@junobuild/admin 0.5.0-next-2025-06-12 → 0.5.0-next-2025-06-20

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 { Principal } from '@dfinity/principal';
2
- import type { AuthenticationConfig, CollectionType, Controller, CustomDomain, DbConfig, MemorySize, Rule, SetControllersArgs, SetRule, StorageConfig } from '../../declarations/satellite/satellite.did';
2
+ import type { AuthenticationConfig, CollectionType, Controller, CustomDomain, DbConfig, ListRulesParams, ListRulesResults, MemorySize, Rule, SetControllersArgs, SetRule, StorageConfig } from '../../declarations/satellite/satellite.did';
3
3
  import type { SatelliteParameters } from '../types/actor.types';
4
4
  export declare const setStorageConfig: ({ config, satellite }: {
5
5
  config: StorageConfig;
@@ -22,10 +22,11 @@ export declare const getDatastoreConfig: ({ satellite }: {
22
22
  export declare const getAuthConfig: ({ satellite }: {
23
23
  satellite: SatelliteParameters;
24
24
  }) => Promise<[] | [AuthenticationConfig]>;
25
- export declare const listRules: ({ satellite, type }: {
25
+ export declare const listRules: ({ satellite, type, filter }: {
26
26
  satellite: SatelliteParameters;
27
27
  type: CollectionType;
28
- }) => Promise<[string, Rule][]>;
28
+ filter: ListRulesParams;
29
+ }) => Promise<ListRulesResults>;
29
30
  export declare const setRule: ({ type, collection, rule, satellite }: {
30
31
  type: CollectionType;
31
32
  collection: string;
@@ -1,16 +1,19 @@
1
1
  import type { Rule, RulesType } from '@junobuild/config';
2
2
  import type { SatelliteParameters } from '../types/actor.types';
3
+ import type { ListRulesMatcher, ListRulesResults } from '../types/list.types';
3
4
  /**
4
5
  * Lists the rules for a satellite.
5
6
  * @param {Object} params - The parameters for listing the rules.
6
7
  * @param {RulesType} params.type - The type of rules to list.
8
+ * @param {ListRulesMatcher} params.filter - The optional filter for the query.
7
9
  * @param {SatelliteParameters} params.satellite - The satellite parameters.
8
- * @returns {Promise<Rule[]>} A promise that resolves to an array of rules.
10
+ * @returns {Promise<ListRulesResults>} A promise that resolves to the resolved rules.
9
11
  */
10
- export declare const listRules: ({ type, satellite }: {
12
+ export declare const listRules: ({ type, satellite, filter }: {
11
13
  type: RulesType;
14
+ filter?: ListRulesMatcher;
12
15
  satellite: SatelliteParameters;
13
- }) => Promise<Rule[]>;
16
+ }) => Promise<ListRulesResults>;
14
17
  /**
15
18
  * Sets a rule for a satellite.
16
19
  * @param {Object} params - The parameters for setting the rule.
@@ -0,0 +1,44 @@
1
+ import type { Rule } from '@junobuild/config';
2
+ /**
3
+ * Represents matching parameters for a list call.
4
+ * @interface
5
+ */
6
+ export interface ListRulesMatcher {
7
+ /**
8
+ * Include the system collections (prefixed with #).
9
+ * @type {boolean}
10
+ */
11
+ include_system: boolean;
12
+ }
13
+ /**
14
+ * Represents the parameters for listing the rules.
15
+ * @interface
16
+ */
17
+ export interface ListRulesParams {
18
+ /**
19
+ * The matcher parameters for the query.
20
+ * @type {ListRulesMatcher}
21
+ */
22
+ matcher?: ListRulesMatcher;
23
+ }
24
+ /**
25
+ * Represents the results of list the rules.
26
+ * @interface
27
+ */
28
+ export interface ListRulesResults {
29
+ /**
30
+ * The rules matching the query.
31
+ * @type {Rule[]}
32
+ */
33
+ items: Rule[];
34
+ /**
35
+ * The number of items - basically items.length.
36
+ * @type {bigint}
37
+ */
38
+ items_length: bigint;
39
+ /**
40
+ * The total number of matching results.
41
+ * @type {bigint}
42
+ */
43
+ matches_length: bigint;
44
+ }
@@ -1,6 +1,8 @@
1
1
  import type { MemoryText, PermissionText, Rule, RulesType } from '@junobuild/config';
2
- import type { CollectionType as CollectionTypeApi, Memory, Permission, Rule as RuleApi, SetRule } from '../../declarations/satellite/satellite.did';
2
+ import type { CollectionType as CollectionTypeApi, ListRulesParams as ListRulesParamsApi, Memory, Permission, Rule as RuleApi, SetRule } from '../../declarations/satellite/satellite.did';
3
+ import type { ListRulesMatcher } from '../types/list.types';
3
4
  export declare const mapRuleType: (type: RulesType) => CollectionTypeApi;
5
+ export declare const mapRulesFilter: (filter?: ListRulesMatcher) => ListRulesParamsApi;
4
6
  export declare const mapSetRule: ({ read, write, memory, maxSize, maxChangesPerUser, maxCapacity, version, mutablePermissions, maxTokens }: Pick<Rule, "read" | "write" | "maxSize" | "maxChangesPerUser" | "maxCapacity" | "version" | "memory" | "mutablePermissions" | "maxTokens">) => SetRule;
5
7
  export declare const mapRule: ([collection, rule]: [string, RuleApi]) => Rule;
6
8
  export declare const permissionToText: (permission: Permission) => PermissionText;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junobuild/admin",
3
- "version": "0.5.0-next-2025-06-12",
3
+ "version": "0.5.0-next-2025-06-20",
4
4
  "description": "A library for interfacing with admin features of Juno",
5
5
  "author": "David Dal Busco (https://daviddalbusco.com)",
6
6
  "license": "MIT",