Skip to content

Commit cdc2ba7

Browse files
chore(storage-confirm-upload): switch to node-sql template
- Change template from node-graphql to node-sql for connection pooling - Add pool and withUserContext support to mock-context helper Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent dbdb3d4 commit cdc2ba7

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
{
22
"name": "storage-confirm-upload",
33
"version": "1.0.0",
4-
"type": "node-graphql",
4+
"type": "node-sql",
55
"port": 8085,
66
"taskIdentifier": "storage:confirm_upload",
77
"description": "Confirms file upload by checking S3 HeadObject and transitioning status to uploaded",
88
"dependencies": {
99
"@aws-sdk/client-s3": "^3.1060.0",
10-
"@pgpmjs/env": "^2.15.3",
11-
"@pgpmjs/logger": "^2.4.3",
12-
"pg": "^8.16.0"
10+
"@pgsql/quotes": "^0.0.4"
1311
}
1412
}

tests/helpers/mock-context.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Inline type to avoid requiring fn-runtime to be built for unit tests.
2-
// Mirrors FunctionContext from packages/fn-runtime/src/types.ts
2+
// Mirrors FunctionContext from packages/fn-runtime/src/types.ts (node-graphql)
3+
// and generated/*/types.ts (node-sql)
34
type FunctionContext = {
45
job: {
56
jobId?: string;
@@ -14,13 +15,17 @@ type FunctionContext = {
1415
warn: (...args: any[]) => void;
1516
};
1617
env: Record<string, string | undefined>;
18+
// node-sql template fields
19+
pool?: any;
20+
withUserContext?: any;
1721
};
1822

1923
type MockContextOptions = {
2024
env?: Record<string, string | undefined>;
2125
databaseId?: string;
2226
clientResponse?: any;
2327
metaResponse?: any;
28+
pool?: any;
2429
};
2530

2631
export const createMockContext = (
@@ -38,5 +43,7 @@ export const createMockContext = (
3843
request: jest.fn().mockResolvedValue(options.metaResponse ?? {})
3944
} as any,
4045
log: { info: jest.fn(), error: jest.fn(), warn: jest.fn() },
41-
env: options.env ?? {}
46+
env: options.env ?? {},
47+
pool: options.pool,
48+
withUserContext: jest.fn()
4249
});

0 commit comments

Comments
 (0)