@contractspec/example.integration-stripe 0.0.0-canary-20260113162409
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$colon$bundle.log +37 -0
- package/.turbo/turbo-build.log +38 -0
- package/CHANGELOG.md +302 -0
- package/LICENSE +21 -0
- package/README.md +29 -0
- package/dist/blueprint.d.ts +7 -0
- package/dist/blueprint.d.ts.map +1 -0
- package/dist/blueprint.js +66 -0
- package/dist/blueprint.js.map +1 -0
- package/dist/connection.sample.d.ts +7 -0
- package/dist/connection.sample.d.ts.map +1 -0
- package/dist/connection.sample.js +22 -0
- package/dist/connection.sample.js.map +1 -0
- package/dist/docs/index.d.ts +1 -0
- package/dist/docs/index.js +1 -0
- package/dist/docs/integration-stripe.docblock.d.ts +1 -0
- package/dist/docs/integration-stripe.docblock.js +30 -0
- package/dist/docs/integration-stripe.docblock.js.map +1 -0
- package/dist/example.d.ts +7 -0
- package/dist/example.d.ts.map +1 -0
- package/dist/example.js +47 -0
- package/dist/example.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +8 -0
- package/dist/tenant.d.ts +7 -0
- package/dist/tenant.d.ts.map +1 -0
- package/dist/tenant.js +53 -0
- package/dist/tenant.js.map +1 -0
- package/dist/workflow.d.ts +7 -0
- package/dist/workflow.d.ts.map +1 -0
- package/dist/workflow.js +59 -0
- package/dist/workflow.js.map +1 -0
- package/package.json +63 -0
- package/src/blueprint.ts +62 -0
- package/src/connection.sample.ts +21 -0
- package/src/docs/index.ts +1 -0
- package/src/docs/integration-stripe.docblock.ts +28 -0
- package/src/example.ts +32 -0
- package/src/index.ts +6 -0
- package/src/tenant.ts +53 -0
- package/src/workflow.ts +53 -0
- package/translation.catalog.json +21 -0
- package/tsconfig.json +11 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/tsdown.config.js +6 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"example.js","names":[],"sources":["../src/example.ts"],"sourcesContent":["import { defineExample } from '@contractspec/lib.contracts';\n\nconst example = defineExample({\n meta: {\n key: 'integration-stripe',\n version: '1.0.0',\n title: 'Integration — Stripe Payments',\n description:\n 'Wire AppBlueprint + Workflow + TenantAppConfig to enable Stripe-backed payments (spec-first integration pattern).',\n kind: 'integration',\n visibility: 'public',\n stability: 'experimental',\n owners: ['@platform.core'],\n tags: ['stripe', 'payments', 'integration', 'blueprint', 'workflow'],\n },\n docs: {\n rootDocId: 'docs.examples.integration-stripe',\n usageDocId: 'docs.examples.integration-stripe.usage',\n },\n entrypoints: {\n packageName: '@contractspec/example.integration-stripe',\n docs: './docs',\n },\n surfaces: {\n templates: true,\n sandbox: { enabled: true, modes: ['markdown', 'specs'] },\n studio: { enabled: true, installable: true },\n mcp: { enabled: true },\n },\n});\n\nexport default example;\n"],"mappings":";;;AAEA,MAAM,UAAU,cAAc;CAC5B,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,MAAM;EACN,YAAY;EACZ,WAAW;EACX,QAAQ,CAAC,iBAAiB;EAC1B,MAAM;GAAC;GAAU;GAAY;GAAe;GAAa;GAAW;EACrE;CACD,MAAM;EACJ,WAAW;EACX,YAAY;EACb;CACD,aAAa;EACX,aAAa;EACb,MAAM;EACP;CACD,UAAU;EACR,WAAW;EACX,SAAS;GAAE,SAAS;GAAM,OAAO,CAAC,YAAY,QAAQ;GAAE;EACxD,QAAQ;GAAE,SAAS;GAAM,aAAa;GAAM;EAC5C,KAAK,EAAE,SAAS,MAAM;EACvB;CACF,CAAC;AAEF,sBAAe"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { artisanStripeBlueprint } from "./blueprint.js";
|
|
2
|
+
import { stripeLiveConnection } from "./connection.sample.js";
|
|
3
|
+
import example from "./example.js";
|
|
4
|
+
import { collectPaymentWorkflow } from "./workflow.js";
|
|
5
|
+
import { artisanStripeTenantConfig } from "./tenant.js";
|
|
6
|
+
export { artisanStripeBlueprint, artisanStripeTenantConfig, collectPaymentWorkflow, example, stripeLiveConnection };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { artisanStripeBlueprint } from "./blueprint.js";
|
|
2
|
+
import { stripeLiveConnection } from "./connection.sample.js";
|
|
3
|
+
import example_default from "./example.js";
|
|
4
|
+
import { collectPaymentWorkflow } from "./workflow.js";
|
|
5
|
+
import { artisanStripeTenantConfig } from "./tenant.js";
|
|
6
|
+
import "./docs/index.js";
|
|
7
|
+
|
|
8
|
+
export { artisanStripeBlueprint, artisanStripeTenantConfig, collectPaymentWorkflow, example_default as example, stripeLiveConnection };
|
package/dist/tenant.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenant.d.ts","names":[],"sources":["../src/tenant.ts"],"sourcesContent":[],"mappings":";;;cAEa,2BAA2B"}
|
package/dist/tenant.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//#region src/tenant.ts
|
|
2
|
+
const artisanStripeTenantConfig = {
|
|
3
|
+
meta: {
|
|
4
|
+
id: "tenant-config-artisan-stripe",
|
|
5
|
+
tenantId: "artisan-co",
|
|
6
|
+
appId: "artisan",
|
|
7
|
+
blueprintName: "artisan.payments.stripe",
|
|
8
|
+
blueprintVersion: "1.0.0",
|
|
9
|
+
environment: "production",
|
|
10
|
+
version: "1.0.0",
|
|
11
|
+
status: "published",
|
|
12
|
+
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
13
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
14
|
+
},
|
|
15
|
+
integrations: [{
|
|
16
|
+
slotId: "primary-payments",
|
|
17
|
+
connectionId: "conn-stripe-live",
|
|
18
|
+
scope: {
|
|
19
|
+
workflows: ["collectPayment"],
|
|
20
|
+
operations: ["payments.stripe.chargeCard"]
|
|
21
|
+
}
|
|
22
|
+
}],
|
|
23
|
+
knowledge: [],
|
|
24
|
+
locales: {
|
|
25
|
+
defaultLocale: "en",
|
|
26
|
+
enabledLocales: ["en", "fr"]
|
|
27
|
+
},
|
|
28
|
+
translationOverrides: { entries: [{
|
|
29
|
+
key: "artisan.payments.appName",
|
|
30
|
+
locale: "en",
|
|
31
|
+
value: "Artisan Payments Portal"
|
|
32
|
+
}] },
|
|
33
|
+
branding: {
|
|
34
|
+
appName: { en: "Artisan Payments Portal" },
|
|
35
|
+
assets: [{
|
|
36
|
+
type: "logo",
|
|
37
|
+
url: "https://tenant.artisanos.dev/logo.png"
|
|
38
|
+
}, {
|
|
39
|
+
type: "logo-dark",
|
|
40
|
+
url: "https://tenant.artisanos.dev/logo-dark.png"
|
|
41
|
+
}],
|
|
42
|
+
colors: {
|
|
43
|
+
primary: "#F97316",
|
|
44
|
+
secondary: "#1F2937"
|
|
45
|
+
},
|
|
46
|
+
customDomain: "pay.artisanos.dev"
|
|
47
|
+
},
|
|
48
|
+
notes: "Stripe connection bound for production payments."
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { artisanStripeTenantConfig };
|
|
53
|
+
//# sourceMappingURL=tenant.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tenant.js","names":[],"sources":["../src/tenant.ts"],"sourcesContent":["import type { TenantAppConfig } from '@contractspec/lib.contracts/app-config/spec';\n\nexport const artisanStripeTenantConfig: TenantAppConfig = {\n meta: {\n id: 'tenant-config-artisan-stripe',\n tenantId: 'artisan-co',\n appId: 'artisan',\n blueprintName: 'artisan.payments.stripe',\n blueprintVersion: '1.0.0',\n environment: 'production',\n version: '1.0.0',\n status: 'published',\n createdAt: new Date().toISOString(),\n updatedAt: new Date().toISOString(),\n },\n integrations: [\n {\n slotId: 'primary-payments',\n connectionId: 'conn-stripe-live',\n scope: {\n workflows: ['collectPayment'],\n operations: ['payments.stripe.chargeCard'],\n },\n },\n ],\n knowledge: [],\n locales: {\n defaultLocale: 'en',\n enabledLocales: ['en', 'fr'],\n },\n translationOverrides: {\n entries: [\n {\n key: 'artisan.payments.appName',\n locale: 'en',\n value: 'Artisan Payments Portal',\n },\n ],\n },\n branding: {\n appName: { en: 'Artisan Payments Portal' },\n assets: [\n { type: 'logo', url: 'https://tenant.artisanos.dev/logo.png' },\n { type: 'logo-dark', url: 'https://tenant.artisanos.dev/logo-dark.png' },\n ],\n colors: {\n primary: '#F97316',\n secondary: '#1F2937',\n },\n customDomain: 'pay.artisanos.dev',\n },\n notes: 'Stripe connection bound for production payments.',\n};\n"],"mappings":";AAEA,MAAa,4BAA6C;CACxD,MAAM;EACJ,IAAI;EACJ,UAAU;EACV,OAAO;EACP,eAAe;EACf,kBAAkB;EAClB,aAAa;EACb,SAAS;EACT,QAAQ;EACR,4BAAW,IAAI,MAAM,EAAC,aAAa;EACnC,4BAAW,IAAI,MAAM,EAAC,aAAa;EACpC;CACD,cAAc,CACZ;EACE,QAAQ;EACR,cAAc;EACd,OAAO;GACL,WAAW,CAAC,iBAAiB;GAC7B,YAAY,CAAC,6BAA6B;GAC3C;EACF,CACF;CACD,WAAW,EAAE;CACb,SAAS;EACP,eAAe;EACf,gBAAgB,CAAC,MAAM,KAAK;EAC7B;CACD,sBAAsB,EACpB,SAAS,CACP;EACE,KAAK;EACL,QAAQ;EACR,OAAO;EACR,CACF,EACF;CACD,UAAU;EACR,SAAS,EAAE,IAAI,2BAA2B;EAC1C,QAAQ,CACN;GAAE,MAAM;GAAQ,KAAK;GAAyC,EAC9D;GAAE,MAAM;GAAa,KAAK;GAA8C,CACzE;EACD,QAAQ;GACN,SAAS;GACT,WAAW;GACZ;EACD,cAAc;EACf;CACD,OAAO;CACR"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.d.ts","names":[],"sources":["../src/workflow.ts"],"sourcesContent":[],"mappings":";;;cAOa,wBAAwB"}
|
package/dist/workflow.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { OwnersEnum, StabilityEnum, TagsEnum } from "@contractspec/lib.contracts/ownership";
|
|
2
|
+
|
|
3
|
+
//#region src/workflow.ts
|
|
4
|
+
const collectPaymentWorkflow = {
|
|
5
|
+
meta: {
|
|
6
|
+
key: "artisan.payments.collectPayment",
|
|
7
|
+
version: "1.0.0",
|
|
8
|
+
title: "Collect Card Payment",
|
|
9
|
+
description: "Charge a customer using the tenant Stripe connection and record settlement details.",
|
|
10
|
+
domain: "payments",
|
|
11
|
+
owners: [OwnersEnum.PlatformCore],
|
|
12
|
+
tags: [TagsEnum.Marketplace, "stripe"],
|
|
13
|
+
stability: StabilityEnum.Experimental
|
|
14
|
+
},
|
|
15
|
+
definition: {
|
|
16
|
+
entryStepId: "prepare",
|
|
17
|
+
steps: [
|
|
18
|
+
{
|
|
19
|
+
id: "prepare",
|
|
20
|
+
type: "automation",
|
|
21
|
+
label: "Prepare charge parameters",
|
|
22
|
+
action: { operation: {
|
|
23
|
+
key: "payments.prepareCharge",
|
|
24
|
+
version: "1.0.0"
|
|
25
|
+
} }
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "charge",
|
|
29
|
+
type: "automation",
|
|
30
|
+
label: "Charge card via Stripe",
|
|
31
|
+
action: { operation: {
|
|
32
|
+
key: "payments.stripe.chargeCard",
|
|
33
|
+
version: "1.0.0"
|
|
34
|
+
} }
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "confirm",
|
|
38
|
+
type: "automation",
|
|
39
|
+
label: "Confirm settlement",
|
|
40
|
+
action: { operation: {
|
|
41
|
+
key: "payments.recordSettlement",
|
|
42
|
+
version: "1.0.0"
|
|
43
|
+
} }
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
transitions: [{
|
|
47
|
+
from: "prepare",
|
|
48
|
+
to: "charge"
|
|
49
|
+
}, {
|
|
50
|
+
from: "charge",
|
|
51
|
+
to: "confirm",
|
|
52
|
+
condition: "output.success === true"
|
|
53
|
+
}]
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
//#endregion
|
|
58
|
+
export { collectPaymentWorkflow };
|
|
59
|
+
//# sourceMappingURL=workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workflow.js","names":[],"sources":["../src/workflow.ts"],"sourcesContent":["import type { WorkflowSpec } from '@contractspec/lib.contracts/workflow/spec';\nimport {\n OwnersEnum,\n StabilityEnum,\n TagsEnum,\n} from '@contractspec/lib.contracts/ownership';\n\nexport const collectPaymentWorkflow: WorkflowSpec = {\n meta: {\n key: 'artisan.payments.collectPayment',\n version: '1.0.0',\n title: 'Collect Card Payment',\n description:\n 'Charge a customer using the tenant Stripe connection and record settlement details.',\n domain: 'payments',\n owners: [OwnersEnum.PlatformCore],\n tags: [TagsEnum.Marketplace, 'stripe'],\n stability: StabilityEnum.Experimental,\n },\n definition: {\n entryStepId: 'prepare',\n steps: [\n {\n id: 'prepare',\n type: 'automation',\n label: 'Prepare charge parameters',\n action: {\n operation: { key: 'payments.prepareCharge', version: '1.0.0' },\n },\n },\n {\n id: 'charge',\n type: 'automation',\n label: 'Charge card via Stripe',\n action: {\n operation: { key: 'payments.stripe.chargeCard', version: '1.0.0' },\n },\n },\n {\n id: 'confirm',\n type: 'automation',\n label: 'Confirm settlement',\n action: {\n operation: { key: 'payments.recordSettlement', version: '1.0.0' },\n },\n },\n ],\n transitions: [\n { from: 'prepare', to: 'charge' },\n { from: 'charge', to: 'confirm', condition: 'output.success === true' },\n ],\n },\n};\n"],"mappings":";;;AAOA,MAAa,yBAAuC;CAClD,MAAM;EACJ,KAAK;EACL,SAAS;EACT,OAAO;EACP,aACE;EACF,QAAQ;EACR,QAAQ,CAAC,WAAW,aAAa;EACjC,MAAM,CAAC,SAAS,aAAa,SAAS;EACtC,WAAW,cAAc;EAC1B;CACD,YAAY;EACV,aAAa;EACb,OAAO;GACL;IACE,IAAI;IACJ,MAAM;IACN,OAAO;IACP,QAAQ,EACN,WAAW;KAAE,KAAK;KAA0B,SAAS;KAAS,EAC/D;IACF;GACD;IACE,IAAI;IACJ,MAAM;IACN,OAAO;IACP,QAAQ,EACN,WAAW;KAAE,KAAK;KAA8B,SAAS;KAAS,EACnE;IACF;GACD;IACE,IAAI;IACJ,MAAM;IACN,OAAO;IACP,QAAQ,EACN,WAAW;KAAE,KAAK;KAA6B,SAAS;KAAS,EAClE;IACF;GACF;EACD,aAAa,CACX;GAAE,MAAM;GAAW,IAAI;GAAU,EACjC;GAAE,MAAM;GAAU,IAAI;GAAW,WAAW;GAA2B,CACxE;EACF;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@contractspec/example.integration-stripe",
|
|
3
|
+
"version": "0.0.0-canary-20260113162409",
|
|
4
|
+
"description": "Integration example – Stripe Payments (blueprint + workflow + tenant config).",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/index.js",
|
|
9
|
+
"./blueprint": "./dist/blueprint.js",
|
|
10
|
+
"./connection.sample": "./dist/connection.sample.js",
|
|
11
|
+
"./docs": "./dist/docs/index.js",
|
|
12
|
+
"./docs/integration-stripe.docblock": "./dist/docs/integration-stripe.docblock.js",
|
|
13
|
+
"./example": "./dist/example.js",
|
|
14
|
+
"./tenant": "./dist/tenant.js",
|
|
15
|
+
"./workflow": "./dist/workflow.js",
|
|
16
|
+
"./*": "./*"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
|
|
20
|
+
"publish:pkg:canary": "bun publish:pkg --tag canary",
|
|
21
|
+
"build": "bun build:types && bun build:bundle",
|
|
22
|
+
"build:bundle": "tsdown",
|
|
23
|
+
"build:types": "tsc --noEmit",
|
|
24
|
+
"dev": "bun build:bundle --watch",
|
|
25
|
+
"clean": "rimraf dist .turbo",
|
|
26
|
+
"lint": "bun lint:fix",
|
|
27
|
+
"lint:fix": "eslint src --fix",
|
|
28
|
+
"lint:check": "eslint src",
|
|
29
|
+
"test": "bun test"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"@contractspec/lib.schema": "0.0.0-canary-20260113162409",
|
|
33
|
+
"@contractspec/lib.contracts": "0.0.0-canary-20260113162409"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@contractspec/tool.tsdown": "0.0.0-canary-20260113162409",
|
|
37
|
+
"@contractspec/tool.typescript": "0.0.0-canary-20260113162409",
|
|
38
|
+
"tsdown": "^0.19.0",
|
|
39
|
+
"typescript": "^5.9.3"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public",
|
|
43
|
+
"exports": {
|
|
44
|
+
".": "./dist/index.js",
|
|
45
|
+
"./blueprint": "./dist/blueprint.js",
|
|
46
|
+
"./connection.sample": "./dist/connection.sample.js",
|
|
47
|
+
"./docs": "./dist/docs/index.js",
|
|
48
|
+
"./docs/integration-stripe.docblock": "./dist/docs/integration-stripe.docblock.js",
|
|
49
|
+
"./example": "./dist/example.js",
|
|
50
|
+
"./tenant": "./dist/tenant.js",
|
|
51
|
+
"./workflow": "./dist/workflow.js",
|
|
52
|
+
"./*": "./*"
|
|
53
|
+
},
|
|
54
|
+
"registry": "https://registry.npmjs.org/"
|
|
55
|
+
},
|
|
56
|
+
"license": "MIT",
|
|
57
|
+
"repository": {
|
|
58
|
+
"type": "git",
|
|
59
|
+
"url": "https://github.com/lssm-tech/contractspec.git",
|
|
60
|
+
"directory": "packages/examples/integration-stripe"
|
|
61
|
+
},
|
|
62
|
+
"homepage": "https://contractspec.io"
|
|
63
|
+
}
|
package/src/blueprint.ts
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { AppBlueprintSpec } from '@contractspec/lib.contracts/app-config/spec';
|
|
2
|
+
import {
|
|
3
|
+
OwnersEnum,
|
|
4
|
+
StabilityEnum,
|
|
5
|
+
TagsEnum,
|
|
6
|
+
} from '@contractspec/lib.contracts/ownership';
|
|
7
|
+
|
|
8
|
+
export const artisanStripeBlueprint: AppBlueprintSpec = {
|
|
9
|
+
meta: {
|
|
10
|
+
key: 'artisan.payments.stripe',
|
|
11
|
+
version: '1.0.0',
|
|
12
|
+
appId: 'artisan',
|
|
13
|
+
title: 'ArtisanOS Stripe Payments',
|
|
14
|
+
description:
|
|
15
|
+
'Blueprint enabling card payments for ArtisanOS merchants via the Stripe integration.',
|
|
16
|
+
domain: 'payments',
|
|
17
|
+
owners: [OwnersEnum.PlatformCore],
|
|
18
|
+
tags: [TagsEnum.Marketplace, 'stripe', 'payments'],
|
|
19
|
+
stability: StabilityEnum.Experimental,
|
|
20
|
+
},
|
|
21
|
+
capabilities: {
|
|
22
|
+
enabled: [{ key: 'payments.psp', version: '1.0.0' }],
|
|
23
|
+
},
|
|
24
|
+
integrationSlots: [
|
|
25
|
+
{
|
|
26
|
+
slotId: 'primary-payments',
|
|
27
|
+
requiredCategory: 'payments',
|
|
28
|
+
allowedModes: ['managed', 'byok'],
|
|
29
|
+
requiredCapabilities: [{ key: 'payments.psp', version: '1.0.0' }],
|
|
30
|
+
required: true,
|
|
31
|
+
description:
|
|
32
|
+
'Primary card processor slot. Bind the tenant Stripe connection here.',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
branding: {
|
|
36
|
+
appNameKey: 'artisan.payments.appName',
|
|
37
|
+
assets: [
|
|
38
|
+
{ type: 'logo', url: 'https://cdn.artisanos.dev/branding/logo.png' },
|
|
39
|
+
{
|
|
40
|
+
type: 'favicon',
|
|
41
|
+
url: 'https://cdn.artisanos.dev/branding/favicon.ico',
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
colorTokens: {
|
|
45
|
+
primary: 'colors.brand.primary',
|
|
46
|
+
secondary: 'colors.brand.secondary',
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
translationCatalog: {
|
|
50
|
+
key: 'artisan.payments.catalog',
|
|
51
|
+
version: '1.0.0',
|
|
52
|
+
},
|
|
53
|
+
workflows: {
|
|
54
|
+
collectPayment: {
|
|
55
|
+
key: 'artisan.payments.collectPayment',
|
|
56
|
+
version: '1.0.0',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
policies: [{ key: 'artisan.payments.default', version: '1.0.0' }],
|
|
60
|
+
notes:
|
|
61
|
+
'Install this blueprint and pair it with the Stripe integration connection to enable card collection.',
|
|
62
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { IntegrationConnection } from '@contractspec/lib.contracts/integrations/connection';
|
|
2
|
+
|
|
3
|
+
export const stripeLiveConnection: IntegrationConnection = {
|
|
4
|
+
meta: {
|
|
5
|
+
id: 'conn-stripe-live',
|
|
6
|
+
tenantId: 'artisan-co',
|
|
7
|
+
integrationKey: 'payments.stripe',
|
|
8
|
+
integrationVersion: '1',
|
|
9
|
+
label: 'Stripe Production',
|
|
10
|
+
environment: 'production',
|
|
11
|
+
createdAt: '2026-01-01T00:00:00.000Z',
|
|
12
|
+
updatedAt: '2026-01-01T00:00:00.000Z',
|
|
13
|
+
},
|
|
14
|
+
ownershipMode: 'managed',
|
|
15
|
+
config: {
|
|
16
|
+
accountId: 'acct_xxx',
|
|
17
|
+
},
|
|
18
|
+
secretProvider: 'vault',
|
|
19
|
+
secretRef: 'vault://integrations/artisan-co/conn-stripe-live',
|
|
20
|
+
status: 'connected',
|
|
21
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './integration-stripe.docblock';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { DocBlock } from '@contractspec/lib.contracts/docs';
|
|
2
|
+
import { registerDocBlocks } from '@contractspec/lib.contracts/docs';
|
|
3
|
+
|
|
4
|
+
const blocks: DocBlock[] = [
|
|
5
|
+
{
|
|
6
|
+
id: 'docs.examples.integration-stripe',
|
|
7
|
+
title: 'Integration Example — Stripe Payments',
|
|
8
|
+
summary:
|
|
9
|
+
'How to wire IntegrationSpec/TenantAppConfig + blueprint + workflow to enable Stripe-backed payments.',
|
|
10
|
+
kind: 'reference',
|
|
11
|
+
visibility: 'public',
|
|
12
|
+
route: '/docs/examples/integration-stripe',
|
|
13
|
+
tags: ['stripe', 'payments', 'integrations', 'example'],
|
|
14
|
+
body: `## Included\n- App blueprint enabling \`payments.psp\` capability.\n- Workflow invoking Stripe operations (prepare → charge → confirm).\n- Tenant app config binding workflow to an IntegrationConnection.\n\n## Notes\n- Secrets live in secret providers; connection config is non-secret.\n- Use \`ctx.resolvedAppConfig\` in operation executors to access integrations, branding, and translations.`,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: 'docs.examples.integration-stripe.usage',
|
|
18
|
+
title: 'Stripe Integration Example — Usage',
|
|
19
|
+
summary: 'How to use the blueprint, workflow, and tenant config together.',
|
|
20
|
+
kind: 'usage',
|
|
21
|
+
visibility: 'public',
|
|
22
|
+
route: '/docs/examples/integration-stripe/usage',
|
|
23
|
+
tags: ['stripe', 'usage'],
|
|
24
|
+
body: `## Usage\n1) Register the blueprint + workflow + catalog in your registry.\n2) Persist an IntegrationConnection (see connection sample).\n3) Bind the tenant app config to the connection.\n\n## Guardrails\n- Never log secrets.\n- Keep payment semantics spec-defined; gate breaking changes behind flags.`,
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
registerDocBlocks(blocks);
|
package/src/example.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineExample } from '@contractspec/lib.contracts';
|
|
2
|
+
|
|
3
|
+
const example = defineExample({
|
|
4
|
+
meta: {
|
|
5
|
+
key: 'integration-stripe',
|
|
6
|
+
version: '1.0.0',
|
|
7
|
+
title: 'Integration — Stripe Payments',
|
|
8
|
+
description:
|
|
9
|
+
'Wire AppBlueprint + Workflow + TenantAppConfig to enable Stripe-backed payments (spec-first integration pattern).',
|
|
10
|
+
kind: 'integration',
|
|
11
|
+
visibility: 'public',
|
|
12
|
+
stability: 'experimental',
|
|
13
|
+
owners: ['@platform.core'],
|
|
14
|
+
tags: ['stripe', 'payments', 'integration', 'blueprint', 'workflow'],
|
|
15
|
+
},
|
|
16
|
+
docs: {
|
|
17
|
+
rootDocId: 'docs.examples.integration-stripe',
|
|
18
|
+
usageDocId: 'docs.examples.integration-stripe.usage',
|
|
19
|
+
},
|
|
20
|
+
entrypoints: {
|
|
21
|
+
packageName: '@contractspec/example.integration-stripe',
|
|
22
|
+
docs: './docs',
|
|
23
|
+
},
|
|
24
|
+
surfaces: {
|
|
25
|
+
templates: true,
|
|
26
|
+
sandbox: { enabled: true, modes: ['markdown', 'specs'] },
|
|
27
|
+
studio: { enabled: true, installable: true },
|
|
28
|
+
mcp: { enabled: true },
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export default example;
|
package/src/index.ts
ADDED
package/src/tenant.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { TenantAppConfig } from '@contractspec/lib.contracts/app-config/spec';
|
|
2
|
+
|
|
3
|
+
export const artisanStripeTenantConfig: TenantAppConfig = {
|
|
4
|
+
meta: {
|
|
5
|
+
id: 'tenant-config-artisan-stripe',
|
|
6
|
+
tenantId: 'artisan-co',
|
|
7
|
+
appId: 'artisan',
|
|
8
|
+
blueprintName: 'artisan.payments.stripe',
|
|
9
|
+
blueprintVersion: '1.0.0',
|
|
10
|
+
environment: 'production',
|
|
11
|
+
version: '1.0.0',
|
|
12
|
+
status: 'published',
|
|
13
|
+
createdAt: new Date().toISOString(),
|
|
14
|
+
updatedAt: new Date().toISOString(),
|
|
15
|
+
},
|
|
16
|
+
integrations: [
|
|
17
|
+
{
|
|
18
|
+
slotId: 'primary-payments',
|
|
19
|
+
connectionId: 'conn-stripe-live',
|
|
20
|
+
scope: {
|
|
21
|
+
workflows: ['collectPayment'],
|
|
22
|
+
operations: ['payments.stripe.chargeCard'],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
knowledge: [],
|
|
27
|
+
locales: {
|
|
28
|
+
defaultLocale: 'en',
|
|
29
|
+
enabledLocales: ['en', 'fr'],
|
|
30
|
+
},
|
|
31
|
+
translationOverrides: {
|
|
32
|
+
entries: [
|
|
33
|
+
{
|
|
34
|
+
key: 'artisan.payments.appName',
|
|
35
|
+
locale: 'en',
|
|
36
|
+
value: 'Artisan Payments Portal',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
branding: {
|
|
41
|
+
appName: { en: 'Artisan Payments Portal' },
|
|
42
|
+
assets: [
|
|
43
|
+
{ type: 'logo', url: 'https://tenant.artisanos.dev/logo.png' },
|
|
44
|
+
{ type: 'logo-dark', url: 'https://tenant.artisanos.dev/logo-dark.png' },
|
|
45
|
+
],
|
|
46
|
+
colors: {
|
|
47
|
+
primary: '#F97316',
|
|
48
|
+
secondary: '#1F2937',
|
|
49
|
+
},
|
|
50
|
+
customDomain: 'pay.artisanos.dev',
|
|
51
|
+
},
|
|
52
|
+
notes: 'Stripe connection bound for production payments.',
|
|
53
|
+
};
|
package/src/workflow.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { WorkflowSpec } from '@contractspec/lib.contracts/workflow/spec';
|
|
2
|
+
import {
|
|
3
|
+
OwnersEnum,
|
|
4
|
+
StabilityEnum,
|
|
5
|
+
TagsEnum,
|
|
6
|
+
} from '@contractspec/lib.contracts/ownership';
|
|
7
|
+
|
|
8
|
+
export const collectPaymentWorkflow: WorkflowSpec = {
|
|
9
|
+
meta: {
|
|
10
|
+
key: 'artisan.payments.collectPayment',
|
|
11
|
+
version: '1.0.0',
|
|
12
|
+
title: 'Collect Card Payment',
|
|
13
|
+
description:
|
|
14
|
+
'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
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"meta": {
|
|
3
|
+
"name": "artisan.payments.catalog",
|
|
4
|
+
"version": 1
|
|
5
|
+
},
|
|
6
|
+
"defaultLocale": "en",
|
|
7
|
+
"supportedLocales": ["en", "fr"],
|
|
8
|
+
"entries": [
|
|
9
|
+
{
|
|
10
|
+
"key": "artisan.payments.appName",
|
|
11
|
+
"locale": "en",
|
|
12
|
+
"value": "Artisan Payments Portal"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"key": "artisan.payments.appName",
|
|
16
|
+
"locale": "fr",
|
|
17
|
+
"value": "Portail de paiement Artisan"
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
|