Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mjameswh authored Jan 24, 2025
2 parents b7cc833 + 411a6fe commit 5f8d4b7
Show file tree
Hide file tree
Showing 34 changed files with 2,838 additions and 2,198 deletions.
61 changes: 33 additions & 28 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,34 +50,39 @@ See [sdk-structure.md](./docs/sdk-structure.md)

### Environment setup

- The TS SDK can be executed on 18, 20 or 22. However, we recommend using Node 22 for SDK development.
For easier testing during development you may want to use a version manager, such as
[fnm](https://github.com/Schniz/fnm) or [nvm](https://github.com/nvm-sh/nvm/blob/master/README.md).

- To run tests, you will need access to a local Temporal server, e.g. using the
[Temporal CLI's integrated dev server](https://github.com/temporalio/cli#start-the-server).
- Install the [Rust toolchain](https://rustup.rs/).
- Install [Protocol Buffers](https://github.com/protocolbuffers/protobuf/releases/).
- Clone the [sdk-typescript](https://github.com/temporalio/sdk-typescript) repo:
```sh
git clone https://github.com/temporalio/sdk-typescript.git
cd sdk-typescript
```
- Initialize the Core SDK submodule:
```sh
git submodule update --init --recursive
```
> If you get a `The authenticity of host 'github.com (192.30.252.123)' can't be established.`
> error, run `ssh-keyscan github.com >> ~/.ssh/known_hosts` and retry.
- Install the dependencies:
```sh
npm ci
```
This may take a few minutes, as it involves downloading and compiling Rust dependencies.
- You should now be able to build:
```sh
npm run build
```
The TS SDK can be executed on 18, 20 or 22. However, we recommend using Node 22 for SDK development.
For easier testing during development you may want to use a version manager, such as
[fnm](https://github.com/Schniz/fnm) or [nvm](https://github.com/nvm-sh/nvm/blob/master/README.md).

1. To run tests, you will need access to a local Temporal server, e.g. using the
[Temporal CLI's integrated dev server](https://github.com/temporalio/cli#start-the-server).
2. Install the [Rust toolchain](https://rustup.rs/).
3. Install [Protocol Buffers](https://github.com/protocolbuffers/protobuf/releases/).
4. Clone the [sdk-typescript](https://github.com/temporalio/sdk-typescript) repo:
```sh
git clone https://github.com/temporalio/sdk-typescript.git
cd sdk-typescript
```
5. Initialize the Core SDK submodule:

```sh
git submodule update --init --recursive
```

> If you get a `The authenticity of host 'github.com (192.30.252.123)' can't be established.`
> error, run `ssh-keyscan github.com >> ~/.ssh/known_hosts` and retry.
6. Install the dependencies:
```sh
npm ci
```
This may take a few minutes, as it involves downloading and compiling Rust dependencies.

You should now be able to build:

```sh
npm run build
```

If building fails, resetting your environment may help:

Expand Down
23 changes: 0 additions & 23 deletions packages/common/src/type-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,26 +218,3 @@ export function SymbolBasedInstanceOfError<E extends Error>(markerName: string):
});
};
}

// Thanks MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze
export function deepFreeze<T>(object: T): T {
// Retrieve the property names defined on object
const propNames = Object.getOwnPropertyNames(object);

// Freeze properties before freezing self
for (const name of propNames) {
const value = (object as any)[name];

if (value && typeof value === 'object') {
try {
deepFreeze(value);
} catch (_err) {
// This is okay, there are some typed arrays that cannot be frozen (encodingKeys)
}
} else if (typeof value === 'function') {
Object.freeze(value);
}
}

return Object.freeze(object);
}
Loading

0 comments on commit 5f8d4b7

Please sign in to comment.