Socket
Socket
Sign inDemoInstall

@dfinity/candid

Package Overview
Dependencies
Maintainers
9
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dfinity/candid - npm Package Compare versions

Comparing version 0.10.3 to 0.10.4

24

lib/cjs/candid-ui.js

@@ -57,6 +57,6 @@ "use strict";

input.placeholder = t.display();
return exports.inputBox(t, { input });
return (0, exports.inputBox)(t, { input });
}
visitNull(t, d) {
return exports.inputBox(t, {});
return (0, exports.inputBox)(t, {});
}

@@ -70,4 +70,4 @@ visitRecord(t, fields, d) {

}
const form = exports.recordForm(fields, config);
return exports.inputBox(t, { form });
const form = (0, exports.recordForm)(fields, config);
return (0, exports.inputBox)(t, { form });
}

@@ -81,4 +81,4 @@ visitTuple(t, components, d) {

}
const form = exports.tupleForm(components, config);
return exports.inputBox(t, { form });
const form = (0, exports.tupleForm)(components, config);
return (0, exports.inputBox)(t, { form });
}

@@ -94,4 +94,4 @@ visitVariant(t, fields, d) {

const config = { open: select, event: 'change' };
const form = exports.variantForm(fields, config);
return exports.inputBox(t, { form });
const form = (0, exports.variantForm)(fields, config);
return (0, exports.inputBox)(t, { form });
}

@@ -102,4 +102,4 @@ visitOpt(t, ty, d) {

checkbox.classList.add('open');
const form = exports.optForm(ty, { open: checkbox, event: 'change' });
return exports.inputBox(t, { form });
const form = (0, exports.optForm)(ty, { open: checkbox, event: 'change' });
return (0, exports.inputBox)(t, { form });
}

@@ -116,4 +116,4 @@ visitVec(t, ty, d) {

container.classList.add('popup-form');
const form = exports.vecForm(ty, { open: len, event: 'change', container });
return exports.inputBox(t, { form });
const form = (0, exports.vecForm)(ty, { open: len, event: 'change', container });
return (0, exports.inputBox)(t, { form });
}

@@ -120,0 +120,0 @@ visitRec(t, ty, d) {

@@ -47,5 +47,5 @@ "use strict";

encode() {
const len = leb128_1.lebEncode(this._typs.length);
const buf = buffer_1.concat(...this._typs);
return buffer_1.concat(len, buf);
const len = (0, leb128_1.lebEncode)(this._typs.length);
const buf = (0, buffer_1.concat)(...this._typs);
return (0, buffer_1.concat)(len, buf);
}

@@ -56,3 +56,3 @@ indexOf(typeName) {

}
return leb128_1.slebEncode(this._idx.get(typeName) || 0);
return (0, leb128_1.slebEncode)(this._idx.get(typeName) || 0);
}

@@ -200,3 +200,3 @@ }

encodeType() {
return leb128_1.slebEncode(-17 /* Empty */);
return (0, leb128_1.slebEncode)(-17 /* Empty */);
}

@@ -225,7 +225,7 @@ decodeValue() {

encodeType() {
return leb128_1.slebEncode(-2 /* Bool */);
return (0, leb128_1.slebEncode)(-2 /* Bool */);
}
decodeValue(b, t) {
this.checkType(t);
switch (leb128_1.safeReadUint8(b)) {
switch ((0, leb128_1.safeReadUint8)(b)) {
case 0:

@@ -258,3 +258,3 @@ return false;

encodeType() {
return leb128_1.slebEncode(-1 /* Null */);
return (0, leb128_1.slebEncode)(-1 /* Null */);
}

@@ -284,3 +284,3 @@ decodeValue(b, t) {

encodeType() {
return leb128_1.slebEncode(-16 /* Reserved */);
return (0, leb128_1.slebEncode)(-16 /* Reserved */);
}

@@ -310,12 +310,12 @@ decodeValue(b, t) {

const buf = new TextEncoder().encode(x);
const len = leb128_1.lebEncode(buf.byteLength);
return buffer_1.concat(len, buf);
const len = (0, leb128_1.lebEncode)(buf.byteLength);
return (0, buffer_1.concat)(len, buf);
}
encodeType() {
return leb128_1.slebEncode(-15 /* Text */);
return (0, leb128_1.slebEncode)(-15 /* Text */);
}
decodeValue(b, t) {
this.checkType(t);
const len = leb128_1.lebDecode(b);
const buf = leb128_1.safeRead(b, Number(len));
const len = (0, leb128_1.lebDecode)(b);
const buf = (0, leb128_1.safeRead)(b, Number(len));
const decoder = new TextDecoder('utf8', { fatal: true });

@@ -345,10 +345,10 @@ return decoder.decode(buf);

encodeValue(x) {
return leb128_1.slebEncode(x);
return (0, leb128_1.slebEncode)(x);
}
encodeType() {
return leb128_1.slebEncode(-4 /* Int */);
return (0, leb128_1.slebEncode)(-4 /* Int */);
}
decodeValue(b, t) {
this.checkType(t);
return leb128_1.slebDecode(b);
return (0, leb128_1.slebDecode)(b);
}

@@ -376,10 +376,10 @@ get name() {

encodeValue(x) {
return leb128_1.lebEncode(x);
return (0, leb128_1.lebEncode)(x);
}
encodeType() {
return leb128_1.slebEncode(-3 /* Nat */);
return (0, leb128_1.slebEncode)(-3 /* Nat */);
}
decodeValue(b, t) {
this.checkType(t);
return leb128_1.lebDecode(b);
return (0, leb128_1.lebDecode)(b);
}

@@ -424,7 +424,7 @@ get name() {

const opcode = this._bits === 32 ? -13 /* Float32 */ : -14 /* Float64 */;
return leb128_1.slebEncode(opcode);
return (0, leb128_1.slebEncode)(opcode);
}
decodeValue(b, t) {
this.checkType(t);
const bytes = leb128_1.safeRead(b, this._bits / 8);
const bytes = (0, leb128_1.safeRead)(b, this._bits / 8);
const view = new DataView(bytes);

@@ -472,11 +472,11 @@ if (this._bits === 32) {

encodeValue(x) {
return leb128_2.writeIntLE(x, this._bits / 8);
return (0, leb128_2.writeIntLE)(x, this._bits / 8);
}
encodeType() {
const offset = Math.log2(this._bits) - 3;
return leb128_1.slebEncode(-9 - offset);
return (0, leb128_1.slebEncode)(-9 - offset);
}
decodeValue(b, t) {
this.checkType(t);
const num = leb128_2.readIntLE(b, this._bits / 8);
const num = (0, leb128_2.readIntLE)(b, this._bits / 8);
if (this._bits <= 32) {

@@ -522,11 +522,11 @@ return Number(num);

encodeValue(x) {
return leb128_2.writeUIntLE(x, this.bits / 8);
return (0, leb128_2.writeUIntLE)(x, this.bits / 8);
}
encodeType() {
const offset = Math.log2(this.bits) - 3;
return leb128_1.slebEncode(-5 - offset);
return (0, leb128_1.slebEncode)(-5 - offset);
}
decodeValue(b, t) {
this.checkType(t);
const num = leb128_2.readUIntLE(b, this.bits / 8);
const num = (0, leb128_2.readUIntLE)(b, this.bits / 8);
if (this.bits <= 32) {

@@ -568,13 +568,13 @@ return Number(num);

encodeValue(x) {
const len = leb128_1.lebEncode(x.length);
const len = (0, leb128_1.lebEncode)(x.length);
if (this._blobOptimization) {
return buffer_1.concat(len, new Uint8Array(x));
return (0, buffer_1.concat)(len, new Uint8Array(x));
}
return buffer_1.concat(len, ...x.map(d => this._type.encodeValue(d)));
return (0, buffer_1.concat)(len, ...x.map(d => this._type.encodeValue(d)));
}
_buildTypeTableImpl(typeTable) {
this._type.buildTypeTable(typeTable);
const opCode = leb128_1.slebEncode(-19 /* Vector */);
const opCode = (0, leb128_1.slebEncode)(-19 /* Vector */);
const buffer = this._type.encodeType(typeTable);
typeTable.add(this, buffer_1.concat(opCode, buffer));
typeTable.add(this, (0, buffer_1.concat)(opCode, buffer));
}

@@ -586,3 +586,3 @@ decodeValue(b, t) {

}
const len = Number(leb128_1.lebDecode(b));
const len = Number((0, leb128_1.lebDecode)(b));
if (this._blobOptimization) {

@@ -629,3 +629,3 @@ return [...new Uint8Array(b.read(len))];

else {
return buffer_1.concat(new Uint8Array([1]), this._type.encodeValue(x[0]));
return (0, buffer_1.concat)(new Uint8Array([1]), this._type.encodeValue(x[0]));
}

@@ -635,5 +635,5 @@ }

this._type.buildTypeTable(typeTable);
const opCode = leb128_1.slebEncode(-18 /* Opt */);
const opCode = (0, leb128_1.slebEncode)(-18 /* Opt */);
const buffer = this._type.encodeType(typeTable);
typeTable.add(this, buffer_1.concat(opCode, buffer));
typeTable.add(this, (0, buffer_1.concat)(opCode, buffer));
}

@@ -645,3 +645,3 @@ decodeValue(b, t) {

}
switch (leb128_1.safeReadUint8(b)) {
switch ((0, leb128_1.safeReadUint8)(b)) {
case 0:

@@ -678,3 +678,3 @@ return [];

super();
this._fields = Object.entries(fields).sort((a, b) => hash_1.idlLabelToId(a[0]) - hash_1.idlLabelToId(b[0]));
this._fields = Object.entries(fields).sort((a, b) => (0, hash_1.idlLabelToId)(a[0]) - (0, hash_1.idlLabelToId)(b[0]));
}

@@ -708,10 +708,10 @@ accept(v, d) {

const bufs = zipWith(this._fields, values, ([, c], d) => c.encodeValue(d));
return buffer_1.concat(...bufs);
return (0, buffer_1.concat)(...bufs);
}
_buildTypeTableImpl(T) {
this._fields.forEach(([_, value]) => value.buildTypeTable(T));
const opCode = leb128_1.slebEncode(-20 /* Record */);
const len = leb128_1.lebEncode(this._fields.length);
const fields = this._fields.map(([key, value]) => buffer_1.concat(leb128_1.lebEncode(hash_1.idlLabelToId(key)), value.encodeType(T)));
T.add(this, buffer_1.concat(opCode, len, buffer_1.concat(...fields)));
const opCode = (0, leb128_1.slebEncode)(-20 /* Record */);
const len = (0, leb128_1.lebEncode)(this._fields.length);
const fields = this._fields.map(([key, value]) => (0, buffer_1.concat)((0, leb128_1.lebEncode)((0, hash_1.idlLabelToId)(key)), value.encodeType(T)));
T.add(this, (0, buffer_1.concat)(opCode, len, (0, buffer_1.concat)(...fields)));
}

@@ -726,3 +726,3 @@ decodeValue(b, t) {

for (const [hash, type] of record._fields) {
if (idx >= this._fields.length || hash_1.idlLabelToId(this._fields[idx][0]) !== hash_1.idlLabelToId(hash)) {
if (idx >= this._fields.length || (0, hash_1.idlLabelToId)(this._fields[idx][0]) !== (0, hash_1.idlLabelToId)(hash)) {
// skip field

@@ -784,3 +784,3 @@ type.decodeValue(b, type);

const bufs = zipWith(this._components, x, (c, d) => c.encodeValue(d));
return buffer_1.concat(...bufs);
return (0, buffer_1.concat)(...bufs);
}

@@ -824,3 +824,3 @@ decodeValue(b, t) {

super();
this._fields = Object.entries(fields).sort((a, b) => hash_1.idlLabelToId(a[0]) - hash_1.idlLabelToId(b[0]));
this._fields = Object.entries(fields).sort((a, b) => (0, hash_1.idlLabelToId)(a[0]) - (0, hash_1.idlLabelToId)(b[0]));
}

@@ -843,5 +843,5 @@ accept(v, d) {

if (x.hasOwnProperty(name)) {
const idx = leb128_1.lebEncode(i);
const idx = (0, leb128_1.lebEncode)(i);
const buf = type.encodeValue(x[name]);
return buffer_1.concat(idx, buf);
return (0, buffer_1.concat)(idx, buf);
}

@@ -855,6 +855,6 @@ }

});
const opCode = leb128_1.slebEncode(-21 /* Variant */);
const len = leb128_1.lebEncode(this._fields.length);
const fields = this._fields.map(([key, value]) => buffer_1.concat(leb128_1.lebEncode(hash_1.idlLabelToId(key)), value.encodeType(typeTable)));
typeTable.add(this, buffer_1.concat(opCode, len, ...fields));
const opCode = (0, leb128_1.slebEncode)(-21 /* Variant */);
const len = (0, leb128_1.lebEncode)(this._fields.length);
const fields = this._fields.map(([key, value]) => (0, buffer_1.concat)((0, leb128_1.lebEncode)((0, hash_1.idlLabelToId)(key)), value.encodeType(typeTable)));
typeTable.add(this, (0, buffer_1.concat)(opCode, len, ...fields));
}

@@ -866,3 +866,3 @@ decodeValue(b, t) {

}
const idx = Number(leb128_1.lebDecode(b));
const idx = Number((0, leb128_1.lebDecode)(b));
if (idx >= variant._fields.length) {

@@ -873,3 +873,3 @@ throw Error('Invalid variant index: ' + idx);

for (const [key, expectType] of this._fields) {
if (hash_1.idlLabelToId(wireHash) === hash_1.idlLabelToId(key)) {
if ((0, hash_1.idlLabelToId)(wireHash) === (0, hash_1.idlLabelToId)(key)) {
const value = expectType.decodeValue(b, wireType);

@@ -970,8 +970,8 @@ return { [key]: value };

function decodePrincipalId(b) {
const x = leb128_1.safeReadUint8(b);
const x = (0, leb128_1.safeReadUint8)(b);
if (x !== 1) {
throw new Error('Cannot decode principal');
}
const len = Number(leb128_1.lebDecode(b));
return principal_1.Principal.fromUint8Array(new Uint8Array(leb128_1.safeRead(b, len)));
const len = Number((0, leb128_1.lebDecode)(b));
return principal_1.Principal.fromUint8Array(new Uint8Array((0, leb128_1.safeRead)(b, len)));
}

@@ -990,7 +990,7 @@ /**

const buf = x.toUint8Array();
const len = leb128_1.lebEncode(buf.byteLength);
return buffer_1.concat(new Uint8Array([1]), len, buf);
const len = (0, leb128_1.lebEncode)(buf.byteLength);
return (0, buffer_1.concat)(new Uint8Array([1]), len, buf);
}
encodeType() {
return leb128_1.slebEncode(-24 /* Principal */);
return (0, leb128_1.slebEncode)(-24 /* Principal */);
}

@@ -1036,7 +1036,7 @@ decodeValue(b, t) {

const buf = principal.toUint8Array();
const len = leb128_1.lebEncode(buf.byteLength);
const canister = buffer_1.concat(new Uint8Array([1]), len, buf);
const len = (0, leb128_1.lebEncode)(buf.byteLength);
const canister = (0, buffer_1.concat)(new Uint8Array([1]), len, buf);
const method = new TextEncoder().encode(methodName);
const methodLen = leb128_1.lebEncode(method.byteLength);
return buffer_1.concat(new Uint8Array([1]), canister, methodLen, method);
const methodLen = (0, leb128_1.lebEncode)(method.byteLength);
return (0, buffer_1.concat)(new Uint8Array([1]), canister, methodLen, method);
}

@@ -1046,13 +1046,13 @@ _buildTypeTableImpl(T) {

this.retTypes.forEach(arg => arg.buildTypeTable(T));
const opCode = leb128_1.slebEncode(-22 /* Func */);
const argLen = leb128_1.lebEncode(this.argTypes.length);
const args = buffer_1.concat(...this.argTypes.map(arg => arg.encodeType(T)));
const retLen = leb128_1.lebEncode(this.retTypes.length);
const rets = buffer_1.concat(...this.retTypes.map(arg => arg.encodeType(T)));
const annLen = leb128_1.lebEncode(this.annotations.length);
const anns = buffer_1.concat(...this.annotations.map(a => this.encodeAnnotation(a)));
T.add(this, buffer_1.concat(opCode, argLen, args, retLen, rets, annLen, anns));
const opCode = (0, leb128_1.slebEncode)(-22 /* Func */);
const argLen = (0, leb128_1.lebEncode)(this.argTypes.length);
const args = (0, buffer_1.concat)(...this.argTypes.map(arg => arg.encodeType(T)));
const retLen = (0, leb128_1.lebEncode)(this.retTypes.length);
const rets = (0, buffer_1.concat)(...this.retTypes.map(arg => arg.encodeType(T)));
const annLen = (0, leb128_1.lebEncode)(this.annotations.length);
const anns = (0, buffer_1.concat)(...this.annotations.map(a => this.encodeAnnotation(a)));
T.add(this, (0, buffer_1.concat)(opCode, argLen, args, retLen, rets, annLen, anns));
}
decodeValue(b) {
const x = leb128_1.safeReadUint8(b);
const x = (0, leb128_1.safeReadUint8)(b);
if (x !== 1) {

@@ -1062,4 +1062,4 @@ throw new Error('Cannot decode function reference');

const canister = decodePrincipalId(b);
const mLen = Number(leb128_1.lebDecode(b));
const buf = leb128_1.safeRead(b, mLen);
const mLen = Number((0, leb128_1.lebDecode)(b));
const buf = (0, leb128_1.safeRead)(b, mLen);
const decoder = new TextDecoder('utf8', { fatal: true });

@@ -1100,3 +1100,3 @@ const method = decoder.decode(buf);

super();
this._fields = Object.entries(fields).sort((a, b) => hash_1.idlLabelToId(a[0]) - hash_1.idlLabelToId(b[0]));
this._fields = Object.entries(fields).sort((a, b) => (0, hash_1.idlLabelToId)(a[0]) - (0, hash_1.idlLabelToId)(b[0]));
}

@@ -1111,15 +1111,15 @@ accept(v, d) {

const buf = x.toUint8Array();
const len = leb128_1.lebEncode(buf.length);
return buffer_1.concat(new Uint8Array([1]), len, buf);
const len = (0, leb128_1.lebEncode)(buf.length);
return (0, buffer_1.concat)(new Uint8Array([1]), len, buf);
}
_buildTypeTableImpl(T) {
this._fields.forEach(([_, func]) => func.buildTypeTable(T));
const opCode = leb128_1.slebEncode(-23 /* Service */);
const len = leb128_1.lebEncode(this._fields.length);
const opCode = (0, leb128_1.slebEncode)(-23 /* Service */);
const len = (0, leb128_1.lebEncode)(this._fields.length);
const meths = this._fields.map(([label, func]) => {
const labelBuf = new TextEncoder().encode(label);
const labelLen = leb128_1.lebEncode(labelBuf.length);
return buffer_1.concat(labelLen, labelBuf, func.encodeType(T));
const labelLen = (0, leb128_1.lebEncode)(labelBuf.length);
return (0, buffer_1.concat)(labelLen, labelBuf, func.encodeType(T));
});
T.add(this, buffer_1.concat(opCode, len, ...meths));
T.add(this, (0, buffer_1.concat)(opCode, len, ...meths));
}

@@ -1160,5 +1160,5 @@ decodeValue(b) {

const table = typeTable.encode();
const len = leb128_1.lebEncode(args.length);
const typs = buffer_1.concat(...argTypes.map(t => t.encodeType(typeTable)));
const vals = buffer_1.concat(...zipWith(argTypes, args, (t, x) => {
const len = (0, leb128_1.lebEncode)(args.length);
const typs = (0, buffer_1.concat)(...argTypes.map(t => t.encodeType(typeTable)));
const vals = (0, buffer_1.concat)(...zipWith(argTypes, args, (t, x) => {
if (!t.covariant(x)) {

@@ -1169,3 +1169,3 @@ throw new Error(`Invalid ${t.display()} argument: ${toReadableString(x)}`);

}));
return buffer_1.concat(magic, table, len, typs, vals);
return (0, buffer_1.concat)(magic, table, len, typs, vals);
}

@@ -1184,3 +1184,3 @@ exports.encode = encode;

}
const magicBuffer = leb128_1.safeRead(b, magicNumber.length);
const magicBuffer = (0, leb128_1.safeRead)(b, magicNumber.length);
const magic = new TextDecoder().decode(magicBuffer);

@@ -1192,9 +1192,9 @@ if (magic !== magicNumber) {

const typeTable = [];
const len = Number(leb128_1.lebDecode(pipe));
const len = Number((0, leb128_1.lebDecode)(pipe));
for (let i = 0; i < len; i++) {
const ty = Number(leb128_1.slebDecode(pipe));
const ty = Number((0, leb128_1.slebDecode)(pipe));
switch (ty) {
case -18 /* Opt */:
case -19 /* Vector */: {
const t = Number(leb128_1.slebDecode(pipe));
const t = Number((0, leb128_1.slebDecode)(pipe));
typeTable.push([ty, t]);

@@ -1206,6 +1206,6 @@ break;

const fields = [];
let objectLength = Number(leb128_1.lebDecode(pipe));
let objectLength = Number((0, leb128_1.lebDecode)(pipe));
let prevHash;
while (objectLength--) {
const hash = Number(leb128_1.lebDecode(pipe));
const hash = Number((0, leb128_1.lebDecode)(pipe));
if (hash >= Math.pow(2, 32)) {

@@ -1218,3 +1218,3 @@ throw new Error('field id out of 32-bit range');

prevHash = hash;
const t = Number(leb128_1.slebDecode(pipe));
const t = Number((0, leb128_1.slebDecode)(pipe));
fields.push([hash, t]);

@@ -1227,9 +1227,9 @@ }

for (let k = 0; k < 2; k++) {
let funcLength = Number(leb128_1.lebDecode(pipe));
let funcLength = Number((0, leb128_1.lebDecode)(pipe));
while (funcLength--) {
leb128_1.slebDecode(pipe);
(0, leb128_1.slebDecode)(pipe);
}
}
const annLen = Number(leb128_1.lebDecode(pipe));
leb128_1.safeRead(pipe, annLen);
const annLen = Number((0, leb128_1.lebDecode)(pipe));
(0, leb128_1.safeRead)(pipe, annLen);
typeTable.push([ty, undefined]);

@@ -1239,7 +1239,7 @@ break;

case -23 /* Service */: {
let servLength = Number(leb128_1.lebDecode(pipe));
let servLength = Number((0, leb128_1.lebDecode)(pipe));
while (servLength--) {
const l = Number(leb128_1.lebDecode(pipe));
leb128_1.safeRead(pipe, l);
leb128_1.slebDecode(pipe);
const l = Number((0, leb128_1.lebDecode)(pipe));
(0, leb128_1.safeRead)(pipe, l);
(0, leb128_1.slebDecode)(pipe);
}

@@ -1254,5 +1254,5 @@ typeTable.push([ty, undefined]);

const rawList = [];
const length = Number(leb128_1.lebDecode(pipe));
const length = Number((0, leb128_1.lebDecode)(pipe));
for (let i = 0; i < length; i++) {
rawList.push(Number(leb128_1.slebDecode(pipe)));
rawList.push(Number((0, leb128_1.slebDecode)(pipe)));
}

@@ -1259,0 +1259,0 @@ return [typeTable, rawList];

{
"name": "@dfinity/candid",
"version": "0.10.3",
"version": "0.10.4",
"author": "DFINITY Stiftung <sdk@dfinity.org>",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc