Migrate to TypeScript with esbuild bundling and Vitest smoke tests#3
Open
Valamorde wants to merge 1 commit into
Open
Migrate to TypeScript with esbuild bundling and Vitest smoke tests#3Valamorde wants to merge 1 commit into
Valamorde wants to merge 1 commit into
Conversation
- Convert all 5 Lambdas from AssetCode/JS to NodejsFunction/TS with esbuild bundling
(externalModules: ['@aws-sdk/*'] — runtime provides SDK v3 on Node 22)
- Add src/ layout: shared/{types,keys,db,apigw}, connect, disconnect, keepalive,
services, sendmessage (router + 7 sub-handlers)
- Decompose 300-line sendmessage if-chain into dispatch map + NO_FORWARD set
- Add src/shared/keys.ts — canonical objectId key builders (wire-safe)
- Add 20 Vitest smoke tests across 8 test files; all pass
- Fix noImplicitReturns in forward.ts catch callback
- Add skipLibCheck to tsconfig to resolve vitest/vite type conflicts
- Add pnpm.onlyBuiltDependencies to allow esbuild native build scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NodejsFunction(esbuild bundling) — no per-functionpackage.jsonneededsrc/shared/module for the DDB client singleton, ApiGW factory, key builders, and domain typessendmessageif-chain into a typed dispatch map with one handler file per event typeobjectiddeclared withoutconst(implicit global) inonconnectfor(tokenid in tokens)implicit global in servicesslice(i, i+21)withi+=20) causing duplicated writes"abovevtt"instead ofTABLE_NAMEenv varPRIORITY_ABOVE_NORMAL,require('http'))tsconfig.jsontyponoFalltriganCasesInSwitchcorrectedWire protocol
All HTTP paths, WebSocket
eventTypevalues, and JSON response shapes are preserved exactly. The browser extension requires no changes.Test plan
pnpm test— all 20 smoke tests passcdk diff— Lambda functions replaced (expected), DynamoDB table unchanged