@cosmicdrift/kumiko-bundled-features 0.410.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.
Files changed (151) hide show
  1. package/dist/agent-tools/agent-doc-lint.d.ts +9 -0
  2. package/dist/agent-tools/agent-doc-lint.js +42 -5
  3. package/dist/agent-tools/agent-manifest.d.ts +0 -1
  4. package/dist/agent-tools/agent-manifest.js +9 -99
  5. package/dist/agent-tools/api-docs/anchors.d.ts +14 -0
  6. package/dist/agent-tools/api-docs/anchors.js +49 -0
  7. package/dist/agent-tools/api-docs/check.d.ts +7 -0
  8. package/dist/agent-tools/api-docs/check.js +15 -0
  9. package/dist/agent-tools/api-docs/collect-events.d.ts +10 -0
  10. package/dist/agent-tools/api-docs/collect-events.js +90 -0
  11. package/dist/agent-tools/api-docs/collect.d.ts +15 -0
  12. package/dist/agent-tools/api-docs/collect.js +108 -0
  13. package/dist/agent-tools/api-docs/curl.d.ts +5 -0
  14. package/dist/agent-tools/api-docs/curl.js +24 -0
  15. package/dist/agent-tools/api-docs/error-table.d.ts +9 -0
  16. package/dist/agent-tools/api-docs/error-table.js +31 -0
  17. package/dist/agent-tools/api-docs/examples.d.ts +16 -0
  18. package/dist/agent-tools/api-docs/examples.js +25 -0
  19. package/dist/agent-tools/api-docs/generate.d.ts +19 -0
  20. package/dist/agent-tools/api-docs/generate.js +104 -0
  21. package/dist/agent-tools/api-docs/index-json.d.ts +15 -0
  22. package/dist/agent-tools/api-docs/index-json.js +6 -0
  23. package/dist/agent-tools/api-docs/index.d.ts +9 -0
  24. package/dist/agent-tools/api-docs/index.js +6 -0
  25. package/dist/agent-tools/api-docs/list-parameters.d.ts +61 -0
  26. package/dist/agent-tools/api-docs/list-parameters.js +28 -0
  27. package/dist/agent-tools/api-docs/markdown.d.ts +29 -0
  28. package/dist/agent-tools/api-docs/markdown.js +48 -0
  29. package/dist/agent-tools/api-docs/menu-path.d.ts +8 -0
  30. package/dist/agent-tools/api-docs/menu-path.js +60 -0
  31. package/dist/agent-tools/api-docs/model.d.ts +76 -0
  32. package/dist/agent-tools/api-docs/model.js +1 -0
  33. package/dist/agent-tools/api-docs/problems.d.ts +32 -0
  34. package/dist/agent-tools/api-docs/problems.js +28 -0
  35. package/dist/agent-tools/api-docs/render-events.d.ts +12 -0
  36. package/dist/agent-tools/api-docs/render-events.js +55 -0
  37. package/dist/agent-tools/api-docs/render-openapi.d.ts +10 -0
  38. package/dist/agent-tools/api-docs/render-openapi.js +170 -0
  39. package/dist/agent-tools/api-docs/render-overview.d.ts +11 -0
  40. package/dist/agent-tools/api-docs/render-overview.js +60 -0
  41. package/dist/agent-tools/api-docs/render-reference.d.ts +14 -0
  42. package/dist/agent-tools/api-docs/render-reference.js +50 -0
  43. package/dist/agent-tools/api-docs/render-tokens.d.ts +12 -0
  44. package/dist/agent-tools/api-docs/render-tokens.js +101 -0
  45. package/dist/agent-tools/api-docs/schema-fields.d.ts +16 -0
  46. package/dist/agent-tools/api-docs/schema-fields.js +141 -0
  47. package/dist/agent-tools/api-docs/section-ids.d.ts +25 -0
  48. package/dist/agent-tools/api-docs/section-ids.js +26 -0
  49. package/dist/agent-tools/api-docs/system-only.d.ts +5 -0
  50. package/dist/agent-tools/api-docs/system-only.js +7 -0
  51. package/dist/agent-tools/api-docs/texts/de.d.ts +123 -0
  52. package/dist/agent-tools/api-docs/texts/de.js +123 -0
  53. package/dist/agent-tools/api-docs/texts/en.d.ts +123 -0
  54. package/dist/agent-tools/api-docs/texts/en.js +123 -0
  55. package/dist/agent-tools/api-docs/texts/es.d.ts +123 -0
  56. package/dist/agent-tools/api-docs/texts/es.js +123 -0
  57. package/dist/agent-tools/api-docs/texts/fr.d.ts +123 -0
  58. package/dist/agent-tools/api-docs/texts/fr.js +123 -0
  59. package/dist/agent-tools/api-docs/texts/index.d.ts +14 -0
  60. package/dist/agent-tools/api-docs/texts/index.js +55 -0
  61. package/dist/agent-tools/api-docs/texts/it.d.ts +123 -0
  62. package/dist/agent-tools/api-docs/texts/it.js +123 -0
  63. package/dist/agent-tools/api-docs/texts/types.d.ts +18 -0
  64. package/dist/agent-tools/api-docs/texts/types.js +104 -0
  65. package/dist/agent-tools/api-docs/ui-writes.d.ts +12 -0
  66. package/dist/agent-tools/api-docs/ui-writes.js +73 -0
  67. package/dist/agent-tools/handler-schema.d.ts +5 -0
  68. package/dist/agent-tools/handler-schema.js +37 -0
  69. package/dist/agent-tools/index.d.ts +2 -1
  70. package/dist/agent-tools/index.js +2 -1
  71. package/dist/agent-tools/labels.d.ts +26 -0
  72. package/dist/agent-tools/labels.js +131 -0
  73. package/dist/auth-email-password/seeding.d.ts +17 -2
  74. package/dist/auth-email-password/seeding.js +68 -6
  75. package/dist/auth-email-password/web/i18n.js +1 -0
  76. package/dist/auth-email-password/web/signup-screen.d.ts +1 -1
  77. package/dist/auth-email-password/web/signup-screen.js +20 -2
  78. package/dist/auth-email-password/web/static-account.d.ts +40 -0
  79. package/dist/auth-email-password/web/static-account.js +94 -0
  80. package/dist/auth-email-password/web/static-client.d.ts +38 -0
  81. package/dist/auth-email-password/web/static-client.js +169 -0
  82. package/dist/foundation-shared/demo-admin-env.d.ts +4 -0
  83. package/dist/foundation-shared/demo-admin-env.js +7 -0
  84. package/dist/foundation-shared/index.d.ts +1 -1
  85. package/dist/foundation-shared/index.js +1 -1
  86. package/dist/inbound-mail-foundation/entities.d.ts +84 -0
  87. package/dist/inbound-mail-foundation/entities.js +96 -71
  88. package/dist/inbound-mail-foundation/feature.js +2 -2
  89. package/dist/inbound-provider-imap/imap-client.d.ts +1 -1
  90. package/dist/inbound-provider-imap/imap-client.js +3 -1
  91. package/dist/personal-access-tokens/feature.d.ts +1 -0
  92. package/dist/personal-access-tokens/feature.js +4 -2
  93. package/dist/personal-access-tokens/handlers/create.write.js +2 -2
  94. package/dist/personal-access-tokens/i18n.js +5 -1
  95. package/dist/personal-access-tokens/index.d.ts +4 -2
  96. package/dist/personal-access-tokens/index.js +29 -2
  97. package/dist/personal-access-tokens/scope-events-check.d.ts +3 -0
  98. package/dist/personal-access-tokens/scope-events-check.js +18 -0
  99. package/dist/personal-access-tokens/screens.js +8 -2
  100. package/dist/personal-access-tokens/web/constants.d.ts +1 -0
  101. package/dist/personal-access-tokens/web/constants.js +1 -0
  102. package/dist/personal-access-tokens/web/scopes.d.ts +2 -0
  103. package/dist/personal-access-tokens/web/scopes.js +12 -0
  104. package/dist/presence/feature.d.ts +3 -0
  105. package/dist/presence/feature.js +20 -0
  106. package/dist/presence/handlers/heartbeat.write.d.ts +12 -0
  107. package/dist/presence/handlers/heartbeat.write.js +31 -0
  108. package/dist/presence/handlers/leave.write.d.ts +8 -0
  109. package/dist/presence/handlers/leave.write.js +33 -0
  110. package/dist/presence/handlers/list.query.d.ts +7 -0
  111. package/dist/presence/handlers/list.query.js +28 -0
  112. package/dist/presence/index.d.ts +3 -0
  113. package/dist/presence/index.js +2 -0
  114. package/dist/presence/options.d.ts +17 -0
  115. package/dist/presence/options.js +13 -0
  116. package/dist/presence/payloads.d.ts +18 -0
  117. package/dist/presence/payloads.js +18 -0
  118. package/dist/presence/room.d.ts +13 -0
  119. package/dist/presence/room.js +35 -0
  120. package/dist/presence/store.d.ts +32 -0
  121. package/dist/presence/store.js +140 -0
  122. package/dist/sessions/feature.js +2 -2
  123. package/dist/sessions/handlers/last-activity-probe.route.d.ts +2 -0
  124. package/dist/sessions/handlers/last-activity-probe.route.js +14 -0
  125. package/dist/tenant-inactivity/check-inactive-tenants.js +12 -6
  126. package/dist/tenant-inactivity/constants.d.ts +1 -1
  127. package/dist/tenant-inactivity/constants.js +3 -1
  128. package/dist/tenant-inactivity/handlers/inactivity-state.query.js +2 -1
  129. package/dist/tenant-inactivity/handlers/keep-account.write.js +2 -1
  130. package/dist/tenant-inactivity/options.d.ts +1 -0
  131. package/dist/tenant-inactivity/remote-activity.d.ts +3 -1
  132. package/dist/tenant-inactivity/remote-activity.js +4 -1
  133. package/dist/tenant-inactivity/static-keep-account.d.ts +6 -0
  134. package/dist/tenant-inactivity/static-keep-account.js +15 -0
  135. package/dist/tenant-lifecycle/constants.d.ts +1 -0
  136. package/dist/tenant-lifecycle/constants.js +1 -0
  137. package/dist/tenant-lifecycle/handlers/cancel-destruction.write.js +2 -2
  138. package/dist/tenant-lifecycle/handlers/request-destruction.write.js +2 -1
  139. package/dist/tenant-lifecycle/index.d.ts +1 -1
  140. package/dist/tenant-lifecycle/index.js +1 -1
  141. package/dist/waitlist/static-submit.d.ts +15 -0
  142. package/dist/waitlist/static-submit.js +24 -0
  143. package/package.json +59 -11
  144. package/src/agent-tools/changes.json +24 -0
  145. package/src/auth-email-password/changes.json +24 -0
  146. package/src/inbound-mail-foundation/changes.json +6 -0
  147. package/src/inbound-provider-imap/changes.json +6 -0
  148. package/src/personal-access-tokens/changes.json +6 -0
  149. package/src/presence/changes.json +8 -0
  150. package/src/tenant-inactivity/changes.json +12 -0
  151. package/src/waitlist/changes.json +6 -0
@@ -0,0 +1,169 @@
1
+ // DOM-free request core for the static clients (plain Astro scripts): fetch plus pure logic only.
2
+ // It must not import the renderer, React or anything that touches `window` at import time.
3
+ import { CSRF_COOKIE_BASE, sessionCookieNameCandidates, } from "@cosmicdrift/kumiko-types/session-cookies";
4
+ import { propertyOf } from "@cosmicdrift/kumiko-types/type-guards";
5
+ import { failureFromErrorField, isRecord, parseRetryAfterSeconds, } from "./login-failure.js";
6
+ export const STATIC_NETWORK_REASON = "network";
7
+ export const STATIC_RATE_LIMITED_REASON = "rate_limited";
8
+ export const STATIC_UNKNOWN_REASON = "unknown";
9
+ export const STATIC_UNAUTHENTICATED_REASON = "unauthenticated";
10
+ // A mail client that cuts the link short sends a token below the schema's minimum length; pages
11
+ // show that as the invalid-link state, not as a generic failure.
12
+ export const STATIC_MALFORMED_TOKEN_REASON = "malformed_token";
13
+ const CSRF_HEADER_NAME = "X-CSRF-Token";
14
+ const LOCALE_HEADER_NAME = "X-Locale";
15
+ const WRITE_PATH = "/api/write";
16
+ const QUERY_PATH = "/api/query";
17
+ export function staticFailure(reason, extras = {}) {
18
+ return {
19
+ kind: "failure",
20
+ reason,
21
+ ...(extras.message !== undefined && { message: extras.message }),
22
+ ...(extras.retryAfterSeconds !== undefined && { retryAfterSeconds: extras.retryAfterSeconds }),
23
+ };
24
+ }
25
+ export function staticSuccess(data) {
26
+ return { kind: "success", data };
27
+ }
28
+ function readDocumentCookie() {
29
+ const cookie = propertyOf(propertyOf(globalThis, "document"), "cookie");
30
+ return typeof cookie === "string" ? cookie : "";
31
+ }
32
+ // A malformed escape in a foreign cookie must not break the request; it just carries no CSRF header.
33
+ function decodeURIComponentOrNull(value) {
34
+ try {
35
+ return decodeURIComponent(value);
36
+ }
37
+ catch {
38
+ return null;
39
+ }
40
+ }
41
+ // Anonymous visitors have no CSRF cookie and send no header; a visitor who is signed in on the
42
+ // same origin (invite acceptance) echoes it like the SPA does.
43
+ export function csrfHeaderFromCookie(cookieSource) {
44
+ const valuesByName = new Map();
45
+ for (const pair of cookieSource.split(/;\s*/)) {
46
+ const eq = pair.indexOf("=");
47
+ if (eq < 0)
48
+ continue;
49
+ const name = pair.slice(0, eq);
50
+ if (!valuesByName.has(name))
51
+ valuesByName.set(name, pair.slice(eq + 1));
52
+ }
53
+ for (const name of sessionCookieNameCandidates(CSRF_COOKIE_BASE)) {
54
+ const value = valuesByName.get(name);
55
+ if (value !== undefined && value.length > 0) {
56
+ const decoded = decodeURIComponentOrNull(value);
57
+ if (decoded !== null)
58
+ return { [CSRF_HEADER_NAME]: decoded };
59
+ }
60
+ }
61
+ return {};
62
+ }
63
+ function failsOnlyOnToken(error) {
64
+ if (!isRecord(error) || error["code"] !== "validation_error")
65
+ return false;
66
+ const details = error["details"];
67
+ const fields = isRecord(details) ? details["fields"] : undefined;
68
+ return (Array.isArray(fields) &&
69
+ fields.length > 0 &&
70
+ fields.every((field) => isRecord(field) && field["path"] === "token"));
71
+ }
72
+ function failureFromBody(body) {
73
+ const error = body["error"];
74
+ if (failsOnlyOnToken(error))
75
+ return staticFailure(STATIC_MALFORMED_TOKEN_REASON);
76
+ const { reason, message, retryAfterSeconds } = failureFromErrorField(error, STATIC_UNKNOWN_REASON);
77
+ return staticFailure(reason, { message, retryAfterSeconds });
78
+ }
79
+ // Mirrors the 401 members of `MiddlewareRejectCode` in framework/src/api/auth-middleware.ts
80
+ // (not exported there, and the server must not be imported into browser code).
81
+ const SIGNED_OUT_REASONS = new Set([
82
+ STATIC_UNAUTHENTICATED_REASON,
83
+ "missing_token",
84
+ "invalid_token",
85
+ "session_invalid",
86
+ ]);
87
+ /** True when the server says there is no usable session; wrong credentials are not signed-out. */
88
+ export function isSignedOutFailure(result) {
89
+ return result.kind === "failure" && SIGNED_OUT_REASONS.has(result.reason);
90
+ }
91
+ async function readJsonRecord(res) {
92
+ const parsed = await res.json().catch(() => ({}));
93
+ return isRecord(parsed) ? parsed : {};
94
+ }
95
+ export async function postJson(path, payload, options = {}) {
96
+ let res;
97
+ try {
98
+ res = await fetch(path, {
99
+ method: "POST",
100
+ credentials: "same-origin",
101
+ headers: {
102
+ "Content-Type": "application/json",
103
+ ...(options.locale !== undefined && { [LOCALE_HEADER_NAME]: options.locale }),
104
+ ...csrfHeaderFromCookie(readDocumentCookie()),
105
+ },
106
+ body: JSON.stringify(payload),
107
+ });
108
+ }
109
+ catch {
110
+ return staticFailure(STATIC_NETWORK_REASON);
111
+ }
112
+ const body = await readJsonRecord(res);
113
+ if (res.status === 429) {
114
+ const fromBody = failureFromBody(body).retryAfterSeconds;
115
+ const retryAfterSeconds = parseRetryAfterSeconds(res.headers.get("Retry-After")) ?? fromBody;
116
+ return staticFailure(STATIC_RATE_LIMITED_REASON, { retryAfterSeconds });
117
+ }
118
+ if (!res.ok || body["isSuccess"] === false) {
119
+ const failure = failureFromBody(body);
120
+ // Session-less calls to session-only routes may answer 401 without a usable code.
121
+ return res.status === 401 && failure.reason === STATIC_UNKNOWN_REASON
122
+ ? staticFailure(STATIC_UNAUTHENTICATED_REASON, {
123
+ message: failure.message,
124
+ retryAfterSeconds: failure.retryAfterSeconds,
125
+ })
126
+ : failure;
127
+ }
128
+ return staticSuccess(body);
129
+ }
130
+ export async function dispatchWrite(type, payload, options) {
131
+ const result = await postJson(WRITE_PATH, { type, payload }, options);
132
+ return result.kind === "success" ? staticSuccess(result.data["data"]) : result;
133
+ }
134
+ export async function dispatchQuery(type, payload, options) {
135
+ const result = await postJson(QUERY_PATH, { type, payload }, options);
136
+ return result.kind === "success" ? staticSuccess(result.data["data"]) : result;
137
+ }
138
+ export const URL_TOKEN_PARAM = "token";
139
+ function paramsOf(url, source) {
140
+ return source === "query" ? url.searchParams : new URLSearchParams(url.hash.replace(/^#/, ""));
141
+ }
142
+ export function readUrlToken(href, source) {
143
+ return paramsOf(new URL(href), source).get(URL_TOKEN_PARAM) ?? "";
144
+ }
145
+ // Single-use tokens must not linger in history or the Referer once the page has read them.
146
+ export function hrefWithoutUrlToken(href, source) {
147
+ const url = new URL(href);
148
+ const params = paramsOf(url, source);
149
+ if (!params.has(URL_TOKEN_PARAM))
150
+ return href;
151
+ params.delete(URL_TOKEN_PARAM);
152
+ if (source === "query") {
153
+ url.search = params.toString();
154
+ }
155
+ else {
156
+ const rest = params.toString();
157
+ url.hash = rest === "" ? "" : `#${rest}`;
158
+ }
159
+ return url.toString();
160
+ }
161
+ /** Reads the token from the current page and removes it from the address bar. Browser only. */
162
+ export function takeUrlToken(source) {
163
+ const href = window.location.href;
164
+ const token = readUrlToken(href, source);
165
+ const scrubbed = hrefWithoutUrlToken(href, source);
166
+ if (scrubbed !== href)
167
+ window.history.replaceState(null, "", scrubbed);
168
+ return token;
169
+ }
@@ -10,3 +10,7 @@ export declare const demoAdminEnvSchema: z.ZodObject<{
10
10
  DEMO_SYSADMIN_PASSWORD: z.ZodOptional<z.ZodString>;
11
11
  DEMO_TENANT_ID: z.ZodOptional<z.ZodUUID>;
12
12
  }, z.core.$strip>;
13
+ export declare const BOOTSTRAP_ADMIN_EMAIL_ENV = "KUMIKO_BOOTSTRAP_ADMIN_EMAIL";
14
+ export declare const bootstrapAdminEnvSchema: z.ZodObject<{
15
+ KUMIKO_BOOTSTRAP_ADMIN_EMAIL: z.ZodOptional<z.ZodEmail>;
16
+ }, z.core.$strip>;
@@ -19,3 +19,10 @@ export const demoAdminEnvSchema = z.object({
19
19
  DEMO_SYSADMIN_PASSWORD: seedPassword("Password of the seeded SystemAdmin."),
20
20
  DEMO_TENANT_ID: z.uuid().optional().describe("Id of the seeded demo tenant. Default: generated."),
21
21
  });
22
+ export const BOOTSTRAP_ADMIN_EMAIL_ENV = "KUMIKO_BOOTSTRAP_ADMIN_EMAIL";
23
+ export const bootstrapAdminEnvSchema = z.object({
24
+ [BOOTSTRAP_ADMIN_EMAIL_ENV]: z
25
+ .email()
26
+ .optional()
27
+ .describe("Login of the person who created the app; the first start makes it the admin without a password, set via password reset."),
28
+ });
@@ -1,6 +1,6 @@
1
1
  export { buildInfoEnvSchema } from "./build-info-env.ts";
2
2
  export { requireDefined, requireNonEmpty, requireSecretSet } from "./config-helpers.ts";
3
- export { demoAdminEnvSchema } from "./demo-admin-env.ts";
3
+ export { BOOTSTRAP_ADMIN_EMAIL_ENV, bootstrapAdminEnvSchema, demoAdminEnvSchema, } from "./demo-admin-env.ts";
4
4
  export { isHostAllowlisted, readHostAllowlistFromEnv } from "./host-allowlist.ts";
5
5
  export { sanitizeMailDisplayName } from "./mail-display-name.ts";
6
6
  export { BlockedHostError, HostResolutionError, MAIL_ALLOWED_PRIVATE_HOSTS_ENV_VAR, type MailConnectTarget, type MailHostGuardOptions, mailAllowedPrivateHostsEnvSchema, readAllowedPrivateMailHostsFromEnv, resolveMailConnectTarget, } from "./mail-host-policy.ts";
@@ -2,7 +2,7 @@
2
2
  // Foundation packages (ai-foundation, mail-foundation, file-foundation).
3
3
  export { buildInfoEnvSchema } from "./build-info-env.js";
4
4
  export { requireDefined, requireNonEmpty, requireSecretSet } from "./config-helpers.js";
5
- export { demoAdminEnvSchema } from "./demo-admin-env.js";
5
+ export { BOOTSTRAP_ADMIN_EMAIL_ENV, bootstrapAdminEnvSchema, demoAdminEnvSchema, } from "./demo-admin-env.js";
6
6
  export { isHostAllowlisted, readHostAllowlistFromEnv } from "./host-allowlist.js";
7
7
  export { sanitizeMailDisplayName } from "./mail-display-name.js";
8
8
  export { BlockedHostError, HostResolutionError, MAIL_ALLOWED_PRIVATE_HOSTS_ENV_VAR, mailAllowedPrivateHostsEnvSchema, readAllowedPrivateMailHostsFromEnv, resolveMailConnectTarget, } from "./mail-host-policy.js";
@@ -48,6 +48,90 @@ export declare const mailAccountEntity: import("@cosmicdrift/kumiko-types/fields
48
48
  /** An incoming mail (envelope + snippet, NO body — bodyRef
49
49
  * points to file-foundation). PK = aggregateId =
50
50
  * inboundMessageAggregateId(accountId, providerMessageId). */
51
+ export declare function createInboundMessageEntity(memberRoles: readonly string[]): import("@cosmicdrift/kumiko-types/fields").EntityDefinition<{
52
+ readonly accountId: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
53
+ required: true;
54
+ };
55
+ readonly ownerUserId: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
56
+ required: false;
57
+ };
58
+ readonly messageIdHeader: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
59
+ required: true;
60
+ };
61
+ readonly threadKey: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
62
+ required: true;
63
+ };
64
+ readonly from: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
65
+ required: true;
66
+ };
67
+ readonly to: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
68
+ required: false;
69
+ };
70
+ readonly cc: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
71
+ required: false;
72
+ };
73
+ readonly subject: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
74
+ required: false;
75
+ };
76
+ readonly snippet: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
77
+ required: false;
78
+ };
79
+ readonly receivedAt: {
80
+ readonly type: "timestamp";
81
+ readonly description?: string;
82
+ readonly required?: boolean;
83
+ readonly sortable?: boolean;
84
+ readonly sortNulls?: import("@cosmicdrift/kumiko-types/fields").SortNulls;
85
+ readonly filterable?: boolean;
86
+ readonly sensitive?: boolean;
87
+ readonly access?: import("@cosmicdrift/kumiko-types/fields").FieldAccess;
88
+ readonly locatedBy?: string;
89
+ readonly min?: string;
90
+ readonly max?: string;
91
+ readonly locale?: string;
92
+ } & import("@cosmicdrift/kumiko-types/fields").ResolvedPiiFlags & import("@cosmicdrift/kumiko-types/fields").FieldStateConditions & {
93
+ required: true;
94
+ };
95
+ readonly bodyRef: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
96
+ required: false;
97
+ };
98
+ readonly scope: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
99
+ required: false;
100
+ };
101
+ readonly bodyText: import("@cosmicdrift/kumiko-types/fields").EntityLongTextFieldDef & {
102
+ required: false;
103
+ };
104
+ readonly bodyTextTruncated: {
105
+ readonly type: "boolean";
106
+ readonly description?: string;
107
+ readonly required?: boolean;
108
+ readonly sortable?: boolean;
109
+ readonly sortNulls?: import("@cosmicdrift/kumiko-types/fields").SortNulls;
110
+ readonly filterable?: boolean;
111
+ readonly sensitive?: boolean;
112
+ readonly default?: boolean;
113
+ readonly access?: import("@cosmicdrift/kumiko-types/fields").FieldAccess;
114
+ } & import("@cosmicdrift/kumiko-types/fields").FieldStateConditions & {
115
+ required: false;
116
+ default: boolean;
117
+ };
118
+ readonly bodyHtml: import("@cosmicdrift/kumiko-types/fields").EntityLongTextFieldDef & {
119
+ required: false;
120
+ };
121
+ readonly attachmentFileIds: import("@cosmicdrift/kumiko-types/fields").FilesFieldDef;
122
+ readonly skippedAttachments: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
123
+ required: false;
124
+ };
125
+ readonly senderAuthentication: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
126
+ required: false;
127
+ };
128
+ readonly contentState: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
129
+ required: false;
130
+ };
131
+ readonly contentUnavailableReason: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
132
+ required: false;
133
+ };
134
+ }, "tenant">;
51
135
  export declare const inboundMessageEntity: import("@cosmicdrift/kumiko-types/fields").EntityDefinition<{
52
136
  readonly accountId: import("@cosmicdrift/kumiko-types/fields").EntityTextFieldDef & {
53
137
  required: true;
@@ -1,6 +1,7 @@
1
1
  import { collectPiiSubjectFields } from "@cosmicdrift/kumiko-framework/crypto";
2
- import { deriveEntityTableMeta } from "@cosmicdrift/kumiko-framework/db";
2
+ import { deriveEntityTableMeta, physicalColumnName } from "@cosmicdrift/kumiko-framework/db";
3
3
  import { access, createBooleanField, createEntity, createFilesField, createLongTextField, createNumberField, createTextField, createTimestampField, } from "@cosmicdrift/kumiko-framework/engine";
4
+ import { DEFAULT_INBOUND_MAIL_ADMIN_ROLES, DEFAULT_INBOUND_MAIL_USER_ROLES } from "./mail-roles.js";
4
5
  // ============================================================================
5
6
  // Read models for the three event-sourced aggregates
6
7
  // ============================================================================
@@ -68,79 +69,103 @@ export const mailAccountEntity = createEntity({
68
69
  connectedAt: createTimestampField({ required: true }),
69
70
  },
70
71
  });
72
+ // Mirrors isVisibleToCaller (handlers/scope-visibility.ts) for the roles of the detail query:
73
+ // shared rows and the caller's own personal mailbox, no admin exception. The read gate of other
74
+ // entities (readGate.fileOwner) reads it; the hand-written message queries do not apply it.
75
+ function ownMailboxOrSharedRead(memberRoles) {
76
+ const rule = {
77
+ kind: "where",
78
+ where: (user, ctx) => {
79
+ const owner = `"${ctx.tableName}"."${physicalColumnName(ctx.table, "ownerUserId")}"`;
80
+ return {
81
+ sqlText: `(${owner} IS NULL OR ${owner} = '' OR ${owner} = $${ctx.paramStart})`,
82
+ params: [user.id],
83
+ };
84
+ },
85
+ };
86
+ return Object.fromEntries(memberRoles.map((role) => [role, rule]));
87
+ }
71
88
  /** An incoming mail (envelope + snippet, NO body — bodyRef
72
89
  * points to file-foundation). PK = aggregateId =
73
90
  * inboundMessageAggregateId(accountId, providerMessageId). */
74
- export const inboundMessageEntity = createEntity({
75
- table: "read_inbound_messages",
76
- fields: {
77
- accountId: createTextField({
78
- required: true,
79
- maxLength: 36,
80
- personal: false,
81
- reason: "technical_reference",
82
- }),
83
- // Scope is inherited from the account at ingest time: messages from a
84
- // personal mailbox are visible only to the owner, without joining read_mail_accounts.
85
- ownerUserId: createTextField({ maxLength: 36, personal: false, reason: "pseudonymous_fk" }),
86
- messageIdHeader: createTextField({
87
- required: true,
88
- maxLength: 500,
89
- personal: false,
90
- reason: "technical_reference",
91
- }),
92
- threadKey: createTextField({
93
- required: true,
94
- maxLength: 500,
95
- personal: false,
96
- reason: "technical_reference",
97
- }),
98
- from: createTextField({ required: true, maxLength: 2000, personal: "tenant", find: "none" }),
99
- // JSON-stringified string[] — als Ganzes encrypted.
100
- to: createTextField({ maxLength: 8000, personal: "tenant", find: "none" }),
101
- cc: createTextField({ maxLength: 8000, personal: "tenant", find: "none" }),
102
- subject: createTextField({ maxLength: 4000, personal: "tenant", find: "none" }),
103
- snippet: createTextField({ maxLength: 4000, personal: "tenant", find: "none" }),
104
- receivedAt: createTimestampField({ required: true }),
105
- bodyRef: createTextField({ maxLength: 500, personal: false, reason: "technical_reference" }),
106
- scope: createTextField({ maxLength: 200, personal: false, reason: "technical_reference" }),
107
- // Full plaintext, capped at 32_000 characters before encryption (ciphertext is ~2.3x plus envelope).
108
- // Null on rows from before the column; list-messages never selects it.
109
- bodyText: createLongTextField({ maxLength: 200_000, personal: "tenant", find: "none" }),
110
- bodyTextTruncated: createBooleanField(),
111
- // Sanitized HTML of the mail (sanitizeInboundHtml), null when the mail has none or it was too large.
112
- bodyHtml: createLongTextField({ maxLength: 500_000, personal: "tenant", find: "none" }),
113
- // Bound to the message (entityType = the aggregate type), so the file guard answers with the
114
- // mail's visibility. The fileRefs are bound at ingest, the projection copies the ids.
115
- attachmentFileIds: createFilesField({ personal: false, reason: "technical_reference" }),
116
- // JSON-stringified SkippedInboundAttachment[]: nullable JSON stays a text column
117
- // (jsonb fields are NOT NULL), like to/cc.
118
- skippedAttachments: createTextField({
119
- maxLength: 20_000,
120
- personal: false,
121
- reason: "technical_reference",
122
- }),
123
- // JSON-stringified SenderAuthentication or "null"; a SQL null (rows from before the column) reads as null.
124
- senderAuthentication: createTextField({
125
- maxLength: 4000,
126
- personal: false,
127
- reason: "technical_reference",
128
- }),
129
- // "complete" | "snippet" | "unavailable"; null counts as "snippet".
130
- contentState: createTextField({
131
- maxLength: 20,
132
- personal: false,
133
- reason: "technical_reference",
134
- }),
135
- // One of INBOUND_CONTENT_UNAVAILABLE_REASONS; null while the content is there or not yet missing.
136
- contentUnavailableReason: createTextField({
137
- maxLength: 30,
138
- personal: false,
139
- reason: "technical_reference",
140
- }),
141
- },
142
- attachedFileAccess: "record-only",
143
- });
91
+ export function createInboundMessageEntity(memberRoles) {
92
+ return createEntity({
93
+ access: { read: ownMailboxOrSharedRead(memberRoles) },
94
+ table: "read_inbound_messages",
95
+ fields: {
96
+ accountId: createTextField({
97
+ required: true,
98
+ maxLength: 36,
99
+ personal: false,
100
+ reason: "technical_reference",
101
+ }),
102
+ // Scope is inherited from the account at ingest time: messages from a
103
+ // personal mailbox are visible only to the owner, without joining read_mail_accounts.
104
+ ownerUserId: createTextField({ maxLength: 36, personal: false, reason: "pseudonymous_fk" }),
105
+ messageIdHeader: createTextField({
106
+ required: true,
107
+ maxLength: 500,
108
+ personal: false,
109
+ reason: "technical_reference",
110
+ }),
111
+ threadKey: createTextField({
112
+ required: true,
113
+ maxLength: 500,
114
+ personal: false,
115
+ reason: "technical_reference",
116
+ }),
117
+ from: createTextField({ required: true, maxLength: 2000, personal: "tenant", find: "none" }),
118
+ // JSON-stringified string[] — als Ganzes encrypted.
119
+ to: createTextField({ maxLength: 8000, personal: "tenant", find: "none" }),
120
+ cc: createTextField({ maxLength: 8000, personal: "tenant", find: "none" }),
121
+ subject: createTextField({ maxLength: 4000, personal: "tenant", find: "none" }),
122
+ snippet: createTextField({ maxLength: 4000, personal: "tenant", find: "none" }),
123
+ receivedAt: createTimestampField({ required: true }),
124
+ bodyRef: createTextField({ maxLength: 500, personal: false, reason: "technical_reference" }),
125
+ scope: createTextField({ maxLength: 200, personal: false, reason: "technical_reference" }),
126
+ // Full plaintext, capped at 32_000 characters before encryption (ciphertext is ~2.3x plus envelope).
127
+ // Null on rows from before the column; list-messages never selects it.
128
+ bodyText: createLongTextField({ maxLength: 200_000, personal: "tenant", find: "none" }),
129
+ bodyTextTruncated: createBooleanField(),
130
+ // Sanitized HTML of the mail (sanitizeInboundHtml), null when the mail has none or it was too large.
131
+ bodyHtml: createLongTextField({ maxLength: 500_000, personal: "tenant", find: "none" }),
132
+ // Bound to the message (entityType = the aggregate type), so the file guard answers with the
133
+ // mail's visibility. The fileRefs are bound at ingest, the projection copies the ids.
134
+ attachmentFileIds: createFilesField({ personal: false, reason: "technical_reference" }),
135
+ // JSON-stringified SkippedInboundAttachment[]: nullable JSON stays a text column
136
+ // (jsonb fields are NOT NULL), like to/cc.
137
+ skippedAttachments: createTextField({
138
+ maxLength: 20_000,
139
+ personal: false,
140
+ reason: "technical_reference",
141
+ }),
142
+ // JSON-stringified SenderAuthentication or "null"; a SQL null (rows from before the column) reads as null.
143
+ senderAuthentication: createTextField({
144
+ maxLength: 4000,
145
+ personal: false,
146
+ reason: "technical_reference",
147
+ }),
148
+ // "complete" | "snippet" | "unavailable"; null counts as "snippet".
149
+ contentState: createTextField({
150
+ maxLength: 20,
151
+ personal: false,
152
+ reason: "technical_reference",
153
+ }),
154
+ // One of INBOUND_CONTENT_UNAVAILABLE_REASONS; null while the content is there or not yet missing.
155
+ contentUnavailableReason: createTextField({
156
+ maxLength: 30,
157
+ personal: false,
158
+ reason: "technical_reference",
159
+ }),
160
+ },
161
+ attachedFileAccess: "record-only",
162
+ });
163
+ }
164
+ // Same fields for every role set; table and PII lists do not depend on the roles.
165
+ export const inboundMessageEntity = createInboundMessageEntity([
166
+ ...DEFAULT_INBOUND_MAIL_ADMIN_ROLES,
167
+ ...DEFAULT_INBOUND_MAIL_USER_ROLES,
168
+ ]);
144
169
  /** Thread-Rollup. PK = aggregateId = mailThreadAggregateId(tenantId,
145
170
  * threadKey). */
146
171
  export const mailThreadEntity = createEntity({
@@ -22,7 +22,7 @@
22
22
  // archives all streams and deletes the rows.
23
23
  import { defineFeature, EXT_TENANT_DATA } from "@cosmicdrift/kumiko-framework/engine";
24
24
  import { INBOUND_MAIL_FOUNDATION_FEATURE, INBOUND_MAIL_PROVIDER_EXTENSION } from "./constants.js";
25
- import { inboundMessageEntity, mailAccountEntity, mailThreadEntity, seenMessageTable, syncCursorTable, } from "./entities.js";
25
+ import { createInboundMessageEntity, mailAccountEntity, mailThreadEntity, seenMessageTable, syncCursorTable, } from "./entities.js";
26
26
  import { INBOUND_MESSAGE_AGGREGATE_TYPE, INBOUND_MESSAGE_CONTENT_FETCHED_EVENT_QN, INBOUND_MESSAGE_CONTENT_FETCHED_EVENT_SHORT, INBOUND_MESSAGE_RECEIVED_EVENT_QN, INBOUND_MESSAGE_RECEIVED_EVENT_SHORT, inboundMessageContentFetchedEventPayloadSchema, inboundMessageEventPayloadSchema, MAIL_ACCOUNT_AGGREGATE_TYPE, MAIL_ACCOUNT_CONNECTED_EVENT_QN, MAIL_ACCOUNT_CONNECTED_EVENT_SHORT, MAIL_ACCOUNT_DISCONNECTED_EVENT_QN, MAIL_ACCOUNT_DISCONNECTED_EVENT_SHORT, MAIL_ACCOUNT_UPDATED_EVENT_QN, MAIL_ACCOUNT_UPDATED_EVENT_SHORT, MAIL_THREAD_AGGREGATE_TYPE, MAIL_THREAD_UPDATED_EVENT_QN, MAIL_THREAD_UPDATED_EVENT_SHORT, mailAccountEventPayloadSchema, mailThreadEventPayloadSchema, } from "./events.js";
27
27
  import { createAcknowledgeQuarantineHandler } from "./handlers/acknowledge-quarantine.write.js";
28
28
  import { attachMessageContentHandler } from "./handlers/attach-message-content.write.js";
@@ -151,7 +151,7 @@ export function createInboundMailFoundationFeature(options = {}) {
151
151
  name: "inbound-message",
152
152
  source: INBOUND_MESSAGE_AGGREGATE_TYPE,
153
153
  table: inboundMessagesProjectionTable,
154
- entity: inboundMessageEntity,
154
+ entity: createInboundMessageEntity(roles.memberRoles),
155
155
  apply: {
156
156
  [INBOUND_MESSAGE_RECEIVED_EVENT_QN]: applyInboundMessageReceived,
157
157
  [INBOUND_MESSAGE_CONTENT_FETCHED_EVENT_QN]: applyInboundMessageContentFetched,
@@ -13,7 +13,7 @@ export declare function imapClientOptions(doc: ImapCredentialDocument, target: A
13
13
  secure: boolean;
14
14
  servername?: string | undefined;
15
15
  tls?: {
16
- servername: undefined;
16
+ servername: string | undefined;
17
17
  } | undefined;
18
18
  auth: {
19
19
  user: string;
@@ -66,13 +66,15 @@ export async function createImapClient(doc, hostGuard = {}) {
66
66
  // ("servername argument must be an string"). Overriding it through `tls` with undefined makes the
67
67
  // socket connect without SNI; the certificate is still verified against the IP. Not setting the
68
68
  // option at all (as for SMTP, where nodemailer omits a falsy servername) does not help here.
69
+ // A host pinned to its resolved IP carries the original name, which must reach tls as the SNI name
70
+ // and certificate identity instead of being blanked.
69
71
  export function imapClientOptions(doc, target) {
70
72
  return {
71
73
  host: target.host,
72
74
  port: doc.port,
73
75
  secure: doc.secure,
74
76
  ...(target.servername && { servername: target.servername }),
75
- ...(isIP(target.host) !== 0 && { tls: { servername: undefined } }),
77
+ ...(isIP(target.host) !== 0 && { tls: { servername: target.servername } }),
76
78
  auth: doc.password
77
79
  ? { user: doc.user, pass: doc.password }
78
80
  : { user: doc.user, accessToken: doc.accessToken },
@@ -25,6 +25,7 @@ export type PersonalAccessTokensOptions = {
25
25
  };
26
26
  export type PatFeatureExports = {
27
27
  readonly rateLimit: PatRateLimit;
28
+ readonly scopes: PatScopeConfig;
28
29
  readonly bindAutoRevokeOnPasswordChange: BindPatAutoRevokeOnPasswordChange;
29
30
  };
30
31
  export declare function createPersonalAccessTokensFeature(options: PersonalAccessTokensOptions): FeatureDefinition;
@@ -12,6 +12,7 @@ import { PAT_FEATURE_I18N, patScopeOptionTranslations } from "./i18n.js";
12
12
  import { PAT_REVOKED_EVENT_SHORT, patRevokedSchema } from "./pat-revoked-event.js";
13
13
  import { createPatResolver } from "./resolver.js";
14
14
  import { apiTokenEntity } from "./schema/api-token.js";
15
+ import { validateScopeEventContracts } from "./scope-events-check.js";
15
16
  import { createPatMintScreen, patListScreen } from "./screens.js";
16
17
  import { API_TOKEN_ENTITY_NAME, PAT_DEFAULT_RATE_LIMIT, PAT_FEATURE, } from "./web/constants.js";
17
18
  // Password-change is the only field-level trigger — see the postSave hook
@@ -70,6 +71,7 @@ export function createPersonalAccessTokensFeature(options) {
70
71
  // different path. No projection: the payload IS the read, consumed
71
72
  // directly off the event-store NOTIFY.
72
73
  r.defineEvent(PAT_REVOKED_EVENT_SHORT, patRevokedSchema, { piiFields: "none" });
74
+ r.bootCheck(({ features }) => validateScopeEventContracts(scopes, features));
73
75
  // Password-change auto-revoke — mirrors sessions' own
74
76
  // autoRevokeOnPasswordChange postSave hook, including WHY it's a
75
77
  // late-bind callback rather than direct ctx.db use: user:write:user:update
@@ -123,12 +125,12 @@ export function createPersonalAccessTokensFeature(options) {
123
125
  r.translations({ keys: { ...PAT_FEATURE_I18N, ...patScopeOptionTranslations(scopes) } });
124
126
  // rateLimit flows into feature.exports so run-prod-app builds the
125
127
  // limiter from the same declaration — single source of truth. `scopes`
126
- // is closed over directly by the useExtension build() above and by
127
- // available-scopes, so it doesn't need to round-trip through exports.
128
+ // is also exported so the API-docs generator can read the catalog.
128
129
  return {
129
130
  handlers,
130
131
  queries,
131
132
  bindAutoRevokeOnPasswordChange,
133
+ scopes,
132
134
  rateLimit: options.rateLimit ?? PAT_DEFAULT_RATE_LIMIT,
133
135
  };
134
136
  });
@@ -7,7 +7,7 @@ import { encryptForDirectWrite, unprocessable, verifyPassword } from "../../shar
7
7
  import { UserQueries } from "../../user/index.js";
8
8
  import { mintPatToken } from "../hash.js";
9
9
  import { apiTokenEntity, apiTokenTable } from "../schema/api-token.js";
10
- import { API_TOKEN_ENTITY_NAME, PAT_DEFAULT_EXPIRES_IN_DAYS, PatErrors } from "../web/constants.js";
10
+ import { API_TOKEN_ENTITY_NAME, PAT_DEFAULT_EXPIRES_IN_DAYS, PAT_MAX_EXPIRES_IN_DAYS, PatErrors, } from "../web/constants.js";
11
11
  // @wrapper-known error-helper
12
12
  function reauthFailed() {
13
13
  return unprocessable(PatErrors.reauthRequired, "errors.reauthRequired");
@@ -27,7 +27,7 @@ export function createPatCreateHandler(opts = {}) {
27
27
  schema: z.object({
28
28
  name: z.string().min(1).max(120),
29
29
  scopes: z.array(z.string().min(1)).min(1),
30
- expiresInDays: z.number().int().positive().max(3650).optional(),
30
+ expiresInDays: z.number().int().positive().max(PAT_MAX_EXPIRES_IN_DAYS).optional(),
31
31
  currentPassword: z.string().min(1),
32
32
  mfaCode: z.string().optional(),
33
33
  }),
@@ -1,10 +1,12 @@
1
1
  import { ACTION_FORM_ENTITY } from "@cosmicdrift/kumiko-framework/ui-types";
2
2
  import { fieldLabelKey, fieldOptionLabelKey } from "@cosmicdrift/kumiko-renderer/headless";
3
- import { PAT_FEATURE } from "./web/constants.js";
3
+ import { PAT_FEATURE, PatHandlers } from "./web/constants.js";
4
4
  const mintFieldKey = (field) => fieldLabelKey(PAT_FEATURE, ACTION_FORM_ENTITY, field);
5
5
  const scopeOptionKey = (grant) => fieldOptionLabelKey(PAT_FEATURE, ACTION_FORM_ENTITY, "scopes", grant);
6
6
  // The generated scope labels are English only; apps translate them under this key.
7
7
  export const patScopeOptionKey = (domain, level) => scopeOptionKey(`${domain}:${level}`);
8
+ // The revoke handler has no entity and no action form, so its title and field label only exist here.
9
+ const patRevokeKey = (suffix) => `${PatHandlers.revoke}:${suffix}`;
8
10
  export const PAT_FEATURE_I18N = {
9
11
  "screen:api-tokens.title": { en: "Personal Access Tokens" },
10
12
  "screen:api-token-create.title": { en: "Create a new token" },
@@ -19,6 +21,8 @@ export const PAT_FEATURE_I18N = {
19
21
  "pat.list.status.expired": { en: "Expired" },
20
22
  "pat.list.revoke": { en: "Revoke" },
21
23
  "pat.list.revoke.confirm": { en: "Revoke this token? Anything using it will stop working." },
24
+ [patRevokeKey("title")]: { en: "Revoke token" },
25
+ [patRevokeKey("field:id")]: { en: "Token" },
22
26
  "pat.create.title": { en: "Create a new token" },
23
27
  "pat.create.submit": { en: "Create token" },
24
28
  "pat.create.reauth": { en: "Confirm your identity" },
@@ -1,5 +1,6 @@
1
1
  import type { FeatureDefinition } from "@cosmicdrift/kumiko-framework/engine";
2
2
  import { type PatRateLimit } from "./web/constants.ts";
3
+ import type { PatScopeConfig } from "./web/scopes.ts";
3
4
  export type { BindPatAutoRevokeOnPasswordChange, PersonalAccessTokensOptions } from "./feature.ts";
4
5
  export { bindPatAutoRevokeOnPasswordChangeFromFeature, createPersonalAccessTokensFeature, } from "./feature.ts";
5
6
  export type { CreatePatOptions, PatMfaVerifyResult } from "./handlers/create.write.ts";
@@ -10,7 +11,8 @@ export { createPatResolver } from "./resolver.ts";
10
11
  export { revokeAllPatTokensForUser } from "./revoke-for-user.ts";
11
12
  export { apiTokenEntity, apiTokenTable } from "./schema/api-token.ts";
12
13
  export type { PatRateLimit } from "./web/constants.ts";
13
- export { PAT_DEFAULT_RATE_LIMIT, PAT_FEATURE, PatHandlers, PatQueries } from "./web/constants.ts";
14
+ export { PAT_DEFAULT_EXPIRES_IN_DAYS, PAT_DEFAULT_RATE_LIMIT, PAT_FEATURE, PAT_MAX_EXPIRES_IN_DAYS, PAT_SCREEN_ID, PatHandlers, PatQueries, } from "./web/constants.ts";
14
15
  export type { PatScopeConfig, PatScopeDef } from "./web/scopes.ts";
15
- export { expandScopes } from "./web/scopes.ts";
16
+ export { expandScopeEvents, expandScopes } from "./web/scopes.ts";
17
+ export declare function patScopesFromFeature(feature: FeatureDefinition): PatScopeConfig | undefined;
16
18
  export declare function patRateLimitFromFeature(feature: FeatureDefinition): PatRateLimit;