Skip to content

Commit efa0e45

Browse files
chore: merge main
2 parents cd42b00 + 47aeb7c commit efa0e45

File tree

3 files changed

+104
-46
lines changed

3 files changed

+104
-46
lines changed

packages/functions/README.md

Lines changed: 62 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ The raw user ID as a `Uint8Array`.
270270

271271
Gets the list of admin controllers from the Satellite.
272272

273-
| Function | Type |
274-
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
275-
| `getAdminControllers` | `() => [Uint8Array<ArrayBufferLike>, { metadata: [string, string][]; created_at: bigint; updated_at: bigint; scope: "write" or "admin" or "submit"; expires_at?: bigint or undefined; }][]` |
273+
| Function | Type |
274+
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
275+
| `getAdminControllers` | `() => [Uint8Array<ArrayBufferLike>, { metadata: [string, string][]; created_at: bigint; updated_at: bigint; scope: "write" or "admin" or "submit"; expires_at?: bigint or undefined; kind?: "automation" or ... 1 more ... or undefined; }][]` |
276276

277277
Returns:
278278

@@ -284,9 +284,9 @@ The list of admin controllers.
284284

285285
Gets the list of controllers from the Satellite.
286286

287-
| Function | Type |
288-
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
289-
| `getControllers` | `() => [Uint8Array<ArrayBufferLike>, { metadata: [string, string][]; created_at: bigint; updated_at: bigint; scope: "write" or "admin" or "submit"; expires_at?: bigint or undefined; }][]` |
287+
| Function | Type |
288+
| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
289+
| `getControllers` | `() => [Uint8Array<ArrayBufferLike>, { metadata: [string, string][]; created_at: bigint; updated_at: bigint; scope: "write" or "admin" or "submit"; expires_at?: bigint or undefined; kind?: "automation" or ... 1 more ... or undefined; }][]` |
290290

291291
Returns:
292292

@@ -811,6 +811,7 @@ The current timestamp.
811811
- [ListOrderSchema](#gear-listorderschema)
812812
- [ListParamsSchema](#gear-listparamsschema)
813813
- [ControllerScopeSchema](#gear-controllerscopeschema)
814+
- [ControllerKindSchema](#gear-controllerkindschema)
814815
- [MetadataSchema](#gear-metadataschema)
815816
- [ControllerSchema](#gear-controllerschema)
816817
- [ControllerRecordSchema](#gear-controllerrecordschema)
@@ -1641,10 +1642,22 @@ References:
16411642

16421643
References:
16431644

1644-
- ControllerScopeSchema
1645+
- ControllerScope
16451646

16461647
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L15)
16471648

1649+
#### :gear: ControllerKindSchema
1650+
1651+
| Constant | Type |
1652+
| ---------------------- | -------------------------------------------------------------- |
1653+
| `ControllerKindSchema` | `ZodEnum<{ automation: "automation"; emulator: "emulator"; }>` |
1654+
1655+
References:
1656+
1657+
- ControllerKind
1658+
1659+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L25)
1660+
16481661
#### :gear: MetadataSchema
16491662

16501663
| Constant | Type |
@@ -1655,43 +1668,43 @@ References:
16551668

16561669
- MetadataSchema
16571670

1658-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L25)
1671+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L35)
16591672

16601673
#### :gear: ControllerSchema
16611674

1662-
| Constant | Type |
1663-
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1664-
| `ControllerSchema` | `ZodObject<{ metadata: ZodArray<ZodTuple<[ZodString, ZodString], null>>; created_at: ZodBigInt; updated_at: ZodBigInt; expires_at: ZodOptional<...>; scope: ZodEnum<...>; }, $strict>` |
1675+
| Constant | Type |
1676+
| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1677+
| `ControllerSchema` | `ZodObject<{ metadata: ZodArray<ZodTuple<[ZodString, ZodString], null>>; created_at: ZodBigInt; updated_at: ZodBigInt; expires_at: ZodOptional<...>; scope: ZodEnum<...>; kind: ZodOptional<...>; }, $strict>` |
16651678

16661679
References:
16671680

16681681
- ControllerSchema
16691682

1670-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L35)
1683+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L45)
16711684

16721685
#### :gear: ControllerRecordSchema
16731686

1674-
| Constant | Type |
1675-
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1676-
| `ControllerRecordSchema` | `ZodTuple<[ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, ZodObject<{ metadata: ZodArray<ZodTuple<[ZodString, ZodString], null>>; created_at: ZodBigInt; updated_at: ZodBigInt; expires_at: ZodOptional<...>; scope: ZodEnum<...>; }, $strict>], null>` |
1687+
| Constant | Type |
1688+
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1689+
| `ControllerRecordSchema` | `ZodTuple<[ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, ZodObject<{ metadata: ZodArray<ZodTuple<[ZodString, ZodString], null>>; ... 4 more ...; kind: ZodOptional<...>; }, $strict>], null>` |
16771690

16781691
References:
16791692

16801693
- ControllerRecordSchema
16811694

1682-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L78)
1695+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L95)
16831696

16841697
#### :gear: ControllersSchema
16851698

1686-
| Constant | Type |
1687-
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1688-
| `ControllersSchema` | `ZodArray<ZodTuple<[ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, ZodObject<{ metadata: ZodArray<ZodTuple<[ZodString, ZodString], null>>; created_at: ZodBigInt; updated_at: ZodBigInt; expires_at: ZodOptional<...>; scope: ZodEnum<...>; }, $strict>], null>>` |
1699+
| Constant | Type |
1700+
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1701+
| `ControllersSchema` | `ZodArray<ZodTuple<[ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>, ZodObject<{ metadata: ZodArray<ZodTuple<[ZodString, ZodString], null>>; ... 4 more ...; kind: ZodOptional<...>; }, $strict>], null>>` |
16891702

16901703
References:
16911704

16921705
- ControllersSchema
16931706

1694-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L88)
1707+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L105)
16951708

16961709
#### :gear: ControllerCheckParamsSchema
16971710

@@ -1703,7 +1716,7 @@ References:
17031716

17041717
- ControllerCheckParamsSchema
17051718

1706-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L98)
1719+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L115)
17071720

17081721
#### :gear: CollectionParamsSchema
17091722

@@ -2311,26 +2324,27 @@ List results, parameterized by type of returned item.
23112324

23122325
Represents a controller with access scope and associated metadata.
23132326

2314-
| Property | Type | Description |
2315-
| ------------ | -------------------------------- | ------------------------------------------------------------------ |
2316-
| `metadata` | `[string, string][]` | A list of key-value metadata pairs associated with the controller. |
2317-
| `created_at` | `bigint` | The timestamp when the controller was created. |
2318-
| `updated_at` | `bigint` | The timestamp when the controller was last updated. |
2319-
| `expires_at` | `bigint or undefined` | Optional expiration timestamp for the controller. |
2320-
| `scope` | `"write" or "admin" or "submit"` | The scope assigned to the controller. |
2327+
| Property | Type | Description |
2328+
| ------------ | ----------------------------------------- | -------------------------------------------------------------------------------------------------- |
2329+
| `metadata` | `[string, string][]` | A list of key-value metadata pairs associated with the controller. |
2330+
| `created_at` | `bigint` | The timestamp when the controller was created. |
2331+
| `updated_at` | `bigint` | The timestamp when the controller was last updated. |
2332+
| `expires_at` | `bigint or undefined` | Optional expiration timestamp for the controller. 👉 It's a placeholder for future implementation. |
2333+
| `scope` | `"write" or "admin" or "submit"` | The scope assigned to the controller. |
2334+
| `kind` | `"automation" or "emulator" or undefined` | An optional kind identifier of the controller. |
23212335

2322-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L48)
2336+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L59)
23232337

23242338
#### :gear: ControllerCheckParams
23252339

23262340
Represents the parameters required to perform controller checks.
23272341

2328-
| Property | Type | Description |
2329-
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
2330-
| `caller` | `any` | The identity of the caller to verify against the controller list. |
2331-
| `controllers` | `[Uint8Array<ArrayBufferLike>, { metadata: [string, string][]; created_at: bigint; updated_at: bigint; scope: "write" or "admin" or "submit"; expires_at?: bigint or undefined; }][]` | The list of controllers to check against. |
2342+
| Property | Type | Description |
2343+
| ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- |
2344+
| `caller` | `any` | The identity of the caller to verify against the controller list. |
2345+
| `controllers` | `[Uint8Array<ArrayBufferLike>, { metadata: [string, string][]; created_at: bigint; updated_at: bigint; scope: "write" or "admin" or "submit"; expires_at?: bigint or undefined; kind?: "automation" or ... 1 more ... or undefined; }][]` | The list of controllers to check against. |
23322346

2333-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L106)
2347+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L123)
23342348

23352349
#### :gear: CollectionParams
23362350

@@ -2446,6 +2460,7 @@ Type representing the parameters required to make a canister call.
24462460
- [TimestampMatcher](#gear-timestampmatcher)
24472461
- [ListOrderField](#gear-listorderfield)
24482462
- [ControllerScope](#gear-controllerscope)
2463+
- [ControllerKind](#gear-controllerkind)
24492464
- [Metadata](#gear-metadata)
24502465
- [ControllerRecord](#gear-controllerrecord)
24512466
- [Controllers](#gear-controllers)
@@ -3175,6 +3190,16 @@ Represents the permission scope of a controller.
31753190

31763191
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L20)
31773192

3193+
#### :gear: ControllerKind
3194+
3195+
Represents a specific kind of controller. Meant for informational purposes.
3196+
3197+
| Type | Type |
3198+
| ---------------- | -------------------------------------- |
3199+
| `ControllerKind` | `z.infer<typeof ControllerKindSchema>` |
3200+
3201+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L30)
3202+
31783203
#### :gear: Metadata
31793204

31803205
Represents a single metadata entry as a key-value tuple.
@@ -3183,7 +3208,7 @@ Represents a single metadata entry as a key-value tuple.
31833208
| ---------- | -------------------------------- |
31843209
| `Metadata` | `z.infer<typeof MetadataSchema>` |
31853210

3186-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L30)
3211+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L40)
31873212

31883213
#### :gear: ControllerRecord
31893214

@@ -3193,7 +3218,7 @@ Represents a tuple containing the principal ID and associated controller data.
31933218
| ------------------ | ---------------------------------------- |
31943219
| `ControllerRecord` | `z.infer<typeof ControllerRecordSchema>` |
31953220

3196-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L83)
3221+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L100)
31973222

31983223
#### :gear: Controllers
31993224

@@ -3203,7 +3228,7 @@ Represents a list of controllers.
32033228
| ------------- | ----------------------------------- |
32043229
| `Controllers` | `z.infer<typeof ControllersSchema>` |
32053230

3206-
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L93)
3231+
[:link: Source](https://github.com/junobuild/juno-js/tree/main/packages/functions/src/sdk/schemas/controllers.ts#L110)
32073232

32083233
#### :gear: ListStoreParams
32093234

packages/functions/src/sdk/schemas/controllers.ts

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
} from '../../schemas/satellite';
1111

1212
/**
13-
* @see ControllerScopeSchema
13+
* @see ControllerScope
1414
*/
1515
export const ControllerScopeSchema = z.enum(['write', 'admin', 'submit']);
1616

@@ -19,6 +19,16 @@ export const ControllerScopeSchema = z.enum(['write', 'admin', 'submit']);
1919
*/
2020
export type ControllerScope = z.infer<typeof ControllerScopeSchema>;
2121

22+
/**
23+
* @see ControllerKind
24+
*/
25+
export const ControllerKindSchema = z.enum(['automation', 'emulator']);
26+
27+
/**
28+
* Represents a specific kind of controller. Meant for informational purposes.
29+
*/
30+
export type ControllerKind = z.infer<typeof ControllerKindSchema>;
31+
2232
/**
2333
* @see MetadataSchema
2434
*/
@@ -38,7 +48,8 @@ export const ControllerSchema = z
3848
created_at: TimestampSchema,
3949
updated_at: TimestampSchema,
4050
expires_at: TimestampSchema.optional(),
41-
scope: ControllerScopeSchema
51+
scope: ControllerScopeSchema,
52+
kind: ControllerKindSchema.optional()
4253
})
4354
.strict();
4455

@@ -70,6 +81,11 @@ export interface Controller {
7081
* The scope assigned to the controller.
7182
*/
7283
scope: ControllerScope;
84+
85+
/**
86+
* An optional kind identifier of the controller.
87+
*/
88+
kind?: ControllerKind;
7389
}
7490

7591
/**

0 commit comments

Comments
 (0)