@flighthq/protocol 0.5.1-next.1069.554a2ac → 0.5.1-next.1201.9b49dee
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/protocol.d.ts +12 -12
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js +22 -22
- package/dist/protocol.js.map +1 -1
- package/package.json +4 -4
- package/src/protocol.test.ts +18 -18
- package/src/protocolHost.test.ts +3 -3
package/README.md
CHANGED
|
@@ -13,5 +13,5 @@ Import the supported application-facing API from `@flighthq/protocol`. The `@fli
|
|
|
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/protocol@0.5.1-next.
|
|
17
|
-
- [License](https://github.com/flighthq/flight/blob/
|
|
16
|
+
- [Source for @flighthq/protocol@0.5.1-next.1201.9b49dee](https://github.com/flighthq/flight/tree/9b49dee3f22f6b2838c3d237edcc77bca65734f2/packages/protocol)
|
|
17
|
+
- [License](https://github.com/flighthq/flight/blob/9b49dee3f22f6b2838c3d237edcc77bca65734f2/LICENSE.md)
|
package/dist/protocol.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import type { EntityConstruction,
|
|
2
|
-
export declare function attachProtocolHandler(
|
|
1
|
+
import type { EntityConstruction, HostProtocolDefaultProvider, HostProtocolLaunchProvider, HostProtocolOpenProvider, HostProtocolRegistrationProvider, HostProtocolRegistrationQueryProvider, HostProtocolUnregistrationProvider, ParsedProtocolUrl, ProtocolHandler } from '@flighthq/types/contract';
|
|
2
|
+
export declare function attachProtocolHandler(hostProtocolOpen: Readonly<HostProtocolOpenProvider>, handler: ProtocolHandler): void;
|
|
3
3
|
export declare function createProtocolHandler(): ProtocolHandler;
|
|
4
4
|
export declare function createProtocolUrl(parts: Readonly<Partial<ParsedProtocolUrl>>): string;
|
|
5
5
|
export declare function detachProtocolHandler(handler: ProtocolHandler): void;
|
|
6
6
|
export declare function disposeProtocolHandler(handler: ProtocolHandler): void;
|
|
7
|
-
export declare function getProtocolLaunchUrl(
|
|
8
|
-
export declare function getRegisteredProtocolSchemes(
|
|
7
|
+
export declare function getProtocolLaunchUrl(hostProtocolLaunch: Readonly<HostProtocolLaunchProvider>): string | null;
|
|
8
|
+
export declare function getRegisteredProtocolSchemes(hostProtocolRegistration: Readonly<HostProtocolRegistrationProvider>): readonly string[];
|
|
9
9
|
export declare function initializeProtocolHandler(out: EntityConstruction<ProtocolHandler>): void;
|
|
10
|
-
export declare function isProtocolSchemeDefault(
|
|
11
|
-
export declare function isProtocolSchemeRegistered(
|
|
10
|
+
export declare function isProtocolSchemeDefault(hostProtocolDefault: Readonly<HostProtocolDefaultProvider>, scheme: string): boolean;
|
|
11
|
+
export declare function isProtocolSchemeRegistered(hostProtocolRegistrationQuery: Readonly<HostProtocolRegistrationQueryProvider>, scheme: string): boolean;
|
|
12
12
|
export declare function isValidProtocolScheme(scheme: string): boolean;
|
|
13
13
|
export declare function parseProtocolUrl(url: string): ParsedProtocolUrl | null;
|
|
14
|
-
export declare function registerProtocolScheme(
|
|
15
|
-
export declare function registerProtocolSchemes(
|
|
16
|
-
export declare function removeProtocolSchemeAsDefault(
|
|
17
|
-
export declare function setProtocolSchemeAsDefault(
|
|
18
|
-
export declare function unregisterProtocolScheme(
|
|
19
|
-
export declare function unregisterProtocolSchemes(
|
|
14
|
+
export declare function registerProtocolScheme(hostProtocolRegistration: Readonly<HostProtocolRegistrationProvider>, scheme: string): boolean;
|
|
15
|
+
export declare function registerProtocolSchemes(hostProtocolRegistration: Readonly<HostProtocolRegistrationProvider>, schemes: readonly string[]): boolean;
|
|
16
|
+
export declare function removeProtocolSchemeAsDefault(hostProtocolDefault: Readonly<HostProtocolDefaultProvider>, scheme: string): boolean;
|
|
17
|
+
export declare function setProtocolSchemeAsDefault(hostProtocolDefault: Readonly<HostProtocolDefaultProvider>, scheme: string): boolean;
|
|
18
|
+
export declare function unregisterProtocolScheme(hostProtocolUnregistration: Readonly<HostProtocolUnregistrationProvider>, scheme: string): boolean;
|
|
19
|
+
export declare function unregisterProtocolSchemes(hostProtocolUnregistration: Readonly<HostProtocolUnregistrationProvider>, schemes: readonly string[]): boolean;
|
|
20
20
|
//# sourceMappingURL=protocol.d.ts.map
|
package/dist/protocol.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,kBAAkB,EAClB,2BAA2B,EAC3B,0BAA0B,EAC1B,wBAAwB,EACxB,gCAAgC,EAChC,qCAAqC,EACrC,kCAAkC,EAClC,iBAAiB,EACjB,eAAe,EAChB,MAAM,0BAA0B,CAAC;AAElC,wBAAgB,qBAAqB,CACnC,gBAAgB,EAAE,QAAQ,CAAC,wBAAwB,CAAC,EACpD,OAAO,EAAE,eAAe,GACvB,IAAI,CAON;AAED,wBAAgB,qBAAqB,IAAI,eAAe,CAIvD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,GAAG,MAAM,CAkBrF;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAGpE;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,eAAe,GAAG,IAAI,CAGrE;AAED,wBAAgB,oBAAoB,CAAC,kBAAkB,EAAE,QAAQ,CAAC,0BAA0B,CAAC,GAAG,MAAM,GAAG,IAAI,CAE5G;AAED,wBAAgB,4BAA4B,CAC1C,wBAAwB,EAAE,QAAQ,CAAC,gCAAgC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
1
1
|
import { allocateEntity, finishEntity } from '@flighthq/entity/contract';
|
|
2
2
|
import { clearSignal, createSignal, emitSignal } from '@flighthq/signals/contract';
|
|
3
|
-
export function attachProtocolHandler(
|
|
3
|
+
export function attachProtocolHandler(hostProtocolOpen, handler) {
|
|
4
4
|
detachProtocolHandler(handler);
|
|
5
|
-
const backend =
|
|
5
|
+
const backend = hostProtocolOpen;
|
|
6
6
|
_subscriptions.set(handler, backend.subscribe((url) => emitSignal(handler.onOpenUrl, url)));
|
|
7
7
|
}
|
|
8
8
|
export function createProtocolHandler() {
|
|
@@ -37,20 +37,20 @@ export function disposeProtocolHandler(handler) {
|
|
|
37
37
|
detachProtocolHandler(handler);
|
|
38
38
|
clearSignal(handler.onOpenUrl);
|
|
39
39
|
}
|
|
40
|
-
export function getProtocolLaunchUrl(
|
|
41
|
-
return
|
|
40
|
+
export function getProtocolLaunchUrl(hostProtocolLaunch) {
|
|
41
|
+
return hostProtocolLaunch.getLaunchUrl();
|
|
42
42
|
}
|
|
43
|
-
export function getRegisteredProtocolSchemes(
|
|
44
|
-
return
|
|
43
|
+
export function getRegisteredProtocolSchemes(hostProtocolRegistration) {
|
|
44
|
+
return hostProtocolRegistration.getRegisteredSchemes();
|
|
45
45
|
}
|
|
46
46
|
export function initializeProtocolHandler(out) {
|
|
47
47
|
out.onOpenUrl = createSignal();
|
|
48
48
|
}
|
|
49
|
-
export function isProtocolSchemeDefault(
|
|
50
|
-
return isValidProtocolScheme(scheme) &&
|
|
49
|
+
export function isProtocolSchemeDefault(hostProtocolDefault, scheme) {
|
|
50
|
+
return isValidProtocolScheme(scheme) && hostProtocolDefault.isDefault(scheme);
|
|
51
51
|
}
|
|
52
|
-
export function isProtocolSchemeRegistered(
|
|
53
|
-
return isValidProtocolScheme(scheme) &&
|
|
52
|
+
export function isProtocolSchemeRegistered(hostProtocolRegistrationQuery, scheme) {
|
|
53
|
+
return isValidProtocolScheme(scheme) && hostProtocolRegistrationQuery.isRegistered(scheme);
|
|
54
54
|
}
|
|
55
55
|
export function isValidProtocolScheme(scheme) {
|
|
56
56
|
if (typeof scheme !== 'string' || scheme.length === 0)
|
|
@@ -104,13 +104,13 @@ export function parseProtocolUrl(url) {
|
|
|
104
104
|
}
|
|
105
105
|
return { host, path, query, scheme };
|
|
106
106
|
}
|
|
107
|
-
export function registerProtocolScheme(
|
|
108
|
-
return isValidProtocolScheme(scheme) &&
|
|
107
|
+
export function registerProtocolScheme(hostProtocolRegistration, scheme) {
|
|
108
|
+
return isValidProtocolScheme(scheme) && hostProtocolRegistration.register(scheme);
|
|
109
109
|
}
|
|
110
|
-
export function registerProtocolSchemes(
|
|
110
|
+
export function registerProtocolSchemes(hostProtocolRegistration, schemes) {
|
|
111
111
|
if (!schemes.every(isValidProtocolScheme))
|
|
112
112
|
return false;
|
|
113
|
-
const backend =
|
|
113
|
+
const backend = hostProtocolRegistration;
|
|
114
114
|
let allSucceeded = true;
|
|
115
115
|
for (const scheme of schemes) {
|
|
116
116
|
if (!backend.register(scheme))
|
|
@@ -118,19 +118,19 @@ export function registerProtocolSchemes(host, schemes) {
|
|
|
118
118
|
}
|
|
119
119
|
return allSucceeded;
|
|
120
120
|
}
|
|
121
|
-
export function removeProtocolSchemeAsDefault(
|
|
122
|
-
return isValidProtocolScheme(scheme) &&
|
|
121
|
+
export function removeProtocolSchemeAsDefault(hostProtocolDefault, scheme) {
|
|
122
|
+
return isValidProtocolScheme(scheme) && hostProtocolDefault.removeAsDefault(scheme);
|
|
123
123
|
}
|
|
124
|
-
export function setProtocolSchemeAsDefault(
|
|
125
|
-
return isValidProtocolScheme(scheme) &&
|
|
124
|
+
export function setProtocolSchemeAsDefault(hostProtocolDefault, scheme) {
|
|
125
|
+
return isValidProtocolScheme(scheme) && hostProtocolDefault.setAsDefault(scheme);
|
|
126
126
|
}
|
|
127
|
-
export function unregisterProtocolScheme(
|
|
128
|
-
return isValidProtocolScheme(scheme) &&
|
|
127
|
+
export function unregisterProtocolScheme(hostProtocolUnregistration, scheme) {
|
|
128
|
+
return isValidProtocolScheme(scheme) && hostProtocolUnregistration.unregister(scheme);
|
|
129
129
|
}
|
|
130
|
-
export function unregisterProtocolSchemes(
|
|
130
|
+
export function unregisterProtocolSchemes(hostProtocolUnregistration, schemes) {
|
|
131
131
|
if (!schemes.every(isValidProtocolScheme))
|
|
132
132
|
return false;
|
|
133
|
-
const backend =
|
|
133
|
+
const backend = hostProtocolUnregistration;
|
|
134
134
|
let allSucceeded = true;
|
|
135
135
|
for (const scheme of schemes) {
|
|
136
136
|
if (!backend.unregister(scheme))
|
package/dist/protocol.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAanF,MAAM,UAAU,qBAAqB,
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../src/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAanF,MAAM,UAAU,qBAAqB,CACnC,gBAAoD,EACpD,OAAwB;IAExB,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAC/B,MAAM,OAAO,GAAG,gBAAgB,CAAC;IACjC,cAAc,CAAC,GAAG,CAChB,OAAO,EACP,OAAO,CAAC,SAAS,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,CAC/D,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB;IACnC,MAAM,GAAG,GAAG,cAAc,EAAmB,CAAC;IAC9C,yBAAyB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CAAC;IACxD,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,cAAc,GAAG,sBAAsB,CAAC;AAC9C,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;AACrF,MAAM,cAAc,GAAG,IAAI,OAAO,EAA+B,CAAC;AAElE,SAAS,2BAA2B,CAAC,KAAa;IAChD,IAAI,CAAC;QACH,OAAO,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC;IACvD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flighthq/protocol",
|
|
3
|
-
"version": "0.5.1-next.
|
|
3
|
+
"version": "0.5.1-next.1201.9b49dee",
|
|
4
4
|
"author": "Joshua Granick and other contributors",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"clean:dist": "tsx ../../scripts/clean-package-dist.ts"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@flighthq/entity": "0.5.1-next.
|
|
42
|
-
"@flighthq/signals": "0.5.1-next.
|
|
43
|
-
"@flighthq/types": "0.5.1-next.
|
|
41
|
+
"@flighthq/entity": "0.5.1-next.1201.9b49dee",
|
|
42
|
+
"@flighthq/signals": "0.5.1-next.1201.9b49dee",
|
|
43
|
+
"@flighthq/types": "0.5.1-next.1201.9b49dee"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"typescript": "^5.3.0"
|
package/src/protocol.test.ts
CHANGED
|
@@ -78,8 +78,8 @@ describe('attachProtocolHandler', () => {
|
|
|
78
78
|
const handler = createProtocolHandler();
|
|
79
79
|
const receive = vi.fn();
|
|
80
80
|
connectSignal(handler.onOpenUrl, receive);
|
|
81
|
-
attachProtocolHandler(first.host, handler);
|
|
82
|
-
attachProtocolHandler(second.host, handler);
|
|
81
|
+
attachProtocolHandler(first.host.protocol.open, handler);
|
|
82
|
+
attachProtocolHandler(second.host.protocol.open, handler);
|
|
83
83
|
second.emitOpen('flight://warm-open');
|
|
84
84
|
expect(first.unsubscribe).toHaveBeenCalledOnce();
|
|
85
85
|
expect(receive).toHaveBeenCalledExactlyOnceWith('flight://warm-open');
|
|
@@ -110,7 +110,7 @@ describe('detachProtocolHandler', () => {
|
|
|
110
110
|
it('unsubscribes the current provider exactly once', () => {
|
|
111
111
|
const fixture = createFixture();
|
|
112
112
|
const handler = createProtocolHandler();
|
|
113
|
-
attachProtocolHandler(fixture.host, handler);
|
|
113
|
+
attachProtocolHandler(fixture.host.protocol.open, handler);
|
|
114
114
|
detachProtocolHandler(handler);
|
|
115
115
|
detachProtocolHandler(handler);
|
|
116
116
|
expect(fixture.unsubscribe).toHaveBeenCalledOnce();
|
|
@@ -123,7 +123,7 @@ describe('disposeProtocolHandler', () => {
|
|
|
123
123
|
const handler = createProtocolHandler();
|
|
124
124
|
const receive = vi.fn();
|
|
125
125
|
connectSignal(handler.onOpenUrl, receive);
|
|
126
|
-
attachProtocolHandler(fixture.host, handler);
|
|
126
|
+
attachProtocolHandler(fixture.host.protocol.open, handler);
|
|
127
127
|
disposeProtocolHandler(handler);
|
|
128
128
|
fixture.emitOpen('flight://ignored');
|
|
129
129
|
expect(fixture.unsubscribe).toHaveBeenCalledOnce();
|
|
@@ -133,13 +133,13 @@ describe('disposeProtocolHandler', () => {
|
|
|
133
133
|
|
|
134
134
|
describe('getProtocolLaunchUrl', () => {
|
|
135
135
|
it('returns the cold-start provider fact', () => {
|
|
136
|
-
expect(getProtocolLaunchUrl(createFixture().host)).toBe('flight://cold-start');
|
|
136
|
+
expect(getProtocolLaunchUrl(createFixture().host.protocol.launch)).toBe('flight://cold-start');
|
|
137
137
|
});
|
|
138
138
|
});
|
|
139
139
|
|
|
140
140
|
describe('getRegisteredProtocolSchemes', () => {
|
|
141
141
|
it('returns the provider schemes', () => {
|
|
142
|
-
expect(getRegisteredProtocolSchemes(createFixture().host)).toEqual(['flight']);
|
|
142
|
+
expect(getRegisteredProtocolSchemes(createFixture().host.protocol.registration)).toEqual(['flight']);
|
|
143
143
|
});
|
|
144
144
|
});
|
|
145
145
|
|
|
@@ -151,15 +151,15 @@ describe('initializeProtocolHandler', () => {
|
|
|
151
151
|
describe('isProtocolSchemeDefault', () => {
|
|
152
152
|
it('validates before querying the provider', () => {
|
|
153
153
|
const host = createFixture().host;
|
|
154
|
-
expect(isProtocolSchemeDefault(host, 'flight')).toBe(true);
|
|
155
|
-
expect(isProtocolSchemeDefault(host, 'https')).toBe(false);
|
|
154
|
+
expect(isProtocolSchemeDefault(host.protocol.default, 'flight')).toBe(true);
|
|
155
|
+
expect(isProtocolSchemeDefault(host.protocol.default, 'https')).toBe(false);
|
|
156
156
|
});
|
|
157
157
|
});
|
|
158
158
|
describe('isProtocolSchemeRegistered', () => {
|
|
159
159
|
it('validates before querying the provider', () => {
|
|
160
160
|
const host = createFixture().host;
|
|
161
|
-
expect(isProtocolSchemeRegistered(host, 'flight')).toBe(true);
|
|
162
|
-
expect(isProtocolSchemeRegistered(host, 'https')).toBe(false);
|
|
161
|
+
expect(isProtocolSchemeRegistered(host.protocol.registrationQuery, 'flight')).toBe(true);
|
|
162
|
+
expect(isProtocolSchemeRegistered(host.protocol.registrationQuery, 'https')).toBe(false);
|
|
163
163
|
});
|
|
164
164
|
});
|
|
165
165
|
describe('isValidProtocolScheme', () => {
|
|
@@ -187,46 +187,46 @@ describe('parseProtocolUrl', () => {
|
|
|
187
187
|
describe('registerProtocolScheme', () => {
|
|
188
188
|
it('delegates a valid scheme', () => {
|
|
189
189
|
const { calls, host } = createFixture();
|
|
190
|
-
expect(registerProtocolScheme(host, 'flight')).toBe(true);
|
|
190
|
+
expect(registerProtocolScheme(host.protocol.registration, 'flight')).toBe(true);
|
|
191
191
|
expect(calls).toEqual(['register:flight']);
|
|
192
192
|
});
|
|
193
193
|
});
|
|
194
194
|
describe('registerProtocolSchemes', () => {
|
|
195
195
|
it('prevalidates the full batch and aggregates provider outcomes', () => {
|
|
196
196
|
const fixture = createFixture();
|
|
197
|
-
expect(registerProtocolSchemes(fixture.host, ['flight', 'https'])).toBe(false);
|
|
197
|
+
expect(registerProtocolSchemes(fixture.host.protocol.registration, ['flight', 'https'])).toBe(false);
|
|
198
198
|
expect(fixture.calls).toEqual([]);
|
|
199
|
-
expect(registerProtocolSchemes(fixture.host, ['flight', 'fail'])).toBe(false);
|
|
199
|
+
expect(registerProtocolSchemes(fixture.host.protocol.registration, ['flight', 'fail'])).toBe(false);
|
|
200
200
|
expect(fixture.calls).toEqual(['register:flight', 'register:fail']);
|
|
201
201
|
});
|
|
202
202
|
});
|
|
203
203
|
describe('removeProtocolSchemeAsDefault', () => {
|
|
204
204
|
it('delegates a valid scheme', () => {
|
|
205
205
|
const { calls, host } = createFixture();
|
|
206
|
-
expect(removeProtocolSchemeAsDefault(host, 'flight')).toBe(true);
|
|
206
|
+
expect(removeProtocolSchemeAsDefault(host.protocol.default, 'flight')).toBe(true);
|
|
207
207
|
expect(calls).toEqual(['removeDefault:flight']);
|
|
208
208
|
});
|
|
209
209
|
});
|
|
210
210
|
describe('setProtocolSchemeAsDefault', () => {
|
|
211
211
|
it('delegates a valid scheme', () => {
|
|
212
212
|
const { calls, host } = createFixture();
|
|
213
|
-
expect(setProtocolSchemeAsDefault(host, 'flight')).toBe(true);
|
|
213
|
+
expect(setProtocolSchemeAsDefault(host.protocol.default, 'flight')).toBe(true);
|
|
214
214
|
expect(calls).toEqual(['default:flight']);
|
|
215
215
|
});
|
|
216
216
|
});
|
|
217
217
|
describe('unregisterProtocolScheme', () => {
|
|
218
218
|
it('delegates a valid scheme', () => {
|
|
219
219
|
const { calls, host } = createFixture();
|
|
220
|
-
expect(unregisterProtocolScheme(host, 'flight')).toBe(true);
|
|
220
|
+
expect(unregisterProtocolScheme(host.protocol.unregistration, 'flight')).toBe(true);
|
|
221
221
|
expect(calls).toEqual(['unregister:flight']);
|
|
222
222
|
});
|
|
223
223
|
});
|
|
224
224
|
describe('unregisterProtocolSchemes', () => {
|
|
225
225
|
it('prevalidates the full batch and aggregates provider outcomes', () => {
|
|
226
226
|
const fixture = createFixture();
|
|
227
|
-
expect(unregisterProtocolSchemes(fixture.host, ['flight', 'https'])).toBe(false);
|
|
227
|
+
expect(unregisterProtocolSchemes(fixture.host.protocol.unregistration, ['flight', 'https'])).toBe(false);
|
|
228
228
|
expect(fixture.calls).toEqual([]);
|
|
229
|
-
expect(unregisterProtocolSchemes(fixture.host, ['flight', 'fail'])).toBe(false);
|
|
229
|
+
expect(unregisterProtocolSchemes(fixture.host.protocol.unregistration, ['flight', 'fail'])).toBe(false);
|
|
230
230
|
expect(fixture.calls).toEqual(['unregister:flight', 'unregister:fail']);
|
|
231
231
|
});
|
|
232
232
|
});
|
package/src/protocolHost.test.ts
CHANGED
|
@@ -26,8 +26,8 @@ describe('protocol explicit Host ownership', () => {
|
|
|
26
26
|
},
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
-
expect(Reflect.apply(registerProtocolScheme, undefined, [host, 'flight'])).toBe(true);
|
|
30
|
-
expect(Reflect.apply(getProtocolLaunchUrl, undefined, [host])).toBe('flight://cold-start');
|
|
29
|
+
expect(Reflect.apply(registerProtocolScheme, undefined, [host.protocol.registration, 'flight'])).toBe(true);
|
|
30
|
+
expect(Reflect.apply(getProtocolLaunchUrl, undefined, [host.protocol.launch])).toBe('flight://cold-start');
|
|
31
31
|
expect(register).toHaveBeenCalledExactlyOnceWith('flight');
|
|
32
32
|
expect(getLaunchUrl).toHaveBeenCalledOnce();
|
|
33
33
|
});
|
|
@@ -51,7 +51,7 @@ describe('protocol explicit Host ownership', () => {
|
|
|
51
51
|
let received = '';
|
|
52
52
|
connectSignal(handler.onOpenUrl, (url) => (received = url));
|
|
53
53
|
|
|
54
|
-
Reflect.apply(attachProtocolHandler, undefined, [host, handler]);
|
|
54
|
+
Reflect.apply(attachProtocolHandler, undefined, [host.protocol.open, handler]);
|
|
55
55
|
listeners.open?.('flight://warm-open');
|
|
56
56
|
|
|
57
57
|
expect(subscribe).toHaveBeenCalledOnce();
|