@shipfox/api-integration-core 7.1.0 → 8.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,6 +1,6 @@
1
1
  $ shipfox-swc && shipfox-temporal-bundle dist/temporal/workflows/index.js
2
- Successfully compiled: 50 files with swc (523.83ms)
3
- 2026-07-22T13:12:11.575Z [INFO] asset workflow-bundle-646aca428e9943f8cf17.js 3.17 MiB [emitted] [immutable] (name: main)
2
+ Successfully compiled: 50 files with swc (386.43ms)
3
+ 2026-07-22T14:52:27.401Z [INFO] asset workflow-bundle-646aca428e9943f8cf17.js 3.17 MiB [emitted] [immutable] (name: main)
4
4
  orphan modules 33.5 KiB [orphan] 21 modules
5
5
  runtime modules 1.13 KiB 5 modules
6
6
  modules by path ../../../../node_modules/.pnpm/ 970 KiB 196 modules
@@ -12,6 +12,6 @@ optional modules 30 bytes [optional]
12
12
  __temporal_custom_payload_converter (ignored) 15 bytes [optional] [built] [code generated]
13
13
  __temporal_custom_failure_converter (ignored) 15 bytes [optional] [built] [code generated]
14
14
  ../../../shared/node/temporal/dist/workflow-error-interceptor.js 1.21 KiB [built] [code generated]
15
- webpack 5.107.2 compiled successfully in 9255 ms
16
- 2026-07-22T13:12:11.593Z [INFO] Workflow bundle created { size: '3.17MB' }
15
+ webpack 5.107.2 compiled successfully in 6215 ms
16
+ 2026-07-22T14:52:27.413Z [INFO] Workflow bundle created { size: '3.17MB' }
17
17
  /home/runner/work/shipfox/shipfox/libs/api/integration/core/dist/temporal/workflows/index.js: 3323154 bytes
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # @shipfox/api-integration-core
2
2
 
3
+ ## 8.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [de559bb]
8
+ - Updated dependencies [7f227c6]
9
+ - @shipfox/api-agent-dto@8.0.0
10
+ - @shipfox/api-integration-core-dto@8.0.0
11
+ - @shipfox/api-workflows-dto@8.0.0
12
+ - @shipfox/api-integration-gitea@8.0.0
13
+ - @shipfox/api-integration-github@8.0.0
14
+ - @shipfox/api-integration-jira@8.0.0
15
+ - @shipfox/api-integration-linear@8.0.0
16
+ - @shipfox/api-integration-sentry@8.0.0
17
+ - @shipfox/api-integration-slack@8.0.0
18
+ - @shipfox/api-integration-webhook@8.0.0
19
+
3
20
  ## 7.1.0
4
21
 
5
22
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import { integrationsInterModuleContract } from '@shipfox/api-integration-core-dto';
1
+ import { integrationsInterModuleContract } from '@shipfox/api-integration-core-dto/inter-module';
2
2
  import { type InterModulePresentation } from '@shipfox/inter-module';
3
3
  import type { IntegrationProviderRegistry } from '#core/providers/registry.js';
4
4
  import type { IntegrationSourceControlService } from '#core/source-control-service.js';
@@ -1 +1 @@
1
- {"version":3,"file":"inter-module.d.ts","sourceRoot":"","sources":["../../src/presentation/inter-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,+BAA+B,EAAC,MAAM,mCAAmC,CAAC;AAClF,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;AAe/B,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,6BAA6B,CAAC;AAC7E,OAAO,KAAK,EAAC,+BAA+B,EAAC,MAAM,iCAAiC,CAAC;AAGrF,wBAAgB,yCAAyC,CAAC,MAAM,EAAE;IAChE,QAAQ,EAAE,2BAA2B,CAAC;IACtC,aAAa,EAAE,+BAA+B,CAAC;CAChD,GAAG,uBAAuB,CAAC,OAAO,+BAA+B,CAAC,CA+ElE"}
1
+ {"version":3,"file":"inter-module.d.ts","sourceRoot":"","sources":["../../src/presentation/inter-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,+BAA+B,EAAC,MAAM,gDAAgD,CAAC;AAC/F,OAAO,EAIL,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;AAe/B,OAAO,KAAK,EAAC,2BAA2B,EAAC,MAAM,6BAA6B,CAAC;AAC7E,OAAO,KAAK,EAAC,+BAA+B,EAAC,MAAM,iCAAiC,CAAC;AAGrF,wBAAgB,yCAAyC,CAAC,MAAM,EAAE;IAChE,QAAQ,EAAE,2BAA2B,CAAC;IACtC,aAAa,EAAE,+BAA+B,CAAC;CAChD,GAAG,uBAAuB,CAAC,OAAO,+BAA+B,CAAC,CA+ElE"}
@@ -1,4 +1,4 @@
1
- import { integrationsInterModuleContract } from '@shipfox/api-integration-core-dto';
1
+ import { integrationsInterModuleContract } from '@shipfox/api-integration-core-dto/inter-module';
2
2
  import { createInterModuleKnownError, defineInterModulePresentation } from '@shipfox/inter-module';
3
3
  import { buildAgentToolCatalogs, buildAgentToolSelectionCatalogs, createWorkspaceConnectionSnapshotLoader } from '#core/agent-tool-selection.js';
4
4
  import { IntegrationCapabilityUnavailableError, IntegrationCheckoutUnsupportedError, IntegrationConnectionInactiveError, IntegrationConnectionNotFoundError, IntegrationConnectionWorkspaceMismatchError, IntegrationProviderError, IntegrationProviderUnavailableError } from '#core/errors.js';
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/presentation/inter-module.ts"],"sourcesContent":["import {integrationsInterModuleContract} from '@shipfox/api-integration-core-dto';\nimport {\n createInterModuleKnownError,\n defineInterModulePresentation,\n type InterModuleMethodContract,\n type InterModulePresentation,\n} from '@shipfox/inter-module';\nimport {\n buildAgentToolCatalogs,\n buildAgentToolSelectionCatalogs,\n createWorkspaceConnectionSnapshotLoader,\n} from '#core/agent-tool-selection.js';\nimport {\n IntegrationCapabilityUnavailableError,\n IntegrationCheckoutUnsupportedError,\n IntegrationConnectionInactiveError,\n IntegrationConnectionNotFoundError,\n IntegrationConnectionWorkspaceMismatchError,\n IntegrationProviderError,\n IntegrationProviderUnavailableError,\n} from '#core/errors.js';\nimport type {IntegrationProviderRegistry} from '#core/providers/registry.js';\nimport type {IntegrationSourceControlService} from '#core/source-control-service.js';\nimport {getIntegrationConnectionById} from '#db/connections.js';\n\nexport function createIntegrationsInterModulePresentation(params: {\n registry: IntegrationProviderRegistry;\n sourceControl: IntegrationSourceControlService;\n}): InterModulePresentation<typeof integrationsInterModuleContract> {\n const contract = integrationsInterModuleContract;\n return defineInterModulePresentation(contract, {\n resolveSourceRepository: async (input) =>\n await known(contract.methods.resolveSourceRepository, input, async () => {\n const resolved = await params.sourceControl.resolveRepository(input);\n return {\n connection: {\n id: resolved.connection.id,\n provider: resolved.connection.provider,\n slug: resolved.connection.slug,\n },\n repository: resolved.repository,\n };\n }),\n listSourceFiles: async (input) =>\n await known(\n contract.methods.listSourceFiles,\n input,\n async () => await params.sourceControl.listFiles(input),\n ),\n fetchSourceFile: async (input) =>\n await known(\n contract.methods.fetchSourceFile,\n input,\n async () => await params.sourceControl.fetchFile(input),\n ),\n createCheckoutSpec: async (input) =>\n await known(contract.methods.createCheckoutSpec, input, async () => {\n const spec = await params.sourceControl.createCheckoutSpec(input);\n return {\n repositoryUrl: spec.repositoryUrl,\n ref: spec.ref,\n ...(spec.credentials\n ? {\n credentials: {\n ...spec.credentials,\n expiresAt: spec.credentials.expiresAt.toISOString(),\n },\n }\n : {}),\n ...(spec.gitAuthor === undefined ? {} : {gitAuthor: spec.gitAuthor}),\n };\n }),\n getAgentToolsContext: async (input) =>\n await known(contract.methods.getAgentToolsContext, input, async () => {\n const [selectionCatalogs, catalogs, snapshot, defaultConnection] = await Promise.all([\n buildAgentToolSelectionCatalogs(params.registry),\n buildAgentToolCatalogs(params.registry),\n createWorkspaceConnectionSnapshotLoader(params.registry)(input.workspaceId),\n getIntegrationConnectionById(input.defaultConnectionId),\n ]);\n return {\n selectionCatalogs: [...selectionCatalogs].map(([provider, value]) => ({\n provider,\n selectors: value.selectors.map((selector) => ({...selector})),\n })),\n catalogs: [...catalogs].map(([provider, tools]) => ({\n provider,\n tools: tools.map(({methods, ...tool}) => ({\n ...tool,\n ...(methods === undefined ? {} : {methods: methods.map((method) => ({...method}))}),\n })),\n })),\n workspaceConnections: [...snapshot].map(([slug, value]) => ({\n slug,\n ...value,\n capabilities: [...value.capabilities],\n })),\n defaultConnection: defaultConnection\n ? {\n id: defaultConnection.id,\n slug: defaultConnection.slug,\n provider: defaultConnection.provider,\n }\n : null,\n };\n }),\n });\n}\n\nasync function known<Output>(\n method: InterModuleMethodContract,\n input: {connectionId?: string; defaultConnectionId?: string},\n operation: () => Promise<Output>,\n): Promise<Output> {\n try {\n return await operation();\n } catch (error) {\n throw mapError(method, input, error);\n }\n}\nfunction mapError(\n method: InterModuleMethodContract,\n input: {connectionId?: string; defaultConnectionId?: string},\n error: unknown,\n): unknown {\n if (error instanceof IntegrationConnectionNotFoundError)\n return createInterModuleKnownError(method, 'connection-not-found', {\n connectionId: input.connectionId ?? input.defaultConnectionId,\n });\n if (error instanceof IntegrationConnectionInactiveError)\n return createInterModuleKnownError(method, 'connection-inactive', {\n connectionId: input.connectionId,\n });\n if (error instanceof IntegrationConnectionWorkspaceMismatchError)\n return createInterModuleKnownError(method, 'connection-workspace-mismatch', {\n connectionId: input.connectionId,\n });\n if (error instanceof IntegrationProviderUnavailableError)\n return createInterModuleKnownError(method, 'provider-unavailable', {provider: error.provider});\n if (error instanceof IntegrationCapabilityUnavailableError)\n return createInterModuleKnownError(method, 'capability-unavailable', {\n provider: error.provider,\n capability: error.capability,\n });\n if (error instanceof IntegrationCheckoutUnsupportedError)\n return createInterModuleKnownError(method, 'checkout-unsupported', {provider: error.provider});\n if (error instanceof IntegrationProviderError)\n return createInterModuleKnownError(method, 'provider-failure', {\n reason: error.reason,\n ...(error.retryAfterSeconds === undefined\n ? {}\n : {retryAfterSeconds: error.retryAfterSeconds}),\n });\n return error;\n}\n"],"names":["integrationsInterModuleContract","createInterModuleKnownError","defineInterModulePresentation","buildAgentToolCatalogs","buildAgentToolSelectionCatalogs","createWorkspaceConnectionSnapshotLoader","IntegrationCapabilityUnavailableError","IntegrationCheckoutUnsupportedError","IntegrationConnectionInactiveError","IntegrationConnectionNotFoundError","IntegrationConnectionWorkspaceMismatchError","IntegrationProviderError","IntegrationProviderUnavailableError","getIntegrationConnectionById","createIntegrationsInterModulePresentation","params","contract","resolveSourceRepository","input","known","methods","resolved","sourceControl","resolveRepository","connection","id","provider","slug","repository","listSourceFiles","listFiles","fetchSourceFile","fetchFile","createCheckoutSpec","spec","repositoryUrl","ref","credentials","expiresAt","toISOString","gitAuthor","undefined","getAgentToolsContext","selectionCatalogs","catalogs","snapshot","defaultConnection","Promise","all","registry","workspaceId","defaultConnectionId","map","value","selectors","selector","tools","tool","method","workspaceConnections","capabilities","operation","error","mapError","connectionId","capability","reason","retryAfterSeconds"],"mappings":"AAAA,SAAQA,+BAA+B,QAAO,oCAAoC;AAClF,SACEC,2BAA2B,EAC3BC,6BAA6B,QAGxB,wBAAwB;AAC/B,SACEC,sBAAsB,EACtBC,+BAA+B,EAC/BC,uCAAuC,QAClC,gCAAgC;AACvC,SACEC,qCAAqC,EACrCC,mCAAmC,EACnCC,kCAAkC,EAClCC,kCAAkC,EAClCC,2CAA2C,EAC3CC,wBAAwB,EACxBC,mCAAmC,QAC9B,kBAAkB;AAGzB,SAAQC,4BAA4B,QAAO,qBAAqB;AAEhE,OAAO,SAASC,0CAA0CC,MAGzD;IACC,MAAMC,WAAWhB;IACjB,OAAOE,8BAA8Bc,UAAU;QAC7CC,yBAAyB,OAAOC,QAC9B,MAAMC,MAAMH,SAASI,OAAO,CAACH,uBAAuB,EAAEC,OAAO;gBAC3D,MAAMG,WAAW,MAAMN,OAAOO,aAAa,CAACC,iBAAiB,CAACL;gBAC9D,OAAO;oBACLM,YAAY;wBACVC,IAAIJ,SAASG,UAAU,CAACC,EAAE;wBAC1BC,UAAUL,SAASG,UAAU,CAACE,QAAQ;wBACtCC,MAAMN,SAASG,UAAU,CAACG,IAAI;oBAChC;oBACAC,YAAYP,SAASO,UAAU;gBACjC;YACF;QACFC,iBAAiB,OAAOX,QACtB,MAAMC,MACJH,SAASI,OAAO,CAACS,eAAe,EAChCX,OACA,UAAY,MAAMH,OAAOO,aAAa,CAACQ,SAAS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OAAOX,4BAA4ByD,QAAQ,wBAAwB;QAAChC,UAAUoC,MAAMpC,QAAQ;IAAA;IAC9F,IAAIoC,iBAAiBxD,uCACnB,OAAOL,4BAA4ByD,QAAQ,0BAA0B;QACnEhC,UAAUoC,MAAMpC,QAAQ;QACxBuC,YAAYH,MAAMG,UAAU;IAC9B;IACF,IAAIH,iBAAiBvD,qCACnB,OAAON,4BAA4ByD,QAAQ,wBAAwB;QAAChC,UAAUoC,MAAMpC,QAAQ;IAAA;IAC9F,IAAIoC,iBAAiBnD,0BACnB,OAAOV,4BAA4ByD,QAAQ,oBAAoB;QAC7DQ,QAAQJ,MAAMI,MAAM;QACpB,GAAIJ,MAAMK,iBAAiB,KAAK1B,YAC5B,CAAC,IACD;YAAC0B,mBAAmBL,MAAMK,iBAAiB;QAAA,CAAC;IAClD;IACF,OAAOL;AACT"}
1
+ {"version":3,"sources":["../../src/presentation/inter-module.ts"],"sourcesContent":["import {integrationsInterModuleContract} from '@shipfox/api-integration-core-dto/inter-module';\nimport {\n createInterModuleKnownError,\n defineInterModulePresentation,\n type InterModuleMethodContract,\n type InterModulePresentation,\n} from '@shipfox/inter-module';\nimport {\n buildAgentToolCatalogs,\n buildAgentToolSelectionCatalogs,\n createWorkspaceConnectionSnapshotLoader,\n} from '#core/agent-tool-selection.js';\nimport {\n IntegrationCapabilityUnavailableError,\n IntegrationCheckoutUnsupportedError,\n IntegrationConnectionInactiveError,\n IntegrationConnectionNotFoundError,\n IntegrationConnectionWorkspaceMismatchError,\n IntegrationProviderError,\n IntegrationProviderUnavailableError,\n} from '#core/errors.js';\nimport type {IntegrationProviderRegistry} from '#core/providers/registry.js';\nimport type {IntegrationSourceControlService} from '#core/source-control-service.js';\nimport {getIntegrationConnectionById} from '#db/connections.js';\n\nexport function createIntegrationsInterModulePresentation(params: {\n registry: IntegrationProviderRegistry;\n sourceControl: IntegrationSourceControlService;\n}): InterModulePresentation<typeof integrationsInterModuleContract> {\n const contract = integrationsInterModuleContract;\n return defineInterModulePresentation(contract, {\n resolveSourceRepository: async (input) =>\n await known(contract.methods.resolveSourceRepository, input, async () => {\n const resolved = await params.sourceControl.resolveRepository(input);\n return {\n connection: {\n id: resolved.connection.id,\n provider: resolved.connection.provider,\n slug: resolved.connection.slug,\n },\n repository: resolved.repository,\n };\n }),\n listSourceFiles: async (input) =>\n await known(\n contract.methods.listSourceFiles,\n input,\n async () => await params.sourceControl.listFiles(input),\n ),\n fetchSourceFile: async (input) =>\n await known(\n contract.methods.fetchSourceFile,\n input,\n async () => await params.sourceControl.fetchFile(input),\n ),\n createCheckoutSpec: async (input) =>\n await known(contract.methods.createCheckoutSpec, input, async () => {\n const spec = await params.sourceControl.createCheckoutSpec(input);\n return {\n repositoryUrl: spec.repositoryUrl,\n ref: spec.ref,\n ...(spec.credentials\n ? {\n credentials: {\n ...spec.credentials,\n expiresAt: spec.credentials.expiresAt.toISOString(),\n },\n }\n : {}),\n ...(spec.gitAuthor === undefined ? {} : {gitAuthor: spec.gitAuthor}),\n };\n }),\n getAgentToolsContext: async (input) =>\n await known(contract.methods.getAgentToolsContext, input, async () => {\n const [selectionCatalogs, catalogs, snapshot, defaultConnection] = await Promise.all([\n buildAgentToolSelectionCatalogs(params.registry),\n buildAgentToolCatalogs(params.registry),\n createWorkspaceConnectionSnapshotLoader(params.registry)(input.workspaceId),\n getIntegrationConnectionById(input.defaultConnectionId),\n ]);\n return {\n selectionCatalogs: [...selectionCatalogs].map(([provider, value]) => ({\n provider,\n selectors: value.selectors.map((selector) => ({...selector})),\n })),\n catalogs: [...catalogs].map(([provider, tools]) => ({\n provider,\n tools: tools.map(({methods, ...tool}) => ({\n ...tool,\n ...(methods === undefined ? {} : {methods: methods.map((method) => ({...method}))}),\n })),\n })),\n workspaceConnections: [...snapshot].map(([slug, value]) => ({\n slug,\n ...value,\n capabilities: [...value.capabilities],\n })),\n defaultConnection: defaultConnection\n ? {\n id: defaultConnection.id,\n slug: defaultConnection.slug,\n provider: defaultConnection.provider,\n }\n : null,\n };\n }),\n });\n}\n\nasync function known<Output>(\n method: InterModuleMethodContract,\n input: {connectionId?: string; defaultConnectionId?: string},\n operation: () => Promise<Output>,\n): Promise<Output> {\n try {\n return await operation();\n } catch (error) {\n throw mapError(method, input, error);\n }\n}\nfunction mapError(\n method: InterModuleMethodContract,\n input: {connectionId?: string; defaultConnectionId?: string},\n error: unknown,\n): unknown {\n if (error instanceof IntegrationConnectionNotFoundError)\n return createInterModuleKnownError(method, 'connection-not-found', {\n connectionId: input.connectionId ?? input.defaultConnectionId,\n });\n if (error instanceof IntegrationConnectionInactiveError)\n return createInterModuleKnownError(method, 'connection-inactive', {\n connectionId: input.connectionId,\n });\n if (error instanceof IntegrationConnectionWorkspaceMismatchError)\n return createInterModuleKnownError(method, 'connection-workspace-mismatch', {\n connectionId: input.connectionId,\n });\n if (error instanceof IntegrationProviderUnavailableError)\n return createInterModuleKnownError(method, 'provider-unavailable', {provider: error.provider});\n if (error instanceof IntegrationCapabilityUnavailableError)\n return createInterModuleKnownError(method, 'capability-unavailable', {\n provider: error.provider,\n capability: error.capability,\n });\n if (error instanceof IntegrationCheckoutUnsupportedError)\n return createInterModuleKnownError(method, 'checkout-unsupported', {provider: error.provider});\n if (error instanceof IntegrationProviderError)\n return createInterModuleKnownError(method, 'provider-failure', {\n reason: error.reason,\n ...(error.retryAfterSeconds === undefined\n ? {}\n : {retryAfterSeconds: error.retryAfterSeconds}),\n });\n return error;\n}\n"],"names":["integrationsInterModuleContract","createInterModuleKnownError","defineInterModulePresentation","buildAgentToolCatalogs","buildAgentToolSelectionCatalogs","createWorkspaceConnectionSnapshotLoader","IntegrationCapabilityUnavailableError","IntegrationCheckoutUnsupportedError","IntegrationConnectionInactiveError","IntegrationConnectionNotFoundError","IntegrationConnectionWorkspaceMismatchError","IntegrationProviderError","IntegrationProviderUnavailableError","getIntegrationConnectionById","createIntegrationsInterModulePresentation","params","contract","resolveSourceRepository","input","known","methods","resolved","sourceControl","resolveRepository","connection","id","provider","slug","repository","listSourceFiles","listFiles","fetchSourceFile","fetchFile","createCheckoutSpec","spec","repositoryUrl","ref","credentials","expiresAt","toISOString","gitAuthor","undefined","getAgentToolsContext","selectionCatalogs","catalogs","snapshot","defaultConnection","Promise","all","registry","workspaceId","defaultConnectionId","map","value","selectors","selector","tools","tool","method","workspaceConnections","capabilities","operation","error","mapError","connectionId","capability","reason","retryAfterSeconds"],"mappings":"AAAA,SAAQA,+BAA+B,QAAO,iDAAiD;AAC/F,SACEC,2BAA2B,EAC3BC,6BAA6B,QAGxB,wBAAwB;AAC/B,SACEC,sBAAsB,EACtBC,+BAA+B,EAC/BC,uCAAuC,QAClC,gCAAgC;AACvC,SACEC,qCAAqC,EACrCC,mCAAmC,EACnCC,kCAAkC,EAClCC,kCAAkC,EAClCC,2CAA2C,EAC3CC,wBAAwB,EACxBC,mCAAmC,QAC9B,kBAAkB;AAGzB,SAAQC,4BAA4B,QAAO,qBAAqB;AAEhE,OAAO,SAASC,0CAA0CC,MAGzD;IACC,MAAMC,WAAWhB;IACjB,OAAOE,8BAA8Bc,UAAU;QAC7CC,yBAAyB,OAAOC,QAC9B,MAAMC,MAAMH,SAASI,OAAO,CAACH,uBAAuB,EAAEC,OAAO;gBAC3D,MAAMG,WAAW,MAAMN,OAAOO,aAAa,CAACC,iBAAiB,CAACL;gBAC9D,OAAO;oBACLM,YAAY;wBACVC,IAAIJ,SAASG,UAAU,CAACC,EAAE;wBAC1BC,UAAUL,SAASG,UAAU,CAACE,QAAQ;wBACtCC,MAAMN,SAASG,UAAU,CAACG,IAAI;oBAChC;oBACAC,YAAYP,SAASO,UAAU;gBACjC;YACF;QACFC,iBAAiB,OAAOX,QACtB,MAAMC,MACJH,SAASI,OAAO,CAACS,eAAe,EAChCX,OACA,UAAY,MAAMH,OAAOO,aAAa,CAACQ,SAAS,CAACZ;QAErDa,iBAAiB,OAAOb,QACtB,MAAMC,MACJH,SAASI,OAAO,CAACW,eAAe,EAChCb,OACA,UAAY,MAAMH,OAAOO,aAA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