@wcstack/credential 1.20.0 → 1.21.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/README.ja.md +5 -0
- package/README.md +6 -0
- package/dist/index.d.ts +133 -40
- package/dist/index.esm.js +566 -120
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../src/config.ts","../src/core/CredentialCore.ts","../src/components/Credential.ts","../src/registerComponents.ts","../src/bootstrapCredential.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n credential: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n credential: \"wcs-credential\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\n// Note: this is the live, mutable internal config. It is not part of the public\n// package exports (see exports.ts) — only `getConfig()` (a frozen snapshot) is\n// surfaced. `setConfig()` is applied internally via `bootstrapCredential()` and\n// is not re-exported from the package root, though a deep path import\n// (`.../src/config.js`) can still reach and mutate it. Accepted as-is for\n// cross-package consistency: every @wcstack package follows this same shape.\n// Use `getConfig()` for a frozen, safe read.\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\nexport function setConfig(partialConfig: IWritableConfig): void {\n if (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","import { CredentialGetOptions, IWcBindable, StorableCredential } from \"../types.js\";\n\n/**\n * Headless Credential Management primitive. A thin, framework-agnostic\n * wrapper around `navigator.credentials.get()`/`.store()` exposed through the\n * wc-bindable protocol.\n *\n * Reuses batch3's \"thin command\" archetype established by `@wcstack/share`\n * (docs/credential-tag-design.md): single `_gen` generation guard,\n * same-value-guarded private setters, never-throw try/catch, no\n * `AbortController`/`abort()` command.\n *\n * **v1 scope excludes WebAuthn (`publicKey`)** — see docs/credential-tag-design.md\n * §0. `get()` validates and strips a `publicKey` option rather than silently\n * forwarding it, surfacing the attempt as a scope-violation `error` instead of\n * accidentally supporting WebAuthn through a side door.\n *\n * **`get()`/`store()` share one `_gen`** — an accepted v1 simplification\n * (docs/multi-promise-io-node-design.md): these two operations are used\n * sequentially in real auth flows (store after a successful login, get before\n * attempting one), not naturally concurrently on the same instance. If both\n * ARE invoked concurrently on the same `<wcs-credential>`, the later call's\n * generation bump silently drops the earlier call's completion write. If this\n * limitation actually bites, use two separate `<wcs-credential>` instances\n * (one for get, one for store) rather than reworking the Core.\n */\nexport class CredentialCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"value\", event: \"wcs-credential:complete\", getter: (e: Event) => (e as CustomEvent).detail.value },\n { name: \"loading\", event: \"wcs-credential:loading-changed\" },\n { name: \"error\", event: \"wcs-credential:error\" },\n { name: \"cancelled\", event: \"wcs-credential:cancelled-changed\" },\n ],\n commands: [\n { name: \"get\", async: true },\n { name: \"store\", async: true },\n ],\n };\n\n private _target: EventTarget;\n private _value: Credential | null = null;\n private _loading: boolean = false;\n private _error: any = null;\n private _cancelled: boolean = false;\n // Generation guard (§3.4): shared by get() and store() (see class docs on\n // the accepted concurrency limitation this implies).\n private _gen = 0;\n // SSR (§3.8): no asynchronous probe to await, so readiness is immediate.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n get ready(): Promise<void> {\n return this._ready;\n }\n\n get value(): Credential | null {\n return this._value;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): any {\n return this._error;\n }\n\n get cancelled(): boolean {\n return this._cancelled;\n }\n\n // Lifecycle (§3.5). Command-driven with no subscription to establish, so\n // observe() is an idempotent no-op that resolves once ready; dispose() only\n // invalidates any in-flight get()/store() (there is nothing to unsubscribe).\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this._gen++;\n }\n\n private _setLoading(loading: boolean): void {\n if (this._loading === loading) return;\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n // Deliberately NO same-value guard (unlike error/loading/cancelled below).\n // `value` is a success-completion signal, not idempotent state: it is written\n // only on a successful get()/store(), and wcs-credential:complete is the *sole*\n // success notification. store() echoes the caller's credential argument, so two\n // consecutive successful store() calls with the same object reference are two\n // distinct completions and must each re-fire wcs-credential:complete so an\n // `$on`/eventToken consumer (and a `value:` binding) sees every success. This\n // matches clipboard `_setRead` / broadcast `_setMessage`, which carve\n // result/event values out of the §3.3 guard for the same reason.\n private _setValue(value: Credential | null): void {\n this._value = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:complete\", {\n detail: { value },\n bubbles: true,\n }));\n }\n\n private _setError(error: any): void {\n if (this._error === error) return;\n this._error = error;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n private _setCancelled(cancelled: boolean): void {\n if (this._cancelled === cancelled) return;\n this._cancelled = cancelled;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:cancelled-changed\", {\n detail: cancelled,\n bubbles: true,\n }));\n }\n\n private _api(): typeof navigator.credentials | undefined {\n const nav = (globalThis as any).navigator;\n return nav?.credentials;\n }\n\n // Normalizes a rejection reason to a consistent { name, message } shape,\n // mirroring WorkerCore._normalizeError (packages/worker/src/core/WorkerCore.ts).\n private _normalizeError(e: unknown): { name: string; message: string } {\n if (e instanceof Error) {\n return { name: e.name, message: e.message };\n }\n return { name: \"Error\", message: String(e) };\n }\n\n // Classifies a get()/store() rejection as a user cancellation vs a real\n // failure (docs/credential-tag-design.md §2/§5). For the Credential\n // Management API the browser rejects with `NotAllowedError` when the user\n // dismisses/declines the native account-chooser UI — this is a routine \"the\n // user did not pick\" outcome, not a platform failure, so it maps to\n // `cancelled` and is kept out of `error`. Note this is `NotAllowedError`,\n // NOT `AbortError`: unlike Web Share/Contact Picker (whose APIs reject with\n // `AbortError` on dismissal), credentials.get()/store() signal user refusal\n // via `NotAllowedError`. Every other name (SecurityError, NetworkError, a\n // programmatic signal abort, etc.) flows to `error`.\n private _isCancellation(e: unknown): boolean {\n return (e as { name?: unknown } | null)?.name === \"NotAllowedError\";\n }\n\n /**\n * `get(options)` — v1 scope excludes `publicKey` (WebAuthn). If present, it\n * is stripped and the call surfaces a scope-violation `error` instead of\n * forwarding it to the platform API (which would accidentally support\n * WebAuthn through a side door). `navigator.credentials.get()` does not\n * require a user gesture (unlike Web Share/Fullscreen), so this can be\n * invoked automatically on page load for a \"silent sign-in\" flow.\n */\n async get(options: CredentialGetOptions & { publicKey?: unknown } = {}): Promise<Credential | null> {\n if (\"publicKey\" in options) {\n this._setError({ name: \"NotSupportedError\", message: \"WebAuthn (publicKey) is out of scope for @wcstack/credential v1. Use a dedicated WebAuthn node instead.\" });\n return null;\n }\n\n const api = this._api();\n if (!api) {\n this._setError({ message: \"Credential Management API is not supported in this browser.\" });\n return null;\n }\n\n const gen = ++this._gen;\n\n this._setLoading(true);\n // Reset the previous outcome before starting a new get so a stale\n // cancelled/error does not linger into this call's result.\n this._setError(null);\n this._setCancelled(false);\n\n try {\n const credential = await api.get(options as CredentialRequestOptions);\n\n if (gen !== this._gen) return null; // stale (dispose() ran while awaiting)\n\n this._setValue(credential);\n this._setLoading(false);\n return credential;\n } catch (e: any) {\n if (gen !== this._gen) return null;\n if (this._isCancellation(e)) {\n this._setCancelled(true);\n } else {\n this._setError(this._normalizeError(e));\n }\n this._setLoading(false);\n return null;\n }\n }\n\n /**\n * `store(credential)` — shares the same single `_gen` as `get()` (see class\n * docs). `navigator.credentials.store()` resolves `Promise<void>` (per\n * `lib.dom.d.ts`) — there is no payload to read off the API, so `value` is\n * synthesized as an echo of the caller's `credential`, mirroring\n * `ShareCore.share()`'s same accommodation for `navigator.share()`.\n *\n * A `PublicKeyCredential` (`type === \"public-key\"`, WebAuthn) is rejected as a\n * scope violation before touching the platform API — the same v1 boundary\n * `get()` enforces on the `publicKey` option (docs/credential-tag-design.md\n * §3.2), so this node never becomes a WebAuthn store backdoor.\n */\n async store(credential: StorableCredential): Promise<Credential | null> {\n if ((credential as { type?: unknown } | null)?.type === \"public-key\") {\n this._setError({ name: \"NotSupportedError\", message: \"WebAuthn (publicKey) credentials are out of scope for @wcstack/credential v1. Use a dedicated WebAuthn node instead.\" });\n return null;\n }\n\n const api = this._api();\n if (!api) {\n this._setError({ message: \"Credential Management API is not supported in this browser.\" });\n return null;\n }\n\n const gen = ++this._gen;\n\n this._setLoading(true);\n // Reset the previous outcome before starting a new store so a stale\n // cancelled/error does not linger into this call's result.\n this._setError(null);\n this._setCancelled(false);\n\n try {\n await api.store(credential);\n\n if (gen !== this._gen) return null;\n\n this._setValue(credential);\n this._setLoading(false);\n return credential;\n } catch (e: any) {\n if (gen !== this._gen) return null;\n if (this._isCancellation(e)) {\n this._setCancelled(true);\n } else {\n this._setError(this._normalizeError(e));\n }\n this._setLoading(false);\n return null;\n }\n }\n}\n","import { CredentialGetOptions, IWcBindable, StorableCredential } from \"../types.js\";\nimport { CredentialCore } from \"../core/CredentialCore.js\";\n\n/**\n * `<wcs-credential>` — declarative Credential Management API primitive\n * (password/federated only — see docs/credential-tag-design.md §0 for the\n * WebAuthn scope exclusion).\n *\n * A thin command-only Shell (mirrors `<wcs-share>`): no attributes at all.\n * `get(options)`/`store(credential)`'s arguments are per-call.\n */\nexport class WcsCredential extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...CredentialCore.wcBindable,\n inputs: [],\n // Inherit commands from Core (single source of truth).\n commands: CredentialCore.wcBindable.commands,\n };\n\n private _core: CredentialCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new CredentialCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-credential:loading-changed\": (d) => ({ loading: d === true }),\n \"wcs-credential:cancelled-changed\": (d) => ({ cancelled: d === true }),\n \"wcs-credential:error\": (d) => ({ error: d != null }),\n });\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\n }\n\n // --- Core delegated getters ---\n\n get value(): Credential | null {\n return this._core.value;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get cancelled(): boolean {\n return this._core.cancelled;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Commands ---\n\n get(options?: CredentialGetOptions): Promise<Credential | null> {\n return this._core.get(options);\n }\n\n store(credential: StorableCredential): Promise<Credential | null> {\n return this._core.store(credential);\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n this.style.display = \"none\";\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n}\n","import { WcsCredential } from \"./components/Credential.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.credential)) {\n customElements.define(config.tagNames.credential, WcsCredential);\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapCredential(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n"],"names":[],"mappings":"AAQA,MAAM,OAAO,GAAoB;AAC/B,IAAA,QAAQ,EAAE;AACR,QAAA,UAAU,EAAE,gBAAgB;AAC7B,KAAA;CACF;AAED,SAAS,UAAU,CAAI,GAAM,EAAA;AAC3B,IAAA,IAAI,GAAG,KAAK,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;AAAE,QAAA,OAAO,GAAG;AACvD,IAAA,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;IAClB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;AAClC,QAAA,UAAU,CAAE,GAA+B,CAAC,GAAG,CAAC,CAAC;IACnD;AACA,IAAA,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,EAAE;QACd,SAAS,CAAC,UAAU,CAAC;IACvB;AACA,IAAA,kBAAkB,EAAE;AACtB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../src/config.ts","../src/core/operationLane.ts","../src/core/platformCapability.ts","../src/core/credentialCapabilities.ts","../src/core/CredentialCore.ts","../src/components/Credential.ts","../src/registerComponents.ts","../src/bootstrapCredential.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n credential: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n credential: \"wcs-credential\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\n// Note: this is the live, mutable internal config. It is not part of the public\n// package exports (see exports.ts) — only `getConfig()` (a frozen snapshot) is\n// surfaced. `setConfig()` is applied internally via `bootstrapCredential()` and\n// is not re-exported from the package root, though a deep path import\n// (`.../src/config.js`) can still reach and mutate it. Accepted as-is for\n// cross-package consistency: every @wcstack package follows this same shape.\n// Use `getConfig()` for a frozen, safe read.\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\nexport function setConfig(partialConfig: IWritableConfig): void {\n if (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /io-core/operation-lane.ts by scripts/sync-io-core.mjs.\n// Run `node scripts/sync-io-core.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * operationLane.ts\n *\n * Phase 4 (docs/architecture-hardening/09-remediation-design.md §5, §5.1) の\n * OperationTicket / CommitGuard / terminal CAS を型付き実装した lane プリミティブ。\n * docs/async-execution-model.md §5 が既に規範化した排他モード\n * (latest / queue / exhaust / overlap) を、`AbortController` だけでは防げない\n * 「取消不能な Promise・abort と同時に完了した結果の commit」から守るための\n * 実行時ガードとして具体化する。\n *\n * 配置方針 (§5): 本ファイルは /io-core/ の単一正典であり、scripts/sync-io-core.mjs が\n * 各 IO ノードの src/core/ へ生成コピー (AUTO-GENERATED, 編集禁止) を配布する。\n * `protocol/wcBindable.ts` と同じ copy-distribution 方式で、ランタイム依存を導入せず\n * 各パッケージのバンドルへ inline される (zero-runtime-dep / 自己完結 CDN を維持)。\n * 編集はこの正典に対して行い、`node scripts/sync-io-core.mjs` で再配布する。\n *\n * PoC 実装対象は fetch の `latest` policy のみ。queue / exhaust / overlap は\n * 「全 policy の lane unit」(§8 完了条件) として `operationLane.test.ts` が\n * 直接検証する。lane 自体は promise を実行せず、bookkeeping と guard の\n * 状態機械に徹する — 実際の非同期処理は Core が駆動し lane に照合する。\n */\n\n/** §5: 排他モードの語彙。async-execution-model.md §5 の 4 モードに対応 (parallel は予約語・スコープ外)。 */\nexport type LanePolicy = \"latest\" | \"queue\" | \"exhaust\" | \"overlap\";\n\n/** §5: 各 operation の一回限りの終端結果。 */\nexport type TerminalOutcome = \"success\" | \"error\" | \"timeout\" | \"aborted\" | \"stale\";\n\n/** §5: 論理操作 1 件の identity。retry は同じ operationId を再利用する。 */\nexport interface OperationTicket {\n readonly operationId: number;\n /** 発行時に捕捉した I/O Core の observe / reconnect / dispose lifecycle 世代。 */\n readonly ownerGeneration: number;\n readonly laneKey: string;\n readonly policy: LanePolicy;\n /** supersede bookkeeping に使う epoch (latest policy のみ)。 */\n readonly supersedeEpoch?: number;\n}\n\n/** §5: operation の 1 回の試行。retry で attempt++ と resource signal だけ差し替える。 */\nexport interface OperationAttempt {\n readonly operationId: number;\n readonly attempt: number;\n readonly signal?: AbortSignal;\n}\n\n/** §6: DevTools 側 channel へ流す trace(fetch では既定 off・zero-cost)。 */\nexport type OperationTraceEvent =\n | { readonly type: \"io:operation-started\"; readonly operationId: number; readonly laneKey: string; readonly policy: LanePolicy }\n | { readonly type: \"io:operation-retried\"; readonly operationId: number; readonly laneKey: string; readonly attempt: number }\n | { readonly type: \"io:operation-settled\"; readonly operationId: number; readonly laneKey: string; readonly outcome: TerminalOutcome }\n | { readonly type: \"io:stale-dropped\"; readonly operationId: number; readonly laneKey: string };\n\nexport interface OperationLaneOptions {\n /** attempt ごとに AbortController を発行し signal を渡す (fetch/upload 系)。 */\n readonly withSignal?: boolean;\n /**\n * trace subscriber。undefined なら trace record を一切生成しない\n * (§10.3 hook-off zero allocation の gate)。\n */\n readonly trace?: (event: OperationTraceEvent) => void;\n}\n\n/** 内部の終端状態。absence = pending。'committing' は multi-setter commit 中の中間状態。 */\ntype TerminalStatus = \"committing\" | TerminalOutcome;\n\n/**\n * 1 レーン = 独立した排他単位。Core が 1 つ以上所有する (module singleton にしない —\n * 複数 <wcs-fetch> 間で漏れるため)。\n */\nexport class OperationLane {\n readonly laneKey: string;\n readonly policy: LanePolicy;\n\n private _ownerGeneration = 0;\n private _latestEpoch = 0;\n private _nextOperationId = 1;\n // latest / queue / exhaust の単一 active。queue は head を指す。\n private _activeOperationId: number | undefined = undefined;\n // overlap の active set (§5: 内部 bookkeeping のみ・observable 公開はしない)。\n private readonly _activeOperationIds = new Set<number>();\n // queue policy の FIFO。\n private readonly _queue: OperationTicket[] = [];\n private _inFlightCount = 0;\n // opId → 終端状態 (absence = pending)。\n private readonly _terminal = new Map<number, TerminalStatus>();\n // claimTerminal で確定した outcome (finalize が 'committing' を最終値へ移す)。\n private readonly _claimedOutcome = new Map<number, TerminalOutcome>();\n // opId → AbortController (identity は opId が保証。cross-op clobber は構造上起きない)。\n private readonly _controllers = new Map<number, AbortController>();\n // opId → attempt 数。\n private readonly _attempts = new Map<number, number>();\n private readonly _withSignal: boolean;\n private readonly _trace?: (event: OperationTraceEvent) => void;\n\n constructor(laneKey: string, policy: LanePolicy, options: OperationLaneOptions = {}) {\n this.laneKey = laneKey;\n this.policy = policy;\n this._withSignal = options.withSignal ?? false;\n this._trace = options.trace;\n }\n\n get ownerGeneration(): number {\n return this._ownerGeneration;\n }\n\n get inFlightCount(): number {\n return this._inFlightCount;\n }\n\n get latestEpoch(): number {\n return this._latestEpoch;\n }\n\n get activeOperationId(): number | undefined {\n return this._activeOperationId;\n }\n\n /**\n * 新しい要求の到着。arrival policy を適用し ticket + 最初の attempt を発行する。\n * exhaust で実行中の場合だけ null を返す (新要求を ticket 化せず拒否 = 冪等 no-op)。\n */\n begin(): { ticket: OperationTicket; attempt: OperationAttempt } | null {\n let supersedeEpoch: number | undefined;\n switch (this.policy) {\n case \"latest\": {\n // latestEpoch を進め、旧 active を abort (可能なら)。旧 ticket は settle 時に\n // eligibility 不一致で stale となる。\n supersedeEpoch = ++this._latestEpoch;\n if (this._activeOperationId !== undefined) {\n this._abortController(this._activeOperationId);\n }\n break;\n }\n case \"exhaust\": {\n // 実行中なら新要求を拒否 (呼び出し側は既存結果へ合流)。\n if (this._activeOperationId !== undefined) {\n return null;\n }\n break;\n }\n case \"queue\":\n case \"overlap\":\n break;\n }\n\n const operationId = this._nextOperationId++;\n const ticket: OperationTicket = {\n operationId,\n ownerGeneration: this._ownerGeneration,\n laneKey: this.laneKey,\n policy: this.policy,\n supersedeEpoch,\n };\n\n switch (this.policy) {\n case \"latest\":\n case \"exhaust\":\n this._activeOperationId = operationId;\n break;\n case \"queue\":\n this._queue.push(ticket);\n // 先頭だけを active にする (先行が完了するまで待つ)。\n if (this._activeOperationId === undefined) {\n this._activeOperationId = operationId;\n }\n break;\n case \"overlap\":\n this._activeOperationIds.add(operationId);\n break;\n }\n\n this._inFlightCount += 1;\n this._attempts.set(operationId, 1);\n const attempt = this._makeAttempt(operationId, 1);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:operation-started\", operationId, laneKey: this.laneKey, policy: this.policy });\n }\n return { ticket, attempt };\n }\n\n /**\n * retry: 同じ operationId に新しい attempt を作る。attempt number と resource signal\n * だけを更新する (§5)。既に終端した operation には作れない (null)。\n */\n retry(ticket: OperationTicket): OperationAttempt | null {\n if (ticket.ownerGeneration !== this._ownerGeneration) return null;\n if (this._terminal.has(ticket.operationId)) return null;\n const previous = this._attempts.get(ticket.operationId);\n if (previous === undefined) return null;\n const attemptNo = previous + 1;\n this._attempts.set(ticket.operationId, attemptNo);\n // 前の attempt の signal は破棄し、新しい controller を張る。\n this._releaseController(ticket.operationId);\n const attempt = this._makeAttempt(ticket.operationId, attemptNo);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:operation-retried\", operationId: ticket.operationId, laneKey: this.laneKey, attempt: attemptNo });\n }\n return attempt;\n }\n\n /**\n * CommitGuard (§5.1)。外部可視の setter / event dispatch の直前に呼ぶ。\n * (1) owner lifecycle generation 一致 (2) terminal settle 前 (3) policy eligibility。\n */\n canCommit(ticket: OperationTicket): boolean {\n if (ticket.ownerGeneration !== this._ownerGeneration) return false;\n const status = this._terminal.get(ticket.operationId);\n // absence = pending / 'committing' = multi-setter commit 中。どちらも settle 前。\n if (status !== undefined && status !== \"committing\") return false;\n return this._isEligible(ticket);\n }\n\n /**\n * terminal CAS (§5.1): pending → committing を claim する。勝者だけが true。\n * eligibility / owner gen を満たさない場合も false。claim 後は commit 中となり、\n * canCommit は各 setter の直前で再検査する (setter が同期 supersede しても取りこぼさない)。\n */\n claimTerminal(ticket: OperationTicket, outcome: TerminalOutcome): boolean {\n if (ticket.ownerGeneration !== this._ownerGeneration) return false;\n if (this._terminal.has(ticket.operationId)) return false; // 既に committing / 終端\n if (!this._isEligible(ticket)) return false;\n this._terminal.set(ticket.operationId, \"committing\");\n this._claimedOutcome.set(ticket.operationId, outcome);\n return true;\n }\n\n /** claim 済み outcome (timer が claim → catch が読む等)。未 claim なら undefined。 */\n claimedOutcome(ticket: OperationTicket): TerminalOutcome | undefined {\n return this._claimedOutcome.get(ticket.operationId);\n }\n\n /**\n * operation の後始末。claim 済みなら outcome を確定し、未 claim なら stale-drop。\n * controller を解放し in-flight を減らし、policy の bookkeeping を進める。冪等。\n */\n finalize(ticket: OperationTicket): void {\n const operationId = ticket.operationId;\n const status = this._terminal.get(operationId);\n if (status !== undefined && status !== \"committing\") {\n // 既に確定済み。冪等に return。\n return;\n }\n let outcome: TerminalOutcome;\n if (status === \"committing\") {\n outcome = this._claimedOutcome.get(operationId) ?? \"stale\";\n } else {\n // 一度も claim されなかった (supersede / dispose で eligibility を失った)。\n outcome = \"stale\";\n }\n this._terminal.set(operationId, outcome);\n this._claimedOutcome.delete(operationId);\n this._releaseController(operationId);\n this._attempts.delete(operationId);\n if (this._inFlightCount > 0) this._inFlightCount -= 1;\n this._advanceBookkeeping(operationId);\n if (this._trace !== undefined) {\n if (outcome === \"stale\") {\n this._trace({ type: \"io:stale-dropped\", operationId, laneKey: this.laneKey });\n } else {\n this._trace({ type: \"io:operation-settled\", operationId, laneKey: this.laneKey, outcome });\n }\n }\n }\n\n /** operation の signal (resource 解放用)。withSignal でなければ undefined。 */\n signalOf(ticket: OperationTicket): AbortSignal | undefined {\n return this._controllers.get(ticket.operationId)?.signal;\n }\n\n /** best-effort な resource 中断。正しさは owner gen / eligibility / terminal CAS が担う。 */\n abort(ticket: OperationTicket): void {\n this._abortController(ticket.operationId);\n }\n\n /**\n * 現在 active な operation を中断する (利用者による明示キャンセル)。epoch は進めない —\n * 中断された operation は eligibility を保ったまま 'aborted' を claim できる\n * (loading をクリアしつつ in-flight 状態を残す)。\n */\n abortActive(): void {\n if (this._activeOperationId !== undefined) {\n this._abortController(this._activeOperationId);\n }\n for (const operationId of this._activeOperationIds) {\n this._abortController(operationId);\n }\n }\n\n /**\n * dispose (§4.1 world generation)。owner generation を bump して全 ticket を無効化し、\n * 生きている controller を全て abort する。dispose 後に settle した operation は\n * owner gen 不一致で外部 commit しない。retention gate (§10.3) のため live な\n * 全 operation を即時に stale として finalize し、controller / attempt を解放する。\n */\n disposeOwner(): void {\n this._ownerGeneration += 1;\n for (const operationId of Array.from(this._controllers.keys())) {\n this._abortController(operationId);\n // finalize は dispose 後 (terminal='stale') に early-return するため controller を\n // 解放しない。retention gate (§10.3) を満たすためここで明示的に解放する。\n this._releaseController(operationId);\n }\n for (const operationId of Array.from(this._attempts.keys())) {\n if (!this._terminal.has(operationId)) {\n this._terminal.set(operationId, \"stale\");\n }\n this._claimedOutcome.delete(operationId);\n this._attempts.delete(operationId);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:stale-dropped\", operationId, laneKey: this.laneKey });\n }\n }\n this._activeOperationId = undefined;\n this._activeOperationIds.clear();\n this._queue.length = 0;\n this._inFlightCount = 0;\n }\n\n // --- internal ---\n\n private _makeAttempt(operationId: number, attemptNo: number): OperationAttempt {\n let signal: AbortSignal | undefined;\n // AbortController 不在環境(古い runtime / 一部 SSR)では degraded: signal なしで進む。\n // 正しさは owner generation / eligibility / terminal CAS が担うため、native 中断が\n // 無くても supersede / dispose は機能する(best-effort resource 中断が省かれるだけ)。\n if (this._withSignal && typeof AbortController === \"function\") {\n const controller = new AbortController();\n this._controllers.set(operationId, controller);\n signal = controller.signal;\n }\n return { operationId, attempt: attemptNo, signal };\n }\n\n private _isEligible(ticket: OperationTicket): boolean {\n switch (this.policy) {\n case \"latest\":\n return ticket.supersedeEpoch === this._latestEpoch;\n case \"queue\":\n case \"exhaust\":\n return this._activeOperationId === ticket.operationId;\n case \"overlap\":\n return this._activeOperationIds.has(ticket.operationId);\n }\n }\n\n private _advanceBookkeeping(operationId: number): void {\n switch (this.policy) {\n case \"latest\":\n case \"exhaust\":\n if (this._activeOperationId === operationId) {\n this._activeOperationId = undefined;\n }\n break;\n case \"queue\": {\n // 完了した ticket を FIFO から取り除き、次の先頭を active にする。filter で\n // 「先頭 / 非先頭 / 不在」を一様に扱う (finalize は冪等ガードを通った op のみ到達)。\n const remaining = this._queue.filter((t) => t.operationId !== operationId);\n this._queue.length = 0;\n this._queue.push(...remaining);\n this._activeOperationId = this._queue.length > 0 ? this._queue[0].operationId : undefined;\n break;\n }\n case \"overlap\":\n this._activeOperationIds.delete(operationId);\n break;\n }\n }\n\n private _abortController(operationId: number): void {\n const controller = this._controllers.get(operationId);\n if (controller !== undefined && !controller.signal.aborted) {\n controller.abort();\n }\n }\n\n private _releaseController(operationId: number): void {\n this._controllers.delete(operationId);\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /io-core/platform-capability.ts by scripts/sync-io-core.mjs.\n// Run `node scripts/sync-io-core.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * platform-capability.ts\n *\n * Phase 6(docs/architecture-hardening/09-remediation-design.md §7.2 /\n * 07-browser-capability-variance.md)の browser capability 判定と error taxonomy の\n * 汎用プリミティブ。node 固有の capability registry / error code は各パッケージが\n * 別ファイルで宣言し、この汎用層(型 + assess 機構)を import する。\n *\n * 原則:\n * - feature detection は境界(利用直前)で行う。module 評価時に browser global を\n * 参照しない(SSR / worker で import が失敗しない)。\n * - capability ID(`web.fetch` 等)は文字列を global property path として eval せず、\n * registry が ID ごとに副作用のない presence probe を対応付ける。\n * - availability / permission / readiness / activity / operation error を 1 つの\n * `ready / unsupported / error` enum に畳まない。required 欠如は開始しない、\n * optional 欠如は宣言済み fallback で readiness を `degraded` にする。\n *\n * 配置: 本ファイルは /io-core/ の単一正典であり、scripts/sync-io-core.mjs が\n * 各 IO ノードの src/core/ へ生成コピー (AUTO-GENERATED, 編集禁止) を配布する。\n * `protocol/wcBindable.ts` と同じ copy-distribution 方式で、ランタイム依存を導入せず\n * 各パッケージのバンドルへ inline される (zero-runtime-dep / 自己完結 CDN を維持)。\n * 編集はこの正典に対して行い、`node scripts/sync-io-core.mjs` で再配布する。\n *\n * pure(module 評価時に browser global 非参照)。\n */\n\nexport type Availability = \"available\" | \"missing\" | \"unknown\";\nexport type PermissionState = \"granted\" | \"denied\" | \"prompt\" | \"not-applicable\" | \"unknown\";\nexport type Readiness = \"idle\" | \"ready\" | \"degraded\";\nexport type Activity = \"inactive\" | \"active\";\nexport type PreconditionState = \"satisfied\" | \"required\" | \"not-applicable\";\n\n/** operation error の phase(taxonomy)。 */\nexport type WcsIoErrorPhase = \"probe\" | \"start\" | \"execute\" | \"decode\" | \"commit\" | \"dispose\";\n\n/** serializable な error info(non-cloneable な cause とは分離。DevTools / remote へは info のみ)。 */\nexport interface WcsIoErrorInfo {\n readonly code: string;\n readonly phase: WcsIoErrorPhase;\n readonly recoverable: boolean;\n readonly capabilityId?: string;\n readonly message: string;\n}\n\nexport interface PlatformAssessment {\n readonly availability: ReadonlyMap<string, Availability>;\n readonly permission: PermissionState;\n readonly readiness: Readiness;\n readonly activity: Activity;\n readonly preconditions: {\n readonly secureContext: PreconditionState;\n readonly userActivation: PreconditionState;\n };\n readonly epoch: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\n/** capability 1 件の仕様。probe は副作用なく presence を返す(利用直前に呼ぶ)。 */\nexport interface CapabilitySpec {\n readonly probe: () => boolean;\n readonly requiresSecureContext?: boolean;\n readonly requiresUserActivation?: boolean;\n /** browser compatibility dataset のキー(任意・診断用)。 */\n readonly compatKey?: string;\n}\n\nexport type CapabilityRegistry = ReadonlyMap<string, CapabilitySpec>;\n\nexport interface AssessOptions {\n readonly required: readonly string[];\n readonly optional?: readonly string[];\n readonly permission?: PermissionState;\n readonly activity?: Activity;\n readonly epoch?: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\nfunction isSecureContext(): boolean {\n return (globalThis as { isSecureContext?: unknown }).isSecureContext === true;\n}\n\n/**\n * capability を利用直前に評価して PlatformAssessment を作る。\n * required が 1 つでも欠ければ readiness は \"idle\"(開始不可)、\n * required 揃い + optional 欠けは \"degraded\"、全揃いは \"ready\"。\n */\nexport function assessCapabilities(registry: CapabilityRegistry, options: AssessOptions): PlatformAssessment {\n const availability = new Map<string, Availability>();\n const evaluate = (id: string): Availability => {\n const spec = registry.get(id);\n if (spec === undefined) return \"unknown\";\n return spec.probe() ? \"available\" : \"missing\";\n };\n\n let requiredAllAvailable = true;\n for (const id of options.required) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") requiredAllAvailable = false;\n }\n let optionalAllAvailable = true;\n for (const id of options.optional ?? []) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") optionalAllAvailable = false;\n }\n\n const readiness: Readiness = !requiredAllAvailable ? \"idle\" : (optionalAllAvailable ? \"ready\" : \"degraded\");\n\n // preconditions: 対象 capability のいずれかが要求する場合だけ評価する。\n const allIds = [...options.required, ...(options.optional ?? [])];\n const needsSecure = allIds.some((id) => registry.get(id)?.requiresSecureContext === true);\n const needsActivation = allIds.some((id) => registry.get(id)?.requiresUserActivation === true);\n const secureContext: PreconditionState = needsSecure ? (isSecureContext() ? \"satisfied\" : \"required\") : \"not-applicable\";\n const userActivation: PreconditionState = needsActivation ? \"required\" : \"not-applicable\";\n\n return {\n availability,\n permission: options.permission ?? \"not-applicable\",\n readiness,\n activity: options.activity ?? \"inactive\",\n preconditions: { secureContext, userActivation },\n epoch: options.epoch ?? 0,\n lastError: options.lastError,\n };\n}\n\n/** availability から「required がすべて available か」を判定するヘルパ(supported の最低条件)。 */\nexport function requiredCapabilitiesAvailable(assessment: PlatformAssessment, required: readonly string[]): boolean {\n return required.every((id) => assessment.availability.get(id) === \"available\");\n}\n","/**\n * credentialCapabilities.ts\n *\n * Credential Management node 固有の capability registry と error code。汎用の assess\n * 機構・型は `./platformCapability.js`(/io-core/ から copy-distribution される生成\n * ファイル)から import する。node 固有の宣言はこのハンドライトファイルに置き、生成\n * コピーとは分離する。\n */\n\nimport { CapabilityRegistry, CapabilitySpec } from \"./platformCapability.js\";\n\n/** 安定した credential error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_CREDENTIAL_ERROR_CODE = {\n CapabilityMissing: \"capability-missing\",\n /** WebAuthn(publicKey) は v1 スコープ外 — get()/store() 双方で拒否する。 */\n OutOfScope: \"out-of-scope\",\n /** get()/store() の真のプラットフォーム失敗(NotAllowedError=cancelled は除く)。 */\n CredentialFailed: \"credential-failed\",\n} as const;\n\n/**\n * credential node の capability registry。`navigator.credentials`(CredentialsContainer)\n * の presence を probe する。文字列 ID を global property path として eval しない。\n */\nexport const CREDENTIAL_CAPABILITIES: CapabilityRegistry = new Map<string, CapabilitySpec>([\n [\"web.credentials\", { probe: () => (globalThis as { navigator?: { credentials?: unknown } }).navigator?.credentials != null, compatKey: \"api.CredentialsContainer\" }],\n]);\n","import { CredentialGetOptions, IWcBindable, StorableCredential } from \"../types.js\";\nimport { OperationLane, OperationTicket } from \"./operationLane.js\";\nimport {\n PlatformAssessment,\n WcsIoErrorInfo,\n WcsIoErrorPhase,\n assessCapabilities,\n requiredCapabilitiesAvailable,\n} from \"./platformCapability.js\";\nimport { CREDENTIAL_CAPABILITIES, WCS_CREDENTIAL_ERROR_CODE } from \"./credentialCapabilities.js\";\n\n/**\n * Headless Credential Management primitive. A thin, framework-agnostic wrapper\n * around `navigator.credentials.get()`/`.store()` exposed through the wc-bindable\n * protocol.\n *\n * Concurrency is owned by the shared `OperationLane` (io-core) with the `latest`\n * policy — **`get()` and `store()` share one lane**. A later call supersedes the\n * earlier one (the earlier completion fails the terminal CAS), preserving the v1\n * \"single generation\" behavior (docs/multi-promise-io-node-design.md): these two\n * operations are used sequentially in real auth flows (store after login, get\n * before one), not naturally concurrently on the same instance. If both ARE\n * invoked concurrently, the later call's result wins; use two separate\n * `<wcs-credential>` instances if that bites. The lane runs with\n * `withSignal: false` — the Credential Management API takes no `AbortSignal`;\n * dispose() invalidates any in-flight call via the owner generation.\n *\n * **v1 scope excludes WebAuthn (`publicKey`)** (docs/credential-tag-design.md §0):\n * `get()` validates+strips a `publicKey` option and `store()` rejects a\n * `PublicKeyCredential`, surfacing the attempt as a scope-violation `error`\n * (`errorInfo.code === \"out-of-scope\"`) rather than a WebAuthn backdoor.\n *\n * Note the cancellation signal is **`NotAllowedError`, NOT `AbortError`**: unlike\n * Web Share / Contact Picker, `credentials.get()/store()` reject with\n * `NotAllowedError` when the user dismisses the native chooser. That maps to\n * `cancelled`; every other name flows to `error`/`errorInfo`.\n */\nexport class CredentialCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"value\", event: \"wcs-credential:complete\", getter: (e: Event) => (e as CustomEvent).detail.value },\n { name: \"loading\", event: \"wcs-credential:loading-changed\" },\n { name: \"error\", event: \"wcs-credential:error\" },\n { name: \"cancelled\", event: \"wcs-credential:cancelled-changed\" },\n // Serializable failure taxonomy (stable code / phase / recoverable), or null.\n // Additive bindable output; the existing `error` property/event are unchanged.\n // Fires its own `wcs-credential:error-info-changed` event; no getter, so the\n // bound value is the event detail (mirrors `error` / `loading` / `cancelled`).\n { name: \"errorInfo\", event: \"wcs-credential:error-info-changed\" },\n ],\n commands: [\n { name: \"get\", async: true },\n { name: \"store\", async: true },\n ],\n };\n\n // Required capability (probed at call time, never at module eval).\n private static readonly REQUIRED_CAPABILITIES = [\"web.credentials\"] as const;\n\n private _target: EventTarget;\n private _value: Credential | null = null;\n private _loading: boolean = false;\n private _error: any = null;\n private _cancelled: boolean = false;\n private _errorInfo: WcsIoErrorInfo | null = null;\n // Concurrency lane (io-core), shared by get() and store(). `latest`: a later\n // call supersedes the earlier. `withSignal: false`: the API takes no AbortSignal.\n private _lane = new OperationLane(\"credential\", \"latest\", { withSignal: false });\n // SSR (§3.8): no asynchronous probe to await, so readiness is immediate.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n get ready(): Promise<void> {\n return this._ready;\n }\n\n get value(): Credential | null {\n return this._value;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): any {\n return this._error;\n }\n\n get cancelled(): boolean {\n return this._cancelled;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable` / `capabilityId`), or null. Exposed as an additive wc-bindable\n * property (event `wcs-credential:error-info-changed`); the existing `error`\n * property/event are unchanged. A `NotAllowedError` user cancellation is\n * `cancelled`, not `errorInfo`.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n /**\n * Whether the required platform capability (`web.credentials`) is available right\n * now — decided by call-time feature detection, not User-Agent. Core-only,\n * additive.\n */\n get supported(): boolean {\n return requiredCapabilitiesAvailable(this.platformAssessment, CredentialCore.REQUIRED_CAPABILITIES);\n }\n\n /**\n * Full platform assessment (availability / readiness / preconditions), probed at\n * call time. Core-only opt-in dev / sidecar view.\n */\n get platformAssessment(): PlatformAssessment {\n return assessCapabilities(CREDENTIAL_CAPABILITIES, {\n required: CredentialCore.REQUIRED_CAPABILITIES,\n activity: this._loading ? \"active\" : \"inactive\",\n lastError: this._errorInfo ?? undefined,\n });\n }\n\n // Lifecycle (§3.5). Command-driven with no subscription to establish, so\n // observe() is an idempotent no-op that resolves once ready; dispose() bumps the\n // lane's owner generation, invalidating any in-flight get()/store().\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this._lane.disposeOwner();\n }\n\n // CommitGuard (§5.1): external setters / event dispatch only run if the ticket\n // still holds owner generation, is pre-terminal, and is the lane's latest epoch\n // (a superseding get()/store() can invalidate a ticket mid-commit).\n private _commitStep(ticket: OperationTicket, step: () => void): void {\n if (this._lane.canCommit(ticket)) {\n step();\n }\n }\n\n private _setLoading(loading: boolean): void {\n if (this._loading === loading) return;\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n // Deliberately NO same-value guard (unlike error/loading/cancelled below).\n // `value` is a success-completion signal, not idempotent state: it is written\n // only on a successful get()/store(), and wcs-credential:complete is the *sole*\n // success notification (store() echoes the caller's credential, so two successful\n // store() calls with the same object reference are two distinct completions). This\n // matches ShareCore `_setValue` / clipboard `_setRead`.\n private _setValue(value: Credential | null): void {\n this._value = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:complete\", {\n detail: { value },\n bubbles: true,\n }));\n }\n\n private _setError(error: any): void {\n if (this._error === error) return;\n this._error = error;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n private _setCancelled(cancelled: boolean): void {\n if (this._cancelled === cancelled) return;\n this._cancelled = cancelled;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:cancelled-changed\", {\n detail: cancelled,\n bubbles: true,\n }));\n }\n\n // Single mutation point for `errorInfo`, mirroring `_setError`'s same-value guard\n // and event dispatch so the additive `errorInfo` wc-bindable property stays in\n // sync with `error`. Each failure builds a fresh object (reference guard passes);\n // the clear path passes null (suppresses a redundant null→null per call start).\n private _setErrorInfo(code: string, phase: WcsIoErrorPhase, recoverable: boolean, message: string, capabilityId?: string): void {\n this._commitErrorInfo({ code, phase, recoverable, message, ...(capabilityId === undefined ? {} : { capabilityId }) });\n }\n\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n if (this._errorInfo === info) return;\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:error-info-changed\", {\n detail: info,\n bubbles: true,\n }));\n }\n\n // Normalizes a rejection reason to a consistent { name, message } shape,\n // mirroring WorkerCore._normalizeError (packages/worker/src/core/WorkerCore.ts).\n private _normalizeError(e: unknown): { name: string; message: string } {\n if (e instanceof Error) {\n return { name: e.name, message: e.message };\n }\n return { name: \"Error\", message: String(e) };\n }\n\n // Classifies a get()/store() rejection as a user cancellation vs a real failure.\n // The Credential Management API rejects with `NotAllowedError` when the user\n // dismisses/declines the native chooser — a routine \"the user did not pick\"\n // outcome, mapped to `cancelled` and kept out of `error`/`errorInfo`. This is\n // `NotAllowedError`, NOT `AbortError` (unlike Web Share / Contact Picker). Every\n // other name (SecurityError, NetworkError, etc.) flows to `error`.\n private _isCancellation(e: unknown): boolean {\n return (e as { name?: unknown } | null)?.name === \"NotAllowedError\";\n }\n\n // Shared lane flow for get()/store() (both `latest` on the same lane). `op`\n // performs the platform call and returns the value to publish on success.\n private async _run(op: () => Promise<Credential | null>): Promise<Credential | null> {\n // `latest`: advance the epoch (supersede any in-flight get()/store()).\n const started = this._lane.begin()!;\n const { ticket } = started;\n\n this._commitStep(ticket, () => this._setLoading(true));\n // Reset the previous outcome before starting so a stale cancelled/error/\n // errorInfo does not linger into this call's result.\n this._commitStep(ticket, () => {\n this._commitErrorInfo(null);\n this._setError(null);\n this._setCancelled(false);\n });\n\n try {\n const value = await op();\n // Terminal CAS: a stale (superseded / dispose-invalidated) completion loses\n // the claim and is dropped without writing state.\n if (!this._lane.claimTerminal(ticket, \"success\")) {\n return null;\n }\n // Separate commit steps (like FetchCore): if `_setValue`'s event listener\n // synchronously supersedes this op, the following `_setLoading(false)` is\n // stopped by the commit guard rather than clobbering the newer op.\n this._commitStep(ticket, () => this._setValue(value));\n this._commitStep(ticket, () => this._setLoading(false));\n this._lane.finalize(ticket);\n return value;\n } catch (e: any) {\n const cancelled = this._isCancellation(e);\n if (!this._lane.claimTerminal(ticket, cancelled ? \"aborted\" : \"error\")) {\n return null;\n }\n this._commitStep(ticket, () => {\n if (cancelled) {\n this._setCancelled(true);\n } else {\n const norm = this._normalizeError(e);\n this._setErrorInfo(WCS_CREDENTIAL_ERROR_CODE.CredentialFailed, \"execute\", true, norm.message);\n this._setError(norm);\n }\n });\n this._commitStep(ticket, () => this._setLoading(false));\n this._lane.finalize(ticket);\n return null;\n }\n }\n\n /**\n * `get(options)` — v1 scope excludes `publicKey` (WebAuthn). If present, it is\n * stripped and the call surfaces a scope-violation `error` instead of forwarding\n * it to the platform API. `navigator.credentials.get()` does not require a user\n * gesture, so this can be invoked automatically on page load for silent sign-in.\n */\n async get(options: CredentialGetOptions & { publicKey?: unknown } = {}): Promise<Credential | null> {\n if (\"publicKey\" in options) {\n const message = \"WebAuthn (publicKey) is out of scope for @wcstack/credential v1. Use a dedicated WebAuthn node instead.\";\n this._setErrorInfo(WCS_CREDENTIAL_ERROR_CODE.OutOfScope, \"start\", false, message);\n this._setError({ name: \"NotSupportedError\", message });\n return null;\n }\n\n const assessment = this.platformAssessment;\n if (!requiredCapabilitiesAvailable(assessment, CredentialCore.REQUIRED_CAPABILITIES)) {\n const missing = CredentialCore.REQUIRED_CAPABILITIES.find((id) => assessment.availability.get(id) !== \"available\");\n const message = \"Credential Management API is not supported in this browser.\";\n this._setErrorInfo(WCS_CREDENTIAL_ERROR_CODE.CapabilityMissing, \"start\", false, message, missing);\n this._setError({ message });\n return null;\n }\n\n const nav = (globalThis as { navigator?: { credentials?: CredentialsContainer } }).navigator!;\n return this._run(() => nav.credentials!.get(options as CredentialRequestOptions));\n }\n\n /**\n * `store(credential)` — shares the same single lane as `get()`.\n * `navigator.credentials.store()` resolves `Promise<void>`, so `value` is\n * synthesized as an echo of the caller's `credential`. A `PublicKeyCredential`\n * (`type === \"public-key\"`, WebAuthn) is rejected as a scope violation before\n * touching the platform API.\n */\n async store(credential: StorableCredential): Promise<Credential | null> {\n if ((credential as { type?: unknown } | null)?.type === \"public-key\") {\n const message = \"WebAuthn (publicKey) credentials are out of scope for @wcstack/credential v1. Use a dedicated WebAuthn node instead.\";\n this._setErrorInfo(WCS_CREDENTIAL_ERROR_CODE.OutOfScope, \"start\", false, message);\n this._setError({ name: \"NotSupportedError\", message });\n return null;\n }\n\n const assessment = this.platformAssessment;\n if (!requiredCapabilitiesAvailable(assessment, CredentialCore.REQUIRED_CAPABILITIES)) {\n const missing = CredentialCore.REQUIRED_CAPABILITIES.find((id) => assessment.availability.get(id) !== \"available\");\n const message = \"Credential Management API is not supported in this browser.\";\n this._setErrorInfo(WCS_CREDENTIAL_ERROR_CODE.CapabilityMissing, \"start\", false, message, missing);\n this._setError({ message });\n return null;\n }\n\n const nav = (globalThis as { navigator?: { credentials?: CredentialsContainer } }).navigator!;\n return this._run(async () => {\n await nav.credentials!.store(credential);\n return credential;\n });\n }\n}\n","import { CredentialGetOptions, IWcBindable, StorableCredential } from \"../types.js\";\nimport { CredentialCore } from \"../core/CredentialCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\n\n/**\n * `<wcs-credential>` — declarative Credential Management API primitive\n * (password/federated only — see docs/credential-tag-design.md §0 for the\n * WebAuthn scope exclusion).\n *\n * A thin command-only Shell (mirrors `<wcs-share>`): no attributes at all.\n * `get(options)`/`store(credential)`'s arguments are per-call.\n */\nexport class WcsCredential extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...CredentialCore.wcBindable,\n inputs: [],\n // Inherit commands from Core (single source of truth).\n commands: CredentialCore.wcBindable.commands,\n };\n\n private _core: CredentialCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new CredentialCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-credential:loading-changed\": (d) => ({ loading: d === true }),\n \"wcs-credential:cancelled-changed\": (d) => ({ cancelled: d === true }),\n \"wcs-credential:error\": (d) => ({ error: d != null }),\n });\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\n }\n\n // --- Core delegated getters ---\n\n get value(): Credential | null {\n return this._core.value;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get cancelled(): boolean {\n return this._core.cancelled;\n }\n\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Commands ---\n\n get(options?: CredentialGetOptions): Promise<Credential | null> {\n return this._core.get(options);\n }\n\n store(credential: StorableCredential): Promise<Credential | null> {\n return this._core.store(credential);\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n this.style.display = \"none\";\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n}\n","import { WcsCredential } from \"./components/Credential.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.credential)) {\n customElements.define(config.tagNames.credential, WcsCredential);\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapCredential(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n"],"names":[],"mappings":"AAQA,MAAM,OAAO,GAAoB;AAC/B,IAAA,QAAQ,EAAE;AACR,QAAA,UAAU,EAAE,gBAAgB;AAC7B,KAA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E;QACd,SAAS,CAAC,UAAU,CAAC;IACvB;AACA,IAAA,kBAAkB,EAAE;AACtB;;;;"}
|
package/dist/index.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const e={tagNames:{credential:"wcs-credential"}};function t(e){if(null===e||"object"!=typeof e)return e;Object.freeze(e);for(const n of Object.keys(e))t(e[n]);return e}function n(e){if(null===e||"object"!=typeof e)return e;const t={};for(const s of Object.keys(e))t[s]=n(e[s]);return t}let s=null;const r=e;function a(){return s||(s=t(n(e))),s}class i extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"value",event:"wcs-credential:complete",getter:e=>e.detail.value},{name:"loading",event:"wcs-credential:loading-changed"},{name:"error",event:"wcs-credential:error"},{name:"cancelled",event:"wcs-credential:cancelled-changed"}],commands:[{name:"get",async:!0},{name:"store",async:!0}]};_target;_value=null;_loading=!1;_error=null;_cancelled=!1;_gen=0;_ready=Promise.resolve();constructor(e){super(),this._target=e??this}get ready(){return this._ready}get value(){return this._value}get loading(){return this._loading}get error(){return this._error}get cancelled(){return this._cancelled}observe(){return this._ready}dispose(){this._gen++}_setLoading(e){this._loading!==e&&(this._loading=e,this._target.dispatchEvent(new CustomEvent("wcs-credential:loading-changed",{detail:e,bubbles:!0})))}_setValue(e){this._value=e,this._target.dispatchEvent(new CustomEvent("wcs-credential:complete",{detail:{value:e},bubbles:!0}))}_setError(e){this._error!==e&&(this._error=e,this._target.dispatchEvent(new CustomEvent("wcs-credential:error",{detail:e,bubbles:!0})))}_setCancelled(e){this._cancelled!==e&&(this._cancelled=e,this._target.dispatchEvent(new CustomEvent("wcs-credential:cancelled-changed",{detail:e,bubbles:!0})))}_api(){const e=globalThis.navigator;return e?.credentials}_normalizeError(e){return e instanceof Error?{name:e.name,message:e.message}:{name:"Error",message:String(e)}}_isCancellation(e){return"NotAllowedError"===e?.name}async get(e={}){if("publicKey"in e)return this._setError({name:"NotSupportedError",message:"WebAuthn (publicKey) is out of scope for @wcstack/credential v1. Use a dedicated WebAuthn node instead."}),null;const t=this._api();if(!t)return this._setError({message:"Credential Management API is not supported in this browser."}),null;const n=++this._gen;this._setLoading(!0),this._setError(null),this._setCancelled(!1);try{const s=await t.get(e);return n!==this._gen?null:(this._setValue(s),this._setLoading(!1),s)}catch(e){return n!==this._gen||(this._isCancellation(e)?this._setCancelled(!0):this._setError(this._normalizeError(e)),this._setLoading(!1)),null}}async store(e){if("public-key"===e?.type)return this._setError({name:"NotSupportedError",message:"WebAuthn (publicKey) credentials are out of scope for @wcstack/credential v1. Use a dedicated WebAuthn node instead."}),null;const t=this._api();if(!t)return this._setError({message:"Credential Management API is not supported in this browser."}),null;const n=++this._gen;this._setLoading(!0),this._setError(null),this._setCancelled(!1);try{return await t.store(e),n!==this._gen?null:(this._setValue(e),this._setLoading(!1),e)}catch(e){return n!==this._gen||(this._isCancellation(e)?this._setCancelled(!0):this._setError(this._normalizeError(e)),this._setLoading(!1)),null}}}class l extends HTMLElement{static hasConnectedCallbackPromise=!0;static wcBindable={...i.wcBindable,inputs:[],commands:i.wcBindable.commands};_core;_connectedCallbackPromise=Promise.resolve();_internals=null;constructor(){super(),this._core=new i(this),this._internals=this._initInternals(),this._wireStates({"wcs-credential:loading-changed":e=>({loading:!0===e}),"wcs-credential:cancelled-changed":e=>({cancelled:!0===e}),"wcs-credential:error":e=>({error:null!=e})})}get debugStates(){return this._internals?[...this._internals.states]:[]}_initInternals(){try{if("function"!=typeof this.attachInternals)return null;const e=this.attachInternals();return e.states.add("wcs-probe"),e.states.delete("wcs-probe"),e}catch{return null}}_wireStates(e){if(null===this._internals)return;const t=this._internals.states;for(const[n,s]of Object.entries(e))this.addEventListener(n,e=>{const n=this.hasAttribute("debug-states");for(const[r,a]of Object.entries(s(e.detail))){try{a?t.add(r):t.delete(r)}catch{}n&&this.toggleAttribute(`data-wcs-state-${r}`,a)}})}get value(){return this._core.value}get loading(){return this._core.loading}get error(){return this._core.error}get cancelled(){return this._core.cancelled}get connectedCallbackPromise(){return this._connectedCallbackPromise}get(e){return this._core.get(e)}store(e){return this._core.store(e)}connectedCallback(){this.style.display="none",this._connectedCallbackPromise=this._core.observe()}disconnectedCallback(){this._core.dispose()}}function c(t){var n;t&&((n=t).tagNames&&Object.assign(e.tagNames,n.tagNames),s=null),customElements.get(r.tagNames.credential)||customElements.define(r.tagNames.credential,l)}export{i as CredentialCore,l as WcsCredential,c as bootstrapCredential,a as getConfig};
|
|
1
|
+
const e={tagNames:{credential:"wcs-credential"}};function t(e){if(null===e||"object"!=typeof e)return e;Object.freeze(e);for(const i of Object.keys(e))t(e[i]);return e}function i(e){if(null===e||"object"!=typeof e)return e;const t={};for(const r of Object.keys(e))t[r]=i(e[r]);return t}let r=null;const n=e;function s(){return r||(r=t(i(e))),r}class a{laneKey;policy;_ownerGeneration=0;_latestEpoch=0;_nextOperationId=1;_activeOperationId=void 0;_activeOperationIds=new Set;_queue=[];_inFlightCount=0;_terminal=new Map;_claimedOutcome=new Map;_controllers=new Map;_attempts=new Map;_withSignal;_trace;constructor(e,t,i={}){this.laneKey=e,this.policy=t,this._withSignal=i.withSignal??!1,this._trace=i.trace}get ownerGeneration(){return this._ownerGeneration}get inFlightCount(){return this._inFlightCount}get latestEpoch(){return this._latestEpoch}get activeOperationId(){return this._activeOperationId}begin(){let e;switch(this.policy){case"latest":e=++this._latestEpoch,void 0!==this._activeOperationId&&this._abortController(this._activeOperationId);break;case"exhaust":if(void 0!==this._activeOperationId)return null}const t=this._nextOperationId++,i={operationId:t,ownerGeneration:this._ownerGeneration,laneKey:this.laneKey,policy:this.policy,supersedeEpoch:e};switch(this.policy){case"latest":case"exhaust":this._activeOperationId=t;break;case"queue":this._queue.push(i),void 0===this._activeOperationId&&(this._activeOperationId=t);break;case"overlap":this._activeOperationIds.add(t)}this._inFlightCount+=1,this._attempts.set(t,1);const r=this._makeAttempt(t,1);return void 0!==this._trace&&this._trace({type:"io:operation-started",operationId:t,laneKey:this.laneKey,policy:this.policy}),{ticket:i,attempt:r}}retry(e){if(e.ownerGeneration!==this._ownerGeneration)return null;if(this._terminal.has(e.operationId))return null;const t=this._attempts.get(e.operationId);if(void 0===t)return null;const i=t+1;this._attempts.set(e.operationId,i),this._releaseController(e.operationId);const r=this._makeAttempt(e.operationId,i);return void 0!==this._trace&&this._trace({type:"io:operation-retried",operationId:e.operationId,laneKey:this.laneKey,attempt:i}),r}canCommit(e){if(e.ownerGeneration!==this._ownerGeneration)return!1;const t=this._terminal.get(e.operationId);return(void 0===t||"committing"===t)&&this._isEligible(e)}claimTerminal(e,t){return e.ownerGeneration===this._ownerGeneration&&(!this._terminal.has(e.operationId)&&(!!this._isEligible(e)&&(this._terminal.set(e.operationId,"committing"),this._claimedOutcome.set(e.operationId,t),!0)))}claimedOutcome(e){return this._claimedOutcome.get(e.operationId)}finalize(e){const t=e.operationId,i=this._terminal.get(t);if(void 0!==i&&"committing"!==i)return;let r;r="committing"===i?this._claimedOutcome.get(t)??"stale":"stale",this._terminal.set(t,r),this._claimedOutcome.delete(t),this._releaseController(t),this._attempts.delete(t),this._inFlightCount>0&&(this._inFlightCount-=1),this._advanceBookkeeping(t),void 0!==this._trace&&("stale"===r?this._trace({type:"io:stale-dropped",operationId:t,laneKey:this.laneKey}):this._trace({type:"io:operation-settled",operationId:t,laneKey:this.laneKey,outcome:r}))}signalOf(e){return this._controllers.get(e.operationId)?.signal}abort(e){this._abortController(e.operationId)}abortActive(){void 0!==this._activeOperationId&&this._abortController(this._activeOperationId);for(const e of this._activeOperationIds)this._abortController(e)}disposeOwner(){this._ownerGeneration+=1;for(const e of Array.from(this._controllers.keys()))this._abortController(e),this._releaseController(e);for(const e of Array.from(this._attempts.keys()))this._terminal.has(e)||this._terminal.set(e,"stale"),this._claimedOutcome.delete(e),this._attempts.delete(e),void 0!==this._trace&&this._trace({type:"io:stale-dropped",operationId:e,laneKey:this.laneKey});this._activeOperationId=void 0,this._activeOperationIds.clear(),this._queue.length=0,this._inFlightCount=0}_makeAttempt(e,t){let i;if(this._withSignal&&"function"==typeof AbortController){const t=new AbortController;this._controllers.set(e,t),i=t.signal}return{operationId:e,attempt:t,signal:i}}_isEligible(e){switch(this.policy){case"latest":return e.supersedeEpoch===this._latestEpoch;case"queue":case"exhaust":return this._activeOperationId===e.operationId;case"overlap":return this._activeOperationIds.has(e.operationId)}}_advanceBookkeeping(e){switch(this.policy){case"latest":case"exhaust":this._activeOperationId===e&&(this._activeOperationId=void 0);break;case"queue":{const t=this._queue.filter(t=>t.operationId!==e);this._queue.length=0,this._queue.push(...t),this._activeOperationId=this._queue.length>0?this._queue[0].operationId:void 0;break}case"overlap":this._activeOperationIds.delete(e)}}_abortController(e){const t=this._controllers.get(e);void 0===t||t.signal.aborted||t.abort()}_releaseController(e){this._controllers.delete(e)}}function o(e,t){const i=new Map,r=t=>{const i=e.get(t);return void 0===i?"unknown":i.probe()?"available":"missing"};let n=!0;for(const e of t.required){const t=r(e);i.set(e,t),"available"!==t&&(n=!1)}let s=!0;for(const e of t.optional??[]){const t=r(e);i.set(e,t),"available"!==t&&(s=!1)}const a=n?s?"ready":"degraded":"idle",o=[...t.required,...t.optional??[]],l=o.some(t=>!0===e.get(t)?.requiresSecureContext),c=o.some(t=>!0===e.get(t)?.requiresUserActivation),h=l?!0===globalThis.isSecureContext?"satisfied":"required":"not-applicable",d=c?"required":"not-applicable";return{availability:i,permission:t.permission??"not-applicable",readiness:a,activity:t.activity??"inactive",preconditions:{secureContext:h,userActivation:d},epoch:t.epoch??0,lastError:t.lastError}}function l(e,t){return t.every(t=>"available"===e.availability.get(t))}const c={CapabilityMissing:"capability-missing",OutOfScope:"out-of-scope",CredentialFailed:"credential-failed"},h=new Map([["web.credentials",{probe:()=>null!=globalThis.navigator?.credentials,compatKey:"api.CredentialsContainer"}]]);class d extends EventTarget{static wcBindable={protocol:"wc-bindable",version:1,properties:[{name:"value",event:"wcs-credential:complete",getter:e=>e.detail.value},{name:"loading",event:"wcs-credential:loading-changed"},{name:"error",event:"wcs-credential:error"},{name:"cancelled",event:"wcs-credential:cancelled-changed"},{name:"errorInfo",event:"wcs-credential:error-info-changed"}],commands:[{name:"get",async:!0},{name:"store",async:!0}]};static REQUIRED_CAPABILITIES=["web.credentials"];_target;_value=null;_loading=!1;_error=null;_cancelled=!1;_errorInfo=null;_lane=new a("credential","latest",{withSignal:!1});_ready=Promise.resolve();constructor(e){super(),this._target=e??this}get ready(){return this._ready}get value(){return this._value}get loading(){return this._loading}get error(){return this._error}get cancelled(){return this._cancelled}get errorInfo(){return this._errorInfo}get supported(){return l(this.platformAssessment,d.REQUIRED_CAPABILITIES)}get platformAssessment(){return o(h,{required:d.REQUIRED_CAPABILITIES,activity:this._loading?"active":"inactive",lastError:this._errorInfo??void 0})}observe(){return this._ready}dispose(){this._lane.disposeOwner()}_commitStep(e,t){this._lane.canCommit(e)&&t()}_setLoading(e){this._loading!==e&&(this._loading=e,this._target.dispatchEvent(new CustomEvent("wcs-credential:loading-changed",{detail:e,bubbles:!0})))}_setValue(e){this._value=e,this._target.dispatchEvent(new CustomEvent("wcs-credential:complete",{detail:{value:e},bubbles:!0}))}_setError(e){this._error!==e&&(this._error=e,this._target.dispatchEvent(new CustomEvent("wcs-credential:error",{detail:e,bubbles:!0})))}_setCancelled(e){this._cancelled!==e&&(this._cancelled=e,this._target.dispatchEvent(new CustomEvent("wcs-credential:cancelled-changed",{detail:e,bubbles:!0})))}_setErrorInfo(e,t,i,r,n){this._commitErrorInfo({code:e,phase:t,recoverable:i,message:r,...void 0===n?{}:{capabilityId:n}})}_commitErrorInfo(e){this._errorInfo!==e&&(this._errorInfo=e,this._target.dispatchEvent(new CustomEvent("wcs-credential:error-info-changed",{detail:e,bubbles:!0})))}_normalizeError(e){return e instanceof Error?{name:e.name,message:e.message}:{name:"Error",message:String(e)}}_isCancellation(e){return"NotAllowedError"===e?.name}async _run(e){const t=this._lane.begin(),{ticket:i}=t;this._commitStep(i,()=>this._setLoading(!0)),this._commitStep(i,()=>{this._commitErrorInfo(null),this._setError(null),this._setCancelled(!1)});try{const t=await e();return this._lane.claimTerminal(i,"success")?(this._commitStep(i,()=>this._setValue(t)),this._commitStep(i,()=>this._setLoading(!1)),this._lane.finalize(i),t):null}catch(e){const t=this._isCancellation(e);return this._lane.claimTerminal(i,t?"aborted":"error")?(this._commitStep(i,()=>{if(t)this._setCancelled(!0);else{const t=this._normalizeError(e);this._setErrorInfo(c.CredentialFailed,"execute",!0,t.message),this._setError(t)}}),this._commitStep(i,()=>this._setLoading(!1)),this._lane.finalize(i),null):null}}async get(e={}){if("publicKey"in e){const e="WebAuthn (publicKey) is out of scope for @wcstack/credential v1. Use a dedicated WebAuthn node instead.";return this._setErrorInfo(c.OutOfScope,"start",!1,e),this._setError({name:"NotSupportedError",message:e}),null}const t=this.platformAssessment;if(!l(t,d.REQUIRED_CAPABILITIES)){const e=d.REQUIRED_CAPABILITIES.find(e=>"available"!==t.availability.get(e)),i="Credential Management API is not supported in this browser.";return this._setErrorInfo(c.CapabilityMissing,"start",!1,i,e),this._setError({message:i}),null}const i=globalThis.navigator;return this._run(()=>i.credentials.get(e))}async store(e){if("public-key"===e?.type){const e="WebAuthn (publicKey) credentials are out of scope for @wcstack/credential v1. Use a dedicated WebAuthn node instead.";return this._setErrorInfo(c.OutOfScope,"start",!1,e),this._setError({name:"NotSupportedError",message:e}),null}const t=this.platformAssessment;if(!l(t,d.REQUIRED_CAPABILITIES)){const e=d.REQUIRED_CAPABILITIES.find(e=>"available"!==t.availability.get(e)),i="Credential Management API is not supported in this browser.";return this._setErrorInfo(c.CapabilityMissing,"start",!1,i,e),this._setError({message:i}),null}const i=globalThis.navigator;return this._run(async()=>(await i.credentials.store(e),e))}}class _ extends HTMLElement{static hasConnectedCallbackPromise=!0;static wcBindable={...d.wcBindable,inputs:[],commands:d.wcBindable.commands};_core;_connectedCallbackPromise=Promise.resolve();_internals=null;constructor(){super(),this._core=new d(this),this._internals=this._initInternals(),this._wireStates({"wcs-credential:loading-changed":e=>({loading:!0===e}),"wcs-credential:cancelled-changed":e=>({cancelled:!0===e}),"wcs-credential:error":e=>({error:null!=e})})}get debugStates(){return this._internals?[...this._internals.states]:[]}_initInternals(){try{if("function"!=typeof this.attachInternals)return null;const e=this.attachInternals();return e.states.add("wcs-probe"),e.states.delete("wcs-probe"),e}catch{return null}}_wireStates(e){if(null===this._internals)return;const t=this._internals.states;for(const[i,r]of Object.entries(e))this.addEventListener(i,e=>{const i=this.hasAttribute("debug-states");for(const[n,s]of Object.entries(r(e.detail))){try{s?t.add(n):t.delete(n)}catch{}i&&this.toggleAttribute(`data-wcs-state-${n}`,s)}})}get value(){return this._core.value}get loading(){return this._core.loading}get error(){return this._core.error}get cancelled(){return this._core.cancelled}get errorInfo(){return this._core.errorInfo}get connectedCallbackPromise(){return this._connectedCallbackPromise}get(e){return this._core.get(e)}store(e){return this._core.store(e)}connectedCallback(){this.style.display="none",this._connectedCallbackPromise=this._core.observe()}disconnectedCallback(){this._core.dispose()}}function u(t){var i;t&&((i=t).tagNames&&Object.assign(e.tagNames,i.tagNames),r=null),customElements.get(n.tagNames.credential)||customElements.define(n.tagNames.credential,_)}export{d as CredentialCore,c as WCS_CREDENTIAL_ERROR_CODE,_ as WcsCredential,u as bootstrapCredential,s as getConfig};
|
|
2
2
|
//# sourceMappingURL=index.esm.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.min.js","sources":["../src/config.ts","../src/core/CredentialCore.ts","../src/components/Credential.ts","../src/bootstrapCredential.ts","../src/registerComponents.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n credential: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n credential: \"wcs-credential\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\n// Note: this is the live, mutable internal config. It is not part of the public\n// package exports (see exports.ts) — only `getConfig()` (a frozen snapshot) is\n// surfaced. `setConfig()` is applied internally via `bootstrapCredential()` and\n// is not re-exported from the package root, though a deep path import\n// (`.../src/config.js`) can still reach and mutate it. Accepted as-is for\n// cross-package consistency: every @wcstack package follows this same shape.\n// Use `getConfig()` for a frozen, safe read.\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\nexport function setConfig(partialConfig: IWritableConfig): void {\n if (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","import { CredentialGetOptions, IWcBindable, StorableCredential } from \"../types.js\";\n\n/**\n * Headless Credential Management primitive. A thin, framework-agnostic\n * wrapper around `navigator.credentials.get()`/`.store()` exposed through the\n * wc-bindable protocol.\n *\n * Reuses batch3's \"thin command\" archetype established by `@wcstack/share`\n * (docs/credential-tag-design.md): single `_gen` generation guard,\n * same-value-guarded private setters, never-throw try/catch, no\n * `AbortController`/`abort()` command.\n *\n * **v1 scope excludes WebAuthn (`publicKey`)** — see docs/credential-tag-design.md\n * §0. `get()` validates and strips a `publicKey` option rather than silently\n * forwarding it, surfacing the attempt as a scope-violation `error` instead of\n * accidentally supporting WebAuthn through a side door.\n *\n * **`get()`/`store()` share one `_gen`** — an accepted v1 simplification\n * (docs/multi-promise-io-node-design.md): these two operations are used\n * sequentially in real auth flows (store after a successful login, get before\n * attempting one), not naturally concurrently on the same instance. If both\n * ARE invoked concurrently on the same `<wcs-credential>`, the later call's\n * generation bump silently drops the earlier call's completion write. If this\n * limitation actually bites, use two separate `<wcs-credential>` instances\n * (one for get, one for store) rather than reworking the Core.\n */\nexport class CredentialCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"value\", event: \"wcs-credential:complete\", getter: (e: Event) => (e as CustomEvent).detail.value },\n { name: \"loading\", event: \"wcs-credential:loading-changed\" },\n { name: \"error\", event: \"wcs-credential:error\" },\n { name: \"cancelled\", event: \"wcs-credential:cancelled-changed\" },\n ],\n commands: [\n { name: \"get\", async: true },\n { name: \"store\", async: true },\n ],\n };\n\n private _target: EventTarget;\n private _value: Credential | null = null;\n private _loading: boolean = false;\n private _error: any = null;\n private _cancelled: boolean = false;\n // Generation guard (§3.4): shared by get() and store() (see class docs on\n // the accepted concurrency limitation this implies).\n private _gen = 0;\n // SSR (§3.8): no asynchronous probe to await, so readiness is immediate.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n get ready(): Promise<void> {\n return this._ready;\n }\n\n get value(): Credential | null {\n return this._value;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): any {\n return this._error;\n }\n\n get cancelled(): boolean {\n return this._cancelled;\n }\n\n // Lifecycle (§3.5). Command-driven with no subscription to establish, so\n // observe() is an idempotent no-op that resolves once ready; dispose() only\n // invalidates any in-flight get()/store() (there is nothing to unsubscribe).\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this._gen++;\n }\n\n private _setLoading(loading: boolean): void {\n if (this._loading === loading) return;\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n // Deliberately NO same-value guard (unlike error/loading/cancelled below).\n // `value` is a success-completion signal, not idempotent state: it is written\n // only on a successful get()/store(), and wcs-credential:complete is the *sole*\n // success notification. store() echoes the caller's credential argument, so two\n // consecutive successful store() calls with the same object reference are two\n // distinct completions and must each re-fire wcs-credential:complete so an\n // `$on`/eventToken consumer (and a `value:` binding) sees every success. This\n // matches clipboard `_setRead` / broadcast `_setMessage`, which carve\n // result/event values out of the §3.3 guard for the same reason.\n private _setValue(value: Credential | null): void {\n this._value = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:complete\", {\n detail: { value },\n bubbles: true,\n }));\n }\n\n private _setError(error: any): void {\n if (this._error === error) return;\n this._error = error;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n private _setCancelled(cancelled: boolean): void {\n if (this._cancelled === cancelled) return;\n this._cancelled = cancelled;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:cancelled-changed\", {\n detail: cancelled,\n bubbles: true,\n }));\n }\n\n private _api(): typeof navigator.credentials | undefined {\n const nav = (globalThis as any).navigator;\n return nav?.credentials;\n }\n\n // Normalizes a rejection reason to a consistent { name, message } shape,\n // mirroring WorkerCore._normalizeError (packages/worker/src/core/WorkerCore.ts).\n private _normalizeError(e: unknown): { name: string; message: string } {\n if (e instanceof Error) {\n return { name: e.name, message: e.message };\n }\n return { name: \"Error\", message: String(e) };\n }\n\n // Classifies a get()/store() rejection as a user cancellation vs a real\n // failure (docs/credential-tag-design.md §2/§5). For the Credential\n // Management API the browser rejects with `NotAllowedError` when the user\n // dismisses/declines the native account-chooser UI — this is a routine \"the\n // user did not pick\" outcome, not a platform failure, so it maps to\n // `cancelled` and is kept out of `error`. Note this is `NotAllowedError`,\n // NOT `AbortError`: unlike Web Share/Contact Picker (whose APIs reject with\n // `AbortError` on dismissal), credentials.get()/store() signal user refusal\n // via `NotAllowedError`. Every other name (SecurityError, NetworkError, a\n // programmatic signal abort, etc.) flows to `error`.\n private _isCancellation(e: unknown): boolean {\n return (e as { name?: unknown } | null)?.name === \"NotAllowedError\";\n }\n\n /**\n * `get(options)` — v1 scope excludes `publicKey` (WebAuthn). If present, it\n * is stripped and the call surfaces a scope-violation `error` instead of\n * forwarding it to the platform API (which would accidentally support\n * WebAuthn through a side door). `navigator.credentials.get()` does not\n * require a user gesture (unlike Web Share/Fullscreen), so this can be\n * invoked automatically on page load for a \"silent sign-in\" flow.\n */\n async get(options: CredentialGetOptions & { publicKey?: unknown } = {}): Promise<Credential | null> {\n if (\"publicKey\" in options) {\n this._setError({ name: \"NotSupportedError\", message: \"WebAuthn (publicKey) is out of scope for @wcstack/credential v1. Use a dedicated WebAuthn node instead.\" });\n return null;\n }\n\n const api = this._api();\n if (!api) {\n this._setError({ message: \"Credential Management API is not supported in this browser.\" });\n return null;\n }\n\n const gen = ++this._gen;\n\n this._setLoading(true);\n // Reset the previous outcome before starting a new get so a stale\n // cancelled/error does not linger into this call's result.\n this._setError(null);\n this._setCancelled(false);\n\n try {\n const credential = await api.get(options as CredentialRequestOptions);\n\n if (gen !== this._gen) return null; // stale (dispose() ran while awaiting)\n\n this._setValue(credential);\n this._setLoading(false);\n return credential;\n } catch (e: any) {\n if (gen !== this._gen) return null;\n if (this._isCancellation(e)) {\n this._setCancelled(true);\n } else {\n this._setError(this._normalizeError(e));\n }\n this._setLoading(false);\n return null;\n }\n }\n\n /**\n * `store(credential)` — shares the same single `_gen` as `get()` (see class\n * docs). `navigator.credentials.store()` resolves `Promise<void>` (per\n * `lib.dom.d.ts`) — there is no payload to read off the API, so `value` is\n * synthesized as an echo of the caller's `credential`, mirroring\n * `ShareCore.share()`'s same accommodation for `navigator.share()`.\n *\n * A `PublicKeyCredential` (`type === \"public-key\"`, WebAuthn) is rejected as a\n * scope violation before touching the platform API — the same v1 boundary\n * `get()` enforces on the `publicKey` option (docs/credential-tag-design.md\n * §3.2), so this node never becomes a WebAuthn store backdoor.\n */\n async store(credential: StorableCredential): Promise<Credential | null> {\n if ((credential as { type?: unknown } | null)?.type === \"public-key\") {\n this._setError({ name: \"NotSupportedError\", message: \"WebAuthn (publicKey) credentials are out of scope for @wcstack/credential v1. Use a dedicated WebAuthn node instead.\" });\n return null;\n }\n\n const api = this._api();\n if (!api) {\n this._setError({ message: \"Credential Management API is not supported in this browser.\" });\n return null;\n }\n\n const gen = ++this._gen;\n\n this._setLoading(true);\n // Reset the previous outcome before starting a new store so a stale\n // cancelled/error does not linger into this call's result.\n this._setError(null);\n this._setCancelled(false);\n\n try {\n await api.store(credential);\n\n if (gen !== this._gen) return null;\n\n this._setValue(credential);\n this._setLoading(false);\n return credential;\n } catch (e: any) {\n if (gen !== this._gen) return null;\n if (this._isCancellation(e)) {\n this._setCancelled(true);\n } else {\n this._setError(this._normalizeError(e));\n }\n this._setLoading(false);\n return null;\n }\n }\n}\n","import { CredentialGetOptions, IWcBindable, StorableCredential } from \"../types.js\";\nimport { CredentialCore } from \"../core/CredentialCore.js\";\n\n/**\n * `<wcs-credential>` — declarative Credential Management API primitive\n * (password/federated only — see docs/credential-tag-design.md §0 for the\n * WebAuthn scope exclusion).\n *\n * A thin command-only Shell (mirrors `<wcs-share>`): no attributes at all.\n * `get(options)`/`store(credential)`'s arguments are per-call.\n */\nexport class WcsCredential extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...CredentialCore.wcBindable,\n inputs: [],\n // Inherit commands from Core (single source of truth).\n commands: CredentialCore.wcBindable.commands,\n };\n\n private _core: CredentialCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new CredentialCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-credential:loading-changed\": (d) => ({ loading: d === true }),\n \"wcs-credential:cancelled-changed\": (d) => ({ cancelled: d === true }),\n \"wcs-credential:error\": (d) => ({ error: d != null }),\n });\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\n }\n\n // --- Core delegated getters ---\n\n get value(): Credential | null {\n return this._core.value;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get cancelled(): boolean {\n return this._core.cancelled;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Commands ---\n\n get(options?: CredentialGetOptions): Promise<Credential | null> {\n return this._core.get(options);\n }\n\n store(credential: StorableCredential): Promise<Credential | null> {\n return this._core.store(credential);\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n this.style.display = \"none\";\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapCredential(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n","import { WcsCredential } from \"./components/Credential.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.credential)) {\n customElements.define(config.tagNames.credential, WcsCredential);\n }\n}\n"],"names":["_config","tagNames","credential","deepFreeze","obj","Object","freeze","key","keys","deepClone","clone","frozenConfig","config","getConfig","CredentialCore","EventTarget","static","protocol","version","properties","name","event","getter","e","detail","value","commands","async","_target","_value","_loading","_error","_cancelled","_gen","_ready","Promise","resolve","constructor","target","super","this","ready","loading","error","cancelled","observe","dispose","_setLoading","dispatchEvent","CustomEvent","bubbles","_setValue","_setError","_setCancelled","_api","nav","globalThis","navigator","credentials","_normalizeError","Error","message","String","_isCancellation","get","options","api","gen","store","type","WcsCredential","HTMLElement","wcBindable","inputs","_core","_connectedCallbackPromise","_internals","_initInternals","_wireStates","d","debugStates","states","attachInternals","internals","add","delete","map","toStates","entries","addEventListener","debug","hasAttribute","on","toggleAttribute","connectedCallbackPromise","connectedCallback","style","display","disconnectedCallback","bootstrapCredential","userConfig","partialConfig","assign","customElements","define"],"mappings":"AAQA,MAAMA,EAA2B,CAC/BC,SAAU,CACRC,WAAY,mBAIhB,SAASC,EAAcC,GACrB,GAAY,OAARA,GAA+B,iBAARA,EAAkB,OAAOA,EACpDC,OAAOC,OAAOF,GACd,IAAK,MAAMG,KAAOF,OAAOG,KAAKJ,GAC5BD,EAAYC,EAAgCG,IAE9C,OAAOH,CACT,CAEA,SAASK,EAAaL,GACpB,GAAY,OAARA,GAA+B,iBAARA,EAAkB,OAAOA,EACpD,MAAMM,EAAiC,CAAA,EACvC,IAAK,MAAMH,KAAOF,OAAOG,KAAKJ,GAC5BM,EAAMH,GAAOE,EAAWL,EAAgCG,IAE1D,OAAOG,CACT,CAEA,IAAIC,EAA+B,KAS5B,MAAMC,EAAkBZ,WAEfa,IAId,OAHKF,IACHA,EAAeR,EAAWM,EAAUT,KAE/BW,CACT,CCtBM,MAAOG,UAAuBC,YAClCC,kBAAiC,CAC/BC,SAAU,cACVC,QAAS,EACTC,WAAY,CACV,CAAEC,KAAM,QAASC,MAAO,0BAA2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AkBC,SAAU,CAC5E,IACMoE,EAAMX,EAAOG,IAAIhE,GAAgB6D,EAAOI,OAAOjE,EACrD,CAAE,MAA0B,CACxBsE,GAAOlD,KAAKqD,gBAAgB,kBAAkBzE,IAAQwE,EAC5D,GAGN,CAIA,SAAInE,GACF,OAAOe,KAAKkC,MAAMjD,KACpB,CAEA,WAAIiB,GACF,OAAOF,KAAKkC,MAAMhC,OACpB,CAEA,SAAIC,GACF,OAAOH,KAAKkC,MAAM/B,KACpB,CAEA,aAAIC,GACF,OAAOJ,KAAKkC,MAAM9B,SACpB,CAEA,4BAAIkD,GACF,OAAOtD,KAAKmC,yBACd,CAIA,GAAAX,CAAIC,GACF,OAAOzB,KAAKkC,MAAMV,IAAIC,EACxB,CAEA,KAAAG,CAAMlE,GACJ,OAAOsC,KAAKkC,MAAMN,MAAMlE,EAC1B,CAIA,iBAAA6F,GACEvD,KAAKwD,MAAMC,QAAU,OACrBzD,KAAKmC,0BAA4BnC,KAAKkC,MAAM7B,SAC9C,CAEA,oBAAAqD,GACE1D,KAAKkC,MAAM5B,SACb,EClHI,SAAUqD,EAAoBC,GH8C9B,IAAoBC,EG7CpBD,KH6CoBC,EG5CZD,GH6CMnG,UAChBI,OAAOiG,OAAOtG,EAAQC,SAAUoG,EAAcpG,UAEhDU,EAAe,MIlDV4F,eAAevC,IAAIpD,EAAOX,SAASC,aACtCqG,eAAeC,OAAO5F,EAAOX,SAASC,WAAYoE,EDItD"}
|
|
1
|
+
{"version":3,"file":"index.esm.min.js","sources":["../src/config.ts","../src/core/operationLane.ts","../src/core/platformCapability.ts","../src/core/credentialCapabilities.ts","../src/core/CredentialCore.ts","../src/components/Credential.ts","../src/bootstrapCredential.ts","../src/registerComponents.ts"],"sourcesContent":["import { IConfig, IWritableConfig } from \"./types.js\";\n\ninterface IInternalConfig extends IConfig {\n tagNames: {\n credential: string;\n };\n}\n\nconst _config: IInternalConfig = {\n tagNames: {\n credential: \"wcs-credential\",\n },\n};\n\nfunction deepFreeze<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n Object.freeze(obj);\n for (const key of Object.keys(obj)) {\n deepFreeze((obj as Record<string, unknown>)[key]);\n }\n return obj;\n}\n\nfunction deepClone<T>(obj: T): T {\n if (obj === null || typeof obj !== \"object\") return obj;\n const clone: Record<string, unknown> = {};\n for (const key of Object.keys(obj)) {\n clone[key] = deepClone((obj as Record<string, unknown>)[key]);\n }\n return clone as T;\n}\n\nlet frozenConfig: IConfig | null = null;\n\n// Note: this is the live, mutable internal config. It is not part of the public\n// package exports (see exports.ts) — only `getConfig()` (a frozen snapshot) is\n// surfaced. `setConfig()` is applied internally via `bootstrapCredential()` and\n// is not re-exported from the package root, though a deep path import\n// (`.../src/config.js`) can still reach and mutate it. Accepted as-is for\n// cross-package consistency: every @wcstack package follows this same shape.\n// Use `getConfig()` for a frozen, safe read.\nexport const config: IConfig = _config as IConfig;\n\nexport function getConfig(): IConfig {\n if (!frozenConfig) {\n frozenConfig = deepFreeze(deepClone(_config));\n }\n return frozenConfig;\n}\n\nexport function setConfig(partialConfig: IWritableConfig): void {\n if (partialConfig.tagNames) {\n Object.assign(_config.tagNames, partialConfig.tagNames);\n }\n frozenConfig = null;\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /io-core/operation-lane.ts by scripts/sync-io-core.mjs.\n// Run `node scripts/sync-io-core.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * operationLane.ts\n *\n * Phase 4 (docs/architecture-hardening/09-remediation-design.md §5, §5.1) の\n * OperationTicket / CommitGuard / terminal CAS を型付き実装した lane プリミティブ。\n * docs/async-execution-model.md §5 が既に規範化した排他モード\n * (latest / queue / exhaust / overlap) を、`AbortController` だけでは防げない\n * 「取消不能な Promise・abort と同時に完了した結果の commit」から守るための\n * 実行時ガードとして具体化する。\n *\n * 配置方針 (§5): 本ファイルは /io-core/ の単一正典であり、scripts/sync-io-core.mjs が\n * 各 IO ノードの src/core/ へ生成コピー (AUTO-GENERATED, 編集禁止) を配布する。\n * `protocol/wcBindable.ts` と同じ copy-distribution 方式で、ランタイム依存を導入せず\n * 各パッケージのバンドルへ inline される (zero-runtime-dep / 自己完結 CDN を維持)。\n * 編集はこの正典に対して行い、`node scripts/sync-io-core.mjs` で再配布する。\n *\n * PoC 実装対象は fetch の `latest` policy のみ。queue / exhaust / overlap は\n * 「全 policy の lane unit」(§8 完了条件) として `operationLane.test.ts` が\n * 直接検証する。lane 自体は promise を実行せず、bookkeeping と guard の\n * 状態機械に徹する — 実際の非同期処理は Core が駆動し lane に照合する。\n */\n\n/** §5: 排他モードの語彙。async-execution-model.md §5 の 4 モードに対応 (parallel は予約語・スコープ外)。 */\nexport type LanePolicy = \"latest\" | \"queue\" | \"exhaust\" | \"overlap\";\n\n/** §5: 各 operation の一回限りの終端結果。 */\nexport type TerminalOutcome = \"success\" | \"error\" | \"timeout\" | \"aborted\" | \"stale\";\n\n/** §5: 論理操作 1 件の identity。retry は同じ operationId を再利用する。 */\nexport interface OperationTicket {\n readonly operationId: number;\n /** 発行時に捕捉した I/O Core の observe / reconnect / dispose lifecycle 世代。 */\n readonly ownerGeneration: number;\n readonly laneKey: string;\n readonly policy: LanePolicy;\n /** supersede bookkeeping に使う epoch (latest policy のみ)。 */\n readonly supersedeEpoch?: number;\n}\n\n/** §5: operation の 1 回の試行。retry で attempt++ と resource signal だけ差し替える。 */\nexport interface OperationAttempt {\n readonly operationId: number;\n readonly attempt: number;\n readonly signal?: AbortSignal;\n}\n\n/** §6: DevTools 側 channel へ流す trace(fetch では既定 off・zero-cost)。 */\nexport type OperationTraceEvent =\n | { readonly type: \"io:operation-started\"; readonly operationId: number; readonly laneKey: string; readonly policy: LanePolicy }\n | { readonly type: \"io:operation-retried\"; readonly operationId: number; readonly laneKey: string; readonly attempt: number }\n | { readonly type: \"io:operation-settled\"; readonly operationId: number; readonly laneKey: string; readonly outcome: TerminalOutcome }\n | { readonly type: \"io:stale-dropped\"; readonly operationId: number; readonly laneKey: string };\n\nexport interface OperationLaneOptions {\n /** attempt ごとに AbortController を発行し signal を渡す (fetch/upload 系)。 */\n readonly withSignal?: boolean;\n /**\n * trace subscriber。undefined なら trace record を一切生成しない\n * (§10.3 hook-off zero allocation の gate)。\n */\n readonly trace?: (event: OperationTraceEvent) => void;\n}\n\n/** 内部の終端状態。absence = pending。'committing' は multi-setter commit 中の中間状態。 */\ntype TerminalStatus = \"committing\" | TerminalOutcome;\n\n/**\n * 1 レーン = 独立した排他単位。Core が 1 つ以上所有する (module singleton にしない —\n * 複数 <wcs-fetch> 間で漏れるため)。\n */\nexport class OperationLane {\n readonly laneKey: string;\n readonly policy: LanePolicy;\n\n private _ownerGeneration = 0;\n private _latestEpoch = 0;\n private _nextOperationId = 1;\n // latest / queue / exhaust の単一 active。queue は head を指す。\n private _activeOperationId: number | undefined = undefined;\n // overlap の active set (§5: 内部 bookkeeping のみ・observable 公開はしない)。\n private readonly _activeOperationIds = new Set<number>();\n // queue policy の FIFO。\n private readonly _queue: OperationTicket[] = [];\n private _inFlightCount = 0;\n // opId → 終端状態 (absence = pending)。\n private readonly _terminal = new Map<number, TerminalStatus>();\n // claimTerminal で確定した outcome (finalize が 'committing' を最終値へ移す)。\n private readonly _claimedOutcome = new Map<number, TerminalOutcome>();\n // opId → AbortController (identity は opId が保証。cross-op clobber は構造上起きない)。\n private readonly _controllers = new Map<number, AbortController>();\n // opId → attempt 数。\n private readonly _attempts = new Map<number, number>();\n private readonly _withSignal: boolean;\n private readonly _trace?: (event: OperationTraceEvent) => void;\n\n constructor(laneKey: string, policy: LanePolicy, options: OperationLaneOptions = {}) {\n this.laneKey = laneKey;\n this.policy = policy;\n this._withSignal = options.withSignal ?? false;\n this._trace = options.trace;\n }\n\n get ownerGeneration(): number {\n return this._ownerGeneration;\n }\n\n get inFlightCount(): number {\n return this._inFlightCount;\n }\n\n get latestEpoch(): number {\n return this._latestEpoch;\n }\n\n get activeOperationId(): number | undefined {\n return this._activeOperationId;\n }\n\n /**\n * 新しい要求の到着。arrival policy を適用し ticket + 最初の attempt を発行する。\n * exhaust で実行中の場合だけ null を返す (新要求を ticket 化せず拒否 = 冪等 no-op)。\n */\n begin(): { ticket: OperationTicket; attempt: OperationAttempt } | null {\n let supersedeEpoch: number | undefined;\n switch (this.policy) {\n case \"latest\": {\n // latestEpoch を進め、旧 active を abort (可能なら)。旧 ticket は settle 時に\n // eligibility 不一致で stale となる。\n supersedeEpoch = ++this._latestEpoch;\n if (this._activeOperationId !== undefined) {\n this._abortController(this._activeOperationId);\n }\n break;\n }\n case \"exhaust\": {\n // 実行中なら新要求を拒否 (呼び出し側は既存結果へ合流)。\n if (this._activeOperationId !== undefined) {\n return null;\n }\n break;\n }\n case \"queue\":\n case \"overlap\":\n break;\n }\n\n const operationId = this._nextOperationId++;\n const ticket: OperationTicket = {\n operationId,\n ownerGeneration: this._ownerGeneration,\n laneKey: this.laneKey,\n policy: this.policy,\n supersedeEpoch,\n };\n\n switch (this.policy) {\n case \"latest\":\n case \"exhaust\":\n this._activeOperationId = operationId;\n break;\n case \"queue\":\n this._queue.push(ticket);\n // 先頭だけを active にする (先行が完了するまで待つ)。\n if (this._activeOperationId === undefined) {\n this._activeOperationId = operationId;\n }\n break;\n case \"overlap\":\n this._activeOperationIds.add(operationId);\n break;\n }\n\n this._inFlightCount += 1;\n this._attempts.set(operationId, 1);\n const attempt = this._makeAttempt(operationId, 1);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:operation-started\", operationId, laneKey: this.laneKey, policy: this.policy });\n }\n return { ticket, attempt };\n }\n\n /**\n * retry: 同じ operationId に新しい attempt を作る。attempt number と resource signal\n * だけを更新する (§5)。既に終端した operation には作れない (null)。\n */\n retry(ticket: OperationTicket): OperationAttempt | null {\n if (ticket.ownerGeneration !== this._ownerGeneration) return null;\n if (this._terminal.has(ticket.operationId)) return null;\n const previous = this._attempts.get(ticket.operationId);\n if (previous === undefined) return null;\n const attemptNo = previous + 1;\n this._attempts.set(ticket.operationId, attemptNo);\n // 前の attempt の signal は破棄し、新しい controller を張る。\n this._releaseController(ticket.operationId);\n const attempt = this._makeAttempt(ticket.operationId, attemptNo);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:operation-retried\", operationId: ticket.operationId, laneKey: this.laneKey, attempt: attemptNo });\n }\n return attempt;\n }\n\n /**\n * CommitGuard (§5.1)。外部可視の setter / event dispatch の直前に呼ぶ。\n * (1) owner lifecycle generation 一致 (2) terminal settle 前 (3) policy eligibility。\n */\n canCommit(ticket: OperationTicket): boolean {\n if (ticket.ownerGeneration !== this._ownerGeneration) return false;\n const status = this._terminal.get(ticket.operationId);\n // absence = pending / 'committing' = multi-setter commit 中。どちらも settle 前。\n if (status !== undefined && status !== \"committing\") return false;\n return this._isEligible(ticket);\n }\n\n /**\n * terminal CAS (§5.1): pending → committing を claim する。勝者だけが true。\n * eligibility / owner gen を満たさない場合も false。claim 後は commit 中となり、\n * canCommit は各 setter の直前で再検査する (setter が同期 supersede しても取りこぼさない)。\n */\n claimTerminal(ticket: OperationTicket, outcome: TerminalOutcome): boolean {\n if (ticket.ownerGeneration !== this._ownerGeneration) return false;\n if (this._terminal.has(ticket.operationId)) return false; // 既に committing / 終端\n if (!this._isEligible(ticket)) return false;\n this._terminal.set(ticket.operationId, \"committing\");\n this._claimedOutcome.set(ticket.operationId, outcome);\n return true;\n }\n\n /** claim 済み outcome (timer が claim → catch が読む等)。未 claim なら undefined。 */\n claimedOutcome(ticket: OperationTicket): TerminalOutcome | undefined {\n return this._claimedOutcome.get(ticket.operationId);\n }\n\n /**\n * operation の後始末。claim 済みなら outcome を確定し、未 claim なら stale-drop。\n * controller を解放し in-flight を減らし、policy の bookkeeping を進める。冪等。\n */\n finalize(ticket: OperationTicket): void {\n const operationId = ticket.operationId;\n const status = this._terminal.get(operationId);\n if (status !== undefined && status !== \"committing\") {\n // 既に確定済み。冪等に return。\n return;\n }\n let outcome: TerminalOutcome;\n if (status === \"committing\") {\n outcome = this._claimedOutcome.get(operationId) ?? \"stale\";\n } else {\n // 一度も claim されなかった (supersede / dispose で eligibility を失った)。\n outcome = \"stale\";\n }\n this._terminal.set(operationId, outcome);\n this._claimedOutcome.delete(operationId);\n this._releaseController(operationId);\n this._attempts.delete(operationId);\n if (this._inFlightCount > 0) this._inFlightCount -= 1;\n this._advanceBookkeeping(operationId);\n if (this._trace !== undefined) {\n if (outcome === \"stale\") {\n this._trace({ type: \"io:stale-dropped\", operationId, laneKey: this.laneKey });\n } else {\n this._trace({ type: \"io:operation-settled\", operationId, laneKey: this.laneKey, outcome });\n }\n }\n }\n\n /** operation の signal (resource 解放用)。withSignal でなければ undefined。 */\n signalOf(ticket: OperationTicket): AbortSignal | undefined {\n return this._controllers.get(ticket.operationId)?.signal;\n }\n\n /** best-effort な resource 中断。正しさは owner gen / eligibility / terminal CAS が担う。 */\n abort(ticket: OperationTicket): void {\n this._abortController(ticket.operationId);\n }\n\n /**\n * 現在 active な operation を中断する (利用者による明示キャンセル)。epoch は進めない —\n * 中断された operation は eligibility を保ったまま 'aborted' を claim できる\n * (loading をクリアしつつ in-flight 状態を残す)。\n */\n abortActive(): void {\n if (this._activeOperationId !== undefined) {\n this._abortController(this._activeOperationId);\n }\n for (const operationId of this._activeOperationIds) {\n this._abortController(operationId);\n }\n }\n\n /**\n * dispose (§4.1 world generation)。owner generation を bump して全 ticket を無効化し、\n * 生きている controller を全て abort する。dispose 後に settle した operation は\n * owner gen 不一致で外部 commit しない。retention gate (§10.3) のため live な\n * 全 operation を即時に stale として finalize し、controller / attempt を解放する。\n */\n disposeOwner(): void {\n this._ownerGeneration += 1;\n for (const operationId of Array.from(this._controllers.keys())) {\n this._abortController(operationId);\n // finalize は dispose 後 (terminal='stale') に early-return するため controller を\n // 解放しない。retention gate (§10.3) を満たすためここで明示的に解放する。\n this._releaseController(operationId);\n }\n for (const operationId of Array.from(this._attempts.keys())) {\n if (!this._terminal.has(operationId)) {\n this._terminal.set(operationId, \"stale\");\n }\n this._claimedOutcome.delete(operationId);\n this._attempts.delete(operationId);\n if (this._trace !== undefined) {\n this._trace({ type: \"io:stale-dropped\", operationId, laneKey: this.laneKey });\n }\n }\n this._activeOperationId = undefined;\n this._activeOperationIds.clear();\n this._queue.length = 0;\n this._inFlightCount = 0;\n }\n\n // --- internal ---\n\n private _makeAttempt(operationId: number, attemptNo: number): OperationAttempt {\n let signal: AbortSignal | undefined;\n // AbortController 不在環境(古い runtime / 一部 SSR)では degraded: signal なしで進む。\n // 正しさは owner generation / eligibility / terminal CAS が担うため、native 中断が\n // 無くても supersede / dispose は機能する(best-effort resource 中断が省かれるだけ)。\n if (this._withSignal && typeof AbortController === \"function\") {\n const controller = new AbortController();\n this._controllers.set(operationId, controller);\n signal = controller.signal;\n }\n return { operationId, attempt: attemptNo, signal };\n }\n\n private _isEligible(ticket: OperationTicket): boolean {\n switch (this.policy) {\n case \"latest\":\n return ticket.supersedeEpoch === this._latestEpoch;\n case \"queue\":\n case \"exhaust\":\n return this._activeOperationId === ticket.operationId;\n case \"overlap\":\n return this._activeOperationIds.has(ticket.operationId);\n }\n }\n\n private _advanceBookkeeping(operationId: number): void {\n switch (this.policy) {\n case \"latest\":\n case \"exhaust\":\n if (this._activeOperationId === operationId) {\n this._activeOperationId = undefined;\n }\n break;\n case \"queue\": {\n // 完了した ticket を FIFO から取り除き、次の先頭を active にする。filter で\n // 「先頭 / 非先頭 / 不在」を一様に扱う (finalize は冪等ガードを通った op のみ到達)。\n const remaining = this._queue.filter((t) => t.operationId !== operationId);\n this._queue.length = 0;\n this._queue.push(...remaining);\n this._activeOperationId = this._queue.length > 0 ? this._queue[0].operationId : undefined;\n break;\n }\n case \"overlap\":\n this._activeOperationIds.delete(operationId);\n break;\n }\n }\n\n private _abortController(operationId: number): void {\n const controller = this._controllers.get(operationId);\n if (controller !== undefined && !controller.signal.aborted) {\n controller.abort();\n }\n }\n\n private _releaseController(operationId: number): void {\n this._controllers.delete(operationId);\n }\n}\n","// ===========================================================================\n// AUTO-GENERATED FILE - DO NOT EDIT.\n// Generated from /io-core/platform-capability.ts by scripts/sync-io-core.mjs.\n// Run `node scripts/sync-io-core.mjs` after editing the source.\n// ===========================================================================\n\n/**\n * platform-capability.ts\n *\n * Phase 6(docs/architecture-hardening/09-remediation-design.md §7.2 /\n * 07-browser-capability-variance.md)の browser capability 判定と error taxonomy の\n * 汎用プリミティブ。node 固有の capability registry / error code は各パッケージが\n * 別ファイルで宣言し、この汎用層(型 + assess 機構)を import する。\n *\n * 原則:\n * - feature detection は境界(利用直前)で行う。module 評価時に browser global を\n * 参照しない(SSR / worker で import が失敗しない)。\n * - capability ID(`web.fetch` 等)は文字列を global property path として eval せず、\n * registry が ID ごとに副作用のない presence probe を対応付ける。\n * - availability / permission / readiness / activity / operation error を 1 つの\n * `ready / unsupported / error` enum に畳まない。required 欠如は開始しない、\n * optional 欠如は宣言済み fallback で readiness を `degraded` にする。\n *\n * 配置: 本ファイルは /io-core/ の単一正典であり、scripts/sync-io-core.mjs が\n * 各 IO ノードの src/core/ へ生成コピー (AUTO-GENERATED, 編集禁止) を配布する。\n * `protocol/wcBindable.ts` と同じ copy-distribution 方式で、ランタイム依存を導入せず\n * 各パッケージのバンドルへ inline される (zero-runtime-dep / 自己完結 CDN を維持)。\n * 編集はこの正典に対して行い、`node scripts/sync-io-core.mjs` で再配布する。\n *\n * pure(module 評価時に browser global 非参照)。\n */\n\nexport type Availability = \"available\" | \"missing\" | \"unknown\";\nexport type PermissionState = \"granted\" | \"denied\" | \"prompt\" | \"not-applicable\" | \"unknown\";\nexport type Readiness = \"idle\" | \"ready\" | \"degraded\";\nexport type Activity = \"inactive\" | \"active\";\nexport type PreconditionState = \"satisfied\" | \"required\" | \"not-applicable\";\n\n/** operation error の phase(taxonomy)。 */\nexport type WcsIoErrorPhase = \"probe\" | \"start\" | \"execute\" | \"decode\" | \"commit\" | \"dispose\";\n\n/** serializable な error info(non-cloneable な cause とは分離。DevTools / remote へは info のみ)。 */\nexport interface WcsIoErrorInfo {\n readonly code: string;\n readonly phase: WcsIoErrorPhase;\n readonly recoverable: boolean;\n readonly capabilityId?: string;\n readonly message: string;\n}\n\nexport interface PlatformAssessment {\n readonly availability: ReadonlyMap<string, Availability>;\n readonly permission: PermissionState;\n readonly readiness: Readiness;\n readonly activity: Activity;\n readonly preconditions: {\n readonly secureContext: PreconditionState;\n readonly userActivation: PreconditionState;\n };\n readonly epoch: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\n/** capability 1 件の仕様。probe は副作用なく presence を返す(利用直前に呼ぶ)。 */\nexport interface CapabilitySpec {\n readonly probe: () => boolean;\n readonly requiresSecureContext?: boolean;\n readonly requiresUserActivation?: boolean;\n /** browser compatibility dataset のキー(任意・診断用)。 */\n readonly compatKey?: string;\n}\n\nexport type CapabilityRegistry = ReadonlyMap<string, CapabilitySpec>;\n\nexport interface AssessOptions {\n readonly required: readonly string[];\n readonly optional?: readonly string[];\n readonly permission?: PermissionState;\n readonly activity?: Activity;\n readonly epoch?: number;\n readonly lastError?: WcsIoErrorInfo;\n}\n\nfunction isSecureContext(): boolean {\n return (globalThis as { isSecureContext?: unknown }).isSecureContext === true;\n}\n\n/**\n * capability を利用直前に評価して PlatformAssessment を作る。\n * required が 1 つでも欠ければ readiness は \"idle\"(開始不可)、\n * required 揃い + optional 欠けは \"degraded\"、全揃いは \"ready\"。\n */\nexport function assessCapabilities(registry: CapabilityRegistry, options: AssessOptions): PlatformAssessment {\n const availability = new Map<string, Availability>();\n const evaluate = (id: string): Availability => {\n const spec = registry.get(id);\n if (spec === undefined) return \"unknown\";\n return spec.probe() ? \"available\" : \"missing\";\n };\n\n let requiredAllAvailable = true;\n for (const id of options.required) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") requiredAllAvailable = false;\n }\n let optionalAllAvailable = true;\n for (const id of options.optional ?? []) {\n const a = evaluate(id);\n availability.set(id, a);\n if (a !== \"available\") optionalAllAvailable = false;\n }\n\n const readiness: Readiness = !requiredAllAvailable ? \"idle\" : (optionalAllAvailable ? \"ready\" : \"degraded\");\n\n // preconditions: 対象 capability のいずれかが要求する場合だけ評価する。\n const allIds = [...options.required, ...(options.optional ?? [])];\n const needsSecure = allIds.some((id) => registry.get(id)?.requiresSecureContext === true);\n const needsActivation = allIds.some((id) => registry.get(id)?.requiresUserActivation === true);\n const secureContext: PreconditionState = needsSecure ? (isSecureContext() ? \"satisfied\" : \"required\") : \"not-applicable\";\n const userActivation: PreconditionState = needsActivation ? \"required\" : \"not-applicable\";\n\n return {\n availability,\n permission: options.permission ?? \"not-applicable\",\n readiness,\n activity: options.activity ?? \"inactive\",\n preconditions: { secureContext, userActivation },\n epoch: options.epoch ?? 0,\n lastError: options.lastError,\n };\n}\n\n/** availability から「required がすべて available か」を判定するヘルパ(supported の最低条件)。 */\nexport function requiredCapabilitiesAvailable(assessment: PlatformAssessment, required: readonly string[]): boolean {\n return required.every((id) => assessment.availability.get(id) === \"available\");\n}\n","/**\n * credentialCapabilities.ts\n *\n * Credential Management node 固有の capability registry と error code。汎用の assess\n * 機構・型は `./platformCapability.js`(/io-core/ から copy-distribution される生成\n * ファイル)から import する。node 固有の宣言はこのハンドライトファイルに置き、生成\n * コピーとは分離する。\n */\n\nimport { CapabilityRegistry, CapabilitySpec } from \"./platformCapability.js\";\n\n/** 安定した credential error code(taxonomy)。値は公開キーとして固定。 */\nexport const WCS_CREDENTIAL_ERROR_CODE = {\n CapabilityMissing: \"capability-missing\",\n /** WebAuthn(publicKey) は v1 スコープ外 — get()/store() 双方で拒否する。 */\n OutOfScope: \"out-of-scope\",\n /** get()/store() の真のプラットフォーム失敗(NotAllowedError=cancelled は除く)。 */\n CredentialFailed: \"credential-failed\",\n} as const;\n\n/**\n * credential node の capability registry。`navigator.credentials`(CredentialsContainer)\n * の presence を probe する。文字列 ID を global property path として eval しない。\n */\nexport const CREDENTIAL_CAPABILITIES: CapabilityRegistry = new Map<string, CapabilitySpec>([\n [\"web.credentials\", { probe: () => (globalThis as { navigator?: { credentials?: unknown } }).navigator?.credentials != null, compatKey: \"api.CredentialsContainer\" }],\n]);\n","import { CredentialGetOptions, IWcBindable, StorableCredential } from \"../types.js\";\nimport { OperationLane, OperationTicket } from \"./operationLane.js\";\nimport {\n PlatformAssessment,\n WcsIoErrorInfo,\n WcsIoErrorPhase,\n assessCapabilities,\n requiredCapabilitiesAvailable,\n} from \"./platformCapability.js\";\nimport { CREDENTIAL_CAPABILITIES, WCS_CREDENTIAL_ERROR_CODE } from \"./credentialCapabilities.js\";\n\n/**\n * Headless Credential Management primitive. A thin, framework-agnostic wrapper\n * around `navigator.credentials.get()`/`.store()` exposed through the wc-bindable\n * protocol.\n *\n * Concurrency is owned by the shared `OperationLane` (io-core) with the `latest`\n * policy — **`get()` and `store()` share one lane**. A later call supersedes the\n * earlier one (the earlier completion fails the terminal CAS), preserving the v1\n * \"single generation\" behavior (docs/multi-promise-io-node-design.md): these two\n * operations are used sequentially in real auth flows (store after login, get\n * before one), not naturally concurrently on the same instance. If both ARE\n * invoked concurrently, the later call's result wins; use two separate\n * `<wcs-credential>` instances if that bites. The lane runs with\n * `withSignal: false` — the Credential Management API takes no `AbortSignal`;\n * dispose() invalidates any in-flight call via the owner generation.\n *\n * **v1 scope excludes WebAuthn (`publicKey`)** (docs/credential-tag-design.md §0):\n * `get()` validates+strips a `publicKey` option and `store()` rejects a\n * `PublicKeyCredential`, surfacing the attempt as a scope-violation `error`\n * (`errorInfo.code === \"out-of-scope\"`) rather than a WebAuthn backdoor.\n *\n * Note the cancellation signal is **`NotAllowedError`, NOT `AbortError`**: unlike\n * Web Share / Contact Picker, `credentials.get()/store()` reject with\n * `NotAllowedError` when the user dismisses the native chooser. That maps to\n * `cancelled`; every other name flows to `error`/`errorInfo`.\n */\nexport class CredentialCore extends EventTarget {\n static wcBindable: IWcBindable = {\n protocol: \"wc-bindable\",\n version: 1,\n properties: [\n { name: \"value\", event: \"wcs-credential:complete\", getter: (e: Event) => (e as CustomEvent).detail.value },\n { name: \"loading\", event: \"wcs-credential:loading-changed\" },\n { name: \"error\", event: \"wcs-credential:error\" },\n { name: \"cancelled\", event: \"wcs-credential:cancelled-changed\" },\n // Serializable failure taxonomy (stable code / phase / recoverable), or null.\n // Additive bindable output; the existing `error` property/event are unchanged.\n // Fires its own `wcs-credential:error-info-changed` event; no getter, so the\n // bound value is the event detail (mirrors `error` / `loading` / `cancelled`).\n { name: \"errorInfo\", event: \"wcs-credential:error-info-changed\" },\n ],\n commands: [\n { name: \"get\", async: true },\n { name: \"store\", async: true },\n ],\n };\n\n // Required capability (probed at call time, never at module eval).\n private static readonly REQUIRED_CAPABILITIES = [\"web.credentials\"] as const;\n\n private _target: EventTarget;\n private _value: Credential | null = null;\n private _loading: boolean = false;\n private _error: any = null;\n private _cancelled: boolean = false;\n private _errorInfo: WcsIoErrorInfo | null = null;\n // Concurrency lane (io-core), shared by get() and store(). `latest`: a later\n // call supersedes the earlier. `withSignal: false`: the API takes no AbortSignal.\n private _lane = new OperationLane(\"credential\", \"latest\", { withSignal: false });\n // SSR (§3.8): no asynchronous probe to await, so readiness is immediate.\n private _ready: Promise<void> = Promise.resolve();\n\n constructor(target?: EventTarget) {\n super();\n this._target = target ?? this;\n }\n\n get ready(): Promise<void> {\n return this._ready;\n }\n\n get value(): Credential | null {\n return this._value;\n }\n\n get loading(): boolean {\n return this._loading;\n }\n\n get error(): any {\n return this._error;\n }\n\n get cancelled(): boolean {\n return this._cancelled;\n }\n\n /**\n * The last failure's serializable `WcsIoErrorInfo` (stable `code` / `phase` /\n * `recoverable` / `capabilityId`), or null. Exposed as an additive wc-bindable\n * property (event `wcs-credential:error-info-changed`); the existing `error`\n * property/event are unchanged. A `NotAllowedError` user cancellation is\n * `cancelled`, not `errorInfo`.\n */\n get errorInfo(): WcsIoErrorInfo | null {\n return this._errorInfo;\n }\n\n /**\n * Whether the required platform capability (`web.credentials`) is available right\n * now — decided by call-time feature detection, not User-Agent. Core-only,\n * additive.\n */\n get supported(): boolean {\n return requiredCapabilitiesAvailable(this.platformAssessment, CredentialCore.REQUIRED_CAPABILITIES);\n }\n\n /**\n * Full platform assessment (availability / readiness / preconditions), probed at\n * call time. Core-only opt-in dev / sidecar view.\n */\n get platformAssessment(): PlatformAssessment {\n return assessCapabilities(CREDENTIAL_CAPABILITIES, {\n required: CredentialCore.REQUIRED_CAPABILITIES,\n activity: this._loading ? \"active\" : \"inactive\",\n lastError: this._errorInfo ?? undefined,\n });\n }\n\n // Lifecycle (§3.5). Command-driven with no subscription to establish, so\n // observe() is an idempotent no-op that resolves once ready; dispose() bumps the\n // lane's owner generation, invalidating any in-flight get()/store().\n observe(): Promise<void> {\n return this._ready;\n }\n\n dispose(): void {\n this._lane.disposeOwner();\n }\n\n // CommitGuard (§5.1): external setters / event dispatch only run if the ticket\n // still holds owner generation, is pre-terminal, and is the lane's latest epoch\n // (a superseding get()/store() can invalidate a ticket mid-commit).\n private _commitStep(ticket: OperationTicket, step: () => void): void {\n if (this._lane.canCommit(ticket)) {\n step();\n }\n }\n\n private _setLoading(loading: boolean): void {\n if (this._loading === loading) return;\n this._loading = loading;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:loading-changed\", {\n detail: loading,\n bubbles: true,\n }));\n }\n\n // Deliberately NO same-value guard (unlike error/loading/cancelled below).\n // `value` is a success-completion signal, not idempotent state: it is written\n // only on a successful get()/store(), and wcs-credential:complete is the *sole*\n // success notification (store() echoes the caller's credential, so two successful\n // store() calls with the same object reference are two distinct completions). This\n // matches ShareCore `_setValue` / clipboard `_setRead`.\n private _setValue(value: Credential | null): void {\n this._value = value;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:complete\", {\n detail: { value },\n bubbles: true,\n }));\n }\n\n private _setError(error: any): void {\n if (this._error === error) return;\n this._error = error;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:error\", {\n detail: error,\n bubbles: true,\n }));\n }\n\n private _setCancelled(cancelled: boolean): void {\n if (this._cancelled === cancelled) return;\n this._cancelled = cancelled;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:cancelled-changed\", {\n detail: cancelled,\n bubbles: true,\n }));\n }\n\n // Single mutation point for `errorInfo`, mirroring `_setError`'s same-value guard\n // and event dispatch so the additive `errorInfo` wc-bindable property stays in\n // sync with `error`. Each failure builds a fresh object (reference guard passes);\n // the clear path passes null (suppresses a redundant null→null per call start).\n private _setErrorInfo(code: string, phase: WcsIoErrorPhase, recoverable: boolean, message: string, capabilityId?: string): void {\n this._commitErrorInfo({ code, phase, recoverable, message, ...(capabilityId === undefined ? {} : { capabilityId }) });\n }\n\n private _commitErrorInfo(info: WcsIoErrorInfo | null): void {\n if (this._errorInfo === info) return;\n this._errorInfo = info;\n this._target.dispatchEvent(new CustomEvent(\"wcs-credential:error-info-changed\", {\n detail: info,\n bubbles: true,\n }));\n }\n\n // Normalizes a rejection reason to a consistent { name, message } shape,\n // mirroring WorkerCore._normalizeError (packages/worker/src/core/WorkerCore.ts).\n private _normalizeError(e: unknown): { name: string; message: string } {\n if (e instanceof Error) {\n return { name: e.name, message: e.message };\n }\n return { name: \"Error\", message: String(e) };\n }\n\n // Classifies a get()/store() rejection as a user cancellation vs a real failure.\n // The Credential Management API rejects with `NotAllowedError` when the user\n // dismisses/declines the native chooser — a routine \"the user did not pick\"\n // outcome, mapped to `cancelled` and kept out of `error`/`errorInfo`. This is\n // `NotAllowedError`, NOT `AbortError` (unlike Web Share / Contact Picker). Every\n // other name (SecurityError, NetworkError, etc.) flows to `error`.\n private _isCancellation(e: unknown): boolean {\n return (e as { name?: unknown } | null)?.name === \"NotAllowedError\";\n }\n\n // Shared lane flow for get()/store() (both `latest` on the same lane). `op`\n // performs the platform call and returns the value to publish on success.\n private async _run(op: () => Promise<Credential | null>): Promise<Credential | null> {\n // `latest`: advance the epoch (supersede any in-flight get()/store()).\n const started = this._lane.begin()!;\n const { ticket } = started;\n\n this._commitStep(ticket, () => this._setLoading(true));\n // Reset the previous outcome before starting so a stale cancelled/error/\n // errorInfo does not linger into this call's result.\n this._commitStep(ticket, () => {\n this._commitErrorInfo(null);\n this._setError(null);\n this._setCancelled(false);\n });\n\n try {\n const value = await op();\n // Terminal CAS: a stale (superseded / dispose-invalidated) completion loses\n // the claim and is dropped without writing state.\n if (!this._lane.claimTerminal(ticket, \"success\")) {\n return null;\n }\n // Separate commit steps (like FetchCore): if `_setValue`'s event listener\n // synchronously supersedes this op, the following `_setLoading(false)` is\n // stopped by the commit guard rather than clobbering the newer op.\n this._commitStep(ticket, () => this._setValue(value));\n this._commitStep(ticket, () => this._setLoading(false));\n this._lane.finalize(ticket);\n return value;\n } catch (e: any) {\n const cancelled = this._isCancellation(e);\n if (!this._lane.claimTerminal(ticket, cancelled ? \"aborted\" : \"error\")) {\n return null;\n }\n this._commitStep(ticket, () => {\n if (cancelled) {\n this._setCancelled(true);\n } else {\n const norm = this._normalizeError(e);\n this._setErrorInfo(WCS_CREDENTIAL_ERROR_CODE.CredentialFailed, \"execute\", true, norm.message);\n this._setError(norm);\n }\n });\n this._commitStep(ticket, () => this._setLoading(false));\n this._lane.finalize(ticket);\n return null;\n }\n }\n\n /**\n * `get(options)` — v1 scope excludes `publicKey` (WebAuthn). If present, it is\n * stripped and the call surfaces a scope-violation `error` instead of forwarding\n * it to the platform API. `navigator.credentials.get()` does not require a user\n * gesture, so this can be invoked automatically on page load for silent sign-in.\n */\n async get(options: CredentialGetOptions & { publicKey?: unknown } = {}): Promise<Credential | null> {\n if (\"publicKey\" in options) {\n const message = \"WebAuthn (publicKey) is out of scope for @wcstack/credential v1. Use a dedicated WebAuthn node instead.\";\n this._setErrorInfo(WCS_CREDENTIAL_ERROR_CODE.OutOfScope, \"start\", false, message);\n this._setError({ name: \"NotSupportedError\", message });\n return null;\n }\n\n const assessment = this.platformAssessment;\n if (!requiredCapabilitiesAvailable(assessment, CredentialCore.REQUIRED_CAPABILITIES)) {\n const missing = CredentialCore.REQUIRED_CAPABILITIES.find((id) => assessment.availability.get(id) !== \"available\");\n const message = \"Credential Management API is not supported in this browser.\";\n this._setErrorInfo(WCS_CREDENTIAL_ERROR_CODE.CapabilityMissing, \"start\", false, message, missing);\n this._setError({ message });\n return null;\n }\n\n const nav = (globalThis as { navigator?: { credentials?: CredentialsContainer } }).navigator!;\n return this._run(() => nav.credentials!.get(options as CredentialRequestOptions));\n }\n\n /**\n * `store(credential)` — shares the same single lane as `get()`.\n * `navigator.credentials.store()` resolves `Promise<void>`, so `value` is\n * synthesized as an echo of the caller's `credential`. A `PublicKeyCredential`\n * (`type === \"public-key\"`, WebAuthn) is rejected as a scope violation before\n * touching the platform API.\n */\n async store(credential: StorableCredential): Promise<Credential | null> {\n if ((credential as { type?: unknown } | null)?.type === \"public-key\") {\n const message = \"WebAuthn (publicKey) credentials are out of scope for @wcstack/credential v1. Use a dedicated WebAuthn node instead.\";\n this._setErrorInfo(WCS_CREDENTIAL_ERROR_CODE.OutOfScope, \"start\", false, message);\n this._setError({ name: \"NotSupportedError\", message });\n return null;\n }\n\n const assessment = this.platformAssessment;\n if (!requiredCapabilitiesAvailable(assessment, CredentialCore.REQUIRED_CAPABILITIES)) {\n const missing = CredentialCore.REQUIRED_CAPABILITIES.find((id) => assessment.availability.get(id) !== \"available\");\n const message = \"Credential Management API is not supported in this browser.\";\n this._setErrorInfo(WCS_CREDENTIAL_ERROR_CODE.CapabilityMissing, \"start\", false, message, missing);\n this._setError({ message });\n return null;\n }\n\n const nav = (globalThis as { navigator?: { credentials?: CredentialsContainer } }).navigator!;\n return this._run(async () => {\n await nav.credentials!.store(credential);\n return credential;\n });\n }\n}\n","import { CredentialGetOptions, IWcBindable, StorableCredential } from \"../types.js\";\nimport { CredentialCore } from \"../core/CredentialCore.js\";\nimport { WcsIoErrorInfo } from \"../core/platformCapability.js\";\n\n/**\n * `<wcs-credential>` — declarative Credential Management API primitive\n * (password/federated only — see docs/credential-tag-design.md §0 for the\n * WebAuthn scope exclusion).\n *\n * A thin command-only Shell (mirrors `<wcs-share>`): no attributes at all.\n * `get(options)`/`store(credential)`'s arguments are per-call.\n */\nexport class WcsCredential extends HTMLElement {\n static hasConnectedCallbackPromise = true;\n\n static wcBindable: IWcBindable = {\n ...CredentialCore.wcBindable,\n inputs: [],\n // Inherit commands from Core (single source of truth).\n commands: CredentialCore.wcBindable.commands,\n };\n\n private _core: CredentialCore;\n private _connectedCallbackPromise: Promise<void> = Promise.resolve();\n private _internals: ElementInternals | null = null;\n\n constructor() {\n super();\n this._core = new CredentialCore(this);\n this._internals = this._initInternals();\n this._wireStates({\n \"wcs-credential:loading-changed\": (d) => ({ loading: d === true }),\n \"wcs-credential:cancelled-changed\": (d) => ({ cancelled: d === true }),\n \"wcs-credential:error\": (d) => ({ error: d != null }),\n });\n }\n\n // CSS state reflection (:state()) — debug-only snapshot getter. NOT part of\n // wc-bindable (not a bind target); see README \"CSS styling with :state()\".\n // MUST NOT return the live CustomStateSet (that would let callers write\n // states from outside, defeating the point of :state() being read-only).\n get debugStates(): string[] {\n return this._internals ? [...this._internals.states] : [];\n }\n\n private _initInternals(): ElementInternals | null {\n // never-throw (async-io-node-guidelines.md §3.6): attachInternals is absent\n // in happy-dom / older environments, and pre-125 Chromium rejects\n // non-dashed state names from states.add() (probed and discarded here).\n // Either case silently disables reflection — the component still works,\n // it just doesn't expose :state() selectors.\n try {\n if (typeof this.attachInternals !== \"function\") return null;\n const internals = this.attachInternals();\n internals.states.add(\"wcs-probe\");\n internals.states.delete(\"wcs-probe\");\n return internals;\n } catch {\n return null;\n }\n }\n\n private _wireStates(map: Record<string, (detail: any) => Record<string, boolean>>): void {\n if (this._internals === null) return;\n const states = this._internals.states;\n for (const [event, toStates] of Object.entries(map)) {\n this.addEventListener(event, (e) => {\n const debug = this.hasAttribute(\"debug-states\");\n for (const [name, on] of Object.entries(toStates((e as CustomEvent).detail))) {\n try {\n if (on) { states.add(name); } else { states.delete(name); }\n } catch { /* never-throw */ }\n if (debug) this.toggleAttribute(`data-wcs-state-${name}`, on);\n }\n });\n }\n }\n\n // --- Core delegated getters ---\n\n get value(): Credential | null {\n return this._core.value;\n }\n\n get loading(): boolean {\n return this._core.loading;\n }\n\n get error(): any {\n return this._core.error;\n }\n\n get cancelled(): boolean {\n return this._core.cancelled;\n }\n\n get errorInfo(): WcsIoErrorInfo | null {\n return this._core.errorInfo;\n }\n\n get connectedCallbackPromise(): Promise<void> {\n return this._connectedCallbackPromise;\n }\n\n // --- Commands ---\n\n get(options?: CredentialGetOptions): Promise<Credential | null> {\n return this._core.get(options);\n }\n\n store(credential: StorableCredential): Promise<Credential | null> {\n return this._core.store(credential);\n }\n\n // --- Lifecycle ---\n\n connectedCallback(): void {\n this.style.display = \"none\";\n this._connectedCallbackPromise = this._core.observe();\n }\n\n disconnectedCallback(): void {\n this._core.dispose();\n }\n}\n","import { setConfig } from \"./config.js\";\nimport { registerComponents } from \"./registerComponents.js\";\nimport { IWritableConfig } from \"./types.js\";\n\nexport function bootstrapCredential(userConfig?: IWritableConfig): void {\n if (userConfig) {\n setConfig(userConfig);\n }\n registerComponents();\n}\n","import { WcsCredential } from \"./components/Credential.js\";\nimport { config } from \"./config.js\";\n\nexport function registerComponents(): void {\n if (!customElements.get(config.tagNames.credential)) {\n customElements.define(config.tagNames.credential, WcsCredential);\n }\n}\n"],"names":["_config","tagNames","credential","deepFreeze","obj","Object","freeze","key","keys","deepClone","clone","frozenConfig","config","getConfig","OperationLane","laneKey","policy","_ownerGeneration","_latestEpoch","_nextOperationId","_activeOperationId","undefined","_activeOperationIds","Set","_queue","_inFlightCount","_terminal","Map","_claimedOutcome","_controllers","_attempts","_withSignal","_trace","constructor","options","this","withSignal","trace","ownerGeneration","inFlightCount","latestEpoch","activeOperationId","begin","supersedeEpoch","_abortController","operationId","ticket","push","add","set","attempt","_makeAttempt","type","retry","has","previous","get","attemptNo","_releaseController","canCommit","status","_isEligible","claimTerminal","outcome","claimedOutcome","finalize","delete","_advanceBookkeeping","signalOf","signal","abort","abortActive","disposeOwner","Array","from","clear","length","AbortController","controller","remaining","filter","t","aborted","assessCapabilities","registry","availability","evaluate","id","spec","probe","requiredAllAvailable","required","a","optionalAllAvailable","optional","readiness","allIds","needsSecure","some","requiresSecureContext","needsActivation","requiresUserActivation","secureContext","globalThis","isSecureContext","userActivation","permission","activity","preconditions","epoch","lastError","requiredCapabilitiesAvailable","assessment","every","WCS_CREDENTIAL_ERROR_CODE","CapabilityMissing","OutOfScope","CredentialFailed","CREDENTIAL_CAPABILITIES","navigator","credentials","compatKey","CredentialCore","EventTarget","static","protocol","version","properties","name","event","getter","e","detail","value","commands","async","_target","_value","_loading","_error","_cancelled","_errorInfo","_lane","_ready","Promise","resolve","target","super","ready","loading","error","cancelled","errorInfo","supported","platformAssessment","REQUIRED_CAPABILITIES","observe","dispose","_commitStep","step","_setLoading","dispatchEvent","CustomEvent","bubbles","_setValue","_setError","_setCancelled","_setErrorInfo","code","phase","recoverable","message","capabilityId","_commitErrorInfo","info","_normalizeError","Error","String","_isCancellation","_run","op","started","norm","missing","find","nav","store","WcsCredential","HTMLElement","wcBindable","inputs","_core","_connectedCallbackPromise","_internals","_initInternals","_wireStates","d","debugStates","states","attachInternals","internals","map","toStates","entries","addEventListener","debug","hasAttribute","on","toggleAttribute","connectedCallbackPromise","connectedCallback","style","display","disconnectedCallback","bootstrapCredential","userConfig","partialConfig","assign","customElements","define"],"mappings":"AAQA,MAAMA,EAA2B,CAC/BC,SAAU,CACRC,WAAY,mBAIhB,SAASC,EAAcC,GACrB,GAAY,OAARA,GAA+B,iBAARA,EAAkB,OAAOA,EACpDC,OAAOC,OAAOF,GACd,IAAK,MAAMG,KAAOF,OAAOG,KAAKJ,GAC5BD,EAAYC,EAAgCG,IAE9C,OAAOH,CACT,CAEA,SAASK,EAAaL,GACpB,GAAY,OAARA,GAA+B,iBAARA,EAAkB,OAAOA,EACpD,MAAMM,EAAiC,CAAA,EACvC,IAAK,MAAMH,KAAOF,OAAOG,KAAKJ,GAC5BM,EAAMH,GAAOE,EAAWL,EAAgCG,IAE1D,OAAOG,CACT,CAEA,IAAIC,EAA+B,KAS5B,MAAMC,EAAkBZ,WAEfa,IA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AC1B,CAIA,iBAAAgN,GACE/K,KAAKgL,MAAMC,QAAU,OACrBjL,KAAK6J,0BAA4B7J,KAAK4J,MAAMnC,SAC9C,CAEA,oBAAAyD,GACElL,KAAK4J,MAAMlC,SACb,ECvHI,SAAUyD,EAAoBC,GN8C9B,IAAoBC,EM7CpBD,KN6CoBC,EM5CZD,GN6CMtN,UAChBI,OAAOoN,OAAOzN,EAAQC,SAAUuN,EAAcvN,UAEhDU,EAAe,MOlDV+M,eAAelK,IAAI5C,EAAOX,SAASC,aACtCwN,eAAeC,OAAO/M,EAAOX,SAASC,WAAYyL,EDItD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wcstack/credential",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
4
4
|
"description": "Declarative Credential Management component for Web Components. Framework-agnostic navigator.credentials get/store wrapper (password/federated only) via wc-bindable-protocol.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.esm.js",
|