@cosmicdrift/kumiko-bundled-features 0.412.0 → 0.413.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/dist/admin-shell/feature.d.ts +1 -1
- package/dist/agent-tools/api-docs/anchors.js +1 -1
- package/dist/auth-email-password/boot-rules.d.ts +7 -0
- package/dist/auth-email-password/boot-rules.js +7 -0
- package/dist/auth-email-password/feature.js +6 -13
- package/dist/auth-email-password/validate-options.d.ts +5 -0
- package/dist/auth-email-password/validate-options.js +15 -0
- package/dist/billing-foundation/boot-rules.d.ts +22 -0
- package/dist/billing-foundation/boot-rules.js +22 -0
- package/dist/billing-foundation/validate-options.js +56 -18
- package/dist/cap-overview/boot-rules.d.ts +12 -0
- package/dist/cap-overview/boot-rules.js +12 -0
- package/dist/cap-overview/feature.js +8 -3
- package/dist/documents/boot-rules.d.ts +12 -0
- package/dist/documents/boot-rules.js +12 -0
- package/dist/documents/feature.js +8 -3
- package/dist/file-derivatives/boot-rules.d.ts +7 -0
- package/dist/file-derivatives/boot-rules.js +7 -0
- package/dist/file-derivatives/feature.js +5 -2
- package/dist/folders/boot-rules.d.ts +7 -0
- package/dist/folders/boot-rules.js +7 -0
- package/dist/folders/feature.js +8 -5
- package/dist/helpdesk/boot-rules.d.ts +7 -0
- package/dist/helpdesk/boot-rules.js +7 -0
- package/dist/{contact → helpdesk}/challenge.js +2 -2
- package/dist/helpdesk/client/helpdesk-client-source.d.ts +1 -0
- package/dist/{contact/client/contact-client-source.js → helpdesk/client/helpdesk-client-source.js} +4 -4
- package/dist/helpdesk/client/helpdesk-website-client.d.ts +26 -0
- package/dist/helpdesk/client/index.d.ts +2 -0
- package/dist/helpdesk/client/index.js +1 -0
- package/dist/{contact → helpdesk}/entity.d.ts +6 -6
- package/dist/{contact → helpdesk}/entity.js +31 -27
- package/dist/helpdesk/feature.d.ts +3 -0
- package/dist/{contact → helpdesk}/feature.js +43 -39
- package/dist/{contact → helpdesk}/handlers/attempts.d.ts +2 -2
- package/dist/helpdesk/handlers/challenge.query.d.ts +9 -0
- package/dist/{contact → helpdesk}/handlers/challenge.query.js +5 -5
- package/dist/helpdesk/handlers/forward-request.write.d.ts +9 -0
- package/dist/{contact → helpdesk}/handlers/forward-request.write.js +17 -15
- package/dist/{contact → helpdesk}/handlers/mark-done.write.d.ts +2 -2
- package/dist/{contact → helpdesk}/handlers/mark-done.write.js +8 -8
- package/dist/{contact → helpdesk}/handlers/notify-reporter-in-app.write.d.ts +2 -2
- package/dist/{contact → helpdesk}/handlers/notify-reporter-in-app.write.js +11 -11
- package/dist/{contact → helpdesk}/handlers/open-count.js +2 -2
- package/dist/{contact → helpdesk}/handlers/open-count.query.js +4 -4
- package/dist/{contact → helpdesk}/handlers/replies.query.js +6 -6
- package/dist/{contact → helpdesk}/handlers/reply.write.d.ts +4 -4
- package/dist/{contact → helpdesk}/handlers/reply.write.js +16 -16
- package/dist/helpdesk/handlers/report.write.d.ts +16 -0
- package/dist/{contact → helpdesk}/handlers/report.write.js +17 -17
- package/dist/helpdesk/handlers/request-delivery.query.d.ts +16 -0
- package/dist/{contact → helpdesk}/handlers/request-delivery.query.js +24 -24
- package/dist/{contact → helpdesk}/handlers/request-detail.query.d.ts +3 -3
- package/dist/{contact → helpdesk}/handlers/request-detail.query.js +10 -10
- package/dist/{contact → helpdesk}/handlers/request-list.query.js +2 -2
- package/dist/helpdesk/handlers/send-reply-mail.write.d.ts +8 -0
- package/dist/{contact → helpdesk}/handlers/send-reply-mail.write.js +15 -15
- package/dist/helpdesk/handlers/send-test.write.d.ts +5 -0
- package/dist/{contact → helpdesk}/handlers/send-test.write.js +10 -10
- package/dist/{contact → helpdesk}/handlers/submit.write.d.ts +4 -4
- package/dist/{contact → helpdesk}/handlers/submit.write.js +17 -17
- package/dist/{contact → helpdesk}/handlers/take-over-uploads.js +5 -5
- package/dist/{contact → helpdesk}/i18n.d.ts +1 -1
- package/dist/{contact → helpdesk}/i18n.js +78 -75
- package/dist/helpdesk/index.d.ts +5 -0
- package/dist/helpdesk/index.js +4 -0
- package/dist/{contact → helpdesk}/lib.d.ts +5 -5
- package/dist/{contact → helpdesk}/lib.js +16 -16
- package/dist/{contact → helpdesk}/mail.d.ts +20 -20
- package/dist/{contact → helpdesk}/mail.js +47 -47
- package/dist/{contact → helpdesk}/options.d.ts +6 -6
- package/dist/helpdesk/options.js +36 -0
- package/dist/helpdesk/panels.d.ts +2 -0
- package/dist/helpdesk/panels.js +21 -0
- package/dist/{contact → helpdesk}/payloads.d.ts +11 -11
- package/dist/{contact → helpdesk}/payloads.js +28 -28
- package/dist/helpdesk/screens.d.ts +5 -0
- package/dist/{contact → helpdesk}/screens.js +87 -87
- package/dist/{contact → helpdesk}/subject.js +3 -3
- package/dist/helpdesk/user-data-hooks.d.ts +3 -0
- package/dist/{contact → helpdesk}/user-data-hooks.js +15 -15
- package/dist/helpdesk/web/constants.d.ts +127 -0
- package/dist/helpdesk/web/constants.js +126 -0
- package/dist/helpdesk/web/index.d.ts +1 -0
- package/dist/helpdesk/web/index.js +1 -0
- package/dist/host-routing/boot-rules.d.ts +22 -0
- package/dist/host-routing/boot-rules.js +22 -0
- package/dist/host-routing/validate-options.js +35 -11
- package/dist/jobs/boot-rules.d.ts +7 -0
- package/dist/jobs/boot-rules.js +7 -0
- package/dist/jobs/feature.js +5 -2
- package/dist/legal-pages/boot-rules.d.ts +17 -0
- package/dist/legal-pages/boot-rules.js +17 -0
- package/dist/legal-pages/feature.js +5 -2
- package/dist/legal-pages/lib/validate-routes.js +11 -3
- package/dist/metrics/boot-rules.d.ts +12 -0
- package/dist/metrics/boot-rules.js +12 -0
- package/dist/metrics/validate.js +8 -2
- package/dist/notes-history/boot-rules.d.ts +7 -0
- package/dist/notes-history/boot-rules.js +7 -0
- package/dist/notes-history/feature.js +7 -4
- package/dist/personal-access-tokens/boot-rules.d.ts +7 -0
- package/dist/personal-access-tokens/boot-rules.js +7 -0
- package/dist/personal-access-tokens/scope-events-check.js +7 -4
- package/dist/presence/boot-rules.d.ts +7 -0
- package/dist/presence/boot-rules.js +7 -0
- package/dist/presence/options.js +5 -1
- package/dist/readiness/boot-rules.d.ts +12 -0
- package/dist/readiness/boot-rules.js +12 -0
- package/dist/readiness/probe-boot-check.js +8 -3
- package/dist/shared/assert-no-where-rule-in-ownership-write.d.ts +1 -1
- package/dist/shared/assert-no-where-rule-in-ownership-write.js +11 -7
- package/dist/shared/boot-rules.d.ts +7 -0
- package/dist/shared/boot-rules.js +7 -0
- package/dist/subscription-mollie/boot-rules.d.ts +17 -0
- package/dist/subscription-mollie/boot-rules.js +17 -0
- package/dist/subscription-mollie/feature.js +13 -6
- package/dist/tags/boot-rules.d.ts +7 -0
- package/dist/tags/boot-rules.js +7 -0
- package/dist/tags/feature.js +8 -5
- package/dist/template-resolver/boot-rules.d.ts +17 -0
- package/dist/template-resolver/boot-rules.js +17 -0
- package/dist/template-resolver/feature.js +14 -5
- package/dist/tenant/boot-rules.d.ts +7 -0
- package/dist/tenant/boot-rules.js +7 -0
- package/dist/tenant/feature.js +5 -2
- package/kumiko-es-tables.json +4 -4
- package/package.json +29 -29
- package/src/{contact → helpdesk}/changes.json +6 -0
- package/dist/contact/client/contact-client-source.d.ts +0 -1
- package/dist/contact/client/contact-website-client.d.ts +0 -26
- package/dist/contact/client/index.d.ts +0 -2
- package/dist/contact/client/index.js +0 -1
- package/dist/contact/feature.d.ts +0 -3
- package/dist/contact/handlers/challenge.query.d.ts +0 -9
- package/dist/contact/handlers/forward-request.write.d.ts +0 -9
- package/dist/contact/handlers/report.write.d.ts +0 -16
- package/dist/contact/handlers/request-delivery.query.d.ts +0 -16
- package/dist/contact/handlers/send-reply-mail.write.d.ts +0 -8
- package/dist/contact/handlers/send-test.write.d.ts +0 -5
- package/dist/contact/index.d.ts +0 -5
- package/dist/contact/index.js +0 -4
- package/dist/contact/options.js +0 -32
- package/dist/contact/panels.d.ts +0 -2
- package/dist/contact/panels.js +0 -21
- package/dist/contact/screens.d.ts +0 -5
- package/dist/contact/user-data-hooks.d.ts +0 -3
- package/dist/contact/web/constants.d.ts +0 -127
- package/dist/contact/web/constants.js +0 -126
- package/dist/contact/web/index.d.ts +0 -1
- package/dist/contact/web/index.js +0 -1
- /package/dist/{contact → helpdesk}/challenge.d.ts +0 -0
- /package/dist/{contact/client/contact-website-client.js → helpdesk/client/helpdesk-website-client.js} +0 -0
- /package/dist/{contact → helpdesk}/handlers/access.d.ts +0 -0
- /package/dist/{contact → helpdesk}/handlers/access.js +0 -0
- /package/dist/{contact → helpdesk}/handlers/attempts.js +0 -0
- /package/dist/{contact → helpdesk}/handlers/open-count.d.ts +0 -0
- /package/dist/{contact → helpdesk}/handlers/open-count.query.d.ts +0 -0
- /package/dist/{contact → helpdesk}/handlers/replies.query.d.ts +0 -0
- /package/dist/{contact → helpdesk}/handlers/request-list.query.d.ts +0 -0
- /package/dist/{contact → helpdesk}/handlers/take-over-uploads.d.ts +0 -0
- /package/dist/{contact → helpdesk}/pow.d.ts +0 -0
- /package/dist/{contact → helpdesk}/pow.js +0 -0
- /package/dist/{contact → helpdesk}/subject.d.ts +0 -0
- /package/dist/{contact → helpdesk}/user-agent.d.ts +0 -0
- /package/dist/{contact → helpdesk}/user-agent.js +0 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
export declare const HELPDESK_FEATURE: "helpdesk";
|
|
2
|
+
export declare const HELPDESK_KIND: {
|
|
3
|
+
readonly Question: "question";
|
|
4
|
+
readonly Contact: "contact";
|
|
5
|
+
readonly Bug: "bug";
|
|
6
|
+
readonly Wish: "wish";
|
|
7
|
+
};
|
|
8
|
+
export type HelpdeskKind = (typeof HELPDESK_KIND)[keyof typeof HELPDESK_KIND];
|
|
9
|
+
export declare const HELPDESK_WEBSITE_KINDS: readonly ["question", "contact", "bug"];
|
|
10
|
+
export declare const HELPDESK_ADMIN_KINDS: readonly ["question", "bug", "wish"];
|
|
11
|
+
export declare const HELPDESK_STATUS: {
|
|
12
|
+
readonly Open: "open";
|
|
13
|
+
readonly Answered: "answered";
|
|
14
|
+
readonly Done: "done";
|
|
15
|
+
};
|
|
16
|
+
export type HelpdeskStatus = (typeof HELPDESK_STATUS)[keyof typeof HELPDESK_STATUS];
|
|
17
|
+
export declare const HELPDESK_SOURCE: {
|
|
18
|
+
readonly Website: "website";
|
|
19
|
+
readonly Admin: "admin";
|
|
20
|
+
};
|
|
21
|
+
export type HelpdeskSource = (typeof HELPDESK_SOURCE)[keyof typeof HELPDESK_SOURCE];
|
|
22
|
+
export declare const HELPDESK_REPLY_CHANNELS: {
|
|
23
|
+
readonly Email: "email";
|
|
24
|
+
readonly EmailAndInApp: "email+inApp";
|
|
25
|
+
};
|
|
26
|
+
export type HelpdeskReplyChannels = (typeof HELPDESK_REPLY_CHANNELS)[keyof typeof HELPDESK_REPLY_CHANNELS];
|
|
27
|
+
export declare const HELPDESK_ORIGIN: {
|
|
28
|
+
readonly Website: "website";
|
|
29
|
+
readonly AdminReport: "admin-report";
|
|
30
|
+
};
|
|
31
|
+
export type HelpdeskOrigin = (typeof HELPDESK_ORIGIN)[keyof typeof HELPDESK_ORIGIN];
|
|
32
|
+
export declare const HELPDESK_DELIVERY_CHANNEL: {
|
|
33
|
+
readonly Email: "email";
|
|
34
|
+
readonly Telegram: "telegram";
|
|
35
|
+
readonly ReplyEmail: "reply-email";
|
|
36
|
+
readonly ReplyInApp: "reply-in-app";
|
|
37
|
+
};
|
|
38
|
+
export type HelpdeskDeliveryChannel = (typeof HELPDESK_DELIVERY_CHANNEL)[keyof typeof HELPDESK_DELIVERY_CHANNEL];
|
|
39
|
+
export declare const HELPDESK_DELIVERY_STATUS: {
|
|
40
|
+
readonly Pending: "pending";
|
|
41
|
+
readonly Delivered: "delivered";
|
|
42
|
+
readonly Failed: "failed";
|
|
43
|
+
readonly Skipped: "skipped";
|
|
44
|
+
readonly Read: "read";
|
|
45
|
+
};
|
|
46
|
+
export type HelpdeskDeliveryStatus = (typeof HELPDESK_DELIVERY_STATUS)[keyof typeof HELPDESK_DELIVERY_STATUS];
|
|
47
|
+
export type HelpdeskPhoneMode = "off" | "optional" | "required";
|
|
48
|
+
export declare const HelpdeskHandlers: {
|
|
49
|
+
readonly submit: "helpdesk:write:submit";
|
|
50
|
+
readonly report: "helpdesk:write:report";
|
|
51
|
+
readonly reply: "helpdesk:write:reply";
|
|
52
|
+
readonly markDone: "helpdesk:write:mark-done";
|
|
53
|
+
readonly sendTest: "helpdesk:write:send-test";
|
|
54
|
+
readonly forwardRequest: "helpdesk:write:forward-request";
|
|
55
|
+
readonly sendReplyMail: "helpdesk:write:send-reply-mail";
|
|
56
|
+
readonly notifyReporterInApp: "helpdesk:write:notify-reporter-in-app";
|
|
57
|
+
};
|
|
58
|
+
export declare const HelpdeskQueries: {
|
|
59
|
+
readonly challenge: "helpdesk:query:challenge";
|
|
60
|
+
readonly openCount: "helpdesk:query:open-count";
|
|
61
|
+
readonly requestDetail: "helpdesk:query:request-detail";
|
|
62
|
+
readonly replies: "helpdesk:query:replies";
|
|
63
|
+
readonly requestDelivery: "helpdesk:query:request-delivery";
|
|
64
|
+
readonly requestList: "helpdesk:query:helpdesk-request:list";
|
|
65
|
+
};
|
|
66
|
+
export declare const HelpdeskScreens: {
|
|
67
|
+
readonly requestList: "helpdesk:screen:request-list";
|
|
68
|
+
readonly requestDetail: "helpdesk:screen:request-detail";
|
|
69
|
+
readonly report: "helpdesk:screen:report";
|
|
70
|
+
readonly reply: "helpdesk:screen:reply";
|
|
71
|
+
readonly replyMail: "helpdesk:screen:reply-mail";
|
|
72
|
+
readonly forwarding: "helpdesk:screen:forwarding";
|
|
73
|
+
};
|
|
74
|
+
export declare const HELPDESK_UPLOAD_FIELD: "fileIds";
|
|
75
|
+
export declare const HelpdeskConfigKeys: {
|
|
76
|
+
readonly replyTo: "helpdesk:config:reply-to";
|
|
77
|
+
readonly telegramChat: "helpdesk:config:telegram-chat";
|
|
78
|
+
};
|
|
79
|
+
export declare const HelpdeskErrors: {
|
|
80
|
+
readonly telegramChatMissing: "telegram_chat_missing";
|
|
81
|
+
readonly telegramTestFailed: "telegram_test_failed";
|
|
82
|
+
readonly notFound: "helpdesk_request_not_found";
|
|
83
|
+
readonly phoneNotAllowed: "helpdesk_phone_not_allowed";
|
|
84
|
+
readonly phoneRequired: "helpdesk_phone_required";
|
|
85
|
+
readonly reporterEmailMissing: "helpdesk_reporter_email_missing";
|
|
86
|
+
readonly attachmentNotFound: "helpdesk_attachment_not_found";
|
|
87
|
+
};
|
|
88
|
+
export declare const HELPDESK_NOTIFICATION_TYPES: {
|
|
89
|
+
readonly newRequest: "helpdesk:notify:new-request";
|
|
90
|
+
readonly confirmation: "helpdesk:notify:confirmation";
|
|
91
|
+
readonly acknowledgement: "helpdesk:notify:acknowledgement";
|
|
92
|
+
readonly reply: "helpdesk:notify:reply";
|
|
93
|
+
readonly replyInApp: "helpdesk:notify:reply-in-app";
|
|
94
|
+
readonly test: "helpdesk:notify:test";
|
|
95
|
+
};
|
|
96
|
+
export declare const HELPDESK_CLIENT_PATH: "/helpdesk/client.js";
|
|
97
|
+
export declare const HELPDESK_FIELD_LIMITS: {
|
|
98
|
+
readonly name: 120;
|
|
99
|
+
readonly email: 254;
|
|
100
|
+
readonly phone: 40;
|
|
101
|
+
readonly subject: 200;
|
|
102
|
+
readonly message: 5000;
|
|
103
|
+
readonly locale: 35;
|
|
104
|
+
readonly honeypot: 500;
|
|
105
|
+
readonly page: 300;
|
|
106
|
+
readonly challenge: 64;
|
|
107
|
+
readonly nonce: 32;
|
|
108
|
+
};
|
|
109
|
+
export declare const HELPDESK_MAX_FILES = 5;
|
|
110
|
+
export declare const HELPDESK_SUBJECT_MAX_CHARS = 80;
|
|
111
|
+
export declare const HELPDESK_POW_BITS: {
|
|
112
|
+
readonly min: 8;
|
|
113
|
+
readonly max: 26;
|
|
114
|
+
readonly default: 19;
|
|
115
|
+
};
|
|
116
|
+
export declare const HELPDESK_DEFAULT_MIN_SUBMIT_SECONDS = 3;
|
|
117
|
+
export declare const HELPDESK_DEFAULT_CHALLENGE_TTL_MINUTES = 30;
|
|
118
|
+
export declare const HELPDESK_CHALLENGE_REDIS_PREFIX: "helpdesk:challenge:";
|
|
119
|
+
export declare const HELPDESK_REQUEST_ENTITY: "helpdesk-request";
|
|
120
|
+
export declare const HELPDESK_REPLY_ENTITY: "helpdesk-reply";
|
|
121
|
+
export declare const helpdeskIdempotencyKeys: {
|
|
122
|
+
readonly admins: (requestId: string) => string;
|
|
123
|
+
readonly telegram: (requestId: string) => string;
|
|
124
|
+
readonly confirmation: (requestId: string) => string;
|
|
125
|
+
readonly reply: (replyId: string) => string;
|
|
126
|
+
readonly replyInApp: (replyId: string) => string;
|
|
127
|
+
};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// Pure string constants, safe for browser code (see waitlist/web/constants.ts).
|
|
2
|
+
export const HELPDESK_FEATURE = "helpdesk";
|
|
3
|
+
export const HELPDESK_KIND = {
|
|
4
|
+
Question: "question",
|
|
5
|
+
Contact: "contact",
|
|
6
|
+
Bug: "bug",
|
|
7
|
+
Wish: "wish",
|
|
8
|
+
};
|
|
9
|
+
export const HELPDESK_WEBSITE_KINDS = [
|
|
10
|
+
HELPDESK_KIND.Question,
|
|
11
|
+
HELPDESK_KIND.Contact,
|
|
12
|
+
HELPDESK_KIND.Bug,
|
|
13
|
+
];
|
|
14
|
+
export const HELPDESK_ADMIN_KINDS = [
|
|
15
|
+
HELPDESK_KIND.Question,
|
|
16
|
+
HELPDESK_KIND.Bug,
|
|
17
|
+
HELPDESK_KIND.Wish,
|
|
18
|
+
];
|
|
19
|
+
export const HELPDESK_STATUS = {
|
|
20
|
+
Open: "open",
|
|
21
|
+
Answered: "answered",
|
|
22
|
+
Done: "done",
|
|
23
|
+
};
|
|
24
|
+
export const HELPDESK_SOURCE = {
|
|
25
|
+
Website: "website",
|
|
26
|
+
Admin: "admin",
|
|
27
|
+
};
|
|
28
|
+
export const HELPDESK_REPLY_CHANNELS = {
|
|
29
|
+
Email: "email",
|
|
30
|
+
EmailAndInApp: "email+inApp",
|
|
31
|
+
};
|
|
32
|
+
export const HELPDESK_ORIGIN = {
|
|
33
|
+
Website: "website",
|
|
34
|
+
AdminReport: "admin-report",
|
|
35
|
+
};
|
|
36
|
+
export const HELPDESK_DELIVERY_CHANNEL = {
|
|
37
|
+
Email: "email",
|
|
38
|
+
Telegram: "telegram",
|
|
39
|
+
ReplyEmail: "reply-email",
|
|
40
|
+
ReplyInApp: "reply-in-app",
|
|
41
|
+
};
|
|
42
|
+
export const HELPDESK_DELIVERY_STATUS = {
|
|
43
|
+
Pending: "pending",
|
|
44
|
+
Delivered: "delivered",
|
|
45
|
+
Failed: "failed",
|
|
46
|
+
Skipped: "skipped",
|
|
47
|
+
Read: "read",
|
|
48
|
+
};
|
|
49
|
+
export const HelpdeskHandlers = {
|
|
50
|
+
submit: "helpdesk:write:submit",
|
|
51
|
+
report: "helpdesk:write:report",
|
|
52
|
+
reply: "helpdesk:write:reply",
|
|
53
|
+
markDone: "helpdesk:write:mark-done",
|
|
54
|
+
sendTest: "helpdesk:write:send-test",
|
|
55
|
+
forwardRequest: "helpdesk:write:forward-request",
|
|
56
|
+
sendReplyMail: "helpdesk:write:send-reply-mail",
|
|
57
|
+
notifyReporterInApp: "helpdesk:write:notify-reporter-in-app",
|
|
58
|
+
};
|
|
59
|
+
export const HelpdeskQueries = {
|
|
60
|
+
challenge: "helpdesk:query:challenge",
|
|
61
|
+
openCount: "helpdesk:query:open-count",
|
|
62
|
+
requestDetail: "helpdesk:query:request-detail",
|
|
63
|
+
replies: "helpdesk:query:replies",
|
|
64
|
+
requestDelivery: "helpdesk:query:request-delivery",
|
|
65
|
+
// Entity-convention list QN: entityList screens resolve their query by this shape.
|
|
66
|
+
requestList: "helpdesk:query:helpdesk-request:list",
|
|
67
|
+
};
|
|
68
|
+
export const HelpdeskScreens = {
|
|
69
|
+
requestList: "helpdesk:screen:request-list",
|
|
70
|
+
requestDetail: "helpdesk:screen:request-detail",
|
|
71
|
+
report: "helpdesk:screen:report",
|
|
72
|
+
reply: "helpdesk:screen:reply",
|
|
73
|
+
replyMail: "helpdesk:screen:reply-mail",
|
|
74
|
+
forwarding: "helpdesk:screen:forwarding",
|
|
75
|
+
};
|
|
76
|
+
// Files field of both upload forms (report, reply); the uploads are pending under the screen QN.
|
|
77
|
+
export const HELPDESK_UPLOAD_FIELD = "fileIds";
|
|
78
|
+
export const HelpdeskConfigKeys = {
|
|
79
|
+
replyTo: "helpdesk:config:reply-to",
|
|
80
|
+
telegramChat: "helpdesk:config:telegram-chat",
|
|
81
|
+
};
|
|
82
|
+
export const HelpdeskErrors = {
|
|
83
|
+
telegramChatMissing: "telegram_chat_missing",
|
|
84
|
+
telegramTestFailed: "telegram_test_failed",
|
|
85
|
+
notFound: "helpdesk_request_not_found",
|
|
86
|
+
phoneNotAllowed: "helpdesk_phone_not_allowed",
|
|
87
|
+
phoneRequired: "helpdesk_phone_required",
|
|
88
|
+
reporterEmailMissing: "helpdesk_reporter_email_missing",
|
|
89
|
+
attachmentNotFound: "helpdesk_attachment_not_found",
|
|
90
|
+
};
|
|
91
|
+
export const HELPDESK_NOTIFICATION_TYPES = {
|
|
92
|
+
newRequest: "helpdesk:notify:new-request",
|
|
93
|
+
confirmation: "helpdesk:notify:confirmation",
|
|
94
|
+
acknowledgement: "helpdesk:notify:acknowledgement",
|
|
95
|
+
reply: "helpdesk:notify:reply",
|
|
96
|
+
replyInApp: "helpdesk:notify:reply-in-app",
|
|
97
|
+
test: "helpdesk:notify:test",
|
|
98
|
+
};
|
|
99
|
+
export const HELPDESK_CLIENT_PATH = "/helpdesk/client.js";
|
|
100
|
+
export const HELPDESK_FIELD_LIMITS = {
|
|
101
|
+
name: 120,
|
|
102
|
+
email: 254,
|
|
103
|
+
phone: 40,
|
|
104
|
+
subject: 200,
|
|
105
|
+
message: 5000,
|
|
106
|
+
locale: 35,
|
|
107
|
+
honeypot: 500,
|
|
108
|
+
page: 300,
|
|
109
|
+
challenge: 64,
|
|
110
|
+
nonce: 32,
|
|
111
|
+
};
|
|
112
|
+
export const HELPDESK_MAX_FILES = 5;
|
|
113
|
+
export const HELPDESK_SUBJECT_MAX_CHARS = 80;
|
|
114
|
+
export const HELPDESK_POW_BITS = { min: 8, max: 26, default: 19 };
|
|
115
|
+
export const HELPDESK_DEFAULT_MIN_SUBMIT_SECONDS = 3;
|
|
116
|
+
export const HELPDESK_DEFAULT_CHALLENGE_TTL_MINUTES = 30;
|
|
117
|
+
export const HELPDESK_CHALLENGE_REDIS_PREFIX = "helpdesk:challenge:";
|
|
118
|
+
export const HELPDESK_REQUEST_ENTITY = "helpdesk-request";
|
|
119
|
+
export const HELPDESK_REPLY_ENTITY = "helpdesk-reply";
|
|
120
|
+
export const helpdeskIdempotencyKeys = {
|
|
121
|
+
admins: (requestId) => `helpdesk:request:${requestId}:admins`,
|
|
122
|
+
telegram: (requestId) => `helpdesk:request:${requestId}:telegram`,
|
|
123
|
+
confirmation: (requestId) => `helpdesk:request:${requestId}:confirmation`,
|
|
124
|
+
reply: (replyId) => `helpdesk:reply:${replyId}`,
|
|
125
|
+
replyInApp: (replyId) => `helpdesk:reply:${replyId}:in-app`,
|
|
126
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HELPDESK_ADMIN_KINDS, HELPDESK_CLIENT_PATH, HELPDESK_DELIVERY_CHANNEL, HELPDESK_DELIVERY_STATUS, HELPDESK_FEATURE, HELPDESK_FIELD_LIMITS, HELPDESK_KIND, HELPDESK_NOTIFICATION_TYPES, HELPDESK_ORIGIN, HELPDESK_REPLY_CHANNELS, HELPDESK_SOURCE, HELPDESK_STATUS, HELPDESK_SUBJECT_MAX_CHARS, HELPDESK_WEBSITE_KINDS, HelpdeskConfigKeys, type HelpdeskDeliveryChannel, type HelpdeskDeliveryStatus, HelpdeskErrors, HelpdeskHandlers, type HelpdeskKind, type HelpdeskOrigin, type HelpdeskPhoneMode, HelpdeskQueries, type HelpdeskReplyChannels, HelpdeskScreens, type HelpdeskSource, type HelpdeskStatus, } from "./constants.ts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { HELPDESK_ADMIN_KINDS, HELPDESK_CLIENT_PATH, HELPDESK_DELIVERY_CHANNEL, HELPDESK_DELIVERY_STATUS, HELPDESK_FEATURE, HELPDESK_FIELD_LIMITS, HELPDESK_KIND, HELPDESK_NOTIFICATION_TYPES, HELPDESK_ORIGIN, HELPDESK_REPLY_CHANNELS, HELPDESK_SOURCE, HELPDESK_STATUS, HELPDESK_SUBJECT_MAX_CHARS, HELPDESK_WEBSITE_KINDS, HelpdeskConfigKeys, HelpdeskErrors, HelpdeskHandlers, HelpdeskQueries, HelpdeskScreens, } from "./constants.js";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const HOST_ROUTING_BOOT_RULES: {
|
|
2
|
+
readonly invalidRedirect: {
|
|
3
|
+
readonly id: "host-routing/invalid-redirect";
|
|
4
|
+
readonly summary: "Redirect rules use a path as from, a same-origin path or https URL as to, and a lowercase hostname as host.";
|
|
5
|
+
readonly fix: "Fix the redirect rule named in the error message.";
|
|
6
|
+
};
|
|
7
|
+
readonly invalidApexAnonymousQueryAllowlist: {
|
|
8
|
+
readonly id: "host-routing/invalid-apex-anonymous-query-allowlist";
|
|
9
|
+
readonly summary: "apexAnonymousQueryAllowlist keys are apex hostnames and the option is not combined with tenantBy path.";
|
|
10
|
+
readonly fix: "Use apex or www.<apex> keys and drop the option in path mode.";
|
|
11
|
+
};
|
|
12
|
+
readonly invalidDomainOrPrefix: {
|
|
13
|
+
readonly id: "host-routing/invalid-domain-or-prefix";
|
|
14
|
+
readonly summary: "baseDomain and hosts keys are lowercase hostnames and tenantPathPrefix is a leading-slash path.";
|
|
15
|
+
readonly fix: "Fix the domain or prefix named in the error message.";
|
|
16
|
+
};
|
|
17
|
+
readonly invalidLocales: {
|
|
18
|
+
readonly id: "host-routing/invalid-locales";
|
|
19
|
+
readonly summary: "Locales look like de or de-at and the default locale is not in prefixed.";
|
|
20
|
+
readonly fix: "Fix the locales option named in the error message.";
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const HOST_ROUTING_BOOT_RULES = {
|
|
2
|
+
invalidRedirect: {
|
|
3
|
+
id: "host-routing/invalid-redirect",
|
|
4
|
+
summary: "Redirect rules use a path as from, a same-origin path or https URL as to, and a lowercase hostname as host.",
|
|
5
|
+
fix: "Fix the redirect rule named in the error message.",
|
|
6
|
+
},
|
|
7
|
+
invalidApexAnonymousQueryAllowlist: {
|
|
8
|
+
id: "host-routing/invalid-apex-anonymous-query-allowlist",
|
|
9
|
+
summary: "apexAnonymousQueryAllowlist keys are apex hostnames and the option is not combined with tenantBy path.",
|
|
10
|
+
fix: "Use apex or www.<apex> keys and drop the option in path mode.",
|
|
11
|
+
},
|
|
12
|
+
invalidDomainOrPrefix: {
|
|
13
|
+
id: "host-routing/invalid-domain-or-prefix",
|
|
14
|
+
summary: "baseDomain and hosts keys are lowercase hostnames and tenantPathPrefix is a leading-slash path.",
|
|
15
|
+
fix: "Fix the domain or prefix named in the error message.",
|
|
16
|
+
},
|
|
17
|
+
invalidLocales: {
|
|
18
|
+
id: "host-routing/invalid-locales",
|
|
19
|
+
summary: "Locales look like de or de-at and the default locale is not in prefixed.",
|
|
20
|
+
fix: "Fix the locales option named in the error message.",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { bootRuleError } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { HOST_ROUTING_BOOT_RULES } from "./boot-rules.js";
|
|
1
3
|
import { isApexHostname } from "./host.js";
|
|
2
4
|
const DOMAIN_PATTERN = /^[a-z0-9](?:[a-z0-9.-]*[a-z0-9])?$/;
|
|
3
5
|
const PATH_PREFIX_PATTERN = /^\/[a-z0-9-]+(?:\/[a-z0-9-]+)*$/;
|
|
@@ -9,16 +11,24 @@ const REDIRECT_TARGET_PATTERN = /^(?:\/(?!\/)[A-Za-z0-9._~/-]*|https:\/\/[a-z0-9
|
|
|
9
11
|
function validateRedirects(options) {
|
|
10
12
|
for (const rule of options.redirects ?? []) {
|
|
11
13
|
if (!REDIRECT_PATH_PATTERN.test(rule.from)) {
|
|
12
|
-
throw
|
|
14
|
+
throw bootRuleError(HOST_ROUTING_BOOT_RULES.invalidRedirect, {
|
|
15
|
+
message: `host-routing: redirect from must be a path like "/old", got "${rule.from}"`,
|
|
16
|
+
});
|
|
13
17
|
}
|
|
14
18
|
if (rule.from === "/api" || rule.from.startsWith("/api/")) {
|
|
15
|
-
throw
|
|
19
|
+
throw bootRuleError(HOST_ROUTING_BOOT_RULES.invalidRedirect, {
|
|
20
|
+
message: `host-routing: redirect from must not be an /api path, it would never fire, got "${rule.from}"`,
|
|
21
|
+
});
|
|
16
22
|
}
|
|
17
23
|
if (!REDIRECT_TARGET_PATTERN.test(rule.to)) {
|
|
18
|
-
throw
|
|
24
|
+
throw bootRuleError(HOST_ROUTING_BOOT_RULES.invalidRedirect, {
|
|
25
|
+
message: `host-routing: redirect to must be a same-origin path or an https URL without query, got "${rule.to}"`,
|
|
26
|
+
});
|
|
19
27
|
}
|
|
20
28
|
if (rule.host !== undefined && !DOMAIN_PATTERN.test(rule.host)) {
|
|
21
|
-
throw
|
|
29
|
+
throw bootRuleError(HOST_ROUTING_BOOT_RULES.invalidRedirect, {
|
|
30
|
+
message: `host-routing: redirect host must be a lowercase hostname, got "${rule.host}"`,
|
|
31
|
+
});
|
|
22
32
|
}
|
|
23
33
|
}
|
|
24
34
|
}
|
|
@@ -26,11 +36,15 @@ function validateAnonymousQueryAllowlist(options) {
|
|
|
26
36
|
if (options.apexAnonymousQueryAllowlist !== undefined && options.tenantBy === "path") {
|
|
27
37
|
// Path mode resolves as fallback-only: a client-sent X-Tenant or cookie wins
|
|
28
38
|
// before the resolver runs, so the allowlist could never hold.
|
|
29
|
-
throw
|
|
39
|
+
throw bootRuleError(HOST_ROUTING_BOOT_RULES.invalidApexAnonymousQueryAllowlist, {
|
|
40
|
+
message: 'host-routing: apexAnonymousQueryAllowlist cannot be used with tenantBy "path", because the client names its tenant there and bypasses the allowlist',
|
|
41
|
+
});
|
|
30
42
|
}
|
|
31
43
|
for (const host of Object.keys(options.apexAnonymousQueryAllowlist ?? {})) {
|
|
32
44
|
if (!isApexHostname(host, options.baseDomain)) {
|
|
33
|
-
throw
|
|
45
|
+
throw bootRuleError(HOST_ROUTING_BOOT_RULES.invalidApexAnonymousQueryAllowlist, {
|
|
46
|
+
message: `host-routing: apexAnonymousQueryAllowlist key must be the apex or www.<apex> hostname, got "${host}"`,
|
|
47
|
+
});
|
|
34
48
|
}
|
|
35
49
|
}
|
|
36
50
|
}
|
|
@@ -38,16 +52,22 @@ function validateAnonymousQueryAllowlist(options) {
|
|
|
38
52
|
// the boot instead of routing every request to a 404.
|
|
39
53
|
export function validateHostRoutingOptions(options) {
|
|
40
54
|
if (!DOMAIN_PATTERN.test(options.baseDomain)) {
|
|
41
|
-
throw
|
|
55
|
+
throw bootRuleError(HOST_ROUTING_BOOT_RULES.invalidDomainOrPrefix, {
|
|
56
|
+
message: `host-routing: baseDomain must be a lowercase hostname without port, got "${options.baseDomain}"`,
|
|
57
|
+
});
|
|
42
58
|
}
|
|
43
59
|
for (const host of Object.keys(options.hosts ?? {})) {
|
|
44
60
|
if (!DOMAIN_PATTERN.test(host)) {
|
|
45
|
-
throw
|
|
61
|
+
throw bootRuleError(HOST_ROUTING_BOOT_RULES.invalidDomainOrPrefix, {
|
|
62
|
+
message: `host-routing: hosts key must be a lowercase hostname, got "${host}"`,
|
|
63
|
+
});
|
|
46
64
|
}
|
|
47
65
|
}
|
|
48
66
|
if (options.tenantPathPrefix !== undefined &&
|
|
49
67
|
!PATH_PREFIX_PATTERN.test(options.tenantPathPrefix)) {
|
|
50
|
-
throw
|
|
68
|
+
throw bootRuleError(HOST_ROUTING_BOOT_RULES.invalidDomainOrPrefix, {
|
|
69
|
+
message: `host-routing: tenantPathPrefix must look like "/app" (leading slash, no trailing slash), got "${options.tenantPathPrefix}"`,
|
|
70
|
+
});
|
|
51
71
|
}
|
|
52
72
|
validateRedirects(options);
|
|
53
73
|
validateAnonymousQueryAllowlist(options);
|
|
@@ -55,11 +75,15 @@ export function validateHostRoutingOptions(options) {
|
|
|
55
75
|
if (locales !== undefined) {
|
|
56
76
|
for (const locale of [locales.default, ...locales.prefixed]) {
|
|
57
77
|
if (!LOCALE_PATTERN.test(locale)) {
|
|
58
|
-
throw
|
|
78
|
+
throw bootRuleError(HOST_ROUTING_BOOT_RULES.invalidLocales, {
|
|
79
|
+
message: `host-routing: locale must look like "de" or "de-at", got "${locale}"`,
|
|
80
|
+
});
|
|
59
81
|
}
|
|
60
82
|
}
|
|
61
83
|
if (locales.prefixed.includes(locales.default)) {
|
|
62
|
-
throw
|
|
84
|
+
throw bootRuleError(HOST_ROUTING_BOOT_RULES.invalidLocales, {
|
|
85
|
+
message: `host-routing: default locale "${locales.default}" is served unprefixed and must not be in prefixed`,
|
|
86
|
+
});
|
|
63
87
|
}
|
|
64
88
|
}
|
|
65
89
|
}
|
package/dist/jobs/feature.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { defineFeature } from "@cosmicdrift/kumiko-framework/engine";
|
|
1
|
+
import { bootRuleError, defineFeature, } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { JOBS_BOOT_RULES } from "./boot-rules.js";
|
|
2
3
|
import { catalogQuery } from "./handlers/catalog.query.js";
|
|
3
4
|
import { consumerDisableWrite, consumerEnableWrite, consumerRestartWrite, consumerSkipWrite, } from "./handlers/consumer.write.js";
|
|
4
5
|
import { consumerDetailQuery, consumersQuery } from "./handlers/consumers.query.js";
|
|
@@ -22,7 +23,9 @@ export function createJobsFeature(options = {}) {
|
|
|
22
23
|
const staleRunTimeoutHours = options.staleRunTimeoutHours ?? DEFAULT_JOB_RUN_STALE_TIMEOUT_HOURS;
|
|
23
24
|
const readRoles = options.readRoles ?? [];
|
|
24
25
|
if (readRoles.includes("anonymous")) {
|
|
25
|
-
throw
|
|
26
|
+
throw bootRuleError(JOBS_BOOT_RULES.anonymousReadRole, {
|
|
27
|
+
message: `createJobsFeature: readRoles must not contain "anonymous" — job status and failures are only readable by members of the tenant.`,
|
|
28
|
+
});
|
|
26
29
|
}
|
|
27
30
|
return defineFeature("jobs", (r) => {
|
|
28
31
|
r.adoptsBundledLists();
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const LEGAL_PAGES_BOOT_RULES: {
|
|
2
|
+
readonly invalidRoute: {
|
|
3
|
+
readonly id: "legal-pages/invalid-route";
|
|
4
|
+
readonly summary: "Legal page routes declare path, slug and lang, and the path starts with a slash.";
|
|
5
|
+
readonly fix: "Fix the route named in the error message.";
|
|
6
|
+
};
|
|
7
|
+
readonly duplicateRoutePath: {
|
|
8
|
+
readonly id: "legal-pages/duplicate-route-path";
|
|
9
|
+
readonly summary: "Legal page route paths are unique.";
|
|
10
|
+
readonly fix: "Remove or rename the duplicate route.";
|
|
11
|
+
};
|
|
12
|
+
readonly routesWithoutRequiredBlocks: {
|
|
13
|
+
readonly id: "legal-pages/routes-without-required-blocks";
|
|
14
|
+
readonly summary: "Custom routes that miss the default required blocks pass requiredBlocks explicitly.";
|
|
15
|
+
readonly fix: "Pass requiredBlocks (or an empty array) alongside custom routes.";
|
|
16
|
+
};
|
|
17
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const LEGAL_PAGES_BOOT_RULES = {
|
|
2
|
+
invalidRoute: {
|
|
3
|
+
id: "legal-pages/invalid-route",
|
|
4
|
+
summary: "Legal page routes declare path, slug and lang, and the path starts with a slash.",
|
|
5
|
+
fix: "Fix the route named in the error message.",
|
|
6
|
+
},
|
|
7
|
+
duplicateRoutePath: {
|
|
8
|
+
id: "legal-pages/duplicate-route-path",
|
|
9
|
+
summary: "Legal page route paths are unique.",
|
|
10
|
+
fix: "Remove or rename the duplicate route.",
|
|
11
|
+
},
|
|
12
|
+
routesWithoutRequiredBlocks: {
|
|
13
|
+
id: "legal-pages/routes-without-required-blocks",
|
|
14
|
+
summary: "Custom routes that miss the default required blocks pass requiredBlocks explicitly.",
|
|
15
|
+
fix: "Pass requiredBlocks (or an empty array) alongside custom routes.",
|
|
16
|
+
},
|
|
17
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { computeRevisionEtag, etagMatches } from "@cosmicdrift/kumiko-framework/api";
|
|
2
|
-
import { defineFeature, SYSTEM_TENANT_ID, } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { bootRuleError, defineFeature, SYSTEM_TENANT_ID, } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { escapeHtml } from "@cosmicdrift/kumiko-renderer/headless";
|
|
4
4
|
import { cachedSecurePageResponse, redirectToCanonicalPath, slashVariantOf, } from "../page-render/index.js";
|
|
5
|
+
import { LEGAL_PAGES_BOOT_RULES } from "./boot-rules.js";
|
|
5
6
|
import { runLegalPagesBootCheck } from "./lib/boot-check.js";
|
|
6
7
|
import { validateRoutes } from "./lib/validate-routes.js";
|
|
7
8
|
import { renderMarkdownToHtml, wrapInLayout } from "./markdown.js";
|
|
@@ -35,7 +36,9 @@ export function createLegalPagesFeature(opts = {}) {
|
|
|
35
36
|
if (opts.routes !== undefined && opts.routes.length > 0 && opts.requiredBlocks === undefined) {
|
|
36
37
|
const coversDefaultBlock = LEGAL_REQUIRED_BLOCKS.some((block) => opts.routes?.some((route) => route.slug === block.slug && route.lang === block.lang));
|
|
37
38
|
if (!coversDefaultBlock) {
|
|
38
|
-
throw
|
|
39
|
+
throw bootRuleError(LEGAL_PAGES_BOOT_RULES.routesWithoutRequiredBlocks, {
|
|
40
|
+
message: "legal-pages: custom `routes` without `requiredBlocks` — pass `requiredBlocks` explicitly (or `[]`)",
|
|
41
|
+
});
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
const alternatesBySlug = alternatesBySlugOf(routes);
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
+
import { bootRuleError } from "@cosmicdrift/kumiko-framework/engine";
|
|
2
|
+
import { LEGAL_PAGES_BOOT_RULES } from "../boot-rules.js";
|
|
1
3
|
// Validated once at feature-build time (not per-request) so a config typo
|
|
2
4
|
// fails app startup instead of surfacing as a confusing 404 later.
|
|
3
5
|
export function validateRoutes(routes) {
|
|
4
6
|
const seenPaths = new Set();
|
|
5
7
|
for (const route of routes) {
|
|
6
8
|
if (!route.path || !route.slug || !route.lang) {
|
|
7
|
-
throw
|
|
9
|
+
throw bootRuleError(LEGAL_PAGES_BOOT_RULES.invalidRoute, {
|
|
10
|
+
message: `legal-pages: route is missing a required field (path/slug/lang): ${JSON.stringify(route)}`,
|
|
11
|
+
});
|
|
8
12
|
}
|
|
9
13
|
if (!route.path.startsWith("/")) {
|
|
10
|
-
throw
|
|
14
|
+
throw bootRuleError(LEGAL_PAGES_BOOT_RULES.invalidRoute, {
|
|
15
|
+
message: `legal-pages: route path must start with "/", got "${route.path}"`,
|
|
16
|
+
});
|
|
11
17
|
}
|
|
12
18
|
if (seenPaths.has(route.path)) {
|
|
13
|
-
throw
|
|
19
|
+
throw bootRuleError(LEGAL_PAGES_BOOT_RULES.duplicateRoutePath, {
|
|
20
|
+
message: `legal-pages: duplicate route path "${route.path}"`,
|
|
21
|
+
});
|
|
14
22
|
}
|
|
15
23
|
seenPaths.add(route.path);
|
|
16
24
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const METRICS_BOOT_RULES: {
|
|
2
|
+
readonly duplicateMetricId: {
|
|
3
|
+
readonly id: "metrics/duplicate-metric-id";
|
|
4
|
+
readonly summary: "Metric ids passed to the metrics factory are unique.";
|
|
5
|
+
readonly fix: "Rename one of the metrics.";
|
|
6
|
+
};
|
|
7
|
+
readonly invalidMetric: {
|
|
8
|
+
readonly id: "metrics/invalid-metric";
|
|
9
|
+
readonly summary: "Each metric passed to the metrics factory has a kebab-case id and a valid definition.";
|
|
10
|
+
readonly fix: "Fix the metric named in the error message.";
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const METRICS_BOOT_RULES = {
|
|
2
|
+
duplicateMetricId: {
|
|
3
|
+
id: "metrics/duplicate-metric-id",
|
|
4
|
+
summary: "Metric ids passed to the metrics factory are unique.",
|
|
5
|
+
fix: "Rename one of the metrics.",
|
|
6
|
+
},
|
|
7
|
+
invalidMetric: {
|
|
8
|
+
id: "metrics/invalid-metric",
|
|
9
|
+
summary: "Each metric passed to the metrics factory has a kebab-case id and a valid definition.",
|
|
10
|
+
fix: "Fix the metric named in the error message.",
|
|
11
|
+
},
|
|
12
|
+
};
|
package/dist/metrics/validate.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { extractTableInfo, isTimestamptzType } from "@cosmicdrift/kumiko-framework/db";
|
|
2
|
+
import { bootRuleError } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
|
+
import { METRICS_BOOT_RULES } from "./boot-rules.js";
|
|
2
4
|
import { filterValueKindOf, metricFilterEntries, RESERVED_PAYLOAD_KEYS } from "./filters.js";
|
|
3
5
|
import { METRIC_RANGES } from "./web/constants.js";
|
|
4
6
|
const KEBAB_ID = /^[a-z][a-z0-9]*(-[a-z0-9]+)*$/;
|
|
@@ -11,7 +13,9 @@ export function validateMetrics(metrics) {
|
|
|
11
13
|
const seen = new Set();
|
|
12
14
|
for (const metric of metrics) {
|
|
13
15
|
if (seen.has(metric.id)) {
|
|
14
|
-
throw
|
|
16
|
+
throw bootRuleError(METRICS_BOOT_RULES.duplicateMetricId, {
|
|
17
|
+
message: `metrics: duplicate metric id "${metric.id}"`,
|
|
18
|
+
});
|
|
15
19
|
}
|
|
16
20
|
seen.add(metric.id);
|
|
17
21
|
validateMetric(metric);
|
|
@@ -19,7 +23,9 @@ export function validateMetrics(metrics) {
|
|
|
19
23
|
}
|
|
20
24
|
function validateMetric(metric) {
|
|
21
25
|
const fail = (reason) => {
|
|
22
|
-
throw
|
|
26
|
+
throw bootRuleError(METRICS_BOOT_RULES.invalidMetric, {
|
|
27
|
+
message: `metrics: metric "${metric.id}" ${reason}`,
|
|
28
|
+
});
|
|
23
29
|
};
|
|
24
30
|
if (!KEBAB_ID.test(metric.id))
|
|
25
31
|
fail("has an id that is not kebab-case");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const NOTES_HISTORY_BOOT_RULES: {
|
|
2
|
+
readonly emptyParentsAllowlist: {
|
|
3
|
+
readonly id: "notes-history/empty-parents-allowlist";
|
|
4
|
+
readonly summary: "The parents allowlist is omitted or non-empty.";
|
|
5
|
+
readonly fix: "Omit parents or list at least one entity.";
|
|
6
|
+
};
|
|
7
|
+
};
|
|
@@ -12,8 +12,9 @@
|
|
|
12
12
|
// Only create + list are registered — no update, no delete. A correction is
|
|
13
13
|
// a new entry, not an edit; see entity.ts for why that still satisfies GDPR
|
|
14
14
|
// erasure without a delete path.
|
|
15
|
-
import { defineEntityListHandler, defineFeature, } from "@cosmicdrift/kumiko-framework/engine";
|
|
15
|
+
import { bootRuleError, defineEntityListHandler, defineFeature, } from "@cosmicdrift/kumiko-framework/engine";
|
|
16
16
|
import { assertNoWhereRuleInOwnershipWrite, resolveFeatureAccess } from "../shared/index.js";
|
|
17
|
+
import { NOTES_HISTORY_BOOT_RULES } from "./boot-rules.js";
|
|
17
18
|
import { createNoteEntryEntity, noteMentionEntity } from "./entity.js";
|
|
18
19
|
import { createNoteEntryExecutor } from "./executor.js";
|
|
19
20
|
import { createAddNoteHandler } from "./handlers/add-note.write.js";
|
|
@@ -56,9 +57,11 @@ export function createNotesHistoryFeature(opts = {}) {
|
|
|
56
57
|
// that's a config mistake, not a valid allowlist. Omit `parents` instead
|
|
57
58
|
// of passing an empty array.
|
|
58
59
|
if (opts.parents !== undefined && opts.parents.length === 0) {
|
|
59
|
-
throw
|
|
60
|
-
"
|
|
61
|
-
|
|
60
|
+
throw bootRuleError(NOTES_HISTORY_BOOT_RULES.emptyParentsAllowlist, {
|
|
61
|
+
message: "createNotesHistoryFeature({ parents }): parents must not be an empty array — " +
|
|
62
|
+
"an empty allowlist rejects every add-note call. Omit `parents` to allow " +
|
|
63
|
+
"any registered entity the caller can read as a note parent.",
|
|
64
|
+
});
|
|
62
65
|
}
|
|
63
66
|
return defineFeature(NOTES_HISTORY_FEATURE_NAME, (r) => registerNotesHistory(r, resolveFeatureAccess(opts, DEFAULT_NOTES_HISTORY_ACCESS), opts.ownership, opts.parents));
|
|
64
67
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const PERSONAL_ACCESS_TOKENS_BOOT_RULES: {
|
|
2
|
+
readonly scopeEventWithoutContract: {
|
|
3
|
+
readonly id: "personal-access-tokens/scope-event-without-contract";
|
|
4
|
+
readonly summary: "Events listed in PAT scopes have a public webhook contract.";
|
|
5
|
+
readonly fix: "Declare the event with r.defineWebhookEvent or opt the entity into webhookEvents.";
|
|
6
|
+
};
|
|
7
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const PERSONAL_ACCESS_TOKENS_BOOT_RULES = {
|
|
2
|
+
scopeEventWithoutContract: {
|
|
3
|
+
id: "personal-access-tokens/scope-event-without-contract",
|
|
4
|
+
summary: "Events listed in PAT scopes have a public webhook contract.",
|
|
5
|
+
fix: "Declare the event with r.defineWebhookEvent or opt the entity into webhookEvents.",
|
|
6
|
+
},
|
|
7
|
+
};
|