@kya-os/consent 0.1.44 → 0.1.46
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/bundle/inline.d.ts.map +1 -1
- package/dist/bundle/inline.js +4 -4
- package/dist/bundle/inline.js.map +1 -1
- package/dist/cjs/bundle/inline.js +4 -4
- package/dist/cjs/bundle/inline.js.map +1 -1
- package/dist/cjs/components/consent-capabilities-screen.js +52 -12
- package/dist/cjs/components/consent-capabilities-screen.js.map +1 -1
- package/dist/cjs/components/consent-capability-card.js +191 -32
- package/dist/cjs/components/consent-capability-card.js.map +1 -1
- package/dist/cjs/components/mcp-consent.js +173 -77
- package/dist/cjs/components/mcp-consent.js.map +1 -1
- package/dist/cjs/mcp-app/inline.js +2 -2
- package/dist/cjs/mcp-app/inline.js.map +1 -1
- package/dist/cjs/resolution/credential-capabilities.js +53 -0
- package/dist/cjs/resolution/credential-capabilities.js.map +1 -0
- package/dist/components/consent-capabilities-screen.d.ts +32 -0
- package/dist/components/consent-capabilities-screen.d.ts.map +1 -1
- package/dist/components/consent-capabilities-screen.js +53 -13
- package/dist/components/consent-capabilities-screen.js.map +1 -1
- package/dist/components/consent-capability-card.d.ts.map +1 -1
- package/dist/components/consent-capability-card.js +191 -32
- package/dist/components/consent-capability-card.js.map +1 -1
- package/dist/components/mcp-consent.d.ts +33 -0
- package/dist/components/mcp-consent.d.ts.map +1 -1
- package/dist/components/mcp-consent.js +173 -77
- package/dist/components/mcp-consent.js.map +1 -1
- package/dist/consent.js +427 -165
- package/dist/consent.min.js +278 -119
- package/dist/mcp-app/inline.d.ts.map +1 -1
- package/dist/mcp-app/inline.js +2 -2
- package/dist/mcp-app/inline.js.map +1 -1
- package/dist/resolution/credential-capabilities.d.ts +25 -0
- package/dist/resolution/credential-capabilities.d.ts.map +1 -0
- package/dist/resolution/credential-capabilities.js +46 -0
- package/dist/resolution/credential-capabilities.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline.js","sourceRoot":"","sources":["../../src/mcp-app/inline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,sEAAsE;AACtE,MAAM,CAAC,MAAM,oBAAoB,GAAW,
|
|
1
|
+
{"version":3,"file":"inline.js","sourceRoot":"","sources":["../../src/mcp-app/inline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,sEAAsE;AACtE,MAAM,CAAC,MAAM,oBAAoB,GAAW,+qlvBAA+qlvB,CAAC;AAE5tlvB,4CAA4C;AAC5C,MAAM,CAAC,MAAM,yBAAyB,GAAW,MAAM,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type AuthMode } from "../types/modes.types.js";
|
|
2
|
+
import type { Capability } from "../types/capabilities.types.js";
|
|
3
|
+
export declare function shouldRenderCapabilityScreen(mode: AuthMode, capabilityCount: number): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* The credential path grants a fixed, all-or-nothing scope set (see the
|
|
6
|
+
* scopes constraint in handleApprove), so every capability starts selected —
|
|
7
|
+
* the rows themselves stay interactive, same as the consent-only path.
|
|
8
|
+
*/
|
|
9
|
+
export declare function shouldSelectAllCapabilities(mode: AuthMode): boolean;
|
|
10
|
+
export declare function areCredentialsComplete(formData: Record<string, string>): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Which capabilities count as selected. In disclosure mode every capability is
|
|
13
|
+
* granted, so all ids are returned; otherwise the operator's `defaultOn` seeds
|
|
14
|
+
* the initial selection.
|
|
15
|
+
*/
|
|
16
|
+
export declare function capabilityIdsFor(capabilities: Capability[], disclosureMode: boolean): string[];
|
|
17
|
+
/**
|
|
18
|
+
* Identity of a seeding decision: the capability ids in order, plus the
|
|
19
|
+
* all-selected flag. Lit compares properties by reference, so a parent that
|
|
20
|
+
* rebuilds its capability array on every render would otherwise re-seed (and
|
|
21
|
+
* wipe the user's toggles) on every keystroke. Seeding is keyed on this value
|
|
22
|
+
* instead of array identity.
|
|
23
|
+
*/
|
|
24
|
+
export declare function capabilitySeedKey(capabilities: Capability[], allSelected: boolean): string;
|
|
25
|
+
//# sourceMappingURL=credential-capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-capabilities.d.ts","sourceRoot":"","sources":["../../src/resolution/credential-capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAYjE,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,QAAQ,EACd,eAAe,EAAE,MAAM,GACtB,OAAO,CAET;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAEnE;AAED,wBAAgB,sBAAsB,CACpC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,OAAO,CAKT;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,UAAU,EAAE,EAC1B,cAAc,EAAE,OAAO,GACtB,MAAM,EAAE,CAIV;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,UAAU,EAAE,EAC1B,WAAW,EAAE,OAAO,GACnB,MAAM,CAER"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { AUTH_MODES } from "../types/modes.types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Modes whose screen is replaced by the humanized capability layout. Credentials
|
|
4
|
+
* is included so the user sees what is being granted before signing in — on the
|
|
5
|
+
* anchor path the sign-in submit IS the approval, so there is no later screen.
|
|
6
|
+
*/
|
|
7
|
+
const CAPABILITY_SCREEN_MODES = [
|
|
8
|
+
AUTH_MODES.CONSENT_ONLY,
|
|
9
|
+
AUTH_MODES.CREDENTIALS,
|
|
10
|
+
];
|
|
11
|
+
export function shouldRenderCapabilityScreen(mode, capabilityCount) {
|
|
12
|
+
return capabilityCount > 0 && CAPABILITY_SCREEN_MODES.includes(mode);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The credential path grants a fixed, all-or-nothing scope set (see the
|
|
16
|
+
* scopes constraint in handleApprove), so every capability starts selected —
|
|
17
|
+
* the rows themselves stay interactive, same as the consent-only path.
|
|
18
|
+
*/
|
|
19
|
+
export function shouldSelectAllCapabilities(mode) {
|
|
20
|
+
return mode === AUTH_MODES.CREDENTIALS;
|
|
21
|
+
}
|
|
22
|
+
export function areCredentialsComplete(formData) {
|
|
23
|
+
return ((formData.username?.trim().length ?? 0) > 0 &&
|
|
24
|
+
(formData.password?.trim().length ?? 0) > 0);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Which capabilities count as selected. In disclosure mode every capability is
|
|
28
|
+
* granted, so all ids are returned; otherwise the operator's `defaultOn` seeds
|
|
29
|
+
* the initial selection.
|
|
30
|
+
*/
|
|
31
|
+
export function capabilityIdsFor(capabilities, disclosureMode) {
|
|
32
|
+
return capabilities
|
|
33
|
+
.filter((capability) => disclosureMode || capability.defaultOn)
|
|
34
|
+
.map((capability) => capability.id);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Identity of a seeding decision: the capability ids in order, plus the
|
|
38
|
+
* all-selected flag. Lit compares properties by reference, so a parent that
|
|
39
|
+
* rebuilds its capability array on every render would otherwise re-seed (and
|
|
40
|
+
* wipe the user's toggles) on every keystroke. Seeding is keyed on this value
|
|
41
|
+
* instead of array identity.
|
|
42
|
+
*/
|
|
43
|
+
export function capabilitySeedKey(capabilities, allSelected) {
|
|
44
|
+
return `${allSelected ? 1 : 0}:${capabilities.map((c) => c.id).join(" ")}`;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=credential-capabilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-capabilities.js","sourceRoot":"","sources":["../../src/resolution/credential-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