@nestia/sdk 2.4.3 → 2.4.4

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.
Files changed (70) hide show
  1. package/lib/INestiaConfig.d.ts +13 -0
  2. package/lib/analyses/ControllerAnalyzer.js +12 -1
  3. package/lib/analyses/ControllerAnalyzer.js.map +1 -1
  4. package/lib/analyses/PathAnalyzer.d.ts +2 -2
  5. package/lib/analyses/PathAnalyzer.js +27 -11
  6. package/lib/analyses/PathAnalyzer.js.map +1 -1
  7. package/lib/analyses/ReflectAnalyzer.js +11 -2
  8. package/lib/analyses/ReflectAnalyzer.js.map +1 -1
  9. package/lib/executable/internal/NestiaConfigLoader.js +5 -1
  10. package/lib/executable/internal/NestiaConfigLoader.js.map +1 -1
  11. package/lib/executable/sdk.js +11 -11
  12. package/lib/generates/SwaggerGenerator.js +16 -22
  13. package/lib/generates/SwaggerGenerator.js.map +1 -1
  14. package/lib/generates/internal/SwaggerSchemaGenerator.js +22 -15
  15. package/lib/generates/internal/SwaggerSchemaGenerator.js.map +1 -1
  16. package/lib/structures/ISwaggerComponents.d.ts +1 -1
  17. package/lib/structures/ISwaggerRoute.d.ts +3 -3
  18. package/package.json +5 -5
  19. package/src/INestiaConfig.ts +248 -234
  20. package/src/NestiaSdkApplication.ts +253 -253
  21. package/src/analyses/AccessorAnalyzer.ts +60 -60
  22. package/src/analyses/ConfigAnalyzer.ts +147 -147
  23. package/src/analyses/ControllerAnalyzer.ts +390 -379
  24. package/src/analyses/ExceptionAnalyzer.ts +115 -115
  25. package/src/analyses/GenericAnalyzer.ts +51 -51
  26. package/src/analyses/ImportAnalyzer.ts +138 -138
  27. package/src/analyses/PathAnalyzer.ts +110 -98
  28. package/src/analyses/ReflectAnalyzer.ts +11 -6
  29. package/src/analyses/SecurityAnalyzer.ts +20 -20
  30. package/src/executable/internal/CommandParser.ts +15 -15
  31. package/src/executable/internal/NestiaConfigLoader.ts +67 -67
  32. package/src/executable/internal/NestiaSdkCommand.ts +60 -60
  33. package/src/executable/sdk.ts +73 -73
  34. package/src/generates/E2eGenerator.ts +64 -64
  35. package/src/generates/SdkGenerator.ts +96 -96
  36. package/src/generates/SwaggerGenerator.ts +376 -372
  37. package/src/generates/internal/E2eFileProgrammer.ts +123 -123
  38. package/src/generates/internal/SdkDistributionComposer.ts +91 -91
  39. package/src/generates/internal/SdkDtoGenerator.ts +424 -424
  40. package/src/generates/internal/SdkFileProgrammer.ts +106 -106
  41. package/src/generates/internal/SdkImportWizard.ts +55 -55
  42. package/src/generates/internal/SdkRouteDirectory.ts +17 -17
  43. package/src/generates/internal/SdkSimulationProgrammer.ts +133 -133
  44. package/src/generates/internal/SdkTypeDefiner.ts +119 -119
  45. package/src/generates/internal/SwaggerSchemaGenerator.ts +18 -2
  46. package/src/generates/internal/SwaggerSchemaValidator.ts +198 -198
  47. package/src/index.ts +4 -4
  48. package/src/module.ts +2 -2
  49. package/src/structures/IErrorReport.ts +6 -6
  50. package/src/structures/INestiaProject.ts +13 -13
  51. package/src/structures/INormalizedInput.ts +20 -20
  52. package/src/structures/ISwagger.ts +91 -91
  53. package/src/structures/ISwaggerComponents.ts +29 -29
  54. package/src/structures/ISwaggerError.ts +8 -8
  55. package/src/structures/ISwaggerInfo.ts +80 -80
  56. package/src/structures/ISwaggerLazyProperty.ts +7 -7
  57. package/src/structures/ISwaggerLazySchema.ts +7 -7
  58. package/src/structures/ISwaggerRoute.ts +51 -51
  59. package/src/structures/ISwaggerSecurityScheme.ts +65 -65
  60. package/src/structures/ITypeTuple.ts +6 -6
  61. package/src/structures/MethodType.ts +5 -5
  62. package/src/structures/ParamCategory.ts +1 -1
  63. package/src/structures/TypeEntry.ts +22 -22
  64. package/src/utils/ArrayUtil.ts +26 -26
  65. package/src/utils/FileRetriever.ts +22 -22
  66. package/src/utils/ImportDictionary.ts +125 -125
  67. package/src/utils/MapUtil.ts +14 -14
  68. package/src/utils/PathUtil.ts +10 -10
  69. package/src/utils/SourceFinder.ts +66 -66
  70. package/src/utils/StripEnums.ts +5 -5
@@ -1,65 +1,65 @@
1
- /**
2
- * Security scheme of Swagger Documents.
3
- *
4
- * `ISwaggerSecurityScheme` is a data structure representing content of
5
- * `securitySchemes` in `swagger.json` file. It is composed with 5 types of security
6
- * schemes as an union type like below.
7
- *
8
- * @reference https://swagger.io/specification/#security-scheme-object
9
- * @author Jeongho Nam - https://github.com/samchon
10
- */
11
- export type ISwaggerSecurityScheme =
12
- | ISwaggerSecurityScheme.IHttpBasic
13
- | ISwaggerSecurityScheme.IHttpBearer
14
- | ISwaggerSecurityScheme.IApiKey
15
- | ISwaggerSecurityScheme.IOpenId
16
- | ISwaggerSecurityScheme.IOAuth2;
17
- export namespace ISwaggerSecurityScheme {
18
- export interface IHttpBasic {
19
- type: "http";
20
- scheme: "basic";
21
- }
22
- export interface IHttpBearer {
23
- type: "http";
24
- scheme: "bearer";
25
- bearerFormat?: string;
26
- }
27
- export interface IApiKey {
28
- type: "apiKey";
29
-
30
- /**
31
- * @default header
32
- */
33
- in?: "header" | "query" | "cookie";
34
-
35
- /**
36
- * @default Authorization
37
- */
38
- name?: string;
39
- }
40
-
41
- export interface IOpenId {
42
- type: "openIdConnect";
43
- openIdConnectUrl: string;
44
- }
45
-
46
- export interface IOAuth2 {
47
- type: "oauth2";
48
- flows: IOAuth2.IFlowSet;
49
- description?: string;
50
- }
51
- export namespace IOAuth2 {
52
- export interface IFlowSet {
53
- authorizationCode?: IFlow;
54
- implicit?: Omit<IFlow, "tokenUrl">;
55
- password?: Omit<IFlow, "authorizationUrl">;
56
- clientCredentials?: Omit<IFlow, "authorizationUrl">;
57
- }
58
- export interface IFlow {
59
- authorizationUrl: string;
60
- tokenUrl: string;
61
- refreshUrl: string;
62
- scopes?: Record<string, string>;
63
- }
64
- }
65
- }
1
+ /**
2
+ * Security scheme of Swagger Documents.
3
+ *
4
+ * `ISwaggerSecurityScheme` is a data structure representing content of
5
+ * `securitySchemes` in `swagger.json` file. It is composed with 5 types of security
6
+ * schemes as an union type like below.
7
+ *
8
+ * @reference https://swagger.io/specification/#security-scheme-object
9
+ * @author Jeongho Nam - https://github.com/samchon
10
+ */
11
+ export type ISwaggerSecurityScheme =
12
+ | ISwaggerSecurityScheme.IHttpBasic
13
+ | ISwaggerSecurityScheme.IHttpBearer
14
+ | ISwaggerSecurityScheme.IApiKey
15
+ | ISwaggerSecurityScheme.IOpenId
16
+ | ISwaggerSecurityScheme.IOAuth2;
17
+ export namespace ISwaggerSecurityScheme {
18
+ export interface IHttpBasic {
19
+ type: "http";
20
+ scheme: "basic";
21
+ }
22
+ export interface IHttpBearer {
23
+ type: "http";
24
+ scheme: "bearer";
25
+ bearerFormat?: string;
26
+ }
27
+ export interface IApiKey {
28
+ type: "apiKey";
29
+
30
+ /**
31
+ * @default header
32
+ */
33
+ in?: "header" | "query" | "cookie";
34
+
35
+ /**
36
+ * @default Authorization
37
+ */
38
+ name?: string;
39
+ }
40
+
41
+ export interface IOpenId {
42
+ type: "openIdConnect";
43
+ openIdConnectUrl: string;
44
+ }
45
+
46
+ export interface IOAuth2 {
47
+ type: "oauth2";
48
+ flows: IOAuth2.IFlowSet;
49
+ description?: string;
50
+ }
51
+ export namespace IOAuth2 {
52
+ export interface IFlowSet {
53
+ authorizationCode?: IFlow;
54
+ implicit?: Omit<IFlow, "tokenUrl">;
55
+ password?: Omit<IFlow, "authorizationUrl">;
56
+ clientCredentials?: Omit<IFlow, "authorizationUrl">;
57
+ }
58
+ export interface IFlow {
59
+ authorizationUrl: string;
60
+ tokenUrl: string;
61
+ refreshUrl: string;
62
+ scopes?: Record<string, string>;
63
+ }
64
+ }
65
+ }
@@ -1,6 +1,6 @@
1
- import ts from "typescript";
2
-
3
- export interface ITypeTuple {
4
- type: ts.Type;
5
- typeName: string;
6
- }
1
+ import ts from "typescript";
2
+
3
+ export interface ITypeTuple {
4
+ type: ts.Type;
5
+ typeName: string;
6
+ }
@@ -1,5 +1,5 @@
1
- export type MethodType = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
2
-
3
- export namespace MethodType {
4
- export const VALUES: MethodType[] = ["GET", "POST", "PUT", "PATCH", "DELETE"];
5
- }
1
+ export type MethodType = "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
2
+
3
+ export namespace MethodType {
4
+ export const VALUES: MethodType[] = ["GET", "POST", "PUT", "PATCH", "DELETE"];
5
+ }
@@ -1 +1 @@
1
- export type ParamCategory = "param" | "query" | "body" | "headers";
1
+ export type ParamCategory = "param" | "query" | "body" | "headers";
@@ -1,22 +1,22 @@
1
- import { hash } from "tstl/functional/hash";
2
- import ts from "typescript";
3
-
4
- export class TypeEntry {
5
- public constructor(
6
- public readonly type: ts.Type,
7
- public readonly nullable: boolean,
8
- public readonly required: boolean,
9
- ) {}
10
-
11
- public equals(obj: TypeEntry): boolean {
12
- return (
13
- this.type === obj.type &&
14
- this.nullable === obj.nullable &&
15
- this.required === obj.required
16
- );
17
- }
18
-
19
- public hashCode(): number {
20
- return hash(this.type, this.nullable, this.required);
21
- }
22
- }
1
+ import { hash } from "tstl/functional/hash";
2
+ import ts from "typescript";
3
+
4
+ export class TypeEntry {
5
+ public constructor(
6
+ public readonly type: ts.Type,
7
+ public readonly nullable: boolean,
8
+ public readonly required: boolean,
9
+ ) {}
10
+
11
+ public equals(obj: TypeEntry): boolean {
12
+ return (
13
+ this.type === obj.type &&
14
+ this.nullable === obj.nullable &&
15
+ this.required === obj.required
16
+ );
17
+ }
18
+
19
+ public hashCode(): number {
20
+ return hash(this.type, this.nullable, this.required);
21
+ }
22
+ }
@@ -1,26 +1,26 @@
1
- export namespace ArrayUtil {
2
- export function has<T>(array: T[], ...items: T[]): boolean {
3
- return items.every(
4
- (elem) => array.find((org) => org === elem) !== undefined,
5
- );
6
- }
7
-
8
- export async function asyncMap<Input, Output>(
9
- array: Input[],
10
- closure: (input: Input) => Promise<Output>,
11
- ): Promise<Output[]> {
12
- const ret: Output[] = [];
13
- for (const elem of array) ret.push(await closure(elem));
14
- return ret;
15
- }
16
-
17
- export async function asyncFilter<Input>(
18
- array: Input[],
19
- closure: (input: Input) => Promise<boolean>,
20
- ): Promise<Input[]> {
21
- const ret: Input[] = [];
22
- for (const elem of array)
23
- if ((await closure(elem)) === true) ret.push(elem);
24
- return ret;
25
- }
26
- }
1
+ export namespace ArrayUtil {
2
+ export function has<T>(array: T[], ...items: T[]): boolean {
3
+ return items.every(
4
+ (elem) => array.find((org) => org === elem) !== undefined,
5
+ );
6
+ }
7
+
8
+ export async function asyncMap<Input, Output>(
9
+ array: Input[],
10
+ closure: (input: Input) => Promise<Output>,
11
+ ): Promise<Output[]> {
12
+ const ret: Output[] = [];
13
+ for (const elem of array) ret.push(await closure(elem));
14
+ return ret;
15
+ }
16
+
17
+ export async function asyncFilter<Input>(
18
+ array: Input[],
19
+ closure: (input: Input) => Promise<boolean>,
20
+ ): Promise<Input[]> {
21
+ const ret: Input[] = [];
22
+ for (const elem of array)
23
+ if ((await closure(elem)) === true) ret.push(elem);
24
+ return ret;
25
+ }
26
+ }
@@ -1,22 +1,22 @@
1
- import fs from "fs";
2
- import path from "path";
3
-
4
- export namespace FileRetriever {
5
- export const directory =
6
- (name: string) =>
7
- (dir: string, depth: number = 0): string | null => {
8
- const location: string = path.join(dir, name);
9
- if (fs.existsSync(location)) return dir;
10
- else if (depth > 2) return null;
11
- return directory(name)(path.join(dir, ".."), depth + 1);
12
- };
13
-
14
- export const file =
15
- (name: string) =>
16
- (directory: string, depth: number = 0): string | null => {
17
- const location: string = path.join(directory, name);
18
- if (fs.existsSync(location)) return location;
19
- else if (depth > 2) return null;
20
- return file(name)(path.join(directory, ".."), depth + 1);
21
- };
22
- }
1
+ import fs from "fs";
2
+ import path from "path";
3
+
4
+ export namespace FileRetriever {
5
+ export const directory =
6
+ (name: string) =>
7
+ (dir: string, depth: number = 0): string | null => {
8
+ const location: string = path.join(dir, name);
9
+ if (fs.existsSync(location)) return dir;
10
+ else if (depth > 2) return null;
11
+ return directory(name)(path.join(dir, ".."), depth + 1);
12
+ };
13
+
14
+ export const file =
15
+ (name: string) =>
16
+ (directory: string, depth: number = 0): string | null => {
17
+ const location: string = path.join(directory, name);
18
+ if (fs.existsSync(location)) return location;
19
+ else if (depth > 2) return null;
20
+ return file(name)(path.join(directory, ".."), depth + 1);
21
+ };
22
+ }
@@ -1,125 +1,125 @@
1
- import path from "path";
2
- import { HashMap } from "tstl/container/HashMap";
3
- import { HashSet } from "tstl/container/HashSet";
4
- import { Pair } from "tstl/utility/Pair";
5
-
6
- export class ImportDictionary {
7
- private readonly components_: HashMap<Pair<string, boolean>, IComposition> =
8
- new HashMap();
9
-
10
- public constructor(public readonly file: string) {}
11
-
12
- public empty(): boolean {
13
- return this.components_.empty();
14
- }
15
-
16
- public external(props: ImportDictionary.IExternalProps): string {
17
- const composition: IComposition = this.components_.take(
18
- new Pair(props.library, props.type),
19
- () => ({
20
- location: `node_modules/${props.library}`,
21
- elements: new HashSet(),
22
- default: false,
23
- type: props.type,
24
- }),
25
- );
26
- if (props.instance === null) composition.default = true;
27
- else composition.elements.insert(props.instance);
28
- return props.instance ?? props.library;
29
- }
30
-
31
- public internal(props: ImportDictionary.IInternalProps): string {
32
- const file: string = (() => {
33
- if (props.file.substring(props.file.length - 5) === ".d.ts")
34
- return props.file.substring(0, props.file.length - 5);
35
- else if (props.file.substring(props.file.length - 3) === ".ts")
36
- return props.file.substring(0, props.file.length - 3);
37
- return props.file;
38
- })();
39
- const composition: IComposition = this.components_.take(
40
- new Pair(file, props.type),
41
- () => ({
42
- location: file,
43
- elements: new HashSet(),
44
- default: false,
45
- type: props.type,
46
- }),
47
- );
48
- if (props.instance === null) {
49
- composition.default = true;
50
- if (props.name) composition.name = props.name;
51
- } else composition.elements.insert(props.instance);
52
- return props.instance ?? file;
53
- }
54
-
55
- public toScript(outDir: string): string {
56
- const external: string[] = [];
57
- const internal: string[] = [];
58
-
59
- const locator = (str: string) => {
60
- const location: string = path.relative(outDir, str).split("\\").join("/");
61
- const index: number = location.lastIndexOf(NODE_MODULES);
62
- return index === -1
63
- ? location.startsWith("..")
64
- ? location
65
- : `./${location}`
66
- : location.substring(index + NODE_MODULES.length);
67
- };
68
- const enroll =
69
- (filter: (str: string) => boolean) => (container: string[]) => {
70
- const compositions: IComposition[] = this.components_
71
- .toJSON()
72
- .filter((c) => filter(c.second.location))
73
- .map((e) => ({
74
- ...e.second,
75
- location: locator(e.second.location),
76
- }))
77
- .sort((a, b) => a.location.localeCompare(b.location));
78
- for (const c of compositions) {
79
- const brackets: string[] = [];
80
- if (c.default) brackets.push(c.name ?? c.location);
81
- if (c.elements.empty() === false)
82
- brackets.push(
83
- `{ ${c.elements
84
- .toJSON()
85
- .sort((a, b) => a.localeCompare(b))
86
- .join(", ")} }`,
87
- );
88
- container.push(
89
- `import ${c.type ? "type " : ""}${brackets.join(", ")} from "${
90
- c.location
91
- }";`,
92
- );
93
- }
94
- };
95
-
96
- enroll((str) => str.indexOf(NODE_MODULES) !== -1)(external);
97
- enroll((str) => str.indexOf(NODE_MODULES) === -1)(internal);
98
-
99
- if (external.length && internal.length) external.push("");
100
- return [...external, ...internal].join("\n");
101
- }
102
- }
103
- export namespace ImportDictionary {
104
- export interface IExternalProps {
105
- type: boolean;
106
- library: string;
107
- instance: string | null;
108
- }
109
- export interface IInternalProps {
110
- type: boolean;
111
- file: string;
112
- instance: string | null;
113
- name?: string | null;
114
- }
115
- }
116
-
117
- interface IComposition {
118
- location: string;
119
- type: boolean;
120
- default: boolean;
121
- name?: string;
122
- elements: HashSet<string>;
123
- }
124
-
125
- const NODE_MODULES = "node_modules/";
1
+ import path from "path";
2
+ import { HashMap } from "tstl/container/HashMap";
3
+ import { HashSet } from "tstl/container/HashSet";
4
+ import { Pair } from "tstl/utility/Pair";
5
+
6
+ export class ImportDictionary {
7
+ private readonly components_: HashMap<Pair<string, boolean>, IComposition> =
8
+ new HashMap();
9
+
10
+ public constructor(public readonly file: string) {}
11
+
12
+ public empty(): boolean {
13
+ return this.components_.empty();
14
+ }
15
+
16
+ public external(props: ImportDictionary.IExternalProps): string {
17
+ const composition: IComposition = this.components_.take(
18
+ new Pair(props.library, props.type),
19
+ () => ({
20
+ location: `node_modules/${props.library}`,
21
+ elements: new HashSet(),
22
+ default: false,
23
+ type: props.type,
24
+ }),
25
+ );
26
+ if (props.instance === null) composition.default = true;
27
+ else composition.elements.insert(props.instance);
28
+ return props.instance ?? props.library;
29
+ }
30
+
31
+ public internal(props: ImportDictionary.IInternalProps): string {
32
+ const file: string = (() => {
33
+ if (props.file.substring(props.file.length - 5) === ".d.ts")
34
+ return props.file.substring(0, props.file.length - 5);
35
+ else if (props.file.substring(props.file.length - 3) === ".ts")
36
+ return props.file.substring(0, props.file.length - 3);
37
+ return props.file;
38
+ })();
39
+ const composition: IComposition = this.components_.take(
40
+ new Pair(file, props.type),
41
+ () => ({
42
+ location: file,
43
+ elements: new HashSet(),
44
+ default: false,
45
+ type: props.type,
46
+ }),
47
+ );
48
+ if (props.instance === null) {
49
+ composition.default = true;
50
+ if (props.name) composition.name = props.name;
51
+ } else composition.elements.insert(props.instance);
52
+ return props.instance ?? file;
53
+ }
54
+
55
+ public toScript(outDir: string): string {
56
+ const external: string[] = [];
57
+ const internal: string[] = [];
58
+
59
+ const locator = (str: string) => {
60
+ const location: string = path.relative(outDir, str).split("\\").join("/");
61
+ const index: number = location.lastIndexOf(NODE_MODULES);
62
+ return index === -1
63
+ ? location.startsWith("..")
64
+ ? location
65
+ : `./${location}`
66
+ : location.substring(index + NODE_MODULES.length);
67
+ };
68
+ const enroll =
69
+ (filter: (str: string) => boolean) => (container: string[]) => {
70
+ const compositions: IComposition[] = this.components_
71
+ .toJSON()
72
+ .filter((c) => filter(c.second.location))
73
+ .map((e) => ({
74
+ ...e.second,
75
+ location: locator(e.second.location),
76
+ }))
77
+ .sort((a, b) => a.location.localeCompare(b.location));
78
+ for (const c of compositions) {
79
+ const brackets: string[] = [];
80
+ if (c.default) brackets.push(c.name ?? c.location);
81
+ if (c.elements.empty() === false)
82
+ brackets.push(
83
+ `{ ${c.elements
84
+ .toJSON()
85
+ .sort((a, b) => a.localeCompare(b))
86
+ .join(", ")} }`,
87
+ );
88
+ container.push(
89
+ `import ${c.type ? "type " : ""}${brackets.join(", ")} from "${
90
+ c.location
91
+ }";`,
92
+ );
93
+ }
94
+ };
95
+
96
+ enroll((str) => str.indexOf(NODE_MODULES) !== -1)(external);
97
+ enroll((str) => str.indexOf(NODE_MODULES) === -1)(internal);
98
+
99
+ if (external.length && internal.length) external.push("");
100
+ return [...external, ...internal].join("\n");
101
+ }
102
+ }
103
+ export namespace ImportDictionary {
104
+ export interface IExternalProps {
105
+ type: boolean;
106
+ library: string;
107
+ instance: string | null;
108
+ }
109
+ export interface IInternalProps {
110
+ type: boolean;
111
+ file: string;
112
+ instance: string | null;
113
+ name?: string | null;
114
+ }
115
+ }
116
+
117
+ interface IComposition {
118
+ location: string;
119
+ type: boolean;
120
+ default: boolean;
121
+ name?: string;
122
+ elements: HashSet<string>;
123
+ }
124
+
125
+ const NODE_MODULES = "node_modules/";
@@ -1,14 +1,14 @@
1
- export namespace MapUtil {
2
- export function take<Key, T>(
3
- dict: Map<Key, T>,
4
- key: Key,
5
- generator: () => T,
6
- ): T {
7
- const oldbie: T | undefined = dict.get(key);
8
- if (oldbie) return oldbie;
9
-
10
- const value: T = generator();
11
- dict.set(key, value);
12
- return value;
13
- }
14
- }
1
+ export namespace MapUtil {
2
+ export function take<Key, T>(
3
+ dict: Map<Key, T>,
4
+ key: Key,
5
+ generator: () => T,
6
+ ): T {
7
+ const oldbie: T | undefined = dict.get(key);
8
+ if (oldbie) return oldbie;
9
+
10
+ const value: T = generator();
11
+ dict.set(key, value);
12
+ return value;
13
+ }
14
+ }
@@ -1,10 +1,10 @@
1
- export namespace PathUtil {
2
- export const accessors = (path: string) =>
3
- path
4
- .split("/")
5
- .filter((str) => str.length && str[0] !== ":")
6
- .map(normalize);
7
-
8
- const normalize = (str: string) =>
9
- str.split("-").join("_").split(".").join("_");
10
- }
1
+ export namespace PathUtil {
2
+ export const accessors = (path: string) =>
3
+ path
4
+ .split("/")
5
+ .filter((str) => str.length && str[0] !== ":")
6
+ .map(normalize);
7
+
8
+ const normalize = (str: string) =>
9
+ str.split("-").join("_").split(".").join("_");
10
+ }