@junobuild/core-peer 0.1.17 → 1.0.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.
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/node/index.mjs +1 -1
- package/dist/node/index.mjs.map +4 -4
- package/dist/types/api/_actor.factory.d.ts +5 -0
- package/dist/types/api/actor.api.d.ts +9 -6
- package/dist/types/api/doc.api.d.ts +21 -30
- package/dist/types/api/storage.api.d.ts +18 -25
- package/dist/types/constants/call-options.constants.d.ts +9 -0
- package/dist/types/index.d.ts +12 -12
- package/dist/types/providers/auth.providers.d.ts +1 -1
- package/dist/types/services/_identity.services.d.ts +2 -0
- package/dist/types/services/{user.services.d.ts → _user.services.d.ts} +1 -1
- package/dist/types/services/auth-timout.services.d.ts +2 -2
- package/dist/types/services/auth.services.d.ts +5 -1
- package/dist/types/services/doc.services.d.ts +33 -17
- package/dist/types/services/functions.services.d.ts +26 -0
- package/dist/types/services/storage.services.d.ts +36 -21
- package/dist/types/stores/_agent.factory.d.ts +4 -0
- package/dist/types/stores/actor.store.d.ts +5 -5
- package/dist/types/stores/agent.store.d.ts +3 -6
- package/dist/types/stores/auth.store.d.ts +3 -3
- package/dist/types/stores/env.store.d.ts +4 -3
- package/dist/types/types/actor.d.ts +51 -0
- package/dist/types/types/{auth.types.d.ts → auth.d.ts} +1 -1
- package/dist/types/types/call-options.d.ts +43 -0
- package/dist/types/types/{doc.types.d.ts → doc.d.ts} +1 -1
- package/dist/types/types/{env.types.d.ts → env.d.ts} +3 -3
- package/dist/types/types/satellite.d.ts +40 -0
- package/dist/types/types/storage.types.d.ts +1 -1
- package/dist/types/utils/doc.utils.d.ts +1 -1
- package/dist/types/utils/env.utils.d.ts +4 -4
- package/dist/types/utils/list.utils.d.ts +1 -1
- package/dist/types/workers/_auth.worker.handler.d.ts +11 -0
- package/dist/types/workers/auth.worker.d.ts +1 -5
- package/dist/workers/_auth.worker.handler.js +43 -0
- package/dist/workers/_auth.worker.handler.js.map +7 -0
- package/dist/workers/auth.worker.js +7 -7
- package/dist/workers/auth.worker.js.map +4 -4
- package/package.json +2 -2
- package/dist/types/services/factory.services.d.ts +0 -8
- package/dist/types/services/identity.services.d.ts +0 -2
- package/dist/types/types/build.types.d.ts +0 -5
- package/dist/types/types/satellite.types.d.ts +0 -27
- /package/dist/types/stores/{store.d.ts → _store.d.ts} +0 -0
- /package/dist/types/types/{errors.types.d.ts → errors.d.ts} +0 -0
- /package/dist/types/types/{list.types.d.ts → list.d.ts} +0 -0
- /package/dist/types/types/{subscription.types.d.ts → subscription.d.ts} +0 -0
- /package/dist/types/types/{utility.types.d.ts → utility.d.ts} +0 -0
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { _SERVICE as SatelliteActor } from '../../declarations/satellite/satellite.did';
|
|
2
|
+
import { idlFactory as idlFactorySatellite } from '../../declarations/satellite/satellite.factory.did.js';
|
|
3
|
+
import { idlFactory as idlCertifiedFactorySatellite } from '../../declarations/satellite/satellite.factory.certified.did.js';
|
|
4
|
+
import { idlFactory as idlFactorySputnik } from '../../declarations/sputnik/sputnik.factory.did.js';
|
|
5
|
+
export { idlCertifiedFactorySatellite, idlFactorySatellite, idlFactorySputnik, type SatelliteActor };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import type { ActorSubclass } from '@dfinity/agent';
|
|
2
|
-
import type { ActorMethod } from '@dfinity/agent/lib/esm/actor';
|
|
1
|
+
import type { ActorMethod, ActorSubclass } from '@dfinity/agent';
|
|
3
2
|
import type { IDL } from '@dfinity/candid';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
|
|
7
|
-
export declare const
|
|
3
|
+
import type { CallOptions } from '../types/call-options';
|
|
4
|
+
import type { SatelliteContext } from '../types/satellite';
|
|
5
|
+
import { type SatelliteActor } from './_actor.factory';
|
|
6
|
+
export declare const getSatelliteActor: ({ satellite, options: { certified } }: {
|
|
7
|
+
satellite: SatelliteContext;
|
|
8
|
+
options: CallOptions;
|
|
9
|
+
}) => Promise<SatelliteActor>;
|
|
10
|
+
export declare const getSatelliteExtendedActor: <T = Record<string, ActorMethod>>({ idlFactory, ...rest }: SatelliteContext & {
|
|
8
11
|
idlFactory: IDL.InterfaceFactory;
|
|
9
12
|
}) => Promise<ActorSubclass<T>>;
|
|
@@ -1,52 +1,43 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
export declare const getDoc: <D>({ collection, key,
|
|
1
|
+
import type { ActorReadParams, ActorUpdateParams } from '../types/actor';
|
|
2
|
+
import type { Doc } from '../types/doc';
|
|
3
|
+
import type { ListParams, ListResults } from '../types/list';
|
|
4
|
+
export declare const getDoc: <D>({ collection, key, ...rest }: {
|
|
5
5
|
collection: string;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export declare const getManyDocs: ({ docs, satellite }: {
|
|
6
|
+
} & ActorReadParams & Pick<Doc<D>, "key">) => Promise<Doc<D> | undefined>;
|
|
7
|
+
export declare const getManyDocs: ({ docs, ...rest }: {
|
|
9
8
|
docs: ({
|
|
10
9
|
collection: string;
|
|
11
10
|
} & Pick<Doc<any>, "key">)[];
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export declare const setDoc: <D>({ collection, doc, satellite }: {
|
|
11
|
+
} & ActorReadParams) => Promise<(Doc<any> | undefined)[]>;
|
|
12
|
+
export declare const setDoc: <D>({ collection, doc, ...rest }: {
|
|
15
13
|
collection: string;
|
|
16
14
|
doc: Doc<D>;
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
export declare const setManyDocs: ({ docs, satellite }: {
|
|
15
|
+
} & ActorUpdateParams) => Promise<Doc<D>>;
|
|
16
|
+
export declare const setManyDocs: ({ docs, ...rest }: {
|
|
20
17
|
docs: {
|
|
21
18
|
collection: string;
|
|
22
19
|
doc: Doc<any>;
|
|
23
20
|
}[];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
export declare const deleteDoc: <D>({ collection, doc, satellite }: {
|
|
21
|
+
} & ActorUpdateParams) => Promise<Doc<any>[]>;
|
|
22
|
+
export declare const deleteDoc: <D>({ collection, doc, ...rest }: {
|
|
27
23
|
collection: string;
|
|
28
24
|
doc: Doc<D>;
|
|
29
|
-
|
|
30
|
-
}
|
|
31
|
-
export declare const deleteManyDocs: ({ docs, satellite }: {
|
|
25
|
+
} & ActorUpdateParams) => Promise<void>;
|
|
26
|
+
export declare const deleteManyDocs: ({ docs, ...rest }: {
|
|
32
27
|
docs: {
|
|
33
28
|
collection: string;
|
|
34
29
|
doc: Doc<any>;
|
|
35
30
|
}[];
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
export declare const deleteFilteredDocs: ({ collection, filter, satellite }: {
|
|
31
|
+
} & ActorUpdateParams) => Promise<void>;
|
|
32
|
+
export declare const deleteFilteredDocs: ({ collection, filter, ...rest }: {
|
|
39
33
|
collection: string;
|
|
40
34
|
filter: ListParams;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
export declare const listDocs: <D>({ collection, filter, satellite }: {
|
|
35
|
+
} & ActorUpdateParams) => Promise<void>;
|
|
36
|
+
export declare const listDocs: <D>({ collection, filter, ...rest }: {
|
|
44
37
|
collection: string;
|
|
45
38
|
filter: ListParams;
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
export declare const countDocs: ({ collection, filter, satellite }: {
|
|
39
|
+
} & ActorReadParams) => Promise<ListResults<Doc<D>>>;
|
|
40
|
+
export declare const countDocs: ({ collection, filter, ...rest }: {
|
|
49
41
|
collection: string;
|
|
50
42
|
filter: ListParams;
|
|
51
|
-
|
|
52
|
-
}) => Promise<bigint>;
|
|
43
|
+
} & ActorReadParams) => Promise<bigint>;
|
|
@@ -1,42 +1,35 @@
|
|
|
1
1
|
import { type AssetKey, type UploadAsset } from '@junobuild/storage';
|
|
2
2
|
import type { AssetNoContent } from '../../declarations/satellite/satellite.did';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
export declare const uploadAsset: ({
|
|
6
|
-
|
|
7
|
-
}) => Promise<void>;
|
|
8
|
-
export declare const listAssets: ({ collection,
|
|
3
|
+
import type { ActorReadParams, ActorUpdateParams } from '../types/actor';
|
|
4
|
+
import type { ListParams, ListResults } from '../types/list';
|
|
5
|
+
export declare const uploadAsset: ({ asset, ...rest }: {
|
|
6
|
+
asset: UploadAsset;
|
|
7
|
+
} & ActorUpdateParams) => Promise<void>;
|
|
8
|
+
export declare const listAssets: ({ collection, filter, ...rest }: {
|
|
9
9
|
collection: string;
|
|
10
|
-
satellite: Satellite;
|
|
11
10
|
filter: ListParams;
|
|
12
|
-
}) => Promise<ListResults<AssetNoContent>>;
|
|
13
|
-
export declare const countAssets: ({ collection,
|
|
11
|
+
} & ActorReadParams) => Promise<ListResults<AssetNoContent>>;
|
|
12
|
+
export declare const countAssets: ({ collection, filter, ...rest }: {
|
|
14
13
|
collection: string;
|
|
15
|
-
satellite: Satellite;
|
|
16
14
|
filter: ListParams;
|
|
17
|
-
}) => Promise<bigint>;
|
|
18
|
-
export declare const deleteAsset: ({ collection, fullPath,
|
|
15
|
+
} & ActorReadParams) => Promise<bigint>;
|
|
16
|
+
export declare const deleteAsset: ({ collection, fullPath, ...rest }: {
|
|
19
17
|
collection: string;
|
|
20
|
-
|
|
21
|
-
} & Pick<AssetKey, "fullPath">) => Promise<void>;
|
|
18
|
+
} & ActorUpdateParams & Pick<AssetKey, "fullPath">) => Promise<void>;
|
|
22
19
|
export declare const deleteManyAssets: ({ assets, satellite }: {
|
|
23
20
|
assets: ({
|
|
24
21
|
collection: string;
|
|
25
22
|
} & Pick<AssetKey, "fullPath">)[];
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
export declare const deleteFilteredAssets: ({ collection, satellite, filter }: {
|
|
23
|
+
} & ActorUpdateParams) => Promise<void>;
|
|
24
|
+
export declare const deleteFilteredAssets: ({ collection, filter, ...rest }: {
|
|
29
25
|
collection: string;
|
|
30
|
-
satellite: Satellite;
|
|
31
26
|
filter: ListParams;
|
|
32
|
-
}) => Promise<void>;
|
|
33
|
-
export declare const getAsset: ({ collection, fullPath,
|
|
27
|
+
} & ActorUpdateParams) => Promise<void>;
|
|
28
|
+
export declare const getAsset: ({ collection, fullPath, ...rest }: {
|
|
34
29
|
collection: string;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export declare const getManyAssets: ({ assets, satellite }: {
|
|
30
|
+
} & ActorReadParams & Pick<AssetKey, "fullPath">) => Promise<AssetNoContent | undefined>;
|
|
31
|
+
export declare const getManyAssets: ({ assets, ...rest }: {
|
|
38
32
|
assets: ({
|
|
39
33
|
collection: string;
|
|
40
34
|
} & Pick<AssetKey, "fullPath">)[];
|
|
41
|
-
|
|
42
|
-
}) => Promise<(AssetNoContent | undefined)[]>;
|
|
35
|
+
} & ActorReadParams) => Promise<(AssetNoContent | undefined)[]>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ReadOptions } from '../types/call-options';
|
|
2
|
+
/**
|
|
3
|
+
* Default options for read operations.
|
|
4
|
+
*
|
|
5
|
+
* For backwards compatibility and because most developers probably prioritize speed over
|
|
6
|
+
* additional security when fetching read-only data from the Internet Computer,
|
|
7
|
+
* read operations are performed in an uncertified way by default.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DEFAULT_READ_OPTIONS: ReadOptions;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import type { Asset, AssetEncoding, AssetKey, EncodingType, Storage } from '@junobuild/storage';
|
|
2
|
-
import type { User } from './types/auth
|
|
3
|
-
import type { UserEnvironment } from './types/env
|
|
4
|
-
import type { Unsubscribe } from './types/subscription
|
|
2
|
+
import type { User } from './types/auth';
|
|
3
|
+
import type { UserEnvironment } from './types/env';
|
|
4
|
+
import type { Unsubscribe } from './types/subscription';
|
|
5
5
|
export * from './providers/auth.providers';
|
|
6
6
|
export { getIdentityOnce, signIn, signOut, unsafeIdentity } from './services/auth.services';
|
|
7
7
|
export * from './services/doc.services';
|
|
8
|
-
export * from './services/
|
|
8
|
+
export * from './services/functions.services';
|
|
9
9
|
export * from './services/storage.services';
|
|
10
|
-
export type * from './types/auth
|
|
11
|
-
export type * from './types/doc
|
|
12
|
-
export type * from './types/env
|
|
13
|
-
export * from './types/errors
|
|
14
|
-
export { ListOrder, ListPaginate, ListParams, ListResults } from './types/list
|
|
15
|
-
export type * from './types/satellite
|
|
10
|
+
export type * from './types/auth';
|
|
11
|
+
export type * from './types/doc';
|
|
12
|
+
export type * from './types/env';
|
|
13
|
+
export * from './types/errors';
|
|
14
|
+
export { ListOrder, ListPaginate, ListParams, ListResults } from './types/list';
|
|
15
|
+
export type * from './types/satellite';
|
|
16
16
|
export type * from './types/storage.types';
|
|
17
|
-
export type * from './types/subscription
|
|
18
|
-
export type * from './types/utility
|
|
17
|
+
export type * from './types/subscription';
|
|
18
|
+
export type * from './types/utility';
|
|
19
19
|
export type { Asset, AssetEncoding, AssetKey, EncodingType, Storage };
|
|
20
20
|
/**
|
|
21
21
|
* Initializes Juno with the provided optional environment parameters.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InternetIdentityConfig, NFIDConfig, Provider, SignInOptions } from '../types/auth
|
|
1
|
+
import type { InternetIdentityConfig, NFIDConfig, Provider, SignInOptions } from '../types/auth';
|
|
2
2
|
/**
|
|
3
3
|
* Options for signing in with an authentication provider.
|
|
4
4
|
* @interface AuthProviderSignInOptions
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { Provider, User } from '../types/auth
|
|
1
|
+
import type { Provider, User } from '../types/auth';
|
|
2
2
|
export declare const initUser: (provider?: Provider) => Promise<User>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { EnvironmentWorker } from '../types/env
|
|
2
|
-
import type { Unsubscribe } from '../types/subscription
|
|
1
|
+
import type { EnvironmentWorker } from '../types/env';
|
|
2
|
+
import type { Unsubscribe } from '../types/subscription';
|
|
3
3
|
export declare const initAuthTimeoutWorker: (auth: EnvironmentWorker) => Unsubscribe;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Identity } from '@dfinity/agent';
|
|
2
|
-
import type { Provider, SignInOptions } from '../types/auth
|
|
2
|
+
import type { Provider, SignInOptions } from '../types/auth';
|
|
3
3
|
export declare const initAuth: (provider?: Provider) => Promise<void>;
|
|
4
4
|
/**
|
|
5
5
|
* Signs in a user with the specified options.
|
|
@@ -14,6 +14,10 @@ export declare const signIn: (options?: SignInOptions) => Promise<void>;
|
|
|
14
14
|
* @returns {Promise<void>} A promise that resolves when the sign-out process is complete.
|
|
15
15
|
*/
|
|
16
16
|
export declare const signOut: () => Promise<void>;
|
|
17
|
+
/**
|
|
18
|
+
* ℹ️ Exposed for testing purpose only. Should not be leaked to consumer or used by the library.
|
|
19
|
+
*/
|
|
20
|
+
export declare const resetAuth: () => Promise<void>;
|
|
17
21
|
export declare const getIdentity: () => Identity | undefined;
|
|
18
22
|
/**
|
|
19
23
|
* Returns the identity of a signed-in user or an anonymous identity.
|
|
@@ -1,39 +1,47 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { ReadOptions } from '../types/call-options';
|
|
2
|
+
import type { Doc } from '../types/doc';
|
|
3
|
+
import type { ListParams, ListResults } from '../types/list';
|
|
4
|
+
import type { SatelliteOptions } from '../types/satellite';
|
|
4
5
|
/**
|
|
5
6
|
* Retrieves a single document from a collection.
|
|
7
|
+
*
|
|
6
8
|
* @template D
|
|
7
9
|
* @param {Object} params - The parameters for retrieving the document.
|
|
8
10
|
* @param {string} params.collection - The name of the collection.
|
|
9
|
-
* @param {SatelliteOptions} [params.satellite] - Options for the satellite (useful for NodeJS usage only).
|
|
10
11
|
* @param {string} params.key - The key of the document to retrieve.
|
|
12
|
+
* @param {ReadOptions} [params.options] - Call options controlling certification. Defaults to uncertified reads for performance unless specified.
|
|
13
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
11
14
|
* @returns {Promise<Doc<D> | undefined>} A promise that resolves to the document or undefined if not found.
|
|
12
15
|
*/
|
|
13
|
-
export declare const getDoc: <D>({ satellite, ...rest }: {
|
|
16
|
+
export declare const getDoc: <D>({ satellite, options, ...rest }: {
|
|
14
17
|
collection: string;
|
|
15
18
|
satellite?: SatelliteOptions;
|
|
19
|
+
options?: ReadOptions;
|
|
16
20
|
} & Pick<Doc<D>, "key">) => Promise<Doc<D> | undefined>;
|
|
17
21
|
/**
|
|
18
22
|
* Retrieves multiple documents from a single or different collections in a single call.
|
|
23
|
+
*
|
|
19
24
|
* @param {Object} params - The parameters for retrieving the documents.
|
|
20
25
|
* @param {Array} params.docs - The list of documents with their collections and keys.
|
|
21
|
-
* @param {
|
|
26
|
+
* @param {ReadOptions} [params.options] - Call options controlling certification. Defaults to uncertified reads for performance unless specified.
|
|
27
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
22
28
|
* @returns {Promise<Array<Doc<any> | undefined>>} A promise that resolves to an array of documents or undefined if not found.
|
|
23
29
|
*/
|
|
24
|
-
export declare const getManyDocs: ({ satellite, ...rest }: {
|
|
30
|
+
export declare const getManyDocs: ({ satellite, options, ...rest }: {
|
|
25
31
|
docs: ({
|
|
26
32
|
collection: string;
|
|
27
33
|
} & Pick<Doc<any>, "key">)[];
|
|
28
34
|
satellite?: SatelliteOptions;
|
|
35
|
+
options?: ReadOptions;
|
|
29
36
|
}) => Promise<(Doc<any> | undefined)[]>;
|
|
30
37
|
/**
|
|
31
38
|
* Adds or updates a single document in a collection.
|
|
39
|
+
*
|
|
32
40
|
* @template D
|
|
33
41
|
* @param {Object} params - The parameters for adding or updating the document.
|
|
34
42
|
* @param {string} params.collection - The name of the collection.
|
|
35
43
|
* @param {Doc<D>} params.doc - The document to add or update.
|
|
36
|
-
* @param {SatelliteOptions} [params.satellite] - Options
|
|
44
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
37
45
|
* @returns {Promise<Doc<D>>} A promise that resolves to the added or updated document.
|
|
38
46
|
*/
|
|
39
47
|
export declare const setDoc: <D>({ satellite, ...rest }: {
|
|
@@ -43,9 +51,10 @@ export declare const setDoc: <D>({ satellite, ...rest }: {
|
|
|
43
51
|
}) => Promise<Doc<D>>;
|
|
44
52
|
/**
|
|
45
53
|
* Adds or updates multiple documents in a or different collections.
|
|
54
|
+
*
|
|
46
55
|
* @param {Object} params - The parameters for adding or updating the documents.
|
|
47
56
|
* @param {Array} params.docs - The list of documents with their collections and data.
|
|
48
|
-
* @param {SatelliteOptions} [params.satellite] - Options
|
|
57
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
49
58
|
* @returns {Promise<Array<Doc<any>>>} A promise that resolves to an array of added or updated documents.
|
|
50
59
|
*/
|
|
51
60
|
export declare const setManyDocs: ({ satellite, ...rest }: {
|
|
@@ -57,11 +66,12 @@ export declare const setManyDocs: ({ satellite, ...rest }: {
|
|
|
57
66
|
}) => Promise<Doc<any>[]>;
|
|
58
67
|
/**
|
|
59
68
|
* Deletes a single document from a collection.
|
|
69
|
+
*
|
|
60
70
|
* @template D
|
|
61
71
|
* @param {Object} params - The parameters for deleting the document.
|
|
62
72
|
* @param {string} params.collection - The name of the collection.
|
|
63
73
|
* @param {Doc<D>} params.doc - The document to delete.
|
|
64
|
-
* @param {SatelliteOptions} [params.satellite] - Options
|
|
74
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
65
75
|
* @returns {Promise<void>} A promise that resolves when the document is deleted.
|
|
66
76
|
*/
|
|
67
77
|
export declare const deleteDoc: <D>({ satellite, ...rest }: {
|
|
@@ -71,9 +81,10 @@ export declare const deleteDoc: <D>({ satellite, ...rest }: {
|
|
|
71
81
|
}) => Promise<void>;
|
|
72
82
|
/**
|
|
73
83
|
* Deletes multiple documents from a or different collections.
|
|
84
|
+
*
|
|
74
85
|
* @param {Object} params - The parameters for deleting the documents.
|
|
75
86
|
* @param {Array} params.docs - The list of documents with their collections and data.
|
|
76
|
-
* @param {SatelliteOptions} [params.satellite] - Options
|
|
87
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
77
88
|
* @returns {Promise<void>} A promise that resolves when the documents are deleted.
|
|
78
89
|
*/
|
|
79
90
|
export declare const deleteManyDocs: ({ satellite, ...rest }: {
|
|
@@ -89,8 +100,7 @@ export declare const deleteManyDocs: ({ satellite, ...rest }: {
|
|
|
89
100
|
* @param {Object} params - The parameters for deleting documents.
|
|
90
101
|
* @param {string} params.collection - The name of the collection.
|
|
91
102
|
* @param {ListParams} [params.filter] - The filter criteria to match documents for deletion.
|
|
92
|
-
* @param {SatelliteOptions} [params.satellite] - Options
|
|
93
|
-
*
|
|
103
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
94
104
|
* @returns {Promise<void>} A promise that resolves when the documents are deleted.
|
|
95
105
|
*/
|
|
96
106
|
export declare const deleteFilteredDocs: ({ satellite, filter, ...rest }: {
|
|
@@ -100,28 +110,34 @@ export declare const deleteFilteredDocs: ({ satellite, filter, ...rest }: {
|
|
|
100
110
|
}) => Promise<void>;
|
|
101
111
|
/**
|
|
102
112
|
* Lists documents in a collection with optional filtering.
|
|
113
|
+
*
|
|
103
114
|
* @template D
|
|
104
115
|
* @param {Object} params - The parameters for listing the documents.
|
|
105
116
|
* @param {string} params.collection - The name of the collection.
|
|
106
117
|
* @param {ListParams} [params.filter] - Optional filter parameters.
|
|
107
|
-
* @param {
|
|
118
|
+
* @param {ReadOptions} [params.options] - Call options controlling certification. Defaults to uncertified reads for performance unless specified.
|
|
119
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
108
120
|
* @returns {Promise<ListResults<Doc<D>>>} A promise that resolves to the list of documents.
|
|
109
121
|
*/
|
|
110
|
-
export declare const listDocs: <D>({ satellite, filter, ...rest }: {
|
|
122
|
+
export declare const listDocs: <D>({ satellite, options, filter, ...rest }: {
|
|
111
123
|
collection: string;
|
|
112
124
|
filter?: ListParams;
|
|
113
125
|
satellite?: SatelliteOptions;
|
|
126
|
+
options?: ReadOptions;
|
|
114
127
|
}) => Promise<ListResults<Doc<D>>>;
|
|
115
128
|
/**
|
|
116
129
|
* Counts documents in a collection with optional filtering.
|
|
130
|
+
*
|
|
117
131
|
* @param {Object} params - The parameters for counting the documents.
|
|
118
132
|
* @param {string} params.collection - The name of the collection.
|
|
119
133
|
* @param {ListParams} [params.filter] - Optional filter parameters.
|
|
120
|
-
* @param {
|
|
134
|
+
* @param {ReadOptions} [params.options] - Call options controlling certification. Defaults to uncertified reads for performance unless specified.
|
|
135
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
121
136
|
* @returns {Promise<bigint>} A promise that resolves to the count of documents as a bigint.
|
|
122
137
|
*/
|
|
123
|
-
export declare const countDocs: ({ satellite, filter, ...rest }: {
|
|
138
|
+
export declare const countDocs: ({ satellite, options, filter, ...rest }: {
|
|
124
139
|
collection: string;
|
|
125
140
|
filter?: ListParams;
|
|
126
141
|
satellite?: SatelliteOptions;
|
|
142
|
+
options?: ReadOptions;
|
|
127
143
|
}) => Promise<bigint>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ActorSubclass } from '@dfinity/agent';
|
|
2
|
+
import type { ActorMethod } from '@dfinity/agent/lib/esm/actor';
|
|
3
|
+
import type { IDL } from '@dfinity/candid';
|
|
4
|
+
import type { SatelliteOptions } from '../types/satellite';
|
|
5
|
+
/**
|
|
6
|
+
* Returns an extended satellite actor instance using the provided IDL factory and satellite options.
|
|
7
|
+
*
|
|
8
|
+
* This function is intended for advanced use cases where developers have implemented
|
|
9
|
+
* custom endpoints in their serverless functions using the extended build type.
|
|
10
|
+
*
|
|
11
|
+
* In most cases, developers should not need to call this directly.
|
|
12
|
+
* Extended actors are typically mapped and handled automatically.
|
|
13
|
+
*
|
|
14
|
+
* @template T - The actor interface type.
|
|
15
|
+
*
|
|
16
|
+
* @param {Object} params - The parameters for creating the actor.
|
|
17
|
+
* @param {IDL.InterfaceFactory} params.idlFactory - The IDL factory defining the custom actor interface.
|
|
18
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only.
|
|
19
|
+
* In browser environments, configuration is automatically inherited from `initSatellite()`.
|
|
20
|
+
*
|
|
21
|
+
* @returns {Promise<ActorSubclass<T>>} A promise that resolves to the extended actor instance.
|
|
22
|
+
*/
|
|
23
|
+
export declare const getSatelliteExtendedActor: <T = Record<string, ActorMethod>>({ idlFactory, satellite }: {
|
|
24
|
+
idlFactory: IDL.InterfaceFactory;
|
|
25
|
+
satellite?: SatelliteOptions;
|
|
26
|
+
}) => Promise<ActorSubclass<T>>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { Asset, AssetKey, Storage } from '@junobuild/storage';
|
|
2
2
|
import type { AssetNoContent } from '../../declarations/satellite/satellite.did';
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { ReadOptions } from '../types/call-options';
|
|
4
|
+
import type { ListParams } from '../types/list';
|
|
5
|
+
import type { SatelliteOptions } from '../types/satellite';
|
|
5
6
|
import type { Assets } from '../types/storage.types';
|
|
6
7
|
/**
|
|
7
8
|
* Uploads a blob to the storage.
|
|
8
|
-
*
|
|
9
|
+
*
|
|
10
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
9
11
|
* @returns {Promise<AssetKey>} A promise that resolves to the asset key.
|
|
10
12
|
*/
|
|
11
13
|
export declare const uploadBlob: (params: Storage & {
|
|
@@ -13,7 +15,8 @@ export declare const uploadBlob: (params: Storage & {
|
|
|
13
15
|
}) => Promise<AssetKey>;
|
|
14
16
|
/**
|
|
15
17
|
* Uploads a file to the storage.
|
|
16
|
-
*
|
|
18
|
+
*
|
|
19
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
17
20
|
* @returns {Promise<AssetKey>} A promise that resolves to the asset key.
|
|
18
21
|
*/
|
|
19
22
|
export declare const uploadFile: (params: Partial<Pick<Storage, "filename">> & Omit<Storage, "filename" | "data"> & {
|
|
@@ -23,36 +26,43 @@ export declare const uploadFile: (params: Partial<Pick<Storage, "filename">> & O
|
|
|
23
26
|
}) => Promise<AssetKey>;
|
|
24
27
|
/**
|
|
25
28
|
* Lists assets in a collection with optional filtering.
|
|
29
|
+
*
|
|
26
30
|
* @param {Object} params - The parameters for listing the assets.
|
|
27
31
|
* @param {string} params.collection - The name of the collection.
|
|
28
|
-
* @param {SatelliteOptions} [params.satellite] - The satellite options (required only in NodeJS environment).
|
|
29
32
|
* @param {ListParams} [params.filter] - The filter parameters.
|
|
33
|
+
* @param {ReadOptions} [params.options] - Call options controlling certification. Defaults to uncertified reads for performance unless specified.
|
|
34
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
30
35
|
* @returns {Promise<Assets>} A promise that resolves to the list of assets.
|
|
31
36
|
*/
|
|
32
|
-
export declare const listAssets: ({ collection, satellite: satelliteOptions,
|
|
37
|
+
export declare const listAssets: ({ collection, filter, satellite: satelliteOptions, options }: {
|
|
33
38
|
collection: string;
|
|
34
|
-
satellite?: SatelliteOptions;
|
|
35
39
|
filter?: ListParams;
|
|
40
|
+
satellite?: SatelliteOptions;
|
|
41
|
+
options?: ReadOptions;
|
|
36
42
|
}) => Promise<Assets>;
|
|
37
43
|
/**
|
|
38
44
|
* Counts assets in a collection with optional filtering.
|
|
45
|
+
*
|
|
39
46
|
* @param {Object} params - The parameters for counting the assets.
|
|
40
47
|
* @param {string} params.collection - The name of the collection.
|
|
41
|
-
* @param {SatelliteOptions} [params.satellite] - The satellite options (required only in NodeJS environment).
|
|
42
48
|
* @param {ListParams} [params.filter] - The filter parameters for narrowing down the count.
|
|
49
|
+
* @param {ReadOptions} [params.options] - Call options controlling certification. Defaults to uncertified reads for performance unless specified.
|
|
50
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
43
51
|
* @returns {Promise<bigint>} A promise that resolves to the count of assets as a bigint.
|
|
44
52
|
*/
|
|
45
|
-
export declare const countAssets: ({ collection, satellite: satelliteOptions,
|
|
53
|
+
export declare const countAssets: ({ collection, filter, satellite: satelliteOptions, options }: {
|
|
46
54
|
collection: string;
|
|
47
|
-
satellite?: SatelliteOptions;
|
|
48
55
|
filter?: ListParams;
|
|
56
|
+
satellite?: SatelliteOptions;
|
|
57
|
+
options?: ReadOptions;
|
|
49
58
|
}) => Promise<bigint>;
|
|
50
59
|
/**
|
|
51
60
|
* Deletes an asset from the storage.
|
|
61
|
+
*
|
|
52
62
|
* @param {Object} params - The parameters for deleting the asset.
|
|
53
63
|
* @param {string} params.collection - The name of the collection.
|
|
54
|
-
* @param {SatelliteOptions} [params.satellite] - The satellite options (required only in NodeJS environment).
|
|
55
64
|
* @param {string} params.fullPath - The full path of the asset.
|
|
65
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
56
66
|
* @returns {Promise<void>} A promise that resolves when the asset is deleted.
|
|
57
67
|
*/
|
|
58
68
|
export declare const deleteAsset: ({ collection, fullPath, satellite }: {
|
|
@@ -61,9 +71,10 @@ export declare const deleteAsset: ({ collection, fullPath, satellite }: {
|
|
|
61
71
|
} & Pick<AssetKey, "fullPath">) => Promise<void>;
|
|
62
72
|
/**
|
|
63
73
|
* Deletes multiple assets from the storage.
|
|
74
|
+
*
|
|
64
75
|
* @param {Object} params - The parameters for deleting the assets.
|
|
65
76
|
* @param {Array} params.assets - The list of assets with their collections and full paths.
|
|
66
|
-
* @param {SatelliteOptions} [params.satellite] -
|
|
77
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
67
78
|
* @returns {Promise<void>} A promise that resolves when the assets are deleted.
|
|
68
79
|
*/
|
|
69
80
|
export declare const deleteManyAssets: ({ assets, satellite }: {
|
|
@@ -71,15 +82,14 @@ export declare const deleteManyAssets: ({ assets, satellite }: {
|
|
|
71
82
|
collection: string;
|
|
72
83
|
} & Pick<AssetKey, "fullPath">)[];
|
|
73
84
|
satellite?: SatelliteOptions;
|
|
74
|
-
}
|
|
85
|
+
}) => Promise<void>;
|
|
75
86
|
/**
|
|
76
87
|
* Deletes multiple assets from a collection based on filtering criteria.
|
|
77
88
|
*
|
|
78
89
|
* @param {Object} params - The parameters for deleting the assets.
|
|
79
90
|
* @param {string} params.collection - The name of the collection from which to delete assets.
|
|
80
|
-
* @param {SatelliteOptions} [params.satellite] - The satellite options (required only in NodeJS environment).
|
|
81
91
|
* @param {ListParams} [params.filter] - The filter criteria to match assets for deletion.
|
|
82
|
-
*
|
|
92
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
83
93
|
* @returns {Promise<void>} A promise that resolves when the assets matching the filter criteria are deleted.
|
|
84
94
|
*/
|
|
85
95
|
export declare const deleteFilteredAssets: ({ collection, satellite: satelliteOptions, filter }: {
|
|
@@ -89,28 +99,34 @@ export declare const deleteFilteredAssets: ({ collection, satellite: satelliteOp
|
|
|
89
99
|
}) => Promise<void>;
|
|
90
100
|
/**
|
|
91
101
|
* Retrieves an asset from the storage.
|
|
102
|
+
*
|
|
92
103
|
* @param {Object} params - The parameters for retrieving the asset.
|
|
93
104
|
* @param {string} params.collection - The name of the collection.
|
|
94
|
-
* @param {SatelliteOptions} [params.satellite] - The satellite options (required only in NodeJS environment).
|
|
95
105
|
* @param {string} params.fullPath - The full path of the asset.
|
|
106
|
+
* @param {ReadOptions} [params.options] - Call options controlling certification. Defaults to uncertified reads for performance unless specified.
|
|
107
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
96
108
|
* @returns {Promise<AssetNoContent | undefined>} A promise that resolves to the asset or undefined if not found.
|
|
97
109
|
*/
|
|
98
|
-
export declare const getAsset: ({ satellite, ...rest }: {
|
|
110
|
+
export declare const getAsset: ({ satellite, options, ...rest }: {
|
|
99
111
|
collection: string;
|
|
100
112
|
satellite?: SatelliteOptions;
|
|
113
|
+
options?: ReadOptions;
|
|
101
114
|
} & Pick<AssetKey, "fullPath">) => Promise<AssetNoContent | undefined>;
|
|
102
115
|
/**
|
|
103
116
|
* Retrieves multiple assets from the storage.
|
|
117
|
+
*
|
|
104
118
|
* @param {Object} params - The parameters for retrieving the assets.
|
|
105
119
|
* @param {Array} params.assets - The list of assets with their collections and full paths.
|
|
106
|
-
* @param {
|
|
120
|
+
* @param {ReadOptions} [params.options] - Call options controlling certification. Defaults to uncertified reads for performance unless specified.
|
|
121
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
107
122
|
* @returns {Promise<Array<AssetNoContent | undefined>>} A promise that resolves to an array of assets or undefined if not found.
|
|
108
123
|
*/
|
|
109
|
-
export declare const getManyAssets: ({ satellite, ...rest }: {
|
|
124
|
+
export declare const getManyAssets: ({ satellite, options, ...rest }: {
|
|
110
125
|
assets: ({
|
|
111
126
|
collection: string;
|
|
112
127
|
} & Pick<AssetKey, "fullPath">)[];
|
|
113
128
|
satellite?: SatelliteOptions;
|
|
129
|
+
options?: ReadOptions;
|
|
114
130
|
}) => Promise<(AssetNoContent | undefined)[]>;
|
|
115
131
|
/**
|
|
116
132
|
* Returns a public URL for accessing a specific asset stored on a Satellite.
|
|
@@ -136,8 +152,7 @@ export declare const getManyAssets: ({ satellite, ...rest }: {
|
|
|
136
152
|
* @param {Object} params.assetKey - Identifies the asset to generate the URL for.
|
|
137
153
|
* @param {string} params.assetKey.fullPath - The full path of the asset (e.g., `/folder/file.jpg`).
|
|
138
154
|
* @param {string} [params.assetKey.token] - Optional access token for accessing protected assets.
|
|
139
|
-
* @param {SatelliteOptions} [params.satellite] -
|
|
140
|
-
*
|
|
155
|
+
* @param {SatelliteOptions} [params.satellite] - Options to specify a satellite in a NodeJS environment only. In browser environments, the satellite configuration is inherited from the initialization through `initSatellite()`.
|
|
141
156
|
* @returns {string} A full URL pointing to the asset.
|
|
142
157
|
*/
|
|
143
158
|
export declare const downloadUrl: ({ assetKey: { fullPath, token }, satellite: satelliteOptions }: {
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { HttpAgent } from '@dfinity/agent';
|
|
2
|
+
import type { SatelliteContext } from '../types/satellite';
|
|
3
|
+
export type CreateAgentParams = Required<Pick<SatelliteContext, 'identity'>> & Pick<SatelliteContext, 'container'>;
|
|
4
|
+
export declare const createAgent: ({ identity, container }: CreateAgentParams) => Promise<HttpAgent>;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { type ActorSubclass } from '@dfinity/agent';
|
|
2
2
|
import type { ActorMethod } from '@dfinity/agent/lib/esm/actor';
|
|
3
3
|
import type { IDL } from '@dfinity/candid';
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
4
|
+
import type { ActorKey } from '../types/actor';
|
|
5
|
+
import type { SatelliteContext } from '../types/satellite';
|
|
6
6
|
type ActorParams = {
|
|
7
7
|
idlFactory: IDL.InterfaceFactory;
|
|
8
|
-
} & Required<Pick<
|
|
8
|
+
} & Required<Pick<SatelliteContext, 'satelliteId' | 'identity'>> & Pick<SatelliteContext, 'container'>;
|
|
9
9
|
type ActorRecord = Record<string, ActorMethod>;
|
|
10
10
|
export declare class ActorStore {
|
|
11
11
|
#private;
|
|
12
12
|
private static instance;
|
|
13
13
|
private constructor();
|
|
14
14
|
static getInstance(): ActorStore;
|
|
15
|
-
getActor<T = ActorRecord>({ satelliteId, identity,
|
|
16
|
-
|
|
15
|
+
getActor<T = ActorRecord>({ satelliteId, identity, actorKey, ...rest }: ActorParams & {
|
|
16
|
+
actorKey: ActorKey;
|
|
17
17
|
}): Promise<ActorSubclass<T>>;
|
|
18
18
|
reset(): void;
|
|
19
19
|
private createActor;
|