@junobuild/admin 0.1.6 → 0.1.7

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.
@@ -37,7 +37,7 @@ export declare const canisterStatus: ({ actor, canisterId }: {
37
37
  canisterId: Principal;
38
38
  }) => Promise<CanisterStatusResponse>;
39
39
  export declare const canisterMetadata: ({ canisterId, path, ...rest }: ActorParameters & {
40
- canisterId: string | undefined;
40
+ canisterId: Principal | string | undefined;
41
41
  path: string;
42
42
  }) => Promise<CanisterStatus.Status | undefined>;
43
43
  export declare const listCanisterSnapshots: ({ actor, canisterId }: {
@@ -7,6 +7,7 @@ export * from './services/orbiter.controllers.services';
7
7
  export * from './services/orbiter.memory.services';
8
8
  export * from './services/orbiter.upgrade.services';
9
9
  export * from './services/orbiter.version.services';
10
+ export * from './services/package.services';
10
11
  export * from './services/releases.services';
11
12
  export * from './services/satellite.assets.services';
12
13
  export * from './services/satellite.config.services';
@@ -0,0 +1,35 @@
1
+ import { Principal } from '@dfinity/principal';
2
+ import { type JunoPackage } from '@junobuild/config';
3
+ import { ActorParameters } from '../types/actor.types';
4
+ /**
5
+ * Parameters required to retrieve a `juno:package` metadata section.
6
+ *
7
+ * @typedef {Object} GetJunoPackageParams
8
+ * @property {Principal | string} moduleId - The ID of the canister module (as a Principal or string).
9
+ * @property {ActorParameters} [ActorParameters] - Additional actor parameters for making the canister call.
10
+ */
11
+ export type GetJunoPackageParams = {
12
+ moduleId: Principal | string;
13
+ } & ActorParameters;
14
+ /**
15
+ * Get the `juno:package` metadata from the public custom section of a given module.
16
+ *
17
+ * @param {Object} params - The parameters to fetch the metadata.
18
+ * @param {Principal | string} params.moduleId - The canister ID (as a `Principal` or string) from which to retrieve the metadata.
19
+ * @param {ActorParameters} params - Additional actor parameters required for the call.
20
+ *
21
+ * @returns {Promise<JunoPackage | undefined>} A promise that resolves to the parsed `JunoPackage` metadata, or `undefined` if not found.
22
+ *
23
+ * @throws {ZodError} If the metadata exists but does not conform to the expected `JunoPackage` schema.
24
+ */
25
+ export declare const getJunoPackage: ({ moduleId, ...rest }: GetJunoPackageParams) => Promise<JunoPackage | undefined>;
26
+ /**
27
+ * Retrieves only the `version` field from the `juno:package` metadata.
28
+ *
29
+ * @param {GetJunoPackageParams} params - The parameters to fetch the package version.
30
+ *
31
+ * @returns {Promise<string | undefined>} A promise that resolves to the version string or `undefined` if not found.
32
+ *
33
+ * @throws {ZodError} If the metadata exists but does not conform to the expected `JunoPackage` schema.
34
+ */
35
+ export declare const getJunoPackageVersion: (params: GetJunoPackageParams) => Promise<JunoPackage["version"] | undefined>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@junobuild/admin",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
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",
@@ -57,6 +57,7 @@
57
57
  "@dfinity/principal": "^2.3.0",
58
58
  "@dfinity/utils": "^2",
59
59
  "@junobuild/config": "*",
60
- "semver": "7.*"
60
+ "semver": "7.*",
61
+ "zod": "^3"
61
62
  }
62
63
  }