@junobuild/analytics 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.
Files changed (82) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +17 -0
  3. package/declarations/cmc/cmc.did +122 -0
  4. package/declarations/cmc/cmc.did.d.ts +48 -0
  5. package/declarations/cmc/cmc.factory.did.js +67 -0
  6. package/declarations/cmc/index.d.ts +45 -0
  7. package/declarations/cmc/index.js +37 -0
  8. package/declarations/console/console.did.d.ts +71 -0
  9. package/declarations/console/console.factory.did.js +79 -0
  10. package/declarations/console/console.factory.did.mjs +79 -0
  11. package/declarations/console/index.d.ts +45 -0
  12. package/declarations/console/index.js +37 -0
  13. package/declarations/ic/ic.did +195 -0
  14. package/declarations/ic/ic.did.d.ts +208 -0
  15. package/declarations/ic/ic.factory.did.js +274 -0
  16. package/declarations/mission_control/index.d.ts +45 -0
  17. package/declarations/mission_control/index.js +38 -0
  18. package/declarations/mission_control/mission_control.did.d.ts +101 -0
  19. package/declarations/mission_control/mission_control.factory.did.js +136 -0
  20. package/declarations/observatory/index.d.ts +45 -0
  21. package/declarations/observatory/index.js +38 -0
  22. package/declarations/observatory/observatory.did.d.ts +86 -0
  23. package/declarations/observatory/observatory.factory.did.js +95 -0
  24. package/declarations/observatory/observatory.factory.did.mjs +95 -0
  25. package/declarations/orbiter/index.d.ts +45 -0
  26. package/declarations/orbiter/index.js +37 -0
  27. package/declarations/orbiter/orbiter.did.d.ts +103 -0
  28. package/declarations/orbiter/orbiter.factory.did.js +124 -0
  29. package/declarations/satellite/index.d.ts +45 -0
  30. package/declarations/satellite/index.js +37 -0
  31. package/declarations/satellite/satellite.did.d.ts +201 -0
  32. package/declarations/satellite/satellite.factory.did.js +215 -0
  33. package/declarations/satellite/satellite.factory.did.mjs +215 -0
  34. package/dist/browser/index.js +2 -0
  35. package/dist/browser/index.js.map +7 -0
  36. package/dist/declarations/cmc/cmc.did +122 -0
  37. package/dist/declarations/cmc/cmc.did.d.ts +48 -0
  38. package/dist/declarations/cmc/cmc.factory.did.js +67 -0
  39. package/dist/declarations/cmc/index.d.ts +45 -0
  40. package/dist/declarations/cmc/index.js +37 -0
  41. package/dist/declarations/console/console.did.d.ts +71 -0
  42. package/dist/declarations/console/console.factory.did.js +79 -0
  43. package/dist/declarations/console/console.factory.did.mjs +79 -0
  44. package/dist/declarations/console/index.d.ts +45 -0
  45. package/dist/declarations/console/index.js +37 -0
  46. package/dist/declarations/ic/ic.did +195 -0
  47. package/dist/declarations/ic/ic.did.d.ts +208 -0
  48. package/dist/declarations/ic/ic.factory.did.js +274 -0
  49. package/dist/declarations/mission_control/index.d.ts +45 -0
  50. package/dist/declarations/mission_control/index.js +38 -0
  51. package/dist/declarations/mission_control/mission_control.did.d.ts +101 -0
  52. package/dist/declarations/mission_control/mission_control.factory.did.js +136 -0
  53. package/dist/declarations/observatory/index.d.ts +45 -0
  54. package/dist/declarations/observatory/index.js +38 -0
  55. package/dist/declarations/observatory/observatory.did.d.ts +86 -0
  56. package/dist/declarations/observatory/observatory.factory.did.js +95 -0
  57. package/dist/declarations/observatory/observatory.factory.did.mjs +95 -0
  58. package/dist/declarations/orbiter/index.d.ts +45 -0
  59. package/dist/declarations/orbiter/index.js +37 -0
  60. package/dist/declarations/orbiter/orbiter.did.d.ts +103 -0
  61. package/dist/declarations/orbiter/orbiter.factory.did.js +124 -0
  62. package/dist/declarations/satellite/index.d.ts +45 -0
  63. package/dist/declarations/satellite/index.js +37 -0
  64. package/dist/declarations/satellite/satellite.did.d.ts +201 -0
  65. package/dist/declarations/satellite/satellite.factory.did.js +215 -0
  66. package/dist/declarations/satellite/satellite.factory.did.mjs +215 -0
  67. package/dist/index.js +1 -0
  68. package/dist/node/index.mjs +4 -0
  69. package/dist/node/index.mjs.map +7 -0
  70. package/dist/types/index.d.ts +5 -0
  71. package/dist/types/services/analytics.services.d.ts +10 -0
  72. package/dist/types/services/proxy.services.d.ts +4 -0
  73. package/dist/types/types/env.d.ts +15 -0
  74. package/dist/types/types/post-message.d.ts +11 -0
  75. package/dist/types/types/proxy.d.ts +11 -0
  76. package/dist/types/types/track.d.ts +4 -0
  77. package/dist/types/utils/date.utils.d.ts +1 -0
  78. package/dist/types/utils/json.utils.d.ts +8 -0
  79. package/dist/types/workers/analytics.worker.d.ts +1 -0
  80. package/dist/workers/analytics.worker.js +6 -0
  81. package/dist/workers/analytics.worker.js.map +7 -0
  82. package/package.json +49 -0
@@ -0,0 +1,124 @@
1
+ // @ts-ignore
2
+ export const idlFactory = ({IDL}) => {
3
+ const DeleteControllersArgs = IDL.Record({
4
+ controllers: IDL.Vec(IDL.Principal)
5
+ });
6
+ const ControllerScope = IDL.Variant({
7
+ Write: IDL.Null,
8
+ Admin: IDL.Null
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
+ scope: ControllerScope,
15
+ expires_at: IDL.Opt(IDL.Nat64)
16
+ });
17
+ const DelOriginConfig = IDL.Record({updated_at: IDL.Opt(IDL.Nat64)});
18
+ const GetAnalytics = IDL.Record({
19
+ to: IDL.Opt(IDL.Nat64),
20
+ from: IDL.Opt(IDL.Nat64),
21
+ satellite_id: IDL.Opt(IDL.Principal)
22
+ });
23
+ const AnalyticKey = IDL.Record({
24
+ key: IDL.Text,
25
+ session_id: IDL.Text,
26
+ satellite_id: IDL.Principal
27
+ });
28
+ const PageViewDevice = IDL.Record({
29
+ inner_height: IDL.Nat16,
30
+ inner_width: IDL.Nat16
31
+ });
32
+ const PageView = IDL.Record({
33
+ title: IDL.Text,
34
+ updated_at: IDL.Nat64,
35
+ referrer: IDL.Opt(IDL.Text),
36
+ time_zone: IDL.Text,
37
+ href: IDL.Text,
38
+ created_at: IDL.Nat64,
39
+ device: PageViewDevice,
40
+ user_agent: IDL.Opt(IDL.Text),
41
+ collected_at: IDL.Nat64
42
+ });
43
+ const TrackEvent = IDL.Record({
44
+ updated_at: IDL.Nat64,
45
+ metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
46
+ name: IDL.Text,
47
+ created_at: IDL.Nat64,
48
+ collected_at: IDL.Nat64
49
+ });
50
+ const OriginConfig = IDL.Record({
51
+ key: IDL.Principal,
52
+ updated_at: IDL.Nat64,
53
+ created_at: IDL.Nat64,
54
+ filter: IDL.Text
55
+ });
56
+ const SetController = IDL.Record({
57
+ metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
58
+ scope: ControllerScope,
59
+ expires_at: IDL.Opt(IDL.Nat64)
60
+ });
61
+ const SetControllersArgs = IDL.Record({
62
+ controller: SetController,
63
+ controllers: IDL.Vec(IDL.Principal)
64
+ });
65
+ const SetOriginConfig = IDL.Record({
66
+ key: IDL.Principal,
67
+ updated_at: IDL.Opt(IDL.Nat64),
68
+ filter: IDL.Text
69
+ });
70
+ const SetPageView = IDL.Record({
71
+ title: IDL.Text,
72
+ updated_at: IDL.Opt(IDL.Nat64),
73
+ referrer: IDL.Opt(IDL.Text),
74
+ time_zone: IDL.Text,
75
+ href: IDL.Text,
76
+ device: PageViewDevice,
77
+ user_agent: IDL.Opt(IDL.Text),
78
+ collected_at: IDL.Nat64
79
+ });
80
+ const Result = IDL.Variant({Ok: PageView, Err: IDL.Text});
81
+ const Result_1 = IDL.Variant({Ok: IDL.Null, Err: IDL.Text});
82
+ const SetTrackEvent = IDL.Record({
83
+ updated_at: IDL.Opt(IDL.Nat64),
84
+ metadata: IDL.Opt(IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))),
85
+ name: IDL.Text,
86
+ collected_at: IDL.Nat64
87
+ });
88
+ const Result_2 = IDL.Variant({Ok: TrackEvent, Err: IDL.Text});
89
+ return IDL.Service({
90
+ del_controllers: IDL.Func(
91
+ [DeleteControllersArgs],
92
+ [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
93
+ []
94
+ ),
95
+ del_origin_config: IDL.Func([IDL.Principal, DelOriginConfig], [], []),
96
+ get_page_views: IDL.Func(
97
+ [GetAnalytics],
98
+ [IDL.Vec(IDL.Tuple(AnalyticKey, PageView))],
99
+ ['query']
100
+ ),
101
+ get_track_events: IDL.Func(
102
+ [GetAnalytics],
103
+ [IDL.Vec(IDL.Tuple(AnalyticKey, TrackEvent))],
104
+ ['query']
105
+ ),
106
+ list_controllers: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], ['query']),
107
+ list_origin_configs: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, OriginConfig))], ['query']),
108
+ set_controllers: IDL.Func(
109
+ [SetControllersArgs],
110
+ [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
111
+ []
112
+ ),
113
+ set_origin_config: IDL.Func([IDL.Principal, SetOriginConfig], [OriginConfig], []),
114
+ set_page_view: IDL.Func([AnalyticKey, SetPageView], [Result], []),
115
+ set_page_views: IDL.Func([IDL.Vec(IDL.Tuple(AnalyticKey, SetPageView))], [Result_1], []),
116
+ set_track_event: IDL.Func([AnalyticKey, SetTrackEvent], [Result_2], []),
117
+ set_track_events: IDL.Func([IDL.Vec(IDL.Tuple(AnalyticKey, SetTrackEvent))], [Result_1], []),
118
+ version: IDL.Func([], [IDL.Text], ['query'])
119
+ });
120
+ };
121
+ // @ts-ignore
122
+ export const init = ({IDL}) => {
123
+ return [];
124
+ };
@@ -0,0 +1,45 @@
1
+ import type {ActorConfig, ActorSubclass, Agent, HttpAgentOptions} from '@dfinity/agent';
2
+ import type {IDL} from '@dfinity/candid';
3
+ import type {Principal} from '@dfinity/principal';
4
+
5
+ import {_SERVICE} from './satellite.did';
6
+
7
+ export declare const idlFactory: IDL.InterfaceFactory;
8
+ export declare const canisterId: string;
9
+
10
+ export declare interface CreateActorOptions {
11
+ /**
12
+ * @see {@link Agent}
13
+ */
14
+ agent?: Agent;
15
+ /**
16
+ * @see {@link HttpAgentOptions}
17
+ */
18
+ agentOptions?: HttpAgentOptions;
19
+ /**
20
+ * @see {@link ActorConfig}
21
+ */
22
+ actorOptions?: ActorConfig;
23
+ }
24
+
25
+ /**
26
+ * Intializes an {@link ActorSubclass}, configured with the provided SERVICE interface of a canister.
27
+ * @constructs {@link ActorSubClass}
28
+ * @param {string | Principal} canisterId - ID of the canister the {@link Actor} will talk to
29
+ * @param {CreateActorOptions} options - see {@link CreateActorOptions}
30
+ * @param {CreateActorOptions["agent"]} options.agent - a pre-configured agent you'd like to use. Supercedes agentOptions
31
+ * @param {CreateActorOptions["agentOptions"]} options.agentOptions - options to set up a new agent
32
+ * @see {@link HttpAgentOptions}
33
+ * @param {CreateActorOptions["actorOptions"]} options.actorOptions - options for the Actor
34
+ * @see {@link ActorConfig}
35
+ */
36
+ export declare const createActor: (
37
+ canisterId: string | Principal,
38
+ options?: CreateActorOptions
39
+ ) => ActorSubclass<_SERVICE>;
40
+
41
+ /**
42
+ * Intialized Actor using default settings, ready to talk to a canister using its candid interface
43
+ * @constructs {@link ActorSubClass}
44
+ */
45
+ export declare const satellite: ActorSubclass<_SERVICE>;
@@ -0,0 +1,37 @@
1
+ import {Actor, HttpAgent} from '@dfinity/agent';
2
+
3
+ // Imports and re-exports candid interface
4
+ import {idlFactory} from './satellite.did.js';
5
+ export {idlFactory} from './satellite.did.js';
6
+
7
+ /* CANISTER_ID is replaced by webpack based on node environment
8
+ * Note: canister environment variable will be standardized as
9
+ * process.env.CANISTER_ID_<CANISTER_NAME_UPPERCASE>
10
+ * beginning in dfx 0.15.0
11
+ */
12
+ export const canisterId = process.env.CANISTER_ID_SATELLITE || process.env.SATELLITE_CANISTER_ID;
13
+
14
+ export const createActor = (canisterId, options = {}) => {
15
+ const agent = options.agent || new HttpAgent({...options.agentOptions});
16
+
17
+ if (options.agent && options.agentOptions) {
18
+ console.warn(
19
+ 'Detected both agent and agentOptions passed to createActor. Ignoring agentOptions and proceeding with the provided agent.'
20
+ );
21
+ }
22
+
23
+ // Fetch root key for certificate validation during development
24
+ if (process.env.DFX_NETWORK !== 'ic') {
25
+ agent.fetchRootKey().catch((err) => {
26
+ console.warn('Unable to fetch root key. Check to ensure that your local replica is running');
27
+ console.error(err);
28
+ });
29
+ }
30
+
31
+ // Creates an actor with using the candid interface and the HttpAgent
32
+ return Actor.createActor(idlFactory, {
33
+ agent,
34
+ canisterId,
35
+ ...options.actorOptions
36
+ });
37
+ };
@@ -0,0 +1,201 @@
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
+ description: [] | [string];
15
+ full_path: string;
16
+ }
17
+ export interface AssetNoContent {
18
+ key: AssetKey;
19
+ updated_at: bigint;
20
+ encodings: Array<[string, AssetEncodingNoContent]>;
21
+ headers: Array<[string, string]>;
22
+ created_at: bigint;
23
+ }
24
+ export interface CommitBatch {
25
+ batch_id: bigint;
26
+ headers: Array<[string, string]>;
27
+ chunk_ids: Array<bigint>;
28
+ }
29
+ export interface Config {
30
+ storage: StorageConfig;
31
+ }
32
+ export interface Controller {
33
+ updated_at: bigint;
34
+ metadata: Array<[string, string]>;
35
+ created_at: bigint;
36
+ scope: ControllerScope;
37
+ expires_at: [] | [bigint];
38
+ }
39
+ export type ControllerScope = {Write: null} | {Admin: null};
40
+ export interface CustomDomain {
41
+ updated_at: bigint;
42
+ created_at: bigint;
43
+ bn_id: [] | [string];
44
+ }
45
+ export interface DelDoc {
46
+ updated_at: [] | [bigint];
47
+ }
48
+ export interface DeleteControllersArgs {
49
+ controllers: Array<Principal>;
50
+ }
51
+ export interface Doc {
52
+ updated_at: bigint;
53
+ owner: Principal;
54
+ data: Uint8Array | number[];
55
+ description: [] | [string];
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
+ description: [] | [string];
75
+ encoding_type: [] | [string];
76
+ full_path: string;
77
+ }
78
+ export interface InitUploadResult {
79
+ batch_id: bigint;
80
+ }
81
+ export interface ListMatcher {
82
+ key: [] | [string];
83
+ description: [] | [string];
84
+ }
85
+ export interface ListOrder {
86
+ field: ListOrderField;
87
+ desc: boolean;
88
+ }
89
+ export type ListOrderField = {UpdatedAt: null} | {Keys: null} | {CreatedAt: null};
90
+ export interface ListPaginate {
91
+ start_after: [] | [string];
92
+ limit: [] | [bigint];
93
+ }
94
+ export interface ListParams {
95
+ order: [] | [ListOrder];
96
+ owner: [] | [Principal];
97
+ matcher: [] | [ListMatcher];
98
+ paginate: [] | [ListPaginate];
99
+ }
100
+ export interface ListResults {
101
+ matches_pages: [] | [bigint];
102
+ matches_length: bigint;
103
+ items_page: [] | [bigint];
104
+ items: Array<[string, AssetNoContent]>;
105
+ items_length: bigint;
106
+ }
107
+ export interface ListResults_1 {
108
+ matches_pages: [] | [bigint];
109
+ matches_length: bigint;
110
+ items_page: [] | [bigint];
111
+ items: Array<[string, Doc]>;
112
+ items_length: bigint;
113
+ }
114
+ export type Permission = {Controllers: null} | {Private: null} | {Public: null} | {Managed: null};
115
+ export interface Rule {
116
+ updated_at: bigint;
117
+ max_size: [] | [bigint];
118
+ read: Permission;
119
+ created_at: bigint;
120
+ write: Permission;
121
+ }
122
+ export type RulesType = {Db: null} | {Storage: null};
123
+ export interface SetController {
124
+ metadata: Array<[string, string]>;
125
+ scope: ControllerScope;
126
+ expires_at: [] | [bigint];
127
+ }
128
+ export interface SetControllersArgs {
129
+ controller: SetController;
130
+ controllers: Array<Principal>;
131
+ }
132
+ export interface SetDoc {
133
+ updated_at: [] | [bigint];
134
+ data: Uint8Array | number[];
135
+ description: [] | [string];
136
+ }
137
+ export interface SetRule {
138
+ updated_at: [] | [bigint];
139
+ max_size: [] | [bigint];
140
+ read: Permission;
141
+ write: Permission;
142
+ }
143
+ export interface StorageConfig {
144
+ rewrites: Array<[string, string]>;
145
+ headers: Array<[string, Array<[string, string]>]>;
146
+ }
147
+ export interface StreamingCallbackHttpResponse {
148
+ token: [] | [StreamingCallbackToken];
149
+ body: Uint8Array | number[];
150
+ }
151
+ export interface StreamingCallbackToken {
152
+ token: [] | [string];
153
+ sha256: [] | [Uint8Array | number[]];
154
+ headers: Array<[string, string]>;
155
+ index: bigint;
156
+ encoding_type: string;
157
+ full_path: string;
158
+ }
159
+ export type StreamingStrategy = {
160
+ Callback: {
161
+ token: StreamingCallbackToken;
162
+ callback: [Principal, string];
163
+ };
164
+ };
165
+ export interface UploadChunk {
166
+ content: Uint8Array | number[];
167
+ batch_id: bigint;
168
+ order_id: [] | [bigint];
169
+ }
170
+ export interface UploadChunkResult {
171
+ chunk_id: bigint;
172
+ }
173
+ export interface _SERVICE {
174
+ commit_asset_upload: ActorMethod<[CommitBatch], undefined>;
175
+ del_asset: ActorMethod<[string, string], undefined>;
176
+ del_assets: ActorMethod<[string], undefined>;
177
+ del_controllers: ActorMethod<[DeleteControllersArgs], Array<[Principal, Controller]>>;
178
+ del_custom_domain: ActorMethod<[string], undefined>;
179
+ del_doc: ActorMethod<[string, string, DelDoc], undefined>;
180
+ del_rule: ActorMethod<[RulesType, string, DelDoc], undefined>;
181
+ get_config: ActorMethod<[], Config>;
182
+ get_doc: ActorMethod<[string, string], [] | [Doc]>;
183
+ http_request: ActorMethod<[HttpRequest], HttpResponse>;
184
+ http_request_streaming_callback: ActorMethod<
185
+ [StreamingCallbackToken],
186
+ StreamingCallbackHttpResponse
187
+ >;
188
+ init_asset_upload: ActorMethod<[InitAssetKey], InitUploadResult>;
189
+ list_assets: ActorMethod<[string, ListParams], ListResults>;
190
+ list_controllers: ActorMethod<[], Array<[Principal, Controller]>>;
191
+ list_custom_domains: ActorMethod<[], Array<[string, CustomDomain]>>;
192
+ list_docs: ActorMethod<[string, ListParams], ListResults_1>;
193
+ list_rules: ActorMethod<[RulesType], Array<[string, Rule]>>;
194
+ set_config: ActorMethod<[Config], undefined>;
195
+ set_controllers: ActorMethod<[SetControllersArgs], Array<[Principal, Controller]>>;
196
+ set_custom_domain: ActorMethod<[string, [] | [string]], undefined>;
197
+ set_doc: ActorMethod<[string, string, SetDoc], Doc>;
198
+ set_rule: ActorMethod<[RulesType, string, SetRule], undefined>;
199
+ upload_asset_chunk: ActorMethod<[UploadChunk], UploadChunkResult>;
200
+ version: ActorMethod<[], string>;
201
+ }
@@ -0,0 +1,215 @@
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 ControllerScope = IDL.Variant({
12
+ Write: IDL.Null,
13
+ Admin: IDL.Null
14
+ });
15
+ const Controller = IDL.Record({
16
+ updated_at: IDL.Nat64,
17
+ metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
18
+ created_at: IDL.Nat64,
19
+ scope: ControllerScope,
20
+ expires_at: IDL.Opt(IDL.Nat64)
21
+ });
22
+ const DelDoc = IDL.Record({updated_at: IDL.Opt(IDL.Nat64)});
23
+ const RulesType = IDL.Variant({Db: IDL.Null, Storage: IDL.Null});
24
+ const StorageConfig = IDL.Record({
25
+ rewrites: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
26
+ headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))))
27
+ });
28
+ const Config = IDL.Record({storage: StorageConfig});
29
+ const Doc = IDL.Record({
30
+ updated_at: IDL.Nat64,
31
+ owner: IDL.Principal,
32
+ data: IDL.Vec(IDL.Nat8),
33
+ description: IDL.Opt(IDL.Text),
34
+ created_at: IDL.Nat64
35
+ });
36
+ const HttpRequest = IDL.Record({
37
+ url: IDL.Text,
38
+ method: IDL.Text,
39
+ body: IDL.Vec(IDL.Nat8),
40
+ headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text))
41
+ });
42
+ const StreamingCallbackToken = IDL.Record({
43
+ token: IDL.Opt(IDL.Text),
44
+ sha256: IDL.Opt(IDL.Vec(IDL.Nat8)),
45
+ headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
46
+ index: IDL.Nat64,
47
+ encoding_type: IDL.Text,
48
+ full_path: IDL.Text
49
+ });
50
+ const StreamingStrategy = IDL.Variant({
51
+ Callback: IDL.Record({
52
+ token: StreamingCallbackToken,
53
+ callback: IDL.Func([], [], ['query'])
54
+ })
55
+ });
56
+ const HttpResponse = IDL.Record({
57
+ body: IDL.Vec(IDL.Nat8),
58
+ headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
59
+ streaming_strategy: IDL.Opt(StreamingStrategy),
60
+ status_code: IDL.Nat16
61
+ });
62
+ const StreamingCallbackHttpResponse = IDL.Record({
63
+ token: IDL.Opt(StreamingCallbackToken),
64
+ body: IDL.Vec(IDL.Nat8)
65
+ });
66
+ const InitAssetKey = IDL.Record({
67
+ token: IDL.Opt(IDL.Text),
68
+ collection: IDL.Text,
69
+ name: IDL.Text,
70
+ description: IDL.Opt(IDL.Text),
71
+ encoding_type: IDL.Opt(IDL.Text),
72
+ full_path: IDL.Text
73
+ });
74
+ const InitUploadResult = IDL.Record({batch_id: IDL.Nat});
75
+ const ListOrderField = IDL.Variant({
76
+ UpdatedAt: IDL.Null,
77
+ Keys: IDL.Null,
78
+ CreatedAt: IDL.Null
79
+ });
80
+ const ListOrder = IDL.Record({field: ListOrderField, desc: IDL.Bool});
81
+ const ListMatcher = IDL.Record({
82
+ key: IDL.Opt(IDL.Text),
83
+ description: IDL.Opt(IDL.Text)
84
+ });
85
+ const ListPaginate = IDL.Record({
86
+ start_after: IDL.Opt(IDL.Text),
87
+ limit: IDL.Opt(IDL.Nat64)
88
+ });
89
+ const ListParams = IDL.Record({
90
+ order: IDL.Opt(ListOrder),
91
+ owner: IDL.Opt(IDL.Principal),
92
+ matcher: IDL.Opt(ListMatcher),
93
+ paginate: IDL.Opt(ListPaginate)
94
+ });
95
+ const AssetKey = IDL.Record({
96
+ token: IDL.Opt(IDL.Text),
97
+ collection: IDL.Text,
98
+ owner: IDL.Principal,
99
+ name: IDL.Text,
100
+ description: IDL.Opt(IDL.Text),
101
+ full_path: IDL.Text
102
+ });
103
+ const AssetEncodingNoContent = IDL.Record({
104
+ modified: IDL.Nat64,
105
+ sha256: IDL.Vec(IDL.Nat8),
106
+ total_length: IDL.Nat
107
+ });
108
+ const AssetNoContent = IDL.Record({
109
+ key: AssetKey,
110
+ updated_at: IDL.Nat64,
111
+ encodings: IDL.Vec(IDL.Tuple(IDL.Text, AssetEncodingNoContent)),
112
+ headers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
113
+ created_at: IDL.Nat64
114
+ });
115
+ const ListResults = IDL.Record({
116
+ matches_pages: IDL.Opt(IDL.Nat64),
117
+ matches_length: IDL.Nat64,
118
+ items_page: IDL.Opt(IDL.Nat64),
119
+ items: IDL.Vec(IDL.Tuple(IDL.Text, AssetNoContent)),
120
+ items_length: IDL.Nat64
121
+ });
122
+ const CustomDomain = IDL.Record({
123
+ updated_at: IDL.Nat64,
124
+ created_at: IDL.Nat64,
125
+ bn_id: IDL.Opt(IDL.Text)
126
+ });
127
+ const ListResults_1 = IDL.Record({
128
+ matches_pages: IDL.Opt(IDL.Nat64),
129
+ matches_length: IDL.Nat64,
130
+ items_page: IDL.Opt(IDL.Nat64),
131
+ items: IDL.Vec(IDL.Tuple(IDL.Text, Doc)),
132
+ items_length: IDL.Nat64
133
+ });
134
+ const Permission = IDL.Variant({
135
+ Controllers: IDL.Null,
136
+ Private: IDL.Null,
137
+ Public: IDL.Null,
138
+ Managed: IDL.Null
139
+ });
140
+ const Rule = IDL.Record({
141
+ updated_at: IDL.Nat64,
142
+ max_size: IDL.Opt(IDL.Nat),
143
+ read: Permission,
144
+ created_at: IDL.Nat64,
145
+ write: Permission
146
+ });
147
+ const SetController = IDL.Record({
148
+ metadata: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Text)),
149
+ scope: ControllerScope,
150
+ expires_at: IDL.Opt(IDL.Nat64)
151
+ });
152
+ const SetControllersArgs = IDL.Record({
153
+ controller: SetController,
154
+ controllers: IDL.Vec(IDL.Principal)
155
+ });
156
+ const SetDoc = IDL.Record({
157
+ updated_at: IDL.Opt(IDL.Nat64),
158
+ data: IDL.Vec(IDL.Nat8),
159
+ description: IDL.Opt(IDL.Text)
160
+ });
161
+ const SetRule = IDL.Record({
162
+ updated_at: IDL.Opt(IDL.Nat64),
163
+ max_size: IDL.Opt(IDL.Nat),
164
+ read: Permission,
165
+ write: Permission
166
+ });
167
+ const UploadChunk = IDL.Record({
168
+ content: IDL.Vec(IDL.Nat8),
169
+ batch_id: IDL.Nat,
170
+ order_id: IDL.Opt(IDL.Nat)
171
+ });
172
+ const UploadChunkResult = IDL.Record({chunk_id: IDL.Nat});
173
+ return IDL.Service({
174
+ commit_asset_upload: IDL.Func([CommitBatch], [], []),
175
+ del_asset: IDL.Func([IDL.Text, IDL.Text], [], []),
176
+ del_assets: IDL.Func([IDL.Text], [], []),
177
+ del_controllers: IDL.Func(
178
+ [DeleteControllersArgs],
179
+ [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
180
+ []
181
+ ),
182
+ del_custom_domain: IDL.Func([IDL.Text], [], []),
183
+ del_doc: IDL.Func([IDL.Text, IDL.Text, DelDoc], [], []),
184
+ del_rule: IDL.Func([RulesType, IDL.Text, DelDoc], [], []),
185
+ get_config: IDL.Func([], [Config], []),
186
+ get_doc: IDL.Func([IDL.Text, IDL.Text], [IDL.Opt(Doc)], ['query']),
187
+ http_request: IDL.Func([HttpRequest], [HttpResponse], ['query']),
188
+ http_request_streaming_callback: IDL.Func(
189
+ [StreamingCallbackToken],
190
+ [StreamingCallbackHttpResponse],
191
+ ['query']
192
+ ),
193
+ init_asset_upload: IDL.Func([InitAssetKey], [InitUploadResult], []),
194
+ list_assets: IDL.Func([IDL.Text, ListParams], [ListResults], ['query']),
195
+ list_controllers: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))], ['query']),
196
+ list_custom_domains: IDL.Func([], [IDL.Vec(IDL.Tuple(IDL.Text, CustomDomain))], ['query']),
197
+ list_docs: IDL.Func([IDL.Text, ListParams], [ListResults_1], ['query']),
198
+ list_rules: IDL.Func([RulesType], [IDL.Vec(IDL.Tuple(IDL.Text, Rule))], ['query']),
199
+ set_config: IDL.Func([Config], [], []),
200
+ set_controllers: IDL.Func(
201
+ [SetControllersArgs],
202
+ [IDL.Vec(IDL.Tuple(IDL.Principal, Controller))],
203
+ []
204
+ ),
205
+ set_custom_domain: IDL.Func([IDL.Text, IDL.Opt(IDL.Text)], [], []),
206
+ set_doc: IDL.Func([IDL.Text, IDL.Text, SetDoc], [Doc], []),
207
+ set_rule: IDL.Func([RulesType, IDL.Text, SetRule], [], []),
208
+ upload_asset_chunk: IDL.Func([UploadChunk], [UploadChunkResult], []),
209
+ version: IDL.Func([], [IDL.Text], ['query'])
210
+ });
211
+ };
212
+ // @ts-ignore
213
+ export const init = ({IDL}) => {
214
+ return [];
215
+ };