@optique/core 1.1.0-dev.2006 → 1.1.0-dev.2054
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/constructs.cjs +20 -1
- package/dist/constructs.js +20 -1
- package/dist/dependency-runtime.cjs +34 -22
- package/dist/dependency-runtime.js +34 -22
- package/dist/facade.cjs +269 -157
- package/dist/facade.js +272 -160
- package/dist/primitives.cjs +5 -5
- package/dist/primitives.js +5 -5
- package/dist/valueparser.cjs +19 -64
- package/dist/valueparser.js +19 -64
- package/package.json +1 -1
package/dist/valueparser.cjs
CHANGED
|
@@ -2151,34 +2151,18 @@ function macAddress(options) {
|
|
|
2151
2151
|
if (sep === "none") return formatted.join("");
|
|
2152
2152
|
return formatted.join(sep);
|
|
2153
2153
|
}
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
}
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
const groups = value.split(".");
|
|
2166
|
-
if (groups.length !== 3 || !groups.every((g) => /^[0-9a-fA-F]{4}$/.test(g))) return value;
|
|
2167
|
-
octets = groups.flatMap((g) => [g.slice(0, 2), g.slice(2)]);
|
|
2168
|
-
detectedSep = ".";
|
|
2169
|
-
} else {
|
|
2170
|
-
if (value.length !== 12) return value;
|
|
2171
|
-
octets = [];
|
|
2172
|
-
for (let i = 0; i < value.length; i += 2) octets.push(value.slice(i, i + 2));
|
|
2173
|
-
detectedSep = "none";
|
|
2154
|
+
let macParsing = false;
|
|
2155
|
+
function normalizeMacValue(value, fallback) {
|
|
2156
|
+
if (macParsing) return value;
|
|
2157
|
+
macParsing = true;
|
|
2158
|
+
try {
|
|
2159
|
+
const result = parserObj.parse(value);
|
|
2160
|
+
return result.success ? result.value : fallback;
|
|
2161
|
+
} catch {
|
|
2162
|
+
return fallback;
|
|
2163
|
+
} finally {
|
|
2164
|
+
macParsing = false;
|
|
2174
2165
|
}
|
|
2175
|
-
if (octets.length !== 6 || !octets.every((o) => /^[0-9a-fA-F]{1,2}$/.test(o))) return value;
|
|
2176
|
-
octets = octets.map((o) => o.padStart(2, "0"));
|
|
2177
|
-
let sep;
|
|
2178
|
-
if (outputSeparator != null) sep = outputSeparator;
|
|
2179
|
-
else if (separator !== "any") sep = separator;
|
|
2180
|
-
else sep = detectedSep;
|
|
2181
|
-
return joinOctets(octets, sep);
|
|
2182
2166
|
}
|
|
2183
2167
|
const parserObj = {
|
|
2184
2168
|
mode: "sync",
|
|
@@ -2263,44 +2247,15 @@ function macAddress(options) {
|
|
|
2263
2247
|
value: joinOctets(octets, finalSeparator)
|
|
2264
2248
|
};
|
|
2265
2249
|
},
|
|
2266
|
-
format
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
let macParsing = false;
|
|
2270
|
-
Object.defineProperty(parserObj, "format", {
|
|
2271
|
-
value(v) {
|
|
2272
|
-
if (typeof v !== "string") return metavar;
|
|
2273
|
-
if (macParsing) return v;
|
|
2274
|
-
macParsing = true;
|
|
2275
|
-
try {
|
|
2276
|
-
const result = macParser.parse(v);
|
|
2277
|
-
return result.success ? result.value : v;
|
|
2278
|
-
} catch {
|
|
2279
|
-
return v;
|
|
2280
|
-
} finally {
|
|
2281
|
-
macParsing = false;
|
|
2282
|
-
}
|
|
2283
|
-
},
|
|
2284
|
-
configurable: true,
|
|
2285
|
-
enumerable: true
|
|
2286
|
-
});
|
|
2287
|
-
Object.defineProperty(parserObj, "normalize", {
|
|
2288
|
-
value(v) {
|
|
2289
|
-
if (typeof v !== "string") return v;
|
|
2290
|
-
if (macParsing) return v;
|
|
2291
|
-
macParsing = true;
|
|
2292
|
-
try {
|
|
2293
|
-
const result = macParser.parse(v);
|
|
2294
|
-
return result.success ? result.value : v;
|
|
2295
|
-
} catch {
|
|
2296
|
-
return v;
|
|
2297
|
-
} finally {
|
|
2298
|
-
macParsing = false;
|
|
2299
|
-
}
|
|
2250
|
+
format(value) {
|
|
2251
|
+
if (typeof value !== "string") return metavar;
|
|
2252
|
+
return normalizeMacValue(value, value);
|
|
2300
2253
|
},
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2254
|
+
normalize(value) {
|
|
2255
|
+
if (typeof value !== "string") return value;
|
|
2256
|
+
return normalizeMacValue(value, value);
|
|
2257
|
+
}
|
|
2258
|
+
};
|
|
2304
2259
|
return parserObj;
|
|
2305
2260
|
}
|
|
2306
2261
|
/**
|
package/dist/valueparser.js
CHANGED
|
@@ -2151,34 +2151,18 @@ function macAddress(options) {
|
|
|
2151
2151
|
if (sep === "none") return formatted.join("");
|
|
2152
2152
|
return formatted.join(sep);
|
|
2153
2153
|
}
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
}
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
const groups = value.split(".");
|
|
2166
|
-
if (groups.length !== 3 || !groups.every((g) => /^[0-9a-fA-F]{4}$/.test(g))) return value;
|
|
2167
|
-
octets = groups.flatMap((g) => [g.slice(0, 2), g.slice(2)]);
|
|
2168
|
-
detectedSep = ".";
|
|
2169
|
-
} else {
|
|
2170
|
-
if (value.length !== 12) return value;
|
|
2171
|
-
octets = [];
|
|
2172
|
-
for (let i = 0; i < value.length; i += 2) octets.push(value.slice(i, i + 2));
|
|
2173
|
-
detectedSep = "none";
|
|
2154
|
+
let macParsing = false;
|
|
2155
|
+
function normalizeMacValue(value, fallback) {
|
|
2156
|
+
if (macParsing) return value;
|
|
2157
|
+
macParsing = true;
|
|
2158
|
+
try {
|
|
2159
|
+
const result = parserObj.parse(value);
|
|
2160
|
+
return result.success ? result.value : fallback;
|
|
2161
|
+
} catch {
|
|
2162
|
+
return fallback;
|
|
2163
|
+
} finally {
|
|
2164
|
+
macParsing = false;
|
|
2174
2165
|
}
|
|
2175
|
-
if (octets.length !== 6 || !octets.every((o) => /^[0-9a-fA-F]{1,2}$/.test(o))) return value;
|
|
2176
|
-
octets = octets.map((o) => o.padStart(2, "0"));
|
|
2177
|
-
let sep;
|
|
2178
|
-
if (outputSeparator != null) sep = outputSeparator;
|
|
2179
|
-
else if (separator !== "any") sep = separator;
|
|
2180
|
-
else sep = detectedSep;
|
|
2181
|
-
return joinOctets(octets, sep);
|
|
2182
2166
|
}
|
|
2183
2167
|
const parserObj = {
|
|
2184
2168
|
mode: "sync",
|
|
@@ -2263,44 +2247,15 @@ function macAddress(options) {
|
|
|
2263
2247
|
value: joinOctets(octets, finalSeparator)
|
|
2264
2248
|
};
|
|
2265
2249
|
},
|
|
2266
|
-
format
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
let macParsing = false;
|
|
2270
|
-
Object.defineProperty(parserObj, "format", {
|
|
2271
|
-
value(v) {
|
|
2272
|
-
if (typeof v !== "string") return metavar;
|
|
2273
|
-
if (macParsing) return v;
|
|
2274
|
-
macParsing = true;
|
|
2275
|
-
try {
|
|
2276
|
-
const result = macParser.parse(v);
|
|
2277
|
-
return result.success ? result.value : v;
|
|
2278
|
-
} catch {
|
|
2279
|
-
return v;
|
|
2280
|
-
} finally {
|
|
2281
|
-
macParsing = false;
|
|
2282
|
-
}
|
|
2283
|
-
},
|
|
2284
|
-
configurable: true,
|
|
2285
|
-
enumerable: true
|
|
2286
|
-
});
|
|
2287
|
-
Object.defineProperty(parserObj, "normalize", {
|
|
2288
|
-
value(v) {
|
|
2289
|
-
if (typeof v !== "string") return v;
|
|
2290
|
-
if (macParsing) return v;
|
|
2291
|
-
macParsing = true;
|
|
2292
|
-
try {
|
|
2293
|
-
const result = macParser.parse(v);
|
|
2294
|
-
return result.success ? result.value : v;
|
|
2295
|
-
} catch {
|
|
2296
|
-
return v;
|
|
2297
|
-
} finally {
|
|
2298
|
-
macParsing = false;
|
|
2299
|
-
}
|
|
2250
|
+
format(value) {
|
|
2251
|
+
if (typeof value !== "string") return metavar;
|
|
2252
|
+
return normalizeMacValue(value, value);
|
|
2300
2253
|
},
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2254
|
+
normalize(value) {
|
|
2255
|
+
if (typeof value !== "string") return value;
|
|
2256
|
+
return normalizeMacValue(value, value);
|
|
2257
|
+
}
|
|
2258
|
+
};
|
|
2304
2259
|
return parserObj;
|
|
2305
2260
|
}
|
|
2306
2261
|
/**
|