@contractspec/lib.contracts 1.46.2 → 1.47.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/dist/app-config/app-config.capability.d.ts +7 -0
- package/dist/app-config/app-config.capability.js +23 -0
- package/dist/app-config/app-config.feature.d.ts +1 -2
- package/dist/app-config/app-config.feature.js +9 -2
- package/dist/app-config/contracts.d.ts +50 -50
- package/dist/app-config/events.d.ts +27 -27
- package/dist/app-config/index.d.ts +4 -3
- package/dist/app-config/index.js +3 -2
- package/dist/app-config/lifecycle-contracts.d.ts +55 -55
- package/dist/app-config/runtime.d.ts +6 -6
- package/dist/app-config/spec.d.ts +9 -5
- package/dist/app-config/spec.js +5 -1
- package/dist/contract-registry/schemas.d.ts +2 -2
- package/dist/data-views/runtime.d.ts +5 -1
- package/dist/data-views/runtime.js +34 -7
- package/dist/data-views/spec.d.ts +1 -1
- package/dist/docs/index.js +2 -1
- package/dist/docs/tech/cli.docblock.d.ts +6 -0
- package/dist/docs/tech/cli.docblock.js +138 -0
- package/dist/docs/tech/contracts/vertical-pocket-family-office.docblock.js +106 -1
- package/dist/docs/tech/studio/project-access-teams.docblock.js +3 -1
- package/dist/examples/index.d.ts +9 -1
- package/dist/examples/index.js +8 -1
- package/dist/examples/registry.d.ts +3 -25
- package/dist/examples/registry.js +4 -60
- package/dist/examples/schema.d.ts +17 -17
- package/dist/examples/types.d.ts +1 -1
- package/dist/features/types.d.ts +1 -1
- package/dist/index.d.ts +27 -26
- package/dist/index.js +6 -6
- package/dist/install.d.ts +1 -1
- package/dist/integrations/index.d.ts +2 -2
- package/dist/integrations/index.js +2 -2
- package/dist/integrations/integrations.capability.d.ts +7 -0
- package/dist/integrations/integrations.capability.js +17 -0
- package/dist/integrations/integrations.feature.d.ts +1 -2
- package/dist/integrations/integrations.feature.js +9 -2
- package/dist/integrations/openbanking/contracts/accounts.d.ts +66 -66
- package/dist/integrations/openbanking/contracts/balances.d.ts +34 -34
- package/dist/integrations/openbanking/models.d.ts +55 -55
- package/dist/integrations/openbanking/openbanking.capability.d.ts +7 -0
- package/dist/integrations/openbanking/openbanking.capability.js +21 -0
- package/dist/integrations/openbanking/openbanking.feature.d.ts +1 -2
- package/dist/integrations/openbanking/openbanking.feature.js +9 -2
- package/dist/integrations/operations.d.ts +102 -102
- package/dist/integrations/providers/elevenlabs.d.ts +1 -0
- package/dist/integrations/providers/elevenlabs.js +3 -2
- package/dist/integrations/providers/gcs-storage.d.ts +1 -0
- package/dist/integrations/providers/gcs-storage.js +3 -2
- package/dist/integrations/providers/gmail.d.ts +1 -0
- package/dist/integrations/providers/gmail.js +3 -2
- package/dist/integrations/providers/google-calendar.d.ts +1 -0
- package/dist/integrations/providers/google-calendar.js +3 -2
- package/dist/integrations/providers/impls/provider-factory.js +2 -1
- package/dist/integrations/providers/mistral.d.ts +1 -0
- package/dist/integrations/providers/mistral.js +3 -2
- package/dist/integrations/providers/postmark.d.ts +1 -0
- package/dist/integrations/providers/postmark.js +3 -2
- package/dist/integrations/providers/powens.d.ts +1 -0
- package/dist/integrations/providers/powens.js +3 -2
- package/dist/integrations/providers/qdrant.d.ts +1 -0
- package/dist/integrations/providers/qdrant.js +3 -2
- package/dist/integrations/providers/stripe.d.ts +1 -0
- package/dist/integrations/providers/stripe.js +3 -2
- package/dist/integrations/providers/twilio-sms.d.ts +1 -0
- package/dist/integrations/providers/twilio-sms.js +3 -2
- package/dist/integrations/spec.d.ts +5 -1
- package/dist/integrations/spec.js +5 -1
- package/dist/knowledge/knowledge.capability.d.ts +7 -0
- package/dist/knowledge/knowledge.capability.js +21 -0
- package/dist/knowledge/knowledge.feature.d.ts +1 -2
- package/dist/knowledge/knowledge.feature.js +9 -2
- package/dist/knowledge/operations.d.ts +66 -66
- package/dist/llm/exporters.d.ts +1 -1
- package/dist/llm/types.d.ts +1 -1
- package/dist/onboarding-base.d.ts +29 -29
- package/dist/operations/operation.d.ts +1 -1
- package/dist/server/mcp/createMcpServer.js +1 -1
- package/dist/server/mcp/mcpTypes.d.ts +1 -1
- package/dist/server/mcp/registerPresentations.js +1 -1
- package/dist/server/mcp/registerResources.js +2 -2
- package/dist/tests/index.d.ts +2 -2
- package/dist/tests/index.js +2 -2
- package/dist/tests/spec.d.ts +2 -1
- package/dist/tests/spec.js +4 -1
- package/dist/types.d.ts +2 -2
- package/dist/workflow/index.d.ts +8 -1
- package/dist/workflow/index.js +8 -1
- package/dist/workflow/runner.d.ts +2 -2
- package/dist/workflow/spec.d.ts +1 -1
- package/dist/workflow/validation.d.ts +1 -1
- package/dist/workspace-config/contractsrc-schema.d.ts +45 -974
- package/dist/workspace-config/contractsrc-schema.js +89 -55
- package/dist/workspace-config/contractsrc-types.d.ts +346 -0
- package/dist/workspace-config/contractsrc-types.js +0 -0
- package/dist/workspace-config/index.d.ts +3 -2
- package/package.json +27 -25
- package/dist/docs/tech/contracts/create-subscription.docblock.d.ts +0 -6
- package/dist/docs/tech/contracts/create-subscription.docblock.js +0 -21
- package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.d.ts +0 -6
- package/dist/docs/tech/contracts/graphql-typed-outputs.docblock.js +0 -21
- package/dist/docs/tech/templates/runtime.docblock.d.ts +0 -6
- package/dist/docs/tech/templates/runtime.docblock.js +0 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contractspec/lib.contracts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.47.0",
|
|
4
4
|
"description": "Core contract specification definitions and runtime",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"contractspec",
|
|
@@ -25,23 +25,23 @@
|
|
|
25
25
|
"test": "bun test"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@contractspec/tool.tsdown": "1.
|
|
29
|
-
"@contractspec/tool.typescript": "1.
|
|
28
|
+
"@contractspec/tool.tsdown": "1.47.0",
|
|
29
|
+
"@contractspec/tool.typescript": "1.47.0",
|
|
30
30
|
"@types/express": "^5.0.3",
|
|
31
31
|
"@types/turndown": "^5.0.6",
|
|
32
|
-
"tsdown": "^0.
|
|
32
|
+
"tsdown": "^0.19.0",
|
|
33
33
|
"typescript": "^5.9.3"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@aws-sdk/client-secrets-manager": "^3.
|
|
37
|
-
"@aws-sdk/client-sqs": "^3.
|
|
38
|
-
"@contractspec/lib.logger": "1.
|
|
39
|
-
"@contractspec/lib.schema": "1.
|
|
40
|
-
"@elevenlabs/elevenlabs-js": "^2.
|
|
36
|
+
"@aws-sdk/client-secrets-manager": "^3.966.0",
|
|
37
|
+
"@aws-sdk/client-sqs": "^3.966.0",
|
|
38
|
+
"@contractspec/lib.logger": "1.47.0",
|
|
39
|
+
"@contractspec/lib.schema": "1.47.0",
|
|
40
|
+
"@elevenlabs/elevenlabs-js": "^2.30.0",
|
|
41
41
|
"@google-cloud/secret-manager": "^6.1.1",
|
|
42
42
|
"@google-cloud/storage": "^7.18.0",
|
|
43
43
|
"@mistralai/mistralai": "^1.11.0",
|
|
44
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
44
|
+
"@modelcontextprotocol/sdk": "^1.25.2",
|
|
45
45
|
"@pothos/core": "^4.9.1",
|
|
46
46
|
"@pothos/plugin-complexity": "^4.1.2",
|
|
47
47
|
"@pothos/plugin-dataloader": "^4.4.2",
|
|
@@ -50,31 +50,30 @@
|
|
|
50
50
|
"@pothos/plugin-tracing": "^1.1.2",
|
|
51
51
|
"@qdrant/js-client-rest": "^1.16.2",
|
|
52
52
|
"compare-versions": "^6.1.1",
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
53
|
+
"google-gax": "^5.0.6",
|
|
54
|
+
"googleapis": "^170.0.0",
|
|
55
|
+
"mcp-handler": "^1.0.7",
|
|
56
|
+
"postmark": "^4.0.5",
|
|
57
|
+
"stripe": "^20.1.2",
|
|
57
58
|
"turndown": "^7.2.2",
|
|
58
|
-
"twilio": "^5.
|
|
59
|
-
"zod": "^4.
|
|
59
|
+
"twilio": "^5.11.2",
|
|
60
|
+
"zod": "^4.3.5"
|
|
60
61
|
},
|
|
61
62
|
"peerDependencies": {
|
|
62
63
|
"@pothos/core": "^4.9.1",
|
|
63
64
|
"@pothos/plugin-relay": "^4.4.3",
|
|
64
|
-
"elysia": "^1.4.
|
|
65
|
+
"elysia": "^1.4.21",
|
|
65
66
|
"express": "^5.2.1",
|
|
66
67
|
"graphql-scalars": "^1.24.2",
|
|
67
68
|
"next": "16.1.1",
|
|
68
|
-
"@blocknote/core": "^0.
|
|
69
|
-
"@blocknote/react": "^0.
|
|
69
|
+
"@blocknote/core": "^0.46.1",
|
|
70
|
+
"@blocknote/react": "^0.46.1",
|
|
70
71
|
"react": "^19.2.3",
|
|
71
72
|
"react-dom": "^19.2.3",
|
|
72
|
-
"react-hook-form": "^7.
|
|
73
|
+
"react-hook-form": "^7.70.0",
|
|
73
74
|
"@hookform/resolvers": "^5.2.2"
|
|
74
75
|
},
|
|
75
76
|
"type": "module",
|
|
76
|
-
"main": "./dist/index.js",
|
|
77
|
-
"module": "./dist/index.js",
|
|
78
77
|
"types": "./dist/index.d.ts",
|
|
79
78
|
"files": [
|
|
80
79
|
"dist",
|
|
@@ -83,6 +82,7 @@
|
|
|
83
82
|
"exports": {
|
|
84
83
|
".": "./dist/index.js",
|
|
85
84
|
"./app-config": "./dist/app-config/index.js",
|
|
85
|
+
"./app-config/app-config.capability": "./dist/app-config/app-config.capability.js",
|
|
86
86
|
"./app-config/app-config.feature": "./dist/app-config/app-config.feature.js",
|
|
87
87
|
"./app-config/branding": "./dist/app-config/branding.js",
|
|
88
88
|
"./app-config/contracts": "./dist/app-config/contracts.js",
|
|
@@ -121,8 +121,7 @@
|
|
|
121
121
|
"./docs/registry": "./dist/docs/registry.js",
|
|
122
122
|
"./docs/tech-contracts.docs": "./dist/docs/tech-contracts.docs.js",
|
|
123
123
|
"./docs/tech/auth/better-auth-nextjs.docblock": "./dist/docs/tech/auth/better-auth-nextjs.docblock.js",
|
|
124
|
-
"./docs/tech/
|
|
125
|
-
"./docs/tech/contracts/graphql-typed-outputs.docblock": "./dist/docs/tech/contracts/graphql-typed-outputs.docblock.js",
|
|
124
|
+
"./docs/tech/cli.docblock": "./dist/docs/tech/cli.docblock.js",
|
|
126
125
|
"./docs/tech/contracts/migrations.docblock": "./dist/docs/tech/contracts/migrations.docblock.js",
|
|
127
126
|
"./docs/tech/contracts/openapi-export.docblock": "./dist/docs/tech/contracts/openapi-export.docblock.js",
|
|
128
127
|
"./docs/tech/contracts/openapi-import.docblock": "./dist/docs/tech/contracts/openapi-import.docblock.js",
|
|
@@ -147,7 +146,6 @@
|
|
|
147
146
|
"./docs/tech/studio/workspace-ops.docblock": "./dist/docs/tech/studio/workspace-ops.docblock.js",
|
|
148
147
|
"./docs/tech/studio/workspaces.docblock": "./dist/docs/tech/studio/workspaces.docblock.js",
|
|
149
148
|
"./docs/tech/telemetry-ingest.docblock": "./dist/docs/tech/telemetry-ingest.docblock.js",
|
|
150
|
-
"./docs/tech/templates/runtime.docblock": "./dist/docs/tech/templates/runtime.docblock.js",
|
|
151
149
|
"./docs/tech/vscode-extension.docblock": "./dist/docs/tech/vscode-extension.docblock.js",
|
|
152
150
|
"./docs/types": "./dist/docs/types.js",
|
|
153
151
|
"./events": "./dist/events.js",
|
|
@@ -175,6 +173,7 @@
|
|
|
175
173
|
"./integrations/connection": "./dist/integrations/connection.js",
|
|
176
174
|
"./integrations/docs/integrations.docblock": "./dist/integrations/docs/integrations.docblock.js",
|
|
177
175
|
"./integrations/health": "./dist/integrations/health.js",
|
|
176
|
+
"./integrations/integrations.capability": "./dist/integrations/integrations.capability.js",
|
|
178
177
|
"./integrations/integrations.feature": "./dist/integrations/integrations.feature.js",
|
|
179
178
|
"./integrations/openbanking/contracts": "./dist/integrations/openbanking/contracts/index.js",
|
|
180
179
|
"./integrations/openbanking/contracts/accounts": "./dist/integrations/openbanking/contracts/accounts.js",
|
|
@@ -182,6 +181,7 @@
|
|
|
182
181
|
"./integrations/openbanking/contracts/transactions": "./dist/integrations/openbanking/contracts/transactions.js",
|
|
183
182
|
"./integrations/openbanking/guards": "./dist/integrations/openbanking/guards.js",
|
|
184
183
|
"./integrations/openbanking/models": "./dist/integrations/openbanking/models.js",
|
|
184
|
+
"./integrations/openbanking/openbanking.capability": "./dist/integrations/openbanking/openbanking.capability.js",
|
|
185
185
|
"./integrations/openbanking/openbanking.feature": "./dist/integrations/openbanking/openbanking.feature.js",
|
|
186
186
|
"./integrations/openbanking/telemetry": "./dist/integrations/openbanking/telemetry.js",
|
|
187
187
|
"./integrations/operations": "./dist/integrations/operations.js",
|
|
@@ -253,6 +253,7 @@
|
|
|
253
253
|
"./knowledge/ingestion/gmail-adapter": "./dist/knowledge/ingestion/gmail-adapter.js",
|
|
254
254
|
"./knowledge/ingestion/storage-adapter": "./dist/knowledge/ingestion/storage-adapter.js",
|
|
255
255
|
"./knowledge/ingestion/vector-indexer": "./dist/knowledge/ingestion/vector-indexer.js",
|
|
256
|
+
"./knowledge/knowledge.capability": "./dist/knowledge/knowledge.capability.js",
|
|
256
257
|
"./knowledge/knowledge.feature": "./dist/knowledge/knowledge.feature.js",
|
|
257
258
|
"./knowledge/operations": "./dist/knowledge/operations.js",
|
|
258
259
|
"./knowledge/query": "./dist/knowledge/query/index.js",
|
|
@@ -351,6 +352,7 @@
|
|
|
351
352
|
"./workflow/validation": "./dist/workflow/validation.js",
|
|
352
353
|
"./workspace-config": "./dist/workspace-config/index.js",
|
|
353
354
|
"./workspace-config/contractsrc-schema": "./dist/workspace-config/contractsrc-schema.js",
|
|
355
|
+
"./workspace-config/contractsrc-types": "./dist/workspace-config/contractsrc-types.js",
|
|
354
356
|
"./workspace-config/workspace-config.docblock": "./dist/workspace-config/workspace-config.docblock.js",
|
|
355
357
|
"./*": "./*"
|
|
356
358
|
},
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { DocBlock } from "@contractspec/lib.contracts/docs";
|
|
2
|
-
|
|
3
|
-
//#region src/docs/tech/contracts/create-subscription.docblock.d.ts
|
|
4
|
-
declare const tech_contracts_create_subscription_DocBlocks: DocBlock[];
|
|
5
|
-
//#endregion
|
|
6
|
-
export { tech_contracts_create_subscription_DocBlocks };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { registerDocBlocks } from "../../registry.js";
|
|
2
|
-
|
|
3
|
-
//#region src/docs/tech/contracts/create-subscription.docblock.ts
|
|
4
|
-
const tech_contracts_create_subscription_DocBlocks = [{
|
|
5
|
-
id: "docs.tech.contracts.create-subscription",
|
|
6
|
-
title: "Subscriptions via Better Auth Stripe",
|
|
7
|
-
summary: "This app uses Better Auth's Stripe plugin for subscription management.",
|
|
8
|
-
kind: "reference",
|
|
9
|
-
visibility: "public",
|
|
10
|
-
route: "/docs/tech/contracts/create-subscription",
|
|
11
|
-
tags: [
|
|
12
|
-
"tech",
|
|
13
|
-
"contracts",
|
|
14
|
-
"create-subscription"
|
|
15
|
-
],
|
|
16
|
-
body: "### Subscriptions via Better Auth Stripe\n\nThis app uses Better Auth's Stripe plugin for subscription management.\n\nKey endpoints:\n\n- `/api/auth/[...all]` – Better Auth server\n- `/api/auth/stripe/webhook` – Stripe webhook handled by Better Auth\n\nClient usage (org mode):\n\n```ts\nimport { subscription } from '@/lib/auth-client';\n\nawait subscription.upgrade({\n plan: 'core',\n annual: true,\n referenceId: activeOrganization?.id,\n successUrl: '/dashboard',\n cancelUrl: '/pricing',\n});\n```\n\nPlans are configured in `src/lib/auth.ts` referencing env-provided price IDs. See Better Auth Stripe docs: [plugins: Stripe](`https://better-auth.com/docs/plugins/stripe.mdx`) and [Using with organizations](`https://www.better-auth.com/docs/plugins/stripe#using-with-organizations`).\n\nLanding pricing UX\n\n- Components: `SectionEyebrow`, `PriceBadge`, `FeatureList`, `PriceCard`\n- Sections: `PricingSection`, `StoryPricingBenefits`\n- Canonical pricing source: `src/lib/pricing/config.ts`\n\nTrial period\n\n- Le plan « Essentiel » inclut une période d’essai gratuite de 30 jours.\n- Config côté auth: `freeTrial: { days: 30 }` dans `src/lib/auth.ts` (Better Auth Stripe plugin).\n- Config côté pricing: `trial: { days: 30 }` dans `src/lib/pricing/config.ts`.\n\nDashboard badges\n\n- Le `Tableau de bord` affiche des badges d’état d’abonnement:\n - « Essai · se termine le JJ/MM/AAAA » lorsque l’essai est en cours\n - « Abonnement actif » lorsque l’abonnement est actif\n - « Annulé · fin au terme de la période » lorsque la résiliation est planifiée\n- Composant: `components/dashboard/DashboardPage/molecules/Header.tsx`\n- Source des états: hook `useProfileBillingPage()` (`components/profile/ProfileBillingPage/hooks/useProfileBillingPage.tsx`)\n"
|
|
17
|
-
}];
|
|
18
|
-
registerDocBlocks(tech_contracts_create_subscription_DocBlocks);
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
export { tech_contracts_create_subscription_DocBlocks };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { DocBlock } from "@contractspec/lib.contracts/docs";
|
|
2
|
-
|
|
3
|
-
//#region src/docs/tech/contracts/graphql-typed-outputs.docblock.d.ts
|
|
4
|
-
declare const tech_contracts_graphql_typed_outputs_DocBlocks: DocBlock[];
|
|
5
|
-
//#endregion
|
|
6
|
-
export { tech_contracts_graphql_typed_outputs_DocBlocks };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { registerDocBlocks } from "../../registry.js";
|
|
2
|
-
|
|
3
|
-
//#region src/docs/tech/contracts/graphql-typed-outputs.docblock.ts
|
|
4
|
-
const tech_contracts_graphql_typed_outputs_DocBlocks = [{
|
|
5
|
-
id: "docs.tech.contracts.graphql-typed-outputs",
|
|
6
|
-
title: "GraphQL Typed Outputs for Contracts",
|
|
7
|
-
summary: "Improved `@contractspec/lib.contracts` to automatically generate proper GraphQL object types from `SchemaModel` outputs instead of defaulting to `JSON` scalar types.",
|
|
8
|
-
kind: "reference",
|
|
9
|
-
visibility: "public",
|
|
10
|
-
route: "/docs/tech/contracts/graphql-typed-outputs",
|
|
11
|
-
tags: [
|
|
12
|
-
"tech",
|
|
13
|
-
"contracts",
|
|
14
|
-
"graphql-typed-outputs"
|
|
15
|
-
],
|
|
16
|
-
body: "# GraphQL Typed Outputs for Contracts\n\n## Overview\n\nImproved `@contractspec/lib.contracts` to automatically generate proper GraphQL object types from `SchemaModel` outputs instead of defaulting to `JSON` scalar types.\n\n## Problem\n\nPreviously, when GraphQL operations were defined using contracts with `SchemaModel` outputs, the GraphQL schema would default to returning `JSON` scalar types. This meant:\n\n- GraphQL clients couldn't query specific fields\n- No type safety for operation outputs\n- Codegen would fail with \"must have a selection of subfields\" errors\n\n## Solution\n\n### 1. Auto-Type Registration in `graphql-pothos.ts`\n\n**File**: `packages/lssm/libs/contracts/src/server/graphql-pothos.ts`\n\n**Changes**:\n\n- Scan all contract specs and collect their `SchemaModel` outputs\n- Automatically register GraphQL object types for each `SchemaModel`\n- Map field types from SchemaModel to proper GraphQL scalar types\n- Update `resolveGraphQLTypeName` to check for `SchemaModel` names before defaulting to `JSON`\n\n**Key Code**:\n\n```typescript\n// Build a map of output types we need to register\nconst outputTypeCache = new Map<string, AnySchemaModel>();\nfor (const spec of reg.listSpecs()) {\n const out = spec.io.output as AnySchemaModel | ResourceRefDescriptor<boolean>;\n if (out && 'getZod' in out && typeof out.getZod === 'function') {\n const model = out as AnySchemaModel;\n const typeName = model.config?.name ?? 'UnknownOutput';\n if (!outputTypeCache.has(typeName)) {\n outputTypeCache.set(typeName, model);\n }\n }\n}\n\n// Register all output types as GraphQL object types\nfor (const [typeName, model] of outputTypeCache.entries()) {\n builder.objectType(typeName, {\n fields: (t) => {\n // Map each field from SchemaModel to GraphQL field\n // ...\n },\n });\n}\n```\n\n### 2. Fix Contract Definitions\n\n**File**: `packages/hcircle/libs/contracts-coliving/src/interactions/onboarding/org/contracts.ts`\n\n**Changes**:\n\n- Changed `GetOrgOnboardingDraftSpec` from `defineCommand` to `defineQuery` (read-only operation)\n- Added `defineQuery` import\n\n**Before**:\n\n```typescript\nexport const GetOrgOnboardingDraftSpec = defineCommand({\n // ...\n});\n```\n\n**After**:\n\n```typescript\nexport const GetOrgOnboardingDraftSpec = defineQuery({\n // ...\n});\n```\n\n### 3. Update All GraphQL Queries\n\nUpdated all GraphQL operation calls to select proper subfields based on the output type:\n\n#### Output Types and Their Fields\n\n1. **`CreateOrgOutput`**:\n - `organizationId: ID!`\n - `orgType: String!`\n\n2. **`CompleteUserOnboardingOutput`**:\n - `success: Boolean!`\n - `userId: ID!`\n\n3. **`CompleteOrgOnboardingOutput`**:\n - `success: Boolean!`\n - `organizationId: ID!`\n - `orgType: String!`\n\n4. **`OnboardingDraft`** (from resource_ref):\n - `id: ID!`\n - `organizationId: ID!`\n - `data: JSON!`\n - `createdAt: DateTime!`\n - `updatedAt: DateTime!`\n\n5. **`GetOnboardingDraftOutput`**:\n - `id: ID`\n - `organizationId: ID`\n - `data: JSON`\n - `createdAt: DateTime`\n - `updatedAt: DateTime`\n\n6. **`DeleteOnboardingDraftOutput`**:\n - `ok: Boolean!` _(note: not `success`)_\n\n#### Files Updated\n\n1. `/packages/hcircle/apps/mobile-coliving/src/app/onboarding-org-select.tsx`\n2. `/packages/hcircle/apps/mobile-coliving/src/app/onboarding-org.tsx`\n3. `/packages/hcircle/apps/mobile-coliving/src/app/onboarding-user.tsx`\n4. `/packages/hcircle/apps/web-coliving/src/app/onboarding/user/page.tsx`\n5. `/packages/hcircle/apps/web-coliving/src/components/onboarding/OnboardingFlow.tsx`\n6. `/packages/hcircle/apps/web-coliving/src/components/onboarding/OrgSelectionFlow.tsx`\n\n**Example Before**:\n\n```graphql\nmutation CreateOrg($orgType: String!, $name: String!, $slug: String!) {\n createOrganization(input: { orgType: $orgType, name: $name, slug: $slug })\n}\n```\n\n**Example After**:\n\n```graphql\nmutation CreateOrg($orgType: String!, $name: String!, $slug: String!) {\n createOrganization(input: { orgType: $orgType, name: $name, slug: $slug }) {\n organizationId\n orgType\n }\n}\n```\n\n## Benefits\n\n1. **Type Safety**: Full type safety for GraphQL operation outputs\n2. **Auto-Generated Types**: No need to manually specify `returns` in contract transport config\n3. **Better DX**: GraphQL clients can now query specific fields and benefit from autocomplete\n4. **Consistency**: All `SchemaModel` outputs are automatically typed in GraphQL\n5. **Backward Compatible**: Operations with explicit `returns` config still work as before\n\n## Testing\n\nAll GraphQL codegen now passes:\n\n```bash\ncd packages/hcircle/libs/gql-client-coliving\nbun graphql-codegen --config codegen.ts # ✅ Success\n```\n\n## Migration Guide for Other Verticals\n\nTo apply this to other verticals (e.g., Artisanos, Strit):\n\n1. **No code changes needed** - the improved `graphql-pothos.ts` automatically handles all `SchemaModel` outputs\n2. **Update GraphQL queries** - Add field selections to queries that previously returned `JSON`\n3. **Fix query/command mismatches** - Ensure read-only operations use `defineQuery` instead of `defineCommand`\n\n## Future Improvements\n\n1. Add support for nested `SchemaModel` references (currently only supports scalar fields)\n2. Add support for array fields of SchemaModels\n3. Consider auto-generating field selections based on the output type to reduce boilerplate\n\n## Related Documentation\n\n- [Contracts README](../../packages/lssm/libs/contracts/README.md)\n- [Onboarding System](./hcircle/IMPLEMENTATION_COMPLETE.md)\n- [GraphQL Architecture](./graphql/architecture.md)\n"
|
|
17
|
-
}];
|
|
18
|
-
registerDocBlocks(tech_contracts_graphql_typed_outputs_DocBlocks);
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
export { tech_contracts_graphql_typed_outputs_DocBlocks };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { registerDocBlocks } from "../../registry.js";
|
|
2
|
-
|
|
3
|
-
//#region src/docs/tech/templates/runtime.docblock.ts
|
|
4
|
-
const tech_templates_runtime_DocBlocks = [{
|
|
5
|
-
id: "docs.tech.templates.runtime",
|
|
6
|
-
title: "ContractSpec Template Runtime (Phase 9)",
|
|
7
|
-
summary: "Phase 9 introduces a full local-first runtime for templates so anyone can preview apps directly in the browser without provisioning any infrastructure.",
|
|
8
|
-
kind: "reference",
|
|
9
|
-
visibility: "public",
|
|
10
|
-
route: "/docs/tech/templates/runtime",
|
|
11
|
-
tags: [
|
|
12
|
-
"tech",
|
|
13
|
-
"templates",
|
|
14
|
-
"runtime"
|
|
15
|
-
],
|
|
16
|
-
body: "## ContractSpec Template Runtime (Phase 9)\n\nPhase 9 introduces a full local-first runtime for templates so anyone can preview apps directly in the browser without provisioning any infrastructure.\n\n### Building Blocks\n\n- **Local database** – `@contractspec/lib.runtime-local` wraps `sql.js` (SQLite WASM) and `IndexedDB` so we can seed demo data, run migrations, and persist state between sessions. Tests point the runtime to `node_modules/sql.js/dist` so CI doesn’t need a browser.\n- **Local GraphQL** – `LocalGraphQLClient` wires Apollo Client + SchemaLink to resolvers for tasks, messaging, and i18n recipes. All `/templates`, `/studio`, and `/sandbox` previews use those resolvers so we never call remote APIs during demos.\n- **Template registry + installer** – `.../templates/registry.ts` stores the catalog (todos, messaging, recipes). `TemplateInstaller` can seed the runtime (`install`) or export a base64 snapshot via the new `saveTemplateToStudio` mutation.\n- **TemplateShell** – Shared UI wrapper that creates a `TemplateRuntimeProvider`, shows `LocalDataIndicator`, and (optionally) surfaces the new `SaveToStudioButton`.\n\n### Runtime Flows\n\n1. `/templates` now opens a modal that renders `TemplateShell` for each template. Users can explore without leaving the marketing site.\n2. `/studio` switches to a tabbed mini-app (Projects, Canvas, Specs, Deploy) to showcase Studio surfaces with mock data. Visitors see a **preview** shell, while authenticated users (Better Auth via Sigil) unlock full persistence, versioning, and deployment controls.\n3. `/sandbox` lets visitors pick a template and mode (Playground, Spec Editor, Visual Builder). The console at the bottom streams runtime events for transparency.\n\n### GraphQL Mutations\n\n- `saveTemplateToStudio(input: SaveTemplateInput!): SaveTemplateResult!` writes a placeholder project + spec so that templates installed from the sandbox appear in Studio. The mutation is intentionally simple right now: it records which template was imported, stores metadata, and returns `{ projectId, status: 'QUEUED' }` for the UI.\n- `saveCanvasDraft(input: SaveCanvasDraftInput!): CanvasVersion!` snapshots the current Visual Builder nodes to a draft version tied to a canvas overlay. Inputs include `canvasId`, arbitrary `nodes` JSON, and an optional `label`. The resolver enforces org/org access before calling `CanvasVersionManager`.\n- `deployCanvasVersion(input: DeployCanvasVersionInput!): CanvasVersion!` promotes a previously saved draft (`versionId`) to the deployed state. The returned object includes `status`, `nodes`, `createdAt`, and `createdBy` for UI timelines.\n- `undoCanvasVersion(input: UndoCanvasInput!): CanvasVersion` rewinds the visual builder to the prior snapshot (returns `null` when history is empty) so Studio’s toolbar can surface “Undo” without shelling out to local storage.\n\n### Studio GraphQL endpoint\n\n- The landing app exposes the Studio schema at `/api/studio/graphql` via Yoga so React Query hooks (`useStudioProjects`, `useCreateStudioProject`, `useDeployStudioProject`, etc.) can talk to the bundle without spinning up a separate server.\n\n### Spec Editor typing\n\n- Studio’s spec editor now preloads Monaco with ambient declarations for `@contractspec/lib.contracts` and `zod`, so snippets receive autocomplete and inline errors even before the spec ships to the backend. The helper lives in `presentation/components/studio/organisms/monaco-spec-types.ts` and registers the extra libs once per browser session via `monaco.languages.typescript.typescriptDefaults.addExtraLib`.\n- Compiler options are aligned with our frontend toolchain (ES2020 + React JSX) which means drafts written in the editor behave like the compiled artifacts that flow through Studio pipelines.\n\n### Spec templates\n\n- Selecting a spec type now injects a ready-to-edit scaffold (capability, workflow, policy, dataview, component) so authors start from a canonical layout instead of a blank file. Templates live alongside `SpecEditor.tsx`, and we only overwrite the content when the previous value is empty or when the author explicitly switches types via the dropdown.\n\n### Spec preview\n\n- The validation side panel now embeds a `SpecPreview` widget that shows validation errors alongside transport artifacts (GraphQL schema, REST endpoints, component summaries) once a preview run completes. Tabs let authors toggle between “Validation” and “Artifacts,” mirroring the UX described in the Studio plan.\n\n### Testing\n\n- `src/templates/__tests__/runtime.test.ts` covers todos CRUD, messaging delivery, and recipe locale switching through the local GraphQL API.\n- Studio infrastructure tests live in `src/__tests__/e2e/project-lifecycle.test.ts` and continue to exercise project creation + deploy flows.\n\n### Next Steps\n\nFuture templates can register their React components via `registerTemplateComponents(templateId, components)` so TemplateShell can render them automatically. When new templates are added, remember to:\n\n1. Update the registry entry (schema + tags).\n2. Register components inside `presentation/components/templates`.\n3. Document the template under `docs/templates/`.\n\n\n\n\n\n"
|
|
17
|
-
}];
|
|
18
|
-
registerDocBlocks(tech_templates_runtime_DocBlocks);
|
|
19
|
-
|
|
20
|
-
//#endregion
|
|
21
|
-
export { tech_templates_runtime_DocBlocks };
|