@flighthq/geolocation 0.5.1-next.4398.ec497e7 → 0.5.1-next.5076.44cab46
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/README.md +2 -2
- package/dist/contract.d.ts +1 -0
- package/dist/contract.d.ts.map +1 -1
- package/dist/geolocation.d.ts +2 -1
- package/dist/geolocation.d.ts.map +1 -1
- package/dist/geolocation.js.map +1 -1
- package/dist/geolocationAccess.d.ts +1 -1
- package/dist/geolocationAccess.d.ts.map +1 -1
- package/dist/types.d.ts +50 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +4 -3
- package/src/geolocation.test.ts +2 -7
- package/src/geolocationAccess.test.ts +1 -2
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/geolocation`. The `@
|
|
|
13
13
|
This package is part of the locked-version Flight SDK graph. Applications may instead install and import `@flighthq/sdk` when package-level tree shaking is sufficient.
|
|
14
14
|
|
|
15
15
|
- [Flight project](https://github.com/flighthq/flight)
|
|
16
|
-
- [Source for @flighthq/geolocation@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/geolocation@0.5.1-next.5076.44cab46](https://github.com/flighthq/flight/tree/44cab464341f8ac6e5e9df951cf974739ba9d3b7/packages/geolocation)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/44cab464341f8ac6e5e9df951cf974739ba9d3b7/LICENSE.md)
|
package/dist/contract.d.ts
CHANGED
package/dist/contract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,OAAO,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AACjE,mBAAmB,YAAY,CAAC"}
|
package/dist/geolocation.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EntityConstruction } from '@flighthq/entity/contract';
|
|
2
|
+
import type { HostGeolocationCapability, GeolocationErrorReason, GeolocationPosition as FlightGeolocationPosition, GeolocationPositionResult, GeolocationRequestOptions } from './types.ts';
|
|
2
3
|
export declare function clearGeolocationWatch(hostGeolocation: Readonly<HostGeolocationCapability>, id: number): void;
|
|
3
4
|
export declare function createGeolocationPosition(): FlightGeolocationPosition;
|
|
4
5
|
export declare function getCurrentGeolocationPosition(hostGeolocation: Readonly<HostGeolocationCapability>, options?: Readonly<GeolocationRequestOptions>): Promise<FlightGeolocationPosition | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../src/geolocation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,yBAAyB,EACzB,sBAAsB,EACtB,mBAAmB,IAAI,yBAAyB,EAChD,yBAAyB,EACzB,yBAAyB,
|
|
1
|
+
{"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../src/geolocation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,OAAO,KAAK,EACV,yBAAyB,EACzB,sBAAsB,EACtB,mBAAmB,IAAI,yBAAyB,EAChD,yBAAyB,EACzB,yBAAyB,EAC1B,MAAM,YAAY,CAAC;AAEpB,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,QAAQ,CAAC,yBAAyB,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAE5G;AAED,wBAAgB,yBAAyB,IAAI,yBAAyB,CAIrE;AAED,wBAAgB,6BAA6B,CAC3C,eAAe,EAAE,QAAQ,CAAC,yBAAyB,CAAC,EACpD,OAAO,CAAC,EAAE,QAAQ,CAAC,yBAAyB,CAAC,GAC5C,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAE3C;AAED,wBAAgB,mCAAmC,CACjD,eAAe,EAAE,QAAQ,CAAC,yBAAyB,CAAC,EACpD,OAAO,CAAC,EAAE,QAAQ,CAAC,yBAAyB,CAAC,GAC5C,OAAO,CAAC,yBAAyB,CAAC,CAEpC;AAED,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,kBAAkB,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAUtG;AAED,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,QAAQ,CAAC,yBAAyB,CAAC,GAAG,OAAO,CAEpG;AAED,wBAAgB,wBAAwB,CACtC,eAAe,EAAE,QAAQ,CAAC,yBAAyB,CAAC,EACpD,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,yBAAyB,CAAC,KAAK,IAAI,EAChE,OAAO,CAAC,EAAE,QAAQ,CAAC,yBAAyB,CAAC,EAC7C,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,GACjD,MAAM,CAER"}
|
package/dist/geolocation.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geolocation.js","sourceRoot":"","sources":["../src/geolocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"geolocation.js","sourceRoot":"","sources":["../src/geolocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAWzE,MAAM,UAAU,qBAAqB,CAAC,eAAoD,EAAE,EAAU;IACpG,eAAe,CAAC,UAAU,CAAC,E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
|
|
|
1
|
-
import type { GeolocationAccessOutcome, HostGeolocationCapability } from '
|
|
1
|
+
import type { GeolocationAccessOutcome, HostGeolocationCapability } from './types.ts';
|
|
2
2
|
/**
|
|
3
3
|
* Raises the platform's own location-access prompt through the host's geolocation provider.
|
|
4
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geolocationAccess.d.ts","sourceRoot":"","sources":["../src/geolocationAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"geolocationAccess.d.ts","sourceRoot":"","sources":["../src/geolocationAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAEtF;;;;;;;;;;GAUG;AACH,wBAAsB,0BAA0B,CAC9C,eAAe,EAAE,QAAQ,CAAC,yBAAyB,CAAC,GAAG,SAAS,GAC/D,OAAO,CAAC,wBAAwB,CAAC,CASnC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { EntityRaw, EntityRuntime, EntityRuntimeKey } from '@flighthq/entity/contract';
|
|
2
|
+
export interface GeolocationPosition extends EntityRaw {
|
|
3
|
+
[EntityRuntimeKey]: EntityRuntime | undefined;
|
|
4
|
+
latitude: number;
|
|
5
|
+
longitude: number;
|
|
6
|
+
accuracy: number;
|
|
7
|
+
altitude: number;
|
|
8
|
+
altitudeAccuracy: number;
|
|
9
|
+
floorLevel: number;
|
|
10
|
+
heading: number;
|
|
11
|
+
speed: number;
|
|
12
|
+
timestamp: number;
|
|
13
|
+
}
|
|
14
|
+
export type GeolocationErrorReason = 'denied' | 'timeout' | 'unavailable';
|
|
15
|
+
export interface GeolocationPositionResult {
|
|
16
|
+
position: GeolocationPosition | null;
|
|
17
|
+
reason: GeolocationErrorReason | null;
|
|
18
|
+
}
|
|
19
|
+
export interface GeolocationRequestOptions {
|
|
20
|
+
enableHighAccuracy?: boolean;
|
|
21
|
+
timeoutMs?: number;
|
|
22
|
+
maximumAgeMs?: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* What happened when the capability raised its own access prompt.
|
|
26
|
+
*
|
|
27
|
+
* A CAPABILITY outcome, deliberately not a `PermissionState`: only the capability can raise the
|
|
28
|
+
* prompt, and G6 lets it keep that mechanism precisely because what it returns carries no permission
|
|
29
|
+
* vocabulary. Permissions projects this into its own outcome; nothing here names a state.
|
|
30
|
+
*
|
|
31
|
+
* `timeout` is an ACQUISITION observable and says nothing about the user. It occurs routinely with
|
|
32
|
+
* access already granted — indoors, no fix, a slow lock — so it must never be read as a dismissal.
|
|
33
|
+
* Only a permission-state query can tell those apart, and the capability may not hold one; it reports
|
|
34
|
+
* what it saw and leaves the interpretation to the owner that can query.
|
|
35
|
+
*
|
|
36
|
+
* `cleanup-failed` means access WAS obtained and releasing the probe failed afterwards. The decision
|
|
37
|
+
* survives it, so it is a distinct arm rather than a failure that discards the answer.
|
|
38
|
+
*/
|
|
39
|
+
export type GeolocationAccessOutcome = {
|
|
40
|
+
readonly reason: 'cleanup-failed' | 'denied' | 'dismissed' | 'granted' | 'operation-failed' | 'runtime-unavailable' | 'timeout';
|
|
41
|
+
};
|
|
42
|
+
export interface HostGeolocationCapability {
|
|
43
|
+
getCurrentPosition(options: Readonly<GeolocationRequestOptions>): Promise<GeolocationPosition | null>;
|
|
44
|
+
getCurrentPositionResult(options: Readonly<GeolocationRequestOptions>): Promise<GeolocationPositionResult>;
|
|
45
|
+
isAvailable(): boolean;
|
|
46
|
+
watchPosition(listener: (position: Readonly<GeolocationPosition>) => void, options: Readonly<GeolocationRequestOptions>, onError?: (reason: GeolocationErrorReason) => void): number;
|
|
47
|
+
clearWatch(id: number): void;
|
|
48
|
+
promptForAccess(): Promise<GeolocationAccessOutcome>;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@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C,OAAO,EAAE,QAAQ,CAAC,yBAAyB,CAAC,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;IAE3G,WAAW,IAAI,OAAO,CAAC;IACvB,aAAa,CACX,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,mBAAmB,CAAC,KAAK,IAAI,EAC3D,OAAO,EAAE,QAAQ,CAAC,yBAAyB,CAAC,EAC5C,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,sBAAsB,KAAK,IAAI,GACjD,MAAM,CAAC;IACV,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAG7B,eAAe,IAAI,OAAO,CAAC,wBAAwB,CAAC,CAAC;CACtD"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/geolocation",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.5076.44cab46",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -32,14 +32,15 @@
|
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "tsc -b",
|
|
34
34
|
"clean": "tsc -b --clean",
|
|
35
|
+
"generate": "tsx ../../scripts/generate-rust-package.ts --crate flight-geolocation --package geolocation",
|
|
36
|
+
"generate:check": "tsx ../../scripts/generate-rust-package.ts --crate flight-geolocation --package geolocation --check",
|
|
35
37
|
"test": "vitest run --config vitest.config.ts",
|
|
36
38
|
"test:watch": "vitest --watch --config vitest.config.ts",
|
|
37
39
|
"prepack": "npm run clean && npm run clean:dist && npm run build",
|
|
38
40
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
41
|
},
|
|
40
42
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/types": "0.5.1-next.4398.ec497e7"
|
|
43
|
+
"@flighthq/entity": "0.5.1-next.5076.44cab46"
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"typescript": "^7.0.2"
|
package/src/geolocation.test.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
1
|
import { allocateEntity, finishEntity } from '@flighthq/entity/contract';
|
|
2
|
-
import
|
|
3
|
-
Entity,
|
|
4
|
-
HostGeolocationCapability,
|
|
5
|
-
GeolocationErrorReason,
|
|
6
|
-
GeolocationPosition,
|
|
7
|
-
} from '@flighthq/types/contract';
|
|
8
|
-
import { EntityRuntimeKey } from '@flighthq/types/contract';
|
|
2
|
+
import { EntityRuntimeKey } from '@flighthq/entity/contract';
|
|
9
3
|
|
|
10
4
|
import {
|
|
11
5
|
clearGeolocationWatch,
|
|
@@ -16,6 +10,7 @@ import {
|
|
|
16
10
|
isGeolocationAvailable,
|
|
17
11
|
watchGeolocationPosition,
|
|
18
12
|
} from './geolocation.ts';
|
|
13
|
+
import type { HostGeolocationCapability, GeolocationErrorReason, GeolocationPosition } from './types.ts';
|
|
19
14
|
|
|
20
15
|
function fakeBackend(available: boolean = true): HostGeolocationCapability & { cleared: number[]; lastWatch: number } {
|
|
21
16
|
const out = allocateEntity<any>();
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { GeolocationAccessOutcome, HostGeolocationCapability } from '@flighthq/types/contract';
|
|
2
|
-
|
|
3
1
|
import { promptForGeolocationAccess } from './geolocationAccess.ts';
|
|
2
|
+
import type { GeolocationAccessOutcome, HostGeolocationCapability } from './types.ts';
|
|
4
3
|
|
|
5
4
|
// A provider whose promptForAccess answer the test dictates. Only that member is exercised, so the
|
|
6
5
|
// rest of HostGeolocationCapability stays absent on purpose — a probe needing the whole provider would be
|