From f7ee9c3b58e4ad314a73e229c1675b86efefb996 Mon Sep 17 00:00:00 2001 From: Benjamin DeMann Date: Mon, 2 Oct 2023 12:33:22 -0600 Subject: [PATCH] move lib_functional to lib --- canisters/icrc/errors.ts | 2 +- canisters/icrc/icrc_1.ts | 2 +- canisters/icrc/icrc_2.ts | 11 +---------- canisters/icrc/index.ts | 2 +- canisters/ledger/index.ts | 2 +- canisters/management/bitcoin.ts | 2 +- canisters/management/canister_management.ts | 2 +- canisters/management/http_request.ts | 2 +- canisters/management/index.ts | 9 +-------- canisters/management/t_ecdsa.ts | 2 +- package.json | 2 +- src/compiler/generate_candid_and_canister_methods.ts | 2 +- src/{lib_functional => lib}/candid/index.ts | 0 src/{lib_functional => lib}/candid/primitive.ts | 0 src/{lib_functional => lib}/candid/reference/func.ts | 0 src/{lib_functional => lib}/candid/reference/index.ts | 0 .../candid/reference/primitives.ts | 0 .../candid/reference/record.ts | 0 .../candid/reference/recursive.ts | 0 .../candid/reference/result.ts | 0 .../candid/reference/service.ts | 0 .../candid/reference/variant.ts | 0 src/{lib_functional => lib}/candid/serde.ts | 0 .../canister_methods/heartbeat.ts | 0 src/{lib_functional => lib}/canister_methods/index.ts | 0 src/{lib_functional => lib}/canister_methods/init.ts | 2 +- .../canister_methods/inspect_message.ts | 0 .../canister_methods/post_upgrade.ts | 0 .../canister_methods/pre_upgrade.ts | 0 src/{lib_functional => lib}/canister_methods/query.ts | 0 .../canister_methods/update.ts | 0 src/{lib_functional => lib}/globals.ts | 0 src/{lib_functional => lib}/ic.ts | 0 src/{lib_functional => lib}/index.ts | 0 src/{lib_functional => lib}/stable_b_tree_map.ts | 0 src/{lib_functional => lib}/utils.ts | 0 src/{lib_functional => lib}/visitors/did_visitor.ts | 0 .../visitors/encode_decode/decode_visitor.ts | 0 .../visitors/encode_decode/encode_visitor.ts | 0 .../visitors/encode_decode/index.ts | 0 40 files changed, 13 insertions(+), 29 deletions(-) rename src/{lib_functional => lib}/candid/index.ts (100%) rename src/{lib_functional => lib}/candid/primitive.ts (100%) rename src/{lib_functional => lib}/candid/reference/func.ts (100%) rename src/{lib_functional => lib}/candid/reference/index.ts (100%) rename src/{lib_functional => lib}/candid/reference/primitives.ts (100%) rename src/{lib_functional => lib}/candid/reference/record.ts (100%) rename src/{lib_functional => lib}/candid/reference/recursive.ts (100%) rename src/{lib_functional => lib}/candid/reference/result.ts (100%) rename src/{lib_functional => lib}/candid/reference/service.ts (100%) rename src/{lib_functional => lib}/candid/reference/variant.ts (100%) rename src/{lib_functional => lib}/candid/serde.ts (100%) rename src/{lib_functional => lib}/canister_methods/heartbeat.ts (100%) rename src/{lib_functional => lib}/canister_methods/index.ts (100%) rename src/{lib_functional => lib}/canister_methods/init.ts (97%) rename src/{lib_functional => lib}/canister_methods/inspect_message.ts (100%) rename src/{lib_functional => lib}/canister_methods/post_upgrade.ts (100%) rename src/{lib_functional => lib}/canister_methods/pre_upgrade.ts (100%) rename src/{lib_functional => lib}/canister_methods/query.ts (100%) rename src/{lib_functional => lib}/canister_methods/update.ts (100%) rename src/{lib_functional => lib}/globals.ts (100%) rename src/{lib_functional => lib}/ic.ts (100%) rename src/{lib_functional => lib}/index.ts (100%) rename src/{lib_functional => lib}/stable_b_tree_map.ts (100%) rename src/{lib_functional => lib}/utils.ts (100%) rename src/{lib_functional => lib}/visitors/did_visitor.ts (100%) rename src/{lib_functional => lib}/visitors/encode_decode/decode_visitor.ts (100%) rename src/{lib_functional => lib}/visitors/encode_decode/encode_visitor.ts (100%) rename src/{lib_functional => lib}/visitors/encode_decode/index.ts (100%) diff --git a/canisters/icrc/errors.ts b/canisters/icrc/errors.ts index ac93500711..4d613f35bd 100644 --- a/canisters/icrc/errors.ts +++ b/canisters/icrc/errors.ts @@ -1,4 +1,4 @@ -import { nat, Record, text } from '../../src/lib_functional'; +import { nat, Record, text } from '../../src/lib'; export const BadFee = Record({ expected_fee: nat diff --git a/canisters/icrc/icrc_1.ts b/canisters/icrc/icrc_1.ts index 924ac6d2c7..16c764b418 100644 --- a/canisters/icrc/icrc_1.ts +++ b/canisters/icrc/icrc_1.ts @@ -9,7 +9,7 @@ import { Record, text, Variant -} from '../../src/lib_functional'; +} from '../../src/lib'; import { BadBurn, BadFee, diff --git a/canisters/icrc/icrc_2.ts b/canisters/icrc/icrc_2.ts index 42777ed7d8..33cd54da48 100644 --- a/canisters/icrc/icrc_2.ts +++ b/canisters/icrc/icrc_2.ts @@ -1,13 +1,4 @@ -import { - blob, - nat, - nat64, - Null, - Opt, - Principal, - Record, - Variant -} from '../../src/lib_functional'; +import { blob, nat, nat64, Null, Opt, Record, Variant } from '../../src/lib'; import { BadFee, diff --git a/canisters/icrc/index.ts b/canisters/icrc/index.ts index 9af9851f7b..16cbc5d529 100644 --- a/canisters/icrc/index.ts +++ b/canisters/icrc/index.ts @@ -9,7 +9,7 @@ import { text, Tuple, Vec -} from '../../src/lib_functional'; +} from '../../src/lib'; import { Account, TransferArgs, TransferResult, Value } from './icrc_1'; import { AllowanceArgs, diff --git a/canisters/ledger/index.ts b/canisters/ledger/index.ts index 0b0c95b092..acea991e35 100644 --- a/canisters/ledger/index.ts +++ b/canisters/ledger/index.ts @@ -24,7 +24,7 @@ import { Vec, Principal, Func -} from '../../src/lib_functional'; +} from '../../src/lib'; import * as icrc from '../icrc'; // Amount of tokens, measured in 10^-8 of a token. diff --git a/canisters/management/bitcoin.ts b/canisters/management/bitcoin.ts index 057a08e685..2345f6bbd2 100644 --- a/canisters/management/bitcoin.ts +++ b/canisters/management/bitcoin.ts @@ -10,7 +10,7 @@ import { text, Variant, Vec -} from '../../src/lib_functional'; +} from '../../src/lib'; export type BitcoinAddress = text; export const BitcoinAddress = text; diff --git a/canisters/management/canister_management.ts b/canisters/management/canister_management.ts index 87b8dc771b..60bc6a0de4 100644 --- a/canisters/management/canister_management.ts +++ b/canisters/management/canister_management.ts @@ -7,7 +7,7 @@ import { Variant, Null, blob -} from '../../src/lib_functional'; +} from '../../src/lib'; export const CanisterId = Principal; export const UserId = Principal; diff --git a/canisters/management/http_request.ts b/canisters/management/http_request.ts index 8ee0a02283..f69a8d5151 100644 --- a/canisters/management/http_request.ts +++ b/canisters/management/http_request.ts @@ -9,7 +9,7 @@ import { nat64, nat, Func -} from '../../src/lib_functional'; +} from '../../src/lib'; export const HttpHeader = Record({ name: text, diff --git a/canisters/management/index.ts b/canisters/management/index.ts index 4202551d9c..ac94027b2f 100644 --- a/canisters/management/index.ts +++ b/canisters/management/index.ts @@ -1,11 +1,4 @@ -import { - blob, - Canister, - Principal, - update, - Vec, - Void -} from '../../src/lib_functional'; +import { blob, Canister, Principal, update, Vec, Void } from '../../src/lib'; import { GetBalanceArgs, GetCurrentFeePercentilesArgs, diff --git a/canisters/management/t_ecdsa.ts b/canisters/management/t_ecdsa.ts index 6bbc4b6d13..a5bb44846a 100644 --- a/canisters/management/t_ecdsa.ts +++ b/canisters/management/t_ecdsa.ts @@ -7,7 +7,7 @@ import { text, Variant, Vec -} from '../../src/lib_functional'; +} from '../../src/lib'; export const EcdsaCurve = Variant({ secp256k1: Null diff --git a/package.json b/package.json index 60cbe550ad..2f2164e8bc 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "bin": { "azle": "./bin.js" }, - "main": "./src/lib_functional/index.ts", + "main": "./src/lib/index.ts", "repository": { "type": "git", "url": "git+https://github.com/demergent-labs/azle.git" diff --git a/src/compiler/generate_candid_and_canister_methods.ts b/src/compiler/generate_candid_and_canister_methods.ts index fa05264e58..6a2da1984c 100644 --- a/src/compiler/generate_candid_and_canister_methods.ts +++ b/src/compiler/generate_candid_and_canister_methods.ts @@ -3,7 +3,7 @@ import { DEFAULT_VISITOR_DATA, DidResultToCandidString, DidVisitor -} from '../lib_functional/visitors/did_visitor'; +} from '../lib/visitors/did_visitor'; export function generateCandidAndCanisterMethods(mainJs: string): { candid: string; diff --git a/src/lib_functional/candid/index.ts b/src/lib/candid/index.ts similarity index 100% rename from src/lib_functional/candid/index.ts rename to src/lib/candid/index.ts diff --git a/src/lib_functional/candid/primitive.ts b/src/lib/candid/primitive.ts similarity index 100% rename from src/lib_functional/candid/primitive.ts rename to src/lib/candid/primitive.ts diff --git a/src/lib_functional/candid/reference/func.ts b/src/lib/candid/reference/func.ts similarity index 100% rename from src/lib_functional/candid/reference/func.ts rename to src/lib/candid/reference/func.ts diff --git a/src/lib_functional/candid/reference/index.ts b/src/lib/candid/reference/index.ts similarity index 100% rename from src/lib_functional/candid/reference/index.ts rename to src/lib/candid/reference/index.ts diff --git a/src/lib_functional/candid/reference/primitives.ts b/src/lib/candid/reference/primitives.ts similarity index 100% rename from src/lib_functional/candid/reference/primitives.ts rename to src/lib/candid/reference/primitives.ts diff --git a/src/lib_functional/candid/reference/record.ts b/src/lib/candid/reference/record.ts similarity index 100% rename from src/lib_functional/candid/reference/record.ts rename to src/lib/candid/reference/record.ts diff --git a/src/lib_functional/candid/reference/recursive.ts b/src/lib/candid/reference/recursive.ts similarity index 100% rename from src/lib_functional/candid/reference/recursive.ts rename to src/lib/candid/reference/recursive.ts diff --git a/src/lib_functional/candid/reference/result.ts b/src/lib/candid/reference/result.ts similarity index 100% rename from src/lib_functional/candid/reference/result.ts rename to src/lib/candid/reference/result.ts diff --git a/src/lib_functional/candid/reference/service.ts b/src/lib/candid/reference/service.ts similarity index 100% rename from src/lib_functional/candid/reference/service.ts rename to src/lib/candid/reference/service.ts diff --git a/src/lib_functional/candid/reference/variant.ts b/src/lib/candid/reference/variant.ts similarity index 100% rename from src/lib_functional/candid/reference/variant.ts rename to src/lib/candid/reference/variant.ts diff --git a/src/lib_functional/candid/serde.ts b/src/lib/candid/serde.ts similarity index 100% rename from src/lib_functional/candid/serde.ts rename to src/lib/candid/serde.ts diff --git a/src/lib_functional/canister_methods/heartbeat.ts b/src/lib/canister_methods/heartbeat.ts similarity index 100% rename from src/lib_functional/canister_methods/heartbeat.ts rename to src/lib/canister_methods/heartbeat.ts diff --git a/src/lib_functional/canister_methods/index.ts b/src/lib/canister_methods/index.ts similarity index 100% rename from src/lib_functional/canister_methods/index.ts rename to src/lib/canister_methods/index.ts diff --git a/src/lib_functional/canister_methods/init.ts b/src/lib/canister_methods/init.ts similarity index 97% rename from src/lib_functional/canister_methods/init.ts rename to src/lib/canister_methods/init.ts index def061ce6c..62f36f94f2 100644 --- a/src/lib_functional/canister_methods/init.ts +++ b/src/lib/canister_methods/init.ts @@ -1,6 +1,6 @@ import { Callback, CanisterMethodInfo, createParents, executeMethod } from '.'; import { CandidType, TypeMapping } from '../candid'; -import { Void } from '../../lib_functional'; +import { Void } from '../'; import { toParamIDLTypes, toReturnIDLType } from '../utils'; export function init< diff --git a/src/lib_functional/canister_methods/inspect_message.ts b/src/lib/canister_methods/inspect_message.ts similarity index 100% rename from src/lib_functional/canister_methods/inspect_message.ts rename to src/lib/canister_methods/inspect_message.ts diff --git a/src/lib_functional/canister_methods/post_upgrade.ts b/src/lib/canister_methods/post_upgrade.ts similarity index 100% rename from src/lib_functional/canister_methods/post_upgrade.ts rename to src/lib/canister_methods/post_upgrade.ts diff --git a/src/lib_functional/canister_methods/pre_upgrade.ts b/src/lib/canister_methods/pre_upgrade.ts similarity index 100% rename from src/lib_functional/canister_methods/pre_upgrade.ts rename to src/lib/canister_methods/pre_upgrade.ts diff --git a/src/lib_functional/canister_methods/query.ts b/src/lib/canister_methods/query.ts similarity index 100% rename from src/lib_functional/canister_methods/query.ts rename to src/lib/canister_methods/query.ts diff --git a/src/lib_functional/canister_methods/update.ts b/src/lib/canister_methods/update.ts similarity index 100% rename from src/lib_functional/canister_methods/update.ts rename to src/lib/canister_methods/update.ts diff --git a/src/lib_functional/globals.ts b/src/lib/globals.ts similarity index 100% rename from src/lib_functional/globals.ts rename to src/lib/globals.ts diff --git a/src/lib_functional/ic.ts b/src/lib/ic.ts similarity index 100% rename from src/lib_functional/ic.ts rename to src/lib/ic.ts diff --git a/src/lib_functional/index.ts b/src/lib/index.ts similarity index 100% rename from src/lib_functional/index.ts rename to src/lib/index.ts diff --git a/src/lib_functional/stable_b_tree_map.ts b/src/lib/stable_b_tree_map.ts similarity index 100% rename from src/lib_functional/stable_b_tree_map.ts rename to src/lib/stable_b_tree_map.ts diff --git a/src/lib_functional/utils.ts b/src/lib/utils.ts similarity index 100% rename from src/lib_functional/utils.ts rename to src/lib/utils.ts diff --git a/src/lib_functional/visitors/did_visitor.ts b/src/lib/visitors/did_visitor.ts similarity index 100% rename from src/lib_functional/visitors/did_visitor.ts rename to src/lib/visitors/did_visitor.ts diff --git a/src/lib_functional/visitors/encode_decode/decode_visitor.ts b/src/lib/visitors/encode_decode/decode_visitor.ts similarity index 100% rename from src/lib_functional/visitors/encode_decode/decode_visitor.ts rename to src/lib/visitors/encode_decode/decode_visitor.ts diff --git a/src/lib_functional/visitors/encode_decode/encode_visitor.ts b/src/lib/visitors/encode_decode/encode_visitor.ts similarity index 100% rename from src/lib_functional/visitors/encode_decode/encode_visitor.ts rename to src/lib/visitors/encode_decode/encode_visitor.ts diff --git a/src/lib_functional/visitors/encode_decode/index.ts b/src/lib/visitors/encode_decode/index.ts similarity index 100% rename from src/lib_functional/visitors/encode_decode/index.ts rename to src/lib/visitors/encode_decode/index.ts