@junobuild/admin 0.0.12 → 0.0.14
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/README.md +1 -1
- package/declarations/cmc/cmc.did +122 -0
- package/declarations/cmc/cmc.did.d.ts +48 -0
- package/declarations/cmc/cmc.factory.did.js +65 -0
- package/declarations/cmc/index.d.ts +45 -0
- package/declarations/cmc/index.js +32 -0
- package/declarations/console/console.did.d.ts +60 -0
- package/declarations/console/console.factory.did.js +62 -0
- package/declarations/console/console.factory.did.mjs +62 -0
- package/declarations/console/index.d.ts +45 -0
- package/declarations/console/index.js +32 -0
- package/declarations/frontend/frontend.did +188 -0
- package/declarations/frontend/frontend.did.d.ts +172 -0
- package/declarations/frontend/frontend.factory.did.js +208 -0
- package/declarations/frontend/index.d.ts +45 -0
- package/declarations/frontend/index.js +32 -0
- package/declarations/ic/ic.did +82 -0
- package/declarations/ic/ic.did.d.ts +77 -0
- package/declarations/ic/ic.factory.did.js +128 -0
- package/declarations/internet_identity/index.d.ts +45 -0
- package/declarations/internet_identity/index.js +32 -0
- package/declarations/internet_identity/internet_identity.did +330 -0
- package/declarations/internet_identity/internet_identity.did.d.ts +204 -0
- package/declarations/internet_identity/internet_identity.factory.did.js +233 -0
- package/declarations/ledger/index.d.ts +45 -0
- package/declarations/ledger/index.js +32 -0
- package/declarations/ledger/ledger.did +249 -0
- package/declarations/ledger/ledger.did.d.ts +100 -0
- package/declarations/ledger/ledger.factory.did.js +98 -0
- package/declarations/mission_control/index.d.ts +45 -0
- package/declarations/mission_control/index.js +32 -0
- package/declarations/mission_control/mission_control.did.d.ts +41 -0
- package/declarations/mission_control/mission_control.factory.did.js +50 -0
- package/declarations/satellite/index.d.ts +45 -0
- package/declarations/satellite/index.js +32 -0
- package/declarations/satellite/satellite-deprecated.did.d.ts +182 -0
- package/declarations/satellite/satellite-deprecated.factory.did.js +191 -0
- package/declarations/satellite/satellite-deprecated.factory.did.mjs +191 -0
- package/declarations/satellite/satellite.did.d.ts +183 -0
- package/declarations/satellite/satellite.factory.did.js +194 -0
- package/declarations/satellite/satellite.factory.did.mjs +192 -0
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +2 -2
- package/dist/node/index.mjs +1 -1
- package/dist/node/index.mjs.map +2 -2
- package/package.json +3 -3
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import type {ActorMethod} from '@dfinity/agent';
|
|
2
|
+
import type {Principal} from '@dfinity/principal';
|
|
3
|
+
|
|
4
|
+
export interface AssetEncodingNoContent {
|
|
5
|
+
modified: bigint;
|
|
6
|
+
sha256: Uint8Array | number[];
|
|
7
|
+
total_length: bigint;
|
|
8
|
+
}
|
|
9
|
+
export interface AssetKey {
|
|
10
|
+
token: [] | [string];
|
|
11
|
+
collection: string;
|
|
12
|
+
owner: Principal;
|
|
13
|
+
name: string;
|
|
14
|
+
full_path: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AssetNoContent {
|
|
17
|
+
key: AssetKey;
|
|
18
|
+
updated_at: bigint;
|
|
19
|
+
encodings: Array<[string, AssetEncodingNoContent]>;
|
|
20
|
+
headers: Array<[string, string]>;
|
|
21
|
+
created_at: bigint;
|
|
22
|
+
}
|
|
23
|
+
export interface Chunk {
|
|
24
|
+
content: Uint8Array | number[];
|
|
25
|
+
batch_id: bigint;
|
|
26
|
+
}
|
|
27
|
+
export interface CommitBatch {
|
|
28
|
+
batch_id: bigint;
|
|
29
|
+
headers: Array<[string, string]>;
|
|
30
|
+
chunk_ids: Array<bigint>;
|
|
31
|
+
}
|
|
32
|
+
export interface Config {
|
|
33
|
+
storage: StorageConfig;
|
|
34
|
+
}
|
|
35
|
+
export interface Controller {
|
|
36
|
+
updated_at: bigint;
|
|
37
|
+
metadata: Array<[string, string]>;
|
|
38
|
+
created_at: bigint;
|
|
39
|
+
expires_at: [] | [bigint];
|
|
40
|
+
}
|
|
41
|
+
export interface CustomDomain {
|
|
42
|
+
updated_at: bigint;
|
|
43
|
+
created_at: bigint;
|
|
44
|
+
bn_id: [] | [string];
|
|
45
|
+
}
|
|
46
|
+
export interface DelDoc {
|
|
47
|
+
updated_at: [] | [bigint];
|
|
48
|
+
}
|
|
49
|
+
export interface DeleteControllersArgs {
|
|
50
|
+
controllers: Array<Principal>;
|
|
51
|
+
}
|
|
52
|
+
export interface Doc {
|
|
53
|
+
updated_at: bigint;
|
|
54
|
+
owner: Principal;
|
|
55
|
+
data: Uint8Array | number[];
|
|
56
|
+
created_at: bigint;
|
|
57
|
+
}
|
|
58
|
+
export interface HttpRequest {
|
|
59
|
+
url: string;
|
|
60
|
+
method: string;
|
|
61
|
+
body: Uint8Array | number[];
|
|
62
|
+
headers: Array<[string, string]>;
|
|
63
|
+
}
|
|
64
|
+
export interface HttpResponse {
|
|
65
|
+
body: Uint8Array | number[];
|
|
66
|
+
headers: Array<[string, string]>;
|
|
67
|
+
streaming_strategy: [] | [StreamingStrategy];
|
|
68
|
+
status_code: number;
|
|
69
|
+
}
|
|
70
|
+
export interface InitAssetKey {
|
|
71
|
+
token: [] | [string];
|
|
72
|
+
collection: string;
|
|
73
|
+
name: string;
|
|
74
|
+
encoding_type: [] | [string];
|
|
75
|
+
full_path: string;
|
|
76
|
+
}
|
|
77
|
+
export interface InitUploadResult {
|
|
78
|
+
batch_id: bigint;
|
|
79
|
+
}
|
|
80
|
+
export interface ListOrder {
|
|
81
|
+
field: ListOrderField;
|
|
82
|
+
desc: boolean;
|
|
83
|
+
}
|
|
84
|
+
export type ListOrderField = {UpdatedAt: null} | {Keys: null} | {CreatedAt: null};
|
|
85
|
+
export interface ListPaginate {
|
|
86
|
+
start_after: [] | [string];
|
|
87
|
+
limit: [] | [bigint];
|
|
88
|
+
}
|
|
89
|
+
export interface ListParams {
|
|
90
|
+
order: [] | [ListOrder];
|
|
91
|
+
owner: [] | [Principal];
|
|
92
|
+
matcher: [] | [string];
|
|
93
|
+
paginate: [] | [ListPaginate];
|
|
94
|
+
}
|
|
95
|
+
export interface ListResults {
|
|
96
|
+
matches_length: bigint;
|
|
97
|
+
length: bigint;
|
|
98
|
+
items: Array<[string, AssetNoContent]>;
|
|
99
|
+
}
|
|
100
|
+
export interface ListResults_1 {
|
|
101
|
+
matches_length: bigint;
|
|
102
|
+
length: bigint;
|
|
103
|
+
items: Array<[string, Doc]>;
|
|
104
|
+
}
|
|
105
|
+
export type Permission = {Controllers: null} | {Private: null} | {Public: null} | {Managed: null};
|
|
106
|
+
export interface Rule {
|
|
107
|
+
updated_at: bigint;
|
|
108
|
+
max_size: [] | [bigint];
|
|
109
|
+
read: Permission;
|
|
110
|
+
created_at: bigint;
|
|
111
|
+
write: Permission;
|
|
112
|
+
}
|
|
113
|
+
export type RulesType = {Db: null} | {Storage: null};
|
|
114
|
+
export interface SetController {
|
|
115
|
+
metadata: Array<[string, string]>;
|
|
116
|
+
expires_at: [] | [bigint];
|
|
117
|
+
}
|
|
118
|
+
export interface SetControllersArgs {
|
|
119
|
+
controller: SetController;
|
|
120
|
+
controllers: Array<Principal>;
|
|
121
|
+
}
|
|
122
|
+
export interface SetDoc {
|
|
123
|
+
updated_at: [] | [bigint];
|
|
124
|
+
data: Uint8Array | number[];
|
|
125
|
+
}
|
|
126
|
+
export interface SetRule {
|
|
127
|
+
updated_at: [] | [bigint];
|
|
128
|
+
max_size: [] | [bigint];
|
|
129
|
+
read: Permission;
|
|
130
|
+
write: Permission;
|
|
131
|
+
}
|
|
132
|
+
export interface StorageConfig {
|
|
133
|
+
headers: Array<[string, Array<[string, string]>]>;
|
|
134
|
+
}
|
|
135
|
+
export interface StreamingCallbackHttpResponse {
|
|
136
|
+
token: [] | [StreamingCallbackToken];
|
|
137
|
+
body: Uint8Array | number[];
|
|
138
|
+
}
|
|
139
|
+
export interface StreamingCallbackToken {
|
|
140
|
+
token: [] | [string];
|
|
141
|
+
sha256: [] | [Uint8Array | number[]];
|
|
142
|
+
headers: Array<[string, string]>;
|
|
143
|
+
index: bigint;
|
|
144
|
+
encoding_type: string;
|
|
145
|
+
full_path: string;
|
|
146
|
+
}
|
|
147
|
+
export type StreamingStrategy = {
|
|
148
|
+
Callback: {
|
|
149
|
+
token: StreamingCallbackToken;
|
|
150
|
+
callback: [Principal, string];
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
export interface UploadChunk {
|
|
154
|
+
chunk_id: bigint;
|
|
155
|
+
}
|
|
156
|
+
export interface _SERVICE {
|
|
157
|
+
commit_asset_upload: ActorMethod<[CommitBatch], undefined>;
|
|
158
|
+
del_asset: ActorMethod<[string, string], undefined>;
|
|
159
|
+
del_assets: ActorMethod<[[] | [string]], undefined>;
|
|
160
|
+
del_controllers: ActorMethod<[DeleteControllersArgs], Array<[Principal, Controller]>>;
|
|
161
|
+
del_custom_domain: ActorMethod<[string], undefined>;
|
|
162
|
+
del_doc: ActorMethod<[string, string, DelDoc], undefined>;
|
|
163
|
+
get_config: ActorMethod<[], Config>;
|
|
164
|
+
get_doc: ActorMethod<[string, string], [] | [Doc]>;
|
|
165
|
+
http_request: ActorMethod<[HttpRequest], HttpResponse>;
|
|
166
|
+
http_request_streaming_callback: ActorMethod<
|
|
167
|
+
[StreamingCallbackToken],
|
|
168
|
+
StreamingCallbackHttpResponse
|
|
169
|
+
>;
|
|
170
|
+
init_asset_upload: ActorMethod<[InitAssetKey], InitUploadResult>;
|
|
171
|
+
list_assets: ActorMethod<[[] | [string], ListParams], ListResults>;
|
|
172
|
+
list_controllers: ActorMethod<[], Array<[Principal, Controller]>>;
|
|
173
|
+
list_custom_domains: ActorMethod<[], Array<[string, CustomDomain]>>;
|
|
174
|
+
list_docs: ActorMethod<[string, ListParams], ListResults_1>;
|
|
175
|
+
list_rules: ActorMethod<[RulesType], Array<[string, Rule]>>;
|
|
176
|
+
set_config: ActorMethod<[Config], undefined>;
|
|
177
|
+
set_controllers: ActorMethod<[SetControllersArgs], Array<[Principal, Controller]>>;
|
|
178
|
+
set_custom_domain: ActorMethod<[string, [] | [string]], undefined>;
|
|
179
|
+
set_doc: ActorMethod<[string, string, SetDoc], Doc>;
|
|
180
|
+
set_rule: ActorMethod<[RulesType, string, SetRule], undefined>;
|
|
181
|
+
upload_asset_chunk: ActorMethod<[Chunk], UploadChunk>;
|
|
182
|
+
version: ActorMethod<[], string>;
|
|
183
|
+
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
export const idlFactory = ({IDL}) => {
|
|
3
|
+
const CommitBatch = IDL.Record({
|
|
4
|
+
batch_id: IDL.Nat,
|
|
5
|
+
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
6
|
+
chunk_ids: IDL.Vec(IDL.Nat)
|
|
7
|
+
});
|
|
8
|
+
const DeleteControllersArgs = IDL.Record({
|
|
9
|
+
controllers: IDL.Vec(IDL.Principal)
|
|
10
|
+
});
|
|
11
|
+
const Controller = IDL.Record({
|
|
12
|
+
updated_at: IDL.Nat64,
|
|
13
|
+
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
14
|
+
created_at: IDL.Nat64,
|
|
15
|
+
expires_at: IDL.Opt(IDL.Nat64)
|
|
16
|
+
});
|
|
17
|
+
const DelDoc = IDL.Record({updated_at: IDL.Opt(IDL.Nat64)});
|
|
18
|
+
const StorageConfig = IDL.Record({
|
|
19
|
+
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))))
|
|
20
|
+
});
|
|
21
|
+
const Config = IDL.Record({storage: StorageConfig});
|
|
22
|
+
const Doc = IDL.Record({
|
|
23
|
+
updated_at: IDL.Nat64,
|
|
24
|
+
owner: IDL.Principal,
|
|
25
|
+
data: IDL.Vec(IDL.Nat8),
|
|
26
|
+
created_at: IDL.Nat64
|
|
27
|
+
});
|
|
28
|
+
const HttpRequest = IDL.Record({
|
|
29
|
+
url: IDL.Text,
|
|
30
|
+
method: IDL.Text,
|
|
31
|
+
body: IDL.Vec(IDL.Nat8),
|
|
32
|
+
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))
|
|
33
|
+
});
|
|
34
|
+
const StreamingCallbackToken = IDL.Record({
|
|
35
|
+
token: IDL.Opt(IDL.Text),
|
|
36
|
+
sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
37
|
+
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
38
|
+
index: IDL.Nat64,
|
|
39
|
+
encoding_type: IDL.Text,
|
|
40
|
+
full_path: IDL.Text
|
|
41
|
+
});
|
|
42
|
+
const StreamingStrategy = IDL.Variant({
|
|
43
|
+
Callback: IDL.Record({
|
|
44
|
+
token: StreamingCallbackToken,
|
|
45
|
+
callback: IDL.Func([], [], [])
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
const HttpResponse = IDL.Record({
|
|
49
|
+
body: IDL.Vec(IDL.Nat8),
|
|
50
|
+
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
51
|
+
streaming_strategy: IDL.Opt(StreamingStrategy),
|
|
52
|
+
status_code: IDL.Nat16
|
|
53
|
+
});
|
|
54
|
+
const StreamingCallbackHttpResponse = IDL.Record({
|
|
55
|
+
token: IDL.Opt(StreamingCallbackToken),
|
|
56
|
+
body: IDL.Vec(IDL.Nat8)
|
|
57
|
+
});
|
|
58
|
+
const InitAssetKey = IDL.Record({
|
|
59
|
+
token: IDL.Opt(IDL.Text),
|
|
60
|
+
collection: IDL.Text,
|
|
61
|
+
name: IDL.Text,
|
|
62
|
+
encoding_type: IDL.Opt(IDL.Text),
|
|
63
|
+
full_path: IDL.Text
|
|
64
|
+
});
|
|
65
|
+
const InitUploadResult = IDL.Record({batch_id: IDL.Nat});
|
|
66
|
+
const ListOrderField = IDL.Variant({
|
|
67
|
+
UpdatedAt: IDL.Null,
|
|
68
|
+
Keys: IDL.Null,
|
|
69
|
+
CreatedAt: IDL.Null
|
|
70
|
+
});
|
|
71
|
+
const ListOrder = IDL.Record({field: ListOrderField, desc: IDL.Bool});
|
|
72
|
+
const ListPaginate = IDL.Record({
|
|
73
|
+
start_after: IDL.Opt(IDL.Text),
|
|
74
|
+
limit: IDL.Opt(IDL.Nat64)
|
|
75
|
+
});
|
|
76
|
+
const ListParams = IDL.Record({
|
|
77
|
+
order: IDL.Opt(ListOrder),
|
|
78
|
+
owner: IDL.Opt(IDL.Principal),
|
|
79
|
+
matcher: IDL.Opt(IDL.Text),
|
|
80
|
+
paginate: IDL.Opt(ListPaginate)
|
|
81
|
+
});
|
|
82
|
+
const AssetKey = IDL.Record({
|
|
83
|
+
token: IDL.Opt(IDL.Text),
|
|
84
|
+
collection: IDL.Text,
|
|
85
|
+
owner: IDL.Principal,
|
|
86
|
+
name: IDL.Text,
|
|
87
|
+
full_path: IDL.Text
|
|
88
|
+
});
|
|
89
|
+
const AssetEncodingNoContent = IDL.Record({
|
|
90
|
+
modified: IDL.Nat64,
|
|
91
|
+
sha256: IDL.Vec(IDL.Nat8),
|
|
92
|
+
total_length: IDL.Nat
|
|
93
|
+
});
|
|
94
|
+
const AssetNoContent = IDL.Record({
|
|
95
|
+
key: AssetKey,
|
|
96
|
+
updated_at: IDL.Nat64,
|
|
97
|
+
encodings: IDL.Vec(IDL.Tuple(IDL.Text, AssetEncodingNoContent)),
|
|
98
|
+
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
99
|
+
created_at: IDL.Nat64
|
|
100
|
+
});
|
|
101
|
+
const ListResults = IDL.Record({
|
|
102
|
+
matches_length: IDL.Nat64,
|
|
103
|
+
length: IDL.Nat64,
|
|
104
|
+
items: IDL.Vec(IDL.Tuple(IDL.Text, AssetNoContent))
|
|
105
|
+
});
|
|
106
|
+
const CustomDomain = IDL.Record({
|
|
107
|
+
updated_at: IDL.Nat64,
|
|
108
|
+
created_at: IDL.Nat64,
|
|
109
|
+
bn_id: IDL.Opt(IDL.Text)
|
|
110
|
+
});
|
|
111
|
+
const ListResults_1 = IDL.Record({
|
|
112
|
+
matches_length: IDL.Nat64,
|
|
113
|
+
length: IDL.Nat64,
|
|
114
|
+
items: IDL.Vec(IDL.Tuple(IDL.Text, Doc))
|
|
115
|
+
});
|
|
116
|
+
const RulesType = IDL.Variant({Db: IDL.Null, Storage: IDL.Null});
|
|
117
|
+
const Permission = IDL.Variant({
|
|
118
|
+
Controllers: IDL.Null,
|
|
119
|
+
Private: IDL.Null,
|
|
120
|
+
Public: IDL.Null,
|
|
121
|
+
Managed: IDL.Null
|
|
122
|
+
});
|
|
123
|
+
const Rule = IDL.Record({
|
|
124
|
+
updated_at: IDL.Nat64,
|
|
125
|
+
max_size: IDL.Opt(IDL.Nat),
|
|
126
|
+
read: Permission,
|
|
127
|
+
created_at: IDL.Nat64,
|
|
128
|
+
write: Permission
|
|
129
|
+
});
|
|
130
|
+
const SetController = IDL.Record({
|
|
131
|
+
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
132
|
+
expires_at: IDL.Opt(IDL.Nat64)
|
|
133
|
+
});
|
|
134
|
+
const SetControllersArgs = IDL.Record({
|
|
135
|
+
controller: SetController,
|
|
136
|
+
controllers: IDL.Vec(IDL.Principal)
|
|
137
|
+
});
|
|
138
|
+
const SetDoc = IDL.Record({
|
|
139
|
+
updated_at: IDL.Opt(IDL.Nat64),
|
|
140
|
+
data: IDL.Vec(IDL.Nat8)
|
|
141
|
+
});
|
|
142
|
+
const SetRule = IDL.Record({
|
|
143
|
+
updated_at: IDL.Opt(IDL.Nat64),
|
|
144
|
+
max_size: IDL.Opt(IDL.Nat),
|
|
145
|
+
read: Permission,
|
|
146
|
+
write: Permission
|
|
147
|
+
});
|
|
148
|
+
const Chunk = IDL.Record({
|
|
149
|
+
content: IDL.Vec(IDL.Nat8),
|
|
150
|
+
batch_id: IDL.Nat
|
|
151
|
+
});
|
|
152
|
+
const UploadChunk = IDL.Record({chunk_id: IDL.Nat});
|
|
153
|
+
return IDL.Service({
|
|
154
|
+
commit_asset_upload: IDL.Func([CommitBatch], [], []),
|
|
155
|
+
del_asset: IDL.Func([IDL.Text, IDL.Text], [], []),
|
|
156
|
+
del_assets: IDL.Func([IDL.Opt(IDL.Text)], [], []),
|
|
157
|
+
del_controllers: IDL.Func(
|
|
158
|
+
[DeleteControllersArgs],
|
|
159
|
+
[IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
|
|
160
|
+
[]
|
|
161
|
+
),
|
|
162
|
+
del_custom_domain: IDL.Func([IDL.Text], [], []),
|
|
163
|
+
del_doc: IDL.Func([IDL.Text, IDL.Text, DelDoc], [], []),
|
|
164
|
+
get_config: IDL.Func([], [Config], []),
|
|
165
|
+
get_doc: IDL.Func([IDL.Text, IDL.Text], [IDL.Opt(Doc)], ['query']),
|
|
166
|
+
http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']),
|
|
167
|
+
http_request_streaming_callback: IDL.Func(
|
|
168
|
+
[StreamingCallbackToken],
|
|
169
|
+
[StreamingCallbackHttpResponse],
|
|
170
|
+
['query']
|
|
171
|
+
),
|
|
172
|
+
init_asset_upload: IDL.Func([InitAssetKey], [InitUploadResult], []),
|
|
173
|
+
list_assets: IDL.Func([IDL.Opt(IDL.Text), ListParams], [ListResults], ['query']),
|
|
174
|
+
list_controllers: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], ['query']),
|
|
175
|
+
list_custom_domains: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Text, CustomDomain))], ['query']),
|
|
176
|
+
list_docs: IDL.Func([IDL.Text, ListParams], [ListResults_1], ['query']),
|
|
177
|
+
list_rules: IDL.Func([RulesType], [IDL.Vec(IDL.Tuple(IDL.Text, Rule))], ['query']),
|
|
178
|
+
set_config: IDL.Func([Config], [], []),
|
|
179
|
+
set_controllers: IDL.Func(
|
|
180
|
+
[SetControllersArgs],
|
|
181
|
+
[IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
|
|
182
|
+
[]
|
|
183
|
+
),
|
|
184
|
+
set_custom_domain: IDL.Func([IDL.Text, IDL.Opt(IDL.Text)], [], []),
|
|
185
|
+
set_doc: IDL.Func([IDL.Text, IDL.Text, SetDoc], [Doc], []),
|
|
186
|
+
set_rule: IDL.Func([RulesType, IDL.Text, SetRule], [], []),
|
|
187
|
+
upload_asset_chunk: IDL.Func([Chunk], [UploadChunk], []),
|
|
188
|
+
version: IDL.Func([], [IDL.Text], ['query'])
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
// @ts-ignore
|
|
192
|
+
export const init = ({IDL}) => {
|
|
193
|
+
return [];
|
|
194
|
+
};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
export const idlFactory = ({IDL}) => {
|
|
2
|
+
const CommitBatch = IDL.Record({
|
|
3
|
+
batch_id: IDL.Nat,
|
|
4
|
+
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
5
|
+
chunk_ids: IDL.Vec(IDL.Nat)
|
|
6
|
+
});
|
|
7
|
+
const DeleteControllersArgs = IDL.Record({
|
|
8
|
+
controllers: IDL.Vec(IDL.Principal)
|
|
9
|
+
});
|
|
10
|
+
const Controller = IDL.Record({
|
|
11
|
+
updated_at: IDL.Nat64,
|
|
12
|
+
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
13
|
+
created_at: IDL.Nat64,
|
|
14
|
+
expires_at: IDL.Opt(IDL.Nat64)
|
|
15
|
+
});
|
|
16
|
+
const DelDoc = IDL.Record({updated_at: IDL.Opt(IDL.Nat64)});
|
|
17
|
+
const StorageConfig = IDL.Record({
|
|
18
|
+
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))))
|
|
19
|
+
});
|
|
20
|
+
const Config = IDL.Record({storage: StorageConfig});
|
|
21
|
+
const Doc = IDL.Record({
|
|
22
|
+
updated_at: IDL.Nat64,
|
|
23
|
+
owner: IDL.Principal,
|
|
24
|
+
data: IDL.Vec(IDL.Nat8),
|
|
25
|
+
created_at: IDL.Nat64
|
|
26
|
+
});
|
|
27
|
+
const HttpRequest = IDL.Record({
|
|
28
|
+
url: IDL.Text,
|
|
29
|
+
method: IDL.Text,
|
|
30
|
+
body: IDL.Vec(IDL.Nat8),
|
|
31
|
+
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))
|
|
32
|
+
});
|
|
33
|
+
const StreamingCallbackToken = IDL.Record({
|
|
34
|
+
token: IDL.Opt(IDL.Text),
|
|
35
|
+
sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
|
|
36
|
+
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
37
|
+
index: IDL.Nat64,
|
|
38
|
+
encoding_type: IDL.Text,
|
|
39
|
+
full_path: IDL.Text
|
|
40
|
+
});
|
|
41
|
+
const StreamingStrategy = IDL.Variant({
|
|
42
|
+
Callback: IDL.Record({
|
|
43
|
+
token: StreamingCallbackToken,
|
|
44
|
+
callback: IDL.Func([], [], [])
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
const HttpResponse = IDL.Record({
|
|
48
|
+
body: IDL.Vec(IDL.Nat8),
|
|
49
|
+
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
50
|
+
streaming_strategy: IDL.Opt(StreamingStrategy),
|
|
51
|
+
status_code: IDL.Nat16
|
|
52
|
+
});
|
|
53
|
+
const StreamingCallbackHttpResponse = IDL.Record({
|
|
54
|
+
token: IDL.Opt(StreamingCallbackToken),
|
|
55
|
+
body: IDL.Vec(IDL.Nat8)
|
|
56
|
+
});
|
|
57
|
+
const InitAssetKey = IDL.Record({
|
|
58
|
+
token: IDL.Opt(IDL.Text),
|
|
59
|
+
collection: IDL.Text,
|
|
60
|
+
name: IDL.Text,
|
|
61
|
+
encoding_type: IDL.Opt(IDL.Text),
|
|
62
|
+
full_path: IDL.Text
|
|
63
|
+
});
|
|
64
|
+
const InitUploadResult = IDL.Record({batch_id: IDL.Nat});
|
|
65
|
+
const ListOrderField = IDL.Variant({
|
|
66
|
+
UpdatedAt: IDL.Null,
|
|
67
|
+
Keys: IDL.Null,
|
|
68
|
+
CreatedAt: IDL.Null
|
|
69
|
+
});
|
|
70
|
+
const ListOrder = IDL.Record({field: ListOrderField, desc: IDL.Bool});
|
|
71
|
+
const ListPaginate = IDL.Record({
|
|
72
|
+
start_after: IDL.Opt(IDL.Text),
|
|
73
|
+
limit: IDL.Opt(IDL.Nat64)
|
|
74
|
+
});
|
|
75
|
+
const ListParams = IDL.Record({
|
|
76
|
+
order: IDL.Opt(ListOrder),
|
|
77
|
+
owner: IDL.Opt(IDL.Principal),
|
|
78
|
+
matcher: IDL.Opt(IDL.Text),
|
|
79
|
+
paginate: IDL.Opt(ListPaginate)
|
|
80
|
+
});
|
|
81
|
+
const AssetKey = IDL.Record({
|
|
82
|
+
token: IDL.Opt(IDL.Text),
|
|
83
|
+
collection: IDL.Text,
|
|
84
|
+
owner: IDL.Principal,
|
|
85
|
+
name: IDL.Text,
|
|
86
|
+
full_path: IDL.Text
|
|
87
|
+
});
|
|
88
|
+
const AssetEncodingNoContent = IDL.Record({
|
|
89
|
+
modified: IDL.Nat64,
|
|
90
|
+
sha256: IDL.Vec(IDL.Nat8),
|
|
91
|
+
total_length: IDL.Nat
|
|
92
|
+
});
|
|
93
|
+
const AssetNoContent = IDL.Record({
|
|
94
|
+
key: AssetKey,
|
|
95
|
+
updated_at: IDL.Nat64,
|
|
96
|
+
encodings: IDL.Vec(IDL.Tuple(IDL.Text, AssetEncodingNoContent)),
|
|
97
|
+
headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
98
|
+
created_at: IDL.Nat64
|
|
99
|
+
});
|
|
100
|
+
const ListResults = IDL.Record({
|
|
101
|
+
matches_length: IDL.Nat64,
|
|
102
|
+
length: IDL.Nat64,
|
|
103
|
+
items: IDL.Vec(IDL.Tuple(IDL.Text, AssetNoContent))
|
|
104
|
+
});
|
|
105
|
+
const CustomDomain = IDL.Record({
|
|
106
|
+
updated_at: IDL.Nat64,
|
|
107
|
+
created_at: IDL.Nat64,
|
|
108
|
+
bn_id: IDL.Opt(IDL.Text)
|
|
109
|
+
});
|
|
110
|
+
const ListResults_1 = IDL.Record({
|
|
111
|
+
matches_length: IDL.Nat64,
|
|
112
|
+
length: IDL.Nat64,
|
|
113
|
+
items: IDL.Vec(IDL.Tuple(IDL.Text, Doc))
|
|
114
|
+
});
|
|
115
|
+
const RulesType = IDL.Variant({Db: IDL.Null, Storage: IDL.Null});
|
|
116
|
+
const Permission = IDL.Variant({
|
|
117
|
+
Controllers: IDL.Null,
|
|
118
|
+
Private: IDL.Null,
|
|
119
|
+
Public: IDL.Null,
|
|
120
|
+
Managed: IDL.Null
|
|
121
|
+
});
|
|
122
|
+
const Rule = IDL.Record({
|
|
123
|
+
updated_at: IDL.Nat64,
|
|
124
|
+
max_size: IDL.Opt(IDL.Nat),
|
|
125
|
+
read: Permission,
|
|
126
|
+
created_at: IDL.Nat64,
|
|
127
|
+
write: Permission
|
|
128
|
+
});
|
|
129
|
+
const SetController = IDL.Record({
|
|
130
|
+
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
131
|
+
expires_at: IDL.Opt(IDL.Nat64)
|
|
132
|
+
});
|
|
133
|
+
const SetControllersArgs = IDL.Record({
|
|
134
|
+
controller: SetController,
|
|
135
|
+
controllers: IDL.Vec(IDL.Principal)
|
|
136
|
+
});
|
|
137
|
+
const SetDoc = IDL.Record({
|
|
138
|
+
updated_at: IDL.Opt(IDL.Nat64),
|
|
139
|
+
data: IDL.Vec(IDL.Nat8)
|
|
140
|
+
});
|
|
141
|
+
const SetRule = IDL.Record({
|
|
142
|
+
updated_at: IDL.Opt(IDL.Nat64),
|
|
143
|
+
max_size: IDL.Opt(IDL.Nat),
|
|
144
|
+
read: Permission,
|
|
145
|
+
write: Permission
|
|
146
|
+
});
|
|
147
|
+
const Chunk = IDL.Record({
|
|
148
|
+
content: IDL.Vec(IDL.Nat8),
|
|
149
|
+
batch_id: IDL.Nat
|
|
150
|
+
});
|
|
151
|
+
const UploadChunk = IDL.Record({chunk_id: IDL.Nat});
|
|
152
|
+
return IDL.Service({
|
|
153
|
+
commit_asset_upload: IDL.Func([CommitBatch], [], []),
|
|
154
|
+
del_asset: IDL.Func([IDL.Text, IDL.Text], [], []),
|
|
155
|
+
del_assets: IDL.Func([IDL.Opt(IDL.Text)], [], []),
|
|
156
|
+
del_controllers: IDL.Func(
|
|
157
|
+
[DeleteControllersArgs],
|
|
158
|
+
[IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
|
|
159
|
+
[]
|
|
160
|
+
),
|
|
161
|
+
del_custom_domain: IDL.Func([IDL.Text], [], []),
|
|
162
|
+
del_doc: IDL.Func([IDL.Text, IDL.Text, DelDoc], [], []),
|
|
163
|
+
get_config: IDL.Func([], [Config], []),
|
|
164
|
+
get_doc: IDL.Func([IDL.Text, IDL.Text], [IDL.Opt(Doc)], ['query']),
|
|
165
|
+
http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']),
|
|
166
|
+
http_request_streaming_callback: IDL.Func(
|
|
167
|
+
[StreamingCallbackToken],
|
|
168
|
+
[StreamingCallbackHttpResponse],
|
|
169
|
+
['query']
|
|
170
|
+
),
|
|
171
|
+
init_asset_upload: IDL.Func([InitAssetKey], [InitUploadResult], []),
|
|
172
|
+
list_assets: IDL.Func([IDL.Opt(IDL.Text), ListParams], [ListResults], ['query']),
|
|
173
|
+
list_controllers: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], ['query']),
|
|
174
|
+
list_custom_domains: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Text, CustomDomain))], ['query']),
|
|
175
|
+
list_docs: IDL.Func([IDL.Text, ListParams], [ListResults_1], ['query']),
|
|
176
|
+
list_rules: IDL.Func([RulesType], [IDL.Vec(IDL.Tuple(IDL.Text, Rule))], ['query']),
|
|
177
|
+
set_config: IDL.Func([Config], [], []),
|
|
178
|
+
set_controllers: IDL.Func(
|
|
179
|
+
[SetControllersArgs],
|
|
180
|
+
[IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
|
|
181
|
+
[]
|
|
182
|
+
),
|
|
183
|
+
set_custom_domain: IDL.Func([IDL.Text, IDL.Opt(IDL.Text)], [], []),
|
|
184
|
+
set_doc: IDL.Func([IDL.Text, IDL.Text, SetDoc], [Doc], []),
|
|
185
|
+
set_rule: IDL.Func([RulesType, IDL.Text, SetRule], [], []),
|
|
186
|
+
upload_asset_chunk: IDL.Func([Chunk], [UploadChunk], []),
|
|
187
|
+
version: IDL.Func([], [IDL.Text], ['query'])
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
export const init = ({IDL}) => {
|
|
191
|
+
return [];
|
|
192
|
+
};
|
package/dist/browser/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import{a as Mt,b as Qe,c as jt,d as f,e as Ht,f as y,g as Xe,h as W,i as b,j as
|
|
|
2
2
|
ic-request`);var rt=class{getPrincipal(){return f.anonymous()}async transformRequest(e){return Object.assign(Object.assign({},e),{body:{content:e.body}})}};var le=jt(Ze());var nt;(function(t){t.Call="call"})(nt||(nt={}));function G(){let t=new ArrayBuffer(16),e=new DataView(t),r=BigInt(+Date.now()),n=Math.floor(Math.random()*4294967295),o=Math.floor(Math.random()*4294967295);if(typeof e.setBigUint64=="function")e.setBigUint64(0,r);else{let i=BigInt(1)<<BigInt(32);e.setUint32(0,Number(r>>BigInt(32))),e.setUint32(4,Number(r%i))}return e.setUint32(8,n),e.setUint32(12,o),t}var Nr=BigInt(1e6),Pr=BigInt(60*1e3),O=class{constructor(e){this._value=(BigInt(Date.now())+BigInt(e)-Pr)*Nr}toCBOR(){return le.value.u64(this._value.toString(16),16)}toHash(){return Ht(this._value)}};function ue(t=G){return async e=>{let r=t(),n=e.request.headers?new Headers(e.request.headers):new Headers;e.request.headers=n,e.endpoint==="call"&&(e.body.nonce=t())}}var F;(function(t){t.Received="received",t.Processing="processing",t.Replied="replied",t.Rejected="rejected",t.Unknown="unknown",t.Done="done"})(F||(F={}));var ot=5*60*1e3,Er="308182301d060d2b0601040182dc7c0503010201060c2b0601040182dc7c05030201036100814c0e6ec71fab583b08bd81373c255c3c371b2e84863c98a4f1e08b74235d14fb5d9c0cd546d9685f913a0c0b2cc5341583bf4b4392e467db96d65b9bb4cb717112f8472e0d5a4d14505ffd7484b01291091c5f87b98883463f98091a0baaae",vr="ic0.app",Or=".ic0.app",Br="icp0.io",Vr=".icp0.io",Ur="icp-api.io",kr=".icp-api.io",Y=class extends W{constructor(e){super(e),this.message=e}},j=class extends W{constructor(e){super(e),this.message=e}};function qr(){let t;if(typeof window<"u")if(window.fetch)t=window.fetch.bind(window);else throw new Y("Fetch implementation was not available. You appear to be in a browser context, but window.fetch was not present.");else if(typeof window<"u")if(window.fetch)t=window.fetch.bind(window);else throw new Y("Fetch implementation was not available. You appear to be in a Node.js context, but global.fetch was not available.");else typeof self<"u"&&self.fetch&&(t=self.fetch.bind(self));if(t)return t;throw new Y("Fetch implementation was not available. Please provide fetch to the HttpAgent constructor, or ensure it is available in the window or global context.")}var B=class{constructor(e={}){if(this.rootKey=$t(Er),this._pipeline=[],this._timeDiffMsecs=0,this._rootKeyFetched=!1,this._retryTimes=3,this._isAgent=!0,e.source){if(!(e.source instanceof B))throw new Error("An Agent's source can only be another HttpAgent");this._pipeline=[...e.source._pipeline],this._identity=e.source._identity,this._fetch=e.source._fetch,this._host=e.source._host,this._credentials=e.source._credentials}else this._fetch=e.fetch||qr()||fetch.bind(window),this._fetchOptions=e.fetchOptions,this._callOptions=e.callOptions;if(e.host!==void 0)!e.host.match(/^[a-z]+:/)&&typeof window<"u"?this._host=new URL(window.location.protocol+"//"+e.host):this._host=new URL(e.host);else if(e.source!==void 0)this._host=e.source._host;else{let r=typeof window<"u"?window.location:void 0;if(!r)throw new Error("Must specify a host to connect to.");this._host=new URL(r+"")}if(e.retryTimes!==void 0&&(this._retryTimes=e.retryTimes),this._host.hostname.endsWith(Or)?this._host.hostname=vr:this._host.hostname.endsWith(Vr)?this._host.hostname=Br:this._host.hostname.endsWith(kr)&&(this._host.hostname=Ur),e.credentials){let{name:r,password:n}=e.credentials;this._credentials=`${r}${n?":"+n:""}`}this._identity=Promise.resolve(e.identity||new rt),e.disableNonce||this.addTransform(ue(G))}isLocal(){let e=this._host.hostname;return e==="127.0.0.1"||e.endsWith("localhost")}addTransform(e,r=e.priority||0){let n=this._pipeline.findIndex(o=>(o.priority||0)<r);this._pipeline.splice(n>=0?n:this._pipeline.length,0,Object.assign(e,{priority:r}))}async getPrincipal(){if(!this._identity)throw new j("This identity has expired due this application's security policy. Please refresh your authentication.");return(await this._identity).getPrincipal()}async call(e,r,n){let o=await(n!==void 0?await n:await this._identity);if(!o)throw new j("This identity has expired due this application's security policy. Please refresh your authentication.");let i=f.from(e),a=r.effectiveCanisterId?f.from(r.effectiveCanisterId):i,c=o.getPrincipal()||f.anonymous(),l=new O(ot);Math.abs(this._timeDiffMsecs)>1e3*30&&(l=new O(ot+this._timeDiffMsecs));let u={request_type:nt.Call,canister_id:i,method_name:r.methodName,arg:r.arg,sender:c,ingress_expiry:l},p=await this._transform({request:{body:null,method:"POST",headers:new Headers(Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{}))},endpoint:"call",body:u});p=await o.transformRequest(p);let d=Z(p.body),h=this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${a.toText()}/call`,this._host),Object.assign(Object.assign(Object.assign({},this._callOptions),p.request),{body:d}))),[m,x]=await Promise.all([h,wt(u)]);return{requestId:x,response:{ok:m.ok,status:m.status,statusText:m.statusText}}}async _requestAndRetry(e,r=0){if(r>this._retryTimes&&this._retryTimes!==0)throw new Error(`AgentError: Exceeded configured limit of ${this._retryTimes} retry attempts. Please check your network connection or try again in a few moments`);let n=await e();if(!n.ok){let o=await n.clone().text(),i=`Server returned an error:
|
|
3
3
|
Code: ${n.status} (${n.statusText})
|
|
4
4
|
Body: ${o}
|
|
5
|
-
`;if(this._retryTimes>r)return console.warn(i+" Retrying request."),await this._requestAndRetry(e,r+1);throw new Error(i)}return n}async query(e,r,n){let o=await(n!==void 0?await n:await this._identity);if(!o)throw new j("This identity has expired due this application's security policy. Please refresh your authentication.");let i=typeof e=="string"?f.fromText(e):e,a=o?.getPrincipal()||f.anonymous(),c={request_type:"query",canister_id:i,method_name:r.methodName,arg:r.arg,sender:a,ingress_expiry:new O(ot)},l=await this._transform({request:{method:"POST",headers:new Headers(Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{}))},endpoint:"read",body:c});l=await o?.transformRequest(l);let u=Z(l.body),p=await this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${i.toText()}/query`,this._host),Object.assign(Object.assign(Object.assign({},this._fetchOptions),l.request),{body:u})));return I(await p.arrayBuffer())}async createReadStateRequest(e,r){let n=await(r!==void 0?await r:await this._identity);if(!n)throw new j("This identity has expired due this application's security policy. Please refresh your authentication.");let o=n?.getPrincipal()||f.anonymous(),i=await this._transform({request:{method:"POST",headers:new Headers(Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{}))},endpoint:"read_state",body:{request_type:"read_state",paths:e.paths,sender:o,ingress_expiry:new O(ot)}});return n?.transformRequest(i)}async readState(e,r,n,o){let i=typeof e=="string"?f.fromText(e):e,a=o??await this.createReadStateRequest(r,n),c=Z(a.body),l=await this._fetch(""+new URL(`/api/v2/canister/${i}/read_state`,this._host),Object.assign(Object.assign(Object.assign({},this._fetchOptions),a.request),{body:c}));if(!l.ok)throw new Error(`Server returned an error:
|
|
5
|
+
`;if(this._retryTimes>r)return console.warn(i+" Retrying request."),await this._requestAndRetry(e,r+1);throw new Error(i)}return n}async query(e,r,n){let o=await(n!==void 0?await n:await this._identity);if(!o)throw new j("This identity has expired due this application's security policy. Please refresh your authentication.");let i=typeof e=="string"?f.fromText(e):e,a=o?.getPrincipal()||f.anonymous(),c={request_type:"query",canister_id:i,method_name:r.methodName,arg:r.arg,sender:a,ingress_expiry:new O(ot)},l=await this._transform({request:{method:"POST",headers:new Headers(Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{}))},endpoint:"read",body:c});l=await o?.transformRequest(l);let u=Z(l.body),p=await this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${i.toText()}/query`,this._host),Object.assign(Object.assign(Object.assign({},this._fetchOptions),l.request),{body:u})));return I(await p.arrayBuffer())}async createReadStateRequest(e,r){let n=await(r!==void 0?await r:await this._identity);if(!n)throw new j("This identity has expired due this application's security policy. Please refresh your authentication.");let o=n?.getPrincipal()||f.anonymous(),i=await this._transform({request:{method:"POST",headers:new Headers(Object.assign({"Content-Type":"application/cbor"},this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{}))},endpoint:"read_state",body:{request_type:"read_state",paths:e.paths,sender:o,ingress_expiry:new O(ot)}});return n?.transformRequest(i)}async readState(e,r,n,o){let i=typeof e=="string"?f.fromText(e):e,a=o??await this.createReadStateRequest(r,n),c=Z(a.body),l=await this._requestAndRetry(()=>this._fetch(""+new URL(`/api/v2/canister/${i}/read_state`,this._host),Object.assign(Object.assign(Object.assign({},this._fetchOptions),a.request),{body:c})));if(!l.ok)throw new Error(`Server returned an error:
|
|
6
6
|
Code: ${l.status} (${l.statusText})
|
|
7
7
|
Body: ${await l.text()}
|
|
8
8
|
`);return I(await l.arrayBuffer())}async syncTime(e){let r=await import("./canisterStatus-D52DQGXX.js"),n=Date.now();try{e||console.log("Syncing time with the IC. No canisterId provided, so falling back to ryjl3-tyaaa-aaaaa-aaaba-cai");let i=(await r.request({canisterId:e??f.from("ryjl3-tyaaa-aaaaa-aaaba-cai"),agent:this,paths:["time"]})).get("time");i&&(this._timeDiffMsecs=Number(i)-Number(n))}catch(o){console.error("Caught exception while attempting to sync time:",o)}}async status(){let e=this._credentials?{Authorization:"Basic "+btoa(this._credentials)}:{},r=await this._requestAndRetry(()=>this._fetch(""+new URL("/api/v2/status",this._host),Object.assign({headers:e},this._fetchOptions)));return I(await r.arrayBuffer())}async fetchRootKey(){return this._rootKeyFetched||(this.rootKey=(await this.status()).root_key,this._rootKeyFetched=!0),this.rootKey}invalidateIdentity(){this._identity=null}replaceIdentity(e){this._identity=Promise.resolve(e)}_transform(e){let r=Promise.resolve(e);for(let n of this._pipeline)r=r.then(o=>n(o).then(i=>i||o));return r}};var pe;(function(t){t.Error="err",t.GetPrincipal="gp",t.GetPrincipalResponse="gpr",t.Query="q",t.QueryResponse="qr",t.Call="c",t.CallResponse="cr",t.ReadState="rs",t.ReadStateResponse="rsr",t.Status="s",t.StatusResponse="sr"})(pe||(pe={}));function Pt(){let t=typeof window>"u"&&typeof window>"u"?typeof self>"u"?void 0:self.ic.agent:window.ic.agent;if(!t)throw new Error("No Agent could be found.");return t}var it={};Qe(it,{backoff:()=>ye,chain:()=>_e,conditionalDelay:()=>he,defaultStrategy:()=>de,maxAttempts:()=>jr,once:()=>fe,throttle:()=>Hr,timeout:()=>me});var Mr=5*60*1e3;function de(){return _e(he(fe(),1e3),ye(1e3,1.2),me(Mr))}function fe(){let t=!0;return async()=>t?(t=!1,!0):!1}function he(t,e){return async(r,n,o)=>{if(await t(r,n,o))return new Promise(i=>setTimeout(i,e))}}function jr(t){let e=t;return async(r,n,o)=>{if(--e<=0)throw new Error(`Failed to retrieve a reply for request after ${t} attempts:
|