From 2f8cad60544475b5f1a2a162320e43bb92590dac Mon Sep 17 00:00:00 2001 From: Dan Steren Date: Mon, 27 Nov 2023 11:42:02 -0700 Subject: [PATCH 01/34] Remove old eslintrc The new file should be generated for us and will be a .js file. --- .eslintrc | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .eslintrc diff --git a/.eslintrc b/.eslintrc deleted file mode 100644 index 8ecae3337a..0000000000 --- a/.eslintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["prettier"] -} From d8ee26110e9f4fb60bbe394e65bd77ff2856704e Mon Sep 17 00:00:00 2001 From: Dan Steren Date: Mon, 27 Nov 2023 11:49:45 -0700 Subject: [PATCH 02/34] Add eslint These changes were all the result of running `npm init @eslint/config`. --- .eslintrc.js | 30 ++++ package-lock.json | 422 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 + 3 files changed, 454 insertions(+) create mode 100644 .eslintrc.js diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000000..8f32abb2cf --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,30 @@ +module.exports = { + env: { + es2021: true, + node: true + }, + extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], + overrides: [ + { + env: { + node: true + }, + files: ['.eslintrc.{js,cjs}'], + parserOptions: { + sourceType: 'script' + } + } + ], + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module' + }, + plugins: ['@typescript-eslint'], + rules: { + indent: ['error', 4], + 'linebreak-style': ['error', 'unix'], + quotes: ['error', 'single'], + semi: ['error', 'always'] + } +}; diff --git a/package-lock.json b/package-lock.json index 0b09a04754..31cb1bd70a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,6 +35,8 @@ "@types/deep-equal": "^1.0.4", "@types/fs-extra": "9.0.13", "@types/pako": "^2.0.3", + "@typescript-eslint/eslint-plugin": "^6.13.0", + "@typescript-eslint/parser": "^6.13.0", "deep-equal": "^2.2.3", "deep-is": "^0.1.4", "eslint": "8.11.0", @@ -457,6 +459,30 @@ "node": ">=12" } }, + "node_modules/@eslint-community/eslint-utils": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", + "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^3.3.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" + } + }, + "node_modules/@eslint-community/regexpp": { + "version": "4.10.0", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.10.0.tgz", + "integrity": "sha512-Cu96Sd2By9mCNTx2iyKOmq10v22jUVQv0lQnlGNy16oE9589yE+QADPbrMGCkA51cKZSg3Pu/aTJVTGfL/qjUA==", + "dev": true, + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" + } + }, "node_modules/@eslint/eslintrc": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", @@ -522,6 +548,41 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@swc/core": { "version": "1.3.92", "resolved": "https://registry.npmjs.org/@swc/core/-/core-1.3.92.tgz", @@ -770,6 +831,12 @@ "@types/node": "*" } }, + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", + "dev": true + }, "node_modules/@types/node": { "version": "20.8.4", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.4.tgz", @@ -784,11 +851,206 @@ "integrity": "sha512-bq0hMV9opAcrmE0Byyo0fY3Ew4tgOevJmQ9grUhpXQhYfyLJ1Kqg3P33JT5fdbT2AjeAjR51zqqVjAL/HMkx7Q==", "dev": true }, + "node_modules/@types/semver": { + "version": "7.5.8", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.8.tgz", + "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", + "dev": true + }, "node_modules/@types/uuid": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.5.tgz", "integrity": "sha512-xfHdwa1FMJ082prjSJpoEI57GZITiQz10r3vEJCHa2khEFQjKy91aWKz6+zybzssCvXUwE1LQWgWVwZ4nYUvHQ==" }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.13.0.tgz", + "integrity": "sha512-HTvbSd0JceI2GW5DHS3R9zbarOqjkM9XDR7zL8eCsBUO/eSiHcoNE7kSL5sjGXmVa9fjH5LCfHDXNnH4QLp7tQ==", + "dev": true, + "dependencies": { + "@eslint-community/regexpp": "^4.5.1", + "@typescript-eslint/scope-manager": "6.13.0", + "@typescript-eslint/type-utils": "6.13.0", + "@typescript-eslint/utils": "6.13.0", + "@typescript-eslint/visitor-keys": "6.13.0", + "debug": "^4.3.4", + "graphemer": "^1.4.0", + "ignore": "^5.2.4", + "natural-compare": "^1.4.0", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^6.0.0 || ^6.0.0-alpha", + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.13.0.tgz", + "integrity": "sha512-VpG+M7GNhHLI/aTDctqAV0XbzB16vf+qDX9DXuMZSe/0bahzDA9AKZB15NDbd+D9M4cDsJvfkbGOA7qiZ/bWJw==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "6.13.0", + "@typescript-eslint/types": "6.13.0", + "@typescript-eslint/typescript-estree": "6.13.0", + "@typescript-eslint/visitor-keys": "6.13.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.13.0.tgz", + "integrity": "sha512-2x0K2/CujsokIv+LN2T0l5FVDMtsCjkUyYtlcY4xxnxLAW+x41LXr16duoicHpGtLhmtN7kqvuFJ3zbz00Ikhw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.13.0", + "@typescript-eslint/visitor-keys": "6.13.0" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.13.0.tgz", + "integrity": "sha512-YHufAmZd/yP2XdoD3YeFEjq+/Tl+myhzv+GJHSOz+ro/NFGS84mIIuLU3pVwUcauSmwlCrVXbBclkn1HfjY0qQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/typescript-estree": "6.13.0", + "@typescript-eslint/utils": "6.13.0", + "debug": "^4.3.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/types": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.13.0.tgz", + "integrity": "sha512-oXg7DFxx/GmTrKXKKLSoR2rwiutOC7jCQ5nDH5p5VS6cmHE1TcPTaYQ0VPSSUvj7BnNqCgQ/NXcTBxn59pfPTQ==", + "dev": true, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.13.0.tgz", + "integrity": "sha512-IT4O/YKJDoiy/mPEDsfOfp+473A9GVqXlBKckfrAOuVbTqM8xbc0LuqyFCcgeFWpqu3WjQexolgqN2CuWBYbog==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.13.0", + "@typescript-eslint/visitor-keys": "6.13.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "semver": "^7.5.4", + "ts-api-utils": "^1.0.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.13.0.tgz", + "integrity": "sha512-V+txaxARI8yznDkcQ6FNRXxG+T37qT3+2NsDTZ/nKLxv6VfGrRhTnuvxPUxpVuWWr+eVeIxU53PioOXbz8ratQ==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@types/json-schema": "^7.0.12", + "@types/semver": "^7.5.0", + "@typescript-eslint/scope-manager": "6.13.0", + "@typescript-eslint/types": "6.13.0", + "@typescript-eslint/typescript-estree": "6.13.0", + "semver": "^7.5.4" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.13.0.tgz", + "integrity": "sha512-UQklteCEMCRoq/1UhKFZsHv5E4dN1wQSzJoxTfABasWk1HgJRdg1xNUve/Kv/Sdymt4x+iEzpESOqRFlQr/9Aw==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "6.13.0", + "eslint-visitor-keys": "^3.4.1" + }, + "engines": { + "node": "^16.0.0 || >=18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/acorn": { "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", @@ -938,6 +1200,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/asn1.js": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-5.4.1.tgz", @@ -1603,6 +1874,18 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -2011,6 +2294,34 @@ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, + "node_modules/fast-glob": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.2.tgz", + "integrity": "sha512-oX2ruAFQwf/Orj8m737Y5adxDQO0LAB7/S5MnxCdTNDd4p6BsyIVsv9JQsATbTSq8KHRpLwIHbVlUNatxd+1Ow==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -2023,6 +2334,15 @@ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true }, + "node_modules/fastq": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", + "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, "node_modules/file-entry-cache": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", @@ -2210,6 +2530,26 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -2227,6 +2567,12 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==" }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true + }, "node_modules/has-bigints": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.2.tgz", @@ -3164,6 +3510,18 @@ "node": ">=8" } }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/make-error": { "version": "1.3.6", "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", @@ -3185,6 +3543,15 @@ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", "dev": true }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/micromatch": { "version": "4.0.5", "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", @@ -3461,6 +3828,15 @@ "node": ">=8" } }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/pbkdf2": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", @@ -3679,6 +4055,16 @@ "node": ">=8" } }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, "node_modules/rfdc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.3.0.tgz", @@ -3756,6 +4142,21 @@ "node": ">=10.0.0" } }, + "node_modules/semver": { + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", + "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/set-function-length": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz", @@ -3843,6 +4244,15 @@ "resolved": "https://registry.npmjs.org/simple-cbor/-/simple-cbor-0.4.1.tgz", "integrity": "sha512-rijcxtwx2b4Bje3sqeIqw5EeW7UlOIC4YfOdwqIKacpvRQ/D78bWg/4/0m5e0U91oKvlGh7LlJuZCu07ISCC7w==" }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/slice-ansi": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz", @@ -4026,6 +4436,18 @@ "node": ">=8.0" } }, + "node_modules/ts-api-utils": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.0.3.tgz", + "integrity": "sha512-wNMeqtMz5NtwpT/UZGY5alT+VoKdSsOOP/kqHFcUW1P/VRhH2wJ48+DN2WwUliNbQ976ETwDL0Ifd2VVvgonvg==", + "dev": true, + "engines": { + "node": ">=16.13.0" + }, + "peerDependencies": { + "typescript": ">=4.2.0" + } + }, "node_modules/ts-node": { "version": "10.3.1", "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.3.1.tgz", diff --git a/package.json b/package.json index 04a25aa4cf..87a00f8952 100644 --- a/package.json +++ b/package.json @@ -49,6 +49,8 @@ "@types/pako": "^2.0.3", "deep-equal": "^2.2.3", "deep-is": "^0.1.4", + "@typescript-eslint/eslint-plugin": "^6.13.0", + "@typescript-eslint/parser": "^6.13.0", "eslint": "8.11.0", "eslint-config-prettier": "8.5.0", "fast-check": "^3.13.1", From 4cbd1ff331b0549b7fc0ac2893b0b4eb9c1b4c46 Mon Sep 17 00:00:00 2001 From: Dan Steren Date: Mon, 27 Nov 2023 11:50:24 -0700 Subject: [PATCH 03/34] Add eslint to pre-commit hook --- .gitignore | 1 + package.json | 1 + 2 files changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 2e36fa6f2a..a25a888abd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .dfx .DS_Store +.eslintcache .vscode/* !.vscode/extensions.json dist diff --git a/package.json b/package.json index 87a00f8952..2e191a4a85 100644 --- a/package.json +++ b/package.json @@ -59,6 +59,7 @@ "prettier": "^3.0.3" }, "lint-staged": { + "*.{js,ts}": "eslint --cache --fix", "**/*": "prettier --write --ignore-unknown" } } From e08be11c748c591499918e1ff5a35942c489b480 Mon Sep 17 00:00:00 2001 From: Dan Steren Date: Mon, 27 Nov 2023 12:17:00 -0700 Subject: [PATCH 04/34] Configure eslint to work with prettier --- .eslintrc.js | 15 ++- package-lock.json | 302 ++++++++++++++++++++++++++++++++-------------- package.json | 4 +- 3 files changed, 223 insertions(+), 98 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 8f32abb2cf..dd82f702a2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,7 +3,11 @@ module.exports = { es2021: true, node: true }, - extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'], + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'prettier' + ], overrides: [ { env: { @@ -22,9 +26,10 @@ module.exports = { }, plugins: ['@typescript-eslint'], rules: { - indent: ['error', 4], - 'linebreak-style': ['error', 'unix'], - quotes: ['error', 'single'], - semi: ['error', 'always'] + quotes: [ + 'error', + 'single', + { avoidEscape: true, allowTemplateLiterals: false } + ] } }; diff --git a/package-lock.json b/package-lock.json index 31cb1bd70a..f59d20ee5c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,8 +39,8 @@ "@typescript-eslint/parser": "^6.13.0", "deep-equal": "^2.2.3", "deep-is": "^0.1.4", - "eslint": "8.11.0", - "eslint-config-prettier": "8.5.0", + "eslint": "^8.54.0", + "eslint-config-prettier": "^8.5.0", "fast-check": "^3.13.1", "husky": "7.0.4", "lint-staged": "12.3.7", @@ -484,14 +484,14 @@ } }, "node_modules/@eslint/eslintrc": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.4.1.tgz", - "integrity": "sha512-XXrH9Uarn0stsyldqDYq8r++mROmWRI1xKMXa640Bb//SY1+ECYX6VzT6Lcx5frD0V30XieqJ0oX9I2Xj5aoMA==", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-2.1.3.tgz", + "integrity": "sha512-yZzuIG+jnVu6hNSzFEN07e8BxF3uAzYtQb6uDkaYZLo6oYZDCq454c5kB8zxnzfCYyP4MIuyBn10L0DqwujTmA==", "dev": true, "dependencies": { "ajv": "^6.12.4", "debug": "^4.3.2", - "espree": "^9.4.0", + "espree": "^9.6.0", "globals": "^13.19.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", @@ -506,24 +506,46 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@eslint/js": { + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.54.0.tgz", + "integrity": "sha512-ut5V+D+fOoWPgGGNj83GGjnntO39xDy6DWxO0wb7Jp3DcMX0TfIqdzHF85VTQkerdyGmuuMD9AKAo5KiNlf/AQ==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, "node_modules/@humanwhocodes/config-array": { - "version": "0.9.5", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.5.tgz", - "integrity": "sha512-ObyMyWxZiCu/yTisA7uzx81s40xR2fD5Cg/2Kq7G02ajkNubJf6BopgDTmDyc3U7sXpNKM8cYOw7s7Tyr+DnCw==", + "version": "0.11.13", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", + "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", "dev": true, "dependencies": { - "@humanwhocodes/object-schema": "^1.2.1", + "@humanwhocodes/object-schema": "^2.0.1", "debug": "^4.1.1", - "minimatch": "^3.0.4" + "minimatch": "^3.0.5" }, "engines": { "node": ">=10.10.0" } }, + "node_modules/@humanwhocodes/module-importer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", + "dev": true, + "engines": { + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" + } + }, "node_modules/@humanwhocodes/object-schema": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", - "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", + "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", "dev": true }, "node_modules/@noble/curves": { @@ -1051,6 +1073,12 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==", + "dev": true + }, "node_modules/acorn": { "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", @@ -1998,46 +2026,49 @@ } }, "node_modules/eslint": { - "version": "8.11.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.11.0.tgz", - "integrity": "sha512-/KRpd9mIRg2raGxHRGwW9ZywYNAClZrHjdueHcrVDuO3a6bj83eoTirCCk0M0yPwOjWYKHwRVRid+xK4F/GHgA==", - "dev": true, - "dependencies": { - "@eslint/eslintrc": "^1.2.1", - "@humanwhocodes/config-array": "^0.9.2", - "ajv": "^6.10.0", + "version": "8.54.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.54.0.tgz", + "integrity": "sha512-NY0DfAkM8BIZDVl6PgSa1ttZbx3xHgJzSNJKYcQglem6CppHyMhRIQkBVSSMaSRnLhig3jsDbEzOjwCVt4AmmA==", + "dev": true, + "dependencies": { + "@eslint-community/eslint-utils": "^4.2.0", + "@eslint-community/regexpp": "^4.6.1", + "@eslint/eslintrc": "^2.1.3", + "@eslint/js": "8.54.0", + "@humanwhocodes/config-array": "^0.11.13", + "@humanwhocodes/module-importer": "^1.0.1", + "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", + "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", "debug": "^4.3.2", "doctrine": "^3.0.0", "escape-string-regexp": "^4.0.0", - "eslint-scope": "^7.1.1", - "eslint-utils": "^3.0.0", - "eslint-visitor-keys": "^3.3.0", - "espree": "^9.3.1", - "esquery": "^1.4.0", + "eslint-scope": "^7.2.2", + "eslint-visitor-keys": "^3.4.3", + "espree": "^9.6.1", + "esquery": "^1.4.2", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^6.0.1", - "functional-red-black-tree": "^1.0.1", - "glob-parent": "^6.0.1", - "globals": "^13.6.0", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "globals": "^13.19.0", + "graphemer": "^1.4.0", "ignore": "^5.2.0", - "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", + "is-path-inside": "^3.0.3", "js-yaml": "^4.1.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.4.1", "lodash.merge": "^4.6.2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.2", "natural-compare": "^1.4.0", - "optionator": "^0.9.1", - "regexpp": "^3.2.0", + "optionator": "^0.9.3", "strip-ansi": "^6.0.1", - "strip-json-comments": "^3.1.0", - "text-table": "^0.2.0", - "v8-compile-cache": "^2.0.3" + "text-table": "^0.2.0" }, "bin": { "eslint": "bin/eslint.js" @@ -2077,33 +2108,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", - "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", - "dev": true, - "dependencies": { - "eslint-visitor-keys": "^2.0.0" - }, - "engines": { - "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - }, - "peerDependencies": { - "eslint": ">=5" - } - }, - "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/eslint-visitor-keys": { "version": "3.4.3", "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", @@ -2366,6 +2370,22 @@ "node": ">=8" } }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/flat-cache": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.1.tgz", @@ -2436,12 +2456,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/functional-red-black-tree": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", - "integrity": "sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g==", - "dev": true - }, "node_modules/functions-have-names": { "version": "1.2.3", "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", @@ -3076,6 +3090,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-path-inside": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", + "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/is-regex": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", @@ -3426,6 +3449,21 @@ "node": ">=8" } }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/lodash.merge": { "version": "4.6.2", "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", @@ -3766,6 +3804,36 @@ "node": ">= 0.8.0" } }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/p-map": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/p-map/-/p-map-4.0.0.tgz", @@ -3810,6 +3878,15 @@ "safe-buffer": "^5.1.1" } }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -3923,9 +4000,9 @@ "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" }, "node_modules/punycode": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.0.tgz", - "integrity": "sha512-rRV+zQD8tVFys26lAGR9WUuS4iUAngJScM+ZRSKtvl5tKeZ2t5bvdNFdNHBW9FWR4guGHlgmsZ1G7BSm2wTbuA==", + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, "engines": { "node": ">=6" @@ -3963,6 +4040,26 @@ "node": ">=6.0.0" } }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -4021,18 +4118,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/regexpp": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", - "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/mysticatea" - } - }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -4095,6 +4180,29 @@ "inherits": "^2.0.1" } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/rxjs": { "version": "7.8.1", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", @@ -4573,12 +4681,6 @@ "uuid": "dist/bin/uuid" } }, - "node_modules/v8-compile-cache": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.4.0.tgz", - "integrity": "sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw==", - "dev": true - }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -4716,6 +4818,12 @@ } } }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, "node_modules/yaml": { "version": "1.10.2", "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", @@ -4732,6 +4840,18 @@ "engines": { "node": ">=6" } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/package.json b/package.json index 2e191a4a85..d85d56c963 100644 --- a/package.json +++ b/package.json @@ -51,8 +51,8 @@ "deep-is": "^0.1.4", "@typescript-eslint/eslint-plugin": "^6.13.0", "@typescript-eslint/parser": "^6.13.0", - "eslint": "8.11.0", - "eslint-config-prettier": "8.5.0", + "eslint": "^8.54.0", + "eslint-config-prettier": "^8.5.0", "fast-check": "^3.13.1", "husky": "7.0.4", "lint-staged": "12.3.7", From 434371c06a7d17c72cde229cff77ff2c849aa427 Mon Sep 17 00:00:00 2001 From: Dan Steren Date: Mon, 27 Nov 2023 12:57:18 -0700 Subject: [PATCH 05/34] Tweak eslint config --- .eslintignore | 6 ++++++ .eslintrc.js | 27 ++++++++++++++++++++++----- package.json | 1 + 3 files changed, 29 insertions(+), 5 deletions(-) create mode 100644 .eslintignore diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000..f8f99417b4 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,6 @@ +docs +the_azle_book +type_tests +run_time_errors +**/webpack.config.js +dfx_generated diff --git a/.eslintrc.js b/.eslintrc.js index dd82f702a2..e10aa122c4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,3 +1,24 @@ +// TODO: These rules should be enabled, but we had offenses when we enabled ESLint. +// This is tech-debt. We should go through and re-enable these at some point. +const temporarilyDisabledRules = { + '@typescript-eslint/ban-ts-comment': 'off', + '@typescript-eslint/ban-types': 'off', + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-loss-of-precision': 'off', + '@typescript-eslint/no-namespace': 'off', + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/no-var-requires': 'off', + '@typescript-eslint/prefer-as-const': 'off', + 'no-constant-condition': 'off', + 'no-empty': 'off', + 'no-prototype-builtins': 'off', + 'no-undef': 'off', + 'no-useless-catch': 'off', + 'no-useless-escape': 'off', + 'no-var': 'off', + 'prefer-const': 'off' +}; + module.exports = { env: { es2021: true, @@ -26,10 +47,6 @@ module.exports = { }, plugins: ['@typescript-eslint'], rules: { - quotes: [ - 'error', - 'single', - { avoidEscape: true, allowTemplateLiterals: false } - ] + ...temporarilyDisabledRules } }; diff --git a/package.json b/package.json index d85d56c963..6328b71630 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "description": "TypeScript and JavaScript CDK for the Internet Computer", "scripts": { "typecheck": "tsc --noEmit", + "lint": "eslint . --ext .js,.ts --fix", "prepare": "husky install", "test": "test/test.sh" }, From 6f125c07bb7cf8df1adef46b2d78ac76972bac24 Mon Sep 17 00:00:00 2001 From: Dan Steren Date: Tue, 28 Nov 2023 11:26:04 -0700 Subject: [PATCH 06/34] Enable auto-sorting of imports/exports --- .eslintrc.js | 4 +++- package-lock.json | 16 +++++++++++++--- package.json | 1 + 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index e10aa122c4..e3fb91c636 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -45,8 +45,10 @@ module.exports = { ecmaVersion: 'latest', sourceType: 'module' }, - plugins: ['@typescript-eslint'], + plugins: ['@typescript-eslint', 'simple-import-sort'], rules: { + 'simple-import-sort/exports': 'error', + 'simple-import-sort/imports': 'error', ...temporarilyDisabledRules } }; diff --git a/package-lock.json b/package-lock.json index f59d20ee5c..a4aeb797c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,6 +41,7 @@ "deep-is": "^0.1.4", "eslint": "^8.54.0", "eslint-config-prettier": "^8.5.0", + "eslint-plugin-simple-import-sort": "^10.0.0", "fast-check": "^3.13.1", "husky": "7.0.4", "lint-staged": "12.3.7", @@ -2092,6 +2093,15 @@ "eslint": ">=7.0.0" } }, + "node_modules/eslint-plugin-simple-import-sort": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-10.0.0.tgz", + "integrity": "sha512-AeTvO9UCMSNzIHRkg8S6c3RPy5YEwKWSQPx3DYghLedo2ZQxowPFLGDN1AZ2evfg6r6mjBSZSLxLFsWSu3acsw==", + "dev": true, + "peerDependencies": { + "eslint": ">=5.0.0" + } + }, "node_modules/eslint-scope": { "version": "7.2.2", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.2.2.tgz", @@ -3712,9 +3722,9 @@ } }, "node_modules/object-inspect": { - "version": "1.12.3", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", - "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", + "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" diff --git a/package.json b/package.json index 6328b71630..f44e790a7d 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,7 @@ "@typescript-eslint/parser": "^6.13.0", "eslint": "^8.54.0", "eslint-config-prettier": "^8.5.0", + "eslint-plugin-simple-import-sort": "^10.0.0", "fast-check": "^3.13.1", "husky": "7.0.4", "lint-staged": "12.3.7", From 47df10123ef22c0877868e82278f11428ce853e4 Mon Sep 17 00:00:00 2001 From: Dan Steren Date: Tue, 28 Nov 2023 12:20:48 -0700 Subject: [PATCH 07/34] Add to CI/CD --- .github/workflows/test.yml | 3 +++ package.json | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 87c99a3ce5..508e7051e1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -288,6 +288,9 @@ jobs: git clone https://github.com/demergent-labs/wasmedge-quickjs cd wasmedge-quickjs git checkout c21ff69f442998e4cda4619166e23a9bc91418be + - if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }} + shell: bash -l {0} + run: npm run lint - if: ${{ needs.release-candidate-deploy.outputs.should_run_tests }} working-directory: ${{ matrix.example_directories }} run: dfx start --clean --background --host 127.0.0.1:8000 diff --git a/package.json b/package.json index f44e790a7d..62afd1bdc1 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "description": "TypeScript and JavaScript CDK for the Internet Computer", "scripts": { "typecheck": "tsc --noEmit", - "lint": "eslint . --ext .js,.ts --fix", + "lint": "if [ \"$npm_config_fix\" ]; then eslint . --ext .js,.ts --fix; else eslint . --ext .js,.ts; fi", "prepare": "husky install", "test": "test/test.sh" }, From 4407c7fc2a1a0fb5a8497da9c9fc2f3b414cc9d9 Mon Sep 17 00:00:00 2001 From: Dan Steren Date: Fri, 1 Dec 2023 15:39:21 -0700 Subject: [PATCH 08/34] Cache lint results on npm script --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 62afd1bdc1..d45a07e9fa 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "description": "TypeScript and JavaScript CDK for the Internet Computer", "scripts": { "typecheck": "tsc --noEmit", - "lint": "if [ \"$npm_config_fix\" ]; then eslint . --ext .js,.ts --fix; else eslint . --ext .js,.ts; fi", + "lint": "if [ \"$npm_config_fix\" ]; then eslint . --ext .js,.ts --cache --fix; else eslint . --ext .js,.ts --cache; fi", "prepare": "husky install", "test": "test/test.sh" }, From 64a8b9a170fcece9a62e9ba6f137f7644ccf081b Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 4 Apr 2024 10:53:40 -0600 Subject: [PATCH 09/34] Auto fix all file imports with npm run lint --- benchmark/index.ts | 3 +- benchmark/markdown.ts | 2 +- benchmark/usd/index.ts | 12 +-- canisters/icrc/icrc_2.ts | 7 +- canisters/icrc/index.ts | 4 +- canisters/ledger/address/index.ts | 3 +- canisters/ledger/index.ts | 10 +-- canisters/management/canister_info.ts | 10 +-- canisters/management/canister_management.ts | 12 +-- canisters/management/http_request.ts | 14 ++-- dfx/index.ts | 4 +- examples/apollo_server/test/test.ts | 1 + examples/async_await/test/test.ts | 1 + examples/async_await/test/tests.ts | 3 +- examples/audio_and_video/test/test.ts | 1 + examples/audio_recorder/src/index.ts | 2 +- examples/audio_recorder/test/test.ts | 1 + examples/audio_recorder/test/tests.ts | 3 +- examples/autoreload/test/pretest.ts | 1 + examples/autoreload/test/test.ts | 1 + examples/basic_bitcoin/src/bitcoin_api.ts | 2 +- examples/basic_bitcoin/src/bitcoin_wallet.ts | 2 +- examples/basic_bitcoin/src/index.ts | 2 +- examples/bitcoin/test/setup.ts | 2 +- examples/bitcoin/test/test.ts | 7 +- examples/bitcoin/test/tests.ts | 1 + examples/blob_array/test/test.ts | 3 +- examples/blob_array/test/tests.ts | 1 + examples/bytes/test/test.ts | 3 +- examples/bytes/test/tests.ts | 3 +- examples/call_raw/src/index.ts | 2 +- examples/call_raw/test/test.ts | 3 +- examples/call_raw/test/tests.ts | 5 +- examples/candid_encoding/test/test.ts | 3 +- examples/candid_encoding/test/tests.ts | 1 + examples/candid_keywords/src/index.ts | 4 +- examples/candid_keywords/test/test.ts | 3 +- examples/candid_keywords/test/tests.ts | 3 +- examples/canister/src/index.ts | 1 + examples/canister/test/pretest.ts | 2 +- examples/canister/test/test.ts | 1 + examples/canister/test/tests.ts | 5 +- examples/ckbtc/test/tests.ts | 9 +-- examples/ckbtc/wallet/backend/index.ts | 10 +-- examples/ckbtc/wallet/backend/minter.ts | 14 ++-- .../ckbtc/wallet/frontend/elements/ck-app.ts | 9 ++- .../dfx_generate/wallet_backend/index.d.ts | 8 +- .../wallet_backend/wallet_backend.did.d.ts | 2 +- examples/complex_init/src/rec_init/index.ts | 2 +- examples/complex_init/test/test.ts | 1 + examples/complex_init/test/tests.ts | 1 + examples/complex_types/src/candid_types.ts | 2 +- examples/complex_types/src/index.ts | 1 + examples/complex_types/src/posts.ts | 1 + examples/complex_types/src/reactions.ts | 1 + examples/complex_types/src/state.ts | 1 + examples/complex_types/src/threads.ts | 1 + examples/complex_types/src/users.ts | 1 + examples/complex_types/test/test.ts | 1 + examples/complex_types/test/tests.ts | 3 +- .../composite_queries/src/canister1/index.ts | 1 + .../composite_queries/src/canister2/index.ts | 1 + examples/composite_queries/test/test.ts | 1 + examples/composite_queries/test/tests.ts | 3 +- examples/counter/test/test.ts | 1 + examples/counter/test/tests.ts | 1 + .../src/canister1/index.ts | 1 + .../src/canister2/index.ts | 3 +- examples/cross_canister_calls/test/test.ts | 1 + examples/cross_canister_calls/test/tests.ts | 3 +- examples/cycles/src/intermediary/index.ts | 1 + examples/cycles/test/test.ts | 1 + examples/cycles/test/tests.ts | 3 +- examples/date/test/test.ts | 1 + examples/date/test/tests.ts | 3 +- examples/ethereum_json_rpc/test/test.ts | 1 + examples/ethereum_json_rpc/test/tests.ts | 3 +- examples/ethers/test/test.ts | 1 + examples/ethers_base/test/test.ts | 3 +- examples/express/src/backend/index.ts | 2 +- examples/express/test/test.ts | 1 + examples/fetch_ic/test/test.ts | 1 + examples/fetch_ic/test/tests.ts | 2 +- examples/file_protocol/test/test.ts | 1 + examples/fs/test/test.ts | 1 + .../func_types/canisters/func_types/index.ts | 13 +-- .../func_types/canisters/notifiers/index.ts | 2 +- examples/func_types/test/test.ts | 1 + examples/func_types/test/tests.ts | 1 + examples/generics/src/index.ts | 2 +- examples/generics/test/test.ts | 1 + examples/generics/test/tests.ts | 1 + examples/guard_functions/src/index.ts | 1 + examples/guard_functions/test/test.ts | 1 + examples/guard_functions/test/tests.ts | 1 + .../heartbeat/src/heartbeat_async/index.ts | 2 +- examples/heartbeat/test/test.ts | 1 + examples/heartbeat/test/tests.ts | 3 +- examples/hello_world/test/test.ts | 1 + examples/http_outcall_fetch/src/server.ts | 2 +- examples/http_outcall_fetch/test/test.ts | 3 +- examples/hybrid_canister/test/test.ts | 1 + examples/hybrid_canister/test/tests/index.ts | 4 +- examples/ic_api/src/index.ts | 6 +- examples/ic_api/test/test.ts | 1 + examples/ic_api/test/tests.ts | 5 +- examples/ic_evm_rpc/src/server.ts | 2 +- examples/ic_evm_rpc/test/test.ts | 1 + examples/icrc/canisters/proxy/index.ts | 14 ++-- examples/icrc/test/test.ts | 1 + examples/icrc/test/tests.ts | 3 +- examples/imports/src/index.ts | 3 +- examples/imports/test/test.ts | 1 + examples/imports/test/tests.ts | 1 + examples/init/test/test.ts | 1 + examples/init/test/tests.ts | 1 + examples/inspect_message/test/test.ts | 1 + examples/inspect_message/test/tests.ts | 3 +- examples/internet_identity/test/test.ts | 1 + examples/internet_identity/test/tests.ts | 2 +- examples/key_value_store/test/test.ts | 1 + examples/key_value_store/test/tests.ts | 3 +- examples/large_files/src/backend/index.ts | 2 +- .../large_files/test/generateTestFiles.ts | 2 +- examples/large_files/test/pretest.ts | 1 + examples/large_files/test/test.ts | 1 + examples/large_files/test/tests.ts | 11 +-- examples/ledger_canister/test/pretest.ts | 2 +- examples/ledger_canister/test/test.ts | 1 + examples/ledger_canister/test/tests.ts | 1 + examples/list_of_lists/src/index.ts | 4 +- examples/list_of_lists/test/test.ts | 1 + examples/list_of_lists/test/tests.ts | 7 +- examples/management_canister/test/test.ts | 1 + examples/management_canister/test/tests.ts | 3 +- examples/manual_reply/test/test.ts | 1 + examples/manual_reply/test/tests.ts | 3 +- examples/motoko_examples/calc/test/test.ts | 1 + examples/motoko_examples/calc/test/tests.ts | 3 +- examples/motoko_examples/counter/test/test.ts | 1 + .../motoko_examples/counter/test/tests.ts | 3 +- examples/motoko_examples/echo/test/test.ts | 1 + examples/motoko_examples/echo/test/tests.ts | 3 +- .../motoko_examples/factorial/test/test.ts | 1 + .../motoko_examples/factorial/test/tests.ts | 3 +- .../motoko_examples/hello-world/test/test.ts | 1 + .../motoko_examples/hello-world/test/tests.ts | 3 +- examples/motoko_examples/hello/test/test.ts | 1 + examples/motoko_examples/hello/test/tests.ts | 3 +- .../motoko_examples/http_counter/test/test.ts | 1 + .../http_counter/test/tests.ts | 3 +- .../minimal-counter-dapp/test/test.ts | 1 + .../minimal-counter-dapp/test/tests.ts | 3 +- .../persistent-storage/test/test.ts | 1 + .../persistent-storage/test/tests.ts | 3 +- .../src/declarations/phone_book/index.d.ts | 8 +- .../phone_book/phone_book.did.d.ts | 2 +- .../motoko_examples/phone-book/test/test.ts | 1 + .../motoko_examples/phone-book/test/tests.ts | 3 +- .../motoko_examples/quicksort/src/index.ts | 3 +- .../motoko_examples/quicksort/test/test.ts | 1 + .../motoko_examples/quicksort/test/tests.ts | 5 +- .../motoko_examples/simple-to-do/test/test.ts | 1 + .../simple-to-do/test/tests.ts | 3 +- .../superheroes/src/declarations/index.d.ts | 8 +- .../src/declarations/superheroes.did.d.ts | 2 +- .../motoko_examples/superheroes/test/test.ts | 1 + .../motoko_examples/superheroes/test/tests.ts | 3 +- .../threshold_ecdsa/test/test.ts | 1 + .../threshold_ecdsa/test/tests.ts | 3 +- .../motoko_examples/whoami/test/pretest.ts | 4 +- examples/motoko_examples/whoami/test/test.ts | 1 + examples/motoko_examples/whoami/test/tests.ts | 9 ++- examples/new/test/pretest.ts | 1 + examples/notify_raw/test/test.ts | 1 + examples/notify_raw/test/tests.ts | 3 +- examples/null_example/test/test.ts | 1 + examples/null_example/test/tests.ts | 16 ++-- examples/optional_types/test/test.ts | 1 + examples/optional_types/test/tests.ts | 1 + examples/outgoing_http_requests/test/test.ts | 1 + examples/outgoing_http_requests/test/tests.ts | 5 +- examples/plugins/src/index.ts | 1 + examples/plugins/test/test.ts | 1 + examples/plugins/test/tests.ts | 3 +- examples/pre_and_post_upgrade/test/test.ts | 1 + examples/pre_and_post_upgrade/test/tests.ts | 3 +- examples/primitive_ops/benchmark/benchmark.ts | 1 + .../canisters/azle/data_types/blob/index.ts | 3 +- .../azle/data_types/boolean/index.ts | 1 + .../azle/data_types/float/float32.ts | 3 +- .../azle/data_types/float/float64.ts | 3 +- .../canisters/azle/data_types/int/int.ts | 1 + .../canisters/azle/data_types/int/int16.ts | 1 + .../canisters/azle/data_types/int/int32.ts | 1 + .../canisters/azle/data_types/int/int64.ts | 1 + .../canisters/azle/data_types/int/int8.ts | 1 + .../canisters/azle/data_types/nat/nat.ts | 1 + .../canisters/azle/data_types/nat/nat16.ts | 1 + .../canisters/azle/data_types/nat/nat32.ts | 1 + .../canisters/azle/data_types/nat/nat64.ts | 1 + .../canisters/azle/data_types/nat/nat8.ts | 1 + .../canisters/azle/data_types/null/index.ts | 1 + .../canisters/azle/data_types/opt/index.ts | 1 + .../azle/data_types/principal/index.ts | 1 + .../canisters/azle/data_types/record/index.ts | 1 + .../canisters/azle/data_types/text/index.ts | 1 + .../azle/data_types/variant/index.ts | 1 + .../canisters/azle/data_types/vec/index.ts | 1 + .../primitive_ops/canisters/azle/index.ts | 49 +++++------ examples/primitive_types/src/index.ts | 4 +- examples/primitive_types/test/test.ts | 1 + examples/primitive_types/test/tests.ts | 3 +- examples/principal/test/test.ts | 1 + examples/principal/test/tests.ts | 3 +- examples/query/test/test.ts | 1 + examples/query/test/tests.ts | 3 +- examples/randomness/test/test.ts | 1 + examples/randomness/test/tests.ts | 1 + examples/recursion/src/recursion/index.ts | 15 ++-- .../recursion/src/recursive_canister/index.ts | 2 +- examples/recursion/test/pretest.ts | 2 +- examples/recursion/test/test.ts | 1 + examples/recursion/test/tests.ts | 17 ++-- examples/rejections/src/rejections/index.ts | 1 + examples/rejections/test/test.ts | 1 + examples/rejections/test/tests.ts | 10 ++- .../robust_imports/src/azle_coverage/fruit.ts | 24 +++--- .../robust_imports/src/azle_coverage/index.ts | 26 +++--- .../src/import_coverage/index.ts | 4 +- .../src/import_coverage/types.ts | 45 ++++++----- examples/robust_imports/src/index.ts | 81 ++++++++++--------- .../src/type_alias_decls/index.ts | 6 +- .../src/type_alias_decls/types.ts | 7 +- .../robust_imports/src/types/deep/index.ts | 2 +- examples/robust_imports/test/test.ts | 1 + examples/robust_imports/test/tests.ts | 5 +- examples/simple_erc20/test/test.ts | 1 + examples/simple_erc20/test/tests.ts | 3 +- examples/simple_user_accounts/test/test.ts | 1 + examples/simple_user_accounts/test/tests.ts | 18 ++--- examples/sqlite/test/test.ts | 1 + .../test/test.ts | 1 + .../test/tests.ts | 1 + examples/stable_memory/test/test.ts | 1 + examples/stable_memory/test/tests.ts | 3 +- .../stable_structures/src/canister1/index.ts | 1 + .../src/canister1/stable_map_3.ts | 1 + .../src/canister1/stable_map_4.ts | 1 + .../stable_structures/src/canister2/index.ts | 1 + .../src/canister2/stable_map_5.ts | 6 +- .../src/canister2/stable_map_6.ts | 6 +- .../src/canister2/stable_map_8.ts | 6 +- .../src/canister2/stable_map_9.ts | 6 +- .../src/canister3/stable_map_11.ts | 1 + .../src/canister3/stable_map_12.ts | 1 + .../src/canister3/stable_map_14.ts | 1 + .../src/canister3/stable_map_15.ts | 1 + examples/stable_structures/test/test.ts | 1 + examples/stable_structures/test/tests.ts | 17 ++-- examples/tfjs/src/api.ts | 2 +- examples/tfjs/test/test.ts | 1 + examples/timers/test/test.ts | 1 + examples/timers/test/tests.ts | 1 + examples/tuple_types/src/index.ts | 10 +-- examples/tuple_types/test/test.ts | 1 + examples/tuple_types/test/tests.ts | 1 + examples/update/test/test.ts | 1 + examples/update/test/tests.ts | 3 +- examples/vanilla_js/src/index.js | 3 +- examples/vanilla_js/test/test.ts | 3 +- examples/vanilla_js/test/tests.ts | 1 + examples/web_assembly/test/test.ts | 1 + .../complex_candid_definition_memo.ts | 3 +- .../candid/candid_definition_arb/index.ts | 23 +++--- .../recursive_candid_definition_memo.ts | 3 +- .../simple_candid_definition_arb.ts | 9 ++- .../candid/candid_definition_arb/types.ts | 7 +- .../candid/candid_return_type_arb.ts | 2 +- .../candid/candid_value_and_meta_arb.ts | 27 ++++--- .../candid_value_and_meta_arb_generator.ts | 3 +- .../arbitraries/candid/candid_values_arb.ts | 47 +++++------ .../constructed/blob_arb/definition_arb.ts | 3 +- .../candid/constructed/blob_arb/index.ts | 7 +- .../candid/constructed/blob_arb/values_arb.ts | 3 +- .../constructed/opt_arb/definition_arb.ts | 3 +- .../candid/constructed/opt_arb/index.ts | 11 +-- .../candid/constructed/opt_arb/values_arb.ts | 11 +-- .../constructed/record_arb/definition_arb.ts | 3 +- .../candid/constructed/record_arb/index.ts | 8 +- .../constructed/record_arb/values_arb.ts | 9 ++- .../constructed/tuple_arb/definition_arb.ts | 3 +- .../candid/constructed/tuple_arb/index.ts | 9 ++- .../constructed/tuple_arb/values_arbs.ts | 11 +-- .../variant_arb/definition_arbs.ts | 5 +- .../candid/constructed/variant_arb/index.ts | 8 +- .../constructed/variant_arb/values_arb.ts | 9 ++- .../constructed/vec_arb/definition_arb.ts | 3 +- .../candid/constructed/vec_arb/index.ts | 8 +- .../candid/constructed/vec_arb/values_arb.ts | 13 +-- .../candid/corresponding_js_type.ts | 7 +- .../arbitraries/candid/primitive/bool.ts | 9 ++- .../candid/primitive/floats/float32_arb.ts | 11 +-- .../candid/primitive/floats/float64_arb.ts | 11 +-- .../candid/primitive/ints/int16_arb.ts | 13 +-- .../candid/primitive/ints/int32_arb.ts | 13 +-- .../candid/primitive/ints/int64_arb.ts | 11 +-- .../candid/primitive/ints/int8_arb.ts | 15 ++-- .../candid/primitive/ints/int_arb.ts | 13 +-- .../candid/primitive/nats/nat16_arb.ts | 13 +-- .../candid/primitive/nats/nat32_arb.ts | 13 +-- .../candid/primitive/nats/nat64_arb.ts | 11 +-- .../candid/primitive/nats/nat8_arb.ts | 13 +-- .../candid/primitive/nats/nat_arb.ts | 11 +-- .../arbitraries/candid/primitive/null.ts | 11 +-- .../arbitraries/candid/primitive/text.ts | 11 +-- .../arbitraries/candid/primitive/void.ts | 11 +-- .../candid/recursive/definition_arb.ts | 5 +- .../arbitraries/candid/recursive/index.ts | 9 ++- .../candid/recursive/values_arb.ts | 13 +-- .../reference/func_arb/definition_arb.ts | 3 +- .../candid/reference/func_arb/index.ts | 6 +- .../candid/reference/func_arb/values_arb.ts | 5 +- .../candid/reference/principal_arb.ts | 11 +-- .../reference/service_arb/definition_arb.ts | 12 +-- .../candid/reference/service_arb/index.ts | 8 +- .../service_arb/service_method_arb.ts | 14 ++-- .../reference/service_arb/values_arb.ts | 1 + .../candid_type_to_azle_candid_type.ts | 6 +- .../candid/simple_type_arbs/definition_arb.ts | 3 +- .../candid/simple_type_arbs/values_arb.ts | 3 +- property_tests/arbitraries/canister_arb.ts | 9 ++- .../arbitraries/canister_methods/index.ts | 6 +- .../canister_methods/init_method_arb.ts | 12 +-- .../canister_methods/post_upgrade_arb.ts | 10 +-- .../pre_upgrade_method_arb.ts | 8 +- .../canister_methods/query_method_arb.ts | 12 +-- .../canister_methods/update_method_arb.ts | 11 ++- .../arbitraries/http/request_arb.ts | 5 +- .../arbitraries/http/response_arb.ts | 5 +- .../arbitraries/stable_b_tree_map_arb.ts | 3 +- .../are_params_correctly_ordered.ts | 2 +- property_tests/index.ts | 8 +- .../tests/blob/test/generate_body.ts | 2 +- property_tests/tests/blob/test/test.ts | 3 +- .../tests/bool/test/generate_body.ts | 2 +- property_tests/tests/bool/test/test.ts | 3 +- .../http_request/test/fletch.ts | 5 +- .../http_request/test/test.ts | 7 +- .../http_request_update/test/fletch.ts | 5 +- .../test/generate_tests.ts | 2 +- .../http_request_update/test/test.ts | 9 +-- .../test/generate_callable_method_body.ts | 2 +- .../init/test/generate_init_body.ts | 2 +- .../init/test/generate_tests.ts | 2 +- .../tests/canister_methods/init/test/test.ts | 11 ++- .../test/generate_callable_method_body.ts | 2 +- .../test/generate_init_method_body.ts | 3 +- .../post_upgrade/test/generate_init_tests.ts | 2 +- .../test/generate_post_upgrade_method_body.ts | 3 +- .../test/generate_post_upgrade_tests.ts | 2 +- .../post_upgrade/test/test.ts | 31 ++++--- .../canister_methods/pre_upgrade/test/test.ts | 9 +-- .../query/test/generate_body.ts | 6 +- .../query/test/generate_tests.ts | 2 +- .../tests/canister_methods/query/test/test.ts | 5 +- .../update/test/generate_body.ts | 4 +- .../update/test/generate_tests.ts | 4 +- .../canister_methods/update/test/test.ts | 5 +- .../tests/float32/test/generate_body.ts | 2 +- property_tests/tests/float32/test/test.ts | 3 +- .../tests/float64/test/generate_body.ts | 2 +- property_tests/tests/float64/test/test.ts | 3 +- .../tests/func/test/generate_body.ts | 2 +- property_tests/tests/func/test/test.ts | 3 +- .../tests/int/test/generate_body.ts | 2 +- property_tests/tests/int/test/test.ts | 3 +- .../tests/int16/test/generate_body.ts | 2 +- property_tests/tests/int16/test/test.ts | 3 +- .../tests/int32/test/generate_body.ts | 2 +- property_tests/tests/int32/test/test.ts | 3 +- .../tests/int64/test/generate_body.ts | 2 +- property_tests/tests/int64/test/test.ts | 3 +- .../tests/int8/test/generate_body.ts | 2 +- property_tests/tests/int8/test/test.ts | 3 +- .../tests/nat/test/generate_body.ts | 2 +- property_tests/tests/nat/test/test.ts | 3 +- .../tests/nat16/test/generate_body.ts | 2 +- property_tests/tests/nat16/test/test.ts | 3 +- .../tests/nat32/test/generate_body.ts | 2 +- property_tests/tests/nat32/test/test.ts | 3 +- .../tests/nat64/test/generate_body.ts | 2 +- property_tests/tests/nat64/test/test.ts | 3 +- .../tests/nat8/test/generate_body.ts | 2 +- property_tests/tests/nat8/test/test.ts | 3 +- .../tests/null/test/generate_body.ts | 2 +- property_tests/tests/null/test/test.ts | 3 +- .../tests/opt/test/generate_body.ts | 2 +- property_tests/tests/opt/test/test.ts | 3 +- .../tests/principal/test/generate_body.ts | 3 +- .../tests/principal/test/generate_tests.ts | 1 - property_tests/tests/principal/test/test.ts | 3 +- .../tests/record/test/generate_body.ts | 2 +- property_tests/tests/record/test/test.ts | 3 +- .../tests/recursive/test/generate_body.ts | 2 +- .../tests/recursive/test/generate_tests.ts | 2 +- property_tests/tests/recursive/test/test.ts | 3 +- .../tests/service/test/generate_body.ts | 3 +- .../tests/service/test/generate_tests.ts | 5 +- property_tests/tests/service/test/test.ts | 3 +- .../stable_b_tree_map/test/contains_key.ts | 7 +- .../tests/stable_b_tree_map/test/get.ts | 9 +-- .../tests/stable_b_tree_map/test/insert.ts | 9 +-- .../tests/stable_b_tree_map/test/is_empty.ts | 9 +-- .../tests/stable_b_tree_map/test/items.ts | 9 +-- .../tests/stable_b_tree_map/test/keys.ts | 10 +-- .../tests/stable_b_tree_map/test/len.ts | 9 +-- .../tests/stable_b_tree_map/test/remove.ts | 9 +-- .../tests/stable_b_tree_map/test/test.ts | 6 +- .../tests/stable_b_tree_map/test/values.ts | 10 +-- .../tests/text/test/generate_body.ts | 2 +- property_tests/tests/text/test/test.ts | 3 +- .../tests/tuple/test/generate_body.ts | 6 +- .../tests/tuple/test/generate_tests.ts | 4 +- property_tests/tests/tuple/test/test.ts | 3 +- .../tests/variant/test/generate_body.ts | 2 +- property_tests/tests/variant/test/test.ts | 3 +- .../tests/vec/test/generate_body.ts | 2 +- property_tests/tests/vec/test/test.ts | 3 +- scripts/hash_file/index.ts | 2 +- src/compiler/compile_typescript_code.ts | 3 +- src/compiler/file_uploader/expand_paths.ts | 3 +- .../file_uploader/incomplete_files.ts | 2 +- src/compiler/file_uploader/index.ts | 2 +- src/compiler/file_uploader/on_before_exit.ts | 2 +- src/compiler/file_uploader/upload_file.ts | 3 +- src/compiler/file_uploader/uploader_actor.ts | 1 + src/compiler/file_watcher/file_watcher.ts | 2 +- .../generate_candid_and_canister_methods.ts | 1 + src/compiler/get_names.ts | 2 +- src/compiler/handle_cli.ts | 4 +- src/compiler/index.ts | 4 +- src/compiler/utils/get_canister_config.ts | 2 +- src/compiler/utils/get_canister_name.ts | 4 +- src/lib/candid/candid_type.ts | 1 + .../candid/did_file/visitor/did_visitor.ts | 11 +-- src/lib/candid/did_file/visitor/visit/func.ts | 3 +- src/lib/candid/did_file/visitor/visit/opt.ts | 1 + .../did_file/visitor/visit/primitive.ts | 1 + .../candid/did_file/visitor/visit/record.ts | 1 + .../did_file/visitor/visit/recursive.ts | 1 + .../candid/did_file/visitor/visit/service.ts | 1 + .../candid/did_file/visitor/visit/tuple.ts | 1 + .../candid/did_file/visitor/visit/variant.ts | 1 + src/lib/candid/did_file/visitor/visit/vec.ts | 1 + src/lib/candid/recursive.ts | 3 +- src/lib/candid/serde/decode.ts | 4 +- src/lib/candid/serde/encode.ts | 4 +- .../candid/serde/visitors/decode_visitor.ts | 1 + .../candid/serde/visitors/encode_visitor.ts | 5 +- src/lib/candid/serde/visitors/visit/record.ts | 3 +- .../candid/serde/visitors/visit/recursive.ts | 3 +- src/lib/candid/serde/visitors/visit/tuple.ts | 3 +- .../visitors/visit/variant/azle_result.ts | 5 +- .../visitors/visit/variant/azle_variant.ts | 3 +- .../serde/visitors/visit/variant/index.ts | 5 +- src/lib/candid/serde/visitors/visit/vec.ts | 3 +- src/lib/candid/to_idl.ts | 1 + src/lib/candid/type_mapping.ts | 14 ++-- src/lib/candid/types/constructed/blob.ts | 3 +- src/lib/candid/types/constructed/opt.ts | 3 +- src/lib/candid/types/constructed/record.ts | 9 ++- .../candid/types/constructed/to_idl_map.ts | 1 + src/lib/candid/types/constructed/tuple.ts | 7 +- src/lib/candid/types/constructed/variant.ts | 7 +- src/lib/candid/types/constructed/vec.ts | 7 +- src/lib/candid/types/primitive/bool.ts | 3 +- src/lib/candid/types/primitive/empty.ts | 3 +- .../candid/types/primitive/floats/float32.ts | 3 +- .../candid/types/primitive/floats/float64.ts | 3 +- src/lib/candid/types/primitive/ints/index.ts | 2 +- src/lib/candid/types/primitive/ints/int.ts | 3 +- src/lib/candid/types/primitive/ints/int16.ts | 3 +- src/lib/candid/types/primitive/ints/int32.ts | 3 +- src/lib/candid/types/primitive/ints/int64.ts | 3 +- src/lib/candid/types/primitive/ints/int8.ts | 3 +- src/lib/candid/types/primitive/nats/nat.ts | 3 +- src/lib/candid/types/primitive/nats/nat16.ts | 3 +- src/lib/candid/types/primitive/nats/nat32.ts | 3 +- src/lib/candid/types/primitive/nats/nat64.ts | 3 +- src/lib/candid/types/primitive/nats/nat8.ts | 3 +- src/lib/candid/types/primitive/null.ts | 3 +- src/lib/candid/types/primitive/reserved.ts | 3 +- src/lib/candid/types/primitive/text.ts | 3 +- src/lib/candid/types/primitive/void.ts | 1 + src/lib/candid/types/reference/func.ts | 9 ++- src/lib/candid/types/reference/index.ts | 2 +- src/lib/candid/types/reference/principal.ts | 3 +- .../service/canister_function/index.ts | 9 ++- .../service/canister_function/query_update.ts | 2 +- .../canister_function/system_methods.ts | 3 +- src/lib/canister_methods/execute_method.ts | 4 +- src/lib/canister_methods/methods/heartbeat.ts | 4 +- src/lib/canister_methods/methods/init.ts | 2 +- .../methods/inspect_message.ts | 2 +- .../canister_methods/methods/post_upgrade.ts | 2 +- .../canister_methods/methods/pre_upgrade.ts | 2 +- src/lib/canister_methods/methods/query.ts | 4 +- src/lib/canister_methods/methods/update.ts | 4 +- src/lib/fetch/file.ts | 2 +- src/lib/fetch/http.ts | 4 +- src/lib/globals.ts | 9 ++- src/lib/ic/call_raw.ts | 3 +- src/lib/ic/call_raw_128.ts | 5 +- src/lib/ic/clear_timer.ts | 2 +- src/lib/ic/is_controller.ts | 2 +- src/lib/ic/notify_raw.ts | 6 +- src/lib/ic/reply.ts | 2 +- src/lib/ic/set_timer.ts | 7 +- src/lib/ic/set_timer_interval.ts | 5 +- src/lib/ic/stable_64_read.ts | 2 +- src/lib/ic/stable_read.ts | 2 +- src/lib/ic/stable_size.ts | 2 +- src/lib/ic/stable_write.ts | 4 +- src/lib/ic/types/duration.ts | 2 +- src/lib/ic/types/index.ts | 2 +- src/lib/ic/types/timer_id.ts | 2 +- src/lib/index.ts | 6 +- src/lib/server.ts | 11 +-- .../stable_structures/stable_b_tree_map.ts | 2 +- src/lib/stable_structures/stable_json.ts | 2 +- src/lib/system_types/result.ts | 3 +- src/lib/threshold_wallet/ecdsa_public_key.ts | 1 - src/lib/threshold_wallet/sign_with_ecdsa.ts | 1 - src/lib/threshold_wallet/wallet.ts | 4 +- 535 files changed, 1306 insertions(+), 1022 deletions(-) diff --git a/benchmark/index.ts b/benchmark/index.ts index 9d45cc4765..44de6f4a66 100644 --- a/benchmark/index.ts +++ b/benchmark/index.ts @@ -1,7 +1,8 @@ import { execSync } from 'child_process'; -import { create_csv_report } from './csv'; import { writeFileSync } from 'fs'; + import { nat64 } from '../src/lib'; +import { create_csv_report } from './csv'; import { create_markdown_report } from './markdown'; import { run_setup } from './setup'; diff --git a/benchmark/markdown.ts b/benchmark/markdown.ts index d4aef2f209..d505cd7235 100644 --- a/benchmark/markdown.ts +++ b/benchmark/markdown.ts @@ -1,6 +1,5 @@ import { BenchmarkResult, calculate_average } from './index'; import { get_usd_cost_estimates } from './usd'; -import { USDCostEstimates } from './usd/usd_cost_estimate'; import { USAGE_CONFIG_HEAVY_QUERY_HEAVY, USAGE_CONFIG_HEAVY_QUERY_UPDATE_EVEN, @@ -12,6 +11,7 @@ import { USAGE_CONFIG_MODERATE_QUERY_UPDATE_EVEN, USAGE_CONFIG_MODERATE_UPDATE_HEAVY } from './usd/usage_config'; +import { USDCostEstimates } from './usd/usd_cost_estimate'; export function create_markdown_report( benchmark_results: BenchmarkResult[], diff --git a/benchmark/usd/index.ts b/benchmark/usd/index.ts index 2e73b5f5b9..27cc0f4400 100644 --- a/benchmark/usd/index.ts +++ b/benchmark/usd/index.ts @@ -3,15 +3,15 @@ // TODO make this configurable per day, week, month, year etc? Or is just per year sufficient? import { - USAGE_CONFIG_LIGHT_QUERY_UPDATE_EVEN, + USAGE_CONFIG_HEAVY_QUERY_HEAVY, + USAGE_CONFIG_HEAVY_QUERY_UPDATE_EVEN, + USAGE_CONFIG_HEAVY_UPDATE_HEAVY, USAGE_CONFIG_LIGHT_QUERY_HEAVY, + USAGE_CONFIG_LIGHT_QUERY_UPDATE_EVEN, USAGE_CONFIG_LIGHT_UPDATE_HEAVY, - USAGE_CONFIG_MODERATE_QUERY_UPDATE_EVEN, USAGE_CONFIG_MODERATE_QUERY_HEAVY, - USAGE_CONFIG_MODERATE_UPDATE_HEAVY, - USAGE_CONFIG_HEAVY_QUERY_UPDATE_EVEN, - USAGE_CONFIG_HEAVY_QUERY_HEAVY, - USAGE_CONFIG_HEAVY_UPDATE_HEAVY + USAGE_CONFIG_MODERATE_QUERY_UPDATE_EVEN, + USAGE_CONFIG_MODERATE_UPDATE_HEAVY } from './usage_config'; import { get_usd_cost_estimate, USDCostEstimates } from './usd_cost_estimate'; diff --git a/canisters/icrc/icrc_2.ts b/canisters/icrc/icrc_2.ts index c6b23e9f21..97d1fdee6a 100644 --- a/canisters/icrc/icrc_2.ts +++ b/canisters/icrc/icrc_2.ts @@ -1,11 +1,10 @@ import { blob, nat, nat64, Null, Opt, Record, Variant } from '../../src/lib'; - import { - BadFee, BadBurn, - InsufficientFunds, + BadFee, Duplicate, - GenericError + GenericError, + InsufficientFunds } from './errors'; import { Account, CreatedInFuture } from './icrc_1'; diff --git a/canisters/icrc/index.ts b/canisters/icrc/index.ts index 7461e07f90..f601c93298 100644 --- a/canisters/icrc/index.ts +++ b/canisters/icrc/index.ts @@ -3,11 +3,11 @@ import { nat, nat8, Opt, - Record, query, - update, + Record, text, Tuple, + update, Vec } from '../../src/lib'; import { Account, TransferArgs, TransferResult, Value } from './icrc_1'; diff --git a/canisters/ledger/address/index.ts b/canisters/ledger/address/index.ts index bacf8d980f..c2675aacb7 100755 --- a/canisters/ledger/address/index.ts +++ b/canisters/ledger/address/index.ts @@ -1,6 +1,7 @@ -import { blob, Principal } from '../../../src/lib'; import { getCrc32 } from '@dfinity/principal/lib/esm/utils/getCrc'; import { sha224 } from 'js-sha256'; + +import { blob, Principal } from '../../../src/lib'; import { Address } from '../index'; // TODO we need to review these heavily diff --git a/canisters/ledger/index.ts b/canisters/ledger/index.ts index 0a221dad3a..4f34643073 100644 --- a/canisters/ledger/index.ts +++ b/canisters/ledger/index.ts @@ -9,21 +9,21 @@ import { blob, Canister, + Func, nat, nat8, nat32, nat64, Null, Opt, - Record, + Principal, query, - update, + Record, text, Tuple, + update, Variant, - Vec, - Principal, - Func + Vec } from '../../src/lib'; import * as icrc from '../icrc'; diff --git a/canisters/management/canister_info.ts b/canisters/management/canister_info.ts index 472b3c6934..c14ee55bf1 100644 --- a/canisters/management/canister_info.ts +++ b/canisters/management/canister_info.ts @@ -5,14 +5,14 @@ // Some documentation changed from original work. import { - Record, + nat8, + nat64, + Null, Opt, - Vec, Principal, + Record, Variant, - nat64, - nat8, - Null + Vec } from '../../src/lib'; import { managementCanister } from '.'; diff --git a/canisters/management/canister_management.ts b/canisters/management/canister_management.ts index 3fa3260f47..c1c2b8e5e9 100644 --- a/canisters/management/canister_management.ts +++ b/canisters/management/canister_management.ts @@ -1,13 +1,13 @@ import { - Record, + blob, + nat, + nat64, + Null, Opt, - Vec, Principal, - nat, + Record, Variant, - Null, - blob, - nat64 + Vec } from '../../src/lib'; export const CanisterId = Principal; diff --git a/canisters/management/http_request.ts b/canisters/management/http_request.ts index 659a08fcd1..6e0dbedfd7 100644 --- a/canisters/management/http_request.ts +++ b/canisters/management/http_request.ts @@ -1,14 +1,14 @@ import { blob, - Record, + Func, + nat, + nat64, + Null, Opt, - Vec, - Variant, + Record, text, - Null, - nat64, - nat, - Func + Variant, + Vec } from '../../src/lib'; export const HttpHeader = Record({ diff --git a/dfx/index.ts b/dfx/index.ts index 6eeb7510dc..dff4c7d2c2 100644 --- a/dfx/index.ts +++ b/dfx/index.ts @@ -1,6 +1,6 @@ -import { execSync } from 'child_process'; -import { Secp256k1KeyIdentity } from '@dfinity/identity-secp256k1'; import { HttpAgent } from '@dfinity/agent'; +import { Secp256k1KeyIdentity } from '@dfinity/identity-secp256k1'; +import { execSync } from 'child_process'; export function getCanisterId(canisterName: string): string { return execSync( diff --git a/examples/apollo_server/test/test.ts b/examples/apollo_server/test/test.ts index ca162ce922..c39221986e 100644 --- a/examples/apollo_server/test/test.ts +++ b/examples/apollo_server/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { getTests } from './tests'; const canisterId = getCanisterId('apollo_server'); diff --git a/examples/async_await/test/test.ts b/examples/async_await/test/test.ts index 5d39f95ef0..748b5561cb 100644 --- a/examples/async_await/test/test.ts +++ b/examples/async_await/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/async_await'; import { get_tests } from './tests'; diff --git a/examples/async_await/test/tests.ts b/examples/async_await/test/tests.ts index 2911c4299a..baa4fb7b54 100644 --- a/examples/async_await/test/tests.ts +++ b/examples/async_await/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/async_await/async_await.did'; -import { ActorSubclass } from '@dfinity/agent'; export function get_tests( async_await_canister: ActorSubclass<_SERVICE> diff --git a/examples/audio_and_video/test/test.ts b/examples/audio_and_video/test/test.ts index c76a4af1f7..bd945d95c7 100644 --- a/examples/audio_and_video/test/test.ts +++ b/examples/audio_and_video/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { getTests } from './tests'; const canisterId = getCanisterId('backend'); diff --git a/examples/audio_recorder/src/index.ts b/examples/audio_recorder/src/index.ts index d80788a69d..b370c702fd 100644 --- a/examples/audio_recorder/src/index.ts +++ b/examples/audio_recorder/src/index.ts @@ -1,8 +1,8 @@ import { blob, Canister, - ic, Err, + ic, nat64, Ok, Opt, diff --git a/examples/audio_recorder/test/test.ts b/examples/audio_recorder/test/test.ts index eba4db5eb1..8287c52d31 100644 --- a/examples/audio_recorder/test/test.ts +++ b/examples/audio_recorder/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../test/dfx_generated/audio_recorder'; import { get_tests } from './tests'; diff --git a/examples/audio_recorder/test/tests.ts b/examples/audio_recorder/test/tests.ts index 5c1a9309b4..f891f1d411 100644 --- a/examples/audio_recorder/test/tests.ts +++ b/examples/audio_recorder/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { ok, Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/audio_recorder/audio_recorder.did'; -import { ActorSubclass } from '@dfinity/agent'; // TODO to be more thorough we could test all of the error cases as well diff --git a/examples/autoreload/test/pretest.ts b/examples/autoreload/test/pretest.ts index 590398e8c0..e36e160a66 100644 --- a/examples/autoreload/test/pretest.ts +++ b/examples/autoreload/test/pretest.ts @@ -1,5 +1,6 @@ import { execSync } from 'child_process'; import { writeFileSync } from 'fs'; + import { originalServerTs } from './tests'; async function pretest() { diff --git a/examples/autoreload/test/test.ts b/examples/autoreload/test/test.ts index 37d383b834..3c54d7f29e 100644 --- a/examples/autoreload/test/test.ts +++ b/examples/autoreload/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { getTests } from './tests'; const canisterId = getCanisterId('autoreload'); diff --git a/examples/basic_bitcoin/src/bitcoin_api.ts b/examples/basic_bitcoin/src/bitcoin_api.ts index cdfbbf1142..6697e3a8ee 100644 --- a/examples/basic_bitcoin/src/bitcoin_api.ts +++ b/examples/basic_bitcoin/src/bitcoin_api.ts @@ -1,12 +1,12 @@ // @ts-nocheck import { blob, ic, match, nat64, Opt, Vec } from 'azle'; +import { managementCanister } from 'azle/canisters/management'; import { BitcoinNetwork, GetUtxosResult, MillisatoshiPerByte } from 'azle/canisters/management/bitcoin'; -import { managementCanister } from 'azle/canisters/management'; // The fees for the various bitcoin endpoints. const GET_BALANCE_COST_CYCLES: nat64 = 100_000_000n; diff --git a/examples/basic_bitcoin/src/bitcoin_wallet.ts b/examples/basic_bitcoin/src/bitcoin_wallet.ts index 36d9835448..4a0658c29f 100644 --- a/examples/basic_bitcoin/src/bitcoin_wallet.ts +++ b/examples/basic_bitcoin/src/bitcoin_wallet.ts @@ -9,7 +9,7 @@ //! * Support for address types that aren't P2PKH. //! * Caching spent UTXOs so that they are not reused in future transactions. //! * Option to set the fee. -import { blob, ic, nat64, match, Result, Vec } from 'azle'; +import { blob, ic, match, nat64, Result, Vec } from 'azle'; import { BitcoinNetwork, MillisatoshiPerByte, diff --git a/examples/basic_bitcoin/src/index.ts b/examples/basic_bitcoin/src/index.ts index a776d9c87c..0e0fceda3f 100644 --- a/examples/basic_bitcoin/src/index.ts +++ b/examples/basic_bitcoin/src/index.ts @@ -1,6 +1,6 @@ // @ts-nocheck -import { blob, $init, match, nat64, $postUpgrade, $update, Vec } from 'azle'; +import { $init, $postUpgrade, $update, blob, match, nat64, Vec } from 'azle'; import { BitcoinNetwork, GetUtxosResult, diff --git a/examples/bitcoin/test/setup.ts b/examples/bitcoin/test/setup.ts index 00fef8e7b7..88de8e724f 100644 --- a/examples/bitcoin/test/setup.ts +++ b/examples/bitcoin/test/setup.ts @@ -3,8 +3,8 @@ import { ChildProcessWithoutNullStreams, execSync, spawn } from 'child_process'; import { existsSync, rmSync } from 'fs-extra'; import { bitcoinCli, TxInput, TxOutputs, Utxo } from './bitcoin_cli'; -import { Wallets } from './wallets'; import { State } from './test'; +import { Wallets } from './wallets'; /** * Performs preparatory work to get the bitcoin network into a testable state. diff --git a/examples/bitcoin/test/test.ts b/examples/bitcoin/test/test.ts index 0cf90a6b51..f0e1b20e59 100644 --- a/examples/bitcoin/test/test.ts +++ b/examples/bitcoin/test/test.ts @@ -1,9 +1,10 @@ -import { runTests, Test } from 'azle/test'; import { getCanisterId } from 'azle/dfx'; +import { runTests, Test } from 'azle/test'; + +import { bitcoinCli } from './bitcoin_cli'; import { createActor } from './dfx_generated/bitcoin'; -import { wallets } from './wallets'; import { impureSetup, whileRunningBitcoinDaemon } from './setup'; -import { bitcoinCli } from './bitcoin_cli'; +import { wallets } from './wallets'; const bitcoinCanister = createActor(getCanisterId('bitcoin'), { agentOptions: { diff --git a/examples/bitcoin/test/tests.ts b/examples/bitcoin/test/tests.ts index 646e3970c2..caaa63bda4 100644 --- a/examples/bitcoin/test/tests.ts +++ b/examples/bitcoin/test/tests.ts @@ -1,4 +1,5 @@ import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/bitcoin/bitcoin.did'; // import { ActorSubclass } from '@dfinity/agent'; diff --git a/examples/blob_array/test/test.ts b/examples/blob_array/test/test.ts index ce90f35d06..2f4a1baecc 100644 --- a/examples/blob_array/test/test.ts +++ b/examples/blob_array/test/test.ts @@ -1,5 +1,6 @@ -import { runTests } from 'azle/test'; import { getCanisterId } from 'azle/dfx'; +import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/blob_array'; import { get_tests } from './tests'; diff --git a/examples/blob_array/test/tests.ts b/examples/blob_array/test/tests.ts index e1dcc02cb0..19ed6283a9 100644 --- a/examples/blob_array/test/tests.ts +++ b/examples/blob_array/test/tests.ts @@ -1,5 +1,6 @@ import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/blob_array/blob_array.did'; const HELLO_BYTES = Uint8Array.from([104, 101, 108, 108, 111]); diff --git a/examples/bytes/test/test.ts b/examples/bytes/test/test.ts index 958d14ee3b..519bf852be 100644 --- a/examples/bytes/test/test.ts +++ b/examples/bytes/test/test.ts @@ -1,5 +1,6 @@ -import { runTests } from 'azle/test'; import { getCanisterId } from 'azle/dfx'; +import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/bytes_canister'; import { get_tests } from './tests'; diff --git a/examples/bytes/test/tests.ts b/examples/bytes/test/tests.ts index fa826fbcd0..62265a8cf7 100644 --- a/examples/bytes/test/tests.ts +++ b/examples/bytes/test/tests.ts @@ -1,8 +1,9 @@ import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; -import { _SERVICE } from './dfx_generated/bytes_canister/bytes_canister.did.d'; import { readFileSync } from 'fs'; +import { _SERVICE } from './dfx_generated/bytes_canister/bytes_canister.did.d'; + export function get_tests(bytes_canister: ActorSubclass<_SERVICE>): Test[] { return [ { diff --git a/examples/call_raw/src/index.ts b/examples/call_raw/src/index.ts index e0f259d346..7f8ecd317b 100644 --- a/examples/call_raw/src/index.ts +++ b/examples/call_raw/src/index.ts @@ -1,9 +1,9 @@ import { Canister, ic, - Ok, nat, nat64, + Ok, Principal, Result, text, diff --git a/examples/call_raw/test/test.ts b/examples/call_raw/test/test.ts index 04d36d0544..68e9cb2d94 100644 --- a/examples/call_raw/test/test.ts +++ b/examples/call_raw/test/test.ts @@ -1,5 +1,6 @@ -import { runTests } from 'azle/test'; import { getCanisterId } from 'azle/dfx'; +import { runTests } from 'azle/test'; + import { createActor } from '../test/dfx_generated/call_raw'; import { get_tests } from './tests'; diff --git a/examples/call_raw/test/tests.ts b/examples/call_raw/test/tests.ts index 88ead08218..9f1210bdfe 100644 --- a/examples/call_raw/test/tests.ts +++ b/examples/call_raw/test/tests.ts @@ -1,7 +1,8 @@ -import { ok, Test } from 'azle/test'; -import { _SERVICE } from './dfx_generated/call_raw/call_raw.did'; import { ActorSubclass } from '@dfinity/agent'; import { Principal } from '@dfinity/principal'; +import { ok, Test } from 'azle/test'; + +import { _SERVICE } from './dfx_generated/call_raw/call_raw.did'; export function get_tests(call_raw_canister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/candid_encoding/test/test.ts b/examples/candid_encoding/test/test.ts index e8424e2c44..8fc718da01 100644 --- a/examples/candid_encoding/test/test.ts +++ b/examples/candid_encoding/test/test.ts @@ -1,5 +1,6 @@ -import { runTests } from 'azle/test'; import { getCanisterId } from 'azle/dfx'; +import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/candid_encoding'; import { get_tests } from './tests'; diff --git a/examples/candid_encoding/test/tests.ts b/examples/candid_encoding/test/tests.ts index 88e5acfe86..7be9470f14 100644 --- a/examples/candid_encoding/test/tests.ts +++ b/examples/candid_encoding/test/tests.ts @@ -1,6 +1,7 @@ import { ActorSubclass } from '@dfinity/agent'; import { AzleResult, ok, Test } from 'azle/test'; import { execSync } from 'child_process'; + import { _SERVICE } from './dfx_generated/candid_encoding/candid_encoding.did'; export function get_tests( diff --git a/examples/candid_keywords/src/index.ts b/examples/candid_keywords/src/index.ts index 66cd26dd25..a4a2e92f29 100644 --- a/examples/candid_keywords/src/index.ts +++ b/examples/candid_keywords/src/index.ts @@ -6,15 +6,15 @@ import { float64, Func, int, + int8, int16, int32, int64, - int8, nat, + nat8, nat16, nat32, nat64, - nat8, None, Null, Opt, diff --git a/examples/candid_keywords/test/test.ts b/examples/candid_keywords/test/test.ts index 69d4d5abff..9a644c1ebc 100644 --- a/examples/candid_keywords/test/test.ts +++ b/examples/candid_keywords/test/test.ts @@ -1,5 +1,6 @@ -import { runTests } from 'azle/test'; import { getCanisterId } from 'azle/dfx'; +import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/candid_keywords'; import { getTests } from './tests'; diff --git a/examples/candid_keywords/test/tests.ts b/examples/candid_keywords/test/tests.ts index d67a9ce728..289fde06c1 100644 --- a/examples/candid_keywords/test/tests.ts +++ b/examples/candid_keywords/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/candid_keywords/candid_keywords.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests(candid_canister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/canister/src/index.ts b/examples/canister/src/index.ts index 4c6cc631ee..18f894ea0c 100644 --- a/examples/canister/src/index.ts +++ b/examples/canister/src/index.ts @@ -9,6 +9,7 @@ import { update, Vec } from 'azle'; + import SomeCanister from './some_canister'; const Wrapper = Record({ diff --git a/examples/canister/test/pretest.ts b/examples/canister/test/pretest.ts index 288d33d7ba..7d5d433c2a 100644 --- a/examples/canister/test/pretest.ts +++ b/examples/canister/test/pretest.ts @@ -1,5 +1,5 @@ -import { execSync } from 'child_process'; import { getCanisterId } from 'azle/dfx'; +import { execSync } from 'child_process'; async function pretest() { execSync(`dfx canister uninstall-code canister || true`, { diff --git a/examples/canister/test/test.ts b/examples/canister/test/test.ts index d342a8cce0..6b2458e4fb 100644 --- a/examples/canister/test/test.ts +++ b/examples/canister/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/canister'; import { getTests } from './tests'; diff --git a/examples/canister/test/tests.ts b/examples/canister/test/tests.ts index 842b7d8a0b..dd6881c3d7 100644 --- a/examples/canister/test/tests.ts +++ b/examples/canister/test/tests.ts @@ -1,8 +1,9 @@ +import { ActorSubclass } from '@dfinity/agent'; +import { Principal } from '@dfinity/principal'; import { getCanisterId } from 'azle/dfx'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/canister/canister.did'; -import { ActorSubclass } from '@dfinity/agent'; -import { Principal } from '@dfinity/principal'; export function getTests(canister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/ckbtc/test/tests.ts b/examples/ckbtc/test/tests.ts index 77e006aab5..f2da3a29df 100644 --- a/examples/ckbtc/test/tests.ts +++ b/examples/ckbtc/test/tests.ts @@ -1,15 +1,14 @@ -import { execSync } from 'child_process'; import { ActorSubclass } from '@dfinity/agent'; -import { AzleResult, Test } from 'azle/test'; import { Identity } from '@dfinity/agent'; import { Ed25519KeyIdentity } from '@dfinity/identity'; import { getCanisterId } from 'azle/dfx'; - -// @ts-ignore -import { _SERVICE } from '../wallet/frontend/dfx_generated/wallet_backend/wallet_backend.did'; +import { AzleResult, Test } from 'azle/test'; +import { execSync } from 'child_process'; // @ts-ignore import { createActor } from '../wallet/frontend/dfx_generated/wallet_backend'; +// @ts-ignore +import { _SERVICE } from '../wallet/frontend/dfx_generated/wallet_backend/wallet_backend.did'; type Config = { identity: Identity; diff --git a/examples/ckbtc/wallet/backend/index.ts b/examples/ckbtc/wallet/backend/index.ts index b98569061e..1d01431f6c 100644 --- a/examples/ckbtc/wallet/backend/index.ts +++ b/examples/ckbtc/wallet/backend/index.ts @@ -2,18 +2,18 @@ // better using the latest Wasm and did that I know of import { - Canister, - None, - Principal, - Result, - Some, blob, + Canister, ic, init, nat, nat64, + None, postUpgrade, + Principal, + Result, serialize, + Some, text, update } from 'azle'; diff --git a/examples/ckbtc/wallet/backend/minter.ts b/examples/ckbtc/wallet/backend/minter.ts index d6b46d1cfa..d0c7eca90a 100644 --- a/examples/ckbtc/wallet/backend/minter.ts +++ b/examples/ckbtc/wallet/backend/minter.ts @@ -1,18 +1,18 @@ import { + blob, Canister, + nat8, + nat32, + nat64, Null, Opt, Principal, Record, Result, - Variant, - Vec, - blob, - nat32, - nat64, - nat8, text, - update + update, + Variant, + Vec } from 'azle'; const Utxo = Record({ diff --git a/examples/ckbtc/wallet/frontend/elements/ck-app.ts b/examples/ckbtc/wallet/frontend/elements/ck-app.ts index 4ab02c9c87..e4c84bba33 100644 --- a/examples/ckbtc/wallet/frontend/elements/ck-app.ts +++ b/examples/ckbtc/wallet/frontend/elements/ck-app.ts @@ -1,12 +1,13 @@ // @ts-nocheck -import { LitElement, html } from 'lit'; -import { customElement, state } from 'lit/decorators.js'; -import { AuthClient } from '@dfinity/auth-client'; import { ActorSubclass, HttpAgent, Identity } from '@dfinity/agent'; +import { AuthClient } from '@dfinity/auth-client'; +import { nat, nat64 } from 'azle'; +import { html, LitElement } from 'lit'; +import { customElement, state } from 'lit/decorators.js'; + import { createActor } from '../dfx_generated/wallet_backend'; import { _SERVICE } from '../dfx_generated/wallet_backend/wallet_backend.did'; -import { nat, nat64 } from 'azle'; @customElement('ck-app') export class CkApp extends LitElement { diff --git a/examples/ckbtc/wallet/frontend/wallet/frontend/dfx_generate/wallet_backend/index.d.ts b/examples/ckbtc/wallet/frontend/wallet/frontend/dfx_generate/wallet_backend/index.d.ts index cf09a9cf34..76bf83dcbb 100644 --- a/examples/ckbtc/wallet/frontend/wallet/frontend/dfx_generate/wallet_backend/index.d.ts +++ b/examples/ckbtc/wallet/frontend/wallet/frontend/dfx_generate/wallet_backend/index.d.ts @@ -1,11 +1,11 @@ import type { - ActorSubclass, - HttpAgentOptions, ActorConfig, - Agent + ActorSubclass, + Agent, + HttpAgentOptions } from '@dfinity/agent'; -import type { Principal } from '@dfinity/principal'; import type { IDL } from '@dfinity/candid'; +import type { Principal } from '@dfinity/principal'; import { _SERVICE } from './wallet_backend.did'; diff --git a/examples/ckbtc/wallet/frontend/wallet/frontend/dfx_generate/wallet_backend/wallet_backend.did.d.ts b/examples/ckbtc/wallet/frontend/wallet/frontend/dfx_generate/wallet_backend/wallet_backend.did.d.ts index c425359d56..94107b0f04 100644 --- a/examples/ckbtc/wallet/frontend/wallet/frontend/dfx_generate/wallet_backend/wallet_backend.did.d.ts +++ b/examples/ckbtc/wallet/frontend/wallet/frontend/dfx_generate/wallet_backend/wallet_backend.did.d.ts @@ -1,5 +1,5 @@ -import type { Principal } from '@dfinity/principal'; import type { ActorMethod } from '@dfinity/agent'; +import type { Principal } from '@dfinity/principal'; export type ManualReply = | { Ok: Array } diff --git a/examples/complex_init/src/rec_init/index.ts b/examples/complex_init/src/rec_init/index.ts index f889a630c7..608fcb78a2 100644 --- a/examples/complex_init/src/rec_init/index.ts +++ b/examples/complex_init/src/rec_init/index.ts @@ -1,4 +1,4 @@ -import { Canister, init, Null, query, Recursive, Variant, nat } from 'azle'; +import { Canister, init, nat, Null, query, Recursive, Variant } from 'azle'; const Node = Recursive(() => Variant({ diff --git a/examples/complex_init/test/test.ts b/examples/complex_init/test/test.ts index ea6558ea58..1a638fd3c4 100644 --- a/examples/complex_init/test/test.ts +++ b/examples/complex_init/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor as createComplexActor } from '../test/dfx_generated/complex_init'; // @ts-ignore import { createActor as createRecActor } from '../test/dfx_generated/rec_init'; diff --git a/examples/complex_init/test/tests.ts b/examples/complex_init/test/tests.ts index da1ac55ecb..624def4565 100644 --- a/examples/complex_init/test/tests.ts +++ b/examples/complex_init/test/tests.ts @@ -1,5 +1,6 @@ import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE as _COMPLEX_SERVICE } from './dfx_generated/complex_init/complex_init.did'; // @ts-ignore import { _SERVICE as _REC_SERVICE } from './dfx_generated/rec_init/rec_init.did'; diff --git a/examples/complex_types/src/candid_types.ts b/examples/complex_types/src/candid_types.ts index 5dfcf1df11..3989a044eb 100644 --- a/examples/complex_types/src/candid_types.ts +++ b/examples/complex_types/src/candid_types.ts @@ -1,4 +1,4 @@ -import { Record, Null, text, Variant, Vec, Recursive } from 'azle'; +import { Null, Record, Recursive, text, Variant, Vec } from 'azle'; export const ReactionType = Variant({ Fire: Null, diff --git a/examples/complex_types/src/index.ts b/examples/complex_types/src/index.ts index e6fcf675f6..5ed9accc49 100644 --- a/examples/complex_types/src/index.ts +++ b/examples/complex_types/src/index.ts @@ -1,4 +1,5 @@ import { Canister } from 'azle'; + import { createPost, getAllPosts } from './posts'; import { createReaction, getAllReactions } from './reactions'; import { createThread, getAllThreads } from './threads'; diff --git a/examples/complex_types/src/posts.ts b/examples/complex_types/src/posts.ts index 22da24640f..6a1b646f3b 100644 --- a/examples/complex_types/src/posts.ts +++ b/examples/complex_types/src/posts.ts @@ -1,4 +1,5 @@ import { nat32, query, text, update, Vec } from 'azle'; + import { Post } from './candid_types'; import { getReactionFromStateReaction } from './reactions'; import { state, StatePost, StateThread, StateUser } from './state'; diff --git a/examples/complex_types/src/reactions.ts b/examples/complex_types/src/reactions.ts index 7cb89d725a..04039d31cd 100644 --- a/examples/complex_types/src/reactions.ts +++ b/examples/complex_types/src/reactions.ts @@ -1,4 +1,5 @@ import { nat32, query, text, update, Vec } from 'azle'; + import { Reaction, ReactionType } from './candid_types'; import { getPostFromStatePost } from './posts'; import { state, StatePost, StateReaction, StateUser } from './state'; diff --git a/examples/complex_types/src/state.ts b/examples/complex_types/src/state.ts index 991664c87c..02697ace2c 100644 --- a/examples/complex_types/src/state.ts +++ b/examples/complex_types/src/state.ts @@ -1,4 +1,5 @@ import { Vec } from 'azle'; + import { ReactionType } from './candid_types'; // TODO this state should go on the class diff --git a/examples/complex_types/src/threads.ts b/examples/complex_types/src/threads.ts index e72ed1eb55..47dae03a89 100644 --- a/examples/complex_types/src/threads.ts +++ b/examples/complex_types/src/threads.ts @@ -1,4 +1,5 @@ import { nat32, query, text, update, Vec } from 'azle'; + import { Thread } from './candid_types'; import { getPostFromStatePost } from './posts'; import { state, StateThread, StateUser } from './state'; diff --git a/examples/complex_types/src/users.ts b/examples/complex_types/src/users.ts index fbcd2d92cc..ceca648330 100644 --- a/examples/complex_types/src/users.ts +++ b/examples/complex_types/src/users.ts @@ -1,4 +1,5 @@ import { nat32, query, text, update, Vec } from 'azle'; + import { User } from './candid_types'; import { getPostFromStatePost } from './posts'; import { getReactionFromStateReaction } from './reactions'; diff --git a/examples/complex_types/test/test.ts b/examples/complex_types/test/test.ts index f9c192872e..b1423b50b2 100644 --- a/examples/complex_types/test/test.ts +++ b/examples/complex_types/test/test.ts @@ -2,6 +2,7 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../test/dfx_generated/complex_types'; import { get_tests } from './tests'; diff --git a/examples/complex_types/test/tests.ts b/examples/complex_types/test/tests.ts index 4c9c1550b7..ff67ed36e2 100644 --- a/examples/complex_types/test/tests.ts +++ b/examples/complex_types/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/complex_types/complex_types.did.d'; -import { ActorSubclass } from '@dfinity/agent'; export function get_tests( complex_types_canister: ActorSubclass<_SERVICE> diff --git a/examples/composite_queries/src/canister1/index.ts b/examples/composite_queries/src/canister1/index.ts index e19ee9b17b..0917c40603 100644 --- a/examples/composite_queries/src/canister1/index.ts +++ b/examples/composite_queries/src/canister1/index.ts @@ -10,6 +10,7 @@ import { text, update } from 'azle'; + import Canister2 from '../canister2'; let canister2: typeof Canister2; diff --git a/examples/composite_queries/src/canister2/index.ts b/examples/composite_queries/src/canister2/index.ts index 31a156e205..255e38ae6e 100644 --- a/examples/composite_queries/src/canister2/index.ts +++ b/examples/composite_queries/src/canister2/index.ts @@ -10,6 +10,7 @@ import { text, update } from 'azle'; + import Canister3 from '../canister3'; let canister3: typeof Canister3; diff --git a/examples/composite_queries/test/test.ts b/examples/composite_queries/test/test.ts index f2f28f9914..cf0ba9b757 100644 --- a/examples/composite_queries/test/test.ts +++ b/examples/composite_queries/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/canister1'; import { get_tests } from './tests'; diff --git a/examples/composite_queries/test/tests.ts b/examples/composite_queries/test/tests.ts index 9cb1b8a9f5..c31ebc0a5c 100644 --- a/examples/composite_queries/test/tests.ts +++ b/examples/composite_queries/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { getCanisterId } from 'azle/dfx'; import { Test } from 'azle/test'; -import { ActorSubclass } from '@dfinity/agent'; + import { _SERVICE } from './dfx_generated/canister1/canister1.did'; export function get_tests(canister1: ActorSubclass<_SERVICE>): Test[] { diff --git a/examples/counter/test/test.ts b/examples/counter/test/test.ts index 8bf99247e9..ebb0ea61d0 100644 --- a/examples/counter/test/test.ts +++ b/examples/counter/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../test/dfx_generated/counter'; import { get_tests } from './tests'; diff --git a/examples/counter/test/tests.ts b/examples/counter/test/tests.ts index e78f9d270b..b7e4e11177 100644 --- a/examples/counter/test/tests.ts +++ b/examples/counter/test/tests.ts @@ -1,5 +1,6 @@ import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/counter/counter.did'; export function get_tests(counter_canister: ActorSubclass<_SERVICE>): Test[] { diff --git a/examples/cross_canister_calls/src/canister1/index.ts b/examples/cross_canister_calls/src/canister1/index.ts index c19577a2ba..4584bf9709 100644 --- a/examples/cross_canister_calls/src/canister1/index.ts +++ b/examples/cross_canister_calls/src/canister1/index.ts @@ -13,6 +13,7 @@ import { Vec, Void } from 'azle'; + import Canister2 from '../canister2'; import { Account, AccountArgs } from '../canister2/types'; diff --git a/examples/cross_canister_calls/src/canister2/index.ts b/examples/cross_canister_calls/src/canister2/index.ts index 74bc2605c6..d56c0132fa 100644 --- a/examples/cross_canister_calls/src/canister2/index.ts +++ b/examples/cross_canister_calls/src/canister2/index.ts @@ -11,7 +11,8 @@ import { Vec, Void } from 'azle'; -import { State, Account, AccountArgs } from './types'; + +import { Account, AccountArgs, State } from './types'; let state: State = { accounts: { diff --git a/examples/cross_canister_calls/test/test.ts b/examples/cross_canister_calls/test/test.ts index 7e8340e503..ace71ea8ab 100644 --- a/examples/cross_canister_calls/test/test.ts +++ b/examples/cross_canister_calls/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor as createActorCanister1 } from './dfx_generated/canister1'; import { createActor as createActorCanister2 } from './dfx_generated/canister2'; import { get_tests } from './tests'; diff --git a/examples/cross_canister_calls/test/tests.ts b/examples/cross_canister_calls/test/tests.ts index cb71fa8421..e58e38b28e 100644 --- a/examples/cross_canister_calls/test/tests.ts +++ b/examples/cross_canister_calls/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE as CANISTER1_SERVICE } from './dfx_generated/canister1/canister1.did'; import { _SERVICE as CANISTER2_SERVICE } from './dfx_generated/canister2/canister2.did'; -import { ActorSubclass } from '@dfinity/agent'; export function get_tests( canister1: ActorSubclass, diff --git a/examples/cycles/src/intermediary/index.ts b/examples/cycles/src/intermediary/index.ts index 787bbcabed..43e89437f2 100644 --- a/examples/cycles/src/intermediary/index.ts +++ b/examples/cycles/src/intermediary/index.ts @@ -10,6 +10,7 @@ import { update, Void } from 'azle'; + import Cycles from '../cycles'; let cyclesCanister: typeof Cycles; diff --git a/examples/cycles/test/test.ts b/examples/cycles/test/test.ts index 927e94cf62..52e5113d99 100644 --- a/examples/cycles/test/test.ts +++ b/examples/cycles/test/test.ts @@ -2,6 +2,7 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor as createCyclesActor } from './dfx_generated/cycles'; import { createActor as createIntermediaryActor } from './dfx_generated/intermediary'; import { getTests } from './tests'; diff --git a/examples/cycles/test/tests.ts b/examples/cycles/test/tests.ts index 0a035ae622..c3d46ccf8a 100644 --- a/examples/cycles/test/tests.ts +++ b/examples/cycles/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE as CYCLESCANISTERSERVICE } from './dfx_generated/cycles/cycles.did'; import { _SERVICE as INTERMEDIARYCANISTERSERVICE } from './dfx_generated/intermediary/intermediary.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests( cyclesCanister: ActorSubclass, diff --git a/examples/date/test/test.ts b/examples/date/test/test.ts index ff02bda8cc..085d2e0a5f 100644 --- a/examples/date/test/test.ts +++ b/examples/date/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/date'; import { getTests } from './tests'; diff --git a/examples/date/test/tests.ts b/examples/date/test/tests.ts index 734573dd57..c0cc4fe27b 100644 --- a/examples/date/test/tests.ts +++ b/examples/date/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/date/date.did.d'; -import { ActorSubclass } from '@dfinity/agent'; // NOTE: The IC has not concept of a timezone since it's a world computer. It // uses UTC so getUTCDate and getDate will be the same. So when comparing times diff --git a/examples/ethereum_json_rpc/test/test.ts b/examples/ethereum_json_rpc/test/test.ts index 2d2dbb3fed..4b40273a6a 100644 --- a/examples/ethereum_json_rpc/test/test.ts +++ b/examples/ethereum_json_rpc/test/test.ts @@ -2,6 +2,7 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/ethereum_json_rpc'; import { getTests } from './tests'; diff --git a/examples/ethereum_json_rpc/test/tests.ts b/examples/ethereum_json_rpc/test/tests.ts index 4fadadd558..da0b25fb6d 100644 --- a/examples/ethereum_json_rpc/test/tests.ts +++ b/examples/ethereum_json_rpc/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/ethereum_json_rpc/ethereum_json_rpc.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests( ethereumJsonRpcCanister: ActorSubclass<_SERVICE> diff --git a/examples/ethers/test/test.ts b/examples/ethers/test/test.ts index b8c6ed55f6..eeb3cf7726 100644 --- a/examples/ethers/test/test.ts +++ b/examples/ethers/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { getTests } from './tests'; const canisterId = getCanisterId('ethers'); diff --git a/examples/ethers_base/test/test.ts b/examples/ethers_base/test/test.ts index 74a1a5fafd..0a8b49527f 100644 --- a/examples/ethers_base/test/test.ts +++ b/examples/ethers_base/test/test.ts @@ -1,5 +1,6 @@ -import { runTests } from 'azle/test'; import { getCanisterId } from 'azle/dfx'; +import { runTests } from 'azle/test'; + import { getTests } from './tests'; const canisterId = getCanisterId('server'); diff --git a/examples/express/src/backend/index.ts b/examples/express/src/backend/index.ts index 572ef0dc36..b0d4556719 100644 --- a/examples/express/src/backend/index.ts +++ b/examples/express/src/backend/index.ts @@ -1,5 +1,5 @@ import express, { Request, Response } from 'express'; -import { writeFileSync, createReadStream } from 'fs'; +import { createReadStream, writeFileSync } from 'fs'; let globalState = {}; diff --git a/examples/express/test/test.ts b/examples/express/test/test.ts index 19efd25ec3..f0f03fa3ed 100644 --- a/examples/express/test/test.ts +++ b/examples/express/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { getTests } from './tests'; const canisterId = getCanisterId('express'); diff --git a/examples/fetch_ic/test/test.ts b/examples/fetch_ic/test/test.ts index 5aacba6485..c26dcfa29a 100644 --- a/examples/fetch_ic/test/test.ts +++ b/examples/fetch_ic/test/test.ts @@ -1,4 +1,5 @@ import { runTests } from 'azle/test'; + import { getTests } from './tests'; runTests(getTests('backend')); diff --git a/examples/fetch_ic/test/tests.ts b/examples/fetch_ic/test/tests.ts index fadec9a0cb..8f5e040779 100644 --- a/examples/fetch_ic/test/tests.ts +++ b/examples/fetch_ic/test/tests.ts @@ -5,8 +5,8 @@ import * as dns from 'node:dns'; dns.setDefaultResultOrder('ipv4first'); -import { Test } from 'azle/test'; import { getCanisterOrigin } from 'azle/dfx'; +import { Test } from 'azle/test'; import puppeteer, { Browser, Page } from 'puppeteer'; export function getTests(canisterName: string): Test[] { diff --git a/examples/file_protocol/test/test.ts b/examples/file_protocol/test/test.ts index c76a4af1f7..bd945d95c7 100644 --- a/examples/file_protocol/test/test.ts +++ b/examples/file_protocol/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { getTests } from './tests'; const canisterId = getCanisterId('backend'); diff --git a/examples/fs/test/test.ts b/examples/fs/test/test.ts index 976ab3e9f7..c91d144342 100644 --- a/examples/fs/test/test.ts +++ b/examples/fs/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { getTests } from './tests'; const canisterId = getCanisterId('fs'); diff --git a/examples/func_types/canisters/func_types/index.ts b/examples/func_types/canisters/func_types/index.ts index 2b927448e1..4544c19f1a 100644 --- a/examples/func_types/canisters/func_types/index.ts +++ b/examples/func_types/canisters/func_types/index.ts @@ -1,23 +1,24 @@ import { Canister, Func, - init, ic, + init, nat64, + Null, Opt, Principal, query, Record, + Recursive, + serialize, StableBTreeMap, + text, update, Variant, Vec, - text, - Void, - Null, - Recursive, - serialize + Void } from 'azle'; + import Notifier, { NotifierFunc } from '../notifiers'; const BasicFunc = Func([text], text, 'query'); diff --git a/examples/func_types/canisters/notifiers/index.ts b/examples/func_types/canisters/notifiers/index.ts index 40b859d4e4..1c33fcc279 100644 --- a/examples/func_types/canisters/notifiers/index.ts +++ b/examples/func_types/canisters/notifiers/index.ts @@ -1,4 +1,4 @@ -import { Canister, ic, Principal, query, blob, Func, Void } from 'azle'; +import { blob, Canister, Func, ic, Principal, query, Void } from 'azle'; export const NotifierFunc = Func([blob], Void, 'oneway'); export type NotifierFunc = typeof NotifierFunc.tsType; diff --git a/examples/func_types/test/test.ts b/examples/func_types/test/test.ts index 4f627e44fd..f7624ce170 100644 --- a/examples/func_types/test/test.ts +++ b/examples/func_types/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/func_types'; import { getTests } from './tests'; diff --git a/examples/func_types/test/tests.ts b/examples/func_types/test/tests.ts index ad7fc6ab7f..46d425d622 100644 --- a/examples/func_types/test/tests.ts +++ b/examples/func_types/test/tests.ts @@ -2,6 +2,7 @@ import { ActorSubclass } from '@dfinity/agent'; import { Principal } from '@dfinity/principal'; import { getCanisterId } from 'azle/dfx'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/func_types/func_types.did'; export function getTests(funcTypesCanister: ActorSubclass<_SERVICE>): Test[] { diff --git a/examples/generics/src/index.ts b/examples/generics/src/index.ts index cd8ab7e8bd..fb04afbd39 100644 --- a/examples/generics/src/index.ts +++ b/examples/generics/src/index.ts @@ -1,6 +1,6 @@ // @ts-nocheck -import { nat64, $query, Record, Result, Tuple, Variant, Vec } from 'azle'; +import { $query, nat64, Record, Result, Tuple, Variant, Vec } from 'azle'; type SimpleResult = Result; diff --git a/examples/generics/test/test.ts b/examples/generics/test/test.ts index 34e963b53e..57d0ae7994 100644 --- a/examples/generics/test/test.ts +++ b/examples/generics/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/generics'; import { getTests } from './tests'; diff --git a/examples/generics/test/tests.ts b/examples/generics/test/tests.ts index b96c5cf525..51eedc0659 100644 --- a/examples/generics/test/tests.ts +++ b/examples/generics/test/tests.ts @@ -1,5 +1,6 @@ import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/generics/generics.did'; export function getTests(genericsCanister: ActorSubclass<_SERVICE>): Test[] { diff --git a/examples/guard_functions/src/index.ts b/examples/guard_functions/src/index.ts index ecb9df1fe6..d4bf2e8b79 100644 --- a/examples/guard_functions/src/index.ts +++ b/examples/guard_functions/src/index.ts @@ -1,4 +1,5 @@ import { bool, Canister, ic, Manual, nat32, query, update } from 'azle'; + import { allowAll, incrementCounterAndAllowAll, diff --git a/examples/guard_functions/test/test.ts b/examples/guard_functions/test/test.ts index d2d514dbc5..54c06d616c 100644 --- a/examples/guard_functions/test/test.ts +++ b/examples/guard_functions/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/guard_functions'; import { getTests } from './tests'; diff --git a/examples/guard_functions/test/tests.ts b/examples/guard_functions/test/tests.ts index ff5a3c83ba..8933572c25 100644 --- a/examples/guard_functions/test/tests.ts +++ b/examples/guard_functions/test/tests.ts @@ -1,6 +1,7 @@ import { ActorSubclass } from '@dfinity/agent'; import { AgentError } from '@dfinity/agent/lib/cjs/errors'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/guard_functions/guard_functions.did'; export function getTests( diff --git a/examples/heartbeat/src/heartbeat_async/index.ts b/examples/heartbeat/src/heartbeat_async/index.ts index 20109fcacd..040ebfb052 100644 --- a/examples/heartbeat/src/heartbeat_async/index.ts +++ b/examples/heartbeat/src/heartbeat_async/index.ts @@ -1,4 +1,4 @@ -import { blob, Canister, ic, heartbeat, query, serialize } from 'azle'; +import { blob, Canister, heartbeat, ic, query, serialize } from 'azle'; import { managementCanister } from 'azle/canisters/management'; let initialized: blob = Uint8Array.from([]); diff --git a/examples/heartbeat/test/test.ts b/examples/heartbeat/test/test.ts index e13af73eb5..d5147293b7 100644 --- a/examples/heartbeat/test/test.ts +++ b/examples/heartbeat/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor as create_actor_heartbeat_async } from './dfx_generated/heartbeat_async'; import { createActor as create_actor_heartbeat_sync } from './dfx_generated/heartbeat_sync'; import { getTests } from './tests'; diff --git a/examples/heartbeat/test/tests.ts b/examples/heartbeat/test/tests.ts index e4bfb7a36a..0d843e5df1 100644 --- a/examples/heartbeat/test/tests.ts +++ b/examples/heartbeat/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE as _SERVICE_HEARTBEAT_ASYNC } from './dfx_generated/heartbeat_async/heartbeat_async.did'; import { _SERVICE as _SERVICE_HEARTBEAT_SYNC } from './dfx_generated/heartbeat_sync/heartbeat_sync.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests( heartbeatAsyncCanister: ActorSubclass<_SERVICE_HEARTBEAT_ASYNC>, diff --git a/examples/hello_world/test/test.ts b/examples/hello_world/test/test.ts index c76a4af1f7..bd945d95c7 100644 --- a/examples/hello_world/test/test.ts +++ b/examples/hello_world/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { getTests } from './tests'; const canisterId = getCanisterId('backend'); diff --git a/examples/http_outcall_fetch/src/server.ts b/examples/http_outcall_fetch/src/server.ts index fd0218f590..87cda1c6e3 100644 --- a/examples/http_outcall_fetch/src/server.ts +++ b/examples/http_outcall_fetch/src/server.ts @@ -1,5 +1,5 @@ import { ic, query, Server } from 'azle'; -import { HttpTransformArgs, HttpResponse } from 'azle/canisters/management'; +import { HttpResponse, HttpTransformArgs } from 'azle/canisters/management'; import express from 'express'; export default Server( diff --git a/examples/http_outcall_fetch/test/test.ts b/examples/http_outcall_fetch/test/test.ts index 74a1a5fafd..0a8b49527f 100644 --- a/examples/http_outcall_fetch/test/test.ts +++ b/examples/http_outcall_fetch/test/test.ts @@ -1,5 +1,6 @@ -import { runTests } from 'azle/test'; import { getCanisterId } from 'azle/dfx'; +import { runTests } from 'azle/test'; + import { getTests } from './tests'; const canisterId = getCanisterId('server'); diff --git a/examples/hybrid_canister/test/test.ts b/examples/hybrid_canister/test/test.ts index 99a3ba421f..cde0793583 100644 --- a/examples/hybrid_canister/test/test.ts +++ b/examples/hybrid_canister/test/test.ts @@ -1,4 +1,5 @@ import { runTests } from 'azle/test'; + import { getTests } from './tests'; runTests(getTests()); diff --git a/examples/hybrid_canister/test/tests/index.ts b/examples/hybrid_canister/test/tests/index.ts index d3b57df4cb..6f4ebb2e73 100644 --- a/examples/hybrid_canister/test/tests/index.ts +++ b/examples/hybrid_canister/test/tests/index.ts @@ -3,10 +3,10 @@ dns.setDefaultResultOrder('ipv4first'); import { Test } from 'azle/test'; -import { getTests as getTestsCanisterInitAndPostUpgrade } from './canister_init_and_post_upgrade'; import { getTests as getTestsCanister } from './canister'; -import { getTests as getTestsServerInitAndPostUpgrade } from './server_init_and_post_upgrade'; +import { getTests as getTestsCanisterInitAndPostUpgrade } from './canister_init_and_post_upgrade'; import { getTests as getTestsServer } from './server'; +import { getTests as getTestsServerInitAndPostUpgrade } from './server_init_and_post_upgrade'; export function getTests(): Test[] { const canisterInitAndPostUpgradeTests = diff --git a/examples/ic_api/src/index.ts b/examples/ic_api/src/index.ts index 012c4618be..bfd5f40f86 100644 --- a/examples/ic_api/src/index.ts +++ b/examples/ic_api/src/index.ts @@ -1,5 +1,6 @@ import { blob, + bool, Canister, empty, ic, @@ -9,11 +10,10 @@ import { nat32, nat64, Opt, + Principal, query, - update, - bool, text, - Principal, + update, Void } from 'azle'; diff --git a/examples/ic_api/test/test.ts b/examples/ic_api/test/test.ts index febc45f5d9..1f4572e798 100644 --- a/examples/ic_api/test/test.ts +++ b/examples/ic_api/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/ic_api'; import { getTests } from './tests'; diff --git a/examples/ic_api/test/tests.ts b/examples/ic_api/test/tests.ts index efe7d022c7..21220b09cd 100644 --- a/examples/ic_api/test/tests.ts +++ b/examples/ic_api/test/tests.ts @@ -1,9 +1,10 @@ +import { ActorSubclass } from '@dfinity/agent'; +import { Principal } from '@dfinity/principal'; import { getCanisterId } from 'azle/dfx'; import { Test } from 'azle/test'; import { execSync } from 'child_process'; + import { _SERVICE } from './dfx_generated/ic_api/ic_api.did'; -import { ActorSubclass } from '@dfinity/agent'; -import { Principal } from '@dfinity/principal'; export function getTests(icApiCanister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/ic_evm_rpc/src/server.ts b/examples/ic_evm_rpc/src/server.ts index c79645c10c..43050d1b34 100644 --- a/examples/ic_evm_rpc/src/server.ts +++ b/examples/ic_evm_rpc/src/server.ts @@ -8,9 +8,9 @@ import { ethGetBalance } from './json_rpc_methods/eth_get_balance'; import { ethGetTransactionCount } from './json_rpc_methods/eth_get_transaction_count'; import { ethMaxPriorityFeePerGas } from './json_rpc_methods/eth_max_priority_fee_per_gas'; import { ethSendRawTransaction } from './json_rpc_methods/eth_send_raw_transaction'; +import { calculateRsvForTEcdsa } from './tecdsa/calculate_rsv_for_tecdsa'; import { ecdsaPublicKey } from './tecdsa/ecdsa_public_key'; import { signWithEcdsa } from './tecdsa/sign_with_ecdsa'; -import { calculateRsvForTEcdsa } from './tecdsa/calculate_rsv_for_tecdsa'; const app = express(); diff --git a/examples/ic_evm_rpc/test/test.ts b/examples/ic_evm_rpc/test/test.ts index 94b5d77c6e..0a8b49527f 100644 --- a/examples/ic_evm_rpc/test/test.ts +++ b/examples/ic_evm_rpc/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { getTests } from './tests'; const canisterId = getCanisterId('server'); diff --git a/examples/icrc/canisters/proxy/index.ts b/examples/icrc/canisters/proxy/index.ts index d63f1032f8..716a66e145 100644 --- a/examples/icrc/canisters/proxy/index.ts +++ b/examples/icrc/canisters/proxy/index.ts @@ -17,17 +17,17 @@ import { } from 'azle'; import { Account, - ICRC, - TransferArgs, - TransferResult, - Value, - SupportedStandard, + AllowanceArgs, + AllowanceResult, ApproveArgs, ApproveResult, + ICRC, + SupportedStandard, + TransferArgs, TransferFromArgs, TransferFromResult, - AllowanceArgs, - AllowanceResult + TransferResult, + Value } from 'azle/canisters/icrc'; let icrc: typeof ICRC; diff --git a/examples/icrc/test/test.ts b/examples/icrc/test/test.ts index 660422cda7..9a170c3edc 100644 --- a/examples/icrc/test/test.ts +++ b/examples/icrc/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../test/dfx_generated/proxy'; import { getTests } from './tests'; diff --git a/examples/icrc/test/tests.ts b/examples/icrc/test/tests.ts index 9ad539286d..ede85725b9 100644 --- a/examples/icrc/test/tests.ts +++ b/examples/icrc/test/tests.ts @@ -1,7 +1,8 @@ import { ActorSubclass } from '@dfinity/agent'; +import { Principal } from '@dfinity/principal'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/proxy/proxy.did'; -import { Principal } from '@dfinity/principal'; export function getTests(proxyCanister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/imports/src/index.ts b/examples/imports/src/index.ts index 5a6df45091..da79c59a0e 100644 --- a/examples/imports/src/index.ts +++ b/examples/imports/src/index.ts @@ -1,7 +1,8 @@ import { Canister, int, query, text } from 'azle'; -import { one, two, three } from './library'; import { sha224 } from 'js-sha256'; +import { one, three, two } from './library'; + export default Canister({ getOne: query([], text, () => { return one(); diff --git a/examples/imports/test/test.ts b/examples/imports/test/test.ts index 54ecb2b1d4..f8151d8315 100644 --- a/examples/imports/test/test.ts +++ b/examples/imports/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../test/dfx_generated/imports'; import { getTests } from './tests'; diff --git a/examples/imports/test/tests.ts b/examples/imports/test/tests.ts index a35fa1db9d..6595d2b03a 100644 --- a/examples/imports/test/tests.ts +++ b/examples/imports/test/tests.ts @@ -1,5 +1,6 @@ import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/imports/imports.did'; export function getTests(importsCanister: ActorSubclass<_SERVICE>): Test[] { diff --git a/examples/init/test/test.ts b/examples/init/test/test.ts index 97f9a8113d..f2d1a19419 100644 --- a/examples/init/test/test.ts +++ b/examples/init/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../test/dfx_generated/init'; import { getTests } from './tests'; diff --git a/examples/init/test/tests.ts b/examples/init/test/tests.ts index 88755e29f1..642afa581a 100644 --- a/examples/init/test/tests.ts +++ b/examples/init/test/tests.ts @@ -1,5 +1,6 @@ import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/init/init.did'; export function getTests(initCanister: ActorSubclass<_SERVICE>): Test[] { diff --git a/examples/inspect_message/test/test.ts b/examples/inspect_message/test/test.ts index 77cda0065c..5a8814061b 100644 --- a/examples/inspect_message/test/test.ts +++ b/examples/inspect_message/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/inspect_message'; import { getTests } from './tests'; diff --git a/examples/inspect_message/test/tests.ts b/examples/inspect_message/test/tests.ts index c8b30712cb..24a8997699 100644 --- a/examples/inspect_message/test/tests.ts +++ b/examples/inspect_message/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/inspect_message/inspect_message.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests( inspectMessageCanister: ActorSubclass<_SERVICE> diff --git a/examples/internet_identity/test/test.ts b/examples/internet_identity/test/test.ts index 5aacba6485..c26dcfa29a 100644 --- a/examples/internet_identity/test/test.ts +++ b/examples/internet_identity/test/test.ts @@ -1,4 +1,5 @@ import { runTests } from 'azle/test'; + import { getTests } from './tests'; runTests(getTests('backend')); diff --git a/examples/internet_identity/test/tests.ts b/examples/internet_identity/test/tests.ts index 31f2a0df65..298df8ae36 100644 --- a/examples/internet_identity/test/tests.ts +++ b/examples/internet_identity/test/tests.ts @@ -2,8 +2,8 @@ import * as dns from 'node:dns'; dns.setDefaultResultOrder('ipv4first'); import { Principal } from '@dfinity/principal'; -import { Test } from 'azle/test'; import { getCanisterOrigin } from 'azle/dfx'; +import { Test } from 'azle/test'; import puppeteer from 'puppeteer'; export function getTests(canisterName: string): Test[] { diff --git a/examples/key_value_store/test/test.ts b/examples/key_value_store/test/test.ts index 7f6b5a0e8d..587cf3cd57 100644 --- a/examples/key_value_store/test/test.ts +++ b/examples/key_value_store/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/key_value_store'; import { getTests } from './tests'; diff --git a/examples/key_value_store/test/tests.ts b/examples/key_value_store/test/tests.ts index 2341f2d1c8..620c7aee23 100644 --- a/examples/key_value_store/test/tests.ts +++ b/examples/key_value_store/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/key_value_store/key_value_store.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests( keyValueStoreCanister: ActorSubclass<_SERVICE> diff --git a/examples/large_files/src/backend/index.ts b/examples/large_files/src/backend/index.ts index 3f0c2a77a7..a897de79f6 100644 --- a/examples/large_files/src/backend/index.ts +++ b/examples/large_files/src/backend/index.ts @@ -1,6 +1,6 @@ import { Server } from 'azle'; import express, { Request } from 'express'; -import { statSync, existsSync } from 'fs'; +import { existsSync, statSync } from 'fs'; export default Server(() => { const app = express(); diff --git a/examples/large_files/test/generateTestFiles.ts b/examples/large_files/test/generateTestFiles.ts index 1df8a9ba44..14ed6fffc0 100644 --- a/examples/large_files/test/generateTestFiles.ts +++ b/examples/large_files/test/generateTestFiles.ts @@ -1,4 +1,4 @@ -import { Unit, generateFileOfSize, toBytes } from 'azle/scripts/file_generator'; +import { generateFileOfSize, toBytes, Unit } from 'azle/scripts/file_generator'; import { join } from 'path'; export async function generateTestFileOfSize( diff --git a/examples/large_files/test/pretest.ts b/examples/large_files/test/pretest.ts index d0a7a9ba97..6a6b2e71c6 100644 --- a/examples/large_files/test/pretest.ts +++ b/examples/large_files/test/pretest.ts @@ -1,6 +1,7 @@ import { execSync } from 'child_process'; import { rm } from 'fs/promises'; import { join } from 'path'; + import { generateTestFileOfSize } from './generateTestFiles'; async function pretest() { diff --git a/examples/large_files/test/test.ts b/examples/large_files/test/test.ts index c76a4af1f7..bd945d95c7 100644 --- a/examples/large_files/test/test.ts +++ b/examples/large_files/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { getTests } from './tests'; const canisterId = getCanisterId('backend'); diff --git a/examples/large_files/test/tests.ts b/examples/large_files/test/tests.ts index c82cbbc4bd..1e377a39d7 100644 --- a/examples/large_files/test/tests.ts +++ b/examples/large_files/test/tests.ts @@ -1,16 +1,17 @@ import * as dns from 'node:dns'; dns.setDefaultResultOrder('ipv4first'); -import { Test } from 'azle/test'; import { generateIdentity, getCanisterId } from 'azle/dfx'; -import { execSync } from 'child_process'; import { hashFile } from 'azle/scripts/hash_file'; -import { join } from 'path'; -import { rm } from 'fs/promises'; -import { generateTestFileOfSize } from './generateTestFiles'; import { createActor } from 'azle/src/compiler/file_uploader/uploader_actor'; +import { Test } from 'azle/test'; +import { execSync } from 'child_process'; +import { rm } from 'fs/promises'; +import { join } from 'path'; import { v4 } from 'uuid'; + import { AZLE_UPLOADER_IDENTITY_NAME } from '../../../src/compiler/file_uploader/uploader_identity'; +import { generateTestFileOfSize } from './generateTestFiles'; export function getTests(canisterId: string): Test[] { const origin = `http://${canisterId}.localhost:8000`; diff --git a/examples/ledger_canister/test/pretest.ts b/examples/ledger_canister/test/pretest.ts index a894422e65..b9feb59f20 100644 --- a/examples/ledger_canister/test/pretest.ts +++ b/examples/ledger_canister/test/pretest.ts @@ -1,5 +1,5 @@ -import { execSync } from 'child_process'; import { getCanisterId } from 'azle/dfx'; +import { execSync } from 'child_process'; async function pretest(icp_ledger_path: string) { execSync(`dfx canister uninstall-code icp_ledger || true`, { diff --git a/examples/ledger_canister/test/test.ts b/examples/ledger_canister/test/test.ts index 493f8efdd8..082b5357b4 100644 --- a/examples/ledger_canister/test/test.ts +++ b/examples/ledger_canister/test/test.ts @@ -3,6 +3,7 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../test/dfx_generated/ledger_canister'; import { getTests } from './tests'; diff --git a/examples/ledger_canister/test/tests.ts b/examples/ledger_canister/test/tests.ts index b9d0cf912e..d41f8c7bf0 100644 --- a/examples/ledger_canister/test/tests.ts +++ b/examples/ledger_canister/test/tests.ts @@ -2,6 +2,7 @@ import { ActorSubclass } from '@dfinity/agent'; import { Principal } from '@dfinity/principal'; import { ok, Test } from 'azle/test'; import { execSync } from 'child_process'; + import { _SERVICE } from './dfx_generated/ledger_canister/ledger_canister.did'; export function getTests(ledgerCanister: ActorSubclass<_SERVICE>): Test[] { diff --git a/examples/list_of_lists/src/index.ts b/examples/list_of_lists/src/index.ts index c81badb9a4..f7fa49bf97 100644 --- a/examples/list_of_lists/src/index.ts +++ b/examples/list_of_lists/src/index.ts @@ -7,15 +7,15 @@ import { float64, Func, int, + int8, int16, int32, int64, - int8, nat, + nat8, nat16, nat32, nat64, - nat8, Null, Opt, Principal, diff --git a/examples/list_of_lists/test/test.ts b/examples/list_of_lists/test/test.ts index 4163ec7875..3610a17d90 100644 --- a/examples/list_of_lists/test/test.ts +++ b/examples/list_of_lists/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../dfx_generated/list_of_lists'; import { getTests } from './tests'; diff --git a/examples/list_of_lists/test/tests.ts b/examples/list_of_lists/test/tests.ts index f099499c84..eee97ae07b 100644 --- a/examples/list_of_lists/test/tests.ts +++ b/examples/list_of_lists/test/tests.ts @@ -1,8 +1,9 @@ -import { Test } from 'azle/test'; -import { _SERVICE } from '../dfx_generated/list_of_lists/list_of_lists.did'; import { ActorSubclass } from '@dfinity/agent'; -import { deepEqual } from 'fast-equals'; import { Principal } from '@dfinity/principal'; +import { Test } from 'azle/test'; +import { deepEqual } from 'fast-equals'; + +import { _SERVICE } from '../dfx_generated/list_of_lists/list_of_lists.did'; type DeepArray = arr | Array>; diff --git a/examples/management_canister/test/test.ts b/examples/management_canister/test/test.ts index 6e7a399b2c..1267328979 100644 --- a/examples/management_canister/test/test.ts +++ b/examples/management_canister/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../test/dfx_generated/management_canister'; import { getTests } from './tests'; diff --git a/examples/management_canister/test/tests.ts b/examples/management_canister/test/tests.ts index ad06213c6e..30e1cf3376 100644 --- a/examples/management_canister/test/tests.ts +++ b/examples/management_canister/test/tests.ts @@ -1,8 +1,9 @@ import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; -import { _SERVICE } from './dfx_generated/management_canister/management_canister.did'; import { readFileSync } from 'fs'; +import { _SERVICE } from './dfx_generated/management_canister/management_canister.did'; + export function getTests(managementCanister: ActorSubclass<_SERVICE>): Test[] { return [ { diff --git a/examples/manual_reply/test/test.ts b/examples/manual_reply/test/test.ts index 25b8e770b8..8792ca6985 100644 --- a/examples/manual_reply/test/test.ts +++ b/examples/manual_reply/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/manual_reply'; import { getTests } from './tests'; diff --git a/examples/manual_reply/test/tests.ts b/examples/manual_reply/test/tests.ts index 38a2377117..c894488aec 100644 --- a/examples/manual_reply/test/tests.ts +++ b/examples/manual_reply/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/manual_reply/manual_reply.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests(manualReplyCanister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/motoko_examples/calc/test/test.ts b/examples/motoko_examples/calc/test/test.ts index bb0cd680a7..1feaa8e17f 100644 --- a/examples/motoko_examples/calc/test/test.ts +++ b/examples/motoko_examples/calc/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + // @ts-ignore import { createActor } from './dfx_generated/calc'; import { getTests } from './tests'; diff --git a/examples/motoko_examples/calc/test/tests.ts b/examples/motoko_examples/calc/test/tests.ts index 16de684ffe..04e65eeb72 100644 --- a/examples/motoko_examples/calc/test/tests.ts +++ b/examples/motoko_examples/calc/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + // @ts-ignore import { _SERVICE } from './dfx_generated/calc/calc.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests(calcCanister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/motoko_examples/counter/test/test.ts b/examples/motoko_examples/counter/test/test.ts index 0a3ead0d9f..637be5b7d5 100644 --- a/examples/motoko_examples/counter/test/test.ts +++ b/examples/motoko_examples/counter/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + // @ts-ignore import { createActor } from './dfx_generated/counter'; import { getTests } from './tests'; diff --git a/examples/motoko_examples/counter/test/tests.ts b/examples/motoko_examples/counter/test/tests.ts index 7e27cac790..85d98b74bb 100644 --- a/examples/motoko_examples/counter/test/tests.ts +++ b/examples/motoko_examples/counter/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + // @ts-ignore import { _SERVICE } from './dfx_generated/counter/counter.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests(counterCanister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/motoko_examples/echo/test/test.ts b/examples/motoko_examples/echo/test/test.ts index fdb7ee6272..1a5744dbe8 100644 --- a/examples/motoko_examples/echo/test/test.ts +++ b/examples/motoko_examples/echo/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + // @ts-ignore import { createActor } from './dfx_generated/echo'; import { getTests } from './tests'; diff --git a/examples/motoko_examples/echo/test/tests.ts b/examples/motoko_examples/echo/test/tests.ts index fe26bbbeb9..f67b99f057 100644 --- a/examples/motoko_examples/echo/test/tests.ts +++ b/examples/motoko_examples/echo/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + // @ts-ignore import { _SERVICE } from './dfx_generated/echo/echo.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests(echoCanister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/motoko_examples/factorial/test/test.ts b/examples/motoko_examples/factorial/test/test.ts index d1d2d8dd44..be8029f65d 100644 --- a/examples/motoko_examples/factorial/test/test.ts +++ b/examples/motoko_examples/factorial/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + // @ts-ignore import { createActor } from './dfx_generated/factorial'; import { getTests } from './tests'; diff --git a/examples/motoko_examples/factorial/test/tests.ts b/examples/motoko_examples/factorial/test/tests.ts index 832672b4cd..161e546d82 100644 --- a/examples/motoko_examples/factorial/test/tests.ts +++ b/examples/motoko_examples/factorial/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + // @ts-ignore import { _SERVICE } from './dfx_generated/factorial/factorial.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests(factorialCanister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/motoko_examples/hello-world/test/test.ts b/examples/motoko_examples/hello-world/test/test.ts index e47c831a9f..e29046419f 100644 --- a/examples/motoko_examples/hello-world/test/test.ts +++ b/examples/motoko_examples/hello-world/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + // @ts-ignore import { createActor } from './dfx_generated/hello_world'; import { getTests } from './tests'; diff --git a/examples/motoko_examples/hello-world/test/tests.ts b/examples/motoko_examples/hello-world/test/tests.ts index 41693e8212..e90bb3ef78 100644 --- a/examples/motoko_examples/hello-world/test/tests.ts +++ b/examples/motoko_examples/hello-world/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + // @ts-ignore import { _SERVICE } from './dfx_generated/hello_world/hello_world.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests( hello_world_canister: ActorSubclass<_SERVICE> diff --git a/examples/motoko_examples/hello/test/test.ts b/examples/motoko_examples/hello/test/test.ts index ca609ed1e7..dac6802bfe 100644 --- a/examples/motoko_examples/hello/test/test.ts +++ b/examples/motoko_examples/hello/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + // @ts-ignore import { createActor } from '../dfx_generated/hello'; import { getTests } from './tests'; diff --git a/examples/motoko_examples/hello/test/tests.ts b/examples/motoko_examples/hello/test/tests.ts index 3f8e007fcc..273620949c 100644 --- a/examples/motoko_examples/hello/test/tests.ts +++ b/examples/motoko_examples/hello/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + // @ts-ignore import { _SERVICE } from '../dfx_generated/hello/hello.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests(hello_canister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/motoko_examples/http_counter/test/test.ts b/examples/motoko_examples/http_counter/test/test.ts index 99a3ba421f..cde0793583 100644 --- a/examples/motoko_examples/http_counter/test/test.ts +++ b/examples/motoko_examples/http_counter/test/test.ts @@ -1,4 +1,5 @@ import { runTests } from 'azle/test'; + import { getTests } from './tests'; runTests(getTests()); diff --git a/examples/motoko_examples/http_counter/test/tests.ts b/examples/motoko_examples/http_counter/test/tests.ts index ed44e5bb74..5671a156b7 100644 --- a/examples/motoko_examples/http_counter/test/tests.ts +++ b/examples/motoko_examples/http_counter/test/tests.ts @@ -1,6 +1,7 @@ +import * as dns from 'node:dns'; + import { Test } from 'azle/test'; import { execSync } from 'child_process'; -import * as dns from 'node:dns'; dns.setDefaultResultOrder('ipv4first'); const skip = true; diff --git a/examples/motoko_examples/minimal-counter-dapp/test/test.ts b/examples/motoko_examples/minimal-counter-dapp/test/test.ts index 97b7503ea8..7cf7636dd6 100644 --- a/examples/motoko_examples/minimal-counter-dapp/test/test.ts +++ b/examples/motoko_examples/minimal-counter-dapp/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + // @ts-ignore import { createActor } from '../src/declarations/minimal_dapp'; import { getTests } from './tests'; diff --git a/examples/motoko_examples/minimal-counter-dapp/test/tests.ts b/examples/motoko_examples/minimal-counter-dapp/test/tests.ts index 522cf26690..2ce993d825 100644 --- a/examples/motoko_examples/minimal-counter-dapp/test/tests.ts +++ b/examples/motoko_examples/minimal-counter-dapp/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + // @ts-ignore import { _SERVICE } from '../src/declarations/minimal_dapp/minimal_dapp.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests(counterCanister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/motoko_examples/persistent-storage/test/test.ts b/examples/motoko_examples/persistent-storage/test/test.ts index 8b6a104f1e..d133f4ed43 100644 --- a/examples/motoko_examples/persistent-storage/test/test.ts +++ b/examples/motoko_examples/persistent-storage/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/persistent_storage'; import { getTests } from './tests'; diff --git a/examples/motoko_examples/persistent-storage/test/tests.ts b/examples/motoko_examples/persistent-storage/test/tests.ts index 95c65a953e..d06b735b58 100644 --- a/examples/motoko_examples/persistent-storage/test/tests.ts +++ b/examples/motoko_examples/persistent-storage/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; import { execSync } from 'child_process'; + import { _SERVICE } from './dfx_generated/persistent_storage/persistent_storage.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests( persistentStorageCanister: ActorSubclass<_SERVICE> diff --git a/examples/motoko_examples/phone-book/src/declarations/phone_book/index.d.ts b/examples/motoko_examples/phone-book/src/declarations/phone_book/index.d.ts index 0c7ef43c90..184ba77071 100644 --- a/examples/motoko_examples/phone-book/src/declarations/phone_book/index.d.ts +++ b/examples/motoko_examples/phone-book/src/declarations/phone_book/index.d.ts @@ -1,11 +1,11 @@ import type { - ActorSubclass, - HttpAgentOptions, ActorConfig, - Agent + ActorSubclass, + Agent, + HttpAgentOptions } from '@dfinity/agent'; -import type { Principal } from '@dfinity/principal'; import type { IDL } from '@dfinity/candid'; +import type { Principal } from '@dfinity/principal'; import { _SERVICE } from './phone_book.did'; diff --git a/examples/motoko_examples/phone-book/src/declarations/phone_book/phone_book.did.d.ts b/examples/motoko_examples/phone-book/src/declarations/phone_book/phone_book.did.d.ts index fbee1841ca..00ee6d938c 100644 --- a/examples/motoko_examples/phone-book/src/declarations/phone_book/phone_book.did.d.ts +++ b/examples/motoko_examples/phone-book/src/declarations/phone_book/phone_book.did.d.ts @@ -1,6 +1,6 @@ -import type { Principal } from '@dfinity/principal'; import type { ActorMethod } from '@dfinity/agent'; import type { IDL } from '@dfinity/candid'; +import type { Principal } from '@dfinity/principal'; export interface _SERVICE { insert: ActorMethod<[string, { desc: string; phone: string }], undefined>; diff --git a/examples/motoko_examples/phone-book/test/test.ts b/examples/motoko_examples/phone-book/test/test.ts index a621033bac..8bfa786512 100644 --- a/examples/motoko_examples/phone-book/test/test.ts +++ b/examples/motoko_examples/phone-book/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../src/declarations/phone_book'; import { getTests } from './tests'; diff --git a/examples/motoko_examples/phone-book/test/tests.ts b/examples/motoko_examples/phone-book/test/tests.ts index 8a35a60d31..27519cfa0a 100644 --- a/examples/motoko_examples/phone-book/test/tests.ts +++ b/examples/motoko_examples/phone-book/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from '../src/declarations/phone_book/phone_book.did'; -import { ActorSubclass } from '@dfinity/agent'; const TEST_PHONE_BOOK_RECORD = { desc: 'This is a test record', diff --git a/examples/motoko_examples/quicksort/src/index.ts b/examples/motoko_examples/quicksort/src/index.ts index d42c06b81a..6a2acf387a 100644 --- a/examples/motoko_examples/quicksort/src/index.ts +++ b/examples/motoko_examples/quicksort/src/index.ts @@ -1,4 +1,5 @@ -import { Canister, int, Vec, query } from 'azle'; +import { Canister, int, query, Vec } from 'azle'; + import { Int } from './comparison'; import * as Quicksort from './quicksort'; diff --git a/examples/motoko_examples/quicksort/test/test.ts b/examples/motoko_examples/quicksort/test/test.ts index 244180d442..7afbf5707c 100644 --- a/examples/motoko_examples/quicksort/test/test.ts +++ b/examples/motoko_examples/quicksort/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + // @ts-ignore import { createActor } from './dfx_generated/quicksort'; import { getTests } from './tests'; diff --git a/examples/motoko_examples/quicksort/test/tests.ts b/examples/motoko_examples/quicksort/test/tests.ts index 607f918f3a..38377979c2 100644 --- a/examples/motoko_examples/quicksort/test/tests.ts +++ b/examples/motoko_examples/quicksort/test/tests.ts @@ -1,8 +1,9 @@ -import { Ok, Test } from 'azle/test'; +import { ActorSubclass } from '@dfinity/agent'; import { int } from 'azle'; +import { Ok, Test } from 'azle/test'; + // @ts-ignore import { _SERVICE } from './dfx_generated/quicksort/quicksort.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests(quicksortCanister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/motoko_examples/simple-to-do/test/test.ts b/examples/motoko_examples/simple-to-do/test/test.ts index 85b3ffbb24..e3d37dce6d 100644 --- a/examples/motoko_examples/simple-to-do/test/test.ts +++ b/examples/motoko_examples/simple-to-do/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + // @ts-ignore import { createActor } from './dfx_generated/simple_to_do/'; import { getTests } from './tests'; diff --git a/examples/motoko_examples/simple-to-do/test/tests.ts b/examples/motoko_examples/simple-to-do/test/tests.ts index 9c2d7e48f6..3b7d413815 100644 --- a/examples/motoko_examples/simple-to-do/test/tests.ts +++ b/examples/motoko_examples/simple-to-do/test/tests.ts @@ -1,8 +1,9 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { ToDo } from '../src'; // @ts-ignore import { _SERVICE } from './dfx_generated/simple_to_do/simple_to_do.did'; -import { ActorSubclass } from '@dfinity/agent'; const FIRST_TODO_DESCRIPTION = 'Write tests for the simple to do list example'; const SECOND_TODO_DESCRIPTION = 'Mark this todo as complete'; diff --git a/examples/motoko_examples/superheroes/src/declarations/index.d.ts b/examples/motoko_examples/superheroes/src/declarations/index.d.ts index b5f9c4feec..33dbe93068 100644 --- a/examples/motoko_examples/superheroes/src/declarations/index.d.ts +++ b/examples/motoko_examples/superheroes/src/declarations/index.d.ts @@ -1,11 +1,11 @@ import type { - ActorSubclass, - HttpAgentOptions, ActorConfig, - Agent + ActorSubclass, + Agent, + HttpAgentOptions } from '@dfinity/agent'; -import type { Principal } from '@dfinity/principal'; import type { IDL } from '@dfinity/candid'; +import type { Principal } from '@dfinity/principal'; import { _SERVICE } from './superheroes.did'; diff --git a/examples/motoko_examples/superheroes/src/declarations/superheroes.did.d.ts b/examples/motoko_examples/superheroes/src/declarations/superheroes.did.d.ts index 57295867e7..3bd97d8718 100644 --- a/examples/motoko_examples/superheroes/src/declarations/superheroes.did.d.ts +++ b/examples/motoko_examples/superheroes/src/declarations/superheroes.did.d.ts @@ -1,6 +1,6 @@ -import type { Principal } from '@dfinity/principal'; import type { ActorMethod } from '@dfinity/agent'; import type { IDL } from '@dfinity/candid'; +import type { Principal } from '@dfinity/principal'; export type rec_0 = [string, [] | [rec_0]]; export type rec_1 = [string, [] | [rec_1]]; diff --git a/examples/motoko_examples/superheroes/test/test.ts b/examples/motoko_examples/superheroes/test/test.ts index ffbcf8cafd..f34d94f3ed 100644 --- a/examples/motoko_examples/superheroes/test/test.ts +++ b/examples/motoko_examples/superheroes/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../src/declarations'; import { getTests } from './tests'; diff --git a/examples/motoko_examples/superheroes/test/tests.ts b/examples/motoko_examples/superheroes/test/tests.ts index 1fc9c290b0..ccedaab718 100644 --- a/examples/motoko_examples/superheroes/test/tests.ts +++ b/examples/motoko_examples/superheroes/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + // @ts-ignore import { _SERVICE, Superhero } from '../src/declarations/superheroes.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests(superheroesCanister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/motoko_examples/threshold_ecdsa/test/test.ts b/examples/motoko_examples/threshold_ecdsa/test/test.ts index 5b28d93822..ced04f5b7a 100644 --- a/examples/motoko_examples/threshold_ecdsa/test/test.ts +++ b/examples/motoko_examples/threshold_ecdsa/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/threshold_ecdsa/'; import { getTests } from './tests'; diff --git a/examples/motoko_examples/threshold_ecdsa/test/tests.ts b/examples/motoko_examples/threshold_ecdsa/test/tests.ts index 291894606b..2fbd692416 100644 --- a/examples/motoko_examples/threshold_ecdsa/test/tests.ts +++ b/examples/motoko_examples/threshold_ecdsa/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/threshold_ecdsa/threshold_ecdsa.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests(tEcdsaCanister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/motoko_examples/whoami/test/pretest.ts b/examples/motoko_examples/whoami/test/pretest.ts index fc2a10c6f4..4fd44d237b 100644 --- a/examples/motoko_examples/whoami/test/pretest.ts +++ b/examples/motoko_examples/whoami/test/pretest.ts @@ -1,6 +1,6 @@ -import { execSync } from 'child_process'; -import { Ed25519KeyIdentity } from '@dfinity/identity'; import { SignIdentity } from '@dfinity/agent'; +import { Ed25519KeyIdentity } from '@dfinity/identity'; +import { execSync } from 'child_process'; const someoneIdentity = createIdentity(2); export const someonePrincipal = someoneIdentity.getPrincipal().toString(); diff --git a/examples/motoko_examples/whoami/test/test.ts b/examples/motoko_examples/whoami/test/test.ts index e5fd015c94..eea805f046 100644 --- a/examples/motoko_examples/whoami/test/test.ts +++ b/examples/motoko_examples/whoami/test/test.ts @@ -1,4 +1,5 @@ import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/whoami'; import { callingIdentity, canisterId, getTests } from './tests'; diff --git a/examples/motoko_examples/whoami/test/tests.ts b/examples/motoko_examples/whoami/test/tests.ts index dc36824d97..33a5bd79b3 100644 --- a/examples/motoko_examples/whoami/test/tests.ts +++ b/examples/motoko_examples/whoami/test/tests.ts @@ -1,10 +1,11 @@ +import { ActorSubclass } from '@dfinity/agent'; +import { SignIdentity } from '@dfinity/agent'; +import { Ed25519KeyIdentity } from '@dfinity/identity'; import { getCanisterId } from 'azle/dfx'; import { Test } from 'azle/test'; -import { _SERVICE } from './dfx_generated/whoami/whoami.did'; -import { ActorSubclass } from '@dfinity/agent'; import { execSync } from 'child_process'; -import { Ed25519KeyIdentity } from '@dfinity/identity'; -import { SignIdentity } from '@dfinity/agent'; + +import { _SERVICE } from './dfx_generated/whoami/whoami.did'; function createIdentity(seed: number): SignIdentity { const seed1 = [seed, ...new Array(31).fill(0)]; diff --git a/examples/new/test/pretest.ts b/examples/new/test/pretest.ts index 4f48c03f4a..270f535ab7 100644 --- a/examples/new/test/pretest.ts +++ b/examples/new/test/pretest.ts @@ -1,4 +1,5 @@ import { execSync } from 'child_process'; + import { version } from '../../../package.json'; async function pretest() { diff --git a/examples/notify_raw/test/test.ts b/examples/notify_raw/test/test.ts index f986b15a43..b5e38aeef4 100644 --- a/examples/notify_raw/test/test.ts +++ b/examples/notify_raw/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor as createActorCanister1 } from './dfx_generated/canister1'; import { createActor as createActorCanister2 } from './dfx_generated/canister2'; import { getTests } from './tests'; diff --git a/examples/notify_raw/test/tests.ts b/examples/notify_raw/test/tests.ts index ab6c84b65c..b2f97fce47 100644 --- a/examples/notify_raw/test/tests.ts +++ b/examples/notify_raw/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { ok, Test } from 'azle/test'; + import { _SERVICE as CANISTER1_SERVICE } from './dfx_generated/canister1/canister1.did'; import { _SERVICE as CANISTER2_SERVICE } from './dfx_generated/canister2/canister2.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests( canister1: ActorSubclass, diff --git a/examples/null_example/test/test.ts b/examples/null_example/test/test.ts index cbc9e80f05..904a97317a 100644 --- a/examples/null_example/test/test.ts +++ b/examples/null_example/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/null_example'; import { getTests } from './tests'; diff --git a/examples/null_example/test/tests.ts b/examples/null_example/test/tests.ts index ab60ded70c..9c6bb14bc9 100644 --- a/examples/null_example/test/tests.ts +++ b/examples/null_example/test/tests.ts @@ -1,5 +1,6 @@ import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/null_example/null_example.did'; export function getTests(nullExampleCanister: ActorSubclass<_SERVICE>): Test[] { @@ -52,9 +53,8 @@ export function getTests(nullExampleCanister: ActorSubclass<_SERVICE>): Test[] { secondItem: null, thirdItem: 15n }; - const result = await nullExampleCanister.setPartiallyNullRecord( - record - ); + const result = + await nullExampleCanister.setPartiallyNullRecord(record); return { Ok: @@ -87,9 +87,8 @@ export function getTests(nullExampleCanister: ActorSubclass<_SERVICE>): Test[] { firstItem: null, secondItem: null }; - const result = await nullExampleCanister.setSmallNullRecord( - record - ); + const result = + await nullExampleCanister.setSmallNullRecord(record); return { Ok: @@ -124,9 +123,8 @@ export function getTests(nullExampleCanister: ActorSubclass<_SERVICE>): Test[] { secondItem: null, thirdItem: null }; - const result = await nullExampleCanister.setLargeNullRecord( - record - ); + const result = + await nullExampleCanister.setLargeNullRecord(record); return { Ok: diff --git a/examples/optional_types/test/test.ts b/examples/optional_types/test/test.ts index 682815bb1e..d82b8a9cae 100644 --- a/examples/optional_types/test/test.ts +++ b/examples/optional_types/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../test/dfx_generated/optional_types'; import { getTests } from './tests'; diff --git a/examples/optional_types/test/tests.ts b/examples/optional_types/test/tests.ts index 646d5cbb30..6f65fd5704 100644 --- a/examples/optional_types/test/tests.ts +++ b/examples/optional_types/test/tests.ts @@ -1,5 +1,6 @@ import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/optional_types/optional_types.did'; export function getTests( diff --git a/examples/outgoing_http_requests/test/test.ts b/examples/outgoing_http_requests/test/test.ts index ff08bea179..27c506cae2 100644 --- a/examples/outgoing_http_requests/test/test.ts +++ b/examples/outgoing_http_requests/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/outgoing_http_requests'; import { getTests } from './tests'; diff --git a/examples/outgoing_http_requests/test/tests.ts b/examples/outgoing_http_requests/test/tests.ts index ac967a2c58..e2b3b0d44b 100644 --- a/examples/outgoing_http_requests/test/tests.ts +++ b/examples/outgoing_http_requests/test/tests.ts @@ -1,9 +1,10 @@ import { ActorSubclass } from '@dfinity/agent'; -import { Test } from 'azle/test'; -import { _SERVICE } from './dfx_generated/outgoing_http_requests/outgoing_http_requests.did'; import { HttpResponse } from 'azle/canisters/management'; +import { Test } from 'azle/test'; import decodeUtf8 from 'decode-utf8'; +import { _SERVICE } from './dfx_generated/outgoing_http_requests/outgoing_http_requests.did'; + export function getTests( outgoingHttpRequestsCanister: ActorSubclass<_SERVICE> ): Test[] { diff --git a/examples/plugins/src/index.ts b/examples/plugins/src/index.ts index 7b26b92804..8f2a5c78f7 100644 --- a/examples/plugins/src/index.ts +++ b/examples/plugins/src/index.ts @@ -1,6 +1,7 @@ // @ts-nocheck import { $query, $update } from 'azle'; + import { ExecuteResult, QueryResult, SQLite } from '../ic_sqlite_plugin'; $update; diff --git a/examples/plugins/test/test.ts b/examples/plugins/test/test.ts index 56e72a1da2..3920448dbf 100644 --- a/examples/plugins/test/test.ts +++ b/examples/plugins/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/plugins'; import { getTests } from './tests'; diff --git a/examples/plugins/test/tests.ts b/examples/plugins/test/tests.ts index 6c344d6d15..0005e79658 100644 --- a/examples/plugins/test/tests.ts +++ b/examples/plugins/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/plugins/plugins.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests(pluginsCanister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/pre_and_post_upgrade/test/test.ts b/examples/pre_and_post_upgrade/test/test.ts index 470be4a663..3db1caacde 100644 --- a/examples/pre_and_post_upgrade/test/test.ts +++ b/examples/pre_and_post_upgrade/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../test/dfx_generated/pre_and_post_upgrade'; import { getTests } from './tests'; diff --git a/examples/pre_and_post_upgrade/test/tests.ts b/examples/pre_and_post_upgrade/test/tests.ts index 80cbcd125f..789d467ceb 100644 --- a/examples/pre_and_post_upgrade/test/tests.ts +++ b/examples/pre_and_post_upgrade/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; import { execSync } from 'child_process'; + import { _SERVICE } from './dfx_generated/pre_and_post_upgrade/pre_and_post_upgrade.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests( preAndPostUpgradeCanister: ActorSubclass<_SERVICE> diff --git a/examples/primitive_ops/benchmark/benchmark.ts b/examples/primitive_ops/benchmark/benchmark.ts index c7b21bbb33..f811fc2cfb 100644 --- a/examples/primitive_ops/benchmark/benchmark.ts +++ b/examples/primitive_ops/benchmark/benchmark.ts @@ -1,4 +1,5 @@ import { Benchmark, run_benchmarks } from 'azle/benchmark'; + import { createActor as createActorAzle } from '../dfx_generated/azle'; import { createActor as createActorMotoko } from '../dfx_generated/motoko'; import { createActor as createActorRust } from '../dfx_generated/rust'; diff --git a/examples/primitive_ops/canisters/azle/data_types/blob/index.ts b/examples/primitive_ops/canisters/azle/data_types/blob/index.ts index 1db1e6549f..9465aec6fc 100644 --- a/examples/primitive_ops/canisters/azle/data_types/blob/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/blob/index.ts @@ -1,4 +1,5 @@ -import { ic, blob, nat32, update } from 'azle'; +import { blob, ic, nat32, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let blob_init_heap_storage: { [key: string]: blob | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/boolean/index.ts b/examples/primitive_ops/canisters/azle/data_types/boolean/index.ts index 96d5d9fb88..71cff9ebd8 100644 --- a/examples/primitive_ops/canisters/azle/data_types/boolean/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/boolean/index.ts @@ -1,4 +1,5 @@ import { ic, nat32, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let boolean_init_heap_storage: { [key: string]: boolean | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/float/float32.ts b/examples/primitive_ops/canisters/azle/data_types/float/float32.ts index 09b6fd2955..c25c160821 100644 --- a/examples/primitive_ops/canisters/azle/data_types/float/float32.ts +++ b/examples/primitive_ops/canisters/azle/data_types/float/float32.ts @@ -1,4 +1,5 @@ -import { ic, float32, nat32, update } from 'azle'; +import { float32, ic, nat32, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let float32_init_heap_storage: { [key: string]: float32 | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/float/float64.ts b/examples/primitive_ops/canisters/azle/data_types/float/float64.ts index 7dfda59776..4b72564d69 100644 --- a/examples/primitive_ops/canisters/azle/data_types/float/float64.ts +++ b/examples/primitive_ops/canisters/azle/data_types/float/float64.ts @@ -1,4 +1,5 @@ -import { ic, float64, nat32, update } from 'azle'; +import { float64, ic, nat32, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let heap_storage: { [key: string]: float64 | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/int/int.ts b/examples/primitive_ops/canisters/azle/data_types/int/int.ts index ddedd5b46d..718eedc3d2 100644 --- a/examples/primitive_ops/canisters/azle/data_types/int/int.ts +++ b/examples/primitive_ops/canisters/azle/data_types/int/int.ts @@ -1,4 +1,5 @@ import { ic, int, nat32, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let int_init_heap_storage: { [key: string]: int | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/int/int16.ts b/examples/primitive_ops/canisters/azle/data_types/int/int16.ts index c361f969de..f37265cb91 100644 --- a/examples/primitive_ops/canisters/azle/data_types/int/int16.ts +++ b/examples/primitive_ops/canisters/azle/data_types/int/int16.ts @@ -1,4 +1,5 @@ import { ic, int16, nat32, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let int16_init_heap_storage: { [key: string]: int16 | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/int/int32.ts b/examples/primitive_ops/canisters/azle/data_types/int/int32.ts index b7f69853aa..bade6c3ebb 100644 --- a/examples/primitive_ops/canisters/azle/data_types/int/int32.ts +++ b/examples/primitive_ops/canisters/azle/data_types/int/int32.ts @@ -1,4 +1,5 @@ import { ic, int32, nat32, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let int32_init_heap_storage: { [key: string]: int32 | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/int/int64.ts b/examples/primitive_ops/canisters/azle/data_types/int/int64.ts index ebd32a891a..112bcbb65d 100644 --- a/examples/primitive_ops/canisters/azle/data_types/int/int64.ts +++ b/examples/primitive_ops/canisters/azle/data_types/int/int64.ts @@ -1,4 +1,5 @@ import { ic, int64, nat32, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let int64_init_heap_storage: { [key: string]: int64 | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/int/int8.ts b/examples/primitive_ops/canisters/azle/data_types/int/int8.ts index 9182b0ffea..4e9b927f5d 100644 --- a/examples/primitive_ops/canisters/azle/data_types/int/int8.ts +++ b/examples/primitive_ops/canisters/azle/data_types/int/int8.ts @@ -1,4 +1,5 @@ import { ic, int8, nat32, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let int8_init_heap_storage: { [key: string]: int8 | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/nat/nat.ts b/examples/primitive_ops/canisters/azle/data_types/nat/nat.ts index f2bf94b25c..dc8d315712 100644 --- a/examples/primitive_ops/canisters/azle/data_types/nat/nat.ts +++ b/examples/primitive_ops/canisters/azle/data_types/nat/nat.ts @@ -1,4 +1,5 @@ import { ic, nat, nat32, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let nat_init_heap_storage: { [key: string]: nat | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/nat/nat16.ts b/examples/primitive_ops/canisters/azle/data_types/nat/nat16.ts index 5860bf75f1..8d0482af14 100644 --- a/examples/primitive_ops/canisters/azle/data_types/nat/nat16.ts +++ b/examples/primitive_ops/canisters/azle/data_types/nat/nat16.ts @@ -1,4 +1,5 @@ import { ic, nat16, nat32, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let nat16_init_heap_storage: { [key: string]: nat16 | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/nat/nat32.ts b/examples/primitive_ops/canisters/azle/data_types/nat/nat32.ts index 4e56043020..181a31f60d 100644 --- a/examples/primitive_ops/canisters/azle/data_types/nat/nat32.ts +++ b/examples/primitive_ops/canisters/azle/data_types/nat/nat32.ts @@ -1,4 +1,5 @@ import { ic, nat32, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let nat32_init_heap_storage: { [key: string]: nat32 | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/nat/nat64.ts b/examples/primitive_ops/canisters/azle/data_types/nat/nat64.ts index 9207d09b32..0b3873a877 100644 --- a/examples/primitive_ops/canisters/azle/data_types/nat/nat64.ts +++ b/examples/primitive_ops/canisters/azle/data_types/nat/nat64.ts @@ -1,4 +1,5 @@ import { ic, nat32, nat64, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let nat64_init_heap_storage: { [key: string]: nat64 | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/nat/nat8.ts b/examples/primitive_ops/canisters/azle/data_types/nat/nat8.ts index 1c6d1c566e..0669b82ba5 100644 --- a/examples/primitive_ops/canisters/azle/data_types/nat/nat8.ts +++ b/examples/primitive_ops/canisters/azle/data_types/nat/nat8.ts @@ -1,4 +1,5 @@ import { ic, nat8, nat32, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let nat8_init_heap_storage: { [key: string]: nat8 | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/null/index.ts b/examples/primitive_ops/canisters/azle/data_types/null/index.ts index 93bf49f5cd..7232157dab 100644 --- a/examples/primitive_ops/canisters/azle/data_types/null/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/null/index.ts @@ -1,4 +1,5 @@ import { ic, nat32, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let null_init_heap_storage: { [key: string]: null | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/opt/index.ts b/examples/primitive_ops/canisters/azle/data_types/opt/index.ts index f6e271e0cd..6d9c6a2e20 100644 --- a/examples/primitive_ops/canisters/azle/data_types/opt/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/opt/index.ts @@ -1,4 +1,5 @@ import { ic, nat32, None, Opt, Some, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let opt_init_heap_storage: { [key: string]: Opt | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/principal/index.ts b/examples/primitive_ops/canisters/azle/data_types/principal/index.ts index e37efeba49..5551fb54ac 100644 --- a/examples/primitive_ops/canisters/azle/data_types/principal/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/principal/index.ts @@ -1,4 +1,5 @@ import { ic, nat32, Principal, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let principal_init_heap_storage: { [key: string]: Principal | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/record/index.ts b/examples/primitive_ops/canisters/azle/data_types/record/index.ts index a49c0204d6..6ddfcb4b68 100644 --- a/examples/primitive_ops/canisters/azle/data_types/record/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/record/index.ts @@ -1,4 +1,5 @@ import { blob, float32, ic, nat32, Principal, update } from 'azle'; + import { PerfResult } from '../../perf_result'; type User = { diff --git a/examples/primitive_ops/canisters/azle/data_types/text/index.ts b/examples/primitive_ops/canisters/azle/data_types/text/index.ts index 847cb199a4..36ce13f533 100644 --- a/examples/primitive_ops/canisters/azle/data_types/text/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/text/index.ts @@ -1,4 +1,5 @@ import { ic, nat32, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let text_init_heap_storage: { [key: string]: string | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/data_types/variant/index.ts b/examples/primitive_ops/canisters/azle/data_types/variant/index.ts index 66acc56303..b858aca388 100644 --- a/examples/primitive_ops/canisters/azle/data_types/variant/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/variant/index.ts @@ -1,4 +1,5 @@ import { ic, nat32, Null, Principal, update, Variant } from 'azle'; + import { PerfResult } from '../../perf_result'; const Reaction = Variant({ diff --git a/examples/primitive_ops/canisters/azle/data_types/vec/index.ts b/examples/primitive_ops/canisters/azle/data_types/vec/index.ts index d44d34d2a3..ab15b11a5d 100644 --- a/examples/primitive_ops/canisters/azle/data_types/vec/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/vec/index.ts @@ -1,4 +1,5 @@ import { ic, nat32, update } from 'azle'; + import { PerfResult } from '../../perf_result'; let vec_init_heap_storage: { [key: string]: nat32[] | undefined } = {}; diff --git a/examples/primitive_ops/canisters/azle/index.ts b/examples/primitive_ops/canisters/azle/index.ts index 3fa50fe7f2..657e72ce73 100644 --- a/examples/primitive_ops/canisters/azle/index.ts +++ b/examples/primitive_ops/canisters/azle/index.ts @@ -1,4 +1,5 @@ import { Canister, ic, update } from 'azle'; + import { PerfResult } from './perf_result'; const empty = update([], PerfResult, () => { @@ -11,36 +12,36 @@ const empty = update([], PerfResult, () => { }; }); -import { blob_init_stack, blob_init_heap } from './data_types/blob'; -import { boolean_init_stack, boolean_init_heap } from './data_types/boolean'; +import { blob_init_heap, blob_init_stack } from './data_types/blob'; +import { boolean_init_heap, boolean_init_stack } from './data_types/boolean'; import { - float32_init_stack, - float32_init_heap + float32_init_heap, + float32_init_stack } from './data_types/float/float32'; import { - float64_init_stack, - float64_init_heap + float64_init_heap, + float64_init_stack } from './data_types/float/float64'; -import { int_init_stack, int_init_heap } from './data_types/int/int'; -import { int8_init_stack, int8_init_heap } from './data_types/int/int8'; -import { int16_init_stack, int16_init_heap } from './data_types/int/int16'; -import { int32_init_stack, int32_init_heap } from './data_types/int/int32'; -import { int64_init_stack, int64_init_heap } from './data_types/int/int64'; -import { nat_init_stack, nat_init_heap } from './data_types/nat/nat'; -import { nat8_init_stack, nat8_init_heap } from './data_types/nat/nat8'; -import { nat16_init_stack, nat16_init_heap } from './data_types/nat/nat16'; -import { nat32_init_stack, nat32_init_heap } from './data_types/nat/nat32'; -import { nat64_init_stack, nat64_init_heap } from './data_types/nat/nat64'; -import { null_init_stack, null_init_heap } from './data_types/null'; -import { opt_init_stack, opt_init_heap } from './data_types/opt'; +import { int_init_heap, int_init_stack } from './data_types/int/int'; +import { int8_init_heap, int8_init_stack } from './data_types/int/int8'; +import { int16_init_heap, int16_init_stack } from './data_types/int/int16'; +import { int32_init_heap, int32_init_stack } from './data_types/int/int32'; +import { int64_init_heap, int64_init_stack } from './data_types/int/int64'; +import { nat_init_heap, nat_init_stack } from './data_types/nat/nat'; +import { nat8_init_heap, nat8_init_stack } from './data_types/nat/nat8'; +import { nat16_init_heap, nat16_init_stack } from './data_types/nat/nat16'; +import { nat32_init_heap, nat32_init_stack } from './data_types/nat/nat32'; +import { nat64_init_heap, nat64_init_stack } from './data_types/nat/nat64'; +import { null_init_heap, null_init_stack } from './data_types/null'; +import { opt_init_heap, opt_init_stack } from './data_types/opt'; import { - principal_init_stack, - principal_init_heap + principal_init_heap, + principal_init_stack } from './data_types/principal'; -import { record_init_stack, record_init_heap } from './data_types/record'; -import { text_init_stack, text_init_heap } from './data_types/text'; -import { variant_init_stack, variant_init_heap } from './data_types/variant'; -import { vec_init_stack, vec_init_heap } from './data_types/vec'; +import { record_init_heap, record_init_stack } from './data_types/record'; +import { text_init_heap, text_init_stack } from './data_types/text'; +import { variant_init_heap, variant_init_stack } from './data_types/variant'; +import { vec_init_heap, vec_init_stack } from './data_types/vec'; export default Canister({ empty, diff --git a/examples/primitive_types/src/index.ts b/examples/primitive_types/src/index.ts index 5cfa825322..53fcf958f3 100644 --- a/examples/primitive_types/src/index.ts +++ b/examples/primitive_types/src/index.ts @@ -5,15 +5,15 @@ import { float32, float64, int, + int8, int16, int32, int64, - int8, nat, + nat8, nat16, nat32, nat64, - nat8, Null, Principal, query, diff --git a/examples/primitive_types/test/test.ts b/examples/primitive_types/test/test.ts index 1b876d3df0..c2a2667065 100644 --- a/examples/primitive_types/test/test.ts +++ b/examples/primitive_types/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../test/dfx_generated/primitive_types'; import { getTests } from './tests'; diff --git a/examples/primitive_types/test/tests.ts b/examples/primitive_types/test/tests.ts index c6c15fcc7f..4a672f2cc3 100644 --- a/examples/primitive_types/test/tests.ts +++ b/examples/primitive_types/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Principal } from '@dfinity/principal'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/primitive_types/primitive_types.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests( primitiveTypesCanister: ActorSubclass<_SERVICE> diff --git a/examples/principal/test/test.ts b/examples/principal/test/test.ts index 909dc98e2c..2299237388 100644 --- a/examples/principal/test/test.ts +++ b/examples/principal/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../test/dfx_generated/principal'; import { getTests } from './tests'; diff --git a/examples/principal/test/tests.ts b/examples/principal/test/tests.ts index d08fa10edf..fd5670591c 100644 --- a/examples/principal/test/tests.ts +++ b/examples/principal/test/tests.ts @@ -1,6 +1,7 @@ -import { Principal } from '@dfinity/principal'; import { ActorSubclass } from '@dfinity/agent'; +import { Principal } from '@dfinity/principal'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/principal/principal.did'; export function getTests(principalCanister: ActorSubclass<_SERVICE>): Test[] { diff --git a/examples/query/test/test.ts b/examples/query/test/test.ts index affbfb188c..6c30d9b368 100644 --- a/examples/query/test/test.ts +++ b/examples/query/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/query'; import { getTests } from './tests'; diff --git a/examples/query/test/tests.ts b/examples/query/test/tests.ts index ecb7ca0fee..7d6d7e002b 100644 --- a/examples/query/test/tests.ts +++ b/examples/query/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + // @ts-ignore import { _SERVICE } from '../dfx_generated/query/query.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests(query_canister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/randomness/test/test.ts b/examples/randomness/test/test.ts index a165382122..99939a0cdc 100644 --- a/examples/randomness/test/test.ts +++ b/examples/randomness/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/randomness'; import { getTests } from './tests'; diff --git a/examples/randomness/test/tests.ts b/examples/randomness/test/tests.ts index 0fa8e36afb..e9139538c3 100644 --- a/examples/randomness/test/tests.ts +++ b/examples/randomness/test/tests.ts @@ -1,6 +1,7 @@ import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; import { execSync } from 'child_process'; + import { _SERVICE } from './dfx_generated/randomness/randomness.did'; let globalResults: Set = new Set(); diff --git a/examples/recursion/src/recursion/index.ts b/examples/recursion/src/recursion/index.ts index 279bbcd908..f761561a1e 100644 --- a/examples/recursion/src/recursion/index.ts +++ b/examples/recursion/src/recursion/index.ts @@ -1,21 +1,22 @@ import { + Canister, Func, ic, + int8, None, + Opt, Principal, query, - Canister, + Record, + Recursive, + serialize, Some, Tuple, update, - Vec, - Record, - Recursive, - int8, Variant, - Opt, - serialize + Vec } from 'azle'; + import MyFullCanister from '../recursive_canister'; // These are the types that can be recursive diff --git a/examples/recursion/src/recursive_canister/index.ts b/examples/recursion/src/recursive_canister/index.ts index dc76437737..5f3e8078b1 100644 --- a/examples/recursion/src/recursive_canister/index.ts +++ b/examples/recursion/src/recursive_canister/index.ts @@ -1,4 +1,4 @@ -import { query, Canister, Recursive, text, init } from 'azle'; +import { Canister, init, query, Recursive, text } from 'azle'; let myMessage = ''; diff --git a/examples/recursion/test/pretest.ts b/examples/recursion/test/pretest.ts index e25a7a13b4..7d9615d60a 100644 --- a/examples/recursion/test/pretest.ts +++ b/examples/recursion/test/pretest.ts @@ -1,5 +1,5 @@ -import { execSync } from 'child_process'; import { getCanisterId } from 'azle/dfx'; +import { execSync } from 'child_process'; async function pretest() { execSync(`dfx canister uninstall-code recursive_canister || true`, { diff --git a/examples/recursion/test/test.ts b/examples/recursion/test/test.ts index 668a921142..a627ea5d22 100644 --- a/examples/recursion/test/test.ts +++ b/examples/recursion/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + // @ts-ignore import { createActor } from './dfx_generated/recursion'; // @ts-ignore diff --git a/examples/recursion/test/tests.ts b/examples/recursion/test/tests.ts index d62ef551e9..01e1246c90 100644 --- a/examples/recursion/test/tests.ts +++ b/examples/recursion/test/tests.ts @@ -1,24 +1,25 @@ +import { ActorSubclass } from '@dfinity/agent'; +import { Principal } from '@dfinity/principal'; import { getCanisterId } from 'azle/dfx'; import { Test } from 'azle/test'; +import { execSync } from 'child_process'; + import { _SERVICE, rec_0, + rec_2, + rec_4, + rec_6, + rec_8, rec_10, rec_12, rec_14, - rec_2, rec_24, - rec_26, - rec_4, - rec_6, - rec_8 + rec_26 // @ts-ignore } from './dfx_generated/recursion/recursion.did'; // @ts-ignore import { _SERVICE as _REC_SERVICE } from './dfx_generated/recursive_canister/recursive_canister.did'; -import { ActorSubclass } from '@dfinity/agent'; -import { Principal } from '@dfinity/principal'; -import { execSync } from 'child_process'; // TODO these tests should be rewritten to use @dfinity/agent once this issue is resolved: https://github.com/dfinity/agent-js/issues/702 // TODO this issue also needs to be resolved: https://forum.dfinity.org/t/services-wont-deserialize-properly-if-functions-arent-in-alphabetical-order/20885 diff --git a/examples/rejections/src/rejections/index.ts b/examples/rejections/src/rejections/index.ts index ac908c7321..21ac7aacee 100644 --- a/examples/rejections/src/rejections/index.ts +++ b/examples/rejections/src/rejections/index.ts @@ -9,6 +9,7 @@ import { update, Void } from 'azle'; + import SomeCanister from '../some_canister'; const Nonexistent = Canister({ diff --git a/examples/rejections/test/test.ts b/examples/rejections/test/test.ts index b5ca29367d..095ad78ff8 100644 --- a/examples/rejections/test/test.ts +++ b/examples/rejections/test/test.ts @@ -1,4 +1,5 @@ import { runTests } from 'azle/test'; + import { getCanisterId } from '../../../dfx'; import { createActor } from './dfx_generated/rejections'; import { getTests } from './tests'; diff --git a/examples/rejections/test/tests.ts b/examples/rejections/test/tests.ts index 72c2d4ad09..9e915f16e1 100644 --- a/examples/rejections/test/tests.ts +++ b/examples/rejections/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/rejections/rejections.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests(rejectionsCanister: ActorSubclass<_SERVICE>): Test[] { return [ @@ -48,9 +49,10 @@ export function getTests(rejectionsCanister: ActorSubclass<_SERVICE>): Test[] { name: 'reject message', test: async () => { const rejectionMessage = 'custom rejection message'; - const result = await rejectionsCanister.getRejectionMessage( - rejectionMessage - ); + const result = + await rejectionsCanister.getRejectionMessage( + rejectionMessage + ); return { Ok: result === rejectionMessage }; diff --git a/examples/robust_imports/src/azle_coverage/fruit.ts b/examples/robust_imports/src/azle_coverage/fruit.ts index 27cdf35cf0..6c47f9c089 100644 --- a/examples/robust_imports/src/azle_coverage/fruit.ts +++ b/examples/robust_imports/src/azle_coverage/fruit.ts @@ -2,20 +2,21 @@ import { query as kiwi } from 'azle'; export default kiwi; export { - bool as blackberry, blob as banana, + bool as blackberry, empty as elderberry, + Func as Farkleberry, float32 as fig32, float64 as fig64, - Func as Farkleberry, heartbeat as honeydew, init as icaco, - inspectMessage as ilama, int as iceApple, int8 as iceApple8, int16 as iceApple16, int32 as iceApple32, int64 as iceApple64, + inspectMessage as ilama, + Vec as Lime, Manual as Mango, nat as nectarine, nat8 as nectarine8, @@ -24,19 +25,18 @@ export { nat64 as nectarine64, Null as Nutmeg, Opt as Olive, - postUpgrade as pomegranate, - preUpgrade as pineapple, - Principal as peach, Principal as Peach, + Principal as peach, + preUpgrade as pineapple, + postUpgrade as pomegranate, query as quince, - Record as Raspberry, reserved as rambutan, - Canister as Strawberry, + Record as Raspberry, StableBTreeMap as Soncoya, - text as tangerine, + Canister as Strawberry, Tuple as Tamarind, + text as tangerine, update as ugni, - Variant as Voavanga, - Vec as Lime, - Void as Vanilla + Void as Vanilla, + Variant as Voavanga } from 'azle'; diff --git a/examples/robust_imports/src/azle_coverage/index.ts b/examples/robust_imports/src/azle_coverage/index.ts index 8ac3e06b1a..0de5dd0de8 100644 --- a/examples/robust_imports/src/azle_coverage/index.ts +++ b/examples/robust_imports/src/azle_coverage/index.ts @@ -1,18 +1,21 @@ +import { ic, ic as lemon, int16 as coconut } from 'azle'; + import kiwi, { banana, blackberry, elderberry, + Farkleberry, fig32, fig64, - Farkleberry, honeydew, icaco, - ilama, iceApple, iceApple8, iceApple16, iceApple32, iceApple64, + ilama, + Lime, Mango, nectarine, nectarine8, @@ -21,24 +24,21 @@ import kiwi, { nectarine64, Nutmeg, Olive, - pomegranate, - pineapple, - peach, Peach, + peach, + pineapple, + pomegranate, quince, - Raspberry, rambutan, - Strawberry, + Raspberry, Soncoya, - tangerine, + Strawberry, Tamarind, + tangerine, ugni, - Voavanga, - Lime, - Vanilla + Vanilla, + Voavanga } from './fruit'; - -import { ic as lemon, int16 as coconut, ic } from 'azle'; import * as starFruit from './fruit'; const FruitDeliveryCanister = Strawberry({ diff --git a/examples/robust_imports/src/import_coverage/index.ts b/examples/robust_imports/src/import_coverage/index.ts index 5e13b67843..01e7a7cbdb 100644 --- a/examples/robust_imports/src/import_coverage/index.ts +++ b/examples/robust_imports/src/import_coverage/index.ts @@ -1,8 +1,8 @@ import icQuery, * as ic from './types'; -import { text, text as mT, text as mDT, text as mCT } from './types'; +import { text as mCT, text as mDT, text as mT, text } from './types'; import dollarSignQuery from './types'; import query, { int8, int8 as variInt } from './types'; -import { CoveredOpt, CoveredVec, coveredInt16 } from './types'; +import { coveredInt16, CoveredOpt, CoveredVec } from './types'; export const MyCoveredRecord = ic.CoveredRecord({ count: ic.fathomlessStar.DeepInt8, diff --git a/examples/robust_imports/src/import_coverage/types.ts b/examples/robust_imports/src/import_coverage/types.ts index a97737e857..79bd551059 100644 --- a/examples/robust_imports/src/import_coverage/types.ts +++ b/examples/robust_imports/src/import_coverage/types.ts @@ -25,10 +25,12 @@ Import Clause breakdown */ //1) ImportedDefaultBinding (thing) (import thing from 'thing') -import deepDefault from '../types/deep/shallow'; +import * as azle from 'azle'; +//6 Type import +import { Opt, Vec as CoveredVec } from 'azle'; + //2) NameSpaceImport (* as thing) (import * as thing from 'thing') import * as deepStar from '../types/deep'; -import * as azle from 'azle'; //3) NamedImports //a) ({}) (import {} from 'thing') import {} from '../types/deep'; @@ -47,7 +49,7 @@ import { } from '../types/deep'; //c) Combos //i) ({thing1, thing2 as other2}) ({thing1, thing2 as other2}) -import { DeepVariant, DeepInt8 as ProfoundInt8 } from '../types/deep'; +import { DeepInt8 as ProfoundInt8, DeepVariant } from '../types/deep'; //ii) ({thing1 as other1, thing2}) ({thing1, thing2 as other2}) import { DeepRecord as FathomlessRecord, DeepVec } from '../types/deep'; //4) ImportedDefaultBinding, NameSpaceImport (thing, * as other from 'thing') @@ -56,14 +58,13 @@ import profoundDefault, * as profoundStar from '../types/deep'; import bottomlessDefault, { DeepTuple as BottomlessTuple } from '../types/deep'; //a) there could be all sorts of combos in here import cavernousDefault, { - DeepTuple as CavernousTuple, DeepOpt, + DeepTuple as CavernousTuple, DeepVariant as CavernousVariant } from '../types/deep'; -//6 Type import -import { Opt, Vec as CoveredVec } from 'azle'; //7 Default import as import { default as defaultInt16 } from '../types/deep'; +import deepDefault from '../types/deep/shallow'; /* From https://262.ecma-international.org/13.0/#sec-exports 16.2.3 @@ -92,8 +93,8 @@ From https://262.ecma-international.org/13.0/#sec-exports 16.2.3 //1) export ExportFromClause FromClause ; //a) * -export * from 'azle'; export * from '../types/deep'; // TODO support having multiple export * from declarations +export * from 'azle'; //b) * as ModuleExportName export * as azle from 'azle'; //c) NamedExports @@ -105,32 +106,32 @@ export { Record } from 'azle'; //ii) thing as other export { Variant as CoveredVariant } from 'azle'; //iii) combos -export { Tuple as CoveredTuple, Vec, int64 as nat8 } from 'azle'; +export { Tuple as CoveredTuple, int64 as nat8, Vec } from 'azle'; //2) export NamedExports ; export {}; export { DeepVariant }; export { ProfoundInt8 as DeepInt8 }; export { - deepDefault as fathomlessCanister, - deepStar as fathomlessStar, - DeepRecord as CoveredRecord, - CavernousRecord, - DeepTuple, - BottomlessInt8 as FathomlessInt8, - BottomlessVariant as FathomlessVariant, - BottomlessTuple as FathomlessTuple, - FathomlessRecord, - DeepVec as FathomlessVec, - profoundStar, - profoundDefault, bottomlessDefault, cavernousDefault, + CavernousRecord, CavernousTuple, - DeepOpt as FathomlessOpt, CavernousVariant, + defaultInt16 as coveredInt16, Opt as CoveredOpt, + DeepRecord as CoveredRecord, CoveredVec, - defaultInt16 as coveredInt16 + DeepTuple, + deepDefault as fathomlessCanister, + BottomlessInt8 as FathomlessInt8, + DeepOpt as FathomlessOpt, + FathomlessRecord, + deepStar as fathomlessStar, + BottomlessTuple as FathomlessTuple, + BottomlessVariant as FathomlessVariant, + DeepVec as FathomlessVec, + profoundDefault, + profoundStar }; export { DeepInt8 as CoverInt8 }; export type CoveredText = azle.text; diff --git a/examples/robust_imports/src/index.ts b/examples/robust_imports/src/index.ts index ba63406a44..7ee23b955c 100644 --- a/examples/robust_imports/src/index.ts +++ b/examples/robust_imports/src/index.ts @@ -1,64 +1,65 @@ // Named Imports +// Not Named Imports +import './azle_coverage/fruit'; // Shouldn't do anything. It's just here to make sure it doesn't do anything + import { Canister } from 'azle'; + import { - myVariantToMyDeepVariant, - myFathomlessVariantToMyCavernousVariant, - returnVec, - returnFathomlessVec, - returnWeird, - returnFathomlessCanister, - makeCavernousRecord, - typeCheck -} from './import_coverage'; -import { - collectIcaco, - cutPineapple, - separateArilsFromPith, - buyHoneydew, - keepIlamaClean, addSigFigs, + buyHoneydew, checkCanister, checkWatermelonForSeeds, + collectIcaco, compareApplesToOranges, - handleFarkleberries, + cutPineapple, + dirtyIlama, getManagementPeach, - pitOlives, + handleFarkleberries, + isFruitPrepared, + isMangoTrickyToEat, + keepIlamaClean, peelBanana, + pickElderberry, + pitOlives, putTheCoconutInTheLime, - isMangoTrickyToEat, - isFruitPrepared, removeRambutanSkins, - dirtyIlama, - pickElderberry + separateArilsFromPith } from './azle_coverage'; import { + makeCavernousRecord, + myFathomlessVariantToMyCavernousVariant, + myVariantToMyDeepVariant, + returnFathomlessCanister, + returnFathomlessVec, + returnVec, + returnWeird, + typeCheck +} from './import_coverage'; +import { checkPrimAliases } from './ts_primitives'; +import { + checkCanisterAlias, compareStars, - helloTextAlias, - helloAzleTextAlias, - helloMixedTextAlias, - helloDeepTextAlias, - helloStirredTextAlias, - getDeepBlob, deepEmptyAlias, - getNumberAliases, - passPrincipal, - getReservedAlias, - simpleDeepQuery, - simpleAzleQuery, - simpleQuery, - checkCanisterAlias, + getDeepBlob, + getManualAlias, getMyRecord, getMyRecordAlias, + getNumberAliases, + getReservedAlias, + getStable, getSuperAlias, - getManualAlias, + helloAzleTextAlias, + helloDeepTextAlias, + helloMixedTextAlias, + helloStirredTextAlias, + helloTextAlias, + passPrincipal, returnFuncAlias, setStable, - getStable + simpleAzleQuery, + simpleDeepQuery, + simpleQuery } from './type_alias_decls'; -import { checkPrimAliases } from './ts_primitives'; - -// Not Named Imports -import './azle_coverage/fruit'; // Shouldn't do anything. It's just here to make sure it doesn't do anything export default Canister({ myVariantToMyDeepVariant, diff --git a/examples/robust_imports/src/type_alias_decls/index.ts b/examples/robust_imports/src/type_alias_decls/index.ts index 6b5abc341f..0919ef0bd8 100644 --- a/examples/robust_imports/src/type_alias_decls/index.ts +++ b/examples/robust_imports/src/type_alias_decls/index.ts @@ -1,6 +1,7 @@ -import * as types from './types'; import * as azle from 'azle'; +import * as types from './types'; + function offDuty() {} const HELLO_WORLD = 'Hello, World!'; @@ -22,9 +23,10 @@ const NumberAliases = azle.Record({ twelfth: LocalNumberAlias }); -import { MixedConcreteStar } from './types'; import { Result } from 'azle'; +import { MixedConcreteStar } from './types'; + export const compareStars = azle.query( [MixedConcreteStar, MixedConcreteStar], Result(azle.bool, azle.text), diff --git a/examples/robust_imports/src/type_alias_decls/types.ts b/examples/robust_imports/src/type_alias_decls/types.ts index d0ba2aad71..91d991ff40 100644 --- a/examples/robust_imports/src/type_alias_decls/types.ts +++ b/examples/robust_imports/src/type_alias_decls/types.ts @@ -1,10 +1,11 @@ +import * as azle from 'azle'; +import { int, query, Record } from 'azle'; + import * as deep from './deep_alias'; +import { deepAlias } from './deep_alias'; import * as mixed from './mixed_alias'; import { mixedAlias } from './mixed_alias'; import { mixedAlias as stirredAlias } from './mixed_alias'; -import { deepAlias } from './deep_alias'; -import * as azle from 'azle'; -import { Record, int, query } from 'azle'; export const AzleRecordAlias = azle.Record; export const AzleIntAlias = azle.int; diff --git a/examples/robust_imports/src/types/deep/index.ts b/examples/robust_imports/src/types/deep/index.ts index 7f088982e6..19462b9d08 100644 --- a/examples/robust_imports/src/types/deep/index.ts +++ b/examples/robust_imports/src/types/deep/index.ts @@ -1,9 +1,9 @@ export default DeepInt16; export { DeeperRecord as DeepRecord } from './deeper'; +export { DeeperInt8 as DeepInt8 } from './deeper'; export { Tuple as DeepTuple } from 'azle'; export { Opt as DeepOpt } from 'azle'; export { Variant as DeepVariant } from 'azle'; export { Vec as DeepVec } from 'azle'; -export { DeeperInt8 as DeepInt8 } from './deeper'; import DeepInt16 from './deeper'; export * as deepAzle from 'azle'; diff --git a/examples/robust_imports/test/test.ts b/examples/robust_imports/test/test.ts index e3bc0f89d7..c06c8294a7 100644 --- a/examples/robust_imports/test/test.ts +++ b/examples/robust_imports/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../dfx_generated/robust_imports'; import { getTests } from './tests'; diff --git a/examples/robust_imports/test/tests.ts b/examples/robust_imports/test/tests.ts index 31ada846db..12096f5933 100644 --- a/examples/robust_imports/test/tests.ts +++ b/examples/robust_imports/test/tests.ts @@ -1,8 +1,9 @@ -import { Test } from 'azle/test'; +import { ActorSubclass } from '@dfinity/agent'; import { Principal } from '@dfinity/principal'; +import { Test } from 'azle/test'; import { execSync } from 'child_process'; + import { _SERVICE } from '../dfx_generated/robust_imports/robust_imports.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests( robustImportsCanister: ActorSubclass<_SERVICE> diff --git a/examples/simple_erc20/test/test.ts b/examples/simple_erc20/test/test.ts index 4ef5f42a82..72c91d03d0 100644 --- a/examples/simple_erc20/test/test.ts +++ b/examples/simple_erc20/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../test/dfx_generated/simple_erc20'; import { getTests } from './tests'; diff --git a/examples/simple_erc20/test/tests.ts b/examples/simple_erc20/test/tests.ts index d538416ec5..0aa19a3541 100644 --- a/examples/simple_erc20/test/tests.ts +++ b/examples/simple_erc20/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/simple_erc20/simple_erc20.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests(simpleErc20Canister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/simple_user_accounts/test/test.ts b/examples/simple_user_accounts/test/test.ts index a1621230a3..dfff2e1300 100644 --- a/examples/simple_user_accounts/test/test.ts +++ b/examples/simple_user_accounts/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from '../test/dfx_generated/simple_user_accounts'; import { getTests } from './tests'; diff --git a/examples/simple_user_accounts/test/tests.ts b/examples/simple_user_accounts/test/tests.ts index 129e6664a9..3d7b17de37 100644 --- a/examples/simple_user_accounts/test/tests.ts +++ b/examples/simple_user_accounts/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/simple_user_accounts/simple_user_accounts.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests( simpleUserAccountsCanister: ActorSubclass<_SERVICE> @@ -9,9 +10,8 @@ export function getTests( { name: 'getUserById', test: async () => { - const result = await simpleUserAccountsCanister.getUserById( - '0' - ); + const result = + await simpleUserAccountsCanister.getUserById('0'); return { Ok: result.length === 0 @@ -31,9 +31,8 @@ export function getTests( { name: 'createUser', test: async () => { - const result = await simpleUserAccountsCanister.createUser( - 'lastmjs' - ); + const result = + await simpleUserAccountsCanister.createUser('lastmjs'); return { Ok: result.id === '0' && result.username === 'lastmjs' @@ -43,9 +42,8 @@ export function getTests( { name: 'getUserById', test: async () => { - const result = await simpleUserAccountsCanister.getUserById( - '0' - ); + const result = + await simpleUserAccountsCanister.getUserById('0'); return { Ok: diff --git a/examples/sqlite/test/test.ts b/examples/sqlite/test/test.ts index 5fead108f2..89fc73328b 100644 --- a/examples/sqlite/test/test.ts +++ b/examples/sqlite/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { getTests } from './tests'; const canisterId = getCanisterId('sqlite'); diff --git a/examples/stable_b_tree_map_instruction_threshold/test/test.ts b/examples/stable_b_tree_map_instruction_threshold/test/test.ts index 1648ba5a63..10f6927c05 100644 --- a/examples/stable_b_tree_map_instruction_threshold/test/test.ts +++ b/examples/stable_b_tree_map_instruction_threshold/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/stable_b_tree_map_instruction_threshold'; import { getTests } from './tests'; diff --git a/examples/stable_b_tree_map_instruction_threshold/test/tests.ts b/examples/stable_b_tree_map_instruction_threshold/test/tests.ts index 291d58c298..8f163993d9 100644 --- a/examples/stable_b_tree_map_instruction_threshold/test/tests.ts +++ b/examples/stable_b_tree_map_instruction_threshold/test/tests.ts @@ -1,5 +1,6 @@ import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/stable_b_tree_map_instruction_threshold/stable_b_tree_map_instruction_threshold.did'; export function getTests( diff --git a/examples/stable_memory/test/test.ts b/examples/stable_memory/test/test.ts index def8e127eb..469b7166db 100644 --- a/examples/stable_memory/test/test.ts +++ b/examples/stable_memory/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/stable_memory'; import { getTests } from './tests'; diff --git a/examples/stable_memory/test/tests.ts b/examples/stable_memory/test/tests.ts index 5b14c511db..6750e1c960 100644 --- a/examples/stable_memory/test/tests.ts +++ b/examples/stable_memory/test/tests.ts @@ -1,6 +1,7 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/stable_memory/stable_memory.did'; -import { ActorSubclass } from '@dfinity/agent'; const PAGE_SIZE = 65_536; // This should currently remain constant const MAX_STABLE_MEM_PAGES = 65_536; // This will always remain constant diff --git a/examples/stable_structures/src/canister1/index.ts b/examples/stable_structures/src/canister1/index.ts index 6cbb2e90dd..3d157410e7 100644 --- a/examples/stable_structures/src/canister1/index.ts +++ b/examples/stable_structures/src/canister1/index.ts @@ -1,4 +1,5 @@ import { bool, Canister, postUpgrade, query } from 'azle'; + import { stableMap0Methods } from './stable_map_0'; import { stableMap1Methods } from './stable_map_1'; import { stableMap2Methods } from './stable_map_2'; diff --git a/examples/stable_structures/src/canister1/stable_map_3.ts b/examples/stable_structures/src/canister1/stable_map_3.ts index 834279876b..f89520c395 100644 --- a/examples/stable_structures/src/canister1/stable_map_3.ts +++ b/examples/stable_structures/src/canister1/stable_map_3.ts @@ -9,6 +9,7 @@ import { update, Vec } from 'azle'; + import { Reaction } from '../types'; let stableMap3 = StableBTreeMap(3); diff --git a/examples/stable_structures/src/canister1/stable_map_4.ts b/examples/stable_structures/src/canister1/stable_map_4.ts index 20f2f91d2e..1a3882efd2 100644 --- a/examples/stable_structures/src/canister1/stable_map_4.ts +++ b/examples/stable_structures/src/canister1/stable_map_4.ts @@ -9,6 +9,7 @@ import { update, Vec } from 'azle'; + import { User } from '../types'; export let stableMap4 = StableBTreeMap(4); diff --git a/examples/stable_structures/src/canister2/index.ts b/examples/stable_structures/src/canister2/index.ts index ab3db1f8da..6c11cd1eba 100644 --- a/examples/stable_structures/src/canister2/index.ts +++ b/examples/stable_structures/src/canister2/index.ts @@ -1,4 +1,5 @@ import { bool, Canister, postUpgrade, query } from 'azle'; + import { stableMap5Methods } from './stable_map_5'; import { stableMap6Methods } from './stable_map_6'; import { stableMap7Methods } from './stable_map_7'; diff --git a/examples/stable_structures/src/canister2/stable_map_5.ts b/examples/stable_structures/src/canister2/stable_map_5.ts index 0ac3f24c76..6690ac12fb 100644 --- a/examples/stable_structures/src/canister2/stable_map_5.ts +++ b/examples/stable_structures/src/canister2/stable_map_5.ts @@ -4,11 +4,11 @@ import { nat64, Opt, query, - update, StableBTreeMap, - Vec, text, - Tuple + Tuple, + update, + Vec } from 'azle'; let stableMap5 = StableBTreeMap, float64>(5); diff --git a/examples/stable_structures/src/canister2/stable_map_6.ts b/examples/stable_structures/src/canister2/stable_map_6.ts index e5f16cf5b7..dafca6c8bf 100644 --- a/examples/stable_structures/src/canister2/stable_map_6.ts +++ b/examples/stable_structures/src/canister2/stable_map_6.ts @@ -3,10 +3,10 @@ import { nat64, Opt, query, - update, StableBTreeMap, - Vec, - Tuple + Tuple, + update, + Vec } from 'azle'; let stableMap6 = StableBTreeMap, bool>(6); diff --git a/examples/stable_structures/src/canister2/stable_map_8.ts b/examples/stable_structures/src/canister2/stable_map_8.ts index e0000200b7..f4bfc0b37f 100644 --- a/examples/stable_structures/src/canister2/stable_map_8.ts +++ b/examples/stable_structures/src/canister2/stable_map_8.ts @@ -4,10 +4,10 @@ import { Null, Opt, query, - update, StableBTreeMap, - Vec, - Tuple + Tuple, + update, + Vec } from 'azle'; let stableMap8 = StableBTreeMap(8); diff --git a/examples/stable_structures/src/canister2/stable_map_9.ts b/examples/stable_structures/src/canister2/stable_map_9.ts index a5a00f9933..295588c5e6 100644 --- a/examples/stable_structures/src/canister2/stable_map_9.ts +++ b/examples/stable_structures/src/canister2/stable_map_9.ts @@ -4,11 +4,11 @@ import { nat64, Opt, query, - update, StableBTreeMap, - Vec, text, - Tuple + Tuple, + update, + Vec } from 'azle'; let stableMap9 = StableBTreeMap>(9); diff --git a/examples/stable_structures/src/canister3/stable_map_11.ts b/examples/stable_structures/src/canister3/stable_map_11.ts index f14d8aa4b5..314b35a46c 100644 --- a/examples/stable_structures/src/canister3/stable_map_11.ts +++ b/examples/stable_structures/src/canister3/stable_map_11.ts @@ -9,6 +9,7 @@ import { update, Vec } from 'azle'; + import { User } from '../types'; let stableMap11 = StableBTreeMap(11); diff --git a/examples/stable_structures/src/canister3/stable_map_12.ts b/examples/stable_structures/src/canister3/stable_map_12.ts index b4b7eb4e2a..cafb19b87e 100644 --- a/examples/stable_structures/src/canister3/stable_map_12.ts +++ b/examples/stable_structures/src/canister3/stable_map_12.ts @@ -9,6 +9,7 @@ import { update, Vec } from 'azle'; + import { Reaction } from '../types'; let stableMap12 = StableBTreeMap(12); diff --git a/examples/stable_structures/src/canister3/stable_map_14.ts b/examples/stable_structures/src/canister3/stable_map_14.ts index 240ac823b8..48a4c39568 100644 --- a/examples/stable_structures/src/canister3/stable_map_14.ts +++ b/examples/stable_structures/src/canister3/stable_map_14.ts @@ -9,6 +9,7 @@ import { update, Vec } from 'azle'; + import { Callback } from '../types'; let stableMap14 = StableBTreeMap(14); diff --git a/examples/stable_structures/src/canister3/stable_map_15.ts b/examples/stable_structures/src/canister3/stable_map_15.ts index 097fdbbd66..d7a48d68c6 100644 --- a/examples/stable_structures/src/canister3/stable_map_15.ts +++ b/examples/stable_structures/src/canister3/stable_map_15.ts @@ -9,6 +9,7 @@ import { update, Vec } from 'azle'; + import { Callback } from '../types'; let stableMap15 = StableBTreeMap(15); diff --git a/examples/stable_structures/test/test.ts b/examples/stable_structures/test/test.ts index f3755a7bd7..7cef79c6f3 100644 --- a/examples/stable_structures/test/test.ts +++ b/examples/stable_structures/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor as createActorCanister1 } from './dfx_generated/canister1'; import { createActor as createActorCanister2 } from './dfx_generated/canister2'; import { createActor as createActorCanister3 } from './dfx_generated/canister3'; diff --git a/examples/stable_structures/test/tests.ts b/examples/stable_structures/test/tests.ts index d7aacc71ef..69b97b6f66 100644 --- a/examples/stable_structures/test/tests.ts +++ b/examples/stable_structures/test/tests.ts @@ -1,9 +1,3 @@ -import { Test } from 'azle/test'; -import { execSync } from 'child_process'; -import { _SERVICE as CANISTER1_SERVICE } from './dfx_generated/canister1/canister1.did'; -import { Reaction, User } from '../src/types'; -import { _SERVICE as CANISTER2_SERVICE } from './dfx_generated/canister2/canister2.did'; -import { _SERVICE as CANISTER3_SERVICE } from './dfx_generated/canister3/canister3.did'; import { ActorSubclass } from '@dfinity/agent'; import { Principal } from '@dfinity/principal'; import { @@ -12,11 +6,18 @@ import { float64, int, nat, + nat8, nat16, nat32, - nat64, - nat8 + nat64 } from 'azle'; +import { Test } from 'azle/test'; +import { execSync } from 'child_process'; + +import { Reaction, User } from '../src/types'; +import { _SERVICE as CANISTER1_SERVICE } from './dfx_generated/canister1/canister1.did'; +import { _SERVICE as CANISTER2_SERVICE } from './dfx_generated/canister2/canister2.did'; +import { _SERVICE as CANISTER3_SERVICE } from './dfx_generated/canister3/canister3.did'; type _SERVICE = CANISTER1_SERVICE | CANISTER2_SERVICE | CANISTER3_SERVICE; diff --git a/examples/tfjs/src/api.ts b/examples/tfjs/src/api.ts index ae171fa2f7..36f3347596 100644 --- a/examples/tfjs/src/api.ts +++ b/examples/tfjs/src/api.ts @@ -1,6 +1,6 @@ +import * as tf from '@tensorflow/tfjs'; import { ic } from 'azle'; import express from 'express'; -import * as tf from '@tensorflow/tfjs'; async function init() { const app = express(); diff --git a/examples/tfjs/test/test.ts b/examples/tfjs/test/test.ts index 3473f541a3..519e141ad2 100644 --- a/examples/tfjs/test/test.ts +++ b/examples/tfjs/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { getTests } from './tests'; const canisterId = getCanisterId('api'); diff --git a/examples/timers/test/test.ts b/examples/timers/test/test.ts index e394c2b1fc..8c5f04896e 100644 --- a/examples/timers/test/test.ts +++ b/examples/timers/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/timers'; import { getTests } from './tests'; diff --git a/examples/timers/test/tests.ts b/examples/timers/test/tests.ts index eea5ff2139..1bd4c5b7bb 100644 --- a/examples/timers/test/tests.ts +++ b/examples/timers/test/tests.ts @@ -1,5 +1,6 @@ import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/timers/timers.did'; let timerIds = { diff --git a/examples/tuple_types/src/index.ts b/examples/tuple_types/src/index.ts index 5f7ffa2d74..5659439d0f 100644 --- a/examples/tuple_types/src/index.ts +++ b/examples/tuple_types/src/index.ts @@ -1,21 +1,21 @@ import { - query, + Canister, // CallResult, int, - nat64, nat8, + nat64, Null, Principal, + query, Record, + Recursive, // Service, // serviceUpdate, text, Tuple, Variant, Vec, - Void, - Recursive, - Canister + Void } from 'azle'; // TODO maybe we should write tests for canister and stable storage? diff --git a/examples/tuple_types/test/test.ts b/examples/tuple_types/test/test.ts index d9cfa3bc8e..a3029418b9 100644 --- a/examples/tuple_types/test/test.ts +++ b/examples/tuple_types/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/tuple_types'; import { getTests } from './tests'; diff --git a/examples/tuple_types/test/tests.ts b/examples/tuple_types/test/tests.ts index b5f3a15819..4cfc3aa227 100644 --- a/examples/tuple_types/test/tests.ts +++ b/examples/tuple_types/test/tests.ts @@ -1,6 +1,7 @@ import { ActorSubclass } from '@dfinity/agent'; import { Principal } from '@dfinity/principal'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/tuple_types/tuple_types.did'; export function getTests(tupleTypesCanister: ActorSubclass<_SERVICE>): Test[] { diff --git a/examples/update/test/test.ts b/examples/update/test/test.ts index e1878571db..ca1b069e53 100644 --- a/examples/update/test/test.ts +++ b/examples/update/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { createActor } from './dfx_generated/update'; import { getTests } from './tests'; diff --git a/examples/update/test/tests.ts b/examples/update/test/tests.ts index e96dc84d08..9e00fa1760 100644 --- a/examples/update/test/tests.ts +++ b/examples/update/test/tests.ts @@ -1,7 +1,8 @@ +import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + // @ts-ignore import { _SERVICE } from '../dfx_generated/update/update.did'; -import { ActorSubclass } from '@dfinity/agent'; export function getTests(updateCanister: ActorSubclass<_SERVICE>): Test[] { return [ diff --git a/examples/vanilla_js/src/index.js b/examples/vanilla_js/src/index.js index 03156b1e02..2da24faf98 100644 --- a/examples/vanilla_js/src/index.js +++ b/examples/vanilla_js/src/index.js @@ -1,7 +1,8 @@ import { Canister, int, query, text } from 'azle'; -import { relativeImport } from './library'; import { sha224 } from 'js-sha256'; +import { relativeImport } from './library'; + export default Canister({ relativeImport: query([], text, () => { return relativeImport(); diff --git a/examples/vanilla_js/test/test.ts b/examples/vanilla_js/test/test.ts index d620e08749..480f406c73 100644 --- a/examples/vanilla_js/test/test.ts +++ b/examples/vanilla_js/test/test.ts @@ -1,5 +1,6 @@ -import { runTests } from 'azle/test'; import { getCanisterId } from 'azle/dfx'; +import { runTests } from 'azle/test'; + import { createActor } from '../test/dfx_generated/vanilla_js'; import { getTests } from './tests'; diff --git a/examples/vanilla_js/test/tests.ts b/examples/vanilla_js/test/tests.ts index 2b440862fd..31b0e5776c 100644 --- a/examples/vanilla_js/test/tests.ts +++ b/examples/vanilla_js/test/tests.ts @@ -1,5 +1,6 @@ import { ActorSubclass } from '@dfinity/agent'; import { Test } from 'azle/test'; + import { _SERVICE } from './dfx_generated/vanilla_js/vanilla_js.did'; export function getTests(vanillaJsCanister: ActorSubclass<_SERVICE>): Test[] { diff --git a/examples/web_assembly/test/test.ts b/examples/web_assembly/test/test.ts index e0270ea6b5..23b8952a1e 100644 --- a/examples/web_assembly/test/test.ts +++ b/examples/web_assembly/test/test.ts @@ -1,5 +1,6 @@ import { getCanisterId } from 'azle/dfx'; import { runTests } from 'azle/test'; + import { getTests } from './tests'; const canisterId = getCanisterId('web_assembly'); diff --git a/property_tests/arbitraries/candid/candid_definition_arb/complex_candid_definition_memo.ts b/property_tests/arbitraries/candid/candid_definition_arb/complex_candid_definition_memo.ts index 79218dbf52..05153d0fc0 100644 --- a/property_tests/arbitraries/candid/candid_definition_arb/complex_candid_definition_memo.ts +++ b/property_tests/arbitraries/candid/candid_definition_arb/complex_candid_definition_memo.ts @@ -1,5 +1,5 @@ import fc from 'fast-check'; -import { candidDefinitionMemo } from '.'; + import { BlobDefinitionArb } from '../constructed/blob_arb/definition_arb'; import { OptDefinitionArb } from '../constructed/opt_arb/definition_arb'; import { RecordDefinitionArb } from '../constructed/record_arb/definition_arb'; @@ -8,6 +8,7 @@ import { VariantDefinitionArb } from '../constructed/variant_arb/definition_arbs import { VecDefinitionArb } from '../constructed/vec_arb/definition_arb'; import { FuncDefinitionArb } from '../reference/func_arb/definition_arb'; import { ServiceDefinitionArb } from '../reference/service_arb/definition_arb'; +import { candidDefinitionMemo } from '.'; import { CandidDefinitionMemo, DefinitionConstraints, diff --git a/property_tests/arbitraries/candid/candid_definition_arb/index.ts b/property_tests/arbitraries/candid/candid_definition_arb/index.ts index c86ea1aa33..7d57c5e654 100644 --- a/property_tests/arbitraries/candid/candid_definition_arb/index.ts +++ b/property_tests/arbitraries/candid/candid_definition_arb/index.ts @@ -1,24 +1,25 @@ import fc from 'fast-check'; -import { - CandidDefinitionArb, - RecursiveCandidName, - CandidDefinitionMemo, - DefinitionConstraints -} from './types'; + +import { DEFAULT_DEFINITION_MAX_DEPTH } from '../../config'; +import { RecursiveShapes } from '../recursive'; import { COMPLEX_ARB_COUNT, complexCandidDefinitionMemo } from './complex_candid_definition_memo'; +import { + REC_ARB_COUNT, + recursiveCandidDefinitionMemo +} from './recursive_candid_definition_memo'; import { PRIM_ARB_COUNT, primitiveCandidDefinitionArb } from './simple_candid_definition_arb'; import { - REC_ARB_COUNT, - recursiveCandidDefinitionMemo -} from './recursive_candid_definition_memo'; -import { DEFAULT_DEFINITION_MAX_DEPTH } from '../../config'; -import { RecursiveShapes } from '../recursive'; + CandidDefinitionArb, + CandidDefinitionMemo, + DefinitionConstraints, + RecursiveCandidName +} from './types'; export function candidDefinitionArb( recursiveShapes: RecursiveShapes, diff --git a/property_tests/arbitraries/candid/candid_definition_arb/recursive_candid_definition_memo.ts b/property_tests/arbitraries/candid/candid_definition_arb/recursive_candid_definition_memo.ts index e76f2a0e35..09dd86ae9c 100644 --- a/property_tests/arbitraries/candid/candid_definition_arb/recursive_candid_definition_memo.ts +++ b/property_tests/arbitraries/candid/candid_definition_arb/recursive_candid_definition_memo.ts @@ -1,7 +1,8 @@ import fc from 'fast-check'; + import { RecursiveDefinitionArb } from '../recursive/definition_arb'; import { complexCandidDefinitionMemo } from './complex_candid_definition_memo'; -import { RecursiveCandidName, CandidDefinitionMemo } from './types'; +import { CandidDefinitionMemo, RecursiveCandidName } from './types'; // The number of options below (it's just recursive) export const REC_ARB_COUNT = 0; diff --git a/property_tests/arbitraries/candid/candid_definition_arb/simple_candid_definition_arb.ts b/property_tests/arbitraries/candid/candid_definition_arb/simple_candid_definition_arb.ts index 0e24c256b7..bec21614f7 100644 --- a/property_tests/arbitraries/candid/candid_definition_arb/simple_candid_definition_arb.ts +++ b/property_tests/arbitraries/candid/candid_definition_arb/simple_candid_definition_arb.ts @@ -1,17 +1,18 @@ import fc from 'fast-check'; + import { BoolDefinitionArb } from '../primitive/bool'; import { Float32DefinitionArb } from '../primitive/floats/float32_arb'; import { Float64DefinitionArb } from '../primitive/floats/float64_arb'; +import { IntDefinitionArb } from '../primitive/ints/int_arb'; +import { Int8DefinitionArb } from '../primitive/ints/int8_arb'; import { Int16DefinitionArb } from '../primitive/ints/int16_arb'; import { Int32DefinitionArb } from '../primitive/ints/int32_arb'; import { Int64DefinitionArb } from '../primitive/ints/int64_arb'; -import { Int8DefinitionArb } from '../primitive/ints/int8_arb'; -import { IntDefinitionArb } from '../primitive/ints/int_arb'; +import { NatDefinitionArb } from '../primitive/nats/nat_arb'; +import { Nat8DefinitionArb } from '../primitive/nats/nat8_arb'; import { Nat16DefinitionArb } from '../primitive/nats/nat16_arb'; import { Nat32DefinitionArb } from '../primitive/nats/nat32_arb'; import { Nat64DefinitionArb } from '../primitive/nats/nat64_arb'; -import { Nat8DefinitionArb } from '../primitive/nats/nat8_arb'; -import { NatDefinitionArb } from '../primitive/nats/nat_arb'; import { NullDefinitionArb } from '../primitive/null'; import { TextDefinitionArb } from '../primitive/text'; import { PrincipalDefinitionArb } from '../reference/principal_arb'; diff --git a/property_tests/arbitraries/candid/candid_definition_arb/types.ts b/property_tests/arbitraries/candid/candid_definition_arb/types.ts index 8011b9d371..ed671fa584 100644 --- a/property_tests/arbitraries/candid/candid_definition_arb/types.ts +++ b/property_tests/arbitraries/candid/candid_definition_arb/types.ts @@ -1,10 +1,11 @@ import fc from 'fast-check'; -import { CandidType } from '../candid_type'; + import { CandidType as RuntimeCandidType } from '../../../../src/lib/candid/candid_type'; +import { CandidType } from '../candid_type'; +import { RecursiveShapes } from '../recursive'; import { ServiceMethodDefinition } from '../reference/service_arb/service_method_arb'; -import { PrimitiveDefinitionWeights } from './simple_candid_definition_arb'; import { ComplexDefinitionWeights } from './complex_candid_definition_memo'; -import { RecursiveShapes } from '../recursive'; +import { PrimitiveDefinitionWeights } from './simple_candid_definition_arb'; export type CandidDefinitionMemo = ( depthLevel: number diff --git a/property_tests/arbitraries/candid/candid_return_type_arb.ts b/property_tests/arbitraries/candid/candid_return_type_arb.ts index 109abe4840..a545e20cf8 100644 --- a/property_tests/arbitraries/candid/candid_return_type_arb.ts +++ b/property_tests/arbitraries/candid/candid_return_type_arb.ts @@ -4,8 +4,8 @@ import { CandidValueAndMeta, CandidValueAndMetaArb } from './candid_value_and_meta_arb'; -import { VoidArb } from './primitive/void'; import { CorrespondingJSType } from './corresponding_js_type'; +import { VoidArb } from './primitive/void'; export type CandidReturnType = CorrespondingJSType | undefined; diff --git a/property_tests/arbitraries/candid/candid_value_and_meta_arb.ts b/property_tests/arbitraries/candid/candid_value_and_meta_arb.ts index a7db3323ce..310f5cc37f 100644 --- a/property_tests/arbitraries/candid/candid_value_and_meta_arb.ts +++ b/property_tests/arbitraries/candid/candid_value_and_meta_arb.ts @@ -1,4 +1,17 @@ import fc from 'fast-check'; + +import { CandidType as RuntimeCandidType } from '../../../src/lib'; +import { CandidValueConstraints } from './candid_values_arb'; +import { BlobArb } from './constructed/blob_arb'; +import { OptArb } from './constructed/opt_arb'; +import { RecordArb } from './constructed/record_arb'; +import { TupleArb } from './constructed/tuple_arb'; +import { VariantArb } from './constructed/variant_arb'; +import { VecArb } from './constructed/vec_arb'; +import { CorrespondingJSType } from './corresponding_js_type'; +import { BoolArb } from './primitive/bool'; +import { Float32Arb } from './primitive/floats/float32_arb'; +import { Float64Arb } from './primitive/floats/float64_arb'; import { IntArb } from './primitive/ints/int_arb'; import { Int8Arb } from './primitive/ints/int8_arb'; import { Int16Arb } from './primitive/ints/int16_arb'; @@ -10,21 +23,9 @@ import { Nat16Arb } from './primitive/nats/nat16_arb'; import { Nat32Arb } from './primitive/nats/nat32_arb'; import { Nat64Arb } from './primitive/nats/nat64_arb'; import { NullArb } from './primitive/null'; -import { BoolArb } from './primitive/bool'; -import { PrincipalArb } from './reference/principal_arb'; -import { Float32Arb } from './primitive/floats/float32_arb'; -import { Float64Arb } from './primitive/floats/float64_arb'; import { TextArb } from './primitive/text'; -import { BlobArb } from './constructed/blob_arb'; -import { VariantArb } from './constructed/variant_arb'; -import { RecordArb } from './constructed/record_arb'; -import { TupleArb } from './constructed/tuple_arb'; -import { OptArb } from './constructed/opt_arb'; -import { VecArb } from './constructed/vec_arb'; import { FuncArb } from './reference/func_arb'; -import { CorrespondingJSType } from './corresponding_js_type'; -import { CandidType as RuntimeCandidType } from '../../../src/lib'; -import { CandidValueConstraints } from './candid_values_arb'; +import { PrincipalArb } from './reference/principal_arb'; // TODO we're thinking that Candid is not the best name for this. What is better? export type CandidValueAndMeta = { diff --git a/property_tests/arbitraries/candid/candid_value_and_meta_arb_generator.ts b/property_tests/arbitraries/candid/candid_value_and_meta_arb_generator.ts index 95544d4db0..945f9feccd 100644 --- a/property_tests/arbitraries/candid/candid_value_and_meta_arb_generator.ts +++ b/property_tests/arbitraries/candid/candid_value_and_meta_arb_generator.ts @@ -1,8 +1,9 @@ import fc from 'fast-check'; -import { CorrespondingJSType } from './corresponding_js_type'; + import { CandidDefinition, WithShapes } from './candid_definition_arb/types'; import { CandidValueAndMeta } from './candid_value_and_meta_arb'; import { CandidValueConstraints, CandidValues } from './candid_values_arb'; +import { CorrespondingJSType } from './corresponding_js_type'; import { RecursiveShapes } from './recursive'; export function CandidValueAndMetaArbGenerator< diff --git a/property_tests/arbitraries/candid/candid_values_arb.ts b/property_tests/arbitraries/candid/candid_values_arb.ts index 1216110e2a..68fa4a8528 100644 --- a/property_tests/arbitraries/candid/candid_values_arb.ts +++ b/property_tests/arbitraries/candid/candid_values_arb.ts @@ -1,9 +1,24 @@ import fc from 'fast-check'; + +import { + CandidDefinition, + OptCandidDefinition, + RecordCandidDefinition, + RecursiveCandidDefinition, + RecursiveCandidName, + ServiceCandidDefinition, + TupleCandidDefinition, + VariantCandidDefinition, + VecCandidDefinition +} from './candid_definition_arb/types'; +import { BlobValuesArb } from './constructed/blob_arb/values_arb'; +import { OptValuesArb } from './constructed/opt_arb/values_arb'; import { RecordValuesArb } from './constructed/record_arb/values_arb'; -import { BoolValueArb } from './primitive/bool'; +import { TupleValuesArb } from './constructed/tuple_arb/values_arbs'; +import { VariantValuesArb } from './constructed/variant_arb/values_arb'; import { VecValuesArb } from './constructed/vec_arb/values_arb'; -import { TextConstraints, TextValueArb } from './primitive/text'; -import { NullValueArb } from './primitive/null'; +import { CorrespondingJSType } from './corresponding_js_type'; +import { BoolValueArb } from './primitive/bool'; import { Float32Constraints, Float32ValueArb @@ -22,28 +37,14 @@ import { Nat8ValueArb } from './primitive/nats/nat8_arb'; import { Nat16ValueArb } from './primitive/nats/nat16_arb'; import { Nat32ValueArb } from './primitive/nats/nat32_arb'; import { Nat64ValueArb } from './primitive/nats/nat64_arb'; -import { VariantValuesArb } from './constructed/variant_arb/values_arb'; -import { TupleValuesArb } from './constructed/tuple_arb/values_arbs'; -import { OptValuesArb } from './constructed/opt_arb/values_arb'; -import { PrincipalValueArb } from './reference/principal_arb'; -import { FuncValueArb } from './reference/func_arb/values_arb'; +import { NullValueArb } from './primitive/null'; +import { TextConstraints, TextValueArb } from './primitive/text'; import { VoidValueArb } from './primitive/void'; -import { ServiceValueArb } from './reference/service_arb/values_arb'; -import { - CandidDefinition, - OptCandidDefinition, - RecordCandidDefinition, - RecursiveCandidName, - RecursiveCandidDefinition, - ServiceCandidDefinition, - TupleCandidDefinition, - VariantCandidDefinition, - VecCandidDefinition -} from './candid_definition_arb/types'; -import { BlobValuesArb } from './constructed/blob_arb/values_arb'; -import { CorrespondingJSType } from './corresponding_js_type'; -import { RecursiveNameValuesArb } from './recursive/values_arb'; import { RecursiveShapes } from './recursive'; +import { RecursiveNameValuesArb } from './recursive/values_arb'; +import { FuncValueArb } from './reference/func_arb/values_arb'; +import { PrincipalValueArb } from './reference/principal_arb'; +import { ServiceValueArb } from './reference/service_arb/values_arb'; export type CandidValues = { agentArgumentValue: T; diff --git a/property_tests/arbitraries/candid/constructed/blob_arb/definition_arb.ts b/property_tests/arbitraries/candid/constructed/blob_arb/definition_arb.ts index de164f6c38..619fe58b45 100644 --- a/property_tests/arbitraries/candid/constructed/blob_arb/definition_arb.ts +++ b/property_tests/arbitraries/candid/constructed/blob_arb/definition_arb.ts @@ -1,4 +1,6 @@ import fc from 'fast-check'; + +import { blob } from '../../../../../src/lib'; import { UniqueIdentifierArb } from '../../../unique_identifier_arb'; import { BlobCandidDefinition, @@ -6,7 +8,6 @@ import { WithShapesArb } from '../../candid_definition_arb/types'; import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; -import { blob } from '../../../../../src/lib'; export function BlobDefinitionArb(): WithShapesArb { return fc.oneof(SimpleCandidDefinitionArb('blob'), _VecNat8DefinitionArb()); diff --git a/property_tests/arbitraries/candid/constructed/blob_arb/index.ts b/property_tests/arbitraries/candid/constructed/blob_arb/index.ts index e8dc86a93f..a0e8719fe4 100644 --- a/property_tests/arbitraries/candid/constructed/blob_arb/index.ts +++ b/property_tests/arbitraries/candid/constructed/blob_arb/index.ts @@ -1,8 +1,9 @@ import fc from 'fast-check'; -import { BlobValuesArb } from './values_arb'; -import { BlobDefinitionArb, _VecNat8DefinitionArb } from './definition_arb'; -import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; + import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; +import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; +import { _VecNat8DefinitionArb, BlobDefinitionArb } from './definition_arb'; +import { BlobValuesArb } from './values_arb'; export function BlobArb(): fc.Arbitrary> { return fc.oneof( diff --git a/property_tests/arbitraries/candid/constructed/blob_arb/values_arb.ts b/property_tests/arbitraries/candid/constructed/blob_arb/values_arb.ts index 9cd184272e..f1716f14d5 100644 --- a/property_tests/arbitraries/candid/constructed/blob_arb/values_arb.ts +++ b/property_tests/arbitraries/candid/constructed/blob_arb/values_arb.ts @@ -1,7 +1,8 @@ import fc from 'fast-check'; + +import { CandidValues } from '../../candid_values_arb'; import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; import { blobToSrcLiteral } from '../../to_src_literal/blob'; -import { CandidValues } from '../../candid_values_arb'; import { _VecNat8DefinitionArb } from './definition_arb'; export function BlobValuesArb(): fc.Arbitrary> { diff --git a/property_tests/arbitraries/candid/constructed/opt_arb/definition_arb.ts b/property_tests/arbitraries/candid/constructed/opt_arb/definition_arb.ts index 8af2026340..cbc093a0d1 100644 --- a/property_tests/arbitraries/candid/constructed/opt_arb/definition_arb.ts +++ b/property_tests/arbitraries/candid/constructed/opt_arb/definition_arb.ts @@ -1,4 +1,6 @@ import fc from 'fast-check'; + +import { CandidType, Opt } from '../../../../../src/lib'; import { UniqueIdentifierArb } from '../../../unique_identifier_arb'; import { CandidDefinition, @@ -9,7 +11,6 @@ import { WithShapes, WithShapesArb } from '../../candid_definition_arb/types'; -import { CandidType, Opt } from '../../../../../src/lib'; import { RecursiveShapes } from '../../recursive'; export function OptDefinitionArb( diff --git a/property_tests/arbitraries/candid/constructed/opt_arb/index.ts b/property_tests/arbitraries/candid/constructed/opt_arb/index.ts index 24c03eb642..8ef2bc2fc4 100644 --- a/property_tests/arbitraries/candid/constructed/opt_arb/index.ts +++ b/property_tests/arbitraries/candid/constructed/opt_arb/index.ts @@ -1,12 +1,13 @@ import fc from 'fast-check'; + +import { DEFAULT_DEFINITION_MAX_DEPTH } from '../../../config'; +import { candidDefinitionMemo } from '../../candid_definition_arb'; import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; -import { OptDefinitionArb } from './definition_arb'; -import { OptValuesArb } from './values_arb'; import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; -import { candidDefinitionMemo } from '../../candid_definition_arb'; -import { CorrespondingJSType } from '../../corresponding_js_type'; -import { DEFAULT_DEFINITION_MAX_DEPTH } from '../../../config'; import { CandidValueConstraints } from '../../candid_values_arb'; +import { CorrespondingJSType } from '../../corresponding_js_type'; +import { OptDefinitionArb } from './definition_arb'; +import { OptValuesArb } from './values_arb'; export type Opt = [CorrespondingJSType] | never[]; diff --git a/property_tests/arbitraries/candid/constructed/opt_arb/values_arb.ts b/property_tests/arbitraries/candid/constructed/opt_arb/values_arb.ts index b8f3b86580..bbb339634c 100644 --- a/property_tests/arbitraries/candid/constructed/opt_arb/values_arb.ts +++ b/property_tests/arbitraries/candid/constructed/opt_arb/values_arb.ts @@ -1,14 +1,15 @@ import fc from 'fast-check'; -import { Opt } from '.'; -import { CorrespondingJSType } from '../../corresponding_js_type'; + +import { DEFAULT_VALUE_MAX_DEPTH } from '../../../config'; import { OptCandidDefinition } from '../../candid_definition_arb/types'; import { - CandidValues, CandidValueArb, - CandidValueConstraints + CandidValueConstraints, + CandidValues } from '../../candid_values_arb'; +import { CorrespondingJSType } from '../../corresponding_js_type'; import { RecursiveShapes } from '../../recursive'; -import { DEFAULT_VALUE_MAX_DEPTH } from '../../../config'; +import { Opt } from '.'; type SomeOrNone = 'Some' | 'None'; diff --git a/property_tests/arbitraries/candid/constructed/record_arb/definition_arb.ts b/property_tests/arbitraries/candid/constructed/record_arb/definition_arb.ts index ce2b666c01..5dedeee3e2 100644 --- a/property_tests/arbitraries/candid/constructed/record_arb/definition_arb.ts +++ b/property_tests/arbitraries/candid/constructed/record_arb/definition_arb.ts @@ -1,4 +1,6 @@ import fc from 'fast-check'; + +import { CandidType, Record } from '../../../../../src/lib'; import { JsFunctionNameArb } from '../../../js_function_name_arb'; import { UniqueIdentifierArb } from '../../../unique_identifier_arb'; import { @@ -8,7 +10,6 @@ import { WithShapes, WithShapesArb } from '../../candid_definition_arb/types'; -import { CandidType, Record } from '../../../../../src/lib'; import { RecursiveShapes } from '../../recursive'; type Field = [string, CandidDefinition]; diff --git a/property_tests/arbitraries/candid/constructed/record_arb/index.ts b/property_tests/arbitraries/candid/constructed/record_arb/index.ts index 0f4beb3c9a..103b71ffe9 100644 --- a/property_tests/arbitraries/candid/constructed/record_arb/index.ts +++ b/property_tests/arbitraries/candid/constructed/record_arb/index.ts @@ -1,12 +1,12 @@ import fc from 'fast-check'; +import { candidDefinitionArb } from '../../candid_definition_arb'; import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; -import { RecordDefinitionArb } from './definition_arb'; -import { RecordValuesArb } from './values_arb'; import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; -import { CorrespondingJSType } from '../../corresponding_js_type'; -import { candidDefinitionArb } from '../../candid_definition_arb'; import { CandidValueConstraints } from '../../candid_values_arb'; +import { CorrespondingJSType } from '../../corresponding_js_type'; +import { RecordDefinitionArb } from './definition_arb'; +import { RecordValuesArb } from './values_arb'; export type Record = { [x: string]: CorrespondingJSType; diff --git a/property_tests/arbitraries/candid/constructed/record_arb/values_arb.ts b/property_tests/arbitraries/candid/constructed/record_arb/values_arb.ts index 1b54144a4d..c411038e45 100644 --- a/property_tests/arbitraries/candid/constructed/record_arb/values_arb.ts +++ b/property_tests/arbitraries/candid/constructed/record_arb/values_arb.ts @@ -1,14 +1,15 @@ import fc from 'fast-check'; -import { Record } from './index'; + +import { DEFAULT_VALUE_MAX_DEPTH } from '../../../config'; import { RecordCandidDefinition } from '../../candid_definition_arb/types'; import { - CandidValues, CandidValueArb, - CandidValueConstraints + CandidValueConstraints, + CandidValues } from '../../candid_values_arb'; import { CorrespondingJSType } from '../../corresponding_js_type'; import { RecursiveShapes } from '../../recursive'; -import { DEFAULT_VALUE_MAX_DEPTH } from '../../../config'; +import { Record } from './index'; type Field = [string, CandidValues]; type ArbField = [string, fc.Arbitrary>]; diff --git a/property_tests/arbitraries/candid/constructed/tuple_arb/definition_arb.ts b/property_tests/arbitraries/candid/constructed/tuple_arb/definition_arb.ts index 073ee2e158..f27206ae02 100644 --- a/property_tests/arbitraries/candid/constructed/tuple_arb/definition_arb.ts +++ b/property_tests/arbitraries/candid/constructed/tuple_arb/definition_arb.ts @@ -1,4 +1,6 @@ import fc from 'fast-check'; + +import { CandidType, Tuple } from '../../../../../src/lib'; import { UniqueIdentifierArb } from '../../../unique_identifier_arb'; import { CandidDefinition, @@ -6,7 +8,6 @@ import { WithShapes, WithShapesArb } from '../../candid_definition_arb/types'; -import { CandidType, Tuple } from '../../../../../src/lib'; import { RecursiveShapes } from '../../recursive'; export function TupleDefinitionArb( diff --git a/property_tests/arbitraries/candid/constructed/tuple_arb/index.ts b/property_tests/arbitraries/candid/constructed/tuple_arb/index.ts index 7a6c849edb..745c067c0a 100644 --- a/property_tests/arbitraries/candid/constructed/tuple_arb/index.ts +++ b/property_tests/arbitraries/candid/constructed/tuple_arb/index.ts @@ -1,11 +1,12 @@ -import { CorrespondingJSType } from '../../corresponding_js_type'; +import fc from 'fast-check'; + import { candidDefinitionArb } from '../../candid_definition_arb'; import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; -import { TupleDefinitionArb } from './definition_arb'; -import { TupleValuesArb } from './values_arbs'; import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; -import fc from 'fast-check'; import { CandidValueConstraints } from '../../candid_values_arb'; +import { CorrespondingJSType } from '../../corresponding_js_type'; +import { TupleDefinitionArb } from './definition_arb'; +import { TupleValuesArb } from './values_arbs'; export type Tuple = CorrespondingJSType[]; export type ReturnTuple = Tuple | {}; diff --git a/property_tests/arbitraries/candid/constructed/tuple_arb/values_arbs.ts b/property_tests/arbitraries/candid/constructed/tuple_arb/values_arbs.ts index 7ff3a25626..d1c578382b 100644 --- a/property_tests/arbitraries/candid/constructed/tuple_arb/values_arbs.ts +++ b/property_tests/arbitraries/candid/constructed/tuple_arb/values_arbs.ts @@ -1,14 +1,15 @@ import fc from 'fast-check'; -import { Tuple, ReturnTuple } from '.'; -import { CorrespondingJSType } from '../../corresponding_js_type'; + +import { DEFAULT_VALUE_MAX_DEPTH } from '../../../config'; import { TupleCandidDefinition } from '../../candid_definition_arb/types'; import { - CandidValues, CandidValueArb, - CandidValueConstraints + CandidValueConstraints, + CandidValues } from '../../candid_values_arb'; +import { CorrespondingJSType } from '../../corresponding_js_type'; import { RecursiveShapes } from '../../recursive'; -import { DEFAULT_VALUE_MAX_DEPTH } from '../../../config'; +import { ReturnTuple, Tuple } from '.'; export function TupleValuesArb( tupleDefinition: TupleCandidDefinition, diff --git a/property_tests/arbitraries/candid/constructed/variant_arb/definition_arbs.ts b/property_tests/arbitraries/candid/constructed/variant_arb/definition_arbs.ts index 0b20c0e050..955c8b62f8 100644 --- a/property_tests/arbitraries/candid/constructed/variant_arb/definition_arbs.ts +++ b/property_tests/arbitraries/candid/constructed/variant_arb/definition_arbs.ts @@ -1,4 +1,7 @@ import fc from 'fast-check'; + +import { CandidType, Variant } from '../../../../../src/lib'; +import { JsFunctionNameArb } from '../../../js_function_name_arb'; import { UniqueIdentifierArb } from '../../../unique_identifier_arb'; import { CandidDefinition, @@ -9,8 +12,6 @@ import { WithShapes, WithShapesArb } from '../../candid_definition_arb/types'; -import { JsFunctionNameArb } from '../../../js_function_name_arb'; -import { CandidType, Variant } from '../../../../../src/lib'; import { RecursiveShapes } from '../../recursive'; type Field = [string, CandidDefinition]; diff --git a/property_tests/arbitraries/candid/constructed/variant_arb/index.ts b/property_tests/arbitraries/candid/constructed/variant_arb/index.ts index 43299a5810..4549bda032 100644 --- a/property_tests/arbitraries/candid/constructed/variant_arb/index.ts +++ b/property_tests/arbitraries/candid/constructed/variant_arb/index.ts @@ -1,13 +1,13 @@ import fc from 'fast-check'; +import { DEFAULT_DEFINITION_MAX_DEPTH } from '../../../config'; import { candidDefinitionMemo } from '../../candid_definition_arb'; -import { CorrespondingJSType } from '../../corresponding_js_type'; import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; -import { VariantDefinitionArb } from './definition_arbs'; -import { VariantValuesArb } from './values_arb'; import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; -import { DEFAULT_DEFINITION_MAX_DEPTH } from '../../../config'; import { CandidValueConstraints } from '../../candid_values_arb'; +import { CorrespondingJSType } from '../../corresponding_js_type'; +import { VariantDefinitionArb } from './definition_arbs'; +import { VariantValuesArb } from './values_arb'; export type Variant = { [x: string]: CorrespondingJSType; diff --git a/property_tests/arbitraries/candid/constructed/variant_arb/values_arb.ts b/property_tests/arbitraries/candid/constructed/variant_arb/values_arb.ts index 613ab7e6ad..3a1803ec65 100644 --- a/property_tests/arbitraries/candid/constructed/variant_arb/values_arb.ts +++ b/property_tests/arbitraries/candid/constructed/variant_arb/values_arb.ts @@ -1,14 +1,15 @@ import fc from 'fast-check'; -import { Variant } from '.'; + +import { DEFAULT_VALUE_MAX_DEPTH } from '../../../config'; import { VariantCandidDefinition } from '../../candid_definition_arb/types'; import { - CandidValues, CandidValueArb, - CandidValueConstraints + CandidValueConstraints, + CandidValues } from '../../candid_values_arb'; import { CorrespondingJSType } from '../../corresponding_js_type'; import { RecursiveShapes } from '../../recursive'; -import { DEFAULT_VALUE_MAX_DEPTH } from '../../../config'; +import { Variant } from '.'; type Field = [string, CandidValues]; diff --git a/property_tests/arbitraries/candid/constructed/vec_arb/definition_arb.ts b/property_tests/arbitraries/candid/constructed/vec_arb/definition_arb.ts index 8675a1f177..41143d57fe 100644 --- a/property_tests/arbitraries/candid/constructed/vec_arb/definition_arb.ts +++ b/property_tests/arbitraries/candid/constructed/vec_arb/definition_arb.ts @@ -1,4 +1,6 @@ import fc from 'fast-check'; + +import { CandidType, Vec } from '../../../../../src/lib'; import { UniqueIdentifierArb } from '../../../unique_identifier_arb'; import { CandidDefinition, @@ -9,7 +11,6 @@ import { WithShapes, WithShapesArb } from '../../candid_definition_arb/types'; -import { CandidType, Vec } from '../../../../../src/lib'; export function VecDefinitionArb( candidTypeArb: RecursiveCandidDefinitionMemo, diff --git a/property_tests/arbitraries/candid/constructed/vec_arb/index.ts b/property_tests/arbitraries/candid/constructed/vec_arb/index.ts index ed20ef6620..c24eb67604 100644 --- a/property_tests/arbitraries/candid/constructed/vec_arb/index.ts +++ b/property_tests/arbitraries/candid/constructed/vec_arb/index.ts @@ -1,13 +1,13 @@ import fc from 'fast-check'; +import { DEFAULT_DEFINITION_MAX_DEPTH } from '../../../config'; import { candidDefinitionMemo } from '../../candid_definition_arb'; -import { CorrespondingJSType } from '../../corresponding_js_type'; import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; -import { VecDefinitionArb } from './definition_arb'; -import { VecValuesArb } from './values_arb'; import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; -import { DEFAULT_DEFINITION_MAX_DEPTH } from '../../../config'; import { CandidValueConstraints } from '../../candid_values_arb'; +import { CorrespondingJSType } from '../../corresponding_js_type'; +import { VecDefinitionArb } from './definition_arb'; +import { VecValuesArb } from './values_arb'; export type Vec = | CorrespondingJSType[] diff --git a/property_tests/arbitraries/candid/constructed/vec_arb/values_arb.ts b/property_tests/arbitraries/candid/constructed/vec_arb/values_arb.ts index 80bda3b580..219da1c092 100644 --- a/property_tests/arbitraries/candid/constructed/vec_arb/values_arb.ts +++ b/property_tests/arbitraries/candid/constructed/vec_arb/values_arb.ts @@ -1,7 +1,6 @@ import fc, { ArrayConstraints } from 'fast-check'; -import { Vec } from '.'; -import { CandidType } from '../../candid_type'; -import { CorrespondingJSType } from '../../corresponding_js_type'; + +import { DEFAULT_VALUE_MAX_DEPTH } from '../../../config'; import { CandidDefinition, OptCandidDefinition, @@ -10,13 +9,15 @@ import { VariantCandidDefinition, VecCandidDefinition } from '../../candid_definition_arb/types'; +import { CandidType } from '../../candid_type'; import { - CandidValues, CandidValueArb, - CandidValueConstraints + CandidValueConstraints, + CandidValues } from '../../candid_values_arb'; +import { CorrespondingJSType } from '../../corresponding_js_type'; import { RecursiveShapes } from '../../recursive'; -import { DEFAULT_VALUE_MAX_DEPTH } from '../../../config'; +import { Vec } from '.'; /* https://github.com/dfinity/candid/blob/491969f34dd791e51f69c5f8d3c6192ae405b839/spec/Candid.md#memory diff --git a/property_tests/arbitraries/candid/corresponding_js_type.ts b/property_tests/arbitraries/candid/corresponding_js_type.ts index 116e0d6993..aa31d205b1 100644 --- a/property_tests/arbitraries/candid/corresponding_js_type.ts +++ b/property_tests/arbitraries/candid/corresponding_js_type.ts @@ -1,10 +1,11 @@ import { Principal } from '@dfinity/principal'; -import { Func } from './reference/func_arb'; + import { Opt } from './constructed/opt_arb'; -import { Variant } from './constructed/variant_arb'; +import { Record } from './constructed/record_arb'; import { Tuple } from './constructed/tuple_arb'; +import { Variant } from './constructed/variant_arb'; import { Vec } from './constructed/vec_arb'; -import { Record } from './constructed/record_arb'; +import { Func } from './reference/func_arb'; export type CorrespondingJSType = | number diff --git a/property_tests/arbitraries/candid/primitive/bool.ts b/property_tests/arbitraries/candid/primitive/bool.ts index c14dd23465..cb3e1f1f20 100644 --- a/property_tests/arbitraries/candid/primitive/bool.ts +++ b/property_tests/arbitraries/candid/primitive/bool.ts @@ -1,11 +1,12 @@ import fc from 'fast-check'; + +import { BoolCandidDefinition } from '../candid_definition_arb/types'; +import { WithShapesArb } from '../candid_definition_arb/types'; +import { CandidValueAndMetaArbGenerator } from '../candid_value_and_meta_arb_generator'; +import { CandidValues } from '../candid_values_arb'; import { SimpleCandidDefinitionArb } from '../simple_type_arbs/definition_arb'; import { SimpleCandidValuesArb } from '../simple_type_arbs/values_arb'; import { booleanToSrcLiteral } from '../to_src_literal/boolean'; -import { CandidValueAndMetaArbGenerator } from '../candid_value_and_meta_arb_generator'; -import { BoolCandidDefinition } from '../candid_definition_arb/types'; -import { CandidValues } from '../candid_values_arb'; -import { WithShapesArb } from '../candid_definition_arb/types'; export function BoolArb(): fc.Arbitrary { return CandidValueAndMetaArbGenerator(BoolDefinitionArb(), BoolValueArb); diff --git a/property_tests/arbitraries/candid/primitive/floats/float32_arb.ts b/property_tests/arbitraries/candid/primitive/floats/float32_arb.ts index e31a551c74..0eefb6b1d5 100644 --- a/property_tests/arbitraries/candid/primitive/floats/float32_arb.ts +++ b/property_tests/arbitraries/candid/primitive/floats/float32_arb.ts @@ -1,15 +1,16 @@ import fc from 'fast-check'; -import { floatToSrcLiteral } from '../../to_src_literal/float'; -import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; -import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; -import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; -import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; + import { FloatCandidDefinition, WithShapesArb } from '../../candid_definition_arb/types'; +import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; +import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; import { CandidValues } from '../../candid_values_arb'; import { RecursiveShapes } from '../../recursive'; +import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; +import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; +import { floatToSrcLiteral } from '../../to_src_literal/float'; export interface Float32Constraints extends fc.Float32ArrayConstraints { noNegativeZero?: boolean; diff --git a/property_tests/arbitraries/candid/primitive/floats/float64_arb.ts b/property_tests/arbitraries/candid/primitive/floats/float64_arb.ts index 1cff48f1ca..71ec463b55 100644 --- a/property_tests/arbitraries/candid/primitive/floats/float64_arb.ts +++ b/property_tests/arbitraries/candid/primitive/floats/float64_arb.ts @@ -1,15 +1,16 @@ import fc from 'fast-check'; -import { floatToSrcLiteral } from '../../to_src_literal/float'; -import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; -import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; -import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; + import { FloatCandidDefinition, WithShapesArb } from '../../candid_definition_arb/types'; -import { CandidValues } from '../../candid_values_arb'; import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; +import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; +import { CandidValues } from '../../candid_values_arb'; import { RecursiveShapes } from '../../recursive'; +import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; +import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; +import { floatToSrcLiteral } from '../../to_src_literal/float'; export interface Float64Constraints extends fc.Float64ArrayConstraints { noNegativeZero?: boolean; diff --git a/property_tests/arbitraries/candid/primitive/ints/int16_arb.ts b/property_tests/arbitraries/candid/primitive/ints/int16_arb.ts index 6816f87cb7..67fe8bdc59 100644 --- a/property_tests/arbitraries/candid/primitive/ints/int16_arb.ts +++ b/property_tests/arbitraries/candid/primitive/ints/int16_arb.ts @@ -1,15 +1,16 @@ -import { numberToSrcLiteral } from '../../to_src_literal/number'; -import { NumberArb } from './'; -import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; -import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; -import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; -import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; import fc from 'fast-check'; + import { IntCandidDefinition, WithShapesArb } from '../../candid_definition_arb/types'; +import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; +import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; import { CandidValues } from '../../candid_values_arb'; +import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; +import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; +import { numberToSrcLiteral } from '../../to_src_literal/number'; +import { NumberArb } from './'; export function Int16Arb(): fc.Arbitrary> { return CandidValueAndMetaArbGenerator(Int16DefinitionArb(), Int16ValueArb); diff --git a/property_tests/arbitraries/candid/primitive/ints/int32_arb.ts b/property_tests/arbitraries/candid/primitive/ints/int32_arb.ts index 08c5476599..fc0a216c50 100644 --- a/property_tests/arbitraries/candid/primitive/ints/int32_arb.ts +++ b/property_tests/arbitraries/candid/primitive/ints/int32_arb.ts @@ -1,15 +1,16 @@ -import { numberToSrcLiteral } from '../../to_src_literal/number'; -import { NumberArb } from './'; -import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; -import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; -import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; -import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; import fc from 'fast-check'; + import { IntCandidDefinition, WithShapesArb } from '../../candid_definition_arb/types'; +import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; +import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; import { CandidValues } from '../../candid_values_arb'; +import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; +import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; +import { numberToSrcLiteral } from '../../to_src_literal/number'; +import { NumberArb } from './'; export function Int32Arb(): fc.Arbitrary> { return CandidValueAndMetaArbGenerator(Int32DefinitionArb(), Int32ValueArb); diff --git a/property_tests/arbitraries/candid/primitive/ints/int64_arb.ts b/property_tests/arbitraries/candid/primitive/ints/int64_arb.ts index 4e25356f55..a15a49aaaf 100644 --- a/property_tests/arbitraries/candid/primitive/ints/int64_arb.ts +++ b/property_tests/arbitraries/candid/primitive/ints/int64_arb.ts @@ -1,14 +1,15 @@ import fc from 'fast-check'; -import { bigintToSrcLiteral } from '../../to_src_literal/bigint'; -import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; -import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; -import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; + import { IntCandidDefinition, WithShapesArb } from '../../candid_definition_arb/types'; -import { CandidValues } from '../../candid_values_arb'; import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; +import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; +import { CandidValues } from '../../candid_values_arb'; +import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; +import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; +import { bigintToSrcLiteral } from '../../to_src_literal/bigint'; export function Int64Arb(): fc.Arbitrary> { return CandidValueAndMetaArbGenerator(Int64DefinitionArb(), Int64ValueArb); diff --git a/property_tests/arbitraries/candid/primitive/ints/int8_arb.ts b/property_tests/arbitraries/candid/primitive/ints/int8_arb.ts index e5e3600e51..42adae2f3f 100644 --- a/property_tests/arbitraries/candid/primitive/ints/int8_arb.ts +++ b/property_tests/arbitraries/candid/primitive/ints/int8_arb.ts @@ -1,15 +1,16 @@ -import { numberToSrcLiteral } from '../../to_src_literal/number'; -import { NumberArb } from './'; -import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; -import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; -import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; -import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; import fc from 'fast-check'; -import { CandidValues } from '../../candid_values_arb'; + import { IntCandidDefinition, WithShapesArb } from '../../candid_definition_arb/types'; +import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; +import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; +import { CandidValues } from '../../candid_values_arb'; +import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; +import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; +import { numberToSrcLiteral } from '../../to_src_literal/number'; +import { NumberArb } from './'; export function Int8Arb(): fc.Arbitrary> { return CandidValueAndMetaArbGenerator(Int8DefinitionArb(), Int8ValueArb); diff --git a/property_tests/arbitraries/candid/primitive/ints/int_arb.ts b/property_tests/arbitraries/candid/primitive/ints/int_arb.ts index dbf5ec6c07..d2bf5d406a 100644 --- a/property_tests/arbitraries/candid/primitive/ints/int_arb.ts +++ b/property_tests/arbitraries/candid/primitive/ints/int_arb.ts @@ -1,14 +1,15 @@ import fc from 'fast-check'; -import { bigintToSrcLiteral } from '../../to_src_literal/bigint'; -import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; -import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; -import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; -import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; -import { CandidValues } from '../../candid_values_arb'; + import { IntCandidDefinition, WithShapesArb } from '../../candid_definition_arb/types'; +import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; +import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; +import { CandidValues } from '../../candid_values_arb'; +import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; +import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; +import { bigintToSrcLiteral } from '../../to_src_literal/bigint'; export function IntArb(): fc.Arbitrary> { return CandidValueAndMetaArbGenerator(IntDefinitionArb(), IntValueArb); diff --git a/property_tests/arbitraries/candid/primitive/nats/nat16_arb.ts b/property_tests/arbitraries/candid/primitive/nats/nat16_arb.ts index b045b414ea..865ab74bc6 100644 --- a/property_tests/arbitraries/candid/primitive/nats/nat16_arb.ts +++ b/property_tests/arbitraries/candid/primitive/nats/nat16_arb.ts @@ -1,15 +1,16 @@ -import { numberToSrcLiteral } from '../../to_src_literal/number'; -import { UNumberArb } from './index'; -import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; -import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; -import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; import fc from 'fast-check'; -import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; + import { NatCandidDefinition, WithShapesArb } from '../../candid_definition_arb/types'; +import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; +import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; import { CandidValues } from '../../candid_values_arb'; +import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; +import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; +import { numberToSrcLiteral } from '../../to_src_literal/number'; +import { UNumberArb } from './index'; export function Nat16Arb(): fc.Arbitrary> { return CandidValueAndMetaArbGenerator(Nat16DefinitionArb(), Nat16ValueArb); diff --git a/property_tests/arbitraries/candid/primitive/nats/nat32_arb.ts b/property_tests/arbitraries/candid/primitive/nats/nat32_arb.ts index 73b1bb0c6f..d30bcc7f0e 100644 --- a/property_tests/arbitraries/candid/primitive/nats/nat32_arb.ts +++ b/property_tests/arbitraries/candid/primitive/nats/nat32_arb.ts @@ -1,15 +1,16 @@ -import { numberToSrcLiteral } from '../../to_src_literal/number'; -import { UNumberArb } from './index'; -import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; -import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; -import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; import fc from 'fast-check'; -import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; + import { NatCandidDefinition, WithShapesArb } from '../../candid_definition_arb/types'; +import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; +import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; import { CandidValues } from '../../candid_values_arb'; +import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; +import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; +import { numberToSrcLiteral } from '../../to_src_literal/number'; +import { UNumberArb } from './index'; export function Nat32Arb(): fc.Arbitrary> { return CandidValueAndMetaArbGenerator(Nat32DefinitionArb(), Nat32ValueArb); diff --git a/property_tests/arbitraries/candid/primitive/nats/nat64_arb.ts b/property_tests/arbitraries/candid/primitive/nats/nat64_arb.ts index 2a09f3975b..9a32ace699 100644 --- a/property_tests/arbitraries/candid/primitive/nats/nat64_arb.ts +++ b/property_tests/arbitraries/candid/primitive/nats/nat64_arb.ts @@ -1,14 +1,15 @@ import fc from 'fast-check'; -import { bigintToSrcLiteral } from '../../to_src_literal/bigint'; -import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; -import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; -import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; -import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; + import { NatCandidDefinition, WithShapesArb } from '../../candid_definition_arb/types'; +import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; +import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; import { CandidValues } from '../../candid_values_arb'; +import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; +import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; +import { bigintToSrcLiteral } from '../../to_src_literal/bigint'; export function Nat64Arb(): fc.Arbitrary> { return CandidValueAndMetaArbGenerator(Nat64DefinitionArb(), Nat64ValueArb); diff --git a/property_tests/arbitraries/candid/primitive/nats/nat8_arb.ts b/property_tests/arbitraries/candid/primitive/nats/nat8_arb.ts index a7199318ba..0ac02cd7d4 100644 --- a/property_tests/arbitraries/candid/primitive/nats/nat8_arb.ts +++ b/property_tests/arbitraries/candid/primitive/nats/nat8_arb.ts @@ -1,15 +1,16 @@ -import { numberToSrcLiteral } from '../../to_src_literal/number'; -import { UNumberArb } from './index'; -import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; -import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; -import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; import fc from 'fast-check'; -import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; + import { NatCandidDefinition, WithShapesArb } from '../../candid_definition_arb/types'; +import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; +import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; import { CandidValues } from '../../candid_values_arb'; +import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; +import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; +import { numberToSrcLiteral } from '../../to_src_literal/number'; +import { UNumberArb } from './index'; export function Nat8Arb(): fc.Arbitrary> { return CandidValueAndMetaArbGenerator(Nat8DefinitionArb(), Nat8ValueArb); diff --git a/property_tests/arbitraries/candid/primitive/nats/nat_arb.ts b/property_tests/arbitraries/candid/primitive/nats/nat_arb.ts index 0977abe6b5..b06bebec04 100644 --- a/property_tests/arbitraries/candid/primitive/nats/nat_arb.ts +++ b/property_tests/arbitraries/candid/primitive/nats/nat_arb.ts @@ -1,14 +1,15 @@ import fc from 'fast-check'; -import { bigintToSrcLiteral } from '../../to_src_literal/bigint'; -import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; -import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; -import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; -import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; + import { NatCandidDefinition, WithShapesArb } from '../../candid_definition_arb/types'; +import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; +import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; import { CandidValues } from '../../candid_values_arb'; +import { SimpleCandidDefinitionArb } from '../../simple_type_arbs/definition_arb'; +import { SimpleCandidValuesArb } from '../../simple_type_arbs/values_arb'; +import { bigintToSrcLiteral } from '../../to_src_literal/bigint'; export function NatArb(): fc.Arbitrary> { return CandidValueAndMetaArbGenerator(NatDefinitionArb(), NatValueArb); diff --git a/property_tests/arbitraries/candid/primitive/null.ts b/property_tests/arbitraries/candid/primitive/null.ts index 992d835de7..e3598808e8 100644 --- a/property_tests/arbitraries/candid/primitive/null.ts +++ b/property_tests/arbitraries/candid/primitive/null.ts @@ -1,14 +1,15 @@ import fc from 'fast-check'; -import { SimpleCandidDefinitionArb } from '../simple_type_arbs/definition_arb'; -import { SimpleCandidValuesArb } from '../simple_type_arbs/values_arb'; -import { nullToSrcLiteral } from '../to_src_literal/null'; -import { CandidValueAndMetaArbGenerator } from '../candid_value_and_meta_arb_generator'; + import { NullCandidDefinition, WithShapesArb } from '../candid_definition_arb/types'; -import { CandidValues } from '../candid_values_arb'; import { CandidValueAndMeta } from '../candid_value_and_meta_arb'; +import { CandidValueAndMetaArbGenerator } from '../candid_value_and_meta_arb_generator'; +import { CandidValues } from '../candid_values_arb'; +import { SimpleCandidDefinitionArb } from '../simple_type_arbs/definition_arb'; +import { SimpleCandidValuesArb } from '../simple_type_arbs/values_arb'; +import { nullToSrcLiteral } from '../to_src_literal/null'; export function NullArb(): fc.Arbitrary> { return CandidValueAndMetaArbGenerator(NullDefinitionArb(), NullValueArb); diff --git a/property_tests/arbitraries/candid/primitive/text.ts b/property_tests/arbitraries/candid/primitive/text.ts index 4ee729e8c6..d0cadbf2b6 100644 --- a/property_tests/arbitraries/candid/primitive/text.ts +++ b/property_tests/arbitraries/candid/primitive/text.ts @@ -1,16 +1,17 @@ import fc, { StringSharedConstraints } from 'fast-check'; -import { stringToSrcLiteral } from '../to_src_literal/string'; + +import { JsFunctionNameArb } from '../../js_function_name_arb'; import { TextCandidDefinition, WithShapesArb } from '../candid_definition_arb/types'; -import { SimpleCandidValuesArb } from '../simple_type_arbs/values_arb'; -import { SimpleCandidDefinitionArb } from '../simple_type_arbs/definition_arb'; -import { CandidValues } from '../candid_values_arb'; import { CandidValueAndMeta } from '../candid_value_and_meta_arb'; import { CandidValueAndMetaArbGenerator } from '../candid_value_and_meta_arb_generator'; -import { JsFunctionNameArb } from '../../js_function_name_arb'; +import { CandidValues } from '../candid_values_arb'; import { RecursiveShapes } from '../recursive'; +import { SimpleCandidDefinitionArb } from '../simple_type_arbs/definition_arb'; +import { SimpleCandidValuesArb } from '../simple_type_arbs/values_arb'; +import { stringToSrcLiteral } from '../to_src_literal/string'; export interface TextConstraints extends StringSharedConstraints { canStartWithDigit?: boolean; diff --git a/property_tests/arbitraries/candid/primitive/void.ts b/property_tests/arbitraries/candid/primitive/void.ts index dcda59949f..ce338367da 100644 --- a/property_tests/arbitraries/candid/primitive/void.ts +++ b/property_tests/arbitraries/candid/primitive/void.ts @@ -1,14 +1,15 @@ import fc from 'fast-check'; -import { voidToSrcLiteral } from '../to_src_literal/void'; -import { SimpleCandidDefinitionArb } from '../simple_type_arbs/definition_arb'; -import { SimpleCandidValuesArb } from '../simple_type_arbs/values_arb'; -import { CandidValueAndMetaArbGenerator } from '../candid_value_and_meta_arb_generator'; -import { CandidValueAndMeta } from '../candid_value_and_meta_arb'; + import { VoidCandidDefinition, WithShapesArb } from '../candid_definition_arb/types'; +import { CandidValueAndMeta } from '../candid_value_and_meta_arb'; +import { CandidValueAndMetaArbGenerator } from '../candid_value_and_meta_arb_generator'; import { CandidValues } from '../candid_values_arb'; +import { SimpleCandidDefinitionArb } from '../simple_type_arbs/definition_arb'; +import { SimpleCandidValuesArb } from '../simple_type_arbs/values_arb'; +import { voidToSrcLiteral } from '../to_src_literal/void'; export function VoidArb(): fc.Arbitrary> { return CandidValueAndMetaArbGenerator(VoidDefinitionArb(), VoidValueArb); diff --git a/property_tests/arbitraries/candid/recursive/definition_arb.ts b/property_tests/arbitraries/candid/recursive/definition_arb.ts index 75dd8a1f9b..5d74b645b9 100644 --- a/property_tests/arbitraries/candid/recursive/definition_arb.ts +++ b/property_tests/arbitraries/candid/recursive/definition_arb.ts @@ -1,15 +1,16 @@ import fc from 'fast-check'; + +import { CandidType, Recursive } from '../../../../src/lib'; import { UniqueIdentifierArb } from '../../unique_identifier_arb'; import { CandidDefinition, DefinitionConstraints, + RecursiveCandidDefinition, RecursiveCandidDefinitionMemo, RecursiveCandidName, - RecursiveCandidDefinition, WithShapes, WithShapesArb } from '../candid_definition_arb/types'; -import { CandidType, Recursive } from '../../../../src/lib'; import { RecursiveShapes } from '.'; export function RecursiveDefinitionArb( diff --git a/property_tests/arbitraries/candid/recursive/index.ts b/property_tests/arbitraries/candid/recursive/index.ts index 0d5f73adc7..5cae131da8 100644 --- a/property_tests/arbitraries/candid/recursive/index.ts +++ b/property_tests/arbitraries/candid/recursive/index.ts @@ -1,11 +1,12 @@ import fc from 'fast-check'; -import { CandidValueAndMeta } from '../candid_value_and_meta_arb'; + +import { DEFAULT_DEFINITION_MAX_DEPTH } from '../../config'; +import { complexCandidDefinitionMemo } from '../candid_definition_arb/complex_candid_definition_memo'; import { RecursiveCandidDefinition } from '../candid_definition_arb/types'; +import { CandidValueAndMeta } from '../candid_value_and_meta_arb'; +import { CandidValueAndMetaArbGenerator } from '../candid_value_and_meta_arb_generator'; import { RecursiveDefinitionArb } from './definition_arb'; import { RecursiveValuesArb } from './values_arb'; -import { CandidValueAndMetaArbGenerator } from '../candid_value_and_meta_arb_generator'; -import { complexCandidDefinitionMemo } from '../candid_definition_arb/complex_candid_definition_memo'; -import { DEFAULT_DEFINITION_MAX_DEPTH } from '../../config'; export type Recursive = any; export type RecursiveShapes = { [key: string]: RecursiveCandidDefinition }; diff --git a/property_tests/arbitraries/candid/recursive/values_arb.ts b/property_tests/arbitraries/candid/recursive/values_arb.ts index 132bb50aeb..ad2c28702e 100644 --- a/property_tests/arbitraries/candid/recursive/values_arb.ts +++ b/property_tests/arbitraries/candid/recursive/values_arb.ts @@ -1,15 +1,16 @@ import fc from 'fast-check'; -import { Recursive, RecursiveShapes } from '.'; + +import { DEFAULT_VALUE_MAX_DEPTH } from '../../config'; import { - RecursiveCandidName, - RecursiveCandidDefinition + RecursiveCandidDefinition, + RecursiveCandidName } from '../candid_definition_arb/types'; import { - CandidValues, CandidValueArb, - CandidValueConstraints + CandidValueConstraints, + CandidValues } from '../candid_values_arb'; -import { DEFAULT_VALUE_MAX_DEPTH } from '../../config'; +import { Recursive, RecursiveShapes } from '.'; export function RecursiveNameValuesArb( recDefinition: RecursiveCandidName | RecursiveCandidDefinition, diff --git a/property_tests/arbitraries/candid/reference/func_arb/definition_arb.ts b/property_tests/arbitraries/candid/reference/func_arb/definition_arb.ts index f76dafd24b..b8330c1b9b 100644 --- a/property_tests/arbitraries/candid/reference/func_arb/definition_arb.ts +++ b/property_tests/arbitraries/candid/reference/func_arb/definition_arb.ts @@ -1,4 +1,6 @@ import fc from 'fast-check'; + +import { CandidType, Func } from '../../../../../src/lib'; import { UniqueIdentifierArb } from '../../../unique_identifier_arb'; import { CandidDefinition, @@ -7,7 +9,6 @@ import { WithShapesArb } from '../../candid_definition_arb/types'; import { VoidDefinitionArb } from '../../primitive/void'; -import { CandidType, Func } from '../../../../../src/lib'; type Mode = 'query' | 'update' | 'oneway'; diff --git a/property_tests/arbitraries/candid/reference/func_arb/index.ts b/property_tests/arbitraries/candid/reference/func_arb/index.ts index b4fb300e20..58ad5d7734 100644 --- a/property_tests/arbitraries/candid/reference/func_arb/index.ts +++ b/property_tests/arbitraries/candid/reference/func_arb/index.ts @@ -1,12 +1,12 @@ -import fc from 'fast-check'; import { Principal } from '@dfinity/principal'; +import fc from 'fast-check'; import { candidDefinitionArb } from '../../candid_definition_arb'; import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; -import { FuncDefinitionArb } from './definition_arb'; -import { FuncValueArb } from './values_arb'; import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; import { CandidValueConstraints } from '../../candid_values_arb'; +import { FuncDefinitionArb } from './definition_arb'; +import { FuncValueArb } from './values_arb'; export type Func = [Principal, string]; diff --git a/property_tests/arbitraries/candid/reference/func_arb/values_arb.ts b/property_tests/arbitraries/candid/reference/func_arb/values_arb.ts index 72423f6e3e..d32cc6bb11 100644 --- a/property_tests/arbitraries/candid/reference/func_arb/values_arb.ts +++ b/property_tests/arbitraries/candid/reference/func_arb/values_arb.ts @@ -1,8 +1,9 @@ import fc from 'fast-check'; -import { Func } from '.'; -import { TextArb } from '../../primitive/text'; + import { CandidValues } from '../../candid_values_arb'; +import { TextArb } from '../../primitive/text'; import { PrincipalArb } from '../principal_arb'; +import { Func } from '.'; export function FuncValueArb(): fc.Arbitrary> { return fc diff --git a/property_tests/arbitraries/candid/reference/principal_arb.ts b/property_tests/arbitraries/candid/reference/principal_arb.ts index 7978fef387..7bd64dbce9 100644 --- a/property_tests/arbitraries/candid/reference/principal_arb.ts +++ b/property_tests/arbitraries/candid/reference/principal_arb.ts @@ -1,15 +1,16 @@ -import fc from 'fast-check'; import { Principal } from '@dfinity/principal'; -import { principalToSrcLiteral } from '../to_src_literal/principal'; -import { SimpleCandidDefinitionArb } from '../simple_type_arbs/definition_arb'; -import { SimpleCandidValuesArb } from '../simple_type_arbs/values_arb'; +import fc from 'fast-check'; + import { PrincipalCandidDefinition, WithShapesArb } from '../candid_definition_arb/types'; -import { CandidValues } from '../candid_values_arb'; import { CandidValueAndMeta } from '../candid_value_and_meta_arb'; import { CandidValueAndMetaArbGenerator } from '../candid_value_and_meta_arb_generator'; +import { CandidValues } from '../candid_values_arb'; +import { SimpleCandidDefinitionArb } from '../simple_type_arbs/definition_arb'; +import { SimpleCandidValuesArb } from '../simple_type_arbs/values_arb'; +import { principalToSrcLiteral } from '../to_src_literal/principal'; export function PrincipalArb(): fc.Arbitrary> { return CandidValueAndMetaArbGenerator( diff --git a/property_tests/arbitraries/candid/reference/service_arb/definition_arb.ts b/property_tests/arbitraries/candid/reference/service_arb/definition_arb.ts index 1d0cc21896..ae8718c9e5 100644 --- a/property_tests/arbitraries/candid/reference/service_arb/definition_arb.ts +++ b/property_tests/arbitraries/candid/reference/service_arb/definition_arb.ts @@ -1,17 +1,17 @@ import fc from 'fast-check'; -import { - ServiceMethodArb, - ServiceMethodDefinition -} from './service_method_arb'; +import { Canister } from '../../../../../src/lib/candid/types/reference/service'; +import { UniqueIdentifierArb } from '../../../unique_identifier_arb'; import { CandidDefinition, ServiceCandidDefinition, WithShapes, WithShapesArb } from '../../candid_definition_arb/types'; -import { UniqueIdentifierArb } from '../../../unique_identifier_arb'; -import { Canister } from '../../../../../src/lib/candid/types/reference/service'; +import { + ServiceMethodArb, + ServiceMethodDefinition +} from './service_method_arb'; export function ServiceDefinitionArb( fieldCandidDefArb: WithShapesArb diff --git a/property_tests/arbitraries/candid/reference/service_arb/index.ts b/property_tests/arbitraries/candid/reference/service_arb/index.ts index 26d1f95507..b74e3d2a0d 100644 --- a/property_tests/arbitraries/candid/reference/service_arb/index.ts +++ b/property_tests/arbitraries/candid/reference/service_arb/index.ts @@ -1,15 +1,15 @@ -import fc from 'fast-check'; import { Principal } from '@dfinity/principal'; +import fc from 'fast-check'; import { candidDefinitionArb } from '../../candid_definition_arb'; -import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; import { CandidDefinition, WithShapesArb } from '../../candid_definition_arb/types'; -import { ServiceValueArb } from './values_arb'; -import { ServiceDefinitionArb } from './definition_arb'; +import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; +import { ServiceDefinitionArb } from './definition_arb'; +import { ServiceValueArb } from './values_arb'; // TODO: // - services that are more than type-definitions, i.e. have functionality diff --git a/property_tests/arbitraries/candid/reference/service_arb/service_method_arb.ts b/property_tests/arbitraries/candid/reference/service_arb/service_method_arb.ts index 77fc4fb455..2b3c20d96d 100644 --- a/property_tests/arbitraries/candid/reference/service_arb/service_method_arb.ts +++ b/property_tests/arbitraries/candid/reference/service_arb/service_method_arb.ts @@ -1,18 +1,18 @@ import fc from 'fast-check'; -import { CandidType } from '../../candid_type'; +import { + query, + update +} from '../../../../../src/lib/canister_methods/methods/'; +import { CanisterMethodInfo } from '../../../../../src/lib/canister_methods/types/canister_method_info'; +import { JsFunctionNameArb } from '../../../js_function_name_arb'; import { CandidDefinition, WithShapes, WithShapesArb } from '../../candid_definition_arb/types'; +import { CandidType } from '../../candid_type'; import { VoidDefinitionArb } from '../../primitive/void'; -import { JsFunctionNameArb } from '../../../js_function_name_arb'; -import { - query, - update -} from '../../../../../src/lib/canister_methods/methods/'; -import { CanisterMethodInfo } from '../../../../../src/lib/canister_methods/types/canister_method_info'; type Mode = 'query' | 'update'; diff --git a/property_tests/arbitraries/candid/reference/service_arb/values_arb.ts b/property_tests/arbitraries/candid/reference/service_arb/values_arb.ts index 5b5d84fa25..89f0b74a38 100644 --- a/property_tests/arbitraries/candid/reference/service_arb/values_arb.ts +++ b/property_tests/arbitraries/candid/reference/service_arb/values_arb.ts @@ -1,5 +1,6 @@ import { Principal } from '@dfinity/principal'; import fc from 'fast-check'; + import { ServiceCandidDefinition } from '../../candid_definition_arb/types'; import { CandidValues } from '../../candid_values_arb'; import { PrincipalValueArb } from '../principal_arb'; diff --git a/property_tests/arbitraries/candid/simple_type_arbs/candid_type_to_azle_candid_type.ts b/property_tests/arbitraries/candid/simple_type_arbs/candid_type_to_azle_candid_type.ts index 99a87e2d67..d13c2a4ccd 100644 --- a/property_tests/arbitraries/candid/simple_type_arbs/candid_type_to_azle_candid_type.ts +++ b/property_tests/arbitraries/candid/simple_type_arbs/candid_type_to_azle_candid_type.ts @@ -1,6 +1,7 @@ import { blob, bool, + CandidType, float32, float64, int, @@ -14,10 +15,9 @@ import { nat32, nat64, Null, - text, - Void, Principal, - CandidType + text, + Void } from '../../../../src/lib'; import { SimpleCandidType } from '../candid_type'; diff --git a/property_tests/arbitraries/candid/simple_type_arbs/definition_arb.ts b/property_tests/arbitraries/candid/simple_type_arbs/definition_arb.ts index b1cb78715c..c44d8b09f9 100644 --- a/property_tests/arbitraries/candid/simple_type_arbs/definition_arb.ts +++ b/property_tests/arbitraries/candid/simple_type_arbs/definition_arb.ts @@ -1,11 +1,12 @@ import fc from 'fast-check'; + +import { UniqueIdentifierArb } from '../../unique_identifier_arb'; import { PrimitiveDefinition, WithShapes, WithShapesArb } from '../candid_definition_arb/types'; import { SimpleCandidType } from '../candid_type'; -import { UniqueIdentifierArb } from '../../unique_identifier_arb'; import { candidTypeToRuntimeCandidTypeObject } from './candid_type_to_azle_candid_type'; export function SimpleCandidDefinitionArb( diff --git a/property_tests/arbitraries/candid/simple_type_arbs/values_arb.ts b/property_tests/arbitraries/candid/simple_type_arbs/values_arb.ts index cfd517045e..6afae40c6a 100644 --- a/property_tests/arbitraries/candid/simple_type_arbs/values_arb.ts +++ b/property_tests/arbitraries/candid/simple_type_arbs/values_arb.ts @@ -1,6 +1,7 @@ import fc from 'fast-check'; -import { CorrespondingJSType } from '../corresponding_js_type'; + import { CandidValues } from '../candid_values_arb'; +import { CorrespondingJSType } from '../corresponding_js_type'; export function SimpleCandidValuesArb( arb: fc.Arbitrary, diff --git a/property_tests/arbitraries/canister_arb.ts b/property_tests/arbitraries/canister_arb.ts index bea781addd..aaf67e0598 100644 --- a/property_tests/arbitraries/canister_arb.ts +++ b/property_tests/arbitraries/canister_arb.ts @@ -1,12 +1,13 @@ import fc from 'fast-check'; -import { QueryMethod } from './canister_methods/query_method_arb'; + import { Test } from '../../test'; -import { UpdateMethod } from './canister_methods/update_method_arb'; +import { CliStringVisitor } from '../visitors/cli-string-visitor'; +import { CorrespondingJSType } from './candid/corresponding_js_type'; import { InitMethod } from './canister_methods/init_method_arb'; import { PostUpgradeMethod } from './canister_methods/post_upgrade_arb'; import { PreUpgradeMethod } from './canister_methods/pre_upgrade_method_arb'; -import { CorrespondingJSType } from './candid/corresponding_js_type'; -import { CliStringVisitor } from '../visitors/cli-string-visitor'; +import { QueryMethod } from './canister_methods/query_method_arb'; +import { UpdateMethod } from './canister_methods/update_method_arb'; export type Canister = { initArgs: string[] | undefined; diff --git a/property_tests/arbitraries/canister_methods/index.ts b/property_tests/arbitraries/canister_methods/index.ts index f923a77703..82958c2239 100644 --- a/property_tests/arbitraries/canister_methods/index.ts +++ b/property_tests/arbitraries/canister_methods/index.ts @@ -1,10 +1,10 @@ import fc from 'fast-check'; -import { CandidValueAndMeta } from '../candid/candid_value_and_meta_arb'; +import { Test } from '../../../test'; +import { Named } from '../..'; import { CandidReturnType } from '../candid/candid_return_type_arb'; +import { CandidValueAndMeta } from '../candid/candid_value_and_meta_arb'; import { CorrespondingJSType } from '../candid/corresponding_js_type'; -import { Named } from '../..'; -import { Test } from '../../../test'; export type BodyGenerator< ParamAgentArgumentValue extends CorrespondingJSType = undefined, diff --git a/property_tests/arbitraries/canister_methods/init_method_arb.ts b/property_tests/arbitraries/canister_methods/init_method_arb.ts index b7f5e7f6c8..1d837941f5 100644 --- a/property_tests/arbitraries/canister_methods/init_method_arb.ts +++ b/property_tests/arbitraries/canister_methods/init_method_arb.ts @@ -1,19 +1,19 @@ import fc from 'fast-check'; +import { Test } from '../../../test'; +import { Named } from '../..'; import { CandidValueAndMeta } from '../candid/candid_value_and_meta_arb'; import { CorrespondingJSType } from '../candid/corresponding_js_type'; +import { VoidArb } from '../candid/primitive/void'; import { UniqueIdentifierArb } from '../unique_identifier_arb'; -import { Named } from '../..'; import { BodyGenerator, - TestsGenerator, CallbackLocation, - isDefined, + CallbackLocationArb, generateCallback, - CallbackLocationArb + isDefined, + TestsGenerator } from '.'; -import { Test } from '../../../test'; -import { VoidArb } from '../candid/primitive/void'; export type InitMethod< ParamAgentArgumentValue extends CorrespondingJSType, diff --git a/property_tests/arbitraries/canister_methods/post_upgrade_arb.ts b/property_tests/arbitraries/canister_methods/post_upgrade_arb.ts index e37fb66184..f92890b5ed 100644 --- a/property_tests/arbitraries/canister_methods/post_upgrade_arb.ts +++ b/property_tests/arbitraries/canister_methods/post_upgrade_arb.ts @@ -1,18 +1,18 @@ import fc from 'fast-check'; +import { Test } from '../../../test'; +import { Named } from '../..'; import { CandidValueAndMeta } from '../candid/candid_value_and_meta_arb'; import { CorrespondingJSType } from '../candid/corresponding_js_type'; +import { VoidArb } from '../candid/primitive/void'; import { UniqueIdentifierArb } from '../unique_identifier_arb'; -import { Named } from '../..'; import { BodyGenerator, - TestsGenerator, CallbackLocation, + generateCallback, isDefined, - generateCallback + TestsGenerator } from '.'; -import { Test } from '../../../test'; -import { VoidArb } from '../candid/primitive/void'; export type PostUpgradeMethod< ParamAgentArgumentValue extends CorrespondingJSType, diff --git a/property_tests/arbitraries/canister_methods/pre_upgrade_method_arb.ts b/property_tests/arbitraries/canister_methods/pre_upgrade_method_arb.ts index 84be578add..87a7f75061 100644 --- a/property_tests/arbitraries/canister_methods/pre_upgrade_method_arb.ts +++ b/property_tests/arbitraries/canister_methods/pre_upgrade_method_arb.ts @@ -1,15 +1,15 @@ import fc from 'fast-check'; +import { Test } from '../../../test'; +import { VoidArb } from '../candid/primitive/void'; import { UniqueIdentifierArb } from '../unique_identifier_arb'; import { BodyGenerator, - TestsGenerator, CallbackLocation, + CallbackLocationArb, generateCallback, - CallbackLocationArb + TestsGenerator } from '.'; -import { Test } from '../../../test'; -import { VoidArb } from '../candid/primitive/void'; export type PreUpgradeMethod = { imports: Set; diff --git a/property_tests/arbitraries/canister_methods/query_method_arb.ts b/property_tests/arbitraries/canister_methods/query_method_arb.ts index bbafc49d42..cc5475a783 100644 --- a/property_tests/arbitraries/canister_methods/query_method_arb.ts +++ b/property_tests/arbitraries/canister_methods/query_method_arb.ts @@ -1,19 +1,19 @@ import fc from 'fast-check'; -import { CandidValueAndMeta } from '../candid/candid_value_and_meta_arb'; +import { Test } from '../../../test'; +import { Named } from '../..'; import { CandidReturnType } from '../candid/candid_return_type_arb'; +import { CandidValueAndMeta } from '../candid/candid_value_and_meta_arb'; import { CorrespondingJSType } from '../candid/corresponding_js_type'; import { UniqueIdentifierArb } from '../unique_identifier_arb'; -import { Named } from '../..'; import { BodyGenerator, - TestsGenerator, CallbackLocation, - isDefined, + CallbackLocationArb, generateCallback, - CallbackLocationArb + isDefined, + TestsGenerator } from '.'; -import { Test } from '../../../test'; export type QueryMethod = { imports: Set; diff --git a/property_tests/arbitraries/canister_methods/update_method_arb.ts b/property_tests/arbitraries/canister_methods/update_method_arb.ts index 4ae57bf6a8..a5780fccf7 100644 --- a/property_tests/arbitraries/canister_methods/update_method_arb.ts +++ b/property_tests/arbitraries/canister_methods/update_method_arb.ts @@ -1,18 +1,17 @@ import fc from 'fast-check'; -import { CandidValueAndMeta } from '../candid/candid_value_and_meta_arb'; +import { Test } from '../../../test'; +import { Named } from '../..'; import { CandidReturnType } from '../candid/candid_return_type_arb'; +import { CandidValueAndMeta } from '../candid/candid_value_and_meta_arb'; import { CorrespondingJSType } from '../candid/corresponding_js_type'; import { UniqueIdentifierArb } from '../unique_identifier_arb'; -import { Test } from '../../../test'; -import { Named } from '../..'; - import { BodyGenerator, - TestsGenerator, CallbackLocation, + generateCallback, isDefined, - generateCallback + TestsGenerator } from '.'; export type UpdateMethod = { diff --git a/property_tests/arbitraries/http/request_arb.ts b/property_tests/arbitraries/http/request_arb.ts index 55f6366564..b994116951 100644 --- a/property_tests/arbitraries/http/request_arb.ts +++ b/property_tests/arbitraries/http/request_arb.ts @@ -1,10 +1,11 @@ import fc from 'fast-check'; -import { HttpHeadersArb } from './headers_arb'; -import { BodyArb } from './body_arb'; + import { HttpRequest, None, Some } from '../../../src/lib'; import { CandidValueAndMeta } from '../candid/candid_value_and_meta_arb'; import { blobToSrcLiteral } from '../candid/to_src_literal/blob'; import { stringToSrcLiteral } from '../candid/to_src_literal/string'; +import { BodyArb } from './body_arb'; +import { HttpHeadersArb } from './headers_arb'; type RequestMethod = // | 'CONNECT' // Results in WARN hyper::proto::h1::role: unexpected content-length found, canceling diff --git a/property_tests/arbitraries/http/response_arb.ts b/property_tests/arbitraries/http/response_arb.ts index 554f268552..a029b4da8d 100644 --- a/property_tests/arbitraries/http/response_arb.ts +++ b/property_tests/arbitraries/http/response_arb.ts @@ -1,11 +1,12 @@ import fc from 'fast-check'; + import { HttpResponse, None } from '../../../src/lib'; -import { HttpHeadersArb } from './headers_arb'; -import { BodyArb } from './body_arb'; import { CandidValueAndMeta } from '../candid/candid_value_and_meta_arb'; import { CorrespondingJSType } from '../candid/corresponding_js_type'; import { blobToSrcLiteral } from '../candid/to_src_literal/blob'; import { stringToSrcLiteral } from '../candid/to_src_literal/string'; +import { BodyArb } from './body_arb'; +import { HttpHeadersArb } from './headers_arb'; export type HttpResponseAgentResponseValue = { status: number; diff --git a/property_tests/arbitraries/stable_b_tree_map_arb.ts b/property_tests/arbitraries/stable_b_tree_map_arb.ts index 4ed9a3e62f..07723dd694 100644 --- a/property_tests/arbitraries/stable_b_tree_map_arb.ts +++ b/property_tests/arbitraries/stable_b_tree_map_arb.ts @@ -1,7 +1,8 @@ import fc from 'fast-check'; + +import { CandidValueAndMetaArb } from './candid/candid_value_and_meta_arb'; import { UniqueIdentifierArb } from './unique_identifier_arb'; import { createUniquePrimitiveArb } from './unique_primitive_arb'; -import { CandidValueAndMetaArb } from './candid/candid_value_and_meta_arb'; type SerializableType = 'STABLE_JSON' | 'CANDID_TYPE_OBJECT'; diff --git a/property_tests/are_params_correctly_ordered.ts b/property_tests/are_params_correctly_ordered.ts index fec852875e..f8d616e4be 100644 --- a/property_tests/are_params_correctly_ordered.ts +++ b/property_tests/are_params_correctly_ordered.ts @@ -1,6 +1,6 @@ +import { Named } from '.'; import { CandidValueAndMeta } from './arbitraries/candid/candid_value_and_meta_arb'; import { CorrespondingJSType } from './arbitraries/candid/corresponding_js_type'; -import { Named } from '.'; export function areParamsCorrectlyOrdered( params: Named>[] diff --git a/property_tests/index.ts b/property_tests/index.ts index f782591a4e..8ed3c017fc 100644 --- a/property_tests/index.ts +++ b/property_tests/index.ts @@ -1,11 +1,11 @@ -import fc from 'fast-check'; +import { execSync } from 'child_process'; // @ts-ignore import libraryDeepEqual from 'deep-is'; - -import { Canister } from './arbitraries/canister_arb'; +import fc from 'fast-check'; import { existsSync, mkdirSync, writeFileSync } from 'fs'; -import { execSync } from 'child_process'; + import { runTests } from '../test'; +import { Canister } from './arbitraries/canister_arb'; import { clear as clearUniquePrimitiveArb } from './arbitraries/unique_primitive_arb'; export type Named = { diff --git a/property_tests/tests/blob/test/generate_body.ts b/property_tests/tests/blob/test/generate_body.ts index 2a2aee3be9..a4b13c01e7 100644 --- a/property_tests/tests/blob/test/generate_body.ts +++ b/property_tests/tests/blob/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/blob/test/test.ts b/property_tests/tests/blob/test/test.ts index 50ea35ab7b..7e40d0d46a 100644 --- a/property_tests/tests/blob/test/test.ts +++ b/property_tests/tests/blob/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { BlobArb } from 'azle/property_tests/arbitraries/candid/constructed/blob_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/bool/test/generate_body.ts b/property_tests/tests/bool/test/generate_body.ts index 1731b949f2..563aed3275 100644 --- a/property_tests/tests/bool/test/generate_body.ts +++ b/property_tests/tests/bool/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/bool/test/test.ts b/property_tests/tests/bool/test/test.ts index d05e1c9759..3f5c412239 100644 --- a/property_tests/tests/bool/test/test.ts +++ b/property_tests/tests/bool/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { BoolArb } from 'azle/property_tests/arbitraries/candid/primitive/bool'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/canister_methods/http_request/test/fletch.ts b/property_tests/tests/canister_methods/http_request/test/fletch.ts index 4806dadcbd..bfb9538c60 100644 --- a/property_tests/tests/canister_methods/http_request/test/fletch.ts +++ b/property_tests/tests/canister_methods/http_request/test/fletch.ts @@ -1,7 +1,8 @@ -import { execSync } from 'child_process'; +import * as dns from 'node:dns'; + import { HttpRequest } from 'azle'; import { getCanisterId } from 'azle/dfx'; -import * as dns from 'node:dns'; +import { execSync } from 'child_process'; dns.setDefaultResultOrder('ipv4first'); type HttpResponse = { diff --git a/property_tests/tests/canister_methods/http_request/test/test.ts b/property_tests/tests/canister_methods/http_request/test/test.ts index 5faf83fa1f..f106fa5012 100644 --- a/property_tests/tests/canister_methods/http_request/test/test.ts +++ b/property_tests/tests/canister_methods/http_request/test/test.ts @@ -1,15 +1,14 @@ -import fc from 'fast-check'; - import { HttpRequest } from 'azle'; import { runPropTests } from 'azle/property_tests'; +import { RecordArb } from 'azle/property_tests/arbitraries/candid/constructed/record_arb'; import { CanisterArb, CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; +import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; import { HttpRequestArb } from 'azle/property_tests/arbitraries/http/request_arb'; import { HttpResponseArb } from 'azle/property_tests/arbitraries/http/response_arb'; -import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; -import { RecordArb } from 'azle/property_tests/arbitraries/candid/constructed/record_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/canister_methods/http_request_update/test/fletch.ts b/property_tests/tests/canister_methods/http_request_update/test/fletch.ts index 4806dadcbd..bfb9538c60 100644 --- a/property_tests/tests/canister_methods/http_request_update/test/fletch.ts +++ b/property_tests/tests/canister_methods/http_request_update/test/fletch.ts @@ -1,7 +1,8 @@ -import { execSync } from 'child_process'; +import * as dns from 'node:dns'; + import { HttpRequest } from 'azle'; import { getCanisterId } from 'azle/dfx'; -import * as dns from 'node:dns'; +import { execSync } from 'child_process'; dns.setDefaultResultOrder('ipv4first'); type HttpResponse = { diff --git a/property_tests/tests/canister_methods/http_request_update/test/generate_tests.ts b/property_tests/tests/canister_methods/http_request_update/test/generate_tests.ts index 706f0902dd..4612819ec4 100644 --- a/property_tests/tests/canister_methods/http_request_update/test/generate_tests.ts +++ b/property_tests/tests/canister_methods/http_request_update/test/generate_tests.ts @@ -1,5 +1,5 @@ import { HttpRequest, HttpResponse } from 'azle'; -import { deepEqual, Named, getActor } from 'azle/property_tests'; +import { deepEqual, getActor, Named } from 'azle/property_tests'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { HttpResponseAgentResponseValue } from 'azle/property_tests/arbitraries/http/response_arb'; import { Test } from 'azle/test'; diff --git a/property_tests/tests/canister_methods/http_request_update/test/test.ts b/property_tests/tests/canister_methods/http_request_update/test/test.ts index 508951e9de..4b2ba01b16 100644 --- a/property_tests/tests/canister_methods/http_request_update/test/test.ts +++ b/property_tests/tests/canister_methods/http_request_update/test/test.ts @@ -1,19 +1,18 @@ -import fc from 'fast-check'; - import { HttpRequest } from 'azle'; import { runPropTests } from 'azle/property_tests'; +import { RecordArb } from 'azle/property_tests/arbitraries/candid/constructed/record_arb'; import { CanisterArb, CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; +import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import { UpdateMethodArb } from 'azle/property_tests/arbitraries/canister_methods/update_method_arb'; import { HttpRequestArb } from 'azle/property_tests/arbitraries/http/request_arb'; import { HttpResponseArb } from 'azle/property_tests/arbitraries/http/response_arb'; -import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; -import { RecordArb } from 'azle/property_tests/arbitraries/candid/constructed/record_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; -import { UpdateMethodArb } from 'azle/property_tests/arbitraries/canister_methods/update_method_arb'; const HttpRequestUpdateMethodArb = RecordArb().chain((record) => { const HttpRequestMethodArb = UpdateMethodArb( diff --git a/property_tests/tests/canister_methods/init/test/generate_callable_method_body.ts b/property_tests/tests/canister_methods/init/test/generate_callable_method_body.ts index d1adc9fbb2..42b2e2f5df 100644 --- a/property_tests/tests/canister_methods/init/test/generate_callable_method_body.ts +++ b/property_tests/tests/canister_methods/init/test/generate_callable_method_body.ts @@ -1,6 +1,6 @@ import { Named } from 'azle/property_tests'; -import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; +import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; export function generateBody( _namedParams: Named>[], diff --git a/property_tests/tests/canister_methods/init/test/generate_init_body.ts b/property_tests/tests/canister_methods/init/test/generate_init_body.ts index f53d66c2f0..47c4b8cb8e 100644 --- a/property_tests/tests/canister_methods/init/test/generate_init_body.ts +++ b/property_tests/tests/canister_methods/init/test/generate_init_body.ts @@ -1,6 +1,6 @@ import { Named } from 'azle/property_tests'; -import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; +import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/canister_methods/init/test/generate_tests.ts b/property_tests/tests/canister_methods/init/test/generate_tests.ts index 606909b13c..24c808b365 100644 --- a/property_tests/tests/canister_methods/init/test/generate_tests.ts +++ b/property_tests/tests/canister_methods/init/test/generate_tests.ts @@ -1,4 +1,4 @@ -import { deepEqual, Named, getActor } from 'azle/property_tests'; +import { deepEqual, getActor, Named } from 'azle/property_tests'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { Test } from 'azle/test'; diff --git a/property_tests/tests/canister_methods/init/test/test.ts b/property_tests/tests/canister_methods/init/test/test.ts index 4701478455..e78b987ca4 100644 --- a/property_tests/tests/canister_methods/init/test/test.ts +++ b/property_tests/tests/canister_methods/init/test/test.ts @@ -1,23 +1,22 @@ -import fc from 'fast-check'; - import { runPropTests } from 'azle/property_tests'; -import { CandidValueAndMetaArb } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { CandidReturnTypeArb } from 'azle/property_tests/arbitraries/candid/candid_return_type_arb'; +import { CandidValueAndMetaArb } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; +import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { CanisterArb, CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; -import { UpdateMethodArb } from 'azle/property_tests/arbitraries/canister_methods/update_method_arb'; +import { InitMethodArb } from 'azle/property_tests/arbitraries/canister_methods/init_method_arb'; import { QueryMethod, QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; -import { InitMethodArb } from 'azle/property_tests/arbitraries/canister_methods/init_method_arb'; +import { UpdateMethodArb } from 'azle/property_tests/arbitraries/canister_methods/update_method_arb'; +import fc from 'fast-check'; import { generateBody as callableMethodBodyGenerator } from './generate_callable_method_body'; import { generateBody as initBodyGenerator } from './generate_init_body'; import { generateTests } from './generate_tests'; -import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; // TODO multiplying by zero is to remove -0 // TODO we should open an issue with agent-js diff --git a/property_tests/tests/canister_methods/post_upgrade/test/generate_callable_method_body.ts b/property_tests/tests/canister_methods/post_upgrade/test/generate_callable_method_body.ts index d1adc9fbb2..42b2e2f5df 100644 --- a/property_tests/tests/canister_methods/post_upgrade/test/generate_callable_method_body.ts +++ b/property_tests/tests/canister_methods/post_upgrade/test/generate_callable_method_body.ts @@ -1,6 +1,6 @@ import { Named } from 'azle/property_tests'; -import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; +import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; export function generateBody( _namedParams: Named>[], diff --git a/property_tests/tests/canister_methods/post_upgrade/test/generate_init_method_body.ts b/property_tests/tests/canister_methods/post_upgrade/test/generate_init_method_body.ts index 048b4afac6..3409c1e4ea 100644 --- a/property_tests/tests/canister_methods/post_upgrade/test/generate_init_method_body.ts +++ b/property_tests/tests/canister_methods/post_upgrade/test/generate_init_method_body.ts @@ -1,7 +1,8 @@ import { Named } from 'azle/property_tests'; -import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; +import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; + import { globalInitVarName } from './global_var_name'; export function generateBody( diff --git a/property_tests/tests/canister_methods/post_upgrade/test/generate_init_tests.ts b/property_tests/tests/canister_methods/post_upgrade/test/generate_init_tests.ts index 02491c950f..956cc11e1c 100644 --- a/property_tests/tests/canister_methods/post_upgrade/test/generate_init_tests.ts +++ b/property_tests/tests/canister_methods/post_upgrade/test/generate_init_tests.ts @@ -1,4 +1,4 @@ -import { deepEqual, Named, getActor } from 'azle/property_tests'; +import { deepEqual, getActor, Named } from 'azle/property_tests'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { Test } from 'azle/test'; diff --git a/property_tests/tests/canister_methods/post_upgrade/test/generate_post_upgrade_method_body.ts b/property_tests/tests/canister_methods/post_upgrade/test/generate_post_upgrade_method_body.ts index 3b75533aa7..82bedd05a6 100644 --- a/property_tests/tests/canister_methods/post_upgrade/test/generate_post_upgrade_method_body.ts +++ b/property_tests/tests/canister_methods/post_upgrade/test/generate_post_upgrade_method_body.ts @@ -1,7 +1,8 @@ import { Named } from 'azle/property_tests'; -import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; +import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; + import { globalPostUpgradeVarName } from './global_var_name'; export function generateBody( diff --git a/property_tests/tests/canister_methods/post_upgrade/test/generate_post_upgrade_tests.ts b/property_tests/tests/canister_methods/post_upgrade/test/generate_post_upgrade_tests.ts index 673bfaaed1..ac4b0feeb2 100644 --- a/property_tests/tests/canister_methods/post_upgrade/test/generate_post_upgrade_tests.ts +++ b/property_tests/tests/canister_methods/post_upgrade/test/generate_post_upgrade_tests.ts @@ -1,4 +1,4 @@ -import { deepEqual, Named, getActor } from 'azle/property_tests'; +import { deepEqual, getActor, Named } from 'azle/property_tests'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { Test } from 'azle/test'; diff --git a/property_tests/tests/canister_methods/post_upgrade/test/test.ts b/property_tests/tests/canister_methods/post_upgrade/test/test.ts index 0e7ec8e284..831186495a 100644 --- a/property_tests/tests/canister_methods/post_upgrade/test/test.ts +++ b/property_tests/tests/canister_methods/post_upgrade/test/test.ts @@ -1,38 +1,37 @@ -import fc from 'fast-check'; - import { runPropTests } from 'azle/property_tests'; +import { candidDefinitionArb } from 'azle/property_tests/arbitraries/candid/candid_definition_arb'; +import { + CandidDefinition, + WithShapes +} from 'azle/property_tests/arbitraries/candid/candid_definition_arb/types'; +import { CandidReturnTypeArb } from 'azle/property_tests/arbitraries/candid/candid_return_type_arb'; import { CandidValueAndMeta, CandidValueAndMetaArb } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; -import { CandidReturnTypeArb } from 'azle/property_tests/arbitraries/candid/candid_return_type_arb'; +import { definitionAndValueToValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb_generator'; +import { CandidValueArb } from 'azle/property_tests/arbitraries/candid/candid_values_arb'; +import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { CanisterArb, CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; -import { UpdateMethodArb } from 'azle/property_tests/arbitraries/canister_methods/update_method_arb'; +import { InitMethodArb } from 'azle/property_tests/arbitraries/canister_methods/init_method_arb'; +import { PostUpgradeMethodArb } from 'azle/property_tests/arbitraries/canister_methods/post_upgrade_arb'; import { QueryMethod, QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; -import { PostUpgradeMethodArb } from 'azle/property_tests/arbitraries/canister_methods/post_upgrade_arb'; +import { UpdateMethodArb } from 'azle/property_tests/arbitraries/canister_methods/update_method_arb'; +import { DEFAULT_VALUE_MAX_DEPTH } from 'azle/property_tests/arbitraries/config'; +import fc from 'fast-check'; import { generateBody as callableMethodBodyGenerator } from './generate_callable_method_body'; -import { generateBody as postUpgradeMethodBodyGenerator } from './generate_post_upgrade_method_body'; import { generateBody as initMethodBodyGenerator } from './generate_init_method_body'; import { generateTests as generateInitTests } from './generate_init_tests'; +import { generateBody as postUpgradeMethodBodyGenerator } from './generate_post_upgrade_method_body'; import { generateTests as generatePostUpgradeTests } from './generate_post_upgrade_tests'; -import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; -import { InitMethodArb } from 'azle/property_tests/arbitraries/canister_methods/init_method_arb'; import { globalInitVarName, globalPostUpgradeVarName } from './global_var_name'; -import { candidDefinitionArb } from 'azle/property_tests/arbitraries/candid/candid_definition_arb'; -import { CandidValueArb } from 'azle/property_tests/arbitraries/candid/candid_values_arb'; -import { definitionAndValueToValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb_generator'; -import { - CandidDefinition, - WithShapes -} from 'azle/property_tests/arbitraries/candid/candid_definition_arb/types'; -import { DEFAULT_VALUE_MAX_DEPTH } from 'azle/property_tests/arbitraries/config'; const CanisterConfigArb = fc .array(candidDefinitionArb({})) diff --git a/property_tests/tests/canister_methods/pre_upgrade/test/test.ts b/property_tests/tests/canister_methods/pre_upgrade/test/test.ts index 34e7945e41..9e517424ce 100644 --- a/property_tests/tests/canister_methods/pre_upgrade/test/test.ts +++ b/property_tests/tests/canister_methods/pre_upgrade/test/test.ts @@ -1,19 +1,18 @@ -import fc from 'fast-check'; - import { deepEqual, getActor, runPropTests } from 'azle/property_tests'; -import { CandidValueAndMetaArb } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { CandidReturnTypeArb } from 'azle/property_tests/arbitraries/candid/candid_return_type_arb'; +import { CandidValueAndMetaArb } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { CanisterArb, CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; -import { UpdateMethodArb } from 'azle/property_tests/arbitraries/canister_methods/update_method_arb'; +import { PreUpgradeMethodArb } from 'azle/property_tests/arbitraries/canister_methods/pre_upgrade_method_arb'; import { QueryMethod, QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; -import { PreUpgradeMethodArb } from 'azle/property_tests/arbitraries/canister_methods/pre_upgrade_method_arb'; +import { UpdateMethodArb } from 'azle/property_tests/arbitraries/canister_methods/update_method_arb'; +import fc from 'fast-check'; const SimplePreUpgradeArb = PreUpgradeMethodArb({ generateBody: () => diff --git a/property_tests/tests/canister_methods/query/test/generate_body.ts b/property_tests/tests/canister_methods/query/test/generate_body.ts index 960b3c19a3..0a78fed29d 100644 --- a/property_tests/tests/canister_methods/query/test/generate_body.ts +++ b/property_tests/tests/canister_methods/query/test/generate_body.ts @@ -1,8 +1,8 @@ -import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; -import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; +import { Named } from 'azle/property_tests'; import { CandidReturnType } from 'azle/property_tests/arbitraries/candid/candid_return_type_arb'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; -import { Named } from 'azle/property_tests'; +import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; +import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( namedParams: Named>[], diff --git a/property_tests/tests/canister_methods/query/test/generate_tests.ts b/property_tests/tests/canister_methods/query/test/generate_tests.ts index 038614e43e..d4359e5115 100644 --- a/property_tests/tests/canister_methods/query/test/generate_tests.ts +++ b/property_tests/tests/canister_methods/query/test/generate_tests.ts @@ -1,7 +1,7 @@ import { deepEqual, getActor, Named } from 'azle/property_tests'; -import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { CandidReturnType } from 'azle/property_tests/arbitraries/candid/candid_return_type_arb'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; +import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; import { Test } from 'azle/test'; export function generateTests( diff --git a/property_tests/tests/canister_methods/query/test/test.ts b/property_tests/tests/canister_methods/query/test/test.ts index bc56880a19..a87c4fed13 100644 --- a/property_tests/tests/canister_methods/query/test/test.ts +++ b/property_tests/tests/canister_methods/query/test/test.ts @@ -1,13 +1,12 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; -import { CandidValueAndMetaArb } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { CandidReturnTypeArb } from 'azle/property_tests/arbitraries/candid/candid_return_type_arb'; +import { CandidValueAndMetaArb } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { CanisterArb, CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/canister_methods/update/test/generate_body.ts b/property_tests/tests/canister_methods/update/test/generate_body.ts index ed946fc4c8..0a78fed29d 100644 --- a/property_tests/tests/canister_methods/update/test/generate_body.ts +++ b/property_tests/tests/canister_methods/update/test/generate_body.ts @@ -1,8 +1,8 @@ -import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; -import { CandidReturnType } from 'azle/property_tests/arbitraries/candid/candid_return_type_arb'; import { Named } from 'azle/property_tests'; +import { CandidReturnType } from 'azle/property_tests/arbitraries/candid/candid_return_type_arb'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; +import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( namedParams: Named>[], diff --git a/property_tests/tests/canister_methods/update/test/generate_tests.ts b/property_tests/tests/canister_methods/update/test/generate_tests.ts index 887d1001ba..29bff5bae6 100644 --- a/property_tests/tests/canister_methods/update/test/generate_tests.ts +++ b/property_tests/tests/canister_methods/update/test/generate_tests.ts @@ -1,8 +1,8 @@ -import { deepEqual, Named, getActor } from 'azle/property_tests'; -import { Test } from 'azle/test'; +import { deepEqual, getActor, Named } from 'azle/property_tests'; import { CandidReturnType } from 'azle/property_tests/arbitraries/candid/candid_return_type_arb'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type'; +import { Test } from 'azle/test'; export function generateTests( functionName: string, diff --git a/property_tests/tests/canister_methods/update/test/test.ts b/property_tests/tests/canister_methods/update/test/test.ts index 0df239cac8..724fd73586 100644 --- a/property_tests/tests/canister_methods/update/test/test.ts +++ b/property_tests/tests/canister_methods/update/test/test.ts @@ -1,13 +1,12 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; -import { CandidValueAndMetaArb } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { CandidReturnTypeArb } from 'azle/property_tests/arbitraries/candid/candid_return_type_arb'; +import { CandidValueAndMetaArb } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { CanisterArb, CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { UpdateMethodArb } from 'azle/property_tests/arbitraries/canister_methods/update_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/float32/test/generate_body.ts b/property_tests/tests/float32/test/generate_body.ts index e30bddd47f..be4f256104 100644 --- a/property_tests/tests/float32/test/generate_body.ts +++ b/property_tests/tests/float32/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/float32/test/test.ts b/property_tests/tests/float32/test/test.ts index 57857e6035..f1db52f992 100644 --- a/property_tests/tests/float32/test/test.ts +++ b/property_tests/tests/float32/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { Float32Arb } from 'azle/property_tests/arbitraries/candid/primitive/floats/float32_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/float64/test/generate_body.ts b/property_tests/tests/float64/test/generate_body.ts index 5693308553..f3fc35fa4b 100644 --- a/property_tests/tests/float64/test/generate_body.ts +++ b/property_tests/tests/float64/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/float64/test/test.ts b/property_tests/tests/float64/test/test.ts index e25bab348f..86f3534711 100644 --- a/property_tests/tests/float64/test/test.ts +++ b/property_tests/tests/float64/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { Float64Arb } from 'azle/property_tests/arbitraries/candid/primitive/floats/float64_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/func/test/generate_body.ts b/property_tests/tests/func/test/generate_body.ts index 1a43c3195d..9311c41d89 100644 --- a/property_tests/tests/func/test/generate_body.ts +++ b/property_tests/tests/func/test/generate_body.ts @@ -1,6 +1,6 @@ +import { Named } from 'azle/property_tests'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Func } from 'azle/property_tests/arbitraries/candid/reference/func_arb'; -import { Named } from 'azle/property_tests'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/func/test/test.ts b/property_tests/tests/func/test/test.ts index db8e8a9dcb..60e7f9b8ed 100644 --- a/property_tests/tests/func/test/test.ts +++ b/property_tests/tests/func/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { FuncArb } from 'azle/property_tests/arbitraries/candid/reference/func_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/int/test/generate_body.ts b/property_tests/tests/int/test/generate_body.ts index 88171062e8..213bb0ae99 100644 --- a/property_tests/tests/int/test/generate_body.ts +++ b/property_tests/tests/int/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/int/test/test.ts b/property_tests/tests/int/test/test.ts index 96e9919a77..ef28ef7b35 100644 --- a/property_tests/tests/int/test/test.ts +++ b/property_tests/tests/int/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { IntArb } from 'azle/property_tests/arbitraries/candid/primitive/ints/int_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/int16/test/generate_body.ts b/property_tests/tests/int16/test/generate_body.ts index e17bc72bfe..0f26a55321 100644 --- a/property_tests/tests/int16/test/generate_body.ts +++ b/property_tests/tests/int16/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/int16/test/test.ts b/property_tests/tests/int16/test/test.ts index 46008e7d56..934c7f6627 100644 --- a/property_tests/tests/int16/test/test.ts +++ b/property_tests/tests/int16/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { Int16Arb } from 'azle/property_tests/arbitraries/candid/primitive/ints/int16_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/int32/test/generate_body.ts b/property_tests/tests/int32/test/generate_body.ts index 16b9a29550..fcac9922a5 100644 --- a/property_tests/tests/int32/test/generate_body.ts +++ b/property_tests/tests/int32/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/int32/test/test.ts b/property_tests/tests/int32/test/test.ts index b2790bf8c7..5179729c64 100644 --- a/property_tests/tests/int32/test/test.ts +++ b/property_tests/tests/int32/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { Int32Arb } from 'azle/property_tests/arbitraries/candid/primitive/ints/int32_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/int64/test/generate_body.ts b/property_tests/tests/int64/test/generate_body.ts index 90bafab51e..a176e72b06 100644 --- a/property_tests/tests/int64/test/generate_body.ts +++ b/property_tests/tests/int64/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/int64/test/test.ts b/property_tests/tests/int64/test/test.ts index 8cc9552327..805a119720 100644 --- a/property_tests/tests/int64/test/test.ts +++ b/property_tests/tests/int64/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { Int64Arb } from 'azle/property_tests/arbitraries/candid/primitive/ints/int64_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/int8/test/generate_body.ts b/property_tests/tests/int8/test/generate_body.ts index 86ec62ff08..030c06a9bc 100644 --- a/property_tests/tests/int8/test/generate_body.ts +++ b/property_tests/tests/int8/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/int8/test/test.ts b/property_tests/tests/int8/test/test.ts index 0d1a76c5e9..9a65592316 100644 --- a/property_tests/tests/int8/test/test.ts +++ b/property_tests/tests/int8/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { Int8Arb } from 'azle/property_tests/arbitraries/candid/primitive/ints/int8_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/nat/test/generate_body.ts b/property_tests/tests/nat/test/generate_body.ts index fb4f9c7810..ba2e63496a 100644 --- a/property_tests/tests/nat/test/generate_body.ts +++ b/property_tests/tests/nat/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/nat/test/test.ts b/property_tests/tests/nat/test/test.ts index 455d096f7e..3ddfcda8cf 100644 --- a/property_tests/tests/nat/test/test.ts +++ b/property_tests/tests/nat/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { NatArb } from 'azle/property_tests/arbitraries/candid/primitive/nats/nat_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/nat16/test/generate_body.ts b/property_tests/tests/nat16/test/generate_body.ts index 116fb89d0c..36c5809b54 100644 --- a/property_tests/tests/nat16/test/generate_body.ts +++ b/property_tests/tests/nat16/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/nat16/test/test.ts b/property_tests/tests/nat16/test/test.ts index 5ee8833562..02f4094076 100644 --- a/property_tests/tests/nat16/test/test.ts +++ b/property_tests/tests/nat16/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { Nat16Arb } from 'azle/property_tests/arbitraries/candid/primitive/nats/nat16_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/nat32/test/generate_body.ts b/property_tests/tests/nat32/test/generate_body.ts index c96a9cd2e3..3ead7aca94 100644 --- a/property_tests/tests/nat32/test/generate_body.ts +++ b/property_tests/tests/nat32/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/nat32/test/test.ts b/property_tests/tests/nat32/test/test.ts index e841f0a5c7..13f86bd6d1 100644 --- a/property_tests/tests/nat32/test/test.ts +++ b/property_tests/tests/nat32/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { Nat32Arb } from 'azle/property_tests/arbitraries/candid/primitive/nats/nat32_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/nat64/test/generate_body.ts b/property_tests/tests/nat64/test/generate_body.ts index de3eaa9eba..423f9a0013 100644 --- a/property_tests/tests/nat64/test/generate_body.ts +++ b/property_tests/tests/nat64/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/nat64/test/test.ts b/property_tests/tests/nat64/test/test.ts index 5940b0f349..4d94191d05 100644 --- a/property_tests/tests/nat64/test/test.ts +++ b/property_tests/tests/nat64/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { Nat64Arb } from 'azle/property_tests/arbitraries/candid/primitive/nats/nat64_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/nat8/test/generate_body.ts b/property_tests/tests/nat8/test/generate_body.ts index 0b9479d261..1a06f4ec48 100644 --- a/property_tests/tests/nat8/test/generate_body.ts +++ b/property_tests/tests/nat8/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/nat8/test/test.ts b/property_tests/tests/nat8/test/test.ts index 0e8efb63b3..05235f5ff8 100644 --- a/property_tests/tests/nat8/test/test.ts +++ b/property_tests/tests/nat8/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { Nat8Arb } from 'azle/property_tests/arbitraries/candid/primitive/nats/nat8_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/null/test/generate_body.ts b/property_tests/tests/null/test/generate_body.ts index 553eaeb441..407c964407 100644 --- a/property_tests/tests/null/test/generate_body.ts +++ b/property_tests/tests/null/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; export function generateBody( namedParamNulls: Named>[], diff --git a/property_tests/tests/null/test/test.ts b/property_tests/tests/null/test/test.ts index b51d768825..9471ead31a 100644 --- a/property_tests/tests/null/test/test.ts +++ b/property_tests/tests/null/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { NullArb } from 'azle/property_tests/arbitraries/candid/primitive/null'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/opt/test/generate_body.ts b/property_tests/tests/opt/test/generate_body.ts index fe74aa8e7e..1973730d8e 100644 --- a/property_tests/tests/opt/test/generate_body.ts +++ b/property_tests/tests/opt/test/generate_body.ts @@ -1,6 +1,6 @@ +import { Named } from 'azle/property_tests'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Opt } from 'azle/property_tests/arbitraries/candid/constructed/opt_arb'; -import { Named } from 'azle/property_tests'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/opt/test/test.ts b/property_tests/tests/opt/test/test.ts index fa4b1ce89b..4d2ed7d160 100644 --- a/property_tests/tests/opt/test/test.ts +++ b/property_tests/tests/opt/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { OptArb } from 'azle/property_tests/arbitraries/candid/constructed/opt_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/principal/test/generate_body.ts b/property_tests/tests/principal/test/generate_body.ts index 4119207627..69dc896e1a 100644 --- a/property_tests/tests/principal/test/generate_body.ts +++ b/property_tests/tests/principal/test/generate_body.ts @@ -1,7 +1,6 @@ import { Principal } from '@dfinity/principal'; - -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/principal/test/generate_tests.ts b/property_tests/tests/principal/test/generate_tests.ts index aa42fbbc34..adccf33806 100644 --- a/property_tests/tests/principal/test/generate_tests.ts +++ b/property_tests/tests/principal/test/generate_tests.ts @@ -1,5 +1,4 @@ import { Principal } from '@dfinity/principal'; - import { deepEqual, getActor, Named } from 'azle/property_tests'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Test } from 'azle/test'; diff --git a/property_tests/tests/principal/test/test.ts b/property_tests/tests/principal/test/test.ts index bd1cbc4784..43e6717339 100644 --- a/property_tests/tests/principal/test/test.ts +++ b/property_tests/tests/principal/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { PrincipalArb } from 'azle/property_tests/arbitraries/candid/reference/principal_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/record/test/generate_body.ts b/property_tests/tests/record/test/generate_body.ts index 63332122f2..56d5b4a55f 100644 --- a/property_tests/tests/record/test/generate_body.ts +++ b/property_tests/tests/record/test/generate_body.ts @@ -1,6 +1,6 @@ +import { Named } from 'azle/property_tests'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Record } from 'azle/property_tests/arbitraries/candid/constructed/record_arb'; -import { Named } from 'azle/property_tests'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/record/test/test.ts b/property_tests/tests/record/test/test.ts index 62a3647916..e7f2b76423 100644 --- a/property_tests/tests/record/test/test.ts +++ b/property_tests/tests/record/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { RecordArb } from 'azle/property_tests/arbitraries/candid/constructed/record_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/recursive/test/generate_body.ts b/property_tests/tests/recursive/test/generate_body.ts index cec3076211..6488fdc42b 100644 --- a/property_tests/tests/recursive/test/generate_body.ts +++ b/property_tests/tests/recursive/test/generate_body.ts @@ -1,6 +1,6 @@ +import { Named } from 'azle/property_tests'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Recursive } from 'azle/property_tests/arbitraries/candid/recursive'; -import { Named } from 'azle/property_tests'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/recursive/test/generate_tests.ts b/property_tests/tests/recursive/test/generate_tests.ts index bfe05cead8..234c5ec79a 100644 --- a/property_tests/tests/recursive/test/generate_tests.ts +++ b/property_tests/tests/recursive/test/generate_tests.ts @@ -1,4 +1,4 @@ -import { getActor, Named, deepEqual } from 'azle/property_tests'; +import { deepEqual, getActor, Named } from 'azle/property_tests'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Recursive } from 'azle/property_tests/arbitraries/candid/recursive'; import { Test } from 'azle/test'; diff --git a/property_tests/tests/recursive/test/test.ts b/property_tests/tests/recursive/test/test.ts index 3739ba8090..c506cf5f96 100644 --- a/property_tests/tests/recursive/test/test.ts +++ b/property_tests/tests/recursive/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { RecursiveArb } from 'azle/property_tests/arbitraries/candid/recursive'; import { @@ -8,6 +6,7 @@ import { } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; import { UpdateMethodArb } from 'azle/property_tests/arbitraries/canister_methods/update_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/service/test/generate_body.ts b/property_tests/tests/service/test/generate_body.ts index 384cf734de..21e6caaec4 100644 --- a/property_tests/tests/service/test/generate_body.ts +++ b/property_tests/tests/service/test/generate_body.ts @@ -1,7 +1,6 @@ import { Principal } from '@dfinity/principal'; - -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; export function generateBody( namedParamServices: Named>[], diff --git a/property_tests/tests/service/test/generate_tests.ts b/property_tests/tests/service/test/generate_tests.ts index 3ed780de99..4abe1e70ee 100644 --- a/property_tests/tests/service/test/generate_tests.ts +++ b/property_tests/tests/service/test/generate_tests.ts @@ -1,9 +1,8 @@ import { Principal } from '@dfinity/principal'; -import { execSync } from 'child_process'; - -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Test } from 'azle/test'; +import { execSync } from 'child_process'; export function generateTests( functionName: string, diff --git a/property_tests/tests/service/test/test.ts b/property_tests/tests/service/test/test.ts index 621a28301a..1194fc3cc5 100644 --- a/property_tests/tests/service/test/test.ts +++ b/property_tests/tests/service/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { ServiceArb } from 'azle/property_tests/arbitraries/candid/reference/service_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/stable_b_tree_map/test/contains_key.ts b/property_tests/tests/stable_b_tree_map/test/contains_key.ts index 3c917618d6..2b255606ba 100644 --- a/property_tests/tests/stable_b_tree_map/test/contains_key.ts +++ b/property_tests/tests/stable_b_tree_map/test/contains_key.ts @@ -1,10 +1,9 @@ -import fc from 'fast-check'; - import { deepEqual, getActor } from 'azle/property_tests'; -import { Test } from 'azle/test'; -import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; +import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; +import { Test } from 'azle/test'; +import fc from 'fast-check'; export function ContainsKeyTestArb(stableBTreeMap: StableBTreeMap) { return fc diff --git a/property_tests/tests/stable_b_tree_map/test/get.ts b/property_tests/tests/stable_b_tree_map/test/get.ts index 010b65bff2..f26d8a41c1 100644 --- a/property_tests/tests/stable_b_tree_map/test/get.ts +++ b/property_tests/tests/stable_b_tree_map/test/get.ts @@ -1,10 +1,9 @@ -import fc from 'fast-check'; - -import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; import { deepEqual, getActor } from 'azle/property_tests'; -import { Test } from 'azle/test'; -import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; +import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; +import { Test } from 'azle/test'; +import fc from 'fast-check'; export function GetTestArb(stableBTreeMap: StableBTreeMap) { return fc diff --git a/property_tests/tests/stable_b_tree_map/test/insert.ts b/property_tests/tests/stable_b_tree_map/test/insert.ts index 180c6ccf8e..2686b184a0 100644 --- a/property_tests/tests/stable_b_tree_map/test/insert.ts +++ b/property_tests/tests/stable_b_tree_map/test/insert.ts @@ -1,10 +1,9 @@ -import fc from 'fast-check'; - -import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; import { deepEqual, getActor } from 'azle/property_tests'; -import { Test } from 'azle/test'; -import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; +import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; +import { Test } from 'azle/test'; +import fc from 'fast-check'; export function InsertTestArb(stableBTreeMap: StableBTreeMap) { return fc diff --git a/property_tests/tests/stable_b_tree_map/test/is_empty.ts b/property_tests/tests/stable_b_tree_map/test/is_empty.ts index e4a15de482..a42a16140a 100644 --- a/property_tests/tests/stable_b_tree_map/test/is_empty.ts +++ b/property_tests/tests/stable_b_tree_map/test/is_empty.ts @@ -1,10 +1,9 @@ -import fc from 'fast-check'; - -import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; import { deepEqual, getActor } from 'azle/property_tests'; -import { Test } from 'azle/test'; -import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; +import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; +import { Test } from 'azle/test'; +import fc from 'fast-check'; export function IsEmptyTestArb(stableBTreeMap: StableBTreeMap) { return fc diff --git a/property_tests/tests/stable_b_tree_map/test/items.ts b/property_tests/tests/stable_b_tree_map/test/items.ts index 640f65c510..0232341d43 100644 --- a/property_tests/tests/stable_b_tree_map/test/items.ts +++ b/property_tests/tests/stable_b_tree_map/test/items.ts @@ -1,10 +1,9 @@ -import fc from 'fast-check'; - -import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; import { deepEqual, getActor } from 'azle/property_tests'; -import { Test } from 'azle/test'; -import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; +import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; +import { Test } from 'azle/test'; +import fc from 'fast-check'; export function ItemsTestArb(stableBTreeMap: StableBTreeMap) { return fc diff --git a/property_tests/tests/stable_b_tree_map/test/keys.ts b/property_tests/tests/stable_b_tree_map/test/keys.ts index 00f59d3950..310681c750 100644 --- a/property_tests/tests/stable_b_tree_map/test/keys.ts +++ b/property_tests/tests/stable_b_tree_map/test/keys.ts @@ -1,11 +1,11 @@ -import fc from 'fast-check'; - -import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; import { deepEqual, getActor } from 'azle/property_tests'; +import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; +import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; import { Test } from 'azle/test'; +import fc from 'fast-check'; + import { getArrayForCandidType, getArrayStringForCandidType } from './utils'; -import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; -import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; export function KeysTestArb(stableBTreeMap: StableBTreeMap) { return fc diff --git a/property_tests/tests/stable_b_tree_map/test/len.ts b/property_tests/tests/stable_b_tree_map/test/len.ts index 643e8a1047..4045af0cb9 100644 --- a/property_tests/tests/stable_b_tree_map/test/len.ts +++ b/property_tests/tests/stable_b_tree_map/test/len.ts @@ -1,10 +1,9 @@ -import fc from 'fast-check'; - -import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; import { deepEqual, getActor } from 'azle/property_tests'; -import { Test } from 'azle/test'; -import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; +import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; +import { Test } from 'azle/test'; +import fc from 'fast-check'; export function LenTestArb(stableBTreeMap: StableBTreeMap) { return fc diff --git a/property_tests/tests/stable_b_tree_map/test/remove.ts b/property_tests/tests/stable_b_tree_map/test/remove.ts index 5309333307..2a6fdf49f1 100644 --- a/property_tests/tests/stable_b_tree_map/test/remove.ts +++ b/property_tests/tests/stable_b_tree_map/test/remove.ts @@ -1,10 +1,9 @@ -import fc from 'fast-check'; - -import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; import { deepEqual, getActor } from 'azle/property_tests'; -import { Test } from 'azle/test'; -import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; +import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; +import { Test } from 'azle/test'; +import fc from 'fast-check'; export function RemoveTestArb(stableBTreeMap: StableBTreeMap) { return fc diff --git a/property_tests/tests/stable_b_tree_map/test/test.ts b/property_tests/tests/stable_b_tree_map/test/test.ts index 51770bb8fe..9da11bc00a 100644 --- a/property_tests/tests/stable_b_tree_map/test/test.ts +++ b/property_tests/tests/stable_b_tree_map/test/test.ts @@ -1,17 +1,17 @@ -import fc from 'fast-check'; - import { runPropTests } from 'azle/property_tests'; import { CanisterArb } from 'azle/property_tests/arbitraries/canister_arb'; import { StableBTreeMapArb } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; +import fc from 'fast-check'; + import { ContainsKeyTestArb } from './contains_key'; import { GetTestArb } from './get'; +import { InsertTestArb } from './insert'; import { IsEmptyTestArb } from './is_empty'; import { ItemsTestArb } from './items'; import { KeysTestArb } from './keys'; import { LenTestArb } from './len'; import { RemoveTestArb } from './remove'; import { ValuesTestArb } from './values'; -import { InsertTestArb } from './insert'; const StableBTreeMapTestArb = fc .array( diff --git a/property_tests/tests/stable_b_tree_map/test/values.ts b/property_tests/tests/stable_b_tree_map/test/values.ts index 1c2f13624d..75567584e1 100644 --- a/property_tests/tests/stable_b_tree_map/test/values.ts +++ b/property_tests/tests/stable_b_tree_map/test/values.ts @@ -1,11 +1,11 @@ -import fc from 'fast-check'; - -import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; import { deepEqual, getActor } from 'azle/property_tests'; +import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb'; +import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; import { Test } from 'azle/test'; +import fc from 'fast-check'; + import { getArrayForCandidType, getArrayStringForCandidType } from './utils'; -import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb'; -import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; export function ValuesTestArb(stableBTreeMap: StableBTreeMap) { return fc diff --git a/property_tests/tests/text/test/generate_body.ts b/property_tests/tests/text/test/generate_body.ts index 14cb6370d0..0e2091277f 100644 --- a/property_tests/tests/text/test/generate_body.ts +++ b/property_tests/tests/text/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/text/test/test.ts b/property_tests/tests/text/test/test.ts index afe08eb274..10d60b62e3 100644 --- a/property_tests/tests/text/test/test.ts +++ b/property_tests/tests/text/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { TextArb } from 'azle/property_tests/arbitraries/candid/primitive/text'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/tuple/test/generate_body.ts b/property_tests/tests/tuple/test/generate_body.ts index f0558e84f6..9db56b18d1 100644 --- a/property_tests/tests/tuple/test/generate_body.ts +++ b/property_tests/tests/tuple/test/generate_body.ts @@ -1,9 +1,9 @@ +import { Named } from 'azle/property_tests'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { - Tuple, - ReturnTuple + ReturnTuple, + Tuple } from 'azle/property_tests/arbitraries/candid/constructed/tuple_arb'; -import { Named } from 'azle/property_tests'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/tuple/test/generate_tests.ts b/property_tests/tests/tuple/test/generate_tests.ts index e0ba2bb7ae..5740c9a8fc 100644 --- a/property_tests/tests/tuple/test/generate_tests.ts +++ b/property_tests/tests/tuple/test/generate_tests.ts @@ -1,8 +1,8 @@ import { deepEqual, getActor, Named } from 'azle/property_tests'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { - Tuple, - ReturnTuple + ReturnTuple, + Tuple } from 'azle/property_tests/arbitraries/candid/constructed/tuple_arb'; import { Test } from 'azle/test'; diff --git a/property_tests/tests/tuple/test/test.ts b/property_tests/tests/tuple/test/test.ts index 8f00409b2b..bea642699a 100644 --- a/property_tests/tests/tuple/test/test.ts +++ b/property_tests/tests/tuple/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { TupleArb } from 'azle/property_tests/arbitraries/candid/constructed/tuple_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/variant/test/generate_body.ts b/property_tests/tests/variant/test/generate_body.ts index c6c2ed6a69..30e7aea51d 100644 --- a/property_tests/tests/variant/test/generate_body.ts +++ b/property_tests/tests/variant/test/generate_body.ts @@ -1,6 +1,6 @@ +import { Named } from 'azle/property_tests'; import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Variant } from 'azle/property_tests/arbitraries/candid/constructed/variant_arb'; -import { Named } from 'azle/property_tests'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/variant/test/test.ts b/property_tests/tests/variant/test/test.ts index afac895e54..c0c950b649 100644 --- a/property_tests/tests/variant/test/test.ts +++ b/property_tests/tests/variant/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { VariantArb } from 'azle/property_tests/arbitraries/candid/constructed/variant_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/property_tests/tests/vec/test/generate_body.ts b/property_tests/tests/vec/test/generate_body.ts index 5ebd339506..e209ee6cd3 100644 --- a/property_tests/tests/vec/test/generate_body.ts +++ b/property_tests/tests/vec/test/generate_body.ts @@ -1,5 +1,5 @@ -import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { Named } from 'azle/property_tests'; +import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb'; import { areParamsCorrectlyOrdered } from 'azle/property_tests/are_params_correctly_ordered'; export function generateBody( diff --git a/property_tests/tests/vec/test/test.ts b/property_tests/tests/vec/test/test.ts index 269b1adfe6..423494bc97 100644 --- a/property_tests/tests/vec/test/test.ts +++ b/property_tests/tests/vec/test/test.ts @@ -1,5 +1,3 @@ -import fc from 'fast-check'; - import { defaultArrayConstraints, runPropTests } from 'azle/property_tests'; import { VecArb } from 'azle/property_tests/arbitraries/candid/constructed/vec_arb'; import { @@ -7,6 +5,7 @@ import { CanisterConfig } from 'azle/property_tests/arbitraries/canister_arb'; import { QueryMethodArb } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb'; +import fc from 'fast-check'; import { generateBody } from './generate_body'; import { generateTests } from './generate_tests'; diff --git a/scripts/hash_file/index.ts b/scripts/hash_file/index.ts index e7b10aba00..053960edca 100644 --- a/scripts/hash_file/index.ts +++ b/scripts/hash_file/index.ts @@ -1,5 +1,5 @@ import { createHash } from 'crypto'; -import { open, FileReadResult } from 'fs/promises'; +import { FileReadResult, open } from 'fs/promises'; export async function hashFile(path: string): Promise { return await hashFileByParts(path, 0); diff --git a/src/compiler/compile_typescript_code.ts b/src/compiler/compile_typescript_code.ts index 883e10229b..e828cd5e12 100644 --- a/src/compiler/compile_typescript_code.ts +++ b/src/compiler/compile_typescript_code.ts @@ -1,6 +1,7 @@ import { buildSync } from 'esbuild'; -import { JavaScript, TypeScript } from './utils/types'; + import { Result } from './utils/result'; +import { JavaScript, TypeScript } from './utils/types'; export function compileTypeScriptToJavaScript( main: string, diff --git a/src/compiler/file_uploader/expand_paths.ts b/src/compiler/file_uploader/expand_paths.ts index acf153ebee..3eeaa60441 100644 --- a/src/compiler/file_uploader/expand_paths.ts +++ b/src/compiler/file_uploader/expand_paths.ts @@ -1,6 +1,7 @@ import { readdir, stat } from 'fs/promises'; import { join } from 'path'; -import { Src, Dest } from '.'; + +import { Dest, Src } from '.'; export async function expandPaths(paths: [Src, Dest][]) { return paths.reduce( diff --git a/src/compiler/file_uploader/incomplete_files.ts b/src/compiler/file_uploader/incomplete_files.ts index f5f50ca6b0..6693141dc0 100644 --- a/src/compiler/file_uploader/incomplete_files.ts +++ b/src/compiler/file_uploader/incomplete_files.ts @@ -1,5 +1,5 @@ -import { Src, Dest } from '.'; import { filterAsync } from '../utils/filter_async'; +import { Dest, Src } from '.'; import { UploaderActor } from './uploader_actor'; export async function getListOfIncompleteFiles( diff --git a/src/compiler/file_uploader/index.ts b/src/compiler/file_uploader/index.ts index 703d2a3b99..07ed9fe16b 100644 --- a/src/compiler/file_uploader/index.ts +++ b/src/compiler/file_uploader/index.ts @@ -1,7 +1,7 @@ import { getCanisterId } from '../../../dfx'; import { expandPaths } from './expand_paths'; -import { uploadFile } from './upload_file'; import { onBeforeExit } from './on_before_exit'; +import { uploadFile } from './upload_file'; import { createActor } from './uploader_actor'; import { generateUploaderIdentity } from './uploader_identity'; diff --git a/src/compiler/file_uploader/on_before_exit.ts b/src/compiler/file_uploader/on_before_exit.ts index bf798eec25..d7097762da 100644 --- a/src/compiler/file_uploader/on_before_exit.ts +++ b/src/compiler/file_uploader/on_before_exit.ts @@ -1,6 +1,6 @@ import { Dest, Src } from '.'; import { getListOfIncompleteFiles } from './incomplete_files'; -import { OngoingHashingJob, getOngoingHashingJobs } from './ongoing_hashes'; +import { getOngoingHashingJobs, OngoingHashingJob } from './ongoing_hashes'; import { UploaderActor } from './uploader_actor'; export function onBeforeExit(paths: [Src, Dest][], actor: UploaderActor) { diff --git a/src/compiler/file_uploader/upload_file.ts b/src/compiler/file_uploader/upload_file.ts index d69ba88aa2..ec07e5d0ea 100644 --- a/src/compiler/file_uploader/upload_file.ts +++ b/src/compiler/file_uploader/upload_file.ts @@ -1,4 +1,5 @@ -import { stat, open } from 'fs/promises'; +import { open, stat } from 'fs/promises'; + import { Dest, Src } from '.'; import { bytesToHumanReadable } from './bytes_to_human_readable'; import { UploaderActor } from './uploader_actor'; diff --git a/src/compiler/file_uploader/uploader_actor.ts b/src/compiler/file_uploader/uploader_actor.ts index 65db1b8885..8f4e60194d 100644 --- a/src/compiler/file_uploader/uploader_actor.ts +++ b/src/compiler/file_uploader/uploader_actor.ts @@ -1,4 +1,5 @@ import { Actor, ActorMethod, ActorSubclass } from '@dfinity/agent'; + import { createAuthenticatedAgent } from '../../../dfx'; export type UploaderActor = ActorSubclass<_SERVICE>; diff --git a/src/compiler/file_watcher/file_watcher.ts b/src/compiler/file_watcher/file_watcher.ts index a12d5d3f95..10632ee461 100644 --- a/src/compiler/file_watcher/file_watcher.ts +++ b/src/compiler/file_watcher/file_watcher.ts @@ -2,9 +2,9 @@ import { Actor } from '@dfinity/agent'; import { watch } from 'chokidar'; import { readFileSync, writeFileSync } from 'fs'; +import { createAuthenticatedAgent, whoami } from '../../../dfx'; import { getCanisterJavaScript } from '../get_canister_javascript'; import { ok } from '../utils/result'; -import { createAuthenticatedAgent, whoami } from '../../../dfx'; const reloadedJsPath = process.argv[2]; const canisterId = process.argv[3]; diff --git a/src/compiler/generate_candid_and_canister_methods.ts b/src/compiler/generate_candid_and_canister_methods.ts index 26543881ac..ed99a4ed74 100644 --- a/src/compiler/generate_candid_and_canister_methods.ts +++ b/src/compiler/generate_candid_and_canister_methods.ts @@ -1,4 +1,5 @@ import { readFileSync } from 'fs'; + import { CanisterMethods } from './utils/types'; export function generateCandidAndCanisterMethods(wasmFilePath: string): { diff --git a/src/compiler/get_names.ts b/src/compiler/get_names.ts index 499247a938..5d0f93e9ef 100644 --- a/src/compiler/get_names.ts +++ b/src/compiler/get_names.ts @@ -4,6 +4,7 @@ import { readFileSync } from 'fs'; import { hashOfDirectory } from 'hash-of-directory'; import { join } from 'path'; +import { getCanisterId } from '../../dfx'; import { getCanisterConfig, getCanisterName, @@ -12,7 +13,6 @@ import { } from './utils'; import { GLOBAL_AZLE_CONFIG_DIR } from './utils/global_paths'; import { JSCanisterConfig } from './utils/types'; -import { getCanisterId } from '../../dfx'; export async function getNamesBeforeCli() { const stdioType = getStdIoType(); diff --git a/src/compiler/handle_cli.ts b/src/compiler/handle_cli.ts index 33bd9bb24c..a23c074970 100644 --- a/src/compiler/handle_cli.ts +++ b/src/compiler/handle_cli.ts @@ -1,11 +1,11 @@ import { execSync, IOType } from 'child_process'; import { rmSync } from 'fs'; -import { generateNewAzleProject } from './new_command'; import { version as azleVersion } from '../../package.json'; -import { GLOBAL_AZLE_CONFIG_DIR } from './utils/global_paths'; import { uploadFiles } from './file_uploader'; import { getFilesToUpload } from './file_uploader/get_files_to_upload'; +import { generateNewAzleProject } from './new_command'; +import { GLOBAL_AZLE_CONFIG_DIR } from './utils/global_paths'; export function handleCli( stdioType: IOType, diff --git a/src/compiler/index.ts b/src/compiler/index.ts index cd4cee6538..23e9317409 100644 --- a/src/compiler/index.ts +++ b/src/compiler/index.ts @@ -4,15 +4,15 @@ import { compileRustCodeWithCandidAndCompilerInfo } from './compile_rust_code_wi import { setupFileWatcher } from './file_watcher/setup_file_watcher'; import { getCandidAndCanisterMethods } from './get_candid_and_canister_methods'; import { getCanisterJavaScript } from './get_canister_javascript'; -import { getNamesBeforeCli, getNamesAfterCli } from './get_names'; +import { getNamesAfterCli, getNamesBeforeCli } from './get_names'; import { handleCli } from './handle_cli'; +import { logAutoreloadWarning } from './log_auto_reload_warning'; import { prepareDockerImage } from './prepare_docker_image'; import { prepareRustStagingArea } from './prepare_rust_staging_area'; import { logSuccess, time, unwrap } from './utils'; import { green } from './utils/colors'; import { GLOBAL_AZLE_CONFIG_DIR } from './utils/global_paths'; import { CompilerInfo } from './utils/types'; -import { logAutoreloadWarning } from './log_auto_reload_warning'; azle(); diff --git a/src/compiler/utils/get_canister_config.ts b/src/compiler/utils/get_canister_config.ts index 911bf0fd3a..b94aedb8e1 100644 --- a/src/compiler/utils/get_canister_config.ts +++ b/src/compiler/utils/get_canister_config.ts @@ -1,7 +1,7 @@ import { existsSync, readFileSync } from 'fs'; import { join } from 'path'; -import { red, yellow, green, blue, purple } from './colors'; +import { blue, green, purple, red, yellow } from './colors'; import { Err, Ok, Result } from './result'; import { AzleError, DfxJson, JSCanisterConfig } from './types'; diff --git a/src/compiler/utils/get_canister_name.ts b/src/compiler/utils/get_canister_name.ts index 99e8b50a34..899e4313b2 100644 --- a/src/compiler/utils/get_canister_name.ts +++ b/src/compiler/utils/get_canister_name.ts @@ -1,7 +1,7 @@ -import { green, dim } from './colors'; +import { version } from '../../../package.json'; +import { dim, green } from './colors'; import { Err, Ok, Result } from './result'; import { AzleError } from './types'; -import { version } from '../../../package.json'; export function getCanisterName(args: string[]): Result { const canisterNames = args.slice(2).filter((arg) => !isCliFlag(arg)); diff --git a/src/lib/candid/candid_type.ts b/src/lib/candid/candid_type.ts index bfbba94d8f..9c228d51c3 100644 --- a/src/lib/candid/candid_type.ts +++ b/src/lib/candid/candid_type.ts @@ -1,4 +1,5 @@ import { IDL } from '@dfinity/candid'; + import { Parent } from './to_idl'; export interface CandidType { diff --git a/src/lib/candid/did_file/visitor/did_visitor.ts b/src/lib/candid/did_file/visitor/did_visitor.ts index 509461b95d..b479314cbe 100644 --- a/src/lib/candid/did_file/visitor/did_visitor.ts +++ b/src/lib/candid/did_file/visitor/did_visitor.ts @@ -1,13 +1,14 @@ import { IDL } from '@dfinity/candid'; -import { visitService } from './visit/service'; -import { visitVariant } from './visit/variant'; + +import { visitFunc } from './visit/func'; +import { visitOpt } from './visit/opt'; +import { visitPrimitive } from './visit/primitive'; import { visitRecord } from './visit/record'; import { visitRecursive } from './visit/recursive'; -import { visitPrimitive } from './visit/primitive'; +import { visitService } from './visit/service'; import { visitTuple } from './visit/tuple'; -import { visitOpt } from './visit/opt'; +import { visitVariant } from './visit/variant'; import { visitVec } from './visit/vec'; -import { visitFunc } from './visit/func'; export type VisitorData = { usedRecClasses: IDL.RecClass[]; diff --git a/src/lib/candid/did_file/visitor/visit/func.ts b/src/lib/candid/did_file/visitor/visit/func.ts index 328f9e1a5c..b0e86a1109 100644 --- a/src/lib/candid/did_file/visitor/visit/func.ts +++ b/src/lib/candid/did_file/visitor/visit/func.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { extractCandid } from '../extract_candid'; + import { DidVisitor, VisitorData, VisitorResult } from '../did_visitor'; +import { extractCandid } from '../extract_candid'; export function visitFunc( t: IDL.FuncClass, diff --git a/src/lib/candid/did_file/visitor/visit/opt.ts b/src/lib/candid/did_file/visitor/visit/opt.ts index d00a005de8..8c065e6830 100644 --- a/src/lib/candid/did_file/visitor/visit/opt.ts +++ b/src/lib/candid/did_file/visitor/visit/opt.ts @@ -1,4 +1,5 @@ import { IDL } from '@dfinity/candid'; + import { DidVisitor, VisitorData, VisitorResult } from '../did_visitor'; export function visitOpt( diff --git a/src/lib/candid/did_file/visitor/visit/primitive.ts b/src/lib/candid/did_file/visitor/visit/primitive.ts index f257b9ced2..7330271358 100644 --- a/src/lib/candid/did_file/visitor/visit/primitive.ts +++ b/src/lib/candid/did_file/visitor/visit/primitive.ts @@ -1,4 +1,5 @@ import { IDL } from '@dfinity/candid'; + import { VisitorResult } from '../did_visitor'; export function visitPrimitive(t: IDL.PrimitiveType): VisitorResult { diff --git a/src/lib/candid/did_file/visitor/visit/record.ts b/src/lib/candid/did_file/visitor/visit/record.ts index 066ab942fe..7a3f558295 100644 --- a/src/lib/candid/did_file/visitor/visit/record.ts +++ b/src/lib/candid/did_file/visitor/visit/record.ts @@ -1,4 +1,5 @@ import { IDL } from '@dfinity/candid'; + import { DidVisitor, VisitorData, VisitorResult } from '../did_visitor'; import { escapeCandidKeywords } from '../escape_candid_keywords'; import { extractCandid } from '../extract_candid'; diff --git a/src/lib/candid/did_file/visitor/visit/recursive.ts b/src/lib/candid/did_file/visitor/visit/recursive.ts index d28fc1162e..8c9a91f511 100644 --- a/src/lib/candid/did_file/visitor/visit/recursive.ts +++ b/src/lib/candid/did_file/visitor/visit/recursive.ts @@ -1,4 +1,5 @@ import { IDL } from '@dfinity/candid'; + import { DidVisitor, VisitorData, VisitorResult } from '../did_visitor'; export function visitRecursive( diff --git a/src/lib/candid/did_file/visitor/visit/service.ts b/src/lib/candid/did_file/visitor/visit/service.ts index c7c7a11510..433d7b1e44 100644 --- a/src/lib/candid/did_file/visitor/visit/service.ts +++ b/src/lib/candid/did_file/visitor/visit/service.ts @@ -1,4 +1,5 @@ import { IDL } from '@dfinity/candid'; + import { CandidDef, CandidTypesDefs, diff --git a/src/lib/candid/did_file/visitor/visit/tuple.ts b/src/lib/candid/did_file/visitor/visit/tuple.ts index bcf284f291..c5d8f15f06 100644 --- a/src/lib/candid/did_file/visitor/visit/tuple.ts +++ b/src/lib/candid/did_file/visitor/visit/tuple.ts @@ -1,4 +1,5 @@ import { IDL } from '@dfinity/candid'; + import { DidVisitor, VisitorData, VisitorResult } from '../did_visitor'; import { extractCandid } from '../extract_candid'; diff --git a/src/lib/candid/did_file/visitor/visit/variant.ts b/src/lib/candid/did_file/visitor/visit/variant.ts index 8abb824244..7f07d15456 100644 --- a/src/lib/candid/did_file/visitor/visit/variant.ts +++ b/src/lib/candid/did_file/visitor/visit/variant.ts @@ -1,4 +1,5 @@ import { IDL } from '@dfinity/candid'; + import { DidVisitor, VisitorData, VisitorResult } from '../did_visitor'; import { escapeCandidKeywords } from '../escape_candid_keywords'; import { extractCandid } from '../extract_candid'; diff --git a/src/lib/candid/did_file/visitor/visit/vec.ts b/src/lib/candid/did_file/visitor/visit/vec.ts index 34b9ef3020..92f3c5954a 100644 --- a/src/lib/candid/did_file/visitor/visit/vec.ts +++ b/src/lib/candid/did_file/visitor/visit/vec.ts @@ -1,4 +1,5 @@ import { IDL } from '@dfinity/candid'; + import { DidVisitor, VisitorData, VisitorResult } from '../did_visitor'; export function visitVec( diff --git a/src/lib/candid/recursive.ts b/src/lib/candid/recursive.ts index 9e59bee051..7eaa8ed176 100644 --- a/src/lib/candid/recursive.ts +++ b/src/lib/candid/recursive.ts @@ -1,5 +1,6 @@ -import { v4 } from 'uuid'; import { IDL } from '@dfinity/candid'; +import { v4 } from 'uuid'; + import { CandidType, Parent } from './index'; export type _AzleRecursiveFunction = { diff --git a/src/lib/candid/serde/decode.ts b/src/lib/candid/serde/decode.ts index d5496078d2..398511da60 100644 --- a/src/lib/candid/serde/decode.ts +++ b/src/lib/candid/serde/decode.ts @@ -1,8 +1,8 @@ import { IDL } from '@dfinity/candid'; -import { AzleVec, AzleOpt, AzleTuple } from '../types/constructed'; -import { DecodeVisitor } from './visitors/decode_visitor'; import { CandidType, toIdl, toIdlArray } from '../../candid'; +import { AzleOpt, AzleTuple, AzleVec } from '../types/constructed'; +import { DecodeVisitor } from './visitors/decode_visitor'; /** * Decodes the provided buffer into the designated JS value. diff --git a/src/lib/candid/serde/encode.ts b/src/lib/candid/serde/encode.ts index 3423e5873d..6d86d84242 100644 --- a/src/lib/candid/serde/encode.ts +++ b/src/lib/candid/serde/encode.ts @@ -1,8 +1,8 @@ import { IDL } from '@dfinity/candid'; -import { AzleVec, AzleOpt, AzleTuple } from '../types/constructed'; -import { EncodeVisitor } from './visitors/encode_visitor'; import { CandidType, toIdl, toIdlArray } from '../../candid'; +import { AzleOpt, AzleTuple, AzleVec } from '../types/constructed'; +import { EncodeVisitor } from './visitors/encode_visitor'; /** * Encodes the provided value as candid blob of the designated type. diff --git a/src/lib/candid/serde/visitors/decode_visitor.ts b/src/lib/candid/serde/visitors/decode_visitor.ts index 9da00466c5..5e99c48733 100644 --- a/src/lib/candid/serde/visitors/decode_visitor.ts +++ b/src/lib/candid/serde/visitors/decode_visitor.ts @@ -1,4 +1,5 @@ import { IDL } from '@dfinity/candid'; + import { Opt } from '../../types/constructed'; import { VisitorData, VisitorResult } from './types'; import { visitRecord } from './visit/record'; diff --git a/src/lib/candid/serde/visitors/encode_visitor.ts b/src/lib/candid/serde/visitors/encode_visitor.ts index 70c38dc5a6..995a448394 100644 --- a/src/lib/candid/serde/visitors/encode_visitor.ts +++ b/src/lib/candid/serde/visitors/encode_visitor.ts @@ -1,10 +1,11 @@ import { IDL } from '@dfinity/candid'; + import { VisitorData, VisitorResult } from './types'; -import { visitTuple } from './visit/tuple'; -import { visitVec } from './visit/vec'; import { visitRecord } from './visit/record'; import { visitRec } from './visit/recursive'; +import { visitTuple } from './visit/tuple'; import { visitVariant } from './visit/variant'; +import { visitVec } from './visit/vec'; /** * When we encode a Service we have a service class and we need it to be only diff --git a/src/lib/candid/serde/visitors/visit/record.ts b/src/lib/candid/serde/visitors/visit/record.ts index 641d29e05c..cd2a8c3bf5 100644 --- a/src/lib/candid/serde/visitors/visit/record.ts +++ b/src/lib/candid/serde/visitors/visit/record.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { EncodeVisitor } from '../encode_visitor'; + import { DecodeVisitor } from '../decode_visitor'; +import { EncodeVisitor } from '../encode_visitor'; import { VisitorData, VisitorResult } from '../types'; export function visitRecord( diff --git a/src/lib/candid/serde/visitors/visit/recursive.ts b/src/lib/candid/serde/visitors/visit/recursive.ts index bd15bbef7a..6de43fa87f 100644 --- a/src/lib/candid/serde/visitors/visit/recursive.ts +++ b/src/lib/candid/serde/visitors/visit/recursive.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { EncodeVisitor } from '../encode_visitor'; + import { DecodeVisitor } from '../decode_visitor'; +import { EncodeVisitor } from '../encode_visitor'; import { VisitorData, VisitorResult } from '../types'; export function visitRec( diff --git a/src/lib/candid/serde/visitors/visit/tuple.ts b/src/lib/candid/serde/visitors/visit/tuple.ts index f899a89f8b..3d64178613 100644 --- a/src/lib/candid/serde/visitors/visit/tuple.ts +++ b/src/lib/candid/serde/visitors/visit/tuple.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { EncodeVisitor } from '../encode_visitor'; + import { DecodeVisitor } from '../decode_visitor'; +import { EncodeVisitor } from '../encode_visitor'; import { VisitorData, VisitorResult } from '../types'; export function visitTuple( diff --git a/src/lib/candid/serde/visitors/visit/variant/azle_result.ts b/src/lib/candid/serde/visitors/visit/variant/azle_result.ts index 186c94adca..63f0d90522 100644 --- a/src/lib/candid/serde/visitors/visit/variant/azle_result.ts +++ b/src/lib/candid/serde/visitors/visit/variant/azle_result.ts @@ -1,8 +1,9 @@ import { IDL } from '@dfinity/candid'; -import { EncodeVisitor } from '../../encode_visitor'; + +import { Result } from '../../../../../system_types/result'; import { DecodeVisitor } from '../../decode_visitor'; +import { EncodeVisitor } from '../../encode_visitor'; import { VisitorData } from '../../types'; -import { Result } from '../../../../../system_types/result'; export function visitAzleResult( visitor: DecodeVisitor | EncodeVisitor, diff --git a/src/lib/candid/serde/visitors/visit/variant/azle_variant.ts b/src/lib/candid/serde/visitors/visit/variant/azle_variant.ts index aa4ef196d1..77563e81be 100644 --- a/src/lib/candid/serde/visitors/visit/variant/azle_variant.ts +++ b/src/lib/candid/serde/visitors/visit/variant/azle_variant.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { EncodeVisitor } from '../../encode_visitor'; + import { DecodeVisitor } from '../../decode_visitor'; +import { EncodeVisitor } from '../../encode_visitor'; import { VisitorData } from '../../types'; export function visitAzleVariant( diff --git a/src/lib/candid/serde/visitors/visit/variant/index.ts b/src/lib/candid/serde/visitors/visit/variant/index.ts index 26818ae4d3..64b648ff1d 100644 --- a/src/lib/candid/serde/visitors/visit/variant/index.ts +++ b/src/lib/candid/serde/visitors/visit/variant/index.ts @@ -1,10 +1,11 @@ import { IDL } from '@dfinity/candid'; -import { EncodeVisitor } from '../../encode_visitor'; + import { AzleResult } from '../../../../../system_types'; import { DecodeVisitor } from '../../decode_visitor'; +import { EncodeVisitor } from '../../encode_visitor'; import { VisitorData, VisitorResult } from '../../types'; -import { visitAzleVariant } from './azle_variant'; import { visitAzleResult } from './azle_result'; +import { visitAzleVariant } from './azle_variant'; export function visitVariant( visitor: DecodeVisitor | EncodeVisitor, diff --git a/src/lib/candid/serde/visitors/visit/vec.ts b/src/lib/candid/serde/visitors/visit/vec.ts index 44b600ef96..2b50d5b513 100644 --- a/src/lib/candid/serde/visitors/visit/vec.ts +++ b/src/lib/candid/serde/visitors/visit/vec.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { EncodeVisitor } from '../encode_visitor'; + import { DecodeVisitor } from '../decode_visitor'; +import { EncodeVisitor } from '../encode_visitor'; import { VisitorData, VisitorResult } from '../types'; export function visitVec( diff --git a/src/lib/candid/to_idl.ts b/src/lib/candid/to_idl.ts index a61e01d0dc..cb510dfe1a 100644 --- a/src/lib/candid/to_idl.ts +++ b/src/lib/candid/to_idl.ts @@ -1,4 +1,5 @@ import { IDL } from '@dfinity/candid'; + import { CandidType } from './candid_type'; export type Parent = { diff --git a/src/lib/candid/type_mapping.ts b/src/lib/candid/type_mapping.ts index f376205d16..bb9f5c4bd0 100644 --- a/src/lib/candid/type_mapping.ts +++ b/src/lib/candid/type_mapping.ts @@ -1,13 +1,10 @@ +import { AzleResult, Result } from '../system_types'; import { AzleBlob, blob } from './types/constructed/blob'; -import { AzleVec } from './types/constructed/vec'; import { AzleOpt, Opt } from './types/constructed/opt'; import { AzleTuple } from './types/constructed/tuple'; -import { AzleNull, Null } from './types/primitive/null'; -import { AzleReserved, reserved } from './types/primitive/reserved'; -import { AzleEmpty, empty } from './types/primitive/empty'; +import { AzleVec } from './types/constructed/vec'; import { AzleBool, bool } from './types/primitive/bool'; -import { AzleText } from './types/primitive/text'; -import { AzleVoid } from './types/primitive/void'; +import { AzleEmpty, empty } from './types/primitive/empty'; import { AzleFloat32, float32 } from './types/primitive/floats/float32'; import { AzleFloat64, float64 } from './types/primitive/floats/float64'; import { AzleInt, int } from './types/primitive/ints/int'; @@ -20,7 +17,10 @@ import { AzleNat8, nat8 } from './types/primitive/nats/nat8'; import { AzleNat16, nat16 } from './types/primitive/nats/nat16'; import { AzleNat32, nat32 } from './types/primitive/nats/nat32'; import { AzleNat64, nat64 } from './types/primitive/nats/nat64'; -import { AzleResult, Result } from '../system_types'; +import { AzleNull, Null } from './types/primitive/null'; +import { AzleReserved, reserved } from './types/primitive/reserved'; +import { AzleText } from './types/primitive/text'; +import { AzleVoid } from './types/primitive/void'; import { Principal } from './types/reference/principal'; // TODO I believe we have some unnecessary cases and constructs in here now diff --git a/src/lib/candid/types/constructed/blob.ts b/src/lib/candid/types/constructed/blob.ts index 2736eba2f0..a3805306d0 100644 --- a/src/lib/candid/types/constructed/blob.ts +++ b/src/lib/candid/types/constructed/blob.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../serde/encode'; + import { decode } from '../../serde/decode'; +import { encode } from '../../serde/encode'; export class AzleBlob { _azleKind: 'AzleBlob' = 'AzleBlob'; diff --git a/src/lib/candid/types/constructed/opt.ts b/src/lib/candid/types/constructed/opt.ts index f7d71e4a1f..a0ef1b880d 100644 --- a/src/lib/candid/types/constructed/opt.ts +++ b/src/lib/candid/types/constructed/opt.ts @@ -1,10 +1,11 @@ +import { IDL } from '@dfinity/candid'; + import { CandidType } from '../../candid_type'; import { decode } from '../../serde/decode'; import { encode } from '../../serde/encode'; import { Parent, toIdl } from '../../to_idl'; import { TypeMapping } from '../../type_mapping'; import { RequireExactlyOne } from './variant'; -import { IDL } from '@dfinity/candid'; /** * Represents an optional value: every {@link Opt} is either `Some` and contains diff --git a/src/lib/candid/types/constructed/record.ts b/src/lib/candid/types/constructed/record.ts index a27d9d0e7f..cfc1ea85e0 100644 --- a/src/lib/candid/types/constructed/record.ts +++ b/src/lib/candid/types/constructed/record.ts @@ -1,10 +1,11 @@ import { IDL } from '@dfinity/candid'; -import { toIdlMap, CandidMap } from './to_idl_map'; + import { CandidType } from '../../candid_type'; -import { TypeMapping } from '../../type_mapping'; -import { Parent } from '../../to_idl'; -import { encode } from '../../serde/encode'; import { decode } from '../../serde/decode'; +import { encode } from '../../serde/encode'; +import { Parent } from '../../to_idl'; +import { TypeMapping } from '../../type_mapping'; +import { CandidMap, toIdlMap } from './to_idl_map'; export function Record< T extends { diff --git a/src/lib/candid/types/constructed/to_idl_map.ts b/src/lib/candid/types/constructed/to_idl_map.ts index 0384ca1882..f9d6ec3c9d 100644 --- a/src/lib/candid/types/constructed/to_idl_map.ts +++ b/src/lib/candid/types/constructed/to_idl_map.ts @@ -1,4 +1,5 @@ import { IDL } from '@dfinity/candid'; + import { CandidType } from '../../candid_type'; import { Parent, toIdl } from '../../to_idl'; diff --git a/src/lib/candid/types/constructed/tuple.ts b/src/lib/candid/types/constructed/tuple.ts index 050535f044..87789ad3a5 100644 --- a/src/lib/candid/types/constructed/tuple.ts +++ b/src/lib/candid/types/constructed/tuple.ts @@ -1,8 +1,9 @@ -import { CandidType } from '../../candid_type'; -import { Parent, toIdl } from '../../to_idl'; import { IDL } from '@dfinity/candid'; -import { encode } from '../../serde/encode'; + +import { CandidType } from '../../candid_type'; import { decode } from '../../serde/decode'; +import { encode } from '../../serde/encode'; +import { Parent, toIdl } from '../../to_idl'; import { TypeMapping } from '../../type_mapping'; export class AzleTuple { diff --git a/src/lib/candid/types/constructed/variant.ts b/src/lib/candid/types/constructed/variant.ts index 12bd89a26b..1e3a6aee60 100644 --- a/src/lib/candid/types/constructed/variant.ts +++ b/src/lib/candid/types/constructed/variant.ts @@ -1,9 +1,10 @@ -import { CandidType } from '../../candid_type'; -import { TypeMapping } from '../../type_mapping'; -import { toIdlMap, CandidMap } from './to_idl_map'; import { IDL } from '@dfinity/candid'; + +import { CandidType } from '../../candid_type'; import { decode } from '../../serde/decode'; import { encode } from '../../serde/encode'; +import { TypeMapping } from '../../type_mapping'; +import { CandidMap, toIdlMap } from './to_idl_map'; export type Variant< T extends { diff --git a/src/lib/candid/types/constructed/vec.ts b/src/lib/candid/types/constructed/vec.ts index 8ab0d94a4f..bb14bc996d 100644 --- a/src/lib/candid/types/constructed/vec.ts +++ b/src/lib/candid/types/constructed/vec.ts @@ -1,8 +1,9 @@ -import { CandidType } from '../../candid_type'; -import { Parent, toIdl } from '../../to_idl'; import { IDL } from '@dfinity/candid'; -import { encode } from '../../serde/encode'; + +import { CandidType } from '../../candid_type'; import { decode } from '../../serde/decode'; +import { encode } from '../../serde/encode'; +import { Parent, toIdl } from '../../to_idl'; import { TypeMapping } from '../../type_mapping'; export class AzleVec { diff --git a/src/lib/candid/types/primitive/bool.ts b/src/lib/candid/types/primitive/bool.ts index 6578496b6f..a921ba9706 100644 --- a/src/lib/candid/types/primitive/bool.ts +++ b/src/lib/candid/types/primitive/bool.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../serde/encode'; + import { decode } from '../../serde/decode'; +import { encode } from '../../serde/encode'; export class AzleBool { _azleKind: 'AzleBool' = 'AzleBool'; diff --git a/src/lib/candid/types/primitive/empty.ts b/src/lib/candid/types/primitive/empty.ts index bf60cd0c87..1e22f3a87b 100644 --- a/src/lib/candid/types/primitive/empty.ts +++ b/src/lib/candid/types/primitive/empty.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../serde/encode'; + import { decode } from '../../serde/decode'; +import { encode } from '../../serde/encode'; export class AzleEmpty { _azleKind: 'AzleEmpty' = 'AzleEmpty'; diff --git a/src/lib/candid/types/primitive/floats/float32.ts b/src/lib/candid/types/primitive/floats/float32.ts index 60f19b9635..3dcd4924c3 100644 --- a/src/lib/candid/types/primitive/floats/float32.ts +++ b/src/lib/candid/types/primitive/floats/float32.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../../serde/encode'; + import { decode } from '../../../serde/decode'; +import { encode } from '../../../serde/encode'; export class AzleFloat32 { _azleKind: 'AzleFloat32' = 'AzleFloat32'; diff --git a/src/lib/candid/types/primitive/floats/float64.ts b/src/lib/candid/types/primitive/floats/float64.ts index f373b353c4..95597d8bb7 100644 --- a/src/lib/candid/types/primitive/floats/float64.ts +++ b/src/lib/candid/types/primitive/floats/float64.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../../serde/encode'; + import { decode } from '../../../serde/decode'; +import { encode } from '../../../serde/encode'; export class AzleFloat64 { _azleKind: 'AzleFloat64' = 'AzleFloat64'; diff --git a/src/lib/candid/types/primitive/ints/index.ts b/src/lib/candid/types/primitive/ints/index.ts index 436b5547ed..b8718ae345 100644 --- a/src/lib/candid/types/primitive/ints/index.ts +++ b/src/lib/candid/types/primitive/ints/index.ts @@ -1,5 +1,5 @@ export * from './int'; export * from './int8'; -export * from './int32'; export * from './int16'; +export * from './int32'; export * from './int64'; diff --git a/src/lib/candid/types/primitive/ints/int.ts b/src/lib/candid/types/primitive/ints/int.ts index 8b226601e2..472f7b4f4f 100644 --- a/src/lib/candid/types/primitive/ints/int.ts +++ b/src/lib/candid/types/primitive/ints/int.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../../serde/encode'; + import { decode } from '../../../serde/decode'; +import { encode } from '../../../serde/encode'; export class AzleInt { _azleKind: 'AzleInt' = 'AzleInt'; diff --git a/src/lib/candid/types/primitive/ints/int16.ts b/src/lib/candid/types/primitive/ints/int16.ts index b757d55607..383d89c1bb 100644 --- a/src/lib/candid/types/primitive/ints/int16.ts +++ b/src/lib/candid/types/primitive/ints/int16.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../../serde/encode'; + import { decode } from '../../../serde/decode'; +import { encode } from '../../../serde/encode'; export class AzleInt16 { _azleKind: 'AzleInt16' = 'AzleInt16'; diff --git a/src/lib/candid/types/primitive/ints/int32.ts b/src/lib/candid/types/primitive/ints/int32.ts index 5ba10b6bdd..57bc08d46f 100644 --- a/src/lib/candid/types/primitive/ints/int32.ts +++ b/src/lib/candid/types/primitive/ints/int32.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../../serde/encode'; + import { decode } from '../../../serde/decode'; +import { encode } from '../../../serde/encode'; export class AzleInt32 { _azleKind: 'AzleInt32' = 'AzleInt32'; diff --git a/src/lib/candid/types/primitive/ints/int64.ts b/src/lib/candid/types/primitive/ints/int64.ts index 32145a69a5..2628bdc726 100644 --- a/src/lib/candid/types/primitive/ints/int64.ts +++ b/src/lib/candid/types/primitive/ints/int64.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../../serde/encode'; + import { decode } from '../../../serde/decode'; +import { encode } from '../../../serde/encode'; export class AzleInt64 { _azleKind: 'AzleInt64' = 'AzleInt64'; diff --git a/src/lib/candid/types/primitive/ints/int8.ts b/src/lib/candid/types/primitive/ints/int8.ts index 33f92ae3c3..6849633669 100644 --- a/src/lib/candid/types/primitive/ints/int8.ts +++ b/src/lib/candid/types/primitive/ints/int8.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../../serde/encode'; + import { decode } from '../../../serde/decode'; +import { encode } from '../../../serde/encode'; export class AzleInt8 { _azleKind: 'AzleInt8' = 'AzleInt8'; diff --git a/src/lib/candid/types/primitive/nats/nat.ts b/src/lib/candid/types/primitive/nats/nat.ts index 88c2151bd7..4a824865bc 100644 --- a/src/lib/candid/types/primitive/nats/nat.ts +++ b/src/lib/candid/types/primitive/nats/nat.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../../serde/encode'; + import { decode } from '../../../serde/decode'; +import { encode } from '../../../serde/encode'; export class AzleNat { _azleKind: 'AzleNat' = 'AzleNat'; diff --git a/src/lib/candid/types/primitive/nats/nat16.ts b/src/lib/candid/types/primitive/nats/nat16.ts index 27b4206f88..db7cc5c332 100644 --- a/src/lib/candid/types/primitive/nats/nat16.ts +++ b/src/lib/candid/types/primitive/nats/nat16.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../../serde/encode'; + import { decode } from '../../../serde/decode'; +import { encode } from '../../../serde/encode'; export class AzleNat16 { _azleKind: 'AzleNat16' = 'AzleNat16'; diff --git a/src/lib/candid/types/primitive/nats/nat32.ts b/src/lib/candid/types/primitive/nats/nat32.ts index 3c08026452..0a4f58a8fd 100644 --- a/src/lib/candid/types/primitive/nats/nat32.ts +++ b/src/lib/candid/types/primitive/nats/nat32.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../../serde/encode'; + import { decode } from '../../../serde/decode'; +import { encode } from '../../../serde/encode'; export class AzleNat32 { _azleKind: 'AzleNat32' = 'AzleNat32'; diff --git a/src/lib/candid/types/primitive/nats/nat64.ts b/src/lib/candid/types/primitive/nats/nat64.ts index 538c985998..480c8965ae 100644 --- a/src/lib/candid/types/primitive/nats/nat64.ts +++ b/src/lib/candid/types/primitive/nats/nat64.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../../serde/encode'; + import { decode } from '../../../serde/decode'; +import { encode } from '../../../serde/encode'; export class AzleNat64 { _azleKind: 'AzleNat64' = 'AzleNat64'; diff --git a/src/lib/candid/types/primitive/nats/nat8.ts b/src/lib/candid/types/primitive/nats/nat8.ts index 4cfd235128..9847773ad6 100644 --- a/src/lib/candid/types/primitive/nats/nat8.ts +++ b/src/lib/candid/types/primitive/nats/nat8.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../../serde/encode'; + import { decode } from '../../../serde/decode'; +import { encode } from '../../../serde/encode'; export class AzleNat8 { _azleKind: 'AzleNat8' = 'AzleNat8'; diff --git a/src/lib/candid/types/primitive/null.ts b/src/lib/candid/types/primitive/null.ts index d5a0809e44..bec4d50a39 100644 --- a/src/lib/candid/types/primitive/null.ts +++ b/src/lib/candid/types/primitive/null.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../serde/encode'; + import { decode } from '../../serde/decode'; +import { encode } from '../../serde/encode'; export class AzleNull { _azleKind: 'AzleNull' = 'AzleNull'; diff --git a/src/lib/candid/types/primitive/reserved.ts b/src/lib/candid/types/primitive/reserved.ts index e005d6a7bf..ad24da8c0f 100644 --- a/src/lib/candid/types/primitive/reserved.ts +++ b/src/lib/candid/types/primitive/reserved.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../serde/encode'; + import { decode } from '../../serde/decode'; +import { encode } from '../../serde/encode'; export class AzleReserved { _azleKind: 'AzleReserved' = 'AzleReserved'; diff --git a/src/lib/candid/types/primitive/text.ts b/src/lib/candid/types/primitive/text.ts index 106da3f0be..279f40bb4c 100644 --- a/src/lib/candid/types/primitive/text.ts +++ b/src/lib/candid/types/primitive/text.ts @@ -1,6 +1,7 @@ import { IDL } from '@dfinity/candid'; -import { encode } from '../../serde/encode'; + import { decode } from '../../serde/decode'; +import { encode } from '../../serde/encode'; export class AzleText { _azleKind: 'AzleText' = 'AzleText'; diff --git a/src/lib/candid/types/primitive/void.ts b/src/lib/candid/types/primitive/void.ts index 2774153c44..cbd6385d08 100644 --- a/src/lib/candid/types/primitive/void.ts +++ b/src/lib/candid/types/primitive/void.ts @@ -1,4 +1,5 @@ import { IDL } from '@dfinity/candid'; + import { decode } from '../../serde/decode'; import { encode } from '../../serde/encode'; diff --git a/src/lib/candid/types/reference/func.ts b/src/lib/candid/types/reference/func.ts index 5bad7a0f17..9d4f3d0c0e 100644 --- a/src/lib/candid/types/reference/func.ts +++ b/src/lib/candid/types/reference/func.ts @@ -1,9 +1,10 @@ -import { CandidType, Parent, toIdlArray } from '../../index'; import { IDL } from '@dfinity/candid'; -import { Principal } from './principal'; -import { encode } from '../../serde/encode'; -import { decode } from '../../serde/decode'; + import { Serializable } from '../../../stable_structures/stable_b_tree_map'; +import { CandidType, Parent, toIdlArray } from '../../index'; +import { decode } from '../../serde/decode'; +import { encode } from '../../serde/encode'; +import { Principal } from './principal'; export type Func = [Principal, string]; type Mode = 'query' | 'update' | 'oneway'; diff --git a/src/lib/candid/types/reference/index.ts b/src/lib/candid/types/reference/index.ts index 98307ac051..755d6eeb76 100644 --- a/src/lib/candid/types/reference/index.ts +++ b/src/lib/candid/types/reference/index.ts @@ -1,3 +1,3 @@ export * from './func'; -export * from './service'; export * from './principal'; +export * from './service'; diff --git a/src/lib/candid/types/reference/principal.ts b/src/lib/candid/types/reference/principal.ts index 2f4d025a8b..ea56143020 100644 --- a/src/lib/candid/types/reference/principal.ts +++ b/src/lib/candid/types/reference/principal.ts @@ -1,7 +1,8 @@ import { IDL } from '@dfinity/candid'; import { Principal as DfinityPrincipal } from '@dfinity/principal'; -import { encode } from '../../serde/encode'; + import { decode } from '../../serde/decode'; +import { encode } from '../../serde/encode'; import { Parent } from '../../to_idl'; export class Principal extends DfinityPrincipal { diff --git a/src/lib/candid/types/reference/service/canister_function/index.ts b/src/lib/candid/types/reference/service/canister_function/index.ts index d7cd380610..fca63a0488 100644 --- a/src/lib/candid/types/reference/service/canister_function/index.ts +++ b/src/lib/candid/types/reference/service/canister_function/index.ts @@ -1,10 +1,11 @@ -import { Parent, CandidType, toIdlArray } from '../../../../index'; -import { _AzleRecursiveFunction } from '../../../../recursive'; -import { ic } from '../../../../../ic'; -import { Principal } from '../../principal'; import { IDL } from '@dfinity/candid'; + import { CanisterMethodInfo } from '../../../../../canister_methods/types/canister_method_info'; +import { ic } from '../../../../../ic'; +import { CandidType, Parent, toIdlArray } from '../../../../index'; +import { _AzleRecursiveFunction } from '../../../../recursive'; import { decode, encode } from '../../../../serde'; +import { Principal } from '../../principal'; import { createQueryMethods, createUpdateMethods } from './query_update'; import { createGetSystemFunctionIdlFunction, diff --git a/src/lib/candid/types/reference/service/canister_function/query_update.ts b/src/lib/candid/types/reference/service/canister_function/query_update.ts index e1f17a4e2d..0b39136ae7 100644 --- a/src/lib/candid/types/reference/service/canister_function/query_update.ts +++ b/src/lib/candid/types/reference/service/canister_function/query_update.ts @@ -1,5 +1,5 @@ -import { CanisterOptions } from '.'; import { handleUncaughtError } from '../../../../../error'; +import { CanisterOptions } from '.'; type QueryMethod = { name: string; diff --git a/src/lib/candid/types/reference/service/canister_function/system_methods.ts b/src/lib/candid/types/reference/service/canister_function/system_methods.ts index 7fa272a6fb..c89b16d557 100644 --- a/src/lib/candid/types/reference/service/canister_function/system_methods.ts +++ b/src/lib/candid/types/reference/service/canister_function/system_methods.ts @@ -1,6 +1,7 @@ +import { IDL } from '@dfinity/candid'; + import { Parent, toIdlArray } from '../../../../index'; import { _AzleRecursiveFunction } from '../../../../recursive'; -import { IDL } from '@dfinity/candid'; import { CanisterOptions, ServiceFunctionInfo } from '.'; type SystemMethod = { name: string } | undefined; diff --git a/src/lib/canister_methods/execute_method.ts b/src/lib/canister_methods/execute_method.ts index 8da650d68e..9743b33ece 100644 --- a/src/lib/canister_methods/execute_method.ts +++ b/src/lib/canister_methods/execute_method.ts @@ -1,9 +1,9 @@ -import { ic } from '../ic'; import { CandidType } from '../candid/candid_type'; import { decode } from '../candid/serde/decode'; import { encode } from '../candid/serde/encode'; -import { CanisterMethodInfo } from './types/canister_method_info'; import { handleUncaughtError } from '../error'; +import { ic } from '../ic'; +import { CanisterMethodInfo } from './types/canister_method_info'; export function executeMethod( mode: CanisterMethodInfo['mode'], diff --git a/src/lib/canister_methods/methods/heartbeat.ts b/src/lib/canister_methods/methods/heartbeat.ts index 373ce8feca..d1f59501f6 100644 --- a/src/lib/canister_methods/methods/heartbeat.ts +++ b/src/lib/canister_methods/methods/heartbeat.ts @@ -1,7 +1,7 @@ -import { ic } from '../../ic'; import { Void } from '../../candid/types/primitive/void'; -import { CanisterMethodInfo } from '../types/canister_method_info'; +import { ic } from '../../ic'; import { isAsync } from '../is_async'; +import { CanisterMethodInfo } from '../types/canister_method_info'; export function heartbeat( callback: () => void | Promise diff --git a/src/lib/canister_methods/methods/init.ts b/src/lib/canister_methods/methods/init.ts index eb6bdef8c8..0272d92fa3 100644 --- a/src/lib/canister_methods/methods/init.ts +++ b/src/lib/canister_methods/methods/init.ts @@ -1,9 +1,9 @@ import { CandidType } from '../../candid/candid_type'; import { TypeMapping } from '../../candid/type_mapping'; import { Void } from '../../candid/types/primitive/void'; +import { executeMethod } from '../execute_method'; import { Callback } from '../types/callback'; import { CanisterMethodInfo } from '../types/canister_method_info'; -import { executeMethod } from '../execute_method'; export function init< const Params extends ReadonlyArray, diff --git a/src/lib/canister_methods/methods/inspect_message.ts b/src/lib/canister_methods/methods/inspect_message.ts index 5635e99e24..053996eaf6 100644 --- a/src/lib/canister_methods/methods/inspect_message.ts +++ b/src/lib/canister_methods/methods/inspect_message.ts @@ -1,6 +1,6 @@ import { Void } from '../../candid/types/primitive/void'; -import { CanisterMethodInfo } from '../types/canister_method_info'; import { executeMethod } from '../execute_method'; +import { CanisterMethodInfo } from '../types/canister_method_info'; export function inspectMessage( callback: () => void | Promise diff --git a/src/lib/canister_methods/methods/post_upgrade.ts b/src/lib/canister_methods/methods/post_upgrade.ts index a8d0bcf0be..5d32ea6836 100644 --- a/src/lib/canister_methods/methods/post_upgrade.ts +++ b/src/lib/canister_methods/methods/post_upgrade.ts @@ -1,9 +1,9 @@ import { CandidType } from '../../candid/candid_type'; import { TypeMapping } from '../../candid/type_mapping'; import { Void } from '../../candid/types/primitive/void'; +import { executeMethod } from '../execute_method'; import { Callback } from '../types/callback'; import { CanisterMethodInfo } from '../types/canister_method_info'; -import { executeMethod } from '../execute_method'; export function postUpgrade< const Params extends ReadonlyArray, diff --git a/src/lib/canister_methods/methods/pre_upgrade.ts b/src/lib/canister_methods/methods/pre_upgrade.ts index d94132777c..e9c55ef047 100644 --- a/src/lib/canister_methods/methods/pre_upgrade.ts +++ b/src/lib/canister_methods/methods/pre_upgrade.ts @@ -1,6 +1,6 @@ import { Void } from '../../candid/types/primitive/void'; -import { CanisterMethodInfo } from '../types/canister_method_info'; import { isAsync } from '../is_async'; +import { CanisterMethodInfo } from '../types/canister_method_info'; export function preUpgrade( callback: () => void | Promise diff --git a/src/lib/canister_methods/methods/query.ts b/src/lib/canister_methods/methods/query.ts index 8b7b0ffb98..24d22dfbee 100644 --- a/src/lib/canister_methods/methods/query.ts +++ b/src/lib/canister_methods/methods/query.ts @@ -1,9 +1,9 @@ import { CandidType } from '../../candid/candid_type'; import { TypeMapping } from '../../candid/type_mapping'; -import { Callback } from '../types/callback'; -import { CanisterMethodInfo } from '../types/canister_method_info'; import { executeMethod } from '../execute_method'; import { isAsync } from '../is_async'; +import { Callback } from '../types/callback'; +import { CanisterMethodInfo } from '../types/canister_method_info'; import { MethodArgs } from '../types/method_args'; export function query< diff --git a/src/lib/canister_methods/methods/update.ts b/src/lib/canister_methods/methods/update.ts index 6de16af599..b88e6a8981 100644 --- a/src/lib/canister_methods/methods/update.ts +++ b/src/lib/canister_methods/methods/update.ts @@ -1,9 +1,9 @@ import { CandidType } from '../../candid/candid_type'; import { TypeMapping } from '../../candid/type_mapping'; -import { Callback } from '../types/callback'; -import { CanisterMethodInfo } from '../types/canister_method_info'; import { executeMethod } from '../execute_method'; import { isAsync } from '../is_async'; +import { Callback } from '../types/callback'; +import { CanisterMethodInfo } from '../types/canister_method_info'; import { MethodArgs } from '../types/method_args'; export function update< diff --git a/src/lib/fetch/file.ts b/src/lib/fetch/file.ts index 3638c4b99b..c4f24017e1 100644 --- a/src/lib/fetch/file.ts +++ b/src/lib/fetch/file.ts @@ -1,7 +1,7 @@ import { readFile } from 'fs/promises'; -import { getUrl } from './url'; import { AzleFetchResponse } from './response'; +import { getUrl } from './url'; export async function fetchFile(input: RequestInfo | URL): Promise { const url = getUrl(input); diff --git a/src/lib/fetch/http.ts b/src/lib/fetch/http.ts index 8ad21f571b..8e1e649d24 100644 --- a/src/lib/fetch/http.ts +++ b/src/lib/fetch/http.ts @@ -1,8 +1,8 @@ import { inflate } from 'pako'; -import { azleFetch, serialize } from '.'; -import { ic } from '../'; import { HttpTransform } from '../../../canisters/management'; +import { ic } from '../'; +import { azleFetch, serialize } from '.'; import { AzleFetchResponse } from './response'; import { getUrl } from './url'; diff --git a/src/lib/globals.ts b/src/lib/globals.ts index 846785509c..946468c589 100644 --- a/src/lib/globals.ts +++ b/src/lib/globals.ts @@ -1,11 +1,12 @@ -import { ic } from './ic'; -import { AzleIc } from './ic/types/azle_ic'; import { Buffer } from 'buffer'; -import { jsonReplacer } from './stable_structures/stable_json'; import * as process from 'process'; -import { v4 } from 'uuid'; import { URL } from 'url'; +import { v4 } from 'uuid'; + import { azleFetch } from './fetch'; +import { ic } from './ic'; +import { AzleIc } from './ic/types/azle_ic'; +import { jsonReplacer } from './stable_structures/stable_json'; declare global { var _azleInsideCanister: boolean; diff --git a/src/lib/ic/call_raw.ts b/src/lib/ic/call_raw.ts index a6d33ddce0..18e0a4b451 100644 --- a/src/lib/ic/call_raw.ts +++ b/src/lib/ic/call_raw.ts @@ -1,7 +1,8 @@ +import { v4 } from 'uuid'; + import { Principal } from '../'; import { blob } from '../candid/types/constructed/blob'; import { nat64 } from '../candid/types/primitive/nats/nat64'; -import { v4 } from 'uuid'; import { text } from '../candid/types/primitive/text'; /** diff --git a/src/lib/ic/call_raw_128.ts b/src/lib/ic/call_raw_128.ts index 6c4b4cdb01..358bf9973d 100644 --- a/src/lib/ic/call_raw_128.ts +++ b/src/lib/ic/call_raw_128.ts @@ -1,9 +1,10 @@ +import { v4 } from 'uuid'; + import { Principal } from '../'; +import { encode } from '../candid/serde/encode'; import { blob } from '../candid/types/constructed/blob'; import { nat } from '../candid/types/primitive/nats/nat'; -import { v4 } from 'uuid'; import { text } from '../candid/types/primitive/text'; -import { encode } from '../candid/serde/encode'; /** * Performs an asynchronous call to another canister using the [System API]( diff --git a/src/lib/ic/clear_timer.ts b/src/lib/ic/clear_timer.ts index 21f3cad766..d7a5d54ca1 100644 --- a/src/lib/ic/clear_timer.ts +++ b/src/lib/ic/clear_timer.ts @@ -1,6 +1,6 @@ +import { encode } from '../candid/serde/encode'; import { Void } from '../candid/types/primitive/void'; import { TimerId } from './types/timer_id'; -import { encode } from '../candid/serde/encode'; /** * Cancels an existing timer. Does nothing if the timer has already been canceled. diff --git a/src/lib/ic/is_controller.ts b/src/lib/ic/is_controller.ts index ab7da249d3..7c47fec0da 100644 --- a/src/lib/ic/is_controller.ts +++ b/src/lib/ic/is_controller.ts @@ -1,5 +1,5 @@ -import { Principal } from '../candid/types/reference/principal'; import { bool } from '../candid/types/primitive/bool'; +import { Principal } from '../candid/types/reference/principal'; /** Determine if a {@link Principal} is a controller of the canister. */ export function isController(principal: Principal): bool { diff --git a/src/lib/ic/notify_raw.ts b/src/lib/ic/notify_raw.ts index 34adc49e84..80a925cc90 100644 --- a/src/lib/ic/notify_raw.ts +++ b/src/lib/ic/notify_raw.ts @@ -1,8 +1,8 @@ -import { Void } from '../candid/types/primitive/void'; -import { nat } from '../candid/types/primitive/nats/nat'; import { blob } from '../candid/types/constructed/blob'; -import { Principal } from '../candid/types/reference/principal'; +import { nat } from '../candid/types/primitive/nats/nat'; import { text } from '../candid/types/primitive/text'; +import { Void } from '../candid/types/primitive/void'; +import { Principal } from '../candid/types/reference/principal'; /** * Like notify, but sends the argument as raw bytes, skipping Candid serialization. diff --git a/src/lib/ic/reply.ts b/src/lib/ic/reply.ts index 8875e64bed..eaa5e50c88 100644 --- a/src/lib/ic/reply.ts +++ b/src/lib/ic/reply.ts @@ -1,6 +1,6 @@ import { CandidType } from '../candid/candid_type'; -import { Void } from '../candid/types/primitive/void'; import { encode } from '../candid/serde/encode'; +import { Void } from '../candid/types/primitive/void'; /** * Used to manually reply to an ingress message. Intended to be used in diff --git a/src/lib/ic/set_timer.ts b/src/lib/ic/set_timer.ts index df4d8e8f90..5fac847f92 100644 --- a/src/lib/ic/set_timer.ts +++ b/src/lib/ic/set_timer.ts @@ -1,9 +1,10 @@ -import { Duration } from './types/duration'; -import { TimerId } from './types/timer_id'; import { v4 } from 'uuid'; -import { nat64 } from '../candid/types/primitive/nats/nat64'; + import { decode } from '../candid/serde/decode'; import { encode } from '../candid/serde/encode'; +import { nat64 } from '../candid/types/primitive/nats/nat64'; +import { Duration } from './types/duration'; +import { TimerId } from './types/timer_id'; /** * Sets callback to be executed later, after delay. Panics if `delay` + time() is more than 2^64 - 1. diff --git a/src/lib/ic/set_timer_interval.ts b/src/lib/ic/set_timer_interval.ts index 57d3f95a15..5ef541d91a 100644 --- a/src/lib/ic/set_timer_interval.ts +++ b/src/lib/ic/set_timer_interval.ts @@ -1,9 +1,10 @@ -import { Duration } from './types/duration'; -import { TimerId } from './types/timer_id'; import { v4 } from 'uuid'; + import { decode } from '../candid/serde/decode'; import { encode } from '../candid/serde/encode'; import { nat64 } from '../candid/types/primitive/nats/nat64'; +import { Duration } from './types/duration'; +import { TimerId } from './types/timer_id'; /** * Sets callback to be executed every interval. Panics if `interval` + time() is more than 2^64 - 1. diff --git a/src/lib/ic/stable_64_read.ts b/src/lib/ic/stable_64_read.ts index 36a0584c12..c3d765f4ae 100644 --- a/src/lib/ic/stable_64_read.ts +++ b/src/lib/ic/stable_64_read.ts @@ -1,5 +1,5 @@ -import { nat64 } from '../candid/types/primitive/nats/nat64'; import { encode } from '../candid/serde/encode'; +import { nat64 } from '../candid/types/primitive/nats/nat64'; /** * Reads data from the stable memory location specified by an offset. diff --git a/src/lib/ic/stable_read.ts b/src/lib/ic/stable_read.ts index 187b1a7791..fb4ebb3ebb 100644 --- a/src/lib/ic/stable_read.ts +++ b/src/lib/ic/stable_read.ts @@ -1,5 +1,5 @@ -import { nat32 } from '../candid/types/primitive/nats/nat32'; import { encode } from '../candid/serde/encode'; +import { nat32 } from '../candid/types/primitive/nats/nat32'; /** * Reads data from the stable memory location specified by an offset diff --git a/src/lib/ic/stable_size.ts b/src/lib/ic/stable_size.ts index 8534712bdf..6816473b4c 100644 --- a/src/lib/ic/stable_size.ts +++ b/src/lib/ic/stable_size.ts @@ -1,5 +1,5 @@ -import { nat32 } from '../candid/types/primitive/nats/nat32'; import { decode } from '../candid/serde/decode'; +import { nat32 } from '../candid/types/primitive/nats/nat32'; /** * Gets current size of the stable memory (in WASM pages) diff --git a/src/lib/ic/stable_write.ts b/src/lib/ic/stable_write.ts index 9ed526005f..448f896614 100644 --- a/src/lib/ic/stable_write.ts +++ b/src/lib/ic/stable_write.ts @@ -1,6 +1,6 @@ -import { nat32 } from '../candid/types/primitive/nats/nat32'; -import { blob } from '../candid/types/constructed/blob'; import { encode } from '../candid/serde/encode'; +import { blob } from '../candid/types/constructed/blob'; +import { nat32 } from '../candid/types/primitive/nats/nat32'; /** * Writes data to the stable memory location specified by an offset diff --git a/src/lib/ic/types/duration.ts b/src/lib/ic/types/duration.ts index 33c33f5405..c74de4fc4d 100644 --- a/src/lib/ic/types/duration.ts +++ b/src/lib/ic/types/duration.ts @@ -1,4 +1,4 @@ -import { nat64, AzleNat64 } from '../../candid/types/primitive/nats/nat64'; +import { AzleNat64, nat64 } from '../../candid/types/primitive/nats/nat64'; /** * Represents a duration of time in seconds. diff --git a/src/lib/ic/types/index.ts b/src/lib/ic/types/index.ts index 9996f11bda..9d6a7d6d05 100644 --- a/src/lib/ic/types/index.ts +++ b/src/lib/ic/types/index.ts @@ -1,5 +1,5 @@ -export * from './azle_ic'; export * from './args_type'; +export * from './azle_ic'; export * from './duration'; export * from './return_type_of'; export * from './timer_id'; diff --git a/src/lib/ic/types/timer_id.ts b/src/lib/ic/types/timer_id.ts index 15e92e46a2..d67485e82c 100644 --- a/src/lib/ic/types/timer_id.ts +++ b/src/lib/ic/types/timer_id.ts @@ -1,4 +1,4 @@ -import { nat64, AzleNat64 } from '../../candid/types/primitive/nats/nat64'; +import { AzleNat64, nat64 } from '../../candid/types/primitive/nats/nat64'; /** * Type returned by the {@link ic.setTimer} and {@link ic.setTimerInterval} diff --git a/src/lib/index.ts b/src/lib/index.ts index 1d1723cf05..8c68412e8c 100644 --- a/src/lib/index.ts +++ b/src/lib/index.ts @@ -2,11 +2,11 @@ import './globals'; import '../../type_tests'; export * from './candid'; export * from './canister_methods'; +export { serialize } from './fetch'; export * from './ic'; +export * from './json'; +export * from './server'; export * from './stable_structures/stable_b_tree_map'; export * from './stable_structures/stable_json'; export * from './system_types'; -export * from './server'; -export { serialize } from './fetch'; -export * from './json'; export * from './threshold_wallet'; diff --git a/src/lib/server.ts b/src/lib/server.ts index 30df0c5747..d86e7c1ad3 100644 --- a/src/lib/server.ts +++ b/src/lib/server.ts @@ -1,3 +1,9 @@ +import { Server as NodeServer, ServerResponse } from 'http'; +// @ts-ignore +import { HttpConn } from 'http'; +// @ts-ignore +import { IncomingMessageForServer } from 'http'; + import { blob, bool, @@ -20,11 +26,6 @@ import { Variant, Vec } from '.'; -import { ServerResponse, Server as NodeServer } from 'http'; -// @ts-ignore -import { HttpConn } from 'http'; -// @ts-ignore -import { IncomingMessageForServer } from 'http'; import { CanisterOptions } from './candid/types/reference/service/canister_function'; const httpMessageParser = require('http-message-parser'); diff --git a/src/lib/stable_structures/stable_b_tree_map.ts b/src/lib/stable_structures/stable_b_tree_map.ts index 46d65e1357..3b69360b37 100644 --- a/src/lib/stable_structures/stable_b_tree_map.ts +++ b/src/lib/stable_structures/stable_b_tree_map.ts @@ -1,6 +1,6 @@ import { None, Opt, Some } from '../candid/types/constructed/opt'; -import { nat64 } from '../candid/types/primitive/nats/nat64'; import { nat8 } from '../candid/types/primitive/nats/nat8'; +import { nat64 } from '../candid/types/primitive/nats/nat64'; import { stableJson } from './stable_json'; export interface Serializable { diff --git a/src/lib/stable_structures/stable_json.ts b/src/lib/stable_structures/stable_json.ts index 19ff9e8b88..7a6893f922 100644 --- a/src/lib/stable_structures/stable_json.ts +++ b/src/lib/stable_structures/stable_json.ts @@ -1,5 +1,5 @@ -import { Serializable } from './stable_b_tree_map'; import { Principal } from '../candid/types/reference/principal'; +import { Serializable } from './stable_b_tree_map'; export function StableJson(options?: { replacer?: typeof jsonReplacer; diff --git a/src/lib/system_types/result.ts b/src/lib/system_types/result.ts index 0af595e43a..2861cabbe8 100644 --- a/src/lib/system_types/result.ts +++ b/src/lib/system_types/result.ts @@ -1,7 +1,8 @@ +import { IDL } from '@dfinity/candid'; + import { CandidType } from '../candid/candid_type'; import { Parent, toIdl } from '../candid/to_idl'; import { RequireExactlyOne } from '../candid/types/constructed/variant'; -import { IDL } from '@dfinity/candid'; export class AzleResult { constructor(ok: T, err: K) { diff --git a/src/lib/threshold_wallet/ecdsa_public_key.ts b/src/lib/threshold_wallet/ecdsa_public_key.ts index a48b5c33a4..3758fc1edb 100644 --- a/src/lib/threshold_wallet/ecdsa_public_key.ts +++ b/src/lib/threshold_wallet/ecdsa_public_key.ts @@ -1,5 +1,4 @@ import { Principal, serialize } from '../'; - import { ThresholdKeyInfo } from './wallet'; export async function ecdsaPublicKey( diff --git a/src/lib/threshold_wallet/sign_with_ecdsa.ts b/src/lib/threshold_wallet/sign_with_ecdsa.ts index e54267fe68..aef4a71b27 100644 --- a/src/lib/threshold_wallet/sign_with_ecdsa.ts +++ b/src/lib/threshold_wallet/sign_with_ecdsa.ts @@ -1,5 +1,4 @@ import { serialize } from '../'; - import { ThresholdKeyInfo } from './wallet'; export async function signWithEcdsa( diff --git a/src/lib/threshold_wallet/wallet.ts b/src/lib/threshold_wallet/wallet.ts index 40f52dcb83..f168457da3 100644 --- a/src/lib/threshold_wallet/wallet.ts +++ b/src/lib/threshold_wallet/wallet.ts @@ -1,3 +1,5 @@ +import './register_get_url'; + import { ethers } from 'ethers'; import { Principal } from '../'; @@ -5,8 +7,6 @@ import { calculateRsvForTEcdsa } from './calculate_rsv_for_tecdsa'; import { ecdsaPublicKey } from './ecdsa_public_key'; import { signWithEcdsa } from './sign_with_ecdsa'; -import './register_get_url'; - export type ThresholdKeyInfo = { derivationPath: Uint8Array[]; canisterId?: Principal | string; From 28cc8202f5817860eb78389842fa3cf73a6ba13a Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 10 Apr 2024 14:50:32 -0600 Subject: [PATCH 10/34] fix linting for merge from main --- src/compiler/file_uploader/upload_file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/file_uploader/upload_file.ts b/src/compiler/file_uploader/upload_file.ts index bf8a8de6a0..c69e5cdd91 100644 --- a/src/compiler/file_uploader/upload_file.ts +++ b/src/compiler/file_uploader/upload_file.ts @@ -1,9 +1,9 @@ import { open, stat } from 'fs/promises'; +import { hashFile } from '../../../scripts/hash_file'; import { Dest, Src } from '.'; import { bytesToHumanReadable } from './bytes_to_human_readable'; import { UploaderActor } from './uploader_actor'; -import { hashFile } from '../../../scripts/hash_file'; export async function uploadFile( srcPath: Src, From 93a5470d19cbc288a0f4c45a932c8e5c48dc8631 Mon Sep 17 00:00:00 2001 From: Dan Steren Date: Wed, 29 Nov 2023 10:39:23 -0700 Subject: [PATCH 11/34] Remove useless escape characters --- .eslintrc.js | 1 - examples/ledger_canister/test/tests.ts | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index e3fb91c636..5aff5faa11 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -14,7 +14,6 @@ const temporarilyDisabledRules = { 'no-prototype-builtins': 'off', 'no-undef': 'off', 'no-useless-catch': 'off', - 'no-useless-escape': 'off', 'no-var': 'off', 'prefer-const': 'off' }; diff --git a/examples/ledger_canister/test/tests.ts b/examples/ledger_canister/test/tests.ts index d41f8c7bf0..a6844b149f 100644 --- a/examples/ledger_canister/test/tests.ts +++ b/examples/ledger_canister/test/tests.ts @@ -194,7 +194,7 @@ function getTransferErrorTests( name: 'deploy icpLedger', prep: async () => { execSync( - `dfx deploy icp_ledger --argument=\'(record {minting_account = "\'$(dfx ledger account-id)\'"; initial_values = vec {}; send_whitelist = vec {}})\'`, + `dfx deploy icp_ledger --argument='(record {minting_account = "'$(dfx ledger account-id)'"; initial_values = vec {}; send_whitelist = vec {}})'`, { stdio: 'inherit' } @@ -261,7 +261,7 @@ function getTransferErrorTests( name: 'deploy icpLedger', prep: async () => { execSync( - `dfx deploy icp_ledger --argument=\'(record {minting_account = "\'$(dfx ledger account-id)\'"; initial_values = vec { record { "\'$(dfx ledger account-id --of-canister ledger_canister)\'"; record { e8s=100_000_000_000 } }; }; send_whitelist = vec {}})\'`, + `dfx deploy icp_ledger --argument='(record {minting_account = "'$(dfx ledger account-id)'"; initial_values = vec { record { "'$(dfx ledger account-id --of-canister ledger_canister)'"; record { e8s=100_000_000_000 } }; }; send_whitelist = vec {}})'`, { stdio: 'inherit' } From eccf642a25ea2f2b07db4eaaf7b0510c49b2c873 Mon Sep 17 00:00:00 2001 From: Dan Steren Date: Wed, 29 Nov 2023 10:41:25 -0700 Subject: [PATCH 12/34] Remove useless try/catch --- .eslintrc.js | 1 - .../reference/service/canister_function/index.ts | 16 ++++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 5aff5faa11..ab7ed9c2b9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -13,7 +13,6 @@ const temporarilyDisabledRules = { 'no-empty': 'off', 'no-prototype-builtins': 'off', 'no-undef': 'off', - 'no-useless-catch': 'off', 'no-var': 'off', 'prefer-const': 'off' }; diff --git a/src/lib/candid/types/reference/service/canister_function/index.ts b/src/lib/candid/types/reference/service/canister_function/index.ts index fca63a0488..ff69900f90 100644 --- a/src/lib/candid/types/reference/service/canister_function/index.ts +++ b/src/lib/candid/types/reference/service/canister_function/index.ts @@ -174,16 +174,12 @@ function serviceCall( const encodedArgs = encode(paramCandidTypes, args); if (notify) { - try { - return (callFunction as NotifyRawFunction)( - canisterId, - methodName, - encodedArgs, - cycles - ); - } catch (error) { - throw error; - } + return (callFunction as NotifyRawFunction)( + canisterId, + methodName, + encodedArgs, + cycles + ); } else { return (async () => { const encodedResult = await (callFunction as CallRawFunction)( From 159447d0510020ad7c15279a05bbdbdd6c755f16 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 4 Apr 2024 11:47:51 -0600 Subject: [PATCH 13/34] Correct banned TS types --- .eslintrc.js | 1 - .../src/canister3/stable_map_16.ts | 2 +- .../src/canister3/stable_map_17.ts | 2 +- http_client/fetch_ic/actor.ts | 18 ++++++++++++++++-- .../candid/constructed/tuple_arb/index.ts | 2 +- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index ab7ed9c2b9..ba63ce1de4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,7 +2,6 @@ // This is tech-debt. We should go through and re-enable these at some point. const temporarilyDisabledRules = { '@typescript-eslint/ban-ts-comment': 'off', - '@typescript-eslint/ban-types': 'off', '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-loss-of-precision': 'off', '@typescript-eslint/no-namespace': 'off', diff --git a/examples/stable_structures/src/canister3/stable_map_16.ts b/examples/stable_structures/src/canister3/stable_map_16.ts index 6677d28fa3..18893fedcb 100644 --- a/examples/stable_structures/src/canister3/stable_map_16.ts +++ b/examples/stable_structures/src/canister3/stable_map_16.ts @@ -12,7 +12,7 @@ import { Vec } from 'azle'; -let stableMap16 = StableBTreeMap(16); +let stableMap16 = StableBTreeMap(16); export const stableMap16Methods = { stableMap16ContainsKey: query([text], bool, (key) => { diff --git a/examples/stable_structures/src/canister3/stable_map_17.ts b/examples/stable_structures/src/canister3/stable_map_17.ts index ccdef796e0..fbbbea7861 100644 --- a/examples/stable_structures/src/canister3/stable_map_17.ts +++ b/examples/stable_structures/src/canister3/stable_map_17.ts @@ -10,7 +10,7 @@ import { Vec } from 'azle'; -let stableMap17 = StableBTreeMap<{}, text>(17); +let stableMap17 = StableBTreeMap(17); export const stableMap17Methods = { stableMap17ContainsKey: query([text], bool, (key) => { diff --git a/http_client/fetch_ic/actor.ts b/http_client/fetch_ic/actor.ts index e85483ae54..a4c1e5d382 100644 --- a/http_client/fetch_ic/actor.ts +++ b/http_client/fetch_ic/actor.ts @@ -91,7 +91,14 @@ export interface _SERVICE { upgrade: [] | [boolean]; streaming_strategy: | [] - | [{ Callback: { token: {}; callback: [Principal, string] } }]; + | [ + { + Callback: { + token: unknown; // TODO I am not sure if unknown is the right option here. Maybe `object`? + callback: [Principal, string]; + }; + } + ]; status_code: number; } >; @@ -110,7 +117,14 @@ export interface _SERVICE { upgrade: [] | [boolean]; streaming_strategy: | [] - | [{ Callback: { token: {}; callback: [Principal, string] } }]; + | [ + { + Callback: { + token: unknown; + callback: [Principal, string]; + }; + } + ]; status_code: number; } >; diff --git a/property_tests/arbitraries/candid/constructed/tuple_arb/index.ts b/property_tests/arbitraries/candid/constructed/tuple_arb/index.ts index 745c067c0a..27f7138221 100644 --- a/property_tests/arbitraries/candid/constructed/tuple_arb/index.ts +++ b/property_tests/arbitraries/candid/constructed/tuple_arb/index.ts @@ -9,7 +9,7 @@ import { TupleDefinitionArb } from './definition_arb'; import { TupleValuesArb } from './values_arbs'; export type Tuple = CorrespondingJSType[]; -export type ReturnTuple = Tuple | {}; +export type ReturnTuple = Tuple | Record; export function TupleArb( constraints?: CandidValueConstraints From 684e05bed034330be0230b02091f60b8444e7dff Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 4 Apr 2024 11:59:23 -0600 Subject: [PATCH 14/34] update eslintignore --- .eslintignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.eslintignore b/.eslintignore index f8f99417b4..6bc2c5fd02 100644 --- a/.eslintignore +++ b/.eslintignore @@ -3,4 +3,7 @@ the_azle_book type_tests run_time_errors **/webpack.config.js +dfx_generate dfx_generated +declarations +property_tests/tests/**/src/* From d54fb617420cd92068215e415a353c86b5d72d34 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 4 Apr 2024 12:03:42 -0600 Subject: [PATCH 15/34] Enable no-loss-of-precision and no-namespace --- .eslintrc.js | 2 -- src/lib/system_types/result.ts | 6 ++++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index ba63ce1de4..4c3b1a92f5 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,8 +3,6 @@ const temporarilyDisabledRules = { '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/no-loss-of-precision': 'off', - '@typescript-eslint/no-namespace': 'off', '@typescript-eslint/no-unused-vars': 'off', '@typescript-eslint/no-var-requires': 'off', '@typescript-eslint/prefer-as-const': 'off', diff --git a/src/lib/system_types/result.ts b/src/lib/system_types/result.ts index 2861cabbe8..03cf6657fa 100644 --- a/src/lib/system_types/result.ts +++ b/src/lib/system_types/result.ts @@ -33,6 +33,12 @@ export type Result = RequireExactlyOne<{ Err: Err; }>; +// Using a namespace is the only way we can see to get Result exported as: +// - a type +// - a function +// - a namespace for the Ok and Err functions +// +// eslint-disable-next-line @typescript-eslint/no-namespace export namespace Result { export function Ok(value: T) { return { Ok: value }; From 10b0141d51051c7e1cb0b8759e625fa42da6d1ac Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 4 Apr 2024 12:09:47 -0600 Subject: [PATCH 16/34] Enable no-prototype-builtins rule --- .eslintrc.js | 1 - property_tests/visitors/cli-string-visitor.ts | 2 +- scripts/reorder_dfx_json.js | 7 ++++++- src/lib/candid/types/constructed/to_idl_map.ts | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 4c3b1a92f5..07603462a1 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -8,7 +8,6 @@ const temporarilyDisabledRules = { '@typescript-eslint/prefer-as-const': 'off', 'no-constant-condition': 'off', 'no-empty': 'off', - 'no-prototype-builtins': 'off', 'no-undef': 'off', 'no-var': 'off', 'prefer-const': 'off' diff --git a/property_tests/visitors/cli-string-visitor.ts b/property_tests/visitors/cli-string-visitor.ts index c8cec60dff..2aa55e3df9 100644 --- a/property_tests/visitors/cli-string-visitor.ts +++ b/property_tests/visitors/cli-string-visitor.ts @@ -71,7 +71,7 @@ export class CliStringVisitor extends IDL.Visitor { data: VisitorData ): string { for (const [name, type] of fields) { - if (data.value.hasOwnProperty(name)) { + if (Object.prototype.hasOwnProperty.call(data.value, name)) { const value = type.accept(this, { value: data.value[name] }); if (value === 'null') { return `variant {${name}}`; diff --git a/scripts/reorder_dfx_json.js b/scripts/reorder_dfx_json.js index f8646b376b..430c037037 100644 --- a/scripts/reorder_dfx_json.js +++ b/scripts/reorder_dfx_json.js @@ -32,7 +32,12 @@ fs.readdir(dirPath, (err, folders) => { fs.readJson(dfxJsonPath) .then((dfxConfig) => { for (const canister in dfxConfig.canisters) { - if (dfxConfig.canisters.hasOwnProperty(canister)) { + if ( + Object.prototype.hasOwnProperty.call( + dfxConfig.canisters, + canister + ) + ) { dfxConfig.canisters[canister] = reorderKeys( dfxConfig.canisters[canister], [ diff --git a/src/lib/candid/types/constructed/to_idl_map.ts b/src/lib/candid/types/constructed/to_idl_map.ts index f9d6ec3c9d..58c9353571 100644 --- a/src/lib/candid/types/constructed/to_idl_map.ts +++ b/src/lib/candid/types/constructed/to_idl_map.ts @@ -10,7 +10,7 @@ export function toIdlMap(candidMap: CandidMap, parent: Parent[]): IdlMap { const idlMap: IdlMap = {}; for (const key in candidMap) { - if (candidMap.hasOwnProperty(key)) { + if (Object.prototype.hasOwnProperty.call(candidMap, key)) { const candidType = candidMap[key]; idlMap[key] = toIdl(candidType, parent); } From 86f4c0c91e14c9acacc07cc07bfb6fcbccbfef20 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 4 Apr 2024 12:13:16 -0600 Subject: [PATCH 17/34] Enable no-empty rule --- .eslintrc.js | 1 - examples/rejections/src/rejections/index.ts | 16 ++++++++++++---- examples/robust_imports/test/tests.ts | 20 +++++++++++++++----- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 07603462a1..0d28e57e1b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -7,7 +7,6 @@ const temporarilyDisabledRules = { '@typescript-eslint/no-var-requires': 'off', '@typescript-eslint/prefer-as-const': 'off', 'no-constant-condition': 'off', - 'no-empty': 'off', 'no-undef': 'off', 'no-var': 'off', 'prefer-const': 'off' diff --git a/examples/rejections/src/rejections/index.ts b/examples/rejections/src/rejections/index.ts index 21ac7aacee..dfe32d6f7c 100644 --- a/examples/rejections/src/rejections/index.ts +++ b/examples/rejections/src/rejections/index.ts @@ -53,7 +53,9 @@ export default Canister({ } else { await ic.call(nonexistentCanister.method); } - } catch (error) {} + } catch (error) { + // continue regardless of error + } return ic.rejectCode(); }), @@ -69,7 +71,9 @@ export default Canister({ } else { await ic.call(someCanister.reject, { args: ['reject'] }); } - } catch (error) {} + } catch (error) { + // continue regardless of error + } return ic.rejectCode(); }), @@ -84,7 +88,9 @@ export default Canister({ } else { await ic.call(someCanister.error); } - } catch (error) {} + } catch (error) { + // continue regardless of error + } return ic.rejectCode(); }), @@ -100,7 +106,9 @@ export default Canister({ } else { await ic.call(someCanister.reject, { args: [message] }); } - } catch (error) {} + } catch (error) { + // continue regardless of error + } return ic.rejectMessage(); }) diff --git a/examples/robust_imports/test/tests.ts b/examples/robust_imports/test/tests.ts index 12096f5933..2e0aa65dca 100644 --- a/examples/robust_imports/test/tests.ts +++ b/examples/robust_imports/test/tests.ts @@ -179,14 +179,18 @@ function getAzleCoverageTests(fruit: ActorSubclass<_SERVICE>): Test[] { try { await fruit.checkWatermelonForSeeds(false, watermelon); return { Ok: false }; - } catch (err) {} + } catch (err) { + // continue regardless of error + } try { await fruit.checkWatermelonForSeeds( true, seedlessWatermelon ); return { Ok: false }; - } catch (err) {} + } catch (err) { + // continue regardless of error + } try { await fruit.checkWatermelonForSeeds( false, @@ -310,11 +314,15 @@ function getAzleCoverageTests(fruit: ActorSubclass<_SERVICE>): Test[] { try { await fruit.dirtyIlama(); return { Ok: false }; - } catch {} + } catch { + // continue regardless of error + } try { await fruit.pickElderberry(); return { Ok: false }; - } catch {} + } catch { + // continue regardless of error + } return { Ok: !(await fruit.isFruitPrepared()) }; @@ -396,7 +404,9 @@ function getTypeAliasDeclTests(canister: ActorSubclass<_SERVICE>): Test[] { try { await canister.deepEmptyAlias(); return { Ok: false }; - } catch {} + } catch { + // continue regardless of error + } return { Ok: true }; } }, From 59b91257262b1c857899a70884dafda1f499edf1 Mon Sep 17 00:00:00 2001 From: Dan Steren Date: Wed, 29 Nov 2023 14:52:21 -0700 Subject: [PATCH 18/34] Enable prefer-as-const rule --- .eslintrc.js | 1 - src/lib/candid/types/constructed/blob.ts | 4 ++-- src/lib/candid/types/constructed/opt.ts | 4 ++-- src/lib/candid/types/constructed/tuple.ts | 4 ++-- src/lib/candid/types/constructed/vec.ts | 4 ++-- src/lib/candid/types/primitive/bool.ts | 4 ++-- src/lib/candid/types/primitive/empty.ts | 4 ++-- src/lib/candid/types/primitive/floats/float32.ts | 4 ++-- src/lib/candid/types/primitive/floats/float64.ts | 4 ++-- src/lib/candid/types/primitive/ints/int.ts | 4 ++-- src/lib/candid/types/primitive/ints/int16.ts | 4 ++-- src/lib/candid/types/primitive/ints/int32.ts | 4 ++-- src/lib/candid/types/primitive/ints/int64.ts | 4 ++-- src/lib/candid/types/primitive/ints/int8.ts | 4 ++-- src/lib/candid/types/primitive/nats/nat.ts | 4 ++-- src/lib/candid/types/primitive/nats/nat16.ts | 4 ++-- src/lib/candid/types/primitive/nats/nat32.ts | 4 ++-- src/lib/candid/types/primitive/nats/nat64.ts | 4 ++-- src/lib/candid/types/primitive/nats/nat8.ts | 4 ++-- src/lib/candid/types/primitive/null.ts | 4 ++-- src/lib/candid/types/primitive/reserved.ts | 4 ++-- src/lib/candid/types/primitive/text.ts | 4 ++-- src/lib/candid/types/primitive/void.ts | 4 ++-- src/lib/candid/types/reference/principal.ts | 2 +- 24 files changed, 45 insertions(+), 46 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 0d28e57e1b..d4da96b058 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -5,7 +5,6 @@ const temporarilyDisabledRules = { '@typescript-eslint/no-explicit-any': 'off', '@typescript-eslint/no-unused-vars': 'off', '@typescript-eslint/no-var-requires': 'off', - '@typescript-eslint/prefer-as-const': 'off', 'no-constant-condition': 'off', 'no-undef': 'off', 'no-var': 'off', diff --git a/src/lib/candid/types/constructed/blob.ts b/src/lib/candid/types/constructed/blob.ts index a3805306d0..fea080d021 100644 --- a/src/lib/candid/types/constructed/blob.ts +++ b/src/lib/candid/types/constructed/blob.ts @@ -4,8 +4,8 @@ import { decode } from '../../serde/decode'; import { encode } from '../../serde/encode'; export class AzleBlob { - _azleKind: 'AzleBlob' = 'AzleBlob'; - static _azleKind: 'AzleBlob' = 'AzleBlob'; + _azleKind = 'AzleBlob' as const; + static _azleKind = 'AzleBlob' as const; static tsType: blob; diff --git a/src/lib/candid/types/constructed/opt.ts b/src/lib/candid/types/constructed/opt.ts index a0ef1b880d..b0d602f27c 100644 --- a/src/lib/candid/types/constructed/opt.ts +++ b/src/lib/candid/types/constructed/opt.ts @@ -39,8 +39,8 @@ export class AzleOpt { innerType: CandidType; - _azleKind: 'AzleOpt' = 'AzleOpt'; - static _azleKind: 'AzleOpt' = 'AzleOpt'; + _azleKind = 'AzleOpt' as const; + static _azleKind = 'AzleOpt' as const; toBytes(data: any) { return encode(this, data); diff --git a/src/lib/candid/types/constructed/tuple.ts b/src/lib/candid/types/constructed/tuple.ts index 87789ad3a5..bb52cc9144 100644 --- a/src/lib/candid/types/constructed/tuple.ts +++ b/src/lib/candid/types/constructed/tuple.ts @@ -17,8 +17,8 @@ export class AzleTuple { innerTypes: CandidType[]; - _azleKind: 'AzleTuple' = 'AzleTuple'; - static _azleKind: 'AzleTuple' = 'AzleTuple'; + _azleKind = 'AzleTuple' as const; + static _azleKind = 'AzleTuple' as const; toBytes(data: any) { return encode(this, data); diff --git a/src/lib/candid/types/constructed/vec.ts b/src/lib/candid/types/constructed/vec.ts index bb14bc996d..cdb3b0acc1 100644 --- a/src/lib/candid/types/constructed/vec.ts +++ b/src/lib/candid/types/constructed/vec.ts @@ -15,8 +15,8 @@ export class AzleVec { innerType: CandidType; - _azleKind: 'AzleVec' = 'AzleVec'; - static _azleKind: 'AzleVec' = 'AzleVec'; + _azleKind = 'AzleVec' as const; + static _azleKind = 'AzleVec' as const; toBytes(data: any) { return encode(this, data); diff --git a/src/lib/candid/types/primitive/bool.ts b/src/lib/candid/types/primitive/bool.ts index a921ba9706..9ccb98a530 100644 --- a/src/lib/candid/types/primitive/bool.ts +++ b/src/lib/candid/types/primitive/bool.ts @@ -4,8 +4,8 @@ import { decode } from '../../serde/decode'; import { encode } from '../../serde/encode'; export class AzleBool { - _azleKind: 'AzleBool' = 'AzleBool'; - static _azleKind: 'AzleBool' = 'AzleBool'; + _azleKind = 'AzleBool' as const; + static _azleKind = 'AzleBool' as const; static tsType: bool; diff --git a/src/lib/candid/types/primitive/empty.ts b/src/lib/candid/types/primitive/empty.ts index 1e22f3a87b..6ab13069fc 100644 --- a/src/lib/candid/types/primitive/empty.ts +++ b/src/lib/candid/types/primitive/empty.ts @@ -4,8 +4,8 @@ import { decode } from '../../serde/decode'; import { encode } from '../../serde/encode'; export class AzleEmpty { - _azleKind: 'AzleEmpty' = 'AzleEmpty'; - static _azleKind: 'AzleEmpty' = 'AzleEmpty'; + _azleKind = 'AzleEmpty' as const; + static _azleKind = 'AzleEmpty' as const; static tsType: empty; diff --git a/src/lib/candid/types/primitive/floats/float32.ts b/src/lib/candid/types/primitive/floats/float32.ts index 3dcd4924c3..f53b1662f0 100644 --- a/src/lib/candid/types/primitive/floats/float32.ts +++ b/src/lib/candid/types/primitive/floats/float32.ts @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode'; import { encode } from '../../../serde/encode'; export class AzleFloat32 { - _azleKind: 'AzleFloat32' = 'AzleFloat32'; - static _azleKind: 'AzleFloat32' = 'AzleFloat32'; + _azleKind = 'AzleFloat32' as const; + static _azleKind = 'AzleFloat32' as const; static tsType: float32; diff --git a/src/lib/candid/types/primitive/floats/float64.ts b/src/lib/candid/types/primitive/floats/float64.ts index 95597d8bb7..53465a8f80 100644 --- a/src/lib/candid/types/primitive/floats/float64.ts +++ b/src/lib/candid/types/primitive/floats/float64.ts @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode'; import { encode } from '../../../serde/encode'; export class AzleFloat64 { - _azleKind: 'AzleFloat64' = 'AzleFloat64'; - static _azleKind: 'AzleFloat64' = 'AzleFloat64'; + _azleKind = 'AzleFloat64' as const; + static _azleKind = 'AzleFloat64' as const; static tsType: float64; diff --git a/src/lib/candid/types/primitive/ints/int.ts b/src/lib/candid/types/primitive/ints/int.ts index 472f7b4f4f..c84f61197c 100644 --- a/src/lib/candid/types/primitive/ints/int.ts +++ b/src/lib/candid/types/primitive/ints/int.ts @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode'; import { encode } from '../../../serde/encode'; export class AzleInt { - _azleKind: 'AzleInt' = 'AzleInt'; - static _azleKind: 'AzleInt' = 'AzleInt'; + _azleKind = 'AzleInt' as const; + static _azleKind = 'AzleInt' as const; static tsType: int; diff --git a/src/lib/candid/types/primitive/ints/int16.ts b/src/lib/candid/types/primitive/ints/int16.ts index 383d89c1bb..e5d65827c3 100644 --- a/src/lib/candid/types/primitive/ints/int16.ts +++ b/src/lib/candid/types/primitive/ints/int16.ts @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode'; import { encode } from '../../../serde/encode'; export class AzleInt16 { - _azleKind: 'AzleInt16' = 'AzleInt16'; - static _azleKind: 'AzleInt16' = 'AzleInt16'; + _azleKind = 'AzleInt16' as const; + static _azleKind = 'AzleInt16' as const; static tsType: int16; diff --git a/src/lib/candid/types/primitive/ints/int32.ts b/src/lib/candid/types/primitive/ints/int32.ts index 57bc08d46f..0e29281e62 100644 --- a/src/lib/candid/types/primitive/ints/int32.ts +++ b/src/lib/candid/types/primitive/ints/int32.ts @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode'; import { encode } from '../../../serde/encode'; export class AzleInt32 { - _azleKind: 'AzleInt32' = 'AzleInt32'; - static _azleKind: 'AzleInt32' = 'AzleInt32'; + _azleKind = 'AzleInt32' as const; + static _azleKind = 'AzleInt32' as const; static tsType: int32; diff --git a/src/lib/candid/types/primitive/ints/int64.ts b/src/lib/candid/types/primitive/ints/int64.ts index 2628bdc726..1a43f9e3f3 100644 --- a/src/lib/candid/types/primitive/ints/int64.ts +++ b/src/lib/candid/types/primitive/ints/int64.ts @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode'; import { encode } from '../../../serde/encode'; export class AzleInt64 { - _azleKind: 'AzleInt64' = 'AzleInt64'; - static _azleKind: 'AzleInt64' = 'AzleInt64'; + _azleKind = 'AzleInt64' as const; + static _azleKind = 'AzleInt64' as const; static tsType: int64; diff --git a/src/lib/candid/types/primitive/ints/int8.ts b/src/lib/candid/types/primitive/ints/int8.ts index 6849633669..e1a65ac4f3 100644 --- a/src/lib/candid/types/primitive/ints/int8.ts +++ b/src/lib/candid/types/primitive/ints/int8.ts @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode'; import { encode } from '../../../serde/encode'; export class AzleInt8 { - _azleKind: 'AzleInt8' = 'AzleInt8'; - static _azleKind: 'AzleInt8' = 'AzleInt8'; + _azleKind = 'AzleInt8' as const; + static _azleKind = 'AzleInt8' as const; static tsType: int8; diff --git a/src/lib/candid/types/primitive/nats/nat.ts b/src/lib/candid/types/primitive/nats/nat.ts index 4a824865bc..f8a451e810 100644 --- a/src/lib/candid/types/primitive/nats/nat.ts +++ b/src/lib/candid/types/primitive/nats/nat.ts @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode'; import { encode } from '../../../serde/encode'; export class AzleNat { - _azleKind: 'AzleNat' = 'AzleNat'; - static _azleKind: 'AzleNat' = 'AzleNat'; + _azleKind = 'AzleNat' as const; + static _azleKind = 'AzleNat' as const; static tsType: nat; diff --git a/src/lib/candid/types/primitive/nats/nat16.ts b/src/lib/candid/types/primitive/nats/nat16.ts index db7cc5c332..097753a423 100644 --- a/src/lib/candid/types/primitive/nats/nat16.ts +++ b/src/lib/candid/types/primitive/nats/nat16.ts @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode'; import { encode } from '../../../serde/encode'; export class AzleNat16 { - _azleKind: 'AzleNat16' = 'AzleNat16'; - static _azleKind: 'AzleNat16' = 'AzleNat16'; + _azleKind = 'AzleNat16' as const; + static _azleKind = 'AzleNat16' as const; static tsType: nat16; diff --git a/src/lib/candid/types/primitive/nats/nat32.ts b/src/lib/candid/types/primitive/nats/nat32.ts index 0a4f58a8fd..6bbe15d199 100644 --- a/src/lib/candid/types/primitive/nats/nat32.ts +++ b/src/lib/candid/types/primitive/nats/nat32.ts @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode'; import { encode } from '../../../serde/encode'; export class AzleNat32 { - _azleKind: 'AzleNat32' = 'AzleNat32'; - static _azleKind: 'AzleNat32' = 'AzleNat32'; + _azleKind = 'AzleNat32' as const; + static _azleKind = 'AzleNat32' as const; static tsType: nat32; diff --git a/src/lib/candid/types/primitive/nats/nat64.ts b/src/lib/candid/types/primitive/nats/nat64.ts index 480c8965ae..234ccece51 100644 --- a/src/lib/candid/types/primitive/nats/nat64.ts +++ b/src/lib/candid/types/primitive/nats/nat64.ts @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode'; import { encode } from '../../../serde/encode'; export class AzleNat64 { - _azleKind: 'AzleNat64' = 'AzleNat64'; - static _azleKind: 'AzleNat64' = 'AzleNat64'; + _azleKind = 'AzleNat64' as const; + static _azleKind = 'AzleNat64' as const; static tsType: nat64; diff --git a/src/lib/candid/types/primitive/nats/nat8.ts b/src/lib/candid/types/primitive/nats/nat8.ts index 9847773ad6..55f2447f98 100644 --- a/src/lib/candid/types/primitive/nats/nat8.ts +++ b/src/lib/candid/types/primitive/nats/nat8.ts @@ -4,8 +4,8 @@ import { decode } from '../../../serde/decode'; import { encode } from '../../../serde/encode'; export class AzleNat8 { - _azleKind: 'AzleNat8' = 'AzleNat8'; - static _azleKind: 'AzleNat8' = 'AzleNat8'; + _azleKind = 'AzleNat8' as const; + static _azleKind = 'AzleNat8' as const; static tsType: nat8; diff --git a/src/lib/candid/types/primitive/null.ts b/src/lib/candid/types/primitive/null.ts index bec4d50a39..3f7d5785dd 100644 --- a/src/lib/candid/types/primitive/null.ts +++ b/src/lib/candid/types/primitive/null.ts @@ -4,8 +4,8 @@ import { decode } from '../../serde/decode'; import { encode } from '../../serde/encode'; export class AzleNull { - _azleKind: 'AzleNull' = 'AzleNull'; - static _azleKind: 'AzleNull' = 'AzleNull'; + _azleKind = 'AzleNull' as const; + static _azleKind = 'AzleNull' as const; static tsType: Null; diff --git a/src/lib/candid/types/primitive/reserved.ts b/src/lib/candid/types/primitive/reserved.ts index ad24da8c0f..5e69151e6b 100644 --- a/src/lib/candid/types/primitive/reserved.ts +++ b/src/lib/candid/types/primitive/reserved.ts @@ -4,8 +4,8 @@ import { decode } from '../../serde/decode'; import { encode } from '../../serde/encode'; export class AzleReserved { - _azleKind: 'AzleReserved' = 'AzleReserved'; - static _azleKind: 'AzleReserved' = 'AzleReserved'; + _azleKind = 'AzleReserved' as const; + static _azleKind = 'AzleReserved' as const; static tsType: reserved; diff --git a/src/lib/candid/types/primitive/text.ts b/src/lib/candid/types/primitive/text.ts index 279f40bb4c..6615948901 100644 --- a/src/lib/candid/types/primitive/text.ts +++ b/src/lib/candid/types/primitive/text.ts @@ -4,8 +4,8 @@ import { decode } from '../../serde/decode'; import { encode } from '../../serde/encode'; export class AzleText { - _azleKind: 'AzleText' = 'AzleText'; - static _azleKind: 'AzleText' = 'AzleText'; + _azleKind = 'AzleText' as const; + static _azleKind = 'AzleText' as const; static tsType: text; diff --git a/src/lib/candid/types/primitive/void.ts b/src/lib/candid/types/primitive/void.ts index cbd6385d08..12abe87530 100644 --- a/src/lib/candid/types/primitive/void.ts +++ b/src/lib/candid/types/primitive/void.ts @@ -4,8 +4,8 @@ import { decode } from '../../serde/decode'; import { encode } from '../../serde/encode'; export class AzleVoid { - _azleKind: 'AzleVoid' = 'AzleVoid'; - static _azleKind: 'AzleVoid' = 'AzleVoid'; + _azleKind = 'AzleVoid' as const; + static _azleKind = 'AzleVoid' as const; static tsType: Void; diff --git a/src/lib/candid/types/reference/principal.ts b/src/lib/candid/types/reference/principal.ts index ea56143020..48d48d1ae7 100644 --- a/src/lib/candid/types/reference/principal.ts +++ b/src/lib/candid/types/reference/principal.ts @@ -6,7 +6,7 @@ import { encode } from '../../serde/encode'; import { Parent } from '../../to_idl'; export class Principal extends DfinityPrincipal { - static _azleKind: 'Principal' = 'Principal'; + static _azleKind = 'Principal' as const; static tsType: Principal; From e0e763c0de52af5e67608374a3c7c5fc1ff097a4 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 4 Apr 2024 12:41:32 -0600 Subject: [PATCH 19/34] reduce no-unused vars to 26 --- .eslintrc.js | 8 ++++++- canisters/management/canister_info.ts | 3 ++- examples/async_await/src/async_await.ts | 2 +- examples/bitcoin/test/tests.ts | 4 ++-- examples/ckbtc/test/tests.ts | 2 -- examples/ethereum_json_rpc/src/index.ts | 1 - examples/guard_functions/test/tests.ts | 12 ++++------- .../heartbeat/src/heartbeat_async/index.ts | 2 +- examples/ic_api/src/index.ts | 4 ++-- examples/inspect_message/test/tests.ts | 5 ++--- .../src/ledger_canister/index.ts | 2 -- examples/ledger_canister/test/tests.ts | 2 +- examples/list_of_lists/test/tests.ts | 9 +------- examples/management_canister/test/tests.ts | 21 +++++++------------ .../http_counter/test/tests.ts | 2 -- .../motoko_examples/simple-to-do/src/index.ts | 2 +- examples/notify_raw/test/tests.ts | 2 +- examples/primitive_types/test/tests.ts | 6 ++---- examples/stable_memory/test/tests.ts | 4 ++-- examples/timers/src/timers.ts | 1 - examples/tuple_types/src/index.ts | 3 +-- .../constructed/opt_arb/definition_arb.ts | 1 - .../candid/recursive/definition_arb.ts | 1 - .../arbitraries/candid/to_src_literal/void.ts | 2 +- property_tests/arbitraries/canister_arb.ts | 7 ------- .../candid/did_file/visitor/visit/variant.ts | 2 +- src/lib/candid/serde/decode.ts | 3 ++- src/lib/candid/serde/encode.ts | 3 ++- src/lib/candid/type_mapping.ts | 2 +- src/lib/candid/types/reference/func.ts | 1 - src/lib/ic/call_raw_128.ts | 1 - src/lib/ic/clear_timer.ts | 1 - src/lib/ic/set_timer.ts | 3 --- src/lib/ic/set_timer_interval.ts | 3 --- src/lib/ic/stable_64_read.ts | 3 --- src/lib/ic/stable_read.ts | 1 - src/lib/ic/stable_size.ts | 1 - src/lib/ic/stable_write.ts | 1 - src/lib/server.ts | 2 +- src/lib/threshold_wallet/wallet.ts | 8 +++---- 40 files changed, 49 insertions(+), 94 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index d4da96b058..c79f4c436f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,7 +3,13 @@ const temporarilyDisabledRules = { '@typescript-eslint/ban-ts-comment': 'off', '@typescript-eslint/no-explicit-any': 'off', - '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/no-unused-vars': [ + 'off', + { + argsIgnorePattern: '^_', // Ignore argument variables starting with _ + varsIgnorePattern: '^_' // Ignore local variables starting with _ + } + ], // 26 problems '@typescript-eslint/no-var-requires': 'off', 'no-constant-condition': 'off', 'no-undef': 'off', diff --git a/canisters/management/canister_info.ts b/canisters/management/canister_info.ts index c14ee55bf1..7a4f783941 100644 --- a/canisters/management/canister_info.ts +++ b/canisters/management/canister_info.ts @@ -14,7 +14,8 @@ import { Variant, Vec } from '../../src/lib'; -import { managementCanister } from '.'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import { managementCanister } from '.'; // Used for links in comments /** Argument type of {@link managementCanister.canister_info}. */ export const CanisterInfoArgs = Record({ diff --git a/examples/async_await/src/async_await.ts b/examples/async_await/src/async_await.ts index 1be0d380f6..4a8be71217 100644 --- a/examples/async_await/src/async_await.ts +++ b/examples/async_await/src/async_await.ts @@ -1,4 +1,4 @@ -import { blob, Canister, ic, serialize, update, Void } from 'azle'; +import { blob, Canister, ic, update, Void } from 'azle'; import { managementCanister } from 'azle/canisters/management'; export default Canister({ diff --git a/examples/bitcoin/test/tests.ts b/examples/bitcoin/test/tests.ts index caaa63bda4..e97806b214 100644 --- a/examples/bitcoin/test/tests.ts +++ b/examples/bitcoin/test/tests.ts @@ -1,6 +1,6 @@ -import { Test } from 'azle/test'; +// import { Test } from 'azle/test'; -import { _SERVICE } from './dfx_generated/bitcoin/bitcoin.did'; +// import { _SERVICE } from './dfx_generated/bitcoin/bitcoin.did'; // import { ActorSubclass } from '@dfinity/agent'; // export function get_tests(update_canister: ActorSubclass<_SERVICE>): Test[] { diff --git a/examples/ckbtc/test/tests.ts b/examples/ckbtc/test/tests.ts index f2da3a29df..e0b5403944 100644 --- a/examples/ckbtc/test/tests.ts +++ b/examples/ckbtc/test/tests.ts @@ -86,8 +86,6 @@ export function getTests(): Test[] { return { Err: Object.keys(updateBalanceResult.Err)[0] }; } - const okValue = updateBalanceResult.Ok; - return { Ok: true }; } }, diff --git a/examples/ethereum_json_rpc/src/index.ts b/examples/ethereum_json_rpc/src/index.ts index 9e01d6aae3..8a54b43203 100644 --- a/examples/ethereum_json_rpc/src/index.ts +++ b/examples/ethereum_json_rpc/src/index.ts @@ -5,7 +5,6 @@ import { nat32, Principal, query, - serialize, Some, StableBTreeMap, text, diff --git a/examples/guard_functions/test/tests.ts b/examples/guard_functions/test/tests.ts index 8933572c25..00321b491c 100644 --- a/examples/guard_functions/test/tests.ts +++ b/examples/guard_functions/test/tests.ts @@ -81,8 +81,7 @@ export function getTests( name: 'tightlyGuarded', test: async () => { try { - const result = - await guardFunctionsCanister.tightlyGuarded(); + await guardFunctionsCanister.tightlyGuarded(); return { Err: 'Expected tightlyGuarded function to throw' }; @@ -99,8 +98,7 @@ export function getTests( name: 'errorStringGuarded', test: async () => { try { - const result = - await guardFunctionsCanister.errorStringGuarded(); + await guardFunctionsCanister.errorStringGuarded(); return { Err: 'Expected errorStringGuarded function to throw' }; @@ -117,8 +115,7 @@ export function getTests( name: 'customErrorGuarded', test: async () => { try { - const result = - await guardFunctionsCanister.customErrorGuarded(); + await guardFunctionsCanister.customErrorGuarded(); return { Err: 'Expected customErrorGuarded function to throw' }; @@ -135,8 +132,7 @@ export function getTests( name: 'nonStringErrValueGuarded', test: async () => { try { - const result = - await guardFunctionsCanister.nonStringErrValueGuarded(); + await guardFunctionsCanister.nonStringErrValueGuarded(); return { Err: 'Expected nonStringErrValueGuarded function to throw' }; diff --git a/examples/heartbeat/src/heartbeat_async/index.ts b/examples/heartbeat/src/heartbeat_async/index.ts index 040ebfb052..aee0bf497d 100644 --- a/examples/heartbeat/src/heartbeat_async/index.ts +++ b/examples/heartbeat/src/heartbeat_async/index.ts @@ -1,4 +1,4 @@ -import { blob, Canister, heartbeat, ic, query, serialize } from 'azle'; +import { blob, Canister, heartbeat, ic, query } from 'azle'; import { managementCanister } from 'azle/canisters/management'; let initialized: blob = Uint8Array.from([]); diff --git a/examples/ic_api/src/index.ts b/examples/ic_api/src/index.ts index bfd5f40f86..0357a0ade9 100644 --- a/examples/ic_api/src/index.ts +++ b/examples/ic_api/src/index.ts @@ -57,7 +57,7 @@ export default Canister({ argDataRaw: query( [blob, int8, bool, text], blob, - (arg1, arg2, arg3, arg4) => { + (_arg1, _arg2, _arg3, _arg4) => { return ic.argDataRaw(); } ), @@ -65,7 +65,7 @@ export default Canister({ argDataRawSize: query( [blob, int8, bool, text], nat32, - (arg1, arg2, arg3, arg4) => { + (_arg1, _arg2, _arg3, _arg4) => { return ic.argDataRawSize(); } ), diff --git a/examples/inspect_message/test/tests.ts b/examples/inspect_message/test/tests.ts index 24a8997699..6b9fe8a456 100644 --- a/examples/inspect_message/test/tests.ts +++ b/examples/inspect_message/test/tests.ts @@ -27,7 +27,7 @@ export function getTests( name: 'not calling `ic.acceptMessage` in inspectMessage', test: async () => { try { - const result = await inspectMessageCanister.inaccessible(); + await inspectMessageCanister.inaccessible(); return { Ok: false }; @@ -44,8 +44,7 @@ export function getTests( name: 'throwing in `inspectMessage`', test: async () => { try { - const result = - await inspectMessageCanister.alsoInaccessible(); + await inspectMessageCanister.alsoInaccessible(); return { Ok: false diff --git a/examples/ledger_canister/src/ledger_canister/index.ts b/examples/ledger_canister/src/ledger_canister/index.ts index 60341d91db..15978865da 100644 --- a/examples/ledger_canister/src/ledger_canister/index.ts +++ b/examples/ledger_canister/src/ledger_canister/index.ts @@ -2,7 +2,6 @@ import { Canister, ic, init, - nat16, nat32, nat64, None, @@ -18,7 +17,6 @@ import { Address, Archives, binaryAddressFromAddress, - Block, GetBlocksArgs, hexAddressFromPrincipal, Ledger, diff --git a/examples/ledger_canister/test/tests.ts b/examples/ledger_canister/test/tests.ts index a6844b149f..026d648b2e 100644 --- a/examples/ledger_canister/test/tests.ts +++ b/examples/ledger_canister/test/tests.ts @@ -1,6 +1,6 @@ import { ActorSubclass } from '@dfinity/agent'; import { Principal } from '@dfinity/principal'; -import { ok, Test } from 'azle/test'; +import { Test } from 'azle/test'; import { execSync } from 'child_process'; import { _SERVICE } from './dfx_generated/ledger_canister/ledger_canister.did'; diff --git a/examples/list_of_lists/test/tests.ts b/examples/list_of_lists/test/tests.ts index eee97ae07b..fe2dde5cf5 100644 --- a/examples/list_of_lists/test/tests.ts +++ b/examples/list_of_lists/test/tests.ts @@ -178,7 +178,7 @@ export function getTests(listOfListsCanister: ActorSubclass<_SERVICE>): Test[] { name: 'listOfEmpty test', test: async () => { try { - const result = await listOfListsCanister.listOfEmpty(); + await listOfListsCanister.listOfEmpty(); } catch (error) { return { Ok: (error as any).message.startsWith('Call failed') @@ -238,13 +238,6 @@ export function getTests(listOfListsCanister: ActorSubclass<_SERVICE>): Test[] { const expectedResult = [[[Principal.fromText('aaaaa-aa')]]]; const result = await listOfListsCanister.listOfPrincipal(expectedResult); - const principalEq = (a: any, b: any) => { - return ( - 'toText' in a && - 'toText' in b && - a.toText() === b.toText() - ); - }; return { Ok: diff --git a/examples/management_canister/test/tests.ts b/examples/management_canister/test/tests.ts index 30e1cf3376..4cb35e3ea8 100644 --- a/examples/management_canister/test/tests.ts +++ b/examples/management_canister/test/tests.ts @@ -24,8 +24,7 @@ export function getTests(managementCanister: ActorSubclass<_SERVICE>): Test[] { const canisterId = await managementCanister.getCreatedCanisterId(); - const executeUpdateSettingsResult = - await managementCanister.executeUpdateSettings(canisterId); + await managementCanister.executeUpdateSettings(canisterId); const getCanisterStatusResult = await managementCanister.getCanisterStatus({ @@ -75,8 +74,7 @@ export function getTests(managementCanister: ActorSubclass<_SERVICE>): Test[] { const cyclesBefore = statusBefore.cycles; - const depositCyclesResult = - await managementCanister.executeDepositCycles(canisterId); + await managementCanister.executeDepositCycles(canisterId); const statusAfter = await managementCanister.getCanisterStatus({ canister_id: canisterId @@ -95,8 +93,7 @@ export function getTests(managementCanister: ActorSubclass<_SERVICE>): Test[] { const canisterId = await managementCanister.getCreatedCanisterId(); - const executeUninstallCodeResult = - await managementCanister.executeUninstallCode(canisterId); + await managementCanister.executeUninstallCode(canisterId); const getCanisterStatusResult = await managementCanister.getCanisterStatus({ @@ -116,8 +113,7 @@ export function getTests(managementCanister: ActorSubclass<_SERVICE>): Test[] { const canisterId = await managementCanister.getCreatedCanisterId(); - const executeStopCanisterResult = - await managementCanister.executeStopCanister(canisterId); + await managementCanister.executeStopCanister(canisterId); const getCanisterStatusResult = await managementCanister.getCanisterStatus({ @@ -150,8 +146,7 @@ export function getTests(managementCanister: ActorSubclass<_SERVICE>): Test[] { }; } - const executeStartCanisterResult = - await managementCanister.executeStartCanister(canisterId); + await managementCanister.executeStartCanister(canisterId); const getCanisterStatusAfterResult = await managementCanister.getCanisterStatus({ @@ -219,11 +214,9 @@ export function getTests(managementCanister: ActorSubclass<_SERVICE>): Test[] { const canisterId = await managementCanister.getCreatedCanisterId(); - const executeStopCanisterResult = - await managementCanister.executeStopCanister(canisterId); + await managementCanister.executeStopCanister(canisterId); - const executeDeleteCanisterResult = - await managementCanister.executeDeleteCanister(canisterId); + await managementCanister.executeDeleteCanister(canisterId); return { Ok: true diff --git a/examples/motoko_examples/http_counter/test/tests.ts b/examples/motoko_examples/http_counter/test/tests.ts index 5671a156b7..48c586df7b 100644 --- a/examples/motoko_examples/http_counter/test/tests.ts +++ b/examples/motoko_examples/http_counter/test/tests.ts @@ -4,8 +4,6 @@ import { Test } from 'azle/test'; import { execSync } from 'child_process'; dns.setDefaultResultOrder('ipv4first'); -const skip = true; - export function getTests(): Test[] { return [ { diff --git a/examples/motoko_examples/simple-to-do/src/index.ts b/examples/motoko_examples/simple-to-do/src/index.ts index de5b931cc9..dc9665f99e 100644 --- a/examples/motoko_examples/simple-to-do/src/index.ts +++ b/examples/motoko_examples/simple-to-do/src/index.ts @@ -63,6 +63,6 @@ export default Canister({ // ); // ``` // See: https://github.com/demergent-labs/azle/issues/574 - todos = new Map([...todos].filter(([key, value]) => !value.completed)); + todos = new Map([...todos].filter(([_key, value]) => !value.completed)); }) }); diff --git a/examples/notify_raw/test/tests.ts b/examples/notify_raw/test/tests.ts index b2f97fce47..9efc3c91e6 100644 --- a/examples/notify_raw/test/tests.ts +++ b/examples/notify_raw/test/tests.ts @@ -1,5 +1,5 @@ import { ActorSubclass } from '@dfinity/agent'; -import { ok, Test } from 'azle/test'; +import { Test } from 'azle/test'; import { _SERVICE as CANISTER1_SERVICE } from './dfx_generated/canister1/canister1.did'; import { _SERVICE as CANISTER2_SERVICE } from './dfx_generated/canister2/canister2.did'; diff --git a/examples/primitive_types/test/tests.ts b/examples/primitive_types/test/tests.ts index 4a672f2cc3..e483b6d6bf 100644 --- a/examples/primitive_types/test/tests.ts +++ b/examples/primitive_types/test/tests.ts @@ -498,7 +498,7 @@ export function getTests( name: 'getEmpty', test: async () => { try { - const result = await primitiveTypesCanister.getEmpty(); + await primitiveTypesCanister.getEmpty(); } catch (error) { return { Ok: (error as any).message.startsWith('Call failed') @@ -514,9 +514,7 @@ export function getTests( name: 'printEmpty', test: async () => { try { - const result = await primitiveTypesCanister.printEmpty( - undefined as never - ); + await primitiveTypesCanister.printEmpty(undefined as never); } catch (error) { return { Ok: ((error as any).message as string).includes( diff --git a/examples/stable_memory/test/tests.ts b/examples/stable_memory/test/tests.ts index f9dbee3db1..407d6c98b7 100644 --- a/examples/stable_memory/test/tests.ts +++ b/examples/stable_memory/test/tests.ts @@ -204,7 +204,7 @@ export function getTests( name: 'stable grow out of memory', test: async () => { try { - const result = await stableMemoryCanister.stableGrow(1); + await stableMemoryCanister.stableGrow(1); } catch (e: any) { return { Ok: e.toString().includes('OutOfMemory') // TODO change error messages back to nice ones once we figure that out @@ -241,7 +241,7 @@ export function getTests( // TODO we are also turning this test off because it seems like we can't grow to the max memory anymore // TODO I am guessing this is because of the size of stable memory try { - const result = await stableMemoryCanister.stable64Grow(1n); + await stableMemoryCanister.stable64Grow(1n); } catch (e: any) { return { Ok: e.toString().includes('OutOfMemory') // TODO change error messages back to nice ones once we figure that out diff --git a/examples/timers/src/timers.ts b/examples/timers/src/timers.ts index b59ee0ac25..aa51576a25 100644 --- a/examples/timers/src/timers.ts +++ b/examples/timers/src/timers.ts @@ -7,7 +7,6 @@ import { int8, query, Record, - serialize, text, TimerId, update, diff --git a/examples/tuple_types/src/index.ts b/examples/tuple_types/src/index.ts index 5659439d0f..6f8982afb3 100644 --- a/examples/tuple_types/src/index.ts +++ b/examples/tuple_types/src/index.ts @@ -14,8 +14,7 @@ import { text, Tuple, Variant, - Vec, - Void + Vec } from 'azle'; // TODO maybe we should write tests for canister and stable storage? diff --git a/property_tests/arbitraries/candid/constructed/opt_arb/definition_arb.ts b/property_tests/arbitraries/candid/constructed/opt_arb/definition_arb.ts index cbc093a0d1..cf28a1f83a 100644 --- a/property_tests/arbitraries/candid/constructed/opt_arb/definition_arb.ts +++ b/property_tests/arbitraries/candid/constructed/opt_arb/definition_arb.ts @@ -11,7 +11,6 @@ import { WithShapes, WithShapesArb } from '../../candid_definition_arb/types'; -import { RecursiveShapes } from '../../recursive'; export function OptDefinitionArb( candidTypeArbForInnerType: RecursiveCandidDefinitionMemo, diff --git a/property_tests/arbitraries/candid/recursive/definition_arb.ts b/property_tests/arbitraries/candid/recursive/definition_arb.ts index 5d74b645b9..6c2f0baa99 100644 --- a/property_tests/arbitraries/candid/recursive/definition_arb.ts +++ b/property_tests/arbitraries/candid/recursive/definition_arb.ts @@ -11,7 +11,6 @@ import { WithShapes, WithShapesArb } from '../candid_definition_arb/types'; -import { RecursiveShapes } from '.'; export function RecursiveDefinitionArb( candidTypeArbForInnerType: RecursiveCandidDefinitionMemo, diff --git a/property_tests/arbitraries/candid/to_src_literal/void.ts b/property_tests/arbitraries/candid/to_src_literal/void.ts index c04cfbf647..c2a780e60c 100644 --- a/property_tests/arbitraries/candid/to_src_literal/void.ts +++ b/property_tests/arbitraries/candid/to_src_literal/void.ts @@ -1,3 +1,3 @@ -export function voidToSrcLiteral(value: undefined): string { +export function voidToSrcLiteral(): string { return 'undefined'; } diff --git a/property_tests/arbitraries/canister_arb.ts b/property_tests/arbitraries/canister_arb.ts index aaf67e0598..bdf664a700 100644 --- a/property_tests/arbitraries/canister_arb.ts +++ b/property_tests/arbitraries/canister_arb.ts @@ -157,10 +157,3 @@ function generateSourceCode( }); `; } - -function escapeForBash(input: string) { - return input - .replace(/\\/g, '\\\\') // Escape backslashes - .replace(/'/g, "'\\''") // Escape single quotes - .replace(/"/g, '\\"'); // Escape double quotes -} diff --git a/src/lib/candid/did_file/visitor/visit/variant.ts b/src/lib/candid/did_file/visitor/visit/variant.ts index 7f07d15456..e623f47258 100644 --- a/src/lib/candid/did_file/visitor/visit/variant.ts +++ b/src/lib/candid/did_file/visitor/visit/variant.ts @@ -9,7 +9,7 @@ export function visitVariant( didVisitor: DidVisitor, data: VisitorData ): VisitorResult { - const candidFields = fields.map(([key, value]) => + const candidFields = fields.map(([_key, value]) => value.accept(didVisitor, { ...data, isOnService: false }) ); const candid = extractCandid(candidFields); diff --git a/src/lib/candid/serde/decode.ts b/src/lib/candid/serde/decode.ts index 398511da60..eaa6dfda53 100644 --- a/src/lib/candid/serde/decode.ts +++ b/src/lib/candid/serde/decode.ts @@ -1,7 +1,8 @@ import { IDL } from '@dfinity/candid'; import { CandidType, toIdl, toIdlArray } from '../../candid'; -import { AzleOpt, AzleTuple, AzleVec } from '../types/constructed'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import { AzleOpt, AzleTuple, AzleVec } from '../types/constructed'; // Used for links in comments import { DecodeVisitor } from './visitors/decode_visitor'; /** diff --git a/src/lib/candid/serde/encode.ts b/src/lib/candid/serde/encode.ts index 6d86d84242..1bb5857de4 100644 --- a/src/lib/candid/serde/encode.ts +++ b/src/lib/candid/serde/encode.ts @@ -1,7 +1,8 @@ import { IDL } from '@dfinity/candid'; import { CandidType, toIdl, toIdlArray } from '../../candid'; -import { AzleOpt, AzleTuple, AzleVec } from '../types/constructed'; +// eslint-disable-next-line @typescript-eslint/no-unused-vars +import { AzleOpt, AzleTuple, AzleVec } from '../types/constructed'; // Used for links in comments import { EncodeVisitor } from './visitors/encode_visitor'; /** diff --git a/src/lib/candid/type_mapping.ts b/src/lib/candid/type_mapping.ts index bb9f5c4bd0..fec00c18b1 100644 --- a/src/lib/candid/type_mapping.ts +++ b/src/lib/candid/type_mapping.ts @@ -18,7 +18,7 @@ import { AzleNat16, nat16 } from './types/primitive/nats/nat16'; import { AzleNat32, nat32 } from './types/primitive/nats/nat32'; import { AzleNat64, nat64 } from './types/primitive/nats/nat64'; import { AzleNull, Null } from './types/primitive/null'; -import { AzleReserved, reserved } from './types/primitive/reserved'; +import { AzleReserved } from './types/primitive/reserved'; import { AzleText } from './types/primitive/text'; import { AzleVoid } from './types/primitive/void'; import { Principal } from './types/reference/principal'; diff --git a/src/lib/candid/types/reference/func.ts b/src/lib/candid/types/reference/func.ts index 9d4f3d0c0e..00e4a653f9 100644 --- a/src/lib/candid/types/reference/func.ts +++ b/src/lib/candid/types/reference/func.ts @@ -1,6 +1,5 @@ import { IDL } from '@dfinity/candid'; -import { Serializable } from '../../../stable_structures/stable_b_tree_map'; import { CandidType, Parent, toIdlArray } from '../../index'; import { decode } from '../../serde/decode'; import { encode } from '../../serde/encode'; diff --git a/src/lib/ic/call_raw_128.ts b/src/lib/ic/call_raw_128.ts index 358bf9973d..46f996beda 100644 --- a/src/lib/ic/call_raw_128.ts +++ b/src/lib/ic/call_raw_128.ts @@ -1,7 +1,6 @@ import { v4 } from 'uuid'; import { Principal } from '../'; -import { encode } from '../candid/serde/encode'; import { blob } from '../candid/types/constructed/blob'; import { nat } from '../candid/types/primitive/nats/nat'; import { text } from '../candid/types/primitive/text'; diff --git a/src/lib/ic/clear_timer.ts b/src/lib/ic/clear_timer.ts index d7a5d54ca1..368afbd84d 100644 --- a/src/lib/ic/clear_timer.ts +++ b/src/lib/ic/clear_timer.ts @@ -1,4 +1,3 @@ -import { encode } from '../candid/serde/encode'; import { Void } from '../candid/types/primitive/void'; import { TimerId } from './types/timer_id'; diff --git a/src/lib/ic/set_timer.ts b/src/lib/ic/set_timer.ts index 5fac847f92..0ac3c2780a 100644 --- a/src/lib/ic/set_timer.ts +++ b/src/lib/ic/set_timer.ts @@ -1,8 +1,5 @@ import { v4 } from 'uuid'; -import { decode } from '../candid/serde/decode'; -import { encode } from '../candid/serde/encode'; -import { nat64 } from '../candid/types/primitive/nats/nat64'; import { Duration } from './types/duration'; import { TimerId } from './types/timer_id'; diff --git a/src/lib/ic/set_timer_interval.ts b/src/lib/ic/set_timer_interval.ts index 5ef541d91a..2446de83ba 100644 --- a/src/lib/ic/set_timer_interval.ts +++ b/src/lib/ic/set_timer_interval.ts @@ -1,8 +1,5 @@ import { v4 } from 'uuid'; -import { decode } from '../candid/serde/decode'; -import { encode } from '../candid/serde/encode'; -import { nat64 } from '../candid/types/primitive/nats/nat64'; import { Duration } from './types/duration'; import { TimerId } from './types/timer_id'; diff --git a/src/lib/ic/stable_64_read.ts b/src/lib/ic/stable_64_read.ts index c3d765f4ae..5a54c76784 100644 --- a/src/lib/ic/stable_64_read.ts +++ b/src/lib/ic/stable_64_read.ts @@ -1,4 +1,3 @@ -import { encode } from '../candid/serde/encode'; import { nat64 } from '../candid/types/primitive/nats/nat64'; /** @@ -13,8 +12,6 @@ export function stable64Read(offset: nat64, length: nat64): Uint8Array { return undefined as any; } - const paramsCandidBytes = encode([nat64, nat64], [offset, length]).buffer; - return new Uint8Array( globalThis._azleIc.stable64Read(offset.toString(), length.toString()) ); diff --git a/src/lib/ic/stable_read.ts b/src/lib/ic/stable_read.ts index fb4ebb3ebb..28e1a7d060 100644 --- a/src/lib/ic/stable_read.ts +++ b/src/lib/ic/stable_read.ts @@ -1,4 +1,3 @@ -import { encode } from '../candid/serde/encode'; import { nat32 } from '../candid/types/primitive/nats/nat32'; /** diff --git a/src/lib/ic/stable_size.ts b/src/lib/ic/stable_size.ts index 6816473b4c..0157145fc6 100644 --- a/src/lib/ic/stable_size.ts +++ b/src/lib/ic/stable_size.ts @@ -1,4 +1,3 @@ -import { decode } from '../candid/serde/decode'; import { nat32 } from '../candid/types/primitive/nats/nat32'; /** diff --git a/src/lib/ic/stable_write.ts b/src/lib/ic/stable_write.ts index 448f896614..e44d3548cd 100644 --- a/src/lib/ic/stable_write.ts +++ b/src/lib/ic/stable_write.ts @@ -1,4 +1,3 @@ -import { encode } from '../candid/serde/encode'; import { blob } from '../candid/types/constructed/blob'; import { nat32 } from '../candid/types/primitive/nats/nat32'; diff --git a/src/lib/server.ts b/src/lib/server.ts index d86e7c1ad3..cb4e4b99c1 100644 --- a/src/lib/server.ts +++ b/src/lib/server.ts @@ -240,7 +240,7 @@ export async function httpHandler( } } - end(data: any) { + end(_data: any) { const startIndex = this.responseData.indexOf(Buffer.from('\r\n\r\n')) + 4; diff --git a/src/lib/threshold_wallet/wallet.ts b/src/lib/threshold_wallet/wallet.ts index f168457da3..b6e4b55333 100644 --- a/src/lib/threshold_wallet/wallet.ts +++ b/src/lib/threshold_wallet/wallet.ts @@ -83,15 +83,15 @@ export class ThresholdWallet extends ethers.AbstractSigner { } // TODO implement? - async signMessage(message: string | Uint8Array): Promise { + async signMessage(_message: string | Uint8Array): Promise { throw new Error(`ThresholdWallet: signMessage is not implemented`); } // TODO implement? async signTypedData( - domain: ethers.TypedDataDomain, - types: Record, - value: Record + _domain: ethers.TypedDataDomain, + _types: Record, + _value: Record ): Promise { throw new Error(`ThresholdWallet: signTypedData is not implemented`); } From 5a10fa684b01bd563dcbe1cd7adf0b53e3e1bddf Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 4 Apr 2024 13:31:46 -0600 Subject: [PATCH 20/34] Resolve 3 no-var-requires problems --- package-lock.json | 7 +++++++ package.json | 5 +++-- src/compiler/utils/global_paths.ts | 3 ++- src/lib/globals.ts | 5 +++-- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index a4aeb797c6..45e32330bd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -35,6 +35,7 @@ "@types/deep-equal": "^1.0.4", "@types/fs-extra": "9.0.13", "@types/pako": "^2.0.3", + "@types/text-encoding": "^0.0.39", "@typescript-eslint/eslint-plugin": "^6.13.0", "@typescript-eslint/parser": "^6.13.0", "deep-equal": "^2.2.3", @@ -880,6 +881,12 @@ "integrity": "sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==", "dev": true }, + "node_modules/@types/text-encoding": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/text-encoding/-/text-encoding-0.0.39.tgz", + "integrity": "sha512-gRPvgL1aMgP6Pv92Rs310cJvVQ86DSF62E7K30g1FoGmmYWXoNuXT8PV835iAVeiAZkRwr2IW37KuyDn9ljmeA==", + "dev": true + }, "node_modules/@types/uuid": { "version": "9.0.5", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-9.0.5.tgz", diff --git a/package.json b/package.json index d45a07e9fa..6696eb00b2 100644 --- a/package.json +++ b/package.json @@ -48,10 +48,11 @@ "@types/deep-equal": "^1.0.4", "@types/fs-extra": "9.0.13", "@types/pako": "^2.0.3", - "deep-equal": "^2.2.3", - "deep-is": "^0.1.4", + "@types/text-encoding": "^0.0.39", "@typescript-eslint/eslint-plugin": "^6.13.0", "@typescript-eslint/parser": "^6.13.0", + "deep-equal": "^2.2.3", + "deep-is": "^0.1.4", "eslint": "^8.54.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-simple-import-sort": "^10.0.0", diff --git a/src/compiler/utils/global_paths.ts b/src/compiler/utils/global_paths.ts index ee55f2f049..82df684efd 100644 --- a/src/compiler/utils/global_paths.ts +++ b/src/compiler/utils/global_paths.ts @@ -1,6 +1,7 @@ +import { homedir } from 'os'; import { join, resolve } from 'path'; export const GLOBAL_AZLE_CONFIG_DIR = resolve( - require('os').homedir(), + homedir(), join('.config', 'azle') ); diff --git a/src/lib/globals.ts b/src/lib/globals.ts index 946468c589..081aca22b4 100644 --- a/src/lib/globals.ts +++ b/src/lib/globals.ts @@ -1,5 +1,6 @@ import { Buffer } from 'buffer'; import * as process from 'process'; +import { TextDecoder, TextEncoder } from 'text-encoding'; import { URL } from 'url'; import { v4 } from 'uuid'; @@ -66,8 +67,8 @@ if (globalThis._azleInsideCanister) { return originalSetTimeout(handler, 0); }; - globalThis.TextDecoder = require('text-encoding').TextDecoder; - globalThis.TextEncoder = require('text-encoding').TextEncoder; + globalThis.TextDecoder = TextDecoder; + globalThis.TextEncoder = TextEncoder; globalThis._azleIcTimers = {}; globalThis._azleResolveIds = {}; globalThis._azleRejectIds = {}; From 509b1e693066016f43f7a7dff13cd93f451942d2 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 4 Apr 2024 13:36:52 -0600 Subject: [PATCH 21/34] enable no-var rule --- .eslintrc.js | 1 - src/lib/globals.ts | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index c79f4c436f..d5ad92f2a3 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -13,7 +13,6 @@ const temporarilyDisabledRules = { '@typescript-eslint/no-var-requires': 'off', 'no-constant-condition': 'off', 'no-undef': 'off', - 'no-var': 'off', 'prefer-const': 'off' }; diff --git a/src/lib/globals.ts b/src/lib/globals.ts index 081aca22b4..3d1b9318d3 100644 --- a/src/lib/globals.ts +++ b/src/lib/globals.ts @@ -1,3 +1,4 @@ +/* eslint-disable no-var */ import { Buffer } from 'buffer'; import * as process from 'process'; import { TextDecoder, TextEncoder } from 'text-encoding'; From 35f3dacbb9deaaeda03d01bc329a5e1e9e3c67f3 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 4 Apr 2024 13:32:18 -0600 Subject: [PATCH 22/34] Count remaining problems --- .eslintrc.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index d5ad92f2a3..6403e92087 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,8 +1,8 @@ // TODO: These rules should be enabled, but we had offenses when we enabled ESLint. // This is tech-debt. We should go through and re-enable these at some point. const temporarilyDisabledRules = { - '@typescript-eslint/ban-ts-comment': 'off', - '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/ban-ts-comment': 'off', // 42 problems + '@typescript-eslint/no-explicit-any': 'off', // 537 problems '@typescript-eslint/no-unused-vars': [ 'off', { @@ -10,10 +10,10 @@ const temporarilyDisabledRules = { varsIgnorePattern: '^_' // Ignore local variables starting with _ } ], // 26 problems - '@typescript-eslint/no-var-requires': 'off', - 'no-constant-condition': 'off', - 'no-undef': 'off', - 'prefer-const': 'off' + '@typescript-eslint/no-var-requires': 'off', // 14 problems + 'no-constant-condition': 'off', // 1 problem + 'no-undef': 'off', // 79 problems + 'prefer-const': 'off' // 154 problems }; module.exports = { From cb71341ad3965439942720070238e5d3318cceb7 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 4 Apr 2024 16:42:30 -0600 Subject: [PATCH 23/34] Add func-style, array-callback-return, no-template-curly-in-string, and eqeqeq rules --- .eslintrc.js | 4 ++++ examples/motoko_examples/factorial/src/index.ts | 2 +- examples/tuple_types/test/tests.ts | 8 ++++---- property_tests/arbitraries/stable_b_tree_map_arb.ts | 2 +- .../tests/canister_methods/http_request/test/fletch.ts | 2 +- .../canister_methods/http_request_update/test/fletch.ts | 2 +- src/compiler/utils/get_canister_config.ts | 2 +- 7 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 6403e92087..ffd3b03ddc 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -46,6 +46,10 @@ module.exports = { rules: { 'simple-import-sort/exports': 'error', 'simple-import-sort/imports': 'error', + 'func-style': ['error', 'declaration', { allowArrowFunctions: true }], + 'array-callback-return': 'error', + 'no-template-curly-in-string': 'error', + eqeqeq: 'error', ...temporarilyDisabledRules } }; diff --git a/examples/motoko_examples/factorial/src/index.ts b/examples/motoko_examples/factorial/src/index.ts index e46971e6f2..9cc25a7930 100644 --- a/examples/motoko_examples/factorial/src/index.ts +++ b/examples/motoko_examples/factorial/src/index.ts @@ -9,7 +9,7 @@ export default Canister({ // We implement the recursion in a helper function. function go(m: nat): nat { - if (m == 0n) { + if (m === 0n) { return 1n; } else { return m * go(m - 1n); diff --git a/examples/tuple_types/test/tests.ts b/examples/tuple_types/test/tests.ts index 4cfc3aa227..fdf00257dc 100644 --- a/examples/tuple_types/test/tests.ts +++ b/examples/tuple_types/test/tests.ts @@ -479,10 +479,10 @@ export function getTests(tupleTypesCanister: ActorSubclass<_SERVICE>): Test[] { return { Ok: - result[1] == expectedResult[1] && - result[0][0] == expectedResult[0][0] && - result[0][1][0] == expectedResult[0][1][0] && - result[0][1][1] == expectedResult[0][1][1] + result[1] === expectedResult[1] && + result[0][0] === expectedResult[0][0] && + result[0][1][0] === expectedResult[0][1][0] && + result[0][1][1] === expectedResult[0][1][1] }; } } diff --git a/property_tests/arbitraries/stable_b_tree_map_arb.ts b/property_tests/arbitraries/stable_b_tree_map_arb.ts index 07723dd694..0833a1e622 100644 --- a/property_tests/arbitraries/stable_b_tree_map_arb.ts +++ b/property_tests/arbitraries/stable_b_tree_map_arb.ts @@ -67,7 +67,7 @@ function getSerializableArguments( ? 'stableJson' : keySample.src.candidTypeObject; const valueArgument = - valueSerializableType == 'STABLE_JSON' + valueSerializableType === 'STABLE_JSON' ? 'stableJson' : valueSample.src.candidTypeObject; diff --git a/property_tests/tests/canister_methods/http_request/test/fletch.ts b/property_tests/tests/canister_methods/http_request/test/fletch.ts index bfb9538c60..5b9983a850 100644 --- a/property_tests/tests/canister_methods/http_request/test/fletch.ts +++ b/property_tests/tests/canister_methods/http_request/test/fletch.ts @@ -18,7 +18,7 @@ export async function fletch( canisterName: string, request: HttpRequest ): Promise { - if (request.method === 'TRACE' || request.method == 'PATCH') { + if (request.method === 'TRACE' || request.method === 'PATCH') { return fletchSync(canisterName, request); } const canisterId = getCanisterId(canisterName); diff --git a/property_tests/tests/canister_methods/http_request_update/test/fletch.ts b/property_tests/tests/canister_methods/http_request_update/test/fletch.ts index bfb9538c60..5b9983a850 100644 --- a/property_tests/tests/canister_methods/http_request_update/test/fletch.ts +++ b/property_tests/tests/canister_methods/http_request_update/test/fletch.ts @@ -18,7 +18,7 @@ export async function fletch( canisterName: string, request: HttpRequest ): Promise { - if (request.method === 'TRACE' || request.method == 'PATCH') { + if (request.method === 'TRACE' || request.method === 'PATCH') { return fletchSync(canisterName, request); } const canisterId = getCanisterId(canisterName); diff --git a/src/compiler/utils/get_canister_config.ts b/src/compiler/utils/get_canister_config.ts index b94aedb8e1..28c0a03610 100644 --- a/src/compiler/utils/get_canister_config.ts +++ b/src/compiler/utils/get_canister_config.ts @@ -38,7 +38,7 @@ export function getCanisterConfig( ] .filter(([_, value]) => !value) .map(([field, _]) => field); - const fieldOrFields = missingFields.length == 1 ? 'field' : 'fields'; + const fieldOrFields = missingFields.length === 1 ? 'field' : 'fields'; const missingFieldNames = missingFields.join(', '); return Err({ error: `Missing ${fieldOrFields} ${missingFieldNames} in ./dfx.json`, From 0294d994b52ca318e8e5e560efdabe3ae8425cbc Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 4 Apr 2024 17:05:28 -0600 Subject: [PATCH 24/34] Add prefer template literal rule --- .eslintrc.js | 1 + canisters/ledger/address/index.ts | 2 +- .../src/canister_init_and_post_upgrade.ts | 16 ++++++++-------- .../src/server_init_and_post_upgrade.ts | 16 ++++++++-------- .../src/minimal_dapp_assets/src/index.js | 4 ++-- property_tests/visitors/cli-string-visitor.ts | 6 +++--- src/lib/candid/did_file/to_did_string.ts | 4 ++-- src/lib/candid/did_file/visitor/visit/func.ts | 2 +- src/lib/candid/did_file/visitor/visit/record.ts | 2 +- src/lib/candid/did_file/visitor/visit/variant.ts | 2 +- 10 files changed, 28 insertions(+), 27 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index ffd3b03ddc..22c1edcf2a 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -49,6 +49,7 @@ module.exports = { 'func-style': ['error', 'declaration', { allowArrowFunctions: true }], 'array-callback-return': 'error', 'no-template-curly-in-string': 'error', + 'prefer-template': 'error', eqeqeq: 'error', ...temporarilyDisabledRules } diff --git a/canisters/ledger/address/index.ts b/canisters/ledger/address/index.ts index c2675aacb7..e17c6c4fb5 100755 --- a/canisters/ledger/address/index.ts +++ b/canisters/ledger/address/index.ts @@ -74,6 +74,6 @@ function to32Bits(number: number): number[] { function toHexString(byteArray: Uint8Array): string { return Array.from(byteArray, (byte) => { - return ('0' + (byte & 0xff).toString(16)).slice(-2); + return `0${(byte & 0xff).toString(16)}`.slice(-2); }).join(''); } diff --git a/examples/hybrid_canister/src/canister_init_and_post_upgrade.ts b/examples/hybrid_canister/src/canister_init_and_post_upgrade.ts index 4daf8bf52a..099a89c8a8 100644 --- a/examples/hybrid_canister/src/canister_init_and_post_upgrade.ts +++ b/examples/hybrid_canister/src/canister_init_and_post_upgrade.ts @@ -19,22 +19,22 @@ let candidUpdateText = ''; export default Canister({ ...serverCanisterMethods(serverCallback), init: init([text, text, text, text], (param0, param1, param2, param3) => { - httpQueryText = param0 + '-init'; - httpUpdateText = param1 + '-init'; + httpQueryText = `${param0}-init`; + httpUpdateText = `${param1}-init`; - candidQueryText = param2 + '-init'; - candidUpdateText = param3 + '-init'; + candidQueryText = `${param2}-init`; + candidUpdateText = `${param3}-init`; setNodeServer(serverCallback()); }), postUpgrade: postUpgrade( [text, text, text, text], (param0, param1, param2, param3) => { - httpQueryText = param0 + '-postUpgrade'; - httpUpdateText = param1 + '-postUpgrade'; + httpQueryText = `${param0}-postUpgrade`; + httpUpdateText = `${param1}-postUpgrade`; - candidQueryText = param2 + '-postUpgrade'; - candidUpdateText = param3 + '-postUpgrade'; + candidQueryText = `${param2}-postUpgrade`; + candidUpdateText = `${param3}-postUpgrade`; setNodeServer(serverCallback()); } diff --git a/examples/hybrid_canister/src/server_init_and_post_upgrade.ts b/examples/hybrid_canister/src/server_init_and_post_upgrade.ts index a9a77fb1e2..c2cfbcfea5 100644 --- a/examples/hybrid_canister/src/server_init_and_post_upgrade.ts +++ b/examples/hybrid_canister/src/server_init_and_post_upgrade.ts @@ -17,22 +17,22 @@ let candidUpdateText = ''; export default Server(serverCallback, { init: init([text, text, text, text], (param0, param1, param2, param3) => { - httpQueryText = param0 + '-init'; - httpUpdateText = param1 + '-init'; + httpQueryText = `${param0}-init`; + httpUpdateText = `${param1}-init`; - candidQueryText = param2 + '-init'; - candidUpdateText = param3 + '-init'; + candidQueryText = `${param2}-init`; + candidUpdateText = `${param3}-init`; setNodeServer(serverCallback()); }), postUpgrade: postUpgrade( [text, text, text, text], (param0, param1, param2, param3) => { - httpQueryText = param0 + '-postUpgrade'; - httpUpdateText = param1 + '-postUpgrade'; + httpQueryText = `${param0}-postUpgrade`; + httpUpdateText = `${param1}-postUpgrade`; - candidQueryText = param2 + '-postUpgrade'; - candidUpdateText = param3 + '-postUpgrade'; + candidQueryText = `${param2}-postUpgrade`; + candidUpdateText = `${param3}-postUpgrade`; setNodeServer(serverCallback()); } diff --git a/examples/motoko_examples/minimal-counter-dapp/src/minimal_dapp_assets/src/index.js b/examples/motoko_examples/minimal-counter-dapp/src/minimal_dapp_assets/src/index.js index 2435884d33..e6424d7301 100644 --- a/examples/motoko_examples/minimal-counter-dapp/src/minimal_dapp_assets/src/index.js +++ b/examples/motoko_examples/minimal-counter-dapp/src/minimal_dapp_assets/src/index.js @@ -2,10 +2,10 @@ import { minimal_dapp } from '../../declarations/minimal_dapp'; document.addEventListener('DOMContentLoaded', async function () { const counter = await minimal_dapp.getCount(); - document.getElementById('counter').innerText = 'Counter: ' + counter; + document.getElementById('counter').innerText = `Counter: ${counter}`; }); document.getElementById('clickMeBtn').addEventListener('click', async () => { const counter = await minimal_dapp.count(); - document.getElementById('counter').innerText = 'Counter: ' + counter; + document.getElementById('counter').innerText = `Counter: ${counter}`; }); diff --git a/property_tests/visitors/cli-string-visitor.ts b/property_tests/visitors/cli-string-visitor.ts index 2aa55e3df9..1ea78152c2 100644 --- a/property_tests/visitors/cli-string-visitor.ts +++ b/property_tests/visitors/cli-string-visitor.ts @@ -17,7 +17,7 @@ export class CliStringVisitor extends IDL.Visitor { if (floatString.includes('.') || floatString.includes('e')) { return floatString; } - return floatString + '.0'; + return `${floatString}.0`; } visitText(_t: IDL.TextClass, data: VisitorData): string { return `"${escapeForBash(data.value)}"`; @@ -80,7 +80,7 @@ export class CliStringVisitor extends IDL.Visitor { } } } - throw new Error('Variant has no data: ' + data.value); + throw new Error(`Variant has no data: ${data.value}`); } visitVec( _t: IDL.VecClass, @@ -90,7 +90,7 @@ export class CliStringVisitor extends IDL.Visitor { const elements = data.value.map((e: any) => { return ty.accept(this, { value: e }); }); - return 'vec {' + elements.join('; ') + '}'; + return `vec {${elements.join('; ')}}`; } visitType(t: IDL.Type, data: VisitorData): string { return t.valueToString(data.value); diff --git a/src/lib/candid/did_file/to_did_string.ts b/src/lib/candid/did_file/to_did_string.ts index 8bb12a7e47..7ecafb9fd5 100644 --- a/src/lib/candid/did_file/to_did_string.ts +++ b/src/lib/candid/did_file/to_did_string.ts @@ -10,12 +10,12 @@ export function toDidString(result: VisitorResult): string { const [candid, candidTypeDefs] = result; const candidTypesString = namedTypeToCandidString(candidTypeDefs); - return candidTypesString + candid + '\n'; + return `${candidTypesString + candid}\n`; } function namedTypeToCandidString(newTypes: CandidTypesDefs): string { return Object.entries(newTypes).length > 0 - ? namedTypesToStingArr(newTypes).join('\n') + '\n' + ? `${namedTypesToStingArr(newTypes).join('\n')}\n` : ''; } diff --git a/src/lib/candid/did_file/visitor/visit/func.ts b/src/lib/candid/did_file/visitor/visit/func.ts index b0e86a1109..1dbb83d403 100644 --- a/src/lib/candid/did_file/visitor/visit/func.ts +++ b/src/lib/candid/did_file/visitor/visit/func.ts @@ -19,7 +19,7 @@ export function visitFunc( const args = candidArgs[0].join(', '); const rets = candidRets[0].join(', '); const annon = - t.annotations.length === 0 ? '' : ' ' + t.annotations.join(' '); + t.annotations.length === 0 ? '' : ` ${t.annotations.join(' ')}`; return [ `${data.isOnService ? '' : 'func '}(${args}) -> (${rets})${annon}`, { ...candidArgs[1], ...candidRets[1] } diff --git a/src/lib/candid/did_file/visitor/visit/record.ts b/src/lib/candid/did_file/visitor/visit/record.ts index 7a3f558295..368d5963a4 100644 --- a/src/lib/candid/did_file/visitor/visit/record.ts +++ b/src/lib/candid/did_file/visitor/visit/record.ts @@ -15,7 +15,7 @@ export function visitRecord( const candid = extractCandid(candidFields); const field_strings = fields.map( ([key, _value], index) => - escapeCandidKeywords(key) + ':' + candid[0][index] + `${escapeCandidKeywords(key)}:${candid[0][index]}` ); return [`record {${field_strings.join('; ')}}`, candid[1]]; } diff --git a/src/lib/candid/did_file/visitor/visit/variant.ts b/src/lib/candid/did_file/visitor/visit/variant.ts index e623f47258..6098b63ab6 100644 --- a/src/lib/candid/did_file/visitor/visit/variant.ts +++ b/src/lib/candid/did_file/visitor/visit/variant.ts @@ -16,7 +16,7 @@ export function visitVariant( const fields_string = fields.map( ([key, value], index) => escapeCandidKeywords(key) + - (value.name === 'null' ? '' : ':' + candid[0][index]) + (value.name === 'null' ? '' : `:${candid[0][index]}`) ); return [`variant {${fields_string.join('; ')}}`, candid[1]]; } From 3f782edaf3fb1b8b47a9a93312751c3cdca8f01f Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 4 Apr 2024 21:11:43 -0600 Subject: [PATCH 25/34] type fixes --- src/compiler/file_uploader/expand_paths.ts | 4 ++-- src/lib/candid/serde/decode.ts | 4 ++-- src/lib/candid/serde/encode.ts | 4 ++-- src/lib/canister_methods/execute_method.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/compiler/file_uploader/expand_paths.ts b/src/compiler/file_uploader/expand_paths.ts index 3eeaa60441..bf24dc0fa5 100644 --- a/src/compiler/file_uploader/expand_paths.ts +++ b/src/compiler/file_uploader/expand_paths.ts @@ -40,7 +40,7 @@ async function expandDirectory( }, Promise.resolve([]) ); - } catch (error) { - throw new Error(`Error reading directory: ${error}`); + } catch (error: any) { + throw new Error(`Error reading directory: ${error.message}`); } } diff --git a/src/lib/candid/serde/decode.ts b/src/lib/candid/serde/decode.ts index eaa6dfda53..a4cc4fb3d8 100644 --- a/src/lib/candid/serde/decode.ts +++ b/src/lib/candid/serde/decode.ts @@ -17,10 +17,10 @@ import { DecodeVisitor } from './visitors/decode_visitor'; * @param candidType either a built-in IDL data type, or an Azle-defined super-type * @returns the Azle representation of the data */ -export function decode( +export function decode( candidType: CandidType | CandidType[], data: ArrayBuffer -): any | any[] { +): T | T[] { if (Array.isArray(candidType)) { return decodeMultiple(candidType, data); } diff --git a/src/lib/candid/serde/encode.ts b/src/lib/candid/serde/encode.ts index 1bb5857de4..74a759be4f 100644 --- a/src/lib/candid/serde/encode.ts +++ b/src/lib/candid/serde/encode.ts @@ -17,9 +17,9 @@ import { EncodeVisitor } from './visitors/encode_visitor'; * @param candidType either a built-in IDL data type, or an Azle-defined super-type * @returns candid bytes */ -export function encode( +export function encode( candidType: CandidType | CandidType[], - data: any | any[] + data: T | T[] ): Uint8Array { if (Array.isArray(candidType)) { if (Array.isArray(data)) { diff --git a/src/lib/canister_methods/execute_method.ts b/src/lib/canister_methods/execute_method.ts index 9743b33ece..0fe26ce61a 100644 --- a/src/lib/canister_methods/execute_method.ts +++ b/src/lib/canister_methods/execute_method.ts @@ -13,7 +13,7 @@ export function executeMethod( returnCandidType: CandidType, manual: boolean ) { - const decodedArgs = decode(paramCandidTypes, args[0]); + const decodedArgs = decode(paramCandidTypes, args[0]); const result = getResult(decodedArgs, callback); From e02e1e8fba8f3d0bc4ea93a8db74f5a4089628a2 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 4 Apr 2024 21:41:57 -0600 Subject: [PATCH 26/34] add no-param-reassign, prefer-for-of, prefer-arrow-callback, and no-var rules --- .eslintrc.js | 4 ++++ .../minimal-counter-dapp/src/minimal_dapp_assets/src/index.js | 2 +- src/lib/globals.ts | 4 +--- test/index.ts | 4 +--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 22c1edcf2a..d1ba80edfc 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -50,6 +50,10 @@ module.exports = { 'array-callback-return': 'error', 'no-template-curly-in-string': 'error', 'prefer-template': 'error', + 'no-param-reassign': 'error', + '@typescript-eslint/prefer-for-of': 'error', + 'prefer-arrow-callback': 'error', + 'no-var': 'error', eqeqeq: 'error', ...temporarilyDisabledRules } diff --git a/examples/motoko_examples/minimal-counter-dapp/src/minimal_dapp_assets/src/index.js b/examples/motoko_examples/minimal-counter-dapp/src/minimal_dapp_assets/src/index.js index e6424d7301..b8a7fe9ce7 100644 --- a/examples/motoko_examples/minimal-counter-dapp/src/minimal_dapp_assets/src/index.js +++ b/examples/motoko_examples/minimal-counter-dapp/src/minimal_dapp_assets/src/index.js @@ -1,6 +1,6 @@ import { minimal_dapp } from '../../declarations/minimal_dapp'; -document.addEventListener('DOMContentLoaded', async function () { +document.addEventListener('DOMContentLoaded', async () => { const counter = await minimal_dapp.getCount(); document.getElementById('counter').innerText = `Counter: ${counter}`; }); diff --git a/src/lib/globals.ts b/src/lib/globals.ts index 3d1b9318d3..631e0fb364 100644 --- a/src/lib/globals.ts +++ b/src/lib/globals.ts @@ -114,9 +114,7 @@ if (globalThis._azleInsideCanister) { instantiatedSource.instance.exports ); - for (let i = 0; i < exportEntries.length; i++) { - const [key, value] = exportEntries[i]; - + for (const [key, value] of exportEntries) { if (typeof value === 'function') { instantiatedSource.instance.exports[key] = value.bind({ instanceUuid: uuid, diff --git a/test/index.ts b/test/index.ts index 967238034b..a35dbf1761 100644 --- a/test/index.ts +++ b/test/index.ts @@ -34,9 +34,7 @@ export async function runTests( tests: Test[], exitProcess: boolean = true ): Promise { - for (let i = 0; i < tests.length; i++) { - const test = tests[i]; - + for (const test of tests) { try { if (test.skip === true) { console.log(`Skipping: ${test.name}`); From 6028abb7b216946627a21e81563b47acfc94c1b6 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 10 Apr 2024 14:56:07 -0600 Subject: [PATCH 27/34] pr_fixes --- http_client/fetch_ic/actor.ts | 4 ++-- src/lib/candid/serde/decode.ts | 2 +- src/lib/candid/serde/encode.ts | 2 +- src/lib/canister_methods/execute_method.ts | 2 +- src/lib/globals.ts | 15 ++++++++++++++- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/http_client/fetch_ic/actor.ts b/http_client/fetch_ic/actor.ts index a4c1e5d382..938ddfe17e 100644 --- a/http_client/fetch_ic/actor.ts +++ b/http_client/fetch_ic/actor.ts @@ -94,7 +94,7 @@ export interface _SERVICE { | [ { Callback: { - token: unknown; // TODO I am not sure if unknown is the right option here. Maybe `object`? + token: Uint8Array | number[]; callback: [Principal, string]; }; } @@ -120,7 +120,7 @@ export interface _SERVICE { | [ { Callback: { - token: unknown; + token: Uint8Array | number[]; callback: [Principal, string]; }; } diff --git a/src/lib/candid/serde/decode.ts b/src/lib/candid/serde/decode.ts index a4cc4fb3d8..df7dbba976 100644 --- a/src/lib/candid/serde/decode.ts +++ b/src/lib/candid/serde/decode.ts @@ -17,7 +17,7 @@ import { DecodeVisitor } from './visitors/decode_visitor'; * @param candidType either a built-in IDL data type, or an Azle-defined super-type * @returns the Azle representation of the data */ -export function decode( +export function decode( candidType: CandidType | CandidType[], data: ArrayBuffer ): T | T[] { diff --git a/src/lib/candid/serde/encode.ts b/src/lib/candid/serde/encode.ts index 74a759be4f..fdbdb12afe 100644 --- a/src/lib/candid/serde/encode.ts +++ b/src/lib/candid/serde/encode.ts @@ -17,7 +17,7 @@ import { EncodeVisitor } from './visitors/encode_visitor'; * @param candidType either a built-in IDL data type, or an Azle-defined super-type * @returns candid bytes */ -export function encode( +export function encode( candidType: CandidType | CandidType[], data: T | T[] ): Uint8Array { diff --git a/src/lib/canister_methods/execute_method.ts b/src/lib/canister_methods/execute_method.ts index 0fe26ce61a..9743b33ece 100644 --- a/src/lib/canister_methods/execute_method.ts +++ b/src/lib/canister_methods/execute_method.ts @@ -13,7 +13,7 @@ export function executeMethod( returnCandidType: CandidType, manual: boolean ) { - const decodedArgs = decode(paramCandidTypes, args[0]); + const decodedArgs = decode(paramCandidTypes, args[0]); const result = getResult(decodedArgs, callback); diff --git a/src/lib/globals.ts b/src/lib/globals.ts index 631e0fb364..539d955e95 100644 --- a/src/lib/globals.ts +++ b/src/lib/globals.ts @@ -1,4 +1,3 @@ -/* eslint-disable no-var */ import { Buffer } from 'buffer'; import * as process from 'process'; import { TextDecoder, TextEncoder } from 'text-encoding'; @@ -11,19 +10,33 @@ import { AzleIc } from './ic/types/azle_ic'; import { jsonReplacer } from './stable_structures/stable_json'; declare global { + // eslint-disable-next-line no-var var _azleInsideCanister: boolean; + // eslint-disable-next-line no-var var _azleWasmtimeCandidEnvironment: boolean; + // eslint-disable-next-line no-var var _azleIc: AzleIc | undefined; + // eslint-disable-next-line no-var var _azleResolveIds: { [key: string]: (buf: ArrayBuffer) => void }; + // eslint-disable-next-line no-var var _azleRejectIds: { [key: string]: (err: any) => void }; + // eslint-disable-next-line no-var var _azleIcTimers: { [key: string]: string }; + // eslint-disable-next-line no-var var _azleTimerCallbacks: { [key: string]: () => void }; + // eslint-disable-next-line no-var var _azleGuardFunctions: { [key: string]: () => any }; + // eslint-disable-next-line no-var var _azleWebAssembly: any; + // eslint-disable-next-line no-var var _azleOutgoingHttpOptionsSubnetSize: number | undefined; + // eslint-disable-next-line no-var var _azleOutgoingHttpOptionsMaxResponseBytes: bigint | undefined; + // eslint-disable-next-line no-var var _azleOutgoingHttpOptionsCycles: bigint | undefined; + // eslint-disable-next-line no-var var _azleOutgoingHttpOptionsTransformMethodName: string | undefined; + // eslint-disable-next-line no-var var _azleOutgoingHttpOptionsTransformContext: Uint8Array | undefined; } From 2a21a51c5e244673a9fd7502edb7aae31f8535ee Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 10 Apr 2024 15:30:07 -0600 Subject: [PATCH 28/34] Restore no-unused-vars and no-constant-condition rules --- .eslintrc.js | 15 +++++++-------- examples/basic_bitcoin/src/bitcoin_wallet.ts | 1 + .../canisters/azle/data_types/blob/index.ts | 2 +- .../canisters/azle/data_types/boolean/index.ts | 2 +- .../canisters/azle/data_types/float/float32.ts | 2 +- .../canisters/azle/data_types/float/float64.ts | 2 +- .../canisters/azle/data_types/int/int.ts | 2 +- .../canisters/azle/data_types/int/int16.ts | 2 +- .../canisters/azle/data_types/int/int32.ts | 2 +- .../canisters/azle/data_types/int/int64.ts | 2 +- .../canisters/azle/data_types/int/int8.ts | 2 +- .../canisters/azle/data_types/nat/nat.ts | 2 +- .../canisters/azle/data_types/nat/nat16.ts | 2 +- .../canisters/azle/data_types/nat/nat32.ts | 2 +- .../canisters/azle/data_types/nat/nat64.ts | 2 +- .../canisters/azle/data_types/nat/nat8.ts | 2 +- .../canisters/azle/data_types/null/index.ts | 2 +- .../canisters/azle/data_types/opt/index.ts | 2 +- .../canisters/azle/data_types/principal/index.ts | 2 +- .../canisters/azle/data_types/record/index.ts | 2 +- .../canisters/azle/data_types/text/index.ts | 2 +- .../canisters/azle/data_types/variant/index.ts | 2 +- .../canisters/azle/data_types/vec/index.ts | 4 ++-- examples/tfjs/src/api.ts | 1 + .../candid/candid_value_and_meta_arb.ts | 2 +- .../candid/reference/func_arb/index.ts | 5 +---- src/lib/candid/manual.ts | 4 ++++ .../types/canister_method_info.ts | 4 ++++ 28 files changed, 41 insertions(+), 35 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index d1ba80edfc..1291a44b5c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,15 +3,7 @@ const temporarilyDisabledRules = { '@typescript-eslint/ban-ts-comment': 'off', // 42 problems '@typescript-eslint/no-explicit-any': 'off', // 537 problems - '@typescript-eslint/no-unused-vars': [ - 'off', - { - argsIgnorePattern: '^_', // Ignore argument variables starting with _ - varsIgnorePattern: '^_' // Ignore local variables starting with _ - } - ], // 26 problems '@typescript-eslint/no-var-requires': 'off', // 14 problems - 'no-constant-condition': 'off', // 1 problem 'no-undef': 'off', // 79 problems 'prefer-const': 'off' // 154 problems }; @@ -55,6 +47,13 @@ module.exports = { 'prefer-arrow-callback': 'error', 'no-var': 'error', eqeqeq: 'error', + '@typescript-eslint/no-unused-vars': [ + 'error', + { + argsIgnorePattern: '^_', // Ignore argument variables starting with _ + varsIgnorePattern: '^_' // Ignore local variables starting with _ + } + ], ...temporarilyDisabledRules } }; diff --git a/examples/basic_bitcoin/src/bitcoin_wallet.ts b/examples/basic_bitcoin/src/bitcoin_wallet.ts index 4a0658c29f..65d7d9bc28 100644 --- a/examples/basic_bitcoin/src/bitcoin_wallet.ts +++ b/examples/basic_bitcoin/src/bitcoin_wallet.ts @@ -137,6 +137,7 @@ async function buildTransaction( // rebuild the transaction, until the fee is set to the correct amount. console.log('Building transaction...'); let totalFee = 0n; + // eslint-disable-next-line no-constant-condition while (true) { const transaction = match( buildTransactionWithFee( diff --git a/examples/primitive_ops/canisters/azle/data_types/blob/index.ts b/examples/primitive_ops/canisters/azle/data_types/blob/index.ts index 9465aec6fc..a0c057c4c7 100644 --- a/examples/primitive_ops/canisters/azle/data_types/blob/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/blob/index.ts @@ -10,7 +10,7 @@ export const blob_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: blob = + let _value: blob = i % 2 === 0 ? Uint8Array.from([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) : Uint8Array.from([]); diff --git a/examples/primitive_ops/canisters/azle/data_types/boolean/index.ts b/examples/primitive_ops/canisters/azle/data_types/boolean/index.ts index 71cff9ebd8..d091946935 100644 --- a/examples/primitive_ops/canisters/azle/data_types/boolean/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/boolean/index.ts @@ -10,7 +10,7 @@ export const boolean_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value = i % 2 === 0 ? true : false; + let _value = i % 2 === 0 ? true : false; // TODO std::convert::identity(value); consider something like Rust to ensure the value assignment above is never optimized away i += 1; } diff --git a/examples/primitive_ops/canisters/azle/data_types/float/float32.ts b/examples/primitive_ops/canisters/azle/data_types/float/float32.ts index c25c160821..a80026e5a4 100644 --- a/examples/primitive_ops/canisters/azle/data_types/float/float32.ts +++ b/examples/primitive_ops/canisters/azle/data_types/float/float32.ts @@ -10,7 +10,7 @@ export const float32_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value = i % 2 === 0 ? Math.PI : Math.E; + let _value = i % 2 === 0 ? Math.PI : Math.E; // TODO std::convert::identity(value); consider something like Rust to ensure the value assignment above is never optimized away i += 1; } diff --git a/examples/primitive_ops/canisters/azle/data_types/float/float64.ts b/examples/primitive_ops/canisters/azle/data_types/float/float64.ts index 4b72564d69..738edde0c1 100644 --- a/examples/primitive_ops/canisters/azle/data_types/float/float64.ts +++ b/examples/primitive_ops/canisters/azle/data_types/float/float64.ts @@ -10,7 +10,7 @@ export const float64_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value = i % 2 === 0 ? Math.PI : Math.E; + let _value = i % 2 === 0 ? Math.PI : Math.E; // TODO std::convert::identity(value); consider something like Rust to ensure the value assignment above is never optimized away i += 1; } diff --git a/examples/primitive_ops/canisters/azle/data_types/int/int.ts b/examples/primitive_ops/canisters/azle/data_types/int/int.ts index 718eedc3d2..ce8555f7a1 100644 --- a/examples/primitive_ops/canisters/azle/data_types/int/int.ts +++ b/examples/primitive_ops/canisters/azle/data_types/int/int.ts @@ -10,7 +10,7 @@ export const int_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: int = + let _value: int = i % 2 === 0 ? 170_141_183_460_469_231_731_687_303_715_884_105_727n : 0n; diff --git a/examples/primitive_ops/canisters/azle/data_types/int/int16.ts b/examples/primitive_ops/canisters/azle/data_types/int/int16.ts index f37265cb91..5906086c82 100644 --- a/examples/primitive_ops/canisters/azle/data_types/int/int16.ts +++ b/examples/primitive_ops/canisters/azle/data_types/int/int16.ts @@ -10,7 +10,7 @@ export const int16_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: int16 = i % 2 === 0 ? 32_767 : 0; + let _value: int16 = i % 2 === 0 ? 32_767 : 0; // TODO std::convert::identity(value); consider something like Rust to ensure the value assignment above is never optimized away i += 1; } diff --git a/examples/primitive_ops/canisters/azle/data_types/int/int32.ts b/examples/primitive_ops/canisters/azle/data_types/int/int32.ts index bade6c3ebb..c2d27fec5e 100644 --- a/examples/primitive_ops/canisters/azle/data_types/int/int32.ts +++ b/examples/primitive_ops/canisters/azle/data_types/int/int32.ts @@ -10,7 +10,7 @@ export const int32_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: int32 = i % 2 === 0 ? 2_147_483_647 : 0; + let _value: int32 = i % 2 === 0 ? 2_147_483_647 : 0; // TODO std::convert::identity(value); consider something like Rust to ensure the value assignment above is never optimized away i += 1; } diff --git a/examples/primitive_ops/canisters/azle/data_types/int/int64.ts b/examples/primitive_ops/canisters/azle/data_types/int/int64.ts index 112bcbb65d..e120db6cf1 100644 --- a/examples/primitive_ops/canisters/azle/data_types/int/int64.ts +++ b/examples/primitive_ops/canisters/azle/data_types/int/int64.ts @@ -10,7 +10,7 @@ export const int64_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: int64 = i % 2 === 0 ? 9_223_372_036_854_775_807n : 0n; + let _value: int64 = i % 2 === 0 ? 9_223_372_036_854_775_807n : 0n; // TODO std::convert::identity(value); consider something like Rust to ensure the value assignment above is never optimized away i += 1; } diff --git a/examples/primitive_ops/canisters/azle/data_types/int/int8.ts b/examples/primitive_ops/canisters/azle/data_types/int/int8.ts index 4e9b927f5d..0b87cc076d 100644 --- a/examples/primitive_ops/canisters/azle/data_types/int/int8.ts +++ b/examples/primitive_ops/canisters/azle/data_types/int/int8.ts @@ -10,7 +10,7 @@ export const int8_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: int8 = i % 2 === 0 ? 127 : 0; + let _value: int8 = i % 2 === 0 ? 127 : 0; // TODO std::convert::identity(value); consider something like Rust to ensure the value assignment above is never optimized away i += 1; } diff --git a/examples/primitive_ops/canisters/azle/data_types/nat/nat.ts b/examples/primitive_ops/canisters/azle/data_types/nat/nat.ts index dc8d315712..74f4193e87 100644 --- a/examples/primitive_ops/canisters/azle/data_types/nat/nat.ts +++ b/examples/primitive_ops/canisters/azle/data_types/nat/nat.ts @@ -10,7 +10,7 @@ export const nat_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: nat = + let _value: nat = i % 2 === 0 ? 340_282_366_920_938_463_463_374_607_431_768_211_455n : 0n; diff --git a/examples/primitive_ops/canisters/azle/data_types/nat/nat16.ts b/examples/primitive_ops/canisters/azle/data_types/nat/nat16.ts index 8d0482af14..0f0f4b407c 100644 --- a/examples/primitive_ops/canisters/azle/data_types/nat/nat16.ts +++ b/examples/primitive_ops/canisters/azle/data_types/nat/nat16.ts @@ -10,7 +10,7 @@ export const nat16_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: nat16 = i % 2 === 0 ? 65_535 : 0; + let _value: nat16 = i % 2 === 0 ? 65_535 : 0; // TODO std::convert::identity(value); consider something like Rust to ensure the value assignment above is never optimized away i += 1; } diff --git a/examples/primitive_ops/canisters/azle/data_types/nat/nat32.ts b/examples/primitive_ops/canisters/azle/data_types/nat/nat32.ts index 181a31f60d..de8b566a5e 100644 --- a/examples/primitive_ops/canisters/azle/data_types/nat/nat32.ts +++ b/examples/primitive_ops/canisters/azle/data_types/nat/nat32.ts @@ -10,7 +10,7 @@ export const nat32_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: nat32 = i % 2 === 0 ? 4_294_967_295 : 0; + let _value: nat32 = i % 2 === 0 ? 4_294_967_295 : 0; // TODO std::convert::identity(value); consider something like Rust to ensure the value assignment above is never optimized away i += 1; } diff --git a/examples/primitive_ops/canisters/azle/data_types/nat/nat64.ts b/examples/primitive_ops/canisters/azle/data_types/nat/nat64.ts index 0b3873a877..b3ec955e31 100644 --- a/examples/primitive_ops/canisters/azle/data_types/nat/nat64.ts +++ b/examples/primitive_ops/canisters/azle/data_types/nat/nat64.ts @@ -10,7 +10,7 @@ export const nat64_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: nat64 = i % 2 === 0 ? 18_446_744_073_709_551_615n : 0n; + let _value: nat64 = i % 2 === 0 ? 18_446_744_073_709_551_615n : 0n; // TODO std::convert::identity(value); consider something like Rust to ensure the value assignment above is never optimized away i += 1; } diff --git a/examples/primitive_ops/canisters/azle/data_types/nat/nat8.ts b/examples/primitive_ops/canisters/azle/data_types/nat/nat8.ts index 0669b82ba5..ca745aeafe 100644 --- a/examples/primitive_ops/canisters/azle/data_types/nat/nat8.ts +++ b/examples/primitive_ops/canisters/azle/data_types/nat/nat8.ts @@ -10,7 +10,7 @@ export const nat8_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: nat8 = i % 2 === 0 ? 255 : 0; + let _value: nat8 = i % 2 === 0 ? 255 : 0; // TODO std::convert::identity(value); consider something like Rust to ensure the value assignment above is never optimized away i += 1; } diff --git a/examples/primitive_ops/canisters/azle/data_types/null/index.ts b/examples/primitive_ops/canisters/azle/data_types/null/index.ts index 7232157dab..a31b5d3eb3 100644 --- a/examples/primitive_ops/canisters/azle/data_types/null/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/null/index.ts @@ -10,7 +10,7 @@ export const null_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: null = i % 2 === 0 ? null : null; + let _value: null = i % 2 === 0 ? null : null; // TODO std::convert::identity(value); consider something like Rust to ensure the value assignment above is never optimized away i += 1; } diff --git a/examples/primitive_ops/canisters/azle/data_types/opt/index.ts b/examples/primitive_ops/canisters/azle/data_types/opt/index.ts index 6d9c6a2e20..012bcc61f8 100644 --- a/examples/primitive_ops/canisters/azle/data_types/opt/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/opt/index.ts @@ -10,7 +10,7 @@ export const opt_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: Opt = i % 2 === 0 ? Some(true) : None; + let _value: Opt = i % 2 === 0 ? Some(true) : None; // TODO std::convert::identity(value); consider something like Rust to ensure the value assignment above is never optimized away i += 1; } diff --git a/examples/primitive_ops/canisters/azle/data_types/principal/index.ts b/examples/primitive_ops/canisters/azle/data_types/principal/index.ts index 5551fb54ac..17eb74c2d0 100644 --- a/examples/primitive_ops/canisters/azle/data_types/principal/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/principal/index.ts @@ -10,7 +10,7 @@ export const principal_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: Principal = + let _value: Principal = i % 2 === 0 ? Principal.fromText('rrkah-fqaaa-aaaaa-aaaaq-cai') : Principal.fromText('aaaaa-aa'); diff --git a/examples/primitive_ops/canisters/azle/data_types/record/index.ts b/examples/primitive_ops/canisters/azle/data_types/record/index.ts index 6ddfcb4b68..37eb004056 100644 --- a/examples/primitive_ops/canisters/azle/data_types/record/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/record/index.ts @@ -19,7 +19,7 @@ export const record_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: User = + let _value: User = i % 2 === 0 ? { principal: Principal.fromText( diff --git a/examples/primitive_ops/canisters/azle/data_types/text/index.ts b/examples/primitive_ops/canisters/azle/data_types/text/index.ts index 36ce13f533..465c7d495e 100644 --- a/examples/primitive_ops/canisters/azle/data_types/text/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/text/index.ts @@ -10,7 +10,7 @@ export const text_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: string = i % 2 === 0 ? 'hello' : ''; + let _value: string = i % 2 === 0 ? 'hello' : ''; // TODO std::convert::identity(value); consider something like Rust to ensure the value assignment above is never optimized away i += 1; } diff --git a/examples/primitive_ops/canisters/azle/data_types/variant/index.ts b/examples/primitive_ops/canisters/azle/data_types/variant/index.ts index b858aca388..e6d5ccbc02 100644 --- a/examples/primitive_ops/canisters/azle/data_types/variant/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/variant/index.ts @@ -18,7 +18,7 @@ export const variant_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: Reaction = + let _value: Reaction = i % 2 === 0 ? { ThumbsUp: 2 diff --git a/examples/primitive_ops/canisters/azle/data_types/vec/index.ts b/examples/primitive_ops/canisters/azle/data_types/vec/index.ts index ab15b11a5d..82bcaa5caa 100644 --- a/examples/primitive_ops/canisters/azle/data_types/vec/index.ts +++ b/examples/primitive_ops/canisters/azle/data_types/vec/index.ts @@ -10,8 +10,8 @@ export const vec_init_stack = update([nat32], PerfResult, (num_inits) => { let i = 0; while (i < num_inits) { - let value: nat32[] = i % 2 === 0 ? [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] : []; - // TODO std::convert::identity(value); consider something like Rust to ensure the value assignment above is never optimized away + let _value: nat32[] = i % 2 === 0 ? [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] : []; + // TODO std::convert::identity(_value); consider something like Rust to ensure the value assignment above is never optimized away i += 1; } diff --git a/examples/tfjs/src/api.ts b/examples/tfjs/src/api.ts index 36f3347596..b0871c352c 100644 --- a/examples/tfjs/src/api.ts +++ b/examples/tfjs/src/api.ts @@ -25,6 +25,7 @@ async function init() { app.get('/prediction', async (_req, res) => { // TODO Tokenization and prediction for this specific model have not yet been figured out // const prediction = model.predict(tf.tensor([])); + console.info(model); res.send('Prediction not yet implemented'); }); diff --git a/property_tests/arbitraries/candid/candid_value_and_meta_arb.ts b/property_tests/arbitraries/candid/candid_value_and_meta_arb.ts index 310f5cc37f..8c8a458286 100644 --- a/property_tests/arbitraries/candid/candid_value_and_meta_arb.ts +++ b/property_tests/arbitraries/candid/candid_value_and_meta_arb.ts @@ -71,7 +71,7 @@ export function CandidValueAndMetaArb( BoolArb(), NullArb(), TextArb(constraints), - FuncArb(constraints), + FuncArb(), PrincipalArb() ); } diff --git a/property_tests/arbitraries/candid/reference/func_arb/index.ts b/property_tests/arbitraries/candid/reference/func_arb/index.ts index 58ad5d7734..8e31469d8d 100644 --- a/property_tests/arbitraries/candid/reference/func_arb/index.ts +++ b/property_tests/arbitraries/candid/reference/func_arb/index.ts @@ -4,15 +4,12 @@ import fc from 'fast-check'; import { candidDefinitionArb } from '../../candid_definition_arb'; import { CandidValueAndMeta } from '../../candid_value_and_meta_arb'; import { CandidValueAndMetaArbGenerator } from '../../candid_value_and_meta_arb_generator'; -import { CandidValueConstraints } from '../../candid_values_arb'; import { FuncDefinitionArb } from './definition_arb'; import { FuncValueArb } from './values_arb'; export type Func = [Principal, string]; -export function FuncArb( - constraints?: CandidValueConstraints -): fc.Arbitrary> { +export function FuncArb(): fc.Arbitrary> { return CandidValueAndMetaArbGenerator( FuncDefinitionArb(candidDefinitionArb({})), FuncValueArb diff --git a/src/lib/candid/manual.ts b/src/lib/candid/manual.ts index 60f5a992c0..f297b5b22b 100644 --- a/src/lib/candid/manual.ts +++ b/src/lib/candid/manual.ts @@ -5,4 +5,8 @@ export function Manual(candidType: CandidType): typeof AzleVoid { return candidType as unknown as typeof AzleVoid; } +// To achieve the developer facing type inference API we often introduce type +// parameters that are used by the consumer of the function but not by the +// function itself +// eslint-disable-next-line @typescript-eslint/no-unused-vars export type Manual = void; diff --git a/src/lib/canister_methods/types/canister_method_info.ts b/src/lib/canister_methods/types/canister_method_info.ts index c08cc77283..7ceb9492ab 100644 --- a/src/lib/canister_methods/types/canister_method_info.ts +++ b/src/lib/canister_methods/types/canister_method_info.ts @@ -1,3 +1,7 @@ +// To achieve the developer facing type inference API we often introduce type +// parameters that are used by the consumer of the function but not by the +// function itself +// eslint-disable-next-line @typescript-eslint/no-unused-vars export type CanisterMethodInfo, K> = { mode: | 'query' From 69a38f6e74b3e0648a6551b75b208ea8eeda6f9f Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 10 Apr 2024 15:50:56 -0600 Subject: [PATCH 29/34] Restore no-var-requires rule --- .eslintignore | 1 + .eslintrc.js | 1 - bin.js | 1 + external_module.d.ts | 3 +++ property_tests/get_actor.ts | 1 + scripts/add_metadata_to_dfx_json.js | 2 ++ scripts/file_generator/bin.js | 1 + scripts/hash_file/bin.js | 1 + scripts/reorder_dfx_json.js | 2 ++ scripts/simplify_tsconfig.js | 2 ++ scripts/update_dfx_json_main.js | 2 ++ src/compiler/file_watcher/file_watcher_loader.js | 1 + src/lib/server.ts | 3 +-- 13 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 external_module.d.ts diff --git a/.eslintignore b/.eslintignore index 6bc2c5fd02..b9a1b2710a 100644 --- a/.eslintignore +++ b/.eslintignore @@ -7,3 +7,4 @@ dfx_generate dfx_generated declarations property_tests/tests/**/src/* +dist diff --git a/.eslintrc.js b/.eslintrc.js index 1291a44b5c..2525f7592e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -3,7 +3,6 @@ const temporarilyDisabledRules = { '@typescript-eslint/ban-ts-comment': 'off', // 42 problems '@typescript-eslint/no-explicit-any': 'off', // 537 problems - '@typescript-eslint/no-var-requires': 'off', // 14 problems 'no-undef': 'off', // 79 problems 'prefer-const': 'off' // 154 problems }; diff --git a/bin.js b/bin.js index 673ff1fab4..057297a32c 100755 --- a/bin.js +++ b/bin.js @@ -1,5 +1,6 @@ #!/usr/bin/env node +// eslint-disable-next-line @typescript-eslint/no-var-requires require('ts-node').register({ transpileOnly: true, ignore: [`node_modules/(?!azle)`], diff --git a/external_module.d.ts b/external_module.d.ts new file mode 100644 index 0000000000..9c8178268b --- /dev/null +++ b/external_module.d.ts @@ -0,0 +1,3 @@ +declare module 'http-message-parser' { + export default function httpMessageParser(...args: any[]): any; +} diff --git a/property_tests/get_actor.ts b/property_tests/get_actor.ts index 3579eaafeb..ee8ef0c577 100644 --- a/property_tests/get_actor.ts +++ b/property_tests/get_actor.ts @@ -11,6 +11,7 @@ export function getActor(parentDir: string) { delete require.cache[resolvedPathIndex]; delete require.cache[resolvedPathDid]; + // eslint-disable-next-line @typescript-eslint/no-var-requires const { createActor } = require(`${parentDir}/dfx_generated/canister`); return createActor(getCanisterId('canister'), { agentOptions: { diff --git a/scripts/add_metadata_to_dfx_json.js b/scripts/add_metadata_to_dfx_json.js index fd8c6038a6..d51c6333ce 100644 --- a/scripts/add_metadata_to_dfx_json.js +++ b/scripts/add_metadata_to_dfx_json.js @@ -1,4 +1,6 @@ +// eslint-disable-next-line @typescript-eslint/no-var-requires const fs = require('fs'); +// eslint-disable-next-line @typescript-eslint/no-var-requires const path = require('path'); const targetDirectory = process.argv[2] || '.'; // Use the provided directory or default to the current directory diff --git a/scripts/file_generator/bin.js b/scripts/file_generator/bin.js index d2cd03050f..8c893f67a9 100755 --- a/scripts/file_generator/bin.js +++ b/scripts/file_generator/bin.js @@ -1,5 +1,6 @@ #!/usr/bin/env node +// eslint-disable-next-line @typescript-eslint/no-var-requires require('ts-node').register({ transpileOnly: true, ignore: [`node_modules/(?!azle)`], diff --git a/scripts/hash_file/bin.js b/scripts/hash_file/bin.js index d2cd03050f..8c893f67a9 100755 --- a/scripts/hash_file/bin.js +++ b/scripts/hash_file/bin.js @@ -1,5 +1,6 @@ #!/usr/bin/env node +// eslint-disable-next-line @typescript-eslint/no-var-requires require('ts-node').register({ transpileOnly: true, ignore: [`node_modules/(?!azle)`], diff --git a/scripts/reorder_dfx_json.js b/scripts/reorder_dfx_json.js index 430c037037..22d058a18f 100644 --- a/scripts/reorder_dfx_json.js +++ b/scripts/reorder_dfx_json.js @@ -1,4 +1,6 @@ +// eslint-disable-next-line @typescript-eslint/no-var-requires const fs = require('fs-extra'); +// eslint-disable-next-line @typescript-eslint/no-var-requires const path = require('path'); // Helper function to reorder keys in an object. diff --git a/scripts/simplify_tsconfig.js b/scripts/simplify_tsconfig.js index 816756a45a..84822794c2 100644 --- a/scripts/simplify_tsconfig.js +++ b/scripts/simplify_tsconfig.js @@ -1,4 +1,6 @@ +// eslint-disable-next-line @typescript-eslint/no-var-requires const fs = require('fs-extra'); +// eslint-disable-next-line @typescript-eslint/no-var-requires const path = require('path'); // Read directory. diff --git a/scripts/update_dfx_json_main.js b/scripts/update_dfx_json_main.js index b8980df57b..6f4d5c74fb 100644 --- a/scripts/update_dfx_json_main.js +++ b/scripts/update_dfx_json_main.js @@ -1,4 +1,6 @@ +// eslint-disable-next-line @typescript-eslint/no-var-requires const fs = require('fs'); +// eslint-disable-next-line @typescript-eslint/no-var-requires const path = require('path'); // Helper function to update the canister definition diff --git a/src/compiler/file_watcher/file_watcher_loader.js b/src/compiler/file_watcher/file_watcher_loader.js index daf60daa2e..b13582b1fd 100644 --- a/src/compiler/file_watcher/file_watcher_loader.js +++ b/src/compiler/file_watcher/file_watcher_loader.js @@ -1,3 +1,4 @@ +// eslint-disable-next-line @typescript-eslint/no-var-requires require('ts-node').register({ transpileOnly: true, ignore: [`node_modules/(?!azle)`], diff --git a/src/lib/server.ts b/src/lib/server.ts index cb4e4b99c1..ec81d2a532 100644 --- a/src/lib/server.ts +++ b/src/lib/server.ts @@ -3,6 +3,7 @@ import { Server as NodeServer, ServerResponse } from 'http'; import { HttpConn } from 'http'; // @ts-ignore import { IncomingMessageForServer } from 'http'; +import httpMessageParser from 'http-message-parser'; import { blob, @@ -28,8 +29,6 @@ import { } from '.'; import { CanisterOptions } from './candid/types/reference/service/canister_function'; -const httpMessageParser = require('http-message-parser'); - export type HeaderField = [text, text]; export const HeaderField = Tuple(text, text); From 7b38beac203f10dc9cc6f59be824f45e3e70fb12 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 10 Apr 2024 16:08:24 -0600 Subject: [PATCH 30/34] turn of pref-const --- .eslintrc.js | 6 +++--- examples/stable_structures/test/tests.ts | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 2525f7592e..c9f56dc417 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,10 +1,8 @@ // TODO: These rules should be enabled, but we had offenses when we enabled ESLint. // This is tech-debt. We should go through and re-enable these at some point. const temporarilyDisabledRules = { - '@typescript-eslint/ban-ts-comment': 'off', // 42 problems '@typescript-eslint/no-explicit-any': 'off', // 537 problems - 'no-undef': 'off', // 79 problems - 'prefer-const': 'off' // 154 problems + 'no-undef': 'off' // 79 problems }; module.exports = { @@ -53,6 +51,8 @@ module.exports = { varsIgnorePattern: '^_' // Ignore local variables starting with _ } ], + '@typescript-eslint/ban-ts-comment': 'off', + 'prefer-const': 'off', // For azle let is used to indicate mutability not only re-assignability ...temporarilyDisabledRules } }; diff --git a/examples/stable_structures/test/tests.ts b/examples/stable_structures/test/tests.ts index 69b97b6f66..c502f5716a 100644 --- a/examples/stable_structures/test/tests.ts +++ b/examples/stable_structures/test/tests.ts @@ -414,9 +414,9 @@ function itemsIsLength( length === 1 ? 'item' : 'items' }`, test: async () => { - let keyComp: (a: any, b: any) => boolean = + const keyComp: (a: any, b: any) => boolean = STABLE_MAP_KEYSCOMPS[index]; - let valueComp: (a: any, b: any) => boolean = + const valueComp: (a: any, b: any) => boolean = STABLEMAPVALUECOMPS[index]; const itemsResult = await (stableStructuresCanister as any)[ `stableMap${index}Items` @@ -451,7 +451,7 @@ function keysIsLength( length === 1 ? 'key' : 'keys' }`, test: async () => { - let keyComp: (a: any, b: any) => boolean = + const keyComp: (a: any, b: any) => boolean = STABLE_MAP_KEYSCOMPS[index]; const keysResult = await (stableStructuresCanister as any)[ `stableMap${index}Keys` @@ -491,7 +491,8 @@ function lenReturns( function remove(stableStructuresCanister: ActorSubclass<_SERVICE>): Test[] { return STABLE_MAP_KEYS.map((stableMapKeys, index) => { - let valueComp: (a: any, b: any) => boolean = STABLEMAPVALUECOMPS[index]; + const valueComp: (a: any, b: any) => boolean = + STABLEMAPVALUECOMPS[index]; return { name: `stableMap${index}.remove() returns the previously stored value`, test: async () => { @@ -518,7 +519,7 @@ function valuesIsLength( length === 1 ? 'value' : 'values' }`, test: async () => { - let valueComp: (a: any, b: any) => boolean = + const valueComp: (a: any, b: any) => boolean = STABLEMAPVALUECOMPS[index]; const valuesResult = await (stableStructuresCanister as any)[ `stableMap${index}Values` From 801dd16bb68561a9c78f27b6a64fd925ba590341 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 10 Apr 2024 16:14:24 -0600 Subject: [PATCH 31/34] finishing restoring recommended linting rules --- .eslintrc.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index c9f56dc417..8e2555a094 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,10 +1,3 @@ -// TODO: These rules should be enabled, but we had offenses when we enabled ESLint. -// This is tech-debt. We should go through and re-enable these at some point. -const temporarilyDisabledRules = { - '@typescript-eslint/no-explicit-any': 'off', // 537 problems - 'no-undef': 'off' // 79 problems -}; - module.exports = { env: { es2021: true, @@ -53,6 +46,7 @@ module.exports = { ], '@typescript-eslint/ban-ts-comment': 'off', 'prefer-const': 'off', // For azle let is used to indicate mutability not only re-assignability - ...temporarilyDisabledRules + 'no-undef': 'error', // TS compiler handles this for us + '@typescript-eslint/no-explicit-any': 'off' // TODO https://github.com/demergent-labs/azle/issues/1737 } }; From 008c70c46aed9b060161d598376ba5f3f18dca76 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Wed, 10 Apr 2024 16:22:10 -0600 Subject: [PATCH 32/34] no-undef should be off because the ts compiler handles it for us --- .eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.eslintrc.js b/.eslintrc.js index 8e2555a094..35757b419c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -46,7 +46,7 @@ module.exports = { ], '@typescript-eslint/ban-ts-comment': 'off', 'prefer-const': 'off', // For azle let is used to indicate mutability not only re-assignability - 'no-undef': 'error', // TS compiler handles this for us + 'no-undef': 'off', // TS compiler handles this for us '@typescript-eslint/no-explicit-any': 'off' // TODO https://github.com/demergent-labs/azle/issues/1737 } }; From 1cb7a58efdba7fe03a4df244196cef9ebedb553a Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 11 Apr 2024 09:25:37 -0600 Subject: [PATCH 33/34] ignore http-message-parser --- external_module.d.ts | 3 --- src/lib/server.ts | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 external_module.d.ts diff --git a/external_module.d.ts b/external_module.d.ts deleted file mode 100644 index 9c8178268b..0000000000 --- a/external_module.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -declare module 'http-message-parser' { - export default function httpMessageParser(...args: any[]): any; -} diff --git a/src/lib/server.ts b/src/lib/server.ts index ec81d2a532..0eba50a4a9 100644 --- a/src/lib/server.ts +++ b/src/lib/server.ts @@ -3,6 +3,7 @@ import { Server as NodeServer, ServerResponse } from 'http'; import { HttpConn } from 'http'; // @ts-ignore import { IncomingMessageForServer } from 'http'; +// @ts-ignore import httpMessageParser from 'http-message-parser'; import { From 5fd47ad39658320b559b96e430ce8e1cf74747b7 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Thu, 11 Apr 2024 10:40:38 -0600 Subject: [PATCH 34/34] add info --- src/lib/globals.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/globals.ts b/src/lib/globals.ts index 539d955e95..04b4a655ff 100644 --- a/src/lib/globals.ts +++ b/src/lib/globals.ts @@ -62,7 +62,8 @@ if (globalThis._azleInsideCanister) { ...globalThis.console, log, error: log, - warn: log + warn: log, + info: log }; const originalSetTimeout = setTimeout;