@arrirpc/codegen-ts 0.54.0 → 0.57.0
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 +1118 -758
- package/dist/index.d.cts +29 -40
- package/dist/index.d.mts +29 -40
- package/dist/index.d.ts +29 -40
- package/dist/index.mjs +1119 -744
- package/package.json +5 -5
package/dist/index.d.cts
CHANGED
|
@@ -1,51 +1,40 @@
|
|
|
1
1
|
import * as _arrirpc_codegen_utils from '@arrirpc/codegen-utils';
|
|
2
|
-
import { AppDefinition,
|
|
2
|
+
import { AppDefinition, Schema } from '@arrirpc/codegen-utils';
|
|
3
3
|
import prettier from 'prettier';
|
|
4
4
|
|
|
5
|
+
interface TsProperty {
|
|
6
|
+
typeName: string;
|
|
7
|
+
defaultValue: string;
|
|
8
|
+
validationTemplate: (input: string) => string;
|
|
9
|
+
fromJsonTemplate: (input: string, target: string) => string;
|
|
10
|
+
toJsonTemplate: (input: string, target: string, key: string) => string;
|
|
11
|
+
toQueryStringTemplate: (input: string, target: string, key: string) => string;
|
|
12
|
+
content: string;
|
|
13
|
+
}
|
|
14
|
+
interface CodegenContext {
|
|
15
|
+
clientName: string;
|
|
16
|
+
typePrefix: string;
|
|
17
|
+
generatedTypes: string[];
|
|
18
|
+
instancePath: string;
|
|
19
|
+
schemaPath: string;
|
|
20
|
+
discriminatorParent: string;
|
|
21
|
+
discriminatorKey: string;
|
|
22
|
+
discriminatorValue: string;
|
|
23
|
+
versionNumber: string;
|
|
24
|
+
usedFeatures: {
|
|
25
|
+
sse: boolean;
|
|
26
|
+
ws: boolean;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
5
30
|
interface TypescriptGeneratorOptions {
|
|
6
31
|
clientName: string;
|
|
7
32
|
outputFile: string;
|
|
33
|
+
typePrefix?: string;
|
|
8
34
|
prettierOptions?: Omit<prettier.Config, "parser">;
|
|
9
35
|
}
|
|
10
36
|
declare const typescriptClientGenerator: _arrirpc_codegen_utils.GeneratorPlugin<TypescriptGeneratorOptions>;
|
|
11
37
|
declare function createTypescriptClient(def: AppDefinition, options: TypescriptGeneratorOptions): Promise<string>;
|
|
12
|
-
|
|
13
|
-
versionNumber: string;
|
|
14
|
-
typesNeedingParser: string[];
|
|
15
|
-
hasSseProcedures: boolean;
|
|
16
|
-
hasWsProcedures: boolean;
|
|
17
|
-
}
|
|
18
|
-
declare function tsRpcFromDefinition(key: string, schema: RpcDefinition, options: RpcOptions): string;
|
|
19
|
-
declare function tsHttpRpcFromDefinition(key: string, schema: HttpRpcDefinition, options: RpcOptions): string;
|
|
20
|
-
declare function tsWsRpcFromDefinition(key: string, schema: WsRpcDefinition, options: RpcOptions): string;
|
|
21
|
-
declare function tsServiceFromDefinition(name: string, schema: ServiceDefinition, options: RpcOptions): string;
|
|
22
|
-
interface AdditionalOptions {
|
|
23
|
-
isOptional: boolean;
|
|
24
|
-
existingTypeNames: string[];
|
|
25
|
-
logDef?: boolean;
|
|
26
|
-
}
|
|
27
|
-
interface TsProperty {
|
|
28
|
-
tsType: string;
|
|
29
|
-
schema: Schema;
|
|
30
|
-
fieldTemplate: string;
|
|
31
|
-
fromJsonTemplate: (input: string) => string;
|
|
32
|
-
toJsonTemplate: (input: string) => string;
|
|
33
|
-
content: string;
|
|
34
|
-
}
|
|
35
|
-
declare function tsTypeFromJtdSchema(nodePath: string, def: Schema, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
36
|
-
declare function maybeOptionalKey(keyName: string, isOptional?: boolean): string;
|
|
37
|
-
declare function maybeNullType(typeName: string, isNullable?: boolean): string;
|
|
38
|
-
declare function tsAnyFromJtdSchema(nodePath: string, def: Schema, options: TypescriptGeneratorOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
39
|
-
declare function getJsDocComment(metadata: Schema["metadata"]): string;
|
|
40
|
-
declare function tsScalarFromJtdSchema(nodePath: string, def: SchemaFormType, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
41
|
-
declare function tsObjectFromJtdSchema(nodePath: string, def: SchemaFormProperties, options: RpcOptions, additionalOptions: AdditionalOptions & {
|
|
42
|
-
discriminatorKey?: string;
|
|
43
|
-
discriminatorKeyValue?: string;
|
|
44
|
-
}): TsProperty;
|
|
45
|
-
declare function tsEnumFromJtdSchema(nodePath: string, def: SchemaFormEnum, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
46
|
-
declare function tsArrayFromJtdSchema(nodePath: string, def: SchemaFormElements, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
47
|
-
declare function tsDiscriminatedUnionFromJtdSchema(nodePath: string, def: SchemaFormDiscriminator, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
48
|
-
declare function tsRecordFromJtdSchema(nodePath: string, def: SchemaFormValues, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
49
|
-
declare function tsRefFromJtdSchema(nodePath: string, def: SchemaFormRef, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
38
|
+
declare function tsTypeFromSchema(schema: Schema, context: CodegenContext): TsProperty;
|
|
50
39
|
|
|
51
|
-
export { type TypescriptGeneratorOptions, createTypescriptClient,
|
|
40
|
+
export { type TypescriptGeneratorOptions, createTypescriptClient, tsTypeFromSchema, typescriptClientGenerator };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,51 +1,40 @@
|
|
|
1
1
|
import * as _arrirpc_codegen_utils from '@arrirpc/codegen-utils';
|
|
2
|
-
import { AppDefinition,
|
|
2
|
+
import { AppDefinition, Schema } from '@arrirpc/codegen-utils';
|
|
3
3
|
import prettier from 'prettier';
|
|
4
4
|
|
|
5
|
+
interface TsProperty {
|
|
6
|
+
typeName: string;
|
|
7
|
+
defaultValue: string;
|
|
8
|
+
validationTemplate: (input: string) => string;
|
|
9
|
+
fromJsonTemplate: (input: string, target: string) => string;
|
|
10
|
+
toJsonTemplate: (input: string, target: string, key: string) => string;
|
|
11
|
+
toQueryStringTemplate: (input: string, target: string, key: string) => string;
|
|
12
|
+
content: string;
|
|
13
|
+
}
|
|
14
|
+
interface CodegenContext {
|
|
15
|
+
clientName: string;
|
|
16
|
+
typePrefix: string;
|
|
17
|
+
generatedTypes: string[];
|
|
18
|
+
instancePath: string;
|
|
19
|
+
schemaPath: string;
|
|
20
|
+
discriminatorParent: string;
|
|
21
|
+
discriminatorKey: string;
|
|
22
|
+
discriminatorValue: string;
|
|
23
|
+
versionNumber: string;
|
|
24
|
+
usedFeatures: {
|
|
25
|
+
sse: boolean;
|
|
26
|
+
ws: boolean;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
5
30
|
interface TypescriptGeneratorOptions {
|
|
6
31
|
clientName: string;
|
|
7
32
|
outputFile: string;
|
|
33
|
+
typePrefix?: string;
|
|
8
34
|
prettierOptions?: Omit<prettier.Config, "parser">;
|
|
9
35
|
}
|
|
10
36
|
declare const typescriptClientGenerator: _arrirpc_codegen_utils.GeneratorPlugin<TypescriptGeneratorOptions>;
|
|
11
37
|
declare function createTypescriptClient(def: AppDefinition, options: TypescriptGeneratorOptions): Promise<string>;
|
|
12
|
-
|
|
13
|
-
versionNumber: string;
|
|
14
|
-
typesNeedingParser: string[];
|
|
15
|
-
hasSseProcedures: boolean;
|
|
16
|
-
hasWsProcedures: boolean;
|
|
17
|
-
}
|
|
18
|
-
declare function tsRpcFromDefinition(key: string, schema: RpcDefinition, options: RpcOptions): string;
|
|
19
|
-
declare function tsHttpRpcFromDefinition(key: string, schema: HttpRpcDefinition, options: RpcOptions): string;
|
|
20
|
-
declare function tsWsRpcFromDefinition(key: string, schema: WsRpcDefinition, options: RpcOptions): string;
|
|
21
|
-
declare function tsServiceFromDefinition(name: string, schema: ServiceDefinition, options: RpcOptions): string;
|
|
22
|
-
interface AdditionalOptions {
|
|
23
|
-
isOptional: boolean;
|
|
24
|
-
existingTypeNames: string[];
|
|
25
|
-
logDef?: boolean;
|
|
26
|
-
}
|
|
27
|
-
interface TsProperty {
|
|
28
|
-
tsType: string;
|
|
29
|
-
schema: Schema;
|
|
30
|
-
fieldTemplate: string;
|
|
31
|
-
fromJsonTemplate: (input: string) => string;
|
|
32
|
-
toJsonTemplate: (input: string) => string;
|
|
33
|
-
content: string;
|
|
34
|
-
}
|
|
35
|
-
declare function tsTypeFromJtdSchema(nodePath: string, def: Schema, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
36
|
-
declare function maybeOptionalKey(keyName: string, isOptional?: boolean): string;
|
|
37
|
-
declare function maybeNullType(typeName: string, isNullable?: boolean): string;
|
|
38
|
-
declare function tsAnyFromJtdSchema(nodePath: string, def: Schema, options: TypescriptGeneratorOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
39
|
-
declare function getJsDocComment(metadata: Schema["metadata"]): string;
|
|
40
|
-
declare function tsScalarFromJtdSchema(nodePath: string, def: SchemaFormType, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
41
|
-
declare function tsObjectFromJtdSchema(nodePath: string, def: SchemaFormProperties, options: RpcOptions, additionalOptions: AdditionalOptions & {
|
|
42
|
-
discriminatorKey?: string;
|
|
43
|
-
discriminatorKeyValue?: string;
|
|
44
|
-
}): TsProperty;
|
|
45
|
-
declare function tsEnumFromJtdSchema(nodePath: string, def: SchemaFormEnum, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
46
|
-
declare function tsArrayFromJtdSchema(nodePath: string, def: SchemaFormElements, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
47
|
-
declare function tsDiscriminatedUnionFromJtdSchema(nodePath: string, def: SchemaFormDiscriminator, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
48
|
-
declare function tsRecordFromJtdSchema(nodePath: string, def: SchemaFormValues, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
49
|
-
declare function tsRefFromJtdSchema(nodePath: string, def: SchemaFormRef, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
38
|
+
declare function tsTypeFromSchema(schema: Schema, context: CodegenContext): TsProperty;
|
|
50
39
|
|
|
51
|
-
export { type TypescriptGeneratorOptions, createTypescriptClient,
|
|
40
|
+
export { type TypescriptGeneratorOptions, createTypescriptClient, tsTypeFromSchema, typescriptClientGenerator };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,51 +1,40 @@
|
|
|
1
1
|
import * as _arrirpc_codegen_utils from '@arrirpc/codegen-utils';
|
|
2
|
-
import { AppDefinition,
|
|
2
|
+
import { AppDefinition, Schema } from '@arrirpc/codegen-utils';
|
|
3
3
|
import prettier from 'prettier';
|
|
4
4
|
|
|
5
|
+
interface TsProperty {
|
|
6
|
+
typeName: string;
|
|
7
|
+
defaultValue: string;
|
|
8
|
+
validationTemplate: (input: string) => string;
|
|
9
|
+
fromJsonTemplate: (input: string, target: string) => string;
|
|
10
|
+
toJsonTemplate: (input: string, target: string, key: string) => string;
|
|
11
|
+
toQueryStringTemplate: (input: string, target: string, key: string) => string;
|
|
12
|
+
content: string;
|
|
13
|
+
}
|
|
14
|
+
interface CodegenContext {
|
|
15
|
+
clientName: string;
|
|
16
|
+
typePrefix: string;
|
|
17
|
+
generatedTypes: string[];
|
|
18
|
+
instancePath: string;
|
|
19
|
+
schemaPath: string;
|
|
20
|
+
discriminatorParent: string;
|
|
21
|
+
discriminatorKey: string;
|
|
22
|
+
discriminatorValue: string;
|
|
23
|
+
versionNumber: string;
|
|
24
|
+
usedFeatures: {
|
|
25
|
+
sse: boolean;
|
|
26
|
+
ws: boolean;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
5
30
|
interface TypescriptGeneratorOptions {
|
|
6
31
|
clientName: string;
|
|
7
32
|
outputFile: string;
|
|
33
|
+
typePrefix?: string;
|
|
8
34
|
prettierOptions?: Omit<prettier.Config, "parser">;
|
|
9
35
|
}
|
|
10
36
|
declare const typescriptClientGenerator: _arrirpc_codegen_utils.GeneratorPlugin<TypescriptGeneratorOptions>;
|
|
11
37
|
declare function createTypescriptClient(def: AppDefinition, options: TypescriptGeneratorOptions): Promise<string>;
|
|
12
|
-
|
|
13
|
-
versionNumber: string;
|
|
14
|
-
typesNeedingParser: string[];
|
|
15
|
-
hasSseProcedures: boolean;
|
|
16
|
-
hasWsProcedures: boolean;
|
|
17
|
-
}
|
|
18
|
-
declare function tsRpcFromDefinition(key: string, schema: RpcDefinition, options: RpcOptions): string;
|
|
19
|
-
declare function tsHttpRpcFromDefinition(key: string, schema: HttpRpcDefinition, options: RpcOptions): string;
|
|
20
|
-
declare function tsWsRpcFromDefinition(key: string, schema: WsRpcDefinition, options: RpcOptions): string;
|
|
21
|
-
declare function tsServiceFromDefinition(name: string, schema: ServiceDefinition, options: RpcOptions): string;
|
|
22
|
-
interface AdditionalOptions {
|
|
23
|
-
isOptional: boolean;
|
|
24
|
-
existingTypeNames: string[];
|
|
25
|
-
logDef?: boolean;
|
|
26
|
-
}
|
|
27
|
-
interface TsProperty {
|
|
28
|
-
tsType: string;
|
|
29
|
-
schema: Schema;
|
|
30
|
-
fieldTemplate: string;
|
|
31
|
-
fromJsonTemplate: (input: string) => string;
|
|
32
|
-
toJsonTemplate: (input: string) => string;
|
|
33
|
-
content: string;
|
|
34
|
-
}
|
|
35
|
-
declare function tsTypeFromJtdSchema(nodePath: string, def: Schema, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
36
|
-
declare function maybeOptionalKey(keyName: string, isOptional?: boolean): string;
|
|
37
|
-
declare function maybeNullType(typeName: string, isNullable?: boolean): string;
|
|
38
|
-
declare function tsAnyFromJtdSchema(nodePath: string, def: Schema, options: TypescriptGeneratorOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
39
|
-
declare function getJsDocComment(metadata: Schema["metadata"]): string;
|
|
40
|
-
declare function tsScalarFromJtdSchema(nodePath: string, def: SchemaFormType, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
41
|
-
declare function tsObjectFromJtdSchema(nodePath: string, def: SchemaFormProperties, options: RpcOptions, additionalOptions: AdditionalOptions & {
|
|
42
|
-
discriminatorKey?: string;
|
|
43
|
-
discriminatorKeyValue?: string;
|
|
44
|
-
}): TsProperty;
|
|
45
|
-
declare function tsEnumFromJtdSchema(nodePath: string, def: SchemaFormEnum, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
46
|
-
declare function tsArrayFromJtdSchema(nodePath: string, def: SchemaFormElements, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
47
|
-
declare function tsDiscriminatedUnionFromJtdSchema(nodePath: string, def: SchemaFormDiscriminator, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
48
|
-
declare function tsRecordFromJtdSchema(nodePath: string, def: SchemaFormValues, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
49
|
-
declare function tsRefFromJtdSchema(nodePath: string, def: SchemaFormRef, options: RpcOptions, additionalOptions: AdditionalOptions): TsProperty;
|
|
38
|
+
declare function tsTypeFromSchema(schema: Schema, context: CodegenContext): TsProperty;
|
|
50
39
|
|
|
51
|
-
export { type TypescriptGeneratorOptions, createTypescriptClient,
|
|
40
|
+
export { type TypescriptGeneratorOptions, createTypescriptClient, tsTypeFromSchema, typescriptClientGenerator };
|