@shipfox/api-integration-core-dto 12.0.0 → 14.0.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.
@@ -1,2 +1,2 @@
1
1
  $ shipfox-swc
2
- Successfully compiled: 8 files with swc (265.42ms)
2
+ Successfully compiled: 8 files with swc (266.26ms)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @shipfox/api-integration-core-dto
2
2
 
3
+ ## 14.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 18e9bad: Adds source-control ref resolution that pins branch and tag names to commits.
8
+
9
+ ### Minor Changes
10
+
11
+ - c44641f: Adds provider capabilities to the `integrations.connection.available` event, so subscribers can tell a tool connection from a source-control connection. The publisher now carries the capabilities the connection DTO already exposes.
12
+ - 1b71a66: Exposes each provider's event catalog and the fixed-event providers on the integration validation context. Every provider now refuses the reserved `manual` and `cron` connection slugs.
13
+
14
+ ## 12.2.0
15
+
16
+ ### Minor Changes
17
+
18
+ - 7901a60: Retry workspace workflow definition syncs when an integration connection becomes available.
19
+
3
20
  ## 12.0.0
4
21
 
5
22
  ### Major Changes
package/dist/events.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod';
2
- export declare const INTEGRATION_EVENT_RECEIVED: "integrations.event.received";
2
+ export declare const INTEGRATION_EVENT_RECEIVED: 'integrations.event.received';
3
+ export declare const INTEGRATION_CONNECTION_AVAILABLE: 'integrations.connection.available';
3
4
  export declare const integrationEventReceivedSchema: z.ZodObject<{
4
5
  provider: z.ZodString;
5
6
  source: z.ZodString;
@@ -12,6 +13,17 @@ export declare const integrationEventReceivedSchema: z.ZodObject<{
12
13
  payload: z.ZodCustom<unknown, unknown>;
13
14
  }, z.core.$strip>;
14
15
  export type IntegrationEventReceivedEvent = z.infer<typeof integrationEventReceivedSchema>;
16
+ export declare const integrationConnectionAvailableSchema: z.ZodObject<{
17
+ provider: z.ZodString;
18
+ workspaceId: z.ZodString;
19
+ connectionId: z.ZodString;
20
+ slug: z.ZodString;
21
+ capabilities: z.ZodDefault<z.ZodArray<z.ZodEnum<{
22
+ agent_tools: "agent_tools";
23
+ source_control: "source_control";
24
+ }>>>;
25
+ }, z.core.$strip>;
26
+ export type IntegrationConnectionAvailableEvent = z.infer<typeof integrationConnectionAvailableSchema>;
15
27
  export declare const sourcePushSchema: z.ZodObject<{
16
28
  externalRepositoryId: z.ZodString;
17
29
  ref: z.ZodString;
@@ -20,7 +32,7 @@ export declare const sourcePushSchema: z.ZodObject<{
20
32
  isDefaultBranch: z.ZodBoolean;
21
33
  }, z.core.$strip>;
22
34
  export type SourcePushPayload = z.infer<typeof sourcePushSchema>;
23
- export declare const INTEGRATION_SOURCE_COMMIT_PUSHED: "integrations.source_control.commit_pushed";
35
+ export declare const INTEGRATION_SOURCE_COMMIT_PUSHED: 'integrations.source_control.commit_pushed';
24
36
  export declare const integrationSourceCommitPushedSchema: z.ZodObject<{
25
37
  provider: z.ZodString;
26
38
  workspaceId: z.ZodString;
@@ -43,7 +55,7 @@ export declare const sourceRepositoryIdentitySchema: z.ZodObject<{
43
55
  defaultBranch: z.ZodString;
44
56
  }, z.core.$strip>;
45
57
  export type SourceRepositoryIdentity = z.infer<typeof sourceRepositoryIdentitySchema>;
46
- export declare const INTEGRATION_SOURCE_REPOSITORY_UPDATED: "integrations.source_control.repository_updated";
58
+ export declare const INTEGRATION_SOURCE_REPOSITORY_UPDATED: 'integrations.source_control.repository_updated';
47
59
  export declare const integrationSourceRepositoryUpdatedSchema: z.ZodObject<{
48
60
  provider: z.ZodString;
49
61
  workspaceId: z.ZodString;
@@ -73,14 +85,25 @@ export interface SentryIssuePayload {
73
85
  firstSeenAt: string | null;
74
86
  lastSeenAt: string | null;
75
87
  }
76
- export declare const SENTRY_ISSUE_ACTIONS: readonly ["created", "resolved", "assigned", "archived", "unresolved"];
88
+ export declare const SENTRY_ISSUE_ACTIONS: readonly ['created', 'resolved', 'assigned', 'archived', 'unresolved'];
77
89
  export type SentryIssueAction = (typeof SENTRY_ISSUE_ACTIONS)[number];
78
90
  export interface IntegrationsEventMap {
91
+ [INTEGRATION_CONNECTION_AVAILABLE]: IntegrationConnectionAvailableEvent;
79
92
  [INTEGRATION_EVENT_RECEIVED]: IntegrationEventReceivedEvent;
80
93
  [INTEGRATION_SOURCE_COMMIT_PUSHED]: IntegrationSourceCommitPushedEvent;
81
94
  [INTEGRATION_SOURCE_REPOSITORY_UPDATED]: IntegrationSourceRepositoryUpdatedEvent;
82
95
  }
83
96
  export declare const integrationsEventSchemas: {
97
+ "integrations.connection.available": z.ZodObject<{
98
+ provider: z.ZodString;
99
+ workspaceId: z.ZodString;
100
+ connectionId: z.ZodString;
101
+ slug: z.ZodString;
102
+ capabilities: z.ZodDefault<z.ZodArray<z.ZodEnum<{
103
+ agent_tools: "agent_tools";
104
+ source_control: "source_control";
105
+ }>>>;
106
+ }, z.core.$strip>;
84
107
  "integrations.event.received": z.ZodObject<{
85
108
  provider: z.ZodString;
86
109
  source: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,eAAO,MAAM,0BAA0B,EAAG,6BAAsC,CAAC;AAOjF,eAAO,MAAM,8BAA8B;;;;;;;;;;iBAYzC,CAAC;AACH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAI3F,eAAO,MAAM,gBAAgB;;;;;;iBAM3B,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEjE,eAAO,MAAM,gCAAgC,EAC3C,2CAAoD,CAAC;AAKvD,eAAO,MAAM,mCAAmC;;;;;;;;;;;;;iBAO9C,CAAC;AACH,MAAM,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,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AO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAKD,eAAO,MAAM,oBAAoB,YAC/B,SAAS,EACT,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,CACJ,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,MAAM,WAAW,oBAAoB;IACnC,CAAC,gCAAgC,CAAC,EAAE,mCAAmC,CAAC;IACxE,CAAC,0BAA0B,CAAC,EAAE,6BAA6B,CAAC;IAC5D,CAAC,gCAAgC,CAAC,EAAE,kCAAkC,CAAC;IACvE,CAAC,qCAAqC,CAAC,EAAE,uCAAuC,CAAC;CAClF;AAED,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAKoB,CAAC"}
package/dist/events.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import { z } from 'zod';
2
+ import { integrationCapabilitySchema } from './schemas/integrations.js';
2
3
  export const INTEGRATION_EVENT_RECEIVED = 'integrations.event.received';
4
+ export const INTEGRATION_CONNECTION_AVAILABLE = 'integrations.connection.available';
3
5
  const nonEmptyStringSchema = z.string().nonempty();
4
6
  const isoDateTimeSchema = z.string().datetime();
5
7
  const requiredUnknownSchema = z.custom((value)=>value !== undefined);
@@ -17,6 +19,17 @@ export const integrationEventReceivedSchema = z.object({
17
19
  receivedAt: isoDateTimeSchema,
18
20
  payload: requiredUnknownSchema
19
21
  });
22
+ export const integrationConnectionAvailableSchema = z.object({
23
+ provider: nonEmptyStringSchema,
24
+ workspaceId: nonEmptyStringSchema,
25
+ connectionId: nonEmptyStringSchema,
26
+ slug: nonEmptyStringSchema,
27
+ // Provider registry capabilities, so subscribers can tell a tool connection
28
+ // from a source-control connection without their own provider table.
29
+ // Defaulting keeps availability events written before this field existed
30
+ // deliverable while every new event is still constrained to known capabilities.
31
+ capabilities: z.array(integrationCapabilitySchema).max(16).default([])
32
+ });
20
33
  // A source-control push, normalized by the producing provider and carried by
21
34
  // `INTEGRATION_SOURCE_COMMIT_PUSHED` for domain consumers.
22
35
  export const sourcePushSchema = z.object({
@@ -67,6 +80,7 @@ export const SENTRY_ISSUE_ACTIONS = [
67
80
  'unresolved'
68
81
  ];
69
82
  export const integrationsEventSchemas = {
83
+ [INTEGRATION_CONNECTION_AVAILABLE]: integrationConnectionAvailableSchema,
70
84
  [INTEGRATION_EVENT_RECEIVED]: integrationEventReceivedSchema,
71
85
  [INTEGRATION_SOURCE_COMMIT_PUSHED]: integrationSourceCommitPushedSchema,
72
86
  [INTEGRATION_SOURCE_REPOSITORY_UPDATED]: integrationSourceRepositoryUpdatedSchema
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/events.ts"],"sourcesContent":["import {z} from 'zod';\n\nexport const INTEGRATION_EVENT_RECEIVED = 'integrations.event.received' as const;\n\nconst nonEmptyStringSchema = z.string().nonempty();\nconst isoDateTimeSchema = z.string().datetime();\nconst requiredUnknownSchema = z.custom<unknown>((value) => value !== undefined);\nconst nullableConnectionNameSchema = nonEmptyStringSchema.nullish().default(null);\n\nexport const integrationEventReceivedSchema = z.object({\n provider: nonEmptyStringSchema,\n source: nonEmptyStringSchema,\n event: nonEmptyStringSchema,\n workspaceId: nonEmptyStringSchema,\n connectionId: nonEmptyStringSchema,\n // Denormalized so trigger consumers can render the connection name without a\n // synchronous callback into the integrations module.\n connectionName: nullableConnectionNameSchema,\n deliveryId: nonEmptyStringSchema,\n receivedAt: isoDateTimeSchema,\n payload: requiredUnknownSchema,\n});\nexport type IntegrationEventReceivedEvent = z.infer<typeof integrationEventReceivedSchema>;\n\n// A source-control push, normalized by the producing provider and carried by\n// `INTEGRATION_SOURCE_COMMIT_PUSHED` for domain consumers.\nexport const sourcePushSchema = z.object({\n externalRepositoryId: nonEmptyStringSchema,\n ref: nonEmptyStringSchema,\n headCommitSha: nonEmptyStringSchema,\n defaultBranch: nonEmptyStringSchema,\n isDefaultBranch: z.boolean(),\n});\nexport type SourcePushPayload = z.infer<typeof sourcePushSchema>;\n\nexport const INTEGRATION_SOURCE_COMMIT_PUSHED =\n 'integrations.source_control.commit_pushed' as const;\n\n// Typed, provider-agnostic source-control event. The producing provider owns the\n// translation from its raw webhook into this shape, so domain consumers never decode\n// provider payloads. `isDefaultBranch` is a fact; the branch policy lives in the consumer.\nexport const integrationSourceCommitPushedSchema = z.object({\n provider: nonEmptyStringSchema,\n workspaceId: nonEmptyStringSchema,\n connectionId: nonEmptyStringSchema,\n deliveryId: nonEmptyStringSchema,\n receivedAt: isoDateTimeSchema,\n push: sourcePushSchema,\n});\nexport type IntegrationSourceCommitPushedEvent = z.infer<\n typeof integrationSourceCommitPushedSchema\n>;\n\nexport const sourceRepositoryIdentitySchema = z.object({\n externalRepositoryId: nonEmptyStringSchema,\n owner: nonEmptyStringSchema,\n name: nonEmptyStringSchema,\n defaultBranch: nonEmptyStringSchema,\n});\nexport type SourceRepositoryIdentity = z.infer<typeof sourceRepositoryIdentitySchema>;\n\nexport const INTEGRATION_SOURCE_REPOSITORY_UPDATED =\n 'integrations.source_control.repository_updated' as const;\n\n// Typed, provider-agnostic source-control event. The producing provider owns the\n// translation from its raw webhook into this shape, so domain consumers never decode\n// provider payloads.\nexport const integrationSourceRepositoryUpdatedSchema = z.object({\n provider: nonEmptyStringSchema,\n workspaceId: nonEmptyStringSchema,\n connectionId: nonEmptyStringSchema,\n deliveryId: nonEmptyStringSchema,\n receivedAt: isoDateTimeSchema,\n repository: sourceRepositoryIdentitySchema,\n});\nexport type IntegrationSourceRepositoryUpdatedEvent = z.infer<\n typeof integrationSourceRepositoryUpdatedSchema\n>;\n\nexport interface SentryIssuePayload {\n action: SentryIssueAction;\n issueId: string;\n shortId: string | null;\n title: string;\n culprit: string | null;\n level: string | null;\n status: string | null;\n platform: string | null;\n webUrl: string | null;\n issueUrl: string | null;\n projectUrl: string | null;\n firstSeenAt: string | null;\n lastSeenAt: string | null;\n}\n\n// Single source of truth for Sentry issue actions: the sentry-dto webhook schema\n// builds its z.enum from this tuple, so accepted webhook actions and the published\n// SentryIssuePayload contract cannot drift.\nexport const SENTRY_ISSUE_ACTIONS = [\n 'created',\n 'resolved',\n 'assigned',\n 'archived',\n 'unresolved',\n] as const;\n\nexport type SentryIssueAction = (typeof SENTRY_ISSUE_ACTIONS)[number];\n\nexport interface IntegrationsEventMap {\n [INTEGRATION_EVENT_RECEIVED]: IntegrationEventReceivedEvent;\n [INTEGRATION_SOURCE_COMMIT_PUSHED]: IntegrationSourceCommitPushedEvent;\n [INTEGRATION_SOURCE_REPOSITORY_UPDATED]: IntegrationSourceRepositoryUpdatedEvent;\n}\n\nexport const integrationsEventSchemas = {\n [INTEGRATION_EVENT_RECEIVED]: integrationEventReceivedSchema,\n [INTEGRATION_SOURCE_COMMIT_PUSHED]: integrationSourceCommitPushedSchema,\n [INTEGRATION_SOURCE_REPOSITORY_UPDATED]: integrationSourceRepositoryUpdatedSchema,\n} satisfies Record<keyof IntegrationsEventMap, z.ZodType>;\n"],"names":["z","INTEGRATION_EVENT_RECEIVED","nonEmptyStringSchema","string","nonempty","isoDateTimeSchema","datetime","requiredUnknownSchema","custom","value","undefined","nullableConnectionNameSchema","nullish","default","integrationEventReceivedSchema","object","provider","source","event","workspaceId","connectionId","connectionName","deliveryId","receivedAt","payload","sourcePushSchema","externalRepositoryId","ref","headCommitSha","defaultBranch","isDefaultBranch","boolean","INTEGRATION_SOURCE_COMMIT_PUSHED","integrationSourceCommitPushedSchema","push","sourceRepositoryIdentitySchema","owner","name","INTEGRATION_SOURCE_REPOSITORY_UPDATED","integrationSourceRepositoryUpdatedSchema","repository","SENTRY_ISSUE_ACTIONS","integrationsEventSchemas"],"mappings":"AAAA,SAAQA,CAAC,QAAO,MAAM;AAEtB,OAAO,MAAMC,6BAA6B,8BAAuC;AAEjF,MAAMC,uBAAuBF,EAAEG,MAAM,GAAGC,QAAQ;AAChD,MAAMC,oBAAoBL,EAAEG,MAAM,GAAGG,QAAQ;AAC7C,MAAMC,wBAAwBP,EAAEQ,MAAM,CAAU,CAACC,QAAUA,UAAUC;AACrE,MAAMC,+BAA+BT,qBAAqBU,OAAO,GAAGC,OAAO,CAAC;AAE5E,OAAO,MAAMC,iCAAiCd,EAAEe,MAAM,CAAC;IACrDC,UAAUd;IACVe,QAAQf;IACRgB,OAAOhB;IACPiB,aAAajB;IACbkB,cAAclB;IACd,6EAA6E;IAC7E,qDAAqD;IACrDmB,gBAAgBV;IAChBW,YAAYpB;IACZqB,YAAYlB;IACZmB,SAASjB;AACX,GAAG;AAGH,6EAA6E;AAC7E,2DAA2D;AAC3D,OAAO,MAAMkB,mBAAmBzB,EAAEe,MAAM,CAAC;IACvCW,sBAAsBxB;IACtByB,KAAKzB;IACL0B,eAAe1B;IACf2B,eAAe3B;IACf4B,iBAAiB9B,EAAE+B,OAAO;AAC5B,GAAG;AAGH,OAAO,MAAMC,mCACX,4CAAqD;AAEvD,iFAAiF;AACjF,qFAAqF;AACrF,2FAA2F;AAC3F,OAAO,MAAMC,sCAAsCjC,EAAEe,MAAM,CAAC;IAC1DC,UAAUd;IACViB,aAAajB;IACbkB,cAAclB;IACdoB,YAAYpB;IACZqB,YAAYlB;IACZ6B,MAAMT;AACR,GAAG;AAKH,OAAO,MAAMU,iCAAiCnC,EAAEe,MAAM,CAAC;IACrDW,sBAAsBxB;IACtBkC,OAAOlC;IACPmC,MAAMnC;IACN2B,eAAe3B;AACjB,GAAG;AAGH,OAAO,MAAMoC,wCACX,iDAA0D;AAE5D,iFAAiF;AACjF,qFAAqF;AACrF,qBAAqB;AACrB,OAAO,MAAMC,2CAA2CvC,EAAEe,MAAM,CAAC;IAC/DC,UAAUd;IACViB,aAAajB;IACbkB,cAAclB;IACdoB,YAAYpB;IACZqB,YAAYlB;IACZmC,YAAYL;AACd,GAAG;AAqBH,iFAAiF;AACjF,mFAAmF;AACnF,4CAA4C;AAC5C,OAAO,MAAMM,uBAAuB;IAClC;IACA;IACA;IACA;IACA;CACD,CAAU;AAUX,OAAO,MAAMC,2BAA2B;IACtC,CAACzC,2BAA2B,EAAEa;IAC9B,CAACkB,iCAAiC,EAAEC;IACpC,CAACK,sCAAsC,EAAEC;AAC3C,EAA0D"}
1
+ {"version":3,"sources":["../src/events.ts"],"sourcesContent":["import {z} from 'zod';\nimport {integrationCapabilitySchema} from './schemas/integrations.js';\n\nexport const INTEGRATION_EVENT_RECEIVED = 'integrations.event.received' as const;\nexport const INTEGRATION_CONNECTION_AVAILABLE = 'integrations.connection.available' as const;\n\nconst nonEmptyStringSchema = z.string().nonempty();\nconst isoDateTimeSchema = z.string().datetime();\nconst requiredUnknownSchema = z.custom<unknown>((value) => value !== undefined);\nconst nullableConnectionNameSchema = nonEmptyStringSchema.nullish().default(null);\n\nexport const integrationEventReceivedSchema = z.object({\n provider: nonEmptyStringSchema,\n source: nonEmptyStringSchema,\n event: nonEmptyStringSchema,\n workspaceId: nonEmptyStringSchema,\n connectionId: nonEmptyStringSchema,\n // Denormalized so trigger consumers can render the connection name without a\n // synchronous callback into the integrations module.\n connectionName: nullableConnectionNameSchema,\n deliveryId: nonEmptyStringSchema,\n receivedAt: isoDateTimeSchema,\n payload: requiredUnknownSchema,\n});\nexport type IntegrationEventReceivedEvent = z.infer<typeof integrationEventReceivedSchema>;\n\nexport const integrationConnectionAvailableSchema = z.object({\n provider: nonEmptyStringSchema,\n workspaceId: nonEmptyStringSchema,\n connectionId: nonEmptyStringSchema,\n slug: nonEmptyStringSchema,\n // Provider registry capabilities, so subscribers can tell a tool connection\n // from a source-control connection without their own provider table.\n // Defaulting keeps availability events written before this field existed\n // deliverable while every new event is still constrained to known capabilities.\n capabilities: z.array(integrationCapabilitySchema).max(16).default([]),\n});\nexport type IntegrationConnectionAvailableEvent = z.infer<\n typeof integrationConnectionAvailableSchema\n>;\n\n// A source-control push, normalized by the producing provider and carried by\n// `INTEGRATION_SOURCE_COMMIT_PUSHED` for domain consumers.\nexport const sourcePushSchema = z.object({\n externalRepositoryId: nonEmptyStringSchema,\n ref: nonEmptyStringSchema,\n headCommitSha: nonEmptyStringSchema,\n defaultBranch: nonEmptyStringSchema,\n isDefaultBranch: z.boolean(),\n});\nexport type SourcePushPayload = z.infer<typeof sourcePushSchema>;\n\nexport const INTEGRATION_SOURCE_COMMIT_PUSHED =\n 'integrations.source_control.commit_pushed' as const;\n\n// Typed, provider-agnostic source-control event. The producing provider owns the\n// translation from its raw webhook into this shape, so domain consumers never decode\n// provider payloads. `isDefaultBranch` is a fact; the branch policy lives in the consumer.\nexport const integrationSourceCommitPushedSchema = z.object({\n provider: nonEmptyStringSchema,\n workspaceId: nonEmptyStringSchema,\n connectionId: nonEmptyStringSchema,\n deliveryId: nonEmptyStringSchema,\n receivedAt: isoDateTimeSchema,\n push: sourcePushSchema,\n});\nexport type IntegrationSourceCommitPushedEvent = z.infer<\n typeof integrationSourceCommitPushedSchema\n>;\n\nexport const sourceRepositoryIdentitySchema = z.object({\n externalRepositoryId: nonEmptyStringSchema,\n owner: nonEmptyStringSchema,\n name: nonEmptyStringSchema,\n defaultBranch: nonEmptyStringSchema,\n});\nexport type SourceRepositoryIdentity = z.infer<typeof sourceRepositoryIdentitySchema>;\n\nexport const INTEGRATION_SOURCE_REPOSITORY_UPDATED =\n 'integrations.source_control.repository_updated' as const;\n\n// Typed, provider-agnostic source-control event. The producing provider owns the\n// translation from its raw webhook into this shape, so domain consumers never decode\n// provider payloads.\nexport const integrationSourceRepositoryUpdatedSchema = z.object({\n provider: nonEmptyStringSchema,\n workspaceId: nonEmptyStringSchema,\n connectionId: nonEmptyStringSchema,\n deliveryId: nonEmptyStringSchema,\n receivedAt: isoDateTimeSchema,\n repository: sourceRepositoryIdentitySchema,\n});\nexport type IntegrationSourceRepositoryUpdatedEvent = z.infer<\n typeof integrationSourceRepositoryUpdatedSchema\n>;\n\nexport interface SentryIssuePayload {\n action: SentryIssueAction;\n issueId: string;\n shortId: string | null;\n title: string;\n culprit: string | null;\n level: string | null;\n status: string | null;\n platform: string | null;\n webUrl: string | null;\n issueUrl: string | null;\n projectUrl: string | null;\n firstSeenAt: string | null;\n lastSeenAt: string | null;\n}\n\n// Single source of truth for Sentry issue actions: the sentry-dto webhook schema\n// builds its z.enum from this tuple, so accepted webhook actions and the published\n// SentryIssuePayload contract cannot drift.\nexport const SENTRY_ISSUE_ACTIONS = [\n 'created',\n 'resolved',\n 'assigned',\n 'archived',\n 'unresolved',\n] as const;\n\nexport type SentryIssueAction = (typeof SENTRY_ISSUE_ACTIONS)[number];\n\nexport interface IntegrationsEventMap {\n [INTEGRATION_CONNECTION_AVAILABLE]: IntegrationConnectionAvailableEvent;\n [INTEGRATION_EVENT_RECEIVED]: IntegrationEventReceivedEvent;\n [INTEGRATION_SOURCE_COMMIT_PUSHED]: IntegrationSourceCommitPushedEvent;\n [INTEGRATION_SOURCE_REPOSITORY_UPDATED]: IntegrationSourceRepositoryUpdatedEvent;\n}\n\nexport const integrationsEventSchemas = {\n [INTEGRATION_CONNECTION_AVAILABLE]: integrationConnectionAvailableSchema,\n [INTEGRATION_EVENT_RECEIVED]: integrationEventReceivedSchema,\n [INTEGRATION_SOURCE_COMMIT_PUSHED]: integrationSourceCommitPushedSchema,\n [INTEGRATION_SOURCE_REPOSITORY_UPDATED]: integrationSourceRepositoryUpdatedSchema,\n} satisfies Record<keyof IntegrationsEventMap, z.ZodType>;\n"],"names":["z","integrationCapabilitySchema","INTEGRATION_EVENT_RECEIVED","INTEGRATION_CONNECTION_AVAILABLE","nonEmptyStringSchema","string","nonempty","isoDateTimeSchema","datetime","requiredUnknownSchema","custom","value","undefined","nullableConnectionNameSchema","nullish","default","integrationEventReceivedSchema","object","provider","source","event","workspaceId","connectionId","connectionName","deliveryId","receivedAt","payload","integrationConnectionAvailableSchema","slug","capabilities","array","max","sourcePushSchema","externalRepositoryId","ref","headCommitSha","defaultBranch","isDefaultBranch","boolean","INTEGRATION_SOURCE_COMMIT_PUSHED","integrationSourceCommitPushedSchema","push","sourceRepositoryIdentitySchema","owner","name","INTEGRATION_SOURCE_REPOSITORY_UPDATED","integrationSourceRepositoryUpdatedSchema","repository","SENTRY_ISSUE_ACTIONS","integrationsEventSchemas"],"mappings":"AAAA,SAAQA,CAAC,QAAO,MAAM;AACtB,SAAQC,2BAA2B,QAAO,4BAA4B;AAEtE,OAAO,MAAMC,6BAA6B,8BAAuC;AACjF,OAAO,MAAMC,mCAAmC,oCAA6C;AAE7F,MAAMC,uBAAuBJ,EAAEK,MAAM,GAAGC,QAAQ;AAChD,MAAMC,oBAAoBP,EAAEK,MAAM,GAAGG,QAAQ;AAC7C,MAAMC,wBAAwBT,EAAEU,MAAM,CAAU,CAACC,QAAUA,UAAUC;AACrE,MAAMC,+BAA+BT,qBAAqBU,OAAO,GAAGC,OAAO,CAAC;AAE5E,OAAO,MAAMC,iCAAiChB,EAAEiB,MAAM,CAAC;IACrDC,UAAUd;IACVe,QAAQf;IACRgB,OAAOhB;IACPiB,aAAajB;IACbkB,cAAclB;IACd,6EAA6E;IAC7E,qDAAqD;IACrDmB,gBAAgBV;IAChBW,YAAYpB;IACZqB,YAAYlB;IACZmB,SAASjB;AACX,GAAG;AAGH,OAAO,MAAMkB,uCAAuC3B,EAAEiB,MAAM,CAAC;IAC3DC,UAAUd;IACViB,aAAajB;IACbkB,cAAclB;IAC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4,13 +4,13 @@ import { z } from 'zod';
4
4
  export declare const integrationsInterModuleContract: import("@shipfox/inter-module").InterModuleContract<{
5
5
  readonly module: "integrations";
6
6
  readonly methods: {
7
- readonly resolveSourceRepository: {
8
- readonly input: z.ZodObject<{
7
+ resolveSourceRepository: {
8
+ input: z.ZodObject<{
9
9
  workspaceId: z.ZodString;
10
10
  connectionId: z.ZodString;
11
11
  externalRepositoryId: z.ZodString;
12
12
  }, z.core.$strip>;
13
- readonly output: z.ZodObject<{
13
+ output: z.ZodObject<{
14
14
  connection: z.ZodObject<{
15
15
  id: z.ZodString;
16
16
  provider: z.ZodString;
@@ -23,16 +23,16 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
23
23
  fullName: z.ZodString;
24
24
  defaultBranch: z.ZodString;
25
25
  visibility: z.ZodEnum<{
26
- unknown: "unknown";
27
- public: "public";
28
- private: "private";
29
26
  internal: "internal";
27
+ private: "private";
28
+ public: "public";
29
+ unknown: "unknown";
30
30
  }>;
31
31
  cloneUrl: z.ZodString;
32
32
  htmlUrl: z.ZodString;
33
33
  }, z.core.$strip>;
34
34
  }, z.core.$strip>;
35
- readonly errors: {
35
+ errors: {
36
36
  'connection-not-found': z.ZodObject<{
37
37
  connectionId: z.ZodString;
38
38
  }, z.core.$strip>;
@@ -48,8 +48,8 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
48
48
  'capability-unavailable': z.ZodObject<{
49
49
  provider: z.ZodString;
50
50
  capability: z.ZodEnum<{
51
- source_control: "source_control";
52
51
  agent_tools: "agent_tools";
52
+ source_control: "source_control";
53
53
  }>;
54
54
  }, z.core.$strip>;
55
55
  'checkout-unsupported': z.ZodObject<{
@@ -61,30 +61,30 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
61
61
  }, z.core.$strip>;
62
62
  };
63
63
  };
64
- readonly resolveConnection: {
65
- readonly input: z.ZodObject<{
64
+ resolveConnection: {
65
+ input: z.ZodObject<{
66
66
  workspaceId: z.ZodString;
67
67
  slug: z.ZodString;
68
68
  }, z.core.$strip>;
69
- readonly output: z.ZodNullable<z.ZodObject<{
69
+ output: z.ZodNullable<z.ZodObject<{
70
70
  id: z.ZodString;
71
71
  provider: z.ZodString;
72
72
  slug: z.ZodString;
73
73
  }, z.core.$strip>>;
74
74
  };
75
- readonly resolveTriggerReference: {
76
- readonly input: z.ZodObject<{
75
+ resolveTriggerReference: {
76
+ input: z.ZodObject<{
77
77
  workspaceId: z.ZodString;
78
78
  connectionId: z.ZodString;
79
79
  payload: z.ZodUnknown;
80
80
  }, z.core.$strip>;
81
- readonly output: z.ZodNullable<z.ZodObject<{
81
+ output: z.ZodNullable<z.ZodObject<{
82
82
  externalRepositoryId: z.ZodString;
83
83
  ref: z.ZodString;
84
84
  commit: z.ZodString;
85
85
  actor: z.ZodNullable<z.ZodString>;
86
86
  }, z.core.$strip>>;
87
- readonly errors: {
87
+ errors: {
88
88
  'connection-not-found': z.ZodObject<{
89
89
  connectionId: z.ZodString;
90
90
  }, z.core.$strip>;
@@ -100,8 +100,48 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
100
100
  'capability-unavailable': z.ZodObject<{
101
101
  provider: z.ZodString;
102
102
  capability: z.ZodEnum<{
103
+ agent_tools: "agent_tools";
103
104
  source_control: "source_control";
105
+ }>;
106
+ }, z.core.$strip>;
107
+ 'checkout-unsupported': z.ZodObject<{
108
+ provider: z.ZodString;
109
+ }, z.core.$strip>;
110
+ 'provider-failure': z.ZodObject<{
111
+ reason: z.ZodString;
112
+ retryAfterSeconds: z.ZodOptional<z.ZodNumber>;
113
+ }, z.core.$strip>;
114
+ };
115
+ };
116
+ resolveSourceRef: {
117
+ input: z.ZodObject<{
118
+ workspaceId: z.ZodString;
119
+ connectionId: z.ZodString;
120
+ externalRepositoryId: z.ZodString;
121
+ ref: z.ZodString;
122
+ }, z.core.$strip>;
123
+ output: z.ZodObject<{
124
+ ref: z.ZodString;
125
+ commit: z.ZodString;
126
+ }, z.core.$strip>;
127
+ errors: {
128
+ 'connection-not-found': z.ZodObject<{
129
+ connectionId: z.ZodString;
130
+ }, z.core.$strip>;
131
+ 'connection-inactive': z.ZodObject<{
132
+ connectionId: z.ZodString;
133
+ }, z.core.$strip>;
134
+ 'connection-workspace-mismatch': z.ZodObject<{
135
+ connectionId: z.ZodString;
136
+ }, z.core.$strip>;
137
+ 'provider-unavailable': z.ZodObject<{
138
+ provider: z.ZodString;
139
+ }, z.core.$strip>;
140
+ 'capability-unavailable': z.ZodObject<{
141
+ provider: z.ZodString;
142
+ capability: z.ZodEnum<{
104
143
  agent_tools: "agent_tools";
144
+ source_control: "source_control";
105
145
  }>;
106
146
  }, z.core.$strip>;
107
147
  'checkout-unsupported': z.ZodObject<{
@@ -111,10 +151,16 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
111
151
  reason: z.ZodString;
112
152
  retryAfterSeconds: z.ZodOptional<z.ZodNumber>;
113
153
  }, z.core.$strip>;
154
+ 'ref-not-found': z.ZodObject<{
155
+ ref: z.ZodString;
156
+ }, z.core.$strip>;
157
+ 'ref-invalid': z.ZodObject<{
158
+ ref: z.ZodString;
159
+ }, z.core.$strip>;
114
160
  };
115
161
  };
116
- readonly listSourceFiles: {
117
- readonly input: z.ZodObject<{
162
+ listSourceFiles: {
163
+ input: z.ZodObject<{
118
164
  workspaceId: z.ZodString;
119
165
  connectionId: z.ZodString;
120
166
  externalRepositoryId: z.ZodString;
@@ -123,7 +169,7 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
123
169
  limit: z.ZodNumber;
124
170
  cursor: z.ZodOptional<z.ZodString>;
125
171
  }, z.core.$strip>;
126
- readonly output: z.ZodObject<{
172
+ output: z.ZodObject<{
127
173
  files: z.ZodArray<z.ZodObject<{
128
174
  path: z.ZodString;
129
175
  type: z.ZodLiteral<"file">;
@@ -131,7 +177,7 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
131
177
  }, z.core.$strip>>;
132
178
  nextCursor: z.ZodNullable<z.ZodString>;
133
179
  }, z.core.$strip>;
134
- readonly errors: {
180
+ errors: {
135
181
  'connection-not-found': z.ZodObject<{
136
182
  connectionId: z.ZodString;
137
183
  }, z.core.$strip>;
@@ -147,8 +193,8 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
147
193
  'capability-unavailable': z.ZodObject<{
148
194
  provider: z.ZodString;
149
195
  capability: z.ZodEnum<{
150
- source_control: "source_control";
151
196
  agent_tools: "agent_tools";
197
+ source_control: "source_control";
152
198
  }>;
153
199
  }, z.core.$strip>;
154
200
  'checkout-unsupported': z.ZodObject<{
@@ -160,20 +206,20 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
160
206
  }, z.core.$strip>;
161
207
  };
162
208
  };
163
- readonly fetchSourceFile: {
164
- readonly input: z.ZodObject<{
209
+ fetchSourceFile: {
210
+ input: z.ZodObject<{
165
211
  workspaceId: z.ZodString;
166
212
  connectionId: z.ZodString;
167
213
  externalRepositoryId: z.ZodString;
168
214
  ref: z.ZodString;
169
215
  path: z.ZodString;
170
216
  }, z.core.$strip>;
171
- readonly output: z.ZodObject<{
217
+ output: z.ZodObject<{
172
218
  path: z.ZodString;
173
219
  ref: z.ZodString;
174
220
  content: z.ZodString;
175
221
  }, z.core.$strip>;
176
- readonly errors: {
222
+ errors: {
177
223
  'connection-not-found': z.ZodObject<{
178
224
  connectionId: z.ZodString;
179
225
  }, z.core.$strip>;
@@ -189,8 +235,8 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
189
235
  'capability-unavailable': z.ZodObject<{
190
236
  provider: z.ZodString;
191
237
  capability: z.ZodEnum<{
192
- source_control: "source_control";
193
238
  agent_tools: "agent_tools";
239
+ source_control: "source_control";
194
240
  }>;
195
241
  }, z.core.$strip>;
196
242
  'checkout-unsupported': z.ZodObject<{
@@ -202,8 +248,8 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
202
248
  }, z.core.$strip>;
203
249
  };
204
250
  };
205
- readonly createCheckoutSpec: {
206
- readonly input: z.ZodObject<{
251
+ createCheckoutSpec: {
252
+ input: z.ZodObject<{
207
253
  workspaceId: z.ZodString;
208
254
  connectionId: z.ZodString;
209
255
  externalRepositoryId: z.ZodString;
@@ -215,7 +261,7 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
215
261
  }>;
216
262
  }, z.core.$strip>>;
217
263
  }, z.core.$strip>;
218
- readonly output: z.ZodObject<{
264
+ output: z.ZodObject<{
219
265
  repositoryUrl: z.ZodString;
220
266
  ref: z.ZodString;
221
267
  credentials: z.ZodOptional<z.ZodObject<{
@@ -228,7 +274,7 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
228
274
  email: z.ZodString;
229
275
  }, z.core.$strip>>;
230
276
  }, z.core.$strip>;
231
- readonly errors: {
277
+ errors: {
232
278
  'connection-not-found': z.ZodObject<{
233
279
  connectionId: z.ZodString;
234
280
  }, z.core.$strip>;
@@ -244,8 +290,8 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
244
290
  'capability-unavailable': z.ZodObject<{
245
291
  provider: z.ZodString;
246
292
  capability: z.ZodEnum<{
247
- source_control: "source_control";
248
293
  agent_tools: "agent_tools";
294
+ source_control: "source_control";
249
295
  }>;
250
296
  }, z.core.$strip>;
251
297
  'checkout-unsupported': z.ZodObject<{
@@ -257,20 +303,20 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
257
303
  }, z.core.$strip>;
258
304
  };
259
305
  };
260
- readonly getAgentToolsContext: {
261
- readonly input: z.ZodObject<{
306
+ getAgentToolsContext: {
307
+ input: z.ZodObject<{
262
308
  workspaceId: z.ZodString;
263
309
  defaultConnectionId: z.ZodString;
264
310
  }, z.core.$strip>;
265
- readonly output: z.ZodObject<{
311
+ output: z.ZodObject<{
266
312
  selectionCatalogs: z.ZodArray<z.ZodObject<{
267
313
  provider: z.ZodString;
268
314
  selectors: z.ZodArray<z.ZodObject<{
269
315
  token: z.ZodString;
270
316
  kind: z.ZodEnum<{
271
- method: "method";
272
317
  family: "family";
273
318
  family_wildcard: "family_wildcard";
319
+ method: "method";
274
320
  standalone: "standalone";
275
321
  }>;
276
322
  sensitivity: z.ZodEnum<{
@@ -310,17 +356,22 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
310
356
  id: z.ZodString;
311
357
  provider: z.ZodString;
312
358
  capabilities: z.ZodArray<z.ZodEnum<{
313
- source_control: "source_control";
314
359
  agent_tools: "agent_tools";
360
+ source_control: "source_control";
315
361
  }>>;
316
362
  }, z.core.$strip>>;
363
+ eventCatalogs: z.ZodArray<z.ZodObject<{
364
+ provider: z.ZodString;
365
+ events: z.ZodArray<z.ZodString>;
366
+ }, z.core.$strip>>;
367
+ fixedEventProviders: z.ZodArray<z.ZodString>;
317
368
  defaultConnection: z.ZodNullable<z.ZodObject<{
318
369
  id: z.ZodString;
319
370
  slug: z.ZodString;
320
371
  provider: z.ZodString;
321
372
  }, z.core.$strip>>;
322
373
  }, z.core.$strip>;
323
- readonly errors: {
374
+ errors: {
324
375
  'connection-not-found': z.ZodObject<{
325
376
  connectionId: z.ZodString;
326
377
  }, z.core.$strip>;
@@ -336,8 +387,8 @@ export declare const integrationsInterModuleContract: import("@shipfox/inter-mod
336
387
  'capability-unavailable': z.ZodObject<{
337
388
  provider: z.ZodString;
338
389
  capability: z.ZodEnum<{
339
- source_control: "source_control";
340
390
  agent_tools: "agent_tools";
391
+ source_control: "source_control";
341
392
  }>;
342
393
  }, z.core.$strip>;
343
394
  'checkout-unsupported': z.ZodObject<{
@@ -1 +1 @@
1
- {"version":3,"file":"inter-module.d.ts","sourceRoot":"","sources":["../src/inter-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,iBAAiB,EAAC,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAqCtB,kFAAkF;AAClF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ChB,KAAK;;;;;;;;;;;;YAIL,MAAM;;;;;;;;;;;;;YAQN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAER,oBAAoB;YAClB,KAAK;;;;YACL,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAgDN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGV,CAAC;AASH,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
@@ -6,6 +6,7 @@ const capability = z.enum([
6
6
  'source_control',
7
7
  'agent_tools'
8
8
  ]);
9
+ const safeRef = z.string().refine(isSafeRefInput, 'Ref contains a control character');
9
10
  const connection = z.object({
10
11
  id,
11
12
  provider,
@@ -63,6 +64,15 @@ const sourceErrors = {
63
64
  }),
64
65
  'provider-failure': providerError
65
66
  };
67
+ const refErrors = {
68
+ ...sourceErrors,
69
+ 'ref-not-found': z.object({
70
+ ref: safeRef
71
+ }),
72
+ 'ref-invalid': z.object({
73
+ ref: safeRef
74
+ })
75
+ };
66
76
  /** Producer-owned synchronous operations for the Integrations bounded context. */ export const integrationsInterModuleContract = defineInterModuleContract({
67
77
  module: 'integrations',
68
78
  methods: {
@@ -90,6 +100,16 @@ const sourceErrors = {
90
100
  output: triggerReference.nullable(),
91
101
  errors: sourceErrors
92
102
  },
103
+ resolveSourceRef: {
104
+ input: sourceInput.extend({
105
+ ref: safeRef
106
+ }),
107
+ output: z.object({
108
+ ref: z.string(),
109
+ commit: z.string()
110
+ }),
111
+ errors: refErrors
112
+ },
93
113
  listSourceFiles: {
94
114
  input: sourceInput.extend({
95
115
  ref: z.string(),
@@ -198,6 +218,11 @@ const sourceErrors = {
198
218
  provider,
199
219
  capabilities: z.array(capability)
200
220
  })),
221
+ eventCatalogs: z.array(z.object({
222
+ provider,
223
+ events: z.array(z.string())
224
+ })),
225
+ fixedEventProviders: z.array(provider),
201
226
  defaultConnection: z.object({
202
227
  id,
203
228
  slug: z.string(),
@@ -208,5 +233,13 @@ const sourceErrors = {
208
233
  }
209
234
  }
210
235
  });
236
+ function isSafeRefInput(value) {
237
+ return [
238
+ ...value
239
+ ].every((character)=>{
240
+ const code = character.codePointAt(0) ?? 0;
241
+ return !(code < 0x20 || code >= 0x7f && code <= 0x9f || code === 0x2028 || code === 0x2029);
242
+ });
243
+ }
211
244
 
212
245
  //# sourceMappingURL=inter-module.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/inter-module.ts"],"sourcesContent":["import {defineInterModuleContract, type InterModuleClient} from '@shipfox/inter-module';\nimport {z} from 'zod';\n\nconst id = z.string().uuid();\nconst provider = z.string().min(1);\nconst capability = z.enum(['source_control', 'agent_tools']);\nconst connection = z.object({id, provider, slug: z.string().min(1)});\nconst repository = z.object({\n externalRepositoryId: z.string(),\n owner: z.string(),\n name: z.string(),\n fullName: z.string(),\n defaultBranch: z.string(),\n visibility: z.enum(['public', 'private', 'internal', 'unknown']),\n cloneUrl: z.string(),\n htmlUrl: z.string(),\n});\nconst triggerReference = z.object({\n externalRepositoryId: z.string(),\n ref: z.string(),\n commit: z.string(),\n actor: z.string().nullable(),\n});\nconst sourceInput = z.object({workspaceId: id, connectionId: id, externalRepositoryId: z.string()});\nconst providerError = z.object({\n reason: z.string(),\n retryAfterSeconds: z.number().int().positive().optional(),\n});\nconst sourceErrors = {\n 'connection-not-found': z.object({connectionId: id}),\n 'connection-inactive': z.object({connectionId: id}),\n 'connection-workspace-mismatch': z.object({connectionId: id}),\n 'provider-unavailable': z.object({provider}),\n 'capability-unavailable': z.object({provider, capability}),\n 'checkout-unsupported': z.object({provider}),\n 'provider-failure': providerError,\n};\n\n/** Producer-owned synchronous operations for the Integrations bounded context. */\nexport const integrationsInterModuleContract = defineInterModuleContract({\n module: 'integrations',\n methods: {\n resolveSourceRepository: {\n input: sourceInput,\n output: z.object({connection, repository}),\n errors: sourceErrors,\n },\n resolveConnection: {\n input: z.object({workspaceId: id, slug: z.string().min(1)}),\n output: connection.nullable(),\n },\n resolveTriggerReference: {\n input: z.object({workspaceId: id, connectionId: id, payload: z.unknown()}),\n output: triggerReference.nullable(),\n errors: sourceErrors,\n },\n listSourceFiles: {\n input: sourceInput.extend({\n ref: z.string(),\n prefix: z.string(),\n limit: z.number().int().positive(),\n cursor: z.string().optional(),\n }),\n output: z.object({\n files: z.array(\n z.object({path: z.string(), type: z.literal('file'), size: z.number().int().nullable()}),\n ),\n nextCursor: z.string().nullable(),\n }),\n errors: sourceErrors,\n },\n fetchSourceFile: {\n input: sourceInput.extend({ref: z.string(), path: z.string()}),\n output: z.object({path: z.string(), ref: z.string(), content: z.string()}),\n errors: sourceErrors,\n },\n createCheckoutSpec: {\n input: sourceInput.extend({\n ref: z.string().optional(),\n permissions: z.object({contents: z.enum(['read', 'write'])}).optional(),\n }),\n output: z.object({\n repositoryUrl: z.string(),\n ref: z.string(),\n credentials: z\n .object({username: z.string(), token: z.string(), expiresAt: z.string().datetime()})\n .optional(),\n gitAuthor: z.object({name: z.string(), email: z.string()}).optional(),\n }),\n errors: sourceErrors,\n },\n getAgentToolsContext: {\n input: z.object({workspaceId: id, defaultConnectionId: id}),\n output: z.object({\n selectionCatalogs: z.array(\n z.object({\n provider,\n selectors: z.array(\n z.object({\n token: z.string(),\n kind: z.enum(['family', 'family_wildcard', 'method', 'standalone']),\n sensitivity: z.enum(['read', 'write']),\n sensitive: z.boolean(),\n }),\n ),\n }),\n ),\n catalogs: z.array(\n z.object({\n provider,\n tools: z.array(\n z.object({\n id: z.string(),\n description: z.string(),\n sensitivity: z.enum(['read', 'write']),\n sensitive: z.boolean(),\n requiredScope: z.unknown(),\n inputSchema: z.record(z.string(), z.unknown()),\n outputSchema: z.record(z.string(), z.unknown()).optional(),\n methods: z\n .array(\n z.object({\n id: z.string(),\n description: z.string(),\n sensitivity: z.enum(['read', 'write']),\n sensitive: z.boolean(),\n requiredScope: z.unknown(),\n }),\n )\n .optional(),\n }),\n ),\n }),\n ),\n workspaceConnections: z.array(\n z.object({slug: z.string(), id, provider, capabilities: z.array(capability)}),\n ),\n defaultConnection: z.object({id, slug: z.string(), provider}).nullable(),\n }),\n errors: sourceErrors,\n },\n },\n});\n\nexport type IntegrationsModuleClient = InterModuleClient<typeof integrationsInterModuleContract>;\n"],"names":["defineInterModuleContract","z","id","string","uuid","provider","min","capability","enum","connection","object","slug","repository","externalRepositoryId","owner","name","fullName","defaultBranch","visibility","cloneUrl","htmlUrl","triggerReference","ref","commit","actor","nullable","sourceInput","workspaceId","connectionId","providerError","reason","retryAfterSeconds","number","int","positive","optional","sourceErrors","integrationsInterModuleContract","module","methods","resolveSourceRepository","input","output","errors","resolveConnection","resolveTriggerReference","payload","unknown","listSourceFiles","extend","prefix","limit","cursor","files","array","path","type","literal","size","nextCursor","fetchSourceFile","content","createCheckoutSpec","permissions","contents","repositoryUrl","credentials","username","token","expiresAt","datetime","gitAuthor","email","getAgentToolsContext","defaultConnectionId","selectionCatalogs","selectors","kind","sensitivity","sensitive","boolean","catalogs","tools","description","requiredScope","inputSchema","record","outputSchema","workspaceConnections","capabilities","defaultConnection"],"mappings":"AAAA,SAAQA,yBAAyB,QAA+B,wBAAwB;AACxF,SAAQC,CAAC,QAAO,MAAM;AAEtB,MAAMC,KAAKD,EAAEE,MAAM,GAAGC,IAAI;AAC1B,MAAMC,WAAWJ,EAAEE,MAAM,GAAGG,GAAG,CAAC;AAChC,MAAMC,aAAaN,EAAEO,IAAI,CAAC;IAAC;IAAkB;CAAc;AAC3D,MAAMC,aAAaR,EAAES,MAAM,CAAC;IAACR;IAAIG;IAAUM,MAAMV,EAAEE,MAAM,GAAGG,GAAG,CAAC;AAAE;AAClE,MAAMM,aAAaX,EAAES,MAAM,CAAC;IAC1BG,sBAAsBZ,EAAEE,MAAM;IAC9BW,OAAOb,EAAEE,MAAM;IACfY,MAAMd,EAAEE,MAAM;IACda,UAAUf,EAAEE,MAAM;IAClBc,eAAehB,EAAEE,MAAM;IACv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,EAAE8C,OAAO;wBAC3CwC,cAActF,EAAEqF,MAAM,CAACrF,EAAEE,MAAM,IAAIF,EAAE8C,OAAO,IAAIZ,QAAQ;wBACxDI,SAAStC,EACNqD,KAAK,CACJrD,EAAES,MAAM,CAAC;4BACPR,IAAID,EAAEE,MAAM;4BACZgF,aAAalF,EAAEE,MAAM;4BACrB2E,aAAa7E,EAAEO,IAAI,CAAC;gCAAC;gCAAQ;6BAAQ;4BACrCuE,WAAW9E,EAAE+E,OAAO;4BACpBI,eAAenF,EAAE8C,OAAO;wBAC1B,IAEDZ,QAAQ;oBACb;gBAEJ;gBAEFqD,sBAAsBvF,EAAEqD,KAAK,CAC3BrD,EAAES,MAAM,CAAC;oBAACC,MAAMV,EAAEE,MAAM;oBAAID;oBAAIG;oBAAUoF,cAAcxF,EAAEqD,KAAK,CAAC/C;gBAAW;gBAE7EmF,mBAAmBzF,EAAES,MAAM,CAAC;oBAACR;oBAAIS,MAAMV,EAAEE,MAAM;oBAAIE;gBAAQ,GAAGoB,QAAQ;YACxE;YACAkB,QAAQP;QACV;IACF;AACF,GAAG"}
1
+ {"version":3,"sources":["../src/inter-module.ts"],"sourcesContent":["import {defineInterModuleContract, type InterModuleClient} from '@shipfox/inter-module';\nimport {z} from 'zod';\n\nconst id = z.string().uuid();\nconst provider = z.string().min(1);\nconst capability = z.enum(['source_control', 'agent_tools']);\nconst safeRef = z.string().refine(isSafeRefInput, 'Ref contains a control character');\nconst connection = z.object({id, provider, slug: z.string().min(1)});\nconst repository = z.object({\n externalRepositoryId: z.string(),\n owner: z.string(),\n name: z.string(),\n fullName: z.string(),\n defaultBranch: z.string(),\n visibility: z.enum(['public', 'private', 'internal', 'unknown']),\n cloneUrl: z.string(),\n htmlUrl: z.string(),\n});\nconst triggerReference = z.object({\n externalRepositoryId: z.string(),\n ref: z.string(),\n commit: z.string(),\n actor: z.string().nullable(),\n});\nconst sourceInput = z.object({workspaceId: id, connectionId: id, externalRepositoryId: z.string()});\nconst providerError = z.object({\n reason: z.string(),\n retryAfterSeconds: z.number().int().positive().optional(),\n});\nconst sourceErrors = {\n 'connection-not-found': z.object({connectionId: id}),\n 'connection-inactive': z.object({connectionId: id}),\n 'connection-workspace-mismatch': z.object({connectionId: id}),\n 'provider-unavailable': z.object({provider}),\n 'capability-unavailable': z.object({provider, capability}),\n 'checkout-unsupported': z.object({provider}),\n 'provider-failure': providerError,\n};\n\nconst refErrors = {\n ...sourceErrors,\n 'ref-not-found': z.object({ref: safeRef}),\n 'ref-invalid': z.object({ref: safeRef}),\n};\n\n/** Producer-owned synchronous operations for the Integrations bounded context. */\nexport const integrationsInterModuleContract = defineInterModuleContract({\n module: 'integrations',\n methods: {\n resolveSourceRepository: {\n input: sourceInput,\n output: z.object({connection, repository}),\n errors: sourceErrors,\n },\n resolveConnection: {\n input: z.object({workspaceId: id, slug: z.string().min(1)}),\n output: connection.nullable(),\n },\n resolveTriggerReference: {\n input: z.object({workspaceId: id, connectionId: id, payload: z.unknown()}),\n output: triggerReference.nullable(),\n errors: sourceErrors,\n },\n resolveSourceRef: {\n input: sourceInput.extend({ref: safeRef}),\n output: z.object({ref: z.string(), commit: z.string()}),\n errors: refErrors,\n },\n listSourceFiles: {\n input: sourceInput.extend({\n ref: z.string(),\n prefix: z.string(),\n limit: z.number().int().positive(),\n cursor: z.string().optional(),\n }),\n output: z.object({\n files: z.array(\n z.object({path: z.string(), type: z.literal('file'), size: z.number().int().nullable()}),\n ),\n nextCursor: z.string().nullable(),\n }),\n errors: sourceErrors,\n },\n fetchSourceFile: {\n input: sourceInput.extend({ref: z.string(), path: z.string()}),\n output: z.object({path: z.string(), ref: z.string(), content: z.string()}),\n errors: sourceErrors,\n },\n createCheckoutSpec: {\n input: sourceInput.extend({\n ref: z.string().optional(),\n permissions: z.object({contents: z.enum(['read', 'write'])}).optional(),\n }),\n output: z.object({\n repositoryUrl: z.string(),\n ref: z.string(),\n credentials: z\n .object({username: z.string(), token: z.string(), expiresAt: z.string().datetime()})\n .optional(),\n gitAuthor: z.object({name: z.string(), email: z.string()}).optional(),\n }),\n errors: sourceErrors,\n },\n getAgentToolsContext: {\n input: z.object({workspaceId: id, defaultConnectionId: id}),\n output: z.object({\n selectionCatalogs: z.array(\n z.object({\n provider,\n selectors: z.array(\n z.object({\n token: z.string(),\n kind: z.enum(['family', 'family_wildcard', 'method', 'standalone']),\n sensitivity: z.enum(['read', 'write']),\n sensitive: z.boolean(),\n }),\n ),\n }),\n ),\n catalogs: z.array(\n z.object({\n provider,\n tools: z.array(\n z.object({\n id: z.string(),\n description: z.string(),\n sensitivity: z.enum(['read', 'write']),\n sensitive: z.boolean(),\n requiredScope: z.unknown(),\n inputSchema: z.record(z.string(), z.unknown()),\n outputSchema: z.record(z.string(), z.unknown()).optional(),\n methods: z\n .array(\n z.object({\n id: z.string(),\n description: z.string(),\n sensitivity: z.enum(['read', 'write']),\n sensitive: z.boolean(),\n requiredScope: z.unknown(),\n }),\n )\n .optional(),\n }),\n ),\n }),\n ),\n workspaceConnections: z.array(\n z.object({slug: z.string(), id, provider, capabilities: z.array(capability)}),\n ),\n eventCatalogs: z.array(z.object({provider, events: z.array(z.string())})),\n fixedEventProviders: z.array(provider),\n defaultConnection: z.object({id, slug: z.string(), provider}).nullable(),\n }),\n errors: sourceErrors,\n },\n },\n});\n\nfunction isSafeRefInput(value: string): boolean {\n return [...value].every((character) => {\n const code = character.codePointAt(0) ?? 0;\n return !(code < 0x20 || (code >= 0x7f && code <= 0x9f) || code === 0x2028 || code === 0x2029);\n });\n}\n\nexport type IntegrationsModuleClient = InterModuleClient<typeof integrationsInterModuleContract>;\n"],"names":["defineInterModuleContract","z","id","string","uuid","provider","min","capability","enum","safeRef","refine","isSafeRefInput","connection","object","slug","repository","externalRepositoryId","owner","name","fullName","defaultBranch","visibility","cloneUrl","htmlUrl","triggerReference","ref","commit","actor","nullable","sourceInput","workspaceId","connectionId","providerError","reason","retryAfterSeconds","number","int","positive","optional","sourceErrors","refErrors","integrationsInterModuleContract","module","methods","resolveSourceRepository","input","output","errors","resolveConnection","resolveTriggerReference","payload","unknown","resolveSourceRef","extend","listSourceFiles","prefix","limit","cursor","files","array","path","type","literal","size","nextCursor","fetchSourceFile","content","createCheckoutSpec","permissions","contents","repositoryUrl","credentials","username","token","expiresAt","datetime","gitAuthor","email","getAgentToolsContext","defaultConnectionId","selectionCatalogs","selectors","kind","sensitivity","sensitive","boolean","catalogs","tools","description","requiredScope","inputSchema","record","outputSchema","workspaceConnections","capabilities","eventCatalogs","events","fixedEventProviders","defaultConnection","value","every","character","code","codePointAt"],"mappings":"AAAA,SAAQA,yBAAyB,QAA+B,wBAAwB;AACxF,SAAQC,CAAC,QAAO,MAAM;AAEtB,MAAMC,KAAKD,EAAEE,MAAM,GAAGC,IAAI;AAC1B,MAAMC,WAAWJ,EAAEE,MAAM,GAAGG,GAAG,CAAC;AAChC,MAAMC,aAAaN,EAAEO,IAAI,CAAC;IAAC;IAAkB;CAAc;AAC3D,MAAMC,UAAUR,EAAEE,MAAM,GAAGO,MAAM,CAACC,gBAAgB;AAClD,MAAMC,aAAaX,EAAEY,MAAM,CAAC;IAACX;IAAIG;IAAUS,MAAMb,EAAEE,MAAM,GAAGG,GAAG,CAAC;AAAE;AAClE,MAAMS,aAAad,EAAEY,MAAM,CAAC;IAC1BG,sBAAsBf,EAAEE,MAAM;IAC9Bc,OAAOhB,EAAEE,MAAM;IACfe,MAAMjB,EAAEE,MAAM;IACdgB,UAAUlB,EAAEE,MAAM;IAClBiB,eAAenB,EAAEE,MAAM;IACvBkB,YAAYpB,EAAEO,IAAI,CAAC;QAAC;QAAU;QAAW;QAAY;KAAU;IAC/Dc,UAAUrB,EAAEE,MAAM;IAClBoB,SAAStB,EAAEE,MAAM;AACnB;AACA,MAAMqB,mBAAmBvB,EAAEY,MAAM,CAAC;IAChCG,sBAAsBf,EAAEE,MAAM;IAC9BsB,KAAKxB,EAAEE,MAAM;IACbuB,QAAQzB,EAAEE,MAAM;IAChBwB,OAAO1B,EAAEE,MA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_MAX_LENGTH, connectionSlugSchema, type IntegrationCapabilityDto, type IntegrationConnectionDto, type IntegrationConnectionLifecycleStatusDto, type IntegrationProviderDto, type IntegrationProviderKindDto, integrationCapabilitySchema, integrationConnectionDtoSchema, integrationConnectionLifecycleStatusSchema, integrationProviderDtoSchema, integrationProviderKindSchema, type ListIntegrationConnectionsQueryDto, type ListIntegrationConnectionsResponseDto, type ListIntegrationProvidersQueryDto, type ListIntegrationProvidersResponseDto, type ListRepositoriesParamsDto, type ListRepositoriesQueryDto, type ListRepositoriesResponseDto, listIntegrationConnectionsQuerySchema, listIntegrationConnectionsResponseSchema, listIntegrationProvidersQuerySchema, listIntegrationProvidersResponseSchema, listRepositoriesParamsSchema, listRepositoriesQuerySchema, listRepositoriesResponseSchema, type RepositoryDto, type RepositoryVisibilityDto, repositoryDtoSchema, repositoryVisibilitySchema, type UpdateIntegrationConnectionBodyDto, type UpdateIntegrationConnectionLifecycleStatusDto, updateIntegrationConnectionBodySchema, updateIntegrationConnectionLifecycleStatusSchema, } from './integrations.js';
1
+ export { CONNECTION_SLUG_MAX_LENGTH, connectionSlugSchema, type IntegrationCapabilityDto, type IntegrationConnectionDto, type IntegrationConnectionLifecycleStatusDto, type IntegrationProviderDto, type IntegrationProviderKindDto, integrationCapabilitySchema, integrationConnectionDtoSchema, integrationConnectionLifecycleStatusSchema, integrationProviderDtoSchema, integrationProviderKindSchema, type ListIntegrationConnectionsQueryDto, type ListIntegrationConnectionsResponseDto, type ListIntegrationProvidersQueryDto, type ListIntegrationProvidersResponseDto, type ListRepositoriesParamsDto, type ListRepositoriesQueryDto, type ListRepositoriesResponseDto, listIntegrationConnectionsQuerySchema, listIntegrationConnectionsResponseSchema, listIntegrationProvidersQuerySchema, listIntegrationProvidersResponseSchema, listRepositoriesParamsSchema, listRepositoriesQuerySchema, listRepositoriesResponseSchema, RESERVED_CONNECTION_SLUGS, type RepositoryDto, type RepositoryVisibilityDto, repositoryDtoSchema, repositoryVisibilitySchema, type UpdateIntegrationConnectionBodyDto, type UpdateIntegrationConnectionLifecycleStatusDto, updateIntegrationConnectionBodySchema, updateIntegrationConnectionLifecycleStatusSchema, } from './integrations.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,uCAAuC,EAC5C,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,2BAA2B,EAC3B,8BAA8B,EAC9B,0CAA0C,EAC1C,4BAA4B,EAC5B,6BAA6B,EAC7B,KAAK,kCAAkC,EACvC,KAAK,qCAAqC,EAC1C,KAAK,gCAAgC,EACrC,KAAK,mCAAmC,EACxC,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,qCAAqC,EACrC,wCAAwC,EACxC,mCAAmC,EACnC,sCAAsC,EACtC,4BAA4B,EAC5B,2BAA2B,EAC3B,8BAA8B,EAC9B,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,mBAAmB,EACnB,0BAA0B,EAC1B,KAAK,kCAAkC,EACvC,KAAK,6CAA6C,EAClD,qCAAqC,EACrC,gDAAgD,GACjD,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAC1B,oBAAoB,EACpB,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAC7B,KAAK,uCAAuC,EAC5C,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAC/B,2BAA2B,EAC3B,8BAA8B,EAC9B,0CAA0C,EAC1C,4BAA4B,EAC5B,6BAA6B,EAC7B,KAAK,kCAAkC,EACvC,KAAK,qCAAqC,EAC1C,KAAK,gCAAgC,EACr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