@cosmicdrift/kumiko-framework 0.411.0 → 0.412.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/agents/api/framework-db.md +1 -1
- package/agents/api/framework-engine.md +48 -1
- package/agents/api/framework-errors.md +2 -0
- package/agents/api/types.md +8 -0
- package/agents/api.md +2 -2
- package/agents/examples/api-docs.md +702 -0
- package/agents/examples.md +1 -0
- package/dist/api/auth-middleware.d.ts +1 -0
- package/dist/api/index.d.ts +3 -0
- package/dist/api/index.js +3 -0
- package/dist/api/pat-auth-reject.d.ts +7 -0
- package/dist/api/pat-auth-reject.js +7 -0
- package/dist/api/server-middleware.js +2 -1
- package/dist/compliance/sub-processors.js +2 -2
- package/dist/config/index.d.ts +25 -0
- package/dist/config/index.js +28 -1
- package/dist/db/event-store-executor-read-paging.d.ts +1 -0
- package/dist/db/event-store-executor-read-paging.js +2 -1
- package/dist/db/read-gate-clause.js +26 -7
- package/dist/db/table-builder.d.ts +1 -2
- package/dist/engine/define-feature.js +3 -0
- package/dist/engine/entity-list-runtime-options.js +12 -0
- package/dist/engine/factories.d.ts +2 -0
- package/dist/engine/feature-builder-state.d.ts +2 -1
- package/dist/engine/feature-builder-state.js +1 -0
- package/dist/engine/index.d.ts +5 -2
- package/dist/engine/index.js +4 -1
- package/dist/engine/registry-facade.js +13 -0
- package/dist/engine/webhook-contracts.d.ts +12 -0
- package/dist/engine/webhook-contracts.js +172 -0
- package/dist/engine/webhook-events.d.ts +34 -0
- package/dist/engine/webhook-events.js +71 -0
- package/dist/errors/docs-url.js +2 -19
- package/dist/errors/error-codes.d.ts +20 -0
- package/dist/errors/error-codes.js +19 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +1 -0
- package/dist/i18n/required-surface-keys.d.ts +4 -0
- package/dist/i18n/required-surface-keys.js +15 -0
- package/package.json +3 -3
- package/src/changes.json +30 -0
package/agents/examples.md
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
| `anonymous-access-multitenant` | Subdomain-based tenant resolution for anonymous-access — SaaS shop / CMS pattern with per-tenant public surface. | `examples/anonymous-access-multitenant.md` |
|
|
10
10
|
| `apex-landing` | Apex landing page composed from other features — hero copy from template-resolver, prices and caps from tier-engine — rendered to one static HTML string. | `examples/apex-landing.md` |
|
|
11
11
|
| `apex-surface-auth` | Apex-Surface: öffentliche Account-Flows (Login/Register/PW/Löschen) via createPublicSurface + AuthShell, inkl. anonymem email-verifiziertem Deletion-Flow. | `examples/apex-surface-auth.md` |
|
|
12
|
+
| `api-docs` | API documentation for personal access tokens: recorded examples, kumiko api-docs and a committed golden. | `examples/api-docs.md` |
|
|
12
13
|
| `api-worker-split` | Split deploy topology: API process (runSingleInstance:false, enqueue-only) + worker process (consumes worker-lane jobs, applies multiStreamProjections, writes results back through the worker dispatcher). | `examples/api-worker-split.md` |
|
|
13
14
|
| `app-config` | kumiko.config.ts with defineAppConfig: the one feature list, client entries and ports the tooling reads. | `examples/app-config.md` |
|
|
14
15
|
| `auth-claims` | r.authClaims() — features contribute identity facts into the JWT at login time with auto-prefixed keys. | `examples/auth-claims.md` |
|
|
@@ -33,6 +33,7 @@ export type AnonymousAccessResolved = AnonymousAccessConfig & {
|
|
|
33
33
|
readonly tenantExists?: TenantExists;
|
|
34
34
|
readonly resolverTrust?: "authoritative" | "fallback-only";
|
|
35
35
|
};
|
|
36
|
+
export type MiddlewareRejectCode = "missing_token" | "invalid_token" | "ambiguous_auth" | "session_invalid" | "tenant_required" | "tenant_not_found" | "tenant_mismatch" | "invalid_tenant_format" | "tenant_unavailable";
|
|
36
37
|
export declare function identifyOptionalSession(c: Context, jwt: JwtHelper): Promise<void>;
|
|
37
38
|
export declare function authMiddleware(jwt: JwtHelper, options?: AuthMiddlewareOptions): (c: Context, next: Next) => Promise<Response | undefined>;
|
|
38
39
|
export declare function getUser(c: Context): SessionUser;
|
package/dist/api/index.d.ts
CHANGED
|
@@ -17,6 +17,8 @@ export { cacheControlHeader, cachedResponse, computeRevisionEtag, computeStrongE
|
|
|
17
17
|
export type { JwtHelper } from "./jwt.ts";
|
|
18
18
|
export { loadJwtSecretOrKeyring } from "./jwt.ts";
|
|
19
19
|
export { publicOriginOf } from "./origin-middleware.ts";
|
|
20
|
+
export { PAT_RATE_LIMITED_CODE, patAuthRejectHttpStatus } from "./pat-auth-reject.ts";
|
|
21
|
+
export { patAllows, qnMatches } from "./pat-scope.ts";
|
|
20
22
|
export type { PostAuthLandingArgs, PostAuthLandingResolver, } from "./post-auth-landing.ts";
|
|
21
23
|
export type { RedisSseBroker } from "./redis-sse-broker.ts";
|
|
22
24
|
export { createDefaultSseBroker, createRedisSseBroker, isRedisSseBroker, } from "./redis-sse-broker.ts";
|
|
@@ -24,6 +26,7 @@ export { readonlyRequestContext as requestContext } from "./request-context-scop
|
|
|
24
26
|
export { buildRequestContextDataFromRequest } from "./request-id-middleware.ts";
|
|
25
27
|
export type { MetricsRouteOptions } from "./route-registrars.ts";
|
|
26
28
|
export { createMetricsApp, DEFAULT_MAX_REQUEST_BYTES, isPrometheusMeter, } from "./route-registrars.ts";
|
|
29
|
+
export { MAX_PAYLOAD_DEPTH } from "./routes.ts";
|
|
27
30
|
export type { ServerOptions } from "./server.ts";
|
|
28
31
|
export { buildServer } from "./server.ts";
|
|
29
32
|
export { resolveBaseDbAndSearchAdapter } from "./server-event-dispatcher.ts";
|
package/dist/api/index.js
CHANGED
|
@@ -10,10 +10,13 @@ export { ExtraRouteRejection, signatureRoute } from "./extra-route.js";
|
|
|
10
10
|
export { cacheControlHeader, cachedResponse, computeRevisionEtag, computeStrongEtag, computeWeakEtag, etagMatches, } from "./http-cache.js";
|
|
11
11
|
export { loadJwtSecretOrKeyring } from "./jwt.js";
|
|
12
12
|
export { publicOriginOf } from "./origin-middleware.js";
|
|
13
|
+
export { PAT_RATE_LIMITED_CODE, patAuthRejectHttpStatus } from "./pat-auth-reject.js";
|
|
14
|
+
export { patAllows, qnMatches } from "./pat-scope.js";
|
|
13
15
|
export { createDefaultSseBroker, createRedisSseBroker, isRedisSseBroker, } from "./redis-sse-broker.js";
|
|
14
16
|
export { readonlyRequestContext as requestContext } from "./request-context-scopes.js";
|
|
15
17
|
export { buildRequestContextDataFromRequest } from "./request-id-middleware.js";
|
|
16
18
|
export { createMetricsApp, DEFAULT_MAX_REQUEST_BYTES, isPrometheusMeter, } from "./route-registrars.js";
|
|
19
|
+
export { MAX_PAYLOAD_DEPTH } from "./routes.js";
|
|
17
20
|
export { buildServer } from "./server.js";
|
|
18
21
|
export { resolveBaseDbAndSearchAdapter } from "./server-event-dispatcher.js";
|
|
19
22
|
export { makeDispatchSystemQuery, makeDispatchSystemWrite, makeDispatchWriteAs, } from "./server-extra-routes.js";
|
|
@@ -6,6 +6,7 @@ import { assertSessionCallbacksPaired } from "./auth-routes.js";
|
|
|
6
6
|
import { csrfMiddleware } from "./csrf-middleware.js";
|
|
7
7
|
import { observabilityMiddleware } from "./observability-middleware.js";
|
|
8
8
|
import { assertOriginGuardConfig, normalizeOrigin, resolveOriginGuard, } from "./origin-middleware.js";
|
|
9
|
+
import { PAT_RATE_LIMITED_CODE } from "./pat-auth-reject.js";
|
|
9
10
|
import { patRouteGuard } from "./pat-route-guard.js";
|
|
10
11
|
import { piiCiphertextResponseGuard } from "./pii-leak-guard.js";
|
|
11
12
|
import { requestIdMiddleware } from "./request-id-middleware.js";
|
|
@@ -189,7 +190,7 @@ function buildPatRateLimitGuard(patRateLimiter) {
|
|
|
189
190
|
if (pat && !(await patRateLimiter.check(pat.tokenId))) {
|
|
190
191
|
return c.json({
|
|
191
192
|
error: {
|
|
192
|
-
code:
|
|
193
|
+
code: PAT_RATE_LIMITED_CODE,
|
|
193
194
|
httpStatus: 429,
|
|
194
195
|
message: "personal access token rate limit exceeded",
|
|
195
196
|
i18nKey: "auth.errors.patRateLimited",
|
|
@@ -87,9 +87,9 @@ export const KUMIKO_SUB_PROCESSORS = [
|
|
|
87
87
|
purpose: "Platform key custody (Key Manager) and Transactional Email Delivery",
|
|
88
88
|
region: "EU (France)",
|
|
89
89
|
dpa: "https://www.scaleway.com/en/contracts/",
|
|
90
|
-
addedAt: "2026-
|
|
90
|
+
addedAt: "2026-11-01",
|
|
91
91
|
appliesTo: ["all-tiers"],
|
|
92
|
-
status: "
|
|
92
|
+
status: "active",
|
|
93
93
|
},
|
|
94
94
|
];
|
|
95
95
|
/**
|
package/dist/config/index.d.ts
CHANGED
|
@@ -21,6 +21,28 @@ export type AppPorts = {
|
|
|
21
21
|
};
|
|
22
22
|
/** The boot-validator options an app owns; `env` and the cipher are injected by the runners. */
|
|
23
23
|
export type AppValidateBootOptions = Pick<ValidateBootOptions, "navAllowlist" | "navAllowlistExempt" | "requiredLocales" | "requireFieldValueTranslations" | "warnOnUniqueAccessRoles">;
|
|
24
|
+
/** Settings of `kumiko api-docs`, the generator for the HTTP API developer docs. */
|
|
25
|
+
export type AppApiDocsConfig = {
|
|
26
|
+
/** Locales of the generated pages; default en. */
|
|
27
|
+
readonly locales?: readonly string[];
|
|
28
|
+
readonly outDir?: string;
|
|
29
|
+
/** Host that the curl examples and the OpenAPI `servers` entry point to. */
|
|
30
|
+
readonly baseUrl?: string;
|
|
31
|
+
readonly appName?: string;
|
|
32
|
+
/** One paragraph per locale, appended to the tokens page (plan or tier limits). */
|
|
33
|
+
readonly planNote?: Readonly<Record<string, string>>;
|
|
34
|
+
/** One text per locale for the delivery section of the events page: signature, timeouts, retries. Required for every requested locale once an event is public. */
|
|
35
|
+
readonly webhookDelivery?: Readonly<Record<string, string>>;
|
|
36
|
+
/** Writes triggered by screens that are deliberately not reachable with an API token. `pattern` is a QN or a glob ending in `*`. */
|
|
37
|
+
readonly uiOnlyWrites?: readonly {
|
|
38
|
+
readonly pattern: string;
|
|
39
|
+
readonly reason: string;
|
|
40
|
+
}[];
|
|
41
|
+
/** Paragraph overrides per locale and text key; the page structure stays fixed. */
|
|
42
|
+
readonly texts?: Readonly<Record<string, Readonly<Record<string, string>>>>;
|
|
43
|
+
/** Directory of recorded request/response examples; default `api-examples`. */
|
|
44
|
+
readonly examplesDir?: string;
|
|
45
|
+
};
|
|
24
46
|
export type AppConfig = {
|
|
25
47
|
/** Features mounted in every environment: dev, tests, prod. */
|
|
26
48
|
readonly features: readonly FeatureDefinition[];
|
|
@@ -38,6 +60,7 @@ export type AppConfig = {
|
|
|
38
60
|
readonly bundledLists?: BundledListsOptions;
|
|
39
61
|
/** "on" enforces tenant isolation in Postgres via row level security; schema tooling and every runner read this one value. Default "on". */
|
|
40
62
|
readonly rowLevelSecurity?: RowLevelSecurityMode;
|
|
63
|
+
readonly apiDocs?: AppApiDocsConfig;
|
|
41
64
|
};
|
|
42
65
|
export declare const APP_CONFIG_FILE = "kumiko.config.ts";
|
|
43
66
|
declare const INFRA_PORT_NAMES: readonly ["postgres", "redis", "meilisearch", "s3"];
|
|
@@ -46,6 +69,8 @@ export type AppPortRole = "dev" | "e2e" | (typeof INFRA_PORT_NAMES)[number];
|
|
|
46
69
|
export declare function listAppPorts(ports: AppPorts): readonly AppPortEntry[];
|
|
47
70
|
/** Problems with the declared ports: out of range or claimed twice by this app. */
|
|
48
71
|
export declare function findAppPortProblems(ports: AppPorts): readonly string[];
|
|
72
|
+
/** Problems with the declared `apiDocs` block: empty or duplicate locales, a `uiOnlyWrites` entry without reason. */
|
|
73
|
+
export declare function findApiDocsConfigProblems(apiDocs: AppApiDocsConfig): readonly string[];
|
|
49
74
|
export declare function defineAppConfig(config: AppConfig): AppConfig;
|
|
50
75
|
/**
|
|
51
76
|
* Raw `features` plus `prodFeatures`, without the bundled foundation: the runners compose it,
|
package/dist/config/index.js
CHANGED
|
@@ -46,8 +46,35 @@ export function findAppPortProblems(ports) {
|
|
|
46
46
|
// Entries end up in the server's bundle list and in generated files, so only
|
|
47
47
|
// plain relative paths inside the app are accepted.
|
|
48
48
|
const CLIENT_ENTRY_RE = /^(?!\/)(?!.*\.\.)[A-Za-z0-9_./-]+\.(ts|tsx)$/;
|
|
49
|
+
/** Problems with the declared `apiDocs` block: empty or duplicate locales, a `uiOnlyWrites` entry without reason. */
|
|
50
|
+
export function findApiDocsConfigProblems(apiDocs) {
|
|
51
|
+
const problems = [];
|
|
52
|
+
const { locales, uiOnlyWrites } = apiDocs;
|
|
53
|
+
if (locales !== undefined) {
|
|
54
|
+
if (locales.length === 0)
|
|
55
|
+
problems.push("apiDocs.locales must not be empty");
|
|
56
|
+
if (new Set(locales).size !== locales.length) {
|
|
57
|
+
problems.push("apiDocs.locales must not contain duplicates");
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
for (const [locale, text] of Object.entries(apiDocs.webhookDelivery ?? {})) {
|
|
61
|
+
if (text.trim() === "")
|
|
62
|
+
problems.push(`apiDocs.webhookDelivery: "${locale}" text must not be empty`);
|
|
63
|
+
}
|
|
64
|
+
for (const entry of uiOnlyWrites ?? []) {
|
|
65
|
+
if (entry.pattern.trim() === "")
|
|
66
|
+
problems.push("apiDocs.uiOnlyWrites: pattern must not be empty");
|
|
67
|
+
if (entry.reason.trim() === "") {
|
|
68
|
+
problems.push(`apiDocs.uiOnlyWrites: "${entry.pattern}" needs a non-empty reason`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return problems;
|
|
72
|
+
}
|
|
49
73
|
export function defineAppConfig(config) {
|
|
50
|
-
const problems = [
|
|
74
|
+
const problems = [
|
|
75
|
+
...findAppPortProblems(config.ports),
|
|
76
|
+
...(config.apiDocs ? findApiDocsConfigProblems(config.apiDocs) : []),
|
|
77
|
+
];
|
|
51
78
|
if (config.client.entries.length === 0)
|
|
52
79
|
problems.push("client.entries must name at least one entry");
|
|
53
80
|
for (const entry of config.client.entries) {
|
|
@@ -2,6 +2,7 @@ import type { DbRunner } from "./connection.ts";
|
|
|
2
2
|
import type { Table } from "./event-store-executor-context.ts";
|
|
3
3
|
import type { ListWhere } from "./event-store-executor-read-filter.ts";
|
|
4
4
|
import { type ListSort } from "./event-store-executor-read-sort.ts";
|
|
5
|
+
export declare const DEFAULT_LIST_LIMIT = 50;
|
|
5
6
|
export declare function resolveListPagination(payload: {
|
|
6
7
|
readonly limit?: unknown;
|
|
7
8
|
readonly offset?: unknown;
|
|
@@ -8,8 +8,9 @@ import { physicalColumnName } from "./table-builder.js";
|
|
|
8
8
|
// handlers that pass their payload straight through — a non-integer limit
|
|
9
9
|
// would otherwise be interpolated raw into `LIMIT ${limit}` SQL text.
|
|
10
10
|
const MAX_LIST_LIMIT = 200; // keep in sync with engine/entity-handlers.ts MAX_LIST_LIMIT
|
|
11
|
+
export const DEFAULT_LIST_LIMIT = 50;
|
|
11
12
|
export function resolveListPagination(payload) {
|
|
12
|
-
const limit = payload.limit ??
|
|
13
|
+
const limit = payload.limit ?? DEFAULT_LIST_LIMIT;
|
|
13
14
|
const offset = payload.offset ?? 0;
|
|
14
15
|
if (typeof limit !== "number" || !Number.isInteger(limit) || limit < 0) {
|
|
15
16
|
throw new UnprocessableError("invalid_list_limit", {
|
|
@@ -77,12 +77,25 @@ function linkClause(input, link, mode) {
|
|
|
77
77
|
}
|
|
78
78
|
return { kind: "sql", sqlText, params: sql.params };
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
function hasRowReadRule(entity) {
|
|
81
|
+
return Object.keys(entity.access?.read ?? {}).length > 0;
|
|
82
|
+
}
|
|
83
|
+
// A read model is served by hand-written queries that filter rows themselves; only its own
|
|
84
|
+
// access.read can be reproduced here, so without one every role of its detail query would read every row.
|
|
85
|
+
function ownerSources(option) {
|
|
86
|
+
const sources = [...option.entities].map(([name, entity]) => ({ name, entity }));
|
|
87
|
+
for (const [name, { entity, table }] of option.readModelEntities ?? []) {
|
|
88
|
+
if (!option.entities.has(name) && hasRowReadRule(entity)) {
|
|
89
|
+
sources.push({ name, entity, projectionTable: table });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return sources;
|
|
93
|
+
}
|
|
94
|
+
// Join rows and gated entities are left out: their readability is not resolvable without recursion.
|
|
82
95
|
function ownerCandidates(input, selfName) {
|
|
83
96
|
const { option } = input;
|
|
84
97
|
const owners = [];
|
|
85
|
-
for (const
|
|
98
|
+
for (const { name, entity, projectionTable } of ownerSources(option)) {
|
|
86
99
|
if (name === FILE_REF_ENTITY_NAME || name === selfName)
|
|
87
100
|
continue;
|
|
88
101
|
if (entity.parentRef !== undefined || entity.readGate !== undefined)
|
|
@@ -94,14 +107,20 @@ function ownerCandidates(input, selfName) {
|
|
|
94
107
|
const fileFields = Object.entries(entity.fields)
|
|
95
108
|
.filter(([, field]) => isFileField(field))
|
|
96
109
|
.map(([fieldName]) => fieldName);
|
|
97
|
-
if (fileFields.length
|
|
98
|
-
|
|
110
|
+
if (fileFields.length === 0)
|
|
111
|
+
continue;
|
|
112
|
+
owners.push({
|
|
113
|
+
name,
|
|
114
|
+
entity,
|
|
115
|
+
table: projectionTable ?? tableOf(option, name, entity),
|
|
116
|
+
fileFields,
|
|
117
|
+
});
|
|
99
118
|
}
|
|
100
119
|
return owners;
|
|
101
120
|
}
|
|
102
121
|
function ownerBranch(input, owner, refTable, sql) {
|
|
103
|
-
const {
|
|
104
|
-
const ownerTable =
|
|
122
|
+
const { user, db } = input;
|
|
123
|
+
const ownerTable = owner.table;
|
|
105
124
|
const ownerTableName = String(schemaTableName(ownerTable));
|
|
106
125
|
const ownership = buildOwnershipClause(user, owner.entity.access?.read, ownerTable, 1, ownerTableName);
|
|
107
126
|
if (ownership.kind === "empty")
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
import type { EntityDefinition, FieldDefinition, FieldsMap } from "@cosmicdrift/kumiko-types/fields";
|
|
3
3
|
import type { EntityRelations } from "@cosmicdrift/kumiko-types/relations";
|
|
4
4
|
import type { TenancyBrand } from "@cosmicdrift/kumiko-types/tenancy-brand";
|
|
5
|
-
import type { Table } from "./event-store-executor-context.ts";
|
|
6
5
|
import type { LocatedTimestampRead } from "./located-timestamp.ts";
|
|
7
6
|
import type { MoneyRead } from "./money.ts";
|
|
8
7
|
export { toSnakeCase } from "../utils/case.ts";
|
|
9
8
|
import { type ColumnBuilder, type ColumnHandle, type SchemaTable, type TableColumns } from "./dialect.ts";
|
|
10
9
|
export { SOFT_DELETE_LIVE_ROW_PREDICATE } from "./entity-table-indexes.ts";
|
|
11
|
-
export declare function physicalColumnName(table:
|
|
10
|
+
export declare function physicalColumnName(table: unknown, field: string): string;
|
|
12
11
|
export type AnyPgColumn = ColumnHandle;
|
|
13
12
|
export declare const READ_MODEL_PREFIX = "read_";
|
|
14
13
|
export declare function toTableName(entityName: string): string;
|
|
@@ -4,6 +4,7 @@ import { buildEntityHandlerMethods } from "./feature-entity-handlers.js";
|
|
|
4
4
|
import { buildProbeMethods } from "./feature-probes.js";
|
|
5
5
|
import { buildUiExtensionsMethods } from "./feature-ui-extensions.js";
|
|
6
6
|
import { isObjectArgument, throwObjectArgumentRequired, unwrapArrayForm } from "./object-form.js";
|
|
7
|
+
import { buildWebhookEventMethods } from "./webhook-events.js";
|
|
7
8
|
// `TExports` lets the setup callback hand back a typed object that
|
|
8
9
|
// downstream features can import (e.g. `tenantFeature.exports.config`). The
|
|
9
10
|
// runtime always packs whatever setup returns into `featureDef.exports` —
|
|
@@ -89,6 +90,7 @@ export function defineFeature(name, setup, settings) {
|
|
|
89
90
|
},
|
|
90
91
|
...buildEntityHandlerMethods(state, name),
|
|
91
92
|
...buildConfigEventsJobsMethods(state, name),
|
|
93
|
+
...buildWebhookEventMethods(state, name),
|
|
92
94
|
...buildUiExtensionsMethods(state, name),
|
|
93
95
|
...buildProbeMethods(state, name),
|
|
94
96
|
};
|
|
@@ -143,6 +145,7 @@ export function defineFeature(name, setup, settings) {
|
|
|
143
145
|
bootChecks: state.bootChecks,
|
|
144
146
|
referenceData: state.referenceData,
|
|
145
147
|
events: state.events,
|
|
148
|
+
...(Object.keys(state.webhookEvents).length > 0 && { webhookEvents: state.webhookEvents }),
|
|
146
149
|
eventMigrations: state.eventMigrations,
|
|
147
150
|
configReads: state.configReads,
|
|
148
151
|
handlerEntityMappings: state.handlerEntityMappings,
|
|
@@ -26,6 +26,17 @@ function readTableOf(ctx, entityName, entity) {
|
|
|
26
26
|
.find((projection) => projection.name.endsWith(`:projection:${entityName}${IMPLICIT_PROJECTION_SUFFIX}`));
|
|
27
27
|
return implicit?.table ?? buildEntityTable(entityName, entity);
|
|
28
28
|
}
|
|
29
|
+
const readModelOwnersOf = memoizePerRegistry((registry) => {
|
|
30
|
+
const owners = new Map();
|
|
31
|
+
for (const { source, table } of registry.getAllProjections().values()) {
|
|
32
|
+
if (typeof source !== "string")
|
|
33
|
+
continue;
|
|
34
|
+
const entity = registry.getReadModelEntity(source);
|
|
35
|
+
if (entity !== undefined)
|
|
36
|
+
owners.set(source, { entity, table });
|
|
37
|
+
}
|
|
38
|
+
return owners;
|
|
39
|
+
});
|
|
29
40
|
function readTableResolver(ctx, label) {
|
|
30
41
|
return (name) => {
|
|
31
42
|
const entity = ctx.registry.getEntity(name);
|
|
@@ -40,6 +51,7 @@ export function parentVisibilityFor(ctx, user) {
|
|
|
40
51
|
const detailRules = detailAccessOf(ctx.registry);
|
|
41
52
|
return {
|
|
42
53
|
entities: ctx.registry.getAllEntities(),
|
|
54
|
+
readModelEntities: readModelOwnersOf(ctx.registry),
|
|
43
55
|
canReadEntity: (name) => {
|
|
44
56
|
const rule = detailRules.get(name);
|
|
45
57
|
return rule !== undefined && hasAccess(user, rule);
|
|
@@ -192,6 +192,8 @@ export declare function createEntity<const F, const T extends EntityTenancy = "t
|
|
|
192
192
|
/** Event stream lives on SYSTEM_TENANT_ID (tenant-independent aggregate, e.g.
|
|
193
193
|
* user) instead of the creator's tenant. See EntityDefinition.systemStream. */
|
|
194
194
|
readonly systemStream?: boolean;
|
|
195
|
+
/** See EntityDefinition.webhookEvents. */
|
|
196
|
+
readonly webhookEvents?: boolean;
|
|
195
197
|
readonly eventVersion?: number;
|
|
196
198
|
readonly eventMigrations?: EntityDefinition["eventMigrations"];
|
|
197
199
|
readonly searchWeight?: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConfigKeyDefinition, ConfigSeedDef, ExtensionSelectorDef, JobDefinition, NotificationDefinition, ReferenceDataDef, RegistrarExtensionDef, RegistrarExtensionRegistration, TranslationKeys } from "@cosmicdrift/kumiko-types/config";
|
|
2
|
-
import type { BootCheckFn, FeatureMetricDef, SecretKeyDefinition, SecretNamespaceDefinition, StoreTableEntry, UiHints } from "@cosmicdrift/kumiko-types/feature";
|
|
2
|
+
import type { BootCheckFn, FeatureMetricDef, SecretKeyDefinition, SecretNamespaceDefinition, StoreTableEntry, UiHints, WebhookEventDef } from "@cosmicdrift/kumiko-types/feature";
|
|
3
3
|
import type { EntityDefinition } from "@cosmicdrift/kumiko-types/fields";
|
|
4
4
|
import type { AuthClaimsFn, ClaimKeyDefinition, EventDef, EventMigrationDef, QueryHandlerDef, StreamHandlerDef, WriteHandlerDef } from "@cosmicdrift/kumiko-types/handlers";
|
|
5
5
|
import type { LifecycleHookFn, OwnedFn, PhasedHook, PostDeleteHookFn, PostQueryHookFn, PostSaveHookFn, PreDeleteHookFn, SearchPayloadContributorFn, ValidationHookFn } from "@cosmicdrift/kumiko-types/hooks";
|
|
@@ -31,6 +31,7 @@ export type FeatureBuilderState = {
|
|
|
31
31
|
configSeeds: ConfigSeedDef[];
|
|
32
32
|
jobs: Record<string, JobDefinition>;
|
|
33
33
|
events: Record<string, EventDef>;
|
|
34
|
+
webhookEvents: Record<string, WebhookEventDef>;
|
|
34
35
|
eventMigrations: Record<string, EventMigrationDef[]>;
|
|
35
36
|
configReads: string[];
|
|
36
37
|
entityPostSave: Record<string, PhasedHook<PostSaveHookFn>[]>;
|
package/dist/engine/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export type { ConfigAccessor, ConfigAccessorFactory, ConfigCascade, ConfigCascad
|
|
|
3
3
|
export type { ConfigScope } from "@cosmicdrift/kumiko-types/config-scope";
|
|
4
4
|
export type { KumikoEventTypeMap } from "@cosmicdrift/kumiko-types/event-type-map";
|
|
5
5
|
export type { ExtensionOptionsArgs, ExtensionOptionsFor, KumikoExtensionOptionsMap, } from "@cosmicdrift/kumiko-types/extension-options-map";
|
|
6
|
-
export type { BootOptionName, SecretKeyDefinition, SecretKeyHandle, SecretNamespaceDefinition, SecretNamespaceHandle, SecretNamespaceOptions, } from "@cosmicdrift/kumiko-types/feature";
|
|
6
|
+
export type { BootOptionName, SecretKeyDefinition, SecretKeyHandle, SecretNamespaceDefinition, SecretNamespaceHandle, SecretNamespaceOptions, WebhookEntityVerb, WebhookEventContract, WebhookEventHandle, } from "@cosmicdrift/kumiko-types/feature";
|
|
7
7
|
export type { FeatureRegistrar } from "@cosmicdrift/kumiko-types/feature-registrar";
|
|
8
8
|
export type { DeriveContext, EntityDefinition, FieldDefinition, JsonbFieldDef, ResolvedPiiFlags, RetentionDef, } from "@cosmicdrift/kumiko-types/fields";
|
|
9
9
|
export type { AccessRule, AgentEffect, AgentHandlerHints, AgentRisk, AuthClaimsContext, BeforeTransactionResult, ChatSendFailureCode, ClaimKeyType, DeliveryErrorCode, DeliveryFailureCode, DeliverySkipReason, EscapeHatchAuditSink, EscapeHatchDeclaration, EscapeHatchKind, EscapeHatchUseEvent, EventDef, JobContext, JobDeferral, NotifyDelivery, NotifyDeliveryStatus, NotifyDispatched, NotifyFactory, NotifyFn, NotifyJobDispatcher, NotifyOptions, NotifyPriority, NotifyResult, QueryHandlerDef, RateLimitPer, RoleAccessPersonalData, RoleAccessRule, StreamHandlerDef, TenantWriteTarget, WriteEvent, WriteHandlerDef, WriteHandlerFn, WriteResult, } from "@cosmicdrift/kumiko-types/handlers";
|
|
@@ -18,7 +18,8 @@ export type { ActionFormScreenDefinition, BundledListsOptions, ConfigEditScreenD
|
|
|
18
18
|
export type { TargetRef } from "@cosmicdrift/kumiko-types/target-ref";
|
|
19
19
|
export type { TreeAction, TreeActionDef, TreeChildrenSubscribe, TreeNode, } from "@cosmicdrift/kumiko-types/tree-node";
|
|
20
20
|
export type { WorkspaceDefinition } from "@cosmicdrift/kumiko-types/workspace";
|
|
21
|
-
export {
|
|
21
|
+
export { DEFAULT_LIST_LIMIT } from "../db/event-store-executor-read-paging.ts";
|
|
22
|
+
export { handlerDescriptionKey, handlerFieldLabelKey, handlerTitleKey, webhookEventDescriptionKey, webhookEventFieldKey, } from "../i18n/required-surface-keys.ts";
|
|
22
23
|
export { attachOutsideTransaction } from "../pipeline/attach-outside-transaction.ts";
|
|
23
24
|
export { hasAccess } from "./access.ts";
|
|
24
25
|
export type { PrincipalProfile, PrincipalStatus, PrincipalStatusPlugin, TenantLifecycleStatusPlugin, } from "./active-membership.ts";
|
|
@@ -103,4 +104,6 @@ export { isSystemTenant, isUuid, parseTenantId, SYSTEM_TENANT_ID } from "./types
|
|
|
103
104
|
export type { AppContext, BeforeTransactionContext, FeatureDefinition, HandlerAuth, HandlerContext, HandlerDb, HandlerDispatch, HandlerEvents, HandlerObservability, JobDispatch, JobEvents, JobObservability, QueryEvent, Registry, ReservationContext, SessionUser, TenantId, } from "./types/index.ts";
|
|
104
105
|
export type { AwaitedEventType, PipelineCtx, StepInstance, StepResolver, } from "./types/step.ts";
|
|
105
106
|
export { walkStepInstances } from "./walk-step-instances.ts";
|
|
107
|
+
export { createWebhookContractResolver, type WebhookContractResolver, } from "./webhook-contracts.ts";
|
|
108
|
+
export { formatWebhookPayloadIssues, parseWebhookPayload, toEntityWebhookPayload, type WebhookPayloadIssue, type WebhookPayloadResult, } from "./webhook-events.ts";
|
|
106
109
|
export { withFormDerivations } from "./with-form-derivations.ts";
|
package/dist/engine/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Public API
|
|
2
2
|
export { isAgentVisibleScreen, resolveAgentExposure, } from "@cosmicdrift/kumiko-types/agent-exposure";
|
|
3
3
|
export { DELIVERY_FAILURE_CODES, DELIVERY_SKIP_REASONS, HTTP_ERROR_CODE_PATTERN, isDeliveryErrorCode, isOpenToAllGranted, } from "@cosmicdrift/kumiko-types/handlers";
|
|
4
|
-
export {
|
|
4
|
+
export { DEFAULT_LIST_LIMIT } from "../db/event-store-executor-read-paging.js";
|
|
5
|
+
export { handlerDescriptionKey, handlerFieldLabelKey, handlerTitleKey, webhookEventDescriptionKey, webhookEventFieldKey, } from "../i18n/required-surface-keys.js";
|
|
5
6
|
export { attachOutsideTransaction } from "../pipeline/attach-outside-transaction.js";
|
|
6
7
|
export { hasAccess } from "./access.js";
|
|
7
8
|
export { collectBootRuleViolations } from "./boot-validator/boot-report.js";
|
|
@@ -83,4 +84,6 @@ export { findTierResolverUsage, isTierResolverPlugin, requireTierResolverPlugin,
|
|
|
83
84
|
export { findOverDeepTransferChain, resolveTransferAdjacency as resolveEntityTransferAdjacency, } from "./transfer-adjacency.js";
|
|
84
85
|
export { isSystemTenant, isUuid, parseTenantId, SYSTEM_TENANT_ID } from "./types/identifiers.js";
|
|
85
86
|
export { walkStepInstances } from "./walk-step-instances.js";
|
|
87
|
+
export { createWebhookContractResolver, } from "./webhook-contracts.js";
|
|
88
|
+
export { formatWebhookPayloadIssues, parseWebhookPayload, toEntityWebhookPayload, } from "./webhook-events.js";
|
|
86
89
|
export { withFormDerivations } from "./with-form-derivations.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { filterByPhase, filterOwned } from "./registry-state.js";
|
|
2
|
+
import { assertUniqueWebhookWireNames, createWebhookContractResolver, } from "./webhook-contracts.js";
|
|
2
3
|
function isFeatureSystemScoped(state, featureName) {
|
|
3
4
|
if (!featureName)
|
|
4
5
|
return false;
|
|
@@ -9,6 +10,12 @@ function isFeatureSystemScoped(state, featureName) {
|
|
|
9
10
|
// return-object literal, only the closure-captured variable changed
|
|
10
11
|
// (state.X instead of bare X, done in the RegistryState-threading step).
|
|
11
12
|
export function buildRegistryFacade(state) {
|
|
13
|
+
assertUniqueWebhookWireNames([...state.featureMap.values()]);
|
|
14
|
+
let resolver;
|
|
15
|
+
const webhookContracts = () => {
|
|
16
|
+
resolver ??= createWebhookContractResolver([...state.featureMap.values()]);
|
|
17
|
+
return resolver;
|
|
18
|
+
};
|
|
12
19
|
return {
|
|
13
20
|
features: state.featureMap,
|
|
14
21
|
getFeature(name) {
|
|
@@ -149,6 +156,12 @@ export function buildRegistryFacade(state) {
|
|
|
149
156
|
getEvent(qualifiedName) {
|
|
150
157
|
return state.eventMap.get(qualifiedName);
|
|
151
158
|
},
|
|
159
|
+
getWebhookEventContract(qualifiedName) {
|
|
160
|
+
return webhookContracts().get(qualifiedName);
|
|
161
|
+
},
|
|
162
|
+
getWebhookEventContracts() {
|
|
163
|
+
return webhookContracts().declared();
|
|
164
|
+
},
|
|
152
165
|
getEventUpcasters() {
|
|
153
166
|
return state.eventUpcasterMap;
|
|
154
167
|
},
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { WebhookEventContract } from "@cosmicdrift/kumiko-types/feature";
|
|
2
|
+
import type { FeatureDefinition } from "./types/index.ts";
|
|
3
|
+
export type WebhookContractResolver = {
|
|
4
|
+
/** Declared contract, or one derived from an entity lifecycle event (`entity.verb`). */
|
|
5
|
+
get(qualifiedName: string): WebhookEventContract | undefined;
|
|
6
|
+
/** Declared contracts only, sorted by QN. */
|
|
7
|
+
declared(): readonly WebhookEventContract[];
|
|
8
|
+
};
|
|
9
|
+
/** Works on the feature list so a boot check, which has no registry, resolves the same contracts. */
|
|
10
|
+
export declare function createWebhookContractResolver(features: readonly FeatureDefinition[]): WebhookContractResolver;
|
|
11
|
+
/** Receivers tell events apart by wire name, so two contracts must never share one. */
|
|
12
|
+
export declare function assertUniqueWebhookWireNames(features: readonly FeatureDefinition[]): void;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import * as z from "zod";
|
|
2
|
+
import { DEFAULT_CURRENCIES } from "./field-helpers.js";
|
|
3
|
+
import { personalFieldNames } from "./personal-data-fields.js";
|
|
4
|
+
import { fieldToZod } from "./schema-builder.js";
|
|
5
|
+
const ENTITY_VERBS = ["created", "updated", "deleted"];
|
|
6
|
+
const CONTRACT_VERSION = 1;
|
|
7
|
+
// money and locatedTimestamp are stored as several flat columns (amount plus currency, instant
|
|
8
|
+
// plus zone); the event shape of such a field is not mapped yet, so they stay out instead of
|
|
9
|
+
// being described wrongly.
|
|
10
|
+
const COMPOUND_FIELD_TYPES = new Set([
|
|
11
|
+
"money",
|
|
12
|
+
"locatedTimestamp",
|
|
13
|
+
]);
|
|
14
|
+
function isEncryptedText(field) {
|
|
15
|
+
return (field.type === "text" || field.type === "longText") && field.encrypted === true;
|
|
16
|
+
}
|
|
17
|
+
function isSecretText(field) {
|
|
18
|
+
return field.type === "text" && field.writeOnly === true;
|
|
19
|
+
}
|
|
20
|
+
function isSensitive(field) {
|
|
21
|
+
return "sensitive" in field && field.sensitive === true;
|
|
22
|
+
}
|
|
23
|
+
// A webhook leaves the system: credentials, client addresses, restricted-read fields and system-written
|
|
24
|
+
// plaintext fields stay out even when not personal. `allowPlaintext` is a plain string, hence the patterns.
|
|
25
|
+
const NEVER_RELEASED_NAME = /hash|secret|token|password|passcode|totp|recovery|salt|storagekey|fromip|useragent/i;
|
|
26
|
+
const CREDENTIAL_REASON = /credential|hash|secret|token/i;
|
|
27
|
+
function plaintextReason(field) {
|
|
28
|
+
return "allowPlaintext" in field && typeof field.allowPlaintext === "string"
|
|
29
|
+
? field.allowPlaintext
|
|
30
|
+
: undefined;
|
|
31
|
+
}
|
|
32
|
+
function hasRestrictedAccess(field, mode) {
|
|
33
|
+
return "access" in field && field.access?.[mode] !== undefined;
|
|
34
|
+
}
|
|
35
|
+
function isCredentialOrInternal(name, field) {
|
|
36
|
+
const reason = plaintextReason(field);
|
|
37
|
+
return (hasRestrictedAccess(field, "read") ||
|
|
38
|
+
(reason !== undefined && hasRestrictedAccess(field, "write")) ||
|
|
39
|
+
NEVER_RELEASED_NAME.test(name) ||
|
|
40
|
+
(reason !== undefined && CREDENTIAL_REASON.test(reason)));
|
|
41
|
+
}
|
|
42
|
+
function releasableFields(entity, excludedFields) {
|
|
43
|
+
const personal = personalFieldNames(entity, false);
|
|
44
|
+
return Object.entries(entity.fields).filter(([name, field]) => !personal.has(name) &&
|
|
45
|
+
!excludedFields.has(name) &&
|
|
46
|
+
!COMPOUND_FIELD_TYPES.has(field.type) &&
|
|
47
|
+
!isEncryptedText(field) &&
|
|
48
|
+
!isSecretText(field) &&
|
|
49
|
+
!isSensitive(field) &&
|
|
50
|
+
!isCredentialOrInternal(name, field));
|
|
51
|
+
}
|
|
52
|
+
function isAlwaysPresent(field) {
|
|
53
|
+
return (("required" in field && field.required === true) ||
|
|
54
|
+
("default" in field && field.default !== undefined));
|
|
55
|
+
}
|
|
56
|
+
function fieldShape(fields, presence) {
|
|
57
|
+
return Object.fromEntries(fields.map(([name, field]) => {
|
|
58
|
+
const schema = fieldToZod(field, DEFAULT_CURRENCIES, { applyDefaults: false });
|
|
59
|
+
const required = presence === "as-declared" && isAlwaysPresent(field);
|
|
60
|
+
return [name, required ? schema : schema.nullable().optional()];
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
// The executor appends `changes` and `previous` (the whole pre-update row, which always has `id`)
|
|
64
|
+
// on update and `{ previous }` on delete; create appends the flat fields without `id`. Receivers
|
|
65
|
+
// need the id, so the contract carries it on the top level; `toEntityWebhookPayload` takes it from
|
|
66
|
+
// the event's aggregate id.
|
|
67
|
+
function payloadFor(verb, fields) {
|
|
68
|
+
const row = z.object({ id: z.uuid(), ...fieldShape(fields, "optional") });
|
|
69
|
+
if (verb === "created")
|
|
70
|
+
return z.object({ id: z.uuid(), ...fieldShape(fields, "as-declared") });
|
|
71
|
+
if (verb === "updated")
|
|
72
|
+
return z.object({
|
|
73
|
+
id: z.uuid(),
|
|
74
|
+
changes: z.object(fieldShape(fields, "optional")),
|
|
75
|
+
previous: row,
|
|
76
|
+
});
|
|
77
|
+
return z.object({ id: z.uuid(), previous: row });
|
|
78
|
+
}
|
|
79
|
+
const VERB_DESCRIPTION = {
|
|
80
|
+
created: "was created",
|
|
81
|
+
updated: "was updated",
|
|
82
|
+
deleted: "was deleted",
|
|
83
|
+
};
|
|
84
|
+
function entityContract(entityName, verb, entity, excludedFields) {
|
|
85
|
+
return {
|
|
86
|
+
qn: `${entityName}.${verb}`,
|
|
87
|
+
wireName: `${entityName}.${verb}`,
|
|
88
|
+
description: `A ${entityName} ${VERB_DESCRIPTION[verb]}.`,
|
|
89
|
+
payload: payloadFor(verb, releasableFields(entity, excludedFields)),
|
|
90
|
+
version: CONTRACT_VERSION,
|
|
91
|
+
origin: "entity",
|
|
92
|
+
entity: entityName,
|
|
93
|
+
verb,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function excludedFieldsByEntity(features) {
|
|
97
|
+
const byEntity = new Map();
|
|
98
|
+
for (const feature of features) {
|
|
99
|
+
for (const [handlerName, handler] of Object.entries(feature.writeHandlers)) {
|
|
100
|
+
const entityName = feature.handlerEntityMappings[handlerName];
|
|
101
|
+
if (entityName === undefined || handler.excludedFields === undefined)
|
|
102
|
+
continue;
|
|
103
|
+
const names = byEntity.get(entityName) ?? new Set();
|
|
104
|
+
for (const field of handler.excludedFields)
|
|
105
|
+
names.add(field);
|
|
106
|
+
byEntity.set(entityName, names);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
return byEntity;
|
|
110
|
+
}
|
|
111
|
+
function entityVerbOf(qualifiedName) {
|
|
112
|
+
const dot = qualifiedName.lastIndexOf(".");
|
|
113
|
+
if (dot <= 0)
|
|
114
|
+
return undefined;
|
|
115
|
+
const verb = ENTITY_VERBS.find((candidate) => candidate === qualifiedName.slice(dot + 1));
|
|
116
|
+
return verb === undefined ? undefined : { entity: qualifiedName.slice(0, dot), verb };
|
|
117
|
+
}
|
|
118
|
+
/** Works on the feature list so a boot check, which has no registry, resolves the same contracts. */
|
|
119
|
+
export function createWebhookContractResolver(features) {
|
|
120
|
+
const declared = new Map();
|
|
121
|
+
const entities = new Map();
|
|
122
|
+
for (const feature of features) {
|
|
123
|
+
for (const def of Object.values(feature.webhookEvents ?? {})) {
|
|
124
|
+
declared.set(def.qn, { ...def, origin: "declared" });
|
|
125
|
+
}
|
|
126
|
+
for (const [name, entity] of Object.entries(feature.entities ?? {}))
|
|
127
|
+
entities.set(name, entity);
|
|
128
|
+
}
|
|
129
|
+
const excluded = excludedFieldsByEntity(features);
|
|
130
|
+
const derived = new Map();
|
|
131
|
+
return {
|
|
132
|
+
get(qualifiedName) {
|
|
133
|
+
const own = declared.get(qualifiedName);
|
|
134
|
+
if (own !== undefined)
|
|
135
|
+
return own;
|
|
136
|
+
if (!derived.has(qualifiedName)) {
|
|
137
|
+
const target = entityVerbOf(qualifiedName);
|
|
138
|
+
const entity = target === undefined ? undefined : entities.get(target.entity);
|
|
139
|
+
derived.set(qualifiedName, target === undefined || entity === undefined || entity.webhookEvents !== true
|
|
140
|
+
? undefined
|
|
141
|
+
: entityContract(target.entity, target.verb, entity, excluded.get(target.entity) ?? new Set()));
|
|
142
|
+
}
|
|
143
|
+
return derived.get(qualifiedName);
|
|
144
|
+
},
|
|
145
|
+
declared() {
|
|
146
|
+
return [...declared.values()].sort((a, b) => (a.qn < b.qn ? -1 : a.qn > b.qn ? 1 : 0));
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
/** Receivers tell events apart by wire name, so two contracts must never share one. */
|
|
151
|
+
export function assertUniqueWebhookWireNames(features) {
|
|
152
|
+
const qnByWireName = new Map();
|
|
153
|
+
const claim = (wireName, qn) => {
|
|
154
|
+
const existing = qnByWireName.get(wireName);
|
|
155
|
+
if (existing !== undefined && existing !== qn) {
|
|
156
|
+
throw new Error(`Webhook wire name "${wireName}" is used by both "${existing}" and "${qn}"; give one of them another wireName.`);
|
|
157
|
+
}
|
|
158
|
+
qnByWireName.set(wireName, qn);
|
|
159
|
+
};
|
|
160
|
+
for (const feature of features) {
|
|
161
|
+
for (const def of Object.values(feature.webhookEvents ?? {}))
|
|
162
|
+
claim(def.wireName, def.qn);
|
|
163
|
+
}
|
|
164
|
+
for (const feature of features) {
|
|
165
|
+
for (const [name, entity] of Object.entries(feature.entities ?? {})) {
|
|
166
|
+
if (entity.webhookEvents !== true)
|
|
167
|
+
continue;
|
|
168
|
+
for (const verb of ENTITY_VERBS)
|
|
169
|
+
claim(`${name}.${verb}`, `${name}.${verb}`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|