@xyo-network/location-plugin 2.99.5 → 3.0.0

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 (105) hide show
  1. package/dist/neutral/index.d.ts +50 -5
  2. package/dist/neutral/index.mjs +18 -29
  3. package/dist/neutral/index.mjs.map +1 -1
  4. package/package.json +15 -34
  5. package/src/index.ts +1 -1
  6. package/xy.config.ts +4 -5
  7. package/dist/browser/Config.d.cts +0 -11
  8. package/dist/browser/Config.d.cts.map +0 -1
  9. package/dist/browser/Config.d.mts +0 -11
  10. package/dist/browser/Config.d.mts.map +0 -1
  11. package/dist/browser/Config.d.ts +0 -11
  12. package/dist/browser/Config.d.ts.map +0 -1
  13. package/dist/browser/CurrentLocationPayloadSet.d.cts +0 -3
  14. package/dist/browser/CurrentLocationPayloadSet.d.cts.map +0 -1
  15. package/dist/browser/CurrentLocationPayloadSet.d.mts +0 -3
  16. package/dist/browser/CurrentLocationPayloadSet.d.mts.map +0 -1
  17. package/dist/browser/CurrentLocationPayloadSet.d.ts +0 -3
  18. package/dist/browser/CurrentLocationPayloadSet.d.ts.map +0 -1
  19. package/dist/browser/CurrentLocationWitness.d.cts +0 -11
  20. package/dist/browser/CurrentLocationWitness.d.cts.map +0 -1
  21. package/dist/browser/CurrentLocationWitness.d.mts +0 -11
  22. package/dist/browser/CurrentLocationWitness.d.mts.map +0 -1
  23. package/dist/browser/CurrentLocationWitness.d.ts +0 -11
  24. package/dist/browser/CurrentLocationWitness.d.ts.map +0 -1
  25. package/dist/browser/Plugin.d.cts +0 -21
  26. package/dist/browser/Plugin.d.cts.map +0 -1
  27. package/dist/browser/Plugin.d.mts +0 -21
  28. package/dist/browser/Plugin.d.mts.map +0 -1
  29. package/dist/browser/Plugin.d.ts +0 -21
  30. package/dist/browser/Plugin.d.ts.map +0 -1
  31. package/dist/browser/index.cjs +0 -110
  32. package/dist/browser/index.cjs.map +0 -1
  33. package/dist/browser/index.d.cts +0 -5
  34. package/dist/browser/index.d.cts.map +0 -1
  35. package/dist/browser/index.d.mts +0 -5
  36. package/dist/browser/index.d.mts.map +0 -1
  37. package/dist/browser/index.d.ts +0 -5
  38. package/dist/browser/index.d.ts.map +0 -1
  39. package/dist/browser/index.mjs +0 -89
  40. package/dist/browser/index.mjs.map +0 -1
  41. package/dist/neutral/Config.d.cts +0 -11
  42. package/dist/neutral/Config.d.cts.map +0 -1
  43. package/dist/neutral/Config.d.mts +0 -11
  44. package/dist/neutral/Config.d.mts.map +0 -1
  45. package/dist/neutral/Config.d.ts +0 -11
  46. package/dist/neutral/Config.d.ts.map +0 -1
  47. package/dist/neutral/CurrentLocationPayloadSet.d.cts +0 -3
  48. package/dist/neutral/CurrentLocationPayloadSet.d.cts.map +0 -1
  49. package/dist/neutral/CurrentLocationPayloadSet.d.mts +0 -3
  50. package/dist/neutral/CurrentLocationPayloadSet.d.mts.map +0 -1
  51. package/dist/neutral/CurrentLocationPayloadSet.d.ts +0 -3
  52. package/dist/neutral/CurrentLocationPayloadSet.d.ts.map +0 -1
  53. package/dist/neutral/CurrentLocationWitness.d.cts +0 -11
  54. package/dist/neutral/CurrentLocationWitness.d.cts.map +0 -1
  55. package/dist/neutral/CurrentLocationWitness.d.mts +0 -11
  56. package/dist/neutral/CurrentLocationWitness.d.mts.map +0 -1
  57. package/dist/neutral/CurrentLocationWitness.d.ts +0 -11
  58. package/dist/neutral/CurrentLocationWitness.d.ts.map +0 -1
  59. package/dist/neutral/Plugin.d.cts +0 -21
  60. package/dist/neutral/Plugin.d.cts.map +0 -1
  61. package/dist/neutral/Plugin.d.mts +0 -21
  62. package/dist/neutral/Plugin.d.mts.map +0 -1
  63. package/dist/neutral/Plugin.d.ts +0 -21
  64. package/dist/neutral/Plugin.d.ts.map +0 -1
  65. package/dist/neutral/index.cjs +0 -110
  66. package/dist/neutral/index.cjs.map +0 -1
  67. package/dist/neutral/index.d.cts +0 -5
  68. package/dist/neutral/index.d.cts.map +0 -1
  69. package/dist/neutral/index.d.mts +0 -5
  70. package/dist/neutral/index.d.mts.map +0 -1
  71. package/dist/neutral/index.d.ts.map +0 -1
  72. package/dist/node/Config.d.cts +0 -11
  73. package/dist/node/Config.d.cts.map +0 -1
  74. package/dist/node/Config.d.mts +0 -11
  75. package/dist/node/Config.d.mts.map +0 -1
  76. package/dist/node/Config.d.ts +0 -11
  77. package/dist/node/Config.d.ts.map +0 -1
  78. package/dist/node/CurrentLocationPayloadSet.d.cts +0 -3
  79. package/dist/node/CurrentLocationPayloadSet.d.cts.map +0 -1
  80. package/dist/node/CurrentLocationPayloadSet.d.mts +0 -3
  81. package/dist/node/CurrentLocationPayloadSet.d.mts.map +0 -1
  82. package/dist/node/CurrentLocationPayloadSet.d.ts +0 -3
  83. package/dist/node/CurrentLocationPayloadSet.d.ts.map +0 -1
  84. package/dist/node/CurrentLocationWitness.d.cts +0 -11
  85. package/dist/node/CurrentLocationWitness.d.cts.map +0 -1
  86. package/dist/node/CurrentLocationWitness.d.mts +0 -11
  87. package/dist/node/CurrentLocationWitness.d.mts.map +0 -1
  88. package/dist/node/CurrentLocationWitness.d.ts +0 -11
  89. package/dist/node/CurrentLocationWitness.d.ts.map +0 -1
  90. package/dist/node/Plugin.d.cts +0 -21
  91. package/dist/node/Plugin.d.cts.map +0 -1
  92. package/dist/node/Plugin.d.mts +0 -21
  93. package/dist/node/Plugin.d.mts.map +0 -1
  94. package/dist/node/Plugin.d.ts +0 -21
  95. package/dist/node/Plugin.d.ts.map +0 -1
  96. package/dist/node/index.cjs +0 -122
  97. package/dist/node/index.cjs.map +0 -1
  98. package/dist/node/index.d.cts +0 -5
  99. package/dist/node/index.d.cts.map +0 -1
  100. package/dist/node/index.d.mts +0 -5
  101. package/dist/node/index.d.mts.map +0 -1
  102. package/dist/node/index.d.ts +0 -5
  103. package/dist/node/index.d.ts.map +0 -1
  104. package/dist/node/index.mjs +0 -94
  105. package/dist/node/index.mjs.map +0 -1
@@ -1,5 +1,50 @@
1
- export * from './Config.ts';
2
- export * from './CurrentLocationPayloadSet.ts';
3
- export * from './CurrentLocationWitness.ts';
4
- export { LocationPlugin as default, LocationPlugin } from './Plugin.ts';
5
- //# sourceMappingURL=index.d.ts.map
1
+ import * as _xyo_network_module_model from '@xyo-network/module-model';
2
+ import { ModuleParams, AnyConfigSchema } from '@xyo-network/module-model';
3
+ import { WitnessConfig } from '@xyo-network/witness-model';
4
+ import * as _xyo_network_payload_model from '@xyo-network/payload-model';
5
+ import { PayloadSetPayload, Schema, Payload } from '@xyo-network/payload-model';
6
+ import { AbstractWitness } from '@xyo-network/abstract-witness';
7
+ import * as _xyo_network_payloadset_plugin from '@xyo-network/payloadset-plugin';
8
+ import * as _store__xyo_network_account_model_virtual_3afa553815_package from '.store/@xyo-network-account-model-virtual-3afa553815/package';
9
+ import * as _store__xylabs_object_npm_4_0_0_ffd6151301_package from '.store/@xylabs-object-npm-4.0.0-ffd6151301/package';
10
+
11
+ type CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config';
12
+ declare const CurrentLocationWitnessConfigSchema: CurrentLocationWitnessConfigSchema;
13
+ type CurrentLocationWitnessConfig = WitnessConfig<{
14
+ schema: CurrentLocationWitnessConfigSchema;
15
+ }>;
16
+ type CurrentLocationWitnessParams = ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>, {
17
+ geolocation?: Geolocation;
18
+ }>;
19
+
20
+ declare const CurrentLocationPayloadSet: PayloadSetPayload;
21
+
22
+ declare class CurrentLocationWitness<TParams extends CurrentLocationWitnessParams = CurrentLocationWitnessParams> extends AbstractWitness<TParams> {
23
+ static readonly configSchemas: Schema[];
24
+ static readonly defaultConfigSchema: Schema;
25
+ get geolocation(): Geolocation;
26
+ getCurrentPosition(): Promise<GeolocationPosition>;
27
+ protected observeHandler(): Promise<Payload[]>;
28
+ }
29
+
30
+ declare const LocationPlugin: () => _xyo_network_payloadset_plugin.PayloadSetWitnessPlugin<CurrentLocationWitness<_store__xylabs_object_npm_4_0_0_ffd6151301_package.BaseParamsFields & {
31
+ account?: _store__xyo_network_account_model_virtual_3afa553815_package.AccountInstance | "random";
32
+ addToResolvers?: boolean;
33
+ additionalSigners?: _store__xyo_network_account_model_virtual_3afa553815_package.AccountInstance[];
34
+ allowNameResolution?: boolean;
35
+ config: _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<_xyo_network_module_model.ArchivingModuleConfig & _xyo_network_module_model.ModuleConfigFields & _xyo_network_payload_model.SchemaFields & _xyo_network_payload_model.PayloadFields & Omit<_xyo_network_module_model.ArchivingModuleConfig & _xyo_network_module_model.ModuleConfigFields & {
36
+ schema: "network.xyo.location.current.config";
37
+ } & {
38
+ schema: CurrentLocationWitnessConfigSchema;
39
+ }, "schema"> & {
40
+ schema: "network.xyo.location.current.config";
41
+ }, "schema"> & {
42
+ schema: string;
43
+ };
44
+ ephemeralQueryAccountEnabled?: boolean;
45
+ moduleIdentifierTransformers?: _xyo_network_module_model.ModuleIdentifierTransformer[];
46
+ } & {
47
+ geolocation?: Geolocation;
48
+ }>>;
49
+
50
+ export { CurrentLocationPayloadSet, CurrentLocationWitness, type CurrentLocationWitnessConfig, CurrentLocationWitnessConfigSchema, type CurrentLocationWitnessParams, LocationPlugin, LocationPlugin as default };
@@ -1,6 +1,3 @@
1
- var __defProp = Object.defineProperty;
2
- var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
3
-
4
1
  // src/Config.ts
5
2
  var CurrentLocationWitnessConfigSchema = "network.xyo.location.current.config";
6
3
 
@@ -22,24 +19,21 @@ import { assertEx } from "@xylabs/assert";
22
19
  import { AbstractWitness } from "@xyo-network/abstract-witness";
23
20
  import { LocationHeadingSchema as LocationHeadingSchema2, LocationSchema as LocationSchema2 } from "@xyo-network/location-payload-plugin";
24
21
  var CurrentLocationWitness = class extends AbstractWitness {
25
- static {
26
- __name(this, "CurrentLocationWitness");
27
- }
28
- static configSchemas = [
29
- ...super.configSchemas,
30
- CurrentLocationWitnessConfigSchema
31
- ];
22
+ static configSchemas = [...super.configSchemas, CurrentLocationWitnessConfigSchema];
32
23
  static defaultConfigSchema = CurrentLocationWitnessConfigSchema;
33
24
  get geolocation() {
34
25
  return assertEx(this.params.geolocation, () => "No geolocation provided");
35
26
  }
36
27
  getCurrentPosition() {
37
28
  return new Promise((resolve, reject) => {
38
- this.geolocation?.getCurrentPosition((position) => {
39
- resolve(position);
40
- }, (error) => {
41
- reject(error);
42
- });
29
+ this.geolocation?.getCurrentPosition(
30
+ (position) => {
31
+ resolve(position);
32
+ },
33
+ (error) => {
34
+ reject(error);
35
+ }
36
+ );
43
37
  });
44
38
  }
45
39
  async observeHandler() {
@@ -58,10 +52,7 @@ var CurrentLocationWitness = class extends AbstractWitness {
58
52
  speed: location.coords.speed ?? void 0
59
53
  }
60
54
  ] : [];
61
- return [
62
- locationPayload,
63
- ...heading
64
- ];
55
+ return [locationPayload, ...heading];
65
56
  }
66
57
  };
67
58
 
@@ -69,16 +60,14 @@ var CurrentLocationWitness = class extends AbstractWitness {
69
60
  import { LocationSchema as LocationSchema3 } from "@xyo-network/location-payload-plugin";
70
61
  import { PayloadSetSchema as PayloadSetSchema2 } from "@xyo-network/payload-model";
71
62
  import { createPayloadSetWitnessPlugin } from "@xyo-network/payloadset-plugin";
72
- var LocationPlugin = /* @__PURE__ */ __name(() => createPayloadSetWitnessPlugin({
73
- required: {
74
- [LocationSchema3]: 1
75
- },
76
- schema: PayloadSetSchema2
77
- }, {
78
- witness: /* @__PURE__ */ __name(async (params) => {
79
- return await CurrentLocationWitness.create(params);
80
- }, "witness")
81
- }), "LocationPlugin");
63
+ var LocationPlugin = () => createPayloadSetWitnessPlugin(
64
+ { required: { [LocationSchema3]: 1 }, schema: PayloadSetSchema2 },
65
+ {
66
+ witness: async (params) => {
67
+ return await CurrentLocationWitness.create(params);
68
+ }
69
+ }
70
+ );
82
71
  export {
83
72
  CurrentLocationPayloadSet,
84
73
  CurrentLocationWitness,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Config.ts","../../src/CurrentLocationPayloadSet.ts","../../src/CurrentLocationWitness.ts","../../src/Plugin.ts"],"sourcesContent":["import { AnyConfigSchema, ModuleParams } from '@xyo-network/module-model'\nimport { WitnessConfig } from '@xyo-network/witness-model'\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 { assertEx } from '@xylabs/assert'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport { LocationHeadingPayload, LocationHeadingSchema, LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { Payload, Schema } from '@xyo-network/payload-model'\n\nimport { CurrentLocationWitnessConfigSchema, CurrentLocationWitnessParams } from './Config.ts'\n\nexport class CurrentLocationWitness<TParams extends CurrentLocationWitnessParams = CurrentLocationWitnessParams> extends AbstractWitness<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, CurrentLocationWitnessConfigSchema]\n static override readonly defaultConfigSchema: Schema = 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[]\n = 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 { 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.ts'\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"],"mappings":";;;;AAIO,IAAMA,qCAAyE;;;ACJtF,SAASC,uBAAuBC,sBAAsB;AACtD,SAA4BC,wBAAwB;AAE7C,IAAMC,4BAA+C;EAC1DC,UAAU;IACR,CAACJ,qBAAAA,GAAwB;EAC3B;EACAK,UAAU;IACR,CAACJ,cAAAA,GAAiB;EACpB;EACAK,QAAQJ;AACV;;;ACXA,SAASK,gBAAgB;AACzB,SAASC,uBAAuB;AAChC,SAAiCC,yBAAAA,wBAAwCC,kBAAAA,uBAAsB;AAKxF,IAAMC,yBAAN,cAAkHC,gBAAAA;EAPzH,OAOyHA;;;EACvH,OAAyBC,gBAA0B;OAAI,MAAMA;IAAeC;;EAC5E,OAAyBC,sBAA8BD;EAEvD,IAAIE,cAA2B;AAC7B,WAAOC,SAAS,KAAKC,OAAOF,aAAa,MAAM,yBAAA;EACjD;EAEAG,qBAAqB;AACnB,WAAO,IAAIC,QAA6B,CAACC,SAASC,WAAAA;AAChD,WAAKN,aAAaG,mBAChB,CAACI,aAAAA;AACCF,gBAAQE,QAAAA;MACV,GACA,CAACC,UAAAA;AACCF,eAAOE,KAAAA;MACT,CAAA;IAEJ,CAAA;EACF;EAEA,MAAyBC,iBAAqC;AAC5D,UAAMC,WAAW,MAAM,KAAKP,mBAAkB;AAC9C,UAAMQ,kBAAmC;MACvCC,UAAUF,SAASG,OAAOD,YAAYE;MACtCC,kBAAkBL,SAASG,OAAOE,oBAAoBD;MACtDE,UAAUN,SAASG,OAAOG;MAC1BC,WAAWP,SAASG,OAAOI;MAC3BC,QAAQC;IACV;AACA,UAAMC,UACFV,SAASG,OAAOO,UACd;MACE;QACEA,SAASV,SAASG,OAAOO,WAAWN;QACpCI,QAAQG;QACRC,OAAOZ,SAASG,OAAOS,SAASR;MAClC;QAEF,CAAA;AACN,WAAO;MAACH;SAAoBS;;EAC9B;AACF;;;ACjDA,SAASG,kBAAAA,uBAAsB;AAC/B,SAASC,oBAAAA,yBAAwB;AACjC,SAASC,qCAAqC;AAIvC,IAAMC,iBAAiB,6BAC5BC,8BACE;EAAEC,UAAU;IAAE,CAACC,eAAAA,GAAiB;EAAE;EAAGC,QAAQC;AAAiB,GAC9D;EACEC,SAAS,8BAAOC,WAAAA;AACd,WAAO,MAAMC,uBAAuBC,OAAOF,MAAAA;EAC7C,GAFS;AAGX,CAAA,GAP0B;","names":["CurrentLocationWitnessConfigSchema","LocationHeadingSchema","LocationSchema","PayloadSetSchema","CurrentLocationPayloadSet","optional","required","schema","assertEx","AbstractWitness","LocationHeadingSchema","LocationSchema","CurrentLocationWitness","AbstractWitness","configSchemas","CurrentLocationWitnessConfigSchema","defaultConfigSchema","geolocation","assertEx","params","getCurrentPosition","Promise","resolve","reject","position","error","observeHandler","location","locationPayload","altitude","coords","undefined","altitudeAccuracy","latitude","longitude","schema","LocationSchema","heading","LocationHeadingSchema","speed","LocationSchema","PayloadSetSchema","createPayloadSetWitnessPlugin","LocationPlugin","createPayloadSetWitnessPlugin","required","LocationSchema","schema","PayloadSetSchema","witness","params","CurrentLocationWitness","create"]}
1
+ {"version":3,"sources":["../../src/Config.ts","../../src/CurrentLocationPayloadSet.ts","../../src/CurrentLocationWitness.ts","../../src/Plugin.ts"],"sourcesContent":["import { AnyConfigSchema, ModuleParams } from '@xyo-network/module-model'\nimport { WitnessConfig } from '@xyo-network/witness-model'\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 { assertEx } from '@xylabs/assert'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport { LocationHeadingPayload, LocationHeadingSchema, LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { Payload, Schema } from '@xyo-network/payload-model'\n\nimport { CurrentLocationWitnessConfigSchema, CurrentLocationWitnessParams } from './Config.ts'\n\nexport class CurrentLocationWitness<TParams extends CurrentLocationWitnessParams = CurrentLocationWitnessParams> extends AbstractWitness<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, CurrentLocationWitnessConfigSchema]\n static override readonly defaultConfigSchema: Schema = 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[]\n = 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 { 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.ts'\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"],"mappings":";AAIO,IAAM,qCAAyE;;;ACJtF,SAAS,uBAAuB,sBAAsB;AACtD,SAA4B,wBAAwB;AAE7C,IAAM,4BAA+C;AAAA,EAC1D,UAAU;AAAA,IACR,CAAC,qBAAqB,GAAG;AAAA,EAC3B;AAAA,EACA,UAAU;AAAA,IACR,CAAC,cAAc,GAAG;AAAA,EACpB;AAAA,EACA,QAAQ;AACV;;;ACXA,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC,SAAiC,yBAAAA,wBAAwC,kBAAAC,uBAAsB;AAKxF,IAAM,yBAAN,cAAkH,gBAAyB;AAAA,EAChJ,OAAyB,gBAA0B,CAAC,GAAG,MAAM,eAAe,kCAAkC;AAAA,EAC9G,OAAyB,sBAA8B;AAAA,EAEvD,IAAI,cAA2B;AAC7B,WAAO,SAAS,KAAK,OAAO,aAAa,MAAM,yBAAyB;AAAA,EAC1E;AAAA,EAEA,qBAAqB;AACnB,WAAO,IAAI,QAA6B,CAAC,SAAS,WAAW;AAC3D,WAAK,aAAa;AAAA,QAChB,CAAC,aAAkC;AACjC,kBAAQ,QAAQ;AAAA,QAClB;AAAA,QACA,CAAC,UAAoC;AACnC,iBAAO,KAAK;AAAA,QACd;AAAA,MACF;AAAA,IACF,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,QAAQC;AAAA,IACV;AACA,UAAM,UACF,SAAS,OAAO,UACd;AAAA,MACE;AAAA,QACE,SAAS,SAAS,OAAO,WAAW;AAAA,QACpC,QAAQC;AAAA,QACR,OAAO,SAAS,OAAO,SAAS;AAAA,MAClC;AAAA,IACF,IACA,CAAC;AACP,WAAO,CAAC,iBAAiB,GAAG,OAAO;AAAA,EACrC;AACF;;;ACjDA,SAAS,kBAAAC,uBAAsB;AAC/B,SAAS,oBAAAC,yBAAwB;AACjC,SAAS,qCAAqC;AAIvC,IAAM,iBAAiB,MAC5B;AAAA,EACE,EAAE,UAAU,EAAE,CAACC,eAAc,GAAG,EAAE,GAAG,QAAQC,kBAAiB;AAAA,EAC9D;AAAA,IACE,SAAS,OAAO,WAAW;AACzB,aAAO,MAAM,uBAAuB,OAAO,MAAM;AAAA,IACnD;AAAA,EACF;AACF;","names":["LocationHeadingSchema","LocationSchema","LocationSchema","LocationHeadingSchema","LocationSchema","PayloadSetSchema","LocationSchema","PayloadSetSchema"]}
package/package.json CHANGED
@@ -10,49 +10,30 @@
10
10
  "url": "https://github.com/XYOracleNetwork/plugins/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/assert": "^3.6.8",
14
- "@xyo-network/abstract-witness": "^2.111.2",
15
- "@xyo-network/location-payload-plugin": "^2.99.5",
16
- "@xyo-network/module-model": "^2.111.2",
17
- "@xyo-network/payload-model": "^2.111.2",
18
- "@xyo-network/payloadset-plugin": "^2.111.2",
19
- "@xyo-network/witness-model": "^2.111.2"
13
+ "@xylabs/assert": "^4.0.0",
14
+ "@xyo-network/abstract-witness": "^3.0.1",
15
+ "@xyo-network/location-payload-plugin": "^3.0.0",
16
+ "@xyo-network/module-model": "^3.0.1",
17
+ "@xyo-network/payload-model": "^3.0.1",
18
+ "@xyo-network/payloadset-plugin": "^3.0.1",
19
+ "@xyo-network/witness-model": "^3.0.1"
20
20
  },
21
21
  "devDependencies": {
22
- "@xylabs/ts-scripts-yarn3": "^3.15.13",
23
- "@xylabs/tsconfig-dom": "^3.15.13",
24
- "@xylabs/tsconfig-dom-jest": "^3.15.13",
22
+ "@xylabs/ts-scripts-yarn3": "^4.0.0-rc.15",
23
+ "@xylabs/tsconfig-dom": "^4.0.0-rc.15",
24
+ "@xylabs/tsconfig-dom-jest": "^4.0.0-rc.15",
25
25
  "typescript": "^5.5.4"
26
26
  },
27
27
  "description": "Typescript/Javascript Plugins for XYO Platform",
28
- "types": "dist/node/index.d.ts",
28
+ "types": "dist/neutral/index.d.ts",
29
29
  "exports": {
30
30
  ".": {
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.mjs"
39
- }
40
- },
41
- "node": {
42
- "require": {
43
- "types": "./dist/node/index.d.cts",
44
- "default": "./dist/node/index.cjs"
45
- },
46
- "import": {
47
- "types": "./dist/node/index.d.mts",
48
- "default": "./dist/node/index.mjs"
49
- }
50
- }
31
+ "types": "./dist/neutral/index.d.ts",
32
+ "default": "./dist/neutral/index.mjs"
51
33
  },
52
34
  "./package.json": "./package.json"
53
35
  },
54
- "main": "dist/node/index.cjs",
55
- "module": "dist/node/index.mjs",
36
+ "module": "dist/neutral/index.mjs",
56
37
  "homepage": "https://xyo.network",
57
38
  "license": "LGPL-3.0-only",
58
39
  "publishConfig": {
@@ -63,6 +44,6 @@
63
44
  "url": "https://github.com/XYOracleNetwork/plugins.git"
64
45
  },
65
46
  "sideEffects": false,
66
- "version": "2.99.5",
47
+ "version": "3.0.0",
67
48
  "type": "module"
68
49
  }
package/src/index.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from './Config.ts'
2
2
  export * from './CurrentLocationPayloadSet.ts'
3
3
  export * from './CurrentLocationWitness.ts'
4
- // eslint-disable-next-line import/no-default-export
4
+ // eslint-disable-next-line import-x/no-default-export
5
5
  export { LocationPlugin as default, LocationPlugin } from './Plugin.ts'
package/xy.config.ts CHANGED
@@ -1,14 +1,13 @@
1
1
  import { XyTsupConfig } from '@xylabs/ts-scripts-yarn3'
2
2
  const config: XyTsupConfig = {
3
3
  compile: {
4
- browser: {
5
- src: true,
6
- },
7
- node: {
4
+ browser: {},
5
+ node: {},
6
+ neutral: {
8
7
  src: true,
9
8
  },
10
9
  },
11
10
  }
12
11
 
13
- // eslint-disable-next-line import/no-default-export
12
+ // eslint-disable-next-line import-x/no-default-export
14
13
  export default config
@@ -1,11 +0,0 @@
1
- import { AnyConfigSchema, ModuleParams } from '@xyo-network/module-model';
2
- import { WitnessConfig } from '@xyo-network/witness-model';
3
- export type CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config';
4
- export declare const CurrentLocationWitnessConfigSchema: CurrentLocationWitnessConfigSchema;
5
- export type CurrentLocationWitnessConfig = WitnessConfig<{
6
- schema: CurrentLocationWitnessConfigSchema;
7
- }>;
8
- export type CurrentLocationWitnessParams = ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>, {
9
- geolocation?: Geolocation;
10
- }>;
11
- //# sourceMappingURL=Config.d.ts.map
@@ -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,2BAA2B,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE1D,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,11 +0,0 @@
1
- import { AnyConfigSchema, ModuleParams } from '@xyo-network/module-model';
2
- import { WitnessConfig } from '@xyo-network/witness-model';
3
- export type CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config';
4
- export declare const CurrentLocationWitnessConfigSchema: CurrentLocationWitnessConfigSchema;
5
- export type CurrentLocationWitnessConfig = WitnessConfig<{
6
- schema: CurrentLocationWitnessConfigSchema;
7
- }>;
8
- export type CurrentLocationWitnessParams = ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>, {
9
- geolocation?: Geolocation;
10
- }>;
11
- //# sourceMappingURL=Config.d.ts.map
@@ -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,2BAA2B,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE1D,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,11 +0,0 @@
1
- import { AnyConfigSchema, ModuleParams } from '@xyo-network/module-model';
2
- import { WitnessConfig } from '@xyo-network/witness-model';
3
- export type CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config';
4
- export declare const CurrentLocationWitnessConfigSchema: CurrentLocationWitnessConfigSchema;
5
- export type CurrentLocationWitnessConfig = WitnessConfig<{
6
- schema: CurrentLocationWitnessConfigSchema;
7
- }>;
8
- export type CurrentLocationWitnessParams = ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>, {
9
- geolocation?: Geolocation;
10
- }>;
11
- //# sourceMappingURL=Config.d.ts.map
@@ -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,2BAA2B,CAAA;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE1D,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,3 +0,0 @@
1
- import { PayloadSetPayload } from '@xyo-network/payload-model';
2
- export declare const CurrentLocationPayloadSet: PayloadSetPayload;
3
- //# sourceMappingURL=CurrentLocationPayloadSet.d.ts.map
@@ -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,3 +0,0 @@
1
- import { PayloadSetPayload } from '@xyo-network/payload-model';
2
- export declare const CurrentLocationPayloadSet: PayloadSetPayload;
3
- //# sourceMappingURL=CurrentLocationPayloadSet.d.ts.map
@@ -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,3 +0,0 @@
1
- import { PayloadSetPayload } from '@xyo-network/payload-model';
2
- export declare const CurrentLocationPayloadSet: PayloadSetPayload;
3
- //# sourceMappingURL=CurrentLocationPayloadSet.d.ts.map
@@ -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,11 +0,0 @@
1
- import { AbstractWitness } from '@xyo-network/abstract-witness';
2
- import { Payload, Schema } from '@xyo-network/payload-model';
3
- import { CurrentLocationWitnessParams } from './Config.ts';
4
- export declare class CurrentLocationWitness<TParams extends CurrentLocationWitnessParams = CurrentLocationWitnessParams> extends AbstractWitness<TParams> {
5
- static readonly configSchemas: Schema[];
6
- static readonly defaultConfigSchema: Schema;
7
- get geolocation(): Geolocation;
8
- getCurrentPosition(): Promise<GeolocationPosition>;
9
- protected observeHandler(): Promise<Payload[]>;
10
- }
11
- //# sourceMappingURL=CurrentLocationWitness.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CurrentLocationWitness.d.ts","sourceRoot":"","sources":["../../src/CurrentLocationWitness.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAsC,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAE9F,qBAAa,sBAAsB,CAAC,OAAO,SAAS,4BAA4B,GAAG,4BAA4B,CAAE,SAAQ,eAAe,CAAC,OAAO,CAAC;IAC/I,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAA+D;IAC/G,gBAAyB,mBAAmB,EAAE,MAAM,CAAqC;IAEzF,IAAI,WAAW,IAAI,WAAW,CAE7B;IAED,kBAAkB;cAaO,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;CAqB9D"}
@@ -1,11 +0,0 @@
1
- import { AbstractWitness } from '@xyo-network/abstract-witness';
2
- import { Payload, Schema } from '@xyo-network/payload-model';
3
- import { CurrentLocationWitnessParams } from './Config.ts';
4
- export declare class CurrentLocationWitness<TParams extends CurrentLocationWitnessParams = CurrentLocationWitnessParams> extends AbstractWitness<TParams> {
5
- static readonly configSchemas: Schema[];
6
- static readonly defaultConfigSchema: Schema;
7
- get geolocation(): Geolocation;
8
- getCurrentPosition(): Promise<GeolocationPosition>;
9
- protected observeHandler(): Promise<Payload[]>;
10
- }
11
- //# sourceMappingURL=CurrentLocationWitness.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CurrentLocationWitness.d.ts","sourceRoot":"","sources":["../../src/CurrentLocationWitness.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAsC,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAE9F,qBAAa,sBAAsB,CAAC,OAAO,SAAS,4BAA4B,GAAG,4BAA4B,CAAE,SAAQ,eAAe,CAAC,OAAO,CAAC;IAC/I,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAA+D;IAC/G,gBAAyB,mBAAmB,EAAE,MAAM,CAAqC;IAEzF,IAAI,WAAW,IAAI,WAAW,CAE7B;IAED,kBAAkB;cAaO,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;CAqB9D"}
@@ -1,11 +0,0 @@
1
- import { AbstractWitness } from '@xyo-network/abstract-witness';
2
- import { Payload, Schema } from '@xyo-network/payload-model';
3
- import { CurrentLocationWitnessParams } from './Config.ts';
4
- export declare class CurrentLocationWitness<TParams extends CurrentLocationWitnessParams = CurrentLocationWitnessParams> extends AbstractWitness<TParams> {
5
- static readonly configSchemas: Schema[];
6
- static readonly defaultConfigSchema: Schema;
7
- get geolocation(): Geolocation;
8
- getCurrentPosition(): Promise<GeolocationPosition>;
9
- protected observeHandler(): Promise<Payload[]>;
10
- }
11
- //# sourceMappingURL=CurrentLocationWitness.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CurrentLocationWitness.d.ts","sourceRoot":"","sources":["../../src/CurrentLocationWitness.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAA;AAE/D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAA;AAE5D,OAAO,EAAsC,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAE9F,qBAAa,sBAAsB,CAAC,OAAO,SAAS,4BAA4B,GAAG,4BAA4B,CAAE,SAAQ,eAAe,CAAC,OAAO,CAAC;IAC/I,gBAAyB,aAAa,EAAE,MAAM,EAAE,CAA+D;IAC/G,gBAAyB,mBAAmB,EAAE,MAAM,CAAqC;IAEzF,IAAI,WAAW,IAAI,WAAW,CAE7B;IAED,kBAAkB;cAaO,cAAc,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;CAqB9D"}
@@ -1,21 +0,0 @@
1
- import { CurrentLocationWitness } from './CurrentLocationWitness.ts';
2
- export declare const LocationPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<CurrentLocationWitness<import("@xylabs/object").BaseParamsFields & {
3
- account?: import("@xyo-network/account-model").AccountInstance | "random";
4
- addToResolvers?: boolean;
5
- additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
6
- allowNameResolution?: boolean;
7
- config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
8
- schema: "network.xyo.location.current.config";
9
- } & {
10
- schema: import("./Config.ts").CurrentLocationWitnessConfigSchema;
11
- }, "schema"> & {
12
- schema: "network.xyo.location.current.config";
13
- }, "schema"> & {
14
- schema: string;
15
- };
16
- ephemeralQueryAccountEnabled?: boolean;
17
- moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
18
- } & {
19
- geolocation?: Geolocation;
20
- }>>;
21
- //# sourceMappingURL=Plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;GAQxB,CAAA"}
@@ -1,21 +0,0 @@
1
- import { CurrentLocationWitness } from './CurrentLocationWitness.ts';
2
- export declare const LocationPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<CurrentLocationWitness<import("@xylabs/object").BaseParamsFields & {
3
- account?: import("@xyo-network/account-model").AccountInstance | "random";
4
- addToResolvers?: boolean;
5
- additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
6
- allowNameResolution?: boolean;
7
- config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
8
- schema: "network.xyo.location.current.config";
9
- } & {
10
- schema: import("./Config.ts").CurrentLocationWitnessConfigSchema;
11
- }, "schema"> & {
12
- schema: "network.xyo.location.current.config";
13
- }, "schema"> & {
14
- schema: string;
15
- };
16
- ephemeralQueryAccountEnabled?: boolean;
17
- moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
18
- } & {
19
- geolocation?: Geolocation;
20
- }>>;
21
- //# sourceMappingURL=Plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;GAQxB,CAAA"}
@@ -1,21 +0,0 @@
1
- import { CurrentLocationWitness } from './CurrentLocationWitness.ts';
2
- export declare const LocationPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<CurrentLocationWitness<import("@xylabs/object").BaseParamsFields & {
3
- account?: import("@xyo-network/account-model").AccountInstance | "random";
4
- addToResolvers?: boolean;
5
- additionalSigners?: import("@xyo-network/account-model").AccountInstance[];
6
- allowNameResolution?: boolean;
7
- config: import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & Omit<import("@xyo-network/module-model").ArchivingModuleConfig & import("@xyo-network/module-model").ModuleConfigFields & {
8
- schema: "network.xyo.location.current.config";
9
- } & {
10
- schema: import("./Config.ts").CurrentLocationWitnessConfigSchema;
11
- }, "schema"> & {
12
- schema: "network.xyo.location.current.config";
13
- }, "schema"> & {
14
- schema: string;
15
- };
16
- ephemeralQueryAccountEnabled?: boolean;
17
- moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
18
- } & {
19
- geolocation?: Geolocation;
20
- }>>;
21
- //# sourceMappingURL=Plugin.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;GAQxB,CAAA"}
@@ -1,110 +0,0 @@
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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
- var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: true });
10
- };
11
- var __copyProps = (to, from, except, desc) => {
12
- if (from && typeof from === "object" || typeof from === "function") {
13
- for (let key of __getOwnPropNames(from))
14
- if (!__hasOwnProp.call(to, key) && key !== except)
15
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
- }
17
- return to;
18
- };
19
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
-
21
- // src/index.ts
22
- var src_exports = {};
23
- __export(src_exports, {
24
- CurrentLocationPayloadSet: () => CurrentLocationPayloadSet,
25
- CurrentLocationWitness: () => CurrentLocationWitness,
26
- CurrentLocationWitnessConfigSchema: () => CurrentLocationWitnessConfigSchema,
27
- LocationPlugin: () => LocationPlugin,
28
- default: () => LocationPlugin
29
- });
30
- module.exports = __toCommonJS(src_exports);
31
-
32
- // src/Config.ts
33
- var CurrentLocationWitnessConfigSchema = "network.xyo.location.current.config";
34
-
35
- // src/CurrentLocationPayloadSet.ts
36
- var import_location_payload_plugin = require("@xyo-network/location-payload-plugin");
37
- var import_payload_model = require("@xyo-network/payload-model");
38
- var CurrentLocationPayloadSet = {
39
- optional: {
40
- [import_location_payload_plugin.LocationHeadingSchema]: 1
41
- },
42
- required: {
43
- [import_location_payload_plugin.LocationSchema]: 1
44
- },
45
- schema: import_payload_model.PayloadSetSchema
46
- };
47
-
48
- // src/CurrentLocationWitness.ts
49
- var import_assert = require("@xylabs/assert");
50
- var import_abstract_witness = require("@xyo-network/abstract-witness");
51
- var import_location_payload_plugin2 = require("@xyo-network/location-payload-plugin");
52
- var CurrentLocationWitness = class extends import_abstract_witness.AbstractWitness {
53
- static {
54
- __name(this, "CurrentLocationWitness");
55
- }
56
- static configSchemas = [
57
- ...super.configSchemas,
58
- CurrentLocationWitnessConfigSchema
59
- ];
60
- static defaultConfigSchema = CurrentLocationWitnessConfigSchema;
61
- get geolocation() {
62
- return (0, import_assert.assertEx)(this.params.geolocation, () => "No geolocation provided");
63
- }
64
- getCurrentPosition() {
65
- return new Promise((resolve, reject) => {
66
- this.geolocation?.getCurrentPosition((position) => {
67
- resolve(position);
68
- }, (error) => {
69
- reject(error);
70
- });
71
- });
72
- }
73
- async observeHandler() {
74
- const location = await this.getCurrentPosition();
75
- const locationPayload = {
76
- altitude: location.coords.altitude ?? void 0,
77
- altitudeAccuracy: location.coords.altitudeAccuracy ?? void 0,
78
- latitude: location.coords.latitude,
79
- longitude: location.coords.longitude,
80
- schema: import_location_payload_plugin2.LocationSchema
81
- };
82
- const heading = location.coords.heading ? [
83
- {
84
- heading: location.coords.heading ?? void 0,
85
- schema: import_location_payload_plugin2.LocationHeadingSchema,
86
- speed: location.coords.speed ?? void 0
87
- }
88
- ] : [];
89
- return [
90
- locationPayload,
91
- ...heading
92
- ];
93
- }
94
- };
95
-
96
- // src/Plugin.ts
97
- var import_location_payload_plugin3 = require("@xyo-network/location-payload-plugin");
98
- var import_payload_model2 = require("@xyo-network/payload-model");
99
- var import_payloadset_plugin = require("@xyo-network/payloadset-plugin");
100
- var LocationPlugin = /* @__PURE__ */ __name(() => (0, import_payloadset_plugin.createPayloadSetWitnessPlugin)({
101
- required: {
102
- [import_location_payload_plugin3.LocationSchema]: 1
103
- },
104
- schema: import_payload_model2.PayloadSetSchema
105
- }, {
106
- witness: /* @__PURE__ */ __name(async (params) => {
107
- return await CurrentLocationWitness.create(params);
108
- }, "witness")
109
- }), "LocationPlugin");
110
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/index.ts","../../src/Config.ts","../../src/CurrentLocationPayloadSet.ts","../../src/CurrentLocationWitness.ts","../../src/Plugin.ts"],"sourcesContent":["export * from './Config.ts'\nexport * from './CurrentLocationPayloadSet.ts'\nexport * from './CurrentLocationWitness.ts'\n// eslint-disable-next-line import/no-default-export\nexport { LocationPlugin as default, LocationPlugin } from './Plugin.ts'\n","import { AnyConfigSchema, ModuleParams } from '@xyo-network/module-model'\nimport { WitnessConfig } from '@xyo-network/witness-model'\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 { assertEx } from '@xylabs/assert'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport { LocationHeadingPayload, LocationHeadingSchema, LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport { Payload, Schema } from '@xyo-network/payload-model'\n\nimport { CurrentLocationWitnessConfigSchema, CurrentLocationWitnessParams } from './Config.ts'\n\nexport class CurrentLocationWitness<TParams extends CurrentLocationWitnessParams = CurrentLocationWitnessParams> extends AbstractWitness<TParams> {\n static override readonly configSchemas: Schema[] = [...super.configSchemas, CurrentLocationWitnessConfigSchema]\n static override readonly defaultConfigSchema: Schema = 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[]\n = 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 { 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.ts'\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;ACIO,IAAMA,qCAAyE;;;ACJtF,qCAAsD;AACtD,2BAAoD;AAE7C,IAAMC,4BAA+C;EAC1DC,UAAU;IACR,CAACC,oDAAAA,GAAwB;EAC3B;EACAC,UAAU;IACR,CAACC,6CAAAA,GAAiB;EACpB;EACAC,QAAQC;AACV;;;ACXA,oBAAyB;AACzB,8BAAgC;AAChC,IAAAC,kCAA+F;AAKxF,IAAMC,yBAAN,cAAkHC,wCAAAA;EAPzH,OAOyHA;;;EACvH,OAAyBC,gBAA0B;OAAI,MAAMA;IAAeC;;EAC5E,OAAyBC,sBAA8BD;EAEvD,IAAIE,cAA2B;AAC7B,eAAOC,wBAAS,KAAKC,OAAOF,aAAa,MAAM,yBAAA;EACjD;EAEAG,qBAAqB;AACnB,WAAO,IAAIC,QAA6B,CAACC,SAASC,WAAAA;AAChD,WAAKN,aAAaG,mBAChB,CAACI,aAAAA;AACCF,gBAAQE,QAAAA;MACV,GACA,CAACC,UAAAA;AACCF,eAAOE,KAAAA;MACT,CAAA;IAEJ,CAAA;EACF;EAEA,MAAyBC,iBAAqC;AAC5D,UAAMC,WAAW,MAAM,KAAKP,mBAAkB;AAC9C,UAAMQ,kBAAmC;MACvCC,UAAUF,SAASG,OAAOD,YAAYE;MACtCC,kBAAkBL,SAASG,OAAOE,oBAAoBD;MACtDE,UAAUN,SAASG,OAAOG;MAC1BC,WAAWP,SAASG,OAAOI;MAC3BC,QAAQC;IACV;AACA,UAAMC,UACFV,SAASG,OAAOO,UACd;MACE;QACEA,SAASV,SAASG,OAAOO,WAAWN;QACpCI,QAAQG;QACRC,OAAOZ,SAASG,OAAOS,SAASR;MAClC;QAEF,CAAA;AACN,WAAO;MAACH;SAAoBS;;EAC9B;AACF;;;ACjDA,IAAAG,kCAA+B;AAC/B,IAAAC,wBAAiC;AACjC,+BAA8C;AAIvC,IAAMC,iBAAiB,iCAC5BC,wDACE;EAAEC,UAAU;IAAE,CAACC,8CAAAA,GAAiB;EAAE;EAAGC,QAAQC;AAAiB,GAC9D;EACEC,SAAS,8BAAOC,WAAAA;AACd,WAAO,MAAMC,uBAAuBC,OAAOF,MAAAA;EAC7C,GAFS;AAGX,CAAA,GAP0B;","names":["CurrentLocationWitnessConfigSchema","CurrentLocationPayloadSet","optional","LocationHeadingSchema","required","LocationSchema","schema","PayloadSetSchema","import_location_payload_plugin","CurrentLocationWitness","AbstractWitness","configSchemas","CurrentLocationWitnessConfigSchema","defaultConfigSchema","geolocation","assertEx","params","getCurrentPosition","Promise","resolve","reject","position","error","observeHandler","location","locationPayload","altitude","coords","undefined","altitudeAccuracy","latitude","longitude","schema","LocationSchema","heading","LocationHeadingSchema","speed","import_location_payload_plugin","import_payload_model","LocationPlugin","createPayloadSetWitnessPlugin","required","LocationSchema","schema","PayloadSetSchema","witness","params","CurrentLocationWitness","create"]}
@@ -1,5 +0,0 @@
1
- export * from './Config.ts';
2
- export * from './CurrentLocationPayloadSet.ts';
3
- export * from './CurrentLocationWitness.ts';
4
- export { LocationPlugin as default, LocationPlugin } from './Plugin.ts';
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,gCAAgC,CAAA;AAC9C,cAAc,6BAA6B,CAAA;AAE3C,OAAO,EAAE,cAAc,IAAI,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA"}