@shipfox/api-server 14.0.0 → 15.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: 7 files with swc (574.21ms)
2
+ Successfully compiled: 7 files with swc (684.58ms)
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @shipfox/api-server
2
2
 
3
+ ## 15.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [a7804a8]
8
+ - Updated dependencies [af095a4]
9
+ - Updated dependencies [1801f46]
10
+ - Updated dependencies [07410fe]
11
+ - Updated dependencies [989eb11]
12
+ - Updated dependencies [c6e7526]
13
+ - Updated dependencies [75f6828]
14
+ - Updated dependencies [050b796]
15
+ - Updated dependencies [1d16b55]
16
+ - @shipfox/api-definitions-dto@15.0.0
17
+ - @shipfox/api-definitions@15.0.0
18
+ - @shipfox/api-workflows-dto@15.0.0
19
+ - @shipfox/api-workflows@15.0.0
20
+ - @shipfox/api-triggers@15.0.0
21
+ - @shipfox/api-agent-dto@15.0.0
22
+ - @shipfox/api-agent@15.0.0
23
+ - @shipfox/api-integration-core@15.0.0
24
+ - @shipfox/api-dispatcher@15.0.0
25
+ - @shipfox/api-logs@15.0.0
26
+ - @shipfox/api-runners@15.0.0
27
+ - @shipfox/api-integration-core-dto@15.0.0
28
+ - @shipfox/node-opentelemetry@0.6.5
29
+ - @shipfox/api-auth@15.0.0
30
+ - @shipfox/api-auth-dto@15.0.0
31
+ - @shipfox/api-email-challenges@1.1.10
32
+ - @shipfox/api-projects@15.0.0
33
+ - @shipfox/api-projects-dto@15.0.0
34
+ - @shipfox/api-workspaces@15.0.0
35
+ - @shipfox/api-workspaces-dto@15.0.0
36
+ - @shipfox/api-secrets@15.0.0
37
+ - @shipfox/node-fastify@0.4.3
38
+ - @shipfox/node-module@1.0.7
39
+ - @shipfox/annotations@15.0.0
40
+
3
41
  ## 14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,CAAC;AAEtB,wBAAsB,cAAc,CAClC,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,aAAa,EAAE,CAAC,CAyJ1B"}
package/dist/modules.js CHANGED
@@ -178,7 +178,9 @@ export async function defaultModules(options = {}) {
178
178
  jobLeaseTokenTtlSeconds: durationToSeconds(authConfig.AUTH_JOB_LEASE_TOKEN_EXPIRES_IN)
179
179
  }),
180
180
  createTriggersModule({
181
- workflows: workflowsClient
181
+ workflows: workflowsClient,
182
+ definitions: definitionsClient,
183
+ projects: projectsClient
182
184
  }),
183
185
  dispatcherModule,
184
186
  ...extensionModules
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/modules.ts"],"sourcesContent":["import {annotationsModule} from '@shipfox/annotations';\nimport {annotationsInterModuleContract} from '@shipfox/annotations-dto/inter-module';\nimport {createAgentModule} from '@shipfox/api-agent';\nimport {agentInterModuleContract} from '@shipfox/api-agent-dto/inter-module';\nimport {createAuthModule} from '@shipfox/api-auth';\nimport {config as authConfig} from '@shipfox/api-auth/config';\nimport {\n type AuthInterModuleClient,\n authInterModuleContract,\n} from '@shipfox/api-auth-dto/inter-module';\nimport {createDefinitionsModule} from '@shipfox/api-definitions';\nimport {definitionsInterModuleContract} from '@shipfox/api-definitions-dto/inter-module';\nimport {dispatcherModule} from '@shipfox/api-dispatcher';\nimport {emailChallengesModule} from '@shipfox/api-email-challenges';\nimport {createIntegrationsContext, type WebhookDeliverySource} from '@shipfox/api-integration-core';\nimport {integrationsInterModuleContract} from '@shipfox/api-integration-core-dto/inter-module';\nimport {createLogsModule} from '@shipfox/api-logs';\nimport {createProjectsModule} from '@shipfox/api-projects';\nimport {projectsInterModuleContract} from '@shipfox/api-projects-dto/inter-module';\nimport {createRunnersModule} from '@shipfox/api-runners';\nimport {runnersInterModuleContract} from '@shipfox/api-runners-dto/inter-module';\nimport {createSecretsModule} from '@shipfox/api-secrets';\nimport {\n type SecretsInterModuleClient,\n secretsInterModuleContract,\n} from '@shipfox/api-secrets-dto/inter-module';\nimport {createTriggersModule} from '@shipfox/api-triggers';\nimport {createWorkflowsModule} from '@shipfox/api-workflows';\nimport {workflowsInterModuleContract} from '@shipfox/api-workflows-dto/inter-module';\nimport {createWorkspacesModule} from '@shipfox/api-workspaces';\nimport {\n type WorkspacesInterModuleClient,\n workspacesInterModuleContract,\n} from '@shipfox/api-workspaces-dto/inter-module';\nimport {reportError} from '@shipfox/node-error-monitoring';\nimport {durationToSeconds} from '@shipfox/node-jwt';\nimport type {ShipfoxModule} from '@shipfox/node-module';\nimport {\n createInMemoryInterModuleTransport,\n registerInterModulePresentations,\n} from '@shipfox/node-module/inter-module';\nimport {logger} from '@shipfox/node-opentelemetry';\n\nexport interface DefaultModulesOptions {\n webhookDeliverySource?: WebhookDeliverySource | undefined;\n authModule?: DefaultAuthModuleFactory | undefined;\n agentModule?: DefaultAgentModuleFactory | undefined;\n runnersModule?: DefaultRunnersModuleFactory | undefined;\n extension?: DefaultModulesExtension | undefined;\n}\n\nexport type DefaultAuthModuleFactory = (options: {\n workspaces: WorkspacesInterModuleClient;\n}) => ShipfoxModule;\n\n/**\n * Builds the Agent module in the standard composition slot. The default\n * factory validates Agent configuration through `createAgentModule`; a custom\n * factory owns equivalent validation when it does not delegate to that\n * factory. Custom modules must preserve the `agent` database namespace and\n * canonical Agent presentation required by the composed clients.\n */\nexport type DefaultAgentModuleFactory = (options: {\n secrets: Pick<SecretsInterModuleClient, 'deleteSecrets' | 'getSecretsByNamespace' | 'setSecrets'>;\n}) => ShipfoxModule;\nexport type DefaultRunnersModuleFactory = (options: {auth: AuthInterModuleClient}) => ShipfoxModule;\nexport type DefaultModulesExtension = (options: {\n workspaces: WorkspacesInterModuleClient;\n}) => ShipfoxModule[];\n\nexport async function defaultModules(\n options: DefaultModulesOptions = {},\n): Promise<ShipfoxModule[]> {\n const interModuleTransport = createInMemoryInterModuleTransport({\n reportInternalError: (error, context) => {\n logger().error(\n {err: error, module: context.module, method: context.method, phase: context.phase},\n 'Inter-module call failed unexpectedly',\n );\n reportError(error, {\n boundary: 'inter-module',\n operation: `${context.module}.${context.method}`,\n tags: {module: context.module, method: context.method, phase: context.phase},\n });\n },\n });\n const workflowsClient = interModuleTransport.createClient(workflowsInterModuleContract);\n const authClient = interModuleTransport.createClient(authInterModuleContract);\n const agentClient = interModuleTransport.createClient(agentInterModuleContract);\n const runnersClient = interModuleTransport.createClient(runnersInterModuleContract);\n const projectsClient = interModuleTransport.createClient(projectsInterModuleContract);\n const definitionsClient = interModuleTransport.createClient(definitionsInterModuleContract);\n const annotationsClient = interModuleTransport.createClient(annotationsInterModuleContract);\n const secretsClient = interModuleTransport.createClient(secretsInterModuleContract);\n const workspacesClient = interModuleTransport.createClient(workspacesInterModuleContract);\n const integrationsClient = interModuleTransport.createClient(integrationsInterModuleContract);\n const integrations = await createIntegrationsContext({\n workspaces: workspacesClient,\n secrets: {\n deleteSecrets: async (params) => (await secretsClient.deleteSecrets(params)).deleted,\n linear: {\n getSecret: async (params) =>\n (\n await secretsClient.getSecret({\n ...params,\n namespace: `system/integrations/linear/${params.namespace}`,\n })\n ).value,\n setSecrets: async (params) => {\n const {editedBy, ...secretParams} = params;\n await secretsClient.setSecrets({\n ...secretParams,\n namespace: `system/integrations/linear/${secretParams.namespace}`,\n ...(editedBy === undefined ? {} : {editedBy}),\n });\n },\n deleteSecrets: async (params) =>\n (\n await secretsClient.deleteSecrets({\n ...params,\n namespace: `system/integrations/linear/${params.namespace}`,\n })\n ).deleted,\n },\n jira: {\n getSecret: async (params) =>\n (\n await secretsClient.getSecret({\n ...params,\n namespace: `system/integrations/jira/${params.namespace}`,\n })\n ).value,\n setSecrets: async (params) => {\n const {editedBy, ...secretParams} = params;\n await secretsClient.setSecrets({\n ...secretParams,\n namespace: `system/integrations/jira/${secretParams.namespace}`,\n ...(editedBy === undefined ? {} : {editedBy}),\n });\n },\n deleteSecrets: async (params) =>\n (\n await secretsClient.deleteSecrets({\n ...params,\n namespace: `system/integrations/jira/${params.namespace}`,\n })\n ).deleted,\n },\n slack: {\n getSecret: async (params) =>\n (\n await secretsClient.getSecret({\n ...params,\n namespace: `system/integrations/slack/${params.namespace}`,\n })\n ).value,\n setSecrets: async (params) => {\n const {editedBy, ...secretParams} = params;\n await secretsClient.setSecrets({\n ...secretParams,\n namespace: `system/integrations/slack/${secretParams.namespace}`,\n ...(editedBy === undefined ? {} : {editedBy}),\n });\n },\n deleteSecrets: async (params) =>\n (\n await secretsClient.deleteSecrets({\n ...params,\n namespace: `system/integrations/slack/${params.namespace}`,\n })\n ).deleted,\n },\n },\n agentTools: {workflows: workflowsClient},\n webhookDeliverySource: options.webhookDeliverySource,\n });\n const projectsModule = createProjectsModule({integrations: integrationsClient, auth: authClient});\n const definitionsModule = createDefinitionsModule({\n projects: projectsClient,\n agent: agentClient,\n integrations: integrationsClient,\n });\n const extensionModules = options.extension?.({workspaces: workspacesClient}) ?? [];\n const agentModule = (options.agentModule ?? createAgentModule)({\n secrets: createAgentSecretsClient(secretsClient),\n });\n if (options.agentModule) validateCustomAgentModule(agentModule);\n\n const modules = [\n emailChallengesModule,\n (options.authModule ?? createAuthModule)({workspaces: workspacesClient}),\n createWorkspacesModule({auth: authClient, projects: projectsClient, runners: runnersClient}),\n createSecretsModule(projectsClient),\n agentModule,\n integrations.module,\n projectsModule,\n definitionsModule,\n createWorkflowsModule({\n annotations: annotationsClient,\n agent: agentClient,\n definitions: definitionsClient,\n auth: authClient,\n projects: projectsClient,\n runners: runnersClient,\n secrets: secretsClient,\n workspaces: workspacesClient,\n integrations: integrationsClient,\n }),\n annotationsModule,\n (options.runnersModule ?? createRunnersModule)({auth: authClient}),\n createLogsModule({\n workflows: workflowsClient,\n jobLeaseTokenTtlSeconds: durationToSeconds(authConfig.AUTH_JOB_LEASE_TOKEN_EXPIRES_IN),\n }),\n createTriggersModule({workflows: workflowsClient}),\n dispatcherModule,\n ...extensionModules,\n ];\n registerInterModulePresentations({transport: interModuleTransport, modules});\n interModuleTransport.seal();\n return modules;\n}\n\ntype AgentModuleSecretsClient = Pick<\n SecretsInterModuleClient,\n 'deleteSecrets' | 'getSecretsByNamespace' | 'setSecrets'\n>;\n\nfunction createAgentSecretsClient(\n secretsClient: SecretsInterModuleClient,\n): AgentModuleSecretsClient {\n return {\n deleteSecrets: (input, options) => secretsClient.deleteSecrets(input, options),\n getSecretsByNamespace: (input, options) => secretsClient.getSecretsByNamespace(input, options),\n setSecrets: (input, options) => secretsClient.setSecrets(input, options),\n };\n}\n\nfunction validateCustomAgentModule(module: ShipfoxModule): void {\n const databases = module.database\n ? Array.isArray(module.database)\n ? module.database\n : [module.database]\n : [];\n if (\n !databases.some(({databaseNamespace}) => databaseNamespace === agentInterModuleContract.module)\n ) {\n throw new Error(\n 'Custom agentModule must declare database namespace \"agent\" for the Agent module.',\n );\n }\n\n if (\n !module.interModulePresentations?.some(({contract}) => contract === agentInterModuleContract)\n ) {\n throw new Error('Custom agentModule must present the canonical \"agent\" inter-module contract.');\n }\n}\n"],"names":["annotationsModule","annotationsInterModuleContract","createAgentModule","agentInterModuleContract","createAuthModule","config","authConfig","authInterModuleContract","createDefinitionsModule","definitionsInterModuleContract","dispatcherModule","emailChallengesModule","createIntegrationsContext","integrationsInterModuleContract","createLogsModule","createProjectsModule","projectsInterModuleContract","createRunnersModule","runnersInterModuleContract","createSecretsModule","secretsInterModuleContract","createTriggersModule","createWorkflowsModule","workflowsInterModuleContract","createWorkspacesModule","workspacesInterModuleContract","reportError","durationToSeconds","createInMemoryInterModuleTransport","registerInterModulePresentations","logger","defaultModules","options","interModuleTransport","reportInternalError","error","context","err","module","method","phase","boundary","operation","tags","workflowsClient","createClient","authClient","agentClient","runnersClient","projectsClient","definitionsClient","annotationsClient","secretsClient","workspacesClient","integrationsClient","integrations","workspaces","secrets","deleteSecrets","params","deleted","linear","getSecret","namespace","value","setSecrets","editedBy","secretParams","undefined","jira","slack","agentTools","workflows","webhookDeliverySource","projectsModule","auth","definitionsModule","projects","agent","extensionModules","extension","agentModule","createAgentSecretsClient","validateCustomAgentModule","modules","authModule","runners","annotations","definitions","runnersModule","jobLeaseTokenTtlSeconds","AUTH_JOB_LEASE_TOKEN_EXPIRES_IN","transport","seal","input","getSecretsByNamespace","databases","database","Array","isArray","some","databaseNamespace","Error","interModulePresentations","contract"],"mappings":"AAAA,SAAQA,iBAAiB,QAAO,uBAAuB;AACvD,SAAQC,8BAA8B,QAAO,wCAAwC;AACrF,SAAQC,iBAAiB,QAAO,qBAAqB;AACrD,SAAQC,wBAAwB,QAAO,sCAAsC;AAC7E,SAAQC,gBAAgB,QAAO,oBAAoB;AACnD,SAAQC,UAAUC,UAAU,QAAO,2BAA2B;AAC9D,SAEEC,uBAAuB,QAClB,qCAAqC;AAC5C,SAAQC,uBAAuB,QAAO,2BAA2B;AACjE,SAAQC,8BAA8B,QAAO,4CAA4C;AACzF,SAAQC,gBAAgB,QAAO,0BAA0B;AACzD,SAAQC,qBAAqB,QAAO,gCAAgC;AACpE,SAAQC,yBAAyB,QAAmC,gCAAgC;AACpG,SAAQC,+BAA+B,QAAO,iDAAiD;AAC/F,SAAQC,gBAAgB,QAAO,oBAAoB;AACnD,SAAQC,oBAAoB,QAAO,wBAAwB;AAC3D,SAAQC,2BAA2B,QAAO,yCAAyC;AACnF,SAAQC,mBAAmB,QAAO,uBAAuB;AACzD,SAAQC,0BAA0B,QAAO,wCAAwC;AACjF,SAAQC,mBAAmB,QAAO,uBAAuB;AACzD,SAEEC,0BAA0B,QACrB,wCAAwC;AAC/C,SAAQC,oBAAoB,QAAO,wBAAwB;AAC3D,SAAQC,qBAAqB,QAAO,yBAAyB;AAC7D,SAAQC,4BAA4B,QAAO,0CAA0C;AACrF,SAAQC,sBAAsB,QAAO,0BAA0B;AAC/D,SAEEC,6BAA6B,QACxB,2CAA2C;AAClD,SAAQC,WAAW,QAAO,iCAAiC;AAC3D,SAAQC,iBAAiB,QAAO,oBAAoB;AAEpD,SACEC,kCAAkC,EAClCC,gCAAgC,QAC3B,oCAAoC;AAC3C,SAAQC,M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2B,OAAO/B;YACPyC,aAAatC;YACbyB,MAAM7B;YACN+B,UAAU5B;YACVqC,SAAStC;YACTS,SAASL;YACTI,YAAYH;YACZE,cAAcD;QAChB;QACAtD;QACCgC,CAAAA,QAAQyD,aAAa,IAAIxE,mBAAkB,EAAG;YAAC0D,MAAM7B;QAAU;QAChEhC,iBAAiB;YACf0D,WAAW5B;YACX8C,yBAAyB/D,kBAAkBrB,WAAWqF,+BAA+B;QACvF;QACAtE,qBAAqB;YAACmD,WAAW5B;QAAe;QAChDlC;WACGqE;KACJ;IACDlD,iCAAiC;QAAC+D,WAAW3D;QAAsBmD;IAAO;IAC1EnD,qBAAqB4D,IAAI;IACzB,OAAOT;AACT;AAOA,SAASF,yBACP9B,aAAuC;IAEvC,OAAO;QACLM,eAAe,CAACoC,OAAO9D,UAAYoB,cAAcM,aAAa,CAACoC,OAAO9D;QACtE+D,uBAAuB,CAACD,OAAO9D,UAAYoB,cAAc2C,qBAAqB,CAACD,OAAO9D;QACtFiC,YAAY,CAAC6B,OAAO9D,UAAYoB,cAAca,UAAU,CAAC6B,OAAO9D;IAClE;AACF;AAEA,SAASmD,0BAA0B7C,MAAqB;IACtD,MAAM0D,YAAY1D,OAAO2D,QAAQ,GAC7BC,MAAMC,OAAO,CAAC7D,OAAO2D,QAAQ,IAC3B3D,OAAO2D,QAAQ,GACf;QAAC3D,OAAO2D,QAAQ;KAAC,GACnB,EAAE;IACN,IACE,CAACD,UAAUI,IAAI,CAAC,CAAC,EAACC,iBAAiB,EAAC,GAAKA,sBAAsBlG,yBAAyBmC,MAAM,GAC9F;QACA,MAAM,IAAIgE,MACR;IAEJ;IAEA,IACE,CAAChE,OAAOiE,wBAAwB,EAAEH,KAAK,CAAC,EAACI,QAAQ,EAAC,GAAKA,aAAarG,2BACpE;QACA,MAAM,IAAImG,MAAM;IAClB;AACF"}
1
+ {"version":3,"sources":["../src/modules.ts"],"sourcesContent":["import {annotationsModule} from '@shipfox/annotations';\nimport {annotationsInterModuleContract} from '@shipfox/annotations-dto/inter-module';\nimport {createAgentModule} from '@shipfox/api-agent';\nimport {agentInterModuleContract} from '@shipfox/api-agent-dto/inter-module';\nimport {createAuthModule} from '@shipfox/api-auth';\nimport {config as authConfig} from '@shipfox/api-auth/config';\nimport {\n type AuthInterModuleClient,\n authInterModuleContract,\n} from '@shipfox/api-auth-dto/inter-module';\nimport {createDefinitionsModule} from '@shipfox/api-definitions';\nimport {definitionsInterModuleContract} from '@shipfox/api-definitions-dto/inter-module';\nimport {dispatcherModule} from '@shipfox/api-dispatcher';\nimport {emailChallengesModule} from '@shipfox/api-email-challenges';\nimport {createIntegrationsContext, type WebhookDeliverySource} from '@shipfox/api-integration-core';\nimport {integrationsInterModuleContract} from '@shipfox/api-integration-core-dto/inter-module';\nimport {createLogsModule} from '@shipfox/api-logs';\nimport {createProjectsModule} from '@shipfox/api-projects';\nimport {projectsInterModuleContract} from '@shipfox/api-projects-dto/inter-module';\nimport {createRunnersModule} from '@shipfox/api-runners';\nimport {runnersInterModuleContract} from '@shipfox/api-runners-dto/inter-module';\nimport {createSecretsModule} from '@shipfox/api-secrets';\nimport {\n type SecretsInterModuleClient,\n secretsInterModuleContract,\n} from '@shipfox/api-secrets-dto/inter-module';\nimport {createTriggersModule} from '@shipfox/api-triggers';\nimport {createWorkflowsModule} from '@shipfox/api-workflows';\nimport {workflowsInterModuleContract} from '@shipfox/api-workflows-dto/inter-module';\nimport {createWorkspacesModule} from '@shipfox/api-workspaces';\nimport {\n type WorkspacesInterModuleClient,\n workspacesInterModuleContract,\n} from '@shipfox/api-workspaces-dto/inter-module';\nimport {reportError} from '@shipfox/node-error-monitoring';\nimport {durationToSeconds} from '@shipfox/node-jwt';\nimport type {ShipfoxModule} from '@shipfox/node-module';\nimport {\n createInMemoryInterModuleTransport,\n registerInterModulePresentations,\n} from '@shipfox/node-module/inter-module';\nimport {logger} from '@shipfox/node-opentelemetry';\n\nexport interface DefaultModulesOptions {\n webhookDeliverySource?: WebhookDeliverySource | undefined;\n authModule?: DefaultAuthModuleFactory | undefined;\n agentModule?: DefaultAgentModuleFactory | undefined;\n runnersModule?: DefaultRunnersModuleFactory | undefined;\n extension?: DefaultModulesExtension | undefined;\n}\n\nexport type DefaultAuthModuleFactory = (options: {\n workspaces: WorkspacesInterModuleClient;\n}) => ShipfoxModule;\n\n/**\n * Builds the Agent module in the standard composition slot. The default\n * factory validates Agent configuration through `createAgentModule`; a custom\n * factory owns equivalent validation when it does not delegate to that\n * factory. Custom modules must preserve the `agent` database namespace and\n * canonical Agent presentation required by the composed clients.\n */\nexport type DefaultAgentModuleFactory = (options: {\n secrets: Pick<SecretsInterModuleClient, 'deleteSecrets' | 'getSecretsByNamespace' | 'setSecrets'>;\n}) => ShipfoxModule;\nexport type DefaultRunnersModuleFactory = (options: {auth: AuthInterModuleClient}) => ShipfoxModule;\nexport type DefaultModulesExtension = (options: {\n workspaces: WorkspacesInterModuleClient;\n}) => ShipfoxModule[];\n\nexport async function defaultModules(\n options: DefaultModulesOptions = {},\n): Promise<ShipfoxModule[]> {\n const interModuleTransport = createInMemoryInterModuleTransport({\n reportInternalError: (error, context) => {\n logger().error(\n {err: error, module: context.module, method: context.method, phase: context.phase},\n 'Inter-module call failed unexpectedly',\n );\n reportError(error, {\n boundary: 'inter-module',\n operation: `${context.module}.${context.method}`,\n tags: {module: context.module, method: context.method, phase: context.phase},\n });\n },\n });\n const workflowsClient = interModuleTransport.createClient(workflowsInterModuleContract);\n const authClient = interModuleTransport.createClient(authInterModuleContract);\n const agentClient = interModuleTransport.createClient(agentInterModuleContract);\n const runnersClient = interModuleTransport.createClient(runnersInterModuleContract);\n const projectsClient = interModuleTransport.createClient(projectsInterModuleContract);\n const definitionsClient = interModuleTransport.createClient(definitionsInterModuleContract);\n const annotationsClient = interModuleTransport.createClient(annotationsInterModuleContract);\n const secretsClient = interModuleTransport.createClient(secretsInterModuleContract);\n const workspacesClient = interModuleTransport.createClient(workspacesInterModuleContract);\n const integrationsClient = interModuleTransport.createClient(integrationsInterModuleContract);\n const integrations = await createIntegrationsContext({\n workspaces: workspacesClient,\n secrets: {\n deleteSecrets: async (params) => (await secretsClient.deleteSecrets(params)).deleted,\n linear: {\n getSecret: async (params) =>\n (\n await secretsClient.getSecret({\n ...params,\n namespace: `system/integrations/linear/${params.namespace}`,\n })\n ).value,\n setSecrets: async (params) => {\n const {editedBy, ...secretParams} = params;\n await secretsClient.setSecrets({\n ...secretParams,\n namespace: `system/integrations/linear/${secretParams.namespace}`,\n ...(editedBy === undefined ? {} : {editedBy}),\n });\n },\n deleteSecrets: async (params) =>\n (\n await secretsClient.deleteSecrets({\n ...params,\n namespace: `system/integrations/linear/${params.namespace}`,\n })\n ).deleted,\n },\n jira: {\n getSecret: async (params) =>\n (\n await secretsClient.getSecret({\n ...params,\n namespace: `system/integrations/jira/${params.namespace}`,\n })\n ).value,\n setSecrets: async (params) => {\n const {editedBy, ...secretParams} = params;\n await secretsClient.setSecrets({\n ...secretParams,\n namespace: `system/integrations/jira/${secretParams.namespace}`,\n ...(editedBy === undefined ? {} : {editedBy}),\n });\n },\n deleteSecrets: async (params) =>\n (\n await secretsClient.deleteSecrets({\n ...params,\n namespace: `system/integrations/jira/${params.namespace}`,\n })\n ).deleted,\n },\n slack: {\n getSecret: async (params) =>\n (\n await secretsClient.getSecret({\n ...params,\n namespace: `system/integrations/slack/${params.namespace}`,\n })\n ).value,\n setSecrets: async (params) => {\n const {editedBy, ...secretParams} = params;\n await secretsClient.setSecrets({\n ...secretParams,\n namespace: `system/integrations/slack/${secretParams.namespace}`,\n ...(editedBy === undefined ? {} : {editedBy}),\n });\n },\n deleteSecrets: async (params) =>\n (\n await secretsClient.deleteSecrets({\n ...params,\n namespace: `system/integrations/slack/${params.namespace}`,\n })\n ).deleted,\n },\n },\n agentTools: {workflows: workflowsClient},\n webhookDeliverySource: options.webhookDeliverySource,\n });\n const projectsModule = createProjectsModule({integrations: integrationsClient, auth: authClient});\n const definitionsModule = createDefinitionsModule({\n projects: projectsClient,\n agent: agentClient,\n integrations: integrationsClient,\n });\n const extensionModules = options.extension?.({workspaces: workspacesClient}) ?? [];\n const agentModule = (options.agentModule ?? createAgentModule)({\n secrets: createAgentSecretsClient(secretsClient),\n });\n if (options.agentModule) validateCustomAgentModule(agentModule);\n\n const modules = [\n emailChallengesModule,\n (options.authModule ?? createAuthModule)({workspaces: workspacesClient}),\n createWorkspacesModule({auth: authClient, projects: projectsClient, runners: runnersClient}),\n createSecretsModule(projectsClient),\n agentModule,\n integrations.module,\n projectsModule,\n definitionsModule,\n createWorkflowsModule({\n annotations: annotationsClient,\n agent: agentClient,\n definitions: definitionsClient,\n auth: authClient,\n projects: projectsClient,\n runners: runnersClient,\n secrets: secretsClient,\n workspaces: workspacesClient,\n integrations: integrationsClient,\n }),\n annotationsModule,\n (options.runnersModule ?? createRunnersModule)({auth: authClient}),\n createLogsModule({\n workflows: workflowsClient,\n jobLeaseTokenTtlSeconds: durationToSeconds(authConfig.AUTH_JOB_LEASE_TOKEN_EXPIRES_IN),\n }),\n createTriggersModule({\n workflows: workflowsClient,\n definitions: definitionsClient,\n projects: projectsClient,\n }),\n dispatcherModule,\n ...extensionModules,\n ];\n registerInterModulePresentations({transport: interModuleTransport, modules});\n interModuleTransport.seal();\n return modules;\n}\n\ntype AgentModuleSecretsClient = Pick<\n SecretsInterModuleClient,\n 'deleteSecrets' | 'getSecretsByNamespace' | 'setSecrets'\n>;\n\nfunction createAgentSecretsClient(\n secretsClient: SecretsInterModuleClient,\n): AgentModuleSecretsClient {\n return {\n deleteSecrets: (input, options) => secretsClient.deleteSecrets(input, options),\n getSecretsByNamespace: (input, options) => secretsClient.getSecretsByNamespace(input, options),\n setSecrets: (input, options) => secretsClient.setSecrets(input, options),\n };\n}\n\nfunction validateCustomAgentModule(module: ShipfoxModule): void {\n const databases = module.database\n ? Array.isArray(module.database)\n ? module.database\n : [module.database]\n : [];\n if (\n !databases.some(({databaseNamespace}) => databaseNamespace === agentInterModuleContract.module)\n ) {\n throw new Error(\n 'Custom agentModule must declare database namespace \"agent\" for the Agent module.',\n );\n }\n\n if (\n !module.interModulePresentations?.some(({contract}) => contract === agentInterModuleContract)\n ) {\n throw new Error('Custom agentModule must present the canonical \"agent\" inter-module contract.');\n }\n}\n"],"names":["annotationsModule","annotationsInterModuleContract","createAgentModule","agentInterModuleContract","createAuthModule","config","authConfig","authInterModuleContract","createDefinitionsModule","definitionsInterModuleContract","dispatcherModule","emailChallengesModule","createIntegrationsContext","integrationsInterModuleContract","createLogsModule","createProjectsModule","projectsInterModuleContract","createRunnersModule","runnersInterModuleContract","createSecretsModule","secretsInterModuleContract","createTriggersModule","createWorkflowsModule","workflowsInterModuleContract","createWorkspacesModule","workspacesInterModuleContract","reportError","durationToSeconds","createInMemoryInterModuleTransport","registerInterModulePresentations","logger","defaultModules","options","interModuleTransport","reportInternalError","error","context","err","module","method","phase","boundary","operation","tags","workflowsClient","createClient","authClient","agentClient","runnersClient","projectsClient","definitionsClient","annotationsClient","secretsClient","workspacesClient","integrationsClient","integrations","workspaces","secrets","deleteSecrets","params","deleted","linear","getSecret","namespace","value","setSecrets","editedBy","secretParams","undefined","jira","slack","agentTools","workflows","webhookDeliverySource","projectsModule","auth","definitionsModule","projects","agent","extensionModules","extension","agentModule","createAgentSecretsClient","validateCustomAgentModule","modules","authModule","runners","annotations","definitions","runnersModule","jobLeaseTokenTtlSeconds","AUTH_JOB_LEASE_TOKEN_EXPIRES_IN","transport","seal","input","getSecretsByNamespace","databases","database","Array","isArray","some","databaseNamespace","Error","interModulePresentations","contract"],"mappings":"AAAA,SAAQA,iBAAiB,QAAO,uBAAuB;AACvD,SAAQC,8BAA8B,QAAO,wCAAwC;AACrF,SAAQC,iBAAiB,QAAO,qBAAqB;AACrD,SAAQC,wBAAwB,QAAO,sCAAsC;AAC7E,SAAQC,gBAAgB,QAAO,oBAAoB;AACnD,SAAQC,UAAUC,UAAU,QAAO,2BAA2B;AAC9D,SAEEC,uBAAuB,QAClB,qCAAqC;AAC5C,SAA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