@awarevue/api-types 1.0.72 → 1.0.74

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.
@@ -104,12 +104,12 @@ const encodeComparison = (value) => {
104
104
  throw new Error(`Unsupported value type for comparison: ${typeof value}`);
105
105
  };
106
106
  const createAlarmRuleBody = (eventKind, behavior, deviceType, eventCriteria, deviceId) => {
107
- let runIf = 'device.type == "' + deviceType + '"';
107
+ let runIf = 'source.type == "' + deviceType + '"';
108
108
  if (deviceId) {
109
- runIf += ` && device.id == "${deviceId}"`;
109
+ runIf += ` and source.id == "${deviceId}"`;
110
110
  }
111
111
  for (const criterion of eventCriteria) {
112
- runIf += ` && event.${criterion.field} ${encodeComparison(criterion.value)}`;
112
+ runIf += ` and event.${criterion.field} ${encodeComparison(criterion.value)}`;
113
113
  }
114
114
  return {
115
115
  onEvent: eventKind,
@@ -375,8 +375,133 @@ export declare const sAutomationRuleDto: z.ZodObject<{
375
375
  score: number | null;
376
376
  description?: string | undefined;
377
377
  }>;
378
+ export declare const sAutomationBulkMergeRequest: z.ZodObject<{
379
+ merge: z.ZodArray<z.ZodObject<{
380
+ displayName: z.ZodString;
381
+ description: z.ZodOptional<z.ZodString>;
382
+ code: z.ZodNullable<z.ZodString>;
383
+ body: z.ZodObject<{
384
+ onEvent: z.ZodString;
385
+ runIf: z.ZodOptional<z.ZodString>;
386
+ commands: z.ZodArray<z.ZodObject<{
387
+ command: z.ZodString;
388
+ target: z.ZodString;
389
+ params: z.ZodRecord<z.ZodString, z.ZodUnknown>;
390
+ }, "strip", z.ZodTypeAny, {
391
+ target: string;
392
+ params: Record<string, unknown>;
393
+ command: string;
394
+ }, {
395
+ target: string;
396
+ params: Record<string, unknown>;
397
+ command: string;
398
+ }>, "many">;
399
+ }, "strip", z.ZodTypeAny, {
400
+ onEvent: string;
401
+ commands: {
402
+ target: string;
403
+ params: Record<string, unknown>;
404
+ command: string;
405
+ }[];
406
+ runIf?: string | undefined;
407
+ }, {
408
+ onEvent: string;
409
+ commands: {
410
+ target: string;
411
+ params: Record<string, unknown>;
412
+ command: string;
413
+ }[];
414
+ runIf?: string | undefined;
415
+ }>;
416
+ enabled: z.ZodBoolean;
417
+ exclusivityGroup: z.ZodNullable<z.ZodString>;
418
+ score: z.ZodNullable<z.ZodNumber>;
419
+ module: z.ZodNullable<z.ZodString>;
420
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
421
+ }, "strip", z.ZodTypeAny, {
422
+ code: string | null;
423
+ module: string | null;
424
+ body: {
425
+ onEvent: string;
426
+ commands: {
427
+ target: string;
428
+ params: Record<string, unknown>;
429
+ command: string;
430
+ }[];
431
+ runIf?: string | undefined;
432
+ };
433
+ metadata: Record<string, unknown>;
434
+ displayName: string;
435
+ enabled: boolean;
436
+ exclusivityGroup: string | null;
437
+ score: number | null;
438
+ description?: string | undefined;
439
+ }, {
440
+ code: string | null;
441
+ module: string | null;
442
+ body: {
443
+ onEvent: string;
444
+ commands: {
445
+ target: string;
446
+ params: Record<string, unknown>;
447
+ command: string;
448
+ }[];
449
+ runIf?: string | undefined;
450
+ };
451
+ metadata: Record<string, unknown>;
452
+ displayName: string;
453
+ enabled: boolean;
454
+ exclusivityGroup: string | null;
455
+ score: number | null;
456
+ description?: string | undefined;
457
+ }>, "many">;
458
+ removeCodes: z.ZodArray<z.ZodString, "many">;
459
+ }, "strip", z.ZodTypeAny, {
460
+ merge: {
461
+ code: string | null;
462
+ module: string | null;
463
+ body: {
464
+ onEvent: string;
465
+ commands: {
466
+ target: string;
467
+ params: Record<string, unknown>;
468
+ command: string;
469
+ }[];
470
+ runIf?: string | undefined;
471
+ };
472
+ metadata: Record<string, unknown>;
473
+ displayName: string;
474
+ enabled: boolean;
475
+ exclusivityGroup: string | null;
476
+ score: number | null;
477
+ description?: string | undefined;
478
+ }[];
479
+ removeCodes: string[];
480
+ }, {
481
+ merge: {
482
+ code: string | null;
483
+ module: string | null;
484
+ body: {
485
+ onEvent: string;
486
+ commands: {
487
+ target: string;
488
+ params: Record<string, unknown>;
489
+ command: string;
490
+ }[];
491
+ runIf?: string | undefined;
492
+ };
493
+ metadata: Record<string, unknown>;
494
+ displayName: string;
495
+ enabled: boolean;
496
+ exclusivityGroup: string | null;
497
+ score: number | null;
498
+ description?: string | undefined;
499
+ }[];
500
+ removeCodes: string[];
501
+ }>;
378
502
  export type AutomationRuleBody = z.infer<typeof sAutomationRuleBody>;
379
503
  export type AutomationRuleProps = z.infer<typeof sAutomationRuleProps>;
380
504
  export type AutomationRuleDto = z.infer<typeof sAutomationRuleDto>;
381
505
  export type AddAutomationRuleRequest = z.infer<typeof sAddAutomationRuleRequest>;
382
506
  export type UpdateAutomationRuleRequest = z.infer<typeof sUpdateAutomationRule>;
507
+ export type AutomationBulkMergeRequest = z.infer<typeof sAutomationBulkMergeRequest>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sAutomationRuleDto = exports.sUpdateAutomationRule = exports.sAddAutomationRuleRequest = exports.sAutomationRuleProps = exports.sAutomationRuleBody = exports.sAutomationRuleCommand = void 0;
3
+ exports.sAutomationBulkMergeRequest = exports.sAutomationRuleDto = exports.sUpdateAutomationRule = exports.sAddAutomationRuleRequest = exports.sAutomationRuleProps = exports.sAutomationRuleBody = exports.sAutomationRuleCommand = void 0;
4
4
  const zod_1 = require("zod");
5
5
  exports.sAutomationRuleCommand = zod_1.z.object({
6
6
  command: zod_1.z.string().nonempty().describe('The command to be executed'),
@@ -56,3 +56,11 @@ exports.sAutomationRuleDto = exports.sAutomationRuleProps.merge(zod_1.z.object({
56
56
  .string()
57
57
  .describe('The date the automation rule was last modified'),
58
58
  }));
59
+ exports.sAutomationBulkMergeRequest = zod_1.z.object({
60
+ merge: zod_1.z
61
+ .array(exports.sAutomationRuleProps)
62
+ .describe('The automation rules to merge by code'),
63
+ removeCodes: zod_1.z
64
+ .array(zod_1.z.string())
65
+ .describe('The IDs of the automation rules to delete by code'),
66
+ });
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awarevue/api-types",
3
- "version": "1.0.72",
3
+ "version": "1.0.74",
4
4
  "description": "Common types between backend, agent(s) and frontend(s)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@awarevue/api-types",
3
- "version": "1.0.72",
3
+ "version": "1.0.74",
4
4
  "description": "Common types between backend, agent(s) and frontend(s)",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",