@junobuild/admin 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/declarations/mission_control/mission_control.did.d.ts +101 -37
- package/dist/declarations/mission_control/mission_control.factory.did.js +101 -56
- package/dist/node/index.mjs +1 -1
- package/dist/node/index.mjs.map +3 -3
- package/package.json +3 -3
|
@@ -6,7 +6,9 @@ export interface Account {
|
|
|
6
6
|
owner: Principal;
|
|
7
7
|
subaccount: [] | [Uint8Array | number[]];
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export interface Config {
|
|
10
|
+
monitoring: [] | [MonitoringConfig];
|
|
11
|
+
}
|
|
10
12
|
export interface Controller {
|
|
11
13
|
updated_at: bigint;
|
|
12
14
|
metadata: Array<[string, string]>;
|
|
@@ -19,64 +21,109 @@ export interface CreateCanisterConfig {
|
|
|
19
21
|
subnet_id: [] | [Principal];
|
|
20
22
|
name: [] | [string];
|
|
21
23
|
}
|
|
22
|
-
export interface
|
|
24
|
+
export interface CyclesBalance {
|
|
25
|
+
timestamp: bigint;
|
|
26
|
+
amount: bigint;
|
|
27
|
+
}
|
|
28
|
+
export interface CyclesMonitoring {
|
|
29
|
+
strategy: [] | [CyclesMonitoringStrategy];
|
|
23
30
|
enabled: boolean;
|
|
24
|
-
|
|
31
|
+
}
|
|
32
|
+
export interface CyclesMonitoringConfig {
|
|
33
|
+
notification: [] | [DepositedCyclesEmailNotification];
|
|
34
|
+
default_strategy: [] | [CyclesMonitoringStrategy];
|
|
35
|
+
}
|
|
36
|
+
export interface CyclesMonitoringStartConfig {
|
|
37
|
+
orbiters_strategy: [] | [SegmentsMonitoringStrategy];
|
|
38
|
+
mission_control_strategy: [] | [CyclesMonitoringStrategy];
|
|
39
|
+
satellites_strategy: [] | [SegmentsMonitoringStrategy];
|
|
40
|
+
}
|
|
41
|
+
export interface CyclesMonitoringStatus {
|
|
42
|
+
monitored_ids: Array<Principal>;
|
|
43
|
+
running: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface CyclesMonitoringStopConfig {
|
|
46
|
+
satellite_ids: [] | [Array<Principal>];
|
|
47
|
+
try_mission_control: [] | [boolean];
|
|
48
|
+
orbiter_ids: [] | [Array<Principal>];
|
|
49
|
+
}
|
|
50
|
+
export type CyclesMonitoringStrategy = {BelowThreshold: CyclesThreshold};
|
|
51
|
+
export interface CyclesThreshold {
|
|
52
|
+
fund_cycles: bigint;
|
|
53
|
+
min_cycles: bigint;
|
|
25
54
|
}
|
|
26
55
|
export interface DepositCyclesArgs {
|
|
27
56
|
cycles: bigint;
|
|
28
57
|
destination_id: Principal;
|
|
29
58
|
}
|
|
59
|
+
export interface DepositedCyclesEmailNotification {
|
|
60
|
+
to: [] | [string];
|
|
61
|
+
enabled: boolean;
|
|
62
|
+
}
|
|
63
|
+
export interface GetMonitoringHistory {
|
|
64
|
+
to: [] | [bigint];
|
|
65
|
+
from: [] | [bigint];
|
|
66
|
+
segment_id: Principal;
|
|
67
|
+
}
|
|
68
|
+
export interface MissionControlSettings {
|
|
69
|
+
updated_at: bigint;
|
|
70
|
+
created_at: bigint;
|
|
71
|
+
monitoring: [] | [Monitoring];
|
|
72
|
+
}
|
|
73
|
+
export interface Monitoring {
|
|
74
|
+
cycles: [] | [CyclesMonitoring];
|
|
75
|
+
}
|
|
76
|
+
export interface MonitoringConfig {
|
|
77
|
+
cycles: [] | [CyclesMonitoringConfig];
|
|
78
|
+
}
|
|
79
|
+
export interface MonitoringHistory {
|
|
80
|
+
cycles: [] | [MonitoringHistoryCycles];
|
|
81
|
+
}
|
|
82
|
+
export interface MonitoringHistoryCycles {
|
|
83
|
+
deposited_cycles: [] | [CyclesBalance];
|
|
84
|
+
cycles: CyclesBalance;
|
|
85
|
+
}
|
|
86
|
+
export interface MonitoringHistoryKey {
|
|
87
|
+
segment_id: Principal;
|
|
88
|
+
created_at: bigint;
|
|
89
|
+
nonce: number;
|
|
90
|
+
}
|
|
91
|
+
export interface MonitoringStartConfig {
|
|
92
|
+
cycles_config: [] | [CyclesMonitoringStartConfig];
|
|
93
|
+
}
|
|
94
|
+
export interface MonitoringStatus {
|
|
95
|
+
cycles: [] | [CyclesMonitoringStatus];
|
|
96
|
+
}
|
|
97
|
+
export interface MonitoringStopConfig {
|
|
98
|
+
cycles_config: [] | [CyclesMonitoringStopConfig];
|
|
99
|
+
}
|
|
30
100
|
export interface Orbiter {
|
|
31
101
|
updated_at: bigint;
|
|
32
102
|
orbiter_id: Principal;
|
|
33
103
|
metadata: Array<[string, string]>;
|
|
34
104
|
created_at: bigint;
|
|
105
|
+
settings: [] | [Settings];
|
|
35
106
|
}
|
|
36
107
|
export type Result = {Ok: bigint} | {Err: TransferError};
|
|
37
108
|
export type Result_1 = {Ok: bigint} | {Err: TransferError_1};
|
|
38
|
-
export type Result_2 = {Ok: SegmentStatus} | {Err: string};
|
|
39
109
|
export interface Satellite {
|
|
40
110
|
updated_at: bigint;
|
|
41
111
|
metadata: Array<[string, string]>;
|
|
42
112
|
created_at: bigint;
|
|
43
113
|
satellite_id: Principal;
|
|
114
|
+
settings: [] | [Settings];
|
|
44
115
|
}
|
|
45
|
-
export interface
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
memory_allocation: bigint;
|
|
49
|
-
compute_allocation: bigint;
|
|
50
|
-
}
|
|
51
|
-
export interface SegmentCanisterStatus {
|
|
52
|
-
status: CanisterStatusType;
|
|
53
|
-
memory_size: bigint;
|
|
54
|
-
cycles: bigint;
|
|
55
|
-
settings: SegmentCanisterSettings;
|
|
56
|
-
idle_cycles_burned_per_day: bigint;
|
|
57
|
-
module_hash: [] | [Uint8Array | number[]];
|
|
58
|
-
}
|
|
59
|
-
export interface SegmentStatus {
|
|
60
|
-
id: Principal;
|
|
61
|
-
status: SegmentCanisterStatus;
|
|
62
|
-
metadata: [] | [Array<[string, string]>];
|
|
63
|
-
status_at: bigint;
|
|
64
|
-
}
|
|
65
|
-
export interface SegmentsStatuses {
|
|
66
|
-
orbiters: [] | [Array<Result_2>];
|
|
67
|
-
satellites: [] | [Array<Result_2>];
|
|
68
|
-
mission_control: Result_2;
|
|
116
|
+
export interface SegmentsMonitoringStrategy {
|
|
117
|
+
ids: Array<Principal>;
|
|
118
|
+
strategy: CyclesMonitoringStrategy;
|
|
69
119
|
}
|
|
70
120
|
export interface SetController {
|
|
71
121
|
metadata: Array<[string, string]>;
|
|
72
122
|
scope: ControllerScope;
|
|
73
123
|
expires_at: [] | [bigint];
|
|
74
124
|
}
|
|
75
|
-
export interface
|
|
76
|
-
|
|
77
|
-
orbiters: Array<[Principal, CronJobStatusesConfig]>;
|
|
78
|
-
satellites: Array<[Principal, CronJobStatusesConfig]>;
|
|
79
|
-
cycles_threshold: [] | [bigint];
|
|
125
|
+
export interface Settings {
|
|
126
|
+
monitoring: [] | [Monitoring];
|
|
80
127
|
}
|
|
81
128
|
export interface Timestamp {
|
|
82
129
|
timestamp_nanos: bigint;
|
|
@@ -119,6 +166,13 @@ export type TransferError_1 =
|
|
|
119
166
|
| {CreatedInFuture: {ledger_time: bigint}}
|
|
120
167
|
| {TooOld: null}
|
|
121
168
|
| {InsufficientFunds: {balance: bigint}};
|
|
169
|
+
export interface User {
|
|
170
|
+
updated_at: bigint;
|
|
171
|
+
metadata: Array<[string, string]>;
|
|
172
|
+
user: [] | [Principal];
|
|
173
|
+
created_at: bigint;
|
|
174
|
+
config: [] | [Config];
|
|
175
|
+
}
|
|
122
176
|
export interface _SERVICE {
|
|
123
177
|
add_mission_control_controllers: ActorMethod<[Array<Principal>], undefined>;
|
|
124
178
|
add_satellites_controllers: ActorMethod<[Array<Principal>, Array<Principal>], undefined>;
|
|
@@ -132,17 +186,24 @@ export interface _SERVICE {
|
|
|
132
186
|
del_satellite: ActorMethod<[Principal, bigint], undefined>;
|
|
133
187
|
del_satellites_controllers: ActorMethod<[Array<Principal>, Array<Principal>], undefined>;
|
|
134
188
|
deposit_cycles: ActorMethod<[DepositCyclesArgs], undefined>;
|
|
189
|
+
get_config: ActorMethod<[], [] | [Config]>;
|
|
190
|
+
get_metadata: ActorMethod<[], Array<[string, string]>>;
|
|
191
|
+
get_monitoring_history: ActorMethod<
|
|
192
|
+
[GetMonitoringHistory],
|
|
193
|
+
Array<[MonitoringHistoryKey, MonitoringHistory]>
|
|
194
|
+
>;
|
|
195
|
+
get_monitoring_status: ActorMethod<[], MonitoringStatus>;
|
|
196
|
+
get_settings: ActorMethod<[], [] | [MissionControlSettings]>;
|
|
135
197
|
get_user: ActorMethod<[], Principal>;
|
|
198
|
+
get_user_data: ActorMethod<[], User>;
|
|
136
199
|
icp_transfer: ActorMethod<[TransferArgs], Result>;
|
|
137
200
|
icrc_transfer: ActorMethod<[Principal, TransferArg], Result_1>;
|
|
138
201
|
list_mission_control_controllers: ActorMethod<[], Array<[Principal, Controller]>>;
|
|
139
|
-
list_mission_control_statuses: ActorMethod<[], Array<[bigint, Result_2]>>;
|
|
140
|
-
list_orbiter_statuses: ActorMethod<[Principal], [] | [Array<[bigint, Result_2]>]>;
|
|
141
202
|
list_orbiters: ActorMethod<[], Array<[Principal, Orbiter]>>;
|
|
142
|
-
list_satellite_statuses: ActorMethod<[Principal], [] | [Array<[bigint, Result_2]>]>;
|
|
143
203
|
list_satellites: ActorMethod<[], Array<[Principal, Satellite]>>;
|
|
144
204
|
remove_mission_control_controllers: ActorMethod<[Array<Principal>], undefined>;
|
|
145
205
|
remove_satellites_controllers: ActorMethod<[Array<Principal>, Array<Principal>], undefined>;
|
|
206
|
+
set_config: ActorMethod<[[] | [Config]], undefined>;
|
|
146
207
|
set_metadata: ActorMethod<[Array<[string, string]>], undefined>;
|
|
147
208
|
set_mission_control_controllers: ActorMethod<[Array<Principal>, SetController], undefined>;
|
|
148
209
|
set_orbiter: ActorMethod<[Principal, [] | [string]], Orbiter>;
|
|
@@ -157,10 +218,13 @@ export interface _SERVICE {
|
|
|
157
218
|
[Array<Principal>, Array<Principal>, SetController],
|
|
158
219
|
undefined
|
|
159
220
|
>;
|
|
160
|
-
|
|
221
|
+
start_monitoring: ActorMethod<[], undefined>;
|
|
222
|
+
stop_monitoring: ActorMethod<[], undefined>;
|
|
161
223
|
top_up: ActorMethod<[Principal, Tokens], undefined>;
|
|
162
224
|
unset_orbiter: ActorMethod<[Principal], undefined>;
|
|
163
225
|
unset_satellite: ActorMethod<[Principal], undefined>;
|
|
226
|
+
update_and_start_monitoring: ActorMethod<[MonitoringStartConfig], undefined>;
|
|
227
|
+
update_and_stop_monitoring: ActorMethod<[MonitoringStopConfig], undefined>;
|
|
164
228
|
version: ActorMethod<[], string>;
|
|
165
229
|
}
|
|
166
230
|
export declare const idlFactory: IDL.InterfaceFactory;
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
// @ts-ignore
|
|
2
2
|
export const idlFactory = ({IDL}) => {
|
|
3
|
+
const CyclesThreshold = IDL.Record({
|
|
4
|
+
fund_cycles: IDL.Nat,
|
|
5
|
+
min_cycles: IDL.Nat
|
|
6
|
+
});
|
|
7
|
+
const CyclesMonitoringStrategy = IDL.Variant({
|
|
8
|
+
BelowThreshold: CyclesThreshold
|
|
9
|
+
});
|
|
10
|
+
const CyclesMonitoring = IDL.Record({
|
|
11
|
+
strategy: IDL.Opt(CyclesMonitoringStrategy),
|
|
12
|
+
enabled: IDL.Bool
|
|
13
|
+
});
|
|
14
|
+
const Monitoring = IDL.Record({cycles: IDL.Opt(CyclesMonitoring)});
|
|
15
|
+
const Settings = IDL.Record({monitoring: IDL.Opt(Monitoring)});
|
|
3
16
|
const Orbiter = IDL.Record({
|
|
4
17
|
updated_at: IDL.Nat64,
|
|
5
18
|
orbiter_id: IDL.Principal,
|
|
6
19
|
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
7
|
-
created_at: IDL.Nat64
|
|
20
|
+
created_at: IDL.Nat64,
|
|
21
|
+
settings: IDL.Opt(Settings)
|
|
8
22
|
});
|
|
9
23
|
const CreateCanisterConfig = IDL.Record({
|
|
10
24
|
subnet_id: IDL.Opt(IDL.Principal),
|
|
@@ -14,12 +28,65 @@ export const idlFactory = ({IDL}) => {
|
|
|
14
28
|
updated_at: IDL.Nat64,
|
|
15
29
|
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
16
30
|
created_at: IDL.Nat64,
|
|
17
|
-
satellite_id: IDL.Principal
|
|
31
|
+
satellite_id: IDL.Principal,
|
|
32
|
+
settings: IDL.Opt(Settings)
|
|
18
33
|
});
|
|
19
34
|
const DepositCyclesArgs = IDL.Record({
|
|
20
35
|
cycles: IDL.Nat,
|
|
21
36
|
destination_id: IDL.Principal
|
|
22
37
|
});
|
|
38
|
+
const DepositedCyclesEmailNotification = IDL.Record({
|
|
39
|
+
to: IDL.Opt(IDL.Text),
|
|
40
|
+
enabled: IDL.Bool
|
|
41
|
+
});
|
|
42
|
+
const CyclesMonitoringConfig = IDL.Record({
|
|
43
|
+
notification: IDL.Opt(DepositedCyclesEmailNotification),
|
|
44
|
+
default_strategy: IDL.Opt(CyclesMonitoringStrategy)
|
|
45
|
+
});
|
|
46
|
+
const MonitoringConfig = IDL.Record({
|
|
47
|
+
cycles: IDL.Opt(CyclesMonitoringConfig)
|
|
48
|
+
});
|
|
49
|
+
const Config = IDL.Record({monitoring: IDL.Opt(MonitoringConfig)});
|
|
50
|
+
const GetMonitoringHistory = IDL.Record({
|
|
51
|
+
to: IDL.Opt(IDL.Nat64),
|
|
52
|
+
from: IDL.Opt(IDL.Nat64),
|
|
53
|
+
segment_id: IDL.Principal
|
|
54
|
+
});
|
|
55
|
+
const MonitoringHistoryKey = IDL.Record({
|
|
56
|
+
segment_id: IDL.Principal,
|
|
57
|
+
created_at: IDL.Nat64,
|
|
58
|
+
nonce: IDL.Int32
|
|
59
|
+
});
|
|
60
|
+
const CyclesBalance = IDL.Record({
|
|
61
|
+
timestamp: IDL.Nat64,
|
|
62
|
+
amount: IDL.Nat
|
|
63
|
+
});
|
|
64
|
+
const MonitoringHistoryCycles = IDL.Record({
|
|
65
|
+
deposited_cycles: IDL.Opt(CyclesBalance),
|
|
66
|
+
cycles: CyclesBalance
|
|
67
|
+
});
|
|
68
|
+
const MonitoringHistory = IDL.Record({
|
|
69
|
+
cycles: IDL.Opt(MonitoringHistoryCycles)
|
|
70
|
+
});
|
|
71
|
+
const CyclesMonitoringStatus = IDL.Record({
|
|
72
|
+
monitored_ids: IDL.Vec(IDL.Principal),
|
|
73
|
+
running: IDL.Bool
|
|
74
|
+
});
|
|
75
|
+
const MonitoringStatus = IDL.Record({
|
|
76
|
+
cycles: IDL.Opt(CyclesMonitoringStatus)
|
|
77
|
+
});
|
|
78
|
+
const MissionControlSettings = IDL.Record({
|
|
79
|
+
updated_at: IDL.Nat64,
|
|
80
|
+
created_at: IDL.Nat64,
|
|
81
|
+
monitoring: IDL.Opt(Monitoring)
|
|
82
|
+
});
|
|
83
|
+
const User = IDL.Record({
|
|
84
|
+
updated_at: IDL.Nat64,
|
|
85
|
+
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
86
|
+
user: IDL.Opt(IDL.Principal),
|
|
87
|
+
created_at: IDL.Nat64,
|
|
88
|
+
config: IDL.Opt(Config)
|
|
89
|
+
});
|
|
23
90
|
const Tokens = IDL.Record({e8s: IDL.Nat64});
|
|
24
91
|
const Timestamp = IDL.Record({timestamp_nanos: IDL.Nat64});
|
|
25
92
|
const TransferArgs = IDL.Record({
|
|
@@ -75,51 +142,30 @@ export const idlFactory = ({IDL}) => {
|
|
|
75
142
|
scope: ControllerScope,
|
|
76
143
|
expires_at: IDL.Opt(IDL.Nat64)
|
|
77
144
|
});
|
|
78
|
-
const CanisterStatusType = IDL.Variant({
|
|
79
|
-
stopped: IDL.Null,
|
|
80
|
-
stopping: IDL.Null,
|
|
81
|
-
running: IDL.Null
|
|
82
|
-
});
|
|
83
|
-
const SegmentCanisterSettings = IDL.Record({
|
|
84
|
-
freezing_threshold: IDL.Nat,
|
|
85
|
-
controllers: IDL.Vec(IDL.Principal),
|
|
86
|
-
memory_allocation: IDL.Nat,
|
|
87
|
-
compute_allocation: IDL.Nat
|
|
88
|
-
});
|
|
89
|
-
const SegmentCanisterStatus = IDL.Record({
|
|
90
|
-
status: CanisterStatusType,
|
|
91
|
-
memory_size: IDL.Nat,
|
|
92
|
-
cycles: IDL.Nat,
|
|
93
|
-
settings: SegmentCanisterSettings,
|
|
94
|
-
idle_cycles_burned_per_day: IDL.Nat,
|
|
95
|
-
module_hash: IDL.Opt(IDL.Vec(IDL.Nat8))
|
|
96
|
-
});
|
|
97
|
-
const SegmentStatus = IDL.Record({
|
|
98
|
-
id: IDL.Principal,
|
|
99
|
-
status: SegmentCanisterStatus,
|
|
100
|
-
metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
|
|
101
|
-
status_at: IDL.Nat64
|
|
102
|
-
});
|
|
103
|
-
const Result_2 = IDL.Variant({Ok: SegmentStatus, Err: IDL.Text});
|
|
104
145
|
const SetController = IDL.Record({
|
|
105
146
|
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
106
147
|
scope: ControllerScope,
|
|
107
148
|
expires_at: IDL.Opt(IDL.Nat64)
|
|
108
149
|
});
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
150
|
+
const SegmentsMonitoringStrategy = IDL.Record({
|
|
151
|
+
ids: IDL.Vec(IDL.Principal),
|
|
152
|
+
strategy: CyclesMonitoringStrategy
|
|
153
|
+
});
|
|
154
|
+
const CyclesMonitoringStartConfig = IDL.Record({
|
|
155
|
+
orbiters_strategy: IDL.Opt(SegmentsMonitoringStrategy),
|
|
156
|
+
mission_control_strategy: IDL.Opt(CyclesMonitoringStrategy),
|
|
157
|
+
satellites_strategy: IDL.Opt(SegmentsMonitoringStrategy)
|
|
158
|
+
});
|
|
159
|
+
const MonitoringStartConfig = IDL.Record({
|
|
160
|
+
cycles_config: IDL.Opt(CyclesMonitoringStartConfig)
|
|
112
161
|
});
|
|
113
|
-
const
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
cycles_threshold: IDL.Opt(IDL.Nat64)
|
|
162
|
+
const CyclesMonitoringStopConfig = IDL.Record({
|
|
163
|
+
satellite_ids: IDL.Opt(IDL.Vec(IDL.Principal)),
|
|
164
|
+
try_mission_control: IDL.Opt(IDL.Bool),
|
|
165
|
+
orbiter_ids: IDL.Opt(IDL.Vec(IDL.Principal))
|
|
118
166
|
});
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
satellites: IDL.Opt(IDL.Vec(Result_2)),
|
|
122
|
-
mission_control: Result_2
|
|
167
|
+
const MonitoringStopConfig = IDL.Record({
|
|
168
|
+
cycles_config: IDL.Opt(CyclesMonitoringStopConfig)
|
|
123
169
|
});
|
|
124
170
|
return IDL.Service({
|
|
125
171
|
add_mission_control_controllers: IDL.Func([IDL.Vec(IDL.Principal)], [], []),
|
|
@@ -134,7 +180,17 @@ export const idlFactory = ({IDL}) => {
|
|
|
134
180
|
del_satellite: IDL.Func([IDL.Principal, IDL.Nat], [], []),
|
|
135
181
|
del_satellites_controllers: IDL.Func([IDL.Vec(IDL.Principal), IDL.Vec(IDL.Principal)], [], []),
|
|
136
182
|
deposit_cycles: IDL.Func([DepositCyclesArgs], [], []),
|
|
183
|
+
get_config: IDL.Func([], [IDL.Opt(Config)], ['query']),
|
|
184
|
+
get_metadata: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))], ['query']),
|
|
185
|
+
get_monitoring_history: IDL.Func(
|
|
186
|
+
[GetMonitoringHistory],
|
|
187
|
+
[IDL.Vec(IDL.Tuple(MonitoringHistoryKey, MonitoringHistory))],
|
|
188
|
+
['query']
|
|
189
|
+
),
|
|
190
|
+
get_monitoring_status: IDL.Func([], [MonitoringStatus], ['query']),
|
|
191
|
+
get_settings: IDL.Func([], [IDL.Opt(MissionControlSettings)], ['query']),
|
|
137
192
|
get_user: IDL.Func([], [IDL.Principal], ['query']),
|
|
193
|
+
get_user_data: IDL.Func([], [User], ['query']),
|
|
138
194
|
icp_transfer: IDL.Func([TransferArgs], [Result], []),
|
|
139
195
|
icrc_transfer: IDL.Func([IDL.Principal, TransferArg], [Result_1], []),
|
|
140
196
|
list_mission_control_controllers: IDL.Func(
|
|
@@ -142,22 +198,7 @@ export const idlFactory = ({IDL}) => {
|
|
|
142
198
|
[IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
|
|
143
199
|
['query']
|
|
144
200
|
),
|
|
145
|
-
list_mission_control_statuses: IDL.Func(
|
|
146
|
-
[],
|
|
147
|
-
[IDL.Vec(IDL.Tuple(IDL.Nat64, Result_2))],
|
|
148
|
-
['query']
|
|
149
|
-
),
|
|
150
|
-
list_orbiter_statuses: IDL.Func(
|
|
151
|
-
[IDL.Principal],
|
|
152
|
-
[IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Nat64, Result_2)))],
|
|
153
|
-
['query']
|
|
154
|
-
),
|
|
155
201
|
list_orbiters: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, Orbiter))], ['query']),
|
|
156
|
-
list_satellite_statuses: IDL.Func(
|
|
157
|
-
[IDL.Principal],
|
|
158
|
-
[IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Nat64, Result_2)))],
|
|
159
|
-
['query']
|
|
160
|
-
),
|
|
161
202
|
list_satellites: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, Satellite))], ['query']),
|
|
162
203
|
remove_mission_control_controllers: IDL.Func([IDL.Vec(IDL.Principal)], [], []),
|
|
163
204
|
remove_satellites_controllers: IDL.Func(
|
|
@@ -165,6 +206,7 @@ export const idlFactory = ({IDL}) => {
|
|
|
165
206
|
[],
|
|
166
207
|
[]
|
|
167
208
|
),
|
|
209
|
+
set_config: IDL.Func([IDL.Opt(Config)], [], []),
|
|
168
210
|
set_metadata: IDL.Func([IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))], [], []),
|
|
169
211
|
set_mission_control_controllers: IDL.Func([IDL.Vec(IDL.Principal), SetController], [], []),
|
|
170
212
|
set_orbiter: IDL.Func([IDL.Principal, IDL.Opt(IDL.Text)], [Orbiter], []),
|
|
@@ -189,10 +231,13 @@ export const idlFactory = ({IDL}) => {
|
|
|
189
231
|
[],
|
|
190
232
|
[]
|
|
191
233
|
),
|
|
192
|
-
|
|
234
|
+
start_monitoring: IDL.Func([], [], []),
|
|
235
|
+
stop_monitoring: IDL.Func([], [], []),
|
|
193
236
|
top_up: IDL.Func([IDL.Principal, Tokens], [], []),
|
|
194
237
|
unset_orbiter: IDL.Func([IDL.Principal], [], []),
|
|
195
238
|
unset_satellite: IDL.Func([IDL.Principal], [], []),
|
|
239
|
+
update_and_start_monitoring: IDL.Func([MonitoringStartConfig], [], []),
|
|
240
|
+
update_and_stop_monitoring: IDL.Func([MonitoringStopConfig], [], []),
|
|
196
241
|
version: IDL.Func([], [IDL.Text], ['query'])
|
|
197
242
|
});
|
|
198
243
|
};
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as topLevelCreateRequire } from 'module';
|
|
2
2
|
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
-
var J=class extends Error{constructor(){super("The Wasm code for the upgrade is identical to the code currently installed. No upgrade is necessary.")}};import{isNullish as Ge}from"@junobuild/utils";var _t=({IDL:t})=>{let e=t.Record({updated_at:t.Nat64,orbiter_id:t.Principal,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64}),r=t.Record({subnet_id:t.Opt(t.Principal),name:t.Opt(t.Text)}),o=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,satellite_id:t.Principal}),s=t.Record({cycles:t.Nat,destination_id:t.Principal}),a=t.Record({e8s:t.Nat64}),n=t.Record({timestamp_nanos:t.Nat64}),i=t.Record({to:t.Vec(t.Nat8),fee:a,memo:t.Nat64,from_subaccount:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(n),amount:a}),p=t.Variant({TxTooOld:t.Record({allowed_window_nanos:t.Nat64}),BadFee:t.Record({expected_fee:a}),TxDuplicate:t.Record({duplicate_of:t.Nat64}),TxCreatedInFuture:t.Null,InsufficientFunds:t.Record({balance:a})}),l=t.Variant({Ok:t.Nat64,Err:p}),m=t.Record({owner:t.Principal,subaccount:t.Opt(t.Vec(t.Nat8))}),d=t.Record({to:m,fee:t.Opt(t.Nat),memo:t.Opt(t.Vec(t.Nat8)),from_subaccount:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat}),c=t.Variant({GenericError:t.Record({message:t.Text,error_code:t.Nat}),TemporarilyUnavailable:t.Null,BadBurn:t.Record({min_burn_amount:t.Nat}),Duplicate:t.Record({duplicate_of:t.Nat}),BadFee:t.Record({expected_fee:t.Nat}),CreatedInFuture:t.Record({ledger_time:t.Nat64}),TooOld:t.Null,InsufficientFunds:t.Record({balance:t.Nat})}),u=t.Variant({Ok:t.Nat,Err:c}),g=t.Variant({Write:t.Null,Admin:t.Null}),P=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,scope:g,expires_at:t.Opt(t.Nat64)}),k=t.Variant({stopped:t.Null,stopping:t.Null,running:t.Null}),S=t.Record({freezing_threshold:t.Nat,controllers:t.Vec(t.Principal),memory_allocation:t.Nat,compute_allocation:t.Nat}),C=t.Record({status:k,memory_size:t.Nat,cycles:t.Nat,settings:S,idle_cycles_burned_per_day:t.Nat,module_hash:t.Opt(t.Vec(t.Nat8))}),N=t.Record({id:t.Principal,status:C,metadata:t.Opt(t.Vec(t.Tuple(t.Text,t.Text))),status_at:t.Nat64}),y=t.Variant({Ok:N,Err:t.Text}),x=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),scope:g,expires_at:t.Opt(t.Nat64)}),A=t.Record({enabled:t.Bool,cycles_threshold:t.Opt(t.Nat64)}),O=t.Record({mission_control_cycles_threshold:t.Opt(t.Nat64),orbiters:t.Vec(t.Tuple(t.Principal,A)),satellites:t.Vec(t.Tuple(t.Principal,A)),cycles_threshold:t.Opt(t.Nat64)}),w=t.Record({orbiters:t.Opt(t.Vec(y)),satellites:t.Opt(t.Vec(y)),mission_control:y});return t.Service({add_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),add_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),create_orbiter:t.Func([t.Opt(t.Text)],[e],[]),create_orbiter_with_config:t.Func([r],[e],[]),create_satellite:t.Func([t.Text],[o],[]),create_satellite_with_config:t.Func([r],[o],[]),del_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),del_orbiter:t.Func([t.Principal,t.Nat],[],[]),del_orbiters_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),del_satellite:t.Func([t.Principal,t.Nat],[],[]),del_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),deposit_cycles:t.Func([s],[],[]),get_user:t.Func([],[t.Principal],["query"]),icp_transfer:t.Func([i],[l],[]),icrc_transfer:t.Func([t.Principal,d],[u],[]),list_mission_control_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,P))],["query"]),list_mission_control_statuses:t.Func([],[t.Vec(t.Tuple(t.Nat64,y))],["query"]),list_orbiter_statuses:t.Func([t.Principal],[t.Opt(t.Vec(t.Tuple(t.Nat64,y)))],["query"]),list_orbiters:t.Func([],[t.Vec(t.Tuple(t.Principal,e))],["query"]),list_satellite_statuses:t.Func([t.Principal],[t.Opt(t.Vec(t.Tuple(t.Nat64,y)))],["query"]),list_satellites:t.Func([],[t.Vec(t.Tuple(t.Principal,o))],["query"]),remove_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),remove_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),set_metadata:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[],[]),set_mission_control_controllers:t.Func([t.Vec(t.Principal),x],[],[]),set_orbiter:t.Func([t.Principal,t.Opt(t.Text)],[e],[]),set_orbiter_metadata:t.Func([t.Principal,t.Vec(t.Tuple(t.Text,t.Text))],[e],[]),set_orbiters_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal),x],[],[]),set_satellite:t.Func([t.Principal,t.Opt(t.Text)],[o],[]),set_satellite_metadata:t.Func([t.Principal,t.Vec(t.Tuple(t.Text,t.Text))],[o],[]),set_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal),x],[],[]),status:t.Func([O],[w],[]),top_up:t.Func([t.Principal,a],[],[]),unset_orbiter:t.Func([t.Principal],[],[]),unset_satellite:t.Func([t.Principal],[],[]),version:t.Func([],[t.Text],["query"])})};var yt=({IDL:t})=>{let e=t.Record({controllers:t.Vec(t.Principal)}),r=t.Variant({Write:t.Null,Admin:t.Null}),o=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,scope:r,expires_at:t.Opt(t.Nat64)}),s=t.Record({version:t.Opt(t.Nat64)}),a=t.Record({cycles:t.Nat,destination_id:t.Principal}),n=t.Record({to:t.Opt(t.Nat64),from:t.Opt(t.Nat64),satellite_id:t.Opt(t.Principal)}),i=t.Record({key:t.Text,collected_at:t.Nat64}),p=t.Record({inner_height:t.Nat16,inner_width:t.Nat16}),l=t.Record({title:t.Text,updated_at:t.Nat64,referrer:t.Opt(t.Text),time_zone:t.Text,session_id:t.Text,href:t.Text,created_at:t.Nat64,satellite_id:t.Principal,device:p,version:t.Opt(t.Nat64),user_agent:t.Opt(t.Text)}),m=t.Record({safari:t.Float64,opera:t.Float64,others:t.Float64,firefox:t.Float64,chrome:t.Float64}),d=t.Record({desktop:t.Float64,others:t.Float64,mobile:t.Float64}),c=t.Record({browsers:m,devices:d}),u=t.Record({day:t.Nat8,month:t.Nat8,year:t.Int32}),g=t.Record({bounce_rate:t.Float64,average_page_views_per_session:t.Float64,daily_total_page_views:t.Vec(t.Tuple(u,t.Nat32)),total_page_views:t.Nat32,unique_page_views:t.Nat64,unique_sessions:t.Nat64}),P=t.Record({referrers:t.Vec(t.Tuple(t.Text,t.Nat32)),pages:t.Vec(t.Tuple(t.Text,t.Nat32))}),k=t.Variant({Navigate:t.Null,Restore:t.Null,Reload:t.Null,BackForward:t.Null,BackForwardCache:t.Null,Prerender:t.Null}),S=t.Record({id:t.Text,value:t.Float64,navigation_type:t.Opt(k),delta:t.Float64}),C=t.Variant({WebVitalsMetric:S}),N=t.Variant({CLS:t.Null,FCP:t.Null,INP:t.Null,LCP:t.Null,TTFB:t.Null}),y=t.Record({updated_at:t.Nat64,session_id:t.Text,data:C,href:t.Text,metric_name:N,created_at:t.Nat64,satellite_id:t.Principal,version:t.Opt(t.Nat64)}),x=t.Record({cls:t.Opt(t.Float64),fcp:t.Opt(t.Float64),inp:t.Opt(t.Float64),lcp:t.Opt(t.Float64),ttfb:t.Opt(t.Float64)}),A=t.Record({overall:x,pages:t.Vec(t.Tuple(t.Text,x))}),O=t.Record({updated_at:t.Nat64,session_id:t.Text,metadata:t.Opt(t.Vec(t.Tuple(t.Text,t.Text))),name:t.Text,created_at:t.Nat64,satellite_id:t.Principal,version:t.Opt(t.Nat64)}),w=t.Record({total:t.Vec(t.Tuple(t.Text,t.Nat32))}),h=t.Record({performance_metrics:t.Bool,track_events:t.Bool,page_views:t.Bool}),T=t.Record({updated_at:t.Nat64,features:t.Opt(h),created_at:t.Nat64,version:t.Opt(t.Nat64)}),R=t.Record({stable:t.Nat64,heap:t.Nat64}),v=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),scope:r,expires_at:t.Opt(t.Nat64)}),V=t.Record({controller:v,controllers:t.Vec(t.Principal)}),M=t.Record({title:t.Text,updated_at:t.Opt(t.Nat64),referrer:t.Opt(t.Text),time_zone:t.Text,session_id:t.Text,href:t.Text,satellite_id:t.Principal,device:p,version:t.Opt(t.Nat64),user_agent:t.Opt(t.Text)}),U=t.Variant({Ok:l,Err:t.Text}),E=t.Variant({Ok:t.Null,Err:t.Vec(t.Tuple(i,t.Text))}),F=t.Record({session_id:t.Text,data:C,href:t.Text,metric_name:N,satellite_id:t.Principal,version:t.Opt(t.Nat64),user_agent:t.Opt(t.Text)}),st=t.Variant({Ok:y,Err:t.Text}),nt=t.Record({features:t.Opt(h),version:t.Opt(t.Nat64)}),Z=t.Record({updated_at:t.Opt(t.Nat64),session_id:t.Text,metadata:t.Opt(t.Vec(t.Tuple(t.Text,t.Text))),name:t.Text,satellite_id:t.Principal,version:t.Opt(t.Nat64),user_agent:t.Opt(t.Text)}),it=t.Variant({Ok:O,Err:t.Text});return t.Service({del_controllers:t.Func([e],[t.Vec(t.Tuple(t.Principal,o))],[]),del_satellite_config:t.Func([t.Principal,s],[],[]),deposit_cycles:t.Func([a],[],[]),get_page_views:t.Func([n],[t.Vec(t.Tuple(i,l))],["query"]),get_page_views_analytics_clients:t.Func([n],[c],["query"]),get_page_views_analytics_metrics:t.Func([n],[g],["query"]),get_page_views_analytics_top_10:t.Func([n],[P],["query"]),get_performance_metrics:t.Func([n],[t.Vec(t.Tuple(i,y))],["query"]),get_performance_metrics_analytics_web_vitals:t.Func([n],[A],["query"]),get_track_events:t.Func([n],[t.Vec(t.Tuple(i,O))],["query"]),get_track_events_analytics:t.Func([n],[w],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,o))],["query"]),list_satellite_configs:t.Func([],[t.Vec(t.Tuple(t.Principal,T))],["query"]),memory_size:t.Func([],[R],["query"]),set_controllers:t.Func([V],[t.Vec(t.Tuple(t.Principal,o))],[]),set_page_view:t.Func([i,M],[U],[]),set_page_views:t.Func([t.Vec(t.Tuple(i,M))],[E],[]),set_performance_metric:t.Func([i,F],[st],[]),set_performance_metrics:t.Func([t.Vec(t.Tuple(i,F))],[E],[]),set_satellite_configs:t.Func([t.Vec(t.Tuple(t.Principal,nt))],[t.Vec(t.Tuple(t.Principal,T))],[]),set_track_event:t.Func([i,Z],[it],[]),set_track_events:t.Func([t.Vec(t.Tuple(i,Z))],[E],[]),version:t.Func([],[t.Text],["query"])})};var gt=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Record({controllers:t.Vec(t.Principal)}),o=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,expires_at:t.Opt(t.Nat64)}),s=t.Record({updated_at:t.Opt(t.Nat64)}),a=t.Record({headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text))))}),n=t.Record({storage:a}),i=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),created_at:t.Nat64}),p=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text))}),l=t.Record({token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),m=t.Variant({Callback:t.Record({token:l,callback:t.Func([],[],[])})}),d=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(m),status_code:t.Nat16}),c=t.Record({token:t.Opt(l),body:t.Vec(t.Nat8)}),u=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,encoding_type:t.Opt(t.Text),full_path:t.Text}),g=t.Record({batch_id:t.Nat}),P=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),k=t.Record({field:P,desc:t.Bool}),S=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),C=t.Record({order:t.Opt(k),owner:t.Opt(t.Principal),matcher:t.Opt(t.Text),paginate:t.Opt(S)}),N=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,full_path:t.Text}),y=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),x=t.Record({key:N,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,y)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64}),A=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,x))}),O=t.Record({updated_at:t.Nat64,created_at:t.Nat64,bn_id:t.Opt(t.Text)}),w=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,i))}),h=t.Variant({Db:t.Null,Storage:t.Null}),T=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),R=t.Record({updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:T,created_at:t.Nat64,write:T}),v=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),expires_at:t.Opt(t.Nat64)}),V=t.Record({controller:v,controllers:t.Vec(t.Principal)}),M=t.Record({updated_at:t.Opt(t.Nat64),data:t.Vec(t.Nat8)}),U=t.Record({updated_at:t.Opt(t.Nat64),max_size:t.Opt(t.Nat),read:T,write:T}),E=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat}),F=t.Record({chunk_id:t.Nat});return t.Service({commit_asset_upload:t.Func([e],[],[]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Opt(t.Text)],[],[]),del_controllers:t.Func([r],[t.Vec(t.Tuple(t.Principal,o))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,s],[],[]),get_config:t.Func([],[n],[]),get_doc:t.Func([t.Text,t.Text],[t.Opt(i)],["query"]),http_request:t.Func([p],[d],["query"]),http_request_streaming_callback:t.Func([l],[c],["query"]),init_asset_upload:t.Func([u],[g],[]),list_assets:t.Func([t.Opt(t.Text),C],[A],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,o))],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,O))],["query"]),list_docs:t.Func([t.Text,C],[w],["query"]),list_rules:t.Func([h],[t.Vec(t.Tuple(t.Text,R))],["query"]),set_config:t.Func([n],[],[]),set_controllers:t.Func([V],[t.Vec(t.Tuple(t.Principal,o))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_doc:t.Func([t.Text,t.Text,M],[i],[]),set_rule:t.Func([h,t.Text,U],[],[]),upload_asset_chunk:t.Func([E],[F],[]),version:t.Func([],[t.Text],["query"])})};var xt=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Record({controllers:t.Vec(t.Principal)}),o=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,expires_at:t.Opt(t.Nat64)}),s=t.Record({updated_at:t.Opt(t.Nat64)}),a=t.Record({headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text))))}),n=t.Record({storage:a}),i=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),created_at:t.Nat64}),p=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text))}),l=t.Record({token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),m=t.Variant({Callback:t.Record({token:l,callback:t.Func([],[],[])})}),d=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(m),status_code:t.Nat16}),c=t.Record({token:t.Opt(l),body:t.Vec(t.Nat8)}),u=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,encoding_type:t.Opt(t.Text),full_path:t.Text}),g=t.Record({batch_id:t.Nat}),P=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),k=t.Record({field:P,desc:t.Bool}),S=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),C=t.Record({order:t.Opt(k),matcher:t.Opt(t.Text),paginate:t.Opt(S)}),N=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,full_path:t.Text}),y=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),x=t.Record({key:N,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,y)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64}),A=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,x))}),O=t.Record({updated_at:t.Nat64,created_at:t.Nat64,bn_id:t.Opt(t.Text)}),w=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,i))}),h=t.Variant({Db:t.Null,Storage:t.Null}),T=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),R=t.Record({updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:T,created_at:t.Nat64,write:T}),v=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),expires_at:t.Opt(t.Nat64)}),V=t.Record({controller:v,controllers:t.Vec(t.Principal)}),M=t.Record({updated_at:t.Opt(t.Nat64),data:t.Vec(t.Nat8)}),U=t.Record({updated_at:t.Opt(t.Nat64),max_size:t.Opt(t.Nat),read:T,write:T}),E=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat}),F=t.Record({chunk_id:t.Nat});return t.Service({commit_asset_upload:t.Func([e],[],[]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Opt(t.Text)],[],[]),del_controllers:t.Func([r],[t.Vec(t.Tuple(t.Principal,o))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,s],[],[]),get_config:t.Func([],[n],[]),get_doc:t.Func([t.Text,t.Text],[t.Opt(i)],["query"]),http_request:t.Func([p],[d],["query"]),http_request_streaming_callback:t.Func([l],[c],["query"]),init_asset_upload:t.Func([u],[g],[]),list_assets:t.Func([t.Opt(t.Text),C],[A],["query"]),list_controllers:t.Func([],[t.Vec(t.Principal)],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,O))],["query"]),list_docs:t.Func([t.Text,C],[w],["query"]),list_rules:t.Func([h],[t.Vec(t.Tuple(t.Text,R))],["query"]),set_config:t.Func([n],[],[]),set_controllers:t.Func([V],[t.Vec(t.Tuple(t.Principal,o))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_doc:t.Func([t.Text,t.Text,M],[i],[]),set_rule:t.Func([h,t.Text,U],[],[]),upload_asset_chunk:t.Func([E],[F],[]),version:t.Func([],[t.Text],["query"])})};var Tt=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),o=t.Record({field:r,desc:t.Bool}),s=t.Variant({Equal:t.Nat64,Between:t.Tuple(t.Nat64,t.Nat64),GreaterThan:t.Nat64,LessThan:t.Nat64}),a=t.Record({key:t.Opt(t.Text),updated_at:t.Opt(s),description:t.Opt(t.Text),created_at:t.Opt(s)}),n=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),i=t.Record({order:t.Opt(o),owner:t.Opt(t.Principal),matcher:t.Opt(a),paginate:t.Opt(n)}),p=t.Record({controllers:t.Vec(t.Principal)}),l=t.Variant({Write:t.Null,Admin:t.Null}),m=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,scope:l,expires_at:t.Opt(t.Nat64)}),d=t.Record({version:t.Opt(t.Nat64)}),c=t.Variant({Db:t.Null,Storage:t.Null}),u=t.Record({version:t.Opt(t.Nat64)}),g=t.Record({cycles:t.Nat,destination_id:t.Principal}),P=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,description:t.Opt(t.Text),full_path:t.Text}),k=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),S=t.Record({key:P,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,k)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,version:t.Opt(t.Nat64)}),C=t.Record({derivation_origin:t.Opt(t.Text)}),N=t.Record({internet_identity:t.Opt(C)}),y=t.Record({stable:t.Opt(t.Nat64),heap:t.Opt(t.Nat64)}),x=t.Record({max_memory_size:t.Opt(y)}),A=t.Variant({Deny:t.Null,AllowAny:t.Null,SameOrigin:t.Null}),O=t.Variant({Deny:t.Null,Allow:t.Null}),w=t.Record({status_code:t.Nat16,location:t.Text}),h=t.Record({iframe:t.Opt(A),rewrites:t.Vec(t.Tuple(t.Text,t.Text)),headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text)))),max_memory_size:t.Opt(y),raw_access:t.Opt(O),redirects:t.Opt(t.Vec(t.Tuple(t.Text,w)))}),T=t.Record({db:t.Opt(x),authentication:t.Opt(N),storage:h}),R=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),description:t.Opt(t.Text),created_at:t.Nat64,version:t.Opt(t.Nat64)}),v=t.Variant({Heap:t.Null,Stable:t.Null}),V=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),M=t.Record({max_tokens:t.Nat64,time_per_token_ns:t.Nat64}),U=t.Record({max_capacity:t.Opt(t.Nat32),memory:t.Opt(v),updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:V,created_at:t.Nat64,version:t.Opt(t.Nat64),mutable_permissions:t.Opt(t.Bool),rate_config:t.Opt(M),write:V}),E=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),certificate_version:t.Opt(t.Nat16)}),F=t.Record({memory:v,token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),st=t.Variant({Callback:t.Record({token:F,callback:t.Func([],[],["query"])})}),nt=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(st),status_code:t.Nat16}),Z=t.Record({token:t.Opt(F),body:t.Vec(t.Nat8)}),it=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,description:t.Opt(t.Text),encoding_type:t.Opt(t.Text),full_path:t.Text}),be=t.Record({batch_id:t.Nat}),ke=t.Record({matches_pages:t.Opt(t.Nat64),matches_length:t.Nat64,items_page:t.Opt(t.Nat64),items:t.Vec(t.Tuple(t.Text,S)),items_length:t.Nat64}),we=t.Record({updated_at:t.Nat64,created_at:t.Nat64,version:t.Opt(t.Nat64),bn_id:t.Opt(t.Text)}),ve=t.Record({matches_pages:t.Opt(t.Nat64),matches_length:t.Nat64,items_page:t.Opt(t.Nat64),items:t.Vec(t.Tuple(t.Text,R)),items_length:t.Nat64}),Me=t.Record({stable:t.Nat64,heap:t.Nat64}),Ue=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),scope:l,expires_at:t.Opt(t.Nat64)}),Ee=t.Record({controller:Ue,controllers:t.Vec(t.Principal)}),mt=t.Record({data:t.Vec(t.Nat8),description:t.Opt(t.Text),version:t.Opt(t.Nat64)}),qe=t.Record({max_capacity:t.Opt(t.Nat32),memory:t.Opt(v),max_size:t.Opt(t.Nat),read:V,version:t.Opt(t.Nat64),mutable_permissions:t.Opt(t.Bool),rate_config:t.Opt(M),write:V}),ze=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat,order_id:t.Opt(t.Nat)}),Be=t.Record({chunk_id:t.Nat});return t.Service({build_version:t.Func([],[t.Text],["query"]),commit_asset_upload:t.Func([e],[],[]),count_assets:t.Func([t.Text,i],[t.Nat64],["query"]),count_collection_assets:t.Func([t.Text],[t.Nat64],["query"]),count_collection_docs:t.Func([t.Text],[t.Nat64],["query"]),count_docs:t.Func([t.Text,i],[t.Nat64],["query"]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Text],[],[]),del_controllers:t.Func([p],[t.Vec(t.Tuple(t.Principal,m))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,d],[],[]),del_docs:t.Func([t.Text],[],[]),del_filtered_assets:t.Func([t.Text,i],[],[]),del_filtered_docs:t.Func([t.Text,i],[],[]),del_many_assets:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[],[]),del_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text,d))],[],[]),del_rule:t.Func([c,t.Text,u],[],[]),deposit_cycles:t.Func([g],[],[]),get_asset:t.Func([t.Text,t.Text],[t.Opt(S)],["query"]),get_auth_config:t.Func([],[t.Opt(N)],["query"]),get_config:t.Func([],[T],[]),get_db_config:t.Func([],[t.Opt(x)],["query"]),get_doc:t.Func([t.Text,t.Text],[t.Opt(R)],["query"]),get_many_assets:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[t.Vec(t.Tuple(t.Text,t.Opt(S)))],["query"]),get_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[t.Vec(t.Tuple(t.Text,t.Opt(R)))],["query"]),get_rule:t.Func([c,t.Text],[t.Opt(U)],["query"]),get_storage_config:t.Func([],[h],["query"]),http_request:t.Func([E],[nt],["query"]),http_request_streaming_callback:t.Func([F],[Z],["query"]),init_asset_upload:t.Func([it],[be],[]),list_assets:t.Func([t.Text,i],[ke],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,m))],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,we))],["query"]),list_docs:t.Func([t.Text,i],[ve],["query"]),list_rules:t.Func([c],[t.Vec(t.Tuple(t.Text,U))],["query"]),memory_size:t.Func([],[Me],["query"]),set_auth_config:t.Func([N],[],[]),set_controllers:t.Func([Ee],[t.Vec(t.Tuple(t.Principal,m))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_db_config:t.Func([x],[],[]),set_doc:t.Func([t.Text,t.Text,mt],[R],[]),set_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text,mt))],[t.Vec(t.Tuple(t.Text,R))],[]),set_rule:t.Func([c,t.Text,qe],[U],[]),set_storage_config:t.Func([h],[],[]),upload_asset_chunk:t.Func([ze],[Be],[]),version:t.Func([],[t.Text],["query"])})};import{Actor as He,HttpAgent as Ke}from"@dfinity/agent";import{nonNullish as ft}from"@junobuild/utils";var Pt=async({canisterId:t,idlFactory:e,config:r,...o})=>{let s=await f(o);return He.createActor(e,{agent:s,canisterId:t,...r??{}})},f=async({agent:t,...e})=>t??await We(e),We=async({identity:t,fetch:e,container:r})=>{let o=ft(r)&&r!==!1,s=o?r===!0?"http://127.0.0.1:5987":r:"https://icp-api.io";return await Ke.create({identity:t,host:s,retryTimes:10,...ft(e)&&{fetch:e},shouldFetchRootKey:o})};var Ct=({satelliteId:t,...e})=>G({canisterId:t,...e,idlFactory:xt}),_=({satelliteId:t,...e})=>G({canisterId:t,...e,idlFactory:Tt}),Nt=({satelliteId:t,...e})=>G({canisterId:t,...e,idlFactory:gt}),K=({missionControlId:t,...e})=>G({canisterId:t,...e,idlFactory:_t}),Q=({orbiterId:t,...e})=>G({canisterId:t,...e,idlFactory:yt}),G=({canisterId:t,idlFactory:e,...r})=>{if(Ge(t))throw new Error("No canister ID provided.");return Pt({canisterId:t,idlFactory:e,...r})};var ht=async({missionControl:t})=>(await K(t)).version(),St=async({missionControl:t})=>(await K(t)).get_user(),Rt=async({missionControl:t})=>(await K(t)).list_mission_control_controllers(),At=async({missionControl:t,satelliteIds:e,controllerIds:r,controller:o})=>(await K(t)).set_satellites_controllers(e,r,o),Ot=async({missionControl:t,controllerIds:e,controller:r})=>(await K(t)).set_mission_control_controllers(e,r);import{Principal as je}from"@dfinity/principal";import{nonNullish as Xe,toNullable as Ze}from"@junobuild/utils";var ct=({controllerId:t,profile:e})=>({controllerIds:[je.fromText(t)],controller:Je(e)}),Je=t=>({metadata:Xe(t)&&t!==""?[["profile",t]]:[],expires_at:Ze(void 0),scope:{Admin:null}});var Wr=({controllerId:t,profile:e,...r})=>At({...r,...ct({controllerId:t,profile:e})}),Gr=({controllerId:t,profile:e,...r})=>Ot({...r,...ct({controllerId:t,profile:e})}),jr=t=>Rt(t);import{Principal as lr}from"@dfinity/principal";var j={reinstall:null},B={upgrade:[{skip_pre_upgrade:[!1],wasm_memory_persistence:[{replace:null}]}]};import{fromNullable as ar,isNullish as sr}from"@junobuild/utils";import{CanisterStatus as Qe}from"@dfinity/agent";import{ICManagementCanister as b}from"@dfinity/ic-management";import{Principal as Ye}from"@dfinity/principal";import{assertNonNullish as $e}from"@junobuild/utils";var Vt=async({canisterId:t,actor:e})=>{let r=await f(e),{stopCanister:o}=b.create({agent:r});await o(t)},Ft=async({canisterId:t,actor:e})=>{let r=await f(e),{startCanister:o}=b.create({agent:r});await o(t)},bt=async({actor:t,code:e})=>{let r=await f(t),{installCode:o}=b.create({agent:r});return o(e)},kt=async({actor:t,canisterId:e})=>{let r=await f(t),{storedChunks:o}=b.create({agent:r});return o({canisterId:e})},Y=async({actor:t,canisterId:e})=>{let r=await f(t),{clearChunkStore:o}=b.create({agent:r});return o({canisterId:e})},wt=async({actor:t,chunk:e})=>{let r=await f(t),{uploadChunk:o}=b.create({agent:r});return o(e)},vt=async({actor:t,code:e})=>{let r=await f(t),{installChunkedCode:o}=b.create({agent:r});return o(e)},Mt=async({actor:t,canisterId:e})=>{let r=await f(t),{canisterStatus:o}=b.create({agent:r});return o(e)},Ut=async({canisterId:t,path:e,...r})=>{$e(t,"A canister ID must be provided to request its status.");let o=await f(r);return(await Qe.request({canisterId:Ye.from(t),agent:o,paths:[{kind:"metadata",key:e,path:e,decodeStrategy:"utf-8"}]})).get(e)},Et=async({actor:t,canisterId:e})=>{let r=await f(t),{listCanisterSnapshots:o}=b.create({agent:r});return o({canisterId:e})},qt=async({actor:t,...e})=>{let r=await f(t),{takeCanisterSnapshot:o}=b.create({agent:r});return o(e)};var zt=(a=>(a[a.AssertingExistingCode=0]="AssertingExistingCode",a[a.StoppingCanister=1]="StoppingCanister",a[a.TakingSnapshot=2]="TakingSnapshot",a[a.UpgradingCode=3]="UpgradingCode",a[a.RestartingCanister=4]="RestartingCanister",a))(zt||{});var $=t=>(t instanceof Uint8Array||(t=Uint8Array.from(t)),t.reduce((e,r)=>e+r.toString(16).padStart(2,"0"),""));var Bt=t=>crypto.subtle.digest("SHA-256",t),Ht=t=>Array.from(new Uint8Array(t)).map(r=>r.toString(16).padStart(2,"0")).join(""),Kt=async t=>{let e=await Bt(await t.arrayBuffer());return Ht(e)},D=async t=>{let e=await Bt(t);return Ht(e)};import{isNullish as Ie,nonNullish as Wt}from"@junobuild/utils";var Gt=async({actor:t,canisterId:e,missionControlId:r,wasmModule:o,preClearChunks:s,...a})=>{s&&await Y({actor:t,canisterId:e});let n=await Le({wasmModule:o}),{uploadChunks:i,storedChunks:p,preClearChunks:l,postClearChunks:m}=await tr({actor:t,wasmChunks:n,canisterId:e,missionControlId:r});l&&await Y({actor:t,canisterId:e});let d=[];for await(let c of er({uploadChunks:i,actor:t,canisterId:e,missionControlId:r}))d=[...d,...c];await vt({actor:t,code:{...a,chunkHashesList:[...d,...p].sort(({orderId:c},{orderId:u})=>c-u).map(({chunkHash:c})=>c),targetCanisterId:e,storeCanisterId:r,wasmModuleHash:await D(o)}}),m&&await Y({actor:t,canisterId:e})},Le=async({wasmModule:t})=>{let e=new Blob([t]),r=[],o=1e6,s=0;for(let a=0;a<e.size;a+=o){let n=e.slice(a,a+o);r.push({chunk:n,orderId:s,sha256:await Kt(n)}),s++}return r},tr=async({canisterId:t,missionControlId:e,actor:r,wasmChunks:o})=>{let s=await kt({actor:r,canisterId:e??t}),a=s.map(({hash:p})=>({chunkHash:{hash:p},sha256:$(p)})),{storedChunks:n,uploadChunks:i}=o.reduce(({uploadChunks:p,storedChunks:l},{sha256:m,...d})=>{let c=a.find(({sha256:u})=>u===m);return{uploadChunks:[...p,...Wt(c)?[]:[{sha256:m,...d}]],storedChunks:[...l,...Wt(c)?[{...d,...c}]:[]]}},{uploadChunks:[],storedChunks:[]});return{uploadChunks:i,storedChunks:n,preClearChunks:s.length>0&&n.length===0,postClearChunks:Ie(e)}};async function*er({uploadChunks:t,limit:e=12,...r}){for(let o=0;o<t.length;o=o+e){let s=t.slice(o,o+e);yield await Promise.all(s.map(n=>rr({uploadChunk:n,...r})))}}var rr=async({actor:t,canisterId:e,missionControlId:r,uploadChunk:{chunk:o,...s}})=>({chunkHash:await wt({actor:t,chunk:{canisterId:r??e,chunk:new Uint8Array(await o.arrayBuffer())}}),...s});var jt=async({actor:t,...e})=>{await bt({actor:t,code:e})};var q=async({wasmModule:t,canisterId:e,actor:r,onProgress:o,takeSnapshot:s=!0,...a})=>{await X({fn:async()=>await nr({wasmModule:t,canisterId:e,actor:r,...a}),onProgress:o,step:0}),await X({fn:async()=>await Vt({canisterId:e,actor:r}),onProgress:o,step:1});try{await X({fn:async()=>s?await cr({canisterId:e,actor:r}):Promise.resolve(),onProgress:o,step:2}),await X({fn:async()=>await ir({wasmModule:t,canisterId:e,actor:r,...a}),onProgress:o,step:3})}finally{await X({fn:async()=>await Ft({canisterId:e,actor:r}),onProgress:o,step:4})}},X=async({fn:t,step:e,onProgress:r})=>{r?.({step:e,state:"in_progress"});try{await t(),r?.({step:e,state:"success"})}catch(o){throw r?.({step:e,state:"error"}),o}},nr=async({actor:t,canisterId:e,wasmModule:r,reset:o})=>{if(o===!0)return;let{module_hash:s}=await Mt({actor:t,canisterId:e}),a=ar(s);if(sr(a))return;let n=await D(r),i=$(a);if(n===i)throw new J},ir=async({wasmModule:t,canisterId:e,actor:r,...o})=>{await((new Blob([t]).size>2e6?"chunked":"single")==="chunked"?Gt:jt)({wasmModule:t,canisterId:e,actor:r,...o})},cr=async t=>{let e=await Et(t);await qt({...t,snapshotId:e?.[0]?.id})};import{IDL as H}from"@dfinity/candid";var Xt=t=>H.encode([H.Record({user:H.Principal})],[{user:t}]),I=t=>H.encode([H.Record({controllers:H.Vec(H.Principal)})],[{controllers:t.map(([e,r])=>e)}]);var wo=async({missionControl:t,...e})=>{let r=await St({missionControl:t}),{missionControlId:o,...s}=t;if(!o)throw new Error("No mission control principal defined.");let a=Xt(r);await q({actor:s,canisterId:lr.fromText(o),arg:new Uint8Array(a),mode:B,...e})};var Uo=t=>ht(t);var zo=async t=>{await q(t)};var Zt=async({orbiter:t})=>(await Q(t)).version(),L=async({orbiter:t})=>(await Q(t)).list_controllers(),Jt=async({orbiter:t})=>{let{memory_size:e}=await Q(t);return e()};var Go=t=>L(t);var Zo=t=>Jt(t);import{Principal as pr}from"@dfinity/principal";var Lo=async({orbiter:t,reset:e=!1,...r})=>{let{orbiterId:o,...s}=t;if(!o)throw new Error("No orbiter principal defined.");let a=await L({orbiter:t}),n=I(a);await q({actor:s,canisterId:pr.fromText(o),arg:new Uint8Array(n),mode:e?j:B,reset:e,...r})};var ra=t=>Zt(t);import{major as Qt,minor as Yt,patch as $t}from"semver";var sa=({currentVersion:t,selectedVersion:e})=>{let r=Qt(t),o=Qt(e),s=Yt(t),a=Yt(e),n=$t(t),i=$t(e);return r<o-1||s<a-1||n<i-1?{canUpgrade:!1}:{canUpgrade:!0}};import{toNullable as dr}from"@junobuild/utils";var Dt=async({config:t,satellite:e})=>{let{set_storage_config:r}=await _(e);return r(t)},It=async({config:t,satellite:e})=>{let{set_db_config:r}=await _(e);return r(t)},Lt=async({config:t,satellite:e})=>{let{set_auth_config:r}=await _(e);return r(t)};var te=async({satellite:t})=>{let{get_auth_config:e}=await _(t);return e()},ee=async({satellite:t,type:e})=>(await _(t)).list_rules(e),re=async({type:t,collection:e,rule:r,satellite:o})=>{let{set_rule:s}=await _(o);return s(t,e,r)},oe=async({satellite:t})=>{let{version:e}=await _(t);return e()},ae=async({satellite:t})=>{let{build_version:e}=await _(t);return e()},se=async({satellite:t})=>(await Ct(t)).list_controllers(),tt=async({satellite:t})=>(await Nt(t)).list_controllers(),et=async({satellite:t})=>(await _(t)).list_controllers(),ne=async({satellite:t})=>{let{list_custom_domains:e}=await _(t);return e()},ie=async({satellite:t,domainName:e,boundaryNodesId:r})=>{let{set_custom_domain:o}=await _(t);await o(e,dr(r))},ce=async({satellite:t})=>{let{memory_size:e}=await _(t);return e()},le=async({collection:t,satellite:e})=>{let{count_collection_docs:r}=await _(e);return r(t)},pe=async({collection:t,satellite:e})=>{let{count_collection_assets:r}=await _(e);return r(t)},de=async({collection:t,satellite:e})=>{let{del_docs:r}=await _(e);return r(t)},ue=async({collection:t,satellite:e})=>{let{del_assets:r}=await _(e);return r(t)},me=async({args:t,satellite:e})=>{let{set_controllers:r}=await _(e);return r(t)};var da=t=>pe(t),ua=t=>ue(t);import{fromNullable as rt,isNullish as ye,nonNullish as _e}from"@junobuild/utils";import{nonNullish as ur,toNullable as lt}from"@junobuild/utils";var pt=t=>lt(ur(t)?{heap:lt(t.heap),stable:lt(t.stable)}:void 0);var fa=async({config:{headers:t,rewrites:e,redirects:r,iframe:o,rawAccess:s,maxMemorySize:a},satellite:n})=>{let i=(t??[]).map(({source:c,headers:u})=>[c,u]),p=(e??[]).map(({source:c,destination:u})=>[c,u]),l=(r??[]).map(({source:c,location:u,code:g})=>[c,{status_code:g,location:u}]);return await Dt({satellite:n,config:{headers:i,rewrites:p,redirects:[l],iframe:[o==="same-origin"?{SameOrigin:null}:o==="allow-any"?{AllowAny:null}:{Deny:null}],raw_access:[s===!0?{Allow:null}:{Deny:null}],max_memory_size:pt(a)}})},Pa=async({config:{maxMemorySize:t},...e})=>{await It({config:{max_memory_size:pt(t)},...e})},Ca=async({config:{internetIdentity:t},...e})=>{await Lt({config:{internet_identity:ye(t?.derivationOrigin)?[]:[{derivation_origin:[t.derivationOrigin]}]},...e})},Na=async({satellite:t})=>{let e=rt(await te({satellite:t}));if(ye(e))return;let r=rt(e.internet_identity??[]);return{..._e(r)&&{internetIdentity:{..._e(rt(r.derivation_origin))&&{derivationOrigin:rt(r.derivation_origin)}}}}};var Ra=({deprecatedNoScope:t,...e})=>(t===!0?tt:et)(e),Aa=t=>me(t);var Fa=t=>le(t),ba=t=>de(t);import{fromNullable as ge,nonNullish as mr}from"@junobuild/utils";var Ma=async({satellite:t})=>(await ne({satellite:t})).map(([r,o])=>{let s=ge(o.version);return{domain:r,bn_id:ge(o.bn_id),created_at:o.created_at,updated_at:o.updated_at,...mr(s)&&{version:s}}}),Ua=({satellite:t,domains:e})=>Promise.all(e.map(({domain:r,bn_id:o})=>ie({satellite:t,domainName:r,boundaryNodesId:o})));var za=t=>ce(t);import{fromNullable as W,nonNullish as z,toNullable as ot}from"@junobuild/utils";var xe={Db:null},Te={Storage:null},fe={Public:null},Pe={Private:null},Ce={Managed:null},Ne={Controllers:null},dt={Heap:null},he={Stable:null},Se=600000000n;var ut=t=>t==="storage"?Te:xe,Oe=({read:t,write:e,memory:r,maxSize:o,maxCapacity:s,version:a,mutablePermissions:n,maxTokens:i})=>({read:Ae(t),write:Ae(e),memory:z(r)?[_r(r)]:[],version:ot(a),max_size:ot(z(o)&&o>0?BigInt(o):void 0),max_capacity:ot(z(s)&&s>0?s:void 0),mutable_permissions:ot(n),rate_config:z(i)?[{max_tokens:BigInt(i),time_per_token_ns:Se}]:[]}),Ve=([t,e])=>{let{read:r,write:o,updated_at:s,created_at:a,max_size:n,max_capacity:i,memory:p,mutable_permissions:l,version:m,rate_config:d}=e,c=n?.[0]??0n>0n?Number(W(n)):void 0,u=i?.[0]??!1?W(i):void 0,g=W(m),P=d?.[0]?.max_tokens??0n>0n?W(d)?.max_tokens:void 0;return{collection:t,read:Re(r),write:Re(o),memory:yr(W(p)??dt),updatedAt:s,createdAt:a,...z(g)&&{version:g},...z(c)&&{maxSize:c},...z(u)&&{maxCapacity:u},mutablePermissions:W(l)??!0,...z(P)&&{maxTokens:Number(P)}}},Re=t=>"Public"in t?"public":"Private"in t?"private":"Managed"in t?"managed":"controllers",Ae=t=>{switch(t){case"public":return fe;case"private":return Pe;case"managed":return Ce;default:return Ne}},_r=t=>{switch(t.toLowerCase()){case"heap":return dt;default:return he}},yr=t=>"Heap"in t?"heap":"stable";var Za=async({type:t,satellite:e})=>(await ee({satellite:e,type:ut(t)})).map(o=>Ve(o)),Ja=async({rule:{collection:t,...e},type:r,satellite:o})=>{await re({type:ut(r),rule:Oe(e),satellite:o,collection:t})};import{IDL as at}from"@dfinity/candid";import{Principal as Fe}from"@dfinity/principal";import{isNullish as gr}from"@junobuild/utils";var rs=async({satellite:t,deprecated:e,deprecatedNoScope:r,reset:o=!1,...s})=>{let{satelliteId:a,...n}=t;if(gr(a))throw new Error("No satellite principal defined.");if(e){let m=await se({satellite:t}),d=at.encode([at.Record({controllers:at.Vec(at.Principal)})],[{controllers:m}]);await q({actor:n,canisterId:Fe.fromText(a),arg:new Uint8Array(d),mode:o?j:B,reset:o,...s});return}let p=await(r?tt:et)({satellite:t}),l=I(p);await q({actor:n,canisterId:Fe.fromText(a),arg:new Uint8Array(l),mode:o?j:B,reset:o,...s})};import{nonNullish as xr}from"@junobuild/utils";var is=t=>oe(t),cs=t=>ae(t),ls=async({satellite:{satelliteId:t,...e}})=>{let r=await Ut({...e,canisterId:t,path:"juno:build"});return xr(r)&&["stock","extended"].includes(r)?r:void 0};export{zt as UpgradeCodeProgressStep,J as UpgradeCodeUnchangedError,Kt as blobSha256,sa as checkUpgradeVersion,da as countAssets,Fa as countDocs,ua as deleteAssets,ba as deleteDocs,Na as getAuthConfig,Ma as listCustomDomains,jr as listMissionControlControllers,Go as listOrbiterControllers,Za as listRules,Ra as listSatelliteControllers,Uo as missionControlVersion,Zo as orbiterMemorySize,ra as orbiterVersion,ls as satelliteBuildType,cs as satelliteBuildVersion,za as satelliteMemorySize,is as satelliteVersion,Ca as setAuthConfig,Ua as setCustomDomains,Pa as setDatastoreConfig,Gr as setMissionControlController,Ja as setRule,Aa as setSatelliteControllers,Wr as setSatellitesController,fa as setStorageConfig,D as uint8ArraySha256,wo as upgradeMissionControl,zo as upgradeModule,Lo as upgradeOrbiter,rs as upgradeSatellite};
|
|
3
|
+
var $=class extends Error{constructor(){super("The Wasm code for the upgrade is identical to the code currently installed. No upgrade is necessary.")}};import{isNullish as Ge}from"@dfinity/utils";var gt=({IDL:t})=>{let e=t.Record({fund_cycles:t.Nat,min_cycles:t.Nat}),r=t.Variant({BelowThreshold:e}),o=t.Record({strategy:t.Opt(r),enabled:t.Bool}),a=t.Record({cycles:t.Opt(o)}),s=t.Record({monitoring:t.Opt(a)}),n=t.Record({updated_at:t.Nat64,orbiter_id:t.Principal,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,settings:t.Opt(s)}),i=t.Record({subnet_id:t.Opt(t.Principal),name:t.Opt(t.Text)}),l=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,satellite_id:t.Principal,settings:t.Opt(s)}),p=t.Record({cycles:t.Nat,destination_id:t.Principal}),m=t.Record({to:t.Opt(t.Text),enabled:t.Bool}),u=t.Record({notification:t.Opt(m),default_strategy:t.Opt(r)}),c=t.Record({cycles:t.Opt(u)}),d=t.Record({monitoring:t.Opt(c)}),g=t.Record({to:t.Opt(t.Nat64),from:t.Opt(t.Nat64),segment_id:t.Principal}),C=t.Record({segment_id:t.Principal,created_at:t.Nat64,nonce:t.Int32}),M=t.Record({timestamp:t.Nat64,amount:t.Nat}),F=t.Record({deposited_cycles:t.Opt(M),cycles:M}),N=t.Record({cycles:t.Opt(F)}),h=t.Record({monitored_ids:t.Vec(t.Principal),running:t.Bool}),V=t.Record({cycles:t.Opt(h)}),S=t.Record({updated_at:t.Nat64,created_at:t.Nat64,monitoring:t.Opt(a)}),U=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),user:t.Opt(t.Principal),created_at:t.Nat64,config:t.Opt(d)}),x=t.Record({e8s:t.Nat64}),q=t.Record({timestamp_nanos:t.Nat64}),f=t.Record({to:t.Vec(t.Nat8),fee:x,memo:t.Nat64,from_subaccount:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(q),amount:x}),y=t.Variant({TxTooOld:t.Record({allowed_window_nanos:t.Nat64}),BadFee:t.Record({expected_fee:x}),TxDuplicate:t.Record({duplicate_of:t.Nat64}),TxCreatedInFuture:t.Null,InsufficientFunds:t.Record({balance:x})}),T=t.Variant({Ok:t.Nat64,Err:y}),b=t.Record({owner:t.Principal,subaccount:t.Opt(t.Vec(t.Nat8))}),R=t.Record({to:b,fee:t.Opt(t.Nat),memo:t.Opt(t.Vec(t.Nat8)),from_subaccount:t.Opt(t.Vec(t.Nat8)),created_at_time:t.Opt(t.Nat64),amount:t.Nat}),k=t.Variant({GenericError:t.Record({message:t.Text,error_code:t.Nat}),TemporarilyUnavailable:t.Null,BadBurn:t.Record({min_burn_amount:t.Nat}),Duplicate:t.Record({duplicate_of:t.Nat}),BadFee:t.Record({expected_fee:t.Nat}),CreatedInFuture:t.Record({ledger_time:t.Nat64}),TooOld:t.Null,InsufficientFunds:t.Record({balance:t.Nat})}),w=t.Variant({Ok:t.Nat,Err:k}),O=t.Variant({Write:t.Null,Admin:t.Null}),A=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,scope:O,expires_at:t.Opt(t.Nat64)}),z=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),scope:O,expires_at:t.Opt(t.Nat64)}),W=t.Record({ids:t.Vec(t.Principal),strategy:r}),G=t.Record({orbiters_strategy:t.Opt(W),mission_control_strategy:t.Opt(r),satellites_strategy:t.Opt(W)}),Z=t.Record({cycles_config:t.Opt(G)}),ct=t.Record({satellite_ids:t.Opt(t.Vec(t.Principal)),try_mission_control:t.Opt(t.Bool),orbiter_ids:t.Opt(t.Vec(t.Principal))}),lt=t.Record({cycles_config:t.Opt(ct)});return t.Service({add_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),add_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),create_orbiter:t.Func([t.Opt(t.Text)],[n],[]),create_orbiter_with_config:t.Func([i],[n],[]),create_satellite:t.Func([t.Text],[l],[]),create_satellite_with_config:t.Func([i],[l],[]),del_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),del_orbiter:t.Func([t.Principal,t.Nat],[],[]),del_orbiters_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),del_satellite:t.Func([t.Principal,t.Nat],[],[]),del_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),deposit_cycles:t.Func([p],[],[]),get_config:t.Func([],[t.Opt(d)],["query"]),get_metadata:t.Func([],[t.Vec(t.Tuple(t.Text,t.Text))],["query"]),get_monitoring_history:t.Func([g],[t.Vec(t.Tuple(C,N))],["query"]),get_monitoring_status:t.Func([],[V],["query"]),get_settings:t.Func([],[t.Opt(S)],["query"]),get_user:t.Func([],[t.Principal],["query"]),get_user_data:t.Func([],[U],["query"]),icp_transfer:t.Func([f],[T],[]),icrc_transfer:t.Func([t.Principal,R],[w],[]),list_mission_control_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,A))],["query"]),list_orbiters:t.Func([],[t.Vec(t.Tuple(t.Principal,n))],["query"]),list_satellites:t.Func([],[t.Vec(t.Tuple(t.Principal,l))],["query"]),remove_mission_control_controllers:t.Func([t.Vec(t.Principal)],[],[]),remove_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal)],[],[]),set_config:t.Func([t.Opt(d)],[],[]),set_metadata:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[],[]),set_mission_control_controllers:t.Func([t.Vec(t.Principal),z],[],[]),set_orbiter:t.Func([t.Principal,t.Opt(t.Text)],[n],[]),set_orbiter_metadata:t.Func([t.Principal,t.Vec(t.Tuple(t.Text,t.Text))],[n],[]),set_orbiters_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal),z],[],[]),set_satellite:t.Func([t.Principal,t.Opt(t.Text)],[l],[]),set_satellite_metadata:t.Func([t.Principal,t.Vec(t.Tuple(t.Text,t.Text))],[l],[]),set_satellites_controllers:t.Func([t.Vec(t.Principal),t.Vec(t.Principal),z],[],[]),start_monitoring:t.Func([],[],[]),stop_monitoring:t.Func([],[],[]),top_up:t.Func([t.Principal,x],[],[]),unset_orbiter:t.Func([t.Principal],[],[]),unset_satellite:t.Func([t.Principal],[],[]),update_and_start_monitoring:t.Func([Z],[],[]),update_and_stop_monitoring:t.Func([lt],[],[]),version:t.Func([],[t.Text],["query"])})};var xt=({IDL:t})=>{let e=t.Record({controllers:t.Vec(t.Principal)}),r=t.Variant({Write:t.Null,Admin:t.Null}),o=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,scope:r,expires_at:t.Opt(t.Nat64)}),a=t.Record({version:t.Opt(t.Nat64)}),s=t.Record({cycles:t.Nat,destination_id:t.Principal}),n=t.Record({to:t.Opt(t.Nat64),from:t.Opt(t.Nat64),satellite_id:t.Opt(t.Principal)}),i=t.Record({key:t.Text,collected_at:t.Nat64}),l=t.Record({inner_height:t.Nat16,inner_width:t.Nat16}),p=t.Record({title:t.Text,updated_at:t.Nat64,referrer:t.Opt(t.Text),time_zone:t.Text,session_id:t.Text,href:t.Text,created_at:t.Nat64,satellite_id:t.Principal,device:l,version:t.Opt(t.Nat64),user_agent:t.Opt(t.Text)}),m=t.Record({safari:t.Float64,opera:t.Float64,others:t.Float64,firefox:t.Float64,chrome:t.Float64}),u=t.Record({desktop:t.Float64,others:t.Float64,mobile:t.Float64}),c=t.Record({browsers:m,devices:u}),d=t.Record({day:t.Nat8,month:t.Nat8,year:t.Int32}),g=t.Record({bounce_rate:t.Float64,average_page_views_per_session:t.Float64,daily_total_page_views:t.Vec(t.Tuple(d,t.Nat32)),total_page_views:t.Nat32,unique_page_views:t.Nat64,unique_sessions:t.Nat64}),C=t.Record({referrers:t.Vec(t.Tuple(t.Text,t.Nat32)),pages:t.Vec(t.Tuple(t.Text,t.Nat32))}),M=t.Variant({Navigate:t.Null,Restore:t.Null,Reload:t.Null,BackForward:t.Null,BackForwardCache:t.Null,Prerender:t.Null}),F=t.Record({id:t.Text,value:t.Float64,navigation_type:t.Opt(M),delta:t.Float64}),N=t.Variant({WebVitalsMetric:F}),h=t.Variant({CLS:t.Null,FCP:t.Null,INP:t.Null,LCP:t.Null,TTFB:t.Null}),V=t.Record({updated_at:t.Nat64,session_id:t.Text,data:N,href:t.Text,metric_name:h,created_at:t.Nat64,satellite_id:t.Principal,version:t.Opt(t.Nat64)}),S=t.Record({cls:t.Opt(t.Float64),fcp:t.Opt(t.Float64),inp:t.Opt(t.Float64),lcp:t.Opt(t.Float64),ttfb:t.Opt(t.Float64)}),U=t.Record({overall:S,pages:t.Vec(t.Tuple(t.Text,S))}),x=t.Record({updated_at:t.Nat64,session_id:t.Text,metadata:t.Opt(t.Vec(t.Tuple(t.Text,t.Text))),name:t.Text,created_at:t.Nat64,satellite_id:t.Principal,version:t.Opt(t.Nat64)}),q=t.Record({total:t.Vec(t.Tuple(t.Text,t.Nat32))}),f=t.Record({performance_metrics:t.Bool,track_events:t.Bool,page_views:t.Bool}),y=t.Record({updated_at:t.Nat64,features:t.Opt(f),created_at:t.Nat64,version:t.Opt(t.Nat64)}),T=t.Record({stable:t.Nat64,heap:t.Nat64}),b=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),scope:r,expires_at:t.Opt(t.Nat64)}),R=t.Record({controller:b,controllers:t.Vec(t.Principal)}),k=t.Record({title:t.Text,updated_at:t.Opt(t.Nat64),referrer:t.Opt(t.Text),time_zone:t.Text,session_id:t.Text,href:t.Text,satellite_id:t.Principal,device:l,version:t.Opt(t.Nat64),user_agent:t.Opt(t.Text)}),w=t.Variant({Ok:p,Err:t.Text}),O=t.Variant({Ok:t.Null,Err:t.Vec(t.Tuple(i,t.Text))}),A=t.Record({session_id:t.Text,data:N,href:t.Text,metric_name:h,satellite_id:t.Principal,version:t.Opt(t.Nat64),user_agent:t.Opt(t.Text)}),z=t.Variant({Ok:V,Err:t.Text}),W=t.Record({features:t.Opt(f),version:t.Opt(t.Nat64)}),G=t.Record({updated_at:t.Opt(t.Nat64),session_id:t.Text,metadata:t.Opt(t.Vec(t.Tuple(t.Text,t.Text))),name:t.Text,satellite_id:t.Principal,version:t.Opt(t.Nat64),user_agent:t.Opt(t.Text)}),Z=t.Variant({Ok:x,Err:t.Text});return t.Service({del_controllers:t.Func([e],[t.Vec(t.Tuple(t.Principal,o))],[]),del_satellite_config:t.Func([t.Principal,a],[],[]),deposit_cycles:t.Func([s],[],[]),get_page_views:t.Func([n],[t.Vec(t.Tuple(i,p))],["query"]),get_page_views_analytics_clients:t.Func([n],[c],["query"]),get_page_views_analytics_metrics:t.Func([n],[g],["query"]),get_page_views_analytics_top_10:t.Func([n],[C],["query"]),get_performance_metrics:t.Func([n],[t.Vec(t.Tuple(i,V))],["query"]),get_performance_metrics_analytics_web_vitals:t.Func([n],[U],["query"]),get_track_events:t.Func([n],[t.Vec(t.Tuple(i,x))],["query"]),get_track_events_analytics:t.Func([n],[q],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,o))],["query"]),list_satellite_configs:t.Func([],[t.Vec(t.Tuple(t.Principal,y))],["query"]),memory_size:t.Func([],[T],["query"]),set_controllers:t.Func([R],[t.Vec(t.Tuple(t.Principal,o))],[]),set_page_view:t.Func([i,k],[w],[]),set_page_views:t.Func([t.Vec(t.Tuple(i,k))],[O],[]),set_performance_metric:t.Func([i,A],[z],[]),set_performance_metrics:t.Func([t.Vec(t.Tuple(i,A))],[O],[]),set_satellite_configs:t.Func([t.Vec(t.Tuple(t.Principal,W))],[t.Vec(t.Tuple(t.Principal,y))],[]),set_track_event:t.Func([i,G],[Z],[]),set_track_events:t.Func([t.Vec(t.Tuple(i,G))],[O],[]),version:t.Func([],[t.Text],["query"])})};var ft=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Record({controllers:t.Vec(t.Principal)}),o=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,expires_at:t.Opt(t.Nat64)}),a=t.Record({updated_at:t.Opt(t.Nat64)}),s=t.Record({headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text))))}),n=t.Record({storage:s}),i=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),created_at:t.Nat64}),l=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text))}),p=t.Record({token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),m=t.Variant({Callback:t.Record({token:p,callback:t.Func([],[],[])})}),u=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(m),status_code:t.Nat16}),c=t.Record({token:t.Opt(p),body:t.Vec(t.Nat8)}),d=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,encoding_type:t.Opt(t.Text),full_path:t.Text}),g=t.Record({batch_id:t.Nat}),C=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),M=t.Record({field:C,desc:t.Bool}),F=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),N=t.Record({order:t.Opt(M),owner:t.Opt(t.Principal),matcher:t.Opt(t.Text),paginate:t.Opt(F)}),h=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,full_path:t.Text}),V=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),S=t.Record({key:h,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,V)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64}),U=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,S))}),x=t.Record({updated_at:t.Nat64,created_at:t.Nat64,bn_id:t.Opt(t.Text)}),q=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,i))}),f=t.Variant({Db:t.Null,Storage:t.Null}),y=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),T=t.Record({updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:y,created_at:t.Nat64,write:y}),b=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),expires_at:t.Opt(t.Nat64)}),R=t.Record({controller:b,controllers:t.Vec(t.Principal)}),k=t.Record({updated_at:t.Opt(t.Nat64),data:t.Vec(t.Nat8)}),w=t.Record({updated_at:t.Opt(t.Nat64),max_size:t.Opt(t.Nat),read:y,write:y}),O=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat}),A=t.Record({chunk_id:t.Nat});return t.Service({commit_asset_upload:t.Func([e],[],[]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Opt(t.Text)],[],[]),del_controllers:t.Func([r],[t.Vec(t.Tuple(t.Principal,o))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,a],[],[]),get_config:t.Func([],[n],[]),get_doc:t.Func([t.Text,t.Text],[t.Opt(i)],["query"]),http_request:t.Func([l],[u],["query"]),http_request_streaming_callback:t.Func([p],[c],["query"]),init_asset_upload:t.Func([d],[g],[]),list_assets:t.Func([t.Opt(t.Text),N],[U],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,o))],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,x))],["query"]),list_docs:t.Func([t.Text,N],[q],["query"]),list_rules:t.Func([f],[t.Vec(t.Tuple(t.Text,T))],["query"]),set_config:t.Func([n],[],[]),set_controllers:t.Func([R],[t.Vec(t.Tuple(t.Principal,o))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_doc:t.Func([t.Text,t.Text,k],[i],[]),set_rule:t.Func([f,t.Text,w],[],[]),upload_asset_chunk:t.Func([O],[A],[]),version:t.Func([],[t.Text],["query"])})};var Tt=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Record({controllers:t.Vec(t.Principal)}),o=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,expires_at:t.Opt(t.Nat64)}),a=t.Record({updated_at:t.Opt(t.Nat64)}),s=t.Record({headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text))))}),n=t.Record({storage:s}),i=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),created_at:t.Nat64}),l=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text))}),p=t.Record({token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),m=t.Variant({Callback:t.Record({token:p,callback:t.Func([],[],[])})}),u=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(m),status_code:t.Nat16}),c=t.Record({token:t.Opt(p),body:t.Vec(t.Nat8)}),d=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,encoding_type:t.Opt(t.Text),full_path:t.Text}),g=t.Record({batch_id:t.Nat}),C=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),M=t.Record({field:C,desc:t.Bool}),F=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),N=t.Record({order:t.Opt(M),matcher:t.Opt(t.Text),paginate:t.Opt(F)}),h=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,full_path:t.Text}),V=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),S=t.Record({key:h,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,V)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64}),U=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,S))}),x=t.Record({updated_at:t.Nat64,created_at:t.Nat64,bn_id:t.Opt(t.Text)}),q=t.Record({matches_length:t.Nat64,length:t.Nat64,items:t.Vec(t.Tuple(t.Text,i))}),f=t.Variant({Db:t.Null,Storage:t.Null}),y=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),T=t.Record({updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:y,created_at:t.Nat64,write:y}),b=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),expires_at:t.Opt(t.Nat64)}),R=t.Record({controller:b,controllers:t.Vec(t.Principal)}),k=t.Record({updated_at:t.Opt(t.Nat64),data:t.Vec(t.Nat8)}),w=t.Record({updated_at:t.Opt(t.Nat64),max_size:t.Opt(t.Nat),read:y,write:y}),O=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat}),A=t.Record({chunk_id:t.Nat});return t.Service({commit_asset_upload:t.Func([e],[],[]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Opt(t.Text)],[],[]),del_controllers:t.Func([r],[t.Vec(t.Tuple(t.Principal,o))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,a],[],[]),get_config:t.Func([],[n],[]),get_doc:t.Func([t.Text,t.Text],[t.Opt(i)],["query"]),http_request:t.Func([l],[u],["query"]),http_request_streaming_callback:t.Func([p],[c],["query"]),init_asset_upload:t.Func([d],[g],[]),list_assets:t.Func([t.Opt(t.Text),N],[U],["query"]),list_controllers:t.Func([],[t.Vec(t.Principal)],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,x))],["query"]),list_docs:t.Func([t.Text,N],[q],["query"]),list_rules:t.Func([f],[t.Vec(t.Tuple(t.Text,T))],["query"]),set_config:t.Func([n],[],[]),set_controllers:t.Func([R],[t.Vec(t.Tuple(t.Principal,o))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_doc:t.Func([t.Text,t.Text,k],[i],[]),set_rule:t.Func([f,t.Text,w],[],[]),upload_asset_chunk:t.Func([O],[A],[]),version:t.Func([],[t.Text],["query"])})};var Pt=({IDL:t})=>{let e=t.Record({batch_id:t.Nat,headers:t.Vec(t.Tuple(t.Text,t.Text)),chunk_ids:t.Vec(t.Nat)}),r=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),o=t.Record({field:r,desc:t.Bool}),a=t.Variant({Equal:t.Nat64,Between:t.Tuple(t.Nat64,t.Nat64),GreaterThan:t.Nat64,LessThan:t.Nat64}),s=t.Record({key:t.Opt(t.Text),updated_at:t.Opt(a),description:t.Opt(t.Text),created_at:t.Opt(a)}),n=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),i=t.Record({order:t.Opt(o),owner:t.Opt(t.Principal),matcher:t.Opt(s),paginate:t.Opt(n)}),l=t.Record({controllers:t.Vec(t.Principal)}),p=t.Variant({Write:t.Null,Admin:t.Null}),m=t.Record({updated_at:t.Nat64,metadata:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,scope:p,expires_at:t.Opt(t.Nat64)}),u=t.Record({version:t.Opt(t.Nat64)}),c=t.Variant({Db:t.Null,Storage:t.Null}),d=t.Record({version:t.Opt(t.Nat64)}),g=t.Record({cycles:t.Nat,destination_id:t.Principal}),C=t.Record({token:t.Opt(t.Text),collection:t.Text,owner:t.Principal,name:t.Text,description:t.Opt(t.Text),full_path:t.Text}),M=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),F=t.Record({key:C,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,M)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,version:t.Opt(t.Nat64)}),N=t.Record({derivation_origin:t.Opt(t.Text)}),h=t.Record({internet_identity:t.Opt(N)}),V=t.Record({stable:t.Opt(t.Nat64),heap:t.Opt(t.Nat64)}),S=t.Record({max_memory_size:t.Opt(V)}),U=t.Variant({Deny:t.Null,AllowAny:t.Null,SameOrigin:t.Null}),x=t.Variant({Deny:t.Null,Allow:t.Null}),q=t.Record({status_code:t.Nat16,location:t.Text}),f=t.Record({iframe:t.Opt(U),rewrites:t.Vec(t.Tuple(t.Text,t.Text)),headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text)))),max_memory_size:t.Opt(V),raw_access:t.Opt(x),redirects:t.Opt(t.Vec(t.Tuple(t.Text,q)))}),y=t.Record({db:t.Opt(S),authentication:t.Opt(h),storage:f}),T=t.Record({updated_at:t.Nat64,owner:t.Principal,data:t.Vec(t.Nat8),description:t.Opt(t.Text),created_at:t.Nat64,version:t.Opt(t.Nat64)}),b=t.Variant({Heap:t.Null,Stable:t.Null}),R=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),k=t.Record({max_tokens:t.Nat64,time_per_token_ns:t.Nat64}),w=t.Record({max_capacity:t.Opt(t.Nat32),memory:t.Opt(b),updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:R,created_at:t.Nat64,version:t.Opt(t.Nat64),mutable_permissions:t.Opt(t.Bool),rate_config:t.Opt(k),write:R}),O=t.Record({url:t.Text,method:t.Text,body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),certificate_version:t.Opt(t.Nat16)}),A=t.Record({memory:b,token:t.Opt(t.Text),sha256:t.Opt(t.Vec(t.Nat8)),headers:t.Vec(t.Tuple(t.Text,t.Text)),index:t.Nat64,encoding_type:t.Text,full_path:t.Text}),z=t.Variant({Callback:t.Record({token:A,callback:t.Func([],[],["query"])})}),W=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(z),status_code:t.Nat16}),G=t.Record({token:t.Opt(A),body:t.Vec(t.Nat8)}),Z=t.Record({token:t.Opt(t.Text),collection:t.Text,name:t.Text,description:t.Opt(t.Text),encoding_type:t.Opt(t.Text),full_path:t.Text}),ct=t.Record({batch_id:t.Nat}),lt=t.Record({matches_pages:t.Opt(t.Nat64),matches_length:t.Nat64,items_page:t.Opt(t.Nat64),items:t.Vec(t.Tuple(t.Text,F)),items_length:t.Nat64}),we=t.Record({updated_at:t.Nat64,created_at:t.Nat64,version:t.Opt(t.Nat64),bn_id:t.Opt(t.Text)}),Me=t.Record({matches_pages:t.Opt(t.Nat64),matches_length:t.Nat64,items_page:t.Opt(t.Nat64),items:t.Vec(t.Tuple(t.Text,T)),items_length:t.Nat64}),ve=t.Record({stable:t.Nat64,heap:t.Nat64}),Ue=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),scope:p,expires_at:t.Opt(t.Nat64)}),qe=t.Record({controller:Ue,controllers:t.Vec(t.Principal)}),yt=t.Record({data:t.Vec(t.Nat8),description:t.Opt(t.Text),version:t.Opt(t.Nat64)}),Ee=t.Record({max_capacity:t.Opt(t.Nat32),memory:t.Opt(b),max_size:t.Opt(t.Nat),read:R,version:t.Opt(t.Nat64),mutable_permissions:t.Opt(t.Bool),rate_config:t.Opt(k),write:R}),Be=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat,order_id:t.Opt(t.Nat)}),ze=t.Record({chunk_id:t.Nat});return t.Service({build_version:t.Func([],[t.Text],["query"]),commit_asset_upload:t.Func([e],[],[]),count_assets:t.Func([t.Text,i],[t.Nat64],["query"]),count_collection_assets:t.Func([t.Text],[t.Nat64],["query"]),count_collection_docs:t.Func([t.Text],[t.Nat64],["query"]),count_docs:t.Func([t.Text,i],[t.Nat64],["query"]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Text],[],[]),del_controllers:t.Func([l],[t.Vec(t.Tuple(t.Principal,m))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,u],[],[]),del_docs:t.Func([t.Text],[],[]),del_filtered_assets:t.Func([t.Text,i],[],[]),del_filtered_docs:t.Func([t.Text,i],[],[]),del_many_assets:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[],[]),del_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text,u))],[],[]),del_rule:t.Func([c,t.Text,d],[],[]),deposit_cycles:t.Func([g],[],[]),get_asset:t.Func([t.Text,t.Text],[t.Opt(F)],["query"]),get_auth_config:t.Func([],[t.Opt(h)],["query"]),get_config:t.Func([],[y],[]),get_db_config:t.Func([],[t.Opt(S)],["query"]),get_doc:t.Func([t.Text,t.Text],[t.Opt(T)],["query"]),get_many_assets:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[t.Vec(t.Tuple(t.Text,t.Opt(F)))],["query"]),get_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[t.Vec(t.Tuple(t.Text,t.Opt(T)))],["query"]),get_rule:t.Func([c,t.Text],[t.Opt(w)],["query"]),get_storage_config:t.Func([],[f],["query"]),http_request:t.Func([O],[W],["query"]),http_request_streaming_callback:t.Func([A],[G],["query"]),init_asset_upload:t.Func([Z],[ct],[]),list_assets:t.Func([t.Text,i],[lt],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,m))],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,we))],["query"]),list_docs:t.Func([t.Text,i],[Me],["query"]),list_rules:t.Func([c],[t.Vec(t.Tuple(t.Text,w))],["query"]),memory_size:t.Func([],[ve],["query"]),set_auth_config:t.Func([h],[],[]),set_controllers:t.Func([qe],[t.Vec(t.Tuple(t.Principal,m))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_db_config:t.Func([S],[],[]),set_doc:t.Func([t.Text,t.Text,yt],[T],[]),set_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text,yt))],[t.Vec(t.Tuple(t.Text,T))],[]),set_rule:t.Func([c,t.Text,Ee],[w],[]),set_storage_config:t.Func([f],[],[]),upload_asset_chunk:t.Func([Be],[ze],[]),version:t.Func([],[t.Text],["query"])})};import{Actor as He,HttpAgent as Ke}from"@dfinity/agent";import{nonNullish as Ct}from"@dfinity/utils";var Nt=async({canisterId:t,idlFactory:e,config:r,...o})=>{let a=await P(o);return He.createActor(e,{agent:a,canisterId:t,...r??{}})},P=async({agent:t,...e})=>t??await We(e),We=async({identity:t,fetch:e,container:r})=>{let o=Ct(r)&&r!==!1,a=o?r===!0?"http://127.0.0.1:5987":r:"https://icp-api.io";return await Ke.create({identity:t,host:a,retryTimes:10,...Ct(e)&&{fetch:e},shouldFetchRootKey:o})};var ht=({satelliteId:t,...e})=>J({canisterId:t,...e,idlFactory:Tt}),_=({satelliteId:t,...e})=>J({canisterId:t,...e,idlFactory:Pt}),St=({satelliteId:t,...e})=>J({canisterId:t,...e,idlFactory:ft}),j=({missionControlId:t,...e})=>J({canisterId:t,...e,idlFactory:gt}),D=({orbiterId:t,...e})=>J({canisterId:t,...e,idlFactory:xt}),J=({canisterId:t,idlFactory:e,...r})=>{if(Ge(t))throw new Error("No canister ID provided.");return Nt({canisterId:t,idlFactory:e,...r})};var Rt=async({missionControl:t})=>(await j(t)).version(),Ot=async({missionControl:t})=>(await j(t)).get_user(),At=async({missionControl:t})=>(await j(t)).list_mission_control_controllers(),Ft=async({missionControl:t,satelliteIds:e,controllerIds:r,controller:o})=>(await j(t)).set_satellites_controllers(e,r,o),Vt=async({missionControl:t,controllerIds:e,controller:r})=>(await j(t)).set_mission_control_controllers(e,r);import{Principal as je}from"@dfinity/principal";import{nonNullish as Xe,toNullable as Ze}from"@dfinity/utils";var pt=({controllerId:t,profile:e})=>({controllerIds:[je.fromText(t)],controller:Je(e)}),Je=t=>({metadata:Xe(t)&&t!==""?[["profile",t]]:[],expires_at:Ze(void 0),scope:{Admin:null}});var Wr=({controllerId:t,profile:e,...r})=>Ft({...r,...pt({controllerId:t,profile:e})}),Gr=({controllerId:t,profile:e,...r})=>Vt({...r,...pt({controllerId:t,profile:e})}),jr=t=>At(t);import{Principal as lr}from"@dfinity/principal";var Q={reinstall:null},H={upgrade:[{skip_pre_upgrade:[!1],wasm_memory_persistence:[{replace:null}]}]};import{fromNullable as ar,isNullish as sr}from"@dfinity/utils";import{CanisterStatus as Qe}from"@dfinity/agent";import{ICManagementCanister as v}from"@dfinity/ic-management";import{Principal as Ye}from"@dfinity/principal";import{assertNonNullish as $e}from"@dfinity/utils";var bt=async({canisterId:t,actor:e})=>{let r=await P(e),{stopCanister:o}=v.create({agent:r});await o(t)},kt=async({canisterId:t,actor:e})=>{let r=await P(e),{startCanister:o}=v.create({agent:r});await o(t)},wt=async({actor:t,code:e})=>{let r=await P(t),{installCode:o}=v.create({agent:r});return o(e)},Mt=async({actor:t,canisterId:e})=>{let r=await P(t),{storedChunks:o}=v.create({agent:r});return o({canisterId:e})},I=async({actor:t,canisterId:e})=>{let r=await P(t),{clearChunkStore:o}=v.create({agent:r});return o({canisterId:e})},vt=async({actor:t,chunk:e})=>{let r=await P(t),{uploadChunk:o}=v.create({agent:r});return o(e)},Ut=async({actor:t,code:e})=>{let r=await P(t),{installChunkedCode:o}=v.create({agent:r});return o(e)},qt=async({actor:t,canisterId:e})=>{let r=await P(t),{canisterStatus:o}=v.create({agent:r});return o(e)},Et=async({canisterId:t,path:e,...r})=>{$e(t,"A canister ID must be provided to request its status.");let o=await P(r);return(await Qe.request({canisterId:Ye.from(t),agent:o,paths:[{kind:"metadata",key:e,path:e,decodeStrategy:"utf-8"}]})).get(e)},Bt=async({actor:t,canisterId:e})=>{let r=await P(t),{listCanisterSnapshots:o}=v.create({agent:r});return o({canisterId:e})},zt=async({actor:t,...e})=>{let r=await P(t),{takeCanisterSnapshot:o}=v.create({agent:r});return o(e)};var Ht=(s=>(s[s.AssertingExistingCode=0]="AssertingExistingCode",s[s.StoppingCanister=1]="StoppingCanister",s[s.TakingSnapshot=2]="TakingSnapshot",s[s.UpgradingCode=3]="UpgradingCode",s[s.RestartingCanister=4]="RestartingCanister",s))(Ht||{});var L=t=>(t instanceof Uint8Array||(t=Uint8Array.from(t)),t.reduce((e,r)=>e+r.toString(16).padStart(2,"0"),""));var Kt=t=>crypto.subtle.digest("SHA-256",t),Wt=t=>Array.from(new Uint8Array(t)).map(r=>r.toString(16).padStart(2,"0")).join(""),Gt=async t=>{let e=await Kt(await t.arrayBuffer());return Wt(e)},tt=async t=>{let e=await Kt(t);return Wt(e)};import{isNullish as Ie,nonNullish as jt}from"@dfinity/utils";var Xt=async({actor:t,canisterId:e,missionControlId:r,wasmModule:o,preClearChunks:a,...s})=>{a&&await I({actor:t,canisterId:e});let n=await Le({wasmModule:o}),{uploadChunks:i,storedChunks:l,preClearChunks:p,postClearChunks:m}=await tr({actor:t,wasmChunks:n,canisterId:e,missionControlId:r});p&&await I({actor:t,canisterId:e});let u=[];for await(let c of er({uploadChunks:i,actor:t,canisterId:e,missionControlId:r}))u=[...u,...c];await Ut({actor:t,code:{...s,chunkHashesList:[...u,...l].sort(({orderId:c},{orderId:d})=>c-d).map(({chunkHash:c})=>c),targetCanisterId:e,storeCanisterId:r,wasmModuleHash:await tt(o)}}),m&&await I({actor:t,canisterId:e})},Le=async({wasmModule:t})=>{let e=new Blob([t]),r=[],o=1e6,a=0;for(let s=0;s<e.size;s+=o){let n=e.slice(s,s+o);r.push({chunk:n,orderId:a,sha256:await Gt(n)}),a++}return r},tr=async({canisterId:t,missionControlId:e,actor:r,wasmChunks:o})=>{let a=await Mt({actor:r,canisterId:e??t}),s=a.map(({hash:l})=>({chunkHash:{hash:l},sha256:L(l)})),{storedChunks:n,uploadChunks:i}=o.reduce(({uploadChunks:l,storedChunks:p},{sha256:m,...u})=>{let c=s.find(({sha256:d})=>d===m);return{uploadChunks:[...l,...jt(c)?[]:[{sha256:m,...u}]],storedChunks:[...p,...jt(c)?[{...u,...c}]:[]]}},{uploadChunks:[],storedChunks:[]});return{uploadChunks:i,storedChunks:n,preClearChunks:a.length>0&&n.length===0,postClearChunks:Ie(e)}};async function*er({uploadChunks:t,limit:e=12,...r}){for(let o=0;o<t.length;o=o+e){let a=t.slice(o,o+e);yield await Promise.all(a.map(n=>rr({uploadChunk:n,...r})))}}var rr=async({actor:t,canisterId:e,missionControlId:r,uploadChunk:{chunk:o,...a}})=>({chunkHash:await vt({actor:t,chunk:{canisterId:r??e,chunk:new Uint8Array(await o.arrayBuffer())}}),...a});var Zt=async({actor:t,...e})=>{await wt({actor:t,code:e})};var E=async({wasmModule:t,canisterId:e,actor:r,onProgress:o,takeSnapshot:a=!0,...s})=>{await Y({fn:async()=>await nr({wasmModule:t,canisterId:e,actor:r,...s}),onProgress:o,step:0}),await Y({fn:async()=>await bt({canisterId:e,actor:r}),onProgress:o,step:1});try{await Y({fn:async()=>a?await cr({canisterId:e,actor:r}):Promise.resolve(),onProgress:o,step:2}),await Y({fn:async()=>await ir({wasmModule:t,canisterId:e,actor:r,...s}),onProgress:o,step:3})}finally{await Y({fn:async()=>await kt({canisterId:e,actor:r}),onProgress:o,step:4})}},Y=async({fn:t,step:e,onProgress:r})=>{r?.({step:e,state:"in_progress"});try{await t(),r?.({step:e,state:"success"})}catch(o){throw r?.({step:e,state:"error"}),o}},nr=async({actor:t,canisterId:e,wasmModule:r,reset:o})=>{if(o===!0)return;let{module_hash:a}=await qt({actor:t,canisterId:e}),s=ar(a);if(sr(s))return;let n=await tt(r),i=L(s);if(n===i)throw new $},ir=async({wasmModule:t,canisterId:e,actor:r,...o})=>{await((new Blob([t]).size>2e6?"chunked":"single")==="chunked"?Xt:Zt)({wasmModule:t,canisterId:e,actor:r,...o})},cr=async t=>{let e=await Bt(t);await zt({...t,snapshotId:e?.[0]?.id})};import{IDL as K}from"@dfinity/candid";var Jt=t=>K.encode([K.Record({user:K.Principal})],[{user:t}]),et=t=>K.encode([K.Record({controllers:K.Vec(K.Principal)})],[{controllers:t.map(([e,r])=>e)}]);var wo=async({missionControl:t,...e})=>{let r=await Ot({missionControl:t}),{missionControlId:o,...a}=t;if(!o)throw new Error("No mission control principal defined.");let s=Jt(r);await E({actor:a,canisterId:lr.fromText(o),arg:new Uint8Array(s),mode:H,...e})};var Uo=t=>Rt(t);var Bo=async t=>{await E(t)};var Qt=async({orbiter:t})=>(await D(t)).version(),rt=async({orbiter:t})=>(await D(t)).list_controllers(),Yt=async({orbiter:t})=>{let{memory_size:e}=await D(t);return e()};var Go=t=>rt(t);var Zo=t=>Yt(t);import{Principal as pr}from"@dfinity/principal";var Lo=async({orbiter:t,reset:e=!1,...r})=>{let{orbiterId:o,...a}=t;if(!o)throw new Error("No orbiter principal defined.");let s=await rt({orbiter:t}),n=et(s);await E({actor:a,canisterId:pr.fromText(o),arg:new Uint8Array(n),mode:e?Q:H,reset:e,...r})};var ra=t=>Qt(t);import{major as $t,minor as Dt,patch as It}from"semver";var sa=({currentVersion:t,selectedVersion:e})=>{let r=$t(t),o=$t(e),a=Dt(t),s=Dt(e),n=It(t),i=It(e);return r<o-1||a<s-1||n<i-1?{canUpgrade:!1}:{canUpgrade:!0}};import{toNullable as dr}from"@dfinity/utils";var Lt=async({config:t,satellite:e})=>{let{set_storage_config:r}=await _(e);return r(t)},te=async({config:t,satellite:e})=>{let{set_db_config:r}=await _(e);return r(t)},ee=async({config:t,satellite:e})=>{let{set_auth_config:r}=await _(e);return r(t)};var re=async({satellite:t})=>{let{get_auth_config:e}=await _(t);return e()},oe=async({satellite:t,type:e})=>(await _(t)).list_rules(e),ae=async({type:t,collection:e,rule:r,satellite:o})=>{let{set_rule:a}=await _(o);return a(t,e,r)},se=async({satellite:t})=>{let{version:e}=await _(t);return e()},ne=async({satellite:t})=>{let{build_version:e}=await _(t);return e()},ie=async({satellite:t})=>(await ht(t)).list_controllers(),ot=async({satellite:t})=>(await St(t)).list_controllers(),at=async({satellite:t})=>(await _(t)).list_controllers(),ce=async({satellite:t})=>{let{list_custom_domains:e}=await _(t);return e()},le=async({satellite:t,domainName:e,boundaryNodesId:r})=>{let{set_custom_domain:o}=await _(t);await o(e,dr(r))},pe=async({satellite:t})=>{let{memory_size:e}=await _(t);return e()},de=async({collection:t,satellite:e})=>{let{count_collection_docs:r}=await _(e);return r(t)},ue=async({collection:t,satellite:e})=>{let{count_collection_assets:r}=await _(e);return r(t)},me=async({collection:t,satellite:e})=>{let{del_docs:r}=await _(e);return r(t)},_e=async({collection:t,satellite:e})=>{let{del_assets:r}=await _(e);return r(t)},ye=async({args:t,satellite:e})=>{let{set_controllers:r}=await _(e);return r(t)};var da=t=>ue(t),ua=t=>_e(t);import{fromNullable as st,isNullish as xe,nonNullish as ge}from"@dfinity/utils";import{nonNullish as ur,toNullable as dt}from"@dfinity/utils";var ut=t=>dt(ur(t)?{heap:dt(t.heap),stable:dt(t.stable)}:void 0);var Ta=async({config:{headers:t,rewrites:e,redirects:r,iframe:o,rawAccess:a,maxMemorySize:s},satellite:n})=>{let i=(t??[]).map(({source:c,headers:d})=>[c,d]),l=(e??[]).map(({source:c,destination:d})=>[c,d]),p=(r??[]).map(({source:c,location:d,code:g})=>[c,{status_code:g,location:d}]);return await Lt({satellite:n,config:{headers:i,rewrites:l,redirects:[p],iframe:[o==="same-origin"?{SameOrigin:null}:o==="allow-any"?{AllowAny:null}:{Deny:null}],raw_access:[a===!0?{Allow:null}:{Deny:null}],max_memory_size:ut(s)}})},Pa=async({config:{maxMemorySize:t},...e})=>{await te({config:{max_memory_size:ut(t)},...e})},Ca=async({config:{internetIdentity:t},...e})=>{await ee({config:{internet_identity:xe(t?.derivationOrigin)?[]:[{derivation_origin:[t.derivationOrigin]}]},...e})},Na=async({satellite:t})=>{let e=st(await re({satellite:t}));if(xe(e))return;let r=st(e.internet_identity??[]);return{...ge(r)&&{internetIdentity:{...ge(st(r.derivation_origin))&&{derivationOrigin:st(r.derivation_origin)}}}}};var Ra=({deprecatedNoScope:t,...e})=>(t===!0?ot:at)(e),Oa=t=>ye(t);var Va=t=>de(t),ba=t=>me(t);import{fromNullable as fe,nonNullish as mr}from"@dfinity/utils";var va=async({satellite:t})=>(await ce({satellite:t})).map(([r,o])=>{let a=fe(o.version);return{domain:r,bn_id:fe(o.bn_id),created_at:o.created_at,updated_at:o.updated_at,...mr(a)&&{version:a}}}),Ua=({satellite:t,domains:e})=>Promise.all(e.map(({domain:r,bn_id:o})=>le({satellite:t,domainName:r,boundaryNodesId:o})));var Ba=t=>pe(t);import{fromNullable as X,nonNullish as B,toNullable as nt}from"@dfinity/utils";var Te={Db:null},Pe={Storage:null},Ce={Public:null},Ne={Private:null},he={Managed:null},Se={Controllers:null},mt={Heap:null},Re={Stable:null},Oe=600000000n;var _t=t=>t==="storage"?Pe:Te,Ve=({read:t,write:e,memory:r,maxSize:o,maxCapacity:a,version:s,mutablePermissions:n,maxTokens:i})=>({read:Fe(t),write:Fe(e),memory:B(r)?[_r(r)]:[],version:nt(s),max_size:nt(B(o)&&o>0?BigInt(o):void 0),max_capacity:nt(B(a)&&a>0?a:void 0),mutable_permissions:nt(n),rate_config:B(i)?[{max_tokens:BigInt(i),time_per_token_ns:Oe}]:[]}),be=([t,e])=>{let{read:r,write:o,updated_at:a,created_at:s,max_size:n,max_capacity:i,memory:l,mutable_permissions:p,version:m,rate_config:u}=e,c=n?.[0]??0n>0n?Number(X(n)):void 0,d=i?.[0]??!1?X(i):void 0,g=X(m),C=u?.[0]?.max_tokens??0n>0n?X(u)?.max_tokens:void 0;return{collection:t,read:Ae(r),write:Ae(o),memory:yr(X(l)??mt),updatedAt:a,createdAt:s,...B(g)&&{version:g},...B(c)&&{maxSize:c},...B(d)&&{maxCapacity:d},mutablePermissions:X(p)??!0,...B(C)&&{maxTokens:Number(C)}}},Ae=t=>"Public"in t?"public":"Private"in t?"private":"Managed"in t?"managed":"controllers",Fe=t=>{switch(t){case"public":return Ce;case"private":return Ne;case"managed":return he;default:return Se}},_r=t=>{switch(t.toLowerCase()){case"heap":return mt;default:return Re}},yr=t=>"Heap"in t?"heap":"stable";var Za=async({type:t,satellite:e})=>(await oe({satellite:e,type:_t(t)})).map(o=>be(o)),Ja=async({rule:{collection:t,...e},type:r,satellite:o})=>{await ae({type:_t(r),rule:Ve(e),satellite:o,collection:t})};import{IDL as it}from"@dfinity/candid";import{Principal as ke}from"@dfinity/principal";import{isNullish as gr}from"@dfinity/utils";var rs=async({satellite:t,deprecated:e,deprecatedNoScope:r,reset:o=!1,...a})=>{let{satelliteId:s,...n}=t;if(gr(s))throw new Error("No satellite principal defined.");if(e){let m=await ie({satellite:t}),u=it.encode([it.Record({controllers:it.Vec(it.Principal)})],[{controllers:m}]);await E({actor:n,canisterId:ke.fromText(s),arg:new Uint8Array(u),mode:o?Q:H,reset:o,...a});return}let l=await(r?ot:at)({satellite:t}),p=et(l);await E({actor:n,canisterId:ke.fromText(s),arg:new Uint8Array(p),mode:o?Q:H,reset:o,...a})};import{nonNullish as xr}from"@dfinity/utils";var is=t=>se(t),cs=t=>ne(t),ls=async({satellite:{satelliteId:t,...e}})=>{let r=await Et({...e,canisterId:t,path:"juno:build"});return xr(r)&&["stock","extended"].includes(r)?r:void 0};export{Ht as UpgradeCodeProgressStep,$ as UpgradeCodeUnchangedError,Gt as blobSha256,sa as checkUpgradeVersion,da as countAssets,Va as countDocs,ua as deleteAssets,ba as deleteDocs,Na as getAuthConfig,va as listCustomDomains,jr as listMissionControlControllers,Go as listOrbiterControllers,Za as listRules,Ra as listSatelliteControllers,Uo as missionControlVersion,Zo as orbiterMemorySize,ra as orbiterVersion,ls as satelliteBuildType,cs as satelliteBuildVersion,Ba as satelliteMemorySize,is as satelliteVersion,Ca as setAuthConfig,Ua as setCustomDomains,Pa as setDatastoreConfig,Gr as setMissionControlController,Ja as setRule,Oa as setSatelliteControllers,Wr as setSatellitesController,Ta as setStorageConfig,tt as uint8ArraySha256,wo as upgradeMissionControl,Bo as upgradeModule,Lo as upgradeOrbiter,rs as upgradeSatellite};
|
|
4
4
|
//# sourceMappingURL=index.mjs.map
|