@junobuild/config 2.8.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.mjs.map +1 -1
- package/dist/types/cli/run.d.ts +22 -22
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/cli/run.ts", "../../src/utils/zod.utils.ts", "../../src/cli/run.context.ts", "../../src/utils/identity.utils.ts", "../../src/utils/principal.utils.ts", "../../../../node_modules/@
|
|
3
|
+
"sources": ["../../src/cli/run.ts", "../../src/utils/zod.utils.ts", "../../src/cli/run.context.ts", "../../src/utils/identity.utils.ts", "../../src/utils/principal.utils.ts", "../../../../node_modules/@icp-sdk/core/src/principal/utils/base32.ts", "../../../../node_modules/@icp-sdk/core/src/principal/utils/getCrc.ts", "../../../../node_modules/@noble/hashes/src/utils.ts", "../../../../node_modules/@noble/hashes/src/_md.ts", "../../../../node_modules/@noble/hashes/src/sha2.ts", "../../../../node_modules/@icp-sdk/core/src/principal/principal.ts", "../../src/cli/run.env.ts", "../../src/types/juno.env.ts", "../../src/console/config.ts", "../../src/console/console.config.ts", "../../src/shared/authentication.config.ts", "../../src/shared/storage.config.ts", "../../src/shared/feature.config.ts", "../../src/types/cli.config.ts", "../../src/types/encoding.ts", "../../src/pkg/juno.package.ts", "../../src/pkg/juno.package.constants.ts", "../../src/satellite/config.ts", "../../src/satellite/configs/assertions.config.ts", "../../src/satellite/configs/collections.ts", "../../src/satellite/configs/rules.ts", "../../src/satellite/configs/datastore.config.ts", "../../src/satellite/configs/emulator.config.ts", "../../src/satellite/constants/emulator.constants.ts", "../../src/satellite/validators/emulator.validators.ts", "../../src/satellite/configs/module.settings.ts", "../../src/satellite/configs/orbiter.config.ts", "../../src/satellite/configs/satellite.config.ts", "../../src/satellite/juno.config.ts"],
|
|
4
4
|
"sourcesContent": ["import * as z from 'zod';\nimport {createFunctionSchema} from '../utils/zod.utils';\nimport {type OnRun, OnRunContextSchema, OnRunSchema} from './run.context';\nimport type {OnRunEnv} from './run.env';\n\nexport const RunFnSchema = z.function({\n input: z.tuple([OnRunContextSchema]),\n output: OnRunSchema\n});\nexport type RunFn = (context: OnRunEnv) => OnRun;\n\nexport const RunFnOrObjectSchema = z.union([OnRunSchema, createFunctionSchema(RunFnSchema)]);\nexport type RunFnOrObject = OnRun | RunFn;\n\nexport function defineRun(run: OnRun): OnRun;\nexport function defineRun(run: RunFn): RunFn;\nexport function defineRun(run: RunFnOrObject): RunFnOrObject;\nexport function defineRun(run: RunFnOrObject): RunFnOrObject {\n return run;\n}\n", "import * as z from 'zod';\n\n/**\n * Wraps a Zod function schema so that parsing returns the **original function**\n * instead of Zod's wrapped validator.\n *\n * Why?\n * ----\n * In Zod v4, `z.function({...})` normally returns a wrapper that validates\n * both arguments and the return value **every time the function is called**.\n * If your function's return type is `void | Promise<void>`, Zod tries to\n * validate it synchronously, which can throw\n * \"Encountered Promise during synchronous parse\"\n * when the implementation is async.\n *\n * By using `.implement`, we tell Zod: \u201Cthis is the function that satisfies\n * the schema.\u201D That way the schema still validates the function shape at\n * parse time, but the returned value is the **original function** you passed\n * in \u2014 no runtime wrapper, no sync/async mismatch.\n *\n * Reference:\n * https://github.com/colinhacks/zod/issues/4143#issuecomment-2845134912*\n */\n// TODO: Duplicates the helper in @junobuild/functions.\nexport const createFunctionSchema = <T extends z.ZodFunction>(schema: T) =>\n z.custom<Parameters<T['implement']>[0]>((fn) =>\n schema.implement(fn as Parameters<T['implement']>[0])\n );\n", "import type {Identity} from '@icp-sdk/core/agent';\nimport type {Principal} from '@icp-sdk/core/principal';\nimport * as z from 'zod';\nimport {StrictIdentitySchema} from '../utils/identity.utils';\nimport {StrictPrincipalSchema} from '../utils/principal.utils';\nimport {createFunctionSchema} from '../utils/zod.utils';\n\n/**\n * @see OnRunContext\n */\nexport const OnRunContextSchema = z.strictObject({\n satelliteId: StrictPrincipalSchema,\n orbiterId: StrictPrincipalSchema.optional(),\n identity: StrictIdentitySchema,\n container: z.string().optional()\n});\n\n/**\n * The context for running a task.\n */\nexport interface OnRunContext {\n /**\n * The Satellite ID as defined in the `juno.config` file.\n *\n * A {@link Principal} instance.\n */\n satelliteId: Principal;\n\n /**\n * The Orbiter ID as defined in the `juno.config` file (if defined).\n *\n * A {@link Principal} instance.\n */\n orbiterId?: Principal;\n\n /**\n * The {@link Identity} used by the CLI for this execution,\n * resolved according to the selected mode and profile.\n */\n identity: Identity;\n\n /**\n * A custom container URL. Useful when your local emulator runs on a non-default URL or port.\n * @type {string}\n * @optional\n */\n container?: string;\n}\n\n/**\n * @see RunFunction\n */\nconst RunFunctionSchema = z.function({\n input: z.tuple([OnRunContextSchema]),\n output: z.promise(z.void()).or(z.void())\n});\n/**\n * The function executed by a task.\n */\nexport type RunFunction = (context: OnRunContext) => void | Promise<void>;\n\n/**\n * @see OnRun\n */\nexport const OnRunSchema = z.strictObject({\n run: createFunctionSchema(RunFunctionSchema)\n});\n\n/**\n * A runner (job) executed with `juno run`.\n */\nexport interface OnRun {\n /**\n * The function that will be executed and called with parameters\n * inherited from your configuration and CLI.\n */\n run: RunFunction;\n}\n", "import * as z from 'zod';\nimport {StrictPrincipalSchema} from './principal.utils';\n\n/**\n * Ensures an unknown object is an identity.\n */\nexport const StrictIdentitySchema = z\n .unknown()\n .refine(\n (val) =>\n val !== undefined &&\n val !== null &&\n typeof val === 'object' &&\n 'transformRequest' in val &&\n typeof val.transformRequest === 'function' &&\n 'getPrincipal' in val &&\n typeof val.getPrincipal === 'function' &&\n StrictPrincipalSchema.safeParse(val.getPrincipal()).success,\n {\n message: 'Invalid Identity'\n }\n );\n", "import {PrincipalTextSchema} from '@dfinity/zod-schemas';\nimport {Principal} from '@icp-sdk/core/principal';\nimport * as z from 'zod';\n\n/**\n * Ensures reliable validation of PrincipalTextSchema inside z.record.\n */\nexport const StrictPrincipalTextSchema = z\n .string()\n .refine((val) => PrincipalTextSchema.safeParse(val).success, {\n message: 'Invalid textual representation of a Principal.'\n });\n\n/**\n * Ensures an unknown type is a Principal.\n */\n// eslint-disable-next-line local-rules/prefer-object-params\nexport const StrictPrincipalSchema = z.unknown().transform((val, ctx): Principal => {\n if (Principal.isPrincipal(val)) {\n return Principal.from(val);\n }\n\n ctx.issues.push({\n code: 'custom',\n message: 'Invalid Principal',\n input: val\n });\n\n return z.NEVER;\n});\n", "const alphabet = 'abcdefghijklmnopqrstuvwxyz234567';\n\n// Build a lookup table for decoding.\nconst lookupTable: Record<string, number> = Object.create(null);\nfor (let i = 0; i < alphabet.length; i++) {\n lookupTable[alphabet[i]] = i;\n}\n\n// Add aliases for rfc4648.\nlookupTable['0'] = lookupTable.o;\nlookupTable['1'] = lookupTable.i;\n\n/**\n * @param input The Uint8Array to encode.\n * @returns A Base32 string encoding the input.\n */\nexport function base32Encode(input: Uint8Array): string {\n // How many bits will we skip from the first byte.\n let skip = 0;\n // 5 high bits, carry from one byte to the next.\n let bits = 0;\n\n // The output string in base32.\n let output = '';\n\n function encodeByte(byte: number) {\n if (skip < 0) {\n // we have a carry from the previous byte\n bits |= byte >> -skip;\n } else {\n // no carry\n bits = (byte << skip) & 248;\n }\n\n if (skip > 3) {\n // Not enough data to produce a character, get us another one\n skip -= 8;\n return 1;\n }\n\n if (skip < 4) {\n // produce a character\n output += alphabet[bits >> 3];\n skip += 5;\n }\n\n return 0;\n }\n\n for (let i = 0; i < input.length; ) {\n i += encodeByte(input[i]);\n }\n\n return output + (skip < 0 ? alphabet[bits >> 3] : '');\n}\n\n/**\n * @param input The base32 encoded string to decode.\n */\nexport function base32Decode(input: string): Uint8Array {\n // how many bits we have from the previous character.\n let skip = 0;\n // current byte we're producing.\n let byte = 0;\n\n const output = new Uint8Array(((input.length * 4) / 3) | 0);\n let o = 0;\n\n function decodeChar(char: string) {\n // Consume a character from the stream, store\n // the output in this.output. As before, better\n // to use update().\n let val = lookupTable[char.toLowerCase()];\n if (val === undefined) {\n throw new Error(`Invalid character: ${JSON.stringify(char)}`);\n }\n\n // move to the high bits\n val <<= 3;\n byte |= val >>> skip;\n skip += 5;\n\n if (skip >= 8) {\n // We have enough bytes to produce an output\n output[o++] = byte;\n skip -= 8;\n\n if (skip > 0) {\n byte = (val << (5 - skip)) & 255;\n } else {\n byte = 0;\n }\n }\n }\n\n for (const c of input) {\n decodeChar(c);\n }\n\n return output.slice(0, o);\n}\n", "// This file is translated to JavaScript from\n// https://lxp32.github.io/docs/a-simple-example-crc32-calculation/\nconst lookUpTable: Uint32Array = new Uint32Array([\n 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,\n 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,\n 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,\n 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,\n 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,\n 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,\n 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,\n 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,\n 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,\n 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,\n 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,\n 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,\n 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,\n 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,\n 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,\n 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,\n 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,\n 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,\n 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,\n 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,\n 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,\n 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,\n 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,\n 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,\n 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,\n 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,\n 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,\n 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,\n 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,\n 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,\n 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,\n 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,\n]);\n\n/**\n * Calculate the CRC32 of a Uint8Array.\n * @param buf The Uint8Array to calculate the CRC32 of.\n */\nexport function getCrc32(buf: Uint8Array): number {\n let crc = -1;\n\n for (let i = 0; i < buf.length; i++) {\n const byte = buf[i];\n const t = (byte ^ crc) & 0xff;\n crc = lookUpTable[t] ^ (crc >>> 8);\n }\n\n return (crc ^ -1) >>> 0;\n}\n", "/**\n * Utilities for hex, bytes, CSPRNG.\n * @module\n */\n/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\n\n/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */\nexport function isBytes(a: unknown): a is Uint8Array {\n return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');\n}\n\n/** Asserts something is positive integer. */\nexport function anumber(n: number): void {\n if (!Number.isSafeInteger(n) || n < 0) throw new Error('positive integer expected, got ' + n);\n}\n\n/** Asserts something is Uint8Array. */\nexport function abytes(b: Uint8Array | undefined, ...lengths: number[]): void {\n if (!isBytes(b)) throw new Error('Uint8Array expected');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);\n}\n\n/** Asserts something is hash */\nexport function ahash(h: IHash): void {\n if (typeof h !== 'function' || typeof h.create !== 'function')\n throw new Error('Hash should be wrapped by utils.createHasher');\n anumber(h.outputLen);\n anumber(h.blockLen);\n}\n\n/** Asserts a hash instance has not been destroyed / finished */\nexport function aexists(instance: any, checkFinished = true): void {\n if (instance.destroyed) throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called');\n}\n\n/** Asserts output is properly-sized byte array */\nexport function aoutput(out: any, instance: any): void {\n abytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error('digestInto() expects output buffer of length at least ' + min);\n }\n}\n\n/** Generic type encompassing 8/16/32-byte arrays - but not 64-byte. */\n// prettier-ignore\nexport type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array |\n Uint16Array | Int16Array | Uint32Array | Int32Array;\n\n/** Cast u8 / u16 / u32 to u8. */\nexport function u8(arr: TypedArray): Uint8Array {\n return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n\n/** Cast u8 / u16 / u32 to u32. */\nexport function u32(arr: TypedArray): Uint32Array {\n return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n}\n\n/** Zeroize a byte array. Warning: JS provides no guarantees. */\nexport function clean(...arrays: TypedArray[]): void {\n for (let i = 0; i < arrays.length; i++) {\n arrays[i].fill(0);\n }\n}\n\n/** Create DataView of an array for easy byte-level manipulation. */\nexport function createView(arr: TypedArray): DataView {\n return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n\n/** The rotate right (circular right shift) operation for uint32 */\nexport function rotr(word: number, shift: number): number {\n return (word << (32 - shift)) | (word >>> shift);\n}\n\n/** The rotate left (circular left shift) operation for uint32 */\nexport function rotl(word: number, shift: number): number {\n return (word << shift) | ((word >>> (32 - shift)) >>> 0);\n}\n\n/** Is current platform little-endian? Most are. Big-Endian platform: IBM */\nexport const isLE: boolean = /* @__PURE__ */ (() =>\n new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();\n\n/** The byte swap operation for uint32 */\nexport function byteSwap(word: number): number {\n return (\n ((word << 24) & 0xff000000) |\n ((word << 8) & 0xff0000) |\n ((word >>> 8) & 0xff00) |\n ((word >>> 24) & 0xff)\n );\n}\n/** Conditionally byte swap if on a big-endian platform */\nexport const swap8IfBE: (n: number) => number = isLE\n ? (n: number) => n\n : (n: number) => byteSwap(n);\n\n/** @deprecated */\nexport const byteSwapIfBE: typeof swap8IfBE = swap8IfBE;\n/** In place byte swap for Uint32Array */\nexport function byteSwap32(arr: Uint32Array): Uint32Array {\n for (let i = 0; i < arr.length; i++) {\n arr[i] = byteSwap(arr[i]);\n }\n return arr;\n}\n\nexport const swap32IfBE: (u: Uint32Array) => Uint32Array = isLE\n ? (u: Uint32Array) => u\n : byteSwap32;\n\n// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex\nconst hasHexBuiltin: boolean = /* @__PURE__ */ (() =>\n // @ts-ignore\n typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();\n\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) =>\n i.toString(16).padStart(2, '0')\n);\n\n/**\n * Convert byte array to hex string. Uses built-in function, when available.\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes: Uint8Array): string {\n abytes(bytes);\n // @ts-ignore\n if (hasHexBuiltin) return bytes.toHex();\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 } as const;\nfunction asciiToBase16(ch: number): number | undefined {\n if (ch >= asciis._0 && ch <= asciis._9) return ch - asciis._0; // '2' => 50-48\n if (ch >= asciis.A && ch <= asciis.F) return ch - (asciis.A - 10); // 'B' => 66-(65-10)\n if (ch >= asciis.a && ch <= asciis.f) return ch - (asciis.a - 10); // 'b' => 98-(97-10)\n return;\n}\n\n/**\n * Convert hex string to byte array. Uses built-in function, when available.\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex: string): Uint8Array {\n if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex);\n // @ts-ignore\n if (hasHexBuiltin) return Uint8Array.fromHex(hex);\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2) throw new Error('hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163\n }\n return array;\n}\n\n/**\n * There is no setImmediate in browser and setTimeout is slow.\n * Call of async fn will return Promise, which will be fullfiled only on\n * next scheduler queue processing step and this is exactly what we need.\n */\nexport const nextTick = async (): Promise<void> => {};\n\n/** Returns control to thread each 'tick' ms to avoid blocking. */\nexport async function asyncLoop(\n iters: number,\n tick: number,\n cb: (i: number) => void\n): Promise<void> {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick) continue;\n await nextTick();\n ts += diff;\n }\n}\n\n// Global symbols, but ts doesn't see them: https://github.com/microsoft/TypeScript/issues/31535\ndeclare const TextEncoder: any;\ndeclare const TextDecoder: any;\n\n/**\n * Converts string to bytes using UTF8 encoding.\n * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])\n */\nexport function utf8ToBytes(str: string): Uint8Array {\n if (typeof str !== 'string') throw new Error('string expected');\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n\n/**\n * Converts bytes to string using UTF8 encoding.\n * @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc'\n */\nexport function bytesToUtf8(bytes: Uint8Array): string {\n return new TextDecoder().decode(bytes);\n}\n\n/** Accepted input of hash functions. Strings are converted to byte arrays. */\nexport type Input = string | Uint8Array;\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data: Input): Uint8Array {\n if (typeof data === 'string') data = utf8ToBytes(data);\n abytes(data);\n return data;\n}\n\n/** KDFs can accept string or Uint8Array for user convenience. */\nexport type KDFInput = string | Uint8Array;\n/**\n * Helper for KDFs: consumes uint8array or string.\n * When string is passed, does utf8 decoding, using TextDecoder.\n */\nexport function kdfInputToBytes(data: KDFInput): Uint8Array {\n if (typeof data === 'string') data = utf8ToBytes(data);\n abytes(data);\n return data;\n}\n\n/** Copies several Uint8Arrays into one. */\nexport function concatBytes(...arrays: Uint8Array[]): Uint8Array {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n abytes(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n\ntype EmptyObj = {};\nexport function checkOpts<T1 extends EmptyObj, T2 extends EmptyObj>(\n defaults: T1,\n opts?: T2\n): T1 & T2 {\n if (opts !== undefined && {}.toString.call(opts) !== '[object Object]')\n throw new Error('options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged as T1 & T2;\n}\n\n/** Hash interface. */\nexport type IHash = {\n (data: Uint8Array): Uint8Array;\n blockLen: number;\n outputLen: number;\n create: any;\n};\n\n/** For runtime check if class implements interface */\nexport abstract class Hash<T extends Hash<T>> {\n abstract blockLen: number; // Bytes per block\n abstract outputLen: number; // Bytes in output\n abstract update(buf: Input): this;\n // Writes digest into buf\n abstract digestInto(buf: Uint8Array): void;\n abstract digest(): Uint8Array;\n /**\n * Resets internal state. Makes Hash instance unusable.\n * Reset is impossible for keyed hashes if key is consumed into state. If digest is not consumed\n * by user, they will need to manually call `destroy()` when zeroing is necessary.\n */\n abstract destroy(): void;\n /**\n * Clones hash instance. Unsafe: doesn't check whether `to` is valid. Can be used as `clone()`\n * when no options are passed.\n * Reasons to use `_cloneInto` instead of clone: 1) performance 2) reuse instance => all internal\n * buffers are overwritten => causes buffer overwrite which is used for digest in some cases.\n * There are no guarantees for clean-up because it's impossible in JS.\n */\n abstract _cloneInto(to?: T): T;\n // Safe version that clones internal state\n abstract clone(): T;\n}\n\n/**\n * XOF: streaming API to read digest in chunks.\n * Same as 'squeeze' in keccak/k12 and 'seek' in blake3, but more generic name.\n * When hash used in XOF mode it is up to user to call '.destroy' afterwards, since we cannot\n * destroy state, next call can require more bytes.\n */\nexport type HashXOF<T extends Hash<T>> = Hash<T> & {\n xof(bytes: number): Uint8Array; // Read 'bytes' bytes from digest stream\n xofInto(buf: Uint8Array): Uint8Array; // read buf.length bytes from digest stream into buf\n};\n\n/** Hash function */\nexport type CHash = ReturnType<typeof createHasher>;\n/** Hash function with output */\nexport type CHashO = ReturnType<typeof createOptHasher>;\n/** XOF with output */\nexport type CHashXO = ReturnType<typeof createXOFer>;\n\n/** Wraps hash function, creating an interface on top of it */\nexport function createHasher<T extends Hash<T>>(\n hashCons: () => Hash<T>\n): {\n (msg: Input): Uint8Array;\n outputLen: number;\n blockLen: number;\n create(): Hash<T>;\n} {\n const hashC = (msg: Input): Uint8Array => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\n\nexport function createOptHasher<H extends Hash<H>, T extends Object>(\n hashCons: (opts?: T) => Hash<H>\n): {\n (msg: Input, opts?: T): Uint8Array;\n outputLen: number;\n blockLen: number;\n create(opts?: T): Hash<H>;\n} {\n const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({} as T);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts?: T) => hashCons(opts);\n return hashC;\n}\n\nexport function createXOFer<H extends HashXOF<H>, T extends Object>(\n hashCons: (opts?: T) => HashXOF<H>\n): {\n (msg: Input, opts?: T): Uint8Array;\n outputLen: number;\n blockLen: number;\n create(opts?: T): HashXOF<H>;\n} {\n const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({} as T);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts?: T) => hashCons(opts);\n return hashC;\n}\nexport const wrapConstructor: typeof createHasher = createHasher;\nexport const wrapConstructorWithOpts: typeof createOptHasher = createOptHasher;\nexport const wrapXOFConstructorWithOpts: typeof createXOFer = createXOFer;\n\n/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */\nexport function randomBytes(bytesLength = 32): Uint8Array {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n // Legacy Node.js compatibility\n if (crypto && typeof crypto.randomBytes === 'function') {\n return Uint8Array.from(crypto.randomBytes(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n", "/**\n * Internal Merkle-Damgard hash utils.\n * @module\n */\nimport { type Input, Hash, abytes, aexists, aoutput, clean, createView, toBytes } from './utils.ts';\n\n/** Polyfill for Safari 14. https://caniuse.com/mdn-javascript_builtins_dataview_setbiguint64 */\nexport function setBigUint64(\n view: DataView,\n byteOffset: number,\n value: bigint,\n isLE: boolean\n): void {\n if (typeof view.setBigUint64 === 'function') return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n\n/** Choice: a ? b : c */\nexport function Chi(a: number, b: number, c: number): number {\n return (a & b) ^ (~a & c);\n}\n\n/** Majority function, true if any two inputs is true. */\nexport function Maj(a: number, b: number, c: number): number {\n return (a & b) ^ (a & c) ^ (b & c);\n}\n\n/**\n * Merkle-Damgard hash construction base class.\n * Could be used to create MD5, RIPEMD, SHA1, SHA2.\n */\nexport abstract class HashMD<T extends HashMD<T>> extends Hash<T> {\n protected abstract process(buf: DataView, offset: number): void;\n protected abstract get(): number[];\n protected abstract set(...args: number[]): void;\n abstract destroy(): void;\n protected abstract roundClean(): void;\n\n readonly blockLen: number;\n readonly outputLen: number;\n readonly padOffset: number;\n readonly isLE: boolean;\n\n // For partial updates less than block size\n protected buffer: Uint8Array;\n protected view: DataView;\n protected finished = false;\n protected length = 0;\n protected pos = 0;\n protected destroyed = false;\n\n constructor(blockLen: number, outputLen: number, padOffset: number, isLE: boolean) {\n super();\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data: Input): this {\n aexists(this);\n data = toBytes(data);\n abytes(data);\n const { view, buffer, blockLen } = this;\n const len = data.length;\n for (let pos = 0; pos < len; ) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen) this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out: Uint8Array): void {\n aexists(this);\n aoutput(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n clean(this.buffer.subarray(pos));\n // we have less than padOffset left in buffer, so we cannot put length in\n // current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++) buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n if (len % 4) throw new Error('_sha2: outputLen should be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length) throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE);\n }\n digest(): Uint8Array {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to?: T): T {\n to ||= new (this.constructor as any)() as T;\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.destroyed = destroyed;\n to.finished = finished;\n to.length = length;\n to.pos = pos;\n if (length % blockLen) to.buffer.set(buffer);\n return to;\n }\n clone(): T {\n return this._cloneInto();\n }\n}\n\n/**\n * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.\n * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.\n */\n\n/** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */\nexport const SHA256_IV: Uint32Array = /* @__PURE__ */ Uint32Array.from([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,\n]);\n\n/** Initial SHA224 state. Bits 32..64 of frac part of sqrt of primes 23..53 */\nexport const SHA224_IV: Uint32Array = /* @__PURE__ */ Uint32Array.from([\n 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4,\n]);\n\n/** Initial SHA384 state. Bits 0..64 of frac part of sqrt of primes 23..53 */\nexport const SHA384_IV: Uint32Array = /* @__PURE__ */ Uint32Array.from([\n 0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939,\n 0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4,\n]);\n\n/** Initial SHA512 state. Bits 0..64 of frac part of sqrt of primes 2..19 */\nexport const SHA512_IV: Uint32Array = /* @__PURE__ */ Uint32Array.from([\n 0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1,\n 0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179,\n]);\n", "/**\n * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.\n * SHA256 is the fastest hash implementable in JS, even faster than Blake3.\n * Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and\n * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).\n * @module\n */\nimport { Chi, HashMD, Maj, SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from './_md.ts';\nimport * as u64 from './_u64.ts';\nimport { type CHash, clean, createHasher, rotr } from './utils.ts';\n\n/**\n * Round constants:\n * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)\n */\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ Uint32Array.from([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n\n/** Reusable temporary buffer. \"W\" comes straight from spec. */\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\nexport class SHA256 extends HashMD<SHA256> {\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n protected A: number = SHA256_IV[0] | 0;\n protected B: number = SHA256_IV[1] | 0;\n protected C: number = SHA256_IV[2] | 0;\n protected D: number = SHA256_IV[3] | 0;\n protected E: number = SHA256_IV[4] | 0;\n protected F: number = SHA256_IV[5] | 0;\n protected G: number = SHA256_IV[6] | 0;\n protected H: number = SHA256_IV[7] | 0;\n\n constructor(outputLen: number = 32) {\n super(64, outputLen, 8, false);\n }\n protected get(): [number, number, number, number, number, number, number, number] {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n protected set(\n A: number, B: number, C: number, D: number, E: number, F: number, G: number, H: number\n ): void {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n protected process(view: DataView, offset: number): void {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n protected roundClean(): void {\n clean(SHA256_W);\n }\n destroy(): void {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n clean(this.buffer);\n }\n}\n\nexport class SHA224 extends SHA256 {\n protected A: number = SHA224_IV[0] | 0;\n protected B: number = SHA224_IV[1] | 0;\n protected C: number = SHA224_IV[2] | 0;\n protected D: number = SHA224_IV[3] | 0;\n protected E: number = SHA224_IV[4] | 0;\n protected F: number = SHA224_IV[5] | 0;\n protected G: number = SHA224_IV[6] | 0;\n protected H: number = SHA224_IV[7] | 0;\n constructor() {\n super(28);\n }\n}\n\n// SHA2-512 is slower than sha256 in js because u64 operations are slow.\n\n// Round contants\n// First 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409\n// prettier-ignore\nconst K512 = /* @__PURE__ */ (() => u64.split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\nconst SHA512_Kh = /* @__PURE__ */ (() => K512[0])();\nconst SHA512_Kl = /* @__PURE__ */ (() => K512[1])();\n\n// Reusable temporary buffers\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\n\nexport class SHA512 extends HashMD<SHA512> {\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n // h -- high 32 bits, l -- low 32 bits\n protected Ah: number = SHA512_IV[0] | 0;\n protected Al: number = SHA512_IV[1] | 0;\n protected Bh: number = SHA512_IV[2] | 0;\n protected Bl: number = SHA512_IV[3] | 0;\n protected Ch: number = SHA512_IV[4] | 0;\n protected Cl: number = SHA512_IV[5] | 0;\n protected Dh: number = SHA512_IV[6] | 0;\n protected Dl: number = SHA512_IV[7] | 0;\n protected Eh: number = SHA512_IV[8] | 0;\n protected El: number = SHA512_IV[9] | 0;\n protected Fh: number = SHA512_IV[10] | 0;\n protected Fl: number = SHA512_IV[11] | 0;\n protected Gh: number = SHA512_IV[12] | 0;\n protected Gl: number = SHA512_IV[13] | 0;\n protected Hh: number = SHA512_IV[14] | 0;\n protected Hl: number = SHA512_IV[15] | 0;\n\n constructor(outputLen: number = 64) {\n super(128, outputLen, 16, false);\n }\n // prettier-ignore\n protected get(): [\n number, number, number, number, number, number, number, number,\n number, number, number, number, number, number, number, number\n ] {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n protected set(\n Ah: number, Al: number, Bh: number, Bl: number, Ch: number, Cl: number, Dh: number, Dl: number,\n Eh: number, El: number, Fh: number, Fl: number, Gh: number, Gl: number, Hh: number, Hl: number\n ): void {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n protected process(view: DataView, offset: number): void {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);\n const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);\n const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);\n // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);\n const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);\n const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = u64.add3L(T1l, sigma0l, MAJl);\n Ah = u64.add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n protected roundClean(): void {\n clean(SHA512_W_H, SHA512_W_L);\n }\n destroy(): void {\n clean(this.buffer);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\n\nexport class SHA384 extends SHA512 {\n protected Ah: number = SHA384_IV[0] | 0;\n protected Al: number = SHA384_IV[1] | 0;\n protected Bh: number = SHA384_IV[2] | 0;\n protected Bl: number = SHA384_IV[3] | 0;\n protected Ch: number = SHA384_IV[4] | 0;\n protected Cl: number = SHA384_IV[5] | 0;\n protected Dh: number = SHA384_IV[6] | 0;\n protected Dl: number = SHA384_IV[7] | 0;\n protected Eh: number = SHA384_IV[8] | 0;\n protected El: number = SHA384_IV[9] | 0;\n protected Fh: number = SHA384_IV[10] | 0;\n protected Fl: number = SHA384_IV[11] | 0;\n protected Gh: number = SHA384_IV[12] | 0;\n protected Gl: number = SHA384_IV[13] | 0;\n protected Hh: number = SHA384_IV[14] | 0;\n protected Hl: number = SHA384_IV[15] | 0;\n\n constructor() {\n super(48);\n }\n}\n\n/**\n * Truncated SHA512/256 and SHA512/224.\n * SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as \"intermediary\" IV of SHA512/t.\n * Then t hashes string to produce result IV.\n * See `test/misc/sha2-gen-iv.js`.\n */\n\n/** SHA512/224 IV */\nconst T224_IV = /* @__PURE__ */ Uint32Array.from([\n 0x8c3d37c8, 0x19544da2, 0x73e19966, 0x89dcd4d6, 0x1dfab7ae, 0x32ff9c82, 0x679dd514, 0x582f9fcf,\n 0x0f6d2b69, 0x7bd44da8, 0x77e36f73, 0x04c48942, 0x3f9d85a8, 0x6a1d36c8, 0x1112e6ad, 0x91d692a1,\n]);\n\n/** SHA512/256 IV */\nconst T256_IV = /* @__PURE__ */ Uint32Array.from([\n 0x22312194, 0xfc2bf72c, 0x9f555fa3, 0xc84c64c2, 0x2393b86b, 0x6f53b151, 0x96387719, 0x5940eabd,\n 0x96283ee2, 0xa88effe3, 0xbe5e1e25, 0x53863992, 0x2b0199fc, 0x2c85b8aa, 0x0eb72ddc, 0x81c52ca2,\n]);\n\nexport class SHA512_224 extends SHA512 {\n protected Ah: number = T224_IV[0] | 0;\n protected Al: number = T224_IV[1] | 0;\n protected Bh: number = T224_IV[2] | 0;\n protected Bl: number = T224_IV[3] | 0;\n protected Ch: number = T224_IV[4] | 0;\n protected Cl: number = T224_IV[5] | 0;\n protected Dh: number = T224_IV[6] | 0;\n protected Dl: number = T224_IV[7] | 0;\n protected Eh: number = T224_IV[8] | 0;\n protected El: number = T224_IV[9] | 0;\n protected Fh: number = T224_IV[10] | 0;\n protected Fl: number = T224_IV[11] | 0;\n protected Gh: number = T224_IV[12] | 0;\n protected Gl: number = T224_IV[13] | 0;\n protected Hh: number = T224_IV[14] | 0;\n protected Hl: number = T224_IV[15] | 0;\n\n constructor() {\n super(28);\n }\n}\n\nexport class SHA512_256 extends SHA512 {\n protected Ah: number = T256_IV[0] | 0;\n protected Al: number = T256_IV[1] | 0;\n protected Bh: number = T256_IV[2] | 0;\n protected Bl: number = T256_IV[3] | 0;\n protected Ch: number = T256_IV[4] | 0;\n protected Cl: number = T256_IV[5] | 0;\n protected Dh: number = T256_IV[6] | 0;\n protected Dl: number = T256_IV[7] | 0;\n protected Eh: number = T256_IV[8] | 0;\n protected El: number = T256_IV[9] | 0;\n protected Fh: number = T256_IV[10] | 0;\n protected Fl: number = T256_IV[11] | 0;\n protected Gh: number = T256_IV[12] | 0;\n protected Gl: number = T256_IV[13] | 0;\n protected Hh: number = T256_IV[14] | 0;\n protected Hl: number = T256_IV[15] | 0;\n\n constructor() {\n super(32);\n }\n}\n\n/**\n * SHA2-256 hash function from RFC 4634.\n *\n * It is the fastest JS hash, even faster than Blake3.\n * To break sha256 using birthday attack, attackers need to try 2^128 hashes.\n * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.\n */\nexport const sha256: CHash = /* @__PURE__ */ createHasher(() => new SHA256());\n/** SHA2-224 hash function from RFC 4634 */\nexport const sha224: CHash = /* @__PURE__ */ createHasher(() => new SHA224());\n\n/** SHA2-512 hash function from RFC 4634. */\nexport const sha512: CHash = /* @__PURE__ */ createHasher(() => new SHA512());\n/** SHA2-384 hash function from RFC 4634. */\nexport const sha384: CHash = /* @__PURE__ */ createHasher(() => new SHA384());\n\n/**\n * SHA2-512/256 \"truncated\" hash function, with improved resistance to length extension attacks.\n * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).\n */\nexport const sha512_256: CHash = /* @__PURE__ */ createHasher(() => new SHA512_256());\n/**\n * SHA2-512/224 \"truncated\" hash function, with improved resistance to length extension attacks.\n * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).\n */\nexport const sha512_224: CHash = /* @__PURE__ */ createHasher(() => new SHA512_224());\n", "import { base32Decode, base32Encode } from './utils/base32.ts';\nimport { getCrc32 } from './utils/getCrc.ts';\nimport { sha224 } from '@noble/hashes/sha2';\nimport { bytesToHex, hexToBytes } from '@noble/hashes/utils';\n\nexport const JSON_KEY_PRINCIPAL = '__principal__';\nconst SELF_AUTHENTICATING_SUFFIX = 2;\nconst ANONYMOUS_SUFFIX = 4;\n\nconst MANAGEMENT_CANISTER_PRINCIPAL_TEXT_STR = 'aaaaa-aa';\n\nexport type JsonnablePrincipal = {\n [JSON_KEY_PRINCIPAL]: string;\n};\n\nexport class Principal {\n public static anonymous(): Principal {\n return new this(new Uint8Array([ANONYMOUS_SUFFIX]));\n }\n\n /**\n * Utility method, returning the principal representing the management canister, decoded from the hex string `'aaaaa-aa'`\n * @returns {Principal} principal of the management canister\n */\n public static managementCanister(): Principal {\n return this.fromText(MANAGEMENT_CANISTER_PRINCIPAL_TEXT_STR);\n }\n\n public static selfAuthenticating(publicKey: Uint8Array): Principal {\n const sha = sha224(publicKey);\n return new this(new Uint8Array([...sha, SELF_AUTHENTICATING_SUFFIX]));\n }\n\n public static from(other: unknown): Principal {\n if (typeof other === 'string') {\n return Principal.fromText(other);\n } else if (Object.getPrototypeOf(other) === Uint8Array.prototype) {\n return new Principal(other as Uint8Array);\n } else if (Principal.isPrincipal(other)) {\n return new Principal(other._arr);\n }\n\n throw new Error(`Impossible to convert ${JSON.stringify(other)} to Principal.`);\n }\n\n public static fromHex(hex: string): Principal {\n return new this(hexToBytes(hex));\n }\n\n public static fromText(text: string): Principal {\n let maybePrincipal = text;\n // If formatted as JSON string, parse it first\n if (text.includes(JSON_KEY_PRINCIPAL)) {\n const obj = JSON.parse(text);\n if (JSON_KEY_PRINCIPAL in obj) {\n maybePrincipal = obj[JSON_KEY_PRINCIPAL];\n }\n }\n\n const canisterIdNoDash = maybePrincipal.toLowerCase().replace(/-/g, '');\n\n let arr = base32Decode(canisterIdNoDash);\n arr = arr.slice(4, arr.length);\n\n const principal = new this(arr);\n if (principal.toText() !== maybePrincipal) {\n throw new Error(\n `Principal \"${principal.toText()}\" does not have a valid checksum (original value \"${maybePrincipal}\" may not be a valid Principal ID).`,\n );\n }\n\n return principal;\n }\n\n public static fromUint8Array(arr: Uint8Array): Principal {\n return new this(arr);\n }\n\n public static isPrincipal(other: unknown): other is Principal {\n return (\n other instanceof Principal ||\n (typeof other === 'object' &&\n other !== null &&\n '_isPrincipal' in other &&\n (other as { _isPrincipal: boolean })['_isPrincipal'] === true &&\n '_arr' in other &&\n (other as { _arr: Uint8Array })['_arr'] instanceof Uint8Array)\n );\n }\n\n public readonly _isPrincipal = true;\n\n protected constructor(private _arr: Uint8Array) {}\n\n public isAnonymous(): boolean {\n return this._arr.byteLength === 1 && this._arr[0] === ANONYMOUS_SUFFIX;\n }\n\n public toUint8Array(): Uint8Array {\n return this._arr;\n }\n\n public toHex(): string {\n return bytesToHex(this._arr).toUpperCase();\n }\n\n public toText(): string {\n const checksumArrayBuf = new ArrayBuffer(4);\n const view = new DataView(checksumArrayBuf);\n view.setUint32(0, getCrc32(this._arr));\n const checksum = new Uint8Array(checksumArrayBuf);\n\n const array = new Uint8Array([...checksum, ...this._arr]);\n\n const result = base32Encode(array);\n const matches = result.match(/.{1,5}/g);\n if (!matches) {\n // This should only happen if there's no character, which is unreachable.\n throw new Error();\n }\n return matches.join('-');\n }\n\n public toString(): string {\n return this.toText();\n }\n\n /**\n * Serializes to JSON\n * @returns {JsonnablePrincipal} a JSON object with a single key, {@link JSON_KEY_PRINCIPAL}, whose value is the principal as a string\n */\n public toJSON(): JsonnablePrincipal {\n return { [JSON_KEY_PRINCIPAL]: this.toText() };\n }\n\n /**\n * Utility method taking a Principal to compare against. Used for determining canister ranges in certificate verification\n * @param {Principal} other - a {@link Principal} to compare\n * @returns {'lt' | 'eq' | 'gt'} `'lt' | 'eq' | 'gt'` a string, representing less than, equal to, or greater than\n */\n public compareTo(other: Principal): 'lt' | 'eq' | 'gt' {\n for (let i = 0; i < Math.min(this._arr.length, other._arr.length); i++) {\n if (this._arr[i] < other._arr[i]) return 'lt';\n else if (this._arr[i] > other._arr[i]) return 'gt';\n }\n // Here, at least one principal is a prefix of the other principal (they could be the same)\n if (this._arr.length < other._arr.length) return 'lt';\n if (this._arr.length > other._arr.length) return 'gt';\n return 'eq';\n }\n\n /**\n * Utility method checking whether a provided Principal is less than or equal to the current one using the {@link Principal.compareTo} method\n * @param other a {@link Principal} to compare\n * @returns {boolean} boolean\n */\n public ltEq(other: Principal): boolean {\n const cmp = this.compareTo(other);\n return cmp == 'lt' || cmp == 'eq';\n }\n\n /**\n * Utility method checking whether a provided Principal is greater than or equal to the current one using the {@link Principal.compareTo} method\n * @param other a {@link Principal} to compare\n * @returns {boolean} boolean\n */\n public gtEq(other: Principal): boolean {\n const cmp = this.compareTo(other);\n return cmp == 'gt' || cmp == 'eq';\n }\n}\n", "import * as z from 'zod';\nimport {type JunoConfigEnv, JunoConfigEnvSchema} from '../types/juno.env';\n\n/**\n * @see OnRunEnv\n */\nexport const OnRunEnvSchema = JunoConfigEnvSchema.extend({\n profile: z.string().optional()\n});\n\n/**\n * The environment available when executing `juno run`.\n */\nexport type OnRunEnv = JunoConfigEnv & {\n /**\n * Optional profile (e.g. `personal`, `team`) used for execution.\n */\n profile?: string;\n};\n", "import * as z from 'zod';\n\n/**\n * @see JunoConfigMode\n */\nexport const JunoConfigModeSchema = z.union([z.literal('production'), z.string()]);\n\n/**\n * Represents the mode of the Juno configuration.\n * @typedef {'production' | string} JunoConfigMode\n */\nexport type JunoConfigMode = 'production' | string;\n\n/**\n * @see JunoConfigEnv\n */\nexport const JunoConfigEnvSchema = z.object({\n mode: JunoConfigModeSchema\n});\n\n/**\n * Represents the environment configuration for Juno.\n * @interface JunoConfigEnv\n */\nexport interface JunoConfigEnv {\n /**\n * The mode of the Juno configuration.\n * @type {JunoConfigMode}\n */\n mode: JunoConfigMode;\n}\n", "import type {JunoConfigEnv} from '../types/juno.env';\nimport type {JunoConsoleConfig} from './console.config';\n\nexport type JunoConsoleConfigFn = (config: JunoConfigEnv) => JunoConsoleConfig;\n\nexport type JunoConsoleConfigFnOrObject = JunoConsoleConfig | JunoConsoleConfigFn;\n\nexport function defineConsoleConfig(config: JunoConsoleConfig): JunoConsoleConfig;\nexport function defineConsoleConfig(config: JunoConsoleConfigFn): JunoConsoleConfigFn;\nexport function defineConsoleConfig(\n config: JunoConsoleConfigFnOrObject\n): JunoConsoleConfigFnOrObject;\nexport function defineConsoleConfig(\n config: JunoConsoleConfigFnOrObject\n): JunoConsoleConfigFnOrObject {\n return config;\n}\n", "import {type PrincipalText, PrincipalTextSchema} from '@dfinity/zod-schemas';\nimport * as z from 'zod';\nimport {\n type AuthenticationConfig,\n AuthenticationConfigSchema\n} from '../shared/authentication.config';\nimport {type StorageConfig, StorageConfigSchema} from '../shared/storage.config';\nimport {type CliConfig, CliConfigSchema} from '../types/cli.config';\nimport {type JunoConfigMode, JunoConfigModeSchema} from '../types/juno.env';\nimport type {Either} from '../types/utility.types';\nimport {StrictPrincipalTextSchema} from '../utils/principal.utils';\n\n/**\n * @see ConsoleId\n */\nexport const ConsoleIdSchema = z.object({\n id: PrincipalTextSchema\n});\n\n/**\n * Represents the unique identifier for a console.\n * @interface ConsoleId\n */\nexport interface ConsoleId {\n /**\n * The unique identifier (ID) of the console.\n * @type {string}\n */\n id: PrincipalText;\n}\n\n/**\n * @see ConsoleIds\n */\nexport const ConsoleIdsSchema = z.object({\n ids: z.record(JunoConfigModeSchema, StrictPrincipalTextSchema)\n});\n\n/**\n * Represents a mapping of console identifiers to different configurations based on the mode of the application.\n * @interface ConsoleIds\n */\nexport interface ConsoleIds {\n /**\n * A mapping of console identifiers (IDs) to different configurations based on the mode of the application.\n *\n * This allows the application to use different console IDs, such as production, staging, etc.\n * @type {Record<JunoConfigMode, string>}\n */\n ids: Record<JunoConfigMode, PrincipalText>;\n}\n\nconst JunoConsoleConfigBaseSchema = z.object({\n ...CliConfigSchema.shape,\n storage: StorageConfigSchema.optional(),\n authentication: AuthenticationConfigSchema.optional()\n});\n\n/**\n * @see JunoConsoleConfig\n */\nexport const JunoConsoleConfigSchema = z.union([\n z\n .object({\n ...ConsoleIdSchema.shape,\n ...JunoConsoleConfigBaseSchema.shape\n })\n .strict(),\n z\n .object({\n ...ConsoleIdsSchema.shape,\n ...JunoConsoleConfigBaseSchema.shape\n })\n .strict()\n]);\n\n/**\n * Represents the configuration for a console.\n * @typedef {Either<ConsoleId, ConsoleIds>} ConsoleConfig\n */\nexport type JunoConsoleConfig = Either<ConsoleId, ConsoleIds> &\n CliConfig & {\n /**\n * Optional configuration parameters for the console, affecting the operational behavior of its Storage.\n * @type {StorageConfig}\n * @optional\n */\n storage?: StorageConfig;\n\n /**\n * Optional configuration parameters for the console, affecting the operational behavior of its Authentication.\n * @type {AuthenticationConfig}\n * @optional\n */\n authentication?: AuthenticationConfig;\n };\n", "import {type PrincipalText, PrincipalTextSchema} from '@dfinity/zod-schemas';\nimport * as z from 'zod';\n\n/**\n * @see AuthenticationConfigInternetIdentity\n */\nexport const AuthenticationConfigInternetIdentitySchema = z.strictObject({\n derivationOrigin: z.url().optional(),\n externalAlternativeOrigins: z.array(z.url()).optional()\n});\n\n/**\n * Configure the behavior of Internet Identity.\n * @interface AuthenticationConfigInternetIdentity\n */\nexport interface AuthenticationConfigInternetIdentity {\n /**\n * This setting ensures that users are recognized on your app, regardless of whether they use the default URL or any other custom domain.\n * For example, if set to hello.com, a user signing on at https://hello.com will receive the same identifier (principal) as when signing on at https://www.hello.com.\n * @type {string}\n * @optional\n */\n derivationOrigin?: string;\n\n /**\n * An optional list of external alternative origins allowed for authentication, which can be useful if you want to reuse the same derivation origin across multiple Satellites.\n * @type {string[]}\n * @optional\n */\n externalAlternativeOrigins?: string[];\n}\n\n/**\n * @see AuthenticationConfigDelegation\n */\nexport const AuthenticationConfigDelegationSchema = z.strictObject({\n allowedTargets: z.array(PrincipalTextSchema).nullable().optional(),\n sessionDuration: z\n .bigint()\n .max(\n 30n * 24n * 60n * 60n * 1_000_000_000n,\n 'The maximal length of a defined session duration - maxTimeToLive - cannot exceed 30 days'\n )\n .optional()\n});\n\n/**\n * Configure the delegation behavior for authentication.\n *\n * @interface AuthenticationConfigDelegation\n */\nexport interface AuthenticationConfigDelegation {\n /**\n * List of allowed targets (backend modules) that authenticated users\n * may call using the issued session.\n *\n * - Omit this value to restrict access to this Satellite only (default).\n * - Provide an array to explicitly allow only those targets.\n * - Set to `null` to allow calling any backend.\n *\n * \u26A0\uFE0F Setting to `null` removes all restrictions \u2014 use with caution.\n */\n allowedTargets?: PrincipalText[] | null;\n\n /**\n * Duration for which a session remains valid, expressed in nanoseconds.\n *\n * Defaults to 1 day. Cannot exceed 30 days.\n *\n * Once issued, a session cannot be extended or shortened.\n * New settings only apply to future logins.\n */\n sessionDuration?: bigint;\n}\n\n/**\n * @see AuthenticationConfigGoogle\n */\nexport const AuthenticationConfigGoogleSchema = z.strictObject({\n clientId: z\n .string()\n .trim()\n .regex(/^[0-9]+-[a-z0-9]+\\.apps\\.googleusercontent\\.com$/, 'Invalid Google client ID format')\n .max(128, 'Google clientId too long'),\n delegation: AuthenticationConfigDelegationSchema.optional()\n});\n\n/**\n * Configure the sign-in with Google.\n *\n * @interface AuthenticationConfigGoogle\n */\nexport interface AuthenticationConfigGoogle {\n /**\n * The OAuth 2.0 client ID from your\n * [Google Cloud Console](https://console.cloud.google.com/apis/credentials).\n *\n * Example: `\"1234567890-abcdefg.apps.googleusercontent.com\"`\n *\n * @type {string}\n */\n clientId: string;\n\n /**\n * Optional delegation settings for authentication.\n * If omitted, the default delegation behavior applies.\n */\n delegation?: AuthenticationConfigDelegation;\n}\n\n/**\n * @see AuthenticationConfigRules\n */\nexport const AuthenticationConfigRulesSchema = z.strictObject({\n allowedCallers: z.array(PrincipalTextSchema)\n});\n\n/**\n * Configure the rules of the authentication.\n * @interface AuthenticationConfigRules\n */\nexport interface AuthenticationConfigRules {\n /**\n * This option defines who's allowed to use your app.\n *\n * If you enable this, only the identities you list (in user key, format, like `bj4r4-5cdop-...`) will be allowed to sign in or use any features like Datastore or Storage.\n *\n * @type {PrincipalText[]}\n * @optional\n */\n allowedCallers: PrincipalText[];\n}\n\n/**\n * @see AuthenticationConfig\n */\nexport const AuthenticationConfigSchema = z.strictObject({\n internetIdentity: AuthenticationConfigInternetIdentitySchema.optional(),\n google: AuthenticationConfigGoogleSchema.optional(),\n rules: AuthenticationConfigRulesSchema.optional(),\n version: z.bigint().optional()\n});\n\n/**\n * Configures the Authentication options of a Satellite.\n * @interface AuthenticationConfig\n */\nexport interface AuthenticationConfig {\n /**\n * Optional configuration of Internet Identity authentication method.\n * @type {AuthenticationConfigInternetIdentity}\n * @optional\n */\n internetIdentity?: AuthenticationConfigInternetIdentity;\n\n /**\n * Optional configuration for enabling Google authentication method.\n * @type {AuthenticationConfigGoogle}\n * @optional\n */\n google?: AuthenticationConfigGoogle;\n\n /**\n * Optional configuration for the rules of the authentication.\n * @type {AuthenticationConfigRules}\n * @optional\n */\n rules?: AuthenticationConfigRules;\n\n /**\n * The current version of the config.\n *\n * Optional. The CLI will automatically resolve the version and warn you if there's a potential overwrite.\n * You can provide it if you want to manage versioning manually within your config file.\n *\n * @type {bigint}\n * @optional\n */\n version?: bigint;\n}\n", "import * as z from 'zod';\nimport {type MaxMemorySizeConfig, MaxMemorySizeConfigSchema} from './feature.config';\n\n/**\n * @see StorageConfigSourceGlob\n */\nexport const StorageConfigSourceGlobSchema = z.string();\n\n/**\n * Represents a glob pattern for matching files in the Storage configuration.\n * @typedef {string} StorageConfigSourceGlob\n */\nexport type StorageConfigSourceGlob = string;\n\n/**\n * @see StorageConfigHeader\n */\nexport const StorageConfigHeaderSchema = z\n .object({\n source: StorageConfigSourceGlobSchema,\n headers: z.array(z.tuple([z.string(), z.string()]))\n })\n .strict();\n\n/**\n * Headers allow the client and the Storage to pass additional information along with a request or a response.\n * Some sets of headers can affect how the browser handles the page and its content.\n * @interface StorageConfigHeader\n */\nexport interface StorageConfigHeader {\n /**\n * The glob pattern used to match files within the Storage that these headers will apply to.\n * @type {StorageConfigSourceGlob}\n */\n source: StorageConfigSourceGlob;\n\n /**\n * An array of key-value pairs representing the headers to apply.\n * Each pair includes the header name and its value.\n * Example: `[[\"Cache-Control\", \"max-age=3600\"], [\"X-Custom-Header\", \"value\"]]`\n * @type {Array<[string, string]>}\n */\n headers: [string, string][];\n}\n\n/**\n * @see StorageConfigRewrite\n */\nexport const StorageConfigRewriteSchema = z\n .object({\n source: StorageConfigSourceGlobSchema,\n destination: z.string()\n })\n .strict();\n\n/**\n * You can utilize optional rewrites to display the same content for multiple URLs.\n * Rewrites are especially useful when combined with pattern matching, allowing acceptance of any URL that matches the pattern.\n * @interface StorageConfigRewrite\n */\nexport interface StorageConfigRewrite {\n /**\n * The glob pattern or specific path to match for incoming requests.\n * Matches are rewritten to the specified destination.\n * @type {StorageConfigSourceGlob}\n */\n source: StorageConfigSourceGlob;\n\n /**\n * The destination path or file to which matching requests should be rewritten.\n * @type {string}\n */\n destination: string;\n}\n\n/**\n * @see StorageConfigRedirect\n */\nexport const StorageConfigRedirectSchema = z\n .object({\n source: StorageConfigSourceGlobSchema,\n location: z.string(),\n code: z.union([z.literal(301), z.literal(302)])\n })\n .strict();\n\n/**\n * Use a URL redirect to prevent broken links if you've moved a page or to shorten URLs.\n * @interface StorageConfigRedirect\n */\nexport interface StorageConfigRedirect {\n /**\n * The glob pattern or specific path to match for incoming requests that should be redirected.\n * @type {StorageConfigSourceGlob}\n */\n source: StorageConfigSourceGlob;\n\n /**\n * The URL or path to which the request should be redirected.\n * @type {string}\n */\n location: string;\n\n /**\n * The HTTP status code to use for the redirect, typically 301 (permanent redirect) or 302 (temporary redirect).\n * @type {301 | 302}\n */\n code: 301 | 302;\n}\n\n/**\n * @see StorageConfig\n */\nexport const StorageConfigSchema = z.object({\n headers: z.array(StorageConfigHeaderSchema).optional(),\n rewrites: z.array(StorageConfigRewriteSchema).optional(),\n redirects: z.array(StorageConfigRedirectSchema).optional(),\n iframe: z.enum(['deny', 'same-origin', 'allow-any']).optional(),\n rawAccess: z.boolean().optional(),\n maxMemorySize: MaxMemorySizeConfigSchema.optional(),\n version: z.bigint().optional()\n});\n\n/**\n * Configures the hosting behavior of the Storage.\n * @interface StorageConfig\n */\nexport interface StorageConfig {\n /**\n * Optional array of `StorageConfigHeader` objects to define custom HTTP headers for specific files or patterns.\n * @type {StorageConfigHeader[]}\n * @optional\n */\n headers?: StorageConfigHeader[];\n\n /**\n * Optional array of `StorageConfigRewrite` objects to define rewrite rules.\n * @type {StorageConfigRewrite[]}\n * @optional\n */\n rewrites?: StorageConfigRewrite[];\n\n /**\n * Optional array of `StorageConfigRedirect` objects to define HTTP redirects.\n * @type {StorageConfigRedirect[]}\n * @optional\n */\n redirects?: StorageConfigRedirect[];\n\n /**\n * For security reasons and to prevent click-jacking attacks, dapps deployed with Juno are, by default, set to deny embedding in other sites.\n *\n * Options are:\n * - `deny`: Prevents any content from being displayed in an iframe.\n * - `same-origin`: Allows iframe content from the same origin as the page.\n * - `allow-any`: Allows iframe content from any origin.\n *\n * If not specified, then `deny` is used as default value.\n * @type {'deny' | 'same-origin' | 'allow-any'}\n * @optional\n */\n iframe?: 'deny' | 'same-origin' | 'allow-any';\n\n /**\n * Optional flag to enable access for raw URLs.\n *\n * \u26A0\uFE0F **WARNING: Enabling this option is highly discouraged due to security risks.**\n *\n * Enabling this option allows access to raw URLs (e.g., https://satellite-id.raw.icp0.io), bypassing certificate validation.\n * This creates a security vulnerability where a malicious node in the chain can respond to requests with malicious or invalid content.\n * Since there is no validation on raw URLs, the client may receive and process harmful data.\n *\n * If not specified, the default value is `false`.\n * @type {boolean}\n * @optional\n */\n rawAccess?: boolean;\n\n /**\n * Configuration for maximum memory size limits for the Storage.\n *\n * This is used to specify optional limits on heap and stable memory for the smart contract.\n * When the limit is reached, the Storage and smart contract continue to operate normally but reject the upload of new assets.\n *\n * If not specified, no memory limits are enforced.\n *\n * @type {MaxMemorySizeConfig}\n * @optional\n */\n maxMemorySize?: MaxMemorySizeConfig;\n\n /**\n * The current version of the config.\n *\n * Optional. The CLI will automatically resolve the version and warn you if there's a potential overwrite.\n * You can provide it if you want to manage versioning manually within your config file.\n *\n * @type {bigint}\n * @optional\n */\n version?: bigint;\n}\n", "import * as z from 'zod';\n\n/**\n * @see MaxMemorySizeConfig\n */\nexport const MaxMemorySizeConfigSchema = z\n .object({\n heap: z.bigint().optional(),\n stable: z.bigint().optional()\n })\n .strict();\n\n/**\n * Configuration for granting access to features only if the maximum memory size limits are not reached.\n *\n * The maximum size corresponds to the overall heap or stable memory of the smart contract.\n */\nexport interface MaxMemorySizeConfig {\n /**\n * Maximum allowed heap memory size in bytes.\n *\n * This field is optional. If not specified, no limit is enforced on the heap memory size.\n *\n * @type {bigint}\n */\n heap?: bigint;\n\n /**\n * Maximum allowed stable memory size in bytes.\n *\n * This field is optional. If not specified, no limit is enforced on the stable memory size.\n *\n * @type {bigint}\n */\n stable?: bigint;\n}\n", "import * as z from 'zod';\nimport {type EncodingType, EncodingTypeSchema} from './encoding';\n\n/**\n * @see Precompress\n */\nexport const PrecompressSchema = z.strictObject({\n pattern: z.string().optional(),\n mode: z.enum(['both', 'replace']).optional(),\n algorithm: z.enum(['gzip', 'brotli']).optional()\n});\n\n/**\n * @see CliConfig\n */\nexport const CliConfigSchema = z.strictObject({\n source: z.string().optional(),\n ignore: z.array(z.string()).optional(),\n precompress: z\n .union([PrecompressSchema, z.array(PrecompressSchema), z.literal(false)])\n .optional(),\n encoding: z.array(z.tuple([z.string(), EncodingTypeSchema])).optional(),\n predeploy: z.array(z.string()).optional(),\n postdeploy: z.array(z.string()).optional()\n});\n\n/**\n * Configuration for compressing files during deployment.\n */\nexport interface Precompress {\n /**\n * Glob pattern for files to precompress.\n * @default any css|js|mjs|html\n */\n pattern?: string;\n\n /**\n * Determines what happens to the original files after compression:\n * - `\"both\"` \u2014 upload both original and compressed versions.\n * - `\"replace\"` \u2014 upload only the compressed version (served with `Content-Encoding`).\n *\n * @default \"both\"\n */\n mode?: 'both' | 'replace';\n\n /**\n * Compression algorithm.\n * @default \"gzip\"\n */\n algorithm?: 'gzip' | 'brotli';\n}\n\n/**\n * The configuration used by the CLI to resolve, prepare and deploy your app.\n */\nexport interface CliConfig {\n /**\n * Specifies the directory from which to deploy to Storage.\n * For instance, if `npm run build` outputs files to a `dist` folder, use `source: 'dist'`.\n *\n * @default 'build'\n * @type {string}\n */\n source?: string;\n\n /**\n * Specifies files or patterns to ignore during deployment, using glob patterns similar to those in .gitignore.\n * @type {string[]}\n * @optional\n */\n ignore?: string[];\n\n /**\n * Controls compression optimization for files in the source folder.\n *\n * By default, JavaScript (.js), ES Modules (.mjs), CSS (.css), and HTML (.html)\n * are compressed, and both the original and compressed versions are uploaded.\n *\n * Set to `false` to disable, or provide one or more {@link Precompress} objects to customize.\n *\n * @type {Precompress | Precompress[] | false}\n * @optional\n */\n precompress?: Precompress | Precompress[] | false;\n\n /**\n * Customizes file encoding mapping for HTTP response headers `Content-Encoding` based on file extension:\n * - `.Z` for compress,\n * - `.gz` for gzip,\n * - `.br` for brotli,\n * - `.zlib` for deflate,\n * - anything else defaults to `identity`.\n * The \"encoding\" attribute allows overriding default mappings with an array of glob patterns and encoding types.\n * @type {Array<[string, EncodingType]>}\n * @optional\n */\n encoding?: Array<[string, EncodingType]>;\n\n /**\n * Defines a list of scripts or commands to be run before the deployment process begins.\n * This can be useful for tasks such as compiling assets, running tests, or building production-ready files.\n *\n * Example:\n * ```json\n * {\n * \"predeploy\": [\"npm run build\", \"npm run lint\"]\n * }\n * ```\n *\n * @type {string[]}\n * @optional\n */\n predeploy?: string[];\n\n /**\n * Defines a list of scripts or commands to be run after the deployment process completes.\n * This can be used for tasks such as notifications, cleanup, or sending confirmation messages to services or team members.\n *\n * Example:\n * ```json\n * {\n * \"postdeploy\": [\"./scripts/notify-admins.sh\", \"echo 'Deployment complete'\"]\n * }\n * ```\n *\n * @type {string[]}\n * @optional\n */\n postdeploy?: string[];\n}\n", "import * as z from 'zod';\n\n/**\n * see EncodingType\n */\nexport const EncodingTypeSchema = z.enum(['identity', 'gzip', 'compress', 'deflate', 'br']);\n\n/**\n * Represents the encoding types for assets.\n * @typedef {'identity' | 'gzip' | 'compress' | 'deflate' | 'br'} EncodingType\n */\nexport type EncodingType = 'identity' | 'gzip' | 'compress' | 'deflate' | 'br';\n", "import * as z from 'zod';\n\n/**\n * @see JunoPackageDependencies\n */\nexport const JunoPackageDependenciesSchema = z.record(z.string(), z.string());\n\n/**\n * @see JunoPackage\n */\nexport const JunoPackageSchema = z.object({\n name: z.string(),\n version: z.string(),\n dependencies: JunoPackageDependenciesSchema.optional()\n});\n", "/**\n * The ID used to identify a Juno Satellite.\n *\n * It is either the name of a (stock) package or\n * used when checking if a canister includes `@junobuild/satellite` as a dependency.\n */\nexport const JUNO_PACKAGE_SATELLITE_ID = '@junobuild/satellite';\n\n/**\n * The ID used to identify a Juno Sputnik crate.\n *\n * Used when checking if a canister includes `@junobuild/sputnik` as a dependency.\n */\nexport const JUNO_PACKAGE_SPUTNIK_ID = '@junobuild/sputnik';\n\n/**\n * The ID used to identify a Juno Mission Control package.\n */\nexport const JUNO_PACKAGE_MISSION_CONTROL_ID = '@junobuild/mission-control';\n\n/**\n * The ID used to identify a Juno Orbiter package.\n */\nexport const JUNO_PACKAGE_ORBITER_ID = '@junobuild/orbiter';\n", "import type {JunoConfigEnv} from '../types/juno.env';\nimport type {JunoConfig} from './juno.config';\n\nexport type JunoConfigFn = (config: JunoConfigEnv) => JunoConfig;\n\nexport type JunoConfigFnOrObject = JunoConfig | JunoConfigFn;\n\nexport function defineConfig(config: JunoConfig): JunoConfig;\nexport function defineConfig(config: JunoConfigFn): JunoConfigFn;\nexport function defineConfig(config: JunoConfigFnOrObject): JunoConfigFnOrObject;\nexport function defineConfig(config: JunoConfigFnOrObject): JunoConfigFnOrObject {\n return config;\n}\n", "import * as z from 'zod';\n\n/**\n * @see SatelliteAssertions\n */\nexport const SatelliteAssertionsSchema = z.strictObject({\n heapMemory: z.union([z.bigint(), z.boolean()]).optional()\n});\n\n/**\n * Configuration for satellite assertions.\n * @interface SatelliteAssertions\n */\nexport interface SatelliteAssertions {\n /**\n * Configuration for the heap memory size check, which can be:\n * - `true` to enable the check with a default threshold of 900MB,\n * - `false` to disable the heap memory size check,\n * - A `bigint` to specify a custom threshold in MB (megabytes) for the heap memory size check.\n *\n * If not specified, then `true` is used as the default value.\n * @type {bigint | boolean}\n */\n heapMemory?: bigint | boolean;\n}\n", "import * as z from 'zod';\nimport {type Rule, RuleSchema} from './rules';\n\n/**\n * @see DatastoreCollection\n */\nexport const DatastoreCollectionSchema = RuleSchema.omit({\n createdAt: true,\n updatedAt: true,\n maxSize: true\n});\n\n/**\n * Represents a configuration for a collection of the Satellite Datastore.\n * @typedef {Omit<Rule, 'createdAt' | 'updatedAt' | 'maxSize'>} DatastoreCollection\n */\nexport type DatastoreCollection = Omit<Rule, 'createdAt' | 'updatedAt' | 'maxSize'>;\n\n/**\n * @see StorageCollection\n */\nexport const StorageCollectionSchema = RuleSchema.omit({\n createdAt: true,\n updatedAt: true,\n maxCapacity: true\n});\n\n/**\n * Represents a configuration for a collection of the Satellite Storage.\n * @typedef {Omit<Rule, 'createdAt' | 'updatedAt' | 'maxCapacity'>} StorageCollection\n */\nexport type StorageCollection = Omit<Rule, 'createdAt' | 'updatedAt' | 'maxCapacity'>;\n\n/**\n * @see Collections\n */\nexport const CollectionsSchema = z.strictObject({\n datastore: z.array(DatastoreCollectionSchema).optional(),\n storage: z.array(StorageCollectionSchema).optional()\n});\n\n/**\n * Represents the configuration for all the collections of a Satellite.\n * @interface Collections\n */\nexport interface Collections {\n /**\n * An optional array that defines the collections of the Datastore.\n * @type {DatastoreCollection[]}\n * @optional\n */\n datastore?: DatastoreCollection[];\n\n /**\n * An optional array that defines the collections of the Storage.\n * @type {StorageCollection[]}\n * @optional\n */\n storage?: StorageCollection[];\n}\n", "import * as z from 'zod';\n\n/**\n * @see PermissionText\n */\nexport const PermissionTextSchema = z.enum(['public', 'private', 'managed', 'controllers']);\n\n/**\n * Represents the permission levels for read and write access.\n * @typedef {'public' | 'private' | 'managed' | 'controllers'} PermissionText\n */\nexport type PermissionText = 'public' | 'private' | 'managed' | 'controllers';\n\n/**\n * @see MemoryText\n */\nexport const MemoryTextSchema = z.enum(['heap', 'stable']);\n\n/**\n * Represents the memory types.\n * @typedef {'heap' | 'stable'} MemoryText\n */\nexport type MemoryText = 'heap' | 'stable';\n\n/**\n * @see RulesType\n */\nexport const RulesTypeSchema = z.enum(['db', 'storage']);\n\n/**\n * Represents the types of rules.\n * @typedef {'db' | 'storage'} RulesType\n */\nexport type RulesType = 'db' | 'storage';\n\n/**\n * @see Rule\n */\nexport const RuleSchema = z.strictObject({\n collection: z.string(),\n read: PermissionTextSchema,\n write: PermissionTextSchema,\n memory: MemoryTextSchema,\n createdAt: z.bigint().optional(),\n updatedAt: z.bigint().optional(),\n version: z.bigint().optional(),\n maxSize: z.bigint().optional(),\n maxChangesPerUser: z.number().optional(),\n maxCapacity: z.number().optional(),\n mutablePermissions: z.boolean().optional().default(true),\n maxTokens: z.bigint().optional()\n});\n\n/**\n * Represents a rule configuration for a collection.\n * @interface Rule\n */\nexport interface Rule {\n /**\n * The name of the collection the rule applies to.\n * @type {string}\n */\n collection: string;\n\n /**\n * The permission level for read access.\n * @type {PermissionText}\n */\n read: PermissionText;\n\n /**\n * The permission level for write access.\n * @type {PermissionText}\n */\n write: PermissionText;\n\n /**\n * The type of memory allocated for the collection.\n * @type {MemoryText}\n */\n memory: MemoryText;\n\n /**\n * The timestamp when the rule was created.\n * @type {bigint}\n * @optional\n */\n createdAt?: bigint;\n\n /**\n * The timestamp when the rule was last updated.\n * @type {bigint}\n * @optional\n */\n updatedAt?: bigint;\n\n /**\n * The version of the rule.\n * @type {bigint}\n * @optional\n * @description Must be provided when updating the rule to ensure the correct version is being updated.\n */\n version?: bigint;\n\n /**\n * The maximum size of the collection in bytes.\n * @type {number}\n * @optional\n */\n maxSize?: bigint;\n\n /**\n * The maximum number of changes (create, update or delete) per user for the collection.\n * @type {number}\n * @optional\n */\n maxChangesPerUser?: number;\n\n /**\n * The maximum capacity of the collection.\n * @type {number}\n * @optional\n */\n maxCapacity?: number;\n\n /**\n * Indicates whether the permissions are mutable.\n * @default true\n * @type {boolean}\n */\n mutablePermissions?: boolean;\n\n /**\n * The maximum number of writes and deletes per minute.\n */\n maxTokens?: bigint;\n}\n", "import * as z from 'zod';\nimport {type MaxMemorySizeConfig, MaxMemorySizeConfigSchema} from '../../shared/feature.config';\n\n/**\n * @see DatastoreConfig\n */\nexport const DatastoreConfigSchema = z.strictObject({\n maxMemorySize: MaxMemorySizeConfigSchema.optional(),\n version: z.bigint().optional()\n});\n\n/**\n * Configures the behavior of the Datastore.\n * @interface DatastoreConfig\n */\nexport interface DatastoreConfig {\n /**\n * Configuration for maximum memory size limits for the Datastore.\n *\n * This is used to specify optional limits on heap and stable memory for the smart contract.\n * When the limit is reached, the Datastore and smart contract continue to operate normally but reject the creation or updates of documents.\n *\n * If not specified, no memory limits are enforced.\n *\n * @type {MaxMemorySizeConfig}\n * @optional\n */\n maxMemorySize?: MaxMemorySizeConfig;\n\n /**\n * The current version of the config.\n *\n * Optional. The CLI will automatically resolve the version and warn you if there's a potential overwrite.\n * You can provide it if you want to manage versioning manually within your config file.\n *\n * @type {bigint}\n * @optional\n */\n version?: bigint;\n}\n", "import * as z from 'zod';\nimport {refineEmulatorConfig} from '../validators/emulator.validators';\n\nconst EmulatorPortsSchema = z.strictObject({\n /**\n * @default 5987\n */\n server: z.number().optional(),\n\n /**\n * @default 5999\n */\n admin: z.number().optional(),\n\n /**\n * @default 30\n */\n timeoutInSeconds: z.number().int().positive().optional()\n});\n\nconst ConsolePortSchema = z.strictObject({\n /**\n * Console UI (like https://console.juno.build) running with the emulator.\n * @default 5866\n */\n console: z.number().optional()\n});\n\n/**\n * Represents the ports exposed by an emulator container.\n */\nexport interface EmulatorPorts {\n /**\n * The port of the server used to simulate execution. This is the port your app connects to.\n * Also known as the \"local Internet Computer replica\" or the \"Pocket-IC port\".\n * @default 5987\n */\n server?: number;\n\n /**\n * The port of the admin server used for tasks like transferring ICP from the ledger.\n * @default 5999\n */\n admin?: number;\n\n /**\n * Max number of seconds to wait for emulator ports to become ready.\n * @default 30\n */\n timeoutInSeconds?: number;\n}\n\n/**\n * @see EmulatorSkylab\n */\nconst EmulatorSkylabSchema = z.strictObject({\n ports: EmulatorPortsSchema.extend(ConsolePortSchema.shape).optional()\n});\n\n/**\n * Configuration for the Skylab emulator.\n */\nexport interface EmulatorSkylab {\n /**\n * Ports exposed by the Skylab container.\n */\n ports?: EmulatorPorts & {\n /**\n * Console UI (like https://console.juno.build) running with the emulator.\n * @default 5866\n */\n console: number;\n };\n}\n\n/**\n * @see EmulatorConsole\n */\nconst EmulatorConsoleSchema = z.strictObject({\n ports: EmulatorPortsSchema.optional()\n});\n\n/**\n * Configuration for the Console emulator.\n */\nexport interface EmulatorConsole {\n /**\n * Ports exposed by the Console container.\n */\n ports?: EmulatorPorts;\n}\n\n/**\n * @see EmulatorSatellite\n */\nconst EmulatorSatelliteSchema = z.strictObject({\n ports: EmulatorPortsSchema.optional()\n});\n\n/**\n * Configuration for the Satellite emulator.\n */\nexport interface EmulatorSatellite {\n /**\n * Ports exposed by the Satellite container.\n */\n ports?: EmulatorPorts;\n}\n\n/**\n * @see EmulatorRunner\n */\nconst EmulatorRunnerSchema = z.strictObject({\n type: z.enum(['docker', 'podman']),\n image: z.string().optional(),\n name: z.string().optional(),\n volume: z.string().optional(),\n target: z.string().optional(),\n platform: z.enum(['linux/amd64', 'linux/arm64']).optional()\n});\n\n/**\n * Shared options for all runner variants.\n */\nexport interface EmulatorRunner {\n /**\n * The containerization tool to run the emulator.\n */\n type: 'docker' | 'podman';\n\n /**\n * Image reference.\n * @default depends on emulator type, e.g. \"junobuild/skylab:latest\"\n */\n image?: string;\n\n /**\n * Optional container name to use for the emulator.\n * Useful for reusing or managing a specific container.\n */\n name?: string;\n\n /**\n * Persistent volume to store internal state.\n * @default \"juno\"\n */\n volume?: string;\n\n /**\n * Shared folder for deploying and hot-reloading serverless functions.\n */\n target?: string;\n\n /**\n * The platform to use when running the emulator container.\n */\n platform?: 'linux/amd64' | 'linux/arm64';\n}\n\n/**\n * @see NetworkServices\n */\nconst NetworkServicesSchema = z.strictObject({\n registry: z.boolean().optional(),\n cmc: z.boolean().optional(),\n icp: z.boolean().optional(),\n cycles: z.boolean().optional(),\n nns: z.boolean().optional(),\n sns: z.boolean().optional(),\n internet_identity: z.boolean().optional(),\n nns_dapp: z.boolean().optional()\n});\n\n/**\n * Network services that can be enabled in the emulator.\n *\n * Each flag corresponds to a system canister or application that can be included\n * in the local Internet Computer network when the emulator starts.\n */\nexport interface NetworkServices {\n /**\n * Registry canister: Stores network configuration and topology (subnet membership, public keys, feature flags).\n * Acts as the source of truth other system canisters read/write to.\n */\n registry?: boolean;\n\n /**\n * CMC (Cycles Minting Canister): Converts ICP to cycles and distributes them; maintains subnet lists and conversion rate.\n * Requires icp and nns to not be enabled.\n */\n cmc?: boolean;\n\n /**\n * ICP token: Deploys the ICP ledger and index canisters.\n */\n icp?: boolean;\n\n /**\n * Cycles token: Deploys the cycles ledger and index canisters.\n */\n cycles?: boolean;\n\n /**\n * NNS governance canisters: Deploys the governance and root canisters.\n * Core governance system (neurons, proposals, voting) and related control logic.\n * Enables managing network-level decisions in an emulated environment.\n */\n nns?: boolean;\n\n /**\n * SNS canisters: Deploys the SNS-W and aggregator canisters.\n * Service Nervous System stack used to govern individual dapps.\n */\n sns?: boolean;\n\n /**\n * Internet Identity: Deploys the II canister for authentication.\n */\n internet_identity?: boolean;\n\n /**\n * NNS dapp: Deploys the NNS UI canister and frontend application\n * Requires cmc, icp, nns, sns, internet_identity to be enabled.\n */\n nns_dapp?: boolean;\n}\n\n/**\n * @see Network\n */\nconst NetworkSchema = z.strictObject({\n services: NetworkServicesSchema\n});\n\n/**\n * Configuration for customizing the Internet Computer network bootstrapped\n * by the emulator.\n */\nexport interface Network {\n /**\n * System canisters and applications available in the network.\n */\n services: NetworkServices;\n}\n\n/**\n * @see EmulatorConfig\n */\nexport const EmulatorConfigSchema = z\n .union([\n z.strictObject({\n runner: EmulatorRunnerSchema.optional(),\n network: NetworkSchema.optional(),\n skylab: EmulatorSkylabSchema\n }),\n z.strictObject({\n runner: EmulatorRunnerSchema.optional(),\n network: NetworkSchema.optional(),\n console: EmulatorConsoleSchema\n }),\n z.strictObject({\n runner: EmulatorRunnerSchema.optional(),\n network: NetworkSchema.optional(),\n satellite: EmulatorSatelliteSchema\n })\n ])\n .superRefine(refineEmulatorConfig);\n\n/**\n * The configuration for running the Juno emulator.\n */\nexport type EmulatorConfig =\n | {runner?: EmulatorRunner; network?: Network; skylab: EmulatorSkylab}\n | {runner?: EmulatorRunner; network?: Network; console: EmulatorConsole}\n | {runner?: EmulatorRunner; network?: Network; satellite: EmulatorSatellite};\n", "import type {NetworkServices} from '../configs/emulator.config';\n\nexport const DEFAULT_NETWORK_SERVICES: NetworkServices = {\n registry: false,\n cmc: true,\n icp: true,\n cycles: true,\n nns: true,\n sns: false,\n internet_identity: true,\n nns_dapp: false\n} as const;\n\nexport const DEFAULT_SATELLITE_NETWORK_SERVICES: NetworkServices = {\n ...DEFAULT_NETWORK_SERVICES,\n cycles: false,\n cmc: false,\n nns: false\n} as const;\n", "import type * as z from 'zod';\nimport type {EmulatorConfigSchema} from '../configs/emulator.config';\nimport {\n DEFAULT_NETWORK_SERVICES,\n DEFAULT_SATELLITE_NETWORK_SERVICES\n} from '../constants/emulator.constants';\n\nconst NNS_REQUIRED_SERVICES = ['icp'] as const;\nconst CMC_REQUIRED_SERVICES = ['icp', 'nns'] as const;\nconst CYCLES_REQUIRED_SERVICES = ['cmc', 'icp', 'nns'] as const;\nconst NNS_DAPP_REQUIRED_SERVICES = ['cmc', 'icp', 'nns', 'sns', 'internet_identity'] as const;\n\ntype EmulatorConfigInput = z.input<typeof EmulatorConfigSchema>;\n\n// eslint-disable-next-line local-rules/prefer-object-params\nconst refineNetworkServices = (cfg: EmulatorConfigInput, ctx: z.RefinementCtx) => {\n const defaultServices =\n 'satellite' in cfg ? DEFAULT_SATELLITE_NETWORK_SERVICES : DEFAULT_NETWORK_SERVICES;\n const mergedServices = {...defaultServices, ...(cfg.network?.services ?? {})};\n\n const assertServices = ({\n requiredServices,\n key\n }: {\n requiredServices:\n | typeof NNS_DAPP_REQUIRED_SERVICES\n | typeof CMC_REQUIRED_SERVICES\n | typeof CYCLES_REQUIRED_SERVICES\n | typeof NNS_REQUIRED_SERVICES;\n key: string;\n }) => {\n const hasMissingServices =\n requiredServices.find((k) => mergedServices[k as keyof typeof mergedServices] === false) !==\n undefined;\n\n if (hasMissingServices) {\n ctx.addIssue({\n code: 'custom',\n path: ['network', 'services', key],\n message: `${key} requires: ${requiredServices.join(', ')}`\n });\n }\n };\n\n if (mergedServices.nns_dapp) {\n assertServices({\n requiredServices: NNS_DAPP_REQUIRED_SERVICES,\n key: 'nns_dapp'\n });\n }\n\n if (mergedServices.cmc) {\n assertServices({\n requiredServices: CMC_REQUIRED_SERVICES,\n key: 'cmc'\n });\n }\n\n if (mergedServices.cycles) {\n assertServices({\n requiredServices: CYCLES_REQUIRED_SERVICES,\n key: 'cycles'\n });\n }\n\n if (mergedServices.nns) {\n assertServices({\n requiredServices: NNS_REQUIRED_SERVICES,\n key: 'nns'\n });\n }\n};\n\n// eslint-disable-next-line local-rules/prefer-object-params\nexport const refineEmulatorConfig = (cfg: EmulatorConfigInput, ctx: z.RefinementCtx) => {\n if (cfg.network === undefined) {\n return;\n }\n\n if (cfg.network.services === undefined) {\n return;\n }\n\n refineNetworkServices(cfg, ctx);\n};\n", "import * as z from 'zod';\n\n/**\n * @see ModuleLogVisibility\n */\nexport const ModuleLogVisibilitySchema = z.enum(['controllers', 'public']);\n\n/**\n * Specifies who can see the logs of the module.\n *\n * - 'controllers': Only the controllers of the module can see the logs.\n * - 'public': Everyone can see the logs.\n *\n * @typedef {'controllers' | 'public'} ModuleLogVisibility\n */\nexport type ModuleLogVisibility = 'controllers' | 'public';\n\n/**\n * @see ModuleSettings\n */\nexport const ModuleSettingsSchema = z.strictObject({\n freezingThreshold: z.bigint().optional(),\n reservedCyclesLimit: z.bigint().optional(),\n logVisibility: ModuleLogVisibilitySchema.optional(),\n heapMemoryLimit: z.bigint().optional(),\n memoryAllocation: z.bigint().optional(),\n computeAllocation: z.bigint().optional()\n});\n\n/**\n * Settings for a module - Satellite, Mission Control or Orbiter.\n *\n * These settings control various aspects of the module's behavior and resource usage.\n *\n * @interface ModuleSettings\n */\nexport interface ModuleSettings {\n /**\n * The cycle threshold below which the module will automatically stop to avoid running out of cycles.\n *\n * For example, if set to `BigInt(1000000)`, the module will stop when it has fewer than 1,000,000 cycles remaining.\n *\n * @type {bigint}\n */\n freezingThreshold?: bigint;\n\n /**\n * The number of cycles reserved for the module's operations to ensure it has enough cycles to function.\n *\n * For example, setting it to `BigInt(5000000)` reserves 5,000,000 cycles for the module.\n *\n * @type {bigint}\n */\n reservedCyclesLimit?: bigint;\n\n /**\n * Controls who can see the module's logs.\n *\n * @type {ModuleLogVisibility}\n */\n logVisibility?: ModuleLogVisibility;\n\n /**\n * The maximum amount of WebAssembly (Wasm) memory the module can use on the heap.\n *\n * For example, setting it to `BigInt(1024 * 1024 * 64)` allows the module to use up to 64 MB of Wasm memory.\n *\n * @type {bigint}\n */\n heapMemoryLimit?: bigint;\n\n /**\n * The amount of memory explicitly allocated to the module.\n *\n * For example, setting it to `BigInt(1024 * 1024 * 128)` allocates 128 MB of memory to the module.\n *\n * @type {bigint}\n */\n memoryAllocation?: bigint;\n\n /**\n * The proportion of compute capacity allocated to the module.\n *\n * This is a fraction of the total compute capacity of the subnet. For example, setting it to `BigInt(10)` allocates 10% of the compute capacity to the module.\n *\n * @type {bigint}\n */\n computeAllocation?: bigint;\n}\n", "import {type PrincipalText, PrincipalTextSchema} from '@dfinity/zod-schemas';\nimport * as z from 'zod';\nimport {type JunoConfigMode, JunoConfigModeSchema} from '../../types/juno.env';\nimport type {Either} from '../../types/utility.types';\nimport {StrictPrincipalTextSchema} from '../../utils/principal.utils';\n\n/**\n * @see OrbiterId\n */\nexport const OrbiterIdSchema = z.object({\n id: PrincipalTextSchema\n});\n\n/**\n * Represents the configuration for an orbiter.\n * @interface OrbiterId\n */\nexport interface OrbiterId {\n /**\n * The identifier of the orbiter used in the dApp.\n * @type {string}\n */\n id: PrincipalText;\n}\n\n/**\n * @see OrbiterIds\n */\nexport const OrbiterIdsSchema = z.object({\n ids: z.record(JunoConfigModeSchema, StrictPrincipalTextSchema)\n});\n\n/**\n * Represents a mapping of orbiter identitifiers to different configurations based on the mode of the application.\n * @interface OrbiterIds\n */\nexport interface OrbiterIds {\n /**\n * A mapping of orbiter identifiers (IDs) to different configurations based on the mode of the application.\n *\n * This allows the application to use different orbiter IDs, such as production, development, etc.\n *\n * Example:\n * {\n * \"production\": \"xo2hm-lqaaa-aaaal-ab3oa-cai\",\n * \"development\": \"gl6nx-5maaa-aaaaa-qaaqq-cai\"\n * }\n * @type {Record<JunoConfigMode, string>}\n */\n ids: Record<JunoConfigMode, PrincipalText>;\n}\n\n/**\n * @see OrbiterConfig\n */\nexport const OrbiterConfigSchema = z.union([OrbiterIdSchema.strict(), OrbiterIdsSchema.strict()]);\n\n/**\n * Represents the configuration for an orbiter (analytics).\n *\n * @typedef {Either<OrbiterId, OrbiterIds>} OrbiterConfig\n * @property {OrbiterId | OrbiterIds} OrbiterId or OrbiterIds - Defines a unique Orbiter or a collection of Orbiters.\n */\nexport type OrbiterConfig = Either<OrbiterId, OrbiterIds>;\n", "import {type PrincipalText, PrincipalTextSchema} from '@dfinity/zod-schemas';\nimport * as z from 'zod';\nimport {\n type AuthenticationConfig,\n AuthenticationConfigSchema\n} from '../../shared/authentication.config';\nimport {type StorageConfig, StorageConfigSchema} from '../../shared/storage.config';\nimport type {CliConfig} from '../../types/cli.config';\nimport {type JunoConfigMode, JunoConfigModeSchema} from '../../types/juno.env';\nimport type {Either} from '../../types/utility.types';\nimport {StrictPrincipalTextSchema} from '../../utils/principal.utils';\nimport {type SatelliteAssertions, SatelliteAssertionsSchema} from './assertions.config';\nimport {type Collections, CollectionsSchema} from './collections';\nimport {type DatastoreConfig, DatastoreConfigSchema} from './datastore.config';\nimport {type ModuleSettings, ModuleSettingsSchema} from './module.settings';\n\n/**\n * @see SatelliteId\n */\nexport const SatelliteIdSchema = z.object({\n id: PrincipalTextSchema\n});\n\n/**\n * Represents the unique identifier for a satellite.\n * @interface SatelliteId\n */\nexport interface SatelliteId {\n /**\n * The unique identifier (ID) of the satellite for this application.\n * @type {string}\n */\n id: PrincipalText;\n}\n\n/**\n * @see SatelliteIds\n */\nexport const SatelliteIdsSchema = z.object({\n ids: z.record(JunoConfigModeSchema, StrictPrincipalTextSchema)\n});\n\n/**\n * Represents a mapping of satellite identifiers to different configurations based on the mode of the application.\n * @interface SatelliteIds\n */\nexport interface SatelliteIds {\n /**\n * A mapping of satellite identifiers (IDs) to different configurations based on the mode of the application.\n *\n * This allows the application to use different satellite IDs, such as production, staging, etc.\n *\n * Example:\n * {\n * \"production\": \"xo2hm-lqaaa-aaaal-ab3oa-cai\",\n * \"staging\": \"gl6nx-5maaa-aaaaa-qaaqq-cai\"\n * }\n * @type {Record<JunoConfigMode, string>}\n */\n ids: Record<JunoConfigMode, PrincipalText>;\n}\n\n/**\n * @see SatelliteConfigOptions\n */\nconst SatelliteConfigOptionsBaseSchema = z.object({\n storage: StorageConfigSchema.optional(),\n datastore: DatastoreConfigSchema.optional(),\n authentication: AuthenticationConfigSchema.optional(),\n assertions: SatelliteAssertionsSchema.optional(),\n settings: ModuleSettingsSchema.optional(),\n collections: CollectionsSchema.optional()\n});\n\n/**\n * @see JunoConsoleConfig\n */\nexport const SatelliteConfigOptionsSchema = z.union([\n z\n .object({\n ...SatelliteIdSchema.shape,\n ...SatelliteConfigOptionsBaseSchema.shape\n })\n .strict(),\n z\n .object({\n ...SatelliteIdsSchema.shape,\n ...SatelliteConfigOptionsBaseSchema.shape\n })\n .strict()\n]);\n\n/**\n * SatelliteConfigOptions interface provides configuration settings that allow for fine-tuning\n * the operational behavior of various aspects of a Satellite, such as storage, datastore,\n * authentication, and deployment assertions.\n *\n * These options affect specific modules of the Satellite and may require manual application of\n * changes, typically through CLI commands (e.g., `juno config`).\n *\n * @interface SatelliteConfigOptions\n *\n * @property {StorageConfig} [storage] - Configuration settings for storage management in the Satellite.\n * @property {DatastoreConfig} [datastore] - Configuration settings for datastore management.\n * @property {AuthenticationConfig} [authentication] - Authentication-specific configurations.\n * @property {SatelliteAssertions} [assertions] - Conditions and assertions for deployment or operational checks.\n * @property {ModuleSettings} [settings] - General settings governing module behavior and resource management.\n */\nexport interface SatelliteConfigOptions {\n /**\n * Optional configuration parameters for the satellite, affecting the operational behavior of its Storage.\n * Changes to these parameters must be applied manually afterwards, for example with the CLI using `juno config` commands.\n * @type {StorageConfig}\n * @optional\n */\n storage?: StorageConfig;\n\n /**\n * Optional configuration parameters for the satellite, affecting the operational behavior of its Datastore.\n * Changes to these parameters must be applied manually afterwards, for example with the CLI using `juno config` commands.\n * @type {DatastoreConfig}\n * @optional\n */\n datastore?: DatastoreConfig;\n\n /**\n * Optional configuration parameters for the satellite, affecting the operational behavior of its Authentication.\n * Changes to these parameters must be applied manually afterwards, for example with the CLI using `juno config` commands.\n * @type {AuthenticationConfig}\n * @optional\n */\n authentication?: AuthenticationConfig;\n\n /**\n * Optional configurations to override default assertions made by the CLI regarding satellite deployment conditions.\n * @type {SatelliteAssertions}\n * @optional\n */\n assertions?: SatelliteAssertions;\n\n /**\n * Optional configuration parameters for the Satellite.\n * These settings control various aspects of the module's behavior and resource usage.\n * @type {ModuleSettings}\n * @optional\n */\n settings?: ModuleSettings;\n\n /**\n * Optional configuration for the Datastore and Storage collections.\n * @type {Collections}\n * @optional\n */\n collections?: Collections;\n}\n\n/**\n * Represents the configuration for a satellite.\n *\n * @typedef {Either<SatelliteId, SatelliteIds> & CliConfig & SatelliteConfigOptions} SatelliteConfig\n * @property {SatelliteId | SatelliteIds} SatelliteId or SatelliteIds - Defines a unique Satellite or a collection of Satellites.\n * @property {CliConfig} CliConfig - Configuration specific to the CLI interface.\n * @property {SatelliteConfigOptions} SatelliteConfigOptions - Additional configuration options for the Satellite.\n */\nexport type SatelliteConfig = Either<SatelliteId, SatelliteIds> &\n CliConfig &\n SatelliteConfigOptions;\n", "import * as z from 'zod';\nimport {type EmulatorConfig, EmulatorConfigSchema} from './configs/emulator.config';\nimport {type OrbiterConfig, OrbiterConfigSchema} from './configs/orbiter.config';\nimport {type SatelliteConfig, SatelliteConfigOptionsSchema} from './configs/satellite.config';\n\n/**\n * @see JunoConfig\n */\nexport const JunoConfigSchema = z.strictObject({\n satellite: SatelliteConfigOptionsSchema,\n orbiter: OrbiterConfigSchema.optional(),\n emulator: EmulatorConfigSchema.optional()\n});\n\n/**\n * Represents the overall configuration for Juno.\n * @interface JunoConfig\n */\nexport interface JunoConfig {\n /**\n * The configuration for the satellite.\n * @type {SatelliteConfig}\n */\n satellite: SatelliteConfig;\n\n /**\n * The optional configuration for the orbiter.\n * @type {OrbiterConfig}\n * @optional\n */\n orbiter?: OrbiterConfig;\n\n /**\n * Your options for the emulator.\n */\n emulator?: EmulatorConfig;\n}\n"],
|
|
5
5
|
"mappings": "AAAA,UAAYA,MAAO,MCAnB,UAAYC,OAAO,MAwBZ,IAAMC,EAAiDC,GAC1D,UAAuCC,GACvCD,EAAO,UAAUC,CAAmC,CACtD,ECzBF,UAAYC,MAAO,MCFnB,UAAYC,OAAO,MCAnB,OAAQ,uBAAAC,OAA0B,uBCAlC,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C,GAAqB,SAAO,CACvC,IAAO,SAAOC,EAAsBC,CAAyB,CAC/D,CAAC,EAyBYC,GAAwB,QAAM,CAACL,GAAgB,OAAO,EAAGE,GAAiB,OAAO,CAAC,CAAC,ECvDhG,OAA4B,uBAAAI,OAA0B,uBACtD,UAAYC,MAAO,MAkBZ,IAAMC,GAAsB,SAAO,CACxC,GAAIC,EACN,CAAC,EAiBYC,GAAuB,SAAO,CACzC,IAAO,SAAOC,EAAsBC,CAAyB,CAC/D,CAAC,EAyBKC,GAAqC,SAAO,CAChD,QAASC,EAAoB,SAAS,EACtC,UAAWC,GAAsB,SAAS,EAC1C,eAAgBC,EAA2B,SAAS,EACpD,WAAYC,GAA0B,SAAS,EAC/C,SAAUC,GAAqB,SAAS,EACxC,YAAaC,GAAkB,SAAS,CAC1C,CAAC,EAKYC,GAAiC,QAAM,CAE/C,SAAO,CACN,GAAGZ,GAAkB,MACrB,GAAGK,GAAiC,KACtC,CAAC,EACA,OAAO,EAEP,SAAO,CACN,GAAGH,GAAmB,MACtB,GAAGG,GAAiC,KACtC,CAAC,EACA,OAAO,CACZ,CAAC,EC1FD,UAAYQ,OAAO,MAQZ,IAAMC,GAAqB,gBAAa,CAC7C,UAAWC,GACX,QAASC,GAAoB,SAAS,EACtC,SAAUC,GAAqB,SAAS,CAC1C,CAAC",
|
|
6
6
|
"names": ["z", "z", "createFunctionSchema", "schema", "fn", "z", "z", "PrincipalTextSchema", "alphabet", "lookupTable", "i", "base32Encode", "input", "skip", "bits", "output", "encodeByte", "byte", "base32Decode", "o", "decodeChar", "char", "val", "c", "lookUpTable", "getCrc32", "buf", "crc", "i", "t", "isBytes", "a", "abytes", "b", "lengths", "isBytes", "aexists", "instance", "checkFinished", "aoutput", "out", "abytes", "min", "clean", "arrays", "i", "createView", "arr", "rotr", "word", "shift", "hasHexBuiltin", "hexes", "_", "i", "bytesToHex", "bytes", "abytes", "hex", "asciis", "asciiToBase16", "ch", "hexToBytes", "hl", "al", "array", "ai", "hi", "n1", "n2", "char", "utf8ToBytes", "str", "toBytes", "data", "utf8ToBytes", "abytes", "Hash", "createHasher", "hashCons", "hashC", "msg", "toBytes", "tmp", "setBigUint64", "view", "byteOffset", "value", "isLE", "_32n", "_u32_max", "wh", "wl", "h", "l", "Chi", "a", "b", "c", "Maj", "HashMD", "Hash", "blockLen", "outputLen", "padOffset", "createView", "data", "aexists", "toBytes", "abytes", "buffer", "len", "pos", "take", "dataView", "out", "aoutput", "clean", "i", "oview", "outLen", "state", "res", "to", "length", "finished", "destroyed", "SHA256_IV", "SHA224_IV", "SHA256_K", "SHA256_W", "SHA256", "HashMD", "outputLen", "SHA256_IV", "A", "B", "C", "D", "E", "F", "G", "H", "view", "offset", "i", "W15", "W2", "s0", "rotr", "s1", "sigma1", "T1", "Chi", "T2", "Maj", "clean", "SHA224", "SHA224_IV", "sha224", "createHasher", "SHA224", "JSON_KEY_PRINCIPAL", "SELF_AUTHENTICATING_SUFFIX", "ANONYMOUS_SUFFIX", "MANAGEMENT_CANISTER_PRINCIPAL_TEXT_STR", "Principal", "_Principal", "publicKey", "sha", "sha224", "other", "hex", "hexToBytes", "text", "maybePrincipal", "obj", "canisterIdNoDash", "arr", "base32Decode", "principal", "_arr", "bytesToHex", "checksumArrayBuf", "getCrc32", "checksum", "array", "matches", "base32Encode", "i", "cmp", "z", "StrictPrincipalTextSchema", "val", "PrincipalTextSchema", "StrictPrincipalSchema", "ctx", "Principal", "StrictIdentitySchema", "val", "StrictPrincipalSchema", "OnRunContextSchema", "StrictPrincipalSchema", "StrictIdentitySchema", "RunFunctionSchema", "OnRunSchema", "createFunctionSchema", "RunFnSchema", "OnRunContextSchema", "OnRunSchema", "RunFnOrObjectSchema", "createFunctionSchema", "defineRun", "run", "z", "z", "JunoConfigModeSchema", "JunoConfigEnvSchema", "OnRunEnvSchema", "JunoConfigEnvSchema", "defineConsoleConfig", "config", "PrincipalTextSchema", "z", "PrincipalTextSchema", "z", "AuthenticationConfigInternetIdentitySchema", "AuthenticationConfigDelegationSchema", "AuthenticationConfigGoogleSchema", "AuthenticationConfigRulesSchema", "AuthenticationConfigSchema", "z", "z", "MaxMemorySizeConfigSchema", "StorageConfigSourceGlobSchema", "StorageConfigHeaderSchema", "StorageConfigRewriteSchema", "StorageConfigRedirectSchema", "StorageConfigSchema", "MaxMemorySizeConfigSchema", "z", "z", "EncodingTypeSchema", "PrecompressSchema", "CliConfigSchema", "EncodingTypeSchema", "ConsoleIdSchema", "PrincipalTextSchema", "ConsoleIdsSchema", "JunoConfigModeSchema", "StrictPrincipalTextSchema", "JunoConsoleConfigBaseSchema", "CliConfigSchema", "StorageConfigSchema", "AuthenticationConfigSchema", "JunoConsoleConfigSchema", "z", "JunoPackageDependenciesSchema", "JunoPackageSchema", "JUNO_PACKAGE_SATELLITE_ID", "JUNO_PACKAGE_SPUTNIK_ID", "JUNO_PACKAGE_MISSION_CONTROL_ID", "JUNO_PACKAGE_ORBITER_ID", "defineConfig", "config", "z", "SatelliteAssertionsSchema", "z", "z", "PermissionTextSchema", "MemoryTextSchema", "RulesTypeSchema", "RuleSchema", "DatastoreCollectionSchema", "RuleSchema", "StorageCollectionSchema", "CollectionsSchema", "z", "DatastoreConfigSchema", "MaxMemorySizeConfigSchema", "z", "DEFAULT_NETWORK_SERVICES", "DEFAULT_SATELLITE_NETWORK_SERVICES", "NNS_REQUIRED_SERVICES", "CMC_REQUIRED_SERVICES", "CYCLES_REQUIRED_SERVICES", "NNS_DAPP_REQUIRED_SERVICES", "refineNetworkServices", "cfg", "ctx", "mergedServices", "DEFAULT_SATELLITE_NETWORK_SERVICES", "DEFAULT_NETWORK_SERVICES", "assertServices", "requiredServices", "key", "k", "refineEmulatorConfig", "EmulatorPortsSchema", "ConsolePortSchema", "EmulatorSkylabSchema", "EmulatorConsoleSchema", "EmulatorSatelliteSchema", "EmulatorRunnerSchema", "NetworkServicesSchema", "NetworkSchema", "EmulatorConfigSchema", "refineEmulatorConfig", "z", "ModuleLogVisibilitySchema", "ModuleSettingsSchema", "PrincipalTextSchema", "z", "OrbiterIdSchema", "PrincipalTextSchema", "OrbiterIdsSchema", "JunoConfigModeSchema", "StrictPrincipalTextSchema", "OrbiterConfigSchema", "PrincipalTextSchema", "z", "SatelliteIdSchema", "PrincipalTextSchema", "SatelliteIdsSchema", "JunoConfigModeSchema", "StrictPrincipalTextSchema", "SatelliteConfigOptionsBaseSchema", "StorageConfigSchema", "DatastoreConfigSchema", "AuthenticationConfigSchema", "SatelliteAssertionsSchema", "ModuleSettingsSchema", "CollectionsSchema", "SatelliteConfigOptionsSchema", "z", "JunoConfigSchema", "SatelliteConfigOptionsSchema", "OrbiterConfigSchema", "EmulatorConfigSchema"]
|
package/dist/node/index.mjs.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../../src/cli/run.ts", "../../src/utils/zod.utils.ts", "../../src/cli/run.context.ts", "../../src/utils/identity.utils.ts", "../../src/utils/principal.utils.ts", "../../../../node_modules/@
|
|
3
|
+
"sources": ["../../src/cli/run.ts", "../../src/utils/zod.utils.ts", "../../src/cli/run.context.ts", "../../src/utils/identity.utils.ts", "../../src/utils/principal.utils.ts", "../../../../node_modules/@icp-sdk/core/src/principal/utils/base32.ts", "../../../../node_modules/@icp-sdk/core/src/principal/utils/getCrc.ts", "../../../../node_modules/@noble/hashes/src/utils.ts", "../../../../node_modules/@noble/hashes/src/_md.ts", "../../../../node_modules/@noble/hashes/src/sha2.ts", "../../../../node_modules/@icp-sdk/core/src/principal/principal.ts", "../../src/cli/run.env.ts", "../../src/types/juno.env.ts", "../../src/console/config.ts", "../../src/console/console.config.ts", "../../src/shared/authentication.config.ts", "../../src/shared/storage.config.ts", "../../src/shared/feature.config.ts", "../../src/types/cli.config.ts", "../../src/types/encoding.ts", "../../src/pkg/juno.package.ts", "../../src/pkg/juno.package.constants.ts", "../../src/satellite/config.ts", "../../src/satellite/configs/assertions.config.ts", "../../src/satellite/configs/collections.ts", "../../src/satellite/configs/rules.ts", "../../src/satellite/configs/datastore.config.ts", "../../src/satellite/configs/emulator.config.ts", "../../src/satellite/constants/emulator.constants.ts", "../../src/satellite/validators/emulator.validators.ts", "../../src/satellite/configs/module.settings.ts", "../../src/satellite/configs/orbiter.config.ts", "../../src/satellite/configs/satellite.config.ts", "../../src/satellite/juno.config.ts"],
|
|
4
4
|
"sourcesContent": ["import * as z from 'zod';\nimport {createFunctionSchema} from '../utils/zod.utils';\nimport {type OnRun, OnRunContextSchema, OnRunSchema} from './run.context';\nimport type {OnRunEnv} from './run.env';\n\nexport const RunFnSchema = z.function({\n input: z.tuple([OnRunContextSchema]),\n output: OnRunSchema\n});\nexport type RunFn = (context: OnRunEnv) => OnRun;\n\nexport const RunFnOrObjectSchema = z.union([OnRunSchema, createFunctionSchema(RunFnSchema)]);\nexport type RunFnOrObject = OnRun | RunFn;\n\nexport function defineRun(run: OnRun): OnRun;\nexport function defineRun(run: RunFn): RunFn;\nexport function defineRun(run: RunFnOrObject): RunFnOrObject;\nexport function defineRun(run: RunFnOrObject): RunFnOrObject {\n return run;\n}\n", "import * as z from 'zod';\n\n/**\n * Wraps a Zod function schema so that parsing returns the **original function**\n * instead of Zod's wrapped validator.\n *\n * Why?\n * ----\n * In Zod v4, `z.function({...})` normally returns a wrapper that validates\n * both arguments and the return value **every time the function is called**.\n * If your function's return type is `void | Promise<void>`, Zod tries to\n * validate it synchronously, which can throw\n * \"Encountered Promise during synchronous parse\"\n * when the implementation is async.\n *\n * By using `.implement`, we tell Zod: \u201Cthis is the function that satisfies\n * the schema.\u201D That way the schema still validates the function shape at\n * parse time, but the returned value is the **original function** you passed\n * in \u2014 no runtime wrapper, no sync/async mismatch.\n *\n * Reference:\n * https://github.com/colinhacks/zod/issues/4143#issuecomment-2845134912*\n */\n// TODO: Duplicates the helper in @junobuild/functions.\nexport const createFunctionSchema = <T extends z.ZodFunction>(schema: T) =>\n z.custom<Parameters<T['implement']>[0]>((fn) =>\n schema.implement(fn as Parameters<T['implement']>[0])\n );\n", "import type {Identity} from '@icp-sdk/core/agent';\nimport type {Principal} from '@icp-sdk/core/principal';\nimport * as z from 'zod';\nimport {StrictIdentitySchema} from '../utils/identity.utils';\nimport {StrictPrincipalSchema} from '../utils/principal.utils';\nimport {createFunctionSchema} from '../utils/zod.utils';\n\n/**\n * @see OnRunContext\n */\nexport const OnRunContextSchema = z.strictObject({\n satelliteId: StrictPrincipalSchema,\n orbiterId: StrictPrincipalSchema.optional(),\n identity: StrictIdentitySchema,\n container: z.string().optional()\n});\n\n/**\n * The context for running a task.\n */\nexport interface OnRunContext {\n /**\n * The Satellite ID as defined in the `juno.config` file.\n *\n * A {@link Principal} instance.\n */\n satelliteId: Principal;\n\n /**\n * The Orbiter ID as defined in the `juno.config` file (if defined).\n *\n * A {@link Principal} instance.\n */\n orbiterId?: Principal;\n\n /**\n * The {@link Identity} used by the CLI for this execution,\n * resolved according to the selected mode and profile.\n */\n identity: Identity;\n\n /**\n * A custom container URL. Useful when your local emulator runs on a non-default URL or port.\n * @type {string}\n * @optional\n */\n container?: string;\n}\n\n/**\n * @see RunFunction\n */\nconst RunFunctionSchema = z.function({\n input: z.tuple([OnRunContextSchema]),\n output: z.promise(z.void()).or(z.void())\n});\n/**\n * The function executed by a task.\n */\nexport type RunFunction = (context: OnRunContext) => void | Promise<void>;\n\n/**\n * @see OnRun\n */\nexport const OnRunSchema = z.strictObject({\n run: createFunctionSchema(RunFunctionSchema)\n});\n\n/**\n * A runner (job) executed with `juno run`.\n */\nexport interface OnRun {\n /**\n * The function that will be executed and called with parameters\n * inherited from your configuration and CLI.\n */\n run: RunFunction;\n}\n", "import * as z from 'zod';\nimport {StrictPrincipalSchema} from './principal.utils';\n\n/**\n * Ensures an unknown object is an identity.\n */\nexport const StrictIdentitySchema = z\n .unknown()\n .refine(\n (val) =>\n val !== undefined &&\n val !== null &&\n typeof val === 'object' &&\n 'transformRequest' in val &&\n typeof val.transformRequest === 'function' &&\n 'getPrincipal' in val &&\n typeof val.getPrincipal === 'function' &&\n StrictPrincipalSchema.safeParse(val.getPrincipal()).success,\n {\n message: 'Invalid Identity'\n }\n );\n", "import {PrincipalTextSchema} from '@dfinity/zod-schemas';\nimport {Principal} from '@icp-sdk/core/principal';\nimport * as z from 'zod';\n\n/**\n * Ensures reliable validation of PrincipalTextSchema inside z.record.\n */\nexport const StrictPrincipalTextSchema = z\n .string()\n .refine((val) => PrincipalTextSchema.safeParse(val).success, {\n message: 'Invalid textual representation of a Principal.'\n });\n\n/**\n * Ensures an unknown type is a Principal.\n */\n// eslint-disable-next-line local-rules/prefer-object-params\nexport const StrictPrincipalSchema = z.unknown().transform((val, ctx): Principal => {\n if (Principal.isPrincipal(val)) {\n return Principal.from(val);\n }\n\n ctx.issues.push({\n code: 'custom',\n message: 'Invalid Principal',\n input: val\n });\n\n return z.NEVER;\n});\n", "const alphabet = 'abcdefghijklmnopqrstuvwxyz234567';\n\n// Build a lookup table for decoding.\nconst lookupTable: Record<string, number> = Object.create(null);\nfor (let i = 0; i < alphabet.length; i++) {\n lookupTable[alphabet[i]] = i;\n}\n\n// Add aliases for rfc4648.\nlookupTable['0'] = lookupTable.o;\nlookupTable['1'] = lookupTable.i;\n\n/**\n * @param input The Uint8Array to encode.\n * @returns A Base32 string encoding the input.\n */\nexport function base32Encode(input: Uint8Array): string {\n // How many bits will we skip from the first byte.\n let skip = 0;\n // 5 high bits, carry from one byte to the next.\n let bits = 0;\n\n // The output string in base32.\n let output = '';\n\n function encodeByte(byte: number) {\n if (skip < 0) {\n // we have a carry from the previous byte\n bits |= byte >> -skip;\n } else {\n // no carry\n bits = (byte << skip) & 248;\n }\n\n if (skip > 3) {\n // Not enough data to produce a character, get us another one\n skip -= 8;\n return 1;\n }\n\n if (skip < 4) {\n // produce a character\n output += alphabet[bits >> 3];\n skip += 5;\n }\n\n return 0;\n }\n\n for (let i = 0; i < input.length; ) {\n i += encodeByte(input[i]);\n }\n\n return output + (skip < 0 ? alphabet[bits >> 3] : '');\n}\n\n/**\n * @param input The base32 encoded string to decode.\n */\nexport function base32Decode(input: string): Uint8Array {\n // how many bits we have from the previous character.\n let skip = 0;\n // current byte we're producing.\n let byte = 0;\n\n const output = new Uint8Array(((input.length * 4) / 3) | 0);\n let o = 0;\n\n function decodeChar(char: string) {\n // Consume a character from the stream, store\n // the output in this.output. As before, better\n // to use update().\n let val = lookupTable[char.toLowerCase()];\n if (val === undefined) {\n throw new Error(`Invalid character: ${JSON.stringify(char)}`);\n }\n\n // move to the high bits\n val <<= 3;\n byte |= val >>> skip;\n skip += 5;\n\n if (skip >= 8) {\n // We have enough bytes to produce an output\n output[o++] = byte;\n skip -= 8;\n\n if (skip > 0) {\n byte = (val << (5 - skip)) & 255;\n } else {\n byte = 0;\n }\n }\n }\n\n for (const c of input) {\n decodeChar(c);\n }\n\n return output.slice(0, o);\n}\n", "// This file is translated to JavaScript from\n// https://lxp32.github.io/docs/a-simple-example-crc32-calculation/\nconst lookUpTable: Uint32Array = new Uint32Array([\n 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3,\n 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,\n 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,\n 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,\n 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,\n 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,\n 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f,\n 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d,\n 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,\n 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,\n 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457,\n 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,\n 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb,\n 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9,\n 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,\n 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad,\n 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683,\n 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,\n 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7,\n 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,\n 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,\n 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79,\n 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f,\n 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,\n 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,\n 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21,\n 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,\n 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45,\n 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db,\n 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,\n 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf,\n 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d,\n]);\n\n/**\n * Calculate the CRC32 of a Uint8Array.\n * @param buf The Uint8Array to calculate the CRC32 of.\n */\nexport function getCrc32(buf: Uint8Array): number {\n let crc = -1;\n\n for (let i = 0; i < buf.length; i++) {\n const byte = buf[i];\n const t = (byte ^ crc) & 0xff;\n crc = lookUpTable[t] ^ (crc >>> 8);\n }\n\n return (crc ^ -1) >>> 0;\n}\n", "/**\n * Utilities for hex, bytes, CSPRNG.\n * @module\n */\n/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated (2025-04-30), we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\n\n/** Checks if something is Uint8Array. Be careful: nodejs Buffer will return true. */\nexport function isBytes(a: unknown): a is Uint8Array {\n return a instanceof Uint8Array || (ArrayBuffer.isView(a) && a.constructor.name === 'Uint8Array');\n}\n\n/** Asserts something is positive integer. */\nexport function anumber(n: number): void {\n if (!Number.isSafeInteger(n) || n < 0) throw new Error('positive integer expected, got ' + n);\n}\n\n/** Asserts something is Uint8Array. */\nexport function abytes(b: Uint8Array | undefined, ...lengths: number[]): void {\n if (!isBytes(b)) throw new Error('Uint8Array expected');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error('Uint8Array expected of length ' + lengths + ', got length=' + b.length);\n}\n\n/** Asserts something is hash */\nexport function ahash(h: IHash): void {\n if (typeof h !== 'function' || typeof h.create !== 'function')\n throw new Error('Hash should be wrapped by utils.createHasher');\n anumber(h.outputLen);\n anumber(h.blockLen);\n}\n\n/** Asserts a hash instance has not been destroyed / finished */\nexport function aexists(instance: any, checkFinished = true): void {\n if (instance.destroyed) throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called');\n}\n\n/** Asserts output is properly-sized byte array */\nexport function aoutput(out: any, instance: any): void {\n abytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error('digestInto() expects output buffer of length at least ' + min);\n }\n}\n\n/** Generic type encompassing 8/16/32-byte arrays - but not 64-byte. */\n// prettier-ignore\nexport type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array |\n Uint16Array | Int16Array | Uint32Array | Int32Array;\n\n/** Cast u8 / u16 / u32 to u8. */\nexport function u8(arr: TypedArray): Uint8Array {\n return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n\n/** Cast u8 / u16 / u32 to u32. */\nexport function u32(arr: TypedArray): Uint32Array {\n return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n}\n\n/** Zeroize a byte array. Warning: JS provides no guarantees. */\nexport function clean(...arrays: TypedArray[]): void {\n for (let i = 0; i < arrays.length; i++) {\n arrays[i].fill(0);\n }\n}\n\n/** Create DataView of an array for easy byte-level manipulation. */\nexport function createView(arr: TypedArray): DataView {\n return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n}\n\n/** The rotate right (circular right shift) operation for uint32 */\nexport function rotr(word: number, shift: number): number {\n return (word << (32 - shift)) | (word >>> shift);\n}\n\n/** The rotate left (circular left shift) operation for uint32 */\nexport function rotl(word: number, shift: number): number {\n return (word << shift) | ((word >>> (32 - shift)) >>> 0);\n}\n\n/** Is current platform little-endian? Most are. Big-Endian platform: IBM */\nexport const isLE: boolean = /* @__PURE__ */ (() =>\n new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44)();\n\n/** The byte swap operation for uint32 */\nexport function byteSwap(word: number): number {\n return (\n ((word << 24) & 0xff000000) |\n ((word << 8) & 0xff0000) |\n ((word >>> 8) & 0xff00) |\n ((word >>> 24) & 0xff)\n );\n}\n/** Conditionally byte swap if on a big-endian platform */\nexport const swap8IfBE: (n: number) => number = isLE\n ? (n: number) => n\n : (n: number) => byteSwap(n);\n\n/** @deprecated */\nexport const byteSwapIfBE: typeof swap8IfBE = swap8IfBE;\n/** In place byte swap for Uint32Array */\nexport function byteSwap32(arr: Uint32Array): Uint32Array {\n for (let i = 0; i < arr.length; i++) {\n arr[i] = byteSwap(arr[i]);\n }\n return arr;\n}\n\nexport const swap32IfBE: (u: Uint32Array) => Uint32Array = isLE\n ? (u: Uint32Array) => u\n : byteSwap32;\n\n// Built-in hex conversion https://caniuse.com/mdn-javascript_builtins_uint8array_fromhex\nconst hasHexBuiltin: boolean = /* @__PURE__ */ (() =>\n // @ts-ignore\n typeof Uint8Array.from([]).toHex === 'function' && typeof Uint8Array.fromHex === 'function')();\n\n// Array where index 0xf0 (240) is mapped to string 'f0'\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) =>\n i.toString(16).padStart(2, '0')\n);\n\n/**\n * Convert byte array to hex string. Uses built-in function, when available.\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes: Uint8Array): string {\n abytes(bytes);\n // @ts-ignore\n if (hasHexBuiltin) return bytes.toHex();\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n\n// We use optimized technique to convert hex string to byte array\nconst asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 } as const;\nfunction asciiToBase16(ch: number): number | undefined {\n if (ch >= asciis._0 && ch <= asciis._9) return ch - asciis._0; // '2' => 50-48\n if (ch >= asciis.A && ch <= asciis.F) return ch - (asciis.A - 10); // 'B' => 66-(65-10)\n if (ch >= asciis.a && ch <= asciis.f) return ch - (asciis.a - 10); // 'b' => 98-(97-10)\n return;\n}\n\n/**\n * Convert hex string to byte array. Uses built-in function, when available.\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex: string): Uint8Array {\n if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex);\n // @ts-ignore\n if (hasHexBuiltin) return Uint8Array.fromHex(hex);\n const hl = hex.length;\n const al = hl / 2;\n if (hl % 2) throw new Error('hex string expected, got unpadded hex of length ' + hl);\n const array = new Uint8Array(al);\n for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {\n const n1 = asciiToBase16(hex.charCodeAt(hi));\n const n2 = asciiToBase16(hex.charCodeAt(hi + 1));\n if (n1 === undefined || n2 === undefined) {\n const char = hex[hi] + hex[hi + 1];\n throw new Error('hex string expected, got non-hex character \"' + char + '\" at index ' + hi);\n }\n array[ai] = n1 * 16 + n2; // multiply first octet, e.g. 'a3' => 10*16+3 => 160 + 3 => 163\n }\n return array;\n}\n\n/**\n * There is no setImmediate in browser and setTimeout is slow.\n * Call of async fn will return Promise, which will be fullfiled only on\n * next scheduler queue processing step and this is exactly what we need.\n */\nexport const nextTick = async (): Promise<void> => {};\n\n/** Returns control to thread each 'tick' ms to avoid blocking. */\nexport async function asyncLoop(\n iters: number,\n tick: number,\n cb: (i: number) => void\n): Promise<void> {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick) continue;\n await nextTick();\n ts += diff;\n }\n}\n\n// Global symbols, but ts doesn't see them: https://github.com/microsoft/TypeScript/issues/31535\ndeclare const TextEncoder: any;\ndeclare const TextDecoder: any;\n\n/**\n * Converts string to bytes using UTF8 encoding.\n * @example utf8ToBytes('abc') // Uint8Array.from([97, 98, 99])\n */\nexport function utf8ToBytes(str: string): Uint8Array {\n if (typeof str !== 'string') throw new Error('string expected');\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n\n/**\n * Converts bytes to string using UTF8 encoding.\n * @example bytesToUtf8(Uint8Array.from([97, 98, 99])) // 'abc'\n */\nexport function bytesToUtf8(bytes: Uint8Array): string {\n return new TextDecoder().decode(bytes);\n}\n\n/** Accepted input of hash functions. Strings are converted to byte arrays. */\nexport type Input = string | Uint8Array;\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data: Input): Uint8Array {\n if (typeof data === 'string') data = utf8ToBytes(data);\n abytes(data);\n return data;\n}\n\n/** KDFs can accept string or Uint8Array for user convenience. */\nexport type KDFInput = string | Uint8Array;\n/**\n * Helper for KDFs: consumes uint8array or string.\n * When string is passed, does utf8 decoding, using TextDecoder.\n */\nexport function kdfInputToBytes(data: KDFInput): Uint8Array {\n if (typeof data === 'string') data = utf8ToBytes(data);\n abytes(data);\n return data;\n}\n\n/** Copies several Uint8Arrays into one. */\nexport function concatBytes(...arrays: Uint8Array[]): Uint8Array {\n let sum = 0;\n for (let i = 0; i < arrays.length; i++) {\n const a = arrays[i];\n abytes(a);\n sum += a.length;\n }\n const res = new Uint8Array(sum);\n for (let i = 0, pad = 0; i < arrays.length; i++) {\n const a = arrays[i];\n res.set(a, pad);\n pad += a.length;\n }\n return res;\n}\n\ntype EmptyObj = {};\nexport function checkOpts<T1 extends EmptyObj, T2 extends EmptyObj>(\n defaults: T1,\n opts?: T2\n): T1 & T2 {\n if (opts !== undefined && {}.toString.call(opts) !== '[object Object]')\n throw new Error('options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged as T1 & T2;\n}\n\n/** Hash interface. */\nexport type IHash = {\n (data: Uint8Array): Uint8Array;\n blockLen: number;\n outputLen: number;\n create: any;\n};\n\n/** For runtime check if class implements interface */\nexport abstract class Hash<T extends Hash<T>> {\n abstract blockLen: number; // Bytes per block\n abstract outputLen: number; // Bytes in output\n abstract update(buf: Input): this;\n // Writes digest into buf\n abstract digestInto(buf: Uint8Array): void;\n abstract digest(): Uint8Array;\n /**\n * Resets internal state. Makes Hash instance unusable.\n * Reset is impossible for keyed hashes if key is consumed into state. If digest is not consumed\n * by user, they will need to manually call `destroy()` when zeroing is necessary.\n */\n abstract destroy(): void;\n /**\n * Clones hash instance. Unsafe: doesn't check whether `to` is valid. Can be used as `clone()`\n * when no options are passed.\n * Reasons to use `_cloneInto` instead of clone: 1) performance 2) reuse instance => all internal\n * buffers are overwritten => causes buffer overwrite which is used for digest in some cases.\n * There are no guarantees for clean-up because it's impossible in JS.\n */\n abstract _cloneInto(to?: T): T;\n // Safe version that clones internal state\n abstract clone(): T;\n}\n\n/**\n * XOF: streaming API to read digest in chunks.\n * Same as 'squeeze' in keccak/k12 and 'seek' in blake3, but more generic name.\n * When hash used in XOF mode it is up to user to call '.destroy' afterwards, since we cannot\n * destroy state, next call can require more bytes.\n */\nexport type HashXOF<T extends Hash<T>> = Hash<T> & {\n xof(bytes: number): Uint8Array; // Read 'bytes' bytes from digest stream\n xofInto(buf: Uint8Array): Uint8Array; // read buf.length bytes from digest stream into buf\n};\n\n/** Hash function */\nexport type CHash = ReturnType<typeof createHasher>;\n/** Hash function with output */\nexport type CHashO = ReturnType<typeof createOptHasher>;\n/** XOF with output */\nexport type CHashXO = ReturnType<typeof createXOFer>;\n\n/** Wraps hash function, creating an interface on top of it */\nexport function createHasher<T extends Hash<T>>(\n hashCons: () => Hash<T>\n): {\n (msg: Input): Uint8Array;\n outputLen: number;\n blockLen: number;\n create(): Hash<T>;\n} {\n const hashC = (msg: Input): Uint8Array => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\n\nexport function createOptHasher<H extends Hash<H>, T extends Object>(\n hashCons: (opts?: T) => Hash<H>\n): {\n (msg: Input, opts?: T): Uint8Array;\n outputLen: number;\n blockLen: number;\n create(opts?: T): Hash<H>;\n} {\n const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({} as T);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts?: T) => hashCons(opts);\n return hashC;\n}\n\nexport function createXOFer<H extends HashXOF<H>, T extends Object>(\n hashCons: (opts?: T) => HashXOF<H>\n): {\n (msg: Input, opts?: T): Uint8Array;\n outputLen: number;\n blockLen: number;\n create(opts?: T): HashXOF<H>;\n} {\n const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({} as T);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts?: T) => hashCons(opts);\n return hashC;\n}\nexport const wrapConstructor: typeof createHasher = createHasher;\nexport const wrapConstructorWithOpts: typeof createOptHasher = createOptHasher;\nexport const wrapXOFConstructorWithOpts: typeof createXOFer = createXOFer;\n\n/** Cryptographically secure PRNG. Uses internal OS-level `crypto.getRandomValues`. */\nexport function randomBytes(bytesLength = 32): Uint8Array {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n // Legacy Node.js compatibility\n if (crypto && typeof crypto.randomBytes === 'function') {\n return Uint8Array.from(crypto.randomBytes(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n", "/**\n * Internal Merkle-Damgard hash utils.\n * @module\n */\nimport { type Input, Hash, abytes, aexists, aoutput, clean, createView, toBytes } from './utils.ts';\n\n/** Polyfill for Safari 14. https://caniuse.com/mdn-javascript_builtins_dataview_setbiguint64 */\nexport function setBigUint64(\n view: DataView,\n byteOffset: number,\n value: bigint,\n isLE: boolean\n): void {\n if (typeof view.setBigUint64 === 'function') return view.setBigUint64(byteOffset, value, isLE);\n const _32n = BigInt(32);\n const _u32_max = BigInt(0xffffffff);\n const wh = Number((value >> _32n) & _u32_max);\n const wl = Number(value & _u32_max);\n const h = isLE ? 4 : 0;\n const l = isLE ? 0 : 4;\n view.setUint32(byteOffset + h, wh, isLE);\n view.setUint32(byteOffset + l, wl, isLE);\n}\n\n/** Choice: a ? b : c */\nexport function Chi(a: number, b: number, c: number): number {\n return (a & b) ^ (~a & c);\n}\n\n/** Majority function, true if any two inputs is true. */\nexport function Maj(a: number, b: number, c: number): number {\n return (a & b) ^ (a & c) ^ (b & c);\n}\n\n/**\n * Merkle-Damgard hash construction base class.\n * Could be used to create MD5, RIPEMD, SHA1, SHA2.\n */\nexport abstract class HashMD<T extends HashMD<T>> extends Hash<T> {\n protected abstract process(buf: DataView, offset: number): void;\n protected abstract get(): number[];\n protected abstract set(...args: number[]): void;\n abstract destroy(): void;\n protected abstract roundClean(): void;\n\n readonly blockLen: number;\n readonly outputLen: number;\n readonly padOffset: number;\n readonly isLE: boolean;\n\n // For partial updates less than block size\n protected buffer: Uint8Array;\n protected view: DataView;\n protected finished = false;\n protected length = 0;\n protected pos = 0;\n protected destroyed = false;\n\n constructor(blockLen: number, outputLen: number, padOffset: number, isLE: boolean) {\n super();\n this.blockLen = blockLen;\n this.outputLen = outputLen;\n this.padOffset = padOffset;\n this.isLE = isLE;\n this.buffer = new Uint8Array(blockLen);\n this.view = createView(this.buffer);\n }\n update(data: Input): this {\n aexists(this);\n data = toBytes(data);\n abytes(data);\n const { view, buffer, blockLen } = this;\n const len = data.length;\n for (let pos = 0; pos < len; ) {\n const take = Math.min(blockLen - this.pos, len - pos);\n // Fast path: we have at least one block in input, cast it to view and process\n if (take === blockLen) {\n const dataView = createView(data);\n for (; blockLen <= len - pos; pos += blockLen) this.process(dataView, pos);\n continue;\n }\n buffer.set(data.subarray(pos, pos + take), this.pos);\n this.pos += take;\n pos += take;\n if (this.pos === blockLen) {\n this.process(view, 0);\n this.pos = 0;\n }\n }\n this.length += data.length;\n this.roundClean();\n return this;\n }\n digestInto(out: Uint8Array): void {\n aexists(this);\n aoutput(out, this);\n this.finished = true;\n // Padding\n // We can avoid allocation of buffer for padding completely if it\n // was previously not allocated here. But it won't change performance.\n const { buffer, view, blockLen, isLE } = this;\n let { pos } = this;\n // append the bit '1' to the message\n buffer[pos++] = 0b10000000;\n clean(this.buffer.subarray(pos));\n // we have less than padOffset left in buffer, so we cannot put length in\n // current block, need process it and pad again\n if (this.padOffset > blockLen - pos) {\n this.process(view, 0);\n pos = 0;\n }\n // Pad until full block byte with zeros\n for (let i = pos; i < blockLen; i++) buffer[i] = 0;\n // Note: sha512 requires length to be 128bit integer, but length in JS will overflow before that\n // You need to write around 2 exabytes (u64_max / 8 / (1024**6)) for this to happen.\n // So we just write lowest 64 bits of that value.\n setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE);\n this.process(view, 0);\n const oview = createView(out);\n const len = this.outputLen;\n // NOTE: we do division by 4 later, which should be fused in single op with modulo by JIT\n if (len % 4) throw new Error('_sha2: outputLen should be aligned to 32bit');\n const outLen = len / 4;\n const state = this.get();\n if (outLen > state.length) throw new Error('_sha2: outputLen bigger than state');\n for (let i = 0; i < outLen; i++) oview.setUint32(4 * i, state[i], isLE);\n }\n digest(): Uint8Array {\n const { buffer, outputLen } = this;\n this.digestInto(buffer);\n const res = buffer.slice(0, outputLen);\n this.destroy();\n return res;\n }\n _cloneInto(to?: T): T {\n to ||= new (this.constructor as any)() as T;\n to.set(...this.get());\n const { blockLen, buffer, length, finished, destroyed, pos } = this;\n to.destroyed = destroyed;\n to.finished = finished;\n to.length = length;\n to.pos = pos;\n if (length % blockLen) to.buffer.set(buffer);\n return to;\n }\n clone(): T {\n return this._cloneInto();\n }\n}\n\n/**\n * Initial SHA-2 state: fractional parts of square roots of first 16 primes 2..53.\n * Check out `test/misc/sha2-gen-iv.js` for recomputation guide.\n */\n\n/** Initial SHA256 state. Bits 0..32 of frac part of sqrt of primes 2..19 */\nexport const SHA256_IV: Uint32Array = /* @__PURE__ */ Uint32Array.from([\n 0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,\n]);\n\n/** Initial SHA224 state. Bits 32..64 of frac part of sqrt of primes 23..53 */\nexport const SHA224_IV: Uint32Array = /* @__PURE__ */ Uint32Array.from([\n 0xc1059ed8, 0x367cd507, 0x3070dd17, 0xf70e5939, 0xffc00b31, 0x68581511, 0x64f98fa7, 0xbefa4fa4,\n]);\n\n/** Initial SHA384 state. Bits 0..64 of frac part of sqrt of primes 23..53 */\nexport const SHA384_IV: Uint32Array = /* @__PURE__ */ Uint32Array.from([\n 0xcbbb9d5d, 0xc1059ed8, 0x629a292a, 0x367cd507, 0x9159015a, 0x3070dd17, 0x152fecd8, 0xf70e5939,\n 0x67332667, 0xffc00b31, 0x8eb44a87, 0x68581511, 0xdb0c2e0d, 0x64f98fa7, 0x47b5481d, 0xbefa4fa4,\n]);\n\n/** Initial SHA512 state. Bits 0..64 of frac part of sqrt of primes 2..19 */\nexport const SHA512_IV: Uint32Array = /* @__PURE__ */ Uint32Array.from([\n 0x6a09e667, 0xf3bcc908, 0xbb67ae85, 0x84caa73b, 0x3c6ef372, 0xfe94f82b, 0xa54ff53a, 0x5f1d36f1,\n 0x510e527f, 0xade682d1, 0x9b05688c, 0x2b3e6c1f, 0x1f83d9ab, 0xfb41bd6b, 0x5be0cd19, 0x137e2179,\n]);\n", "/**\n * SHA2 hash function. A.k.a. sha256, sha384, sha512, sha512_224, sha512_256.\n * SHA256 is the fastest hash implementable in JS, even faster than Blake3.\n * Check out [RFC 4634](https://datatracker.ietf.org/doc/html/rfc4634) and\n * [FIPS 180-4](https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf).\n * @module\n */\nimport { Chi, HashMD, Maj, SHA224_IV, SHA256_IV, SHA384_IV, SHA512_IV } from './_md.ts';\nimport * as u64 from './_u64.ts';\nimport { type CHash, clean, createHasher, rotr } from './utils.ts';\n\n/**\n * Round constants:\n * First 32 bits of fractional parts of the cube roots of the first 64 primes 2..311)\n */\n// prettier-ignore\nconst SHA256_K = /* @__PURE__ */ Uint32Array.from([\n 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,\n 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,\n 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,\n 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,\n 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,\n 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,\n 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,\n 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2\n]);\n\n/** Reusable temporary buffer. \"W\" comes straight from spec. */\nconst SHA256_W = /* @__PURE__ */ new Uint32Array(64);\nexport class SHA256 extends HashMD<SHA256> {\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n protected A: number = SHA256_IV[0] | 0;\n protected B: number = SHA256_IV[1] | 0;\n protected C: number = SHA256_IV[2] | 0;\n protected D: number = SHA256_IV[3] | 0;\n protected E: number = SHA256_IV[4] | 0;\n protected F: number = SHA256_IV[5] | 0;\n protected G: number = SHA256_IV[6] | 0;\n protected H: number = SHA256_IV[7] | 0;\n\n constructor(outputLen: number = 32) {\n super(64, outputLen, 8, false);\n }\n protected get(): [number, number, number, number, number, number, number, number] {\n const { A, B, C, D, E, F, G, H } = this;\n return [A, B, C, D, E, F, G, H];\n }\n // prettier-ignore\n protected set(\n A: number, B: number, C: number, D: number, E: number, F: number, G: number, H: number\n ): void {\n this.A = A | 0;\n this.B = B | 0;\n this.C = C | 0;\n this.D = D | 0;\n this.E = E | 0;\n this.F = F | 0;\n this.G = G | 0;\n this.H = H | 0;\n }\n protected process(view: DataView, offset: number): void {\n // Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) SHA256_W[i] = view.getUint32(offset, false);\n for (let i = 16; i < 64; i++) {\n const W15 = SHA256_W[i - 15];\n const W2 = SHA256_W[i - 2];\n const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ (W15 >>> 3);\n const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ (W2 >>> 10);\n SHA256_W[i] = (s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16]) | 0;\n }\n // Compression function main loop, 64 rounds\n let { A, B, C, D, E, F, G, H } = this;\n for (let i = 0; i < 64; i++) {\n const sigma1 = rotr(E, 6) ^ rotr(E, 11) ^ rotr(E, 25);\n const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const sigma0 = rotr(A, 2) ^ rotr(A, 13) ^ rotr(A, 22);\n const T2 = (sigma0 + Maj(A, B, C)) | 0;\n H = G;\n G = F;\n F = E;\n E = (D + T1) | 0;\n D = C;\n C = B;\n B = A;\n A = (T1 + T2) | 0;\n }\n // Add the compressed chunk to the current hash value\n A = (A + this.A) | 0;\n B = (B + this.B) | 0;\n C = (C + this.C) | 0;\n D = (D + this.D) | 0;\n E = (E + this.E) | 0;\n F = (F + this.F) | 0;\n G = (G + this.G) | 0;\n H = (H + this.H) | 0;\n this.set(A, B, C, D, E, F, G, H);\n }\n protected roundClean(): void {\n clean(SHA256_W);\n }\n destroy(): void {\n this.set(0, 0, 0, 0, 0, 0, 0, 0);\n clean(this.buffer);\n }\n}\n\nexport class SHA224 extends SHA256 {\n protected A: number = SHA224_IV[0] | 0;\n protected B: number = SHA224_IV[1] | 0;\n protected C: number = SHA224_IV[2] | 0;\n protected D: number = SHA224_IV[3] | 0;\n protected E: number = SHA224_IV[4] | 0;\n protected F: number = SHA224_IV[5] | 0;\n protected G: number = SHA224_IV[6] | 0;\n protected H: number = SHA224_IV[7] | 0;\n constructor() {\n super(28);\n }\n}\n\n// SHA2-512 is slower than sha256 in js because u64 operations are slow.\n\n// Round contants\n// First 32 bits of the fractional parts of the cube roots of the first 80 primes 2..409\n// prettier-ignore\nconst K512 = /* @__PURE__ */ (() => u64.split([\n '0x428a2f98d728ae22', '0x7137449123ef65cd', '0xb5c0fbcfec4d3b2f', '0xe9b5dba58189dbbc',\n '0x3956c25bf348b538', '0x59f111f1b605d019', '0x923f82a4af194f9b', '0xab1c5ed5da6d8118',\n '0xd807aa98a3030242', '0x12835b0145706fbe', '0x243185be4ee4b28c', '0x550c7dc3d5ffb4e2',\n '0x72be5d74f27b896f', '0x80deb1fe3b1696b1', '0x9bdc06a725c71235', '0xc19bf174cf692694',\n '0xe49b69c19ef14ad2', '0xefbe4786384f25e3', '0x0fc19dc68b8cd5b5', '0x240ca1cc77ac9c65',\n '0x2de92c6f592b0275', '0x4a7484aa6ea6e483', '0x5cb0a9dcbd41fbd4', '0x76f988da831153b5',\n '0x983e5152ee66dfab', '0xa831c66d2db43210', '0xb00327c898fb213f', '0xbf597fc7beef0ee4',\n '0xc6e00bf33da88fc2', '0xd5a79147930aa725', '0x06ca6351e003826f', '0x142929670a0e6e70',\n '0x27b70a8546d22ffc', '0x2e1b21385c26c926', '0x4d2c6dfc5ac42aed', '0x53380d139d95b3df',\n '0x650a73548baf63de', '0x766a0abb3c77b2a8', '0x81c2c92e47edaee6', '0x92722c851482353b',\n '0xa2bfe8a14cf10364', '0xa81a664bbc423001', '0xc24b8b70d0f89791', '0xc76c51a30654be30',\n '0xd192e819d6ef5218', '0xd69906245565a910', '0xf40e35855771202a', '0x106aa07032bbd1b8',\n '0x19a4c116b8d2d0c8', '0x1e376c085141ab53', '0x2748774cdf8eeb99', '0x34b0bcb5e19b48a8',\n '0x391c0cb3c5c95a63', '0x4ed8aa4ae3418acb', '0x5b9cca4f7763e373', '0x682e6ff3d6b2b8a3',\n '0x748f82ee5defb2fc', '0x78a5636f43172f60', '0x84c87814a1f0ab72', '0x8cc702081a6439ec',\n '0x90befffa23631e28', '0xa4506cebde82bde9', '0xbef9a3f7b2c67915', '0xc67178f2e372532b',\n '0xca273eceea26619c', '0xd186b8c721c0c207', '0xeada7dd6cde0eb1e', '0xf57d4f7fee6ed178',\n '0x06f067aa72176fba', '0x0a637dc5a2c898a6', '0x113f9804bef90dae', '0x1b710b35131c471b',\n '0x28db77f523047d84', '0x32caab7b40c72493', '0x3c9ebe0a15c9bebc', '0x431d67c49c100d4c',\n '0x4cc5d4becb3e42b6', '0x597f299cfc657e2a', '0x5fcb6fab3ad6faec', '0x6c44198c4a475817'\n].map(n => BigInt(n))))();\nconst SHA512_Kh = /* @__PURE__ */ (() => K512[0])();\nconst SHA512_Kl = /* @__PURE__ */ (() => K512[1])();\n\n// Reusable temporary buffers\nconst SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);\nconst SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);\n\nexport class SHA512 extends HashMD<SHA512> {\n // We cannot use array here since array allows indexing by variable\n // which means optimizer/compiler cannot use registers.\n // h -- high 32 bits, l -- low 32 bits\n protected Ah: number = SHA512_IV[0] | 0;\n protected Al: number = SHA512_IV[1] | 0;\n protected Bh: number = SHA512_IV[2] | 0;\n protected Bl: number = SHA512_IV[3] | 0;\n protected Ch: number = SHA512_IV[4] | 0;\n protected Cl: number = SHA512_IV[5] | 0;\n protected Dh: number = SHA512_IV[6] | 0;\n protected Dl: number = SHA512_IV[7] | 0;\n protected Eh: number = SHA512_IV[8] | 0;\n protected El: number = SHA512_IV[9] | 0;\n protected Fh: number = SHA512_IV[10] | 0;\n protected Fl: number = SHA512_IV[11] | 0;\n protected Gh: number = SHA512_IV[12] | 0;\n protected Gl: number = SHA512_IV[13] | 0;\n protected Hh: number = SHA512_IV[14] | 0;\n protected Hl: number = SHA512_IV[15] | 0;\n\n constructor(outputLen: number = 64) {\n super(128, outputLen, 16, false);\n }\n // prettier-ignore\n protected get(): [\n number, number, number, number, number, number, number, number,\n number, number, number, number, number, number, number, number\n ] {\n const { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n return [Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl];\n }\n // prettier-ignore\n protected set(\n Ah: number, Al: number, Bh: number, Bl: number, Ch: number, Cl: number, Dh: number, Dl: number,\n Eh: number, El: number, Fh: number, Fl: number, Gh: number, Gl: number, Hh: number, Hl: number\n ): void {\n this.Ah = Ah | 0;\n this.Al = Al | 0;\n this.Bh = Bh | 0;\n this.Bl = Bl | 0;\n this.Ch = Ch | 0;\n this.Cl = Cl | 0;\n this.Dh = Dh | 0;\n this.Dl = Dl | 0;\n this.Eh = Eh | 0;\n this.El = El | 0;\n this.Fh = Fh | 0;\n this.Fl = Fl | 0;\n this.Gh = Gh | 0;\n this.Gl = Gl | 0;\n this.Hh = Hh | 0;\n this.Hl = Hl | 0;\n }\n protected process(view: DataView, offset: number): void {\n // Extend the first 16 words into the remaining 64 words w[16..79] of the message schedule array\n for (let i = 0; i < 16; i++, offset += 4) {\n SHA512_W_H[i] = view.getUint32(offset);\n SHA512_W_L[i] = view.getUint32((offset += 4));\n }\n for (let i = 16; i < 80; i++) {\n // s0 := (w[i-15] rightrotate 1) xor (w[i-15] rightrotate 8) xor (w[i-15] rightshift 7)\n const W15h = SHA512_W_H[i - 15] | 0;\n const W15l = SHA512_W_L[i - 15] | 0;\n const s0h = u64.rotrSH(W15h, W15l, 1) ^ u64.rotrSH(W15h, W15l, 8) ^ u64.shrSH(W15h, W15l, 7);\n const s0l = u64.rotrSL(W15h, W15l, 1) ^ u64.rotrSL(W15h, W15l, 8) ^ u64.shrSL(W15h, W15l, 7);\n // s1 := (w[i-2] rightrotate 19) xor (w[i-2] rightrotate 61) xor (w[i-2] rightshift 6)\n const W2h = SHA512_W_H[i - 2] | 0;\n const W2l = SHA512_W_L[i - 2] | 0;\n const s1h = u64.rotrSH(W2h, W2l, 19) ^ u64.rotrBH(W2h, W2l, 61) ^ u64.shrSH(W2h, W2l, 6);\n const s1l = u64.rotrSL(W2h, W2l, 19) ^ u64.rotrBL(W2h, W2l, 61) ^ u64.shrSL(W2h, W2l, 6);\n // SHA256_W[i] = s0 + s1 + SHA256_W[i - 7] + SHA256_W[i - 16];\n const SUMl = u64.add4L(s0l, s1l, SHA512_W_L[i - 7], SHA512_W_L[i - 16]);\n const SUMh = u64.add4H(SUMl, s0h, s1h, SHA512_W_H[i - 7], SHA512_W_H[i - 16]);\n SHA512_W_H[i] = SUMh | 0;\n SHA512_W_L[i] = SUMl | 0;\n }\n let { Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl } = this;\n // Compression function main loop, 80 rounds\n for (let i = 0; i < 80; i++) {\n // S1 := (e rightrotate 14) xor (e rightrotate 18) xor (e rightrotate 41)\n const sigma1h = u64.rotrSH(Eh, El, 14) ^ u64.rotrSH(Eh, El, 18) ^ u64.rotrBH(Eh, El, 41);\n const sigma1l = u64.rotrSL(Eh, El, 14) ^ u64.rotrSL(Eh, El, 18) ^ u64.rotrBL(Eh, El, 41);\n //const T1 = (H + sigma1 + Chi(E, F, G) + SHA256_K[i] + SHA256_W[i]) | 0;\n const CHIh = (Eh & Fh) ^ (~Eh & Gh);\n const CHIl = (El & Fl) ^ (~El & Gl);\n // T1 = H + sigma1 + Chi(E, F, G) + SHA512_K[i] + SHA512_W[i]\n // prettier-ignore\n const T1ll = u64.add5L(Hl, sigma1l, CHIl, SHA512_Kl[i], SHA512_W_L[i]);\n const T1h = u64.add5H(T1ll, Hh, sigma1h, CHIh, SHA512_Kh[i], SHA512_W_H[i]);\n const T1l = T1ll | 0;\n // S0 := (a rightrotate 28) xor (a rightrotate 34) xor (a rightrotate 39)\n const sigma0h = u64.rotrSH(Ah, Al, 28) ^ u64.rotrBH(Ah, Al, 34) ^ u64.rotrBH(Ah, Al, 39);\n const sigma0l = u64.rotrSL(Ah, Al, 28) ^ u64.rotrBL(Ah, Al, 34) ^ u64.rotrBL(Ah, Al, 39);\n const MAJh = (Ah & Bh) ^ (Ah & Ch) ^ (Bh & Ch);\n const MAJl = (Al & Bl) ^ (Al & Cl) ^ (Bl & Cl);\n Hh = Gh | 0;\n Hl = Gl | 0;\n Gh = Fh | 0;\n Gl = Fl | 0;\n Fh = Eh | 0;\n Fl = El | 0;\n ({ h: Eh, l: El } = u64.add(Dh | 0, Dl | 0, T1h | 0, T1l | 0));\n Dh = Ch | 0;\n Dl = Cl | 0;\n Ch = Bh | 0;\n Cl = Bl | 0;\n Bh = Ah | 0;\n Bl = Al | 0;\n const All = u64.add3L(T1l, sigma0l, MAJl);\n Ah = u64.add3H(All, T1h, sigma0h, MAJh);\n Al = All | 0;\n }\n // Add the compressed chunk to the current hash value\n ({ h: Ah, l: Al } = u64.add(this.Ah | 0, this.Al | 0, Ah | 0, Al | 0));\n ({ h: Bh, l: Bl } = u64.add(this.Bh | 0, this.Bl | 0, Bh | 0, Bl | 0));\n ({ h: Ch, l: Cl } = u64.add(this.Ch | 0, this.Cl | 0, Ch | 0, Cl | 0));\n ({ h: Dh, l: Dl } = u64.add(this.Dh | 0, this.Dl | 0, Dh | 0, Dl | 0));\n ({ h: Eh, l: El } = u64.add(this.Eh | 0, this.El | 0, Eh | 0, El | 0));\n ({ h: Fh, l: Fl } = u64.add(this.Fh | 0, this.Fl | 0, Fh | 0, Fl | 0));\n ({ h: Gh, l: Gl } = u64.add(this.Gh | 0, this.Gl | 0, Gh | 0, Gl | 0));\n ({ h: Hh, l: Hl } = u64.add(this.Hh | 0, this.Hl | 0, Hh | 0, Hl | 0));\n this.set(Ah, Al, Bh, Bl, Ch, Cl, Dh, Dl, Eh, El, Fh, Fl, Gh, Gl, Hh, Hl);\n }\n protected roundClean(): void {\n clean(SHA512_W_H, SHA512_W_L);\n }\n destroy(): void {\n clean(this.buffer);\n this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n }\n}\n\nexport class SHA384 extends SHA512 {\n protected Ah: number = SHA384_IV[0] | 0;\n protected Al: number = SHA384_IV[1] | 0;\n protected Bh: number = SHA384_IV[2] | 0;\n protected Bl: number = SHA384_IV[3] | 0;\n protected Ch: number = SHA384_IV[4] | 0;\n protected Cl: number = SHA384_IV[5] | 0;\n protected Dh: number = SHA384_IV[6] | 0;\n protected Dl: number = SHA384_IV[7] | 0;\n protected Eh: number = SHA384_IV[8] | 0;\n protected El: number = SHA384_IV[9] | 0;\n protected Fh: number = SHA384_IV[10] | 0;\n protected Fl: number = SHA384_IV[11] | 0;\n protected Gh: number = SHA384_IV[12] | 0;\n protected Gl: number = SHA384_IV[13] | 0;\n protected Hh: number = SHA384_IV[14] | 0;\n protected Hl: number = SHA384_IV[15] | 0;\n\n constructor() {\n super(48);\n }\n}\n\n/**\n * Truncated SHA512/256 and SHA512/224.\n * SHA512_IV is XORed with 0xa5a5a5a5a5a5a5a5, then used as \"intermediary\" IV of SHA512/t.\n * Then t hashes string to produce result IV.\n * See `test/misc/sha2-gen-iv.js`.\n */\n\n/** SHA512/224 IV */\nconst T224_IV = /* @__PURE__ */ Uint32Array.from([\n 0x8c3d37c8, 0x19544da2, 0x73e19966, 0x89dcd4d6, 0x1dfab7ae, 0x32ff9c82, 0x679dd514, 0x582f9fcf,\n 0x0f6d2b69, 0x7bd44da8, 0x77e36f73, 0x04c48942, 0x3f9d85a8, 0x6a1d36c8, 0x1112e6ad, 0x91d692a1,\n]);\n\n/** SHA512/256 IV */\nconst T256_IV = /* @__PURE__ */ Uint32Array.from([\n 0x22312194, 0xfc2bf72c, 0x9f555fa3, 0xc84c64c2, 0x2393b86b, 0x6f53b151, 0x96387719, 0x5940eabd,\n 0x96283ee2, 0xa88effe3, 0xbe5e1e25, 0x53863992, 0x2b0199fc, 0x2c85b8aa, 0x0eb72ddc, 0x81c52ca2,\n]);\n\nexport class SHA512_224 extends SHA512 {\n protected Ah: number = T224_IV[0] | 0;\n protected Al: number = T224_IV[1] | 0;\n protected Bh: number = T224_IV[2] | 0;\n protected Bl: number = T224_IV[3] | 0;\n protected Ch: number = T224_IV[4] | 0;\n protected Cl: number = T224_IV[5] | 0;\n protected Dh: number = T224_IV[6] | 0;\n protected Dl: number = T224_IV[7] | 0;\n protected Eh: number = T224_IV[8] | 0;\n protected El: number = T224_IV[9] | 0;\n protected Fh: number = T224_IV[10] | 0;\n protected Fl: number = T224_IV[11] | 0;\n protected Gh: number = T224_IV[12] | 0;\n protected Gl: number = T224_IV[13] | 0;\n protected Hh: number = T224_IV[14] | 0;\n protected Hl: number = T224_IV[15] | 0;\n\n constructor() {\n super(28);\n }\n}\n\nexport class SHA512_256 extends SHA512 {\n protected Ah: number = T256_IV[0] | 0;\n protected Al: number = T256_IV[1] | 0;\n protected Bh: number = T256_IV[2] | 0;\n protected Bl: number = T256_IV[3] | 0;\n protected Ch: number = T256_IV[4] | 0;\n protected Cl: number = T256_IV[5] | 0;\n protected Dh: number = T256_IV[6] | 0;\n protected Dl: number = T256_IV[7] | 0;\n protected Eh: number = T256_IV[8] | 0;\n protected El: number = T256_IV[9] | 0;\n protected Fh: number = T256_IV[10] | 0;\n protected Fl: number = T256_IV[11] | 0;\n protected Gh: number = T256_IV[12] | 0;\n protected Gl: number = T256_IV[13] | 0;\n protected Hh: number = T256_IV[14] | 0;\n protected Hl: number = T256_IV[15] | 0;\n\n constructor() {\n super(32);\n }\n}\n\n/**\n * SHA2-256 hash function from RFC 4634.\n *\n * It is the fastest JS hash, even faster than Blake3.\n * To break sha256 using birthday attack, attackers need to try 2^128 hashes.\n * BTC network is doing 2^70 hashes/sec (2^95 hashes/year) as per 2025.\n */\nexport const sha256: CHash = /* @__PURE__ */ createHasher(() => new SHA256());\n/** SHA2-224 hash function from RFC 4634 */\nexport const sha224: CHash = /* @__PURE__ */ createHasher(() => new SHA224());\n\n/** SHA2-512 hash function from RFC 4634. */\nexport const sha512: CHash = /* @__PURE__ */ createHasher(() => new SHA512());\n/** SHA2-384 hash function from RFC 4634. */\nexport const sha384: CHash = /* @__PURE__ */ createHasher(() => new SHA384());\n\n/**\n * SHA2-512/256 \"truncated\" hash function, with improved resistance to length extension attacks.\n * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).\n */\nexport const sha512_256: CHash = /* @__PURE__ */ createHasher(() => new SHA512_256());\n/**\n * SHA2-512/224 \"truncated\" hash function, with improved resistance to length extension attacks.\n * See the paper on [truncated SHA512](https://eprint.iacr.org/2010/548.pdf).\n */\nexport const sha512_224: CHash = /* @__PURE__ */ createHasher(() => new SHA512_224());\n", "import { base32Decode, base32Encode } from './utils/base32.ts';\nimport { getCrc32 } from './utils/getCrc.ts';\nimport { sha224 } from '@noble/hashes/sha2';\nimport { bytesToHex, hexToBytes } from '@noble/hashes/utils';\n\nexport const JSON_KEY_PRINCIPAL = '__principal__';\nconst SELF_AUTHENTICATING_SUFFIX = 2;\nconst ANONYMOUS_SUFFIX = 4;\n\nconst MANAGEMENT_CANISTER_PRINCIPAL_TEXT_STR = 'aaaaa-aa';\n\nexport type JsonnablePrincipal = {\n [JSON_KEY_PRINCIPAL]: string;\n};\n\nexport class Principal {\n public static anonymous(): Principal {\n return new this(new Uint8Array([ANONYMOUS_SUFFIX]));\n }\n\n /**\n * Utility method, returning the principal representing the management canister, decoded from the hex string `'aaaaa-aa'`\n * @returns {Principal} principal of the management canister\n */\n public static managementCanister(): Principal {\n return this.fromText(MANAGEMENT_CANISTER_PRINCIPAL_TEXT_STR);\n }\n\n public static selfAuthenticating(publicKey: Uint8Array): Principal {\n const sha = sha224(publicKey);\n return new this(new Uint8Array([...sha, SELF_AUTHENTICATING_SUFFIX]));\n }\n\n public static from(other: unknown): Principal {\n if (typeof other === 'string') {\n return Principal.fromText(other);\n } else if (Object.getPrototypeOf(other) === Uint8Array.prototype) {\n return new Principal(other as Uint8Array);\n } else if (Principal.isPrincipal(other)) {\n return new Principal(other._arr);\n }\n\n throw new Error(`Impossible to convert ${JSON.stringify(other)} to Principal.`);\n }\n\n public static fromHex(hex: string): Principal {\n return new this(hexToBytes(hex));\n }\n\n public static fromText(text: string): Principal {\n let maybePrincipal = text;\n // If formatted as JSON string, parse it first\n if (text.includes(JSON_KEY_PRINCIPAL)) {\n const obj = JSON.parse(text);\n if (JSON_KEY_PRINCIPAL in obj) {\n maybePrincipal = obj[JSON_KEY_PRINCIPAL];\n }\n }\n\n const canisterIdNoDash = maybePrincipal.toLowerCase().replace(/-/g, '');\n\n let arr = base32Decode(canisterIdNoDash);\n arr = arr.slice(4, arr.length);\n\n const principal = new this(arr);\n if (principal.toText() !== maybePrincipal) {\n throw new Error(\n `Principal \"${principal.toText()}\" does not have a valid checksum (original value \"${maybePrincipal}\" may not be a valid Principal ID).`,\n );\n }\n\n return principal;\n }\n\n public static fromUint8Array(arr: Uint8Array): Principal {\n return new this(arr);\n }\n\n public static isPrincipal(other: unknown): other is Principal {\n return (\n other instanceof Principal ||\n (typeof other === 'object' &&\n other !== null &&\n '_isPrincipal' in other &&\n (other as { _isPrincipal: boolean })['_isPrincipal'] === true &&\n '_arr' in other &&\n (other as { _arr: Uint8Array })['_arr'] instanceof Uint8Array)\n );\n }\n\n public readonly _isPrincipal = true;\n\n protected constructor(private _arr: Uint8Array) {}\n\n public isAnonymous(): boolean {\n return this._arr.byteLength === 1 && this._arr[0] === ANONYMOUS_SUFFIX;\n }\n\n public toUint8Array(): Uint8Array {\n return this._arr;\n }\n\n public toHex(): string {\n return bytesToHex(this._arr).toUpperCase();\n }\n\n public toText(): string {\n const checksumArrayBuf = new ArrayBuffer(4);\n const view = new DataView(checksumArrayBuf);\n view.setUint32(0, getCrc32(this._arr));\n const checksum = new Uint8Array(checksumArrayBuf);\n\n const array = new Uint8Array([...checksum, ...this._arr]);\n\n const result = base32Encode(array);\n const matches = result.match(/.{1,5}/g);\n if (!matches) {\n // This should only happen if there's no character, which is unreachable.\n throw new Error();\n }\n return matches.join('-');\n }\n\n public toString(): string {\n return this.toText();\n }\n\n /**\n * Serializes to JSON\n * @returns {JsonnablePrincipal} a JSON object with a single key, {@link JSON_KEY_PRINCIPAL}, whose value is the principal as a string\n */\n public toJSON(): JsonnablePrincipal {\n return { [JSON_KEY_PRINCIPAL]: this.toText() };\n }\n\n /**\n * Utility method taking a Principal to compare against. Used for determining canister ranges in certificate verification\n * @param {Principal} other - a {@link Principal} to compare\n * @returns {'lt' | 'eq' | 'gt'} `'lt' | 'eq' | 'gt'` a string, representing less than, equal to, or greater than\n */\n public compareTo(other: Principal): 'lt' | 'eq' | 'gt' {\n for (let i = 0; i < Math.min(this._arr.length, other._arr.length); i++) {\n if (this._arr[i] < other._arr[i]) return 'lt';\n else if (this._arr[i] > other._arr[i]) return 'gt';\n }\n // Here, at least one principal is a prefix of the other principal (they could be the same)\n if (this._arr.length < other._arr.length) return 'lt';\n if (this._arr.length > other._arr.length) return 'gt';\n return 'eq';\n }\n\n /**\n * Utility method checking whether a provided Principal is less than or equal to the current one using the {@link Principal.compareTo} method\n * @param other a {@link Principal} to compare\n * @returns {boolean} boolean\n */\n public ltEq(other: Principal): boolean {\n const cmp = this.compareTo(other);\n return cmp == 'lt' || cmp == 'eq';\n }\n\n /**\n * Utility method checking whether a provided Principal is greater than or equal to the current one using the {@link Principal.compareTo} method\n * @param other a {@link Principal} to compare\n * @returns {boolean} boolean\n */\n public gtEq(other: Principal): boolean {\n const cmp = this.compareTo(other);\n return cmp == 'gt' || cmp == 'eq';\n }\n}\n", "import * as z from 'zod';\nimport {type JunoConfigEnv, JunoConfigEnvSchema} from '../types/juno.env';\n\n/**\n * @see OnRunEnv\n */\nexport const OnRunEnvSchema = JunoConfigEnvSchema.extend({\n profile: z.string().optional()\n});\n\n/**\n * The environment available when executing `juno run`.\n */\nexport type OnRunEnv = JunoConfigEnv & {\n /**\n * Optional profile (e.g. `personal`, `team`) used for execution.\n */\n profile?: string;\n};\n", "import * as z from 'zod';\n\n/**\n * @see JunoConfigMode\n */\nexport const JunoConfigModeSchema = z.union([z.literal('production'), z.string()]);\n\n/**\n * Represents the mode of the Juno configuration.\n * @typedef {'production' | string} JunoConfigMode\n */\nexport type JunoConfigMode = 'production' | string;\n\n/**\n * @see JunoConfigEnv\n */\nexport const JunoConfigEnvSchema = z.object({\n mode: JunoConfigModeSchema\n});\n\n/**\n * Represents the environment configuration for Juno.\n * @interface JunoConfigEnv\n */\nexport interface JunoConfigEnv {\n /**\n * The mode of the Juno configuration.\n * @type {JunoConfigMode}\n */\n mode: JunoConfigMode;\n}\n", "import type {JunoConfigEnv} from '../types/juno.env';\nimport type {JunoConsoleConfig} from './console.config';\n\nexport type JunoConsoleConfigFn = (config: JunoConfigEnv) => JunoConsoleConfig;\n\nexport type JunoConsoleConfigFnOrObject = JunoConsoleConfig | JunoConsoleConfigFn;\n\nexport function defineConsoleConfig(config: JunoConsoleConfig): JunoConsoleConfig;\nexport function defineConsoleConfig(config: JunoConsoleConfigFn): JunoConsoleConfigFn;\nexport function defineConsoleConfig(\n config: JunoConsoleConfigFnOrObject\n): JunoConsoleConfigFnOrObject;\nexport function defineConsoleConfig(\n config: JunoConsoleConfigFnOrObject\n): JunoConsoleConfigFnOrObject {\n return config;\n}\n", "import {type PrincipalText, PrincipalTextSchema} from '@dfinity/zod-schemas';\nimport * as z from 'zod';\nimport {\n type AuthenticationConfig,\n AuthenticationConfigSchema\n} from '../shared/authentication.config';\nimport {type StorageConfig, StorageConfigSchema} from '../shared/storage.config';\nimport {type CliConfig, CliConfigSchema} from '../types/cli.config';\nimport {type JunoConfigMode, JunoConfigModeSchema} from '../types/juno.env';\nimport type {Either} from '../types/utility.types';\nimport {StrictPrincipalTextSchema} from '../utils/principal.utils';\n\n/**\n * @see ConsoleId\n */\nexport const ConsoleIdSchema = z.object({\n id: PrincipalTextSchema\n});\n\n/**\n * Represents the unique identifier for a console.\n * @interface ConsoleId\n */\nexport interface ConsoleId {\n /**\n * The unique identifier (ID) of the console.\n * @type {string}\n */\n id: PrincipalText;\n}\n\n/**\n * @see ConsoleIds\n */\nexport const ConsoleIdsSchema = z.object({\n ids: z.record(JunoConfigModeSchema, StrictPrincipalTextSchema)\n});\n\n/**\n * Represents a mapping of console identifiers to different configurations based on the mode of the application.\n * @interface ConsoleIds\n */\nexport interface ConsoleIds {\n /**\n * A mapping of console identifiers (IDs) to different configurations based on the mode of the application.\n *\n * This allows the application to use different console IDs, such as production, staging, etc.\n * @type {Record<JunoConfigMode, string>}\n */\n ids: Record<JunoConfigMode, PrincipalText>;\n}\n\nconst JunoConsoleConfigBaseSchema = z.object({\n ...CliConfigSchema.shape,\n storage: StorageConfigSchema.optional(),\n authentication: AuthenticationConfigSchema.optional()\n});\n\n/**\n * @see JunoConsoleConfig\n */\nexport const JunoConsoleConfigSchema = z.union([\n z\n .object({\n ...ConsoleIdSchema.shape,\n ...JunoConsoleConfigBaseSchema.shape\n })\n .strict(),\n z\n .object({\n ...ConsoleIdsSchema.shape,\n ...JunoConsoleConfigBaseSchema.shape\n })\n .strict()\n]);\n\n/**\n * Represents the configuration for a console.\n * @typedef {Either<ConsoleId, ConsoleIds>} ConsoleConfig\n */\nexport type JunoConsoleConfig = Either<ConsoleId, ConsoleIds> &\n CliConfig & {\n /**\n * Optional configuration parameters for the console, affecting the operational behavior of its Storage.\n * @type {StorageConfig}\n * @optional\n */\n storage?: StorageConfig;\n\n /**\n * Optional configuration parameters for the console, affecting the operational behavior of its Authentication.\n * @type {AuthenticationConfig}\n * @optional\n */\n authentication?: AuthenticationConfig;\n };\n", "import {type PrincipalText, PrincipalTextSchema} from '@dfinity/zod-schemas';\nimport * as z from 'zod';\n\n/**\n * @see AuthenticationConfigInternetIdentity\n */\nexport const AuthenticationConfigInternetIdentitySchema = z.strictObject({\n derivationOrigin: z.url().optional(),\n externalAlternativeOrigins: z.array(z.url()).optional()\n});\n\n/**\n * Configure the behavior of Internet Identity.\n * @interface AuthenticationConfigInternetIdentity\n */\nexport interface AuthenticationConfigInternetIdentity {\n /**\n * This setting ensures that users are recognized on your app, regardless of whether they use the default URL or any other custom domain.\n * For example, if set to hello.com, a user signing on at https://hello.com will receive the same identifier (principal) as when signing on at https://www.hello.com.\n * @type {string}\n * @optional\n */\n derivationOrigin?: string;\n\n /**\n * An optional list of external alternative origins allowed for authentication, which can be useful if you want to reuse the same derivation origin across multiple Satellites.\n * @type {string[]}\n * @optional\n */\n externalAlternativeOrigins?: string[];\n}\n\n/**\n * @see AuthenticationConfigDelegation\n */\nexport const AuthenticationConfigDelegationSchema = z.strictObject({\n allowedTargets: z.array(PrincipalTextSchema).nullable().optional(),\n sessionDuration: z\n .bigint()\n .max(\n 30n * 24n * 60n * 60n * 1_000_000_000n,\n 'The maximal length of a defined session duration - maxTimeToLive - cannot exceed 30 days'\n )\n .optional()\n});\n\n/**\n * Configure the delegation behavior for authentication.\n *\n * @interface AuthenticationConfigDelegation\n */\nexport interface AuthenticationConfigDelegation {\n /**\n * List of allowed targets (backend modules) that authenticated users\n * may call using the issued session.\n *\n * - Omit this value to restrict access to this Satellite only (default).\n * - Provide an array to explicitly allow only those targets.\n * - Set to `null` to allow calling any backend.\n *\n * \u26A0\uFE0F Setting to `null` removes all restrictions \u2014 use with caution.\n */\n allowedTargets?: PrincipalText[] | null;\n\n /**\n * Duration for which a session remains valid, expressed in nanoseconds.\n *\n * Defaults to 1 day. Cannot exceed 30 days.\n *\n * Once issued, a session cannot be extended or shortened.\n * New settings only apply to future logins.\n */\n sessionDuration?: bigint;\n}\n\n/**\n * @see AuthenticationConfigGoogle\n */\nexport const AuthenticationConfigGoogleSchema = z.strictObject({\n clientId: z\n .string()\n .trim()\n .regex(/^[0-9]+-[a-z0-9]+\\.apps\\.googleusercontent\\.com$/, 'Invalid Google client ID format')\n .max(128, 'Google clientId too long'),\n delegation: AuthenticationConfigDelegationSchema.optional()\n});\n\n/**\n * Configure the sign-in with Google.\n *\n * @interface AuthenticationConfigGoogle\n */\nexport interface AuthenticationConfigGoogle {\n /**\n * The OAuth 2.0 client ID from your\n * [Google Cloud Console](https://console.cloud.google.com/apis/credentials).\n *\n * Example: `\"1234567890-abcdefg.apps.googleusercontent.com\"`\n *\n * @type {string}\n */\n clientId: string;\n\n /**\n * Optional delegation settings for authentication.\n * If omitted, the default delegation behavior applies.\n */\n delegation?: AuthenticationConfigDelegation;\n}\n\n/**\n * @see AuthenticationConfigRules\n */\nexport const AuthenticationConfigRulesSchema = z.strictObject({\n allowedCallers: z.array(PrincipalTextSchema)\n});\n\n/**\n * Configure the rules of the authentication.\n * @interface AuthenticationConfigRules\n */\nexport interface AuthenticationConfigRules {\n /**\n * This option defines who's allowed to use your app.\n *\n * If you enable this, only the identities you list (in user key, format, like `bj4r4-5cdop-...`) will be allowed to sign in or use any features like Datastore or Storage.\n *\n * @type {PrincipalText[]}\n * @optional\n */\n allowedCallers: PrincipalText[];\n}\n\n/**\n * @see AuthenticationConfig\n */\nexport const AuthenticationConfigSchema = z.strictObject({\n internetIdentity: AuthenticationConfigInternetIdentitySchema.optional(),\n google: AuthenticationConfigGoogleSchema.optional(),\n rules: AuthenticationConfigRulesSchema.optional(),\n version: z.bigint().optional()\n});\n\n/**\n * Configures the Authentication options of a Satellite.\n * @interface AuthenticationConfig\n */\nexport interface AuthenticationConfig {\n /**\n * Optional configuration of Internet Identity authentication method.\n * @type {AuthenticationConfigInternetIdentity}\n * @optional\n */\n internetIdentity?: AuthenticationConfigInternetIdentity;\n\n /**\n * Optional configuration for enabling Google authentication method.\n * @type {AuthenticationConfigGoogle}\n * @optional\n */\n google?: AuthenticationConfigGoogle;\n\n /**\n * Optional configuration for the rules of the authentication.\n * @type {AuthenticationConfigRules}\n * @optional\n */\n rules?: AuthenticationConfigRules;\n\n /**\n * The current version of the config.\n *\n * Optional. The CLI will automatically resolve the version and warn you if there's a potential overwrite.\n * You can provide it if you want to manage versioning manually within your config file.\n *\n * @type {bigint}\n * @optional\n */\n version?: bigint;\n}\n", "import * as z from 'zod';\nimport {type MaxMemorySizeConfig, MaxMemorySizeConfigSchema} from './feature.config';\n\n/**\n * @see StorageConfigSourceGlob\n */\nexport const StorageConfigSourceGlobSchema = z.string();\n\n/**\n * Represents a glob pattern for matching files in the Storage configuration.\n * @typedef {string} StorageConfigSourceGlob\n */\nexport type StorageConfigSourceGlob = string;\n\n/**\n * @see StorageConfigHeader\n */\nexport const StorageConfigHeaderSchema = z\n .object({\n source: StorageConfigSourceGlobSchema,\n headers: z.array(z.tuple([z.string(), z.string()]))\n })\n .strict();\n\n/**\n * Headers allow the client and the Storage to pass additional information along with a request or a response.\n * Some sets of headers can affect how the browser handles the page and its content.\n * @interface StorageConfigHeader\n */\nexport interface StorageConfigHeader {\n /**\n * The glob pattern used to match files within the Storage that these headers will apply to.\n * @type {StorageConfigSourceGlob}\n */\n source: StorageConfigSourceGlob;\n\n /**\n * An array of key-value pairs representing the headers to apply.\n * Each pair includes the header name and its value.\n * Example: `[[\"Cache-Control\", \"max-age=3600\"], [\"X-Custom-Header\", \"value\"]]`\n * @type {Array<[string, string]>}\n */\n headers: [string, string][];\n}\n\n/**\n * @see StorageConfigRewrite\n */\nexport const StorageConfigRewriteSchema = z\n .object({\n source: StorageConfigSourceGlobSchema,\n destination: z.string()\n })\n .strict();\n\n/**\n * You can utilize optional rewrites to display the same content for multiple URLs.\n * Rewrites are especially useful when combined with pattern matching, allowing acceptance of any URL that matches the pattern.\n * @interface StorageConfigRewrite\n */\nexport interface StorageConfigRewrite {\n /**\n * The glob pattern or specific path to match for incoming requests.\n * Matches are rewritten to the specified destination.\n * @type {StorageConfigSourceGlob}\n */\n source: StorageConfigSourceGlob;\n\n /**\n * The destination path or file to which matching requests should be rewritten.\n * @type {string}\n */\n destination: string;\n}\n\n/**\n * @see StorageConfigRedirect\n */\nexport const StorageConfigRedirectSchema = z\n .object({\n source: StorageConfigSourceGlobSchema,\n location: z.string(),\n code: z.union([z.literal(301), z.literal(302)])\n })\n .strict();\n\n/**\n * Use a URL redirect to prevent broken links if you've moved a page or to shorten URLs.\n * @interface StorageConfigRedirect\n */\nexport interface StorageConfigRedirect {\n /**\n * The glob pattern or specific path to match for incoming requests that should be redirected.\n * @type {StorageConfigSourceGlob}\n */\n source: StorageConfigSourceGlob;\n\n /**\n * The URL or path to which the request should be redirected.\n * @type {string}\n */\n location: string;\n\n /**\n * The HTTP status code to use for the redirect, typically 301 (permanent redirect) or 302 (temporary redirect).\n * @type {301 | 302}\n */\n code: 301 | 302;\n}\n\n/**\n * @see StorageConfig\n */\nexport const StorageConfigSchema = z.object({\n headers: z.array(StorageConfigHeaderSchema).optional(),\n rewrites: z.array(StorageConfigRewriteSchema).optional(),\n redirects: z.array(StorageConfigRedirectSchema).optional(),\n iframe: z.enum(['deny', 'same-origin', 'allow-any']).optional(),\n rawAccess: z.boolean().optional(),\n maxMemorySize: MaxMemorySizeConfigSchema.optional(),\n version: z.bigint().optional()\n});\n\n/**\n * Configures the hosting behavior of the Storage.\n * @interface StorageConfig\n */\nexport interface StorageConfig {\n /**\n * Optional array of `StorageConfigHeader` objects to define custom HTTP headers for specific files or patterns.\n * @type {StorageConfigHeader[]}\n * @optional\n */\n headers?: StorageConfigHeader[];\n\n /**\n * Optional array of `StorageConfigRewrite` objects to define rewrite rules.\n * @type {StorageConfigRewrite[]}\n * @optional\n */\n rewrites?: StorageConfigRewrite[];\n\n /**\n * Optional array of `StorageConfigRedirect` objects to define HTTP redirects.\n * @type {StorageConfigRedirect[]}\n * @optional\n */\n redirects?: StorageConfigRedirect[];\n\n /**\n * For security reasons and to prevent click-jacking attacks, dapps deployed with Juno are, by default, set to deny embedding in other sites.\n *\n * Options are:\n * - `deny`: Prevents any content from being displayed in an iframe.\n * - `same-origin`: Allows iframe content from the same origin as the page.\n * - `allow-any`: Allows iframe content from any origin.\n *\n * If not specified, then `deny` is used as default value.\n * @type {'deny' | 'same-origin' | 'allow-any'}\n * @optional\n */\n iframe?: 'deny' | 'same-origin' | 'allow-any';\n\n /**\n * Optional flag to enable access for raw URLs.\n *\n * \u26A0\uFE0F **WARNING: Enabling this option is highly discouraged due to security risks.**\n *\n * Enabling this option allows access to raw URLs (e.g., https://satellite-id.raw.icp0.io), bypassing certificate validation.\n * This creates a security vulnerability where a malicious node in the chain can respond to requests with malicious or invalid content.\n * Since there is no validation on raw URLs, the client may receive and process harmful data.\n *\n * If not specified, the default value is `false`.\n * @type {boolean}\n * @optional\n */\n rawAccess?: boolean;\n\n /**\n * Configuration for maximum memory size limits for the Storage.\n *\n * This is used to specify optional limits on heap and stable memory for the smart contract.\n * When the limit is reached, the Storage and smart contract continue to operate normally but reject the upload of new assets.\n *\n * If not specified, no memory limits are enforced.\n *\n * @type {MaxMemorySizeConfig}\n * @optional\n */\n maxMemorySize?: MaxMemorySizeConfig;\n\n /**\n * The current version of the config.\n *\n * Optional. The CLI will automatically resolve the version and warn you if there's a potential overwrite.\n * You can provide it if you want to manage versioning manually within your config file.\n *\n * @type {bigint}\n * @optional\n */\n version?: bigint;\n}\n", "import * as z from 'zod';\n\n/**\n * @see MaxMemorySizeConfig\n */\nexport const MaxMemorySizeConfigSchema = z\n .object({\n heap: z.bigint().optional(),\n stable: z.bigint().optional()\n })\n .strict();\n\n/**\n * Configuration for granting access to features only if the maximum memory size limits are not reached.\n *\n * The maximum size corresponds to the overall heap or stable memory of the smart contract.\n */\nexport interface MaxMemorySizeConfig {\n /**\n * Maximum allowed heap memory size in bytes.\n *\n * This field is optional. If not specified, no limit is enforced on the heap memory size.\n *\n * @type {bigint}\n */\n heap?: bigint;\n\n /**\n * Maximum allowed stable memory size in bytes.\n *\n * This field is optional. If not specified, no limit is enforced on the stable memory size.\n *\n * @type {bigint}\n */\n stable?: bigint;\n}\n", "import * as z from 'zod';\nimport {type EncodingType, EncodingTypeSchema} from './encoding';\n\n/**\n * @see Precompress\n */\nexport const PrecompressSchema = z.strictObject({\n pattern: z.string().optional(),\n mode: z.enum(['both', 'replace']).optional(),\n algorithm: z.enum(['gzip', 'brotli']).optional()\n});\n\n/**\n * @see CliConfig\n */\nexport const CliConfigSchema = z.strictObject({\n source: z.string().optional(),\n ignore: z.array(z.string()).optional(),\n precompress: z\n .union([PrecompressSchema, z.array(PrecompressSchema), z.literal(false)])\n .optional(),\n encoding: z.array(z.tuple([z.string(), EncodingTypeSchema])).optional(),\n predeploy: z.array(z.string()).optional(),\n postdeploy: z.array(z.string()).optional()\n});\n\n/**\n * Configuration for compressing files during deployment.\n */\nexport interface Precompress {\n /**\n * Glob pattern for files to precompress.\n * @default any css|js|mjs|html\n */\n pattern?: string;\n\n /**\n * Determines what happens to the original files after compression:\n * - `\"both\"` \u2014 upload both original and compressed versions.\n * - `\"replace\"` \u2014 upload only the compressed version (served with `Content-Encoding`).\n *\n * @default \"both\"\n */\n mode?: 'both' | 'replace';\n\n /**\n * Compression algorithm.\n * @default \"gzip\"\n */\n algorithm?: 'gzip' | 'brotli';\n}\n\n/**\n * The configuration used by the CLI to resolve, prepare and deploy your app.\n */\nexport interface CliConfig {\n /**\n * Specifies the directory from which to deploy to Storage.\n * For instance, if `npm run build` outputs files to a `dist` folder, use `source: 'dist'`.\n *\n * @default 'build'\n * @type {string}\n */\n source?: string;\n\n /**\n * Specifies files or patterns to ignore during deployment, using glob patterns similar to those in .gitignore.\n * @type {string[]}\n * @optional\n */\n ignore?: string[];\n\n /**\n * Controls compression optimization for files in the source folder.\n *\n * By default, JavaScript (.js), ES Modules (.mjs), CSS (.css), and HTML (.html)\n * are compressed, and both the original and compressed versions are uploaded.\n *\n * Set to `false` to disable, or provide one or more {@link Precompress} objects to customize.\n *\n * @type {Precompress | Precompress[] | false}\n * @optional\n */\n precompress?: Precompress | Precompress[] | false;\n\n /**\n * Customizes file encoding mapping for HTTP response headers `Content-Encoding` based on file extension:\n * - `.Z` for compress,\n * - `.gz` for gzip,\n * - `.br` for brotli,\n * - `.zlib` for deflate,\n * - anything else defaults to `identity`.\n * The \"encoding\" attribute allows overriding default mappings with an array of glob patterns and encoding types.\n * @type {Array<[string, EncodingType]>}\n * @optional\n */\n encoding?: Array<[string, EncodingType]>;\n\n /**\n * Defines a list of scripts or commands to be run before the deployment process begins.\n * This can be useful for tasks such as compiling assets, running tests, or building production-ready files.\n *\n * Example:\n * ```json\n * {\n * \"predeploy\": [\"npm run build\", \"npm run lint\"]\n * }\n * ```\n *\n * @type {string[]}\n * @optional\n */\n predeploy?: string[];\n\n /**\n * Defines a list of scripts or commands to be run after the deployment process completes.\n * This can be used for tasks such as notifications, cleanup, or sending confirmation messages to services or team members.\n *\n * Example:\n * ```json\n * {\n * \"postdeploy\": [\"./scripts/notify-admins.sh\", \"echo 'Deployment complete'\"]\n * }\n * ```\n *\n * @type {string[]}\n * @optional\n */\n postdeploy?: string[];\n}\n", "import * as z from 'zod';\n\n/**\n * see EncodingType\n */\nexport const EncodingTypeSchema = z.enum(['identity', 'gzip', 'compress', 'deflate', 'br']);\n\n/**\n * Represents the encoding types for assets.\n * @typedef {'identity' | 'gzip' | 'compress' | 'deflate' | 'br'} EncodingType\n */\nexport type EncodingType = 'identity' | 'gzip' | 'compress' | 'deflate' | 'br';\n", "import * as z from 'zod';\n\n/**\n * @see JunoPackageDependencies\n */\nexport const JunoPackageDependenciesSchema = z.record(z.string(), z.string());\n\n/**\n * @see JunoPackage\n */\nexport const JunoPackageSchema = z.object({\n name: z.string(),\n version: z.string(),\n dependencies: JunoPackageDependenciesSchema.optional()\n});\n", "/**\n * The ID used to identify a Juno Satellite.\n *\n * It is either the name of a (stock) package or\n * used when checking if a canister includes `@junobuild/satellite` as a dependency.\n */\nexport const JUNO_PACKAGE_SATELLITE_ID = '@junobuild/satellite';\n\n/**\n * The ID used to identify a Juno Sputnik crate.\n *\n * Used when checking if a canister includes `@junobuild/sputnik` as a dependency.\n */\nexport const JUNO_PACKAGE_SPUTNIK_ID = '@junobuild/sputnik';\n\n/**\n * The ID used to identify a Juno Mission Control package.\n */\nexport const JUNO_PACKAGE_MISSION_CONTROL_ID = '@junobuild/mission-control';\n\n/**\n * The ID used to identify a Juno Orbiter package.\n */\nexport const JUNO_PACKAGE_ORBITER_ID = '@junobuild/orbiter';\n", "import type {JunoConfigEnv} from '../types/juno.env';\nimport type {JunoConfig} from './juno.config';\n\nexport type JunoConfigFn = (config: JunoConfigEnv) => JunoConfig;\n\nexport type JunoConfigFnOrObject = JunoConfig | JunoConfigFn;\n\nexport function defineConfig(config: JunoConfig): JunoConfig;\nexport function defineConfig(config: JunoConfigFn): JunoConfigFn;\nexport function defineConfig(config: JunoConfigFnOrObject): JunoConfigFnOrObject;\nexport function defineConfig(config: JunoConfigFnOrObject): JunoConfigFnOrObject {\n return config;\n}\n", "import * as z from 'zod';\n\n/**\n * @see SatelliteAssertions\n */\nexport const SatelliteAssertionsSchema = z.strictObject({\n heapMemory: z.union([z.bigint(), z.boolean()]).optional()\n});\n\n/**\n * Configuration for satellite assertions.\n * @interface SatelliteAssertions\n */\nexport interface SatelliteAssertions {\n /**\n * Configuration for the heap memory size check, which can be:\n * - `true` to enable the check with a default threshold of 900MB,\n * - `false` to disable the heap memory size check,\n * - A `bigint` to specify a custom threshold in MB (megabytes) for the heap memory size check.\n *\n * If not specified, then `true` is used as the default value.\n * @type {bigint | boolean}\n */\n heapMemory?: bigint | boolean;\n}\n", "import * as z from 'zod';\nimport {type Rule, RuleSchema} from './rules';\n\n/**\n * @see DatastoreCollection\n */\nexport const DatastoreCollectionSchema = RuleSchema.omit({\n createdAt: true,\n updatedAt: true,\n maxSize: true\n});\n\n/**\n * Represents a configuration for a collection of the Satellite Datastore.\n * @typedef {Omit<Rule, 'createdAt' | 'updatedAt' | 'maxSize'>} DatastoreCollection\n */\nexport type DatastoreCollection = Omit<Rule, 'createdAt' | 'updatedAt' | 'maxSize'>;\n\n/**\n * @see StorageCollection\n */\nexport const StorageCollectionSchema = RuleSchema.omit({\n createdAt: true,\n updatedAt: true,\n maxCapacity: true\n});\n\n/**\n * Represents a configuration for a collection of the Satellite Storage.\n * @typedef {Omit<Rule, 'createdAt' | 'updatedAt' | 'maxCapacity'>} StorageCollection\n */\nexport type StorageCollection = Omit<Rule, 'createdAt' | 'updatedAt' | 'maxCapacity'>;\n\n/**\n * @see Collections\n */\nexport const CollectionsSchema = z.strictObject({\n datastore: z.array(DatastoreCollectionSchema).optional(),\n storage: z.array(StorageCollectionSchema).optional()\n});\n\n/**\n * Represents the configuration for all the collections of a Satellite.\n * @interface Collections\n */\nexport interface Collections {\n /**\n * An optional array that defines the collections of the Datastore.\n * @type {DatastoreCollection[]}\n * @optional\n */\n datastore?: DatastoreCollection[];\n\n /**\n * An optional array that defines the collections of the Storage.\n * @type {StorageCollection[]}\n * @optional\n */\n storage?: StorageCollection[];\n}\n", "import * as z from 'zod';\n\n/**\n * @see PermissionText\n */\nexport const PermissionTextSchema = z.enum(['public', 'private', 'managed', 'controllers']);\n\n/**\n * Represents the permission levels for read and write access.\n * @typedef {'public' | 'private' | 'managed' | 'controllers'} PermissionText\n */\nexport type PermissionText = 'public' | 'private' | 'managed' | 'controllers';\n\n/**\n * @see MemoryText\n */\nexport const MemoryTextSchema = z.enum(['heap', 'stable']);\n\n/**\n * Represents the memory types.\n * @typedef {'heap' | 'stable'} MemoryText\n */\nexport type MemoryText = 'heap' | 'stable';\n\n/**\n * @see RulesType\n */\nexport const RulesTypeSchema = z.enum(['db', 'storage']);\n\n/**\n * Represents the types of rules.\n * @typedef {'db' | 'storage'} RulesType\n */\nexport type RulesType = 'db' | 'storage';\n\n/**\n * @see Rule\n */\nexport const RuleSchema = z.strictObject({\n collection: z.string(),\n read: PermissionTextSchema,\n write: PermissionTextSchema,\n memory: MemoryTextSchema,\n createdAt: z.bigint().optional(),\n updatedAt: z.bigint().optional(),\n version: z.bigint().optional(),\n maxSize: z.bigint().optional(),\n maxChangesPerUser: z.number().optional(),\n maxCapacity: z.number().optional(),\n mutablePermissions: z.boolean().optional().default(true),\n maxTokens: z.bigint().optional()\n});\n\n/**\n * Represents a rule configuration for a collection.\n * @interface Rule\n */\nexport interface Rule {\n /**\n * The name of the collection the rule applies to.\n * @type {string}\n */\n collection: string;\n\n /**\n * The permission level for read access.\n * @type {PermissionText}\n */\n read: PermissionText;\n\n /**\n * The permission level for write access.\n * @type {PermissionText}\n */\n write: PermissionText;\n\n /**\n * The type of memory allocated for the collection.\n * @type {MemoryText}\n */\n memory: MemoryText;\n\n /**\n * The timestamp when the rule was created.\n * @type {bigint}\n * @optional\n */\n createdAt?: bigint;\n\n /**\n * The timestamp when the rule was last updated.\n * @type {bigint}\n * @optional\n */\n updatedAt?: bigint;\n\n /**\n * The version of the rule.\n * @type {bigint}\n * @optional\n * @description Must be provided when updating the rule to ensure the correct version is being updated.\n */\n version?: bigint;\n\n /**\n * The maximum size of the collection in bytes.\n * @type {number}\n * @optional\n */\n maxSize?: bigint;\n\n /**\n * The maximum number of changes (create, update or delete) per user for the collection.\n * @type {number}\n * @optional\n */\n maxChangesPerUser?: number;\n\n /**\n * The maximum capacity of the collection.\n * @type {number}\n * @optional\n */\n maxCapacity?: number;\n\n /**\n * Indicates whether the permissions are mutable.\n * @default true\n * @type {boolean}\n */\n mutablePermissions?: boolean;\n\n /**\n * The maximum number of writes and deletes per minute.\n */\n maxTokens?: bigint;\n}\n", "import * as z from 'zod';\nimport {type MaxMemorySizeConfig, MaxMemorySizeConfigSchema} from '../../shared/feature.config';\n\n/**\n * @see DatastoreConfig\n */\nexport const DatastoreConfigSchema = z.strictObject({\n maxMemorySize: MaxMemorySizeConfigSchema.optional(),\n version: z.bigint().optional()\n});\n\n/**\n * Configures the behavior of the Datastore.\n * @interface DatastoreConfig\n */\nexport interface DatastoreConfig {\n /**\n * Configuration for maximum memory size limits for the Datastore.\n *\n * This is used to specify optional limits on heap and stable memory for the smart contract.\n * When the limit is reached, the Datastore and smart contract continue to operate normally but reject the creation or updates of documents.\n *\n * If not specified, no memory limits are enforced.\n *\n * @type {MaxMemorySizeConfig}\n * @optional\n */\n maxMemorySize?: MaxMemorySizeConfig;\n\n /**\n * The current version of the config.\n *\n * Optional. The CLI will automatically resolve the version and warn you if there's a potential overwrite.\n * You can provide it if you want to manage versioning manually within your config file.\n *\n * @type {bigint}\n * @optional\n */\n version?: bigint;\n}\n", "import * as z from 'zod';\nimport {refineEmulatorConfig} from '../validators/emulator.validators';\n\nconst EmulatorPortsSchema = z.strictObject({\n /**\n * @default 5987\n */\n server: z.number().optional(),\n\n /**\n * @default 5999\n */\n admin: z.number().optional(),\n\n /**\n * @default 30\n */\n timeoutInSeconds: z.number().int().positive().optional()\n});\n\nconst ConsolePortSchema = z.strictObject({\n /**\n * Console UI (like https://console.juno.build) running with the emulator.\n * @default 5866\n */\n console: z.number().optional()\n});\n\n/**\n * Represents the ports exposed by an emulator container.\n */\nexport interface EmulatorPorts {\n /**\n * The port of the server used to simulate execution. This is the port your app connects to.\n * Also known as the \"local Internet Computer replica\" or the \"Pocket-IC port\".\n * @default 5987\n */\n server?: number;\n\n /**\n * The port of the admin server used for tasks like transferring ICP from the ledger.\n * @default 5999\n */\n admin?: number;\n\n /**\n * Max number of seconds to wait for emulator ports to become ready.\n * @default 30\n */\n timeoutInSeconds?: number;\n}\n\n/**\n * @see EmulatorSkylab\n */\nconst EmulatorSkylabSchema = z.strictObject({\n ports: EmulatorPortsSchema.extend(ConsolePortSchema.shape).optional()\n});\n\n/**\n * Configuration for the Skylab emulator.\n */\nexport interface EmulatorSkylab {\n /**\n * Ports exposed by the Skylab container.\n */\n ports?: EmulatorPorts & {\n /**\n * Console UI (like https://console.juno.build) running with the emulator.\n * @default 5866\n */\n console: number;\n };\n}\n\n/**\n * @see EmulatorConsole\n */\nconst EmulatorConsoleSchema = z.strictObject({\n ports: EmulatorPortsSchema.optional()\n});\n\n/**\n * Configuration for the Console emulator.\n */\nexport interface EmulatorConsole {\n /**\n * Ports exposed by the Console container.\n */\n ports?: EmulatorPorts;\n}\n\n/**\n * @see EmulatorSatellite\n */\nconst EmulatorSatelliteSchema = z.strictObject({\n ports: EmulatorPortsSchema.optional()\n});\n\n/**\n * Configuration for the Satellite emulator.\n */\nexport interface EmulatorSatellite {\n /**\n * Ports exposed by the Satellite container.\n */\n ports?: EmulatorPorts;\n}\n\n/**\n * @see EmulatorRunner\n */\nconst EmulatorRunnerSchema = z.strictObject({\n type: z.enum(['docker', 'podman']),\n image: z.string().optional(),\n name: z.string().optional(),\n volume: z.string().optional(),\n target: z.string().optional(),\n platform: z.enum(['linux/amd64', 'linux/arm64']).optional()\n});\n\n/**\n * Shared options for all runner variants.\n */\nexport interface EmulatorRunner {\n /**\n * The containerization tool to run the emulator.\n */\n type: 'docker' | 'podman';\n\n /**\n * Image reference.\n * @default depends on emulator type, e.g. \"junobuild/skylab:latest\"\n */\n image?: string;\n\n /**\n * Optional container name to use for the emulator.\n * Useful for reusing or managing a specific container.\n */\n name?: string;\n\n /**\n * Persistent volume to store internal state.\n * @default \"juno\"\n */\n volume?: string;\n\n /**\n * Shared folder for deploying and hot-reloading serverless functions.\n */\n target?: string;\n\n /**\n * The platform to use when running the emulator container.\n */\n platform?: 'linux/amd64' | 'linux/arm64';\n}\n\n/**\n * @see NetworkServices\n */\nconst NetworkServicesSchema = z.strictObject({\n registry: z.boolean().optional(),\n cmc: z.boolean().optional(),\n icp: z.boolean().optional(),\n cycles: z.boolean().optional(),\n nns: z.boolean().optional(),\n sns: z.boolean().optional(),\n internet_identity: z.boolean().optional(),\n nns_dapp: z.boolean().optional()\n});\n\n/**\n * Network services that can be enabled in the emulator.\n *\n * Each flag corresponds to a system canister or application that can be included\n * in the local Internet Computer network when the emulator starts.\n */\nexport interface NetworkServices {\n /**\n * Registry canister: Stores network configuration and topology (subnet membership, public keys, feature flags).\n * Acts as the source of truth other system canisters read/write to.\n */\n registry?: boolean;\n\n /**\n * CMC (Cycles Minting Canister): Converts ICP to cycles and distributes them; maintains subnet lists and conversion rate.\n * Requires icp and nns to not be enabled.\n */\n cmc?: boolean;\n\n /**\n * ICP token: Deploys the ICP ledger and index canisters.\n */\n icp?: boolean;\n\n /**\n * Cycles token: Deploys the cycles ledger and index canisters.\n */\n cycles?: boolean;\n\n /**\n * NNS governance canisters: Deploys the governance and root canisters.\n * Core governance system (neurons, proposals, voting) and related control logic.\n * Enables managing network-level decisions in an emulated environment.\n */\n nns?: boolean;\n\n /**\n * SNS canisters: Deploys the SNS-W and aggregator canisters.\n * Service Nervous System stack used to govern individual dapps.\n */\n sns?: boolean;\n\n /**\n * Internet Identity: Deploys the II canister for authentication.\n */\n internet_identity?: boolean;\n\n /**\n * NNS dapp: Deploys the NNS UI canister and frontend application\n * Requires cmc, icp, nns, sns, internet_identity to be enabled.\n */\n nns_dapp?: boolean;\n}\n\n/**\n * @see Network\n */\nconst NetworkSchema = z.strictObject({\n services: NetworkServicesSchema\n});\n\n/**\n * Configuration for customizing the Internet Computer network bootstrapped\n * by the emulator.\n */\nexport interface Network {\n /**\n * System canisters and applications available in the network.\n */\n services: NetworkServices;\n}\n\n/**\n * @see EmulatorConfig\n */\nexport const EmulatorConfigSchema = z\n .union([\n z.strictObject({\n runner: EmulatorRunnerSchema.optional(),\n network: NetworkSchema.optional(),\n skylab: EmulatorSkylabSchema\n }),\n z.strictObject({\n runner: EmulatorRunnerSchema.optional(),\n network: NetworkSchema.optional(),\n console: EmulatorConsoleSchema\n }),\n z.strictObject({\n runner: EmulatorRunnerSchema.optional(),\n network: NetworkSchema.optional(),\n satellite: EmulatorSatelliteSchema\n })\n ])\n .superRefine(refineEmulatorConfig);\n\n/**\n * The configuration for running the Juno emulator.\n */\nexport type EmulatorConfig =\n | {runner?: EmulatorRunner; network?: Network; skylab: EmulatorSkylab}\n | {runner?: EmulatorRunner; network?: Network; console: EmulatorConsole}\n | {runner?: EmulatorRunner; network?: Network; satellite: EmulatorSatellite};\n", "import type {NetworkServices} from '../configs/emulator.config';\n\nexport const DEFAULT_NETWORK_SERVICES: NetworkServices = {\n registry: false,\n cmc: true,\n icp: true,\n cycles: true,\n nns: true,\n sns: false,\n internet_identity: true,\n nns_dapp: false\n} as const;\n\nexport const DEFAULT_SATELLITE_NETWORK_SERVICES: NetworkServices = {\n ...DEFAULT_NETWORK_SERVICES,\n cycles: false,\n cmc: false,\n nns: false\n} as const;\n", "import type * as z from 'zod';\nimport type {EmulatorConfigSchema} from '../configs/emulator.config';\nimport {\n DEFAULT_NETWORK_SERVICES,\n DEFAULT_SATELLITE_NETWORK_SERVICES\n} from '../constants/emulator.constants';\n\nconst NNS_REQUIRED_SERVICES = ['icp'] as const;\nconst CMC_REQUIRED_SERVICES = ['icp', 'nns'] as const;\nconst CYCLES_REQUIRED_SERVICES = ['cmc', 'icp', 'nns'] as const;\nconst NNS_DAPP_REQUIRED_SERVICES = ['cmc', 'icp', 'nns', 'sns', 'internet_identity'] as const;\n\ntype EmulatorConfigInput = z.input<typeof EmulatorConfigSchema>;\n\n// eslint-disable-next-line local-rules/prefer-object-params\nconst refineNetworkServices = (cfg: EmulatorConfigInput, ctx: z.RefinementCtx) => {\n const defaultServices =\n 'satellite' in cfg ? DEFAULT_SATELLITE_NETWORK_SERVICES : DEFAULT_NETWORK_SERVICES;\n const mergedServices = {...defaultServices, ...(cfg.network?.services ?? {})};\n\n const assertServices = ({\n requiredServices,\n key\n }: {\n requiredServices:\n | typeof NNS_DAPP_REQUIRED_SERVICES\n | typeof CMC_REQUIRED_SERVICES\n | typeof CYCLES_REQUIRED_SERVICES\n | typeof NNS_REQUIRED_SERVICES;\n key: string;\n }) => {\n const hasMissingServices =\n requiredServices.find((k) => mergedServices[k as keyof typeof mergedServices] === false) !==\n undefined;\n\n if (hasMissingServices) {\n ctx.addIssue({\n code: 'custom',\n path: ['network', 'services', key],\n message: `${key} requires: ${requiredServices.join(', ')}`\n });\n }\n };\n\n if (mergedServices.nns_dapp) {\n assertServices({\n requiredServices: NNS_DAPP_REQUIRED_SERVICES,\n key: 'nns_dapp'\n });\n }\n\n if (mergedServices.cmc) {\n assertServices({\n requiredServices: CMC_REQUIRED_SERVICES,\n key: 'cmc'\n });\n }\n\n if (mergedServices.cycles) {\n assertServices({\n requiredServices: CYCLES_REQUIRED_SERVICES,\n key: 'cycles'\n });\n }\n\n if (mergedServices.nns) {\n assertServices({\n requiredServices: NNS_REQUIRED_SERVICES,\n key: 'nns'\n });\n }\n};\n\n// eslint-disable-next-line local-rules/prefer-object-params\nexport const refineEmulatorConfig = (cfg: EmulatorConfigInput, ctx: z.RefinementCtx) => {\n if (cfg.network === undefined) {\n return;\n }\n\n if (cfg.network.services === undefined) {\n return;\n }\n\n refineNetworkServices(cfg, ctx);\n};\n", "import * as z from 'zod';\n\n/**\n * @see ModuleLogVisibility\n */\nexport const ModuleLogVisibilitySchema = z.enum(['controllers', 'public']);\n\n/**\n * Specifies who can see the logs of the module.\n *\n * - 'controllers': Only the controllers of the module can see the logs.\n * - 'public': Everyone can see the logs.\n *\n * @typedef {'controllers' | 'public'} ModuleLogVisibility\n */\nexport type ModuleLogVisibility = 'controllers' | 'public';\n\n/**\n * @see ModuleSettings\n */\nexport const ModuleSettingsSchema = z.strictObject({\n freezingThreshold: z.bigint().optional(),\n reservedCyclesLimit: z.bigint().optional(),\n logVisibility: ModuleLogVisibilitySchema.optional(),\n heapMemoryLimit: z.bigint().optional(),\n memoryAllocation: z.bigint().optional(),\n computeAllocation: z.bigint().optional()\n});\n\n/**\n * Settings for a module - Satellite, Mission Control or Orbiter.\n *\n * These settings control various aspects of the module's behavior and resource usage.\n *\n * @interface ModuleSettings\n */\nexport interface ModuleSettings {\n /**\n * The cycle threshold below which the module will automatically stop to avoid running out of cycles.\n *\n * For example, if set to `BigInt(1000000)`, the module will stop when it has fewer than 1,000,000 cycles remaining.\n *\n * @type {bigint}\n */\n freezingThreshold?: bigint;\n\n /**\n * The number of cycles reserved for the module's operations to ensure it has enough cycles to function.\n *\n * For example, setting it to `BigInt(5000000)` reserves 5,000,000 cycles for the module.\n *\n * @type {bigint}\n */\n reservedCyclesLimit?: bigint;\n\n /**\n * Controls who can see the module's logs.\n *\n * @type {ModuleLogVisibility}\n */\n logVisibility?: ModuleLogVisibility;\n\n /**\n * The maximum amount of WebAssembly (Wasm) memory the module can use on the heap.\n *\n * For example, setting it to `BigInt(1024 * 1024 * 64)` allows the module to use up to 64 MB of Wasm memory.\n *\n * @type {bigint}\n */\n heapMemoryLimit?: bigint;\n\n /**\n * The amount of memory explicitly allocated to the module.\n *\n * For example, setting it to `BigInt(1024 * 1024 * 128)` allocates 128 MB of memory to the module.\n *\n * @type {bigint}\n */\n memoryAllocation?: bigint;\n\n /**\n * The proportion of compute capacity allocated to the module.\n *\n * This is a fraction of the total compute capacity of the subnet. For example, setting it to `BigInt(10)` allocates 10% of the compute capacity to the module.\n *\n * @type {bigint}\n */\n computeAllocation?: bigint;\n}\n", "import {type PrincipalText, PrincipalTextSchema} from '@dfinity/zod-schemas';\nimport * as z from 'zod';\nimport {type JunoConfigMode, JunoConfigModeSchema} from '../../types/juno.env';\nimport type {Either} from '../../types/utility.types';\nimport {StrictPrincipalTextSchema} from '../../utils/principal.utils';\n\n/**\n * @see OrbiterId\n */\nexport const OrbiterIdSchema = z.object({\n id: PrincipalTextSchema\n});\n\n/**\n * Represents the configuration for an orbiter.\n * @interface OrbiterId\n */\nexport interface OrbiterId {\n /**\n * The identifier of the orbiter used in the dApp.\n * @type {string}\n */\n id: PrincipalText;\n}\n\n/**\n * @see OrbiterIds\n */\nexport const OrbiterIdsSchema = z.object({\n ids: z.record(JunoConfigModeSchema, StrictPrincipalTextSchema)\n});\n\n/**\n * Represents a mapping of orbiter identitifiers to different configurations based on the mode of the application.\n * @interface OrbiterIds\n */\nexport interface OrbiterIds {\n /**\n * A mapping of orbiter identifiers (IDs) to different configurations based on the mode of the application.\n *\n * This allows the application to use different orbiter IDs, such as production, development, etc.\n *\n * Example:\n * {\n * \"production\": \"xo2hm-lqaaa-aaaal-ab3oa-cai\",\n * \"development\": \"gl6nx-5maaa-aaaaa-qaaqq-cai\"\n * }\n * @type {Record<JunoConfigMode, string>}\n */\n ids: Record<JunoConfigMode, PrincipalText>;\n}\n\n/**\n * @see OrbiterConfig\n */\nexport const OrbiterConfigSchema = z.union([OrbiterIdSchema.strict(), OrbiterIdsSchema.strict()]);\n\n/**\n * Represents the configuration for an orbiter (analytics).\n *\n * @typedef {Either<OrbiterId, OrbiterIds>} OrbiterConfig\n * @property {OrbiterId | OrbiterIds} OrbiterId or OrbiterIds - Defines a unique Orbiter or a collection of Orbiters.\n */\nexport type OrbiterConfig = Either<OrbiterId, OrbiterIds>;\n", "import {type PrincipalText, PrincipalTextSchema} from '@dfinity/zod-schemas';\nimport * as z from 'zod';\nimport {\n type AuthenticationConfig,\n AuthenticationConfigSchema\n} from '../../shared/authentication.config';\nimport {type StorageConfig, StorageConfigSchema} from '../../shared/storage.config';\nimport type {CliConfig} from '../../types/cli.config';\nimport {type JunoConfigMode, JunoConfigModeSchema} from '../../types/juno.env';\nimport type {Either} from '../../types/utility.types';\nimport {StrictPrincipalTextSchema} from '../../utils/principal.utils';\nimport {type SatelliteAssertions, SatelliteAssertionsSchema} from './assertions.config';\nimport {type Collections, CollectionsSchema} from './collections';\nimport {type DatastoreConfig, DatastoreConfigSchema} from './datastore.config';\nimport {type ModuleSettings, ModuleSettingsSchema} from './module.settings';\n\n/**\n * @see SatelliteId\n */\nexport const SatelliteIdSchema = z.object({\n id: PrincipalTextSchema\n});\n\n/**\n * Represents the unique identifier for a satellite.\n * @interface SatelliteId\n */\nexport interface SatelliteId {\n /**\n * The unique identifier (ID) of the satellite for this application.\n * @type {string}\n */\n id: PrincipalText;\n}\n\n/**\n * @see SatelliteIds\n */\nexport const SatelliteIdsSchema = z.object({\n ids: z.record(JunoConfigModeSchema, StrictPrincipalTextSchema)\n});\n\n/**\n * Represents a mapping of satellite identifiers to different configurations based on the mode of the application.\n * @interface SatelliteIds\n */\nexport interface SatelliteIds {\n /**\n * A mapping of satellite identifiers (IDs) to different configurations based on the mode of the application.\n *\n * This allows the application to use different satellite IDs, such as production, staging, etc.\n *\n * Example:\n * {\n * \"production\": \"xo2hm-lqaaa-aaaal-ab3oa-cai\",\n * \"staging\": \"gl6nx-5maaa-aaaaa-qaaqq-cai\"\n * }\n * @type {Record<JunoConfigMode, string>}\n */\n ids: Record<JunoConfigMode, PrincipalText>;\n}\n\n/**\n * @see SatelliteConfigOptions\n */\nconst SatelliteConfigOptionsBaseSchema = z.object({\n storage: StorageConfigSchema.optional(),\n datastore: DatastoreConfigSchema.optional(),\n authentication: AuthenticationConfigSchema.optional(),\n assertions: SatelliteAssertionsSchema.optional(),\n settings: ModuleSettingsSchema.optional(),\n collections: CollectionsSchema.optional()\n});\n\n/**\n * @see JunoConsoleConfig\n */\nexport const SatelliteConfigOptionsSchema = z.union([\n z\n .object({\n ...SatelliteIdSchema.shape,\n ...SatelliteConfigOptionsBaseSchema.shape\n })\n .strict(),\n z\n .object({\n ...SatelliteIdsSchema.shape,\n ...SatelliteConfigOptionsBaseSchema.shape\n })\n .strict()\n]);\n\n/**\n * SatelliteConfigOptions interface provides configuration settings that allow for fine-tuning\n * the operational behavior of various aspects of a Satellite, such as storage, datastore,\n * authentication, and deployment assertions.\n *\n * These options affect specific modules of the Satellite and may require manual application of\n * changes, typically through CLI commands (e.g., `juno config`).\n *\n * @interface SatelliteConfigOptions\n *\n * @property {StorageConfig} [storage] - Configuration settings for storage management in the Satellite.\n * @property {DatastoreConfig} [datastore] - Configuration settings for datastore management.\n * @property {AuthenticationConfig} [authentication] - Authentication-specific configurations.\n * @property {SatelliteAssertions} [assertions] - Conditions and assertions for deployment or operational checks.\n * @property {ModuleSettings} [settings] - General settings governing module behavior and resource management.\n */\nexport interface SatelliteConfigOptions {\n /**\n * Optional configuration parameters for the satellite, affecting the operational behavior of its Storage.\n * Changes to these parameters must be applied manually afterwards, for example with the CLI using `juno config` commands.\n * @type {StorageConfig}\n * @optional\n */\n storage?: StorageConfig;\n\n /**\n * Optional configuration parameters for the satellite, affecting the operational behavior of its Datastore.\n * Changes to these parameters must be applied manually afterwards, for example with the CLI using `juno config` commands.\n * @type {DatastoreConfig}\n * @optional\n */\n datastore?: DatastoreConfig;\n\n /**\n * Optional configuration parameters for the satellite, affecting the operational behavior of its Authentication.\n * Changes to these parameters must be applied manually afterwards, for example with the CLI using `juno config` commands.\n * @type {AuthenticationConfig}\n * @optional\n */\n authentication?: AuthenticationConfig;\n\n /**\n * Optional configurations to override default assertions made by the CLI regarding satellite deployment conditions.\n * @type {SatelliteAssertions}\n * @optional\n */\n assertions?: SatelliteAssertions;\n\n /**\n * Optional configuration parameters for the Satellite.\n * These settings control various aspects of the module's behavior and resource usage.\n * @type {ModuleSettings}\n * @optional\n */\n settings?: ModuleSettings;\n\n /**\n * Optional configuration for the Datastore and Storage collections.\n * @type {Collections}\n * @optional\n */\n collections?: Collections;\n}\n\n/**\n * Represents the configuration for a satellite.\n *\n * @typedef {Either<SatelliteId, SatelliteIds> & CliConfig & SatelliteConfigOptions} SatelliteConfig\n * @property {SatelliteId | SatelliteIds} SatelliteId or SatelliteIds - Defines a unique Satellite or a collection of Satellites.\n * @property {CliConfig} CliConfig - Configuration specific to the CLI interface.\n * @property {SatelliteConfigOptions} SatelliteConfigOptions - Additional configuration options for the Satellite.\n */\nexport type SatelliteConfig = Either<SatelliteId, SatelliteIds> &\n CliConfig &\n SatelliteConfigOptions;\n", "import * as z from 'zod';\nimport {type EmulatorConfig, EmulatorConfigSchema} from './configs/emulator.config';\nimport {type OrbiterConfig, OrbiterConfigSchema} from './configs/orbiter.config';\nimport {type SatelliteConfig, SatelliteConfigOptionsSchema} from './configs/satellite.config';\n\n/**\n * @see JunoConfig\n */\nexport const JunoConfigSchema = z.strictObject({\n satellite: SatelliteConfigOptionsSchema,\n orbiter: OrbiterConfigSchema.optional(),\n emulator: EmulatorConfigSchema.optional()\n});\n\n/**\n * Represents the overall configuration for Juno.\n * @interface JunoConfig\n */\nexport interface JunoConfig {\n /**\n * The configuration for the satellite.\n * @type {SatelliteConfig}\n */\n satellite: SatelliteConfig;\n\n /**\n * The optional configuration for the orbiter.\n * @type {OrbiterConfig}\n * @optional\n */\n orbiter?: OrbiterConfig;\n\n /**\n * Your options for the emulator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AS,EACzC,cAAeD,GAA0B,SAAS,EAClD,gBAAmB,SAAO,EAAE,SAAS,EACrC,iBAAoB,SAAO,EAAE,SAAS,EACtC,kBAAqB,SAAO,EAAE,SAAS,CACzC,CAAC,EC3BD,OAA4B,uBAAAE,OAA0B,uBACtD,UAAYC,MAAO,MAQZ,IAAMC,GAAoB,SAAO,CACtC,GAAIC,EACN,CAAC,EAiBYC,GAAqB,SAAO,CACvC,IAAO,SAAOC,EAAsBC,CAAyB,CAC/D,CAAC,EAyBYC,GAAwB,QAAM,CAACL,GAAgB,OAAO,EAAGE,GAAiB,OAAO,CAAC,CAAC,ECvDhG,OAA4B,uBAAAI,OAA0B,uBACtD,UAAYC,MAAO,MAkBZ,IAAMC,GAAsB,SAAO,CACxC,GAAIC,EACN,CAAC,EAiBYC,GAAuB,SAAO,CACzC,IAAO,SAAOC,EAAsBC,CAAyB,CAC/D,CAAC,EAyBKC,GAAqC,SAAO,CAChD,QAASC,EAAoB,SAAS,EACtC,UAAWC,GAAsB,SAAS,EAC1C,eAAgBC,EAA2B,SAAS,EACpD,WAAYC,GAA0B,SAAS,EAC/C,SAAUC,GAAqB,SAAS,EACxC,YAAaC,GAAkB,SAAS,CAC1C,CAAC,EAKYC,GAAiC,QAAM,CAE/C,SAAO,CACN,GAAGZ,GAAkB,MACrB,GAAGK,GAAiC,KACtC,CAAC,EACA,OAAO,EAEP,SAAO,CACN,GAAGH,GAAmB,MACtB,GAAGG,GAAiC,KACtC,CAAC,EACA,OAAO,CACZ,CAAC,EC1FD,UAAYQ,OAAO,MAQZ,IAAMC,GAAqB,gBAAa,CAC7C,UAAWC,GACX,QAASC,GAAoB,SAAS,EACtC,SAAUC,GAAqB,SAAS,CAC1C,CAAC",
|
|
6
6
|
"names": ["z", "z", "createFunctionSchema", "schema", "fn", "z", "z", "PrincipalTextSchema", "alphabet", "lookupTable", "i", "base32Encode", "input", "skip", "bits", "output", "encodeByte", "byte", "base32Decode", "o", "decodeChar", "char", "val", "c", "lookUpTable", "getCrc32", "buf", "crc", "i", "t", "isBytes", "a", "abytes", "b", "lengths", "isBytes", "aexists", "instance", "checkFinished", "aoutput", "out", "abytes", "min", "clean", "arrays", "i", "createView", "arr", "rotr", "word", "shift", "hasHexBuiltin", "hexes", "_", "i", "bytesToHex", "bytes", "abytes", "hex", "asciis", "asciiToBase16", "ch", "hexToBytes", "hl", "al", "array", "ai", "hi", "n1", "n2", "char", "utf8ToBytes", "str", "toBytes", "data", "utf8ToBytes", "abytes", "Hash", "createHasher", "hashCons", "hashC", "msg", "toBytes", "tmp", "setBigUint64", "view", "byteOffset", "value", "isLE", "_32n", "_u32_max", "wh", "wl", "h", "l", "Chi", "a", "b", "c", "Maj", "HashMD", "Hash", "blockLen", "outputLen", "padOffset", "createView", "data", "aexists", "toBytes", "abytes", "buffer", "len", "pos", "take", "dataView", "out", "aoutput", "clean", "i", "oview", "outLen", "state", "res", "to", "length", "finished", "destroyed", "SHA256_IV", "SHA224_IV", "SHA256_K", "SHA256_W", "SHA256", "HashMD", "outputLen", "SHA256_IV", "A", "B", "C", "D", "E", "F", "G", "H", "view", "offset", "i", "W15", "W2", "s0", "rotr", "s1", "sigma1", "T1", "Chi", "T2", "Maj", "clean", "SHA224", "SHA224_IV", "sha224", "createHasher", "SHA224", "JSON_KEY_PRINCIPAL", "SELF_AUTHENTICATING_SUFFIX", "ANONYMOUS_SUFFIX", "MANAGEMENT_CANISTER_PRINCIPAL_TEXT_STR", "Principal", "_Principal", "publicKey", "sha", "sha224", "other", "hex", "hexToBytes", "text", "maybePrincipal", "obj", "canisterIdNoDash", "arr", "base32Decode", "principal", "_arr", "bytesToHex", "checksumArrayBuf", "getCrc32", "checksum", "array", "matches", "base32Encode", "i", "cmp", "z", "StrictPrincipalTextSchema", "val", "PrincipalTextSchema", "StrictPrincipalSchema", "ctx", "Principal", "StrictIdentitySchema", "val", "StrictPrincipalSchema", "OnRunContextSchema", "StrictPrincipalSchema", "StrictIdentitySchema", "RunFunctionSchema", "OnRunSchema", "createFunctionSchema", "RunFnSchema", "OnRunContextSchema", "OnRunSchema", "RunFnOrObjectSchema", "createFunctionSchema", "defineRun", "run", "z", "z", "JunoConfigModeSchema", "JunoConfigEnvSchema", "OnRunEnvSchema", "JunoConfigEnvSchema", "defineConsoleConfig", "config", "PrincipalTextSchema", "z", "PrincipalTextSchema", "z", "AuthenticationConfigInternetIdentitySchema", "AuthenticationConfigDelegationSchema", "AuthenticationConfigGoogleSchema", "AuthenticationConfigRulesSchema", "AuthenticationConfigSchema", "z", "z", "MaxMemorySizeConfigSchema", "StorageConfigSourceGlobSchema", "StorageConfigHeaderSchema", "StorageConfigRewriteSchema", "StorageConfigRedirectSchema", "StorageConfigSchema", "MaxMemorySizeConfigSchema", "z", "z", "EncodingTypeSchema", "PrecompressSchema", "CliConfigSchema", "EncodingTypeSchema", "ConsoleIdSchema", "PrincipalTextSchema", "ConsoleIdsSchema", "JunoConfigModeSchema", "StrictPrincipalTextSchema", "JunoConsoleConfigBaseSchema", "CliConfigSchema", "StorageConfigSchema", "AuthenticationConfigSchema", "JunoConsoleConfigSchema", "z", "JunoPackageDependenciesSchema", "JunoPackageSchema", "JUNO_PACKAGE_SATELLITE_ID", "JUNO_PACKAGE_SPUTNIK_ID", "JUNO_PACKAGE_MISSION_CONTROL_ID", "JUNO_PACKAGE_ORBITER_ID", "defineConfig", "config", "z", "SatelliteAssertionsSchema", "z", "z", "PermissionTextSchema", "MemoryTextSchema", "RulesTypeSchema", "RuleSchema", "DatastoreCollectionSchema", "RuleSchema", "StorageCollectionSchema", "CollectionsSchema", "z", "DatastoreConfigSchema", "MaxMemorySizeConfigSchema", "z", "DEFAULT_NETWORK_SERVICES", "DEFAULT_SATELLITE_NETWORK_SERVICES", "NNS_REQUIRED_SERVICES", "CMC_REQUIRED_SERVICES", "CYCLES_REQUIRED_SERVICES", "NNS_DAPP_REQUIRED_SERVICES", "refineNetworkServices", "cfg", "ctx", "mergedServices", "DEFAULT_SATELLITE_NETWORK_SERVICES", "DEFAULT_NETWORK_SERVICES", "assertServices", "requiredServices", "key", "k", "refineEmulatorConfig", "EmulatorPortsSchema", "ConsolePortSchema", "EmulatorSkylabSchema", "EmulatorConsoleSchema", "EmulatorSatelliteSchema", "EmulatorRunnerSchema", "NetworkServicesSchema", "NetworkSchema", "EmulatorConfigSchema", "refineEmulatorConfig", "z", "ModuleLogVisibilitySchema", "ModuleSettingsSchema", "PrincipalTextSchema", "z", "OrbiterIdSchema", "PrincipalTextSchema", "OrbiterIdsSchema", "JunoConfigModeSchema", "StrictPrincipalTextSchema", "OrbiterConfigSchema", "PrincipalTextSchema", "z", "SatelliteIdSchema", "PrincipalTextSchema", "SatelliteIdsSchema", "JunoConfigModeSchema", "StrictPrincipalTextSchema", "SatelliteConfigOptionsBaseSchema", "StorageConfigSchema", "DatastoreConfigSchema", "AuthenticationConfigSchema", "SatelliteAssertionsSchema", "ModuleSettingsSchema", "CollectionsSchema", "SatelliteConfigOptionsSchema", "z", "JunoConfigSchema", "SatelliteConfigOptionsSchema", "OrbiterConfigSchema", "EmulatorConfigSchema"]
|
package/dist/types/cli/run.d.ts
CHANGED
|
@@ -2,19 +2,19 @@ import * as z from 'zod';
|
|
|
2
2
|
import { type OnRun } from './run.context';
|
|
3
3
|
import type { OnRunEnv } from './run.env';
|
|
4
4
|
export declare const RunFnSchema: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
5
|
-
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
6
|
-
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
5
|
+
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>;
|
|
6
|
+
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>>;
|
|
7
7
|
identity: z.ZodUnknown;
|
|
8
8
|
container: z.ZodOptional<z.ZodString>;
|
|
9
9
|
}, z.core.$strict>], null>, z.ZodObject<{
|
|
10
10
|
run: z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodObject<{
|
|
11
|
-
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
12
|
-
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
11
|
+
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>;
|
|
12
|
+
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>>;
|
|
13
13
|
identity: z.ZodUnknown;
|
|
14
14
|
container: z.ZodOptional<z.ZodString>;
|
|
15
15
|
}, z.core.$strict>], null>, z.ZodUnion<[z.ZodPromise<z.ZodVoid>, z.ZodVoid]>>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodObject<{
|
|
16
|
-
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
17
|
-
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
16
|
+
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>;
|
|
17
|
+
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>>;
|
|
18
18
|
identity: z.ZodUnknown;
|
|
19
19
|
container: z.ZodOptional<z.ZodString>;
|
|
20
20
|
}, z.core.$strict>], null>, z.ZodUnion<[z.ZodPromise<z.ZodVoid>, z.ZodVoid]>>>;
|
|
@@ -22,47 +22,47 @@ export declare const RunFnSchema: z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
|
22
22
|
export type RunFn = (context: OnRunEnv) => OnRun;
|
|
23
23
|
export declare const RunFnOrObjectSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
24
24
|
run: z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodObject<{
|
|
25
|
-
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
26
|
-
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
25
|
+
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>;
|
|
26
|
+
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>>;
|
|
27
27
|
identity: z.ZodUnknown;
|
|
28
28
|
container: z.ZodOptional<z.ZodString>;
|
|
29
29
|
}, z.core.$strict>], null>, z.ZodUnion<[z.ZodPromise<z.ZodVoid>, z.ZodVoid]>>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodObject<{
|
|
30
|
-
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
31
|
-
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
30
|
+
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>;
|
|
31
|
+
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>>;
|
|
32
32
|
identity: z.ZodUnknown;
|
|
33
33
|
container: z.ZodOptional<z.ZodString>;
|
|
34
34
|
}, z.core.$strict>], null>, z.ZodUnion<[z.ZodPromise<z.ZodVoid>, z.ZodVoid]>>>;
|
|
35
35
|
}, z.core.$strict>, z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodObject<{
|
|
36
|
-
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
37
|
-
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
36
|
+
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>;
|
|
37
|
+
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>>;
|
|
38
38
|
identity: z.ZodUnknown;
|
|
39
39
|
container: z.ZodOptional<z.ZodString>;
|
|
40
40
|
}, z.core.$strict>], null>, z.ZodObject<{
|
|
41
41
|
run: z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodObject<{
|
|
42
|
-
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
43
|
-
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
42
|
+
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>;
|
|
43
|
+
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>>;
|
|
44
44
|
identity: z.ZodUnknown;
|
|
45
45
|
container: z.ZodOptional<z.ZodString>;
|
|
46
46
|
}, z.core.$strict>], null>, z.ZodUnion<[z.ZodPromise<z.ZodVoid>, z.ZodVoid]>>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodObject<{
|
|
47
|
-
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
48
|
-
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
47
|
+
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>;
|
|
48
|
+
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>>;
|
|
49
49
|
identity: z.ZodUnknown;
|
|
50
50
|
container: z.ZodOptional<z.ZodString>;
|
|
51
51
|
}, z.core.$strict>], null>, z.ZodUnion<[z.ZodPromise<z.ZodVoid>, z.ZodVoid]>>>;
|
|
52
52
|
}, z.core.$strict>>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodObject<{
|
|
53
|
-
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
54
|
-
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
53
|
+
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>;
|
|
54
|
+
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>>;
|
|
55
55
|
identity: z.ZodUnknown;
|
|
56
56
|
container: z.ZodOptional<z.ZodString>;
|
|
57
57
|
}, z.core.$strict>], null>, z.ZodObject<{
|
|
58
58
|
run: z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodObject<{
|
|
59
|
-
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
60
|
-
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
59
|
+
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>;
|
|
60
|
+
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>>;
|
|
61
61
|
identity: z.ZodUnknown;
|
|
62
62
|
container: z.ZodOptional<z.ZodString>;
|
|
63
63
|
}, z.core.$strict>], null>, z.ZodUnion<[z.ZodPromise<z.ZodVoid>, z.ZodVoid]>>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodObject<{
|
|
64
|
-
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
65
|
-
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@
|
|
64
|
+
satelliteId: z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>;
|
|
65
|
+
orbiterId: z.ZodOptional<z.ZodPipe<z.ZodUnknown, z.ZodTransform<import("@icp-sdk/core/principal").Principal, unknown>>>;
|
|
66
66
|
identity: z.ZodUnknown;
|
|
67
67
|
container: z.ZodOptional<z.ZodString>;
|
|
68
68
|
}, z.core.$strict>], null>, z.ZodUnion<[z.ZodPromise<z.ZodVoid>, z.ZodVoid]>>>;
|