@junobuild/functions 0.0.12 → 0.0.13-next-2025-04-01

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/schemas/db.d.ts CHANGED
@@ -1,13 +1,6 @@
1
1
  import * as z from 'zod';
2
2
  import { Uint8ArraySchema } from './candid';
3
- /**
4
- * @see DocDescription
5
- */
6
- export declare const DocDescriptionSchema: z.ZodString;
7
- /**
8
- * Represents a document description with a maximum length of 1024 characters.
9
- */
10
- export type DocDescription = z.infer<typeof DocDescriptionSchema>;
3
+ import { Description, type RawUserId, type Timestamp, type Version } from './satellite';
11
4
  /**
12
5
  * @see RawData
13
6
  */
@@ -22,30 +15,66 @@ export type RawData = z.infer<typeof Uint8ArraySchema>;
22
15
  * @see Doc
23
16
  */
24
17
  export declare const DocSchema: z.ZodObject<{
18
+ owner: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
19
+ data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
20
+ description: z.ZodOptional<z.ZodString>;
21
+ created_at: z.ZodBigInt;
22
+ updated_at: z.ZodBigInt;
23
+ version: z.ZodOptional<z.ZodBigInt>;
24
+ }, "strict", z.ZodTypeAny, {
25
+ owner: Uint8Array<ArrayBufferLike>;
26
+ data: Uint8Array<ArrayBufferLike>;
27
+ created_at: bigint;
28
+ updated_at: bigint;
29
+ description?: string | undefined;
30
+ version?: bigint | undefined;
31
+ }, {
32
+ owner: Uint8Array<ArrayBufferLike>;
33
+ data: Uint8Array<ArrayBufferLike>;
34
+ created_at: bigint;
35
+ updated_at: bigint;
36
+ description?: string | undefined;
37
+ version?: bigint | undefined;
38
+ }>;
39
+ /**
40
+ * Represents a document stored in a collection.
41
+ */
42
+ export interface Doc {
25
43
  /**
26
44
  * The user who owns this document.
27
45
  */
28
- owner: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
46
+ owner: RawUserId;
29
47
  /**
30
48
  * The raw data of the document.
31
49
  */
32
- data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
50
+ data: RawData;
33
51
  /**
34
52
  * An optional description of the document.
35
53
  */
36
- description: z.ZodOptional<z.ZodString>;
54
+ description?: Description;
37
55
  /**
38
56
  * The timestamp when the document was first created.
39
57
  */
40
- created_at: z.ZodBigInt;
58
+ created_at: Timestamp;
41
59
  /**
42
60
  * The timestamp when the document was last updated.
43
61
  */
44
- updated_at: z.ZodBigInt;
62
+ updated_at: Timestamp;
45
63
  /**
46
64
  * The version number of the document, used for consistency checks.
47
65
  * If not provided, it's assumed to be the first version.
48
66
  */
67
+ version?: Version;
68
+ }
69
+ /**
70
+ * @see OptionDoc
71
+ */
72
+ export declare const OptionDocSchema: z.ZodOptional<z.ZodObject<{
73
+ owner: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
74
+ data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
75
+ description: z.ZodOptional<z.ZodString>;
76
+ created_at: z.ZodBigInt;
77
+ updated_at: z.ZodBigInt;
49
78
  version: z.ZodOptional<z.ZodBigInt>;
50
79
  }, "strict", z.ZodTypeAny, {
51
80
  owner: Uint8Array<ArrayBufferLike>;
@@ -61,8 +90,62 @@ export declare const DocSchema: z.ZodObject<{
61
90
  updated_at: bigint;
62
91
  description?: string | undefined;
63
92
  version?: bigint | undefined;
93
+ }>>;
94
+ /**
95
+ * A shorthand for a document that might or not be defined.
96
+ */
97
+ export type OptionDoc = Doc | undefined;
98
+ /**
99
+ * @see SetDoc
100
+ */
101
+ export declare const SetDocSchema: z.ZodObject<{
102
+ data: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
103
+ description: z.ZodOptional<z.ZodString>;
104
+ version: z.ZodOptional<z.ZodBigInt>;
105
+ }, "strict", z.ZodTypeAny, {
106
+ data: Uint8Array<ArrayBufferLike>;
107
+ description?: string | undefined;
108
+ version?: bigint | undefined;
109
+ }, {
110
+ data: Uint8Array<ArrayBufferLike>;
111
+ description?: string | undefined;
112
+ version?: bigint | undefined;
64
113
  }>;
65
114
  /**
66
- * Represents a document stored in a collection.
115
+ * Represents the proposed version of a document to be created or updated.
116
+ * This can be validated before allowing the operation.
117
+ */
118
+ export interface SetDoc {
119
+ /**
120
+ * The raw data of the document.
121
+ */
122
+ data: RawData;
123
+ /**
124
+ * An optional description of the document.
125
+ */
126
+ description?: Description;
127
+ /**
128
+ * The expected version number to ensure consistency.
129
+ */
130
+ version?: Version;
131
+ }
132
+ /**
133
+ * @see DelDoc
67
134
  */
68
- export type Doc = z.infer<typeof DocSchema>;
135
+ export declare const DelDocSchema: z.ZodObject<{
136
+ version: z.ZodOptional<z.ZodBigInt>;
137
+ }, "strict", z.ZodTypeAny, {
138
+ version?: bigint | undefined;
139
+ }, {
140
+ version?: bigint | undefined;
141
+ }>;
142
+ /**
143
+ * Represents the proposed version of a document to be deleted.
144
+ * This can be validated before allowing the operation.
145
+ */
146
+ export interface DelDoc {
147
+ /**
148
+ * The expected version number to ensure consistency.
149
+ */
150
+ version?: Version;
151
+ }
@@ -55,3 +55,12 @@ export declare const KeySchema: z.ZodString;
55
55
  * A unique key identifier within a collection.
56
56
  */
57
57
  export type Key = z.infer<typeof KeySchema>;
58
+ /**
59
+ * @see Description
60
+ */
61
+ export declare const DescriptionSchema: z.ZodString;
62
+ /**
63
+ * Represents a description with a maximum length of 1024 characters.
64
+ * Used for document and asset fields which can be useful for search purpose.
65
+ */
66
+ export type Description = z.infer<typeof DescriptionSchema>;
@@ -0,0 +1,307 @@
1
+ import * as z from 'zod';
2
+ import { type Collection, type Description, type RawUserId, type Timestamp, type Version } from './satellite';
3
+ /**
4
+ * Represents a single HTTP header as a tuple of name and value.
5
+ */
6
+ export type HeaderField = [string, string];
7
+ /**
8
+ * Binary content used in asset encoding.
9
+ */
10
+ export type Blob = Uint8Array;
11
+ /**
12
+ * When stable memory is used, chunks are saved within a StableBTreeMap and their keys - StableEncodingChunkKey - are saved for reference as serialized values
13
+ */
14
+ export type BlobOrKey = Uint8Array;
15
+ /**
16
+ * Represents a SHA-256 hash as a 32-byte binary value.
17
+ */
18
+ export type Hash = Uint8Array;
19
+ /**
20
+ * Metadata identifying an asset within a collection and the storage system.
21
+ */
22
+ export interface AssetKey {
23
+ /**
24
+ * The name of the asset (e.g., "logo.png").
25
+ */
26
+ name: string;
27
+ /**
28
+ * The full relative path of the asset (e.g., "/images/logo.png").
29
+ */
30
+ full_path: string;
31
+ /**
32
+ * Optional access token for the asset.
33
+ * If set, can be used using a query parameter e.g. /full_path/?token=1223-3345-5564-3333
34
+ */
35
+ token?: string;
36
+ /**
37
+ * The collection to which this asset belongs.
38
+ */
39
+ collection: Collection;
40
+ /**
41
+ * The owner of the asset.
42
+ */
43
+ owner: RawUserId;
44
+ /**
45
+ * Optional description of the asset for indexing/search.
46
+ */
47
+ description?: Description;
48
+ }
49
+ /**
50
+ * Represents a specific encoding of an asset, such as "gzip" or "identity" (no compression).
51
+ */
52
+ export interface AssetEncoding {
53
+ /**
54
+ * Timestamp when the encoding was last modified.
55
+ */
56
+ modified: Timestamp;
57
+ /**
58
+ * Chunks of binary content or references to them.
59
+ */
60
+ content_chunks: BlobOrKey[];
61
+ /**
62
+ * Total byte size of the encoded content.
63
+ */
64
+ total_length: bigint;
65
+ /**
66
+ * SHA-256 hash of the encoded content.
67
+ */
68
+ sha256: Hash;
69
+ }
70
+ /**
71
+ * @see Asset
72
+ */
73
+ export declare const AssetSchema: z.ZodObject<{
74
+ key: z.ZodObject<{
75
+ name: z.ZodString;
76
+ full_path: z.ZodString;
77
+ token: z.ZodOptional<z.ZodString>;
78
+ collection: z.ZodString;
79
+ owner: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
80
+ description: z.ZodOptional<z.ZodString>;
81
+ }, "strip", z.ZodTypeAny, {
82
+ owner: Uint8Array<ArrayBufferLike>;
83
+ collection: string;
84
+ name: string;
85
+ full_path: string;
86
+ description?: string | undefined;
87
+ token?: string | undefined;
88
+ }, {
89
+ owner: Uint8Array<ArrayBufferLike>;
90
+ collection: string;
91
+ name: string;
92
+ full_path: string;
93
+ description?: string | undefined;
94
+ token?: string | undefined;
95
+ }>;
96
+ headers: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">;
97
+ encodings: z.ZodRecord<z.ZodString, z.ZodObject<{
98
+ modified: z.ZodBigInt;
99
+ content_chunks: z.ZodArray<z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>, "many">;
100
+ total_length: z.ZodBigInt;
101
+ sha256: z.ZodEffects<z.ZodType<Uint8Array<ArrayBuffer>, z.ZodTypeDef, Uint8Array<ArrayBuffer>>, Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>;
102
+ }, "strip", z.ZodTypeAny, {
103
+ modified: bigint;
104
+ content_chunks: Uint8Array<ArrayBufferLike>[];
105
+ total_length: bigint;
106
+ sha256: Uint8Array<ArrayBuffer>;
107
+ }, {
108
+ modified: bigint;
109
+ content_chunks: Uint8Array<ArrayBufferLike>[];
110
+ total_length: bigint;
111
+ sha256: Uint8Array<ArrayBuffer>;
112
+ }>>;
113
+ created_at: z.ZodBigInt;
114
+ updated_at: z.ZodBigInt;
115
+ version: z.ZodOptional<z.ZodBigInt>;
116
+ }, "strict", z.ZodTypeAny, {
117
+ created_at: bigint;
118
+ updated_at: bigint;
119
+ key: {
120
+ owner: Uint8Array<ArrayBufferLike>;
121
+ collection: string;
122
+ name: string;
123
+ full_path: string;
124
+ description?: string | undefined;
125
+ token?: string | undefined;
126
+ };
127
+ headers: [string, string][];
128
+ encodings: Record<string, {
129
+ modified: bigint;
130
+ content_chunks: Uint8Array<ArrayBufferLike>[];
131
+ total_length: bigint;
132
+ sha256: Uint8Array<ArrayBuffer>;
133
+ }>;
134
+ version?: bigint | undefined;
135
+ }, {
136
+ created_at: bigint;
137
+ updated_at: bigint;
138
+ key: {
139
+ owner: Uint8Array<ArrayBufferLike>;
140
+ collection: string;
141
+ name: string;
142
+ full_path: string;
143
+ description?: string | undefined;
144
+ token?: string | undefined;
145
+ };
146
+ headers: [string, string][];
147
+ encodings: Record<string, {
148
+ modified: bigint;
149
+ content_chunks: Uint8Array<ArrayBufferLike>[];
150
+ total_length: bigint;
151
+ sha256: Uint8Array<ArrayBuffer>;
152
+ }>;
153
+ version?: bigint | undefined;
154
+ }>;
155
+ /**
156
+ * A stored asset including its metadata, encodings, and timestamps.
157
+ */
158
+ export interface Asset {
159
+ /**
160
+ * Metadata about the asset's identity and ownership.
161
+ */
162
+ key: AssetKey;
163
+ /**
164
+ * Optional HTTP headers associated with the asset.
165
+ */
166
+ headers: HeaderField[];
167
+ /**
168
+ * A mapping from encoding types (e.g., "identity", "gzip") to the corresponding encoded version.
169
+ */
170
+ encodings: Record<string, AssetEncoding>;
171
+ /**
172
+ * Timestamp when the asset was created.
173
+ */
174
+ created_at: Timestamp;
175
+ /**
176
+ * Timestamp when the asset was last updated.
177
+ */
178
+ updated_at: Timestamp;
179
+ /**
180
+ * Optional version number of the asset.
181
+ */
182
+ version?: Version;
183
+ }
184
+ /**
185
+ * A string identifier representing a specific encoding format (e.g., "gzip", "identity").
186
+ */
187
+ export type EncodingType = string;
188
+ /**
189
+ * A unique reference identifier for batches.
190
+ */
191
+ export type ReferenceId = bigint;
192
+ /**
193
+ * @see Batch
194
+ */
195
+ export declare const BatchSchema: z.ZodObject<{
196
+ key: z.ZodObject<{
197
+ name: z.ZodString;
198
+ full_path: z.ZodString;
199
+ token: z.ZodOptional<z.ZodString>;
200
+ collection: z.ZodString;
201
+ owner: z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>;
202
+ description: z.ZodOptional<z.ZodString>;
203
+ }, "strip", z.ZodTypeAny, {
204
+ owner: Uint8Array<ArrayBufferLike>;
205
+ collection: string;
206
+ name: string;
207
+ full_path: string;
208
+ description?: string | undefined;
209
+ token?: string | undefined;
210
+ }, {
211
+ owner: Uint8Array<ArrayBufferLike>;
212
+ collection: string;
213
+ name: string;
214
+ full_path: string;
215
+ description?: string | undefined;
216
+ token?: string | undefined;
217
+ }>;
218
+ reference_id: z.ZodOptional<z.ZodBigInt>;
219
+ expires_at: z.ZodBigInt;
220
+ encoding_type: z.ZodOptional<z.ZodString>;
221
+ }, "strict", z.ZodTypeAny, {
222
+ expires_at: bigint;
223
+ key: {
224
+ owner: Uint8Array<ArrayBufferLike>;
225
+ collection: string;
226
+ name: string;
227
+ full_path: string;
228
+ description?: string | undefined;
229
+ token?: string | undefined;
230
+ };
231
+ reference_id?: bigint | undefined;
232
+ encoding_type?: string | undefined;
233
+ }, {
234
+ expires_at: bigint;
235
+ key: {
236
+ owner: Uint8Array<ArrayBufferLike>;
237
+ collection: string;
238
+ name: string;
239
+ full_path: string;
240
+ description?: string | undefined;
241
+ token?: string | undefined;
242
+ };
243
+ reference_id?: bigint | undefined;
244
+ encoding_type?: string | undefined;
245
+ }>;
246
+ /**
247
+ * Represents a batch of chunks to be uploaded and committed to an asset.
248
+ */
249
+ export interface Batch {
250
+ /**
251
+ * The metadata key for the asset being uploaded.
252
+ */
253
+ key: AssetKey;
254
+ /**
255
+ * Optional reference ID for tracking or validation.
256
+ */
257
+ reference_id?: ReferenceId;
258
+ /**
259
+ * Timestamp when this batch expires.
260
+ */
261
+ expires_at: Timestamp;
262
+ /**
263
+ * Optional encoding format (e.g., "gzip").
264
+ */
265
+ encoding_type?: EncodingType;
266
+ }
267
+ /**
268
+ * A unique identifier representing a single chunk of data.
269
+ */
270
+ export type ChunkId = bigint;
271
+ /**
272
+ * A unique identifier representing a batch of upload.
273
+ */
274
+ export type BatchId = bigint;
275
+ /**
276
+ * @see CommitBatch
277
+ */
278
+ export declare const CommitBatchSchema: z.ZodObject<{
279
+ batch_id: z.ZodBigInt;
280
+ headers: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">;
281
+ chunk_ids: z.ZodArray<z.ZodBigInt, "many">;
282
+ }, "strict", z.ZodTypeAny, {
283
+ headers: [string, string][];
284
+ batch_id: bigint;
285
+ chunk_ids: bigint[];
286
+ }, {
287
+ headers: [string, string][];
288
+ batch_id: bigint;
289
+ chunk_ids: bigint[];
290
+ }>;
291
+ /**
292
+ * Represents the final step in uploading an asset, committing the batch to storage.
293
+ */
294
+ export interface CommitBatch {
295
+ /**
296
+ * The ID of the batch being committed.
297
+ */
298
+ batch_id: BatchId;
299
+ /**
300
+ * HTTP headers associated with this asset.
301
+ */
302
+ headers: HeaderField[];
303
+ /**
304
+ * List of chunk IDs that make up the asset content.
305
+ */
306
+ chunk_ids: ChunkId[];
307
+ }
@@ -0,0 +1,39 @@
1
+ import { ControllerCheckParams, Controllers } from './schemas/controllers';
2
+ /**
3
+ * Gets the list of admin controllers from the Satellite.
4
+ *
5
+ * @returns {Controllers} The list of admin controllers.
6
+ *
7
+ * @throws {z.ZodError} If the returned value does not match the expected schema.
8
+ */
9
+ export declare const getAdminControllers: () => Controllers;
10
+ /**
11
+ * Gets the list of controllers from the Satellite.
12
+ *
13
+ * @returns {Controllers} The list of all controllers.
14
+ *
15
+ * @throws {z.ZodError} If the returned value does not match the expected schema.
16
+ */
17
+ export declare const getControllers: () => Controllers;
18
+ /**
19
+ * Checks if the given caller is an admin among the provided controllers.
20
+ *
21
+ * @param {ControllerCheckParams} params - The parameters including the caller identity
22
+ * and the list of controllers to verify against.
23
+ *
24
+ * @returns {boolean} Whether the caller is an admin.
25
+ *
26
+ * @throws {z.ZodError} If any input does not match the expected schema.
27
+ */
28
+ export declare const isAdminController: (params: ControllerCheckParams) => boolean;
29
+ /**
30
+ * Checks if the given caller exists among the provided controllers.
31
+ *
32
+ * @param {ControllerCheckParams} params - The parameters including the caller identity
33
+ * and the list of controllers to verify against.
34
+ *
35
+ * @returns {boolean} Whether the caller is a controller.
36
+ *
37
+ * @throws {z.ZodError} If any input does not match the expected schema.
38
+ */
39
+ export declare const isController: (params: ControllerCheckParams) => boolean;
package/sdk/db.sdk.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { SetDocStoreParams } from './schemas/db';
1
+ import { DeleteDocStoreParams, SetDocStoreParams } from './schemas/db';
2
2
  /**
3
3
  * Stores or updates a document in the datastore.
4
4
  *
@@ -11,3 +11,13 @@ import { SetDocStoreParams } from './schemas/db';
11
11
  * @throws {Error} If the Satellite fails at validating the submitted document before storing it.
12
12
  */
13
13
  export declare const setDocStore: (params: SetDocStoreParams) => void;
14
+ /**
15
+ * Delete a document in the datastore.
16
+ *
17
+ * @param {DeleteDocStoreParams} params - The parameters required to delete the document,
18
+ * including the caller, collection, key, and version of the document.
19
+ *
20
+ * @throws {z.ZodError} If the provided parameters do not match the expected schema.
21
+ * @throws {Error} If the Satellite fails at validating the submitted request before deleting it.
22
+ */
23
+ export declare const deleteDocStore: (params: DeleteDocStoreParams) => void;
@@ -0,0 +1,174 @@
1
+ import * as z from 'zod';
2
+ import { RawUserId, Timestamp, UserId } from '../../schemas/satellite';
3
+ /**
4
+ * @see ControllerScopeSchema
5
+ */
6
+ export declare const ControllerScopeSchema: z.ZodEnum<["write", "admin"]>;
7
+ /**
8
+ * Represents the permission scope of a controller.
9
+ */
10
+ export type ControllerScope = z.infer<typeof ControllerScopeSchema>;
11
+ /**
12
+ * @see MetadataSchema
13
+ */
14
+ export declare const MetadataSchema: z.ZodTuple<[z.ZodString, z.ZodString], null>;
15
+ /**
16
+ * Represents a single metadata entry as a key-value tuple.
17
+ */
18
+ export type Metadata = z.infer<typeof MetadataSchema>;
19
+ /**
20
+ * @see ControllerSchema
21
+ */
22
+ export declare const ControllerSchema: z.ZodObject<{
23
+ metadata: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">;
24
+ created_at: z.ZodBigInt;
25
+ updated_at: z.ZodBigInt;
26
+ expires_at: z.ZodOptional<z.ZodBigInt>;
27
+ scope: z.ZodEnum<["write", "admin"]>;
28
+ }, "strict", z.ZodTypeAny, {
29
+ created_at: bigint;
30
+ updated_at: bigint;
31
+ metadata: [string, string][];
32
+ scope: "write" | "admin";
33
+ expires_at?: bigint | undefined;
34
+ }, {
35
+ created_at: bigint;
36
+ updated_at: bigint;
37
+ metadata: [string, string][];
38
+ scope: "write" | "admin";
39
+ expires_at?: bigint | undefined;
40
+ }>;
41
+ /**
42
+ * Represents a controller with access scope and associated metadata.
43
+ */
44
+ export interface Controller {
45
+ /**
46
+ * A list of key-value metadata pairs associated with the controller.
47
+ */
48
+ metadata: Metadata[];
49
+ /**
50
+ * The timestamp when the controller was created.
51
+ */
52
+ created_at: Timestamp;
53
+ /**
54
+ * The timestamp when the controller was last updated.
55
+ */
56
+ updated_at: Timestamp;
57
+ /**
58
+ * Optional expiration timestamp for the controller.
59
+ * 👉 It's a placeholder for future implementation.
60
+ */
61
+ expires_at?: Timestamp;
62
+ /**
63
+ * The scope assigned to the controller.
64
+ */
65
+ scope: ControllerScope;
66
+ }
67
+ /**
68
+ * @see ControllerRecordSchema
69
+ */
70
+ export declare const ControllerRecordSchema: z.ZodTuple<[z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>, z.ZodObject<{
71
+ metadata: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">;
72
+ created_at: z.ZodBigInt;
73
+ updated_at: z.ZodBigInt;
74
+ expires_at: z.ZodOptional<z.ZodBigInt>;
75
+ scope: z.ZodEnum<["write", "admin"]>;
76
+ }, "strict", z.ZodTypeAny, {
77
+ created_at: bigint;
78
+ updated_at: bigint;
79
+ metadata: [string, string][];
80
+ scope: "write" | "admin";
81
+ expires_at?: bigint | undefined;
82
+ }, {
83
+ created_at: bigint;
84
+ updated_at: bigint;
85
+ metadata: [string, string][];
86
+ scope: "write" | "admin";
87
+ expires_at?: bigint | undefined;
88
+ }>], null>;
89
+ /**
90
+ * Represents a tuple containing the principal ID and associated controller data.
91
+ */
92
+ export type ControllerRecord = z.infer<typeof ControllerRecordSchema>;
93
+ /**
94
+ * @see ControllersSchema
95
+ */
96
+ export declare const ControllersSchema: z.ZodArray<z.ZodTuple<[z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>, z.ZodObject<{
97
+ metadata: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">;
98
+ created_at: z.ZodBigInt;
99
+ updated_at: z.ZodBigInt;
100
+ expires_at: z.ZodOptional<z.ZodBigInt>;
101
+ scope: z.ZodEnum<["write", "admin"]>;
102
+ }, "strict", z.ZodTypeAny, {
103
+ created_at: bigint;
104
+ updated_at: bigint;
105
+ metadata: [string, string][];
106
+ scope: "write" | "admin";
107
+ expires_at?: bigint | undefined;
108
+ }, {
109
+ created_at: bigint;
110
+ updated_at: bigint;
111
+ metadata: [string, string][];
112
+ scope: "write" | "admin";
113
+ expires_at?: bigint | undefined;
114
+ }>], null>, "many">;
115
+ /**
116
+ * Represents a list of controllers.
117
+ */
118
+ export type Controllers = z.infer<typeof ControllersSchema>;
119
+ /**
120
+ * @see ControllerCheckParamsSchema
121
+ */
122
+ export declare const ControllerCheckParamsSchema: z.ZodObject<{
123
+ caller: z.ZodUnion<[z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>, z.ZodType<import("@dfinity/principal").Principal, z.ZodTypeDef, import("@dfinity/principal").Principal>]>;
124
+ controllers: z.ZodArray<z.ZodTuple<[z.ZodType<Uint8Array<ArrayBufferLike>, z.ZodTypeDef, Uint8Array<ArrayBufferLike>>, z.ZodObject<{
125
+ metadata: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>, "many">;
126
+ created_at: z.ZodBigInt;
127
+ updated_at: z.ZodBigInt;
128
+ expires_at: z.ZodOptional<z.ZodBigInt>;
129
+ scope: z.ZodEnum<["write", "admin"]>;
130
+ }, "strict", z.ZodTypeAny, {
131
+ created_at: bigint;
132
+ updated_at: bigint;
133
+ metadata: [string, string][];
134
+ scope: "write" | "admin";
135
+ expires_at?: bigint | undefined;
136
+ }, {
137
+ created_at: bigint;
138
+ updated_at: bigint;
139
+ metadata: [string, string][];
140
+ scope: "write" | "admin";
141
+ expires_at?: bigint | undefined;
142
+ }>], null>, "many">;
143
+ }, "strip", z.ZodTypeAny, {
144
+ caller: Uint8Array<ArrayBufferLike> | import("@dfinity/principal").Principal;
145
+ controllers: [Uint8Array<ArrayBufferLike>, {
146
+ created_at: bigint;
147
+ updated_at: bigint;
148
+ metadata: [string, string][];
149
+ scope: "write" | "admin";
150
+ expires_at?: bigint | undefined;
151
+ }][];
152
+ }, {
153
+ caller: Uint8Array<ArrayBufferLike> | import("@dfinity/principal").Principal;
154
+ controllers: [Uint8Array<ArrayBufferLike>, {
155
+ created_at: bigint;
156
+ updated_at: bigint;
157
+ metadata: [string, string][];
158
+ scope: "write" | "admin";
159
+ expires_at?: bigint | undefined;
160
+ }][];
161
+ }>;
162
+ /**
163
+ * Represents the parameters required to perform controller checks.
164
+ */
165
+ export interface ControllerCheckParams {
166
+ /**
167
+ * The identity of the caller to verify against the controller list.
168
+ */
169
+ caller: RawUserId | UserId;
170
+ /**
171
+ * The list of controllers to check against.
172
+ */
173
+ controllers: Controllers;
174
+ }