@arrirpc/codegen-utils 0.76.4 → 0.77.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
@@ -3,8 +3,17 @@
3
3
  const typeDefs = require('@arrirpc/type-defs');
4
4
  const scule = require('scule');
5
5
 
6
- function unflattenProcedures(procedures) {
7
- return unflattenObject(procedures);
6
+ function unflattenProcedures(procedures, rootService) {
7
+ if (!rootService) {
8
+ return unflattenObject(procedures);
9
+ }
10
+ const filteredProcedures = {};
11
+ for (const key of Object.keys(procedures)) {
12
+ if (key.startsWith(rootService)) {
13
+ filteredProcedures[key.replace(rootService + ".", "")] = procedures[key];
14
+ }
15
+ }
16
+ return unflattenObject(filteredProcedures);
8
17
  }
9
18
  function unflattenObject(data) {
10
19
  if (Object(data) !== data || Array.isArray(data)) return data;
package/dist/index.d.cts CHANGED
@@ -2,7 +2,7 @@ import { AppDefinition, RpcDefinition, ServiceDefinition } from '@arrirpc/type-d
2
2
  export * from '@arrirpc/type-defs';
3
3
  export * from 'scule';
4
4
 
5
- declare function unflattenProcedures(procedures: AppDefinition['procedures']): Record<string, RpcDefinition | ServiceDefinition>;
5
+ declare function unflattenProcedures(procedures: AppDefinition['procedures'], rootService?: string): Record<string, RpcDefinition | ServiceDefinition>;
6
6
  declare function unflattenObject(data: Record<string, any>): any;
7
7
  declare const removeDisallowedChars: (input: string, disallowedChars: string) => string;
8
8
  declare const stringStartsWithNumber: (input: string) => boolean;
package/dist/index.d.mts CHANGED
@@ -2,7 +2,7 @@ import { AppDefinition, RpcDefinition, ServiceDefinition } from '@arrirpc/type-d
2
2
  export * from '@arrirpc/type-defs';
3
3
  export * from 'scule';
4
4
 
5
- declare function unflattenProcedures(procedures: AppDefinition['procedures']): Record<string, RpcDefinition | ServiceDefinition>;
5
+ declare function unflattenProcedures(procedures: AppDefinition['procedures'], rootService?: string): Record<string, RpcDefinition | ServiceDefinition>;
6
6
  declare function unflattenObject(data: Record<string, any>): any;
7
7
  declare const removeDisallowedChars: (input: string, disallowedChars: string) => string;
8
8
  declare const stringStartsWithNumber: (input: string) => boolean;
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { AppDefinition, RpcDefinition, ServiceDefinition } from '@arrirpc/type-d
2
2
  export * from '@arrirpc/type-defs';
3
3
  export * from 'scule';
4
4
 
5
- declare function unflattenProcedures(procedures: AppDefinition['procedures']): Record<string, RpcDefinition | ServiceDefinition>;
5
+ declare function unflattenProcedures(procedures: AppDefinition['procedures'], rootService?: string): Record<string, RpcDefinition | ServiceDefinition>;
6
6
  declare function unflattenObject(data: Record<string, any>): any;
7
7
  declare const removeDisallowedChars: (input: string, disallowedChars: string) => string;
8
8
  declare const stringStartsWithNumber: (input: string) => boolean;
package/dist/index.mjs CHANGED
@@ -1,8 +1,17 @@
1
1
  export * from '@arrirpc/type-defs';
2
2
  export * from 'scule';
3
3
 
4
- function unflattenProcedures(procedures) {
5
- return unflattenObject(procedures);
4
+ function unflattenProcedures(procedures, rootService) {
5
+ if (!rootService) {
6
+ return unflattenObject(procedures);
7
+ }
8
+ const filteredProcedures = {};
9
+ for (const key of Object.keys(procedures)) {
10
+ if (key.startsWith(rootService)) {
11
+ filteredProcedures[key.replace(rootService + ".", "")] = procedures[key];
12
+ }
13
+ }
14
+ return unflattenObject(filteredProcedures);
6
15
  }
7
16
  function unflattenObject(data) {
8
17
  if (Object(data) !== data || Array.isArray(data)) return data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arrirpc/codegen-utils",
3
- "version": "0.76.4",
3
+ "version": "0.77.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
- "@arrirpc/type-defs": "0.76.4"
26
+ "@arrirpc/type-defs": "0.77.1"
27
27
  },
28
28
  "devDependencies": {}
29
29
  }