@pithy-sh/support 0.4.0 → 0.5.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/data/message.d.ts +2 -8
- package/dist/data/message.d.ts.map +1 -1
- package/dist/data/tables.d.ts +2 -8
- package/dist/data/tables.d.ts.map +1 -1
- package/dist/error/errors.d.ts +4 -3
- package/dist/error/errors.d.ts.map +1 -1
- package/dist/http/routes.d.ts +4 -1
- package/dist/http/routes.d.ts.map +1 -1
- package/dist/provision/provisionSupport.d.ts +13 -1
- package/dist/provision/provisionSupport.d.ts.map +1 -1
- package/dist/provision/provisionSupport.js +18 -3
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/package.json +8 -8
- package/src/error/errors.ts +4 -3
- package/src/http/routes.ts +4 -1
- package/src/provision/provisionSupport.ts +21 -2
- package/src/version.generated.ts +1 -1
package/dist/data/message.d.ts
CHANGED
|
@@ -51,13 +51,7 @@ export declare const SupportMessage: z.ZodObject<{
|
|
|
51
51
|
email: "email";
|
|
52
52
|
}>;
|
|
53
53
|
submittedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
-
context: z.ZodOptional<z.ZodNullable<
|
|
55
|
-
screen: z.ZodOptional<z.ZodString>;
|
|
56
|
-
appVersion: z.ZodOptional<z.ZodString>;
|
|
57
|
-
platform: z.ZodOptional<z.ZodString>;
|
|
58
|
-
environment: z.ZodOptional<z.ZodString>;
|
|
59
|
-
locale: z.ZodOptional<z.ZodString>;
|
|
60
|
-
}, z.core.$strict>]>, z.ZodObject<{
|
|
54
|
+
context: z.ZodOptional<z.ZodNullable<import("@pithy-sh/core/src/data/codecs").SqliteJson<z.ZodObject<{
|
|
61
55
|
screen: z.ZodOptional<z.ZodString>;
|
|
62
56
|
appVersion: z.ZodOptional<z.ZodString>;
|
|
63
57
|
platform: z.ZodOptional<z.ZodString>;
|
|
@@ -66,7 +60,7 @@ export declare const SupportMessage: z.ZodObject<{
|
|
|
66
60
|
}, z.core.$strict>>>>;
|
|
67
61
|
mimeMessageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
68
62
|
mimeInReplyTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
69
|
-
mimeReferences: z.ZodOptional<z.ZodNullable<
|
|
63
|
+
mimeReferences: z.ZodOptional<z.ZodNullable<import("@pithy-sh/core/src/data/codecs").SqliteJson<z.ZodArray<z.ZodString>>>>;
|
|
70
64
|
fromAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
71
65
|
fromName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
72
66
|
toAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/data/message.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB;;;;;;kBA2DlC,CAAC;AACJ,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEjF,yHAAyH;AACzH,eAAO,MAAM,mBAAmB,yBAEoF,CAAC;AACrH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEvE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/data/message.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,wBAAwB;;;;;;kBA2DlC,CAAC;AACJ,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAEjF,yHAAyH;AACzH,eAAO,MAAM,mBAAmB,yBAEoF,CAAC;AACrH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEvE;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAwHvB,CAAC;AACL,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC"}
|
package/dist/data/tables.d.ts
CHANGED
|
@@ -82,13 +82,7 @@ export declare const supportTables: {
|
|
|
82
82
|
email: "email";
|
|
83
83
|
}>;
|
|
84
84
|
submittedByUserId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
85
|
-
context: z.ZodOptional<z.ZodNullable<
|
|
86
|
-
screen: z.ZodOptional<z.ZodString>;
|
|
87
|
-
appVersion: z.ZodOptional<z.ZodString>;
|
|
88
|
-
platform: z.ZodOptional<z.ZodString>;
|
|
89
|
-
environment: z.ZodOptional<z.ZodString>;
|
|
90
|
-
locale: z.ZodOptional<z.ZodString>;
|
|
91
|
-
}, z.core.$strict>]>, z.ZodObject<{
|
|
85
|
+
context: z.ZodOptional<z.ZodNullable<import("@pithy-sh/core/src/data/codecs").SqliteJson<z.ZodObject<{
|
|
92
86
|
screen: z.ZodOptional<z.ZodString>;
|
|
93
87
|
appVersion: z.ZodOptional<z.ZodString>;
|
|
94
88
|
platform: z.ZodOptional<z.ZodString>;
|
|
@@ -97,7 +91,7 @@ export declare const supportTables: {
|
|
|
97
91
|
}, z.core.$strict>>>>;
|
|
98
92
|
mimeMessageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
99
93
|
mimeInReplyTo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
100
|
-
mimeReferences: z.ZodOptional<z.ZodNullable<
|
|
94
|
+
mimeReferences: z.ZodOptional<z.ZodNullable<import("@pithy-sh/core/src/data/codecs").SqliteJson<z.ZodArray<z.ZodString>>>>;
|
|
101
95
|
fromAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
102
96
|
fromName: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
103
97
|
toAddress: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../src/data/tables.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAO7B;;;GAGG;AAEH,8CAA8C;AAC9C,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAC3D,gEAAgE;AAChE,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAC7D,wDAAwD;AACxD,eAAO,MAAM,yBAAyB,4BAA4B,CAAC;AACnE,2EAA2E;AAC3E,eAAO,MAAM,6BAA6B,gCAAgC,CAAC;AAC3E,kEAAkE;AAClE,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAE7D;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAE3D,oEAAoE;AACpE,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../src/data/tables.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAkB,KAAK,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACjF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAO7B;;;GAGG;AAEH,8CAA8C;AAC9C,eAAO,MAAM,qBAAqB,wBAAwB,CAAC;AAC3D,gEAAgE;AAChE,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAC7D,wDAAwD;AACxD,eAAO,MAAM,yBAAyB,4BAA4B,CAAC;AACnE,2EAA2E;AAC3E,eAAO,MAAM,6BAA6B,gCAAgC,CAAC;AAC3E,kEAAkE;AAClE,eAAO,MAAM,mBAAmB,4BAA4B,CAAC;AAE7D;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,yBAAyB,CAAC;AAE3D,oEAAoE;AACpE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMa,CAAC;AAExC,qCAAqC;AACrC,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC;AAEjD,gFAAgF;AAChF,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,CAAC;AAEpE,sDAAsD;AACtD,wBAAgB,eAAe,CAAC,EAAE,EAAE,UAAU,GAAG,eAAe,CAE/D"}
|
package/dist/error/errors.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
import { PithyError } from "@pithy-sh/core/src/error/pithyError";
|
|
4
4
|
import type { MessageParams } from "@pithy-sh/core/src/i18n/catalog";
|
|
5
|
+
import type { UnmarkedString } from "@pithy-sh/core/src/privacy/types";
|
|
5
6
|
/**
|
|
6
7
|
* `@pithy-sh/support` throw sugar. The `support/*` codes live in core's closed `KitErrorPayload` union
|
|
7
8
|
* (CLAUDE.md §Errors: capabilities add their codes to the one union); these subclasses are the
|
|
@@ -15,11 +16,11 @@ import type { MessageParams } from "@pithy-sh/core/src/i18n/catalog";
|
|
|
15
16
|
/** Variable parts each subclass accepts; `code`/`status` are fixed by the subclass. */
|
|
16
17
|
interface SupportErrorArgs {
|
|
17
18
|
/** Override the public, safe-to-expose message. */
|
|
18
|
-
message?:
|
|
19
|
+
message?: UnmarkedString;
|
|
19
20
|
/** A remediation hint (CLI action line). */
|
|
20
|
-
action?:
|
|
21
|
+
action?: UnmarkedString;
|
|
21
22
|
/** Internal context for logs + audit. Never serialized to clients. */
|
|
22
|
-
detail?:
|
|
23
|
+
detail?: UnmarkedString;
|
|
23
24
|
/**
|
|
24
25
|
* Values a translating client interpolates into its own wording for this code. Client-facing, so —
|
|
25
26
|
* unlike `action` and `detail` — these cross the boundary with `message`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/error/errors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/error/errors.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAEvE;;;;;;;;;GASG;AAEH,uFAAuF;AACvF,UAAU,gBAAgB;IACxB,mDAAmD;IACnD,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB,4CAA4C;IAC5C,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,sEAAsE;IACtE,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB;;;OAGG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;CACxB;AAED,iEAAiE;AACjE,qBAAa,oBAAqB,SAAQ,UAAU;IAClD,YAAY,IAAI,GAAE,gBAAqB,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAYrE;CACF;AAED,0EAA0E;AAC1E,qBAAa,2BAA4B,SAAQ,UAAU;IACzD,YAAY,IAAI,GAAE,gBAAqB,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAYrE;CACF;AAED,4FAA4F;AAC5F,qBAAa,8BAA+B,SAAQ,UAAU;IAC5D,YAAY,IAAI,GAAE,gBAAqB,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAYrE;CACF;AAED,gGAAgG;AAChG,qBAAa,oBAAqB,SAAQ,UAAU;IAClD,YAAY,IAAI,GAAE,gBAAqB,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAYrE;CACF;AAED,4EAA4E;AAC5E,qBAAa,0BAA2B,SAAQ,UAAU;IACxD,YAAY,IAAI,GAAE,gBAAqB,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAYrE;CACF;AAED,6FAA6F;AAC7F,qBAAa,uBAAwB,SAAQ,UAAU;IACrD,YAAY,IAAI,GAAE,gBAAqB,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAYrE;CACF"}
|
package/dist/http/routes.d.ts
CHANGED
|
@@ -76,7 +76,10 @@ import { type HandlerDeps } from "./handlers";
|
|
|
76
76
|
* `createBackend` mounts **every** capability's middleware before **any** capability's routes, and the
|
|
77
77
|
* adopter's `app` capability composes last — so their middleware runs after auth has resolved the
|
|
78
78
|
* session and before this file's `requireAuth()`. `createBackend.workers.test.ts` pins that ordering,
|
|
79
|
-
* because a paragraph asserting it is not the same as a test failing when it changes.
|
|
79
|
+
* because a paragraph asserting it is not the same as a test failing when it changes. Readiness guards
|
|
80
|
+
* (`Capability.readiness`) mount between the two, after every middleware and before every route, and
|
|
81
|
+
* skip the admin surface; `createBackend.readiness.workers.test.ts` pins that. A check like this one
|
|
82
|
+
* refuses a caller, not a broken Worker, so it stays in `middleware`.
|
|
80
83
|
*
|
|
81
84
|
* Two consequences worth stating rather than discovering. Their middleware sees `c.var.auth` as **null**
|
|
82
85
|
* on an unauthenticated request, since it runs ahead of the route's own gate — so it should pass those
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/http/routes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAM7E,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAEL,KAAK,WAAW,EAUjB,MAAM,YAAY,CAAC;AA+BpB
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/http/routes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAM7E,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE1C,OAAO,EAEL,KAAK,WAAW,EAUjB,MAAM,YAAY,CAAC;AA+BpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0FG;AAEH,2CAA2C;AAC3C,MAAM,WAAW,oBAAoB;IACnC,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,qDAAqD;IACrD,WAAW,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,KAAK,OAAO,CAAC,WAAW,CAAC,CAAC;CACjE;AAuCD,mFAAmF;AACnF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,oBAAoB,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,IAAI,CAoJtG"}
|
|
@@ -48,6 +48,13 @@ export declare function supportRoutingRuleName(project: string): string;
|
|
|
48
48
|
* audits and deletes under cannot drift from the name it deploys under.
|
|
49
49
|
*/
|
|
50
50
|
export declare function supportWorkerName(project: string, env: ManagedEnvironment): string;
|
|
51
|
+
/**
|
|
52
|
+
* The Workflows the classification worker is deployed with in one environment —
|
|
53
|
+
* `<project>-<env>-support-classify`. Derived by the call `resolveSupportConfig` deploys with, so teardown
|
|
54
|
+
* deletes the names provision created and no others (#789). Deleting a Worker does not delete the
|
|
55
|
+
* Workflows registered against it.
|
|
56
|
+
*/
|
|
57
|
+
export declare function supportWorkflowNames(project: string, env: ManagedEnvironment): string[];
|
|
51
58
|
/** The live Cloudflare/wrangler seam. Each step must be idempotent. */
|
|
52
59
|
export interface SupportProvisioner {
|
|
53
60
|
/**
|
|
@@ -145,6 +152,11 @@ export interface SupportDeprovisioner {
|
|
|
145
152
|
* environment before it removes the bucket or the rule they share (#591).
|
|
146
153
|
*/
|
|
147
154
|
hasWorker(env: ManagedEnvironment): Promise<boolean>;
|
|
155
|
+
/**
|
|
156
|
+
* Delete the env's classification Workflows, by {@link supportWorkflowNames}. Idempotent (a Workflow already
|
|
157
|
+
* gone is a no-op). Deleting the worker leaves them registered, so they go first (#789).
|
|
158
|
+
*/
|
|
159
|
+
deleteWorkflows(env: ManagedEnvironment): Promise<void>;
|
|
148
160
|
/** Delete the env's classification worker. Idempotent. */
|
|
149
161
|
deleteWorker(env: ManagedEnvironment): Promise<void>;
|
|
150
162
|
/**
|
|
@@ -187,7 +199,7 @@ export interface SupportDeprovisionResult {
|
|
|
187
199
|
* is every environment's support history — so they go with the last environment, never a staging teardown.
|
|
188
200
|
* 3. Remove the routing rule, when asked, **first**: stop new mail arriving before removing the worker that would
|
|
189
201
|
* have handled it.
|
|
190
|
-
* 4. Delete the environment's worker, then — only when asked — the bucket and everything in it.
|
|
202
|
+
* 4. Delete the environment's Workflows, then its worker, then — only when asked — the bucket and everything in it.
|
|
191
203
|
*/
|
|
192
204
|
export declare function deprovisionSupport(deprovisioner: SupportDeprovisioner, target: DeprovisionTarget, options?: SupportDeprovisionOptions): Promise<SupportDeprovisionResult>;
|
|
193
205
|
//# sourceMappingURL=provisionSupport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provisionSupport.d.ts","sourceRoot":"","sources":["../../src/provision/provisionSupport.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"provisionSupport.d.ts","sourceRoot":"","sources":["../../src/provision/provisionSupport.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
-
import { SUPPORT_CAPABILITY } from "../workflows/specs.js";
|
|
3
|
+
import { SUPPORT_CAPABILITY, supportWorkflowRegistry } from "../workflows/specs.js";
|
|
4
4
|
import { GLOBAL_SCOPE } from "@pithy-sh/core/src/naming/environment";
|
|
5
5
|
import { resourceName } from "@pithy-sh/core/src/naming/resource";
|
|
6
6
|
import { resourceNames } from "@pithy-sh/core/src/naming/resourceNames";
|
|
7
|
+
import { hostWorkflowsFor } from "@pithy-sh/core/src/workflow/host";
|
|
7
8
|
import { assertSharedLeavesLast, deprovisionTarget, managedEnvironments } from "@pithy-sh/secrets/src/scope";
|
|
8
9
|
//#region src/provision/provisionSupport.ts
|
|
9
10
|
/**
|
|
@@ -61,6 +62,19 @@ function supportWorkerName(project, env) {
|
|
|
61
62
|
return resourceNames(project).env(env).worker(SUPPORT_CAPABILITY);
|
|
62
63
|
}
|
|
63
64
|
/**
|
|
65
|
+
* The Workflows the classification worker is deployed with in one environment —
|
|
66
|
+
* `<project>-<env>-support-classify`. Derived by the call `resolveSupportConfig` deploys with, so teardown
|
|
67
|
+
* deletes the names provision created and no others (#789). Deleting a Worker does not delete the
|
|
68
|
+
* Workflows registered against it.
|
|
69
|
+
*/
|
|
70
|
+
function supportWorkflowNames(project, env) {
|
|
71
|
+
return hostWorkflowsFor(supportWorkflowRegistry, {
|
|
72
|
+
project,
|
|
73
|
+
capability: SUPPORT_CAPABILITY,
|
|
74
|
+
env
|
|
75
|
+
}).workflows.map((workflow) => workflow.name);
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
64
78
|
* Provision the support infrastructure.
|
|
65
79
|
*
|
|
66
80
|
* The order matters and is the inverse of how it fails: the bucket exists before a worker that could
|
|
@@ -111,7 +125,7 @@ async function provisionSupport(provisioner, environments) {
|
|
|
111
125
|
* is every environment's support history — so they go with the last environment, never a staging teardown.
|
|
112
126
|
* 3. Remove the routing rule, when asked, **first**: stop new mail arriving before removing the worker that would
|
|
113
127
|
* have handled it.
|
|
114
|
-
* 4. Delete the environment's worker, then — only when asked — the bucket and everything in it.
|
|
128
|
+
* 4. Delete the environment's Workflows, then its worker, then — only when asked — the bucket and everything in it.
|
|
115
129
|
*/
|
|
116
130
|
async function deprovisionSupport(deprovisioner, target, options = {}) {
|
|
117
131
|
const env = deprovisionTarget(target);
|
|
@@ -123,6 +137,7 @@ async function deprovisionSupport(deprovisioner, target, options = {}) {
|
|
|
123
137
|
flag: "--routing-zone"
|
|
124
138
|
}] : []]);
|
|
125
139
|
const routingRuleRemoved = options.removeRouting ? (await deprovisioner.removeRoutingRule()).removed : false;
|
|
140
|
+
await deprovisioner.deleteWorkflows(env);
|
|
126
141
|
await deprovisioner.deleteWorker(env);
|
|
127
142
|
if (options.deleteStorage) await deprovisioner.deleteBucket();
|
|
128
143
|
return {
|
|
@@ -131,4 +146,4 @@ async function deprovisionSupport(deprovisioner, target, options = {}) {
|
|
|
131
146
|
};
|
|
132
147
|
}
|
|
133
148
|
//#endregion
|
|
134
|
-
export { deprovisionSupport, provisionSupport, supportRoutingRuleName, supportWorkerName };
|
|
149
|
+
export { deprovisionSupport, provisionSupport, supportRoutingRuleName, supportWorkerName, supportWorkflowNames };
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
/** This package's npm name — the join key against a release feed. */
|
|
4
4
|
export declare const PACKAGE_NAME = "@pithy-sh/support";
|
|
5
5
|
/** This package's version, stamped from its own package.json at generation time. */
|
|
6
|
-
export declare const PACKAGE_VERSION = "0.
|
|
6
|
+
export declare const PACKAGE_VERSION = "0.5.0";
|
|
7
7
|
//# sourceMappingURL=version.generated.d.ts.map
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
/** This package's npm name — the join key against a release feed. */
|
|
5
5
|
const PACKAGE_NAME = "@pithy-sh/support";
|
|
6
6
|
/** This package's version, stamped from its own package.json at generation time. */
|
|
7
|
-
const PACKAGE_VERSION = "0.
|
|
7
|
+
const PACKAGE_VERSION = "0.5.0";
|
|
8
8
|
//#endregion
|
|
9
9
|
export { PACKAGE_NAME, PACKAGE_VERSION };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pithy-sh/support",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"build": "tsdown && tsc -p tsconfig.build.json && bun ../../tooling/build/src/stampDeclarations.ts",
|
|
29
|
-
"typecheck": "
|
|
29
|
+
"typecheck": "bun check -p tsconfig.json",
|
|
30
30
|
"test": "vitest run",
|
|
31
31
|
"test:node": "vitest run --project=node",
|
|
32
32
|
"test:workers": "vitest run --project=workers",
|
|
@@ -40,12 +40,12 @@
|
|
|
40
40
|
"tldts": "^7.4.10"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
|
-
"@pithy-sh/auth": "^0.
|
|
44
|
-
"@pithy-sh/core": "^0.
|
|
45
|
-
"@pithy-sh/email": "^0.
|
|
46
|
-
"@pithy-sh/payments": "^0.
|
|
47
|
-
"@pithy-sh/secrets": "^0.
|
|
48
|
-
"@pithy-sh/storage": "^0.
|
|
43
|
+
"@pithy-sh/auth": "^0.10.0",
|
|
44
|
+
"@pithy-sh/core": "^0.12.0",
|
|
45
|
+
"@pithy-sh/email": "^0.6.0",
|
|
46
|
+
"@pithy-sh/payments": "^0.6.0",
|
|
47
|
+
"@pithy-sh/secrets": "^0.6.0",
|
|
48
|
+
"@pithy-sh/storage": "^0.5.0",
|
|
49
49
|
"hono": "^4.13.2",
|
|
50
50
|
"kysely": "^0.29.0",
|
|
51
51
|
"zod": "^4.4.0"
|
package/src/error/errors.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import { PithyError } from "@pithy-sh/core/src/error/pithyError";
|
|
5
5
|
import type { MessageParams } from "@pithy-sh/core/src/i18n/catalog";
|
|
6
|
+
import type { UnmarkedString } from "@pithy-sh/core/src/privacy/types";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* `@pithy-sh/support` throw sugar. The `support/*` codes live in core's closed `KitErrorPayload` union
|
|
@@ -18,11 +19,11 @@ import type { MessageParams } from "@pithy-sh/core/src/i18n/catalog";
|
|
|
18
19
|
/** Variable parts each subclass accepts; `code`/`status` are fixed by the subclass. */
|
|
19
20
|
interface SupportErrorArgs {
|
|
20
21
|
/** Override the public, safe-to-expose message. */
|
|
21
|
-
message?:
|
|
22
|
+
message?: UnmarkedString;
|
|
22
23
|
/** A remediation hint (CLI action line). */
|
|
23
|
-
action?:
|
|
24
|
+
action?: UnmarkedString;
|
|
24
25
|
/** Internal context for logs + audit. Never serialized to clients. */
|
|
25
|
-
detail?:
|
|
26
|
+
detail?: UnmarkedString;
|
|
26
27
|
/**
|
|
27
28
|
* Values a translating client interpolates into its own wording for this code. Client-facing, so —
|
|
28
29
|
* unlike `action` and `detail` — these cross the boundary with `message`.
|
package/src/http/routes.ts
CHANGED
|
@@ -125,7 +125,10 @@ import {
|
|
|
125
125
|
* `createBackend` mounts **every** capability's middleware before **any** capability's routes, and the
|
|
126
126
|
* adopter's `app` capability composes last — so their middleware runs after auth has resolved the
|
|
127
127
|
* session and before this file's `requireAuth()`. `createBackend.workers.test.ts` pins that ordering,
|
|
128
|
-
* because a paragraph asserting it is not the same as a test failing when it changes.
|
|
128
|
+
* because a paragraph asserting it is not the same as a test failing when it changes. Readiness guards
|
|
129
|
+
* (`Capability.readiness`) mount between the two, after every middleware and before every route, and
|
|
130
|
+
* skip the admin surface; `createBackend.readiness.workers.test.ts` pins that. A check like this one
|
|
131
|
+
* refuses a caller, not a broken Worker, so it stays in `middleware`.
|
|
129
132
|
*
|
|
130
133
|
* Two consequences worth stating rather than discovering. Their middleware sees `c.var.auth` as **null**
|
|
131
134
|
* on an unauthenticated request, since it runs ahead of the route's own gate — so it should pass those
|
|
@@ -5,6 +5,7 @@ import type { DeclaredEnvironments } from "@pithy-sh/core/src/naming/environment
|
|
|
5
5
|
import { GLOBAL_SCOPE } from "@pithy-sh/core/src/naming/environment";
|
|
6
6
|
import { resourceName } from "@pithy-sh/core/src/naming/resource";
|
|
7
7
|
import { resourceNames } from "@pithy-sh/core/src/naming/resourceNames";
|
|
8
|
+
import { hostWorkflowsFor } from "@pithy-sh/core/src/workflow/host";
|
|
8
9
|
import {
|
|
9
10
|
assertSharedLeavesLast,
|
|
10
11
|
type DeprovisionTarget,
|
|
@@ -12,7 +13,7 @@ import {
|
|
|
12
13
|
type ManagedEnvironment,
|
|
13
14
|
managedEnvironments,
|
|
14
15
|
} from "@pithy-sh/secrets/src/scope";
|
|
15
|
-
import { SUPPORT_CAPABILITY } from "../workflows/specs";
|
|
16
|
+
import { SUPPORT_CAPABILITY, supportWorkflowRegistry } from "../workflows/specs";
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* The provisioning orchestration for the support capability — the live counterpart to
|
|
@@ -67,6 +68,18 @@ export function supportWorkerName(project: string, env: ManagedEnvironment): str
|
|
|
67
68
|
return resourceNames(project).env(env).worker(SUPPORT_CAPABILITY);
|
|
68
69
|
}
|
|
69
70
|
|
|
71
|
+
/**
|
|
72
|
+
* The Workflows the classification worker is deployed with in one environment —
|
|
73
|
+
* `<project>-<env>-support-classify`. Derived by the call `resolveSupportConfig` deploys with, so teardown
|
|
74
|
+
* deletes the names provision created and no others (#789). Deleting a Worker does not delete the
|
|
75
|
+
* Workflows registered against it.
|
|
76
|
+
*/
|
|
77
|
+
export function supportWorkflowNames(project: string, env: ManagedEnvironment): string[] {
|
|
78
|
+
return hostWorkflowsFor(supportWorkflowRegistry, { project, capability: SUPPORT_CAPABILITY, env }).workflows.map(
|
|
79
|
+
(workflow) => workflow.name,
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
|
|
70
83
|
/** The live Cloudflare/wrangler seam. Each step must be idempotent. */
|
|
71
84
|
export interface SupportProvisioner {
|
|
72
85
|
/**
|
|
@@ -164,6 +177,11 @@ export interface SupportDeprovisioner {
|
|
|
164
177
|
* environment before it removes the bucket or the rule they share (#591).
|
|
165
178
|
*/
|
|
166
179
|
hasWorker(env: ManagedEnvironment): Promise<boolean>;
|
|
180
|
+
/**
|
|
181
|
+
* Delete the env's classification Workflows, by {@link supportWorkflowNames}. Idempotent (a Workflow already
|
|
182
|
+
* gone is a no-op). Deleting the worker leaves them registered, so they go first (#789).
|
|
183
|
+
*/
|
|
184
|
+
deleteWorkflows(env: ManagedEnvironment): Promise<void>;
|
|
167
185
|
/** Delete the env's classification worker. Idempotent. */
|
|
168
186
|
deleteWorker(env: ManagedEnvironment): Promise<void>;
|
|
169
187
|
/**
|
|
@@ -207,7 +225,7 @@ export interface SupportDeprovisionResult {
|
|
|
207
225
|
* is every environment's support history — so they go with the last environment, never a staging teardown.
|
|
208
226
|
* 3. Remove the routing rule, when asked, **first**: stop new mail arriving before removing the worker that would
|
|
209
227
|
* have handled it.
|
|
210
|
-
* 4. Delete the environment's worker, then — only when asked — the bucket and everything in it.
|
|
228
|
+
* 4. Delete the environment's Workflows, then its worker, then — only when asked — the bucket and everything in it.
|
|
211
229
|
*/
|
|
212
230
|
export async function deprovisionSupport(
|
|
213
231
|
deprovisioner: SupportDeprovisioner,
|
|
@@ -220,6 +238,7 @@ export async function deprovisionSupport(
|
|
|
220
238
|
...(options.removeRouting ? [{ what: "the inbound routing rule", flag: "--routing-zone" }] : []),
|
|
221
239
|
]);
|
|
222
240
|
const routingRuleRemoved = options.removeRouting ? (await deprovisioner.removeRoutingRule()).removed : false;
|
|
241
|
+
await deprovisioner.deleteWorkflows(env);
|
|
223
242
|
await deprovisioner.deleteWorker(env);
|
|
224
243
|
if (options.deleteStorage) await deprovisioner.deleteBucket();
|
|
225
244
|
return { env, routingRuleRemoved };
|
package/src/version.generated.ts
CHANGED