@lssm/lib.contracts 1.7.3 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -325
- package/dist/app-config/contracts.d.ts +51 -49
- package/dist/app-config/contracts.d.ts.map +1 -1
- package/dist/app-config/contracts.js +1 -1
- package/dist/app-config/contracts.js.map +1 -1
- package/dist/app-config/events.d.ts +28 -26
- package/dist/app-config/events.d.ts.map +1 -1
- package/dist/app-config/events.js +1 -1
- package/dist/app-config/events.js.map +1 -1
- package/dist/app-config/lifecycle-contracts.d.ts +81 -79
- package/dist/app-config/lifecycle-contracts.d.ts.map +1 -1
- package/dist/app-config/lifecycle-contracts.js +1 -1
- package/dist/app-config/lifecycle-contracts.js.map +1 -1
- package/dist/app-config/runtime.d.ts.map +1 -1
- package/dist/app-config/runtime.js.map +1 -1
- package/dist/app-config/spec.d.ts +2 -2
- package/dist/app-config/spec.d.ts.map +1 -1
- package/dist/app-config/spec.js.map +1 -1
- package/dist/app-config/validation.d.ts.map +1 -1
- package/dist/app-config/validation.js.map +1 -1
- package/dist/capabilities/openbanking.d.ts.map +1 -1
- package/dist/capabilities/openbanking.js.map +1 -1
- package/dist/capabilities.d.ts +2 -1
- package/dist/capabilities.d.ts.map +1 -1
- package/dist/capabilities.js +1 -1
- package/dist/capabilities.js.map +1 -1
- package/dist/client/react/form-render.d.ts +1 -0
- package/dist/client/react/form-render.d.ts.map +1 -1
- package/dist/contracts-adapter-input.d.ts +1 -0
- package/dist/contracts-adapter-input.d.ts.map +1 -1
- package/dist/data-views/query-generator.d.ts +40 -0
- package/dist/data-views/query-generator.d.ts.map +1 -0
- package/dist/data-views/query-generator.js +2 -0
- package/dist/data-views/query-generator.js.map +1 -0
- package/dist/data-views/runtime.d.ts +27 -0
- package/dist/data-views/runtime.d.ts.map +1 -0
- package/dist/data-views/runtime.js +2 -0
- package/dist/data-views/runtime.js.map +1 -0
- package/dist/data-views.js.map +1 -1
- package/dist/events.d.ts +1 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +1 -1
- package/dist/events.js.map +1 -1
- package/dist/experiments/evaluator.d.ts.map +1 -1
- package/dist/experiments/evaluator.js.map +1 -1
- package/dist/experiments/spec-resolver.d.ts +17 -0
- package/dist/experiments/spec-resolver.d.ts.map +1 -0
- package/dist/experiments/spec-resolver.js +0 -0
- package/dist/experiments/spec.js.map +1 -1
- package/dist/forms.d.ts +1 -0
- package/dist/forms.d.ts.map +1 -1
- package/dist/graphql-federation/dist/index.js +2 -0
- package/dist/graphql-federation/dist/index.js.map +1 -0
- package/dist/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/install.d.ts +1 -0
- package/dist/install.d.ts.map +1 -1
- package/dist/integrations/connection.d.ts.map +1 -1
- package/dist/integrations/contracts.d.ts +103 -101
- package/dist/integrations/contracts.d.ts.map +1 -1
- package/dist/integrations/contracts.js +1 -1
- package/dist/integrations/contracts.js.map +1 -1
- package/dist/integrations/health.d.ts.map +1 -1
- package/dist/integrations/health.js.map +1 -1
- package/dist/integrations/openbanking/contracts/accounts.d.ts +67 -65
- package/dist/integrations/openbanking/contracts/accounts.d.ts.map +1 -1
- package/dist/integrations/openbanking/contracts/accounts.js +1 -1
- package/dist/integrations/openbanking/contracts/accounts.js.map +1 -1
- package/dist/integrations/openbanking/contracts/balances.d.ts +35 -33
- package/dist/integrations/openbanking/contracts/balances.d.ts.map +1 -1
- package/dist/integrations/openbanking/contracts/balances.js +1 -1
- package/dist/integrations/openbanking/contracts/balances.js.map +1 -1
- package/dist/integrations/openbanking/contracts/index.js.map +1 -1
- package/dist/integrations/openbanking/contracts/transactions.d.ts +49 -47
- package/dist/integrations/openbanking/contracts/transactions.d.ts.map +1 -1
- package/dist/integrations/openbanking/contracts/transactions.js +1 -1
- package/dist/integrations/openbanking/contracts/transactions.js.map +1 -1
- package/dist/integrations/openbanking/guards.js.map +1 -1
- package/dist/integrations/openbanking/models.d.ts +57 -54
- package/dist/integrations/openbanking/models.d.ts.map +1 -1
- package/dist/integrations/openbanking/models.js +1 -1
- package/dist/integrations/openbanking/models.js.map +1 -1
- package/dist/integrations/openbanking/telemetry.js.map +1 -1
- package/dist/integrations/providers/elevenlabs.d.ts.map +1 -1
- package/dist/integrations/providers/elevenlabs.js.map +1 -1
- package/dist/integrations/providers/gcs-storage.js.map +1 -1
- package/dist/integrations/providers/gmail.d.ts.map +1 -1
- package/dist/integrations/providers/gmail.js.map +1 -1
- package/dist/integrations/providers/google-calendar.js.map +1 -1
- package/dist/integrations/providers/impls/elevenlabs-voice.js.map +1 -1
- package/dist/integrations/providers/impls/gcs-storage.js.map +1 -1
- package/dist/integrations/providers/impls/gmail-inbound.js.map +1 -1
- package/dist/integrations/providers/impls/gmail-outbound.d.ts.map +1 -1
- package/dist/integrations/providers/impls/gmail-outbound.js.map +1 -1
- package/dist/integrations/providers/impls/google-calendar.d.ts.map +1 -1
- package/dist/integrations/providers/impls/google-calendar.js.map +1 -1
- package/dist/integrations/providers/impls/mistral-embedding.js.map +1 -1
- package/dist/integrations/providers/impls/mistral-llm.js.map +1 -1
- package/dist/integrations/providers/impls/postmark-email.js.map +1 -1
- package/dist/integrations/providers/impls/powens-client.d.ts.map +1 -1
- package/dist/integrations/providers/impls/powens-client.js.map +1 -1
- package/dist/integrations/providers/impls/powens-openbanking.d.ts.map +1 -1
- package/dist/integrations/providers/impls/powens-openbanking.js.map +1 -1
- package/dist/integrations/providers/impls/provider-factory.d.ts.map +1 -1
- package/dist/integrations/providers/impls/provider-factory.js.map +1 -1
- package/dist/integrations/providers/impls/qdrant-vector.d.ts.map +1 -1
- package/dist/integrations/providers/impls/qdrant-vector.js.map +1 -1
- package/dist/integrations/providers/impls/stripe-payments.d.ts.map +1 -1
- package/dist/integrations/providers/impls/stripe-payments.js.map +1 -1
- package/dist/integrations/providers/impls/twilio-sms.js.map +1 -1
- package/dist/integrations/providers/llm.d.ts.map +1 -1
- package/dist/integrations/providers/mistral.d.ts.map +1 -1
- package/dist/integrations/providers/mistral.js.map +1 -1
- package/dist/integrations/providers/payments.d.ts.map +1 -1
- package/dist/integrations/providers/postmark.d.ts.map +1 -1
- package/dist/integrations/providers/postmark.js.map +1 -1
- package/dist/integrations/providers/powens.js.map +1 -1
- package/dist/integrations/providers/qdrant.d.ts.map +1 -1
- package/dist/integrations/providers/qdrant.js.map +1 -1
- package/dist/integrations/providers/stripe.js.map +1 -1
- package/dist/integrations/providers/twilio-sms.js.map +1 -1
- package/dist/integrations/runtime.d.ts.map +1 -1
- package/dist/integrations/runtime.js.map +1 -1
- package/dist/integrations/secrets/env-secret-provider.js.map +1 -1
- package/dist/integrations/secrets/gcp-secret-manager.d.ts.map +1 -1
- package/dist/integrations/secrets/gcp-secret-manager.js.map +1 -1
- package/dist/integrations/secrets/manager.d.ts +2 -2
- package/dist/integrations/secrets/manager.d.ts.map +1 -1
- package/dist/integrations/secrets/manager.js.map +1 -1
- package/dist/integrations/secrets/provider.js.map +1 -1
- package/dist/integrations/spec.d.ts.map +1 -1
- package/dist/integrations/spec.js.map +1 -1
- package/dist/jobs/gcp-cloud-tasks.js.map +1 -1
- package/dist/jobs/gcp-pubsub.d.ts.map +1 -1
- package/dist/jobs/gcp-pubsub.js.map +1 -1
- package/dist/jobs/handlers/gmail-sync-handler.js.map +1 -1
- package/dist/jobs/handlers/storage-document-handler.js.map +1 -1
- package/dist/jobs/memory-queue.d.ts.map +1 -1
- package/dist/jobs/memory-queue.js.map +1 -1
- package/dist/jobs/queue.d.ts.map +1 -1
- package/dist/jsonschema.d.ts +1 -1
- package/dist/jsonschema.d.ts.map +1 -1
- package/dist/knowledge/contracts.d.ts +67 -65
- package/dist/knowledge/contracts.d.ts.map +1 -1
- package/dist/knowledge/contracts.js +1 -1
- package/dist/knowledge/contracts.js.map +1 -1
- package/dist/knowledge/ingestion/document-processor.js.map +1 -1
- package/dist/knowledge/ingestion/embedding-service.d.ts.map +1 -1
- package/dist/knowledge/ingestion/embedding-service.js.map +1 -1
- package/dist/knowledge/ingestion/gmail-adapter.d.ts.map +1 -1
- package/dist/knowledge/ingestion/gmail-adapter.js.map +1 -1
- package/dist/knowledge/ingestion/storage-adapter.js.map +1 -1
- package/dist/knowledge/ingestion/vector-indexer.js.map +1 -1
- package/dist/knowledge/query/service.d.ts +2 -2
- package/dist/knowledge/query/service.d.ts.map +1 -1
- package/dist/knowledge/query/service.js.map +1 -1
- package/dist/knowledge/runtime.d.ts.map +1 -1
- package/dist/knowledge/runtime.js.map +1 -1
- package/dist/knowledge/spaces/email-threads.js.map +1 -1
- package/dist/knowledge/spaces/financial-docs.js.map +1 -1
- package/dist/knowledge/spaces/financial-overview.js.map +1 -1
- package/dist/knowledge/spaces/product-canon.js.map +1 -1
- package/dist/knowledge/spaces/support-faq.js.map +1 -1
- package/dist/knowledge/spaces/uploaded-docs.js.map +1 -1
- package/dist/knowledge/spec.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js.map +1 -1
- package/dist/onboarding-base.d.ts +30 -28
- package/dist/onboarding-base.d.ts.map +1 -1
- package/dist/onboarding-base.js +1 -1
- package/dist/onboarding-base.js.map +1 -1
- package/dist/policy/engine.js.map +1 -1
- package/dist/policy/opa-adapter.d.ts.map +1 -1
- package/dist/policy/opa-adapter.js.map +1 -1
- package/dist/policy/spec.d.ts.map +1 -1
- package/dist/policy/spec.js.map +1 -1
- package/dist/presentations.d.ts +1 -0
- package/dist/presentations.d.ts.map +1 -1
- package/dist/presentations.v2.d.ts +1 -0
- package/dist/presentations.v2.d.ts.map +1 -1
- package/dist/regenerator/executor.d.ts.map +1 -1
- package/dist/regenerator/executor.js.map +1 -1
- package/dist/regenerator/service.d.ts.map +1 -1
- package/dist/regenerator/service.js.map +1 -1
- package/dist/regenerator/sinks.d.ts.map +1 -1
- package/dist/regenerator/sinks.js.map +1 -1
- package/dist/regenerator/types.d.ts.map +1 -1
- package/dist/regenerator/utils.js.map +1 -1
- package/dist/registry.d.ts +37 -9
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +1 -1
- package/dist/registry.js.map +1 -1
- package/dist/schema/dist/FieldType.js +2 -0
- package/dist/schema/dist/FieldType.js.map +1 -0
- package/dist/schema/dist/ScalarTypeEnum.js +2 -0
- package/dist/schema/dist/ScalarTypeEnum.js.map +1 -0
- package/dist/schema/{src → dist}/SchemaModel.js +1 -1
- package/dist/schema/dist/SchemaModel.js.map +1 -0
- package/dist/schema/dist/index.js +1 -0
- package/dist/server/graphql-pothos.d.ts +15 -2
- package/dist/server/graphql-pothos.d.ts.map +1 -1
- package/dist/server/graphql-pothos.js.map +1 -1
- package/dist/server/graphql-schema-export.js +1 -1
- package/dist/server/graphql-schema-export.js.map +1 -1
- package/dist/server/provider-mcp.d.ts +22 -4
- package/dist/server/provider-mcp.d.ts.map +1 -1
- package/dist/server/provider-mcp.js.map +1 -1
- package/dist/server/rest-next-app.d.ts +23 -3
- package/dist/server/rest-next-app.d.ts.map +1 -1
- package/dist/server/rest-next-app.js.map +1 -1
- package/dist/spec.d.ts +23 -0
- package/dist/spec.d.ts.map +1 -1
- package/dist/spec.js.map +1 -1
- package/dist/telemetry/anomaly.js.map +1 -1
- package/dist/telemetry/spec.d.ts.map +1 -1
- package/dist/telemetry/spec.js.map +1 -1
- package/dist/telemetry/tracker.d.ts.map +1 -1
- package/dist/telemetry/tracker.js.map +1 -1
- package/dist/tests/runner.js.map +1 -1
- package/dist/tests/spec.js.map +1 -1
- package/dist/themes.d.ts.map +1 -1
- package/dist/themes.js.map +1 -1
- package/dist/types/all.d.ts +2 -2
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/workflow/adapters/db-adapter.d.ts +30 -10
- package/dist/workflow/adapters/db-adapter.d.ts.map +1 -1
- package/dist/workflow/adapters/db-adapter.js +1 -1
- package/dist/workflow/adapters/db-adapter.js.map +1 -1
- package/dist/workflow/adapters/file-adapter.js.map +1 -1
- package/dist/workflow/adapters/index.d.ts +2 -2
- package/dist/workflow/adapters/index.js +1 -1
- package/dist/workflow/adapters/memory-store.d.ts.map +1 -1
- package/dist/workflow/adapters/memory-store.js.map +1 -1
- package/dist/workflow/expression.js.map +1 -1
- package/dist/workflow/index.d.ts +2 -2
- package/dist/workflow/index.js +1 -1
- package/dist/workflow/runner.d.ts +1 -0
- package/dist/workflow/runner.d.ts.map +1 -1
- package/dist/workflow/runner.js +1 -1
- package/dist/workflow/runner.js.map +1 -1
- package/dist/workflow/sla-monitor.d.ts +21 -0
- package/dist/workflow/sla-monitor.d.ts.map +1 -0
- package/dist/workflow/sla-monitor.js +2 -0
- package/dist/workflow/sla-monitor.js.map +1 -0
- package/dist/workflow/spec.d.ts.map +1 -1
- package/dist/workflow/spec.js.map +1 -1
- package/dist/workflow/state.d.ts +1 -0
- package/dist/workflow/state.d.ts.map +1 -1
- package/dist/workflow/validation.d.ts.map +1 -1
- package/dist/workflow/validation.js.map +1 -1
- package/package.json +181 -177
- package/dist/graphql-federation/src/index.js +0 -2
- package/dist/graphql-federation/src/index.js.map +0 -1
- package/dist/schema/src/FieldType.js +0 -2
- package/dist/schema/src/FieldType.js.map +0 -1
- package/dist/schema/src/ScalarTypeEnum.js +0 -2
- package/dist/schema/src/ScalarTypeEnum.js.map +0 -1
- package/dist/schema/src/SchemaModel.js.map +0 -1
- package/dist/schema/src/index.js +0 -1
- /package/dist/schema/{src → dist}/EnumType.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"twilio-sms.js","names":[],"sources":["../../../../src/integrations/providers/impls/twilio-sms.ts"],"sourcesContent":["import Twilio from 'twilio';\n\nimport type {\n SendSmsInput,\n SmsDeliveryStatus,\n SmsMessage,\n SmsProvider,\n} from '../sms';\n\ntype TwilioClient = ReturnType<typeof Twilio>;\n\nexport interface TwilioSmsProviderOptions {\n accountSid: string;\n authToken: string;\n fromNumber?: string;\n client?: TwilioClient;\n}\n\nexport class TwilioSmsProvider implements SmsProvider {\n private readonly client: TwilioClient;\n private readonly fromNumber?: string;\n\n constructor(options: TwilioSmsProviderOptions) {\n this.client =\n options.client ?? Twilio(options.accountSid, options.authToken);\n this.fromNumber = options.fromNumber;\n }\n\n async sendSms(input: SendSmsInput): Promise<SmsMessage> {\n const message = await this.client.messages.create({\n to: input.to,\n from: input.from ?? this.fromNumber,\n body: input.body,\n });\n\n return {\n id: message.sid,\n to: message.to ?? input.to,\n from: message.from ?? input.from ?? this.fromNumber ?? '',\n body: message.body ?? input.body,\n status: mapStatus(message.status),\n sentAt: message.dateCreated ? new Date(message.dateCreated) : undefined,\n deliveredAt:\n message.status === 'delivered' && message.dateUpdated\n ? new Date(message.dateUpdated)\n : undefined,\n price: message.price ? Number(message.price) : undefined,\n priceCurrency: message.priceUnit ?? undefined,\n errorCode: message.errorCode ? String(message.errorCode) : undefined,\n errorMessage: message.errorMessage ?? undefined,\n };\n }\n\n async getDeliveryStatus(messageId: string): Promise<SmsDeliveryStatus> {\n const message = await this.client.messages(messageId).fetch();\n return {\n status: mapStatus(message.status),\n errorCode: message.errorCode ? String(message.errorCode) : undefined,\n errorMessage: message.errorMessage ?? undefined,\n updatedAt: message.dateUpdated\n ? new Date(message.dateUpdated)\n : new Date(),\n };\n }\n}\n\nfunction mapStatus(
|
|
1
|
+
{"version":3,"file":"twilio-sms.js","names":[],"sources":["../../../../src/integrations/providers/impls/twilio-sms.ts"],"sourcesContent":["import Twilio from 'twilio';\n\nimport type {\n SendSmsInput,\n SmsDeliveryStatus,\n SmsMessage,\n SmsProvider,\n} from '../sms';\n\ntype TwilioClient = ReturnType<typeof Twilio>;\n\nexport interface TwilioSmsProviderOptions {\n accountSid: string;\n authToken: string;\n fromNumber?: string;\n client?: TwilioClient;\n}\n\nexport class TwilioSmsProvider implements SmsProvider {\n private readonly client: TwilioClient;\n private readonly fromNumber?: string;\n\n constructor(options: TwilioSmsProviderOptions) {\n this.client =\n options.client ?? Twilio(options.accountSid, options.authToken);\n this.fromNumber = options.fromNumber;\n }\n\n async sendSms(input: SendSmsInput): Promise<SmsMessage> {\n const message = await this.client.messages.create({\n to: input.to,\n from: input.from ?? this.fromNumber,\n body: input.body,\n });\n\n return {\n id: message.sid,\n to: message.to ?? input.to,\n from: message.from ?? input.from ?? this.fromNumber ?? '',\n body: message.body ?? input.body,\n status: mapStatus(message.status),\n sentAt: message.dateCreated ? new Date(message.dateCreated) : undefined,\n deliveredAt:\n message.status === 'delivered' && message.dateUpdated\n ? new Date(message.dateUpdated)\n : undefined,\n price: message.price ? Number(message.price) : undefined,\n priceCurrency: message.priceUnit ?? undefined,\n errorCode: message.errorCode ? String(message.errorCode) : undefined,\n errorMessage: message.errorMessage ?? undefined,\n };\n }\n\n async getDeliveryStatus(messageId: string): Promise<SmsDeliveryStatus> {\n const message = await this.client.messages(messageId).fetch();\n return {\n status: mapStatus(message.status),\n errorCode: message.errorCode ? String(message.errorCode) : undefined,\n errorMessage: message.errorMessage ?? undefined,\n updatedAt: message.dateUpdated\n ? new Date(message.dateUpdated)\n : new Date(),\n };\n }\n}\n\nfunction mapStatus(status: string | null): SmsMessage['status'] {\n switch (status) {\n case 'queued':\n case 'accepted':\n case 'scheduled':\n return 'queued';\n case 'sending':\n case 'processing':\n return 'sending';\n case 'sent':\n return 'sent';\n case 'delivered':\n return 'delivered';\n case 'undelivered':\n return 'undelivered';\n case 'failed':\n case 'canceled':\n return 'failed';\n default:\n return 'queued';\n }\n}\n"],"mappings":"sBAkBA,IAAa,EAAb,KAAsD,CACpD,OACA,WAEA,YAAY,EAAmC,CAC7C,KAAK,OACH,EAAQ,QAAU,EAAO,EAAQ,WAAY,EAAQ,UAAU,CACjE,KAAK,WAAa,EAAQ,WAG5B,MAAM,QAAQ,EAA0C,CACtD,IAAM,EAAU,MAAM,KAAK,OAAO,SAAS,OAAO,CAChD,GAAI,EAAM,GACV,KAAM,EAAM,MAAQ,KAAK,WACzB,KAAM,EAAM,KACb,CAAC,CAEF,MAAO,CACL,GAAI,EAAQ,IACZ,GAAI,EAAQ,IAAM,EAAM,GACxB,KAA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CnC;;UAGM,WAAA;WACN;UACD;;;;KAKE,cAAA;;SAGC;;;;QAKD;;;;SAKC;;;SAIA;;;YAIG;;UAGC,gBAAA;;;UAIA,WAAA;iBACA,wBAAwB,iBAAiB,QAAQ;mBAEpD,wBACA,iBACT,cAAc;wBACK,eAAe,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mistral.d.ts","names":[],"sources":["../../../src/integrations/providers/mistral.ts"],"sourcesContent":[],"mappings":";;;cAGa,wBAAwB;
|
|
1
|
+
{"version":3,"file":"mistral.d.ts","names":[],"sources":["../../../src/integrations/providers/mistral.ts"],"sourcesContent":[],"mappings":";;;cAGa,wBAAwB;iBAyErB,0BAAA,WACJ,0BACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mistral.js","names":["mistralIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/mistral.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec, IntegrationSpecRegistry } from '../spec';\n\nexport const mistralIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'ai-llm.mistral',\n version: 1,\n category: 'ai-llm',\n displayName: 'Mistral AI',\n title: 'Mistral Large Language Model',\n description:\n 'Mistral integration providing chat completions and embedding generation.',\n domain: 'ai',\n owners: ['platform.ai'],\n tags: ['ai', 'llm', 'embeddings'],\n stability: StabilityEnum.Experimental,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [\n { key: 'ai.chat', version: 1 },\n { key: 'ai.embeddings', version: 1 },\n ],\n },\n configSchema: {\n schema: {\n type: 'object',\n properties: {\n model: {\n type: 'string',\n description
|
|
1
|
+
{"version":3,"file":"mistral.js","names":["mistralIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/mistral.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec, IntegrationSpecRegistry } from '../spec';\n\nexport const mistralIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'ai-llm.mistral',\n version: 1,\n category: 'ai-llm',\n displayName: 'Mistral AI',\n title: 'Mistral Large Language Model',\n description:\n 'Mistral integration providing chat completions and embedding generation.',\n domain: 'ai',\n owners: ['platform.ai'],\n tags: ['ai', 'llm', 'embeddings'],\n stability: StabilityEnum.Experimental,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [\n { key: 'ai.chat', version: 1 },\n { key: 'ai.embeddings', version: 1 },\n ],\n },\n configSchema: {\n schema: {\n type: 'object',\n properties: {\n model: {\n type: 'string',\n description:\n 'Default chat completion model (e.g., mistral-large-latest).',\n },\n embeddingModel: {\n type: 'string',\n description: 'Embedding model identifier.',\n },\n },\n },\n example: {\n model: 'mistral-large-latest',\n embeddingModel: 'mistral-embed',\n },\n },\n secretSchema: {\n schema: {\n type: 'object',\n required: ['apiKey'],\n properties: {\n apiKey: {\n type: 'string',\n description:\n 'Mistral API key with access to chat and embeddings endpoints.',\n },\n },\n },\n example: {\n apiKey: 'mistral-***',\n },\n },\n healthCheck: {\n method: 'custom',\n timeoutMs: 5000,\n },\n docsUrl: 'https://docs.mistral.ai/platform/endpoints',\n constraints: {\n rateLimit: {\n rpm: 600,\n },\n },\n byokSetup: {\n setupInstructions:\n 'Generate an API key within the Mistral console and ensure the selected models are enabled for the account.',\n },\n};\n\nexport function registerMistralIntegration(\n registry: IntegrationSpecRegistry\n): IntegrationSpecRegistry {\n return registry.register(mistralIntegrationSpec);\n}\n"],"mappings":"mDAGA,MAAaA,EAA0C,CACrD,KAAM,CACJ,IAAK,iBACL,QAAS,EACT,SAAU,SACV,YAAa,aACb,MAAO,+BACP,YACE,2EACF,OAAQ,KACR,OAAQ,CAAC,cAAc,CACvB,KAAM,CAAC,KAAM,MAAO,aAAa,CACjC,UAAW,EAAc,aAC1B,CACD,eAAgB,CAAC,UAAW,OAAO,CACnC,aAAc,CACZ,SAAU,CACR,CAAE,IAAK,UAAW,QAAS,EAAG,CAC9B,CAAE,IAAK,gBAAiB,QAAS,EAAG,CACrC,CACF,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,WAAY,CACV,MAAO,CACL,KAAM,SACN,YACE,8DACH,CACD,eAAgB,CACd,KAAM,SACN,YAAa,8BACd,CACF,CACF,CACD,QAAS,CACP,MAAO,uBACP,eAAgB,gBACjB,CACF,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,SAAU,CAAC,SAAS,CACpB,WAAY,CACV,OAAQ,CACN,KAAM,SACN,YACE,gEACH,CACF,CACF,CACD,QAAS,CACP,OAAQ,cACT,CACF,CACD,YAAa,CACX,OAAQ,SACR,UAAW,IACZ,CACD,QAAS,6CACT,YAAa,CACX,UAAW,CACT,IAAK,IACN,CACF,CACD,UAAW,CACT,kBACE,6GACH,CACF,CAED,SAAgB,EACd,EACyB,CACzB,OAAO,EAAS,SAAS,EAAuB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payments.d.ts","names":[],"sources":["../../../src/integrations/providers/payments.ts"],"sourcesContent":[],"mappings":";UAAiB,KAAA;EAAA;EAML,MAAA,EAAA,MAAA;EAQK,QAAA,EAAA,MAAA;;AAKH,KAbF,mBAAA,GAaE,yBAAA,GAAA,uBAAA,GAAA,iBAAA,GAAA,YAAA,GAAA,WAAA,GAAA,UAAA;AACA,UANG,eAAA,CAMH;EAAI,EAAA,EAAA,MAAA;EAGD,KAAA,CAAA,EAAA,MAAA;EAOA,IAAA,CAAA,EAAA,MAAA;EAEP,QAAA,CAAA,EAdG,MAcH,CAAA,MAAA,EAAA,MAAA,CAAA;EACA,SAAA,CAAA,EAdI,IAcJ;EAIG,SAAA,CAAA,EAjBC,IAiBD;;AAEC,UAhBG,mBAAA,CAgBH;EAAI,KAAA,CAAA,EAAA,MAAA;EAGD,IAAA,CAAA,EAAA,MAAA;EAWA,WAAA,CAAA,EAAA,MAAA;EAMA,QAAA,CAAA,EAhCJ,MAgCiB,CAAA,MAAA,EAAA,MAAA,CAAA;;AA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
1
|
-
{"version":3,"file":"postmark.d.ts","names":[],"sources":["../../../src/integrations/providers/postmark.ts"],"sourcesContent":[],"mappings":";;;cAGa,yBAAyB;
|
|
1
|
+
{"version":3,"file":"postmark.d.ts","names":[],"sources":["../../../src/integrations/providers/postmark.ts"],"sourcesContent":[],"mappings":";;;cAGa,yBAAyB;iBA2EtB,2BAAA,WACJ,0BACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postmark.js","names":["postmarkIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/postmark.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec, IntegrationSpecRegistry } from '../spec';\n\nexport const postmarkIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'email.postmark',\n version: 1,\n category: 'email',\n displayName: 'Postmark',\n title: 'Postmark Transactional Email',\n description: 'Postmark integration for transactional email delivery.',\n domain: 'communications',\n owners: ['platform.messaging'],\n tags: ['email', 'transactional'],\n stability: StabilityEnum.Stable,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [{ key: 'email.transactional', version: 1 }],\n requires: [\n {\n key: 'platform.webhooks',\n optional: true,\n reason: 'Optional for inbound bounce handling',\n },\n ],\n },\n configSchema: {\n schema: {\n type: 'object',\n properties: {\n messageStream: {\n type: 'string',\n description
|
|
1
|
+
{"version":3,"file":"postmark.js","names":["postmarkIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/postmark.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec, IntegrationSpecRegistry } from '../spec';\n\nexport const postmarkIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'email.postmark',\n version: 1,\n category: 'email',\n displayName: 'Postmark',\n title: 'Postmark Transactional Email',\n description: 'Postmark integration for transactional email delivery.',\n domain: 'communications',\n owners: ['platform.messaging'],\n tags: ['email', 'transactional'],\n stability: StabilityEnum.Stable,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [{ key: 'email.transactional', version: 1 }],\n requires: [\n {\n key: 'platform.webhooks',\n optional: true,\n reason: 'Optional for inbound bounce handling',\n },\n ],\n },\n configSchema: {\n schema: {\n type: 'object',\n properties: {\n messageStream: {\n type: 'string',\n description:\n 'Optional message stream identifier (e.g., transactional).',\n },\n fromEmail: {\n type: 'string',\n description: 'Default From address used for outbound messages.',\n },\n },\n },\n example: {\n messageStream: 'outbound',\n fromEmail: 'notifications@example.com',\n },\n },\n secretSchema: {\n schema: {\n type: 'object',\n required: ['serverToken'],\n properties: {\n serverToken: {\n type: 'string',\n description: 'Server token for the Postmark account.',\n },\n },\n },\n example: {\n serverToken: 'server-***',\n },\n },\n healthCheck: {\n method: 'ping',\n timeoutMs: 3000,\n },\n docsUrl: 'https://postmarkapp.com/developer',\n constraints: {\n rateLimit: {\n rpm: 500,\n },\n },\n byokSetup: {\n setupInstructions:\n 'Create a Postmark server token with outbound send permissions and configure allowed from addresses.',\n },\n};\n\nexport function registerPostmarkIntegration(\n registry: IntegrationSpecRegistry\n): IntegrationSpecRegistry {\n return registry.register(postmarkIntegrationSpec);\n}\n"],"mappings":"mDAGA,MAAaA,EAA2C,CACtD,KAAM,CACJ,IAAK,iBACL,QAAS,EACT,SAAU,QACV,YAAa,WACb,MAAO,+BACP,YAAa,yDACb,OAAQ,iBACR,OAAQ,CAAC,qBAAqB,CAC9B,KAAM,CAAC,QAAS,gBAAgB,CAChC,UAAW,EAAc,OAC1B,CACD,eAAgB,CAAC,UAAW,OAAO,CACnC,aAAc,CACZ,SAAU,CAAC,CAAE,IAAK,sBAAuB,QAAS,EAAG,CAAC,CACtD,SAAU,CACR,CACE,IAAK,oBACL,SAAU,GACV,OAAQ,uCACT,CACF,CACF,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,WAAY,CACV,cAAe,CACb,KAAM,SACN,YACE,4DACH,CACD,UAAW,CACT,KAAM,SACN,YAAa,mDACd,CACF,CACF,CACD,QAAS,CACP,cAAe,WACf,UAAW,4BACZ,CACF,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,SAAU,CAAC,cAAc,CACzB,WAAY,CACV,YAAa,CACX,KAAM,SACN,YAAa,yCACd,CACF,CACF,CACD,QAAS,CACP,YAAa,aACd,CACF,CACD,YAAa,CACX,OAAQ,OACR,UAAW,IACZ,CACD,QAAS,oCACT,YAAa,CACX,UAAW,CACT,IAAK,IACN,CACF,CACD,UAAW,CACT,kBACE,sGACH,CACF,CAED,SAAgB,EACd,EACyB,CACzB,OAAO,EAAS,SAAS,EAAwB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powens.js","names":["powensIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/powens.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec } from '../spec';\nimport type { IntegrationSpecRegistry } from '../spec';\n\nexport const powensIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'openbanking.powens',\n version: 1,\n category: 'open-banking',\n displayName: 'Powens Open Banking',\n title: 'Powens Open Banking (Read)',\n description:\n 'Read-only Open Banking integration powered by Powens, exposing accounts, transactions, and balances.',\n domain: 'finance',\n owners: ['platform.finance'],\n tags: ['open-banking', 'powens', 'finance'],\n stability: StabilityEnum.Experimental,\n },\n supportedModes: ['byok'],\n capabilities: {\n provides: [\n { key: 'openbanking.accounts.read', version: 1 },\n { key: 'openbanking.transactions.read', version: 1 },\n { key: 'openbanking.balances.read', version: 1 },\n ],\n },\n configSchema: {\n schema: {\n type: 'object',\n required: ['environment'],\n properties: {\n environment: {\n type: 'string',\n enum: ['sandbox', 'production'],\n description:\n 'Powens environment to target. Sandbox uses Powens test API base URL, production uses live endpoints.',\n },\n baseUrl: {\n type: 'string',\n description:\n 'Optional override for the Powens API base URL. Defaults to Powens environment defaults.',\n },\n region: {\n type: 'string',\n description:\n 'Optional Powens region identifier when targeting a specific data residency cluster.',\n },\n pollingIntervalMs: {\n type: 'number',\n description:\n 'Optional custom polling interval in milliseconds for background sync jobs (defaults to platform standard).',\n },\n },\n },\n example: {\n environment: 'sandbox',\n baseUrl: 'https://api-sandbox.powens.com/v2',\n region: 'eu-west-1',\n pollingIntervalMs: 300000,\n },\n },\n secretSchema: {\n schema: {\n type: 'object',\n required: ['clientId', 'clientSecret'],\n properties: {\n clientId: {\n type: 'string',\n description:\n 'Powens OAuth client identifier obtained from the Powens Console (BYOK project).',\n },\n clientSecret: {\n type: 'string',\n description:\n 'Powens OAuth client secret used to exchange for access tokens.',\n },\n apiKey: {\n type: 'string',\n description:\n 'Optional Powens API key (if the tenant project exposes a dedicated API token).',\n },\n webhookSecret: {\n type: 'string',\n description:\n 'Optional webhook signing secret used to verify Powens webhook payloads.',\n },\n },\n },\n example: {\n clientId: 'powens-client-id',\n clientSecret: 'powens-client-secret',\n apiKey: 'powens-api-key',\n webhookSecret: 'powens-webhook-secret',\n },\n },\n healthCheck: {\n method: 'ping',\n timeoutMs: 8000,\n },\n docsUrl: 'https://docs.powens.com/',\n constraints: {\n rateLimit: {\n rph: 10000,\n rpm: 600,\n },\n },\n byokSetup: {\n setupInstructions:\n 'Create a Powens BYOK project, generate OAuth credentials, and optionally configure webhook delivery for account/transaction updates.',\n requiredScopes: ['accounts:read', 'transactions:read', 'balances:read'],\n },\n};\n\nexport function registerPowensIntegration(\n registry: IntegrationSpecRegistry\n): IntegrationSpecRegistry {\n return registry.register(powensIntegrationSpec);\n}\n
|
|
1
|
+
{"version":3,"file":"powens.js","names":["powensIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/powens.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec } from '../spec';\nimport type { IntegrationSpecRegistry } from '../spec';\n\nexport const powensIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'openbanking.powens',\n version: 1,\n category: 'open-banking',\n displayName: 'Powens Open Banking',\n title: 'Powens Open Banking (Read)',\n description:\n 'Read-only Open Banking integration powered by Powens, exposing accounts, transactions, and balances.',\n domain: 'finance',\n owners: ['platform.finance'],\n tags: ['open-banking', 'powens', 'finance'],\n stability: StabilityEnum.Experimental,\n },\n supportedModes: ['byok'],\n capabilities: {\n provides: [\n { key: 'openbanking.accounts.read', version: 1 },\n { key: 'openbanking.transactions.read', version: 1 },\n { key: 'openbanking.balances.read', version: 1 },\n ],\n },\n configSchema: {\n schema: {\n type: 'object',\n required: ['environment'],\n properties: {\n environment: {\n type: 'string',\n enum: ['sandbox', 'production'],\n description:\n 'Powens environment to target. Sandbox uses Powens test API base URL, production uses live endpoints.',\n },\n baseUrl: {\n type: 'string',\n description:\n 'Optional override for the Powens API base URL. Defaults to Powens environment defaults.',\n },\n region: {\n type: 'string',\n description:\n 'Optional Powens region identifier when targeting a specific data residency cluster.',\n },\n pollingIntervalMs: {\n type: 'number',\n description:\n 'Optional custom polling interval in milliseconds for background sync jobs (defaults to platform standard).',\n },\n },\n },\n example: {\n environment: 'sandbox',\n baseUrl: 'https://api-sandbox.powens.com/v2',\n region: 'eu-west-1',\n pollingIntervalMs: 300000,\n },\n },\n secretSchema: {\n schema: {\n type: 'object',\n required: ['clientId', 'clientSecret'],\n properties: {\n clientId: {\n type: 'string',\n description:\n 'Powens OAuth client identifier obtained from the Powens Console (BYOK project).',\n },\n clientSecret: {\n type: 'string',\n description:\n 'Powens OAuth client secret used to exchange for access tokens.',\n },\n apiKey: {\n type: 'string',\n description:\n 'Optional Powens API key (if the tenant project exposes a dedicated API token).',\n },\n webhookSecret: {\n type: 'string',\n description:\n 'Optional webhook signing secret used to verify Powens webhook payloads.',\n },\n },\n },\n example: {\n clientId: 'powens-client-id',\n clientSecret: 'powens-client-secret',\n apiKey: 'powens-api-key',\n webhookSecret: 'powens-webhook-secret',\n },\n },\n healthCheck: {\n method: 'ping',\n timeoutMs: 8000,\n },\n docsUrl: 'https://docs.powens.com/',\n constraints: {\n rateLimit: {\n rph: 10000,\n rpm: 600,\n },\n },\n byokSetup: {\n setupInstructions:\n 'Create a Powens BYOK project, generate OAuth credentials, and optionally configure webhook delivery for account/transaction updates.',\n requiredScopes: ['accounts:read', 'transactions:read', 'balances:read'],\n },\n};\n\nexport function registerPowensIntegration(\n registry: IntegrationSpecRegistry\n): IntegrationSpecRegistry {\n return registry.register(powensIntegrationSpec);\n}\n"],"mappings":"mDAIA,MAAaA,EAAyC,CACpD,KAAM,CACJ,IAAK,qBACL,QAAS,EACT,SAAU,eACV,YAAa,sBACb,MAAO,6BACP,YACE,uGACF,OAAQ,UACR,OAAQ,CAAC,mBAAmB,CAC5B,KAAM,CAAC,eAAgB,SAAU,UAAU,CAC3C,UAAW,EAAc,aAC1B,CACD,eAAgB,CAAC,OAAO,CACxB,aAAc,CACZ,SAAU,CACR,CAAE,IAAK,4BAA6B,QAAS,EAAG,CAChD,CAAE,IAAK,gCAAiC,QAAS,EAAG,CACpD,CAAE,IAAK,4BAA6B,QAAS,EAAG,CACjD,CACF,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,SAAU,CAAC,cAAc,CACzB,WAAY,CACV,YAAa,CACX,KAAM,SACN,KAAM,CAAC,UAAW,aAAa,CAC/B,YACE,uGACH,CACD,QAAS,CACP,KAAM,SACN,YACE,0FACH,CACD,OAAQ,CACN,KAAM,SACN,YACE,sFACH,CACD,kBAAmB,CACjB,KAAM,SACN,YACE,6GACH,CACF,CACF,CACD,QAAS,CACP,YAAa,UACb,QAAS,oCACT,OAAQ,YACR,kBAAmB,IACpB,CACF,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,SAAU,CAAC,WAAY,eAAe,CACtC,WAAY,CACV,SAAU,CACR,KAAM,SACN,YACE,kFACH,CACD,aAAc,CACZ,KAAM,SACN,YACE,iEACH,CACD,OAAQ,CACN,KAAM,SACN,YACE,iFACH,CACD,cAAe,CACb,KAAM,SACN,YACE,0EACH,CACF,CACF,CACD,QAAS,CACP,SAAU,mBACV,aAAc,uBACd,OAAQ,iBACR,cAAe,wBAChB,CACF,CACD,YAAa,CACX,OAAQ,OACR,UAAW,IACZ,CACD,QAAS,2BACT,YAAa,CACX,UAAW,CACT,IAAK,IACL,IAAK,IACN,CACF,CACD,UAAW,CACT,kBACE,uIACF,eAAgB,CAAC,gBAAiB,oBAAqB,gBAAgB,CACxE,CACF,CAED,SAAgB,EACd,EACyB,CACzB,OAAO,EAAS,SAAS,EAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qdrant.d.ts","names":[],"sources":["../../../src/integrations/providers/qdrant.ts"],"sourcesContent":[],"mappings":";;;cAGa,uBAAuB;
|
|
1
|
+
{"version":3,"file":"qdrant.d.ts","names":[],"sources":["../../../src/integrations/providers/qdrant.ts"],"sourcesContent":[],"mappings":";;;cAGa,uBAAuB;iBAgFpB,yBAAA,WACJ,0BACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"qdrant.js","names":["qdrantIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/qdrant.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec, IntegrationSpecRegistry } from '../spec';\n\nexport const qdrantIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'vectordb.qdrant',\n version: 1,\n category: 'vector-db',\n displayName: 'Qdrant',\n title: 'Qdrant Vector Database',\n description: 'Qdrant integration for vector search and embeddings storage.',\n domain: 'ai',\n owners: ['platform.ai'],\n tags: ['vector-db', 'search'],\n stability: StabilityEnum.Experimental,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [\n { key: 'vector-db.search', version: 1 },\n { key: 'vector-db.storage', version: 1 },\n ],\n requires: [\n {\n key: 'ai.embeddings',\n optional: true,\n reason
|
|
1
|
+
{"version":3,"file":"qdrant.js","names":["qdrantIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/qdrant.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec, IntegrationSpecRegistry } from '../spec';\n\nexport const qdrantIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'vectordb.qdrant',\n version: 1,\n category: 'vector-db',\n displayName: 'Qdrant',\n title: 'Qdrant Vector Database',\n description: 'Qdrant integration for vector search and embeddings storage.',\n domain: 'ai',\n owners: ['platform.ai'],\n tags: ['vector-db', 'search'],\n stability: StabilityEnum.Experimental,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [\n { key: 'vector-db.search', version: 1 },\n { key: 'vector-db.storage', version: 1 },\n ],\n requires: [\n {\n key: 'ai.embeddings',\n optional: true,\n reason:\n 'Required if vectors are generated via hosted embedding services',\n },\n ],\n },\n configSchema: {\n schema: {\n type: 'object',\n properties: {\n apiUrl: {\n type: 'string',\n description:\n 'Base URL for the Qdrant instance (e.g., https://qdrant.example.com).',\n },\n collectionPrefix: {\n type: 'string',\n description:\n 'Prefix applied to all collection names for this tenant.',\n },\n },\n },\n example: {\n apiUrl: 'https://qdrant.example.com',\n collectionPrefix: 'tenant_',\n },\n },\n secretSchema: {\n schema: {\n type: 'object',\n properties: {\n apiKey: {\n type: 'string',\n description: 'API key or token when authentication is enabled.',\n },\n },\n },\n example: {\n apiKey: 'qdrant-api-key',\n },\n },\n healthCheck: {\n method: 'ping',\n timeoutMs: 4000,\n },\n docsUrl: 'https://qdrant.tech/documentation/quick-start/',\n constraints: {\n quotas: {\n collections: 100,\n pointsPerCollection: 1_000_000,\n },\n },\n byokSetup: {\n setupInstructions:\n 'Provide the HTTPS endpoint of your Qdrant cluster and generate an API key with read/write access to the collections that will be managed.',\n },\n};\n\nexport function registerQdrantIntegration(\n registry: IntegrationSpecRegistry\n): IntegrationSpecRegistry {\n return registry.register(qdrantIntegrationSpec);\n}\n"],"mappings":"mDAGA,MAAaA,EAAyC,CACpD,KAAM,CACJ,IAAK,kBACL,QAAS,EACT,SAAU,YACV,YAAa,SACb,MAAO,yBACP,YAAa,+DACb,OAAQ,KACR,OAAQ,CAAC,cAAc,CACvB,KAAM,CAAC,YAAa,SAAS,CAC7B,UAAW,EAAc,aAC1B,CACD,eAAgB,CAAC,UAAW,OAAO,CACnC,aAAc,CACZ,SAAU,CACR,CAAE,IAAK,mBAAoB,QAAS,EAAG,CACvC,CAAE,IAAK,oBAAqB,QAAS,EAAG,CACzC,CACD,SAAU,CACR,CACE,IAAK,gBACL,SAAU,GACV,OACE,kEACH,CACF,CACF,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,WAAY,CACV,OAAQ,CACN,KAAM,SACN,YACE,uEACH,CACD,iBAAkB,CAChB,KAAM,SACN,YACE,0DACH,CACF,CACF,CACD,QAAS,CACP,OAAQ,6BACR,iBAAkB,UACnB,CACF,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,WAAY,CACV,OAAQ,CACN,KAAM,SACN,YAAa,mDACd,CACF,CACF,CACD,QAAS,CACP,OAAQ,iBACT,CACF,CACD,YAAa,CACX,OAAQ,OACR,UAAW,IACZ,CACD,QAAS,iDACT,YAAa,CACX,OAAQ,CACN,YAAa,IACb,oBAAqB,IACtB,CACF,CACD,UAAW,CACT,kBACE,4IACH,CACF,CAED,SAAgB,EACd,EACyB,CACzB,OAAO,EAAS,SAAS,EAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stripe.js","names":["stripeIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/stripe.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec } from '../spec';\nimport type { IntegrationSpecRegistry } from '../spec';\n\nexport const stripeIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'payments.stripe',\n version: 1,\n category: 'payments',\n displayName: 'Stripe',\n title: 'Stripe Payments',\n description:\n 'Stripe integration for payment processing, charges, and payouts.',\n domain: 'payments',\n owners: ['platform.payments'],\n tags: ['payments', 'psp'],\n stability: StabilityEnum.Stable,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [{ key: 'payments.psp', version: 1 }],\n requires: [\n {\n key: 'platform.webhooks',\n optional: true,\n reason: 'Recommended for reliable event ingestion',\n },\n ],\n },\n configSchema: {\n schema: {\n type: 'object',\n properties: {\n accountId: {\n type: 'string',\n description: 'Connected account ID when using Stripe Connect (BYOK).',\n },\n region: {\n type: 'string',\n description: 'Optional Stripe region or data residency hint.',\n },\n },\n },\n example: {\n accountId: 'acct_123',\n region: 'us-east-1',\n },\n },\n secretSchema: {\n schema: {\n type: 'object',\n required: ['apiKey', 'webhookSecret'],\n properties: {\n apiKey: {\n type: 'string',\n description: 'Stripe secret API key (sk_live_... or sk_test_...).',\n },\n webhookSecret: {\n type: 'string',\n description: 'Signing secret for webhook verification.',\n },\n },\n },\n example: {\n apiKey: 'sk_live_***',\n webhookSecret: 'whsec_***',\n },\n },\n healthCheck: {\n method: 'ping',\n timeoutMs: 5000,\n },\n docsUrl: 'https://stripe.com/docs/api',\n constraints: {\n rateLimit: {\n rpm: 1000,\n rph: 20000,\n },\n },\n byokSetup: {\n setupInstructions:\n 'Create a restricted Stripe API key with write access to Charges and provide a webhook signing secret.',\n requiredScopes: ['charges:write', 'customers:read'],\n },\n};\n\nexport function registerStripeIntegration(\n registry: IntegrationSpecRegistry\n): IntegrationSpecRegistry {\n return registry.register(stripeIntegrationSpec);\n}\n
|
|
1
|
+
{"version":3,"file":"stripe.js","names":["stripeIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/stripe.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec } from '../spec';\nimport type { IntegrationSpecRegistry } from '../spec';\n\nexport const stripeIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'payments.stripe',\n version: 1,\n category: 'payments',\n displayName: 'Stripe',\n title: 'Stripe Payments',\n description:\n 'Stripe integration for payment processing, charges, and payouts.',\n domain: 'payments',\n owners: ['platform.payments'],\n tags: ['payments', 'psp'],\n stability: StabilityEnum.Stable,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [{ key: 'payments.psp', version: 1 }],\n requires: [\n {\n key: 'platform.webhooks',\n optional: true,\n reason: 'Recommended for reliable event ingestion',\n },\n ],\n },\n configSchema: {\n schema: {\n type: 'object',\n properties: {\n accountId: {\n type: 'string',\n description: 'Connected account ID when using Stripe Connect (BYOK).',\n },\n region: {\n type: 'string',\n description: 'Optional Stripe region or data residency hint.',\n },\n },\n },\n example: {\n accountId: 'acct_123',\n region: 'us-east-1',\n },\n },\n secretSchema: {\n schema: {\n type: 'object',\n required: ['apiKey', 'webhookSecret'],\n properties: {\n apiKey: {\n type: 'string',\n description: 'Stripe secret API key (sk_live_... or sk_test_...).',\n },\n webhookSecret: {\n type: 'string',\n description: 'Signing secret for webhook verification.',\n },\n },\n },\n example: {\n apiKey: 'sk_live_***',\n webhookSecret: 'whsec_***',\n },\n },\n healthCheck: {\n method: 'ping',\n timeoutMs: 5000,\n },\n docsUrl: 'https://stripe.com/docs/api',\n constraints: {\n rateLimit: {\n rpm: 1000,\n rph: 20000,\n },\n },\n byokSetup: {\n setupInstructions:\n 'Create a restricted Stripe API key with write access to Charges and provide a webhook signing secret.',\n requiredScopes: ['charges:write', 'customers:read'],\n },\n};\n\nexport function registerStripeIntegration(\n registry: IntegrationSpecRegistry\n): IntegrationSpecRegistry {\n return registry.register(stripeIntegrationSpec);\n}\n"],"mappings":"mDAIA,MAAaA,EAAyC,CACpD,KAAM,CACJ,IAAK,kBACL,QAAS,EACT,SAAU,WACV,YAAa,SACb,MAAO,kBACP,YACE,mEACF,OAAQ,WACR,OAAQ,CAAC,oBAAoB,CAC7B,KAAM,CAAC,WAAY,MAAM,CACzB,UAAW,EAAc,OAC1B,CACD,eAAgB,CAAC,UAAW,OAAO,CACnC,aAAc,CACZ,SAAU,CAAC,CAAE,IAAK,eAAgB,QAAS,EAAG,CAAC,CAC/C,SAAU,CACR,CACE,IAAK,oBACL,SAAU,GACV,OAAQ,2CACT,CACF,CACF,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,WAAY,CACV,UAAW,CACT,KAAM,SACN,YAAa,yDACd,CACD,OAAQ,CACN,KAAM,SACN,YAAa,iDACd,CACF,CACF,CACD,QAAS,CACP,UAAW,WACX,OAAQ,YACT,CACF,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,SAAU,CAAC,SAAU,gBAAgB,CACrC,WAAY,CACV,OAAQ,CACN,KAAM,SACN,YAAa,sDACd,CACD,cAAe,CACb,KAAM,SACN,YAAa,2CACd,CACF,CACF,CACD,QAAS,CACP,OAAQ,cACR,cAAe,YAChB,CACF,CACD,YAAa,CACX,OAAQ,OACR,UAAW,IACZ,CACD,QAAS,8BACT,YAAa,CACX,UAAW,CACT,IAAK,IACL,IAAK,IACN,CACF,CACD,UAAW,CACT,kBACE,wGACF,eAAgB,CAAC,gBAAiB,iBAAiB,CACpD,CACF,CAED,SAAgB,EACd,EACyB,CACzB,OAAO,EAAS,SAAS,EAAsB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"twilio-sms.js","names":["twilioSmsIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/twilio-sms.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec, IntegrationSpecRegistry } from '../spec';\n\nexport const twilioSmsIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'sms.twilio',\n version: 1,\n category: 'sms',\n displayName: 'Twilio SMS',\n title: 'Twilio Messaging',\n description:\n 'Twilio SMS integration for transactional and notification messaging.',\n domain: 'communications',\n owners: ['platform.messaging'],\n tags: ['sms', 'messaging'],\n stability: StabilityEnum.Stable,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [{ key: 'sms.outbound', version: 1 }],\n },\n configSchema: {\n schema: {\n type: 'object',\n properties: {\n fromNumber: {\n type: 'string',\n description: 'Default Twilio phone number used as sender.',\n },\n },\n },\n example: {\n fromNumber: '+15551234567',\n },\n },\n secretSchema: {\n schema: {\n type: 'object',\n required: ['accountSid', 'authToken'],\n properties: {\n accountSid: {\n type: 'string',\n description: 'Twilio Account SID.',\n },\n authToken: {\n type: 'string',\n description: 'Twilio Auth Token.',\n },\n },\n },\n example: {\n accountSid: 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n authToken: 'auth-token',\n },\n },\n healthCheck: {\n method: 'custom',\n timeoutMs: 3000,\n },\n docsUrl: 'https://www.twilio.com/docs/sms/api',\n constraints: {\n rateLimit: {\n rpm: 200,\n },\n },\n byokSetup: {\n setupInstructions:\n 'Provide a Twilio account SID, auth token, and verify the outbound sending numbers used by the integration.',\n },\n};\n\nexport function registerTwilioSmsIntegration(\n registry: IntegrationSpecRegistry\n): IntegrationSpecRegistry {\n return registry.register(twilioSmsIntegrationSpec);\n}\n
|
|
1
|
+
{"version":3,"file":"twilio-sms.js","names":["twilioSmsIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/twilio-sms.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec, IntegrationSpecRegistry } from '../spec';\n\nexport const twilioSmsIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'sms.twilio',\n version: 1,\n category: 'sms',\n displayName: 'Twilio SMS',\n title: 'Twilio Messaging',\n description:\n 'Twilio SMS integration for transactional and notification messaging.',\n domain: 'communications',\n owners: ['platform.messaging'],\n tags: ['sms', 'messaging'],\n stability: StabilityEnum.Stable,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [{ key: 'sms.outbound', version: 1 }],\n },\n configSchema: {\n schema: {\n type: 'object',\n properties: {\n fromNumber: {\n type: 'string',\n description: 'Default Twilio phone number used as sender.',\n },\n },\n },\n example: {\n fromNumber: '+15551234567',\n },\n },\n secretSchema: {\n schema: {\n type: 'object',\n required: ['accountSid', 'authToken'],\n properties: {\n accountSid: {\n type: 'string',\n description: 'Twilio Account SID.',\n },\n authToken: {\n type: 'string',\n description: 'Twilio Auth Token.',\n },\n },\n },\n example: {\n accountSid: 'ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',\n authToken: 'auth-token',\n },\n },\n healthCheck: {\n method: 'custom',\n timeoutMs: 3000,\n },\n docsUrl: 'https://www.twilio.com/docs/sms/api',\n constraints: {\n rateLimit: {\n rpm: 200,\n },\n },\n byokSetup: {\n setupInstructions:\n 'Provide a Twilio account SID, auth token, and verify the outbound sending numbers used by the integration.',\n },\n};\n\nexport function registerTwilioSmsIntegration(\n registry: IntegrationSpecRegistry\n): IntegrationSpecRegistry {\n return registry.register(twilioSmsIntegrationSpec);\n}\n"],"mappings":"mDAGA,MAAaA,EAA4C,CACvD,KAAM,CACJ,IAAK,aACL,QAAS,EACT,SAAU,MACV,YAAa,aACb,MAAO,mBACP,YACE,uEACF,OAAQ,iBACR,OAAQ,CAAC,qBAAqB,CAC9B,KAAM,CAAC,MAAO,YAAY,CAC1B,UAAW,EAAc,OAC1B,CACD,eAAgB,CAAC,UAAW,OAAO,CACnC,aAAc,CACZ,SAAU,CAAC,CAAE,IAAK,eAAgB,QAAS,EAAG,CAAC,CAChD,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,WAAY,CACV,WAAY,CACV,KAAM,SACN,YAAa,8CACd,CACF,CACF,CACD,QAAS,CACP,WAAY,eACb,CACF,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,SAAU,CAAC,aAAc,YAAY,CACrC,WAAY,CACV,WAAY,CACV,KAAM,SACN,YAAa,sBACd,CACD,UAAW,CACT,KAAM,SACN,YAAa,qBACd,CACF,CACF,CACD,QAAS,CACP,WAAY,mCACZ,UAAW,aACZ,CACF,CACD,YAAa,CACX,OAAQ,SACR,UAAW,IACZ,CACD,QAAS,sCACT,YAAa,CACX,UAAW,CACT,IAAK,IACN,CACF,CACD,UAAW,CACT,kBACE,6GACH,CACF,CAED,SAAgB,EACd,EACyB,CACzB,OAAO,EAAS,SAAS,EAAyB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","names":[],"sources":["../../src/integrations/runtime.ts"],"sourcesContent":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","names":[],"sources":["../../src/integrations/runtime.ts"],"sourcesContent":[],"mappings":";;;;;;UASiB,wBAAA;;EAAA,gBAAA,EAAA,MAAA;EAMA,aAAA,EAAA,MAAA;AAgBjB;AAIY,UApBK,yBAAA,CAoBsB;EAEtB,QAAA,EAAA,MAAA;EAKT,KAAA,EAAA,MAAA;EACM,WAAA,CAAA,EAAA,MAAA;EACI,MAAA,CAAA,EAAA,MAAA;EAET,cAAA,EAAA,MAAA;EACE,kBAAA,EAAA,MAAA;EAAM,YAAA,EAAA,MAAA;EAGA,MAAA,EAAA,SAAA,GAAA,OAAsB;EAWtB,UAAA,CAAA,EAAA,MAAA;EAOA,SAAA,CAAA,EAAA,MAAA;EAER,YAAA,CAAA,EAAA,MAAA;EACC,UAAA,EA5CI,IA4CJ;EAIS,QAAA,CAAA,EA/CN,MA+CM,CAAA,MAAA,EAAA,MAAA,GAAA,MAAA,GAAA,OAAA,CAAA;;AAKF,UAjDA,2BAAA,CAiD2B;EAC9B,MAAA,CAAA,KAAA,EAjDE,yBAiDF,CAAA,EAjD8B,OAiD9B,CAAA,IAAA,CAAA,GAAA,IAAA;;AAKA,KAnDF,2BAAA,GAmDE,SAAA,GAAA,OAAA;AAAI,UAjDD,kBAAA,CAiDC;EAML,QAAA,EAAA,MAAA;EASwB,KAAA,EAAA,MAAA;EACxB,WAAA,CAAA,EAAA,MAAA;EAyBO,MAAA,CAAA,EAAA,MAAA;EAEF,IAAA,EAvFV,eAuFU;EACH,UAAA,EAvFD,qBAuFC;EACE,cAAA,EAvFC,cAuFD;EAAR,eAAA,EAAA,MAAA;EAC0B,KAAA,EAtF1B,wBAsF0B;EAAtB,MAAA,CAAA,EArFF,MAqFE,CAAA,MAAA,EAAA,OAAA,CAAA;;AAAD,UAlFK,sBAAA,CAkFL;EAkPI,QAAA,EAAA,MAAA;EASA,KAAA,EAAA,MAAA;;;;;;;;UAlUC,oBAAA;;;;;;UAOA;;SAER;UACC;;;;mBAIS;;;;UAKF,2BAAA;cACH;;;;0BAIY;cACZ;;cAMD,oBAAA;;;;;;;;8BASwB,0BACxB;0FAyBO,0CAEF,gCACH,2BACN,QAAQ,KACZ,QAAQ,sBAAsB;;;;;;;;;iBAkPnB,qBAAA,cAAmC;iBASnC,qBAAA,SAA8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","names":["secretProvider: SecretProvider"],"sources":["../../src/integrations/runtime.ts"],"sourcesContent":["import { performance } from 'node:perf_hooks';\nimport type { ResolvedAppConfig, ResolvedIntegration } from '../app-config/runtime';\nimport type { ConnectionStatus, IntegrationConnection } from './connection';\nimport type { IntegrationSpec } from './spec';\nimport type { SecretProvider, SecretValue } from './secrets/provider';\n\nexport interface IntegrationTraceMetadata {\n blueprintName: string;\n blueprintVersion: number;\n configVersion: number;\n}\n\nexport interface IntegrationTelemetryEvent {\n tenantId: string;\n appId: string;\n environment?: string;\n slotId?: string;\n integrationKey: string;\n integrationVersion: number;\n connectionId: string;\n status: 'success' | 'error';\n durationMs?: number;\n errorCode?: string;\n errorMessage?: string;\n occurredAt: Date;\n metadata?: Record<string, string | number | boolean>;\n}\n\nexport interface IntegrationTelemetryEmitter {\n record(event: IntegrationTelemetryEvent): Promise<void> | void;\n}\n\nexport type IntegrationInvocationStatus = 'success' | 'error';\n\nexport interface IntegrationContext {\n tenantId: string;\n appId: string;\n environment?: string;\n slotId?: string;\n spec: IntegrationSpec;\n connection: IntegrationConnection;\n secretProvider: SecretProvider;\n secretReference: string;\n trace: IntegrationTraceMetadata;\n config?: Record<string, unknown>;\n}\n\nexport interface IntegrationCallContext {\n tenantId: string;\n appId: string;\n environment?: string;\n blueprintName: string;\n blueprintVersion: number;\n configVersion: number;\n slotId: string;\n operation: string;\n}\n\nexport interface IntegrationCallError {\n code: string;\n message: string;\n retryable: boolean;\n cause?: unknown;\n}\n\nexport interface IntegrationCallResult<T> {\n success: boolean;\n data?: T;\n error?: IntegrationCallError;\n metadata: {\n latencyMs: number;\n connectionId: string;\n ownershipMode: IntegrationConnection['ownershipMode'];\n attempts: number;\n };\n}\n\nexport interface IntegrationCallGuardOptions {\n telemetry?: IntegrationTelemetryEmitter;\n maxAttempts?: number;\n backoffMs?: number;\n shouldRetry?: (error: unknown, attempt: number) => boolean;\n sleep?: (ms: number) => Promise<void>;\n now?: () => Date;\n}\n\nconst DEFAULT_MAX_ATTEMPTS = 3;\nconst DEFAULT_BACKOFF_MS = 250;\n\nexport class IntegrationCallGuard {\n private readonly telemetry?: IntegrationTelemetryEmitter;\n private readonly maxAttempts: number;\n private readonly backoffMs: number;\n private readonly shouldRetry: (error: unknown, attempt: number) => boolean;\n private readonly sleep: (ms: number) => Promise<void>;\n private readonly now: () => Date;\n\n constructor(\n private readonly secretProvider: SecretProvider,\n options: IntegrationCallGuardOptions = {}\n ) {\n this.telemetry = options.telemetry;\n this.maxAttempts = Math.max(\n 1,\n options.maxAttempts ?? DEFAULT_MAX_ATTEMPTS\n );\n this.backoffMs = options.backoffMs ?? DEFAULT_BACKOFF_MS;\n this.shouldRetry =\n options.shouldRetry ??\n ((error: unknown) =>\n typeof error === 'object' &&\n error !== null &&\n 'retryable' in error &&\n Boolean((error as { retryable?: unknown }).retryable));\n this.sleep =\n options.sleep ??\n ((ms: number) =>\n ms <= 0\n ? Promise.resolve()\n : new Promise((resolve) => setTimeout(resolve, ms)));\n this.now = options.now ?? (() => new Date());\n }\n\n async executeWithGuards<T>(\n slotId: string,\n operation: string,\n input: unknown,\n resolvedConfig: ResolvedAppConfig,\n executor: (\n connection: IntegrationConnection,\n secrets: Record<string, string>\n ) => Promise<T>\n ): Promise<IntegrationCallResult<T>> {\n const integration = this.findIntegration(slotId, resolvedConfig);\n if (!integration) {\n return this.failure(\n {\n tenantId: resolvedConfig.tenantId,\n appId: resolvedConfig.appId,\n environment: resolvedConfig.environment,\n blueprintName: resolvedConfig.blueprintName,\n blueprintVersion: resolvedConfig.blueprintVersion,\n configVersion: resolvedConfig.configVersion,\n slotId,\n operation,\n },\n undefined,\n {\n code: 'SLOT_NOT_BOUND',\n message: `Integration slot \"${slotId}\" is not bound for tenant \"${resolvedConfig.tenantId}\".`,\n retryable: false,\n },\n 0\n );\n }\n\n const status = integration.connection.status;\n if (status === 'disconnected' || status === 'error') {\n return this.failure(\n this.makeContext(slotId, operation, resolvedConfig),\n integration,\n {\n code: 'CONNECTION_NOT_READY',\n message: `Integration connection \"${integration.connection.meta.label}\" is in status \"${status}\".`,\n retryable: false,\n },\n 0\n );\n }\n\n const secrets = await this.fetchSecrets(integration.connection);\n\n let attempt = 0;\n const started = performance.now();\n while (attempt < this.maxAttempts) {\n attempt += 1;\n try {\n const data = await executor(integration.connection, secrets);\n const duration = performance.now() - started;\n this.emitTelemetry(\n this.makeContext(slotId, operation, resolvedConfig),\n integration,\n 'success',\n duration\n );\n return {\n success: true,\n data,\n metadata: {\n latencyMs: duration,\n connectionId: integration.connection.meta.id,\n ownershipMode: integration.connection.ownershipMode,\n attempts: attempt,\n },\n };\n } catch (error) {\n const duration = performance.now() - started;\n this.emitTelemetry(\n this.makeContext(slotId, operation, resolvedConfig),\n integration,\n 'error',\n duration,\n this.errorCodeFor(error),\n error instanceof Error ? error.message : String(error)\n );\n const retryable = this.shouldRetry(error, attempt);\n if (!retryable || attempt >= this.maxAttempts) {\n return {\n success: false,\n error: {\n code: this.errorCodeFor(error),\n message:\n error instanceof Error ? error.message : String(error),\n retryable,\n cause: error,\n },\n metadata: {\n latencyMs: duration,\n connectionId: integration.connection.meta.id,\n ownershipMode: integration.connection.ownershipMode,\n attempts: attempt,\n },\n };\n }\n await this.sleep(this.backoffMs);\n }\n }\n\n // Should never reach here due to loop logic.\n return {\n success: false,\n error: {\n code: 'UNKNOWN_ERROR',\n message: 'Integration call failed after retries.',\n retryable: false,\n },\n metadata: {\n latencyMs: performance.now() - started,\n connectionId: integration.connection.meta.id,\n ownershipMode: integration.connection.ownershipMode,\n attempts: this.maxAttempts,\n },\n };\n }\n\n private findIntegration(\n slotId: string,\n config: ResolvedAppConfig\n ): ResolvedIntegration | undefined {\n return config.integrations.find(\n (integration) => integration.slot.slotId === slotId\n );\n }\n\n private async fetchSecrets(\n connection: IntegrationConnection\n ): Promise<Record<string, string>> {\n if (!this.secretProvider.canHandle(connection.secretRef)) {\n throw new Error(\n `Secret provider \"${this.secretProvider.id}\" cannot handle reference \"${connection.secretRef}\".`\n );\n }\n const secret = await this.secretProvider.getSecret(connection.secretRef);\n return this.parseSecret(secret);\n }\n\n private parseSecret(secret: SecretValue): Record<string, string> {\n const text = new TextDecoder().decode(secret.data);\n try {\n const parsed = JSON.parse(text);\n if (\n parsed &&\n typeof parsed === 'object' &&\n !Array.isArray(parsed)\n ) {\n const entries = Object.entries(parsed).filter(\n ([, value]) =>\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n );\n return Object.fromEntries(\n entries.map(([key, value]) => [key, String(value)])\n );\n }\n } catch {\n // Fall through to raw secret.\n }\n return { secret: text };\n }\n\n private emitTelemetry(\n context: IntegrationCallContext,\n integration: ResolvedIntegration | undefined,\n status: 'success' | 'error',\n durationMs: number,\n errorCode?: string,\n errorMessage?: string\n ) {\n if (!this.telemetry || !integration) return;\n this.telemetry.record({\n tenantId: context.tenantId,\n appId: context.appId,\n environment: context.environment,\n slotId: context.slotId,\n integrationKey: integration.connection.meta.integrationKey,\n integrationVersion: integration.connection.meta.integrationVersion,\n connectionId: integration.connection.meta.id,\n status,\n durationMs,\n errorCode,\n errorMessage,\n occurredAt: this.now(),\n metadata: {\n blueprint: `${context.blueprintName}.v${context.blueprintVersion}`,\n configVersion: context.configVersion,\n operation: context.operation,\n },\n });\n }\n\n private failure<T>(\n context: IntegrationCallContext,\n integration: ResolvedIntegration | undefined,\n error: IntegrationCallError,\n attempts: number\n ): IntegrationCallResult<T> {\n if (integration) {\n this.emitTelemetry(\n context,\n integration,\n 'error',\n 0,\n error.code,\n error.message\n );\n }\n return {\n success: false,\n error,\n metadata: {\n latencyMs: 0,\n connectionId: integration?.connection.meta.id ?? 'unknown',\n ownershipMode:\n integration?.connection.ownershipMode ?? 'managed',\n attempts,\n },\n };\n }\n\n private makeContext(\n slotId: string,\n operation: string,\n config: ResolvedAppConfig\n ): IntegrationCallContext {\n return {\n tenantId: config.tenantId,\n appId: config.appId,\n environment: config.environment,\n blueprintName: config.blueprintName,\n blueprintVersion: config.blueprintVersion,\n configVersion: config.configVersion,\n slotId,\n operation,\n };\n }\n\n private errorCodeFor(error: unknown): string {\n if (\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n typeof (error as { code?: unknown }).code === 'string'\n ) {\n return (error as { code: string }).code;\n }\n return 'PROVIDER_ERROR';\n }\n}\n\nexport function ensureConnectionReady(\n integration: ResolvedIntegration\n): void {\n const status = integration.connection.status;\n if (status === 'disconnected' || status === 'error') {\n throw new Error(\n `Integration connection \"${integration.connection.meta.label}\" is in status \"${status}\".`\n );\n }\n}\n\nexport function connectionStatusLabel(status: ConnectionStatus): string {\n switch (status) {\n case 'connected':\n return 'connected';\n case 'disconnected':\n return 'disconnected';\n case 'error':\n return 'error';\n case 'unknown':\n default:\n return 'unknown';\n }\n}\n"],"mappings":"8CAyFA,IAAa,EAAb,KAAkC,CAChC,UACA,YACA,UACA,YACA,MACA,IAEA,YACE,EACA,EAAuC,EAAE,CACzC,CAFiB,KAAA,eAAA,EAGjB,KAAK,UAAY,EAAQ,UACzB,KAAK,YAAc,KAAK,IACtB,EACA,EAAQ,aAAe,EACxB,CACD,KAAK,UAAY,EAAQ,WAAa,IACtC,KAAK,YACH,EAAQ,cACN,GACA,OAAO,GAAU,YACjB,GACA,cAAe,GACf,EAAS,EAAkC,WAC/C,KAAK,MACH,EAAQ,QACN,GACA,GAAM,EACF,QAAQ,SAAS,CACjB,IAAI,QAAS,GAAY,WAAW,EAAS,EAAG,CAAC,EACzD,KAAK,IAAM,EAAQ,UAAc,IAAI,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O"}
|
|
1
|
+
{"version":3,"file":"runtime.js","names":["secretProvider: SecretProvider"],"sources":["../../src/integrations/runtime.ts"],"sourcesContent":["import { performance } from 'node:perf_hooks';\nimport type {\n ResolvedAppConfig,\n ResolvedIntegration,\n} from '../app-config/runtime';\nimport type { ConnectionStatus, IntegrationConnection } from './connection';\nimport type { IntegrationSpec } from './spec';\nimport type { SecretProvider, SecretValue } from './secrets/provider';\n\nexport interface IntegrationTraceMetadata {\n blueprintName: string;\n blueprintVersion: number;\n configVersion: number;\n}\n\nexport interface IntegrationTelemetryEvent {\n tenantId: string;\n appId: string;\n environment?: string;\n slotId?: string;\n integrationKey: string;\n integrationVersion: number;\n connectionId: string;\n status: 'success' | 'error';\n durationMs?: number;\n errorCode?: string;\n errorMessage?: string;\n occurredAt: Date;\n metadata?: Record<string, string | number | boolean>;\n}\n\nexport interface IntegrationTelemetryEmitter {\n record(event: IntegrationTelemetryEvent): Promise<void> | void;\n}\n\nexport type IntegrationInvocationStatus = 'success' | 'error';\n\nexport interface IntegrationContext {\n tenantId: string;\n appId: string;\n environment?: string;\n slotId?: string;\n spec: IntegrationSpec;\n connection: IntegrationConnection;\n secretProvider: SecretProvider;\n secretReference: string;\n trace: IntegrationTraceMetadata;\n config?: Record<string, unknown>;\n}\n\nexport interface IntegrationCallContext {\n tenantId: string;\n appId: string;\n environment?: string;\n blueprintName: string;\n blueprintVersion: number;\n configVersion: number;\n slotId: string;\n operation: string;\n}\n\nexport interface IntegrationCallError {\n code: string;\n message: string;\n retryable: boolean;\n cause?: unknown;\n}\n\nexport interface IntegrationCallResult<T> {\n success: boolean;\n data?: T;\n error?: IntegrationCallError;\n metadata: {\n latencyMs: number;\n connectionId: string;\n ownershipMode: IntegrationConnection['ownershipMode'];\n attempts: number;\n };\n}\n\nexport interface IntegrationCallGuardOptions {\n telemetry?: IntegrationTelemetryEmitter;\n maxAttempts?: number;\n backoffMs?: number;\n shouldRetry?: (error: unknown, attempt: number) => boolean;\n sleep?: (ms: number) => Promise<void>;\n now?: () => Date;\n}\n\nconst DEFAULT_MAX_ATTEMPTS = 3;\nconst DEFAULT_BACKOFF_MS = 250;\n\nexport class IntegrationCallGuard {\n private readonly telemetry?: IntegrationTelemetryEmitter;\n private readonly maxAttempts: number;\n private readonly backoffMs: number;\n private readonly shouldRetry: (error: unknown, attempt: number) => boolean;\n private readonly sleep: (ms: number) => Promise<void>;\n private readonly now: () => Date;\n\n constructor(\n private readonly secretProvider: SecretProvider,\n options: IntegrationCallGuardOptions = {}\n ) {\n this.telemetry = options.telemetry;\n this.maxAttempts = Math.max(1, options.maxAttempts ?? DEFAULT_MAX_ATTEMPTS);\n this.backoffMs = options.backoffMs ?? DEFAULT_BACKOFF_MS;\n this.shouldRetry =\n options.shouldRetry ??\n ((error: unknown) =>\n typeof error === 'object' &&\n error !== null &&\n 'retryable' in error &&\n Boolean((error as { retryable?: unknown }).retryable));\n this.sleep =\n options.sleep ??\n ((ms: number) =>\n ms <= 0\n ? Promise.resolve()\n : new Promise((resolve) => setTimeout(resolve, ms)));\n this.now = options.now ?? (() => new Date());\n }\n\n async executeWithGuards<T>(\n slotId: string,\n operation: string,\n input: unknown,\n resolvedConfig: ResolvedAppConfig,\n executor: (\n connection: IntegrationConnection,\n secrets: Record<string, string>\n ) => Promise<T>\n ): Promise<IntegrationCallResult<T>> {\n const integration = this.findIntegration(slotId, resolvedConfig);\n if (!integration) {\n return this.failure(\n {\n tenantId: resolvedConfig.tenantId,\n appId: resolvedConfig.appId,\n environment: resolvedConfig.environment,\n blueprintName: resolvedConfig.blueprintName,\n blueprintVersion: resolvedConfig.blueprintVersion,\n configVersion: resolvedConfig.configVersion,\n slotId,\n operation,\n },\n undefined,\n {\n code: 'SLOT_NOT_BOUND',\n message: `Integration slot \"${slotId}\" is not bound for tenant \"${resolvedConfig.tenantId}\".`,\n retryable: false,\n },\n 0\n );\n }\n\n const status = integration.connection.status;\n if (status === 'disconnected' || status === 'error') {\n return this.failure(\n this.makeContext(slotId, operation, resolvedConfig),\n integration,\n {\n code: 'CONNECTION_NOT_READY',\n message: `Integration connection \"${integration.connection.meta.label}\" is in status \"${status}\".`,\n retryable: false,\n },\n 0\n );\n }\n\n const secrets = await this.fetchSecrets(integration.connection);\n\n let attempt = 0;\n const started = performance.now();\n while (attempt < this.maxAttempts) {\n attempt += 1;\n try {\n const data = await executor(integration.connection, secrets);\n const duration = performance.now() - started;\n this.emitTelemetry(\n this.makeContext(slotId, operation, resolvedConfig),\n integration,\n 'success',\n duration\n );\n return {\n success: true,\n data,\n metadata: {\n latencyMs: duration,\n connectionId: integration.connection.meta.id,\n ownershipMode: integration.connection.ownershipMode,\n attempts: attempt,\n },\n };\n } catch (error) {\n const duration = performance.now() - started;\n this.emitTelemetry(\n this.makeContext(slotId, operation, resolvedConfig),\n integration,\n 'error',\n duration,\n this.errorCodeFor(error),\n error instanceof Error ? error.message : String(error)\n );\n const retryable = this.shouldRetry(error, attempt);\n if (!retryable || attempt >= this.maxAttempts) {\n return {\n success: false,\n error: {\n code: this.errorCodeFor(error),\n message: error instanceof Error ? error.message : String(error),\n retryable,\n cause: error,\n },\n metadata: {\n latencyMs: duration,\n connectionId: integration.connection.meta.id,\n ownershipMode: integration.connection.ownershipMode,\n attempts: attempt,\n },\n };\n }\n await this.sleep(this.backoffMs);\n }\n }\n\n // Should never reach here due to loop logic.\n return {\n success: false,\n error: {\n code: 'UNKNOWN_ERROR',\n message: 'Integration call failed after retries.',\n retryable: false,\n },\n metadata: {\n latencyMs: performance.now() - started,\n connectionId: integration.connection.meta.id,\n ownershipMode: integration.connection.ownershipMode,\n attempts: this.maxAttempts,\n },\n };\n }\n\n private findIntegration(\n slotId: string,\n config: ResolvedAppConfig\n ): ResolvedIntegration | undefined {\n return config.integrations.find(\n (integration) => integration.slot.slotId === slotId\n );\n }\n\n private async fetchSecrets(\n connection: IntegrationConnection\n ): Promise<Record<string, string>> {\n if (!this.secretProvider.canHandle(connection.secretRef)) {\n throw new Error(\n `Secret provider \"${this.secretProvider.id}\" cannot handle reference \"${connection.secretRef}\".`\n );\n }\n const secret = await this.secretProvider.getSecret(connection.secretRef);\n return this.parseSecret(secret);\n }\n\n private parseSecret(secret: SecretValue): Record<string, string> {\n const text = new TextDecoder().decode(secret.data);\n try {\n const parsed = JSON.parse(text);\n if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {\n const entries = Object.entries(parsed).filter(\n ([, value]) =>\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n );\n return Object.fromEntries(\n entries.map(([key, value]) => [key, String(value)])\n );\n }\n } catch {\n // Fall through to raw secret.\n }\n return { secret: text };\n }\n\n private emitTelemetry(\n context: IntegrationCallContext,\n integration: ResolvedIntegration | undefined,\n status: 'success' | 'error',\n durationMs: number,\n errorCode?: string,\n errorMessage?: string\n ) {\n if (!this.telemetry || !integration) return;\n this.telemetry.record({\n tenantId: context.tenantId,\n appId: context.appId,\n environment: context.environment,\n slotId: context.slotId,\n integrationKey: integration.connection.meta.integrationKey,\n integrationVersion: integration.connection.meta.integrationVersion,\n connectionId: integration.connection.meta.id,\n status,\n durationMs,\n errorCode,\n errorMessage,\n occurredAt: this.now(),\n metadata: {\n blueprint: `${context.blueprintName}.v${context.blueprintVersion}`,\n configVersion: context.configVersion,\n operation: context.operation,\n },\n });\n }\n\n private failure<T>(\n context: IntegrationCallContext,\n integration: ResolvedIntegration | undefined,\n error: IntegrationCallError,\n attempts: number\n ): IntegrationCallResult<T> {\n if (integration) {\n this.emitTelemetry(\n context,\n integration,\n 'error',\n 0,\n error.code,\n error.message\n );\n }\n return {\n success: false,\n error,\n metadata: {\n latencyMs: 0,\n connectionId: integration?.connection.meta.id ?? 'unknown',\n ownershipMode: integration?.connection.ownershipMode ?? 'managed',\n attempts,\n },\n };\n }\n\n private makeContext(\n slotId: string,\n operation: string,\n config: ResolvedAppConfig\n ): IntegrationCallContext {\n return {\n tenantId: config.tenantId,\n appId: config.appId,\n environment: config.environment,\n blueprintName: config.blueprintName,\n blueprintVersion: config.blueprintVersion,\n configVersion: config.configVersion,\n slotId,\n operation,\n };\n }\n\n private errorCodeFor(error: unknown): string {\n if (\n typeof error === 'object' &&\n error !== null &&\n 'code' in error &&\n typeof (error as { code?: unknown }).code === 'string'\n ) {\n return (error as { code: string }).code;\n }\n return 'PROVIDER_ERROR';\n }\n}\n\nexport function ensureConnectionReady(integration: ResolvedIntegration): void {\n const status = integration.connection.status;\n if (status === 'disconnected' || status === 'error') {\n throw new Error(\n `Integration connection \"${integration.connection.meta.label}\" is in status \"${status}\".`\n );\n }\n}\n\nexport function connectionStatusLabel(status: ConnectionStatus): string {\n switch (status) {\n case 'connected':\n return 'connected';\n case 'disconnected':\n return 'disconnected';\n case 'error':\n return 'error';\n case 'unknown':\n default:\n return 'unknown';\n }\n}\n"],"mappings":"8CA4FA,IAAa,EAAb,KAAkC,CAChC,UACA,YACA,UACA,YACA,MACA,IAEA,YACE,EACA,EAAuC,EAAE,CACzC,CAFiB,KAAA,eAAA,EAGjB,KAAK,UAAY,EAAQ,UACzB,KAAK,YAAc,KAAK,IAAI,EAAG,EAAQ,aAAe,EAAqB,CAC3E,KAAK,UAAY,EAAQ,WAAa,IACtC,KAAK,YACH,EAAQ,cACN,GACA,OAAO,GAAU,YACjB,GACA,cAAe,GACf,EAAS,EAAkC,WAC/C,KAAK,MACH,EAAQ,QACN,GACA,GAAM,EACF,QAAQ,SAAS,CACjB,IAAI,QAAS,GAAY,WAAW,EAAS,EAAG,CAAC,EACzD,KAAK,IAAM,EAAQ,UAAc,IAAI,MAGvC,MAAM,kBACJ,EACA,EACA,EACA,EACA,EAImC,CACnC,IAAM,EAAc,KAAK,gBAAgB,EAAQ,EAAe,CAChE,GAAI,CAAC,EACH,OAAO,KAAK,QACV,CACE,SAAU,EAAe,SACzB,MAAO,EAAe,MACtB,YAAa,EAAe,YAC5B,cAAe,EAAe,cAC9B,iBAAkB,EAAe,iBACjC,cAAe,EAAe,cAC9B,SACA,YACD,CACD,IAAA,GACA,CACE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,KAAK,GAC1C,SACA,aACA,YACA,eACA,WAAY,KAAK,KAAK,CACtB,SAAU,CACR,UAAW,GAAG,EAAQ,cAAc,IAAI,EAAQ,mBAChD,cAAe,EAAQ,cACvB,UAAW,EAAQ,UACpB,CACF,CAAC,CAGJ,QACE,EACA,EACA,EACA,EAC0B,CAW1B,OAVI,GACF,KAAK,cACH,EACA,EACA,QACA,EACA,EAAM,KACN,EAAM,QACP,CAEI,CACL,QAAS,GACT,QACA,SAAU,CACR,UAAW,EACX,aAAc,GAAa,WAAW,KAAK,IAAM,UACjD,cAAe,GAAa,WAAW,eAAiB,UACxD,WACD,CACF,CAGH,YACE,EACA,EACA,EACwB,CACxB,MAAO,CACL,SAAU,EAAO,SACjB,MAAO,EAAO,MACd,YAAa,EAAO,YACpB,cAAe,EAAO,cACtB,iBAAkB,EAAO,iBACzB,cAAe,EAAO,cACtB,SACA,YACD,CAGH,aAAqB,EAAwB,CAS3C,OAPE,OAAO,GAAU,UACjB,GACA,SAAU,GACV,OAAQ,EAA6B,MAAS,SAEtC,EAA2B,KAE9B,mBAIX,SAAgB,EAAsB,EAAwC,CAC5E,IAAM,EAAS,EAAY,WAAW,OACtC,GAAI,IAAW,gBAAkB,IAAW,QAC1C,MAAU,MACR,2BAA2B,EAAY,WAAW,KAAK,MAAM,kBAAkB,EAAO,IACvF,CAIL,SAAgB,EAAsB,EAAkC,CACtE,OAAQ,EAAR,CACE,IAAK,YACH,MAAO,YACT,IAAK,eACH,MAAO,eACT,IAAK,QACH,MAAO,QACT,IAAK,UACL,QACE,MAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-secret-provider.js","names":[],"sources":["../../../src/integrations/secrets/env-secret-provider.ts"],"sourcesContent":["import { parseSecretUri, SecretProviderError } from './provider';\nimport type {\n SecretProvider,\n SecretReference,\n SecretRotationResult,\n SecretValue,\n SecretWritePayload,\n} from './provider';\n\ninterface EnvSecretProviderOptions {\n /**\n * Optional map to alias secret references to environment variable names.\n * Useful when referencing secrets from other providers (e.g. gcp://...)\n * while still allowing local overrides.\n */\n aliases?: Record<string, string>;\n}\n\n/**\n * Environment-variable backed secret provider. Read-only by design.\n * Allows overriding other secret providers by deriving environment variable\n * names from secret references (or by using explicit aliases).\n */\nexport class EnvSecretProvider implements SecretProvider {\n readonly id = 'env';\n\n private readonly aliases: Record<string, string>;\n\n constructor(options: EnvSecretProviderOptions = {}) {\n this.aliases = options.aliases ?? {};\n }\n\n canHandle(reference: SecretReference): boolean {\n const envKey = this.resolveEnvKey(reference);\n return envKey !== undefined && process.env[envKey] !== undefined;\n }\n\n async getSecret(reference: SecretReference): Promise<SecretValue> {\n const envKey = this.resolveEnvKey(reference);\n if (!envKey) {\n throw new SecretProviderError({\n message: `Unable to resolve environment variable for reference \"${reference}\".`,\n provider: this.id,\n reference,\n code: 'INVALID',\n });\n }\n\n const value = process.env[envKey];\n if (value === undefined) {\n throw new SecretProviderError({\n message: `Environment variable \"${envKey}\" not found for reference \"${reference}\".`,\n provider: this.id,\n reference,\n code: 'NOT_FOUND',\n });\n }\n\n return {\n data: Buffer.from(value, 'utf-8'),\n version: 'current',\n metadata: {\n source: 'env',\n envKey,\n },\n retrievedAt: new Date(),\n };\n }\n\n async setSecret(\n reference: SecretReference,\n _payload: SecretWritePayload\n ): Promise<SecretRotationResult> {\n throw this.forbiddenError('setSecret', reference);\n }\n\n async rotateSecret(\n reference: SecretReference,\n _payload: SecretWritePayload\n ): Promise<SecretRotationResult> {\n throw this.forbiddenError('rotateSecret', reference);\n }\n\n async deleteSecret(reference: SecretReference): Promise<void> {\n throw this.forbiddenError('deleteSecret', reference);\n }\n\n private resolveEnvKey(reference: SecretReference): string | undefined {\n if (!reference) {\n return undefined;\n }\n\n if (this.aliases[reference]) {\n return this.aliases[reference];\n }\n\n if (!reference.includes('://')) {\n return reference;\n }\n\n try {\n const parsed = parseSecretUri(reference);\n if (parsed.provider === 'env') {\n return parsed.path;\n }\n\n if (parsed.extras?.env) {\n return parsed.extras.env;\n }\n\n return this.deriveEnvKey(parsed.path);\n } catch {\n return reference;\n }\n }\n\n private deriveEnvKey(path: string): string | undefined {\n if (!path) return undefined;\n return path\n .split(/[\\/:\\-\\.]/)\n .filter(Boolean)\n .map((segment) =>\n segment\n .replace(/[^a-zA-Z0-9]/g, '_')\n .replace(/_{2,}/g, '_')\n .toUpperCase()\n )\n .join('_');\n }\n\n private forbiddenError(\n operation: string,\n reference: SecretReference\n ): SecretProviderError {\n return new SecretProviderError({\n message: `EnvSecretProvider is read-only. \"${operation}\" is not allowed for ${reference}.`,\n provider: this.id,\n reference,\n code: 'FORBIDDEN',\n });\n }\n}\n
|
|
1
|
+
{"version":3,"file":"env-secret-provider.js","names":[],"sources":["../../../src/integrations/secrets/env-secret-provider.ts"],"sourcesContent":["import { parseSecretUri, SecretProviderError } from './provider';\nimport type {\n SecretProvider,\n SecretReference,\n SecretRotationResult,\n SecretValue,\n SecretWritePayload,\n} from './provider';\n\ninterface EnvSecretProviderOptions {\n /**\n * Optional map to alias secret references to environment variable names.\n * Useful when referencing secrets from other providers (e.g. gcp://...)\n * while still allowing local overrides.\n */\n aliases?: Record<string, string>;\n}\n\n/**\n * Environment-variable backed secret provider. Read-only by design.\n * Allows overriding other secret providers by deriving environment variable\n * names from secret references (or by using explicit aliases).\n */\nexport class EnvSecretProvider implements SecretProvider {\n readonly id = 'env';\n\n private readonly aliases: Record<string, string>;\n\n constructor(options: EnvSecretProviderOptions = {}) {\n this.aliases = options.aliases ?? {};\n }\n\n canHandle(reference: SecretReference): boolean {\n const envKey = this.resolveEnvKey(reference);\n return envKey !== undefined && process.env[envKey] !== undefined;\n }\n\n async getSecret(reference: SecretReference): Promise<SecretValue> {\n const envKey = this.resolveEnvKey(reference);\n if (!envKey) {\n throw new SecretProviderError({\n message: `Unable to resolve environment variable for reference \"${reference}\".`,\n provider: this.id,\n reference,\n code: 'INVALID',\n });\n }\n\n const value = process.env[envKey];\n if (value === undefined) {\n throw new SecretProviderError({\n message: `Environment variable \"${envKey}\" not found for reference \"${reference}\".`,\n provider: this.id,\n reference,\n code: 'NOT_FOUND',\n });\n }\n\n return {\n data: Buffer.from(value, 'utf-8'),\n version: 'current',\n metadata: {\n source: 'env',\n envKey,\n },\n retrievedAt: new Date(),\n };\n }\n\n async setSecret(\n reference: SecretReference,\n _payload: SecretWritePayload\n ): Promise<SecretRotationResult> {\n throw this.forbiddenError('setSecret', reference);\n }\n\n async rotateSecret(\n reference: SecretReference,\n _payload: SecretWritePayload\n ): Promise<SecretRotationResult> {\n throw this.forbiddenError('rotateSecret', reference);\n }\n\n async deleteSecret(reference: SecretReference): Promise<void> {\n throw this.forbiddenError('deleteSecret', reference);\n }\n\n private resolveEnvKey(reference: SecretReference): string | undefined {\n if (!reference) {\n return undefined;\n }\n\n if (this.aliases[reference]) {\n return this.aliases[reference];\n }\n\n if (!reference.includes('://')) {\n return reference;\n }\n\n try {\n const parsed = parseSecretUri(reference);\n if (parsed.provider === 'env') {\n return parsed.path;\n }\n\n if (parsed.extras?.env) {\n return parsed.extras.env;\n }\n\n return this.deriveEnvKey(parsed.path);\n } catch {\n return reference;\n }\n }\n\n private deriveEnvKey(path: string): string | undefined {\n if (!path) return undefined;\n return path\n .split(/[\\/:\\-\\.]/)\n .filter(Boolean)\n .map((segment) =>\n segment\n .replace(/[^a-zA-Z0-9]/g, '_')\n .replace(/_{2,}/g, '_')\n .toUpperCase()\n )\n .join('_');\n }\n\n private forbiddenError(\n operation: string,\n reference: SecretReference\n ): SecretProviderError {\n return new SecretProviderError({\n message: `EnvSecretProvider is read-only. \"${operation}\" is not allowed for ${reference}.`,\n provider: this.id,\n reference,\n code: 'FORBIDDEN',\n });\n }\n}\n"],"mappings":"wEAuBA,IAAa,EAAb,KAAyD,CACvD,GAAc,MAEd,QAEA,YAAY,EAAoC,EAAE,CAAE,CAClD,KAAK,QAAU,EAAQ,SAAW,EAAE,CAGtC,UAAU,EAAqC,CAC7C,IAAM,EAAS,KAAK,cAAc,EAAU,CA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EAAoB,CAC7B,QAAS,oCAAoC,EAAU,uBAAuB,EAAU,GACxF,SAAU,KAAK,GACf,YACA,KAAM,YACP,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcp-secret-manager.d.ts","names":[],"sources":["../../../src/integrations/secrets/gcp-secret-manager.ts"],"sourcesContent":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"gcp-secret-manager.d.ts","names":[],"sources":["../../../src/integrations/secrets/gcp-secret-manager.ts"],"sourcesContent":[],"mappings":";;;;;KAmBK,mBAAA,GAAsB;UAEjB,+BAAA;EAFL,SAAA,CAAA,EAAA,MAAA;EAEK,MAAA,CAAA,EAEC,mBAFD;EAEC,aAAA,CAAA,EACO,qBADP,CAAA,OACoC,0BADpC,CAAA,CAAA,CAAA,CAAA;EACoC,kBAAA,CAAA,EACxB,MAAA,CAAO,MAAA,CAAO,KAAA,CAAM,aAAA,CAAc,EAAA,CAAG,YADb;;AACxB,cAaV,wBAAA,YAAoC,cAbW,CAAA;EAAY,SAAA,EAAA,GAAA,oBAAA;EAa3D,iBAAA,MAAA;EAMU,iBAAA,iBAAA;EAQA,iBAAA,WAAA;EAUR,WAAA,CAAA,OAAA,CAAA,EAlBQ,+BAkBR;EAEG,SAAA,CAAA,SAAA,EAZK,eAYL,CAAA,EAAA,OAAA;EACL,SAAA,CAAA,SAAA,EAHE,eAGF,EAAA,OAyCE,CAzCF,EAAA;IAAR,OAAA,CAAA,EAAA,MAAA;EAyCU,CAAA,EAAA,WAAA,CAAA,EA1CG,WA0CH,CAAA,EAzCV,OAyCU,CAzCF,WAyCE,CAAA;EACF,SAAA,CAAA,SAAA,EADE,eACF,EAAA,OAAA,EAAA,kBAAA,CAAA,EACR,OADQ,CACA,oBADA,CAAA;EACA,YAAA,CAAA,SAAA,EAsCE,eAtCF,EAAA,OAAA,EAuCA,kBAvCA,CAAA,EAwCR,OAxCQ,CAwCA,oBAxCA,CAAA;EAAR,YAAA,CAAA,SAAA,EA4C2B,eA5C3B,CAAA,EA4C6C,OA5C7C,CAAA,IAAA,CAAA;EAsCU,QAAA,cAAA;EACF,QAAA,UAAA;EACA,QAAA,gBAAA;EAAR,QAAA,kBAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcp-secret-manager.js","names":["DEFAULT_REPLICATION: protos.google.cloud.secretmanager.v1.IReplication"],"sources":["../../../src/integrations/secrets/gcp-secret-manager.ts"],"sourcesContent":["import { protos, SecretManagerServiceClient } from '@google-cloud/secret-manager';\nimport type { CallOptions } from 'google-gax';\n\nimport { normalizeSecretPayload, parseSecretUri, SecretProviderError } from './provider';\nimport type {\n SecretProvider,\n SecretReference,\n SecretRotationResult,\n SecretValue,\n SecretWritePayload,\n} from './provider';\n\ntype SecretManagerClient = SecretManagerServiceClient;\n\ninterface GcpSecretManagerProviderOptions {\n projectId?: string;\n client?: SecretManagerClient;\n clientOptions?: ConstructorParameters<typeof SecretManagerServiceClient>[0];\n defaultReplication?: protos.google.cloud.secretmanager.v1.IReplication;\n}\n\ninterface GcpSecretLocation {\n projectId: string;\n secretId: string;\n version?: string;\n}\n\nconst DEFAULT_REPLICATION: protos.google.cloud.secretmanager.v1.IReplication = {\n automatic: {},\n};\n\nexport class GcpSecretManagerProvider implements SecretProvider {\n readonly id = 'gcp-secret-manager';\n private readonly client: SecretManagerClient;\n private readonly explicitProjectId?: string;\n private readonly replication: protos.google.cloud.secretmanager.v1.IReplication;\n\n constructor(options: GcpSecretManagerProviderOptions = {}) {\n this.client =\n options.client ??\n new SecretManagerServiceClient(options.clientOptions ?? {});\n this.explicitProjectId = options.projectId;\n this.replication = options.defaultReplication ?? DEFAULT_REPLICATION;\n }\n\n canHandle(reference: SecretReference): boolean {\n try {\n const parsed = parseSecretUri(reference);\n return parsed.provider === 'gcp';\n } catch {\n return false;\n }\n }\n\n async getSecret(\n reference: SecretReference,\n options?: { version?: string },\n callOptions?: CallOptions\n ): Promise<SecretValue> {\n const location = this.parseReference(reference);\n const secretVersionName = this.buildVersionName(location, options?.version);\n try {\n const response = await this.client.accessSecretVersion(\n {\n name: secretVersionName,\n },\n callOptions ?? {}\n );\n const [result] = response;\n const payload = result.payload;\n if (!payload?.data) {\n throw new SecretProviderError({\n message: `Secret payload empty for ${secretVersionName}`,\n provider: this.id,\n reference,\n code: 'UNKNOWN',\n });\n }\n\n const version = extractVersionFromName(result.name ?? secretVersionName);\n return {\n data: payload.data as Uint8Array,\n version,\n metadata: payload.dataCrc32c\n ? { crc32c: payload.dataCrc32c.toString() }\n : undefined,\n retrievedAt: new Date(),\n };\n } catch (error) {\n throw toSecretProviderError({\n error,\n provider: this.id,\n reference,\n operation: 'access',\n });\n }\n }\n\n async setSecret(\n reference: SecretReference,\n payload: SecretWritePayload\n ): Promise<SecretRotationResult> {\n const location = this.parseReference(reference);\n const { secretName } = this.buildNames(location);\n const data = normalizeSecretPayload(payload);\n await this.ensureSecretExists(location, payload);\n\n try {\n const response = await this.client.addSecretVersion({\n parent: secretName,\n payload: {\n data,\n },\n });\n if (!response) {\n throw new SecretProviderError({\n message: `No version returned when adding secret version for ${secretName}`,\n provider: this.id,\n reference,\n code: 'UNKNOWN',\n });\n }\n const [version] = response;\n const versionName = version?.name ?? `${secretName}/versions/latest`;\n return {\n reference: `gcp://${versionName}`,\n version: extractVersionFromName(versionName) ?? 'latest',\n };\n } catch (error) {\n throw toSecretProviderError({\n error,\n provider: this.id,\n reference,\n operation: 'addSecretVersion',\n });\n }\n }\n\n async rotateSecret(\n reference: SecretReference,\n payload: SecretWritePayload\n ): Promise<SecretRotationResult> {\n return this.setSecret(reference, payload);\n }\n\n async deleteSecret(reference: SecretReference): Promise<void> {\n const location = this.parseReference(reference);\n const { secretName } = this.buildNames(location);\n try {\n await this.client.deleteSecret({\n name: secretName,\n });\n } catch (error) {\n throw toSecretProviderError({\n error,\n provider: this.id,\n reference,\n operation: 'delete',\n });\n }\n }\n\n private parseReference(reference: SecretReference): GcpSecretLocation {\n const parsed = parseSecretUri(reference);\n if (parsed.provider !== 'gcp') {\n throw new SecretProviderError({\n message: `Unsupported secret provider: ${parsed.provider}`,\n provider: this.id,\n reference,\n code: 'INVALID',\n });\n }\n\n const segments = parsed.path.split('/').filter(Boolean);\n if (segments.length < 4 || segments[0] !== 'projects') {\n throw new SecretProviderError({\n message: `Expected secret reference format gcp://projects/{project}/secrets/{secret}[(/versions/{version})] but received \"${parsed.path}\"`,\n provider: this.id,\n reference,\n code: 'INVALID',\n });\n }\n\n const projectIdCandidate = segments[1] ?? this.explicitProjectId;\n if (!projectIdCandidate) {\n throw new SecretProviderError({\n message: `Unable to resolve project or secret from reference \"${parsed.path}\"`,\n provider: this.id,\n reference,\n code: 'INVALID',\n });\n }\n\n const indexOfSecrets = segments.indexOf('secrets');\n if (indexOfSecrets === -1 || indexOfSecrets + 1 >= segments.length) {\n throw new SecretProviderError({\n message: `Unable to resolve project or secret from reference \"${parsed.path}\"`,\n provider: this.id,\n reference,\n code: 'INVALID',\n });\n }\n\n const resolvedProjectId = projectIdCandidate;\n const secretIdCandidate = segments[indexOfSecrets + 1];\n if (!secretIdCandidate) {\n throw new SecretProviderError({\n message: `Unable to resolve secret ID from reference \"${parsed.path}\"`,\n provider: this.id,\n reference,\n code: 'INVALID',\n });\n }\n const secretId = secretIdCandidate;\n const indexOfVersions = segments.indexOf('versions');\n const version =\n parsed.extras?.version ??\n (indexOfVersions !== -1 && indexOfVersions + 1 < segments.length\n ? segments[indexOfVersions + 1]\n : undefined);\n\n return {\n projectId: resolvedProjectId,\n secretId,\n version,\n };\n }\n\n private buildNames(location: GcpSecretLocation): {\n secretName: string;\n projectParent: string;\n } {\n const projectId = location.projectId ?? this.explicitProjectId;\n if (!projectId) {\n throw new SecretProviderError({\n message: 'Project ID must be provided either in reference or provider configuration',\n provider: this.id,\n reference: `gcp://projects//secrets/${location.secretId}`,\n code: 'INVALID',\n });\n }\n\n const projectParent = `projects/${projectId}`;\n const secretName = `${projectParent}/secrets/${location.secretId}`;\n return {\n projectParent,\n secretName,\n };\n }\n\n private buildVersionName(\n location: GcpSecretLocation,\n explicitVersion?: string\n ): string {\n const { secretName } = this.buildNames(location);\n const version = explicitVersion ?? location.version ?? 'latest';\n return `${secretName}/versions/${version}`;\n }\n\n private async ensureSecretExists(\n location: GcpSecretLocation,\n payload: SecretWritePayload\n ): Promise<void> {\n const { secretName, projectParent } = this.buildNames(location);\n try {\n await this.client.getSecret({ name: secretName });\n } catch (error) {\n const providerError = toSecretProviderError({\n error,\n provider: this.id,\n reference: `gcp://${secretName}`,\n operation: 'getSecret',\n suppressThrow: true,\n });\n if (!providerError || providerError.code !== 'NOT_FOUND') {\n if (providerError) {\n throw providerError;\n }\n throw error;\n }\n try {\n await this.client.createSecret({\n parent: projectParent,\n secretId: location.secretId,\n secret: {\n replication: this.replication,\n labels: payload.labels,\n },\n });\n } catch (creationError) {\n const creationProviderError = toSecretProviderError({\n error: creationError,\n provider: this.id,\n reference: `gcp://${secretName}`,\n operation: 'createSecret',\n });\n throw creationProviderError;\n }\n }\n }\n}\n\nfunction extractVersionFromName(name: string): string | undefined {\n const segments = name.split('/').filter(Boolean);\n const index = segments.indexOf('versions');\n if (index === -1 || index + 1 >= segments.length) {\n return undefined;\n }\n return segments[index + 1];\n}\n\nfunction toSecretProviderError(params: {\n error: unknown;\n provider: string;\n reference: SecretReference;\n operation: string;\n suppressThrow?: boolean;\n}): SecretProviderError {\n const { error, provider, reference, operation, suppressThrow } = params;\n if (error instanceof SecretProviderError) {\n return error;\n }\n\n const code = deriveErrorCode(error);\n const message =\n error instanceof Error ? error.message : `Unknown error during ${operation}`;\n\n const providerError = new SecretProviderError({\n message,\n provider,\n reference,\n code,\n cause: error,\n });\n\n if (suppressThrow) {\n return providerError;\n }\n\n throw providerError;\n}\n\nfunction deriveErrorCode(error: unknown): SecretProviderError['code'] {\n if (typeof error !== 'object' || error === null) {\n return 'UNKNOWN';\n }\n\n const errorAny = error as { code?: number | string };\n const code = errorAny.code;\n if (code === 5 || code === 'NOT_FOUND') return 'NOT_FOUND';\n if (code === 6 || code === 'ALREADY_EXISTS') return 'INVALID';\n if (code === 7 || code === 'PERMISSION_DENIED' || code === 403) {\n return 'FORBIDDEN';\n }\n if (code === 3 || code === 'INVALID_ARGUMENT') return 'INVALID';\n return 'UNKNOWN';\n}\n\n\n"],"mappings":"0LA2BA,MAAMA,EAAyE,CAC7E,UAAW,EAAE,CACd,CAED,IAAa,EAAb,KAAgE,CAC9D,GAAc,qBACd,OACA,kBACA,YAEA,YAAY,EAA2C,EAAE,CAAE,CACzD,KAAK,OACH,EAAQ,QACR,IAAI,EAA2B,EAAQ,eAAiB,EAAE,CAAC,CAC7D,KAAK,kBAAoB,EAAQ,UACjC,KAAK,YAAc,EAAQ,oBAAsB,EAGnD,UAAU,EAAqC,CAC7C,GAAI,CAEF,OADe,EAAe,EAAU,CAC1B,WAAa,WACrB,CACN,MAAO,IAIX,MAAM,UACJ,EACA,EACA,EACsB,CACtB,IAAM,EAAW,KAAK,eAAe,EAAU,CACzC,EAAoB,KAAK,iBAAiB,EAAU,GAAS,QAAQ,CAC3E,GAAI,CAOF,GAAM,CAAC,GANU,MAAM,KAAK,OAAO,oBACjC,CACE,KAAM,EACP,CACD,GAAe,EAAE,CAClB,CAEK,EAAU,EAAO,QACvB,GAAI,CAAC,GAAS,KACZ,MAAM,IAAI,EAAoB,CAC5B,QAAS,4BAA4B,IACrC,SAAU,KAAK,GACf,YACA,KAAM,UACP,CAAC,CAGJ,IAAM,EAAU,EAAuB,EAAO,MAAQ,EAAkB,CACxE,MAAO,CACL,KAAM,EAAQ,KACd,UACA,SAAU,EAAQ,WACd,CAAE,OAAQ,EAAQ,WAAW,UAAU,CAAE,CACzC,IAAA,GACJ,YAAa,IAAI,KAClB,OACM,EAAO,CACd,MAAM,EAAsB,CAC1B,QACA,SAAU,KAAK,GACf,YACA,UAAW,SACZ,CAAC,EAIN,MAAM,UACJ,EACA,EAC+B,CAC/B,IAAM,EAAW,KAAK,eAAe,EAAU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AAM,EAAgB,EAAsB,CAC1C,QACA,SAAU,KAAK,GACf,UAAW,SAAS,IACpB,UAAW,YACX,cAAe,GAChB,CAAC,CACF,GAAI,CAAC,GAAiB,EAAc,OAAS,YAI3C,MAHI,GAGE,EAER,GAAI,CACF,MAAM,KAAK,OAAO,aAAa,CAC7B,OAAQ,EACR,SAAU,EAAS,SACnB,OAAQ,CACN,YAAa,KAAK,YAClB,OAAQ,EAAQ,OACjB,CACF,CAAC,OACK,EAAe,CAOtB,MAN8B,EAAsB,CAClD,MAAO,EACP,SAAU,KAAK,GACf,UAAW,SAAS,IACpB,UAAW,eACZ,CAAC,KAOV,SAAS,EAAuB,EAAkC,CAChE,IAAM,EAAW,EAAK,MAAM,IAAI,CAAC,OAAO,QAAQ,CAC1C,EAAQ,EAAS,QAAQ,WAAW,CACtC,SAAU,IAAM,EAAQ,GAAK,EAAS,QAG1C,OAAO,EAAS,EAAQ,GAG1B,SAAS,EAAsB,EAMP,CACtB,GAAM,CAAE,QAAO,WAAU,YAAW,YAAW,iBAAkB,EACjE,GAAI,aAAiB,EACnB,OAAO,EAGT,IAAM,EAAO,EAAgB,EAAM,CAI7B,EAAgB,IAAI,EAAoB,CAC5C,QAHA,aAAiB,MAAQ,EAAM,QAAU,wBAAwB,IAIjE,WACA,YACA,OACA,MAAO,EACR,CAAC,CAEF,GAAI,EACF,OAAO,EAGT,MAAM,EAGR,SAAS,EAAgB,EAA6C,CACpE,GAAI,OAAO,GAAU,WAAY,EAC/B,MAAO,UAIT,IAAM,EADW,EACK,KAOtB,OANI,IAAS,GAAK,IAAS,YAAoB,YAC3C,IAAS,GAAK,IAAS,iBAAyB,UAChD,IAAS,GAAK,IAAS,qBAAuB,IAAS,IAClD,YAEL,IAAS,GAAK,IAAS,mBAA2B,UAC/C"}
|
|
1
|
+
{"version":3,"file":"gcp-secret-manager.js","names":["DEFAULT_REPLICATION: protos.google.cloud.secretmanager.v1.IReplication"],"sources":["../../../src/integrations/secrets/gcp-secret-manager.ts"],"sourcesContent":["import {\n protos,\n SecretManagerServiceClient,\n} from '@google-cloud/secret-manager';\nimport type { CallOptions } from 'google-gax';\n\nimport {\n normalizeSecretPayload,\n parseSecretUri,\n SecretProviderError,\n} from './provider';\nimport type {\n SecretProvider,\n SecretReference,\n SecretRotationResult,\n SecretValue,\n SecretWritePayload,\n} from './provider';\n\ntype SecretManagerClient = SecretManagerServiceClient;\n\ninterface GcpSecretManagerProviderOptions {\n projectId?: string;\n client?: SecretManagerClient;\n clientOptions?: ConstructorParameters<typeof SecretManagerServiceClient>[0];\n defaultReplication?: protos.google.cloud.secretmanager.v1.IReplication;\n}\n\ninterface GcpSecretLocation {\n projectId: string;\n secretId: string;\n version?: string;\n}\n\nconst DEFAULT_REPLICATION: protos.google.cloud.secretmanager.v1.IReplication = {\n automatic: {},\n};\n\nexport class GcpSecretManagerProvider implements SecretProvider {\n readonly id = 'gcp-secret-manager';\n private readonly client: SecretManagerClient;\n private readonly explicitProjectId?: string;\n private readonly replication: protos.google.cloud.secretmanager.v1.IReplication;\n\n constructor(options: GcpSecretManagerProviderOptions = {}) {\n this.client =\n options.client ??\n new SecretManagerServiceClient(options.clientOptions ?? {});\n this.explicitProjectId = options.projectId;\n this.replication = options.defaultReplication ?? DEFAULT_REPLICATION;\n }\n\n canHandle(reference: SecretReference): boolean {\n try {\n const parsed = parseSecretUri(reference);\n return parsed.provider === 'gcp';\n } catch {\n return false;\n }\n }\n\n async getSecret(\n reference: SecretReference,\n options?: { version?: string },\n callOptions?: CallOptions\n ): Promise<SecretValue> {\n const location = this.parseReference(reference);\n const secretVersionName = this.buildVersionName(location, options?.version);\n try {\n const response = await this.client.accessSecretVersion(\n {\n name: secretVersionName,\n },\n callOptions ?? {}\n );\n const [result] = response;\n const payload = result.payload;\n if (!payload?.data) {\n throw new SecretProviderError({\n message: `Secret payload empty for ${secretVersionName}`,\n provider: this.id,\n reference,\n code: 'UNKNOWN',\n });\n }\n\n const version = extractVersionFromName(result.name ?? secretVersionName);\n return {\n data: payload.data as Uint8Array,\n version,\n metadata: payload.dataCrc32c\n ? { crc32c: payload.dataCrc32c.toString() }\n : undefined,\n retrievedAt: new Date(),\n };\n } catch (error) {\n throw toSecretProviderError({\n error,\n provider: this.id,\n reference,\n operation: 'access',\n });\n }\n }\n\n async setSecret(\n reference: SecretReference,\n payload: SecretWritePayload\n ): Promise<SecretRotationResult> {\n const location = this.parseReference(reference);\n const { secretName } = this.buildNames(location);\n const data = normalizeSecretPayload(payload);\n await this.ensureSecretExists(location, payload);\n\n try {\n const response = await this.client.addSecretVersion({\n parent: secretName,\n payload: {\n data,\n },\n });\n if (!response) {\n throw new SecretProviderError({\n message: `No version returned when adding secret version for ${secretName}`,\n provider: this.id,\n reference,\n code: 'UNKNOWN',\n });\n }\n const [version] = response;\n const versionName = version?.name ?? `${secretName}/versions/latest`;\n return {\n reference: `gcp://${versionName}`,\n version: extractVersionFromName(versionName) ?? 'latest',\n };\n } catch (error) {\n throw toSecretProviderError({\n error,\n provider: this.id,\n reference,\n operation: 'addSecretVersion',\n });\n }\n }\n\n async rotateSecret(\n reference: SecretReference,\n payload: SecretWritePayload\n ): Promise<SecretRotationResult> {\n return this.setSecret(reference, payload);\n }\n\n async deleteSecret(reference: SecretReference): Promise<void> {\n const location = this.parseReference(reference);\n const { secretName } = this.buildNames(location);\n try {\n await this.client.deleteSecret({\n name: secretName,\n });\n } catch (error) {\n throw toSecretProviderError({\n error,\n provider: this.id,\n reference,\n operation: 'delete',\n });\n }\n }\n\n private parseReference(reference: SecretReference): GcpSecretLocation {\n const parsed = parseSecretUri(reference);\n if (parsed.provider !== 'gcp') {\n throw new SecretProviderError({\n message: `Unsupported secret provider: ${parsed.provider}`,\n provider: this.id,\n reference,\n code: 'INVALID',\n });\n }\n\n const segments = parsed.path.split('/').filter(Boolean);\n if (segments.length < 4 || segments[0] !== 'projects') {\n throw new SecretProviderError({\n message: `Expected secret reference format gcp://projects/{project}/secrets/{secret}[(/versions/{version})] but received \"${parsed.path}\"`,\n provider: this.id,\n reference,\n code: 'INVALID',\n });\n }\n\n const projectIdCandidate = segments[1] ?? this.explicitProjectId;\n if (!projectIdCandidate) {\n throw new SecretProviderError({\n message: `Unable to resolve project or secret from reference \"${parsed.path}\"`,\n provider: this.id,\n reference,\n code: 'INVALID',\n });\n }\n\n const indexOfSecrets = segments.indexOf('secrets');\n if (indexOfSecrets === -1 || indexOfSecrets + 1 >= segments.length) {\n throw new SecretProviderError({\n message: `Unable to resolve project or secret from reference \"${parsed.path}\"`,\n provider: this.id,\n reference,\n code: 'INVALID',\n });\n }\n\n const resolvedProjectId = projectIdCandidate;\n const secretIdCandidate = segments[indexOfSecrets + 1];\n if (!secretIdCandidate) {\n throw new SecretProviderError({\n message: `Unable to resolve secret ID from reference \"${parsed.path}\"`,\n provider: this.id,\n reference,\n code: 'INVALID',\n });\n }\n const secretId = secretIdCandidate;\n const indexOfVersions = segments.indexOf('versions');\n const version =\n parsed.extras?.version ??\n (indexOfVersions !== -1 && indexOfVersions + 1 < segments.length\n ? segments[indexOfVersions + 1]\n : undefined);\n\n return {\n projectId: resolvedProjectId,\n secretId,\n version,\n };\n }\n\n private buildNames(location: GcpSecretLocation): {\n secretName: string;\n projectParent: string;\n } {\n const projectId = location.projectId ?? this.explicitProjectId;\n if (!projectId) {\n throw new SecretProviderError({\n message:\n 'Project ID must be provided either in reference or provider configuration',\n provider: this.id,\n reference: `gcp://projects//secrets/${location.secretId}`,\n code: 'INVALID',\n });\n }\n\n const projectParent = `projects/${projectId}`;\n const secretName = `${projectParent}/secrets/${location.secretId}`;\n return {\n projectParent,\n secretName,\n };\n }\n\n private buildVersionName(\n location: GcpSecretLocation,\n explicitVersion?: string\n ): string {\n const { secretName } = this.buildNames(location);\n const version = explicitVersion ?? location.version ?? 'latest';\n return `${secretName}/versions/${version}`;\n }\n\n private async ensureSecretExists(\n location: GcpSecretLocation,\n payload: SecretWritePayload\n ): Promise<void> {\n const { secretName, projectParent } = this.buildNames(location);\n try {\n await this.client.getSecret({ name: secretName });\n } catch (error) {\n const providerError = toSecretProviderError({\n error,\n provider: this.id,\n reference: `gcp://${secretName}`,\n operation: 'getSecret',\n suppressThrow: true,\n });\n if (!providerError || providerError.code !== 'NOT_FOUND') {\n if (providerError) {\n throw providerError;\n }\n throw error;\n }\n try {\n await this.client.createSecret({\n parent: projectParent,\n secretId: location.secretId,\n secret: {\n replication: this.replication,\n labels: payload.labels,\n },\n });\n } catch (creationError) {\n const creationProviderError = toSecretProviderError({\n error: creationError,\n provider: this.id,\n reference: `gcp://${secretName}`,\n operation: 'createSecret',\n });\n throw creationProviderError;\n }\n }\n }\n}\n\nfunction extractVersionFromName(name: string): string | undefined {\n const segments = name.split('/').filter(Boolean);\n const index = segments.indexOf('versions');\n if (index === -1 || index + 1 >= segments.length) {\n return undefined;\n }\n return segments[index + 1];\n}\n\nfunction toSecretProviderError(params: {\n error: unknown;\n provider: string;\n reference: SecretReference;\n operation: string;\n suppressThrow?: boolean;\n}): SecretProviderError {\n const { error, provider, reference, operation, suppressThrow } = params;\n if (error instanceof SecretProviderError) {\n return error;\n }\n\n const code = deriveErrorCode(error);\n const message =\n error instanceof Error\n ? error.message\n : `Unknown error during ${operation}`;\n\n const providerError = new SecretProviderError({\n message,\n provider,\n reference,\n code,\n cause: error,\n });\n\n if (suppressThrow) {\n return providerError;\n }\n\n throw providerError;\n}\n\nfunction deriveErrorCode(error: unknown): SecretProviderError['code'] {\n if (typeof error !== 'object' || error === null) {\n return 'UNKNOWN';\n }\n\n const errorAny = error as { code?: number | string };\n const code = errorAny.code;\n if (code === 5 || code === 'NOT_FOUND') return 'NOT_FOUND';\n if (code === 6 || code === 'ALREADY_EXISTS') return 'INVALID';\n if (code === 7 || code === 'PERMISSION_DENIED' || code === 403) {\n return 'FORBIDDEN';\n }\n if (code === 3 || code === 'INVALID_ARGUMENT') return 'INVALID';\n return 'UNKNOWN';\n}\n"],"mappings":"0LAkCA,MAAMA,EAAyE,CAC7E,UAAW,EAAE,CACd,CAED,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AAQ,EAAQ,OACjB,CACF,CAAC,OACK,EAAe,CAOtB,MAN8B,EAAsB,CAClD,MAAO,EACP,SAAU,KAAK,GACf,UAAW,SAAS,IACpB,UAAW,eACZ,CAAC,KAOV,SAAS,EAAuB,EAAkC,CAChE,IAAM,EAAW,EAAK,MAAM,IAAI,CAAC,OAAO,QAAQ,CAC1C,EAAQ,EAAS,QAAQ,WAAW,CACtC,SAAU,IAAM,EAAQ,GAAK,EAAS,QAG1C,OAAO,EAAS,EAAQ,GAG1B,SAAS,EAAsB,EAMP,CACtB,GAAM,CAAE,QAAO,WAAU,YAAW,YAAW,iBAAkB,EACjE,GAAI,aAAiB,EACnB,OAAO,EAGT,IAAM,EAAO,EAAgB,EAAM,CAM7B,EAAgB,IAAI,EAAoB,CAC5C,QALA,aAAiB,MACb,EAAM,QACN,wBAAwB,IAI5B,WACA,YACA,OACA,MAAO,EACR,CAAC,CAEF,GAAI,EACF,OAAO,EAGT,MAAM,EAGR,SAAS,EAAgB,EAA6C,CACpE,GAAI,OAAO,GAAU,WAAY,EAC/B,MAAO,UAIT,IAAM,EADW,EACK,KAOtB,OANI,IAAS,GAAK,IAAS,YAAoB,YAC3C,IAAS,GAAK,IAAS,iBAAyB,UAChD,IAAS,GAAK,IAAS,qBAAuB,IAAS,IAClD,YAEL,IAAS,GAAK,IAAS,mBAA2B,UAC/C"}
|
|
@@ -16,10 +16,10 @@ interface SecretProviderManagerOptions {
|
|
|
16
16
|
* Providers to pre-register. They are registered in array order with
|
|
17
17
|
* descending priority (first entry wins ties).
|
|
18
18
|
*/
|
|
19
|
-
providers?:
|
|
19
|
+
providers?: {
|
|
20
20
|
provider: SecretProvider;
|
|
21
21
|
priority?: number;
|
|
22
|
-
}
|
|
22
|
+
}[];
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Composite secret provider that delegates to registered providers.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.d.ts","names":[],"sources":["../../../src/integrations/secrets/manager.ts"],"sourcesContent":[],"mappings":";;;UAeU,eAAA;;AARU;AAepB;EAmBa,QAAA,CAAA,EAAA,MAAA;;AAaQ,UAhCJ,4BAAA,CAgCI;EAAyB;;;EAuBhC,EAAA,CAAA,EAAA,MAAA;EACD;;;;
|
|
1
|
+
{"version":3,"file":"manager.d.ts","names":[],"sources":["../../../src/integrations/secrets/manager.ts"],"sourcesContent":[],"mappings":";;;UAeU,eAAA;;AARU;AAepB;EAmBa,QAAA,CAAA,EAAA,MAAA;;AAaQ,UAhCJ,4BAAA,CAgCI;EAAyB;;;EAuBhC,EAAA,CAAA,EAAA,MAAA;EACD;;;;EA2BA,SAAA,CAAA,EAAA;IAAR,QAAA,EA1EqB,cA0ErB;IAOU,QAAA,CAAA,EAAA,MAAA;EACF,CAAA,EAAA;;;;;;;AA0EZ;;cAlJY,qBAAA,YAAiC;;;;wBAKvB;qBAQF,0BAAyB;uBAevB;uBAOR,2BACD,qBACT,QAAQ;uBAyBE,0BACF,qBACR,QAAQ;0BAOE,0BACF,qBACR,QAAQ;0BAMmB,kBAAkB;;;;KAgF7C,kBAAA,GAAqB,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","names":["errors: SecretProviderError[]"],"sources":["../../../src/integrations/secrets/manager.ts"],"sourcesContent":["import { SecretProviderError } from './provider';\nimport type {\n SecretProvider,\n SecretReference,\n SecretRotationResult,\n SecretValue,\n SecretWritePayload,\n} from './provider';\n\ninterface ProviderRegistration {\n readonly provider: SecretProvider;\n readonly priority: number;\n readonly order: number;\n}\n\ninterface RegisterOptions {\n /**\n * Larger priority values are attempted first. Defaults to 0.\n */\n priority?: number;\n}\n\nexport interface SecretProviderManagerOptions {\n /**\n * Override manager identifier. Defaults to \"secret-provider-manager\".\n */\n id?: string;\n /**\n * Providers to pre-register. They are registered in array order with\n * descending priority (first entry wins ties).\n */\n providers?:
|
|
1
|
+
{"version":3,"file":"manager.js","names":["errors: SecretProviderError[]"],"sources":["../../../src/integrations/secrets/manager.ts"],"sourcesContent":["import { SecretProviderError } from './provider';\nimport type {\n SecretProvider,\n SecretReference,\n SecretRotationResult,\n SecretValue,\n SecretWritePayload,\n} from './provider';\n\ninterface ProviderRegistration {\n readonly provider: SecretProvider;\n readonly priority: number;\n readonly order: number;\n}\n\ninterface RegisterOptions {\n /**\n * Larger priority values are attempted first. Defaults to 0.\n */\n priority?: number;\n}\n\nexport interface SecretProviderManagerOptions {\n /**\n * Override manager identifier. Defaults to \"secret-provider-manager\".\n */\n id?: string;\n /**\n * Providers to pre-register. They are registered in array order with\n * descending priority (first entry wins ties).\n */\n providers?: { provider: SecretProvider; priority?: number }[];\n}\n\n/**\n * Composite secret provider that delegates to registered providers.\n * Providers are attempted in order of descending priority, respecting the\n * registration order for ties. This enables privileged overrides (e.g.\n * environment variables) while still supporting durable backends like GCP\n * Secret Manager.\n */\nexport class SecretProviderManager implements SecretProvider {\n readonly id: string;\n private readonly providers: ProviderRegistration[] = [];\n private registrationCounter = 0;\n\n constructor(options: SecretProviderManagerOptions = {}) {\n this.id = options.id ?? 'secret-provider-manager';\n const initialProviders = options.providers ?? [];\n for (const entry of initialProviders) {\n this.register(entry.provider, { priority: entry.priority });\n }\n }\n\n register(provider: SecretProvider, options: RegisterOptions = {}): this {\n this.providers.push({\n provider,\n priority: options.priority ?? 0,\n order: this.registrationCounter++,\n });\n this.providers.sort((a, b) => {\n if (a.priority !== b.priority) {\n return b.priority - a.priority;\n }\n return a.order - b.order;\n });\n return this;\n }\n\n canHandle(reference: SecretReference): boolean {\n return this.providers.some(({ provider }) =>\n safeCanHandle(provider, reference)\n );\n }\n\n async getSecret(\n reference: SecretReference,\n options?: SecretFetchOptions\n ): Promise<SecretValue> {\n const errors: SecretProviderError[] = [];\n\n for (const { provider } of this.providers) {\n if (!safeCanHandle(provider, reference)) {\n continue;\n }\n try {\n return await provider.getSecret(reference, options);\n } catch (error) {\n if (error instanceof SecretProviderError) {\n errors.push(error);\n if (error.code !== 'NOT_FOUND') {\n break;\n }\n continue;\n }\n throw error;\n }\n }\n\n throw this.composeError('getSecret', reference, errors, options?.version);\n }\n\n async setSecret(\n reference: SecretReference,\n payload: SecretWritePayload\n ): Promise<SecretRotationResult> {\n return this.delegateToFirst('setSecret', reference, (provider) =>\n provider.setSecret(reference, payload)\n );\n }\n\n async rotateSecret(\n reference: SecretReference,\n payload: SecretWritePayload\n ): Promise<SecretRotationResult> {\n return this.delegateToFirst('rotateSecret', reference, (provider) =>\n provider.rotateSecret(reference, payload)\n );\n }\n\n async deleteSecret(reference: SecretReference): Promise<void> {\n await this.delegateToFirst('deleteSecret', reference, (provider) =>\n provider.deleteSecret(reference)\n );\n }\n\n private async delegateToFirst<T>(\n operation: 'setSecret' | 'rotateSecret' | 'deleteSecret',\n reference: SecretReference,\n invoker: (provider: SecretProvider) => Promise<T>\n ): Promise<T> {\n const errors: SecretProviderError[] = [];\n\n for (const { provider } of this.providers) {\n if (!safeCanHandle(provider, reference)) {\n continue;\n }\n try {\n return await invoker(provider);\n } catch (error) {\n if (error instanceof SecretProviderError) {\n errors.push(error);\n continue;\n }\n throw error;\n }\n }\n\n throw this.composeError(operation, reference, errors);\n }\n\n private composeError(\n operation: string,\n reference: SecretReference,\n errors: SecretProviderError[],\n version?: string\n ): SecretProviderError {\n if (errors.length === 1) {\n const [singleError] = errors;\n if (singleError) {\n return singleError;\n }\n }\n\n const messageParts = [\n `No registered secret provider could ${operation}`,\n `reference \"${reference}\"`,\n ];\n if (version) {\n messageParts.push(`(version: ${version})`);\n }\n if (errors.length > 1) {\n messageParts.push(\n `Attempts: ${errors\n .map((error) => `${error.provider}:${error.code}`)\n .join(', ')}`\n );\n }\n\n return new SecretProviderError({\n message: messageParts.join(' '),\n provider: this.id,\n reference,\n code: errors.length > 0 ? errors[errors.length - 1]!.code : 'UNKNOWN',\n cause: errors,\n });\n }\n}\n\nfunction safeCanHandle(\n provider: SecretProvider,\n reference: SecretReference\n): boolean {\n try {\n return provider.canHandle(reference);\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aAAa,EAA2C,CAC5D,MAAM,KAAK,gBAAgB,eAAgB,EAAY,GACrD,EAAS,aAAa,EAAU,CACjC,CAGH,MAAc,gBACZ,EACA,EACA,EACY,CACZ,IAAMA,EAAgC,EAAE,CAExC,IAAK,GAAM,CAAE,cAAc,KAAK,UACzB,KAAc,EAAU,EAAU,CAGvC,GAAI,CACF,OAAO,MAAM,EAAQ,EAAS,OACvB,EAAO,CACd,GAAI,aAAiB,EAAqB,CACxC,EAAO,KAAK,EAAM,CAClB,SAEF,MAAM,EAIV,MAAM,KAAK,aAAa,EAAW,EAAW,EAAO,CAGvD,aACE,EACA,EACA,EACA,EACqB,CACrB,GAAI,EAAO,SAAW,EAAG,CACvB,GAAM,CAAC,GAAe,EACtB,GAAI,EACF,OAAO,EAIX,IAAM,EAAe,CACnB,uCAAuC,IACvC,cAAc,EAAU,GACzB,CAYD,OAXI,GACF,EAAa,KAAK,aAAa,EAAQ,GAAG,CAExC,EAAO,OAAS,GAClB,EAAa,KACX,aAAa,EACV,IAAK,GAAU,GAAG,EAAM,SAAS,GAAG,EAAM,OAAO,CACjD,KAAK,KAAK,GACd,CAGI,IAAI,EAAoB,CAC7B,QAAS,EAAa,KAAK,IAAI,CAC/B,SAAU,KAAK,GACf,YACA,KAAM,EAAO,OAAS,EAAI,EAAO,EAAO,OAAS,GAAI,KAAO,UAC5D,MAAO,EACR,CAAC,GAIN,SAAS,EACP,EACA,EACS,CACT,GAAI,CACF,OAAO,EAAS,UAAU,EAAU,MAC9B,CACN,MAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","names":[],"sources":["../../../src/integrations/secrets/provider.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\n\nexport type SecretReference = string;\n\nexport interface SecretValue {\n data: Uint8Array;\n version?: string;\n metadata?: Record<string, string>;\n retrievedAt: Date;\n}\n\nexport interface SecretFetchOptions {\n version?: string;\n}\n\nexport type SecretPayloadEncoding = 'utf-8' | 'base64' | 'binary';\n\nexport interface SecretWritePayload {\n data: string | Uint8Array;\n encoding?: SecretPayloadEncoding;\n contentType?: string;\n labels?: Record<string, string>;\n}\n\nexport interface SecretRotationResult {\n reference: SecretReference;\n version: string;\n}\n\nexport interface SecretProvider {\n readonly id: string;\n canHandle(reference: SecretReference): boolean;\n getSecret(\n reference: SecretReference,\n options?: SecretFetchOptions\n ): Promise<SecretValue>;\n setSecret(\n reference: SecretReference,\n payload: SecretWritePayload\n ): Promise<SecretRotationResult>;\n rotateSecret(\n reference: SecretReference,\n payload: SecretWritePayload\n ): Promise<SecretRotationResult>;\n deleteSecret(reference: SecretReference): Promise<void>;\n}\n\nexport interface ParsedSecretUri {\n provider: string;\n path: string;\n extras?: Record<string, string>;\n}\n\nexport class SecretProviderError extends Error {\n readonly provider: string;\n readonly reference: SecretReference;\n readonly code: 'NOT_FOUND' | 'FORBIDDEN' | 'INVALID' | 'UNKNOWN';\n readonly cause?: unknown;\n\n constructor(params: {\n message: string;\n provider: string;\n reference: SecretReference;\n code?: SecretProviderError['code'];\n cause?: unknown;\n }) {\n super(params.message);\n this.name = 'SecretProviderError';\n this.provider = params.provider;\n this.reference = params.reference;\n this.code = params.code ?? 'UNKNOWN';\n this.cause = params.cause;\n }\n}\n\nexport function parseSecretUri(reference: SecretReference): ParsedSecretUri {\n if (!reference) {\n throw new SecretProviderError({\n message: 'Secret reference cannot be empty',\n provider: 'unknown',\n reference,\n code: 'INVALID',\n });\n }\n\n const [scheme, rest] = reference.split('://');\n if (!scheme || !rest) {\n throw new SecretProviderError({\n message: `Invalid secret reference: ${reference}`,\n provider: 'unknown',\n reference,\n code: 'INVALID',\n });\n }\n\n const queryIndex = rest.indexOf('?');\n if (queryIndex === -1) {\n return {\n provider: scheme,\n path: rest,\n };\n }\n\n const path = rest.slice(0, queryIndex);\n const query = rest.slice(queryIndex + 1);\n const extras = Object.fromEntries(\n query\n .split('&')\n .filter(Boolean)\n .map((pair) => {\n const [keyRaw, valueRaw] = pair.split('=');\n const key = keyRaw ?? '';\n const value = valueRaw ?? '';\n return [decodeURIComponent(key), decodeURIComponent(value)];\n })\n );\n\n return {\n provider: scheme,\n path,\n extras,\n };\n}\n\nexport function normalizeSecretPayload(\n payload: SecretWritePayload\n): Uint8Array {\n if (payload.data instanceof Uint8Array) {\n return payload.data;\n }\n\n if (payload.encoding === 'base64') {\n return Buffer.from(payload.data, 'base64');\n }\n\n if (payload.encoding === 'binary') {\n return Buffer.from(payload.data, 'binary');\n }\n\n return Buffer.from(payload.data, 'utf-8');\n}\n
|
|
1
|
+
{"version":3,"file":"provider.js","names":[],"sources":["../../../src/integrations/secrets/provider.ts"],"sourcesContent":["import { Buffer } from 'node:buffer';\n\nexport type SecretReference = string;\n\nexport interface SecretValue {\n data: Uint8Array;\n version?: string;\n metadata?: Record<string, string>;\n retrievedAt: Date;\n}\n\nexport interface SecretFetchOptions {\n version?: string;\n}\n\nexport type SecretPayloadEncoding = 'utf-8' | 'base64' | 'binary';\n\nexport interface SecretWritePayload {\n data: string | Uint8Array;\n encoding?: SecretPayloadEncoding;\n contentType?: string;\n labels?: Record<string, string>;\n}\n\nexport interface SecretRotationResult {\n reference: SecretReference;\n version: string;\n}\n\nexport interface SecretProvider {\n readonly id: string;\n canHandle(reference: SecretReference): boolean;\n getSecret(\n reference: SecretReference,\n options?: SecretFetchOptions\n ): Promise<SecretValue>;\n setSecret(\n reference: SecretReference,\n payload: SecretWritePayload\n ): Promise<SecretRotationResult>;\n rotateSecret(\n reference: SecretReference,\n payload: SecretWritePayload\n ): Promise<SecretRotationResult>;\n deleteSecret(reference: SecretReference): Promise<void>;\n}\n\nexport interface ParsedSecretUri {\n provider: string;\n path: string;\n extras?: Record<string, string>;\n}\n\nexport class SecretProviderError extends Error {\n readonly provider: string;\n readonly reference: SecretReference;\n readonly code: 'NOT_FOUND' | 'FORBIDDEN' | 'INVALID' | 'UNKNOWN';\n readonly cause?: unknown;\n\n constructor(params: {\n message: string;\n provider: string;\n reference: SecretReference;\n code?: SecretProviderError['code'];\n cause?: unknown;\n }) {\n super(params.message);\n this.name = 'SecretProviderError';\n this.provider = params.provider;\n this.reference = params.reference;\n this.code = params.code ?? 'UNKNOWN';\n this.cause = params.cause;\n }\n}\n\nexport function parseSecretUri(reference: SecretReference): ParsedSecretUri {\n if (!reference) {\n throw new SecretProviderError({\n message: 'Secret reference cannot be empty',\n provider: 'unknown',\n reference,\n code: 'INVALID',\n });\n }\n\n const [scheme, rest] = reference.split('://');\n if (!scheme || !rest) {\n throw new SecretProviderError({\n message: `Invalid secret reference: ${reference}`,\n provider: 'unknown',\n reference,\n code: 'INVALID',\n });\n }\n\n const queryIndex = rest.indexOf('?');\n if (queryIndex === -1) {\n return {\n provider: scheme,\n path: rest,\n };\n }\n\n const path = rest.slice(0, queryIndex);\n const query = rest.slice(queryIndex + 1);\n const extras = Object.fromEntries(\n query\n .split('&')\n .filter(Boolean)\n .map((pair) => {\n const [keyRaw, valueRaw] = pair.split('=');\n const key = keyRaw ?? '';\n const value = valueRaw ?? '';\n return [decodeURIComponent(key), decodeURIComponent(value)];\n })\n );\n\n return {\n provider: scheme,\n path,\n extras,\n };\n}\n\nexport function normalizeSecretPayload(\n payload: SecretWritePayload\n): Uint8Array {\n if (payload.data instanceof Uint8Array) {\n return payload.data;\n }\n\n if (payload.encoding === 'base64') {\n return Buffer.from(payload.data, 'base64');\n }\n\n if (payload.encoding === 'binary') {\n return Buffer.from(payload.data, 'binary');\n }\n\n return Buffer.from(payload.data, 'utf-8');\n}\n"],"mappings":"qCAqDA,IAAa,EAAb,cAAyC,KAAM,CAC7C,SACA,UACA,KACA,MAEA,YAAY,EAMT,CACD,MAAM,EAAO,QAAQ,CACrB,KAAK,KAAO,sBACZ,KAAK,SAAW,EAAO,SACvB,KAAK,UAAY,EAAO,UACxB,KAAK,KAAO,EAAO,MAAQ,UAC3B,KAAK,MAAQ,EAAO,QAIxB,SAAgB,EAAe,EAA6C,CAC1E,GAAI,CAAC,EACH,MAAM,IAAI,EAAoB,CAC5B,QAAS,mCACT,SAAU,UACV,YACA,KAAM,UACP,CAAC,CAGJ,GAAM,CAAC,EAAQ,GAAQ,EAAU,MAAM,MAAM,CAC7C,GAAI,CAAC,GAAU,CAAC,EACd,MAAM,IAAI,EAAoB,CAC5B,QAAS,6BAA6B,IACtC,SAAU,UACV,YACA,KAAM,UACP,CAAC,CAGJ,IAAM,EAAa,EAAK,QAAQ,IAAI,CACpC,GAAI,IAAe,GACjB,MAAO,CACL,SAAU,EACV,KAAM,EACP,CAGH,IAAM,EAAO,EAAK,MAAM,EAAG,EAAW,CAChC,EAAQ,EAAK,MAAM,EAAa,EAAE,CAaxC,MAAO,CACL,SAAU,EACV,OACA,OAfa,OAAO,YACpB,EACG,MAAM,IAAI,CACV,OAAO,QAAQ,CACf,IAAK,GAAS,CACb,GAAM,CAAC,EAAQ,GAAY,EAAK,MAAM,IAAI,CACpC,EAAM,GAAU,GAChB,EAAQ,GAAY,GAC1B,MAAO,CAAC,mBAAmB,EAAI,CAAE,mBAAmB,EAAM,CAAC,EAC3D,CACL,CAMA,CAGH,SAAgB,EACd,EACY,CAaZ,OAZI,EAAQ,gBAAgB,WACnB,EAAQ,KAGb,EAAQ,WAAa,SAChB,EAAO,KAAK,EAAQ,KAAM,SAAS,CAGxC,EAAQ,WAAa,SAChB,EAAO,KAAK,EAAQ,KAAM,SAAS,CAGrC,EAAO,KAAK,EAAQ,KAAM,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.d.ts","names":[],"sources":["../../src/integrations/spec.ts"],"sourcesContent":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"spec.d.ts","names":[],"sources":["../../src/integrations/spec.ts"],"sourcesContent":[],"mappings":";;;;KAGY,mBAAA;KAgBA,wBAAA;AAhBA,UAkBK,eAAA,SAAwB,aAlBV,CAAA;EAgBnB;EAEK,GAAA,EAAA,MAAA;EASA;EAOA,OAAA,EAAA,MAAA;EAOA,QAAA,EAlBL,mBAkB4B;EAOvB,WAAA,EAAA,MAAA;AAOjB;AAOiB,UAnCA,4BAAA,CAmCe;EACxB;EAEU,QAAA,EApCN,aAoCM,EAAA;EAEF;EAEA,QAAA,CAAA,EAtCH,qBAsCG,EAAA;;AAIA,UAvCC,uBAAA,CAuCD;EAMH;EAGC,MAAA,EAAA,OAAA;EAAoB;EAMrB,OAAA,CAAA,EAlDD,MAkDC,CAAA,MAAA,EAAA,OAAuB,CAAA;;AAY1B,UA3DO,uBAAA,CA2DP;EAI4B;EAgBZ,MAAA,EAAA,OAAA;EAAsB;EAAe,OAAA,CAAA,EA3EnD,MA2EmD,CAAA,MAAA,EAAA,MAAA,CAAA;AAK/D;UA7EiB,oBAAA;;;;;;UAOA,sBAAA;;;;;;UAOA,eAAA;QACT;;kBAEU;;gBAEF;;gBAEA;;gBAEA;;gBAEA;;;;;;;;;aAMH;;;cAGC;;cAMD,uBAAA;;iBAGI;UASP;sCAI4B;0BAgBZ,sBAAsB;;iBAKhC,sBAAA,OAA6B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spec.js","names":["latest: IntegrationSpec | undefined"],"sources":["../../src/integrations/spec.ts"],"sourcesContent":["import type { OwnerShipMeta } from '../ownership';\nimport type {
|
|
1
|
+
{"version":3,"file":"spec.js","names":["latest: IntegrationSpec | undefined"],"sources":["../../src/integrations/spec.ts"],"sourcesContent":["import type { OwnerShipMeta } from '../ownership';\nimport type { CapabilityRef, CapabilityRequirement } from '../capabilities';\n\nexport type IntegrationCategory =\n | 'payments'\n | 'email'\n | 'calendar'\n | 'sms'\n | 'ai-llm'\n | 'ai-voice'\n | 'speech-to-text'\n | 'vector-db'\n | 'storage'\n | 'accounting'\n | 'crm'\n | 'helpdesk'\n | 'open-banking'\n | 'custom';\n\nexport type IntegrationOwnershipMode = 'managed' | 'byok';\n\nexport interface IntegrationMeta extends OwnerShipMeta {\n /** Stable provider slug (e.g., \"stripe\", \"openai\"). */\n key: string;\n /** Provider version (increment on breaking API changes). */\n version: number;\n category: IntegrationCategory;\n displayName: string;\n}\n\nexport interface IntegrationCapabilityMapping {\n /** Which CapabilitySpec this integration provides. */\n provides: CapabilityRef[];\n /** Optional: which capabilities it requires (e.g., storage for caching). */\n requires?: CapabilityRequirement[];\n}\n\nexport interface IntegrationConfigSchema {\n /** JSON Schema or SchemaModel defining required config fields. */\n schema: unknown;\n /** Example configuration (for docs/UI). */\n example?: Record<string, unknown>;\n}\n\nexport interface IntegrationSecretSchema {\n /** JSON Schema or SchemaModel describing secret fields. */\n schema: unknown;\n /** Redacted example for documentation/UI. */\n example?: Record<string, string>;\n}\n\nexport interface IntegrationByokSetup {\n /** Human-readable instructions for tenants configuring BYOK accounts. */\n setupInstructions?: string;\n /** Required scopes/permissions for BYOK accounts. */\n requiredScopes?: string[];\n}\n\nexport interface IntegrationHealthCheck {\n /** Endpoint or method to validate connection health. */\n method?: 'ping' | 'list' | 'custom';\n /** Timeout in ms for health check. */\n timeoutMs?: number;\n}\n\nexport interface IntegrationSpec {\n meta: IntegrationMeta;\n /** Supported ownership modes for this provider. */\n supportedModes: IntegrationOwnershipMode[];\n /** Which capabilities this integration provides/requires. */\n capabilities: IntegrationCapabilityMapping;\n /** Configuration schema (API keys, endpoints, etc.). */\n configSchema: IntegrationConfigSchema;\n /** Secret schema (API/key material stored via secretRef). */\n secretSchema: IntegrationSecretSchema;\n /** Optional health check configuration. */\n healthCheck?: IntegrationHealthCheck;\n /** Documentation URL. */\n docsUrl?: string;\n /** Rate limits or usage constraints. */\n constraints?: {\n rateLimit?: { rpm?: number; rph?: number };\n quotas?: Record<string, number>;\n };\n /** Provider-specific metadata for BYOK setup flows. */\n byokSetup?: IntegrationByokSetup;\n}\n\nconst integrationKey = (meta: Pick<IntegrationMeta, 'key' | 'version'>) =>\n `${meta.key}.v${meta.version}`;\n\nexport class IntegrationSpecRegistry {\n private readonly items = new Map<string, IntegrationSpec>();\n\n register(spec: IntegrationSpec): this {\n const key = integrationKey(spec.meta);\n if (this.items.has(key)) {\n throw new Error(`Duplicate IntegrationSpec ${key}`);\n }\n this.items.set(key, spec);\n return this;\n }\n\n list(): IntegrationSpec[] {\n return [...this.items.values()];\n }\n\n get(key: string, version?: number): IntegrationSpec | undefined {\n if (version != null) {\n return this.items.get(integrationKey({ key, version }));\n }\n let latest: IntegrationSpec | undefined;\n let maxVersion = -Infinity;\n for (const spec of this.items.values()) {\n if (spec.meta.key !== key) continue;\n if (spec.meta.version > maxVersion) {\n maxVersion = spec.meta.version;\n latest = spec;\n }\n }\n return latest;\n }\n\n getByCategory(category: IntegrationCategory): IntegrationSpec[] {\n return this.list().filter((spec) => spec.meta.category === category);\n }\n}\n\nexport function makeIntegrationSpecKey(meta: IntegrationMeta) {\n return integrationKey(meta);\n}\n"],"mappings":"AAwFA,MAAM,EAAkB,GACtB,GAAG,EAAK,IAAI,IAAI,EAAK,UAEvB,IAAa,EAAb,KAAqC,CACnC,MAAyB,IAAI,IAE7B,SAAS,EAA6B,CACpC,IAAM,EAAM,EAAe,EAAK,KAAK,CACrC,GAAI,KAAK,MAAM,IAAI,EAAI,CACrB,MAAU,MAAM,6BAA6B,IAAM,CAGrD,OADA,KAAK,MAAM,IAAI,EAAK,EAAK,CAClB,KAGT,MAA0B,CACxB,MAAO,CAAC,GAAG,KAAK,MAAM,QAAQ,CAAC,CAGjC,IAAI,EAAa,EAA+C,CAC9D,GAAI,GAAW,KACb,OAAO,KAAK,MAAM,IAAI,EAAe,CAAE,MAAK,UAAS,CAAC,CAAC,CAEzD,IAAIA,EACA,EAAa,KACjB,IAAK,IAAM,KAAQ,KAAK,MAAM,QAAQ,CAChC,EAAK,KAAK,MAAQ,GAClB,EAAK,KAAK,QAAU,IACtB,EAAa,EAAK,KAAK,QACvB,EAAS,GAGb,OAAO,EAGT,cAAc,EAAkD,CAC9D,OAAO,KAAK,MAAM,CAAC,OAAQ,GAAS,EAAK,KAAK,WAAa,EAAS,GAIxE,SAAgB,EAAuB,EAAuB,CAC5D,OAAO,EAAe,EAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcp-cloud-tasks.js","names":["options: GcpCloudTasksQueueOptions"],"sources":["../../src/jobs/gcp-cloud-tasks.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\n\nimport type { EnqueueOptions, Job, JobHandler, JobQueue } from './queue';\n\ninterface CloudTasksClientLike {\n createTask(request: {\n parent: string;\n task: {\n httpRequest: {\n httpMethod: number | string;\n url: string;\n body: Buffer;\n headers?: Record<string, string>;\n oidcToken?: { serviceAccountEmail: string };\n };\n scheduleTime?: { seconds: number };\n };\n }): Promise<unknown>;\n}\n\nexport interface GcpCloudTasksQueueOptions {\n client: CloudTasksClientLike;\n projectId: string;\n location: string;\n queue: string;\n resolveUrl(jobType: string): string;\n serviceAccountEmail?: string;\n}\n\nexport class GcpCloudTasksQueue implements JobQueue {\n private readonly handlers = new Map<string, JobHandler>();\n\n constructor(private readonly options: GcpCloudTasksQueueOptions) {}\n\n async enqueue<TPayload>(\n jobType: string,\n payload: TPayload,\n options: EnqueueOptions = {}\n ): Promise<Job<TPayload>> {\n const enqueueTime =\n options.delaySeconds != null\n ? { seconds: Math.floor(Date.now() / 1000) + options.delaySeconds }\n : undefined;\n const body = Buffer.from(\n JSON.stringify({\n id: randomUUID(),\n type: jobType,\n payload,\n }),\n 'utf-8'\n );\n await this.options.client.createTask({\n parent: `projects/${this.options.projectId}/locations/${this.options.location}/queues/${this.options.queue}`,\n task: {\n httpRequest: {\n httpMethod: 'POST',\n url: this.options.resolveUrl(jobType),\n body,\n headers: { 'Content-Type': 'application/json' },\n oidcToken: this.options.serviceAccountEmail\n ? { serviceAccountEmail: this.options.serviceAccountEmail }\n : undefined,\n },\n scheduleTime: enqueueTime,\n },\n });\n\n return {\n id: randomUUID(),\n type: jobType,\n payload,\n status: 'pending',\n attempts: 0,\n createdAt: new Date(),\n updatedAt: new Date(),\n };\n }\n\n register<TPayload>(jobType: string, handler: JobHandler<TPayload>): void {\n this.handlers.set(jobType, handler as JobHandler);\n }\n\n start(): void {\n // Execution is handled by Cloud Tasks via HTTP callbacks.\n }\n\n async stop(): Promise<void> {\n this.handlers.clear();\n }\n}\n
|
|
1
|
+
{"version":3,"file":"gcp-cloud-tasks.js","names":["options: GcpCloudTasksQueueOptions"],"sources":["../../src/jobs/gcp-cloud-tasks.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\n\nimport type { EnqueueOptions, Job, JobHandler, JobQueue } from './queue';\n\ninterface CloudTasksClientLike {\n createTask(request: {\n parent: string;\n task: {\n httpRequest: {\n httpMethod: number | string;\n url: string;\n body: Buffer;\n headers?: Record<string, string>;\n oidcToken?: { serviceAccountEmail: string };\n };\n scheduleTime?: { seconds: number };\n };\n }): Promise<unknown>;\n}\n\nexport interface GcpCloudTasksQueueOptions {\n client: CloudTasksClientLike;\n projectId: string;\n location: string;\n queue: string;\n resolveUrl(jobType: string): string;\n serviceAccountEmail?: string;\n}\n\nexport class GcpCloudTasksQueue implements JobQueue {\n private readonly handlers = new Map<string, JobHandler>();\n\n constructor(private readonly options: GcpCloudTasksQueueOptions) {}\n\n async enqueue<TPayload>(\n jobType: string,\n payload: TPayload,\n options: EnqueueOptions = {}\n ): Promise<Job<TPayload>> {\n const enqueueTime =\n options.delaySeconds != null\n ? { seconds: Math.floor(Date.now() / 1000) + options.delaySeconds }\n : undefined;\n const body = Buffer.from(\n JSON.stringify({\n id: randomUUID(),\n type: jobType,\n payload,\n }),\n 'utf-8'\n );\n await this.options.client.createTask({\n parent: `projects/${this.options.projectId}/locations/${this.options.location}/queues/${this.options.queue}`,\n task: {\n httpRequest: {\n httpMethod: 'POST',\n url: this.options.resolveUrl(jobType),\n body,\n headers: { 'Content-Type': 'application/json' },\n oidcToken: this.options.serviceAccountEmail\n ? { serviceAccountEmail: this.options.serviceAccountEmail }\n : undefined,\n },\n scheduleTime: enqueueTime,\n },\n });\n\n return {\n id: randomUUID(),\n type: jobType,\n payload,\n status: 'pending',\n attempts: 0,\n createdAt: new Date(),\n updatedAt: new Date(),\n };\n }\n\n register<TPayload>(jobType: string, handler: JobHandler<TPayload>): void {\n this.handlers.set(jobType, handler as JobHandler);\n }\n\n start(): void {\n // Execution is handled by Cloud Tasks via HTTP callbacks.\n }\n\n async stop(): Promise<void> {\n this.handlers.clear();\n }\n}\n"],"mappings":"yCA6BA,IAAa,EAAb,KAAoD,CAClD,SAA4B,IAAI,IAEhC,YAAY,EAAqD,CAApC,KAAA,QAAA,EAE7B,MAAM,QACJ,EACA,EACA,EAA0B,EAAE,CACJ,CACxB,IAAM,EACJ,EAAQ,cAAgB,KAEpB,IAAA,GADA,CAAE,QAAS,KAAK,MAAM,KAAK,KAAK,CAAG,IAAK,CAAG,EAAQ,aAAc,CAEjE,EAAO,OAAO,KAClB,KAAK,UAAU,CACb,GAAI,GAAY,CAChB,KAAM,EACN,UACD,CAAC,CACF,QACD,CAiBD,OAhBA,MAAM,KAAK,QAAQ,OAAO,WAAW,CACnC,OAAQ,YAAY,KAAK,QAAQ,UAAU,aAAa,KAAK,QAAQ,SAAS,UAAU,KAAK,QAAQ,QACrG,KAAM,CACJ,YAAa,CACX,WAAY,OACZ,IAAK,KAAK,QAAQ,WAAW,EAAQ,CACrC,OACA,QAAS,CAAE,eAAgB,mBAAoB,CAC/C,UAAW,KAAK,QAAQ,oBACpB,CAAE,oBAAqB,KAAK,QAAQ,oBAAqB,CACzD,IAAA,GACL,CACD,aAAc,EACf,CACF,CAAC,CAEK,CACL,GAAI,GAAY,CAChB,KAAM,EACN,UACA,OAAQ,UACR,SAAU,EACV,UAAW,IAAI,KACf,UAAW,IAAI,KAChB,CAGH,SAAmB,EAAiB,EAAqC,CACvE,KAAK,SAAS,IAAI,EAAS,EAAsB,CAGnD,OAAc,EAId,MAAM,MAAsB,CAC1B,KAAK,SAAS,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcp-pubsub.d.ts","names":[],"sources":["../../src/jobs/gcp-pubsub.ts"],"sourcesContent":[],"mappings":";;;UAIU,gBAAA;;IAAA,cAAA,CAAgB,OAAA,EAAA;MAMT,IAAA,EAJmB,MAInB;IAKJ,CAAA,CAAA,EATkC,OASlC,CAAA,MAAe,CAAA;EAGY,CAAA;;AAK1B,UAbG,qBAAA,CAaH;EACG,MAAA,EAbP,gBAaO;EAAJ,SAAA,EAAA,MAAA;;
|
|
1
|
+
{"version":3,"file":"gcp-pubsub.d.ts","names":[],"sources":["../../src/jobs/gcp-pubsub.ts"],"sourcesContent":[],"mappings":";;;UAIU,gBAAA;;IAAA,cAAA,CAAgB,OAAA,EAAA;MAMT,IAAA,EAJmB,MAInB;IAKJ,CAAA,CAAA,EATkC,OASlC,CAAA,MAAe,CAAA;EAGY,CAAA;;AAK1B,UAbG,qBAAA,CAaH;EACG,MAAA,EAbP,gBAaO;EAAJ,SAAA,EAAA,MAAA;;AAuB6C,cAhC7C,cAAA,YAA0B,QAgCmB,CAAA;EAAX,iBAAA,OAAA;EAQ/B,iBAAA,QAAA;EAxCuB,WAAA,CAAA,OAAA,EAGC,qBAHD;EAAQ,OAAA,CAAA,QAAA,CAAA,CAAA,OAAA,EAAA,MAAA,EAAA,OAAA,EAOlC,QAPkC,EAAA,QAAA,CAAA,EAQjC,cARiC,CAAA,EAS1C,OAT0C,CASlC,GATkC,CAS9B,QAT8B,CAAA,CAAA;+CAgCA,WAAW;;UAQ1C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcp-pubsub.js","names":["options: GcpPubSubQueueOptions"],"sources":["../../src/jobs/gcp-pubsub.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\n\nimport type { EnqueueOptions, Job, JobHandler, JobQueue } from './queue';\n\ninterface PubSubClientLike {\n topic(name: string): {\n publishMessage(message: { data: Buffer }): Promise<string>;\n };\n}\n\nexport interface GcpPubSubQueueOptions {\n client: PubSubClientLike;\n topicName: string;\n}\n\nexport class GcpPubSubQueue implements JobQueue {\n private readonly handlers = new Map<string, JobHandler>();\n\n constructor(private readonly options: GcpPubSubQueueOptions) {}\n\n async enqueue<TPayload>(\n jobType: string,\n payload: TPayload,\n _options: EnqueueOptions = {}\n ): Promise<Job<TPayload>> {\n await this.options.client
|
|
1
|
+
{"version":3,"file":"gcp-pubsub.js","names":["options: GcpPubSubQueueOptions"],"sources":["../../src/jobs/gcp-pubsub.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\n\nimport type { EnqueueOptions, Job, JobHandler, JobQueue } from './queue';\n\ninterface PubSubClientLike {\n topic(name: string): {\n publishMessage(message: { data: Buffer }): Promise<string>;\n };\n}\n\nexport interface GcpPubSubQueueOptions {\n client: PubSubClientLike;\n topicName: string;\n}\n\nexport class GcpPubSubQueue implements JobQueue {\n private readonly handlers = new Map<string, JobHandler>();\n\n constructor(private readonly options: GcpPubSubQueueOptions) {}\n\n async enqueue<TPayload>(\n jobType: string,\n payload: TPayload,\n _options: EnqueueOptions = {}\n ): Promise<Job<TPayload>> {\n await this.options.client.topic(this.options.topicName).publishMessage({\n data: Buffer.from(\n JSON.stringify({\n id: randomUUID(),\n type: jobType,\n payload,\n }),\n 'utf-8'\n ),\n });\n\n return {\n id: randomUUID(),\n type: jobType,\n payload,\n status: 'pending',\n attempts: 0,\n createdAt: new Date(),\n updatedAt: new Date(),\n };\n }\n\n register<TPayload>(jobType: string, handler: JobHandler<TPayload>): void {\n this.handlers.set(jobType, handler as JobHandler);\n }\n\n start(): void {\n // Message consumption handled externally via Pub/Sub subscription.\n }\n\n async stop(): Promise<void> {\n this.handlers.clear();\n }\n}\n"],"mappings":"yCAeA,IAAa,EAAb,KAAgD,CAC9C,SAA4B,IAAI,IAEhC,YAAY,EAAiD,CAAhC,KAAA,QAAA,EAE7B,MAAM,QACJ,EACA,EACA,EAA2B,EAAE,CACL,CAYxB,OAXA,MAAM,KAAK,QAAQ,OAAO,MAAM,KAAK,QAAQ,UAAU,CAAC,eAAe,CACrE,KAAM,OAAO,KACX,KAAK,UAAU,CACb,GAAI,GAAY,CAChB,KAAM,EACN,UACD,CAAC,CACF,QACD,CACF,CAAC,CAEK,CACL,GAAI,GAAY,CAChB,KAAM,EACN,UACA,OAAQ,UACR,SAAU,EACV,UAAW,IAAI,KACf,UAAW,IAAI,KAChB,CAGH,SAAmB,EAAiB,EAAqC,CACvE,KAAK,SAAS,IAAI,EAAS,EAAsB,CAGnD,OAAc,EAId,MAAM,MAAsB,CAC1B,KAAK,SAAS,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gmail-sync-handler.js","names":[],"sources":["../../../src/jobs/handlers/gmail-sync-handler.ts"],"sourcesContent":["import type { JobHandler } from '../queue';\nimport type { GmailIngestionAdapter } from '../../knowledge/ingestion/gmail-adapter';\nimport type { EmailThreadListQuery } from '../../integrations/providers/email';\n\nexport interface GmailSyncJobPayload extends EmailThreadListQuery {}\n\nexport function createGmailSyncHandler(\n adapter: GmailIngestionAdapter\n): JobHandler<GmailSyncJobPayload> {\n return async (job) => {\n await adapter.syncThreads(job.payload);\n };\n}\n
|
|
1
|
+
{"version":3,"file":"gmail-sync-handler.js","names":[],"sources":["../../../src/jobs/handlers/gmail-sync-handler.ts"],"sourcesContent":["import type { JobHandler } from '../queue';\nimport type { GmailIngestionAdapter } from '../../knowledge/ingestion/gmail-adapter';\nimport type { EmailThreadListQuery } from '../../integrations/providers/email';\n\nexport interface GmailSyncJobPayload extends EmailThreadListQuery {}\n\nexport function createGmailSyncHandler(\n adapter: GmailIngestionAdapter\n): JobHandler<GmailSyncJobPayload> {\n return async (job) => {\n await adapter.syncThreads(job.payload);\n };\n}\n"],"mappings":"AAMA,SAAgB,EACd,EACiC,CACjC,OAAO,KAAO,IAAQ,CACpB,MAAM,EAAQ,YAAY,EAAI,QAAQ"}
|