@pithy-sh/payments 0.3.4 → 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 +1 @@
1
- {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,UAAU,EAGhB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAI3E,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG3E,OAAO,KAAK,EAAE,uBAAuB,EAAuB,MAAM,2BAA2B,CAAC;AAU9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAK7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG;IAClD;;;;OAIG;IACH,cAAc,CAAC,EAAE,uBAAuB,CAAC;CAC1C,CAAC;AAsMF,6FAA6F;AAC7F,MAAM,WAAW,kBACf,SAAQ,UAAU,CAAC,eAAe,EAAE,kBAAkB,EAAE,UAAU,EAAE,OAAO,iBAAiB,CAAC;IAC7F,4BAA4B;IAC5B,cAAc,EAAE,cAAc,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,kBAAkB,CAmGrE;AAED,sFAAsF;AACtF,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,IAAI,kBAAkB,CAE7F"}
1
+ {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,UAAU,EAGhB,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAEzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAI3E,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAG3E,OAAO,KAAK,EAAE,uBAAuB,EAAuB,MAAM,2BAA2B,CAAC;AAU9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,OAAO,CAAC;AAK7C;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG;IAClD;;;;OAIG;IACH,cAAc,CAAC,EAAE,uBAAuB,CAAC;CAC1C,CAAC;AAsMF,6FAA6F;AAC7F,MAAM,WAAW,kBACf,SAAQ,UAAU,CAAC,eAAe,EAAE,kBAAkB,EAAE,UAAU,EAAE,OAAO,iBAAiB,CAAC;IAC7F,4BAA4B;IAC5B,cAAc,EAAE,cAAc,CAAC;CAChC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,eAAe,GAAG,kBAAkB,CAsGrE;AAED,sFAAsF;AACtF,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,IAAI,kBAAkB,CAE7F"}
@@ -12,7 +12,7 @@ import { registerPaymentsRoutes } from "./http/routes.js";
12
12
  import { payments_0001_purchases } from "./migrations/0001_purchases.js";
13
13
  import { paymentsInapplicableSecrets, paymentsSecretBranches } from "./secret/branches.js";
14
14
  import { paymentsExampleSeed } from "./seeds/example.js";
15
- import { PACKAGE_VERSION } from "./version.generated.js";
15
+ import { PACKAGE_NAME, PACKAGE_VERSION } from "./version.generated.js";
16
16
  import { defineCapability } from "@pithy-sh/core/src/capability/capability";
17
17
  import { ValidationError } from "@pithy-sh/core/src/error/pithyError";
18
18
  import { workflowBindings } from "@pithy-sh/core/src/workflow/bindings";
@@ -209,6 +209,7 @@ function payments(options) {
209
209
  const capability = defineCapability({
210
210
  name: "payments",
211
211
  version: PACKAGE_VERSION,
212
+ package: PACKAGE_NAME,
212
213
  dependsOn: ["secrets"],
213
214
  providesEntitlements: true,
214
215
  secretRegistry: paymentsSecretsRegistry,
@@ -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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AE,MAAM,EAAE,GAAG,EAAE,kBAAkB,GAAG,MAAM,CAEnF;AAED,6CAA6C;AAC7C,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,oBAAoB,EAC9B,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.4";
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.4";
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.4",
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.0",
46
- "@pithy-sh/ledger": "^0.2.4",
47
- "@pithy-sh/secrets": "^0.2.4",
45
+ "@pithy-sh/core": "^0.7.4",
46
+ "@pithy-sh/ledger": "^0.2.5",
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",
package/src/capability.ts CHANGED
@@ -25,7 +25,7 @@ import { payments_0001_purchases } from "./migrations/0001_purchases";
25
25
  import { paymentsInapplicableSecrets, paymentsSecretBranches } from "./secret/branches";
26
26
  import { paymentsSecretsRegistry } from "./secret/registry";
27
27
  import { paymentsExampleSeed } from "./seeds/example";
28
- import { PACKAGE_VERSION } from "./version.generated";
28
+ import { PACKAGE_NAME, PACKAGE_VERSION } from "./version.generated";
29
29
  import { paymentsWorkflows } from "./workflows/specs";
30
30
 
31
31
  /**
@@ -336,9 +336,12 @@ export function payments(options: PaymentsOptions): PaymentsCapability {
336
336
 
337
337
  const capability = defineCapability({
338
338
  name: "payments",
339
- // The package version this capability ships at, stamped by `scripts/stampVersions.ts` — a Worker
340
- // cannot read its own package.json. Reported per capability by the control-plane manifest.
339
+ // The package this capability ships in and the version it ships at, both stamped by
340
+ // `scripts/stampVersions.ts` — a Worker cannot read its own package.json. Reported per capability by
341
+ // the control-plane manifest, and reported together: a release feed is keyed by package name, so the
342
+ // version alone leaves a client guessing the key (#626).
341
343
  version: PACKAGE_VERSION,
344
+ package: PACKAGE_NAME,
342
345
  dependsOn: ["secrets"],
343
346
  providesEntitlements: true,
344
347
  // One secret holds every rail's credentials. Declaring the slice here is what lets `sharedSecretsStore`
@@ -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.4";
16
+ export const PACKAGE_VERSION = "0.3.6";