@flaghoist/core 0.1.1 → 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/dist/index.cjs +5 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -61,7 +61,8 @@ var LIMITS = {
|
|
|
61
61
|
maxRules: 100,
|
|
62
62
|
maxConditionsPerRule: 50,
|
|
63
63
|
maxListItems: 1e3,
|
|
64
|
-
maxValueLength: 1024
|
|
64
|
+
maxValueLength: 1024,
|
|
65
|
+
maxDescriptionLength: 2048
|
|
65
66
|
};
|
|
66
67
|
var FLAG_KEY_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
67
68
|
var FORBIDDEN_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
@@ -249,6 +250,9 @@ function parseFlag(input) {
|
|
|
249
250
|
if (typeof o.enabled !== "boolean") return null;
|
|
250
251
|
const rollout = asRecord(o.rollout);
|
|
251
252
|
const percentage = rollout && typeof rollout.percentage === "number" ? clampPercentage(rollout.percentage) : 0;
|
|
253
|
+
if (typeof o.description === "string" && o.description.length > LIMITS.maxDescriptionLength) {
|
|
254
|
+
return null;
|
|
255
|
+
}
|
|
252
256
|
const rawRules = Array.isArray(o.rules) ? o.rules : [];
|
|
253
257
|
if (rawRules.length > LIMITS.maxRules) return null;
|
|
254
258
|
const rules = rawRules.map(parseRule).filter((r) => r !== null);
|
package/dist/index.d.cts
CHANGED
|
@@ -117,6 +117,7 @@ declare const LIMITS: {
|
|
|
117
117
|
readonly maxConditionsPerRule: 50;
|
|
118
118
|
readonly maxListItems: 1000;
|
|
119
119
|
readonly maxValueLength: 1024;
|
|
120
|
+
readonly maxDescriptionLength: 2048;
|
|
120
121
|
};
|
|
121
122
|
/**
|
|
122
123
|
* Attribute names that resolve onto the prototype chain rather than to real data. They are
|
package/dist/index.d.ts
CHANGED
|
@@ -117,6 +117,7 @@ declare const LIMITS: {
|
|
|
117
117
|
readonly maxConditionsPerRule: 50;
|
|
118
118
|
readonly maxListItems: 1000;
|
|
119
119
|
readonly maxValueLength: 1024;
|
|
120
|
+
readonly maxDescriptionLength: 2048;
|
|
120
121
|
};
|
|
121
122
|
/**
|
|
122
123
|
* Attribute names that resolve onto the prototype chain rather than to real data. They are
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,8 @@ var LIMITS = {
|
|
|
22
22
|
maxRules: 100,
|
|
23
23
|
maxConditionsPerRule: 50,
|
|
24
24
|
maxListItems: 1e3,
|
|
25
|
-
maxValueLength: 1024
|
|
25
|
+
maxValueLength: 1024,
|
|
26
|
+
maxDescriptionLength: 2048
|
|
26
27
|
};
|
|
27
28
|
var FLAG_KEY_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
28
29
|
var FORBIDDEN_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
@@ -210,6 +211,9 @@ function parseFlag(input) {
|
|
|
210
211
|
if (typeof o.enabled !== "boolean") return null;
|
|
211
212
|
const rollout = asRecord(o.rollout);
|
|
212
213
|
const percentage = rollout && typeof rollout.percentage === "number" ? clampPercentage(rollout.percentage) : 0;
|
|
214
|
+
if (typeof o.description === "string" && o.description.length > LIMITS.maxDescriptionLength) {
|
|
215
|
+
return null;
|
|
216
|
+
}
|
|
213
217
|
const rawRules = Array.isArray(o.rules) ? o.rules : [];
|
|
214
218
|
if (rawRules.length > LIMITS.maxRules) return null;
|
|
215
219
|
const rules = rawRules.map(parseRule).filter((r) => r !== null);
|