@openremote/core 1.0.2 → 1.2.0-snapshot.20240512155932

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 (58) hide show
  1. package/README.md +86 -8
  2. package/dist/umd/index.bundle.js +2 -0
  3. package/dist/umd/index.bundle.js.LICENSE.txt +26 -0
  4. package/dist/umd/index.js +2 -0
  5. package/dist/umd/index.js.LICENSE.txt +22 -0
  6. package/dist/umd/index.orbundle.js +50 -0
  7. package/dist/umd/index.orbundle.js.LICENSE.txt +38 -0
  8. package/lib/asset-mixin.d.ts +46 -0
  9. package/lib/asset-mixin.js +1 -0
  10. package/lib/asset-mixin.js.map +1 -0
  11. package/{dist → lib}/console.d.ts +21 -12
  12. package/lib/console.js +1 -0
  13. package/lib/console.js.map +1 -0
  14. package/lib/defaults.d.ts +15 -0
  15. package/lib/defaults.js +1 -0
  16. package/lib/defaults.js.map +1 -0
  17. package/{dist → lib}/event.d.ts +30 -16
  18. package/lib/event.js +1 -0
  19. package/lib/event.js.map +1 -0
  20. package/lib/index.d.ts +150 -0
  21. package/lib/index.js +1 -0
  22. package/lib/index.js.map +1 -0
  23. package/lib/util.d.ts +92 -0
  24. package/lib/util.js +1 -0
  25. package/lib/util.js.map +1 -0
  26. package/package.json +31 -14
  27. package/dist/asset-mixin.d.ts +0 -25
  28. package/dist/asset-mixin.js +0 -115
  29. package/dist/asset-mixin.js.map +0 -1
  30. package/dist/console.js +0 -446
  31. package/dist/console.js.map +0 -1
  32. package/dist/event.js +0 -454
  33. package/dist/event.js.map +0 -1
  34. package/dist/index.d.ts +0 -137
  35. package/dist/index.js +0 -683
  36. package/dist/index.js.map +0 -1
  37. package/dist/util.d.ts +0 -17
  38. package/dist/util.js +0 -72
  39. package/dist/util.js.map +0 -1
  40. package/src/asset-mixin.ts +0 -132
  41. package/src/console.d.ts +0 -56
  42. package/src/console.js +0 -451
  43. package/src/console.js.map +0 -1
  44. package/src/console.ts +0 -530
  45. package/src/event.d.ts +0 -75
  46. package/src/event.js +0 -410
  47. package/src/event.js.map +0 -1
  48. package/src/event.ts +0 -584
  49. package/src/index.d.ts +0 -110
  50. package/src/index.js +0 -525
  51. package/src/index.js.map +0 -1
  52. package/src/index.ts +0 -803
  53. package/src/util.d.ts +0 -15
  54. package/src/util.js +0 -46
  55. package/src/util.js.map +0 -1
  56. package/src/util.ts +0 -94
  57. package/tsconfig.json +0 -14
  58. 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
- }