@cosmicdrift/kumiko-samples 0.417.0 → 0.419.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/package.json +1 -1
- package/packages/bundled-features/package.json +6 -1
- package/packages/bundled-features/src/agent-tools/api-docs/schema-fields.ts +14 -0
- package/packages/bundled-features/src/agent-tools/changes.json +6 -0
- package/packages/bundled-features/src/auth-email-password/index.ts +1 -1
- package/packages/bundled-features/src/auth-email-password/signup-activation.ts +2 -5
- package/packages/bundled-features/src/auth-email-password/signup-token-store.ts +0 -6
- package/packages/bundled-features/src/cap-counter/changes.json +6 -0
- package/packages/bundled-features/src/cap-counter/stock-cap-guard.ts +46 -13
- package/packages/bundled-features/src/channel-whatsapp/changes.json +1 -1
- package/packages/bundled-features/src/document-ingest-foundation/changes.json +6 -0
- package/packages/bundled-features/src/document-ingest-foundation/feature.ts +13 -1
- package/packages/bundled-features/src/document-ingest-foundation/report-ingest-progress.ts +23 -6
- package/packages/bundled-features/src/signature/README.md +4 -4
- package/packages/bundled-features/src/signature/changes.json +18 -0
- package/packages/bundled-features/src/signature/entity.ts +3 -1
- package/packages/bundled-features/src/signature/feature.ts +16 -3
- package/packages/bundled-features/src/signature/handlers/lifecycle.write.ts +33 -1
- package/packages/bundled-features/src/signature/i18n.ts +1 -0
- package/packages/bundled-features/src/signature/list-cursor-seal.ts +59 -0
- package/packages/bundled-features/src/signature/options.ts +2 -2
- package/packages/bundled-features/src/signature/payloads.ts +14 -2
- package/packages/bundled-features/src/signature/png.ts +25 -4
- package/packages/bundled-features/src/signature/subject-queries.ts +47 -7
- package/packages/bundled-features/src/signature/sweep.ts +32 -8
- package/packages/bundled-features/src/signature/web/constants.ts +12 -0
- package/packages/bundled-features/src/subscription-paddle/changes.json +1 -1
- package/packages/bundled-features/src/subscription-stripe/changes.json +6 -0
- package/packages/bundled-features/src/subscription-stripe/plugin-methods.ts +2 -0
- package/packages/bundled-features/src/subscription-stripe/verify-webhook.ts +21 -16
- package/packages/bundled-features/src/template-resolver/changes.json +38 -0
- package/packages/bundled-features/src/template-resolver/compile-document-body.ts +3 -8
- package/packages/bundled-features/src/template-resolver/compile-document-styles.ts +102 -0
- package/packages/bundled-features/src/template-resolver/document-frames.ts +25 -0
- package/packages/bundled-features/src/template-resolver/document-op-blocks.ts +568 -0
- package/packages/bundled-features/src/template-resolver/document-ops.ts +136 -126
- package/packages/bundled-features/src/template-resolver/document-print-only.ts +41 -0
- package/packages/bundled-features/src/template-resolver/document-sanitizer.ts +41 -19
- package/packages/bundled-features/src/template-resolver/feature.ts +15 -0
- package/packages/bundled-features/src/template-resolver/handlers/apply-layout.write.ts +137 -0
- package/packages/bundled-features/src/template-resolver/handlers/create-layout.write.ts +87 -0
- package/packages/bundled-features/src/template-resolver/handlers/document-base.ts +2 -2
- package/packages/bundled-features/src/template-resolver/handlers/document-blocks.query.ts +13 -8
- package/packages/bundled-features/src/template-resolver/handlers/document-region.ts +47 -0
- package/packages/bundled-features/src/template-resolver/handlers/failure-reason.ts +13 -0
- package/packages/bundled-features/src/template-resolver/handlers/import-bundle-system.write.ts +3 -0
- package/packages/bundled-features/src/template-resolver/handlers/layout-source.query.ts +17 -5
- package/packages/bundled-features/src/template-resolver/handlers/overview.query.ts +16 -4
- package/packages/bundled-features/src/template-resolver/handlers/patch-draft.write.ts +19 -6
- package/packages/bundled-features/src/template-resolver/handlers/publish-templates.write.ts +69 -0
- package/packages/bundled-features/src/template-resolver/handlers/set.write.ts +7 -0
- package/packages/bundled-features/src/template-resolver/handlers/template-write.ts +15 -3
- package/packages/bundled-features/src/template-resolver/handlers/tenant-settings.ts +122 -0
- package/packages/bundled-features/src/template-resolver/handlers/toggle-status.write.ts +25 -10
- package/packages/bundled-features/src/template-resolver/handlers/upsert-system.write.ts +7 -3
- package/packages/bundled-features/src/template-resolver/handlers/usage.query.ts +131 -18
- package/packages/bundled-features/src/template-resolver/handlers/validate.query.ts +10 -0
- package/packages/bundled-features/src/template-resolver/i18n.ts +3 -0
- package/packages/bundled-features/src/template-resolver/index.ts +29 -0
- package/packages/bundled-features/src/template-resolver/layout-regions.ts +54 -16
- package/packages/bundled-features/src/template-resolver/print-document.ts +3 -1
- package/packages/bundled-features/src/template-resolver/seeding.ts +4 -0
- package/packages/bundled-features/src/template-resolver/template-delivery-policy.ts +11 -1
- package/packages/bundled-features/src/template-resolver/template-edit-policy.ts +37 -1
- package/packages/bundled-features/src/template-resolver/template-meta.ts +25 -6
- package/packages/bundled-features/src/template-resolver/template-preview.ts +6 -7
- package/packages/bundled-features/src/template-resolver/template-validation.ts +10 -3
- package/packages/bundled-features/src/template-resolver/web/constants.ts +29 -0
- package/packages/bundled-features/src/template-resolver/web/document-blocks.ts +5 -0
- package/packages/bundled-features/src/template-resolver/web/document-editor-extensions.ts +34 -2
- package/packages/bundled-features/src/template-resolver/web/document-editor-fonts.ts +13 -0
- package/packages/bundled-features/src/template-resolver/web/document-fonts.ts +21 -0
- package/packages/bundled-features/src/template-resolver/web/document-frame-control.ts +428 -0
- package/packages/bundled-features/src/template-resolver/web/document-frame-node-view.tsx +207 -0
- package/packages/bundled-features/src/template-resolver/web/document-print-decorations.ts +196 -0
- package/packages/bundled-features/src/template-resolver/web/document-print-defaults.ts +59 -0
- package/packages/bundled-features/src/template-resolver/web/document-print-style.ts +246 -0
- package/packages/bundled-features/src/template-resolver/web/document-repeat-strip.ts +104 -0
- package/packages/bundled-features/src/template-resolver/web/document-schema.ts +29 -9
- package/packages/bundled-features/src/template-resolver/web/document-style-css.ts +107 -0
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-bubble.tsx +24 -2
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-content.tsx +66 -7
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-context.ts +13 -1
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-editor.tsx +24 -4
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-helpers.ts +149 -4
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-toolbar-groups.tsx +290 -10
- package/packages/bundled-features/src/template-resolver/web/document-tiptap-toolbar.tsx +90 -8
- package/packages/bundled-features/src/template-resolver/web/document-toolbar-blocks.ts +20 -0
- package/packages/bundled-features/src/template-resolver/web/fontsource-css.d.ts +2 -0
- package/packages/bundled-features/src/template-resolver/web/i18n.ts +28 -0
- package/packages/bundled-features/src/template-resolver/web/index.ts +34 -0
- package/packages/bundled-features/src/template-resolver/web/pdf-constants.ts +6 -0
- package/packages/bundled-features/src/template-resolver/web/qualified-names.ts +7 -0
- package/packages/bundled-features/src/template-resolver/web/use-document-tiptap-model.ts +74 -5
- package/packages/bundled-features/src/tenant/company-config.ts +48 -0
- package/packages/bundled-features/src/tenant/feature.ts +11 -0
- package/packages/bundled-features/src/tenant/i18n.ts +14 -0
- package/packages/bundled-features/src/tenant-inactivity/handlers/keep-account.write.ts +7 -3
- package/packages/bundled-features/src/tenant-lifecycle/changes.json +6 -0
- package/packages/bundled-features/src/tenant-lifecycle/run-tenant-destroy.ts +90 -42
- package/samples/apps/ui-walkthrough/src/app/auth-constants.ts +51 -0
- package/samples/apps/ui-walkthrough/src/app/seed-print-editor-tenants.ts +118 -0
- package/samples/apps/ui-walkthrough/src/app/seed-templates.ts +2 -0
- package/samples/apps/ui-walkthrough/src/app/server.ts +9 -1
- package/samples/apps/ui-walkthrough/src/app/template-seed-data.ts +27 -1
- package/samples/apps/ui-walkthrough/src/run-config.ts +1 -0
- package/samples/apps/use-all-bundled/feature-manifest.json +238 -1
- package/samples/recipes/crypto-shredding-hr/README.md +1 -1
- package/samples/recipes/crypto-shredding-hr/src/feature.ts +1 -1
- package/samples/recipes/list-table-options/README.md +9 -3
- package/samples/recipes/list-table-options/src/feature.ts +123 -3
- package/samples/recipes/pdf-letterhead/README.md +23 -0
- package/samples/recipes/pdf-letterhead/package.json +12 -0
- package/samples/recipes/pdf-letterhead/src/letterhead.ts +92 -0
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
UNSUBSCRIBE_SECRET,
|
|
24
24
|
} from "./auth-constants";
|
|
25
25
|
import { seedTasks } from "./seed";
|
|
26
|
+
import { seedPrintEditorTenants } from "./seed-print-editor-tenants";
|
|
26
27
|
import { seedRental } from "./seed-rental";
|
|
27
28
|
import { seedTemplates } from "./seed-templates";
|
|
28
29
|
import { seedVehicles } from "./seed-vehicles";
|
|
@@ -35,7 +36,14 @@ import { seedVehicles } from "./seed-vehicles";
|
|
|
35
36
|
|
|
36
37
|
await runDevApp({
|
|
37
38
|
features: [...APP_FEATURES],
|
|
38
|
-
seeds: [
|
|
39
|
+
seeds: [
|
|
40
|
+
seedTasks,
|
|
41
|
+
seedRental,
|
|
42
|
+
seedVehicles,
|
|
43
|
+
seedTemplates,
|
|
44
|
+
seedPrintEditorTenants,
|
|
45
|
+
seedPlanTerms,
|
|
46
|
+
],
|
|
39
47
|
// PORT env var override for Playwright e2e runs (config points to 4174);
|
|
40
48
|
// otherwise local default 4173.
|
|
41
49
|
port: Number.parseInt(process.env["PORT"] ?? "4173", 10),
|
|
@@ -174,10 +174,36 @@ export const SYSTEM_PDF_LAYOUT: SeedTemplate = {
|
|
|
174
174
|
`<div data-header><table><tbody><tr><td><img data-resource="logo" alt="Nordlicht"></td><td><p data-align="right" data-size="small">Am Hafen 12 · 24103 Kiel</p></td></tr></tbody></table></div>`,
|
|
175
175
|
"<div data-content></div>",
|
|
176
176
|
"<div data-signature></div>",
|
|
177
|
-
`<div data-footer><p
|
|
177
|
+
`<div data-footer><table data-borders="none"><tbody><tr><td><p>${v("tenantName")}</p></td><td><p>${v("companyAddress")}</p></td><td><p>${v("companyIban")}</p></td><td><p data-align="right">Seite ${v("page")} von ${v("pages")}</p></td></tr></tbody></table></div>`,
|
|
178
178
|
].join(""),
|
|
179
179
|
};
|
|
180
180
|
|
|
181
|
+
// A second letterhead for the layout-transfer walkthrough: other header and footer text, serif
|
|
182
|
+
// body and its own margins, so a template that switches to it changes visibly.
|
|
183
|
+
export const BRIEFBOGEN_LAYOUT_SLUG = "briefbogen";
|
|
184
|
+
export const BRIEFBOGEN_HEADER_TEXT = "Hausverwaltung am Sund";
|
|
185
|
+
export const BRIEFBOGEN_FOOTER_TEXT = "Sundstraße 3 · 18439 Stralsund";
|
|
186
|
+
export const BRIEFBOGEN_MARGINS_MM = { top: 36, right: 24, bottom: 28, left: 30 } as const;
|
|
187
|
+
|
|
188
|
+
export const SYSTEM_BRIEFBOGEN_LAYOUT: SeedTemplate = {
|
|
189
|
+
slug: BRIEFBOGEN_LAYOUT_SLUG,
|
|
190
|
+
kind: "pdf-layout",
|
|
191
|
+
locale: "en",
|
|
192
|
+
title: "Briefbogen Stralsund",
|
|
193
|
+
content: [
|
|
194
|
+
`<div data-header><p data-align="center"><strong>${BRIEFBOGEN_HEADER_TEXT}</strong></p></div>`,
|
|
195
|
+
"<div data-content></div>",
|
|
196
|
+
"<div data-signature></div>",
|
|
197
|
+
`<div data-footer><p data-align="center">${BRIEFBOGEN_FOOTER_TEXT}</p><p data-align="center">Seite ${v("page")} von ${v("pages")}</p></div>`,
|
|
198
|
+
].join(""),
|
|
199
|
+
meta: {
|
|
200
|
+
margins: BRIEFBOGEN_MARGINS_MM,
|
|
201
|
+
fontFamily: "times",
|
|
202
|
+
fontSizePt: 11,
|
|
203
|
+
tableStyle: "lines",
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
|
|
181
207
|
export const TENANT_MAIL_LAYOUT_VERSIONS: readonly string[] = [
|
|
182
208
|
[
|
|
183
209
|
`<div data-header><p><strong>${v("tenantName")}</strong></p></div>`,
|
|
@@ -54,6 +54,7 @@ const TENANT_EDITABLE_TEMPLATES: readonly TenantEditableTemplate[] = [
|
|
|
54
54
|
slug: "default",
|
|
55
55
|
access: { roles: ["TenantAdmin"] },
|
|
56
56
|
})),
|
|
57
|
+
{ kind: "pdf-layout" as const, slug: "briefbogen", access: { roles: ["TenantAdmin"] } },
|
|
57
58
|
];
|
|
58
59
|
|
|
59
60
|
export const APP_FEATURES = [
|
|
@@ -2679,7 +2679,7 @@
|
|
|
2679
2679
|
},
|
|
2680
2680
|
{
|
|
2681
2681
|
"name": "signature",
|
|
2682
|
-
"description": "Signature requests: a signed-in user asks several people to sign one PDF of the tenant. Each signer draws a signature on a display in person or through a link in the URL fragment (14 days, limited opens, revocable, single-use, one answer for every rejection). The last signature moves the request to all-signed; a job renders a signature page through the injected print function, appends it to the unchanged original and completes the request. Events completed, declined and
|
|
2682
|
+
"description": "Signature requests: a signed-in user asks several people to sign one PDF of the tenant. Each signer draws a signature on a display in person or through a link in the URL fragment (14 days, limited opens, revocable, single-use, one answer for every rejection). The last signature moves the request to all-signed; a job renders a signature page through the injected print function, appends it to the unchanged original and completes the request. Events completed, declined, expired and failed report the outcome; signer name, email, image, IP and user agent are personal data.",
|
|
2683
2683
|
"toggleableDefault": null,
|
|
2684
2684
|
"adoptsBundledLists": true,
|
|
2685
2685
|
"requires": [
|
|
@@ -2702,6 +2702,7 @@
|
|
|
2702
2702
|
"signature:write:cancel",
|
|
2703
2703
|
"signature:write:decline-by-link",
|
|
2704
2704
|
"signature:write:expire",
|
|
2705
|
+
"signature:write:fail",
|
|
2705
2706
|
"signature:write:finish",
|
|
2706
2707
|
"signature:write:issue-link",
|
|
2707
2708
|
"signature:write:link-decline",
|
|
@@ -3044,6 +3045,29 @@
|
|
|
3044
3045
|
"usesApis": [],
|
|
3045
3046
|
"extensionsUsed": [],
|
|
3046
3047
|
"configKeys": [
|
|
3048
|
+
{
|
|
3049
|
+
"key": "default-pdf-layout-slug",
|
|
3050
|
+
"qualifiedName": "template-resolver:config:default-pdf-layout-slug",
|
|
3051
|
+
"type": "text",
|
|
3052
|
+
"scope": "tenant",
|
|
3053
|
+
"default": "",
|
|
3054
|
+
"encrypted": false,
|
|
3055
|
+
"computed": false,
|
|
3056
|
+
"validated": false,
|
|
3057
|
+
"options": null,
|
|
3058
|
+
"bounds": null,
|
|
3059
|
+
"pattern": {
|
|
3060
|
+
"regex": "^(?:[a-z0-9]{1,40}(?:-[a-z0-9]{1,40}){0,5}(?::[a-z0-9]{1,40}(?:-[a-z0-9]{1,40}){0,5}){0,3})?$"
|
|
3061
|
+
},
|
|
3062
|
+
"writeRoles": [
|
|
3063
|
+
"TenantAdmin",
|
|
3064
|
+
"Admin",
|
|
3065
|
+
"SystemAdmin"
|
|
3066
|
+
],
|
|
3067
|
+
"readRoles": [
|
|
3068
|
+
"all"
|
|
3069
|
+
]
|
|
3070
|
+
},
|
|
3047
3071
|
{
|
|
3048
3072
|
"key": "resource-max-bytes",
|
|
3049
3073
|
"qualifiedName": "template-resolver:config:resource-max-bytes",
|
|
@@ -3070,9 +3094,11 @@
|
|
|
3070
3094
|
],
|
|
3071
3095
|
"secrets": [],
|
|
3072
3096
|
"writeHandlers": [
|
|
3097
|
+
"template-resolver:write:apply-layout",
|
|
3073
3098
|
"template-resolver:write:archive",
|
|
3074
3099
|
"template-resolver:write:archive-system",
|
|
3075
3100
|
"template-resolver:write:copy-locale",
|
|
3101
|
+
"template-resolver:write:create-layout",
|
|
3076
3102
|
"template-resolver:write:discard-draft",
|
|
3077
3103
|
"template-resolver:write:discard-draft-system",
|
|
3078
3104
|
"template-resolver:write:import-bundle",
|
|
@@ -3080,6 +3106,7 @@
|
|
|
3080
3106
|
"template-resolver:write:patch-draft",
|
|
3081
3107
|
"template-resolver:write:publish",
|
|
3082
3108
|
"template-resolver:write:publish-system",
|
|
3109
|
+
"template-resolver:write:publish-templates",
|
|
3083
3110
|
"template-resolver:write:reply-snippets-set",
|
|
3084
3111
|
"template-resolver:write:reset-to-system",
|
|
3085
3112
|
"template-resolver:write:resource-link-pdf",
|
|
@@ -3134,6 +3161,132 @@
|
|
|
3134
3161
|
"usesApis": [],
|
|
3135
3162
|
"extensionsUsed": [],
|
|
3136
3163
|
"configKeys": [
|
|
3164
|
+
{
|
|
3165
|
+
"key": "company-address",
|
|
3166
|
+
"qualifiedName": "tenant:config:company-address",
|
|
3167
|
+
"type": "text",
|
|
3168
|
+
"scope": "tenant",
|
|
3169
|
+
"default": "",
|
|
3170
|
+
"encrypted": false,
|
|
3171
|
+
"computed": false,
|
|
3172
|
+
"validated": false,
|
|
3173
|
+
"options": null,
|
|
3174
|
+
"bounds": null,
|
|
3175
|
+
"pattern": null,
|
|
3176
|
+
"writeRoles": [
|
|
3177
|
+
"TenantAdmin",
|
|
3178
|
+
"Admin",
|
|
3179
|
+
"SystemAdmin"
|
|
3180
|
+
],
|
|
3181
|
+
"readRoles": [
|
|
3182
|
+
"all"
|
|
3183
|
+
]
|
|
3184
|
+
},
|
|
3185
|
+
{
|
|
3186
|
+
"key": "company-bank",
|
|
3187
|
+
"qualifiedName": "tenant:config:company-bank",
|
|
3188
|
+
"type": "text",
|
|
3189
|
+
"scope": "tenant",
|
|
3190
|
+
"default": "",
|
|
3191
|
+
"encrypted": false,
|
|
3192
|
+
"computed": false,
|
|
3193
|
+
"validated": false,
|
|
3194
|
+
"options": null,
|
|
3195
|
+
"bounds": null,
|
|
3196
|
+
"pattern": null,
|
|
3197
|
+
"writeRoles": [
|
|
3198
|
+
"TenantAdmin",
|
|
3199
|
+
"Admin",
|
|
3200
|
+
"SystemAdmin"
|
|
3201
|
+
],
|
|
3202
|
+
"readRoles": [
|
|
3203
|
+
"all"
|
|
3204
|
+
]
|
|
3205
|
+
},
|
|
3206
|
+
{
|
|
3207
|
+
"key": "company-bic",
|
|
3208
|
+
"qualifiedName": "tenant:config:company-bic",
|
|
3209
|
+
"type": "text",
|
|
3210
|
+
"scope": "tenant",
|
|
3211
|
+
"default": "",
|
|
3212
|
+
"encrypted": false,
|
|
3213
|
+
"computed": false,
|
|
3214
|
+
"validated": false,
|
|
3215
|
+
"options": null,
|
|
3216
|
+
"bounds": null,
|
|
3217
|
+
"pattern": null,
|
|
3218
|
+
"writeRoles": [
|
|
3219
|
+
"TenantAdmin",
|
|
3220
|
+
"Admin",
|
|
3221
|
+
"SystemAdmin"
|
|
3222
|
+
],
|
|
3223
|
+
"readRoles": [
|
|
3224
|
+
"all"
|
|
3225
|
+
]
|
|
3226
|
+
},
|
|
3227
|
+
{
|
|
3228
|
+
"key": "company-email",
|
|
3229
|
+
"qualifiedName": "tenant:config:company-email",
|
|
3230
|
+
"type": "text",
|
|
3231
|
+
"scope": "tenant",
|
|
3232
|
+
"default": "",
|
|
3233
|
+
"encrypted": false,
|
|
3234
|
+
"computed": false,
|
|
3235
|
+
"validated": false,
|
|
3236
|
+
"options": null,
|
|
3237
|
+
"bounds": null,
|
|
3238
|
+
"pattern": null,
|
|
3239
|
+
"writeRoles": [
|
|
3240
|
+
"TenantAdmin",
|
|
3241
|
+
"Admin",
|
|
3242
|
+
"SystemAdmin"
|
|
3243
|
+
],
|
|
3244
|
+
"readRoles": [
|
|
3245
|
+
"all"
|
|
3246
|
+
]
|
|
3247
|
+
},
|
|
3248
|
+
{
|
|
3249
|
+
"key": "company-iban",
|
|
3250
|
+
"qualifiedName": "tenant:config:company-iban",
|
|
3251
|
+
"type": "text",
|
|
3252
|
+
"scope": "tenant",
|
|
3253
|
+
"default": "",
|
|
3254
|
+
"encrypted": false,
|
|
3255
|
+
"computed": false,
|
|
3256
|
+
"validated": false,
|
|
3257
|
+
"options": null,
|
|
3258
|
+
"bounds": null,
|
|
3259
|
+
"pattern": null,
|
|
3260
|
+
"writeRoles": [
|
|
3261
|
+
"TenantAdmin",
|
|
3262
|
+
"Admin",
|
|
3263
|
+
"SystemAdmin"
|
|
3264
|
+
],
|
|
3265
|
+
"readRoles": [
|
|
3266
|
+
"all"
|
|
3267
|
+
]
|
|
3268
|
+
},
|
|
3269
|
+
{
|
|
3270
|
+
"key": "company-management",
|
|
3271
|
+
"qualifiedName": "tenant:config:company-management",
|
|
3272
|
+
"type": "text",
|
|
3273
|
+
"scope": "tenant",
|
|
3274
|
+
"default": "",
|
|
3275
|
+
"encrypted": false,
|
|
3276
|
+
"computed": false,
|
|
3277
|
+
"validated": false,
|
|
3278
|
+
"options": null,
|
|
3279
|
+
"bounds": null,
|
|
3280
|
+
"pattern": null,
|
|
3281
|
+
"writeRoles": [
|
|
3282
|
+
"TenantAdmin",
|
|
3283
|
+
"Admin",
|
|
3284
|
+
"SystemAdmin"
|
|
3285
|
+
],
|
|
3286
|
+
"readRoles": [
|
|
3287
|
+
"all"
|
|
3288
|
+
]
|
|
3289
|
+
},
|
|
3137
3290
|
{
|
|
3138
3291
|
"key": "company-name",
|
|
3139
3292
|
"qualifiedName": "tenant:config:company-name",
|
|
@@ -3155,6 +3308,90 @@
|
|
|
3155
3308
|
"all"
|
|
3156
3309
|
]
|
|
3157
3310
|
},
|
|
3311
|
+
{
|
|
3312
|
+
"key": "company-phone",
|
|
3313
|
+
"qualifiedName": "tenant:config:company-phone",
|
|
3314
|
+
"type": "text",
|
|
3315
|
+
"scope": "tenant",
|
|
3316
|
+
"default": "",
|
|
3317
|
+
"encrypted": false,
|
|
3318
|
+
"computed": false,
|
|
3319
|
+
"validated": false,
|
|
3320
|
+
"options": null,
|
|
3321
|
+
"bounds": null,
|
|
3322
|
+
"pattern": null,
|
|
3323
|
+
"writeRoles": [
|
|
3324
|
+
"TenantAdmin",
|
|
3325
|
+
"Admin",
|
|
3326
|
+
"SystemAdmin"
|
|
3327
|
+
],
|
|
3328
|
+
"readRoles": [
|
|
3329
|
+
"all"
|
|
3330
|
+
]
|
|
3331
|
+
},
|
|
3332
|
+
{
|
|
3333
|
+
"key": "company-register",
|
|
3334
|
+
"qualifiedName": "tenant:config:company-register",
|
|
3335
|
+
"type": "text",
|
|
3336
|
+
"scope": "tenant",
|
|
3337
|
+
"default": "",
|
|
3338
|
+
"encrypted": false,
|
|
3339
|
+
"computed": false,
|
|
3340
|
+
"validated": false,
|
|
3341
|
+
"options": null,
|
|
3342
|
+
"bounds": null,
|
|
3343
|
+
"pattern": null,
|
|
3344
|
+
"writeRoles": [
|
|
3345
|
+
"TenantAdmin",
|
|
3346
|
+
"Admin",
|
|
3347
|
+
"SystemAdmin"
|
|
3348
|
+
],
|
|
3349
|
+
"readRoles": [
|
|
3350
|
+
"all"
|
|
3351
|
+
]
|
|
3352
|
+
},
|
|
3353
|
+
{
|
|
3354
|
+
"key": "company-vat-id",
|
|
3355
|
+
"qualifiedName": "tenant:config:company-vat-id",
|
|
3356
|
+
"type": "text",
|
|
3357
|
+
"scope": "tenant",
|
|
3358
|
+
"default": "",
|
|
3359
|
+
"encrypted": false,
|
|
3360
|
+
"computed": false,
|
|
3361
|
+
"validated": false,
|
|
3362
|
+
"options": null,
|
|
3363
|
+
"bounds": null,
|
|
3364
|
+
"pattern": null,
|
|
3365
|
+
"writeRoles": [
|
|
3366
|
+
"TenantAdmin",
|
|
3367
|
+
"Admin",
|
|
3368
|
+
"SystemAdmin"
|
|
3369
|
+
],
|
|
3370
|
+
"readRoles": [
|
|
3371
|
+
"all"
|
|
3372
|
+
]
|
|
3373
|
+
},
|
|
3374
|
+
{
|
|
3375
|
+
"key": "company-website",
|
|
3376
|
+
"qualifiedName": "tenant:config:company-website",
|
|
3377
|
+
"type": "text",
|
|
3378
|
+
"scope": "tenant",
|
|
3379
|
+
"default": "",
|
|
3380
|
+
"encrypted": false,
|
|
3381
|
+
"computed": false,
|
|
3382
|
+
"validated": false,
|
|
3383
|
+
"options": null,
|
|
3384
|
+
"bounds": null,
|
|
3385
|
+
"pattern": null,
|
|
3386
|
+
"writeRoles": [
|
|
3387
|
+
"TenantAdmin",
|
|
3388
|
+
"Admin",
|
|
3389
|
+
"SystemAdmin"
|
|
3390
|
+
],
|
|
3391
|
+
"readRoles": [
|
|
3392
|
+
"all"
|
|
3393
|
+
]
|
|
3394
|
+
},
|
|
3158
3395
|
{
|
|
3159
3396
|
"key": "locale",
|
|
3160
3397
|
"qualifiedName": "tenant:config:locale",
|
|
@@ -80,6 +80,6 @@ handler marked `agent: { risk: "high" }`. A job or an event consumer has no hand
|
|
|
80
80
|
`irreversibleWithoutEntryHandler` on `r.job` or `r.multiStreamProjection`, or the gate refuses with
|
|
81
81
|
`irreversible_operation_without_entry_handler`. The value names why no entry handler exists:
|
|
82
82
|
`rebuildable-derived-data` (the data is derived and a rebuild recreates it), `high-risk-or-cron-pipeline`
|
|
83
|
-
(a
|
|
83
|
+
(a manually started or cron pipeline that is high-risk by design, like `purge-archived-comments`) or
|
|
84
84
|
`per-dispatch-record-key` (the key belongs to one dispatch record). Hooks and routes never inherit the
|
|
85
85
|
declaration; they dispatch a `risk: "high"` handler instead.
|
|
@@ -21,7 +21,13 @@ the `table` block renders and behaves as before.
|
|
|
21
21
|
file; `maxRows` lowers the default limit of 10000 rows.
|
|
22
22
|
Reference columns export their label and timestamps use the browser time zone.
|
|
23
23
|
- `bulkActions`: row checkboxes and a selection bar. "Delete" runs the delete
|
|
24
|
-
row action once per selected row
|
|
24
|
+
row action once per selected row (done tasks are skipped); "Set status" opens
|
|
25
|
+
an actionForm once for the whole selection. Its `taskIds` field is a
|
|
26
|
+
`multiSelect` with `display: "count"`, and the `task:set-status` handler
|
|
27
|
+
updates every id in one write, bounded by `.max(MAX_BULK_SELECTION)` and
|
|
28
|
+
reading each id through the tenant-scoped executor. The form has a `preview`:
|
|
29
|
+
the `task:set-status-preview` query returns the affected tasks with old and
|
|
30
|
+
new status from the same plan function the handler applies.
|
|
25
31
|
- `table.grouping`: the server groups the list by status; each header shows the
|
|
26
32
|
group's count and estimate sum, "done" starts collapsed and the view menu
|
|
27
33
|
offers grouping by priority or none.
|
|
@@ -54,6 +60,6 @@ bun test
|
|
|
54
60
|
The test boots the feature through the boot validator and checks that a
|
|
55
61
|
misspelled key, a hidden column without the picker, an unknown density, a pinned column
|
|
56
62
|
without `pinning`, a width without `resizing` and a bulk action on a navigate
|
|
57
|
-
row action are rejected.
|
|
63
|
+
row action, a form bulk action whose `idsField` is no count list and a preview over an unknown query or field are rejected.
|
|
58
64
|
`workload.integration.test.ts` runs the hand-written query over HTTP and checks
|
|
59
|
-
the grouped sums and the filtered total.
|
|
65
|
+
the grouped sums and the filtered total, the preview query, and the handler's unknown-id and over-cap rejections.
|
|
@@ -15,7 +15,8 @@ import {
|
|
|
15
15
|
entityListSchema,
|
|
16
16
|
type FeatureDefinition,
|
|
17
17
|
} from "@cosmicdrift/kumiko-framework/engine";
|
|
18
|
-
import
|
|
18
|
+
import { failNotFound, NotFoundError } from "@cosmicdrift/kumiko-framework/errors";
|
|
19
|
+
import { type ListTableOptions, MAX_BULK_SELECTION } from "@cosmicdrift/kumiko-framework/ui-types";
|
|
19
20
|
import { z } from "zod";
|
|
20
21
|
|
|
21
22
|
export const taskEntity = createEntity({
|
|
@@ -60,6 +61,39 @@ export const openAccess = {
|
|
|
60
61
|
},
|
|
61
62
|
} as const;
|
|
62
63
|
|
|
64
|
+
const setStatusInput = z.object({
|
|
65
|
+
taskIds: z.array(z.uuid()).min(1).max(MAX_BULK_SELECTION),
|
|
66
|
+
status: z.enum(taskEntity.fields.status.options),
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
type StatusPlanRow = {
|
|
70
|
+
readonly id: string;
|
|
71
|
+
readonly version: number;
|
|
72
|
+
readonly title: string;
|
|
73
|
+
readonly before: string;
|
|
74
|
+
readonly after: string;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// The one rule behind the status form: the write handler applies it and the preview query shows it.
|
|
78
|
+
async function planStatusChanges(
|
|
79
|
+
taskIds: readonly string[],
|
|
80
|
+
status: string,
|
|
81
|
+
loadTask: (id: string) => Promise<Readonly<Record<string, unknown>> | null | undefined>,
|
|
82
|
+
): Promise<{ readonly rows: readonly StatusPlanRow[] } | { readonly missingId: string }> {
|
|
83
|
+
const rows: StatusPlanRow[] = [];
|
|
84
|
+
for (const id of taskIds) {
|
|
85
|
+
const task = await loadTask(id);
|
|
86
|
+
if (!task) return { missingId: id };
|
|
87
|
+
rows.push({
|
|
88
|
+
id,
|
|
89
|
+
version: Number(task["version"]),
|
|
90
|
+
title: String(task["title"]),
|
|
91
|
+
before: String(task["status"]),
|
|
92
|
+
after: status,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return { rows };
|
|
96
|
+
}
|
|
63
97
|
// Overridable so a test can feed the boot validator a block that must be rejected.
|
|
64
98
|
export function createTaskBoardFeature(
|
|
65
99
|
taskTable: ListTableOptions = {
|
|
@@ -143,8 +177,17 @@ export function createTaskBoardFeature(
|
|
|
143
177
|
visible: { field: "status", ne: "done" },
|
|
144
178
|
},
|
|
145
179
|
],
|
|
146
|
-
// Row checkboxes and a selection bar;
|
|
147
|
-
bulkActions: [
|
|
180
|
+
// Row checkboxes and a selection bar; delete writes once per row, set-status once for all.
|
|
181
|
+
bulkActions: [
|
|
182
|
+
{ id: "delete", rowAction: "delete" },
|
|
183
|
+
{
|
|
184
|
+
id: "set-status",
|
|
185
|
+
label: "Set status",
|
|
186
|
+
icon: "pencil",
|
|
187
|
+
screen: "task-set-status",
|
|
188
|
+
idsField: "taskIds",
|
|
189
|
+
},
|
|
190
|
+
],
|
|
148
191
|
access: openAccess.access,
|
|
149
192
|
});
|
|
150
193
|
|
|
@@ -240,6 +283,83 @@ export function createTaskBoardFeature(
|
|
|
240
283
|
},
|
|
241
284
|
});
|
|
242
285
|
|
|
286
|
+
// One write for the whole selection: the bulk action below opens this form and `taskIds`
|
|
287
|
+
// arrives as a string array. The client cap is no protection, so the schema bounds the list
|
|
288
|
+
// and every id is read through the tenant-scoped executor before anything is written.
|
|
289
|
+
r.writeHandler({
|
|
290
|
+
name: "task:set-status",
|
|
291
|
+
schema: setStatusInput.extend({ note: z.string().optional() }),
|
|
292
|
+
access: openAccess.access,
|
|
293
|
+
handler: async (event, ctx) => {
|
|
294
|
+
const { taskIds, status, note } = event.payload;
|
|
295
|
+
const plan = await planStatusChanges(taskIds, status, (id) =>
|
|
296
|
+
taskExecutor.detail({ id }, event.user, ctx.db),
|
|
297
|
+
);
|
|
298
|
+
if ("missingId" in plan) return failNotFound("task", plan.missingId);
|
|
299
|
+
const changed = plan.rows.filter((row) => row.before !== row.after);
|
|
300
|
+
for (const row of changed) {
|
|
301
|
+
const result = await taskExecutor.update(
|
|
302
|
+
{ id: row.id, version: row.version, changes: { status, note } },
|
|
303
|
+
event.user,
|
|
304
|
+
ctx.db,
|
|
305
|
+
);
|
|
306
|
+
if (!result.isSuccess) return result;
|
|
307
|
+
}
|
|
308
|
+
return { isSuccess: true as const, data: { count: changed.length } };
|
|
309
|
+
},
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
// The preview runs the same plan the write handler runs, so the two cannot drift apart.
|
|
313
|
+
r.queryHandler({
|
|
314
|
+
name: "task:set-status-preview",
|
|
315
|
+
schema: setStatusInput,
|
|
316
|
+
access: openAccess.access,
|
|
317
|
+
handler: async (query, ctx) => {
|
|
318
|
+
const { taskIds, status } = query.payload;
|
|
319
|
+
const plan = await planStatusChanges(taskIds, status, (id) =>
|
|
320
|
+
taskExecutor.detail({ id }, query.user, ctx.db),
|
|
321
|
+
);
|
|
322
|
+
if ("missingId" in plan) throw new NotFoundError("task");
|
|
323
|
+
return {
|
|
324
|
+
count: plan.rows.filter((row) => row.before !== row.after).length,
|
|
325
|
+
tasks: plan.rows.map(({ title, before, after }) => ({ title, before, after })),
|
|
326
|
+
};
|
|
327
|
+
},
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
r.screen({
|
|
331
|
+
id: "task-set-status",
|
|
332
|
+
type: "actionForm",
|
|
333
|
+
dormant: true,
|
|
334
|
+
handler: "task-board:write:task:set-status",
|
|
335
|
+
listScreenId: "task-list",
|
|
336
|
+
redirect: "task-list",
|
|
337
|
+
fields: {
|
|
338
|
+
taskIds: { type: "multiSelect", options: [], display: "count" },
|
|
339
|
+
status: createSelectField({
|
|
340
|
+
options: ["open", "inProgress", "blocked", "done"] as const,
|
|
341
|
+
required: true,
|
|
342
|
+
}),
|
|
343
|
+
note: createTextField({ personal: false, reason: "is_business_data" }),
|
|
344
|
+
},
|
|
345
|
+
layout: { sections: [{ fields: ["taskIds", "status", "note"] }] },
|
|
346
|
+
// Which tasks change and from what to what, shown before the user submits.
|
|
347
|
+
preview: {
|
|
348
|
+
query: "task-board:query:task:set-status-preview",
|
|
349
|
+
fields: ["taskIds", "status"],
|
|
350
|
+
title: "Preview",
|
|
351
|
+
facts: [{ field: "count", label: "Tasks that change" }],
|
|
352
|
+
list: {
|
|
353
|
+
field: "tasks",
|
|
354
|
+
columns: [
|
|
355
|
+
{ field: "title", label: "Task" },
|
|
356
|
+
{ field: "before", label: "Now" },
|
|
357
|
+
{ field: "after", label: "New" },
|
|
358
|
+
],
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
});
|
|
362
|
+
|
|
243
363
|
r.nav({ id: "tasks", label: "task-board:nav.tasks", icon: "list", order: 10 });
|
|
244
364
|
r.nav({
|
|
245
365
|
id: "task-list",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# PDF Letterhead
|
|
2
|
+
|
|
3
|
+
A PDF layout with its own look, a letter with an address frame, and the transfer of the layout to templates.
|
|
4
|
+
|
|
5
|
+
## What it shows
|
|
6
|
+
|
|
7
|
+
- A system `pdf-layout` with a header, a footer in three columns (a borderless table) that prints the company placeholders `companyAddress`, `companyIban` and `companyBic`, and appearance in `meta`: font, size, table style and page margins in mm.
|
|
8
|
+
- A `document-pdf` letter with an address frame (`data-frame`, preset `address`) at the DIN 5008 form B window position, and a text style (`data-text-style`) on a run of text.
|
|
9
|
+
- Company placeholders read the tenant's own settings (`tenant:config:company-*`); the validate query lists the ones a tenant has left empty.
|
|
10
|
+
- `apply-layout` hands the layout to chosen templates as drafts (mode `selected`) or makes it the tenant default (mode `all`, no copies); `publish-templates` activates the drafts together; the usage query lists which templates use the layout.
|
|
11
|
+
|
|
12
|
+
## Source
|
|
13
|
+
|
|
14
|
+
`src/letterhead.ts` holds the layout, the letter and the tenant-editable list; the app passes the list to `createTemplateResolverFeature({ tenantEditable })`.
|
|
15
|
+
|
|
16
|
+
## Tests
|
|
17
|
+
|
|
18
|
+
Needs a running Postgres and `TEST_DATABASE_URL` set (e.g. `postgres://postgres:postgres@127.0.0.1:5432/postgres`, see `demo/.env.example`).
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
cd samples/recipes/pdf-letterhead
|
|
22
|
+
bun test
|
|
23
|
+
```
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cosmicdrift/kumiko-sample-pdf-letterhead",
|
|
3
|
+
"description": "A PDF letterhead as a layout with its own appearance and company-data footer, a letter with an address frame, and the transfer of the layout to templates (apply-layout, publish-templates).",
|
|
4
|
+
"private": true,
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"@cosmicdrift/kumiko-bundled-features": "workspace:*",
|
|
7
|
+
"@cosmicdrift/kumiko-framework": "workspace:*"
|
|
8
|
+
},
|
|
9
|
+
"devDependencies": {
|
|
10
|
+
"@cosmicdrift/kumiko-testing": "workspace:*"
|
|
11
|
+
}
|
|
12
|
+
}
|