@junobuild/core-peer 0.0.14 → 0.0.16

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.
@@ -1,5 +1,5 @@
1
1
  import type { User } from './types/auth.types';
2
- import type { Environment } from './types/env.types';
2
+ import type { UserEnvironment } from './types/env.types';
3
3
  import type { Unsubscribe } from './types/subscription.types';
4
4
  export * from './providers/auth.providers';
5
5
  export { signIn, signOut, unsafeIdentity } from './services/auth.services';
@@ -12,5 +12,24 @@ export { ListOrder, ListPaginate, ListParams, ListResults } from './types/list.t
12
12
  export * from './types/satellite.types';
13
13
  export * from './types/storage.types';
14
14
  export * from './types/subscription.types';
15
- export declare const initJuno: (env: Environment) => Promise<Unsubscribe[]>;
15
+ /**
16
+ * Initializes Juno with the provided optional environment parameters.
17
+ * If no environment is provided, the variables injected by the Vite or NextJS plugins will be used.
18
+ * @deprecated Use {@link initSatellite} instead.
19
+ * @param {UserEnvironment} [userEnv] - The optional user environment configuration.
20
+ * @returns {Promise<Unsubscribe[]>} A promise that resolves to an array of unsubscribe functions.
21
+ */
22
+ export declare const initJuno: (userEnv?: UserEnvironment) => Promise<Unsubscribe[]>;
23
+ /**
24
+ * Initializes a Juno satellite with the provided optional environment parameters.
25
+ * If no environment is provided, the variables injected by the Vite or NextJS plugins will be used.
26
+ * @param {UserEnvironment} [userEnv] - The optional user environment configuration.
27
+ * @returns {Promise<Unsubscribe[]>} A promise that resolves to an array of unsubscribe functions.
28
+ */
29
+ export declare const initSatellite: (userEnv?: UserEnvironment) => Promise<Unsubscribe[]>;
30
+ /**
31
+ * Subscribes to authentication state changes. i.e. each time a user signs in or signs out, the callback will be triggered.
32
+ * @param {function(User | null): void} callback - The callback function to execute when the authentication state changes.
33
+ * @returns {Unsubscribe} A function to unsubscribe from the authentication state changes.
34
+ */
16
35
  export declare const authSubscribe: (callback: (authUser: User | null) => void) => Unsubscribe;
@@ -1,21 +1,79 @@
1
1
  import type { InternetIdentityConfig, NFIDConfig, Provider, SignInOptions } from '../types/auth.types';
2
+ /**
3
+ * Options for signing in with an authentication provider.
4
+ * @interface AuthProviderSignInOptions
5
+ */
2
6
  export interface AuthProviderSignInOptions {
7
+ /**
8
+ * The URL of the identity provider - commonly Internet Identity.
9
+ */
3
10
  identityProvider: string;
11
+ /**
12
+ * Optional features for the window opener.
13
+ */
4
14
  windowOpenerFeatures?: string;
5
15
  }
16
+ /**
17
+ * Common traits for all authentication providers
18
+ * @interface AuthProvider
19
+ */
6
20
  export interface AuthProvider {
21
+ /**
22
+ * The unique identifier of the provider.
23
+ */
7
24
  readonly id: Provider;
25
+ /**
26
+ * Method to get the sign-in options for the provider.
27
+ * @param options - The sign-in options.
28
+ * @returns The sign-in options for the provider that can be use to effectively perform a sign-in.
29
+ */
8
30
  signInOptions: (options: Pick<SignInOptions, 'windowed'>) => AuthProviderSignInOptions;
9
31
  }
32
+ /**
33
+ * Internet Identity authentication provider.
34
+ * @class InternetIdentityProvider
35
+ * @implements {AuthProvider}
36
+ */
10
37
  export declare class InternetIdentityProvider implements AuthProvider {
11
38
  #private;
39
+ /**
40
+ * Creates an instance of InternetIdentityProvider.
41
+ * @param {InternetIdentityConfig} config - The configuration for Internet Identity.
42
+ */
12
43
  constructor({ domain }: InternetIdentityConfig);
44
+ /**
45
+ * Gets the identifier of the provider.
46
+ * @returns {Provider} The identifier of the provider - `internet_identity`.
47
+ */
13
48
  get id(): Provider;
49
+ /**
50
+ * Gets the sign-in options for Internet Identity.
51
+ * @param {Pick<SignInOptions, 'windowed'>} options - The sign-in options.
52
+ * @returns {AuthProviderSignInOptions} The sign-in options for Internet Identity.
53
+ */
14
54
  signInOptions({ windowed }: Pick<SignInOptions, 'windowed'>): AuthProviderSignInOptions;
15
55
  }
56
+ /**
57
+ * NFID authentication provider.
58
+ * @class NFIDProvider
59
+ * @implements {AuthProvider}
60
+ */
16
61
  export declare class NFIDProvider implements AuthProvider {
17
62
  #private;
63
+ /**
64
+ * Creates an instance of NFIDProvider.
65
+ * @param {NFIDConfig} config - The configuration for NFID.
66
+ */
18
67
  constructor({ appName, logoUrl }: NFIDConfig);
68
+ /**
69
+ * Gets the identifier of the provider.
70
+ * @returns {Provider} The identifier of the provider- nfid.
71
+ */
19
72
  get id(): Provider;
73
+ /**
74
+ * Gets the sign-in options for NFID.
75
+ * @param {Pick<SignInOptions, 'windowed'>} options - The sign-in options.
76
+ * @returns {AuthProviderSignInOptions} The sign-in options to effectively sign-in with NFID.
77
+ */
20
78
  signInOptions({ windowed }: Pick<SignInOptions, 'windowed'>): AuthProviderSignInOptions;
21
79
  }
@@ -1,11 +1,23 @@
1
1
  import type { Identity } from '@dfinity/agent';
2
2
  import type { Provider, SignInOptions } from '../types/auth.types';
3
3
  export declare const initAuth: (provider?: Provider) => Promise<void>;
4
+ /**
5
+ * Signs in a user with the specified options.
6
+ * @param {SignInOptions} [options] - The options for signing in.
7
+ * @returns {Promise<void>} A promise that resolves when the sign-in process is complete and the authenticated user is initialized.
8
+ * @throws Will throw an error if the sign-in process fails.
9
+ */
4
10
  export declare const signIn: (options?: SignInOptions) => Promise<void>;
11
+ /**
12
+ * Signs out the current user.
13
+ * @returns {Promise<void>} A promise that resolves when the sign-out process is complete.
14
+ */
5
15
  export declare const signOut: () => Promise<void>;
6
16
  export declare const getIdentity: () => Identity | undefined;
7
17
  /**
8
- * Return what can be the identity of a sign-in user or an anonymous identity.
9
- * Useful to load an identity in web workers.
18
+ * Returns the identity of a signed-in user or an anonymous identity.
19
+ * This function is useful for loading an identity in web workers.
20
+ * Used to imperatively get the identity. Please be certain before using it.
21
+ * @returns {Promise<Identity>} A promise that resolves to the identity of the user or an anonymous identity.
10
22
  */
11
23
  export declare const unsafeIdentity: () => Promise<Identity>;
@@ -1,21 +1,53 @@
1
1
  import type { Doc } from '../types/doc.types';
2
2
  import type { ListParams, ListResults } from '../types/list.types';
3
3
  import type { SatelliteOptions } from '../types/satellite.types';
4
+ /**
5
+ * Retrieves a single document from a collection.
6
+ * @template D
7
+ * @param {Object} params - The parameters for retrieving the document.
8
+ * @param {string} params.collection - The name of the collection.
9
+ * @param {SatelliteOptions} [params.satellite] - Options for the satellite (useful for NodeJS usage only).
10
+ * @param {string} params.key - The key of the document to retrieve.
11
+ * @returns {Promise<Doc<D> | undefined>} A promise that resolves to the document or undefined if not found.
12
+ */
4
13
  export declare const getDoc: <D>({ satellite, ...rest }: {
5
14
  collection: string;
6
15
  satellite?: SatelliteOptions;
7
16
  } & Pick<Doc<D>, 'key'>) => Promise<Doc<D> | undefined>;
17
+ /**
18
+ * Retrieves multiple documents from a single or different collections in a single call.
19
+ * @param {Object} params - The parameters for retrieving the documents.
20
+ * @param {Array} params.docs - The list of documents with their collections and keys.
21
+ * @param {SatelliteOptions} [params.satellite] - Options for the satellite (useful for NodeJS usage only).
22
+ * @returns {Promise<Array<Doc<any> | undefined>>} A promise that resolves to an array of documents or undefined if not found.
23
+ */
8
24
  export declare const getManyDocs: ({ satellite, ...rest }: {
9
25
  docs: ({
10
26
  collection: string;
11
27
  } & Pick<Doc<any>, 'key'>)[];
12
28
  satellite?: SatelliteOptions;
13
29
  }) => Promise<(Doc<any> | undefined)[]>;
30
+ /**
31
+ * Adds or updates a single document in a collection.
32
+ * @template D
33
+ * @param {Object} params - The parameters for adding or updating the document.
34
+ * @param {string} params.collection - The name of the collection.
35
+ * @param {Doc<D>} params.doc - The document to add or update.
36
+ * @param {SatelliteOptions} [params.satellite] - Options for the satellite (useful for NodeJS usage only).
37
+ * @returns {Promise<Doc<D>>} A promise that resolves to the added or updated document.
38
+ */
14
39
  export declare const setDoc: <D>({ satellite, ...rest }: {
15
40
  collection: string;
16
41
  doc: Doc<D>;
17
42
  satellite?: SatelliteOptions;
18
43
  }) => Promise<Doc<D>>;
44
+ /**
45
+ * Adds or updates multiple documents in a or different collections.
46
+ * @param {Object} params - The parameters for adding or updating the documents.
47
+ * @param {Array} params.docs - The list of documents with their collections and data.
48
+ * @param {SatelliteOptions} [params.satellite] - Options for the satellite (useful for NodeJS usage only).
49
+ * @returns {Promise<Array<Doc<any>>>} A promise that resolves to an array of added or updated documents.
50
+ */
19
51
  export declare const setManyDocs: ({ satellite, ...rest }: {
20
52
  docs: {
21
53
  collection: string;
@@ -23,11 +55,27 @@ export declare const setManyDocs: ({ satellite, ...rest }: {
23
55
  }[];
24
56
  satellite?: SatelliteOptions;
25
57
  }) => Promise<Doc<any>[]>;
58
+ /**
59
+ * Deletes a single document from a collection.
60
+ * @template D
61
+ * @param {Object} params - The parameters for deleting the document.
62
+ * @param {string} params.collection - The name of the collection.
63
+ * @param {Doc<D>} params.doc - The document to delete.
64
+ * @param {SatelliteOptions} [params.satellite] - Options for the satellite (useful for NodeJS usage only).
65
+ * @returns {Promise<void>} A promise that resolves when the document is deleted.
66
+ */
26
67
  export declare const deleteDoc: <D>({ satellite, ...rest }: {
27
68
  collection: string;
28
69
  doc: Doc<D>;
29
70
  satellite?: SatelliteOptions;
30
71
  }) => Promise<void>;
72
+ /**
73
+ * Deletes multiple documents from a or different collections.
74
+ * @param {Object} params - The parameters for deleting the documents.
75
+ * @param {Array} params.docs - The list of documents with their collections and data.
76
+ * @param {SatelliteOptions} [params.satellite] - Options for the satellite (useful for NodeJS usage only).
77
+ * @returns {Promise<void>} A promise that resolves when the documents are deleted.
78
+ */
31
79
  export declare const deleteManyDocs: ({ satellite, ...rest }: {
32
80
  docs: {
33
81
  collection: string;
@@ -35,6 +83,15 @@ export declare const deleteManyDocs: ({ satellite, ...rest }: {
35
83
  }[];
36
84
  satellite?: SatelliteOptions;
37
85
  }) => Promise<void>;
86
+ /**
87
+ * Lists documents in a collection with optional filtering.
88
+ * @template D
89
+ * @param {Object} params - The parameters for listing the documents.
90
+ * @param {string} params.collection - The name of the collection.
91
+ * @param {ListParams} [params.filter] - Optional filter parameters.
92
+ * @param {SatelliteOptions} [params.satellite] - Options for the satellite (useful for NodeJS usage only).
93
+ * @returns {Promise<ListResults<Doc<D>>>} A promise that resolves to the list of documents.
94
+ */
38
95
  export declare const listDocs: <D>({ satellite, filter, ...rest }: {
39
96
  collection: string;
40
97
  filter?: ListParams;
@@ -2,33 +2,81 @@ import type { AssetNoContent } from '../../declarations/satellite/satellite.did'
2
2
  import type { ListParams } from '../types/list.types';
3
3
  import type { SatelliteOptions } from '../types/satellite.types';
4
4
  import type { AssetKey, Assets, Storage } from '../types/storage.types';
5
+ /**
6
+ * Uploads a blob to the storage.
7
+ * @param {Storage & {satellite?: SatelliteOptions}} params - The storage parameters. Satellite options are required only in NodeJS environment.
8
+ * @returns {Promise<AssetKey>} A promise that resolves to the asset key.
9
+ */
5
10
  export declare const uploadBlob: (params: Storage & {
6
11
  satellite?: SatelliteOptions;
7
12
  }) => Promise<AssetKey>;
13
+ /**
14
+ * Uploads a file to the storage.
15
+ * @param {Partial<Pick<Storage, 'filename'>> & Omit<Storage, 'filename' | 'data'> & {data: File} & {satellite?: SatelliteOptions}} params - The storage parameters. Satellite options are required only in NodeJS environment.
16
+ * @returns {Promise<AssetKey>} A promise that resolves to the asset key.
17
+ */
8
18
  export declare const uploadFile: (params: Partial<Pick<Storage, 'filename'>> & Omit<Storage, 'filename' | 'data'> & {
9
19
  data: File;
10
20
  } & {
11
21
  satellite?: SatelliteOptions;
12
22
  }) => Promise<AssetKey>;
23
+ /**
24
+ * Lists assets in a collection with optional filtering.
25
+ * @param {Object} params - The parameters for listing the assets.
26
+ * @param {string} params.collection - The name of the collection.
27
+ * @param {SatelliteOptions} [params.satellite] - The satellite options (required only in NodeJS environment).
28
+ * @param {ListParams} [params.filter] - The filter parameters.
29
+ * @returns {Promise<Assets>} A promise that resolves to the list of assets.
30
+ */
13
31
  export declare const listAssets: ({ collection, satellite: satelliteOptions, filter }: {
14
32
  collection: string;
15
33
  satellite?: SatelliteOptions;
16
34
  filter?: ListParams;
17
35
  }) => Promise<Assets>;
36
+ /**
37
+ * Deletes an asset from the storage.
38
+ * @param {Object} params - The parameters for deleting the asset.
39
+ * @param {string} params.collection - The name of the collection.
40
+ * @param {SatelliteOptions} [params.satellite] - The satellite options (required only in NodeJS environment).
41
+ * @param {string} params.fullPath - The full path of the asset.
42
+ * @returns {Promise<void>} A promise that resolves when the asset is deleted.
43
+ */
18
44
  export declare const deleteAsset: ({ collection, fullPath, satellite }: {
19
45
  collection: string;
20
46
  satellite?: SatelliteOptions;
21
47
  } & Pick<AssetKey, 'fullPath'>) => Promise<void>;
48
+ /**
49
+ * Deletes multiple assets from the storage.
50
+ * @param {Object} params - The parameters for deleting the assets.
51
+ * @param {Array} params.assets - The list of assets with their collections and full paths.
52
+ * @param {SatelliteOptions} [params.satellite] - The satellite options (required only in NodeJS environment).
53
+ * @returns {Promise<void>} A promise that resolves when the assets are deleted.
54
+ */
22
55
  export declare const deleteManyAssets: ({ assets, satellite }: {
23
56
  assets: ({
24
57
  collection: string;
25
58
  } & Pick<AssetKey, 'fullPath'>)[];
26
59
  satellite?: SatelliteOptions;
27
60
  } & Pick<AssetKey, 'fullPath'>) => Promise<void>;
61
+ /**
62
+ * Retrieves an asset from the storage.
63
+ * @param {Object} params - The parameters for retrieving the asset.
64
+ * @param {string} params.collection - The name of the collection.
65
+ * @param {SatelliteOptions} [params.satellite] - The satellite options (required only in NodeJS environment).
66
+ * @param {string} params.fullPath - The full path of the asset.
67
+ * @returns {Promise<AssetNoContent | undefined>} A promise that resolves to the asset or undefined if not found.
68
+ */
28
69
  export declare const getAsset: ({ satellite, ...rest }: {
29
70
  collection: string;
30
71
  satellite?: SatelliteOptions;
31
72
  } & Pick<AssetKey, 'fullPath'>) => Promise<AssetNoContent | undefined>;
73
+ /**
74
+ * Retrieves multiple assets from the storage.
75
+ * @param {Object} params - The parameters for retrieving the assets.
76
+ * @param {Array} params.assets - The list of assets with their collections and full paths.
77
+ * @param {SatelliteOptions} [params.satellite] - The satellite options (required only in NodeJS environment).
78
+ * @returns {Promise<Array<AssetNoContent | undefined>>} A promise that resolves to an array of assets or undefined if not found.
79
+ */
32
80
  export declare const getManyAssets: ({ satellite, ...rest }: {
33
81
  assets: ({
34
82
  collection: string;
@@ -1,22 +1,90 @@
1
1
  import type { InternetIdentityProvider, NFIDProvider } from '../providers/auth.providers';
2
2
  import type { Doc } from './doc.types';
3
+ /**
4
+ * Type representing the available authentication providers.
5
+ * @typedef {('internet_identity' | 'nfid')} Provider
6
+ */
3
7
  export type Provider = 'internet_identity' | 'nfid';
8
+ /**
9
+ * Interface representing user data.
10
+ * @interface UserData
11
+ */
4
12
  export interface UserData {
13
+ /**
14
+ * The potential provider used to sign-in. There is no guarantee that the information can be set by the browser during the sign-in flow, therefore it is optional.
15
+ * @type {Provider}
16
+ */
5
17
  provider?: Provider;
6
18
  }
19
+ /**
20
+ * Type representing a user document.
21
+ * @typedef {Doc<UserData>} User
22
+ */
7
23
  export type User = Doc<UserData>;
24
+ /**
25
+ * Interface representing sign-in options.
26
+ * @interface SignInOptions
27
+ */
8
28
  export interface SignInOptions {
29
+ /**
30
+ * Maximum time to live for the session. Cannot be extended.
31
+ * @type {bigint}
32
+ */
9
33
  maxTimeToLive?: bigint;
34
+ /**
35
+ * Origin for derivation. Useful when sign-in using the same domain - e.g. sign-in on www.hello.com for hello.com.
36
+ * @type {(string | URL)}
37
+ */
10
38
  derivationOrigin?: string | URL;
39
+ /**
40
+ * Whether to open the sign-in window.
41
+ * @default true
42
+ * @type {boolean}
43
+ */
11
44
  windowed?: boolean;
45
+ /**
46
+ * Whether to allow the infamous PIN authentication.
47
+ * @default false
48
+ * @type {boolean}
49
+ */
12
50
  allowPin?: boolean;
51
+ /**
52
+ * The authentication provider to use.
53
+ * @default InternetIdentityProvider
54
+ * @type {(InternetIdentityProvider | NFIDProvider)}
55
+ */
13
56
  provider?: InternetIdentityProvider | NFIDProvider;
14
57
  }
58
+ /**
59
+ * Type representing the available Internet Identity domains.
60
+ * @typedef {('internetcomputer.org' | 'ic0.app')} InternetIdentityDomain
61
+ */
15
62
  export type InternetIdentityDomain = 'internetcomputer.org' | 'ic0.app';
63
+ /**
64
+ * Interface representing the configuration for Internet Identity.
65
+ * @interface InternetIdentityConfig
66
+ */
16
67
  export interface InternetIdentityConfig {
68
+ /**
69
+ * The domain for Internet Identity.
70
+ * @default internetcomputer.org
71
+ * @type {InternetIdentityDomain}
72
+ */
17
73
  domain?: InternetIdentityDomain;
18
74
  }
75
+ /**
76
+ * Interface representing the configuration for NFID.
77
+ * @interface NFIDConfig
78
+ */
19
79
  export interface NFIDConfig {
80
+ /**
81
+ * The name of the application.
82
+ * @type {string}
83
+ */
20
84
  appName: string;
85
+ /**
86
+ * The URL of the application's logo.
87
+ * @type {string}
88
+ */
21
89
  logoUrl: string;
22
90
  }
@@ -1,9 +1,42 @@
1
+ /**
2
+ * Represents a document stored in a collection.
3
+ * @template D - The type of data contained in the document.
4
+ * @interface
5
+ */
1
6
  export interface Doc<D> {
7
+ /**
8
+ * The unique key identifying the document within the collection.
9
+ * @type {string}
10
+ */
2
11
  key: string;
12
+ /**
13
+ * An optional description of the document which can also be used to filter document when listing those.
14
+ * @type {string}
15
+ */
3
16
  description?: string;
17
+ /**
18
+ * The data contained in the document.
19
+ * @type {D}
20
+ */
4
21
  data: D;
22
+ /**
23
+ * The owner of the document.
24
+ * @type {string}
25
+ */
5
26
  owner?: string;
27
+ /**
28
+ * The timestamp when the document was created.
29
+ * @type {bigint}
30
+ */
6
31
  created_at?: bigint;
32
+ /**
33
+ * The timestamp when the document was last updated.
34
+ * @type {bigint}
35
+ */
7
36
  updated_at?: bigint;
37
+ /**
38
+ * The version of the document. When updating a document, the current version must be provided to ensure the correct document is updated.
39
+ * @type {bigint}
40
+ */
8
41
  version?: bigint;
9
42
  }
@@ -1,10 +1,43 @@
1
1
  import type { Satellite } from './satellite.types';
2
+ /**
3
+ * Represents the path to a web worker.
4
+ * @typedef {string} EnvironmentWorkerPath
5
+ */
2
6
  export type EnvironmentWorkerPath = string;
7
+ /**
8
+ * Represents a web worker which can be a enable for default path or provided with a specific path string.
9
+ * @typedef {true | EnvironmentWorkerPath} EnvironmentWorker
10
+ */
3
11
  export type EnvironmentWorker = true | EnvironmentWorkerPath;
12
+ /**
13
+ * Represents the environment workers.
14
+ * @interface
15
+ */
4
16
  export interface EnvironmentWorkers {
17
+ /**
18
+ * The authentication worker configuration. A worker which takes cares of validating the session and if expired, triggers an event to ultimately logout the user automatically.
19
+ * @type {EnvironmentWorker}
20
+ */
5
21
  auth?: EnvironmentWorker;
6
22
  }
23
+ /**
24
+ * The environment configuration.
25
+ * @typedef {Object} Environment
26
+ * @property {string} [internetIdentityId] - The optional Internet Identity ID. Generally not provided.
27
+ * @property {EnvironmentWorkers} [workers] - The optional web workers configuration.
28
+ * @property {string} satelliteId - The satellite ID (required).
29
+ * @property {string} [container] - The container. Commonly true to use local development with Docker.
30
+ */
7
31
  export type Environment = {
8
32
  internetIdentityId?: string;
9
33
  workers?: EnvironmentWorkers;
10
34
  } & Required<Pick<Satellite, 'satelliteId'>> & Pick<Satellite, 'container'>;
35
+ /**
36
+ * Represents the user environment configuration. i.e. the optional parameters the user is providing to initialize Juno.
37
+ * @typedef {Object} UserEnvironment
38
+ * @property {string} [internetIdentityId] - The optional Internet Identity ID. Generally not provided.
39
+ * @property {EnvironmentWorkers} [workers] - The environment workers configuration.
40
+ * @property {string} satelliteId - An optional satellite ID. If not provided, the library tries to load the information injected by the Vite and NextJS plugins.
41
+ * @property {string} [container] - The container. If not provided, the library tries to load the information injected by the Vite and NextJS plugins.
42
+ */
43
+ export type UserEnvironment = Omit<Environment, 'satelliteId'> & Pick<Satellite, 'satelliteId'>;
@@ -1,28 +1,117 @@
1
1
  import type { Principal } from '@dfinity/principal';
2
+ /**
3
+ * Represents the results of a list call.
4
+ * @template T - The type of items in the list.
5
+ * @interface
6
+ */
2
7
  export interface ListResults<T> {
8
+ /**
9
+ * The data - e.g., the documents or assets depending on which list was called.
10
+ * @type {T[]}
11
+ */
3
12
  items: T[];
13
+ /**
14
+ * The number of items - basically items.length.
15
+ * @type {bigint}
16
+ */
4
17
  items_length: bigint;
18
+ /**
19
+ * If the query is paginated, the page number (starting from 0) where the items are found.
20
+ * @type {bigint}
21
+ */
5
22
  items_page?: bigint;
23
+ /**
24
+ * The total number of matching results.
25
+ * @type {bigint}
26
+ */
6
27
  matches_length: bigint;
28
+ /**
29
+ * If the query is paginated, the total number of pages (starting from 0).
30
+ * @type {bigint}
31
+ */
7
32
  matches_pages?: bigint;
8
33
  }
34
+ /**
35
+ * Represents pagination parameters for a list call.
36
+ * @interface
37
+ */
9
38
  export interface ListPaginate {
39
+ /**
40
+ * The key to start after for pagination.
41
+ * @type {string}
42
+ */
10
43
  startAfter?: string;
44
+ /**
45
+ * The maximum number of items to return.
46
+ * @type {number}
47
+ */
11
48
  limit?: number;
12
49
  }
50
+ /**
51
+ * Type representing the fields by which the list can be ordered.
52
+ * @typedef {('keys' | 'updated_at' | 'created_at')} ListOrderField
53
+ */
13
54
  export type ListOrderField = 'keys' | 'updated_at' | 'created_at';
55
+ /**
56
+ * Represents the order parameters for a list cal.
57
+ * @interface
58
+ */
14
59
  export interface ListOrder {
60
+ /**
61
+ * Whether the order is descending.
62
+ * @type {boolean}
63
+ */
15
64
  desc: boolean;
65
+ /**
66
+ * The field by which to order the list.
67
+ * @type {ListOrderField}
68
+ */
16
69
  field: ListOrderField;
17
70
  }
71
+ /**
72
+ * Type representing the owner of a list item, either a string or a Principal.
73
+ * @typedef {(string | Principal)} ListOwner
74
+ */
18
75
  export type ListOwner = string | Principal;
76
+ /**
77
+ * Represents matching parameters for a list call.
78
+ * @interface
79
+ */
19
80
  export interface ListMatcher {
81
+ /**
82
+ * The key to match. Support Regex (must comply with Rust regex).
83
+ * @type {string}
84
+ */
20
85
  key?: string;
86
+ /**
87
+ * The description to match. Support Regex (must comply with Rust regex).
88
+ * @type {string}
89
+ */
21
90
  description?: string;
22
91
  }
92
+ /**
93
+ * Represents the parameters for a list query.
94
+ * @interface
95
+ */
23
96
  export interface ListParams {
97
+ /**
98
+ * The matcher parameters for the query.
99
+ * @type {ListMatcher}
100
+ */
24
101
  matcher?: ListMatcher;
102
+ /**
103
+ * The pagination parameters for the query.
104
+ * @type {ListPaginate}
105
+ */
25
106
  paginate?: ListPaginate;
107
+ /**
108
+ * The order parameters for the query.
109
+ * @type {ListOrder}
110
+ */
26
111
  order?: ListOrder;
112
+ /**
113
+ * The owner of the items to match.
114
+ * @type {ListOwner}
115
+ */
27
116
  owner?: ListOwner;
28
117
  }
@@ -1,8 +1,32 @@
1
1
  import type { Identity } from '@dfinity/agent';
2
+ /**
3
+ * Represents the configuration for a satellite.
4
+ * @interface
5
+ */
2
6
  export interface Satellite {
7
+ /**
8
+ * The identity associated with the satellite.
9
+ * @type {Identity}
10
+ */
3
11
  identity: Identity;
12
+ /**
13
+ * The unique identifier for the satellite.
14
+ * @type {string}
15
+ */
4
16
  satelliteId?: string;
17
+ /**
18
+ * A custom fetch function to use for network requests.
19
+ * @type {typeof fetch}
20
+ */
5
21
  fetch?: typeof fetch;
22
+ /**
23
+ * Specifies whether the satellite is running in a container or provides the container URL. i.e. URL to Docker local development.
24
+ * @type {boolean | string}
25
+ */
6
26
  container?: boolean | string;
7
27
  }
28
+ /**
29
+ * Represents partial configuration options for a satellite. To be used only on NodeJS or rarely used for browser.
30
+ * @typedef {Partial<Satellite>} SatelliteOptions
31
+ */
8
32
  export type SatelliteOptions = Partial<Satellite>;