@contractspec/example.integration-stripe 3.7.6 → 3.7.10
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/.turbo/turbo-build.log +36 -33
- package/AGENTS.md +44 -21
- package/CHANGELOG.md +24 -0
- package/README.md +66 -19
- package/dist/blueprint.d.ts +1 -2
- package/dist/blueprint.js +62 -9
- package/dist/browser/blueprint.js +62 -9
- package/dist/browser/connection.sample.js +78 -2
- package/dist/browser/index.js +168 -83
- package/dist/browser/integration-stripe.feature.js +139 -3
- package/dist/browser/integration.js +78 -0
- package/dist/browser/workflow.js +4 -3
- package/dist/connection.sample.js +78 -2
- package/dist/contracts.test.d.ts +1 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +168 -83
- package/dist/integration-stripe.feature.js +139 -3
- package/dist/integration.d.ts +1 -0
- package/dist/integration.js +79 -0
- package/dist/node/blueprint.js +62 -9
- package/dist/node/connection.sample.js +78 -2
- package/dist/node/index.js +168 -83
- package/dist/node/integration-stripe.feature.js +139 -3
- package/dist/node/integration.js +78 -0
- package/dist/node/workflow.js +4 -3
- package/dist/workflow.d.ts +1 -2
- package/dist/workflow.js +4 -3
- package/package.json +22 -8
- package/src/blueprint.ts +59 -59
- package/src/connection.sample.ts +18 -17
- package/src/contracts.test.ts +34 -0
- package/src/docs/integration-stripe.docblock.ts +21 -21
- package/src/example.ts +26 -26
- package/src/index.ts +4 -3
- package/src/integration-stripe.feature.ts +29 -21
- package/src/integration.ts +79 -0
- package/src/tenant.ts +49 -49
- package/src/workflow.ts +50 -50
- package/translation.catalog.json +18 -19
- package/tsconfig.json +7 -9
- package/tsdown.config.js +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -2,43 +2,46 @@ $ contractspec-bun-build prebuild
|
|
|
2
2
|
$ bun run prebuild && bun run build:bundle && bun run build:types
|
|
3
3
|
$ contractspec-bun-build prebuild
|
|
4
4
|
$ contractspec-bun-build transpile
|
|
5
|
-
[contractspec-bun-build] transpile target=bun root=src entries=
|
|
6
|
-
Bundled
|
|
5
|
+
[contractspec-bun-build] transpile target=bun root=src entries=10 noBundle=false
|
|
6
|
+
Bundled 10 modules in 33ms
|
|
7
7
|
|
|
8
|
-
./blueprint.js
|
|
9
|
-
./index.js
|
|
10
|
-
./
|
|
11
|
-
./connection.sample.js
|
|
12
|
-
docs/index.js 1.59 KB
|
|
13
|
-
docs/integration-stripe.docblock.js 1.59 KB
|
|
14
|
-
./example.js 1.0 KB
|
|
15
|
-
./integration-stripe.feature.js
|
|
16
|
-
./
|
|
8
|
+
./blueprint.js 3.35 KB (entry point)
|
|
9
|
+
./index.js 11.21 KB (entry point)
|
|
10
|
+
./tenant.js 1.34 KB (entry point)
|
|
11
|
+
./connection.sample.js 2.94 KB (entry point)
|
|
12
|
+
docs/index.js 1.59 KB (entry point)
|
|
13
|
+
docs/integration-stripe.docblock.js 1.59 KB (entry point)
|
|
14
|
+
./example.js 1.0 KB (entry point)
|
|
15
|
+
./integration-stripe.feature.js 4.74 KB (entry point)
|
|
16
|
+
./workflow.js 1.51 KB (entry point)
|
|
17
|
+
./integration.js 2.36 KB (entry point)
|
|
17
18
|
|
|
18
|
-
[contractspec-bun-build] transpile target=node root=src entries=
|
|
19
|
-
Bundled
|
|
19
|
+
[contractspec-bun-build] transpile target=node root=src entries=10 noBundle=false
|
|
20
|
+
Bundled 10 modules in 24ms
|
|
20
21
|
|
|
21
|
-
./blueprint.js
|
|
22
|
-
./index.js
|
|
23
|
-
./
|
|
24
|
-
./connection.sample.js
|
|
25
|
-
docs/index.js 1.57 KB
|
|
26
|
-
docs/integration-stripe.docblock.js 1.57 KB
|
|
27
|
-
./example.js 1.0 KB
|
|
28
|
-
./integration-stripe.feature.js
|
|
29
|
-
./
|
|
22
|
+
./blueprint.js 3.34 KB (entry point)
|
|
23
|
+
./index.js 11.19 KB (entry point)
|
|
24
|
+
./tenant.js 1.33 KB (entry point)
|
|
25
|
+
./connection.sample.js 2.93 KB (entry point)
|
|
26
|
+
docs/index.js 1.57 KB (entry point)
|
|
27
|
+
docs/integration-stripe.docblock.js 1.57 KB (entry point)
|
|
28
|
+
./example.js 1.0 KB (entry point)
|
|
29
|
+
./integration-stripe.feature.js 4.74 KB (entry point)
|
|
30
|
+
./workflow.js 1.51 KB (entry point)
|
|
31
|
+
./integration.js 2.35 KB (entry point)
|
|
30
32
|
|
|
31
|
-
[contractspec-bun-build] transpile target=browser root=src entries=
|
|
32
|
-
Bundled
|
|
33
|
+
[contractspec-bun-build] transpile target=browser root=src entries=10 noBundle=false
|
|
34
|
+
Bundled 10 modules in 21ms
|
|
33
35
|
|
|
34
|
-
./blueprint.js
|
|
35
|
-
./index.js
|
|
36
|
-
./
|
|
37
|
-
./connection.sample.js
|
|
38
|
-
docs/index.js 1.57 KB
|
|
39
|
-
docs/integration-stripe.docblock.js 1.57 KB
|
|
40
|
-
./example.js 1.0 KB
|
|
41
|
-
./integration-stripe.feature.js
|
|
42
|
-
./
|
|
36
|
+
./blueprint.js 3.34 KB (entry point)
|
|
37
|
+
./index.js 11.19 KB (entry point)
|
|
38
|
+
./tenant.js 1.33 KB (entry point)
|
|
39
|
+
./connection.sample.js 2.93 KB (entry point)
|
|
40
|
+
docs/index.js 1.57 KB (entry point)
|
|
41
|
+
docs/integration-stripe.docblock.js 1.57 KB (entry point)
|
|
42
|
+
./example.js 1.0 KB (entry point)
|
|
43
|
+
./integration-stripe.feature.js 4.74 KB (entry point)
|
|
44
|
+
./workflow.js 1.51 KB (entry point)
|
|
45
|
+
./integration.js 2.35 KB (entry point)
|
|
43
46
|
|
|
44
47
|
$ contractspec-bun-build types
|
package/AGENTS.md
CHANGED
|
@@ -1,34 +1,57 @@
|
|
|
1
|
-
# AI Agent Guide
|
|
1
|
+
# AI Agent Guide — `@contractspec/example.integration-stripe`
|
|
2
2
|
|
|
3
3
|
Scope: `packages/examples/integration-stripe/*`
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Integration example – Stripe Payments (blueprint + workflow + tenant config).
|
|
6
6
|
|
|
7
7
|
## Quick Context
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
9
|
+
- Layer: `example`.
|
|
10
|
+
- Package visibility: published package.
|
|
11
|
+
- Primary consumers are example explorers, template authors, and documentation readers.
|
|
12
|
+
- Related packages: `@contractspec/lib.contracts-integrations`, `@contractspec/lib.contracts-spec`, `@contractspec/lib.schema`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
|
|
11
13
|
|
|
12
|
-
##
|
|
14
|
+
## Architecture
|
|
13
15
|
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
16
|
+
- `src/blueprint.ts` is part of the package's public or composition surface.
|
|
17
|
+
- `src/connection.sample.ts` is part of the package's public or composition surface.
|
|
18
|
+
- `src/docs/` contains docblocks and documentation-facing exports.
|
|
19
|
+
- `src/example.ts` is the runnable example entrypoint.
|
|
20
|
+
- `src/index.ts` is the root public barrel and package entrypoint.
|
|
21
|
+
- `src/integration-stripe.feature.ts` defines a feature entrypoint.
|
|
22
|
+
- `src/tenant.ts` is part of the package's public or composition surface.
|
|
18
23
|
|
|
19
|
-
## Public
|
|
24
|
+
## Public Surface
|
|
20
25
|
|
|
21
|
-
- `.`
|
|
22
|
-
- `./blueprint`
|
|
23
|
-
- `./connection.sample`
|
|
24
|
-
- `./docs`
|
|
25
|
-
- `./
|
|
26
|
-
- `./
|
|
27
|
-
- `./
|
|
26
|
+
- Export `.` resolves through `./src/index.ts`.
|
|
27
|
+
- Export `./blueprint` resolves through `./src/blueprint.ts`.
|
|
28
|
+
- Export `./connection.sample` resolves through `./src/connection.sample.ts`.
|
|
29
|
+
- Export `./docs` resolves through `./src/docs/index.ts`.
|
|
30
|
+
- Export `./docs/integration-stripe.docblock` resolves through `./src/docs/integration-stripe.docblock.ts`.
|
|
31
|
+
- Export `./example` resolves through `./src/example.ts`.
|
|
32
|
+
- Export `./integration-stripe.feature` resolves through `./src/integration-stripe.feature.ts`.
|
|
33
|
+
- Export `./tenant` resolves through `./src/tenant.ts`.
|
|
34
|
+
- Export `./workflow` resolves through `./src/workflow.ts`.
|
|
35
|
+
|
|
36
|
+
## Guardrails
|
|
37
|
+
|
|
38
|
+
- Keep the example package demonstrative, buildable, and aligned with the exported feature surface.
|
|
39
|
+
- Do not add hidden production assumptions that are not actually implemented in the example.
|
|
40
|
+
- Changes here can affect downstream packages such as `@contractspec/lib.contracts-integrations`, `@contractspec/lib.contracts-spec`, `@contractspec/lib.schema`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
|
|
41
|
+
- Changes here can affect downstream packages such as `@contractspec/lib.contracts-integrations`, `@contractspec/lib.contracts-spec`, `@contractspec/lib.schema`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
|
|
28
42
|
|
|
29
43
|
## Local Commands
|
|
30
44
|
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
45
|
+
- `bun run dev` — contractspec-bun-build dev
|
|
46
|
+
- `bun run build` — bun run prebuild && bun run build:bundle && bun run build:types
|
|
47
|
+
- `bun run test` — bun test --pass-with-no-tests
|
|
48
|
+
- `bun run lint` — bun lint:fix
|
|
49
|
+
- `bun run lint:check` — biome check .
|
|
50
|
+
- `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
|
|
51
|
+
- `bun run typecheck` — tsc --noEmit
|
|
52
|
+
- `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
|
|
53
|
+
- `bun run publish:pkg:canary` — bun publish:pkg --tag canary
|
|
54
|
+
- `bun run clean` — rimraf dist .turbo
|
|
55
|
+
- `bun run build:bundle` — contractspec-bun-build transpile
|
|
56
|
+
- `bun run build:types` — contractspec-bun-build types
|
|
57
|
+
- `bun run prebuild` — contractspec-bun-build prebuild
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @contractspec/example.integration-stripe
|
|
2
2
|
|
|
3
|
+
## 3.7.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1a44cb6: feat: improve examples to increase coverage of Contracts type
|
|
8
|
+
- Updated dependencies [1a44cb6]
|
|
9
|
+
- @contractspec/lib.contracts-integrations@3.8.2
|
|
10
|
+
- @contractspec/lib.contracts-spec@4.1.2
|
|
11
|
+
- @contractspec/lib.schema@3.7.8
|
|
12
|
+
|
|
13
|
+
## 3.7.9
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- fix: release
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
- @contractspec/lib.contracts-integrations@3.8.1
|
|
20
|
+
- @contractspec/lib.contracts-spec@4.1.1
|
|
21
|
+
- @contractspec/lib.schema@3.7.7
|
|
22
|
+
|
|
3
23
|
## 3.7.6
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -415,6 +435,7 @@
|
|
|
415
435
|
- 7f3203a: fix: make workspace test runs resilient when packages have no tests
|
|
416
436
|
|
|
417
437
|
Updates package test scripts to pass cleanly when no matching test files exist:
|
|
438
|
+
|
|
418
439
|
- Uses `bun test --pass-with-no-tests` in Bun-based packages that currently ship without test files.
|
|
419
440
|
- Uses `jest --passWithNoTests` for the UI kit web package.
|
|
420
441
|
- Adds `.vscode-test.mjs` for `vscode-contractspec` so VS Code extension test runs have an explicit config and stop failing on missing default configuration.
|
|
@@ -749,14 +770,17 @@
|
|
|
749
770
|
feat: Contract layers support (features, examples, app-configs)
|
|
750
771
|
|
|
751
772
|
### New CLI Commands
|
|
773
|
+
|
|
752
774
|
- `contractspec list layers` - List all contract layers with filtering
|
|
753
775
|
|
|
754
776
|
### Enhanced Commands
|
|
777
|
+
|
|
755
778
|
- `contractspec ci` - New `layers` check category validates features/examples/config
|
|
756
779
|
- `contractspec doctor` - New `layers` health checks
|
|
757
780
|
- `contractspec integrity` - Now shows layer statistics
|
|
758
781
|
|
|
759
782
|
### New APIs
|
|
783
|
+
|
|
760
784
|
- `discoverLayers()` - Scan workspace for all layer files
|
|
761
785
|
- `scanExampleSource()` - Parse ExampleSpec from source code
|
|
762
786
|
- `isExampleFile()` - Check if file is an example spec
|
package/README.md
CHANGED
|
@@ -1,29 +1,76 @@
|
|
|
1
|
-
|
|
1
|
+
# @contractspec/example.integration-stripe
|
|
2
2
|
|
|
3
|
-
Website: https://contractspec.io
|
|
3
|
+
Website: https://contractspec.io
|
|
4
4
|
|
|
5
|
+
**Integration example – Stripe Payments (blueprint + workflow + tenant config).**
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
## What This Demonstrates
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
- Canonical `integration` export via `StripePaymentsIntegrationSpec`.
|
|
10
|
+
- Integration-oriented `app-config` example via `defineAppConfig(...)`.
|
|
11
|
+
- Canonical `workflow` export via `defineWorkflow(...)`.
|
|
12
|
+
- Multi-tenant configuration pattern.
|
|
13
|
+
- Connection sample for credential wiring.
|
|
14
|
+
- `src/docs/` contains docblocks and documentation-facing exports.
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
- `workflow.ts` – minimal `WorkflowSpec` that invokes Stripe operations (`payments.stripe.chargeCard`).
|
|
12
|
-
- `tenant.ts` – tenant configuration binding the workflow to a concrete Stripe `IntegrationConnection`.
|
|
13
|
-
- `connection.sample.ts` – sample connection payload illustrating the data saved by the integrations service.
|
|
14
|
-
- `translation.catalog.json` *(optional)* – canonical strings referenced by `branding.appNameKey`.
|
|
16
|
+
## Running Locally
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
From `packages/examples/integration-stripe`:
|
|
19
|
+
- `bun run dev`
|
|
20
|
+
- `bun run build`
|
|
21
|
+
- `bun run test`
|
|
22
|
+
- `bun run typecheck`
|
|
17
23
|
|
|
18
|
-
|
|
19
|
-
- Resolve tenant-specific branding via `context.branding` for emails or receipts.
|
|
20
|
-
- Resolve localized copy using `context.translationResolver` (if provided by the host).
|
|
24
|
+
## Usage
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
Use `@contractspec/example.integration-stripe` as a reference implementation, or import its exported surfaces into a workspace that composes ContractSpec examples and bundles.
|
|
23
27
|
|
|
24
|
-
|
|
25
|
-
2. Register the blueprint + workflow + translation catalog in your registry.
|
|
26
|
-
3. Use `registerIntegrationContracts` and `registerAppConfigContracts` to expose the connection, branding, and translation management operations.
|
|
27
|
-
4. Implement the payment contract handlers to read `ctx.integrations`, fetch secrets through `ctx.secretProvider`, and execute Stripe calls.
|
|
28
|
-
5. Render receipts or notifications by combining `ctx.branding` (logos/domain) and `ctx.translation.resolve(key, locale)` for localized copy.
|
|
28
|
+
## Architecture
|
|
29
29
|
|
|
30
|
+
- `src/blueprint.ts` is part of the package's public or composition surface.
|
|
31
|
+
- `src/connection.sample.ts` is part of the package's public or composition surface.
|
|
32
|
+
- `src/docs/` contains docblocks and documentation-facing exports.
|
|
33
|
+
- `src/example.ts` is the runnable example entrypoint.
|
|
34
|
+
- `src/integration.ts` defines the exported integration spec.
|
|
35
|
+
- `src/index.ts` is the root public barrel and package entrypoint.
|
|
36
|
+
- `src/integration-stripe.feature.ts` defines a feature entrypoint.
|
|
37
|
+
- `src/tenant.ts` is part of the package's public or composition surface.
|
|
38
|
+
|
|
39
|
+
## Public Entry Points
|
|
40
|
+
|
|
41
|
+
- Export `.` resolves through `./src/index.ts`.
|
|
42
|
+
- Export `./blueprint` resolves through `./src/blueprint.ts`.
|
|
43
|
+
- Export `./connection.sample` resolves through `./src/connection.sample.ts`.
|
|
44
|
+
- Export `./docs` resolves through `./src/docs/index.ts`.
|
|
45
|
+
- Export `./docs/integration-stripe.docblock` resolves through `./src/docs/integration-stripe.docblock.ts`.
|
|
46
|
+
- Export `./example` resolves through `./src/example.ts`.
|
|
47
|
+
- Export `./integration` resolves through `./src/integration.ts`.
|
|
48
|
+
- Export `./integration-stripe.feature` resolves through `./src/integration-stripe.feature.ts`.
|
|
49
|
+
- Export `./tenant` resolves through `./src/tenant.ts`.
|
|
50
|
+
- Export `./workflow` resolves through `./src/workflow.ts`.
|
|
51
|
+
- The package publishes 9 total export subpaths; keep docs aligned with `package.json`.
|
|
52
|
+
|
|
53
|
+
## Local Commands
|
|
54
|
+
|
|
55
|
+
- `bun run dev` — contractspec-bun-build dev
|
|
56
|
+
- `bun run build` — bun run prebuild && bun run build:bundle && bun run build:types
|
|
57
|
+
- `bun run test` — bun test --pass-with-no-tests
|
|
58
|
+
- `bun run lint` — bun lint:fix
|
|
59
|
+
- `bun run lint:check` — biome check .
|
|
60
|
+
- `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
|
|
61
|
+
- `bun run typecheck` — tsc --noEmit
|
|
62
|
+
- `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
|
|
63
|
+
- `bun run publish:pkg:canary` — bun publish:pkg --tag canary
|
|
64
|
+
- `bun run clean` — rimraf dist .turbo
|
|
65
|
+
- `bun run build:bundle` — contractspec-bun-build transpile
|
|
66
|
+
- `bun run build:types` — contractspec-bun-build types
|
|
67
|
+
- `bun run prebuild` — contractspec-bun-build prebuild
|
|
68
|
+
|
|
69
|
+
## Recent Updates
|
|
70
|
+
|
|
71
|
+
- Replace eslint+prettier by biomejs to optimize speed.
|
|
72
|
+
- Missing contract layers.
|
|
73
|
+
|
|
74
|
+
## Notes
|
|
75
|
+
|
|
76
|
+
- Works alongside `@contractspec/lib.contracts-integrations`, `@contractspec/lib.contracts-spec`, `@contractspec/lib.schema`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
|
package/dist/blueprint.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const artisanStripeBlueprint: AppBlueprintSpec;
|
|
1
|
+
export declare const artisanStripeBlueprint: import("@contractspec/lib.contracts-spec/app-config/spec").AppBlueprintSpec;
|
package/dist/blueprint.js
CHANGED
|
@@ -1,11 +1,65 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
// src/
|
|
2
|
+
// src/workflow.ts
|
|
3
3
|
import {
|
|
4
4
|
OwnersEnum,
|
|
5
5
|
StabilityEnum,
|
|
6
6
|
TagsEnum
|
|
7
7
|
} from "@contractspec/lib.contracts-spec/ownership";
|
|
8
|
-
|
|
8
|
+
import { defineWorkflow } from "@contractspec/lib.contracts-spec/workflow";
|
|
9
|
+
var collectPaymentWorkflow = defineWorkflow({
|
|
10
|
+
meta: {
|
|
11
|
+
key: "integration-stripe.workflow.payment",
|
|
12
|
+
version: "1.0.0",
|
|
13
|
+
title: "Collect Card Payment",
|
|
14
|
+
description: "Charge a customer using the tenant Stripe connection and record settlement details.",
|
|
15
|
+
domain: "payments",
|
|
16
|
+
owners: [OwnersEnum.PlatformCore],
|
|
17
|
+
tags: [TagsEnum.Marketplace, "stripe"],
|
|
18
|
+
stability: StabilityEnum.Experimental
|
|
19
|
+
},
|
|
20
|
+
definition: {
|
|
21
|
+
entryStepId: "prepare",
|
|
22
|
+
steps: [
|
|
23
|
+
{
|
|
24
|
+
id: "prepare",
|
|
25
|
+
type: "automation",
|
|
26
|
+
label: "Prepare charge parameters",
|
|
27
|
+
action: {
|
|
28
|
+
operation: { key: "payments.prepareCharge", version: "1.0.0" }
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "charge",
|
|
33
|
+
type: "automation",
|
|
34
|
+
label: "Charge card via Stripe",
|
|
35
|
+
action: {
|
|
36
|
+
operation: { key: "payments.stripe.chargeCard", version: "1.0.0" }
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
id: "confirm",
|
|
41
|
+
type: "automation",
|
|
42
|
+
label: "Confirm settlement",
|
|
43
|
+
action: {
|
|
44
|
+
operation: { key: "payments.recordSettlement", version: "1.0.0" }
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
transitions: [
|
|
49
|
+
{ from: "prepare", to: "charge" },
|
|
50
|
+
{ from: "charge", to: "confirm", condition: "output.success === true" }
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// src/blueprint.ts
|
|
56
|
+
import { defineAppConfig } from "@contractspec/lib.contracts-spec/app-config/spec";
|
|
57
|
+
import {
|
|
58
|
+
OwnersEnum as OwnersEnum2,
|
|
59
|
+
StabilityEnum as StabilityEnum2,
|
|
60
|
+
TagsEnum as TagsEnum2
|
|
61
|
+
} from "@contractspec/lib.contracts-spec/ownership";
|
|
62
|
+
var artisanStripeBlueprint = defineAppConfig({
|
|
9
63
|
meta: {
|
|
10
64
|
key: "artisan.payments.stripe",
|
|
11
65
|
version: "1.0.0",
|
|
@@ -13,9 +67,9 @@ var artisanStripeBlueprint = {
|
|
|
13
67
|
title: "ArtisanOS Stripe Payments",
|
|
14
68
|
description: "Blueprint enabling card payments for ArtisanOS merchants via the Stripe integration.",
|
|
15
69
|
domain: "payments",
|
|
16
|
-
owners: [
|
|
17
|
-
tags: [
|
|
18
|
-
stability:
|
|
70
|
+
owners: [OwnersEnum2.PlatformCore],
|
|
71
|
+
tags: [TagsEnum2.Marketplace, "stripe", "payments"],
|
|
72
|
+
stability: StabilityEnum2.Experimental
|
|
19
73
|
},
|
|
20
74
|
capabilities: {
|
|
21
75
|
enabled: [{ key: "payments.psp", version: "1.0.0" }]
|
|
@@ -50,13 +104,12 @@ var artisanStripeBlueprint = {
|
|
|
50
104
|
},
|
|
51
105
|
workflows: {
|
|
52
106
|
collectPayment: {
|
|
53
|
-
key:
|
|
54
|
-
version:
|
|
107
|
+
key: collectPaymentWorkflow.meta.key,
|
|
108
|
+
version: collectPaymentWorkflow.meta.version
|
|
55
109
|
}
|
|
56
110
|
},
|
|
57
|
-
policies: [{ key: "artisan.payments.default", version: "1.0.0" }],
|
|
58
111
|
notes: "Install this blueprint and pair it with the Stripe integration connection to enable card collection."
|
|
59
|
-
};
|
|
112
|
+
});
|
|
60
113
|
export {
|
|
61
114
|
artisanStripeBlueprint
|
|
62
115
|
};
|
|
@@ -1,10 +1,64 @@
|
|
|
1
|
-
// src/
|
|
1
|
+
// src/workflow.ts
|
|
2
2
|
import {
|
|
3
3
|
OwnersEnum,
|
|
4
4
|
StabilityEnum,
|
|
5
5
|
TagsEnum
|
|
6
6
|
} from "@contractspec/lib.contracts-spec/ownership";
|
|
7
|
-
|
|
7
|
+
import { defineWorkflow } from "@contractspec/lib.contracts-spec/workflow";
|
|
8
|
+
var collectPaymentWorkflow = defineWorkflow({
|
|
9
|
+
meta: {
|
|
10
|
+
key: "integration-stripe.workflow.payment",
|
|
11
|
+
version: "1.0.0",
|
|
12
|
+
title: "Collect Card Payment",
|
|
13
|
+
description: "Charge a customer using the tenant Stripe connection and record settlement details.",
|
|
14
|
+
domain: "payments",
|
|
15
|
+
owners: [OwnersEnum.PlatformCore],
|
|
16
|
+
tags: [TagsEnum.Marketplace, "stripe"],
|
|
17
|
+
stability: StabilityEnum.Experimental
|
|
18
|
+
},
|
|
19
|
+
definition: {
|
|
20
|
+
entryStepId: "prepare",
|
|
21
|
+
steps: [
|
|
22
|
+
{
|
|
23
|
+
id: "prepare",
|
|
24
|
+
type: "automation",
|
|
25
|
+
label: "Prepare charge parameters",
|
|
26
|
+
action: {
|
|
27
|
+
operation: { key: "payments.prepareCharge", version: "1.0.0" }
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "charge",
|
|
32
|
+
type: "automation",
|
|
33
|
+
label: "Charge card via Stripe",
|
|
34
|
+
action: {
|
|
35
|
+
operation: { key: "payments.stripe.chargeCard", version: "1.0.0" }
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "confirm",
|
|
40
|
+
type: "automation",
|
|
41
|
+
label: "Confirm settlement",
|
|
42
|
+
action: {
|
|
43
|
+
operation: { key: "payments.recordSettlement", version: "1.0.0" }
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
],
|
|
47
|
+
transitions: [
|
|
48
|
+
{ from: "prepare", to: "charge" },
|
|
49
|
+
{ from: "charge", to: "confirm", condition: "output.success === true" }
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// src/blueprint.ts
|
|
55
|
+
import { defineAppConfig } from "@contractspec/lib.contracts-spec/app-config/spec";
|
|
56
|
+
import {
|
|
57
|
+
OwnersEnum as OwnersEnum2,
|
|
58
|
+
StabilityEnum as StabilityEnum2,
|
|
59
|
+
TagsEnum as TagsEnum2
|
|
60
|
+
} from "@contractspec/lib.contracts-spec/ownership";
|
|
61
|
+
var artisanStripeBlueprint = defineAppConfig({
|
|
8
62
|
meta: {
|
|
9
63
|
key: "artisan.payments.stripe",
|
|
10
64
|
version: "1.0.0",
|
|
@@ -12,9 +66,9 @@ var artisanStripeBlueprint = {
|
|
|
12
66
|
title: "ArtisanOS Stripe Payments",
|
|
13
67
|
description: "Blueprint enabling card payments for ArtisanOS merchants via the Stripe integration.",
|
|
14
68
|
domain: "payments",
|
|
15
|
-
owners: [
|
|
16
|
-
tags: [
|
|
17
|
-
stability:
|
|
69
|
+
owners: [OwnersEnum2.PlatformCore],
|
|
70
|
+
tags: [TagsEnum2.Marketplace, "stripe", "payments"],
|
|
71
|
+
stability: StabilityEnum2.Experimental
|
|
18
72
|
},
|
|
19
73
|
capabilities: {
|
|
20
74
|
enabled: [{ key: "payments.psp", version: "1.0.0" }]
|
|
@@ -49,13 +103,12 @@ var artisanStripeBlueprint = {
|
|
|
49
103
|
},
|
|
50
104
|
workflows: {
|
|
51
105
|
collectPayment: {
|
|
52
|
-
key:
|
|
53
|
-
version:
|
|
106
|
+
key: collectPaymentWorkflow.meta.key,
|
|
107
|
+
version: collectPaymentWorkflow.meta.version
|
|
54
108
|
}
|
|
55
109
|
},
|
|
56
|
-
policies: [{ key: "artisan.payments.default", version: "1.0.0" }],
|
|
57
110
|
notes: "Install this blueprint and pair it with the Stripe integration connection to enable card collection."
|
|
58
|
-
};
|
|
111
|
+
});
|
|
59
112
|
export {
|
|
60
113
|
artisanStripeBlueprint
|
|
61
114
|
};
|
|
@@ -1,10 +1,86 @@
|
|
|
1
|
+
// src/integration.ts
|
|
2
|
+
import { defineIntegration } from "@contractspec/lib.contracts-spec/integrations/spec";
|
|
3
|
+
import {
|
|
4
|
+
OwnersEnum,
|
|
5
|
+
StabilityEnum,
|
|
6
|
+
TagsEnum
|
|
7
|
+
} from "@contractspec/lib.contracts-spec/ownership";
|
|
8
|
+
import { defineSchemaModel, ScalarTypeEnum } from "@contractspec/lib.schema";
|
|
9
|
+
var StripeConfigModel = defineSchemaModel({
|
|
10
|
+
name: "StripePaymentsIntegrationConfig",
|
|
11
|
+
description: "Managed configuration required to connect a Stripe account.",
|
|
12
|
+
fields: {
|
|
13
|
+
accountId: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
14
|
+
webhookEndpoint: {
|
|
15
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
16
|
+
isOptional: false
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
var StripeSecretModel = defineSchemaModel({
|
|
21
|
+
name: "StripePaymentsIntegrationSecret",
|
|
22
|
+
description: "Secret material stored out-of-band for the Stripe provider.",
|
|
23
|
+
fields: {
|
|
24
|
+
apiKey: { type: ScalarTypeEnum.String_unsecure(), isOptional: false },
|
|
25
|
+
webhookSecret: {
|
|
26
|
+
type: ScalarTypeEnum.String_unsecure(),
|
|
27
|
+
isOptional: false
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
var StripePaymentsIntegrationSpec = defineIntegration({
|
|
32
|
+
meta: {
|
|
33
|
+
key: "integration-stripe.integration.psp",
|
|
34
|
+
version: "1.0.0",
|
|
35
|
+
title: "Stripe Payments Integration",
|
|
36
|
+
description: "Integration contract for managed or BYOK Stripe card processing.",
|
|
37
|
+
domain: "payments",
|
|
38
|
+
category: "payments",
|
|
39
|
+
owners: [OwnersEnum.PlatformCore],
|
|
40
|
+
tags: [TagsEnum.Marketplace, "stripe", "payments"],
|
|
41
|
+
stability: StabilityEnum.Experimental
|
|
42
|
+
},
|
|
43
|
+
supportedModes: ["managed", "byok"],
|
|
44
|
+
capabilities: {
|
|
45
|
+
provides: [{ key: "payments.psp", version: "1.0.0" }]
|
|
46
|
+
},
|
|
47
|
+
configSchema: {
|
|
48
|
+
schema: StripeConfigModel,
|
|
49
|
+
example: {
|
|
50
|
+
accountId: "acct_demo_artisan",
|
|
51
|
+
webhookEndpoint: "https://pay.artisanos.dev/webhooks/stripe"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
secretSchema: {
|
|
55
|
+
schema: StripeSecretModel,
|
|
56
|
+
example: {
|
|
57
|
+
apiKey: "sk_live_redacted",
|
|
58
|
+
webhookSecret: "whsec_redacted"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
healthCheck: {
|
|
62
|
+
method: "ping",
|
|
63
|
+
timeoutMs: 5000
|
|
64
|
+
},
|
|
65
|
+
docsUrl: "https://docs.stripe.com",
|
|
66
|
+
constraints: {
|
|
67
|
+
rateLimit: {
|
|
68
|
+
rpm: 1000
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
byokSetup: {
|
|
72
|
+
setupInstructions: "Create a restricted API key and webhook endpoint, then bind the secret reference to the tenant connection.",
|
|
73
|
+
requiredScopes: ["charges:write", "customers:read", "webhooks:write"]
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
1
77
|
// src/connection.sample.ts
|
|
2
78
|
var stripeLiveConnection = {
|
|
3
79
|
meta: {
|
|
4
80
|
id: "conn-stripe-live",
|
|
5
81
|
tenantId: "artisan-co",
|
|
6
|
-
integrationKey:
|
|
7
|
-
integrationVersion:
|
|
82
|
+
integrationKey: StripePaymentsIntegrationSpec.meta.key,
|
|
83
|
+
integrationVersion: StripePaymentsIntegrationSpec.meta.version,
|
|
8
84
|
label: "Stripe Production",
|
|
9
85
|
environment: "production",
|
|
10
86
|
createdAt: "2026-01-01T00:00:00.000Z",
|