@xyo-network/location-plugin 2.51.9 → 2.51.10
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/cjs/CurrentLocationWitness.js +1 -13
- package/dist/cjs/CurrentLocationWitness.js.map +1 -1
- package/dist/cjs/Plugin.js +1 -1
- package/dist/cjs/Plugin.js.map +1 -1
- package/dist/docs.json +12343 -7543
- package/dist/esm/CurrentLocationWitness.js +1 -9
- package/dist/esm/CurrentLocationWitness.js.map +1 -1
- package/dist/esm/Plugin.js +2 -2
- package/dist/esm/Plugin.js.map +1 -1
- package/dist/types/Config.d.ts +4 -4
- package/dist/types/Config.d.ts.map +1 -1
- package/dist/types/CurrentLocationWitness.d.ts +3 -7
- package/dist/types/CurrentLocationWitness.d.ts.map +1 -1
- package/dist/types/Plugin.d.ts +1 -17
- package/dist/types/Plugin.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/Config.ts +2 -2
- package/src/CurrentLocationWitness.ts +4 -16
- package/src/Plugin.ts +2 -4
|
@@ -4,16 +4,8 @@ import { AbstractWitness } from '@xyo-network/witness';
|
|
|
4
4
|
import { CurrentLocationWitnessConfigSchema } from './Config';
|
|
5
5
|
export class CurrentLocationWitness extends AbstractWitness {
|
|
6
6
|
static configSchema = CurrentLocationWitnessConfigSchema;
|
|
7
|
-
_geolocation;
|
|
8
|
-
constructor(params) {
|
|
9
|
-
super(params);
|
|
10
|
-
this._geolocation = params?.geolocation;
|
|
11
|
-
}
|
|
12
7
|
get geolocation() {
|
|
13
|
-
return assertEx(this.
|
|
14
|
-
}
|
|
15
|
-
static async create(params) {
|
|
16
|
-
return (await super.create(params));
|
|
8
|
+
return assertEx(this.params.geolocation, 'No geolocation provided');
|
|
17
9
|
}
|
|
18
10
|
getCurrentPosition() {
|
|
19
11
|
return new Promise((resolve, reject) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrentLocationWitness.js","sourceRoot":"","sources":["../../src/CurrentLocationWitness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAA0B,qBAAqB,EAAmB,cAAc,EAAE,MAAM,sCAAsC,CAAA;
|
|
1
|
+
{"version":3,"file":"CurrentLocationWitness.js","sourceRoot":"","sources":["../../src/CurrentLocationWitness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAA0B,qBAAqB,EAAmB,cAAc,EAAE,MAAM,sCAAsC,CAAA;AAErI,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAEtD,OAAO,EAAE,kCAAkC,EAAgC,MAAM,UAAU,CAAA;AAE3F,MAAM,OAAO,sBAAoG,SAAQ,eAAwB;IAC/I,MAAM,CAAU,YAAY,GAAG,kCAAkC,CAAA;IAEjE,IAAI,WAAW;QACb,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,yBAAyB,CAAC,CAAA;IACrE,CAAC;IAED,kBAAkB;QAChB,OAAO,IAAI,OAAO,CAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC1D,IAAI,CAAC,WAAW,EAAE,kBAAkB,CAClC,CAAC,QAA6B,EAAE,EAAE;gBAChC,OAAO,CAAC,QAAQ,CAAC,CAAA;YACnB,CAAC,EACD,CAAC,KAA+B,EAAE,EAAE;gBAClC,MAAM,CAAC,KAAK,CAAC,CAAA;YACf,CAAC,CACF,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;IAEQ,KAAK,CAAC,OAAO;QACpB,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,kBAAkB,EAAE,CAAA;QAChD,MAAM,eAAe,GAAoB;YACvC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ,IAAI,SAAS;YAC/C,gBAAgB,EAAE,QAAQ,CAAC,MAAM,CAAC,gBAAgB,IAAI,SAAS;YAC/D,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,QAAQ;YAClC,SAAS,EAAE,QAAQ,CAAC,MAAM,CAAC,SAAS;YACpC,MAAM,EAAE,cAAc;SACvB,CAAA;QACD,MAAM,OAAO,GAA6B,QAAQ,CAAC,MAAM,CAAC,OAAO;YAC/D,CAAC,CAAC;gBACE;oBACE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,IAAI,SAAS;oBAC7C,MAAM,EAAE,qBAAqB;oBAC7B,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,IAAI,SAAS;iBAC1C;aACF;YACH,CAAC,CAAC,EAAE,CAAA;QACN,OAAO,KAAK,CAAC,OAAO,CAAC,CAAC,eAAe,EAAE,GAAG,OAAO,CAAC,CAAC,CAAA;IACrD,CAAC"}
|
package/dist/esm/Plugin.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { LocationSchema } from '@xyo-network/location-payload-plugin';
|
|
2
2
|
import { PayloadSetSchema } from '@xyo-network/payload-model';
|
|
3
|
-
import {
|
|
3
|
+
import { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin';
|
|
4
4
|
import { CurrentLocationWitness } from './CurrentLocationWitness';
|
|
5
|
-
export const LocationPlugin = () =>
|
|
5
|
+
export const LocationPlugin = () => createPayloadSetWitnessPlugin({ required: { [LocationSchema]: 1 }, schema: PayloadSetSchema }, {
|
|
6
6
|
witness: async (params) => {
|
|
7
7
|
return await CurrentLocationWitness.create(params);
|
|
8
8
|
},
|
package/dist/esm/Plugin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;
|
|
1
|
+
{"version":3,"file":"Plugin.js","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAA;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAA;AAE9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AAEjE,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,EAAE,CACjC,6BAA6B,CAC3B,EAAE,QAAQ,EAAE,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,gBAAgB,EAAE,EAC/D;IACE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE;QACxB,OAAO,MAAM,sBAAsB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IACpD,CAAC;CACF,CACF,CAAA"}
|
package/dist/types/Config.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { ModuleParams } from '@xyo-network/module';
|
|
1
|
+
import { AnyConfigSchema, ModuleEventData, ModuleParams } from '@xyo-network/module';
|
|
2
2
|
import { XyoWitnessConfig } from '@xyo-network/witness';
|
|
3
3
|
export type CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config';
|
|
4
4
|
export declare const CurrentLocationWitnessConfigSchema: CurrentLocationWitnessConfigSchema;
|
|
5
5
|
export type CurrentLocationWitnessConfig = XyoWitnessConfig<{
|
|
6
6
|
schema: CurrentLocationWitnessConfigSchema;
|
|
7
7
|
}>;
|
|
8
|
-
export type CurrentLocationWitnessParams = ModuleParams<CurrentLocationWitnessConfig
|
|
9
|
-
geolocation
|
|
10
|
-
}
|
|
8
|
+
export type CurrentLocationWitnessParams = ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>, ModuleEventData, {
|
|
9
|
+
geolocation?: Geolocation;
|
|
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,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"Config.d.ts","sourceRoot":"","sources":["../../src/Config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAEvD,MAAM,MAAM,kCAAkC,GAAG,qCAAqC,CAAA;AACtF,eAAO,MAAM,kCAAkC,EAAE,kCAA0E,CAAA;AAE3H,MAAM,MAAM,4BAA4B,GAAG,gBAAgB,CAAC;IAC1D,MAAM,EAAE,kCAAkC,CAAA;CAC3C,CAAC,CAAA;AAEF,MAAM,MAAM,4BAA4B,GAAG,YAAY,CAAC,eAAe,CAAC,4BAA4B,CAAC,EAAE,eAAe,EAAE;IAAE,WAAW,CAAC,EAAE,WAAW,CAAA;CAAE,CAAC,CAAA"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import { ModuleParams } from '@xyo-network/module';
|
|
2
1
|
import { XyoPayload } from '@xyo-network/payload-model';
|
|
3
|
-
import { AbstractWitness
|
|
4
|
-
import {
|
|
5
|
-
export declare class CurrentLocationWitness extends AbstractWitness<
|
|
2
|
+
import { AbstractWitness } from '@xyo-network/witness';
|
|
3
|
+
import { CurrentLocationWitnessParams } from './Config';
|
|
4
|
+
export declare class CurrentLocationWitness<TParams extends CurrentLocationWitnessParams = CurrentLocationWitnessParams> extends AbstractWitness<TParams> {
|
|
6
5
|
static configSchema: "network.xyo.location.current.config";
|
|
7
|
-
private _geolocation;
|
|
8
|
-
constructor(params: CurrentLocationWitnessParams);
|
|
9
6
|
get geolocation(): Geolocation;
|
|
10
|
-
static create(params?: ModuleParams<CurrentLocationWitnessConfig>): Promise<CurrentLocationWitness>;
|
|
11
7
|
getCurrentPosition(): Promise<GeolocationPosition>;
|
|
12
8
|
observe(): Promise<XyoPayload[]>;
|
|
13
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CurrentLocationWitness.d.ts","sourceRoot":"","sources":["../../src/CurrentLocationWitness.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"CurrentLocationWitness.d.ts","sourceRoot":"","sources":["../../src/CurrentLocationWitness.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,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,YAAY,wCAAqC;IAEjE,IAAI,WAAW,IAAI,WAAW,CAE7B;IAED,kBAAkB;IAaH,OAAO,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;CAoBhD"}
|
package/dist/types/Plugin.d.ts
CHANGED
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
import { ModuleParams } from '@xyo-network/module';
|
|
2
|
-
import { PayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin';
|
|
3
1
|
import { CurrentLocationWitness } from './CurrentLocationWitness';
|
|
4
|
-
export declare const LocationPlugin: () =>
|
|
5
|
-
name?: string | undefined;
|
|
6
|
-
security?: {
|
|
7
|
-
allowAnonymous?: boolean | undefined;
|
|
8
|
-
allowed?: Record<string, (string | import("@xyo-network/module").CosigningAddressSet)[]> | undefined;
|
|
9
|
-
disallowed?: Record<string, string[]> | undefined;
|
|
10
|
-
} | undefined;
|
|
11
|
-
storeQueries?: boolean | undefined;
|
|
12
|
-
} & {
|
|
13
|
-
schema: "network.xyo.location.current.config";
|
|
14
|
-
} & {
|
|
15
|
-
targetSet?: (import("@xyo-network/payload-model").SchemaFields & import("@xyo-network/payload-model").PayloadFields & import("@xyo-network/payload-model").PayloadSet & {
|
|
16
|
-
schema: "network.xyo.payload.set";
|
|
17
|
-
}) | undefined;
|
|
18
|
-
}, undefined>>;
|
|
2
|
+
export declare const LocationPlugin: () => import("@xyo-network/payloadset-plugin").PayloadSetWitnessPlugin<CurrentLocationWitness<import("./Config").CurrentLocationWitnessParams>>;
|
|
19
3
|
//# sourceMappingURL=Plugin.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plugin.d.ts","sourceRoot":"","sources":["../../src/Plugin.ts"],"names":[],"mappings":"
|
|
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,iJAQxB,CAAA"}
|
package/package.json
CHANGED
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@xylabs/assert": "^2.7.4",
|
|
14
|
-
"@xyo-network/location-payload-plugin": "^2.51.
|
|
15
|
-
"@xyo-network/module": "^2.51.
|
|
16
|
-
"@xyo-network/payload-model": "^2.51.
|
|
17
|
-
"@xyo-network/payloadset-plugin": "^2.51.
|
|
18
|
-
"@xyo-network/witness": "^2.51.
|
|
14
|
+
"@xyo-network/location-payload-plugin": "^2.51.10",
|
|
15
|
+
"@xyo-network/module": "^2.51.10",
|
|
16
|
+
"@xyo-network/payload-model": "^2.51.10",
|
|
17
|
+
"@xyo-network/payloadset-plugin": "^2.51.10",
|
|
18
|
+
"@xyo-network/witness": "^2.51.10"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
21
|
"@xylabs/ts-scripts-yarn3": "^2.16.1",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
},
|
|
56
56
|
"sideEffects": false,
|
|
57
57
|
"types": "dist/types/index.d.ts",
|
|
58
|
-
"version": "2.51.
|
|
58
|
+
"version": "2.51.10"
|
|
59
59
|
}
|
package/src/Config.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModuleParams } from '@xyo-network/module'
|
|
1
|
+
import { AnyConfigSchema, ModuleEventData, ModuleParams } from '@xyo-network/module'
|
|
2
2
|
import { XyoWitnessConfig } from '@xyo-network/witness'
|
|
3
3
|
|
|
4
4
|
export type CurrentLocationWitnessConfigSchema = 'network.xyo.location.current.config'
|
|
@@ -8,4 +8,4 @@ export type CurrentLocationWitnessConfig = XyoWitnessConfig<{
|
|
|
8
8
|
schema: CurrentLocationWitnessConfigSchema
|
|
9
9
|
}>
|
|
10
10
|
|
|
11
|
-
export type CurrentLocationWitnessParams = ModuleParams<CurrentLocationWitnessConfig
|
|
11
|
+
export type CurrentLocationWitnessParams = ModuleParams<AnyConfigSchema<CurrentLocationWitnessConfig>, ModuleEventData, { geolocation?: Geolocation }>
|
|
@@ -1,27 +1,15 @@
|
|
|
1
1
|
import { assertEx } from '@xylabs/assert'
|
|
2
2
|
import { LocationHeadingPayload, LocationHeadingSchema, LocationPayload, LocationSchema } from '@xyo-network/location-payload-plugin'
|
|
3
|
-
import { ModuleParams } from '@xyo-network/module'
|
|
4
3
|
import { XyoPayload } from '@xyo-network/payload-model'
|
|
5
|
-
import { AbstractWitness
|
|
4
|
+
import { AbstractWitness } from '@xyo-network/witness'
|
|
6
5
|
|
|
7
|
-
import {
|
|
6
|
+
import { CurrentLocationWitnessConfigSchema, CurrentLocationWitnessParams } from './Config'
|
|
8
7
|
|
|
9
|
-
export class CurrentLocationWitness extends AbstractWitness<
|
|
8
|
+
export class CurrentLocationWitness<TParams extends CurrentLocationWitnessParams = CurrentLocationWitnessParams> extends AbstractWitness<TParams> {
|
|
10
9
|
static override configSchema = CurrentLocationWitnessConfigSchema
|
|
11
10
|
|
|
12
|
-
private _geolocation: Geolocation
|
|
13
|
-
|
|
14
|
-
constructor(params: CurrentLocationWitnessParams) {
|
|
15
|
-
super(params)
|
|
16
|
-
this._geolocation = params?.geolocation
|
|
17
|
-
}
|
|
18
|
-
|
|
19
11
|
get geolocation(): Geolocation {
|
|
20
|
-
return assertEx(this.
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static override async create(params?: ModuleParams<CurrentLocationWitnessConfig>): Promise<CurrentLocationWitness> {
|
|
24
|
-
return (await super.create(params)) as CurrentLocationWitness
|
|
12
|
+
return assertEx(this.params.geolocation, 'No geolocation provided')
|
|
25
13
|
}
|
|
26
14
|
|
|
27
15
|
getCurrentPosition() {
|
package/src/Plugin.ts
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { LocationSchema } from '@xyo-network/location-payload-plugin'
|
|
2
|
-
import { ModuleParams } from '@xyo-network/module'
|
|
3
2
|
import { PayloadSetSchema } from '@xyo-network/payload-model'
|
|
4
|
-
import {
|
|
3
|
+
import { createPayloadSetWitnessPlugin } from '@xyo-network/payloadset-plugin'
|
|
5
4
|
|
|
6
|
-
import { CurrentLocationWitnessConfig } from './Config'
|
|
7
5
|
import { CurrentLocationWitness } from './CurrentLocationWitness'
|
|
8
6
|
|
|
9
7
|
export const LocationPlugin = () =>
|
|
10
|
-
|
|
8
|
+
createPayloadSetWitnessPlugin<CurrentLocationWitness>(
|
|
11
9
|
{ required: { [LocationSchema]: 1 }, schema: PayloadSetSchema },
|
|
12
10
|
{
|
|
13
11
|
witness: async (params) => {
|