@wildo-ai/external-connectors-models 1.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/esm/.native.tsbuildinfo +1 -0
  2. package/dist/esm/core/commons.external-connectors-models.schemas.d.ts +49 -9
  3. package/dist/esm/core/commons.external-connectors-models.schemas.d.ts.map +1 -1
  4. package/dist/esm/core/commons.external-connectors-models.schemas.js +46 -7
  5. package/dist/esm/core/commons.external-connectors-models.schemas.js.map +1 -1
  6. package/dist/esm/core/operation-classification.external-connectors-models.schemas.d.ts +13 -0
  7. package/dist/esm/core/operation-classification.external-connectors-models.schemas.d.ts.map +1 -0
  8. package/dist/esm/core/operation-classification.external-connectors-models.schemas.js +14 -0
  9. package/dist/esm/core/operation-classification.external-connectors-models.schemas.js.map +1 -0
  10. package/dist/esm/core/protocols.external-connectors-models.schemas.d.ts +0 -25
  11. package/dist/esm/core/protocols.external-connectors-models.schemas.d.ts.map +1 -1
  12. package/dist/esm/core/protocols.external-connectors-models.schemas.js.map +1 -1
  13. package/dist/esm/core/security.external-connectors-models.schemas.d.ts +132 -2
  14. package/dist/esm/core/security.external-connectors-models.schemas.d.ts.map +1 -1
  15. package/dist/esm/core/security.external-connectors-models.schemas.js +164 -0
  16. package/dist/esm/core/security.external-connectors-models.schemas.js.map +1 -1
  17. package/dist/esm/features/core.external-connectors-models.schemas.d.ts +0 -63
  18. package/dist/esm/features/core.external-connectors-models.schemas.d.ts.map +0 -1
  19. package/dist/esm/features/core.external-connectors-models.schemas.js +0 -101
  20. package/dist/esm/features/core.external-connectors-models.schemas.js.map +0 -1
  21. package/dist/esm/features/email.external-connectors-models.schemas.d.ts +0 -181
  22. package/dist/esm/features/email.external-connectors-models.schemas.d.ts.map +0 -1
  23. package/dist/esm/features/email.external-connectors-models.schemas.js +0 -34
  24. package/dist/esm/features/email.external-connectors-models.schemas.js.map +0 -1
  25. package/dist/esm/features/hooks.external-connectors-models.schemas.d.ts +0 -101
  26. package/dist/esm/features/hooks.external-connectors-models.schemas.d.ts.map +0 -1
  27. package/dist/esm/features/hooks.external-connectors-models.schemas.js +0 -11
  28. package/dist/esm/features/hooks.external-connectors-models.schemas.js.map +0 -1
  29. package/dist/esm/features/sms.external-connectors-models.schemas.d.ts +0 -21
  30. package/dist/esm/features/sms.external-connectors-models.schemas.d.ts.map +0 -1
  31. package/dist/esm/features/sms.external-connectors-models.schemas.js +0 -8
  32. package/dist/esm/features/sms.external-connectors-models.schemas.js.map +0 -1
  33. package/dist/esm/index.d.ts +3 -9
  34. package/dist/esm/index.d.ts.map +1 -1
  35. package/dist/esm/index.js +6 -10
  36. package/dist/esm/index.js.map +1 -1
  37. package/dist/esm/protocols/a2a.external-connectors-models.schemas.d.ts +0 -57
  38. package/dist/esm/protocols/a2a.external-connectors-models.schemas.d.ts.map +0 -1
  39. package/dist/esm/protocols/a2a.external-connectors-models.schemas.js +0 -73
  40. package/dist/esm/protocols/a2a.external-connectors-models.schemas.js.map +0 -1
  41. package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.d.ts +242 -3
  42. package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.d.ts.map +1 -1
  43. package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.js +294 -2
  44. package/dist/esm/protocols/agent-client-protocol.external-connectors-models.schemas.js.map +1 -1
  45. package/dist/esm/protocols/billing.standard-interface.schemas.d.ts +154 -0
  46. package/dist/esm/protocols/billing.standard-interface.schemas.d.ts.map +1 -1
  47. package/dist/esm/protocols/billing.standard-interface.schemas.js +50 -1
  48. package/dist/esm/protocols/billing.standard-interface.schemas.js.map +1 -1
  49. package/dist/esm/protocols/email.external-connectors-models.schemas.d.ts +1 -1
  50. package/dist/esm/protocols/email.standard-interface.schemas.d.ts +5 -5
  51. package/dist/esm/protocols/git.external-connectors-models.schemas.d.ts +0 -14
  52. package/dist/esm/protocols/git.external-connectors-models.schemas.d.ts.map +0 -1
  53. package/dist/esm/protocols/git.external-connectors-models.schemas.js +0 -9
  54. package/dist/esm/protocols/git.external-connectors-models.schemas.js.map +0 -1
  55. package/dist/esm/protocols/grpc.external-connectors-models.schemas.d.ts +0 -14
  56. package/dist/esm/protocols/grpc.external-connectors-models.schemas.d.ts.map +0 -1
  57. package/dist/esm/protocols/grpc.external-connectors-models.schemas.js +0 -9
  58. package/dist/esm/protocols/grpc.external-connectors-models.schemas.js.map +0 -1
  59. package/dist/esm/protocols/hooks-capability.external-connectors-models.schemas.d.ts +101 -0
  60. package/dist/esm/protocols/hooks-capability.external-connectors-models.schemas.d.ts.map +1 -0
  61. package/dist/esm/protocols/hooks-capability.external-connectors-models.schemas.js +11 -0
  62. package/dist/esm/protocols/hooks-capability.external-connectors-models.schemas.js.map +1 -0
  63. package/dist/esm/protocols/llm.external-connectors-models.schemas.d.ts +39 -20
  64. package/dist/esm/protocols/llm.external-connectors-models.schemas.d.ts.map +1 -1
  65. package/dist/esm/protocols/llm.external-connectors-models.schemas.js +113 -27
  66. package/dist/esm/protocols/llm.external-connectors-models.schemas.js.map +1 -1
  67. package/dist/esm/protocols/mcp.external-connectors-models.schemas.d.ts +0 -60
  68. package/dist/esm/protocols/mcp.external-connectors-models.schemas.d.ts.map +0 -1
  69. package/dist/esm/protocols/mcp.external-connectors-models.schemas.js +0 -35
  70. package/dist/esm/protocols/mcp.external-connectors-models.schemas.js.map +0 -1
  71. package/dist/esm/protocols/oauth2.external-connectors-models.schemas.d.ts +2 -2
  72. package/dist/esm/protocols/rest-api.external-connectors-models.schemas.d.ts +1 -89
  73. package/dist/esm/protocols/rest-api.external-connectors-models.schemas.d.ts.map +1 -1
  74. package/dist/esm/protocols/rest-api.external-connectors-models.schemas.js +1 -83
  75. package/dist/esm/protocols/rest-api.external-connectors-models.schemas.js.map +1 -1
  76. package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.d.ts +370 -0
  77. package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.d.ts.map +1 -0
  78. package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.js +89 -0
  79. package/dist/esm/protocols/rest-operations.external-connectors-models.schemas.js.map +1 -0
  80. package/dist/esm/protocols/saml.external-connectors-models.schemas.d.ts +0 -135
  81. package/dist/esm/protocols/saml.external-connectors-models.schemas.d.ts.map +0 -1
  82. package/dist/esm/protocols/saml.external-connectors-models.schemas.js +0 -9
  83. package/dist/esm/protocols/saml.external-connectors-models.schemas.js.map +0 -1
  84. package/dist/esm/protocols/sms.standard-interface.schemas.d.ts +2 -2
  85. package/dist/tsconfig.build.tsbuildinfo +1 -1
  86. package/package.json +2 -2
  87. package/dist/esm/.builder.pid +0 -9
@@ -146,10 +146,10 @@ export declare const ExternalProvider_AuthProfile_Schema: z.ZodDiscriminatedUnio
146
146
  extraAuthParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
147
147
  extraTokenParams: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
148
148
  tokenFormat: z.ZodDefault<z.ZodEnum<{
149
- token: "token";
149
+ custom: "custom";
150
150
  bearer: "bearer";
151
+ token: "token";
151
152
  oauth: "oauth";
152
- custom: "custom";
153
153
  }>>;
154
154
  customTokenPrefix: z.ZodOptional<z.ZodString>;
155
155
  }, z.core.$strip>, z.ZodObject<{
@@ -184,4 +184,134 @@ export declare const ExternalProvider_AuthProfile_Schema: z.ZodDiscriminatedUnio
184
184
  caRef: z.ZodOptional<z.ZodString>;
185
185
  }, z.core.$strip>], "kind">;
186
186
  export type ExternalProvider_AuthProfile = z.infer<typeof ExternalProvider_AuthProfile_Schema>;
187
+ /**
188
+ * WHOSE ACCOUNT a call spends.
189
+ *
190
+ * Distinct from the scope of the DATA the call touches, and conflating the two inverts the design.
191
+ * A billing provider is APPLICATION-owned — the payment account belongs to whoever ships the
192
+ * application — even though almost everything it produces is organization-shaped: a customer, a
193
+ * subscription, an invoice per tenant. Those are data in the application's own domain, produced by
194
+ * an application-owned account. The question here is never "does this touch organizations?", which
195
+ * is true of nearly everything. It is **whose account is it?**
196
+ *
197
+ * Delivery follows the owner and is not a separate decision: the APPLICATION's material is authored
198
+ * in the deployment environment by an operator, and an ORGANIZATION's or a USER's is authored
199
+ * through the application's own settings and stored, sealed, in its database.
200
+ *
201
+ * **No owner ever defaults to another.** An organization-owned call with no connection REFUSES; it
202
+ * never spends the application's account. A silent substitution means the vendor sees one identity
203
+ * while the application believes it acted as another, and every artifact the call leaves on the far
204
+ * side — a message, a record, a line in the vendor's own audit log — is then attributed to the wrong
205
+ * party, with nothing downstream able to detect it. An application that wants "the tenant's key when
206
+ * they have connected one, otherwise ours" expresses that in its own code by choosing which
207
+ * connection to call with, where the choice is visible.
208
+ */
209
+ export declare enum ExternalProvider_Connection_OwnerScope {
210
+ /** The account belongs to the application itself. Material comes from the deployment environment. */
211
+ APPLICATION = "application",
212
+ /** The account belongs to one tenant — its own workspace, its own subscription with the vendor. */
213
+ ORGANIZATION = "organization",
214
+ /** The account belongs to one person — a personal key they authored for themselves. */
215
+ USER = "user"
216
+ }
217
+ /**
218
+ * WHAT A DECLARED SECRET IDENTIFIES — the integration, or the account.
219
+ *
220
+ * A provider's `secretsContract` holds two kinds of thing and, until this existed, marked neither.
221
+ * Slack's contract is the clearest case: `SLACK_CLIENT_ID` and `SLACK_CLIENT_SECRET` identify the
222
+ * APPLICATION's registration with Slack, while `SLACK_API_KEY` holds a token that identifies WHOSE
223
+ * Slack account is being acted as. They are stored differently, rotated for different reasons, and
224
+ * owned by different parties, and one undifferentiated map made all three look alike.
225
+ *
226
+ * Deliberately ORTHOGONAL to {@link ExternalProvider_Connection_OwnerScope}, which is the axis it is
227
+ * most likely to be confused with. This says what a secret IS; that says whose it is. A billing
228
+ * provider's secret key is a CREDENTIAL — it identifies an account — and is nonetheless
229
+ * application-owned, because the only admissible connection for it is APPLICATION. Collapsing the
230
+ * two would make "the deployment owns this" and "this identifies an integration" the same
231
+ * statement, and they are not.
232
+ *
233
+ * What the distinction buys, concretely:
234
+ *
235
+ * - a credential row owned by a tenant or a person may hold a CREDENTIAL and never a REGISTRATION.
236
+ * Without the mark, nothing stopped a tenant storing a row slugged `SLACK_CLIENT_SECRET` that no
237
+ * reader would ever consult — inert, and indistinguishable from a working connection on screen;
238
+ * - the connect flow can derive WHICH slug a grant is stored under by construction, rather than
239
+ * by the convention that it happens to be the REST contract's `apiKey.secretRef`;
240
+ * - a vendor that supports per-tenant app registrations becomes SAYABLE, which it is not today.
241
+ */
242
+ export declare enum ExternalProvider_SecretScope {
243
+ /**
244
+ * Identifies the INTEGRATION — an OAuth2 client id and secret, a signing secret issued to the
245
+ * app's registration. Authored by the operator in the deployment environment.
246
+ */
247
+ REGISTRATION = "registration",
248
+ /**
249
+ * Identifies an ACCOUNT — a token or key standing for whoever is being acted as. May be authored
250
+ * in the environment (the deployment's own account) or minted into a credential row owned by a
251
+ * tenant or a person; which of those are permitted is the admissibility question, not this one.
252
+ */
253
+ CREDENTIAL = "credential"
254
+ }
255
+ /**
256
+ * ON WHOSE BEHALF the act is performed — orthogonal to who owns the account.
257
+ *
258
+ * These are two questions and every combination of them is real, which is why they are two enums
259
+ * rather than one. An application's service identity can impersonate a user (domain-wide
260
+ * delegation); a tenant's own registration can mint a token that acts for one of its members; a
261
+ * tenant's bot token acts as nobody in particular. Collapsing the pair into a single vocabulary
262
+ * makes most of those unsayable:
263
+ *
264
+ * | owner × delegation | the real case |
265
+ * |---|---|
266
+ * | APPLICATION × SERVICE | a platform API key |
267
+ * | APPLICATION × USER | the application's service identity impersonating a user |
268
+ * | ORGANIZATION × SERVICE | the tenant's own bot or workspace token |
269
+ * | ORGANIZATION × USER | the tenant's registration, acting for one of its members |
270
+ * | USER × SERVICE | a personal key the user authored |
271
+ *
272
+ * OAuth 2.0 carries the same split in its grant types: the client is the REGISTRATION, and the grant
273
+ * decides on whose behalf a token is minted.
274
+ */
275
+ export declare enum ExternalProvider_Connection_DelegationMode {
276
+ /** The call acts as the account's owner, with no third party behind it. */
277
+ SERVICE = "service",
278
+ /** The call acts for a named user, whose authorization is what makes it permissible. */
279
+ USER = "user"
280
+ }
281
+ /**
282
+ * WHICH owner instance a single call spends — supplied BY THE CALL, never read from ambient context.
283
+ *
284
+ * This is the field's hardest constraint to get right and the reason it is a parameter rather than a
285
+ * property of the execution. `ExecutionContext.initiatorIds` answers WHO is performing the operation
286
+ * and `contextResourcesFieldIdentifier` answers WHICH ROWS are in scope; neither answers whose
287
+ * account is being spent, and a design that borrows either is wrong for a case that is entirely
288
+ * ordinary: one user action fanning out a message to every organization the user belongs to. One
289
+ * initiator, one execution, N organizations, a different account per call. An ambient answer cannot
290
+ * vary within one execution, so it cannot express that at all.
291
+ *
292
+ * The initiator is still decisive — as the AUTHORIZATION input. The call names the owner and the
293
+ * runtime asks whether this initiator may act for it. Supplying and authorizing are different jobs,
294
+ * and the resolver cannot verify a target it also invented.
295
+ */
296
+ export declare const ExternalProvider_ConnectionShapeSchema: z.ZodObject<{
297
+ ownerScope: z.ZodEnum<typeof ExternalProvider_Connection_OwnerScope>;
298
+ delegation: z.ZodDefault<z.ZodEnum<typeof ExternalProvider_Connection_DelegationMode>>;
299
+ }, z.core.$strip>;
300
+ /**
301
+ * A connection COMBINATION, with no instance attached — what a provider ADMITS.
302
+ *
303
+ * The capability and the call are the same two axes and different objects, which is why this is a
304
+ * separate schema rather than the target with its identifiers made optional. A provider admitting
305
+ * `ORGANIZATION × USER` says nothing about which organization; a call naming an organization and no
306
+ * user is incomplete. Making one schema serve both would have to relax exactly the refinements that
307
+ * make the call safe.
308
+ */
309
+ export type ExternalProvider_ConnectionShape = z.infer<typeof ExternalProvider_ConnectionShapeSchema>;
310
+ export declare const ExternalProvider_ConnectionTargetSchema: z.ZodObject<{
311
+ ownerScope: z.ZodEnum<typeof ExternalProvider_Connection_OwnerScope>;
312
+ delegation: z.ZodDefault<z.ZodEnum<typeof ExternalProvider_Connection_DelegationMode>>;
313
+ ownerId: z.ZodOptional<z.ZodString>;
314
+ actingForUserId: z.ZodOptional<z.ZodString>;
315
+ }, z.core.$strip>;
316
+ export type ExternalProvider_ConnectionTarget = z.infer<typeof ExternalProvider_ConnectionTargetSchema>;
187
317
  //# sourceMappingURL=security.external-connectors-models.schemas.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"security.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../../src/core/security.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,+BAA+B,EAC/B,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAMxB;;;GAGG;AACH,oBAAY,0BAA0B;IACpC,iCAAiC;IACjC,IAAI,SAAS;IAEb,0CAA0C;IAC1C,OAAO,YAAY;IAEnB,gDAAgD;IAChD,MAAM,WAAW;IAEjB,gCAAgC;IAChC,KAAK,UAAU;IAEf,kEAAkE;IAClE,MAAM,WAAW;IAEjB,0CAA0C;IAC1C,cAAc,mBAAmB;IAEjC,+CAA+C;IAC/C,cAAc,mBAAmB;IAEjC,uCAAuC;IACvC,UAAU,eAAe;IAEzB,qDAAqD;IACrD,eAAe,oBAAoB;CACpC;AAMD,oBAAY,qCAAqC;IAC/C,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED,oBAAY,8CAA8C;IACxD,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,oBAAY,mCAAmC;IAC7C,GAAG,QAAQ;IACX,OAAO,YAAY;IACnB,mBAAmB,wBAAwB;CAC5C;AAMD;;;GAGG;AACH,eAAO,MAAM,yCAAyC;;;;;iBAYpD,CAAC;AAMH,eAAO,MAAM,6CAA6C;;;;;;;iBAkBxD,CAAC;AAMH,eAAO,MAAM,uCAAuC;;;;;;iBAelD,CAAC;AAMH,MAAM,MAAM,mCAAmC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yCAAyC,CAAC,CAAC;AAC5G,MAAM,MAAM,uCAAuC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6CAA6C,CAAC,CAAC;AACpH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uCAAuC,CAAC,CAAC;AAMxG;;;GAGG;AACH,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2BAmI9C,CAAC;AACH,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC"}
1
+ {"version":3,"file":"security.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../../src/core/security.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,+BAA+B,EAC/B,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAMxB;;;GAGG;AACH,oBAAY,0BAA0B;IACpC,iCAAiC;IACjC,IAAI,SAAS;IAEb,0CAA0C;IAC1C,OAAO,YAAY;IAEnB,gDAAgD;IAChD,MAAM,WAAW;IAEjB,gCAAgC;IAChC,KAAK,UAAU;IAEf,kEAAkE;IAClE,MAAM,WAAW;IAEjB,0CAA0C;IAC1C,cAAc,mBAAmB;IAEjC,+CAA+C;IAC/C,cAAc,mBAAmB;IAEjC,uCAAuC;IACvC,UAAU,eAAe;IAEzB,qDAAqD;IACrD,eAAe,oBAAoB;CACpC;AAMD,oBAAY,qCAAqC;IAC/C,MAAM,WAAW;IACjB,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED,oBAAY,8CAA8C;IACxD,MAAM,WAAW;IACjB,MAAM,WAAW;CAClB;AAED,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D,CAAC;AAEH;;;;;;;;GAQG;AACH,MAAM,MAAM,gCAAgC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sCAAsC,CAAC,CAAC;AAEtG,eAAO,MAAM,uCAAuC;;;;;iBA2ClD,CAAC;AAEH,MAAM,MAAM,iCAAiC,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uCAAuC,CAAC,CAAC"}
@@ -230,4 +230,168 @@ export const ExternalProvider_AuthProfile_Schema = z.discriminatedUnion("kind",
230
230
  caRef: z.string().optional(),
231
231
  }),
232
232
  ]);
233
+ // =============================================================================
234
+ // CONNECTION IDENTITY — whose account, on whose behalf, and which one
235
+ // =============================================================================
236
+ /**
237
+ * WHOSE ACCOUNT a call spends.
238
+ *
239
+ * Distinct from the scope of the DATA the call touches, and conflating the two inverts the design.
240
+ * A billing provider is APPLICATION-owned — the payment account belongs to whoever ships the
241
+ * application — even though almost everything it produces is organization-shaped: a customer, a
242
+ * subscription, an invoice per tenant. Those are data in the application's own domain, produced by
243
+ * an application-owned account. The question here is never "does this touch organizations?", which
244
+ * is true of nearly everything. It is **whose account is it?**
245
+ *
246
+ * Delivery follows the owner and is not a separate decision: the APPLICATION's material is authored
247
+ * in the deployment environment by an operator, and an ORGANIZATION's or a USER's is authored
248
+ * through the application's own settings and stored, sealed, in its database.
249
+ *
250
+ * **No owner ever defaults to another.** An organization-owned call with no connection REFUSES; it
251
+ * never spends the application's account. A silent substitution means the vendor sees one identity
252
+ * while the application believes it acted as another, and every artifact the call leaves on the far
253
+ * side — a message, a record, a line in the vendor's own audit log — is then attributed to the wrong
254
+ * party, with nothing downstream able to detect it. An application that wants "the tenant's key when
255
+ * they have connected one, otherwise ours" expresses that in its own code by choosing which
256
+ * connection to call with, where the choice is visible.
257
+ */
258
+ export var ExternalProvider_Connection_OwnerScope;
259
+ (function (ExternalProvider_Connection_OwnerScope) {
260
+ /** The account belongs to the application itself. Material comes from the deployment environment. */
261
+ ExternalProvider_Connection_OwnerScope["APPLICATION"] = "application";
262
+ /** The account belongs to one tenant — its own workspace, its own subscription with the vendor. */
263
+ ExternalProvider_Connection_OwnerScope["ORGANIZATION"] = "organization";
264
+ /** The account belongs to one person — a personal key they authored for themselves. */
265
+ ExternalProvider_Connection_OwnerScope["USER"] = "user";
266
+ })(ExternalProvider_Connection_OwnerScope || (ExternalProvider_Connection_OwnerScope = {}));
267
+ /**
268
+ * WHAT A DECLARED SECRET IDENTIFIES — the integration, or the account.
269
+ *
270
+ * A provider's `secretsContract` holds two kinds of thing and, until this existed, marked neither.
271
+ * Slack's contract is the clearest case: `SLACK_CLIENT_ID` and `SLACK_CLIENT_SECRET` identify the
272
+ * APPLICATION's registration with Slack, while `SLACK_API_KEY` holds a token that identifies WHOSE
273
+ * Slack account is being acted as. They are stored differently, rotated for different reasons, and
274
+ * owned by different parties, and one undifferentiated map made all three look alike.
275
+ *
276
+ * Deliberately ORTHOGONAL to {@link ExternalProvider_Connection_OwnerScope}, which is the axis it is
277
+ * most likely to be confused with. This says what a secret IS; that says whose it is. A billing
278
+ * provider's secret key is a CREDENTIAL — it identifies an account — and is nonetheless
279
+ * application-owned, because the only admissible connection for it is APPLICATION. Collapsing the
280
+ * two would make "the deployment owns this" and "this identifies an integration" the same
281
+ * statement, and they are not.
282
+ *
283
+ * What the distinction buys, concretely:
284
+ *
285
+ * - a credential row owned by a tenant or a person may hold a CREDENTIAL and never a REGISTRATION.
286
+ * Without the mark, nothing stopped a tenant storing a row slugged `SLACK_CLIENT_SECRET` that no
287
+ * reader would ever consult — inert, and indistinguishable from a working connection on screen;
288
+ * - the connect flow can derive WHICH slug a grant is stored under by construction, rather than
289
+ * by the convention that it happens to be the REST contract's `apiKey.secretRef`;
290
+ * - a vendor that supports per-tenant app registrations becomes SAYABLE, which it is not today.
291
+ */
292
+ export var ExternalProvider_SecretScope;
293
+ (function (ExternalProvider_SecretScope) {
294
+ /**
295
+ * Identifies the INTEGRATION — an OAuth2 client id and secret, a signing secret issued to the
296
+ * app's registration. Authored by the operator in the deployment environment.
297
+ */
298
+ ExternalProvider_SecretScope["REGISTRATION"] = "registration";
299
+ /**
300
+ * Identifies an ACCOUNT — a token or key standing for whoever is being acted as. May be authored
301
+ * in the environment (the deployment's own account) or minted into a credential row owned by a
302
+ * tenant or a person; which of those are permitted is the admissibility question, not this one.
303
+ */
304
+ ExternalProvider_SecretScope["CREDENTIAL"] = "credential";
305
+ })(ExternalProvider_SecretScope || (ExternalProvider_SecretScope = {}));
306
+ /**
307
+ * ON WHOSE BEHALF the act is performed — orthogonal to who owns the account.
308
+ *
309
+ * These are two questions and every combination of them is real, which is why they are two enums
310
+ * rather than one. An application's service identity can impersonate a user (domain-wide
311
+ * delegation); a tenant's own registration can mint a token that acts for one of its members; a
312
+ * tenant's bot token acts as nobody in particular. Collapsing the pair into a single vocabulary
313
+ * makes most of those unsayable:
314
+ *
315
+ * | owner × delegation | the real case |
316
+ * |---|---|
317
+ * | APPLICATION × SERVICE | a platform API key |
318
+ * | APPLICATION × USER | the application's service identity impersonating a user |
319
+ * | ORGANIZATION × SERVICE | the tenant's own bot or workspace token |
320
+ * | ORGANIZATION × USER | the tenant's registration, acting for one of its members |
321
+ * | USER × SERVICE | a personal key the user authored |
322
+ *
323
+ * OAuth 2.0 carries the same split in its grant types: the client is the REGISTRATION, and the grant
324
+ * decides on whose behalf a token is minted.
325
+ */
326
+ export var ExternalProvider_Connection_DelegationMode;
327
+ (function (ExternalProvider_Connection_DelegationMode) {
328
+ /** The call acts as the account's owner, with no third party behind it. */
329
+ ExternalProvider_Connection_DelegationMode["SERVICE"] = "service";
330
+ /** The call acts for a named user, whose authorization is what makes it permissible. */
331
+ ExternalProvider_Connection_DelegationMode["USER"] = "user";
332
+ })(ExternalProvider_Connection_DelegationMode || (ExternalProvider_Connection_DelegationMode = {}));
333
+ /**
334
+ * WHICH owner instance a single call spends — supplied BY THE CALL, never read from ambient context.
335
+ *
336
+ * This is the field's hardest constraint to get right and the reason it is a parameter rather than a
337
+ * property of the execution. `ExecutionContext.initiatorIds` answers WHO is performing the operation
338
+ * and `contextResourcesFieldIdentifier` answers WHICH ROWS are in scope; neither answers whose
339
+ * account is being spent, and a design that borrows either is wrong for a case that is entirely
340
+ * ordinary: one user action fanning out a message to every organization the user belongs to. One
341
+ * initiator, one execution, N organizations, a different account per call. An ambient answer cannot
342
+ * vary within one execution, so it cannot express that at all.
343
+ *
344
+ * The initiator is still decisive — as the AUTHORIZATION input. The call names the owner and the
345
+ * runtime asks whether this initiator may act for it. Supplying and authorizing are different jobs,
346
+ * and the resolver cannot verify a target it also invented.
347
+ */
348
+ export const ExternalProvider_ConnectionShapeSchema = z.object({
349
+ ownerScope: z.enum(ExternalProvider_Connection_OwnerScope),
350
+ delegation: z.enum(ExternalProvider_Connection_DelegationMode)
351
+ .default(ExternalProvider_Connection_DelegationMode.SERVICE),
352
+ });
353
+ export const ExternalProvider_ConnectionTargetSchema = ExternalProvider_ConnectionShapeSchema.extend({
354
+ /**
355
+ * The organization or user whose account is spent. Absent for APPLICATION, which has exactly one
356
+ * instance by construction — an id there would be a second name for the deployment.
357
+ */
358
+ ownerId: z.string().optional(),
359
+ /**
360
+ * The user the act is performed for, when `delegation` is USER. Independent of `ownerId`: a
361
+ * tenant-owned connection acting for one of its members carries an organization in `ownerId` and a
362
+ * person here.
363
+ */
364
+ actingForUserId: z.string().optional(),
365
+ }).superRefine((target, ctx) => {
366
+ const ownerIsInstance = target.ownerScope !== ExternalProvider_Connection_OwnerScope.APPLICATION;
367
+ if (ownerIsInstance && (target.ownerId === undefined || target.ownerId === '')) {
368
+ ctx.addIssue({
369
+ code: 'custom',
370
+ path: ['ownerId'],
371
+ message: `A ${target.ownerScope}-owned connection names WHICH ${target.ownerScope}; a call that omits it has not said whose account it spends.`,
372
+ });
373
+ }
374
+ if (!ownerIsInstance && target.ownerId !== undefined) {
375
+ ctx.addIssue({
376
+ code: 'custom',
377
+ path: ['ownerId'],
378
+ message: 'An application-owned connection has exactly one instance, so an ownerId here names something that does not exist.',
379
+ });
380
+ }
381
+ const delegated = target.delegation === ExternalProvider_Connection_DelegationMode.USER;
382
+ if (delegated && (target.actingForUserId === undefined || target.actingForUserId === '')) {
383
+ ctx.addIssue({
384
+ code: 'custom',
385
+ path: ['actingForUserId'],
386
+ message: 'A delegated call acts FOR someone, and the user it acts for is what makes it permissible — it cannot be left to be inferred.',
387
+ });
388
+ }
389
+ if (!delegated && target.actingForUserId !== undefined) {
390
+ ctx.addIssue({
391
+ code: 'custom',
392
+ path: ['actingForUserId'],
393
+ message: 'A SERVICE call acts for nobody. Naming a user here reads as delegation the runtime will not perform, which is worse than an error: the call succeeds as the wrong identity.',
394
+ });
395
+ }
396
+ });
233
397
  //# sourceMappingURL=security.external-connectors-models.schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"security.external-connectors-models.schemas.js","sourceRoot":"","sources":["../../../../src/core/security.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,+BAA+B,EAC/B,kBAAkB,EAClB,aAAa,EACb,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,gFAAgF;AAChF,iBAAiB;AACjB,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAN,IAAY,0BA2BX;AA3BD,WAAY,0BAA0B;IACpC,iCAAiC;IACjC,2CAAa,CAAA;IAEb,0CAA0C;IAC1C,iDAAmB,CAAA;IAEnB,gDAAgD;IAChD,+CAAiB,CAAA;IAEjB,gCAAgC;IAChC,6CAAe,CAAA;IAEf,kEAAkE;IAClE,+CAAiB,CAAA;IAEjB,0CAA0C;IAC1C,+DAAiC,CAAA;IAEjC,+CAA+C;IAC/C,+DAAiC,CAAA;IAEjC,uCAAuC;IACvC,uDAAyB,CAAA;IAEzB,qDAAqD;IACrD,iEAAmC,CAAA;AACrC,CAAC,EA3BW,0BAA0B,KAA1B,0BAA0B,QA2B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EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KACnC,CAAC;IAEF,4BAA4B;IAC5B,uCAAuC,CAAC,MAAM,CAAC;QAC7C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC,IAAI,CAAC;KACjD,CAAC;IAEF,0BAA0B;IAC1B,uCAAuC,CAAC,MAAM,CAAC;QAC7C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC,eAAe,CAAC;QAC3D,8CAA8C;QAC9C,YAAY,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;KACxC,CAAC;IAEF,qBAAqB;IACrB,uCAAuC,CAAC,MAAM,CAAC;QAC7C,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC,UAAU,CAAC;QACtD,4BAA4B;QAC5B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACrC,4BAA4B;QAC5B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QACpC,+BAA+B;QAC/B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC7B,CAAC;CACH,CAAC,CAAC","sourcesContent":["/**\n * Security and Authentication Schemas for External Connectors\n * \n * This module defines authentication profiles that can be used across protocols.\n * It integrates with OAuth2 to avoid duplication between API auth and OAuth2 config.\n * \n * Architecture:\n * - ExternalProvider_Auth_Kind: The type of authentication\n * - ExternalProvider_AuthProfile: How to authenticate with an API\n * - OAuth2-linked profiles: Reference OAuth2 config instead of duplicating\n * \n * @see https://swagger.io/docs/specification/v3_0/authentication/\n */\n\nimport { z } from \"zod\";\nimport {\n OAuth2_GrantType,\n OAuth2_TokenEndpoint_AuthMethod,\n OAuth2_PKCE_Method,\n OAuth2_Prompt,\n OAuth2_AccessType,\n} from './oauth2.enums';\n\n// =============================================================================\n// AUTH KIND ENUM\n// =============================================================================\n\n/**\n * Authentication types supported by external providers\n * Follows OpenAPI 3.0 Security Schemes with extensions\n */\nexport enum ExternalProvider_Auth_Kind {\n /** No authentication required */\n NONE = \"none\",\n \n /** API Key in header, query, or cookie */\n API_KEY = \"api_key\",\n \n /** Bearer token (OAuth2 access token or JWT) */\n BEARER = \"bearer\",\n \n /** HTTP Basic authentication */\n BASIC = \"basic\",\n \n /** OAuth2 authentication - links to OAuth2 provider definition */\n OAUTH2 = \"oauth2\",\n \n /** HMAC signature-based authentication */\n HMAC_SIGNATURE = \"hmac_signature\",\n \n /** OpenID Connect (OAuth2 + identity layer) */\n OPENID_CONNECT = \"openid_connect\",\n \n /** Mutual TLS (client certificates) */\n MUTUAL_TLS = \"mutual_tls\",\n \n /** Frontend-specific secret (not exposed to user) */\n FRONTEND_SECRET = \"frontend_secret\",\n}\n\n// =============================================================================\n// AUTH CONFIGURATION ENUMS\n// =============================================================================\n\nexport enum ExternalProvider_Auth_ApiKey_Location {\n HEADER = \"header\",\n QUERY = \"query\",\n COOKIE = \"cookie\",\n}\n\nexport enum ExternalProvider_Auth_HMAC_Signature_Algorithm {\n SHA256 = \"sha256\",\n SHA512 = \"sha512\",\n}\n\nexport enum ExternalProvider_Auth_Bearer_Format {\n JWT = \"jwt\",\n API_KEY = \"api_key\",\n OAUTH2_ACCESS_TOKEN = \"oauth2_access_token\",\n}\n\n// =============================================================================\n// AUTH CONFIGURATION SCHEMA\n// =============================================================================\n\n/**\n * Auth Configuration - references a secret\n * This is the runtime configuration that specifies which secret to use\n */\nexport const ExternalProvider_Auth_ConfigurationSchema = z.object({\n /** Type of authentication */\n authKind: z.enum(ExternalProvider_Auth_Kind),\n \n /** References to auth profiles this config applies to */\n profileRefs: z.array(z.string()).optional(),\n \n /** Is this the default auth for the provider? */\n isDefault: z.boolean().optional(),\n \n /** Reference to the secret (environment variable name or secret store key) */\n secretRef: z.string(),\n});\n\n// =============================================================================\n// RATE LIMIT CONFIGURATION\n// =============================================================================\n\nexport const ExternalProvider_RateLimitConfigurationSchema = z.object({\n /** Maximum concurrent requests */\n maxConcurrent: z.number().positive().optional().default(10),\n \n /** Minimum time (ms) between requests */\n minTime: z.number().positive().optional(),\n \n /** Request reservoir (bucket size) */\n reservoir: z.number().positive().optional(),\n \n /** Reservoir refresh interval (ms) */\n reservoirRefreshInterval: z.number().positive().optional(),\n \n /** Amount to add to reservoir on refresh */\n reservoirRefreshAmount: z.number().positive().optional(),\n \n /** Request priority (higher = higher priority) */\n priority: z.number().int().optional().default(0),\n});\n\n// =============================================================================\n// AUTH PROFILE BASE SCHEMA\n// =============================================================================\n\nexport const ExternalProvider_AuthProfile_BaseSchema = z.object({\n /** Type of authentication */\n kind: z.enum(ExternalProvider_Auth_Kind),\n \n /** Unique reference for this auth profile */\n ref: z.string().optional(),\n \n /** Is this the default auth profile? */\n isDefault: z.boolean().default(false),\n \n /** Where to place the authentication (header, query, cookie) */\n location: z.enum(ExternalProvider_Auth_ApiKey_Location).default(ExternalProvider_Auth_ApiKey_Location.HEADER),\n \n /** Field name for the authentication */\n locationField: z.string().default(\"Authorization\"),\n});\n\n// =============================================================================\n// INFERRED BASE TYPES\n// =============================================================================\n\nexport type ExternalProvider_Auth_Configuration = z.infer<typeof ExternalProvider_Auth_ConfigurationSchema>;\nexport type ExternalProvider_RateLimitConfiguration = z.infer<typeof ExternalProvider_RateLimitConfigurationSchema>;\nexport type ExternalProvider_AuthProfile_Base = z.infer<typeof ExternalProvider_AuthProfile_BaseSchema>;\n\n// =============================================================================\n// DISCRIMINATED AUTH PROFILE SCHEMAS\n// =============================================================================\n\n/**\n * Complete Auth Profile Schema - discriminated union by kind\n * Each kind has specific configuration fields\n */\nexport const ExternalProvider_AuthProfile_Schema = z.discriminatedUnion(\"kind\", [\n // ─── API Key Authentication ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.API_KEY),\n locationField: z.string().default(\"Authorization\"),\n /** Prefix before the key value (e.g., \"Api-Key \") */\n prefix: z.string().optional(),\n }),\n \n // ─── HMAC Signature Authentication ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.HMAC_SIGNATURE),\n locationField: z.string().default(\"X-Signature\"),\n /** HMAC algorithm */\n algorithm: z.enum(ExternalProvider_Auth_HMAC_Signature_Algorithm).default(ExternalProvider_Auth_HMAC_Signature_Algorithm.SHA256),\n /** What data to sign (body, timestamp, etc.) */\n signaturePayload: z.enum(['body', 'timestamp', 'custom']).optional(),\n /** Timestamp header name (if needed) */\n timestampHeader: z.string().optional(),\n /** Nonce header name (if needed for replay protection) */\n nonceHeader: z.string().optional(),\n }),\n \n // ─── Bearer Token Authentication ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.BEARER),\n location: z.enum(ExternalProvider_Auth_ApiKey_Location).default(ExternalProvider_Auth_ApiKey_Location.HEADER),\n locationField: z.string().default(\"Authorization\"),\n /** Prefix (usually \"Bearer \") */\n prefix: z.string().default(\"Bearer \"),\n /** Token format */\n format: z.enum(ExternalProvider_Auth_Bearer_Format).default(ExternalProvider_Auth_Bearer_Format.JWT),\n }),\n \n // ─── OpenID Connect Authentication ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.OPENID_CONNECT),\n /** OIDC Discovery URL */\n discoveryUrl: z.url().optional(),\n /** Issuer */\n issuer: z.string().optional(),\n /** Expected audience */\n audience: z.string().optional(),\n /** Token validation mode */\n validationMode: z.enum(['jwks', 'introspection', 'local']).optional(),\n }),\n \n // ─── OAuth2 Authentication (UNIFIED APPROACH) ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.OAUTH2),\n \n // ─── OAuth2 Provider Reference (Unified Approach) ───\n /**\n * Reference to OAuth2 provider definition\n * Instead of duplicating OAuth2 config, reference the provider\n * by its string identifier (e.g., \"google\", \"microsoft\")\n */\n oauth2ProviderRef: z.string().optional(),\n \n // ─── Inline OAuth2 Configuration (Legacy/Override) ───\n /** Authorization URL (can be overridden or used when no ref) */\n authUrl: z.url().optional(),\n /** Token URL */\n tokenUrl: z.url().optional(),\n /** Refresh URL (if different from tokenUrl) */\n refreshUrl: z.url().optional(),\n \n /** Required scopes for this auth profile */\n scopes: z.array(z.string()).optional(),\n \n /** Preferred grant type */\n grantType: z.enum(OAuth2_GrantType).optional(),\n \n /** Token endpoint auth method */\n tokenEndpointAuthMethod: z.enum(OAuth2_TokenEndpoint_AuthMethod).optional(),\n \n /** PKCE support */\n pkce: z.boolean().optional(),\n /** PKCE method */\n pkceMethod: z.enum(OAuth2_PKCE_Method).optional(),\n \n /** Prompt behavior */\n prompt: z.enum(OAuth2_Prompt).optional(),\n \n /** Access type (online/offline) */\n accessType: z.enum(OAuth2_AccessType).optional(),\n \n /** Extra authorization parameters */\n extraAuthParams: z.record(z.string(), z.string()).optional(),\n \n /** Extra token parameters */\n extraTokenParams: z.record(z.string(), z.string()).optional(),\n \n // ─── Token Format (for API calls) ───\n /** How to format the token in Authorization header */\n tokenFormat: z.enum(['bearer', 'token', 'oauth', 'custom']).default('bearer'),\n /** Custom prefix if tokenFormat is 'custom' */\n customTokenPrefix: z.string().optional(),\n }),\n \n // ─── Basic Authentication ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.BASIC),\n /** Username field reference */\n usernameRef: z.string().optional(),\n /** Password field reference */\n passwordRef: z.string().optional(),\n }),\n \n // ─── No Authentication ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.NONE),\n }),\n \n // ─── Frontend Secret ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.FRONTEND_SECRET),\n /** Secret is only used in frontend context */\n frontendOnly: z.boolean().default(true),\n }),\n \n // ─── Mutual TLS ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.MUTUAL_TLS),\n /** Certificate reference */\n certificateRef: z.string().optional(),\n /** Private key reference */\n privateKeyRef: z.string().optional(),\n /** CA certificate reference */\n caRef: z.string().optional(),\n }),\n]);\nexport type ExternalProvider_AuthProfile = z.infer<typeof ExternalProvider_AuthProfile_Schema>;\n"]}
1
+ {"version":3,"file":"security.external-connectors-models.schemas.js","sourceRoot":"","sources":["../../../../src/core/security.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,gBAAgB,EAChB,+BAA+B,EAC/B,kBAAkB,EAClB,aAAa,EACb,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,gFAAgF;AAChF,iBAAiB;AACjB,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAN,IAAY,0BA2BX;AA3BD,WAAY,0BAA0B;IACpC,iCAAiC;IACjC,2CAAa,CAAA;IAEb,0CAA0C;IAC1C,iDAAmB,CAAA;IAEnB,gDAAgD;IAChD,+CAAiB,CAAA;IAEjB,gCAAgC;IAChC,6CAAe,CAAA;IAEf,kEAAkE;IAClE,+CAAiB,CAAA;IAEjB,0CAA0C;IAC1C,+DAAiC,CAAA;IAEjC,+CAA+C;IAC/C,+DAAiC,CAAA;IAEjC,uCAAuC;IACvC,uDAAyB,CAAA;IAEzB,qDAAqD;IACrD,iEAAmC,CAAA;AACrC,CAAC,EA3BW,0BAA0B,KAA1B,0BAA0B,QA2BrC;AAED,gFAAgF;AAChF,2BAA2B;AAC3B,gFAAgF;AAEhF,MAAM,CAAN,IAAY,qCAIX;AAJD,WAAY,qCAAqC;IAC/C,0DAAiB,CAAA;IACjB,wDAAe,CAAA;IACf,0DAAiB,CAAA;AACnB,CAAC,EAJW,qCAAqC,KAArC,qCAAqC,QAIhD;AAED,MAAM,CAAN,IAAY,8CAGX;AAHD,WAAY,8CAA8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,IAAI,SAAS,IAAI,CAAC,MAAM,CAAC,eAAe,KAAK,SAAS,IAAI,MAAM,CAAC,eAAe,KAAK,EAAE,CAAC,EAAE,CAAC;QACzF,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,iBAAiB,CAAC;YACzB,OAAO,EAAE,8HAA8H;SACxI,CAAC,CAAC;IACL,CAAC;IACD,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC,eAAe,KAAK,SAAS,EAAE,CAAC;QACvD,GAAG,CAAC,QAAQ,CAAC;YACX,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,CAAC,iBAAiB,CAAC;YACzB,OAAO,EAAE,6KAA6K;SACvL,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CAAC,CAAC","sourcesContent":["/**\n * Security and Authentication Schemas for External Connectors\n * \n * This module defines authentication profiles that can be used across protocols.\n * It integrates with OAuth2 to avoid duplication between API auth and OAuth2 config.\n * \n * Architecture:\n * - ExternalProvider_Auth_Kind: The type of authentication\n * - ExternalProvider_AuthProfile: How to authenticate with an API\n * - OAuth2-linked profiles: Reference OAuth2 config instead of duplicating\n * \n * @see https://swagger.io/docs/specification/v3_0/authentication/\n */\n\nimport { z } from \"zod\";\nimport {\n OAuth2_GrantType,\n OAuth2_TokenEndpoint_AuthMethod,\n OAuth2_PKCE_Method,\n OAuth2_Prompt,\n OAuth2_AccessType,\n} from './oauth2.enums';\n\n// =============================================================================\n// AUTH KIND ENUM\n// =============================================================================\n\n/**\n * Authentication types supported by external providers\n * Follows OpenAPI 3.0 Security Schemes with extensions\n */\nexport enum ExternalProvider_Auth_Kind {\n /** No authentication required */\n NONE = \"none\",\n \n /** API Key in header, query, or cookie */\n API_KEY = \"api_key\",\n \n /** Bearer token (OAuth2 access token or JWT) */\n BEARER = \"bearer\",\n \n /** HTTP Basic authentication */\n BASIC = \"basic\",\n \n /** OAuth2 authentication - links to OAuth2 provider definition */\n OAUTH2 = \"oauth2\",\n \n /** HMAC signature-based authentication */\n HMAC_SIGNATURE = \"hmac_signature\",\n \n /** OpenID Connect (OAuth2 + identity layer) */\n OPENID_CONNECT = \"openid_connect\",\n \n /** Mutual TLS (client certificates) */\n MUTUAL_TLS = \"mutual_tls\",\n \n /** Frontend-specific secret (not exposed to user) */\n FRONTEND_SECRET = \"frontend_secret\",\n}\n\n// =============================================================================\n// AUTH CONFIGURATION ENUMS\n// =============================================================================\n\nexport enum ExternalProvider_Auth_ApiKey_Location {\n HEADER = \"header\",\n QUERY = \"query\",\n COOKIE = \"cookie\",\n}\n\nexport enum ExternalProvider_Auth_HMAC_Signature_Algorithm {\n SHA256 = \"sha256\",\n SHA512 = \"sha512\",\n}\n\nexport enum ExternalProvider_Auth_Bearer_Format {\n JWT = \"jwt\",\n API_KEY = \"api_key\",\n OAUTH2_ACCESS_TOKEN = \"oauth2_access_token\",\n}\n\n// =============================================================================\n// AUTH CONFIGURATION SCHEMA\n// =============================================================================\n\n/**\n * Auth Configuration - references a secret\n * This is the runtime configuration that specifies which secret to use\n */\nexport const ExternalProvider_Auth_ConfigurationSchema = z.object({\n /** Type of authentication */\n authKind: z.enum(ExternalProvider_Auth_Kind),\n \n /** References to auth profiles this config applies to */\n profileRefs: z.array(z.string()).optional(),\n \n /** Is this the default auth for the provider? */\n isDefault: z.boolean().optional(),\n \n /** Reference to the secret (environment variable name or secret store key) */\n secretRef: z.string(),\n});\n\n// =============================================================================\n// RATE LIMIT CONFIGURATION\n// =============================================================================\n\nexport const ExternalProvider_RateLimitConfigurationSchema = z.object({\n /** Maximum concurrent requests */\n maxConcurrent: z.number().positive().optional().default(10),\n \n /** Minimum time (ms) between requests */\n minTime: z.number().positive().optional(),\n \n /** Request reservoir (bucket size) */\n reservoir: z.number().positive().optional(),\n \n /** Reservoir refresh interval (ms) */\n reservoirRefreshInterval: z.number().positive().optional(),\n \n /** Amount to add to reservoir on refresh */\n reservoirRefreshAmount: z.number().positive().optional(),\n \n /** Request priority (higher = higher priority) */\n priority: z.number().int().optional().default(0),\n});\n\n// =============================================================================\n// AUTH PROFILE BASE SCHEMA\n// =============================================================================\n\nexport const ExternalProvider_AuthProfile_BaseSchema = z.object({\n /** Type of authentication */\n kind: z.enum(ExternalProvider_Auth_Kind),\n \n /** Unique reference for this auth profile */\n ref: z.string().optional(),\n \n /** Is this the default auth profile? */\n isDefault: z.boolean().default(false),\n \n /** Where to place the authentication (header, query, cookie) */\n location: z.enum(ExternalProvider_Auth_ApiKey_Location).default(ExternalProvider_Auth_ApiKey_Location.HEADER),\n \n /** Field name for the authentication */\n locationField: z.string().default(\"Authorization\"),\n});\n\n// =============================================================================\n// INFERRED BASE TYPES\n// =============================================================================\n\nexport type ExternalProvider_Auth_Configuration = z.infer<typeof ExternalProvider_Auth_ConfigurationSchema>;\nexport type ExternalProvider_RateLimitConfiguration = z.infer<typeof ExternalProvider_RateLimitConfigurationSchema>;\nexport type ExternalProvider_AuthProfile_Base = z.infer<typeof ExternalProvider_AuthProfile_BaseSchema>;\n\n// =============================================================================\n// DISCRIMINATED AUTH PROFILE SCHEMAS\n// =============================================================================\n\n/**\n * Complete Auth Profile Schema - discriminated union by kind\n * Each kind has specific configuration fields\n */\nexport const ExternalProvider_AuthProfile_Schema = z.discriminatedUnion(\"kind\", [\n // ─── API Key Authentication ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.API_KEY),\n locationField: z.string().default(\"Authorization\"),\n /** Prefix before the key value (e.g., \"Api-Key \") */\n prefix: z.string().optional(),\n }),\n \n // ─── HMAC Signature Authentication ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.HMAC_SIGNATURE),\n locationField: z.string().default(\"X-Signature\"),\n /** HMAC algorithm */\n algorithm: z.enum(ExternalProvider_Auth_HMAC_Signature_Algorithm).default(ExternalProvider_Auth_HMAC_Signature_Algorithm.SHA256),\n /** What data to sign (body, timestamp, etc.) */\n signaturePayload: z.enum(['body', 'timestamp', 'custom']).optional(),\n /** Timestamp header name (if needed) */\n timestampHeader: z.string().optional(),\n /** Nonce header name (if needed for replay protection) */\n nonceHeader: z.string().optional(),\n }),\n \n // ─── Bearer Token Authentication ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.BEARER),\n location: z.enum(ExternalProvider_Auth_ApiKey_Location).default(ExternalProvider_Auth_ApiKey_Location.HEADER),\n locationField: z.string().default(\"Authorization\"),\n /** Prefix (usually \"Bearer \") */\n prefix: z.string().default(\"Bearer \"),\n /** Token format */\n format: z.enum(ExternalProvider_Auth_Bearer_Format).default(ExternalProvider_Auth_Bearer_Format.JWT),\n }),\n \n // ─── OpenID Connect Authentication ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.OPENID_CONNECT),\n /** OIDC Discovery URL */\n discoveryUrl: z.url().optional(),\n /** Issuer */\n issuer: z.string().optional(),\n /** Expected audience */\n audience: z.string().optional(),\n /** Token validation mode */\n validationMode: z.enum(['jwks', 'introspection', 'local']).optional(),\n }),\n \n // ─── OAuth2 Authentication (UNIFIED APPROACH) ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.OAUTH2),\n \n // ─── OAuth2 Provider Reference (Unified Approach) ───\n /**\n * Reference to OAuth2 provider definition\n * Instead of duplicating OAuth2 config, reference the provider\n * by its string identifier (e.g., \"google\", \"microsoft\")\n */\n oauth2ProviderRef: z.string().optional(),\n \n // ─── Inline OAuth2 Configuration (Legacy/Override) ───\n /** Authorization URL (can be overridden or used when no ref) */\n authUrl: z.url().optional(),\n /** Token URL */\n tokenUrl: z.url().optional(),\n /** Refresh URL (if different from tokenUrl) */\n refreshUrl: z.url().optional(),\n \n /** Required scopes for this auth profile */\n scopes: z.array(z.string()).optional(),\n \n /** Preferred grant type */\n grantType: z.enum(OAuth2_GrantType).optional(),\n \n /** Token endpoint auth method */\n tokenEndpointAuthMethod: z.enum(OAuth2_TokenEndpoint_AuthMethod).optional(),\n \n /** PKCE support */\n pkce: z.boolean().optional(),\n /** PKCE method */\n pkceMethod: z.enum(OAuth2_PKCE_Method).optional(),\n \n /** Prompt behavior */\n prompt: z.enum(OAuth2_Prompt).optional(),\n \n /** Access type (online/offline) */\n accessType: z.enum(OAuth2_AccessType).optional(),\n \n /** Extra authorization parameters */\n extraAuthParams: z.record(z.string(), z.string()).optional(),\n \n /** Extra token parameters */\n extraTokenParams: z.record(z.string(), z.string()).optional(),\n \n // ─── Token Format (for API calls) ───\n /** How to format the token in Authorization header */\n tokenFormat: z.enum(['bearer', 'token', 'oauth', 'custom']).default('bearer'),\n /** Custom prefix if tokenFormat is 'custom' */\n customTokenPrefix: z.string().optional(),\n }),\n \n // ─── Basic Authentication ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.BASIC),\n /** Username field reference */\n usernameRef: z.string().optional(),\n /** Password field reference */\n passwordRef: z.string().optional(),\n }),\n \n // ─── No Authentication ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.NONE),\n }),\n \n // ─── Frontend Secret ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.FRONTEND_SECRET),\n /** Secret is only used in frontend context */\n frontendOnly: z.boolean().default(true),\n }),\n \n // ─── Mutual TLS ───\n ExternalProvider_AuthProfile_BaseSchema.extend({\n kind: z.literal(ExternalProvider_Auth_Kind.MUTUAL_TLS),\n /** Certificate reference */\n certificateRef: z.string().optional(),\n /** Private key reference */\n privateKeyRef: z.string().optional(),\n /** CA certificate reference */\n caRef: z.string().optional(),\n }),\n]);\nexport type ExternalProvider_AuthProfile = z.infer<typeof ExternalProvider_AuthProfile_Schema>;\n\n// =============================================================================\n// CONNECTION IDENTITY — whose account, on whose behalf, and which one\n// =============================================================================\n\n/**\n * WHOSE ACCOUNT a call spends.\n *\n * Distinct from the scope of the DATA the call touches, and conflating the two inverts the design.\n * A billing provider is APPLICATION-owned — the payment account belongs to whoever ships the\n * application — even though almost everything it produces is organization-shaped: a customer, a\n * subscription, an invoice per tenant. Those are data in the application's own domain, produced by\n * an application-owned account. The question here is never \"does this touch organizations?\", which\n * is true of nearly everything. It is **whose account is it?**\n *\n * Delivery follows the owner and is not a separate decision: the APPLICATION's material is authored\n * in the deployment environment by an operator, and an ORGANIZATION's or a USER's is authored\n * through the application's own settings and stored, sealed, in its database.\n *\n * **No owner ever defaults to another.** An organization-owned call with no connection REFUSES; it\n * never spends the application's account. A silent substitution means the vendor sees one identity\n * while the application believes it acted as another, and every artifact the call leaves on the far\n * side — a message, a record, a line in the vendor's own audit log — is then attributed to the wrong\n * party, with nothing downstream able to detect it. An application that wants \"the tenant's key when\n * they have connected one, otherwise ours\" expresses that in its own code by choosing which\n * connection to call with, where the choice is visible.\n */\nexport enum ExternalProvider_Connection_OwnerScope {\n /** The account belongs to the application itself. Material comes from the deployment environment. */\n APPLICATION = \"application\",\n /** The account belongs to one tenant — its own workspace, its own subscription with the vendor. */\n ORGANIZATION = \"organization\",\n /** The account belongs to one person — a personal key they authored for themselves. */\n USER = \"user\",\n}\n\n/**\n * WHAT A DECLARED SECRET IDENTIFIES — the integration, or the account.\n *\n * A provider's `secretsContract` holds two kinds of thing and, until this existed, marked neither.\n * Slack's contract is the clearest case: `SLACK_CLIENT_ID` and `SLACK_CLIENT_SECRET` identify the\n * APPLICATION's registration with Slack, while `SLACK_API_KEY` holds a token that identifies WHOSE\n * Slack account is being acted as. They are stored differently, rotated for different reasons, and\n * owned by different parties, and one undifferentiated map made all three look alike.\n *\n * Deliberately ORTHOGONAL to {@link ExternalProvider_Connection_OwnerScope}, which is the axis it is\n * most likely to be confused with. This says what a secret IS; that says whose it is. A billing\n * provider's secret key is a CREDENTIAL — it identifies an account — and is nonetheless\n * application-owned, because the only admissible connection for it is APPLICATION. Collapsing the\n * two would make \"the deployment owns this\" and \"this identifies an integration\" the same\n * statement, and they are not.\n *\n * What the distinction buys, concretely:\n *\n * - a credential row owned by a tenant or a person may hold a CREDENTIAL and never a REGISTRATION.\n * Without the mark, nothing stopped a tenant storing a row slugged `SLACK_CLIENT_SECRET` that no\n * reader would ever consult — inert, and indistinguishable from a working connection on screen;\n * - the connect flow can derive WHICH slug a grant is stored under by construction, rather than\n * by the convention that it happens to be the REST contract's `apiKey.secretRef`;\n * - a vendor that supports per-tenant app registrations becomes SAYABLE, which it is not today.\n */\nexport enum ExternalProvider_SecretScope {\n /**\n * Identifies the INTEGRATION — an OAuth2 client id and secret, a signing secret issued to the\n * app's registration. Authored by the operator in the deployment environment.\n */\n REGISTRATION = \"registration\",\n /**\n * Identifies an ACCOUNT — a token or key standing for whoever is being acted as. May be authored\n * in the environment (the deployment's own account) or minted into a credential row owned by a\n * tenant or a person; which of those are permitted is the admissibility question, not this one.\n */\n CREDENTIAL = \"credential\",\n}\n\n/**\n * ON WHOSE BEHALF the act is performed — orthogonal to who owns the account.\n *\n * These are two questions and every combination of them is real, which is why they are two enums\n * rather than one. An application's service identity can impersonate a user (domain-wide\n * delegation); a tenant's own registration can mint a token that acts for one of its members; a\n * tenant's bot token acts as nobody in particular. Collapsing the pair into a single vocabulary\n * makes most of those unsayable:\n *\n * | owner × delegation | the real case |\n * |---|---|\n * | APPLICATION × SERVICE | a platform API key |\n * | APPLICATION × USER | the application's service identity impersonating a user |\n * | ORGANIZATION × SERVICE | the tenant's own bot or workspace token |\n * | ORGANIZATION × USER | the tenant's registration, acting for one of its members |\n * | USER × SERVICE | a personal key the user authored |\n *\n * OAuth 2.0 carries the same split in its grant types: the client is the REGISTRATION, and the grant\n * decides on whose behalf a token is minted.\n */\nexport enum ExternalProvider_Connection_DelegationMode {\n /** The call acts as the account's owner, with no third party behind it. */\n SERVICE = \"service\",\n /** The call acts for a named user, whose authorization is what makes it permissible. */\n USER = \"user\",\n}\n\n/**\n * WHICH owner instance a single call spends — supplied BY THE CALL, never read from ambient context.\n *\n * This is the field's hardest constraint to get right and the reason it is a parameter rather than a\n * property of the execution. `ExecutionContext.initiatorIds` answers WHO is performing the operation\n * and `contextResourcesFieldIdentifier` answers WHICH ROWS are in scope; neither answers whose\n * account is being spent, and a design that borrows either is wrong for a case that is entirely\n * ordinary: one user action fanning out a message to every organization the user belongs to. One\n * initiator, one execution, N organizations, a different account per call. An ambient answer cannot\n * vary within one execution, so it cannot express that at all.\n *\n * The initiator is still decisive — as the AUTHORIZATION input. The call names the owner and the\n * runtime asks whether this initiator may act for it. Supplying and authorizing are different jobs,\n * and the resolver cannot verify a target it also invented.\n */\nexport const ExternalProvider_ConnectionShapeSchema = z.object({\n ownerScope: z.enum(ExternalProvider_Connection_OwnerScope),\n delegation: z.enum(ExternalProvider_Connection_DelegationMode)\n .default(ExternalProvider_Connection_DelegationMode.SERVICE),\n});\n\n/**\n * A connection COMBINATION, with no instance attached — what a provider ADMITS.\n *\n * The capability and the call are the same two axes and different objects, which is why this is a\n * separate schema rather than the target with its identifiers made optional. A provider admitting\n * `ORGANIZATION × USER` says nothing about which organization; a call naming an organization and no\n * user is incomplete. Making one schema serve both would have to relax exactly the refinements that\n * make the call safe.\n */\nexport type ExternalProvider_ConnectionShape = z.infer<typeof ExternalProvider_ConnectionShapeSchema>;\n\nexport const ExternalProvider_ConnectionTargetSchema = ExternalProvider_ConnectionShapeSchema.extend({\n /**\n * The organization or user whose account is spent. Absent for APPLICATION, which has exactly one\n * instance by construction — an id there would be a second name for the deployment.\n */\n ownerId: z.string().optional(),\n /**\n * The user the act is performed for, when `delegation` is USER. Independent of `ownerId`: a\n * tenant-owned connection acting for one of its members carries an organization in `ownerId` and a\n * person here.\n */\n actingForUserId: z.string().optional(),\n}).superRefine((target, ctx) => {\n const ownerIsInstance = target.ownerScope !== ExternalProvider_Connection_OwnerScope.APPLICATION;\n if (ownerIsInstance && (target.ownerId === undefined || target.ownerId === '')) {\n ctx.addIssue({\n code: 'custom',\n path: ['ownerId'],\n message: `A ${target.ownerScope}-owned connection names WHICH ${target.ownerScope}; a call that omits it has not said whose account it spends.`,\n });\n }\n if (!ownerIsInstance && target.ownerId !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['ownerId'],\n message: 'An application-owned connection has exactly one instance, so an ownerId here names something that does not exist.',\n });\n }\n const delegated = target.delegation === ExternalProvider_Connection_DelegationMode.USER;\n if (delegated && (target.actingForUserId === undefined || target.actingForUserId === '')) {\n ctx.addIssue({\n code: 'custom',\n path: ['actingForUserId'],\n message: 'A delegated call acts FOR someone, and the user it acts for is what makes it permissible — it cannot be left to be inferred.',\n });\n }\n if (!delegated && target.actingForUserId !== undefined) {\n ctx.addIssue({\n code: 'custom',\n path: ['actingForUserId'],\n message: 'A SERVICE call acts for nobody. Naming a user here reads as delegation the runtime will not perform, which is worse than an error: the call succeeds as the wrong identity.',\n });\n }\n});\n\nexport type ExternalProvider_ConnectionTarget = z.infer<typeof ExternalProvider_ConnectionTargetSchema>;\n"]}
@@ -1,63 +0,0 @@
1
- /**
2
- * External Provider Capabilities - Core Definitions
3
- *
4
- * Capabilities represent standardized behaviors that can be implemented
5
- * across multiple providers. Each capability has:
6
- * - A standard interface (request/response schemas)
7
- * - A transformer interface (for provider-specific ETL)
8
- * - Discovery through provider definitions (not protocols)
9
- *
10
- * Capabilities are defined at the PROVIDER level, not protocol level.
11
- * This enables provider-agnostic usage in the backend through
12
- * the ETL (Extract-Transform-Load) pattern.
13
- */
14
- /**
15
- * Standard capabilities that providers can implement.
16
- * Each capability maps to a standardized interface and ETL transformer.
17
- *
18
- * IMPORTANT: Each capability is fully independent - even if related
19
- * (like email capabilities), they have separate transformers and files.
20
- */
21
- export declare enum ExternalConnectorCapability {
22
- /**
23
- * Transactional email sending - password resets, receipts, notifications.
24
- * Standard interface: StandardEmail_SendRequest/Response
25
- * Transformer: EmailTransactional_Transformer
26
- */
27
- EMAIL_TRANSACTIONAL = "email_transactional",
28
- /**
29
- * Marketing email campaigns - newsletters, promotions.
30
- * Standard interface: StandardMarketing_CampaignRequest/Response
31
- * Transformer: EmailMarketing_Transformer
32
- */
33
- EMAIL_MARKETING = "email_marketing",
34
- /**
35
- * Billing provider — subscriptions, payments, invoices, metered usage.
36
- * Standard interface: StandardBilling_Interface
37
- * Transformer: Billing_Transformer
38
- */
39
- BILLING = "billing",
40
- /**
41
- * SMS sending - OTP codes, phone verification, notifications.
42
- * Standard interface: StandardSMS_SendRequest/Response
43
- * Transformer: SMS_Transformer
44
- */
45
- SMS = "sms"
46
- }
47
- /**
48
- * Metadata about each capability for discovery and documentation.
49
- */
50
- export declare const ExternalConnectorCapabilityMetadata: Record<ExternalConnectorCapability, {
51
- displayName: string;
52
- description: string;
53
- category: "email" | "llm" | "auth" | "storage" | "billing" | "sms" | "other";
54
- }>;
55
- /**
56
- * Base interface for all capability transformers.
57
- * Each capability extends this with its specific transformation methods.
58
- */
59
- export interface CapabilityTransformer<TCapability extends ExternalConnectorCapability = ExternalConnectorCapability> {
60
- /** The capability this transformer implements */
61
- readonly providerCapability: TCapability;
62
- }
63
- //# sourceMappingURL=core.external-connectors-models.schemas.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"core.external-connectors-models.schemas.d.ts","sourceRoot":"","sources":["../../../../src/features/core.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH;;;;;;GAMG;AACH,oBAAY,2BAA2B;IAKrC;;;;OAIG;IACH,mBAAmB,wBAAwB;IAE3C;;;;OAIG;IACH,eAAe,oBAAoB;IAenC;;;;OAIG;IACH,OAAO,YAAY;IAMnB;;;;OAIG;IACH,GAAG,QAAQ;CASZ;AAMD;;GAEG;AACH,eAAO,MAAM,mCAAmC,EAAE,MAAM,CAAC,2BAA2B,EAAE;IACpF,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,KAAK,GAAG,OAAO,CAAC;CAC9E,CAqBA,CAAC;AAMF;;;GAGG;AACH,MAAM,WAAW,qBAAqB,CAAC,WAAW,SAAS,2BAA2B,GAAG,2BAA2B;IAClH,iDAAiD;IACjD,QAAQ,CAAC,kBAAkB,EAAE,WAAW,CAAC;CAC1C"}
@@ -1,101 +0,0 @@
1
- /**
2
- * External Provider Capabilities - Core Definitions
3
- *
4
- * Capabilities represent standardized behaviors that can be implemented
5
- * across multiple providers. Each capability has:
6
- * - A standard interface (request/response schemas)
7
- * - A transformer interface (for provider-specific ETL)
8
- * - Discovery through provider definitions (not protocols)
9
- *
10
- * Capabilities are defined at the PROVIDER level, not protocol level.
11
- * This enables provider-agnostic usage in the backend through
12
- * the ETL (Extract-Transform-Load) pattern.
13
- */
14
- // ===============================================================
15
- // Capabilities Enum
16
- // ===============================================================
17
- /**
18
- * Standard capabilities that providers can implement.
19
- * Each capability maps to a standardized interface and ETL transformer.
20
- *
21
- * IMPORTANT: Each capability is fully independent - even if related
22
- * (like email capabilities), they have separate transformers and files.
23
- */
24
- export var ExternalConnectorCapability;
25
- (function (ExternalConnectorCapability) {
26
- // ============================================================
27
- // Email Capabilities (fully segregated)
28
- // ============================================================
29
- /**
30
- * Transactional email sending - password resets, receipts, notifications.
31
- * Standard interface: StandardEmail_SendRequest/Response
32
- * Transformer: EmailTransactional_Transformer
33
- */
34
- ExternalConnectorCapability["EMAIL_TRANSACTIONAL"] = "email_transactional";
35
- /**
36
- * Marketing email campaigns - newsletters, promotions.
37
- * Standard interface: StandardMarketing_CampaignRequest/Response
38
- * Transformer: EmailMarketing_Transformer
39
- */
40
- ExternalConnectorCapability["EMAIL_MARKETING"] = "email_marketing";
41
- // ============================================================
42
- // LLM Capabilities (future)
43
- // ============================================================
44
- // LLM_TEXT_GENERATION = "llm_text_generation",
45
- // LLM_STRUCTURED_OUTPUT = "llm_structured_output",
46
- // LLM_STREAMING = "llm_streaming",
47
- // LLM_MULTIMODAL = "llm_multimodal",
48
- // ============================================================
49
- // Billing Capabilities
50
- // ============================================================
51
- /**
52
- * Billing provider — subscriptions, payments, invoices, metered usage.
53
- * Standard interface: StandardBilling_Interface
54
- * Transformer: Billing_Transformer
55
- */
56
- ExternalConnectorCapability["BILLING"] = "billing";
57
- // ============================================================
58
- // SMS Capabilities (Phase G2)
59
- // ============================================================
60
- /**
61
- * SMS sending - OTP codes, phone verification, notifications.
62
- * Standard interface: StandardSMS_SendRequest/Response
63
- * Transformer: SMS_Transformer
64
- */
65
- ExternalConnectorCapability["SMS"] = "sms";
66
- // ============================================================
67
- // Other Capabilities (future)
68
- // ============================================================
69
- // OAUTH2_SSO = "oauth2_sso",
70
- // WEBHOOK_RECEIVER = "webhook_receiver",
71
- // FILE_STORAGE = "file_storage",
72
- })(ExternalConnectorCapability || (ExternalConnectorCapability = {}));
73
- // ===============================================================
74
- // Capability Metadata
75
- // ===============================================================
76
- /**
77
- * Metadata about each capability for discovery and documentation.
78
- */
79
- export const ExternalConnectorCapabilityMetadata = {
80
- [ExternalConnectorCapability.EMAIL_TRANSACTIONAL]: {
81
- displayName: "Transactional Email",
82
- description: "Send transactional emails like password resets, receipts, and notifications",
83
- category: "email",
84
- },
85
- [ExternalConnectorCapability.EMAIL_MARKETING]: {
86
- displayName: "Marketing Email",
87
- description: "Send marketing campaigns, newsletters, and promotional emails",
88
- category: "email",
89
- },
90
- [ExternalConnectorCapability.BILLING]: {
91
- displayName: "Billing",
92
- description: "Manage subscriptions, payments, invoices, and metered usage via a billing provider",
93
- category: "billing",
94
- },
95
- [ExternalConnectorCapability.SMS]: {
96
- displayName: "SMS",
97
- description: "Send SMS messages for OTP codes, phone verification, and notifications",
98
- category: "sms",
99
- },
100
- };
101
- //# sourceMappingURL=core.external-connectors-models.schemas.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"core.external-connectors-models.schemas.js","sourceRoot":"","sources":["../../../../src/features/core.external-connectors-models.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;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QACrF,QAAQ,EAAE,KAAK;KAChB;CACF,CAAC","sourcesContent":["/**\n * External Provider Capabilities - Core Definitions\n * \n * Capabilities represent standardized behaviors that can be implemented\n * across multiple providers. Each capability has:\n * - A standard interface (request/response schemas)\n * - A transformer interface (for provider-specific ETL)\n * - Discovery through provider definitions (not protocols)\n * \n * Capabilities are defined at the PROVIDER level, not protocol level.\n * This enables provider-agnostic usage in the backend through\n * the ETL (Extract-Transform-Load) pattern.\n */\n\n// ===============================================================\n// Capabilities Enum\n// ===============================================================\n\n/**\n * Standard capabilities that providers can implement.\n * Each capability maps to a standardized interface and ETL transformer.\n * \n * IMPORTANT: Each capability is fully independent - even if related\n * (like email capabilities), they have separate transformers and files.\n */\nexport enum ExternalConnectorCapability {\n // ============================================================\n // Email Capabilities (fully segregated)\n // ============================================================\n \n /** \n * Transactional email sending - password resets, receipts, notifications.\n * Standard interface: StandardEmail_SendRequest/Response\n * Transformer: EmailTransactional_Transformer\n */\n EMAIL_TRANSACTIONAL = \"email_transactional\",\n \n /** \n * Marketing email campaigns - newsletters, promotions.\n * Standard interface: StandardMarketing_CampaignRequest/Response\n * Transformer: EmailMarketing_Transformer\n */\n EMAIL_MARKETING = \"email_marketing\",\n\n // ============================================================\n // LLM Capabilities (future)\n // ============================================================\n \n // LLM_TEXT_GENERATION = \"llm_text_generation\",\n // LLM_STRUCTURED_OUTPUT = \"llm_structured_output\",\n // LLM_STREAMING = \"llm_streaming\",\n // LLM_MULTIMODAL = \"llm_multimodal\",\n \n // ============================================================\n // Billing Capabilities\n // ============================================================\n\n /**\n * Billing provider — subscriptions, payments, invoices, metered usage.\n * Standard interface: StandardBilling_Interface\n * Transformer: Billing_Transformer\n */\n BILLING = \"billing\",\n\n // ============================================================\n // SMS Capabilities (Phase G2)\n // ============================================================\n\n /**\n * SMS sending - OTP codes, phone verification, notifications.\n * Standard interface: StandardSMS_SendRequest/Response\n * Transformer: SMS_Transformer\n */\n SMS = \"sms\",\n\n // ============================================================\n // Other Capabilities (future)\n // ============================================================\n \n // OAUTH2_SSO = \"oauth2_sso\",\n // WEBHOOK_RECEIVER = \"webhook_receiver\",\n // FILE_STORAGE = \"file_storage\",\n}\n\n// ===============================================================\n// Capability Metadata\n// ===============================================================\n\n/**\n * Metadata about each capability for discovery and documentation.\n */\nexport const ExternalConnectorCapabilityMetadata: Record<ExternalConnectorCapability, {\n displayName: string;\n description: string;\n category: \"email\" | \"llm\" | \"auth\" | \"storage\" | \"billing\" | \"sms\" | \"other\";\n}> = {\n [ExternalConnectorCapability.EMAIL_TRANSACTIONAL]: {\n displayName: \"Transactional Email\",\n description: \"Send transactional emails like password resets, receipts, and notifications\",\n category: \"email\",\n },\n [ExternalConnectorCapability.EMAIL_MARKETING]: {\n displayName: \"Marketing Email\",\n description: \"Send marketing campaigns, newsletters, and promotional emails\",\n category: \"email\",\n },\n [ExternalConnectorCapability.BILLING]: {\n displayName: \"Billing\",\n description: \"Manage subscriptions, payments, invoices, and metered usage via a billing provider\",\n category: \"billing\",\n },\n [ExternalConnectorCapability.SMS]: {\n displayName: \"SMS\",\n description: \"Send SMS messages for OTP codes, phone verification, and notifications\",\n category: \"sms\",\n },\n};\n\n// ===============================================================\n// Capability Transformer Base\n// ===============================================================\n\n/**\n * Base interface for all capability transformers.\n * Each capability extends this with its specific transformation methods.\n */\nexport interface CapabilityTransformer<TCapability extends ExternalConnectorCapability = ExternalConnectorCapability> {\n /** The capability this transformer implements */\n readonly providerCapability: TCapability;\n}\n"]}