@pithy-sh/payments 0.3.5 → 0.3.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.
@@ -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 { PaymentsConfig } from "../config/config";
@@ -28,6 +29,11 @@ export interface PaymentsConfigParams {
28
29
  project: string;
29
30
  /** The target environment. */
30
31
  env: ManagedEnvironment;
32
+ /**
33
+ * **The feature this host serves, when it serves one (#643).** Its Worker, its Workflows and every store
34
+ * entry it binds then take the feature's names, as every feature host's do; `env` is `feature`.
35
+ */
36
+ feature?: FeatureIdentity;
31
37
  /** The app database id for this environment — where the `pithy_payments_*` tables live. */
32
38
  appDatabaseId: string;
33
39
  /** This environment's secrets database id (`<project>-<env>-secrets`) — holds the rails' credentials. */
@@ -1 +1 @@
1
- {"version":3,"file":"resolvePaymentsConfig.d.ts","sourceRoot":"","sources":["../../src/provision/resolvePaymentsConfig.ts"],"names":[],"mappings":"AAIA,OAAO,EAAyC,KAAK,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAEpH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD;;;;;;;;;;;;;GAaG;AAEH,yFAAyF;AACzF,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,GAAG,EAAE,kBAAkB,CAAC;IACxB,2FAA2F;IAC3F,aAAa,EAAE,MAAM,CAAC;IACtB,yGAAyG;IACzG,iBAAiB,EAAE,MAAM,CAAC;I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AC9B,MAAM,EAAE,oBAAoB,GAC3B,oBAAoB,CAoCtB"}
@@ -17,22 +17,25 @@ function paymentsWorkerName(project, env) {
17
17
  }
18
18
  /** Fill the template for one environment. */
19
19
  function resolvePaymentsConfig(template, params) {
20
+ const feature = params.feature;
20
21
  const { project, env, appDatabaseId, secretsDatabaseId, storeId, paymentsConfig } = params;
21
22
  const derived = hostWorkflowsFor(paymentsWorkflowRegistry, {
22
23
  project,
23
24
  capability: PAYMENTS_CAPABILITY,
24
- env
25
+ env,
26
+ ...feature ? { feature } : {}
25
27
  });
26
28
  const resolved = resolveWorkflowHost(template, {
27
29
  project,
28
30
  capability: PAYMENTS_CAPABILITY,
29
31
  env,
32
+ ...feature ? { feature } : {},
30
33
  databaseIds: {
31
34
  DB: appDatabaseId,
32
35
  SECRETS: secretsDatabaseId
33
36
  },
34
37
  secretsStoreId: storeId,
35
- masterKeySecretName: masterKeySecretName(project, env),
38
+ masterKeySecretName: masterKeySecretName(project, env, feature),
36
39
  workflows: derived.workflows,
37
40
  vars: { PAYMENTS_CONFIG: JSON.stringify(paymentsConfig) }
38
41
  });
@@ -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/payments";
5
5
  /** This package's version, stamped from its own package.json at generation time. */
6
- export declare const PACKAGE_VERSION = "0.3.5";
6
+ export declare const PACKAGE_VERSION = "0.3.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/payments";
6
6
  /** This package's version, stamped from its own package.json at generation time. */
7
- const PACKAGE_VERSION = "0.3.5";
7
+ const PACKAGE_VERSION = "0.3.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/payments",
3
- "version": "0.3.5",
3
+ "version": "0.3.6",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,9 +42,9 @@
42
42
  "@paddle/paddle-js": "^1.6.4"
43
43
  },
44
44
  "peerDependencies": {
45
- "@pithy-sh/core": "^0.7.3",
45
+ "@pithy-sh/core": "^0.7.4",
46
46
  "@pithy-sh/ledger": "^0.2.5",
47
- "@pithy-sh/secrets": "^0.2.6",
47
+ "@pithy-sh/secrets": "^0.2.7",
48
48
  "hono": "^4.13.2",
49
49
  "kysely": "^0.29.0",
50
50
  "react": "^19.0.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 { resourceNames } from "@pithy-sh/core/src/naming/resourceNames";
5
6
  import { hostWorkflowsFor, resolveWorkflowHost, type WorkflowHostTemplate } from "@pithy-sh/core/src/workflow/host";
6
7
  import { masterKeySecretName } from "@pithy-sh/secrets/src/provision/provisionSecrets";
@@ -34,6 +35,11 @@ export interface PaymentsConfigParams {
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_payments_*` tables live. */
38
44
  appDatabaseId: string;
39
45
  /** This environment's secrets database id (`<project>-<env>-secrets`) — holds the rails' credentials. */
@@ -60,21 +66,28 @@ export function resolvePaymentsConfig(
60
66
  template: WorkflowHostTemplate,
61
67
  params: PaymentsConfigParams,
62
68
  ): WorkflowHostTemplate {
69
+ const feature = params.feature;
63
70
  const { project, env, appDatabaseId, secretsDatabaseId, storeId, paymentsConfig } = params;
64
71
 
65
72
  // Derived before the resolve rather than assigned after it: `resolveWorkflowHost` refuses to fill a
66
73
  // template that declares `workflows` without them, because the only name it could invent unaided is an
67
74
  // unscoped one a second project in the same account would overwrite.
68
- const derived = hostWorkflowsFor(paymentsWorkflowRegistry, { project, capability: PAYMENTS_CAPABILITY, env });
75
+ const derived = hostWorkflowsFor(paymentsWorkflowRegistry, {
76
+ project,
77
+ capability: PAYMENTS_CAPABILITY,
78
+ env,
79
+ ...(feature ? { feature } : {}),
80
+ });
69
81
 
70
82
  const resolved = resolveWorkflowHost(template, {
71
83
  project,
72
84
  capability: PAYMENTS_CAPABILITY,
73
85
  env,
86
+ ...(feature ? { feature } : {}),
74
87
  databaseIds: { DB: appDatabaseId, SECRETS: secretsDatabaseId },
75
88
  secretsStoreId: storeId,
76
89
  // The master key entry is project- and env-scoped, matching what the secrets manager wrote.
77
- masterKeySecretName: masterKeySecretName(project, env),
90
+ masterKeySecretName: masterKeySecretName(project, env, feature),
78
91
  workflows: derived.workflows,
79
92
  // The catalog travels whole: the pass has to map a refreshed store SKU back to a product before it can
80
93
  // project it, and the rails' toggles decide which stores it may ask at all. Nothing sensitive is in it —
@@ -13,4 +13,4 @@
13
13
  export const PACKAGE_NAME = "@pithy-sh/payments";
14
14
 
15
15
  /** This package's version, stamped from its own package.json at generation time. */
16
- export const PACKAGE_VERSION = "0.3.5";
16
+ export const PACKAGE_VERSION = "0.3.6";