@pithy-sh/storage 0.2.5 → 0.2.7
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/capability.d.ts.map +1 -1
- package/dist/capability.js +2 -1
- package/dist/provision/resolveStorageConfig.d.ts +6 -0
- package/dist/provision/resolveStorageConfig.d.ts.map +1 -1
- package/dist/provision/resolveStorageConfig.js +5 -2
- package/dist/version.generated.d.ts +1 -1
- package/dist/version.generated.js +1 -1
- package/package.json +4 -4
- package/src/capability.ts +6 -3
- package/src/provision/resolveStorageConfig.ts +15 -2
- package/src/version.generated.ts +1 -1
package/dist/capability.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,0CAA0C,CAAC;AAC7F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAG3E,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAOzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG;IAChD,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0GAA0G;IAC1G,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,iBACf,SAAQ,UAAU,CAAC,eAAe,EAAE,kBAAkB,EAAE,SAAS,EAAE,OAAO,gBAAgB,CAAC;IAC3F,mCAAmC;IACnC,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,0CAA0C,CAAC;AAC7F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAG3E,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAOzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;GAGG;AACH,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAE3C,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG;IAChD,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0GAA0G;IAC1G,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;GAIG;AACH,MAAM,WAAW,iBACf,SAAQ,UAAU,CAAC,eAAe,EAAE,kBAAkB,EAAE,SAAS,EAAE,OAAO,gBAAgB,CAAC;IAC3F,mCAAmC;IACnC,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,OAAO,GAAE,cAAmB,GAAG,iBAAiB,CA6CvE;AAED,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,IAAI,iBAAiB,CAE3F"}
|
package/dist/capability.js
CHANGED
|
@@ -6,7 +6,7 @@ import { STORAGE_BUCKET_BINDING, storageSecretsRegistry } from "./secret/registr
|
|
|
6
6
|
import { registerStorageRoutes } from "./http/routes.js";
|
|
7
7
|
import { storage_0001_objects } from "./migrations/0001_objects.js";
|
|
8
8
|
import { storageExampleSeed } from "./seeds/example.js";
|
|
9
|
-
import { PACKAGE_VERSION } from "./version.generated.js";
|
|
9
|
+
import { PACKAGE_NAME, PACKAGE_VERSION } from "./version.generated.js";
|
|
10
10
|
import { storageWorkflows } from "./workflows/specs.js";
|
|
11
11
|
import { defineCapability } from "@pithy-sh/core/src/capability/capability";
|
|
12
12
|
import { workflowBindings } from "@pithy-sh/core/src/workflow/bindings";
|
|
@@ -49,6 +49,7 @@ function storage(options = {}) {
|
|
|
49
49
|
const capability = defineCapability({
|
|
50
50
|
name: "storage",
|
|
51
51
|
version: PACKAGE_VERSION,
|
|
52
|
+
package: PACKAGE_NAME,
|
|
52
53
|
dependsOn: ["secrets"],
|
|
53
54
|
secretRegistry: storageSecretsRegistry,
|
|
54
55
|
workflows: storageWorkflows,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
|
+
import type { FeatureIdentity } from "@pithy-sh/core/src/naming/feature";
|
|
3
4
|
import { type WorkflowHostTemplate } from "@pithy-sh/core/src/workflow/host";
|
|
4
5
|
import type { ManagedEnvironment } from "@pithy-sh/secrets/src/scope";
|
|
5
6
|
import type { StorageConfig } from "../config/config";
|
|
@@ -29,6 +30,11 @@ export interface StorageConfigParams {
|
|
|
29
30
|
project: string;
|
|
30
31
|
/** The target environment. */
|
|
31
32
|
env: ManagedEnvironment;
|
|
33
|
+
/**
|
|
34
|
+
* **The feature this host serves, when it serves one (#643).** Its Worker, its Workflows and every store
|
|
35
|
+
* entry it binds then take the feature's names, as every feature host's do; `env` is `feature`.
|
|
36
|
+
*/
|
|
37
|
+
feature?: FeatureIdentity;
|
|
32
38
|
/** The app database id for this environment — where the `pithy_storage_*` tables live. */
|
|
33
39
|
appDatabaseId: string;
|
|
34
40
|
/** This environment's secrets database id (`<project>-<env>-secrets`) — holds the R2 credentials. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveStorageConfig.d.ts","sourceRoot":"","sources":["../../src/provision/resolveStorageConfig.ts"],"names":[],"mappings":"AAGA,OAAO,EAAyC,KAAK,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAEpH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;;;;;;;;;;;;;GAcG;AAEH,qFAAqF;AACrF,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,GAAG,EAAE,kBAAkB,CAAC;IACxB,0FAA0F;IAC1F,aAAa,EAAE,MAAM,CAAC;IACtB,qGAAqG;IACrG,iBAAiB,EAAE,MAAM,CAAC;IAC1B,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,SAAS,EAAE,gBAAgB,CAAC;IAC5B,6FAA6F;IAC7F,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,6CAA6C;AAC7C,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,oBAAoB,EAC9B,MAAM,EAAE,mBAAmB,GAC1B,oBAAoB,
|
|
1
|
+
{"version":3,"file":"resolveStorageConfig.d.ts","sourceRoot":"","sources":["../../src/provision/resolveStorageConfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAyC,KAAK,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAEpH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D;;;;;;;;;;;;;;GAcG;AAEH,qFAAqF;AACrF,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,GAAG,EAAE,kBAAkB,CAAC;IACxB;;;OAGG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,0FAA0F;IAC1F,aAAa,EAAE,MAAM,CAAC;IACtB,qGAAqG;IACrG,iBAAiB,EAAE,MAAM,CAAC;IAC1B,8DAA8D;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,+CAA+C;IAC/C,SAAS,EAAE,gBAAgB,CAAC;IAC5B,6FAA6F;IAC7F,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,6CAA6C;AAC7C,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,oBAAoB,EAC9B,MAAM,EAAE,mBAAmB,GAC1B,oBAAoB,CAkCtB"}
|
|
@@ -6,23 +6,26 @@ import { masterKeySecretName } from "@pithy-sh/secrets/src/provision/provisionSe
|
|
|
6
6
|
//#region src/provision/resolveStorageConfig.ts
|
|
7
7
|
/** Fill the template for one environment. */
|
|
8
8
|
function resolveStorageConfig(template, params) {
|
|
9
|
+
const feature = params.feature;
|
|
9
10
|
const { project, env, appDatabaseId, secretsDatabaseId, storeId, resources, storageConfig } = params;
|
|
10
11
|
const derived = hostWorkflowsFor(storageWorkflowRegistry, {
|
|
11
12
|
project,
|
|
12
13
|
capability: STORAGE_CAPABILITY,
|
|
13
|
-
env
|
|
14
|
+
env,
|
|
15
|
+
...feature ? { feature } : {}
|
|
14
16
|
});
|
|
15
17
|
const resolved = resolveWorkflowHost(template, {
|
|
16
18
|
project,
|
|
17
19
|
capability: STORAGE_CAPABILITY,
|
|
18
20
|
env,
|
|
21
|
+
...feature ? { feature } : {},
|
|
19
22
|
databaseIds: {
|
|
20
23
|
DB: appDatabaseId,
|
|
21
24
|
SECRETS: secretsDatabaseId
|
|
22
25
|
},
|
|
23
26
|
r2BucketNames: { STORAGE_BUCKET: resources.bucketName },
|
|
24
27
|
secretsStoreId: storeId,
|
|
25
|
-
masterKeySecretName: masterKeySecretName(project, env),
|
|
28
|
+
masterKeySecretName: masterKeySecretName(project, env, feature),
|
|
26
29
|
vars: { STORAGE_CONFIG: JSON.stringify(storageConfig) },
|
|
27
30
|
workflows: derived.workflows
|
|
28
31
|
});
|
|
@@ -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/storage";
|
|
5
5
|
/** This package's version, stamped from its own package.json at generation time. */
|
|
6
|
-
export declare const PACKAGE_VERSION = "0.2.
|
|
6
|
+
export declare const PACKAGE_VERSION = "0.2.7";
|
|
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/storage";
|
|
6
6
|
/** This package's version, stamped from its own package.json at generation time. */
|
|
7
|
-
const PACKAGE_VERSION = "0.2.
|
|
7
|
+
const PACKAGE_VERSION = "0.2.7";
|
|
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/storage",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -39,9 +39,9 @@
|
|
|
39
39
|
"@hono/zod-validator": "^0.9.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@pithy-sh/cloudflare": "^0.3.
|
|
43
|
-
"@pithy-sh/core": "^0.7.
|
|
44
|
-
"@pithy-sh/secrets": "^0.2.
|
|
42
|
+
"@pithy-sh/cloudflare": "^0.3.1",
|
|
43
|
+
"@pithy-sh/core": "^0.7.4",
|
|
44
|
+
"@pithy-sh/secrets": "^0.2.7",
|
|
45
45
|
"hono": "^4.13.2",
|
|
46
46
|
"kysely": "^0.29.0",
|
|
47
47
|
"zod": "^4.4.0"
|
package/src/capability.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { registerStorageRoutes } from "./http/routes";
|
|
|
13
13
|
import { storage_0001_objects } from "./migrations/0001_objects";
|
|
14
14
|
import { STORAGE_BUCKET_BINDING, storageSecretsRegistry } from "./secret/registry";
|
|
15
15
|
import { storageExampleSeed } from "./seeds/example";
|
|
16
|
-
import { PACKAGE_VERSION } from "./version.generated";
|
|
16
|
+
import { PACKAGE_NAME, PACKAGE_VERSION } from "./version.generated";
|
|
17
17
|
import { storageWorkflows } from "./workflows/specs";
|
|
18
18
|
|
|
19
19
|
/**
|
|
@@ -76,9 +76,12 @@ export function storage(options: StorageOptions = {}): StorageCapability {
|
|
|
76
76
|
|
|
77
77
|
const capability = defineCapability({
|
|
78
78
|
name: "storage",
|
|
79
|
-
// The package
|
|
80
|
-
// cannot read its own package.json. Reported per capability by
|
|
79
|
+
// The package this capability ships in and the version it ships at, both stamped by
|
|
80
|
+
// `scripts/stampVersions.ts` — a Worker cannot read its own package.json. Reported per capability by
|
|
81
|
+
// the control-plane manifest, and reported together: a release feed is keyed by package name, so the
|
|
82
|
+
// version alone leaves a client guessing the key (#626).
|
|
81
83
|
version: PACKAGE_VERSION,
|
|
84
|
+
package: PACKAGE_NAME,
|
|
82
85
|
dependsOn: ["secrets"],
|
|
83
86
|
secretRegistry: storageSecretsRegistry,
|
|
84
87
|
workflows: storageWorkflows,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// SPDX-FileCopyrightText: 2026 Pithy
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
|
|
4
|
+
import type { FeatureIdentity } from "@pithy-sh/core/src/naming/feature";
|
|
4
5
|
import { hostWorkflowsFor, resolveWorkflowHost, type WorkflowHostTemplate } from "@pithy-sh/core/src/workflow/host";
|
|
5
6
|
import { masterKeySecretName } from "@pithy-sh/secrets/src/provision/provisionSecrets";
|
|
6
7
|
import type { ManagedEnvironment } from "@pithy-sh/secrets/src/scope";
|
|
@@ -34,6 +35,11 @@ export interface StorageConfigParams {
|
|
|
34
35
|
project: string;
|
|
35
36
|
/** The target environment. */
|
|
36
37
|
env: ManagedEnvironment;
|
|
38
|
+
/**
|
|
39
|
+
* **The feature this host serves, when it serves one (#643).** Its Worker, its Workflows and every store
|
|
40
|
+
* entry it binds then take the feature's names, as every feature host's do; `env` is `feature`.
|
|
41
|
+
*/
|
|
42
|
+
feature?: FeatureIdentity;
|
|
37
43
|
/** The app database id for this environment — where the `pithy_storage_*` tables live. */
|
|
38
44
|
appDatabaseId: string;
|
|
39
45
|
/** This environment's secrets database id (`<project>-<env>-secrets`) — holds the R2 credentials. */
|
|
@@ -51,22 +57,29 @@ export function resolveStorageConfig(
|
|
|
51
57
|
template: WorkflowHostTemplate,
|
|
52
58
|
params: StorageConfigParams,
|
|
53
59
|
): WorkflowHostTemplate {
|
|
60
|
+
const feature = params.feature;
|
|
54
61
|
const { project, env, appDatabaseId, secretsDatabaseId, storeId, resources, storageConfig } = params;
|
|
55
62
|
|
|
56
63
|
// Derived before the resolve rather than assigned after it: `resolveWorkflowHost` refuses to fill a
|
|
57
64
|
// template that declares `workflows` without them, because the only unscoped name it could invent is
|
|
58
65
|
// one a second project in the same account would collide with.
|
|
59
|
-
const derived = hostWorkflowsFor(storageWorkflowRegistry, {
|
|
66
|
+
const derived = hostWorkflowsFor(storageWorkflowRegistry, {
|
|
67
|
+
project,
|
|
68
|
+
capability: STORAGE_CAPABILITY,
|
|
69
|
+
env,
|
|
70
|
+
...(feature ? { feature } : {}),
|
|
71
|
+
});
|
|
60
72
|
|
|
61
73
|
const resolved = resolveWorkflowHost(template, {
|
|
62
74
|
project,
|
|
63
75
|
capability: STORAGE_CAPABILITY,
|
|
64
76
|
env,
|
|
77
|
+
...(feature ? { feature } : {}),
|
|
65
78
|
databaseIds: { DB: appDatabaseId, SECRETS: secretsDatabaseId },
|
|
66
79
|
r2BucketNames: { STORAGE_BUCKET: resources.bucketName },
|
|
67
80
|
secretsStoreId: storeId,
|
|
68
81
|
// The master key entry is project- and env-scoped, matching what the secrets manager wrote.
|
|
69
|
-
masterKeySecretName: masterKeySecretName(project, env),
|
|
82
|
+
masterKeySecretName: masterKeySecretName(project, env, feature),
|
|
70
83
|
vars: { STORAGE_CONFIG: JSON.stringify(storageConfig) },
|
|
71
84
|
workflows: derived.workflows,
|
|
72
85
|
});
|
package/src/version.generated.ts
CHANGED