Skip to content

chore(bridge): Refactor TS-Core bridge #1698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,6 @@ jobs:
- platform: windows-x64
runner: windows-latest
reuse-v8-context: true
# Node 22.12.0 on Windows incorrectly resolves `localhost` to `::1`, rather than both `::1` and `127.0.0.1`.
# We changed all of our internal tests to exclusively use `127.0.0.1`, but samples are still written to use
# `localhost`, which really is the proper thing to do in samples. So until this gets fixed upstream, we force
# the last known good version of Node on Windows.
# See https://github.com/nodejs/node/issues/56137 (_resolved_ already, but not yet released).
- platform: windows-x64
node: 22
node-release-override: 22.11.0
runs-on: ${{ matrix.runner }}
name: Run Integration Tests (${{ matrix.platform }}, Node ${{ matrix.node }}, Reuse V8 Context ${{ matrix.reuse-v8-context }})
defaults:
Expand Down Expand Up @@ -222,7 +214,7 @@ jobs:
TEMPORAL_CLIENT_KEY: ${{ secrets.TEMPORAL_CLIENT_KEY }}

- name: Run Tests
run: npm test
run: npm run test
env:
RUN_INTEGRATION_TESTS: true
REUSE_V8_CONTEXT: ${{ matrix.reuse-v8-context }}
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ packages/core-bridge/releases
packages/*/package-lock.json
/sdk-node.iml
*~

# One test creates persisted SQLite DBs; they should normally be deleted automatically,
# but may be left behind in some error scenarios.
packages/test/temporal-db-*.sqlite
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion packages/common/src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export class ValueError extends Error {
export class PayloadConverterError extends ValueError {}

/**
* Used in different parts of the SDK to note that something unexpected has happened.
* Signals that a requested operation can't be completed because it is illegal given the
* current state of the object; e.g. trying to use a resource after it has been closed.
*/
@SymbolBasedInstanceOfError('IllegalStateError')
export class IllegalStateError extends Error {}
Expand Down
11 changes: 11 additions & 0 deletions packages/common/src/type-helpers.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
export type NonNullableObject<T> = { [P in keyof T]-?: NonNullable<T[P]> };

/** Shorthand alias */
export type AnyFunc = (...args: any[]) => any;

/** A tuple without its last element */
export type OmitLast<T> = T extends [...infer REST, any] ? REST : never;

/** F with all arguments but the last */
export type OmitLastParam<F extends AnyFunc> = (...args: OmitLast<Parameters<F>>) => ReturnType<F>;

export type OmitFirst<T> = T extends [any, ...infer REST] ? REST : never;

export type OmitFirstParam<T> = T extends (...args: any[]) => any
? (...args: OmitFirst<Parameters<T>>) => ReturnType<T>
: never;

/** Require that T has at least one of the provided properties defined */
export type RequireAtLeastOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> &
{
Expand Down
Loading
Loading