@xyo-network/location-plugin 2.74.5 → 2.75.2

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 (114) hide show
  1. package/dist/browser/Config.cjs +27 -0
  2. package/dist/browser/Config.cjs.map +1 -0
  3. package/dist/browser/Config.d.cts.map +1 -0
  4. package/dist/browser/Config.d.mts.map +1 -0
  5. package/dist/browser/Config.d.ts +11 -0
  6. package/dist/browser/Config.d.ts.map +1 -0
  7. package/dist/browser/Config.js +5 -0
  8. package/dist/browser/Config.js.map +1 -0
  9. package/dist/browser/CurrentLocationPayloadSet.cjs +37 -0
  10. package/dist/browser/CurrentLocationPayloadSet.cjs.map +1 -0
  11. package/dist/browser/CurrentLocationPayloadSet.d.cts.map +1 -0
  12. package/dist/browser/CurrentLocationPayloadSet.d.mts.map +1 -0
  13. package/dist/browser/CurrentLocationPayloadSet.d.ts +3 -0
  14. package/dist/browser/CurrentLocationPayloadSet.d.ts.map +1 -0
  15. package/dist/browser/CurrentLocationPayloadSet.js +15 -0
  16. package/dist/browser/CurrentLocationPayloadSet.js.map +1 -0
  17. package/dist/browser/CurrentLocationWitness.cjs +70 -0
  18. package/dist/browser/CurrentLocationWitness.cjs.map +1 -0
  19. package/dist/browser/CurrentLocationWitness.d.cts.map +1 -0
  20. package/dist/browser/CurrentLocationWitness.d.mts.map +1 -0
  21. package/dist/browser/CurrentLocationWitness.d.ts +10 -0
  22. package/dist/browser/CurrentLocationWitness.d.ts.map +1 -0
  23. package/dist/browser/CurrentLocationWitness.js +44 -0
  24. package/dist/browser/CurrentLocationWitness.js.map +1 -0
  25. package/dist/browser/Plugin.cjs +85 -0
  26. package/dist/browser/Plugin.cjs.map +1 -0
  27. package/dist/browser/Plugin.d.cts.map +1 -0
  28. package/dist/browser/Plugin.d.mts.map +1 -0
  29. package/dist/browser/Plugin.d.ts +56 -0
  30. package/dist/browser/Plugin.d.ts.map +1 -0
  31. package/dist/browser/Plugin.js +16 -0
  32. package/dist/browser/Plugin.js.map +1 -0
  33. package/dist/browser/index.cjs +107 -0
  34. package/dist/browser/index.cjs.map +1 -0
  35. package/dist/browser/index.d.cts.map +1 -0
  36. package/dist/browser/index.d.mts.map +1 -0
  37. package/dist/browser/index.d.ts +7 -0
  38. package/dist/browser/index.d.ts.map +1 -0
  39. package/dist/browser/index.js +10 -0
  40. package/dist/browser/index.js.map +1 -0
  41. package/dist/docs.json +560 -560
  42. package/dist/node/Config.d.cts +11 -0
  43. package/dist/node/Config.d.cts.map +1 -0
  44. package/dist/node/Config.d.mts +11 -0
  45. package/dist/node/Config.d.mts.map +1 -0
  46. package/dist/node/Config.d.ts +11 -0
  47. package/dist/node/Config.d.ts.map +1 -0
  48. package/dist/node/Config.js +31 -0
  49. package/dist/node/Config.js.map +1 -0
  50. package/dist/node/Config.mjs +6 -0
  51. package/dist/node/Config.mjs.map +1 -0
  52. package/dist/node/CurrentLocationPayloadSet.d.cts +3 -0
  53. package/dist/node/CurrentLocationPayloadSet.d.cts.map +1 -0
  54. package/dist/node/CurrentLocationPayloadSet.d.mts +3 -0
  55. package/dist/node/CurrentLocationPayloadSet.d.mts.map +1 -0
  56. package/dist/node/CurrentLocationPayloadSet.d.ts +3 -0
  57. package/dist/node/CurrentLocationPayloadSet.d.ts.map +1 -0
  58. package/dist/node/CurrentLocationPayloadSet.js +41 -0
  59. package/dist/node/CurrentLocationPayloadSet.js.map +1 -0
  60. package/dist/node/CurrentLocationPayloadSet.mjs +16 -0
  61. package/dist/node/CurrentLocationPayloadSet.mjs.map +1 -0
  62. package/dist/node/CurrentLocationWitness.d.cts +10 -0
  63. package/dist/node/CurrentLocationWitness.d.cts.map +1 -0
  64. package/dist/node/CurrentLocationWitness.d.mts +10 -0
  65. package/dist/node/CurrentLocationWitness.d.mts.map +1 -0
  66. package/dist/node/CurrentLocationWitness.d.ts +10 -0
  67. package/dist/node/CurrentLocationWitness.d.ts.map +1 -0
  68. package/dist/node/CurrentLocationWitness.js +75 -0
  69. package/dist/node/CurrentLocationWitness.js.map +1 -0
  70. package/dist/node/CurrentLocationWitness.mjs +50 -0
  71. package/dist/node/CurrentLocationWitness.mjs.map +1 -0
  72. package/dist/node/Plugin.d.cts +56 -0
  73. package/dist/node/Plugin.d.cts.map +1 -0
  74. package/dist/node/Plugin.d.mts +56 -0
  75. package/dist/node/Plugin.d.mts.map +1 -0
  76. package/dist/node/Plugin.d.ts +56 -0
  77. package/dist/node/Plugin.d.ts.map +1 -0
  78. package/dist/node/Plugin.js +90 -0
  79. package/dist/node/Plugin.js.map +1 -0
  80. package/dist/node/Plugin.mjs +65 -0
  81. package/dist/node/Plugin.mjs.map +1 -0
  82. package/dist/node/index.d.cts +7 -0
  83. package/dist/node/index.d.cts.map +1 -0
  84. package/dist/node/index.d.mts +7 -0
  85. package/dist/node/index.d.mts.map +1 -0
  86. package/dist/node/index.d.ts +7 -0
  87. package/dist/node/index.d.ts.map +1 -0
  88. package/dist/{index.js → node/index.js} +2 -1
  89. package/dist/node/index.js.map +1 -0
  90. package/dist/{index.mjs → node/index.mjs} +2 -1
  91. package/dist/node/index.mjs.map +1 -0
  92. package/package.json +31 -28
  93. package/dist/Config.d.mts.map +0 -1
  94. package/dist/Config.d.ts.map +0 -1
  95. package/dist/CurrentLocationPayloadSet.d.mts.map +0 -1
  96. package/dist/CurrentLocationPayloadSet.d.ts.map +0 -1
  97. package/dist/CurrentLocationWitness.d.mts.map +0 -1
  98. package/dist/CurrentLocationWitness.d.ts.map +0 -1
  99. package/dist/Plugin.d.mts.map +0 -1
  100. package/dist/Plugin.d.ts.map +0 -1
  101. package/dist/index.d.mts.map +0 -1
  102. package/dist/index.d.ts.map +0 -1
  103. package/dist/index.js.map +0 -1
  104. package/dist/index.mjs.map +0 -1
  105. /package/dist/{Config.d.mts → browser/Config.d.cts} +0 -0
  106. /package/dist/{Config.d.ts → browser/Config.d.mts} +0 -0
  107. /package/dist/{CurrentLocationPayloadSet.d.mts → browser/CurrentLocationPayloadSet.d.cts} +0 -0
  108. /package/dist/{CurrentLocationPayloadSet.d.ts → browser/CurrentLocationPayloadSet.d.mts} +0 -0
  109. /package/dist/{CurrentLocationWitness.d.mts → browser/CurrentLocationWitness.d.cts} +0 -0
  110. /package/dist/{CurrentLocationWitness.d.ts → browser/CurrentLocationWitness.d.mts} +0 -0
  111. /package/dist/{Plugin.d.mts → browser/Plugin.d.cts} +0 -0
  112. /package/dist/{Plugin.d.ts → browser/Plugin.d.mts} +0 -0
  113. /package/dist/{index.d.mts → browser/index.d.cts} +0 -0
  114. /package/dist/{index.d.ts → browser/index.d.mts} +0 -0
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/Plugin.ts
21
+ var Plugin_exports = {};
22
+ __export(Plugin_exports, {
23
+ LocationPlugin: () => LocationPlugin
24
+ });
25
+ module.exports = __toCommonJS(Plugin_exports);
26
+ var import_location_payload_plugin2 = require("@xyo-network/location-payload-plugin");
27
+ var import_payload_model = require("@xyo-network/payload-model");
28
+ var import_payloadset_plugin = require("@xyo-network/payloadset-plugin");
29
+
30
+ // src/CurrentLocationWitness.ts
31
+ var import_assert = require("@xylabs/assert");
32
+ var import_location_payload_plugin = require("@xyo-network/location-payload-plugin");
33
+ var import_witness = require("@xyo-network/witness");
34
+
35
+ // src/Config.ts
36
+ var CurrentLocationWitnessConfigSchema = "network.xyo.location.current.config";
37
+
38
+ // src/CurrentLocationWitness.ts
39
+ var CurrentLocationWitness = class extends import_witness.AbstractWitness {
40
+ static configSchemas = [CurrentLocationWitnessConfigSchema];
41
+ get geolocation() {
42
+ return (0, import_assert.assertEx)(this.params.geolocation, "No geolocation provided");
43
+ }
44
+ getCurrentPosition() {
45
+ return new Promise((resolve, reject) => {
46
+ var _a;
47
+ (_a = this.geolocation) == null ? void 0 : _a.getCurrentPosition(
48
+ (position) => {
49
+ resolve(position);
50
+ },
51
+ (error) => {
52
+ reject(error);
53
+ }
54
+ );
55
+ });
56
+ }
57
+ async observeHandler() {
58
+ const location = await this.getCurrentPosition();
59
+ const locationPayload = {
60
+ altitude: location.coords.altitude ?? void 0,
61
+ altitudeAccuracy: location.coords.altitudeAccuracy ?? void 0,
62
+ latitude: location.coords.latitude,
63
+ longitude: location.coords.longitude,
64
+ schema: import_location_payload_plugin.LocationSchema
65
+ };
66
+ const heading = location.coords.heading ? [
67
+ {
68
+ heading: location.coords.heading ?? void 0,
69
+ schema: import_location_payload_plugin.LocationHeadingSchema,
70
+ speed: location.coords.speed ?? void 0
71
+ }
72
+ ] : [];
73
+ return [locationPayload, ...heading];
74
+ }
75
+ };
76
+
77
+ // src/Plugin.ts
78
+ var LocationPlugin = () => (0, import_payloadset_plugin.createPayloadSetWitnessPlugin)(
79
+ { required: { [import_location_payload_plugin2.LocationSchema]: 1 }, schema: import_payload_model.PayloadSetSchema },
80
+ {
81
+ witness: async (params) => {
82
+ return await CurrentLocationWitness.create(params);
83
+ }
84
+ }
85
+ );
86
+ // Annotate the CommonJS export names for ESM import in node:
87
+ 0 && (module.exports = {
88
+ LocationPlugin
89
+ });
90
+ //# sourceMappingURL=Plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Plugin.ts","../../src/CurrentLocationWitness.ts","../../src/Config.ts"],"sourcesContent":["import { LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { CurrentLocationWitness } from './CurrentLocationWitness'\n\nexport const LocationPlugin = () =>\n createPayloadSetWitnessPlugin<CurrentLocationWitness>(\n { required: { [LocationSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await CurrentLocationWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { LocationHeadingPayload, LocationHeadingSchema, LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\nimport { AbstractWitness } from '@xyo-network/witness'\n\nimport { CurrentLocationWitnessConfigSchema, CurrentLocationWitnessParams } from './Config'\n\nexport class CurrentLocationWitness<TParams extends CurrentLocationWitnessParams = CurrentLocationWitnessParams> extends AbstractWitness<TParams> {\n static override configSchemas = [CurrentLocationWitnessConfigSchema]\n\n get geolocation(): Geolocation {\n return assertEx(this.params.geolocation, 'No geolocation provided')\n }\n\n getCurrentPosition() {\n return new Promise<GeolocationPosition>((resolve, reject) => {\n this.geolocation?.getCurrentPosition(\n (position: GeolocationPosition) => {\n resolve(position)\n },\n (error: GeolocationPositionError) => {\n reject(error)\n },\n )\n })\n }\n\n protected override async observeHandler(): Promise<Payload[]> {\n const location = await this.getCurrentPosition()\n const locationPayload: LocationPayload = {\n altitude: location.coords.altitude ?? undefined,\n altitudeAccuracy: location.coords.altitudeAccuracy ?? undefined,\n latitude: location.coords.latitude,\n longitude: location.coords.longitude,\n schema: LocationSchema,\n }\n const heading: LocationHeadingPayload[] = location.coords.heading\n ? [\n {\n heading: location.coords.heading ?? undefined,\n schema: LocationHeadingSchema,\n speed: location.coords.speed ?? undefined,\n },\n ]\n : []\n return [locationPayload, ...heading]\n }\n}\n","import { AnyConfigSchema, ModuleParams } from '@xyo-network/module'\nimport { WitnessConfig } from '@xyo-network/witness'\n\nexport type CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config'\nexport const CurrentLocationWitnessConfigSchema: CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config'\n\nexport type CurrentLocationWitnessConfig = WitnessConfig<{\n schema: CurrentLocationWitnessConfigSchema\n}>\n\nexport type CurrentLocationWitnessParams = ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>, { geolocation?: Geolocation }>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,kCAA+B;AAC/B,2BAAiC;AACjC,+BAA8C;;;ACF9C,oBAAyB;AACzB,qCAA+F;AAE/F,qBAAgC;;;ACCzB,IAAM,qCAAyE;;;ADG/E,IAAM,yBAAN,cAAkH,+BAAyB;AAAA,EAChJ,OAAgB,gBAAgB,CAAC,kCAAkC;AAAA,EAEnE,IAAI,cAA2B;AAC7B,eAAO,wBAAS,KAAK,OAAO,aAAa,yBAAyB;AAAA,EACpE;AAAA,EAEA,qBAAqB;AACnB,WAAO,IAAI,QAA6B,CAAC,SAAS,WAAW;AAfjE;AAgBM,iBAAK,gBAAL,mBAAkB;AAAA,QAChB,CAAC,aAAkC;AACjC,kBAAQ,QAAQ;AAAA,QAClB;AAAA,QACA,CAAC,UAAoC;AACnC,iBAAO,KAAK;AAAA,QACd;AAAA;AAAA,IAEJ,CAAC;AAAA,EACH;AAAA,EAEA,MAAyB,iBAAqC;AAC5D,UAAM,WAAW,MAAM,KAAK,mBAAmB;AAC/C,UAAM,kBAAmC;AAAA,MACvC,UAAU,SAAS,OAAO,YAAY;AAAA,MACtC,kBAAkB,SAAS,OAAO,oBAAoB;AAAA,MACtD,UAAU,SAAS,OAAO;AAAA,MAC1B,WAAW,SAAS,OAAO;AAAA,MAC3B,QAAQ;AAAA,IACV;AACA,UAAM,UAAoC,SAAS,OAAO,UACtD;AAAA,MACE;AAAA,QACE,SAAS,SAAS,OAAO,WAAW;AAAA,QACpC,QAAQ;AAAA,QACR,OAAO,SAAS,OAAO,SAAS;AAAA,MAClC;AAAA,IACF,IACA,CAAC;AACL,WAAO,CAAC,iBAAiB,GAAG,OAAO;AAAA,EACrC;AACF;;;ADzCO,IAAM,iBAAiB,UAC5B;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,8CAAc,GAAG,EAAE,GAAG,QAAQ,sCAAiB;AAAA,EAC9D;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAO,MAAM,uBAAuB,OAAO,MAAM;AAAA,IACnD;AAAA,EACF;AACF;","names":["import_location_payload_plugin"]}
@@ -0,0 +1,65 @@
1
+ // src/Plugin.ts
2
+ import { LocationSchema as LocationSchema2 } from "@xyo-network/location-payload-plugin";
3
+ import { PayloadSetSchema } from "@xyo-network/payload-model";
4
+ import { createPayloadSetWitnessPlugin } from "@xyo-network/payloadset-plugin";
5
+
6
+ // src/CurrentLocationWitness.ts
7
+ import { assertEx } from "@xylabs/assert";
8
+ import { LocationHeadingSchema, LocationSchema } from "@xyo-network/location-payload-plugin";
9
+ import { AbstractWitness } from "@xyo-network/witness";
10
+
11
+ // src/Config.ts
12
+ var CurrentLocationWitnessConfigSchema = "network.xyo.location.current.config";
13
+
14
+ // src/CurrentLocationWitness.ts
15
+ var CurrentLocationWitness = class extends AbstractWitness {
16
+ static configSchemas = [CurrentLocationWitnessConfigSchema];
17
+ get geolocation() {
18
+ return assertEx(this.params.geolocation, "No geolocation provided");
19
+ }
20
+ getCurrentPosition() {
21
+ return new Promise((resolve, reject) => {
22
+ var _a;
23
+ (_a = this.geolocation) == null ? void 0 : _a.getCurrentPosition(
24
+ (position) => {
25
+ resolve(position);
26
+ },
27
+ (error) => {
28
+ reject(error);
29
+ }
30
+ );
31
+ });
32
+ }
33
+ async observeHandler() {
34
+ const location = await this.getCurrentPosition();
35
+ const locationPayload = {
36
+ altitude: location.coords.altitude ?? void 0,
37
+ altitudeAccuracy: location.coords.altitudeAccuracy ?? void 0,
38
+ latitude: location.coords.latitude,
39
+ longitude: location.coords.longitude,
40
+ schema: LocationSchema
41
+ };
42
+ const heading = location.coords.heading ? [
43
+ {
44
+ heading: location.coords.heading ?? void 0,
45
+ schema: LocationHeadingSchema,
46
+ speed: location.coords.speed ?? void 0
47
+ }
48
+ ] : [];
49
+ return [locationPayload, ...heading];
50
+ }
51
+ };
52
+
53
+ // src/Plugin.ts
54
+ var LocationPlugin = () => createPayloadSetWitnessPlugin(
55
+ { required: { [LocationSchema2]: 1 }, schema: PayloadSetSchema },
56
+ {
57
+ witness: async (params) => {
58
+ return await CurrentLocationWitness.create(params);
59
+ }
60
+ }
61
+ );
62
+ export {
63
+ LocationPlugin
64
+ };
65
+ //# sourceMappingURL=Plugin.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Plugin.ts","../../src/CurrentLocationWitness.ts","../../src/Config.ts"],"sourcesContent":["import { LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { CurrentLocationWitness } from './CurrentLocationWitness'\n\nexport const LocationPlugin = () =>\n createPayloadSetWitnessPlugin<CurrentLocationWitness>(\n { required: { [LocationSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await CurrentLocationWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { LocationHeadingPayload, LocationHeadingSchema, LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\nimport { AbstractWitness } from '@xyo-network/witness'\n\nimport { CurrentLocationWitnessConfigSchema, CurrentLocationWitnessParams } from './Config'\n\nexport class CurrentLocationWitness<TParams extends CurrentLocationWitnessParams = CurrentLocationWitnessParams> extends AbstractWitness<TParams> {\n static override configSchemas = [CurrentLocationWitnessConfigSchema]\n\n get geolocation(): Geolocation {\n return assertEx(this.params.geolocation, 'No geolocation provided')\n }\n\n getCurrentPosition() {\n return new Promise<GeolocationPosition>((resolve, reject) => {\n this.geolocation?.getCurrentPosition(\n (position: GeolocationPosition) => {\n resolve(position)\n },\n (error: GeolocationPositionError) => {\n reject(error)\n },\n )\n })\n }\n\n protected override async observeHandler(): Promise<Payload[]> {\n const location = await this.getCurrentPosition()\n const locationPayload: LocationPayload = {\n altitude: location.coords.altitude ?? undefined,\n altitudeAccuracy: location.coords.altitudeAccuracy ?? undefined,\n latitude: location.coords.latitude,\n longitude: location.coords.longitude,\n schema: LocationSchema,\n }\n const heading: LocationHeadingPayload[] = location.coords.heading\n ? [\n {\n heading: location.coords.heading ?? undefined,\n schema: LocationHeadingSchema,\n speed: location.coords.speed ?? undefined,\n },\n ]\n : []\n return [locationPayload, ...heading]\n }\n}\n","import { AnyConfigSchema, ModuleParams } from '@xyo-network/module'\nimport { WitnessConfig } from '@xyo-network/witness'\n\nexport type CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config'\nexport const CurrentLocationWitnessConfigSchema: CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config'\n\nexport type CurrentLocationWitnessConfig = WitnessConfig<{\n schema: CurrentLocationWitnessConfigSchema\n}>\n\nexport type CurrentLocationWitnessParams = ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>, { geolocation?: Geolocation }>\n"],"mappings":";AAAA,SAAS,kBAAAA,uBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACF9C,SAAS,gBAAgB;AACzB,SAAiC,uBAAwC,sBAAsB;AAE/F,SAAS,uBAAuB;;;ACCzB,IAAM,qCAAyE;;;ADG/E,IAAM,yBAAN,cAAkH,gBAAyB;AAAA,EAChJ,OAAgB,gBAAgB,CAAC,kCAAkC;AAAA,EAEnE,IAAI,cAA2B;AAC7B,WAAO,SAAS,KAAK,OAAO,aAAa,yBAAyB;AAAA,EACpE;AAAA,EAEA,qBAAqB;AACnB,WAAO,IAAI,QAA6B,CAAC,SAAS,WAAW;AAfjE;AAgBM,iBAAK,gBAAL,mBAAkB;AAAA,QAChB,CAAC,aAAkC;AACjC,kBAAQ,QAAQ;AAAA,QAClB;AAAA,QACA,CAAC,UAAoC;AACnC,iBAAO,KAAK;AAAA,QACd;AAAA;AAAA,IAEJ,CAAC;AAAA,EACH;AAAA,EAEA,MAAyB,iBAAqC;AAC5D,UAAM,WAAW,MAAM,KAAK,mBAAmB;AAC/C,UAAM,kBAAmC;AAAA,MACvC,UAAU,SAAS,OAAO,YAAY;AAAA,MACtC,kBAAkB,SAAS,OAAO,oBAAoB;AAAA,MACtD,UAAU,SAAS,OAAO;AAAA,MAC1B,WAAW,SAAS,OAAO;AAAA,MAC3B,QAAQ;AAAA,IACV;AACA,UAAM,UAAoC,SAAS,OAAO,UACtD;AAAA,MACE;AAAA,QACE,SAAS,SAAS,OAAO,WAAW;AAAA,QACpC,QAAQ;AAAA,QACR,OAAO,SAAS,OAAO,SAAS;AAAA,MAClC;AAAA,IACF,IACA,CAAC;AACL,WAAO,CAAC,iBAAiB,GAAG,OAAO;AAAA,EACrC;AACF;;;ADzCO,IAAM,iBAAiB,MAC5B;AAAA,EACE,EAAE,UAAU,EAAE,CAACC,eAAc,GAAG,EAAE,GAAG,QAAQ,iBAAiB;AAAA,EAC9D;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAO,MAAM,uBAAuB,OAAO,MAAM;AAAA,IACnD;AAAA,EACF;AACF;","names":["LocationSchema","LocationSchema"]}
@@ -0,0 +1,7 @@
1
+ import { LocationPlugin } from './Plugin';
2
+ export * from './Config';
3
+ export * from './CurrentLocationPayloadSet';
4
+ export * from './CurrentLocationWitness';
5
+ export { LocationPlugin };
6
+ export default LocationPlugin;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC,cAAc,UAAU,CAAA;AACxB,cAAc,6BAA6B,CAAA;AAC3C,cAAc,0BAA0B,CAAA;AAExC,OAAO,EAAE,cAAc,EAAE,CAAA;AAGzB,eAAe,cAAc,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { LocationPlugin } from './Plugin';
2
+ export * from './Config';
3
+ export * from './CurrentLocationPayloadSet';
4
+ export * from './CurrentLocationWitness';
5
+ export { LocationPlugin };
6
+ export default LocationPlugin;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC,cAAc,UAAU,CAAA;AACxB,cAAc,6BAA6B,CAAA;AAC3C,cAAc,0BAA0B,CAAA;AAExC,OAAO,EAAE,cAAc,EAAE,CAAA;AAGzB,eAAe,cAAc,CAAA"}
@@ -0,0 +1,7 @@
1
+ import { LocationPlugin } from './Plugin';
2
+ export * from './Config';
3
+ export * from './CurrentLocationPayloadSet';
4
+ export * from './CurrentLocationWitness';
5
+ export { LocationPlugin };
6
+ export default LocationPlugin;
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC,cAAc,UAAU,CAAA;AACxB,cAAc,6BAA6B,CAAA;AAC3C,cAAc,0BAA0B,CAAA;AAExC,OAAO,EAAE,cAAc,EAAE,CAAA;AAGzB,eAAe,cAAc,CAAA"}
@@ -49,7 +49,8 @@ var CurrentLocationWitness = class extends import_witness.AbstractWitness {
49
49
  }
50
50
  getCurrentPosition() {
51
51
  return new Promise((resolve, reject) => {
52
- this.geolocation?.getCurrentPosition(
52
+ var _a;
53
+ (_a = this.geolocation) == null ? void 0 : _a.getCurrentPosition(
53
54
  (position) => {
54
55
  resolve(position);
55
56
  },
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/index.ts","../../src/Plugin.ts","../../src/CurrentLocationWitness.ts","../../src/Config.ts","../../src/CurrentLocationPayloadSet.ts"],"sourcesContent":["import { LocationPlugin } from './Plugin'\n\nexport * from './Config'\nexport * from './CurrentLocationPayloadSet'\nexport * from './CurrentLocationWitness'\n\nexport { LocationPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default LocationPlugin\n","import { LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { CurrentLocationWitness } from './CurrentLocationWitness'\n\nexport const LocationPlugin = () =>\n createPayloadSetWitnessPlugin<CurrentLocationWitness>(\n { required: { [LocationSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await CurrentLocationWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { LocationHeadingPayload, LocationHeadingSchema, LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\nimport { AbstractWitness } from '@xyo-network/witness'\n\nimport { CurrentLocationWitnessConfigSchema, CurrentLocationWitnessParams } from './Config'\n\nexport class CurrentLocationWitness<TParams extends CurrentLocationWitnessParams = CurrentLocationWitnessParams> extends AbstractWitness<TParams> {\n static override configSchemas = [CurrentLocationWitnessConfigSchema]\n\n get geolocation(): Geolocation {\n return assertEx(this.params.geolocation, 'No geolocation provided')\n }\n\n getCurrentPosition() {\n return new Promise<GeolocationPosition>((resolve, reject) => {\n this.geolocation?.getCurrentPosition(\n (position: GeolocationPosition) => {\n resolve(position)\n },\n (error: GeolocationPositionError) => {\n reject(error)\n },\n )\n })\n }\n\n protected override async observeHandler(): Promise<Payload[]> {\n const location = await this.getCurrentPosition()\n const locationPayload: LocationPayload = {\n altitude: location.coords.altitude ?? undefined,\n altitudeAccuracy: location.coords.altitudeAccuracy ?? undefined,\n latitude: location.coords.latitude,\n longitude: location.coords.longitude,\n schema: LocationSchema,\n }\n const heading: LocationHeadingPayload[] = location.coords.heading\n ? [\n {\n heading: location.coords.heading ?? undefined,\n schema: LocationHeadingSchema,\n speed: location.coords.speed ?? undefined,\n },\n ]\n : []\n return [locationPayload, ...heading]\n }\n}\n","import { AnyConfigSchema, ModuleParams } from '@xyo-network/module'\nimport { WitnessConfig } from '@xyo-network/witness'\n\nexport type CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config'\nexport const CurrentLocationWitnessConfigSchema: CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config'\n\nexport type CurrentLocationWitnessConfig = WitnessConfig<{\n schema: CurrentLocationWitnessConfigSchema\n}>\n\nexport type CurrentLocationWitnessParams = ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>, { geolocation?: Geolocation }>\n","import { LocationHeadingSchema, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { PayloadSetPayload, PayloadSetSchema } from '@xyo-network/payload-model'\n\nexport const CurrentLocationPayloadSet: PayloadSetPayload = {\n optional: {\n [LocationHeadingSchema]: 1,\n },\n required: {\n [LocationSchema]: 1,\n },\n schema: PayloadSetSchema,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,IAAAA,kCAA+B;AAC/B,2BAAiC;AACjC,+BAA8C;;;ACF9C,oBAAyB;AACzB,qCAA+F;AAE/F,qBAAgC;;;ACCzB,IAAM,qCAAyE;;;ADG/E,IAAM,yBAAN,cAAkH,+BAAyB;AAAA,EAChJ,OAAgB,gBAAgB,CAAC,kCAAkC;AAAA,EAEnE,IAAI,cAA2B;AAC7B,eAAO,wBAAS,KAAK,OAAO,aAAa,yBAAyB;AAAA,EACpE;AAAA,EAEA,qBAAqB;AACnB,WAAO,IAAI,QAA6B,CAAC,SAAS,WAAW;AAfjE;AAgBM,iBAAK,gBAAL,mBAAkB;AAAA,QAChB,CAAC,aAAkC;AACjC,kBAAQ,QAAQ;AAAA,QAClB;AAAA,QACA,CAAC,UAAoC;AACnC,iBAAO,KAAK;AAAA,QACd;AAAA;AAAA,IAEJ,CAAC;AAAA,EACH;AAAA,EAEA,MAAyB,iBAAqC;AAC5D,UAAM,WAAW,MAAM,KAAK,mBAAmB;AAC/C,UAAM,kBAAmC;AAAA,MACvC,UAAU,SAAS,OAAO,YAAY;AAAA,MACtC,kBAAkB,SAAS,OAAO,oBAAoB;AAAA,MACtD,UAAU,SAAS,OAAO;AAAA,MAC1B,WAAW,SAAS,OAAO;AAAA,MAC3B,QAAQ;AAAA,IACV;AACA,UAAM,UAAoC,SAAS,OAAO,UACtD;AAAA,MACE;AAAA,QACE,SAAS,SAAS,OAAO,WAAW;AAAA,QACpC,QAAQ;AAAA,QACR,OAAO,SAAS,OAAO,SAAS;AAAA,MAClC;AAAA,IACF,IACA,CAAC;AACL,WAAO,CAAC,iBAAiB,GAAG,OAAO;AAAA,EACrC;AACF;;;ADzCO,IAAM,iBAAiB,UAC5B;AAAA,EACE,EAAE,UAAU,EAAE,CAAC,8CAAc,GAAG,EAAE,GAAG,QAAQ,sCAAiB;AAAA,EAC9D;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAO,MAAM,uBAAuB,OAAO,MAAM;AAAA,IACnD;AAAA,EACF;AACF;;;AGdF,IAAAC,kCAAsD;AACtD,IAAAC,wBAAoD;AAE7C,IAAM,4BAA+C;AAAA,EAC1D,UAAU;AAAA,IACR,CAAC,qDAAqB,GAAG;AAAA,EAC3B;AAAA,EACA,UAAU;AAAA,IACR,CAAC,8CAAc,GAAG;AAAA,EACpB;AAAA,EACA,QAAQ;AACV;;;AJFA,IAAO,cAAQ;","names":["import_location_payload_plugin","import_location_payload_plugin","import_payload_model"]}
@@ -19,7 +19,8 @@ var CurrentLocationWitness = class extends AbstractWitness {
19
19
  }
20
20
  getCurrentPosition() {
21
21
  return new Promise((resolve, reject) => {
22
- this.geolocation?.getCurrentPosition(
22
+ var _a;
23
+ (_a = this.geolocation) == null ? void 0 : _a.getCurrentPosition(
23
24
  (position) => {
24
25
  resolve(position);
25
26
  },
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/Plugin.ts","../../src/CurrentLocationWitness.ts","../../src/Config.ts","../../src/CurrentLocationPayloadSet.ts","../../src/index.ts"],"sourcesContent":["import { LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { CurrentLocationWitness } from './CurrentLocationWitness'\n\nexport const LocationPlugin = () =>\n createPayloadSetWitnessPlugin<CurrentLocationWitness>(\n { required: { [LocationSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await CurrentLocationWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { LocationHeadingPayload, LocationHeadingSchema, LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\nimport { AbstractWitness } from '@xyo-network/witness'\n\nimport { CurrentLocationWitnessConfigSchema, CurrentLocationWitnessParams } from './Config'\n\nexport class CurrentLocationWitness<TParams extends CurrentLocationWitnessParams = CurrentLocationWitnessParams> extends AbstractWitness<TParams> {\n static override configSchemas = [CurrentLocationWitnessConfigSchema]\n\n get geolocation(): Geolocation {\n return assertEx(this.params.geolocation, 'No geolocation provided')\n }\n\n getCurrentPosition() {\n return new Promise<GeolocationPosition>((resolve, reject) => {\n this.geolocation?.getCurrentPosition(\n (position: GeolocationPosition) => {\n resolve(position)\n },\n (error: GeolocationPositionError) => {\n reject(error)\n },\n )\n })\n }\n\n protected override async observeHandler(): Promise<Payload[]> {\n const location = await this.getCurrentPosition()\n const locationPayload: LocationPayload = {\n altitude: location.coords.altitude ?? undefined,\n altitudeAccuracy: location.coords.altitudeAccuracy ?? undefined,\n latitude: location.coords.latitude,\n longitude: location.coords.longitude,\n schema: LocationSchema,\n }\n const heading: LocationHeadingPayload[] = location.coords.heading\n ? [\n {\n heading: location.coords.heading ?? undefined,\n schema: LocationHeadingSchema,\n speed: location.coords.speed ?? undefined,\n },\n ]\n : []\n return [locationPayload, ...heading]\n }\n}\n","import { AnyConfigSchema, ModuleParams } from '@xyo-network/module'\nimport { WitnessConfig } from '@xyo-network/witness'\n\nexport type CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config'\nexport const CurrentLocationWitnessConfigSchema: CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config'\n\nexport type CurrentLocationWitnessConfig = WitnessConfig<{\n schema: CurrentLocationWitnessConfigSchema\n}>\n\nexport type CurrentLocationWitnessParams = ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>, { geolocation?: Geolocation }>\n","import { LocationHeadingSchema, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { PayloadSetPayload, PayloadSetSchema } from '@xyo-network/payload-model'\n\nexport const CurrentLocationPayloadSet: PayloadSetPayload = {\n optional: {\n [LocationHeadingSchema]: 1,\n },\n required: {\n [LocationSchema]: 1,\n },\n schema: PayloadSetSchema,\n}\n","import { LocationPlugin } from './Plugin'\n\nexport * from './Config'\nexport * from './CurrentLocationPayloadSet'\nexport * from './CurrentLocationWitness'\n\nexport { LocationPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default LocationPlugin\n"],"mappings":";AAAA,SAAS,kBAAAA,uBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACF9C,SAAS,gBAAgB;AACzB,SAAiC,uBAAwC,sBAAsB;AAE/F,SAAS,uBAAuB;;;ACCzB,IAAM,qCAAyE;;;ADG/E,IAAM,yBAAN,cAAkH,gBAAyB;AAAA,EAChJ,OAAgB,gBAAgB,CAAC,kCAAkC;AAAA,EAEnE,IAAI,cAA2B;AAC7B,WAAO,SAAS,KAAK,OAAO,aAAa,yBAAyB;AAAA,EACp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Schema","LocationHeadingSchema","LocationSchema","PayloadSetSchema"]}
package/package.json CHANGED
@@ -10,49 +10,52 @@
10
10
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/assert": "^2.11.7",
14
- "@xyo-network/location-payload-plugin": "~2.74.5",
15
- "@xyo-network/module": "~2.74.5",
16
- "@xyo-network/payload-model": "~2.74.5",
17
- "@xyo-network/payloadset-plugin": "~2.74.5",
18
- "@xyo-network/witness": "~2.74.5"
13
+ "@xylabs/assert": "^2.12.10",
14
+ "@xyo-network/location-payload-plugin": "~2.75.2",
15
+ "@xyo-network/module": "~2.75.2",
16
+ "@xyo-network/payload-model": "~2.75.2",
17
+ "@xyo-network/payloadset-plugin": "~2.75.2",
18
+ "@xyo-network/witness": "~2.75.2"
19
19
  },
20
20
  "devDependencies": {
21
- "@xylabs/ts-scripts-yarn3": "^3.0.28",
22
- "@xylabs/tsconfig-dom": "^3.0.28",
23
- "@xylabs/tsconfig-dom-jest": "^3.0.28",
21
+ "@xylabs/ts-scripts-yarn3": "^3.0.77",
22
+ "@xylabs/tsconfig-dom": "^3.0.77",
23
+ "@xylabs/tsconfig-dom-jest": "^3.0.77",
24
24
  "typescript": "^5.2.2"
25
25
  },
26
26
  "description": "Primary SDK for using XYO Protocol 2.0",
27
27
  "docs": "dist/docs.json",
28
- "types": "dist/index.d.ts",
28
+ "types": "dist/node/index.d.ts",
29
29
  "exports": {
30
30
  ".": {
31
- "require": {
32
- "types": "./dist/index.d.ts",
33
- "default": "./dist/index.js"
31
+ "browser": {
32
+ "require": {
33
+ "types": "./dist/browser/index.d.cts",
34
+ "default": "./dist/browser/index.cjs"
35
+ },
36
+ "import": {
37
+ "types": "./dist/browser/index.d.mts",
38
+ "default": "./dist/browser/index.js"
39
+ }
34
40
  },
35
- "import": {
36
- "types": "./dist/index.d.mts",
37
- "default": "./dist/index.mjs"
41
+ "node": {
42
+ "require": {
43
+ "types": "./dist/node/index.d.ts",
44
+ "default": "./dist/node/index.js"
45
+ },
46
+ "import": {
47
+ "types": "./dist/node/index.d.mts",
48
+ "default": "./dist/node/index.mjs"
49
+ }
38
50
  }
39
51
  },
40
- "./dist/docs.json": {
41
- "default": "./dist/docs.json"
42
- },
43
- "./cjs": {
44
- "default": "./dist/index.js"
45
- },
46
52
  "./docs": {
47
53
  "default": "./dist/docs.json"
48
54
  },
49
- "./esm": {
50
- "default": "./dist/index.mjs"
51
- },
52
55
  "./package.json": "./package.json"
53
56
  },
54
- "main": "dist/index.js",
55
- "module": "dist/index.mjs",
57
+ "main": "dist/node/index.js",
58
+ "module": "dist/node/index.mjs",
56
59
  "homepage": "https://xyo.network",
57
60
  "license": "LGPL-3.0",
58
61
  "publishConfig": {
@@ -63,5 +66,5 @@
63
66
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-client-js.git"
64
67
  },
65
68
  "sideEffects": false,
66
- "version": "2.74.5"
69
+ "version": "2.75.2"
67
70
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,MAAM,MAAM,kCAAkC,GAAG,qCAAqC,CAAA;AACtF,eAAO,MAAM,kCAAkC,EAAE,kCAA0E,CAAA;AAE3H,MAAM,MAAM,4BAA4B,GAAG,aAAa,CAAC;IACvD,MAAM,EAAE,kCAAkC,CAAA;CAC3C,CAAC,CAAA;AAEF,MAAM,MAAM,4BAA4B,GAAG,YAAY,CAAC,eAAe,CAAC,4BAA4B,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,MAAM,MAAM,kCAAkC,GAAG,qCAAqC,CAAA;AACtF,eAAO,MAAM,kCAAkC,EAAE,kCAA0E,CAAA;AAE3H,MAAM,MAAM,4BAA4B,GAAG,aAAa,CAAC;IACvD,MAAM,EAAE,kCAAkC,CAAA;CAC3C,CAAC,CAAA;AAEF,MAAM,MAAM,4BAA4B,GAAG,YAAY,CAAC,eAAe,CAAC,4BAA4B,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CurrentLocationPayloadSet.d.ts","sourceRoot":"","sources":["../src/CurrentLocationPayloadSet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAoB,MAAM,4BAA4B,CAAA;AAEhF,eAAO,MAAM,yBAAyB,EAAE,iBAQvC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CurrentLocationPayloadSet.d.ts","sourceRoot":"","sources":["../src/CurrentLocationPayloadSet.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAoB,MAAM,4BAA4B,CAAA;AAEhF,eAAO,MAAM,yBAAyB,EAAE,iBAQvC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CurrentLocationWitness.d.ts","sourceRoot":"","sources":["../src/CurrentLocationWitness.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAsC,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAE3F,qBAAa,sBAAsB,CAAC,OAAO,SAAS,4BAA4B,GAAG,4BAA4B,CAAE,SAAQ,eAAe,CAAC,OAAO,CAAC;IAC/I,OAAgB,aAAa,0CAAuC;IAEpE,IAAI,WAAW,IAAI,WAAW,CAE7B;IAED,kBAAkB;cAaO,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;CAoB9D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"CurrentLocationWitness.d.ts","sourceRoot":"","sources":["../src/CurrentLocationWitness.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAA;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAsC,4BAA4B,EAAE,MAAM,UAAU,CAAA;AAE3F,qBAAa,sBAAsB,CAAC,OAAO,SAAS,4BAA4B,GAAG,4BAA4B,CAAE,SAAQ,eAAe,CAAC,OAAO,CAAC;IAC/I,OAAgB,aAAa,0CAAuC;IAEpE,IAAI,WAAW,IAAI,WAAW,CAE7B;IAED,kBAAkB;cAaO,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;CAoB9D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAEjE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQxB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAEjE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAQxB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC,cAAc,UAAU,CAAA;AACxB,cAAc,6BAA6B,CAAA;AAC3C,cAAc,0BAA0B,CAAA;AAExC,OAAO,EAAE,cAAc,EAAE,CAAA;AAGzB,eAAe,cAAc,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC,cAAc,UAAU,CAAA;AACxB,cAAc,6BAA6B,CAAA;AAC3C,cAAc,0BAA0B,CAAA;AAExC,OAAO,EAAE,cAAc,EAAE,CAAA;AAGzB,eAAe,cAAc,CAAA"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts","../src/Plugin.ts","../src/CurrentLocationWitness.ts","../src/Config.ts","../src/CurrentLocationPayloadSet.ts"],"sourcesContent":["import { LocationPlugin } from './Plugin'\n\nexport * from './Config'\nexport * from './CurrentLocationPayloadSet'\nexport * from './CurrentLocationWitness'\n\nexport { LocationPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default LocationPlugin\n","import { LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { CurrentLocationWitness } from './CurrentLocationWitness'\n\nexport const LocationPlugin = () =>\n createPayloadSetWitnessPlugin<CurrentLocationWitness>(\n { required: { [LocationSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await CurrentLocationWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { LocationHeadingPayload, LocationHeadingSchema, LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\nimport { AbstractWitness } from '@xyo-network/witness'\n\nimport { CurrentLocationWitnessConfigSchema, CurrentLocationWitnessParams } from './Config'\n\nexport class CurrentLocationWitness<TParams extends CurrentLocationWitnessParams = CurrentLocationWitnessParams> extends AbstractWitness<TParams> {\n static override configSchemas = [CurrentLocationWitnessConfigSchema]\n\n get geolocation(): Geolocation {\n return assertEx(this.params.geolocation, 'No geolocation provided')\n }\n\n getCurrentPosition() {\n return new Promise<GeolocationPosition>((resolve, reject) => {\n this.geolocation?.getCurrentPosition(\n (position: GeolocationPosition) => {\n resolve(position)\n },\n (error: GeolocationPositionError) => {\n reject(error)\n },\n )\n })\n }\n\n protected override async observeHandler(): Promise<Payload[]> {\n const location = await this.getCurrentPosition()\n const locationPayload: LocationPayload = {\n altitude: location.coords.altitude ?? undefined,\n altitudeAccuracy: location.coords.altitudeAccuracy ?? undefined,\n latitude: location.coords.latitude,\n longitude: location.coords.longitude,\n schema: LocationSchema,\n }\n const heading: LocationHeadingPayload[] = location.coords.heading\n ? [\n {\n heading: location.coords.heading ?? undefined,\n schema: LocationHeadingSchema,\n speed: location.coords.speed ?? undefined,\n },\n ]\n : []\n return [locationPayload, ...heading]\n }\n}\n","import { AnyConfigSchema, ModuleParams } from '@xyo-network/module'\nimport { WitnessConfig } from '@xyo-network/witness'\n\nexport type CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config'\nexport const CurrentLocationWitnessConfigSchema: CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config'\n\nexport type CurrentLocationWitnessConfig = WitnessConfig<{\n schema: CurrentLocationWitnessConfigSchema\n}>\n\nexport type CurrentLocationWitnessParams = ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>, { geolocation?: Geolocation }>\n","import { LocationHeadingSchema, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { PayloadSetPayload, PayloadSetSchema } from '@xyo-network/payload-model'\n\nexport const CurrentLocationPayloadSet: PayloadSetPayload = {\n optional: {\n [LocationHeadingSchema]: 1,\n },\n required: {\n [LocationSchema]: 1,\n },\n schema: PayloadSetSchema,\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;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A,IACnD;AAAA,EACF;AACF;;;AGdF,IAAAC,kCAAsD;AACtD,IAAAC,wBAAoD;AAE7C,IAAM,4BAA+C;AAAA,EAC1D,UAAU;AAAA,IACR,CAAC,qDAAqB,GAAG;AAAA,EAC3B;AAAA,EACA,UAAU;AAAA,IACR,CAAC,8CAAc,GAAG;AAAA,EACpB;AAAA,EACA,QAAQ;AACV;;;AJFA,IAAO,cAAQ;","names":["import_location_payload_plugin","import_location_payload_plugin","import_payload_model"]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/Plugin.ts","../src/CurrentLocationWitness.ts","../src/Config.ts","../src/CurrentLocationPayloadSet.ts","../src/index.ts"],"sourcesContent":["import { LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\nimport { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'\n\nimport { CurrentLocationWitness } from './CurrentLocationWitness'\n\nexport const LocationPlugin = () =>\n createPayloadSetWitnessPlugin<CurrentLocationWitness>(\n { required: { [LocationSchema]: 1 }, schema: PayloadSetSchema },\n {\n witness: async (params) => {\n return await CurrentLocationWitness.create(params)\n },\n },\n )\n","import { assertEx } from '@xylabs/assert'\nimport { LocationHeadingPayload, LocationHeadingSchema, LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { Payload } from '@xyo-network/payload-model'\nimport { AbstractWitness } from '@xyo-network/witness'\n\nimport { CurrentLocationWitnessConfigSchema, CurrentLocationWitnessParams } from './Config'\n\nexport class CurrentLocationWitness<TParams extends CurrentLocationWitnessParams = CurrentLocationWitnessParams> extends AbstractWitness<TParams> {\n static override configSchemas = [CurrentLocationWitnessConfigSchema]\n\n get geolocation(): Geolocation {\n return assertEx(this.params.geolocation, 'No geolocation provided')\n }\n\n getCurrentPosition() {\n return new Promise<GeolocationPosition>((resolve, reject) => {\n this.geolocation?.getCurrentPosition(\n (position: GeolocationPosition) => {\n resolve(position)\n },\n (error: GeolocationPositionError) => {\n reject(error)\n },\n )\n })\n }\n\n protected override async observeHandler(): Promise<Payload[]> {\n const location = await this.getCurrentPosition()\n const locationPayload: LocationPayload = {\n altitude: location.coords.altitude ?? undefined,\n altitudeAccuracy: location.coords.altitudeAccuracy ?? undefined,\n latitude: location.coords.latitude,\n longitude: location.coords.longitude,\n schema: LocationSchema,\n }\n const heading: LocationHeadingPayload[] = location.coords.heading\n ? [\n {\n heading: location.coords.heading ?? undefined,\n schema: LocationHeadingSchema,\n speed: location.coords.speed ?? undefined,\n },\n ]\n : []\n return [locationPayload, ...heading]\n }\n}\n","import { AnyConfigSchema, ModuleParams } from '@xyo-network/module'\nimport { WitnessConfig } from '@xyo-network/witness'\n\nexport type CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config'\nexport const CurrentLocationWitnessConfigSchema: CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config'\n\nexport type CurrentLocationWitnessConfig = WitnessConfig<{\n schema: CurrentLocationWitnessConfigSchema\n}>\n\nexport type CurrentLocationWitnessParams = ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>, { geolocation?: Geolocation }>\n","import { LocationHeadingSchema, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { PayloadSetPayload, PayloadSetSchema } from '@xyo-network/payload-model'\n\nexport const CurrentLocationPayloadSet: PayloadSetPayload = {\n optional: {\n [LocationHeadingSchema]: 1,\n },\n required: {\n [LocationSchema]: 1,\n },\n schema: PayloadSetSchema,\n}\n","import { LocationPlugin } from './Plugin'\n\nexport * from './Config'\nexport * from './CurrentLocationPayloadSet'\nexport * from './CurrentLocationWitness'\n\nexport { LocationPlugin }\n\n// eslint-disable-next-line import/no-default-export\nexport default LocationPlugin\n"],"mappings":";AAAA,SAAS,kBAAAA,uBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,qCAAqC;;;ACF9C,SAAS,gBAAgB;AACzB,SAAiC,uBAAwC,sBAAsB;AAE/F,SAAS,uBAAuB;;;ACCzB,IAAM,qCAAyE;;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sBAAqB,GAAG;AAAA,EAC3B;AAAA,EACA,UAAU;AAAA,IACR,CAACC,eAAc,GAAG;AAAA,EACpB;AAAA,EACA,QAAQC;AACV;;;ACFA,IAAO,cAAQ;","names":["LocationSchema","LocationSchema","LocationHeadingSchema","LocationSchema","PayloadSetSchema"]}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes