@pithy-sh/support 0.1.4 → 0.1.6
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/provision/provisionSupport.d.ts +7 -3
- package/dist/provision/provisionSupport.d.ts.map +1 -1
- package/dist/provision/provisionSupport.js +14 -7
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/package.json +7 -7
- package/pithy.manifest.json +1 -1
- package/src/provision/provisionSupport.ts +15 -6
- package/src/version.generated.ts +1 -1
|
@@ -120,9 +120,13 @@ export interface SupportProvisionResult {
|
|
|
120
120
|
* Worker whose classification host is not deployed yet, which is a window where real customer
|
|
121
121
|
* messages arrive and stay `uncategorized` with nothing to say why.
|
|
122
122
|
*
|
|
123
|
-
* `environments` is the
|
|
124
|
-
*
|
|
125
|
-
*
|
|
123
|
+
* `environments` is **what the caller determined it can act on**, which the CLI narrows from the project's
|
|
124
|
+
* declaration (#241) to the environments whose app database exists (pithy-sh/pithy#512). Nothing is
|
|
125
|
+
* skipped here and nothing decides here: an environment reaching this list is provisioned, and one that
|
|
126
|
+
* did not was already reported to the operator by name, with why and with the command that fixes it.
|
|
127
|
+
*
|
|
128
|
+
* The bucket is created **whatever the list holds, including nothing** — it is one per project, and making
|
|
129
|
+
* it wait for the last environment to be provisioned is the ordering this change exists to undo.
|
|
126
130
|
*/
|
|
127
131
|
export declare function provisionSupport(provisioner: SupportProvisioner, environments: DeclaredEnvironments | readonly string[]): Promise<SupportProvisionResult>;
|
|
128
132
|
/** The teardown seam — the inverse of {@link SupportProvisioner}. Every step idempotent. */
|
|
@@ -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;AAIlF,OAAO,EAAE,KAAK,kBAAkB,EAAuB,MAAM,6BAA6B,CAAC;A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|
@@ -68,26 +68,33 @@ function supportWorkerName(project, env) {
|
|
|
68
68
|
* Worker whose classification host is not deployed yet, which is a window where real customer
|
|
69
69
|
* messages arrive and stay `uncategorized` with nothing to say why.
|
|
70
70
|
*
|
|
71
|
-
* `environments` is the
|
|
72
|
-
*
|
|
73
|
-
*
|
|
71
|
+
* `environments` is **what the caller determined it can act on**, which the CLI narrows from the project's
|
|
72
|
+
* declaration (#241) to the environments whose app database exists (pithy-sh/pithy#512). Nothing is
|
|
73
|
+
* skipped here and nothing decides here: an environment reaching this list is provisioned, and one that
|
|
74
|
+
* did not was already reported to the operator by name, with why and with the command that fixes it.
|
|
75
|
+
*
|
|
76
|
+
* The bucket is created **whatever the list holds, including nothing** — it is one per project, and making
|
|
77
|
+
* it wait for the last environment to be provisioned is the ordering this change exists to undo.
|
|
74
78
|
*/
|
|
75
79
|
async function provisionSupport(provisioner, environments) {
|
|
76
80
|
await provisioner.preflight();
|
|
77
81
|
const bucket = await provisioner.ensureBucket();
|
|
78
82
|
const search = [];
|
|
79
|
-
|
|
83
|
+
const deployed = managedEnvironments(environments);
|
|
84
|
+
for (const env of deployed) {
|
|
80
85
|
await provisioner.deployWorker(env);
|
|
81
86
|
search.push({
|
|
82
87
|
env,
|
|
83
88
|
...await provisioner.ensureSearchIndex(env)
|
|
84
89
|
});
|
|
85
90
|
}
|
|
86
|
-
const routing = await provisioner.ensureRoutingRule();
|
|
87
91
|
return {
|
|
88
92
|
bucket,
|
|
89
|
-
environments:
|
|
90
|
-
routing
|
|
93
|
+
environments: deployed,
|
|
94
|
+
routing: deployed.length > 0 ? await provisioner.ensureRoutingRule() : {
|
|
95
|
+
created: false,
|
|
96
|
+
skipped: true
|
|
97
|
+
},
|
|
91
98
|
search
|
|
92
99
|
};
|
|
93
100
|
}
|
|
@@ -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.1.
|
|
6
|
+
export declare const PACKAGE_VERSION = "0.1.6";
|
|
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.1.
|
|
7
|
+
const PACKAGE_VERSION = "0.1.6";
|
|
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.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,16 +36,16 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@cloudflare/workers-types": "^5.20260729.1",
|
|
38
38
|
"@hono/zod-validator": "^0.9.0",
|
|
39
|
-
"@pithy-sh/core": "^0.
|
|
40
|
-
"@pithy-sh/email": "^0.1.
|
|
41
|
-
"@pithy-sh/secrets": "^0.1.
|
|
42
|
-
"@pithy-sh/storage": "^0.1.
|
|
39
|
+
"@pithy-sh/core": "^0.3.0",
|
|
40
|
+
"@pithy-sh/email": "^0.1.7",
|
|
41
|
+
"@pithy-sh/secrets": "^0.1.6",
|
|
42
|
+
"@pithy-sh/storage": "^0.1.6",
|
|
43
43
|
"postal-mime": "^3.0.0",
|
|
44
44
|
"tldts": "^7.4.10"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@pithy-sh/auth": "^0.1.
|
|
48
|
-
"@pithy-sh/payments": "^0.1
|
|
47
|
+
"@pithy-sh/auth": "^0.1.6",
|
|
48
|
+
"@pithy-sh/payments": "^0.2.1",
|
|
49
49
|
"hono": "^4.13.2",
|
|
50
50
|
"kysely": "^0.29.0",
|
|
51
51
|
"zod": "^4.4.0"
|
package/pithy.manifest.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"package": "@pithy-sh/support",
|
|
4
4
|
"requiredBindings": [
|
|
5
5
|
{ "type": "d1", "name": "DB" },
|
|
6
|
-
{ "type": "r2", "name": "SUPPORT_BUCKET", "optional": true },
|
|
6
|
+
{ "type": "r2", "name": "SUPPORT_BUCKET", "optional": true, "scope": "global", "resource": "support" },
|
|
7
7
|
{
|
|
8
8
|
"type": "workflow",
|
|
9
9
|
"name": "SUPPORT_CLASSIFY",
|
|
@@ -114,9 +114,13 @@ export interface SupportProvisionResult {
|
|
|
114
114
|
* Worker whose classification host is not deployed yet, which is a window where real customer
|
|
115
115
|
* messages arrive and stay `uncategorized` with nothing to say why.
|
|
116
116
|
*
|
|
117
|
-
* `environments` is the
|
|
118
|
-
*
|
|
119
|
-
*
|
|
117
|
+
* `environments` is **what the caller determined it can act on**, which the CLI narrows from the project's
|
|
118
|
+
* declaration (#241) to the environments whose app database exists (pithy-sh/pithy#512). Nothing is
|
|
119
|
+
* skipped here and nothing decides here: an environment reaching this list is provisioned, and one that
|
|
120
|
+
* did not was already reported to the operator by name, with why and with the command that fixes it.
|
|
121
|
+
*
|
|
122
|
+
* The bucket is created **whatever the list holds, including nothing** — it is one per project, and making
|
|
123
|
+
* it wait for the last environment to be provisioned is the ordering this change exists to undo.
|
|
120
124
|
*/
|
|
121
125
|
export async function provisionSupport(
|
|
122
126
|
provisioner: SupportProvisioner,
|
|
@@ -125,14 +129,19 @@ export async function provisionSupport(
|
|
|
125
129
|
await provisioner.preflight();
|
|
126
130
|
const bucket = await provisioner.ensureBucket();
|
|
127
131
|
const search: SupportProvisionResult["search"] = [];
|
|
128
|
-
|
|
132
|
+
const deployed = managedEnvironments(environments);
|
|
133
|
+
for (const env of deployed) {
|
|
129
134
|
await provisioner.deployWorker(env);
|
|
130
135
|
// Per environment, because each has its own app database — and after the worker, so a database
|
|
131
136
|
// that gains the index always has something able to write to it.
|
|
132
137
|
search.push({ env, ...(await provisioner.ensureSearchIndex(env)) });
|
|
133
138
|
}
|
|
134
|
-
|
|
135
|
-
|
|
139
|
+
// Only when at least one classification host is up. The rule is what starts delivering real customer
|
|
140
|
+
// mail, so making it over a run that deployed nothing is the same window the ordering above closes,
|
|
141
|
+
// widened to the whole project.
|
|
142
|
+
const routing =
|
|
143
|
+
deployed.length > 0 ? await provisioner.ensureRoutingRule() : { created: false, skipped: true as const };
|
|
144
|
+
return { bucket, environments: deployed, routing, search };
|
|
136
145
|
}
|
|
137
146
|
|
|
138
147
|
/** The teardown seam — the inverse of {@link SupportProvisioner}. Every step idempotent. */
|
package/src/version.generated.ts
CHANGED