@cosmicdrift/kumiko-bundled-features 0.414.0 → 0.416.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/agent-tools/tool-catalog.js +20 -1
- package/dist/agent-tools/tool-dispatch.js +14 -5
- package/dist/auth-email-password/signup-token-store.d.ts +2 -2
- package/dist/auth-email-password/signup-token-store.js +2 -4
- package/dist/auth-email-password/web/session.js +2 -1
- package/dist/billing-foundation/checkout-core.d.ts +2 -0
- package/dist/billing-foundation/checkout-core.js +9 -0
- package/dist/billing-foundation/checkout-ledger.d.ts +7 -0
- package/dist/billing-foundation/checkout-ledger.js +6 -0
- package/dist/billing-foundation/events.d.ts +1 -0
- package/dist/billing-foundation/events.js +6 -5
- package/dist/billing-foundation/handlers/create-checkout-session.write.js +2 -1
- package/dist/billing-foundation/handlers/process-event.write.d.ts +3 -1
- package/dist/billing-foundation/handlers/process-event.write.js +57 -32
- package/dist/billing-foundation/handlers/process-payment-event.write.js +5 -5
- package/dist/billing-foundation/handlers/start-plan-checkout.write.js +2 -1
- package/dist/billing-foundation/webhook-handler.js +2 -2
- package/dist/channel-whatsapp/constants.d.ts +1 -0
- package/dist/channel-whatsapp/constants.js +1 -0
- package/dist/channel-whatsapp/events.d.ts +3 -0
- package/dist/channel-whatsapp/events.js +4 -3
- package/dist/channel-whatsapp/graph-client.d.ts +2 -0
- package/dist/channel-whatsapp/graph-client.js +29 -2
- package/dist/channel-whatsapp/inbound-handlers.js +24 -3
- package/dist/channel-whatsapp/webhook-normalize.js +21 -6
- package/dist/compliance-profiles/handlers/set-profile.write.js +2 -0
- package/dist/data-retention/feature.js +1 -0
- package/dist/delivery/handlers/opted-in-user-ids.query.js +12 -3
- package/dist/document-ingest-foundation/feature.js +1 -0
- package/dist/document-ingest-foundation/report-ingest-progress.js +4 -1
- package/dist/documents/feature.d.ts +2 -2
- package/dist/documents/feature.js +7 -2
- package/dist/form-draft/feature.js +1 -0
- package/dist/handbook-knowledge/constants.d.ts +6 -0
- package/dist/handbook-knowledge/constants.js +6 -0
- package/dist/handbook-knowledge/feature.d.ts +9 -0
- package/dist/handbook-knowledge/feature.js +17 -0
- package/dist/handbook-knowledge/handbook-index.d.ts +26 -0
- package/dist/handbook-knowledge/handbook-index.js +51 -0
- package/dist/handbook-knowledge/handlers.d.ts +28 -0
- package/dist/handbook-knowledge/handlers.js +67 -0
- package/dist/handbook-knowledge/index.d.ts +3 -0
- package/dist/handbook-knowledge/index.js +2 -0
- package/dist/helpdesk/feature.js +1 -0
- package/dist/helpdesk/handlers/reply.write.js +3 -3
- package/dist/helpdesk/handlers/report.write.js +3 -2
- package/dist/helpdesk/handlers/submit.write.js +3 -2
- package/dist/helpdesk/legacy-contact-streams.js +5 -2
- package/dist/helpdesk/lib.d.ts +1 -1
- package/dist/helpdesk/lib.js +4 -4
- package/dist/inbound-mail-foundation/account-poll.js +2 -0
- package/dist/inbound-mail-foundation/content-refetch.d.ts +3 -0
- package/dist/inbound-mail-foundation/content-refetch.js +2 -6
- package/dist/inbound-mail-foundation/entities.js +10 -9
- package/dist/inbound-mail-foundation/events.js +10 -9
- package/dist/inbound-mail-foundation/handlers/connect-account.write.js +2 -1
- package/dist/inbound-mail-foundation/handlers/forget-message.write.js +4 -0
- package/dist/inbound-mail-foundation/handlers/ingest-message-schema.js +12 -5
- package/dist/inbound-mail-foundation/normalize-inbound-message.d.ts +6 -0
- package/dist/inbound-mail-foundation/normalize-inbound-message.js +21 -8
- package/dist/inbound-mail-foundation/sanitize-inbound-html.d.ts +0 -1
- package/dist/inbound-mail-foundation/sanitize-inbound-html.js +2 -4
- package/dist/managed-pages/web/page-edit-screen.js +12 -5
- package/dist/shared/hmac-signature.js +4 -2
- package/dist/shared/index.d.ts +2 -1
- package/dist/shared/index.js +2 -1
- package/dist/shared/normalize-email.d.ts +1 -0
- package/dist/shared/normalize-email.js +3 -0
- package/dist/shared/send-best-effort.d.ts +1 -0
- package/dist/shared/send-best-effort.js +10 -5
- package/dist/signature/entity.d.ts +552 -0
- package/dist/signature/entity.js +156 -0
- package/dist/signature/feature.d.ts +3 -0
- package/dist/signature/feature.js +91 -0
- package/dist/signature/files.d.ts +23 -0
- package/dist/signature/files.js +64 -0
- package/dist/signature/grant.d.ts +32 -0
- package/dist/signature/grant.js +44 -0
- package/dist/signature/handlers/anonymous.write.d.ts +14 -0
- package/dist/signature/handlers/anonymous.write.js +52 -0
- package/dist/signature/handlers/cancel.write.d.ts +6 -0
- package/dist/signature/handlers/cancel.write.js +30 -0
- package/dist/signature/handlers/issue-link.write.d.ts +9 -0
- package/dist/signature/handlers/issue-link.write.js +57 -0
- package/dist/signature/handlers/lifecycle.write.d.ts +16 -0
- package/dist/signature/handlers/lifecycle.write.js +70 -0
- package/dist/signature/handlers/link-internal.write.d.ts +23 -0
- package/dist/signature/handlers/link-internal.write.js +186 -0
- package/dist/signature/handlers/request.write.d.ts +19 -0
- package/dist/signature/handlers/request.write.js +67 -0
- package/dist/signature/handlers/revoke-link.write.d.ts +6 -0
- package/dist/signature/handlers/revoke-link.write.js +18 -0
- package/dist/signature/handlers/sign-in-person.write.d.ts +8 -0
- package/dist/signature/handlers/sign-in-person.write.js +52 -0
- package/dist/signature/i18n.d.ts +6 -0
- package/dist/signature/i18n.js +49 -0
- package/dist/signature/index.d.ts +5 -0
- package/dist/signature/index.js +2 -0
- package/dist/signature/lib.d.ts +54 -0
- package/dist/signature/lib.js +68 -0
- package/dist/signature/options.d.ts +31 -0
- package/dist/signature/options.js +5 -0
- package/dist/signature/payloads.d.ts +60 -0
- package/dist/signature/payloads.js +53 -0
- package/dist/signature/png.d.ts +11 -0
- package/dist/signature/png.js +159 -0
- package/dist/signature/screens.d.ts +3 -0
- package/dist/signature/screens.js +95 -0
- package/dist/signature/signature-page.d.ts +25 -0
- package/dist/signature/signature-page.js +62 -0
- package/dist/signature/signing.d.ts +19 -0
- package/dist/signature/signing.js +46 -0
- package/dist/signature/static-sign.d.ts +17 -0
- package/dist/signature/static-sign.js +44 -0
- package/dist/signature/sweep.d.ts +3 -0
- package/dist/signature/sweep.js +113 -0
- package/dist/signature/user-data.d.ts +3 -0
- package/dist/signature/user-data.js +135 -0
- package/dist/signature/web/constants.d.ts +69 -0
- package/dist/signature/web/constants.js +68 -0
- package/dist/signature/web/index.d.ts +3 -0
- package/dist/signature/web/index.js +2 -0
- package/dist/signature/web/pad.d.ts +20 -0
- package/dist/signature/web/pad.js +104 -0
- package/dist/signature/web/signature-pad.d.ts +19 -0
- package/dist/signature/web/signature-pad.js +36 -0
- package/dist/step-dispatcher/deliver-dispatch-request.js +5 -3
- package/dist/step-dispatcher/feature.js +11 -0
- package/dist/step-dispatcher/sweep-abandoned.d.ts +1 -0
- package/dist/step-dispatcher/sweep-abandoned.js +3 -0
- package/dist/subscription-paddle/backfill-checkout-ledger.js +2 -0
- package/dist/subscription-paddle/redeliver-legacy-checkout.js +19 -2
- package/dist/subscription-stripe/feature.d.ts +6 -0
- package/dist/subscription-stripe/feature.js +3 -0
- package/dist/subscription-stripe/plugin-methods.d.ts +3 -1
- package/dist/subscription-stripe/plugin-methods.js +2 -1
- package/dist/subscription-stripe/verify-webhook.js +16 -6
- package/dist/template-resolver/seeding.js +32 -7
- package/dist/template-resolver/web/web-preview-renderer.js +5 -1
- package/dist/tenant-inactivity/check-inactive-tenants.js +27 -16
- package/dist/tenant-inactivity/handlers/keep-account.write.js +7 -0
- package/dist/tenant-inactivity/state-store.d.ts +2 -1
- package/dist/tenant-inactivity/state-store.js +7 -0
- package/dist/tenant-lifecycle/feature.js +1 -0
- package/dist/user/resolve-verified-user-email.js +3 -3
- package/dist/user-data-rights/feature.js +1 -0
- package/dist/waitlist/handlers/reject.write.js +2 -1
- package/dist/waitlist/handlers/submit.write.js +2 -2
- package/dist/waitlist/import.js +2 -1
- package/dist/waitlist/lib.d.ts +0 -1
- package/dist/waitlist/lib.js +1 -4
- package/dist/waitlist/link-on-signup.js +2 -2
- package/dist/workflow-runner/handlers/resume-run.write.js +4 -3
- package/package.json +43 -11
- package/src/agent-tools/changes.json +6 -0
- package/src/auth-mfa/changes.json +6 -0
- package/src/billing-foundation/changes.json +24 -0
- package/src/channel-whatsapp/changes.json +30 -0
- package/src/compliance-profiles/changes.json +5 -0
- package/src/delivery/changes.json +6 -0
- package/src/document-ingest-foundation/changes.json +6 -0
- package/src/documents/changes.json +6 -0
- package/src/handbook-knowledge/changes.json +8 -0
- package/src/helpdesk/changes.json +6 -0
- package/src/inbound-mail-foundation/changes.json +6 -0
- package/src/shared/changes.json +6 -0
- package/src/signature/changes.json +15 -0
- package/src/step-dispatcher/changes.json +6 -0
- package/src/subscription-paddle/changes.json +6 -0
- package/src/subscription-stripe/changes.json +12 -0
- package/src/template-resolver/changes.json +12 -0
- package/src/tenant-inactivity/changes.json +6 -0
- package/src/tenant-lifecycle/changes.json +6 -0
- package/src/workflow-runner/changes.json +6 -0
|
@@ -27,6 +27,9 @@ export async function sweepAbandonedDispatches(args) {
|
|
|
27
27
|
callerFeature: STEP_DISPATCHER_FEATURE,
|
|
28
28
|
});
|
|
29
29
|
try {
|
|
30
|
+
// skip: the next run checks the stream again
|
|
31
|
+
if (await args.isDeliverJobPending(aggregateId))
|
|
32
|
+
continue;
|
|
30
33
|
await closeAbandonedDispatch(applyContext, aggregateId);
|
|
31
34
|
}
|
|
32
35
|
catch (err) {
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// existed: their custom_data still carries the old tenantBinding. Once the
|
|
3
3
|
// first sweep is done the job keeps sweeping for an hour (checkouts opened by
|
|
4
4
|
// the previous release can still be paid), then does nothing.
|
|
5
|
+
// The tenant in custom_data is unverified: the key that signed the binding no longer exists.
|
|
6
|
+
// Only origin "api" and the one hour window bound that; losing a paid checkout would be worse.
|
|
5
7
|
import { parseProviderConsentId, SubscriptionFoundationHandlers, } from "@cosmicdrift/kumiko-bundled-features/billing-foundation";
|
|
6
8
|
import { createSystemUser, parseTenantId, } from "@cosmicdrift/kumiko-framework/engine";
|
|
7
9
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
@@ -3,10 +3,19 @@
|
|
|
3
3
|
// "not in the ledger" may only be waiting for the next sweep. Answering it with a retryable
|
|
4
4
|
// 5xx makes Paddle deliver it again once the sweep has ledgered the checkout.
|
|
5
5
|
import { SYSTEM_TENANT_ID } from "@cosmicdrift/kumiko-framework/engine";
|
|
6
|
+
import { createFallbackLogger } from "@cosmicdrift/kumiko-framework/logging";
|
|
6
7
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
8
|
+
import { isOneOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
7
9
|
import { isTakeoverWindowOver } from "./backfill-checkout-ledger.js";
|
|
8
10
|
import { LEDGER_BACKFILL_MARKER_HANDLER_QN, } from "./ledger-backfill-marker.js";
|
|
9
11
|
import { hasLegacyTenantBinding } from "./webhook-events.js";
|
|
12
|
+
const log = createFallbackLogger("subscription-paddle");
|
|
13
|
+
// A retry cannot fix these: the marker handler is missing, disabled or not permitted.
|
|
14
|
+
const MARKER_CONFIGURATION_ERROR_CODES = [
|
|
15
|
+
"access_denied",
|
|
16
|
+
"not_found",
|
|
17
|
+
"feature_disabled",
|
|
18
|
+
];
|
|
10
19
|
export async function shouldRedeliverLegacyCheckout(args) {
|
|
11
20
|
if (!hasLegacyTenantBinding(args.event))
|
|
12
21
|
return false;
|
|
@@ -16,9 +25,17 @@ export async function shouldRedeliverLegacyCheckout(args) {
|
|
|
16
25
|
roles: [],
|
|
17
26
|
payload: { markCompleted: false },
|
|
18
27
|
});
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
if (!marker.isSuccess) {
|
|
29
|
+
// tenantBinding is client-settable, so a permanent failure must not turn into endless 503s.
|
|
30
|
+
if (isOneOf(MARKER_CONFIGURATION_ERROR_CODES, marker.error.code)) {
|
|
31
|
+
log.warn("ledger backfill marker not readable, not redelivering", {
|
|
32
|
+
errorCode: marker.error.code,
|
|
33
|
+
});
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
// Transient or internal: Paddle redelivers only a bounded number of times, so retrying is safe.
|
|
21
37
|
return true;
|
|
38
|
+
}
|
|
22
39
|
const { completedAt } = marker.data; // @cast-boundary engine-payload
|
|
23
40
|
if (completedAt === null)
|
|
24
41
|
return true;
|
|
@@ -46,6 +46,12 @@ export type SubscriptionStripeOptions = {
|
|
|
46
46
|
* mode:"subscription" — Stripe rejects invoice_creation there; the
|
|
47
47
|
* subscription's own invoicing covers it. */
|
|
48
48
|
readonly paymentInvoiceCreation?: boolean;
|
|
49
|
+
/** Shows Stripe's promotion-code field in every checkout of this app.
|
|
50
|
+
* Default false, because the field shows even when no code exists. Codes
|
|
51
|
+
* and coupons are created in the Stripe dashboard, not in the app. The
|
|
52
|
+
* consumer-protection confirmation mail shows the catalog price captured
|
|
53
|
+
* at consent, not the discounted amount. */
|
|
54
|
+
readonly allowPromotionCodes?: boolean;
|
|
49
55
|
/** Allowlist of Stripe price-ids a mode:"payment" (one-off) checkout may
|
|
50
56
|
* target — checkout-core's `openCheckout` rejects any other priceId as
|
|
51
57
|
* `unknown_price`. App-specific and empty by default: without an
|
|
@@ -164,6 +164,9 @@ export function createSubscriptionStripeFeature(options = {}) {
|
|
|
164
164
|
...(options.paymentInvoiceCreation !== undefined && {
|
|
165
165
|
paymentInvoiceCreation: options.paymentInvoiceCreation,
|
|
166
166
|
}),
|
|
167
|
+
...(options.allowPromotionCodes !== undefined && {
|
|
168
|
+
allowPromotionCodes: options.allowPromotionCodes,
|
|
169
|
+
}),
|
|
167
170
|
}),
|
|
168
171
|
createPortalSession: createStripePortalSession(runtimes.ctx),
|
|
169
172
|
cancelSubscription: createStripeCancelSubscription(runtimes.ctx),
|
|
@@ -7,9 +7,11 @@ export type StripeCheckoutSessionRuntimeOptions = {
|
|
|
7
7
|
/** Whether a mode:"payment" checkout gets a Stripe invoice. Default true.
|
|
8
8
|
* Never applied in mode:"subscription" — Stripe rejects invoice_creation there. */
|
|
9
9
|
readonly paymentInvoiceCreation?: boolean;
|
|
10
|
+
/** Shows Stripe's promotion-code field in checkout. Default false. */
|
|
11
|
+
readonly allowPromotionCodes?: boolean;
|
|
10
12
|
};
|
|
11
13
|
export declare function mapAppLocaleToStripeLocale(locale: string): Stripe.Checkout.SessionCreateParams.Locale;
|
|
12
|
-
export declare function createStripeCheckoutSession(runtime: StripeCtxRuntime, { paymentInvoiceCreation }?: StripeCheckoutSessionRuntimeOptions): (ctx: HandlerContext, options: StripeCheckoutOptions) => Promise<{
|
|
14
|
+
export declare function createStripeCheckoutSession(runtime: StripeCtxRuntime, { paymentInvoiceCreation, allowPromotionCodes, }?: StripeCheckoutSessionRuntimeOptions): (ctx: HandlerContext, options: StripeCheckoutOptions) => Promise<{
|
|
13
15
|
url: string;
|
|
14
16
|
providerCheckoutId: string;
|
|
15
17
|
}>;
|
|
@@ -77,7 +77,7 @@ export function mapAppLocaleToStripeLocale(locale) {
|
|
|
77
77
|
function isUnknownCustomerStripeError(error) {
|
|
78
78
|
return isResourceMissingStripeError(error) && error.param === "customer";
|
|
79
79
|
}
|
|
80
|
-
export function createStripeCheckoutSession(runtime, { paymentInvoiceCreation = true } = {}) {
|
|
80
|
+
export function createStripeCheckoutSession(runtime, { paymentInvoiceCreation = true, allowPromotionCodes = false, } = {}) {
|
|
81
81
|
return async (ctx, options) => {
|
|
82
82
|
// Invariant: without billing-live, no Stripe session may be created
|
|
83
83
|
// (sk_test_-keys in production would otherwise create a test-mode checkout).
|
|
@@ -94,6 +94,7 @@ export function createStripeCheckoutSession(runtime, { paymentInvoiceCreation =
|
|
|
94
94
|
success_url: options.successUrl,
|
|
95
95
|
cancel_url: options.cancelUrl,
|
|
96
96
|
submit_type: "pay",
|
|
97
|
+
...(allowPromotionCodes && { allow_promotion_codes: true }),
|
|
97
98
|
...(options.locale && { locale: mapAppLocaleToStripeLocale(options.locale) }),
|
|
98
99
|
...(options.submitMessage && {
|
|
99
100
|
custom_text: {
|
|
@@ -116,7 +116,7 @@ export function verifyAndParseStripeWebhook(runtime, options) {
|
|
|
116
116
|
}
|
|
117
117
|
// Only the checkout ledger can vouch for a new subscription, so `created` must name its session.
|
|
118
118
|
const providerCheckoutId = normalizedType === SubscriptionEventTypes.created
|
|
119
|
-
? await findCheckoutSessionId(stripe, sub.id)
|
|
119
|
+
? await findCheckoutSessionId(stripe, sub.id, event.created)
|
|
120
120
|
: undefined;
|
|
121
121
|
return {
|
|
122
122
|
providerEventId: event.id,
|
|
@@ -131,20 +131,30 @@ export function verifyAndParseStripeWebhook(runtime, options) {
|
|
|
131
131
|
};
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
//
|
|
135
|
-
|
|
136
|
-
//
|
|
137
|
-
|
|
134
|
+
// Stripe may emit `customer.subscription.created` before the session is linked to the subscription.
|
|
135
|
+
const SESSION_LINK_GRACE_SECONDS = 600;
|
|
136
|
+
// A failing Stripe API call, or an empty list for a young event, is answered with 503 so Stripe
|
|
137
|
+
// redelivers. An empty list for an older event means the subscription has no checkout session: the
|
|
138
|
+
// created event then carries no checkout id and the foundation ignores it as not in the ledger.
|
|
139
|
+
async function findCheckoutSessionId(stripe, subscriptionId, eventCreatedSeconds) {
|
|
140
|
+
let sessionId;
|
|
138
141
|
try {
|
|
139
142
|
const sessions = await stripe.checkout.sessions.list({
|
|
140
143
|
subscription: subscriptionId,
|
|
141
144
|
limit: 1,
|
|
142
145
|
});
|
|
143
|
-
|
|
146
|
+
sessionId = sessions.data[0]?.id;
|
|
144
147
|
}
|
|
145
148
|
catch (error) {
|
|
146
149
|
throw transientProviderRejection(error);
|
|
147
150
|
}
|
|
151
|
+
if (sessionId === undefined) {
|
|
152
|
+
const ageSeconds = Temporal.Now.instant().epochMilliseconds / 1000 - eventCreatedSeconds;
|
|
153
|
+
if (ageSeconds < SESSION_LINK_GRACE_SECONDS) {
|
|
154
|
+
throw transientProviderRejection(new Error(`no checkout session linked to ${subscriptionId} yet`));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return sessionId;
|
|
148
158
|
}
|
|
149
159
|
/** Maps a Stripe subscription's price/status/period-end/cancel_at onto the
|
|
150
160
|
* foundation's normalized shape. Null when the subscription's price isn't
|
|
@@ -14,6 +14,7 @@ import { NotFoundError, VersionConflictError } from "@cosmicdrift/kumiko-framewo
|
|
|
14
14
|
import { deleteRowsWithoutReplayableStream, getStreamVersion, getUnscopedStreamMaxVersionForSeed, } from "@cosmicdrift/kumiko-framework/event-store";
|
|
15
15
|
import { createFallbackLogger } from "@cosmicdrift/kumiko-framework/logging";
|
|
16
16
|
import { runEventStoreSeed } from "@cosmicdrift/kumiko-framework/seeding";
|
|
17
|
+
import { SYSTEM_USER_ID } from "@cosmicdrift/kumiko-types/identifiers";
|
|
17
18
|
import { isPlainObject, propertyOf } from "@cosmicdrift/kumiko-types/type-guards";
|
|
18
19
|
import { executor } from "./handlers/shared.js";
|
|
19
20
|
import { evaluateTemplateWrite } from "./handlers/template-gates.js";
|
|
@@ -285,24 +286,48 @@ const ALREADY_REMOVED_ERROR_CODES = new Set([
|
|
|
285
286
|
new VersionConflictError({ entityId: "", expectedVersion: 0, currentVersion: 0 }).code,
|
|
286
287
|
]);
|
|
287
288
|
const NOTIFICATION_SLUG_PATTERN = /^([^:]+):notify:[^:]+$/;
|
|
288
|
-
function
|
|
289
|
+
function orphanVerdictOf(registry, slug) {
|
|
289
290
|
const feature = NOTIFICATION_SLUG_PATTERN.exec(slug)?.[1];
|
|
290
291
|
if (feature === undefined)
|
|
291
|
-
return
|
|
292
|
+
return "not-orphaned";
|
|
292
293
|
const notifications = registry.getAllNotifications();
|
|
293
294
|
if (notifications.has(slug))
|
|
294
|
-
return
|
|
295
|
+
return "not-orphaned";
|
|
295
296
|
const renamedAway = Array.from(notifications.values()).some((notification) => notification.renamedFrom?.includes(slug));
|
|
296
|
-
|
|
297
|
+
if (renamedAway)
|
|
298
|
+
return "renamed-away";
|
|
299
|
+
return registry.getFeature(feature) !== undefined ? "unknown-to-registry" : "not-orphaned";
|
|
300
|
+
}
|
|
301
|
+
// Seeds write as the system user; a row only the system user ever touched still holds seed text.
|
|
302
|
+
function isUneditedSeedRow(row) {
|
|
303
|
+
return (row.insertedById === SYSTEM_USER_ID &&
|
|
304
|
+
(row.modifiedById === null || row.modifiedById === SYSTEM_USER_ID));
|
|
297
305
|
}
|
|
298
306
|
// A removed or renamed notification leaves its seeded system rows behind; they would keep
|
|
299
|
-
// showing up in the template overview.
|
|
300
|
-
//
|
|
307
|
+
// showing up in the template overview. A notification that is merely unknown to this boot
|
|
308
|
+
// (conditional registration, older pod during a rolling deploy) only loses rows nobody edited.
|
|
309
|
+
// Tenant overrides may hold customer text, so they stay and are only reported. Slugs of
|
|
310
|
+
// unmounted features are not ours to judge.
|
|
301
311
|
async function removeOrphanedNotificationTemplates(db, registry) {
|
|
302
312
|
const rows = await selectMany(db, templateResourcesTable, {
|
|
303
313
|
kind: "mail",
|
|
304
314
|
});
|
|
305
|
-
const orphans =
|
|
315
|
+
const orphans = [];
|
|
316
|
+
for (const row of rows) {
|
|
317
|
+
const verdict = orphanVerdictOf(registry, row.slug);
|
|
318
|
+
if (verdict === "not-orphaned")
|
|
319
|
+
continue;
|
|
320
|
+
if (verdict === "unknown-to-registry" &&
|
|
321
|
+
row.tenantId === SYSTEM_TENANT_ID &&
|
|
322
|
+
!isUneditedSeedRow(row)) {
|
|
323
|
+
log.warn("edited system template of a notification unknown to this boot is kept", {
|
|
324
|
+
slug: row.slug,
|
|
325
|
+
locale: row.locale,
|
|
326
|
+
});
|
|
327
|
+
continue;
|
|
328
|
+
}
|
|
329
|
+
orphans.push(row);
|
|
330
|
+
}
|
|
306
331
|
// skip: nothing orphaned
|
|
307
332
|
if (orphans.length === 0)
|
|
308
333
|
return;
|
|
@@ -3,6 +3,7 @@ import { dispatcherErrorText, substituteVariables, useDebouncedValue, usePrimiti
|
|
|
3
3
|
import { HtmlMailFrame, LoadingState, ModeSwitch, PreviewWidthFrame, } from "@cosmicdrift/kumiko-renderer/web";
|
|
4
4
|
import { isPlainObject } from "@cosmicdrift/kumiko-types/type-guards";
|
|
5
5
|
import { useState } from "react";
|
|
6
|
+
import { fillDocumentVariables } from "./fill-document-variables.js";
|
|
6
7
|
import { TemplateResolverQueries } from "./qualified-names.js";
|
|
7
8
|
import { stringValuesOf } from "./string-values.js";
|
|
8
9
|
const PREVIEW_DEBOUNCE_MS = 300;
|
|
@@ -37,5 +38,8 @@ export function BodyPreviewFrame({ body, bodyFormat, }) {
|
|
|
37
38
|
// Markdown with the example values filled in.
|
|
38
39
|
export const WebPreviewRenderer = ({ content, editFormat, variables, }) => {
|
|
39
40
|
const isDocument = editFormat === "document";
|
|
40
|
-
|
|
41
|
+
const examples = stringValuesOf(variables);
|
|
42
|
+
return (_jsx(BodyPreviewFrame, { body: isDocument
|
|
43
|
+
? fillDocumentVariables(content, examples)
|
|
44
|
+
: substituteVariables(content, examples), bodyFormat: isDocument ? "document" : "markdown" }));
|
|
41
45
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
1
|
+
import { fetchOne, runInOwnTransaction } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { hasMailTranslations, mailT } from "@cosmicdrift/kumiko-framework/i18n";
|
|
3
3
|
import { parseRoles } from "@cosmicdrift/kumiko-framework/utils";
|
|
4
4
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
@@ -11,7 +11,7 @@ import { activityBase, decideInactivityAction, foldActivity, resetWarnings, } fr
|
|
|
11
11
|
import { signKeepAccountToken } from "./keep-token.js";
|
|
12
12
|
import { InactivityWarningNotificationType, inactivityMailTemplateLocale, } from "./mail-notifications.js";
|
|
13
13
|
import { resolveInactivityRule } from "./options.js";
|
|
14
|
-
import { isInactivityCycleCurrent, loadInactivityState, loadNewestSessionActivity, saveInactivityState, } from "./state-store.js";
|
|
14
|
+
import { isInactivityCycleCurrent, loadInactivityState, loadNewestSessionActivity, lockInactivityCycle, saveInactivityState, } from "./state-store.js";
|
|
15
15
|
// Links outlive the deadline a little so a late click still counts as a reaction.
|
|
16
16
|
const KEEP_LINK_GRACE_MINUTES = 14 * 24 * 60;
|
|
17
17
|
const MS_PER_MINUTE = 60_000;
|
|
@@ -118,6 +118,29 @@ async function sendWarningMails(args) {
|
|
|
118
118
|
}
|
|
119
119
|
return delivered;
|
|
120
120
|
}
|
|
121
|
+
// The probes and mails before this are slow; a keep link redeemed meanwhile must not end in a
|
|
122
|
+
// deletion request. Check and request share one transaction under the lock the redemption takes.
|
|
123
|
+
async function requestDestructionUnlessKept(ctx, registry, tenantId, stored, now) {
|
|
124
|
+
return runInOwnTransaction(ctx.db, async (txDb) => {
|
|
125
|
+
const runner = txDb.unsafeRaw();
|
|
126
|
+
await lockInactivityCycle(runner, tenantId);
|
|
127
|
+
if (stored !== null && !(await isInactivityCycleCurrent(txDb, stored.cycleId)))
|
|
128
|
+
return false;
|
|
129
|
+
const result = await requestTenantDestruction({
|
|
130
|
+
tenantId,
|
|
131
|
+
actor: ctx.systemUser,
|
|
132
|
+
now,
|
|
133
|
+
db: txDb,
|
|
134
|
+
runner,
|
|
135
|
+
registry,
|
|
136
|
+
revokeSessions: true,
|
|
137
|
+
});
|
|
138
|
+
if (!result.isSuccess) {
|
|
139
|
+
throw new Error(`tenant-inactivity: destruction request for ${tenantId} failed`);
|
|
140
|
+
}
|
|
141
|
+
return true;
|
|
142
|
+
});
|
|
143
|
+
}
|
|
121
144
|
async function evaluate(ctx, options, tenantId, rule, stored, now) {
|
|
122
145
|
const initial = stored ?? emptyState(now);
|
|
123
146
|
const folded = foldActivity(initial, await loadNewestSessionActivity(ctx.db));
|
|
@@ -151,21 +174,9 @@ async function evaluate(ctx, options, tenantId, rule, stored, now) {
|
|
|
151
174
|
}
|
|
152
175
|
if (!ctx.registry)
|
|
153
176
|
throw new Error("tenant-inactivity: ctx.registry required");
|
|
154
|
-
|
|
155
|
-
if (
|
|
177
|
+
const requested = await requestDestructionUnlessKept(ctx, ctx.registry, tenantId, stored, now);
|
|
178
|
+
if (!requested)
|
|
156
179
|
return state;
|
|
157
|
-
const result = await requestTenantDestruction({
|
|
158
|
-
tenantId,
|
|
159
|
-
actor: ctx.systemUser,
|
|
160
|
-
now,
|
|
161
|
-
db: ctx.db,
|
|
162
|
-
runner: ctx.db.unsafeRaw(),
|
|
163
|
-
registry: ctx.registry,
|
|
164
|
-
revokeSessions: true,
|
|
165
|
-
});
|
|
166
|
-
if (!result.isSuccess) {
|
|
167
|
-
throw new Error(`tenant-inactivity: destruction request for ${tenantId} failed`);
|
|
168
|
-
}
|
|
169
180
|
// If the owner cancels the request, a fresh cycle starts instead of an instant second request.
|
|
170
181
|
return startNewCycle({ ...state, lastActivityAt: now });
|
|
171
182
|
}
|
|
@@ -2,7 +2,9 @@ import { fetchOne, updateMany } from "@cosmicdrift/kumiko-framework/db";
|
|
|
2
2
|
import { defineWriteHandler } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { UnprocessableError, writeFailure } from "@cosmicdrift/kumiko-framework/errors";
|
|
4
4
|
import * as z from "zod";
|
|
5
|
+
import { tenantTable } from "../../tenant/index.js";
|
|
5
6
|
import { redeemKeepAccountToken } from "../keep-token.js";
|
|
7
|
+
import { lockInactivityCycle } from "../state-store.js";
|
|
6
8
|
import { tenantInactivityStateTable } from "../state-table.js";
|
|
7
9
|
const KEEP_ACCOUNT_ESCAPE_HATCH_REASON = "the anonymous link holder has no tenant scope; the tenant comes from the signed token and every statement filters by that tenantId";
|
|
8
10
|
export function createKeepAccountHandler(opts) {
|
|
@@ -33,6 +35,11 @@ export function createKeepAccountHandler(opts) {
|
|
|
33
35
|
return row?.cycleId ?? null;
|
|
34
36
|
},
|
|
35
37
|
commitKeep: async (tenantId, cycleId) => {
|
|
38
|
+
await lockInactivityCycle(runner, tenantId);
|
|
39
|
+
// A destruction request that won the lock owns the tenant now; reporting "kept" would be a lie.
|
|
40
|
+
const tenant = await fetchOne(runner, tenantTable, { id: tenantId });
|
|
41
|
+
if (tenant?.status !== "active")
|
|
42
|
+
return false;
|
|
36
43
|
const updated = await updateMany(runner, tenantInactivityStateTable, {
|
|
37
44
|
lastActivityAt: now,
|
|
38
45
|
warningsSent: 0,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type DbRunner, type TenantDb } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
3
3
|
import type { InactivityState } from "./inactivity-plan.ts";
|
|
4
4
|
export type StoredInactivityState = InactivityState & {
|
|
@@ -7,5 +7,6 @@ export type StoredInactivityState = InactivityState & {
|
|
|
7
7
|
export declare function loadInactivityState(db: TenantDb): Promise<StoredInactivityState | null>;
|
|
8
8
|
export declare function isSameInactivityState(a: StoredInactivityState | null, b: StoredInactivityState): boolean;
|
|
9
9
|
export declare function saveInactivityState(db: TenantDb, previous: StoredInactivityState | null, next: StoredInactivityState): Promise<void>;
|
|
10
|
+
export declare function lockInactivityCycle(runner: DbRunner, tenantId: string): Promise<void>;
|
|
10
11
|
export declare function isInactivityCycleCurrent(db: TenantDb, cycleId: string): Promise<boolean>;
|
|
11
12
|
export declare function loadNewestSessionActivity(db: TenantDb): Promise<Temporal.Instant | null>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { acquireNamespacedAdvisoryLock, } from "@cosmicdrift/kumiko-framework/db";
|
|
1
2
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
2
3
|
import { userSessionTable } from "../sessions/index.js";
|
|
3
4
|
import { tenantInactivityStateTable } from "./state-table.js";
|
|
5
|
+
const CYCLE_LOCK_NAMESPACE = 0x696e6163; // 'inac'
|
|
4
6
|
const EPOCH = Temporal.Instant.fromEpochMilliseconds(0);
|
|
5
7
|
export async function loadInactivityState(db) {
|
|
6
8
|
const row = await db.fetchOne(tenantInactivityStateTable, { tenantId: db.tenantId });
|
|
@@ -47,6 +49,11 @@ export async function saveInactivityState(db, previous, next) {
|
|
|
47
49
|
});
|
|
48
50
|
}
|
|
49
51
|
}
|
|
52
|
+
// Serializes the destruction request against keep-link redemption: both hold this lock while they
|
|
53
|
+
// decide, so exactly one of them wins and the other sees the result.
|
|
54
|
+
export async function lockInactivityCycle(runner, tenantId) {
|
|
55
|
+
await acquireNamespacedAdvisoryLock(runner, CYCLE_LOCK_NAMESPACE, tenantId);
|
|
56
|
+
}
|
|
50
57
|
export async function isInactivityCycleCurrent(db, cycleId) {
|
|
51
58
|
const row = await db.fetchOne(tenantInactivityStateTable, { tenantId: db.tenantId });
|
|
52
59
|
return !row || row.cycleId === cycleId;
|
|
@@ -83,6 +83,7 @@ export function createTenantLifecycleFeature() {
|
|
|
83
83
|
r.job({
|
|
84
84
|
name: "run-tenant-destruction",
|
|
85
85
|
trigger: { cron: "0 * * * * *", wakesSleepingApp: false },
|
|
86
|
+
irreversibleWithoutEntryHandler: "high-risk-or-cron-pipeline",
|
|
86
87
|
concurrency: "skip",
|
|
87
88
|
escapeHatch: { reason: RUN_TENANT_DESTRUCTION_REASON },
|
|
88
89
|
handler: async (_payload, ctx) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { decryptStoredPii } from "../shared/index.js";
|
|
1
|
+
import { decryptStoredPii, normalizeEmail } from "../shared/index.js";
|
|
2
2
|
import { userTable } from "./schema/user.js";
|
|
3
3
|
// Only a verified owner may see or erase rows matched by email. Forget keeps emailVerified but has
|
|
4
4
|
// already rewritten the email, hence the pre-tx copy.
|
|
@@ -9,6 +9,6 @@ export async function resolveVerifiedUserEmail(ctx, piiDecryptReason) {
|
|
|
9
9
|
if (row?.emailVerified !== true)
|
|
10
10
|
return null;
|
|
11
11
|
if (ctx.userEmailBeforeDelete)
|
|
12
|
-
return ctx.userEmailBeforeDelete
|
|
13
|
-
return (await decryptStoredPii(row.email, "email", piiDecryptReason))
|
|
12
|
+
return normalizeEmail(ctx.userEmailBeforeDelete);
|
|
13
|
+
return normalizeEmail(await decryptStoredPii(row.email, "email", piiDecryptReason));
|
|
14
14
|
}
|
|
@@ -512,6 +512,7 @@ export function createUserDataRightsFeature(opts = {}) {
|
|
|
512
512
|
r.job({
|
|
513
513
|
name: "run-forget-cleanup",
|
|
514
514
|
trigger: { maintenance: true },
|
|
515
|
+
irreversibleWithoutEntryHandler: "high-risk-or-cron-pipeline",
|
|
515
516
|
concurrency: "skip",
|
|
516
517
|
escapeHatch: { reason: RUN_FORGET_CLEANUP_REASON },
|
|
517
518
|
handler: async (_payload, ctx) => {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { selectMany } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { createSystemUser, defineWriteHandler, parseTenantId, } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { InternalError, NotFoundError, UnprocessableError, writeFailure, } from "@cosmicdrift/kumiko-framework/errors";
|
|
4
|
+
import { normalizeEmail } from "../../shared/index.js";
|
|
4
5
|
import { cancelPendingInvitation, INVITATION_STATUS, tenantInvitationsTable, } from "../../tenant/index.js";
|
|
5
6
|
import { isOpenWaitlistStatus } from "../entity.js";
|
|
6
|
-
import { adminAccess, isTenantMember,
|
|
7
|
+
import { adminAccess, isTenantMember, platformActor, waitlistDb, waitlistExecutor, } from "../lib.js";
|
|
7
8
|
import { WaitlistIdSchema } from "../payloads.js";
|
|
8
9
|
import { WAITLIST_STATUS, WaitlistErrors } from "../web/constants.js";
|
|
9
10
|
// An invited entry already has a live invitation link; rejecting must kill it,
|
|
@@ -2,8 +2,8 @@ import { acquireNamespacedAdvisoryLock, createSystemDbView, createTenantDb, runI
|
|
|
2
2
|
import { defineWriteHandler, } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
|
|
4
4
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
5
|
-
import { sendBestEffort } from "../../shared/index.js";
|
|
6
|
-
import {
|
|
5
|
+
import { normalizeEmail, sendBestEffort } from "../../shared/index.js";
|
|
6
|
+
import { platformActor, waitlistDb, waitlistExecutor } from "../lib.js";
|
|
7
7
|
import { resolveWaitlistMailLocale, waitlistAdminNoticeVariables, waitlistConfirmationVariables, } from "../mail.js";
|
|
8
8
|
import { DEFAULT_SUBMIT_EMAIL_RATE_LIMITS, DEFAULT_SUBMIT_RATE_LIMIT, } from "../options.js";
|
|
9
9
|
import { WaitlistSubmitSchema } from "../payloads.js";
|
package/dist/waitlist/import.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
2
|
import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
|
|
3
|
-
import { normalizeEmail
|
|
3
|
+
import { normalizeEmail } from "../shared/index.js";
|
|
4
|
+
import { platformActor, waitlistExecutor } from "./lib.js";
|
|
4
5
|
import { WAITLIST_FIELD_LIMITS } from "./web/constants.js";
|
|
5
6
|
// RFC 4122 name-based UUID (v5 layout, fixed namespace) so a re-run finds the entry
|
|
6
7
|
// it created before without matching on encrypted personal data.
|
package/dist/waitlist/lib.d.ts
CHANGED
|
@@ -28,7 +28,6 @@ export declare const waitlistExecutor: import("@cosmicdrift/kumiko-types/event-s
|
|
|
28
28
|
readonly status: string;
|
|
29
29
|
readonly submittedAt: Temporal.Instant;
|
|
30
30
|
}>;
|
|
31
|
-
export declare function normalizeEmail(email: string): string;
|
|
32
31
|
export declare function waitlistDb(ctx: Pick<AppContext, "systemDb">): TenantDb;
|
|
33
32
|
export declare function platformActor(): SessionUser;
|
|
34
33
|
export declare function isTenantMember(db: TenantDb, email: string, tenantId: TenantId): Promise<boolean>;
|
package/dist/waitlist/lib.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createEventStoreExecutor, fetchOne, } from "@cosmicdrift/kumiko-framework/db";
|
|
2
2
|
import { access, createSystemUser, SYSTEM_TENANT_ID, } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
|
-
import { acknowledgedSystemDb } from "../shared/index.js";
|
|
3
|
+
import { acknowledgedSystemDb, normalizeEmail } from "../shared/index.js";
|
|
4
4
|
import { tenantMembershipsTable } from "../tenant/index.js";
|
|
5
5
|
import { userTable } from "../user/index.js";
|
|
6
6
|
import { waitlistEntryEntity, waitlistEntryTable } from "./entity.js";
|
|
@@ -9,9 +9,6 @@ export const adminAccess = { roles: access.systemAdmin };
|
|
|
9
9
|
export const waitlistExecutor = createEventStoreExecutor(waitlistEntryTable, waitlistEntryEntity, {
|
|
10
10
|
entityName: "waitlistEntry",
|
|
11
11
|
});
|
|
12
|
-
export function normalizeEmail(email) {
|
|
13
|
-
return email.toLowerCase();
|
|
14
|
-
}
|
|
15
12
|
export function waitlistDb(ctx) {
|
|
16
13
|
return acknowledgedSystemDb(ctx, "waitlist", WAITLIST_CROSS_TENANT_REASON);
|
|
17
14
|
}
|
|
@@ -2,10 +2,10 @@ import { createTenantDb, entityEventName, fetchOne, selectMany, } from "@cosmicd
|
|
|
2
2
|
import { SYSTEM_TENANT_ID } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
3
|
import { parseRoles } from "@cosmicdrift/kumiko-framework/utils";
|
|
4
4
|
import { Temporal } from "@cosmicdrift/kumiko-types/temporal";
|
|
5
|
-
import { decryptStoredPii } from "../shared/index.js";
|
|
5
|
+
import { decryptStoredPii, normalizeEmail } from "../shared/index.js";
|
|
6
6
|
import { tenantMembershipsTable } from "../tenant/index.js";
|
|
7
7
|
import { userTable } from "../user/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import { platformActor, waitlistExecutor } from "./lib.js";
|
|
9
9
|
import { DEFAULT_OWN_TENANT_INVITE_ROLE, WAITLIST_STATUS } from "./web/constants.js";
|
|
10
10
|
const PII_DECRYPT_REASON = "waitlist:link-on-signup";
|
|
11
11
|
export const WAITLIST_MEMBERSHIP_CREATED_EVENT = entityEventName("tenant-membership", "created");
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
// resultKey on steps/wait-for-event.ts) — pre-seeded into stepsAcc below so
|
|
31
31
|
// a subsequent step's resolver can read `ctx.steps[awaits.someKey]`.
|
|
32
32
|
import { fetchOne } from "@cosmicdrift/kumiko-framework/db";
|
|
33
|
-
import { buildPipelineSteps, computeDefinitionFingerprint, describeWorkflowStepError, getStep, runStepList, SYSTEM_ROLE, unwrapWorkflowStepError, WORKFLOW_AGGREGATE_TYPE, WORKFLOW_RESUMED_TYPE, WORKFLOW_RETRY_SCHEDULED_TYPE, WORKFLOW_RUN_COMPLETED_TYPE, WORKFLOW_RUN_FAILED_TYPE, WORKFLOW_RUN_STARTED_TYPE, WORKFLOW_WAITING_FOR_EVENT_TYPE, WorkflowStepError, } from "@cosmicdrift/kumiko-framework/engine";
|
|
33
|
+
import { attachOutsideTransaction, buildPipelineSteps, computeDefinitionFingerprint, describeWorkflowStepError, getStep, runStepList, SYSTEM_ROLE, unwrapWorkflowStepError, WORKFLOW_AGGREGATE_TYPE, WORKFLOW_RESUMED_TYPE, WORKFLOW_RETRY_SCHEDULED_TYPE, WORKFLOW_RUN_COMPLETED_TYPE, WORKFLOW_RUN_FAILED_TYPE, WORKFLOW_RUN_STARTED_TYPE, WORKFLOW_WAITING_FOR_EVENT_TYPE, WorkflowStepError, } from "@cosmicdrift/kumiko-framework/engine";
|
|
34
34
|
import { InternalError } from "@cosmicdrift/kumiko-framework/errors";
|
|
35
35
|
import { createFallbackLogger } from "@cosmicdrift/kumiko-framework/logging";
|
|
36
36
|
import * as z from "zod";
|
|
@@ -215,8 +215,9 @@ async function runResumedPipeline(ctx, db, input) {
|
|
|
215
215
|
...(pending.retryAttempt !== null && { retryAttempt: pending.retryAttempt + 1 }),
|
|
216
216
|
};
|
|
217
217
|
const stepsAcc = seedResumedStepResults(pending.suspensionEventType, awaitedPayload, steps, stepIndex);
|
|
218
|
-
// The handler is system-scoped, so ctx.db is unusable; the steps
|
|
219
|
-
|
|
218
|
+
// The handler is system-scoped, so ctx.db is unusable; the steps get the tenant db without
|
|
219
|
+
// outsideTransaction. Dropped in place: a copy would fall out of the identity-keyed TenantDb registries.
|
|
220
|
+
const outcome = await runStepList(steps, triggerEvent, { ...ctx, db: attachOutsideTransaction(db, undefined) }, stepsAcc, {}, workflowCtx, resumeFrom);
|
|
220
221
|
if (outcome.kind === "suspended") {
|
|
221
222
|
if (!isResumableSuspension(steps, outcome.stepIndex)) {
|
|
222
223
|
throw new WorkflowSuspensionUnsupportedError(workflowName, outcome.stepIndex);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-bundled-features",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.416.0",
|
|
4
4
|
"description": "Built-in features — tenant, user, auth, delivery. The stuff you'd rewrite anyway, already typed.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -592,6 +592,22 @@
|
|
|
592
592
|
"types": "./dist/waitlist/static-submit.d.ts",
|
|
593
593
|
"default": "./dist/waitlist/static-submit.js"
|
|
594
594
|
},
|
|
595
|
+
"./signature": {
|
|
596
|
+
"types": "./dist/signature/index.d.ts",
|
|
597
|
+
"default": "./dist/signature/index.js"
|
|
598
|
+
},
|
|
599
|
+
"./signature/web": {
|
|
600
|
+
"types": "./dist/signature/web/index.d.ts",
|
|
601
|
+
"default": "./dist/signature/web/index.js"
|
|
602
|
+
},
|
|
603
|
+
"./signature/static-sign": {
|
|
604
|
+
"types": "./dist/signature/static-sign.d.ts",
|
|
605
|
+
"default": "./dist/signature/static-sign.js"
|
|
606
|
+
},
|
|
607
|
+
"./handbook-knowledge": {
|
|
608
|
+
"types": "./dist/handbook-knowledge/index.d.ts",
|
|
609
|
+
"default": "./dist/handbook-knowledge/index.js"
|
|
610
|
+
},
|
|
595
611
|
"./page-render": {
|
|
596
612
|
"types": "./dist/page-render/index.d.ts",
|
|
597
613
|
"default": "./dist/page-render/index.js"
|
|
@@ -626,9 +642,9 @@
|
|
|
626
642
|
}
|
|
627
643
|
},
|
|
628
644
|
"dependencies": {
|
|
629
|
-
"@cosmicdrift/kumiko-framework": "0.
|
|
630
|
-
"@cosmicdrift/kumiko-renderer": "0.
|
|
631
|
-
"@cosmicdrift/kumiko-types": "0.
|
|
645
|
+
"@cosmicdrift/kumiko-framework": "0.416.0",
|
|
646
|
+
"@cosmicdrift/kumiko-renderer": "0.416.0",
|
|
647
|
+
"@cosmicdrift/kumiko-types": "0.416.0",
|
|
632
648
|
"@mollie/api-client": "^4.6.0",
|
|
633
649
|
"@node-rs/argon2": "^2.2.2",
|
|
634
650
|
"@tiptap/core": "^3.32.2",
|
|
@@ -1236,6 +1252,22 @@
|
|
|
1236
1252
|
"types": "./dist/waitlist/static-submit.d.ts",
|
|
1237
1253
|
"default": "./dist/waitlist/static-submit.js"
|
|
1238
1254
|
},
|
|
1255
|
+
"./signature": {
|
|
1256
|
+
"types": "./dist/signature/index.d.ts",
|
|
1257
|
+
"default": "./dist/signature/index.js"
|
|
1258
|
+
},
|
|
1259
|
+
"./signature/web": {
|
|
1260
|
+
"types": "./dist/signature/web/index.d.ts",
|
|
1261
|
+
"default": "./dist/signature/web/index.js"
|
|
1262
|
+
},
|
|
1263
|
+
"./signature/static-sign": {
|
|
1264
|
+
"types": "./dist/signature/static-sign.d.ts",
|
|
1265
|
+
"default": "./dist/signature/static-sign.js"
|
|
1266
|
+
},
|
|
1267
|
+
"./handbook-knowledge": {
|
|
1268
|
+
"types": "./dist/handbook-knowledge/index.d.ts",
|
|
1269
|
+
"default": "./dist/handbook-knowledge/index.js"
|
|
1270
|
+
},
|
|
1239
1271
|
"./page-render": {
|
|
1240
1272
|
"types": "./dist/page-render/index.d.ts",
|
|
1241
1273
|
"default": "./dist/page-render/index.js"
|
|
@@ -1278,19 +1310,19 @@
|
|
|
1278
1310
|
"LICENSE"
|
|
1279
1311
|
],
|
|
1280
1312
|
"devDependencies": {
|
|
1281
|
-
"@cosmicdrift/kumiko-locale-de": "0.
|
|
1282
|
-
"@cosmicdrift/kumiko-locale-es": "0.
|
|
1283
|
-
"@cosmicdrift/kumiko-locale-fr": "0.
|
|
1284
|
-
"@cosmicdrift/kumiko-locale-it": "0.
|
|
1285
|
-
"@cosmicdrift/kumiko-renderer-mail-html": "0.
|
|
1286
|
-
"@cosmicdrift/kumiko-testing": "0.
|
|
1313
|
+
"@cosmicdrift/kumiko-locale-de": "0.416.0",
|
|
1314
|
+
"@cosmicdrift/kumiko-locale-es": "0.416.0",
|
|
1315
|
+
"@cosmicdrift/kumiko-locale-fr": "0.416.0",
|
|
1316
|
+
"@cosmicdrift/kumiko-locale-it": "0.416.0",
|
|
1317
|
+
"@cosmicdrift/kumiko-renderer-mail-html": "0.416.0",
|
|
1318
|
+
"@cosmicdrift/kumiko-testing": "0.416.0",
|
|
1287
1319
|
"@testing-library/user-event": "^14.6.8",
|
|
1288
1320
|
"@types/sanitize-html": "^2.16.2",
|
|
1289
1321
|
"jsqr": "^1.4.0",
|
|
1290
1322
|
"unpdf": "^1.9.1"
|
|
1291
1323
|
},
|
|
1292
1324
|
"peerDependencies": {
|
|
1293
|
-
"@cosmicdrift/kumiko-testing": "0.
|
|
1325
|
+
"@cosmicdrift/kumiko-testing": "0.416.0"
|
|
1294
1326
|
},
|
|
1295
1327
|
"peerDependenciesMeta": {
|
|
1296
1328
|
"@cosmicdrift/kumiko-testing": {
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.416.0",
|
|
4
|
+
"type": "improvement",
|
|
5
|
+
"title": "ask_user options can carry a preview",
|
|
6
|
+
"detail": "Each option of the `ask_user` agent tool is a string or `{ label, preview? }`, where `preview` is the text the agent writes if the option is chosen. Plain string options keep working."
|
|
7
|
+
},
|
|
2
8
|
{
|
|
3
9
|
"version": "0.414.0",
|
|
4
10
|
"type": "fix",
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"version": "0.415.0",
|
|
4
|
+
"type": "fix",
|
|
5
|
+
"title": "Signed tokens accept only the exact signature text",
|
|
6
|
+
"detail": "`hmacSignatureMatches` compared the decoded bytes, so a signature whose last character differed only in its unused trailing bits also verified. It now compares the text. No consumer action needed."
|
|
7
|
+
},
|
|
2
8
|
{
|
|
3
9
|
"version": "0.405.0",
|
|
4
10
|
"type": "improvement",
|