@pithy-sh/storage 0.2.6 → 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.
@@ -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,CAA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,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";
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.6";
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.6",
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.0",
43
- "@pithy-sh/core": "^0.7.3",
44
- "@pithy-sh/secrets": "^0.2.6",
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"
@@ -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, { project, capability: STORAGE_CAPABILITY, env });
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
  });
@@ -13,4 +13,4 @@
13
13
  export const PACKAGE_NAME = "@pithy-sh/storage";
14
14
 
15
15
  /** This package's version, stamped from its own package.json at generation time. */
16
- export const PACKAGE_VERSION = "0.2.6";
16
+ export const PACKAGE_VERSION = "0.2.7";