@openremote/core 1.0.2 → 1.2.0-snapshot.20240512154942

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.
Files changed (52) hide show
  1. package/README.md +86 -8
  2. package/lib/asset-mixin.d.ts +46 -0
  3. package/lib/asset-mixin.js +1 -0
  4. package/lib/asset-mixin.js.map +1 -0
  5. package/{dist → lib}/console.d.ts +21 -12
  6. package/lib/console.js +1 -0
  7. package/lib/console.js.map +1 -0
  8. package/lib/defaults.d.ts +15 -0
  9. package/lib/defaults.js +1 -0
  10. package/lib/defaults.js.map +1 -0
  11. package/{dist → lib}/event.d.ts +30 -16
  12. package/lib/event.js +1 -0
  13. package/lib/event.js.map +1 -0
  14. package/lib/index.d.ts +150 -0
  15. package/lib/index.js +1 -0
  16. package/lib/index.js.map +1 -0
  17. package/lib/util.d.ts +92 -0
  18. package/lib/util.js +1 -0
  19. package/lib/util.js.map +1 -0
  20. package/package.json +31 -14
  21. package/dist/asset-mixin.d.ts +0 -25
  22. package/dist/asset-mixin.js +0 -115
  23. package/dist/asset-mixin.js.map +0 -1
  24. package/dist/console.js +0 -446
  25. package/dist/console.js.map +0 -1
  26. package/dist/event.js +0 -454
  27. package/dist/event.js.map +0 -1
  28. package/dist/index.d.ts +0 -137
  29. package/dist/index.js +0 -683
  30. package/dist/index.js.map +0 -1
  31. package/dist/util.d.ts +0 -17
  32. package/dist/util.js +0 -72
  33. package/dist/util.js.map +0 -1
  34. package/src/asset-mixin.ts +0 -132
  35. package/src/console.d.ts +0 -56
  36. package/src/console.js +0 -451
  37. package/src/console.js.map +0 -1
  38. package/src/console.ts +0 -530
  39. package/src/event.d.ts +0 -75
  40. package/src/event.js +0 -410
  41. package/src/event.js.map +0 -1
  42. package/src/event.ts +0 -584
  43. package/src/index.d.ts +0 -110
  44. package/src/index.js +0 -525
  45. package/src/index.js.map +0 -1
  46. package/src/index.ts +0 -803
  47. package/src/util.d.ts +0 -15
  48. package/src/util.js +0 -46
  49. package/src/util.js.map +0 -1
  50. package/src/util.ts +0 -94
  51. package/tsconfig.json +0 -14
  52. package/tsconfig.tsbuildinfo +0 -9788
package/src/util.d.ts DELETED
@@ -1,15 +0,0 @@
1
- import { JsonRulesetDefinition, PushNotificationMessage, RadialGeofencePredicate } from "@openremote/model";
2
- export declare class Deferred<T> {
3
- protected _resolve: (value?: T | PromiseLike<T>) => void;
4
- protected _reject: (reason?: any) => void;
5
- protected _promise: Promise<T>;
6
- readonly resolve: (value?: T | PromiseLike<T> | undefined) => void;
7
- readonly reject: (reason?: any) => void;
8
- readonly promise: Promise<T>;
9
- constructor();
10
- }
11
- export interface GeoNotification {
12
- predicate: RadialGeofencePredicate;
13
- notification: PushNotificationMessage;
14
- }
15
- export declare function getGeoNotificationsFromRulesSet(rulesetDefinition: JsonRulesetDefinition): GeoNotification[];
package/src/util.js DELETED
@@ -1,46 +0,0 @@
1
- export class Deferred {
2
- constructor() {
3
- this._promise = new Promise((resolve1, reject1) => {
4
- this._resolve = resolve1;
5
- this._reject = reject1;
6
- });
7
- Object.freeze(this);
8
- }
9
- get resolve() {
10
- return this._resolve;
11
- }
12
- get reject() {
13
- return this._reject;
14
- }
15
- get promise() {
16
- return this._promise;
17
- }
18
- }
19
- export function getGeoNotificationsFromRulesSet(rulesetDefinition) {
20
- let geoPredicates = [];
21
- let geoNotification;
22
- rulesetDefinition.rules.forEach((rule) => {
23
- geoNotification = {};
24
- if (rule.when && rule.when.asset) {
25
- rule.when.asset.attributes.predicates.forEach((predicate) => {
26
- if (predicate.value.predicateType == "radial" || predicate.value.predicateType == "rect") {
27
- geoNotification.predicate = predicate.value;
28
- }
29
- });
30
- }
31
- if (rule.then) {
32
- rule.then.forEach((action) => {
33
- if (action.action == "notification") {
34
- if (action.notification && action.notification.message) {
35
- geoNotification.notification = action.notification.message;
36
- }
37
- }
38
- });
39
- }
40
- if (geoNotification.predicate && geoNotification.notification) {
41
- geoPredicates.push(geoNotification);
42
- }
43
- });
44
- return geoPredicates;
45
- }
46
- //# sourceMappingURL=util.js.map
package/src/util.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["util.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,QAAQ;IAkBjB;QACI,IAAI,CAAC,QAAQ,GAAG,IAAI,OAAO,CAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE;YACjD,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;YACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAC3B,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAlBD,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;IAED,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC;IACxB,CAAC;IAED,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;CASJ;AAOD,MAAM,UAAU,+BAA+B,CAAC,iBAAwC;IAEpF,IAAI,aAAa,GAAsB,EAAE,CAAC;IAC1C,IAAI,eAAgC,CAAC;IAErC,iBAAiB,CAAC,KAAM,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACtC,eAAe,GAAG,EAAqB,CAAC;QACxC,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YAC9B,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,UAAW,CAAC,UAAW,CAAC,OAAO,CAAC,CAAC,SAAS,EAAE,EAAE;gBAC1D,IAAI,SAAS,CAAC,KAAM,CAAC,aAAa,IAAI,QAAQ,IAAI,SAAS,CAAC,KAAM,CAAC,aAAa,IAAI,MAAM,EAAE;oBACxF,eAAe,CAAC,SAAS,GAAG,SAAS,CAAC,KAAgC,CAAA;iBACzE;YACL,CAAC,CAAC,CAAC;SACN;QAED,IAAI,IAAI,CAAC,IAAI,EAAE;YACX,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACzB,IAAI,MAAM,CAAC,MAAM,IAAI,cAAc,EAAE;oBACjC,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE;wBACpD,eAAe,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC,OAAkC,CAAC;qBACzF;iBACJ;YACL,CAAC,CAAC,CAAC;SACN;QACD,IAAI,eAAe,CAAC,SAAS,IAAI,eAAe,CAAC,YAAY,EAAE;YAC3D,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,CAAA;SACtC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,aAAa,CAAC;AACzB,CAAC"}
package/src/util.ts DELETED
@@ -1,94 +0,0 @@
1
- import {JsonRulesetDefinition, PushNotificationMessage, RadialGeofencePredicate} from "@openremote/model";
2
-
3
- export class Deferred<T> {
4
-
5
- protected _resolve!: (value?: T | PromiseLike<T>) => void;
6
- protected _reject!: (reason?: any) => void;
7
- protected _promise: Promise<T>;
8
-
9
- get resolve() {
10
- return this._resolve;
11
- }
12
-
13
- get reject() {
14
- return this._reject;
15
- }
16
-
17
- get promise() {
18
- return this._promise;
19
- }
20
-
21
- constructor() {
22
- this._promise = new Promise<T>((resolve1, reject1) => {
23
- this._resolve = resolve1;
24
- this._reject = reject1;
25
- });
26
- Object.freeze(this);
27
- }
28
- }
29
-
30
- export interface GeoNotification {
31
- predicate: RadialGeofencePredicate;
32
- notification: PushNotificationMessage;
33
- }
34
-
35
- export function getGeoNotificationsFromRulesSet(rulesetDefinition: JsonRulesetDefinition): GeoNotification[] {
36
-
37
- let geoPredicates: GeoNotification[] = [];
38
- let geoNotification: GeoNotification;
39
-
40
- rulesetDefinition.rules!.forEach((rule) => {
41
- geoNotification = {} as GeoNotification;
42
- if (rule.when && rule.when.asset) {
43
- rule.when.asset.attributes!.predicates!.forEach((predicate) => {
44
- if (predicate.value!.predicateType === "radial" || predicate.value!.predicateType === "rect") {
45
- geoNotification.predicate = predicate.value as RadialGeofencePredicate
46
- }
47
- });
48
- }
49
-
50
- if (rule.then) {
51
- rule.then.forEach((action) => {
52
- if (action.action === "notification") {
53
- if (action.notification && action.notification.message) {
54
- geoNotification.notification = action.notification.message as PushNotificationMessage;
55
- }
56
- }
57
- });
58
- }
59
- if (geoNotification.predicate && geoNotification.notification) {
60
- geoPredicates.push(geoNotification)
61
- }
62
- });
63
-
64
- return geoPredicates;
65
- }
66
-
67
- export function arraysEqual<T>(arr1?: T[], arr2?: T[]) {
68
- if (arr1 === arr2) {
69
- return true;
70
- }
71
- if (!arr1 || !arr2) {
72
- return false;
73
- }
74
- if (arr1.length !== arr2.length) {
75
- return false;
76
- }
77
- for (let i = arr1.length; i--;) {
78
- if (arr1[i] !== arr2[i]) {
79
- return false;
80
- }
81
- }
82
-
83
- return true;
84
- }
85
-
86
- export function arrayRemove<T>(arr: T[], item: T) {
87
- if (arr.length === 0) {
88
- return;
89
- }
90
- const index = arr.indexOf(item);
91
- if (index >= 0) {
92
- arr.splice(index, 1);
93
- }
94
- }
package/tsconfig.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "../../tsconfig",
3
- "compilerOptions": {
4
- "outDir": "./dist/",
5
- "rootDir": "src"
6
- },
7
- "include": [
8
- "./src"
9
- ],
10
- "references": [
11
- { "path": "../rest" },
12
- { "path": "../or-icon" }
13
- ]
14
- }