@arrirpc/codegen-ts 0.83.1 → 0.84.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 +419 -221
- package/dist/index.d.cts +29 -5
- package/dist/index.d.mts +29 -5
- package/dist/index.d.ts +29 -5
- package/dist/index.mjs +419 -222
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -15,9 +15,11 @@ interface TsProperty {
|
|
|
15
15
|
validationTemplate: (input: string) => string;
|
|
16
16
|
fromJsonTemplate: (input: string, target: string) => string;
|
|
17
17
|
toJsonTemplate: (input: string, target: string, key: string) => string;
|
|
18
|
-
|
|
18
|
+
cloneTemplate: (input: string, target: string) => string;
|
|
19
|
+
setSearchParamTemplate: (input: string, target: string, key: string) => string;
|
|
19
20
|
content: string;
|
|
20
21
|
}
|
|
22
|
+
declare function defaultCloneTemplate(input: string, target: string): string;
|
|
21
23
|
interface CodegenContext {
|
|
22
24
|
clientName: string;
|
|
23
25
|
typePrefix: string;
|
|
@@ -28,11 +30,16 @@ interface CodegenContext {
|
|
|
28
30
|
discriminatorKey: string;
|
|
29
31
|
discriminatorValue: string;
|
|
30
32
|
versionNumber: string;
|
|
31
|
-
|
|
33
|
+
useRpcTypes: {
|
|
32
34
|
sse: boolean;
|
|
33
35
|
ws: boolean;
|
|
34
36
|
};
|
|
35
37
|
rpcGenerators: Partial<Record<string, RpcGenerator>>;
|
|
38
|
+
features: {
|
|
39
|
+
validateFn: boolean;
|
|
40
|
+
cloneFn: boolean;
|
|
41
|
+
validatorObj: boolean;
|
|
42
|
+
};
|
|
36
43
|
}
|
|
37
44
|
declare function getJsDocComment(metadata: Schema['metadata']): string;
|
|
38
45
|
declare function validVarName(name: string): string;
|
|
@@ -73,13 +80,30 @@ interface TypescriptGeneratorOptions {
|
|
|
73
80
|
*/
|
|
74
81
|
rpcGenerators?: Partial<Record<RpcDefinition['transport'], RpcGenerator>>;
|
|
75
82
|
/**
|
|
76
|
-
*
|
|
83
|
+
* Enable or disable additional features
|
|
77
84
|
*/
|
|
78
|
-
|
|
85
|
+
features?: {
|
|
86
|
+
/**
|
|
87
|
+
* When enabled the generator will output a "validate()" function that acts as a type guard for the type
|
|
88
|
+
* (Default false)
|
|
89
|
+
*/
|
|
90
|
+
validateFn?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* When enabled the generate will output a "clone()" function that performs a deep copy of the type
|
|
93
|
+
* (Default false)
|
|
94
|
+
*/
|
|
95
|
+
cloneFn?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* When enabled the generator will output a validator object that contains
|
|
98
|
+
* all of the generated parsing, serializing, and helper functions
|
|
99
|
+
* (Default true)
|
|
100
|
+
*/
|
|
101
|
+
validatorObj?: boolean;
|
|
102
|
+
};
|
|
79
103
|
}
|
|
80
104
|
declare const typescriptClientGenerator: _arrirpc_codegen_utils.GeneratorPlugin<TypescriptGeneratorOptions>;
|
|
81
105
|
declare function createTypescriptClient(def: AppDefinition, options: TypescriptGeneratorOptions): Promise<string>;
|
|
82
106
|
declare function tsTypeFromSchema(schema: Schema, context: CodegenContext): TsProperty;
|
|
83
107
|
|
|
84
|
-
export { createTypescriptClient, defineRpcGenerator, getJsDocComment, getRpcKey, getTsTypeName, httpRpcFromDefinition, tsRpcFromDefinition, tsTypeFromSchema, typescriptClientGenerator, validVarName, wsRpcFromDefinition };
|
|
108
|
+
export { createTypescriptClient, defaultCloneTemplate, defineRpcGenerator, getJsDocComment, getRpcKey, getTsTypeName, httpRpcFromDefinition, tsRpcFromDefinition, tsTypeFromSchema, typescriptClientGenerator, validVarName, wsRpcFromDefinition };
|
|
85
109
|
export type { CodegenContext, RpcGenerator, TsProperty, TypescriptGeneratorOptions };
|
package/dist/index.d.mts
CHANGED
|
@@ -15,9 +15,11 @@ interface TsProperty {
|
|
|
15
15
|
validationTemplate: (input: string) => string;
|
|
16
16
|
fromJsonTemplate: (input: string, target: string) => string;
|
|
17
17
|
toJsonTemplate: (input: string, target: string, key: string) => string;
|
|
18
|
-
|
|
18
|
+
cloneTemplate: (input: string, target: string) => string;
|
|
19
|
+
setSearchParamTemplate: (input: string, target: string, key: string) => string;
|
|
19
20
|
content: string;
|
|
20
21
|
}
|
|
22
|
+
declare function defaultCloneTemplate(input: string, target: string): string;
|
|
21
23
|
interface CodegenContext {
|
|
22
24
|
clientName: string;
|
|
23
25
|
typePrefix: string;
|
|
@@ -28,11 +30,16 @@ interface CodegenContext {
|
|
|
28
30
|
discriminatorKey: string;
|
|
29
31
|
discriminatorValue: string;
|
|
30
32
|
versionNumber: string;
|
|
31
|
-
|
|
33
|
+
useRpcTypes: {
|
|
32
34
|
sse: boolean;
|
|
33
35
|
ws: boolean;
|
|
34
36
|
};
|
|
35
37
|
rpcGenerators: Partial<Record<string, RpcGenerator>>;
|
|
38
|
+
features: {
|
|
39
|
+
validateFn: boolean;
|
|
40
|
+
cloneFn: boolean;
|
|
41
|
+
validatorObj: boolean;
|
|
42
|
+
};
|
|
36
43
|
}
|
|
37
44
|
declare function getJsDocComment(metadata: Schema['metadata']): string;
|
|
38
45
|
declare function validVarName(name: string): string;
|
|
@@ -73,13 +80,30 @@ interface TypescriptGeneratorOptions {
|
|
|
73
80
|
*/
|
|
74
81
|
rpcGenerators?: Partial<Record<RpcDefinition['transport'], RpcGenerator>>;
|
|
75
82
|
/**
|
|
76
|
-
*
|
|
83
|
+
* Enable or disable additional features
|
|
77
84
|
*/
|
|
78
|
-
|
|
85
|
+
features?: {
|
|
86
|
+
/**
|
|
87
|
+
* When enabled the generator will output a "validate()" function that acts as a type guard for the type
|
|
88
|
+
* (Default false)
|
|
89
|
+
*/
|
|
90
|
+
validateFn?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* When enabled the generate will output a "clone()" function that performs a deep copy of the type
|
|
93
|
+
* (Default false)
|
|
94
|
+
*/
|
|
95
|
+
cloneFn?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* When enabled the generator will output a validator object that contains
|
|
98
|
+
* all of the generated parsing, serializing, and helper functions
|
|
99
|
+
* (Default true)
|
|
100
|
+
*/
|
|
101
|
+
validatorObj?: boolean;
|
|
102
|
+
};
|
|
79
103
|
}
|
|
80
104
|
declare const typescriptClientGenerator: _arrirpc_codegen_utils.GeneratorPlugin<TypescriptGeneratorOptions>;
|
|
81
105
|
declare function createTypescriptClient(def: AppDefinition, options: TypescriptGeneratorOptions): Promise<string>;
|
|
82
106
|
declare function tsTypeFromSchema(schema: Schema, context: CodegenContext): TsProperty;
|
|
83
107
|
|
|
84
|
-
export { createTypescriptClient, defineRpcGenerator, getJsDocComment, getRpcKey, getTsTypeName, httpRpcFromDefinition, tsRpcFromDefinition, tsTypeFromSchema, typescriptClientGenerator, validVarName, wsRpcFromDefinition };
|
|
108
|
+
export { createTypescriptClient, defaultCloneTemplate, defineRpcGenerator, getJsDocComment, getRpcKey, getTsTypeName, httpRpcFromDefinition, tsRpcFromDefinition, tsTypeFromSchema, typescriptClientGenerator, validVarName, wsRpcFromDefinition };
|
|
85
109
|
export type { CodegenContext, RpcGenerator, TsProperty, TypescriptGeneratorOptions };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,9 +15,11 @@ interface TsProperty {
|
|
|
15
15
|
validationTemplate: (input: string) => string;
|
|
16
16
|
fromJsonTemplate: (input: string, target: string) => string;
|
|
17
17
|
toJsonTemplate: (input: string, target: string, key: string) => string;
|
|
18
|
-
|
|
18
|
+
cloneTemplate: (input: string, target: string) => string;
|
|
19
|
+
setSearchParamTemplate: (input: string, target: string, key: string) => string;
|
|
19
20
|
content: string;
|
|
20
21
|
}
|
|
22
|
+
declare function defaultCloneTemplate(input: string, target: string): string;
|
|
21
23
|
interface CodegenContext {
|
|
22
24
|
clientName: string;
|
|
23
25
|
typePrefix: string;
|
|
@@ -28,11 +30,16 @@ interface CodegenContext {
|
|
|
28
30
|
discriminatorKey: string;
|
|
29
31
|
discriminatorValue: string;
|
|
30
32
|
versionNumber: string;
|
|
31
|
-
|
|
33
|
+
useRpcTypes: {
|
|
32
34
|
sse: boolean;
|
|
33
35
|
ws: boolean;
|
|
34
36
|
};
|
|
35
37
|
rpcGenerators: Partial<Record<string, RpcGenerator>>;
|
|
38
|
+
features: {
|
|
39
|
+
validateFn: boolean;
|
|
40
|
+
cloneFn: boolean;
|
|
41
|
+
validatorObj: boolean;
|
|
42
|
+
};
|
|
36
43
|
}
|
|
37
44
|
declare function getJsDocComment(metadata: Schema['metadata']): string;
|
|
38
45
|
declare function validVarName(name: string): string;
|
|
@@ -73,13 +80,30 @@ interface TypescriptGeneratorOptions {
|
|
|
73
80
|
*/
|
|
74
81
|
rpcGenerators?: Partial<Record<RpcDefinition['transport'], RpcGenerator>>;
|
|
75
82
|
/**
|
|
76
|
-
*
|
|
83
|
+
* Enable or disable additional features
|
|
77
84
|
*/
|
|
78
|
-
|
|
85
|
+
features?: {
|
|
86
|
+
/**
|
|
87
|
+
* When enabled the generator will output a "validate()" function that acts as a type guard for the type
|
|
88
|
+
* (Default false)
|
|
89
|
+
*/
|
|
90
|
+
validateFn?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* When enabled the generate will output a "clone()" function that performs a deep copy of the type
|
|
93
|
+
* (Default false)
|
|
94
|
+
*/
|
|
95
|
+
cloneFn?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* When enabled the generator will output a validator object that contains
|
|
98
|
+
* all of the generated parsing, serializing, and helper functions
|
|
99
|
+
* (Default true)
|
|
100
|
+
*/
|
|
101
|
+
validatorObj?: boolean;
|
|
102
|
+
};
|
|
79
103
|
}
|
|
80
104
|
declare const typescriptClientGenerator: _arrirpc_codegen_utils.GeneratorPlugin<TypescriptGeneratorOptions>;
|
|
81
105
|
declare function createTypescriptClient(def: AppDefinition, options: TypescriptGeneratorOptions): Promise<string>;
|
|
82
106
|
declare function tsTypeFromSchema(schema: Schema, context: CodegenContext): TsProperty;
|
|
83
107
|
|
|
84
|
-
export { createTypescriptClient, defineRpcGenerator, getJsDocComment, getRpcKey, getTsTypeName, httpRpcFromDefinition, tsRpcFromDefinition, tsTypeFromSchema, typescriptClientGenerator, validVarName, wsRpcFromDefinition };
|
|
108
|
+
export { createTypescriptClient, defaultCloneTemplate, defineRpcGenerator, getJsDocComment, getRpcKey, getTsTypeName, httpRpcFromDefinition, tsRpcFromDefinition, tsTypeFromSchema, typescriptClientGenerator, validVarName, wsRpcFromDefinition };
|
|
85
109
|
export type { CodegenContext, RpcGenerator, TsProperty, TypescriptGeneratorOptions };
|