@junobuild/admin 0.0.8 → 0.0.10

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.
Files changed (48) hide show
  1. package/dist/browser/index.js +8 -8
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/declarations/cmc/cmc.did.d.ts +30 -30
  4. package/dist/declarations/cmc/cmc.factory.did.js +63 -63
  5. package/dist/declarations/cmc/index.d.ts +18 -18
  6. package/dist/declarations/cmc/index.js +22 -22
  7. package/dist/declarations/console/console.did.d.ts +37 -37
  8. package/dist/declarations/console/console.factory.did.js +60 -60
  9. package/dist/declarations/console/console.factory.did.mjs +60 -60
  10. package/dist/declarations/console/index.d.ts +18 -18
  11. package/dist/declarations/console/index.js +22 -22
  12. package/dist/declarations/frontend/frontend.did.d.ts +136 -136
  13. package/dist/declarations/frontend/frontend.factory.did.js +206 -206
  14. package/dist/declarations/frontend/index.d.ts +18 -18
  15. package/dist/declarations/frontend/index.js +22 -22
  16. package/dist/declarations/ic/ic.did.d.ts +63 -63
  17. package/dist/declarations/ic/ic.factory.did.js +126 -126
  18. package/dist/declarations/internet_identity/index.d.ts +18 -18
  19. package/dist/declarations/internet_identity/index.js +22 -22
  20. package/dist/declarations/internet_identity/internet_identity.did.d.ts +136 -136
  21. package/dist/declarations/internet_identity/internet_identity.factory.did.js +231 -231
  22. package/dist/declarations/ledger/index.d.ts +18 -18
  23. package/dist/declarations/ledger/index.js +22 -22
  24. package/dist/declarations/ledger/ledger.did.d.ts +64 -64
  25. package/dist/declarations/ledger/ledger.factory.did.js +96 -96
  26. package/dist/declarations/mission_control/index.d.ts +18 -18
  27. package/dist/declarations/mission_control/index.js +22 -22
  28. package/dist/declarations/mission_control/mission_control.did.d.ts +30 -30
  29. package/dist/declarations/mission_control/mission_control.factory.did.js +48 -48
  30. package/dist/declarations/satellite/index.d.ts +18 -18
  31. package/dist/declarations/satellite/index.js +22 -22
  32. package/dist/declarations/satellite/satellite-deprecated.did.d.ts +120 -124
  33. package/dist/declarations/satellite/satellite-deprecated.factory.did.js +189 -189
  34. package/dist/declarations/satellite/satellite-deprecated.factory.did.mjs +189 -189
  35. package/dist/declarations/satellite/satellite.did.d.ts +121 -124
  36. package/dist/declarations/satellite/satellite.factory.did.js +192 -189
  37. package/dist/declarations/satellite/satellite.factory.did.mjs +190 -189
  38. package/dist/node/index.mjs +22 -22
  39. package/dist/node/index.mjs.map +4 -4
  40. package/dist/types/api/satellite.api.d.ts +11 -1
  41. package/dist/types/constants/rules.constants.d.ts +7 -0
  42. package/dist/types/index.d.ts +1 -0
  43. package/dist/types/services/satellite.services.d.ts +10 -0
  44. package/dist/types/types/rules.types.d.ts +10 -0
  45. package/dist/types/utils/did.utils.d.ts +4 -0
  46. package/dist/types/utils/rule.utils.d.ts +6 -0
  47. package/dist/types/utils/utils.d.ts +7 -0
  48. package/package.json +1 -1
@@ -1,10 +1,20 @@
1
1
  import type { Principal } from '@dfinity/principal';
2
- import type { Config, Controller } from '../../declarations/satellite/satellite.did';
2
+ import type { Config, Controller, Rule, RulesType, SetRule } from '../../declarations/satellite/satellite.did';
3
3
  import type { SatelliteParameters } from '../types/actor.types';
4
4
  export declare const setConfig: ({ config, satellite }: {
5
5
  config: Config;
6
6
  satellite: SatelliteParameters;
7
7
  }) => Promise<void>;
8
+ export declare const listRules: ({ satellite, type }: {
9
+ satellite: SatelliteParameters;
10
+ type: RulesType;
11
+ }) => Promise<[string, Rule][]>;
12
+ export declare const setRule: ({ type, collection, rule, satellite }: {
13
+ type: RulesType;
14
+ collection: string;
15
+ rule: SetRule;
16
+ satellite: SatelliteParameters;
17
+ }) => Promise<void>;
8
18
  export declare const version: ({ satellite }: {
9
19
  satellite: SatelliteParameters;
10
20
  }) => Promise<string>;
@@ -0,0 +1,7 @@
1
+ import type { Permission, RulesType } from '../../declarations/satellite/satellite.did';
2
+ export declare const DbRulesType: RulesType;
3
+ export declare const StorageRulesType: RulesType;
4
+ export declare const PermissionPublic: Permission;
5
+ export declare const PermissionPrivate: Permission;
6
+ export declare const PermissionManaged: Permission;
7
+ export declare const PermissionControllers: Permission;
@@ -3,3 +3,4 @@ export * from './services/satellite.services';
3
3
  export * from './types/actor.types';
4
4
  export * from './types/config.types';
5
5
  export * from './types/ic.types';
6
+ export * from './types/rules.types';
@@ -1,9 +1,19 @@
1
1
  import type { SatelliteParameters } from '../types/actor.types';
2
2
  import type { Config } from '../types/config.types';
3
+ import type { Rule, RulesType } from '../types/rules.types';
3
4
  export declare const setConfig: ({ config: { storage: { headers: configHeaders } }, satellite }: {
4
5
  config: Config;
5
6
  satellite: SatelliteParameters;
6
7
  }) => Promise<void>;
8
+ export declare const listRules: ({ type, satellite }: {
9
+ type: RulesType;
10
+ satellite: SatelliteParameters;
11
+ }) => Promise<Rule[]>;
12
+ export declare const setRule: ({ rule: { collection, ...rest }, type, satellite }: {
13
+ rule: Rule;
14
+ type: RulesType;
15
+ satellite: SatelliteParameters;
16
+ }) => Promise<void>;
7
17
  export declare const satelliteVersion: (params: {
8
18
  satellite: SatelliteParameters;
9
19
  }) => Promise<string>;
@@ -0,0 +1,10 @@
1
+ export type PermissionText = 'public' | 'private' | 'managed' | 'controllers';
2
+ export type RulesType = 'db' | 'storage';
3
+ export interface Rule {
4
+ collection: string;
5
+ read: PermissionText;
6
+ write: PermissionText;
7
+ created_at?: bigint;
8
+ updated_at?: bigint;
9
+ max_size?: number;
10
+ }
@@ -0,0 +1,4 @@
1
+ export declare const toNullable: <T>(value?: T | undefined) => [] | [T];
2
+ export declare const fromNullable: <T>(value: [] | [T]) => T | undefined;
3
+ export declare const toArray: <T>(data: T) => Promise<Uint8Array>;
4
+ export declare const fromArray: <T>(data: Uint8Array | number[]) => Promise<T>;
@@ -0,0 +1,6 @@
1
+ import type { Permission, Rule as RuleApi, RulesType as RulesTypeApi, SetRule } from '../../declarations/satellite/satellite.did';
2
+ import type { PermissionText, Rule, RulesType } from '../types/rules.types';
3
+ export declare const mapRuleType: (type: RulesType) => RulesTypeApi;
4
+ export declare const mapSetRule: ({ read, write, max_size, updated_at }: Pick<Rule, 'read' | 'write' | 'max_size' | 'updated_at'>) => SetRule;
5
+ export declare const mapRule: ([collection, rule]: [string, RuleApi]) => Rule;
6
+ export declare const permissionToText: (permission: Permission) => PermissionText;
@@ -0,0 +1,7 @@
1
+ /** Is null or undefined */
2
+ export declare const isNullish: <T>(argument: T | null | undefined) => argument is null | undefined;
3
+ /** Not null and not undefined */
4
+ export declare const nonNullish: <T>(argument: T | null | undefined) => argument is NonNullable<T>;
5
+ export declare class NullishError extends Error {
6
+ }
7
+ export declare const assertNonNullish: <T>(value: T, message?: string) => asserts value is NonNullable<T>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junobuild/admin",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
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",