@junobuild/core-peer 0.0.1
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/LICENSE +21 -0
- package/README.md +25 -0
- package/declarations/deprecated/mission_control-0-0-4.did.d.ts +80 -0
- package/declarations/deprecated/mission_control-0-0-4.factory.did.js +99 -0
- package/declarations/deprecated/satellite-0-0-8.did.d.ts +183 -0
- package/declarations/deprecated/satellite-0-0-8.factory.did.js +194 -0
- package/declarations/deprecated/satellite-0-0-9.did.d.ts +199 -0
- package/declarations/deprecated/satellite-0-0-9.factory.did.js +213 -0
- package/declarations/satellite/index.d.ts +45 -0
- package/declarations/satellite/index.js +37 -0
- package/declarations/satellite/satellite.did.d.ts +207 -0
- package/declarations/satellite/satellite.factory.did.js +221 -0
- package/declarations/satellite/satellite.factory.did.mjs +221 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/index.js.map +7 -0
- package/dist/declarations/deprecated/mission_control-0-0-4.did.d.ts +80 -0
- package/dist/declarations/deprecated/mission_control-0-0-4.factory.did.js +99 -0
- package/dist/declarations/deprecated/satellite-0-0-8.did.d.ts +183 -0
- package/dist/declarations/deprecated/satellite-0-0-8.factory.did.js +194 -0
- package/dist/declarations/deprecated/satellite-0-0-9.did.d.ts +199 -0
- package/dist/declarations/deprecated/satellite-0-0-9.factory.did.js +213 -0
- package/dist/declarations/satellite/index.d.ts +45 -0
- package/dist/declarations/satellite/index.js +37 -0
- package/dist/declarations/satellite/satellite.did.d.ts +207 -0
- package/dist/declarations/satellite/satellite.factory.did.js +221 -0
- package/dist/declarations/satellite/satellite.factory.did.mjs +221 -0
- package/dist/index.js +1 -0
- package/dist/node/index.mjs +4 -0
- package/dist/node/index.mjs.map +7 -0
- package/dist/types/api/actor.api.d.ts +3 -0
- package/dist/types/api/doc.api.d.ts +22 -0
- package/dist/types/api/storage.api.d.ts +20 -0
- package/dist/types/constants/auth.constants.d.ts +11 -0
- package/dist/types/index.d.ts +16 -0
- package/dist/types/providers/auth.providers.d.ts +31 -0
- package/dist/types/services/auth-timout.services.d.ts +3 -0
- package/dist/types/services/auth.services.d.ts +11 -0
- package/dist/types/services/doc.services.d.ts +22 -0
- package/dist/types/services/identity.services.d.ts +2 -0
- package/dist/types/services/storage.services.d.ts +24 -0
- package/dist/types/services/user.services.d.ts +2 -0
- package/dist/types/stores/auth.store.d.ts +13 -0
- package/dist/types/stores/env.store.d.ts +12 -0
- package/dist/types/stores/store.d.ts +5 -0
- package/dist/types/types/auth.types.d.ts +13 -0
- package/dist/types/types/doc.types.d.ts +8 -0
- package/dist/types/types/env.types.d.ts +10 -0
- package/dist/types/types/list.types.d.ts +28 -0
- package/dist/types/types/post-message.d.ts +5 -0
- package/dist/types/types/satellite.types.d.ts +8 -0
- package/dist/types/types/storage.types.d.ts +35 -0
- package/dist/types/types/subscription.types.d.ts +1 -0
- package/dist/types/utils/actor.utils.d.ts +6 -0
- package/dist/types/utils/auth.utils.d.ts +2 -0
- package/dist/types/utils/crypto.utils.d.ts +1 -0
- package/dist/types/utils/data.utils.d.ts +2 -0
- package/dist/types/utils/env.utils.d.ts +1 -0
- package/dist/types/utils/events.utils.d.ts +4 -0
- package/dist/types/utils/list.utils.d.ts +3 -0
- package/dist/types/utils/storage.utils.d.ts +1 -0
- package/dist/types/utils/window.utils.d.ts +4 -0
- package/dist/types/workers/auth.worker.d.ts +6 -0
- package/dist/workers/auth.worker.js +25 -0
- package/dist/workers/auth.worker.js.gz +0 -0
- package/dist/workers/auth.worker.js.map +7 -0
- package/package.json +66 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 David Dal Busco
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[![npm][npm-badge]][npm-badge-url]
|
|
2
|
+
[![license][npm-license]][npm-license-url]
|
|
3
|
+
|
|
4
|
+
[npm-badge]: https://img.shields.io/npm/v/@junobuild/core-peer
|
|
5
|
+
[npm-badge-url]: https://www.npmjs.com/package/@junobuild/core-peer
|
|
6
|
+
[npm-license]: https://img.shields.io/npm/l/@junobuild/core-peer
|
|
7
|
+
[npm-license-url]: https://github.com/junobuild/juno-js/blob/main/LICENSE
|
|
8
|
+
|
|
9
|
+
# Juno JavaScript core SDK
|
|
10
|
+
|
|
11
|
+
JavaScript [core](../core/README.md) client for Juno minus DFINITY agent-js dependencies.
|
|
12
|
+
|
|
13
|
+
## Context
|
|
14
|
+
|
|
15
|
+
There might be a use case in which you are using the Juno core library in an application where you are already utilizing DFINITY's [agent-js](https://github.com/dfinity/agent-js/).
|
|
16
|
+
|
|
17
|
+
You might also be building your app with a framework such as Next.js, which can lead to issues when interpreting agent-js provided through our libraries.
|
|
18
|
+
|
|
19
|
+
For such use cases, you can use this specific library, which sets the DFINITY libraries as peer dependencies. This way, those dependencies will be packaged on your side.
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
MIT © [David Dal Busco](mailto:david.dalbusco@outlook.com)
|
|
24
|
+
|
|
25
|
+
[juno]: https://juno.build
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type {ActorMethod} from '@dfinity/agent';
|
|
2
|
+
import type {Principal} from '@dfinity/principal';
|
|
3
|
+
|
|
4
|
+
export interface CanisterStatusResponse {
|
|
5
|
+
status: CanisterStatusType;
|
|
6
|
+
memory_size: bigint;
|
|
7
|
+
cycles: bigint;
|
|
8
|
+
settings: DefiniteCanisterSettings;
|
|
9
|
+
idle_cycles_burned_per_day: bigint;
|
|
10
|
+
module_hash: [] | [Uint8Array | number[]];
|
|
11
|
+
}
|
|
12
|
+
export type CanisterStatusType = {stopped: null} | {stopping: null} | {running: null};
|
|
13
|
+
export interface Controller {
|
|
14
|
+
updated_at: bigint;
|
|
15
|
+
metadata: Array<[string, string]>;
|
|
16
|
+
created_at: bigint;
|
|
17
|
+
expires_at: [] | [bigint];
|
|
18
|
+
}
|
|
19
|
+
export interface CronJobStatusesSatelliteConfig {
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
cycles_threshold: [] | [bigint];
|
|
22
|
+
}
|
|
23
|
+
export interface DefiniteCanisterSettings {
|
|
24
|
+
freezing_threshold: bigint;
|
|
25
|
+
controllers: Array<Principal>;
|
|
26
|
+
memory_allocation: bigint;
|
|
27
|
+
compute_allocation: bigint;
|
|
28
|
+
}
|
|
29
|
+
export type Result = {Ok: SegmentStatus} | {Err: string};
|
|
30
|
+
export interface Satellite {
|
|
31
|
+
updated_at: bigint;
|
|
32
|
+
metadata: Array<[string, string]>;
|
|
33
|
+
created_at: bigint;
|
|
34
|
+
satellite_id: Principal;
|
|
35
|
+
}
|
|
36
|
+
export interface SegmentStatus {
|
|
37
|
+
id: Principal;
|
|
38
|
+
status: CanisterStatusResponse;
|
|
39
|
+
metadata: [] | [Array<[string, string]>];
|
|
40
|
+
status_at: bigint;
|
|
41
|
+
}
|
|
42
|
+
export interface SegmentsStatuses {
|
|
43
|
+
satellites: [] | [Array<Result>];
|
|
44
|
+
mission_control: Result;
|
|
45
|
+
}
|
|
46
|
+
export interface SetController {
|
|
47
|
+
metadata: Array<[string, string]>;
|
|
48
|
+
expires_at: [] | [bigint];
|
|
49
|
+
}
|
|
50
|
+
export interface StatusesArgs {
|
|
51
|
+
mission_control_cycles_threshold: [] | [bigint];
|
|
52
|
+
satellites: Array<[Principal, CronJobStatusesSatelliteConfig]>;
|
|
53
|
+
cycles_threshold: [] | [bigint];
|
|
54
|
+
}
|
|
55
|
+
export interface Tokens {
|
|
56
|
+
e8s: bigint;
|
|
57
|
+
}
|
|
58
|
+
export interface _SERVICE {
|
|
59
|
+
add_mission_control_controllers: ActorMethod<[Array<Principal>], undefined>;
|
|
60
|
+
add_satellites_controllers: ActorMethod<[Array<Principal>, Array<Principal>], undefined>;
|
|
61
|
+
create_satellite: ActorMethod<[string], Satellite>;
|
|
62
|
+
del_mission_control_controllers: ActorMethod<[Array<Principal>], undefined>;
|
|
63
|
+
del_satellites_controllers: ActorMethod<[Array<Principal>, Array<Principal>], undefined>;
|
|
64
|
+
get_user: ActorMethod<[], Principal>;
|
|
65
|
+
list_mission_control_controllers: ActorMethod<[], Array<[Principal, Controller]>>;
|
|
66
|
+
list_mission_control_statuses: ActorMethod<[], Array<[bigint, Result]>>;
|
|
67
|
+
list_satellite_statuses: ActorMethod<[Principal], [] | [Array<[bigint, Result]>]>;
|
|
68
|
+
list_satellites: ActorMethod<[], Array<[Principal, Satellite]>>;
|
|
69
|
+
remove_mission_control_controllers: ActorMethod<[Array<Principal>], undefined>;
|
|
70
|
+
remove_satellites_controllers: ActorMethod<[Array<Principal>, Array<Principal>], undefined>;
|
|
71
|
+
set_metadata: ActorMethod<[Array<[string, string]>], undefined>;
|
|
72
|
+
set_mission_control_controllers: ActorMethod<[Array<Principal>, SetController], undefined>;
|
|
73
|
+
set_satellites_controllers: ActorMethod<
|
|
74
|
+
[Array<Principal>, Array<Principal>, SetController],
|
|
75
|
+
undefined
|
|
76
|
+
>;
|
|
77
|
+
status: ActorMethod<[StatusesArgs], SegmentsStatuses>;
|
|
78
|
+
top_up: ActorMethod<[Principal, Tokens], undefined>;
|
|
79
|
+
version: ActorMethod<[], string>;
|
|
80
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// @ts-ignore
|
|
2
|
+
export const idlFactory = ({IDL}) => {
|
|
3
|
+
const Satellite = IDL.Record({
|
|
4
|
+
updated_at: IDL.Nat64,
|
|
5
|
+
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
6
|
+
created_at: IDL.Nat64,
|
|
7
|
+
satellite_id: IDL.Principal
|
|
8
|
+
});
|
|
9
|
+
const Controller = IDL.Record({
|
|
10
|
+
updated_at: IDL.Nat64,
|
|
11
|
+
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
12
|
+
created_at: IDL.Nat64,
|
|
13
|
+
expires_at: IDL.Opt(IDL.Nat64)
|
|
14
|
+
});
|
|
15
|
+
const CanisterStatusType = IDL.Variant({
|
|
16
|
+
stopped: IDL.Null,
|
|
17
|
+
stopping: IDL.Null,
|
|
18
|
+
running: IDL.Null
|
|
19
|
+
});
|
|
20
|
+
const DefiniteCanisterSettings = IDL.Record({
|
|
21
|
+
freezing_threshold: IDL.Nat,
|
|
22
|
+
controllers: IDL.Vec(IDL.Principal),
|
|
23
|
+
memory_allocation: IDL.Nat,
|
|
24
|
+
compute_allocation: IDL.Nat
|
|
25
|
+
});
|
|
26
|
+
const CanisterStatusResponse = IDL.Record({
|
|
27
|
+
status: CanisterStatusType,
|
|
28
|
+
memory_size: IDL.Nat,
|
|
29
|
+
cycles: IDL.Nat,
|
|
30
|
+
settings: DefiniteCanisterSettings,
|
|
31
|
+
idle_cycles_burned_per_day: IDL.Nat,
|
|
32
|
+
module_hash: IDL.Opt(IDL.Vec(IDL.Nat8))
|
|
33
|
+
});
|
|
34
|
+
const SegmentStatus = IDL.Record({
|
|
35
|
+
id: IDL.Principal,
|
|
36
|
+
status: CanisterStatusResponse,
|
|
37
|
+
metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
|
|
38
|
+
status_at: IDL.Nat64
|
|
39
|
+
});
|
|
40
|
+
const Result = IDL.Variant({Ok: SegmentStatus, Err: IDL.Text});
|
|
41
|
+
const SetController = IDL.Record({
|
|
42
|
+
metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
|
|
43
|
+
expires_at: IDL.Opt(IDL.Nat64)
|
|
44
|
+
});
|
|
45
|
+
const CronJobStatusesSatelliteConfig = IDL.Record({
|
|
46
|
+
enabled: IDL.Bool,
|
|
47
|
+
cycles_threshold: IDL.Opt(IDL.Nat64)
|
|
48
|
+
});
|
|
49
|
+
const StatusesArgs = IDL.Record({
|
|
50
|
+
mission_control_cycles_threshold: IDL.Opt(IDL.Nat64),
|
|
51
|
+
satellites: IDL.Vec(IDL.Tuple(IDL.Principal, CronJobStatusesSatelliteConfig)),
|
|
52
|
+
cycles_threshold: IDL.Opt(IDL.Nat64)
|
|
53
|
+
});
|
|
54
|
+
const SegmentsStatuses = IDL.Record({
|
|
55
|
+
satellites: IDL.Opt(IDL.Vec(Result)),
|
|
56
|
+
mission_control: Result
|
|
57
|
+
});
|
|
58
|
+
const Tokens = IDL.Record({e8s: IDL.Nat64});
|
|
59
|
+
return IDL.Service({
|
|
60
|
+
add_mission_control_controllers: IDL.Func([IDL.Vec(IDL.Principal)], [], []),
|
|
61
|
+
add_satellites_controllers: IDL.Func([IDL.Vec(IDL.Principal), IDL.Vec(IDL.Principal)], [], []),
|
|
62
|
+
create_satellite: IDL.Func([IDL.Text], [Satellite], []),
|
|
63
|
+
del_mission_control_controllers: IDL.Func([IDL.Vec(IDL.Principal)], [], []),
|
|
64
|
+
del_satellites_controllers: IDL.Func([IDL.Vec(IDL.Principal), IDL.Vec(IDL.Principal)], [], []),
|
|
65
|
+
get_user: IDL.Func([], [IDL.Principal], ['query']),
|
|
66
|
+
list_mission_control_controllers: IDL.Func(
|
|
67
|
+
[],
|
|
68
|
+
[IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
|
|
69
|
+
['query']
|
|
70
|
+
),
|
|
71
|
+
list_mission_control_statuses: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Nat64, Result))], ['query']),
|
|
72
|
+
list_satellite_statuses: IDL.Func(
|
|
73
|
+
[IDL.Principal],
|
|
74
|
+
[IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Nat64, Result)))],
|
|
75
|
+
['query']
|
|
76
|
+
),
|
|
77
|
+
list_satellites: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, Satellite))], ['query']),
|
|
78
|
+
remove_mission_control_controllers: IDL.Func([IDL.Vec(IDL.Principal)], [], []),
|
|
79
|
+
remove_satellites_controllers: IDL.Func(
|
|
80
|
+
[IDL.Vec(IDL.Principal), IDL.Vec(IDL.Principal)],
|
|
81
|
+
[],
|
|
82
|
+
[]
|
|
83
|
+
),
|
|
84
|
+
set_metadata: IDL.Func([IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))], [], []),
|
|
85
|
+
set_mission_control_controllers: IDL.Func([IDL.Vec(IDL.Principal), SetController], [], []),
|
|
86
|
+
set_satellites_controllers: IDL.Func(
|
|
87
|
+
[IDL.Vec(IDL.Principal), IDL.Vec(IDL.Principal), SetController],
|
|
88
|
+
[],
|
|
89
|
+
[]
|
|
90
|
+
),
|
|
91
|
+
status: IDL.Func([StatusesArgs], [SegmentsStatuses], []),
|
|
92
|
+
top_up: IDL.Func([IDL.Principal, Tokens], [], []),
|
|
93
|
+
version: IDL.Func([], [IDL.Text], ['query'])
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
// @ts-ignore
|
|
97
|
+
export const init = ({IDL}) => {
|
|
98
|
+
return [];
|
|
99
|
+
};
|
|
@@ -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
|
+
};
|