@arrirpc/codegen-utils 0.50.0 → 0.51.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +7 -7
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.mjs +5 -5
- package/dist/testModels.cjs +2 -2
- package/dist/testModels.mjs +2 -2
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
@@ -20,13 +20,13 @@ const isHttpMethod = (input) => {
|
|
20
20
|
const isRpcHttpMethod = (input) => {
|
21
21
|
return isHttpMethod(input) && input !== "head";
|
22
22
|
};
|
23
|
-
const SCHEMA_VERSION = "0.0.
|
23
|
+
const SCHEMA_VERSION = "0.0.6";
|
24
24
|
function isAppDefinition(input) {
|
25
25
|
if (typeof input !== "object") {
|
26
26
|
return false;
|
27
27
|
}
|
28
28
|
const inputObj = input;
|
29
|
-
if (typeof inputObj.
|
29
|
+
if (typeof inputObj.schemaVersion !== "string") {
|
30
30
|
return false;
|
31
31
|
}
|
32
32
|
if (typeof inputObj.procedures !== "object") {
|
@@ -138,7 +138,7 @@ function normalizeWhitespace(input) {
|
|
138
138
|
}
|
139
139
|
return result;
|
140
140
|
}
|
141
|
-
function
|
141
|
+
function defineGeneratorPlugin(plugin) {
|
142
142
|
return plugin;
|
143
143
|
}
|
144
144
|
function createAppDefinition(input) {
|
@@ -165,7 +165,7 @@ function createAppDefinition(input) {
|
|
165
165
|
};
|
166
166
|
}
|
167
167
|
const result = {
|
168
|
-
|
168
|
+
schemaVersion: "0.0.6",
|
169
169
|
...input,
|
170
170
|
procedures,
|
171
171
|
definitions
|
@@ -176,7 +176,7 @@ function createAppDefinition(input) {
|
|
176
176
|
exports.HttpMethodValues = HttpMethodValues;
|
177
177
|
exports.SCHEMA_VERSION = SCHEMA_VERSION;
|
178
178
|
exports.createAppDefinition = createAppDefinition;
|
179
|
-
exports.
|
179
|
+
exports.defineGeneratorPlugin = defineGeneratorPlugin;
|
180
180
|
exports.isAppDefinition = isAppDefinition;
|
181
181
|
exports.isHttpMethod = isHttpMethod;
|
182
182
|
exports.isRpcDefinition = isRpcDefinition;
|
package/dist/index.d.cts
CHANGED
@@ -7,9 +7,9 @@ type HttpMethod = (typeof HttpMethodValues)[number];
|
|
7
7
|
type RpcHttpMethod = Exclude<HttpMethod, "head">;
|
8
8
|
declare const isHttpMethod: (input: any) => input is "get" | "post" | "put" | "patch" | "delete" | "head";
|
9
9
|
declare const isRpcHttpMethod: (input: any) => input is RpcHttpMethod;
|
10
|
-
declare const SCHEMA_VERSION = "0.0.
|
10
|
+
declare const SCHEMA_VERSION = "0.0.6";
|
11
11
|
interface AppDefinition {
|
12
|
-
|
12
|
+
schemaVersion: typeof SCHEMA_VERSION;
|
13
13
|
info?: {
|
14
14
|
title?: string;
|
15
15
|
description?: string;
|
@@ -56,17 +56,17 @@ declare const removeDisallowedChars: (input: string, disallowedChars: string) =>
|
|
56
56
|
declare const stringStartsWithNumber: (input: string) => boolean;
|
57
57
|
declare function setNestedObjectProperty<T>(targetProp: string, value: T, object: Record<any, any>): Record<any, any>;
|
58
58
|
declare function normalizeWhitespace(input: string): string;
|
59
|
-
interface
|
59
|
+
interface Generator<TOptions extends Record<string, any> | undefined> {
|
60
60
|
generator: (def: AppDefinition, isDevServer?: boolean) => any;
|
61
61
|
options: TOptions;
|
62
62
|
}
|
63
|
-
type
|
64
|
-
declare function
|
63
|
+
type GeneratorPlugin<TOptions extends Record<string, any> | undefined> = (options: TOptions) => Generator<TOptions>;
|
64
|
+
declare function defineGeneratorPlugin<TOptions extends Record<string, any> | undefined>(plugin: GeneratorPlugin<TOptions>): GeneratorPlugin<TOptions>;
|
65
65
|
type RpcDefinitionHelper = RpcDefinition<SchemaFormProperties | SchemaFormDiscriminator>;
|
66
|
-
type AppDefinitionHelper = Omit<AppDefinition, "procedures" | "definitions" | "
|
66
|
+
type AppDefinitionHelper = Omit<AppDefinition, "procedures" | "definitions" | "schemaVersion"> & {
|
67
67
|
procedures: Record<string, RpcDefinitionHelper>;
|
68
68
|
definitions?: AppDefinition["definitions"];
|
69
69
|
};
|
70
70
|
declare function createAppDefinition(input: AppDefinitionHelper): AppDefinition;
|
71
71
|
|
72
|
-
export { type AppDefinition, type
|
72
|
+
export { type AppDefinition, type CustomRpcDefinition, type Generator, type GeneratorPlugin, type HttpMethod, HttpMethodValues, type HttpRpcDefinition, type RpcDefinition, type RpcDefinitionBase, type RpcHttpMethod, SCHEMA_VERSION, type ServiceDefinition, type WsRpcDefinition, createAppDefinition, defineGeneratorPlugin, isAppDefinition, isHttpMethod, isRpcDefinition, isRpcDefinitionBase, isRpcHttpMethod, isServiceDefinition, normalizeWhitespace, removeDisallowedChars, setNestedObjectProperty, stringStartsWithNumber, unflattenObject, unflattenProcedures };
|
package/dist/index.d.mts
CHANGED
@@ -7,9 +7,9 @@ type HttpMethod = (typeof HttpMethodValues)[number];
|
|
7
7
|
type RpcHttpMethod = Exclude<HttpMethod, "head">;
|
8
8
|
declare const isHttpMethod: (input: any) => input is "get" | "post" | "put" | "patch" | "delete" | "head";
|
9
9
|
declare const isRpcHttpMethod: (input: any) => input is RpcHttpMethod;
|
10
|
-
declare const SCHEMA_VERSION = "0.0.
|
10
|
+
declare const SCHEMA_VERSION = "0.0.6";
|
11
11
|
interface AppDefinition {
|
12
|
-
|
12
|
+
schemaVersion: typeof SCHEMA_VERSION;
|
13
13
|
info?: {
|
14
14
|
title?: string;
|
15
15
|
description?: string;
|
@@ -56,17 +56,17 @@ declare const removeDisallowedChars: (input: string, disallowedChars: string) =>
|
|
56
56
|
declare const stringStartsWithNumber: (input: string) => boolean;
|
57
57
|
declare function setNestedObjectProperty<T>(targetProp: string, value: T, object: Record<any, any>): Record<any, any>;
|
58
58
|
declare function normalizeWhitespace(input: string): string;
|
59
|
-
interface
|
59
|
+
interface Generator<TOptions extends Record<string, any> | undefined> {
|
60
60
|
generator: (def: AppDefinition, isDevServer?: boolean) => any;
|
61
61
|
options: TOptions;
|
62
62
|
}
|
63
|
-
type
|
64
|
-
declare function
|
63
|
+
type GeneratorPlugin<TOptions extends Record<string, any> | undefined> = (options: TOptions) => Generator<TOptions>;
|
64
|
+
declare function defineGeneratorPlugin<TOptions extends Record<string, any> | undefined>(plugin: GeneratorPlugin<TOptions>): GeneratorPlugin<TOptions>;
|
65
65
|
type RpcDefinitionHelper = RpcDefinition<SchemaFormProperties | SchemaFormDiscriminator>;
|
66
|
-
type AppDefinitionHelper = Omit<AppDefinition, "procedures" | "definitions" | "
|
66
|
+
type AppDefinitionHelper = Omit<AppDefinition, "procedures" | "definitions" | "schemaVersion"> & {
|
67
67
|
procedures: Record<string, RpcDefinitionHelper>;
|
68
68
|
definitions?: AppDefinition["definitions"];
|
69
69
|
};
|
70
70
|
declare function createAppDefinition(input: AppDefinitionHelper): AppDefinition;
|
71
71
|
|
72
|
-
export { type AppDefinition, type
|
72
|
+
export { type AppDefinition, type CustomRpcDefinition, type Generator, type GeneratorPlugin, type HttpMethod, HttpMethodValues, type HttpRpcDefinition, type RpcDefinition, type RpcDefinitionBase, type RpcHttpMethod, SCHEMA_VERSION, type ServiceDefinition, type WsRpcDefinition, createAppDefinition, defineGeneratorPlugin, isAppDefinition, isHttpMethod, isRpcDefinition, isRpcDefinitionBase, isRpcHttpMethod, isServiceDefinition, normalizeWhitespace, removeDisallowedChars, setNestedObjectProperty, stringStartsWithNumber, unflattenObject, unflattenProcedures };
|
package/dist/index.d.ts
CHANGED
@@ -7,9 +7,9 @@ type HttpMethod = (typeof HttpMethodValues)[number];
|
|
7
7
|
type RpcHttpMethod = Exclude<HttpMethod, "head">;
|
8
8
|
declare const isHttpMethod: (input: any) => input is "get" | "post" | "put" | "patch" | "delete" | "head";
|
9
9
|
declare const isRpcHttpMethod: (input: any) => input is RpcHttpMethod;
|
10
|
-
declare const SCHEMA_VERSION = "0.0.
|
10
|
+
declare const SCHEMA_VERSION = "0.0.6";
|
11
11
|
interface AppDefinition {
|
12
|
-
|
12
|
+
schemaVersion: typeof SCHEMA_VERSION;
|
13
13
|
info?: {
|
14
14
|
title?: string;
|
15
15
|
description?: string;
|
@@ -56,17 +56,17 @@ declare const removeDisallowedChars: (input: string, disallowedChars: string) =>
|
|
56
56
|
declare const stringStartsWithNumber: (input: string) => boolean;
|
57
57
|
declare function setNestedObjectProperty<T>(targetProp: string, value: T, object: Record<any, any>): Record<any, any>;
|
58
58
|
declare function normalizeWhitespace(input: string): string;
|
59
|
-
interface
|
59
|
+
interface Generator<TOptions extends Record<string, any> | undefined> {
|
60
60
|
generator: (def: AppDefinition, isDevServer?: boolean) => any;
|
61
61
|
options: TOptions;
|
62
62
|
}
|
63
|
-
type
|
64
|
-
declare function
|
63
|
+
type GeneratorPlugin<TOptions extends Record<string, any> | undefined> = (options: TOptions) => Generator<TOptions>;
|
64
|
+
declare function defineGeneratorPlugin<TOptions extends Record<string, any> | undefined>(plugin: GeneratorPlugin<TOptions>): GeneratorPlugin<TOptions>;
|
65
65
|
type RpcDefinitionHelper = RpcDefinition<SchemaFormProperties | SchemaFormDiscriminator>;
|
66
|
-
type AppDefinitionHelper = Omit<AppDefinition, "procedures" | "definitions" | "
|
66
|
+
type AppDefinitionHelper = Omit<AppDefinition, "procedures" | "definitions" | "schemaVersion"> & {
|
67
67
|
procedures: Record<string, RpcDefinitionHelper>;
|
68
68
|
definitions?: AppDefinition["definitions"];
|
69
69
|
};
|
70
70
|
declare function createAppDefinition(input: AppDefinitionHelper): AppDefinition;
|
71
71
|
|
72
|
-
export { type AppDefinition, type
|
72
|
+
export { type AppDefinition, type CustomRpcDefinition, type Generator, type GeneratorPlugin, type HttpMethod, HttpMethodValues, type HttpRpcDefinition, type RpcDefinition, type RpcDefinitionBase, type RpcHttpMethod, SCHEMA_VERSION, type ServiceDefinition, type WsRpcDefinition, createAppDefinition, defineGeneratorPlugin, isAppDefinition, isHttpMethod, isRpcDefinition, isRpcDefinitionBase, isRpcHttpMethod, isServiceDefinition, normalizeWhitespace, removeDisallowedChars, setNestedObjectProperty, stringStartsWithNumber, unflattenObject, unflattenProcedures };
|
package/dist/index.mjs
CHANGED
@@ -19,13 +19,13 @@ const isHttpMethod = (input) => {
|
|
19
19
|
const isRpcHttpMethod = (input) => {
|
20
20
|
return isHttpMethod(input) && input !== "head";
|
21
21
|
};
|
22
|
-
const SCHEMA_VERSION = "0.0.
|
22
|
+
const SCHEMA_VERSION = "0.0.6";
|
23
23
|
function isAppDefinition(input) {
|
24
24
|
if (typeof input !== "object") {
|
25
25
|
return false;
|
26
26
|
}
|
27
27
|
const inputObj = input;
|
28
|
-
if (typeof inputObj.
|
28
|
+
if (typeof inputObj.schemaVersion !== "string") {
|
29
29
|
return false;
|
30
30
|
}
|
31
31
|
if (typeof inputObj.procedures !== "object") {
|
@@ -137,7 +137,7 @@ function normalizeWhitespace(input) {
|
|
137
137
|
}
|
138
138
|
return result;
|
139
139
|
}
|
140
|
-
function
|
140
|
+
function defineGeneratorPlugin(plugin) {
|
141
141
|
return plugin;
|
142
142
|
}
|
143
143
|
function createAppDefinition(input) {
|
@@ -164,7 +164,7 @@ function createAppDefinition(input) {
|
|
164
164
|
};
|
165
165
|
}
|
166
166
|
const result = {
|
167
|
-
|
167
|
+
schemaVersion: "0.0.6",
|
168
168
|
...input,
|
169
169
|
procedures,
|
170
170
|
definitions
|
@@ -172,4 +172,4 @@ function createAppDefinition(input) {
|
|
172
172
|
return result;
|
173
173
|
}
|
174
174
|
|
175
|
-
export { HttpMethodValues, SCHEMA_VERSION, createAppDefinition,
|
175
|
+
export { HttpMethodValues, SCHEMA_VERSION, createAppDefinition, defineGeneratorPlugin, isAppDefinition, isHttpMethod, isRpcDefinition, isRpcDefinitionBase, isRpcHttpMethod, isServiceDefinition, normalizeWhitespace, removeDisallowedChars, setNestedObjectProperty, stringStartsWithNumber, unflattenObject, unflattenProcedures };
|
package/dist/testModels.cjs
CHANGED
@@ -67,7 +67,7 @@ const TestUpdateUserParams = schema.a.pick(
|
|
67
67
|
}
|
68
68
|
);
|
69
69
|
const TestAppDefinition = {
|
70
|
-
|
70
|
+
schemaVersion: "0.0.6",
|
71
71
|
info: {
|
72
72
|
title: "Test App Client",
|
73
73
|
description: "This is a example app definition",
|
@@ -218,7 +218,7 @@ const ExampleRecursive = schema.a.recursive(
|
|
218
218
|
{ id: "ExampleRecursive" }
|
219
219
|
);
|
220
220
|
const ReferenceAppDefinition = {
|
221
|
-
|
221
|
+
schemaVersion: "0.0.6",
|
222
222
|
procedures: {},
|
223
223
|
definitions: {
|
224
224
|
ExamplePayload,
|
package/dist/testModels.mjs
CHANGED
@@ -65,7 +65,7 @@ const TestUpdateUserParams = a.pick(
|
|
65
65
|
}
|
66
66
|
);
|
67
67
|
const TestAppDefinition = {
|
68
|
-
|
68
|
+
schemaVersion: "0.0.6",
|
69
69
|
info: {
|
70
70
|
title: "Test App Client",
|
71
71
|
description: "This is a example app definition",
|
@@ -216,7 +216,7 @@ const ExampleRecursive = a.recursive(
|
|
216
216
|
{ id: "ExampleRecursive" }
|
217
217
|
);
|
218
218
|
const ReferenceAppDefinition = {
|
219
|
-
|
219
|
+
schemaVersion: "0.0.6",
|
220
220
|
procedures: {},
|
221
221
|
definitions: {
|
222
222
|
ExamplePayload,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arrirpc/codegen-utils",
|
3
|
-
"version": "0.
|
3
|
+
"version": "0.51.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"author": {
|
6
6
|
"name": "joshmossas",
|
@@ -23,7 +23,7 @@
|
|
23
23
|
],
|
24
24
|
"dependencies": {
|
25
25
|
"scule": "^1.3.0",
|
26
|
-
"@arrirpc/schema": "0.
|
27
|
-
"jtd-utils": "0.
|
26
|
+
"@arrirpc/schema": "0.51.0",
|
27
|
+
"jtd-utils": "0.51.0"
|
28
28
|
}
|
29
29
|
}
|