@junobuild/core-peer 1.0.3 → 1.1.0

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 (53) hide show
  1. package/dist/browser/index.js +1 -1
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/node/index.mjs +1 -1
  4. package/dist/node/index.mjs.map +4 -4
  5. package/dist/types/api/actor.api.d.ts +1 -1
  6. package/dist/types/api/storage.api.d.ts +4 -4
  7. package/dist/types/services/storage.services.d.ts +3 -3
  8. package/dist/types/stores/actor.store.d.ts +1 -2
  9. package/dist/types/types/storage.types.d.ts +2 -2
  10. package/dist/types/utils/data.utils.d.ts +2 -2
  11. package/dist/types/utils/doc.utils.d.ts +4 -4
  12. package/dist/types/utils/list.utils.d.ts +2 -2
  13. package/package.json +6 -5
  14. package/dist/declarations/deprecated/console-0-0-14.did.d.ts +0 -267
  15. package/dist/declarations/deprecated/console-0-0-14.factory.did.js +0 -285
  16. package/dist/declarations/deprecated/console-0-0-8-patch1.did.d.ts +0 -75
  17. package/dist/declarations/deprecated/console-0-0-8-patch1.factory.did.js +0 -80
  18. package/dist/declarations/deprecated/mission_control-0-0-13.did.d.ts +0 -246
  19. package/dist/declarations/deprecated/mission_control-0-0-13.factory.did.js +0 -280
  20. package/dist/declarations/deprecated/mission_control-0-0-14.did.d.ts +0 -241
  21. package/dist/declarations/deprecated/mission_control-0-0-14.factory.did.js +0 -258
  22. package/dist/declarations/deprecated/mission_control-0-0-4.did.d.ts +0 -80
  23. package/dist/declarations/deprecated/mission_control-0-0-4.factory.did.js +0 -99
  24. package/dist/declarations/deprecated/observatory-0-0-9.did.d.ts +0 -70
  25. package/dist/declarations/deprecated/observatory-0-0-9.factory.did.js +0 -76
  26. package/dist/declarations/deprecated/orbiter-0-0-6.did.d.ts +0 -161
  27. package/dist/declarations/deprecated/orbiter-0-0-6.factory.did.js +0 -192
  28. package/dist/declarations/deprecated/orbiter-0-0-7.did.d.ts +0 -166
  29. package/dist/declarations/deprecated/orbiter-0-0-7.factory.did.js +0 -197
  30. package/dist/declarations/deprecated/orbiter-0-0-8.did.d.ts +0 -245
  31. package/dist/declarations/deprecated/orbiter-0-0-8.factory.did.js +0 -287
  32. package/dist/declarations/deprecated/orbiter-0-2-0.did.d.ts +0 -277
  33. package/dist/declarations/deprecated/orbiter-0-2-0.factory.did.js +0 -319
  34. package/dist/declarations/deprecated/satellite-0-0-16.did.d.ts +0 -240
  35. package/dist/declarations/deprecated/satellite-0-0-16.factory.did.js +0 -264
  36. package/dist/declarations/deprecated/satellite-0-0-17.did.d.ts +0 -254
  37. package/dist/declarations/deprecated/satellite-0-0-17.factory.did.js +0 -281
  38. package/dist/declarations/deprecated/satellite-0-0-21.did.d.ts +0 -299
  39. package/dist/declarations/deprecated/satellite-0-0-21.factory.did.js +0 -333
  40. package/dist/declarations/deprecated/satellite-0-0-22.did.d.ts +0 -290
  41. package/dist/declarations/deprecated/satellite-0-0-22.factory.did.js +0 -318
  42. package/dist/declarations/deprecated/satellite-0-0-8.did.d.ts +0 -183
  43. package/dist/declarations/deprecated/satellite-0-0-8.factory.did.js +0 -194
  44. package/dist/declarations/deprecated/satellite-0-0-9.did.d.ts +0 -199
  45. package/dist/declarations/deprecated/satellite-0-0-9.factory.did.js +0 -213
  46. package/dist/declarations/satellite/satellite.did.d.ts +0 -396
  47. package/dist/declarations/satellite/satellite.factory.certified.did.js +0 -419
  48. package/dist/declarations/satellite/satellite.factory.did.js +0 -419
  49. package/dist/declarations/satellite/satellite.factory.did.mjs +0 -419
  50. package/dist/declarations/sputnik/sputnik.did.d.ts +0 -396
  51. package/dist/declarations/sputnik/sputnik.factory.certified.did.js +0 -419
  52. package/dist/declarations/sputnik/sputnik.factory.did.js +0 -419
  53. package/dist/types/api/_actor.factory.d.ts +0 -5
@@ -1,8 +1,8 @@
1
1
  import type { ActorMethod, ActorSubclass } from '@dfinity/agent';
2
2
  import type { IDL } from '@dfinity/candid';
3
+ import { type SatelliteActor } from '@junobuild/ic-client';
3
4
  import type { CallOptions } from '../types/call-options';
4
5
  import type { SatelliteContext } from '../types/satellite';
5
- import { type SatelliteActor } from './_actor.factory';
6
6
  export declare const getSatelliteActor: ({ satellite, options: { certified } }: {
7
7
  satellite: SatelliteContext;
8
8
  options: CallOptions;
@@ -1,5 +1,5 @@
1
+ import type { SatelliteDid } from '@junobuild/ic-client';
1
2
  import { type AssetKey, type UploadAsset } from '@junobuild/storage';
2
- import type { AssetNoContent } from '../../declarations/satellite/satellite.did';
3
3
  import type { ActorReadParams, ActorUpdateParams } from '../types/actor';
4
4
  import type { ListParams, ListResults } from '../types/list';
5
5
  export declare const uploadAsset: ({ asset, ...rest }: {
@@ -8,7 +8,7 @@ export declare const uploadAsset: ({ asset, ...rest }: {
8
8
  export declare const listAssets: ({ collection, filter, ...rest }: {
9
9
  collection: string;
10
10
  filter: ListParams;
11
- } & ActorReadParams) => Promise<ListResults<AssetNoContent>>;
11
+ } & ActorReadParams) => Promise<ListResults<SatelliteDid.AssetNoContent>>;
12
12
  export declare const countAssets: ({ collection, filter, ...rest }: {
13
13
  collection: string;
14
14
  filter: ListParams;
@@ -27,9 +27,9 @@ export declare const deleteFilteredAssets: ({ collection, filter, ...rest }: {
27
27
  } & ActorUpdateParams) => Promise<void>;
28
28
  export declare const getAsset: ({ collection, fullPath, ...rest }: {
29
29
  collection: string;
30
- } & ActorReadParams & Pick<AssetKey, "fullPath">) => Promise<AssetNoContent | undefined>;
30
+ } & ActorReadParams & Pick<AssetKey, "fullPath">) => Promise<SatelliteDid.AssetNoContent | undefined>;
31
31
  export declare const getManyAssets: ({ assets, ...rest }: {
32
32
  assets: ({
33
33
  collection: string;
34
34
  } & Pick<AssetKey, "fullPath">)[];
35
- } & ActorReadParams) => Promise<(AssetNoContent | undefined)[]>;
35
+ } & ActorReadParams) => Promise<(SatelliteDid.AssetNoContent | undefined)[]>;
@@ -1,5 +1,5 @@
1
+ import type { SatelliteDid } from '@junobuild/ic-client';
1
2
  import type { Asset, AssetKey, Storage } from '@junobuild/storage';
2
- import type { AssetNoContent } from '../../declarations/satellite/satellite.did';
3
3
  import type { ReadOptions } from '../types/call-options';
4
4
  import type { ListParams } from '../types/list';
5
5
  import type { SatelliteOptions } from '../types/satellite';
@@ -111,7 +111,7 @@ export declare const getAsset: ({ satellite, options, ...rest }: {
111
111
  collection: string;
112
112
  satellite?: SatelliteOptions;
113
113
  options?: ReadOptions;
114
- } & Pick<AssetKey, "fullPath">) => Promise<AssetNoContent | undefined>;
114
+ } & Pick<AssetKey, "fullPath">) => Promise<SatelliteDid.AssetNoContent | undefined>;
115
115
  /**
116
116
  * Retrieves multiple assets from the storage.
117
117
  *
@@ -127,7 +127,7 @@ export declare const getManyAssets: ({ satellite, options, ...rest }: {
127
127
  } & Pick<AssetKey, "fullPath">)[];
128
128
  satellite?: SatelliteOptions;
129
129
  options?: ReadOptions;
130
- }) => Promise<(AssetNoContent | undefined)[]>;
130
+ }) => Promise<(SatelliteDid.AssetNoContent | undefined)[]>;
131
131
  /**
132
132
  * Returns a public URL for accessing a specific asset stored on a Satellite.
133
133
  *
@@ -1,5 +1,4 @@
1
- import { type ActorSubclass } from '@dfinity/agent';
2
- import type { ActorMethod } from '@dfinity/agent/lib/esm/actor';
1
+ import { type ActorMethod, type ActorSubclass } from '@dfinity/agent';
3
2
  import type { IDL } from '@dfinity/candid';
4
3
  import type { ActorKey } from '../types/actor';
5
4
  import type { SatelliteContext } from '../types/satellite';
@@ -1,12 +1,12 @@
1
+ import type { SatelliteDid } from '@junobuild/ic-client';
1
2
  import type { Asset } from '@junobuild/storage';
2
- import type { AssetNoContent } from '../../declarations/satellite/satellite.did';
3
3
  import type { ListResults } from './list';
4
4
  /**
5
5
  * Represents a collection of assets with pagination details.
6
6
  * @interface
7
7
  * @extends {Pick<ListResults<AssetNoContent>, 'items_length' | 'items_page' | 'matches_length' | 'matches_pages'>}
8
8
  */
9
- export interface Assets extends Omit<ListResults<AssetNoContent>, 'items'> {
9
+ export interface Assets extends Omit<ListResults<SatelliteDid.AssetNoContent>, 'items'> {
10
10
  /**
11
11
  * The collection of assets.
12
12
  * @type {Asset[]}
@@ -1,2 +1,2 @@
1
- import type { Doc } from '../../declarations/satellite/satellite.did';
2
- export declare const mapData: <D>({ data }: Pick<Doc, "data">) => Promise<D>;
1
+ import type { SatelliteDid } from '@junobuild/ic-client';
2
+ export declare const mapData: <D>({ data }: Pick<SatelliteDid.Doc, "data">) => Promise<D>;
@@ -1,8 +1,8 @@
1
- import type { DelDoc, Doc as DocApi, SetDoc } from '../../declarations/satellite/satellite.did';
1
+ import type { SatelliteDid } from '@junobuild/ic-client';
2
2
  import type { Doc } from '../types/doc';
3
- export declare const toSetDoc: <D>(doc: Doc<D>) => Promise<SetDoc>;
4
- export declare const toDelDoc: <D>(doc: Doc<D>) => DelDoc;
3
+ export declare const toSetDoc: <D>(doc: Doc<D>) => Promise<SatelliteDid.SetDoc>;
4
+ export declare const toDelDoc: <D>(doc: Doc<D>) => SatelliteDid.DelDoc;
5
5
  export declare const fromDoc: <D>({ doc, key }: {
6
- doc: DocApi;
6
+ doc: SatelliteDid.Doc;
7
7
  key: string;
8
8
  }) => Promise<Doc<D>>;
@@ -1,3 +1,3 @@
1
- import type { ListParams as ListParamsApi } from '../../declarations/satellite/satellite.did';
1
+ import type { SatelliteDid } from '@junobuild/ic-client';
2
2
  import type { ListParams } from '../types/list';
3
- export declare const toListParams: ({ matcher, paginate, order, owner }: ListParams) => ListParamsApi;
3
+ export declare const toListParams: ({ matcher, paginate, order, owner }: ListParams) => SatelliteDid.ListParams;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junobuild/core-peer",
3
- "version": "1.0.3",
3
+ "version": "1.1.0",
4
4
  "description": "JavaScript core client for Juno minus DFINITY agent-js dependencies",
5
5
  "author": "David Dal Busco (https://daviddalbusco.com)",
6
6
  "license": "MIT",
@@ -29,9 +29,8 @@
29
29
  "rmdir": "node ../../scripts/rmdir.mjs",
30
30
  "ts-declaration": "tsc --emitDeclarationOnly --outDir dist/types",
31
31
  "copy-src": "rm -rf src && cp -R ../core/src . && rm -rf ./src/tests",
32
- "copy-declarations": "rm -rf declarations && cp -R ../core/declarations .",
33
- "copy": "npm run copy-src && npm run copy-declarations",
34
- "build": "npm run rmdir && mkdir -p dist && npm run copy && cp -R declarations dist && node esbuild.mjs && npm run ts-declaration",
32
+ "copy": "npm run copy-src",
33
+ "build": "npm run rmdir && mkdir -p dist && npm run copy && node esbuild.mjs && npm run ts-declaration",
35
34
  "prepack": "npm run build"
36
35
  },
37
36
  "repository": {
@@ -53,7 +52,9 @@
53
52
  ],
54
53
  "homepage": "https://juno.build",
55
54
  "dependencies": {
56
- "@junobuild/storage": "*",
55
+ "@junobuild/errors": "*",
56
+ "@junobuild/ic-client": "^1",
57
+ "@junobuild/storage": "^1",
57
58
  "@junobuild/utils": "*"
58
59
  },
59
60
  "peerDependencies": {
@@ -1,267 +0,0 @@
1
- import type {ActorMethod} from '@dfinity/agent';
2
- import type {IDL} from '@dfinity/candid';
3
- import type {Principal} from '@dfinity/principal';
4
-
5
- export interface AssertMissionControlCenterArgs {
6
- mission_control_id: Principal;
7
- user: Principal;
8
- }
9
- export interface AssetEncodingNoContent {
10
- modified: bigint;
11
- sha256: Uint8Array | number[];
12
- total_length: bigint;
13
- }
14
- export interface AssetKey {
15
- token: [] | [string];
16
- collection: string;
17
- owner: Principal;
18
- name: string;
19
- description: [] | [string];
20
- full_path: string;
21
- }
22
- export interface AssetNoContent {
23
- key: AssetKey;
24
- updated_at: bigint;
25
- encodings: Array<[string, AssetEncodingNoContent]>;
26
- headers: Array<[string, string]>;
27
- created_at: bigint;
28
- version: [] | [bigint];
29
- }
30
- export interface AssetsUpgradeOptions {
31
- clear_existing_assets: [] | [boolean];
32
- }
33
- export interface CommitBatch {
34
- batch_id: bigint;
35
- headers: Array<[string, string]>;
36
- chunk_ids: Array<bigint>;
37
- }
38
- export interface CommitProposal {
39
- sha256: Uint8Array | number[];
40
- proposal_id: bigint;
41
- }
42
- export interface Config {
43
- storage: StorageConfig;
44
- }
45
- export interface ConfigMaxMemorySize {
46
- stable: [] | [bigint];
47
- heap: [] | [bigint];
48
- }
49
- export type ControllerScope = {Write: null} | {Admin: null};
50
- export interface CreateCanisterArgs {
51
- block_index: [] | [bigint];
52
- subnet_id: [] | [Principal];
53
- user: Principal;
54
- }
55
- export interface CustomDomain {
56
- updated_at: bigint;
57
- created_at: bigint;
58
- version: [] | [bigint];
59
- bn_id: [] | [string];
60
- }
61
- export interface DeleteControllersArgs {
62
- controllers: Array<Principal>;
63
- }
64
- export interface DeleteProposalAssets {
65
- proposal_ids: Array<bigint>;
66
- }
67
- export interface GetCreateCanisterFeeArgs {
68
- user: Principal;
69
- }
70
- export interface HttpRequest {
71
- url: string;
72
- method: string;
73
- body: Uint8Array | number[];
74
- headers: Array<[string, string]>;
75
- certificate_version: [] | [number];
76
- }
77
- export interface HttpResponse {
78
- body: Uint8Array | number[];
79
- headers: Array<[string, string]>;
80
- streaming_strategy: [] | [StreamingStrategy];
81
- status_code: number;
82
- }
83
- export interface InitAssetKey {
84
- token: [] | [string];
85
- collection: string;
86
- name: string;
87
- description: [] | [string];
88
- encoding_type: [] | [string];
89
- full_path: string;
90
- }
91
- export interface InitUploadResult {
92
- batch_id: bigint;
93
- }
94
- export interface ListMatcher {
95
- key: [] | [string];
96
- updated_at: [] | [TimestampMatcher];
97
- description: [] | [string];
98
- created_at: [] | [TimestampMatcher];
99
- }
100
- export interface ListOrder {
101
- field: ListOrderField;
102
- desc: boolean;
103
- }
104
- export type ListOrderField = {UpdatedAt: null} | {Keys: null} | {CreatedAt: null};
105
- export interface ListPaginate {
106
- start_after: [] | [string];
107
- limit: [] | [bigint];
108
- }
109
- export interface ListParams {
110
- order: [] | [ListOrder];
111
- owner: [] | [Principal];
112
- matcher: [] | [ListMatcher];
113
- paginate: [] | [ListPaginate];
114
- }
115
- export interface ListResults {
116
- matches_pages: [] | [bigint];
117
- matches_length: bigint;
118
- items_page: [] | [bigint];
119
- items: Array<[string, AssetNoContent]>;
120
- items_length: bigint;
121
- }
122
- export type Memory = {Heap: null} | {Stable: null};
123
- export interface MissionControl {
124
- updated_at: bigint;
125
- credits: Tokens;
126
- mission_control_id: [] | [Principal];
127
- owner: Principal;
128
- created_at: bigint;
129
- }
130
- export interface Payment {
131
- status: PaymentStatus;
132
- updated_at: bigint;
133
- block_index_payment: bigint;
134
- mission_control_id: [] | [Principal];
135
- created_at: bigint;
136
- block_index_refunded: [] | [bigint];
137
- }
138
- export type PaymentStatus = {Refunded: null} | {Acknowledged: null} | {Completed: null};
139
- export interface Proposal {
140
- status: ProposalStatus;
141
- updated_at: bigint;
142
- sha256: [] | [Uint8Array | number[]];
143
- executed_at: [] | [bigint];
144
- owner: Principal;
145
- created_at: bigint;
146
- version: [] | [bigint];
147
- proposal_type: ProposalType;
148
- }
149
- export type ProposalStatus =
150
- | {Initialized: null}
151
- | {Failed: null}
152
- | {Open: null}
153
- | {Rejected: null}
154
- | {Executed: null}
155
- | {Accepted: null};
156
- export type ProposalType =
157
- | {AssetsUpgrade: AssetsUpgradeOptions}
158
- | {SegmentsDeployment: SegmentsDeploymentOptions};
159
- export interface RateConfig {
160
- max_tokens: bigint;
161
- time_per_token_ns: bigint;
162
- }
163
- export type SegmentType = {Orbiter: null} | {MissionControl: null} | {Satellite: null};
164
- export interface SegmentsDeploymentOptions {
165
- orbiter: [] | [string];
166
- mission_control_version: [] | [string];
167
- satellite_version: [] | [string];
168
- }
169
- export interface SetController {
170
- metadata: Array<[string, string]>;
171
- scope: ControllerScope;
172
- expires_at: [] | [bigint];
173
- }
174
- export interface SetControllersArgs {
175
- controller: SetController;
176
- controllers: Array<Principal>;
177
- }
178
- export interface StorageConfig {
179
- iframe: [] | [StorageConfigIFrame];
180
- rewrites: Array<[string, string]>;
181
- headers: Array<[string, Array<[string, string]>]>;
182
- max_memory_size: [] | [ConfigMaxMemorySize];
183
- raw_access: [] | [StorageConfigRawAccess];
184
- redirects: [] | [Array<[string, StorageConfigRedirect]>];
185
- }
186
- export type StorageConfigIFrame = {Deny: null} | {AllowAny: null} | {SameOrigin: null};
187
- export type StorageConfigRawAccess = {Deny: null} | {Allow: null};
188
- export interface StorageConfigRedirect {
189
- status_code: number;
190
- location: string;
191
- }
192
- export interface StreamingCallbackHttpResponse {
193
- token: [] | [StreamingCallbackToken];
194
- body: Uint8Array | number[];
195
- }
196
- export interface StreamingCallbackToken {
197
- memory: Memory;
198
- token: [] | [string];
199
- sha256: [] | [Uint8Array | number[]];
200
- headers: Array<[string, string]>;
201
- index: bigint;
202
- encoding_type: string;
203
- full_path: string;
204
- }
205
- export type StreamingStrategy = {
206
- Callback: {
207
- token: StreamingCallbackToken;
208
- callback: [Principal, string];
209
- };
210
- };
211
- export type TimestampMatcher =
212
- | {Equal: bigint}
213
- | {Between: [bigint, bigint]}
214
- | {GreaterThan: bigint}
215
- | {LessThan: bigint};
216
- export interface Tokens {
217
- e8s: bigint;
218
- }
219
- export interface UploadChunk {
220
- content: Uint8Array | number[];
221
- batch_id: bigint;
222
- order_id: [] | [bigint];
223
- }
224
- export interface UploadChunkResult {
225
- chunk_id: bigint;
226
- }
227
- export interface _SERVICE {
228
- add_credits: ActorMethod<[Principal, Tokens], undefined>;
229
- add_invitation_code: ActorMethod<[string], undefined>;
230
- assert_mission_control_center: ActorMethod<[AssertMissionControlCenterArgs], undefined>;
231
- commit_asset_upload: ActorMethod<[CommitBatch], undefined>;
232
- commit_proposal: ActorMethod<[CommitProposal], null>;
233
- create_orbiter: ActorMethod<[CreateCanisterArgs], Principal>;
234
- create_satellite: ActorMethod<[CreateCanisterArgs], Principal>;
235
- del_controllers: ActorMethod<[DeleteControllersArgs], undefined>;
236
- del_custom_domain: ActorMethod<[string], undefined>;
237
- delete_proposal_assets: ActorMethod<[DeleteProposalAssets], undefined>;
238
- get_config: ActorMethod<[], Config>;
239
- get_create_orbiter_fee: ActorMethod<[GetCreateCanisterFeeArgs], [] | [Tokens]>;
240
- get_create_satellite_fee: ActorMethod<[GetCreateCanisterFeeArgs], [] | [Tokens]>;
241
- get_credits: ActorMethod<[], Tokens>;
242
- get_proposal: ActorMethod<[bigint], [] | [Proposal]>;
243
- get_storage_config: ActorMethod<[], StorageConfig>;
244
- get_user_mission_control_center: ActorMethod<[], [] | [MissionControl]>;
245
- http_request: ActorMethod<[HttpRequest], HttpResponse>;
246
- http_request_streaming_callback: ActorMethod<
247
- [StreamingCallbackToken],
248
- StreamingCallbackHttpResponse
249
- >;
250
- init_asset_upload: ActorMethod<[InitAssetKey, bigint], InitUploadResult>;
251
- init_proposal: ActorMethod<[ProposalType], [bigint, Proposal]>;
252
- init_user_mission_control_center: ActorMethod<[], MissionControl>;
253
- list_assets: ActorMethod<[string, ListParams], ListResults>;
254
- list_custom_domains: ActorMethod<[], Array<[string, CustomDomain]>>;
255
- list_payments: ActorMethod<[], Array<[bigint, Payment]>>;
256
- list_user_mission_control_centers: ActorMethod<[], Array<[Principal, MissionControl]>>;
257
- set_controllers: ActorMethod<[SetControllersArgs], undefined>;
258
- set_custom_domain: ActorMethod<[string, [] | [string]], undefined>;
259
- set_fee: ActorMethod<[SegmentType, Tokens], undefined>;
260
- set_storage_config: ActorMethod<[StorageConfig], undefined>;
261
- submit_proposal: ActorMethod<[bigint], [bigint, Proposal]>;
262
- update_rate_config: ActorMethod<[SegmentType, RateConfig], undefined>;
263
- upload_asset_chunk: ActorMethod<[UploadChunk], UploadChunkResult>;
264
- version: ActorMethod<[], string>;
265
- }
266
- export declare const idlFactory: IDL.InterfaceFactory;
267
- export declare const init: (args: {IDL: typeof IDL}) => IDL.Type[];