@lssm/lib.contracts 0.0.0-canary-20251212230121 → 0.0.0-canary-20251215220103

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.
Files changed (87) hide show
  1. package/dist/contract-registry/index.js +1 -0
  2. package/dist/contract-registry/schemas.js +1 -0
  3. package/dist/contract-registry/types.js +0 -0
  4. package/dist/docs/index.js +1 -1
  5. package/dist/docs/tech/auth/better-auth-nextjs.docblock.js +58 -0
  6. package/dist/docs/tech/contracts/README.docblock.js +1 -1
  7. package/dist/docs/tech/contracts/openapi-export.docblock.js +38 -0
  8. package/dist/docs/tech/mcp-endpoints.docblock.js +1 -1
  9. package/dist/docs/tech/studio/learning-events.docblock.js +1 -0
  10. package/dist/docs/tech/studio/learning-journeys.docblock.js +57 -0
  11. package/dist/docs/tech/studio/platform-admin-panel.docblock.js +63 -0
  12. package/dist/docs/tech/studio/project-access-teams.docblock.js +36 -0
  13. package/dist/docs/tech/studio/project-routing.docblock.js +1 -0
  14. package/dist/docs/tech/studio/sandbox-unlogged.docblock.js +20 -0
  15. package/dist/docs/tech/studio/team-invitations.docblock.js +65 -0
  16. package/dist/docs/tech/studio/workspace-ops.docblock.js +1 -0
  17. package/dist/docs/tech/studio/workspaces.docblock.js +41 -0
  18. package/dist/docs/tech/telemetry-ingest.docblock.js +122 -0
  19. package/dist/docs/tech/vscode-extension.docblock.js +68 -0
  20. package/dist/index.js +1 -1
  21. package/dist/integrations/docs/integrations.docblock.js +1 -101
  22. package/dist/integrations/index.js +1 -1
  23. package/dist/integrations/providers/impls/index.js +1 -1
  24. package/dist/integrations/providers/impls/provider-factory.js +1 -1
  25. package/dist/integrations/providers/index.js +1 -1
  26. package/dist/integrations/providers/registry.js +1 -0
  27. package/dist/integrations/secrets/aws-secret-manager.js +1 -0
  28. package/dist/integrations/secrets/index.js +1 -1
  29. package/dist/integrations/secrets/scaleway-secret-manager.js +1 -0
  30. package/dist/jobs/define-job.js +1 -1
  31. package/dist/jobs/gcp-cloud-tasks.js +1 -1
  32. package/dist/jobs/gcp-pubsub.js +1 -1
  33. package/dist/jobs/handlers/index.js +1 -1
  34. package/dist/jobs/index.js +1 -1
  35. package/dist/jobs/memory-queue.js +1 -1
  36. package/dist/jobs/queue.js +1 -0
  37. package/dist/jobs/scaleway-sqs-queue.js +1 -1
  38. package/dist/node_modules/@pothos/plugin-prisma/esm/util/datamodel.js +1 -1
  39. package/dist/node_modules/@pothos/plugin-prisma/esm/util/map-query.js +1 -1
  40. package/dist/openapi.js +1 -0
  41. package/dist/server/index.js +1 -1
  42. package/dist/server/mcp/createMcpServer.js +1 -0
  43. package/dist/server/mcp/mcpTypes.js +0 -0
  44. package/dist/server/mcp/registerPresentations.js +1 -0
  45. package/dist/server/mcp/registerPrompts.js +3 -0
  46. package/dist/server/mcp/registerResources.js +1 -0
  47. package/dist/server/mcp/registerTools.js +1 -0
  48. package/dist/server/provider-mcp.js +1 -1
  49. package/package.json +65 -11
  50. package/dist/node_modules/zod-to-json-schema/dist/esm/Options.js +0 -1
  51. package/dist/node_modules/zod-to-json-schema/dist/esm/Refs.js +0 -1
  52. package/dist/node_modules/zod-to-json-schema/dist/esm/errorMessages.js +0 -1
  53. package/dist/node_modules/zod-to-json-schema/dist/esm/getRelativePath.js +0 -1
  54. package/dist/node_modules/zod-to-json-schema/dist/esm/index.js +0 -1
  55. package/dist/node_modules/zod-to-json-schema/dist/esm/parseDef.js +0 -1
  56. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/any.js +0 -1
  57. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/array.js +0 -1
  58. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js +0 -1
  59. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js +0 -1
  60. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/branded.js +0 -1
  61. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/catch.js +0 -1
  62. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/date.js +0 -1
  63. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/default.js +0 -1
  64. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/effects.js +0 -1
  65. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/enum.js +0 -1
  66. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js +0 -1
  67. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/literal.js +0 -1
  68. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/map.js +0 -1
  69. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js +0 -1
  70. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/never.js +0 -1
  71. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/null.js +0 -1
  72. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js +0 -1
  73. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/number.js +0 -1
  74. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/object.js +0 -1
  75. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/optional.js +0 -1
  76. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js +0 -1
  77. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/promise.js +0 -1
  78. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js +0 -1
  79. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/record.js +0 -1
  80. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/set.js +0 -1
  81. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +0 -3
  82. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js +0 -1
  83. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js +0 -1
  84. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/union.js +0 -1
  85. package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js +0 -1
  86. package/dist/node_modules/zod-to-json-schema/dist/esm/selectParser.js +0 -1
  87. package/dist/node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js +0 -1
@@ -0,0 +1,68 @@
1
+ import{registerDocBlocks as e}from"../registry.js";const t=[{id:`docs.tech.vscode.extension`,title:`ContractSpec VS Code Extension`,summary:`VS Code extension for spec-first development with validation, scaffolding, and MCP integration.`,kind:`reference`,visibility:`public`,route:`/docs/tech/vscode/extension`,tags:[`vscode`,`extension`,`tooling`,`dx`],body:`# ContractSpec VS Code Extension
2
+
3
+ The ContractSpec VS Code extension provides spec-first development tooling directly in your editor.
4
+
5
+ ## Features
6
+
7
+ - **Real-time Validation**: Get instant feedback on spec errors and warnings as you save files
8
+ - **Build/Scaffold**: Generate handler and component skeletons from specs (no AI required)
9
+ - **Spec Explorer**: List and navigate all specs in your workspace
10
+ - **Dependency Analysis**: Visualize spec dependencies and detect cycles
11
+ - **MCP Integration**: Search ContractSpec documentation via Model Context Protocol
12
+ - **Snippets**: Code snippets for common ContractSpec patterns
13
+
14
+ ## Commands
15
+
16
+ | Command | Description |
17
+ |---------|-------------|
18
+ | \`ContractSpec: Validate Current Spec\` | Validate the currently open spec file |
19
+ | \`ContractSpec: Validate All Specs\` | Validate all spec files in the workspace |
20
+ | \`ContractSpec: Build/Scaffold\` | Generate handler/component from the current spec |
21
+ | \`ContractSpec: List All Specs\` | Show all specs in the workspace |
22
+ | \`ContractSpec: Analyze Dependencies\` | Analyze and visualize spec dependencies |
23
+ | \`ContractSpec: Search Docs (MCP)\` | Search documentation via MCP |
24
+
25
+ ## Configuration
26
+
27
+ | Setting | Description | Default |
28
+ |---------|-------------|---------|
29
+ | \`contractspec.api.baseUrl\` | Base URL for ContractSpec API (enables MCP + remote telemetry) | \`""\` |
30
+ | \`contractspec.telemetry.posthogHost\` | PostHog host URL for direct telemetry | \`"https://eu.posthog.com"\` |
31
+ | \`contractspec.telemetry.posthogProjectKey\` | PostHog project key for direct telemetry | \`""\` |
32
+ | \`contractspec.validation.onSave\` | Run validation on save | \`true\` |
33
+ | \`contractspec.validation.onOpen\` | Run validation on open | \`true\` |
34
+
35
+ ## Architecture
36
+
37
+ The extension uses:
38
+ - \`@lssm/module.contractspec-workspace\` for pure analysis + templates
39
+ - \`@lssm/bundle.contractspec-workspace\` for workspace services + adapters
40
+
41
+ This allows the extension to work without requiring the CLI to be installed.
42
+
43
+ ## Telemetry
44
+
45
+ The extension uses a hybrid telemetry approach:
46
+ 1. If \`contractspec.api.baseUrl\` is configured → send to API \`/api/telemetry/ingest\`
47
+ 2. Otherwise → send directly to PostHog (if project key configured)
48
+
49
+ Telemetry respects VS Code's telemetry settings. No file paths, source code, or PII is collected.
50
+ `},{id:`docs.tech.vscode.snippets`,title:`ContractSpec Snippets`,summary:`Code snippets for common ContractSpec patterns in VS Code.`,kind:`reference`,visibility:`public`,route:`/docs/tech/vscode/snippets`,tags:[`vscode`,`snippets`,`dx`],body:`# ContractSpec Snippets
51
+
52
+ The VS Code extension includes snippets for common ContractSpec patterns.
53
+
54
+ ## Available Snippets
55
+
56
+ | Prefix | Description |
57
+ |--------|-------------|
58
+ | \`contractspec-command\` | Create a new command (write operation) |
59
+ | \`contractspec-query\` | Create a new query (read-only operation) |
60
+ | \`contractspec-event\` | Create a new event |
61
+ | \`contractspec-docblock\` | Create a new DocBlock |
62
+ | \`contractspec-telemetry\` | Create a new TelemetrySpec |
63
+ | \`contractspec-presentation\` | Create a new Presentation |
64
+
65
+ ## Usage
66
+
67
+ Type the prefix in a TypeScript file and press Tab to expand the snippet. Tab through the placeholders to fill in your values.
68
+ `}];e(t);export{t as tech_vscode_extension_DocBlocks};
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{CapabilityRegistry as e,capabilityKey as t,defineCapability as n}from"./capabilities.js";import{DataViewRegistry as r,dataViewKey as i}from"./data-views.js";import{defineEvent as a,eventKey as o}from"./events.js";import{FeatureRegistry as s,installFeature as c,validateFeatureTargetsV2 as l}from"./features.js";import{FormRegistry as u,buildZodWithRelations as d,defineFormSpec as f,evalPredicate as p}from"./forms.js";import{schemaToMarkdown as m,schemaToMarkdownDetail as h,schemaToMarkdownList as g,schemaToMarkdownSummary as _,schemaToMarkdownTable as v}from"./schema-to-markdown.js";import{TransformEngine as y,createDefaultTransformEngine as b,registerBasicValidation as x,registerDefaultReactRenderer as S,registerReactToMarkdownRenderer as C}from"./presentations.v2.js";import{createEngineWithDefaults as w,createFeatureModule as T,registerFeature as E,renderFeaturePresentation as D}from"./client/react/feature-render.js";import{createFormRenderer as O}from"./client/react/form-render.js";import{shadcnDriver as k}from"./client/react/drivers/shadcn.js";import{rnReusablesDriver as A}from"./client/react/drivers/rn-reusables.js";import"./client/index.js";import{defaultGqlField as j,defaultMcpTool as M,defaultRestPath as N,jsonSchemaForSpec as P}from"./jsonschema.js";import{registerContractsOnBuilder as F}from"./server/graphql-pothos.js";import{PresentationRegistry as I,jsonSchemaForPresentation as L}from"./presentations.js";import{createMcpServer as R}from"./server/provider-mcp.js";import{createFetchHandler as z}from"./server/rest-generic.js";import{elysiaPlugin as B}from"./server/rest-elysia.js";import{expressRouter as V}from"./server/rest-express.js";import{makeNextAppHandler as H}from"./server/rest-next-app.js";import{makeNextPagesHandler as U}from"./server/rest-next-pages.js";import"./server/index.js";import{defineCommand as W,defineQuery as G,isEmitDeclRef as K}from"./spec.js";import{docBlockToPresentationSpec as q,docBlockToPresentationV2 as J,docBlocksToPresentationRoutes as Y,docBlocksToPresentationSpecs as X,mapDocRoutes as Z}from"./docs/presentations.js";import{DocRegistry as Q,defaultDocRegistry as $,docId as ee,listRegisteredDocBlocks as te,registerDocBlocks as ne}from"./docs/registry.js";import{SpecRegistry as re,opKey as ie}from"./registry.js";import{installOp as ae,makeEmit as oe,op as se}from"./install.js";import{definePrompt as ce}from"./prompt.js";import{PromptRegistry as le}from"./promptRegistry.js";import{ResourceRegistry as ue,defineResourceTemplate as de,isResourceRef as fe,resourceRef as pe}from"./resources.js";import{toV2FromV1 as me}from"./presentations.backcompat.js";import{Owners as he,OwnersEnum as ge,StabilityEnum as _e,Tags as ve,TagsEnum as ye}from"./ownership.js";import{CompleteOnboardingBaseInput as be,CompleteOnboardingBaseOutput as xe,CompleteOnboardingBaseSpec as Se,DeleteOnboardingDraftBaseSpec as Ce,DeleteOnboardingDraftOutput as we,GetOnboardingDraftBaseSpec as Te,GetOnboardingDraftOutput as Ee,SaveOnboardingDraftBaseSpec as De,SaveOnboardingDraftInput as Oe,SaveOnboardingDraftOutput as ke}from"./onboarding-base.js";import{openBankingAccountsReadCapability as Ae,openBankingBalancesReadCapability as je,openBankingTransactionsReadCapability as Me,registerOpenBankingCapabilities as Ne}from"./capabilities/openbanking.js";import{PolicyRegistry as Pe,makePolicyKey as Fe}from"./policy/spec.js";import{PolicyEngine as Ie}from"./policy/engine.js";import{OPAPolicyAdapter as Le,buildOPAInput as Re}from"./policy/opa-adapter.js";import{ThemeRegistry as ze,makeThemeRef as Be}from"./themes.js";import{MigrationRegistry as Ve}from"./migrations.js";import{TelemetryRegistry as He,makeTelemetryKey as Ue}from"./telemetry/spec.js";import{TelemetryTracker as We}from"./telemetry/tracker.js";import{TelemetryAnomalyMonitor as Ge}from"./telemetry/anomaly.js";import"./telemetry/index.js";import{TestRegistry as Ke,makeTestKey as qe}from"./tests/spec.js";import{TestRunner as Je}from"./tests/runner.js";import"./tests/index.js";import{ExperimentRegistry as Ye,makeExperimentKey as Xe}from"./experiments/spec.js";import{ExperimentEvaluator as Ze}from"./experiments/evaluator.js";import{AppBlueprintRegistry as Qe,makeAppBlueprintKey as $e}from"./app-config/spec.js";import{composeAppConfig as et,resolveAppConfig as tt}from"./app-config/runtime.js";import{IntegrationSpecRegistry as nt,makeIntegrationSpecKey as rt}from"./integrations/spec.js";import{registerStripeIntegration as it,stripeIntegrationSpec as at}from"./integrations/providers/stripe.js";import{postmarkIntegrationSpec as ot,registerPostmarkIntegration as st}from"./integrations/providers/postmark.js";import{qdrantIntegrationSpec as ct,registerQdrantIntegration as lt}from"./integrations/providers/qdrant.js";import{mistralIntegrationSpec as ut,registerMistralIntegration as dt}from"./integrations/providers/mistral.js";import{elevenLabsIntegrationSpec as ft,registerElevenLabsIntegration as pt}from"./integrations/providers/elevenlabs.js";import{gmailIntegrationSpec as mt,registerGmailIntegration as ht}from"./integrations/providers/gmail.js";import{googleCalendarIntegrationSpec as gt,registerGoogleCalendarIntegration as _t}from"./integrations/providers/google-calendar.js";import{registerTwilioSmsIntegration as vt,twilioSmsIntegrationSpec as yt}from"./integrations/providers/twilio-sms.js";import{gcsStorageIntegrationSpec as bt,registerGcsStorageIntegration as xt}from"./integrations/providers/gcs-storage.js";import{powensIntegrationSpec as St,registerPowensIntegration as Ct}from"./integrations/providers/powens.js";import{MistralLLMProvider as wt}from"./integrations/providers/impls/mistral-llm.js";import{MistralEmbeddingProvider as Tt}from"./integrations/providers/impls/mistral-embedding.js";import{QdrantVectorProvider as Et}from"./integrations/providers/impls/qdrant-vector.js";import{GmailInboundProvider as Dt}from"./integrations/providers/impls/gmail-inbound.js";import{GmailOutboundProvider as Ot}from"./integrations/providers/impls/gmail-outbound.js";import{GoogleCalendarProvider as kt}from"./integrations/providers/impls/google-calendar.js";import{ElevenLabsVoiceProvider as At}from"./integrations/providers/impls/elevenlabs-voice.js";import{GoogleCloudStorageProvider as jt}from"./integrations/providers/impls/gcs-storage.js";import{StripePaymentsProvider as Mt}from"./integrations/providers/impls/stripe-payments.js";import{PostmarkEmailProvider as Nt}from"./integrations/providers/impls/postmark-email.js";import{TwilioSmsProvider as Pt}from"./integrations/providers/impls/twilio-sms.js";import{PowensClient as Ft,PowensClientError as It}from"./integrations/providers/impls/powens-client.js";import{PowensOpenBankingProvider as Lt}from"./integrations/providers/impls/powens-openbanking.js";import{IntegrationProviderFactory as Rt}from"./integrations/providers/impls/provider-factory.js";import{SecretProviderError as zt,normalizeSecretPayload as Bt,parseSecretUri as Vt}from"./integrations/secrets/provider.js";import{GcpSecretManagerProvider as Ht}from"./integrations/secrets/gcp-secret-manager.js";import{EnvSecretProvider as Ut}from"./integrations/secrets/env-secret-provider.js";import{SecretProviderManager as Wt}from"./integrations/secrets/manager.js";import{IntegrationCallGuard as Gt,connectionStatusLabel as Kt,ensureConnectionReady as qt}from"./integrations/runtime.js";import{IntegrationHealthService as Jt}from"./integrations/health.js";import{AccountBalanceRecord as Yt,BankAccountRecord as Xt,BankTransactionRecord as Zt}from"./integrations/openbanking/models.js";import{OPENBANKING_PII_FIELDS as Qt,OPENBANKING_TELEMETRY_EVENTS as $t,redactOpenBankingTelemetryPayload as en}from"./integrations/openbanking/telemetry.js";import{OpenBankingGetAccount as tn,OpenBankingListAccounts as nn,OpenBankingSyncAccounts as rn}from"./integrations/openbanking/contracts/accounts.js";import{OpenBankingListTransactions as an,OpenBankingSyncTransactions as on}from"./integrations/openbanking/contracts/transactions.js";import{OpenBankingGetBalances as sn,OpenBankingRefreshBalances as cn}from"./integrations/openbanking/contracts/balances.js";import{registerOpenBankingContracts as ln}from"./integrations/openbanking/contracts/index.js";import{assertPrimaryOpenBankingReady as un,ensurePrimaryOpenBankingIntegration as dn}from"./integrations/openbanking/guards.js";import"./integrations/index.js";import{KnowledgeSpaceRegistry as fn,makeKnowledgeSpaceKey as pn}from"./knowledge/spec.js";import{productCanonKnowledgeSpace as mn,registerProductCanonKnowledgeSpace as hn}from"./knowledge/spaces/product-canon.js";import{registerSupportFaqKnowledgeSpace as gn,supportFaqKnowledgeSpace as _n}from"./knowledge/spaces/support-faq.js";import{emailThreadsKnowledgeSpace as vn,registerEmailThreadsKnowledgeSpace as yn}from"./knowledge/spaces/email-threads.js";import{registerUploadedDocsKnowledgeSpace as bn,uploadedDocsKnowledgeSpace as xn}from"./knowledge/spaces/uploaded-docs.js";import{financialDocsKnowledgeSpace as Sn,registerFinancialDocsKnowledgeSpace as Cn}from"./knowledge/spaces/financial-docs.js";import{financialOverviewKnowledgeSpace as wn,registerFinancialOverviewKnowledgeSpace as Tn}from"./knowledge/spaces/financial-overview.js";import"./knowledge/index.js";import{CreateIntegrationConnection as En,DeleteIntegrationConnection as Dn,ListIntegrationConnections as On,TestIntegrationConnection as kn,UpdateIntegrationConnection as An,integrationContracts as jn,registerIntegrationContracts as Mn}from"./integrations/contracts.js";import{CreateKnowledgeSource as Nn,DeleteKnowledgeSource as Pn,ListKnowledgeSources as Fn,TriggerKnowledgeSourceSync as In,UpdateKnowledgeSource as Ln,knowledgeContracts as Rn,registerKnowledgeContracts as zn}from"./knowledge/contracts.js";import{behaviorToEnvelope as Bn,errorToEnvelope as Vn,telemetryToEnvelope as Hn}from"./regenerator/utils.js";import{RegeneratorService as Un}from"./regenerator/service.js";import{ProposalExecutor as Wn}from"./regenerator/executor.js";import{ExecutorProposalSink as Gn}from"./regenerator/sinks.js";import"./regenerator/index.js";import{WorkflowRegistry as Kn}from"./workflow/spec.js";import{WorkflowValidationError as qn,assertWorkflowSpecValid as Jn,validateWorkflowSpec as Yn}from"./workflow/validation.js";import{evaluateExpression as Xn}from"./workflow/expression.js";import{WorkflowPreFlightError as Zn,WorkflowRunner as Qn}from"./workflow/runner.js";import{InMemoryStateStore as $n}from"./workflow/adapters/memory-store.js";import{PrismaStateStore as er}from"./workflow/adapters/db-adapter.js";import{createFileStateStore as tr}from"./workflow/adapters/file-adapter.js";import"./workflow/index.js";import{techContractsDocs as nr}from"./docs/tech-contracts.docs.js";import{metaDocs as rr}from"./docs/meta.docs.js";import"./docs/index.js";import{defineSchemaModel as ir}from"@lssm/lib.schema";export{Yt as AccountBalanceRecord,Qe as AppBlueprintRegistry,Xt as BankAccountRecord,Zt as BankTransactionRecord,e as CapabilityRegistry,be as CompleteOnboardingBaseInput,xe as CompleteOnboardingBaseOutput,Se as CompleteOnboardingBaseSpec,En as CreateIntegrationConnection,Nn as CreateKnowledgeSource,r as DataViewRegistry,Dn as DeleteIntegrationConnection,Pn as DeleteKnowledgeSource,Ce as DeleteOnboardingDraftBaseSpec,we as DeleteOnboardingDraftOutput,Q as DocRegistry,At as ElevenLabsVoiceProvider,Ut as EnvSecretProvider,Gn as ExecutorProposalSink,Ze as ExperimentEvaluator,Ye as ExperimentRegistry,s as FeatureRegistry,u as FormRegistry,Ht as GcpSecretManagerProvider,Te as GetOnboardingDraftBaseSpec,Ee as GetOnboardingDraftOutput,Dt as GmailInboundProvider,Ot as GmailOutboundProvider,kt as GoogleCalendarProvider,jt as GoogleCloudStorageProvider,$n as InMemoryStateStore,Gt as IntegrationCallGuard,Jt as IntegrationHealthService,Rt as IntegrationProviderFactory,nt as IntegrationSpecRegistry,fn as KnowledgeSpaceRegistry,On as ListIntegrationConnections,Fn as ListKnowledgeSources,Ve as MigrationRegistry,Tt as MistralEmbeddingProvider,wt as MistralLLMProvider,Le as OPAPolicyAdapter,Qt as OPENBANKING_PII_FIELDS,$t as OPENBANKING_TELEMETRY_EVENTS,tn as OpenBankingGetAccount,sn as OpenBankingGetBalances,nn as OpenBankingListAccounts,an as OpenBankingListTransactions,cn as OpenBankingRefreshBalances,rn as OpenBankingSyncAccounts,on as OpenBankingSyncTransactions,he as Owners,ge as OwnersEnum,Ie as PolicyEngine,Pe as PolicyRegistry,Nt as PostmarkEmailProvider,Ft as PowensClient,It as PowensClientError,Lt as PowensOpenBankingProvider,I as PresentationRegistry,er as PrismaStateStore,le as PromptRegistry,Wn as ProposalExecutor,Et as QdrantVectorProvider,Un as RegeneratorService,ue as ResourceRegistry,De as SaveOnboardingDraftBaseSpec,Oe as SaveOnboardingDraftInput,ke as SaveOnboardingDraftOutput,zt as SecretProviderError,Wt as SecretProviderManager,re as SpecRegistry,_e as StabilityEnum,Mt as StripePaymentsProvider,ve as Tags,ye as TagsEnum,Ge as TelemetryAnomalyMonitor,He as TelemetryRegistry,We as TelemetryTracker,kn as TestIntegrationConnection,Ke as TestRegistry,Je as TestRunner,ze as ThemeRegistry,y as TransformEngine,In as TriggerKnowledgeSourceSync,Pt as TwilioSmsProvider,An as UpdateIntegrationConnection,Ln as UpdateKnowledgeSource,Zn as WorkflowPreFlightError,Kn as WorkflowRegistry,Qn as WorkflowRunner,qn as WorkflowValidationError,un as assertPrimaryOpenBankingReady,Jn as assertWorkflowSpecValid,Bn as behaviorToEnvelope,Re as buildOPAInput,d as buildZodWithRelations,t as capabilityKey,et as composeAppConfig,Kt as connectionStatusLabel,b as createDefaultTransformEngine,w as createEngineWithDefaults,T as createFeatureModule,z as createFetchHandler,tr as createFileStateStore,O as createFormRenderer,R as createMcpServer,i as dataViewKey,$ as defaultDocRegistry,j as defaultGqlField,M as defaultMcpTool,N as defaultRestPath,n as defineCapability,W as defineCommand,a as defineEvent,f as defineFormSpec,ce as definePrompt,G as defineQuery,de as defineResourceTemplate,ir as defineSchemaModel,q as docBlockToPresentationSpec,J as docBlockToPresentationV2,Y as docBlocksToPresentationRoutes,X as docBlocksToPresentationSpecs,ee as docId,ft as elevenLabsIntegrationSpec,B as elysiaPlugin,vn as emailThreadsKnowledgeSpace,qt as ensureConnectionReady,dn as ensurePrimaryOpenBankingIntegration,Vn as errorToEnvelope,p as evalPredicate,Xn as evaluateExpression,o as eventKey,V as expressRouter,Sn as financialDocsKnowledgeSpace,wn as financialOverviewKnowledgeSpace,bt as gcsStorageIntegrationSpec,mt as gmailIntegrationSpec,gt as googleCalendarIntegrationSpec,c as installFeature,ae as installOp,jn as integrationContracts,K as isEmitDeclRef,fe as isResourceRef,L as jsonSchemaForPresentation,P as jsonSchemaForSpec,Rn as knowledgeContracts,te as listRegisteredDocBlocks,$e as makeAppBlueprintKey,oe as makeEmit,Xe as makeExperimentKey,rt as makeIntegrationSpecKey,pn as makeKnowledgeSpaceKey,H as makeNextAppHandler,U as makeNextPagesHandler,Fe as makePolicyKey,Ue as makeTelemetryKey,qe as makeTestKey,Be as makeThemeRef,Z as mapDocRoutes,rr as metaDocs,ut as mistralIntegrationSpec,Bt as normalizeSecretPayload,se as op,ie as opKey,Ae as openBankingAccountsReadCapability,je as openBankingBalancesReadCapability,Me as openBankingTransactionsReadCapability,Vt as parseSecretUri,ot as postmarkIntegrationSpec,St as powensIntegrationSpec,mn as productCanonKnowledgeSpace,ct as qdrantIntegrationSpec,en as redactOpenBankingTelemetryPayload,x as registerBasicValidation,F as registerContractsOnBuilder,S as registerDefaultReactRenderer,ne as registerDocBlocks,pt as registerElevenLabsIntegration,yn as registerEmailThreadsKnowledgeSpace,E as registerFeature,Cn as registerFinancialDocsKnowledgeSpace,Tn as registerFinancialOverviewKnowledgeSpace,xt as registerGcsStorageIntegration,ht as registerGmailIntegration,_t as registerGoogleCalendarIntegration,Mn as registerIntegrationContracts,zn as registerKnowledgeContracts,dt as registerMistralIntegration,Ne as registerOpenBankingCapabilities,ln as registerOpenBankingContracts,st as registerPostmarkIntegration,Ct as registerPowensIntegration,hn as registerProductCanonKnowledgeSpace,lt as registerQdrantIntegration,C as registerReactToMarkdownRenderer,it as registerStripeIntegration,gn as registerSupportFaqKnowledgeSpace,vt as registerTwilioSmsIntegration,bn as registerUploadedDocsKnowledgeSpace,D as renderFeaturePresentation,tt as resolveAppConfig,pe as resourceRef,A as rnReusablesDriver,m as schemaToMarkdown,h as schemaToMarkdownDetail,g as schemaToMarkdownList,_ as schemaToMarkdownSummary,v as schemaToMarkdownTable,k as shadcnDriver,at as stripeIntegrationSpec,_n as supportFaqKnowledgeSpace,nr as techContractsDocs,Hn as telemetryToEnvelope,me as toV2FromV1,yt as twilioSmsIntegrationSpec,xn as uploadedDocsKnowledgeSpace,l as validateFeatureTargetsV2,Yn as validateWorkflowSpec};
1
+ import{CapabilityRegistry as e,capabilityKey as t,defineCapability as n}from"./capabilities.js";import{DataViewRegistry as r,dataViewKey as i}from"./data-views.js";import{defineEvent as a,eventKey as o}from"./events.js";import{FeatureRegistry as s,installFeature as c,validateFeatureTargetsV2 as l}from"./features.js";import{FormRegistry as u,buildZodWithRelations as d,defineFormSpec as f,evalPredicate as p}from"./forms.js";import{schemaToMarkdown as m,schemaToMarkdownDetail as h,schemaToMarkdownList as g,schemaToMarkdownSummary as _,schemaToMarkdownTable as v}from"./schema-to-markdown.js";import{TransformEngine as y,createDefaultTransformEngine as b,registerBasicValidation as x,registerDefaultReactRenderer as S,registerReactToMarkdownRenderer as C}from"./presentations.v2.js";import{createEngineWithDefaults as w,createFeatureModule as T,registerFeature as E,renderFeaturePresentation as D}from"./client/react/feature-render.js";import{createFormRenderer as O}from"./client/react/form-render.js";import{shadcnDriver as k}from"./client/react/drivers/shadcn.js";import{rnReusablesDriver as A}from"./client/react/drivers/rn-reusables.js";import"./client/index.js";import{defaultGqlField as j,defaultMcpTool as M,defaultRestPath as N,jsonSchemaForSpec as P}from"./jsonschema.js";import{registerContractsOnBuilder as F}from"./server/graphql-pothos.js";import{PresentationRegistry as I,jsonSchemaForPresentation as L}from"./presentations.js";import{createMcpServer as R}from"./server/mcp/createMcpServer.js";import{createFetchHandler as z}from"./server/rest-generic.js";import{elysiaPlugin as B}from"./server/rest-elysia.js";import{expressRouter as V}from"./server/rest-express.js";import{makeNextAppHandler as H}from"./server/rest-next-app.js";import{makeNextPagesHandler as U}from"./server/rest-next-pages.js";import"./server/index.js";import{defineCommand as W,defineQuery as G,isEmitDeclRef as K}from"./spec.js";import{docBlockToPresentationSpec as q,docBlockToPresentationV2 as J,docBlocksToPresentationRoutes as Y,docBlocksToPresentationSpecs as X,mapDocRoutes as Z}from"./docs/presentations.js";import{DocRegistry as Q,defaultDocRegistry as $,docId as ee,listRegisteredDocBlocks as te,registerDocBlocks as ne}from"./docs/registry.js";import{SpecRegistry as re,opKey as ie}from"./registry.js";import{Owners as ae,OwnersEnum as oe,StabilityEnum as se,Tags as ce,TagsEnum as le}from"./ownership.js";import{ContractRegistryFileSchema as ue,ContractRegistryItemSchema as de,ContractRegistryItemTypeSchema as fe,ContractRegistryManifestSchema as pe}from"./contract-registry/schemas.js";import"./contract-registry/index.js";import{installOp as me,makeEmit as he,op as ge}from"./install.js";import{openApiForRegistry as _e}from"./openapi.js";import{definePrompt as ve}from"./prompt.js";import{PromptRegistry as ye}from"./promptRegistry.js";import{ResourceRegistry as be,defineResourceTemplate as xe,isResourceRef as Se,resourceRef as Ce}from"./resources.js";import{toV2FromV1 as we}from"./presentations.backcompat.js";import{CompleteOnboardingBaseInput as Te,CompleteOnboardingBaseOutput as Ee,CompleteOnboardingBaseSpec as De,DeleteOnboardingDraftBaseSpec as Oe,DeleteOnboardingDraftOutput as ke,GetOnboardingDraftBaseSpec as Ae,GetOnboardingDraftOutput as je,SaveOnboardingDraftBaseSpec as Me,SaveOnboardingDraftInput as Ne,SaveOnboardingDraftOutput as Pe}from"./onboarding-base.js";import{openBankingAccountsReadCapability as Fe,openBankingBalancesReadCapability as Ie,openBankingTransactionsReadCapability as Le,registerOpenBankingCapabilities as Re}from"./capabilities/openbanking.js";import{PolicyRegistry as ze,makePolicyKey as Be}from"./policy/spec.js";import{PolicyEngine as Ve}from"./policy/engine.js";import{OPAPolicyAdapter as He,buildOPAInput as Ue}from"./policy/opa-adapter.js";import{ThemeRegistry as We,makeThemeRef as Ge}from"./themes.js";import{MigrationRegistry as Ke}from"./migrations.js";import{TelemetryRegistry as qe,makeTelemetryKey as Je}from"./telemetry/spec.js";import{TelemetryTracker as Ye}from"./telemetry/tracker.js";import{TelemetryAnomalyMonitor as Xe}from"./telemetry/anomaly.js";import"./telemetry/index.js";import{TestRegistry as Ze,makeTestKey as Qe}from"./tests/spec.js";import{TestRunner as $e}from"./tests/runner.js";import"./tests/index.js";import{ExperimentRegistry as et,makeExperimentKey as tt}from"./experiments/spec.js";import{ExperimentEvaluator as nt}from"./experiments/evaluator.js";import{AppBlueprintRegistry as rt,makeAppBlueprintKey as it}from"./app-config/spec.js";import{composeAppConfig as at,resolveAppConfig as ot}from"./app-config/runtime.js";import{IntegrationSpecRegistry as st,makeIntegrationSpecKey as ct}from"./integrations/spec.js";import{registerStripeIntegration as lt,stripeIntegrationSpec as ut}from"./integrations/providers/stripe.js";import{postmarkIntegrationSpec as dt,registerPostmarkIntegration as ft}from"./integrations/providers/postmark.js";import{qdrantIntegrationSpec as pt,registerQdrantIntegration as mt}from"./integrations/providers/qdrant.js";import{mistralIntegrationSpec as ht,registerMistralIntegration as gt}from"./integrations/providers/mistral.js";import{elevenLabsIntegrationSpec as _t,registerElevenLabsIntegration as vt}from"./integrations/providers/elevenlabs.js";import{gmailIntegrationSpec as yt,registerGmailIntegration as bt}from"./integrations/providers/gmail.js";import{googleCalendarIntegrationSpec as xt,registerGoogleCalendarIntegration as St}from"./integrations/providers/google-calendar.js";import{registerTwilioSmsIntegration as Ct,twilioSmsIntegrationSpec as wt}from"./integrations/providers/twilio-sms.js";import{gcsStorageIntegrationSpec as Tt,registerGcsStorageIntegration as Et}from"./integrations/providers/gcs-storage.js";import{powensIntegrationSpec as Dt,registerPowensIntegration as Ot}from"./integrations/providers/powens.js";import{createDefaultIntegrationSpecRegistry as kt}from"./integrations/providers/registry.js";import{AccountBalanceRecord as At,BankAccountRecord as jt,BankTransactionRecord as Mt}from"./integrations/openbanking/models.js";import{OPENBANKING_PII_FIELDS as Nt,OPENBANKING_TELEMETRY_EVENTS as Pt,redactOpenBankingTelemetryPayload as Ft}from"./integrations/openbanking/telemetry.js";import{OpenBankingGetAccount as It,OpenBankingListAccounts as Lt,OpenBankingSyncAccounts as Rt}from"./integrations/openbanking/contracts/accounts.js";import{OpenBankingListTransactions as zt,OpenBankingSyncTransactions as Bt}from"./integrations/openbanking/contracts/transactions.js";import{OpenBankingGetBalances as Vt,OpenBankingRefreshBalances as Ht}from"./integrations/openbanking/contracts/balances.js";import{registerOpenBankingContracts as Ut}from"./integrations/openbanking/contracts/index.js";import{assertPrimaryOpenBankingReady as Wt,ensurePrimaryOpenBankingIntegration as Gt}from"./integrations/openbanking/guards.js";import"./integrations/index.js";import{KnowledgeSpaceRegistry as Kt,makeKnowledgeSpaceKey as qt}from"./knowledge/spec.js";import{productCanonKnowledgeSpace as Jt,registerProductCanonKnowledgeSpace as Yt}from"./knowledge/spaces/product-canon.js";import{registerSupportFaqKnowledgeSpace as Xt,supportFaqKnowledgeSpace as Zt}from"./knowledge/spaces/support-faq.js";import{emailThreadsKnowledgeSpace as Qt,registerEmailThreadsKnowledgeSpace as $t}from"./knowledge/spaces/email-threads.js";import{registerUploadedDocsKnowledgeSpace as en,uploadedDocsKnowledgeSpace as tn}from"./knowledge/spaces/uploaded-docs.js";import{financialDocsKnowledgeSpace as nn,registerFinancialDocsKnowledgeSpace as rn}from"./knowledge/spaces/financial-docs.js";import{financialOverviewKnowledgeSpace as an,registerFinancialOverviewKnowledgeSpace as on}from"./knowledge/spaces/financial-overview.js";import"./knowledge/index.js";import{CreateIntegrationConnection as sn,DeleteIntegrationConnection as cn,ListIntegrationConnections as ln,TestIntegrationConnection as un,UpdateIntegrationConnection as dn,integrationContracts as fn,registerIntegrationContracts as pn}from"./integrations/contracts.js";import{CreateKnowledgeSource as mn,DeleteKnowledgeSource as hn,ListKnowledgeSources as gn,TriggerKnowledgeSourceSync as _n,UpdateKnowledgeSource as vn,knowledgeContracts as yn,registerKnowledgeContracts as bn}from"./knowledge/contracts.js";import{behaviorToEnvelope as xn,errorToEnvelope as Sn,telemetryToEnvelope as Cn}from"./regenerator/utils.js";import{RegeneratorService as wn}from"./regenerator/service.js";import{ProposalExecutor as Tn}from"./regenerator/executor.js";import{ExecutorProposalSink as En}from"./regenerator/sinks.js";import"./regenerator/index.js";import{WorkflowRegistry as Dn}from"./workflow/spec.js";import{WorkflowValidationError as On,assertWorkflowSpecValid as kn,validateWorkflowSpec as An}from"./workflow/validation.js";import{evaluateExpression as jn}from"./workflow/expression.js";import{WorkflowPreFlightError as Mn,WorkflowRunner as Nn}from"./workflow/runner.js";import{InMemoryStateStore as Pn}from"./workflow/adapters/memory-store.js";import{PrismaStateStore as Fn}from"./workflow/adapters/db-adapter.js";import{createFileStateStore as In}from"./workflow/adapters/file-adapter.js";import"./workflow/index.js";import{techContractsDocs as Ln}from"./docs/tech-contracts.docs.js";import{metaDocs as Rn}from"./docs/meta.docs.js";import"./docs/index.js";import{defineSchemaModel as zn}from"@lssm/lib.schema";export{At as AccountBalanceRecord,rt as AppBlueprintRegistry,jt as BankAccountRecord,Mt as BankTransactionRecord,e as CapabilityRegistry,Te as CompleteOnboardingBaseInput,Ee as CompleteOnboardingBaseOutput,De as CompleteOnboardingBaseSpec,ue as ContractRegistryFileSchema,de as ContractRegistryItemSchema,fe as ContractRegistryItemTypeSchema,pe as ContractRegistryManifestSchema,sn as CreateIntegrationConnection,mn as CreateKnowledgeSource,r as DataViewRegistry,cn as DeleteIntegrationConnection,hn as DeleteKnowledgeSource,Oe as DeleteOnboardingDraftBaseSpec,ke as DeleteOnboardingDraftOutput,Q as DocRegistry,En as ExecutorProposalSink,nt as ExperimentEvaluator,et as ExperimentRegistry,s as FeatureRegistry,u as FormRegistry,Ae as GetOnboardingDraftBaseSpec,je as GetOnboardingDraftOutput,Pn as InMemoryStateStore,st as IntegrationSpecRegistry,Kt as KnowledgeSpaceRegistry,ln as ListIntegrationConnections,gn as ListKnowledgeSources,Ke as MigrationRegistry,He as OPAPolicyAdapter,Nt as OPENBANKING_PII_FIELDS,Pt as OPENBANKING_TELEMETRY_EVENTS,It as OpenBankingGetAccount,Vt as OpenBankingGetBalances,Lt as OpenBankingListAccounts,zt as OpenBankingListTransactions,Ht as OpenBankingRefreshBalances,Rt as OpenBankingSyncAccounts,Bt as OpenBankingSyncTransactions,ae as Owners,oe as OwnersEnum,Ve as PolicyEngine,ze as PolicyRegistry,I as PresentationRegistry,Fn as PrismaStateStore,ye as PromptRegistry,Tn as ProposalExecutor,wn as RegeneratorService,be as ResourceRegistry,Me as SaveOnboardingDraftBaseSpec,Ne as SaveOnboardingDraftInput,Pe as SaveOnboardingDraftOutput,re as SpecRegistry,se as StabilityEnum,ce as Tags,le as TagsEnum,Xe as TelemetryAnomalyMonitor,qe as TelemetryRegistry,Ye as TelemetryTracker,un as TestIntegrationConnection,Ze as TestRegistry,$e as TestRunner,We as ThemeRegistry,y as TransformEngine,_n as TriggerKnowledgeSourceSync,dn as UpdateIntegrationConnection,vn as UpdateKnowledgeSource,Mn as WorkflowPreFlightError,Dn as WorkflowRegistry,Nn as WorkflowRunner,On as WorkflowValidationError,Wt as assertPrimaryOpenBankingReady,kn as assertWorkflowSpecValid,xn as behaviorToEnvelope,Ue as buildOPAInput,d as buildZodWithRelations,t as capabilityKey,at as composeAppConfig,kt as createDefaultIntegrationSpecRegistry,b as createDefaultTransformEngine,w as createEngineWithDefaults,T as createFeatureModule,z as createFetchHandler,In as createFileStateStore,O as createFormRenderer,R as createMcpServer,i as dataViewKey,$ as defaultDocRegistry,j as defaultGqlField,M as defaultMcpTool,N as defaultRestPath,n as defineCapability,W as defineCommand,a as defineEvent,f as defineFormSpec,ve as definePrompt,G as defineQuery,xe as defineResourceTemplate,zn as defineSchemaModel,q as docBlockToPresentationSpec,J as docBlockToPresentationV2,Y as docBlocksToPresentationRoutes,X as docBlocksToPresentationSpecs,ee as docId,_t as elevenLabsIntegrationSpec,B as elysiaPlugin,Qt as emailThreadsKnowledgeSpace,Gt as ensurePrimaryOpenBankingIntegration,Sn as errorToEnvelope,p as evalPredicate,jn as evaluateExpression,o as eventKey,V as expressRouter,nn as financialDocsKnowledgeSpace,an as financialOverviewKnowledgeSpace,Tt as gcsStorageIntegrationSpec,yt as gmailIntegrationSpec,xt as googleCalendarIntegrationSpec,c as installFeature,me as installOp,fn as integrationContracts,K as isEmitDeclRef,Se as isResourceRef,L as jsonSchemaForPresentation,P as jsonSchemaForSpec,yn as knowledgeContracts,te as listRegisteredDocBlocks,it as makeAppBlueprintKey,he as makeEmit,tt as makeExperimentKey,ct as makeIntegrationSpecKey,qt as makeKnowledgeSpaceKey,H as makeNextAppHandler,U as makeNextPagesHandler,Be as makePolicyKey,Je as makeTelemetryKey,Qe as makeTestKey,Ge as makeThemeRef,Z as mapDocRoutes,Rn as metaDocs,ht as mistralIntegrationSpec,ge as op,ie as opKey,_e as openApiForRegistry,Fe as openBankingAccountsReadCapability,Ie as openBankingBalancesReadCapability,Le as openBankingTransactionsReadCapability,dt as postmarkIntegrationSpec,Dt as powensIntegrationSpec,Jt as productCanonKnowledgeSpace,pt as qdrantIntegrationSpec,Ft as redactOpenBankingTelemetryPayload,x as registerBasicValidation,F as registerContractsOnBuilder,S as registerDefaultReactRenderer,ne as registerDocBlocks,vt as registerElevenLabsIntegration,$t as registerEmailThreadsKnowledgeSpace,E as registerFeature,rn as registerFinancialDocsKnowledgeSpace,on as registerFinancialOverviewKnowledgeSpace,Et as registerGcsStorageIntegration,bt as registerGmailIntegration,St as registerGoogleCalendarIntegration,pn as registerIntegrationContracts,bn as registerKnowledgeContracts,gt as registerMistralIntegration,Re as registerOpenBankingCapabilities,Ut as registerOpenBankingContracts,ft as registerPostmarkIntegration,Ot as registerPowensIntegration,Yt as registerProductCanonKnowledgeSpace,mt as registerQdrantIntegration,C as registerReactToMarkdownRenderer,lt as registerStripeIntegration,Xt as registerSupportFaqKnowledgeSpace,Ct as registerTwilioSmsIntegration,en as registerUploadedDocsKnowledgeSpace,D as renderFeaturePresentation,ot as resolveAppConfig,Ce as resourceRef,A as rnReusablesDriver,m as schemaToMarkdown,h as schemaToMarkdownDetail,g as schemaToMarkdownList,_ as schemaToMarkdownSummary,v as schemaToMarkdownTable,k as shadcnDriver,ut as stripeIntegrationSpec,Zt as supportFaqKnowledgeSpace,Ln as techContractsDocs,Cn as telemetryToEnvelope,we as toV2FromV1,wt as twilioSmsIntegrationSpec,tn as uploadedDocsKnowledgeSpace,l as validateFeatureTargetsV2,An as validateWorkflowSpec};
@@ -1,101 +1 @@
1
- import{registerDocBlocks as e}from"../../docs/registry.js";import"../../registry.js";const t=[{id:`docs.tech.contracts.integrations`,title:`ContractSpec Integrations`,summary:`This document describes the integration architecture that powers the`,kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/integrations`,tags:[`tech`,`contracts`,`integrations`],body:`# ContractSpec Integrations
2
-
3
- This document describes the integration architecture that powers the
4
- Pocket Family Office vertical and other ContractSpec-based apps. It
5
- focuses on provider-agnostic contracts, secret management, health
6
- checking, and runtime guards.
7
-
8
- ## Core Concepts
9
-
10
- - **IntegrationSpec** – declarative description of a provider that lists
11
- supported ownership modes, capability mappings, configuration schema,
12
- secret schema, health check policy, and documentation metadata.
13
- - **IntegrationConnection** – tenant/environment binding to a provider
14
- (\`meta\` + ownership mode + config + \`secretRef\`). Secrets are never
15
- embedded in specs or configs.
16
- - **AppIntegrationSlot** – blueprint-level requirement that declares
17
- which integration categories/capabilities must be satisfied at runtime
18
- (e.g. \`primaryLLM\`, \`primaryVectorDb\`).
19
- - **AppIntegrationBinding** – tenant-level slot → connection mapping.
20
- - **ResolvedIntegration** – runtime view containing slot metadata,
21
- connection details, and the resolved IntegrationSpec.
22
-
23
- ## Registered Providers
24
-
25
- The Pocket Family Office reference registers ten priority providers in
26
- \`packages/libs/contracts/src/integrations/providers\`:
27
-
28
- | Category | Provider | Key | Notes |
29
- | ------------- | ---------------- | --------------------------- | ------------------------------------------------- |
30
- | payments | Stripe | \`payments.stripe\` | Card + invoice flows, managed or BYOK credentials |
31
- | email (out) | Postmark | \`email.postmark\` | Transactional email delivery |
32
- | email (in) | Gmail API | \`email.gmail\` | Thread ingestion (OAuth BYOK or service account) |
33
- | calendar | Google Calendar | \`calendar.google\` | Event scheduling via service account |
34
- | vector-db | Qdrant | \`vectordb.qdrant\` | Embedding storage & search |
35
- | storage | Google Cloud | \`storage.gcs\` | S3-compatible object storage |
36
- | ai-llm | Mistral | \`ai-llm.mistral\` | Primary chat + embedding provider |
37
- | ai-voice | ElevenLabs | \`ai-voice.elevenlabs\` | Text-to-speech synthesis |
38
- | sms | Twilio SMS | \`sms.twilio\` | Urgent and fallback reminders |
39
- | open-banking | Powens | \`openbanking.powens\` | Read-only account, transaction, and balance sync |
40
-
41
- Each provider ships with:
42
-
43
- - Strongly typed adapter interfaces (\`payments.ts\`, \`llm.ts\`, etc.).
44
- - A concrete SDK-backed implementation under \`providers/impls\`.
45
- - Unit tests validating adapter behaviour and health checks.
46
-
47
- ## Secret Management
48
-
49
- All integrations rely on the \`SecretProvider\` abstraction defined in
50
- \`integrations/secrets\`. Two providers ship with the contracts library and
51
- are orchestrated by the \`SecretProviderManager\` composite:
52
-
53
- - **EnvSecretProvider (\`env-secret-provider.ts\`)** – high-priority,
54
- read-only overrides backed by environment variables. Supports the
55
- \`env://VARIABLE_NAME\` scheme as well as overrides for other schemes via
56
- \`?env=ALIAS\` or derived uppercase keys (e.g.
57
- \`gcp://.../stripe-secret-key\` → \`PROJECTS_DEMO_SECRETS_STRIPE_SECRET_KEY\`).
58
- - **GcpSecretManagerProvider (\`gcp-secret-manager.ts\`)** – production
59
- backend for versioned, auditable secrets stored in Google Cloud Secret
60
- Manager.
61
-
62
- The manager attempts providers in priority order (environment first,
63
- then GCP). Key points:
64
-
65
- - \`secretRef\` uses a URI scheme (examples: \`env://LOCAL_API_TOKEN\`,
66
- \`gcp://projects/demo/secrets/stripe-key/versions/latest\`).
67
- - \`IntegrationCallGuard\` fetches and parses secrets before executing a
68
- provider adapter.
69
- - Providers never accept raw secrets in constructors; they expect a map
70
- of resolved string values from the guard.
71
- - Local development can rely on \`.env\` files, while staging/production
72
- reference long-lived GCP secrets without changing the integration
73
- specs.
74
-
75
- ## Health Checks & Telemetry
76
-
77
- - Each IntegrationSpec optionally declares \`healthCheck.method\` and
78
- timeouts.
79
- - \`IntegrationCallGuard\` enforces connection status, wraps retries with
80
- exponential back-off, and emits telemetry events tagged with tenant,
81
- app, blueprint, config version, and slot id.
82
- - Validation rules (\`app-config/validation.ts\`) surface issues at
83
- publish time (slot mismatch, unsupported ownership modes, missing
84
- capabilities, etc.).
85
-
86
- ## Runtime Usage
87
-
88
- 1. Blueprint defines slots (\`primaryLLM\`, \`primaryVectorDb\`, ...).
89
- 2. Tenant binds connections referencing the integration ids above.
90
- 3. \`composeAppConfig\` merges blueprint + tenant, resolving specs,
91
- connections, and knowledge bindings.
92
- 4. Workflow runner fetches providers via \`IntegrationCallGuard\` and
93
- executes operations with full guardrails.
94
-
95
- See \`packages/verticals/pocket-family-office\` for
96
- examples of how the blueprint, tenant config, and workflows pull these
97
- pieces together.
98
-
99
-
100
-
101
- `}];e(t);export{t as tech_contracts_integrations_DocBlocks};
1
+ import{registerDocBlocks as e}from"../../docs/registry.js";import"../../registry.js";const t=[{id:`docs.tech.contracts.integrations`,title:`ContractSpec Integrations`,summary:`Provider-agnostic integration contracts: specs, connections, secrets, health checks, and runtime guards.`,kind:`reference`,visibility:`public`,route:`/docs/tech/contracts/integrations`,tags:[`tech`,`contracts`,`integrations`],body:"# ContractSpec Integrations\n\nThis document describes the integration architecture that powers ContractSpec-based apps. It focuses on provider-agnostic contracts, secret management, health checks, and runtime guards.\n\n## Core Concepts\n\n- **IntegrationSpec** – declarative description of a provider that lists supported ownership modes, capability mappings, configuration schema, secret schema, health check policy, and documentation metadata.\n- **IntegrationConnection** – tenant/environment binding to a provider (`meta` + ownership mode + config + `secretRef`). Secrets are never embedded in specs or configs.\n- **AppIntegrationSlot** – blueprint-level requirement that declares which integration categories/capabilities must be satisfied at runtime (e.g. `primaryLLM`, `primaryVectorDb`).\n- **AppIntegrationBinding** – tenant-level slot → connection mapping.\n- **ResolvedIntegration** – runtime view containing slot metadata, connection details, and the resolved IntegrationSpec.\n\n## Registered Providers\n\nThe contracts library ships ten priority providers in `packages/libs/contracts/src/integrations/providers`:\n\n| Category | Provider | Key | Notes |\n| ------------- | ---------------- | --------------------------- | ------------------------------------------------- |\n| payments | Stripe | `payments.stripe` | Card + invoice flows, managed or BYOK credentials |\n| email (out) | Postmark | `email.postmark` | Transactional email delivery |\n| email (in) | Gmail API | `email.gmail` | Thread ingestion (OAuth BYOK or service account) |\n| calendar | Google Calendar | `calendar.google` | Event scheduling via service account |\n| vector-db | Qdrant | `vectordb.qdrant` | Embedding storage & search |\n| storage | Google Cloud | `storage.gcs` | Object storage |\n| ai-llm | Mistral | `ai-llm.mistral` | Primary chat + embedding provider |\n| ai-voice | ElevenLabs | `ai-voice.elevenlabs` | Text-to-speech synthesis |\n| sms | Twilio SMS | `sms.twilio` | Urgent and fallback reminders |\n| open-banking | Powens | `openbanking.powens` | Read-only account, transaction, and balance sync |\n\nEach provider ships with:\n\n- Strongly typed adapter interfaces (`payments.ts`, `llm.ts`, etc.)\n- A concrete SDK-backed implementation under `providers/impls`\n- Unit tests validating adapter behaviour and health checks\n\n### Canonical registry builder\n\nTo list all shipped specs at runtime, use:\n\n- `createDefaultIntegrationSpecRegistry()` from `@lssm/lib.contracts/integrations/providers/registry`\n\n## Secret Management\n\nAll integrations rely on the `SecretProvider` abstraction defined in `integrations/secrets`. Providers ship with the contracts library and are orchestrated by the `SecretProviderManager` composite:\n\n- **EnvSecretProvider** (`env-secret-provider.ts`) – high-priority, read-only overrides backed by environment variables.\n - Supports the `env://VARIABLE_NAME` scheme\n - Supports overrides for other schemes via `?env=ALIAS` or derived uppercase keys\n- **GcpSecretManagerProvider** (`gcp-secret-manager.ts`) – versioned secrets stored in Google Cloud Secret Manager.\n - Example: `gcp://projects/demo/secrets/stripe-key/versions/latest`\n- **AwsSecretsManagerProvider** (`aws-secret-manager.ts`) – AWS Secrets Manager backend.\n - Example: `aws://secretsmanager/eu-west-1/my-secret?version=AWSCURRENT`\n - Region may be in the reference or provided via `AWS_REGION` / `AWS_DEFAULT_REGION`\n- **ScalewaySecretManagerProvider** (`scaleway-secret-manager.ts`) – Scaleway Secret Manager backend.\n - Example (id): `scw://secret-manager/fr-par/1234...-uuid?version=latest`\n - Example (name, create+write): `scw://secret-manager/fr-par/my-secret-name`\n - Requires `SCW_SECRET_KEY` (token) and `SCW_DEFAULT_PROJECT_ID` when creating secrets by name\n\nThe manager attempts providers in priority order (environment first, then cloud providers). Key points:\n\n- `secretRef` is a URI-like reference; raw secrets are never returned.\n- `IntegrationCallGuard` fetches and parses secrets before executing a provider adapter.\n- Local development can rely on `.env` files, while staging/production reference cloud secret stores.\n\n## Health Checks & Telemetry\n\n- Each IntegrationSpec optionally declares `healthCheck.method` and timeouts.\n- `IntegrationCallGuard` enforces connection status, wraps retries with exponential back-off, and emits telemetry events tagged with tenant/app/slot metadata.\n- Validation rules (`app-config/validation.ts`) surface issues at publish time (slot mismatch, unsupported ownership modes, missing capabilities, etc.).\n\n## Studio persistence (ContractSpec Studio)\n\nContractSpec Studio persists tenant `IntegrationConnection` records in Postgres (Prisma model `IntegrationConnection` in `@lssm/lib.database-contractspec-studio`) and exposes a platform-admin management surface (see the Studio platform admin panel).\n"}];e(t);export{t as tech_contracts_integrations_DocBlocks};
@@ -1 +1 @@
1
- import{IntegrationSpecRegistry as e,makeIntegrationSpecKey as t}from"./spec.js";import{registerStripeIntegration as n,stripeIntegrationSpec as r}from"./providers/stripe.js";import{postmarkIntegrationSpec as i,registerPostmarkIntegration as a}from"./providers/postmark.js";import{qdrantIntegrationSpec as o,registerQdrantIntegration as s}from"./providers/qdrant.js";import{mistralIntegrationSpec as c,registerMistralIntegration as l}from"./providers/mistral.js";import{elevenLabsIntegrationSpec as u,registerElevenLabsIntegration as d}from"./providers/elevenlabs.js";import{gmailIntegrationSpec as f,registerGmailIntegration as p}from"./providers/gmail.js";import{googleCalendarIntegrationSpec as m,registerGoogleCalendarIntegration as h}from"./providers/google-calendar.js";import{registerTwilioSmsIntegration as g,twilioSmsIntegrationSpec as _}from"./providers/twilio-sms.js";import{gcsStorageIntegrationSpec as v,registerGcsStorageIntegration as y}from"./providers/gcs-storage.js";import{powensIntegrationSpec as b,registerPowensIntegration as x}from"./providers/powens.js";import{MistralLLMProvider as S}from"./providers/impls/mistral-llm.js";import{MistralEmbeddingProvider as C}from"./providers/impls/mistral-embedding.js";import{QdrantVectorProvider as w}from"./providers/impls/qdrant-vector.js";import{GmailInboundProvider as T}from"./providers/impls/gmail-inbound.js";import{GmailOutboundProvider as E}from"./providers/impls/gmail-outbound.js";import{GoogleCalendarProvider as D}from"./providers/impls/google-calendar.js";import{ElevenLabsVoiceProvider as O}from"./providers/impls/elevenlabs-voice.js";import{GoogleCloudStorageProvider as k}from"./providers/impls/gcs-storage.js";import{StripePaymentsProvider as A}from"./providers/impls/stripe-payments.js";import{PostmarkEmailProvider as j}from"./providers/impls/postmark-email.js";import{TwilioSmsProvider as M}from"./providers/impls/twilio-sms.js";import{PowensClient as N,PowensClientError as P}from"./providers/impls/powens-client.js";import{PowensOpenBankingProvider as F}from"./providers/impls/powens-openbanking.js";import{IntegrationProviderFactory as I}from"./providers/impls/provider-factory.js";import"./providers/index.js";import{SecretProviderError as L,normalizeSecretPayload as R,parseSecretUri as z}from"./secrets/provider.js";import{GcpSecretManagerProvider as B}from"./secrets/gcp-secret-manager.js";import{EnvSecretProvider as V}from"./secrets/env-secret-provider.js";import{SecretProviderManager as H}from"./secrets/manager.js";import"./secrets/index.js";import{IntegrationCallGuard as U,connectionStatusLabel as W,ensureConnectionReady as G}from"./runtime.js";import{IntegrationHealthService as K}from"./health.js";import{AccountBalanceRecord as q,BankAccountRecord as J,BankTransactionRecord as Y}from"./openbanking/models.js";import{OPENBANKING_PII_FIELDS as X,OPENBANKING_TELEMETRY_EVENTS as Z,redactOpenBankingTelemetryPayload as Q}from"./openbanking/telemetry.js";import{OpenBankingGetAccount as $,OpenBankingListAccounts as ee,OpenBankingSyncAccounts as te}from"./openbanking/contracts/accounts.js";import{OpenBankingListTransactions as ne,OpenBankingSyncTransactions as re}from"./openbanking/contracts/transactions.js";import{OpenBankingGetBalances as ie,OpenBankingRefreshBalances as ae}from"./openbanking/contracts/balances.js";import{registerOpenBankingContracts as oe}from"./openbanking/contracts/index.js";import{assertPrimaryOpenBankingReady as se,ensurePrimaryOpenBankingIntegration as ce}from"./openbanking/guards.js";export{q as AccountBalanceRecord,J as BankAccountRecord,Y as BankTransactionRecord,O as ElevenLabsVoiceProvider,V as EnvSecretProvider,B as GcpSecretManagerProvider,T as GmailInboundProvider,E as GmailOutboundProvider,D as GoogleCalendarProvider,k as GoogleCloudStorageProvider,U as IntegrationCallGuard,K as IntegrationHealthService,I as IntegrationProviderFactory,e as IntegrationSpecRegistry,C as MistralEmbeddingProvider,S as MistralLLMProvider,X as OPENBANKING_PII_FIELDS,Z as OPENBANKING_TELEMETRY_EVENTS,$ as OpenBankingGetAccount,ie as OpenBankingGetBalances,ee as OpenBankingListAccounts,ne as OpenBankingListTransactions,ae as OpenBankingRefreshBalances,te as OpenBankingSyncAccounts,re as OpenBankingSyncTransactions,j as PostmarkEmailProvider,N as PowensClient,P as PowensClientError,F as PowensOpenBankingProvider,w as QdrantVectorProvider,L as SecretProviderError,H as SecretProviderManager,A as StripePaymentsProvider,M as TwilioSmsProvider,se as assertPrimaryOpenBankingReady,W as connectionStatusLabel,u as elevenLabsIntegrationSpec,G as ensureConnectionReady,ce as ensurePrimaryOpenBankingIntegration,v as gcsStorageIntegrationSpec,f as gmailIntegrationSpec,m as googleCalendarIntegrationSpec,t as makeIntegrationSpecKey,c as mistralIntegrationSpec,R as normalizeSecretPayload,z as parseSecretUri,i as postmarkIntegrationSpec,b as powensIntegrationSpec,o as qdrantIntegrationSpec,Q as redactOpenBankingTelemetryPayload,d as registerElevenLabsIntegration,y as registerGcsStorageIntegration,p as registerGmailIntegration,h as registerGoogleCalendarIntegration,l as registerMistralIntegration,oe as registerOpenBankingContracts,a as registerPostmarkIntegration,x as registerPowensIntegration,s as registerQdrantIntegration,n as registerStripeIntegration,g as registerTwilioSmsIntegration,r as stripeIntegrationSpec,_ as twilioSmsIntegrationSpec};
1
+ import{IntegrationSpecRegistry as e,makeIntegrationSpecKey as t}from"./spec.js";import{registerStripeIntegration as n,stripeIntegrationSpec as r}from"./providers/stripe.js";import{postmarkIntegrationSpec as i,registerPostmarkIntegration as a}from"./providers/postmark.js";import{qdrantIntegrationSpec as o,registerQdrantIntegration as s}from"./providers/qdrant.js";import{mistralIntegrationSpec as c,registerMistralIntegration as l}from"./providers/mistral.js";import{elevenLabsIntegrationSpec as u,registerElevenLabsIntegration as d}from"./providers/elevenlabs.js";import{gmailIntegrationSpec as f,registerGmailIntegration as p}from"./providers/gmail.js";import{googleCalendarIntegrationSpec as m,registerGoogleCalendarIntegration as h}from"./providers/google-calendar.js";import{registerTwilioSmsIntegration as g,twilioSmsIntegrationSpec as _}from"./providers/twilio-sms.js";import{gcsStorageIntegrationSpec as v,registerGcsStorageIntegration as y}from"./providers/gcs-storage.js";import{powensIntegrationSpec as b,registerPowensIntegration as x}from"./providers/powens.js";import{createDefaultIntegrationSpecRegistry as S}from"./providers/registry.js";import"./providers/index.js";import{AccountBalanceRecord as C,BankAccountRecord as w,BankTransactionRecord as T}from"./openbanking/models.js";import{OPENBANKING_PII_FIELDS as E,OPENBANKING_TELEMETRY_EVENTS as D,redactOpenBankingTelemetryPayload as O}from"./openbanking/telemetry.js";import{OpenBankingGetAccount as k,OpenBankingListAccounts as A,OpenBankingSyncAccounts as j}from"./openbanking/contracts/accounts.js";import{OpenBankingListTransactions as M,OpenBankingSyncTransactions as N}from"./openbanking/contracts/transactions.js";import{OpenBankingGetBalances as P,OpenBankingRefreshBalances as F}from"./openbanking/contracts/balances.js";import{registerOpenBankingContracts as I}from"./openbanking/contracts/index.js";import{assertPrimaryOpenBankingReady as L,ensurePrimaryOpenBankingIntegration as R}from"./openbanking/guards.js";export{C as AccountBalanceRecord,w as BankAccountRecord,T as BankTransactionRecord,e as IntegrationSpecRegistry,E as OPENBANKING_PII_FIELDS,D as OPENBANKING_TELEMETRY_EVENTS,k as OpenBankingGetAccount,P as OpenBankingGetBalances,A as OpenBankingListAccounts,M as OpenBankingListTransactions,F as OpenBankingRefreshBalances,j as OpenBankingSyncAccounts,N as OpenBankingSyncTransactions,L as assertPrimaryOpenBankingReady,S as createDefaultIntegrationSpecRegistry,u as elevenLabsIntegrationSpec,R as ensurePrimaryOpenBankingIntegration,v as gcsStorageIntegrationSpec,f as gmailIntegrationSpec,m as googleCalendarIntegrationSpec,t as makeIntegrationSpecKey,c as mistralIntegrationSpec,i as postmarkIntegrationSpec,b as powensIntegrationSpec,o as qdrantIntegrationSpec,O as redactOpenBankingTelemetryPayload,d as registerElevenLabsIntegration,y as registerGcsStorageIntegration,p as registerGmailIntegration,h as registerGoogleCalendarIntegration,l as registerMistralIntegration,I as registerOpenBankingContracts,a as registerPostmarkIntegration,x as registerPowensIntegration,s as registerQdrantIntegration,n as registerStripeIntegration,g as registerTwilioSmsIntegration,r as stripeIntegrationSpec,_ as twilioSmsIntegrationSpec};
@@ -1 +1 @@
1
- import{MistralLLMProvider as e}from"./mistral-llm.js";import{MistralEmbeddingProvider as t}from"./mistral-embedding.js";import{QdrantVectorProvider as n}from"./qdrant-vector.js";import{GmailInboundProvider as r}from"./gmail-inbound.js";import{GmailOutboundProvider as i}from"./gmail-outbound.js";import{GoogleCalendarProvider as a}from"./google-calendar.js";import{ElevenLabsVoiceProvider as o}from"./elevenlabs-voice.js";import{GoogleCloudStorageProvider as s}from"./gcs-storage.js";import{StripePaymentsProvider as c}from"./stripe-payments.js";import{PostmarkEmailProvider as l}from"./postmark-email.js";import{TwilioSmsProvider as u}from"./twilio-sms.js";import{PowensClient as d,PowensClientError as f}from"./powens-client.js";import{PowensOpenBankingProvider as p}from"./powens-openbanking.js";import{IntegrationProviderFactory as m}from"./provider-factory.js";export{o as ElevenLabsVoiceProvider,r as GmailInboundProvider,i as GmailOutboundProvider,a as GoogleCalendarProvider,s as GoogleCloudStorageProvider,m as IntegrationProviderFactory,t as MistralEmbeddingProvider,e as MistralLLMProvider,l as PostmarkEmailProvider,d as PowensClient,f as PowensClientError,p as PowensOpenBankingProvider,n as QdrantVectorProvider,c as StripePaymentsProvider,u as TwilioSmsProvider};
1
+ import{ElevenLabsVoiceProvider as e}from"./elevenlabs-voice.js";import{GoogleCloudStorageProvider as t}from"./gcs-storage.js";import{GmailInboundProvider as n}from"./gmail-inbound.js";import{GmailOutboundProvider as r}from"./gmail-outbound.js";import{GoogleCalendarProvider as i}from"./google-calendar.js";import{MistralLLMProvider as a}from"./mistral-llm.js";import{MistralEmbeddingProvider as o}from"./mistral-embedding.js";import{QdrantVectorProvider as s}from"./qdrant-vector.js";import{StripePaymentsProvider as c}from"./stripe-payments.js";import{PostmarkEmailProvider as l}from"./postmark-email.js";import{TwilioSmsProvider as u}from"./twilio-sms.js";import{PowensClient as d,PowensClientError as f}from"./powens-client.js";import{PowensOpenBankingProvider as p}from"./powens-openbanking.js";import{IntegrationProviderFactory as m}from"./provider-factory.js";export{e as ElevenLabsVoiceProvider,n as GmailInboundProvider,r as GmailOutboundProvider,i as GoogleCalendarProvider,t as GoogleCloudStorageProvider,m as IntegrationProviderFactory,o as MistralEmbeddingProvider,a as MistralLLMProvider,l as PostmarkEmailProvider,d as PowensClient,f as PowensClientError,p as PowensOpenBankingProvider,s as QdrantVectorProvider,c as StripePaymentsProvider,u as TwilioSmsProvider};
@@ -1 +1 @@
1
- import{MistralLLMProvider as e}from"./mistral-llm.js";import{MistralEmbeddingProvider as t}from"./mistral-embedding.js";import{QdrantVectorProvider as n}from"./qdrant-vector.js";import{ElevenLabsVoiceProvider as r}from"./elevenlabs-voice.js";import{GoogleCloudStorageProvider as i}from"./gcs-storage.js";import{StripePaymentsProvider as a}from"./stripe-payments.js";import{PostmarkEmailProvider as o}from"./postmark-email.js";import{TwilioSmsProvider as s}from"./twilio-sms.js";import{PowensOpenBankingProvider as c}from"./powens-openbanking.js";import{Buffer as l}from"node:buffer";const u=new Map;var d=class{async createPaymentsProvider(e){let t=await this.loadSecrets(e);switch(e.spec.meta.key){case`payments.stripe`:return new a({apiKey:p(t,`apiKey`,`Stripe API key is required`)});default:throw Error(`Unsupported payments integration: ${e.spec.meta.key}`)}}async createEmailOutboundProvider(e){let t=await this.loadSecrets(e);switch(e.spec.meta.key){case`email.postmark`:return new o({serverToken:p(t,`serverToken`,`Postmark server token is required`),defaultFromEmail:e.config.fromEmail,messageStream:e.config.messageStream});default:throw Error(`Unsupported email integration: ${e.spec.meta.key}`)}}async createSmsProvider(e){let t=await this.loadSecrets(e);switch(e.spec.meta.key){case`sms.twilio`:return new s({accountSid:p(t,`accountSid`,`Twilio account SID is required`),authToken:p(t,`authToken`,`Twilio auth token is required`),fromNumber:e.config.fromNumber});default:throw Error(`Unsupported SMS integration: ${e.spec.meta.key}`)}}async createVectorStoreProvider(e){let t=await this.loadSecrets(e);switch(e.spec.meta.key){case`vectordb.qdrant`:return new n({url:m(e,`apiUrl`,`Qdrant apiUrl config is required`),apiKey:t.apiKey});default:throw Error(`Unsupported vector store integration: ${e.spec.meta.key}`)}}async createObjectStorageProvider(e){let t=await this.loadSecrets(e);switch(e.spec.meta.key){case`storage.s3`:case`storage.gcs`:return new i({bucket:m(e,`bucket`,`Storage bucket is required`),clientOptions:t.type===`service_account`?{credentials:t}:void 0});default:throw Error(`Unsupported storage integration: ${e.spec.meta.key}`)}}async createVoiceProvider(e){let t=await this.loadSecrets(e);switch(e.spec.meta.key){case`ai-voice.elevenlabs`:return new r({apiKey:p(t,`apiKey`,`ElevenLabs API key is required`),defaultVoiceId:e.config.defaultVoiceId});default:throw Error(`Unsupported voice integration: ${e.spec.meta.key}`)}}async createLlmProvider(t){let n=await this.loadSecrets(t);switch(t.spec.meta.key){case`ai-llm.mistral`:return new e({apiKey:p(n,`apiKey`,`Mistral API key is required`),defaultModel:t.config.model});default:throw Error(`Unsupported LLM integration: ${t.spec.meta.key}`)}}async createEmbeddingProvider(e){let n=await this.loadSecrets(e);switch(e.spec.meta.key){case`ai-llm.mistral`:return new t({apiKey:p(n,`apiKey`,`Mistral API key is required`),defaultModel:e.config.embeddingModel});default:throw Error(`Unsupported embeddings integration: ${e.spec.meta.key}`)}}async createOpenBankingProvider(e){let t=await this.loadSecrets(e),n=e.config;switch(e.spec.meta.key){case`openbanking.powens`:{let r=m(e,`environment`,`Powens environment (sandbox | production) must be specified in integration config.`);if(r!==`sandbox`&&r!==`production`)throw Error(`Powens environment "${r}" is invalid. Expected "sandbox" or "production".`);return new c({clientId:p(t,`clientId`,`Powens clientId is required`),clientSecret:p(t,`clientSecret`,`Powens clientSecret is required`),apiKey:t.apiKey,environment:r,baseUrl:n?.baseUrl})}default:throw Error(`Unsupported open banking integration: ${e.spec.meta.key}`)}}async loadSecrets(e){let t=e.connection.meta.id;if(u.has(t))return u.get(t);let n=f(await e.secretProvider.getSecret(e.secretReference));return u.set(t,n),n}};function f(e){let t=l.from(e.data).toString(`utf-8`).trim();if(!t)return{};try{return JSON.parse(t)}catch{return{apiKey:t}}}function p(e,t,n){let r=e[t];if(r==null||r===``)throw Error(n);return r}function m(e,t,n){let r=e.config?.[t];if(r==null)throw Error(n);return r}export{d as IntegrationProviderFactory};
1
+ import{ElevenLabsVoiceProvider as e}from"./elevenlabs-voice.js";import{GoogleCloudStorageProvider as t}from"./gcs-storage.js";import{MistralLLMProvider as n}from"./mistral-llm.js";import{MistralEmbeddingProvider as r}from"./mistral-embedding.js";import{QdrantVectorProvider as i}from"./qdrant-vector.js";import{StripePaymentsProvider as a}from"./stripe-payments.js";import{PostmarkEmailProvider as o}from"./postmark-email.js";import{TwilioSmsProvider as s}from"./twilio-sms.js";import{PowensOpenBankingProvider as c}from"./powens-openbanking.js";import{Buffer as l}from"node:buffer";const u=new Map;var d=class{async createPaymentsProvider(e){let t=await this.loadSecrets(e);switch(e.spec.meta.key){case`payments.stripe`:return new a({apiKey:p(t,`apiKey`,`Stripe API key is required`)});default:throw Error(`Unsupported payments integration: ${e.spec.meta.key}`)}}async createEmailOutboundProvider(e){let t=await this.loadSecrets(e);switch(e.spec.meta.key){case`email.postmark`:return new o({serverToken:p(t,`serverToken`,`Postmark server token is required`),defaultFromEmail:e.config.fromEmail,messageStream:e.config.messageStream});default:throw Error(`Unsupported email integration: ${e.spec.meta.key}`)}}async createSmsProvider(e){let t=await this.loadSecrets(e);switch(e.spec.meta.key){case`sms.twilio`:return new s({accountSid:p(t,`accountSid`,`Twilio account SID is required`),authToken:p(t,`authToken`,`Twilio auth token is required`),fromNumber:e.config.fromNumber});default:throw Error(`Unsupported SMS integration: ${e.spec.meta.key}`)}}async createVectorStoreProvider(e){let t=await this.loadSecrets(e);switch(e.spec.meta.key){case`vectordb.qdrant`:return new i({url:m(e,`apiUrl`,`Qdrant apiUrl config is required`),apiKey:t.apiKey});default:throw Error(`Unsupported vector store integration: ${e.spec.meta.key}`)}}async createObjectStorageProvider(e){let n=await this.loadSecrets(e);switch(e.spec.meta.key){case`storage.s3`:case`storage.gcs`:return new t({bucket:m(e,`bucket`,`Storage bucket is required`),clientOptions:n.type===`service_account`?{credentials:n}:void 0});default:throw Error(`Unsupported storage integration: ${e.spec.meta.key}`)}}async createVoiceProvider(t){let n=await this.loadSecrets(t);switch(t.spec.meta.key){case`ai-voice.elevenlabs`:return new e({apiKey:p(n,`apiKey`,`ElevenLabs API key is required`),defaultVoiceId:t.config.defaultVoiceId});default:throw Error(`Unsupported voice integration: ${t.spec.meta.key}`)}}async createLlmProvider(e){let t=await this.loadSecrets(e);switch(e.spec.meta.key){case`ai-llm.mistral`:return new n({apiKey:p(t,`apiKey`,`Mistral API key is required`),defaultModel:e.config.model});default:throw Error(`Unsupported LLM integration: ${e.spec.meta.key}`)}}async createEmbeddingProvider(e){let t=await this.loadSecrets(e);switch(e.spec.meta.key){case`ai-llm.mistral`:return new r({apiKey:p(t,`apiKey`,`Mistral API key is required`),defaultModel:e.config.embeddingModel});default:throw Error(`Unsupported embeddings integration: ${e.spec.meta.key}`)}}async createOpenBankingProvider(e){let t=await this.loadSecrets(e),n=e.config;switch(e.spec.meta.key){case`openbanking.powens`:{let r=m(e,`environment`,`Powens environment (sandbox | production) must be specified in integration config.`);if(r!==`sandbox`&&r!==`production`)throw Error(`Powens environment "${r}" is invalid. Expected "sandbox" or "production".`);return new c({clientId:p(t,`clientId`,`Powens clientId is required`),clientSecret:p(t,`clientSecret`,`Powens clientSecret is required`),apiKey:t.apiKey,environment:r,baseUrl:n?.baseUrl})}default:throw Error(`Unsupported open banking integration: ${e.spec.meta.key}`)}}async loadSecrets(e){let t=e.connection.meta.id;if(u.has(t))return u.get(t);let n=f(await e.secretProvider.getSecret(e.secretReference));return u.set(t,n),n}};function f(e){let t=l.from(e.data).toString(`utf-8`).trim();if(!t)return{};try{return JSON.parse(t)}catch{return{apiKey:t}}}function p(e,t,n){let r=e[t];if(r==null||r===``)throw Error(n);return r}function m(e,t,n){let r=e.config?.[t];if(r==null)throw Error(n);return r}export{d as IntegrationProviderFactory};
@@ -1 +1 @@
1
- import{registerStripeIntegration as e,stripeIntegrationSpec as t}from"./stripe.js";import{postmarkIntegrationSpec as n,registerPostmarkIntegration as r}from"./postmark.js";import{qdrantIntegrationSpec as i,registerQdrantIntegration as a}from"./qdrant.js";import{mistralIntegrationSpec as o,registerMistralIntegration as s}from"./mistral.js";import{elevenLabsIntegrationSpec as c,registerElevenLabsIntegration as l}from"./elevenlabs.js";import{gmailIntegrationSpec as u,registerGmailIntegration as d}from"./gmail.js";import{googleCalendarIntegrationSpec as f,registerGoogleCalendarIntegration as p}from"./google-calendar.js";import{registerTwilioSmsIntegration as m,twilioSmsIntegrationSpec as h}from"./twilio-sms.js";import{gcsStorageIntegrationSpec as g,registerGcsStorageIntegration as _}from"./gcs-storage.js";import{powensIntegrationSpec as v,registerPowensIntegration as y}from"./powens.js";import{MistralLLMProvider as b}from"./impls/mistral-llm.js";import{MistralEmbeddingProvider as x}from"./impls/mistral-embedding.js";import{QdrantVectorProvider as S}from"./impls/qdrant-vector.js";import{GmailInboundProvider as C}from"./impls/gmail-inbound.js";import{GmailOutboundProvider as w}from"./impls/gmail-outbound.js";import{GoogleCalendarProvider as T}from"./impls/google-calendar.js";import{ElevenLabsVoiceProvider as E}from"./impls/elevenlabs-voice.js";import{GoogleCloudStorageProvider as D}from"./impls/gcs-storage.js";import{StripePaymentsProvider as O}from"./impls/stripe-payments.js";import{PostmarkEmailProvider as k}from"./impls/postmark-email.js";import{TwilioSmsProvider as A}from"./impls/twilio-sms.js";import{PowensClient as j,PowensClientError as M}from"./impls/powens-client.js";import{PowensOpenBankingProvider as N}from"./impls/powens-openbanking.js";import{IntegrationProviderFactory as P}from"./impls/provider-factory.js";import"./impls/index.js";export{E as ElevenLabsVoiceProvider,C as GmailInboundProvider,w as GmailOutboundProvider,T as GoogleCalendarProvider,D as GoogleCloudStorageProvider,P as IntegrationProviderFactory,x as MistralEmbeddingProvider,b as MistralLLMProvider,k as PostmarkEmailProvider,j as PowensClient,M as PowensClientError,N as PowensOpenBankingProvider,S as QdrantVectorProvider,O as StripePaymentsProvider,A as TwilioSmsProvider,c as elevenLabsIntegrationSpec,g as gcsStorageIntegrationSpec,u as gmailIntegrationSpec,f as googleCalendarIntegrationSpec,o as mistralIntegrationSpec,n as postmarkIntegrationSpec,v as powensIntegrationSpec,i as qdrantIntegrationSpec,l as registerElevenLabsIntegration,_ as registerGcsStorageIntegration,d as registerGmailIntegration,p as registerGoogleCalendarIntegration,s as registerMistralIntegration,r as registerPostmarkIntegration,y as registerPowensIntegration,a as registerQdrantIntegration,e as registerStripeIntegration,m as registerTwilioSmsIntegration,t as stripeIntegrationSpec,h as twilioSmsIntegrationSpec};
1
+ import{registerStripeIntegration as e,stripeIntegrationSpec as t}from"./stripe.js";import{postmarkIntegrationSpec as n,registerPostmarkIntegration as r}from"./postmark.js";import{qdrantIntegrationSpec as i,registerQdrantIntegration as a}from"./qdrant.js";import{mistralIntegrationSpec as o,registerMistralIntegration as s}from"./mistral.js";import{elevenLabsIntegrationSpec as c,registerElevenLabsIntegration as l}from"./elevenlabs.js";import{gmailIntegrationSpec as u,registerGmailIntegration as d}from"./gmail.js";import{googleCalendarIntegrationSpec as f,registerGoogleCalendarIntegration as p}from"./google-calendar.js";import{registerTwilioSmsIntegration as m,twilioSmsIntegrationSpec as h}from"./twilio-sms.js";import{gcsStorageIntegrationSpec as g,registerGcsStorageIntegration as _}from"./gcs-storage.js";import{powensIntegrationSpec as v,registerPowensIntegration as y}from"./powens.js";import{createDefaultIntegrationSpecRegistry as b}from"./registry.js";export{b as createDefaultIntegrationSpecRegistry,c as elevenLabsIntegrationSpec,g as gcsStorageIntegrationSpec,u as gmailIntegrationSpec,f as googleCalendarIntegrationSpec,o as mistralIntegrationSpec,n as postmarkIntegrationSpec,v as powensIntegrationSpec,i as qdrantIntegrationSpec,l as registerElevenLabsIntegration,_ as registerGcsStorageIntegration,d as registerGmailIntegration,p as registerGoogleCalendarIntegration,s as registerMistralIntegration,r as registerPostmarkIntegration,y as registerPowensIntegration,a as registerQdrantIntegration,e as registerStripeIntegration,m as registerTwilioSmsIntegration,t as stripeIntegrationSpec,h as twilioSmsIntegrationSpec};
@@ -0,0 +1 @@
1
+ import{IntegrationSpecRegistry as e}from"../spec.js";import{registerStripeIntegration as t}from"./stripe.js";import{registerPostmarkIntegration as n}from"./postmark.js";import{registerQdrantIntegration as r}from"./qdrant.js";import{registerMistralIntegration as i}from"./mistral.js";import{registerElevenLabsIntegration as a}from"./elevenlabs.js";import{registerGmailIntegration as o}from"./gmail.js";import{registerGoogleCalendarIntegration as s}from"./google-calendar.js";import{registerTwilioSmsIntegration as c}from"./twilio-sms.js";import{registerGcsStorageIntegration as l}from"./gcs-storage.js";import{registerPowensIntegration as u}from"./powens.js";function d(){let d=new e;return t(d),n(d),r(d),i(d),a(d),o(d),s(d),c(d),l(d),u(d),d}export{d as createDefaultIntegrationSpecRegistry};
@@ -0,0 +1 @@
1
+ import{SecretProviderError as e,normalizeSecretPayload as t,parseSecretUri as n}from"./provider.js";import{Buffer as r}from"node:buffer";import{CreateSecretCommand as i,DeleteSecretCommand as a,GetSecretValueCommand as o,PutSecretValueCommand as s,SecretsManagerClient as c}from"@aws-sdk/client-secrets-manager";var l=class{id=`aws-secrets-manager`;explicitRegion;injectedClient;clientConfig;clientsByRegion=new Map;constructor(e={}){this.explicitRegion=e.region,this.injectedClient=e.client,this.clientConfig=e.clientConfig}canHandle(e){try{let t=n(e);return t.provider===`aws`&&(t.path===`secretsmanager`||t.path.startsWith(`secretsmanager/`))}catch{return!1}}async getSecret(e,t){let n=this.parseReference(e),r=this.getClient(n.region),i=t?.version??n.stage??n.version,a={SecretId:n.secretId,...this.buildVersionSelector(i)};try{let t=await r.send(new o(a));return{data:u(t,e,this.id),version:typeof t.VersionId==`string`&&t.VersionId?t.VersionId:i,metadata:{region:n.region,secretId:n.secretId,...i?{requestedVersion:i}:{}},retrievedAt:new Date}}catch(t){throw p({error:t,provider:this.id,reference:e,operation:`getSecret`})}}async setSecret(n,r){let a=this.parseReference(n),o=this.getClient(a.region),c=t(r);try{let e=await o.send(new s({SecretId:a.secretId,SecretBinary:c})),t=typeof e.VersionId==`string`&&e.VersionId?e.VersionId:`latest`;return{reference:this.buildReference(a.region,a.secretId,{version:t}),version:t}}catch(t){if(!f(t))throw p({error:t,provider:this.id,reference:n,operation:`putSecretValue`});if(d(a.secretId))throw new e({message:`Secret not found: ${a.secretId}`,provider:this.id,reference:n,code:`NOT_FOUND`,cause:t});try{let e=await o.send(new i({Name:a.secretId,SecretBinary:c})),t=typeof e.VersionId==`string`&&e.VersionId?e.VersionId:`latest`;return{reference:this.buildReference(a.region,a.secretId,{version:t}),version:t}}catch(e){throw p({error:e,provider:this.id,reference:n,operation:`createSecret`})}}}async rotateSecret(e,t){return this.setSecret(e,t)}async deleteSecret(e){let t=this.parseReference(e),n=this.getClient(t.region);try{await n.send(new a({SecretId:t.secretId,RecoveryWindowInDays:7}))}catch(t){throw p({error:t,provider:this.id,reference:e,operation:`deleteSecret`})}}getClient(e){if(this.injectedClient)return this.injectedClient;let t=this.clientsByRegion.get(e);if(t)return t;let n=new c({...this.clientConfig??{},region:e});return this.clientsByRegion.set(e,n),n}parseReference(t){let r=n(t);if(r.provider!==`aws`)throw new e({message:`Unsupported secret provider: ${r.provider}`,provider:this.id,reference:t,code:`INVALID`});let i=r.path.split(`/`).filter(Boolean);if(i.length<3||i[0]!==`secretsmanager`)throw new e({message:`Expected secret reference format aws://secretsmanager/{region}/{secretIdOrArn}[?version=...]`,provider:this.id,reference:t,code:`INVALID`});let a=i[1],o=this.resolveRegion(a),s=i.slice(2).join(`/`);if(!s)throw new e({message:`Unable to resolve secret id from reference "${r.path}"`,provider:this.id,reference:t,code:`INVALID`});return{region:o,secretId:s,version:r.extras?.version,stage:r.extras?.stage}}resolveRegion(t){let n=t??this.explicitRegion??process.env.AWS_REGION??process.env.AWS_DEFAULT_REGION;if(!n)throw new e({message:`AWS region must be provided either in reference (aws://secretsmanager/{region}/...) or via AWS_REGION/AWS_DEFAULT_REGION.`,provider:this.id,reference:`aws://secretsmanager//`,code:`INVALID`});return n}buildVersionSelector(e){return e?e===`latest`||e===`current`?{VersionStage:`AWSCURRENT`}:e.startsWith(`AWS`)?{VersionStage:e}:{VersionId:e}:{}}buildReference(e,t,n){let r=`aws://secretsmanager/${e}/${t}`,i=n?Object.entries(n).filter(([,e])=>!!e).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join(`&`):``;return i?`${r}?${i}`:r}};function u(t,n,i){if(!t||typeof t!=`object`)throw new e({message:`Invalid AWS Secrets Manager response`,provider:i,reference:n,code:`UNKNOWN`,cause:t});let a=t;if(a.SecretBinary instanceof Uint8Array)return a.SecretBinary;if(typeof a.SecretBinary==`string`)return r.from(a.SecretBinary,`base64`);if(typeof a.SecretString==`string`)return r.from(a.SecretString,`utf-8`);throw new e({message:`AWS secret value is empty`,provider:i,reference:n,code:`NOT_FOUND`,cause:t})}function d(e){return e.startsWith(`arn:aws:secretsmanager:`)}function f(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.$metadata?.httpStatusCode==`number`?t.$metadata.httpStatusCode===404:t.name===`ResourceNotFoundException`}function p(t){let{error:n,provider:r,reference:i,operation:a}=t;if(n instanceof e)return n;let o=typeof n==`object`&&!!n&&`$metadata`in n&&typeof n.$metadata==`object`&&n.$metadata?.httpStatusCode,s=o===404?`NOT_FOUND`:o===401||o===403?`FORBIDDEN`:o===400?`INVALID`:`UNKNOWN`;return new e({message:n instanceof Error?n.message:`Unknown error during ${a}`,provider:r,reference:i,code:s,cause:n})}export{l as AwsSecretsManagerProvider};
@@ -1 +1 @@
1
- import{SecretProviderError as e,normalizeSecretPayload as t,parseSecretUri as n}from"./provider.js";import{GcpSecretManagerProvider as r}from"./gcp-secret-manager.js";import{EnvSecretProvider as i}from"./env-secret-provider.js";import{SecretProviderManager as a}from"./manager.js";export{i as EnvSecretProvider,r as GcpSecretManagerProvider,e as SecretProviderError,a as SecretProviderManager,t as normalizeSecretPayload,n as parseSecretUri};
1
+ import{SecretProviderError as e,normalizeSecretPayload as t,parseSecretUri as n}from"./provider.js";import{AwsSecretsManagerProvider as r}from"./aws-secret-manager.js";import{EnvSecretProvider as i}from"./env-secret-provider.js";import{GcpSecretManagerProvider as a}from"./gcp-secret-manager.js";import{ScalewaySecretManagerProvider as o}from"./scaleway-secret-manager.js";import{SecretProviderManager as s}from"./manager.js";export{r as AwsSecretsManagerProvider,i as EnvSecretProvider,a as GcpSecretManagerProvider,o as ScalewaySecretManagerProvider,e as SecretProviderError,s as SecretProviderManager,t as normalizeSecretPayload,n as parseSecretUri};
@@ -0,0 +1 @@
1
+ import{SecretProviderError as e,normalizeSecretPayload as t,parseSecretUri as n}from"./provider.js";import{Buffer as r}from"node:buffer";const i=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;var a=class{id=`scaleway-secret-manager`;token;defaultRegion;defaultProjectId;baseUrl;fetchFn;constructor(e={}){this.token=e.token??process.env.SCW_SECRET_KEY??process.env.SCALEWAY_SECRET_KEY??``,this.defaultRegion=e.defaultRegion??process.env.SCW_DEFAULT_REGION??process.env.SCW_REGION,this.defaultProjectId=e.defaultProjectId??process.env.SCW_DEFAULT_PROJECT_ID??process.env.SCW_PROJECT_ID,this.baseUrl=e.baseUrl??`https://api.scaleway.com`,this.fetchFn=e.fetch??fetch}canHandle(e){try{let t=n(e);return t.provider===`scw`&&(t.path===`secret-manager`||t.path.startsWith(`secret-manager/`))}catch{return!1}}async getSecret(t,n){let a=this.parseReference(t);if(!this.token)throw new e({message:`Scaleway secret manager token is missing (set SCW_SECRET_KEY / SCALEWAY_SECRET_KEY).`,provider:this.id,reference:t,code:`FORBIDDEN`});if(!i.test(a.secretIdOrName))throw new e({message:`Scaleway getSecret requires a secretId (uuid) reference, not a secret name.`,provider:this.id,reference:t,code:`INVALID`});let s=n?.version??a.revision??`latest`,c=`${this.baseUrl}/secret-manager/v1beta1/regions/${encodeURIComponent(a.region)}/secrets/${encodeURIComponent(a.secretIdOrName)}/versions/${encodeURIComponent(s)}/access`,u=await this.fetchFn(c,{method:`GET`,headers:{"X-Auth-Token":this.token}});if(!u.ok)throw await l({response:u,provider:this.id,reference:t,operation:`getSecret`});let d=o(await u.json());return{data:r.from(d,`base64`),version:s,metadata:{region:a.region,secretId:a.secretIdOrName},retrievedAt:new Date}}async setSecret(n,a){let o=this.parseReference(n);if(!this.token)throw new e({message:`Scaleway secret manager token is missing (set SCW_SECRET_KEY / SCALEWAY_SECRET_KEY).`,provider:this.id,reference:n,code:`FORBIDDEN`});let s=t(a),c=r.from(s).toString(`base64`),l=i.test(o.secretIdOrName)?o.secretIdOrName:await this.createSecret({region:o.region,name:o.secretIdOrName,reference:n}),u=await this.createSecretVersion({region:o.region,secretId:l,dataB64:c,reference:n});return{reference:this.buildReference(o.region,l,{version:u}),version:u}}async rotateSecret(e,t){return this.setSecret(e,t)}async deleteSecret(t){let n=this.parseReference(t);if(!this.token)throw new e({message:`Scaleway secret manager token is missing (set SCW_SECRET_KEY / SCALEWAY_SECRET_KEY).`,provider:this.id,reference:t,code:`FORBIDDEN`});if(!i.test(n.secretIdOrName))throw new e({message:`Scaleway deleteSecret requires a secretId (uuid) reference, not a secret name.`,provider:this.id,reference:t,code:`INVALID`});let r=`${this.baseUrl}/secret-manager/v1beta1/regions/${encodeURIComponent(n.region)}/secrets/${encodeURIComponent(n.secretIdOrName)}`,a=await this.fetchFn(r,{method:`DELETE`,headers:{"X-Auth-Token":this.token}});if(!a.ok)throw await l({response:a,provider:this.id,reference:t,operation:`deleteSecret`})}parseReference(t){let r=n(t);if(r.provider!==`scw`)throw new e({message:`Unsupported secret provider: ${r.provider}`,provider:this.id,reference:t,code:`INVALID`});let i=r.path.split(`/`).filter(Boolean);if(i.length<2||i[0]!==`secret-manager`)throw new e({message:`Expected secret reference format scw://secret-manager/{region}/{secretIdOrName}[?version=...]`,provider:this.id,reference:t,code:`INVALID`});let a=i[1]??this.defaultRegion;if(!a)throw new e({message:`Scaleway region must be provided either in reference (scw://secret-manager/{region}/...) or via SCW_DEFAULT_REGION/SCW_REGION.`,provider:this.id,reference:t,code:`INVALID`});let o=i.slice(2).join(`/`);if(!o)throw new e({message:`Unable to resolve secret id/name from reference "${r.path}"`,provider:this.id,reference:t,code:`INVALID`});return{region:a,secretIdOrName:o,revision:r.extras?.version}}async createSecret(t){let n=this.defaultProjectId;if(!n)throw new e({message:`Scaleway project id is required to create secrets by name (set SCW_DEFAULT_PROJECT_ID/SCW_PROJECT_ID).`,provider:this.id,reference:t.reference,code:`INVALID`});let r=`${this.baseUrl}/secret-manager/v1beta1/regions/${encodeURIComponent(t.region)}/secrets`,i=await this.fetchFn(r,{method:`POST`,headers:{"Content-Type":`application/json`,"X-Auth-Token":this.token},body:JSON.stringify({name:t.name,project_id:n})});if(!i.ok)throw await l({response:i,provider:this.id,reference:t.reference,operation:`createSecret`});return s(await i.json())}async createSecretVersion(e){let t=`${this.baseUrl}/secret-manager/v1beta1/regions/${encodeURIComponent(e.region)}/secrets/${encodeURIComponent(e.secretId)}/versions`,n=await this.fetchFn(t,{method:`POST`,headers:{"Content-Type":`application/json`,"X-Auth-Token":this.token},body:JSON.stringify({data:e.dataB64})});if(!n.ok)throw await l({response:n,provider:this.id,reference:e.reference,operation:`createSecretVersion`});return c(await n.json())??`latest`}buildReference(e,t,n){let r=`scw://secret-manager/${e}/${t}`,i=n?Object.entries(n).filter(([,e])=>!!e).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join(`&`):``;return i?`${r}?${i}`:r}};function o(e){if(!e||typeof e!=`object`)throw Error(`Invalid scaleway secret payload`);let t=e;if(typeof t.data==`string`&&t.data)return t.data;throw Error(`Scaleway secret payload is missing data`)}function s(e){if(!e||typeof e!=`object`)throw Error(`Invalid scaleway createSecret payload`);let t=e;if(typeof t.id==`string`&&t.id)return t.id;throw Error(`Scaleway createSecret response is missing id`)}function c(e){if(!e||typeof e!=`object`)return;let t=e;if(typeof t.revision==`number`)return String(t.revision);if(typeof t.revision==`string`&&t.revision)return t.revision;if(typeof t.id==`string`&&t.id)return t.id}async function l(t){let{response:n,provider:r,reference:i,operation:a}=t,o=n.status===404?`NOT_FOUND`:n.status===401||n.status===403?`FORBIDDEN`:n.status>=400&&n.status<500?`INVALID`:`UNKNOWN`,s=await u(n);return new e({message:s?`Scaleway Secret Manager ${a} failed (${n.status}): ${s}`:`Scaleway Secret Manager ${a} failed (${n.status})`,provider:r,reference:i,code:o})}async function u(e){try{let t=(await e.text()).trim();return t.length?t:void 0}catch{return}}export{a as ScalewaySecretManagerProvider};
@@ -1 +1 @@
1
- function e(e,t){e.register(t.type,async e=>{let n=t.schema.parse(e.payload),r={...e,payload:n};await t.handler(n,r)})}export{e as registerDefinedJob};
1
+ function e(e,t){e.register(t.type,async e=>{let n=t.schema.parse(e.payload);await t.handler(n,e)})}export{e as registerDefinedJob};
@@ -1 +1 @@
1
- import{randomUUID as e}from"node:crypto";var t=class{handlers=new Map;constructor(e){this.options=e}async enqueue(t,n,r={}){let i=r.delaySeconds==null?void 0:{seconds:Math.floor(Date.now()/1e3)+r.delaySeconds},a=Buffer.from(JSON.stringify({id:e(),type:t,payload:n}),`utf-8`);return await this.options.client.createTask({parent:`projects/${this.options.projectId}/locations/${this.options.location}/queues/${this.options.queue}`,task:{httpRequest:{httpMethod:`POST`,url:this.options.resolveUrl(t),body:a,headers:{"Content-Type":`application/json`},oidcToken:this.options.serviceAccountEmail?{serviceAccountEmail:this.options.serviceAccountEmail}:void 0},scheduleTime:i}}),{id:e(),type:t,payload:n,status:`pending`,attempts:0,createdAt:new Date,updatedAt:new Date}}register(e,t){this.handlers.set(e,t)}start(){}async stop(){this.handlers.clear()}};export{t as GcpCloudTasksQueue};
1
+ import{DEFAULT_RETRY_POLICY as e}from"./queue.js";import{randomUUID as t}from"node:crypto";var n=class{handlers=new Map;constructor(e){this.options=e}async enqueue(n,r,i={}){let a=i.delaySeconds==null?void 0:{seconds:Math.floor(Date.now()/1e3)+i.delaySeconds},o=Buffer.from(JSON.stringify({id:t(),type:n,payload:r}),`utf-8`);return await this.options.client.createTask({parent:`projects/${this.options.projectId}/locations/${this.options.location}/queues/${this.options.queue}`,task:{httpRequest:{httpMethod:`POST`,url:this.options.resolveUrl(n),body:o,headers:{"Content-Type":`application/json`},oidcToken:this.options.serviceAccountEmail?{serviceAccountEmail:this.options.serviceAccountEmail}:void 0},scheduleTime:a}}),{id:t(),type:n,version:1,payload:r,status:`pending`,priority:i.priority??0,attempts:0,maxRetries:i.maxRetries??e.maxRetries,createdAt:new Date,updatedAt:new Date}}register(e,t){this.handlers.set(e,t)}start(){}async stop(){this.handlers.clear()}};export{n as GcpCloudTasksQueue};
@@ -1 +1 @@
1
- import{randomUUID as e}from"node:crypto";var t=class{handlers=new Map;constructor(e){this.options=e}async enqueue(t,n,r={}){return await this.options.client.topic(this.options.topicName).publishMessage({data:Buffer.from(JSON.stringify({id:e(),type:t,payload:n}),`utf-8`)}),{id:e(),type:t,payload:n,status:`pending`,attempts:0,createdAt:new Date,updatedAt:new Date}}register(e,t){this.handlers.set(e,t)}start(){}async stop(){this.handlers.clear()}};export{t as GcpPubSubQueue};
1
+ import{DEFAULT_RETRY_POLICY as e}from"./queue.js";import{randomUUID as t}from"node:crypto";var n=class{handlers=new Map;constructor(e){this.options=e}async enqueue(n,r,i={}){return await this.options.client.topic(this.options.topicName).publishMessage({data:Buffer.from(JSON.stringify({id:t(),type:n,payload:r}),`utf-8`)}),{id:t(),type:n,version:1,payload:r,status:`pending`,priority:i.priority??0,attempts:0,maxRetries:i.maxRetries??e.maxRetries,createdAt:new Date,updatedAt:new Date}}register(e,t){this.handlers.set(e,t)}start(){}async stop(){this.handlers.clear()}};export{n as GcpPubSubQueue};
@@ -1 +1 @@
1
- import{registerDefinedJob as e}from"../define-job.js";import{PING_JOB_TYPE as t,PingPayloadSchema as n,pingJob as r}from"./ping-handler.js";import{createGmailSyncHandler as i}from"./gmail-sync-handler.js";import{createStorageDocumentHandler as a}from"./storage-document-handler.js";function o(t){e(t,r)}export{t as PING_JOB_TYPE,n as PingPayloadSchema,i as createGmailSyncHandler,a as createStorageDocumentHandler,r as pingJob,o as registerAllJobs};
1
+ import{registerDefinedJob as e}from"../define-job.js";import{createGmailSyncHandler as t}from"./gmail-sync-handler.js";import{PING_JOB_TYPE as n,PingPayloadSchema as r,pingJob as i}from"./ping-handler.js";import{createStorageDocumentHandler as a}from"./storage-document-handler.js";function o(t){e(t,i)}export{n as PING_JOB_TYPE,r as PingPayloadSchema,t as createGmailSyncHandler,a as createStorageDocumentHandler,i as pingJob,o as registerAllJobs};
@@ -1 +1 @@
1
- import{GcpCloudTasksQueue as e}from"./gcp-cloud-tasks.js";import{GcpPubSubQueue as t}from"./gcp-pubsub.js";import{MemoryJobQueue as n}from"./memory-queue.js";import{ScalewaySqsJobQueue as r}from"./scaleway-sqs-queue.js";import{PING_JOB_TYPE as i,PingPayloadSchema as a,pingJob as o}from"./handlers/ping-handler.js";import{createGmailSyncHandler as s}from"./handlers/gmail-sync-handler.js";import{createStorageDocumentHandler as c}from"./handlers/storage-document-handler.js";import{registerAllJobs as l}from"./handlers/index.js";export{e as GcpCloudTasksQueue,t as GcpPubSubQueue,n as MemoryJobQueue,i as PING_JOB_TYPE,a as PingPayloadSchema,r as ScalewaySqsJobQueue,s as createGmailSyncHandler,c as createStorageDocumentHandler,o as pingJob,l as registerAllJobs};
1
+ import{registerDefinedJob as e}from"./define-job.js";import{DEFAULT_RETRY_POLICY as t,calculateBackoff as n,defineJobType as r}from"./queue.js";export{t as DEFAULT_RETRY_POLICY,n as calculateBackoff,r as defineJobType,e as registerDefinedJob};
@@ -1 +1 @@
1
- import{randomUUID as e}from"node:crypto";var t=class{jobs=[];handlers=new Map;timer;processing=!1;constructor(e=200){this.pollIntervalMs=e}async enqueue(t,n,r={}){let i={id:e(),type:t,payload:n,status:`pending`,attempts:0,createdAt:new Date,updatedAt:new Date};return r.delaySeconds&&(i.updatedAt=new Date(Date.now()+r.delaySeconds*1e3)),this.jobs.push(i),i}register(e,t){this.handlers.set(e,t)}start(){this.timer||=setInterval(()=>{this.processNext()},this.pollIntervalMs)}async stop(){for(this.timer&&=(clearInterval(this.timer),void 0);this.processing;)await new Promise(e=>setTimeout(e,10))}async processNext(){if(this.processing)return;let e=this.jobs.find(e=>e.status===`pending`&&e.updatedAt<=new Date);if(!e)return;let t=this.handlers.get(e.type);if(t){this.processing=!0,e.status=`running`,e.updatedAt=new Date,e.attempts+=1;try{await t(e),e.status=`completed`,e.updatedAt=new Date}catch(t){e.status=`failed`,e.lastError=t instanceof Error?t.message:`Unknown job error`,e.updatedAt=new Date}finally{this.processing=!1}}}};export{t as MemoryJobQueue};
1
+ import{DEFAULT_RETRY_POLICY as e}from"./queue.js";import{randomUUID as t}from"node:crypto";var n=class{jobs=[];handlers=new Map;timer;processing=!1;constructor(e=200){this.pollIntervalMs=e}async enqueue(n,r,i={}){let a={id:t(),type:n,version:1,payload:r,status:`pending`,priority:i.priority??0,attempts:0,maxRetries:i.maxRetries??e.maxRetries,createdAt:new Date,updatedAt:new Date};return i.delaySeconds&&(a.updatedAt=new Date(Date.now()+i.delaySeconds*1e3)),this.jobs.push(a),a}register(e,t){this.handlers.set(e,t)}start(){this.timer||=setInterval(()=>{this.processNext()},this.pollIntervalMs)}async stop(){for(this.timer&&=(clearInterval(this.timer),void 0);this.processing;)await new Promise(e=>setTimeout(e,10))}async processNext(){if(this.processing)return;let e=this.jobs.find(e=>e.status===`pending`&&e.updatedAt<=new Date);if(!e)return;let t=this.handlers.get(e.type);if(t){this.processing=!0,e.status=`running`,e.updatedAt=new Date,e.attempts+=1;try{await t(e),e.status=`completed`,e.updatedAt=new Date}catch(t){e.status=`failed`,e.lastError=t instanceof Error?t.message:`Unknown job error`,e.updatedAt=new Date}finally{this.processing=!1}}}};export{n as MemoryJobQueue};
@@ -0,0 +1 @@
1
+ import"zod";const e={maxRetries:3,initialBackoffMs:1e3,maxBackoffMs:6e4,multiplier:2,jitter:!0};function t(t,n=e){let r=Math.min(n.initialBackoffMs*n.multiplier**(t-1),n.maxBackoffMs);if(n.jitter){let e=.8+Math.random()*.4;return Math.floor(r*e)}return r}function n(e){return e}export{e as DEFAULT_RETRY_POLICY,t as calculateBackoff,n as defineJobType};
@@ -1 +1 @@
1
- import{randomUUID as e}from"crypto";import{DeleteMessageCommand as t,ReceiveMessageCommand as n,SQSClient as r,SendMessageCommand as i}from"@aws-sdk/client-sqs";var a=class{sqs;queueUrl;waitTimeSeconds;maxNumberOfMessages;visibilityTimeoutSeconds;handlers=new Map;running=!1;constructor(e){let t=process.env.SCALEWAY_ACCESS_KEY_QUEUE,n=process.env.SCALEWAY_SECRET_KEY_QUEUE;if(!t||!n)throw Error(`Missing SCALEWAY_ACCESS_KEY_QUEUE / SCALEWAY_SECRET_KEY_QUEUE in env`);this.sqs=new r({region:e.region??process.env.SCALEWAY_REGION??`par`,endpoint:`https://sqs.mnq.fr-par.scaleway.com`,credentials:{accessKeyId:t,secretAccessKey:n}}),this.queueUrl=e.queueUrl,this.waitTimeSeconds=e.waitTimeSeconds??20,this.maxNumberOfMessages=e.maxNumberOfMessages??5,this.visibilityTimeoutSeconds=e.visibilityTimeoutSeconds??60}async enqueue(t,n,r={}){let a=e(),o=new Date,s={id:a,type:t,payload:n};return await this.sqs.send(new i({QueueUrl:this.queueUrl,MessageBody:JSON.stringify(s),DelaySeconds:r.delaySeconds??0})),{id:a,type:t,payload:n,status:`pending`,attempts:0,createdAt:o,updatedAt:o}}register(e,t){if(this.handlers.has(e))throw Error(`Handler already registered for job type "${e}"`);this.handlers.set(e,t)}start(){this.running||(this.running=!0,this.pollLoop().catch(e=>{console.error(`[queue] Fatal error in poll loop`,e),process.exit(1)}))}async stop(){this.running=!1}async pollLoop(){for(console.log(`[queue] SQS worker started for queue:`,this.queueUrl);this.running;)try{let e=(await this.sqs.send(new n({QueueUrl:this.queueUrl,MaxNumberOfMessages:this.maxNumberOfMessages,WaitTimeSeconds:this.waitTimeSeconds,VisibilityTimeout:this.visibilityTimeoutSeconds,MessageSystemAttributeNames:[`ApproximateReceiveCount`]}))).Messages??[];if(e.length===0)continue;for(let t of e){if(!t.Body||!t.ReceiptHandle){console.warn(`[queue] Message missing Body or ReceiptHandle`,t.MessageId);continue}let e;try{e=JSON.parse(t.Body)}catch(e){console.error(`[queue] Failed to parse message body (id=${t.MessageId}), deleting`,e),await this.deleteMessage(t.ReceiptHandle);continue}let n=this.handlers.get(e.type);if(!n){console.error(`[queue] No handler registered for type "${e.type}", deleting message`),await this.deleteMessage(t.ReceiptHandle);continue}let r=new Date,i=parseInt(t.Attributes?.ApproximateReceiveCount??`1`,10),a={id:e.id,type:e.type,payload:e.payload,status:`pending`,attempts:i,createdAt:r,updatedAt:r};a.status=`running`,a.updatedAt=new Date;try{await n(a),a.status=`completed`,a.updatedAt=new Date,await this.deleteMessage(t.ReceiptHandle)}catch(e){a.status=`failed`,a.lastError=e instanceof Error?e.message:`Unknown job error`,a.updatedAt=new Date,console.error(`[queue] Error while handling job type=${a.type} id=${a.id}`,e)}}}catch(e){e&&typeof e==`object`&&`$response`in e?console.error(`[queue] Error while polling SQS`,e,e.$response):console.error(`[queue] Error while polling SQS`,e),await this.sleep(5e3)}console.log(`[queue] SQS worker stopped`)}async deleteMessage(e){try{await this.sqs.send(new t({QueueUrl:this.queueUrl,ReceiptHandle:e}))}catch(e){console.error(`[queue] Failed to delete message`,e)}}async sleep(e){await new Promise(t=>setTimeout(t,e))}};export{a as ScalewaySqsJobQueue};
1
+ import{DEFAULT_RETRY_POLICY as e}from"./queue.js";import{randomUUID as t}from"crypto";import{DeleteMessageCommand as n,ReceiveMessageCommand as r,SQSClient as i,SendMessageCommand as a}from"@aws-sdk/client-sqs";var o=class{sqs;queueUrl;waitTimeSeconds;maxNumberOfMessages;visibilityTimeoutSeconds;handlers=new Map;running=!1;constructor(e){let t=process.env.SCALEWAY_ACCESS_KEY_QUEUE,n=process.env.SCALEWAY_SECRET_KEY_QUEUE;if(!t||!n)throw Error(`Missing SCALEWAY_ACCESS_KEY_QUEUE / SCALEWAY_SECRET_KEY_QUEUE in env`);this.sqs=new i({region:e.region??process.env.SCALEWAY_REGION??`par`,endpoint:`https://sqs.mnq.fr-par.scaleway.com`,credentials:{accessKeyId:t,secretAccessKey:n}}),this.queueUrl=e.queueUrl,this.waitTimeSeconds=e.waitTimeSeconds??20,this.maxNumberOfMessages=e.maxNumberOfMessages??5,this.visibilityTimeoutSeconds=e.visibilityTimeoutSeconds??60}async enqueue(n,r,i={}){let o=t(),s=new Date,c={id:o,type:n,payload:r};return await this.sqs.send(new a({QueueUrl:this.queueUrl,MessageBody:JSON.stringify(c),DelaySeconds:i.delaySeconds??0})),{id:o,type:n,version:1,payload:r,status:`pending`,priority:i.priority??0,attempts:0,maxRetries:i.maxRetries??e.maxRetries,createdAt:s,updatedAt:s}}register(e,t){if(this.handlers.has(e))throw Error(`Handler already registered for job type "${e}"`);this.handlers.set(e,t)}start(){this.running||(this.running=!0,this.pollLoop().catch(e=>{console.error(`[queue] Fatal error in poll loop`,e),process.exit(1)}))}async stop(){this.running=!1}async pollLoop(){for(console.log(`[queue] SQS worker started for queue:`,this.queueUrl);this.running;)try{let t=(await this.sqs.send(new r({QueueUrl:this.queueUrl,MaxNumberOfMessages:this.maxNumberOfMessages,WaitTimeSeconds:this.waitTimeSeconds,VisibilityTimeout:this.visibilityTimeoutSeconds,MessageSystemAttributeNames:[`ApproximateReceiveCount`]}))).Messages??[];if(t.length===0)continue;for(let n of t){if(!n.Body||!n.ReceiptHandle){console.warn(`[queue] Message missing Body or ReceiptHandle`,n.MessageId);continue}let t;try{t=JSON.parse(n.Body)}catch(e){console.error(`[queue] Failed to parse message body (id=${n.MessageId}), deleting`,e),await this.deleteMessage(n.ReceiptHandle);continue}let r=this.handlers.get(t.type);if(!r){console.error(`[queue] No handler registered for type "${t.type}", deleting message`),await this.deleteMessage(n.ReceiptHandle);continue}let i=new Date,a=parseInt(n.Attributes?.ApproximateReceiveCount??`1`,10),o={id:t.id,type:t.type,version:1,payload:t.payload,status:`pending`,priority:0,attempts:a,maxRetries:e.maxRetries,createdAt:i,updatedAt:i};o.status=`running`,o.updatedAt=new Date;try{await r(o),o.status=`completed`,o.updatedAt=new Date,await this.deleteMessage(n.ReceiptHandle)}catch(e){o.status=`failed`,o.lastError=e instanceof Error?e.message:`Unknown job error`,o.updatedAt=new Date,console.error(`[queue] Error while handling job type=${o.type} id=${o.id}`,e)}}}catch(e){e&&typeof e==`object`&&`$response`in e?console.error(`[queue] Error while polling SQS`,e,e.$response):console.error(`[queue] Error while polling SQS`,e),await this.sleep(5e3)}console.log(`[queue] SQS worker stopped`)}async deleteMessage(e){try{await this.sqs.send(new n({QueueUrl:this.queueUrl,ReceiptHandle:e}))}catch(e){console.error(`[queue] Failed to delete message`,e)}}async sleep(e){await new Promise(t=>setTimeout(t,e))}};export{o as ScalewaySqsJobQueue};
@@ -1 +1 @@
1
- import{PrismaObjectRef as e}from"../object-ref.js";import{PrismaInterfaceRef as t}from"../interface-ref.js";import{getDMMF as n}from"./get-client.js";import{PothosSchemaError as r}from"@pothos/core";const i=new WeakMap;function a(n,r,a=`object`){i.has(r)||i.set(r,new Map);let o=i.get(r);return o.has(n)||o.set(n,a===`object`?new e(n,n):new t(n,n)),o.get(n)}function o(e,t,n){let i=s(e,t,n);if(i.kind!==`object`)throw new r(`Field ${n} of model '${e}' is not a relation (${i.kind})`);return i}function s(e,t,n){let i=c(e,t).fields.find(e=>e.name===n);if(!i)throw new r(`Field '${n}' not found in model '${e}'`);return i}function c(e,t){let i=n(t),a=Array.isArray(i.models)?i.models.find(t=>t.name===e):i.models[e];if(!a)throw new r(`Model '${e}' not found in DMMF`);return a}function l(e,t){let n=`${t.slice(0,1).toLowerCase()}${t.slice(1)}`,i=n in e?e[n]:null;if(!i)throw new r(`Unable to find delegate for model ${t}`);return i}export{l as getDelegateFromModel,s as getFieldData,c as getModel,a as getRefFromModel,o as getRelation};
1
+ import{PrismaObjectRef as e}from"../object-ref.js";import{PrismaInterfaceRef as t}from"../interface-ref.js";import{getDMMF as n}from"./get-client.js";import{PothosSchemaError as r}from"@pothos/core";const i=new WeakMap;function a(n,r,a=`object`){i.has(r)||i.set(r,new Map);let o=i.get(r);return o.has(n)||o.set(n,a===`object`?new e(n,n):new t(n,n)),o.get(n)}function o(e,t,n){let i=s(e,t,n);if(i.kind!==`object`)throw new r(`Field ${n} of model '${e}' is not a relation (${i.kind})`);return i}function s(e,t,n){let i=c(e,t).fields.find(e=>e.name===n);if(!i)throw new r(`Field '${n}' not found in model '${e}'`);return i}function c(e,t){let i=n(t),a=Array.isArray(i.models)?i.models.find(t=>t.name===e):i.models[e];if(!a)throw new r(`Model '${e}' not found in DMMF`);if(!a.uniqueIndexes)throw new r(`Model '${e}' is missing required datamodel information. This is likely because you're using Prisma v7+ without providing the generated datamodel. Please follow the setup instructions at https://pothos-graphql.dev/docs/plugins/prisma#setup to generate and configure the datamodel properly.`);return a}function l(e,t){let n=`${t.slice(0,1).toLowerCase()}${t.slice(1)}`,i=n in e?e[n]:null;if(!i)throw new r(`Unable to find delegate for model ${t}`);return i}export{l as getDelegateFromModel,s as getFieldData,c as getModel,a as getRefFromModel,o as getRelation};
@@ -1 +1 @@
1
- import{setLoaderMappings as e}from"./loader-map.js";import{require_graphql as t}from"../../../../graphql/index.js";import{createState as n,mergeSelection as r,selectionCompatible as i,selectionToQuery as a}from"./selections.js";import{wrapWithUsageCheck as o}from"./usage.js";import{PothosValidationError as s,getMappedArgumentValues as c}from"@pothos/core";var l=t();function u(e,t,n,i,a,o,s){if(a.name.value.startsWith(`__`))return;let{pothosPrismaInclude:c,pothosPrismaSelect:f,pothosIndirectInclude:m,pothosPrismaModel:h}=e.extensions??{};if(m?.path&&m.path.length>0||m?.paths&&m.paths.length===0)d(e,n,a,[],m.paths??[m.path],o,(e,r,a,o)=>{u(e,t,n,i,r,a,o)});else if(m){u(n.schema.getType(m.getType()),t,n,i,a,o,s);return}((0,l.isObjectType)(e)||(0,l.isInterfaceType)(e))&&(h&&!f&&(i.mode=`include`),(c??f)&&r(i,{select:f?{...f}:void 0,include:c?{...c}:void 0}),a.selectionSet&&(!s||!i.skipDeferredFragments)&&p(e,t,n,i,a.selectionSet,o))}function d(e,t,n,r,i,a,o,s=!1){for(let c of i)r.length>0?f(e,t,n,[...r,...c],a,o,s):f(e,t,n,c,a,o,s)}function f(e,t,n,r,i,a,o=!1,c=e){if(r.length===0){a(e,n,i,o);return}let[u,...d]=r;if(!(!n.selectionSet||!u))for(let p of n.selectionSet.selections)switch(p.kind){case l.Kind.FIELD:c.name===e.name&&!b(t,p)&&p.name.value===u.name&&((0,l.isObjectType)(e)||(0,l.isInterfaceType)(e))&&f((0,l.getNamedType)(e.getFields()[p.name.value].type),t,p,d,[...i,p.alias?.value??p.name.value],a,o);continue;case l.Kind.FRAGMENT_SPREAD:f(t.schema.getType(t.fragments[p.name.value].typeCondition.name.value),t,t.fragments[p.name.value],r,i,a,o||x(p,t),u.type?t.schema.getType(u.type):c);continue;case l.Kind.INLINE_FRAGMENT:(!p.typeCondition||!u.type||p.typeCondition.name.value===u.type)&&f(p.typeCondition?t.schema.getType(p.typeCondition.name.value):e,t,p,r,i,a,o||x(p,t),u.type?t.schema.getType(u.type):c);continue;default:throw new s(`Unsupported selection kind ${n.kind}`)}}function p(e,t,n,r,i,a,o=e){let c=e;for(let u of i.selections)switch(u.kind){case l.Kind.FIELD:if(o.name!==e.name)continue;m(e,t,n,r,u,a);continue;case l.Kind.FRAGMENT_SPREAD:if(r.skipDeferredFragments&&x(u,n))continue;c=n.schema.getType(n.fragments[u.name.value].typeCondition.name.value),p(c,t,n,r,n.fragments[u.name.value].selectionSet,a,c.extensions?.pothosPrismaModel===e.extensions.pothosPrismaModel?c:o);continue;case l.Kind.INLINE_FRAGMENT:if(r.skipDeferredFragments&&x(u,n))continue;c=u.typeCondition?n.schema.getType(u.typeCondition.name.value):e,p(c,t,n,r,u.selectionSet,a,c.extensions?.pothosPrismaModel===e.extensions.pothosPrismaModel?c:o);continue;default:throw new s(`Unsupported selection kind ${u.kind}`)}}function m(e,t,n,o,p,m){if(p.name.value.startsWith(`__`)||b(n,p))return;let h=e.getFields()[p.name.value];if(!h)throw new s(`Unknown field ${p.name.value} on ${e.name}`);let g=h.extensions?.pothosPrismaSelect,x,S={};if(typeof g==`function`){let e=c(h,p,t,n);x=g(e,t,(i,s,c)=>{let f=(0,l.getNamedType)(h.type),m=typeof i==`function`?i(e,t):i,g=Array.isArray(s)?y(s,v(f,n),c?(0,l.getNamedType)(n.schema.getType(c)):void 0):s,b=_(v(g?n.schema.getType(g.getType()):f,n),n,o.skipDeferredFragments,o);if(typeof m==`object`&&Object.keys(m).length>0&&r(b,{select:{},...m}),g?.path&&g.path.length>0||g?.paths&&g.paths.length>0)d(f,n,p,f.extensions?.pothosIndirectInclude?.path??[],g?.paths??(g?.path?[g.path]:[]),[],(e,r,i,a)=>{u(e,t,n,b,r,i,a)});else if(g){let e=n.schema.getType(g.getType());e!==f&&u(e,t,n,b,p,[])}return u(f,t,n,b,p,[]),S=b.mappings,a(b)},e=>{if(e.length===0)return p;let t=(0,l.getNamedType)(h.type),r=null;return f(t,n,p,e.map(e=>({name:e})),[],(e,t)=>{r=t}),r})}else x={select:g};g&&i(o,x,!0)&&(r(o,x),o.mappings[p.alias?.value??p.name.value]={field:p.name.value,type:e.name,mappings:S,indirectPath:m})}function h({context:t,info:n,typeName:r,select:i,include:s,path:c=[],paths:p=[],withUsageCheck:m=!1,skipDeferredFragments:h=!0}){let g=(0,l.getNamedType)(n.returnType),v=r?n.schema.getTypeMap()[r]:g,y,b=i?{select:i}:s?{include:s}:void 0;if(c.length>0||p.length>0){let{pothosIndirectInclude:e}=g.extensions??{};f(g,n,n.fieldNodes[0],e?.path??[],[],(e,i,a,o)=>{d(e,n,i,[],p.length>0?p.map(e=>e.map(e=>typeof e==`string`?{name:e}:e)):[c.map(e=>typeof e==`string`?{name:e}:e)],a,(e,i,a,o)=>{y=_(r?v:e,n,h,void 0,b),u(r?v:e,t,n,y,i,a,o)},o)})}else y=_(v,n,h,void 0,b),u(v,t,n,y,n.fieldNodes[0],[]);y||=_(v,n,h,void 0,b),e(t,n,y.mappings);let x=a(y);return m?o(x):x}function g(e,t,n,r){let i=r?t.schema.getTypeMap()[r]:t.parentType,a=_(i,t,n);if(!((0,l.isObjectType)(i)||(0,l.isInterfaceType)(i)))throw new s(`Prisma plugin can only resolve includes for object and interface types`);return m(i,e,t,a,t.fieldNodes[0],[]),a}function _(e,t,i,a,o){let s=v(e,t),c=n(s.extensions?.pothosPrismaFieldMap,s.extensions?.pothosPrismaSelect?`select`:`include`,i,a);return o&&r(c,o),c}function v(e,t){let n=e;for(;n.extensions?.pothosIndirectInclude;)n=t.schema.getType((n.extensions?.pothosIndirectInclude).getType());return n}function y(e,t,n){let r=e.length>0?t:n??t,i=[];if(!((0,l.isObjectType)(r)||(0,l.isInterfaceType)(r)))throw new s(`Expected ${r} to be an Object type`);for(let t of e){let e=r.getFields()[t];if(!e)throw new s(`Expected ${r} to have a field ${t}`);if(r=(0,l.getNamedType)(e.type),!((0,l.isObjectType)(r)||(0,l.isInterfaceType)(r)))throw new s(`Expected ${r} to be an Object or Interface type`);i.push({name:t,type:r.name})}return{getType:()=>n?.name??(i.length>0?i[i.length-1].type:t.name),path:i}}function b(e,t){return(0,l.getDirectiveValues)(l.GraphQLSkipDirective,t,e.variableValues)?.if===!0?!0:(0,l.getDirectiveValues)(l.GraphQLIncludeDirective,t,e.variableValues)?.if===!1}function x(e,t){let n=t.schema.getDirective(`defer`);if(!n)return!1;let r=(0,l.getDirectiveValues)(n,e,t.variableValues);return!!r&&r.if!==!1}export{h as queryFromInfo,g as selectionStateFromInfo};
1
+ import{setLoaderMappings as e}from"./loader-map.js";import{require_graphql as t}from"../../../../graphql/index.js";import{createState as n,mergeSelection as r,selectionCompatible as i,selectionToQuery as a}from"./selections.js";import{wrapWithUsageCheck as o}from"./usage.js";import{PothosValidationError as s,getMappedArgumentValues as c}from"@pothos/core";var l=t();function u(e,t,n,i,a,o,s){if(a.name.value.startsWith(`__`))return;let{pothosPrismaInclude:c,pothosPrismaSelect:f,pothosIndirectInclude:m,pothosPrismaModel:h}=e.extensions??{};if(m?.path&&m.path.length>0||m?.paths&&m.paths.length===0)d(e,n,a,[],m.paths??[m.path],o,(e,r,a,o)=>{u(e,t,n,i,r,a,o)});else if(m){u(n.schema.getType(m.getType()),t,n,i,a,o,s);return}((0,l.isObjectType)(e)||(0,l.isInterfaceType)(e))&&(h&&!f&&(i.mode=`include`),(c??f)&&r(i,{select:f?{...f}:void 0,include:c?{...c}:void 0}),a.selectionSet&&(!s||!i.skipDeferredFragments)&&p(e,t,n,i,a.selectionSet,o))}function d(e,t,n,r,i,a,o,s=!1){for(let c of i)r.length>0?f(e,t,n,[...r,...c],a,o,s):f(e,t,n,c,a,o,s)}function f(e,t,n,r,i,a,o=!1,c=e){if(r.length===0){a(e,n,i,o);return}let[u,...d]=r;if(!(!n.selectionSet||!u))for(let p of n.selectionSet.selections)switch(p.kind){case l.Kind.FIELD:c.name===e.name&&!x(t,p)&&p.name.value===u.name&&((0,l.isObjectType)(e)||(0,l.isInterfaceType)(e))&&f((0,l.getNamedType)(e.getFields()[p.name.value].type),t,p,d,[...i,p.alias?.value??p.name.value],a,o);continue;case l.Kind.FRAGMENT_SPREAD:f(t.schema.getType(t.fragments[p.name.value].typeCondition.name.value),t,t.fragments[p.name.value],r,i,a,o||S(p,t),u.type?t.schema.getType(u.type):c);continue;case l.Kind.INLINE_FRAGMENT:(!p.typeCondition||!u.type||p.typeCondition.name.value===u.type)&&f(p.typeCondition?t.schema.getType(p.typeCondition.name.value):e,t,p,r,i,a,o||S(p,t),u.type?t.schema.getType(u.type):c);continue;default:throw new s(`Unsupported selection kind ${n.kind}`)}}function p(e,t,n,r,i,a,o=e){let c=e;for(let u of i.selections)switch(u.kind){case l.Kind.FIELD:if(o.name!==e.name)continue;m(e,t,n,r,u,a);continue;case l.Kind.FRAGMENT_SPREAD:if(r.skipDeferredFragments&&S(u,n))continue;c=n.schema.getType(n.fragments[u.name.value].typeCondition.name.value),p(c,t,n,r,n.fragments[u.name.value].selectionSet,a,c.extensions?.pothosPrismaModel===e.extensions.pothosPrismaModel?c:o);continue;case l.Kind.INLINE_FRAGMENT:if(r.skipDeferredFragments&&S(u,n))continue;c=u.typeCondition?n.schema.getType(u.typeCondition.name.value):e,p(c,t,n,r,u.selectionSet,a,c.extensions?.pothosPrismaModel===e.extensions.pothosPrismaModel?c:o);continue;default:throw new s(`Unsupported selection kind ${u.kind}`)}}function m(e,t,n,o,p,m){if(p.name.value.startsWith(`__`)||x(n,p))return;let g=e.getFields()[p.name.value];if(!g)throw new s(`Unknown field ${p.name.value} on ${e.name}`);let _=g.extensions?.pothosPrismaSelect,S,C={};if(typeof _==`function`){let e=c(g,p,t,n);S=_(e,t,(i,s,c)=>{let f=(0,l.getNamedType)(g.type),m=typeof i==`function`?i(e,t):i,h=Array.isArray(s)?b(s,y(f,n),c?(0,l.getNamedType)(n.schema.getType(c)):void 0):s,_=v(y(h?n.schema.getType(h.getType()):f,n),n,o.skipDeferredFragments,o);if(typeof m==`object`&&Object.keys(m).length>0&&r(_,{select:{},...m}),h?.path&&h.path.length>0||h?.paths&&h.paths.length>0)d(f,n,p,f.extensions?.pothosIndirectInclude?.path??[],h?.paths??(h?.path?[h.path]:[]),[],(e,r,i,a)=>{u(e,t,n,_,r,i,a)});else if(h){let e=n.schema.getType(h.getType());e!==f&&u(e,t,n,_,p,[])}return u(f,t,n,_,p,[]),C=_.mappings,a(_)},e=>{if(e.length===0)return p;let t=(0,l.getNamedType)(g.type),r=null;return f(t,n,p,e.map(e=>({name:e})),[],(e,t)=>{r=t}),r})}else S={select:_};_&&i(o,S,!0)&&(r(o,S),o.mappings=h(o.mappings,{[p.alias?.value??p.name.value]:{field:p.name.value,type:e.name,mappings:C,indirectPath:m}}))}function h(e,t){let n={...e};for(let[e,r]of Object.entries(t))n[e]?n[e]={...n[e],mappings:h(n[e].mappings,r.mappings)}:n[e]=r;return n}function g({context:t,info:n,typeName:r,select:i,include:s,path:c=[],paths:p=[],withUsageCheck:m=!1,skipDeferredFragments:h=!0}){let g=(0,l.getNamedType)(n.returnType),_=r?n.schema.getTypeMap()[r]:g,y,b=i?{select:i}:s?{include:s}:void 0;if(c.length>0||p.length>0){let{pothosIndirectInclude:e}=g.extensions??{};f(g,n,n.fieldNodes[0],e?.path??[],[],(e,i,a,o)=>{d(e,n,i,[],p.length>0?p.map(e=>e.map(e=>typeof e==`string`?{name:e}:e)):[c.map(e=>typeof e==`string`?{name:e}:e)],a,(e,i,a,o)=>{y=v(r?_:e,n,h,void 0,b),u(r?_:e,t,n,y,i,a,o)},o)})}else y=v(_,n,h,void 0,b),u(_,t,n,y,n.fieldNodes[0],[]);y||=v(_,n,h,void 0,b),e(t,n,y.mappings);let x=a(y);return m?o(x):x}function _(e,t,n,r){let i=r?t.schema.getTypeMap()[r]:t.parentType,a=v(i,t,n);if(!((0,l.isObjectType)(i)||(0,l.isInterfaceType)(i)))throw new s(`Prisma plugin can only resolve includes for object and interface types`);return m(i,e,t,a,t.fieldNodes[0],[]),a}function v(e,t,i,a,o){let s=y(e,t),c=n(s.extensions?.pothosPrismaFieldMap,s.extensions?.pothosPrismaSelect?`select`:`include`,i,a);return o&&r(c,o),c}function y(e,t){let n=e;for(;n.extensions?.pothosIndirectInclude;)n=t.schema.getType(n.extensions.pothosIndirectInclude.getType());return n}function b(e,t,n){let r=e.length>0?t:n??t,i=[];if(!((0,l.isObjectType)(r)||(0,l.isInterfaceType)(r)))throw new s(`Expected ${r} to be an Object type`);for(let t of e){let e=r.getFields()[t];if(!e)throw new s(`Expected ${r} to have a field ${t}`);if(r=(0,l.getNamedType)(e.type),!((0,l.isObjectType)(r)||(0,l.isInterfaceType)(r)))throw new s(`Expected ${r} to be an Object or Interface type`);i.push({name:t,type:r.name})}return{getType:()=>n?.name??(i.length>0?i[i.length-1].type:t.name),path:i}}function x(e,t){return(0,l.getDirectiveValues)(l.GraphQLSkipDirective,t,e.variableValues)?.if===!0?!0:(0,l.getDirectiveValues)(l.GraphQLIncludeDirective,t,e.variableValues)?.if===!1}function S(e,t){let n=t.schema.getDirective(`defer`);if(!n)return!1;let r=(0,l.getDirectiveValues)(n,e,t.variableValues);return!!r&&r.if!==!1}export{g as queryFromInfo,_ as selectionStateFromInfo};
@@ -0,0 +1 @@
1
+ import{defaultRestPath as e,jsonSchemaForSpec as t}from"./jsonschema.js";function n(e,t){return`${e.replace(/\./g,`_`)}_v${t}`}function r(e,t,r){return`${e}_${n(t,r)}`}function i(e,t){return(t??(e===`query`?`GET`:`POST`)).toLowerCase()}function a(t){let n=t.transport?.rest?.path??e(t.meta.name,t.meta.version);return n.startsWith(`/`)?n:`/${n}`}function o(e,o={}){let s=e.listSpecs().filter(e=>e.meta.kind===`command`||e.meta.kind===`query`).slice().sort((e,t)=>{let n=e.meta.name.localeCompare(t.meta.name);return n===0?e.meta.version-t.meta.version:n}),c={openapi:`3.1.0`,info:{title:o.title??`ContractSpec API`,version:o.version??`0.0.0`,...o.description?{description:o.description}:{}},...o.servers?{servers:o.servers}:{},paths:{},components:{schemas:{}}};for(let e of s){let o=t(e),s=i(e.meta.kind,e.transport?.rest?.method),l=a(e),u=n(e.meta.name,e.meta.version),d=c.paths[l]??={},f={operationId:u,summary:e.meta.description??e.meta.name,description:e.meta.description,tags:e.meta.tags??[],"x-contractspec":{name:e.meta.name,version:e.meta.version,kind:e.meta.kind},responses:{}};if(o.input){let t=r(`Input`,e.meta.name,e.meta.version);c.components.schemas[t]=o.input,f.requestBody={required:!0,content:{"application/json":{schema:{$ref:`#/components/schemas/${t}`}}}}}let p={};if(o.output){let t=r(`Output`,e.meta.name,e.meta.version);c.components.schemas[t]=o.output,p[200]={description:`OK`,content:{"application/json":{schema:{$ref:`#/components/schemas/${t}`}}}}}else p[200]={description:`OK`};f.responses=p,d[s]=f}return c}export{o as openApiForRegistry};
@@ -1 +1 @@
1
- import{registerContractsOnBuilder as e}from"./graphql-pothos.js";import{createMcpServer as t}from"./provider-mcp.js";import{createFetchHandler as n}from"./rest-generic.js";import{elysiaPlugin as r}from"./rest-elysia.js";import{expressRouter as i}from"./rest-express.js";import{makeNextAppHandler as a}from"./rest-next-app.js";import{makeNextPagesHandler as o}from"./rest-next-pages.js";export{n as createFetchHandler,t as createMcpServer,r as elysiaPlugin,i as expressRouter,a as makeNextAppHandler,o as makeNextPagesHandler,e as registerContractsOnBuilder};
1
+ import{registerContractsOnBuilder as e}from"./graphql-pothos.js";import{createMcpServer as t}from"./mcp/createMcpServer.js";import"./provider-mcp.js";import{createFetchHandler as n}from"./rest-generic.js";import{elysiaPlugin as r}from"./rest-elysia.js";import{expressRouter as i}from"./rest-express.js";import{makeNextAppHandler as a}from"./rest-next-app.js";import{makeNextPagesHandler as o}from"./rest-next-pages.js";export{n as createFetchHandler,t as createMcpServer,r as elysiaPlugin,i as expressRouter,a as makeNextAppHandler,o as makeNextPagesHandler,e as registerContractsOnBuilder};
@@ -0,0 +1 @@
1
+ import{registerMcpTools as e}from"./registerTools.js";import{registerMcpResources as t}from"./registerResources.js";import{registerMcpPrompts as n}from"./registerPrompts.js";import{registerMcpPresentations as r}from"./registerPresentations.js";function i(i,a,o,s,c){return c.logger.info(`Creating MCP server`),e(i,a,{toolCtx:c.toolCtx}),t(i,o,{logger:c.logger,resourceCtx:c.resourceCtx}),r(i,{logger:c.logger,presentations:c.presentations,presentationsV2:c.presentationsV2}),n(i,s,{promptCtx:c.promptCtx}),i}export{i as createMcpServer};
File without changes
@@ -0,0 +1 @@
1
+ import{createDefaultTransformEngine as e,registerBasicValidation as t,registerDefaultReactRenderer as n}from"../../presentations.v2.js";import{jsonSchemaForPresentation as r}from"../../presentations.js";function i(e){return!e||typeof e!=`object`?!1:`body`in e&&typeof e.body==`string`}function a(a,o){let s=o.presentations,c=o.presentationsV2;if(s)for(let e of s.list()){let t=`presentation.${e.meta.name.replace(/\./g,`_`)}.v${e.meta.version}`,n=`presentation://${e.meta.name}/v${e.meta.version}`;a.registerResource(t,n,{title:`${e.meta.name} v${e.meta.version}`,description:e.meta.description??`Presentation`},async()=>{if(e.content.kind===`markdown`)return{contents:[{uri:n,mimeType:`text/markdown`,text:e.content.content?e.content.content:`See resource: ${e.content.resourceUri??``}`}]};if(e.content.kind===`data`){let t=r(e);return{contents:[{uri:n,mimeType:`application/json`,text:JSON.stringify(t,null,2)}]}}let t={name:e.meta.name,version:e.meta.version,kind:e.content.kind,description:e.meta.description??``};return{contents:[{uri:n,mimeType:`application/json`,text:JSON.stringify(t,null,2)}]}});for(let i of[{ext:`.md`,target:`markdown`},{ext:`.json`,target:`application/json`},{ext:`.xml`,target:`application/xml`}]){let s=`${t}${i.ext}`,c=`${n}${i.ext}`;o.logger.info(`Registering presentation resource ${c} for ${s}`),a.registerResource(s,c,{title:`${e.meta.name} v${e.meta.version} (${i.ext})`,description:`${e.meta.description??`Presentation`} (${i.ext})`},async()=>{if(e.content.kind===`markdown`&&i.target===`markdown`)return{contents:[{uri:c,mimeType:`text/markdown`,text:e.content.content??`See resource: ${e.content.resourceUri??``}`}]};if(e.content.kind===`data`&&i.target===`application/json`)return{contents:[{uri:c,mimeType:`application/json`,text:JSON.stringify(r(e),null,2)}]};let t=JSON.stringify({meta:e.meta,content:e.content},null,2);return i.target===`application/json`?{contents:[{uri:c,mimeType:`application/json`,text:t}]}:i.target===`application/xml`?{contents:[{uri:c,mimeType:`application/xml`,text:`<presentation name="${e.meta.name}" version="${e.meta.version}"><json>${encodeURIComponent(t)}</json></presentation>`}]}:{contents:[{uri:c,mimeType:`text/markdown`,text:`Unsupported presentation for markdown`}]}})}}if(c&&c.length){let r=t(n(e()));for(let e of c){let t=`presentation.${e.meta.name.replace(/\./g,`_`)}.v${e.meta.version}`,n=`presentation://${e.meta.name}/v${e.meta.version}`;o.logger.info(`Registering presentation descriptor ${n} for ${t}`),a.registerResource(t,n,{title:`${e.meta.name} v${e.meta.version}`,description:e.meta.description??`Presentation`,mimeType:`application/json`},async()=>({contents:[{uri:n,mimeType:`application/json`,text:JSON.stringify({meta:e.meta,source:e.source,targets:e.targets},null,2)}]}));for(let o of[{ext:`.md`,target:`markdown`},{ext:`.json`,target:`application/json`},{ext:`.xml`,target:`application/xml`}]){let s=`${t}${o.ext}`,c=`${n}${o.ext}`;a.registerResource(s,c,{title:`${e.meta.name} v${e.meta.version} (${o.ext})`,description:`${e.meta.description??`Presentation`} (${o.ext})`},async()=>{let t=await r.render(o.target,e);return{contents:[{uri:c,mimeType:i(t)&&t.mimeType?t.mimeType:o.target===`markdown`?`text/markdown`:o.target,text:i(t)&&typeof t.body==`string`?t.body:String(t)}]}})}}}}export{a as registerMcpPresentations};
@@ -0,0 +1,3 @@
1
+ import e from"zod";function t(e){let t={};for(let n of e)t[n.name]=n.schema;return t}function n(e,n,r){for(let i of n.list())e.registerPrompt(i.meta.name,{title:i.meta.title,description:i.meta.description,argsSchema:t(i.args)},async e=>{let t=(e,t)=>{let n=e;for(let[e,r]of Object.entries(t))n=n.replace(RegExp(`\\{${e}\\}`,`g`),encodeURIComponent(String(r)));return n};return{messages:[{role:`assistant`,content:{type:`text`,text:(await i.render(i.input.parse(e),{...r.promptCtx(),link:t})).map(e=>e.type===`text`?e.text:`See resource: ${e.title??e.uri}\nURI: ${e.uri}`).join(`
2
+
3
+ `)}}],description:i.meta.description}})}export{n as registerMcpPrompts};
@@ -0,0 +1 @@
1
+ import{ResourceTemplate as e}from"@modelcontextprotocol/sdk/server/mcp.js";import{Buffer as t}from"node:buffer";function n(e){return{title:e.meta.title,description:e.meta.description,mimeType:e.meta.mimeType,_meta:{tags:e.meta.tags??[]}}}function r(r,i,a){for(let o of i.listTemplates())a.logger.info(`Registering resource: `+o.meta.uriTemplate),r.registerResource(o.meta.uriTemplate,new e(o.meta.uriTemplate,{list:void 0}),n(o),async(e,n)=>{let r=o.input.parse(n),i=await o.resolve(r,a.resourceCtx());return typeof i.data==`string`?{contents:[{uri:i.uri,mimeType:i.mimeType??o.meta.mimeType,text:i.data}]}:{contents:[{uri:i.uri,mimeType:i.mimeType??o.meta.mimeType,blob:t.from(i.data).toString(`base64`)}]}}),a.logger.info(`Registered resource: `+o.meta.uriTemplate)}export{r as registerMcpResources};
@@ -0,0 +1 @@
1
+ import{defaultMcpTool as e}from"../../jsonschema.js";function t(t,n,r){for(let i of n.listSpecs()){if(i.meta.kind!==`command`)continue;let a=i.transport?.mcp?.toolName??e(i.meta.name,i.meta.version);t.registerTool(a,{description:i.meta.description,inputSchema:i.io.input?.getZod()},async e=>{let t=await n.execute(i.meta.name,i.meta.version,e??{},r.toolCtx());return{content:[{type:`text`,text:JSON.stringify(t,null,4)}]}})}}export{t as registerMcpTools};
@@ -1 +1 @@
1
- import{createDefaultTransformEngine as e,registerBasicValidation as t,registerDefaultReactRenderer as n}from"../presentations.v2.js";import{defaultMcpTool as r,jsonSchemaForSpec as i}from"../jsonschema.js";import{jsonSchemaForPresentation as a}from"../presentations.js";import{zodToJsonSchema as o}from"../node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js";import"../node_modules/zod-to-json-schema/dist/esm/index.js";import s from"zod";import{ResourceTemplate as c}from"@modelcontextprotocol/sdk/server/mcp.js";function l(l,u,d,f,p){for(let e of u.listSpecs()){if(e.meta.kind!==`command`)continue;let{input:t}=i(e),n=e.transport?.mcp?.toolName??r(e.meta.name,e.meta.version);l.registerTool(n,{description:e.meta.description,inputSchema:t},async(t,n)=>{let r=await u.execute(e.meta.name,e.meta.version,t??{},p.toolCtx());return{content:[{type:`text`,text:JSON.stringify(r,null,4)}]}})}for(let e of d.listTemplates())l.registerResource(e.meta.uriTemplate.split(`:`)[0],new c(e.meta.uriTemplate,{}),{description:e.meta.description,inputSchema:o(e.input,{})},async(t,n,r)=>{let i=p.resourceCtx(),a=await e.resolve(n,i);return typeof a.data==`string`?{contents:[{uri:a.uri,mimeType:a.mimeType??e.meta.mimeType,text:a.data}]}:{contents:[{uri:a.uri,mimeType:a.mimeType??e.meta.mimeType,blob:a.data.toString()}]}});let m=p.presentations,h=p.presentationsV2;if(m){t(n(e()));for(let e of m.list()){let t=`presentation.${e.meta.name.replace(/\./g,`_`)}.v${e.meta.version}`,n=`presentation://${e.meta.name}/v${e.meta.version}`;l.registerResource(t,new c(n,{}),{description:e.meta.description??`Presentation`,inputSchema:s.toJSONSchema(s.object({}))},async(t,r,i)=>{if(e.content.kind===`markdown`)return{contents:[{uri:n,mimeType:`text/markdown`,text:e.content.content?e.content.content:`See resource: ${e.content.resourceUri??``}`}]};if(e.content.kind===`data`){let t=a(e);return{contents:[{uri:n,mimeType:`application/json`,text:JSON.stringify(t,null,2)}]}}let o={name:e.meta.name,version:e.meta.version,kind:e.content.kind,description:e.meta.description??``};return{contents:[{uri:n,mimeType:`application/json`,text:JSON.stringify(o,null,2)}]}});for(let r of[{ext:`.md`,target:`markdown`},{ext:`.json`,target:`application/json`},{ext:`.xml`,target:`application/xml`}]){let i=`${t}${r.ext}`,o=`${n}${r.ext}`;l.registerResource(i,new c(o,{}),{description:`${e.meta.description??`Presentation`} (${r.ext})`,inputSchema:s.toJSONSchema(s.object({}))},async()=>{if(e.content.kind===`markdown`&&r.target===`markdown`)return{contents:[{uri:o,mimeType:`text/markdown`,text:e.content.content??`See resource: ${e.content.resourceUri??``}`}]};if(e.content.kind===`data`&&r.target===`application/json`)return{contents:[{uri:o,mimeType:`application/json`,text:JSON.stringify(a(e),null,2)}]};let t=JSON.stringify({meta:e.meta,content:e.content},null,2);return r.target===`application/json`?{contents:[{uri:o,mimeType:`application/json`,text:t}]}:r.target===`application/xml`?{contents:[{uri:o,mimeType:`application/xml`,text:`<presentation name="${e.meta.name}" version="${e.meta.version}"><json>${encodeURIComponent(t)}</json></presentation>`}]}:{contents:[{uri:o,mimeType:`text/markdown`,text:`Unsupported presentation for markdown`}]}})}}}if(h&&h.length){let r=t(n(e()));for(let e of h){let t=`presentation.${e.meta.name.replace(/\./g,`_`)}.v${e.meta.version}`,n=`presentation://${e.meta.name}/v${e.meta.version}`;l.registerResource(t,new c(n,{}),{description:e.meta.description??`Presentation`,inputSchema:s.toJSONSchema(s.object({}))},async()=>({contents:[{uri:n,mimeType:`application/json`,text:JSON.stringify({meta:e.meta,source:e.source,targets:e.targets},null,2)}]}));for(let i of[{ext:`.md`,target:`markdown`},{ext:`.json`,target:`application/json`},{ext:`.xml`,target:`application/xml`}]){let a=`${t}${i.ext}`,o=`${n}${i.ext}`;l.registerResource(a,new c(o,{}),{description:`${e.meta.description??`Presentation`} (${i.ext})`,inputSchema:s.toJSONSchema(s.object({}))},async()=>{let t=await r.render(i.target,e);return{contents:[{uri:o,mimeType:t.mimeType??(i.target===`markdown`?`text/markdown`:i.target),text:t.body??String(t)}]}})}}}for(let e of f.list())l.registerPrompt(e.meta.name,{title:e.meta.title,description:e.meta.title,argsSchema:o(e.input)},async(t,n)=>{let r=(e,t)=>{let n=e;for(let[e,r]of Object.entries(t))n=n.replace(RegExp(`\\{${e}\\}`,`g`),encodeURIComponent(String(r)));return n};return{messages:[{role:`assistant`,content:(await e.render(e.input.parse(t),{...p.promptCtx(),link:r})).map(e=>e.type===`text`?{type:`text`,text:e.text}:{type:`text`,text:`See resource: ${e.title??e.uri}\nURI: ${e.uri}`})[0]}],description:e.meta.description}});return l}export{l as createMcpServer};
1
+ import{createMcpServer as e}from"./mcp/createMcpServer.js";export{e as createMcpServer};