@shipfox/api-projects 5.0.0 → 6.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.
Files changed (33) hide show
  1. package/.turbo/turbo-build.log +4 -4
  2. package/CHANGELOG.md +30 -0
  3. package/dist/core/projects.d.ts +2 -2
  4. package/dist/core/projects.d.ts.map +1 -1
  5. package/dist/core/projects.js +2 -1
  6. package/dist/core/projects.js.map +1 -1
  7. package/dist/index.d.ts +3 -3
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +6 -2
  10. package/dist/index.js.map +1 -1
  11. package/dist/presentation/inter-module.d.ts +4 -0
  12. package/dist/presentation/inter-module.d.ts.map +1 -0
  13. package/dist/presentation/inter-module.js +29 -0
  14. package/dist/presentation/inter-module.js.map +1 -0
  15. package/dist/presentation/routes/create-project.d.ts +2 -2
  16. package/dist/presentation/routes/create-project.d.ts.map +1 -1
  17. package/dist/presentation/routes/create-project.js +19 -20
  18. package/dist/presentation/routes/create-project.js.map +1 -1
  19. package/dist/presentation/routes/index.d.ts +2 -2
  20. package/dist/presentation/routes/index.d.ts.map +1 -1
  21. package/dist/presentation/routes/index.js +2 -2
  22. package/dist/presentation/routes/index.js.map +1 -1
  23. package/dist/tsconfig.test.tsbuildinfo +1 -1
  24. package/package.json +12 -10
  25. package/src/core/projects.test.ts +21 -25
  26. package/src/core/projects.ts +7 -3
  27. package/src/index.ts +6 -4
  28. package/src/presentation/inter-module.ts +33 -0
  29. package/src/presentation/routes/create-project.ts +41 -41
  30. package/src/presentation/routes/index.ts +3 -3
  31. package/src/presentation/routes/projects.test.ts +17 -28
  32. package/src/presentation/subscribers/on-source-commit-pushed.test.ts +2 -1
  33. package/tsconfig.build.tsbuildinfo +1 -1
@@ -1,6 +1,6 @@
1
1
  $ shipfox-swc && shipfox-temporal-bundle dist/temporal/workflows/index.js
2
- Successfully compiled: 35 files with swc (76.48ms)
3
- 2026-07-19T19:41:25.540Z [INFO] asset workflow-bundle-3333ed6094e3113d3689.js 1.44 MiB [emitted] [immutable] (name: main)
2
+ Successfully compiled: 36 files with swc (469.36ms)
3
+ 2026-07-21T08:09:54.557Z [INFO] asset workflow-bundle-3333ed6094e3113d3689.js 1.44 MiB [emitted] [immutable] (name: main)
4
4
  runtime modules 670 bytes 3 modules
5
5
  modules by path ../../../node_modules/.pnpm/ 424 KiB
6
6
  modules by path ../../../node_modules/.pnpm/@temporalio+common@1.18.1/node_modules/@temporal...(truncated) 155 KiB 34 modules
@@ -15,6 +15,6 @@ modules by path ./dist/temporal/workflows/ 1.02 KiB
15
15
  optional modules 30 bytes [optional]
16
16
  __temporal_custom_payload_converter (ignored) 15 bytes [optional] [built] [code generated]
17
17
  __temporal_custom_failure_converter (ignored) 15 bytes [optional] [built] [code generated]
18
- webpack 5.107.2 compiled successfully in 748 ms
19
- 2026-07-19T19:41:25.543Z [INFO] Workflow bundle created { size: '1.44MB' }
18
+ webpack 5.107.2 compiled successfully in 3254 ms
19
+ 2026-07-21T08:09:54.562Z [INFO] Workflow bundle created { size: '1.44MB' }
20
20
  /home/runner/work/shipfox/shipfox/libs/api/projects/dist/temporal/workflows/index.js: 1514894 bytes
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @shipfox/api-projects
2
2
 
3
+ ## 6.0.0
4
+
5
+ ### Patch Changes
6
+
7
+ - 0bb82a4: Adds the Agent and Integrations inter-module APIs, moving Workflows agent configuration, runtime credential resolution, and integration consumers behind producer-owned clients.
8
+ - f73da5d: Enforces bounded API context imports and routes inter-module consumers through producer contracts.
9
+ - Updated dependencies [0bb82a4]
10
+ - Updated dependencies [54ce48b]
11
+ - Updated dependencies [f4bc2eb]
12
+ - Updated dependencies [c0162b0]
13
+ - Updated dependencies [7ac43a4]
14
+ - Updated dependencies [f262539]
15
+ - Updated dependencies [a01e917]
16
+ - Updated dependencies [3bb4e26]
17
+ - Updated dependencies [8bdc149]
18
+ - Updated dependencies [3810996]
19
+ - Updated dependencies [b00ed29]
20
+ - Updated dependencies [8aa7cd3]
21
+ - Updated dependencies [81f9544]
22
+ - Updated dependencies [4604a06]
23
+ - @shipfox/api-integration-core-dto@6.0.0
24
+ - @shipfox/node-module@0.4.0
25
+ - @shipfox/node-temporal@0.3.2
26
+ - @shipfox/node-drizzle@0.3.2
27
+ - @shipfox/node-outbox@0.2.4
28
+ - @shipfox/api-auth-context@6.0.0
29
+ - @shipfox/node-fastify@0.2.4
30
+ - @shipfox/inter-module@0.2.0
31
+ - @shipfox/api-projects-dto@6.0.0
32
+
3
33
  ## 5.0.0
4
34
 
5
35
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import type { IntegrationSourceControlService } from '@shipfox/api-integration-core';
1
+ import type { IntegrationsModuleClient } from '@shipfox/api-integration-core-dto';
2
2
  import type { Project } from './entities/project.js';
3
3
  export interface CreateProjectFromSourceParams {
4
4
  actorId: string;
@@ -6,7 +6,7 @@ export interface CreateProjectFromSourceParams {
6
6
  name: string;
7
7
  sourceConnectionId: string;
8
8
  sourceExternalRepositoryId: string;
9
- sourceControl: IntegrationSourceControlService;
9
+ integrations: IntegrationsModuleClient;
10
10
  }
11
11
  export declare function createProjectFromSource(params: CreateProjectFromSourceParams): Promise<Project>;
12
12
  //# sourceMappingURL=projects.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/core/projects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,+BAA+B,EAAC,MAAM,+BAA+B,CAAC;AAYnF,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAGnD,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0BAA0B,EAAE,MAAM,CAAC;IACnC,aAAa,EAAE,+BAA+B,CAAC;CAChD;AAED,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,OAAO,CAAC,CAsElB"}
1
+ {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/core/projects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,mCAAmC,CAAC;AAYhF,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAGnD,MAAM,WAAW,6BAA6B;IAC5C,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,kBAAkB,EAAE,MAAM,CAAC;IAC3B,0BAA0B,EAAE,MAAM,CAAC;IACnC,YAAY,EAAE,wBAAwB,CAAC;CACxC;AAED,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,OAAO,CAAC,CA0ElB"}
@@ -7,7 +7,8 @@ import { projects, toProject } from '#db/schema/projects.js';
7
7
  import { recordProjectCreated } from '#metrics/instance.js';
8
8
  import { ProjectAlreadyExistsError } from './errors.js';
9
9
  export async function createProjectFromSource(params) {
10
- const source = await params.sourceControl.resolveRepository({
10
+ let source;
11
+ source = await params.integrations.resolveSourceRepository({
11
12
  workspaceId: params.workspaceId,
12
13
  connectionId: params.sourceConnectionId,
13
14
  externalRepositoryId: params.sourceExternalRepositoryId
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/projects.ts"],"sourcesContent":["import type {IntegrationSourceControlService} from '@shipfox/api-integration-core';\nimport {\n PROJECT_CREATED,\n PROJECT_SOURCE_BOUND,\n type ProjectsEventMap,\n} from '@shipfox/api-projects-dto';\nimport {writeOutboxEvent} from '@shipfox/node-outbox';\nimport {and, eq} from 'drizzle-orm';\nimport {db} from '#db/db.js';\nimport {projectsOutbox} from '#db/schema/outbox.js';\nimport {projects, toProject} from '#db/schema/projects.js';\nimport {recordProjectCreated} from '#metrics/instance.js';\nimport type {Project} from './entities/project.js';\nimport {ProjectAlreadyExistsError} from './errors.js';\n\nexport interface CreateProjectFromSourceParams {\n actorId: string;\n workspaceId: string;\n name: string;\n sourceConnectionId: string;\n sourceExternalRepositoryId: string;\n sourceControl: IntegrationSourceControlService;\n}\n\nexport async function createProjectFromSource(\n params: CreateProjectFromSourceParams,\n): Promise<Project> {\n const source = await params.sourceControl.resolveRepository({\n workspaceId: params.workspaceId,\n connectionId: params.sourceConnectionId,\n externalRepositoryId: params.sourceExternalRepositoryId,\n });\n\n const project = await db().transaction(async (tx) => {\n const [projectRow] = await tx\n .insert(projects)\n .values({\n workspaceId: params.workspaceId,\n sourceConnectionId: source.connection.id,\n sourceExternalRepositoryId: source.repository.externalRepositoryId,\n name: params.name,\n })\n .onConflictDoNothing({\n target: [projects.sourceConnectionId, projects.sourceExternalRepositoryId],\n })\n .returning();\n\n if (!projectRow) {\n const [existing] = await tx\n .select()\n .from(projects)\n .where(\n and(\n eq(projects.sourceConnectionId, source.connection.id),\n eq(projects.sourceExternalRepositoryId, source.repository.externalRepositoryId),\n ),\n )\n .limit(1);\n if (existing) {\n throw new ProjectAlreadyExistsError(\n existing.id,\n source.connection.id,\n source.repository.externalRepositoryId,\n );\n }\n throw new Error('Project insert returned no rows');\n }\n\n const project = toProject(projectRow);\n\n await writeOutboxEvent<ProjectsEventMap>(tx, projectsOutbox, {\n type: PROJECT_CREATED,\n payload: {\n actorId: params.actorId,\n workspaceId: project.workspaceId,\n projectId: project.id,\n sourceConnectionId: project.sourceConnectionId,\n sourceExternalRepositoryId: project.sourceExternalRepositoryId,\n },\n });\n await writeOutboxEvent<ProjectsEventMap>(tx, projectsOutbox, {\n type: PROJECT_SOURCE_BOUND,\n payload: {\n actorId: params.actorId,\n workspaceId: project.workspaceId,\n projectId: project.id,\n sourceConnectionId: project.sourceConnectionId,\n provider: source.connection.provider,\n externalRepositoryId: project.sourceExternalRepositoryId,\n },\n });\n\n return project;\n });\n recordProjectCreated();\n return project;\n}\n"],"names":["PROJECT_CREATED","PROJECT_SOURCE_BOUND","writeOutboxEvent","and","eq","db","projectsOutbox","projects","toProject","recordProjectCreated","ProjectAlreadyExistsError","createProjectFromSource","params","source","sourceControl","resolveRepository","workspaceId","connectionId","sourceConnectionId","externalRepositoryId","sourceExternalRepositoryId","project","transaction","tx","projectRow","insert","values","connection","id","repository","name","onConflictDoNothing","target","returning","existing","select","from","where","limit","Error","type","payload","actorId","projectId","provider"],"mappings":"AACA,SACEA,eAAe,EACfC,oBAAoB,QAEf,4BAA4B;AACnC,SAAQC,gBAAgB,QAAO,uBAAuB;AACtD,SAAQC,GAAG,EAAEC,EAAE,QAAO,cAAc;AACpC,SAAQC,EAAE,QAAO,YAAY;AAC7B,SAAQC,cAAc,QAAO,uBAAuB;AACpD,SAAQC,QAAQ,EAAEC,SAAS,QAAO,yBAAyB;AAC3D,SAAQC,oBAAoB,QAAO,uBAAuB;AAE1D,SAAQC,yBAAyB,QAAO,cAAc;AAWtD,OAAO,eAAeC,wBACpBC,MAAqC;IAErC,MAAMC,SAAS,MAAMD,OAAOE,aAAa,CAACC,iBAAiB,CAAC;QAC1DC,aAAaJ,OAAOI,WAAW;QAC/BC,cAAcL,OAAOM,kBAAkB;QACvCC,sBAAsBP,OAAOQ,0BAA0B;IACzD;IAEA,MAAMC,UAAU,MAAMhB,KAAKiB,WAAW,CAAC,OAAOC;QAC5C,MAAM,CAACC,WAAW,GAAG,MAAMD,GACxBE,MAAM,CAAClB,UACPmB,MAAM,CAAC;YACNV,aAAaJ,OAAOI,WAAW;YAC/BE,oBAAoBL,OAAOc,UAAU,CAACC,EAAE;YACxCR,4BAA4BP,OAAOgB,UAAU,CAACV,oBAAoB;YAClEW,MAAMlB,OAAOkB,IAAI;QACnB,GACCC,mBAAmB,CAAC;YACnBC,QAAQ;gBAACzB,SAASW,kBAAkB;gBAAEX,SAASa,0BAA0B;aAAC;QAC5E,GACCa,SAAS;QAEZ,IAAI,CAACT,YAAY;YACf,MAAM,CAACU,SAAS,GAAG,MAAMX,GACtBY,MAAM,GACNC,IAAI,CAAC7B,UACL8B,KAAK,CACJlC,IACEC,GAAGG,SAASW,kBAAkB,EAAEL,OAAOc,UAAU,CAACC,EAAE,GACpDxB,GAAGG,SAASa,0BAA0B,EAAEP,OAAOgB,UAAU,CAACV,oBAAoB,IAGjFmB,KAAK,CAAC;YACT,IAAIJ,UAAU;gBACZ,MAAM,IAAIxB,0BACRwB,SAASN,EAAE,EACXf,OAAOc,UAAU,CAACC,EAAE,EACpBf,OAAOgB,UAAU,CAACV,oBAAoB;YAE1C;YACA,MAAM,IAAIoB,MAAM;QAClB;QAEA,MAAMlB,UAAUb,UAAUgB;QAE1B,MAAMtB,iBAAmCqB,IAAIjB,gBAAgB;YAC3DkC,MAAMxC;YACNyC,SAAS;gBACPC,SAAS9B,OAAO8B,OAAO;gBACvB1B,aAAaK,QAAQL,WAAW;gBAChC2B,WAAWtB,QAAQO,EAAE;gBACrBV,oBAAoBG,QAAQH,kBAAkB;gBAC9CE,4BAA4BC,QAAQD,0BAA0B;YAChE;QACF;QACA,MAAMlB,iBAAmCqB,IAAIjB,gBAAgB;YAC3DkC,MAAMvC;YACNwC,SAAS;gBACPC,SAAS9B,OAAO8B,OAAO;gBACvB1B,aAAaK,QAAQL,WAAW;gBAChC2B,WAAWtB,QAAQO,EAAE;gBACrBV,oBAAoBG,QAAQH,kBAAkB;gBAC9C0B,UAAU/B,OAAOc,UAAU,CAACiB,QAAQ;gBACpCzB,sBAAsBE,QAAQD,0BAA0B;YAC1D;QACF;QAEA,OAAOC;IACT;IACAZ;IACA,OAAOY;AACT"}
1
+ {"version":3,"sources":["../../src/core/projects.ts"],"sourcesContent":["import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto';\nimport {\n PROJECT_CREATED,\n PROJECT_SOURCE_BOUND,\n type ProjectsEventMap,\n} from '@shipfox/api-projects-dto';\nimport {writeOutboxEvent} from '@shipfox/node-outbox';\nimport {and, eq} from 'drizzle-orm';\nimport {db} from '#db/db.js';\nimport {projectsOutbox} from '#db/schema/outbox.js';\nimport {projects, toProject} from '#db/schema/projects.js';\nimport {recordProjectCreated} from '#metrics/instance.js';\nimport type {Project} from './entities/project.js';\nimport {ProjectAlreadyExistsError} from './errors.js';\n\nexport interface CreateProjectFromSourceParams {\n actorId: string;\n workspaceId: string;\n name: string;\n sourceConnectionId: string;\n sourceExternalRepositoryId: string;\n integrations: IntegrationsModuleClient;\n}\n\nexport async function createProjectFromSource(\n params: CreateProjectFromSourceParams,\n): Promise<Project> {\n let source: {\n connection: {id: string; provider: string};\n repository: {externalRepositoryId: string};\n };\n source = await params.integrations.resolveSourceRepository({\n workspaceId: params.workspaceId,\n connectionId: params.sourceConnectionId,\n externalRepositoryId: params.sourceExternalRepositoryId,\n });\n\n const project = await db().transaction(async (tx) => {\n const [projectRow] = await tx\n .insert(projects)\n .values({\n workspaceId: params.workspaceId,\n sourceConnectionId: source.connection.id,\n sourceExternalRepositoryId: source.repository.externalRepositoryId,\n name: params.name,\n })\n .onConflictDoNothing({\n target: [projects.sourceConnectionId, projects.sourceExternalRepositoryId],\n })\n .returning();\n\n if (!projectRow) {\n const [existing] = await tx\n .select()\n .from(projects)\n .where(\n and(\n eq(projects.sourceConnectionId, source.connection.id),\n eq(projects.sourceExternalRepositoryId, source.repository.externalRepositoryId),\n ),\n )\n .limit(1);\n if (existing) {\n throw new ProjectAlreadyExistsError(\n existing.id,\n source.connection.id,\n source.repository.externalRepositoryId,\n );\n }\n throw new Error('Project insert returned no rows');\n }\n\n const project = toProject(projectRow);\n\n await writeOutboxEvent<ProjectsEventMap>(tx, projectsOutbox, {\n type: PROJECT_CREATED,\n payload: {\n actorId: params.actorId,\n workspaceId: project.workspaceId,\n projectId: project.id,\n sourceConnectionId: project.sourceConnectionId,\n sourceExternalRepositoryId: project.sourceExternalRepositoryId,\n },\n });\n await writeOutboxEvent<ProjectsEventMap>(tx, projectsOutbox, {\n type: PROJECT_SOURCE_BOUND,\n payload: {\n actorId: params.actorId,\n workspaceId: project.workspaceId,\n projectId: project.id,\n sourceConnectionId: project.sourceConnectionId,\n provider: source.connection.provider,\n externalRepositoryId: project.sourceExternalRepositoryId,\n },\n });\n\n return project;\n });\n recordProjectCreated();\n return project;\n}\n"],"names":["PROJECT_CREATED","PROJECT_SOURCE_BOUND","writeOutboxEvent","and","eq","db","projectsOutbox","projects","toProject","recordProjectCreated","ProjectAlreadyExistsError","createProjectFromSource","params","source","integrations","resolveSourceRepository","workspaceId","connectionId","sourceConnectionId","externalRepositoryId","sourceExternalRepositoryId","project","transaction","tx","projectRow","insert","values","connection","id","repository","name","onConflictDoNothing","target","returning","existing","select","from","where","limit","Error","type","payload","actorId","projectId","provider"],"mappings":"AACA,SACEA,eAAe,EACfC,oBAAoB,QAEf,4BAA4B;AACnC,SAAQC,gBAAgB,QAAO,uBAAuB;AACtD,SAAQC,GAAG,EAAEC,EAAE,QAAO,cAAc;AACpC,SAAQC,EAAE,QAAO,YAAY;AAC7B,SAAQC,cAAc,QAAO,uBAAuB;AACpD,SAAQC,QAAQ,EAAEC,SAAS,QAAO,yBAAyB;AAC3D,SAAQC,oBAAoB,QAAO,uBAAuB;AAE1D,SAAQC,yBAAyB,QAAO,cAAc;AAWtD,OAAO,eAAeC,wBACpBC,MAAqC;IAErC,IAAIC;IAIJA,SAAS,MAAMD,OAAOE,YAAY,CAACC,uBAAuB,CAAC;QACzDC,aAAaJ,OAAOI,WAAW;QAC/BC,cAAcL,OAAOM,kBAAkB;QACvCC,sBAAsBP,OAAOQ,0BAA0B;IACzD;IAEA,MAAMC,UAAU,MAAMhB,KAAKiB,WAAW,CAAC,OAAOC;QAC5C,MAAM,CAACC,WAAW,GAAG,MAAMD,GACxBE,MAAM,CAAClB,UACPmB,MAAM,CAAC;YACNV,aAAaJ,OAAOI,WAAW;YAC/BE,oBAAoBL,OAAOc,UAAU,CAACC,EAAE;YACxCR,4BAA4BP,OAAOgB,UAAU,CAACV,oBAAoB;YAClEW,MAAMlB,OAAOkB,IAAI;QACnB,GACCC,mBAAmB,CAAC;YACnBC,QAAQ;gBAACzB,SAASW,kBAAkB;gBAAEX,SAASa,0BAA0B;aAAC;QAC5E,GACCa,SAAS;QAEZ,IAAI,CAACT,YAAY;YACf,MAAM,CAACU,SAAS,GAAG,MAAMX,GACtBY,MAAM,GACNC,IAAI,CAAC7B,UACL8B,KAAK,CACJlC,IACEC,GAAGG,SAASW,kBAAkB,EAAEL,OAAOc,UAAU,CAACC,EAAE,GACpDxB,GAAGG,SAASa,0BAA0B,EAAEP,OAAOgB,UAAU,CAACV,oBAAoB,IAGjFmB,KAAK,CAAC;YACT,IAAIJ,UAAU;gBACZ,MAAM,IAAIxB,0BACRwB,SAASN,EAAE,EACXf,OAAOc,UAAU,CAACC,EAAE,EACpBf,OAAOgB,UAAU,CAACV,oBAAoB;YAE1C;YACA,MAAM,IAAIoB,MAAM;QAClB;QAEA,MAAMlB,UAAUb,UAAUgB;QAE1B,MAAMtB,iBAAmCqB,IAAIjB,gBAAgB;YAC3DkC,MAAMxC;YACNyC,SAAS;gBACPC,SAAS9B,OAAO8B,OAAO;gBACvB1B,aAAaK,QAAQL,WAAW;gBAChC2B,WAAWtB,QAAQO,EAAE;gBACrBV,oBAAoBG,QAAQH,kBAAkB;gBAC9CE,4BAA4BC,QAAQD,0BAA0B;YAChE;QACF;QACA,MAAMlB,iBAAmCqB,IAAIjB,gBAAgB;YAC3DkC,MAAMvC;YACNwC,SAAS;gBACPC,SAAS9B,OAAO8B,OAAO;gBACvB1B,aAAaK,QAAQL,WAAW;gBAChC2B,WAAWtB,QAAQO,EAAE;gBACrBV,oBAAoBG,QAAQH,kBAAkB;gBAC9C0B,UAAU/B,OAAOc,UAAU,CAACiB,QAAQ;gBACpCzB,sBAAsBE,QAAQD,0BAA0B;YAC1D;QACF;QAEA,OAAOC;IACT;IACAZ;IACA,OAAOY;AACT"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { IntegrationSourceControlService } from '@shipfox/api-integration-core';
1
+ import type { IntegrationsModuleClient } from '@shipfox/api-integration-core-dto';
2
2
  import { type ShipfoxModule } from '@shipfox/node-module';
3
3
  export type { Project } from '#core/index.js';
4
4
  export { createProjectFromSource, ProjectAccessDeniedError, ProjectAlreadyExistsError, ProjectNotFoundError, } from '#core/index.js';
@@ -6,7 +6,7 @@ export type { GetProjectBySourceParams } from '#db/index.js';
6
6
  export { createProject, db, getProjectById, getProjectBySource, listProjects, migrationsPath, projectsOutbox, requireProjectForWorkspace, } from '#db/index.js';
7
7
  export { createProjectRoutes, requireProjectAccess } from '#presentation/index.js';
8
8
  export interface CreateProjectsModuleOptions {
9
- sourceControl: IntegrationSourceControlService;
9
+ integrations: IntegrationsModuleClient;
10
10
  }
11
- export declare function createProjectsModule({ sourceControl }: CreateProjectsModuleOptions): ShipfoxModule;
11
+ export declare function createProjectsModule({ integrations }: CreateProjectsModuleOptions): ShipfoxModule;
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,+BAA+B,EAAC,MAAM,+BAA+B,CAAC;AAMnF,OAAO,EAAC,KAAK,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAc3E,YAAY,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAC,wBAAwB,EAAC,MAAM,cAAc,CAAC;AAC3D,OAAO,EACL,aAAa,EACb,EAAE,EACF,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,0BAA0B,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,mBAAmB,EAAE,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAEjF,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,+BAA+B,CAAC;CAChD;AAED,wBAAgB,oBAAoB,CAAC,EAAC,aAAa,EAAC,EAAE,2BAA2B,GAAG,aAAa,CAwBhG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,mCAAmC,CAAC;AAMhF,OAAO,EAAC,KAAK,aAAa,EAAoB,MAAM,sBAAsB,CAAC;AAe3E,YAAY,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAC,wBAAwB,EAAC,MAAM,cAAc,CAAC;AAC3D,OAAO,EACL,aAAa,EACb,EAAE,EACF,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,0BAA0B,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,mBAAmB,EAAE,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAEjF,MAAM,WAAW,2BAA2B;IAC1C,YAAY,EAAE,wBAAwB,CAAC;CACxC;AAED,wBAAgB,oBAAoB,CAAC,EAAC,YAAY,EAAC,EAAE,2BAA2B,GAAG,aAAa,CAyB/F"}
package/dist/index.js CHANGED
@@ -7,6 +7,7 @@ import { db, migrationsPath, projectsOutbox } from '#db/index.js';
7
7
  import { registerProjectsServiceMetrics } from '#metrics/index.js';
8
8
  import { projectsE2eRoutes } from '#presentation/e2eRoutes/index.js';
9
9
  import { createProjectRoutes } from '#presentation/index.js';
10
+ import { createProjectsInterModulePresentation } from '#presentation/inter-module.js';
10
11
  import { onSourceCommitPushed } from '#presentation/subscribers/index.js';
11
12
  import { createProjectsMaintenanceActivities } from '#temporal/activities/index.js';
12
13
  import { PROJECTS_MAINTENANCE_TASK_QUEUE } from '#temporal/constants.js';
@@ -16,14 +17,14 @@ const subscriber = subscriberFactory();
16
17
  export { createProjectFromSource, ProjectAccessDeniedError, ProjectAlreadyExistsError, ProjectNotFoundError } from '#core/index.js';
17
18
  export { createProject, db, getProjectById, getProjectBySource, listProjects, migrationsPath, projectsOutbox, requireProjectForWorkspace } from '#db/index.js';
18
19
  export { createProjectRoutes, requireProjectAccess } from '#presentation/index.js';
19
- export function createProjectsModule({ sourceControl }) {
20
+ export function createProjectsModule({ integrations }) {
20
21
  return {
21
22
  name: 'projects',
22
23
  database: {
23
24
  db,
24
25
  migrationsPath
25
26
  },
26
- routes: createProjectRoutes(sourceControl),
27
+ routes: createProjectRoutes(integrations),
27
28
  e2eRoutes: [
28
29
  projectsE2eRoutes
29
30
  ],
@@ -36,6 +37,9 @@ export function createProjectsModule({ sourceControl }) {
36
37
  eventSchemas: projectsEventSchemas
37
38
  }
38
39
  ],
40
+ interModulePresentations: [
41
+ createProjectsInterModulePresentation()
42
+ ],
39
43
  subscribers: [
40
44
  subscriber(INTEGRATION_SOURCE_COMMIT_PUSHED, onSourceCommitPushed)
41
45
  ],
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {dirname, resolve} from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport type {IntegrationSourceControlService} from '@shipfox/api-integration-core';\nimport {\n INTEGRATION_SOURCE_COMMIT_PUSHED,\n type IntegrationsEventMap,\n} from '@shipfox/api-integration-core-dto';\nimport {projectsEventSchemas} from '@shipfox/api-projects-dto';\nimport {type ShipfoxModule, subscriberFactory} from '@shipfox/node-module';\nimport {db, migrationsPath, projectsOutbox} from '#db/index.js';\nimport {registerProjectsServiceMetrics} from '#metrics/index.js';\nimport {projectsE2eRoutes} from '#presentation/e2eRoutes/index.js';\nimport {createProjectRoutes} from '#presentation/index.js';\nimport {onSourceCommitPushed} from '#presentation/subscribers/index.js';\nimport {createProjectsMaintenanceActivities} from '#temporal/activities/index.js';\nimport {PROJECTS_MAINTENANCE_TASK_QUEUE} from '#temporal/constants.js';\n\nconst packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');\nconst maintenanceWorkflowsPath = resolve(packageRoot, 'dist/temporal/workflows/index.js');\n\nconst subscriber = subscriberFactory<IntegrationsEventMap>();\n\nexport type {Project} from '#core/index.js';\nexport {\n createProjectFromSource,\n ProjectAccessDeniedError,\n ProjectAlreadyExistsError,\n ProjectNotFoundError,\n} from '#core/index.js';\nexport type {GetProjectBySourceParams} from '#db/index.js';\nexport {\n createProject,\n db,\n getProjectById,\n getProjectBySource,\n listProjects,\n migrationsPath,\n projectsOutbox,\n requireProjectForWorkspace,\n} from '#db/index.js';\nexport {createProjectRoutes, requireProjectAccess} from '#presentation/index.js';\n\nexport interface CreateProjectsModuleOptions {\n sourceControl: IntegrationSourceControlService;\n}\n\nexport function createProjectsModule({sourceControl}: CreateProjectsModuleOptions): ShipfoxModule {\n return {\n name: 'projects',\n database: {db, migrationsPath},\n routes: createProjectRoutes(sourceControl),\n e2eRoutes: [projectsE2eRoutes],\n metrics: registerProjectsServiceMetrics,\n publishers: [{name: 'projects', table: projectsOutbox, db, eventSchemas: projectsEventSchemas}],\n subscribers: [subscriber(INTEGRATION_SOURCE_COMMIT_PUSHED, onSourceCommitPushed)],\n workers: [\n {\n taskQueue: PROJECTS_MAINTENANCE_TASK_QUEUE,\n workflowsPath: maintenanceWorkflowsPath,\n activities: createProjectsMaintenanceActivities,\n workflows: [\n {\n name: 'pruneIntegrationEventDedupCron',\n id: 'projects-prune-integration-event-dedup',\n cronSchedule: '0 3 * * *',\n },\n ],\n },\n ],\n };\n}\n"],"names":["dirname","resolve","fileURLToPath","INTEGRATION_SOURCE_COMMIT_PUSHED","projectsEventSchemas","subscriberFactory","db","migrationsPath","projectsOutbox","registerProjectsServiceMetrics","projectsE2eRoutes","createProjectRoutes","onSourceCommitPushed","createProjectsMaintenanceActivities","PROJECTS_MAINTENANCE_TASK_QUEUE","packageRoot","url","maintenanceWorkflowsPath","subscriber","createProjectFromSource","ProjectAccessDeniedError","ProjectAlreadyExistsError","ProjectNotFoundError","createProject","getProjectById","getProjectBySource","listProjects","requireProjectForWorkspace","requireProjectAccess","createProjectsModule","sourceControl","name","database","routes","e2eRoutes","metrics","publishers","table","eventSchemas","subscribers","workers","taskQueue","workflowsPath","activities","workflows","id","cronSchedule"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,OAAO,QAAO,YAAY;AAC3C,SAAQC,aAAa,QAAO,WAAW;AAEvC,SACEC,gCAAgC,QAE3B,oCAAoC;AAC3C,SAAQC,oBAAoB,QAAO,4BAA4B;AAC/D,SAA4BC,iBAAiB,QAAO,uBAAuB;AAC3E,SAAQC,EAAE,EAAEC,cAAc,EAAEC,cAAc,QAAO,eAAe;AAChE,SAAQC,8BAA8B,QAAO,oBAAoB;AACjE,SAAQC,iBAAiB,QAAO,mCAAmC;AACnE,SAAQC,mBAAmB,QAAO,yBAAyB;AAC3D,SAAQC,oBAAoB,QAAO,qCAAqC;AACxE,SAAQC,mCAAmC,QAAO,gCAAgC;AAClF,SAAQC,+BAA+B,QAAO,yBAAyB;AAEvE,MAAMC,cAAcd,QAAQD,QAAQE,cAAc,YAAYc,GAAG,IAAI;AACrE,MAAMC,2BAA2BhB,QAAQc,aAAa;AAEtD,MAAMG,aAAab;AAGnB,SACEc,uBAAuB,EACvBC,wBAAwB,EACxBC,yBAAyB,EACzBC,oBAAoB,QACf,iBAAiB;AAExB,SACEC,aAAa,EACbjB,EAAE,EACFkB,cAAc,EACdC,kBAAkB,EAClBC,YAAY,EACZnB,cAAc,EACdC,cAAc,EACdmB,0BAA0B,QACrB,eAAe;AACtB,SAAQhB,mBAAmB,EAAEiB,oBAAoB,QAAO,yBAAyB;AAMjF,OAAO,SAASC,qBAAqB,EAACC,aAAa,EAA8B;IAC/E,OAAO;QACLC,MAAM;QACNC,UAAU;YAAC1B;YAAIC;QAAc;QAC7B0B,QAAQtB,oBAAoBmB;QAC5BI,WAAW;YAACxB;SAAkB;QAC9ByB,SAAS1B;QACT2B,YAAY;YAAC;gBAACL,MAAM;gBAAYM,OAAO7B;gBAAgBF;gBAAIgC,cAAclC;YAAoB;SAAE;QAC/FmC,aAAa;YAACrB,WAAWf,kCAAkCS;SAAsB;QACjF4B,SAAS;YACP;gBACEC,WAAW3B;gBACX4B,eAAezB;gBACf0B,YAAY9B;gBACZ+B,WAAW;oBACT;wBACEb,MAAM;wBACNc,IAAI;wBACJC,cAAc;oBAChB;iBACD;YACH;SACD;IACH;AACF"}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {dirname, resolve} from 'node:path';\nimport {fileURLToPath} from 'node:url';\nimport type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto';\nimport {\n INTEGRATION_SOURCE_COMMIT_PUSHED,\n type IntegrationsEventMap,\n} from '@shipfox/api-integration-core-dto';\nimport {projectsEventSchemas} from '@shipfox/api-projects-dto';\nimport {type ShipfoxModule, subscriberFactory} from '@shipfox/node-module';\nimport {db, migrationsPath, projectsOutbox} from '#db/index.js';\nimport {registerProjectsServiceMetrics} from '#metrics/index.js';\nimport {projectsE2eRoutes} from '#presentation/e2eRoutes/index.js';\nimport {createProjectRoutes} from '#presentation/index.js';\nimport {createProjectsInterModulePresentation} from '#presentation/inter-module.js';\nimport {onSourceCommitPushed} from '#presentation/subscribers/index.js';\nimport {createProjectsMaintenanceActivities} from '#temporal/activities/index.js';\nimport {PROJECTS_MAINTENANCE_TASK_QUEUE} from '#temporal/constants.js';\n\nconst packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');\nconst maintenanceWorkflowsPath = resolve(packageRoot, 'dist/temporal/workflows/index.js');\n\nconst subscriber = subscriberFactory<IntegrationsEventMap>();\n\nexport type {Project} from '#core/index.js';\nexport {\n createProjectFromSource,\n ProjectAccessDeniedError,\n ProjectAlreadyExistsError,\n ProjectNotFoundError,\n} from '#core/index.js';\nexport type {GetProjectBySourceParams} from '#db/index.js';\nexport {\n createProject,\n db,\n getProjectById,\n getProjectBySource,\n listProjects,\n migrationsPath,\n projectsOutbox,\n requireProjectForWorkspace,\n} from '#db/index.js';\nexport {createProjectRoutes, requireProjectAccess} from '#presentation/index.js';\n\nexport interface CreateProjectsModuleOptions {\n integrations: IntegrationsModuleClient;\n}\n\nexport function createProjectsModule({integrations}: CreateProjectsModuleOptions): ShipfoxModule {\n return {\n name: 'projects',\n database: {db, migrationsPath},\n routes: createProjectRoutes(integrations),\n e2eRoutes: [projectsE2eRoutes],\n metrics: registerProjectsServiceMetrics,\n publishers: [{name: 'projects', table: projectsOutbox, db, eventSchemas: projectsEventSchemas}],\n interModulePresentations: [createProjectsInterModulePresentation()],\n subscribers: [subscriber(INTEGRATION_SOURCE_COMMIT_PUSHED, onSourceCommitPushed)],\n workers: [\n {\n taskQueue: PROJECTS_MAINTENANCE_TASK_QUEUE,\n workflowsPath: maintenanceWorkflowsPath,\n activities: createProjectsMaintenanceActivities,\n workflows: [\n {\n name: 'pruneIntegrationEventDedupCron',\n id: 'projects-prune-integration-event-dedup',\n cronSchedule: '0 3 * * *',\n },\n ],\n },\n ],\n };\n}\n"],"names":["dirname","resolve","fileURLToPath","INTEGRATION_SOURCE_COMMIT_PUSHED","projectsEventSchemas","subscriberFactory","db","migrationsPath","projectsOutbox","registerProjectsServiceMetrics","projectsE2eRoutes","createProjectRoutes","createProjectsInterModulePresentation","onSourceCommitPushed","createProjectsMaintenanceActivities","PROJECTS_MAINTENANCE_TASK_QUEUE","packageRoot","url","maintenanceWorkflowsPath","subscriber","createProjectFromSource","ProjectAccessDeniedError","ProjectAlreadyExistsError","ProjectNotFoundError","createProject","getProjectById","getProjectBySource","listProjects","requireProjectForWorkspace","requireProjectAccess","createProjectsModule","integrations","name","database","routes","e2eRoutes","metrics","publishers","table","eventSchemas","interModulePresentations","subscribers","workers","taskQueue","workflowsPath","activities","workflows","id","cronSchedule"],"mappings":"AAAA,SAAQA,OAAO,EAAEC,OAAO,QAAO,YAAY;AAC3C,SAAQC,aAAa,QAAO,WAAW;AAEvC,SACEC,gCAAgC,QAE3B,oCAAoC;AAC3C,SAAQC,oBAAoB,QAAO,4BAA4B;AAC/D,SAA4BC,iBAAiB,QAAO,uBAAuB;AAC3E,SAAQC,EAAE,EAAEC,cAAc,EAAEC,cAAc,QAAO,eAAe;AAChE,SAAQC,8BAA8B,QAAO,oBAAoB;AACjE,SAAQC,iBAAiB,QAAO,mCAAmC;AACnE,SAAQC,mBAAmB,QAAO,yBAAyB;AAC3D,SAAQC,qCAAqC,QAAO,gCAAgC;AACpF,SAAQC,oBAAoB,QAAO,qCAAqC;AACxE,SAAQC,mCAAmC,QAAO,gCAAgC;AAClF,SAAQC,+BAA+B,QAAO,yBAAyB;AAEvE,MAAMC,cAAcf,QAAQD,QAAQE,cAAc,YAAYe,GAAG,IAAI;AACrE,MAAMC,2BAA2BjB,QAAQe,aAAa;AAEtD,MAAMG,aAAad;AAGnB,SACEe,uBAAuB,EACvBC,wBAAwB,EACxBC,yBAAyB,EACzBC,oBAAoB,QACf,iBAAiB;AAExB,SACEC,aAAa,EACblB,EAAE,EACFmB,cAAc,EACdC,kBAAkB,EAClBC,YAAY,EACZpB,cAAc,EACdC,cAAc,EACdoB,0BAA0B,QACrB,eAAe;AACtB,SAAQjB,mBAAmB,EAAEkB,oBAAoB,QAAO,yBAAyB;AAMjF,OAAO,SAASC,qBAAqB,EAACC,YAAY,EAA8B;IAC9E,OAAO;QACLC,MAAM;QACNC,UAAU;YAAC3B;YAAIC;QAAc;QAC7B2B,QAAQvB,oBAAoBoB;QAC5BI,WAAW;YAACzB;SAAkB;QAC9B0B,SAAS3B;QACT4B,YAAY;YAAC;gBAACL,MAAM;gBAAYM,OAAO9B;gBAAgBF;gBAAIiC,cAAcnC;YAAoB;SAAE;QAC/FoC,0BAA0B;YAAC5B;SAAwC;QACnE6B,aAAa;YAACtB,WAAWhB,kCAAkCU;SAAsB;QACjF6B,SAAS;YACP;gBACEC,WAAW5B;gBACX6B,eAAe1B;gBACf2B,YAAY/B;gBACZgC,WAAW;oBACT;wBACEd,MAAM;wBACNe,IAAI;wBACJC,cAAc;oBAChB;iBACD;YACH;SACD;IACH;AACF"}
@@ -0,0 +1,4 @@
1
+ import { projectsInterModuleContract } from '@shipfox/api-projects-dto';
2
+ import { type InterModulePresentation } from '@shipfox/inter-module';
3
+ export declare function createProjectsInterModulePresentation(): InterModulePresentation<typeof projectsInterModuleContract>;
4
+ //# sourceMappingURL=inter-module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inter-module.d.ts","sourceRoot":"","sources":["../../src/presentation/inter-module.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,2BAA2B,EAAC,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,uBAAuB,CAAC;AAG/B,wBAAgB,qCAAqC,IAAI,uBAAuB,CAC9E,OAAO,2BAA2B,CACnC,CAsBA"}
@@ -0,0 +1,29 @@
1
+ import { projectsInterModuleContract } from '@shipfox/api-projects-dto';
2
+ import { createInterModuleKnownError, defineInterModulePresentation } from '@shipfox/inter-module';
3
+ import { getProjectById } from '#db/projects.js';
4
+ export function createProjectsInterModulePresentation() {
5
+ return defineInterModulePresentation(projectsInterModuleContract, {
6
+ getProjectById: async ({ projectId })=>({
7
+ project: await getProjectById(projectId) ?? null
8
+ }),
9
+ requireProjectForWorkspace: async ({ projectId, workspaceId })=>{
10
+ const project = await getProjectById(projectId);
11
+ if (project === undefined) {
12
+ throw createInterModuleKnownError(projectsInterModuleContract.methods.requireProjectForWorkspace, 'project-not-found', {
13
+ projectId
14
+ });
15
+ }
16
+ if (project.workspaceId !== workspaceId) {
17
+ throw createInterModuleKnownError(projectsInterModuleContract.methods.requireProjectForWorkspace, 'project-workspace-mismatch', {
18
+ projectId,
19
+ workspaceId
20
+ });
21
+ }
22
+ return {
23
+ project
24
+ };
25
+ }
26
+ });
27
+ }
28
+
29
+ //# sourceMappingURL=inter-module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/presentation/inter-module.ts"],"sourcesContent":["import {projectsInterModuleContract} from '@shipfox/api-projects-dto';\nimport {\n createInterModuleKnownError,\n defineInterModulePresentation,\n type InterModulePresentation,\n} from '@shipfox/inter-module';\nimport {getProjectById} from '#db/projects.js';\n\nexport function createProjectsInterModulePresentation(): InterModulePresentation<\n typeof projectsInterModuleContract\n> {\n return defineInterModulePresentation(projectsInterModuleContract, {\n getProjectById: async ({projectId}) => ({project: (await getProjectById(projectId)) ?? null}),\n requireProjectForWorkspace: async ({projectId, workspaceId}) => {\n const project = await getProjectById(projectId);\n if (project === undefined) {\n throw createInterModuleKnownError(\n projectsInterModuleContract.methods.requireProjectForWorkspace,\n 'project-not-found',\n {projectId},\n );\n }\n if (project.workspaceId !== workspaceId) {\n throw createInterModuleKnownError(\n projectsInterModuleContract.methods.requireProjectForWorkspace,\n 'project-workspace-mismatch',\n {projectId, workspaceId},\n );\n }\n return {project};\n },\n });\n}\n"],"names":["projectsInterModuleContract","createInterModuleKnownError","defineInterModulePresentation","getProjectById","createProjectsInterModulePresentation","projectId","project","requireProjectForWorkspace","workspaceId","undefined","methods"],"mappings":"AAAA,SAAQA,2BAA2B,QAAO,4BAA4B;AACtE,SACEC,2BAA2B,EAC3BC,6BAA6B,QAExB,wBAAwB;AAC/B,SAAQC,cAAc,QAAO,kBAAkB;AAE/C,OAAO,SAASC;IAGd,OAAOF,8BAA8BF,6BAA6B;QAChEG,gBAAgB,OAAO,EAACE,SAAS,EAAC,GAAM,CAAA;gBAACC,SAAS,AAAC,MAAMH,eAAeE,cAAe;YAAI,CAAA;QAC3FE,4BAA4B,OAAO,EAACF,SAAS,EAAEG,WAAW,EAAC;YACzD,MAAMF,UAAU,MAAMH,eAAeE;YACrC,IAAIC,YAAYG,WAAW;gBACzB,MAAMR,4BACJD,4BAA4BU,OAAO,CAACH,0BAA0B,EAC9D,qBACA;oBAACF;gBAAS;YAEd;YACA,IAAIC,QAAQE,WAAW,KAAKA,aAAa;gBACvC,MAAMP,4BACJD,4BAA4BU,OAAO,CAACH,0BAA0B,EAC9D,8BACA;oBAACF;oBAAWG;gBAAW;YAE3B;YACA,OAAO;gBAACF;YAAO;QACjB;IACF;AACF"}
@@ -1,3 +1,3 @@
1
- import { type IntegrationSourceControlService } from '@shipfox/api-integration-core';
2
- export declare function createProjectRoute(sourceControl: IntegrationSourceControlService): import("@shipfox/node-fastify").RouteDefinition;
1
+ import { type IntegrationsModuleClient } from '@shipfox/api-integration-core-dto';
2
+ export declare function createProjectRoute(integrations: IntegrationsModuleClient): import("@shipfox/node-fastify").RouteDefinition;
3
3
  //# sourceMappingURL=create-project.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-project.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/create-project.ts"],"names":[],"mappings":"AACA,OAAO,EAQL,KAAK,+BAA+B,EACrC,MAAM,+BAA+B,CAAC;AA2BvC,wBAAgB,kBAAkB,CAAC,aAAa,EAAE,+BAA+B,mDAgEhF"}
1
+ {"version":3,"file":"create-project.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/create-project.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,wBAAwB,EAE9B,MAAM,mCAAmC,CAAC;AAa3C,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,wBAAwB,mDAoFxE"}
@@ -1,6 +1,7 @@
1
1
  import { AUTH_USER, requireUserContext, requireWorkspaceAccess } from '@shipfox/api-auth-context';
2
- import { IntegrationCapabilityUnavailableError, IntegrationConnectionInactiveError, IntegrationConnectionNotFoundError, IntegrationConnectionWorkspaceMismatchError, IntegrationProviderError, IntegrationProviderUnavailableError } from '@shipfox/api-integration-core';
2
+ import { integrationsInterModuleContract } from '@shipfox/api-integration-core-dto';
3
3
  import { createProjectBodySchema, projectResponseSchema } from '@shipfox/api-projects-dto';
4
+ import { isInterModuleKnownError } from '@shipfox/inter-module';
4
5
  import { ClientError, defineRoute } from '@shipfox/node-fastify';
5
6
  import { createProjectFromSource, ProjectAlreadyExistsError } from '#core/index.js';
6
7
  import { toProjectDto } from '#presentation/dto/index.js';
@@ -9,10 +10,7 @@ function providerStatus(reason) {
9
10
  if (reason === 'timeout' || reason === 'provider-unavailable') return 503;
10
11
  return 422;
11
12
  }
12
- function isProviderError(error) {
13
- return error instanceof IntegrationProviderError || error instanceof Error && 'reason' in error && typeof error.reason === 'string' && (error.reason === 'repository-not-found' || error.reason === 'access-denied' || error.reason === 'rate-limited' || error.reason === 'timeout' || error.reason === 'provider-unavailable' || error.reason === 'malformed-provider-response');
14
- }
15
- export function createProjectRoute(sourceControl) {
13
+ export function createProjectRoute(integrations) {
16
14
  return defineRoute({
17
15
  method: 'POST',
18
16
  path: '/',
@@ -25,28 +23,29 @@ export function createProjectRoute(sourceControl) {
25
23
  }
26
24
  },
27
25
  errorHandler: (error)=>{
28
- if (error instanceof IntegrationConnectionNotFoundError) {
29
- throw new ClientError(error.message, 'source-connection-not-found', {
26
+ const known = isInterModuleKnownError(integrationsInterModuleContract.methods.resolveSourceRepository, error) ? error : undefined;
27
+ if (known?.code === 'connection-not-found') {
28
+ throw new ClientError('Source connection not found', 'source-connection-not-found', {
30
29
  status: 404
31
30
  });
32
31
  }
33
- if (error instanceof IntegrationConnectionWorkspaceMismatchError) {
34
- throw new ClientError(error.message, 'forbidden', {
32
+ if (known?.code === 'connection-workspace-mismatch') {
33
+ throw new ClientError('Source connection does not belong to this workspace', 'forbidden', {
35
34
  status: 403
36
35
  });
37
36
  }
38
- if (error instanceof IntegrationConnectionInactiveError) {
39
- throw new ClientError(error.message, 'source-connection-inactive', {
37
+ if (known?.code === 'connection-inactive') {
38
+ throw new ClientError('Source connection is not active', 'source-connection-inactive', {
40
39
  status: 422
41
40
  });
42
41
  }
43
- if (error instanceof IntegrationProviderUnavailableError) {
44
- throw new ClientError(error.message, 'integration-provider-unavailable', {
42
+ if (known?.code === 'provider-unavailable') {
43
+ throw new ClientError('Integration provider is unavailable', 'integration-provider-unavailable', {
45
44
  status: 422
46
45
  });
47
46
  }
48
- if (error instanceof IntegrationCapabilityUnavailableError) {
49
- throw new ClientError(error.message, 'integration-capability-unavailable', {
47
+ if (known?.code === 'capability-unavailable') {
48
+ throw new ClientError('Integration capability is unavailable', 'integration-capability-unavailable', {
50
49
  status: 422
51
50
  });
52
51
  }
@@ -60,12 +59,12 @@ export function createProjectRoute(sourceControl) {
60
59
  status: 409
61
60
  });
62
61
  }
63
- if (isProviderError(error)) {
64
- throw new ClientError(error.message, error.reason, {
62
+ if (known?.code === 'provider-failure') {
63
+ throw new ClientError('Integration provider request failed', known.details.reason, {
65
64
  details: {
66
- retry_after_seconds: error.retryAfterSeconds
65
+ retry_after_seconds: known.details.retryAfterSeconds
67
66
  },
68
- status: providerStatus(error.reason)
67
+ status: providerStatus(known.details.reason)
69
68
  });
70
69
  }
71
70
  throw error;
@@ -83,7 +82,7 @@ export function createProjectRoute(sourceControl) {
83
82
  name,
84
83
  sourceConnectionId: source.connection_id,
85
84
  sourceExternalRepositoryId: source.external_repository_id,
86
- sourceControl
85
+ integrations
87
86
  });
88
87
  reply.status(201);
89
88
  return toProjectDto(project);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/presentation/routes/create-project.ts"],"sourcesContent":["import {AUTH_USER, requireUserContext, requireWorkspaceAccess} from '@shipfox/api-auth-context';\nimport {\n IntegrationCapabilityUnavailableError,\n IntegrationConnectionInactiveError,\n IntegrationConnectionNotFoundError,\n IntegrationConnectionWorkspaceMismatchError,\n IntegrationProviderError,\n type IntegrationProviderErrorReason,\n IntegrationProviderUnavailableError,\n type IntegrationSourceControlService,\n} from '@shipfox/api-integration-core';\nimport {createProjectBodySchema, projectResponseSchema} from '@shipfox/api-projects-dto';\nimport {ClientError, defineRoute} from '@shipfox/node-fastify';\nimport {createProjectFromSource, ProjectAlreadyExistsError} from '#core/index.js';\nimport {toProjectDto} from '#presentation/dto/index.js';\n\nfunction providerStatus(reason: IntegrationProviderErrorReason): number {\n if (reason === 'rate-limited') return 429;\n if (reason === 'timeout' || reason === 'provider-unavailable') return 503;\n return 422;\n}\n\nfunction isProviderError(error: unknown): error is IntegrationProviderError {\n return (\n error instanceof IntegrationProviderError ||\n (error instanceof Error &&\n 'reason' in error &&\n typeof error.reason === 'string' &&\n (error.reason === 'repository-not-found' ||\n error.reason === 'access-denied' ||\n error.reason === 'rate-limited' ||\n error.reason === 'timeout' ||\n error.reason === 'provider-unavailable' ||\n error.reason === 'malformed-provider-response'))\n );\n}\n\nexport function createProjectRoute(sourceControl: IntegrationSourceControlService) {\n return defineRoute({\n method: 'POST',\n path: '/',\n auth: AUTH_USER,\n description: 'Create a project bound to a source repository.',\n schema: {\n body: createProjectBodySchema,\n response: {\n 201: projectResponseSchema,\n },\n },\n errorHandler: (error) => {\n if (error instanceof IntegrationConnectionNotFoundError) {\n throw new ClientError(error.message, 'source-connection-not-found', {status: 404});\n }\n if (error instanceof IntegrationConnectionWorkspaceMismatchError) {\n throw new ClientError(error.message, 'forbidden', {status: 403});\n }\n if (error instanceof IntegrationConnectionInactiveError) {\n throw new ClientError(error.message, 'source-connection-inactive', {status: 422});\n }\n if (error instanceof IntegrationProviderUnavailableError) {\n throw new ClientError(error.message, 'integration-provider-unavailable', {status: 422});\n }\n if (error instanceof IntegrationCapabilityUnavailableError) {\n throw new ClientError(error.message, 'integration-capability-unavailable', {status: 422});\n }\n if (error instanceof ProjectAlreadyExistsError) {\n throw new ClientError(error.message, 'project-already-exists', {\n details: {\n existing_project_id: error.existingProjectId,\n source_connection_id: error.sourceConnectionId,\n source_external_repository_id: error.sourceExternalRepositoryId,\n },\n status: 409,\n });\n }\n if (isProviderError(error)) {\n throw new ClientError(error.message, error.reason, {\n details: {retry_after_seconds: error.retryAfterSeconds},\n status: providerStatus(error.reason),\n });\n }\n throw error;\n },\n handler: async (request, reply) => {\n const {workspace_id: workspaceId, name, source} = request.body;\n const actor = requireUserContext(request);\n\n requireWorkspaceAccess({request, workspaceId});\n const project = await createProjectFromSource({\n actorId: actor.userId,\n workspaceId,\n name,\n sourceConnectionId: source.connection_id,\n sourceExternalRepositoryId: source.external_repository_id,\n sourceControl,\n });\n\n reply.status(201);\n return toProjectDto(project);\n },\n });\n}\n"],"names":["AUTH_USER","requireUserContext","requireWorkspaceAccess","IntegrationCapabilityUnavailableError","IntegrationConnectionInactiveError","IntegrationConnectionNotFoundError","IntegrationConnectionWorkspaceMismatchError","IntegrationProviderError","IntegrationProviderUnavailableError","createProjectBodySchema","projectResponseSchema","ClientError","defineRoute","createProjectFromSource","ProjectAlreadyExistsError","toProjectDto","providerStatus","reason","isProviderError","error","Error","createProjectRoute","sourceControl","method","path","auth","description","schema","body","response","errorHandler","message","status","details","existing_project_id","existingProjectId","source_connection_id","sourceConnectionId","source_external_repository_id","sourceExternalRepositoryId","retry_after_seconds","retryAfterSeconds","handler","request","reply","workspace_id","workspaceId","name","source","actor","project","actorId","userId","connection_id","external_repository_id"],"mappings":"AAAA,SAAQA,SAAS,EAAEC,kBAAkB,EAAEC,sBAAsB,QAAO,4BAA4B;AAChG,SACEC,qCAAqC,EACrCC,kCAAkC,EAClCC,kCAAkC,EAClCC,2CAA2C,EAC3CC,wBAAwB,EAExBC,mCAAmC,QAE9B,gCAAgC;AACvC,SAAQC,uBAAuB,EAAEC,qBAAqB,QAAO,4BAA4B;AACzF,SAAQC,WAAW,EAAEC,WAAW,QAAO,wBAAwB;AAC/D,SAAQC,uBAAuB,EAAEC,yBAAyB,QAAO,iBAAiB;AAClF,SAAQC,YAAY,QAAO,6BAA6B;AAExD,SAASC,eAAeC,MAAsC;IAC5D,IAAIA,WAAW,gBAAgB,OAAO;IACtC,IAAIA,WAAW,aAAaA,WAAW,wBAAwB,OAAO;IACtE,OAAO;AACT;AAEA,SAASC,gBAAgBC,KAAc;IACrC,OACEA,iBAAiBZ,4BAChBY,iBAAiBC,SAChB,YAAYD,SACZ,OAAOA,MAAMF,MAAM,KAAK,YACvBE,CAAAA,MAAMF,MAAM,KAAK,0BAChBE,MAAMF,MAAM,KAAK,mBACjBE,MAAMF,MAAM,KAAK,kBACjBE,MAAMF,MAAM,KAAK,aACjBE,MAAMF,MAAM,KAAK,0BACjBE,MAAMF,MAAM,KAAK,6BAA4B;AAErD;AAEA,OAAO,SAASI,mBAAmBC,aAA8C;IAC/E,OAAOV,YAAY;QACjBW,QAAQ;QACRC,MAAM;QACNC,MAAMzB;QACN0B,aAAa;QACbC,QAAQ;YACNC,MAAMnB;YACNoB,UAAU;gBACR,KAAKnB;YACP;QACF;QACAoB,cAAc,CAACX;YACb,IAAIA,iBAAiBd,oCAAoC;gBACvD,MAAM,IAAIM,YAAYQ,MAAMY,OAAO,EAAE,+BAA+B;oBAACC,QAAQ;gBAAG;YAClF;YACA,IAAIb,iBAAiBb,6CAA6C;gBAChE,MAAM,IAAIK,YAAYQ,MAAMY,OAAO,EAAE,aAAa;oBAACC,QAAQ;gBAAG;YAChE;YACA,IAAIb,iBAAiBf,oCAAoC;gBACvD,MAAM,IAAIO,YAAYQ,MAAMY,OAAO,EAAE,8BAA8B;oBAACC,QAAQ;gBAAG;YACjF;YACA,IAAIb,iBAAiBX,qCAAqC;gBACxD,MAAM,IAAIG,YAAYQ,MAAMY,OAAO,EAAE,oCAAoC;oBAACC,QAAQ;gBAAG;YACvF;YACA,IAAIb,iBAAiBhB,uCAAuC;gBAC1D,MAAM,IAAIQ,YAAYQ,MAAMY,OAAO,EAAE,sCAAsC;oBAACC,QAAQ;gBAAG;YACzF;YACA,IAAIb,iBAAiBL,2BAA2B;gBAC9C,MAAM,IAAIH,YAAYQ,MAAMY,OAAO,EAAE,0BAA0B;oBAC7DE,SAAS;wBACPC,qBAAqBf,MAAMgB,iBAAiB;wBAC5CC,sBAAsBjB,MAAMkB,kBAAkB;wBAC9CC,+BAA+BnB,MAAMoB,0BAA0B;oBACjE;oBACAP,QAAQ;gBACV;YACF;YACA,IAAId,gBAAgBC,QAAQ;gBAC1B,MAAM,IAAIR,YAAYQ,MAAMY,OAAO,EAAEZ,MAAMF,MAAM,EAAE;oBACjDgB,SAAS;wBAACO,qBAAqBrB,MAAMsB,iBAAiB;oBAAA;oBACtDT,QAAQhB,eAAeG,MAAMF,MAAM;gBACrC;YACF;YACA,MAAME;QACR;QACAuB,SAAS,OAAOC,SAASC;YACvB,MAAM,EAACC,cAAcC,WAAW,EAAEC,IAAI,EAAEC,MAAM,EAAC,GAAGL,QAAQf,IAAI;YAC9D,MAAMqB,QAAQhD,mBAAmB0C;YAEjCzC,uBAAuB;gBAACyC;gBAASG;YAAW;YAC5C,MAAMI,UAAU,MAAMrC,wBAAwB;gBAC5CsC,SAASF,MAAMG,MAAM;gBACrBN;gBACAC;gBACAV,oBAAoBW,OAAOK,aAAa;gBACxCd,4BAA4BS,OAAOM,sBAAsB;gBACzDhC;YACF;YAEAsB,MAAMZ,MAAM,CAAC;YACb,OAAOjB,aAAamC;QACtB;IACF;AACF"}
1
+ {"version":3,"sources":["../../../src/presentation/routes/create-project.ts"],"sourcesContent":["import {AUTH_USER, requireUserContext, requireWorkspaceAccess} from '@shipfox/api-auth-context';\nimport {\n type IntegrationsModuleClient,\n integrationsInterModuleContract,\n} from '@shipfox/api-integration-core-dto';\nimport {createProjectBodySchema, projectResponseSchema} from '@shipfox/api-projects-dto';\nimport {isInterModuleKnownError} from '@shipfox/inter-module';\nimport {ClientError, defineRoute} from '@shipfox/node-fastify';\nimport {createProjectFromSource, ProjectAlreadyExistsError} from '#core/index.js';\nimport {toProjectDto} from '#presentation/dto/index.js';\n\nfunction providerStatus(reason: string): number {\n if (reason === 'rate-limited') return 429;\n if (reason === 'timeout' || reason === 'provider-unavailable') return 503;\n return 422;\n}\n\nexport function createProjectRoute(integrations: IntegrationsModuleClient) {\n return defineRoute({\n method: 'POST',\n path: '/',\n auth: AUTH_USER,\n description: 'Create a project bound to a source repository.',\n schema: {\n body: createProjectBodySchema,\n response: {\n 201: projectResponseSchema,\n },\n },\n errorHandler: (error) => {\n const known = isInterModuleKnownError(\n integrationsInterModuleContract.methods.resolveSourceRepository,\n error,\n )\n ? error\n : undefined;\n if (known?.code === 'connection-not-found') {\n throw new ClientError('Source connection not found', 'source-connection-not-found', {\n status: 404,\n });\n }\n if (known?.code === 'connection-workspace-mismatch') {\n throw new ClientError('Source connection does not belong to this workspace', 'forbidden', {\n status: 403,\n });\n }\n if (known?.code === 'connection-inactive') {\n throw new ClientError('Source connection is not active', 'source-connection-inactive', {\n status: 422,\n });\n }\n if (known?.code === 'provider-unavailable') {\n throw new ClientError(\n 'Integration provider is unavailable',\n 'integration-provider-unavailable',\n {status: 422},\n );\n }\n if (known?.code === 'capability-unavailable') {\n throw new ClientError(\n 'Integration capability is unavailable',\n 'integration-capability-unavailable',\n {status: 422},\n );\n }\n if (error instanceof ProjectAlreadyExistsError) {\n throw new ClientError(error.message, 'project-already-exists', {\n details: {\n existing_project_id: error.existingProjectId,\n source_connection_id: error.sourceConnectionId,\n source_external_repository_id: error.sourceExternalRepositoryId,\n },\n status: 409,\n });\n }\n if (known?.code === 'provider-failure') {\n throw new ClientError('Integration provider request failed', known.details.reason, {\n details: {retry_after_seconds: known.details.retryAfterSeconds},\n status: providerStatus(known.details.reason),\n });\n }\n throw error;\n },\n handler: async (request, reply) => {\n const {workspace_id: workspaceId, name, source} = request.body;\n const actor = requireUserContext(request);\n\n requireWorkspaceAccess({request, workspaceId});\n const project = await createProjectFromSource({\n actorId: actor.userId,\n workspaceId,\n name,\n sourceConnectionId: source.connection_id,\n sourceExternalRepositoryId: source.external_repository_id,\n integrations,\n });\n\n reply.status(201);\n return toProjectDto(project);\n },\n });\n}\n"],"names":["AUTH_USER","requireUserContext","requireWorkspaceAccess","integrationsInterModuleContract","createProjectBodySchema","projectResponseSchema","isInterModuleKnownError","ClientError","defineRoute","createProjectFromSource","ProjectAlreadyExistsError","toProjectDto","providerStatus","reason","createProjectRoute","integrations","method","path","auth","description","schema","body","response","errorHandler","error","known","methods","resolveSourceRepository","undefined","code","status","message","details","existing_project_id","existingProjectId","source_connection_id","sourceConnectionId","source_external_repository_id","sourceExternalRepositoryId","retry_after_seconds","retryAfterSeconds","handler","request","reply","workspace_id","workspaceId","name","source","actor","project","actorId","userId","connection_id","external_repository_id"],"mappings":"AAAA,SAAQA,SAAS,EAAEC,kBAAkB,EAAEC,sBAAsB,QAAO,4BAA4B;AAChG,SAEEC,+BAA+B,QAC1B,oCAAoC;AAC3C,SAAQC,uBAAuB,EAAEC,qBAAqB,QAAO,4BAA4B;AACzF,SAAQC,uBAAuB,QAAO,wBAAwB;AAC9D,SAAQC,WAAW,EAAEC,WAAW,QAAO,wBAAwB;AAC/D,SAAQC,uBAAuB,EAAEC,yBAAyB,QAAO,iBAAiB;AAClF,SAAQC,YAAY,QAAO,6BAA6B;AAExD,SAASC,eAAeC,MAAc;IACpC,IAAIA,WAAW,gBAAgB,OAAO;IACtC,IAAIA,WAAW,aAAaA,WAAW,wBAAwB,OAAO;IACtE,OAAO;AACT;AAEA,OAAO,SAASC,mBAAmBC,YAAsC;IACvE,OAAOP,YAAY;QACjBQ,QAAQ;QACRC,MAAM;QACNC,MAAMlB;QACNmB,aAAa;QACbC,QAAQ;YACNC,MAAMjB;YACNkB,UAAU;gBACR,KAAKjB;YACP;QACF;QACAkB,cAAc,CAACC;YACb,MAAMC,QAAQnB,wBACZH,gCAAgCuB,OAAO,CAACC,uBAAuB,EAC/DH,SAEEA,QACAI;YACJ,IAAIH,OAAOI,SAAS,wBAAwB;gBAC1C,MAAM,IAAItB,YAAY,+BAA+B,+BAA+B;oBAClFuB,QAAQ;gBACV;YACF;YACA,IAAIL,OAAOI,SAAS,iCAAiC;gBACnD,MAAM,IAAItB,YAAY,uDAAuD,aAAa;oBACxFuB,QAAQ;gBACV;YACF;YACA,IAAIL,OAAOI,SAAS,uBAAuB;gBACzC,MAAM,IAAItB,YAAY,mCAAmC,8BAA8B;oBACrFuB,QAAQ;gBACV;YACF;YACA,IAAIL,OAAOI,SAAS,wBAAwB;gBAC1C,MAAM,IAAItB,YACR,uCACA,oCACA;oBAACuB,QAAQ;gBAAG;YAEhB;YACA,IAAIL,OAAOI,SAAS,0BAA0B;gBAC5C,MAAM,IAAItB,YACR,yCACA,sCACA;oBAACuB,QAAQ;gBAAG;YAEhB;YACA,IAAIN,iBAAiBd,2BAA2B;gBAC9C,MAAM,IAAIH,YAAYiB,MAAMO,OAAO,EAAE,0BAA0B;oBAC7DC,SAAS;wBACPC,qBAAqBT,MAAMU,iBAAiB;wBAC5CC,sBAAsBX,MAAMY,kBAAkB;wBAC9CC,+BAA+Bb,MAAMc,0BAA0B;oBACjE;oBACAR,QAAQ;gBACV;YACF;YACA,IAAIL,OAAOI,SAAS,oBAAoB;gBACtC,MAAM,IAAItB,YAAY,uCAAuCkB,MAAMO,OAAO,CAACnB,MAAM,EAAE;oBACjFmB,SAAS;wBAACO,qBAAqBd,MAAMO,OAAO,CAACQ,iBAAiB;oBAAA;oBAC9DV,QAAQlB,eAAea,MAAMO,OAAO,CAACnB,MAAM;gBAC7C;YACF;YACA,MAAMW;QACR;QACAiB,SAAS,OAAOC,SAASC;YACvB,MAAM,EAACC,cAAcC,WAAW,EAAEC,IAAI,EAAEC,MAAM,EAAC,GAAGL,QAAQrB,IAAI;YAC9D,MAAM2B,QAAQ/C,mBAAmByC;YAEjCxC,uBAAuB;gBAACwC;gBAASG;YAAW;YAC5C,MAAMI,UAAU,MAAMxC,wBAAwB;gBAC5CyC,SAASF,MAAMG,MAAM;gBACrBN;gBACAC;gBACAV,oBAAoBW,OAAOK,aAAa;gBACxCd,4BAA4BS,OAAOM,sBAAsB;gBACzDtC;YACF;YAEA4B,MAAMb,MAAM,CAAC;YACb,OAAOnB,aAAasC;QACtB;IACF;AACF"}
@@ -1,4 +1,4 @@
1
- import type { IntegrationSourceControlService } from '@shipfox/api-integration-core';
1
+ import type { IntegrationsModuleClient } from '@shipfox/api-integration-core-dto';
2
2
  import type { RouteGroup } from '@shipfox/node-fastify';
3
- export declare function createProjectRoutes(sourceControl: IntegrationSourceControlService): RouteGroup[];
3
+ export declare function createProjectRoutes(integrations: IntegrationsModuleClient): RouteGroup[];
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,+BAA+B,EAAC,MAAM,+BAA+B,CAAC;AACnF,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAKtD,wBAAgB,mBAAmB,CAAC,aAAa,EAAE,+BAA+B,GAAG,UAAU,EAAE,CAOhG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/presentation/routes/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,wBAAwB,EAAC,MAAM,mCAAmC,CAAC;AAChF,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,uBAAuB,CAAC;AAKtD,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,wBAAwB,GAAG,UAAU,EAAE,CAOxF"}
@@ -1,12 +1,12 @@
1
1
  import { createProjectRoute } from './create-project.js';
2
2
  import { getProjectRoute } from './get-project.js';
3
3
  import { listProjectsRoute } from './list-projects.js';
4
- export function createProjectRoutes(sourceControl) {
4
+ export function createProjectRoutes(integrations) {
5
5
  return [
6
6
  {
7
7
  prefix: '/projects',
8
8
  routes: [
9
- createProjectRoute(sourceControl),
9
+ createProjectRoute(integrations),
10
10
  listProjectsRoute,
11
11
  getProjectRoute
12
12
  ]
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/presentation/routes/index.ts"],"sourcesContent":["import type {IntegrationSourceControlService} from '@shipfox/api-integration-core';\nimport type {RouteGroup} from '@shipfox/node-fastify';\nimport {createProjectRoute} from './create-project.js';\nimport {getProjectRoute} from './get-project.js';\nimport {listProjectsRoute} from './list-projects.js';\n\nexport function createProjectRoutes(sourceControl: IntegrationSourceControlService): RouteGroup[] {\n return [\n {\n prefix: '/projects',\n routes: [createProjectRoute(sourceControl), listProjectsRoute, getProjectRoute],\n },\n ];\n}\n"],"names":["createProjectRoute","getProjectRoute","listProjectsRoute","createProjectRoutes","sourceControl","prefix","routes"],"mappings":"AAEA,SAAQA,kBAAkB,QAAO,sBAAsB;AACvD,SAAQC,eAAe,QAAO,mBAAmB;AACjD,SAAQC,iBAAiB,QAAO,qBAAqB;AAErD,OAAO,SAASC,oBAAoBC,aAA8C;IAChF,OAAO;QACL;YACEC,QAAQ;YACRC,QAAQ;gBAACN,mBAAmBI;gBAAgBF;gBAAmBD;aAAgB;QACjF;KACD;AACH"}
1
+ {"version":3,"sources":["../../../src/presentation/routes/index.ts"],"sourcesContent":["import type {IntegrationsModuleClient} from '@shipfox/api-integration-core-dto';\nimport type {RouteGroup} from '@shipfox/node-fastify';\nimport {createProjectRoute} from './create-project.js';\nimport {getProjectRoute} from './get-project.js';\nimport {listProjectsRoute} from './list-projects.js';\n\nexport function createProjectRoutes(integrations: IntegrationsModuleClient): RouteGroup[] {\n return [\n {\n prefix: '/projects',\n routes: [createProjectRoute(integrations), listProjectsRoute, getProjectRoute],\n },\n ];\n}\n"],"names":["createProjectRoute","getProjectRoute","listProjectsRoute","createProjectRoutes","integrations","prefix","routes"],"mappings":"AAEA,SAAQA,kBAAkB,QAAO,sBAAsB;AACvD,SAAQC,eAAe,QAAO,mBAAmB;AACjD,SAAQC,iBAAiB,QAAO,qBAAqB;AAErD,OAAO,SAASC,oBAAoBC,YAAsC;IACxE,OAAO;QACL;YACEC,QAAQ;YACRC,QAAQ;gBAACN,mBAAmBI;gBAAeF;gBAAmBD;aAAgB;QAChF;KACD;AACH"}