@junobuild/admin 0.0.7 → 0.0.9

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.
@@ -2,8 +2,10 @@ import type { IDL } from '@dfinity/candid';
2
2
  import type { _SERVICE as ConsoleActor } from '../../declarations/console/console.did';
3
3
  import type { _SERVICE as ICActor } from '../../declarations/ic/ic.did';
4
4
  import type { _SERVICE as MissionControlActor } from '../../declarations/mission_control/mission_control.did';
5
+ import type { _SERVICE as DeprecatedSatelliteActor } from '../../declarations/satellite/satellite-deprecated.did';
5
6
  import type { _SERVICE as SatelliteActor } from '../../declarations/satellite/satellite.did';
6
7
  import type { ActorParameters, ConsoleParameters, MissionControlParameters, SatelliteParameters } from '../types/actor.types';
8
+ export declare const getDeprecatedSatelliteActor: ({ satelliteId, ...rest }: SatelliteParameters) => Promise<DeprecatedSatelliteActor>;
7
9
  export declare const getSatelliteActor: ({ satelliteId, ...rest }: SatelliteParameters) => Promise<SatelliteActor>;
8
10
  export declare const getMissionControlActor: ({ missionControlId, ...rest }: MissionControlParameters) => Promise<MissionControlActor>;
9
11
  export declare const getConsoleActor: ({ consoleId, ...rest }: ConsoleParameters) => Promise<ConsoleActor>;
@@ -1,13 +1,26 @@
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>;
21
+ export declare const listDeprecatedControllers: ({ satellite }: {
22
+ satellite: SatelliteParameters;
23
+ }) => Promise<Principal[]>;
11
24
  export declare const listControllers: ({ satellite }: {
12
25
  satellite: SatelliteParameters;
13
26
  }) => Promise<[Principal, Controller][]>;
@@ -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,13 +1,24 @@
1
1
  import type { SatelliteParameters } from '../types/actor.types';
2
2
  import type { Config } from '../types/config.types';
3
+ import { 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>;
10
- export declare const upgradeSatellite: ({ satellite, wasm_module }: {
20
+ export declare const upgradeSatellite: ({ satellite, wasm_module, deprecated }: {
11
21
  satellite: SatelliteParameters;
12
22
  wasm_module: Array<number>;
23
+ deprecated: boolean;
13
24
  }) => Promise<void>;
@@ -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.7",
3
+ "version": "0.0.9",
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",