@nullplatform/ui-plugin-sdk 0.14.0 → 0.15.0

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.
package/dist/catalog.d.ts CHANGED
@@ -23,6 +23,7 @@ export interface CatalogElementSpec {
23
23
  /**
24
24
  * Closed lists for string props. The host drops any other value, so the element draws its default. `prop[].key`
25
25
  * names a key of each item in an array prop, which the host drops from an item whose value isn't in the list.
26
+ * `prop[]` names the items of an array of plain values: the host drops each item that isn't in the list.
26
27
  */
27
28
  values?: Readonly<Record<string, readonly string[]>>;
28
29
  /**
package/dist/catalog.js CHANGED
@@ -444,6 +444,8 @@ const OWN_CATALOG = [
444
444
  disabled: "boolean",
445
445
  },
446
446
  events: { change: "onChange" },
447
+ // Never below an application, whatever a bundle asks for; the host drops any other level.
448
+ values: { "levels[]": ["organization", "account", "namespace", "application"] },
447
449
  },
448
450
  {
449
451
  // Shows one platform resource by its NRN: kind badge, name and, with `showPath`, where it lives
@@ -3,8 +3,14 @@ export type WhenQuery = Record<string, unknown>;
3
3
  * Roots a condition may reference. The API knows how to load each one; anything else is rejected at write time.
4
4
  * `locale` and `route` are in the plugin context but are not roots: the platform resolves installations without
5
5
  * knowing either, so a condition on them could only ever hold in developer mode.
6
+ *
7
+ * `scope` holds on pages under a scope (the scope itself, its deployments), where the host resolves for the scope's
8
+ * NRN. Besides its fields a custom scope carries `specification` (`id`, `slug`, `name`): the scope type, so a
9
+ * contribution can target one kind of scope (`"scope.specification.slug": "release"`) in every organization. A
10
+ * built-in scope has none (its `provider` is not a specification): `scope.type` tells those apart. Anywhere else
11
+ * `scope` is `undefined`, so a condition on it does not match.
6
12
  */
7
- export declare const CONTEXT_ROOTS: readonly ["nrn", "organization", "account", "namespace", "application", "user"];
13
+ export declare const CONTEXT_ROOTS: readonly ["nrn", "organization", "account", "namespace", "application", "scope", "user"];
8
14
  export type ContextRoot = (typeof CONTEXT_ROOTS)[number];
9
15
  export declare const WHEN_LIMITS: {
10
16
  readonly depth: 16;
@@ -8,13 +8,19 @@ import sift from 'sift';
8
8
  * Roots a condition may reference. The API knows how to load each one; anything else is rejected at write time.
9
9
  * `locale` and `route` are in the plugin context but are not roots: the platform resolves installations without
10
10
  * knowing either, so a condition on them could only ever hold in developer mode.
11
+ *
12
+ * `scope` holds on pages under a scope (the scope itself, its deployments), where the host resolves for the scope's
13
+ * NRN. Besides its fields a custom scope carries `specification` (`id`, `slug`, `name`): the scope type, so a
14
+ * contribution can target one kind of scope (`"scope.specification.slug": "release"`) in every organization. A
15
+ * built-in scope has none (its `provider` is not a specification): `scope.type` tells those apart. Anywhere else
16
+ * `scope` is `undefined`, so a condition on it does not match.
11
17
  */
12
- export const CONTEXT_ROOTS = ['nrn', 'organization', 'account', 'namespace', 'application', 'user'];
18
+ export const CONTEXT_ROOTS = ['nrn', 'organization', 'account', 'namespace', 'application', 'scope', 'user'];
13
19
  /**
14
- * In the plugin context, but not usable in a condition yet. Installations resolve for the application's NRN, so the
15
- * platform never loads a scope, a deployment or a build and a condition on any would silently never match.
20
+ * In the plugin context, but not usable in a condition yet. Installations resolve for the application's NRN (or the
21
+ * scope's), so the platform never loads a deployment or a build and a condition on either would silently never match.
16
22
  */
17
- const UNSUPPORTED_ROOTS = new Set(['scope', 'deployment', 'build']);
23
+ const UNSUPPORTED_ROOTS = new Set(['deployment', 'build']);
18
24
  /** Operators that would execute code or are meaningless outside MongoDB. */
19
25
  const ALLOWED_OPERATORS = new Set(['$eq', '$ne', '$gt', '$gte', '$lt', '$lte', '$in', '$nin', '$exists', '$size', '$all', '$elemMatch', '$not', '$and', '$or', '$nor', '$mod']);
20
26
  export const WHEN_LIMITS = { depth: 16, nodes: 512, array: 100, string: 1024 };
@@ -18,13 +18,19 @@ const sift_1 = __importDefault(require("sift"));
18
18
  * Roots a condition may reference. The API knows how to load each one; anything else is rejected at write time.
19
19
  * `locale` and `route` are in the plugin context but are not roots: the platform resolves installations without
20
20
  * knowing either, so a condition on them could only ever hold in developer mode.
21
+ *
22
+ * `scope` holds on pages under a scope (the scope itself, its deployments), where the host resolves for the scope's
23
+ * NRN. Besides its fields a custom scope carries `specification` (`id`, `slug`, `name`): the scope type, so a
24
+ * contribution can target one kind of scope (`"scope.specification.slug": "release"`) in every organization. A
25
+ * built-in scope has none (its `provider` is not a specification): `scope.type` tells those apart. Anywhere else
26
+ * `scope` is `undefined`, so a condition on it does not match.
21
27
  */
22
- exports.CONTEXT_ROOTS = ['nrn', 'organization', 'account', 'namespace', 'application', 'user'];
28
+ exports.CONTEXT_ROOTS = ['nrn', 'organization', 'account', 'namespace', 'application', 'scope', 'user'];
23
29
  /**
24
- * In the plugin context, but not usable in a condition yet. Installations resolve for the application's NRN, so the
25
- * platform never loads a scope, a deployment or a build and a condition on any would silently never match.
30
+ * In the plugin context, but not usable in a condition yet. Installations resolve for the application's NRN (or the
31
+ * scope's), so the platform never loads a deployment or a build and a condition on either would silently never match.
26
32
  */
27
- const UNSUPPORTED_ROOTS = new Set(['scope', 'deployment', 'build']);
33
+ const UNSUPPORTED_ROOTS = new Set(['deployment', 'build']);
28
34
  /** Operators that would execute code or are meaningless outside MongoDB. */
29
35
  const ALLOWED_OPERATORS = new Set(['$eq', '$ne', '$gt', '$gte', '$lt', '$lte', '$in', '$nin', '$exists', '$size', '$all', '$elemMatch', '$not', '$and', '$or', '$nor', '$mod']);
30
36
  exports.WHEN_LIMITS = { depth: 16, nodes: 512, array: 100, string: 1024 };
@@ -35,11 +35,19 @@ export interface PluginContext {
35
35
  slug?: string;
36
36
  name?: string;
37
37
  };
38
- /** Set on scope pages. Not usable in `when` yet (see `CONTEXT_ROOTS`). */
38
+ /**
39
+ * Set on pages under a scope (the scope, its deployments). `specification` is the scope type, the same a `when`
40
+ * reads as `scope.specification.*` (see `CONTEXT_ROOTS`); a host that does not know it leaves it out.
41
+ */
39
42
  scope?: {
40
43
  id: number | string;
41
44
  slug?: string;
42
45
  name?: string;
46
+ specification?: {
47
+ id: string;
48
+ slug?: string;
49
+ name?: string;
50
+ };
43
51
  };
44
52
  /** Set on deployment pages. Not usable in `when` yet (see `CONTEXT_ROOTS`). */
45
53
  deployment?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nullplatform/ui-plugin-sdk",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "SDK for nullplatform UI plugins: catalog components, bridge client and defineUI",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",