@contractspec/example.integration-stripe 3.7.6 → 3.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,7 +3,7 @@ $ bun run prebuild && bun run build:bundle && bun run build:types
3
3
  $ contractspec-bun-build prebuild
4
4
  $ contractspec-bun-build transpile
5
5
  [contractspec-bun-build] transpile target=bun root=src entries=9 noBundle=false
6
- Bundled 9 modules in 32ms
6
+ Bundled 9 modules in 13ms
7
7
 
8
8
  ./blueprint.js 1.77 KB (entry point)
9
9
  ./index.js 8.59 KB (entry point)
@@ -16,7 +16,7 @@ Bundled 9 modules in 32ms
16
16
  ./tenant.js 1.34 KB (entry point)
17
17
 
18
18
  [contractspec-bun-build] transpile target=node root=src entries=9 noBundle=false
19
- Bundled 9 modules in 18ms
19
+ Bundled 9 modules in 24ms
20
20
 
21
21
  ./blueprint.js 1.77 KB (entry point)
22
22
  ./index.js 8.57 KB (entry point)
@@ -29,7 +29,7 @@ Bundled 9 modules in 18ms
29
29
  ./tenant.js 1.33 KB (entry point)
30
30
 
31
31
  [contractspec-bun-build] transpile target=browser root=src entries=9 noBundle=false
32
- Bundled 9 modules in 38ms
32
+ Bundled 9 modules in 24ms
33
33
 
34
34
  ./blueprint.js 1.77 KB (entry point)
35
35
  ./index.js 8.57 KB (entry point)
package/AGENTS.md CHANGED
@@ -1,34 +1,57 @@
1
- # AI Agent Guide -- `@contractspec/example.integration-stripe`
1
+ # AI Agent Guide `@contractspec/example.integration-stripe`
2
2
 
3
3
  Scope: `packages/examples/integration-stripe/*`
4
4
 
5
- Demonstrates Stripe Payments integration with blueprint, workflow, and tenant configuration patterns.
5
+ Integration example – Stripe Payments (blueprint + workflow + tenant config).
6
6
 
7
7
  ## Quick Context
8
8
 
9
- - **Layer**: example
10
- - **Related Packages**: `lib.schema`, `lib.contracts-spec`, `lib.contracts-integrations`
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
- ## What This Demonstrates
14
+ ## Architecture
13
15
 
14
- - Integration blueprint definition for Stripe
15
- - Payment workflow with typed steps
16
- - Multi-tenant configuration pattern
17
- - Connection sample for credential wiring
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 Exports
24
+ ## Public Surface
20
25
 
21
- - `.` -- root barrel
22
- - `./blueprint` -- Stripe integration blueprint
23
- - `./connection.sample` -- sample connection config
24
- - `./docs` -- DocBlock documentation
25
- - `./example` -- runnable example entry point
26
- - `./tenant` -- tenant configuration
27
- - `./workflow` -- payment workflow definition
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
- - Build: `bun run build`
32
- - Dev: `bun run dev`
33
- - Test: `bun test`
34
- - Typecheck: `bun run typecheck`
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/README.md CHANGED
@@ -1,29 +1,73 @@
1
- ### Integration Example – Stripe Payments
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
- This example shows how to wire the `IntegrationSpec`/`TenantAppConfig` layers together to enable Stripe-backed payments for ArtisanOS.
7
+ ## What This Demonstrates
7
8
 
8
- Files included:
9
+ - Integration blueprint definition for Stripe.
10
+ - Payment workflow with typed steps.
11
+ - Multi-tenant configuration pattern.
12
+ - Connection sample for credential wiring.
13
+ - `src/docs/` contains docblocks and documentation-facing exports.
14
+ - `src/docs/` contains docblocks and documentation-facing exports.
9
15
 
10
- - `blueprint.ts` – declares the `AppBlueprintSpec` enabling the `payments.psp` capability and mapping the payment workflow.
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
- When the workflow runner executes the `charge` step, the `WorkflowRunner` now surfaces the tenant `ResolvedAppConfig` (including integrations, branding, and translations) through `OperationExecutorContext.resolvedAppConfig`. An implementation of `opExecutor` can:
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
- - Pull the connection via `context.integrations[0]` and ask a `secretProvider` for Stripe keys.
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
- Recommended next steps:
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
- 1. Persist the sample connection through the integration CRUD contracts (`integrations.connection.create`).
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/index.ts` is the root public barrel and package entrypoint.
35
+ - `src/integration-stripe.feature.ts` defines a feature entrypoint.
36
+ - `src/tenant.ts` is part of the package's public or composition surface.
37
+
38
+ ## Public Entry Points
39
+
40
+ - Export `.` resolves through `./src/index.ts`.
41
+ - Export `./blueprint` resolves through `./src/blueprint.ts`.
42
+ - Export `./connection.sample` resolves through `./src/connection.sample.ts`.
43
+ - Export `./docs` resolves through `./src/docs/index.ts`.
44
+ - Export `./docs/integration-stripe.docblock` resolves through `./src/docs/integration-stripe.docblock.ts`.
45
+ - Export `./example` resolves through `./src/example.ts`.
46
+ - Export `./integration-stripe.feature` resolves through `./src/integration-stripe.feature.ts`.
47
+ - Export `./tenant` resolves through `./src/tenant.ts`.
48
+ - Export `./workflow` resolves through `./src/workflow.ts`.
49
+
50
+ ## Local Commands
51
+
52
+ - `bun run dev` — contractspec-bun-build dev
53
+ - `bun run build` — bun run prebuild && bun run build:bundle && bun run build:types
54
+ - `bun run test` — bun test --pass-with-no-tests
55
+ - `bun run lint` — bun lint:fix
56
+ - `bun run lint:check` — biome check .
57
+ - `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
58
+ - `bun run typecheck` — tsc --noEmit
59
+ - `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
60
+ - `bun run publish:pkg:canary` — bun publish:pkg --tag canary
61
+ - `bun run clean` — rimraf dist .turbo
62
+ - `bun run build:bundle` — contractspec-bun-build transpile
63
+ - `bun run build:types` — contractspec-bun-build types
64
+ - `bun run prebuild` — contractspec-bun-build prebuild
65
+
66
+ ## Recent Updates
67
+
68
+ - Replace eslint+prettier by biomejs to optimize speed.
69
+ - Missing contract layers.
70
+
71
+ ## Notes
72
+
73
+ - Works alongside `@contractspec/lib.contracts-integrations`, `@contractspec/lib.contracts-spec`, `@contractspec/lib.schema`, `@contractspec/tool.bun`, `@contractspec/tool.typescript`.
@@ -148,57 +148,29 @@ var example = defineExample({
148
148
  });
149
149
  var example_default = example;
150
150
 
151
- // src/workflow.ts
152
- import {
153
- OwnersEnum as OwnersEnum2,
154
- StabilityEnum as StabilityEnum2,
155
- TagsEnum as TagsEnum2
156
- } from "@contractspec/lib.contracts-spec/ownership";
157
- var collectPaymentWorkflow = {
151
+ // src/integration-stripe.feature.ts
152
+ import { defineFeature } from "@contractspec/lib.contracts-spec";
153
+ var IntegrationStripeFeature = defineFeature({
158
154
  meta: {
159
- key: "artisan.payments.collectPayment",
155
+ key: "integration-stripe",
160
156
  version: "1.0.0",
161
- title: "Collect Card Payment",
162
- description: "Charge a customer using the tenant Stripe connection and record settlement details.",
163
- domain: "payments",
164
- owners: [OwnersEnum2.PlatformCore],
165
- tags: [TagsEnum2.Marketplace, "stripe"],
166
- stability: StabilityEnum2.Experimental
157
+ title: "Stripe Payments Integration",
158
+ description: "Stripe payments integration with blueprint, workflow, and tenant configuration",
159
+ domain: "integration",
160
+ owners: ["@integration-team"],
161
+ tags: ["integration", "stripe", "payments"],
162
+ stability: "experimental"
167
163
  },
168
- definition: {
169
- entryStepId: "prepare",
170
- steps: [
171
- {
172
- id: "prepare",
173
- type: "automation",
174
- label: "Prepare charge parameters",
175
- action: {
176
- operation: { key: "payments.prepareCharge", version: "1.0.0" }
177
- }
178
- },
179
- {
180
- id: "charge",
181
- type: "automation",
182
- label: "Charge card via Stripe",
183
- action: {
184
- operation: { key: "payments.stripe.chargeCard", version: "1.0.0" }
185
- }
186
- },
187
- {
188
- id: "confirm",
189
- type: "automation",
190
- label: "Confirm settlement",
191
- action: {
192
- operation: { key: "payments.recordSettlement", version: "1.0.0" }
193
- }
194
- }
195
- ],
196
- transitions: [
197
- { from: "prepare", to: "charge" },
198
- { from: "charge", to: "confirm", condition: "output.success === true" }
199
- ]
200
- }
201
- };
164
+ integrations: [
165
+ { key: "integration-stripe.integration.psp", version: "1.0.0" }
166
+ ],
167
+ workflows: [{ key: "integration-stripe.workflow.payment", version: "1.0.0" }],
168
+ policies: [{ key: "integration-stripe.policy.payments", version: "1.0.0" }],
169
+ docs: [
170
+ "docs.examples.integration-stripe",
171
+ "docs.examples.integration-stripe.usage"
172
+ ]
173
+ });
202
174
 
203
175
  // src/tenant.ts
204
176
  var artisanStripeTenantConfig = {
@@ -253,29 +225,57 @@ var artisanStripeTenantConfig = {
253
225
  notes: "Stripe connection bound for production payments."
254
226
  };
255
227
 
256
- // src/integration-stripe.feature.ts
257
- import { defineFeature } from "@contractspec/lib.contracts-spec";
258
- var IntegrationStripeFeature = defineFeature({
228
+ // src/workflow.ts
229
+ import {
230
+ OwnersEnum as OwnersEnum2,
231
+ StabilityEnum as StabilityEnum2,
232
+ TagsEnum as TagsEnum2
233
+ } from "@contractspec/lib.contracts-spec/ownership";
234
+ var collectPaymentWorkflow = {
259
235
  meta: {
260
- key: "integration-stripe",
236
+ key: "artisan.payments.collectPayment",
261
237
  version: "1.0.0",
262
- title: "Stripe Payments Integration",
263
- description: "Stripe payments integration with blueprint, workflow, and tenant configuration",
264
- domain: "integration",
265
- owners: ["@integration-team"],
266
- tags: ["integration", "stripe", "payments"],
267
- stability: "experimental"
238
+ title: "Collect Card Payment",
239
+ description: "Charge a customer using the tenant Stripe connection and record settlement details.",
240
+ domain: "payments",
241
+ owners: [OwnersEnum2.PlatformCore],
242
+ tags: [TagsEnum2.Marketplace, "stripe"],
243
+ stability: StabilityEnum2.Experimental
268
244
  },
269
- integrations: [
270
- { key: "integration-stripe.integration.psp", version: "1.0.0" }
271
- ],
272
- workflows: [{ key: "integration-stripe.workflow.payment", version: "1.0.0" }],
273
- policies: [{ key: "integration-stripe.policy.payments", version: "1.0.0" }],
274
- docs: [
275
- "docs.examples.integration-stripe",
276
- "docs.examples.integration-stripe.usage"
277
- ]
278
- });
245
+ definition: {
246
+ entryStepId: "prepare",
247
+ steps: [
248
+ {
249
+ id: "prepare",
250
+ type: "automation",
251
+ label: "Prepare charge parameters",
252
+ action: {
253
+ operation: { key: "payments.prepareCharge", version: "1.0.0" }
254
+ }
255
+ },
256
+ {
257
+ id: "charge",
258
+ type: "automation",
259
+ label: "Charge card via Stripe",
260
+ action: {
261
+ operation: { key: "payments.stripe.chargeCard", version: "1.0.0" }
262
+ }
263
+ },
264
+ {
265
+ id: "confirm",
266
+ type: "automation",
267
+ label: "Confirm settlement",
268
+ action: {
269
+ operation: { key: "payments.recordSettlement", version: "1.0.0" }
270
+ }
271
+ }
272
+ ],
273
+ transitions: [
274
+ { from: "prepare", to: "charge" },
275
+ { from: "charge", to: "confirm", condition: "output.success === true" }
276
+ ]
277
+ }
278
+ };
279
279
  export {
280
280
  stripeLiveConnection,
281
281
  example_default as example,
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export * from './blueprint';
2
- export * from './workflow';
3
- export * from './tenant';
4
2
  export * from './connection.sample';
5
- export * from './integration-stripe.feature';
6
3
  export { default as example } from './example';
4
+ export * from './integration-stripe.feature';
5
+ export * from './tenant';
6
+ export * from './workflow';
7
7
  import './docs';
package/dist/index.js CHANGED
@@ -149,57 +149,29 @@ var example = defineExample({
149
149
  });
150
150
  var example_default = example;
151
151
 
152
- // src/workflow.ts
153
- import {
154
- OwnersEnum as OwnersEnum2,
155
- StabilityEnum as StabilityEnum2,
156
- TagsEnum as TagsEnum2
157
- } from "@contractspec/lib.contracts-spec/ownership";
158
- var collectPaymentWorkflow = {
152
+ // src/integration-stripe.feature.ts
153
+ import { defineFeature } from "@contractspec/lib.contracts-spec";
154
+ var IntegrationStripeFeature = defineFeature({
159
155
  meta: {
160
- key: "artisan.payments.collectPayment",
156
+ key: "integration-stripe",
161
157
  version: "1.0.0",
162
- title: "Collect Card Payment",
163
- description: "Charge a customer using the tenant Stripe connection and record settlement details.",
164
- domain: "payments",
165
- owners: [OwnersEnum2.PlatformCore],
166
- tags: [TagsEnum2.Marketplace, "stripe"],
167
- stability: StabilityEnum2.Experimental
158
+ title: "Stripe Payments Integration",
159
+ description: "Stripe payments integration with blueprint, workflow, and tenant configuration",
160
+ domain: "integration",
161
+ owners: ["@integration-team"],
162
+ tags: ["integration", "stripe", "payments"],
163
+ stability: "experimental"
168
164
  },
169
- definition: {
170
- entryStepId: "prepare",
171
- steps: [
172
- {
173
- id: "prepare",
174
- type: "automation",
175
- label: "Prepare charge parameters",
176
- action: {
177
- operation: { key: "payments.prepareCharge", version: "1.0.0" }
178
- }
179
- },
180
- {
181
- id: "charge",
182
- type: "automation",
183
- label: "Charge card via Stripe",
184
- action: {
185
- operation: { key: "payments.stripe.chargeCard", version: "1.0.0" }
186
- }
187
- },
188
- {
189
- id: "confirm",
190
- type: "automation",
191
- label: "Confirm settlement",
192
- action: {
193
- operation: { key: "payments.recordSettlement", version: "1.0.0" }
194
- }
195
- }
196
- ],
197
- transitions: [
198
- { from: "prepare", to: "charge" },
199
- { from: "charge", to: "confirm", condition: "output.success === true" }
200
- ]
201
- }
202
- };
165
+ integrations: [
166
+ { key: "integration-stripe.integration.psp", version: "1.0.0" }
167
+ ],
168
+ workflows: [{ key: "integration-stripe.workflow.payment", version: "1.0.0" }],
169
+ policies: [{ key: "integration-stripe.policy.payments", version: "1.0.0" }],
170
+ docs: [
171
+ "docs.examples.integration-stripe",
172
+ "docs.examples.integration-stripe.usage"
173
+ ]
174
+ });
203
175
 
204
176
  // src/tenant.ts
205
177
  var artisanStripeTenantConfig = {
@@ -254,29 +226,57 @@ var artisanStripeTenantConfig = {
254
226
  notes: "Stripe connection bound for production payments."
255
227
  };
256
228
 
257
- // src/integration-stripe.feature.ts
258
- import { defineFeature } from "@contractspec/lib.contracts-spec";
259
- var IntegrationStripeFeature = defineFeature({
229
+ // src/workflow.ts
230
+ import {
231
+ OwnersEnum as OwnersEnum2,
232
+ StabilityEnum as StabilityEnum2,
233
+ TagsEnum as TagsEnum2
234
+ } from "@contractspec/lib.contracts-spec/ownership";
235
+ var collectPaymentWorkflow = {
260
236
  meta: {
261
- key: "integration-stripe",
237
+ key: "artisan.payments.collectPayment",
262
238
  version: "1.0.0",
263
- title: "Stripe Payments Integration",
264
- description: "Stripe payments integration with blueprint, workflow, and tenant configuration",
265
- domain: "integration",
266
- owners: ["@integration-team"],
267
- tags: ["integration", "stripe", "payments"],
268
- stability: "experimental"
239
+ title: "Collect Card Payment",
240
+ description: "Charge a customer using the tenant Stripe connection and record settlement details.",
241
+ domain: "payments",
242
+ owners: [OwnersEnum2.PlatformCore],
243
+ tags: [TagsEnum2.Marketplace, "stripe"],
244
+ stability: StabilityEnum2.Experimental
269
245
  },
270
- integrations: [
271
- { key: "integration-stripe.integration.psp", version: "1.0.0" }
272
- ],
273
- workflows: [{ key: "integration-stripe.workflow.payment", version: "1.0.0" }],
274
- policies: [{ key: "integration-stripe.policy.payments", version: "1.0.0" }],
275
- docs: [
276
- "docs.examples.integration-stripe",
277
- "docs.examples.integration-stripe.usage"
278
- ]
279
- });
246
+ definition: {
247
+ entryStepId: "prepare",
248
+ steps: [
249
+ {
250
+ id: "prepare",
251
+ type: "automation",
252
+ label: "Prepare charge parameters",
253
+ action: {
254
+ operation: { key: "payments.prepareCharge", version: "1.0.0" }
255
+ }
256
+ },
257
+ {
258
+ id: "charge",
259
+ type: "automation",
260
+ label: "Charge card via Stripe",
261
+ action: {
262
+ operation: { key: "payments.stripe.chargeCard", version: "1.0.0" }
263
+ }
264
+ },
265
+ {
266
+ id: "confirm",
267
+ type: "automation",
268
+ label: "Confirm settlement",
269
+ action: {
270
+ operation: { key: "payments.recordSettlement", version: "1.0.0" }
271
+ }
272
+ }
273
+ ],
274
+ transitions: [
275
+ { from: "prepare", to: "charge" },
276
+ { from: "charge", to: "confirm", condition: "output.success === true" }
277
+ ]
278
+ }
279
+ };
280
280
  export {
281
281
  stripeLiveConnection,
282
282
  example_default as example,