Skip to content

Commit

Permalink
fix(typescript): noSerdeLayer with SSE now compiles (#5404)
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-support authored Dec 13, 2024
1 parent 643ba46 commit 9e2fa9c
Show file tree
Hide file tree
Showing 167 changed files with 6,711 additions and 30 deletions.
6 changes: 6 additions & 0 deletions generators/typescript/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.43.1] - 2024-12-11

- Fix: When `noSerdeLayer` is enabled, streaming endpoints were failing to compile because
they assumed that the serialization layer existed. This is now fixed.


## [0.43.0] - 2024-12-11

- Feature: Generate inline types for inline schemas by setting `enableInlineTypes` to `true` in the generator config.
Expand Down
2 changes: 1 addition & 1 deletion generators/typescript/sdk/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.43.0
0.43.1
Original file line number Diff line number Diff line change
Expand Up @@ -495,35 +495,56 @@ export class GeneratedThrowingEndpointResponse implements GeneratedEndpointRespo
signal: getAbortSignalExpression({
abortSignalReference: this.clientClass.getReferenceToAbortSignal.bind(this.clientClass)
}),
parse: ts.factory.createArrowFunction(
[ts.factory.createToken(ts.SyntaxKind.AsyncKeyword)],
undefined,
[
ts.factory.createParameterDeclaration(
undefined,
undefined,
undefined,
GeneratedStreamingEndpointImplementation.DATA_PARAMETER_NAME
)
],
undefined,
ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken),
ts.factory.createBlock(
[
ts.factory.createReturnStatement(
context.sdkEndpointTypeSchemas
.getGeneratedEndpointTypeSchemas(this.packageId, this.endpoint.name)
.deserializeStreamData({
context,
referenceToRawStreamData: ts.factory.createIdentifier(
GeneratedStreamingEndpointImplementation.DATA_PARAMETER_NAME
)
})
)
],
true
)
)
parse: context.includeSerdeLayer
? ts.factory.createArrowFunction(
[ts.factory.createToken(ts.SyntaxKind.AsyncKeyword)],
undefined,
[
ts.factory.createParameterDeclaration(
undefined,
undefined,
undefined,
GeneratedStreamingEndpointImplementation.DATA_PARAMETER_NAME
)
],
undefined,
ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken),
ts.factory.createBlock(
[
ts.factory.createReturnStatement(
context.sdkEndpointTypeSchemas
.getGeneratedEndpointTypeSchemas(this.packageId, this.endpoint.name)
.deserializeStreamData({
context,
referenceToRawStreamData: ts.factory.createIdentifier(
GeneratedStreamingEndpointImplementation.DATA_PARAMETER_NAME
)
})
)
],
true
)
)
: ts.factory.createArrowFunction(
undefined,
undefined,
[
ts.factory.createParameterDeclaration(
undefined,
undefined,
undefined,
GeneratedStreamingEndpointImplementation.DATA_PARAMETER_NAME
)
],
undefined,
ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken),
ts.factory.createAsExpression(
ts.factory.createIdentifier(
GeneratedStreamingEndpointImplementation.DATA_PARAMETER_NAME
),
ts.factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword)
)
)
})
)
];
Expand Down
2 changes: 2 additions & 0 deletions seed/ts-sdk/seed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ fixtures:
streaming:
- customConfig: null
outputFolder: no-custom-config
- customConfig: null
outputFolder: no-serde-layer
- customConfig:
allowCustomFetcher: true
timeoutInSeconds: 2
Expand Down
57 changes: 57 additions & 0 deletions seed/ts-sdk/streaming/no-serde-layer/.github/workflows/ci.yml

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

3 changes: 3 additions & 0 deletions seed/ts-sdk/streaming/no-serde-layer/.gitignore

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

3 changes: 3 additions & 0 deletions seed/ts-sdk/streaming/no-serde-layer/.mock/definition/api.yml

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

41 changes: 41 additions & 0 deletions seed/ts-sdk/streaming/no-serde-layer/.mock/definition/dummy.yml

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

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

1 change: 1 addition & 0 deletions seed/ts-sdk/streaming/no-serde-layer/.mock/generators.yml

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

9 changes: 9 additions & 0 deletions seed/ts-sdk/streaming/no-serde-layer/.npmignore

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

2 changes: 2 additions & 0 deletions seed/ts-sdk/streaming/no-serde-layer/.prettierrc.yml

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

153 changes: 153 additions & 0 deletions seed/ts-sdk/streaming/no-serde-layer/README.md

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

5 changes: 5 additions & 0 deletions seed/ts-sdk/streaming/no-serde-layer/jest.config.js

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

Loading

0 comments on commit 9e2fa9c

Please sign in to comment.