@junobuild/core-peer 0.0.21 → 0.0.22-next-2024-08-04
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/declarations/satellite/satellite.did.d.ts +25 -2
- package/declarations/satellite/satellite.factory.did.js +28 -4
- package/declarations/satellite/satellite.factory.did.mjs +28 -4
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +3 -3
- package/dist/declarations/satellite/satellite.did.d.ts +25 -2
- package/dist/declarations/satellite/satellite.factory.did.js +28 -4
- package/dist/declarations/satellite/satellite.factory.did.mjs +28 -4
- package/dist/node/index.mjs +1 -1
- package/dist/node/index.mjs.map +3 -3
- package/dist/types/types/list.types.d.ts +53 -0
- package/package.json +6 -6
|
@@ -35,8 +35,14 @@ export interface CommitBatch {
|
|
|
35
35
|
chunk_ids: Array<bigint>;
|
|
36
36
|
}
|
|
37
37
|
export interface Config {
|
|
38
|
+
db: [] | [DbConfig];
|
|
39
|
+
authentication: [] | [AuthenticationConfig];
|
|
38
40
|
storage: StorageConfig;
|
|
39
41
|
}
|
|
42
|
+
export interface ConfigMaxMemorySize {
|
|
43
|
+
stable: [] | [bigint];
|
|
44
|
+
heap: [] | [bigint];
|
|
45
|
+
}
|
|
40
46
|
export interface Controller {
|
|
41
47
|
updated_at: bigint;
|
|
42
48
|
metadata: Array<[string, string]>;
|
|
@@ -51,9 +57,15 @@ export interface CustomDomain {
|
|
|
51
57
|
version: [] | [bigint];
|
|
52
58
|
bn_id: [] | [string];
|
|
53
59
|
}
|
|
60
|
+
export interface DbConfig {
|
|
61
|
+
max_memory_size: [] | [ConfigMaxMemorySize];
|
|
62
|
+
}
|
|
54
63
|
export interface DelDoc {
|
|
55
64
|
version: [] | [bigint];
|
|
56
65
|
}
|
|
66
|
+
export interface DelRule {
|
|
67
|
+
version: [] | [bigint];
|
|
68
|
+
}
|
|
57
69
|
export interface DeleteControllersArgs {
|
|
58
70
|
controllers: Array<Principal>;
|
|
59
71
|
}
|
|
@@ -95,7 +107,9 @@ export interface InitUploadResult {
|
|
|
95
107
|
}
|
|
96
108
|
export interface ListMatcher {
|
|
97
109
|
key: [] | [string];
|
|
110
|
+
updated_at: [] | [TimestampMatcher];
|
|
98
111
|
description: [] | [string];
|
|
112
|
+
created_at: [] | [TimestampMatcher];
|
|
99
113
|
}
|
|
100
114
|
export interface ListOrder {
|
|
101
115
|
field: ListOrderField;
|
|
@@ -171,6 +185,7 @@ export interface StorageConfig {
|
|
|
171
185
|
iframe: [] | [StorageConfigIFrame];
|
|
172
186
|
rewrites: Array<[string, string]>;
|
|
173
187
|
headers: Array<[string, Array<[string, string]>]>;
|
|
188
|
+
max_memory_size: [] | [ConfigMaxMemorySize];
|
|
174
189
|
raw_access: [] | [StorageConfigRawAccess];
|
|
175
190
|
redirects: [] | [Array<[string, StorageConfigRedirect]>];
|
|
176
191
|
}
|
|
@@ -199,6 +214,11 @@ export type StreamingStrategy = {
|
|
|
199
214
|
callback: [Principal, string];
|
|
200
215
|
};
|
|
201
216
|
};
|
|
217
|
+
export type TimestampMatcher =
|
|
218
|
+
| {Equal: bigint}
|
|
219
|
+
| {Between: [bigint, bigint]}
|
|
220
|
+
| {GreaterThan: bigint}
|
|
221
|
+
| {LessThan: bigint};
|
|
202
222
|
export interface UploadChunk {
|
|
203
223
|
content: Uint8Array | number[];
|
|
204
224
|
batch_id: bigint;
|
|
@@ -220,14 +240,16 @@ export interface _SERVICE {
|
|
|
220
240
|
del_docs: ActorMethod<[string], undefined>;
|
|
221
241
|
del_many_assets: ActorMethod<[Array<[string, string]>], undefined>;
|
|
222
242
|
del_many_docs: ActorMethod<[Array<[string, string, DelDoc]>], undefined>;
|
|
223
|
-
del_rule: ActorMethod<[RulesType, string,
|
|
243
|
+
del_rule: ActorMethod<[RulesType, string, DelRule], undefined>;
|
|
224
244
|
deposit_cycles: ActorMethod<[DepositCyclesArgs], undefined>;
|
|
225
245
|
get_asset: ActorMethod<[string, string], [] | [AssetNoContent]>;
|
|
226
246
|
get_auth_config: ActorMethod<[], [] | [AuthenticationConfig]>;
|
|
227
247
|
get_config: ActorMethod<[], Config>;
|
|
248
|
+
get_db_config: ActorMethod<[], [] | [DbConfig]>;
|
|
228
249
|
get_doc: ActorMethod<[string, string], [] | [Doc]>;
|
|
229
250
|
get_many_assets: ActorMethod<[Array<[string, string]>], Array<[string, [] | [AssetNoContent]]>>;
|
|
230
251
|
get_many_docs: ActorMethod<[Array<[string, string]>], Array<[string, [] | [Doc]]>>;
|
|
252
|
+
get_storage_config: ActorMethod<[], StorageConfig>;
|
|
231
253
|
http_request: ActorMethod<[HttpRequest], HttpResponse>;
|
|
232
254
|
http_request_streaming_callback: ActorMethod<
|
|
233
255
|
[StreamingCallbackToken],
|
|
@@ -241,12 +263,13 @@ export interface _SERVICE {
|
|
|
241
263
|
list_rules: ActorMethod<[RulesType], Array<[string, Rule]>>;
|
|
242
264
|
memory_size: ActorMethod<[], MemorySize>;
|
|
243
265
|
set_auth_config: ActorMethod<[AuthenticationConfig], undefined>;
|
|
244
|
-
set_config: ActorMethod<[Config], undefined>;
|
|
245
266
|
set_controllers: ActorMethod<[SetControllersArgs], Array<[Principal, Controller]>>;
|
|
246
267
|
set_custom_domain: ActorMethod<[string, [] | [string]], undefined>;
|
|
268
|
+
set_db_config: ActorMethod<[DbConfig], undefined>;
|
|
247
269
|
set_doc: ActorMethod<[string, string, SetDoc], Doc>;
|
|
248
270
|
set_many_docs: ActorMethod<[Array<[string, string, SetDoc]>], Array<[string, Doc]>>;
|
|
249
271
|
set_rule: ActorMethod<[RulesType, string, SetRule], undefined>;
|
|
272
|
+
set_storage_config: ActorMethod<[StorageConfig], undefined>;
|
|
250
273
|
upload_asset_chunk: ActorMethod<[UploadChunk], UploadChunkResult>;
|
|
251
274
|
version: ActorMethod<[], string>;
|
|
252
275
|
}
|
|
@@ -21,6 +21,7 @@ export const idlFactory = ({IDL}) => {
|
|
|
21
21
|
});
|
|
22
22
|
const DelDoc = IDL.Record({version: IDL.Opt(IDL.Nat64)});
|
|
23
23
|
const RulesType = IDL.Variant({Db: IDL.Null, Storage: IDL.Null});
|
|
24
|
+
const DelRule = IDL.Record({version: IDL.Opt(IDL.Nat64)});
|
|
24
25
|
const DepositCyclesArgs = IDL.Record({
|
|
25
26
|
cycles: IDL.Nat,
|
|
26
27
|
destination_id: IDL.Principal
|
|
@@ -52,6 +53,13 @@ export const idlFactory = ({IDL}) => {
|
|
|
52
53
|
const AuthenticationConfig = IDL.Record({
|
|
53
54
|
internet_identity: IDL.Opt(AuthenticationConfigInternetIdentity)
|
|
54
55
|
});
|
|
56
|
+
const ConfigMaxMemorySize = IDL.Record({
|
|
57
|
+
stable: IDL.Opt(IDL.Nat64),
|
|
58
|
+
heap: IDL.Opt(IDL.Nat64)
|
|
59
|
+
});
|
|
60
|
+
const DbConfig = IDL.Record({
|
|
61
|
+
max_memory_size: IDL.Opt(ConfigMaxMemorySize)
|
|
62
|
+
});
|
|
55
63
|
const StorageConfigIFrame = IDL.Variant({
|
|
56
64
|
Deny: IDL.Null,
|
|
57
65
|
AllowAny: IDL.Null,
|
|
@@ -69,10 +77,15 @@ export const idlFactory = ({IDL}) => {
|
|
|
69
77
|
iframe: IDL.Opt(StorageConfigIFrame),
|
|
70
78
|
rewrites: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
71
79
|
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)))),
|
|
80
|
+
max_memory_size: IDL.Opt(ConfigMaxMemorySize),
|
|
72
81
|
raw_access: IDL.Opt(StorageConfigRawAccess),
|
|
73
82
|
redirects: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, StorageConfigRedirect)))
|
|
74
83
|
});
|
|
75
|
-
const Config = IDL.Record({
|
|
84
|
+
const Config = IDL.Record({
|
|
85
|
+
db: IDL.Opt(DbConfig),
|
|
86
|
+
authentication: IDL.Opt(AuthenticationConfig),
|
|
87
|
+
storage: StorageConfig
|
|
88
|
+
});
|
|
76
89
|
const Doc = IDL.Record({
|
|
77
90
|
updated_at: IDL.Nat64,
|
|
78
91
|
owner: IDL.Principal,
|
|
@@ -129,9 +142,17 @@ export const idlFactory = ({IDL}) => {
|
|
|
129
142
|
CreatedAt: IDL.Null
|
|
130
143
|
});
|
|
131
144
|
const ListOrder = IDL.Record({field: ListOrderField, desc: IDL.Bool});
|
|
145
|
+
const TimestampMatcher = IDL.Variant({
|
|
146
|
+
Equal: IDL.Nat64,
|
|
147
|
+
Between: IDL.Tuple(IDL.Nat64, IDL.Nat64),
|
|
148
|
+
GreaterThan: IDL.Nat64,
|
|
149
|
+
LessThan: IDL.Nat64
|
|
150
|
+
});
|
|
132
151
|
const ListMatcher = IDL.Record({
|
|
133
152
|
key: IDL.Opt(IDL.Text),
|
|
134
|
-
|
|
153
|
+
updated_at: IDL.Opt(TimestampMatcher),
|
|
154
|
+
description: IDL.Opt(IDL.Text),
|
|
155
|
+
created_at: IDL.Opt(TimestampMatcher)
|
|
135
156
|
});
|
|
136
157
|
const ListPaginate = IDL.Record({
|
|
137
158
|
start_after: IDL.Opt(IDL.Text),
|
|
@@ -227,11 +248,12 @@ export const idlFactory = ({IDL}) => {
|
|
|
227
248
|
del_docs: IDL.Func([IDL.Text], [], []),
|
|
228
249
|
del_many_assets: IDL.Func([IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))], [], []),
|
|
229
250
|
del_many_docs: IDL.Func([IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text, DelDoc))], [], []),
|
|
230
|
-
del_rule: IDL.Func([RulesType, IDL.Text,
|
|
251
|
+
del_rule: IDL.Func([RulesType, IDL.Text, DelRule], [], []),
|
|
231
252
|
deposit_cycles: IDL.Func([DepositCyclesArgs], [], []),
|
|
232
253
|
get_asset: IDL.Func([IDL.Text, IDL.Text], [IDL.Opt(AssetNoContent)], ['query']),
|
|
233
254
|
get_auth_config: IDL.Func([], [IDL.Opt(AuthenticationConfig)], ['query']),
|
|
234
255
|
get_config: IDL.Func([], [Config], []),
|
|
256
|
+
get_db_config: IDL.Func([], [IDL.Opt(DbConfig)], ['query']),
|
|
235
257
|
get_doc: IDL.Func([IDL.Text, IDL.Text], [IDL.Opt(Doc)], ['query']),
|
|
236
258
|
get_many_assets: IDL.Func(
|
|
237
259
|
[IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))],
|
|
@@ -243,6 +265,7 @@ export const idlFactory = ({IDL}) => {
|
|
|
243
265
|
[IDL.Vec(IDL.Tuple(IDL.Text, IDL.Opt(Doc)))],
|
|
244
266
|
['query']
|
|
245
267
|
),
|
|
268
|
+
get_storage_config: IDL.Func([], [StorageConfig], ['query']),
|
|
246
269
|
http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']),
|
|
247
270
|
http_request_streaming_callback: IDL.Func(
|
|
248
271
|
[StreamingCallbackToken],
|
|
@@ -257,13 +280,13 @@ export const idlFactory = ({IDL}) => {
|
|
|
257
280
|
list_rules: IDL.Func([RulesType], [IDL.Vec(IDL.Tuple(IDL.Text, Rule))], ['query']),
|
|
258
281
|
memory_size: IDL.Func([], [MemorySize], ['query']),
|
|
259
282
|
set_auth_config: IDL.Func([AuthenticationConfig], [], []),
|
|
260
|
-
set_config: IDL.Func([Config], [], []),
|
|
261
283
|
set_controllers: IDL.Func(
|
|
262
284
|
[SetControllersArgs],
|
|
263
285
|
[IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
|
|
264
286
|
[]
|
|
265
287
|
),
|
|
266
288
|
set_custom_domain: IDL.Func([IDL.Text, IDL.Opt(IDL.Text)], [], []),
|
|
289
|
+
set_db_config: IDL.Func([DbConfig], [], []),
|
|
267
290
|
set_doc: IDL.Func([IDL.Text, IDL.Text, SetDoc], [Doc], []),
|
|
268
291
|
set_many_docs: IDL.Func(
|
|
269
292
|
[IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text, SetDoc))],
|
|
@@ -271,6 +294,7 @@ export const idlFactory = ({IDL}) => {
|
|
|
271
294
|
[]
|
|
272
295
|
),
|
|
273
296
|
set_rule: IDL.Func([RulesType, IDL.Text, SetRule], [], []),
|
|
297
|
+
set_storage_config: IDL.Func([StorageConfig], [], []),
|
|
274
298
|
upload_asset_chunk: IDL.Func([UploadChunk], [UploadChunkResult], []),
|
|
275
299
|
version: IDL.Func([], [IDL.Text], ['query'])
|
|
276
300
|
});
|
|
@@ -21,6 +21,7 @@ export const idlFactory = ({IDL}) => {
|
|
|
21
21
|
});
|
|
22
22
|
const DelDoc = IDL.Record({version: IDL.Opt(IDL.Nat64)});
|
|
23
23
|
const RulesType = IDL.Variant({Db: IDL.Null, Storage: IDL.Null});
|
|
24
|
+
const DelRule = IDL.Record({version: IDL.Opt(IDL.Nat64)});
|
|
24
25
|
const DepositCyclesArgs = IDL.Record({
|
|
25
26
|
cycles: IDL.Nat,
|
|
26
27
|
destination_id: IDL.Principal
|
|
@@ -52,6 +53,13 @@ export const idlFactory = ({IDL}) => {
|
|
|
52
53
|
const AuthenticationConfig = IDL.Record({
|
|
53
54
|
internet_identity: IDL.Opt(AuthenticationConfigInternetIdentity)
|
|
54
55
|
});
|
|
56
|
+
const ConfigMaxMemorySize = IDL.Record({
|
|
57
|
+
stable: IDL.Opt(IDL.Nat64),
|
|
58
|
+
heap: IDL.Opt(IDL.Nat64)
|
|
59
|
+
});
|
|
60
|
+
const DbConfig = IDL.Record({
|
|
61
|
+
max_memory_size: IDL.Opt(ConfigMaxMemorySize)
|
|
62
|
+
});
|
|
55
63
|
const StorageConfigIFrame = IDL.Variant({
|
|
56
64
|
Deny: IDL.Null,
|
|
57
65
|
AllowAny: IDL.Null,
|
|
@@ -69,10 +77,15 @@ export const idlFactory = ({IDL}) => {
|
|
|
69
77
|
iframe: IDL.Opt(StorageConfigIFrame),
|
|
70
78
|
rewrites: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
71
79
|
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)))),
|
|
80
|
+
max_memory_size: IDL.Opt(ConfigMaxMemorySize),
|
|
72
81
|
raw_access: IDL.Opt(StorageConfigRawAccess),
|
|
73
82
|
redirects: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, StorageConfigRedirect)))
|
|
74
83
|
});
|
|
75
|
-
const Config = IDL.Record({
|
|
84
|
+
const Config = IDL.Record({
|
|
85
|
+
db: IDL.Opt(DbConfig),
|
|
86
|
+
authentication: IDL.Opt(AuthenticationConfig),
|
|
87
|
+
storage: StorageConfig
|
|
88
|
+
});
|
|
76
89
|
const Doc = IDL.Record({
|
|
77
90
|
updated_at: IDL.Nat64,
|
|
78
91
|
owner: IDL.Principal,
|
|
@@ -129,9 +142,17 @@ export const idlFactory = ({IDL}) => {
|
|
|
129
142
|
CreatedAt: IDL.Null
|
|
130
143
|
});
|
|
131
144
|
const ListOrder = IDL.Record({field: ListOrderField, desc: IDL.Bool});
|
|
145
|
+
const TimestampMatcher = IDL.Variant({
|
|
146
|
+
Equal: IDL.Nat64,
|
|
147
|
+
Between: IDL.Tuple(IDL.Nat64, IDL.Nat64),
|
|
148
|
+
GreaterThan: IDL.Nat64,
|
|
149
|
+
LessThan: IDL.Nat64
|
|
150
|
+
});
|
|
132
151
|
const ListMatcher = IDL.Record({
|
|
133
152
|
key: IDL.Opt(IDL.Text),
|
|
134
|
-
|
|
153
|
+
updated_at: IDL.Opt(TimestampMatcher),
|
|
154
|
+
description: IDL.Opt(IDL.Text),
|
|
155
|
+
created_at: IDL.Opt(TimestampMatcher)
|
|
135
156
|
});
|
|
136
157
|
const ListPaginate = IDL.Record({
|
|
137
158
|
start_after: IDL.Opt(IDL.Text),
|
|
@@ -227,11 +248,12 @@ export const idlFactory = ({IDL}) => {
|
|
|
227
248
|
del_docs: IDL.Func([IDL.Text], [], []),
|
|
228
249
|
del_many_assets: IDL.Func([IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))], [], []),
|
|
229
250
|
del_many_docs: IDL.Func([IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text, DelDoc))], [], []),
|
|
230
|
-
del_rule: IDL.Func([RulesType, IDL.Text,
|
|
251
|
+
del_rule: IDL.Func([RulesType, IDL.Text, DelRule], [], []),
|
|
231
252
|
deposit_cycles: IDL.Func([DepositCyclesArgs], [], []),
|
|
232
253
|
get_asset: IDL.Func([IDL.Text, IDL.Text], [IDL.Opt(AssetNoContent)], ['query']),
|
|
233
254
|
get_auth_config: IDL.Func([], [IDL.Opt(AuthenticationConfig)], ['query']),
|
|
234
255
|
get_config: IDL.Func([], [Config], []),
|
|
256
|
+
get_db_config: IDL.Func([], [IDL.Opt(DbConfig)], ['query']),
|
|
235
257
|
get_doc: IDL.Func([IDL.Text, IDL.Text], [IDL.Opt(Doc)], ['query']),
|
|
236
258
|
get_many_assets: IDL.Func(
|
|
237
259
|
[IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))],
|
|
@@ -243,6 +265,7 @@ export const idlFactory = ({IDL}) => {
|
|
|
243
265
|
[IDL.Vec(IDL.Tuple(IDL.Text, IDL.Opt(Doc)))],
|
|
244
266
|
['query']
|
|
245
267
|
),
|
|
268
|
+
get_storage_config: IDL.Func([], [StorageConfig], ['query']),
|
|
246
269
|
http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']),
|
|
247
270
|
http_request_streaming_callback: IDL.Func(
|
|
248
271
|
[StreamingCallbackToken],
|
|
@@ -257,13 +280,13 @@ export const idlFactory = ({IDL}) => {
|
|
|
257
280
|
list_rules: IDL.Func([RulesType], [IDL.Vec(IDL.Tuple(IDL.Text, Rule))], ['query']),
|
|
258
281
|
memory_size: IDL.Func([], [MemorySize], ['query']),
|
|
259
282
|
set_auth_config: IDL.Func([AuthenticationConfig], [], []),
|
|
260
|
-
set_config: IDL.Func([Config], [], []),
|
|
261
283
|
set_controllers: IDL.Func(
|
|
262
284
|
[SetControllersArgs],
|
|
263
285
|
[IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
|
|
264
286
|
[]
|
|
265
287
|
),
|
|
266
288
|
set_custom_domain: IDL.Func([IDL.Text, IDL.Opt(IDL.Text)], [], []),
|
|
289
|
+
set_db_config: IDL.Func([DbConfig], [], []),
|
|
267
290
|
set_doc: IDL.Func([IDL.Text, IDL.Text, SetDoc], [Doc], []),
|
|
268
291
|
set_many_docs: IDL.Func(
|
|
269
292
|
[IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text, SetDoc))],
|
|
@@ -271,6 +294,7 @@ export const idlFactory = ({IDL}) => {
|
|
|
271
294
|
[]
|
|
272
295
|
),
|
|
273
296
|
set_rule: IDL.Func([RulesType, IDL.Text, SetRule], [], []),
|
|
297
|
+
set_storage_config: IDL.Func([StorageConfig], [], []),
|
|
274
298
|
upload_asset_chunk: IDL.Func([UploadChunk], [UploadChunkResult], []),
|
|
275
299
|
version: IDL.Func([], [IDL.Text], ['query'])
|
|
276
300
|
});
|
package/dist/browser/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Principal as et}from"@dfinity/principal";var l=t=>t==null,c=t=>!l(t),oe=class extends Error{},F=(t,e)=>{if(l(t))throw new oe(e)},H="__bigint__",z="__principal__",W="__uint8array__",ie=(t,e)=>typeof e=="bigint"?{[H]:`${e}`}:c(e)&&e instanceof et?{[z]:e.toText()}:c(e)&&e instanceof Uint8Array?{[W]:Array.from(e)}:e,ne=(t,e)=>{let s=o=>e[o];return c(e)&&typeof e=="object"&&H in e?BigInt(s(H)):c(e)&&typeof e=="object"&&z in e?et.fromText(s(z)):c(e)&&typeof e=="object"&&W in e?Uint8Array.from(s(W)):e},_=t=>c(t)?[t]:[],p=t=>t?.[0],st=async t=>{let e=new Blob([JSON.stringify(t,ie)],{type:"application/json; charset=utf-8"});return new Uint8Array(await e.arrayBuffer())},V=async t=>{let e=new Blob([t instanceof Uint8Array?t:new Uint8Array(t)],{type:"application/json; charset=utf-8"});return JSON.parse(await e.text(),ne)},ot=()=>typeof window<"u";var b=class{callbacks=[];populate(e){this.callbacks.forEach(({callback:s})=>s(e))}subscribe(e){let s=Symbol();return this.callbacks.push({id:s,callback:e}),()=>this.callbacks=this.callbacks.filter(({id:o})=>o!==s)}};var w=class t extends b{static instance;authUser=null;constructor(){super()}static getInstance(){return t.instance||(t.instance=new t),t.instance}set(e){this.authUser=e,this.populate(e)}get(){return this.authUser}subscribe(e){let s=super.subscribe(e);return e(this.authUser),s}reset(){this.authUser=null,this.populate(this.authUser)}};var Y=({message:t,detail:e})=>{let s=new CustomEvent(t,{detail:e,bubbles:!0});document.dispatchEvent(s)};var it=BigInt(144e11),nt=!1,rt={width:576,height:576},at={width:505,height:705},ct="internetcomputer.org";var R="http://127.0.0.1:5987",lt="rdmx6-jaaaa-aaaaa-aaadq-cai";var x=class t extends b{static instance;env;constructor(){super()}static getInstance(){return t.instance||(t.instance=new t),t.instance}set(e){this.env=e,this.populate(e)}get(){return this.env}subscribe(e){let s=super.subscribe(e);return e(this.env),s}};var G=({width:t,height:e})=>{if(!ot()||l(window)||l(window.top))return;let{top:{innerWidth:s,innerHeight:o}}=window,i=o/2+screenY-e/2,n=s/2+screenX-t/2;return`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=${t}, height=${e}, top=${i}, left=${n}`};var M=class{#t;constructor({domain:e}){this.#t=e}get id(){return"internet_identity"}signInOptions({windowed:e}){let s=()=>{let o=x.getInstance().get()?.container;if(l(o)||o===!1)return`https://identity.${this.#t??ct}`;let i=x.getInstance().get(),n=c(i)&&c(i?.internetIdentityId)?i.internetIdentityId:lt,{host:r,protocol:a}=new URL(o===!0?R:o);return/apple/i.test(navigator?.vendor)?`${a}//${r}?canisterId=${n}`:`${a}//${n}.${r.replace("127.0.0.1","localhost")}`};return{...e!==!1&&{windowOpenerFeatures:G(rt)},identityProvider:s()}}},pt=class{#t;#e;constructor({appName:e,logoUrl:s}){this.#t=e,this.#e=s}get id(){return"nfid"}signInOptions({windowed:e}){return{...e!==!1&&{windowOpenerFeatures:G(at)},identityProvider:`https://nfid.one/authenticate/?applicationName=${encodeURI(this.#t)}&applicationLogo=${encodeURI(this.#e)}`}}};import{AuthClient as re}from"@dfinity/auth-client";var K=()=>re.create({idleOptions:{disableIdle:!0,disableDefaultIdleCallback:!0}});var dt=async({data:t})=>{try{return await V(t)}catch(e){console.error("The data parsing has failed, mapping to undefined as a fallback.",e);return}};var J=async t=>{let{data:e,version:s,description:o}=t;return{description:_(o),data:await st(e),version:_(s)}},X=t=>{let{version:e}=t;return{version:_(e)}},U=async({doc:t,key:e})=>{let{owner:s,version:o,description:i,data:n,...r}=t;return{key:e,description:p(i),owner:s.toText(),data:await V(n),version:p(o),...r}};import{Principal as ae}from"@dfinity/principal";var $=({matcher:t,paginate:e,order:s,owner:o})=>({matcher:l(t)?[]:[{key:_(t.key),description:_(t.description)}],paginate:_(l(e)?void 0:{start_after:_(e.startAfter),limit:_(l(e.limit)?void 0:BigInt(e.limit))}),order:_(l(s)?void 0:{desc:s.desc,field:s.field==="created_at"?{CreatedAt:null}:s.field==="updated_at"?{UpdatedAt:null}:{Keys:null}}),owner:_(l(o)?void 0:typeof o=="string"?ae.fromText(o):o)});var ut=({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)}),s=t.Record({controllers:t.Vec(t.Principal)}),o=t.Variant({Write:t.Null,Admin:t.Null}),i=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)}),n=t.Record({version:t.Opt(t.Nat64)}),r=t.Variant({Db:t.Null,Storage:t.Null}),a=t.Record({cycles:t.Nat,destination_id:t.Principal}),d=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}),A=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),u=t.Record({key:d,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,A)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,version:t.Opt(t.Nat64)}),g=t.Record({derivation_origin:t.Opt(t.Text)}),h=t.Record({internet_identity:t.Opt(g)}),v=t.Variant({Deny:t.Null,AllowAny:t.Null,SameOrigin:t.Null}),O=t.Variant({Deny:t.Null,Allow:t.Null}),P=t.Record({status_code:t.Nat16,location:t.Text}),S=t.Record({iframe:t.Opt(v),rewrites:t.Vec(t.Tuple(t.Text,t.Text)),headers:t.Vec(t.Tuple(t.Text,t.Vec(t.Tuple(t.Text,t.Text)))),raw_access:t.Opt(O),redirects:t.Opt(t.Vec(t.Tuple(t.Text,P)))}),y=t.Record({storage:S}),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)}),j=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)}),k=t.Variant({Heap:t.Null,Stable:t.Null}),E=t.Record({memory:k,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}),$t=t.Variant({Callback:t.Record({token:E,callback:t.Func([],[],["query"])})}),Bt=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt($t),status_code:t.Nat16}),qt=t.Record({token:t.Opt(E),body:t.Vec(t.Nat8)}),jt=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}),Ht=t.Record({batch_id:t.Nat}),zt=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),Wt=t.Record({field:zt,desc:t.Bool}),Yt=t.Record({key:t.Opt(t.Text),description:t.Opt(t.Text)}),Gt=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),L=t.Record({order:t.Opt(Wt),owner:t.Opt(t.Principal),matcher:t.Opt(Yt),paginate:t.Opt(Gt)}),Jt=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,u)),items_length:t.Nat64}),Xt=t.Record({updated_at:t.Nat64,created_at:t.Nat64,version:t.Opt(t.Nat64),bn_id:t.Opt(t.Text)}),Qt=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}),C=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),Zt=t.Record({max_capacity:t.Opt(t.Nat32),memory:t.Opt(k),updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:C,created_at:t.Nat64,version:t.Opt(t.Nat64),mutable_permissions:t.Opt(t.Bool),write:C}),It=t.Record({stable:t.Nat64,heap:t.Nat64}),Dt=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),scope:o,expires_at:t.Opt(t.Nat64)}),Lt=t.Record({controller:Dt,controllers:t.Vec(t.Principal)}),tt=t.Record({data:t.Vec(t.Nat8),description:t.Opt(t.Text),version:t.Opt(t.Nat64)}),te=t.Record({max_capacity:t.Opt(t.Nat32),memory:t.Opt(k),max_size:t.Opt(t.Nat),read:C,version:t.Opt(t.Nat64),mutable_permissions:t.Opt(t.Bool),write:C}),ee=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat,order_id:t.Opt(t.Nat)}),se=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],[t.Nat64],["query"]),count_docs:t.Func([t.Text],[t.Nat64],["query"]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Text],[],[]),del_controllers:t.Func([s],[t.Vec(t.Tuple(t.Principal,i))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,n],[],[]),del_docs:t.Func([t.Text],[],[]),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,n))],[],[]),del_rule:t.Func([r,t.Text,n],[],[]),deposit_cycles:t.Func([a],[],[]),get_asset:t.Func([t.Text,t.Text],[t.Opt(u)],["query"]),get_auth_config:t.Func([],[t.Opt(h)],["query"]),get_config:t.Func([],[y],[]),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(u)))],["query"]),get_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[t.Vec(t.Tuple(t.Text,t.Opt(T)))],["query"]),http_request:t.Func([j],[Bt],["query"]),http_request_streaming_callback:t.Func([E],[qt],["query"]),init_asset_upload:t.Func([jt],[Ht],[]),list_assets:t.Func([t.Text,L],[Jt],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,i))],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,Xt))],["query"]),list_docs:t.Func([t.Text,L],[Qt],["query"]),list_rules:t.Func([r],[t.Vec(t.Tuple(t.Text,Zt))],["query"]),memory_size:t.Func([],[It],["query"]),set_auth_config:t.Func([h],[],[]),set_config:t.Func([y],[],[]),set_controllers:t.Func([Lt],[t.Vec(t.Tuple(t.Principal,i))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_doc:t.Func([t.Text,t.Text,tt],[T],[]),set_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text,tt))],[t.Vec(t.Tuple(t.Text,T))],[]),set_rule:t.Func([r,t.Text,te],[],[]),upload_asset_chunk:t.Func([ee],[se],[]),version:t.Func([],[t.Text],["query"])})};import{Actor as ce,HttpAgent as le}from"@dfinity/agent";var mt=async({satelliteId:t,idlFactory:e,identity:s,fetch:o,container:i})=>{let r=c(i)&&i!==!1?i===!0?R:i:"https://icp-api.io",a=new le({identity:s,host:r,...o&&{fetch:o}});return c(i)&&await a.fetchRootKey(),ce.createActor(e,{agent:a,canisterId:t})};var yt=({satelliteId:t,container:e})=>{let{satelliteId:s}=Q({satelliteId:t}),{container:o}=Z({container:e});if(c(o)&&o!==!1){let{host:i,protocol:n}=new URL(o===!0?R:o);return`${n}//${s??"unknown"}.${i.replace("127.0.0.1","localhost")}`}return`https://${s??"unknown"}.icp0.io`},Q=({satelliteId:t})=>c(t)?{satelliteId:t}:x.getInstance().get()??{satelliteId:void 0},Z=({container:t})=>c(t)?{container:t}:x.getInstance().get()??{container:void 0};var f=async({satelliteId:t,container:e,...s})=>{let{satelliteId:o}=Q({satelliteId:t});F(o,"No satellite ID defined. Did you initialize Juno?");let{container:i}=Z({container:e});return mt({satelliteId:o,container:i,idlFactory:ut,...s})};var ft=async({collection:t,key:e,satellite:s})=>{let o=await f(s),i=p(await o.get_doc(t,e));if(!l(i))return U({doc:i,key:e})},gt=async({docs:t,satellite:e})=>{let{get_many_docs:s}=await f(e),o=t.map(({collection:r,key:a})=>[r,a]),i=await s(o),n=[];for(let[r,a]of i){let d=p(a);n.push(c(d)?await U({key:r,doc:d}):void 0)}return n},ht=async({collection:t,doc:e,satellite:s})=>{let{set_doc:o}=await f(s),{key:i}=e,n=await J(e),r=await o(t,i,n);return await U({key:i,doc:r})},_t=async({docs:t,satellite:e})=>{let{set_many_docs:s}=await f(e),o=[];for(let{collection:r,doc:a}of t){let{key:d}=a;o.push([r,d,await J(a)])}let i=await s(o),n=[];for(let[r,a]of i)n.push(await U({key:r,doc:a}));return n},At=async({collection:t,doc:e,satellite:s})=>{let{del_doc:o}=await f(s),{key:i}=e;return o(t,i,X(e))},Tt=async({docs:t,satellite:e})=>{let{del_many_docs:s}=await f(e),o=t.map(({collection:i,doc:n})=>[i,n.key,X(n)]);await s(o)},xt=async({collection:t,filter:e,satellite:s})=>{let o=await f(s),{items:i,items_page:n,items_length:r,matches_length:a,matches_pages:d}=await o.list_docs(t,$(e)),A=[];for(let[u,g]of i){let{data:h,owner:v,description:O,version:P,...S}=g;A.push({key:u,description:p(O),owner:v.toText(),data:await dt({data:h}),version:p(P),...S})}return{items:A,items_length:r,items_page:p(n),matches_length:a,matches_pages:p(d)}};import{AnonymousIdentity as pe}from"@dfinity/agent";var m=t=>t!==void 0?t:B()??new pe;var Nt=async({satellite:t,...e})=>{let s=m(t?.identity);return ft({...e,satellite:{...t,identity:s}})},Ts=async({satellite:t,...e})=>{let s=m(t?.identity);return gt({...e,satellite:{...t,identity:s}})},Pt=async({satellite:t,...e})=>{let s=m(t?.identity);return ht({...e,satellite:{...t,identity:s}})},xs=async({satellite:t,...e})=>{let s=m(t?.identity);return _t({...e,satellite:{...t,identity:s}})},Ns=async({satellite:t,...e})=>{let s=m(t?.identity);return At({...e,satellite:{...t,identity:s}})},Ps=async({satellite:t,...e})=>{let s=m(t?.identity);return Tt({...e,satellite:{...t,identity:s}})},ws=async({satellite:t,filter:e,...s})=>{let o=m(t?.identity);return xt({...s,filter:e??{},satellite:{...t,identity:o}})};var wt=async t=>{let e=B();if(l(e))throw new Error("No identity to initialize the user. Have you initialized Juno?");let s=e.getPrincipal().toText(),o=await Nt({collection:"#user",key:s});return l(o)?await de({userId:s,provider:t}):o},de=async({userId:t,...e})=>Pt({collection:"#user",doc:{key:t,data:e}});var N,I=async t=>{if(N=N??await K(),!(await N?.isAuthenticated()??!1))return;let s=await wt(t);w.getInstance().set(s)},ue=async t=>new Promise(async(e,s)=>{N=N??await K();let o=t?.provider??new M({});await N.login({onSuccess:async()=>{await I(o.id),e()},onError:i=>s(i),maxTimeToLive:t?.maxTimeToLive??it,allowPinAuthentication:t?.allowPin??nt,...t?.derivationOrigin!==void 0&&{derivationOrigin:t.derivationOrigin},...o.signInOptions({windowed:t?.windowed})})}),D=async()=>{await N?.logout(),N=void 0,w.getInstance().reset()},B=()=>N?.getIdentity(),me=async()=>(N??await K()).getIdentity();var vt=t=>{let e=t===!0?"./workers/auth.worker.js":t,s=new Worker(e),o=async()=>{Y({message:"junoSignOutAuthTimer"}),await D()};return s.onmessage=async({data:i})=>{let{msg:n,data:r}=i;switch(n){case"junoSignOutAuthTimer":await o();return;case"junoDelegationRemainingTime":Y({message:"junoDelegationRemainingTime",detail:r?.authRemainingTime});return}},w.getInstance().subscribe(i=>{if(l(i)){s.postMessage({msg:"junoStopAuthTimer"});return}s.postMessage({msg:"junoStartAuthTimer"})})};var Ot=()=>{let t=()=>typeof import.meta<"u"&&typeof import.meta.env<"u"?import.meta.env?.VITE_SATELLITE_ID??import.meta.env?.PUBLIC_SATELLITE_ID:void 0;return typeof process<"u"?process.env?.NEXT_PUBLIC_SATELLITE_ID??t():t()},St=()=>{let t=()=>typeof import.meta<"u"&&typeof import.meta.env<"u"?import.meta.env?.VITE_CONTAINER??import.meta.env?.PUBLIC_CONTAINER:void 0;return typeof process<"u"?process.env?.NEXT_PUBLIC_CONTAINER??t():t()};import"@dfinity/principal";var ye=t=>t==null,fe=t=>!ye(t),q=t=>fe(t)?[t]:[],ge=()=>typeof window<"u",bt=async({asset:{data:t,filename:e,collection:s,headers:o,token:i,fullPath:n,encoding:r,description:a},actor:d,init_asset_upload:A})=>{let{batch_id:u}=await A({collection:s,full_path:n,name:e,token:q(i),encoding_type:q(r),description:q(a)}),g=19e5,h=[],v=ge()?new Blob([await t.arrayBuffer()]):t,O=0n;for(let y=0;y<v.size;y+=g){let T=v.slice(y,y+g);h.push({batchId:u,chunk:T,actor:d,orderId:O}),O++}let P=[];for await(let y of he({uploadChunks:h}))P=[...P,...y];let S=o.find(([y,T])=>y.toLowerCase()==="content-type")===void 0&&t.type!==void 0&&t.type!==""?[["Content-Type",t.type]]:void 0;await d.commit_asset_upload({batch_id:u,chunk_ids:P.map(({chunk_id:y})=>y),headers:[...o,...S||[]]})};async function*he({uploadChunks:t,limit:e=12}){for(let s=0;s<t.length;s=s+e){let o=t.slice(s,s+e);yield await Promise.all(o.map(i=>_e(i)))}}var _e=async({batchId:t,chunk:e,actor:s,orderId:o})=>s.upload_asset_chunk({batch_id:t,content:new Uint8Array(await e.arrayBuffer()),order_id:q(o)});var Rt=async({satellite:t,...e})=>{let s=await f(t);await bt({actor:s,asset:e,init_asset_upload:async i=>await s.init_asset_upload(i)})},kt=async({collection:t,satellite:e,filter:s})=>{let o=await f(e),{items:i,items_length:n,items_page:r,matches_length:a,matches_pages:d}=await o.list_assets(t,$(s));return{items:i.map(([A,u])=>u),items_length:n,items_page:p(r),matches_length:a,matches_pages:p(d)}},Et=async({collection:t,fullPath:e,satellite:s})=>(await f(s)).del_asset(t,e),Ut=async({assets:t,satellite:e})=>{let{del_many_assets:s}=await f(e),o=t.map(({collection:i,fullPath:n})=>[i,n]);await s(o)},Ct=async({collection:t,fullPath:e,satellite:s})=>{let{get_asset:o}=await f(s);return p(await o(t,e))},Ft=async({assets:t,satellite:e})=>{let{get_many_assets:s}=await f(e),o=t.map(({collection:n,fullPath:r})=>[n,r]);return(await s(o)).map(([n,r])=>p(r))};var Vt=t=>btoa([...t].map(e=>String.fromCharCode(e)).join(""));var so=async t=>Mt(t),oo=async t=>Mt({filename:t.data.name,...t}),Mt=async({filename:t,data:e,collection:s,headers:o=[],fullPath:i,token:n,satellite:r,encoding:a,description:d})=>{let A=m(r?.identity),u=decodeURI(t),g=i??`/${s}/${u}`,h={...r,identity:A};return await Rt({data:e,filename:u,collection:s,token:n,headers:o,fullPath:g,encoding:a,satellite:h,description:d}),{downloadUrl:Kt({satellite:h,assetKey:{fullPath:g,token:n}}),fullPath:g,name:u}},io=async({collection:t,satellite:e,filter:s})=>{let o={...e,identity:m(e?.identity)},{items:i,...n}=await kt({collection:t,satellite:o,filter:s??{}}),r=i.map(({key:{full_path:a,token:d,name:A,owner:u,description:g},headers:h,encodings:v,created_at:O,updated_at:P})=>{let S=p(d);return{fullPath:a,description:p(g),name:A,downloadUrl:Kt({satellite:o,assetKey:{fullPath:a,token:S}}),token:S,headers:h,encodings:v.reduce((y,[T,{modified:j,sha256:k,total_length:E}])=>({...y,[T]:{modified:j,sha256:Vt(k),total_length:E}}),{}),owner:u.toText(),created_at:O,updated_at:P}});return{items:r,assets:r,...n}},no=async({collection:t,fullPath:e,satellite:s})=>Et({collection:t,fullPath:e,satellite:{...s,identity:m(s?.identity)}}),ro=async({assets:t,satellite:e})=>Ut({assets:t,satellite:{...e,identity:m(e?.identity)}}),ao=async({satellite:t,...e})=>{let s=m(t?.identity);return Ct({...e,satellite:{...t,identity:s}})},co=async({satellite:t,...e})=>{let s=m(t?.identity);return Ft({...e,satellite:{...t,identity:s}})},Kt=({assetKey:{fullPath:t,token:e},satellite:s})=>{let o={...s,identity:m(s?.identity)};return`${yt(o)}${t}${c(e)?`?token=${e}`:""}`};var Ae=t=>{let e=t?.satelliteId??Ot();F(e,"Satellite ID is not configured. Juno cannot be initialized.");let s=t?.container??St();return{satelliteId:e,internetIdentityId:t?.internetIdentityId,workers:t?.workers,container:s}},ho=async t=>Te(t),Te=async t=>{let e=Ae(t);x.getInstance().set(e),await I();let s=e.workers?.auth!==void 0?vt(e.workers.auth):void 0;return[...s?[s]:[]]},_o=t=>w.getInstance().subscribe(t);export{M as InternetIdentityProvider,pt as NFIDProvider,_o as authSubscribe,no as deleteAsset,Ns as deleteDoc,ro as deleteManyAssets,Ps as deleteManyDocs,Kt as downloadUrl,ao as getAsset,Nt as getDoc,co as getManyAssets,Ts as getManyDocs,ho as initJuno,Te as initSatellite,io as listAssets,ws as listDocs,Pt as setDoc,xs as setManyDocs,ue as signIn,D as signOut,me as unsafeIdentity,so as uploadBlob,oo as uploadFile};
|
|
1
|
+
import{Principal as it}from"@dfinity/principal";var c=t=>t==null,l=t=>!c(t),ce=class extends Error{},F=(t,e)=>{if(c(t))throw new ce(e)},W="__bigint__",G="__principal__",Y="__uint8array__",le=(t,e)=>typeof e=="bigint"?{[W]:`${e}`}:l(e)&&e instanceof it?{[G]:e.toText()}:l(e)&&e instanceof Uint8Array?{[Y]:Array.from(e)}:e,pe=(t,e)=>{let s=o=>e[o];return l(e)&&typeof e=="object"&&W in e?BigInt(s(W)):l(e)&&typeof e=="object"&&G in e?it.fromText(s(G)):l(e)&&typeof e=="object"&&Y in e?Uint8Array.from(s(Y)):e},u=t=>l(t)?[t]:[],p=t=>t?.[0],nt=async t=>{let e=new Blob([JSON.stringify(t,le)],{type:"application/json; charset=utf-8"});return new Uint8Array(await e.arrayBuffer())},V=async t=>{let e=new Blob([t instanceof Uint8Array?t:new Uint8Array(t)],{type:"application/json; charset=utf-8"});return JSON.parse(await e.text(),pe)},rt=()=>typeof window<"u";var R=class{callbacks=[];populate(e){this.callbacks.forEach(({callback:s})=>s(e))}subscribe(e){let s=Symbol();return this.callbacks.push({id:s,callback:e}),()=>this.callbacks=this.callbacks.filter(({id:o})=>o!==s)}};var v=class t extends R{static instance;authUser=null;constructor(){super()}static getInstance(){return t.instance||(t.instance=new t),t.instance}set(e){this.authUser=e,this.populate(e)}get(){return this.authUser}subscribe(e){let s=super.subscribe(e);return e(this.authUser),s}reset(){this.authUser=null,this.populate(this.authUser)}};var J=({message:t,detail:e})=>{let s=new CustomEvent(t,{detail:e,bubbles:!0});document.dispatchEvent(s)};var at=BigInt(144e11),ct=!1,lt={width:576,height:576},pt={width:505,height:705},dt="internetcomputer.org";var k="http://127.0.0.1:5987",ut="rdmx6-jaaaa-aaaaa-aaadq-cai";var N=class t extends R{static instance;env;constructor(){super()}static getInstance(){return t.instance||(t.instance=new t),t.instance}set(e){this.env=e,this.populate(e)}get(){return this.env}subscribe(e){let s=super.subscribe(e);return e(this.env),s}};var X=({width:t,height:e})=>{if(!rt()||c(window)||c(window.top))return;let{top:{innerWidth:s,innerHeight:o}}=window,i=o/2+screenY-e/2,n=s/2+screenX-t/2;return`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=no, width=${t}, height=${e}, top=${i}, left=${n}`};var M=class{#t;constructor({domain:e}){this.#t=e}get id(){return"internet_identity"}signInOptions({windowed:e}){let s=()=>{let o=N.getInstance().get()?.container;if(c(o)||o===!1)return`https://identity.${this.#t??dt}`;let i=N.getInstance().get(),n=l(i)&&l(i?.internetIdentityId)?i.internetIdentityId:ut,{host:r,protocol:a}=new URL(o===!0?k:o);return/apple/i.test(navigator?.vendor)?`${a}//${r}?canisterId=${n}`:`${a}//${n}.${r.replace("127.0.0.1","localhost")}`};return{...e!==!1&&{windowOpenerFeatures:X(lt)},identityProvider:s()}}},mt=class{#t;#e;constructor({appName:e,logoUrl:s}){this.#t=e,this.#e=s}get id(){return"nfid"}signInOptions({windowed:e}){return{...e!==!1&&{windowOpenerFeatures:X(pt)},identityProvider:`https://nfid.one/authenticate/?applicationName=${encodeURI(this.#t)}&applicationLogo=${encodeURI(this.#e)}`}}};import{AuthClient as de}from"@dfinity/auth-client";var K=()=>de.create({idleOptions:{disableIdle:!0,disableDefaultIdleCallback:!0}});var yt=async({data:t})=>{try{return await V(t)}catch(e){console.error("The data parsing has failed, mapping to undefined as a fallback.",e);return}};var Q=async t=>{let{data:e,version:s,description:o}=t;return{description:u(o),data:await nt(e),version:u(s)}},Z=t=>{let{version:e}=t;return{version:u(e)}},C=async({doc:t,key:e})=>{let{owner:s,version:o,description:i,data:n,...r}=t;return{key:e,description:p(i),owner:s.toText(),data:await V(n),version:p(o),...r}};import{Principal as ue}from"@dfinity/principal";var ft=t=>{if(c(t))return u();switch(t.matcher){case"equal":return u({Equal:t.timestamp});case"greaterThan":return u({GreaterThan:t.timestamp});case"lessThan":return u({LessThan:t.timestamp});case"between":return u({Between:[t.timestamps.start,t.timestamps.end]});default:throw new Error("Invalid list matcher for timestamp",t)}},q=({matcher:t,paginate:e,order:s,owner:o})=>({matcher:c(t)?[]:[{key:u(t.key),description:u(t.description),created_at:ft(t.createdAt),updated_at:ft(t.updatedAt)}],paginate:u(c(e)?void 0:{start_after:u(e.startAfter),limit:u(c(e.limit)?void 0:BigInt(e.limit))}),order:u(c(s)?void 0:{desc:s.desc,field:s.field==="created_at"?{CreatedAt:null}:s.field==="updated_at"?{UpdatedAt:null}:{Keys:null}}),owner:u(c(o)?void 0:typeof o=="string"?ue.fromText(o):o)});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)}),s=t.Record({controllers:t.Vec(t.Principal)}),o=t.Variant({Write:t.Null,Admin:t.Null}),i=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)}),n=t.Record({version:t.Opt(t.Nat64)}),r=t.Variant({Db:t.Null,Storage:t.Null}),a=t.Record({version:t.Opt(t.Nat64)}),d=t.Record({cycles:t.Nat,destination_id:t.Principal}),_=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}),f=t.Record({modified:t.Nat64,sha256:t.Vec(t.Nat8),total_length:t.Nat}),g=t.Record({key:_,updated_at:t.Nat64,encodings:t.Vec(t.Tuple(t.Text,f)),headers:t.Vec(t.Tuple(t.Text,t.Text)),created_at:t.Nat64,version:t.Opt(t.Nat64)}),T=t.Record({derivation_origin:t.Opt(t.Text)}),x=t.Record({internet_identity:t.Opt(T)}),w=t.Record({stable:t.Opt(t.Nat64),heap:t.Opt(t.Nat64)}),A=t.Record({max_memory_size:t.Opt(w)}),O=t.Variant({Deny:t.Null,AllowAny:t.Null,SameOrigin:t.Null}),h=t.Variant({Deny:t.Null,Allow:t.Null}),b=t.Record({status_code:t.Nat16,location:t.Text}),E=t.Record({iframe:t.Opt(O),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(w),raw_access:t.Opt(h),redirects:t.Opt(t.Vec(t.Tuple(t.Text,b)))}),j=t.Record({db:t.Opt(A),authentication:t.Opt(x),storage:E}),S=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)}),zt=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)}),z=t.Variant({Heap:t.Null,Stable:t.Null}),H=t.Record({memory:z,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}),Ht=t.Variant({Callback:t.Record({token:H,callback:t.Func([],[],["query"])})}),Wt=t.Record({body:t.Vec(t.Nat8),headers:t.Vec(t.Tuple(t.Text,t.Text)),streaming_strategy:t.Opt(Ht),status_code:t.Nat16}),Gt=t.Record({token:t.Opt(H),body:t.Vec(t.Nat8)}),Yt=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}),Jt=t.Record({batch_id:t.Nat}),Xt=t.Variant({UpdatedAt:t.Null,Keys:t.Null,CreatedAt:t.Null}),Qt=t.Record({field:Xt,desc:t.Bool}),et=t.Variant({Equal:t.Nat64,Between:t.Tuple(t.Nat64,t.Nat64),GreaterThan:t.Nat64,LessThan:t.Nat64}),Zt=t.Record({key:t.Opt(t.Text),updated_at:t.Opt(et),description:t.Opt(t.Text),created_at:t.Opt(et)}),Dt=t.Record({start_after:t.Opt(t.Text),limit:t.Opt(t.Nat64)}),st=t.Record({order:t.Opt(Qt),owner:t.Opt(t.Principal),matcher:t.Opt(Zt),paginate:t.Opt(Dt)}),It=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,g)),items_length:t.Nat64}),Lt=t.Record({updated_at:t.Nat64,created_at:t.Nat64,version:t.Opt(t.Nat64),bn_id:t.Opt(t.Text)}),te=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}),U=t.Variant({Controllers:t.Null,Private:t.Null,Public:t.Null,Managed:t.Null}),ee=t.Record({max_capacity:t.Opt(t.Nat32),memory:t.Opt(z),updated_at:t.Nat64,max_size:t.Opt(t.Nat),read:U,created_at:t.Nat64,version:t.Opt(t.Nat64),mutable_permissions:t.Opt(t.Bool),write:U}),se=t.Record({stable:t.Nat64,heap:t.Nat64}),oe=t.Record({metadata:t.Vec(t.Tuple(t.Text,t.Text)),scope:o,expires_at:t.Opt(t.Nat64)}),ie=t.Record({controller:oe,controllers:t.Vec(t.Principal)}),ot=t.Record({data:t.Vec(t.Nat8),description:t.Opt(t.Text),version:t.Opt(t.Nat64)}),ne=t.Record({max_capacity:t.Opt(t.Nat32),memory:t.Opt(z),max_size:t.Opt(t.Nat),read:U,version:t.Opt(t.Nat64),mutable_permissions:t.Opt(t.Bool),write:U}),re=t.Record({content:t.Vec(t.Nat8),batch_id:t.Nat,order_id:t.Opt(t.Nat)}),ae=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],[t.Nat64],["query"]),count_docs:t.Func([t.Text],[t.Nat64],["query"]),del_asset:t.Func([t.Text,t.Text],[],[]),del_assets:t.Func([t.Text],[],[]),del_controllers:t.Func([s],[t.Vec(t.Tuple(t.Principal,i))],[]),del_custom_domain:t.Func([t.Text],[],[]),del_doc:t.Func([t.Text,t.Text,n],[],[]),del_docs:t.Func([t.Text],[],[]),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,n))],[],[]),del_rule:t.Func([r,t.Text,a],[],[]),deposit_cycles:t.Func([d],[],[]),get_asset:t.Func([t.Text,t.Text],[t.Opt(g)],["query"]),get_auth_config:t.Func([],[t.Opt(x)],["query"]),get_config:t.Func([],[j],[]),get_db_config:t.Func([],[t.Opt(A)],["query"]),get_doc:t.Func([t.Text,t.Text],[t.Opt(S)],["query"]),get_many_assets:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[t.Vec(t.Tuple(t.Text,t.Opt(g)))],["query"]),get_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text))],[t.Vec(t.Tuple(t.Text,t.Opt(S)))],["query"]),get_storage_config:t.Func([],[E],["query"]),http_request:t.Func([zt],[Wt],["query"]),http_request_streaming_callback:t.Func([H],[Gt],["query"]),init_asset_upload:t.Func([Yt],[Jt],[]),list_assets:t.Func([t.Text,st],[It],["query"]),list_controllers:t.Func([],[t.Vec(t.Tuple(t.Principal,i))],["query"]),list_custom_domains:t.Func([],[t.Vec(t.Tuple(t.Text,Lt))],["query"]),list_docs:t.Func([t.Text,st],[te],["query"]),list_rules:t.Func([r],[t.Vec(t.Tuple(t.Text,ee))],["query"]),memory_size:t.Func([],[se],["query"]),set_auth_config:t.Func([x],[],[]),set_controllers:t.Func([ie],[t.Vec(t.Tuple(t.Principal,i))],[]),set_custom_domain:t.Func([t.Text,t.Opt(t.Text)],[],[]),set_db_config:t.Func([A],[],[]),set_doc:t.Func([t.Text,t.Text,ot],[S],[]),set_many_docs:t.Func([t.Vec(t.Tuple(t.Text,t.Text,ot))],[t.Vec(t.Tuple(t.Text,S))],[]),set_rule:t.Func([r,t.Text,ne],[],[]),set_storage_config:t.Func([E],[],[]),upload_asset_chunk:t.Func([re],[ae],[]),version:t.Func([],[t.Text],["query"])})};import{Actor as me,HttpAgent as ye}from"@dfinity/agent";var ht=async({satelliteId:t,idlFactory:e,identity:s,fetch:o,container:i})=>{let r=l(i)&&i!==!1?i===!0?k:i:"https://icp-api.io",a=new ye({identity:s,host:r,...o&&{fetch:o}});return l(i)&&await a.fetchRootKey(),me.createActor(e,{agent:a,canisterId:t})};var _t=({satelliteId:t,container:e})=>{let{satelliteId:s}=D({satelliteId:t}),{container:o}=I({container:e});if(l(o)&&o!==!1){let{host:i,protocol:n}=new URL(o===!0?k:o);return`${n}//${s??"unknown"}.${i.replace("127.0.0.1","localhost")}`}return`https://${s??"unknown"}.icp0.io`},D=({satelliteId:t})=>l(t)?{satelliteId:t}:N.getInstance().get()??{satelliteId:void 0},I=({container:t})=>l(t)?{container:t}:N.getInstance().get()??{container:void 0};var y=async({satelliteId:t,container:e,...s})=>{let{satelliteId:o}=D({satelliteId:t});F(o,"No satellite ID defined. Did you initialize Juno?");let{container:i}=I({container:e});return ht({satelliteId:o,container:i,idlFactory:gt,...s})};var Tt=async({collection:t,key:e,satellite:s})=>{let o=await y(s),i=p(await o.get_doc(t,e));if(!c(i))return C({doc:i,key:e})},At=async({docs:t,satellite:e})=>{let{get_many_docs:s}=await y(e),o=t.map(({collection:r,key:a})=>[r,a]),i=await s(o),n=[];for(let[r,a]of i){let d=p(a);n.push(l(d)?await C({key:r,doc:d}):void 0)}return n},xt=async({collection:t,doc:e,satellite:s})=>{let{set_doc:o}=await y(s),{key:i}=e,n=await Q(e),r=await o(t,i,n);return await C({key:i,doc:r})},Nt=async({docs:t,satellite:e})=>{let{set_many_docs:s}=await y(e),o=[];for(let{collection:r,doc:a}of t){let{key:d}=a;o.push([r,d,await Q(a)])}let i=await s(o),n=[];for(let[r,a]of i)n.push(await C({key:r,doc:a}));return n},Pt=async({collection:t,doc:e,satellite:s})=>{let{del_doc:o}=await y(s),{key:i}=e;return o(t,i,Z(e))},wt=async({docs:t,satellite:e})=>{let{del_many_docs:s}=await y(e),o=t.map(({collection:i,doc:n})=>[i,n.key,Z(n)]);await s(o)},vt=async({collection:t,filter:e,satellite:s})=>{let o=await y(s),{items:i,items_page:n,items_length:r,matches_length:a,matches_pages:d}=await o.list_docs(t,q(e)),_=[];for(let[f,g]of i){let{data:T,owner:x,description:w,version:A,...O}=g;_.push({key:f,description:p(w),owner:x.toText(),data:await yt({data:T}),version:p(A),...O})}return{items:_,items_length:r,items_page:p(n),matches_length:a,matches_pages:p(d)}};import{AnonymousIdentity as fe}from"@dfinity/agent";var m=t=>t!==void 0?t:B()??new fe;var Ot=async({satellite:t,...e})=>{let s=m(t?.identity);return Tt({...e,satellite:{...t,identity:s}})},vs=async({satellite:t,...e})=>{let s=m(t?.identity);return At({...e,satellite:{...t,identity:s}})},St=async({satellite:t,...e})=>{let s=m(t?.identity);return xt({...e,satellite:{...t,identity:s}})},Os=async({satellite:t,...e})=>{let s=m(t?.identity);return Nt({...e,satellite:{...t,identity:s}})},Ss=async({satellite:t,...e})=>{let s=m(t?.identity);return Pt({...e,satellite:{...t,identity:s}})},bs=async({satellite:t,...e})=>{let s=m(t?.identity);return wt({...e,satellite:{...t,identity:s}})},Rs=async({satellite:t,filter:e,...s})=>{let o=m(t?.identity);return vt({...s,filter:e??{},satellite:{...t,identity:o}})};var bt=async t=>{let e=B();if(c(e))throw new Error("No identity to initialize the user. Have you initialized Juno?");let s=e.getPrincipal().toText(),o=await Ot({collection:"#user",key:s});return c(o)?await ge({userId:s,provider:t}):o},ge=async({userId:t,...e})=>St({collection:"#user",doc:{key:t,data:e}});var P,L=async t=>{if(P=P??await K(),!(await P?.isAuthenticated()??!1))return;let s=await bt(t);v.getInstance().set(s)},he=async t=>new Promise(async(e,s)=>{P=P??await K();let o=t?.provider??new M({});await P.login({onSuccess:async()=>{await L(o.id),e()},onError:i=>s(i),maxTimeToLive:t?.maxTimeToLive??at,allowPinAuthentication:t?.allowPin??ct,...t?.derivationOrigin!==void 0&&{derivationOrigin:t.derivationOrigin},...o.signInOptions({windowed:t?.windowed})})}),tt=async()=>{await P?.logout(),P=void 0,v.getInstance().reset()},B=()=>P?.getIdentity(),_e=async()=>(P??await K()).getIdentity();var Rt=t=>{let e=t===!0?"./workers/auth.worker.js":t,s=new Worker(e),o=async()=>{J({message:"junoSignOutAuthTimer"}),await tt()};return s.onmessage=async({data:i})=>{let{msg:n,data:r}=i;switch(n){case"junoSignOutAuthTimer":await o();return;case"junoDelegationRemainingTime":J({message:"junoDelegationRemainingTime",detail:r?.authRemainingTime});return}},v.getInstance().subscribe(i=>{if(c(i)){s.postMessage({msg:"junoStopAuthTimer"});return}s.postMessage({msg:"junoStartAuthTimer"})})};var kt=()=>{let t=()=>typeof import.meta<"u"&&typeof import.meta.env<"u"?import.meta.env?.VITE_SATELLITE_ID??import.meta.env?.PUBLIC_SATELLITE_ID:void 0;return typeof process<"u"?process.env?.NEXT_PUBLIC_SATELLITE_ID??t():t()},Et=()=>{let t=()=>typeof import.meta<"u"&&typeof import.meta.env<"u"?import.meta.env?.VITE_CONTAINER??import.meta.env?.PUBLIC_CONTAINER:void 0;return typeof process<"u"?process.env?.NEXT_PUBLIC_CONTAINER??t():t()};import"@dfinity/principal";var Te=t=>t==null,Ae=t=>!Te(t),$=t=>Ae(t)?[t]:[],xe=()=>typeof window<"u",Ct=async({asset:{data:t,filename:e,collection:s,headers:o,token:i,fullPath:n,encoding:r,description:a},actor:d,init_asset_upload:_})=>{let{batch_id:f}=await _({collection:s,full_path:n,name:e,token:$(i),encoding_type:$(r),description:$(a)}),g=19e5,T=[],x=xe()?new Blob([await t.arrayBuffer()]):t,w=0n;for(let h=0;h<x.size;h+=g){let b=x.slice(h,h+g);T.push({batchId:f,chunk:b,actor:d,orderId:w}),w++}let A=[];for await(let h of Ne({uploadChunks:T}))A=[...A,...h];let O=o.find(([h,b])=>h.toLowerCase()==="content-type")===void 0&&t.type!==void 0&&t.type!==""?[["Content-Type",t.type]]:void 0;await d.commit_asset_upload({batch_id:f,chunk_ids:A.map(({chunk_id:h})=>h),headers:[...o,...O||[]]})};async function*Ne({uploadChunks:t,limit:e=12}){for(let s=0;s<t.length;s=s+e){let o=t.slice(s,s+e);yield await Promise.all(o.map(i=>Pe(i)))}}var Pe=async({batchId:t,chunk:e,actor:s,orderId:o})=>s.upload_asset_chunk({batch_id:t,content:new Uint8Array(await e.arrayBuffer()),order_id:$(o)});var Ut=async({satellite:t,...e})=>{let s=await y(t);await Ct({actor:s,asset:e,init_asset_upload:async i=>await s.init_asset_upload(i)})},Ft=async({collection:t,satellite:e,filter:s})=>{let o=await y(e),{items:i,items_length:n,items_page:r,matches_length:a,matches_pages:d}=await o.list_assets(t,q(s));return{items:i.map(([_,f])=>f),items_length:n,items_page:p(r),matches_length:a,matches_pages:p(d)}},Vt=async({collection:t,fullPath:e,satellite:s})=>(await y(s)).del_asset(t,e),Mt=async({assets:t,satellite:e})=>{let{del_many_assets:s}=await y(e),o=t.map(({collection:i,fullPath:n})=>[i,n]);await s(o)},Kt=async({collection:t,fullPath:e,satellite:s})=>{let{get_asset:o}=await y(s);return p(await o(t,e))},qt=async({assets:t,satellite:e})=>{let{get_many_assets:s}=await y(e),o=t.map(({collection:n,fullPath:r})=>[n,r]);return(await s(o)).map(([n,r])=>p(r))};var Bt=t=>btoa([...t].map(e=>String.fromCharCode(e)).join(""));var ao=async t=>$t(t),co=async t=>$t({filename:t.data.name,...t}),$t=async({filename:t,data:e,collection:s,headers:o=[],fullPath:i,token:n,satellite:r,encoding:a,description:d})=>{let _=m(r?.identity),f=decodeURI(t),g=i??`/${s}/${f}`,T={...r,identity:_};return await Ut({data:e,filename:f,collection:s,token:n,headers:o,fullPath:g,encoding:a,satellite:T,description:d}),{downloadUrl:jt({satellite:T,assetKey:{fullPath:g,token:n}}),fullPath:g,name:f}},lo=async({collection:t,satellite:e,filter:s})=>{let o={...e,identity:m(e?.identity)},{items:i,...n}=await Ft({collection:t,satellite:o,filter:s??{}}),r=i.map(({key:{full_path:a,token:d,name:_,owner:f,description:g},headers:T,encodings:x,created_at:w,updated_at:A})=>{let O=p(d);return{fullPath:a,description:p(g),name:_,downloadUrl:jt({satellite:o,assetKey:{fullPath:a,token:O}}),token:O,headers:T,encodings:x.reduce((h,[b,{modified:E,sha256:j,total_length:S}])=>({...h,[b]:{modified:E,sha256:Bt(j),total_length:S}}),{}),owner:f.toText(),created_at:w,updated_at:A}});return{items:r,assets:r,...n}},po=async({collection:t,fullPath:e,satellite:s})=>Vt({collection:t,fullPath:e,satellite:{...s,identity:m(s?.identity)}}),uo=async({assets:t,satellite:e})=>Mt({assets:t,satellite:{...e,identity:m(e?.identity)}}),mo=async({satellite:t,...e})=>{let s=m(t?.identity);return Kt({...e,satellite:{...t,identity:s}})},yo=async({satellite:t,...e})=>{let s=m(t?.identity);return qt({...e,satellite:{...t,identity:s}})},jt=({assetKey:{fullPath:t,token:e},satellite:s})=>{let o={...s,identity:m(s?.identity)};return`${_t(o)}${t}${l(e)?`?token=${e}`:""}`};var we=t=>{let e=t?.satelliteId??kt();F(e,"Satellite ID is not configured. Juno cannot be initialized.");let s=t?.container??Et();return{satelliteId:e,internetIdentityId:t?.internetIdentityId,workers:t?.workers,container:s}},No=async t=>ve(t),ve=async t=>{let e=we(t);N.getInstance().set(e),await L();let s=e.workers?.auth!==void 0?Rt(e.workers.auth):void 0;return[...s?[s]:[]]},Po=t=>v.getInstance().subscribe(t);export{M as InternetIdentityProvider,mt as NFIDProvider,Po as authSubscribe,po as deleteAsset,Ss as deleteDoc,uo as deleteManyAssets,bs as deleteManyDocs,jt as downloadUrl,mo as getAsset,Ot as getDoc,yo as getManyAssets,vs as getManyDocs,No as initJuno,ve as initSatellite,lo as listAssets,Rs as listDocs,St as setDoc,Os as setManyDocs,he as signIn,tt as signOut,_e as unsafeIdentity,ao as uploadBlob,co as uploadFile};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|