@xyo-network/location-plugin 5.2.3 → 5.3.1
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.
package/dist/neutral/Config.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { AnyConfigSchema, ModuleParams } from '@xyo-network/module-model';
|
|
2
2
|
import type { WitnessConfig } from '@xyo-network/witness-model';
|
|
3
|
-
export type CurrentLocationWitnessConfigSchema =
|
|
4
|
-
export declare const CurrentLocationWitnessConfigSchema:
|
|
3
|
+
export type CurrentLocationWitnessConfigSchema = typeof CurrentLocationWitnessConfigSchema;
|
|
4
|
+
export declare const CurrentLocationWitnessConfigSchema: "network.xyo.location.current.config" & {
|
|
5
|
+
readonly __schema: true;
|
|
6
|
+
};
|
|
5
7
|
export type CurrentLocationWitnessConfig = WitnessConfig<{
|
|
6
8
|
schema: CurrentLocationWitnessConfigSchema;
|
|
7
9
|
}>;
|
|
@@ -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;
|
|
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;AAE9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAE/D,MAAM,MAAM,kCAAkC,GAAG,OAAO,kCAAkC,CAAA;AAC1F,eAAO,MAAM,kCAAkC;;CAAwD,CAAA;AAEvG,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"}
|
package/dist/neutral/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// src/Config.ts
|
|
2
|
-
|
|
2
|
+
import { asSchema } from "@xyo-network/payload-model";
|
|
3
|
+
var CurrentLocationWitnessConfigSchema = asSchema("network.xyo.location.current.config", true);
|
|
3
4
|
|
|
4
5
|
// src/CurrentLocationPayloadSet.ts
|
|
5
6
|
import { LocationHeadingSchema, LocationSchema } from "@xyo-network/location-payload-plugin";
|
|
@@ -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 =
|
|
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 { asSchema } from '@xyo-network/payload-model'\nimport type { WitnessConfig } from '@xyo-network/witness-model'\n\nexport type CurrentLocationWitnessConfigSchema = typeof CurrentLocationWitnessConfigSchema\nexport const CurrentLocationWitnessConfigSchema = asSchema('network.xyo.location.current.config', true)\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":";AACA,SAAS,gBAAgB;AAIlB,IAAM,qCAAqC,SAAS,uCAAuC,IAAI;;;ACLtG,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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xyo-network/location-plugin",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.1",
|
|
4
4
|
"description": "Typescript/Javascript Plugins for XYO Platform",
|
|
5
5
|
"homepage": "https://xyo.network",
|
|
6
6
|
"bugs": {
|
|
@@ -36,22 +36,22 @@
|
|
|
36
36
|
"!**/*.test.*"
|
|
37
37
|
],
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@xylabs/assert": "~5.0.
|
|
40
|
-
"@xyo-network/abstract-witness": "~5.2
|
|
41
|
-
"@xyo-network/location-payload-plugin": "
|
|
42
|
-
"@xyo-network/module-model": "~5.2
|
|
43
|
-
"@xyo-network/payload-model": "~5.2
|
|
44
|
-
"@xyo-network/payloadset-plugin": "~5.2
|
|
45
|
-
"@xyo-network/witness-model": "~5.2
|
|
39
|
+
"@xylabs/assert": "~5.0.64",
|
|
40
|
+
"@xyo-network/abstract-witness": "~5.3.2",
|
|
41
|
+
"@xyo-network/location-payload-plugin": "5.3.1",
|
|
42
|
+
"@xyo-network/module-model": "~5.3.2",
|
|
43
|
+
"@xyo-network/payload-model": "~5.3.2",
|
|
44
|
+
"@xyo-network/payloadset-plugin": "~5.3.2",
|
|
45
|
+
"@xyo-network/witness-model": "~5.3.2"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@xylabs/ts-scripts-yarn3": "~7.2
|
|
49
|
-
"@xylabs/tsconfig-dom": "~7.2
|
|
50
|
-
"@xylabs/vitest-extended": "~5.0.
|
|
48
|
+
"@xylabs/ts-scripts-yarn3": "~7.3.2",
|
|
49
|
+
"@xylabs/tsconfig-dom": "~7.3.2",
|
|
50
|
+
"@xylabs/vitest-extended": "~5.0.64",
|
|
51
51
|
"typescript": "~5.9.3",
|
|
52
|
-
"vitest": "~4.0.
|
|
52
|
+
"vitest": "~4.0.18"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|
|
56
56
|
}
|
|
57
|
-
}
|
|
57
|
+
}
|
package/src/Config.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { AnyConfigSchema, ModuleParams } from '@xyo-network/module-model'
|
|
2
|
+
import { asSchema } from '@xyo-network/payload-model'
|
|
2
3
|
import type { WitnessConfig } from '@xyo-network/witness-model'
|
|
3
4
|
|
|
4
|
-
export type CurrentLocationWitnessConfigSchema =
|
|
5
|
-
export const CurrentLocationWitnessConfigSchema
|
|
5
|
+
export type CurrentLocationWitnessConfigSchema = typeof CurrentLocationWitnessConfigSchema
|
|
6
|
+
export const CurrentLocationWitnessConfigSchema = asSchema('network.xyo.location.current.config', true)
|
|
6
7
|
|
|
7
8
|
export type CurrentLocationWitnessConfig = WitnessConfig<{
|
|
8
9
|
schema: CurrentLocationWitnessConfigSchema
|