@shipfox/api-projects 12.0.0 → 12.2.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.
- package/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +14 -0
- package/dist/core/errors.d.ts.map +1 -1
- package/dist/db/db.d.ts +6 -6
- package/dist/db/schema/integration-event-dedup.d.ts +1 -1
- package/dist/db/schema/outbox.d.ts +1 -1
- package/dist/db/schema/projects.d.ts +1 -1
- package/dist/presentation/dto/project.d.ts +1 -1
- package/dist/presentation/dto/project.d.ts.map +1 -1
- package/dist/presentation/inter-module.d.ts.map +1 -1
- package/dist/presentation/inter-module.js +20 -1
- package/dist/presentation/inter-module.js.map +1 -1
- package/dist/tsconfig.test.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/presentation/inter-module.test.ts +40 -0
- package/src/presentation/inter-module.ts +14 -0
- package/tsconfig.build.tsbuildinfo +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shipfox/api-projects",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "12.
|
|
4
|
+
"version": "12.2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/ShipfoxHQ/shipfox.git",
|
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
"@temporalio/workflow": "1.18.1",
|
|
22
22
|
"drizzle-orm": "^0.45.2",
|
|
23
23
|
"zod": "^4.4.3",
|
|
24
|
-
"@shipfox/api-auth-context": "12.0.0",
|
|
25
|
-
"@shipfox/api-common-dto": "12.0.0",
|
|
26
24
|
"@shipfox/api-auth-dto": "12.0.0",
|
|
27
|
-
"@shipfox/api-
|
|
25
|
+
"@shipfox/api-auth-context": "12.2.0",
|
|
26
|
+
"@shipfox/api-common-dto": "12.0.0",
|
|
27
|
+
"@shipfox/api-integration-core-dto": "12.2.0",
|
|
28
|
+
"@shipfox/api-projects-dto": "12.2.0",
|
|
28
29
|
"@shipfox/inter-module": "0.2.3",
|
|
29
30
|
"@shipfox/node-drizzle": "0.3.5",
|
|
30
|
-
"@shipfox/
|
|
31
|
-
"@shipfox/node-
|
|
32
|
-
"@shipfox/node-
|
|
33
|
-
"@shipfox/node-
|
|
31
|
+
"@shipfox/node-fastify": "0.4.2",
|
|
32
|
+
"@shipfox/node-module": "1.0.6",
|
|
33
|
+
"@shipfox/node-opentelemetry": "0.6.4",
|
|
34
|
+
"@shipfox/node-outbox": "0.2.6",
|
|
34
35
|
"@shipfox/node-postgres": "0.5.0",
|
|
35
|
-
"@shipfox/node-temporal": "0.4.
|
|
36
|
-
"@shipfox/node-outbox": "0.2.6"
|
|
36
|
+
"@shipfox/node-temporal": "0.4.5"
|
|
37
37
|
},
|
|
38
38
|
"imports": {
|
|
39
39
|
"#*": "./dist/*"
|
|
@@ -75,6 +75,46 @@ async function expectUnauthorized(
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
describe('Projects checkout target inter-module presentation', () => {
|
|
78
|
+
test('lists workspace projects through the paginated inter-module contract', async () => {
|
|
79
|
+
const client = createClient();
|
|
80
|
+
const workspaceId = crypto.randomUUID();
|
|
81
|
+
const first = await insertProject({
|
|
82
|
+
workspaceId,
|
|
83
|
+
connectionId: crypto.randomUUID(),
|
|
84
|
+
owner: 'acme',
|
|
85
|
+
name: 'first',
|
|
86
|
+
});
|
|
87
|
+
const second = await insertProject({
|
|
88
|
+
workspaceId,
|
|
89
|
+
connectionId: crypto.randomUUID(),
|
|
90
|
+
owner: 'acme',
|
|
91
|
+
name: 'second',
|
|
92
|
+
});
|
|
93
|
+
await insertProject({
|
|
94
|
+
workspaceId: crypto.randomUUID(),
|
|
95
|
+
connectionId: crypto.randomUUID(),
|
|
96
|
+
owner: 'other',
|
|
97
|
+
name: 'excluded',
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
const firstPage = await client.listProjectsByWorkspace({workspaceId, limit: 1});
|
|
101
|
+
expect(firstPage.projects).toHaveLength(1);
|
|
102
|
+
expect(firstPage.nextCursor).not.toBeNull();
|
|
103
|
+
if (!firstPage.nextCursor) expect.fail('Expected a second project page');
|
|
104
|
+
|
|
105
|
+
const secondPage = await client.listProjectsByWorkspace({
|
|
106
|
+
workspaceId,
|
|
107
|
+
limit: 1,
|
|
108
|
+
cursor: firstPage.nextCursor,
|
|
109
|
+
});
|
|
110
|
+
expect(secondPage.projects).toHaveLength(1);
|
|
111
|
+
expect(secondPage.nextCursor).toBeNull();
|
|
112
|
+
const projectIds = [...firstPage.projects, ...secondPage.projects]
|
|
113
|
+
.map((project) => project.id)
|
|
114
|
+
.sort();
|
|
115
|
+
expect(projectIds).toEqual([first.projectId, second.projectId].sort());
|
|
116
|
+
});
|
|
117
|
+
|
|
78
118
|
test('resolves a project by its workspace-scoped source repository', async () => {
|
|
79
119
|
const client = createClient();
|
|
80
120
|
const workspaceId = crypto.randomUUID();
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
getProjectById,
|
|
10
10
|
getProjectBySource,
|
|
11
11
|
getWorkspaceProjectCounts,
|
|
12
|
+
listProjects,
|
|
12
13
|
resolveCheckoutTarget,
|
|
13
14
|
updateProjectSourceMetadata,
|
|
14
15
|
} from '#db/projects.js';
|
|
@@ -21,6 +22,19 @@ export function createProjectsInterModulePresentation(params: {
|
|
|
21
22
|
getProjectBySource: async (input) => ({
|
|
22
23
|
project: (await getProjectBySource(input)) ?? null,
|
|
23
24
|
}),
|
|
25
|
+
listProjectsByWorkspace: async ({workspaceId, limit, cursor}) => {
|
|
26
|
+
const result = await listProjects({
|
|
27
|
+
workspaceId,
|
|
28
|
+
limit,
|
|
29
|
+
...(cursor ? {cursor: {createdAt: new Date(cursor.createdAt), id: cursor.id}} : {}),
|
|
30
|
+
});
|
|
31
|
+
return {
|
|
32
|
+
projects: result.projects,
|
|
33
|
+
nextCursor: result.nextCursor
|
|
34
|
+
? {createdAt: result.nextCursor.createdAt.toISOString(), id: result.nextCursor.id}
|
|
35
|
+
: null,
|
|
36
|
+
};
|
|
37
|
+
},
|
|
24
38
|
requireProjectForWorkspace: async ({projectId, workspaceId}) => {
|
|
25
39
|
const project = await getProjectById(projectId);
|
|
26
40
|
if (project === undefined) {
|