@endora-commerce/mod-credentials 0.100.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/LICENSE +21 -0
- package/README.md +59 -0
- package/dist/admin/api/credentials-client.d.ts +11 -0
- package/dist/admin/api/credentials-client.d.ts.map +1 -0
- package/dist/admin/api/credentials-client.js +38 -0
- package/dist/admin/api/credentials-client.js.map +1 -0
- package/dist/admin/components/ConfigurationForm.d.ts +22 -0
- package/dist/admin/components/ConfigurationForm.d.ts.map +1 -0
- package/dist/admin/components/ConfigurationForm.js +89 -0
- package/dist/admin/components/ConfigurationForm.js.map +1 -0
- package/dist/admin/index.d.ts +47 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +65 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/pages/CredentialsNewPage.d.ts +19 -0
- package/dist/admin/pages/CredentialsNewPage.d.ts.map +1 -0
- package/dist/admin/pages/CredentialsNewPage.js +22 -0
- package/dist/admin/pages/CredentialsNewPage.js.map +1 -0
- package/dist/admin/pages/CredentialsPage.d.ts +22 -0
- package/dist/admin/pages/CredentialsPage.d.ts.map +1 -0
- package/dist/admin/pages/CredentialsPage.js +154 -0
- package/dist/admin/pages/CredentialsPage.js.map +1 -0
- package/dist/admin-ui/ConfigurationPreviewModal.d.ts +16 -0
- package/dist/admin-ui/ConfigurationPreviewModal.d.ts.map +1 -0
- package/dist/admin-ui/ConfigurationPreviewModal.js +15 -0
- package/dist/admin-ui/ConfigurationPreviewModal.js.map +1 -0
- package/dist/admin-ui/index.d.ts +57 -0
- package/dist/admin-ui/index.d.ts.map +1 -0
- package/dist/admin-ui/index.js +56 -0
- package/dist/admin-ui/index.js.map +1 -0
- package/dist/backend/commands/create-configuration.command.d.ts +20 -0
- package/dist/backend/commands/create-configuration.command.d.ts.map +1 -0
- package/dist/backend/commands/create-configuration.command.js +70 -0
- package/dist/backend/commands/create-configuration.command.js.map +1 -0
- package/dist/backend/commands/delete-configuration.command.d.ts +16 -0
- package/dist/backend/commands/delete-configuration.command.d.ts.map +1 -0
- package/dist/backend/commands/delete-configuration.command.js +48 -0
- package/dist/backend/commands/delete-configuration.command.js.map +1 -0
- package/dist/backend/commands/update-configuration.command.d.ts +20 -0
- package/dist/backend/commands/update-configuration.command.d.ts.map +1 -0
- package/dist/backend/commands/update-configuration.command.js +94 -0
- package/dist/backend/commands/update-configuration.command.js.map +1 -0
- package/dist/backend/entities/credential-configuration.entity.d.ts +30 -0
- package/dist/backend/entities/credential-configuration.entity.d.ts.map +1 -0
- package/dist/backend/entities/credential-configuration.entity.js +84 -0
- package/dist/backend/entities/credential-configuration.entity.js.map +1 -0
- package/dist/backend/index.d.ts +73 -0
- package/dist/backend/index.d.ts.map +1 -0
- package/dist/backend/index.js +80 -0
- package/dist/backend/index.js.map +1 -0
- package/dist/backend/plugin.d.ts +43 -0
- package/dist/backend/plugin.d.ts.map +1 -0
- package/dist/backend/plugin.js +25 -0
- package/dist/backend/plugin.js.map +1 -0
- package/dist/backend/routes.admin.d.ts +27 -0
- package/dist/backend/routes.admin.d.ts.map +1 -0
- package/dist/backend/routes.admin.js +50 -0
- package/dist/backend/routes.admin.js.map +1 -0
- package/dist/backend/services/configuration-type-registry.d.ts +105 -0
- package/dist/backend/services/configuration-type-registry.d.ts.map +1 -0
- package/dist/backend/services/configuration-type-registry.js +111 -0
- package/dist/backend/services/configuration-type-registry.js.map +1 -0
- package/dist/backend/services/credentials.service.d.ts +63 -0
- package/dist/backend/services/credentials.service.d.ts.map +1 -0
- package/dist/backend/services/credentials.service.js +128 -0
- package/dist/backend/services/credentials.service.js.map +1 -0
- package/dist/backend/services/field-validator.d.ts +65 -0
- package/dist/backend/services/field-validator.d.ts.map +1 -0
- package/dist/backend/services/field-validator.js +165 -0
- package/dist/backend/services/field-validator.js.map +1 -0
- package/dist/backend/services/registry-singleton.d.ts +28 -0
- package/dist/backend/services/registry-singleton.d.ts.map +1 -0
- package/dist/backend/services/registry-singleton.js +29 -0
- package/dist/backend/services/registry-singleton.js.map +1 -0
- package/dist/backend/services/secret-value-codec.d.ts +55 -0
- package/dist/backend/services/secret-value-codec.d.ts.map +1 -0
- package/dist/backend/services/secret-value-codec.js +105 -0
- package/dist/backend/services/secret-value-codec.js.map +1 -0
- package/dist/backend/types/email-adapter.type.d.ts +10 -0
- package/dist/backend/types/email-adapter.type.d.ts.map +1 -0
- package/dist/backend/types/email-adapter.type.js +49 -0
- package/dist/backend/types/email-adapter.type.js.map +1 -0
- package/dist/backend/types/llm.type.d.ts +3 -0
- package/dist/backend/types/llm.type.d.ts.map +1 -0
- package/dist/backend/types/llm.type.js +35 -0
- package/dist/backend/types/llm.type.js.map +1 -0
- package/dist/manifest.d.ts +176 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +167 -0
- package/dist/manifest.js.map +1 -0
- package/dist/migrations/20260721T011509_credentials_init.d.ts +17 -0
- package/dist/migrations/20260721T011509_credentials_init.d.ts.map +1 -0
- package/dist/migrations/20260721T011509_credentials_init.js +36 -0
- package/dist/migrations/20260721T011509_credentials_init.js.map +1 -0
- package/dist/migrations/index.d.ts +27 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +29 -0
- package/dist/migrations/index.js.map +1 -0
- package/docs/credentials.md +202 -0
- package/i18n/en.json +47 -0
- package/i18n/pl.json +47 -0
- package/package.json +98 -0
- package/tailwind.css +16 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CredentialsPage.js","sourceRoot":"","sources":["../../../src/admin/pages/CredentialsPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAO/C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,eAAe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CAAC,eAAe,CAAC,GACZ,IACL,CACP,GACD,CACH,EAED,KAAC,yBAAyB,IACxB,IAAI,EAAE,OAAO,KAAK,IAAI,EACtB,aAAa,EAAE,OAAO,EACtB,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,GAC/B,IACE,CACP,CAAC;AACJ,CAAC;AAED,6EAA6E;AAC7E,MAAM,iBAAiB,GAA2B;IAChD,oBAAoB,EAAE,gBAAgB;IACtC,qBAAqB,EAAE,iBAAiB;IACxC,uBAAuB,EAAE,mBAAmB;IAC5C,4BAA4B,EAAE,wBAAwB;IACtD,iBAAiB,EAAE,aAAa;IAChC,yBAAyB,EAAE,qBAAqB;CACjD,CAAC;AAEF;;;;GAIG;AACH,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { ConfigurationDto } from '@endora-commerce/contracts';
|
|
3
|
+
/**
|
|
4
|
+
* Read-only preview of a credential configuration (feature 058 US1).
|
|
5
|
+
*
|
|
6
|
+
* Hand-rolled overlay mirroring the `OrdersBulkStatusDialog` convention (no
|
|
7
|
+
* shared Dialog primitive exists). Secrets are shown only as "set / not set" —
|
|
8
|
+
* never a value (SC-003).
|
|
9
|
+
*/
|
|
10
|
+
export interface ConfigurationPreviewModalProps {
|
|
11
|
+
open: boolean;
|
|
12
|
+
configuration: ConfigurationDto | null;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function ConfigurationPreviewModal({ open, configuration, onClose, }: ConfigurationPreviewModalProps): ReactNode;
|
|
16
|
+
//# sourceMappingURL=ConfigurationPreviewModal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigurationPreviewModal.d.ts","sourceRoot":"","sources":["../../src/admin-ui/ConfigurationPreviewModal.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAGnE;;;;;;GAMG;AACH,MAAM,WAAW,8BAA8B;IAC7C,IAAI,EAAE,OAAO,CAAC;IACd,aAAa,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACvC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,yBAAyB,CAAC,EACxC,IAAI,EACJ,aAAa,EACb,OAAO,GACR,EAAE,8BAA8B,GAAG,SAAS,CA4C5C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import {} from 'react';
|
|
3
|
+
import { Button } from '@endora-commerce/admin-kit/ui';
|
|
4
|
+
import { useTranslation } from '@endora-commerce/admin-kit/i18n';
|
|
5
|
+
export function ConfigurationPreviewModal({ open, configuration, onClose, }) {
|
|
6
|
+
const t = useTranslation('credentials');
|
|
7
|
+
if (!open || !configuration)
|
|
8
|
+
return null;
|
|
9
|
+
return (_jsx("div", { className: "fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4", role: "dialog", "aria-modal": "true", children: _jsxs("div", { className: "w-full max-w-md rounded-lg bg-background p-6 shadow-lg", children: [_jsx("h2", { className: "mb-1 text-lg font-semibold", children: t('preview.title') }), _jsxs("p", { className: "mb-4 text-sm text-muted-foreground", children: [configuration.name, " \u00B7 ", configuration.typeLabel ?? configuration.typeCode, " /", ' ', configuration.providerLabel ?? configuration.providerCode] }), configuration.inert ? (_jsx("p", { className: "mb-4 text-sm text-destructive", children: t('form.inert') })) : (_jsx("dl", { className: "space-y-2", children: configuration.fields.map((f) => (_jsxs("div", { className: "flex items-center justify-between gap-4 text-sm", children: [_jsx("dt", { className: "text-muted-foreground", children: f.key }), _jsx("dd", { className: "font-medium", children: f.secret
|
|
10
|
+
? f.isSet
|
|
11
|
+
? t('preview.secret')
|
|
12
|
+
: t('preview.notSet')
|
|
13
|
+
: String(f.value ?? '') })] }, f.key))) })), _jsx("div", { className: "mt-6 flex justify-end", children: _jsx(Button, { variant: "outline", onClick: onClose, children: t('action.cancel') }) })] }) }));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ConfigurationPreviewModal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfigurationPreviewModal.js","sourceRoot":"","sources":["../../src/admin-ui/ConfigurationPreviewModal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAcjE,MAAM,UAAU,yBAAyB,CAAC,EACxC,IAAI,EACJ,aAAa,EACb,OAAO,GACwB;IAC/B,MAAM,CAAC,GAAG,cAAc,CAAC,aAAa,CAAC,CAAC;IACxC,IAAI,CAAC,IAAI,IAAI,CAAC,aAAa;QAAE,OAAO,IAAI,CAAC;IAEzC,OAAO,CACL,cACE,SAAS,EAAC,qEAAqE,EAC/E,IAAI,EAAC,QAAQ,gBACF,MAAM,YAEjB,eAAK,SAAS,EAAC,wDAAwD,aACrE,aAAI,SAAS,EAAC,4BAA4B,YAAE,CAAC,CAAC,eAAe,CAAC,GAAM,EACpE,aAAG,SAAS,EAAC,oCAAoC,aAC9C,aAAa,CAAC,IAAI,cAAK,aAAa,CAAC,SAAS,IAAI,aAAa,CAAC,QAAQ,QAAI,GAAG,EAC/E,aAAa,CAAC,aAAa,IAAI,aAAa,CAAC,YAAY,IACxD,EAEH,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,CACrB,YAAG,SAAS,EAAC,+BAA+B,YAAE,CAAC,CAAC,YAAY,CAAC,GAAK,CACnE,CAAC,CAAC,CAAC,CACF,aAAI,SAAS,EAAC,WAAW,YACtB,aAAa,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAC/B,eAAiB,SAAS,EAAC,iDAAiD,aAC1E,aAAI,SAAS,EAAC,uBAAuB,YAAE,CAAC,CAAC,GAAG,GAAM,EAClD,aAAI,SAAS,EAAC,aAAa,YACxB,CAAC,CAAC,MAAM;oCACP,CAAC,CAAC,CAAC,CAAC,KAAK;wCACP,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC;wCACrB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC;oCACvB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,GACtB,KARG,CAAC,CAAC,GAAG,CAST,CACP,CAAC,GACC,CACN,EAED,cAAK,SAAS,EAAC,uBAAuB,YACpC,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,OAAO,YACvC,CAAC,CAAC,eAAe,CAAC,GACZ,GACL,IACF,GACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `credentials`' published component surface — D-191's `./admin-ui` exit,
|
|
3
|
+
* arriving with its first and only user (feature 091, Phase 4, batch 10;
|
|
4
|
+
* `contracts/admin-component-contribution.md` Z9…Z12, and R9 of
|
|
5
|
+
* `specs/084-small-f4-package-layout/contracts/module-package-layout.md`).
|
|
6
|
+
*
|
|
7
|
+
* ## Why this subpath exists at all, and why the kit was refused
|
|
8
|
+
*
|
|
9
|
+
* `settings`' `ConfigurationReferenceInput` — the editor for the
|
|
10
|
+
* `credential_ref` setting value type — renders this modal when the operator
|
|
11
|
+
* asks to see what a referenced configuration holds. The reach was
|
|
12
|
+
* `backend/scripts/ledgers/cross-module-imports/settings.ts`' only key, and
|
|
13
|
+
* `admin-component-contribution.md` Z1 decides its exit from the **signature**
|
|
14
|
+
* rather than from taste: `(open, configuration, onClose)` is a value in and a
|
|
15
|
+
* value back, which is Z1 question 1, so it is a **published component** and
|
|
16
|
+
* not a zone contribution. A zone has zero-or-many contributors and there is no
|
|
17
|
+
* honest answer for a modal that resolved to two `onClose`s.
|
|
18
|
+
*
|
|
19
|
+
* Z1.1 then asks the kit first, and the kit refuses this one: the modal calls
|
|
20
|
+
* `useTranslation('credentials')`, and R-1's §9.2 ruled that a module's
|
|
21
|
+
* translation namespace **is** module knowledge — the bundle behind it ships in
|
|
22
|
+
* a package `@endora-commerce/admin-kit` does not and may not depend on, is
|
|
23
|
+
* resolved at runtime by string, and a renamed key renders itself into the
|
|
24
|
+
* operator's screen as a label. Every string it shows is this module's
|
|
25
|
+
* vocabulary (*"Configuration preview"*, *"Set (hidden)"*, *"Unavailable —
|
|
26
|
+
* configuration type is no longer registered"*), so the R-1 remedy that
|
|
27
|
+
* retired `AssetPicker`, `AssetUploader` and `CategoryTreePicker` — move the
|
|
28
|
+
* copy to `core` and publish into the kit — would put credential vocabulary in
|
|
29
|
+
* the shared bundle. This is the one reach in the repository that takes the
|
|
30
|
+
* other exit, which is what `admin-component-contribution.md` §1.1 measured
|
|
31
|
+
* over all 69 ledgered admin reaches.
|
|
32
|
+
*
|
|
33
|
+
* ## The reach stays counted (Z11)
|
|
34
|
+
*
|
|
35
|
+
* `check:module-boundary`'s D-171 designation is derived from the artefact — a
|
|
36
|
+
* subpath is contract surface **iff** its emitted module exports no runtime
|
|
37
|
+
* binding — and this one exports a React component. So `settings`' ledger entry
|
|
38
|
+
* is **re-keyed, not retired**: the coupling is real, it now has a supported
|
|
39
|
+
* spelling, and a supported spelling is not an uncounted one. Do not widen that
|
|
40
|
+
* derivation for this subpath and do not add a field to the `endora` block;
|
|
41
|
+
* D-191 refuses both by name.
|
|
42
|
+
*
|
|
43
|
+
* ## Presence (Z12)
|
|
44
|
+
*
|
|
45
|
+
* A statically imported component is filtered by nothing, and `credentials`
|
|
46
|
+
* declares an activation control, so the **consumer** gates the render — see
|
|
47
|
+
* `useSurfaceVisibility()({ module: 'credentials' })` in
|
|
48
|
+
* `packages/modules/settings/src/admin/components/ConfigurationReferenceInput.tsx`.
|
|
49
|
+
* Gating here would be the wrong place: the component cannot know whether its
|
|
50
|
+
* absence should collapse the field or the whole row.
|
|
51
|
+
*
|
|
52
|
+
* **This entry re-exports and declares nothing of its own**, which is `./admin`
|
|
53
|
+
* R2's rule one directory over: the surface is the set of files listed here.
|
|
54
|
+
*/
|
|
55
|
+
export { ConfigurationPreviewModal } from './ConfigurationPreviewModal.js';
|
|
56
|
+
export type { ConfigurationPreviewModalProps } from './ConfigurationPreviewModal.js';
|
|
57
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin-ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,YAAY,EAAE,8BAA8B,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `credentials`' published component surface — D-191's `./admin-ui` exit,
|
|
3
|
+
* arriving with its first and only user (feature 091, Phase 4, batch 10;
|
|
4
|
+
* `contracts/admin-component-contribution.md` Z9…Z12, and R9 of
|
|
5
|
+
* `specs/084-small-f4-package-layout/contracts/module-package-layout.md`).
|
|
6
|
+
*
|
|
7
|
+
* ## Why this subpath exists at all, and why the kit was refused
|
|
8
|
+
*
|
|
9
|
+
* `settings`' `ConfigurationReferenceInput` — the editor for the
|
|
10
|
+
* `credential_ref` setting value type — renders this modal when the operator
|
|
11
|
+
* asks to see what a referenced configuration holds. The reach was
|
|
12
|
+
* `backend/scripts/ledgers/cross-module-imports/settings.ts`' only key, and
|
|
13
|
+
* `admin-component-contribution.md` Z1 decides its exit from the **signature**
|
|
14
|
+
* rather than from taste: `(open, configuration, onClose)` is a value in and a
|
|
15
|
+
* value back, which is Z1 question 1, so it is a **published component** and
|
|
16
|
+
* not a zone contribution. A zone has zero-or-many contributors and there is no
|
|
17
|
+
* honest answer for a modal that resolved to two `onClose`s.
|
|
18
|
+
*
|
|
19
|
+
* Z1.1 then asks the kit first, and the kit refuses this one: the modal calls
|
|
20
|
+
* `useTranslation('credentials')`, and R-1's §9.2 ruled that a module's
|
|
21
|
+
* translation namespace **is** module knowledge — the bundle behind it ships in
|
|
22
|
+
* a package `@endora-commerce/admin-kit` does not and may not depend on, is
|
|
23
|
+
* resolved at runtime by string, and a renamed key renders itself into the
|
|
24
|
+
* operator's screen as a label. Every string it shows is this module's
|
|
25
|
+
* vocabulary (*"Configuration preview"*, *"Set (hidden)"*, *"Unavailable —
|
|
26
|
+
* configuration type is no longer registered"*), so the R-1 remedy that
|
|
27
|
+
* retired `AssetPicker`, `AssetUploader` and `CategoryTreePicker` — move the
|
|
28
|
+
* copy to `core` and publish into the kit — would put credential vocabulary in
|
|
29
|
+
* the shared bundle. This is the one reach in the repository that takes the
|
|
30
|
+
* other exit, which is what `admin-component-contribution.md` §1.1 measured
|
|
31
|
+
* over all 69 ledgered admin reaches.
|
|
32
|
+
*
|
|
33
|
+
* ## The reach stays counted (Z11)
|
|
34
|
+
*
|
|
35
|
+
* `check:module-boundary`'s D-171 designation is derived from the artefact — a
|
|
36
|
+
* subpath is contract surface **iff** its emitted module exports no runtime
|
|
37
|
+
* binding — and this one exports a React component. So `settings`' ledger entry
|
|
38
|
+
* is **re-keyed, not retired**: the coupling is real, it now has a supported
|
|
39
|
+
* spelling, and a supported spelling is not an uncounted one. Do not widen that
|
|
40
|
+
* derivation for this subpath and do not add a field to the `endora` block;
|
|
41
|
+
* D-191 refuses both by name.
|
|
42
|
+
*
|
|
43
|
+
* ## Presence (Z12)
|
|
44
|
+
*
|
|
45
|
+
* A statically imported component is filtered by nothing, and `credentials`
|
|
46
|
+
* declares an activation control, so the **consumer** gates the render — see
|
|
47
|
+
* `useSurfaceVisibility()({ module: 'credentials' })` in
|
|
48
|
+
* `packages/modules/settings/src/admin/components/ConfigurationReferenceInput.tsx`.
|
|
49
|
+
* Gating here would be the wrong place: the component cannot know whether its
|
|
50
|
+
* absence should collapse the field or the whole row.
|
|
51
|
+
*
|
|
52
|
+
* **This entry re-exports and declares nothing of its own**, which is `./admin`
|
|
53
|
+
* R2's rule one directory over: the surface is the set of files listed here.
|
|
54
|
+
*/
|
|
55
|
+
export { ConfigurationPreviewModal } from './ConfigurationPreviewModal.js';
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin-ui/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type CreateConfiguration } from '@endora-commerce/contracts';
|
|
2
|
+
import type { Command } from '@endora-commerce/platform/commands';
|
|
3
|
+
import { CredentialConfiguration } from '../entities/credential-configuration.entity.js';
|
|
4
|
+
import type { ConfigurationTypeRegistry } from '../services/configuration-type-registry.js';
|
|
5
|
+
import { providerVariantFor } from '../services/field-validator.js';
|
|
6
|
+
/**
|
|
7
|
+
* `credential.create` (feature 058 US1, Principle XIII).
|
|
8
|
+
*
|
|
9
|
+
* Validates the submitted values against the selected type/provider descriptor,
|
|
10
|
+
* encrypts secret fields, and persists a new configuration. Secrets are redacted
|
|
11
|
+
* in the audit `after` state. Irreversible (undoing a secret change is
|
|
12
|
+
* high-risk).
|
|
13
|
+
*/
|
|
14
|
+
export declare function makeCreateConfigurationCommand(input: {
|
|
15
|
+
data: CreateConfiguration;
|
|
16
|
+
registry: ConfigurationTypeRegistry;
|
|
17
|
+
secretEncryptionKey: string | undefined;
|
|
18
|
+
}): Command<CredentialConfiguration>;
|
|
19
|
+
export { providerVariantFor };
|
|
20
|
+
//# sourceMappingURL=create-configuration.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-configuration.command.d.ts","sourceRoot":"","sources":["../../../src/backend/commands/create-configuration.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAElE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AACzF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAE5F,OAAO,EAEL,kBAAkB,EAEnB,MAAM,gCAAgC,CAAC;AAExC;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE;IACpD,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,EAAE,yBAAyB,CAAC;IACpC,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAkEnC;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ERROR_CODES } from '@endora-commerce/contracts';
|
|
2
|
+
import { HttpError } from '@endora-commerce/platform/http';
|
|
3
|
+
import { CredentialConfiguration } from '../entities/credential-configuration.entity.js';
|
|
4
|
+
import { ConfigurationTypeUnknown } from '../services/configuration-type-registry.js';
|
|
5
|
+
import { buildPersistableValues, providerVariantFor, redactSecretsForAudit, } from '../services/field-validator.js';
|
|
6
|
+
/**
|
|
7
|
+
* `credential.create` (feature 058 US1, Principle XIII).
|
|
8
|
+
*
|
|
9
|
+
* Validates the submitted values against the selected type/provider descriptor,
|
|
10
|
+
* encrypts secret fields, and persists a new configuration. Secrets are redacted
|
|
11
|
+
* in the audit `after` state. Irreversible (undoing a secret change is
|
|
12
|
+
* high-risk).
|
|
13
|
+
*/
|
|
14
|
+
export function makeCreateConfigurationCommand(input) {
|
|
15
|
+
const { data, registry, secretEncryptionKey } = input;
|
|
16
|
+
return {
|
|
17
|
+
action: 'credential.create',
|
|
18
|
+
objectType: 'credential_configuration',
|
|
19
|
+
objectId: data.code,
|
|
20
|
+
run: async ({ em }) => {
|
|
21
|
+
let descriptor;
|
|
22
|
+
try {
|
|
23
|
+
descriptor = registry.resolve(data.typeCode);
|
|
24
|
+
}
|
|
25
|
+
catch (err) {
|
|
26
|
+
if (err instanceof ConfigurationTypeUnknown) {
|
|
27
|
+
throw new HttpError(400, ERROR_CODES.CREDENTIAL_TYPE_UNKNOWN, `Unknown configuration type "${data.typeCode}".`);
|
|
28
|
+
}
|
|
29
|
+
throw err;
|
|
30
|
+
}
|
|
31
|
+
const variant = descriptor.providers.find((p) => p.code === data.providerCode);
|
|
32
|
+
if (!variant) {
|
|
33
|
+
throw new HttpError(400, ERROR_CODES.CREDENTIAL_TYPE_UNKNOWN, `Unknown provider "${data.providerCode}" for type "${data.typeCode}".`);
|
|
34
|
+
}
|
|
35
|
+
const existing = await em.findOne(CredentialConfiguration, { code: data.code });
|
|
36
|
+
if (existing) {
|
|
37
|
+
throw new HttpError(409, ERROR_CODES.CREDENTIAL_CODE_TAKEN, `Code "${data.code}" is already in use.`);
|
|
38
|
+
}
|
|
39
|
+
const { values, errors } = buildPersistableValues({
|
|
40
|
+
fields: variant.fields,
|
|
41
|
+
submitted: data.values,
|
|
42
|
+
existing: {},
|
|
43
|
+
secretEncryptionKey,
|
|
44
|
+
});
|
|
45
|
+
if (errors.length > 0) {
|
|
46
|
+
throw new HttpError(422, ERROR_CODES.CREDENTIAL_VALIDATION_FAILED, 'Some fields are invalid.', errors.map((e) => ({ path: e.field, issue: e.message })));
|
|
47
|
+
}
|
|
48
|
+
const entity = em.create(CredentialConfiguration, {
|
|
49
|
+
code: data.code,
|
|
50
|
+
name: data.name,
|
|
51
|
+
typeCode: data.typeCode,
|
|
52
|
+
providerCode: data.providerCode,
|
|
53
|
+
values,
|
|
54
|
+
});
|
|
55
|
+
await em.persistAndFlush(entity);
|
|
56
|
+
return {
|
|
57
|
+
result: entity,
|
|
58
|
+
after: {
|
|
59
|
+
code: entity.code,
|
|
60
|
+
name: entity.name,
|
|
61
|
+
typeCode: entity.typeCode,
|
|
62
|
+
providerCode: entity.providerCode,
|
|
63
|
+
values: redactSecretsForAudit(values, variant.fields),
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export { providerVariantFor };
|
|
70
|
+
//# sourceMappingURL=create-configuration.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-configuration.command.js","sourceRoot":"","sources":["../../../src/backend/commands/create-configuration.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA4B,MAAM,4BAA4B,CAAC;AAEnF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAEzF,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AACtF,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,gCAAgC,CAAC;AAExC;;;;;;;GAOG;AACH,MAAM,UAAU,8BAA8B,CAAC,KAI9C;IACC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC;IACtD,OAAO;QACL,MAAM,EAAE,mBAAmB;QAC3B,UAAU,EAAE,0BAA0B;QACtC,QAAQ,EAAE,IAAI,CAAC,IAAI;QACnB,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;YACpB,IAAI,UAAU,CAAC;YACf,IAAI,CAAC;gBACH,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;YAC/C,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,IAAI,GAAG,YAAY,wBAA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EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CACzD,CAAC;YACJ,CAAC;YAED,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM,CAAC,uBAAuB,EAAE;gBAChD,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,YAAY,EAAE,IAAI,CAAC,YAAY;gBAC/B,MAAM;aACP,CAAC,CAAC;YACH,MAAM,EAAE,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;YAEjC,OAAO;gBACL,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE;oBACL,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,YAAY,EAAE,MAAM,CAAC,YAAY;oBACjC,MAAM,EAAE,qBAAqB,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC;iBACtD;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Command } from '@endora-commerce/platform/commands';
|
|
2
|
+
import type { ConfigurationTypeRegistry } from '../services/configuration-type-registry.js';
|
|
3
|
+
/**
|
|
4
|
+
* `credential.delete` (feature 058 US1, Principle XIII).
|
|
5
|
+
*
|
|
6
|
+
* Unconditional delete for US1 — the referencing-setting guard (`CREDENTIAL_IN_USE`)
|
|
7
|
+
* is added in US2 (T043). Captures the before-state with secrets redacted.
|
|
8
|
+
* Irreversible.
|
|
9
|
+
*/
|
|
10
|
+
export declare function makeDeleteConfigurationCommand(input: {
|
|
11
|
+
code: string;
|
|
12
|
+
registry: ConfigurationTypeRegistry;
|
|
13
|
+
}): Command<{
|
|
14
|
+
code: string;
|
|
15
|
+
}>;
|
|
16
|
+
//# sourceMappingURL=delete-configuration.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-configuration.command.d.ts","sourceRoot":"","sources":["../../../src/backend/commands/delete-configuration.command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAG9E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAG5F;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,yBAAyB,CAAC;CACrC,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAoC5B"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ERROR_CODES } from '@endora-commerce/contracts';
|
|
2
|
+
import { HttpError } from '@endora-commerce/platform/http';
|
|
3
|
+
import { CredentialConfiguration } from '../entities/credential-configuration.entity.js';
|
|
4
|
+
import { redactSecretsForAudit } from '../services/field-validator.js';
|
|
5
|
+
/**
|
|
6
|
+
* `credential.delete` (feature 058 US1, Principle XIII).
|
|
7
|
+
*
|
|
8
|
+
* Unconditional delete for US1 — the referencing-setting guard (`CREDENTIAL_IN_USE`)
|
|
9
|
+
* is added in US2 (T043). Captures the before-state with secrets redacted.
|
|
10
|
+
* Irreversible.
|
|
11
|
+
*/
|
|
12
|
+
export function makeDeleteConfigurationCommand(input) {
|
|
13
|
+
const { code, registry } = input;
|
|
14
|
+
// The registry's diagnostic read (issue #129): the audit snapshot has to know
|
|
15
|
+
// which value was a secret whatever the contributing module's state, or a
|
|
16
|
+
// deletion while that module is off records the credential without recording
|
|
17
|
+
// that it held one.
|
|
18
|
+
const variantFields = (entity) => {
|
|
19
|
+
const descriptor = registry.entry(entity.typeCode);
|
|
20
|
+
return descriptor?.providers.find((p) => p.code === entity.providerCode)?.fields ?? [];
|
|
21
|
+
};
|
|
22
|
+
return {
|
|
23
|
+
action: 'credential.delete',
|
|
24
|
+
objectType: 'credential_configuration',
|
|
25
|
+
objectId: code,
|
|
26
|
+
capture: async ({ em }) => {
|
|
27
|
+
const entity = await em.findOne(CredentialConfiguration, { code });
|
|
28
|
+
if (!entity)
|
|
29
|
+
return null;
|
|
30
|
+
return {
|
|
31
|
+
code: entity.code,
|
|
32
|
+
name: entity.name,
|
|
33
|
+
typeCode: entity.typeCode,
|
|
34
|
+
providerCode: entity.providerCode,
|
|
35
|
+
values: redactSecretsForAudit(entity.values, variantFields(entity)),
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
run: async ({ em }) => {
|
|
39
|
+
const entity = await em.findOne(CredentialConfiguration, { code });
|
|
40
|
+
if (!entity) {
|
|
41
|
+
throw new HttpError(404, ERROR_CODES.CREDENTIAL_NOT_FOUND, `Configuration "${code}" not found.`);
|
|
42
|
+
}
|
|
43
|
+
await em.removeAndFlush(entity);
|
|
44
|
+
return { result: { code }, after: null };
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=delete-configuration.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-configuration.command.js","sourceRoot":"","sources":["../../../src/backend/commands/delete-configuration.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAEzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,UAAU,8BAA8B,CAAC,KAG9C;IACC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAEjC,8EAA8E;IAC9E,0EAA0E;IAC1E,6EAA6E;IAC7E,oBAAoB;IACpB,MAAM,aAAa,GAAG,CAAC,M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EAAE,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAC3C,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type UpdateConfiguration } from '@endora-commerce/contracts';
|
|
2
|
+
import type { Command } from '@endora-commerce/platform/commands';
|
|
3
|
+
import { CredentialConfiguration } from '../entities/credential-configuration.entity.js';
|
|
4
|
+
import type { ConfigurationTypeRegistry } from '../services/configuration-type-registry.js';
|
|
5
|
+
/**
|
|
6
|
+
* `credential.update` (feature 058 US1, Principle XIII).
|
|
7
|
+
*
|
|
8
|
+
* Write-only secret preservation: a secret submitted blank / omitted / equal to
|
|
9
|
+
* the `[redacted]` mask keeps the stored envelope; a non-empty secret is
|
|
10
|
+
* re-encrypted. `typeCode`/`providerCode` are immutable (rejected upstream in
|
|
11
|
+
* the route). Honors `expectedVersion` (optimistic lock). Secrets redacted in
|
|
12
|
+
* both audit states. Irreversible.
|
|
13
|
+
*/
|
|
14
|
+
export declare function makeUpdateConfigurationCommand(input: {
|
|
15
|
+
code: string;
|
|
16
|
+
data: UpdateConfiguration;
|
|
17
|
+
registry: ConfigurationTypeRegistry;
|
|
18
|
+
secretEncryptionKey: string | undefined;
|
|
19
|
+
}): Command<CredentialConfiguration>;
|
|
20
|
+
//# sourceMappingURL=update-configuration.command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-configuration.command.d.ts","sourceRoot":"","sources":["../../../src/backend/commands/update-configuration.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACnF,OAAO,KAAK,EAAc,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAG9E,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AACzF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAM5F;;;;;;;;GAQG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,mBAAmB,CAAC;IAC1B,QAAQ,EAAE,yBAAyB,CAAC;IACpC,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAkGnC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { ERROR_CODES } from '@endora-commerce/contracts';
|
|
2
|
+
import { HttpError } from '@endora-commerce/platform/http';
|
|
3
|
+
import { ModuleDisabledError } from '@endora-commerce/platform/kernel';
|
|
4
|
+
import { CredentialConfiguration } from '../entities/credential-configuration.entity.js';
|
|
5
|
+
import { buildPersistableValues, redactSecretsForAudit, } from '../services/field-validator.js';
|
|
6
|
+
/**
|
|
7
|
+
* `credential.update` (feature 058 US1, Principle XIII).
|
|
8
|
+
*
|
|
9
|
+
* Write-only secret preservation: a secret submitted blank / omitted / equal to
|
|
10
|
+
* the `[redacted]` mask keeps the stored envelope; a non-empty secret is
|
|
11
|
+
* re-encrypted. `typeCode`/`providerCode` are immutable (rejected upstream in
|
|
12
|
+
* the route). Honors `expectedVersion` (optimistic lock). Secrets redacted in
|
|
13
|
+
* both audit states. Irreversible.
|
|
14
|
+
*/
|
|
15
|
+
export function makeUpdateConfigurationCommand(input) {
|
|
16
|
+
const { code, data, registry, secretEncryptionKey } = input;
|
|
17
|
+
// The registry's diagnostic read (issue #129), for the same reason as in the
|
|
18
|
+
// delete command: an audit snapshot must know which value was a secret
|
|
19
|
+
// whatever the contributing module's state. The write itself reads the acting
|
|
20
|
+
// side and refuses — see `run`.
|
|
21
|
+
const loadVariantFields = (entity) => {
|
|
22
|
+
const descriptor = registry.entry(entity.typeCode);
|
|
23
|
+
const variant = descriptor?.providers.find((p) => p.code === entity.providerCode);
|
|
24
|
+
return variant?.fields ?? [];
|
|
25
|
+
};
|
|
26
|
+
return {
|
|
27
|
+
action: 'credential.update',
|
|
28
|
+
objectType: 'credential_configuration',
|
|
29
|
+
objectId: code,
|
|
30
|
+
capture: async ({ em }) => {
|
|
31
|
+
const entity = await em.findOne(CredentialConfiguration, { code });
|
|
32
|
+
if (!entity)
|
|
33
|
+
return null;
|
|
34
|
+
return {
|
|
35
|
+
code: entity.code,
|
|
36
|
+
name: entity.name,
|
|
37
|
+
typeCode: entity.typeCode,
|
|
38
|
+
providerCode: entity.providerCode,
|
|
39
|
+
values: redactSecretsForAudit(entity.values, loadVariantFields(entity)),
|
|
40
|
+
};
|
|
41
|
+
},
|
|
42
|
+
run: async ({ em }) => {
|
|
43
|
+
const entity = await em.findOne(CredentialConfiguration, { code });
|
|
44
|
+
if (!entity) {
|
|
45
|
+
throw new HttpError(404, ERROR_CODES.CREDENTIAL_NOT_FOUND, `Configuration "${code}" not found.`);
|
|
46
|
+
}
|
|
47
|
+
if (data.expectedVersion !== undefined && entity.version !== data.expectedVersion) {
|
|
48
|
+
throw new HttpError(409, ERROR_CODES.VERSION_CONFLICT, 'The configuration was modified by someone else. Reload and try again.');
|
|
49
|
+
}
|
|
50
|
+
// The acting read, and the two "no descriptor" answers kept apart: a type
|
|
51
|
+
// nobody registers is the inert row FR-016 describes, while a type whose
|
|
52
|
+
// contributing module is switched off comes straight back with that module
|
|
53
|
+
// — so it refuses with the 503 envelope naming it, rather than telling an
|
|
54
|
+
// operator their configuration has lost its type.
|
|
55
|
+
const owner = registry.ownerOf(entity.typeCode);
|
|
56
|
+
if (owner !== null && !registry.isAvailable(entity.typeCode)) {
|
|
57
|
+
throw new ModuleDisabledError(owner);
|
|
58
|
+
}
|
|
59
|
+
const descriptor = registry.get(entity.typeCode);
|
|
60
|
+
const variant = descriptor?.providers.find((p) => p.code === entity.providerCode);
|
|
61
|
+
if (!variant) {
|
|
62
|
+
// Inert: the type/provider is no longer registered — refuse to edit
|
|
63
|
+
// rather than validate against an unknown shape (FR-016).
|
|
64
|
+
throw new HttpError(400, ERROR_CODES.CREDENTIAL_TYPE_UNKNOWN, `Configuration type "${entity.typeCode}" is no longer registered.`);
|
|
65
|
+
}
|
|
66
|
+
if (data.name !== undefined)
|
|
67
|
+
entity.name = data.name;
|
|
68
|
+
if (data.values !== undefined) {
|
|
69
|
+
const { values, errors } = buildPersistableValues({
|
|
70
|
+
fields: variant.fields,
|
|
71
|
+
submitted: data.values,
|
|
72
|
+
existing: entity.values,
|
|
73
|
+
secretEncryptionKey,
|
|
74
|
+
});
|
|
75
|
+
if (errors.length > 0) {
|
|
76
|
+
throw new HttpError(422, ERROR_CODES.CREDENTIAL_VALIDATION_FAILED, 'Some fields are invalid.', errors.map((e) => ({ path: e.field, issue: e.message })));
|
|
77
|
+
}
|
|
78
|
+
entity.values = values;
|
|
79
|
+
}
|
|
80
|
+
await em.flush();
|
|
81
|
+
return {
|
|
82
|
+
result: entity,
|
|
83
|
+
after: {
|
|
84
|
+
code: entity.code,
|
|
85
|
+
name: entity.name,
|
|
86
|
+
typeCode: entity.typeCode,
|
|
87
|
+
providerCode: entity.providerCode,
|
|
88
|
+
values: redactSecretsForAudit(entity.values, variant.fields),
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=update-configuration.command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-configuration.command.js","sourceRoot":"","sources":["../../../src/backend/commands/update-configuration.command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAA4B,MAAM,4BAA4B,CAAC;AAEnF,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAEzF,OAAO,EACL,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,gCAAgC,CAAC;AAExC;;;;;;;;GAQG;AACH,MAAM,UAAU,8BAA8B,CAAC,KAK9C;IAC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AE,CAAC;gBAC9B,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,sBAAsB,CAAC;oBAChD,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,SAAS,EAAE,IAAI,CAAC,MAAM;oBACtB,QAAQ,EAAE,MAAM,CAAC,MAAM;oBACvB,mBAAmB;iBACpB,CAAC,CAAC;gBACH,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACtB,MAAM,IAAI,SAAS,CACjB,GAAG,EACH,WAAW,CAAC,4BAA4B,EACxC,0BAA0B,EAC1B,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CACzD,CAAC;gBACJ,CAAC;gBACD,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;YACzB,CAAC;YAED,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;YAEjB,OAAO;gBACL,MAAM,EAAE,MAAM;gBACd,KAAK,EAAE;oBACL,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,IAAI,EAAE,MAAM,CAAC,IAAI;oBACjB,QAAQ,EAAE,MAAM,CAAC,QAAQ;oBACzB,YAAY,EAAE,MAAM,CAAC,YAAY;oBACjC,MAAM,EAAE,qBAAqB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC;iBAC7D;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { OptionalProps } from '@mikro-orm/core';
|
|
2
|
+
/**
|
|
3
|
+
* CredentialConfiguration — feature 058 / data-model.md §1.
|
|
4
|
+
*
|
|
5
|
+
* A reusable, named instance of a code-registered configuration type (e.g.
|
|
6
|
+
* `llm`, `email_adapter`). The credentials core is type-agnostic: `typeCode` /
|
|
7
|
+
* `providerCode` are resolved against the in-process `ConfigurationTypeRegistry`
|
|
8
|
+
* at read/write time, never enforced by DB constraints.
|
|
9
|
+
*
|
|
10
|
+
* Platform-global (`@GlobalEntity()`, Principle XI) — like `SettingValue`, this
|
|
11
|
+
* carries no tenant key and is administered platform-wide.
|
|
12
|
+
*
|
|
13
|
+
* `values` is a field-value bag keyed by `FieldDefinition.key`: secret fields
|
|
14
|
+
* hold AES-256-GCM envelopes (`{ v, alg, iv, ct, tag }`), non-secret fields hold
|
|
15
|
+
* plain JSON scalars. `version` powers the optimistic lock guarding concurrent
|
|
16
|
+
* edits.
|
|
17
|
+
*/
|
|
18
|
+
export declare class CredentialConfiguration {
|
|
19
|
+
[OptionalProps]?: 'id' | 'version' | 'createdAt' | 'updatedAt';
|
|
20
|
+
id: string;
|
|
21
|
+
code: string;
|
|
22
|
+
name: string;
|
|
23
|
+
typeCode: string;
|
|
24
|
+
providerCode: string;
|
|
25
|
+
values: Record<string, unknown>;
|
|
26
|
+
version: number;
|
|
27
|
+
createdAt: Date;
|
|
28
|
+
updatedAt: Date;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=credential-configuration.entity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-configuration.entity.d.ts","sourceRoot":"","sources":["../../../src/backend/entities/credential-configuration.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAgC,MAAM,iBAAiB,CAAC;AAI7F;;;;;;;;;;;;;;;GAeG;AACH,qBAEa,uBAAuB;IAClC,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,WAAW,GAAG,WAAW,CAAC;IAG/D,EAAE,EAAE,MAAM,CAAgB;IAI1B,IAAI,EAAG,MAAM,CAAC;IAGd,IAAI,EAAG,MAAM,CAAC;IAId,QAAQ,EAAG,MAAM,CAAC;IAGlB,YAAY,EAAG,MAAM,CAAC;IAGtB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAM;IAGrC,OAAO,EAAG,MAAM,CAAC;IAGjB,SAAS,EAAE,IAAI,CAAc;IAG7B,SAAS,EAAE,IAAI,CAAc;CAC9B"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Entity, Index, OptionalProps, PrimaryKey, Property, Unique } from '@mikro-orm/core';
|
|
11
|
+
import { randomUUID } from 'crypto';
|
|
12
|
+
import { GlobalEntity } from '@endora-commerce/platform/tenancy';
|
|
13
|
+
/**
|
|
14
|
+
* CredentialConfiguration — feature 058 / data-model.md §1.
|
|
15
|
+
*
|
|
16
|
+
* A reusable, named instance of a code-registered configuration type (e.g.
|
|
17
|
+
* `llm`, `email_adapter`). The credentials core is type-agnostic: `typeCode` /
|
|
18
|
+
* `providerCode` are resolved against the in-process `ConfigurationTypeRegistry`
|
|
19
|
+
* at read/write time, never enforced by DB constraints.
|
|
20
|
+
*
|
|
21
|
+
* Platform-global (`@GlobalEntity()`, Principle XI) — like `SettingValue`, this
|
|
22
|
+
* carries no tenant key and is administered platform-wide.
|
|
23
|
+
*
|
|
24
|
+
* `values` is a field-value bag keyed by `FieldDefinition.key`: secret fields
|
|
25
|
+
* hold AES-256-GCM envelopes (`{ v, alg, iv, ct, tag }`), non-secret fields hold
|
|
26
|
+
* plain JSON scalars. `version` powers the optimistic lock guarding concurrent
|
|
27
|
+
* edits.
|
|
28
|
+
*/
|
|
29
|
+
let CredentialConfiguration = class CredentialConfiguration {
|
|
30
|
+
[OptionalProps];
|
|
31
|
+
id = randomUUID();
|
|
32
|
+
code;
|
|
33
|
+
name;
|
|
34
|
+
typeCode;
|
|
35
|
+
providerCode;
|
|
36
|
+
values = {};
|
|
37
|
+
version;
|
|
38
|
+
createdAt = new Date();
|
|
39
|
+
updatedAt = new Date();
|
|
40
|
+
};
|
|
41
|
+
__decorate([
|
|
42
|
+
PrimaryKey({ type: 'uuid' }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], CredentialConfiguration.prototype, "id", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
Property({ type: 'varchar', length: 128, fieldName: 'code' }),
|
|
47
|
+
Unique(),
|
|
48
|
+
__metadata("design:type", String)
|
|
49
|
+
], CredentialConfiguration.prototype, "code", void 0);
|
|
50
|
+
__decorate([
|
|
51
|
+
Property({ type: 'varchar', length: 255, fieldName: 'name' }),
|
|
52
|
+
__metadata("design:type", String)
|
|
53
|
+
], CredentialConfiguration.prototype, "name", void 0);
|
|
54
|
+
__decorate([
|
|
55
|
+
Property({ type: 'varchar', length: 64, fieldName: 'type_code' }),
|
|
56
|
+
Index(),
|
|
57
|
+
__metadata("design:type", String)
|
|
58
|
+
], CredentialConfiguration.prototype, "typeCode", void 0);
|
|
59
|
+
__decorate([
|
|
60
|
+
Property({ type: 'varchar', length: 64, fieldName: 'provider_code' }),
|
|
61
|
+
__metadata("design:type", String)
|
|
62
|
+
], CredentialConfiguration.prototype, "providerCode", void 0);
|
|
63
|
+
__decorate([
|
|
64
|
+
Property({ type: 'json', fieldName: 'values' }),
|
|
65
|
+
__metadata("design:type", Object)
|
|
66
|
+
], CredentialConfiguration.prototype, "values", void 0);
|
|
67
|
+
__decorate([
|
|
68
|
+
Property({ type: 'integer', version: true, fieldName: 'version' }),
|
|
69
|
+
__metadata("design:type", Number)
|
|
70
|
+
], CredentialConfiguration.prototype, "version", void 0);
|
|
71
|
+
__decorate([
|
|
72
|
+
Property({ type: 'datetime', onCreate: () => new Date(), fieldName: 'created_at' }),
|
|
73
|
+
__metadata("design:type", Date)
|
|
74
|
+
], CredentialConfiguration.prototype, "createdAt", void 0);
|
|
75
|
+
__decorate([
|
|
76
|
+
Property({ type: 'datetime', onCreate: () => new Date(), onUpdate: () => new Date(), fieldName: 'updated_at' }),
|
|
77
|
+
__metadata("design:type", Date)
|
|
78
|
+
], CredentialConfiguration.prototype, "updatedAt", void 0);
|
|
79
|
+
CredentialConfiguration = __decorate([
|
|
80
|
+
GlobalEntity(),
|
|
81
|
+
Entity({ tableName: 'credential_configurations' })
|
|
82
|
+
], CredentialConfiguration);
|
|
83
|
+
export { CredentialConfiguration };
|
|
84
|
+
//# sourceMappingURL=credential-configuration.entity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-configuration.entity.js","sourceRoot":"","sources":["../../../src/backend/entities/credential-configuration.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE;;;;;;;;;;;;;;;GAeG;AAGI,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAClC,CAAC,aAAa,CAAC,CAAgD;IAG/D,EAAE,GAAW,UAAU,EAAE,CAAC;IAI1B,IAAI,CAAU;IAGd,IAAI,CAAU;IAId,QAAQ,CAAU;IAGlB,YAAY,CAAU;IAGtB,MAAM,GAA4B,EAAE,CAAC;IAGrC,OAAO,CAAU;IAGjB,SAAS,GAAS,I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