@lssm/module.learning-journey 0.0.0-canary-20251220041653 → 0.0.0-canary-20251221132705
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/contracts/models.d.ts +118 -118
- package/dist/contracts/models.d.ts.map +1 -1
- package/dist/contracts/onboarding.d.ts +167 -167
- package/dist/contracts/onboarding.d.ts.map +1 -1
- package/dist/contracts/onboarding.js +1 -1
- package/dist/contracts/operations.d.ts +70 -70
- package/dist/contracts/operations.d.ts.map +1 -1
- package/dist/contracts/operations.js +1 -1
- package/dist/engines/xp.d.ts.map +1 -1
- package/dist/entities/ai.d.ts +200 -200
- package/dist/entities/course.d.ts +150 -150
- package/dist/entities/flashcard.d.ts +145 -145
- package/dist/entities/gamification.d.ts +198 -198
- package/dist/entities/gamification.d.ts.map +1 -1
- package/dist/entities/index.d.ts +605 -605
- package/dist/entities/learner.d.ts +192 -192
- package/dist/entities/onboarding.d.ts +165 -165
- package/dist/events.d.ts +213 -213
- package/dist/libs/contracts/dist/_virtual/rolldown_runtime.js +6 -0
- package/dist/libs/contracts/dist/_virtual/rolldown_runtime.js.map +1 -0
- package/dist/libs/contracts/dist/client/react/form-render.js +1 -0
- package/dist/libs/contracts/dist/data-views.js +1 -0
- package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +6 -6
- package/dist/libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js.map +1 -1
- package/dist/libs/contracts/dist/features.js +1 -0
- package/dist/libs/contracts/dist/forms.js +1 -0
- package/dist/libs/contracts/dist/index.js +14 -1
- package/dist/libs/contracts/dist/index.js.map +1 -0
- package/dist/libs/contracts/dist/integrations/contracts.js +1 -1
- package/dist/libs/contracts/dist/integrations/contracts.js.map +1 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js +1 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/accounts.js.map +1 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js +1 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/balances.js.map +1 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js +1 -1
- package/dist/libs/contracts/dist/integrations/openbanking/contracts/transactions.js.map +1 -1
- package/dist/libs/contracts/dist/knowledge/contracts.js +1 -1
- package/dist/libs/contracts/dist/knowledge/contracts.js.map +1 -1
- package/dist/libs/contracts/dist/llm/exporters.js.map +1 -1
- package/dist/libs/contracts/dist/onboarding-base.js +1 -1
- package/dist/libs/contracts/dist/onboarding-base.js.map +1 -1
- package/dist/libs/contracts/dist/{spec.js → operation.js} +2 -2
- package/dist/libs/contracts/dist/operation.js.map +1 -0
- package/dist/libs/contracts/dist/presentations.js +1 -0
- package/dist/libs/contracts/dist/registry-utils.js +24 -0
- package/dist/libs/contracts/dist/registry-utils.js.map +1 -0
- package/dist/libs/contracts/dist/registry.js +1 -0
- package/dist/libs/contracts/dist/workflow/index.js +1 -0
- package/dist/libs/contracts/dist/workflow/spec.js +1 -0
- package/dist/libs/contracts/dist/workspace-config/contractsrc-schema.js +122 -0
- package/dist/libs/contracts/dist/workspace-config/contractsrc-schema.js.map +1 -0
- package/dist/libs/contracts/dist/workspace-config/index.js +1 -0
- package/package.json +5 -5
- package/dist/libs/contracts/dist/spec.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rolldown_runtime.js","names":[],"sources":["../../../../../../../libs/contracts/dist/_virtual/rolldown_runtime.js"],"sourcesContent":["//#region rolldown:runtime\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);\nvar __export = (all, symbols) => {\n\tlet target = {};\n\tfor (var name in all) {\n\t\t__defProp(target, name, {\n\t\t\tget: all[name],\n\t\t\tenumerable: true\n\t\t});\n\t}\n\tif (symbols) {\n\t\t__defProp(target, Symbol.toStringTag, { value: \"Module\" });\n\t}\n\treturn target;\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") {\n\t\tfor (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {\n\t\t\tkey = keys[i];\n\t\t\tif (!__hasOwnProp.call(to, key) && key !== except) {\n\t\t\t\t__defProp(to, key, {\n\t\t\t\t\tget: ((k) => from[k]).bind(null, key),\n\t\t\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t}\n\treturn to;\n};\nvar __toCommonJS = (mod) => __hasOwnProp.call(mod, \"module.exports\") ? mod[\"module.exports\"] : __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\n\n//#endregion\nexport { __esmMin, __export, __toCommonJS };"],"mappings":";AAKA,IAAI,YAAY,IAAI,eAAe,OAAO,MAAM,GAAG,KAAK,EAAE,GAAG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./registry-utils.js";
|
|
@@ -3,8 +3,8 @@ import { registerDocBlocks } from "../../registry.js";
|
|
|
3
3
|
//#region ../../libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js
|
|
4
4
|
const tech_contracts_openapi_export_DocBlocks = [{
|
|
5
5
|
id: "docs.tech.contracts.openapi-export",
|
|
6
|
-
title: "OpenAPI export (OpenAPI 3.1) from
|
|
7
|
-
summary: "Generate a deterministic OpenAPI document from a
|
|
6
|
+
title: "OpenAPI export (OpenAPI 3.1) from OperationSpecRegistry",
|
|
7
|
+
summary: "Generate a deterministic OpenAPI document from a OperationSpecRegistry using jsonSchemaForSpec + REST transport metadata.",
|
|
8
8
|
kind: "reference",
|
|
9
9
|
visibility: "public",
|
|
10
10
|
route: "/docs/tech/contracts/openapi-export",
|
|
@@ -13,7 +13,7 @@ const tech_contracts_openapi_export_DocBlocks = [{
|
|
|
13
13
|
"openapi",
|
|
14
14
|
"rest"
|
|
15
15
|
],
|
|
16
|
-
body: `## OpenAPI export (OpenAPI 3.1) from
|
|
16
|
+
body: `## OpenAPI export (OpenAPI 3.1) from OperationSpecRegistry
|
|
17
17
|
|
|
18
18
|
### Purpose
|
|
19
19
|
|
|
@@ -42,9 +42,9 @@ contractspec openapi --registry ./src/registry.ts --out ./openapi.json
|
|
|
42
42
|
|
|
43
43
|
The registry module must export one of:
|
|
44
44
|
|
|
45
|
-
- \`registry:
|
|
46
|
-
- \`default():
|
|
47
|
-
- \`createRegistry():
|
|
45
|
+
- \`registry: OperationSpecRegistry\`
|
|
46
|
+
- \`default(): OperationSpecRegistry | Promise<OperationSpecRegistry>\`
|
|
47
|
+
- \`createRegistry(): OperationSpecRegistry | Promise<OperationSpecRegistry>\`
|
|
48
48
|
|
|
49
49
|
### Notes / limitations (current)
|
|
50
50
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi-export.docblock.js","names":[],"sources":["../../../../../../../../../libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js"],"sourcesContent":["import { registerDocBlocks } from \"../../registry.js\";\n\n//#region src/docs/tech/contracts/openapi-export.docblock.ts\nconst tech_contracts_openapi_export_DocBlocks = [{\n\tid: \"docs.tech.contracts.openapi-export\",\n\ttitle: \"OpenAPI export (OpenAPI 3.1) from
|
|
1
|
+
{"version":3,"file":"openapi-export.docblock.js","names":[],"sources":["../../../../../../../../../libs/contracts/dist/docs/tech/contracts/openapi-export.docblock.js"],"sourcesContent":["import { registerDocBlocks } from \"../../registry.js\";\n\n//#region src/docs/tech/contracts/openapi-export.docblock.ts\nconst tech_contracts_openapi_export_DocBlocks = [{\n\tid: \"docs.tech.contracts.openapi-export\",\n\ttitle: \"OpenAPI export (OpenAPI 3.1) from OperationSpecRegistry\",\n\tsummary: \"Generate a deterministic OpenAPI document from a OperationSpecRegistry using jsonSchemaForSpec + REST transport metadata.\",\n\tkind: \"reference\",\n\tvisibility: \"public\",\n\troute: \"/docs/tech/contracts/openapi-export\",\n\ttags: [\n\t\t\"contracts\",\n\t\t\"openapi\",\n\t\t\"rest\"\n\t],\n\tbody: `## OpenAPI export (OpenAPI 3.1) from OperationSpecRegistry\n\n### Purpose\n\nContractSpec specs can be exported into an **OpenAPI 3.1** document for tooling (SDK generation, docs, gateways).\n\nThe export is **spec-first**:\n\n- Uses \\`jsonSchemaForSpec(spec)\\` for input/output JSON Schema (from SchemaModel → zod → JSON Schema)\n- Uses \\`spec.transport.rest.method/path\\` when present\n- Falls back to deterministic defaults:\n - Method: \\`POST\\` for commands, \\`GET\\` for queries\n - Path: \\`defaultRestPath(name, version)\\` → \\`/<dot/name>/v<version>\\`\n\n### Library API\n\n- Function: \\`openApiForRegistry(registry, options?)\\`\n- Location: \\`@lssm/lib.contracts/openapi\\`\n\n### CLI\n\nExport OpenAPI from a registry module:\n\n\\`\\`\\`bash\ncontractspec openapi --registry ./src/registry.ts --out ./openapi.json\n\\`\\`\\`\n\nThe registry module must export one of:\n\n- \\`registry: OperationSpecRegistry\\`\n- \\`default(): OperationSpecRegistry | Promise<OperationSpecRegistry>\\`\n- \\`createRegistry(): OperationSpecRegistry | Promise<OperationSpecRegistry>\\`\n\n### Notes / limitations (current)\n\n- Responses are generated as a basic \\`200\\` response (plus schemas when available).\n- Query (GET) inputs are currently represented as a JSON request body when an input schema exists.\n- Errors are not yet expanded into OpenAPI responses; that will be added when we standardize error envelopes.`\n}];\nregisterDocBlocks(tech_contracts_openapi_export_DocBlocks);\n\n//#endregion\nexport { tech_contracts_openapi_export_DocBlocks };"],"mappings":";;;AAGA,MAAM,0CAA0C,CAAC;CAChD,IAAI;CACJ,OAAO;CACP,SAAS;CACT,MAAM;CACN,YAAY;CACZ,OAAO;CACP,MAAM;EACL;EACA;EACA;EACA;CACD,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCN,CAAC;AACF,kBAAkB,wCAAwC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./registry-utils.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./registry-utils.js";
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { GroupingStrategies, init_registry_utils } from "./registry-utils.js";
|
|
2
|
+
import "./data-views.js";
|
|
1
3
|
import "./schema/dist/index.js";
|
|
2
4
|
import { defineEvent } from "./events.js";
|
|
5
|
+
import "./features.js";
|
|
6
|
+
import "./forms.js";
|
|
3
7
|
import "./presentations.v2.js";
|
|
4
8
|
import "./client/react/feature-render.js";
|
|
5
9
|
import "./client/react/form-render.js";
|
|
@@ -14,7 +18,7 @@ import "./server/rest-express.js";
|
|
|
14
18
|
import "./server/rest-next-app.js";
|
|
15
19
|
import "./server/rest-next-pages.js";
|
|
16
20
|
import "./server/index.js";
|
|
17
|
-
import { defineCommand, defineQuery } from "./
|
|
21
|
+
import { defineCommand, defineQuery } from "./operation.js";
|
|
18
22
|
import { docBlockToPresentationSpec, docBlockToPresentationV2, docBlocksToPresentationRoutes } from "./docs/presentations.js";
|
|
19
23
|
import { DocRegistry, defaultDocRegistry, registerDocBlocks } from "./docs/registry.js";
|
|
20
24
|
import "./registry.js";
|
|
@@ -62,6 +66,9 @@ import "./integrations/contracts.js";
|
|
|
62
66
|
import "./knowledge/contracts.js";
|
|
63
67
|
import "./regenerator/service.js";
|
|
64
68
|
import "./regenerator/index.js";
|
|
69
|
+
import { FolderConventionsSchema, OpenApiConfigSchema, OpenApiExportConfigSchema, OpenApiSourceConfigSchema } from "./workspace-config/contractsrc-schema.js";
|
|
70
|
+
import "./workspace-config/index.js";
|
|
71
|
+
import "./workflow/spec.js";
|
|
65
72
|
import "./workflow/runner.js";
|
|
66
73
|
import "./workflow/index.js";
|
|
67
74
|
import { techContractsDocs } from "./docs/tech-contracts.docs.js";
|
|
@@ -70,3 +77,9 @@ import "./docs/index.js";
|
|
|
70
77
|
import "./llm/exporters.js";
|
|
71
78
|
import "./llm/prompts.js";
|
|
72
79
|
import "./llm/index.js";
|
|
80
|
+
|
|
81
|
+
//#region ../../libs/contracts/dist/index.js
|
|
82
|
+
init_registry_utils();
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../libs/contracts/dist/index.js"],"sourcesContent":["import { CapabilityRegistry, capabilityKey, defineCapability } from \"./capabilities.js\";\nimport { GroupingStrategies, filterBy, getUniqueDomains, getUniqueOwners, getUniqueTags, groupBy, groupByMultiple, groupByToArray, init_registry_utils } from \"./registry-utils.js\";\nimport { DataViewRegistry, dataViewKey } from \"./data-views.js\";\nimport { K5 } from \"./schema/dist/index.js\";\nimport { defineEvent, eventKey } from \"./events.js\";\nimport { FeatureRegistry, installFeature, validateFeatureTargetsV2 } from \"./features.js\";\nimport { FormRegistry, buildZodWithRelations, defineFormSpec, evalPredicate } from \"./forms.js\";\nimport { schemaToMarkdown, schemaToMarkdownDetail, schemaToMarkdownList, schemaToMarkdownSummary, schemaToMarkdownTable } from \"./schema-to-markdown.js\";\nimport { TransformEngine, createDefaultTransformEngine, registerBasicValidation, registerDefaultReactRenderer, registerReactToMarkdownRenderer } from \"./presentations.v2.js\";\nimport { createEngineWithDefaults, createFeatureModule, registerFeature, renderFeaturePresentation } from \"./client/react/feature-render.js\";\nimport { createFormRenderer } from \"./client/react/form-render.js\";\nimport { shadcnDriver } from \"./client/react/drivers/shadcn.js\";\nimport { rnReusablesDriver } from \"./client/react/drivers/rn-reusables.js\";\nimport \"./client/index.js\";\nimport { defaultGqlField, defaultMcpTool, defaultRestPath, jsonSchemaForSpec } from \"./jsonschema.js\";\nimport { registerContractsOnBuilder } from \"./server/graphql-pothos.js\";\nimport { PresentationRegistry, jsonSchemaForPresentation } from \"./presentations.js\";\nimport { createMcpServer } from \"./server/mcp/createMcpServer.js\";\nimport { createFetchHandler } from \"./server/rest-generic.js\";\nimport { elysiaPlugin } from \"./server/rest-elysia.js\";\nimport { expressRouter } from \"./server/rest-express.js\";\nimport { makeNextAppHandler } from \"./server/rest-next-app.js\";\nimport { makeNextPagesHandler } from \"./server/rest-next-pages.js\";\nimport \"./server/index.js\";\nimport { defineCommand, defineQuery, isEmitDeclRef } from \"./operation.js\";\nimport { docBlockToPresentationSpec, docBlockToPresentationV2, docBlocksToPresentationRoutes, docBlocksToPresentationSpecs, mapDocRoutes } from \"./docs/presentations.js\";\nimport { DocRegistry, defaultDocRegistry, docId, listRegisteredDocBlocks, registerDocBlocks } from \"./docs/registry.js\";\nimport { OperationSpecRegistry, opKey } from \"./registry.js\";\nimport { Owners, OwnersEnum, StabilityEnum, Tags, TagsEnum } from \"./ownership.js\";\nimport { ContractRegistryFileSchema, ContractRegistryItemSchema, ContractRegistryItemTypeSchema, ContractRegistryManifestSchema } from \"./contract-registry/schemas.js\";\nimport \"./contract-registry/index.js\";\nimport { installOp, makeEmit, op } from \"./install.js\";\nimport { openApiForRegistry } from \"./openapi.js\";\nimport { definePrompt } from \"./prompt.js\";\nimport { PromptRegistry } from \"./promptRegistry.js\";\nimport { ResourceRegistry, defineResourceTemplate, isResourceRef, resourceRef } from \"./resources.js\";\nimport { CompleteOnboardingBaseInput, CompleteOnboardingBaseOutput, CompleteOnboardingBaseSpec, DeleteOnboardingDraftBaseSpec, DeleteOnboardingDraftOutput, GetOnboardingDraftBaseSpec, GetOnboardingDraftOutput, SaveOnboardingDraftBaseSpec, SaveOnboardingDraftInput, SaveOnboardingDraftOutput } from \"./onboarding-base.js\";\nimport { openBankingAccountsReadCapability, openBankingBalancesReadCapability, openBankingTransactionsReadCapability, registerOpenBankingCapabilities } from \"./capabilities/openbanking.js\";\nimport { PolicyRegistry, makePolicyKey } from \"./policy/spec.js\";\nimport { PolicyEngine } from \"./policy/engine.js\";\nimport { OPAPolicyAdapter, buildOPAInput } from \"./policy/opa-adapter.js\";\nimport { ThemeRegistry, makeThemeRef } from \"./themes.js\";\nimport { MigrationRegistry } from \"./migrations.js\";\nimport { TelemetryRegistry, makeTelemetryKey } from \"./telemetry/spec.js\";\nimport { TelemetryTracker } from \"./telemetry/tracker.js\";\nimport { TelemetryAnomalyMonitor } from \"./telemetry/anomaly.js\";\nimport \"./telemetry/index.js\";\nimport { TestRegistry, makeTestKey } from \"./tests/spec.js\";\nimport { TestRunner } from \"./tests/runner.js\";\nimport \"./tests/index.js\";\nimport { ExperimentRegistry, makeExperimentKey } from \"./experiments/spec.js\";\nimport { ExperimentEvaluator } from \"./experiments/evaluator.js\";\nimport { AppBlueprintRegistry, makeAppBlueprintKey } from \"./app-config/spec.js\";\nimport { composeAppConfig, resolveAppConfig } from \"./app-config/runtime.js\";\nimport { IntegrationSpecRegistry, makeIntegrationSpecKey } from \"./integrations/spec.js\";\nimport { registerStripeIntegration, stripeIntegrationSpec } from \"./integrations/providers/stripe.js\";\nimport { postmarkIntegrationSpec, registerPostmarkIntegration } from \"./integrations/providers/postmark.js\";\nimport { qdrantIntegrationSpec, registerQdrantIntegration } from \"./integrations/providers/qdrant.js\";\nimport { mistralIntegrationSpec, registerMistralIntegration } from \"./integrations/providers/mistral.js\";\nimport { elevenLabsIntegrationSpec, registerElevenLabsIntegration } from \"./integrations/providers/elevenlabs.js\";\nimport { gmailIntegrationSpec, registerGmailIntegration } from \"./integrations/providers/gmail.js\";\nimport { googleCalendarIntegrationSpec, registerGoogleCalendarIntegration } from \"./integrations/providers/google-calendar.js\";\nimport { registerTwilioSmsIntegration, twilioSmsIntegrationSpec } from \"./integrations/providers/twilio-sms.js\";\nimport { gcsStorageIntegrationSpec, registerGcsStorageIntegration } from \"./integrations/providers/gcs-storage.js\";\nimport { powensIntegrationSpec, registerPowensIntegration } from \"./integrations/providers/powens.js\";\nimport { createDefaultIntegrationSpecRegistry } from \"./integrations/providers/registry.js\";\nimport { AccountBalanceRecord, BankAccountRecord, BankTransactionRecord } from \"./integrations/openbanking/models.js\";\nimport { OPENBANKING_PII_FIELDS, OPENBANKING_TELEMETRY_EVENTS, redactOpenBankingTelemetryPayload } from \"./integrations/openbanking/telemetry.js\";\nimport { OpenBankingGetAccount, OpenBankingListAccounts, OpenBankingSyncAccounts } from \"./integrations/openbanking/contracts/accounts.js\";\nimport { OpenBankingListTransactions, OpenBankingSyncTransactions } from \"./integrations/openbanking/contracts/transactions.js\";\nimport { OpenBankingGetBalances, OpenBankingRefreshBalances } from \"./integrations/openbanking/contracts/balances.js\";\nimport { OpenBankingFeature } from \"./integrations/openbanking/openbanking.feature.js\";\nimport { registerOpenBankingContracts } from \"./integrations/openbanking/contracts/index.js\";\nimport { assertPrimaryOpenBankingReady, ensurePrimaryOpenBankingIntegration } from \"./integrations/openbanking/guards.js\";\nimport \"./integrations/index.js\";\nimport { KnowledgeSpaceRegistry, makeKnowledgeSpaceKey } from \"./knowledge/spec.js\";\nimport { productCanonKnowledgeSpace, registerProductCanonKnowledgeSpace } from \"./knowledge/spaces/product-canon.js\";\nimport { registerSupportFaqKnowledgeSpace, supportFaqKnowledgeSpace } from \"./knowledge/spaces/support-faq.js\";\nimport { emailThreadsKnowledgeSpace, registerEmailThreadsKnowledgeSpace } from \"./knowledge/spaces/email-threads.js\";\nimport { registerUploadedDocsKnowledgeSpace, uploadedDocsKnowledgeSpace } from \"./knowledge/spaces/uploaded-docs.js\";\nimport { financialDocsKnowledgeSpace, registerFinancialDocsKnowledgeSpace } from \"./knowledge/spaces/financial-docs.js\";\nimport { financialOverviewKnowledgeSpace, registerFinancialOverviewKnowledgeSpace } from \"./knowledge/spaces/financial-overview.js\";\nimport \"./knowledge/index.js\";\nimport { CreateIntegrationConnection, DeleteIntegrationConnection, ListIntegrationConnections, TestIntegrationConnection, UpdateIntegrationConnection, integrationContracts, registerIntegrationContracts } from \"./integrations/contracts.js\";\nimport { CreateKnowledgeSource, DeleteKnowledgeSource, ListKnowledgeSources, TriggerKnowledgeSourceSync, UpdateKnowledgeSource, knowledgeContracts, registerKnowledgeContracts } from \"./knowledge/contracts.js\";\nimport { behaviorToEnvelope, errorToEnvelope, telemetryToEnvelope } from \"./regenerator/utils.js\";\nimport { RegeneratorService } from \"./regenerator/service.js\";\nimport { ProposalExecutor } from \"./regenerator/executor.js\";\nimport { ExecutorProposalSink } from \"./regenerator/sinks.js\";\nimport \"./regenerator/index.js\";\nimport { ContractsrcSchema, DEFAULT_CONTRACTSRC, FolderConventionsSchema, OpenApiConfigSchema, OpenApiExportConfigSchema, OpenApiSourceConfigSchema } from \"./workspace-config/contractsrc-schema.js\";\nimport \"./workspace-config/index.js\";\nimport { WorkflowRegistry } from \"./workflow/spec.js\";\nimport { WorkflowValidationError, assertWorkflowSpecValid, validateWorkflowSpec } from \"./workflow/validation.js\";\nimport { evaluateExpression } from \"./workflow/expression.js\";\nimport { WorkflowPreFlightError, WorkflowRunner } from \"./workflow/runner.js\";\nimport { InMemoryStateStore } from \"./workflow/adapters/memory-store.js\";\nimport { PrismaStateStore } from \"./workflow/adapters/db-adapter.js\";\nimport { createFileStateStore } from \"./workflow/adapters/file-adapter.js\";\nimport \"./workflow/index.js\";\nimport { techContractsDocs } from \"./docs/tech-contracts.docs.js\";\nimport { metaDocs } from \"./docs/meta.docs.js\";\nimport \"./docs/index.js\";\nimport { docBlockToMarkdown, eventToMarkdown, exportFeature, exportSpec, featureToMarkdown, presentationToMarkdown, specToAgentPrompt, specToContextMarkdown, specToFullMarkdown } from \"./llm/exporters.js\";\nimport { AGENT_SYSTEM_PROMPTS, formatPlanForAgent, generateFixViolationsPrompt, generateImplementationPlan, generateImplementationPrompt, generateReviewPrompt, generateTestPrompt, generateVerificationPrompt } from \"./llm/prompts.js\";\nimport \"./llm/index.js\";\n\n//#region src/index.ts\ninit_registry_utils();\n\n//#endregion\nexport { AGENT_SYSTEM_PROMPTS, AccountBalanceRecord, AppBlueprintRegistry, BankAccountRecord, BankTransactionRecord, CapabilityRegistry, CompleteOnboardingBaseInput, CompleteOnboardingBaseOutput, CompleteOnboardingBaseSpec, ContractRegistryFileSchema, ContractRegistryItemSchema, ContractRegistryItemTypeSchema, ContractRegistryManifestSchema, ContractsrcSchema, CreateIntegrationConnection, CreateKnowledgeSource, DEFAULT_CONTRACTSRC, DataViewRegistry, DeleteIntegrationConnection, DeleteKnowledgeSource, DeleteOnboardingDraftBaseSpec, DeleteOnboardingDraftOutput, DocRegistry, ExecutorProposalSink, ExperimentEvaluator, ExperimentRegistry, FeatureRegistry, FolderConventionsSchema, FormRegistry, GetOnboardingDraftBaseSpec, GetOnboardingDraftOutput, GroupingStrategies, InMemoryStateStore, IntegrationSpecRegistry, KnowledgeSpaceRegistry, ListIntegrationConnections, ListKnowledgeSources, MigrationRegistry, OPAPolicyAdapter, OPENBANKING_PII_FIELDS, OPENBANKING_TELEMETRY_EVENTS, OpenApiConfigSchema, OpenApiExportConfigSchema, OpenApiSourceConfigSchema, OpenBankingFeature, OpenBankingGetAccount, OpenBankingGetBalances, OpenBankingListAccounts, OpenBankingListTransactions, OpenBankingRefreshBalances, OpenBankingSyncAccounts, OpenBankingSyncTransactions, OperationSpecRegistry, Owners, OwnersEnum, PolicyEngine, PolicyRegistry, PresentationRegistry, PrismaStateStore, PromptRegistry, ProposalExecutor, RegeneratorService, ResourceRegistry, SaveOnboardingDraftBaseSpec, SaveOnboardingDraftInput, SaveOnboardingDraftOutput, StabilityEnum, Tags, TagsEnum, TelemetryAnomalyMonitor, TelemetryRegistry, TelemetryTracker, TestIntegrationConnection, TestRegistry, TestRunner, ThemeRegistry, TransformEngine, TriggerKnowledgeSourceSync, UpdateIntegrationConnection, UpdateKnowledgeSource, WorkflowPreFlightError, WorkflowRegistry, WorkflowRunner, WorkflowValidationError, assertPrimaryOpenBankingReady, assertWorkflowSpecValid, behaviorToEnvelope, buildOPAInput, buildZodWithRelations, capabilityKey, composeAppConfig, createDefaultIntegrationSpecRegistry, createDefaultTransformEngine, createEngineWithDefaults, createFeatureModule, createFetchHandler, createFileStateStore, createFormRenderer, createMcpServer, dataViewKey, defaultDocRegistry, defaultGqlField, defaultMcpTool, defaultRestPath, defineCapability, defineCommand, defineEvent, defineFormSpec, definePrompt, defineQuery, defineResourceTemplate, K5 as defineSchemaModel, docBlockToMarkdown, docBlockToPresentationSpec, docBlockToPresentationV2, docBlocksToPresentationRoutes, docBlocksToPresentationSpecs, docId, elevenLabsIntegrationSpec, elysiaPlugin, emailThreadsKnowledgeSpace, ensurePrimaryOpenBankingIntegration, errorToEnvelope, evalPredicate, evaluateExpression, eventKey, eventToMarkdown, exportFeature, exportSpec, expressRouter, featureToMarkdown, filterBy, financialDocsKnowledgeSpace, financialOverviewKnowledgeSpace, formatPlanForAgent, gcsStorageIntegrationSpec, generateFixViolationsPrompt, generateImplementationPlan, generateImplementationPrompt, generateReviewPrompt, generateTestPrompt, generateVerificationPrompt, getUniqueDomains, getUniqueOwners, getUniqueTags, gmailIntegrationSpec, googleCalendarIntegrationSpec, groupBy, groupByMultiple, groupByToArray, installFeature, installOp, integrationContracts, isEmitDeclRef, isResourceRef, jsonSchemaForPresentation, jsonSchemaForSpec, knowledgeContracts, listRegisteredDocBlocks, makeAppBlueprintKey, makeEmit, makeExperimentKey, makeIntegrationSpecKey, makeKnowledgeSpaceKey, makeNextAppHandler, makeNextPagesHandler, makePolicyKey, makeTelemetryKey, makeTestKey, makeThemeRef, mapDocRoutes, metaDocs, mistralIntegrationSpec, op, opKey, openApiForRegistry, openBankingAccountsReadCapability, openBankingBalancesReadCapability, openBankingTransactionsReadCapability, postmarkIntegrationSpec, powensIntegrationSpec, presentationToMarkdown, productCanonKnowledgeSpace, qdrantIntegrationSpec, redactOpenBankingTelemetryPayload, registerBasicValidation, registerContractsOnBuilder, registerDefaultReactRenderer, registerDocBlocks, registerElevenLabsIntegration, registerEmailThreadsKnowledgeSpace, registerFeature, registerFinancialDocsKnowledgeSpace, registerFinancialOverviewKnowledgeSpace, registerGcsStorageIntegration, registerGmailIntegration, registerGoogleCalendarIntegration, registerIntegrationContracts, registerKnowledgeContracts, registerMistralIntegration, registerOpenBankingCapabilities, registerOpenBankingContracts, registerPostmarkIntegration, registerPowensIntegration, registerProductCanonKnowledgeSpace, registerQdrantIntegration, registerReactToMarkdownRenderer, registerStripeIntegration, registerSupportFaqKnowledgeSpace, registerTwilioSmsIntegration, registerUploadedDocsKnowledgeSpace, renderFeaturePresentation, resolveAppConfig, resourceRef, rnReusablesDriver, schemaToMarkdown, schemaToMarkdownDetail, schemaToMarkdownList, schemaToMarkdownSummary, schemaToMarkdownTable, shadcnDriver, specToAgentPrompt, specToContextMarkdown, specToFullMarkdown, stripeIntegrationSpec, supportFaqKnowledgeSpace, techContractsDocs, telemetryToEnvelope, twilioSmsIntegrationSpec, uploadedDocsKnowledgeSpace, validateFeatureTargetsV2, validateWorkflowSpec };"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4GA,qBAAqB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E5, x8 } from "../schema/dist/index.js";
|
|
2
|
-
import { defineCommand, defineQuery } from "../
|
|
2
|
+
import { defineCommand, defineQuery } from "../operation.js";
|
|
3
3
|
|
|
4
4
|
//#region ../../libs/contracts/dist/integrations/contracts.js
|
|
5
5
|
const IntegrationConnectionRecord = new x8({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","names":[],"sources":["../../../../../../../libs/contracts/dist/integrations/contracts.js"],"sourcesContent":["import { E5, x8 } from \"../schema/dist/index.js\";\nimport { defineCommand, defineQuery } from \"../spec.js\";\n\n//#region src/integrations/contracts.ts\nconst IntegrationConnectionRecord = new x8({\n\tname: \"IntegrationConnectionRecord\",\n\tfields: {\n\t\tid: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tintegrationKey: {\n\t\t\ttype: E5.NonEmptyString(),\n\t\t\tisOptional: false\n\t\t},\n\t\tintegrationVersion: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tlabel: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\townershipMode: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\texternalAccountId: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tsecretProvider: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tsecretRef: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tstatus: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tenvironment: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\thealthStatus: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\thealthCheckedAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\thealthLatencyMs: {\n\t\t\ttype: E5.Float_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\thealthErrorCode: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\thealthErrorMessage: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tusageRequestCount: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tusageSuccessCount: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tusageErrorCount: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tusageLastUsedAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\tusageLastErrorAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\tusageLastErrorCode: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tcreatedAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\tupdatedAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst CreateIntegrationConnectionInput = new x8({\n\tname: \"CreateIntegrationConnectionInput\",\n\tfields: {\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tintegrationKey: {\n\t\t\ttype: E5.NonEmptyString(),\n\t\t\tisOptional: false\n\t\t},\n\t\tintegrationVersion: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tlabel: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\townershipMode: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\texternalAccountId: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tsecretProvider: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tsecretRef: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tenvironment: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tconfig: {\n\t\t\ttype: E5.JSONObject(),\n\t\t\tisOptional: false\n\t\t}\n\t}\n});\nconst UpdateIntegrationConnectionInput = new x8({\n\tname: \"UpdateIntegrationConnectionInput\",\n\tfields: {\n\t\tconnectionId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tlabel: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tstatus: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\townershipMode: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\texternalAccountId: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tsecretProvider: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tsecretRef: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tconfig: {\n\t\t\ttype: E5.JSONObject(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst DeleteIntegrationConnectionInput = new x8({\n\tname: \"DeleteIntegrationConnectionInput\",\n\tfields: { connectionId: {\n\t\ttype: E5.ID(),\n\t\tisOptional: false\n\t} }\n});\nconst ListIntegrationConnectionsInput = new x8({\n\tname: \"ListIntegrationConnectionsInput\",\n\tfields: {\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tcategory: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tstatus: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst ListIntegrationConnectionsOutput = new x8({\n\tname: \"ListIntegrationConnectionsOutput\",\n\tfields: { connections: {\n\t\ttype: IntegrationConnectionRecord,\n\t\tisOptional: false,\n\t\tisArray: true\n\t} }\n});\nconst TestIntegrationConnectionInput = new x8({\n\tname: \"TestIntegrationConnectionInput\",\n\tfields: { connectionId: {\n\t\ttype: E5.ID(),\n\t\tisOptional: false\n\t} }\n});\nconst TestIntegrationConnectionOutput = new x8({\n\tname: \"TestIntegrationConnectionOutput\",\n\tfields: {\n\t\tsuccess: {\n\t\t\ttype: E5.Boolean(),\n\t\t\tisOptional: false\n\t\t},\n\t\tstatus: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tlatencyMs: {\n\t\t\ttype: E5.Float_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\terror: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\terrorCode: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst DeleteIntegrationConnectionOutput = new x8({\n\tname: \"DeleteIntegrationConnectionOutput\",\n\tfields: { success: {\n\t\ttype: E5.Boolean(),\n\t\tisOptional: false\n\t} }\n});\nconst CreateIntegrationConnection = defineCommand({\n\tmeta: {\n\t\tname: \"integrations.connection.create\",\n\t\tversion: 1,\n\t\tdescription: \"Create a new integration connection for a tenant.\",\n\t\tgoal: \"Provision a tenant-scoped connection to an external provider.\",\n\t\tcontext: \"Used by Ops or the App Studio to configure external integrations such as Stripe or Qdrant.\",\n\t\towners: [\"platform.integrations\"],\n\t\ttags: [\"integration\", \"connections\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: CreateIntegrationConnectionInput,\n\t\toutput: IntegrationConnectionRecord\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.integration.manage\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst UpdateIntegrationConnection = defineCommand({\n\tmeta: {\n\t\tname: \"integrations.connection.update\",\n\t\tversion: 1,\n\t\tdescription: \"Update metadata or credentials for an integration connection.\",\n\t\tgoal: \"Allow secure rotation of credentials and metadata adjustments.\",\n\t\tcontext: \"Supports rotating API keys, toggling status, or updating labels for tenant integrations.\",\n\t\towners: [\"platform.integrations\"],\n\t\ttags: [\"integration\", \"connections\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: UpdateIntegrationConnectionInput,\n\t\toutput: IntegrationConnectionRecord\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.integration.manage\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst DeleteIntegrationConnection = defineCommand({\n\tmeta: {\n\t\tname: \"integrations.connection.delete\",\n\t\tversion: 1,\n\t\tdescription: \"Delete an integration connection for a tenant.\",\n\t\tgoal: \"Safely remove credentials and disable connector usage.\",\n\t\tcontext: \"Ensures connections are de-provisioned when no longer needed or breached.\",\n\t\towners: [\"platform.integrations\"],\n\t\ttags: [\"integration\", \"connections\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: DeleteIntegrationConnectionInput,\n\t\toutput: DeleteIntegrationConnectionOutput\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.integration.manage\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst ListIntegrationConnections = defineQuery({\n\tmeta: {\n\t\tname: \"integrations.connection.list\",\n\t\tversion: 1,\n\t\tdescription: \"List integration connections for a tenant.\",\n\t\tgoal: \"Provide visibility into configured integrations and their status.\",\n\t\tcontext: \"Used by the App Studio and Ops flows to show bindings and health.\",\n\t\towners: [\"platform.integrations\"],\n\t\ttags: [\"integration\", \"connections\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: ListIntegrationConnectionsInput,\n\t\toutput: ListIntegrationConnectionsOutput\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.integration.read\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst TestIntegrationConnection = defineCommand({\n\tmeta: {\n\t\tname: \"integrations.connection.test\",\n\t\tversion: 1,\n\t\tdescription: \"Run a health check against a configured integration connection.\",\n\t\tgoal: \"Validate credentials and connectivity for external providers.\",\n\t\tcontext: \"Triggered manually or by background monitors to confirm provider availability.\",\n\t\towners: [\"platform.integrations\"],\n\t\ttags: [\"integration\", \"connections\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: TestIntegrationConnectionInput,\n\t\toutput: TestIntegrationConnectionOutput\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.integration.manage\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst integrationContracts = {\n\tCreateIntegrationConnection,\n\tUpdateIntegrationConnection,\n\tDeleteIntegrationConnection,\n\tListIntegrationConnections,\n\tTestIntegrationConnection\n};\nfunction registerIntegrationContracts(registry) {\n\treturn registry.register(CreateIntegrationConnection).register(UpdateIntegrationConnection).register(DeleteIntegrationConnection).register(ListIntegrationConnections).register(TestIntegrationConnection);\n}\n\n//#endregion\nexport { CreateIntegrationConnection, DeleteIntegrationConnection, ListIntegrationConnections, TestIntegrationConnection, UpdateIntegrationConnection, integrationContracts, registerIntegrationContracts };"],"mappings":";;;;AAIA,MAAM,8BAA8B,IAAI,GAAG;CAC1C,MAAM;CACN,QAAQ;EACP,IAAI;GACH,MAAM,GAAG,IAAI;GACb,YAAY;GACZ;EACD,UAAU;GACT,MAAM,GAAG,IAAI;GACb,YAAY;GACZ;EACD,gBAAgB;GACf,MAAM,GAAG,gBAAgB;GACzB,YAAY;GACZ;EACD,oBAAoB;GACnB,MAAM,GAAG,cAAc;GACvB,YAAY;GACZ;EACD,OAAO;GACN,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,eAAe;GACd,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,mBAAmB;GAClB,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,gBAAgB;GACf,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,WAAW;GACV,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,QAAQ;GACP,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,aAAa;GACZ,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,cAAc;GACb,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,iBAAiB;GAChB,MAAM,GAAG,UAAU;GACnB,YAAY;GACZ;EACD,iBAAiB;GAChB,MAAM,GAAG,gBAA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F,MAAM,6BAA6B,YAAY;CAC9C,MAAM;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ,CAAC,wBAAwB;EACjC,MAAM,CAAC,eAAe,cAAc;EACpC,WAAW;EACX;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ;EACP,MAAM;EACN,UAAU,CAAC;GACV,MAAM;GACN,SAAS;GACT,CAAC;EACF;CACD,CAAC;AACF,MAAM,4BAA4B,cAAc;CAC/C,MAAM;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ,CAAC,wBAAwB;EACjC,MAAM,CAAC,eAAe,cAAc;EACpC,WAAW;EACX;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ;EACP,MAAM;EACN,UAAU,CAAC;GACV,MAAM;GACN,SAAS;GACT,CAAC;EACF;CACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"contracts.js","names":[],"sources":["../../../../../../../libs/contracts/dist/integrations/contracts.js"],"sourcesContent":["import { E5, x8 } from \"../schema/dist/index.js\";\nimport { defineCommand, defineQuery } from \"../operation.js\";\n\n//#region src/integrations/contracts.ts\nconst IntegrationConnectionRecord = new x8({\n\tname: \"IntegrationConnectionRecord\",\n\tfields: {\n\t\tid: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tintegrationKey: {\n\t\t\ttype: E5.NonEmptyString(),\n\t\t\tisOptional: false\n\t\t},\n\t\tintegrationVersion: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tlabel: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\townershipMode: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\texternalAccountId: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tsecretProvider: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tsecretRef: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tstatus: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tenvironment: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\thealthStatus: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\thealthCheckedAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\thealthLatencyMs: {\n\t\t\ttype: E5.Float_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\thealthErrorCode: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\thealthErrorMessage: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tusageRequestCount: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tusageSuccessCount: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tusageErrorCount: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tusageLastUsedAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\tusageLastErrorAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\tusageLastErrorCode: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tcreatedAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\tupdatedAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst CreateIntegrationConnectionInput = new x8({\n\tname: \"CreateIntegrationConnectionInput\",\n\tfields: {\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tintegrationKey: {\n\t\t\ttype: E5.NonEmptyString(),\n\t\t\tisOptional: false\n\t\t},\n\t\tintegrationVersion: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tlabel: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\townershipMode: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\texternalAccountId: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tsecretProvider: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tsecretRef: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tenvironment: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tconfig: {\n\t\t\ttype: E5.JSONObject(),\n\t\t\tisOptional: false\n\t\t}\n\t}\n});\nconst UpdateIntegrationConnectionInput = new x8({\n\tname: \"UpdateIntegrationConnectionInput\",\n\tfields: {\n\t\tconnectionId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tlabel: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tstatus: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\townershipMode: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\texternalAccountId: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tsecretProvider: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tsecretRef: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tconfig: {\n\t\t\ttype: E5.JSONObject(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst DeleteIntegrationConnectionInput = new x8({\n\tname: \"DeleteIntegrationConnectionInput\",\n\tfields: { connectionId: {\n\t\ttype: E5.ID(),\n\t\tisOptional: false\n\t} }\n});\nconst ListIntegrationConnectionsInput = new x8({\n\tname: \"ListIntegrationConnectionsInput\",\n\tfields: {\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tcategory: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tstatus: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst ListIntegrationConnectionsOutput = new x8({\n\tname: \"ListIntegrationConnectionsOutput\",\n\tfields: { connections: {\n\t\ttype: IntegrationConnectionRecord,\n\t\tisOptional: false,\n\t\tisArray: true\n\t} }\n});\nconst TestIntegrationConnectionInput = new x8({\n\tname: \"TestIntegrationConnectionInput\",\n\tfields: { connectionId: {\n\t\ttype: E5.ID(),\n\t\tisOptional: false\n\t} }\n});\nconst TestIntegrationConnectionOutput = new x8({\n\tname: \"TestIntegrationConnectionOutput\",\n\tfields: {\n\t\tsuccess: {\n\t\t\ttype: E5.Boolean(),\n\t\t\tisOptional: false\n\t\t},\n\t\tstatus: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tlatencyMs: {\n\t\t\ttype: E5.Float_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\terror: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\terrorCode: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst DeleteIntegrationConnectionOutput = new x8({\n\tname: \"DeleteIntegrationConnectionOutput\",\n\tfields: { success: {\n\t\ttype: E5.Boolean(),\n\t\tisOptional: false\n\t} }\n});\nconst CreateIntegrationConnection = defineCommand({\n\tmeta: {\n\t\tname: \"integrations.connection.create\",\n\t\tversion: 1,\n\t\tdescription: \"Create a new integration connection for a tenant.\",\n\t\tgoal: \"Provision a tenant-scoped connection to an external provider.\",\n\t\tcontext: \"Used by Ops or the App Studio to configure external integrations such as Stripe or Qdrant.\",\n\t\towners: [\"platform.integrations\"],\n\t\ttags: [\"integration\", \"connections\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: CreateIntegrationConnectionInput,\n\t\toutput: IntegrationConnectionRecord\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.integration.manage\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst UpdateIntegrationConnection = defineCommand({\n\tmeta: {\n\t\tname: \"integrations.connection.update\",\n\t\tversion: 1,\n\t\tdescription: \"Update metadata or credentials for an integration connection.\",\n\t\tgoal: \"Allow secure rotation of credentials and metadata adjustments.\",\n\t\tcontext: \"Supports rotating API keys, toggling status, or updating labels for tenant integrations.\",\n\t\towners: [\"platform.integrations\"],\n\t\ttags: [\"integration\", \"connections\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: UpdateIntegrationConnectionInput,\n\t\toutput: IntegrationConnectionRecord\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.integration.manage\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst DeleteIntegrationConnection = defineCommand({\n\tmeta: {\n\t\tname: \"integrations.connection.delete\",\n\t\tversion: 1,\n\t\tdescription: \"Delete an integration connection for a tenant.\",\n\t\tgoal: \"Safely remove credentials and disable connector usage.\",\n\t\tcontext: \"Ensures connections are de-provisioned when no longer needed or breached.\",\n\t\towners: [\"platform.integrations\"],\n\t\ttags: [\"integration\", \"connections\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: DeleteIntegrationConnectionInput,\n\t\toutput: DeleteIntegrationConnectionOutput\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.integration.manage\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst ListIntegrationConnections = defineQuery({\n\tmeta: {\n\t\tname: \"integrations.connection.list\",\n\t\tversion: 1,\n\t\tdescription: \"List integration connections for a tenant.\",\n\t\tgoal: \"Provide visibility into configured integrations and their status.\",\n\t\tcontext: \"Used by the App Studio and Ops flows to show bindings and health.\",\n\t\towners: [\"platform.integrations\"],\n\t\ttags: [\"integration\", \"connections\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: ListIntegrationConnectionsInput,\n\t\toutput: ListIntegrationConnectionsOutput\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.integration.read\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst TestIntegrationConnection = defineCommand({\n\tmeta: {\n\t\tname: \"integrations.connection.test\",\n\t\tversion: 1,\n\t\tdescription: \"Run a health check against a configured integration connection.\",\n\t\tgoal: \"Validate credentials and connectivity for external providers.\",\n\t\tcontext: \"Triggered manually or by background monitors to confirm provider availability.\",\n\t\towners: [\"platform.integrations\"],\n\t\ttags: [\"integration\", \"connections\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: TestIntegrationConnectionInput,\n\t\toutput: TestIntegrationConnectionOutput\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.integration.manage\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst integrationContracts = {\n\tCreateIntegrationConnection,\n\tUpdateIntegrationConnection,\n\tDeleteIntegrationConnection,\n\tListIntegrationConnections,\n\tTestIntegrationConnection\n};\nfunction registerIntegrationContracts(registry) {\n\treturn registry.register(CreateIntegrationConnection).register(UpdateIntegrationConnection).register(DeleteIntegrationConnection).register(ListIntegrationConnections).register(TestIntegrationConnection);\n}\n\n//#endregion\nexport { CreateIntegrationConnection, DeleteIntegrationConnection, ListIntegrationConnections, TestIntegrationConnection, UpdateIntegrationConnection, integrationContracts, registerIntegrationContracts };"],"mappings":";;;;AAIA,MAAM,8BAA8B,IAAI,GAAG;CAC1C,MAAM;CACN,QAAQ;EACP,IAAI;GACH,MAAM,GAAG,IAAI;GACb,YAAY;GACZ;EACD,UAAU;GACT,MAAM,GAAG,IAAI;GACb,YAAY;GACZ;EACD,gBAAgB;GACf,MAAM,GAAG,gBAAgB;GACzB,YAAY;GACZ;EACD,oBAAoB;GACnB,MAAM,GAAG,cAAc;GACvB,YAAY;GACZ;EACD,OAAO;GACN,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,eAAe;GACd,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,mBAAmB;GAClB,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,gBAAgB;GACf,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,WAAW;GACV,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,QAAQ;GACP,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,aAAa;GACZ,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,cAAc;GACb,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,iBAAiB;GAChB,MAAM,GAAG,UAAU;GACnB,YAAY;GACZ;EACD,iBAAiB;GAChB,MAAM,GAAG,gBAAgB;GACzB,YAAY;GACZ;EACD,iBAAiB;GAChB,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,oBAAoB;GACnB,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,mBAAmB;GAClB,MAAM,GAAG,cAAc;GACvB,YAAY;GACZ;EACD,mBAAmB;GAClB,MAAM,GAAG,cA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,UAAU,CAAC;GACV,MAAM;GACN,SAAS;GACT,CAAC;EACF;CACD,CAAC;AACF,MAAM,4BAA4B,cAAc;CAC/C,MAAM;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ,CAAC,wBAAwB;EACjC,MAAM,CAAC,eAAe,cAAc;EACpC,WAAW;EACX;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ;EACP,MAAM;EACN,UAAU,CAAC;GACV,MAAM;GACN,SAAS;GACT,CAAC;EACF;CACD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E5, x8 } from "../../../schema/dist/index.js";
|
|
2
|
-
import { defineCommand, defineQuery } from "../../../
|
|
2
|
+
import { defineCommand, defineQuery } from "../../../operation.js";
|
|
3
3
|
import { BankAccountRecord } from "../models.js";
|
|
4
4
|
import { OPENBANKING_TELEMETRY_EVENTS } from "../telemetry.js";
|
|
5
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accounts.js","names":[],"sources":["../../../../../../../../../libs/contracts/dist/integrations/openbanking/contracts/accounts.js"],"sourcesContent":["import { E5, x8 } from \"../../../schema/dist/index.js\";\nimport { defineCommand, defineQuery } from \"../../../
|
|
1
|
+
{"version":3,"file":"accounts.js","names":[],"sources":["../../../../../../../../../libs/contracts/dist/integrations/openbanking/contracts/accounts.js"],"sourcesContent":["import { E5, x8 } from \"../../../schema/dist/index.js\";\nimport { defineCommand, defineQuery } from \"../../../operation.js\";\nimport { BankAccountRecord } from \"../models.js\";\nimport { OPENBANKING_TELEMETRY_EVENTS } from \"../telemetry.js\";\n\n//#region src/integrations/openbanking/contracts/accounts.ts\nconst OpenBankingListAccountsInput = new x8({\n\tname: \"OpenBankingListAccountsInput\",\n\tdescription: \"Parameters for listing bank accounts through the open banking provider.\",\n\tfields: {\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tuserId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tconnectionId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: true\n\t\t},\n\t\tincludeBalances: {\n\t\t\ttype: E5.Boolean(),\n\t\t\tisOptional: true\n\t\t},\n\t\tinstitutionId: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tcursor: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tpageSize: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst OpenBankingListAccountsOutput = new x8({\n\tname: \"OpenBankingListAccountsOutput\",\n\tdescription: \"Paginated list of bank accounts available to the tenant and user.\",\n\tfields: {\n\t\taccounts: {\n\t\t\ttype: BankAccountRecord,\n\t\t\tisOptional: false,\n\t\t\tisArray: true\n\t\t},\n\t\tnextCursor: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\thasMore: {\n\t\t\ttype: E5.Boolean(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst OpenBankingGetAccountInput = new x8({\n\tname: \"OpenBankingGetAccountInput\",\n\tdescription: \"Parameters for retrieving a specific bank account.\",\n\tfields: {\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\taccountId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tincludeBalances: {\n\t\t\ttype: E5.Boolean(),\n\t\t\tisOptional: true\n\t\t},\n\t\tincludeLatestTransactions: {\n\t\t\ttype: E5.Boolean(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst OpenBankingSyncAccountsInput = new x8({\n\tname: \"OpenBankingSyncAccountsInput\",\n\tdescription: \"Command payload to trigger an account synchronisation against the open banking provider.\",\n\tfields: {\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tuserId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: true\n\t\t},\n\t\tconnectionId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\taccountIds: {\n\t\t\ttype: E5.ID(),\n\t\t\tisArray: true,\n\t\t\tisOptional: true\n\t\t},\n\t\tforceFullRefresh: {\n\t\t\ttype: E5.Boolean(),\n\t\t\tisOptional: true\n\t\t},\n\t\ttriggerWorkflows: {\n\t\t\ttype: E5.Boolean(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst OpenBankingSyncAccountsOutput = new x8({\n\tname: \"OpenBankingSyncAccountsOutput\",\n\tdescription: \"Result of a bank account synchronisation run.\",\n\tfields: {\n\t\tsynced: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tfailed: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\terrors: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisArray: true,\n\t\t\tisOptional: true\n\t\t},\n\t\tnextSyncSuggestedAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst OpenBankingListAccounts = defineQuery({\n\tmeta: {\n\t\tname: \"openbanking.accounts.list\",\n\t\tversion: 1,\n\t\tdescription: \"List bank accounts available to a tenant/user via Powens Open Banking.\",\n\t\tgoal: \"Provide downstream workflows with the set of accounts accessible via the configured open banking connection.\",\n\t\tcontext: \"Used by Pocket Family Office dashboards and sync workflows to enumerate bank accounts prior to syncing balances or transactions.\",\n\t\towners: [\"platform.finance\"],\n\t\ttags: [\n\t\t\t\"open-banking\",\n\t\t\t\"powens\",\n\t\t\t\"accounts\"\n\t\t],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: OpenBankingListAccountsInput,\n\t\toutput: OpenBankingListAccountsOutput\n\t},\n\tpolicy: { auth: \"user\" }\n});\nconst OpenBankingGetAccount = defineQuery({\n\tmeta: {\n\t\tname: \"openbanking.accounts.get\",\n\t\tversion: 1,\n\t\tdescription: \"Retrieve the canonical bank account record for the given account identifier.\",\n\t\tgoal: \"Allow user-facing experiences and automations to display up-to-date account metadata.\",\n\t\tcontext: \"Invoked by UI surfaces and workflow automation steps that require detailed metadata for a specific bank account.\",\n\t\towners: [\"platform.finance\"],\n\t\ttags: [\n\t\t\t\"open-banking\",\n\t\t\t\"powens\",\n\t\t\t\"accounts\"\n\t\t],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: OpenBankingGetAccountInput,\n\t\toutput: BankAccountRecord\n\t},\n\tpolicy: { auth: \"user\" }\n});\nconst OpenBankingSyncAccounts = defineCommand({\n\tmeta: {\n\t\tname: \"openbanking.accounts.sync\",\n\t\tversion: 1,\n\t\tdescription: \"Initiate a synchronisation run to refresh bank account metadata from Powens.\",\n\t\tgoal: \"Keep canonical bank account records aligned with the external open banking provider.\",\n\t\tcontext: \"Triggered by scheduled workflows or manual operator actions to reconcile account metadata prior to transaction/balance syncs.\",\n\t\towners: [\"platform.finance\"],\n\t\ttags: [\n\t\t\t\"open-banking\",\n\t\t\t\"powens\",\n\t\t\t\"accounts\"\n\t\t],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: OpenBankingSyncAccountsInput,\n\t\toutput: OpenBankingSyncAccountsOutput\n\t},\n\tpolicy: { auth: \"admin\" },\n\ttelemetry: {\n\t\tsuccess: {\n\t\t\tevent: { name: OPENBANKING_TELEMETRY_EVENTS.accountsSynced },\n\t\t\tproperties: ({ input, output }) => {\n\t\t\t\tconst payload = input;\n\t\t\t\tconst result = output;\n\t\t\t\treturn {\n\t\t\t\t\ttenantId: payload?.tenantId,\n\t\t\t\t\tconnectionId: payload?.connectionId,\n\t\t\t\t\tsynced: result?.synced,\n\t\t\t\t\tfailed: result?.failed\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\tfailure: {\n\t\t\tevent: { name: OPENBANKING_TELEMETRY_EVENTS.accountsSyncFailed },\n\t\t\tproperties: ({ input, error }) => {\n\t\t\t\tconst payload = input;\n\t\t\t\treturn {\n\t\t\t\t\ttenantId: payload?.tenantId,\n\t\t\t\t\tconnectionId: payload?.connectionId,\n\t\t\t\t\terror: error instanceof Error ? error.message : String(error ?? \"unknown\")\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n});\nconst openBankingAccountContracts = {\n\tOpenBankingListAccounts,\n\tOpenBankingGetAccount,\n\tOpenBankingSyncAccounts\n};\nfunction registerOpenBankingAccountContracts(registry) {\n\treturn registry.register(OpenBankingListAccounts).register(OpenBankingGetAccount).register(OpenBankingSyncAccounts);\n}\n\n//#endregion\nexport { OpenBankingGetAccount, OpenBankingListAccounts, OpenBankingSyncAccounts, openBankingAccountContracts, registerOpenBankingAccountContracts };"],"mappings":";;;;;;AAMA,MAAM,+BAA+B,IAAI,GAAG;CAC3C,MAAM;CACN,aAAa;CACb,QAAQ;EACP,UAAU;GACT,MAAM,GAAG,IAAI;GACb,YAAY;GACZ;EACD,QAAQ;GACP,MAAM,GAAG,IAAI;GACb,YAAY;GACZ;EACD,cAAc;GACb,MAAM,GAAG,IAAI;GACb,YAAY;GACZ;EACD,iBAAiB;GAChB,MAAM,GAAG,SAAS;GAClB,YAAY;GACZ;EACD,eAAe;GACd,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,QAAQ;GACP,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,UAAU;GACT,MAAM,GAAG,cAAc;GACvB,YAAY;GACZ;EACD;CACD,CAAC;AACF,MAAM,gCAAgC,IAAI,GAAG;CAC5C,MAAM;CACN,aAAa;CACb,QAAQ;EACP,UAAU;GACT,MAAM;GACN,YAAY;GACZ,SAAS;GACT;EACD,YAAY;GACX,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,SAAS;GACR,MAAM,GAAG,SAAS;GAClB,YAAY;GACZ;EACD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CACD,QAAQ,EAAE,MAAM,QAAQ;CACxB,CAAC;AACF,MAAM,wBAAwB,YAAY;CACzC,MAAM;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ,CAAC,mBAAmB;EAC5B,MAAM;GACL;GACA;GACA;GACA;EACD,WAAW;EACX;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ,EAAE,MAAM,QAAQ;CACxB,CAAC;AACF,MAAM,0BAA0B,cAAc;CAC7C,MAAM;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ,CAAC,mBAAmB;EAC5B,MAAM;GACL;GACA;GACA;GACA;EACD,WAAW;EACX;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ,EAAE,MAAM,SAAS;CACzB,WAAW;EACV,SAAS;GACR,OAAO,EAAE,MAAM,6BAA6B,gBAAgB;GAC5D,aAAa,EAAE,OAAO,aAAa;IAClC,MAAM,UAAU;IAChB,MAAM,SAAS;AACf,WAAO;KACN,UAAU,SAAS;KACnB,cAAc,SAAS;KACvB,QAAQ,QAAQ;KAChB,QAAQ,QAAQ;KAChB;;GAEF;EACD,SAAS;GACR,OAAO,EAAE,MAAM,6BAA6B,oBAAoB;GAChE,aAAa,EAAE,OAAO,YAAY;IACjC,MAAM,UAAU;AAChB,WAAO;KACN,UAAU,SAAS;KACnB,cAAc,SAAS;KACvB,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,SAAS,UAAU;KAC1E;;GAEF;EACD;CACD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E5, x8 } from "../../../schema/dist/index.js";
|
|
2
|
-
import { defineCommand, defineQuery } from "../../../
|
|
2
|
+
import { defineCommand, defineQuery } from "../../../operation.js";
|
|
3
3
|
import { AccountBalanceRecord } from "../models.js";
|
|
4
4
|
import { OPENBANKING_TELEMETRY_EVENTS } from "../telemetry.js";
|
|
5
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balances.js","names":[],"sources":["../../../../../../../../../libs/contracts/dist/integrations/openbanking/contracts/balances.js"],"sourcesContent":["import { E5, x8 } from \"../../../schema/dist/index.js\";\nimport { defineCommand, defineQuery } from \"../../../
|
|
1
|
+
{"version":3,"file":"balances.js","names":[],"sources":["../../../../../../../../../libs/contracts/dist/integrations/openbanking/contracts/balances.js"],"sourcesContent":["import { E5, x8 } from \"../../../schema/dist/index.js\";\nimport { defineCommand, defineQuery } from \"../../../operation.js\";\nimport { AccountBalanceRecord } from \"../models.js\";\nimport { OPENBANKING_TELEMETRY_EVENTS } from \"../telemetry.js\";\n\n//#region src/integrations/openbanking/contracts/balances.ts\nconst OpenBankingGetBalancesInput = new x8({\n\tname: \"OpenBankingGetBalancesInput\",\n\tdescription: \"Parameters for retrieving bank account balances from the canonical ledger.\",\n\tfields: {\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\taccountId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tbalanceTypes: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisArray: true,\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst OpenBankingGetBalancesOutput = new x8({\n\tname: \"OpenBankingGetBalancesOutput\",\n\tdescription: \"Canonical balances for a bank account.\",\n\tfields: {\n\t\tbalances: {\n\t\t\ttype: AccountBalanceRecord,\n\t\t\tisOptional: false,\n\t\t\tisArray: true\n\t\t},\n\t\tasOf: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst OpenBankingRefreshBalancesInput = new x8({\n\tname: \"OpenBankingRefreshBalancesInput\",\n\tdescription: \"Command payload to refresh balances for a bank account via the open banking provider.\",\n\tfields: {\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\taccountId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tconnectionId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: true\n\t\t},\n\t\tbalanceTypes: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisArray: true,\n\t\t\tisOptional: true\n\t\t},\n\t\tforceRefresh: {\n\t\t\ttype: E5.Boolean(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst OpenBankingRefreshBalancesOutput = new x8({\n\tname: \"OpenBankingRefreshBalancesOutput\",\n\tdescription: \"Result of a balance refresh against the open banking provider.\",\n\tfields: {\n\t\tbalances: {\n\t\t\ttype: AccountBalanceRecord,\n\t\t\tisOptional: false,\n\t\t\tisArray: true\n\t\t},\n\t\trefreshedAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: false\n\t\t},\n\t\terrors: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisArray: true,\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst OpenBankingGetBalances = defineQuery({\n\tmeta: {\n\t\tname: \"openbanking.balances.get\",\n\t\tversion: 1,\n\t\tdescription: \"Retrieve the latest cached balances for a bank account.\",\n\t\tgoal: \"Expose current and available balances required by dashboards and analytics.\",\n\t\tcontext: \"Used by Pocket Family Office UI surfaces and automation steps that require balance totals prior to generating summaries.\",\n\t\towners: [\"platform.finance\"],\n\t\ttags: [\n\t\t\t\"open-banking\",\n\t\t\t\"powens\",\n\t\t\t\"balances\"\n\t\t],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: OpenBankingGetBalancesInput,\n\t\toutput: OpenBankingGetBalancesOutput\n\t},\n\tpolicy: { auth: \"user\" }\n});\nconst OpenBankingRefreshBalances = defineCommand({\n\tmeta: {\n\t\tname: \"openbanking.balances.refresh\",\n\t\tversion: 1,\n\t\tdescription: \"Refresh balances for a bank account via the configured open banking provider.\",\n\t\tgoal: \"Ensure canonical balance records reflect the latest values from Powens.\",\n\t\tcontext: \"Triggered by scheduled workflows before generating summaries or forecasting cashflow.\",\n\t\towners: [\"platform.finance\"],\n\t\ttags: [\n\t\t\t\"open-banking\",\n\t\t\t\"powens\",\n\t\t\t\"balances\"\n\t\t],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: OpenBankingRefreshBalancesInput,\n\t\toutput: OpenBankingRefreshBalancesOutput\n\t},\n\tpolicy: { auth: \"admin\" },\n\ttelemetry: {\n\t\tsuccess: {\n\t\t\tevent: { name: OPENBANKING_TELEMETRY_EVENTS.balancesRefreshed },\n\t\t\tproperties: ({ input, output }) => {\n\t\t\t\tconst payload = input;\n\t\t\t\tconst result = output;\n\t\t\t\treturn {\n\t\t\t\t\ttenantId: payload?.tenantId,\n\t\t\t\t\taccountId: payload?.accountId,\n\t\t\t\t\trefreshedAt: result?.refreshedAt,\n\t\t\t\t\tbalanceCount: Array.isArray(result?.balances) ? result?.balances.length : void 0\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\tfailure: {\n\t\t\tevent: { name: OPENBANKING_TELEMETRY_EVENTS.balancesRefreshFailed },\n\t\t\tproperties: ({ input, error }) => {\n\t\t\t\tconst payload = input;\n\t\t\t\treturn {\n\t\t\t\t\ttenantId: payload?.tenantId,\n\t\t\t\t\taccountId: payload?.accountId,\n\t\t\t\t\terror: error instanceof Error ? error.message : String(error ?? \"unknown\")\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n});\nconst openBankingBalanceContracts = {\n\tOpenBankingGetBalances,\n\tOpenBankingRefreshBalances\n};\nfunction registerOpenBankingBalanceContracts(registry) {\n\treturn registry.register(OpenBankingGetBalances).register(OpenBankingRefreshBalances);\n}\n\n//#endregion\nexport { OpenBankingGetBalances, OpenBankingRefreshBalances, openBankingBalanceContracts, registerOpenBankingBalanceContracts };"],"mappings":";;;;;;AAMA,MAAM,8BAA8B,IAAI,GAAG;CAC1C,MAAM;CACN,aAAa;CACb,QAAQ;EACP,UAAU;GACT,MAAM,GAAG,IAAI;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AM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ,CAAC,mBAAmB;EAC5B,MAAM;GACL;GACA;GACA;GACA;EACD,WAAW;EACX;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ,EAAE,MAAM,SAAS;CACzB,WAAW;EACV,SAAS;GACR,OAAO,EAAE,MAAM,6BAA6B,mBAAmB;GAC/D,aAAa,EAAE,OAAO,aAAa;IAClC,MAAM,UAAU;IAChB,MAAM,SAAS;AACf,WAAO;KACN,UAAU,SAAS;KACnB,WAAW,SAAS;KACpB,aAAa,QAAQ;KACrB,cAAc,MAAM,QAAQ,QAAQ,SAAS,GAAG,QAAQ,SAAS,SAAS,KAAK;KAC/E;;GAEF;EACD,SAAS;GACR,OAAO,EAAE,MAAM,6BAA6B,uBAAuB;GACnE,aAAa,EAAE,OAAO,YAAY;IACjC,MAAM,UAAU;AAChB,WAAO;KACN,UAAU,SAAS;KACnB,WAAW,SAAS;KACpB,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,SAAS,UAAU;KAC1E;;GAEF;EACD;CACD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E5, x8 } from "../../../schema/dist/index.js";
|
|
2
|
-
import { defineCommand, defineQuery } from "../../../
|
|
2
|
+
import { defineCommand, defineQuery } from "../../../operation.js";
|
|
3
3
|
import { BankTransactionRecord } from "../models.js";
|
|
4
4
|
import { OPENBANKING_TELEMETRY_EVENTS } from "../telemetry.js";
|
|
5
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transactions.js","names":[],"sources":["../../../../../../../../../libs/contracts/dist/integrations/openbanking/contracts/transactions.js"],"sourcesContent":["import { E5, x8 } from \"../../../schema/dist/index.js\";\nimport { defineCommand, defineQuery } from \"../../../
|
|
1
|
+
{"version":3,"file":"transactions.js","names":[],"sources":["../../../../../../../../../libs/contracts/dist/integrations/openbanking/contracts/transactions.js"],"sourcesContent":["import { E5, x8 } from \"../../../schema/dist/index.js\";\nimport { defineCommand, defineQuery } from \"../../../operation.js\";\nimport { BankTransactionRecord } from \"../models.js\";\nimport { OPENBANKING_TELEMETRY_EVENTS } from \"../telemetry.js\";\n\n//#region src/integrations/openbanking/contracts/transactions.ts\nconst OpenBankingListTransactionsInput = new x8({\n\tname: \"OpenBankingListTransactionsInput\",\n\tdescription: \"Parameters for listing bank transactions from the canonical ledger.\",\n\tfields: {\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\taccountId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tfrom: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\tto: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\tcursor: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tpageSize: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tdirection: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tminimumAmount: {\n\t\t\ttype: E5.Float_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tmaximumAmount: {\n\t\t\ttype: E5.Float_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tcategory: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst OpenBankingListTransactionsOutput = new x8({\n\tname: \"OpenBankingListTransactionsOutput\",\n\tdescription: \"Paginated list of transactions for a bank account.\",\n\tfields: {\n\t\ttransactions: {\n\t\t\ttype: BankTransactionRecord,\n\t\t\tisOptional: false,\n\t\t\tisArray: true\n\t\t},\n\t\tnextCursor: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\thasMore: {\n\t\t\ttype: E5.Boolean(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst OpenBankingSyncTransactionsInput = new x8({\n\tname: \"OpenBankingSyncTransactionsInput\",\n\tdescription: \"Command payload to synchronise transactions from the open banking provider into the canonical ledger.\",\n\tfields: {\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\taccountId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tfrom: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\tto: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\tconnectionId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: true\n\t\t},\n\t\tincludePending: {\n\t\t\ttype: E5.Boolean(),\n\t\t\tisOptional: true\n\t\t},\n\t\tbackfillDays: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst OpenBankingSyncTransactionsOutput = new x8({\n\tname: \"OpenBankingSyncTransactionsOutput\",\n\tdescription: \"Result of a transaction synchronisation run.\",\n\tfields: {\n\t\tsynced: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tfailed: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tearliestSyncedAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\tlatestSyncedAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\tnextSinceToken: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\terrors: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisArray: true,\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst OpenBankingListTransactions = defineQuery({\n\tmeta: {\n\t\tname: \"openbanking.transactions.list\",\n\t\tversion: 1,\n\t\tdescription: \"List bank transactions that have been normalised into the canonical ledger.\",\n\t\tgoal: \"Allow downstream analytics and UI surfaces to page through canonical bank transactions.\",\n\t\tcontext: \"Used by Pocket Family Office dashboards, reconciliation workflows, and analytics data views.\",\n\t\towners: [\"platform.finance\"],\n\t\ttags: [\n\t\t\t\"open-banking\",\n\t\t\t\"powens\",\n\t\t\t\"transactions\"\n\t\t],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: OpenBankingListTransactionsInput,\n\t\toutput: OpenBankingListTransactionsOutput\n\t},\n\tpolicy: { auth: \"user\" }\n});\nconst OpenBankingSyncTransactions = defineCommand({\n\tmeta: {\n\t\tname: \"openbanking.transactions.sync\",\n\t\tversion: 1,\n\t\tdescription: \"Synchronise transactions for a bank account by calling the configured open banking provider.\",\n\t\tgoal: \"Ensure the canonical transaction ledger stays aligned with the external provider.\",\n\t\tcontext: \"Triggered by scheduled workflows or on-demand actions when activity is expected on an account.\",\n\t\towners: [\"platform.finance\"],\n\t\ttags: [\n\t\t\t\"open-banking\",\n\t\t\t\"powens\",\n\t\t\t\"transactions\"\n\t\t],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: OpenBankingSyncTransactionsInput,\n\t\toutput: OpenBankingSyncTransactionsOutput\n\t},\n\tpolicy: { auth: \"admin\" },\n\ttelemetry: {\n\t\tsuccess: {\n\t\t\tevent: { name: OPENBANKING_TELEMETRY_EVENTS.transactionsSynced },\n\t\t\tproperties: ({ input, output }) => {\n\t\t\t\tconst payload = input;\n\t\t\t\tconst result = output;\n\t\t\t\treturn {\n\t\t\t\t\ttenantId: payload?.tenantId,\n\t\t\t\t\taccountId: payload?.accountId,\n\t\t\t\t\tsynced: result?.synced,\n\t\t\t\t\tfailed: result?.failed,\n\t\t\t\t\tearliestSyncedAt: result?.earliestSyncedAt,\n\t\t\t\t\tlatestSyncedAt: result?.latestSyncedAt\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\tfailure: {\n\t\t\tevent: { name: OPENBANKING_TELEMETRY_EVENTS.transactionsSyncFailed },\n\t\t\tproperties: ({ input, error }) => {\n\t\t\t\tconst payload = input;\n\t\t\t\treturn {\n\t\t\t\t\ttenantId: payload?.tenantId,\n\t\t\t\t\taccountId: payload?.accountId,\n\t\t\t\t\terror: error instanceof Error ? error.message : String(error ?? \"unknown\")\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t}\n});\nconst openBankingTransactionContracts = {\n\tOpenBankingListTransactions,\n\tOpenBankingSyncTransactions\n};\nfunction registerOpenBankingTransactionContracts(registry) {\n\treturn registry.register(OpenBankingListTransactions).register(OpenBankingSyncTransactions);\n}\n\n//#endregion\nexport { OpenBankingListTransactions, OpenBankingSyncTransactions, openBankingTransactionContracts, registerOpenBankingTransactionContracts };"],"mappings":";;;;;;AAMA,MAAM,mCAAmC,IAAI,GAAG;CAC/C,MAAM;CACN,aAAa;CACb,QAAQ;EACP,UAAU;GACT,MAAM,GAAG,IAAI;GACb,YAAY;GACZ;EACD,WAAW;GACV,MAAM,GAAG,IAAI;GACb,YAAY;GACZ;EACD,MAAM;GACL,MAAM,GAAG,UAAU;GACnB,YAAY;GACZ;EACD,IAAI;GACH,MAAM,GAAG,UAAU;GACnB,YAAY;GACZ;EACD,QAAQ;GACP,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,UAAU;GACT,MAAM,GAAG,cAAc;GACvB,YAAY;GACZ;EACD,WAAW;GACV,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,eAAe;GACd,MAAM,GAAG,gBAAgB;GACzB,YAAY;GACZ;EACD,eAAe;GACd,MAAM,GAAG,gBAAgB;GACzB,YAAY;GACZ;EACD,UAAU;GACT,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD;CACD,CAAC;AACF,MAAM,oCAAoC,IAAI,GAAG;CAChD,MAAM;CACN,aAAa;CACb,QAAQ;EACP,cAAc;GACb,MAAM;GACN,YAAY;GACZ,SAAS;GACT;EACD,YAAY;GAC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AM,8BAA8B,cAAc;CACjD,MAAM;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ,CAAC,mBAAmB;EAC5B,MAAM;GACL;GACA;GACA;GACA;EACD,WAAW;EACX;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ,EAAE,MAAM,SAAS;CACzB,WAAW;EACV,SAAS;GACR,OAAO,EAAE,MAAM,6BAA6B,oBAAoB;GAChE,aAAa,EAAE,OAAO,aAAa;IAClC,MAAM,UAAU;IAChB,MAAM,SAAS;AACf,WAAO;KACN,UAAU,SAAS;KACnB,WAAW,SAAS;KACpB,QAAQ,QAAQ;KAChB,QAAQ,QAAQ;KAChB,kBAAkB,QAAQ;KAC1B,gBAAgB,QAAQ;KACxB;;GAEF;EACD,SAAS;GACR,OAAO,EAAE,MAAM,6BAA6B,wBAAwB;GACpE,aAAa,EAAE,OAAO,YAAY;IACjC,MAAM,UAAU;AAChB,WAAO;KACN,UAAU,SAAS;KACnB,WAAW,SAAS;KACpB,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,SAAS,UAAU;KAC1E;;GAEF;EACD;CACD,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { E5, x8 } from "../schema/dist/index.js";
|
|
2
|
-
import { defineCommand, defineQuery } from "../
|
|
2
|
+
import { defineCommand, defineQuery } from "../operation.js";
|
|
3
3
|
|
|
4
4
|
//#region ../../libs/contracts/dist/knowledge/contracts.js
|
|
5
5
|
const KnowledgeSyncSchedule = new x8({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contracts.js","names":[],"sources":["../../../../../../../libs/contracts/dist/knowledge/contracts.js"],"sourcesContent":["import { E5, x8 } from \"../schema/dist/index.js\";\nimport { defineCommand, defineQuery } from \"../spec.js\";\n\n//#region src/knowledge/contracts.ts\nconst KnowledgeSyncSchedule = new x8({\n\tname: \"KnowledgeSyncSchedule\",\n\tfields: {\n\t\tenabled: {\n\t\t\ttype: E5.Boolean(),\n\t\t\tisOptional: false\n\t\t},\n\t\tcron: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tintervalMs: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst KnowledgeSourceRecord = new x8({\n\tname: \"KnowledgeSourceRecord\",\n\tfields: {\n\t\tid: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tspaceKey: {\n\t\t\ttype: E5.NonEmptyString(),\n\t\t\tisOptional: false\n\t\t},\n\t\tspaceVersion: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tlabel: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tsourceType: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tsyncSchedule: {\n\t\t\ttype: KnowledgeSyncSchedule,\n\t\t\tisOptional: true\n\t\t},\n\t\tlastSyncStatus: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tlastSyncAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\titemsProcessed: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tcreatedAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\tupdatedAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst CreateKnowledgeSourceInput = new x8({\n\tname: \"CreateKnowledgeSourceInput\",\n\tfields: {\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tspaceKey: {\n\t\t\ttype: E5.NonEmptyString(),\n\t\t\tisOptional: false\n\t\t},\n\t\tspaceVersion: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tlabel: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tsourceType: {\n\t\t\ttype: E5.NonEmptyString(),\n\t\t\tisOptional: false\n\t\t},\n\t\tconfig: {\n\t\t\ttype: E5.JSONObject(),\n\t\t\tisOptional: false\n\t\t},\n\t\tsyncSchedule: {\n\t\t\ttype: KnowledgeSyncSchedule,\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst UpdateKnowledgeSourceInput = new x8({\n\tname: \"UpdateKnowledgeSourceInput\",\n\tfields: {\n\t\tsourceId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tlabel: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tconfig: {\n\t\t\ttype: E5.JSONObject(),\n\t\t\tisOptional: true\n\t\t},\n\t\tsyncSchedule: {\n\t\t\ttype: KnowledgeSyncSchedule,\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst DeleteKnowledgeSourceInput = new x8({\n\tname: \"DeleteKnowledgeSourceInput\",\n\tfields: { sourceId: {\n\t\ttype: E5.ID(),\n\t\tisOptional: false\n\t} }\n});\nconst DeleteKnowledgeSourceOutput = new x8({\n\tname: \"DeleteKnowledgeSourceOutput\",\n\tfields: { success: {\n\t\ttype: E5.Boolean(),\n\t\tisOptional: false\n\t} }\n});\nconst ListKnowledgeSourcesInput = new x8({\n\tname: \"ListKnowledgeSourcesInput\",\n\tfields: {\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tspaceKey: {\n\t\t\ttype: E5.NonEmptyString(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst ListKnowledgeSourcesOutput = new x8({\n\tname: \"ListKnowledgeSourcesOutput\",\n\tfields: { sources: {\n\t\ttype: KnowledgeSourceRecord,\n\t\tisOptional: false,\n\t\tisArray: true\n\t} }\n});\nconst TriggerKnowledgeSyncInput = new x8({\n\tname: \"TriggerKnowledgeSyncInput\",\n\tfields: { sourceId: {\n\t\ttype: E5.ID(),\n\t\tisOptional: false\n\t} }\n});\nconst TriggerKnowledgeSyncOutput = new x8({\n\tname: \"TriggerKnowledgeSyncOutput\",\n\tfields: {\n\t\tsuccess: {\n\t\t\ttype: E5.Boolean(),\n\t\t\tisOptional: false\n\t\t},\n\t\titemsProcessed: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\terror: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst CreateKnowledgeSource = defineCommand({\n\tmeta: {\n\t\tname: \"knowledge.source.create\",\n\t\tversion: 1,\n\t\tdescription: \"Create a knowledge source binding for a tenant.\",\n\t\tgoal: \"Onboard a new knowledge ingestion source such as Notion or uploads.\",\n\t\tcontext: \"Used by Ops and App Studio to configure knowledge ingestion per tenant and space.\",\n\t\towners: [\"platform.knowledge\"],\n\t\ttags: [\"knowledge\", \"sources\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: CreateKnowledgeSourceInput,\n\t\toutput: KnowledgeSourceRecord\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.knowledge.manage\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst UpdateKnowledgeSource = defineCommand({\n\tmeta: {\n\t\tname: \"knowledge.source.update\",\n\t\tversion: 1,\n\t\tdescription: \"Update metadata or configuration for a knowledge source.\",\n\t\tgoal: \"Allow rotation of credentials, sync schedules, and labels.\",\n\t\tcontext: \"Supports editing how a tenant ingests knowledge (e.g., toggling sync cadence).\",\n\t\towners: [\"platform.knowledge\"],\n\t\ttags: [\"knowledge\", \"sources\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: UpdateKnowledgeSourceInput,\n\t\toutput: KnowledgeSourceRecord\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.knowledge.manage\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst DeleteKnowledgeSource = defineCommand({\n\tmeta: {\n\t\tname: \"knowledge.source.delete\",\n\t\tversion: 1,\n\t\tdescription: \"Delete a knowledge source binding for a tenant.\",\n\t\tgoal: \"Remove obsolete or compromised knowledge ingestion paths.\",\n\t\tcontext: \"Ensures ephemeral or external sources can be removed cleanly without leaving residual bindings.\",\n\t\towners: [\"platform.knowledge\"],\n\t\ttags: [\"knowledge\", \"sources\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: DeleteKnowledgeSourceInput,\n\t\toutput: DeleteKnowledgeSourceOutput\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.knowledge.manage\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst ListKnowledgeSources = defineQuery({\n\tmeta: {\n\t\tname: \"knowledge.source.list\",\n\t\tversion: 1,\n\t\tdescription: \"List knowledge sources configured for a tenant.\",\n\t\tgoal: \"Provide visibility into knowledge ingest configuration and schedules.\",\n\t\tcontext: \"Used by App Studio and Ops flows to surface knowledge sources and their health.\",\n\t\towners: [\"platform.knowledge\"],\n\t\ttags: [\"knowledge\", \"sources\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: ListKnowledgeSourcesInput,\n\t\toutput: ListKnowledgeSourcesOutput\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.knowledge.read\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst TriggerKnowledgeSourceSync = defineCommand({\n\tmeta: {\n\t\tname: \"knowledge.source.triggerSync\",\n\t\tversion: 1,\n\t\tdescription: \"Trigger an immediate sync for a knowledge source.\",\n\t\tgoal: \"Support manual or automated sync retries for knowledge ingestion.\",\n\t\tcontext: \"Invoked by Ops tooling or monitors when knowledge content must be refreshed or reprocessed.\",\n\t\towners: [\"platform.knowledge\"],\n\t\ttags: [\"knowledge\", \"sources\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: TriggerKnowledgeSyncInput,\n\t\toutput: TriggerKnowledgeSyncOutput\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.knowledge.manage\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst knowledgeContracts = {\n\tCreateKnowledgeSource,\n\tUpdateKnowledgeSource,\n\tDeleteKnowledgeSource,\n\tListKnowledgeSources,\n\tTriggerKnowledgeSourceSync\n};\nfunction registerKnowledgeContracts(registry) {\n\treturn registry.register(CreateKnowledgeSource).register(UpdateKnowledgeSource).register(DeleteKnowledgeSource).register(ListKnowledgeSources).register(TriggerKnowledgeSourceSync);\n}\n\n//#endregion\nexport { CreateKnowledgeSource, DeleteKnowledgeSource, ListKnowledgeSources, TriggerKnowledgeSourceSync, UpdateKnowledgeSource, knowledgeContracts, registerKnowledgeContracts };"],"mappings":";;;;AAIA,MAAM,wBAAwB,IAAI,GAAG;CACpC,MAAM;CACN,QAAQ;EACP,SAAS;GACR,MAAM,GAAG,SAAS;GAClB,YAAY;GACZ;EACD,MAAM;GACL,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,YAAY;GACX,MAAM,GAAG,cAAc;GACvB,YAAY;GACZ;EACD;CACD,CAAC;AACF,MAAM,wBAAwB,IAAI,GAAG;CACpC,MAAM;CACN,QAAQ;EACP,IAAI;GACH,MAAM,GAAG,IAAI;GACb,YAAY;GACZ;EACD,UAAU;GACT,MAAM,GAAG,IAAI;GACb,YAAY;GACZ;EACD,UAAU;GACT,MAAM,GAAG,gBAAgB;GACzB,YAAY;GACZ;EACD,cAAc;GACb,MAAM,G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,CAAC,qBAAqB;EAC9B,MAAM,CAAC,aAAa,UAAU;EAC9B,WAAW;EACX;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ;EACP,MAAM;EACN,UAAU,CAAC;GACV,MAAM;GACN,SAAS;GACT,CAAC;EACF;CACD,CAAC;AACF,MAAM,wBAAwB,cAAc;CAC3C,MAAM;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ,CAAC,qBAAqB;EAC9B,MAAM,CAAC,aAAa,UAAU;EAC9B,WAAW;EACX;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ;EACP,MAAM;EACN,UAAU,CAAC;GACV,MAAM;GACN,SAAS;GACT,CAAC;EACF;CACD,CAAC;AACF,MAAM,uBAAuB,YAAY;CACxC,MAAM;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ,CAAC,qBAAqB;EAC9B,MAAM,CAAC,aAAa,UAAU;EAC9B,WAAW;EACX;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ;EACP,MAAM;EACN,UAAU,CAAC;GACV,MAAM;GACN,SAAS;GACT,CAAC;EACF;CACD,CAAC;AACF,MAAM,6BAA6B,cAAc;CAChD,MAAM;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ,CAAC,qBAAqB;EAC9B,MAAM,CAAC,aAAa,UAAU;EAC9B,WAAW;EACX;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ;EACP,MAAM;EACN,UAAU,CAAC;GACV,MAAM;GACN,SAAS;GACT,CAAC;EACF;CACD,CAAC"}
|
|
1
|
+
{"version":3,"file":"contracts.js","names":[],"sources":["../../../../../../../libs/contracts/dist/knowledge/contracts.js"],"sourcesContent":["import { E5, x8 } from \"../schema/dist/index.js\";\nimport { defineCommand, defineQuery } from \"../operation.js\";\n\n//#region src/knowledge/contracts.ts\nconst KnowledgeSyncSchedule = new x8({\n\tname: \"KnowledgeSyncSchedule\",\n\tfields: {\n\t\tenabled: {\n\t\t\ttype: E5.Boolean(),\n\t\t\tisOptional: false\n\t\t},\n\t\tcron: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tintervalMs: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst KnowledgeSourceRecord = new x8({\n\tname: \"KnowledgeSourceRecord\",\n\tfields: {\n\t\tid: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tspaceKey: {\n\t\t\ttype: E5.NonEmptyString(),\n\t\t\tisOptional: false\n\t\t},\n\t\tspaceVersion: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tlabel: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tsourceType: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tsyncSchedule: {\n\t\t\ttype: KnowledgeSyncSchedule,\n\t\t\tisOptional: true\n\t\t},\n\t\tlastSyncStatus: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tlastSyncAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\titemsProcessed: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tcreatedAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t},\n\t\tupdatedAt: {\n\t\t\ttype: E5.DateTime(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst CreateKnowledgeSourceInput = new x8({\n\tname: \"CreateKnowledgeSourceInput\",\n\tfields: {\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tspaceKey: {\n\t\t\ttype: E5.NonEmptyString(),\n\t\t\tisOptional: false\n\t\t},\n\t\tspaceVersion: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tlabel: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: false\n\t\t},\n\t\tsourceType: {\n\t\t\ttype: E5.NonEmptyString(),\n\t\t\tisOptional: false\n\t\t},\n\t\tconfig: {\n\t\t\ttype: E5.JSONObject(),\n\t\t\tisOptional: false\n\t\t},\n\t\tsyncSchedule: {\n\t\t\ttype: KnowledgeSyncSchedule,\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst UpdateKnowledgeSourceInput = new x8({\n\tname: \"UpdateKnowledgeSourceInput\",\n\tfields: {\n\t\tsourceId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tlabel: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\tconfig: {\n\t\t\ttype: E5.JSONObject(),\n\t\t\tisOptional: true\n\t\t},\n\t\tsyncSchedule: {\n\t\t\ttype: KnowledgeSyncSchedule,\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst DeleteKnowledgeSourceInput = new x8({\n\tname: \"DeleteKnowledgeSourceInput\",\n\tfields: { sourceId: {\n\t\ttype: E5.ID(),\n\t\tisOptional: false\n\t} }\n});\nconst DeleteKnowledgeSourceOutput = new x8({\n\tname: \"DeleteKnowledgeSourceOutput\",\n\tfields: { success: {\n\t\ttype: E5.Boolean(),\n\t\tisOptional: false\n\t} }\n});\nconst ListKnowledgeSourcesInput = new x8({\n\tname: \"ListKnowledgeSourcesInput\",\n\tfields: {\n\t\ttenantId: {\n\t\t\ttype: E5.ID(),\n\t\t\tisOptional: false\n\t\t},\n\t\tspaceKey: {\n\t\t\ttype: E5.NonEmptyString(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst ListKnowledgeSourcesOutput = new x8({\n\tname: \"ListKnowledgeSourcesOutput\",\n\tfields: { sources: {\n\t\ttype: KnowledgeSourceRecord,\n\t\tisOptional: false,\n\t\tisArray: true\n\t} }\n});\nconst TriggerKnowledgeSyncInput = new x8({\n\tname: \"TriggerKnowledgeSyncInput\",\n\tfields: { sourceId: {\n\t\ttype: E5.ID(),\n\t\tisOptional: false\n\t} }\n});\nconst TriggerKnowledgeSyncOutput = new x8({\n\tname: \"TriggerKnowledgeSyncOutput\",\n\tfields: {\n\t\tsuccess: {\n\t\t\ttype: E5.Boolean(),\n\t\t\tisOptional: false\n\t\t},\n\t\titemsProcessed: {\n\t\t\ttype: E5.Int_unsecure(),\n\t\t\tisOptional: true\n\t\t},\n\t\terror: {\n\t\t\ttype: E5.String_unsecure(),\n\t\t\tisOptional: true\n\t\t}\n\t}\n});\nconst CreateKnowledgeSource = defineCommand({\n\tmeta: {\n\t\tname: \"knowledge.source.create\",\n\t\tversion: 1,\n\t\tdescription: \"Create a knowledge source binding for a tenant.\",\n\t\tgoal: \"Onboard a new knowledge ingestion source such as Notion or uploads.\",\n\t\tcontext: \"Used by Ops and App Studio to configure knowledge ingestion per tenant and space.\",\n\t\towners: [\"platform.knowledge\"],\n\t\ttags: [\"knowledge\", \"sources\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: CreateKnowledgeSourceInput,\n\t\toutput: KnowledgeSourceRecord\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.knowledge.manage\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst UpdateKnowledgeSource = defineCommand({\n\tmeta: {\n\t\tname: \"knowledge.source.update\",\n\t\tversion: 1,\n\t\tdescription: \"Update metadata or configuration for a knowledge source.\",\n\t\tgoal: \"Allow rotation of credentials, sync schedules, and labels.\",\n\t\tcontext: \"Supports editing how a tenant ingests knowledge (e.g., toggling sync cadence).\",\n\t\towners: [\"platform.knowledge\"],\n\t\ttags: [\"knowledge\", \"sources\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: UpdateKnowledgeSourceInput,\n\t\toutput: KnowledgeSourceRecord\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.knowledge.manage\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst DeleteKnowledgeSource = defineCommand({\n\tmeta: {\n\t\tname: \"knowledge.source.delete\",\n\t\tversion: 1,\n\t\tdescription: \"Delete a knowledge source binding for a tenant.\",\n\t\tgoal: \"Remove obsolete or compromised knowledge ingestion paths.\",\n\t\tcontext: \"Ensures ephemeral or external sources can be removed cleanly without leaving residual bindings.\",\n\t\towners: [\"platform.knowledge\"],\n\t\ttags: [\"knowledge\", \"sources\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: DeleteKnowledgeSourceInput,\n\t\toutput: DeleteKnowledgeSourceOutput\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.knowledge.manage\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst ListKnowledgeSources = defineQuery({\n\tmeta: {\n\t\tname: \"knowledge.source.list\",\n\t\tversion: 1,\n\t\tdescription: \"List knowledge sources configured for a tenant.\",\n\t\tgoal: \"Provide visibility into knowledge ingest configuration and schedules.\",\n\t\tcontext: \"Used by App Studio and Ops flows to surface knowledge sources and their health.\",\n\t\towners: [\"platform.knowledge\"],\n\t\ttags: [\"knowledge\", \"sources\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: ListKnowledgeSourcesInput,\n\t\toutput: ListKnowledgeSourcesOutput\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.knowledge.read\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst TriggerKnowledgeSourceSync = defineCommand({\n\tmeta: {\n\t\tname: \"knowledge.source.triggerSync\",\n\t\tversion: 1,\n\t\tdescription: \"Trigger an immediate sync for a knowledge source.\",\n\t\tgoal: \"Support manual or automated sync retries for knowledge ingestion.\",\n\t\tcontext: \"Invoked by Ops tooling or monitors when knowledge content must be refreshed or reprocessed.\",\n\t\towners: [\"platform.knowledge\"],\n\t\ttags: [\"knowledge\", \"sources\"],\n\t\tstability: \"experimental\"\n\t},\n\tio: {\n\t\tinput: TriggerKnowledgeSyncInput,\n\t\toutput: TriggerKnowledgeSyncOutput\n\t},\n\tpolicy: {\n\t\tauth: \"admin\",\n\t\tpolicies: [{\n\t\t\tname: \"platform.knowledge.manage\",\n\t\t\tversion: 1\n\t\t}]\n\t}\n});\nconst knowledgeContracts = {\n\tCreateKnowledgeSource,\n\tUpdateKnowledgeSource,\n\tDeleteKnowledgeSource,\n\tListKnowledgeSources,\n\tTriggerKnowledgeSourceSync\n};\nfunction registerKnowledgeContracts(registry) {\n\treturn registry.register(CreateKnowledgeSource).register(UpdateKnowledgeSource).register(DeleteKnowledgeSource).register(ListKnowledgeSources).register(TriggerKnowledgeSourceSync);\n}\n\n//#endregion\nexport { CreateKnowledgeSource, DeleteKnowledgeSource, ListKnowledgeSources, TriggerKnowledgeSourceSync, UpdateKnowledgeSource, knowledgeContracts, registerKnowledgeContracts };"],"mappings":";;;;AAIA,MAAM,wBAAwB,IAAI,GAAG;CACpC,MAAM;CACN,QAAQ;EACP,SAAS;GACR,MAAM,GAAG,SAAS;GAClB,YAAY;GACZ;EACD,MAAM;GACL,MAAM,GAAG,iBAAiB;GAC1B,YAAY;GACZ;EACD,YAAY;GACX,MAAM,GAAG,cAAc;GACvB,YAAY;GACZ;EACD;CACD,CAAC;AACF,MAAM,wBAAwB,IAAI,GAAG;CACpC,MAAM;CACN,QAAQ;EACP,IAAI;GACH,MAAM,GAAG,IAAI;GACb,YAAY;GACZ;EACD,UAAU;GACT,MAAM,GAAG,IAAI;GACb,YA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wB,cAAc;CAC3C,MAAM;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ,CAAC,qBAAqB;EAC9B,MAAM,CAAC,aAAa,UAAU;EAC9B,WAAW;EACX;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ;EACP,MAAM;EACN,UAAU,CAAC;GACV,MAAM;GACN,SAAS;GACT,CAAC;EACF;CACD,CAAC;AACF,MAAM,wBAAwB,cAAc;CAC3C,MAAM;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ,CAAC,qBAAqB;EAC9B,MAAM,CAAC,aAAa,UAAU;EAC9B,WAAW;EACX;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ;EACP,MAAM;EACN,UAAU,CAAC;GACV,MAAM;GACN,SAAS;GACT,CAAC;EACF;CACD,CAAC;AACF,MAAM,uBAAuB,YAAY;CACxC,MAAM;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ,CAAC,qBAAqB;EAC9B,MAAM,CAAC,aAAa,UAAU;EAC9B,WAAW;EACX;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ;EACP,MAAM;EACN,UAAU,CAAC;GACV,MAAM;GACN,SAAS;GACT,CAAC;EACF;CACD,CAAC;AACF,MAAM,6BAA6B,cAAc;CAChD,MAAM;EACL,MAAM;EACN,SAAS;EACT,aAAa;EACb,MAAM;EACN,SAAS;EACT,QAAQ,CAAC,qBAAqB;EAC9B,MAAM,CAAC,aAAa,UAAU;EAC9B,WAAW;EACX;CACD,IAAI;EACH,OAAO;EACP,QAAQ;EACR;CACD,QAAQ;EACP,MAAM;EACN,UAAU,CAAC;GACV,MAAM;GACN,SAAS;GACT,CAAC;EACF;CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exporters.js","names":[],"sources":["../../../../../../../libs/contracts/dist/llm/exporters.js"],"sourcesContent":["import { jsonSchemaForSpec } from \"../jsonschema.js\";\nimport { isEmitDeclRef } from \"../spec.js\";\n\n//#region src/llm/exporters.ts\nconst DEFAULT_SPEC_OPTIONS = {\n\tformat: \"full\",\n\tincludeSchemas: true,\n\tincludeScenarios: true,\n\tincludeExamples: true,\n\tincludePolicy: true,\n\tincludeSideEffects: true\n};\nconst DEFAULT_FEATURE_OPTIONS = {\n\t...DEFAULT_SPEC_OPTIONS,\n\tincludeRelatedSpecs: true,\n\tincludeRelatedEvents: true,\n\tincludeRelatedPresentations: true\n};\n/**\n* Export a single spec to context-focused markdown.\n* Includes: goal, context, description, acceptance scenarios.\n* Best for: Understanding what the spec does, providing context to LLMs.\n*/\nfunction specToContextMarkdown(spec) {\n\tconst m = spec.meta;\n\tconst lines = [];\n\tlines.push(`# ${m.name} (v${m.version})`);\n\tlines.push(\"\");\n\tlines.push(`> ${m.description}`);\n\tlines.push(\"\");\n\tlines.push(`**Type:** ${m.kind} | **Stability:** ${m.stability}`);\n\tlines.push(\"\");\n\tlines.push(\"## Goal\");\n\tlines.push(\"\");\n\tlines.push(m.goal);\n\tlines.push(\"\");\n\tlines.push(\"## Context\");\n\tlines.push(\"\");\n\tlines.push(m.context);\n\tlines.push(\"\");\n\tif (spec.acceptance?.scenarios?.length) {\n\t\tlines.push(\"## Acceptance Criteria\");\n\t\tlines.push(\"\");\n\t\tfor (const s of spec.acceptance.scenarios) {\n\t\t\tlines.push(`### ${s.name}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Given:**\");\n\t\t\tfor (const g of s.given) lines.push(`- ${g}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**When:**\");\n\t\t\tfor (const w of s.when) lines.push(`- ${w}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Then:**\");\n\t\t\tfor (const t of s.then) lines.push(`- ${t}`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a single spec to full markdown with all details.\n* Includes: all fields, I/O schemas, policy, events, examples.\n* Best for: Complete documentation, implementation reference.\n*/\nfunction specToFullMarkdown(spec, options = {}) {\n\tconst opts = {\n\t\t...DEFAULT_SPEC_OPTIONS,\n\t\t...options\n\t};\n\tconst m = spec.meta;\n\tconst lines = [];\n\tlines.push(`# ${m.name}.v${m.version}`);\n\tlines.push(\"\");\n\tlines.push(`> ${m.description}`);\n\tlines.push(\"\");\n\tlines.push(\"## Metadata\");\n\tlines.push(\"\");\n\tlines.push(\"| Field | Value |\");\n\tlines.push(\"|-------|-------|\");\n\tlines.push(`| Kind | ${m.kind} |`);\n\tlines.push(`| Stability | ${m.stability} |`);\n\tlines.push(`| Owners | ${m.owners.join(\", \")} |`);\n\tlines.push(`| Tags | ${m.tags.join(\", \")} |`);\n\tlines.push(\"\");\n\tlines.push(\"## Goal\");\n\tlines.push(\"\");\n\tlines.push(m.goal);\n\tlines.push(\"\");\n\tlines.push(\"## Context\");\n\tlines.push(\"\");\n\tlines.push(m.context);\n\tlines.push(\"\");\n\tif (opts.includeSchemas) {\n\t\tlines.push(\"## Input/Output\");\n\t\tlines.push(\"\");\n\t\tif (spec.io.input) {\n\t\t\tlines.push(\"### Input Schema\");\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"```json\");\n\t\t\ttry {\n\t\t\t\tconst schema = jsonSchemaForSpec(spec);\n\t\t\t\tlines.push(JSON.stringify(schema.input ?? {}, null, 2));\n\t\t\t} catch {\n\t\t\t\tlines.push(\"// Schema generation not available\");\n\t\t\t}\n\t\t\tlines.push(\"```\");\n\t\t\tlines.push(\"\");\n\t\t}\n\t\tlines.push(\"### Output Schema\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"```json\");\n\t\ttry {\n\t\t\tconst schema = jsonSchemaForSpec(spec);\n\t\t\tlines.push(JSON.stringify(schema.output ?? {}, null, 2));\n\t\t} catch {\n\t\t\tlines.push(\"// Schema generation not available\");\n\t\t}\n\t\tlines.push(\"```\");\n\t\tlines.push(\"\");\n\t\tif (spec.io.errors && Object.keys(spec.io.errors).length) {\n\t\t\tlines.push(\"### Error Codes\");\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"| Code | HTTP | Description | When |\");\n\t\t\tlines.push(\"|------|------|-------------|------|\");\n\t\t\tfor (const [code, err] of Object.entries(spec.io.errors)) lines.push(`| \\`${code}\\` | ${err.http ?? 400} | ${err.description} | ${err.when} |`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\tif (opts.includePolicy) {\n\t\tlines.push(\"## Policy\");\n\t\tlines.push(\"\");\n\t\tlines.push(`- **Auth Required:** ${spec.policy.auth}`);\n\t\tlines.push(`- **Idempotent:** ${spec.policy.idempotent ?? m.kind === \"query\"}`);\n\t\tif (spec.policy.rateLimit) lines.push(`- **Rate Limit:** ${spec.policy.rateLimit.rpm} rpm per ${spec.policy.rateLimit.key}`);\n\t\tif (spec.policy.flags?.length) lines.push(`- **Feature Flags:** ${spec.policy.flags.join(\", \")}`);\n\t\tif (spec.policy.pii?.length) lines.push(`- **PII Fields:** ${spec.policy.pii.join(\", \")}`);\n\t\tif (spec.policy.escalate) lines.push(`- **Escalation:** ${spec.policy.escalate}`);\n\t\tlines.push(\"\");\n\t}\n\tif (opts.includeSideEffects && spec.sideEffects) {\n\t\tif (spec.sideEffects.emits?.length) {\n\t\t\tlines.push(\"## Events Emitted\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const e of spec.sideEffects.emits) if (isEmitDeclRef(e)) lines.push(`- \\`${e.ref.name}.v${e.ref.version}\\` — ${e.when}`);\n\t\t\telse lines.push(`- \\`${e.name}.v${e.version}\\` — ${e.when}`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t\tif (spec.sideEffects.analytics?.length) {\n\t\t\tlines.push(\"## Analytics Events\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const a of spec.sideEffects.analytics) lines.push(`- ${a}`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\tif (opts.includeScenarios && spec.acceptance?.scenarios?.length) {\n\t\tlines.push(\"## Acceptance Scenarios\");\n\t\tlines.push(\"\");\n\t\tfor (const s of spec.acceptance.scenarios) {\n\t\t\tlines.push(`### ${s.name}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Given:**\");\n\t\t\tfor (const g of s.given) lines.push(`- ${g}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**When:**\");\n\t\t\tfor (const w of s.when) lines.push(`- ${w}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Then:**\");\n\t\t\tfor (const t of s.then) lines.push(`- ${t}`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\tif (opts.includeExamples && spec.acceptance?.examples?.length) {\n\t\tlines.push(\"## Examples\");\n\t\tlines.push(\"\");\n\t\tfor (const ex of spec.acceptance.examples) {\n\t\t\tlines.push(`### ${ex.name}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Input:**\");\n\t\t\tlines.push(\"```json\");\n\t\t\tlines.push(JSON.stringify(ex.input, null, 2));\n\t\t\tlines.push(\"```\");\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Output:**\");\n\t\t\tlines.push(\"```json\");\n\t\t\tlines.push(JSON.stringify(ex.output, null, 2));\n\t\t\tlines.push(\"```\");\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\tif (spec.transport) {\n\t\tlines.push(\"## Transport Configuration\");\n\t\tlines.push(\"\");\n\t\tif (spec.transport.rest) lines.push(`- **REST:** ${spec.transport.rest.method ?? \"POST\"} ${spec.transport.rest.path ?? \"auto\"}`);\n\t\tif (spec.transport.gql) lines.push(`- **GraphQL:** ${spec.transport.gql.field ?? \"auto\"}`);\n\t\tif (spec.transport.mcp) lines.push(`- **MCP Tool:** ${spec.transport.mcp.toolName ?? \"auto\"}`);\n\t\tlines.push(\"\");\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a single spec as an actionable agent prompt.\n* Includes: instructions, full spec, expected output format.\n* Best for: Directly feeding to coding agents for implementation.\n*/\nfunction specToAgentPrompt(spec, options) {\n\tconst taskType = options?.taskType ?? \"implement\";\n\tconst m = spec.meta;\n\tconst lines = [];\n\tconst taskVerb = {\n\t\timplement: \"Implement\",\n\t\ttest: \"Write tests for\",\n\t\trefactor: \"Refactor\",\n\t\treview: \"Review\"\n\t}[taskType];\n\tlines.push(`# Task: ${taskVerb} ${m.name}.v${m.version}`);\n\tlines.push(\"\");\n\tlines.push(\"## Context\");\n\tlines.push(\"\");\n\tlines.push(`You are working on a ContractSpec-driven codebase. This spec defines a ${m.kind} operation.`);\n\tlines.push(\"\");\n\tlines.push(`**Goal:** ${m.goal}`);\n\tlines.push(\"\");\n\tlines.push(`**Background:** ${m.context}`);\n\tlines.push(\"\");\n\tlines.push(\"## Specification\");\n\tlines.push(\"\");\n\tlines.push(specToFullMarkdown(spec));\n\tlines.push(\"\");\n\tlines.push(\"## Instructions\");\n\tlines.push(\"\");\n\tif (taskType === \"implement\") {\n\t\tlines.push(\"Implement this specification following these requirements:\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"1. **Type Safety**: Use TypeScript with strict typing. No `any` types.\");\n\t\tlines.push(\"2. **Input Validation**: Validate input against the schema before processing.\");\n\t\tlines.push(\"3. **Error Handling**: Implement all error cases defined in the spec.\");\n\t\tlines.push(\"4. **Events**: Emit events as specified in sideEffects.emits.\");\n\t\tlines.push(\"5. **Policy**: Respect auth, rate limits, and feature flags.\");\n\t\tlines.push(\"6. **Idempotency**: \" + (spec.policy.idempotent ? \"This operation MUST be idempotent.\" : \"This operation may have side effects.\"));\n\t\tlines.push(\"\");\n\t\tif (spec.policy.pii?.length) {\n\t\t\tlines.push(\"**PII Handling**: The following fields contain PII and must be handled carefully:\");\n\t\t\tfor (const field of spec.policy.pii) lines.push(`- ${field}`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t} else if (taskType === \"test\") {\n\t\tlines.push(\"Write comprehensive tests for this specification:\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"1. Test all acceptance scenarios defined in the spec.\");\n\t\tlines.push(\"2. Test all error cases with appropriate assertions.\");\n\t\tlines.push(\"3. Test edge cases and boundary conditions.\");\n\t\tlines.push(\"4. Verify events are emitted correctly.\");\n\t\tlines.push(\"5. Use descriptive test names following the pattern: \\\"should [behavior] when [condition]\\\"\");\n\t\tlines.push(\"\");\n\t} else if (taskType === \"refactor\") {\n\t\tlines.push(\"Refactor this implementation while preserving all behavior:\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"1. Maintain compliance with the specification.\");\n\t\tlines.push(\"2. Improve code clarity and maintainability.\");\n\t\tlines.push(\"3. Reduce complexity where possible.\");\n\t\tlines.push(\"4. Ensure all existing tests still pass.\");\n\t\tlines.push(\"\");\n\t} else if (taskType === \"review\") {\n\t\tlines.push(\"Review this implementation against the specification:\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"1. Verify input/output types match the schema.\");\n\t\tlines.push(\"2. Check all error cases are handled.\");\n\t\tlines.push(\"3. Verify events are emitted as specified.\");\n\t\tlines.push(\"4. Check policy compliance (auth, rate limits).\");\n\t\tlines.push(\"5. Report any deviations from the spec.\");\n\t\tlines.push(\"\");\n\t}\n\tif (options?.existingCode) {\n\t\tlines.push(\"## Existing Code\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"```typescript\");\n\t\tlines.push(options.existingCode);\n\t\tlines.push(\"```\");\n\t\tlines.push(\"\");\n\t}\n\tlines.push(\"## Expected Output\");\n\tlines.push(\"\");\n\tif (taskType === \"implement\" || taskType === \"refactor\") {\n\t\tlines.push(\"Provide a complete TypeScript implementation. Include:\");\n\t\tlines.push(\"- Type definitions for input/output\");\n\t\tlines.push(\"- Handler function with proper error handling\");\n\t\tlines.push(\"- JSDoc comments explaining the implementation\");\n\t} else if (taskType === \"test\") lines.push(\"Provide a complete test file using the testing framework available (prefer Vitest).\");\n\telse if (taskType === \"review\") {\n\t\tlines.push(\"Provide a structured review with:\");\n\t\tlines.push(\"- Compliance status (pass/fail for each requirement)\");\n\t\tlines.push(\"- Issues found with severity (error/warning/info)\");\n\t\tlines.push(\"- Suggestions for improvement\");\n\t}\n\tlines.push(\"\");\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a feature module to markdown.\n* Includes all related specs, events, and presentations.\n*/\nfunction featureToMarkdown(feature, deps, options = {}) {\n\tconst opts = {\n\t\t...DEFAULT_FEATURE_OPTIONS,\n\t\t...options\n\t};\n\tconst m = feature.meta;\n\tconst lines = [];\n\tlines.push(`# Feature: ${m.title ?? m.key}`);\n\tlines.push(\"\");\n\tif (m.description) {\n\t\tlines.push(`> ${m.description}`);\n\t\tlines.push(\"\");\n\t}\n\tlines.push(\"## Overview\");\n\tlines.push(\"\");\n\tlines.push(`- **Key:** \\`${m.key}\\``);\n\tlines.push(`- **Stability:** ${m.stability}`);\n\tlines.push(`- **Owners:** ${m.owners.join(\", \")}`);\n\tif (m.tags?.length) lines.push(`- **Tags:** ${m.tags.join(\", \")}`);\n\tlines.push(\"\");\n\tif (feature.operations?.length) {\n\t\tlines.push(\"## Operations\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"| Name | Version | Type |\");\n\t\tlines.push(\"|------|---------|------|\");\n\t\tfor (const op of feature.operations) {\n\t\t\tconst kind = (deps?.specs?.getSpec(op.name, op.version))?.meta.kind ?? \"unknown\";\n\t\t\tlines.push(`| ${op.name} | v${op.version} | ${kind} |`);\n\t\t}\n\t\tlines.push(\"\");\n\t\tif (opts.includeRelatedSpecs && deps?.specs) {\n\t\t\tlines.push(\"### Operation Details\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const op of feature.operations) {\n\t\t\t\tconst spec = deps.specs.getSpec(op.name, op.version);\n\t\t\t\tif (spec) {\n\t\t\t\t\tlines.push(`---`);\n\t\t\t\t\tlines.push(\"\");\n\t\t\t\t\tlines.push(specToFullMarkdown(spec, opts));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (feature.events?.length) {\n\t\tlines.push(\"## Events\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"| Name | Version |\");\n\t\tlines.push(\"|------|---------|\");\n\t\tfor (const evt of feature.events) lines.push(`| ${evt.name} | v${evt.version} |`);\n\t\tlines.push(\"\");\n\t}\n\tif (feature.presentations?.length) {\n\t\tlines.push(\"## Presentations\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"| Name | Version |\");\n\t\tlines.push(\"|------|---------|\");\n\t\tfor (const pres of feature.presentations) lines.push(`| ${pres.name} | v${pres.version} |`);\n\t\tlines.push(\"\");\n\t\tif (opts.includeRelatedPresentations && deps?.presentations) {\n\t\t\tlines.push(\"### Presentation Details\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const pres of feature.presentations) {\n\t\t\t\tconst p = deps.presentations.get(pres.name, pres.version);\n\t\t\t\tif (p) {\n\t\t\t\t\tlines.push(`#### ${pres.name}.v${pres.version}`);\n\t\t\t\t\tlines.push(\"\");\n\t\t\t\t\tlines.push(`- **Kind:** ${p.content.kind ?? \"unknown\"}`);\n\t\t\t\t\tif (\"componentKey\" in p.content) lines.push(`- **Component:** ${p.content.componentKey}`);\n\t\t\t\t\tlines.push(\"\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (feature.capabilities) {\n\t\tif (feature.capabilities.provides?.length) {\n\t\t\tlines.push(\"## Capabilities Provided\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const cap of feature.capabilities.provides) lines.push(`- \\`${cap.key}.v${cap.version}\\``);\n\t\t\tlines.push(\"\");\n\t\t}\n\t\tif (feature.capabilities.requires?.length) {\n\t\t\tlines.push(\"## Capabilities Required\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const cap of feature.capabilities.requires) lines.push(`- \\`${cap.key}\\`${cap.version ? `.v${cap.version}` : \"\"} (${cap.optional ? \"optional\" : \"required\"})`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a presentation descriptor to markdown.\n*/\nfunction presentationToMarkdown(presentation) {\n\tconst m = presentation.meta;\n\tconst lines = [];\n\tlines.push(`# Presentation: ${m.name}.v${m.version}`);\n\tlines.push(\"\");\n\tif (m.description) {\n\t\tlines.push(`> ${m.description}`);\n\t\tlines.push(\"\");\n\t}\n\tlines.push(\"## Metadata\");\n\tlines.push(\"\");\n\tlines.push(`- **Name:** ${m.name}`);\n\tlines.push(`- **Version:** ${m.version}`);\n\tif (m.stability) lines.push(`- **Stability:** ${m.stability}`);\n\tif (m.owners?.length) lines.push(`- **Owners:** ${m.owners.join(\", \")}`);\n\tif (m.tags?.length) lines.push(`- **Tags:** ${m.tags.join(\", \")}`);\n\tlines.push(\"\");\n\tlines.push(\"## Source\");\n\tlines.push(\"\");\n\tlines.push(`- **Type:** ${presentation.source.type}`);\n\tif (presentation.source.type === \"component\") {\n\t\tlines.push(`- **Framework:** ${presentation.source.framework}`);\n\t\tlines.push(`- **Component Key:** ${presentation.source.componentKey}`);\n\t}\n\tlines.push(\"\");\n\tlines.push(\"## Supported Targets\");\n\tlines.push(\"\");\n\tfor (const target of presentation.targets) lines.push(`- ${target}`);\n\tlines.push(\"\");\n\tif (presentation.policy) {\n\t\tlines.push(\"## Policy\");\n\t\tlines.push(\"\");\n\t\tif (presentation.policy.flags?.length) lines.push(`- **Feature Flags:** ${presentation.policy.flags.join(\", \")}`);\n\t\tif (presentation.policy.pii?.length) lines.push(`- **PII Fields:** ${presentation.policy.pii.join(\", \")}`);\n\t\tlines.push(\"\");\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export an event spec to markdown.\n*/\nfunction eventToMarkdown(event) {\n\tconst lines = [];\n\tlines.push(`# Event: ${event.name}.v${event.version}`);\n\tlines.push(\"\");\n\tlines.push(\"## Metadata\");\n\tlines.push(\"\");\n\tlines.push(`- **Name:** ${event.name}`);\n\tlines.push(`- **Version:** ${event.version}`);\n\tif (event.description) lines.push(`- **Description:** ${event.description}`);\n\tlines.push(\"\");\n\tlines.push(\"## Payload Schema\");\n\tlines.push(\"\");\n\tlines.push(\"```json\");\n\ttry {\n\t\tconst zodSchema = event.payload.getZod();\n\t\tif (\"shape\" in zodSchema && zodSchema.shape) {\n\t\t\tconst shape = zodSchema.shape;\n\t\t\tconst fields = Object.keys(shape);\n\t\t\tlines.push(JSON.stringify({ fields }, null, 2));\n\t\t} else lines.push(\"// Payload schema available at runtime\");\n\t} catch {\n\t\tlines.push(\"// Schema details available at runtime\");\n\t}\n\tlines.push(\"```\");\n\tlines.push(\"\");\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a DocBlock to markdown (already markdown, but formatted consistently).\n*/\nfunction docBlockToMarkdown(doc) {\n\tconst lines = [];\n\tlines.push(`# ${doc.title}`);\n\tlines.push(\"\");\n\tif (doc.summary) {\n\t\tlines.push(`> ${doc.summary}`);\n\t\tlines.push(\"\");\n\t}\n\tlines.push(\"## Metadata\");\n\tlines.push(\"\");\n\tlines.push(`- **ID:** ${doc.id}`);\n\tlines.push(`- **Kind:** ${doc.kind ?? \"reference\"}`);\n\tlines.push(`- **Visibility:** ${doc.visibility ?? \"public\"}`);\n\tif (doc.tags?.length) lines.push(`- **Tags:** ${doc.tags.join(\", \")}`);\n\tif (doc.owners?.length) lines.push(`- **Owners:** ${doc.owners.join(\", \")}`);\n\tif (doc.domain) lines.push(`- **Domain:** ${doc.domain}`);\n\tlines.push(\"\");\n\tlines.push(\"## Content\");\n\tlines.push(\"\");\n\tlines.push(doc.body);\n\tlines.push(\"\");\n\tif (doc.links?.length) {\n\t\tlines.push(\"## Related Links\");\n\t\tlines.push(\"\");\n\t\tfor (const link of doc.links) lines.push(`- [${link.label}](${link.href})`);\n\t\tlines.push(\"\");\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a spec with a specific format.\n* Convenience function that wraps the format-specific functions.\n*/\nfunction exportSpec(spec, options = {}) {\n\tconst format = options.format ?? \"full\";\n\tlet markdown;\n\tswitch (format) {\n\t\tcase \"context\":\n\t\t\tmarkdown = specToContextMarkdown(spec);\n\t\t\tbreak;\n\t\tcase \"prompt\":\n\t\t\tmarkdown = specToAgentPrompt(spec);\n\t\t\tbreak;\n\t\tcase \"full\":\n\t\tdefault:\n\t\t\tmarkdown = specToFullMarkdown(spec, options);\n\t\t\tbreak;\n\t}\n\treturn {\n\t\tspec,\n\t\tmarkdown,\n\t\tformat,\n\t\tmeta: {\n\t\t\tspecName: spec.meta.name,\n\t\t\tspecVersion: spec.meta.version,\n\t\t\texportedAt: (/* @__PURE__ */ new Date()).toISOString(),\n\t\t\twordCount: markdown.split(/\\s+/).length\n\t\t}\n\t};\n}\n/**\n* Export a feature with a specific format.\n*/\nfunction exportFeature(feature, deps, options = {}) {\n\tconst format = options.format ?? \"full\";\n\treturn {\n\t\tfeature,\n\t\tmarkdown: featureToMarkdown(feature, deps, options),\n\t\tformat,\n\t\tincludedSpecs: feature.operations?.map((o) => `${o.name}.v${o.version}`) ?? [],\n\t\tincludedEvents: feature.events?.map((e) => `${e.name}.v${e.version}`) ?? [],\n\t\tincludedPresentations: feature.presentations?.map((p) => `${p.name}.v${p.version}`) ?? []\n\t};\n}\n\n//#endregion\nexport { docBlockToMarkdown, eventToMarkdown, exportFeature, exportSpec, featureToMarkdown, presentationToMarkdown, specToAgentPrompt, specToContextMarkdown, specToFullMarkdown };"],"mappings":";;;AAIA,MAAM,uBAAuB;CAC5B,QAAQ;CACR,gBAAgB;CAChB,kBAAkB;CAClB,iBAAiB;CACjB,eAAe;CACf,oBAAoB;CACpB;AACD,MAAM,0BAA0B;CAC/B,GAAG;CACH,qBAAqB;CACrB,sBAAsB;CACtB,6BAA6B;CAC7B"}
|
|
1
|
+
{"version":3,"file":"exporters.js","names":[],"sources":["../../../../../../../libs/contracts/dist/llm/exporters.js"],"sourcesContent":["import { jsonSchemaForSpec } from \"../jsonschema.js\";\nimport { isEmitDeclRef } from \"../operation.js\";\n\n//#region src/llm/exporters.ts\nconst DEFAULT_SPEC_OPTIONS = {\n\tformat: \"full\",\n\tincludeSchemas: true,\n\tincludeScenarios: true,\n\tincludeExamples: true,\n\tincludePolicy: true,\n\tincludeSideEffects: true\n};\nconst DEFAULT_FEATURE_OPTIONS = {\n\t...DEFAULT_SPEC_OPTIONS,\n\tincludeRelatedSpecs: true,\n\tincludeRelatedEvents: true,\n\tincludeRelatedPresentations: true\n};\n/**\n* Export a single spec to context-focused markdown.\n* Includes: goal, context, description, acceptance scenarios.\n* Best for: Understanding what the spec does, providing context to LLMs.\n*/\nfunction specToContextMarkdown(spec) {\n\tconst m = spec.meta;\n\tconst lines = [];\n\tlines.push(`# ${m.name} (v${m.version})`);\n\tlines.push(\"\");\n\tlines.push(`> ${m.description}`);\n\tlines.push(\"\");\n\tlines.push(`**Type:** ${m.kind} | **Stability:** ${m.stability}`);\n\tlines.push(\"\");\n\tlines.push(\"## Goal\");\n\tlines.push(\"\");\n\tlines.push(m.goal);\n\tlines.push(\"\");\n\tlines.push(\"## Context\");\n\tlines.push(\"\");\n\tlines.push(m.context);\n\tlines.push(\"\");\n\tif (spec.acceptance?.scenarios?.length) {\n\t\tlines.push(\"## Acceptance Criteria\");\n\t\tlines.push(\"\");\n\t\tfor (const s of spec.acceptance.scenarios) {\n\t\t\tlines.push(`### ${s.name}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Given:**\");\n\t\t\tfor (const g of s.given) lines.push(`- ${g}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**When:**\");\n\t\t\tfor (const w of s.when) lines.push(`- ${w}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Then:**\");\n\t\t\tfor (const t of s.then) lines.push(`- ${t}`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a single spec to full markdown with all details.\n* Includes: all fields, I/O schemas, policy, events, examples.\n* Best for: Complete documentation, implementation reference.\n*/\nfunction specToFullMarkdown(spec, options = {}) {\n\tconst opts = {\n\t\t...DEFAULT_SPEC_OPTIONS,\n\t\t...options\n\t};\n\tconst m = spec.meta;\n\tconst lines = [];\n\tlines.push(`# ${m.name}.v${m.version}`);\n\tlines.push(\"\");\n\tlines.push(`> ${m.description}`);\n\tlines.push(\"\");\n\tlines.push(\"## Metadata\");\n\tlines.push(\"\");\n\tlines.push(\"| Field | Value |\");\n\tlines.push(\"|-------|-------|\");\n\tlines.push(`| Kind | ${m.kind} |`);\n\tlines.push(`| Stability | ${m.stability} |`);\n\tlines.push(`| Owners | ${m.owners.join(\", \")} |`);\n\tlines.push(`| Tags | ${m.tags.join(\", \")} |`);\n\tlines.push(\"\");\n\tlines.push(\"## Goal\");\n\tlines.push(\"\");\n\tlines.push(m.goal);\n\tlines.push(\"\");\n\tlines.push(\"## Context\");\n\tlines.push(\"\");\n\tlines.push(m.context);\n\tlines.push(\"\");\n\tif (opts.includeSchemas) {\n\t\tlines.push(\"## Input/Output\");\n\t\tlines.push(\"\");\n\t\tif (spec.io.input) {\n\t\t\tlines.push(\"### Input Schema\");\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"```json\");\n\t\t\ttry {\n\t\t\t\tconst schema = jsonSchemaForSpec(spec);\n\t\t\t\tlines.push(JSON.stringify(schema.input ?? {}, null, 2));\n\t\t\t} catch {\n\t\t\t\tlines.push(\"// Schema generation not available\");\n\t\t\t}\n\t\t\tlines.push(\"```\");\n\t\t\tlines.push(\"\");\n\t\t}\n\t\tlines.push(\"### Output Schema\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"```json\");\n\t\ttry {\n\t\t\tconst schema = jsonSchemaForSpec(spec);\n\t\t\tlines.push(JSON.stringify(schema.output ?? {}, null, 2));\n\t\t} catch {\n\t\t\tlines.push(\"// Schema generation not available\");\n\t\t}\n\t\tlines.push(\"```\");\n\t\tlines.push(\"\");\n\t\tif (spec.io.errors && Object.keys(spec.io.errors).length) {\n\t\t\tlines.push(\"### Error Codes\");\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"| Code | HTTP | Description | When |\");\n\t\t\tlines.push(\"|------|------|-------------|------|\");\n\t\t\tfor (const [code, err] of Object.entries(spec.io.errors)) lines.push(`| \\`${code}\\` | ${err.http ?? 400} | ${err.description} | ${err.when} |`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\tif (opts.includePolicy) {\n\t\tlines.push(\"## Policy\");\n\t\tlines.push(\"\");\n\t\tlines.push(`- **Auth Required:** ${spec.policy.auth}`);\n\t\tlines.push(`- **Idempotent:** ${spec.policy.idempotent ?? m.kind === \"query\"}`);\n\t\tif (spec.policy.rateLimit) lines.push(`- **Rate Limit:** ${spec.policy.rateLimit.rpm} rpm per ${spec.policy.rateLimit.key}`);\n\t\tif (spec.policy.flags?.length) lines.push(`- **Feature Flags:** ${spec.policy.flags.join(\", \")}`);\n\t\tif (spec.policy.pii?.length) lines.push(`- **PII Fields:** ${spec.policy.pii.join(\", \")}`);\n\t\tif (spec.policy.escalate) lines.push(`- **Escalation:** ${spec.policy.escalate}`);\n\t\tlines.push(\"\");\n\t}\n\tif (opts.includeSideEffects && spec.sideEffects) {\n\t\tif (spec.sideEffects.emits?.length) {\n\t\t\tlines.push(\"## Events Emitted\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const e of spec.sideEffects.emits) if (isEmitDeclRef(e)) lines.push(`- \\`${e.ref.name}.v${e.ref.version}\\` — ${e.when}`);\n\t\t\telse lines.push(`- \\`${e.name}.v${e.version}\\` — ${e.when}`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t\tif (spec.sideEffects.analytics?.length) {\n\t\t\tlines.push(\"## Analytics Events\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const a of spec.sideEffects.analytics) lines.push(`- ${a}`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\tif (opts.includeScenarios && spec.acceptance?.scenarios?.length) {\n\t\tlines.push(\"## Acceptance Scenarios\");\n\t\tlines.push(\"\");\n\t\tfor (const s of spec.acceptance.scenarios) {\n\t\t\tlines.push(`### ${s.name}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Given:**\");\n\t\t\tfor (const g of s.given) lines.push(`- ${g}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**When:**\");\n\t\t\tfor (const w of s.when) lines.push(`- ${w}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Then:**\");\n\t\t\tfor (const t of s.then) lines.push(`- ${t}`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\tif (opts.includeExamples && spec.acceptance?.examples?.length) {\n\t\tlines.push(\"## Examples\");\n\t\tlines.push(\"\");\n\t\tfor (const ex of spec.acceptance.examples) {\n\t\t\tlines.push(`### ${ex.name}`);\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Input:**\");\n\t\t\tlines.push(\"```json\");\n\t\t\tlines.push(JSON.stringify(ex.input, null, 2));\n\t\t\tlines.push(\"```\");\n\t\t\tlines.push(\"\");\n\t\t\tlines.push(\"**Output:**\");\n\t\t\tlines.push(\"```json\");\n\t\t\tlines.push(JSON.stringify(ex.output, null, 2));\n\t\t\tlines.push(\"```\");\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\tif (spec.transport) {\n\t\tlines.push(\"## Transport Configuration\");\n\t\tlines.push(\"\");\n\t\tif (spec.transport.rest) lines.push(`- **REST:** ${spec.transport.rest.method ?? \"POST\"} ${spec.transport.rest.path ?? \"auto\"}`);\n\t\tif (spec.transport.gql) lines.push(`- **GraphQL:** ${spec.transport.gql.field ?? \"auto\"}`);\n\t\tif (spec.transport.mcp) lines.push(`- **MCP Tool:** ${spec.transport.mcp.toolName ?? \"auto\"}`);\n\t\tlines.push(\"\");\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a single spec as an actionable agent prompt.\n* Includes: instructions, full spec, expected output format.\n* Best for: Directly feeding to coding agents for implementation.\n*/\nfunction specToAgentPrompt(spec, options) {\n\tconst taskType = options?.taskType ?? \"implement\";\n\tconst m = spec.meta;\n\tconst lines = [];\n\tconst taskVerb = {\n\t\timplement: \"Implement\",\n\t\ttest: \"Write tests for\",\n\t\trefactor: \"Refactor\",\n\t\treview: \"Review\"\n\t}[taskType];\n\tlines.push(`# Task: ${taskVerb} ${m.name}.v${m.version}`);\n\tlines.push(\"\");\n\tlines.push(\"## Context\");\n\tlines.push(\"\");\n\tlines.push(`You are working on a ContractSpec-driven codebase. This spec defines a ${m.kind} operation.`);\n\tlines.push(\"\");\n\tlines.push(`**Goal:** ${m.goal}`);\n\tlines.push(\"\");\n\tlines.push(`**Background:** ${m.context}`);\n\tlines.push(\"\");\n\tlines.push(\"## Specification\");\n\tlines.push(\"\");\n\tlines.push(specToFullMarkdown(spec));\n\tlines.push(\"\");\n\tlines.push(\"## Instructions\");\n\tlines.push(\"\");\n\tif (taskType === \"implement\") {\n\t\tlines.push(\"Implement this specification following these requirements:\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"1. **Type Safety**: Use TypeScript with strict typing. No `any` types.\");\n\t\tlines.push(\"2. **Input Validation**: Validate input against the schema before processing.\");\n\t\tlines.push(\"3. **Error Handling**: Implement all error cases defined in the spec.\");\n\t\tlines.push(\"4. **Events**: Emit events as specified in sideEffects.emits.\");\n\t\tlines.push(\"5. **Policy**: Respect auth, rate limits, and feature flags.\");\n\t\tlines.push(\"6. **Idempotency**: \" + (spec.policy.idempotent ? \"This operation MUST be idempotent.\" : \"This operation may have side effects.\"));\n\t\tlines.push(\"\");\n\t\tif (spec.policy.pii?.length) {\n\t\t\tlines.push(\"**PII Handling**: The following fields contain PII and must be handled carefully:\");\n\t\t\tfor (const field of spec.policy.pii) lines.push(`- ${field}`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t} else if (taskType === \"test\") {\n\t\tlines.push(\"Write comprehensive tests for this specification:\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"1. Test all acceptance scenarios defined in the spec.\");\n\t\tlines.push(\"2. Test all error cases with appropriate assertions.\");\n\t\tlines.push(\"3. Test edge cases and boundary conditions.\");\n\t\tlines.push(\"4. Verify events are emitted correctly.\");\n\t\tlines.push(\"5. Use descriptive test names following the pattern: \\\"should [behavior] when [condition]\\\"\");\n\t\tlines.push(\"\");\n\t} else if (taskType === \"refactor\") {\n\t\tlines.push(\"Refactor this implementation while preserving all behavior:\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"1. Maintain compliance with the specification.\");\n\t\tlines.push(\"2. Improve code clarity and maintainability.\");\n\t\tlines.push(\"3. Reduce complexity where possible.\");\n\t\tlines.push(\"4. Ensure all existing tests still pass.\");\n\t\tlines.push(\"\");\n\t} else if (taskType === \"review\") {\n\t\tlines.push(\"Review this implementation against the specification:\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"1. Verify input/output types match the schema.\");\n\t\tlines.push(\"2. Check all error cases are handled.\");\n\t\tlines.push(\"3. Verify events are emitted as specified.\");\n\t\tlines.push(\"4. Check policy compliance (auth, rate limits).\");\n\t\tlines.push(\"5. Report any deviations from the spec.\");\n\t\tlines.push(\"\");\n\t}\n\tif (options?.existingCode) {\n\t\tlines.push(\"## Existing Code\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"```typescript\");\n\t\tlines.push(options.existingCode);\n\t\tlines.push(\"```\");\n\t\tlines.push(\"\");\n\t}\n\tlines.push(\"## Expected Output\");\n\tlines.push(\"\");\n\tif (taskType === \"implement\" || taskType === \"refactor\") {\n\t\tlines.push(\"Provide a complete TypeScript implementation. Include:\");\n\t\tlines.push(\"- Type definitions for input/output\");\n\t\tlines.push(\"- Handler function with proper error handling\");\n\t\tlines.push(\"- JSDoc comments explaining the implementation\");\n\t} else if (taskType === \"test\") lines.push(\"Provide a complete test file using the testing framework available (prefer Vitest).\");\n\telse if (taskType === \"review\") {\n\t\tlines.push(\"Provide a structured review with:\");\n\t\tlines.push(\"- Compliance status (pass/fail for each requirement)\");\n\t\tlines.push(\"- Issues found with severity (error/warning/info)\");\n\t\tlines.push(\"- Suggestions for improvement\");\n\t}\n\tlines.push(\"\");\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a feature module to markdown.\n* Includes all related specs, events, and presentations.\n*/\nfunction featureToMarkdown(feature, deps, options = {}) {\n\tconst opts = {\n\t\t...DEFAULT_FEATURE_OPTIONS,\n\t\t...options\n\t};\n\tconst m = feature.meta;\n\tconst lines = [];\n\tlines.push(`# Feature: ${m.title ?? m.key}`);\n\tlines.push(\"\");\n\tif (m.description) {\n\t\tlines.push(`> ${m.description}`);\n\t\tlines.push(\"\");\n\t}\n\tlines.push(\"## Overview\");\n\tlines.push(\"\");\n\tlines.push(`- **Key:** \\`${m.key}\\``);\n\tlines.push(`- **Stability:** ${m.stability}`);\n\tlines.push(`- **Owners:** ${m.owners.join(\", \")}`);\n\tif (m.tags?.length) lines.push(`- **Tags:** ${m.tags.join(\", \")}`);\n\tlines.push(\"\");\n\tif (feature.operations?.length) {\n\t\tlines.push(\"## Operations\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"| Name | Version | Type |\");\n\t\tlines.push(\"|------|---------|------|\");\n\t\tfor (const op of feature.operations) {\n\t\t\tconst kind = (deps?.specs?.getSpec(op.name, op.version))?.meta.kind ?? \"unknown\";\n\t\t\tlines.push(`| ${op.name} | v${op.version} | ${kind} |`);\n\t\t}\n\t\tlines.push(\"\");\n\t\tif (opts.includeRelatedSpecs && deps?.specs) {\n\t\t\tlines.push(\"### Operation Details\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const op of feature.operations) {\n\t\t\t\tconst spec = deps.specs.getSpec(op.name, op.version);\n\t\t\t\tif (spec) {\n\t\t\t\t\tlines.push(`---`);\n\t\t\t\t\tlines.push(\"\");\n\t\t\t\t\tlines.push(specToFullMarkdown(spec, opts));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (feature.events?.length) {\n\t\tlines.push(\"## Events\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"| Name | Version |\");\n\t\tlines.push(\"|------|---------|\");\n\t\tfor (const evt of feature.events) lines.push(`| ${evt.name} | v${evt.version} |`);\n\t\tlines.push(\"\");\n\t}\n\tif (feature.presentations?.length) {\n\t\tlines.push(\"## Presentations\");\n\t\tlines.push(\"\");\n\t\tlines.push(\"| Name | Version |\");\n\t\tlines.push(\"|------|---------|\");\n\t\tfor (const pres of feature.presentations) lines.push(`| ${pres.name} | v${pres.version} |`);\n\t\tlines.push(\"\");\n\t\tif (opts.includeRelatedPresentations && deps?.presentations) {\n\t\t\tlines.push(\"### Presentation Details\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const pres of feature.presentations) {\n\t\t\t\tconst p = deps.presentations.get(pres.name, pres.version);\n\t\t\t\tif (p) {\n\t\t\t\t\tlines.push(`#### ${pres.name}.v${pres.version}`);\n\t\t\t\t\tlines.push(\"\");\n\t\t\t\t\tlines.push(`- **Kind:** ${p.content.kind ?? \"unknown\"}`);\n\t\t\t\t\tif (\"componentKey\" in p.content) lines.push(`- **Component:** ${p.content.componentKey}`);\n\t\t\t\t\tlines.push(\"\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif (feature.capabilities) {\n\t\tif (feature.capabilities.provides?.length) {\n\t\t\tlines.push(\"## Capabilities Provided\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const cap of feature.capabilities.provides) lines.push(`- \\`${cap.key}.v${cap.version}\\``);\n\t\t\tlines.push(\"\");\n\t\t}\n\t\tif (feature.capabilities.requires?.length) {\n\t\t\tlines.push(\"## Capabilities Required\");\n\t\t\tlines.push(\"\");\n\t\t\tfor (const cap of feature.capabilities.requires) lines.push(`- \\`${cap.key}\\`${cap.version ? `.v${cap.version}` : \"\"} (${cap.optional ? \"optional\" : \"required\"})`);\n\t\t\tlines.push(\"\");\n\t\t}\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a presentation descriptor to markdown.\n*/\nfunction presentationToMarkdown(presentation) {\n\tconst m = presentation.meta;\n\tconst lines = [];\n\tlines.push(`# Presentation: ${m.name}.v${m.version}`);\n\tlines.push(\"\");\n\tif (m.description) {\n\t\tlines.push(`> ${m.description}`);\n\t\tlines.push(\"\");\n\t}\n\tlines.push(\"## Metadata\");\n\tlines.push(\"\");\n\tlines.push(`- **Name:** ${m.name}`);\n\tlines.push(`- **Version:** ${m.version}`);\n\tif (m.stability) lines.push(`- **Stability:** ${m.stability}`);\n\tif (m.owners?.length) lines.push(`- **Owners:** ${m.owners.join(\", \")}`);\n\tif (m.tags?.length) lines.push(`- **Tags:** ${m.tags.join(\", \")}`);\n\tlines.push(\"\");\n\tlines.push(\"## Source\");\n\tlines.push(\"\");\n\tlines.push(`- **Type:** ${presentation.source.type}`);\n\tif (presentation.source.type === \"component\") {\n\t\tlines.push(`- **Framework:** ${presentation.source.framework}`);\n\t\tlines.push(`- **Component Key:** ${presentation.source.componentKey}`);\n\t}\n\tlines.push(\"\");\n\tlines.push(\"## Supported Targets\");\n\tlines.push(\"\");\n\tfor (const target of presentation.targets) lines.push(`- ${target}`);\n\tlines.push(\"\");\n\tif (presentation.policy) {\n\t\tlines.push(\"## Policy\");\n\t\tlines.push(\"\");\n\t\tif (presentation.policy.flags?.length) lines.push(`- **Feature Flags:** ${presentation.policy.flags.join(\", \")}`);\n\t\tif (presentation.policy.pii?.length) lines.push(`- **PII Fields:** ${presentation.policy.pii.join(\", \")}`);\n\t\tlines.push(\"\");\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export an event spec to markdown.\n*/\nfunction eventToMarkdown(event) {\n\tconst lines = [];\n\tlines.push(`# Event: ${event.name}.v${event.version}`);\n\tlines.push(\"\");\n\tlines.push(\"## Metadata\");\n\tlines.push(\"\");\n\tlines.push(`- **Name:** ${event.name}`);\n\tlines.push(`- **Version:** ${event.version}`);\n\tif (event.description) lines.push(`- **Description:** ${event.description}`);\n\tlines.push(\"\");\n\tlines.push(\"## Payload Schema\");\n\tlines.push(\"\");\n\tlines.push(\"```json\");\n\ttry {\n\t\tconst zodSchema = event.payload.getZod();\n\t\tif (\"shape\" in zodSchema && zodSchema.shape) {\n\t\t\tconst shape = zodSchema.shape;\n\t\t\tconst fields = Object.keys(shape);\n\t\t\tlines.push(JSON.stringify({ fields }, null, 2));\n\t\t} else lines.push(\"// Payload schema available at runtime\");\n\t} catch {\n\t\tlines.push(\"// Schema details available at runtime\");\n\t}\n\tlines.push(\"```\");\n\tlines.push(\"\");\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a DocBlock to markdown (already markdown, but formatted consistently).\n*/\nfunction docBlockToMarkdown(doc) {\n\tconst lines = [];\n\tlines.push(`# ${doc.title}`);\n\tlines.push(\"\");\n\tif (doc.summary) {\n\t\tlines.push(`> ${doc.summary}`);\n\t\tlines.push(\"\");\n\t}\n\tlines.push(\"## Metadata\");\n\tlines.push(\"\");\n\tlines.push(`- **ID:** ${doc.id}`);\n\tlines.push(`- **Kind:** ${doc.kind ?? \"reference\"}`);\n\tlines.push(`- **Visibility:** ${doc.visibility ?? \"public\"}`);\n\tif (doc.tags?.length) lines.push(`- **Tags:** ${doc.tags.join(\", \")}`);\n\tif (doc.owners?.length) lines.push(`- **Owners:** ${doc.owners.join(\", \")}`);\n\tif (doc.domain) lines.push(`- **Domain:** ${doc.domain}`);\n\tlines.push(\"\");\n\tlines.push(\"## Content\");\n\tlines.push(\"\");\n\tlines.push(doc.body);\n\tlines.push(\"\");\n\tif (doc.links?.length) {\n\t\tlines.push(\"## Related Links\");\n\t\tlines.push(\"\");\n\t\tfor (const link of doc.links) lines.push(`- [${link.label}](${link.href})`);\n\t\tlines.push(\"\");\n\t}\n\treturn lines.join(\"\\n\");\n}\n/**\n* Export a spec with a specific format.\n* Convenience function that wraps the format-specific functions.\n*/\nfunction exportSpec(spec, options = {}) {\n\tconst format = options.format ?? \"full\";\n\tlet markdown;\n\tswitch (format) {\n\t\tcase \"context\":\n\t\t\tmarkdown = specToContextMarkdown(spec);\n\t\t\tbreak;\n\t\tcase \"prompt\":\n\t\t\tmarkdown = specToAgentPrompt(spec);\n\t\t\tbreak;\n\t\tcase \"full\":\n\t\tdefault:\n\t\t\tmarkdown = specToFullMarkdown(spec, options);\n\t\t\tbreak;\n\t}\n\treturn {\n\t\tspec,\n\t\tmarkdown,\n\t\tformat,\n\t\tmeta: {\n\t\t\tspecName: spec.meta.name,\n\t\t\tspecVersion: spec.meta.version,\n\t\t\texportedAt: (/* @__PURE__ */ new Date()).toISOString(),\n\t\t\twordCount: markdown.split(/\\s+/).length\n\t\t}\n\t};\n}\n/**\n* Export a feature with a specific format.\n*/\nfunction exportFeature(feature, deps, options = {}) {\n\tconst format = options.format ?? \"full\";\n\treturn {\n\t\tfeature,\n\t\tmarkdown: featureToMarkdown(feature, deps, options),\n\t\tformat,\n\t\tincludedSpecs: feature.operations?.map((o) => `${o.name}.v${o.version}`) ?? [],\n\t\tincludedEvents: feature.events?.map((e) => `${e.name}.v${e.version}`) ?? [],\n\t\tincludedPresentations: feature.presentations?.map((p) => `${p.name}.v${p.version}`) ?? []\n\t};\n}\n\n//#endregion\nexport { docBlockToMarkdown, eventToMarkdown, exportFeature, exportSpec, featureToMarkdown, presentationToMarkdown, specToAgentPrompt, specToContextMarkdown, specToFullMarkdown };"],"mappings":";;;AAIA,MAAM,uBAAuB;CAC5B,QAAQ;CACR,gBAAgB;CAChB,kBAAkB;CAClB,iBAAiB;CACjB,eAAe;CACf,oBAAoB;CACpB;AACD,MAAM,0BAA0B;CAC/B,GAAG;CACH,qBAAqB;CACrB,sBAAsB;CACtB,6BAA6B;CAC7B"}
|