diff --git a/.prettierignore b/.prettierignore index 9a401401..6bb04593 100644 --- a/.prettierignore +++ b/.prettierignore @@ -8,4 +8,4 @@ loader target -packages/did-tools/src/mocks/satellite.raw.did.mock.ts \ No newline at end of file +packages/did-tools/src/tests/mocks/satellite.raw.did.mock.ts \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index d25b1a84..6762448e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@junobuild/juno-js", - "version": "0.0.99", + "version": "0.0.101", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@junobuild/juno-js", - "version": "0.0.99", + "version": "0.0.101", "license": "MIT", "workspaces": [ "packages/utils", @@ -9167,7 +9167,7 @@ }, "packages/admin": { "name": "@junobuild/admin", - "version": "0.0.61", + "version": "0.1.0", "license": "MIT", "peerDependencies": { "@dfinity/agent": "^2.1.3", @@ -9248,7 +9248,7 @@ }, "packages/console": { "name": "@junobuild/console", - "version": "0.0.11", + "version": "0.1.0", "license": "MIT", "peerDependencies": { "@dfinity/agent": "^2.1.3", @@ -9309,7 +9309,7 @@ }, "packages/did-tools": { "name": "@junobuild/did-tools", - "version": "0.0.4", + "version": "0.0.5", "license": "MIT", "dependencies": { "@babel/core": "^7.25.2", @@ -9323,7 +9323,7 @@ }, "packages/storage": { "name": "@junobuild/storage", - "version": "0.0.8", + "version": "0.1.0", "license": "MIT", "peerDependencies": { "@dfinity/agent": "^2.1.3", diff --git a/package.json b/package.json index bbb9525a..4bc6251c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@junobuild/juno-js", - "version": "0.0.99", + "version": "0.0.101", "description": "JavaScript libraries for interfacing with Juno", "author": "David Dal Busco (https://daviddalbusco.com)", "license": "MIT", diff --git a/packages/admin/declarations/mission_control/mission_control.did.d.ts b/packages/admin/declarations/mission_control/mission_control.did.d.ts index 4697da69..b2ee93e7 100644 --- a/packages/admin/declarations/mission_control/mission_control.did.d.ts +++ b/packages/admin/declarations/mission_control/mission_control.did.d.ts @@ -6,7 +6,9 @@ export interface Account { owner: Principal; subaccount: [] | [Uint8Array | number[]]; } -export type CanisterStatusType = {stopped: null} | {stopping: null} | {running: null}; +export interface Config { + monitoring: [] | [MonitoringConfig]; +} export interface Controller { updated_at: bigint; metadata: Array<[string, string]>; @@ -19,64 +21,109 @@ export interface CreateCanisterConfig { subnet_id: [] | [Principal]; name: [] | [string]; } -export interface CronJobStatusesConfig { +export interface CyclesBalance { + timestamp: bigint; + amount: bigint; +} +export interface CyclesMonitoring { + strategy: [] | [CyclesMonitoringStrategy]; enabled: boolean; - cycles_threshold: [] | [bigint]; +} +export interface CyclesMonitoringConfig { + notification: [] | [DepositedCyclesEmailNotification]; + default_strategy: [] | [CyclesMonitoringStrategy]; +} +export interface CyclesMonitoringStartConfig { + orbiters_strategy: [] | [SegmentsMonitoringStrategy]; + mission_control_strategy: [] | [CyclesMonitoringStrategy]; + satellites_strategy: [] | [SegmentsMonitoringStrategy]; +} +export interface CyclesMonitoringStatus { + monitored_ids: Array; + running: boolean; +} +export interface CyclesMonitoringStopConfig { + satellite_ids: [] | [Array]; + try_mission_control: [] | [boolean]; + orbiter_ids: [] | [Array]; +} +export type CyclesMonitoringStrategy = {BelowThreshold: CyclesThreshold}; +export interface CyclesThreshold { + fund_cycles: bigint; + min_cycles: bigint; } export interface DepositCyclesArgs { cycles: bigint; destination_id: Principal; } +export interface DepositedCyclesEmailNotification { + to: [] | [string]; + enabled: boolean; +} +export interface GetMonitoringHistory { + to: [] | [bigint]; + from: [] | [bigint]; + segment_id: Principal; +} +export interface MissionControlSettings { + updated_at: bigint; + created_at: bigint; + monitoring: [] | [Monitoring]; +} +export interface Monitoring { + cycles: [] | [CyclesMonitoring]; +} +export interface MonitoringConfig { + cycles: [] | [CyclesMonitoringConfig]; +} +export interface MonitoringHistory { + cycles: [] | [MonitoringHistoryCycles]; +} +export interface MonitoringHistoryCycles { + deposited_cycles: [] | [CyclesBalance]; + cycles: CyclesBalance; +} +export interface MonitoringHistoryKey { + segment_id: Principal; + created_at: bigint; + nonce: number; +} +export interface MonitoringStartConfig { + cycles_config: [] | [CyclesMonitoringStartConfig]; +} +export interface MonitoringStatus { + cycles: [] | [CyclesMonitoringStatus]; +} +export interface MonitoringStopConfig { + cycles_config: [] | [CyclesMonitoringStopConfig]; +} export interface Orbiter { updated_at: bigint; orbiter_id: Principal; metadata: Array<[string, string]>; created_at: bigint; + settings: [] | [Settings]; } export type Result = {Ok: bigint} | {Err: TransferError}; export type Result_1 = {Ok: bigint} | {Err: TransferError_1}; -export type Result_2 = {Ok: SegmentStatus} | {Err: string}; export interface Satellite { updated_at: bigint; metadata: Array<[string, string]>; created_at: bigint; satellite_id: Principal; + settings: [] | [Settings]; } -export interface SegmentCanisterSettings { - freezing_threshold: bigint; - controllers: Array; - memory_allocation: bigint; - compute_allocation: bigint; -} -export interface SegmentCanisterStatus { - status: CanisterStatusType; - memory_size: bigint; - cycles: bigint; - settings: SegmentCanisterSettings; - idle_cycles_burned_per_day: bigint; - module_hash: [] | [Uint8Array | number[]]; -} -export interface SegmentStatus { - id: Principal; - status: SegmentCanisterStatus; - metadata: [] | [Array<[string, string]>]; - status_at: bigint; -} -export interface SegmentsStatuses { - orbiters: [] | [Array]; - satellites: [] | [Array]; - mission_control: Result_2; +export interface SegmentsMonitoringStrategy { + ids: Array; + strategy: CyclesMonitoringStrategy; } export interface SetController { metadata: Array<[string, string]>; scope: ControllerScope; expires_at: [] | [bigint]; } -export interface StatusesArgs { - mission_control_cycles_threshold: [] | [bigint]; - orbiters: Array<[Principal, CronJobStatusesConfig]>; - satellites: Array<[Principal, CronJobStatusesConfig]>; - cycles_threshold: [] | [bigint]; +export interface Settings { + monitoring: [] | [Monitoring]; } export interface Timestamp { timestamp_nanos: bigint; @@ -119,6 +166,13 @@ export type TransferError_1 = | {CreatedInFuture: {ledger_time: bigint}} | {TooOld: null} | {InsufficientFunds: {balance: bigint}}; +export interface User { + updated_at: bigint; + metadata: Array<[string, string]>; + user: [] | [Principal]; + created_at: bigint; + config: [] | [Config]; +} export interface _SERVICE { add_mission_control_controllers: ActorMethod<[Array], undefined>; add_satellites_controllers: ActorMethod<[Array, Array], undefined>; @@ -132,17 +186,24 @@ export interface _SERVICE { del_satellite: ActorMethod<[Principal, bigint], undefined>; del_satellites_controllers: ActorMethod<[Array, Array], undefined>; deposit_cycles: ActorMethod<[DepositCyclesArgs], undefined>; + get_config: ActorMethod<[], [] | [Config]>; + get_metadata: ActorMethod<[], Array<[string, string]>>; + get_monitoring_history: ActorMethod< + [GetMonitoringHistory], + Array<[MonitoringHistoryKey, MonitoringHistory]> + >; + get_monitoring_status: ActorMethod<[], MonitoringStatus>; + get_settings: ActorMethod<[], [] | [MissionControlSettings]>; get_user: ActorMethod<[], Principal>; + get_user_data: ActorMethod<[], User>; icp_transfer: ActorMethod<[TransferArgs], Result>; icrc_transfer: ActorMethod<[Principal, TransferArg], Result_1>; list_mission_control_controllers: ActorMethod<[], Array<[Principal, Controller]>>; - list_mission_control_statuses: ActorMethod<[], Array<[bigint, Result_2]>>; - list_orbiter_statuses: ActorMethod<[Principal], [] | [Array<[bigint, Result_2]>]>; list_orbiters: ActorMethod<[], Array<[Principal, Orbiter]>>; - list_satellite_statuses: ActorMethod<[Principal], [] | [Array<[bigint, Result_2]>]>; list_satellites: ActorMethod<[], Array<[Principal, Satellite]>>; remove_mission_control_controllers: ActorMethod<[Array], undefined>; remove_satellites_controllers: ActorMethod<[Array, Array], undefined>; + set_config: ActorMethod<[[] | [Config]], undefined>; set_metadata: ActorMethod<[Array<[string, string]>], undefined>; set_mission_control_controllers: ActorMethod<[Array, SetController], undefined>; set_orbiter: ActorMethod<[Principal, [] | [string]], Orbiter>; @@ -157,10 +218,13 @@ export interface _SERVICE { [Array, Array, SetController], undefined >; - status: ActorMethod<[StatusesArgs], SegmentsStatuses>; + start_monitoring: ActorMethod<[], undefined>; + stop_monitoring: ActorMethod<[], undefined>; top_up: ActorMethod<[Principal, Tokens], undefined>; unset_orbiter: ActorMethod<[Principal], undefined>; unset_satellite: ActorMethod<[Principal], undefined>; + update_and_start_monitoring: ActorMethod<[MonitoringStartConfig], undefined>; + update_and_stop_monitoring: ActorMethod<[MonitoringStopConfig], undefined>; version: ActorMethod<[], string>; } export declare const idlFactory: IDL.InterfaceFactory; diff --git a/packages/admin/declarations/mission_control/mission_control.factory.did.js b/packages/admin/declarations/mission_control/mission_control.factory.did.js index 71670dea..0691a02d 100644 --- a/packages/admin/declarations/mission_control/mission_control.factory.did.js +++ b/packages/admin/declarations/mission_control/mission_control.factory.did.js @@ -1,10 +1,24 @@ // @ts-ignore export const idlFactory = ({IDL}) => { + const CyclesThreshold = IDL.Record({ + fund_cycles: IDL.Nat, + min_cycles: IDL.Nat + }); + const CyclesMonitoringStrategy = IDL.Variant({ + BelowThreshold: CyclesThreshold + }); + const CyclesMonitoring = IDL.Record({ + strategy: IDL.Opt(CyclesMonitoringStrategy), + enabled: IDL.Bool + }); + const Monitoring = IDL.Record({cycles: IDL.Opt(CyclesMonitoring)}); + const Settings = IDL.Record({monitoring: IDL.Opt(Monitoring)}); const Orbiter = IDL.Record({ updated_at: IDL.Nat64, orbiter_id: IDL.Principal, metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), - created_at: IDL.Nat64 + created_at: IDL.Nat64, + settings: IDL.Opt(Settings) }); const CreateCanisterConfig = IDL.Record({ subnet_id: IDL.Opt(IDL.Principal), @@ -14,12 +28,65 @@ export const idlFactory = ({IDL}) => { updated_at: IDL.Nat64, metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), created_at: IDL.Nat64, - satellite_id: IDL.Principal + satellite_id: IDL.Principal, + settings: IDL.Opt(Settings) }); const DepositCyclesArgs = IDL.Record({ cycles: IDL.Nat, destination_id: IDL.Principal }); + const DepositedCyclesEmailNotification = IDL.Record({ + to: IDL.Opt(IDL.Text), + enabled: IDL.Bool + }); + const CyclesMonitoringConfig = IDL.Record({ + notification: IDL.Opt(DepositedCyclesEmailNotification), + default_strategy: IDL.Opt(CyclesMonitoringStrategy) + }); + const MonitoringConfig = IDL.Record({ + cycles: IDL.Opt(CyclesMonitoringConfig) + }); + const Config = IDL.Record({monitoring: IDL.Opt(MonitoringConfig)}); + const GetMonitoringHistory = IDL.Record({ + to: IDL.Opt(IDL.Nat64), + from: IDL.Opt(IDL.Nat64), + segment_id: IDL.Principal + }); + const MonitoringHistoryKey = IDL.Record({ + segment_id: IDL.Principal, + created_at: IDL.Nat64, + nonce: IDL.Int32 + }); + const CyclesBalance = IDL.Record({ + timestamp: IDL.Nat64, + amount: IDL.Nat + }); + const MonitoringHistoryCycles = IDL.Record({ + deposited_cycles: IDL.Opt(CyclesBalance), + cycles: CyclesBalance + }); + const MonitoringHistory = IDL.Record({ + cycles: IDL.Opt(MonitoringHistoryCycles) + }); + const CyclesMonitoringStatus = IDL.Record({ + monitored_ids: IDL.Vec(IDL.Principal), + running: IDL.Bool + }); + const MonitoringStatus = IDL.Record({ + cycles: IDL.Opt(CyclesMonitoringStatus) + }); + const MissionControlSettings = IDL.Record({ + updated_at: IDL.Nat64, + created_at: IDL.Nat64, + monitoring: IDL.Opt(Monitoring) + }); + const User = IDL.Record({ + updated_at: IDL.Nat64, + metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), + user: IDL.Opt(IDL.Principal), + created_at: IDL.Nat64, + config: IDL.Opt(Config) + }); const Tokens = IDL.Record({e8s: IDL.Nat64}); const Timestamp = IDL.Record({timestamp_nanos: IDL.Nat64}); const TransferArgs = IDL.Record({ @@ -75,51 +142,30 @@ export const idlFactory = ({IDL}) => { scope: ControllerScope, expires_at: IDL.Opt(IDL.Nat64) }); - const CanisterStatusType = IDL.Variant({ - stopped: IDL.Null, - stopping: IDL.Null, - running: IDL.Null - }); - const SegmentCanisterSettings = IDL.Record({ - freezing_threshold: IDL.Nat, - controllers: IDL.Vec(IDL.Principal), - memory_allocation: IDL.Nat, - compute_allocation: IDL.Nat - }); - const SegmentCanisterStatus = IDL.Record({ - status: CanisterStatusType, - memory_size: IDL.Nat, - cycles: IDL.Nat, - settings: SegmentCanisterSettings, - idle_cycles_burned_per_day: IDL.Nat, - module_hash: IDL.Opt(IDL.Vec(IDL.Nat8)) - }); - const SegmentStatus = IDL.Record({ - id: IDL.Principal, - status: SegmentCanisterStatus, - metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))), - status_at: IDL.Nat64 - }); - const Result_2 = IDL.Variant({Ok: SegmentStatus, Err: IDL.Text}); const SetController = IDL.Record({ metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)), scope: ControllerScope, expires_at: IDL.Opt(IDL.Nat64) }); - const CronJobStatusesConfig = IDL.Record({ - enabled: IDL.Bool, - cycles_threshold: IDL.Opt(IDL.Nat64) + const SegmentsMonitoringStrategy = IDL.Record({ + ids: IDL.Vec(IDL.Principal), + strategy: CyclesMonitoringStrategy + }); + const CyclesMonitoringStartConfig = IDL.Record({ + orbiters_strategy: IDL.Opt(SegmentsMonitoringStrategy), + mission_control_strategy: IDL.Opt(CyclesMonitoringStrategy), + satellites_strategy: IDL.Opt(SegmentsMonitoringStrategy) + }); + const MonitoringStartConfig = IDL.Record({ + cycles_config: IDL.Opt(CyclesMonitoringStartConfig) }); - const StatusesArgs = IDL.Record({ - mission_control_cycles_threshold: IDL.Opt(IDL.Nat64), - orbiters: IDL.Vec(IDL.Tuple(IDL.Principal, CronJobStatusesConfig)), - satellites: IDL.Vec(IDL.Tuple(IDL.Principal, CronJobStatusesConfig)), - cycles_threshold: IDL.Opt(IDL.Nat64) + const CyclesMonitoringStopConfig = IDL.Record({ + satellite_ids: IDL.Opt(IDL.Vec(IDL.Principal)), + try_mission_control: IDL.Opt(IDL.Bool), + orbiter_ids: IDL.Opt(IDL.Vec(IDL.Principal)) }); - const SegmentsStatuses = IDL.Record({ - orbiters: IDL.Opt(IDL.Vec(Result_2)), - satellites: IDL.Opt(IDL.Vec(Result_2)), - mission_control: Result_2 + const MonitoringStopConfig = IDL.Record({ + cycles_config: IDL.Opt(CyclesMonitoringStopConfig) }); return IDL.Service({ add_mission_control_controllers: IDL.Func([IDL.Vec(IDL.Principal)], [], []), @@ -134,7 +180,17 @@ export const idlFactory = ({IDL}) => { del_satellite: IDL.Func([IDL.Principal, IDL.Nat], [], []), del_satellites_controllers: IDL.Func([IDL.Vec(IDL.Principal), IDL.Vec(IDL.Principal)], [], []), deposit_cycles: IDL.Func([DepositCyclesArgs], [], []), + get_config: IDL.Func([], [IDL.Opt(Config)], ['query']), + get_metadata: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))], ['query']), + get_monitoring_history: IDL.Func( + [GetMonitoringHistory], + [IDL.Vec(IDL.Tuple(MonitoringHistoryKey, MonitoringHistory))], + ['query'] + ), + get_monitoring_status: IDL.Func([], [MonitoringStatus], ['query']), + get_settings: IDL.Func([], [IDL.Opt(MissionControlSettings)], ['query']), get_user: IDL.Func([], [IDL.Principal], ['query']), + get_user_data: IDL.Func([], [User], ['query']), icp_transfer: IDL.Func([TransferArgs], [Result], []), icrc_transfer: IDL.Func([IDL.Principal, TransferArg], [Result_1], []), list_mission_control_controllers: IDL.Func( @@ -142,22 +198,7 @@ export const idlFactory = ({IDL}) => { [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], ['query'] ), - list_mission_control_statuses: IDL.Func( - [], - [IDL.Vec(IDL.Tuple(IDL.Nat64, Result_2))], - ['query'] - ), - list_orbiter_statuses: IDL.Func( - [IDL.Principal], - [IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Nat64, Result_2)))], - ['query'] - ), list_orbiters: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, Orbiter))], ['query']), - list_satellite_statuses: IDL.Func( - [IDL.Principal], - [IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Nat64, Result_2)))], - ['query'] - ), list_satellites: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, Satellite))], ['query']), remove_mission_control_controllers: IDL.Func([IDL.Vec(IDL.Principal)], [], []), remove_satellites_controllers: IDL.Func( @@ -165,6 +206,7 @@ export const idlFactory = ({IDL}) => { [], [] ), + set_config: IDL.Func([IDL.Opt(Config)], [], []), set_metadata: IDL.Func([IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))], [], []), set_mission_control_controllers: IDL.Func([IDL.Vec(IDL.Principal), SetController], [], []), set_orbiter: IDL.Func([IDL.Principal, IDL.Opt(IDL.Text)], [Orbiter], []), @@ -189,10 +231,13 @@ export const idlFactory = ({IDL}) => { [], [] ), - status: IDL.Func([StatusesArgs], [SegmentsStatuses], []), + start_monitoring: IDL.Func([], [], []), + stop_monitoring: IDL.Func([], [], []), top_up: IDL.Func([IDL.Principal, Tokens], [], []), unset_orbiter: IDL.Func([IDL.Principal], [], []), unset_satellite: IDL.Func([IDL.Principal], [], []), + update_and_start_monitoring: IDL.Func([MonitoringStartConfig], [], []), + update_and_stop_monitoring: IDL.Func([MonitoringStopConfig], [], []), version: IDL.Func([], [IDL.Text], ['query']) }); }; diff --git a/packages/admin/package.json b/packages/admin/package.json index 7b6ce518..e1e99168 100644 --- a/packages/admin/package.json +++ b/packages/admin/package.json @@ -1,6 +1,6 @@ { "name": "@junobuild/admin", - "version": "0.0.61", + "version": "0.1.0", "description": "A library for interfacing with admin features of Juno", "author": "David Dal Busco (https://daviddalbusco.com)", "license": "MIT", diff --git a/packages/console/declarations/console/console.did.d.ts b/packages/console/declarations/console/console.did.d.ts index 9d1eb672..045681ec 100644 --- a/packages/console/declarations/console/console.did.d.ts +++ b/packages/console/declarations/console/console.did.d.ts @@ -160,7 +160,7 @@ export interface RateConfig { max_tokens: bigint; time_per_token_ns: bigint; } -export type SegmentType = {Orbiter: null} | {MissionControl: null} | {Satellite: null}; +export type SegmentKind = {Orbiter: null} | {MissionControl: null} | {Satellite: null}; export interface SegmentsDeploymentOptions { orbiter: [] | [string]; mission_control_version: [] | [string]; @@ -256,10 +256,10 @@ export interface _SERVICE { list_user_mission_control_centers: ActorMethod<[], Array<[Principal, MissionControl]>>; set_controllers: ActorMethod<[SetControllersArgs], undefined>; set_custom_domain: ActorMethod<[string, [] | [string]], undefined>; - set_fee: ActorMethod<[SegmentType, Tokens], undefined>; + set_fee: ActorMethod<[SegmentKind, Tokens], undefined>; set_storage_config: ActorMethod<[StorageConfig], undefined>; submit_proposal: ActorMethod<[bigint], [bigint, Proposal]>; - update_rate_config: ActorMethod<[SegmentType, RateConfig], undefined>; + update_rate_config: ActorMethod<[SegmentKind, RateConfig], undefined>; upload_asset_chunk: ActorMethod<[UploadChunk], UploadChunkResult>; version: ActorMethod<[], string>; } diff --git a/packages/console/declarations/console/console.factory.did.js b/packages/console/declarations/console/console.factory.did.js index 07fa7ca2..9e4e9ce1 100644 --- a/packages/console/declarations/console/console.factory.did.js +++ b/packages/console/declarations/console/console.factory.did.js @@ -219,7 +219,7 @@ export const idlFactory = ({IDL}) => { controller: SetController, controllers: IDL.Vec(IDL.Principal) }); - const SegmentType = IDL.Variant({ + const SegmentKind = IDL.Variant({ Orbiter: IDL.Null, MissionControl: IDL.Null, Satellite: IDL.Null @@ -271,10 +271,10 @@ export const idlFactory = ({IDL}) => { ), set_controllers: IDL.Func([SetControllersArgs], [], []), set_custom_domain: IDL.Func([IDL.Text, IDL.Opt(IDL.Text)], [], []), - set_fee: IDL.Func([SegmentType, Tokens], [], []), + set_fee: IDL.Func([SegmentKind, Tokens], [], []), set_storage_config: IDL.Func([StorageConfig], [], []), submit_proposal: IDL.Func([IDL.Nat], [IDL.Nat, Proposal], []), - update_rate_config: IDL.Func([SegmentType, RateConfig], [], []), + update_rate_config: IDL.Func([SegmentKind, RateConfig], [], []), upload_asset_chunk: IDL.Func([UploadChunk], [UploadChunkResult], []), version: IDL.Func([], [IDL.Text], ['query']) }); diff --git a/packages/console/declarations/console/console.factory.did.mjs b/packages/console/declarations/console/console.factory.did.mjs index 07fa7ca2..9e4e9ce1 100644 --- a/packages/console/declarations/console/console.factory.did.mjs +++ b/packages/console/declarations/console/console.factory.did.mjs @@ -219,7 +219,7 @@ export const idlFactory = ({IDL}) => { controller: SetController, controllers: IDL.Vec(IDL.Principal) }); - const SegmentType = IDL.Variant({ + const SegmentKind = IDL.Variant({ Orbiter: IDL.Null, MissionControl: IDL.Null, Satellite: IDL.Null @@ -271,10 +271,10 @@ export const idlFactory = ({IDL}) => { ), set_controllers: IDL.Func([SetControllersArgs], [], []), set_custom_domain: IDL.Func([IDL.Text, IDL.Opt(IDL.Text)], [], []), - set_fee: IDL.Func([SegmentType, Tokens], [], []), + set_fee: IDL.Func([SegmentKind, Tokens], [], []), set_storage_config: IDL.Func([StorageConfig], [], []), submit_proposal: IDL.Func([IDL.Nat], [IDL.Nat, Proposal], []), - update_rate_config: IDL.Func([SegmentType, RateConfig], [], []), + update_rate_config: IDL.Func([SegmentKind, RateConfig], [], []), upload_asset_chunk: IDL.Func([UploadChunk], [UploadChunkResult], []), version: IDL.Func([], [IDL.Text], ['query']) }); diff --git a/packages/console/package.json b/packages/console/package.json index b60ea191..7b6f2052 100644 --- a/packages/console/package.json +++ b/packages/console/package.json @@ -1,6 +1,6 @@ { "name": "@junobuild/console", - "version": "0.0.11", + "version": "0.1.0", "description": "A library for interfacing with Juno's Console", "author": "David Dal Busco (https://daviddalbusco.com)", "license": "MIT", diff --git a/packages/did-tools/package.json b/packages/did-tools/package.json index 3c386bd5..0cd0264c 100644 --- a/packages/did-tools/package.json +++ b/packages/did-tools/package.json @@ -1,6 +1,6 @@ { "name": "@junobuild/did-tools", - "version": "0.0.4", + "version": "0.0.5", "description": "Tools for generating APIs from DID files.", "author": "David Dal Busco (https://daviddalbusco.com)", "license": "MIT", diff --git a/packages/did-tools/src/mocks/method-signatures.mock.ts b/packages/did-tools/src/tests/mocks/method-signatures.mock.ts similarity index 100% rename from packages/did-tools/src/mocks/method-signatures.mock.ts rename to packages/did-tools/src/tests/mocks/method-signatures.mock.ts diff --git a/packages/did-tools/src/mocks/satellite.formatted.did.mock.ts b/packages/did-tools/src/tests/mocks/satellite.formatted.did.mock.ts similarity index 100% rename from packages/did-tools/src/mocks/satellite.formatted.did.mock.ts rename to packages/did-tools/src/tests/mocks/satellite.formatted.did.mock.ts diff --git a/packages/did-tools/src/mocks/satellite.raw.did.mock.ts b/packages/did-tools/src/tests/mocks/satellite.raw.did.mock.ts similarity index 100% rename from packages/did-tools/src/mocks/satellite.raw.did.mock.ts rename to packages/did-tools/src/tests/mocks/satellite.raw.did.mock.ts diff --git a/packages/did-tools/src/mocks/transfomer.mock.ts b/packages/did-tools/src/tests/mocks/transfomer.mock.ts similarity index 100% rename from packages/did-tools/src/mocks/transfomer.mock.ts rename to packages/did-tools/src/tests/mocks/transfomer.mock.ts diff --git a/packages/did-tools/src/services/inspector.services.spec.ts b/packages/did-tools/src/tests/services/inspector.services.spec.ts similarity index 92% rename from packages/did-tools/src/services/inspector.services.spec.ts rename to packages/did-tools/src/tests/services/inspector.services.spec.ts index 335f0d54..ad28da85 100644 --- a/packages/did-tools/src/services/inspector.services.spec.ts +++ b/packages/did-tools/src/tests/services/inspector.services.spec.ts @@ -1,6 +1,6 @@ import {join} from 'node:path'; +import {collectApi} from '../../services/inspector.services'; import {mockImports, mockMethodSignatures} from '../mocks/method-signatures.mock'; -import {collectApi} from './inspector.services'; describe('inspector-services', () => { it('should collect method signatures if did file has been formatted with prettier', async () => { @@ -10,6 +10,7 @@ describe('inspector-services', () => { 'packages', 'did-tools', 'src', + 'tests', 'mocks', 'satellite.formatted.did.mock.ts' ) @@ -25,6 +26,7 @@ describe('inspector-services', () => { 'packages', 'did-tools', 'src', + 'tests', 'mocks', 'satellite.raw.did.mock.ts' ) @@ -40,6 +42,7 @@ describe('inspector-services', () => { 'packages', 'did-tools', 'src', + 'tests', 'mocks', 'satellite.formatted.did.mock.ts' ) @@ -55,6 +58,7 @@ describe('inspector-services', () => { 'packages', 'did-tools', 'src', + 'tests', 'mocks', 'satellite.raw.did.mock.ts' ) diff --git a/packages/did-tools/src/services/parser.services.spec.ts b/packages/did-tools/src/tests/services/parser.services.spec.ts similarity index 91% rename from packages/did-tools/src/services/parser.services.spec.ts rename to packages/did-tools/src/tests/services/parser.services.spec.ts index 40f6e3f8..ddb9b7a0 100644 --- a/packages/did-tools/src/services/parser.services.spec.ts +++ b/packages/did-tools/src/tests/services/parser.services.spec.ts @@ -1,6 +1,6 @@ +import {parseApi} from '../../services/parser.services'; import {mockImports, mockMethodSignatures} from '../mocks/method-signatures.mock'; import {mockTransformedCoreJS, mockTransformedCoreTS} from '../mocks/transfomer.mock'; -import {parseApi} from './parser.services'; describe('parser-services', () => { it('should parse TypeScript with core lib', () => { @@ -27,18 +27,18 @@ describe('parser-services', () => { expect(result.trim()).toEqual(mockTransformedCoreJS); }); - it('should import from core-peer', () => { + it('should import from core-standalone', () => { const result = parseApi({ methods: mockMethodSignatures, imports: [], transformerOptions: { outputLanguage: 'ts', - coreLib: 'core-peer' + coreLib: 'core-standalone' } }); expect(result.trim()).toContain( - "import {getSatelliteExtendedActor} from '@junobuild/core-peer';" + "import {getSatelliteExtendedActor} from '@junobuild/core-standalone';" ); }); diff --git a/packages/did-tools/src/tests/tsconfig.json b/packages/did-tools/src/tests/tsconfig.json new file mode 100644 index 00000000..e7f236e4 --- /dev/null +++ b/packages/did-tools/src/tests/tsconfig.json @@ -0,0 +1,3 @@ +{ + "extends": "../../../../tsconfig.spec.json" +} diff --git a/packages/did-tools/src/types/transformer-options.ts b/packages/did-tools/src/types/transformer-options.ts index 4eab7de0..d77b5022 100644 --- a/packages/did-tools/src/types/transformer-options.ts +++ b/packages/did-tools/src/types/transformer-options.ts @@ -1,4 +1,4 @@ export interface TransformerOptions { outputLanguage: 'js' | 'ts'; - coreLib?: 'core' | 'core-peer'; + coreLib?: 'core' | 'core-standalone'; } diff --git a/packages/storage/declarations/console/console.did.d.ts b/packages/storage/declarations/console/console.did.d.ts index 9d1eb672..045681ec 100644 --- a/packages/storage/declarations/console/console.did.d.ts +++ b/packages/storage/declarations/console/console.did.d.ts @@ -160,7 +160,7 @@ export interface RateConfig { max_tokens: bigint; time_per_token_ns: bigint; } -export type SegmentType = {Orbiter: null} | {MissionControl: null} | {Satellite: null}; +export type SegmentKind = {Orbiter: null} | {MissionControl: null} | {Satellite: null}; export interface SegmentsDeploymentOptions { orbiter: [] | [string]; mission_control_version: [] | [string]; @@ -256,10 +256,10 @@ export interface _SERVICE { list_user_mission_control_centers: ActorMethod<[], Array<[Principal, MissionControl]>>; set_controllers: ActorMethod<[SetControllersArgs], undefined>; set_custom_domain: ActorMethod<[string, [] | [string]], undefined>; - set_fee: ActorMethod<[SegmentType, Tokens], undefined>; + set_fee: ActorMethod<[SegmentKind, Tokens], undefined>; set_storage_config: ActorMethod<[StorageConfig], undefined>; submit_proposal: ActorMethod<[bigint], [bigint, Proposal]>; - update_rate_config: ActorMethod<[SegmentType, RateConfig], undefined>; + update_rate_config: ActorMethod<[SegmentKind, RateConfig], undefined>; upload_asset_chunk: ActorMethod<[UploadChunk], UploadChunkResult>; version: ActorMethod<[], string>; } diff --git a/packages/storage/declarations/console/console.factory.did.js b/packages/storage/declarations/console/console.factory.did.js index 07fa7ca2..9e4e9ce1 100644 --- a/packages/storage/declarations/console/console.factory.did.js +++ b/packages/storage/declarations/console/console.factory.did.js @@ -219,7 +219,7 @@ export const idlFactory = ({IDL}) => { controller: SetController, controllers: IDL.Vec(IDL.Principal) }); - const SegmentType = IDL.Variant({ + const SegmentKind = IDL.Variant({ Orbiter: IDL.Null, MissionControl: IDL.Null, Satellite: IDL.Null @@ -271,10 +271,10 @@ export const idlFactory = ({IDL}) => { ), set_controllers: IDL.Func([SetControllersArgs], [], []), set_custom_domain: IDL.Func([IDL.Text, IDL.Opt(IDL.Text)], [], []), - set_fee: IDL.Func([SegmentType, Tokens], [], []), + set_fee: IDL.Func([SegmentKind, Tokens], [], []), set_storage_config: IDL.Func([StorageConfig], [], []), submit_proposal: IDL.Func([IDL.Nat], [IDL.Nat, Proposal], []), - update_rate_config: IDL.Func([SegmentType, RateConfig], [], []), + update_rate_config: IDL.Func([SegmentKind, RateConfig], [], []), upload_asset_chunk: IDL.Func([UploadChunk], [UploadChunkResult], []), version: IDL.Func([], [IDL.Text], ['query']) }); diff --git a/packages/storage/declarations/console/console.factory.did.mjs b/packages/storage/declarations/console/console.factory.did.mjs index 07fa7ca2..9e4e9ce1 100644 --- a/packages/storage/declarations/console/console.factory.did.mjs +++ b/packages/storage/declarations/console/console.factory.did.mjs @@ -219,7 +219,7 @@ export const idlFactory = ({IDL}) => { controller: SetController, controllers: IDL.Vec(IDL.Principal) }); - const SegmentType = IDL.Variant({ + const SegmentKind = IDL.Variant({ Orbiter: IDL.Null, MissionControl: IDL.Null, Satellite: IDL.Null @@ -271,10 +271,10 @@ export const idlFactory = ({IDL}) => { ), set_controllers: IDL.Func([SetControllersArgs], [], []), set_custom_domain: IDL.Func([IDL.Text, IDL.Opt(IDL.Text)], [], []), - set_fee: IDL.Func([SegmentType, Tokens], [], []), + set_fee: IDL.Func([SegmentKind, Tokens], [], []), set_storage_config: IDL.Func([StorageConfig], [], []), submit_proposal: IDL.Func([IDL.Nat], [IDL.Nat, Proposal], []), - update_rate_config: IDL.Func([SegmentType, RateConfig], [], []), + update_rate_config: IDL.Func([SegmentKind, RateConfig], [], []), upload_asset_chunk: IDL.Func([UploadChunk], [UploadChunkResult], []), version: IDL.Func([], [IDL.Text], ['query']) }); diff --git a/packages/storage/package.json b/packages/storage/package.json index efd7b4b2..efe94ed2 100644 --- a/packages/storage/package.json +++ b/packages/storage/package.json @@ -1,6 +1,6 @@ { "name": "@junobuild/storage", - "version": "0.0.8", + "version": "0.1.0", "description": "A library for interfacing with Juno's Storage features.", "author": "David Dal Busco (https://daviddalbusco.com)", "license": "MIT", diff --git a/vitest.config.ts b/vitest.config.ts index 93584efb..407d1ad9 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -6,6 +6,7 @@ export default defineConfig({ passWithNoTests: true, typecheck: { tsconfig: 'tsconfig.spec.json' - } + }, + globals: true } }); diff --git a/vitest.workspace.ts b/vitest.workspace.ts deleted file mode 100644 index 254bcee5..00000000 --- a/vitest.workspace.ts +++ /dev/null @@ -1,10 +0,0 @@ -import {defineWorkspace} from 'vitest/config'; - -export default defineWorkspace([ - 'packages/**/*.spec.ts', - { - test: { - globals: true - } - } -]);