@arrirpc/codegen-ts 0.57.2 → 0.57.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -393,7 +393,7 @@ function tsTaggedUnionFromSchema(schema, context) {
393
393
  });
394
394
  subTypes.push({ value: key, data: subType });
395
395
  }
396
- result.content = `export type ${prefixedTypeName} = ${subTypes.map((type) => type.data.typeName).join(" |")};
396
+ result.content = `${getJsDocComment(schema.metadata)}export type ${prefixedTypeName} = ${subTypes.map((type) => type.data.typeName).join(" |")};
397
397
  export const $$${prefixedTypeName}: ArriModelValidator<${prefixedTypeName}> = {
398
398
  new(): ${prefixedTypeName} {
399
399
  return $$${subTypes[0].data.typeName}.new();
@@ -910,7 +910,10 @@ function httpRpcFromDefinition(def, context) {
910
910
  const serializerMethod = def.method === "get" ? "toUrlQueryString" : "toJsonString";
911
911
  if (def.isEventStream) {
912
912
  context.usedFeatures.sse = true;
913
- return ` ${key}(${params ? `params: ${params},` : ""} options: SseOptions<${response ?? "undefined"}> = {}): EventSourceController {
913
+ return `${getJsDocComment({
914
+ description: def.description,
915
+ isDeprecated: def.isDeprecated
916
+ })} ${key}(${params ? `params: ${params},` : ""} options: SseOptions<${response ?? "undefined"}> = {}): EventSourceController {
914
917
  return arriSseRequest<${response ?? "undefined"}, ${params ?? "undefined"}>(
915
918
  {
916
919
  url: \`\${this._baseUrl}${def.path}\`,
@@ -926,7 +929,10 @@ function httpRpcFromDefinition(def, context) {
926
929
  )
927
930
  }`;
928
931
  }
929
- return ` async ${key}(${params ? `params: ${params}` : ""}): Promise<${response ?? "undefined"}> {
932
+ return `${getJsDocComment({
933
+ description: def.description,
934
+ isDeprecated: def.isDeprecated
935
+ })} async ${key}(${params ? `params: ${params}` : ""}): Promise<${response ?? "undefined"}> {
930
936
  return arriRequest<${response ?? "undefined"}, ${params ?? "undefined"}>({
931
937
  url: \`\${this._baseUrl}${def.path}\`,
932
938
  method: "${def.method.toLowerCase()}",
@@ -944,7 +950,10 @@ function wsRpcFromDefinition(def, context) {
944
950
  const key = getRpcKey(context);
945
951
  const params = def.params ? `${context.typePrefix}${codegenUtils.pascalCase(validVarName(def.params))}` : void 0;
946
952
  const response = def.response ? `${context.typePrefix}${codegenUtils.pascalCase(validVarName(def.response), { normalize: true })}` : void 0;
947
- return ` async ${key}(options: WsOptions<${response ?? "undefined"}> = {}): Promise<WsController<${params ?? "undefined"},${response ?? "undefined"}>> {
953
+ return `${getJsDocComment({
954
+ description: def.description,
955
+ isDeprecated: def.isDeprecated
956
+ })} async ${key}(options: WsOptions<${response ?? "undefined"}> = {}): Promise<WsController<${params ?? "undefined"},${response ?? "undefined"}>> {
948
957
  return arriWsRequest<${params ?? "undefined"}, ${response ?? "undefined"}>({
949
958
  url: \`\${this._baseUrl}${def.path}\`,
950
959
  headers: this._headers,
package/dist/index.mjs CHANGED
@@ -387,7 +387,7 @@ function tsTaggedUnionFromSchema(schema, context) {
387
387
  });
388
388
  subTypes.push({ value: key, data: subType });
389
389
  }
390
- result.content = `export type ${prefixedTypeName} = ${subTypes.map((type) => type.data.typeName).join(" |")};
390
+ result.content = `${getJsDocComment(schema.metadata)}export type ${prefixedTypeName} = ${subTypes.map((type) => type.data.typeName).join(" |")};
391
391
  export const $$${prefixedTypeName}: ArriModelValidator<${prefixedTypeName}> = {
392
392
  new(): ${prefixedTypeName} {
393
393
  return $$${subTypes[0].data.typeName}.new();
@@ -904,7 +904,10 @@ function httpRpcFromDefinition(def, context) {
904
904
  const serializerMethod = def.method === "get" ? "toUrlQueryString" : "toJsonString";
905
905
  if (def.isEventStream) {
906
906
  context.usedFeatures.sse = true;
907
- return ` ${key}(${params ? `params: ${params},` : ""} options: SseOptions<${response ?? "undefined"}> = {}): EventSourceController {
907
+ return `${getJsDocComment({
908
+ description: def.description,
909
+ isDeprecated: def.isDeprecated
910
+ })} ${key}(${params ? `params: ${params},` : ""} options: SseOptions<${response ?? "undefined"}> = {}): EventSourceController {
908
911
  return arriSseRequest<${response ?? "undefined"}, ${params ?? "undefined"}>(
909
912
  {
910
913
  url: \`\${this._baseUrl}${def.path}\`,
@@ -920,7 +923,10 @@ function httpRpcFromDefinition(def, context) {
920
923
  )
921
924
  }`;
922
925
  }
923
- return ` async ${key}(${params ? `params: ${params}` : ""}): Promise<${response ?? "undefined"}> {
926
+ return `${getJsDocComment({
927
+ description: def.description,
928
+ isDeprecated: def.isDeprecated
929
+ })} async ${key}(${params ? `params: ${params}` : ""}): Promise<${response ?? "undefined"}> {
924
930
  return arriRequest<${response ?? "undefined"}, ${params ?? "undefined"}>({
925
931
  url: \`\${this._baseUrl}${def.path}\`,
926
932
  method: "${def.method.toLowerCase()}",
@@ -938,7 +944,10 @@ function wsRpcFromDefinition(def, context) {
938
944
  const key = getRpcKey(context);
939
945
  const params = def.params ? `${context.typePrefix}${pascalCase(validVarName(def.params))}` : void 0;
940
946
  const response = def.response ? `${context.typePrefix}${pascalCase(validVarName(def.response), { normalize: true })}` : void 0;
941
- return ` async ${key}(options: WsOptions<${response ?? "undefined"}> = {}): Promise<WsController<${params ?? "undefined"},${response ?? "undefined"}>> {
947
+ return `${getJsDocComment({
948
+ description: def.description,
949
+ isDeprecated: def.isDeprecated
950
+ })} async ${key}(options: WsOptions<${response ?? "undefined"}> = {}): Promise<WsController<${params ?? "undefined"},${response ?? "undefined"}>> {
942
951
  return arriWsRequest<${params ?? "undefined"}, ${response ?? "undefined"}>({
943
952
  url: \`\${this._baseUrl}${def.path}\`,
944
953
  headers: this._headers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrirpc/codegen-ts",
3
- "version": "0.57.2",
3
+ "version": "0.57.4",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -23,10 +23,10 @@
23
23
  ],
24
24
  "dependencies": {
25
25
  "prettier": "^3.3.3",
26
- "@arrirpc/codegen-utils": "0.57.2",
27
- "@arrirpc/schema": "0.57.2"
26
+ "@arrirpc/codegen-utils": "0.57.4",
27
+ "@arrirpc/schema": "0.57.4"
28
28
  },
29
29
  "devDependencies": {
30
- "@arrirpc/client": "0.57.2"
30
+ "@arrirpc/client": "0.57.4"
31
31
  }
32
32
  }