@pome-sh/cli 0.1.1 → 0.2.0
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/README.md +5 -6
- package/dist/build-info.json +3 -3
- package/dist/src/cli/eval.js +26 -8
- package/dist/src/cli/init-sdk.d.ts +0 -3
- package/dist/src/cli/init-sdk.js +117 -24
- package/dist/src/cli/main.js +23 -69
- package/dist/src/cli/register.d.ts +9 -0
- package/dist/src/cli/register.js +51 -5
- package/dist/src/cli/session.d.ts +7 -1
- package/dist/src/cli/session.js +87 -27
- package/dist/src/demo/runDemo.js +3 -2
- package/dist/src/hosted/client.d.ts +41 -5
- package/dist/src/hosted/client.js +333 -19
- package/dist/src/hosted/errors.d.ts +11 -1
- package/dist/src/hosted/errors.js +8 -1
- package/dist/src/hosted/evalResultView.d.ts +2 -0
- package/dist/src/hosted/evalResultView.js +22 -0
- package/dist/src/hosted/uploadAndFinalize.d.ts +18 -1
- package/dist/src/hosted/uploadAndFinalize.js +51 -3
- package/dist/src/recorder/inspect.js +20 -2
- package/dist/src/runner/mergeAdapterSignals.js +2 -2
- package/dist/src/runner/ports.js +3 -0
- package/dist/src/runner/runScenario.d.ts +79 -2
- package/dist/src/runner/runScenario.js +94 -36
- package/dist/src/runner/runScenarioHosted.d.ts +37 -0
- package/dist/src/runner/runScenarioHosted.js +257 -58
- package/dist/src/runner/runTrialGroup.d.ts +1 -3
- package/dist/src/runner/runTrialGroup.js +1 -3
- package/dist/src/scenario/parseScenario.d.ts +5 -0
- package/dist/src/scenario/parseScenario.js +135 -8
- package/dist/src/scenario/scenarioSchema.d.ts +200 -3
- package/dist/src/scenario/scenarioSchema.js +12 -1
- package/dist/src/twin/twinHarness.d.ts +10 -0
- package/dist/src/twin/twinHarness.js +6 -2
- package/dist/src/twin/twinStart.d.ts +19 -0
- package/dist/src/twin/twinStart.js +156 -0
- package/node_modules/@pome-sh/sdk/dist/fidelity-inventory.d.ts +121 -0
- package/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js +204 -0
- package/node_modules/@pome-sh/sdk/dist/fidelity-inventory.js.map +1 -0
- package/node_modules/@pome-sh/sdk/dist/parity.d.ts +55 -0
- package/node_modules/@pome-sh/sdk/dist/parity.js +112 -0
- package/node_modules/@pome-sh/sdk/dist/parity.js.map +1 -0
- package/node_modules/@pome-sh/sdk/dist/server-helpers.d.ts +15 -0
- package/node_modules/@pome-sh/sdk/dist/server-helpers.js +96 -0
- package/node_modules/@pome-sh/sdk/dist/server-helpers.js.map +1 -1
- package/node_modules/@pome-sh/sdk/dist/server.d.ts +1 -1
- package/node_modules/@pome-sh/sdk/dist/server.js +9 -7
- package/node_modules/@pome-sh/sdk/dist/server.js.map +1 -1
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/errors.d.ts +39 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/errors.js +33 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/errors.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/evaluator-hooks.d.ts +13 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/evaluator-hooks.js +6 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/evaluator-hooks.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/finalize-shapes.d.ts +215 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js +83 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/github-access-control.d.ts +175 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/github-access-control.js +182 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/github-access-control.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/identity.d.ts +90 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/identity.js +72 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/identity.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/index.d.ts +27 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/index.js +34 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/index.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/event-schema.d.ts +286 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js +33 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/event-schema.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.d.ts +65 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js +455 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/fixtures/data.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.d.ts +39 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js +47 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/fixtures/index.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/index.d.ts +25 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/index.js +27 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/index.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.d.ts +100 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js +185 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/map-span.d.ts +64 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/map-span.js +112 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/map-span.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/nano.d.ts +26 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/nano.js +61 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/nano.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/project.d.ts +42 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/project.js +96 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/project.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/semconv.d.ts +51 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/semconv.js +74 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/semconv.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/span-event.d.ts +134 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/span-event.js +152 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/otel/span-event.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/recorder-events.d.ts +418 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/recorder-events.js +234 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/recorder-events.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/redaction.d.ts +2 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/redaction.js +152 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/redaction.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/rest.d.ts +198 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/rest.js +225 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/run.d.ts +201 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/run.js +166 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/run.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +446 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/seed-state.js +167 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/sessions.d.ts +53 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/sessions.js +51 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/sessions.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/task-vocab.d.ts +66 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/task-vocab.js +84 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/task-vocab.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/task.d.ts +483 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/task.js +60 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/dist/task.js.map +1 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/package.json +54 -0
- package/node_modules/@pome-sh/sdk/node_modules/@pome-sh/shared-types/trace-contract.json +41 -0
- package/node_modules/@pome-sh/sdk/package.json +6 -2
- package/node_modules/@pome-sh/shared-types/dist/errors.d.ts +39 -0
- package/node_modules/@pome-sh/shared-types/dist/errors.js +33 -0
- package/node_modules/@pome-sh/shared-types/dist/errors.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/dist/finalize-shapes.d.ts +252 -0
- package/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js +122 -0
- package/node_modules/@pome-sh/shared-types/dist/finalize-shapes.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/dist/identity.d.ts +90 -0
- package/node_modules/@pome-sh/shared-types/dist/identity.js +72 -0
- package/node_modules/@pome-sh/shared-types/dist/identity.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/dist/index.d.ts +13 -1353
- package/node_modules/@pome-sh/shared-types/dist/index.js +14 -568
- package/node_modules/@pome-sh/shared-types/dist/index.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/otel/event-schema.d.ts +45 -0
- package/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js +8 -0
- package/node_modules/@pome-sh/shared-types/dist/otel/legacy-shim.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/otel/semconv.js +7 -0
- package/node_modules/@pome-sh/shared-types/dist/otel/semconv.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/recorder-events.d.ts +62 -0
- package/node_modules/@pome-sh/shared-types/dist/recorder-events.js +36 -0
- package/node_modules/@pome-sh/shared-types/dist/recorder-events.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/rest.d.ts +245 -0
- package/node_modules/@pome-sh/shared-types/dist/rest.js +303 -0
- package/node_modules/@pome-sh/shared-types/dist/rest.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/dist/run.d.ts +7 -0
- package/node_modules/@pome-sh/shared-types/dist/run.js +4 -0
- package/node_modules/@pome-sh/shared-types/dist/run.js.map +1 -1
- package/node_modules/@pome-sh/shared-types/dist/seed-envelope.d.ts +14 -0
- package/node_modules/@pome-sh/shared-types/dist/seed-envelope.js +46 -0
- package/node_modules/@pome-sh/shared-types/dist/seed-envelope.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/dist/seed-state.d.ts +446 -0
- package/node_modules/@pome-sh/shared-types/dist/seed-state.js +167 -0
- package/node_modules/@pome-sh/shared-types/dist/seed-state.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/dist/sessions.d.ts +53 -0
- package/node_modules/@pome-sh/shared-types/dist/sessions.js +51 -0
- package/node_modules/@pome-sh/shared-types/dist/sessions.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/dist/task.d.ts +485 -0
- package/node_modules/@pome-sh/shared-types/dist/task.js +60 -0
- package/node_modules/@pome-sh/shared-types/dist/task.js.map +1 -0
- package/node_modules/@pome-sh/shared-types/package.json +2 -1
- package/node_modules/@pome-sh/shared-types/trace-contract.json +1 -1
- package/node_modules/@pome-sh/twin-github/FIDELITY.md +127 -67
- package/node_modules/@pome-sh/twin-github/README.md +3 -7
- package/node_modules/@pome-sh/twin-github/dist/examples/claude-github-agent.js +4 -20
- package/node_modules/@pome-sh/twin-github/dist/examples/claude-github-agent.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/dist/src/access-control.d.ts +3 -3
- package/node_modules/@pome-sh/twin-github/dist/src/domain.d.ts +141 -3
- package/node_modules/@pome-sh/twin-github/dist/src/domain.js +0 -0
- package/node_modules/@pome-sh/twin-github/dist/src/domain.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/dist/src/routes.js +2 -0
- package/node_modules/@pome-sh/twin-github/dist/src/routes.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/dist/src/seed.d.ts +1 -1
- package/node_modules/@pome-sh/twin-github/dist/src/serializers.d.ts +2 -2
- package/node_modules/@pome-sh/twin-github/dist/src/server.js +7 -6
- package/node_modules/@pome-sh/twin-github/dist/src/server.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/dist/src/tools.d.ts +168 -18
- package/node_modules/@pome-sh/twin-github/dist/src/tools.js +23 -0
- package/node_modules/@pome-sh/twin-github/dist/src/tools.js.map +1 -1
- package/node_modules/@pome-sh/twin-github/fidelity.inventory.json +773 -0
- package/node_modules/@pome-sh/twin-github/package.json +5 -4
- package/node_modules/@pome-sh/twin-slack/FIDELITY.md +121 -35
- package/node_modules/@pome-sh/twin-slack/README.md +2 -6
- package/node_modules/@pome-sh/twin-slack/dist/scripts/fidelity-parity.d.ts +1 -0
- package/node_modules/@pome-sh/twin-slack/dist/scripts/fidelity-parity.js +92 -0
- package/node_modules/@pome-sh/twin-slack/dist/scripts/fidelity-parity.js.map +1 -0
- package/node_modules/@pome-sh/twin-slack/dist/scripts/smoke.js +3 -3
- package/node_modules/@pome-sh/twin-slack/dist/scripts/smoke.js.map +1 -1
- package/node_modules/@pome-sh/twin-slack/dist/scripts/validate-mcp.js +1 -1
- package/node_modules/@pome-sh/twin-slack/dist/scripts/validate-mcp.js.map +1 -1
- package/node_modules/@pome-sh/twin-slack/dist/src/server.js +7 -6
- package/node_modules/@pome-sh/twin-slack/dist/src/server.js.map +1 -1
- package/node_modules/@pome-sh/twin-slack/dist/src/tools.d.ts +30 -4
- package/node_modules/@pome-sh/twin-slack/dist/src/tools.js +48 -1
- package/node_modules/@pome-sh/twin-slack/dist/src/tools.js.map +1 -1
- package/node_modules/@pome-sh/twin-slack/fidelity.inventory.json +377 -0
- package/node_modules/@pome-sh/twin-slack/package.json +5 -4
- package/node_modules/@pome-sh/twin-stripe/FIDELITY.md +151 -50
- package/node_modules/@pome-sh/twin-stripe/README.md +42 -45
- package/node_modules/@pome-sh/twin-stripe/dist/scripts/fidelity-parity.d.ts +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/scripts/fidelity-parity.js +186 -0
- package/node_modules/@pome-sh/twin-stripe/dist/scripts/fidelity-parity.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/scripts/smoke.js +8 -4
- package/node_modules/@pome-sh/twin-stripe/dist/scripts/smoke.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/db.js +26 -2
- package/node_modules/@pome-sh/twin-stripe/dist/src/db.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/billing.d.ts +101 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/billing.js +195 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/billing.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/charges.d.ts +15 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/charges.js +17 -5
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/charges.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/customers.d.ts +47 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/customers.js +103 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/customers.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/events.d.ts +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/events.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/index.d.ts +6 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/index.js +3 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/index.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-intents.d.ts +61 -2
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-intents.js +214 -52
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-intents.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-methods.d.ts +45 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-methods.js +159 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/payment-methods.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/refunds.d.ts +6 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/refunds.js +16 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/refunds.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/schema.d.ts +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/schema.js +144 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/schema.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/stripe-domain.d.ts +420 -43
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/stripe-domain.js +442 -13
- package/node_modules/@pome-sh/twin-stripe/dist/src/domain/stripe-domain.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/errors.d.ts +19 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/errors.js +15 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/errors.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/ids.d.ts +2 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/ids.js +2 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/ids.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/_helpers.d.ts +8 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/_helpers.js +105 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/_helpers.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/billing.d.ts +4 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/billing.js +117 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/billing.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/customers.d.ts +4 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/customers.js +47 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/customers.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/index.js +6 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/index.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/payment-intents.js +28 -102
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/payment-intents.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/payment-methods.d.ts +4 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/payment-methods.js +33 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/routes/payment-methods.js.map +1 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/seed.d.ts +10 -8
- package/node_modules/@pome-sh/twin-stripe/dist/src/seed.js +3 -2
- package/node_modules/@pome-sh/twin-stripe/dist/src/seed.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/serializers.d.ts +181 -21
- package/node_modules/@pome-sh/twin-stripe/dist/src/serializers.js +257 -34
- package/node_modules/@pome-sh/twin-stripe/dist/src/serializers.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/server.js +7 -6
- package/node_modules/@pome-sh/twin-stripe/dist/src/server.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/tools.d.ts +107 -5
- package/node_modules/@pome-sh/twin-stripe/dist/src/tools.js +139 -6
- package/node_modules/@pome-sh/twin-stripe/dist/src/tools.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/types.d.ts +73 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/upstream-types.d.ts +8 -0
- package/node_modules/@pome-sh/twin-stripe/dist/src/x402.js +6 -1
- package/node_modules/@pome-sh/twin-stripe/dist/src/x402.js.map +1 -1
- package/node_modules/@pome-sh/twin-stripe/fidelity.inventory.json +425 -0
- package/node_modules/@pome-sh/twin-stripe/package.json +5 -4
- package/package.json +8 -8
- package/skills/pome-setup/SKILL.md +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// file-size: StripeDomain is deliberately the single coordinator — one method per business operation, orchestrating cross-cutting side effects (events, charges, ledger) the per-table modules must not own.
|
|
1
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
3
|
//
|
|
3
4
|
// StripeDomain — top-level coordinator for the Stripe twin's domain logic.
|
|
@@ -15,13 +16,18 @@
|
|
|
15
16
|
// underlying domain modules and SQL stay scoped to the calling session's
|
|
16
17
|
// account (F1). Two sessions sharing a DB file cannot read or write each
|
|
17
18
|
// other's PIs, charges, balance txns, or events.
|
|
18
|
-
import {
|
|
19
|
+
import { TwinError } from "../errors.js";
|
|
20
|
+
import { PaymentIntentsDomain, piTypes, piUnexpectedState, } from "./payment-intents.js";
|
|
21
|
+
import { declineForFingerprint } from "./payment-methods.js";
|
|
19
22
|
import { ChargesDomain } from "./charges.js";
|
|
20
23
|
import { BalanceDomain } from "./balance.js";
|
|
21
24
|
import { EventsDomain } from "./events.js";
|
|
22
25
|
import { RefundsDomain, } from "./refunds.js";
|
|
26
|
+
import { CustomersDomain, } from "./customers.js";
|
|
27
|
+
import { PaymentMethodsDomain, } from "./payment-methods.js";
|
|
28
|
+
import { BillingDomain, noSuch, } from "./billing.js";
|
|
23
29
|
import { ensureStripeTables, resetStripeTables } from "./schema.js";
|
|
24
|
-
import { paymentIntentJson, chargeJson, balanceTransactionJson, balanceJson, eventJson, refundJson, serializedList, } from "../serializers.js";
|
|
30
|
+
import { paymentIntentJson, cardJson, chargeJson, balanceTransactionJson, balanceJson, customerJson, deletedCustomerJson, eventJson, paymentMethodJson, priceJson, productJson, refundJson, serializedList, subscriptionJson, } from "../serializers.js";
|
|
25
31
|
export class StripeDomain {
|
|
26
32
|
db;
|
|
27
33
|
paymentIntents;
|
|
@@ -29,6 +35,9 @@ export class StripeDomain {
|
|
|
29
35
|
balance;
|
|
30
36
|
events;
|
|
31
37
|
refunds;
|
|
38
|
+
customers;
|
|
39
|
+
paymentMethods;
|
|
40
|
+
billing;
|
|
32
41
|
constructor(db) {
|
|
33
42
|
this.db = db;
|
|
34
43
|
ensureStripeTables(db);
|
|
@@ -37,6 +46,9 @@ export class StripeDomain {
|
|
|
37
46
|
this.balance = new BalanceDomain(db);
|
|
38
47
|
this.events = new EventsDomain(db);
|
|
39
48
|
this.refunds = new RefundsDomain(db);
|
|
49
|
+
this.customers = new CustomersDomain(db);
|
|
50
|
+
this.paymentMethods = new PaymentMethodsDomain(db);
|
|
51
|
+
this.billing = new BillingDomain(db);
|
|
40
52
|
}
|
|
41
53
|
/** Reset Stripe-domain state. Used by `/admin/reset`. */
|
|
42
54
|
reset() {
|
|
@@ -44,12 +56,50 @@ export class StripeDomain {
|
|
|
44
56
|
}
|
|
45
57
|
// ---------- PI flows ----------
|
|
46
58
|
createPaymentIntent(accountId, input) {
|
|
47
|
-
const
|
|
59
|
+
const isCard = Array.isArray(input.payment_method_types) &&
|
|
60
|
+
input.payment_method_types.length === 1 &&
|
|
61
|
+
input.payment_method_types[0] === "card";
|
|
62
|
+
// Card rail: resolve + cross-validate customer and PM up front so a
|
|
63
|
+
// missing/deleted customer 404s before any PI row exists.
|
|
64
|
+
let resolved = {
|
|
65
|
+
paymentMethodId: null,
|
|
66
|
+
customerId: null,
|
|
67
|
+
};
|
|
68
|
+
if (isCard) {
|
|
69
|
+
const customerId = input.customer
|
|
70
|
+
? this.customers.requireLive(accountId, input.customer).id
|
|
71
|
+
: null;
|
|
72
|
+
let paymentMethodId = null;
|
|
73
|
+
if (input.payment_method) {
|
|
74
|
+
const pm = this.paymentMethods.requireById(accountId, input.payment_method);
|
|
75
|
+
assertPMUsable(pm, customerId);
|
|
76
|
+
paymentMethodId = pm.id;
|
|
77
|
+
}
|
|
78
|
+
resolved = { paymentMethodId, customerId };
|
|
79
|
+
if (input.confirm && !resolved.paymentMethodId) {
|
|
80
|
+
// Fail before any PI row exists — otherwise every retry of this
|
|
81
|
+
// malformed one-shot would leave another orphaned PI behind.
|
|
82
|
+
throw missingPaymentMethod();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
const pi = this.paymentIntents.create(accountId, input, resolved);
|
|
48
86
|
this.events.create(accountId, { type: "payment_intent.created", object: paymentIntentJson(pi) });
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
87
|
+
// requires_action is the x402 deposit rail; card PIs never emit it.
|
|
88
|
+
if (pi.status === "requires_action") {
|
|
89
|
+
this.events.create(accountId, {
|
|
90
|
+
type: "payment_intent.requires_action",
|
|
91
|
+
object: paymentIntentJson(pi),
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
// create + confirm in one call (Stripe's one-shot server-side pattern).
|
|
95
|
+
// The PI row and created event persist even when the confirm declines.
|
|
96
|
+
if (isCard && input.confirm) {
|
|
97
|
+
const confirmed = this.confirmPaymentIntent(accountId, pi.id);
|
|
98
|
+
return {
|
|
99
|
+
body: confirmed.body,
|
|
100
|
+
delta: { before: null, after: confirmed.delta?.after ?? rowToRecord(pi) },
|
|
101
|
+
};
|
|
102
|
+
}
|
|
53
103
|
return {
|
|
54
104
|
body: paymentIntentJson(pi),
|
|
55
105
|
delta: { before: null, after: rowToRecord(pi) },
|
|
@@ -62,9 +112,147 @@ export class StripeDomain {
|
|
|
62
112
|
const { rows, hasMore, limit } = this.paymentIntents.list(accountId, input);
|
|
63
113
|
return serializedList(rows.map(paymentIntentJson), hasMore, limit, "/v1/payment_intents");
|
|
64
114
|
}
|
|
65
|
-
confirmPaymentIntent(accountId, id) {
|
|
115
|
+
confirmPaymentIntent(accountId, id, opts = {}) {
|
|
116
|
+
const before = this.paymentIntents.requireById(accountId, id);
|
|
117
|
+
if (!piTypes(before).includes("card")) {
|
|
118
|
+
// Crypto rail: confirm stays the documented idempotent no-op.
|
|
119
|
+
const pi = this.paymentIntents.confirm(accountId, id);
|
|
120
|
+
return {
|
|
121
|
+
body: paymentIntentJson(pi),
|
|
122
|
+
delta: { before: rowToRecord(before), after: rowToRecord(pi) },
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
// Card rail (F-731): synchronous attempt with real success/decline
|
|
126
|
+
// semantics. Unlike crypto, re-confirming a settled card PI is refused.
|
|
127
|
+
// Whitelist the two confirmable card states so an off-diagram status
|
|
128
|
+
// (e.g. a seeded card PI in requires_action) can never mint a charge.
|
|
129
|
+
if (before.status !== "requires_confirmation" &&
|
|
130
|
+
before.status !== "requires_payment_method") {
|
|
131
|
+
throw piUnexpectedState(before.status);
|
|
132
|
+
}
|
|
133
|
+
// `payment_method=` (empty form value) means "use the attached PM".
|
|
134
|
+
const pmId = (opts.payment_method || undefined) ?? before.payment_method_id;
|
|
135
|
+
if (!pmId) {
|
|
136
|
+
throw missingPaymentMethod();
|
|
137
|
+
}
|
|
138
|
+
const pm = this.paymentMethods.requireById(accountId, pmId);
|
|
139
|
+
assertPMUsable(pm, before.customer_id);
|
|
140
|
+
const decline = declineForFingerprint(pm.card_fingerprint);
|
|
141
|
+
// F2: the whole attempt is one better-sqlite3 transaction. Leg 1 CAS
|
|
142
|
+
// (observed status → processing) picks exactly one winner among
|
|
143
|
+
// parallel confirms; the outcome (charge mint, ledger, events, final
|
|
144
|
+
// status) commits atomically with it.
|
|
145
|
+
const tx = this.db.transaction(() => {
|
|
146
|
+
const inFlight = this.paymentIntents.confirmCardLeg1(accountId, id, before.status, pm.id);
|
|
147
|
+
const detailsJson = JSON.stringify(cardChargeDetails(pm));
|
|
148
|
+
if (decline) {
|
|
149
|
+
const failedCharge = this.charges.createForPI(accountId, {
|
|
150
|
+
payment_intent_id: id,
|
|
151
|
+
amount: inFlight.amount,
|
|
152
|
+
currency: inFlight.currency,
|
|
153
|
+
payment_method_id: pm.id,
|
|
154
|
+
payment_method_details_json: detailsJson,
|
|
155
|
+
customer_id: inFlight.customer_id,
|
|
156
|
+
status: "failed",
|
|
157
|
+
failure_code: decline.code,
|
|
158
|
+
failure_decline_code: decline.decline_code,
|
|
159
|
+
failure_message: decline.message,
|
|
160
|
+
});
|
|
161
|
+
const lastPaymentError = {
|
|
162
|
+
type: "card_error",
|
|
163
|
+
code: decline.code,
|
|
164
|
+
decline_code: decline.decline_code,
|
|
165
|
+
message: decline.message,
|
|
166
|
+
payment_method: paymentMethodJson(pm),
|
|
167
|
+
};
|
|
168
|
+
const pi = this.paymentIntents.finalizeCardDecline(accountId, id, failedCharge.id, JSON.stringify(lastPaymentError));
|
|
169
|
+
this.events.create(accountId, {
|
|
170
|
+
type: "payment_intent.payment_failed",
|
|
171
|
+
object: paymentIntentJson(pi),
|
|
172
|
+
});
|
|
173
|
+
this.events.create(accountId, {
|
|
174
|
+
type: "charge.failed",
|
|
175
|
+
object: chargeJson(failedCharge),
|
|
176
|
+
});
|
|
177
|
+
return { declined: decline, pi };
|
|
178
|
+
}
|
|
179
|
+
const balanceTx = this.balance.create(accountId, {
|
|
180
|
+
type: "charge",
|
|
181
|
+
amount: inFlight.amount,
|
|
182
|
+
fee: 0,
|
|
183
|
+
currency: inFlight.currency,
|
|
184
|
+
source_id: id,
|
|
185
|
+
source_type: "payment_intent",
|
|
186
|
+
});
|
|
187
|
+
const charge = this.charges.createForPI(accountId, {
|
|
188
|
+
payment_intent_id: id,
|
|
189
|
+
amount: inFlight.amount,
|
|
190
|
+
currency: inFlight.currency,
|
|
191
|
+
balance_transaction_id: balanceTx.id,
|
|
192
|
+
payment_method_id: pm.id,
|
|
193
|
+
payment_method_details_json: detailsJson,
|
|
194
|
+
customer_id: inFlight.customer_id,
|
|
195
|
+
});
|
|
196
|
+
const pi = this.paymentIntents.finalizeCardSuccess(accountId, id, charge.id);
|
|
197
|
+
this.events.create(accountId, {
|
|
198
|
+
type: "payment_intent.succeeded",
|
|
199
|
+
object: paymentIntentJson(pi),
|
|
200
|
+
});
|
|
201
|
+
this.events.create(accountId, {
|
|
202
|
+
type: "charge.succeeded",
|
|
203
|
+
object: chargeJson(charge),
|
|
204
|
+
});
|
|
205
|
+
return { declined: null, pi };
|
|
206
|
+
});
|
|
207
|
+
const result = tx();
|
|
208
|
+
if (result.declined) {
|
|
209
|
+
// Real Stripe answers a declined confirm with a 402 card_error that
|
|
210
|
+
// embeds the post-attempt PaymentIntent. State above is committed,
|
|
211
|
+
// so the error also carries the recorder-truth delta.
|
|
212
|
+
throw new TwinError("card_error", result.declined.code, result.declined.message, {
|
|
213
|
+
statusCode: 402,
|
|
214
|
+
decline_code: result.declined.decline_code,
|
|
215
|
+
payment_intent: paymentIntentJson(result.pi),
|
|
216
|
+
state_mutation: true,
|
|
217
|
+
state_delta: { before: rowToRecord(before), after: rowToRecord(result.pi) },
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
return {
|
|
221
|
+
body: paymentIntentJson(result.pi),
|
|
222
|
+
delta: { before: rowToRecord(before), after: rowToRecord(result.pi) },
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* POST /v1/payment_intents/:id (F-731). The ruled retry-with-new-PM step:
|
|
227
|
+
* metadata merges per-key, and attaching a PM moves the card PI back to
|
|
228
|
+
* requires_confirmation. PM/customer resolution happens here so unknown
|
|
229
|
+
* ids 404 with Stripe's resource_missing before any state gate fires.
|
|
230
|
+
*/
|
|
231
|
+
updatePaymentIntent(accountId, id, input) {
|
|
66
232
|
const before = this.paymentIntents.requireById(accountId, id);
|
|
67
|
-
const
|
|
233
|
+
const resolved = {};
|
|
234
|
+
if (input.customer !== undefined) {
|
|
235
|
+
resolved.customerId = input.customer
|
|
236
|
+
? this.customers.requireLive(accountId, input.customer).id
|
|
237
|
+
: null;
|
|
238
|
+
}
|
|
239
|
+
const effectiveCustomerId = resolved.customerId !== undefined ? resolved.customerId : before.customer_id;
|
|
240
|
+
if (input.payment_method !== undefined) {
|
|
241
|
+
if (input.payment_method) {
|
|
242
|
+
const pm = this.paymentMethods.requireById(accountId, input.payment_method);
|
|
243
|
+
assertPMUsable(pm, effectiveCustomerId);
|
|
244
|
+
resolved.paymentMethodId = pm.id;
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
resolved.paymentMethodId = null;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
else if (input.customer !== undefined && before.payment_method_id) {
|
|
251
|
+
// Changing only the customer must re-validate the already-attached
|
|
252
|
+
// PM — real Stripe refuses a customer/PM pairing at update time.
|
|
253
|
+
assertPMUsable(this.paymentMethods.requireById(accountId, before.payment_method_id), effectiveCustomerId);
|
|
254
|
+
}
|
|
255
|
+
const pi = this.paymentIntents.update(accountId, id, input, resolved);
|
|
68
256
|
return {
|
|
69
257
|
body: paymentIntentJson(pi),
|
|
70
258
|
delta: { before: rowToRecord(before), after: rowToRecord(pi) },
|
|
@@ -153,12 +341,33 @@ export class StripeDomain {
|
|
|
153
341
|
// ---------- Refunds ----------
|
|
154
342
|
/**
|
|
155
343
|
* Create a refund. Returns the serialized API shape plus a canonical
|
|
156
|
-
* `state_delta` so the route can hand both to `respond()`.
|
|
157
|
-
*
|
|
158
|
-
*
|
|
344
|
+
* `state_delta` so the route can hand both to `respond()`.
|
|
345
|
+
*
|
|
346
|
+
* F-733: the whole flow — refund INSERT + charges.amount_refunded UPDATE
|
|
347
|
+
* (inside `refunds.create()`, nested as a savepoint), the negative
|
|
348
|
+
* refund-type balance transaction, the ledger link backfill, and the
|
|
349
|
+
* charge.refunded / refund.created events — commits in one better-sqlite3
|
|
350
|
+
* transaction, mirroring the settle flows.
|
|
159
351
|
*/
|
|
160
352
|
createRefund(accountId, input) {
|
|
161
|
-
const
|
|
353
|
+
const tx = this.db.transaction(() => {
|
|
354
|
+
const { row, charge } = this.refunds.create(accountId, input);
|
|
355
|
+
const balanceTx = this.balance.create(accountId, {
|
|
356
|
+
type: "refund",
|
|
357
|
+
amount: -row.amount,
|
|
358
|
+
fee: 0,
|
|
359
|
+
currency: row.currency,
|
|
360
|
+
source_id: row.id,
|
|
361
|
+
source_type: "refund",
|
|
362
|
+
});
|
|
363
|
+
const linked = this.refunds.linkBalanceTransaction(accountId, row.id, balanceTx.id);
|
|
364
|
+
// v1 has no webhook delivery; these are the poll-chain signals agents
|
|
365
|
+
// read after a refund (charge carries the post-refund amount_refunded).
|
|
366
|
+
this.events.create(accountId, { type: "charge.refunded", object: chargeJson(charge) });
|
|
367
|
+
this.events.create(accountId, { type: "refund.created", object: refundJson(linked) });
|
|
368
|
+
return linked;
|
|
369
|
+
});
|
|
370
|
+
const row = tx();
|
|
162
371
|
return {
|
|
163
372
|
body: refundJson(row),
|
|
164
373
|
delta: { before: null, after: rowToRecord(row) },
|
|
@@ -171,6 +380,99 @@ export class StripeDomain {
|
|
|
171
380
|
const { rows, hasMore, limit } = this.refunds.list(accountId, input);
|
|
172
381
|
return serializedList(rows.map(refundJson), hasMore, limit, "/v1/refunds");
|
|
173
382
|
}
|
|
383
|
+
// ---------- Customers ----------
|
|
384
|
+
createCustomer(accountId, input) {
|
|
385
|
+
const row = this.customers.create(accountId, input);
|
|
386
|
+
this.events.create(accountId, { type: "customer.created", object: customerJson(row) });
|
|
387
|
+
return {
|
|
388
|
+
body: customerJson(row),
|
|
389
|
+
delta: { before: null, after: rowToRecord(row) },
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
/** Deleted customers serve the `{deleted: true}` stub, like real Stripe. */
|
|
393
|
+
retrieveCustomer(accountId, id) {
|
|
394
|
+
const row = this.customers.requireById(accountId, id);
|
|
395
|
+
return row.deleted ? deletedCustomerJson(row) : customerJson(row);
|
|
396
|
+
}
|
|
397
|
+
updateCustomer(accountId, id, input) {
|
|
398
|
+
const before = this.customers.requireLive(accountId, id);
|
|
399
|
+
const row = this.customers.update(accountId, id, input);
|
|
400
|
+
this.events.create(accountId, { type: "customer.updated", object: customerJson(row) });
|
|
401
|
+
return {
|
|
402
|
+
body: customerJson(row),
|
|
403
|
+
delta: { before: rowToRecord(before), after: rowToRecord(row) },
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
deleteCustomer(accountId, id) {
|
|
407
|
+
const before = this.customers.requireById(accountId, id);
|
|
408
|
+
const attached = this.paymentMethods.allAttachedToCustomer(accountId, id);
|
|
409
|
+
const { row, alreadyDeleted } = this.customers.delete(accountId, id);
|
|
410
|
+
if (!alreadyDeleted) {
|
|
411
|
+
this.events.create(accountId, { type: "customer.deleted", object: deletedCustomerJson(row) });
|
|
412
|
+
// Deletion detached every attached PM (inside customers.delete's
|
|
413
|
+
// transaction); event-polling consumers see one detached event per PM,
|
|
414
|
+
// carrying the post-detach shape.
|
|
415
|
+
for (const pm of attached) {
|
|
416
|
+
this.events.create(accountId, {
|
|
417
|
+
type: "payment_method.detached",
|
|
418
|
+
object: paymentMethodJson(this.paymentMethods.requireById(accountId, pm.id)),
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
return {
|
|
423
|
+
body: deletedCustomerJson(row),
|
|
424
|
+
delta: { before: rowToRecord(before), after: rowToRecord(row) },
|
|
425
|
+
};
|
|
426
|
+
}
|
|
427
|
+
listCustomers(accountId, input) {
|
|
428
|
+
const { rows, hasMore, limit } = this.customers.list(accountId, input);
|
|
429
|
+
return serializedList(rows.map(customerJson), hasMore, limit, "/v1/customers");
|
|
430
|
+
}
|
|
431
|
+
listCustomerPaymentMethods(accountId, customerId, input) {
|
|
432
|
+
// 404 for unknown AND deleted customers — a deleted customer has no
|
|
433
|
+
// payment-method sub-resource anymore.
|
|
434
|
+
this.customers.requireLive(accountId, customerId);
|
|
435
|
+
const { rows, hasMore, limit } = this.paymentMethods.listForCustomer(accountId, customerId, input);
|
|
436
|
+
return serializedList(rows.map(paymentMethodJson), hasMore, limit, `/v1/customers/${customerId}/payment_methods`);
|
|
437
|
+
}
|
|
438
|
+
// ---------- Payment methods ----------
|
|
439
|
+
createPaymentMethod(accountId, input) {
|
|
440
|
+
const row = this.paymentMethods.create(accountId, input);
|
|
441
|
+
return {
|
|
442
|
+
body: paymentMethodJson(row),
|
|
443
|
+
delta: { before: null, after: rowToRecord(row) },
|
|
444
|
+
};
|
|
445
|
+
}
|
|
446
|
+
retrievePaymentMethod(accountId, id) {
|
|
447
|
+
return paymentMethodJson(this.paymentMethods.requireById(accountId, id));
|
|
448
|
+
}
|
|
449
|
+
attachPaymentMethod(accountId, id, customerId) {
|
|
450
|
+
// Resolve the customer first so a missing/deleted customer 404s before
|
|
451
|
+
// any PM lifecycle error fires.
|
|
452
|
+
this.customers.requireLive(accountId, customerId);
|
|
453
|
+
const before = this.paymentMethods.requireById(accountId, id);
|
|
454
|
+
const row = this.paymentMethods.attach(accountId, id, customerId);
|
|
455
|
+
this.events.create(accountId, {
|
|
456
|
+
type: "payment_method.attached",
|
|
457
|
+
object: paymentMethodJson(row),
|
|
458
|
+
});
|
|
459
|
+
return {
|
|
460
|
+
body: paymentMethodJson(row),
|
|
461
|
+
delta: { before: rowToRecord(before), after: rowToRecord(row) },
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
detachPaymentMethod(accountId, id) {
|
|
465
|
+
const before = this.paymentMethods.requireById(accountId, id);
|
|
466
|
+
const row = this.paymentMethods.detach(accountId, id);
|
|
467
|
+
this.events.create(accountId, {
|
|
468
|
+
type: "payment_method.detached",
|
|
469
|
+
object: paymentMethodJson(row),
|
|
470
|
+
});
|
|
471
|
+
return {
|
|
472
|
+
body: paymentMethodJson(row),
|
|
473
|
+
delta: { before: rowToRecord(before), after: rowToRecord(row) },
|
|
474
|
+
};
|
|
475
|
+
}
|
|
174
476
|
// ---------- Charges ----------
|
|
175
477
|
retrieveCharge(accountId, id) {
|
|
176
478
|
return chargeJson(this.charges.requireById(accountId, id));
|
|
@@ -196,6 +498,91 @@ export class StripeDomain {
|
|
|
196
498
|
const { rows, hasMore, limit } = this.events.list(accountId, input);
|
|
197
499
|
return serializedList(rows.map(eventJson), hasMore, limit, "/v1/events");
|
|
198
500
|
}
|
|
501
|
+
// ---------- Billing (F-734, shape tier) ----------
|
|
502
|
+
//
|
|
503
|
+
// Warm surfaces per the F-729 ruling: stored rows served in Stripe shape,
|
|
504
|
+
// deliberately WITHOUT the semantic billing machine — creating a product,
|
|
505
|
+
// price, or subscription emits no events and mints no invoices; the
|
|
506
|
+
// recorder deltas stay truthful to the single-row writes.
|
|
507
|
+
createProduct(accountId, input) {
|
|
508
|
+
const row = this.billing.createProduct(accountId, input);
|
|
509
|
+
return { body: productJson(row), delta: { before: null, after: rowToRecord(row) } };
|
|
510
|
+
}
|
|
511
|
+
retrieveProduct(accountId, id) {
|
|
512
|
+
return productJson(this.billing.requireProduct(accountId, id));
|
|
513
|
+
}
|
|
514
|
+
listProducts(accountId, input) {
|
|
515
|
+
const { rows, hasMore, limit } = this.billing.listProducts(accountId, input);
|
|
516
|
+
return serializedList(rows.map(productJson), hasMore, limit, "/v1/products");
|
|
517
|
+
}
|
|
518
|
+
createPrice(accountId, input) {
|
|
519
|
+
const row = this.billing.createPrice(accountId, input);
|
|
520
|
+
return { body: priceJson(row), delta: { before: null, after: rowToRecord(row) } };
|
|
521
|
+
}
|
|
522
|
+
retrievePrice(accountId, id) {
|
|
523
|
+
return priceJson(this.billing.requirePrice(accountId, id));
|
|
524
|
+
}
|
|
525
|
+
listPrices(accountId, input) {
|
|
526
|
+
const { rows, hasMore, limit } = this.billing.listPrices(accountId, input);
|
|
527
|
+
return serializedList(rows.map(priceJson), hasMore, limit, "/v1/prices");
|
|
528
|
+
}
|
|
529
|
+
createSubscription(accountId, input) {
|
|
530
|
+
// Referential check: subscription.customer must be a live customer
|
|
531
|
+
// (deleted customers 404 like real Stripe).
|
|
532
|
+
if (input.customer)
|
|
533
|
+
this.customers.requireLive(accountId, input.customer);
|
|
534
|
+
const row = this.billing.createSubscription(accountId, input);
|
|
535
|
+
return {
|
|
536
|
+
body: this.subscriptionBody(accountId, row),
|
|
537
|
+
delta: { before: null, after: rowToRecord(row) },
|
|
538
|
+
};
|
|
539
|
+
}
|
|
540
|
+
retrieveSubscription(accountId, id) {
|
|
541
|
+
return this.subscriptionBody(accountId, this.billing.requireSubscription(accountId, id));
|
|
542
|
+
}
|
|
543
|
+
updateSubscription(accountId, id, input) {
|
|
544
|
+
const before = this.billing.requireSubscription(accountId, id);
|
|
545
|
+
const row = this.billing.updateSubscription(accountId, id, input);
|
|
546
|
+
return {
|
|
547
|
+
body: this.subscriptionBody(accountId, row),
|
|
548
|
+
delta: { before: rowToRecord(before), after: rowToRecord(row) },
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
cancelSubscription(accountId, id) {
|
|
552
|
+
const before = this.billing.requireSubscription(accountId, id);
|
|
553
|
+
const row = this.billing.cancelSubscription(accountId, id);
|
|
554
|
+
return {
|
|
555
|
+
body: this.subscriptionBody(accountId, row),
|
|
556
|
+
delta: { before: rowToRecord(before), after: rowToRecord(row) },
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
listSubscriptions(accountId, input) {
|
|
560
|
+
const { rows, hasMore, limit } = this.billing.listSubscriptions(accountId, input);
|
|
561
|
+
return serializedList(rows.map((row) => this.subscriptionBody(accountId, row)), hasMore, limit, "/v1/subscriptions");
|
|
562
|
+
}
|
|
563
|
+
/** Resolve item price rows so the serializer can expand SubscriptionItem.price. */
|
|
564
|
+
subscriptionBody(accountId, row) {
|
|
565
|
+
const items = JSON.parse(row.items_json);
|
|
566
|
+
const prices = new Map();
|
|
567
|
+
for (const item of items) {
|
|
568
|
+
if (!prices.has(item.price)) {
|
|
569
|
+
prices.set(item.price, this.billing.requirePrice(accountId, item.price));
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
return subscriptionJson(row, prices);
|
|
573
|
+
}
|
|
574
|
+
// Invoices are reads-only (F-729 ruling point 2: create/finalize/pay stay
|
|
575
|
+
// unlisted-cold) and nothing in the twin mints one, so the list is always
|
|
576
|
+
// empty and retrieve always 404s — loud, Stripe-shaped, documented.
|
|
577
|
+
retrieveInvoice(accountId, id) {
|
|
578
|
+
void accountId;
|
|
579
|
+
throw noSuch("invoice", id);
|
|
580
|
+
}
|
|
581
|
+
listInvoices(accountId, input) {
|
|
582
|
+
void accountId;
|
|
583
|
+
const limit = Math.min(100, Math.max(1, Math.floor(input.limit ?? 10)));
|
|
584
|
+
return serializedList([], false, limit, "/v1/invoices");
|
|
585
|
+
}
|
|
199
586
|
// ---------- State export (for _pome/state) ----------
|
|
200
587
|
/**
|
|
201
588
|
* Account-scoped state export. Used by `/_pome/state` to surface only
|
|
@@ -224,12 +611,32 @@ export class StripeDomain {
|
|
|
224
611
|
const refunds = this.db
|
|
225
612
|
.prepare("SELECT * FROM refunds WHERE account_id = ? ORDER BY created DESC, rowid DESC")
|
|
226
613
|
.all(accountId);
|
|
614
|
+
const customers = this.db
|
|
615
|
+
.prepare("SELECT * FROM customers WHERE account_id = ? ORDER BY created DESC, rowid DESC")
|
|
616
|
+
.all(accountId);
|
|
617
|
+
const paymentMethods = this.db
|
|
618
|
+
.prepare("SELECT * FROM payment_methods WHERE account_id = ? ORDER BY created DESC, rowid DESC")
|
|
619
|
+
.all(accountId);
|
|
620
|
+
const products = this.db
|
|
621
|
+
.prepare("SELECT * FROM products WHERE account_id = ? ORDER BY created DESC, rowid DESC")
|
|
622
|
+
.all(accountId);
|
|
623
|
+
const prices = this.db
|
|
624
|
+
.prepare("SELECT * FROM prices WHERE account_id = ? ORDER BY created DESC, rowid DESC")
|
|
625
|
+
.all(accountId);
|
|
626
|
+
const subscriptions = this.db
|
|
627
|
+
.prepare("SELECT * FROM subscriptions WHERE account_id = ? ORDER BY created DESC, rowid DESC")
|
|
628
|
+
.all(accountId);
|
|
227
629
|
return {
|
|
228
630
|
payment_intents: pis.map(paymentIntentJson),
|
|
229
631
|
charges: charges.map(chargeJson),
|
|
230
632
|
balance_transactions: balanceTxs.map(balanceTransactionJson),
|
|
231
633
|
events: events.map(eventJson),
|
|
232
634
|
refunds: refunds.map(refundJson),
|
|
635
|
+
customers: customers.map((row) => (row.deleted ? deletedCustomerJson(row) : customerJson(row))),
|
|
636
|
+
payment_methods: paymentMethods.map(paymentMethodJson),
|
|
637
|
+
products: products.map(productJson),
|
|
638
|
+
prices: prices.map(priceJson),
|
|
639
|
+
subscriptions: subscriptions.map((row) => this.subscriptionBody(accountId, row)),
|
|
233
640
|
};
|
|
234
641
|
}
|
|
235
642
|
}
|
|
@@ -238,4 +645,26 @@ function rowToRecord(row) {
|
|
|
238
645
|
// z.record(z.string(), z.unknown()) accepts it.
|
|
239
646
|
return { ...row };
|
|
240
647
|
}
|
|
648
|
+
function missingPaymentMethod() {
|
|
649
|
+
return new TwinError("invalid_request_error", "payment_intent_unexpected_state", "You cannot confirm this PaymentIntent because it's missing a payment method. Update the PaymentIntent with a payment_method and then confirm it again.", { statusCode: 400 });
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Stripe's PM lifecycle rules for using a PM on a PI: a previously
|
|
653
|
+
* detached PM may never be used again, and a PM attached to a customer may
|
|
654
|
+
* only be used on that customer's PaymentIntents.
|
|
655
|
+
*/
|
|
656
|
+
function assertPMUsable(pm, customerId) {
|
|
657
|
+
if (pm.detached) {
|
|
658
|
+
throw new TwinError("invalid_request_error", "payment_method_previously_detached", "A payment method that has been previously detached from a customer may not be used again.", { param: "payment_method", statusCode: 400 });
|
|
659
|
+
}
|
|
660
|
+
if (pm.customer_id && pm.customer_id !== customerId) {
|
|
661
|
+
throw new TwinError("invalid_request_error", "payment_method_customer_mismatch", "The payment method you provided is attached to a customer. You may only use it with that customer via the `customer` parameter.", { param: "payment_method", statusCode: 400 });
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
/** Charge.payment_method_details payload for a card charge. */
|
|
665
|
+
function cardChargeDetails(pm) {
|
|
666
|
+
// Same card block paymentMethodJson serves, so Charge.payment_method_details.card
|
|
667
|
+
// can never drift from PaymentMethod.card for the same PM.
|
|
668
|
+
return { type: "card", card: cardJson(pm) };
|
|
669
|
+
}
|
|
241
670
|
//# sourceMappingURL=stripe-domain.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe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AAsB,CAAC;YAC5D,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC;YAC7B,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC;SACjC,CAAC;IACJ,CAAC;CACF;AAED,SAAS,WAAW,CAAC,GAA4B;IAC/C,iEAAiE;IACjE,gDAAgD;IAChD,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC;AACpB,CAAC"}
|
|
1
|
+
{"version":3,"file":"stripe-domain.js","sourceRoot":"","sources":["../../../src/domain/stripe-domain.ts"],"names":[],"mappings":"AAAA,6MAA6M;AAC7M,sCAAsC;AACtC,EAAE;AACF,2EAA2E;AAC3E,oBAAoB;AACpB,EAAE;AACF,0EAA0E;AAC1E,yEAAyE;AACzE,kCAAkC;AAClC,EAAE;AACF,0EAA0E;AAC1E,yEAAyE;AACzE,uEAAuE;AACvE,EAAE;AACF,qEAAqE;AACrE,yEAAyE;AACzE,yEAAyE;AACzE,iDAAiD;AAajD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EACL,oBAAoB,EACpB,OAAO,EACP,iBAAiB,GAIlB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAyB,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,aAAa,EAA2B,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,YAAY,EAAwB,MAAM,aAAa,CAAC;AACjE,OAAO,EACL,aAAa,GAGd,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,eAAe,GAGhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,oBAAoB,GAGrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,aAAa,EACb,MAAM,GAOP,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACpE,OAAO,EACL,iBAAi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B,OAAO,IAAI,SAAS,CAClB,uBAAuB,EACvB,iCAAiC,EACjC,wJAAwJ,EACxJ,EAAE,UAAU,EAAE,GAAG,EAAE,CACpB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CAAC,EAAoB,EAAE,UAAyB;IACrE,IAAI,EAAE,CAAC,QAAQ,EAAE,CAAC;QAChB,MAAM,IAAI,SAAS,CACjB,uBAAuB,EACvB,oCAAoC,EACpC,2FAA2F,EAC3F,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,EAAE,CAC7C,CAAC;IACJ,CAAC;IACD,IAAI,EAAE,CAAC,WAAW,IAAI,EAAE,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;QACpD,MAAM,IAAI,SAAS,CACjB,uBAAuB,EACvB,kCAAkC,EAClC,iIAAiI,EACjI,EAAE,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,GAAG,EAAE,CAC7C,CAAC;IACJ,CAAC;AACH,CAAC;AAED,+DAA+D;AAC/D,SAAS,iBAAiB,CAAC,EAAoB;IAC7C,kFAAkF;IAClF,2DAA2D;IAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AAC9C,CAAC"}
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
export type StripeErrorType = "invalid_request_error" | "api_error" | "card_error" | "idempotency_error" | "rate_limit_error";
|
|
2
2
|
export type StripeErrorFidelity = "semantic" | "unsupported";
|
|
3
|
+
import type { StateDelta } from "@pome-sh/shared-types";
|
|
3
4
|
export type StripeErrorOpts = {
|
|
4
5
|
param?: string;
|
|
5
6
|
doc_url?: string;
|
|
6
7
|
statusCode?: number;
|
|
7
8
|
fidelity?: StripeErrorFidelity;
|
|
8
9
|
supported_surfaces?: string[];
|
|
10
|
+
/** Card declines: Stripe's issuer decline reason (`generic_decline`, …). */
|
|
11
|
+
decline_code?: string;
|
|
12
|
+
/** Card declines: real Stripe embeds the post-attempt PaymentIntent. */
|
|
13
|
+
payment_intent?: unknown;
|
|
14
|
+
/**
|
|
15
|
+
* Card declines commit real state (failed charge, events, PI transition)
|
|
16
|
+
* before the 402 is thrown — the only error path in the twin that
|
|
17
|
+
* mutates. These recorder-only fields let handle() log the truth; they
|
|
18
|
+
* never serialize into the wire envelope.
|
|
19
|
+
*/
|
|
20
|
+
state_mutation?: boolean;
|
|
21
|
+
state_delta?: StateDelta;
|
|
9
22
|
};
|
|
10
23
|
export type StripeErrorEnvelope = {
|
|
11
24
|
error: {
|
|
@@ -16,6 +29,8 @@ export type StripeErrorEnvelope = {
|
|
|
16
29
|
doc_url?: string;
|
|
17
30
|
fidelity?: StripeErrorFidelity;
|
|
18
31
|
supported_surfaces?: string[];
|
|
32
|
+
decline_code?: string;
|
|
33
|
+
payment_intent?: unknown;
|
|
19
34
|
};
|
|
20
35
|
};
|
|
21
36
|
/**
|
|
@@ -31,6 +46,10 @@ export declare class TwinError extends Error {
|
|
|
31
46
|
readonly doc_url?: string;
|
|
32
47
|
readonly fidelity?: StripeErrorFidelity;
|
|
33
48
|
readonly supported_surfaces?: string[];
|
|
49
|
+
readonly decline_code?: string;
|
|
50
|
+
readonly payment_intent?: unknown;
|
|
51
|
+
readonly state_mutation?: boolean;
|
|
52
|
+
readonly state_delta?: StateDelta;
|
|
34
53
|
constructor(type: StripeErrorType, code: string, message: string, opts?: StripeErrorOpts);
|
|
35
54
|
toEnvelope(): StripeErrorEnvelope;
|
|
36
55
|
}
|