diff --git a/experimental/canisters/icrc/errors.ts b/experimental/canisters/icrc/errors.ts index 94c1c983f8..a572b26ff7 100644 --- a/experimental/canisters/icrc/errors.ts +++ b/experimental/canisters/icrc/errors.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; import { Record } from '../../../src/lib/experimental/candid/types/constructed/record'; import { nat } from '../../../src/lib/experimental/candid/types/primitive/nats/nat'; diff --git a/experimental/canisters/icrc/icrc_1.ts b/experimental/canisters/icrc/icrc_1.ts index 0d4b3a88eb..78792daecf 100644 --- a/experimental/canisters/icrc/icrc_1.ts +++ b/experimental/canisters/icrc/icrc_1.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; import { blob, diff --git a/experimental/canisters/icrc/icrc_2.ts b/experimental/canisters/icrc/icrc_2.ts index f35db9dc18..7fab326ff5 100644 --- a/experimental/canisters/icrc/icrc_2.ts +++ b/experimental/canisters/icrc/icrc_2.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; import { blob } from '../../../src/lib/experimental/candid/types/constructed/blob'; import { Opt } from '../../../src/lib/experimental/candid/types/constructed/opt'; diff --git a/experimental/canisters/icrc/index.ts b/experimental/canisters/icrc/index.ts index 832ed5eee3..492959d4f1 100644 --- a/experimental/canisters/icrc/index.ts +++ b/experimental/canisters/icrc/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; import { Canister, diff --git a/experimental/canisters/ledger/address/index.ts b/experimental/canisters/ledger/address/index.ts index e29fe6106d..ee4a92973d 100755 --- a/experimental/canisters/ledger/address/index.ts +++ b/experimental/canisters/ledger/address/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../src/lib/experimental/experimental'; import { Principal } from '@dfinity/principal'; import { getCrc32 } from '@dfinity/principal/lib/esm/utils/getCrc'; diff --git a/experimental/canisters/ledger/index.ts b/experimental/canisters/ledger/index.ts index 15a3dc5cbb..498c76594c 100644 --- a/experimental/canisters/ledger/index.ts +++ b/experimental/canisters/ledger/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; // Some JS docs licensed under: // @@ -11,7 +7,6 @@ if (globalThis._azleExperimental !== true) { // - https://github.com/dfinity/portal/blob/master/LICENSE // // Some documentation changed from original work. - import { blob, Canister, diff --git a/experimental/canisters/management/bitcoin.ts b/experimental/canisters/management/bitcoin.ts index 4724eac7b2..bd97bf4eb9 100644 --- a/experimental/canisters/management/bitcoin.ts +++ b/experimental/canisters/management/bitcoin.ts @@ -1,11 +1,6 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; // TODO I am thinking we should use the same names as ic-btc-types - import { blob, nat32, diff --git a/experimental/canisters/management/canister_info.ts b/experimental/canisters/management/canister_info.ts index 8835311618..3f3e491ae1 100644 --- a/experimental/canisters/management/canister_info.ts +++ b/experimental/canisters/management/canister_info.ts @@ -1,15 +1,10 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; // JS docs licensed under: // // - https://github.com/dfinity/cdk-rs/blob/main/LICENSE // // Some documentation changed from original work. - import { Opt } from '../../../src/lib/experimental/candid/types/constructed/opt'; import { Record } from '../../../src/lib/experimental/candid/types/constructed/record'; import { Variant } from '../../../src/lib/experimental/candid/types/constructed/variant'; diff --git a/experimental/canisters/management/canister_management.ts b/experimental/canisters/management/canister_management.ts index 1887e58f29..b7ba309906 100644 --- a/experimental/canisters/management/canister_management.ts +++ b/experimental/canisters/management/canister_management.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; import { blob, diff --git a/experimental/canisters/management/http_request.ts b/experimental/canisters/management/http_request.ts index f1936d0d8a..02a2c2aa22 100644 --- a/experimental/canisters/management/http_request.ts +++ b/experimental/canisters/management/http_request.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; import { blob, diff --git a/experimental/canisters/management/index.ts b/experimental/canisters/management/index.ts index 883ceb92ef..4889773658 100644 --- a/experimental/canisters/management/index.ts +++ b/experimental/canisters/management/index.ts @@ -1,15 +1,10 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; // Some JS docs licensed under: // // - https://github.com/dfinity/cdk-rs/blob/main/LICENSE // // Some documentation changed from original work. - import { blob } from '../../../src/lib/experimental/candid/types/constructed/blob'; import { Vec } from '../../../src/lib/experimental/candid/types/constructed/vec'; import { Void } from '../../../src/lib/experimental/candid/types/primitive/void'; diff --git a/experimental/canisters/management/t_ecdsa.ts b/experimental/canisters/management/t_ecdsa.ts index 2669ddc4e6..5d8bafcb9c 100644 --- a/experimental/canisters/management/t_ecdsa.ts +++ b/experimental/canisters/management/t_ecdsa.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../src/lib/experimental/experimental'; import { blob } from '../../../src/lib/experimental/candid/types/constructed/blob'; import { Opt } from '../../../src/lib/experimental/candid/types/constructed/opt'; diff --git a/experimental/index.ts b/experimental/index.ts index 858cfbda56..d16e8ab06d 100644 --- a/experimental/index.ts +++ b/experimental/index.ts @@ -1,7 +1,3 @@ -import { experimentalMessage } from '../src/lib/experimental/experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../src/lib/experimental/experimental'; export * from '../src/lib/experimental'; diff --git a/src/build/experimental/commands/compile/file_watcher/file_watcher.ts b/src/build/experimental/commands/compile/file_watcher/file_watcher.ts index 8a9846d863..41dac72daa 100644 --- a/src/build/experimental/commands/compile/file_watcher/file_watcher.ts +++ b/src/build/experimental/commands/compile/file_watcher/file_watcher.ts @@ -21,11 +21,10 @@ let actor: ActorReloadJs | undefined; const reloadedJsPath = process.argv[2]; const canisterId = process.argv[3]; const mainPath = process.argv[4]; -const wasmedgeQuickJsPath = process.argv[5]; -const esmAliases = JSON.parse(process.argv[6]); -const esmExternals = JSON.parse(process.argv[7]); -const canisterName = process.argv[8]; -const postUpgradeIndex = Number(process.argv[9]); +const esmAliases = JSON.parse(process.argv[5]); +const esmExternals = JSON.parse(process.argv[6]); +const canisterName = process.argv[7]; +const postUpgradeIndex = Number(process.argv[8]); // TODO https://github.com/demergent-labs/azle/issues/1664 const watcher = watch([`**/*.ts`, `**/*.js`], { @@ -44,12 +43,7 @@ watcher.on('all', async (event, path) => { if (event === 'change') { try { - await reloadJs( - actor, - reloadedJsPath, - mainPath, - wasmedgeQuickJsPath - ); + await reloadJs(actor, reloadedJsPath, mainPath); } catch (error) { console.error(error); } @@ -59,12 +53,10 @@ watcher.on('all', async (event, path) => { async function reloadJs( actor: ActorReloadJs, reloadedJsPath: string, - mainPath: string, - wasmedgeQuickJsPath: string + mainPath: string ): Promise { const javaScript = await compileJavaScript( mainPath, - wasmedgeQuickJsPath, esmAliases, esmExternals ); diff --git a/src/build/experimental/commands/compile/file_watcher/setup_file_watcher.ts b/src/build/experimental/commands/compile/file_watcher/setup_file_watcher.ts index 9e87cd87d8..56d228c877 100644 --- a/src/build/experimental/commands/compile/file_watcher/setup_file_watcher.ts +++ b/src/build/experimental/commands/compile/file_watcher/setup_file_watcher.ts @@ -3,7 +3,6 @@ import { join } from 'path'; import { execSyncPretty } from '../../../../stable/utils/exec_sync_pretty'; import { AZLE_PACKAGE_PATH } from '../../../../stable/utils/global_paths'; -import { WASMEDGE_QUICKJS_PATH } from '../../../utils/global_paths'; export function setupFileWatcher( reloadedJsPath: string, @@ -45,7 +44,6 @@ export function setupFileWatcher( reloadedJsPath, canisterId, mainPath, - WASMEDGE_QUICKJS_PATH, JSON.stringify(esmAliases), JSON.stringify(esmExternals), canisterName, diff --git a/src/build/stable/commands/compile/javascript.ts b/src/build/stable/commands/compile/javascript.ts index b59a5088f9..a232601778 100644 --- a/src/build/stable/commands/compile/javascript.ts +++ b/src/build/stable/commands/compile/javascript.ts @@ -1,8 +1,6 @@ import { build, BuildOptions } from 'esbuild'; import esbuildPluginTsc from 'esbuild-plugin-tsc'; -import { experimentalMessage } from '../../../../lib/experimental/experimental'; - export async function compile(main: string): Promise { const prelude = getPrelude(main); const buildOptions = getBuildOptions(prelude); @@ -93,3 +91,19 @@ export function getBuildOptions(ts: string): BuildOptions { ] }; } + +function experimentalMessage(importName: string): string { + return `Azle: experimental mode must be enabled to import from ${importName}. You can enable experimental mode in your dfx.json file like this: +{ + "canisters": { + "canisterName": { + "type": "azle", + "main": "index.ts", + "custom": { + "experimental": true + } + } + } +} +`; +} diff --git a/src/lib/experimental/candid/candid_type.ts b/src/lib/experimental/candid/candid_type.ts index 8be7684373..1b1fecf9bb 100644 --- a/src/lib/experimental/candid/candid_type.ts +++ b/src/lib/experimental/candid/candid_type.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/index.ts b/src/lib/experimental/candid/index.ts index a9c6d49f3e..7eef5cd175 100644 --- a/src/lib/experimental/candid/index.ts +++ b/src/lib/experimental/candid/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; export * from './candid_type'; export * from './manual'; diff --git a/src/lib/experimental/candid/manual.ts b/src/lib/experimental/candid/manual.ts index 418d179a8d..15626c1609 100644 --- a/src/lib/experimental/candid/manual.ts +++ b/src/lib/experimental/candid/manual.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { CandidType } from './candid_type'; import { AzleVoid } from './types/primitive/void'; diff --git a/src/lib/experimental/candid/recursive.ts b/src/lib/experimental/candid/recursive.ts index d704aa2de6..4efeeb0d65 100644 --- a/src/lib/experimental/candid/recursive.ts +++ b/src/lib/experimental/candid/recursive.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { IDL } from '@dfinity/candid'; import { v4 } from 'uuid'; diff --git a/src/lib/experimental/candid/serde/decode.ts b/src/lib/experimental/candid/serde/decode.ts index 92de8c4e95..622682579e 100644 --- a/src/lib/experimental/candid/serde/decode.ts +++ b/src/lib/experimental/candid/serde/decode.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/encode.ts b/src/lib/experimental/candid/serde/encode.ts index 0a3a9e6872..1e3550af69 100644 --- a/src/lib/experimental/candid/serde/encode.ts +++ b/src/lib/experimental/candid/serde/encode.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/index.ts b/src/lib/experimental/candid/serde/index.ts index f637c19987..dc6b8caf9b 100644 --- a/src/lib/experimental/candid/serde/index.ts +++ b/src/lib/experimental/candid/serde/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; export { decode } from './decode'; export { encode } from './encode'; diff --git a/src/lib/experimental/candid/serde/visitors/decode_visitor.ts b/src/lib/experimental/candid/serde/visitors/decode_visitor.ts index 3af9881391..969dada1c6 100644 --- a/src/lib/experimental/candid/serde/visitors/decode_visitor.ts +++ b/src/lib/experimental/candid/serde/visitors/decode_visitor.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/visitors/encode_visitor.ts b/src/lib/experimental/candid/serde/visitors/encode_visitor.ts index e57008d040..9e6291b295 100644 --- a/src/lib/experimental/candid/serde/visitors/encode_visitor.ts +++ b/src/lib/experimental/candid/serde/visitors/encode_visitor.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/visitors/index.ts b/src/lib/experimental/candid/serde/visitors/index.ts index d728302cb2..15cb9febfb 100644 --- a/src/lib/experimental/candid/serde/visitors/index.ts +++ b/src/lib/experimental/candid/serde/visitors/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; export { DecodeVisitor } from './decode_visitor'; export { EncodeVisitor } from './encode_visitor'; diff --git a/src/lib/experimental/candid/serde/visitors/types.ts b/src/lib/experimental/candid/serde/visitors/types.ts index a5783806ef..5dc108f889 100644 --- a/src/lib/experimental/candid/serde/visitors/types.ts +++ b/src/lib/experimental/candid/serde/visitors/types.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; /* * The VisitorData gives us js_data which is the data that is about to be diff --git a/src/lib/experimental/candid/serde/visitors/visit/record.ts b/src/lib/experimental/candid/serde/visitors/visit/record.ts index fe5db972b8..948cbfe030 100644 --- a/src/lib/experimental/candid/serde/visitors/visit/record.ts +++ b/src/lib/experimental/candid/serde/visitors/visit/record.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/visitors/visit/recursive.ts b/src/lib/experimental/candid/serde/visitors/visit/recursive.ts index 8d9982f0fe..fc4d1d54c6 100644 --- a/src/lib/experimental/candid/serde/visitors/visit/recursive.ts +++ b/src/lib/experimental/candid/serde/visitors/visit/recursive.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/visitors/visit/tuple.ts b/src/lib/experimental/candid/serde/visitors/visit/tuple.ts index 8a8cb07cd1..3a49ddfcdf 100644 --- a/src/lib/experimental/candid/serde/visitors/visit/tuple.ts +++ b/src/lib/experimental/candid/serde/visitors/visit/tuple.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/visitors/visit/variant/azle_result.ts b/src/lib/experimental/candid/serde/visitors/visit/variant/azle_result.ts index 4dbb7597b5..e1b4aa7b18 100644 --- a/src/lib/experimental/candid/serde/visitors/visit/variant/azle_result.ts +++ b/src/lib/experimental/candid/serde/visitors/visit/variant/azle_result.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/visitors/visit/variant/azle_variant.ts b/src/lib/experimental/candid/serde/visitors/visit/variant/azle_variant.ts index 46ae87ac32..fc9366754d 100644 --- a/src/lib/experimental/candid/serde/visitors/visit/variant/azle_variant.ts +++ b/src/lib/experimental/candid/serde/visitors/visit/variant/azle_variant.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/visitors/visit/variant/index.ts b/src/lib/experimental/candid/serde/visitors/visit/variant/index.ts index 0ffed5e2ea..8af89f69cd 100644 --- a/src/lib/experimental/candid/serde/visitors/visit/variant/index.ts +++ b/src/lib/experimental/candid/serde/visitors/visit/variant/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/serde/visitors/visit/vec.ts b/src/lib/experimental/candid/serde/visitors/visit/vec.ts index c1edbcac63..8bc090a350 100644 --- a/src/lib/experimental/candid/serde/visitors/visit/vec.ts +++ b/src/lib/experimental/candid/serde/visitors/visit/vec.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/to_idl_type.ts b/src/lib/experimental/candid/to_idl_type.ts index 8c773a13bb..0269cb4424 100644 --- a/src/lib/experimental/candid/to_idl_type.ts +++ b/src/lib/experimental/candid/to_idl_type.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/type_mapping.ts b/src/lib/experimental/candid/type_mapping.ts index 06a5422092..ef20bd1bfe 100644 --- a/src/lib/experimental/candid/type_mapping.ts +++ b/src/lib/experimental/candid/type_mapping.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { AzleResult, Result } from '../system_types'; import { AzleBlob, blob } from './types/constructed/blob'; diff --git a/src/lib/experimental/candid/types/constructed/blob.ts b/src/lib/experimental/candid/types/constructed/blob.ts index 58bb394b92..f8578f3b09 100644 --- a/src/lib/experimental/candid/types/constructed/blob.ts +++ b/src/lib/experimental/candid/types/constructed/blob.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/constructed/index.ts b/src/lib/experimental/candid/types/constructed/index.ts index b0cb5ad3a1..0efb622473 100644 --- a/src/lib/experimental/candid/types/constructed/index.ts +++ b/src/lib/experimental/candid/types/constructed/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; export * from './blob'; export * from './opt'; diff --git a/src/lib/experimental/candid/types/constructed/opt.ts b/src/lib/experimental/candid/types/constructed/opt.ts index b84e55132c..185c86f43c 100644 --- a/src/lib/experimental/candid/types/constructed/opt.ts +++ b/src/lib/experimental/candid/types/constructed/opt.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/constructed/record.ts b/src/lib/experimental/candid/types/constructed/record.ts index 5099064d3a..7dd0611c58 100644 --- a/src/lib/experimental/candid/types/constructed/record.ts +++ b/src/lib/experimental/candid/types/constructed/record.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/constructed/to_idl_map.ts b/src/lib/experimental/candid/types/constructed/to_idl_map.ts index e76e652b1a..f6822197dc 100644 --- a/src/lib/experimental/candid/types/constructed/to_idl_map.ts +++ b/src/lib/experimental/candid/types/constructed/to_idl_map.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/constructed/tuple.ts b/src/lib/experimental/candid/types/constructed/tuple.ts index 5d6ce68268..203318d1d3 100644 --- a/src/lib/experimental/candid/types/constructed/tuple.ts +++ b/src/lib/experimental/candid/types/constructed/tuple.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/constructed/variant.ts b/src/lib/experimental/candid/types/constructed/variant.ts index 0b48201c26..0cc1d50c8c 100644 --- a/src/lib/experimental/candid/types/constructed/variant.ts +++ b/src/lib/experimental/candid/types/constructed/variant.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/constructed/vec.ts b/src/lib/experimental/candid/types/constructed/vec.ts index 08eca40ad6..17ef84fae5 100644 --- a/src/lib/experimental/candid/types/constructed/vec.ts +++ b/src/lib/experimental/candid/types/constructed/vec.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/bool.ts b/src/lib/experimental/candid/types/primitive/bool.ts index 6c769e96f6..7a13e7472f 100644 --- a/src/lib/experimental/candid/types/primitive/bool.ts +++ b/src/lib/experimental/candid/types/primitive/bool.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/empty.ts b/src/lib/experimental/candid/types/primitive/empty.ts index 7e776fb089..13f46a3f44 100644 --- a/src/lib/experimental/candid/types/primitive/empty.ts +++ b/src/lib/experimental/candid/types/primitive/empty.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/floats/float32.ts b/src/lib/experimental/candid/types/primitive/floats/float32.ts index 65a208e16b..1323bd52cd 100644 --- a/src/lib/experimental/candid/types/primitive/floats/float32.ts +++ b/src/lib/experimental/candid/types/primitive/floats/float32.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/floats/float64.ts b/src/lib/experimental/candid/types/primitive/floats/float64.ts index acf2a94b9b..3b8b4c9858 100644 --- a/src/lib/experimental/candid/types/primitive/floats/float64.ts +++ b/src/lib/experimental/candid/types/primitive/floats/float64.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/floats/index.ts b/src/lib/experimental/candid/types/primitive/floats/index.ts index 2e8e220f3f..1a26110b02 100644 --- a/src/lib/experimental/candid/types/primitive/floats/index.ts +++ b/src/lib/experimental/candid/types/primitive/floats/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; export * from './float32'; export * from './float64'; diff --git a/src/lib/experimental/candid/types/primitive/index.ts b/src/lib/experimental/candid/types/primitive/index.ts index bcae8ac504..bc505e0e81 100644 --- a/src/lib/experimental/candid/types/primitive/index.ts +++ b/src/lib/experimental/candid/types/primitive/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; export * from './bool'; export * from './empty'; diff --git a/src/lib/experimental/candid/types/primitive/ints/index.ts b/src/lib/experimental/candid/types/primitive/ints/index.ts index 8b36b28c99..23ac5cdc96 100644 --- a/src/lib/experimental/candid/types/primitive/ints/index.ts +++ b/src/lib/experimental/candid/types/primitive/ints/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; export * from './int'; export * from './int8'; diff --git a/src/lib/experimental/candid/types/primitive/ints/int.ts b/src/lib/experimental/candid/types/primitive/ints/int.ts index ad7e8f4e5d..b78c5a557e 100644 --- a/src/lib/experimental/candid/types/primitive/ints/int.ts +++ b/src/lib/experimental/candid/types/primitive/ints/int.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/ints/int16.ts b/src/lib/experimental/candid/types/primitive/ints/int16.ts index e278de7af8..52f5ed8645 100644 --- a/src/lib/experimental/candid/types/primitive/ints/int16.ts +++ b/src/lib/experimental/candid/types/primitive/ints/int16.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/ints/int32.ts b/src/lib/experimental/candid/types/primitive/ints/int32.ts index b5f759fef6..6bd43f4964 100644 --- a/src/lib/experimental/candid/types/primitive/ints/int32.ts +++ b/src/lib/experimental/candid/types/primitive/ints/int32.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/ints/int64.ts b/src/lib/experimental/candid/types/primitive/ints/int64.ts index 7154f7c0ce..79c54cfeb0 100644 --- a/src/lib/experimental/candid/types/primitive/ints/int64.ts +++ b/src/lib/experimental/candid/types/primitive/ints/int64.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/ints/int8.ts b/src/lib/experimental/candid/types/primitive/ints/int8.ts index e5d320011c..49b5497969 100644 --- a/src/lib/experimental/candid/types/primitive/ints/int8.ts +++ b/src/lib/experimental/candid/types/primitive/ints/int8.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/nats/index.ts b/src/lib/experimental/candid/types/primitive/nats/index.ts index 948f25a17e..09c9340d88 100644 --- a/src/lib/experimental/candid/types/primitive/nats/index.ts +++ b/src/lib/experimental/candid/types/primitive/nats/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; export * from './nat'; export * from './nat8'; diff --git a/src/lib/experimental/candid/types/primitive/nats/nat.ts b/src/lib/experimental/candid/types/primitive/nats/nat.ts index fdc4d5274d..5c1170b500 100644 --- a/src/lib/experimental/candid/types/primitive/nats/nat.ts +++ b/src/lib/experimental/candid/types/primitive/nats/nat.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/nats/nat16.ts b/src/lib/experimental/candid/types/primitive/nats/nat16.ts index ca99bd20d8..826fac5999 100644 --- a/src/lib/experimental/candid/types/primitive/nats/nat16.ts +++ b/src/lib/experimental/candid/types/primitive/nats/nat16.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/nats/nat32.ts b/src/lib/experimental/candid/types/primitive/nats/nat32.ts index 89077a95a5..7b1973b527 100644 --- a/src/lib/experimental/candid/types/primitive/nats/nat32.ts +++ b/src/lib/experimental/candid/types/primitive/nats/nat32.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/nats/nat64.ts b/src/lib/experimental/candid/types/primitive/nats/nat64.ts index 5fd0143e8d..e2460dbafc 100644 --- a/src/lib/experimental/candid/types/primitive/nats/nat64.ts +++ b/src/lib/experimental/candid/types/primitive/nats/nat64.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/nats/nat8.ts b/src/lib/experimental/candid/types/primitive/nats/nat8.ts index c2c4362642..739b4090b8 100644 --- a/src/lib/experimental/candid/types/primitive/nats/nat8.ts +++ b/src/lib/experimental/candid/types/primitive/nats/nat8.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/null.ts b/src/lib/experimental/candid/types/primitive/null.ts index 4db308679a..cc78656b9c 100644 --- a/src/lib/experimental/candid/types/primitive/null.ts +++ b/src/lib/experimental/candid/types/primitive/null.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/reserved.ts b/src/lib/experimental/candid/types/primitive/reserved.ts index 78da5d8b5c..3a4a9fa286 100644 --- a/src/lib/experimental/candid/types/primitive/reserved.ts +++ b/src/lib/experimental/candid/types/primitive/reserved.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/text.ts b/src/lib/experimental/candid/types/primitive/text.ts index 911ffee837..be590037a5 100644 --- a/src/lib/experimental/candid/types/primitive/text.ts +++ b/src/lib/experimental/candid/types/primitive/text.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/primitive/void.ts b/src/lib/experimental/candid/types/primitive/void.ts index 3065f2acd6..47988ca8c1 100644 --- a/src/lib/experimental/candid/types/primitive/void.ts +++ b/src/lib/experimental/candid/types/primitive/void.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/reference/func.ts b/src/lib/experimental/candid/types/reference/func.ts index b4dbecbe83..e2e875b901 100644 --- a/src/lib/experimental/candid/types/reference/func.ts +++ b/src/lib/experimental/candid/types/reference/func.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/reference/index.ts b/src/lib/experimental/candid/types/reference/index.ts index a75cc9770a..0412587be9 100644 --- a/src/lib/experimental/candid/types/reference/index.ts +++ b/src/lib/experimental/candid/types/reference/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; export * from './func'; export * from './principal'; diff --git a/src/lib/experimental/candid/types/reference/principal.ts b/src/lib/experimental/candid/types/reference/principal.ts index fd07ee709f..6bcfc2ba83 100644 --- a/src/lib/experimental/candid/types/reference/principal.ts +++ b/src/lib/experimental/candid/types/reference/principal.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../experimental'; import { IDL } from '@dfinity/candid'; import { Principal as DfinityPrincipal } from '@dfinity/principal'; diff --git a/src/lib/experimental/candid/types/reference/service/canister_function/index.ts b/src/lib/experimental/candid/types/reference/service/canister_function/index.ts index 7bb4734580..e878fe521c 100644 --- a/src/lib/experimental/candid/types/reference/service/canister_function/index.ts +++ b/src/lib/experimental/candid/types/reference/service/canister_function/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/reference/service/canister_function/query_update.ts b/src/lib/experimental/candid/types/reference/service/canister_function/query_update.ts index 5a3476d54a..2ab0853336 100644 --- a/src/lib/experimental/candid/types/reference/service/canister_function/query_update.ts +++ b/src/lib/experimental/candid/types/reference/service/canister_function/query_update.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../../experimental'; import { CanisterOptions } from '.'; diff --git a/src/lib/experimental/candid/types/reference/service/canister_function/system_methods.ts b/src/lib/experimental/candid/types/reference/service/canister_function/system_methods.ts index 2ca450ed73..099cbad56e 100644 --- a/src/lib/experimental/candid/types/reference/service/canister_function/system_methods.ts +++ b/src/lib/experimental/candid/types/reference/service/canister_function/system_methods.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/candid/types/reference/service/index.ts b/src/lib/experimental/candid/types/reference/service/index.ts index 3feb6f8fce..e970a05630 100644 --- a/src/lib/experimental/candid/types/reference/service/index.ts +++ b/src/lib/experimental/candid/types/reference/service/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../../../experimental'; import { CanisterMethodInfo } from '../../../../canister_methods/types/canister_method_info'; import { CandidType, TypeMapping } from '../../../index'; diff --git a/src/lib/experimental/canister_methods/execute_method.ts b/src/lib/experimental/canister_methods/execute_method.ts index 1755d09800..73bd2796ac 100644 --- a/src/lib/experimental/canister_methods/execute_method.ts +++ b/src/lib/experimental/canister_methods/execute_method.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { handleUncaughtError } from '../../stable/error'; import { CandidType } from '../candid/candid_type'; diff --git a/src/lib/experimental/canister_methods/index.ts b/src/lib/experimental/canister_methods/index.ts index 55b91fbdca..23bd7e26ea 100644 --- a/src/lib/experimental/canister_methods/index.ts +++ b/src/lib/experimental/canister_methods/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; export * from './methods'; export * from './types'; diff --git a/src/lib/experimental/canister_methods/is_async.ts b/src/lib/experimental/canister_methods/is_async.ts index f561e63546..f63741e080 100644 --- a/src/lib/experimental/canister_methods/is_async.ts +++ b/src/lib/experimental/canister_methods/is_async.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; export function isAsync(originalFunction: any): boolean { if (originalFunction[Symbol.toStringTag] === 'AsyncFunction') { diff --git a/src/lib/experimental/canister_methods/methods/heartbeat.ts b/src/lib/experimental/canister_methods/methods/heartbeat.ts index a66e5c7b89..1f20d4ebf9 100644 --- a/src/lib/experimental/canister_methods/methods/heartbeat.ts +++ b/src/lib/experimental/canister_methods/methods/heartbeat.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { Void } from '../../candid/types/primitive/void'; import { ic } from '../../ic'; diff --git a/src/lib/experimental/canister_methods/methods/index.ts b/src/lib/experimental/canister_methods/methods/index.ts index d742c928ea..198287f31a 100644 --- a/src/lib/experimental/canister_methods/methods/index.ts +++ b/src/lib/experimental/canister_methods/methods/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; export * from './heartbeat'; export * from './init'; diff --git a/src/lib/experimental/canister_methods/methods/init.ts b/src/lib/experimental/canister_methods/methods/init.ts index da44ee1523..552284240c 100644 --- a/src/lib/experimental/canister_methods/methods/init.ts +++ b/src/lib/experimental/canister_methods/methods/init.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { CandidType } from '../../candid/candid_type'; import { TypeMapping } from '../../candid/type_mapping'; diff --git a/src/lib/experimental/canister_methods/methods/inspect_message.ts b/src/lib/experimental/canister_methods/methods/inspect_message.ts index 661708c350..526061f9ba 100644 --- a/src/lib/experimental/canister_methods/methods/inspect_message.ts +++ b/src/lib/experimental/canister_methods/methods/inspect_message.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { Void } from '../../candid/types/primitive/void'; import { executeMethod } from '../execute_method'; diff --git a/src/lib/experimental/canister_methods/methods/post_upgrade.ts b/src/lib/experimental/canister_methods/methods/post_upgrade.ts index 3e06e415ea..71b317bfd1 100644 --- a/src/lib/experimental/canister_methods/methods/post_upgrade.ts +++ b/src/lib/experimental/canister_methods/methods/post_upgrade.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { CandidType } from '../../candid/candid_type'; import { TypeMapping } from '../../candid/type_mapping'; diff --git a/src/lib/experimental/canister_methods/methods/pre_upgrade.ts b/src/lib/experimental/canister_methods/methods/pre_upgrade.ts index 866b188726..58acf554f8 100644 --- a/src/lib/experimental/canister_methods/methods/pre_upgrade.ts +++ b/src/lib/experimental/canister_methods/methods/pre_upgrade.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { Void } from '../../candid/types/primitive/void'; import { isAsync } from '../is_async'; diff --git a/src/lib/experimental/canister_methods/methods/query.ts b/src/lib/experimental/canister_methods/methods/query.ts index 98f05a2773..a63de7d97e 100644 --- a/src/lib/experimental/canister_methods/methods/query.ts +++ b/src/lib/experimental/canister_methods/methods/query.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { CandidType } from '../../candid/candid_type'; import { TypeMapping } from '../../candid/type_mapping'; diff --git a/src/lib/experimental/canister_methods/methods/update.ts b/src/lib/experimental/canister_methods/methods/update.ts index c598e791c9..04c0d758e0 100644 --- a/src/lib/experimental/canister_methods/methods/update.ts +++ b/src/lib/experimental/canister_methods/methods/update.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { CandidType } from '../../candid/candid_type'; import { TypeMapping } from '../../candid/type_mapping'; diff --git a/src/lib/experimental/canister_methods/types/callback.ts b/src/lib/experimental/canister_methods/types/callback.ts index fbf801a7b8..39072bd57e 100644 --- a/src/lib/experimental/canister_methods/types/callback.ts +++ b/src/lib/experimental/canister_methods/types/callback.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; import { CandidType } from '../../candid/candid_type'; import { TypeMapping } from '../../candid/type_mapping'; diff --git a/src/lib/experimental/canister_methods/types/canister_method_info.ts b/src/lib/experimental/canister_methods/types/canister_method_info.ts index 0abb82fd67..7edb34c88a 100644 --- a/src/lib/experimental/canister_methods/types/canister_method_info.ts +++ b/src/lib/experimental/canister_methods/types/canister_method_info.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; // 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 diff --git a/src/lib/experimental/canister_methods/types/index.ts b/src/lib/experimental/canister_methods/types/index.ts index ffdfd2987a..9bcc8806bf 100644 --- a/src/lib/experimental/canister_methods/types/index.ts +++ b/src/lib/experimental/canister_methods/types/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; export * from './callback'; export * from './canister_method_info'; diff --git a/src/lib/experimental/canister_methods/types/method_args.ts b/src/lib/experimental/canister_methods/types/method_args.ts index 90f3b3047e..a5c630821f 100644 --- a/src/lib/experimental/canister_methods/types/method_args.ts +++ b/src/lib/experimental/canister_methods/types/method_args.ts @@ -1,7 +1,3 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; export type MethodArgs = { manual?: boolean }; diff --git a/src/lib/experimental/experimental.ts b/src/lib/experimental/experimental.ts index aa20fa1e74..51e66dedcf 100644 --- a/src/lib/experimental/experimental.ts +++ b/src/lib/experimental/experimental.ts @@ -1,4 +1,22 @@ -export function experimentalMessage(importName: string): string { +if (globalThis._azleExperimental !== true) { + const importName = getImportName(); + + throw new Error(experimentalMessage(importName)); +} + +function getImportName(): string { + if (import.meta.url.includes('azle/src/lib/experimental')) { + return 'azle/experimental'; + } + + throw new Error( + `Azle: Experimental import name for module path ${ + import.meta.url + } has not been created` + ); +} + +function experimentalMessage(importName: string): string { return `Azle: experimental mode must be enabled to import from ${importName}. You can enable experimental mode in your dfx.json file like this: { "canisters": { diff --git a/src/lib/experimental/fetch/file.ts b/src/lib/experimental/fetch/file.ts index 563e47cc10..53b527ac5a 100644 --- a/src/lib/experimental/fetch/file.ts +++ b/src/lib/experimental/fetch/file.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { readFile } from 'fs/promises'; diff --git a/src/lib/experimental/fetch/headers.ts b/src/lib/experimental/fetch/headers.ts index d5a72d49af..a8ca8d67ca 100644 --- a/src/lib/experimental/fetch/headers.ts +++ b/src/lib/experimental/fetch/headers.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; // TODO this is meant to be basic for now export class AzleFetchHeaders { diff --git a/src/lib/experimental/fetch/http.ts b/src/lib/experimental/fetch/http.ts index 6d95ce62ab..7dde7f7574 100644 --- a/src/lib/experimental/fetch/http.ts +++ b/src/lib/experimental/fetch/http.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { inflate } from 'pako'; diff --git a/src/lib/experimental/fetch/icp.ts b/src/lib/experimental/fetch/icp.ts index 262245dc8e..204410ffad 100644 --- a/src/lib/experimental/fetch/icp.ts +++ b/src/lib/experimental/fetch/icp.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { IDL } from '@dfinity/candid'; import { Principal } from '@dfinity/principal'; diff --git a/src/lib/experimental/fetch/index.ts b/src/lib/experimental/fetch/index.ts index b1935d186d..971ab199da 100644 --- a/src/lib/experimental/fetch/index.ts +++ b/src/lib/experimental/fetch/index.ts @@ -1,14 +1,9 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; // TODO what happens if you have a bunch of fetches in your dependencies, all in a row? // TODO how would you set options for each individually? // TODO it seems like you might not be able to do that // TODO we have got to get rid of the need to set all of these custom things - import { fetchFile } from './file'; import { fetchHttp } from './http'; import { fetchIcp } from './icp'; diff --git a/src/lib/experimental/fetch/response.ts b/src/lib/experimental/fetch/response.ts index f9db422523..21184c1445 100644 --- a/src/lib/experimental/fetch/response.ts +++ b/src/lib/experimental/fetch/response.ts @@ -1,12 +1,7 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; // TODO We currently do not have an implementation of ReadableStream // TODO thus our body is done with Uint8Array or Buffer - import { AzleFetchHeaders } from './headers'; // Using Response from wasmedge-quickjs doesn't seem ideal for the time being diff --git a/src/lib/experimental/fetch/url.ts b/src/lib/experimental/fetch/url.ts index 7c0fc3ebfe..ffd88ac65d 100644 --- a/src/lib/experimental/fetch/url.ts +++ b/src/lib/experimental/fetch/url.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; // TODO we do not support Request yet, same as the frontend fetch // TODO we probably could as wasmedge-quickjs has a Request class in http diff --git a/src/lib/experimental/globals.ts b/src/lib/experimental/globals.ts index 89b12609e0..bf4661a95e 100644 --- a/src/lib/experimental/globals.ts +++ b/src/lib/experimental/globals.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from './experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import './experimental'; import { Buffer } from 'buffer'; import * as process from 'process'; diff --git a/src/lib/experimental/ic/accept_message.ts b/src/lib/experimental/ic/accept_message.ts index fd8d357589..361a703dd9 100644 --- a/src/lib/experimental/ic/accept_message.ts +++ b/src/lib/experimental/ic/accept_message.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { Void } from '../candid/types/primitive/void'; // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/src/lib/experimental/ic/arg_data_raw.ts b/src/lib/experimental/ic/arg_data_raw.ts index 7e4c5e9d79..7e453d2b46 100644 --- a/src/lib/experimental/ic/arg_data_raw.ts +++ b/src/lib/experimental/ic/arg_data_raw.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { blob } from '../candid/types/constructed/blob'; diff --git a/src/lib/experimental/ic/call.ts b/src/lib/experimental/ic/call.ts index 46b6b90448..16c977d3ba 100644 --- a/src/lib/experimental/ic/call.ts +++ b/src/lib/experimental/ic/call.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat } from '../candid/types/primitive/nats/nat'; import { callRaw } from './call_raw'; diff --git a/src/lib/experimental/ic/call_raw.ts b/src/lib/experimental/ic/call_raw.ts index 25b22c4545..f7108aca99 100644 --- a/src/lib/experimental/ic/call_raw.ts +++ b/src/lib/experimental/ic/call_raw.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { Principal } from '@dfinity/principal'; import { v4 } from 'uuid'; diff --git a/src/lib/experimental/ic/caller.ts b/src/lib/experimental/ic/caller.ts index 7a13be78cb..19ba47ba7d 100644 --- a/src/lib/experimental/ic/caller.ts +++ b/src/lib/experimental/ic/caller.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { Principal } from '../candid/types/reference/principal'; diff --git a/src/lib/experimental/ic/candid_compiler.ts b/src/lib/experimental/ic/candid_compiler.ts index 03c950d143..05d0f4734c 100644 --- a/src/lib/experimental/ic/candid_compiler.ts +++ b/src/lib/experimental/ic/candid_compiler.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { text } from '../candid/types/primitive/text'; diff --git a/src/lib/experimental/ic/candid_decode.ts b/src/lib/experimental/ic/candid_decode.ts index 2772f53417..fd94735524 100644 --- a/src/lib/experimental/ic/candid_decode.ts +++ b/src/lib/experimental/ic/candid_decode.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { blob } from '../candid/types/constructed/blob'; import { text } from '../candid/types/primitive/text'; diff --git a/src/lib/experimental/ic/candid_encode.ts b/src/lib/experimental/ic/candid_encode.ts index ef03f8126b..0efdfbba1e 100644 --- a/src/lib/experimental/ic/candid_encode.ts +++ b/src/lib/experimental/ic/candid_encode.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { blob } from '../candid/types/constructed/blob'; import { text } from '../candid/types/primitive/text'; diff --git a/src/lib/experimental/ic/canister_balance.ts b/src/lib/experimental/ic/canister_balance.ts index d8a959ed6a..12d1a963e9 100644 --- a/src/lib/experimental/ic/canister_balance.ts +++ b/src/lib/experimental/ic/canister_balance.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat64 } from '../candid/types/primitive/nats/nat64'; diff --git a/src/lib/experimental/ic/canister_version.ts b/src/lib/experimental/ic/canister_version.ts index 3ba8d3a581..35950c193e 100644 --- a/src/lib/experimental/ic/canister_version.ts +++ b/src/lib/experimental/ic/canister_version.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat64 } from '../candid/types/primitive/nats/nat64'; diff --git a/src/lib/experimental/ic/chunk.ts b/src/lib/experimental/ic/chunk.ts index 47523ddf7d..6860bbdf39 100644 --- a/src/lib/experimental/ic/chunk.ts +++ b/src/lib/experimental/ic/chunk.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { ic } from './'; diff --git a/src/lib/experimental/ic/clear_timer.ts b/src/lib/experimental/ic/clear_timer.ts index 91fb99b5f0..e0251ae0b5 100644 --- a/src/lib/experimental/ic/clear_timer.ts +++ b/src/lib/experimental/ic/clear_timer.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { Void } from '../candid/types/primitive/void'; diff --git a/src/lib/experimental/ic/data_certificate.ts b/src/lib/experimental/ic/data_certificate.ts index 949ba0bf31..77a02d7658 100644 --- a/src/lib/experimental/ic/data_certificate.ts +++ b/src/lib/experimental/ic/data_certificate.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { blob } from '../candid/types/constructed/blob'; import { None, Opt, Some } from '../candid/types/constructed/opt'; diff --git a/src/lib/experimental/ic/id.ts b/src/lib/experimental/ic/id.ts index a53c2a6977..426a5f4333 100644 --- a/src/lib/experimental/ic/id.ts +++ b/src/lib/experimental/ic/id.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { Principal } from '../candid/types/reference/principal'; diff --git a/src/lib/experimental/ic/index.ts b/src/lib/experimental/ic/index.ts index 7836632caa..335037c838 100644 --- a/src/lib/experimental/ic/index.ts +++ b/src/lib/experimental/ic/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { acceptMessage } from './accept_message'; import { argDataRaw } from './arg_data_raw'; diff --git a/src/lib/experimental/ic/instruction_counter.ts b/src/lib/experimental/ic/instruction_counter.ts index c310d7056b..57ae63c289 100644 --- a/src/lib/experimental/ic/instruction_counter.ts +++ b/src/lib/experimental/ic/instruction_counter.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat64 } from '../candid/types/primitive/nats/nat64'; diff --git a/src/lib/experimental/ic/is_controller.ts b/src/lib/experimental/ic/is_controller.ts index 22ea8dbf7b..f010a4f8d9 100644 --- a/src/lib/experimental/ic/is_controller.ts +++ b/src/lib/experimental/ic/is_controller.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { bool } from '../candid/types/primitive/bool'; import { Principal } from '../candid/types/reference/principal'; diff --git a/src/lib/experimental/ic/method_name.ts b/src/lib/experimental/ic/method_name.ts index bb3d368875..9fb7e5d873 100644 --- a/src/lib/experimental/ic/method_name.ts +++ b/src/lib/experimental/ic/method_name.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { text } from '../candid/types/primitive/text'; diff --git a/src/lib/experimental/ic/msg_cycles_accept.ts b/src/lib/experimental/ic/msg_cycles_accept.ts index 433b2beae4..68b6bb5b83 100644 --- a/src/lib/experimental/ic/msg_cycles_accept.ts +++ b/src/lib/experimental/ic/msg_cycles_accept.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat64 } from '../candid/types/primitive/nats/nat64'; diff --git a/src/lib/experimental/ic/msg_cycles_available.ts b/src/lib/experimental/ic/msg_cycles_available.ts index 476ab54bf6..338c882f1e 100644 --- a/src/lib/experimental/ic/msg_cycles_available.ts +++ b/src/lib/experimental/ic/msg_cycles_available.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat64 } from '../candid/types/primitive/nats/nat64'; diff --git a/src/lib/experimental/ic/msg_cycles_refunded.ts b/src/lib/experimental/ic/msg_cycles_refunded.ts index 713bfcfc4d..8de30a1cdd 100644 --- a/src/lib/experimental/ic/msg_cycles_refunded.ts +++ b/src/lib/experimental/ic/msg_cycles_refunded.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat64 } from '../candid/types/primitive/nats/nat64'; diff --git a/src/lib/experimental/ic/notify.ts b/src/lib/experimental/ic/notify.ts index f900b62604..af668ad8e2 100644 --- a/src/lib/experimental/ic/notify.ts +++ b/src/lib/experimental/ic/notify.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat } from '../candid/types/primitive/nats/nat'; import { Void } from '../candid/types/primitive/void'; diff --git a/src/lib/experimental/ic/notify_raw.ts b/src/lib/experimental/ic/notify_raw.ts index 7778c4185b..a731ad01b2 100644 --- a/src/lib/experimental/ic/notify_raw.ts +++ b/src/lib/experimental/ic/notify_raw.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { blob } from '../candid/types/constructed/blob'; import { nat } from '../candid/types/primitive/nats/nat'; diff --git a/src/lib/experimental/ic/performance_counter.ts b/src/lib/experimental/ic/performance_counter.ts index c796ff1515..2645b8ed6a 100644 --- a/src/lib/experimental/ic/performance_counter.ts +++ b/src/lib/experimental/ic/performance_counter.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat32 } from '../candid/types/primitive/nats/nat32'; import { nat64 } from '../candid/types/primitive/nats/nat64'; diff --git a/src/lib/experimental/ic/print.ts b/src/lib/experimental/ic/print.ts index 299f637a04..56d4c0cda8 100644 --- a/src/lib/experimental/ic/print.ts +++ b/src/lib/experimental/ic/print.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { Void } from '../candid/types/primitive/void'; diff --git a/src/lib/experimental/ic/reject.ts b/src/lib/experimental/ic/reject.ts index 1397c34fcb..93be1250c9 100644 --- a/src/lib/experimental/ic/reject.ts +++ b/src/lib/experimental/ic/reject.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { text } from '../candid/types/primitive/text'; import { Void } from '../candid/types/primitive/void'; diff --git a/src/lib/experimental/ic/reject_code.ts b/src/lib/experimental/ic/reject_code.ts index 916dcaa789..d17eeb2e11 100644 --- a/src/lib/experimental/ic/reject_code.ts +++ b/src/lib/experimental/ic/reject_code.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { RejectionCode } from '../system_types'; diff --git a/src/lib/experimental/ic/reject_message.ts b/src/lib/experimental/ic/reject_message.ts index 36a0d478a8..e3c822647e 100644 --- a/src/lib/experimental/ic/reject_message.ts +++ b/src/lib/experimental/ic/reject_message.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { text } from '../candid/types/primitive/text'; // eslint-disable-next-line @typescript-eslint/no-unused-vars diff --git a/src/lib/experimental/ic/reply.ts b/src/lib/experimental/ic/reply.ts index 775687bcd1..d5895ed91a 100644 --- a/src/lib/experimental/ic/reply.ts +++ b/src/lib/experimental/ic/reply.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { CandidType } from '../candid/candid_type'; import { encode } from '../candid/serde/encode'; diff --git a/src/lib/experimental/ic/set_certified_data.ts b/src/lib/experimental/ic/set_certified_data.ts index 87ad79559a..4a0913f772 100644 --- a/src/lib/experimental/ic/set_certified_data.ts +++ b/src/lib/experimental/ic/set_certified_data.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { blob } from '../candid/types/constructed/blob'; import { Void } from '../candid/types/primitive/void'; diff --git a/src/lib/experimental/ic/set_outgoing_http_options.ts b/src/lib/experimental/ic/set_outgoing_http_options.ts index e906cc96ce..7d0c34cfa6 100644 --- a/src/lib/experimental/ic/set_outgoing_http_options.ts +++ b/src/lib/experimental/ic/set_outgoing_http_options.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; export function setOutgoingHttpOptions(options: { maxResponseBytes?: bigint; diff --git a/src/lib/experimental/ic/set_timer.ts b/src/lib/experimental/ic/set_timer.ts index 40285ff248..a0535e44e4 100644 --- a/src/lib/experimental/ic/set_timer.ts +++ b/src/lib/experimental/ic/set_timer.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { v4 } from 'uuid'; diff --git a/src/lib/experimental/ic/set_timer_interval.ts b/src/lib/experimental/ic/set_timer_interval.ts index 65f9c4ccf7..8e6fe633dc 100644 --- a/src/lib/experimental/ic/set_timer_interval.ts +++ b/src/lib/experimental/ic/set_timer_interval.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { v4 } from 'uuid'; diff --git a/src/lib/experimental/ic/time.ts b/src/lib/experimental/ic/time.ts index def4846cfc..1bbad14f94 100644 --- a/src/lib/experimental/ic/time.ts +++ b/src/lib/experimental/ic/time.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { nat64 } from '../candid/types/primitive/nats/nat64'; diff --git a/src/lib/experimental/ic/trap.ts b/src/lib/experimental/ic/trap.ts index 595fb669fe..4e46c8c370 100644 --- a/src/lib/experimental/ic/trap.ts +++ b/src/lib/experimental/ic/trap.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { empty } from '../candid/types/primitive/empty'; import { text } from '../candid/types/primitive/text'; diff --git a/src/lib/experimental/ic/types/args_type.ts b/src/lib/experimental/ic/types/args_type.ts index eb2f5bbbde..78198c59ed 100644 --- a/src/lib/experimental/ic/types/args_type.ts +++ b/src/lib/experimental/ic/types/args_type.ts @@ -1,7 +1,3 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; export type ArgsType = T extends (...args: infer U) => any ? U : any; diff --git a/src/lib/experimental/ic/types/index.ts b/src/lib/experimental/ic/types/index.ts index ffd770e60d..9f3664f98f 100644 --- a/src/lib/experimental/ic/types/index.ts +++ b/src/lib/experimental/ic/types/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; export * from './args_type'; export * from './return_type_of'; diff --git a/src/lib/experimental/ic/types/return_type_of.ts b/src/lib/experimental/ic/types/return_type_of.ts index f3068a15fd..3c2647fc52 100644 --- a/src/lib/experimental/ic/types/return_type_of.ts +++ b/src/lib/experimental/ic/types/return_type_of.ts @@ -1,7 +1,3 @@ -import { experimentalMessage } from '../../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../../experimental'; export type ReturnTypeOf = T extends (...args: any[]) => infer R ? R : any; diff --git a/src/lib/experimental/index.ts b/src/lib/experimental/index.ts index 40365af76b..d56f3f26f6 100644 --- a/src/lib/experimental/index.ts +++ b/src/lib/experimental/index.ts @@ -1,9 +1,4 @@ -import { experimentalMessage } from './experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} - +import './experimental'; import './globals'; import '../../../type_tests'; diff --git a/src/lib/experimental/json.ts b/src/lib/experimental/json.ts index 0e196e8f56..36612c55d7 100644 --- a/src/lib/experimental/json.ts +++ b/src/lib/experimental/json.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from './experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import './experimental'; import { jsonReplacer, diff --git a/src/lib/experimental/server.ts b/src/lib/experimental/server.ts index 33ca569e09..b8deb0c7c4 100644 --- a/src/lib/experimental/server.ts +++ b/src/lib/experimental/server.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from './experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import './experimental'; // TODO make this function's return type explicit https://github.com/demergent-labs/azle/issues/1860 /* eslint-disable @typescript-eslint/explicit-function-return-type */ diff --git a/src/lib/experimental/system_types/index.ts b/src/lib/experimental/system_types/index.ts index d74eeee39b..4da117fafd 100644 --- a/src/lib/experimental/system_types/index.ts +++ b/src/lib/experimental/system_types/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; export * from './rejection_code'; export * from './result'; diff --git a/src/lib/experimental/system_types/rejection_code.ts b/src/lib/experimental/system_types/rejection_code.ts index d91b23fb52..7afc4132f6 100644 --- a/src/lib/experimental/system_types/rejection_code.ts +++ b/src/lib/experimental/system_types/rejection_code.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { Variant } from '../candid/types/constructed/variant'; import { Null } from '../candid/types/primitive/null'; diff --git a/src/lib/experimental/system_types/result.ts b/src/lib/experimental/system_types/result.ts index 0cc2b54276..8fcc3491a4 100644 --- a/src/lib/experimental/system_types/result.ts +++ b/src/lib/experimental/system_types/result.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { IDL } from '@dfinity/candid'; diff --git a/src/lib/experimental/threshold_wallet/calculate_rsv_for_tecdsa.ts b/src/lib/experimental/threshold_wallet/calculate_rsv_for_tecdsa.ts index be80b83fac..033b484c3b 100644 --- a/src/lib/experimental/threshold_wallet/calculate_rsv_for_tecdsa.ts +++ b/src/lib/experimental/threshold_wallet/calculate_rsv_for_tecdsa.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { ethers } from 'ethers'; diff --git a/src/lib/experimental/threshold_wallet/ecdsa_public_key.ts b/src/lib/experimental/threshold_wallet/ecdsa_public_key.ts index ce5bf1ea86..129f63104b 100644 --- a/src/lib/experimental/threshold_wallet/ecdsa_public_key.ts +++ b/src/lib/experimental/threshold_wallet/ecdsa_public_key.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { Principal } from '@dfinity/principal'; diff --git a/src/lib/experimental/threshold_wallet/index.ts b/src/lib/experimental/threshold_wallet/index.ts index c929e94827..22de6e261a 100644 --- a/src/lib/experimental/threshold_wallet/index.ts +++ b/src/lib/experimental/threshold_wallet/index.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; export * from './calculate_rsv_for_tecdsa'; export * from './ecdsa_public_key'; diff --git a/src/lib/experimental/threshold_wallet/register_get_url.ts b/src/lib/experimental/threshold_wallet/register_get_url.ts index 992e8c11d7..21f7bad886 100644 --- a/src/lib/experimental/threshold_wallet/register_get_url.ts +++ b/src/lib/experimental/threshold_wallet/register_get_url.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; // TODO unfortunately this is highly unlikely to work in production because // TODO of the headers...we need a good transform @@ -12,7 +8,6 @@ if (globalThis._azleExperimental !== true) { // TODO and then the response can say what was wrong, instead of an error // TODO what if the developer installs a different version of ethers? // TODO should we use a peer dependency? - import { ethers } from 'ethers'; export async function ethersGetUrl( diff --git a/src/lib/experimental/threshold_wallet/sign_with_ecdsa.ts b/src/lib/experimental/threshold_wallet/sign_with_ecdsa.ts index f33b5d0104..3be93d07aa 100644 --- a/src/lib/experimental/threshold_wallet/sign_with_ecdsa.ts +++ b/src/lib/experimental/threshold_wallet/sign_with_ecdsa.ts @@ -1,8 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} +import '../experimental'; import { serialize } from '../fetch'; import { ThresholdKeyInfo } from './wallet'; diff --git a/src/lib/experimental/threshold_wallet/wallet.ts b/src/lib/experimental/threshold_wallet/wallet.ts index f2749568f3..31ce661e56 100644 --- a/src/lib/experimental/threshold_wallet/wallet.ts +++ b/src/lib/experimental/threshold_wallet/wallet.ts @@ -1,9 +1,4 @@ -import { experimentalMessage } from '../experimental'; - -if (globalThis._azleExperimental !== true) { - throw new Error(experimentalMessage('azle/experimental')); -} - +import '../experimental'; import './register_get_url'; import { Principal } from '@dfinity/principal';