@arrirpc/codegen-utils 0.69.1 → 0.70.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 CHANGED
@@ -1,89 +1,13 @@
1
1
  'use strict';
2
2
 
3
+ const typeDefs = require('@arrirpc/type-defs');
3
4
  const scule = require('scule');
4
- const jtdUtils = require('jtd-utils');
5
5
 
6
- const HttpMethodValues = [
7
- "get",
8
- "post",
9
- "put",
10
- "patch",
11
- "delete",
12
- "head"
13
- ];
14
- const isHttpMethod = (input) => {
15
- if (typeof input !== "string") {
16
- return false;
17
- }
18
- return HttpMethodValues.includes(input);
19
- };
20
- const isRpcHttpMethod = (input) => {
21
- return isHttpMethod(input) && input !== "head";
22
- };
23
- const SCHEMA_VERSION = "0.0.7";
24
- function isAppDefinition(input) {
25
- if (typeof input !== "object") {
26
- return false;
27
- }
28
- const inputObj = input;
29
- if (typeof inputObj.schemaVersion !== "string") {
30
- return false;
31
- }
32
- if (typeof inputObj.procedures !== "object") {
33
- return false;
34
- }
35
- if (typeof inputObj.definitions !== "object") {
36
- return false;
37
- }
38
- return true;
39
- }
40
- function isRpcDefinitionBase(input) {
41
- if (typeof input !== "object" || input === null) {
42
- return false;
43
- }
44
- if ("params" in input && typeof input.params !== "undefined" && typeof input.params !== "string") {
45
- return false;
46
- }
47
- if ("response" in input && typeof input.response !== "undefined" && typeof input.response !== "string") {
48
- return false;
49
- }
50
- return "transport" in input && typeof input.transport === "string" && input.transport.length > 0 && "path" in input && typeof input.path === "string" && input.path.length > 0;
51
- }
52
- function isRpcDefinition(input) {
53
- if (!isRpcDefinitionBase(input)) {
54
- return false;
55
- }
56
- if (!("transport" in input) || typeof input.transport !== "string") {
57
- return false;
58
- }
59
- if (input.transport === "http") {
60
- return "method" in input && isRpcHttpMethod(input.method);
61
- }
62
- if (input.transport === "ws") {
63
- return true;
64
- }
65
- if (input.transport.startsWith("custom:")) {
66
- return true;
67
- }
68
- return false;
69
- }
70
- function isServiceDefinition(input) {
71
- if (typeof input !== "object") {
72
- return false;
73
- }
74
- for (const key of Object.keys(input)) {
75
- if (typeof input[key] !== "object") {
76
- return false;
77
- }
78
- }
79
- return true;
80
- }
81
6
  function unflattenProcedures(procedures) {
82
7
  return unflattenObject(procedures);
83
8
  }
84
9
  function unflattenObject(data) {
85
- if (Object(data) !== data || Array.isArray(data))
86
- return data;
10
+ if (Object(data) !== data || Array.isArray(data)) return data;
87
11
  const regex = /\.?([^.[\]]+)|\[(\d+)\]/g;
88
12
  const result = {};
89
13
  for (const p in data) {
@@ -138,60 +62,30 @@ function normalizeWhitespace(input) {
138
62
  }
139
63
  return result;
140
64
  }
141
- function defineGeneratorPlugin(plugin) {
142
- return plugin;
143
- }
144
- function createAppDefinition(input) {
145
- const definitions = { ...input.definitions };
146
- const procedures = {};
147
- for (const key of Object.keys(input.procedures)) {
148
- const def = input.procedures[key];
149
- let paramName;
150
- if (def.params) {
151
- paramName = def.params.metadata?.id ?? scule.pascalCase(`${key.split(".").join("_")}Params`);
152
- definitions[paramName] = def.params;
153
- }
154
- let responseName;
155
- if (def.response) {
156
- responseName = def.response.metadata?.id ?? scule.pascalCase(`${key.split(".").join("_")}Response`);
157
- definitions[responseName] = def.response;
158
- }
159
- delete def.params;
160
- delete def.response;
161
- procedures[key] = {
162
- ...def,
163
- params: paramName,
164
- response: responseName
165
- };
166
- }
167
- const result = {
168
- schemaVersion: "0.0.7",
169
- ...input,
170
- procedures,
171
- definitions
172
- };
173
- return result;
174
- }
175
65
 
176
- exports.HttpMethodValues = HttpMethodValues;
177
- exports.SCHEMA_VERSION = SCHEMA_VERSION;
178
- exports.createAppDefinition = createAppDefinition;
179
- exports.defineGeneratorPlugin = defineGeneratorPlugin;
180
- exports.isAppDefinition = isAppDefinition;
181
- exports.isHttpMethod = isHttpMethod;
182
- exports.isRpcDefinition = isRpcDefinition;
183
- exports.isRpcDefinitionBase = isRpcDefinitionBase;
184
- exports.isRpcHttpMethod = isRpcHttpMethod;
185
- exports.isServiceDefinition = isServiceDefinition;
186
66
  exports.normalizeWhitespace = normalizeWhitespace;
187
67
  exports.removeDisallowedChars = removeDisallowedChars;
188
68
  exports.setNestedObjectProperty = setNestedObjectProperty;
189
69
  exports.stringStartsWithNumber = stringStartsWithNumber;
190
70
  exports.unflattenObject = unflattenObject;
191
71
  exports.unflattenProcedures = unflattenProcedures;
72
+ Object.prototype.hasOwnProperty.call(typeDefs, '__proto__') &&
73
+ !Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
74
+ Object.defineProperty(exports, '__proto__', {
75
+ enumerable: true,
76
+ value: typeDefs['__proto__']
77
+ });
78
+
79
+ Object.keys(typeDefs).forEach(function (k) {
80
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = typeDefs[k];
81
+ });
82
+ Object.prototype.hasOwnProperty.call(scule, '__proto__') &&
83
+ !Object.prototype.hasOwnProperty.call(exports, '__proto__') &&
84
+ Object.defineProperty(exports, '__proto__', {
85
+ enumerable: true,
86
+ value: scule['__proto__']
87
+ });
88
+
192
89
  Object.keys(scule).forEach(function (k) {
193
90
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = scule[k];
194
91
  });
195
- Object.keys(jtdUtils).forEach(function (k) {
196
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) exports[k] = jtdUtils[k];
197
- });
package/dist/index.d.cts CHANGED
@@ -1,72 +1,12 @@
1
- import { Schema, SchemaFormProperties, SchemaFormDiscriminator } from 'jtd-utils';
2
- export * from 'jtd-utils';
1
+ import { AppDefinition, RpcDefinition, ServiceDefinition } from '@arrirpc/type-defs';
2
+ export * from '@arrirpc/type-defs';
3
3
  export * from 'scule';
4
4
 
5
- declare const HttpMethodValues: readonly ["get", "post", "put", "patch", "delete", "head"];
6
- type HttpMethod = (typeof HttpMethodValues)[number];
7
- type RpcHttpMethod = Exclude<HttpMethod, "head">;
8
- declare const isHttpMethod: (input: any) => input is HttpMethod;
9
- declare const isRpcHttpMethod: (input: any) => input is RpcHttpMethod;
10
- declare const SCHEMA_VERSION = "0.0.7";
11
- interface AppDefinition {
12
- schemaVersion: typeof SCHEMA_VERSION;
13
- info?: {
14
- title?: string;
15
- description?: string;
16
- version?: string;
17
- [key: string]: string | undefined;
18
- };
19
- externalDocs?: {
20
- description?: string;
21
- url: string;
22
- };
23
- procedures: Record<string, RpcDefinition<string>>;
24
- definitions: Record<string, Schema>;
25
- }
26
- declare function isAppDefinition(input: unknown): input is AppDefinition;
27
- interface RpcDefinitionBase<T = string> {
28
- path: string;
29
- params?: T;
30
- response?: T;
31
- description?: string;
32
- isDeprecated?: boolean;
33
- }
34
- interface HttpRpcDefinition<T = string> extends RpcDefinitionBase<T> {
35
- transport: "http";
36
- method: RpcHttpMethod;
37
- isEventStream?: boolean;
38
- }
39
- interface WsRpcDefinition<T = string> extends RpcDefinitionBase<T> {
40
- transport: "ws";
41
- }
42
- interface CustomRpcDefinition<T = string> extends RpcDefinitionBase<T> {
43
- transport: `custom:${string}`;
44
- [key: string]: unknown;
45
- }
46
- type RpcDefinition<T = string> = HttpRpcDefinition<T> | WsRpcDefinition<T> | CustomRpcDefinition<T>;
47
- declare function isRpcDefinitionBase(input: unknown): input is RpcDefinitionBase;
48
- declare function isRpcDefinition(input: unknown): input is RpcDefinition;
49
- interface ServiceDefinition {
50
- [key: string]: RpcDefinition | ServiceDefinition;
51
- }
52
- declare function isServiceDefinition(input: any): input is ServiceDefinition;
53
5
  declare function unflattenProcedures(procedures: AppDefinition["procedures"]): Record<string, RpcDefinition | ServiceDefinition>;
54
6
  declare function unflattenObject(data: Record<string, any>): any;
55
7
  declare const removeDisallowedChars: (input: string, disallowedChars: string) => string;
56
8
  declare const stringStartsWithNumber: (input: string) => boolean;
57
9
  declare function setNestedObjectProperty<T>(targetProp: string, value: T, object: Record<any, any>): Record<any, any>;
58
10
  declare function normalizeWhitespace(input: string): string;
59
- interface Generator<TOptions extends Record<string, any> | undefined> {
60
- run: (def: AppDefinition, isDevServer?: boolean) => any;
61
- options: TOptions;
62
- }
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
- type RpcDefinitionHelper = RpcDefinition<SchemaFormProperties | SchemaFormDiscriminator>;
66
- type AppDefinitionHelper = Omit<AppDefinition, "procedures" | "definitions" | "schemaVersion"> & {
67
- procedures: Record<string, RpcDefinitionHelper>;
68
- definitions?: AppDefinition["definitions"];
69
- };
70
- declare function createAppDefinition(input: AppDefinitionHelper): AppDefinition;
71
11
 
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 };
12
+ export { normalizeWhitespace, removeDisallowedChars, setNestedObjectProperty, stringStartsWithNumber, unflattenObject, unflattenProcedures };
package/dist/index.d.mts CHANGED
@@ -1,72 +1,12 @@
1
- import { Schema, SchemaFormProperties, SchemaFormDiscriminator } from 'jtd-utils';
2
- export * from 'jtd-utils';
1
+ import { AppDefinition, RpcDefinition, ServiceDefinition } from '@arrirpc/type-defs';
2
+ export * from '@arrirpc/type-defs';
3
3
  export * from 'scule';
4
4
 
5
- declare const HttpMethodValues: readonly ["get", "post", "put", "patch", "delete", "head"];
6
- type HttpMethod = (typeof HttpMethodValues)[number];
7
- type RpcHttpMethod = Exclude<HttpMethod, "head">;
8
- declare const isHttpMethod: (input: any) => input is HttpMethod;
9
- declare const isRpcHttpMethod: (input: any) => input is RpcHttpMethod;
10
- declare const SCHEMA_VERSION = "0.0.7";
11
- interface AppDefinition {
12
- schemaVersion: typeof SCHEMA_VERSION;
13
- info?: {
14
- title?: string;
15
- description?: string;
16
- version?: string;
17
- [key: string]: string | undefined;
18
- };
19
- externalDocs?: {
20
- description?: string;
21
- url: string;
22
- };
23
- procedures: Record<string, RpcDefinition<string>>;
24
- definitions: Record<string, Schema>;
25
- }
26
- declare function isAppDefinition(input: unknown): input is AppDefinition;
27
- interface RpcDefinitionBase<T = string> {
28
- path: string;
29
- params?: T;
30
- response?: T;
31
- description?: string;
32
- isDeprecated?: boolean;
33
- }
34
- interface HttpRpcDefinition<T = string> extends RpcDefinitionBase<T> {
35
- transport: "http";
36
- method: RpcHttpMethod;
37
- isEventStream?: boolean;
38
- }
39
- interface WsRpcDefinition<T = string> extends RpcDefinitionBase<T> {
40
- transport: "ws";
41
- }
42
- interface CustomRpcDefinition<T = string> extends RpcDefinitionBase<T> {
43
- transport: `custom:${string}`;
44
- [key: string]: unknown;
45
- }
46
- type RpcDefinition<T = string> = HttpRpcDefinition<T> | WsRpcDefinition<T> | CustomRpcDefinition<T>;
47
- declare function isRpcDefinitionBase(input: unknown): input is RpcDefinitionBase;
48
- declare function isRpcDefinition(input: unknown): input is RpcDefinition;
49
- interface ServiceDefinition {
50
- [key: string]: RpcDefinition | ServiceDefinition;
51
- }
52
- declare function isServiceDefinition(input: any): input is ServiceDefinition;
53
5
  declare function unflattenProcedures(procedures: AppDefinition["procedures"]): Record<string, RpcDefinition | ServiceDefinition>;
54
6
  declare function unflattenObject(data: Record<string, any>): any;
55
7
  declare const removeDisallowedChars: (input: string, disallowedChars: string) => string;
56
8
  declare const stringStartsWithNumber: (input: string) => boolean;
57
9
  declare function setNestedObjectProperty<T>(targetProp: string, value: T, object: Record<any, any>): Record<any, any>;
58
10
  declare function normalizeWhitespace(input: string): string;
59
- interface Generator<TOptions extends Record<string, any> | undefined> {
60
- run: (def: AppDefinition, isDevServer?: boolean) => any;
61
- options: TOptions;
62
- }
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
- type RpcDefinitionHelper = RpcDefinition<SchemaFormProperties | SchemaFormDiscriminator>;
66
- type AppDefinitionHelper = Omit<AppDefinition, "procedures" | "definitions" | "schemaVersion"> & {
67
- procedures: Record<string, RpcDefinitionHelper>;
68
- definitions?: AppDefinition["definitions"];
69
- };
70
- declare function createAppDefinition(input: AppDefinitionHelper): AppDefinition;
71
11
 
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 };
12
+ export { normalizeWhitespace, removeDisallowedChars, setNestedObjectProperty, stringStartsWithNumber, unflattenObject, unflattenProcedures };
package/dist/index.d.ts CHANGED
@@ -1,72 +1,12 @@
1
- import { Schema, SchemaFormProperties, SchemaFormDiscriminator } from 'jtd-utils';
2
- export * from 'jtd-utils';
1
+ import { AppDefinition, RpcDefinition, ServiceDefinition } from '@arrirpc/type-defs';
2
+ export * from '@arrirpc/type-defs';
3
3
  export * from 'scule';
4
4
 
5
- declare const HttpMethodValues: readonly ["get", "post", "put", "patch", "delete", "head"];
6
- type HttpMethod = (typeof HttpMethodValues)[number];
7
- type RpcHttpMethod = Exclude<HttpMethod, "head">;
8
- declare const isHttpMethod: (input: any) => input is HttpMethod;
9
- declare const isRpcHttpMethod: (input: any) => input is RpcHttpMethod;
10
- declare const SCHEMA_VERSION = "0.0.7";
11
- interface AppDefinition {
12
- schemaVersion: typeof SCHEMA_VERSION;
13
- info?: {
14
- title?: string;
15
- description?: string;
16
- version?: string;
17
- [key: string]: string | undefined;
18
- };
19
- externalDocs?: {
20
- description?: string;
21
- url: string;
22
- };
23
- procedures: Record<string, RpcDefinition<string>>;
24
- definitions: Record<string, Schema>;
25
- }
26
- declare function isAppDefinition(input: unknown): input is AppDefinition;
27
- interface RpcDefinitionBase<T = string> {
28
- path: string;
29
- params?: T;
30
- response?: T;
31
- description?: string;
32
- isDeprecated?: boolean;
33
- }
34
- interface HttpRpcDefinition<T = string> extends RpcDefinitionBase<T> {
35
- transport: "http";
36
- method: RpcHttpMethod;
37
- isEventStream?: boolean;
38
- }
39
- interface WsRpcDefinition<T = string> extends RpcDefinitionBase<T> {
40
- transport: "ws";
41
- }
42
- interface CustomRpcDefinition<T = string> extends RpcDefinitionBase<T> {
43
- transport: `custom:${string}`;
44
- [key: string]: unknown;
45
- }
46
- type RpcDefinition<T = string> = HttpRpcDefinition<T> | WsRpcDefinition<T> | CustomRpcDefinition<T>;
47
- declare function isRpcDefinitionBase(input: unknown): input is RpcDefinitionBase;
48
- declare function isRpcDefinition(input: unknown): input is RpcDefinition;
49
- interface ServiceDefinition {
50
- [key: string]: RpcDefinition | ServiceDefinition;
51
- }
52
- declare function isServiceDefinition(input: any): input is ServiceDefinition;
53
5
  declare function unflattenProcedures(procedures: AppDefinition["procedures"]): Record<string, RpcDefinition | ServiceDefinition>;
54
6
  declare function unflattenObject(data: Record<string, any>): any;
55
7
  declare const removeDisallowedChars: (input: string, disallowedChars: string) => string;
56
8
  declare const stringStartsWithNumber: (input: string) => boolean;
57
9
  declare function setNestedObjectProperty<T>(targetProp: string, value: T, object: Record<any, any>): Record<any, any>;
58
10
  declare function normalizeWhitespace(input: string): string;
59
- interface Generator<TOptions extends Record<string, any> | undefined> {
60
- run: (def: AppDefinition, isDevServer?: boolean) => any;
61
- options: TOptions;
62
- }
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
- type RpcDefinitionHelper = RpcDefinition<SchemaFormProperties | SchemaFormDiscriminator>;
66
- type AppDefinitionHelper = Omit<AppDefinition, "procedures" | "definitions" | "schemaVersion"> & {
67
- procedures: Record<string, RpcDefinitionHelper>;
68
- definitions?: AppDefinition["definitions"];
69
- };
70
- declare function createAppDefinition(input: AppDefinitionHelper): AppDefinition;
71
11
 
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 };
12
+ export { normalizeWhitespace, removeDisallowedChars, setNestedObjectProperty, stringStartsWithNumber, unflattenObject, unflattenProcedures };
package/dist/index.mjs CHANGED
@@ -1,88 +1,11 @@
1
- import { pascalCase } from 'scule';
1
+ export * from '@arrirpc/type-defs';
2
2
  export * from 'scule';
3
- export * from 'jtd-utils';
4
3
 
5
- const HttpMethodValues = [
6
- "get",
7
- "post",
8
- "put",
9
- "patch",
10
- "delete",
11
- "head"
12
- ];
13
- const isHttpMethod = (input) => {
14
- if (typeof input !== "string") {
15
- return false;
16
- }
17
- return HttpMethodValues.includes(input);
18
- };
19
- const isRpcHttpMethod = (input) => {
20
- return isHttpMethod(input) && input !== "head";
21
- };
22
- const SCHEMA_VERSION = "0.0.7";
23
- function isAppDefinition(input) {
24
- if (typeof input !== "object") {
25
- return false;
26
- }
27
- const inputObj = input;
28
- if (typeof inputObj.schemaVersion !== "string") {
29
- return false;
30
- }
31
- if (typeof inputObj.procedures !== "object") {
32
- return false;
33
- }
34
- if (typeof inputObj.definitions !== "object") {
35
- return false;
36
- }
37
- return true;
38
- }
39
- function isRpcDefinitionBase(input) {
40
- if (typeof input !== "object" || input === null) {
41
- return false;
42
- }
43
- if ("params" in input && typeof input.params !== "undefined" && typeof input.params !== "string") {
44
- return false;
45
- }
46
- if ("response" in input && typeof input.response !== "undefined" && typeof input.response !== "string") {
47
- return false;
48
- }
49
- return "transport" in input && typeof input.transport === "string" && input.transport.length > 0 && "path" in input && typeof input.path === "string" && input.path.length > 0;
50
- }
51
- function isRpcDefinition(input) {
52
- if (!isRpcDefinitionBase(input)) {
53
- return false;
54
- }
55
- if (!("transport" in input) || typeof input.transport !== "string") {
56
- return false;
57
- }
58
- if (input.transport === "http") {
59
- return "method" in input && isRpcHttpMethod(input.method);
60
- }
61
- if (input.transport === "ws") {
62
- return true;
63
- }
64
- if (input.transport.startsWith("custom:")) {
65
- return true;
66
- }
67
- return false;
68
- }
69
- function isServiceDefinition(input) {
70
- if (typeof input !== "object") {
71
- return false;
72
- }
73
- for (const key of Object.keys(input)) {
74
- if (typeof input[key] !== "object") {
75
- return false;
76
- }
77
- }
78
- return true;
79
- }
80
4
  function unflattenProcedures(procedures) {
81
5
  return unflattenObject(procedures);
82
6
  }
83
7
  function unflattenObject(data) {
84
- if (Object(data) !== data || Array.isArray(data))
85
- return data;
8
+ if (Object(data) !== data || Array.isArray(data)) return data;
86
9
  const regex = /\.?([^.[\]]+)|\[(\d+)\]/g;
87
10
  const result = {};
88
11
  for (const p in data) {
@@ -137,39 +60,5 @@ function normalizeWhitespace(input) {
137
60
  }
138
61
  return result;
139
62
  }
140
- function defineGeneratorPlugin(plugin) {
141
- return plugin;
142
- }
143
- function createAppDefinition(input) {
144
- const definitions = { ...input.definitions };
145
- const procedures = {};
146
- for (const key of Object.keys(input.procedures)) {
147
- const def = input.procedures[key];
148
- let paramName;
149
- if (def.params) {
150
- paramName = def.params.metadata?.id ?? pascalCase(`${key.split(".").join("_")}Params`);
151
- definitions[paramName] = def.params;
152
- }
153
- let responseName;
154
- if (def.response) {
155
- responseName = def.response.metadata?.id ?? pascalCase(`${key.split(".").join("_")}Response`);
156
- definitions[responseName] = def.response;
157
- }
158
- delete def.params;
159
- delete def.response;
160
- procedures[key] = {
161
- ...def,
162
- params: paramName,
163
- response: responseName
164
- };
165
- }
166
- const result = {
167
- schemaVersion: "0.0.7",
168
- ...input,
169
- procedures,
170
- definitions
171
- };
172
- return result;
173
- }
174
63
 
175
- export { HttpMethodValues, SCHEMA_VERSION, createAppDefinition, defineGeneratorPlugin, isAppDefinition, isHttpMethod, isRpcDefinition, isRpcDefinitionBase, isRpcHttpMethod, isServiceDefinition, normalizeWhitespace, removeDisallowedChars, setNestedObjectProperty, stringStartsWithNumber, unflattenObject, unflattenProcedures };
64
+ export { normalizeWhitespace, removeDisallowedChars, setNestedObjectProperty, stringStartsWithNumber, unflattenObject, unflattenProcedures };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrirpc/codegen-utils",
3
- "version": "0.69.1",
3
+ "version": "0.70.1",
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
- "jtd-utils": "0.69.1"
26
+ "@arrirpc/type-defs": "0.70.1"
27
27
  },
28
28
  "devDependencies": {}
29
29
  }