@shakerquiz/utilities 0.3.5 → 0.3.7
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/package.json +7 -1
- package/source/enumerations/features.d.ts +2 -3
- package/source/enumerations/features.js +168 -40
- package/source/enumerations/services.d.ts +1 -0
- package/source/enumerations/services.js +4 -0
- package/source/functions/fetch.d.ts +4 -1
- package/source/functions/fetch.js +39 -23
- package/source/functions/origin.js +29 -29
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shakerquiz/utilities",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"author": "yurkimus <yurkimus@gmail.com>",
|
|
5
5
|
"license": "ISC",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"type": "rm -rf ./source/enumerations/*.d.ts && rm -rf ./source/functions/*.d.ts && tsc --allowjs --emitdeclarationonly --declaration ./source/*.js"
|
|
8
|
+
},
|
|
6
9
|
"exports": {
|
|
7
10
|
".": {
|
|
8
11
|
"node": "./source/index.js",
|
|
@@ -19,5 +22,8 @@
|
|
|
19
22
|
"@yurkimus/response-status": "0.1.1",
|
|
20
23
|
"@yurkimus/url": "0.2.8",
|
|
21
24
|
"urlpattern-polyfill": "10.0.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"typescript": "5.8.2"
|
|
22
28
|
}
|
|
23
29
|
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { URLOptions } from "@yurkimus/url";
|
|
2
|
-
|
|
3
1
|
export namespace Features {
|
|
4
2
|
let Checkin: "Checkin";
|
|
5
3
|
let Cities: "Cities";
|
|
@@ -23,6 +21,7 @@ export namespace Features {
|
|
|
23
21
|
}
|
|
24
22
|
export namespace ServiceFeatures {
|
|
25
23
|
export let Admin: ("Checkin" | "Games" | "Users" | "Cities" | "City" | "Countries" | "Country" | "Exception" | "Game" | "Home" | "Region" | "Regions" | "Registration" | "Registrations" | "Theme" | "Themes" | "User" | "Venue" | "Venues")[];
|
|
24
|
+
export let Backend: ("Checkin" | "Games" | "Users" | "Cities" | "City" | "Game" | "Home" | "Registration" | "Registrations" | "Theme" | "Themes" | "User" | "Venue" | "Venues")[];
|
|
26
25
|
let Games_1: ("Games" | "Game" | "Home" | "Registration" | "Registrations" | "Theme" | "Themes")[];
|
|
27
26
|
export { Games_1 as Games };
|
|
28
27
|
export let Landing: ("Games" | "Exception" | "Game" | "Home" | "Registration")[];
|
|
@@ -399,4 +398,4 @@ export const ServiceNetworkOrigins: Map<Service, Map<Network, string>>;
|
|
|
399
398
|
/**
|
|
400
399
|
* @type {Map<Service, Map<Feature, Map<Network, Nullable<(options?: import('@yurkimus/url').URLOptions) => URL>>>>}
|
|
401
400
|
*/
|
|
402
|
-
export const ServiceFeatureNetworkURLs: Map<Service, Map<Feature, Map<Network, Nullable<(options?:
|
|
401
|
+
export const ServiceFeatureNetworkURLs: Map<Service, Map<Feature, Map<Network, Nullable<(options?: any) => URL>>>>;
|
|
@@ -49,6 +49,23 @@ export var ServiceFeatures = {
|
|
|
49
49
|
Features.Venues,
|
|
50
50
|
],
|
|
51
51
|
|
|
52
|
+
[Services.Backend]: [
|
|
53
|
+
Features.Checkin,
|
|
54
|
+
Features.Cities,
|
|
55
|
+
Features.City,
|
|
56
|
+
Features.Game,
|
|
57
|
+
Features.Games,
|
|
58
|
+
Features.Home,
|
|
59
|
+
Features.Registration,
|
|
60
|
+
Features.Registrations,
|
|
61
|
+
Features.Theme,
|
|
62
|
+
Features.Themes,
|
|
63
|
+
Features.User,
|
|
64
|
+
Features.Users,
|
|
65
|
+
Features.Venue,
|
|
66
|
+
Features.Venues,
|
|
67
|
+
],
|
|
68
|
+
|
|
52
69
|
[Services.Games]: [
|
|
53
70
|
Features.Game,
|
|
54
71
|
Features.Games,
|
|
@@ -308,6 +325,13 @@ export var ServiceNetworkOrigins = new Map([
|
|
|
308
325
|
[Networks.Public, ''],
|
|
309
326
|
]),
|
|
310
327
|
],
|
|
328
|
+
[
|
|
329
|
+
Services.Backend,
|
|
330
|
+
new Map([
|
|
331
|
+
[Networks.Docker, ''],
|
|
332
|
+
[Networks.Public, ''],
|
|
333
|
+
]),
|
|
334
|
+
],
|
|
311
335
|
[
|
|
312
336
|
Services.Games,
|
|
313
337
|
new Map([
|
|
@@ -488,6 +512,110 @@ export var ServiceFeatureNetworkURLs = new Map([
|
|
|
488
512
|
]),
|
|
489
513
|
],
|
|
490
514
|
|
|
515
|
+
[
|
|
516
|
+
Services.Admin,
|
|
517
|
+
new Map([
|
|
518
|
+
[
|
|
519
|
+
Features.Checkin,
|
|
520
|
+
new Map([
|
|
521
|
+
[Networks.Docker, null],
|
|
522
|
+
[Networks.Public, null],
|
|
523
|
+
]),
|
|
524
|
+
],
|
|
525
|
+
[
|
|
526
|
+
Features.Cities,
|
|
527
|
+
new Map([
|
|
528
|
+
[Networks.Docker, null],
|
|
529
|
+
[Networks.Public, null],
|
|
530
|
+
]),
|
|
531
|
+
],
|
|
532
|
+
[
|
|
533
|
+
Features.City,
|
|
534
|
+
new Map([
|
|
535
|
+
[Networks.Docker, null],
|
|
536
|
+
[Networks.Public, null],
|
|
537
|
+
]),
|
|
538
|
+
],
|
|
539
|
+
[
|
|
540
|
+
Features.Game,
|
|
541
|
+
new Map([
|
|
542
|
+
[Networks.Docker, null],
|
|
543
|
+
[Networks.Public, null],
|
|
544
|
+
]),
|
|
545
|
+
],
|
|
546
|
+
[
|
|
547
|
+
Features.Games,
|
|
548
|
+
new Map([
|
|
549
|
+
[Networks.Docker, null],
|
|
550
|
+
[Networks.Public, null],
|
|
551
|
+
]),
|
|
552
|
+
],
|
|
553
|
+
[
|
|
554
|
+
Features.Home,
|
|
555
|
+
new Map([
|
|
556
|
+
[Networks.Docker, null],
|
|
557
|
+
[Networks.Public, null],
|
|
558
|
+
]),
|
|
559
|
+
],
|
|
560
|
+
[
|
|
561
|
+
Features.Registration,
|
|
562
|
+
new Map([
|
|
563
|
+
[Networks.Docker, null],
|
|
564
|
+
[Networks.Public, null],
|
|
565
|
+
]),
|
|
566
|
+
],
|
|
567
|
+
[
|
|
568
|
+
Features.Registrations,
|
|
569
|
+
new Map([
|
|
570
|
+
[Networks.Docker, null],
|
|
571
|
+
[Networks.Public, null],
|
|
572
|
+
]),
|
|
573
|
+
],
|
|
574
|
+
[
|
|
575
|
+
Features.Theme,
|
|
576
|
+
new Map([
|
|
577
|
+
[Networks.Docker, null],
|
|
578
|
+
[Networks.Public, null],
|
|
579
|
+
]),
|
|
580
|
+
],
|
|
581
|
+
[
|
|
582
|
+
Features.Themes,
|
|
583
|
+
new Map([
|
|
584
|
+
[Networks.Docker, null],
|
|
585
|
+
[Networks.Public, null],
|
|
586
|
+
]),
|
|
587
|
+
],
|
|
588
|
+
[
|
|
589
|
+
Features.User,
|
|
590
|
+
new Map([
|
|
591
|
+
[Networks.Docker, null],
|
|
592
|
+
[Networks.Public, null],
|
|
593
|
+
]),
|
|
594
|
+
],
|
|
595
|
+
[
|
|
596
|
+
Features.Users,
|
|
597
|
+
new Map([
|
|
598
|
+
[Networks.Docker, null],
|
|
599
|
+
[Networks.Public, null],
|
|
600
|
+
]),
|
|
601
|
+
],
|
|
602
|
+
[
|
|
603
|
+
Features.Venue,
|
|
604
|
+
new Map([
|
|
605
|
+
[Networks.Docker, null],
|
|
606
|
+
[Networks.Public, null],
|
|
607
|
+
]),
|
|
608
|
+
],
|
|
609
|
+
[
|
|
610
|
+
Features.Venues,
|
|
611
|
+
new Map([
|
|
612
|
+
[Networks.Docker, null],
|
|
613
|
+
[Networks.Public, null],
|
|
614
|
+
]),
|
|
615
|
+
],
|
|
616
|
+
]),
|
|
617
|
+
],
|
|
618
|
+
|
|
491
619
|
[
|
|
492
620
|
Services.Games,
|
|
493
621
|
new Map([
|
|
@@ -556,29 +684,29 @@ export var ServiceFeatureNetworkURLs = new Map([
|
|
|
556
684
|
[
|
|
557
685
|
Features.Game,
|
|
558
686
|
new Map([
|
|
559
|
-
[Networks.Docker,
|
|
560
|
-
[Networks.Public,
|
|
687
|
+
[Networks.Docker, null],
|
|
688
|
+
[Networks.Public, null],
|
|
561
689
|
]),
|
|
562
690
|
],
|
|
563
691
|
[
|
|
564
692
|
Features.Games,
|
|
565
693
|
new Map([
|
|
566
|
-
[Networks.Docker,
|
|
567
|
-
[Networks.Public,
|
|
694
|
+
[Networks.Docker, null],
|
|
695
|
+
[Networks.Public, null],
|
|
568
696
|
]),
|
|
569
697
|
],
|
|
570
698
|
[
|
|
571
699
|
Features.Home,
|
|
572
700
|
new Map([
|
|
573
|
-
[Networks.Docker,
|
|
574
|
-
[Networks.Public,
|
|
701
|
+
[Networks.Docker, null],
|
|
702
|
+
[Networks.Public, null],
|
|
575
703
|
]),
|
|
576
704
|
],
|
|
577
705
|
[
|
|
578
706
|
Features.Registration,
|
|
579
707
|
new Map([
|
|
580
|
-
[Networks.Docker,
|
|
581
|
-
[Networks.Public,
|
|
708
|
+
[Networks.Docker, null],
|
|
709
|
+
[Networks.Public, null],
|
|
582
710
|
]),
|
|
583
711
|
],
|
|
584
712
|
]),
|
|
@@ -590,64 +718,64 @@ export var ServiceFeatureNetworkURLs = new Map([
|
|
|
590
718
|
[
|
|
591
719
|
Features.Cities,
|
|
592
720
|
new Map([
|
|
593
|
-
[Networks.Docker,
|
|
594
|
-
[Networks.Public,
|
|
721
|
+
[Networks.Docker, null],
|
|
722
|
+
[Networks.Public, null],
|
|
595
723
|
]),
|
|
596
724
|
],
|
|
597
725
|
[
|
|
598
726
|
Features.City,
|
|
599
727
|
new Map([
|
|
600
|
-
[Networks.Docker,
|
|
601
|
-
[Networks.Public,
|
|
728
|
+
[Networks.Docker, null],
|
|
729
|
+
[Networks.Public, null],
|
|
602
730
|
]),
|
|
603
731
|
],
|
|
604
732
|
[
|
|
605
733
|
Features.Countries,
|
|
606
734
|
new Map([
|
|
607
|
-
[Networks.Docker,
|
|
608
|
-
[Networks.Public,
|
|
735
|
+
[Networks.Docker, null],
|
|
736
|
+
[Networks.Public, null],
|
|
609
737
|
]),
|
|
610
738
|
],
|
|
611
739
|
[
|
|
612
740
|
Features.Country,
|
|
613
741
|
new Map([
|
|
614
|
-
[Networks.Docker,
|
|
615
|
-
[Networks.Public,
|
|
742
|
+
[Networks.Docker, null],
|
|
743
|
+
[Networks.Public, null],
|
|
616
744
|
]),
|
|
617
745
|
],
|
|
618
746
|
[
|
|
619
747
|
Features.Home,
|
|
620
748
|
new Map([
|
|
621
|
-
[Networks.Docker,
|
|
622
|
-
[Networks.Public,
|
|
749
|
+
[Networks.Docker, null],
|
|
750
|
+
[Networks.Public, null],
|
|
623
751
|
]),
|
|
624
752
|
],
|
|
625
753
|
[
|
|
626
754
|
Features.Region,
|
|
627
755
|
new Map([
|
|
628
|
-
[Networks.Docker,
|
|
629
|
-
[Networks.Public,
|
|
756
|
+
[Networks.Docker, null],
|
|
757
|
+
[Networks.Public, null],
|
|
630
758
|
]),
|
|
631
759
|
],
|
|
632
760
|
[
|
|
633
761
|
Features.Regions,
|
|
634
762
|
new Map([
|
|
635
|
-
[Networks.Docker,
|
|
636
|
-
[Networks.Public,
|
|
763
|
+
[Networks.Docker, null],
|
|
764
|
+
[Networks.Public, null],
|
|
637
765
|
]),
|
|
638
766
|
],
|
|
639
767
|
[
|
|
640
768
|
Features.Venue,
|
|
641
769
|
new Map([
|
|
642
|
-
[Networks.Docker,
|
|
643
|
-
[Networks.Public,
|
|
770
|
+
[Networks.Docker, null],
|
|
771
|
+
[Networks.Public, null],
|
|
644
772
|
]),
|
|
645
773
|
],
|
|
646
774
|
[
|
|
647
775
|
Features.Venues,
|
|
648
776
|
new Map([
|
|
649
|
-
[Networks.Docker,
|
|
650
|
-
[Networks.Public,
|
|
777
|
+
[Networks.Docker, null],
|
|
778
|
+
[Networks.Public, null],
|
|
651
779
|
]),
|
|
652
780
|
],
|
|
653
781
|
]),
|
|
@@ -666,29 +794,29 @@ export var ServiceFeatureNetworkURLs = new Map([
|
|
|
666
794
|
[
|
|
667
795
|
Features.Game,
|
|
668
796
|
new Map([
|
|
669
|
-
[Networks.Docker,
|
|
670
|
-
[Networks.Public,
|
|
797
|
+
[Networks.Docker, null],
|
|
798
|
+
[Networks.Public, null],
|
|
671
799
|
]),
|
|
672
800
|
],
|
|
673
801
|
[
|
|
674
802
|
Features.Games,
|
|
675
803
|
new Map([
|
|
676
|
-
[Networks.Docker,
|
|
677
|
-
[Networks.Public,
|
|
804
|
+
[Networks.Docker, null],
|
|
805
|
+
[Networks.Public, null],
|
|
678
806
|
]),
|
|
679
807
|
],
|
|
680
808
|
[
|
|
681
809
|
Features.Home,
|
|
682
810
|
new Map([
|
|
683
|
-
[Networks.Docker,
|
|
684
|
-
[Networks.Public,
|
|
811
|
+
[Networks.Docker, null],
|
|
812
|
+
[Networks.Public, null],
|
|
685
813
|
]),
|
|
686
814
|
],
|
|
687
815
|
[
|
|
688
816
|
Features.Registration,
|
|
689
817
|
new Map([
|
|
690
|
-
[Networks.Docker,
|
|
691
|
-
[Networks.Public,
|
|
818
|
+
[Networks.Docker, null],
|
|
819
|
+
[Networks.Public, null],
|
|
692
820
|
]),
|
|
693
821
|
],
|
|
694
822
|
]),
|
|
@@ -700,8 +828,8 @@ export var ServiceFeatureNetworkURLs = new Map([
|
|
|
700
828
|
[
|
|
701
829
|
Features.Checkin,
|
|
702
830
|
new Map([
|
|
703
|
-
[Networks.Docker,
|
|
704
|
-
[Networks.Public,
|
|
831
|
+
[Networks.Docker, null],
|
|
832
|
+
[Networks.Public, null],
|
|
705
833
|
]),
|
|
706
834
|
],
|
|
707
835
|
[
|
|
@@ -714,15 +842,15 @@ export var ServiceFeatureNetworkURLs = new Map([
|
|
|
714
842
|
[
|
|
715
843
|
Features.User,
|
|
716
844
|
new Map([
|
|
717
|
-
[Networks.Docker,
|
|
718
|
-
[Networks.Public,
|
|
845
|
+
[Networks.Docker, null],
|
|
846
|
+
[Networks.Public, null],
|
|
719
847
|
]),
|
|
720
848
|
],
|
|
721
849
|
[
|
|
722
850
|
Features.Users,
|
|
723
851
|
new Map([
|
|
724
|
-
[Networks.Docker,
|
|
725
|
-
[Networks.Public,
|
|
852
|
+
[Networks.Docker, null],
|
|
853
|
+
[Networks.Public, null],
|
|
726
854
|
]),
|
|
727
855
|
],
|
|
728
856
|
]),
|
|
@@ -3,6 +3,10 @@ export var Services = /** @type {const} */ ({
|
|
|
3
3
|
* @description Frontend-service representing tools for managing and creating content.
|
|
4
4
|
*/
|
|
5
5
|
Admin: 'Admin',
|
|
6
|
+
/**
|
|
7
|
+
* @description Legacy backend-service in Python.
|
|
8
|
+
*/
|
|
9
|
+
Backend: 'Backend',
|
|
6
10
|
/**
|
|
7
11
|
* @description Backend-service manipulating Theme, Game and Registration.
|
|
8
12
|
*/
|
|
@@ -4,10 +4,13 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* @typedef {WeakMap<Function, Map<ExtensionHooks, Set<Function>>>} Extensions
|
|
6
6
|
*/
|
|
7
|
+
|
|
8
|
+
import { URLOptions } from "@yurkimus/url";
|
|
9
|
+
|
|
7
10
|
/**
|
|
8
11
|
* @type {Extensions}
|
|
9
12
|
*/
|
|
10
13
|
export const extensions: Extensions;
|
|
11
|
-
export function useFetch<S extends Service, F extends typeof import("../enumerations/features.js").ServiceFeatures[S][number], N extends Network>(service: S, feature: F, network: N): <M extends RequestMethod = "GET", R extends Role = "default">(options:
|
|
14
|
+
export function useFetch<S extends Service, F extends typeof import("../enumerations/features.js").ServiceFeatures[S][number], N extends Network>(service: S, feature: F, network: N): <M extends RequestMethod = "GET", R extends Role = "default">(options: URLOptions | undefined, init: RequestInit) => Promise<FetchResults[S][F][M][R]>;
|
|
12
15
|
export type ExtensionHooks = "onbefore" | "onfulfilled" | "onrejected";
|
|
13
16
|
export type Extensions = WeakMap<Function, Map<ExtensionHooks, Set<Function>>>;
|
|
@@ -52,6 +52,16 @@ var handleMessage = (feature, [response, body]) => {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/**
|
|
56
|
+
* @param {Function} fetcher
|
|
57
|
+
* @param {ExtensionHooks} name
|
|
58
|
+
* @param {any} value
|
|
59
|
+
*/
|
|
60
|
+
var extensionHook = (fetcher, name, value) =>
|
|
61
|
+
Array
|
|
62
|
+
.from(extensions.get(fetcher).get(name))
|
|
63
|
+
.reduce((x, f) => f(x), value)
|
|
64
|
+
|
|
55
65
|
/**
|
|
56
66
|
* @template {Service} S
|
|
57
67
|
* @template {typeof import('../enumerations/features.js').ServiceFeatures[S][number]} F
|
|
@@ -61,7 +71,7 @@ var handleMessage = (feature, [response, body]) => {
|
|
|
61
71
|
* @param {F} feature
|
|
62
72
|
* @param {N} network
|
|
63
73
|
*/
|
|
64
|
-
export var useFetch = (service, feature, network) =>
|
|
74
|
+
export var useFetch = (service, feature, network) => {
|
|
65
75
|
/**
|
|
66
76
|
* @template {RequestMethod} [M='GET']
|
|
67
77
|
* @template {Role} [R='default']
|
|
@@ -71,7 +81,7 @@ export var useFetch = (service, feature, network) =>
|
|
|
71
81
|
*
|
|
72
82
|
* @returns {Promise<FetchResults[S][F][M][R]>}
|
|
73
83
|
*/
|
|
74
|
-
|
|
84
|
+
var fetcher = (options, init) => {
|
|
75
85
|
if (!(service in Services))
|
|
76
86
|
throw TypeError(
|
|
77
87
|
`Service '${service}' is not listed in 'Services'.`,
|
|
@@ -122,15 +132,6 @@ export var useFetch = (service, feature, network) =>
|
|
|
122
132
|
`Network '${network}' of 'ServiceFeatureNetworkURLs[${service}][${feature}]' has no value.`,
|
|
123
133
|
)
|
|
124
134
|
|
|
125
|
-
extensions.set(
|
|
126
|
-
fetcher,
|
|
127
|
-
new Map([
|
|
128
|
-
['onbefore', new Set([])],
|
|
129
|
-
['onfulfilled', new Set([])],
|
|
130
|
-
['onrejected', new Set([])],
|
|
131
|
-
]),
|
|
132
|
-
)
|
|
133
|
-
|
|
134
135
|
var url = ServiceFeatureNetworkURLs
|
|
135
136
|
.get(service)
|
|
136
137
|
.get(feature)
|
|
@@ -151,18 +152,13 @@ export var useFetch = (service, feature, network) =>
|
|
|
151
152
|
'application/json',
|
|
152
153
|
)
|
|
153
154
|
|
|
154
|
-
/**
|
|
155
|
-
* @param {ExtensionHooks} name
|
|
156
|
-
* @param {any} value
|
|
157
|
-
*/
|
|
158
|
-
var hook = (name, value) =>
|
|
159
|
-
Array
|
|
160
|
-
.from(extensions.get(fetcher).get(name))
|
|
161
|
-
.reduce((x, f) => f(x), value)
|
|
162
|
-
|
|
163
155
|
return new Promise((resolve, reject) => {
|
|
164
156
|
try {
|
|
165
|
-
resolve(
|
|
157
|
+
resolve(extensionHook(
|
|
158
|
+
fetcher,
|
|
159
|
+
'onbefore',
|
|
160
|
+
request,
|
|
161
|
+
))
|
|
166
162
|
} catch (reason) {
|
|
167
163
|
reject(reason)
|
|
168
164
|
}
|
|
@@ -170,6 +166,26 @@ export var useFetch = (service, feature, network) =>
|
|
|
170
166
|
.then(fetch)
|
|
171
167
|
.then(message.read)
|
|
172
168
|
.then(handleMessage.bind(undefined, feature))
|
|
173
|
-
.then(
|
|
174
|
-
|
|
169
|
+
.then(extensionHook.bind(
|
|
170
|
+
undefined,
|
|
171
|
+
fetcher,
|
|
172
|
+
'onfulfilled',
|
|
173
|
+
))
|
|
174
|
+
.catch(extensionHook.bind(
|
|
175
|
+
undefined,
|
|
176
|
+
fetcher,
|
|
177
|
+
'onrejected',
|
|
178
|
+
))
|
|
175
179
|
}
|
|
180
|
+
|
|
181
|
+
extensions.set(
|
|
182
|
+
fetcher,
|
|
183
|
+
new Map([
|
|
184
|
+
['onbefore', new Set([])],
|
|
185
|
+
['onfulfilled', new Set([])],
|
|
186
|
+
['onrejected', new Set([])],
|
|
187
|
+
]),
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
return fetcher
|
|
191
|
+
}
|
|
@@ -28,40 +28,40 @@ export var setServiceNetworkOrigins = origins => {
|
|
|
28
28
|
`Network '${network}' must be listed in 'Networks'.`,
|
|
29
29
|
)
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
var origin = origins[service][network]
|
|
32
|
+
|
|
33
|
+
ServiceNetworkOrigins
|
|
34
|
+
.get(service)
|
|
35
|
+
.set(network, origin)
|
|
35
36
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
for (var feature of ServiceFeatures[service]) {
|
|
38
|
+
if (!(feature in Features))
|
|
39
|
+
throw TypeError(
|
|
40
|
+
`Feature '${feature}' must be listed in 'Features'.`,
|
|
41
|
+
)
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
if (!(feature in FeaturePathnames))
|
|
44
|
+
throw TypeError(
|
|
45
|
+
`Feature '${feature}' must be listed in 'FeaturePathnames'.`,
|
|
46
|
+
)
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
if (!ServiceFeatureNetworkURLs.has(service))
|
|
49
|
+
throw TypeError(
|
|
50
|
+
`Service '${service}' must be listed in 'ServiceFeatureNetworkURLs'.`,
|
|
51
|
+
)
|
|
51
52
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
if (!ServiceFeatureNetworkURLs.get(service).has(feature))
|
|
54
|
+
throw TypeError(
|
|
55
|
+
`Feature '${feature}' must be listed in 'ServiceFeatureNetworkURLs[${service}]'.`,
|
|
56
|
+
)
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
58
|
+
ServiceFeatureNetworkURLs
|
|
59
|
+
.get(service)
|
|
60
|
+
.get(feature)
|
|
61
|
+
.set(
|
|
62
|
+
network,
|
|
63
|
+
url.bind(undefined, origin, FeaturePathnames[feature]),
|
|
64
|
+
)
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
}
|