@nextera.one/axis-server-sdk 2.3.24 → 2.3.26
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-DiWSbPZ8.d.mts → index-CZbbGuUq.d.mts} +8 -0
- package/dist/{index-BRV_ohRW.d.ts → index-gFSt2xrf.d.ts} +8 -0
- package/dist/index.d.mts +36 -3
- package/dist/index.d.ts +36 -3
- package/dist/index.js +105 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +105 -4
- package/dist/index.mjs.map +1 -1
- package/dist/sensors/index.d.mts +1 -1
- package/dist/sensors/index.d.ts +1 -1
- package/dist/sensors/index.js +104 -4
- package/dist/sensors/index.js.map +1 -1
- package/dist/sensors/index.mjs +104 -4
- package/dist/sensors/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -441,7 +441,11 @@ function Intent(action, options) {
|
|
|
441
441
|
bodyProfile: options?.bodyProfile,
|
|
442
442
|
tlv: options?.tlv,
|
|
443
443
|
dto: options?.dto,
|
|
444
|
-
is: options?.is
|
|
444
|
+
is: options?.is,
|
|
445
|
+
maxUseCount: options?.maxUseCount,
|
|
446
|
+
useCount: options?.useCount,
|
|
447
|
+
duration: options?.duration,
|
|
448
|
+
maxDuration: options?.maxDuration
|
|
445
449
|
});
|
|
446
450
|
Reflect.defineMetadata(INTENT_ROUTES_KEY, routes, target.constructor);
|
|
447
451
|
};
|
|
@@ -9432,9 +9436,10 @@ var init_timeline_store = __esm({
|
|
|
9432
9436
|
// src/utils/axis-tlv-codec.ts
|
|
9433
9437
|
function encodeAxisTlvDto(dtoClass, data, context = {}) {
|
|
9434
9438
|
const schema = (0, import_dto_schema2.extractDtoSchema)(dtoClass);
|
|
9439
|
+
const effectiveContext = withDtoName(dtoClass, context);
|
|
9435
9440
|
const items = schema.fields.flatMap((field) => {
|
|
9436
9441
|
const value = data[field.name];
|
|
9437
|
-
if (!shouldEncodeField(field, value, data,
|
|
9442
|
+
if (!shouldEncodeField(field, value, data, effectiveContext)) return [];
|
|
9438
9443
|
if (value === void 0 || value === null) {
|
|
9439
9444
|
if (field.required) {
|
|
9440
9445
|
throw new Error(`Missing required TLV response field: ${field.name}`);
|
|
@@ -9447,17 +9452,18 @@ function encodeAxisTlvDto(dtoClass, data, context = {}) {
|
|
|
9447
9452
|
}
|
|
9448
9453
|
function projectAxisTlvDto(dtoClass, data, context = {}) {
|
|
9449
9454
|
const schema = (0, import_dto_schema2.extractDtoSchema)(dtoClass);
|
|
9455
|
+
const effectiveContext = withDtoName(dtoClass, context);
|
|
9450
9456
|
const result = {};
|
|
9451
9457
|
for (const field of schema.fields) {
|
|
9452
9458
|
const value = data[field.name];
|
|
9453
|
-
if (!shouldEncodeField(field, value, data,
|
|
9459
|
+
if (!shouldEncodeField(field, value, data, effectiveContext)) continue;
|
|
9454
9460
|
if (value === void 0 || value === null) continue;
|
|
9455
9461
|
result[field.name] = value;
|
|
9456
9462
|
}
|
|
9457
9463
|
return result;
|
|
9458
9464
|
}
|
|
9459
9465
|
function shouldEncodeField(field, value, data, context) {
|
|
9460
|
-
const rule = field
|
|
9466
|
+
const rule = resolveEncodeRule(field, value, data, context);
|
|
9461
9467
|
if (rule === void 0) return true;
|
|
9462
9468
|
if (rule === false) return false;
|
|
9463
9469
|
if (rule.onlyRoles?.length && !hasAnyRole(context, rule.onlyRoles)) {
|
|
@@ -9477,6 +9483,22 @@ function shouldEncodeField(field, value, data, context) {
|
|
|
9477
9483
|
}
|
|
9478
9484
|
return true;
|
|
9479
9485
|
}
|
|
9486
|
+
function withDtoName(dtoClass, context) {
|
|
9487
|
+
return {
|
|
9488
|
+
...context,
|
|
9489
|
+
dtoName: context.dtoName ?? dtoClass.name
|
|
9490
|
+
};
|
|
9491
|
+
}
|
|
9492
|
+
function resolveEncodeRule(field, value, data, context) {
|
|
9493
|
+
return context.visibilityRegistry?.resolve({
|
|
9494
|
+
intent: context.intent,
|
|
9495
|
+
dtoName: context.dtoName,
|
|
9496
|
+
field,
|
|
9497
|
+
value,
|
|
9498
|
+
data,
|
|
9499
|
+
context
|
|
9500
|
+
}) ?? field.encode;
|
|
9501
|
+
}
|
|
9480
9502
|
function hasAnyRole(context, expectedRoles) {
|
|
9481
9503
|
const actualRoles = context.roles ?? [];
|
|
9482
9504
|
return expectedRoles.some((role) => actualRoles.includes(role));
|
|
@@ -9524,6 +9546,82 @@ var init_axis_tlv_codec = __esm({
|
|
|
9524
9546
|
}
|
|
9525
9547
|
});
|
|
9526
9548
|
|
|
9549
|
+
// src/utils/axis-tlv-visibility-registry.ts
|
|
9550
|
+
function overrideKey(override) {
|
|
9551
|
+
return [
|
|
9552
|
+
normalizeKey(override.intent),
|
|
9553
|
+
normalizeKey(override.dtoName),
|
|
9554
|
+
normalizeKey(override.field),
|
|
9555
|
+
override.tag ?? ""
|
|
9556
|
+
].join("|");
|
|
9557
|
+
}
|
|
9558
|
+
function normalizeKey(value) {
|
|
9559
|
+
return typeof value === "string" ? value.trim() : "";
|
|
9560
|
+
}
|
|
9561
|
+
function matchScore(override, input) {
|
|
9562
|
+
if (override.enabled === false) return -1;
|
|
9563
|
+
const intent = normalizeKey(input.intent);
|
|
9564
|
+
const dtoName = normalizeKey(input.dtoName);
|
|
9565
|
+
const overrideIntent = normalizeKey(override.intent);
|
|
9566
|
+
const overrideDtoName = normalizeKey(override.dtoName);
|
|
9567
|
+
const overrideField = normalizeKey(override.field);
|
|
9568
|
+
const fieldName = normalizeKey(input.field.name);
|
|
9569
|
+
if (overrideIntent && overrideIntent !== intent) return -1;
|
|
9570
|
+
if (overrideDtoName && overrideDtoName !== dtoName) return -1;
|
|
9571
|
+
const fieldMatches = Boolean(overrideField && overrideField === fieldName);
|
|
9572
|
+
const tagMatches = typeof override.tag === "number" && override.tag === input.field.tag;
|
|
9573
|
+
if (!fieldMatches && !tagMatches) return -1;
|
|
9574
|
+
return (overrideIntent ? 100 : 0) + (overrideDtoName ? 50 : 0) + (fieldMatches ? 10 : 0) + (tagMatches ? 8 : 0);
|
|
9575
|
+
}
|
|
9576
|
+
var AxisTlvVisibilityRegistry;
|
|
9577
|
+
var init_axis_tlv_visibility_registry = __esm({
|
|
9578
|
+
"src/utils/axis-tlv-visibility-registry.ts"() {
|
|
9579
|
+
AxisTlvVisibilityRegistry = class {
|
|
9580
|
+
constructor(overrides = []) {
|
|
9581
|
+
this.overrides = [];
|
|
9582
|
+
this.setOverrides(overrides);
|
|
9583
|
+
}
|
|
9584
|
+
setOverrides(overrides) {
|
|
9585
|
+
this.overrides = overrides.map((override) => ({ ...override }));
|
|
9586
|
+
}
|
|
9587
|
+
listOverrides() {
|
|
9588
|
+
return this.overrides.map((override) => ({ ...override }));
|
|
9589
|
+
}
|
|
9590
|
+
upsert(override) {
|
|
9591
|
+
const key = overrideKey(override);
|
|
9592
|
+
const index = this.overrides.findIndex((item) => overrideKey(item) === key);
|
|
9593
|
+
if (index >= 0) {
|
|
9594
|
+
this.overrides[index] = { ...override };
|
|
9595
|
+
return;
|
|
9596
|
+
}
|
|
9597
|
+
this.overrides.push({ ...override });
|
|
9598
|
+
}
|
|
9599
|
+
remove(match) {
|
|
9600
|
+
const before = this.overrides.length;
|
|
9601
|
+
this.overrides = this.overrides.filter(
|
|
9602
|
+
(item) => overrideKey(item) !== overrideKey(match)
|
|
9603
|
+
);
|
|
9604
|
+
return before - this.overrides.length;
|
|
9605
|
+
}
|
|
9606
|
+
resolve(input) {
|
|
9607
|
+
let bestScore = -1;
|
|
9608
|
+
let bestIndex = -1;
|
|
9609
|
+
let best;
|
|
9610
|
+
this.overrides.forEach((override, index) => {
|
|
9611
|
+
const score = matchScore(override, input);
|
|
9612
|
+
if (score < 0) return;
|
|
9613
|
+
if (score > bestScore || score === bestScore && index > bestIndex) {
|
|
9614
|
+
bestScore = score;
|
|
9615
|
+
bestIndex = index;
|
|
9616
|
+
best = override;
|
|
9617
|
+
}
|
|
9618
|
+
});
|
|
9619
|
+
return best?.encode;
|
|
9620
|
+
}
|
|
9621
|
+
};
|
|
9622
|
+
}
|
|
9623
|
+
});
|
|
9624
|
+
|
|
9527
9625
|
// src/loom/loom.types.ts
|
|
9528
9626
|
function deriveAnchorReflection(softid, context = "openlogs", scope = "loom") {
|
|
9529
9627
|
return `ar:${context}:${scope}:${softid}`;
|
|
@@ -13259,6 +13357,7 @@ __export(index_exports, {
|
|
|
13259
13357
|
AxisSensorChainService: () => AxisSensorChainService,
|
|
13260
13358
|
AxisStream: () => AxisStream,
|
|
13261
13359
|
AxisTlvDto: () => AxisTlvDto,
|
|
13360
|
+
AxisTlvVisibilityRegistry: () => AxisTlvVisibilityRegistry,
|
|
13262
13361
|
BAND: () => BAND,
|
|
13263
13362
|
BodyProfile: () => BodyProfile2,
|
|
13264
13363
|
BodyProfileValidator: () => BodyProfileValidator,
|
|
@@ -13604,6 +13703,7 @@ var init_index = __esm({
|
|
|
13604
13703
|
init_cce_pipeline();
|
|
13605
13704
|
init_cce_types();
|
|
13606
13705
|
init_axis_tlv_codec();
|
|
13706
|
+
init_axis_tlv_visibility_registry();
|
|
13607
13707
|
init_loom_types();
|
|
13608
13708
|
init_loom_engine();
|
|
13609
13709
|
init_idel_compiler();
|
|
@@ -13666,6 +13766,7 @@ export {
|
|
|
13666
13766
|
AxisSensorChainService,
|
|
13667
13767
|
AxisStream,
|
|
13668
13768
|
AxisTlvDto,
|
|
13769
|
+
AxisTlvVisibilityRegistry,
|
|
13669
13770
|
BAND,
|
|
13670
13771
|
BodyProfile2 as BodyProfile,
|
|
13671
13772
|
BodyProfileValidator,
|