@flighthq/geolocation 0.5.1-next.1350.8ce488b → 0.5.1-next.1404.457d1da
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/geolocation.d.ts +6 -6
- package/dist/geolocation.d.ts.map +1 -1
- package/dist/geolocation.js.map +1 -1
- package/dist/geolocationAccess.d.ts +2 -2
- package/dist/geolocationAccess.d.ts.map +1 -1
- package/dist/geolocationAccess.js.map +1 -1
- package/package.json +3 -3
- package/src/geolocation.test.ts +7 -5
- package/src/geolocationAccess.test.ts +5 -5
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.1404.457d1da](https://github.com/flighthq/flight/tree/457d1da918a60be5853b84eb6c25530a66662cef/packages/geolocation)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/457d1da918a60be5853b84eb6c25530a66662cef/LICENSE.md)
|
package/dist/geolocation.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function clearGeolocationWatch(hostGeolocation: Readonly<
|
|
1
|
+
import type { HostGeolocationCapability, GeolocationErrorReason, GeolocationPosition as FlightGeolocationPosition, GeolocationPositionResult, GeolocationRequestOptions, EntityConstruction } from '@flighthq/types/contract';
|
|
2
|
+
export declare function clearGeolocationWatch(hostGeolocation: Readonly<HostGeolocationCapability>, id: number): void;
|
|
3
3
|
export declare function createGeolocationPosition(): FlightGeolocationPosition;
|
|
4
|
-
export declare function getCurrentGeolocationPosition(hostGeolocation: Readonly<
|
|
5
|
-
export declare function getCurrentGeolocationPositionResult(hostGeolocation: Readonly<
|
|
4
|
+
export declare function getCurrentGeolocationPosition(hostGeolocation: Readonly<HostGeolocationCapability>, options?: Readonly<GeolocationRequestOptions>): Promise<FlightGeolocationPosition | null>;
|
|
5
|
+
export declare function getCurrentGeolocationPositionResult(hostGeolocation: Readonly<HostGeolocationCapability>, options?: Readonly<GeolocationRequestOptions>): Promise<GeolocationPositionResult>;
|
|
6
6
|
export declare function initializeGeolocationPosition(out: EntityConstruction<FlightGeolocationPosition>): void;
|
|
7
|
-
export declare function isGeolocationAvailable(hostGeolocation: Readonly<
|
|
8
|
-
export declare function watchGeolocationPosition(hostGeolocation: Readonly<
|
|
7
|
+
export declare function isGeolocationAvailable(hostGeolocation: Readonly<HostGeolocationCapability>): boolean;
|
|
8
|
+
export declare function watchGeolocationPosition(hostGeolocation: Readonly<HostGeolocationCapability>, handler: (position: Readonly<FlightGeolocationPosition>) => void, options?: Readonly<GeolocationRequestOptions>, onError?: (reason: GeolocationErrorReason) => void): number;
|
|
9
9
|
//# sourceMappingURL=geolocation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geolocation.d.ts","sourceRoot":"","sources":["../src/geolocation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,
|
|
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,EACzB,kBAAkB,EACnB,MAAM,0BAA0B,CAAC;AAElC,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;AAUzE,MAAM,UAAU,qBAAqB,CAAC,
|
|
1
|
+
{"version":3,"file":"geolocation.js","sourceRoot":"","sources":["../src/geolocation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAUzE,MAAM,UAAU,qBAAqB,CAAC,eAAoD,EAAE,EAAU;IACpG,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;AACjC,C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ationAccessOutcome,
|
|
1
|
+
import type { GeolocationAccessOutcome, HostGeolocationCapability } from '@flighthq/types/contract';
|
|
2
2
|
/**
|
|
3
3
|
* Raises the platform's own location-access prompt through the host's geolocation provider.
|
|
4
4
|
*
|
|
@@ -10,5 +10,5 @@ import type { GeolocationAccessOutcome, HostGeolocationProvider } from '@flighth
|
|
|
10
10
|
* Reports `runtime-unavailable` rather than throwing when no provider is installed: an absent host
|
|
11
11
|
* capability is an expected outcome, not API misuse.
|
|
12
12
|
*/
|
|
13
|
-
export declare function promptForGeolocationAccess(hostGeolocation: Readonly<
|
|
13
|
+
export declare function promptForGeolocationAccess(hostGeolocation: Readonly<HostGeolocationCapability> | undefined): Promise<GeolocationAccessOutcome>;
|
|
14
14
|
//# sourceMappingURL=geolocationAccess.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geolocationAccess.d.ts","sourceRoot":"","sources":["../src/geolocationAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,
|
|
1
|
+
{"version":3,"file":"geolocationAccess.d.ts","sourceRoot":"","sources":["../src/geolocationAccess.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAEpG;;;;;;;;;;GAUG;AACH,wBAAsB,0BAA0B,CAC9C,eAAe,EAAE,QAAQ,CAAC,yBAAyB,CAAC,GAAG,SAAS,GAC/D,OAAO,CAAC,wBAAwB,CAAC,CASnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"geolocationAccess.js","sourceRoot":"","sources":["../src/geolocationAccess.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,
|
|
1
|
+
{"version":3,"file":"geolocationAccess.js","sourceRoot":"","sources":["../src/geolocationAccess.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,eAAgE;IAEhE,IAAI,eAAe,KAAK,SAAS,IAAI,OAAO,eAAe,CAAC,eAAe,KAAK,UAAU,EAAE,CAAC;QAC3F,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,CAAC;IAC3C,CAAC;IACD,IAAI,CAAC;QACH,OAAO,MAAM,eAAe,CAAC,eAAe,EAAE,CAAC;IACjD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;IACxC,CAAC;AACH,CAAC"}
|
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.1404.457d1da",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.1404.457d1da",
|
|
42
|
+
"@flighthq/types": "0.5.1-next.1404.457d1da"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"typescript": "^5.3.0"
|
package/src/geolocation.test.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { allocateEntity, finishEntity } from '@flighthq/entity/contract';
|
|
2
2
|
import type {
|
|
3
3
|
Entity,
|
|
4
|
-
|
|
4
|
+
HostGeolocationCapability,
|
|
5
5
|
GeolocationErrorReason,
|
|
6
6
|
GeolocationPosition,
|
|
7
7
|
} from '@flighthq/types/contract';
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
watchGeolocationPosition,
|
|
18
18
|
} from './geolocation';
|
|
19
19
|
|
|
20
|
-
function fakeBackend(available: boolean = true):
|
|
20
|
+
function fakeBackend(available: boolean = true): HostGeolocationCapability & { cleared: number[]; lastWatch: number } {
|
|
21
21
|
const out = allocateEntity<any>();
|
|
22
22
|
out.cleared = [];
|
|
23
23
|
out.lastWatch = 0;
|
|
@@ -54,10 +54,12 @@ function fakeBackend(available: boolean = true): HostGeolocationProvider & { cle
|
|
|
54
54
|
return finishEntity(out);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
function hostWith(backend:
|
|
58
|
-
readonly system: { readonly geolocation:
|
|
57
|
+
function hostWith(backend: HostGeolocationCapability): {
|
|
58
|
+
readonly system: { readonly geolocation: HostGeolocationCapability };
|
|
59
59
|
} {
|
|
60
|
-
return { system: { geolocation: backend } } as {
|
|
60
|
+
return { system: { geolocation: backend } } as {
|
|
61
|
+
readonly system: { readonly geolocation: HostGeolocationCapability };
|
|
62
|
+
};
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
describe('clearGeolocationWatch', () => {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { GeolocationAccessOutcome,
|
|
1
|
+
import type { GeolocationAccessOutcome, HostGeolocationCapability } from '@flighthq/types/contract';
|
|
2
2
|
|
|
3
3
|
import { promptForGeolocationAccess } from './geolocationAccess';
|
|
4
4
|
|
|
5
5
|
// A provider whose promptForAccess answer the test dictates. Only that member is exercised, so the
|
|
6
|
-
// rest of
|
|
6
|
+
// rest of HostGeolocationCapability stays absent on purpose — a probe needing the whole provider would be
|
|
7
7
|
// testing the fake.
|
|
8
|
-
function providerAnswering(outcome: GeolocationAccessOutcome):
|
|
9
|
-
return { promptForAccess: () => Promise.resolve(outcome) } as unknown as
|
|
8
|
+
function providerAnswering(outcome: GeolocationAccessOutcome): HostGeolocationCapability {
|
|
9
|
+
return { promptForAccess: () => Promise.resolve(outcome) } as unknown as HostGeolocationCapability;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
describe('promptForGeolocationAccess', () => {
|
|
@@ -35,7 +35,7 @@ describe('promptForGeolocationAccess', () => {
|
|
|
35
35
|
it('reports operation-failed when the provider throws', async () => {
|
|
36
36
|
const throwing = {
|
|
37
37
|
promptForAccess: () => Promise.reject(new Error('boom')),
|
|
38
|
-
} as unknown as
|
|
38
|
+
} as unknown as HostGeolocationCapability;
|
|
39
39
|
expect(await promptForGeolocationAccess(throwing)).toEqual({ reason: 'operation-failed' });
|
|
40
40
|
});
|
|
41
41
|
|