@shipfox/api-integration-core-dto 9.0.1 → 12.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 (276.05ms)
2
+ Successfully compiled: 8 files with swc (265.42ms)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @shipfox/api-integration-core-dto
2
2
 
3
+ ## 12.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 54c820e: Capture the actor that caused a source-control event on the normalized trigger reference. `TriggerReference` gains a required `actor`, resolved from the webhook sender by the GitHub and Gitea providers and null for payloads that name none.
8
+
9
+ ### Minor Changes
10
+
11
+ - f13e8bb: Add Jira dynamic webhook registration and authenticated event ingestion through
12
+ the shared stored-webhook workflow. Update the SPI webhook request exports and
13
+ serialize Jira installation replacement across API replicas. Preserve Jira
14
+ delivery identifiers and require lifecycle callbacks for registration. Remove
15
+ the unused Jira webhook signing-secret configuration and allow HS256 verification
16
+ at a supplied receipt time.
17
+ - 869a792: Refresh source-backed project repository identity from GitHub repository and installation-repository events.
18
+ - 032d316: Scope checkout credential minting to the currently running checkout step and return its fetch depth.
19
+ - cb0abfa: Expose the normalized trigger project, repository, ref, and commit in workflow context.
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [f78740d]
24
+ - @shipfox/inter-module@0.2.3
25
+
26
+ ## 9.0.2
27
+
28
+ ### Patch Changes
29
+
30
+ - 4b85404: Adds versioned architecture identity to participating package artifacts during publication.
31
+ - Updated dependencies [4b85404]
32
+ - @shipfox/inter-module@0.2.2
33
+
3
34
  ## 9.0.1
4
35
 
5
36
  ### Patch Changes
package/dist/events.d.ts CHANGED
@@ -36,6 +36,28 @@ export declare const integrationSourceCommitPushedSchema: z.ZodObject<{
36
36
  }, z.core.$strip>;
37
37
  }, z.core.$strip>;
38
38
  export type IntegrationSourceCommitPushedEvent = z.infer<typeof integrationSourceCommitPushedSchema>;
39
+ export declare const sourceRepositoryIdentitySchema: z.ZodObject<{
40
+ externalRepositoryId: z.ZodString;
41
+ owner: z.ZodString;
42
+ name: z.ZodString;
43
+ defaultBranch: z.ZodString;
44
+ }, z.core.$strip>;
45
+ export type SourceRepositoryIdentity = z.infer<typeof sourceRepositoryIdentitySchema>;
46
+ export declare const INTEGRATION_SOURCE_REPOSITORY_UPDATED: "integrations.source_control.repository_updated";
47
+ export declare const integrationSourceRepositoryUpdatedSchema: z.ZodObject<{
48
+ provider: z.ZodString;
49
+ workspaceId: z.ZodString;
50
+ connectionId: z.ZodString;
51
+ deliveryId: z.ZodString;
52
+ receivedAt: z.ZodString;
53
+ repository: z.ZodObject<{
54
+ externalRepositoryId: z.ZodString;
55
+ owner: z.ZodString;
56
+ name: z.ZodString;
57
+ defaultBranch: z.ZodString;
58
+ }, z.core.$strip>;
59
+ }, z.core.$strip>;
60
+ export type IntegrationSourceRepositoryUpdatedEvent = z.infer<typeof integrationSourceRepositoryUpdatedSchema>;
39
61
  export interface SentryIssuePayload {
40
62
  action: SentryIssueAction;
41
63
  issueId: string;
@@ -56,6 +78,7 @@ export type SentryIssueAction = (typeof SENTRY_ISSUE_ACTIONS)[number];
56
78
  export interface IntegrationsEventMap {
57
79
  [INTEGRATION_EVENT_RECEIVED]: IntegrationEventReceivedEvent;
58
80
  [INTEGRATION_SOURCE_COMMIT_PUSHED]: IntegrationSourceCommitPushedEvent;
81
+ [INTEGRATION_SOURCE_REPOSITORY_UPDATED]: IntegrationSourceRepositoryUpdatedEvent;
59
82
  }
60
83
  export declare const integrationsEventSchemas: {
61
84
  "integrations.event.received": z.ZodObject<{
@@ -83,5 +106,18 @@ export declare const integrationsEventSchemas: {
83
106
  isDefaultBranch: z.ZodBoolean;
84
107
  }, z.core.$strip>;
85
108
  }, z.core.$strip>;
109
+ "integrations.source_control.repository_updated": z.ZodObject<{
110
+ provider: z.ZodString;
111
+ workspaceId: z.ZodString;
112
+ connectionId: z.ZodString;
113
+ deliveryId: z.ZodString;
114
+ receivedAt: z.ZodString;
115
+ repository: z.ZodObject<{
116
+ externalRepositoryId: z.ZodString;
117
+ owner: z.ZodString;
118
+ name: z.ZodString;
119
+ defaultBranch: z.ZodString;
120
+ }, z.core.$strip>;
121
+ }, z.core.$strip>;
86
122
  };
87
123
  //# sourceMappingURL=events.d.ts.map
@@ -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,CACtD,OAAO,mCAAmC,CAC3C,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,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;I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
  push: sourcePushSchema
40
40
  });
41
+ export const sourceRepositoryIdentitySchema = z.object({
42
+ externalRepositoryId: nonEmptyStringSchema,
43
+ owner: nonEmptyStringSchema,
44
+ name: nonEmptyStringSchema,
45
+ defaultBranch: nonEmptyStringSchema
46
+ });
47
+ export const INTEGRATION_SOURCE_REPOSITORY_UPDATED = 'integrations.source_control.repository_updated';
48
+ // Typed, provider-agnostic source-control event. The producing provider owns the
49
+ // translation from its raw webhook into this shape, so domain consumers never decode
50
+ // provider payloads.
51
+ export const integrationSourceRepositoryUpdatedSchema = z.object({
52
+ provider: nonEmptyStringSchema,
53
+ workspaceId: nonEmptyStringSchema,
54
+ connectionId: nonEmptyStringSchema,
55
+ deliveryId: nonEmptyStringSchema,
56
+ receivedAt: isoDateTimeSchema,
57
+ repository: sourceRepositoryIdentitySchema
58
+ });
41
59
  // Single source of truth for Sentry issue actions: the sentry-dto webhook schema
42
60
  // builds its z.enum from this tuple, so accepted webhook actions and the published
43
61
  // SentryIssuePayload contract cannot drift.
@@ -50,7 +68,8 @@ export const SENTRY_ISSUE_ACTIONS = [
50
68
  ];
51
69
  export const integrationsEventSchemas = {
52
70
  [INTEGRATION_EVENT_RECEIVED]: integrationEventReceivedSchema,
53
- [INTEGRATION_SOURCE_COMMIT_PUSHED]: integrationSourceCommitPushedSchema
71
+ [INTEGRATION_SOURCE_COMMIT_PUSHED]: integrationSourceCommitPushedSchema,
72
+ [INTEGRATION_SOURCE_REPOSITORY_UPDATED]: integrationSourceRepositoryUpdatedSchema
54
73
  };
55
74
 
56
75
  //# sourceMappingURL=events.js.map
@@ -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 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}\n\nexport const integrationsEventSchemas = {\n [INTEGRATION_EVENT_RECEIVED]: integrationEventReceivedSchema,\n [INTEGRATION_SOURCE_COMMIT_PUSHED]: integrationSourceCommitPushedSchema,\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","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;AAqBH,iFAAiF;AACjF,mFAAmF;AACnF,4CAA4C;AAC5C,OAAO,MAAMU,uBAAuB;IAClC;IACA;IACA;IACA;IACA;CACD,CAAU;AASX,OAAO,MAAMC,2BAA2B;IACtC,CAACnC,2BAA2B,EAAEa;IAC9B,CAACkB,iCAAiC,EAAEC;AACtC,EAA0D"}
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"}
@@ -61,6 +61,58 @@ 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<{
66
+ workspaceId: z.ZodString;
67
+ slug: z.ZodString;
68
+ }, z.core.$strip>;
69
+ readonly output: z.ZodNullable<z.ZodObject<{
70
+ id: z.ZodString;
71
+ provider: z.ZodString;
72
+ slug: z.ZodString;
73
+ }, z.core.$strip>>;
74
+ };
75
+ readonly resolveTriggerReference: {
76
+ readonly input: z.ZodObject<{
77
+ workspaceId: z.ZodString;
78
+ connectionId: z.ZodString;
79
+ payload: z.ZodUnknown;
80
+ }, z.core.$strip>;
81
+ readonly output: z.ZodNullable<z.ZodObject<{
82
+ externalRepositoryId: z.ZodString;
83
+ ref: z.ZodString;
84
+ commit: z.ZodString;
85
+ actor: z.ZodNullable<z.ZodString>;
86
+ }, z.core.$strip>>;
87
+ readonly errors: {
88
+ 'connection-not-found': z.ZodObject<{
89
+ connectionId: z.ZodString;
90
+ }, z.core.$strip>;
91
+ 'connection-inactive': z.ZodObject<{
92
+ connectionId: z.ZodString;
93
+ }, z.core.$strip>;
94
+ 'connection-workspace-mismatch': z.ZodObject<{
95
+ connectionId: z.ZodString;
96
+ }, z.core.$strip>;
97
+ 'provider-unavailable': z.ZodObject<{
98
+ provider: z.ZodString;
99
+ }, z.core.$strip>;
100
+ 'capability-unavailable': z.ZodObject<{
101
+ provider: z.ZodString;
102
+ capability: z.ZodEnum<{
103
+ source_control: "source_control";
104
+ agent_tools: "agent_tools";
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
+ };
64
116
  readonly listSourceFiles: {
65
117
  readonly input: z.ZodObject<{
66
118
  workspaceId: z.ZodString;
@@ -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;AA8BtB,kFAAkF;AAClF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8F1C,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuG1C,CAAC;AAEH,MAAM,MAAM,wBAAwB,GAAG,iBAAiB,CAAC,OAAO,+BAA+B,CAAC,CAAC"}
@@ -6,6 +6,11 @@ const capability = z.enum([
6
6
  'source_control',
7
7
  'agent_tools'
8
8
  ]);
9
+ const connection = z.object({
10
+ id,
11
+ provider,
12
+ slug: z.string().min(1)
13
+ });
9
14
  const repository = z.object({
10
15
  externalRepositoryId: z.string(),
11
16
  owner: z.string(),
@@ -21,6 +26,12 @@ const repository = z.object({
21
26
  cloneUrl: z.string(),
22
27
  htmlUrl: z.string()
23
28
  });
29
+ const triggerReference = z.object({
30
+ externalRepositoryId: z.string(),
31
+ ref: z.string(),
32
+ commit: z.string(),
33
+ actor: z.string().nullable()
34
+ });
24
35
  const sourceInput = z.object({
25
36
  workspaceId: id,
26
37
  connectionId: id,
@@ -58,15 +69,27 @@ const sourceErrors = {
58
69
  resolveSourceRepository: {
59
70
  input: sourceInput,
60
71
  output: z.object({
61
- connection: z.object({
62
- id,
63
- provider,
64
- slug: z.string()
65
- }),
72
+ connection,
66
73
  repository
67
74
  }),
68
75
  errors: sourceErrors
69
76
  },
77
+ resolveConnection: {
78
+ input: z.object({
79
+ workspaceId: id,
80
+ slug: z.string().min(1)
81
+ }),
82
+ output: connection.nullable()
83
+ },
84
+ resolveTriggerReference: {
85
+ input: z.object({
86
+ workspaceId: id,
87
+ connectionId: id,
88
+ payload: z.unknown()
89
+ }),
90
+ output: triggerReference.nullable(),
91
+ errors: sourceErrors
92
+ },
70
93
  listSourceFiles: {
71
94
  input: sourceInput.extend({
72
95
  ref: z.string(),
@@ -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 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 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: z.object({id, provider, slug: z.string()}), repository}),\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","repository","object","externalRepositoryId","owner","name","fullName","defaultBranch","visibility","cloneUrl","htmlUrl","sourceInput","workspaceId","connectionId","providerError","reason","retryAfterSeconds","number","int","positive","optional","sourceErrors","integrationsInterModuleContract","module","methods","resolveSourceRepository","input","output","connection","slug","errors","listSourceFiles","extend","ref","prefix","limit","cursor","files","array","path","type","literal","size","nullable","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","unknown","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;IAC1BC,sBAAsBV,EAAEE,MAAM;IAC9BS,OAAOX,EAAEE,MAAM;IACfU,MAAMZ,EAAEE,MAAM;IACdW,UAAUb,EAAEE,MAAM;IAClBY,eAAed,EAAEE,MAAM;IACvBa,YAAYf,EAAEO,IAAI,CAAC;QAAC;QAAU;QAAW;QAAY;KAAU;IAC/DS,UAAUhB,EAAEE,MAAM;IAClBe,SAASjB,EAAEE,MAAM;AACnB;AACA,MAAMgB,cAAclB,EAAES,MAAM,CAAC;IAACU,aAAalB;IAAImB,cAAcnB;IAAIS,sBAAsBV,EAAEE,MAAM;AAAE;AACjG,MAAMmB,gBAAgBrB,EAAES,MAAM,CAAC;IAC7Ba,QAAQtB,EAAEE,MAAM;IAChBqB,mBAAmBvB,EAAEwB,MAAM,GAAGC,GAAG,GAAGC,QAAQ,GAAGC,QAAQ;AACz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WAAWvE,EAAEwE,OAAO;oBACtB;gBAEJ;gBAEFC,UAAUzE,EAAE6C,KAAK,CACf7C,EAAES,MAAM,CAAC;oBACPL;oBACAsE,OAAO1E,EAAE6C,KAAK,CACZ7C,EAAES,MAAM,CAAC;wBACPR,IAAID,EAAEE,MAAM;wBACZyE,aAAa3E,EAAEE,MAAM;wBACrBoE,aAAatE,EAAEO,IAAI,CAAC;4BAAC;4BAAQ;yBAAQ;wBACrCgE,WAAWvE,EAAEwE,OAAO;wBACpBI,eAAe5E,EAAE6E,OAAO;wBACxBC,aAAa9E,EAAE+E,MAAM,CAAC/E,EAAEE,MAAM,IAAIF,EAAE6E,OAAO;wBAC3CG,cAAchF,EAAE+E,MAAM,CAAC/E,EAAEE,MAAM,IAAIF,EAAE6E,OAAO,IAAIlD,QAAQ;wBACxDI,SAAS/B,EACN6C,KAAK,CACJ7C,EAAES,MAAM,CAAC;4BACPR,IAAID,EAAEE,MAAM;4BACZyE,aAAa3E,EAAEE,MAAM;4BACrBoE,aAAatE,EAAEO,IAAI,CAAC;gCAAC;gCAAQ;6BAAQ;4BACrCgE,WAAWvE,EAAEwE,OAAO;4BACpBI,eAAe5E,EAAE6E,OAAO;wBAC1B,IAEDlD,QAAQ;oBACb;gBAEJ;gBAEFsD,sBAAsBjF,EAAE6C,KAAK,CAC3B7C,EAAES,MAAM,CAAC;oBAAC2B,MAAMpC,EAAEE,MAAM;oBAAID;oBAAIG;oBAAU8E,cAAclF,EAAE6C,KAAK,CAACvC;gBAAW;gBAE7E6E,mBAAmBnF,EAAES,MAAM,CAAC;oBAACR;oBAAImC,MAAMpC,EAAEE,MAAM;oBAAIE;gBAAQ,GAAG8C,QAAQ;YACxE;YACAb,QAAQT;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 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;IACvBe,YAAYjB,EAAEO,IAAI,CAAC;QAAC;QAAU;QAAW;QAAY;KAAU;IAC/DW,UAAUlB,EAAEE,MAAM;IAClBiB,SAASnB,EAAEE,MAAM;AACnB;AACA,MAAMkB,mBAAmBpB,EAAES,MAAM,CAAC;IAChCG,sBAAsBZ,EAAEE,MAAM;IAC9BmB,KAAKrB,EAAEE,MAAM;IACboB,QAAQtB,EAAEE,MAAM;IAChBqB,OAAOvB,EAAEE,MAAM,GAAGsB,QAAQ;AAC5B;AACA,MAAMC,cAAczB,EAAES,MAAM,CAAC;IAACiB,aAAazB;IAAI0B,cAAc1B;IAAIW,sBAAsBZ,EAAEE,MAAM;AAAE;AACjG,MAAM0B,gBAAgB5B,EAAES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