@config-bound/schema-export 0.1.0 → 0.1.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @config-bound/schema-export
2
2
 
3
+ ## 0.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [0a6960f]
8
+ - @config-bound/config-bound@0.3.0
9
+
10
+ ## 0.1.1
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies [02b3369]
15
+ - Updated dependencies [ac54dea]
16
+ - Updated dependencies [0f899ee]
17
+ - @config-bound/config-bound@0.2.0
18
+
3
19
  ## 0.1.0
4
20
 
5
21
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@config-bound/schema-export",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Schema export utilities for ConfigBound configuration library",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -33,8 +33,9 @@
33
33
  "author": "Robert Keyser",
34
34
  "license": "MIT",
35
35
  "dependencies": {
36
- "@config-bound/config-bound": "0.1.0",
37
- "js-yaml": "^4.1.0"
36
+ "@config-bound/config-bound": "0.3.0",
37
+ "js-yaml": "^4.1.0",
38
+ "zod": "^4.4.1"
38
39
  },
39
40
  "devDependencies": {
40
41
  "@config-bound/eslint-config": "*",
@@ -45,7 +46,7 @@
45
46
  "jest": "^30.2.0",
46
47
  "rimraf": "^6.1.0",
47
48
  "ts-jest": "^29.4.5",
48
- "typescript": "^5.9.3"
49
+ "typescript": "^6.0.0"
49
50
  },
50
51
  "publishConfig": {
51
52
  "access": "public",
@@ -1,6 +1,6 @@
1
1
  import { Section } from '@config-bound/config-bound/section';
2
2
  import { Element } from '@config-bound/config-bound/element';
3
- import Joi from 'joi';
3
+ import { z } from 'zod';
4
4
  import {
5
5
  exportElement,
6
6
  exportSection,
@@ -17,7 +17,7 @@ describe('Schema Exporter', () => {
17
17
  'example-value',
18
18
  false,
19
19
  false,
20
- Joi.string()
20
+ z.string()
21
21
  );
22
22
 
23
23
  const exported = exportElement(element);
@@ -27,7 +27,7 @@ describe('Schema Exporter', () => {
27
27
  expect(exported.type).toBe('string');
28
28
  expect(exported.default).toBe('default-value');
29
29
  expect(exported.example).toBe('example-value');
30
- expect(exported.required).toBe(false);
30
+ expect(exported.required).toBe(true);
31
31
  expect(exported.sensitive).toBe(false);
32
32
  });
33
33
 
@@ -39,7 +39,7 @@ describe('Schema Exporter', () => {
39
39
  42,
40
40
  false,
41
41
  false,
42
- Joi.number().required()
42
+ z.number()
43
43
  );
44
44
 
45
45
  const exported = exportElement(element);
@@ -55,7 +55,7 @@ describe('Schema Exporter', () => {
55
55
  'sk_test_123',
56
56
  true,
57
57
  false,
58
- Joi.string()
58
+ z.string()
59
59
  );
60
60
 
61
61
  const exported = exportElement(element);
@@ -71,13 +71,13 @@ describe('Schema Exporter', () => {
71
71
  'example',
72
72
  false,
73
73
  true,
74
- Joi.string()
74
+ z.string()
75
75
  );
76
76
 
77
77
  expect(element.omitFromSchema).toBe(true);
78
78
  });
79
79
 
80
- it('should extract joi validation object', () => {
80
+ it('should extract zod validation object', () => {
81
81
  const element = new Element<number>(
82
82
  'port',
83
83
  'Server port',
@@ -85,14 +85,13 @@ describe('Schema Exporter', () => {
85
85
  undefined,
86
86
  false,
87
87
  false,
88
- Joi.number().min(1).max(65535).required()
88
+ z.number().min(1).max(65535)
89
89
  );
90
90
 
91
91
  const exported = exportElement(element);
92
92
 
93
- expect(exported.joiValidation).toBeDefined();
94
- expect((exported.joiValidation as any).type).toBe('number');
95
- expect((exported.joiValidation as any).rules).toBeDefined();
93
+ expect(exported.zodValidation).toBeDefined();
94
+ expect((exported.zodValidation as any).type).toBe('number');
96
95
  });
97
96
 
98
97
  it('should handle enum types', () => {
@@ -103,7 +102,7 @@ describe('Schema Exporter', () => {
103
102
  undefined,
104
103
  false,
105
104
  false,
106
- Joi.string().valid('development', 'staging', 'production')
105
+ z.enum(['development', 'staging', 'production'])
107
106
  );
108
107
 
109
108
  const exported = exportElement(element);
@@ -153,7 +152,7 @@ describe('Schema Exporter', () => {
153
152
  'exampleApp',
154
153
  false,
155
154
  false,
156
- Joi.string()
155
+ z.string()
157
156
  );
158
157
  const privateElement = new Element<string>(
159
158
  'internalKey',
@@ -162,7 +161,7 @@ describe('Schema Exporter', () => {
162
161
  'example',
163
162
  false,
164
163
  true,
165
- Joi.string()
164
+ z.string()
166
165
  );
167
166
 
168
167
  const section = new Section(
@@ -191,7 +190,7 @@ describe('Schema Exporter', () => {
191
190
  'exampleApp',
192
191
  false,
193
192
  false,
194
- Joi.string()
193
+ z.string()
195
194
  );
196
195
  const privateElement = new Element<string>(
197
196
  'internalKey',
@@ -200,7 +199,7 @@ describe('Schema Exporter', () => {
200
199
  'example',
201
200
  false,
202
201
  true,
203
- Joi.string()
202
+ z.string()
204
203
  );
205
204
 
206
205
  const section = new Section(
@@ -254,7 +253,7 @@ describe('Schema Exporter', () => {
254
253
  'exampleApp',
255
254
  false,
256
255
  false,
257
- Joi.string()
256
+ z.string()
258
257
  );
259
258
  const privateElement = new Element<string>(
260
259
  'internalKey',
@@ -263,7 +262,7 @@ describe('Schema Exporter', () => {
263
262
  'example',
264
263
  false,
265
264
  true,
266
- Joi.string()
265
+ z.string()
267
266
  );
268
267
 
269
268
  const sections = [
@@ -1,6 +1,6 @@
1
1
  import { Section } from '@config-bound/config-bound/section';
2
2
  import { Element } from '@config-bound/config-bound/element';
3
- import Joi from 'joi';
3
+ import { z } from 'zod';
4
4
 
5
5
  /**
6
6
  * Represents a single configuration element in the exported schema
@@ -13,7 +13,7 @@ export interface ExportedElement {
13
13
  example?: unknown;
14
14
  required: boolean;
15
15
  sensitive: boolean;
16
- joiValidation: unknown;
16
+ zodValidation: unknown;
17
17
  }
18
18
 
19
19
  /**
@@ -34,56 +34,97 @@ export interface ExportedSchema {
34
34
  }
35
35
 
36
36
  /**
37
- * Extracts type information from a Joi schema
37
+ * Extracts a human-readable type string from a Zod schema.
38
+ *
39
+ * @param validator - Zod validator to inspect.
40
+ * @returns Human-readable type string.
38
41
  */
39
- function extractJoiType(validator: Joi.AnySchema): string {
40
- const describe = validator.describe();
42
+ function extractZodType(validator: z.ZodType): string {
43
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
+ const typeName = (validator as any)._def?.type;
41
45
 
42
- if (describe.type === 'alternatives') {
43
- const types =
44
- describe.matches?.map(
45
- (m: Joi.Description) => m.schema?.type || 'unknown'
46
- ) || [];
47
- return types.join(' | ') || 'any';
46
+ // Handle ZodOptional and ZodNullable wrappers
47
+ if (typeName === 'optional' || typeName === 'nullable') {
48
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
+ return extractZodType((validator as any)._def.innerType);
48
50
  }
49
51
 
50
- if (describe.type === 'string' && describe.allow) {
51
- const allowed = describe.allow;
52
- if (Array.isArray(allowed) && allowed.length > 0) {
53
- return allowed.map((v) => `'${v}'`).join(' | ');
52
+ // Map common Zod type names to readable types
53
+ switch (typeName) {
54
+ case 'string':
55
+ return 'string';
56
+ case 'number':
57
+ return 'number';
58
+ case 'boolean':
59
+ return 'boolean';
60
+ case 'enum': {
61
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
+ const enumValues = Object.values((validator as any)._def.entries ?? {});
63
+ return enumValues.map((v) => String(v)).join(' | ');
54
64
  }
65
+ case 'literal':
66
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
67
+ return String((validator as any)._def.value);
68
+ case 'array':
69
+ return 'array';
70
+ case 'object':
71
+ return 'object';
72
+ case 'union':
73
+ case 'discriminatedUnion': {
74
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
75
+ const options = (validator as any)._def.options;
76
+ if (options) {
77
+ return options.map((opt: z.ZodType) => extractZodType(opt)).join(' | ');
78
+ }
79
+ return 'union';
80
+ }
81
+ case 'any':
82
+ return 'any';
83
+ case 'unknown':
84
+ return 'unknown';
85
+ default:
86
+ return typeName || 'unknown';
55
87
  }
56
-
57
- return describe.type || 'unknown';
58
88
  }
59
89
 
60
90
  /**
61
- * Extracts the raw Joi object from a schema
91
+ * Converts a Zod validator to a JSON Schema representation.
92
+ *
93
+ * @param validator - Zod validator to convert.
94
+ * @returns JSON Schema object.
62
95
  */
63
- function extractJoiValidation(validator: Joi.AnySchema): unknown {
64
- return validator.describe();
96
+ function extractZodValidation(validator: z.ZodType): unknown {
97
+ return z.toJSONSchema(validator, {
98
+ target: 'openapi-3.0',
99
+ reused: 'inline'
100
+ });
65
101
  }
66
102
 
67
103
  /**
68
- * Exports an Element to the external schema format
104
+ * Exports an Element to the external schema format.
105
+ *
106
+ * @param element - Element to export.
107
+ * @returns Exported element representation.
69
108
  */
70
109
  export function exportElement(element: Element<unknown>): ExportedElement {
71
110
  return {
72
111
  name: element.name,
73
112
  description: element.description,
74
- type: extractJoiType(element.validator),
113
+ type: extractZodType(element.validator),
75
114
  default: element.default,
76
115
  example: element.example,
77
116
  required: element.isRequired(),
78
117
  sensitive: element.sensitive,
79
- joiValidation: extractJoiValidation(element.validator)
118
+ zodValidation: extractZodValidation(element.validator)
80
119
  };
81
120
  }
82
121
 
83
122
  /**
84
- * Exports a Section to the external schema format
85
- * @param section - The section to export
86
- * @param includeOmitted - Whether to include elements marked with omitFromSchema (default: false)
123
+ * Exports a Section to the external schema format.
124
+ *
125
+ * @param section - The section to export.
126
+ * @param includeOmitted - Whether to include elements marked with omitFromSchema (default: false).
127
+ * @returns Exported section representation.
87
128
  */
88
129
  export function exportSection(
89
130
  section: Section,
@@ -102,10 +143,12 @@ export function exportSection(
102
143
  }
103
144
 
104
145
  /**
105
- * Exports the complete schema to a structured format
106
- * @param name - The name of the configuration
107
- * @param sections - Array of sections to export
108
- * @param includeOmitted - Whether to include elements marked with omitFromSchema (default: false)
146
+ * Exports the complete schema to a structured format.
147
+ *
148
+ * @param name - Name of the configuration.
149
+ * @param sections - Sections to include in the export.
150
+ * @param includeOmitted - Whether to include elements marked with omitFromSchema (default: false).
151
+ * @returns Exported schema representation.
109
152
  */
110
153
  export function exportSchema(
111
154
  name: string,
@@ -21,7 +21,7 @@ describe('Schema Formatters', () => {
21
21
  example: 8080,
22
22
  required: false,
23
23
  sensitive: false,
24
- joiValidation: {
24
+ zodValidation: {
25
25
  type: 'number',
26
26
  rules: [
27
27
  { name: 'min', args: { limit: 1 } },
@@ -37,7 +37,7 @@ describe('Schema Formatters', () => {
37
37
  example: 'sk_test_123',
38
38
  required: true,
39
39
  sensitive: true,
40
- joiValidation: { type: 'string', flags: { presence: 'required' } }
40
+ zodValidation: { type: 'string', flags: { presence: 'required' } }
41
41
  }
42
42
  ]
43
43
  },
@@ -53,7 +53,7 @@ describe('Schema Formatters', () => {
53
53
  example: undefined,
54
54
  required: false,
55
55
  sensitive: false,
56
- joiValidation: { type: 'string' }
56
+ zodValidation: { type: 'string' }
57
57
  }
58
58
  ]
59
59
  }
@@ -148,7 +148,7 @@ describe('Schema Formatters', () => {
148
148
  default: 3000,
149
149
  required: false,
150
150
  sensitive: false,
151
- joiValidation: {}
151
+ zodValidation: {}
152
152
  }
153
153
  ]
154
154
  }
@@ -173,7 +173,7 @@ describe('Schema Formatters', () => {
173
173
  default: 3000,
174
174
  required: false,
175
175
  sensitive: false,
176
- joiValidation: {}
176
+ zodValidation: {}
177
177
  }
178
178
  ]
179
179
  }
@@ -1,4 +0,0 @@
1
-
2
- > @config-bound/schema-export@0.1.0 build
3
- > tsc
4
-
@@ -1,6 +0,0 @@
1
-
2
- > @config-bound/schema-export@0.1.0 format:ci
3
- > prettier --check --config ../../.config/.prettierrc --ignore-path ../../.config/.prettierignore src/**/*.ts
4
-
5
- Checking formatting...
6
- All matched files use Prettier code style!
@@ -1,4 +0,0 @@
1
-
2
- > @config-bound/schema-export@0.1.0 lint:ci
3
- > eslint src/**/*.ts
4
-
@@ -1,12 +0,0 @@
1
-
2
- > @config-bound/schema-export@0.1.0 test
3
- > jest
4
-
5
- PASS src/schemaFormatters.spec.ts (8.823 s)
6
- PASS src/schemaExporter.spec.ts (9.94 s)
7
-
8
- Test Suites: 2 passed, 2 total
9
- Tests: 23 passed, 23 total
10
- Snapshots: 0 total
11
- Time: 11.528 s
12
- Ran all test suites.
package/dist/index.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export { exportElement, exportSection, exportSchema, type ExportedElement, type ExportedSection, type ExportedSchema } from './schemaExporter.js';
2
- export { formatAsJSON, formatAsYAML, formatAsEnvExample } from './schemaFormatters.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,aAAa,EACb,YAAY,EACZ,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,kBAAkB,EACnB,MAAM,uBAAuB,CAAC"}
package/dist/index.js DELETED
@@ -1,3 +0,0 @@
1
- export { exportElement, exportSection, exportSchema } from './schemaExporter.js';
2
- export { formatAsJSON, formatAsYAML, formatAsEnvExample } from './schemaFormatters.js';
3
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,aAAa,EACb,YAAY,EAIb,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,kBAAkB,EACnB,MAAM,uBAAuB,CAAC"}
@@ -1,48 +0,0 @@
1
- import { Section } from '@config-bound/config-bound/section';
2
- import { Element } from '@config-bound/config-bound/element';
3
- /**
4
- * Represents a single configuration element in the exported schema
5
- */
6
- export interface ExportedElement {
7
- name: string;
8
- description?: string;
9
- type: string;
10
- default?: unknown;
11
- example?: unknown;
12
- required: boolean;
13
- sensitive: boolean;
14
- joiValidation: unknown;
15
- }
16
- /**
17
- * Represents a configuration section in the exported schema
18
- */
19
- export interface ExportedSection {
20
- name: string;
21
- description?: string;
22
- elements: ExportedElement[];
23
- }
24
- /**
25
- * The complete exported configuration schema
26
- */
27
- export interface ExportedSchema {
28
- name: string;
29
- sections: ExportedSection[];
30
- }
31
- /**
32
- * Exports an Element to the external schema format
33
- */
34
- export declare function exportElement(element: Element<unknown>): ExportedElement;
35
- /**
36
- * Exports a Section to the external schema format
37
- * @param section - The section to export
38
- * @param includeOmitted - Whether to include elements marked with omitFromSchema (default: false)
39
- */
40
- export declare function exportSection(section: Section, includeOmitted?: boolean): ExportedSection;
41
- /**
42
- * Exports the complete schema to a structured format
43
- * @param name - The name of the configuration
44
- * @param sections - Array of sections to export
45
- * @param includeOmitted - Whether to include elements marked with omitFromSchema (default: false)
46
- */
47
- export declare function exportSchema(name: string, sections: Section[], includeOmitted?: boolean): ExportedSchema;
48
- //# sourceMappingURL=schemaExporter.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaExporter.d.ts","sourceRoot":"","sources":["../src/schemaExporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAG7D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,eAAe,EAAE,CAAC;CAC7B;AAiCD;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,eAAe,CAWxE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,OAAO,EAChB,cAAc,GAAE,OAAe,GAC9B,eAAe,CAWjB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,OAAO,EAAE,EACnB,cAAc,GAAE,OAAe,GAC9B,cAAc,CAKhB"}
@@ -1,66 +0,0 @@
1
- /**
2
- * Extracts type information from a Joi schema
3
- */
4
- function extractJoiType(validator) {
5
- const describe = validator.describe();
6
- if (describe.type === 'alternatives') {
7
- const types = describe.matches?.map((m) => m.schema?.type || 'unknown') || [];
8
- return types.join(' | ') || 'any';
9
- }
10
- if (describe.type === 'string' && describe.allow) {
11
- const allowed = describe.allow;
12
- if (Array.isArray(allowed) && allowed.length > 0) {
13
- return allowed.map((v) => `'${v}'`).join(' | ');
14
- }
15
- }
16
- return describe.type || 'unknown';
17
- }
18
- /**
19
- * Extracts the raw Joi object from a schema
20
- */
21
- function extractJoiValidation(validator) {
22
- return validator.describe();
23
- }
24
- /**
25
- * Exports an Element to the external schema format
26
- */
27
- export function exportElement(element) {
28
- return {
29
- name: element.name,
30
- description: element.description,
31
- type: extractJoiType(element.validator),
32
- default: element.default,
33
- example: element.example,
34
- required: element.isRequired(),
35
- sensitive: element.sensitive,
36
- joiValidation: extractJoiValidation(element.validator)
37
- };
38
- }
39
- /**
40
- * Exports a Section to the external schema format
41
- * @param section - The section to export
42
- * @param includeOmitted - Whether to include elements marked with omitFromSchema (default: false)
43
- */
44
- export function exportSection(section, includeOmitted = false) {
45
- return {
46
- name: section.name,
47
- description: section.description,
48
- elements: section
49
- .getElements()
50
- .filter((element) => includeOmitted || !element.omitFromSchema)
51
- .map(exportElement)
52
- };
53
- }
54
- /**
55
- * Exports the complete schema to a structured format
56
- * @param name - The name of the configuration
57
- * @param sections - Array of sections to export
58
- * @param includeOmitted - Whether to include elements marked with omitFromSchema (default: false)
59
- */
60
- export function exportSchema(name, sections, includeOmitted = false) {
61
- return {
62
- name,
63
- sections: sections.map((section) => exportSection(section, includeOmitted))
64
- };
65
- }
66
- //# sourceMappingURL=schemaExporter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaExporter.js","sourceRoot":"","sources":["../src/schemaExporter.ts"],"names":[],"mappings":"AAmCA;;GAEG;AACH,SAAS,cAAc,CAAC,SAAwB;IAC9C,MAAM,QAAQ,GAAG,SAAS,CAAC,QAAQ,EAAE,CAAC;IAEtC,IAAI,QAAQ,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;QACrC,MAAM,KAAK,GACT,QAAQ,CAAC,OAAO,EAAE,GAAG,CACnB,CAAC,CAAkB,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,IAAI,SAAS,CACpD,IAAI,EAAE,CAAC;QACV,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;IACpC,CAAC;IAED,IAAI,QAAQ,CAAC,IAAI,KAAK,QAAQ,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;QACjD,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC;QAC/B,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACjD,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClD,CAAC;IACH,CAAC;IAED,OAAO,QAAQ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0,0 @@
1
- {"version":3,"file":"schemaExporter.spec.d.ts","sourceRoot":"","sources":["../src/schemaExporter.spec.ts"],"names":[],"mappings":""}
@@ -1,124 +0,0 @@
1
- import { Section } from '@config-bound/config-bound/section';
2
- import { Element } from '@config-bound/config-bound/element';
3
- import Joi from 'joi';
4
- import { exportElement, exportSection, exportSchema } from './schemaExporter.js';
5
- describe('Schema Exporter', () => {
6
- describe('exportElement', () => {
7
- it('should export a basic element', () => {
8
- const element = new Element('testElement', 'A test element', 'default-value', 'example-value', false, false, Joi.string());
9
- const exported = exportElement(element);
10
- expect(exported.name).toBe('testElement');
11
- expect(exported.description).toBe('A test element');
12
- expect(exported.type).toBe('string');
13
- expect(exported.default).toBe('default-value');
14
- expect(exported.example).toBe('example-value');
15
- expect(exported.required).toBe(false);
16
- expect(exported.sensitive).toBe(false);
17
- });
18
- it('should handle required elements', () => {
19
- const element = new Element('requiredElement', 'A required element', undefined, 42, false, false, Joi.number().required());
20
- const exported = exportElement(element);
21
- expect(exported.required).toBe(true);
22
- });
23
- it('should handle sensitive elements', () => {
24
- const element = new Element('secretKey', 'API secret key', undefined, 'sk_test_123', true, false, Joi.string());
25
- const exported = exportElement(element);
26
- expect(exported.sensitive).toBe(true);
27
- });
28
- it('should handle elements with omitFromSchema', () => {
29
- const element = new Element('privateKey', 'Private configuration key', 'default', 'example', false, true, Joi.string());
30
- expect(element.omitFromSchema).toBe(true);
31
- });
32
- it('should extract joi validation object', () => {
33
- const element = new Element('port', 'Server port', 3000, undefined, false, false, Joi.number().min(1).max(65535).required());
34
- const exported = exportElement(element);
35
- expect(exported.joiValidation).toBeDefined();
36
- expect(exported.joiValidation.type).toBe('number');
37
- expect(exported.joiValidation.rules).toBeDefined();
38
- });
39
- it('should handle enum types', () => {
40
- const element = new Element('environment', 'Runtime environment', 'development', undefined, false, false, Joi.string().valid('development', 'staging', 'production'));
41
- const exported = exportElement(element);
42
- expect(exported.type).toContain('development');
43
- expect(exported.type).toContain('staging');
44
- expect(exported.type).toContain('production');
45
- });
46
- });
47
- describe('exportSection', () => {
48
- it('should export a section with elements', () => {
49
- const elements = [
50
- new Element('host', 'Database host', 'localhost'),
51
- new Element('port', 'Database port', 5432)
52
- ];
53
- const section = new Section('database', elements, 'Database configuration');
54
- const exported = exportSection(section);
55
- expect(exported.name).toBe('database');
56
- expect(exported.description).toBe('Database configuration');
57
- expect(exported.elements).toHaveLength(2);
58
- expect(exported.elements[0].name).toBe('host');
59
- expect(exported.elements[1].name).toBe('port');
60
- });
61
- it('should handle empty sections', () => {
62
- const section = new Section('empty', [], 'Empty section');
63
- const exported = exportSection(section);
64
- expect(exported.name).toBe('empty');
65
- expect(exported.elements).toHaveLength(0);
66
- });
67
- it('should filter out elements with omitFromSchema: true', () => {
68
- const publicElement = new Element('appName', 'Application name', 'myApp', 'exampleApp', false, false, Joi.string());
69
- const privateElement = new Element('internalKey', 'Internal configuration key', 'secret', 'example', false, true, Joi.string());
70
- const section = new Section('app', [publicElement, privateElement], 'Application settings');
71
- const exported = exportSection(section);
72
- expect(exported.name).toBe('app');
73
- expect(exported.description).toBe('Application settings');
74
- expect(exported.elements).toHaveLength(1);
75
- expect(exported.elements[0].name).toBe('appName');
76
- expect(exported.elements.find((e) => e.name === 'internalKey')).toBeUndefined();
77
- });
78
- it('should include omitted elements when includeOmitted is true', () => {
79
- const publicElement = new Element('appName', 'Application name', 'myApp', 'exampleApp', false, false, Joi.string());
80
- const privateElement = new Element('internalKey', 'Internal configuration key', 'secret', 'example', false, true, Joi.string());
81
- const section = new Section('app', [publicElement, privateElement], 'Application settings');
82
- const exported = exportSection(section, true);
83
- expect(exported.name).toBe('app');
84
- expect(exported.description).toBe('Application settings');
85
- expect(exported.elements).toHaveLength(2);
86
- expect(exported.elements[0].name).toBe('appName');
87
- expect(exported.elements[1].name).toBe('internalKey');
88
- });
89
- });
90
- describe('exportSchema', () => {
91
- it('should export a complete schema', () => {
92
- const appElements = [
93
- new Element('port', 'Application port', 3000),
94
- new Element('host', 'Application host', 'localhost')
95
- ];
96
- const dbElements = [
97
- new Element('connectionString', 'Database connection', undefined)
98
- ];
99
- const sections = [
100
- new Section('app', appElements, 'Application settings'),
101
- new Section('database', dbElements, 'Database settings')
102
- ];
103
- const schema = exportSchema('myApp', sections);
104
- expect(schema.name).toBe('myApp');
105
- expect(schema.sections).toHaveLength(2);
106
- expect(schema.sections[0].name).toBe('app');
107
- expect(schema.sections[1].name).toBe('database');
108
- });
109
- it('should include omitted elements when includeOmitted is true', () => {
110
- const publicElement = new Element('appName', 'Application name', 'myApp', 'exampleApp', false, false, Joi.string());
111
- const privateElement = new Element('internalKey', 'Internal configuration key', 'secret', 'example', false, true, Joi.string());
112
- const sections = [
113
- new Section('app', [publicElement, privateElement], 'Application settings')
114
- ];
115
- const schema = exportSchema('myApp', sections, true);
116
- expect(schema.name).toBe('myApp');
117
- expect(schema.sections).toHaveLength(1);
118
- expect(schema.sections[0].elements).toHaveLength(2);
119
- expect(schema.sections[0].elements[0].name).toBe('appName');
120
- expect(schema.sections[0].elements[1].name).toBe('internalKey');
121
- });
122
- });
123
- });
124
- //# sourceMappingURL=schemaExporter.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaExporter.spec.js","sourceRoot":"","sources":["../src/schemaExporter.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAC7D,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,EACL,aAAa,EACb,aAAa,EACb,YAAY,EACb,MAAM,qBAAqB,CAAC;AAE7B,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;QAC7B,EAAE,CAAC,+BAA+B,EAAE,GAAG,EAAE;YACvC,MAAM,OAAO,GAAG,IAAI,OAAO,CACzB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eA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,MAAM,EAAE,CACb,CAAC;YACF,MAAM,cAAc,GAAG,IAAI,OAAO,CAChC,aAAa,EACb,4BAA4B,EAC5B,QAAQ,EACR,SAAS,EACT,KAAK,EACL,IAAI,EACJ,GAAG,CAAC,MAAM,EAAE,CACb,CAAC;YAEF,MAAM,QAAQ,GAAG;gBACf,IAAI,OAAO,CACT,KAAK,EACL,CAAC,aAAa,EAAE,cAAc,CAAC,EAC/B,sBAAsB,CACvB;aACF,CAAC;YAEF,MAAM,MAAM,GAAG,YAAY,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;YAErD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAClC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YACxC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YACpD,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5D,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAClE,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,22 +0,0 @@
1
- import { ExportedSchema } from './schemaExporter.js';
2
- /**
3
- * Formats the schema as JSON string
4
- * @param schema - The schema to format
5
- * @param pretty - Whether to pretty print the JSON
6
- * @returns The configuration schema as a JSON string
7
- */
8
- export declare function formatAsJSON(schema: ExportedSchema, pretty?: boolean): string;
9
- /**
10
- * Formats the schema as YAML string
11
- * @param schema - The schema to format
12
- * @returns The configuration schema as a YAML string
13
- */
14
- export declare function formatAsYAML(schema: ExportedSchema): string;
15
- /**
16
- * Formats the schema as a .env.example file
17
- * @param schema - The exported schema
18
- * @param prefix - Optional prefix for environment variable names (e.g., 'MYAPP')
19
- * @returns The .env.example file content as a string
20
- */
21
- export declare function formatAsEnvExample(schema: ExportedSchema, prefix?: string): string;
22
- //# sourceMappingURL=schemaFormatters.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaFormatters.d.ts","sourceRoot":"","sources":["../src/schemaFormatters.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAmB,MAAM,qBAAqB,CAAC;AAEtE;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,MAAM,EAAE,cAAc,EACtB,MAAM,GAAE,OAAc,GACrB,MAAM,CAER;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,CAM3D;AAwDD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,cAAc,EACtB,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CA+BR"}
@@ -1,99 +0,0 @@
1
- import yaml from 'js-yaml';
2
- /**
3
- * Formats the schema as JSON string
4
- * @param schema - The schema to format
5
- * @param pretty - Whether to pretty print the JSON
6
- * @returns The configuration schema as a JSON string
7
- */
8
- export function formatAsJSON(schema, pretty = true) {
9
- return JSON.stringify(schema, null, pretty ? 2 : 0);
10
- }
11
- /**
12
- * Formats the schema as YAML string
13
- * @param schema - The schema to format
14
- * @returns The configuration schema as a YAML string
15
- */
16
- export function formatAsYAML(schema) {
17
- return yaml.dump(schema, {
18
- indent: 2,
19
- lineWidth: 80,
20
- noRefs: true
21
- });
22
- }
23
- /**
24
- * Generates an environment variable name from section and element names
25
- * @param sectionName - The name of the section
26
- * @param elementName - The name of the element
27
- * @param prefix - Optional prefix for the environment variable name
28
- * @returns The environment variable name
29
- */
30
- function generateEnvVarName(sectionName, elementName, prefix) {
31
- let name = `${sectionName}_${elementName}`.replace(/\./g, '_');
32
- if (prefix) {
33
- name = `${prefix}_${name}`;
34
- }
35
- return name.toUpperCase();
36
- }
37
- /**
38
- * Formats a value for display in .env.example file
39
- * @param element - The element to format
40
- * @returns The formatted value
41
- */
42
- function formatEnvValue(element) {
43
- if (element.sensitive) {
44
- if (element.example !== undefined) {
45
- return 'your-example-value';
46
- }
47
- return 'your-secret-value';
48
- }
49
- if (element.example !== undefined) {
50
- return String(element.example);
51
- }
52
- if (element.default !== undefined) {
53
- return String(element.default);
54
- }
55
- switch (element.type) {
56
- case 'string':
57
- return 'your-value';
58
- case 'number':
59
- return '0';
60
- case 'boolean':
61
- return 'true';
62
- case 'array':
63
- return 'value1,value2';
64
- default:
65
- return 'your-value';
66
- }
67
- }
68
- /**
69
- * Formats the schema as a .env.example file
70
- * @param schema - The exported schema
71
- * @param prefix - Optional prefix for environment variable names (e.g., 'MYAPP')
72
- * @returns The .env.example file content as a string
73
- */
74
- export function formatAsEnvExample(schema, prefix) {
75
- const lines = [];
76
- lines.push(`# ${schema.name} Configuration`);
77
- lines.push('# Generated from schema export');
78
- lines.push('');
79
- for (const section of schema.sections) {
80
- if (section.description) {
81
- lines.push(`# ${section.description}`);
82
- }
83
- for (const element of section.elements) {
84
- const envVarName = generateEnvVarName(section.name, element.name, prefix);
85
- const value = formatEnvValue(element);
86
- const isRequired = element.required && element.default === undefined;
87
- if (element.description) {
88
- lines.push(`# ${element.description}${isRequired ? ' (required)' : ''}`);
89
- }
90
- else if (isRequired) {
91
- lines.push('# Required');
92
- }
93
- lines.push(`${envVarName}=${value}`);
94
- lines.push('');
95
- }
96
- }
97
- return lines.join('\n');
98
- }
99
- //# sourceMappingURL=schemaFormatters.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaFormatters.js","sourceRoot":"","sources":["../src/schemaFormatters.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,SAAS,CAAC;AAG3B;;;;;GA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,YAAY,CAAC,CAAC;YAC3B,CAAC;YAED,KAAK,CAAC,IAAI,CAAC,GAAG,UAAU,IAAI,KAAK,EAAE,CAAC,CAAC;YACrC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=schemaFormatters.spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaFormatters.spec.d.ts","sourceRoot":"","sources":["../src/schemaFormatters.spec.ts"],"names":[],"mappings":""}
@@ -1,161 +0,0 @@
1
- import { formatAsJSON, formatAsYAML, formatAsEnvExample } from './schemaFormatters.js';
2
- describe('Schema Formatters', () => {
3
- const mockSchema = {
4
- name: 'testApp',
5
- sections: [
6
- {
7
- name: 'app',
8
- description: 'Application settings',
9
- elements: [
10
- {
11
- name: 'port',
12
- description: 'Server port',
13
- type: 'number',
14
- default: 3000,
15
- example: 8080,
16
- required: false,
17
- sensitive: false,
18
- joiValidation: {
19
- type: 'number',
20
- rules: [
21
- { name: 'min', args: { limit: 1 } },
22
- { name: 'max', args: { limit: 65535 } }
23
- ]
24
- }
25
- },
26
- {
27
- name: 'apiKey',
28
- description: 'API key',
29
- type: 'string',
30
- default: undefined,
31
- example: 'sk_test_123',
32
- required: true,
33
- sensitive: true,
34
- joiValidation: { type: 'string', flags: { presence: 'required' } }
35
- }
36
- ]
37
- },
38
- {
39
- name: 'database',
40
- description: 'Database configuration',
41
- elements: [
42
- {
43
- name: 'host',
44
- description: 'Database host',
45
- type: 'string',
46
- default: 'localhost',
47
- example: undefined,
48
- required: false,
49
- sensitive: false,
50
- joiValidation: { type: 'string' }
51
- }
52
- ]
53
- }
54
- ]
55
- };
56
- describe('formatAsJSON', () => {
57
- it('should format schema as pretty JSON', () => {
58
- const result = formatAsJSON(mockSchema, true);
59
- expect(result).toContain('"name": "testApp"');
60
- expect(result).toContain('"port"');
61
- expect(result).toContain('"database"');
62
- expect(JSON.parse(result)).toEqual(mockSchema);
63
- });
64
- it('should format schema as compact JSON', () => {
65
- const result = formatAsJSON(mockSchema, false);
66
- expect(result).not.toContain('\n');
67
- expect(JSON.parse(result)).toEqual(mockSchema);
68
- });
69
- });
70
- describe('formatAsYAML', () => {
71
- it('should format schema as YAML', () => {
72
- const result = formatAsYAML(mockSchema);
73
- expect(result).toContain('name: testApp');
74
- expect(result).toContain('- name: port');
75
- expect(result).toContain('- name: database');
76
- expect(result).toBeTruthy();
77
- });
78
- });
79
- describe('formatAsEnvExample', () => {
80
- it('should format schema as .env.example without prefix', () => {
81
- const result = formatAsEnvExample(mockSchema);
82
- expect(result).toContain('# testApp Configuration');
83
- expect(result).toContain('# Generated from schema export');
84
- expect(result).toContain('APP_PORT=');
85
- expect(result).toContain('APP_APIKEY=');
86
- expect(result).toContain('DATABASE_HOST=');
87
- expect(result).toContain('# Server port');
88
- expect(result).toContain('# API key');
89
- expect(result).toContain('# Database host');
90
- });
91
- it('should format schema as .env.example with prefix', () => {
92
- const result = formatAsEnvExample(mockSchema, 'MYAPP');
93
- expect(result).toContain('MYAPP_APP_PORT=');
94
- expect(result).toContain('MYAPP_APP_APIKEY=');
95
- expect(result).toContain('MYAPP_DATABASE_HOST=');
96
- });
97
- it('should include example values when available', () => {
98
- const result = formatAsEnvExample(mockSchema);
99
- expect(result).toContain('APP_PORT=8080');
100
- });
101
- it('should include default values when example is not available', () => {
102
- const result = formatAsEnvExample(mockSchema);
103
- expect(result).toContain('DATABASE_HOST=localhost');
104
- });
105
- it('should use placeholder for sensitive values', () => {
106
- const result = formatAsEnvExample(mockSchema);
107
- expect(result).toContain('APP_APIKEY=your-example-value');
108
- });
109
- it('should mark required fields', () => {
110
- const result = formatAsEnvExample(mockSchema);
111
- expect(result).toContain('# API key (required)');
112
- });
113
- it('should handle sections without descriptions', () => {
114
- const schemaWithoutDesc = {
115
- name: 'test',
116
- sections: [
117
- {
118
- name: 'app',
119
- elements: [
120
- {
121
- name: 'port',
122
- type: 'number',
123
- default: 3000,
124
- required: false,
125
- sensitive: false,
126
- joiValidation: {}
127
- }
128
- ]
129
- }
130
- ]
131
- };
132
- const result = formatAsEnvExample(schemaWithoutDesc);
133
- expect(result).toContain('APP_PORT=3000');
134
- });
135
- it('should handle elements without descriptions', () => {
136
- const schemaWithoutElementDesc = {
137
- name: 'test',
138
- sections: [
139
- {
140
- name: 'app',
141
- description: 'App config',
142
- elements: [
143
- {
144
- name: 'port',
145
- type: 'number',
146
- default: 3000,
147
- required: false,
148
- sensitive: false,
149
- joiValidation: {}
150
- }
151
- ]
152
- }
153
- ]
154
- };
155
- const result = formatAsEnvExample(schemaWithoutElementDesc);
156
- expect(result).toContain('# App config');
157
- expect(result).toContain('APP_PORT=3000');
158
- });
159
- });
160
- });
161
- //# sourceMappingURL=schemaFormatters.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaFormatters.spec.js","sourceRoot":"","sources":["../src/schemaFormatters.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,kBAAkB,EACnB,MAAM,uBAAuB,CAAC;AAG/B,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,MAAM,UAAU,GAAmB;QACjC,IAAI,EAAE,SAAS;QACf,QAAQ,EAAE;YACR;gBACE,IAAI,EAAE,KAAK;gBACX,WAAW,EAAE,sBAAsB;gBACnC,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,MAAM;wBACZ,WAAW,EAAE,aAAa;wBAC1B,IAAI,EAAE,QAAQ;wBACd,OAAO,EAAE,IAAI;wBACb,OAAO,EAAE,IAAI;wBACb,QAAQ,EAAE,KAAK;wBACf,SAAS,EAAE,KAAK;wBAChB,aAAa,EAAE;4BACb,IAAI,EAAE,QAAQ;4BACd,KAAK,EAAE;gCACL,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE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