@loomweaver/plugin-sdk 0.7.5 → 0.7.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.
- package/package.json +1 -1
- package/src/lib/auth.js +3 -4
- package/src/lib/auth.js.map +1 -1
- package/src/lib/capability.js +3 -0
- package/src/lib/capability.js.map +1 -1
- package/src/lib/dialog-ref.d.ts +2 -2
- package/src/lib/dialog-ref.js +14 -12
- package/src/lib/dialog-ref.js.map +1 -1
package/package.json
CHANGED
package/src/lib/auth.js
CHANGED
|
@@ -11,22 +11,21 @@
|
|
|
11
11
|
export const ANONYMOUS = { authenticated: false, roles: [], claims: {} };
|
|
12
12
|
/** True when `snapshot` satisfies `access`. An undefined requirement is always allowed. */
|
|
13
13
|
export function meetsAccess(access, snapshot) {
|
|
14
|
-
var _a, _b;
|
|
15
14
|
if (!access)
|
|
16
15
|
return true;
|
|
17
16
|
if (access.authenticated !== undefined && access.authenticated !== snapshot.authenticated) {
|
|
18
17
|
return false;
|
|
19
18
|
}
|
|
20
19
|
const held = new Set(snapshot.roles);
|
|
21
|
-
if (
|
|
20
|
+
if (access.anyRole?.length && access.anyRole.every((role) => !held.has(role)))
|
|
22
21
|
return false;
|
|
23
|
-
if (
|
|
22
|
+
if (access.allRoles?.length && access.allRoles.some((role) => !held.has(role)))
|
|
24
23
|
return false;
|
|
25
24
|
return true;
|
|
26
25
|
}
|
|
27
26
|
/** Whether a chrome item should render at all: unmet + `hide` (the default) → not visible. */
|
|
28
27
|
export function isAccessVisible(access, snapshot) {
|
|
29
|
-
return meetsAccess(access, snapshot) ||
|
|
28
|
+
return meetsAccess(access, snapshot) || access?.mode === 'disable';
|
|
30
29
|
}
|
|
31
30
|
/** Whether a rendered chrome item should be disabled: unmet + `disable`. */
|
|
32
31
|
export function isAccessDisabled(access, snapshot) {
|
package/src/lib/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../libs/core/plugin-sdk/src/lib/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA4BH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,SAAS,GAAiB,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAqBvF,2FAA2F;AAC3F,MAAM,UAAU,WAAW,CACzB,MAAqC,EACrC,QAAsB
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../../../../libs/core/plugin-sdk/src/lib/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA4BH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,SAAS,GAAiB,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAqBvF,2FAA2F;AAC3F,MAAM,UAAU,WAAW,CACzB,MAAqC,EACrC,QAAsB;IAEtB,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACzB,IAAI,MAAM,CAAC,aAAa,KAAK,SAAS,IAAI,MAAM,CAAC,aAAa,KAAK,QAAQ,CAAC,aAAa,EAAE,CAAC;QAC1F,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IACrC,IAAI,MAAM,CAAC,OAAO,EAAE,MAAM,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5F,IAAI,MAAM,CAAC,QAAQ,EAAE,MAAM,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7F,OAAO,IAAI,CAAC;AACd,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,eAAe,CAC7B,MAAqC,EACrC,QAAsB;IAEtB,OAAO,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,MAAM,EAAE,IAAI,KAAK,SAAS,CAAC;AACrE,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,gBAAgB,CAC9B,MAAqC,EACrC,QAAsB;IAEtB,OAAO,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACjF,CAAC"}
|
package/src/lib/capability.js
CHANGED
|
@@ -18,6 +18,9 @@ export const CAPABILITIES = [
|
|
|
18
18
|
* loudly here rather than as a silent no-op — part of the `ctx`-boundary error taxonomy.
|
|
19
19
|
*/
|
|
20
20
|
export class CapabilityError extends Error {
|
|
21
|
+
capability;
|
|
22
|
+
pluginId;
|
|
23
|
+
reason;
|
|
21
24
|
constructor(capability, pluginId,
|
|
22
25
|
/** Why this particular call needed the capability, when that is not obvious from the member alone. */
|
|
23
26
|
reason) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability.js","sourceRoot":"","sources":["../../../../../../libs/core/plugin-sdk/src/lib/capability.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,eAAe;IACf,IAAI;IACJ,MAAM;IACN,YAAY;IACZ,SAAS;IACT,OAAO;IACP,YAAY;CACJ,CAAC;AAqBX;;;;GAIG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;
|
|
1
|
+
{"version":3,"file":"capability.js","sourceRoot":"","sources":["../../../../../../libs/core/plugin-sdk/src/lib/capability.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,eAAe;IACf,IAAI;IACJ,MAAM;IACN,YAAY;IACZ,SAAS;IACT,OAAO;IACP,YAAY;CACJ,CAAC;AAqBX;;;;GAIG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAE7B;IACA;IAEA;IAJX,YACW,UAAsB,EACtB,QAAgB;IACzB,sGAAsG;IAC7F,MAAe;QAExB,KAAK,CACH,WAAW,QAAQ,qBAAqB,UAAU,8BAA8B;YAC9E,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAC/B,CAAC;QARO,eAAU,GAAV,UAAU,CAAY;QACtB,aAAQ,GAAR,QAAQ,CAAQ;QAEhB,WAAM,GAAN,MAAM,CAAS;QAMxB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF"}
|
package/src/lib/dialog-ref.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* and read its `data`; `open()` returns it so the caller can await the result via `closed`.
|
|
4
4
|
*/
|
|
5
5
|
export declare class DialogRef<R = unknown> {
|
|
6
|
-
readonly data
|
|
6
|
+
readonly data?: unknown | undefined;
|
|
7
7
|
private resolveClosed;
|
|
8
8
|
private settled;
|
|
9
9
|
private readonly maximizedState;
|
|
@@ -14,7 +14,7 @@ export declare class DialogRef<R = unknown> {
|
|
|
14
14
|
readonly maximized: import("@angular/core").Signal<boolean>;
|
|
15
15
|
/** Resolves with the dialog result once it closes (or `undefined` if dismissed). */
|
|
16
16
|
readonly closed: Promise<R | undefined>;
|
|
17
|
-
constructor(data?: unknown);
|
|
17
|
+
constructor(data?: unknown | undefined);
|
|
18
18
|
/**
|
|
19
19
|
* Toggles near-fullscreen. The host frame shows a maximize/restore control when the dialog was
|
|
20
20
|
* opened with `maximizable`; a bare dialog draws its own control and calls this directly.
|
package/src/lib/dialog-ref.js
CHANGED
|
@@ -4,19 +4,21 @@ import { signal } from '@angular/core';
|
|
|
4
4
|
* and read its `data`; `open()` returns it so the caller can await the result via `closed`.
|
|
5
5
|
*/
|
|
6
6
|
export class DialogRef {
|
|
7
|
-
|
|
7
|
+
data;
|
|
8
|
+
resolveClosed;
|
|
9
|
+
settled = false;
|
|
10
|
+
maximizedState = signal(false);
|
|
11
|
+
/**
|
|
12
|
+
* Whether the dialog is currently maximized to near-fullscreen. The host frame reacts (panel
|
|
13
|
+
* size); a bare dialog body reads it to stretch its own chrome.
|
|
14
|
+
*/
|
|
15
|
+
maximized = this.maximizedState.asReadonly();
|
|
16
|
+
/** Resolves with the dialog result once it closes (or `undefined` if dismissed). */
|
|
17
|
+
closed = new Promise((resolve) => {
|
|
18
|
+
this.resolveClosed = resolve;
|
|
19
|
+
});
|
|
20
|
+
constructor(data) {
|
|
8
21
|
this.data = data;
|
|
9
|
-
this.settled = false;
|
|
10
|
-
this.maximizedState = signal(false);
|
|
11
|
-
/**
|
|
12
|
-
* Whether the dialog is currently maximized to near-fullscreen. The host frame reacts (panel
|
|
13
|
-
* size); a bare dialog body reads it to stretch its own chrome.
|
|
14
|
-
*/
|
|
15
|
-
this.maximized = this.maximizedState.asReadonly();
|
|
16
|
-
/** Resolves with the dialog result once it closes (or `undefined` if dismissed). */
|
|
17
|
-
this.closed = new Promise((resolve) => {
|
|
18
|
-
this.resolveClosed = resolve;
|
|
19
|
-
});
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* Toggles near-fullscreen. The host frame shows a maximize/restore control when the dialog was
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog-ref.js","sourceRoot":"","sources":["../../../../../../libs/core/plugin-sdk/src/lib/dialog-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;;GAGG;AACH,MAAM,OAAO,SAAS;
|
|
1
|
+
{"version":3,"file":"dialog-ref.js","sourceRoot":"","sources":["../../../../../../libs/core/plugin-sdk/src/lib/dialog-ref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;;GAGG;AACH,MAAM,OAAO,SAAS;IAgBC;IAfb,aAAa,CAAmC;IAChD,OAAO,GAAG,KAAK,CAAC;IACP,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAEhD;;;OAGG;IACM,SAAS,GAAG,IAAI,CAAC,cAAc,CAAC,UAAU,EAAE,CAAC;IAEtD,oFAAoF;IAC3E,MAAM,GAA2B,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAChE,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC;IAC/B,CAAC,CAAC,CAAC;IAEH,YAAqB,IAAc;QAAd,SAAI,GAAJ,IAAI,CAAU;IAAG,CAAC;IAEvC;;;OAGG;IACH,eAAe;QACb,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;IAChD,CAAC;IAED,uFAAuF;IACvF,KAAK,CAAC,MAAU;QACd,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACjB,OAAO;QACT,CAAC;QACD,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC;QACpB,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC7B,CAAC;CACF"}
|