@arrirpc/codegen-ts 0.70.1 → 0.71.1
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 +8 -8
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +8 -8
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -24,7 +24,7 @@ function tsAnyFromSchema(schema, context) {
|
|
|
24
24
|
return `${target} += JSON.stringify(${input})`;
|
|
25
25
|
},
|
|
26
26
|
toQueryStringTemplate(_input, _target, _key) {
|
|
27
|
-
return `console.warn(
|
|
27
|
+
return `console.warn('[WARNING] Cannot serialize any\\'s to query string. Skipping property at ${context.instancePath}.')`;
|
|
28
28
|
},
|
|
29
29
|
content: ""
|
|
30
30
|
};
|
|
@@ -181,7 +181,7 @@ function tsObjectFromSchema(schema, context) {
|
|
|
181
181
|
return `${target} += $$${prefixedTypeName}.toJsonString(${input});`;
|
|
182
182
|
},
|
|
183
183
|
toQueryStringTemplate(_input, _target) {
|
|
184
|
-
return `console.warn(
|
|
184
|
+
return `console.warn('[WARNING] Cannot serialize nested objects to query string. Skipping property at ${context.instancePath}.')`;
|
|
185
185
|
},
|
|
186
186
|
content: ""
|
|
187
187
|
};
|
|
@@ -377,7 +377,7 @@ function tsTaggedUnionFromSchema(schema, context) {
|
|
|
377
377
|
return `${target} += $$${prefixedTypeName}.toJsonString(${input});`;
|
|
378
378
|
},
|
|
379
379
|
toQueryStringTemplate(_, __, ___) {
|
|
380
|
-
return `console.warn(
|
|
380
|
+
return `console.warn('[WARNING] Cannot serialize nested objects to query string. Skipping property at ${context.instancePath}.');`;
|
|
381
381
|
},
|
|
382
382
|
content: ""
|
|
383
383
|
};
|
|
@@ -889,7 +889,7 @@ function tsRefFromSchema(schema, context) {
|
|
|
889
889
|
return `${target} += $$${prefixedTypeName}.toJsonString(${input});`;
|
|
890
890
|
},
|
|
891
891
|
toQueryStringTemplate(_, __, ___) {
|
|
892
|
-
return `console.warn(
|
|
892
|
+
return `console.warn('[WARNING] Nested objects cannot be serialized to query string. Ignoring property at ${context.instancePath}.');`;
|
|
893
893
|
},
|
|
894
894
|
content: ""
|
|
895
895
|
};
|
|
@@ -915,8 +915,8 @@ function tsRpcFromDefinition(def, context) {
|
|
|
915
915
|
}
|
|
916
916
|
function httpRpcFromDefinition(def, context) {
|
|
917
917
|
const key = getRpcKey(context);
|
|
918
|
-
const params = def.params ? `${context.typePrefix}${codegenUtils.pascalCase(validVarName(def.params))}` :
|
|
919
|
-
const response = def.response ? `${context.typePrefix}${codegenUtils.pascalCase(validVarName(def.response), { normalize: true })}` :
|
|
918
|
+
const params = def.params ? `${context.typePrefix}${codegenUtils.pascalCase(validVarName(def.params))}` : undefined;
|
|
919
|
+
const response = def.response ? `${context.typePrefix}${codegenUtils.pascalCase(validVarName(def.response), { normalize: true })}` : undefined;
|
|
920
920
|
const serializerMethod = def.method === "get" ? "toUrlQueryString" : "toJsonString";
|
|
921
921
|
if (def.isEventStream) {
|
|
922
922
|
context.usedFeatures.sse = true;
|
|
@@ -960,8 +960,8 @@ function httpRpcFromDefinition(def, context) {
|
|
|
960
960
|
function wsRpcFromDefinition(def, context) {
|
|
961
961
|
context.usedFeatures.ws = true;
|
|
962
962
|
const key = getRpcKey(context);
|
|
963
|
-
const params = def.params ? `${context.typePrefix}${codegenUtils.pascalCase(validVarName(def.params))}` :
|
|
964
|
-
const response = def.response ? `${context.typePrefix}${codegenUtils.pascalCase(validVarName(def.response), { normalize: true })}` :
|
|
963
|
+
const params = def.params ? `${context.typePrefix}${codegenUtils.pascalCase(validVarName(def.params))}` : undefined;
|
|
964
|
+
const response = def.response ? `${context.typePrefix}${codegenUtils.pascalCase(validVarName(def.response), { normalize: true })}` : undefined;
|
|
965
965
|
return `${getJsDocComment({
|
|
966
966
|
description: def.description,
|
|
967
967
|
isDeprecated: def.isDeprecated
|
package/dist/index.d.cts
CHANGED
|
@@ -34,7 +34,7 @@ interface CodegenContext {
|
|
|
34
34
|
};
|
|
35
35
|
rpcGenerators: Record<string, RpcGenerator>;
|
|
36
36
|
}
|
|
37
|
-
declare function getJsDocComment(metadata: Schema[
|
|
37
|
+
declare function getJsDocComment(metadata: Schema['metadata']): string;
|
|
38
38
|
declare function validVarName(name: string): string;
|
|
39
39
|
declare function getTsTypeName(schema: Schema, context: CodegenContext): string;
|
|
40
40
|
|
|
@@ -42,11 +42,11 @@ interface TypescriptGeneratorOptions {
|
|
|
42
42
|
clientName: string;
|
|
43
43
|
outputFile: string;
|
|
44
44
|
typePrefix?: string;
|
|
45
|
-
prettierOptions?: Omit<prettier.Config,
|
|
45
|
+
prettierOptions?: Omit<prettier.Config, 'parser'>;
|
|
46
46
|
/**
|
|
47
47
|
* Override the default functions used for creating procedures
|
|
48
48
|
*/
|
|
49
|
-
rpcGenerators?: Record<RpcDefinition[
|
|
49
|
+
rpcGenerators?: Record<RpcDefinition['transport'], RpcGenerator>;
|
|
50
50
|
}
|
|
51
51
|
declare const typescriptClientGenerator: _arrirpc_codegen_utils.GeneratorPlugin<TypescriptGeneratorOptions>;
|
|
52
52
|
declare function createTypescriptClient(def: AppDefinition, options: TypescriptGeneratorOptions): Promise<string>;
|
package/dist/index.d.mts
CHANGED
|
@@ -34,7 +34,7 @@ interface CodegenContext {
|
|
|
34
34
|
};
|
|
35
35
|
rpcGenerators: Record<string, RpcGenerator>;
|
|
36
36
|
}
|
|
37
|
-
declare function getJsDocComment(metadata: Schema[
|
|
37
|
+
declare function getJsDocComment(metadata: Schema['metadata']): string;
|
|
38
38
|
declare function validVarName(name: string): string;
|
|
39
39
|
declare function getTsTypeName(schema: Schema, context: CodegenContext): string;
|
|
40
40
|
|
|
@@ -42,11 +42,11 @@ interface TypescriptGeneratorOptions {
|
|
|
42
42
|
clientName: string;
|
|
43
43
|
outputFile: string;
|
|
44
44
|
typePrefix?: string;
|
|
45
|
-
prettierOptions?: Omit<prettier.Config,
|
|
45
|
+
prettierOptions?: Omit<prettier.Config, 'parser'>;
|
|
46
46
|
/**
|
|
47
47
|
* Override the default functions used for creating procedures
|
|
48
48
|
*/
|
|
49
|
-
rpcGenerators?: Record<RpcDefinition[
|
|
49
|
+
rpcGenerators?: Record<RpcDefinition['transport'], RpcGenerator>;
|
|
50
50
|
}
|
|
51
51
|
declare const typescriptClientGenerator: _arrirpc_codegen_utils.GeneratorPlugin<TypescriptGeneratorOptions>;
|
|
52
52
|
declare function createTypescriptClient(def: AppDefinition, options: TypescriptGeneratorOptions): Promise<string>;
|
package/dist/index.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ interface CodegenContext {
|
|
|
34
34
|
};
|
|
35
35
|
rpcGenerators: Record<string, RpcGenerator>;
|
|
36
36
|
}
|
|
37
|
-
declare function getJsDocComment(metadata: Schema[
|
|
37
|
+
declare function getJsDocComment(metadata: Schema['metadata']): string;
|
|
38
38
|
declare function validVarName(name: string): string;
|
|
39
39
|
declare function getTsTypeName(schema: Schema, context: CodegenContext): string;
|
|
40
40
|
|
|
@@ -42,11 +42,11 @@ interface TypescriptGeneratorOptions {
|
|
|
42
42
|
clientName: string;
|
|
43
43
|
outputFile: string;
|
|
44
44
|
typePrefix?: string;
|
|
45
|
-
prettierOptions?: Omit<prettier.Config,
|
|
45
|
+
prettierOptions?: Omit<prettier.Config, 'parser'>;
|
|
46
46
|
/**
|
|
47
47
|
* Override the default functions used for creating procedures
|
|
48
48
|
*/
|
|
49
|
-
rpcGenerators?: Record<RpcDefinition[
|
|
49
|
+
rpcGenerators?: Record<RpcDefinition['transport'], RpcGenerator>;
|
|
50
50
|
}
|
|
51
51
|
declare const typescriptClientGenerator: _arrirpc_codegen_utils.GeneratorPlugin<TypescriptGeneratorOptions>;
|
|
52
52
|
declare function createTypescriptClient(def: AppDefinition, options: TypescriptGeneratorOptions): Promise<string>;
|
package/dist/index.mjs
CHANGED
|
@@ -18,7 +18,7 @@ function tsAnyFromSchema(schema, context) {
|
|
|
18
18
|
return `${target} += JSON.stringify(${input})`;
|
|
19
19
|
},
|
|
20
20
|
toQueryStringTemplate(_input, _target, _key) {
|
|
21
|
-
return `console.warn(
|
|
21
|
+
return `console.warn('[WARNING] Cannot serialize any\\'s to query string. Skipping property at ${context.instancePath}.')`;
|
|
22
22
|
},
|
|
23
23
|
content: ""
|
|
24
24
|
};
|
|
@@ -175,7 +175,7 @@ function tsObjectFromSchema(schema, context) {
|
|
|
175
175
|
return `${target} += $$${prefixedTypeName}.toJsonString(${input});`;
|
|
176
176
|
},
|
|
177
177
|
toQueryStringTemplate(_input, _target) {
|
|
178
|
-
return `console.warn(
|
|
178
|
+
return `console.warn('[WARNING] Cannot serialize nested objects to query string. Skipping property at ${context.instancePath}.')`;
|
|
179
179
|
},
|
|
180
180
|
content: ""
|
|
181
181
|
};
|
|
@@ -371,7 +371,7 @@ function tsTaggedUnionFromSchema(schema, context) {
|
|
|
371
371
|
return `${target} += $$${prefixedTypeName}.toJsonString(${input});`;
|
|
372
372
|
},
|
|
373
373
|
toQueryStringTemplate(_, __, ___) {
|
|
374
|
-
return `console.warn(
|
|
374
|
+
return `console.warn('[WARNING] Cannot serialize nested objects to query string. Skipping property at ${context.instancePath}.');`;
|
|
375
375
|
},
|
|
376
376
|
content: ""
|
|
377
377
|
};
|
|
@@ -883,7 +883,7 @@ function tsRefFromSchema(schema, context) {
|
|
|
883
883
|
return `${target} += $$${prefixedTypeName}.toJsonString(${input});`;
|
|
884
884
|
},
|
|
885
885
|
toQueryStringTemplate(_, __, ___) {
|
|
886
|
-
return `console.warn(
|
|
886
|
+
return `console.warn('[WARNING] Nested objects cannot be serialized to query string. Ignoring property at ${context.instancePath}.');`;
|
|
887
887
|
},
|
|
888
888
|
content: ""
|
|
889
889
|
};
|
|
@@ -909,8 +909,8 @@ function tsRpcFromDefinition(def, context) {
|
|
|
909
909
|
}
|
|
910
910
|
function httpRpcFromDefinition(def, context) {
|
|
911
911
|
const key = getRpcKey(context);
|
|
912
|
-
const params = def.params ? `${context.typePrefix}${pascalCase(validVarName(def.params))}` :
|
|
913
|
-
const response = def.response ? `${context.typePrefix}${pascalCase(validVarName(def.response), { normalize: true })}` :
|
|
912
|
+
const params = def.params ? `${context.typePrefix}${pascalCase(validVarName(def.params))}` : undefined;
|
|
913
|
+
const response = def.response ? `${context.typePrefix}${pascalCase(validVarName(def.response), { normalize: true })}` : undefined;
|
|
914
914
|
const serializerMethod = def.method === "get" ? "toUrlQueryString" : "toJsonString";
|
|
915
915
|
if (def.isEventStream) {
|
|
916
916
|
context.usedFeatures.sse = true;
|
|
@@ -954,8 +954,8 @@ function httpRpcFromDefinition(def, context) {
|
|
|
954
954
|
function wsRpcFromDefinition(def, context) {
|
|
955
955
|
context.usedFeatures.ws = true;
|
|
956
956
|
const key = getRpcKey(context);
|
|
957
|
-
const params = def.params ? `${context.typePrefix}${pascalCase(validVarName(def.params))}` :
|
|
958
|
-
const response = def.response ? `${context.typePrefix}${pascalCase(validVarName(def.response), { normalize: true })}` :
|
|
957
|
+
const params = def.params ? `${context.typePrefix}${pascalCase(validVarName(def.params))}` : undefined;
|
|
958
|
+
const response = def.response ? `${context.typePrefix}${pascalCase(validVarName(def.response), { normalize: true })}` : undefined;
|
|
959
959
|
return `${getJsDocComment({
|
|
960
960
|
description: def.description,
|
|
961
961
|
isDeprecated: def.isDeprecated
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arrirpc/codegen-ts",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.71.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"prettier": "^3.4.2",
|
|
26
|
-
"@arrirpc/codegen-utils": "0.
|
|
26
|
+
"@arrirpc/codegen-utils": "0.71.1"
|
|
27
27
|
}
|
|
28
28
|
}
|