@featurevisor/core 2.9.0 → 2.10.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.
- package/CHANGELOG.md +11 -0
- package/coverage/clover.xml +2 -2
- package/coverage/lcov-report/builder/allocator.ts.html +1 -1
- package/coverage/lcov-report/builder/buildScopedConditions.ts.html +1 -1
- package/coverage/lcov-report/builder/buildScopedDatafile.ts.html +1 -1
- package/coverage/lcov-report/builder/buildScopedSegments.ts.html +1 -1
- package/coverage/lcov-report/builder/index.html +1 -1
- package/coverage/lcov-report/builder/revision.ts.html +1 -1
- package/coverage/lcov-report/builder/traffic.ts.html +1 -1
- package/coverage/lcov-report/index.html +1 -1
- package/coverage/lcov-report/list/index.html +1 -1
- package/coverage/lcov-report/list/matrix.ts.html +1 -1
- package/coverage/lcov-report/parsers/index.html +1 -1
- package/coverage/lcov-report/parsers/json.ts.html +1 -1
- package/coverage/lcov-report/parsers/yml.ts.html +1 -1
- package/coverage/lcov-report/tester/helpers.ts.html +1 -1
- package/coverage/lcov-report/tester/index.html +1 -1
- package/lib/generate-code/typescript.js +150 -16
- package/lib/generate-code/typescript.js.map +1 -1
- package/lib/linter/featureSchema.d.ts +114 -100
- package/lib/linter/featureSchema.js +222 -80
- package/lib/linter/featureSchema.js.map +1 -1
- package/lib/linter/propertySchema.d.ts +5 -0
- package/lib/linter/propertySchema.js +43 -0
- package/lib/linter/propertySchema.js.map +1 -0
- package/package.json +5 -5
- package/src/generate-code/typescript.ts +168 -18
- package/src/linter/featureSchema.ts +282 -95
- package/src/linter/propertySchema.ts +47 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.10.0](https://github.com/featurevisor/featurevisor/compare/v2.9.0...v2.10.0) (2026-02-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* typed arrays and objects as variables ([#388](https://github.com/featurevisor/featurevisor/issues/388)) ([5909f42](https://github.com/featurevisor/featurevisor/commit/5909f42b93c55a71d3f43fd7a2a58287ac82af7f))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [2.9.0](https://github.com/featurevisor/featurevisor/compare/v2.8.0...v2.9.0) (2026-02-08)
|
|
7
18
|
|
|
8
19
|
|
package/coverage/clover.xml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<coverage generated="
|
|
3
|
-
<project timestamp="
|
|
2
|
+
<coverage generated="1771194435037" clover="3.2.0">
|
|
3
|
+
<project timestamp="1771194435037" name="All files">
|
|
4
4
|
<metrics statements="497" coveredstatements="416" conditionals="232" coveredconditionals="179" methods="70" coveredmethods="62" elements="799" coveredelements="657" complexity="0" loc="497" ncloc="497" packages="4" files="10" classes="10"/>
|
|
5
5
|
<package name="builder">
|
|
6
6
|
<metrics statements="276" coveredstatements="268" conditionals="104" coveredconditionals="95" methods="46" coveredmethods="46"/>
|
|
@@ -205,7 +205,7 @@ export function getUpdatedAvailableRangesAfterFilling(
|
|
|
205
205
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
206
206
|
Code coverage generated by
|
|
207
207
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
208
|
-
at 2026-02-
|
|
208
|
+
at 2026-02-15T22:27:15.008Z
|
|
209
209
|
</div>
|
|
210
210
|
<script src="../prettify.js"></script>
|
|
211
211
|
<script>
|
|
@@ -472,7 +472,7 @@ export function buildScopedCondition(
|
|
|
472
472
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
473
473
|
Code coverage generated by
|
|
474
474
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
475
|
-
at 2026-02-
|
|
475
|
+
at 2026-02-15T22:27:15.008Z
|
|
476
476
|
</div>
|
|
477
477
|
<script src="../prettify.js"></script>
|
|
478
478
|
<script>
|
|
@@ -589,7 +589,7 @@ export function buildScopedDatafile(
|
|
|
589
589
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
590
590
|
Code coverage generated by
|
|
591
591
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
592
|
-
at 2026-02-
|
|
592
|
+
at 2026-02-15T22:27:15.008Z
|
|
593
593
|
</div>
|
|
594
594
|
<script src="../prettify.js"></script>
|
|
595
595
|
<script>
|
|
@@ -529,7 +529,7 @@ export function buildScopedGroupSegments(
|
|
|
529
529
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
530
530
|
Code coverage generated by
|
|
531
531
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
532
|
-
at 2026-02-
|
|
532
|
+
at 2026-02-15T22:27:15.008Z
|
|
533
533
|
</div>
|
|
534
534
|
<script src="../prettify.js"></script>
|
|
535
535
|
<script>
|
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
177
177
|
Code coverage generated by
|
|
178
178
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
179
|
-
at 2026-02-
|
|
179
|
+
at 2026-02-15T22:27:15.008Z
|
|
180
180
|
</div>
|
|
181
181
|
<script src="../prettify.js"></script>
|
|
182
182
|
<script>
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
137
137
|
Code coverage generated by
|
|
138
138
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
139
|
-
at 2026-02-
|
|
139
|
+
at 2026-02-15T22:27:15.008Z
|
|
140
140
|
</div>
|
|
141
141
|
<script src="../prettify.js"></script>
|
|
142
142
|
<script>
|
|
@@ -643,7 +643,7 @@ export function getTraffic(
|
|
|
643
643
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
644
644
|
Code coverage generated by
|
|
645
645
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
646
|
-
at 2026-02-
|
|
646
|
+
at 2026-02-15T22:27:15.008Z
|
|
647
647
|
</div>
|
|
648
648
|
<script src="../prettify.js"></script>
|
|
649
649
|
<script>
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
147
147
|
Code coverage generated by
|
|
148
148
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
149
|
-
at 2026-02-
|
|
149
|
+
at 2026-02-15T22:27:15.008Z
|
|
150
150
|
</div>
|
|
151
151
|
<script src="prettify.js"></script>
|
|
152
152
|
<script>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at 2026-02-
|
|
104
|
+
at 2026-02-15T22:27:15.008Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -721,7 +721,7 @@ export function <span class="fstat-no" title="function not covered" >getSegmentA
|
|
|
721
721
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
722
722
|
Code coverage generated by
|
|
723
723
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
724
|
-
at 2026-02-
|
|
724
|
+
at 2026-02-15T22:27:15.008Z
|
|
725
725
|
</div>
|
|
726
726
|
<script src="../prettify.js"></script>
|
|
727
727
|
<script>
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
117
117
|
Code coverage generated by
|
|
118
118
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
119
|
-
at 2026-02-
|
|
119
|
+
at 2026-02-15T22:27:15.008Z
|
|
120
120
|
</div>
|
|
121
121
|
<script src="../prettify.js"></script>
|
|
122
122
|
<script>
|
|
@@ -103,7 +103,7 @@ export const jsonParser: CustomParser = {
|
|
|
103
103
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
104
104
|
Code coverage generated by
|
|
105
105
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
106
|
-
at 2026-02-
|
|
106
|
+
at 2026-02-15T22:27:15.008Z
|
|
107
107
|
</div>
|
|
108
108
|
<script src="../prettify.js"></script>
|
|
109
109
|
<script>
|
|
@@ -574,7 +574,7 @@ export const ymlParser: CustomParser = {
|
|
|
574
574
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
575
575
|
Code coverage generated by
|
|
576
576
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
577
|
-
at 2026-02-
|
|
577
|
+
at 2026-02-15T22:27:15.008Z
|
|
578
578
|
</div>
|
|
579
579
|
<script src="../prettify.js"></script>
|
|
580
580
|
<script>
|
|
@@ -298,7 +298,7 @@ export function checkIfArraysAreEqual(arr1: any[], arr2: any[]): boolean {
|
|
|
298
298
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
299
299
|
Code coverage generated by
|
|
300
300
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
301
|
-
at 2026-02-
|
|
301
|
+
at 2026-02-15T22:27:15.008Z
|
|
302
302
|
</div>
|
|
303
303
|
<script src="../prettify.js"></script>
|
|
304
304
|
<script>
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
102
102
|
Code coverage generated by
|
|
103
103
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
104
|
-
at 2026-02-
|
|
104
|
+
at 2026-02-15T22:27:15.008Z
|
|
105
105
|
</div>
|
|
106
106
|
<script src="../prettify.js"></script>
|
|
107
107
|
<script>
|
|
@@ -18,13 +18,129 @@ function convertFeaturevisorTypeToTypeScriptType(featurevisorType) {
|
|
|
18
18
|
case "array":
|
|
19
19
|
return "string[]";
|
|
20
20
|
case "object":
|
|
21
|
-
return "
|
|
21
|
+
return "Record<string, unknown>";
|
|
22
22
|
case "json":
|
|
23
|
-
return "
|
|
23
|
+
return "unknown";
|
|
24
24
|
default:
|
|
25
25
|
throw new Error(`Unknown type: ${featurevisorType}`);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* Converts a PropertySchema (items or properties entry) to a TypeScript type string.
|
|
30
|
+
* Handles nested object/array with structured items and properties.
|
|
31
|
+
*/
|
|
32
|
+
function propertySchemaToTypeScriptType(schema) {
|
|
33
|
+
const type = schema.type;
|
|
34
|
+
if (!type) {
|
|
35
|
+
return "unknown";
|
|
36
|
+
}
|
|
37
|
+
switch (type) {
|
|
38
|
+
case "boolean":
|
|
39
|
+
return "boolean";
|
|
40
|
+
case "string":
|
|
41
|
+
return "string";
|
|
42
|
+
case "integer":
|
|
43
|
+
case "double":
|
|
44
|
+
return "number";
|
|
45
|
+
case "array":
|
|
46
|
+
if (schema.items) {
|
|
47
|
+
return `(${propertySchemaToTypeScriptType(schema.items)})[]`;
|
|
48
|
+
}
|
|
49
|
+
return "string[]";
|
|
50
|
+
case "object": {
|
|
51
|
+
const props = schema.properties;
|
|
52
|
+
if (props && typeof props === "object" && Object.keys(props).length > 0) {
|
|
53
|
+
const requiredSet = new Set(schema.required || []);
|
|
54
|
+
const entries = Object.entries(props)
|
|
55
|
+
.map(([k, v]) => {
|
|
56
|
+
const propType = propertySchemaToTypeScriptType(v);
|
|
57
|
+
const optional = requiredSet.size > 0 && !requiredSet.has(k);
|
|
58
|
+
return optional ? `${k}?: ${propType}` : `${k}: ${propType}`;
|
|
59
|
+
})
|
|
60
|
+
.join("; ");
|
|
61
|
+
return `{ ${entries} }`;
|
|
62
|
+
}
|
|
63
|
+
return "Record<string, unknown>";
|
|
64
|
+
}
|
|
65
|
+
default:
|
|
66
|
+
return "unknown";
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Generates TypeScript type/interface declarations and metadata for a variable.
|
|
71
|
+
* Returns declarations to emit (interface or type alias) plus the type name and generic to use in the getter.
|
|
72
|
+
*/
|
|
73
|
+
function generateVariableTypeDeclarations(variableKey, variableSchema) {
|
|
74
|
+
const typeName = getPascalCase(variableKey) + "Variable";
|
|
75
|
+
const itemTypeName = getPascalCase(variableKey) + "VariableItem";
|
|
76
|
+
const type = variableSchema.type;
|
|
77
|
+
const declarations = [];
|
|
78
|
+
if (type === "json") {
|
|
79
|
+
return { declarations: [], returnTypeName: "T", genericArg: "T" };
|
|
80
|
+
}
|
|
81
|
+
if (type === "object") {
|
|
82
|
+
const props = variableSchema.properties;
|
|
83
|
+
if (props && typeof props === "object" && Object.keys(props).length > 0) {
|
|
84
|
+
const requiredSet = new Set(variableSchema.required || []);
|
|
85
|
+
const entries = Object.entries(props)
|
|
86
|
+
.map(([k, v]) => {
|
|
87
|
+
const propType = propertySchemaToTypeScriptType(v);
|
|
88
|
+
const optional = requiredSet.size > 0 && !requiredSet.has(k);
|
|
89
|
+
return optional
|
|
90
|
+
? `${INDENT_NS_BODY}${k}?: ${propType};`
|
|
91
|
+
: `${INDENT_NS_BODY}${k}: ${propType};`;
|
|
92
|
+
})
|
|
93
|
+
.join("\n");
|
|
94
|
+
declarations.push(`${INDENT_NS}export interface ${typeName} {\n${entries}\n${INDENT_NS}}`);
|
|
95
|
+
return { declarations, returnTypeName: typeName, genericArg: typeName };
|
|
96
|
+
}
|
|
97
|
+
declarations.push(`${INDENT_NS}export type ${typeName} = Record<string, unknown>;`);
|
|
98
|
+
return { declarations, returnTypeName: typeName, genericArg: typeName };
|
|
99
|
+
}
|
|
100
|
+
if (type === "array") {
|
|
101
|
+
if (variableSchema.items) {
|
|
102
|
+
const items = variableSchema.items;
|
|
103
|
+
if (items.type === "object" && items.properties && Object.keys(items.properties).length > 0) {
|
|
104
|
+
const requiredSet = new Set(items.required || []);
|
|
105
|
+
const entries = Object.entries(items.properties)
|
|
106
|
+
.map(([k, v]) => {
|
|
107
|
+
const propType = propertySchemaToTypeScriptType(v);
|
|
108
|
+
const optional = requiredSet.size > 0 && !requiredSet.has(k);
|
|
109
|
+
return optional
|
|
110
|
+
? `${INDENT_NS_BODY}${k}?: ${propType};`
|
|
111
|
+
: `${INDENT_NS_BODY}${k}: ${propType};`;
|
|
112
|
+
})
|
|
113
|
+
.join("\n");
|
|
114
|
+
declarations.push(`${INDENT_NS}export interface ${itemTypeName} {\n${entries}\n${INDENT_NS}}`);
|
|
115
|
+
// getVariableArray<T> returns T[] | null, so generic is item type
|
|
116
|
+
return {
|
|
117
|
+
declarations,
|
|
118
|
+
returnTypeName: `${itemTypeName}[]`,
|
|
119
|
+
genericArg: itemTypeName,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
// array of primitive (e.g. string): emit item type only, use item[] in methods
|
|
123
|
+
const itemType = propertySchemaToTypeScriptType(items);
|
|
124
|
+
declarations.push(`${INDENT_NS}export type ${itemTypeName} = ${itemType};`);
|
|
125
|
+
return {
|
|
126
|
+
declarations,
|
|
127
|
+
returnTypeName: `${itemTypeName}[]`,
|
|
128
|
+
genericArg: itemTypeName,
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
// array without items (default string[]): emit item type only
|
|
132
|
+
declarations.push(`${INDENT_NS}export type ${itemTypeName} = string;`);
|
|
133
|
+
return {
|
|
134
|
+
declarations,
|
|
135
|
+
returnTypeName: `${itemTypeName}[]`,
|
|
136
|
+
genericArg: itemTypeName,
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
// primitive: boolean, string, integer, double
|
|
140
|
+
const primitiveType = convertFeaturevisorTypeToTypeScriptType(type);
|
|
141
|
+
declarations.push(`${INDENT_NS}export type ${typeName} = ${primitiveType};`);
|
|
142
|
+
return { declarations, returnTypeName: typeName, genericArg: typeName };
|
|
143
|
+
}
|
|
28
144
|
function getPascalCase(str) {
|
|
29
145
|
// Remove special characters and split the string into an array of words
|
|
30
146
|
const words = str.replace(/[^a-zA-Z0-9]/g, " ").split(" ");
|
|
@@ -39,6 +155,9 @@ function getRelativePath(from, to) {
|
|
|
39
155
|
}
|
|
40
156
|
return relativePath;
|
|
41
157
|
}
|
|
158
|
+
// Indentation for generated namespace content (2 spaces per level)
|
|
159
|
+
const INDENT_NS = " ";
|
|
160
|
+
const INDENT_NS_BODY = " ";
|
|
42
161
|
const instanceSnippet = `
|
|
43
162
|
import { FeaturevisorInstance } from "@featurevisor/sdk";
|
|
44
163
|
|
|
@@ -101,43 +220,58 @@ ${attributeProperties}
|
|
|
101
220
|
}
|
|
102
221
|
const namespaceValue = getPascalCase(featureKey) + "Feature";
|
|
103
222
|
featureNamespaces.push(namespaceValue);
|
|
223
|
+
let variableTypeDeclarations = "";
|
|
104
224
|
let variableMethods = "";
|
|
105
225
|
if (parsedFeature.variablesSchema) {
|
|
106
226
|
const variableKeys = Object.keys(parsedFeature.variablesSchema);
|
|
227
|
+
const allDeclarations = [];
|
|
107
228
|
for (const variableKey of variableKeys) {
|
|
108
229
|
const variableSchema = parsedFeature.variablesSchema[variableKey];
|
|
109
230
|
const variableType = variableSchema.type;
|
|
231
|
+
const { declarations, returnTypeName, genericArg } = generateVariableTypeDeclarations(variableKey, variableSchema);
|
|
232
|
+
allDeclarations.push(...declarations);
|
|
110
233
|
const internalMethodName = `getVariable${variableType === "json" ? "JSON" : getPascalCase(variableType)}`;
|
|
111
|
-
|
|
234
|
+
const hasGeneric = variableType === "json" || variableType === "array" || variableType === "object";
|
|
235
|
+
if (variableType === "json") {
|
|
236
|
+
variableMethods += `
|
|
237
|
+
|
|
238
|
+
${INDENT_NS}export function get${getPascalCase(variableKey)}<T = unknown>(context: Context = {}): T | null {
|
|
239
|
+
${INDENT_NS_BODY}return getInstance().${internalMethodName}<T>(key, "${variableKey}", context);
|
|
240
|
+
${INDENT_NS}}`;
|
|
241
|
+
}
|
|
242
|
+
else if (hasGeneric) {
|
|
112
243
|
variableMethods += `
|
|
113
244
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
245
|
+
${INDENT_NS}export function get${getPascalCase(variableKey)}(context: Context = {}): ${returnTypeName} | null {
|
|
246
|
+
${INDENT_NS_BODY}return getInstance().${internalMethodName}<${genericArg}>(key, "${variableKey}", context);
|
|
247
|
+
${INDENT_NS}}`;
|
|
117
248
|
}
|
|
118
249
|
else {
|
|
119
250
|
variableMethods += `
|
|
120
251
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
252
|
+
${INDENT_NS}export function get${getPascalCase(variableKey)}(context: Context = {}): ${returnTypeName} | null {
|
|
253
|
+
${INDENT_NS_BODY}return getInstance().${internalMethodName}(key, "${variableKey}", context);
|
|
254
|
+
${INDENT_NS}}`;
|
|
124
255
|
}
|
|
125
256
|
}
|
|
257
|
+
if (allDeclarations.length > 0) {
|
|
258
|
+
variableTypeDeclarations = "\n\n" + allDeclarations.join("\n\n");
|
|
259
|
+
}
|
|
126
260
|
}
|
|
127
261
|
const featureContent = `
|
|
128
262
|
import { Context } from "./Context";
|
|
129
263
|
import { getInstance } from "./instance";
|
|
130
264
|
|
|
131
265
|
export namespace ${namespaceValue} {
|
|
132
|
-
|
|
266
|
+
${INDENT_NS}export const key = "${featureKey}";${variableTypeDeclarations}
|
|
133
267
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
268
|
+
${INDENT_NS}export function isEnabled(context: Context = {}) {
|
|
269
|
+
${INDENT_NS_BODY}return getInstance().isEnabled(key, context);
|
|
270
|
+
${INDENT_NS}}
|
|
137
271
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
272
|
+
${INDENT_NS}export function getVariation(context: Context = {}) {
|
|
273
|
+
${INDENT_NS_BODY}return getInstance().getVariation(key, context);
|
|
274
|
+
${INDENT_NS}}${variableMethods}
|
|
141
275
|
}
|
|
142
276
|
`.trimStart();
|
|
143
277
|
const featureNamespaceFilePath = path.join(outputPath, `${namespaceValue}.ts`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../src/generate-code/typescript.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"typescript.js","sourceRoot":"","sources":["../../src/generate-code/typescript.ts"],"names":[],"mappings":";;AAkMA,4EAuJC;AAzVD,yBAAyB;AACzB,6BAA6B;AAK7B,SAAS,uCAAuC,CAAC,gBAAwB;IACvE,QAAQ,gBAAgB,EAAE,CAAC;QACzB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC;QAClB,KAAK,SAAS;YACZ,OAAO,QAAQ,CAAC;QAClB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC;QAClB,KAAK,MAAM;YACT,OAAO,eAAe,CAAC;QACzB,KAAK,OAAO;YACV,OAAO,UAAU,CAAC;QACpB,KAAK,QAAQ;YACX,OAAO,yBAAyB,CAAC;QACnC,KAAK,MAAM;YACT,OAAO,SAAS,CAAC;QACnB;YACE,MAAM,IAAI,KAAK,CAAC,iBAAiB,gBAAgB,EAAE,CAAC,CAAC;IACzD,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,8BAA8B,CAAC,MAAsB;IAC5D,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IACzB,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;QACnB,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC;QAClB,KAAK,SAAS,CAAC;QACf,KAAK,QAAQ;Y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