yini-parser 1.4.3 → 1.6.0

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 (90) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.md +187 -35
  3. package/dist/YINI.d.ts +29 -18
  4. package/dist/YINI.js +104 -3
  5. package/dist/core/astBuilder.d.ts +94 -18
  6. package/dist/core/astBuilder.js +439 -376
  7. package/dist/core/errorDataHandler.d.ts +6 -1
  8. package/dist/core/errorDataHandler.js +30 -43
  9. package/dist/core/internalTypes.d.ts +10 -1
  10. package/dist/core/objectBuilder.d.ts +8 -4
  11. package/dist/core/objectBuilder.js +47 -62
  12. package/dist/core/options/defaultParserOptions.d.ts +3 -2
  13. package/dist/core/options/defaultParserOptions.js +11 -2
  14. package/dist/core/options/optionsFunctions.js +6 -4
  15. package/dist/core/parsingRules/modeFromRulesMatcher.d.ts +1 -1
  16. package/dist/core/parsingRules/modeFromRulesMatcher.js +22 -13
  17. package/dist/core/pipeline/pipeline.js +35 -10
  18. package/dist/core/runtime.js +28 -19
  19. package/dist/grammar/generated/YiniLexer.d.ts +40 -53
  20. package/dist/grammar/generated/YiniLexer.js +357 -356
  21. package/dist/grammar/generated/YiniParser.d.ts +174 -118
  22. package/dist/grammar/generated/YiniParser.js +1185 -929
  23. package/dist/grammar/generated/YiniParserVisitor.d.ts +82 -19
  24. package/dist/grammar/generated/YiniParserVisitor.js +1 -1
  25. package/dist/index.d.ts +2 -1
  26. package/dist/index.js +4 -3
  27. package/dist/parsers/extractHeaderParts.d.ts +12 -19
  28. package/dist/parsers/extractHeaderParts.js +57 -46
  29. package/dist/parsers/parseNumber.d.ts +24 -6
  30. package/dist/parsers/parseNumber.js +114 -49
  31. package/dist/parsers/parseSectionHeader.d.ts +11 -3
  32. package/dist/parsers/parseSectionHeader.js +55 -43
  33. package/dist/parsers/parseString.js +39 -20
  34. package/dist/parsers/validateShebangPlacement.d.ts +3 -0
  35. package/dist/parsers/validateShebangPlacement.js +52 -0
  36. package/dist/types/index.d.ts +20 -3
  37. package/dist/utils/print.d.ts +1 -0
  38. package/dist/utils/print.js +5 -1
  39. package/dist/utils/string.d.ts +1 -0
  40. package/dist/utils/string.js +17 -1
  41. package/dist/utils/system.d.ts +1 -0
  42. package/dist/utils/system.js +6 -1
  43. package/dist/utils/yiniHelpers.d.ts +44 -2
  44. package/dist/utils/yiniHelpers.js +134 -46
  45. package/examples/compare-formats.md +1 -1
  46. package/examples/nested.yini +1 -1
  47. package/package.json +11 -3
  48. package/dist/YINI.js.map +0 -1
  49. package/dist/config/env.js.map +0 -1
  50. package/dist/core/astBuilder.js.map +0 -1
  51. package/dist/core/errorDataHandler.js.map +0 -1
  52. package/dist/core/internalTypes.js.map +0 -1
  53. package/dist/core/objectBuilder.js.map +0 -1
  54. package/dist/core/options/defaultParserOptions.js.map +0 -1
  55. package/dist/core/options/failLevel.js.map +0 -1
  56. package/dist/core/options/optionsFunctions.js.map +0 -1
  57. package/dist/core/parsingRules/modeFromRulesMatcher.js.map +0 -1
  58. package/dist/core/parsingRules/rulesConstAndGuards.js.map +0 -1
  59. package/dist/core/pipeline/errorListeners.js.map +0 -1
  60. package/dist/core/pipeline/pipeline.js.map +0 -1
  61. package/dist/core/resultMetadataBuilder.js.map +0 -1
  62. package/dist/core/runtime.js.map +0 -1
  63. package/dist/dev/main.d.ts +0 -1
  64. package/dist/dev/main.js +0 -168
  65. package/dist/dev/main.js.map +0 -1
  66. package/dist/dev/quick-test-samples/defect-inputs.d.ts +0 -37
  67. package/dist/dev/quick-test-samples/defect-inputs.js +0 -106
  68. package/dist/dev/quick-test-samples/defect-inputs.js.map +0 -1
  69. package/dist/dev/quick-test-samples/valid-inputs.d.ts +0 -21
  70. package/dist/dev/quick-test-samples/valid-inputs.js +0 -422
  71. package/dist/dev/quick-test-samples/valid-inputs.js.map +0 -1
  72. package/dist/grammar/generated/YiniLexer.js.map +0 -1
  73. package/dist/grammar/generated/YiniParser.js.map +0 -1
  74. package/dist/grammar/generated/YiniParserVisitor.js.map +0 -1
  75. package/dist/index.js.map +0 -1
  76. package/dist/parsers/extractHeaderParts.js.map +0 -1
  77. package/dist/parsers/extractSignificantYiniLine.js.map +0 -1
  78. package/dist/parsers/parseBoolean.js.map +0 -1
  79. package/dist/parsers/parseNull.js.map +0 -1
  80. package/dist/parsers/parseNumber.js.map +0 -1
  81. package/dist/parsers/parseSectionHeader.js.map +0 -1
  82. package/dist/parsers/parseString.js.map +0 -1
  83. package/dist/types/index.js.map +0 -1
  84. package/dist/utils/number.js.map +0 -1
  85. package/dist/utils/object.js.map +0 -1
  86. package/dist/utils/pathAndFileName.js.map +0 -1
  87. package/dist/utils/print.js.map +0 -1
  88. package/dist/utils/string.js.map +0 -1
  89. package/dist/utils/system.js.map +0 -1
  90. package/dist/utils/yiniHelpers.js.map +0 -1
package/dist/dev/main.js DELETED
@@ -1,168 +0,0 @@
1
- "use strict";
2
- // src/dev/main.ts
3
- var __importDefault = (this && this.__importDefault) || function (mod) {
4
- return (mod && mod.__esModule) ? mod : { "default": mod };
5
- };
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- /*
8
- * This includes of dev / debug / demo / custom-tesing code.
9
- *
10
- * https://github.com/YINI-lang/yini-parser-typescript/blob/main/docs/Project-Setup.md
11
- *
12
- * Run this code with the following commands:
13
- * npm run start:main
14
- * or
15
- * npm run start:main:dev:debug
16
- */
17
- const env_1 = require("../config/env");
18
- const print_1 = require("../utils/print");
19
- const YINI_1 = __importDefault(require("../YINI"));
20
- const defect_inputs_1 = require("./quick-test-samples/defect-inputs");
21
- require("./quick-test-samples/valid-inputs"); // validConfigComplex,
22
- (0, print_1.debugPrint)();
23
- (0, print_1.debugPrint)('-> Entered dev/main.ts');
24
- (0, print_1.debugPrint)();
25
- if ((0, env_1.isDev)() || (0, env_1.isDebug)()) {
26
- console.log(`process.env?.NODE_ENV = '${process.env?.NODE_ENV}'`);
27
- console.log(`process.env?.APP_ENV = '${process.env?.APP_ENV}'`);
28
- console.log(`process.env?.IS_DEBUG = '${process.env?.IS_DEBUG}'`);
29
- (0, print_1.debugPrint)();
30
- console.log(`localNodeEnv = '${env_1.localNodeEnv}'`);
31
- console.log(` localAppEnv = '${env_1.localAppEnv}'`);
32
- console.log(' isProdEnv() = ' + (0, env_1.isProdEnv)());
33
- console.log(' isDevEnv() = ' + (0, env_1.isDevEnv)());
34
- console.log(' isTestEnv() = ' + (0, env_1.isTestEnv)());
35
- console.log();
36
- console.log(' isDev() = ' + (0, env_1.isDev)());
37
- console.log(' isDebug() = ' + (0, env_1.isDebug)());
38
- console.log();
39
- }
40
- const debugTestObj = {
41
- name: 'e_test',
42
- lang: 'TypeScript',
43
- };
44
- (0, print_1.debugPrint)('debugTestObj:');
45
- (0, print_1.debugPrint)(debugTestObj);
46
- (0, print_1.debugPrint)();
47
- if ((0, env_1.isProdEnv)()) {
48
- // Do nothing, and exit.
49
- }
50
- else {
51
- if (env_1.localAppEnv === 'local' && env_1.localNodeEnv !== 'test') {
52
- // const yiniContent = `#!/usr/bin/env yini
53
- // ^ App
54
- // name = "Shebang-demo"`
55
- const yiniContent = ` #!/usr/bin/env yini
56
- ^ App
57
- // val = 3e3
58
- // 3val = 33
59
- name = "Shebang-\\"demo"
60
- value = c"Hello World"
61
- badEscape = c"E:\\logs\\nebula\\app.log"
62
- valueA = c"\\x41"
63
- `;
64
- console.log('--start0------------------------------------------');
65
- const res0 = YINI_1.default.parse(yiniContent, {
66
- strictMode: false,
67
- failLevel: 'ignore-errors',
68
- // includeMetadata: true,
69
- // includeDiagnostics: true,
70
- // requireDocTerminator: 'optional',
71
- });
72
- console.log('res0:');
73
- console.log(res0);
74
- console.log('--end------------------------------------------\n');
75
- console.log('--start2------------------------------------------');
76
- const res2 = YINI_1.default.parse(defect_inputs_1.defectConfig2Combo3, {
77
- strictMode: true,
78
- failLevel: 'ignore-errors',
79
- // includeMetadata: true,
80
- // includeDiagnostics: true,
81
- // requireDocTerminator: 'optional',
82
- });
83
- console.log('res2:');
84
- console.log(res2);
85
- console.log('--end------------------------------------------\n');
86
- console.log('--start3------------------------------------------');
87
- const res3 = YINI_1.default.parse(defect_inputs_1.defectConfigCombo3, {
88
- strictMode: false,
89
- failLevel: 'ignore-errors',
90
- // includeMetadata: true,
91
- // includeDiagnostics: true,
92
- // requireDocTerminator: 'optional',
93
- });
94
- console.log('res3:');
95
- console.log(res3);
96
- console.log('--end------------------------------------------\n');
97
- console.log('--start4------------------------------------------');
98
- const res4 = YINI_1.default.parse(defect_inputs_1.defectConfigCombo3, {
99
- strictMode: true,
100
- failLevel: 'ignore-errors',
101
- // includeMetadata: true,
102
- // includeDiagnostics: true,
103
- // requireDocTerminator: 'optional',
104
- });
105
- console.log('res4:');
106
- console.log(res4);
107
- console.log('--end------------------------------------------\n');
108
- console.log('--start5------------------------------------------');
109
- const res5 = YINI_1.default.parse(defect_inputs_1.defectConfig2Combo3, {
110
- strictMode: false,
111
- // failLevel: 'ignore-errors',
112
- // includeMetadata: true,
113
- // includeDiagnostics: true,
114
- // requireDocTerminator: 'optional',
115
- });
116
- console.log('res5:');
117
- console.log(res5);
118
- console.log('--end------------------------------------------\n');
119
- console.log('--start6------------------------------------------');
120
- const res6 = YINI_1.default.parse(defect_inputs_1.defectConfig2Combo3, {
121
- strictMode: true,
122
- // failLevel: 'ignore-errors',
123
- // includeMetadata: true,
124
- // includeDiagnostics: true,
125
- // requireDocTerminator: 'optional',
126
- });
127
- console.log('res6:');
128
- console.log(res6);
129
- console.log('--end------------------------------------------\n');
130
- console.log('--start7------------------------------------------');
131
- const res7 = YINI_1.default.parse(defect_inputs_1.defectConfig2Combo3, {
132
- throwOnError: true,
133
- //strictMode: false,
134
- // failLevel: 'ignore-errors',
135
- // includeMetadata: true,
136
- // includeDiagnostics: true,
137
- // requireDocTerminator: 'optional',
138
- });
139
- console.log('res7:');
140
- console.log(res7);
141
- console.log('--end------------------------------------------\n');
142
- console.log('--start8------------------------------------------');
143
- const res8 = YINI_1.default.parse(defect_inputs_1.defectConfig2Combo3, {
144
- strictMode: true,
145
- throwOnError: true,
146
- // failLevel: 'ignore-errors',
147
- // includeMetadata: true,
148
- // includeDiagnostics: true,
149
- // requireDocTerminator: 'optional',
150
- });
151
- console.log('res8:');
152
- console.log(res8);
153
- console.log('--end------------------------------------------\n');
154
- // console.log(
155
- // toPrettyJSON(
156
- // // YINI.parse(validConfig, {
157
- // YINI.parse(yiniContent, {
158
- // strictMode: true,
159
- // // failLevel: 'ignore-errors',
160
- // // includeMetadata: true,
161
- // // includeDiagnostics: true,
162
- // // requireDocTerminator: 'optional',
163
- // }),
164
- // ),
165
- // )
166
- }
167
- }
168
- //# sourceMappingURL=main.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/dev/main.ts"],"names":[],"mappings":";AAAA,kBAAkB;;;;;AAElB;;;;;;;;;GASG;AAEH,uCAQsB;AACtB,0CAAsE;AACtE,mDAA0B;AAC1B,sEAI2C;AAC3C,6CAA0C,CAAC,sBAAsB;AAMjE,IAAA,kBAAU,GAAE,CAAA;AACZ,IAAA,kBAAU,EAAC,wBAAwB,CAAC,CAAA;AACpC,IAAA,kBAAU,GAAE,CAAA;AAEZ,IAAI,IAAA,WAAK,GAAE,IAAI,IAAA,aAAO,GAAE,EAAE,CAAC;IACvB,OAAO,CAAC,GAAG,CAAC,4BAA4B,OAAO,CAAC,GAAG,EAAE,QAAQ,GAAG,CAAC,CAAA;IACjE,OAAO,CAAC,GAAG,CAAC,4BAA4B,OAAO,CAAC,GAAG,EAAE,OAAO,GAAG,CAAC,CAAA;IAChE,OAAO,CAAC,GAAG,CAAC,4BAA4B,OAAO,CAAC,GAAG,EAAE,QAAQ,GAAG,CAAC,CAAA;IAEjE,IAAA,kBAAU,GAAE,CAAA;IACZ,OAAO,CAAC,GAAG,CAAC,mBAAmB,kBAAY,GAAG,CAAC,CAAA;IAC/C,OAAO,CAAC,GAAG,CAAC,mBAAmB,iBAAW,GAAG,CAAC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A4B;YAC5B,oCAAoC;SACvC,CAAC,CAAA;QACF,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;QACpB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;QACjB,OAAO,CAAC,GAAG,CAAC,mDAAmD,CAAC,CAAA;QAEhE,eAAe;QACf,oBAAoB;QACpB,uCAAuC;QACvC,oCAAoC;QACpC,gCAAgC;QAChC,6CAA6C;QAC7C,wCAAwC;QACxC,2CAA2C;QAC3C,mDAAmD;QACnD,cAAc;QACd,SAAS;QACT,IAAI;IACR,CAAC;AACL,CAAC"}
@@ -1,37 +0,0 @@
1
- /**
2
- * Development-only YINI samples with intentional defects.
3
- *
4
- * These inputs are used for quick manual testing during development
5
- * via src/dev/.
6
- *
7
- * Each sample contains ONE clearly documented defect.
8
- * They are NOT part of the automated test suite.
9
- *
10
- * All real testing belongs in /tests/.
11
- */
12
- /**
13
- * Invalid assignment operator (`:=` instead of `=`).
14
- */
15
- export declare const defectInvalidAssignmentOperator = "\n^ App\nname = 'Hello'\ntxt := 'World' // INVALID: assignment operator must be \"=\"\n";
16
- /**
17
- * Invalid section name (starts with a number and contains hyphen).
18
- */
19
- export declare const defectInvalidSectionName = "\n^ App\nname = \"My Application\"\n\n^ 20-Database // INVALID: section name must start with a letter or underscore\nhost = \"localhost\"\nport = 5432\n";
20
- /**
21
- * Invalid numeric literal (double underscore).
22
- */
23
- export declare const defectInvalidNumericLiteral = "\n^ App\nname = \"Demo\"\n\n^ Database\nhost = \"localhost\"\nport = 5432\n\nsomeKey = 33__33 // INVALID: malformed numeric literal\n";
24
- /**
25
- * Duplicate key in the same section.
26
- */
27
- export declare const defectDuplicateKey = "\n^ App\nname = \"Demo\"\nname = \"Override\" // INVALID: duplicate key in same section\n";
28
- /**
29
- * Section level jump (^^ without parent ^).
30
- */
31
- export declare const defectSectionLevelJump = "\n^^ Logging // INVALID: section level jumps without parent\nenabled = true\n";
32
- /**
33
- * Unterminated string literal.
34
- */
35
- export declare const defectUnterminatedString = "\n^ App\nname = \"Demo\nversion = \"1.0.0\"\n";
36
- export declare const defectConfigCombo3 = "\n^ App\nname = \"Combo defects sample\"\n\nmode := \"dev\" // INVALID #1: ':=' is not a valid assignment operator (must be '=')\n\n^ 2Database // INVALID #2: section name starts with a digit (must start with A-Z/_ or be backticked)\nhost = \"localhost\"\n\nports = [80, 443, 8080 // INVALID #3: missing closing ']' in array literal\n";
37
- export declare const defectConfig2Combo3 = "\n^ App\nname = \"ComboTest\"\nversion = 1.0\n\n ^^ Database\n host = \"localhost\"\n port = 54_32 // INVALID number format: underscores not allowed inside numbers\n\n auth = { user: \"admin\", pass: \"secret\" }\n\n ^^^ Logging\n enabled = maybe // INVALID boolean: only true/false/on/off/yes/no allowed\n\n ^ Network\n timeout = 30\n\n^ Server\n host = \"0.0.0.0\"\n port := 8080 // INVALID assignment operator: must use \"=\" not \":=\"\n\n ^^ Security\n useTLS = true\n";
@@ -1,106 +0,0 @@
1
- "use strict";
2
- // src/dev/quick-test-samples/defect-inputs.ts
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.defectConfig2Combo3 = exports.defectConfigCombo3 = exports.defectUnterminatedString = exports.defectSectionLevelJump = exports.defectDuplicateKey = exports.defectInvalidNumericLiteral = exports.defectInvalidSectionName = exports.defectInvalidAssignmentOperator = void 0;
5
- /**
6
- * Development-only YINI samples with intentional defects.
7
- *
8
- * These inputs are used for quick manual testing during development
9
- * via src/dev/.
10
- *
11
- * Each sample contains ONE clearly documented defect.
12
- * They are NOT part of the automated test suite.
13
- *
14
- * All real testing belongs in /tests/.
15
- */
16
- /**
17
- * Invalid assignment operator (`:=` instead of `=`).
18
- */
19
- exports.defectInvalidAssignmentOperator = `
20
- ^ App
21
- name = 'Hello'
22
- txt := 'World' // INVALID: assignment operator must be "="
23
- `;
24
- /**
25
- * Invalid section name (starts with a number and contains hyphen).
26
- */
27
- exports.defectInvalidSectionName = `
28
- ^ App
29
- name = "My Application"
30
-
31
- ^ 20-Database // INVALID: section name must start with a letter or underscore
32
- host = "localhost"
33
- port = 5432
34
- `;
35
- /**
36
- * Invalid numeric literal (double underscore).
37
- */
38
- exports.defectInvalidNumericLiteral = `
39
- ^ App
40
- name = "Demo"
41
-
42
- ^ Database
43
- host = "localhost"
44
- port = 5432
45
-
46
- someKey = 33__33 // INVALID: malformed numeric literal
47
- `;
48
- /**
49
- * Duplicate key in the same section.
50
- */
51
- exports.defectDuplicateKey = `
52
- ^ App
53
- name = "Demo"
54
- name = "Override" // INVALID: duplicate key in same section
55
- `;
56
- /**
57
- * Section level jump (^^ without parent ^).
58
- */
59
- exports.defectSectionLevelJump = `
60
- ^^ Logging // INVALID: section level jumps without parent
61
- enabled = true
62
- `;
63
- /**
64
- * Unterminated string literal.
65
- */
66
- exports.defectUnterminatedString = `
67
- ^ App
68
- name = "Demo
69
- version = "1.0.0"
70
- `;
71
- exports.defectConfigCombo3 = `
72
- ^ App
73
- name = "Combo defects sample"
74
-
75
- mode := "dev" // INVALID #1: ':=' is not a valid assignment operator (must be '=')
76
-
77
- ^ 2Database // INVALID #2: section name starts with a digit (must start with A-Z/_ or be backticked)
78
- host = "localhost"
79
-
80
- ports = [80, 443, 8080 // INVALID #3: missing closing ']' in array literal
81
- `;
82
- exports.defectConfig2Combo3 = `
83
- ^ App
84
- name = "ComboTest"
85
- version = 1.0
86
-
87
- ^^ Database
88
- host = "localhost"
89
- port = 54_32 // INVALID number format: underscores not allowed inside numbers
90
-
91
- auth = { user: "admin", pass: "secret" }
92
-
93
- ^^^ Logging
94
- enabled = maybe // INVALID boolean: only true/false/on/off/yes/no allowed
95
-
96
- ^ Network
97
- timeout = 30
98
-
99
- ^ Server
100
- host = "0.0.0.0"
101
- port := 8080 // INVALID assignment operator: must use "=" not ":="
102
-
103
- ^^ Security
104
- useTLS = true
105
- `;
106
- //# sourceMappingURL=defect-inputs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"defect-inputs.js","sourceRoot":"","sources":["../../../src/dev/quick-test-samples/defect-inputs.ts"],"names":[],"mappings":";AAAA,8CAA8C;;;AAE9C;;;;;;;;;;GAUG;AAEH;;GAEG;AACU,QAAA,+BAA+B,GAAG;;;;CAI9C,CAAA;AAED;;GAEG;AACU,QAAA,wBAAwB,GAAG;;;;;;;CAOvC,CAAA;AAED;;GAEG;AACU,QAAA,2BAA2B,GAAG;;;;;;;;;CAS1C,CAAA;AAED;;GAEG;AACU,QAAA,kBAAkB,GAAG;;;;CAIjC,CAAA;AAED;;GAEG;AACU,QAAA,sBAAsB,GAAG;;;CAGrC,CAAA;AAED;;GAEG;AACU,QAAA,wBAAwB,GAAG;;;;CAIvC,CAAA;AAEY,QAAA,kBAAkB,GAAG;;;;;;;;;;CAUjC,CAAA;AAEY,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;CAuBlC,CAAA"}
@@ -1,21 +0,0 @@
1
- /**
2
- * Development-only YINI samples.
3
- *
4
- * These inputs are used for quick manual testing during development
5
- * via src/dev/quick-test-samples/main.ts. They are NOT part of the automated test suite.
6
- *
7
- * All real testing belongs in /tests/.
8
- */
9
- export declare const validConfigShort = "\n^ App\nname = 'Hello'\n";
10
- export declare const validConfigBasic = "\n^ App\nname = \"My Application\"\nversion = 1.0\nfeatures = [\"search\", \"logging\"]\n\n // Nested sub-section under App\n ^^ Database\n host = \"localhost\"\n port = 5432\n";
11
- export declare const validConfigWithObjects = "\n^ App\n name = \"Demo\"\n version = \"1.0.0\"\n features = [ \"search\", \"dark-mode\" ]\n\n^ Database\n host = \"localhost\"\n port = 5432\n auth = { user: \"admin\", pass: \"secret\" }\n";
12
- /**
13
- * Covers booleans, nulls, number formats, and deeper nesting
14
- */
15
- export declare const validConfigAdvanced = "\n^ Server\n enabled = ON\n timeout = 3.5\n retries = 5\n threshold = 1e-3\n fallback = null\n\n ^^ Logging\n level = \"info\"\n output = { file: \"app.log\", rotate: true }\n";
16
- /**
17
- * Covers arrays of objects and realistic structure
18
- */
19
- export declare const validConfigComplex = "\n^ App\n services = [\n { name: \"api\", port: 8080 },\n { name: \"web\", port: 3000 },\n { name: \"auth\", port: 9000 }\n ]\n\n^ Security\n roles = [\"admin\", \"user\", \"guest\"]\n enabled = true\n";
20
- export declare const validConfigComplexBigA = "\n@YINI\n\n// Example A: Corporate SaaS Platform.\n\n^ App\nname = \"Acme Platform\" // Example Platform\ndescription = \"The word \u201CAcme\u201D has been used for over 100 years in technical and business examples.\"\nmeaning = \"It comes from Greek akm\u1E17 (\u1F00\u03BA\u03BC\u03AE), meaning \u201Cthe highest point\u201D or \u201Cbest\u201D.\"\nversion = \"2.3.1\"\ndebug = OFF\nenvironment = \"production\"\nmaintainers = [\"ops@acme.com\", \"dev@acme.com\"]\n\n ^^ Features\n enableSearch = true\n enablePayments = true\n enableAnalytics = false\n experimental = [\"new-ui\", \"streaming-api\"]\n\n ^^ Limits\n maxUsers = 50000\n requestTimeoutMs = 3500\n retryPolicy = { maxRetries: 5, backoff: \"exponential\" }\n\n ^^ Database\n engine = \"postgres\"\n host = \"db.internal.acme.com\"\n port = 5432\n ssl = true\n pool = { min: 5, max: 50 }\n\n ^^^ Credentials\n username = \"app_user\"\n password = \"****\"\n rotateEveryDays = 90\n\n ^^ API\n baseUrl = \"https://api.acme.com\"\n publicEndpoints = [\"/health\", \"/status\"]\n internalEndpoints = [\"/admin\", \"/metrics\"]\n\n ^^^ Auth\n provider = \"oauth2\"\n tokenTTLSeconds = 3600\n scopes = [\"read\", \"write\", \"admin\"]\n\n ^^^^ Clients\n web = { clientId: \"web-123\", redirectUri: \"https://acme.com/callback\" }\n mobile = { clientId: \"mob-456\", redirectUri: \"acme://auth\" }\n\n^ Logging\nlevel = \"info\"\nformat = \"json\"\noutputs = [\"stdout\", \"file\"]\n\n ^^ File\n path = \"/var/log/acme/app.log\"\n maxSizeMB = 100\n rotate = true\n keepFiles = 10\n\n ^^ Metrics\n enabled = true\n endpoint = \"/metrics\"\n sampleRate = 0.25\n\n^ Services\nenabled = true\n\n ^^ Email\n provider = \"smtp\"\n host = \"smtp.acme.com\"\n port = 587\n secure = false\n from = \"no-reply@acme.com\"\n\n ^^^ Credentials\n user = \"mailer\"\n pass = \"mailer-secret\"\n\n ^^ Cache\n type = \"redis\"\n host = \"cache.internal.acme.com\"\n port = 6379\n ttlSeconds = 600\n\n ^^^ Cluster\n nodes = [\n { host: \"cache-1.internal\", port: 6379 },\n { host: \"cache-2.internal\", port: 6379 },\n { host: \"cache-3.internal\", port: 6379 }\n ]\n\n^ Observability\ntracing = true\ntracingProvider = \"opentelemetry\"\ntraceSampleRate = 0.1\n\n ^^ Exporters\n jaeger = { enabled: true, endpoint: \"http://jaeger:14268/api/traces\" }\n prometheus = { enabled: true, endpoint: \"http://prom:9090\" }\n\n^ Security\nallowedIPs = [\"10.0.0.0/8\", \"192.168.0.0/16\"]\nblockedCountries = [\"KP\", \"SD\"]\n\n ^^ Policies\n passwordMinLength = 14\n require2FA = true\n sessionTTLMinutes = 120\n\n ^^^ Lockout\n maxAttempts = 5\n lockoutMinutes = 30\n";
21
- export declare const validConfigComplexBigB = "\n@YINI\n\n// Example B: High-Security Distributed Control System.\n\n^ App\nname = 'Nebula Control Suite'\ndescription = 'A distributed operations platform for autonomous systems and edge analytics.'\nmeaning = 'Nebula comes from Latin \"nebula\" meaning mist or cloud.'\nversion = '5.0.0-rc.4'\ndebug = ON\nenvironment = 'staging'\nmaintainers = ['infra@nebula.io', 'platform@nebula.io', 'secops@nebula.io']\n\n ^^ Features\n enableSearch = false\n enablePayments = false\n enableAnalytics = true\n experimental = ['vector-engine', 'adaptive-ui', 'ai-routing']\n\n ^^ Limits\n maxUsers = 120000\n requestTimeoutMs = 7200\n retryPolicy = {\n maxRetries: 9,\n backoff: 'fibonacci',\n retryOn: ['timeout', '5xx', 'throttle'],\n schedule: [\n { attempt: 1, delayMs: 80 },\n { attempt: 2, delayMs: 160 },\n { attempt: 3, delayMs: 320 },\n { attempt: 4, delayMs: 640 },\n { attempt: 5, delayMs: 1280 }\n ]\n }\n\n ^^ Database\n engine = 'cockroachdb'\n host = 'cluster.db.nebula.io'\n port = 26257\n ssl = true\n pool = {\n min: 12,\n max: 120,\n warmup: {\n enabled: true,\n strategy: 'aggressive',\n steps: [10, 25, 50, 75, 100],\n healthChecks: [\n { name: 'connectivity', timeoutMs: 300 },\n { name: 'replication', maxLagMs: 200 },\n { name: 'quorum', minNodes: 3 }\n ]\n }\n }\n\n ^^^ Credentials\n username = 'nebula_app'\n password = '****'\n rotateEveryDays = 45\n history = [\n { rotatedAt: '2025-05-10', reason: 'scheduled' },\n { rotatedAt: '2025-03-02', reason: 'key-compromise' },\n { rotatedAt: '2024-12-15', reason: 'policy-change' }\n ]\n\n ^^ API\n baseUrl = 'https://api.nebula.io'\n publicEndpoints = ['/health', '/status', '/version']\n internalEndpoints = ['/admin', '/metrics', '/orchestrator', '/scheduler']\n\n ^^^ Auth\n provider = 'oidc'\n tokenTTLSeconds = 5400\n scopes = ['read', 'write', 'deploy', 'audit']\n\n ^^^^ Clients\n web = {\n clientId: 'nebula-web-prod',\n redirectUri: 'https://nebula.io/auth/callback',\n allowedOrigins: ['https://nebula.io', 'https://console.nebula.io'],\n secrets: [\n { id: 'alpha', value: 'QX7faP9', active: true },\n { id: 'beta', value: 'LM8KdW2', active: true },\n { id: 'legacy', value: 'OLD-KEY-DO-NOT-USE', active: false }\n ]\n }\n\n mobile = {\n clientId: 'nebula-mobile',\n redirectUri: 'nebula://auth',\n platforms: [\n { name: 'ios', minVersion: '15.2', enabled: true },\n { name: 'android', minVersion: '11', enabled: true },\n { name: 'harmonyos', minVersion: '4', enabled: false }\n ],\n refreshPolicy: {\n enabled: true,\n limits: { perHour: 60, perDay: 600 },\n audit: [\n { event: 'refresh', severity: 'info' },\n { event: 'suspicious-location', severity: 'warning' },\n { event: 'credential-stuffing', severity: 'critical' }\n ]\n }\n }\n\n^ Logging\nlevel = 'debug'\nformat = 'ndjson'\noutputs = ['stdout', 'file', 'syslog']\n\n ^^ File\n path = '/srv/log/nebula/nebula.log'\n maxSizeMB = 250\n rotate = true\n keepFiles = 30\n\n ^^ Metrics\n enabled = true\n endpoint = '/internal/metrics'\n sampleRate = 0.75\n\n^ Services\nenabled = true\n\n ^^ Email\n provider = 'ses'\n host = 'email.nebula.io'\n port = 465\n secure = true\n from = 'system@nebula.io'\n\n ^^^ Credentials\n user = 'mailer-nebula'\n pass = 'MAIL-SEC-9921'\n\n ^^ Cache\n type = 'keydb'\n host = 'cache.nebula.internal'\n port = 6380\n ttlSeconds = 1800\n\n ^^^ Cluster\n nodes = [\n { host: 'cache-a.nebula', port: 6380, role: 'primary', zones: ['eu-north-1a'] },\n { host: 'cache-b.nebula', port: 6380, role: 'replica', zones: ['eu-north-1b'] },\n { host: 'cache-c.nebula', port: 6380, role: 'replica', zones: ['eu-north-1c'] },\n { host: 'cache-d.nebula', port: 6380, role: 'observer', zones: ['eu-north-1a'] }\n ]\n\n ^^^ Failover\n strategy = {\n mode: 'predictive',\n thresholds: { errorRate: 0.08, latencyMs: 180 },\n actions: [\n { step: 'drain-traffic', timeoutMs: 1500 },\n { step: 'promote-replica', timeoutMs: 2000 },\n { step: 'resync', propagate: true },\n { step: 'notify', channels: ['pagerduty', 'slack', 'email'] }\n ]\n }\n\n^ Observability\ntracing = true\ntracingProvider = 'tempo'\ntraceSampleRate = 0.35\n\n ^^ Exporters\n jaeger = {\n enabled: false,\n endpoint: 'http://jaeger.internal/api/traces',\n tags: {\n region: 'eu-north',\n environment: 'staging',\n build: { version: '5.0.0-rc.4', commit: 'c8f91d2', dirty: true }\n }\n }\n\n prometheus = {\n enabled: true,\n endpoint: 'http://prometheus.nebula:9090',\n scrapeIntervals: [2, 5, 10, 30],\n retention: { days: 90, maxSeries: 3500000 }\n }\n\n^ Security\nallowedIPs = ['172.16.0.0/12', '100.64.0.0/10']\nblockedCountries = ['KP', 'NG', 'BY']\n\n ^^ Policies\n passwordMinLength = 18\n require2FA = true\n sessionTTLMinutes = 45\n\n ^^^ Lockout\n maxAttempts = 4\n lockoutMinutes = 60\n escalation = {\n enabled: true,\n notify: ['security@nebula.io', 'ciso@nebula.io'],\n rules: [\n { attempts: 3, action: 'captcha' },\n { attempts: 4, action: 'temporary-block', minutes: 120 },\n { attempts: 6, action: 'account-freeze' },\n { attempts: 9, action: 'permanent-block' }\n ]\n }\n";