@cosmicdrift/kumiko-types 0.342.0 → 0.343.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/handlers.d.ts +13 -3
- package/dist/handlers.js +31 -0
- package/dist/screen.d.ts +40 -0
- package/dist/tenant-db-types.d.ts +1 -0
- package/package.json +1 -1
package/dist/handlers.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ import type { GeoTzProvider } from "./geo-tz.js";
|
|
|
13
13
|
import type { Logger } from "./logger.js";
|
|
14
14
|
import type { Meter, MetricsHandle, Tracer } from "./observability/index.js";
|
|
15
15
|
import type { SearchAdapter } from "./search-adapter.js";
|
|
16
|
-
import type { TenantDb } from "./tenant-db-types.js";
|
|
16
|
+
import type { CrossTenantReads, TenantDb } from "./tenant-db-types.js";
|
|
17
17
|
import type { TzContext } from "./tz-context.js";
|
|
18
18
|
export type OpenToAllPersonalData = "tenant-members";
|
|
19
19
|
export type OpenToAllDeclaration = {
|
|
@@ -140,11 +140,20 @@ export type NotifyOptions = {
|
|
|
140
140
|
readonly locale?: string;
|
|
141
141
|
};
|
|
142
142
|
export type NotifyDeliveryStatus = "queued" | "sent" | "failed" | "skipped";
|
|
143
|
+
export declare const DELIVERY_FAILURE_CODES: readonly ["timeout", "network_error", "redirect_blocked", "host_not_allowed", "missing_credentials", "invalid_address", "unexpected_response", "render_failed", "send_failed", "channel_error"];
|
|
144
|
+
export declare const DELIVERY_SKIP_REASONS: readonly ["channel_disabled", "preference_disabled", "rate_limited", "no_address", "unsubscribed", "duplicate_idempotency_key"];
|
|
145
|
+
export type DeliveryFailureCode = (typeof DELIVERY_FAILURE_CODES)[number];
|
|
146
|
+
export type DeliverySkipReason = (typeof DELIVERY_SKIP_REASONS)[number];
|
|
147
|
+
export type DeliveryErrorCode = DeliveryFailureCode | DeliverySkipReason | `http_${number}`;
|
|
148
|
+
export type ChatSendFailureCode = `http_${number}` | Exclude<DeliveryFailureCode, "render_failed" | "send_failed" | "channel_error">;
|
|
149
|
+
export declare const HTTP_ERROR_CODE_PATTERN: RegExp;
|
|
150
|
+
export declare function isDeliveryErrorCode(value: unknown): value is DeliveryErrorCode;
|
|
143
151
|
export type NotifyDelivery = {
|
|
144
152
|
readonly channel: string;
|
|
145
153
|
readonly recipientId: string | null;
|
|
146
154
|
readonly status: NotifyDeliveryStatus;
|
|
147
|
-
readonly error:
|
|
155
|
+
readonly error: DeliveryErrorCode | null;
|
|
156
|
+
readonly confirmed?: false;
|
|
148
157
|
readonly deliveryAttemptId?: string;
|
|
149
158
|
};
|
|
150
159
|
export type NotifyResult = {
|
|
@@ -157,7 +166,7 @@ export type NotifyJobDispatcher = {
|
|
|
157
166
|
}): Promise<unknown>;
|
|
158
167
|
};
|
|
159
168
|
export type NotifyFactory = (user: SessionUser, tenantId: TenantId, jobDispatcher?: NotifyJobDispatcher) => NotifyFn;
|
|
160
|
-
export type EscapeHatchKind = "unsafe-raw" | "acknowledge-cross-tenant" | "global-write" | "identity-switch" | "unsafe-all-tenants";
|
|
169
|
+
export type EscapeHatchKind = "unsafe-raw" | "acknowledge-cross-tenant" | "global-write" | "identity-switch" | "unsafe-all-tenants" | "cross-tenant-read";
|
|
161
170
|
export type EscapeHatchTarget = {
|
|
162
171
|
readonly id: string;
|
|
163
172
|
readonly tenantId: TenantId;
|
|
@@ -315,6 +324,7 @@ export type JobContext = SharedContextFields & {
|
|
|
315
324
|
readonly attempt: number;
|
|
316
325
|
readonly finalAttempt: boolean;
|
|
317
326
|
readonly systemDb?: UncheckedSystemDb;
|
|
327
|
+
readonly crossTenantReads?: CrossTenantReads;
|
|
318
328
|
readonly write: (qn: string, payload: unknown) => Promise<WriteResult>;
|
|
319
329
|
readonly writeAs: (user: SessionUser, qn: string, payload: unknown) => Promise<WriteResult>;
|
|
320
330
|
readonly queryAs: (user: SessionUser, qn: string, payload: unknown) => Promise<unknown>;
|
package/dist/handlers.js
CHANGED
|
@@ -57,6 +57,37 @@ export function isUiAccessGranted(access, userRoles) {
|
|
|
57
57
|
return false;
|
|
58
58
|
return access.roles.some((role) => userRoles.includes(role));
|
|
59
59
|
}
|
|
60
|
+
// Closed vocabulary for delivery failures and skips. Only these values (plus
|
|
61
|
+
// `http_<status>`) are ever stored or returned as a delivery error, never a raw
|
|
62
|
+
// error message: provider errors can carry URLs, tokens and addresses.
|
|
63
|
+
export const DELIVERY_FAILURE_CODES = [
|
|
64
|
+
"timeout",
|
|
65
|
+
"network_error",
|
|
66
|
+
"redirect_blocked",
|
|
67
|
+
"host_not_allowed",
|
|
68
|
+
"missing_credentials",
|
|
69
|
+
"invalid_address",
|
|
70
|
+
"unexpected_response",
|
|
71
|
+
"render_failed",
|
|
72
|
+
"send_failed",
|
|
73
|
+
"channel_error",
|
|
74
|
+
];
|
|
75
|
+
export const DELIVERY_SKIP_REASONS = [
|
|
76
|
+
"channel_disabled",
|
|
77
|
+
"preference_disabled",
|
|
78
|
+
"rate_limited",
|
|
79
|
+
"no_address",
|
|
80
|
+
"unsubscribed",
|
|
81
|
+
"duplicate_idempotency_key",
|
|
82
|
+
];
|
|
83
|
+
export const HTTP_ERROR_CODE_PATTERN = /^http_(\d{3})$/;
|
|
84
|
+
export function isDeliveryErrorCode(value) {
|
|
85
|
+
if (typeof value !== "string")
|
|
86
|
+
return false;
|
|
87
|
+
return (HTTP_ERROR_CODE_PATTERN.test(value) ||
|
|
88
|
+
DELIVERY_FAILURE_CODES.some((code) => code === value) ||
|
|
89
|
+
DELIVERY_SKIP_REASONS.some((reason) => reason === value));
|
|
90
|
+
}
|
|
60
91
|
export function normalizeEventPiiSubject(spec) {
|
|
61
92
|
if ("subjectField" in spec) {
|
|
62
93
|
return { kind: "user", ownerField: spec.subjectField, whenAbsent: undefined };
|
package/dist/screen.d.ts
CHANGED
|
@@ -396,6 +396,10 @@ export type EntityListScreenDefinition = {
|
|
|
396
396
|
/** Screen has no nav entry by design (opened via link or navved by the
|
|
397
397
|
* app); exempts it from the nav-area boot check. */
|
|
398
398
|
readonly dormant?: boolean;
|
|
399
|
+
/** UI-only gate, also on direct URL access; handlers still enforce access. Unmet or failed renders `fallback`. */
|
|
400
|
+
readonly visibleWhen?: DashboardPanelVisibility;
|
|
401
|
+
/** Same-feature short id or cross-feature QN `<feature>:screen:<id>` shown when `visibleWhen` is unmet (default: standard notice). */
|
|
402
|
+
readonly fallback?: string;
|
|
399
403
|
readonly entity: string;
|
|
400
404
|
/** Short screen id (same feature) the create button opens instead of the entity's default edit screen. */
|
|
401
405
|
readonly createScreen?: string;
|
|
@@ -501,6 +505,10 @@ export type ProjectionListScreenDefinition = {
|
|
|
501
505
|
/** Screen has no nav entry by design (opened via link or navved by the
|
|
502
506
|
* app); exempts it from the nav-area boot check. */
|
|
503
507
|
readonly dormant?: boolean;
|
|
508
|
+
/** UI-only gate, also on direct URL access; handlers still enforce access. Unmet or failed renders `fallback`. */
|
|
509
|
+
readonly visibleWhen?: DashboardPanelVisibility;
|
|
510
|
+
/** Same-feature short id or cross-feature QN `<feature>:screen:<id>` shown when `visibleWhen` is unmet (default: standard notice). */
|
|
511
|
+
readonly fallback?: string;
|
|
504
512
|
readonly query: string;
|
|
505
513
|
readonly columns: readonly ListColumnSpec[];
|
|
506
514
|
readonly rowRenderer?: PlatformComponent;
|
|
@@ -591,6 +599,10 @@ export type ProjectionDetailScreenDefinition = {
|
|
|
591
599
|
/** Screen has no nav entry by design (opened via link or navved by the
|
|
592
600
|
* app); exempts it from the nav-area boot check. */
|
|
593
601
|
readonly dormant?: boolean;
|
|
602
|
+
/** UI-only gate, also on direct URL access; handlers still enforce access. Unmet or failed renders `fallback`. */
|
|
603
|
+
readonly visibleWhen?: DashboardPanelVisibility;
|
|
604
|
+
/** Same-feature short id or cross-feature QN `<feature>:screen:<id>` shown when `visibleWhen` is unmet (default: standard notice). */
|
|
605
|
+
readonly fallback?: string;
|
|
594
606
|
readonly query: string;
|
|
595
607
|
/** Query output field whose value titles the page header (breadcrumb) when no `header` is set. */
|
|
596
608
|
readonly recordTitleField?: string;
|
|
@@ -789,6 +801,10 @@ export type DashboardScreenDefinition = {
|
|
|
789
801
|
/** Screen has no nav entry by design (opened via link or navved by the
|
|
790
802
|
* app); exempts it from the nav-area boot check. */
|
|
791
803
|
readonly dormant?: boolean;
|
|
804
|
+
/** UI-only gate, also on direct URL access; handlers still enforce access. Unmet or failed renders `fallback`. */
|
|
805
|
+
readonly visibleWhen?: DashboardPanelVisibility;
|
|
806
|
+
/** Same-feature short id or cross-feature QN `<feature>:screen:<id>` shown when `visibleWhen` is unmet (default: standard notice). */
|
|
807
|
+
readonly fallback?: string;
|
|
792
808
|
readonly panels: readonly DashboardPanelDefinition[];
|
|
793
809
|
readonly filter?: DashboardFilterDefinition;
|
|
794
810
|
/** Segmented control in the toolbar; the value lives in URL search param
|
|
@@ -1119,6 +1135,10 @@ export type EntityEditScreenDefinition = {
|
|
|
1119
1135
|
/** Screen has no nav entry by design (opened via link or navved by the
|
|
1120
1136
|
* app); exempts it from the nav-area boot check. */
|
|
1121
1137
|
readonly dormant?: boolean;
|
|
1138
|
+
/** UI-only gate, also on direct URL access; handlers still enforce access. Unmet or failed renders `fallback`. */
|
|
1139
|
+
readonly visibleWhen?: DashboardPanelVisibility;
|
|
1140
|
+
/** Same-feature short id or cross-feature QN `<feature>:screen:<id>` shown when `visibleWhen` is unmet (default: standard notice). */
|
|
1141
|
+
readonly fallback?: string;
|
|
1122
1142
|
/** Derived by buildAppSchema from the navigate `params` targeting this
|
|
1123
1143
|
* screen — the only URL query keys the create form prefills. An authored
|
|
1124
1144
|
* value is overwritten. */
|
|
@@ -1211,6 +1231,10 @@ export type ActionFormScreenDefinition = {
|
|
|
1211
1231
|
/** Screen has no nav entry by design (opened via link or navved by the
|
|
1212
1232
|
* app); exempts it from the nav-area boot check. */
|
|
1213
1233
|
readonly dormant?: boolean;
|
|
1234
|
+
/** UI-only gate, also on direct URL access; handlers still enforce access. Unmet or failed renders `fallback`. */
|
|
1235
|
+
readonly visibleWhen?: DashboardPanelVisibility;
|
|
1236
|
+
/** Same-feature short id or cross-feature QN `<feature>:screen:<id>` shown when `visibleWhen` is unmet (default: standard notice). */
|
|
1237
|
+
readonly fallback?: string;
|
|
1214
1238
|
/** Derived by buildAppSchema — see EntityEditScreenDefinition.urlPrefillFields. */
|
|
1215
1239
|
readonly urlPrefillFields?: readonly string[];
|
|
1216
1240
|
/** Write-Handler-QN der bei Submit gerufen wird. Form-Object landet
|
|
@@ -1369,6 +1393,10 @@ export type SecretMintScreenDefinition = {
|
|
|
1369
1393
|
/** Screen has no nav entry by design (opened via link or navved by the
|
|
1370
1394
|
* app); exempts it from the nav-area boot check. */
|
|
1371
1395
|
readonly dormant?: boolean;
|
|
1396
|
+
/** UI-only gate, also on direct URL access; handlers still enforce access. Unmet or failed renders `fallback`. */
|
|
1397
|
+
readonly visibleWhen?: DashboardPanelVisibility;
|
|
1398
|
+
/** Same-feature short id or cross-feature QN `<feature>:screen:<id>` shown when `visibleWhen` is unmet (default: standard notice). */
|
|
1399
|
+
readonly fallback?: string;
|
|
1372
1400
|
/** Derived by buildAppSchema — see EntityEditScreenDefinition.urlPrefillFields. */
|
|
1373
1401
|
readonly urlPrefillFields?: readonly string[];
|
|
1374
1402
|
/** Write-handler QN dispatched on submit. */
|
|
@@ -1418,6 +1446,10 @@ export type CustomScreenDefinition = {
|
|
|
1418
1446
|
* triggering the diagnostic if it's missing. Also gates the
|
|
1419
1447
|
* boot-validator's nav-area check, same as `dormant` on other screens. */
|
|
1420
1448
|
readonly dormant?: boolean;
|
|
1449
|
+
/** UI-only gate, also on direct URL access; handlers still enforce access. Unmet or failed renders `fallback`. */
|
|
1450
|
+
readonly visibleWhen?: DashboardPanelVisibility;
|
|
1451
|
+
/** Same-feature short id or cross-feature QN `<feature>:screen:<id>` shown when `visibleWhen` is unmet (default: standard notice). */
|
|
1452
|
+
readonly fallback?: string;
|
|
1421
1453
|
};
|
|
1422
1454
|
export type ConfigEditScreenDefinition = {
|
|
1423
1455
|
readonly id: string;
|
|
@@ -1432,6 +1464,10 @@ export type ConfigEditScreenDefinition = {
|
|
|
1432
1464
|
/** Screen has no nav entry by design (opened via link or navved by the
|
|
1433
1465
|
* app); exempts it from the nav-area boot check. */
|
|
1434
1466
|
readonly dormant?: boolean;
|
|
1467
|
+
/** UI-only gate, also on direct URL access; handlers still enforce access. Unmet or failed renders `fallback`. */
|
|
1468
|
+
readonly visibleWhen?: DashboardPanelVisibility;
|
|
1469
|
+
/** Same-feature short id or cross-feature QN `<feature>:screen:<id>` shown when `visibleWhen` is unmet (default: standard notice). */
|
|
1470
|
+
readonly fallback?: string;
|
|
1435
1471
|
/** scope für config:write:set Calls. Muss zur Scope-Deklaration der
|
|
1436
1472
|
* in `configKeys` referenzierten Keys passen — Boot-Validator
|
|
1437
1473
|
* prüft das gegen die Registry. */
|
|
@@ -1478,6 +1514,10 @@ export type SecretsEditScreenDefinition = {
|
|
|
1478
1514
|
/** Screen has no nav entry by design (opened via link or navved by the
|
|
1479
1515
|
* app); exempts it from the nav-area boot check. */
|
|
1480
1516
|
readonly dormant?: boolean;
|
|
1517
|
+
/** UI-only gate, also on direct URL access; handlers still enforce access. Unmet or failed renders `fallback`. */
|
|
1518
|
+
readonly visibleWhen?: DashboardPanelVisibility;
|
|
1519
|
+
/** Same-feature short id or cross-feature QN `<feature>:screen:<id>` shown when `visibleWhen` is unmet (default: standard notice). */
|
|
1520
|
+
readonly fallback?: string;
|
|
1481
1521
|
/** field id -> qualified secret name (`<feature>:secret:<kebab>`). */
|
|
1482
1522
|
readonly secretKeys: Readonly<Record<string, string>>;
|
|
1483
1523
|
/** field id -> i18n key for the label. */
|
|
@@ -29,6 +29,7 @@ export type GlobalTableDb<TTable> = GlobalReads & (TTable extends ExecutorOnly ?
|
|
|
29
29
|
* Tables without a tenantId column are always unfiltered regardless of mode.
|
|
30
30
|
*/
|
|
31
31
|
export type TenantDbMode = "tenant" | "system";
|
|
32
|
+
export type CrossTenantReads = Pick<TenantDb, "selectMany" | "fetchOne" | "count">;
|
|
32
33
|
export type TenantDb = {
|
|
33
34
|
readonly tenantId: TenantId;
|
|
34
35
|
readonly mode: TenantDbMode;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-types",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.343.0",
|
|
4
4
|
"description": "Framework-Type-Definitions für Kumiko — FeatureDefinition, BootCheck-Types und die reinen Engine-Types. Erlaubt Downstream-Konsumenten, gegen die Type-Contracts zu bauen, ohne das ganze Framework-Package zu importieren. Enthaelt keine identitaets-sensitiven Runtime-Werte mehr (Error-Klassen leben seit #1629 in kumiko-framework, Brand-Symbole nutzen Symbol.for) und ist deshalb eine plain dependency, keine peerDependency.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|