From 0ca016f2221efa160db24bd02203c22a04abcf3e Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 15 Jul 2024 15:13:44 -0600 Subject: [PATCH] remove candid from stable structures --- examples/stable_structures/package-lock.json | 688 ++++++++++++++++- .../src/canister1/stable_map_0.ts | 23 +- .../src/canister1/stable_map_1.ts | 23 +- .../src/canister1/stable_map_2.ts | 23 +- .../src/canister1/stable_map_3.ts | 23 +- .../src/canister1/stable_map_4.ts | 23 +- .../src/canister2/stable_map_5.ts | 23 +- .../src/canister2/stable_map_6.ts | 23 +- .../src/canister2/stable_map_7.ts | 25 +- .../src/canister2/stable_map_8.ts | 25 +- .../src/canister2/stable_map_9.ts | 23 +- .../src/canister3/stable_map_10.ts | 23 +- .../src/canister3/stable_map_11.ts | 23 +- .../src/canister3/stable_map_12.ts | 23 +- .../src/canister3/stable_map_13.ts | 23 +- .../src/canister3/stable_map_14.ts | 23 +- .../src/canister3/stable_map_15.ts | 23 +- .../src/canister3/stable_map_16.ts | 12 +- .../src/canister3/stable_map_17.ts | 23 +- .../stable_structures/stable_b_tree_map.ts | 31 +- .../stable_structures/package-lock.json | 692 +++++++++++++++++- .../stable_structures/src/canister1/index.ts | 107 ++- .../stable_structures/src/canister2/index.ts | 111 ++- .../stable_structures/src/canister3/index.ts | 171 ++++- 24 files changed, 2058 insertions(+), 149 deletions(-) diff --git a/examples/stable_structures/package-lock.json b/examples/stable_structures/package-lock.json index 546b52aac1..eca64c0d76 100644 --- a/examples/stable_structures/package-lock.json +++ b/examples/stable_structures/package-lock.json @@ -12,7 +12,7 @@ "@dfinity/agent": "^0.19.2", "jest": "^29.7.0", "ts-jest": "^29.1.5", - "ts-node": "^10.9.1", + "tsx": "^4.15.7", "typescript": "^5.2.2" } }, @@ -737,6 +737,22 @@ "@noble/hashes": "^1.3.1" } }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@esbuild/android-arm": { "version": "0.19.4", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.4.tgz", @@ -1453,6 +1469,8 @@ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -3302,6 +3320,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/get-tsconfig": { + "version": "4.7.5", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.5.tgz", + "integrity": "sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==", + "dev": true, + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -5023,6 +5053,15 @@ "node": ">=8" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/resolve.exports": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", @@ -5411,6 +5450,8 @@ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -5454,6 +5495,8 @@ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -5466,6 +5509,415 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, + "node_modules/tsx": { + "version": "4.16.2", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.16.2.tgz", + "integrity": "sha512-C1uWweJDgdtX2x600HjaFaucXTilT7tgUZHbOE4+ypskZ1OP8CRCSDkCxG6Vya9EwaFIVagWwpaVAn5wzypaqQ==", + "dev": true, + "dependencies": { + "esbuild": "~0.21.5", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/esbuild": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" + } + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -5563,7 +6015,9 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "node_modules/v8-to-istanbul": { "version": "9.3.0", @@ -6292,6 +6746,13 @@ "@noble/hashes": "^1.3.1" } }, + "@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "dev": true, + "optional": true + }, "@esbuild/android-arm": { "version": "0.19.4", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.4.tgz", @@ -6745,6 +7206,8 @@ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", "dev": true, + "optional": true, + "peer": true, "requires": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -8127,6 +8590,15 @@ "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "dev": true }, + "get-tsconfig": { + "version": "4.7.5", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.5.tgz", + "integrity": "sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==", + "dev": true, + "requires": { + "resolve-pkg-maps": "^1.0.0" + } + }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -9452,6 +9924,12 @@ "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true }, + "resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true + }, "resolve.exports": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", @@ -9717,6 +10195,8 @@ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", "dev": true, + "optional": true, + "peer": true, "requires": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -9738,6 +10218,8 @@ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", "dev": true, + "optional": true, + "peer": true, "requires": { "@jridgewell/trace-mapping": "0.3.9" } @@ -9749,6 +10231,204 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, + "tsx": { + "version": "4.16.2", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.16.2.tgz", + "integrity": "sha512-C1uWweJDgdtX2x600HjaFaucXTilT7tgUZHbOE4+ypskZ1OP8CRCSDkCxG6Vya9EwaFIVagWwpaVAn5wzypaqQ==", + "dev": true, + "requires": { + "esbuild": "~0.21.5", + "fsevents": "~2.3.3", + "get-tsconfig": "^4.7.5" + }, + "dependencies": { + "@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "dev": true, + "optional": true + }, + "@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "dev": true, + "optional": true + }, + "@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "dev": true, + "optional": true + }, + "@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "dev": true, + "optional": true + }, + "@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "dev": true, + "optional": true + }, + "@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "dev": true, + "optional": true + }, + "@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "dev": true, + "optional": true + }, + "@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "dev": true, + "optional": true + }, + "@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "dev": true, + "optional": true + }, + "@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "dev": true, + "optional": true + }, + "@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "dev": true, + "optional": true + }, + "@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "dev": true, + "optional": true + }, + "@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "dev": true, + "optional": true + }, + "@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "dev": true, + "optional": true + }, + "@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "dev": true, + "optional": true + }, + "@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "dev": true, + "optional": true + }, + "@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "dev": true, + "optional": true + }, + "@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "dev": true, + "optional": true + }, + "esbuild": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "dev": true, + "requires": { + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" + } + } + } + }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -9800,7 +10480,9 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "v8-to-istanbul": { "version": "9.3.0", diff --git a/examples/stable_structures/src/canister1/stable_map_0.ts b/examples/stable_structures/src/canister1/stable_map_0.ts index 138d216151..306b01bde4 100644 --- a/examples/stable_structures/src/canister1/stable_map_0.ts +++ b/examples/stable_structures/src/canister1/stable_map_0.ts @@ -2,8 +2,10 @@ import { bool, nat8, nat64, + None, Opt, query, + Some, StableBTreeMap, text, Tuple, @@ -18,10 +20,20 @@ export const stableMap0Methods = { return stableMap0.containsKey(key); }), stableMap0Get: query([nat8], Opt(text), (key) => { - return stableMap0.get(key); + const result = stableMap0.get(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap0Insert: update([nat8, text], Opt(text), (key, value) => { - return stableMap0.insert(key, value); + const result = stableMap0.insert(key, value); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap0IsEmpty: query([], bool, () => { return stableMap0.isEmpty(); @@ -36,7 +48,12 @@ export const stableMap0Methods = { return stableMap0.len(); }), stableMap0Remove: update([nat8], Opt(text), (key) => { - return stableMap0.remove(key); + const result = stableMap0.remove(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap0Values: query([], Vec(text), () => { return stableMap0.values(); diff --git a/examples/stable_structures/src/canister1/stable_map_1.ts b/examples/stable_structures/src/canister1/stable_map_1.ts index 9b79022ce4..d08c52a98f 100644 --- a/examples/stable_structures/src/canister1/stable_map_1.ts +++ b/examples/stable_structures/src/canister1/stable_map_1.ts @@ -3,8 +3,10 @@ import { bool, nat16, nat64, + None, Opt, query, + Some, StableBTreeMap, Tuple, update, @@ -18,10 +20,20 @@ export const stableMap1Methods = { return stableMap1.containsKey(key); }), stableMap1Get: query([nat16], Opt(blob), (key) => { - return stableMap1.get(key); + const result = stableMap1.get(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap1Insert: update([nat16, blob], Opt(blob), (key, value) => { - return stableMap1.insert(key, value); + const result = stableMap1.insert(key, value); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap1IsEmpty: query([], bool, () => { return stableMap1.isEmpty(); @@ -36,7 +48,12 @@ export const stableMap1Methods = { return stableMap1.len(); }), stableMap1Remove: update([nat16], Opt(blob), (key) => { - return stableMap1.remove(key); + const result = stableMap1.remove(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap1Values: query([], Vec(blob), () => { return stableMap1.values(); diff --git a/examples/stable_structures/src/canister1/stable_map_2.ts b/examples/stable_structures/src/canister1/stable_map_2.ts index 7ccac8abf5..9633387642 100644 --- a/examples/stable_structures/src/canister1/stable_map_2.ts +++ b/examples/stable_structures/src/canister1/stable_map_2.ts @@ -3,8 +3,10 @@ import { nat, nat32, nat64, + None, Opt, query, + Some, StableBTreeMap, Tuple, update, @@ -18,10 +20,20 @@ export const stableMap2Methods = { return stableMap2.containsKey(key); }), stableMap2Get: query([nat32], Opt(nat), (key) => { - return stableMap2.get(key); + const result = stableMap2.get(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap2Insert: update([nat32, nat], Opt(nat), (key, value) => { - return stableMap2.insert(key, value); + const result = stableMap2.insert(key, value); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap2IsEmpty: query([], bool, () => { return stableMap2.isEmpty(); @@ -36,7 +48,12 @@ export const stableMap2Methods = { return stableMap2.len(); }), stableMap2Remove: update([nat32], Opt(nat), (key) => { - return stableMap2.remove(key); + const result = stableMap2.remove(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap2Values: query([], Vec(nat), () => { return stableMap2.values(); diff --git a/examples/stable_structures/src/canister1/stable_map_3.ts b/examples/stable_structures/src/canister1/stable_map_3.ts index d53d69f9c3..c045fc6d21 100644 --- a/examples/stable_structures/src/canister1/stable_map_3.ts +++ b/examples/stable_structures/src/canister1/stable_map_3.ts @@ -2,8 +2,10 @@ import { bool, int, nat64, + None, Opt, query, + Some, StableBTreeMap, Tuple, update, @@ -19,10 +21,20 @@ export const stableMap3Methods = { return stableMap3.containsKey(key); }), stableMap3Get: query([Reaction], Opt(int), (key) => { - return stableMap3.get(key); + const result = stableMap3.get(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap3Insert: update([Reaction, int], Opt(int), (key, value) => { - return stableMap3.insert(key, value); + const result = stableMap3.insert(key, value); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap3IsEmpty: query([], bool, () => { return stableMap3.isEmpty(); @@ -37,7 +49,12 @@ export const stableMap3Methods = { return stableMap3.len(); }), stableMap3Remove: update([Reaction], Opt(int), (key) => { - return stableMap3.remove(key); + const result = stableMap3.remove(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap3Values: query([], Vec(int), () => { return stableMap3.values(); diff --git a/examples/stable_structures/src/canister1/stable_map_4.ts b/examples/stable_structures/src/canister1/stable_map_4.ts index 4098e509f3..5cde3e1d6a 100644 --- a/examples/stable_structures/src/canister1/stable_map_4.ts +++ b/examples/stable_structures/src/canister1/stable_map_4.ts @@ -2,8 +2,10 @@ import { bool, float32, nat64, + None, Opt, query, + Some, StableBTreeMap, Tuple, update, @@ -19,10 +21,20 @@ export const stableMap4Methods = { return stableMap4.containsKey(key); }), stableMap4Get: query([User], Opt(float32), (key) => { - return stableMap4.get(key); + const result = stableMap4.get(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap4Insert: update([User, float32], Opt(float32), (key, value) => { - return stableMap4.insert(key, value); + const result = stableMap4.insert(key, value); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap4IsEmpty: query([], bool, () => { return stableMap4.isEmpty(); @@ -37,7 +49,12 @@ export const stableMap4Methods = { return stableMap4.len(); }), stableMap4Remove: update([User], Opt(float32), (key) => { - return stableMap4.remove(key); + const result = stableMap4.remove(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap4Values: query([], Vec(float32), () => { return stableMap4.values(); diff --git a/examples/stable_structures/src/canister2/stable_map_5.ts b/examples/stable_structures/src/canister2/stable_map_5.ts index 447f44e9a7..177cd79e34 100644 --- a/examples/stable_structures/src/canister2/stable_map_5.ts +++ b/examples/stable_structures/src/canister2/stable_map_5.ts @@ -2,8 +2,10 @@ import { bool, float64, nat64, + None, Opt, query, + Some, StableBTreeMap, text, Tuple, @@ -18,13 +20,23 @@ export const stableMap5Methods = { return stableMap5.containsKey(key); }), stableMap5Get: query([Opt(text)], Opt(float64), (key) => { - return stableMap5.get(key); + const result = stableMap5.get(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap5Insert: update( [Opt(text), float64], Opt(float64), (key, value) => { - return stableMap5.insert(key, value); + const result = stableMap5.insert(key, value); + if (result === null) { + return None; + } else { + return Some(result); + } } ), stableMap5IsEmpty: query([], bool, () => { @@ -40,7 +52,12 @@ export const stableMap5Methods = { return stableMap5.len(); }), stableMap5Remove: update([Opt(text)], Opt(float64), (key) => { - return stableMap5.remove(key); + const result = stableMap5.remove(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap5Values: query([], Vec(float64), () => { return stableMap5.values(); diff --git a/examples/stable_structures/src/canister2/stable_map_6.ts b/examples/stable_structures/src/canister2/stable_map_6.ts index 1f4a4fad1f..cf6efb9c21 100644 --- a/examples/stable_structures/src/canister2/stable_map_6.ts +++ b/examples/stable_structures/src/canister2/stable_map_6.ts @@ -1,8 +1,10 @@ import { bool, nat64, + None, Opt, query, + Some, StableBTreeMap, Tuple, update, @@ -16,10 +18,20 @@ export const stableMap6Methods = { return stableMap6.containsKey(key); }), stableMap6Get: query([Vec(nat64)], Opt(bool), (key) => { - return stableMap6.get(key); + const result = stableMap6.get(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap6Insert: update([Vec(nat64), bool], Opt(bool), (key, value) => { - return stableMap6.insert(key, value); + const result = stableMap6.insert(key, value); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap6IsEmpty: query([], bool, () => { return stableMap6.isEmpty(); @@ -34,7 +46,12 @@ export const stableMap6Methods = { return stableMap6.len(); }), stableMap6Remove: update([Vec(nat64)], Opt(bool), (key) => { - return stableMap6.remove(key); + const result = stableMap6.remove(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap6Values: query([], Vec(bool), () => { return stableMap6.values(); diff --git a/examples/stable_structures/src/canister2/stable_map_7.ts b/examples/stable_structures/src/canister2/stable_map_7.ts index 00d172a83c..d8994eddbd 100644 --- a/examples/stable_structures/src/canister2/stable_map_7.ts +++ b/examples/stable_structures/src/canister2/stable_map_7.ts @@ -1,9 +1,11 @@ import { bool, nat64, + None, Null, Opt, query, + Some, StableBTreeMap, Tuple, update, @@ -17,10 +19,21 @@ export const stableMap7Methods = { return stableMap7.containsKey(key); }), stableMap7Get: query([Null], Opt(Null), (key) => { - return stableMap7.get(key); + const result = stableMap7.get(key); + if (stableMap7.containsKey(key)) { + return Some(result); + } else { + return None; + } }), stableMap7Insert: update([Null, Null], Opt(Null), (key, value) => { - return stableMap7.insert(key, value); + const hasOldValue = stableMap7.containsKey(key); + const result = stableMap7.insert(key, value); + if (hasOldValue) { + return Some(result); + } else { + return None; + } }), stableMap7IsEmpty: query([], bool, () => { return stableMap7.isEmpty(); @@ -35,7 +48,13 @@ export const stableMap7Methods = { return stableMap7.len(); }), stableMap7Remove: update([Null], Opt(Null), (key) => { - return stableMap7.remove(key); + const hasOldValue = stableMap7.containsKey(key); + const result = stableMap7.remove(key); + if (hasOldValue) { + return Some(result); + } else { + return None; + } }), stableMap7Values: query([], Vec(Null), () => { return stableMap7.values(); diff --git a/examples/stable_structures/src/canister2/stable_map_8.ts b/examples/stable_structures/src/canister2/stable_map_8.ts index 295c536603..393574f727 100644 --- a/examples/stable_structures/src/canister2/stable_map_8.ts +++ b/examples/stable_structures/src/canister2/stable_map_8.ts @@ -1,9 +1,11 @@ import { bool, nat64, + None, Null, Opt, query, + Some, StableBTreeMap, Tuple, update, @@ -17,10 +19,21 @@ export const stableMap8Methods = { return stableMap8.containsKey(key); }), stableMap8Get: query([bool], Opt(Null), (key) => { - return stableMap8.get(key); + const result = stableMap8.get(key); + if (stableMap8.containsKey(key)) { + return Some(result); + } else { + return None; + } }), stableMap8Insert: update([bool, Null], Opt(Null), (key, value) => { - return stableMap8.insert(key, value); + const hasOldValue = stableMap8.containsKey(key); + const result = stableMap8.insert(key, value); + if (hasOldValue) { + return Some(result); + } else { + return None; + } }), stableMap8IsEmpty: query([], bool, () => { return stableMap8.isEmpty(); @@ -35,7 +48,13 @@ export const stableMap8Methods = { return stableMap8.len(); }), stableMap8Remove: update([bool], Opt(Null), (key) => { - return stableMap8.remove(key); + const hasOldValue = stableMap8.containsKey(key); + const result = stableMap8.remove(key); + if (hasOldValue) { + return Some(result); + } else { + return None; + } }), stableMap8Values: query([], Vec(Null), () => { return stableMap8.values(); diff --git a/examples/stable_structures/src/canister2/stable_map_9.ts b/examples/stable_structures/src/canister2/stable_map_9.ts index 730e446235..4ea075d653 100644 --- a/examples/stable_structures/src/canister2/stable_map_9.ts +++ b/examples/stable_structures/src/canister2/stable_map_9.ts @@ -2,8 +2,10 @@ import { bool, float64, nat64, + None, Opt, query, + Some, StableBTreeMap, text, Tuple, @@ -18,13 +20,23 @@ export const stableMap9Methods = { return stableMap9.containsKey(key); }), stableMap9Get: query([float64], Opt(Vec(text)), (key) => { - return stableMap9.get(key); + const result = stableMap9.get(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap9Insert: update( [float64, Vec(text)], Opt(Vec(text)), (key, value) => { - return stableMap9.insert(key, value); + const result = stableMap9.insert(key, value); + if (result === null) { + return None; + } else { + return Some(result); + } } ), stableMap9IsEmpty: query([], bool, () => { @@ -40,7 +52,12 @@ export const stableMap9Methods = { return stableMap9.len(); }), stableMap9Remove: update([float64], Opt(Vec(text)), (key) => { - return stableMap9.remove(key); + const result = stableMap9.remove(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap9Values: query([], Vec(Vec(text)), () => { return stableMap9.values(); diff --git a/examples/stable_structures/src/canister3/stable_map_10.ts b/examples/stable_structures/src/canister3/stable_map_10.ts index 5f92c76493..4ba342f633 100644 --- a/examples/stable_structures/src/canister3/stable_map_10.ts +++ b/examples/stable_structures/src/canister3/stable_map_10.ts @@ -2,8 +2,10 @@ import { bool, float32, nat64, + None, Opt, query, + Some, StableBTreeMap, Tuple, update, @@ -17,13 +19,23 @@ export const stableMap10Methods = { return stableMap10.containsKey(key); }), stableMap10Get: query([float32], Opt(Opt(bool)), (key) => { - return stableMap10.get(key); + const result = stableMap10.get(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap10Insert: update( [float32, Opt(bool)], Opt(Opt(bool)), (key, value) => { - return stableMap10.insert(key, value); + const result = stableMap10.insert(key, value); + if (result === null) { + return None; + } else { + return Some(result); + } } ), stableMap10IsEmpty: query([], bool, () => { @@ -39,7 +51,12 @@ export const stableMap10Methods = { return stableMap10.len(); }), stableMap10Remove: update([float32], Opt(Opt(bool)), (key) => { - return stableMap10.remove(key); + const result = stableMap10.remove(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap10Values: query([], Vec(Opt(bool)), () => { return stableMap10.values(); diff --git a/examples/stable_structures/src/canister3/stable_map_11.ts b/examples/stable_structures/src/canister3/stable_map_11.ts index 97e2c41312..4949ff276e 100644 --- a/examples/stable_structures/src/canister3/stable_map_11.ts +++ b/examples/stable_structures/src/canister3/stable_map_11.ts @@ -2,8 +2,10 @@ import { bool, nat, nat64, + None, Opt, query, + Some, StableBTreeMap, Tuple, update, @@ -19,10 +21,20 @@ export const stableMap11Methods = { return stableMap11.containsKey(key); }), stableMap11Get: query([nat], Opt(User), (key) => { - return stableMap11.get(key); + const result = stableMap11.get(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap11Insert: update([nat, User], Opt(User), (key, value) => { - return stableMap11.insert(key, value); + const result = stableMap11.insert(key, value); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap11IsEmpty: query([], bool, () => { return stableMap11.isEmpty(); @@ -37,7 +49,12 @@ export const stableMap11Methods = { return stableMap11.len(); }), stableMap11Remove: update([nat], Opt(User), (key) => { - return stableMap11.remove(key); + const result = stableMap11.remove(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap11Values: query([], Vec(User), () => { return stableMap11.values(); diff --git a/examples/stable_structures/src/canister3/stable_map_12.ts b/examples/stable_structures/src/canister3/stable_map_12.ts index d2a380733c..c6880cb781 100644 --- a/examples/stable_structures/src/canister3/stable_map_12.ts +++ b/examples/stable_structures/src/canister3/stable_map_12.ts @@ -2,8 +2,10 @@ import { blob, bool, nat64, + None, Opt, query, + Some, StableBTreeMap, Tuple, update, @@ -19,10 +21,20 @@ export const stableMap12Methods = { return stableMap12.containsKey(key); }), stableMap12Get: query([blob], Opt(Reaction), (key) => { - return stableMap12.get(key); + const result = stableMap12.get(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap12Insert: update([blob, Reaction], Opt(Reaction), (key, value) => { - return stableMap12.insert(key, value); + const result = stableMap12.insert(key, value); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap12IsEmpty: query([], bool, () => { return stableMap12.isEmpty(); @@ -37,7 +49,12 @@ export const stableMap12Methods = { return stableMap12.len(); }), stableMap12Remove: update([blob], Opt(Reaction), (key) => { - return stableMap12.remove(key); + const result = stableMap12.remove(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap12Values: query([], Vec(Reaction), () => { return stableMap12.values(); diff --git a/examples/stable_structures/src/canister3/stable_map_13.ts b/examples/stable_structures/src/canister3/stable_map_13.ts index 3bb37d6812..8c19b018e8 100644 --- a/examples/stable_structures/src/canister3/stable_map_13.ts +++ b/examples/stable_structures/src/canister3/stable_map_13.ts @@ -1,9 +1,11 @@ import { bool, nat64, + None, Opt, Principal, query, + Some, StableBTreeMap, text, Tuple, @@ -18,13 +20,23 @@ export const stableMap13Methods = { return stableMap13.containsKey(key); }), stableMap13Get: query([text], Opt(Principal), (key) => { - return stableMap13.get(key); + const result = stableMap13.get(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap13Insert: update( [text, Principal], Opt(Principal), (key, value) => { - return stableMap13.insert(key, value); + const result = stableMap13.insert(key, value); + if (result === null) { + return None; + } else { + return Some(result); + } } ), stableMap13IsEmpty: query([], bool, () => { @@ -40,7 +52,12 @@ export const stableMap13Methods = { return stableMap13.len(); }), stableMap13Remove: update([text], Opt(Principal), (key) => { - return stableMap13.remove(key); + const result = stableMap13.remove(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap13Values: query([], Vec(Principal), () => { return stableMap13.values(); diff --git a/examples/stable_structures/src/canister3/stable_map_14.ts b/examples/stable_structures/src/canister3/stable_map_14.ts index f6d6da244d..c1dfe1efbc 100644 --- a/examples/stable_structures/src/canister3/stable_map_14.ts +++ b/examples/stable_structures/src/canister3/stable_map_14.ts @@ -1,8 +1,10 @@ import { bool, nat64, + None, Opt, query, + Some, StableBTreeMap, text, Tuple, @@ -19,10 +21,20 @@ export const stableMap14Methods = { return stableMap14.containsKey(key); }), stableMap14Get: query([text], Opt(Callback), (key) => { - return stableMap14.get(key); + const result = stableMap14.get(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap14Insert: update([text, Callback], Opt(Callback), (key, value) => { - return stableMap14.insert(key, value); + const result = stableMap14.insert(key, value); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap14IsEmpty: query([], bool, () => { return stableMap14.isEmpty(); @@ -37,7 +49,12 @@ export const stableMap14Methods = { return stableMap14.len(); }), stableMap14Remove: update([text], Opt(Callback), (key) => { - return stableMap14.remove(key); + const result = stableMap14.remove(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap14Values: query([], Vec(Callback), () => { return stableMap14.values(); diff --git a/examples/stable_structures/src/canister3/stable_map_15.ts b/examples/stable_structures/src/canister3/stable_map_15.ts index 3135df0200..6327ac88a0 100644 --- a/examples/stable_structures/src/canister3/stable_map_15.ts +++ b/examples/stable_structures/src/canister3/stable_map_15.ts @@ -1,8 +1,10 @@ import { bool, nat64, + None, Opt, query, + Some, StableBTreeMap, text, Tuple, @@ -19,10 +21,20 @@ export const stableMap15Methods = { return stableMap15.containsKey(key); }), stableMap15Get: query([Callback], Opt(text), (key) => { - return stableMap15.get(key); + const result = stableMap15.get(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap15Insert: update([Callback, text], Opt(text), (key, value) => { - return stableMap15.insert(key, value); + const result = stableMap15.insert(key, value); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap15IsEmpty: query([], bool, () => { return stableMap15.isEmpty(); @@ -37,7 +49,12 @@ export const stableMap15Methods = { return stableMap15.len(); }), stableMap15Remove: update([Callback], Opt(text), (key) => { - return stableMap15.remove(key); + const result = stableMap15.remove(key); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap15Values: query([], Vec(text), () => { return stableMap15.values(); diff --git a/examples/stable_structures/src/canister3/stable_map_16.ts b/examples/stable_structures/src/canister3/stable_map_16.ts index 4cc7207a2a..522623d676 100644 --- a/examples/stable_structures/src/canister3/stable_map_16.ts +++ b/examples/stable_structures/src/canister3/stable_map_16.ts @@ -21,20 +21,20 @@ export const stableMap16Methods = { stableMap16Get: query([text], Opt(text), (key) => { const result = stableMap16.get(key); - if ('None' in result) { + if (result === null) { return None; } - return Some(JSON.stringify(result.Some)); + return Some(JSON.stringify(result)); }), stableMap16Insert: update([text, text], Opt(text), (key, value) => { const result = stableMap16.insert(key, JSON.parse(value)); - if ('None' in result) { + if (result === null) { return None; } - return Some(JSON.stringify(result.Some)); + return Some(JSON.stringify(result)); }), stableMap16IsEmpty: query([], bool, () => { return stableMap16.isEmpty(); @@ -53,11 +53,11 @@ export const stableMap16Methods = { stableMap16Remove: update([text], Opt(text), (key) => { const result = stableMap16.remove(key); - if ('None' in result) { + if (result === null) { return None; } - return Some(JSON.stringify(result.Some)); + return Some(JSON.stringify(result)); }), stableMap16Values: query([], Vec(text), () => { return stableMap16.values().map((value) => JSON.stringify(value)); diff --git a/examples/stable_structures/src/canister3/stable_map_17.ts b/examples/stable_structures/src/canister3/stable_map_17.ts index 01adcc3bf8..dec2a778f7 100644 --- a/examples/stable_structures/src/canister3/stable_map_17.ts +++ b/examples/stable_structures/src/canister3/stable_map_17.ts @@ -1,8 +1,10 @@ import { bool, nat64, + None, Opt, query, + Some, StableBTreeMap, text, Tuple, @@ -17,10 +19,20 @@ export const stableMap17Methods = { return stableMap17.containsKey(JSON.parse(key)); }), stableMap17Get: query([text], Opt(text), (key) => { - return stableMap17.get(JSON.parse(key)); + const result = stableMap17.get(JSON.parse(key)); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap17Insert: update([text, text], Opt(text), (key, value) => { - return stableMap17.insert(JSON.parse(key), value); + const result = stableMap17.insert(JSON.parse(key), value); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap17IsEmpty: query([], bool, () => { return stableMap17.isEmpty(); @@ -37,7 +49,12 @@ export const stableMap17Methods = { return stableMap17.len(); }), stableMap17Remove: update([text], Opt(text), (key) => { - return stableMap17.remove(JSON.parse(key)); + const result = stableMap17.remove(JSON.parse(key)); + if (result === null) { + return None; + } else { + return Some(result); + } }), stableMap17Values: query([], Vec(text), () => { return stableMap17.values(); diff --git a/src/lib/stable_structures/stable_b_tree_map.ts b/src/lib/stable_structures/stable_b_tree_map.ts index 82d38d2a86..dbd56ae013 100644 --- a/src/lib/stable_structures/stable_b_tree_map.ts +++ b/src/lib/stable_structures/stable_b_tree_map.ts @@ -1,6 +1,3 @@ -import { None, Opt, Some } from '../candid/types/constructed/opt'; -import { nat8 } from '../candid/types/primitive/nats/nat8'; -import { nat64 } from '../candid/types/primitive/nats/nat64'; import { stableJson } from './stable_json'; export interface Serializable { @@ -11,7 +8,7 @@ export interface Serializable { // TODO make this function's return type explicit https://github.com/demergent-labs/azle/issues/1860 // eslint-disable-next-line @typescript-eslint/explicit-function-return-type export function StableBTreeMap( - memoryIdNumber: nat8, + memoryIdNumber: number, keySerializable: Serializable = stableJson, valueSerializable: Serializable = stableJson ) { @@ -50,7 +47,7 @@ export function StableBTreeMap( * @param key the location from which to retrieve. * @returns the value associated with the given key, if it exists. */ - get(key: Key): Opt { + get(key: Key): Value | null { if (globalThis._azleIc === undefined) { return undefined as any; } @@ -63,10 +60,10 @@ export function StableBTreeMap( ); if (encodedResult === undefined) { - return None; + return null; } else { - return Some( - valueSerializable.fromBytes(new Uint8Array(encodedResult)) + return valueSerializable.fromBytes( + new Uint8Array(encodedResult) ); } }, @@ -76,7 +73,7 @@ export function StableBTreeMap( * @param value the value to insert. * @returns the previous value of the key, if present. */ - insert(key: Key, value: Value): Opt { + insert(key: Key, value: Value): Value | null { if (globalThis._azleIc === undefined) { return undefined as any; } @@ -91,10 +88,10 @@ export function StableBTreeMap( ); if (encodedResult === undefined) { - return None; + return null; } else { - return Some( - valueSerializable.fromBytes(new Uint8Array(encodedResult)) + return valueSerializable.fromBytes( + new Uint8Array(encodedResult) ); } }, @@ -160,7 +157,7 @@ export function StableBTreeMap( * Checks to see how many elements are in the map. * @returns the number of elements in the map. */ - len(): nat64 { + len(): bigint { if (globalThis._azleIc === undefined) { return undefined as any; } @@ -172,7 +169,7 @@ export function StableBTreeMap( * @param key the location from which to remove. * @returns the previous value at the key if it exists, `null` otherwise. */ - remove(key: Key): Opt { + remove(key: Key): Value | null { if (globalThis._azleIc === undefined) { return undefined as any; } @@ -185,10 +182,10 @@ export function StableBTreeMap( ); if (encodedValue === undefined) { - return None; + return null; } else { - return Some( - valueSerializable.fromBytes(new Uint8Array(encodedValue)) + return valueSerializable.fromBytes( + new Uint8Array(encodedValue) ); } }, diff --git a/tests/end_to_end/candid_rpc/class_syntax/stable_structures/package-lock.json b/tests/end_to_end/candid_rpc/class_syntax/stable_structures/package-lock.json index f6cee88fe1..19cb9b8149 100644 --- a/tests/end_to_end/candid_rpc/class_syntax/stable_structures/package-lock.json +++ b/tests/end_to_end/candid_rpc/class_syntax/stable_structures/package-lock.json @@ -12,7 +12,7 @@ "jest": "^29.7.0", "stable_structures_end_to_end_test_functional_syntax": "file:../../../../../examples/stable_structures", "ts-jest": "^29.1.5", - "ts-node": "^10.9.1", + "tsx": "^4.15.7", "typescript": "^5.2.2" } }, @@ -26,7 +26,7 @@ "@dfinity/agent": "^0.19.2", "jest": "^29.7.0", "ts-jest": "^29.1.5", - "ts-node": "^10.9.1", + "tsx": "^4.15.7", "typescript": "^5.2.2" } }, @@ -751,6 +751,22 @@ "@noble/hashes": "^1.3.1" } }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@esbuild/android-arm": { "version": "0.19.4", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.4.tgz", @@ -1467,6 +1483,8 @@ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -3316,6 +3334,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/get-tsconfig": { + "version": "4.7.5", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.5.tgz", + "integrity": "sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==", + "dev": true, + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -5037,6 +5067,15 @@ "node": ">=8" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/resolve.exports": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", @@ -5429,6 +5468,8 @@ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -5472,6 +5513,8 @@ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", "dev": true, + "optional": true, + "peer": true, "dependencies": { "@jridgewell/trace-mapping": "0.3.9" }, @@ -5484,6 +5527,415 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, + "node_modules/tsx": { + "version": "4.16.2", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.16.2.tgz", + "integrity": "sha512-C1uWweJDgdtX2x600HjaFaucXTilT7tgUZHbOE4+ypskZ1OP8CRCSDkCxG6Vya9EwaFIVagWwpaVAn5wzypaqQ==", + "dev": true, + "dependencies": { + "esbuild": "~0.21.5", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "cpu": [ + "arm" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "cpu": [ + "loong64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "cpu": [ + "mips64el" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "cpu": [ + "s390x" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "cpu": [ + "ia32" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "cpu": [ + "x64" + ], + "dev": true, + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/tsx/node_modules/esbuild": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" + } + }, "node_modules/type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -5581,7 +6033,9 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "node_modules/v8-to-istanbul": { "version": "9.3.0", @@ -6310,6 +6764,13 @@ "@noble/hashes": "^1.3.1" } }, + "@esbuild/aix-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", + "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", + "dev": true, + "optional": true + }, "@esbuild/android-arm": { "version": "0.19.4", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.19.4.tgz", @@ -6763,6 +7224,8 @@ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", "dev": true, + "optional": true, + "peer": true, "requires": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -8145,6 +8608,15 @@ "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "dev": true }, + "get-tsconfig": { + "version": "4.7.5", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.7.5.tgz", + "integrity": "sha512-ZCuZCnlqNzjb4QprAzXKdpp/gh6KTxSJuw3IBsPnV/7fV4NxC9ckB+vPTt8w7fJA0TaSD7c55BR47JD6MEDyDw==", + "dev": true, + "requires": { + "resolve-pkg-maps": "^1.0.0" + } + }, "glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -9470,6 +9942,12 @@ "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true }, + "resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true + }, "resolve.exports": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", @@ -9587,7 +10065,7 @@ "azle": "0.22.0", "jest": "^29.7.0", "ts-jest": "^29.1.5", - "ts-node": "^10.9.1", + "tsx": "^4.15.7", "typescript": "^5.2.2" } }, @@ -9746,6 +10224,8 @@ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.1.tgz", "integrity": "sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==", "dev": true, + "optional": true, + "peer": true, "requires": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -9767,6 +10247,8 @@ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", "dev": true, + "optional": true, + "peer": true, "requires": { "@jridgewell/trace-mapping": "0.3.9" } @@ -9778,6 +10260,204 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, + "tsx": { + "version": "4.16.2", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.16.2.tgz", + "integrity": "sha512-C1uWweJDgdtX2x600HjaFaucXTilT7tgUZHbOE4+ypskZ1OP8CRCSDkCxG6Vya9EwaFIVagWwpaVAn5wzypaqQ==", + "dev": true, + "requires": { + "esbuild": "~0.21.5", + "fsevents": "~2.3.3", + "get-tsconfig": "^4.7.5" + }, + "dependencies": { + "@esbuild/android-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", + "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", + "dev": true, + "optional": true + }, + "@esbuild/android-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", + "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", + "dev": true, + "optional": true + }, + "@esbuild/android-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", + "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", + "dev": true, + "optional": true + }, + "@esbuild/darwin-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", + "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", + "dev": true, + "optional": true + }, + "@esbuild/darwin-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", + "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", + "dev": true, + "optional": true + }, + "@esbuild/freebsd-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", + "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", + "dev": true, + "optional": true + }, + "@esbuild/freebsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", + "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", + "dev": true, + "optional": true + }, + "@esbuild/linux-arm": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", + "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", + "dev": true, + "optional": true + }, + "@esbuild/linux-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", + "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", + "dev": true, + "optional": true + }, + "@esbuild/linux-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", + "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-loong64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", + "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-mips64el": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", + "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", + "dev": true, + "optional": true + }, + "@esbuild/linux-ppc64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", + "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", + "dev": true, + "optional": true + }, + "@esbuild/linux-riscv64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", + "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", + "dev": true, + "optional": true + }, + "@esbuild/linux-s390x": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", + "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", + "dev": true, + "optional": true + }, + "@esbuild/linux-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", + "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", + "dev": true, + "optional": true + }, + "@esbuild/netbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", + "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", + "dev": true, + "optional": true + }, + "@esbuild/openbsd-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", + "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", + "dev": true, + "optional": true + }, + "@esbuild/sunos-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", + "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", + "dev": true, + "optional": true + }, + "@esbuild/win32-arm64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", + "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", + "dev": true, + "optional": true + }, + "@esbuild/win32-ia32": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", + "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", + "dev": true, + "optional": true + }, + "@esbuild/win32-x64": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", + "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", + "dev": true, + "optional": true + }, + "esbuild": { + "version": "0.21.5", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", + "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", + "dev": true, + "requires": { + "@esbuild/aix-ppc64": "0.21.5", + "@esbuild/android-arm": "0.21.5", + "@esbuild/android-arm64": "0.21.5", + "@esbuild/android-x64": "0.21.5", + "@esbuild/darwin-arm64": "0.21.5", + "@esbuild/darwin-x64": "0.21.5", + "@esbuild/freebsd-arm64": "0.21.5", + "@esbuild/freebsd-x64": "0.21.5", + "@esbuild/linux-arm": "0.21.5", + "@esbuild/linux-arm64": "0.21.5", + "@esbuild/linux-ia32": "0.21.5", + "@esbuild/linux-loong64": "0.21.5", + "@esbuild/linux-mips64el": "0.21.5", + "@esbuild/linux-ppc64": "0.21.5", + "@esbuild/linux-riscv64": "0.21.5", + "@esbuild/linux-s390x": "0.21.5", + "@esbuild/linux-x64": "0.21.5", + "@esbuild/netbsd-x64": "0.21.5", + "@esbuild/openbsd-x64": "0.21.5", + "@esbuild/sunos-x64": "0.21.5", + "@esbuild/win32-arm64": "0.21.5", + "@esbuild/win32-ia32": "0.21.5", + "@esbuild/win32-x64": "0.21.5" + } + } + } + }, "type-detect": { "version": "4.0.8", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", @@ -9829,7 +10509,9 @@ "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", - "dev": true + "dev": true, + "optional": true, + "peer": true }, "v8-to-istanbul": { "version": "9.3.0", diff --git a/tests/end_to_end/candid_rpc/class_syntax/stable_structures/src/canister1/index.ts b/tests/end_to_end/candid_rpc/class_syntax/stable_structures/src/canister1/index.ts index 8d2de67624..f3211f75ab 100644 --- a/tests/end_to_end/candid_rpc/class_syntax/stable_structures/src/canister1/index.ts +++ b/tests/end_to_end/candid_rpc/class_syntax/stable_structures/src/canister1/index.ts @@ -1,4 +1,4 @@ -import { convertOpt, IDL, query, StableBTreeMap, update } from 'azle'; +import { IDL, query, StableBTreeMap, update } from 'azle'; import { Reaction, User } from '../types'; @@ -23,12 +23,22 @@ export default class { @query([IDL.Nat8], IDL.Opt(IDL.Text)) stableMap0Get(key: number): [string] | [] { - return convertOpt(stableMap0.get(key)); + const result = stableMap0.get(key); + if (result === null) { + return []; + } else { + return [result]; + } } @update([IDL.Nat8, IDL.Text], IDL.Opt(IDL.Text)) stableMap0Insert(key: number, value: string): [string] | [] { - return convertOpt(stableMap0.insert(key, value)); + const result = stableMap0.insert(key, value); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Bool) @@ -53,7 +63,12 @@ export default class { @update([IDL.Nat8], IDL.Opt(IDL.Text)) stableMap0Remove(key: number): [string] | [] { - return convertOpt(stableMap0.remove(key)); + const result = stableMap0.remove(key); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Vec(IDL.Text)) @@ -70,12 +85,22 @@ export default class { @query([IDL.Nat16], IDL.Opt(IDL.Vec(IDL.Nat8))) stableMap1Get(key: number): [Uint8Array] | [] { - return convertOpt(stableMap1.get(key)); + const result = stableMap1.get(key); + if (result === null) { + return []; + } else { + return [result]; + } } @update([IDL.Nat16, IDL.Vec(IDL.Nat8)], IDL.Opt(IDL.Vec(IDL.Nat8))) stableMap1Insert(key: number, value: Uint8Array): [Uint8Array] | [] { - return convertOpt(stableMap1.insert(key, value)); + const result = stableMap1.insert(key, value); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Bool) @@ -100,7 +125,12 @@ export default class { @update([IDL.Nat16], IDL.Opt(IDL.Vec(IDL.Nat8))) stableMap1Remove(key: number): [Uint8Array] | [] { - return convertOpt(stableMap1.remove(key)); + const result = stableMap1.remove(key); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Vec(IDL.Vec(IDL.Nat8))) @@ -117,12 +147,22 @@ export default class { @query([IDL.Nat32], IDL.Opt(IDL.Nat)) stableMap2Get(key: number): [bigint] | [] { - return convertOpt(stableMap2.get(key)); + const result = stableMap2.get(key); + if (result === null) { + return []; + } else { + return [result]; + } } @update([IDL.Nat32, IDL.Nat], IDL.Opt(IDL.Nat)) stableMap2Insert(key: number, value: bigint): [bigint] | [] { - return convertOpt(stableMap2.insert(key, value)); + const result = stableMap2.insert(key, value); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Bool) @@ -147,7 +187,12 @@ export default class { @update([IDL.Nat32], IDL.Opt(IDL.Nat)) stableMap2Remove(key: number): [bigint] | [] { - return convertOpt(stableMap2.remove(key)); + const result = stableMap2.remove(key); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Vec(IDL.Nat)) @@ -164,12 +209,22 @@ export default class { @query([Reaction], IDL.Opt(IDL.Int)) stableMap3Get(key: Reaction): [bigint] | [] { - return convertOpt(stableMap3.get(key)); + const result = stableMap3.get(key); + if (result === null) { + return []; + } else { + return [result]; + } } @update([Reaction, IDL.Int], IDL.Opt(IDL.Int)) stableMap3Insert(key: Reaction, value: bigint): [bigint] | [] { - return convertOpt(stableMap3.insert(key, value)); + const result = stableMap3.insert(key, value); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Bool) @@ -194,7 +249,12 @@ export default class { @update([Reaction], IDL.Opt(IDL.Int)) stableMap3Remove(key: Reaction): [bigint] | [] { - return convertOpt(stableMap3.remove(key)); + const result = stableMap3.remove(key); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Vec(IDL.Int)) @@ -211,12 +271,22 @@ export default class { @query([User], IDL.Opt(IDL.Float32)) stableMap4Get(key: User): [number] | [] { - return convertOpt(stableMap4.get(key)); + const result = stableMap4.get(key); + if (result === null) { + return []; + } else { + return [result]; + } } @update([User, IDL.Float32], IDL.Opt(IDL.Float32)) stableMap4Insert(key: User, value: number): [number] | [] { - return convertOpt(stableMap4.insert(key, value)); + const result = stableMap4.insert(key, value); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Bool) @@ -241,7 +311,12 @@ export default class { @update([User], IDL.Opt(IDL.Float32)) stableMap4Remove(key: User): [number] | [] { - return convertOpt(stableMap4.remove(key)); + const result = stableMap4.remove(key); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Vec(IDL.Float32)) diff --git a/tests/end_to_end/candid_rpc/class_syntax/stable_structures/src/canister2/index.ts b/tests/end_to_end/candid_rpc/class_syntax/stable_structures/src/canister2/index.ts index b24acdbeec..d0dc3dbbb2 100644 --- a/tests/end_to_end/candid_rpc/class_syntax/stable_structures/src/canister2/index.ts +++ b/tests/end_to_end/candid_rpc/class_syntax/stable_structures/src/canister2/index.ts @@ -1,4 +1,4 @@ -import { convertOpt, IDL, query, StableBTreeMap, update } from 'azle'; +import { IDL, query, StableBTreeMap, update } from 'azle'; let stableMap5 = StableBTreeMap<[string] | [], number>(5); let stableMap6 = StableBTreeMap(6); @@ -21,12 +21,22 @@ export default class { @query([IDL.Opt(IDL.Text)], IDL.Opt(IDL.Float64)) stableMap5Get(key: [string] | []): [number] | [] { - return convertOpt(stableMap5.get(key)); + const result = stableMap5.get(key); + if (result === null) { + return []; + } else { + return [result]; + } } @update([IDL.Opt(IDL.Text), IDL.Float64], IDL.Opt(IDL.Float64)) stableMap5Insert(key: [string] | [], value: number): [number] | [] { - return convertOpt(stableMap5.insert(key, value)); + const result = stableMap5.insert(key, value); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Bool) @@ -51,7 +61,12 @@ export default class { @update([IDL.Opt(IDL.Text)], IDL.Opt(IDL.Float64)) stableMap5Remove(key: [string] | []): [number] | [] { - return convertOpt(stableMap5.remove(key)); + const result = stableMap5.remove(key); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Vec(IDL.Float64)) @@ -68,12 +83,22 @@ export default class { @query([IDL.Vec(IDL.Nat64)], IDL.Opt(IDL.Bool)) stableMap6Get(key: bigint[]): [boolean] | [] { - return convertOpt(stableMap6.get(key)); + const result = stableMap6.get(key); + if (result === null) { + return []; + } else { + return [result]; + } } @update([IDL.Vec(IDL.Nat64), IDL.Bool], IDL.Opt(IDL.Bool)) stableMap6Insert(key: bigint[], value: boolean): [boolean] | [] { - return convertOpt(stableMap6.insert(key, value)); + const result = stableMap6.insert(key, value); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Bool) @@ -98,7 +123,12 @@ export default class { @update([IDL.Vec(IDL.Nat64)], IDL.Opt(IDL.Bool)) stableMap6Remove(key: bigint[]): [boolean] | [] { - return convertOpt(stableMap6.remove(key)); + const result = stableMap6.remove(key); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Vec(IDL.Bool)) @@ -115,12 +145,23 @@ export default class { @query([IDL.Null], IDL.Opt(IDL.Null)) stableMap7Get(key: null): [null] | [] { - return convertOpt(stableMap7.get(key)); + const result = stableMap7.get(key); + if (stableMap7.containsKey(key)) { + return [result]; + } else { + return []; + } } @update([IDL.Null, IDL.Null], IDL.Opt(IDL.Null)) stableMap7Insert(key: null, value: null): [null] | [] { - return convertOpt(stableMap7.insert(key, value)); + const hasOldValue = stableMap7.containsKey(key); + const result = stableMap7.insert(key, value); + if (hasOldValue) { + return [result]; + } else { + return []; + } } @query([], IDL.Bool) @@ -145,7 +186,13 @@ export default class { @update([IDL.Null], IDL.Opt(IDL.Null)) stableMap7Remove(key: null): [null] | [] { - return convertOpt(stableMap7.remove(key)); + const hasOldValue = stableMap7.containsKey(key); + const result = stableMap7.remove(key); + if (hasOldValue) { + return [result]; + } else { + return []; + } } @query([], IDL.Vec(IDL.Null)) @@ -162,12 +209,23 @@ export default class { @query([IDL.Bool], IDL.Opt(IDL.Null)) stableMap8Get(key: boolean): [null] | [] { - return convertOpt(stableMap8.get(key)); + const result = stableMap8.get(key); + if (stableMap8.containsKey(key)) { + return [result]; + } else { + return []; + } } @update([IDL.Bool, IDL.Null], IDL.Opt(IDL.Null)) stableMap8Insert(key: boolean, value: null): [null] | [] { - return convertOpt(stableMap8.insert(key, value)); + const hasOldValue = stableMap8.containsKey(key); + const result = stableMap8.insert(key, value); + if (hasOldValue) { + return [result]; + } else { + return []; + } } @query([], IDL.Bool) @@ -192,7 +250,13 @@ export default class { @update([IDL.Bool], IDL.Opt(IDL.Null)) stableMap8Remove(key: boolean): [null] | [] { - return convertOpt(stableMap8.remove(key)); + const hasOldValue = stableMap8.containsKey(key); + const result = stableMap8.remove(key); + if (hasOldValue) { + return [result]; + } else { + return []; + } } @query([], IDL.Vec(IDL.Null)) @@ -209,12 +273,22 @@ export default class { @query([IDL.Float64], IDL.Opt(IDL.Vec(IDL.Text))) stableMap9Get(key: number): [string[]] | [] { - return convertOpt(stableMap9.get(key)); + const result = stableMap9.get(key); + if (result === null) { + return []; + } else { + return [result]; + } } @update([IDL.Float64, IDL.Vec(IDL.Text)], IDL.Opt(IDL.Vec(IDL.Text))) stableMap9Insert(key: number, value: string[]): [string[]] | [] { - return convertOpt(stableMap9.insert(key, value)); + const result = stableMap9.insert(key, value); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Bool) @@ -239,7 +313,12 @@ export default class { @update([IDL.Float64], IDL.Opt(IDL.Vec(IDL.Text))) stableMap9Remove(key: number): [string[]] | [] { - return convertOpt(stableMap9.remove(key)); + const result = stableMap9.remove(key); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Vec(IDL.Vec(IDL.Text))) diff --git a/tests/end_to_end/candid_rpc/class_syntax/stable_structures/src/canister3/index.ts b/tests/end_to_end/candid_rpc/class_syntax/stable_structures/src/canister3/index.ts index 99adce2c2b..98355d805c 100644 --- a/tests/end_to_end/candid_rpc/class_syntax/stable_structures/src/canister3/index.ts +++ b/tests/end_to_end/candid_rpc/class_syntax/stable_structures/src/canister3/index.ts @@ -1,11 +1,4 @@ -import { - convertOpt, - IDL, - Principal, - query, - StableBTreeMap, - update -} from 'azle'; +import { IDL, Principal, query, StableBTreeMap, update } from 'azle'; import { Callback, Reaction, User } from '../types'; @@ -33,7 +26,12 @@ export default class { @query([IDL.Float32], IDL.Opt(IDL.Opt(IDL.Bool))) stableMap10Get(key: number): [[boolean] | []] | [] { - return convertOpt(stableMap10.get(key)); + const result = stableMap10.get(key); + if (result === null) { + return []; + } else { + return [result]; + } } @update([IDL.Float32, IDL.Opt(IDL.Bool)], IDL.Opt(IDL.Opt(IDL.Bool))) @@ -41,7 +39,12 @@ export default class { key: number, value: [boolean] | [] ): [[boolean] | []] | [] { - return convertOpt(stableMap10.insert(key, value)); + const result = stableMap10.insert(key, value); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Bool) @@ -66,7 +69,12 @@ export default class { @update([IDL.Float32], IDL.Opt(IDL.Opt(IDL.Bool))) stableMap10Remove(key: number): [[boolean] | []] | [] { - return convertOpt(stableMap10.remove(key)); + const result = stableMap10.remove(key); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Vec(IDL.Opt(IDL.Bool))) @@ -83,12 +91,22 @@ export default class { @query([IDL.Nat], IDL.Opt(User)) stableMap11Get(key: bigint): [User] | [] { - return convertOpt(stableMap11.get(key)); + const result = stableMap11.get(key); + if (result === null) { + return []; + } else { + return [result]; + } } @update([IDL.Nat, User], IDL.Opt(User)) stableMap11Insert(key: bigint, value: User): [User] | [] { - return convertOpt(stableMap11.insert(key, value)); + const result = stableMap11.insert(key, value); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Bool) @@ -113,7 +131,12 @@ export default class { @update([IDL.Nat], IDL.Opt(User)) stableMap11Remove(key: bigint): [User] | [] { - return convertOpt(stableMap11.remove(key)); + const result = stableMap11.remove(key); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Vec(User)) @@ -130,12 +153,22 @@ export default class { @query([IDL.Vec(IDL.Nat8)], IDL.Opt(Reaction)) stableMap12Get(key: Uint8Array): [Reaction] | [] { - return convertOpt(stableMap12.get(key)); + const result = stableMap12.get(key); + if (result === null) { + return []; + } else { + return [result]; + } } @update([IDL.Vec(IDL.Nat8), Reaction], IDL.Opt(Reaction)) stableMap12Insert(key: Uint8Array, value: Reaction): [Reaction] | [] { - return convertOpt(stableMap12.insert(key, value)); + const result = stableMap12.insert(key, value); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Bool) @@ -160,7 +193,12 @@ export default class { @update([IDL.Vec(IDL.Nat8)], IDL.Opt(Reaction)) stableMap12Remove(key: Uint8Array): [Reaction] | [] { - return convertOpt(stableMap12.remove(key)); + const result = stableMap12.remove(key); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Vec(Reaction)) @@ -177,12 +215,22 @@ export default class { @query([IDL.Text], IDL.Opt(IDL.Principal)) stableMap13Get(key: string): [Principal] | [] { - return convertOpt(stableMap13.get(key)); + const result = stableMap13.get(key); + if (result === null) { + return []; + } else { + return [result]; + } } @update([IDL.Text, IDL.Principal], IDL.Opt(IDL.Principal)) stableMap13Insert(key: string, value: Principal): [Principal] | [] { - return convertOpt(stableMap13.insert(key, value)); + const result = stableMap13.insert(key, value); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Bool) @@ -207,7 +255,12 @@ export default class { @update([IDL.Text], IDL.Opt(IDL.Principal)) stableMap13Remove(key: string): [Principal] | [] { - return convertOpt(stableMap13.remove(key)); + const result = stableMap13.remove(key); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Vec(IDL.Principal)) @@ -224,12 +277,22 @@ export default class { @query([IDL.Text], IDL.Opt(Callback)) stableMap14Get(key: string): [Callback] | [] { - return convertOpt(stableMap14.get(key)); + const result = stableMap14.get(key); + if (result === null) { + return []; + } else { + return [result]; + } } @update([IDL.Text, Callback], IDL.Opt(Callback)) stableMap14Insert(key: string, value: Callback): [Callback] | [] { - return convertOpt(stableMap14.insert(key, value)); + const result = stableMap14.insert(key, value); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Bool) @@ -254,7 +317,12 @@ export default class { @update([IDL.Text], IDL.Opt(Callback)) stableMap14Remove(key: string): [Callback] | [] { - return convertOpt(stableMap14.remove(key)); + const result = stableMap14.remove(key); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Vec(Callback)) @@ -271,12 +339,22 @@ export default class { @query([Callback], IDL.Opt(IDL.Text)) stableMap15Get(key: Callback): [string] | [] { - return convertOpt(stableMap15.get(key)); + const result = stableMap15.get(key); + if (result === null) { + return []; + } else { + return [result]; + } } @update([Callback, IDL.Text], IDL.Opt(IDL.Text)) stableMap15Insert(key: Callback, value: string): [string] | [] { - return convertOpt(stableMap15.insert(key, value)); + const result = stableMap15.insert(key, value); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Bool) @@ -301,7 +379,12 @@ export default class { @update([Callback], IDL.Opt(IDL.Text)) stableMap15Remove(key: Callback): [string] | [] { - return convertOpt(stableMap15.remove(key)); + const result = stableMap15.remove(key); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Vec(IDL.Text)) @@ -319,19 +402,21 @@ export default class { @query([IDL.Text], IDL.Opt(IDL.Text)) stableMap16Get(key: string): [string] | [] { const result = stableMap16.get(key); - if ('None' in result) { + if (result === null) { return []; + } else { + return [JSON.stringify(result)]; } - return [JSON.stringify(result.Some)]; } @update([IDL.Text, IDL.Text], IDL.Opt(IDL.Text)) stableMap16Insert(key: string, value: string): [string] | [] { const result = stableMap16.insert(key, JSON.parse(value)); - if ('None' in result) { + if (result === null) { return []; + } else { + return [JSON.stringify(result)]; } - return [JSON.stringify(result.Some)]; } @query([], IDL.Bool) @@ -359,10 +444,11 @@ export default class { @update([IDL.Text], IDL.Opt(IDL.Text)) stableMap16Remove(key: string): [string] | [] { const result = stableMap16.remove(key); - if ('None' in result) { + if (result === null) { return []; + } else { + return [JSON.stringify(result)]; } - return [JSON.stringify(result.Some)]; } @query([], IDL.Vec(IDL.Text)) @@ -379,12 +465,22 @@ export default class { @query([IDL.Text], IDL.Opt(IDL.Text)) stableMap17Get(key: string): [string] | [] { - return convertOpt(stableMap17.get(JSON.parse(key))); + const result = stableMap17.get(JSON.parse(key)); + if (result === null) { + return []; + } else { + return [result]; + } } @update([IDL.Text, IDL.Text], IDL.Opt(IDL.Text)) stableMap17Insert(key: string, value: string): [string] | [] { - return convertOpt(stableMap17.insert(JSON.parse(key), value)); + const result = stableMap17.insert(JSON.parse(key), value); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Bool) @@ -411,7 +507,12 @@ export default class { @update([IDL.Text], IDL.Opt(IDL.Text)) stableMap17Remove(key: string): [string] | [] { - return convertOpt(stableMap17.remove(JSON.parse(key))); + const result = stableMap17.remove(JSON.parse(key)); + if (result === null) { + return []; + } else { + return [result]; + } } @query([], IDL.Vec(IDL.Text))