diff options
Diffstat (limited to 'src/bun.js/bindings/generated_classes.zig')
-rw-r--r-- | src/bun.js/bindings/generated_classes.zig | 120 |
1 files changed, 73 insertions, 47 deletions
diff --git a/src/bun.js/bindings/generated_classes.zig b/src/bun.js/bindings/generated_classes.zig index 87ab124ce..c64acbef5 100644 --- a/src/bun.js/bindings/generated_classes.zig +++ b/src/bun.js/bindings/generated_classes.zig @@ -1284,88 +1284,114 @@ pub const JSSHA512_256 = struct { } } }; -pub const JSRIPEMD160 = struct { - const RIPEMD160 = Classes.RIPEMD160; - const GetterType = fn (*RIPEMD160, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const GetterTypeWithThisValue = fn (*RIPEMD160, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; - const SetterType = fn (*RIPEMD160, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const SetterTypeWithThisValue = fn (*RIPEMD160, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; - const CallbackType = fn (*RIPEMD160, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; +pub const JSCryptoHasher = struct { + const CryptoHasher = Classes.CryptoHasher; + const GetterType = fn (*CryptoHasher, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const GetterTypeWithThisValue = fn (*CryptoHasher, JSC.JSValue, *JSC.JSGlobalObject) callconv(.C) JSC.JSValue; + const SetterType = fn (*CryptoHasher, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const SetterTypeWithThisValue = fn (*CryptoHasher, JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) callconv(.C) bool; + const CallbackType = fn (*CryptoHasher, *JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) JSC.JSValue; /// Return the pointer to the wrapped object. /// If the object does not match the type, return null. - pub fn fromJS(value: JSC.JSValue) ?*RIPEMD160 { + pub fn fromJS(value: JSC.JSValue) ?*CryptoHasher { JSC.markBinding(@src()); - return RIPEMD160__fromJS(value); + return CryptoHasher__fromJS(value); } - /// Get the RIPEMD160 constructor value. + extern fn CryptoHasherPrototype__algorithmSetCachedValue(JSC.JSValue, *JSC.JSGlobalObject, JSC.JSValue) void; + + extern fn CryptoHasherPrototype__algorithmGetCachedValue(JSC.JSValue) JSC.JSValue; + + /// `CryptoHasher.algorithm` setter + /// This value will be visited by the garbage collector. + pub fn algorithmSetCached(thisValue: JSC.JSValue, globalObject: *JSC.JSGlobalObject, value: JSC.JSValue) void { + JSC.markBinding(@src()); + CryptoHasherPrototype__algorithmSetCachedValue(thisValue, globalObject, value); + } + + /// `CryptoHasher.algorithm` getter + /// This value will be visited by the garbage collector. + pub fn algorithmGetCached(thisValue: JSC.JSValue) ?JSC.JSValue { + JSC.markBinding(@src()); + const result = CryptoHasherPrototype__algorithmGetCachedValue(thisValue); + if (result == .zero) + return null; + + return result; + } + + /// Get the CryptoHasher constructor value. /// This loads lazily from the global object. pub fn getConstructor(globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); - return RIPEMD160__getConstructor(globalObject); + return CryptoHasher__getConstructor(globalObject); } - /// Create a new instance of RIPEMD160 - pub fn toJS(this: *RIPEMD160, globalObject: *JSC.JSGlobalObject) JSC.JSValue { + /// Create a new instance of CryptoHasher + pub fn toJS(this: *CryptoHasher, globalObject: *JSC.JSGlobalObject) JSC.JSValue { JSC.markBinding(@src()); if (comptime Environment.allow_assert) { - const value__ = RIPEMD160__create(globalObject, this); - std.debug.assert(value__.as(RIPEMD160).? == this); // If this fails, likely a C ABI issue. + const value__ = CryptoHasher__create(globalObject, this); + std.debug.assert(value__.as(CryptoHasher).? == this); // If this fails, likely a C ABI issue. return value__; } else { - return RIPEMD160__create(globalObject, this); + return CryptoHasher__create(globalObject, this); } } - /// Modify the internal ptr to point to a new instance of RIPEMD160. - pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*RIPEMD160) bool { + /// Modify the internal ptr to point to a new instance of CryptoHasher. + pub fn dangerouslySetPtr(value: JSC.JSValue, ptr: ?*CryptoHasher) bool { JSC.markBinding(@src()); - return RIPEMD160__dangerouslySetPtr(value, ptr); + return CryptoHasher__dangerouslySetPtr(value, ptr); } /// Detach the ptr from the thisValue - pub fn detachPtr(_: *RIPEMD160, value: JSC.JSValue) void { + pub fn detachPtr(_: *CryptoHasher, value: JSC.JSValue) void { JSC.markBinding(@src()); - std.debug.assert(RIPEMD160__dangerouslySetPtr(value, null)); + std.debug.assert(CryptoHasher__dangerouslySetPtr(value, null)); } - extern fn RIPEMD160__fromJS(JSC.JSValue) ?*RIPEMD160; - extern fn RIPEMD160__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; + extern fn CryptoHasher__fromJS(JSC.JSValue) ?*CryptoHasher; + extern fn CryptoHasher__getConstructor(*JSC.JSGlobalObject) JSC.JSValue; - extern fn RIPEMD160__create(globalObject: *JSC.JSGlobalObject, ptr: ?*RIPEMD160) JSC.JSValue; + extern fn CryptoHasher__create(globalObject: *JSC.JSGlobalObject, ptr: ?*CryptoHasher) JSC.JSValue; - extern fn RIPEMD160__dangerouslySetPtr(JSC.JSValue, ?*RIPEMD160) bool; + extern fn CryptoHasher__dangerouslySetPtr(JSC.JSValue, ?*CryptoHasher) bool; comptime { - if (@TypeOf(RIPEMD160.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*RIPEMD160)) { - @compileLog("RIPEMD160.constructor is not a constructor"); + if (@TypeOf(CryptoHasher.constructor) != (fn (*JSC.JSGlobalObject, *JSC.CallFrame) callconv(.C) ?*CryptoHasher)) { + @compileLog("CryptoHasher.constructor is not a constructor"); } - if (@TypeOf(RIPEMD160.finalize) != (fn (*RIPEMD160) callconv(.C) void)) { - @compileLog("RIPEMD160.finalize is not a finalizer"); + if (@TypeOf(CryptoHasher.finalize) != (fn (*CryptoHasher) callconv(.C) void)) { + @compileLog("CryptoHasher.finalize is not a finalizer"); } - if (@TypeOf(RIPEMD160.getByteLength) != GetterType) - @compileLog("Expected RIPEMD160.getByteLength to be a getter"); + if (@TypeOf(CryptoHasher.getAlgorithm) != GetterType) + @compileLog("Expected CryptoHasher.getAlgorithm to be a getter"); + + if (@TypeOf(CryptoHasher.getByteLength) != GetterType) + @compileLog("Expected CryptoHasher.getByteLength to be a getter"); - if (@TypeOf(RIPEMD160.digest) != CallbackType) - @compileLog("Expected RIPEMD160.digest to be a callback but received " ++ @typeName(@TypeOf(RIPEMD160.digest))); - if (@TypeOf(RIPEMD160.update) != CallbackType) - @compileLog("Expected RIPEMD160.update to be a callback but received " ++ @typeName(@TypeOf(RIPEMD160.update))); - if (@TypeOf(RIPEMD160.getByteLengthStatic) != StaticGetterType) - @compileLog("Expected RIPEMD160.getByteLengthStatic to be a static getter"); + if (@TypeOf(CryptoHasher.digest) != CallbackType) + @compileLog("Expected CryptoHasher.digest to be a callback but received " ++ @typeName(@TypeOf(CryptoHasher.digest))); + if (@TypeOf(CryptoHasher.update) != CallbackType) + @compileLog("Expected CryptoHasher.update to be a callback but received " ++ @typeName(@TypeOf(CryptoHasher.update))); + if (@TypeOf(CryptoHasher.getAlgorithms) != StaticGetterType) + @compileLog("Expected CryptoHasher.getAlgorithms to be a static getter"); - if (@TypeOf(RIPEMD160.hash) != StaticCallbackType) - @compileLog("Expected RIPEMD160.hash to be a static callback"); + if (@TypeOf(CryptoHasher.hash) != StaticCallbackType) + @compileLog("Expected CryptoHasher.hash to be a static callback"); if (!JSC.is_bindgen) { - @export(RIPEMD160.constructor, .{ .name = "RIPEMD160Class__construct" }); - @export(RIPEMD160.digest, .{ .name = "RIPEMD160Prototype__digest" }); - @export(RIPEMD160.finalize, .{ .name = "RIPEMD160Class__finalize" }); - @export(RIPEMD160.getByteLength, .{ .name = "RIPEMD160Prototype__getByteLength" }); - @export(RIPEMD160.getByteLengthStatic, .{ .name = "RIPEMD160Class__getByteLengthStatic" }); - @export(RIPEMD160.hash, .{ .name = "RIPEMD160Class__hash" }); - @export(RIPEMD160.update, .{ .name = "RIPEMD160Prototype__update" }); + @export(CryptoHasher.constructor, .{ .name = "CryptoHasherClass__construct" }); + @export(CryptoHasher.digest, .{ .name = "CryptoHasherPrototype__digest" }); + @export(CryptoHasher.finalize, .{ .name = "CryptoHasherClass__finalize" }); + @export(CryptoHasher.getAlgorithm, .{ .name = "CryptoHasherPrototype__getAlgorithm" }); + @export(CryptoHasher.getAlgorithms, .{ .name = "CryptoHasherClass__getAlgorithms" }); + @export(CryptoHasher.getByteLength, .{ .name = "CryptoHasherPrototype__getByteLength" }); + @export(CryptoHasher.hash, .{ .name = "CryptoHasherClass__hash" }); + @export(CryptoHasher.update, .{ .name = "CryptoHasherPrototype__update" }); } } }; @@ -3276,7 +3302,7 @@ comptime { _ = JSSHA384; _ = JSSHA256; _ = JSSHA512_256; - _ = JSRIPEMD160; + _ = JSCryptoHasher; _ = JSServerWebSocket; _ = JSFileSystemRouter; _ = JSMatchedRoute; |