@lssm/lib.contracts 1.7.4 → 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 +50 -50
- package/dist/app-config/contracts.d.ts.map +1 -1
- package/dist/app-config/contracts.js.map +1 -1
- package/dist/app-config/events.d.ts +27 -27
- package/dist/app-config/events.d.ts.map +1 -1
- package/dist/app-config/events.js.map +1 -1
- package/dist/app-config/lifecycle-contracts.d.ts +80 -80
- package/dist/app-config/lifecycle-contracts.d.ts.map +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/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/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/index.d.ts +4 -3
- package/dist/index.js +1 -1
- package/dist/install.d.ts.map +1 -1
- package/dist/integrations/connection.d.ts.map +1 -1
- package/dist/integrations/contracts.d.ts.map +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 +66 -66
- package/dist/integrations/openbanking/contracts/accounts.d.ts.map +1 -1
- package/dist/integrations/openbanking/contracts/accounts.js.map +1 -1
- package/dist/integrations/openbanking/contracts/balances.d.ts +34 -34
- package/dist/integrations/openbanking/contracts/balances.d.ts.map +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 +48 -48
- package/dist/integrations/openbanking/contracts/transactions.d.ts.map +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 +55 -55
- package/dist/integrations/openbanking/models.d.ts.map +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/knowledge/contracts.d.ts +66 -66
- package/dist/knowledge/contracts.d.ts.map +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 +29 -29
- package/dist/onboarding-base.d.ts.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/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 +36 -9
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +1 -1
- package/dist/registry.js.map +1 -1
- package/dist/resources.d.ts.map +1 -1
- package/dist/schema/dist/FieldType.js +1 -1
- package/dist/schema/dist/FieldType.js.map +1 -1
- package/dist/schema/dist/ScalarTypeEnum.js +1 -1
- package/dist/schema/dist/ScalarTypeEnum.js.map +1 -1
- package/dist/schema/dist/index.js +1 -1
- 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/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 +22 -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.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 +15 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","names":["SchemaModel","ScalarTypeEnum"],"sources":["../../../src/integrations/openbanking/models.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"models.js","names":["SchemaModel","ScalarTypeEnum"],"sources":["../../../src/integrations/openbanking/models.ts"],"sourcesContent":["import { ScalarTypeEnum, SchemaModel } from '@lssm/lib.schema';\n\nexport const BankAccountRecord = new SchemaModel({\n name: 'BankAccountRecord',\n description:\n 'Canonical representation of a bank account synced from an open banking provider.',\n fields: {\n id: { type: ScalarTypeEnum.ID(), isOptional: false },\n tenantId: { type: ScalarTypeEnum.ID(), isOptional: false },\n userId: { type: ScalarTypeEnum.ID(), isOptional: false },\n connectionId: { type: ScalarTypeEnum.ID(), isOptional: false },\n externalId: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n institutionId: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n institutionName: {\n type: ScalarTypeEnum.NonEmptyString(),\n isOptional: false,\n },\n institutionLogoUrl: { type: ScalarTypeEnum.URL(), isOptional: true },\n iban: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n bic: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n accountType: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n currency: { type: ScalarTypeEnum.Currency(), isOptional: false },\n displayName: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n accountNumberMasked: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n productCode: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n balance: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n availableBalance: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: true,\n },\n lastSyncedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n },\n});\n\nexport const BankTransactionRecord = new SchemaModel({\n name: 'BankTransactionRecord',\n description:\n 'Canonical transaction entry mapped from Powens into the open banking ledger.',\n fields: {\n id: { type: ScalarTypeEnum.ID(), isOptional: false },\n accountId: { type: ScalarTypeEnum.ID(), isOptional: false },\n tenantId: { type: ScalarTypeEnum.ID(), isOptional: false },\n connectionId: { type: ScalarTypeEnum.ID(), isOptional: false },\n externalId: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n amount: { type: ScalarTypeEnum.Float_unsecure(), isOptional: false },\n currency: { type: ScalarTypeEnum.Currency(), isOptional: false },\n date: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n bookingDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n valueDate: { type: ScalarTypeEnum.DateTime(), isOptional: true },\n description: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n counterpartyName: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n counterpartyAccount: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n merchantCategoryCode: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n rawCategory: { type: ScalarTypeEnum.String_unsecure(), isOptional: true },\n standardizedCategory: {\n type: ScalarTypeEnum.String_unsecure(),\n isOptional: true,\n },\n transactionType: {\n type: ScalarTypeEnum.NonEmptyString(),\n isOptional: false,\n },\n status: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n runningBalance: { type: ScalarTypeEnum.Float_unsecure(), isOptional: true },\n metadata: { type: ScalarTypeEnum.JSONObject(), isOptional: true },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n updatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n },\n});\n\nexport const AccountBalanceRecord = new SchemaModel({\n name: 'AccountBalanceRecord',\n description:\n 'Canonical balance snapshot computed from Powens balance payloads.',\n fields: {\n id: { type: ScalarTypeEnum.ID(), isOptional: false },\n accountId: { type: ScalarTypeEnum.ID(), isOptional: false },\n tenantId: { type: ScalarTypeEnum.ID(), isOptional: false },\n connectionId: { type: ScalarTypeEnum.ID(), isOptional: false },\n balanceType: { type: ScalarTypeEnum.NonEmptyString(), isOptional: false },\n currentBalance: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: false,\n },\n availableBalance: {\n type: ScalarTypeEnum.Float_unsecure(),\n isOptional: true,\n },\n currency: { type: ScalarTypeEnum.Currency(), isOptional: false },\n lastUpdatedAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n createdAt: { type: ScalarTypeEnum.DateTime(), isOptional: false },\n metadata: { type: ScalarTypeEnum.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AC3E,SAAU,CAAE,KAAMA,EAAe,YAAY,CAAE,WAAY,GAAM,CACjE,UAAW,CAAE,KAAMA,EAAe,UAAU,CAAE,WAAY,GAAO,CACjE,UAAW,CAAE,KAAMA,EAAe,UAAU,CAAE,WAAY,GAAO,CAClE,CACF,CAAC,CAEW,EAAuB,IAAID,EAAY,CAClD,KAAM,uBACN,YACE,oEACF,OAAQ,CACN,GAAI,CAAE,KAAMC,EAAe,IAAI,CAAE,WAAY,GAAO,CACpD,UAAW,CAAE,KAAMA,EAAe,IAAI,CAAE,WAAY,GAAO,CAC3D,SAAU,CAAE,KAAMA,EAAe,IAAI,CAAE,WAAY,GAAO,CAC1D,aAAc,CAAE,KAAMA,EAAe,IAAI,CAAE,WAAY,GAAO,CAC9D,YAAa,CAAE,KAAMA,EAAe,gBAAgB,CAAE,WAAY,GAAO,CACzE,eAAgB,CACd,KAAMA,EAAe,gBAAgB,CACrC,WAAY,GACb,CACD,iBAAkB,CAChB,KAAMA,EAAe,gBAAgB,CACrC,WAAY,GACb,CACD,SAAU,CAAE,KAAMA,EAAe,UAAU,CAAE,WAAY,GAAO,CAChE,cAAe,CAAE,KAAMA,EAAe,UAAU,CAAE,WAAY,GAAO,CACrE,UAAW,CAAE,KAAMA,EAAe,UAAU,CAAE,WAAY,GAAO,CACjE,SAAU,CAAE,KAAMA,EAAe,YAAY,CAAE,WAAY,GAAM,CAClE,CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"telemetry.js","names":["redacted: Record<string, unknown>"],"sources":["../../../src/integrations/openbanking/telemetry.ts"],"sourcesContent":["export const OPENBANKING_PII_FIELDS = [\n 'iban',\n 'bic',\n 'accountNumberMasked',\n 'accountNumber',\n 'counterpartyName',\n 'counterpartyAccount',\n 'description',\n 'merchantName',\n 'merchantCategoryCode',\n 'reference',\n] as const;\n\nexport const OPENBANKING_TELEMETRY_EVENTS = {\n accountsSynced: 'openbanking.accounts.synced',\n accountsSyncFailed: 'openbanking.accounts.sync_failed',\n transactionsSynced: 'openbanking.transactions.synced',\n transactionsSyncFailed: 'openbanking.transactions.sync_failed',\n balancesRefreshed: 'openbanking.balances.refreshed',\n balancesRefreshFailed: 'openbanking.balances.refresh_failed',\n overviewGenerated: 'openbanking.overview.generated',\n} as const;\n\nexport type OpenBankingTelemetryEvent =\n (typeof OPENBANKING_TELEMETRY_EVENTS)[keyof typeof OPENBANKING_TELEMETRY_EVENTS];\n\nexport function redactOpenBankingTelemetryPayload<\n T extends Record<string, unknown
|
|
1
|
+
{"version":3,"file":"telemetry.js","names":["redacted: Record<string, unknown>"],"sources":["../../../src/integrations/openbanking/telemetry.ts"],"sourcesContent":["export const OPENBANKING_PII_FIELDS = [\n 'iban',\n 'bic',\n 'accountNumberMasked',\n 'accountNumber',\n 'counterpartyName',\n 'counterpartyAccount',\n 'description',\n 'merchantName',\n 'merchantCategoryCode',\n 'reference',\n] as const;\n\nexport const OPENBANKING_TELEMETRY_EVENTS = {\n accountsSynced: 'openbanking.accounts.synced',\n accountsSyncFailed: 'openbanking.accounts.sync_failed',\n transactionsSynced: 'openbanking.transactions.synced',\n transactionsSyncFailed: 'openbanking.transactions.sync_failed',\n balancesRefreshed: 'openbanking.balances.refreshed',\n balancesRefreshFailed: 'openbanking.balances.refresh_failed',\n overviewGenerated: 'openbanking.overview.generated',\n} as const;\n\nexport type OpenBankingTelemetryEvent =\n (typeof OPENBANKING_TELEMETRY_EVENTS)[keyof typeof OPENBANKING_TELEMETRY_EVENTS];\n\nexport function redactOpenBankingTelemetryPayload<\n T extends Record<string, unknown>,\n>(payload: T): T {\n const redacted: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(payload)) {\n if (\n OPENBANKING_PII_FIELDS.includes(\n key as (typeof OPENBANKING_PII_FIELDS)[number]\n )\n ) {\n redacted[key] = maskValue(value);\n } else if (Array.isArray(value)) {\n redacted[key] = value.map((item) =>\n typeof item === 'object' && item !== null\n ? redactOpenBankingTelemetryPayload(item as Record<string, unknown>)\n : item\n );\n } else if (typeof value === 'object' && value !== null) {\n redacted[key] = redactOpenBankingTelemetryPayload(\n value as Record<string, unknown>\n );\n } else {\n redacted[key] = value;\n }\n }\n return redacted as T;\n}\n\nfunction maskValue(value: unknown): string {\n if (value == null) return '';\n const str = String(value);\n if (str.length <= 4) return '*'.repeat(str.length);\n return `${'*'.repeat(Math.max(str.length - 4, 0))}${str.slice(-4)}`;\n}\n"],"mappings":"AAAA,MAAa,EAAyB,CACpC,OACA,MACA,sBACA,gBACA,mBACA,sBACA,cACA,eACA,uBACA,YACD,CAEY,EAA+B,CAC1C,eAAgB,8BAChB,mBAAoB,mCACpB,mBAAoB,kCACpB,uBAAwB,uCACxB,kBAAmB,iCACnB,sBAAuB,sCACvB,kBAAmB,iCACpB,CAKD,SAAgB,EAEd,EAAe,CACf,IAAMA,EAAoC,EAAE,CAC5C,IAAK,GAAM,CAAC,EAAK,KAAU,OAAO,QAAQ,EAAQ,CAE9C,EAAuB,SACrB,EACD,CAED,EAAS,GAAO,EAAU,EAAM,CACvB,MAAM,QAAQ,EAAM,CAC7B,EAAS,GAAO,EAAM,IAAK,GACzB,OAAO,GAAS,UAAY,EACxB,EAAkC,EAAgC,CAClE,EACL,CACQ,OAAO,GAAU,UAAY,EACtC,EAAS,GAAO,EACd,EACD,CAED,EAAS,GAAO,EAGpB,OAAO,EAGT,SAAS,EAAU,EAAwB,CACzC,GAAI,GAAS,KAAM,MAAO,GAC1B,IAAM,EAAM,OAAO,EAAM,CAEzB,OADI,EAAI,QAAU,EAAU,IAAI,OAAO,EAAI,OAAO,CAC3C,GAAG,IAAI,OAAO,KAAK,IAAI,EAAI,OAAS,EAAG,EAAE,CAAC,GAAG,EAAI,MAAM,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elevenlabs.d.ts","names":[],"sources":["../../../src/integrations/providers/elevenlabs.ts"],"sourcesContent":[],"mappings":";;;cAGa,2BAA2B;
|
|
1
|
+
{"version":3,"file":"elevenlabs.d.ts","names":[],"sources":["../../../src/integrations/providers/elevenlabs.ts"],"sourcesContent":[],"mappings":";;;cAGa,2BAA2B;iBAgExB,6BAAA,WACJ,0BACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elevenlabs.js","names":["elevenLabsIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/elevenlabs.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec, IntegrationSpecRegistry } from '../spec';\n\nexport const elevenLabsIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'ai-voice.elevenlabs',\n version: 1,\n category: 'ai-voice',\n displayName: 'ElevenLabs Voice',\n title: 'ElevenLabs Text-to-Speech',\n description:\n 'ElevenLabs integration for neural voice synthesis and voice catalog access.',\n domain: 'ai',\n owners: ['platform.ai'],\n tags: ['voice', 'tts'],\n stability: StabilityEnum.Beta,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [{ key: 'ai.voice.synthesis', version: 1 }],\n },\n configSchema: {\n schema: {\n type: 'object',\n properties: {\n defaultVoiceId: {\n type: 'string',\n description
|
|
1
|
+
{"version":3,"file":"elevenlabs.js","names":["elevenLabsIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/elevenlabs.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec, IntegrationSpecRegistry } from '../spec';\n\nexport const elevenLabsIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'ai-voice.elevenlabs',\n version: 1,\n category: 'ai-voice',\n displayName: 'ElevenLabs Voice',\n title: 'ElevenLabs Text-to-Speech',\n description:\n 'ElevenLabs integration for neural voice synthesis and voice catalog access.',\n domain: 'ai',\n owners: ['platform.ai'],\n tags: ['voice', 'tts'],\n stability: StabilityEnum.Beta,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [{ key: 'ai.voice.synthesis', version: 1 }],\n },\n configSchema: {\n schema: {\n type: 'object',\n properties: {\n defaultVoiceId: {\n type: 'string',\n description:\n 'Optional default voice identifier for synthesis requests.',\n },\n },\n },\n example: {\n defaultVoiceId: 'pNInz6obpgDQGcFmaJgB',\n },\n },\n secretSchema: {\n schema: {\n type: 'object',\n required: ['apiKey'],\n properties: {\n apiKey: {\n type: 'string',\n description: 'ElevenLabs API key with text-to-speech permissions.',\n },\n },\n },\n example: {\n apiKey: 'eleven-***',\n },\n },\n healthCheck: {\n method: 'custom',\n timeoutMs: 4000,\n },\n docsUrl: 'https://elevenlabs.io/docs/api-reference/text-to-speech',\n constraints: {\n rateLimit: {\n rpm: 120,\n },\n },\n byokSetup: {\n setupInstructions:\n 'Create an ElevenLabs API key and ensure the desired voices are accessible to the key scope.',\n },\n};\n\nexport function registerElevenLabsIntegration(\n registry: IntegrationSpecRegistry\n): IntegrationSpecRegistry {\n return registry.register(elevenLabsIntegrationSpec);\n}\n"],"mappings":"mDAGA,MAAaA,EAA6C,CACxD,KAAM,CACJ,IAAK,sBACL,QAAS,EACT,SAAU,WACV,YAAa,mBACb,MAAO,4BACP,YACE,8EACF,OAAQ,KACR,OAAQ,CAAC,cAAc,CACvB,KAAM,CAAC,QAAS,MAAM,CACtB,UAAW,EAAc,KAC1B,CACD,eAAgB,CAAC,UAAW,OAAO,CACnC,aAAc,CACZ,SAAU,CAAC,CAAE,IAAK,qBAAsB,QAAS,EAAG,CAAC,CACtD,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,WAAY,CACV,eAAgB,CACd,KAAM,SACN,YACE,4DACH,CACF,CACF,CACD,QAAS,CACP,eAAgB,uBACjB,CACF,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,SAAU,CAAC,SAAS,CACpB,WAAY,CACV,OAAQ,CACN,KAAM,SACN,YAAa,sDACd,CACF,CACF,CACD,QAAS,CACP,OAAQ,aACT,CACF,CACD,YAAa,CACX,OAAQ,SACR,UAAW,IACZ,CACD,QAAS,0DACT,YAAa,CACX,UAAW,CACT,IAAK,IACN,CACF,CACD,UAAW,CACT,kBACE,8FACH,CACF,CAED,SAAgB,EACd,EACyB,CACzB,OAAO,EAAS,SAAS,EAA0B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcs-storage.js","names":["gcsStorageIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/gcs-storage.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec, IntegrationSpecRegistry } from '../spec';\n\nexport const gcsStorageIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'storage.gcs',\n version: 1,\n category: 'storage',\n displayName: 'Google Cloud Storage',\n title: 'Google Cloud Storage Buckets',\n description:\n 'Google Cloud Storage integration for object storage and retrieval.',\n domain: 'infrastructure',\n owners: ['platform.infrastructure'],\n tags: ['storage', 'gcs', 'google-cloud'],\n stability: StabilityEnum.Beta,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [{ key: 'storage.objects', version: 1 }],\n },\n configSchema: {\n schema: {\n type: 'object',\n required: ['bucket'],\n properties: {\n bucket: {\n type: 'string',\n description: 'Primary bucket name used for storing objects.',\n },\n prefix: {\n type: 'string',\n description: 'Optional prefix applied to object keys.',\n },\n },\n },\n example: {\n bucket: 'pfo-tenant-assets',\n prefix: 'documents/',\n },\n },\n secretSchema: {\n schema: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n description:\n 'Service account type field from Google credentials JSON (if provided).',\n },\n client_email: { type: 'string' },\n private_key: { type: 'string' },\n project_id: { type: 'string' },\n },\n },\n example: {\n type: 'service_account',\n client_email: 'svc-account@example.iam.gserviceaccount.com',\n private_key: '-----BEGIN PRIVATE KEY-----...',\n project_id: 'example-project',\n },\n },\n healthCheck: {\n method: 'ping',\n timeoutMs: 4000,\n },\n docsUrl: 'https://cloud.google.com/storage/docs/apis',\n constraints: {\n quotas: {\n storageGb: 5120,\n },\n },\n byokSetup: {\n setupInstructions:\n 'Create a Google Cloud service account with Storage Object Admin role and upload the JSON credentials to the secret store.',\n },\n};\n\nexport function registerGcsStorageIntegration(\n registry: IntegrationSpecRegistry\n): IntegrationSpecRegistry {\n return registry.register(gcsStorageIntegrationSpec);\n}\n
|
|
1
|
+
{"version":3,"file":"gcs-storage.js","names":["gcsStorageIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/gcs-storage.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec, IntegrationSpecRegistry } from '../spec';\n\nexport const gcsStorageIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'storage.gcs',\n version: 1,\n category: 'storage',\n displayName: 'Google Cloud Storage',\n title: 'Google Cloud Storage Buckets',\n description:\n 'Google Cloud Storage integration for object storage and retrieval.',\n domain: 'infrastructure',\n owners: ['platform.infrastructure'],\n tags: ['storage', 'gcs', 'google-cloud'],\n stability: StabilityEnum.Beta,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [{ key: 'storage.objects', version: 1 }],\n },\n configSchema: {\n schema: {\n type: 'object',\n required: ['bucket'],\n properties: {\n bucket: {\n type: 'string',\n description: 'Primary bucket name used for storing objects.',\n },\n prefix: {\n type: 'string',\n description: 'Optional prefix applied to object keys.',\n },\n },\n },\n example: {\n bucket: 'pfo-tenant-assets',\n prefix: 'documents/',\n },\n },\n secretSchema: {\n schema: {\n type: 'object',\n properties: {\n type: {\n type: 'string',\n description:\n 'Service account type field from Google credentials JSON (if provided).',\n },\n client_email: { type: 'string' },\n private_key: { type: 'string' },\n project_id: { type: 'string' },\n },\n },\n example: {\n type: 'service_account',\n client_email: 'svc-account@example.iam.gserviceaccount.com',\n private_key: '-----BEGIN PRIVATE KEY-----...',\n project_id: 'example-project',\n },\n },\n healthCheck: {\n method: 'ping',\n timeoutMs: 4000,\n },\n docsUrl: 'https://cloud.google.com/storage/docs/apis',\n constraints: {\n quotas: {\n storageGb: 5120,\n },\n },\n byokSetup: {\n setupInstructions:\n 'Create a Google Cloud service account with Storage Object Admin role and upload the JSON credentials to the secret store.',\n },\n};\n\nexport function registerGcsStorageIntegration(\n registry: IntegrationSpecRegistry\n): IntegrationSpecRegistry {\n return registry.register(gcsStorageIntegrationSpec);\n}\n"],"mappings":"mDAGA,MAAaA,EAA6C,CACxD,KAAM,CACJ,IAAK,cACL,QAAS,EACT,SAAU,UACV,YAAa,uBACb,MAAO,+BACP,YACE,qEACF,OAAQ,iBACR,OAAQ,CAAC,0BAA0B,CACnC,KAAM,CAAC,UAAW,MAAO,eAAe,CACxC,UAAW,EAAc,KAC1B,CACD,eAAgB,CAAC,UAAW,OAAO,CACnC,aAAc,CACZ,SAAU,CAAC,CAAE,IAAK,kBAAmB,QAAS,EAAG,CAAC,CACnD,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,SAAU,CAAC,SAAS,CACpB,WAAY,CACV,OAAQ,CACN,KAAM,SACN,YAAa,gDACd,CACD,OAAQ,CACN,KAAM,SACN,YAAa,0CACd,CACF,CACF,CACD,QAAS,CACP,OAAQ,oBACR,OAAQ,aACT,CACF,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,WAAY,CACV,KAAM,CACJ,KAAM,SACN,YACE,yEACH,CACD,aAAc,CAAE,KAAM,SAAU,CAChC,YAAa,CAAE,KAAM,SAAU,CAC/B,WAAY,CAAE,KAAM,SAAU,CAC/B,CACF,CACD,QAAS,CACP,KAAM,kBACN,aAAc,8CACd,YAAa,iCACb,WAAY,kBACb,CACF,CACD,YAAa,CACX,OAAQ,OACR,UAAW,IACZ,CACD,QAAS,6CACT,YAAa,CACX,OAAQ,CACN,UAAW,KACZ,CACF,CACD,UAAW,CACT,kBACE,4HACH,CACF,CAED,SAAgB,EACd,EACyB,CACzB,OAAO,EAAS,SAAS,EAA0B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gmail.d.ts","names":[],"sources":["../../../src/integrations/providers/gmail.ts"],"sourcesContent":[],"mappings":";;;cAGa,sBAAsB;
|
|
1
|
+
{"version":3,"file":"gmail.d.ts","names":[],"sources":["../../../src/integrations/providers/gmail.ts"],"sourcesContent":[],"mappings":";;;cAGa,sBAAsB;iBAuFnB,wBAAA,WACJ,0BACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gmail.js","names":["gmailIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/gmail.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec, IntegrationSpecRegistry } from '../spec';\n\nexport const gmailIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'email.gmail',\n version: 1,\n category: 'email',\n displayName: 'Gmail API',\n title: 'Google Gmail API',\n description:\n 'Gmail integration supporting inbound thread ingestion and outbound transactional email.',\n domain: 'communications',\n owners: ['platform.messaging'],\n tags: ['email', 'gmail'],\n stability: StabilityEnum.Beta,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [\n { key: 'email.inbound', version: 1 },\n { key: 'email.outbound', version: 1 },\n ],\n },\n configSchema: {\n schema: {\n type: 'object',\n properties: {\n labelIds: {\n type: 'array',\n items: { type: 'string' },\n description: 'Optional list of label IDs to scope inbound sync.',\n },\n includeSpamTrash: {\n type: 'boolean',\n description: 'Whether to include spam or trash messages during sync.',\n },\n },\n },\n example: {\n labelIds: ['INBOX'],\n includeSpamTrash: false,\n },\n },\n secretSchema: {\n schema: {\n type: 'object',\n required: ['clientId', 'clientSecret', 'refreshToken'],\n properties: {\n clientId: {\n type: 'string',\n description: 'OAuth client ID for the Google Cloud project.',\n },\n clientSecret: {\n type: 'string',\n description: 'OAuth client secret for the Google Cloud project.',\n },\n refreshToken: {\n type: 'string',\n description: 'OAuth refresh token for delegated Gmail access.',\n },\n redirectUri: {\n type: 'string',\n description
|
|
1
|
+
{"version":3,"file":"gmail.js","names":["gmailIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/gmail.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec, IntegrationSpecRegistry } from '../spec';\n\nexport const gmailIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'email.gmail',\n version: 1,\n category: 'email',\n displayName: 'Gmail API',\n title: 'Google Gmail API',\n description:\n 'Gmail integration supporting inbound thread ingestion and outbound transactional email.',\n domain: 'communications',\n owners: ['platform.messaging'],\n tags: ['email', 'gmail'],\n stability: StabilityEnum.Beta,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [\n { key: 'email.inbound', version: 1 },\n { key: 'email.outbound', version: 1 },\n ],\n },\n configSchema: {\n schema: {\n type: 'object',\n properties: {\n labelIds: {\n type: 'array',\n items: { type: 'string' },\n description: 'Optional list of label IDs to scope inbound sync.',\n },\n includeSpamTrash: {\n type: 'boolean',\n description: 'Whether to include spam or trash messages during sync.',\n },\n },\n },\n example: {\n labelIds: ['INBOX'],\n includeSpamTrash: false,\n },\n },\n secretSchema: {\n schema: {\n type: 'object',\n required: ['clientId', 'clientSecret', 'refreshToken'],\n properties: {\n clientId: {\n type: 'string',\n description: 'OAuth client ID for the Google Cloud project.',\n },\n clientSecret: {\n type: 'string',\n description: 'OAuth client secret for the Google Cloud project.',\n },\n refreshToken: {\n type: 'string',\n description: 'OAuth refresh token for delegated Gmail access.',\n },\n redirectUri: {\n type: 'string',\n description:\n 'Optional redirect URI used when issuing the refresh token.',\n },\n },\n },\n example: {\n clientId: 'xxx.apps.googleusercontent.com',\n clientSecret: 'secret',\n refreshToken: 'refresh-token',\n },\n },\n healthCheck: {\n method: 'custom',\n timeoutMs: 4000,\n },\n docsUrl: 'https://developers.google.com/gmail/api',\n constraints: {\n rateLimit: {\n rpm: 600,\n },\n },\n byokSetup: {\n setupInstructions:\n 'Create an OAuth consent screen and credentials within Google Cloud Console, then authorize the Gmail scopes and store the resulting refresh token.',\n },\n};\n\nexport function registerGmailIntegration(\n registry: IntegrationSpecRegistry\n): IntegrationSpecRegistry {\n return registry.register(gmailIntegrationSpec);\n}\n"],"mappings":"mDAGA,MAAaA,EAAwC,CACnD,KAAM,CACJ,IAAK,cACL,QAAS,EACT,SAAU,QACV,YAAa,YACb,MAAO,mBACP,YACE,0FACF,OAAQ,iBACR,OAAQ,CAAC,qBAAqB,CAC9B,KAAM,CAAC,QAAS,QAAQ,CACxB,UAAW,EAAc,KAC1B,CACD,eAAgB,CAAC,UAAW,OAAO,CACnC,aAAc,CACZ,SAAU,CACR,CAAE,IAAK,gBAAiB,QAAS,EAAG,CACpC,CAAE,IAAK,iBAAkB,QAAS,EAAG,CACtC,CACF,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,WAAY,CACV,SAAU,CACR,KAAM,QACN,MAAO,CAAE,KAAM,SAAU,CACzB,YAAa,oDACd,CACD,iBAAkB,CAChB,KAAM,UACN,YAAa,yDACd,CACF,CACF,CACD,QAAS,CACP,SAAU,CAAC,QAAQ,CACnB,iBAAkB,GACnB,CACF,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,SAAU,CAAC,WAAY,eAAgB,eAAe,CACtD,WAAY,CACV,SAAU,CACR,KAAM,SACN,YAAa,gDACd,CACD,aAAc,CACZ,KAAM,SACN,YAAa,oDACd,CACD,aAAc,CACZ,KAAM,SACN,YAAa,kDACd,CACD,YAAa,CACX,KAAM,SACN,YACE,6DACH,CACF,CACF,CACD,QAAS,CACP,SAAU,iCACV,aAAc,SACd,aAAc,gBACf,CACF,CACD,YAAa,CACX,OAAQ,SACR,UAAW,IACZ,CACD,QAAS,0CACT,YAAa,CACX,UAAW,CACT,IAAK,IACN,CACF,CACD,UAAW,CACT,kBACE,qJACH,CACF,CAED,SAAgB,EACd,EACyB,CACzB,OAAO,EAAS,SAAS,EAAqB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-calendar.js","names":["googleCalendarIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/google-calendar.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec, IntegrationSpecRegistry } from '../spec';\n\nexport const googleCalendarIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'calendar.google',\n version: 1,\n category: 'calendar',\n displayName: 'Google Calendar',\n title: 'Google Calendar API',\n description:\n 'Google Calendar integration for event creation, updates, and scheduling automations.',\n domain: 'productivity',\n owners: ['platform.messaging'],\n tags: ['calendar', 'google'],\n stability: StabilityEnum.Beta,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [{ key: 'calendar.events', version: 1 }],\n },\n configSchema: {\n schema: {\n type: 'object',\n properties: {\n calendarId: {\n type: 'string',\n description: 'Default calendar identifier (defaults to primary).',\n },\n },\n },\n example: {\n calendarId: 'primary',\n },\n },\n secretSchema: {\n schema: {\n type: 'object',\n required: ['clientEmail', 'privateKey'],\n properties: {\n clientEmail: {\n type: 'string',\n description: 'Service account client email.',\n },\n privateKey: {\n type: 'string',\n description: 'Service account private key.',\n },\n projectId: {\n type: 'string',\n description: 'Google Cloud project ID.',\n },\n },\n },\n example: {\n clientEmail: 'svc-calendar@example.iam.gserviceaccount.com',\n privateKey: '-----BEGIN PRIVATE KEY-----...',\n projectId: 'calendar-project',\n },\n },\n healthCheck: {\n method: 'custom',\n timeoutMs: 4000,\n },\n docsUrl: 'https://developers.google.com/calendar/api',\n constraints: {},\n byokSetup: {\n setupInstructions:\n 'Create a Google service account with Calendar access and share the target calendars with the service account email.',\n },\n};\n\nexport function registerGoogleCalendarIntegration(\n registry: IntegrationSpecRegistry\n): IntegrationSpecRegistry {\n return registry.register(googleCalendarIntegrationSpec);\n}\n
|
|
1
|
+
{"version":3,"file":"google-calendar.js","names":["googleCalendarIntegrationSpec: IntegrationSpec"],"sources":["../../../src/integrations/providers/google-calendar.ts"],"sourcesContent":["import { StabilityEnum } from '../../ownership';\nimport type { IntegrationSpec, IntegrationSpecRegistry } from '../spec';\n\nexport const googleCalendarIntegrationSpec: IntegrationSpec = {\n meta: {\n key: 'calendar.google',\n version: 1,\n category: 'calendar',\n displayName: 'Google Calendar',\n title: 'Google Calendar API',\n description:\n 'Google Calendar integration for event creation, updates, and scheduling automations.',\n domain: 'productivity',\n owners: ['platform.messaging'],\n tags: ['calendar', 'google'],\n stability: StabilityEnum.Beta,\n },\n supportedModes: ['managed', 'byok'],\n capabilities: {\n provides: [{ key: 'calendar.events', version: 1 }],\n },\n configSchema: {\n schema: {\n type: 'object',\n properties: {\n calendarId: {\n type: 'string',\n description: 'Default calendar identifier (defaults to primary).',\n },\n },\n },\n example: {\n calendarId: 'primary',\n },\n },\n secretSchema: {\n schema: {\n type: 'object',\n required: ['clientEmail', 'privateKey'],\n properties: {\n clientEmail: {\n type: 'string',\n description: 'Service account client email.',\n },\n privateKey: {\n type: 'string',\n description: 'Service account private key.',\n },\n projectId: {\n type: 'string',\n description: 'Google Cloud project ID.',\n },\n },\n },\n example: {\n clientEmail: 'svc-calendar@example.iam.gserviceaccount.com',\n privateKey: '-----BEGIN PRIVATE KEY-----...',\n projectId: 'calendar-project',\n },\n },\n healthCheck: {\n method: 'custom',\n timeoutMs: 4000,\n },\n docsUrl: 'https://developers.google.com/calendar/api',\n constraints: {},\n byokSetup: {\n setupInstructions:\n 'Create a Google service account with Calendar access and share the target calendars with the service account email.',\n },\n};\n\nexport function registerGoogleCalendarIntegration(\n registry: IntegrationSpecRegistry\n): IntegrationSpecRegistry {\n return registry.register(googleCalendarIntegrationSpec);\n}\n"],"mappings":"mDAGA,MAAaA,EAAiD,CAC5D,KAAM,CACJ,IAAK,kBACL,QAAS,EACT,SAAU,WACV,YAAa,kBACb,MAAO,sBACP,YACE,uFACF,OAAQ,eACR,OAAQ,CAAC,qBAAqB,CAC9B,KAAM,CAAC,WAAY,SAAS,CAC5B,UAAW,EAAc,KAC1B,CACD,eAAgB,CAAC,UAAW,OAAO,CACnC,aAAc,CACZ,SAAU,CAAC,CAAE,IAAK,kBAAmB,QAAS,EAAG,CAAC,CACnD,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,WAAY,CACV,WAAY,CACV,KAAM,SACN,YAAa,qDACd,CACF,CACF,CACD,QAAS,CACP,WAAY,UACb,CACF,CACD,aAAc,CACZ,OAAQ,CACN,KAAM,SACN,SAAU,CAAC,cAAe,aAAa,CACvC,WAAY,CACV,YAAa,CACX,KAAM,SACN,YAAa,gCACd,CACD,WAAY,CACV,KAAM,SACN,YAAa,+BACd,CACD,UAAW,CACT,KAAM,SACN,YAAa,2BACd,CACF,CACF,CACD,QAAS,CACP,YAAa,+CACb,WAAY,iCACZ,UAAW,mBACZ,CACF,CACD,YAAa,CACX,OAAQ,SACR,UAAW,IACZ,CACD,QAAS,6CACT,YAAa,EAAE,CACf,UAAW,CACT,kBACE,sHACH,CACF,CAED,SAAgB,EACd,EACyB,CACzB,OAAO,EAAS,SAAS,EAA8B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elevenlabs-voice.js","names":["FORMAT_MAP: Record<\n NonNullable<VoiceSynthesisInput['format']>,\n ElevenLabs.TextToSpeechConvertRequestOutputFormat\n>","SAMPLE_RATE: Partial<\n Record<ElevenLabs.TextToSpeechConvertRequestOutputFormat, number>\n>","chunks: Uint8Array[]"],"sources":["../../../../src/integrations/providers/impls/elevenlabs-voice.ts"],"sourcesContent":["import { ElevenLabsClient } from '@elevenlabs/elevenlabs-js';\nimport type { ElevenLabs } from '@elevenlabs/elevenlabs-js';\n\nimport type {\n Voice,\n VoiceProvider,\n VoiceSynthesisInput,\n VoiceSynthesisResult,\n} from '../voice';\n\nexport interface ElevenLabsVoiceProviderOptions {\n apiKey: string;\n defaultVoiceId?: string;\n modelId?: string;\n client?: ElevenLabsClient;\n}\n\nconst FORMAT_MAP: Record<\n NonNullable<VoiceSynthesisInput['format']>,\n ElevenLabs.TextToSpeechConvertRequestOutputFormat\n> = {\n mp3: 'mp3_44100_128',\n wav: 'pcm_44100',\n ogg: 'mp3_44100_128',\n pcm: 'pcm_16000',\n};\n\nconst SAMPLE_RATE: Partial<\n Record<ElevenLabs.TextToSpeechConvertRequestOutputFormat, number>\n> = {\n mp3_22050_32: 22050,\n mp3_44100_32: 44100,\n mp3_44100_64: 44100,\n mp3_44100_96: 44100,\n mp3_44100_128: 44100,\n mp3_44100_192: 44100,\n pcm_16000: 16000,\n pcm_22050: 22050,\n pcm_24000: 24000,\n pcm_44100: 44100,\n ulaw_8000: 8000,\n};\n\nexport class ElevenLabsVoiceProvider implements VoiceProvider {\n private readonly client: ElevenLabsClient;\n private readonly defaultVoiceId?: string;\n private readonly modelId?: string;\n\n constructor(options: ElevenLabsVoiceProviderOptions) {\n this.client =\n options.client ??\n new ElevenLabsClient({\n apiKey: options.apiKey,\n });\n this.defaultVoiceId = options.defaultVoiceId;\n this.modelId = options.modelId;\n }\n\n async listVoices(): Promise<Voice[]> {\n const response = await this.client.voices.getAll();\n return (response.voices ?? []).map((voice) => ({\n id: voice.voiceId ?? '',\n name: voice.name ?? voice.voiceId ?? '',\n description: voice.description ?? undefined,\n language: voice.labels?.language ?? undefined,\n gender: normalizeGender(voice.labels?.gender),\n previewUrl: voice.previewUrl ?? undefined,\n metadata: {\n category: voice.category ?? '',\n ...voice.labels,\n },\n }));\n }\n\n async synthesize(input: VoiceSynthesisInput): Promise<VoiceSynthesisResult> {\n const voiceId = input.voiceId ?? this.defaultVoiceId;\n if (!voiceId) {\n throw new Error('Voice ID is required for ElevenLabs synthesis.');\n }\n\n const formatKey = input.format ?? 'mp3';\n const outputFormat = FORMAT_MAP[formatKey] ?? FORMAT_MAP.mp3;\n const sampleRate =\n input.sampleRateHz ??\n SAMPLE_RATE[outputFormat] ??\n SAMPLE_RATE.mp3_44100_128 ??\n 44100;\n\n const voiceSettings =\n input.stability != null ||\n input.similarityBoost != null ||\n input.style != null\n ? {\n ...(input.stability != null ? { stability: input.stability } : {}),\n ...(input.similarityBoost != null\n ? { similarityBoost: input.similarityBoost }\n : {}),\n ...(input.style != null ? { style: input.style } : {}),\n }\n : undefined;\n\n const stream = await this.client.textToSpeech.convert(voiceId, {\n text: input.text,\n modelId: this.modelId,\n outputFormat,\n voiceSettings,\n });\n\n const audio = await readWebStream(stream);\n\n return {\n audio,\n format: formatKey,\n sampleRateHz: sampleRate,\n durationSeconds: undefined,\n url: undefined,\n };\n }\n}\n\nfunction normalizeGender(\n value: string | undefined\n): 'male' | 'female' | 'neutral' | undefined {\n if (!value) return undefined;\n const normalized = value.toLowerCase();\n if (normalized === 'male'
|
|
1
|
+
{"version":3,"file":"elevenlabs-voice.js","names":["FORMAT_MAP: Record<\n NonNullable<VoiceSynthesisInput['format']>,\n ElevenLabs.TextToSpeechConvertRequestOutputFormat\n>","SAMPLE_RATE: Partial<\n Record<ElevenLabs.TextToSpeechConvertRequestOutputFormat, number>\n>","chunks: Uint8Array[]"],"sources":["../../../../src/integrations/providers/impls/elevenlabs-voice.ts"],"sourcesContent":["import { ElevenLabsClient } from '@elevenlabs/elevenlabs-js';\nimport type { ElevenLabs } from '@elevenlabs/elevenlabs-js';\n\nimport type {\n Voice,\n VoiceProvider,\n VoiceSynthesisInput,\n VoiceSynthesisResult,\n} from '../voice';\n\nexport interface ElevenLabsVoiceProviderOptions {\n apiKey: string;\n defaultVoiceId?: string;\n modelId?: string;\n client?: ElevenLabsClient;\n}\n\nconst FORMAT_MAP: Record<\n NonNullable<VoiceSynthesisInput['format']>,\n ElevenLabs.TextToSpeechConvertRequestOutputFormat\n> = {\n mp3: 'mp3_44100_128',\n wav: 'pcm_44100',\n ogg: 'mp3_44100_128',\n pcm: 'pcm_16000',\n};\n\nconst SAMPLE_RATE: Partial<\n Record<ElevenLabs.TextToSpeechConvertRequestOutputFormat, number>\n> = {\n mp3_22050_32: 22050,\n mp3_44100_32: 44100,\n mp3_44100_64: 44100,\n mp3_44100_96: 44100,\n mp3_44100_128: 44100,\n mp3_44100_192: 44100,\n pcm_16000: 16000,\n pcm_22050: 22050,\n pcm_24000: 24000,\n pcm_44100: 44100,\n ulaw_8000: 8000,\n};\n\nexport class ElevenLabsVoiceProvider implements VoiceProvider {\n private readonly client: ElevenLabsClient;\n private readonly defaultVoiceId?: string;\n private readonly modelId?: string;\n\n constructor(options: ElevenLabsVoiceProviderOptions) {\n this.client =\n options.client ??\n new ElevenLabsClient({\n apiKey: options.apiKey,\n });\n this.defaultVoiceId = options.defaultVoiceId;\n this.modelId = options.modelId;\n }\n\n async listVoices(): Promise<Voice[]> {\n const response = await this.client.voices.getAll();\n return (response.voices ?? []).map((voice) => ({\n id: voice.voiceId ?? '',\n name: voice.name ?? voice.voiceId ?? '',\n description: voice.description ?? undefined,\n language: voice.labels?.language ?? undefined,\n gender: normalizeGender(voice.labels?.gender),\n previewUrl: voice.previewUrl ?? undefined,\n metadata: {\n category: voice.category ?? '',\n ...voice.labels,\n },\n }));\n }\n\n async synthesize(input: VoiceSynthesisInput): Promise<VoiceSynthesisResult> {\n const voiceId = input.voiceId ?? this.defaultVoiceId;\n if (!voiceId) {\n throw new Error('Voice ID is required for ElevenLabs synthesis.');\n }\n\n const formatKey = input.format ?? 'mp3';\n const outputFormat = FORMAT_MAP[formatKey] ?? FORMAT_MAP.mp3;\n const sampleRate =\n input.sampleRateHz ??\n SAMPLE_RATE[outputFormat] ??\n SAMPLE_RATE.mp3_44100_128 ??\n 44100;\n\n const voiceSettings =\n input.stability != null ||\n input.similarityBoost != null ||\n input.style != null\n ? {\n ...(input.stability != null ? { stability: input.stability } : {}),\n ...(input.similarityBoost != null\n ? { similarityBoost: input.similarityBoost }\n : {}),\n ...(input.style != null ? { style: input.style } : {}),\n }\n : undefined;\n\n const stream = await this.client.textToSpeech.convert(voiceId, {\n text: input.text,\n modelId: this.modelId,\n outputFormat,\n voiceSettings,\n });\n\n const audio = await readWebStream(stream);\n\n return {\n audio,\n format: formatKey,\n sampleRateHz: sampleRate,\n durationSeconds: undefined,\n url: undefined,\n };\n }\n}\n\nfunction normalizeGender(\n value: string | undefined\n): 'male' | 'female' | 'neutral' | undefined {\n if (!value) return undefined;\n const normalized = value.toLowerCase();\n if (\n normalized === 'male' ||\n normalized === 'female' ||\n normalized === 'neutral'\n ) {\n return normalized;\n }\n return undefined;\n}\n\nasync function readWebStream(\n stream: ReadableStream<Uint8Array>\n): Promise<Uint8Array> {\n const reader = stream.getReader();\n const chunks: Uint8Array[] = [];\n\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n if (value) {\n chunks.push(value);\n }\n }\n\n const length = chunks.reduce((total, chunk) => total + chunk.length, 0);\n const result = new Uint8Array(length);\n let offset = 0;\n for (const chunk of chunks) {\n result.set(chunk, offset);\n offset += chunk.length;\n }\n return result;\n}\n"],"mappings":"6DAiBA,MAAMA,EAGF,CACF,IAAK,gBACL,IAAK,YACL,IAAK,gBACL,IAAK,YACN,CAEKC,EAEF,CACF,aAAc,MACd,aAAc,MACd,aAAc,MACd,aAAc,MACd,cAAe,MACf,cAAe,MACf,UAAW,KACX,UAAW,MACX,UAAW,KACX,UAAW,MACX,UAAW,IACZ,CAED,IAAa,EAAb,KAA8D,CAC5D,OACA,eACA,QAEA,YAAY,EAAyC,CACnD,KAAK,OACH,EAAQ,QACR,IAAI,EAAiB,CACnB,OAAQ,EAAQ,OACjB,CAAC,CACJ,KAAK,eAAiB,EAAQ,eAC9B,KAAK,QAAU,EAAQ,QAGzB,MAAM,YAA+B,CAEnC,QADiB,MAAM,KAAK,OAAO,OAAO,QAAQ,EACjC,QAAU,EAAE,EAAE,IAAK,IAAW,CAC7C,GAAI,EAAM,SAAW,GACrB,KAAM,EAAM,MAAQ,EAAM,SAAW,GACrC,YAAa,EAAM,aAAe,IAAA,GAClC,SAAU,EAAM,QAAQ,UAAY,IAAA,GACpC,OAAQ,EAAgB,EAAM,QAAQ,OAAO,CAC7C,WAAY,EAAM,YAAc,IAAA,GAChC,SAAU,CACR,SAAU,EAAM,UAAY,GAC5B,GAAG,EAAM,OACV,CACF,EAAE,CAGL,MAAM,WAAW,EAA2D,CAC1E,IAAM,EAAU,EAAM,SAAW,KAAK,eACtC,GAAI,CAAC,EACH,MAAU,MAAM,iDAAiD,CAGnE,IAAM,EAAY,EAAM,QAAU,MAC5B,EAAe,EAAW,IAAc,EAAW,IACnD,EACJ,EAAM,cACN,EAAY,IACZ,EAAY,eACZ,MAEI,EACJ,EAAM,WAAa,MACnB,EAAM,iBAAmB,MACzB,EAAM,OAAS,KACX,CACE,GAAI,EAAM,WAAa,KAAwC,EAAE,CAAnC,CAAE,UAAW,EAAM,UAAW,CAC5D,GAAI,EAAM,iBAAmB,KAEzB,EAAE,CADF,CAAE,gBAAiB,EAAM,gBAAiB,CAE9C,GAAI,EAAM,OAAS,KAAgC,EAAE,CAA3B,CAAE,MAAO,EAAM,MAAO,CACjD,CACD,IAAA,GAWN,MAAO,CACL,MAHY,MAAM,EAPL,MAAM,KAAK,OAAO,aAAa,QAAQ,EAAS,CAC7D,KAAM,EAAM,KACZ,QAAS,KAAK,QACd,eACA,gBACD,CAAC,CAEuC,CAIvC,OAAQ,EACR,aAAc,EACd,gBAAiB,IAAA,GACjB,IAAK,IAAA,GACN,GAIL,SAAS,EACP,EAC2C,CAC3C,GAAI,CAAC,EAAO,OACZ,IAAM,EAAa,EAAM,aAAa,CACtC,GACE,IAAe,QACf,IAAe,UACf,IAAe,UAEf,OAAO,EAKX,eAAe,EACb,EACqB,CACrB,IAAM,EAAS,EAAO,WAAW,CAC3BC,EAAuB,EAAE,CAE/B,OAAa,CACX,GAAM,CAAE,OAAM,SAAU,MAAM,EAAO,MAAM,CAC3C,GAAI,EAAM,MACN,GACF,EAAO,KAAK,EAAM,CAItB,IAAM,EAAS,EAAO,QAAQ,EAAO,IAAU,EAAQ,EAAM,OAAQ,EAAE,CACjE,EAAS,IAAI,WAAW,EAAO,CACjC,EAAS,EACb,IAAK,IAAM,KAAS,EAClB,EAAO,IAAI,EAAO,EAAO,CACzB,GAAU,EAAM,OAElB,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gcs-storage.js","names":[],"sources":["../../../../src/integrations/providers/impls/gcs-storage.ts"],"sourcesContent":["import { Storage, type StorageOptions } from '@google-cloud/storage';\n\nimport type {\n ObjectStorageProvider,\n PutObjectInput,\n GetObjectResult,\n StorageObjectMetadata,\n ListObjectsQuery,\n ListObjectsResult,\n SignedUrlOptions,\n DeleteObjectInput,\n} from '../storage';\n\nexport interface GoogleCloudStorageProviderOptions {\n bucket: string;\n storage?: Storage;\n clientOptions?: StorageOptions;\n}\n\nexport class GoogleCloudStorageProvider implements ObjectStorageProvider {\n private readonly storage: Storage;\n private readonly bucketName: string;\n\n constructor(options: GoogleCloudStorageProviderOptions) {\n this.storage =\n options.storage ?? new Storage(options.clientOptions ?? undefined);\n this.bucketName = options.bucket;\n }\n\n async putObject(input: PutObjectInput): Promise<StorageObjectMetadata> {\n const bucketName = input.bucket ?? this.bucketName;\n const bucket = this.storage.bucket(bucketName);\n const file = bucket.file(input.key);\n const buffer = toBuffer(input.data);\n await file.save(buffer, {\n resumable: false,\n contentType: input.contentType,\n metadata: input.metadata,\n });\n if (input.makePublic) {\n await file.makePublic();\n }\n const [metadata] = await file.getMetadata();\n return toMetadata(metadata);\n }\n\n async getObject(input: DeleteObjectInput): Promise<GetObjectResult | null> {\n const bucketName = input.bucket ?? this.bucketName;\n const bucket = this.storage.bucket(bucketName);\n const file = bucket.file(input.key);\n const [exists] = await file.exists();\n if (!exists) return null;\n const [contents] = await file.download();\n const [metadata] = await file.getMetadata();\n return {\n ...toMetadata(metadata),\n data: new Uint8Array(contents),\n };\n }\n\n async deleteObject(input: DeleteObjectInput): Promise<void> {\n const bucketName = input.bucket ?? this.bucketName;\n const bucket = this.storage.bucket(bucketName);\n const file = bucket.file(input.key);\n await file.delete({ ignoreNotFound: true });\n }\n\n async generateSignedUrl(options: SignedUrlOptions): Promise<{\n url: string;\n expiresAt: Date;\n }> {\n const bucketName = options.bucket ?? this.bucketName;\n const bucket = this.storage.bucket(bucketName);\n const file = bucket.file(options.key);\n const action = options.method === 'PUT' ? 'write' : 'read';\n const expires = Date.now() + options.expiresInSeconds * 1000;\n const [url] = await file.getSignedUrl({\n action,\n expires,\n contentType: options.contentType,\n });\n return { url, expiresAt: new Date(expires) };\n }\n\n async listObjects(query: ListObjectsQuery): Promise<ListObjectsResult> {\n const bucketName = query.bucket ?? this.bucketName;\n const bucket = this.storage.bucket(bucketName);\n const [files, nextQuery, response] = await bucket.getFiles({\n prefix: query.prefix,\n maxResults: query.maxResults,\n pageToken: query.pageToken,\n });\n const nextTokenFromQuery =\n typeof nextQuery === 'object'
|
|
1
|
+
{"version":3,"file":"gcs-storage.js","names":[],"sources":["../../../../src/integrations/providers/impls/gcs-storage.ts"],"sourcesContent":["import { Storage, type StorageOptions } from '@google-cloud/storage';\n\nimport type {\n ObjectStorageProvider,\n PutObjectInput,\n GetObjectResult,\n StorageObjectMetadata,\n ListObjectsQuery,\n ListObjectsResult,\n SignedUrlOptions,\n DeleteObjectInput,\n} from '../storage';\n\nexport interface GoogleCloudStorageProviderOptions {\n bucket: string;\n storage?: Storage;\n clientOptions?: StorageOptions;\n}\n\nexport class GoogleCloudStorageProvider implements ObjectStorageProvider {\n private readonly storage: Storage;\n private readonly bucketName: string;\n\n constructor(options: GoogleCloudStorageProviderOptions) {\n this.storage =\n options.storage ?? new Storage(options.clientOptions ?? undefined);\n this.bucketName = options.bucket;\n }\n\n async putObject(input: PutObjectInput): Promise<StorageObjectMetadata> {\n const bucketName = input.bucket ?? this.bucketName;\n const bucket = this.storage.bucket(bucketName);\n const file = bucket.file(input.key);\n const buffer = toBuffer(input.data);\n await file.save(buffer, {\n resumable: false,\n contentType: input.contentType,\n metadata: input.metadata,\n });\n if (input.makePublic) {\n await file.makePublic();\n }\n const [metadata] = await file.getMetadata();\n return toMetadata(metadata);\n }\n\n async getObject(input: DeleteObjectInput): Promise<GetObjectResult | null> {\n const bucketName = input.bucket ?? this.bucketName;\n const bucket = this.storage.bucket(bucketName);\n const file = bucket.file(input.key);\n const [exists] = await file.exists();\n if (!exists) return null;\n const [contents] = await file.download();\n const [metadata] = await file.getMetadata();\n return {\n ...toMetadata(metadata),\n data: new Uint8Array(contents),\n };\n }\n\n async deleteObject(input: DeleteObjectInput): Promise<void> {\n const bucketName = input.bucket ?? this.bucketName;\n const bucket = this.storage.bucket(bucketName);\n const file = bucket.file(input.key);\n await file.delete({ ignoreNotFound: true });\n }\n\n async generateSignedUrl(options: SignedUrlOptions): Promise<{\n url: string;\n expiresAt: Date;\n }> {\n const bucketName = options.bucket ?? this.bucketName;\n const bucket = this.storage.bucket(bucketName);\n const file = bucket.file(options.key);\n const action = options.method === 'PUT' ? 'write' : 'read';\n const expires = Date.now() + options.expiresInSeconds * 1000;\n const [url] = await file.getSignedUrl({\n action,\n expires,\n contentType: options.contentType,\n });\n return { url, expiresAt: new Date(expires) };\n }\n\n async listObjects(query: ListObjectsQuery): Promise<ListObjectsResult> {\n const bucketName = query.bucket ?? this.bucketName;\n const bucket = this.storage.bucket(bucketName);\n const [files, nextQuery, response] = await bucket.getFiles({\n prefix: query.prefix,\n maxResults: query.maxResults,\n pageToken: query.pageToken,\n });\n const nextTokenFromQuery =\n typeof nextQuery === 'object' &&\n nextQuery !== null &&\n 'pageToken' in nextQuery\n ? (nextQuery as { pageToken?: string }).pageToken\n : undefined;\n const nextTokenFromResponse =\n response && typeof response === 'object' && 'nextPageToken' in response\n ? (response as { nextPageToken?: string }).nextPageToken\n : undefined;\n return {\n objects: files.map((file) => toMetadata(file.metadata)),\n nextPageToken: nextTokenFromQuery ?? nextTokenFromResponse ?? undefined,\n };\n }\n}\n\nfunction toBuffer(data: Uint8Array | ArrayBuffer): Buffer {\n if (data instanceof Uint8Array) {\n return Buffer.from(data);\n }\n return Buffer.from(data);\n}\n\nfunction toMetadata(metadata: any): StorageObjectMetadata {\n return {\n bucket: metadata.bucket ?? '',\n key: metadata.name ?? '',\n sizeBytes: metadata.size ? Number(metadata.size) : undefined,\n contentType: metadata.contentType ?? undefined,\n etag: metadata.etag ?? undefined,\n checksum: metadata.md5Hash ?? undefined,\n lastModified: metadata.updated ? new Date(metadata.updated) : undefined,\n metadata: metadata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G,EAAQ,iBAAmB,IAClD,CAAC,GAAO,MAAM,EAAK,aAAa,CACpC,SACA,UACA,YAAa,EAAQ,YACtB,CAAC,CACF,MAAO,CAAE,MAAK,UAAW,IAAI,KAAK,EAAQ,CAAE,CAG9C,MAAM,YAAY,EAAqD,CACrE,IAAM,EAAa,EAAM,QAAU,KAAK,WAElC,CAAC,EAAO,EAAW,GAAY,MADtB,KAAK,QAAQ,OAAO,EAAW,CACI,SAAS,CACzD,OAAQ,EAAM,OACd,WAAY,EAAM,WAClB,UAAW,EAAM,UAClB,CAAC,CACI,EACJ,OAAO,GAAc,UACrB,GACA,cAAe,EACV,EAAqC,UACtC,IAAA,GACA,EACJ,GAAY,OAAO,GAAa,UAAY,kBAAmB,EAC1D,EAAwC,cACzC,IAAA,GACN,MAAO,CACL,QAAS,EAAM,IAAK,GAAS,EAAW,EAAK,SAAS,CAAC,CACvD,cAAe,GAAsB,GAAyB,IAAA,GAC/D,GAIL,SAAS,EAAS,EAAwC,CAIxD,OAHI,aAAgB,WACX,OAAO,KAAK,EAAK,CAK5B,SAAS,EAAW,EAAsC,CACxD,MAAO,CACL,OAAQ,EAAS,QAAU,GAC3B,IAAK,EAAS,MAAQ,GACtB,UAAW,EAAS,KAAO,OAAO,EAAS,KAAK,CAAG,IAAA,GACnD,YAAa,EAAS,aAAe,IAAA,GACrC,KAAM,EAAS,MAAQ,IAAA,GACvB,SAAU,EAAS,SAAW,IAAA,GAC9B,aAAc,EAAS,QAAU,IAAI,KAAK,EAAS,QAAQ,CAAG,IAAA,GAC9D,SAAU,EAAS,SACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gmail-inbound.js","names":["q: string[]","metadata: Record<string, string>","attachments: NonNullable<EmailMessage['attachments']>"],"sources":["../../../../src/integrations/providers/impls/gmail-inbound.ts"],"sourcesContent":["import { google, type gmail_v1 } from 'googleapis';\n\nimport type {\n EmailInboundProvider,\n EmailMessagesSinceQuery,\n EmailMessage,\n EmailThread,\n EmailThreadListQuery,\n} from '../email';\n\nexport interface GmailInboundProviderOptions {\n auth: gmail_v1.Options['auth'];\n userId?: string;\n gmail?: gmail_v1.Gmail;\n includeSpamTrash?: boolean;\n}\n\nexport class GmailInboundProvider implements EmailInboundProvider {\n private readonly gmail: gmail_v1.Gmail;\n private readonly userId: string;\n private readonly includeSpamTrash: boolean;\n private readonly auth: gmail_v1.Options['auth'];\n\n constructor(options: GmailInboundProviderOptions) {\n this.auth = options.auth;\n this.gmail =\n options.gmail ??\n google.gmail({\n version: 'v1',\n auth: options.auth,\n });\n this.userId = options.userId ?? 'me';\n this.includeSpamTrash = options.includeSpamTrash ?? false;\n }\n\n async listThreads(query?: EmailThreadListQuery): Promise<EmailThread[]> {\n const response = await this.gmail.users.threads.list({\n userId: this.userId,\n maxResults: query?.pageSize,\n pageToken: query?.pageToken,\n q: query?.query,\n labelIds: query?.label ? [query.label] : undefined,\n includeSpamTrash: this.includeSpamTrash,\n auth: this.auth,\n });\n\n const threads = await Promise.all(\n (response.data.threads ?? []).map(async (thread) => {\n if (!thread.id) return null;\n return this.getThread(thread.id);\n })\n );\n\n return threads.filter((thread): thread is EmailThread => thread !== null);\n }\n\n async getThread(threadId: string): Promise<EmailThread | null> {\n const response = await this.gmail.users.threads.get({\n id: threadId,\n userId: this.userId,\n format: 'full',\n auth: this.auth,\n });\n const thread = response.data;\n if (!thread) return null;\n\n const messages =\n thread.messages?.map((message) => this.transformMessage(message)) ?? [];\n\n const participants = dedupeAddresses(\n messages.flatMap((message) => [\n message.from,\n ...message.to,\n ...(message.cc ?? []),\n ])\n );\n\n const firstMessage = messages[0];\n const lastMessage = messages[messages.length - 1];\n const updatedAt =\n lastMessage?.receivedAt ??\n lastMessage?.sentAt ??\n firstMessage?.receivedAt ??\n firstMessage?.sentAt ??\n new Date();\n\n const labels = Array.from(\n new Set(\n messages\n .flatMap((message) => {\n const labelField = message.metadata?.labelIds;\n if (!labelField) return [];\n return labelField.split(',').map((label) => label.trim());\n })\n .filter((label): label is string => Boolean(label))\n )\n );\n\n return {\n id: thread.id ?? threadId,\n subject: messages[0]?.subject,\n snippet: thread.snippet ?? '',\n participants,\n messages,\n updatedAt,\n labels,\n metadata: thread.historyId ? { historyId: thread.historyId } : undefined,\n };\n }\n\n async listMessagesSince(query: EmailMessagesSinceQuery) {\n const after = query.since\n ? Math.floor(query.since.getTime() / 1000)\n : undefined;\n const q: string[] = [];\n if (after) {\n q.push(`after:${after}`);\n }\n const response = await this.gmail.users.messages.list({\n userId: this.userId,\n maxResults: query.pageSize,\n pageToken: query.pageToken,\n labelIds: query.label ? [query.label] : undefined,\n q: q.join(' '),\n includeSpamTrash: this.includeSpamTrash,\n auth: this.auth,\n });\n\n const messages = await Promise.all(\n (response.data.messages ?? []).map(async (item) => {\n if (!item.id) return null;\n const full = await this.gmail.users.messages.get({\n userId: this.userId,\n id: item.id,\n format: 'full',\n auth: this.auth,\n });\n if (!full.data) return null;\n return this.transformMessage(full.data);\n })\n );\n\n return {\n messages: messages.filter(\n (message): message is EmailMessage => message !== null\n ),\n nextPageToken: response.data.nextPageToken ?? undefined,\n };\n }\n\n private transformMessage(message: gmail_v1.Schema$Message): EmailMessage {\n const headers = message.payload?.headers ?? [];\n const subject = headerValue(headers, 'Subject') ?? '';\n const from =\n parseAddress(headerValue(headers, 'From')) ??\n inferFallbackAddress('from', message.id);\n const to = parseAddressList(headerValue(headers, 'To'));\n const cc = parseAddressList(headerValue(headers, 'Cc'));\n const bcc = parseAddressList(headerValue(headers, 'Bcc'));\n const replyTo = parseAddress(headerValue(headers, 'Reply-To'));\n\n const { text, html, attachments } = extractContent(message.payload);\n const timestamp = message.internalDate\n ? new Date(Number(message.internalDate))\n : new Date();\n\n const metadata: Record<string, string> = {\n ...(message.labelIds?.length\n ? { labelIds: message.labelIds.join(',') }\n : {}),\n ...(message.historyId ? { historyId: message.historyId } : {}),\n };\n\n return {\n id: message.id ?? '',\n threadId: message.threadId ?? '',\n subject,\n from,\n to,\n cc,\n bcc,\n replyTo: replyTo ?? undefined,\n sentAt: timestamp,\n receivedAt: timestamp,\n textBody: text ?? undefined,\n htmlBody: html ?? undefined,\n attachments,\n headers: Object.fromEntries(\n headers.map((header) => [header.name ?? '', header.value ?? ''])\n ),\n metadata: Object.keys(metadata).length > 0 ? metadata : undefined,\n };\n }\n}\n\nfunction headerValue(\n headers: gmail_v1.Schema$MessagePartHeader[],\n name: string\n): string | undefined {\n const header = headers.find(\n (candidate) => candidate.name?.toLowerCase() === name.toLowerCase()\n );\n const value = header?.value;\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction parseAddress(header?: string): { email: string; name?: string } | null {\n const addresses = parseAddressList(header);\n if (addresses.length === 0) {\n return null;\n }\n return addresses[0]!;\n}\n\nfunction inferFallbackAddress(\n field: string,\n messageId?: string | null\n): { email: string; name?: string } {\n const suffix = messageId\n ? messageId.replace(/[^\\w]/g, '').slice(-8) || 'unknown'\n : 'unknown';\n return {\n email: `${field}-${suffix}@mail.local`,\n };\n}\n\nfunction parseAddressList(header?: string): Array<{ email: string; name?: string }> {\n if (!header) return [];\n return header\n .split(',')\n .map((part) => part.trim())\n .filter(Boolean)\n .map((value) => {\n const match = value.match(/^(?:\"?([^\"]*)\"?\\s)?<?([^<>]+)>?$/);\n if (!match) {\n return { email: value };\n }\n const name = match[1]?.trim();\n const email = match[2]?.trim();\n if (!email) {\n return { email: value };\n }\n return name ? { email, name } : { email };\n });\n}\n\nfunction dedupeAddresses(\n addresses: (ReturnType<typeof parseAddress> | { email: string; name?: string })[]\n) {\n const map = new Map<string, { email: string; name?: string }>();\n for (const address of addresses) {\n if (!address) continue;\n map.set(address.email.toLowerCase(), address);\n }\n return Array.from(map.values());\n}\n\nfunction extractContent(payload?: gmail_v1.Schema$MessagePart): {\n text?: string;\n html?: string;\n attachments: EmailMessage['attachments'];\n} {\n if (!payload) {\n return { attachments: [] };\n }\n const attachments: NonNullable<EmailMessage['attachments']> = [];\n const visit = (part?: gmail_v1.Schema$MessagePart): {\n text?: string;\n html?: string;\n } => {\n if (!part) return {};\n if (part.filename && part.body?.attachmentId) {\n attachments.push({\n id: part.body.attachmentId,\n filename: part.filename,\n contentType: part.mimeType ?? 'application/octet-stream',\n sizeBytes: part.body.size ?? undefined,\n });\n }\n const mimeType = part.mimeType ?? '';\n const data = part.body?.data;\n if (mimeType === 'text/plain' && data) {\n return { text: decodeBase64Url(data) };\n }\n if (mimeType === 'text/html' && data) {\n return { html: decodeBase64Url(data) };\n }\n if (part.parts?.length) {\n return part.parts.reduce<{ text?: string; html?: string }>(\n (acc, nested) => {\n const value = visit(nested);\n return {\n text: value.text ?? acc.text,\n html: value.html ?? acc.html,\n };\n },\n {}\n );\n }\n return {};\n };\n\n const { text, html } = visit(payload);\n return { text, html, attachments };\n}\n\nfunction decodeBase64Url(data: string): string {\n const normalized = data.replace(/-/g, '+').replace(/_/g, '/');\n const padding = normalized.length % 4;\n const padded =\n padding === 0 ? normalized : normalized + '='.repeat(4 - padding);\n return Buffer.from(padded, 'base64').toString('utf-8');\n}\n\n\n"],"mappings":"oCAiBA,IAAa,EAAb,KAAkE,CAChE,MACA,OACA,iBACA,KAEA,YAAY,EAAsC,CAChD,KAAK,KAAO,EAAQ,KACpB,KAAK,MACH,EAAQ,OACR,EAAO,MAAM,CACX,QAAS,KACT,KAAM,EAAQ,KACf,CAAC,CACJ,KAAK,OAAS,EAAQ,QAAU,KAChC,KAAK,iBAAmB,EAAQ,kBAAoB,GAGtD,MAAM,YAAY,EAAsD,CACtE,IAAM,EAAW,MAAM,KAAK,MAAM,MAAM,QAAQ,KAAK,CACnD,OAAQ,KAAK,OACb,WAAY,GAAO,SACnB,UAAW,GAAO,UAClB,EAAG,GAAO,MACV,SAAU,GAAO,MAAQ,CAAC,EAAM,MAAM,CAAG,IAAA,GACzC,iBAAkB,KAAK,iBACvB,KAAM,KAAK,KACZ,CAAC,CASF,OAPgB,MAAM,QAAQ,KAC3B,EAAS,KAAK,SAAW,EAAE,EAAE,IAAI,KAAO,IACl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AE,EAAQ,CAE/C,OAAO,MAAM,KAAK,EAAI,QAAQ,CAAC,CAGjC,SAAS,EAAe,EAItB,CACA,GAAI,CAAC,EACH,MAAO,CAAE,YAAa,EAAE,CAAE,CAE5B,IAAMC,EAAwD,EAAE,CAC1D,EAAS,GAGV,CACH,GAAI,CAAC,EAAM,MAAO,EAAE,CAChB,EAAK,UAAY,EAAK,MAAM,cAC9B,EAAY,KAAK,CACf,GAAI,EAAK,KAAK,aACd,SAAU,EAAK,SACf,YAAa,EAAK,UAAY,2BAC9B,UAAW,EAAK,KAAK,MAAQ,IAAA,GAC9B,CAAC,CAEJ,IAAM,EAAW,EAAK,UAAY,GAC5B,EAAO,EAAK,MAAM,KAmBxB,OAlBI,IAAa,cAAgB,EACxB,CAAE,KAAM,EAAgB,EAAK,CAAE,CAEpC,IAAa,aAAe,EACvB,CAAE,KAAM,EAAgB,EAAK,CAAE,CAEpC,EAAK,OAAO,OACP,EAAK,MAAM,QACf,EAAK,IAAW,CACf,IAAM,EAAQ,EAAM,EAAO,CAC3B,MAAO,CACL,KAAM,EAAM,MAAQ,EAAI,KACxB,KAAM,EAAM,MAAQ,EAAI,KACzB,EAEH,EAAE,CACH,CAEI,EAAE,EAGL,CAAE,OAAM,QAAS,EAAM,EAAQ,CACrC,MAAO,CAAE,OAAM,OAAM,cAAa,CAGpC,SAAS,EAAgB,EAAsB,CAC7C,IAAM,EAAa,EAAK,QAAQ,KAAM,IAAI,CAAC,QAAQ,KAAM,IAAI,CACvD,EAAU,EAAW,OAAS,EAC9B,EACJ,IAAY,EAAI,EAAa,EAAa,IAAI,OAAO,EAAI,EAAQ,CACnE,OAAO,OAAO,KAAK,EAAQ,SAAS,CAAC,SAAS,QAAQ"}
|
|
1
|
+
{"version":3,"file":"gmail-inbound.js","names":["q: string[]","metadata: Record<string, string>","attachments: NonNullable<EmailMessage['attachments']>"],"sources":["../../../../src/integrations/providers/impls/gmail-inbound.ts"],"sourcesContent":["import { google, type gmail_v1 } from 'googleapis';\n\nimport type {\n EmailInboundProvider,\n EmailMessagesSinceQuery,\n EmailMessage,\n EmailThread,\n EmailThreadListQuery,\n} from '../email';\n\nexport interface GmailInboundProviderOptions {\n auth: gmail_v1.Options['auth'];\n userId?: string;\n gmail?: gmail_v1.Gmail;\n includeSpamTrash?: boolean;\n}\n\nexport class GmailInboundProvider implements EmailInboundProvider {\n private readonly gmail: gmail_v1.Gmail;\n private readonly userId: string;\n private readonly includeSpamTrash: boolean;\n private readonly auth: gmail_v1.Options['auth'];\n\n constructor(options: GmailInboundProviderOptions) {\n this.auth = options.auth;\n this.gmail =\n options.gmail ??\n google.gmail({\n version: 'v1',\n auth: options.auth,\n });\n this.userId = options.userId ?? 'me';\n this.includeSpamTrash = options.includeSpamTrash ?? false;\n }\n\n async listThreads(query?: EmailThreadListQuery): Promise<EmailThread[]> {\n const response = await this.gmail.users.threads.list({\n userId: this.userId,\n maxResults: query?.pageSize,\n pageToken: query?.pageToken,\n q: query?.query,\n labelIds: query?.label ? [query.label] : undefined,\n includeSpamTrash: this.includeSpamTrash,\n auth: this.auth,\n });\n\n const threads = await Promise.all(\n (response.data.threads ?? []).map(async (thread) => {\n if (!thread.id) return null;\n return this.getThread(thread.id);\n })\n );\n\n return threads.filter((thread): thread is EmailThread => thread !== null);\n }\n\n async getThread(threadId: string): Promise<EmailThread | null> {\n const response = await this.gmail.users.threads.get({\n id: threadId,\n userId: this.userId,\n format: 'full',\n auth: this.auth,\n });\n const thread = response.data;\n if (!thread) return null;\n\n const messages =\n thread.messages?.map((message) => this.transformMessage(message)) ?? [];\n\n const participants = dedupeAddresses(\n messages.flatMap((message) => [\n message.from,\n ...message.to,\n ...(message.cc ?? []),\n ])\n );\n\n const firstMessage = messages[0];\n const lastMessage = messages[messages.length - 1];\n const updatedAt =\n lastMessage?.receivedAt ??\n lastMessage?.sentAt ??\n firstMessage?.receivedAt ??\n firstMessage?.sentAt ??\n new Date();\n\n const labels = Array.from(\n new Set(\n messages\n .flatMap((message) => {\n const labelField = message.metadata?.labelIds;\n if (!labelField) return [];\n return labelField.split(',').map((label) => label.trim());\n })\n .filter((label): label is string => Boolean(label))\n )\n );\n\n return {\n id: thread.id ?? threadId,\n subject: messages[0]?.subject,\n snippet: thread.snippet ?? '',\n participants,\n messages,\n updatedAt,\n labels,\n metadata: thread.historyId ? { historyId: thread.historyId } : undefined,\n };\n }\n\n async listMessagesSince(query: EmailMessagesSinceQuery) {\n const after = query.since\n ? Math.floor(query.since.getTime() / 1000)\n : undefined;\n const q: string[] = [];\n if (after) {\n q.push(`after:${after}`);\n }\n const response = await this.gmail.users.messages.list({\n userId: this.userId,\n maxResults: query.pageSize,\n pageToken: query.pageToken,\n labelIds: query.label ? [query.label] : undefined,\n q: q.join(' '),\n includeSpamTrash: this.includeSpamTrash,\n auth: this.auth,\n });\n\n const messages = await Promise.all(\n (response.data.messages ?? []).map(async (item) => {\n if (!item.id) return null;\n const full = await this.gmail.users.messages.get({\n userId: this.userId,\n id: item.id,\n format: 'full',\n auth: this.auth,\n });\n if (!full.data) return null;\n return this.transformMessage(full.data);\n })\n );\n\n return {\n messages: messages.filter(\n (message): message is EmailMessage => message !== null\n ),\n nextPageToken: response.data.nextPageToken ?? undefined,\n };\n }\n\n private transformMessage(message: gmail_v1.Schema$Message): EmailMessage {\n const headers = message.payload?.headers ?? [];\n const subject = headerValue(headers, 'Subject') ?? '';\n const from =\n parseAddress(headerValue(headers, 'From')) ??\n inferFallbackAddress('from', message.id);\n const to = parseAddressList(headerValue(headers, 'To'));\n const cc = parseAddressList(headerValue(headers, 'Cc'));\n const bcc = parseAddressList(headerValue(headers, 'Bcc'));\n const replyTo = parseAddress(headerValue(headers, 'Reply-To'));\n\n const { text, html, attachments } = extractContent(message.payload);\n const timestamp = message.internalDate\n ? new Date(Number(message.internalDate))\n : new Date();\n\n const metadata: Record<string, string> = {\n ...(message.labelIds?.length\n ? { labelIds: message.labelIds.join(',') }\n : {}),\n ...(message.historyId ? { historyId: message.historyId } : {}),\n };\n\n return {\n id: message.id ?? '',\n threadId: message.threadId ?? '',\n subject,\n from,\n to,\n cc,\n bcc,\n replyTo: replyTo ?? undefined,\n sentAt: timestamp,\n receivedAt: timestamp,\n textBody: text ?? undefined,\n htmlBody: html ?? undefined,\n attachments,\n headers: Object.fromEntries(\n headers.map((header) => [header.name ?? '', header.value ?? ''])\n ),\n metadata: Object.keys(metadata).length > 0 ? metadata : undefined,\n };\n }\n}\n\nfunction headerValue(\n headers: gmail_v1.Schema$MessagePartHeader[],\n name: string\n): string | undefined {\n const header = headers.find(\n (candidate) => candidate.name?.toLowerCase() === name.toLowerCase()\n );\n const value = header?.value;\n return typeof value === 'string' ? value : undefined;\n}\n\nfunction parseAddress(\n header?: string\n): { email: string; name?: string } | null {\n const addresses = parseAddressList(header);\n if (addresses.length === 0) {\n return null;\n }\n return addresses[0]!;\n}\n\nfunction inferFallbackAddress(\n field: string,\n messageId?: string | null\n): { email: string; name?: string } {\n const suffix = messageId\n ? messageId.replace(/[^\\w]/g, '').slice(-8) || 'unknown'\n : 'unknown';\n return {\n email: `${field}-${suffix}@mail.local`,\n };\n}\n\nfunction parseAddressList(header?: string): { email: string; name?: string }[] {\n if (!header) return [];\n return header\n .split(',')\n .map((part) => part.trim())\n .filter(Boolean)\n .map((value) => {\n const match = value.match(/^(?:\"?([^\"]*)\"?\\s)?<?([^<>]+)>?$/);\n if (!match) {\n return { email: value };\n }\n const name = match[1]?.trim();\n const email = match[2]?.trim();\n if (!email) {\n return { email: value };\n }\n return name ? { email, name } : { email };\n });\n}\n\nfunction dedupeAddresses(\n addresses: (\n | ReturnType<typeof parseAddress>\n | { email: string; name?: string }\n )[]\n) {\n const map = new Map<string, { email: string; name?: string }>();\n for (const address of addresses) {\n if (!address) continue;\n map.set(address.email.toLowerCase(), address);\n }\n return Array.from(map.values());\n}\n\nfunction extractContent(payload?: gmail_v1.Schema$MessagePart): {\n text?: string;\n html?: string;\n attachments: EmailMessage['attachments'];\n} {\n if (!payload) {\n return { attachments: [] };\n }\n const attachments: NonNullable<EmailMessage['attachments']> = [];\n const visit = (\n part?: gmail_v1.Schema$MessagePart\n ): {\n text?: string;\n html?: string;\n } => {\n if (!part) return {};\n if (part.filename && part.body?.attachmentId) {\n attachments.push({\n id: part.body.attachmentId,\n filename: part.filename,\n contentType: part.mimeType ?? 'application/octet-stream',\n sizeBytes: part.body.size ?? undefined,\n });\n }\n const mimeType = part.mimeType ?? '';\n const data = part.body?.data;\n if (mimeType === 'text/plain' && data) {\n return { text: decodeBase64Url(data) };\n }\n if (mimeType === 'text/html' && data) {\n return { html: decodeBase64Url(data) };\n }\n if (part.parts?.length) {\n return part.parts.reduce<{ text?: string; html?: string }>(\n (acc, nested) => {\n const value = visit(nested);\n return {\n text: value.text ?? acc.text,\n html: value.html ?? acc.html,\n };\n },\n {}\n );\n }\n return {};\n };\n\n const { text, html } = visit(payload);\n return { text, html, attachments };\n}\n\nfunction decodeBase64Url(data: string): string {\n const normalized = data.replace(/-/g, '+').replace(/_/g, '/');\n const padding = normalized.length % 4;\n const padded =\n padding === 0 ? normalized : normalized + '='.repeat(4 - padding);\n return Buffer.from(padded, 'base64').toString('utf-8');\n}\n"],"mappings":"oCAiBA,IAAa,EAAb,KAAkE,CAChE,MACA,OACA,iBACA,KAEA,YAAY,EAAsC,CAChD,KAAK,KAAO,EAAQ,KACpB,KAAK,MACH,EAAQ,OACR,EAAO,MAAM,CACX,QAAS,KACT,KAAM,EAAQ,KACf,CAAC,CACJ,KAAK,OAAS,EAAQ,QAAU,KAChC,KAAK,iBAAmB,EAAQ,kBAAoB,GAGtD,MAAM,YAAY,EAAsD,CACtE,IAAM,EAAW,MAAM,KAAK,MAAM,MAAM,QAAQ,KAAK,CACnD,OAAQ,KAAK,OACb,WAAY,GAAO,SACnB,UAAW,GAAO,UAClB,EAAG,GAAO,MACV,SAAU,GAAO,MAAQ,CAAC,EAAM,MAAM,CAAG,IAAA,GACzC,iBAAkB,KAAK,iBACvB,KAAM,KAAK,KACZ,CAAC,C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ls/gmail-outbound.ts"],"sourcesContent":[],"mappings":";;;;UASiB,4BAAA;QACT,QAAA,CAAS;EADA,MAAA,CAAA,EAAA,MAAA;EAMJ,KAAA,CAAA,EAHH,QAAA,CAAS,KAGN;;
|
|
1
|
+
{"version":3,"file":"gmail-outbound.d.ts","names":[],"sources":["../../../../src/integrations/providers/impls/gmail-outbound.ts"],"sourcesContent":[],"mappings":";;;;UASiB,4BAAA;QACT,QAAA,CAAS;EADA,MAAA,CAAA,EAAA,MAAA;EAMJ,KAAA,CAAA,EAHH,QAAA,CAAS,KAGN;;AAgBc,cAhBd,qBAAA,YAAiC,qBAgBnB,CAAA;EAA+B,iBAAA,KAAA;EAAR,iBAAA,MAAA;EAhBJ,iBAAA,IAAA;EAAqB,WAAA,CAAA,OAAA,EAK5C,4BAL4C;qBAgBxC,uBAAuB,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gmail-outbound.js","names":["headers: string[]"],"sources":["../../../../src/integrations/providers/impls/gmail-outbound.ts"],"sourcesContent":["import { google, type gmail_v1 } from 'googleapis';\n\nimport type {\n EmailAttachment,\n EmailOutboundMessage,\n EmailOutboundProvider,\n EmailOutboundResult,\n} from '../email';\n\nexport interface GmailOutboundProviderOptions {\n auth: gmail_v1.Options['auth'];\n userId?: string;\n gmail?: gmail_v1.Gmail;\n}\n\nexport class GmailOutboundProvider implements EmailOutboundProvider {\n private readonly gmail: gmail_v1.Gmail;\n private readonly userId: string;\n private readonly auth: gmail_v1.Options['auth'];\n\n constructor(options: GmailOutboundProviderOptions) {\n this.auth = options.auth;\n this.gmail =\n options.gmail ??\n google.gmail({\n version: 'v1',\n auth: options.auth,\n });\n this.userId = options.userId ?? 'me';\n }\n\n async sendEmail(
|
|
1
|
+
{"version":3,"file":"gmail-outbound.js","names":["headers: string[]"],"sources":["../../../../src/integrations/providers/impls/gmail-outbound.ts"],"sourcesContent":["import { google, type gmail_v1 } from 'googleapis';\n\nimport type {\n EmailAttachment,\n EmailOutboundMessage,\n EmailOutboundProvider,\n EmailOutboundResult,\n} from '../email';\n\nexport interface GmailOutboundProviderOptions {\n auth: gmail_v1.Options['auth'];\n userId?: string;\n gmail?: gmail_v1.Gmail;\n}\n\nexport class GmailOutboundProvider implements EmailOutboundProvider {\n private readonly gmail: gmail_v1.Gmail;\n private readonly userId: string;\n private readonly auth: gmail_v1.Options['auth'];\n\n constructor(options: GmailOutboundProviderOptions) {\n this.auth = options.auth;\n this.gmail =\n options.gmail ??\n google.gmail({\n version: 'v1',\n auth: options.auth,\n });\n this.userId = options.userId ?? 'me';\n }\n\n async sendEmail(message: EmailOutboundMessage): Promise<EmailOutboundResult> {\n const raw = encodeMessage(message);\n const response = await this.gmail.users.messages.send({\n userId: this.userId,\n requestBody: {\n raw,\n },\n auth: this.auth,\n });\n\n const id = response.data.id ?? '';\n return {\n id,\n providerMessageId: response.data.id ?? undefined,\n queuedAt: new Date(),\n };\n }\n}\n\nfunction encodeMessage(message: EmailOutboundMessage): string {\n const headers: string[] = [\n `From: ${formatAddress(message.from)}`,\n `To: ${message.to.map(formatAddress).join(', ')}`,\n `Subject: ${message.subject}`,\n 'MIME-Version: 1.0',\n ];\n if (message.cc?.length) {\n headers.push(`Cc: ${message.cc.map(formatAddress).join(', ')}`);\n }\n if (message.replyTo) {\n headers.push(`Reply-To: ${formatAddress(message.replyTo)}`);\n }\n Object.entries(message.headers ?? {}).forEach(([key, value]) => {\n headers.push(`${key}: ${value}`);\n });\n\n const attachments = message.attachments ?? [];\n const hasHtml = Boolean(message.htmlBody);\n const hasText = Boolean(message.textBody);\n const boundaryMain = `mixed_${Date.now()}`;\n const boundaryAlt = `alt_${Date.now()}`;\n\n let body = '';\n if (attachments.length > 0) {\n headers.push(`Content-Type: multipart/mixed; boundary=\"${boundaryMain}\"`);\n body += `\\r\\n--${boundaryMain}\\r\\n`;\n body += buildAlternativePart(hasText, hasHtml, boundaryAlt, message);\n attachments.forEach((attachment) => {\n body += buildAttachmentPart(boundaryMain, attachment);\n });\n body += `\\r\\n--${boundaryMain}--`;\n } else if (hasText && hasHtml) {\n headers.push(\n `Content-Type: multipart/alternative; boundary=\"${boundaryAlt}\"`\n );\n body += `\\r\\n--${boundaryAlt}\\r\\n`;\n body += buildTextPart('text/plain; charset=\"utf-8\"', message.textBody!);\n body += `\\r\\n--${boundaryAlt}\\r\\n`;\n body += buildTextPart('text/html; charset=\"utf-8\"', message.htmlBody!);\n body += `\\r\\n--${boundaryAlt}--`;\n } else if (hasHtml) {\n headers.push('Content-Type: text/html; charset=\"utf-8\"');\n body += `\\r\\n\\r\\n${message.htmlBody}`;\n } else {\n headers.push('Content-Type: text/plain; charset=\"utf-8\"');\n body += `\\r\\n\\r\\n${message.textBody ?? ''}`;\n }\n\n const mime = `${headers.join('\\r\\n')}${body}`;\n return Buffer.from(mime)\n .toString('base64')\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/, '');\n}\n\nfunction buildAlternativePart(\n hasText: boolean,\n hasHtml: boolean,\n boundary: string,\n message: EmailOutboundMessage\n) {\n let content = '';\n content += `Content-Type: multipart/alternative; boundary=\"${boundary}\"\\r\\n`;\n content += '\\r\\n';\n if (hasText) {\n content += `--${boundary}\\r\\n`;\n content += buildTextPart('text/plain; charset=\"utf-8\"', message.textBody!);\n }\n if (hasHtml) {\n content += `\\r\\n--${boundary}\\r\\n`;\n content += buildTextPart('text/html; charset=\"utf-8\"', message.htmlBody!);\n }\n content += `\\r\\n--${boundary}--`;\n return content;\n}\n\nfunction buildTextPart(contentType: string, content: string) {\n return (\n `Content-Type: ${contentType}\\r\\n` +\n 'Content-Transfer-Encoding: 7bit\\r\\n\\r\\n' +\n content\n );\n}\n\nfunction buildAttachmentPart(\n boundary: string,\n attachment: EmailAttachment\n): string {\n const data = attachment.data ?? new Uint8Array();\n const encoded =\n data.byteLength > 0 ? Buffer.from(data).toString('base64') : '';\n return (\n `\\r\\n--${boundary}\\r\\n` +\n `Content-Type: ${attachment.contentType}; name=\"${attachment.filename}\"\\r\\n` +\n 'Content-Transfer-Encoding: base64\\r\\n' +\n `Content-Disposition: attachment; filename=\"${attachment.filename}\"\\r\\n\\r\\n` +\n encoded\n );\n}\n\nfunction formatAddress(address: { email: string; name?: string }) {\n if (address.name) {\n return `\"${address.name}\" <${address.email}>`;\n }\n return address.email;\n}\n"],"mappings":"oCAeA,IAAa,EAAb,KAAoE,CAClE,MACA,OACA,KAEA,YAAY,EAAuC,CACjD,KAAK,KAAO,EAAQ,KACpB,KAAK,MACH,EAAQ,OACR,EAAO,MAAM,CACX,QAAS,KACT,KAAM,EAAQ,KACf,CAAC,CACJ,KAAK,OAAS,EAAQ,QAAU,KAGlC,MAAM,UAAU,EAA6D,CAC3E,IAAM,EAAM,EAAc,EAAQ,CAC5B,EAAW,MAAM,KAAK,MAAM,MAAM,SAAS,KAAK,CACpD,OAAQ,KAAK,OACb,YAAa,CACX,MACD,CACD,KAAM,KAAK,KACZ,CAAC,CAGF,MAAO,CACL,GAFS,EAAS,KAAK,IAAM,GAG7B,kBAAmB,EAAS,KAAK,IAAM,IAAA,GACvC,SAAU,IAAI,KACf,GAIL,SAAS,EAAc,EAAuC,CAC5D,IAAMA,EAAoB,CACxB,SAAS,EAAc,EAAQ,KAAK,GACpC,OAAO,EAAQ,GAAG,IAAI,EAAc,CAAC,KAAK,KAAK,GAC/C,YAAY,EAAQ,UACpB,oBACD,CACG,EAAQ,IAAI,QACd,EAAQ,KAAK,OAAO,EAAQ,GAAG,IAAI,EAAc,CAAC,KAAK,KAAK,GAAG,CAE7D,EAAQ,SACV,EAAQ,KAAK,aAAa,EAAc,EAAQ,QAAQ,GAAG,CAE7D,OAAO,QAAQ,EAAQ,SAAW,EAAE,CAAC,CAAC,SAAS,CAAC,EAAK,KAAW,CAC9D,EAAQ,KAAK,GAAG,EAAI,IAAI,IAAQ,EAChC,CAEF,IAAM,EAAc,EAAQ,aAAe,EAAE,CACvC,EAAU,EAAQ,EAAQ,SAC1B,EAAU,EAAQ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I,OAAO,KAAK,EAAK,CAAC,SAAS,SAAS,CAAG,GAC/D,MACE,SAAS,EAAS,oBACD,EAAW,YAAY,UAAU,EAAW,SAAS;6CAExB,EAAW,SAAS,WAClE,EAIJ,SAAS,EAAc,EAA2C,CAIhE,OAHI,EAAQ,KACH,IAAI,EAAQ,KAAK,KAAK,EAAQ,MAAM,GAEtC,EAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-calendar.d.ts","names":[],"sources":["../../../../src/integrations/providers/impls/google-calendar.ts"],"sourcesContent":[],"mappings":";;;;UAWiB,6BAAA;QACT,WAAA,CAAY;EADH,QAAA,CAAA,EAEJ,WAAA,CAAY,QAFR;EAMJ,UAAA,CAAA,EAAA,MAAA;;
|
|
1
|
+
{"version":3,"file":"google-calendar.d.ts","names":[],"sources":["../../../../src/integrations/providers/impls/google-calendar.ts"],"sourcesContent":[],"mappings":";;;;UAWiB,6BAAA;QACT,WAAA,CAAY;EADH,QAAA,CAAA,EAEJ,WAAA,CAAY,QAFR;EAMJ,UAAA,CAAA,EAAA,MAAA;;AAiBF,cAjBE,sBAAA,YAAkC,gBAiBpC,CAAA;EACE,iBAAA,QAAA;EAAR,iBAAA,iBAAA;EAuBsB,iBAAA,IAAA;EAA6B,WAAA,CAAA,OAAA,EApCjC,6BAoCiC;EAAR,UAAA,CAAA,KAAA,EAxBrC,uBAwBqC,CAAA,EAvB3C,OAuB2C,CAvBnC,wBAuBmC,CAAA;EAcrC,WAAA,CAAA,KAAA,EAdgB,kBAchB,CAAA,EAdqC,OAcrC,CAd6C,aAc7C,CAAA;EACE,WAAA,CAAA,UAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,KAAA,EADF,wBACE,CAAA,EAAR,OAAQ,CAAA,aAAA,CAAA;EAAR,WAAA,CAAA,UAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,CAAA,EAWqD,OAXrD,CAAA,IAAA,CAAA;EAWqD,QAAA,eAAA;EAnEX,QAAA,aAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-calendar.js","names":["event: calendar_v3.Schema$Event","metadata: Record<string, string>"],"sources":["../../../../src/integrations/providers/impls/google-calendar.ts"],"sourcesContent":["import { google, type calendar_v3 } from 'googleapis';\n\nimport type {\n CalendarEvent,\n CalendarEventInput,\n CalendarEventUpdateInput,\n CalendarListEventsQuery,\n CalendarListEventsResult,\n CalendarProvider,\n} from '../calendar';\n\nexport interface GoogleCalendarProviderOptions {\n auth: calendar_v3.Options['auth'];\n calendar?: calendar_v3.Calendar;\n calendarId?: string;\n}\n\nexport class GoogleCalendarProvider implements CalendarProvider {\n private readonly calendar: calendar_v3.Calendar;\n private readonly defaultCalendarId: string;\n private readonly auth: calendar_v3.Options['auth'];\n\n constructor(options: GoogleCalendarProviderOptions) {\n this.auth = options.auth;\n this.calendar =\n options.calendar ??\n google.calendar({\n version: 'v3',\n auth: options.auth,\n });\n this.defaultCalendarId = options.calendarId ?? 'primary';\n }\n\n async listEvents(query: CalendarListEventsQuery): Promise<CalendarListEventsResult> {\n const response = await this.calendar.events.list({\n calendarId: query.calendarId ?? this.defaultCalendarId,\n timeMin: query.timeMin?.toISOString(),\n timeMax: query.timeMax?.toISOString(),\n maxResults: query.maxResults,\n pageToken: query.pageToken,\n singleEvents: true,\n orderBy: 'startTime',\n auth: this.auth,\n });\n\n const events =\n response.data.items?.map((item) =>\n this.fromGoogleEvent(query.calendarId ?? this.defaultCalendarId, item)\n ) ?? [];\n\n return {\n events,\n nextPageToken: response.data.nextPageToken ?? undefined,\n };\n }\n\n async createEvent(input: CalendarEventInput): Promise<CalendarEvent> {\n const calendarId = input.calendarId ?? this.defaultCalendarId;\n const response = await this.calendar.events.insert({\n calendarId,\n requestBody: this.toGoogleEvent(input),\n conferenceDataVersion: input.conference?.create ? 1 : undefined,\n auth: this.auth,\n });\n return this.fromGoogleEvent(calendarId, response.data);\n }\n\n async updateEvent(\n calendarId: string,\n eventId: string,\n input: CalendarEventUpdateInput\n ): Promise<CalendarEvent> {\n const response = await this.calendar.events.patch({\n calendarId: calendarId ?? this.defaultCalendarId,\n eventId,\n requestBody: this.toGoogleEvent(input),\n conferenceDataVersion: input.conference?.create ? 1 : undefined,\n auth: this.auth,\n });\n return this.fromGoogleEvent(calendarId, response.data);\n }\n\n async deleteEvent(calendarId: string, eventId: string): Promise<void> {\n await this.calendar.events.delete({\n calendarId: calendarId ?? this.defaultCalendarId,\n eventId,\n auth: this.auth,\n });\n }\n\n private fromGoogleEvent(\n calendarId: string,\n event: calendar_v3.Schema$Event\n ): CalendarEvent {\n const start = parseDateTime(event.start);\n const end = parseDateTime(event.end);\n const attendees =\n event.attendees?.map((attendee) => ({\n email: attendee.email ?? '',\n name: attendee.displayName ?? undefined,\n optional: attendee.optional ?? undefined,\n responseStatus: normalizeResponseStatus(attendee.responseStatus),\n })) ?? [];\n const reminders =\n event.reminders?.overrides?.map((reminder) => ({\n method: (reminder.method as 'email' | 'popup') ?? 'popup',\n minutesBeforeStart: reminder.minutes ?? 0,\n })) ?? [];\n const metadata = buildMetadata(event);\n return {\n id: event.id ?? '',\n calendarId,\n title: event.summary ?? '',\n description: event.description ?? undefined,\n location: event.location ?? undefined,\n start,\n end,\n allDay: event.start?.date ? true : undefined,\n attendees,\n reminders,\n conferenceLink:\n event.hangoutLink ??\n event.conferenceData?.entryPoints?.find((entry) => entry.uri)?.uri ??\n undefined,\n metadata,\n createdAt: event.created ? new Date(event.created) : undefined,\n updatedAt: event.updated ? new Date(event.updated) : undefined,\n };\n }\n\n private toGoogleEvent(\n input: CalendarEventInput | CalendarEventUpdateInput\n ): calendar_v3.Schema$Event {\n const event: calendar_v3.Schema$Event = {};\n if ('title' in input && input.title) event.summary = input.title;\n if (input.description !== undefined) event.description = input.description;\n if (input.location !== undefined) event.location = input.location;\n if (input.start) {\n event.start = formatDateTime(input.start, input.allDay);\n }\n if (input.end) {\n event.end = formatDateTime(input.end, input.allDay);\n }\n if (input.attendees) {\n event.attendees = input.attendees.map((attendee) => ({\n email: attendee.email,\n displayName: attendee.name,\n optional: attendee.optional,\n responseStatus: attendee.responseStatus,\n }));\n }\n if (input.reminders) {\n event.reminders = {\n useDefault: false,\n overrides: input.reminders.map((reminder) => ({\n method: reminder.method,\n minutes: reminder.minutesBeforeStart,\n })),\n };\n }\n if (input.conference?.create) {\n event.conferenceData = {\n createRequest: {\n requestId: `conf-${Date.now()}`,\n },\n };\n }\n if (input.metadata) {\n event.extendedProperties = {\n ...(event.extendedProperties ?? {}),\n private: {\n ...(event.extendedProperties?.private ?? {}),\n ...input.metadata,\n },\n };\n }\n return event;\n }\n}\n\nfunction parseDateTime(\n time?: calendar_v3.Schema$EventDateTime | null\n): Date {\n if (!time) return new Date();\n if (time.dateTime) return new Date(time.dateTime);\n if (time.date) return new Date(`${time.date}T00:00:00`);\n return new Date();\n}\n\nfunction formatDateTime(date: Date, allDay?: boolean): calendar_v3.Schema$EventDateTime {\n if (allDay) {\n return { date: date.toISOString().slice(0, 10) };\n }\n return { dateTime: date.toISOString() };\n}\n\ntype CalendarResponseStatus = 'needsAction' | 'declined' | 'tentative' | 'accepted';\n\nfunction normalizeResponseStatus(\n status?: string | null\n): CalendarResponseStatus | undefined {\n if (!status) return undefined;\n const allowed: CalendarResponseStatus[] = [\n 'needsAction',\n 'declined',\n 'tentative',\n 'accepted',\n ];\n return allowed.includes(status as CalendarResponseStatus)\n ? (status as CalendarResponseStatus)\n : undefined;\n}\n\nfunction buildMetadata(event: calendar_v3.Schema$Event): Record<string, string> | undefined {\n const metadata: Record<string, string> = {};\n if (event.status) metadata.status = event.status;\n if (event.htmlLink) metadata.htmlLink = event.htmlLink;\n if (event.iCalUID) metadata.iCalUID = event.iCalUID;\n if (event.etag) metadata.etag = event.etag;\n if (event.conferenceData?.conferenceSolution?.name) {\n metadata.conferenceSolution = event.conferenceData.conferenceSolution.name;\n }\n if (event.extendedProperties?.private) {\n Object.entries(event.extendedProperties.private).forEach(([key, value]) => {\n if (typeof value === 'string') {\n metadata[`extended.${key}`] = value;\n }\n });\n }\n return Object.keys(metadata).length > 0 ? metadata : undefined;\n}\n\n\n"],"mappings":"oCAiBA,IAAa,EAAb,KAAgE,CAC9D,SACA,kBACA,KAEA,YAAY,EAAwC,CAClD,KAAK,KAAO,EAAQ,KACpB,KAAK,SACH,EAAQ,UACR,EAAO,SAAS,CACd,QAAS,KACT,KAAM,EAAQ,KACf,CAAC,CACJ,KAAK,kBAAoB,EAAQ,YAAc,UAGjD,MAAM,WAAW,EAAmE,CAClF,IAAM,EAAW,MAAM,KAAK,SAAS,OAAO,KAAK,CAC/C,WAAY,EAAM,YAAc,KAAK,kBACrC,QAAS,EAAM,SAAS,aAAa,CACrC,QAAS,EAAM,SAAS,aAAa,CACrC,WAAY,EAAM,WAClB,UAAW,EAAM,UACjB,aAAc,GACd,QAAS,YACT,KAAM,KAAK,KACZ,CAAC,CAOF,MAAO,CACL,OALA,EAAS,KAAK,OAAO,IAAK,GACxB,KAAK,gBAAgB,EAAM,YAAc,KAAK,kBAAmB,EAAK,CACvE,EAAI,EAAE,CAIP,cAAe,EAAS,KAAK,eAAiB,IAAA,GAC/C,CAGH,MAAM,YAAY,EAAmD,CACnE,IAAM,EAAa,EAAM,YAAc,KAAK,kBACtC,EAAW,MAAM,KAAK,SAAS,OAAO,OAAO,CACjD,aACA,YAAa,KAAK,cAAc,EAAM,CACtC,sBAAuB,EAAM,YAAY,OAAS,EAAI,IAAA,GACtD,KAAM,KAAK,KACZ,CAAC,CACF,OAAO,KAAK,gBAAgB,EAAY,EAAS,KAAK,CAGxD,MAAM,YACJ,EACA,EACA,EACwB,CACxB,IAAM,EAAW,MAAM,KAAK,SAAS,OAAO,MAAM,CAChD,WAAY,GAAc,KAAK,kBAC/B,UACA,YAAa,KAAK,cAAc,EAAM,CACtC,sBAAuB,EAAM,YAAY,OAAS,EAAI,IAAA,GACtD,KAAM,KAAK,KACZ,CAAC,CACF,OAAO,KAAK,gBAAgB,EAAY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,mBAAmB,MAEpE,EAAM,oBAAoB,SAC5B,OAAO,QAAQ,EAAM,mBAAmB,QAAQ,CAAC,SAAS,CAAC,EAAK,KAAW,CACrE,OAAO,GAAU,WACnB,EAAS,YAAY,KAAS,IAEhC,CAEG,OAAO,KAAK,EAAS,CAAC,OAAS,EAAI,EAAW,IAAA"}
|
|
1
|
+
{"version":3,"file":"google-calendar.js","names":["event: calendar_v3.Schema$Event","metadata: Record<string, string>"],"sources":["../../../../src/integrations/providers/impls/google-calendar.ts"],"sourcesContent":["import { google, type calendar_v3 } from 'googleapis';\n\nimport type {\n CalendarEvent,\n CalendarEventInput,\n CalendarEventUpdateInput,\n CalendarListEventsQuery,\n CalendarListEventsResult,\n CalendarProvider,\n} from '../calendar';\n\nexport interface GoogleCalendarProviderOptions {\n auth: calendar_v3.Options['auth'];\n calendar?: calendar_v3.Calendar;\n calendarId?: string;\n}\n\nexport class GoogleCalendarProvider implements CalendarProvider {\n private readonly calendar: calendar_v3.Calendar;\n private readonly defaultCalendarId: string;\n private readonly auth: calendar_v3.Options['auth'];\n\n constructor(options: GoogleCalendarProviderOptions) {\n this.auth = options.auth;\n this.calendar =\n options.calendar ??\n google.calendar({\n version: 'v3',\n auth: options.auth,\n });\n this.defaultCalendarId = options.calendarId ?? 'primary';\n }\n\n async listEvents(\n query: CalendarListEventsQuery\n ): Promise<CalendarListEventsResult> {\n const response = await this.calendar.events.list({\n calendarId: query.calendarId ?? this.defaultCalendarId,\n timeMin: query.timeMin?.toISOString(),\n timeMax: query.timeMax?.toISOString(),\n maxResults: query.maxResults,\n pageToken: query.pageToken,\n singleEvents: true,\n orderBy: 'startTime',\n auth: this.auth,\n });\n\n const events =\n response.data.items?.map((item) =>\n this.fromGoogleEvent(query.calendarId ?? this.defaultCalendarId, item)\n ) ?? [];\n\n return {\n events,\n nextPageToken: response.data.nextPageToken ?? undefined,\n };\n }\n\n async createEvent(input: CalendarEventInput): Promise<CalendarEvent> {\n const calendarId = input.calendarId ?? this.defaultCalendarId;\n const response = await this.calendar.events.insert({\n calendarId,\n requestBody: this.toGoogleEvent(input),\n conferenceDataVersion: input.conference?.create ? 1 : undefined,\n auth: this.auth,\n });\n return this.fromGoogleEvent(calendarId, response.data);\n }\n\n async updateEvent(\n calendarId: string,\n eventId: string,\n input: CalendarEventUpdateInput\n ): Promise<CalendarEvent> {\n const response = await this.calendar.events.patch({\n calendarId: calendarId ?? this.defaultCalendarId,\n eventId,\n requestBody: this.toGoogleEvent(input),\n conferenceDataVersion: input.conference?.create ? 1 : undefined,\n auth: this.auth,\n });\n return this.fromGoogleEvent(calendarId, response.data);\n }\n\n async deleteEvent(calendarId: string, eventId: string): Promise<void> {\n await this.calendar.events.delete({\n calendarId: calendarId ?? this.defaultCalendarId,\n eventId,\n auth: this.auth,\n });\n }\n\n private fromGoogleEvent(\n calendarId: string,\n event: calendar_v3.Schema$Event\n ): CalendarEvent {\n const start = parseDateTime(event.start);\n const end = parseDateTime(event.end);\n const attendees =\n event.attendees?.map((attendee) => ({\n email: attendee.email ?? '',\n name: attendee.displayName ?? undefined,\n optional: attendee.optional ?? undefined,\n responseStatus: normalizeResponseStatus(attendee.responseStatus),\n })) ?? [];\n const reminders =\n event.reminders?.overrides?.map((reminder) => ({\n method: (reminder.method as 'email' | 'popup') ?? 'popup',\n minutesBeforeStart: reminder.minutes ?? 0,\n })) ?? [];\n const metadata = buildMetadata(event);\n return {\n id: event.id ?? '',\n calendarId,\n title: event.summary ?? '',\n description: event.description ?? undefined,\n location: event.location ?? undefined,\n start,\n end,\n allDay: event.start?.date ? true : undefined,\n attendees,\n reminders,\n conferenceLink:\n event.hangoutLink ??\n event.conferenceData?.entryPoints?.find((entry) => entry.uri)?.uri ??\n undefined,\n metadata,\n createdAt: event.created ? new Date(event.created) : undefined,\n updatedAt: event.updated ? new Date(event.updated) : undefined,\n };\n }\n\n private toGoogleEvent(\n input: CalendarEventInput | CalendarEventUpdateInput\n ): calendar_v3.Schema$Event {\n const event: calendar_v3.Schema$Event = {};\n if ('title' in input && input.title) event.summary = input.title;\n if (input.description !== undefined) event.description = input.description;\n if (input.location !== undefined) event.location = input.location;\n if (input.start) {\n event.start = formatDateTime(input.start, input.allDay);\n }\n if (input.end) {\n event.end = formatDateTime(input.end, input.allDay);\n }\n if (input.attendees) {\n event.attendees = input.attendees.map((attendee) => ({\n email: attendee.email,\n displayName: attendee.name,\n optional: attendee.optional,\n responseStatus: attendee.responseStatus,\n }));\n }\n if (input.reminders) {\n event.reminders = {\n useDefault: false,\n overrides: input.reminders.map((reminder) => ({\n method: reminder.method,\n minutes: reminder.minutesBeforeStart,\n })),\n };\n }\n if (input.conference?.create) {\n event.conferenceData = {\n createRequest: {\n requestId: `conf-${Date.now()}`,\n },\n };\n }\n if (input.metadata) {\n event.extendedProperties = {\n ...(event.extendedProperties ?? {}),\n private: {\n ...(event.extendedProperties?.private ?? {}),\n ...input.metadata,\n },\n };\n }\n return event;\n }\n}\n\nfunction parseDateTime(time?: calendar_v3.Schema$EventDateTime | null): Date {\n if (!time) return new Date();\n if (time.dateTime) return new Date(time.dateTime);\n if (time.date) return new Date(`${time.date}T00:00:00`);\n return new Date();\n}\n\nfunction formatDateTime(\n date: Date,\n allDay?: boolean\n): calendar_v3.Schema$EventDateTime {\n if (allDay) {\n return { date: date.toISOString().slice(0, 10) };\n }\n return { dateTime: date.toISOString() };\n}\n\ntype CalendarResponseStatus =\n | 'needsAction'\n | 'declined'\n | 'tentative'\n | 'accepted';\n\nfunction normalizeResponseStatus(\n status?: string | null\n): CalendarResponseStatus | undefined {\n if (!status) return undefined;\n const allowed: CalendarResponseStatus[] = [\n 'needsAction',\n 'declined',\n 'tentative',\n 'accepted',\n ];\n return allowed.includes(status as CalendarResponseStatus)\n ? (status as CalendarResponseStatus)\n : undefined;\n}\n\nfunction buildMetadata(\n event: calendar_v3.Schema$Event\n): Record<string, string> | undefined {\n const metadata: Record<string, string> = {};\n if (event.status) metadata.status = event.status;\n if (event.htmlLink) metadata.htmlLink = event.htmlLink;\n if (event.iCalUID) metadata.iCalUID = event.iCalUID;\n if (event.etag) metadata.etag = event.etag;\n if (event.conferenceData?.conferenceSolution?.name) {\n metadata.conferenceSolution = event.conferenceData.conferenceSolution.name;\n }\n if (event.extendedProperties?.private) {\n Object.entries(event.extendedProperties.private).forEach(([key, value]) => {\n if (typeof value === 'string') {\n metadata[`extended.${key}`] = value;\n }\n });\n }\n return Object.keys(metadata).length > 0 ? metadata : undefined;\n}\n"],"mappings":"oCAiBA,IAAa,EAAb,KAAgE,CAC9D,SACA,kBACA,KAEA,YAAY,EAAwC,CAClD,KAAK,KAAO,EAAQ,KACpB,KAAK,SACH,EAAQ,UACR,EAAO,SAAS,CACd,QAAS,KACT,KAAM,EAAQ,KACf,CAAC,CACJ,KAAK,kBAAoB,EAAQ,YAAc,UAGjD,MAAM,WACJ,EACmC,CACnC,IAAM,EAAW,MAAM,KAAK,SAAS,OAAO,KAAK,CAC/C,WAAY,EAAM,YAAc,KAAK,kBACrC,QAAS,EAAM,SAAS,aAAa,CACrC,QAAS,EAAM,SAAS,aAAa,CACrC,WAAY,EAAM,WAClB,UAAW,EAAM,UACjB,aAAc,GACd,QAAS,YACT,KAAM,KAAK,KACZ,CAAC,CAOF,MAAO,CACL,OALA,EAAS,KAAK,OAAO,IAAK,GACxB,KAAK,gBAAgB,EAAM,YAAc,KAAK,kBAAmB,EAAK,CACvE,EAAI,EAAE,CAIP,cAAe,EAAS,KAAK,eAAiB,IAAA,GAC/C,CAGH,MAAM,YAAY,EAAmD,CACnE,IAAM,EAAa,EAAM,YAAc,KAAK,kBACtC,EAAW,MAAM,KAAK,SAAS,OAAO,OAAO,CACjD,aACA,YAAa,KAAK,cAAc,EAAM,CACtC,sBAAuB,EAAM,YAAY,OAAS,EAAI,IAAA,GACtD,KAAM,KAAK,KACZ,CAAC,CACF,OAAO,KAAK,gBAAgB,EAAY,EAAS,KAAK,CAGxD,MAAM,YACJ,EACA,EACA,EACwB,CACxB,IAAM,EAAW,MAAM,KAA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,OAAS,EAAM,QACtC,EAAM,WAAU,EAAS,SAAW,EAAM,UAC1C,EAAM,UAAS,EAAS,QAAU,EAAM,SACxC,EAAM,OAAM,EAAS,KAAO,EAAM,MAClC,EAAM,gBAAgB,oBAAoB,OAC5C,EAAS,mBAAqB,EAAM,eAAe,mBAAmB,MAEpE,EAAM,oBAAoB,SAC5B,OAAO,QAAQ,EAAM,mBAAmB,QAAQ,CAAC,SAAS,CAAC,EAAK,KAAW,CACrE,OAAO,GAAU,WACnB,EAAS,YAAY,KAAS,IAEhC,CAEG,OAAO,KAAK,EAAS,CAAC,OAAS,EAAI,EAAW,IAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mistral-embedding.js","names":[],"sources":["../../../../src/integrations/providers/impls/mistral-embedding.ts"],"sourcesContent":["import { Mistral } from '@mistralai/mistralai';\n\nimport type {\n EmbeddingDocument,\n EmbeddingProvider,\n EmbeddingResult,\n} from '../embedding';\n\nexport interface MistralEmbeddingProviderOptions {\n apiKey: string;\n defaultModel?: string;\n serverURL?: string;\n client?: Mistral;\n}\n\nexport class MistralEmbeddingProvider implements EmbeddingProvider {\n private readonly client: Mistral;\n private readonly defaultModel: string;\n\n constructor(options: MistralEmbeddingProviderOptions) {\n if (!options.apiKey) {\n throw new Error('MistralEmbeddingProvider requires an apiKey');\n }\n\n this.client =\n options.client ??\n new Mistral({\n apiKey: options.apiKey,\n serverURL: options.serverURL,\n });\n this.defaultModel = options.defaultModel ?? 'mistral-embed';\n }\n\n async embedDocuments(\n documents: EmbeddingDocument[],\n options?: { model?: string }\n ): Promise<EmbeddingResult[]> {\n if (documents.length === 0) return [];\n const model = options?.model ?? this.defaultModel;\n const response = await this.client.embeddings.create({\n model,\n inputs: documents.map((doc) => doc.text),\n });\n\n return response.data.map((item, index) => ({\n id:\n documents[index]?.id ??\n (item.index != null ? `embedding-${item.index}` : `embedding-${index}`),\n vector: item.embedding ?? [],\n dimensions: item.embedding?.length ?? 0,\n model: response.model,\n metadata: documents[index]?.metadata\n ? Object.fromEntries(\n Object.entries(documents[index]?.metadata ?? {}).map(\n ([key, value]) => [key, String(value)]\n )\n )\n : undefined,\n }));\n }\n\n async embedQuery(\n query: string,\n options?: { model?: string }\n ): Promise<EmbeddingResult> {\n const [result] = await this.embedDocuments(\n [{ id: 'query', text: query }],\n options\n );\n if (!result) {\n throw new Error('Failed to compute embedding for query');\n }\n return result;\n }\n}\n
|
|
1
|
+
{"version":3,"file":"mistral-embedding.js","names":[],"sources":["../../../../src/integrations/providers/impls/mistral-embedding.ts"],"sourcesContent":["import { Mistral } from '@mistralai/mistralai';\n\nimport type {\n EmbeddingDocument,\n EmbeddingProvider,\n EmbeddingResult,\n} from '../embedding';\n\nexport interface MistralEmbeddingProviderOptions {\n apiKey: string;\n defaultModel?: string;\n serverURL?: string;\n client?: Mistral;\n}\n\nexport class MistralEmbeddingProvider implements EmbeddingProvider {\n private readonly client: Mistral;\n private readonly defaultModel: string;\n\n constructor(options: MistralEmbeddingProviderOptions) {\n if (!options.apiKey) {\n throw new Error('MistralEmbeddingProvider requires an apiKey');\n }\n\n this.client =\n options.client ??\n new Mistral({\n apiKey: options.apiKey,\n serverURL: options.serverURL,\n });\n this.defaultModel = options.defaultModel ?? 'mistral-embed';\n }\n\n async embedDocuments(\n documents: EmbeddingDocument[],\n options?: { model?: string }\n ): Promise<EmbeddingResult[]> {\n if (documents.length === 0) return [];\n const model = options?.model ?? this.defaultModel;\n const response = await this.client.embeddings.create({\n model,\n inputs: documents.map((doc) => doc.text),\n });\n\n return response.data.map((item, index) => ({\n id:\n documents[index]?.id ??\n (item.index != null ? `embedding-${item.index}` : `embedding-${index}`),\n vector: item.embedding ?? [],\n dimensions: item.embedding?.length ?? 0,\n model: response.model,\n metadata: documents[index]?.metadata\n ? Object.fromEntries(\n Object.entries(documents[index]?.metadata ?? {}).map(\n ([key, value]) => [key, String(value)]\n )\n )\n : undefined,\n }));\n }\n\n async embedQuery(\n query: string,\n options?: { model?: string }\n ): Promise<EmbeddingResult> {\n const [result] = await this.embedDocuments(\n [{ id: 'query', text: query }],\n options\n );\n if (!result) {\n throw new Error('Failed to compute embedding for query');\n }\n return result;\n }\n}\n"],"mappings":"+CAeA,IAAa,EAAb,KAAmE,CACjE,OACA,aAEA,YAAY,EAA0C,CACpD,GAAI,CAAC,EAAQ,OACX,MAAU,MAAM,8CAA8C,CAGhE,KAAK,OACH,EAAQ,QACR,IAAI,EAAQ,CACV,OAAQ,EAAQ,OAChB,UAAW,EAAQ,UACpB,CAAC,CACJ,KAAK,aAAe,EAAQ,cAAgB,gBAG9C,MAAM,eACJ,EACA,EAC4B,CAC5B,GAAI,EAAU,SAAW,EAAG,MAAO,EAAE,CACrC,IAAM,EAAQ,GAAS,OAAS,KAAK,aAC/B,EAAW,MAAM,KAAK,OAAO,WAAW,OAAO,CACnD,QACA,OAAQ,EAAU,IAAK,GAAQ,EAAI,KAAK,CACzC,CAAC,CAEF,OAAO,EAAS,KAAK,KAAK,EAAM,KAAW,CACzC,GACE,EAAU,IAAQ,KACjB,EAAK,OAAS,KAAmC,aAAa,IAAzC,aAAa,EAAK,SAC1C,OAAQ,EAAK,WAAa,EAAE,CAC5B,WAAY,EAAK,WAAW,QAAU,EACtC,MAAO,EAAS,MAChB,SAAU,EAAU,IAAQ,SACxB,OAAO,YACL,OAAO,QAAQ,EAAU,IAAQ,UAAY,EAAE,CAAC,CAAC,KAC9C,CAAC,EAAK,KAAW,CAAC,EAAK,OAAO,EAAM,CAAC,CACvC,CACF,CACD,IAAA,GACL,EAAE,CAGL,MAAM,WACJ,EACA,EAC0B,CAC1B,GAAM,CAAC,GAAU,MAAM,KAAK,eAC1B,CAAC,CAAE,GAAI,QAAS,KAAM,EAAO,CAAC,CAC9B,EACD,CACD,GAAI,CAAC,EACH,MAAU,MAAM,wCAAwC,CAE1D,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mistral-llm.js","names":["aggregatedParts: LLMContentPart[]","aggregatedToolCalls: LLMToolCallPart[]","usage: LLMTokenUsage | undefined","finishReason: string | undefined","message: LLMMessage","request: components.ChatCompletionRequest","parts: LLMContentPart[]"],"sources":["../../../../src/integrations/providers/impls/mistral-llm.ts"],"sourcesContent":["import { Mistral } from '@mistralai/mistralai';\nimport type * as components from '@mistralai/mistralai/models/components/index.js';\n\nimport type {\n LLMChatOptions,\n LLMContentPart,\n LLMMessage,\n LLMProvider,\n LLMResponse,\n LLMStreamChunk,\n LLMToolCallPart,\n LLMTokenUsage,\n} from '../llm';\n\nexport interface MistralLLMProviderOptions {\n apiKey: string;\n defaultModel?: string;\n serverURL?: string;\n client?: Mistral;\n userAgentSuffix?: string;\n}\n\nexport class MistralLLMProvider implements LLMProvider {\n private readonly client: Mistral;\n private readonly defaultModel: string;\n\n constructor(options: MistralLLMProviderOptions) {\n if (!options.apiKey) {\n throw new Error('MistralLLMProvider requires an apiKey');\n }\n\n this.client =\n options.client ??\n new Mistral({\n apiKey: options.apiKey,\n serverURL: options.serverURL,\n userAgent: options.userAgentSuffix\n ? `${options.userAgentSuffix}`\n : undefined,\n });\n this.defaultModel = options.defaultModel ?? 'mistral-large-latest';\n }\n\n async chat(\n messages: LLMMessage[],\n options: LLMChatOptions = {}\n ): Promise<LLMResponse> {\n const request = this.buildChatRequest(messages, options);\n const response = await this.client.chat.complete(request);\n return this.buildLLMResponse(response);\n }\n\n async *stream(\n messages: LLMMessage[],\n options: LLMChatOptions = {}\n ): AsyncIterable<LLMStreamChunk> {\n const request = this.buildChatRequest(messages, options);\n request.stream = true;\n const stream = await this.client.chat.stream(request);\n\n const aggregatedParts: LLMContentPart[] = [];\n const aggregatedToolCalls: LLMToolCallPart[] = [];\n let usage: LLMTokenUsage | undefined;\n let finishReason: string | undefined;\n\n for await (const event of stream) {\n for (const choice of event.data.choices) {\n const delta = choice.delta;\n if (typeof delta.content === 'string') {\n if (delta.content.length > 0) {\n aggregatedParts.push({ type: 'text', text: delta.content });\n yield {\n type: 'message_delta',\n delta: { type: 'text', text: delta.content },\n index: choice.index,\n };\n }\n } else if (Array.isArray(delta.content)) {\n for (const chunk of delta.content) {\n if (chunk.type === 'text' && 'text' in chunk) {\n aggregatedParts.push({ type: 'text', text: chunk.text });\n yield {\n type: 'message_delta',\n delta: { type: 'text', text: chunk.text },\n index: choice.index,\n };\n }\n }\n }\n\n if (delta.toolCalls) {\n let localIndex = 0;\n for (const call of delta.toolCalls) {\n const toolCall = this.fromMistralToolCall(call, localIndex);\n aggregatedToolCalls.push(toolCall);\n yield {\n type: 'tool_call',\n call: toolCall,\n index: choice.index,\n };\n localIndex += 1;\n }\n }\n\n if (choice.finishReason && choice.finishReason !== 'null') {\n finishReason = choice.finishReason;\n }\n }\n\n if (event.data.usage) {\n const usageEntry = this.fromUsage(event.data.usage);\n if (usageEntry) {\n usage = usageEntry;\n yield { type: 'usage', usage: usageEntry };\n }\n }\n }\n\n const message: LLMMessage = {\n role: 'assistant',\n content: aggregatedParts.length\n ? aggregatedParts\n : [{ type: 'text', text: '' }],\n };\n if (aggregatedToolCalls.length > 0) {\n message.content = [\n ...aggregatedToolCalls,\n ...(aggregatedParts.length ? aggregatedParts : []),\n ];\n }\n\n yield {\n type: 'end',\n response: {\n message,\n usage,\n finishReason: mapFinishReason(finishReason),\n },\n };\n }\n\n async countTokens(messages: LLMMessage[]): Promise<{ promptTokens: number }> {\n throw new Error('Mistral API does not currently support token counting');\n }\n\n private buildChatRequest(\n messages: LLMMessage[],\n options: LLMChatOptions\n ): components.ChatCompletionRequest {\n const model = options.model ?? this.defaultModel;\n const mappedMessages = messages.map((message) =>\n this.toMistralMessage(message)\n );\n\n const request: components.ChatCompletionRequest = {\n model,\n messages: mappedMessages,\n };\n\n if (options.temperature != null) {\n request.temperature = options.temperature;\n }\n if (options.topP != null) {\n request.topP = options.topP;\n }\n if (options.maxOutputTokens != null) {\n request.maxTokens = options.maxOutputTokens;\n }\n if (options.stopSequences?.length) {\n request.stop =\n options.stopSequences.length === 1\n ? options.stopSequences[0]\n : options.stopSequences;\n }\n if (options.tools?.length) {\n request.tools = options.tools.map((tool) => ({\n type: 'function',\n function: {\n name: tool.name,\n description: tool.description,\n parameters:\n typeof tool.inputSchema === 'object' && tool.inputSchema !== null\n ? tool.inputSchema\n : {},\n },\n }));\n }\n if (options.responseFormat === 'json') {\n request.responseFormat = { type: 'json_object' };\n }\n\n return request;\n }\n\n private buildLLMResponse(\n response: components.ChatCompletionResponse\n ): LLMResponse {\n const firstChoice = response.choices[0];\n if (!firstChoice) {\n return {\n message: {\n role: 'assistant',\n content: [{ type: 'text', text: '' }],\n },\n usage: this.fromUsage(response.usage),\n raw: response,\n };\n }\n const message = this.fromAssistantMessage(firstChoice.message);\n return {\n message,\n usage: this.fromUsage(response.usage),\n finishReason: mapFinishReason(firstChoice.finishReason),\n raw: response,\n };\n }\n\n private fromUsage(usage: components.UsageInfo | undefined): LLMTokenUsage | undefined {\n if (!usage) return undefined;\n return {\n promptTokens: usage.promptTokens ?? 0,\n completionTokens: usage.completionTokens ?? 0,\n totalTokens: usage.totalTokens ?? 0,\n };\n }\n\n private fromAssistantMessage(\n message: components.AssistantMessage\n ): LLMMessage {\n const parts: LLMContentPart[] = [];\n if (typeof message.content === 'string') {\n parts.push({ type: 'text', text: message.content });\n } else if (Array.isArray(message.content)) {\n message.content.forEach((chunk) => {\n if (chunk.type === 'text' && 'text' in chunk) {\n parts.push({ type: 'text', text: chunk.text });\n }\n });\n }\n\n const toolCalls =\n message.toolCalls?.map((call, index) =>\n this.fromMistralToolCall(call, index)\n ) ?? [];\n\n if (toolCalls.length > 0) {\n parts.splice(0, 0, ...toolCalls);\n }\n\n if (parts.length === 0) {\n parts.push({ type: 'text', text: '' });\n }\n\n return {\n role: 'assistant',\n content: parts,\n };\n }\n\n private fromMistralToolCall(\n call: components.ToolCall,\n index: number\n ): LLMToolCallPart {\n const args =\n typeof call.function.arguments === 'string'\n ? call.function.arguments\n : JSON.stringify(call.function.arguments);\n return {\n type: 'tool-call',\n id: call.id ?? `tool-call-${index}`,\n name: call.function.name,\n arguments: args,\n };\n }\n\n private toMistralMessage(message: LLMMessage): components.Messages {\n const textContent = this.extractText(message.content);\n const toolCalls = this.extractToolCalls(message);\n\n switch (message.role) {\n case 'system':\n return {\n role: 'system',\n content: textContent ?? '',\n };\n case 'user':\n return {\n role: 'user',\n content: textContent ?? '',\n };\n case 'assistant':\n return {\n role: 'assistant',\n content: toolCalls.length > 0 ? null : textContent ?? '',\n toolCalls: toolCalls.length > 0 ? toolCalls : undefined,\n };\n case 'tool':\n return {\n role: 'tool',\n content: textContent ?? '',\n toolCallId: message.toolCallId ?? toolCalls[0]?.id,\n };\n default:\n return {\n role: 'user',\n content: textContent ?? '',\n };\n }\n }\n\n private extractText(parts: LLMContentPart[]): string | null {\n const textParts = parts\n .filter((part) => part.type === 'text')\n .map((part) => (part as Extract<LLMContentPart, { type: 'text' }>).text);\n if (textParts.length === 0) return null;\n return textParts.join('');\n }\n\n private extractToolCalls(message: LLMMessage): components.ToolCall[] {\n const toolCallParts = message.content.filter(\n (part): part is LLMToolCallPart => part.type === 'tool-call'\n );\n return toolCallParts.map((call, index) => ({\n id: call.id ?? `call_${index}`,\n type: 'function',\n index,\n function: {\n name: call.name,\n arguments: call.arguments,\n },\n }));\n }\n}\n\nfunction mapFinishReason(\n reason?: string | null\n): LLMResponse['finishReason'] | undefined {\n if (!reason) return undefined;\n const normalized = reason.toLowerCase();\n switch (normalized) {\n case 'stop':\n return 'stop';\n case 'length':\n return 'length';\n case 'tool_call':\n case 'tool_calls':\n return 'tool_call';\n case 'content_filter':\n return 'content_filter';\n default:\n return undefined;\n }\n}\n\n\n"],"mappings":"+CAsBA,IAAa,EAAb,KAAuD,CACrD,OACA,aAEA,YAAY,EAAoC,CAC9C,GAAI,CAAC,EAAQ,OACX,MAAU,MAAM,wCAAwC,CAG1D,KAAK,OACH,EAAQ,QACR,IAAI,EAAQ,CACV,OAAQ,EAAQ,OAChB,UAAW,EAAQ,UACnB,UAAW,EAA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EAA0C,CACjE,IAAM,EAAc,KAAK,YAAY,EAAQ,QAAQ,CAC/C,EAAY,KAAK,iBAAiB,EAAQ,CAEhD,OAAQ,EAAQ,KAAhB,CACE,IAAK,SACH,MAAO,CACL,KAAM,SACN,QAAS,GAAe,GACzB,CACH,IAAK,OACH,MAAO,CACL,KAAM,OACN,QAAS,GAAe,GACzB,CACH,IAAK,YACH,MAAO,CACL,KAAM,YACN,QAAS,EAAU,OAAS,EAAI,KAAO,GAAe,GACtD,UAAW,EAAU,OAAS,EAAI,EAAY,IAAA,GAC/C,CACH,IAAK,OACH,MAAO,CACL,KAAM,OACN,QAAS,GAAe,GACxB,WAAY,EAAQ,YAAc,EAAU,IAAI,GACjD,CACH,QACE,MAAO,CACL,KAAM,OACN,QAAS,GAAe,GACzB,EAIP,YAAoB,EAAwC,CAC1D,IAAM,EAAY,EACf,OAAQ,GAAS,EAAK,OAAS,OAAO,CACtC,IAAK,GAAU,EAAmD,KAAK,CAE1E,OADI,EAAU,SAAW,EAAU,KAC5B,EAAU,KAAK,GAAG,CAG3B,iBAAyB,EAA4C,CAInE,OAHsB,EAAQ,QAAQ,OACnC,GAAkC,EAAK,OAAS,YAClD,CACoB,KAAK,EAAM,KAAW,CACzC,GAAI,EAAK,IAAM,QAAQ,IACvB,KAAM,WACN,QACA,SAAU,CACR,KAAM,EAAK,KACX,UAAW,EAAK,UACjB,CACF,EAAE,GAIP,SAAS,EACP,EACyC,CACpC,KAEL,OADmB,EAAO,aAAa,CACvC,CACE,IAAK,OACH,MAAO,OACT,IAAK,SACH,MAAO,SACT,IAAK,YACL,IAAK,aACH,MAAO,YACT,IAAK,iBACH,MAAO,iBACT,QACE"}
|
|
1
|
+
{"version":3,"file":"mistral-llm.js","names":["aggregatedParts: LLMContentPart[]","aggregatedToolCalls: LLMToolCallPart[]","usage: LLMTokenUsage | undefined","finishReason: string | undefined","message: LLMMessage","request: components.ChatCompletionRequest","parts: LLMContentPart[]"],"sources":["../../../../src/integrations/providers/impls/mistral-llm.ts"],"sourcesContent":["import { Mistral } from '@mistralai/mistralai';\nimport type * as components from '@mistralai/mistralai/models/components/index.js';\n\nimport type {\n LLMChatOptions,\n LLMContentPart,\n LLMMessage,\n LLMProvider,\n LLMResponse,\n LLMStreamChunk,\n LLMToolCallPart,\n LLMTokenUsage,\n} from '../llm';\n\nexport interface MistralLLMProviderOptions {\n apiKey: string;\n defaultModel?: string;\n serverURL?: string;\n client?: Mistral;\n userAgentSuffix?: string;\n}\n\nexport class MistralLLMProvider implements LLMProvider {\n private readonly client: Mistral;\n private readonly defaultModel: string;\n\n constructor(options: MistralLLMProviderOptions) {\n if (!options.apiKey) {\n throw new Error('MistralLLMProvider requires an apiKey');\n }\n\n this.client =\n options.client ??\n new Mistral({\n apiKey: options.apiKey,\n serverURL: options.serverURL,\n userAgent: options.userAgentSuffix\n ? `${options.userAgentSuffix}`\n : undefined,\n });\n this.defaultModel = options.defaultModel ?? 'mistral-large-latest';\n }\n\n async chat(\n messages: LLMMessage[],\n options: LLMChatOptions = {}\n ): Promise<LLMResponse> {\n const request = this.buildChatRequest(messages, options);\n const response = await this.client.chat.complete(request);\n return this.buildLLMResponse(response);\n }\n\n async *stream(\n messages: LLMMessage[],\n options: LLMChatOptions = {}\n ): AsyncIterable<LLMStreamChunk> {\n const request = this.buildChatRequest(messages, options);\n request.stream = true;\n const stream = await this.client.chat.stream(request);\n\n const aggregatedParts: LLMContentPart[] = [];\n const aggregatedToolCalls: LLMToolCallPart[] = [];\n let usage: LLMTokenUsage | undefined;\n let finishReason: string | undefined;\n\n for await (const event of stream) {\n for (const choice of event.data.choices) {\n const delta = choice.delta;\n if (typeof delta.content === 'string') {\n if (delta.content.length > 0) {\n aggregatedParts.push({ type: 'text', text: delta.content });\n yield {\n type: 'message_delta',\n delta: { type: 'text', text: delta.content },\n index: choice.index,\n };\n }\n } else if (Array.isArray(delta.content)) {\n for (const chunk of delta.content) {\n if (chunk.type === 'text' && 'text' in chunk) {\n aggregatedParts.push({ type: 'text', text: chunk.text });\n yield {\n type: 'message_delta',\n delta: { type: 'text', text: chunk.text },\n index: choice.index,\n };\n }\n }\n }\n\n if (delta.toolCalls) {\n let localIndex = 0;\n for (const call of delta.toolCalls) {\n const toolCall = this.fromMistralToolCall(call, localIndex);\n aggregatedToolCalls.push(toolCall);\n yield {\n type: 'tool_call',\n call: toolCall,\n index: choice.index,\n };\n localIndex += 1;\n }\n }\n\n if (choice.finishReason && choice.finishReason !== 'null') {\n finishReason = choice.finishReason;\n }\n }\n\n if (event.data.usage) {\n const usageEntry = this.fromUsage(event.data.usage);\n if (usageEntry) {\n usage = usageEntry;\n yield { type: 'usage', usage: usageEntry };\n }\n }\n }\n\n const message: LLMMessage = {\n role: 'assistant',\n content: aggregatedParts.length\n ? aggregatedParts\n : [{ type: 'text', text: '' }],\n };\n if (aggregatedToolCalls.length > 0) {\n message.content = [\n ...aggregatedToolCalls,\n ...(aggregatedParts.length ? aggregatedParts : []),\n ];\n }\n\n yield {\n type: 'end',\n response: {\n message,\n usage,\n finishReason: mapFinishReason(finishReason),\n },\n };\n }\n\n async countTokens(messages: LLMMessage[]): Promise<{ promptTokens: number }> {\n throw new Error('Mistral API does not currently support token counting');\n }\n\n private buildChatRequest(\n messages: LLMMessage[],\n options: LLMChatOptions\n ): components.ChatCompletionRequest {\n const model = options.model ?? this.defaultModel;\n const mappedMessages = messages.map((message) =>\n this.toMistralMessage(message)\n );\n\n const request: components.ChatCompletionRequest = {\n model,\n messages: mappedMessages,\n };\n\n if (options.temperature != null) {\n request.temperature = options.temperature;\n }\n if (options.topP != null) {\n request.topP = options.topP;\n }\n if (options.maxOutputTokens != null) {\n request.maxTokens = options.maxOutputTokens;\n }\n if (options.stopSequences?.length) {\n request.stop =\n options.stopSequences.length === 1\n ? options.stopSequences[0]\n : options.stopSequences;\n }\n if (options.tools?.length) {\n request.tools = options.tools.map((tool) => ({\n type: 'function',\n function: {\n name: tool.name,\n description: tool.description,\n parameters:\n typeof tool.inputSchema === 'object' && tool.inputSchema !== null\n ? tool.inputSchema\n : {},\n },\n }));\n }\n if (options.responseFormat === 'json') {\n request.responseFormat = { type: 'json_object' };\n }\n\n return request;\n }\n\n private buildLLMResponse(\n response: components.ChatCompletionResponse\n ): LLMResponse {\n const firstChoice = response.choices[0];\n if (!firstChoice) {\n return {\n message: {\n role: 'assistant',\n content: [{ type: 'text', text: '' }],\n },\n usage: this.fromUsage(response.usage),\n raw: response,\n };\n }\n const message = this.fromAssistantMessage(firstChoice.message);\n return {\n message,\n usage: this.fromUsage(response.usage),\n finishReason: mapFinishReason(firstChoice.finishReason),\n raw: response,\n };\n }\n\n private fromUsage(\n usage: components.UsageInfo | undefined\n ): LLMTokenUsage | undefined {\n if (!usage) return undefined;\n return {\n promptTokens: usage.promptTokens ?? 0,\n completionTokens: usage.completionTokens ?? 0,\n totalTokens: usage.totalTokens ?? 0,\n };\n }\n\n private fromAssistantMessage(\n message: components.AssistantMessage\n ): LLMMessage {\n const parts: LLMContentPart[] = [];\n if (typeof message.content === 'string') {\n parts.push({ type: 'text', text: message.content });\n } else if (Array.isArray(message.content)) {\n message.content.forEach((chunk) => {\n if (chunk.type === 'text' && 'text' in chunk) {\n parts.push({ type: 'text', text: chunk.text });\n }\n });\n }\n\n const toolCalls =\n message.toolCalls?.map((call, index) =>\n this.fromMistralToolCall(call, index)\n ) ?? [];\n\n if (toolCalls.length > 0) {\n parts.splice(0, 0, ...toolCalls);\n }\n\n if (parts.length === 0) {\n parts.push({ type: 'text', text: '' });\n }\n\n return {\n role: 'assistant',\n content: parts,\n };\n }\n\n private fromMistralToolCall(\n call: components.ToolCall,\n index: number\n ): LLMToolCallPart {\n const args =\n typeof call.function.arguments === 'string'\n ? call.function.arguments\n : JSON.stringify(call.function.arguments);\n return {\n type: 'tool-call',\n id: call.id ?? `tool-call-${index}`,\n name: call.function.name,\n arguments: args,\n };\n }\n\n private toMistralMessage(message: LLMMessage): components.Messages {\n const textContent = this.extractText(message.content);\n const toolCalls = this.extractToolCalls(message);\n\n switch (message.role) {\n case 'system':\n return {\n role: 'system',\n content: textContent ?? '',\n };\n case 'user':\n return {\n role: 'user',\n content: textContent ?? '',\n };\n case 'assistant':\n return {\n role: 'assistant',\n content: toolCalls.length > 0 ? null : (textContent ?? ''),\n toolCalls: toolCalls.length > 0 ? toolCalls : undefined,\n };\n case 'tool':\n return {\n role: 'tool',\n content: textContent ?? '',\n toolCallId: message.toolCallId ?? toolCalls[0]?.id,\n };\n default:\n return {\n role: 'user',\n content: textContent ?? '',\n };\n }\n }\n\n private extractText(parts: LLMContentPart[]): string | null {\n const textParts = parts\n .filter((part) => part.type === 'text')\n .map((part) => (part as Extract<LLMContentPart, { type: 'text' }>).text);\n if (textParts.length === 0) return null;\n return textParts.join('');\n }\n\n private extractToolCalls(message: LLMMessage): components.ToolCall[] {\n const toolCallParts = message.content.filter(\n (part): part is LLMToolCallPart => part.type === 'tool-call'\n );\n return toolCallParts.map((call, index) => ({\n id: call.id ?? `call_${index}`,\n type: 'function',\n index,\n function: {\n name: call.name,\n arguments: call.arguments,\n },\n }));\n }\n}\n\nfunction mapFinishReason(\n reason?: string | null\n): LLMResponse['finishReason'] | undefined {\n if (!reason) return undefined;\n const normalized = reason.toLowerCase();\n switch (normalized) {\n case 'stop':\n return 'stop';\n case 'length':\n return 'length';\n case 'tool_call':\n case 'tool_calls':\n return 'tool_call';\n case 'content_filter':\n return 'content_filter';\n default:\n return undefined;\n }\n}\n"],"mappings":"+CAsBA,IAAa,EAAb,KAAuD,CACrD,OACA,aAEA,YAAY,EAAoC,CAC9C,GAAI,CAAC,EAAQ,OACX,MAAU,MAAM,wCAAwC,CAG1D,KAAK,OACH,EAAQ,QACR,IAAI,EAAQ,CACV,OAAQ,EAAQ,OAChB,UAAW,EAAQ,UACnB,UAAW,EAAQ,gBACf,GAAG,EAAQ,kBACX,IAAA,GACL,CAAC,CACJ,KAAK,aAAe,EAAQ,cAAgB,uBAG9C,MAAM,KACJ,EACA,EAA0B,EAAE,CACN,CACt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H,MAAO,CACL,KAAM,SACN,QAAS,GAAe,GACzB,CACH,IAAK,OACH,MAAO,CACL,KAAM,OACN,QAAS,GAAe,GACzB,CACH,IAAK,YACH,MAAO,CACL,KAAM,YACN,QAAS,EAAU,OAAS,EAAI,KAAQ,GAAe,GACvD,UAAW,EAAU,OAAS,EAAI,EAAY,IAAA,GAC/C,CACH,IAAK,OACH,MAAO,CACL,KAAM,OACN,QAAS,GAAe,GACxB,WAAY,EAAQ,YAAc,EAAU,IAAI,GACjD,CACH,QACE,MAAO,CACL,KAAM,OACN,QAAS,GAAe,GACzB,EAIP,YAAoB,EAAwC,CAC1D,IAAM,EAAY,EACf,OAAQ,GAAS,EAAK,OAAS,OAAO,CACtC,IAAK,GAAU,EAAmD,KAAK,CAE1E,OADI,EAAU,SAAW,EAAU,KAC5B,EAAU,KAAK,GAAG,CAG3B,iBAAyB,EAA4C,CAInE,OAHsB,EAAQ,QAAQ,OACnC,GAAkC,EAAK,OAAS,YAClD,CACoB,KAAK,EAAM,KAAW,CACzC,GAAI,EAAK,IAAM,QAAQ,IACvB,KAAM,WACN,QACA,SAAU,CACR,KAAM,EAAK,KACX,UAAW,EAAK,UACjB,CACF,EAAE,GAIP,SAAS,EACP,EACyC,CACpC,KAEL,OADmB,EAAO,aAAa,CACvC,CACE,IAAK,OACH,MAAO,OACT,IAAK,SACH,MAAO,SACT,IAAK,YACL,IAAK,aACH,MAAO,YACT,IAAK,iBACH,MAAO,iBACT,QACE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postmark-email.js","names":["request: PostmarkModels.Message"],"sources":["../../../../src/integrations/providers/impls/postmark-email.ts"],"sourcesContent":["import { ServerClient, type Models as PostmarkModels } from 'postmark';\n\nimport type {\n EmailOutboundMessage,\n EmailOutboundProvider,\n EmailOutboundResult,\n} from '../email';\n\nexport interface PostmarkEmailProviderOptions {\n serverToken: string;\n defaultFromEmail?: string;\n messageStream?: string;\n client?: ServerClient;\n}\n\nexport class PostmarkEmailProvider implements EmailOutboundProvider {\n private readonly client: ServerClient;\n private readonly defaultFromEmail?: string;\n private readonly messageStream?: string;\n\n constructor(options: PostmarkEmailProviderOptions) {\n this.client =\n options.client ??\n new ServerClient(options.serverToken, {\n useHttps: true,\n });\n this.defaultFromEmail = options.defaultFromEmail;\n this.messageStream = options.messageStream;\n }\n\n async sendEmail(message: EmailOutboundMessage): Promise<EmailOutboundResult> {\n const request: PostmarkModels.Message = {\n From: formatAddress(message.from) ?? this.defaultFromEmail,\n To: message.to.map((addr) => formatAddress(addr)).join(', '),\n Cc
|
|
1
|
+
{"version":3,"file":"postmark-email.js","names":["request: PostmarkModels.Message"],"sources":["../../../../src/integrations/providers/impls/postmark-email.ts"],"sourcesContent":["import { ServerClient, type Models as PostmarkModels } from 'postmark';\n\nimport type {\n EmailOutboundMessage,\n EmailOutboundProvider,\n EmailOutboundResult,\n} from '../email';\n\nexport interface PostmarkEmailProviderOptions {\n serverToken: string;\n defaultFromEmail?: string;\n messageStream?: string;\n client?: ServerClient;\n}\n\nexport class PostmarkEmailProvider implements EmailOutboundProvider {\n private readonly client: ServerClient;\n private readonly defaultFromEmail?: string;\n private readonly messageStream?: string;\n\n constructor(options: PostmarkEmailProviderOptions) {\n this.client =\n options.client ??\n new ServerClient(options.serverToken, {\n useHttps: true,\n });\n this.defaultFromEmail = options.defaultFromEmail;\n this.messageStream = options.messageStream;\n }\n\n async sendEmail(message: EmailOutboundMessage): Promise<EmailOutboundResult> {\n const request: PostmarkModels.Message = {\n From: formatAddress(message.from) ?? this.defaultFromEmail,\n To: message.to.map((addr) => formatAddress(addr)).join(', '),\n Cc:\n message.cc?.map((addr) => formatAddress(addr)).join(', ') || undefined,\n Bcc:\n message.bcc?.map((addr) => formatAddress(addr)).join(', ') || undefined,\n ReplyTo: message.replyTo ? formatAddress(message.replyTo) : undefined,\n Subject: message.subject,\n TextBody: message.textBody,\n HtmlBody: message.htmlBody,\n Headers: message.headers\n ? Object.entries(message.headers).map(([name, value]) => ({\n Name: name,\n Value: value,\n }))\n : undefined,\n MessageStream: this.messageStream,\n Attachments: buildAttachments(message),\n };\n\n const response = await this.client.sendEmail(request);\n return {\n id: response.MessageID,\n providerMessageId: response.MessageID,\n queuedAt: new Date(response.SubmittedAt ?? new Date().toISOString()),\n };\n }\n}\n\nfunction formatAddress(address: { email: string; name?: string }): string {\n if (address.name) {\n return `\"${address.name}\" <${address.email}>`;\n }\n return address.email;\n}\n\nfunction buildAttachments(\n message: EmailOutboundMessage\n): PostmarkModels.Attachment[] | undefined {\n if (!message.attachments?.length) return undefined;\n return message.attachments\n .filter((attachment) => attachment.data)\n .map((attachment) => ({\n Name: attachment.filename,\n Content: Buffer.from(attachment.data ?? new Uint8Array()).toString(\n 'base64'\n ),\n ContentType: attachment.contentType,\n ContentID: null,\n ContentLength: attachment.sizeBytes,\n Disposition: 'attachment',\n }));\n}\n"],"mappings":"wCAeA,IAAa,EAAb,KAAoE,CAClE,OACA,iBACA,cAEA,YAAY,EAAuC,CACjD,KAAK,OACH,EAAQ,QACR,IAAI,EAAa,EAAQ,YAAa,CACpC,SAAU,GACX,CAAC,CACJ,KAAK,iBAAmB,EAAQ,iBAChC,KAAK,cAAgB,EAAQ,cAG/B,MAAM,UAAU,EAA6D,CAC3E,IAAMA,EAAkC,CACtC,KAAM,EAAc,EAAQ,KAAK,EAAI,KAAK,iBAC1C,GAAI,EAAQ,GAAG,IAAK,GAAS,EAAc,EAAK,CAAC,CAAC,KAAK,KAAK,CAC5D,GACE,EAAQ,IAAI,IAAK,GAAS,EAAc,EAAK,CAAC,CAAC,KAAK,KAAK,EAAI,IAAA,GAC/D,IACE,EAAQ,KAAK,IAAK,GAAS,EAAc,EAAK,CAAC,CAAC,KAAK,KAAK,EAAI,IAAA,GAChE,QAAS,EAAQ,QAAU,EAAc,EAAQ,QAAQ,CAAG,IAAA,GAC5D,QAAS,EAAQ,QACjB,SAAU,EAAQ,SAClB,SAAU,EAAQ,SAClB,QAAS,EAAQ,QACb,OAAO,QAAQ,EAAQ,QAAQ,CAAC,KAAK,CAAC,EAAM,MAAY,CACtD,KAAM,EACN,MAAO,EACR,EAAE,CACH,IAAA,GACJ,cAAe,KAAK,cACpB,YAAa,EAAiB,EAAQ,CACvC,CAEK,EAAW,MAAM,KAAK,OAAO,UAAU,EAAQ,CACrD,MAAO,CACL,GAAI,EAAS,UACb,kBAAmB,EAAS,UAC5B,SAAU,IAAI,KAAK,EAAS,aAAe,IAAI,MAAM,CAAC,aAAa,CAAC,CACrE,GAIL,SAAS,EAAc,EAAmD,CAIxE,OAHI,EAAQ,KACH,IAAI,EAAQ,KAAK,KAAK,EAAQ,MAAM,GAEtC,EAAQ,MAGjB,SAAS,EACP,EACyC,CACpC,KAAQ,aAAa,OAC1B,OAAO,EAAQ,YACZ,OAAQ,GAAe,EAAW,KAAK,CACvC,IAAK,IAAgB,CACpB,KAAM,EAAW,SACjB,QAAS,OAAO,KAAK,EAAW,MAAQ,IAAI,WAAa,CAAC,SACxD,SACD,CACD,YAAa,EAAW,YACxB,UAAW,KACX,cAAe,EAAW,UAC1B,YAAa,aACd,EAAE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"powens-client.d.ts","names":[],"sources":["../../../../src/integrations/providers/impls/powens-client.ts"],"sourcesContent":[],"mappings":";KAEY,iBAAA;AAAA,UAOK,mBAAA,CAPY;EAOZ,QAAA,EAAA,MAAA;EA4BA,YAAA,EAAA,MAAa;EAoBb,MAAA,CAAA,EAAA,MAAA;EAQA,WAAA,EApDF,iBAoDmB;EAmBjB,OAAA,CAAA,EAAA,MAAA;EAQA,SAAA,CAAA,EAAA,OA7EI,KA6ES;EASb,gBAAA,CAAA,EAAA,MAAA;EASJ,MAAA,CAAA,EAAA;
|
|
1
|
+
{"version":3,"file":"powens-client.d.ts","names":[],"sources":["../../../../src/integrations/providers/impls/powens-client.ts"],"sourcesContent":[],"mappings":";KAEY,iBAAA;AAAA,UAOK,mBAAA,CAPY;EAOZ,QAAA,EAA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