@xyo-network/location-plugin 3.6.1 → 4.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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/Config.ts","../../src/CurrentLocationPayloadSet.ts","../../src/CurrentLocationWitness.ts","../../src/Plugin.ts"],"sourcesContent":["import type { AnyConfigSchema, ModuleParams } from '@xyo-network/module-model'\nimport type { 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 type { PayloadSetPayload } from '@xyo-network/payload-model'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\n\nexport const CurrentLocationPayloadSet: PayloadSetPayload = {\n optional: { [LocationHeadingSchema]: 1 },\n required: { [LocationSchema]: 1 },\n schema: PayloadSetSchema,\n}\n","import { assertEx } from '@xylabs/assert'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport type { LocationHeadingPayload, LocationPayload } from '@xyo-network/location-payload-plugin'\nimport { LocationHeadingSchema, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\n\nimport type { CurrentLocationWitnessParams } from './Config.ts'\nimport { CurrentLocationWitnessConfigSchema } 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;AAEtD,SAAS,wBAAwB;AAE1B,IAAM,4BAA+C;AAAA,EAC1D,UAAU,EAAE,CAAC,qBAAqB,GAAG,EAAE;AAAA,EACvC,UAAU,EAAE,CAAC,cAAc,GAAG,EAAE;AAAA,EAChC,QAAQ;AACV;;;ACRA,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAEhC,SAAS,yBAAAA,wBAAuB,kBAAAC,uBAAsB;AAM/C,IAAM,yBAAN,cAAkH,gBAAyB;AAAA,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LocationSchema","PayloadSetSchema","LocationSchema","PayloadSetSchema"]}
1
+ {"version":3,"sources":["../../src/Config.ts","../../src/CurrentLocationPayloadSet.ts","../../src/CurrentLocationWitness.ts","../../src/Plugin.ts"],"sourcesContent":["import type { AnyConfigSchema, ModuleParams } from '@xyo-network/module-model'\nimport type { 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 interface CurrentLocationWitnessParams extends ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>> { geolocation?: Geolocation }\n","import { LocationHeadingSchema, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport type { PayloadSetPayload } from '@xyo-network/payload-model'\nimport { PayloadSetSchema } from '@xyo-network/payload-model'\n\nexport const CurrentLocationPayloadSet: PayloadSetPayload = {\n optional: { [LocationHeadingSchema]: 1 },\n required: { [LocationSchema]: 1 },\n schema: PayloadSetSchema,\n}\n","import { assertEx } from '@xylabs/assert'\nimport { AbstractWitness } from '@xyo-network/abstract-witness'\nimport type { LocationHeadingPayload, LocationPayload } from '@xyo-network/location-payload-plugin'\nimport { LocationHeadingSchema, LocationSchema } from '@xyo-network/location-payload-plugin'\nimport type { Payload, Schema } from '@xyo-network/payload-model'\n\nimport type { CurrentLocationWitnessParams } from './Config.ts'\nimport { CurrentLocationWitnessConfigSchema } 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;AAEtD,SAAS,wBAAwB;AAE1B,IAAM,4BAA+C;AAAA,EAC1D,UAAU,EAAE,CAAC,qBAAqB,GAAG,EAAE;AAAA,EACvC,UAAU,EAAE,CAAC,cAAc,GAAG,EAAE;AAAA,EAChC,QAAQ;AACV;;;ACRA,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAEhC,SAAS,yBAAAA,wBAAuB,kBAAAC,uBAAsB;AAM/C,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;;;ACnDA,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"]}
@@ -5,7 +5,7 @@ export declare const CurrentLocationWitnessConfigSchema: CurrentLocationWitnessC
5
5
  export type CurrentLocationWitnessConfig = WitnessConfig<{
6
6
  schema: CurrentLocationWitnessConfigSchema;
7
7
  }>;
8
- export type CurrentLocationWitnessParams = ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>, {
8
+ export interface CurrentLocationWitnessParams extends ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>> {
9
9
  geolocation?: Geolocation;
10
- }>;
10
+ }
11
11
  //# sourceMappingURL=Config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE/D,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
+ {"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE/D,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,WAAW,4BAA6B,SAAQ,YAAY,CAAC,eAAe,CAAC,4BAA4B,CAAC,CAAC;IAAG,WAAW,CAAC,EAAE,WAAW,CAAA;CAAE"}
@@ -1,13 +1,3 @@
1
1
  import { CurrentLocationWitness } from './CurrentLocationWitness.ts';
2
- export declare const LocationPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<CurrentLocationWitness<import(".store/@xylabs-base-npm-4.11.2-29ff43002f/package").BaseParamsFields & {
3
- account?: import(".store/@xyo-network-account-model-npm-3.17.1-d1c40ed920/package").AccountInstance | "random";
4
- addToResolvers?: boolean;
5
- additionalSigners?: import(".store/@xyo-network-account-model-npm-3.17.1-d1c40ed920/package").AccountInstance[];
6
- allowNameResolution?: boolean;
7
- config: import("@xyo-network/module-model").AnyConfigSchema<import("./Config.ts").CurrentLocationWitnessConfig>;
8
- ephemeralQueryAccountEnabled?: boolean;
9
- moduleIdentifierTransformers?: import("@xyo-network/module-model").ModuleIdentifierTransformer[];
10
- } & import("@xyo-network/module-model").ModuleChildrenParams & {
11
- geolocation?: Geolocation;
12
- }>>;
2
+ export declare const LocationPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<CurrentLocationWitness<import("./Config.ts").CurrentLocationWitnessParams>>;
13
3
  //# sourceMappingURL=Plugin.d.ts.map
@@ -1 +1 @@
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
+ {"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,oJAQxB,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xyo-network/location-plugin",
3
- "version": "3.6.1",
3
+ "version": "4.0.0",
4
4
  "description": "Typescript/Javascript Plugins for XYO Platform",
5
5
  "homepage": "https://xyo.network",
6
6
  "bugs": {
@@ -29,21 +29,21 @@
29
29
  "module": "dist/neutral/index.mjs",
30
30
  "types": "dist/types/index.d.ts",
31
31
  "dependencies": {
32
- "@xylabs/assert": "^4.11.2",
33
- "@xyo-network/abstract-witness": "^3.17.1",
34
- "@xyo-network/location-payload-plugin": "^3.6.1",
35
- "@xyo-network/module-model": "^3.17.1",
36
- "@xyo-network/payload-model": "^3.17.1",
37
- "@xyo-network/payloadset-plugin": "^3.17.1",
38
- "@xyo-network/witness-model": "^3.17.1"
32
+ "@xylabs/assert": "^4.12.31",
33
+ "@xyo-network/abstract-witness": "^4.0.1",
34
+ "@xyo-network/location-payload-plugin": "^4.0.0",
35
+ "@xyo-network/module-model": "^4.0.1",
36
+ "@xyo-network/payload-model": "^4.0.1",
37
+ "@xyo-network/payloadset-plugin": "^4.0.1",
38
+ "@xyo-network/witness-model": "^4.0.1"
39
39
  },
40
40
  "devDependencies": {
41
- "@xylabs/ts-scripts-yarn3": "^6.5.7",
42
- "@xylabs/tsconfig-dom": "^6.5.7",
43
- "@xylabs/vitest-extended": "^4.11.2",
44
- "knip": "^5.59.0",
41
+ "@xylabs/ts-scripts-yarn3": "^6.5.12",
42
+ "@xylabs/tsconfig-dom": "^6.5.12",
43
+ "@xylabs/vitest-extended": "^4.12.31",
44
+ "knip": "^5.61.3",
45
45
  "typescript": "^5.8.3",
46
- "vitest": "^3.1.4"
46
+ "vitest": "^3.2.4"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"
package/src/Config.ts CHANGED
@@ -8,4 +8,4 @@ export type CurrentLocationWitnessConfig = WitnessConfig<{
8
8
  schema: CurrentLocationWitnessConfigSchema
9
9
  }>
10
10
 
11
- export type CurrentLocationWitnessParams = ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>, { geolocation?: Geolocation }>
11
+ export interface CurrentLocationWitnessParams extends ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>> { geolocation?: Geolocation }