@komaci/prefetch 242.1.9 → 242.2.0
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/build/__mocks__/@lwrjs/router.js +8 -0
- package/build/__mocks__/lwr/router.js +8 -0
- package/build/__mocks__/mockAdgModule.d.ts +1 -1
- package/build/__mocks__/mockAdgModule.js +11 -0
- package/build/__mocks__/o11y/client.js +15 -0
- package/build/__mocks__/o11y_schema/sf_komaci.js +6 -0
- package/build/modules/komaci/prefetch/prefetch.js +46 -46
- package/build/modules/komaci/prefetchService/prefetchService.js +416 -482
- package/build/modules/komaci/prefetchTypes/prefetchTypes.js +16 -24
- package/package.json +5 -5
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const _default: import("
|
|
1
|
+
declare const _default: import("komaci/resolverTypes").AdgModuleHandle | undefined;
|
|
2
2
|
export default _default;
|
|
3
3
|
//# sourceMappingURL=mockAdgModule.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import registerAdgFunction from 'komaci/registerAdgFunction';
|
|
2
|
+
const emptyAdg = {
|
|
3
|
+
parentClass: undefined,
|
|
4
|
+
properties: {},
|
|
5
|
+
functions: [],
|
|
6
|
+
composition: () => [],
|
|
7
|
+
};
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9
|
+
const adgFunction = (fct) => emptyAdg;
|
|
10
|
+
export default registerAdgFunction(adgFunction);
|
|
11
|
+
//# sourceMappingURL=mockAdgModule.js.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2
|
+
const mockInstrumentObj = {
|
|
3
|
+
log: jest.fn(),
|
|
4
|
+
error: jest.fn(),
|
|
5
|
+
trackValue: jest.fn(),
|
|
6
|
+
startActivity: jest.fn().mockImplementation((name) => ({
|
|
7
|
+
stop: jest.fn(),
|
|
8
|
+
error: jest.fn(),
|
|
9
|
+
})),
|
|
10
|
+
incrementCounter: jest.fn(),
|
|
11
|
+
};
|
|
12
|
+
export const getInstrumentation = jest
|
|
13
|
+
.fn()
|
|
14
|
+
.mockImplementation((name) => mockInstrumentObj);
|
|
15
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -4,51 +4,51 @@ import { createRouter } from 'lwr/router';
|
|
|
4
4
|
// NOTE: Backward compatible prefetch until primer is updated to handle this.
|
|
5
5
|
// TODO W-9690128 - Let's potentially remove this prefetch method and update lsdk code to call `getPrefetchState` directly.
|
|
6
6
|
export function prefetch(routes = [], pageReferences = [], config) {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
7
|
+
if (!(routes === null || routes === void 0 ? void 0 : routes.length) || !(pageReferences === null || pageReferences === void 0 ? void 0 : pageReferences.length)) {
|
|
8
|
+
return Promise.resolve([]);
|
|
9
|
+
}
|
|
10
|
+
const router = createRouter({
|
|
11
|
+
routes,
|
|
12
|
+
});
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
let currentState;
|
|
15
|
+
const addressesProcessed = [];
|
|
16
|
+
const wrappedConfig = {
|
|
17
|
+
maxConcurrent: config === null || config === void 0 ? void 0 : config.maxConcurrent,
|
|
18
|
+
onAddressProcessed: (status) => {
|
|
19
|
+
addressesProcessed.push(status);
|
|
20
|
+
if (config && config.onAddressProcessed)
|
|
21
|
+
config.onAddressProcessed(status);
|
|
22
|
+
},
|
|
23
|
+
onStateChanged: (status) => {
|
|
24
|
+
const { state } = status;
|
|
25
|
+
if (state === 'running') {
|
|
26
|
+
if (!currentState) {
|
|
27
|
+
currentState = state;
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
reject(new Error(`Unexpected state transition. ${currentState} -> ${state}`));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else if (state === 'done') {
|
|
34
|
+
if (addressesProcessed.length !== pageReferences.length) {
|
|
35
|
+
reject(new Error(`Prefetch error, expected ${pageReferences.length} addresses processed, but only got ${addressesProcessed.length}`));
|
|
36
|
+
}
|
|
37
|
+
resolve(addressesProcessed);
|
|
38
|
+
}
|
|
39
|
+
else if (state === 'error') {
|
|
40
|
+
reject(new Error(`Prefetch error: ${status.message}`));
|
|
41
|
+
}
|
|
42
|
+
if (config && config.onStateChanged)
|
|
43
|
+
config.onStateChanged(status);
|
|
44
|
+
},
|
|
45
|
+
instrumentationContext: config === null || config === void 0 ? void 0 : config.instrumentationContext,
|
|
46
|
+
downloadImage: config === null || config === void 0 ? void 0 : config.downloadImage,
|
|
47
|
+
};
|
|
48
|
+
getPrefetchService(router, pageReferences, wrappedConfig);
|
|
49
|
+
});
|
|
51
50
|
}
|
|
52
51
|
export function getPrefetchService(router, addresses, config) {
|
|
53
|
-
|
|
54
|
-
}
|
|
52
|
+
return new PrefetchService(router, addresses, config);
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=prefetch.js.map
|
|
@@ -1,509 +1,443 @@
|
|
|
1
|
-
import { ERROR_PREFIX, PrefetchStatusStates as STATE } from 'komaci/prefetchTypes';
|
|
1
|
+
import { ERROR_PREFIX, PrefetchStatusStates as STATE, } from 'komaci/prefetchTypes';
|
|
2
2
|
import { getInstrumentation } from 'o11y/client';
|
|
3
3
|
import { getBulkAdgResolver } from 'komaci/resolver';
|
|
4
4
|
import { InstrumentedAction } from 'komaci/instrumentedAction';
|
|
5
|
-
import { bulkResolveSchema, prefetchSchema, prefetchServiceSchema, totalRoutingSchema } from 'o11y_schema/sf_komaci';
|
|
5
|
+
import { bulkResolveSchema, prefetchSchema, prefetchServiceSchema, totalRoutingSchema, } from 'o11y_schema/sf_komaci';
|
|
6
6
|
const NO_ADG_MODULE_FOUND = 'No ADG module found for given address.';
|
|
7
7
|
const ValidStatusTransitions = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
8
|
+
[STATE.init]: [STATE.running, STATE.stopped, STATE.error],
|
|
9
|
+
[STATE.running]: [STATE.done, STATE.error, STATE.stopped],
|
|
10
|
+
[STATE.error]: [STATE.stopped, STATE.done],
|
|
11
|
+
[STATE.done]: [STATE.stopped],
|
|
12
|
+
[STATE.stopped]: [],
|
|
13
|
+
isValid(oldState, newState) {
|
|
14
|
+
return this[oldState].includes(newState);
|
|
15
|
+
},
|
|
18
16
|
};
|
|
19
17
|
export class PrefetchService {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
18
|
+
constructor(router, addresses, config = {}) {
|
|
19
|
+
this.config = {};
|
|
20
|
+
this.state = STATE.init;
|
|
21
|
+
this.apiOptions = {};
|
|
22
|
+
if (!router) {
|
|
23
|
+
throw new TypeError(`${ERROR_PREFIX} Must provide Router.`);
|
|
24
|
+
}
|
|
25
|
+
this.config = config;
|
|
26
|
+
this.apiOptions.instrumentationContext = this.config.instrumentationContext
|
|
27
|
+
? this.config.instrumentationContext
|
|
28
|
+
: undefined;
|
|
29
|
+
this.router = router;
|
|
30
|
+
this.adgMap = new Map();
|
|
31
|
+
this.resolutionGroups = [];
|
|
32
|
+
this._instrumentation = getInstrumentation('komaci');
|
|
33
|
+
this._activity = this._instrumentation.startActivity('prefetch', this.apiOptions);
|
|
34
|
+
this._size = addresses.length;
|
|
35
|
+
//FIXME: to use o11y.startActivity() when o11y available
|
|
36
|
+
this._startTime = Date.now();
|
|
37
|
+
this.prefetch(addresses);
|
|
27
38
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return Promise.resolve(this.getErrorAddress(address, 'Unexpected exception during routing: ' + err?.message));
|
|
39
|
+
/**
|
|
40
|
+
* Processes the given address through the router, retrieving the AdgFunction if
|
|
41
|
+
* available.
|
|
42
|
+
* @param address to process
|
|
43
|
+
* @returns AdgRoutingResult encapsulating the status, original address, and adgFn
|
|
44
|
+
*/
|
|
45
|
+
processAddress(address) {
|
|
46
|
+
const userSchemaData = { page: JSON.stringify(address) };
|
|
47
|
+
let resolveViewResult;
|
|
48
|
+
try {
|
|
49
|
+
resolveViewResult = this.router.resolveView(address);
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
this._instrumentation.error(err, prefetchSchema, userSchemaData, this.apiOptions);
|
|
53
|
+
return Promise.resolve(this.getErrorAddress(address, 'Unexpected exception during routing: ' + (err === null || err === void 0 ? void 0 : err.message)));
|
|
54
|
+
}
|
|
55
|
+
return resolveViewResult
|
|
56
|
+
.then((destination) => {
|
|
57
|
+
return this.onRoutingResult(address, destination);
|
|
58
|
+
})
|
|
59
|
+
.then((value) => {
|
|
60
|
+
this._instrumentation.log(prefetchSchema, userSchemaData, this.apiOptions);
|
|
61
|
+
return value;
|
|
62
|
+
})
|
|
63
|
+
.catch((err) => {
|
|
64
|
+
this._instrumentation.error(err, prefetchSchema, userSchemaData, this.apiOptions);
|
|
65
|
+
return this.getErrorAddress(address, (err === null || err === void 0 ? void 0 : err.message)
|
|
66
|
+
? 'Unexpected exception processing routing result: ' +
|
|
67
|
+
(err === null || err === void 0 ? void 0 : err.message)
|
|
68
|
+
: 'Unknown exception processing routing result.');
|
|
69
|
+
});
|
|
61
70
|
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (viewInfo) {
|
|
108
|
-
if (viewInfo.specifier) {
|
|
109
|
-
const komaciSpecifier = '@salesforce/komaci/' + viewInfo.specifier.replace('/', '__'); // create adgModuleImporter using komaciSpecifier
|
|
110
|
-
|
|
111
|
-
adgModuleImporter = () => import(komaciSpecifier);
|
|
71
|
+
getErrorAddress(address, reason) {
|
|
72
|
+
return {
|
|
73
|
+
address,
|
|
74
|
+
success: false,
|
|
75
|
+
reason: reason,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Determine if the router has an adg for the given address. For each result
|
|
80
|
+
* with an adg, group the address with other addresses that resolve to the same
|
|
81
|
+
* adg.
|
|
82
|
+
*
|
|
83
|
+
* @param address that resolves to this routingResult
|
|
84
|
+
* @param routingResult provided by the router for this address
|
|
85
|
+
* @returns adgRoutingResult
|
|
86
|
+
*/
|
|
87
|
+
async onRoutingResult(address, routingResult) {
|
|
88
|
+
const adg = 'komaci';
|
|
89
|
+
const { viewset = {} } = routingResult;
|
|
90
|
+
let adgModuleImporter;
|
|
91
|
+
// if routing handler only provides komaci view, use komaci module importer
|
|
92
|
+
if (viewset[adg]) {
|
|
93
|
+
adgModuleImporter = viewset[adg];
|
|
94
|
+
}
|
|
95
|
+
else if (viewset['default']) {
|
|
96
|
+
// calculate komaci specifier using generic default viewset
|
|
97
|
+
const viewInfo = viewset['default'];
|
|
98
|
+
if (viewInfo) {
|
|
99
|
+
if (viewInfo.specifier) {
|
|
100
|
+
const komaciSpecifier = '@salesforce/komaci/' + viewInfo.specifier.replace('/', '__');
|
|
101
|
+
// create adgModuleImporter using komaciSpecifier
|
|
102
|
+
adgModuleImporter = () => import(komaciSpecifier);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
const adgModuleImport = await (adgModuleImporter === null || adgModuleImporter === void 0 ? void 0 : adgModuleImporter());
|
|
107
|
+
const adgRoutingResult = {
|
|
108
|
+
address,
|
|
109
|
+
success: false, // assume the worst
|
|
110
|
+
};
|
|
111
|
+
if (adgModuleImport === null || adgModuleImport === void 0 ? void 0 : adgModuleImport.default) {
|
|
112
|
+
const adgModule = adgModuleImport.default;
|
|
113
|
+
adgRoutingResult.success = true;
|
|
114
|
+
adgRoutingResult.adgModule = adgModule;
|
|
115
|
+
this.updateAdgMap(adgModule, address);
|
|
112
116
|
}
|
|
113
|
-
|
|
117
|
+
else {
|
|
118
|
+
adgRoutingResult.reason = NO_ADG_MODULE_FOUND;
|
|
119
|
+
}
|
|
120
|
+
return adgRoutingResult;
|
|
114
121
|
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
122
|
+
/**
|
|
123
|
+
* Updates the adgMap with the given adgFn, creating the entry if needed
|
|
124
|
+
* and updating the pageReference array for the given address.
|
|
125
|
+
*
|
|
126
|
+
* @param adgModule adgModule that will act as a key in the map
|
|
127
|
+
* @param address address associated with this adgFn
|
|
128
|
+
*/
|
|
129
|
+
updateAdgMap(adgModule, address) {
|
|
130
|
+
const addresses = this.adgMap.get(adgModule);
|
|
131
|
+
// check to see if adg has already been added, and append address to the list
|
|
132
|
+
if (addresses) {
|
|
133
|
+
// if highVolumePriming is enabled, we only wish to resolve each unique module once, so don't add additional addresses to the list for resolution
|
|
134
|
+
if (!this.config.highVolumePriming) {
|
|
135
|
+
addresses.push(address);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
// adg hasn't been added, create entry.
|
|
140
|
+
this.adgMap.set(adgModule, [address]);
|
|
141
|
+
}
|
|
130
142
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
143
|
+
/**
|
|
144
|
+
* Initiates the prefetch process for the given array of addresses.
|
|
145
|
+
* - Addresses are ran through the router to resolve their associated AdgModule, if any
|
|
146
|
+
* - Addresses that resolve to AdgModule are grouped together in order to be resolved in a batch
|
|
147
|
+
* - Addresses that do no resolve to an AdgModule are rejected
|
|
148
|
+
*
|
|
149
|
+
* @param addresses
|
|
150
|
+
*/
|
|
151
|
+
prefetch(addresses) {
|
|
152
|
+
this.updateState(STATE.running);
|
|
153
|
+
this.processAllAddresses(addresses).then((adgRoutingResults) => {
|
|
154
|
+
const rejected = adgRoutingResults.filter(({ success }) => !success);
|
|
155
|
+
rejected.forEach(({ address: rejectedAddress, reason }) => {
|
|
156
|
+
const message = reason ||
|
|
157
|
+
`${ERROR_PREFIX} Unknown exception processing routing result.`;
|
|
158
|
+
this.onAddressDone(rejectedAddress, 'rejected', [message]);
|
|
159
|
+
});
|
|
160
|
+
// if prefetch exclusively consists of unprocessable addresses, update state to done
|
|
161
|
+
if (rejected.length === adgRoutingResults.length) {
|
|
162
|
+
this.updateState(STATE.done, 'no processable addresses, do not bulkResolve and set state to "done"');
|
|
163
|
+
}
|
|
164
|
+
this.bulkResolveGuard();
|
|
165
|
+
});
|
|
154
166
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}) => {
|
|
176
|
-
const message = reason || `${ERROR_PREFIX} Unknown exception processing routing result.`;
|
|
177
|
-
this.onAddressDone(rejectedAddress, 'rejected', [message]);
|
|
178
|
-
}); // if prefetch exclusively consists of unprocessable addresses, update state to done
|
|
179
|
-
|
|
180
|
-
if (rejected.length === adgRoutingResults.length) {
|
|
181
|
-
this.updateState(STATE.done, 'no processable addresses, do not bulkResolve and set state to "done"');
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
this.bulkResolveGuard();
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Processes a list of addresses through the router in series
|
|
189
|
-
* @param addresses to process
|
|
190
|
-
* @returns { AdgRoutingResult[] } a list of AdgRoutingResult
|
|
191
|
-
*/
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
async processAllAddresses(addresses) {
|
|
195
|
-
// add instrumentation to get total duration to process all addresses
|
|
196
|
-
const action = InstrumentedAction.startAction('komaci.router', totalRoutingSchema, {
|
|
197
|
-
instrumentWithoutLog: false,
|
|
198
|
-
postTimeInLog: true,
|
|
199
|
-
apiOptions: this.apiOptions
|
|
200
|
-
});
|
|
201
|
-
const results = [];
|
|
202
|
-
const maxConcurrent = this.config.maxConcurrent || Number.MAX_SAFE_INTEGER;
|
|
203
|
-
|
|
204
|
-
for (let i = 0; i < addresses.length; i += maxConcurrent) {
|
|
205
|
-
const processList = addresses.slice(i, Math.min(addresses.length, i + maxConcurrent));
|
|
206
|
-
results.push(...(await Promise.all(processList.map(address => this.processAddress(address)))));
|
|
167
|
+
/**
|
|
168
|
+
* Processes a list of addresses through the router in series
|
|
169
|
+
* @param addresses to process
|
|
170
|
+
* @returns { AdgRoutingResult[] } a list of AdgRoutingResult
|
|
171
|
+
*/
|
|
172
|
+
async processAllAddresses(addresses) {
|
|
173
|
+
// add instrumentation to get total duration to process all addresses
|
|
174
|
+
const action = InstrumentedAction.startAction('komaci.router', totalRoutingSchema, {
|
|
175
|
+
instrumentWithoutLog: false,
|
|
176
|
+
postTimeInLog: true,
|
|
177
|
+
apiOptions: this.apiOptions,
|
|
178
|
+
});
|
|
179
|
+
const results = [];
|
|
180
|
+
const maxConcurrent = this.config.maxConcurrent || Number.MAX_SAFE_INTEGER;
|
|
181
|
+
for (let i = 0; i < addresses.length; i += maxConcurrent) {
|
|
182
|
+
const processList = addresses.slice(i, Math.min(addresses.length, i + maxConcurrent));
|
|
183
|
+
results.push(...(await Promise.all(processList.map((address) => this.processAddress(address)))));
|
|
184
|
+
}
|
|
185
|
+
action.finishAction(false, {});
|
|
186
|
+
return results;
|
|
207
187
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
this.bulkResolve(adgFn, addresses);
|
|
188
|
+
/**
|
|
189
|
+
* Split all the addresses based on the maxConcurrent configuration
|
|
190
|
+
* bulkResolve them in iterations
|
|
191
|
+
*/
|
|
192
|
+
bulkResolveGuard() {
|
|
193
|
+
const maxConcurrent = this.config.maxConcurrent || Number.MAX_SAFE_INTEGER;
|
|
194
|
+
// rest capacity when there are addresses being processed
|
|
195
|
+
let capacity = maxConcurrent;
|
|
196
|
+
const adgs = this.adgMap.keys();
|
|
197
|
+
for (const adgFn of adgs) {
|
|
198
|
+
const addresses = this.adgMap.get(adgFn);
|
|
199
|
+
if (addresses && addresses.length > 0) {
|
|
200
|
+
if (addresses.length > capacity) {
|
|
201
|
+
if (addresses.length < maxConcurrent) {
|
|
202
|
+
/* to benefits from batching,
|
|
203
|
+
we dont want to split addresses for same adg if they can be in same iteration
|
|
204
|
+
example: having maxConcurrent: 10
|
|
205
|
+
adg1: 6 addresses
|
|
206
|
+
adg2: 8 addresses
|
|
207
|
+
ideal way is two iterations for both adg1 and adg2 instead of iter1: 6 adg1 + 4 adg2, iter2: 4 adg2
|
|
208
|
+
|
|
209
|
+
in addition to the example, if there is another adg3: 4 addresses, will do
|
|
210
|
+
iter1: 6 adg1 + 4 adg3
|
|
211
|
+
iter2: 8 adg2
|
|
212
|
+
*/
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
215
|
+
// if the length of address have exceed the maxConcurrent,
|
|
216
|
+
// split/resolve and update the rest to adgMap
|
|
217
|
+
const currentIteration = addresses.slice(0, capacity);
|
|
218
|
+
this.adgMap.set(adgFn, addresses.slice(capacity));
|
|
219
|
+
this.bulkResolve(adgFn, currentIteration);
|
|
220
|
+
break;
|
|
221
|
+
}
|
|
222
|
+
else {
|
|
223
|
+
// if the length of address can fit in the capacity,
|
|
224
|
+
// resolve them all and remove the entry from adgMap
|
|
225
|
+
capacity = capacity - addresses.length;
|
|
226
|
+
this.adgMap.delete(adgFn);
|
|
227
|
+
this.bulkResolve(adgFn, addresses);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
// in case of empty address list
|
|
232
|
+
this.adgMap.delete(adgFn);
|
|
233
|
+
}
|
|
255
234
|
}
|
|
256
|
-
} else {
|
|
257
|
-
// in case of empty address list
|
|
258
|
-
this.adgMap.delete(adgFn);
|
|
259
|
-
}
|
|
260
235
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
236
|
+
/**
|
|
237
|
+
* Resolves the given adgFunction with the given resolutionGroup
|
|
238
|
+
* @param adgFn to resolve for the inputs provided in the resolutionContext
|
|
239
|
+
* @param addresses the list of addresses to be placed into a new BulkResolver
|
|
240
|
+
*/
|
|
241
|
+
bulkResolve(adgFn, addresses) {
|
|
242
|
+
if (this.state == STATE.stopped) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const action = InstrumentedAction.startAction('komaci', bulkResolveSchema, {
|
|
246
|
+
instrumentWithoutLog: false,
|
|
247
|
+
postTimeInLog: true,
|
|
248
|
+
apiOptions: this.apiOptions,
|
|
249
|
+
});
|
|
250
|
+
const adgInputs = addresses.map((address) => {
|
|
251
|
+
return {
|
|
252
|
+
properties: {},
|
|
253
|
+
context: {
|
|
254
|
+
CurrentPageReference: address,
|
|
255
|
+
},
|
|
256
|
+
};
|
|
257
|
+
});
|
|
258
|
+
const resolverInputStatus = addresses.map(() => STATE.running);
|
|
259
|
+
const bulkResolutionGroup = {
|
|
260
|
+
addresses,
|
|
261
|
+
resolverInputStatus,
|
|
262
|
+
};
|
|
263
|
+
bulkResolutionGroup.adgInputs = adgInputs;
|
|
264
|
+
const bulkResolutionStatusCbs = {
|
|
265
|
+
bulkResolutionStatusCb: this.onBulkResolutionStatus.bind(this, bulkResolutionGroup, action),
|
|
266
|
+
overallBulkResolutionStatusCb: undefined,
|
|
267
|
+
};
|
|
268
|
+
const environmentCfg = {
|
|
269
|
+
instrumentationCtx: this.apiOptions.instrumentationContext,
|
|
270
|
+
downloadImageFunc: this.config.downloadImage,
|
|
271
|
+
MaxResolutionDepth: 512,
|
|
272
|
+
WireTimeout: 180 * 1000,
|
|
273
|
+
WireSlowRunningTimeout: 30 * 1000,
|
|
274
|
+
};
|
|
275
|
+
bulkResolutionGroup.bulkResolver = getBulkAdgResolver(adgFn, adgInputs, bulkResolutionStatusCbs, environmentCfg);
|
|
276
|
+
this.resolutionGroups.push(bulkResolutionGroup);
|
|
277
|
+
bulkResolutionGroup.bulkResolver.start();
|
|
272
278
|
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
279
|
+
/**
|
|
280
|
+
* StatusCallback to BulkResolver, invoked when resolver emits a new status.
|
|
281
|
+
* Updates the prefetchService's status if applicable.
|
|
282
|
+
* @param bulkResolutionGroup
|
|
283
|
+
* @param action InstrumentationContext
|
|
284
|
+
* @param status
|
|
285
|
+
*/
|
|
286
|
+
onBulkResolutionStatus(bulkResolutionGroup, action, status) {
|
|
287
|
+
var _a;
|
|
288
|
+
const state = status.status.getState();
|
|
289
|
+
const index = status.index;
|
|
290
|
+
const { addresses } = bulkResolutionGroup;
|
|
291
|
+
if (index >= 0 && index < addresses.length) {
|
|
292
|
+
bulkResolutionGroup.resolverInputStatus[index] = state;
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
this.onUnexpectedCondition(`Invalid index provided by resolver: ${index}`);
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
if ((_a = bulkResolutionGroup.bulkResolver) === null || _a === void 0 ? void 0 : _a.areAllResolversDone()) {
|
|
299
|
+
action.finishAction(false, {
|
|
300
|
+
userSchemaData: {
|
|
301
|
+
keyCount: addresses.length,
|
|
302
|
+
},
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
switch (state) {
|
|
306
|
+
case STATE.done:
|
|
307
|
+
this.onResolutionDone(status, bulkResolutionGroup);
|
|
308
|
+
break;
|
|
309
|
+
case STATE.stopped:
|
|
310
|
+
// NOTE: Prefetch initiates stop, so this is a noop
|
|
311
|
+
break;
|
|
312
|
+
case STATE.running:
|
|
313
|
+
break;
|
|
314
|
+
default:
|
|
315
|
+
this.onUnexpectedCondition(`Unexpected resolution status: ${JSON.stringify(status)}`);
|
|
284
316
|
}
|
|
285
|
-
};
|
|
286
|
-
});
|
|
287
|
-
const resolverInputStatus = addresses.map(() => STATE.running);
|
|
288
|
-
const bulkResolutionGroup = {
|
|
289
|
-
addresses,
|
|
290
|
-
resolverInputStatus
|
|
291
|
-
};
|
|
292
|
-
bulkResolutionGroup.adgInputs = adgInputs;
|
|
293
|
-
const bulkResolutionStatusCbs = {
|
|
294
|
-
bulkResolutionStatusCb: this.onBulkResolutionStatus.bind(this, bulkResolutionGroup, action),
|
|
295
|
-
overallBulkResolutionStatusCb: undefined
|
|
296
|
-
};
|
|
297
|
-
const environmentCfg = {
|
|
298
|
-
instrumentationCtx: this.apiOptions.instrumentationContext,
|
|
299
|
-
downloadImageFunc: this.config.downloadImage,
|
|
300
|
-
MaxResolutionDepth: 512,
|
|
301
|
-
WireTimeout: 180 * 1000,
|
|
302
|
-
WireSlowRunningTimeout: 30 * 1000
|
|
303
|
-
};
|
|
304
|
-
bulkResolutionGroup.bulkResolver = getBulkAdgResolver(adgFn, adgInputs, bulkResolutionStatusCbs, environmentCfg);
|
|
305
|
-
this.resolutionGroups.push(bulkResolutionGroup);
|
|
306
|
-
bulkResolutionGroup.bulkResolver.start();
|
|
307
|
-
}
|
|
308
|
-
/**
|
|
309
|
-
* StatusCallback to BulkResolver, invoked when resolver emits a new status.
|
|
310
|
-
* Updates the prefetchService's status if applicable.
|
|
311
|
-
* @param bulkResolutionGroup
|
|
312
|
-
* @param action InstrumentationContext
|
|
313
|
-
* @param status
|
|
314
|
-
*/
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
onBulkResolutionStatus(bulkResolutionGroup, action, status) {
|
|
318
|
-
const state = status.status.getState();
|
|
319
|
-
const index = status.index;
|
|
320
|
-
const {
|
|
321
|
-
addresses
|
|
322
|
-
} = bulkResolutionGroup;
|
|
323
|
-
|
|
324
|
-
if (index >= 0 && index < addresses.length) {
|
|
325
|
-
bulkResolutionGroup.resolverInputStatus[index] = state;
|
|
326
|
-
} else {
|
|
327
|
-
this.onUnexpectedCondition(`Invalid index provided by resolver: ${index}`);
|
|
328
|
-
return;
|
|
329
317
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
318
|
+
/**
|
|
319
|
+
* Stops all bulkResolvers
|
|
320
|
+
*/
|
|
321
|
+
stop() {
|
|
322
|
+
if (this.state == STATE.stopped) {
|
|
323
|
+
return;
|
|
335
324
|
}
|
|
336
|
-
|
|
325
|
+
this.resolutionGroups.forEach((bulkResolutionContext) => {
|
|
326
|
+
const { bulkResolver } = bulkResolutionContext;
|
|
327
|
+
if (bulkResolver) {
|
|
328
|
+
bulkResolver.stop();
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
this.updateState(STATE.stopped);
|
|
337
332
|
}
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
case STATE.running:
|
|
349
|
-
break;
|
|
350
|
-
|
|
351
|
-
default:
|
|
352
|
-
this.onUnexpectedCondition(`Unexpected resolution status: ${JSON.stringify(status)}`);
|
|
333
|
+
/**
|
|
334
|
+
* Called upon unexpected conditions that may indicate to the consumer that
|
|
335
|
+
* the prefetchService or its associated resolver is in an invalid state
|
|
336
|
+
* @param message
|
|
337
|
+
*/
|
|
338
|
+
onUnexpectedCondition(message) {
|
|
339
|
+
// eslint-disable-next-line no-console
|
|
340
|
+
console.log(`Komaci/prefetch - error, message: ${message}`);
|
|
341
|
+
this._activity.error(message);
|
|
342
|
+
this.updateState(STATE.error, message);
|
|
353
343
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
344
|
+
/**
|
|
345
|
+
* Called when resolution for a given address has completed, or was otherwise
|
|
346
|
+
* rejected.
|
|
347
|
+
* @param address that is done
|
|
348
|
+
* @param state completed when resolved, or rejected when either no ADG exists, or resolver emitted an error with the given address
|
|
349
|
+
* @param reasons reasons for rejected status, if any
|
|
350
|
+
*/
|
|
351
|
+
onAddressDone(address, state, reasons) {
|
|
352
|
+
const { onAddressProcessed } = this.config;
|
|
353
|
+
const status = {
|
|
354
|
+
state: state,
|
|
355
|
+
address,
|
|
356
|
+
reasons: reasons,
|
|
357
|
+
};
|
|
358
|
+
try {
|
|
359
|
+
onAddressProcessed === null || onAddressProcessed === void 0 ? void 0 : onAddressProcessed(status);
|
|
360
|
+
}
|
|
361
|
+
catch (error) {
|
|
362
|
+
this.onUnexpectedCondition(error === null || error === void 0 ? void 0 : error.message);
|
|
363
|
+
}
|
|
363
364
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
* @param state completed when resolved, or rejected when either no ADG exists, or resolver emitted an error with the given address
|
|
396
|
-
* @param reasons reasons for rejected status, if any
|
|
397
|
-
*/
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
onAddressDone(address, state, reasons) {
|
|
401
|
-
const {
|
|
402
|
-
onAddressProcessed
|
|
403
|
-
} = this.config;
|
|
404
|
-
const status = {
|
|
405
|
-
state: state,
|
|
406
|
-
address,
|
|
407
|
-
reasons: reasons
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
try {
|
|
411
|
-
onAddressProcessed?.(status);
|
|
412
|
-
} catch (error) {
|
|
413
|
-
this.onUnexpectedCondition(error?.message);
|
|
365
|
+
/**
|
|
366
|
+
* Updates the current PrefetchState to done if every bulkResolver has emitted
|
|
367
|
+
* a non-running status for all inputs.
|
|
368
|
+
*/
|
|
369
|
+
updateStateIfAllDone(bulkResolutionContext, status) {
|
|
370
|
+
const bulkContexts = this.resolutionGroups.values();
|
|
371
|
+
let allDone = true;
|
|
372
|
+
for (const context of bulkContexts) {
|
|
373
|
+
if (context.bulkResolver && !context.bulkResolver.areAllResolversDone()) {
|
|
374
|
+
allDone = false;
|
|
375
|
+
break;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
if (allDone) {
|
|
379
|
+
if (this.adgMap.size > 0) {
|
|
380
|
+
// if all current runs are all done but with addresses left in the adgMap
|
|
381
|
+
// go process them
|
|
382
|
+
this.bulkResolveGuard();
|
|
383
|
+
}
|
|
384
|
+
else {
|
|
385
|
+
// prefetch is done when allIdel and nothing left in adgMap
|
|
386
|
+
// eslint-disable-next-line no-console
|
|
387
|
+
console.log(`Komaci/prefetch - duration: ${Date.now() - this._startTime}, size: ${this._size}.`);
|
|
388
|
+
this._activity.stop(prefetchServiceSchema, {
|
|
389
|
+
addressCount: this._size,
|
|
390
|
+
startTime: this._startTime,
|
|
391
|
+
});
|
|
392
|
+
this.updateState(STATE.done, status.status.getErrorMessages().join('\n'));
|
|
393
|
+
bulkResolutionContext.bulkResolver = undefined;
|
|
394
|
+
}
|
|
395
|
+
}
|
|
414
396
|
}
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
if (context.bulkResolver && !context.bulkResolver.areAllResolversDone()) {
|
|
428
|
-
allDone = false;
|
|
429
|
-
break;
|
|
430
|
-
}
|
|
397
|
+
/**
|
|
398
|
+
* Called when resolver emits a "sink" state for an address or all addresses
|
|
399
|
+
* @param status
|
|
400
|
+
* @param bulkResolutionContext
|
|
401
|
+
*/
|
|
402
|
+
onResolutionDone(status, bulkResolutionContext) {
|
|
403
|
+
const index = status.index;
|
|
404
|
+
const { addresses } = bulkResolutionContext;
|
|
405
|
+
const addressState = status.status.getErrorMessages().length !== 0 ? 'rejected' : 'completed';
|
|
406
|
+
const impactedAddress = addresses[index];
|
|
407
|
+
this.onAddressDone(impactedAddress, addressState, status.status.getErrorMessages());
|
|
408
|
+
this.updateStateIfAllDone(bulkResolutionContext, status);
|
|
431
409
|
}
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
410
|
+
/**
|
|
411
|
+
* Updates PrefetchState and notifies consumer via config.onStateChanged callback
|
|
412
|
+
* @param newState the new state
|
|
413
|
+
* @param [message] state message, if any
|
|
414
|
+
*/
|
|
415
|
+
updateState(newState, message) {
|
|
416
|
+
const { onStateChanged } = this.config;
|
|
417
|
+
const abandoned = []; // TODO: Abandoned Not yet implemented
|
|
418
|
+
if (ValidStatusTransitions.isValid(this.state, newState)) {
|
|
419
|
+
this.state = newState;
|
|
420
|
+
try {
|
|
421
|
+
onStateChanged === null || onStateChanged === void 0 ? void 0 : onStateChanged({
|
|
422
|
+
state: newState,
|
|
423
|
+
abandoned,
|
|
424
|
+
message,
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
catch (error) {
|
|
428
|
+
// eslint-disable-next-line no-console
|
|
429
|
+
console.log(error === null || error === void 0 ? void 0 : error.message);
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
const errorMessage = `Komaci/prefetch - Invalid state transition from resovler. Resolver emitted state: ${newState} while prefetch is in ${this.state}`;
|
|
434
|
+
// eslint-disable-next-line no-console
|
|
435
|
+
console.log(errorMessage);
|
|
436
|
+
this._activity.error(errorMessage, 'invalid-prefetch-state-transition');
|
|
437
|
+
}
|
|
451
438
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
* Called when resolver emits a "sink" state for an address or all addresses
|
|
455
|
-
* @param status
|
|
456
|
-
* @param bulkResolutionContext
|
|
457
|
-
*/
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
onResolutionDone(status, bulkResolutionContext) {
|
|
461
|
-
const index = status.index;
|
|
462
|
-
const {
|
|
463
|
-
addresses
|
|
464
|
-
} = bulkResolutionContext;
|
|
465
|
-
const addressState = status.status.getErrorMessages().length !== 0 ? 'rejected' : 'completed';
|
|
466
|
-
const impactedAddress = addresses[index];
|
|
467
|
-
this.onAddressDone(impactedAddress, addressState, status.status.getErrorMessages());
|
|
468
|
-
this.updateStateIfAllDone(bulkResolutionContext, status);
|
|
469
|
-
}
|
|
470
|
-
/**
|
|
471
|
-
* Updates PrefetchState and notifies consumer via config.onStateChanged callback
|
|
472
|
-
* @param newState the new state
|
|
473
|
-
* @param [message] state message, if any
|
|
474
|
-
*/
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
updateState(newState, message) {
|
|
478
|
-
const {
|
|
479
|
-
onStateChanged
|
|
480
|
-
} = this.config;
|
|
481
|
-
const abandoned = []; // TODO: Abandoned Not yet implemented
|
|
482
|
-
|
|
483
|
-
if (ValidStatusTransitions.isValid(this.state, newState)) {
|
|
484
|
-
this.state = newState;
|
|
485
|
-
|
|
486
|
-
try {
|
|
487
|
-
onStateChanged?.({
|
|
488
|
-
state: newState,
|
|
489
|
-
abandoned,
|
|
490
|
-
message
|
|
491
|
-
});
|
|
492
|
-
} catch (error) {
|
|
493
|
-
// eslint-disable-next-line no-console
|
|
494
|
-
console.log(error?.message);
|
|
495
|
-
}
|
|
496
|
-
} else {
|
|
497
|
-
const errorMessage = `Komaci/prefetch - Invalid state transition from resovler. Resolver emitted state: ${newState} while prefetch is in ${this.state}`; // eslint-disable-next-line no-console
|
|
498
|
-
|
|
499
|
-
console.log(errorMessage);
|
|
500
|
-
|
|
501
|
-
this._activity.error(errorMessage, 'invalid-prefetch-state-transition');
|
|
439
|
+
getState() {
|
|
440
|
+
return this.state;
|
|
502
441
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
getState() {
|
|
506
|
-
return this.state;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
|
-
}
|
|
442
|
+
}
|
|
443
|
+
//# sourceMappingURL=prefetchService.js.map
|
|
@@ -1,30 +1,22 @@
|
|
|
1
1
|
export const ERROR_PREFIX = '[komaci prefetch]';
|
|
2
|
-
|
|
3
|
-
* Routing result for each address
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export let ResolutionStatusState;
|
|
7
|
-
|
|
2
|
+
export var ResolutionStatusState;
|
|
8
3
|
(function (ResolutionStatusState) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
4
|
+
ResolutionStatusState["running"] = "running";
|
|
5
|
+
ResolutionStatusState["done"] = "done";
|
|
6
|
+
ResolutionStatusState["error"] = "error";
|
|
7
|
+
ResolutionStatusState["stopped"] = "stopped";
|
|
13
8
|
})(ResolutionStatusState || (ResolutionStatusState = {}));
|
|
14
|
-
|
|
15
|
-
export let PrefetchStatusStates;
|
|
16
|
-
|
|
9
|
+
export var PrefetchStatusStates;
|
|
17
10
|
(function (PrefetchStatusStates) {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
11
|
+
PrefetchStatusStates["init"] = "init";
|
|
12
|
+
PrefetchStatusStates["done"] = "done";
|
|
13
|
+
PrefetchStatusStates["running"] = "running";
|
|
14
|
+
PrefetchStatusStates["stopped"] = "stopped";
|
|
15
|
+
PrefetchStatusStates["error"] = "error";
|
|
23
16
|
})(PrefetchStatusStates || (PrefetchStatusStates = {}));
|
|
24
|
-
|
|
25
|
-
export let AddressStatusStates;
|
|
26
|
-
|
|
17
|
+
export var AddressStatusStates;
|
|
27
18
|
(function (AddressStatusStates) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})(AddressStatusStates || (AddressStatusStates = {}));
|
|
19
|
+
AddressStatusStates["completed"] = "completed";
|
|
20
|
+
AddressStatusStates["rejected"] = "rejected";
|
|
21
|
+
})(AddressStatusStates || (AddressStatusStates = {}));
|
|
22
|
+
//# sourceMappingURL=prefetchTypes.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@komaci/prefetch",
|
|
3
|
-
"version": "242.
|
|
3
|
+
"version": "242.2.0",
|
|
4
4
|
"description": "Komaci prefetch service.",
|
|
5
5
|
"homepage": "https://komaci.dev/",
|
|
6
6
|
"repository": {
|
|
@@ -19,21 +19,21 @@
|
|
|
19
19
|
"types": "build/modules/komaci/prefetchTypes/prefetchTypes.d.ts",
|
|
20
20
|
"main": "build/index.js",
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "
|
|
22
|
+
"build": "tsc -b"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"build/**/*.js",
|
|
26
26
|
"build/**/*.d.ts"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@komaci/module-shared": "242.
|
|
30
|
-
"@komaci/resolver": "242.
|
|
29
|
+
"@komaci/module-shared": "242.2.0",
|
|
30
|
+
"@komaci/resolver": "242.2.0",
|
|
31
31
|
"@lwrjs/router": "0.6.0-alpha.15",
|
|
32
32
|
"o11y": "^240.7.0",
|
|
33
33
|
"o11y_schema": "^240.11.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@komaci/types": "242.
|
|
36
|
+
"@komaci/types": "242.2.0",
|
|
37
37
|
"wait-for-expect": "^3.0.2"
|
|
38
38
|
}
|
|
39
39
|
}
|