@cosmicdrift/kumiko-samples 0.422.0 → 0.424.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/packages/bundled-features/package.json +11 -1
- package/packages/bundled-features/src/auth-email-password/handlers/login.write.ts +52 -0
- package/packages/bundled-features/src/auth-email-password/index.ts +4 -0
- package/packages/bundled-features/src/channel-push/changes.json +8 -1
- package/packages/bundled-features/src/channel-push/push-channel.ts +2 -3
- package/packages/bundled-features/src/document-draft/README.md +84 -0
- package/packages/bundled-features/src/document-draft/changes.json +8 -0
- package/packages/bundled-features/src/document-draft/entity.ts +125 -0
- package/packages/bundled-features/src/document-draft/feature.ts +56 -0
- package/packages/bundled-features/src/document-draft/handlers/blocks.query.ts +63 -0
- package/packages/bundled-features/src/document-draft/handlers/by-subject.query.ts +50 -0
- package/packages/bundled-features/src/document-draft/handlers/create.write.ts +110 -0
- package/packages/bundled-features/src/document-draft/handlers/discard.write.ts +32 -0
- package/packages/bundled-features/src/document-draft/handlers/finalize.write.ts +103 -0
- package/packages/bundled-features/src/document-draft/handlers/patch.write.ts +86 -0
- package/packages/bundled-features/src/document-draft/handlers/revise.write.ts +46 -0
- package/packages/bundled-features/src/document-draft/handlers/save.write.ts +53 -0
- package/packages/bundled-features/src/document-draft/i18n.ts +22 -0
- package/packages/bundled-features/src/document-draft/index.ts +21 -0
- package/packages/bundled-features/src/document-draft/lib.ts +77 -0
- package/packages/bundled-features/src/document-draft/options.ts +51 -0
- package/packages/bundled-features/src/document-draft/payloads.ts +45 -0
- package/packages/bundled-features/src/document-draft/screens/editor-screen.ts +17 -0
- package/packages/bundled-features/src/document-draft/user-data.ts +63 -0
- package/packages/bundled-features/src/document-draft/web/client-plugin.tsx +20 -0
- package/packages/bundled-features/src/document-draft/web/constants.ts +56 -0
- package/packages/bundled-features/src/document-draft/web/editor-screen.tsx +418 -0
- package/packages/bundled-features/src/document-draft/web/i18n.ts +54 -0
- package/packages/bundled-features/src/document-draft/web/index.ts +14 -0
- package/packages/bundled-features/src/helpdesk/changes.json +6 -0
- package/packages/bundled-features/src/shared/index.ts +6 -0
- package/packages/bundled-features/src/{signature → shared}/subject-scope.ts +17 -6
- package/packages/bundled-features/src/signature/changes.json +6 -0
- package/packages/bundled-features/src/signature/feature.ts +1 -1
- package/packages/bundled-features/src/signature/handlers/cancel.write.ts +1 -1
- package/packages/bundled-features/src/signature/handlers/issue-link.write.ts +1 -1
- package/packages/bundled-features/src/signature/handlers/request.write.ts +1 -1
- package/packages/bundled-features/src/signature/handlers/revoke-link.write.ts +1 -1
- package/packages/bundled-features/src/signature/handlers/sign-in-person.write.ts +1 -1
- package/packages/bundled-features/src/signature/options.ts +2 -1
- package/packages/bundled-features/src/signature/subject-queries.ts +1 -1
- package/packages/bundled-features/src/template-resolver/api.ts +3 -1
- package/packages/bundled-features/src/template-resolver/boot-rules.ts +5 -0
- package/packages/bundled-features/src/template-resolver/changes.json +30 -0
- package/packages/bundled-features/src/template-resolver/feature.ts +15 -1
- package/packages/bundled-features/src/template-resolver/handlers/create-variant.write.ts +134 -0
- package/packages/bundled-features/src/template-resolver/handlers/document-base.ts +3 -0
- package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +44 -1
- package/packages/bundled-features/src/template-resolver/handlers/patch-draft.write.ts +12 -1
- package/packages/bundled-features/src/template-resolver/handlers/template-write.ts +111 -11
- package/packages/bundled-features/src/template-resolver/handlers/toggle-status.write.ts +29 -4
- package/packages/bundled-features/src/template-resolver/handlers/upsert-tenant.write.ts +1 -0
- package/packages/bundled-features/src/template-resolver/handlers/variants.query.ts +89 -0
- package/packages/bundled-features/src/template-resolver/i18n.ts +1 -0
- package/packages/bundled-features/src/template-resolver/index.ts +22 -0
- package/packages/bundled-features/src/template-resolver/seeding.ts +16 -1
- package/packages/bundled-features/src/template-resolver/template-delivery-policy.ts +56 -6
- package/packages/bundled-features/src/template-resolver/template-edit-policy.ts +5 -5
- package/packages/bundled-features/src/template-resolver/template-meta.ts +1 -0
- package/packages/bundled-features/src/template-resolver/template-variants.ts +50 -0
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-content.tsx +10 -1
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-toolbar.tsx +10 -4
- package/packages/bundled-features/src/template-resolver/web/i18n.ts +26 -0
- package/packages/bundled-features/src/template-resolver/web/index.ts +5 -0
- package/packages/bundled-features/src/template-resolver/web/qualified-names.ts +5 -0
- package/packages/bundled-features/src/template-resolver/web/system-placeholders.ts +17 -0
- package/packages/bundled-features/src/tenant/changes.json +7 -0
- package/packages/bundled-features/src/tenant/handlers/update-member-roles.write.ts +1 -1
- package/packages/bundled-features/src/tenant/i18n.ts +0 -1
- package/packages/bundled-features/src/tenant-inactivity/changes.json +7 -0
- package/packages/bundled-features/src/tenant-inactivity/constants.ts +1 -1
- package/packages/bundled-features/src/tenant-lifecycle/changes.json +7 -0
- package/packages/bundled-features/src/tenant-lifecycle/constants.ts +1 -1
- package/samples/apps/ui-walkthrough/src/run-config.ts +1 -0
- package/samples/apps/use-all-bundled/feature-manifest.json +37 -1
- package/samples/apps/use-all-bundled/kumiko/migrations/0069_document-draft.rebuild.json +4 -0
- package/samples/apps/use-all-bundled/src/app/client.tsx +3 -0
- package/samples/apps/use-all-bundled/src/run-config.ts +8 -0
- package/samples/recipes/session-exchange/README.md +34 -0
- package/samples/recipes/session-exchange/package.json +12 -0
- package/samples/recipes/session-exchange/src/feature.ts +54 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-samples",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.424.1",
|
|
4
4
|
"description": "Source trees of the Kumiko sample recipes, sample apps and bundled features in repo layout, for tooling such as few-shot corpus builds.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-bundled-features",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.424.1",
|
|
4
4
|
"description": "Built-in features — tenant, user, auth, delivery. The stuff you'd rewrite anyway, already typed.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -169,6 +169,8 @@
|
|
|
169
169
|
"./waitlist/static-submit": "./src/waitlist/static-submit.ts",
|
|
170
170
|
"./signature": "./src/signature/index.ts",
|
|
171
171
|
"./signature/web": "./src/signature/web/index.ts",
|
|
172
|
+
"./document-draft": "./src/document-draft/index.ts",
|
|
173
|
+
"./document-draft/web": "./src/document-draft/web/index.ts",
|
|
172
174
|
"./signature/static-sign": "./src/signature/static-sign.ts",
|
|
173
175
|
"./handbook-knowledge": "./src/handbook-knowledge/index.ts",
|
|
174
176
|
"./page-render": "./src/page-render/index.ts",
|
|
@@ -808,6 +810,14 @@
|
|
|
808
810
|
"types": "./dist/signature/web/index.d.ts",
|
|
809
811
|
"default": "./dist/signature/web/index.js"
|
|
810
812
|
},
|
|
813
|
+
"./document-draft": {
|
|
814
|
+
"types": "./dist/document-draft/index.d.ts",
|
|
815
|
+
"default": "./dist/document-draft/index.js"
|
|
816
|
+
},
|
|
817
|
+
"./document-draft/web": {
|
|
818
|
+
"types": "./dist/document-draft/web/index.d.ts",
|
|
819
|
+
"default": "./dist/document-draft/web/index.js"
|
|
820
|
+
},
|
|
811
821
|
"./signature/static-sign": {
|
|
812
822
|
"types": "./dist/signature/static-sign.d.ts",
|
|
813
823
|
"default": "./dist/signature/static-sign.js"
|
|
@@ -76,6 +76,8 @@ export type LoginResult =
|
|
|
76
76
|
|
|
77
77
|
type Membership = { readonly tenantId: TenantId; readonly roles: readonly string[] };
|
|
78
78
|
|
|
79
|
+
const MembershipList = z.array(z.object({ tenantId: z.string(), roles: z.array(z.string()) }));
|
|
80
|
+
|
|
79
81
|
// result is always a WriteFailure at construction (every reject() call site
|
|
80
82
|
// passes one) — typing it that way, not WriteResult<LoginResult>, lets other
|
|
81
83
|
// handlers with a different success-data type reuse these gates unchanged.
|
|
@@ -286,6 +288,56 @@ export async function gateBuildSession(
|
|
|
286
288
|
return { kind: "auth-session", session };
|
|
287
289
|
}
|
|
288
290
|
|
|
291
|
+
export type VerifiedUserLookup = { readonly email: string } | { readonly userId: string };
|
|
292
|
+
|
|
293
|
+
// Login gate chain AFTER an app-defined method (ID token, email code) proved
|
|
294
|
+
// the identity: account status, membership choice, claims. No password or
|
|
295
|
+
// lockout gate. A lookup by email requires a verified address,
|
|
296
|
+
// otherwise an attacker who pre-registered the victim's email with a known
|
|
297
|
+
// password would share the account the victim later reaches via this method.
|
|
298
|
+
// A lookup by userId trusts that the app linked the identity itself. There is
|
|
299
|
+
// no MFA gate: boot refuses to combine auth-mfa with sessionExchangeHandlers.
|
|
300
|
+
export async function sessionForVerifiedUser(
|
|
301
|
+
ctx: HandlerContext,
|
|
302
|
+
lookup: VerifiedUserLookup,
|
|
303
|
+
): Promise<WriteResult<{ readonly kind: "auth-session"; readonly session: SessionUser }>> {
|
|
304
|
+
const systemUser = createSystemUser(SYSTEM_USER_ID);
|
|
305
|
+
const found = parseAuthUserRow(
|
|
306
|
+
await ctx.dispatch.queryAs(
|
|
307
|
+
systemUser,
|
|
308
|
+
UserQueries.findForAuth,
|
|
309
|
+
"email" in lookup ? { email: lookup.email } : { id: lookup.userId },
|
|
310
|
+
),
|
|
311
|
+
);
|
|
312
|
+
if (!found || found.isDeleted) return invalidCredentials();
|
|
313
|
+
|
|
314
|
+
if ("email" in lookup) {
|
|
315
|
+
const emailGate = gateEnforceEmailVerified(found, true);
|
|
316
|
+
if (!emailGate.ok) return emailGate.result;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const statusGate = gateEnforceAccountStatus(found);
|
|
320
|
+
if (!statusGate.ok) return statusGate.result;
|
|
321
|
+
|
|
322
|
+
const memberships = MembershipList.parse(
|
|
323
|
+
await ctx.dispatch.queryAs(systemUser, TENANT_MEMBERSHIPS_QUERY, { userId: found.id }),
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
const membershipGate = await gateResolveMembership(ctx, found, memberships);
|
|
327
|
+
if (!membershipGate.ok) return membershipGate.result;
|
|
328
|
+
const { chosen, mergedRoles } = membershipGate.value;
|
|
329
|
+
|
|
330
|
+
const session = await gateBuildSession(
|
|
331
|
+
ctx,
|
|
332
|
+
found.id,
|
|
333
|
+
chosen.tenantId,
|
|
334
|
+
mergedRoles,
|
|
335
|
+
found.timezone,
|
|
336
|
+
found.locale,
|
|
337
|
+
);
|
|
338
|
+
return { isSuccess: true, data: session };
|
|
339
|
+
}
|
|
340
|
+
|
|
289
341
|
// Login — unauthenticated entry point. The route is wired public (no JWT
|
|
290
342
|
// middleware), dispatching with the framework's anonymous identity for the
|
|
291
343
|
// handler's access check. Everything inside the handler goes through
|
|
@@ -31,6 +31,10 @@ export type {
|
|
|
31
31
|
SignupOptions,
|
|
32
32
|
} from "./feature.ts";
|
|
33
33
|
export { authEmailPasswordEnvSchema, createAuthEmailPasswordFeature } from "./feature.ts";
|
|
34
|
+
export {
|
|
35
|
+
sessionForVerifiedUser,
|
|
36
|
+
type VerifiedUserLookup,
|
|
37
|
+
} from "./handlers/login.write.ts";
|
|
34
38
|
export { AuthMailNotificationTypes } from "./mail-notifications.ts";
|
|
35
39
|
export {
|
|
36
40
|
AUTH_SELF_REGISTRATION_FEATURE,
|
|
@@ -1 +1,8 @@
|
|
|
1
|
-
[
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.424.1",
|
|
4
|
+
"type": "fix",
|
|
5
|
+
"title": "resolveToken receives a typed db",
|
|
6
|
+
"detail": "The `ctx.db` passed to `resolveToken` is now typed as the delivery channel's `TenantDb` instead of `unknown`, so an app can query its device entity without a guard or cast. Existing callbacks that take `unknown` still compile."
|
|
7
|
+
}
|
|
8
|
+
]
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { DeliveryChannel } from "../delivery/index.ts";
|
|
1
|
+
import type { ChannelContext, DeliveryChannel } from "../delivery/index.ts";
|
|
3
2
|
import type { PushTransport } from "./types.ts";
|
|
4
3
|
|
|
5
4
|
export type PushChannelOptions = {
|
|
6
5
|
readonly transport: PushTransport;
|
|
7
6
|
readonly resolveToken: (
|
|
8
7
|
userId: string,
|
|
9
|
-
ctx:
|
|
8
|
+
ctx: Pick<ChannelContext, "db" | "tenantId">,
|
|
10
9
|
) => Promise<string | null>;
|
|
11
10
|
};
|
|
12
11
|
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# document-draft
|
|
2
|
+
|
|
3
|
+
One editable copy of a PDF document template per object (for example a lease contract). A draft is
|
|
4
|
+
created from a template, or from one of its variants, with the values of its placeholders. It is
|
|
5
|
+
changed with the same structured operations as `template-resolver:write:patch-draft` (or with the HTML
|
|
6
|
+
of an editor) and finalized to a stored PDF. The template stays unchanged.
|
|
7
|
+
|
|
8
|
+
## Setup
|
|
9
|
+
|
|
10
|
+
```typescript
|
|
11
|
+
import { createDocumentDraftFeature } from "@cosmicdrift/kumiko-bundled-features/document-draft";
|
|
12
|
+
import {
|
|
13
|
+
renderPdfBeforeTransaction,
|
|
14
|
+
storeRenderedPdf,
|
|
15
|
+
} from "@cosmicdrift/kumiko-renderer-puppeteer-client";
|
|
16
|
+
|
|
17
|
+
createDocumentDraftFeature({
|
|
18
|
+
subjectTypes: ["lease"],
|
|
19
|
+
pdf: { render: renderPdfBeforeTransaction, store: storeRenderedPdf },
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`bundled-features` never imports the print client; the app injects `render` and `store`. Requires the
|
|
24
|
+
`files`, `template-resolver` and `user-data-rights` features and the print client to be mounted.
|
|
25
|
+
|
|
26
|
+
## Options
|
|
27
|
+
|
|
28
|
+
| Option | Default | Effect |
|
|
29
|
+
| ------------------ | -------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
|
|
30
|
+
| `subjectTypes` | required | The kinds of object a draft belongs to; `create` refuses any other (400) |
|
|
31
|
+
| `pdf` | required | `render` prints the draft before the transaction and uploads it, `store` stores the file in the finalize transaction |
|
|
32
|
+
| `retention` | `{ keepFor: "10y" }` | How long drafts are kept, counted from creation, hard delete |
|
|
33
|
+
| `access` | `{ roles: ["TenantAdmin", "TenantMember"] }` | `AccessRule` of all handlers and queries |
|
|
34
|
+
| `authorizeSubject` | none | `(ctx, user, { subjectType, subjectId })`; `false` answers like a missing draft. Runs in every handler and query |
|
|
35
|
+
| `unscopedRoles` | none | Roles that skip `authorizeSubject`, e.g. `["TenantAdmin"]` |
|
|
36
|
+
| `subjectScreens` | none | Screen id per subject type that the editor returns to after finalize or discard, opened with the subject id |
|
|
37
|
+
|
|
38
|
+
## Handlers and queries
|
|
39
|
+
|
|
40
|
+
| Name | What it does |
|
|
41
|
+
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
42
|
+
| `write:create` | `{subjectType, subjectId, templateSlug, variant?, locale?, variables}`: copies the template text with its placeholders, freezes `variables` with the draft; returns `{id, version}` |
|
|
43
|
+
| `write:patch` | `{id, base, ops}`: structured ops on an open draft; `setVariable`, `setMeta`, `setResource` fail with `op_not_allowed` |
|
|
44
|
+
| `write:save` | `{id, base, content}`: replaces the text with sanitized editor HTML |
|
|
45
|
+
| `write:finalize` | `{id, base}`: prints the draft body with the frozen variables, stores the PDF; status `finalized`, `fileRefId` set |
|
|
46
|
+
| `write:revise` | `{id, base}`: reopens a finalized draft, `revision` + 1, file reference cleared |
|
|
47
|
+
| `write:discard` | `{id, base}`: discards an open draft |
|
|
48
|
+
| `query:blocks` | `{id}`: the draft with block ids, deviations from the template, the variable schema, `subjectScreen` and `version` (the `base` of the next write) |
|
|
49
|
+
| `query:by-subject` | `{subjectType, subjectId}`: the non-discarded drafts of one object, newest first |
|
|
50
|
+
|
|
51
|
+
`base` is the draft's `version`; a stale one fails with `version_conflict`. `patch`, `save`, `finalize`
|
|
52
|
+
and `discard` need status `open`, `revise` needs `finalized` (422 `document_draft_not_open`,
|
|
53
|
+
`document_draft_not_finalized`). A variant must belong to `templateSlug`, otherwise
|
|
54
|
+
`template_variant_unknown`; a missing template fails with `template_not_found`.
|
|
55
|
+
|
|
56
|
+
The placeholders stay in the body; the variables are applied when the PDF is printed, so a draft
|
|
57
|
+
shows `{{...}}` in the editor and every `finalize` prints the current values.
|
|
58
|
+
|
|
59
|
+
## Editor screen
|
|
60
|
+
|
|
61
|
+
The browser entry `@cosmicdrift/kumiko-bundled-features/document-draft/web` has `documentDraftClient()`
|
|
62
|
+
for `createKumikoApp({ clientFeatures })`. It mounts the custom screen `document-draft:screen:document-draft-editor`
|
|
63
|
+
(`DOCUMENT_DRAFT_EDITOR_SCREEN_ID`, short id `document-draft-editor`), which the app opens with the draft id as
|
|
64
|
+
entity id. The screen is dormant: the app decides where it is reachable.
|
|
65
|
+
|
|
66
|
+
The editor shows the draft text with its placeholders (labelled with the frozen values), a preview, the
|
|
67
|
+
template (its title, or the slug and variant when it has none), the revision, the status and the deviations from the template. An open draft can be saved,
|
|
68
|
+
finalized (only without unsaved changes) or discarded; a finalized one is read-only with its file name and
|
|
69
|
+
"Edit again" (`revise`). After finalize or discard the screen opens `subjectScreens[subjectType]` with the
|
|
70
|
+
subject id; without one it stays and shows the new state. Saving re-serializes the whole text through the editor, so
|
|
71
|
+
blocks the editor normalizes (for example tables with repeat rows) can show as deviations although the
|
|
72
|
+
user did not touch them.
|
|
73
|
+
|
|
74
|
+
## Personal data
|
|
75
|
+
|
|
76
|
+
Body, variables, file name and the last change (which holds the ops) are personal data of the draft
|
|
77
|
+
itself: the draft row is its own crypto-shredding subject, like a signer. With a mounted subject KMS
|
|
78
|
+
the events hold them as ciphertext. The user forget run does not reach them. When the object a draft
|
|
79
|
+
belongs to is erased, call `forgetDocumentDraftsOfSubject(ctx, { subjectType, subjectId })`: it
|
|
80
|
+
purges the draft rows and erases their keys, so the old events stay unreadable. Without a KMS the
|
|
81
|
+
key erase does nothing and the old events keep plaintext.
|
|
82
|
+
|
|
83
|
+
`authorizeSubject` needs the full handler context, so `finalize` checks it inside its transaction,
|
|
84
|
+
after printing: a caller who may not see the subject gets 404 and nothing is stored.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.424.0",
|
|
4
|
+
"type": "improvement",
|
|
5
|
+
"title": "document-draft bundle for per-object PDF drafts",
|
|
6
|
+
"detail": "`createDocumentDraftFeature({ subjectTypes, pdf: { render, store }, retention?, access?, authorizeSubject?, unscopedRoles?, subjectScreens? })` adds the entity `documentDraft` (table `read_document_drafts`, so apps that mount it need a schema migration) and the handlers `create`, `patch`, `save`, `finalize`, `revise`, `discard` and the queries `blocks` and `by-subject`. `create` copies a template or one of its variants (placeholders stay in the body) and freezes the `variables`; `patch` takes the ops of `template-resolver:write:patch-draft` except `setVariable`, `setMeta` and `setResource` (`op_not_allowed`); `finalize` prints the draft body and stores the PDF. `{ render: renderPdfBeforeTransaction, store: storeRenderedPdf }` from renderer-puppeteer-client fits `pdf` without an adapter. Body, variables and last change are personal data of the draft row; `forgetDocumentDraftsOfSubject(ctx, subject)` purges the drafts of an erased object and erases their keys. The bundle requires `user-data-rights`. The editor is the dormant custom screen `document-draft:screen:document-draft-editor`, mounted with `documentDraftClient()` from `@cosmicdrift/kumiko-bundled-features/document-draft/web`: it opens with the draft id, edits the text, lists the deviations from the template, saves, finalizes or discards (then opens `subjectScreens[subjectType]` with the subject id) and reopens a finalized draft. The subject scope (`createSubjectScope`) moved from signature to the shared barrel and is used by both bundles."
|
|
7
|
+
}
|
|
8
|
+
]
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createEntity,
|
|
3
|
+
createEntityExecutor,
|
|
4
|
+
createJsonbField,
|
|
5
|
+
createLongTextField,
|
|
6
|
+
createNumberField,
|
|
7
|
+
createSelectField,
|
|
8
|
+
createTextField,
|
|
9
|
+
createTimestampField,
|
|
10
|
+
} from "@cosmicdrift/kumiko-framework/engine";
|
|
11
|
+
import { TEMPLATE_SCOPES } from "../template-resolver/index.ts";
|
|
12
|
+
import {
|
|
13
|
+
DOCUMENT_DRAFT_ENTITY,
|
|
14
|
+
DOCUMENT_DRAFT_STATUS,
|
|
15
|
+
DOCUMENT_DRAFT_STATUS_TONE,
|
|
16
|
+
} from "./web/constants.ts";
|
|
17
|
+
|
|
18
|
+
export const DEFAULT_DOCUMENT_DRAFT_RETENTION_KEEP_FOR = "10y";
|
|
19
|
+
|
|
20
|
+
export type DocumentDraftRetention = { readonly keepFor: string };
|
|
21
|
+
|
|
22
|
+
const STATUS_OPTIONS = [
|
|
23
|
+
DOCUMENT_DRAFT_STATUS.Open,
|
|
24
|
+
DOCUMENT_DRAFT_STATUS.Finalized,
|
|
25
|
+
DOCUMENT_DRAFT_STATUS.Discarded,
|
|
26
|
+
] as const;
|
|
27
|
+
|
|
28
|
+
// The body carries the text of one contract with names and amounts filled in by whoever edits it,
|
|
29
|
+
// so the draft row is its own crypto-shredding subject, like a signer row. find: "none": nothing looks it up.
|
|
30
|
+
const DRAFT_PERSONAL = { personal: "self", find: "none" } as const;
|
|
31
|
+
const DRAFT_PERSONAL_JSON = { personal: "self" } as const;
|
|
32
|
+
|
|
33
|
+
export function createDocumentDraftEntity(
|
|
34
|
+
retention: DocumentDraftRetention = { keepFor: DEFAULT_DOCUMENT_DRAFT_RETENTION_KEEP_FOR },
|
|
35
|
+
) {
|
|
36
|
+
return createEntity({
|
|
37
|
+
table: "read_document_drafts",
|
|
38
|
+
description:
|
|
39
|
+
"One editable copy of a PDF document template for one object (for example a lease contract): the template text with its {{placeholders}} frozen at creation, changed with the same structured operations as a template, then finalized to a stored PDF. The template itself stays unchanged; body, variables and the last change are personal data of the draft.",
|
|
40
|
+
retention: { keepFor: retention.keepFor, strategy: "hardDelete", reference: "createdAt" },
|
|
41
|
+
fields: {
|
|
42
|
+
subjectType: createTextField({
|
|
43
|
+
required: true,
|
|
44
|
+
personal: false,
|
|
45
|
+
reason: "technical_reference",
|
|
46
|
+
filterable: true,
|
|
47
|
+
maxLength: 100,
|
|
48
|
+
}),
|
|
49
|
+
subjectId: createTextField({
|
|
50
|
+
required: true,
|
|
51
|
+
personal: false,
|
|
52
|
+
reason: "technical_reference",
|
|
53
|
+
filterable: true,
|
|
54
|
+
maxLength: 100,
|
|
55
|
+
}),
|
|
56
|
+
templateSlug: createTextField({
|
|
57
|
+
required: true,
|
|
58
|
+
personal: false,
|
|
59
|
+
reason: "technical_reference",
|
|
60
|
+
maxLength: 200,
|
|
61
|
+
}),
|
|
62
|
+
templateVariant: createTextField({
|
|
63
|
+
personal: false,
|
|
64
|
+
reason: "technical_reference",
|
|
65
|
+
maxLength: 200,
|
|
66
|
+
}),
|
|
67
|
+
templateTitle: createTextField({
|
|
68
|
+
personal: false,
|
|
69
|
+
reason: "template_content",
|
|
70
|
+
maxLength: 300,
|
|
71
|
+
}),
|
|
72
|
+
templateId: createTextField({
|
|
73
|
+
required: true,
|
|
74
|
+
personal: false,
|
|
75
|
+
reason: "technical_reference",
|
|
76
|
+
maxLength: 64,
|
|
77
|
+
}),
|
|
78
|
+
templateVersion: createNumberField({ required: true }),
|
|
79
|
+
templateScope: createSelectField({ options: [...TEMPLATE_SCOPES], required: true }),
|
|
80
|
+
locale: createTextField({
|
|
81
|
+
required: true,
|
|
82
|
+
personal: false,
|
|
83
|
+
reason: "technical_reference",
|
|
84
|
+
maxLength: 20,
|
|
85
|
+
}),
|
|
86
|
+
templateBody: createLongTextField({
|
|
87
|
+
required: true,
|
|
88
|
+
personal: false,
|
|
89
|
+
reason: "template_content",
|
|
90
|
+
}),
|
|
91
|
+
body: createLongTextField({ required: true, ...DRAFT_PERSONAL }),
|
|
92
|
+
variables: createJsonbField(DRAFT_PERSONAL_JSON),
|
|
93
|
+
meta: createJsonbField({ personal: false, reason: "template_settings" }),
|
|
94
|
+
variableSchema: createJsonbField({
|
|
95
|
+
personal: false,
|
|
96
|
+
reason: "template_definition",
|
|
97
|
+
}),
|
|
98
|
+
status: createSelectField({
|
|
99
|
+
options: STATUS_OPTIONS,
|
|
100
|
+
required: true,
|
|
101
|
+
default: DOCUMENT_DRAFT_STATUS.Open,
|
|
102
|
+
filterable: true,
|
|
103
|
+
sortable: true,
|
|
104
|
+
optionTones: DOCUMENT_DRAFT_STATUS_TONE,
|
|
105
|
+
}),
|
|
106
|
+
revision: createNumberField({ required: true, default: 1 }),
|
|
107
|
+
fileRefId: createTextField({
|
|
108
|
+
personal: false,
|
|
109
|
+
reason: "technical_reference",
|
|
110
|
+
maxLength: 64,
|
|
111
|
+
}),
|
|
112
|
+
fileName: createTextField({ ...DRAFT_PERSONAL, maxLength: 300 }),
|
|
113
|
+
finalizedAt: createTimestampField({ personal: false, reason: "is_business_timestamp" }),
|
|
114
|
+
lastChange: createJsonbField(DRAFT_PERSONAL_JSON),
|
|
115
|
+
},
|
|
116
|
+
indexes: [{ columns: ["tenantId", "subjectType", "subjectId"] }],
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export const documentDraftEntity = createDocumentDraftEntity();
|
|
121
|
+
|
|
122
|
+
export const { executor: documentDraftExecutor, table: documentDraftTable } = createEntityExecutor(
|
|
123
|
+
DOCUMENT_DRAFT_ENTITY,
|
|
124
|
+
documentDraftEntity,
|
|
125
|
+
);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import {
|
|
2
|
+
defineFeature,
|
|
3
|
+
EXT_USER_DATA,
|
|
4
|
+
type FeatureDefinition,
|
|
5
|
+
} from "@cosmicdrift/kumiko-framework/engine";
|
|
6
|
+
import { createSubjectScope } from "../shared/index.ts";
|
|
7
|
+
import { createDocumentDraftEntity } from "./entity.ts";
|
|
8
|
+
import { createBlocksQuery } from "./handlers/blocks.query.ts";
|
|
9
|
+
import { createBySubjectQuery } from "./handlers/by-subject.query.ts";
|
|
10
|
+
import { createCreateHandler } from "./handlers/create.write.ts";
|
|
11
|
+
import { createDiscardHandler } from "./handlers/discard.write.ts";
|
|
12
|
+
import { createFinalizeHandler } from "./handlers/finalize.write.ts";
|
|
13
|
+
import { createPatchHandler } from "./handlers/patch.write.ts";
|
|
14
|
+
import { createReviseHandler } from "./handlers/revise.write.ts";
|
|
15
|
+
import { createSaveHandler } from "./handlers/save.write.ts";
|
|
16
|
+
import { DOCUMENT_DRAFT_I18N } from "./i18n.ts";
|
|
17
|
+
import { DEFAULT_DOCUMENT_DRAFT_ACCESS } from "./lib.ts";
|
|
18
|
+
import type { DocumentDraftOptions } from "./options.ts";
|
|
19
|
+
import { createDocumentDraftEditorScreen } from "./screens/editor-screen.ts";
|
|
20
|
+
import { DOCUMENT_DRAFT_ENTITY, DOCUMENT_DRAFT_FEATURE } from "./web/constants.ts";
|
|
21
|
+
|
|
22
|
+
export function createDocumentDraftFeature<TUpload>(
|
|
23
|
+
opts: DocumentDraftOptions<TUpload>,
|
|
24
|
+
): FeatureDefinition {
|
|
25
|
+
const access = opts.access ?? DEFAULT_DOCUMENT_DRAFT_ACCESS;
|
|
26
|
+
const scope = createSubjectScope(opts);
|
|
27
|
+
const entity = createDocumentDraftEntity(opts.retention);
|
|
28
|
+
|
|
29
|
+
return defineFeature(DOCUMENT_DRAFT_FEATURE, (r) => {
|
|
30
|
+
r.describe(
|
|
31
|
+
"Document drafts: one editable copy of a PDF document template per object (for example a lease contract). A draft is created from a template or one of its variants with the values for its placeholders, changed with the structured operations of template patch-draft or the editor, and finalized to a stored PDF through the injected print function; the template stays unchanged. Revise reopens a finalized draft. Body, variables and the last change are personal data of the draft, which is its own crypto-shredding subject.",
|
|
32
|
+
);
|
|
33
|
+
r.uiHints({ displayLabel: "Document drafts", category: "data", recommended: false });
|
|
34
|
+
r.requires({ features: ["files", "template-resolver", "user-data-rights"] });
|
|
35
|
+
r.translations({ keys: DOCUMENT_DRAFT_I18N });
|
|
36
|
+
|
|
37
|
+
r.entity({ name: "documentDraft", ...entity });
|
|
38
|
+
|
|
39
|
+
r.writeHandler(createCreateHandler(access, scope, opts.subjectTypes));
|
|
40
|
+
r.writeHandler(createPatchHandler(access, scope));
|
|
41
|
+
r.writeHandler(createSaveHandler(access, scope));
|
|
42
|
+
r.writeHandler(createFinalizeHandler(access, scope, opts.pdf));
|
|
43
|
+
r.writeHandler(createReviseHandler(access, scope));
|
|
44
|
+
r.writeHandler(createDiscardHandler(access, scope));
|
|
45
|
+
r.queryHandler(createBlocksQuery(access, scope, opts.subjectScreens));
|
|
46
|
+
r.queryHandler(createBySubjectQuery(access, scope));
|
|
47
|
+
r.screen(createDocumentDraftEditorScreen(access));
|
|
48
|
+
|
|
49
|
+
// A draft belongs to the object it was made for, not to the acting user: the app erases it
|
|
50
|
+
// with forgetDocumentDraftsOfSubject when that object is erased, so the user pipeline has nothing to do.
|
|
51
|
+
r.useExtension(EXT_USER_DATA, DOCUMENT_DRAFT_ENTITY, {
|
|
52
|
+
export: async () => null,
|
|
53
|
+
delete: async () => {},
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { type AccessRule, defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { NotFoundError } from "@cosmicdrift/kumiko-framework/errors";
|
|
3
|
+
import type { SubjectScope } from "../../shared/index.ts";
|
|
4
|
+
import {
|
|
5
|
+
allowedBlocksFor,
|
|
6
|
+
diffTemplateBlocks,
|
|
7
|
+
documentBlocksOf,
|
|
8
|
+
parseDocumentJson,
|
|
9
|
+
splitTemplateBlocks,
|
|
10
|
+
} from "../../template-resolver/index.ts";
|
|
11
|
+
import { loadScopedDraft } from "../lib.ts";
|
|
12
|
+
import { DraftIdSchema } from "../payloads.ts";
|
|
13
|
+
import { DOCUMENT_DRAFT_ENTITY } from "../web/constants.ts";
|
|
14
|
+
|
|
15
|
+
export function createBlocksQuery(
|
|
16
|
+
access: AccessRule,
|
|
17
|
+
scope: SubjectScope,
|
|
18
|
+
subjectScreens: Readonly<Record<string, string>> = {},
|
|
19
|
+
) {
|
|
20
|
+
return defineQueryHandler({
|
|
21
|
+
name: "blocks",
|
|
22
|
+
schema: DraftIdSchema,
|
|
23
|
+
access,
|
|
24
|
+
description:
|
|
25
|
+
"Reads a document draft as a list of blocks with stable ids (b0, b1, ...) for structured editing with patch: each block has its type, its text with {{name}} placeholders and its settings. Also returns the draft's subject, template, status, revision, the frozen variables, the variable schema, the screen its subject type returns to (subjectScreen, or null) and the settings, the deviations from the template text (blocks added, removed or changed) and the block types allowed in a PDF document. version is the base that patch, save, finalize, revise and discard expect back.",
|
|
26
|
+
handler: async (query, ctx) => {
|
|
27
|
+
const draft = await loadScopedDraft(ctx, query.user, scope, query.payload.id);
|
|
28
|
+
if (draft === null) throw new NotFoundError(DOCUMENT_DRAFT_ENTITY, query.payload.id);
|
|
29
|
+
const subjectType = String(draft.subjectType);
|
|
30
|
+
const body = String(draft.body);
|
|
31
|
+
const templateBody = String(draft.templateBody);
|
|
32
|
+
return {
|
|
33
|
+
id: draft.id,
|
|
34
|
+
subjectType: draft.subjectType,
|
|
35
|
+
subjectId: draft.subjectId,
|
|
36
|
+
templateSlug: draft.templateSlug,
|
|
37
|
+
templateVariant: draft.templateVariant ?? null,
|
|
38
|
+
templateTitle: draft.templateTitle ?? null,
|
|
39
|
+
templateVersion: draft.templateVersion,
|
|
40
|
+
locale: draft.locale,
|
|
41
|
+
status: draft.status,
|
|
42
|
+
revision: draft.revision,
|
|
43
|
+
version: draft.version,
|
|
44
|
+
fileRefId: draft.fileRefId ?? null,
|
|
45
|
+
fileName: draft.fileName ?? null,
|
|
46
|
+
body,
|
|
47
|
+
templateBody,
|
|
48
|
+
variables: draft.variables ?? {},
|
|
49
|
+
variableSchema: draft.variableSchema ?? {},
|
|
50
|
+
subjectScreen: Object.hasOwn(subjectScreens, subjectType)
|
|
51
|
+
? subjectScreens[subjectType]
|
|
52
|
+
: null,
|
|
53
|
+
meta: draft.meta ?? null,
|
|
54
|
+
blocks: documentBlocksOf(parseDocumentJson(body)),
|
|
55
|
+
deviations: diffTemplateBlocks(
|
|
56
|
+
splitTemplateBlocks(templateBody, "html"),
|
|
57
|
+
splitTemplateBlocks(body, "html"),
|
|
58
|
+
),
|
|
59
|
+
allowedBlocks: allowedBlocksFor("document-pdf"),
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type AccessRule, defineQueryHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { NotFoundError } from "@cosmicdrift/kumiko-framework/errors";
|
|
3
|
+
import type { SubjectScope } from "../../shared/index.ts";
|
|
4
|
+
import { documentDraftExecutor } from "../entity.ts";
|
|
5
|
+
import { BySubjectSchema } from "../payloads.ts";
|
|
6
|
+
import { DOCUMENT_DRAFT_ENTITY, DOCUMENT_DRAFT_STATUS } from "../web/constants.ts";
|
|
7
|
+
|
|
8
|
+
// Equals the executor's MAX_LIST_LIMIT; one object never has more live drafts.
|
|
9
|
+
const LIST_LIMIT = 200;
|
|
10
|
+
|
|
11
|
+
export function createBySubjectQuery(access: AccessRule, scope: SubjectScope) {
|
|
12
|
+
return defineQueryHandler({
|
|
13
|
+
name: "by-subject",
|
|
14
|
+
schema: BySubjectSchema,
|
|
15
|
+
access,
|
|
16
|
+
description:
|
|
17
|
+
"Lists the drafts of one object (subjectType, subjectId), newest first, without their text: id, status, revision, version, template, file and creation time (insertedAt). Discarded drafts are left out.",
|
|
18
|
+
handler: async (query, ctx) => {
|
|
19
|
+
const { subjectType, subjectId } = query.payload;
|
|
20
|
+
if (!(await scope.allows(ctx, query.user, subjectType, subjectId))) {
|
|
21
|
+
throw new NotFoundError(DOCUMENT_DRAFT_ENTITY);
|
|
22
|
+
}
|
|
23
|
+
const found = await documentDraftExecutor.list(
|
|
24
|
+
{
|
|
25
|
+
filters: [
|
|
26
|
+
{ field: "subjectType", op: "eq", value: subjectType },
|
|
27
|
+
{ field: "subjectId", op: "eq", value: subjectId },
|
|
28
|
+
{ field: "status", op: "ne", value: DOCUMENT_DRAFT_STATUS.Discarded },
|
|
29
|
+
],
|
|
30
|
+
sort: "insertedAt",
|
|
31
|
+
sortDirection: "desc",
|
|
32
|
+
limit: LIST_LIMIT,
|
|
33
|
+
},
|
|
34
|
+
query.user,
|
|
35
|
+
ctx.db,
|
|
36
|
+
);
|
|
37
|
+
return found.rows.map((row) => ({
|
|
38
|
+
id: row.id,
|
|
39
|
+
status: row.status,
|
|
40
|
+
revision: row.revision,
|
|
41
|
+
version: row.version,
|
|
42
|
+
templateSlug: row.templateSlug,
|
|
43
|
+
templateVariant: row.templateVariant ?? null,
|
|
44
|
+
fileRefId: row.fileRefId ?? null,
|
|
45
|
+
fileName: row.fileName ?? null,
|
|
46
|
+
insertedAt: row.insertedAt,
|
|
47
|
+
}));
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type AccessRule, defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { UnprocessableError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
|
|
3
|
+
import type { SubjectScope } from "../../shared/index.ts";
|
|
4
|
+
import {
|
|
5
|
+
createTemplateResolverApi,
|
|
6
|
+
isVariantSlugOf,
|
|
7
|
+
readVariantOf,
|
|
8
|
+
sanitizeDocumentHtml,
|
|
9
|
+
TemplateNotFoundError,
|
|
10
|
+
VARIANT_UNKNOWN_REASON,
|
|
11
|
+
} from "../../template-resolver/index.ts";
|
|
12
|
+
import { documentDraftExecutor } from "../entity.ts";
|
|
13
|
+
import { draftNotFound } from "../lib.ts";
|
|
14
|
+
import { createDraftSchema } from "../payloads.ts";
|
|
15
|
+
import {
|
|
16
|
+
DOCUMENT_DRAFT_ERROR,
|
|
17
|
+
DOCUMENT_DRAFT_LAST_CHANGE_SOURCE,
|
|
18
|
+
DOCUMENT_DRAFT_STATUS,
|
|
19
|
+
} from "../web/constants.ts";
|
|
20
|
+
|
|
21
|
+
type CreateData = { readonly id: string; readonly version: number };
|
|
22
|
+
|
|
23
|
+
export function createCreateHandler(
|
|
24
|
+
access: AccessRule,
|
|
25
|
+
scope: SubjectScope,
|
|
26
|
+
subjectTypes: readonly [string, ...string[]],
|
|
27
|
+
) {
|
|
28
|
+
const schema = createDraftSchema(subjectTypes);
|
|
29
|
+
return defineWriteHandler<"create", typeof schema, CreateData>({
|
|
30
|
+
name: "create",
|
|
31
|
+
schema,
|
|
32
|
+
access,
|
|
33
|
+
agent: { expose: false },
|
|
34
|
+
description:
|
|
35
|
+
"Creates the editable draft of a PDF document template for one object (subjectType, subjectId), optionally from a variant of the template: the template text with its placeholders is copied, the values are frozen with the draft and the template itself stays unchanged. Returns the draft id and version.",
|
|
36
|
+
handler: async (event, ctx) => {
|
|
37
|
+
const { subjectType, subjectId, templateSlug, variant, locale, variables } = event.payload;
|
|
38
|
+
const user = event.user;
|
|
39
|
+
if (!(await scope.allows(ctx, user, subjectType, subjectId))) return draftNotFound();
|
|
40
|
+
if (variant !== undefined && !isVariantSlugOf(variant, templateSlug)) {
|
|
41
|
+
return variantUnknown(variant);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const api = createTemplateResolverApi(ctx.db, ctx.registry);
|
|
45
|
+
let resource: Awaited<ReturnType<typeof api.resolveTemplate>>;
|
|
46
|
+
try {
|
|
47
|
+
resource = await api.resolveTemplate({
|
|
48
|
+
tenantId: user.tenantId,
|
|
49
|
+
slug: variant ?? templateSlug,
|
|
50
|
+
kind: "document-pdf",
|
|
51
|
+
locale,
|
|
52
|
+
});
|
|
53
|
+
} catch (e) {
|
|
54
|
+
if (!(e instanceof TemplateNotFoundError)) throw e;
|
|
55
|
+
if (variant !== undefined) return variantUnknown(variant);
|
|
56
|
+
return writeFailure(
|
|
57
|
+
new UnprocessableError(DOCUMENT_DRAFT_ERROR.TemplateNotFound, {
|
|
58
|
+
i18nKey: "documentDraft.errors.templateNotFound",
|
|
59
|
+
i18nParams: { slug: templateSlug },
|
|
60
|
+
}),
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
if (variant !== undefined && readVariantOf(resource.meta) !== templateSlug) {
|
|
64
|
+
return variantUnknown(variant);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Same normalization the editor save applies, so an unchanged save shows no deviation.
|
|
68
|
+
const normalized = sanitizeDocumentHtml(resource.content);
|
|
69
|
+
const startContent = normalized.ok ? normalized.html : resource.content;
|
|
70
|
+
|
|
71
|
+
const created = await documentDraftExecutor.create(
|
|
72
|
+
{
|
|
73
|
+
subjectType,
|
|
74
|
+
subjectId,
|
|
75
|
+
templateSlug,
|
|
76
|
+
templateVariant: variant ?? null,
|
|
77
|
+
templateTitle: resource.title,
|
|
78
|
+
templateId: resource.id,
|
|
79
|
+
templateVersion: resource.version,
|
|
80
|
+
templateScope: resource.scope,
|
|
81
|
+
locale,
|
|
82
|
+
body: startContent,
|
|
83
|
+
templateBody: startContent,
|
|
84
|
+
variables,
|
|
85
|
+
meta: resource.meta ?? {},
|
|
86
|
+
variableSchema: resource.variableSchema,
|
|
87
|
+
status: DOCUMENT_DRAFT_STATUS.Open,
|
|
88
|
+
revision: 1,
|
|
89
|
+
lastChange: { source: DOCUMENT_DRAFT_LAST_CHANGE_SOURCE.Create },
|
|
90
|
+
},
|
|
91
|
+
user,
|
|
92
|
+
ctx.db,
|
|
93
|
+
);
|
|
94
|
+
if (!created.isSuccess) return created;
|
|
95
|
+
return {
|
|
96
|
+
isSuccess: true,
|
|
97
|
+
data: { id: String(created.data.id), version: created.data.event.version },
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function variantUnknown(variant: string) {
|
|
104
|
+
return writeFailure(
|
|
105
|
+
new UnprocessableError(VARIANT_UNKNOWN_REASON, {
|
|
106
|
+
i18nKey: "templateResolver.errors.variantUnknown",
|
|
107
|
+
i18nParams: { variant },
|
|
108
|
+
}),
|
|
109
|
+
);
|
|
110
|
+
}
|