@localazy/cdn-client 1.5.2 → 1.5.3
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/dist/browser/localazy-cdn-client.umd.min.js +4 -5
- package/dist/browser/localazy-cdn-client.umd.min.js.map +1 -1
- package/dist/index.d.ts +9 -28
- package/dist/localazy-cdn-client.js +160 -156
- package/dist/localazy-cdn-client.js.map +1 -1
- package/dist/localazy-cdn-client.min.js +4 -5
- package/dist/localazy-cdn-client.min.js.map +1 -1
- package/dist/node/localazy-cdn-client.cjs +160 -156
- package/dist/node/localazy-cdn-client.cjs.map +1 -1
- package/package.json +43 -52
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
-
var __publicField = (obj, key, value) =>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
};
|
|
7
|
-
/* @localazy/cdn-client@1.5.2
|
|
8
|
-
* (c) 2024 Localazy <team@localazy.com>
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
/* @localazy/cdn-client@1.5.3
|
|
5
|
+
* (c) 2025 Localazy <team@localazy.com>
|
|
9
6
|
* @license MIT */
|
|
10
7
|
class Api {
|
|
11
8
|
constructor(context) {
|
|
@@ -24,22 +21,6 @@ class Api {
|
|
|
24
21
|
return await this.context.client.get(this.context.metafile.params.jsonPath);
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
|
-
const isString = (value) => typeof value === "string";
|
|
28
|
-
const isUndefined = (value) => typeof value === "undefined";
|
|
29
|
-
const isArray = (value) => Array.isArray(value);
|
|
30
|
-
const isPlainObject = (value) => Object.prototype.toString.call(value) === "[object Object]";
|
|
31
|
-
const uniq = (array) => [...new Set(array)];
|
|
32
|
-
const uniqBy = (array, predicate) => {
|
|
33
|
-
const seen = {};
|
|
34
|
-
return array.filter((item) => {
|
|
35
|
-
const key = predicate(item);
|
|
36
|
-
if (!Object.hasOwn(seen, key)) {
|
|
37
|
-
seen[key] = true;
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
return false;
|
|
41
|
-
});
|
|
42
|
-
};
|
|
43
24
|
class MemoryCacheAdapter {
|
|
44
25
|
constructor() {
|
|
45
26
|
__publicField(this, "map");
|
|
@@ -58,6 +39,22 @@ class MemoryCacheAdapter {
|
|
|
58
39
|
this.map = /* @__PURE__ */ new Map();
|
|
59
40
|
}
|
|
60
41
|
}
|
|
42
|
+
const isString = (value) => typeof value === "string";
|
|
43
|
+
const isUndefined = (value) => typeof value === "undefined";
|
|
44
|
+
const isArray = (value) => Array.isArray(value);
|
|
45
|
+
const isPlainObject = (value) => Object.prototype.toString.call(value) === "[object Object]";
|
|
46
|
+
const uniq = (array) => [...new Set(array)];
|
|
47
|
+
const uniqBy = (array, predicate) => {
|
|
48
|
+
const seen = {};
|
|
49
|
+
return array.filter((item) => {
|
|
50
|
+
const key = predicate(item);
|
|
51
|
+
if (!Object.hasOwn(seen, key)) {
|
|
52
|
+
seen[key] = true;
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
return false;
|
|
56
|
+
});
|
|
57
|
+
};
|
|
61
58
|
class LocalesCache {
|
|
62
59
|
constructor(context) {
|
|
63
60
|
__publicField(this, "context");
|
|
@@ -104,19 +101,106 @@ class LocalesCache {
|
|
|
104
101
|
return indices.filter((key) => key !== "").join("-");
|
|
105
102
|
}
|
|
106
103
|
}
|
|
107
|
-
class
|
|
104
|
+
class ResponseFactory {
|
|
108
105
|
constructor(context) {
|
|
109
106
|
__publicField(this, "context");
|
|
110
107
|
this.context = context;
|
|
111
108
|
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
109
|
+
createCdnResponse(options) {
|
|
110
|
+
const { requests, responses, hasSingleFileResponse, hasSingleLocaleResponse } = options;
|
|
111
|
+
if (responses.length === 0 || typeof responses[0] === "undefined") {
|
|
112
|
+
return {};
|
|
113
|
+
}
|
|
114
|
+
this.cacheResponses(requests, responses);
|
|
115
|
+
return hasSingleFileResponse && hasSingleLocaleResponse ? responses[0] : ResponseFactory.transformResponses(options);
|
|
116
|
+
}
|
|
117
|
+
cacheResponses(requests, responses) {
|
|
118
|
+
responses.forEach((response, index) => {
|
|
119
|
+
if (typeof requests[index] !== "undefined") {
|
|
120
|
+
const { metafileFile, metafileLocale } = requests[index];
|
|
121
|
+
if (metafileFile && metafileLocale) {
|
|
122
|
+
this.context.cache.setIfMissed({ metafileFile, metafileLocale, data: response });
|
|
123
|
+
}
|
|
124
|
+
}
|
|
118
125
|
});
|
|
119
126
|
}
|
|
127
|
+
static transformResponses(options) {
|
|
128
|
+
const { requests, responses, hasSingleFileResponse } = options;
|
|
129
|
+
return responses.reduce((acc, cur, index) => {
|
|
130
|
+
if (typeof requests[index] !== "undefined") {
|
|
131
|
+
const { metafileFile, metafileLocale } = requests[index];
|
|
132
|
+
if (metafileFile && metafileLocale) {
|
|
133
|
+
if (hasSingleFileResponse) {
|
|
134
|
+
acc[metafileLocale.locale] = cur;
|
|
135
|
+
} else {
|
|
136
|
+
if (!acc[metafileFile.id]) {
|
|
137
|
+
acc[metafileFile.id] = {};
|
|
138
|
+
}
|
|
139
|
+
acc[metafileFile.id][metafileLocale.locale] = cur;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return acc;
|
|
144
|
+
}, {});
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
class Context {
|
|
148
|
+
constructor(options) {
|
|
149
|
+
__publicField(this, "metafile");
|
|
150
|
+
__publicField(this, "cdn");
|
|
151
|
+
__publicField(this, "client");
|
|
152
|
+
__publicField(this, "api");
|
|
153
|
+
__publicField(this, "cache");
|
|
154
|
+
__publicField(this, "responseFactory");
|
|
155
|
+
this.metafile = options.metafileContext;
|
|
156
|
+
this.cdn = options.cdn;
|
|
157
|
+
this.client = options.client;
|
|
158
|
+
this.api = new Api(this);
|
|
159
|
+
this.cache = new LocalesCache(this);
|
|
160
|
+
this.responseFactory = new ResponseFactory(this);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
class MetafileFile {
|
|
164
|
+
constructor(options) {
|
|
165
|
+
__publicField(this, "id");
|
|
166
|
+
__publicField(this, "file");
|
|
167
|
+
__publicField(this, "path");
|
|
168
|
+
__publicField(this, "library");
|
|
169
|
+
__publicField(this, "module");
|
|
170
|
+
__publicField(this, "buildType");
|
|
171
|
+
__publicField(this, "timestamp");
|
|
172
|
+
__publicField(this, "productFlavors");
|
|
173
|
+
__publicField(this, "locales");
|
|
174
|
+
__publicField(this, "baseUrl");
|
|
175
|
+
this.id = options.id;
|
|
176
|
+
this.file = options.file;
|
|
177
|
+
this.path = options.path;
|
|
178
|
+
this.library = options.library;
|
|
179
|
+
this.module = options.module;
|
|
180
|
+
this.buildType = options.buildType;
|
|
181
|
+
this.timestamp = options.timestamp;
|
|
182
|
+
this.productFlavors = options.productFlavors;
|
|
183
|
+
this.locales = options.locales;
|
|
184
|
+
this.baseUrl = options.baseUrl;
|
|
185
|
+
}
|
|
186
|
+
toCdnFile() {
|
|
187
|
+
return {
|
|
188
|
+
id: this.id,
|
|
189
|
+
file: this.file,
|
|
190
|
+
path: this.path,
|
|
191
|
+
library: this.library,
|
|
192
|
+
module: this.module,
|
|
193
|
+
buildType: this.buildType,
|
|
194
|
+
productFlavors: this.productFlavors,
|
|
195
|
+
locales: this.locales.map(
|
|
196
|
+
(locale) => ({
|
|
197
|
+
locale: locale.locale,
|
|
198
|
+
isBaseLocale: locale.isBaseLocale,
|
|
199
|
+
uri: `${this.baseUrl}${locale.uri}`
|
|
200
|
+
})
|
|
201
|
+
)
|
|
202
|
+
};
|
|
203
|
+
}
|
|
120
204
|
}
|
|
121
205
|
class MetafileLocale {
|
|
122
206
|
constructor(options, baseLocale) {
|
|
@@ -167,48 +251,6 @@ class MetafileLocale {
|
|
|
167
251
|
};
|
|
168
252
|
}
|
|
169
253
|
}
|
|
170
|
-
class MetafileFile {
|
|
171
|
-
constructor(options) {
|
|
172
|
-
__publicField(this, "id");
|
|
173
|
-
__publicField(this, "file");
|
|
174
|
-
__publicField(this, "path");
|
|
175
|
-
__publicField(this, "library");
|
|
176
|
-
__publicField(this, "module");
|
|
177
|
-
__publicField(this, "buildType");
|
|
178
|
-
__publicField(this, "timestamp");
|
|
179
|
-
__publicField(this, "productFlavors");
|
|
180
|
-
__publicField(this, "locales");
|
|
181
|
-
__publicField(this, "baseUrl");
|
|
182
|
-
this.id = options.id;
|
|
183
|
-
this.file = options.file;
|
|
184
|
-
this.path = options.path;
|
|
185
|
-
this.library = options.library;
|
|
186
|
-
this.module = options.module;
|
|
187
|
-
this.buildType = options.buildType;
|
|
188
|
-
this.timestamp = options.timestamp;
|
|
189
|
-
this.productFlavors = options.productFlavors;
|
|
190
|
-
this.locales = options.locales;
|
|
191
|
-
this.baseUrl = options.baseUrl;
|
|
192
|
-
}
|
|
193
|
-
toCdnFile() {
|
|
194
|
-
return {
|
|
195
|
-
id: this.id,
|
|
196
|
-
file: this.file,
|
|
197
|
-
path: this.path,
|
|
198
|
-
library: this.library,
|
|
199
|
-
module: this.module,
|
|
200
|
-
buildType: this.buildType,
|
|
201
|
-
productFlavors: this.productFlavors,
|
|
202
|
-
locales: this.locales.map(
|
|
203
|
-
(locale) => ({
|
|
204
|
-
locale: locale.locale,
|
|
205
|
-
isBaseLocale: locale.isBaseLocale,
|
|
206
|
-
uri: `${this.baseUrl}${locale.uri}`
|
|
207
|
-
})
|
|
208
|
-
)
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
254
|
class MetafileData {
|
|
213
255
|
constructor(options, params) {
|
|
214
256
|
__publicField(this, "projectUrl");
|
|
@@ -237,17 +279,19 @@ class MetafileData {
|
|
|
237
279
|
}
|
|
238
280
|
static filesFactory(files, baseLocale, params) {
|
|
239
281
|
return Object.keys(files).reduce((acc, cur) => {
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
282
|
+
if (typeof files[cur] !== "undefined") {
|
|
283
|
+
const locales = files[cur].locales.map(
|
|
284
|
+
(locale) => new MetafileLocale(locale, baseLocale)
|
|
285
|
+
);
|
|
286
|
+
acc.push(
|
|
287
|
+
new MetafileFile({
|
|
288
|
+
...files[cur],
|
|
289
|
+
id: cur,
|
|
290
|
+
locales,
|
|
291
|
+
baseUrl: params.baseUrl
|
|
292
|
+
})
|
|
293
|
+
);
|
|
294
|
+
}
|
|
251
295
|
return acc;
|
|
252
296
|
}, []);
|
|
253
297
|
}
|
|
@@ -286,11 +330,11 @@ class MetafileParams {
|
|
|
286
330
|
let url;
|
|
287
331
|
try {
|
|
288
332
|
url = new URL(metafileUrl);
|
|
289
|
-
} catch
|
|
333
|
+
} catch {
|
|
290
334
|
throw new Error('Invalid param: "options.metafile" cannot be parsed as url.');
|
|
291
335
|
}
|
|
292
|
-
const matches =
|
|
293
|
-
if (matches === null || matches.length !== 4) {
|
|
336
|
+
const matches = /^\/(.*?)\/(.*?)\.(v2.json|js|ts)$/.exec(url.pathname);
|
|
337
|
+
if (matches === null || matches.length !== 4 || typeof matches[1] === "undefined" || typeof matches[2] === "undefined") {
|
|
294
338
|
throw new Error('Invalid param: "options.metafile" contains invalid metafile url.');
|
|
295
339
|
}
|
|
296
340
|
const cdnId = matches[1];
|
|
@@ -317,59 +361,39 @@ class MetafileContext {
|
|
|
317
361
|
this.data = new MetafileData(metafile, this.params);
|
|
318
362
|
}
|
|
319
363
|
}
|
|
320
|
-
class
|
|
321
|
-
constructor(
|
|
322
|
-
__publicField(this, "
|
|
323
|
-
this.
|
|
364
|
+
class FetchHttpAdapter {
|
|
365
|
+
constructor(baseUrl) {
|
|
366
|
+
__publicField(this, "baseUrl");
|
|
367
|
+
this.baseUrl = baseUrl;
|
|
324
368
|
}
|
|
325
|
-
|
|
326
|
-
const
|
|
327
|
-
|
|
328
|
-
|
|
369
|
+
async get(url) {
|
|
370
|
+
const response = await fetch(`${this.baseUrl}${url}`);
|
|
371
|
+
const contentType = response.headers.get("content-type");
|
|
372
|
+
const isJson = contentType === "application/json5" || contentType === "application/json";
|
|
373
|
+
if (response.status >= 400) {
|
|
374
|
+
throw new Error(`Request failed with status code ${response.status.toString()}`);
|
|
329
375
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
this.context.cache.setIfMissed({ metafileFile, metafileLocale, data: response });
|
|
338
|
-
}
|
|
339
|
-
});
|
|
376
|
+
let result;
|
|
377
|
+
if (isJson) {
|
|
378
|
+
result = await response.json();
|
|
379
|
+
} else {
|
|
380
|
+
result = await response.text();
|
|
381
|
+
}
|
|
382
|
+
return result;
|
|
340
383
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
if (hasSingleFileResponse) {
|
|
347
|
-
acc[metafileLocale.locale] = cur;
|
|
348
|
-
} else {
|
|
349
|
-
if (!acc[metafileFile.id]) {
|
|
350
|
-
acc[metafileFile.id] = {};
|
|
351
|
-
}
|
|
352
|
-
acc[metafileFile.id][metafileLocale.locale] = cur;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
return acc;
|
|
356
|
-
}, {});
|
|
384
|
+
}
|
|
385
|
+
class CdnBase {
|
|
386
|
+
constructor(context) {
|
|
387
|
+
__publicField(this, "context");
|
|
388
|
+
this.context = context;
|
|
357
389
|
}
|
|
358
390
|
}
|
|
359
|
-
class
|
|
360
|
-
constructor(
|
|
361
|
-
|
|
362
|
-
__publicField(this, "
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
__publicField(this, "cache");
|
|
366
|
-
__publicField(this, "responseFactory");
|
|
367
|
-
this.metafile = options.metafileContext;
|
|
368
|
-
this.cdn = options.cdn;
|
|
369
|
-
this.client = options.client;
|
|
370
|
-
this.api = new Api(this);
|
|
371
|
-
this.cache = new LocalesCache(this);
|
|
372
|
-
this.responseFactory = new ResponseFactory(this);
|
|
391
|
+
class CdnCache extends CdnBase {
|
|
392
|
+
constructor() {
|
|
393
|
+
super(...arguments);
|
|
394
|
+
__publicField(this, "flush", () => {
|
|
395
|
+
this.context.cache.flush();
|
|
396
|
+
});
|
|
373
397
|
}
|
|
374
398
|
}
|
|
375
399
|
class CdnMetafile extends CdnBase {
|
|
@@ -440,7 +464,8 @@ class Request {
|
|
|
440
464
|
}
|
|
441
465
|
getPromises() {
|
|
442
466
|
return this.files.reduce((acc, cur) => {
|
|
443
|
-
|
|
467
|
+
var _a;
|
|
468
|
+
if (typeof ((_a = this.localesMap.data) == null ? void 0 : _a[cur.id]) !== "undefined") {
|
|
444
469
|
acc.push(
|
|
445
470
|
...this.localesMap.data[cur.id].map(
|
|
446
471
|
(metafileLocale) => {
|
|
@@ -560,27 +585,6 @@ class RequestBuilder {
|
|
|
560
585
|
return result;
|
|
561
586
|
}
|
|
562
587
|
}
|
|
563
|
-
class FetchHttpAdapter {
|
|
564
|
-
constructor(baseUrl) {
|
|
565
|
-
__publicField(this, "baseUrl");
|
|
566
|
-
this.baseUrl = baseUrl;
|
|
567
|
-
}
|
|
568
|
-
async get(url) {
|
|
569
|
-
const response = await fetch(`${this.baseUrl}${url}`);
|
|
570
|
-
const contentType = response.headers.get("content-type");
|
|
571
|
-
const isJson = contentType === "application/json5" || contentType === "application/json";
|
|
572
|
-
if (response.status >= 400) {
|
|
573
|
-
throw new Error(`Request failed with status code ${response.status}`);
|
|
574
|
-
}
|
|
575
|
-
let result;
|
|
576
|
-
if (isJson) {
|
|
577
|
-
result = await response.json();
|
|
578
|
-
} else {
|
|
579
|
-
result = await response.text();
|
|
580
|
-
}
|
|
581
|
-
return result;
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
588
|
const _CdnClient = class _CdnClient {
|
|
585
589
|
constructor(options) {
|
|
586
590
|
__publicField(this, "metafile");
|
|
@@ -609,7 +613,7 @@ const _CdnClient = class _CdnClient {
|
|
|
609
613
|
return cdn;
|
|
610
614
|
}
|
|
611
615
|
};
|
|
612
|
-
__publicField(_CdnClient, "version", "1.5.
|
|
616
|
+
__publicField(_CdnClient, "version", "1.5.3");
|
|
613
617
|
let CdnClient = _CdnClient;
|
|
614
618
|
export {
|
|
615
619
|
Api,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localazy-cdn-client.js","sources":["../src/cdn/api/api.ts","../src/cdn/utils.ts","../src/cdn/cache/memory-cache-adapter.ts","../src/cdn/cache/locales-cache.ts","../src/cdn/methods/cdn-base.ts","../src/cdn/methods/cdn-cache.ts","../src/cdn/metafile/metafile-locale.ts","../src/cdn/metafile/metafile-file.ts","../src/cdn/metafile/metafile-data.ts","../src/cdn/metafile/metafile-params.ts","../src/cdn/context/metafile-context.ts","../src/cdn/response/response-factory.ts","../src/cdn/context/context.ts","../src/cdn/methods/cdn-metafile.ts","../src/cdn/request/locales-map.ts","../src/cdn/request/request.ts","../src/cdn/request/request-builder.ts","../src/cdn/http/fetch-http-adapter.ts","../src/cdn/cdn-client.ts"],"sourcesContent":["import { IMetafile } from '@/interfaces/i-metafile';\nimport { ApiLocaleRequest } from '@/types/api-locale-request';\nimport { Context } from '@/cdn/context/context';\n\nexport class Api {\n protected context: Context;\n\n constructor(context: Context) {\n this.context = context;\n }\n\n public async fetchLocale(options: ApiLocaleRequest): Promise<object | string> {\n if (this.context.cache.has(options)) {\n return new Promise((resolve): void => {\n resolve(this.context.cache.get(options) as object | string);\n });\n }\n\n return this.context.client.get(options.metafileLocale.uri);\n }\n\n public async fetchMetafile(): Promise<IMetafile> {\n return (await this.context.client.get(this.context.metafile.params.jsonPath)) as IMetafile;\n }\n}\n","export const isString = (value: unknown): value is string => typeof value === 'string';\n\nexport const isUndefined = (value: unknown): value is undefined => typeof value === 'undefined';\n\nexport const isArray = <T>(value: unknown): value is T[] => Array.isArray(value);\n\nexport const isPlainObject = (value: unknown): value is Record<string, unknown> =>\n Object.prototype.toString.call(value) === '[object Object]';\n\nexport const uniq = <T>(array: T[]): T[] => [...new Set(array)];\n\nexport const uniqBy = <T>(array: T[], predicate: (item: T) => string): T[] => {\n const seen: Record<string, boolean> = {};\n\n return array.filter((item: T): boolean => {\n const key: string = predicate(item);\n\n if (!Object.hasOwn(seen, key)) {\n seen[key] = true;\n\n return true;\n }\n\n return false;\n });\n};\n","import { ICacheAdapter } from '@/interfaces/i-cache-adapter';\n\nexport class MemoryCacheAdapter<K, V> implements ICacheAdapter<K, V> {\n protected map: Map<K, V>;\n\n constructor() {\n this.map = new Map();\n }\n\n public get(key: K): V | undefined {\n return this.map.get(key);\n }\n\n public has(key: K): boolean {\n return this.map.has(key);\n }\n\n public set(key: K, value: V): void {\n this.map.set(key, value);\n }\n\n public flush(): void {\n this.map = new Map();\n }\n}\n","import { uniq } from '@/cdn/utils';\nimport { ICacheAdapter } from '@/interfaces/i-cache-adapter';\nimport { CacheKeyMetafileOptions } from '@/types/cache-key-metafile-options';\nimport { CacheGetLocalesRequest } from '@/types/cache-get-locales-request';\nimport { CacheHasLocalesRequest } from '@/types/cache-has-locales-request';\nimport { CacheStoreLocalesRequest } from '@/types/cache-store-locales-request';\nimport { MemoryCacheAdapter } from '@/cdn/cache/memory-cache-adapter';\nimport { Context } from '@/cdn/context/context';\n\nexport class LocalesCache {\n protected context: Context;\n\n protected cacheAdapter: ICacheAdapter<string, object | string>;\n\n constructor(context: Context) {\n this.context = context;\n this.cacheAdapter = new MemoryCacheAdapter();\n }\n\n public setIfMissed(options: CacheStoreLocalesRequest): void {\n const { metafileFile, metafileLocale, data }: CacheStoreLocalesRequest = options;\n\n const key: string = this.keyFromMetafile({\n metafileFile,\n metafileLocale,\n });\n\n if (!this.cacheAdapter.has(key)) {\n this.cacheAdapter.set(key, data);\n }\n }\n\n public has(options: CacheHasLocalesRequest): boolean {\n const key: string = this.keyFromMetafile(options);\n\n return this.cacheAdapter.has(key);\n }\n\n public get(options: CacheGetLocalesRequest): object | string | undefined {\n const key: string = this.keyFromMetafile(options);\n\n return this.cacheAdapter.get(key);\n }\n\n public flush(): void {\n this.cacheAdapter.flush();\n }\n\n protected keyFromMetafile(options: CacheKeyMetafileOptions): string {\n const { metafileFile, metafileLocale }: CacheKeyMetafileOptions = options;\n const productFlavors: string = [...uniq(metafileFile.productFlavors)].sort().join('-');\n\n const indices: string[] = [\n this.context.metafile.params.cdnId,\n metafileFile.id,\n metafileFile.file,\n metafileFile.path,\n metafileFile.library,\n metafileFile.module,\n metafileFile.buildType,\n productFlavors,\n metafileLocale.locale,\n metafileLocale.timestamp.toString(),\n ];\n\n return indices.filter((key: string): boolean => key !== '').join('-');\n }\n}\n","import { Context } from '@/cdn/context/context';\n\nexport abstract class CdnBase {\n protected context: Context;\n\n constructor(context: Context) {\n this.context = context;\n }\n}\n","import { CdnBase } from '@/cdn/methods/cdn-base';\n\nexport class CdnCache extends CdnBase {\n public flush = (): void => {\n this.context.cache.flush();\n };\n}\n","import { CdnLocale } from '@/types/cdn-locale';\nimport { IMetafileFileLocale } from '@/interfaces/i-metafile-file-locale';\n\nexport class MetafileLocale implements IMetafileFileLocale {\n public language: string;\n\n public region: string;\n\n public script: string;\n\n public isRtl: boolean;\n\n public name: string;\n\n public localizedName: string;\n\n public uri: string;\n\n public timestamp: number;\n\n protected baseLocale: string;\n\n constructor(options: IMetafileFileLocale, baseLocale: string) {\n this.language = options.language;\n this.region = options.region;\n this.script = options.script;\n this.isRtl = options.isRtl;\n this.name = options.name;\n this.localizedName = options.localizedName;\n this.uri = options.uri;\n this.timestamp = options.timestamp;\n this.baseLocale = baseLocale;\n }\n\n get locale(): string {\n if (this.language && this.region && this.script) {\n return `${this.language}_${this.region}#${this.script}`;\n }\n\n if (this.language && this.script) {\n return `${this.language}#${this.script}`;\n }\n\n if (this.language && this.region) {\n return `${this.language}_${this.region}`;\n }\n\n return this.language;\n }\n\n get isBaseLocale(): boolean {\n return this.locale === this.baseLocale;\n }\n\n public toCdnLocale(): CdnLocale {\n return {\n locale: this.locale,\n isBaseLocale: this.isBaseLocale,\n language: this.language,\n region: this.region,\n script: this.script,\n isRtl: this.isRtl,\n name: this.name,\n localizedName: this.localizedName,\n };\n }\n}\n","import { CdnFile } from '@/types/cdn-file';\nimport { CdnFileLocale } from '@/types/cdn-file-locale';\nimport { MetafileLocale } from '@/cdn/metafile/metafile-locale';\nimport { IMetafileFile } from '@/interfaces/i-metafile-file';\nimport { MetafileFileOptions } from '@/types/metafile-file-options';\n\nexport class MetafileFile implements Omit<IMetafileFile, 'locales'> {\n public id: string;\n\n public file: string;\n\n public path: string;\n\n public library: string;\n\n public module: string;\n\n public buildType: string;\n\n public timestamp: number;\n\n public productFlavors: string[];\n\n public locales: MetafileLocale[];\n\n protected baseUrl: string;\n\n constructor(options: MetafileFileOptions) {\n this.id = options.id;\n this.file = options.file;\n this.path = options.path;\n this.library = options.library;\n this.module = options.module;\n this.buildType = options.buildType;\n this.timestamp = options.timestamp;\n this.productFlavors = options.productFlavors;\n this.locales = options.locales;\n this.baseUrl = options.baseUrl;\n }\n\n public toCdnFile(): CdnFile {\n return {\n id: this.id,\n file: this.file,\n path: this.path,\n library: this.library,\n module: this.module,\n buildType: this.buildType,\n productFlavors: this.productFlavors,\n locales: this.locales.map(\n (locale: MetafileLocale): CdnFileLocale => ({\n locale: locale.locale,\n isBaseLocale: locale.isBaseLocale,\n uri: `${this.baseUrl}${locale.uri}`,\n }),\n ),\n };\n }\n}\n","import { uniqBy } from '@/cdn/utils';\nimport { MetafileParams } from '@/cdn/metafile/metafile-params';\nimport { CdnLocale } from '@/types/cdn-locale';\nimport { MetafileLocale } from '@/cdn/metafile/metafile-locale';\nimport { IMetafile } from '@/interfaces/i-metafile';\nimport { IMetafileFileLocale } from '@/interfaces/i-metafile-file-locale';\nimport { IMetafileFiles } from '@/interfaces/i-metafile-files';\nimport { MetafileFile } from '@/cdn/metafile/metafile-file';\nimport { MetafileOptions } from '@/types/metafile-options';\nimport { FilesMap } from '@/types/files-map';\n\nexport class MetafileData implements Omit<IMetafile, 'files' | 'baseLocale'> {\n public projectUrl: string;\n\n public baseLocale: CdnLocale;\n\n public locales: CdnLocale[];\n\n public timestamp: number;\n\n public files: MetafileFile[];\n\n public filesMap: FilesMap;\n\n constructor(options: MetafileOptions, params: MetafileParams) {\n this.projectUrl = options.projectUrl;\n this.timestamp = options.timestamp;\n this.files = MetafileData.filesFactory(options.files, options.baseLocale, params);\n this.filesMap = MetafileData.filesMapFactory(this.files);\n this.locales = MetafileData.localesFactory(this.files);\n this.baseLocale = this.locales.find((locale: CdnLocale) => locale.isBaseLocale) as CdnLocale;\n }\n\n public static createEmpty(params: MetafileParams): MetafileData {\n return new MetafileData(\n {\n projectUrl: '',\n baseLocale: '',\n timestamp: 0,\n files: {},\n },\n params,\n );\n }\n\n protected static filesFactory(files: IMetafileFiles, baseLocale: string, params: MetafileParams): MetafileFile[] {\n return Object.keys(files).reduce((acc: MetafileFile[], cur: string) => {\n const locales: MetafileLocale[] = files[cur].locales.map(\n (locale: IMetafileFileLocale) => new MetafileLocale(locale, baseLocale),\n );\n\n acc.push(\n new MetafileFile({\n ...files[cur],\n id: cur,\n locales,\n baseUrl: params.baseUrl,\n }),\n );\n\n return acc;\n }, []);\n }\n\n protected static filesMapFactory(files: MetafileFile[]): FilesMap {\n return files.reduce((acc: FilesMap, cur: MetafileFile) => {\n acc[cur.id] = cur;\n\n return acc;\n }, {});\n }\n\n protected static localesFactory(files: MetafileFile[]): CdnLocale[] {\n const locales: CdnLocale[] = files.reduce((acc: CdnLocale[], cur: MetafileFile) => {\n acc.push(...cur.locales.map((locale: MetafileLocale): CdnLocale => locale.toCdnLocale()));\n return acc;\n }, []);\n\n return uniqBy(locales, (cdnLocale: CdnLocale): string => cdnLocale.locale);\n }\n}\n","import { IMetafileParams } from '@/interfaces/i-metafile-params';\n\nexport class MetafileParams implements IMetafileParams {\n protected options: IMetafileParams;\n\n constructor(metafileUrl: string) {\n this.options = MetafileParams.parseMetafileUrl(metafileUrl);\n }\n\n get url(): string {\n return this.options.url;\n }\n\n get baseUrl(): string {\n return this.options.baseUrl;\n }\n\n get cdnId(): string {\n return this.options.cdnId;\n }\n\n get jsonPath(): string {\n return this.options.jsonPath;\n }\n\n protected static parseMetafileUrl(metafileUrl: string): IMetafileParams {\n let url: URL;\n\n try {\n url = new URL(metafileUrl);\n } catch (e) {\n throw new Error('Invalid param: \"options.metafile\" cannot be parsed as url.');\n }\n\n const matches: string[] | null = url.pathname.match(/^\\/(.*?)\\/(.*?)\\.(v2.json|js|ts)$/);\n\n if (matches === null || matches.length !== 4) {\n throw new Error('Invalid param: \"options.metafile\" contains invalid metafile url.');\n }\n\n const cdnId: string = matches[1];\n const tagId: string = matches[2];\n\n return {\n url: metafileUrl,\n baseUrl: url.origin,\n cdnId,\n jsonPath: `/${cdnId}/${tagId}.v2.json`,\n };\n }\n}\n","import { MetafileData } from '@/cdn/metafile/metafile-data';\nimport { IMetafile } from '@/interfaces/i-metafile';\nimport { MetafileParams } from '@/cdn/metafile/metafile-params';\nimport { CdnClientOptions } from '@/types/cdn-client-options';\n\nexport class MetafileContext {\n public params: MetafileParams;\n\n public parsedData: IMetafile | null;\n\n public data: MetafileData;\n\n constructor(options: CdnClientOptions) {\n this.params = new MetafileParams(options.metafile);\n this.parsedData = null;\n this.data = MetafileData.createEmpty(this.params);\n }\n\n public setMetafile(metafile: IMetafile): void {\n this.parsedData = metafile;\n\n this.data = new MetafileData(metafile, this.params);\n }\n}\n","import { ApiLocaleRequest } from '@/types/api-locale-request';\nimport { Context } from '@/cdn/context/context';\nimport { ResponseFactoryOptions } from '@/types/response-factory-options';\nimport { CacheStoreLocalesRequest } from '@/types/cache-store-locales-request';\nimport { CdnResponse } from '@/types/cdn-response';\n\nexport class ResponseFactory {\n protected context: Context;\n\n constructor(context: Context) {\n this.context = context;\n }\n\n public createCdnResponse(options: ResponseFactoryOptions): CdnResponse {\n const { requests, responses, hasSingleFileResponse, hasSingleLocaleResponse }: ResponseFactoryOptions = options;\n\n if (responses.length === 0) {\n return {};\n }\n\n this.cacheResponses(requests, responses);\n\n return hasSingleFileResponse && hasSingleLocaleResponse\n ? responses[0]\n : ResponseFactory.transformResponses(options);\n }\n\n protected cacheResponses(requests: ApiLocaleRequest[], responses: (object | string)[]): void {\n responses.forEach((response: object | string, index: number): void => {\n const { metafileFile, metafileLocale }: Partial<CacheStoreLocalesRequest> = requests[index];\n\n if (metafileFile && metafileLocale) {\n this.context.cache.setIfMissed({ metafileFile, metafileLocale, data: response });\n }\n });\n }\n\n protected static transformResponses(options: ResponseFactoryOptions): CdnResponse {\n const { requests, responses, hasSingleFileResponse }: ResponseFactoryOptions = options;\n\n return responses.reduce((acc: CdnResponse, cur: object | string, index: number) => {\n const { metafileFile, metafileLocale }: Partial<CacheStoreLocalesRequest> = requests[index];\n\n if (metafileFile && metafileLocale) {\n if (hasSingleFileResponse) {\n // @ts-expect-error fix output type\n acc[metafileLocale.locale] = cur;\n } else {\n // @ts-expect-error fix output type\n if (!acc[metafileFile.id]) {\n // @ts-expect-error fix output type\n acc[metafileFile.id] = {};\n }\n\n // @ts-expect-error fix output type\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n acc[metafileFile.id][metafileLocale.locale] = cur;\n }\n }\n\n return acc;\n }, {});\n }\n}\n","import { Api } from '@/cdn/api/api';\nimport { LocalesCache } from '@/cdn/cache/locales-cache';\nimport { CdnClient } from '@/cdn/cdn-client';\nimport { ResponseFactory } from '@/cdn/response/response-factory';\nimport { ContextOptions } from '@/types/context-options';\nimport { MetafileContext } from '@/cdn/context/metafile-context';\nimport { IHttpAdapter } from '@/interfaces/i-http-adapter';\n\nexport class Context {\n public metafile: MetafileContext;\n\n public cdn: CdnClient;\n\n public client: IHttpAdapter;\n\n public api: Api;\n\n public cache: LocalesCache;\n\n public responseFactory: ResponseFactory;\n\n constructor(options: ContextOptions) {\n this.metafile = options.metafileContext;\n this.cdn = options.cdn;\n this.client = options.client;\n this.api = new Api(this);\n this.cache = new LocalesCache(this);\n this.responseFactory = new ResponseFactory(this);\n }\n}\n","import { MetafileFile } from '@/cdn/metafile/metafile-file';\nimport { MetafileParams } from '@/cdn/metafile/metafile-params';\nimport { CdnClientOptions } from '@/types/cdn-client-options';\nimport { MetafileData } from '@/cdn/metafile/metafile-data';\nimport { CdnBase } from '@/cdn/methods/cdn-base';\nimport { CdnFile } from '@/types/cdn-file';\nimport { CdnLocalesOptions } from '@/types/cdn-locales-options';\nimport { IMetafile } from '@/interfaces/i-metafile';\nimport { CdnLocale } from '@/types/cdn-locale';\n\nexport class CdnMetafile extends CdnBase {\n get projectUrl(): string {\n return this.context.metafile.data.projectUrl;\n }\n\n get baseLocale(): CdnLocale {\n return this.context.metafile.data.baseLocale;\n }\n\n get url(): string {\n return this.context.metafile.params.url;\n }\n\n get files(): CdnFile[] {\n return this.context.metafile.data.files.map((file: MetafileFile): CdnFile => file.toCdnFile());\n }\n\n public locales = (options?: CdnLocalesOptions): CdnLocale[] => {\n const { excludeBaseLocale }: CdnLocalesOptions = options || {};\n const { locales }: MetafileData = this.context.metafile.data;\n\n return excludeBaseLocale ? locales.filter((cdnLocale: CdnLocale): boolean => !cdnLocale.isBaseLocale) : locales;\n };\n\n public refresh = async (): Promise<void> => {\n const response: IMetafile = await this.context.api.fetchMetafile();\n\n this.context.metafile.setMetafile(response);\n };\n\n public switch = async (options: CdnClientOptions): Promise<void> => {\n this.context.metafile.params = new MetafileParams(options.metafile);\n\n await this.refresh();\n };\n}\n","import { Context } from '@/cdn/context/context';\nimport { LocalesMapData } from '@/types/locales-map-data';\nimport { LocalesMapOptions } from '@/types/locales-map-options';\n\nexport class LocalesMap {\n public data: LocalesMapData;\n\n protected context: Context;\n\n constructor(options: LocalesMapOptions) {\n this.context = options.context;\n this.data = options.data || {};\n }\n}\n","import { Context } from '@/cdn/context/context';\nimport { MetafileFile } from '@/cdn/metafile/metafile-file';\nimport { MetafileLocale } from '@/cdn/metafile/metafile-locale';\nimport { LocalesMap } from '@/cdn/request/locales-map';\nimport { ApiLocaleRequest } from '@/types/api-locale-request';\nimport { CdnResponse } from '@/types/cdn-response';\n\nexport class Request {\n public files: MetafileFile[];\n\n public localesMap: LocalesMap;\n\n public hasSingleFileResponse: boolean;\n\n public hasSingleLocaleResponse: boolean;\n\n protected context: Context;\n\n constructor(context: Context) {\n this.files = [];\n this.localesMap = new LocalesMap({ context });\n this.hasSingleFileResponse = false;\n this.hasSingleLocaleResponse = false;\n this.context = context;\n }\n\n public async execute(): Promise<CdnResponse> {\n const payload: [Promise<string | object>, ApiLocaleRequest][] = this.getPromises();\n const promises: Promise<string | object>[] = payload.map(\n (item: [Promise<string | object>, ApiLocaleRequest]) => item[0],\n );\n const requests: ApiLocaleRequest[] = payload.map((item: [Promise<string | object>, ApiLocaleRequest]) => item[1]);\n const responses: (string | object)[] = await Promise.all(promises);\n\n return this.context.responseFactory.createCdnResponse({\n requests,\n responses,\n localesMap: this.localesMap,\n hasSingleFileResponse: this.hasSingleFileResponse,\n hasSingleLocaleResponse: this.hasSingleLocaleResponse,\n });\n }\n\n protected getPromises(): [Promise<string | object>, ApiLocaleRequest][] {\n return this.files.reduce((acc: [Promise<string | object>, ApiLocaleRequest][], cur: MetafileFile) => {\n if (this.localesMap.data[cur.id]) {\n acc.push(\n ...this.localesMap.data[cur.id].map(\n (metafileLocale: MetafileLocale): [Promise<string | object>, ApiLocaleRequest] => {\n const request: ApiLocaleRequest = {\n metafileFile: cur,\n metafileLocale,\n };\n\n return [this.context.api.fetchLocale(request), request];\n },\n ),\n );\n }\n return acc;\n }, []);\n }\n}\n","import { isPlainObject, isArray, isString, isUndefined } from '@/cdn/utils';\nimport { CdnFile } from '@/types/cdn-file';\nimport { MetafileLocale } from '@/cdn/metafile/metafile-locale';\nimport { LocalesMap } from '@/cdn/request/locales-map';\nimport { Context } from '@/cdn/context/context';\nimport { MetafileFile } from '@/cdn/metafile/metafile-file';\nimport { IRequestBuilder } from '@/interfaces/i-request-builder';\nimport { Request } from '@/cdn/request/request';\n\nexport class RequestBuilder implements IRequestBuilder {\n protected context: Context;\n\n protected request: Request;\n\n constructor(context: Context) {\n this.context = context;\n this.request = new Request(this.context);\n }\n\n public addFiles(files?: (CdnFile | string)[] | CdnFile | string): RequestBuilder {\n if (!(isPlainObject(files) || isString(files) || isUndefined(files) || isArray(files))) {\n throw new Error('Invalid param: \"request.files\" must be object, array, string or undefined.');\n }\n\n if (isArray(files)) {\n files.forEach((i: CdnFile | string): void => {\n if (!(isPlainObject(i) || isString(i))) {\n throw new Error('Invalid param: array \"request.files\" must contain objects or strings.');\n }\n });\n }\n\n if (isString(files)) {\n this.request.hasSingleFileResponse = true;\n\n const file: MetafileFile | undefined = this.context.metafile.data.files.find(\n (i: MetafileFile): boolean => i.id === files,\n );\n\n if (!(file instanceof MetafileFile)) {\n throw new Error(`File not found: \"${files}\".`);\n }\n\n this.request.files = [file];\n } else if (isUndefined(files)) {\n this.request.files = [...this.context.metafile.data.files];\n } else if (isArray(files)) {\n this.request.files = files.map((file: CdnFile | string): MetafileFile => {\n let metafileFile: MetafileFile;\n\n if (isString(file)) {\n const foundFile: MetafileFile | undefined = this.context.metafile.data.files.find(\n (i: MetafileFile): boolean => i.id === file,\n );\n\n if (isUndefined(foundFile)) {\n throw new Error(`File not found: \"${file}\".`);\n }\n\n metafileFile = foundFile;\n } else {\n const foundFile: MetafileFile | undefined = this.context.metafile.data.files.find(\n (i: MetafileFile): boolean => i.id === file.id,\n );\n\n if (isUndefined(foundFile)) {\n throw new Error(`File not found: \"${file.id}\".`);\n }\n\n metafileFile = foundFile;\n }\n\n return metafileFile;\n });\n } else if (isPlainObject(files)) {\n this.request.hasSingleFileResponse = true;\n\n const foundFile: MetafileFile | undefined = this.context.metafile.data.files.find(\n (i: MetafileFile): boolean => i.id === files.id,\n );\n\n if (isUndefined(foundFile)) {\n throw new Error(`File not found: \"${files.id}\".`);\n }\n\n this.request.files = [foundFile];\n }\n\n return this;\n }\n\n public addLocales(locales?: string[] | string, excludeBaseLocale?: boolean): RequestBuilder {\n if (!(isString(locales) || isUndefined(locales) || isArray(locales))) {\n throw new Error('Invalid param: \"request.locales\" must be array, string or undefined.');\n }\n\n if (isArray(locales)) {\n locales.forEach((i: MetafileFile | string): void => {\n if (!isString(i)) {\n throw new Error('Invalid param: array \"request.locales\" must contain strings.');\n }\n });\n }\n\n if (isString(locales)) {\n this.request.hasSingleLocaleResponse = true;\n this.request.files.reduce((acc: LocalesMap, cur: MetafileFile) => {\n acc.data[cur.id] = cur.locales.filter(\n (metafileLocale: MetafileLocale): boolean => metafileLocale.locale === locales,\n );\n\n return acc;\n }, this.request.localesMap);\n } else if (isUndefined(locales)) {\n this.request.files.reduce((acc: LocalesMap, cur: MetafileFile) => {\n acc.data[cur.id] = excludeBaseLocale\n ? cur.locales.filter((metafileLocale: MetafileLocale): boolean => !metafileLocale.isBaseLocale)\n : cur.locales;\n\n return acc;\n }, this.request.localesMap);\n } else if (isArray(locales)) {\n this.request.files.reduce((acc: LocalesMap, cur: MetafileFile) => {\n acc.data[cur.id] = cur.locales.filter((metafileLocale: MetafileLocale) =>\n locales.includes(metafileLocale.locale),\n );\n\n return acc;\n }, this.request.localesMap);\n }\n\n return this;\n }\n\n public getCdnRequest(): Request {\n const result: Request = this.request;\n this.request = new Request(this.context);\n return result;\n }\n}\n","import { IHttpAdapter } from '@/interfaces/i-http-adapter';\n\nexport class FetchHttpAdapter implements IHttpAdapter {\n protected baseUrl: string;\n\n constructor(baseUrl: string) {\n this.baseUrl = baseUrl;\n }\n\n async get(url: string): Promise<string | object> {\n const response: Response = await fetch(`${this.baseUrl}${url}`);\n const contentType: string | null = response.headers.get('content-type');\n const isJson: boolean = contentType === 'application/json5' || contentType === 'application/json';\n\n if (response.status >= 400) {\n throw new Error(`Request failed with status code ${response.status}`);\n }\n\n let result: string | object;\n\n if (isJson) {\n result = (await response.json()) as object;\n } else {\n result = await response.text();\n }\n\n return result;\n }\n}\n","import { isString } from '@/cdn/utils';\nimport { CdnFetchOptions } from '@/types/cdn-fetch-options';\nimport { CdnResponse } from '@/types/cdn-response';\nimport { CdnCache } from '@/cdn/methods/cdn-cache';\nimport { MetafileContext } from '@/cdn/context/metafile-context';\nimport { Context } from '@/cdn/context/context';\nimport { CdnMetafile } from '@/cdn/methods/cdn-metafile';\nimport { RequestBuilder } from '@/cdn/request/request-builder';\nimport { FetchHttpAdapter } from '@/cdn/http/fetch-http-adapter';\nimport { CdnClientOptions } from '@/types/cdn-client-options';\n\nexport class CdnClient {\n public metafile: CdnMetafile;\n\n public cache: CdnCache;\n\n protected context: Context;\n\n public static version = '__CLIENT_VERSION__';\n\n protected constructor(options: CdnClientOptions) {\n const metafileContext: MetafileContext = new MetafileContext(options);\n const client: FetchHttpAdapter = new FetchHttpAdapter(metafileContext.params.baseUrl);\n\n this.context = new Context({ metafileContext, cdn: this, client });\n this.metafile = new CdnMetafile(this.context);\n this.cache = new CdnCache(this.context);\n }\n\n public fetch = async (options?: CdnFetchOptions): Promise<CdnResponse> => {\n const { files, locales, excludeBaseLocale }: CdnFetchOptions = options || {};\n const requestBuilder: RequestBuilder = new RequestBuilder(this.context)\n .addFiles(files)\n .addLocales(locales, excludeBaseLocale);\n\n return requestBuilder.getCdnRequest().execute();\n };\n\n public static async create(options: CdnClientOptions): Promise<CdnClient> {\n if (!options) {\n throw new Error('Invalid param: missing required \"options\" parameter.');\n }\n\n if (!isString(options.metafile)) {\n throw new Error('Invalid param: \"options.metafile\" must be string.');\n }\n\n const cdn: CdnClient = new CdnClient(options);\n\n await cdn.metafile.refresh();\n\n return cdn;\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AAIO,MAAM,IAAI;AAAA,EAGf,YAAY,SAAkB;AAFpB;AAG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CE,cAPW,YAOG,WAAU;AAPnB,IAAM,YAAN;"}
|
|
1
|
+
{"version":3,"file":"localazy-cdn-client.js","sources":["../src/cdn/api/api.ts","../src/cdn/cache/memory-cache-adapter.ts","../src/cdn/utils.ts","../src/cdn/cache/locales-cache.ts","../src/cdn/response/response-factory.ts","../src/cdn/context/context.ts","../src/cdn/metafile/metafile-file.ts","../src/cdn/metafile/metafile-locale.ts","../src/cdn/metafile/metafile-data.ts","../src/cdn/metafile/metafile-params.ts","../src/cdn/context/metafile-context.ts","../src/cdn/http/fetch-http-adapter.ts","../src/cdn/methods/cdn-base.ts","../src/cdn/methods/cdn-cache.ts","../src/cdn/methods/cdn-metafile.ts","../src/cdn/request/locales-map.ts","../src/cdn/request/request.ts","../src/cdn/request/request-builder.ts","../src/cdn/cdn-client.ts"],"sourcesContent":["import { Context } from '@/cdn/context/context';\nimport { IMetafile } from '@/interfaces/i-metafile';\nimport { ApiLocaleRequest } from '@/types/api-locale-request';\n\nexport class Api {\n protected context: Context;\n\n constructor(context: Context) {\n this.context = context;\n }\n\n public async fetchLocale(options: ApiLocaleRequest): Promise<object | string> {\n if (this.context.cache.has(options)) {\n return new Promise((resolve): void => {\n resolve(this.context.cache.get(options) as object | string);\n });\n }\n\n return this.context.client.get(options.metafileLocale.uri);\n }\n\n public async fetchMetafile(): Promise<IMetafile> {\n return (await this.context.client.get(this.context.metafile.params.jsonPath)) as IMetafile;\n }\n}\n","import { ICacheAdapter } from '@/interfaces/i-cache-adapter';\n\nexport class MemoryCacheAdapter<K, V> implements ICacheAdapter<K, V> {\n protected map: Map<K, V>;\n\n constructor() {\n this.map = new Map();\n }\n\n public get(key: K): V | undefined {\n return this.map.get(key);\n }\n\n public has(key: K): boolean {\n return this.map.has(key);\n }\n\n public set(key: K, value: V): void {\n this.map.set(key, value);\n }\n\n public flush(): void {\n this.map = new Map();\n }\n}\n","export const isString = (value: unknown): value is string => typeof value === 'string';\n\nexport const isUndefined = (value: unknown): value is undefined => typeof value === 'undefined';\n\nexport const isArray = <T>(value: unknown): value is T[] => Array.isArray(value);\n\nexport const isPlainObject = (value: unknown): value is Record<string, unknown> =>\n Object.prototype.toString.call(value) === '[object Object]';\n\nexport const uniq = <T>(array: T[]): T[] => [...new Set(array)];\n\nexport const uniqBy = <T>(array: T[], predicate: (item: T) => string): T[] => {\n const seen: Record<string, boolean> = {};\n\n return array.filter((item: T): boolean => {\n const key: string = predicate(item);\n\n if (!Object.hasOwn(seen, key)) {\n seen[key] = true;\n\n return true;\n }\n\n return false;\n });\n};\n","import { MemoryCacheAdapter } from '@/cdn/cache/memory-cache-adapter';\nimport { Context } from '@/cdn/context/context';\nimport { uniq } from '@/cdn/utils';\nimport { ICacheAdapter } from '@/interfaces/i-cache-adapter';\nimport { CacheGetLocalesRequest } from '@/types/cache-get-locales-request';\nimport { CacheHasLocalesRequest } from '@/types/cache-has-locales-request';\nimport { CacheKeyMetafileOptions } from '@/types/cache-key-metafile-options';\nimport { CacheStoreLocalesRequest } from '@/types/cache-store-locales-request';\n\nexport class LocalesCache {\n protected context: Context;\n\n protected cacheAdapter: ICacheAdapter<string, object | string>;\n\n constructor(context: Context) {\n this.context = context;\n this.cacheAdapter = new MemoryCacheAdapter();\n }\n\n public setIfMissed(options: CacheStoreLocalesRequest): void {\n const { metafileFile, metafileLocale, data }: CacheStoreLocalesRequest = options;\n\n const key: string = this.keyFromMetafile({\n metafileFile,\n metafileLocale,\n });\n\n if (!this.cacheAdapter.has(key)) {\n this.cacheAdapter.set(key, data);\n }\n }\n\n public has(options: CacheHasLocalesRequest): boolean {\n const key: string = this.keyFromMetafile(options);\n\n return this.cacheAdapter.has(key);\n }\n\n public get(options: CacheGetLocalesRequest): object | string | undefined {\n const key: string = this.keyFromMetafile(options);\n\n return this.cacheAdapter.get(key);\n }\n\n public flush(): void {\n this.cacheAdapter.flush();\n }\n\n protected keyFromMetafile(options: CacheKeyMetafileOptions): string {\n const { metafileFile, metafileLocale }: CacheKeyMetafileOptions = options;\n const productFlavors: string = [...uniq(metafileFile.productFlavors)].sort().join('-');\n\n const indices: string[] = [\n this.context.metafile.params.cdnId,\n metafileFile.id,\n metafileFile.file,\n metafileFile.path,\n metafileFile.library,\n metafileFile.module,\n metafileFile.buildType,\n productFlavors,\n metafileLocale.locale,\n metafileLocale.timestamp.toString(),\n ];\n\n return indices.filter((key: string): boolean => key !== '').join('-');\n }\n}\n","import { Context } from '@/cdn/context/context';\nimport { ApiLocaleRequest } from '@/types/api-locale-request';\nimport { CacheStoreLocalesRequest } from '@/types/cache-store-locales-request';\nimport { CdnResponse } from '@/types/cdn-response';\nimport { ResponseFactoryOptions } from '@/types/response-factory-options';\n\nexport class ResponseFactory {\n protected context: Context;\n\n constructor(context: Context) {\n this.context = context;\n }\n\n public createCdnResponse(options: ResponseFactoryOptions): CdnResponse {\n const { requests, responses, hasSingleFileResponse, hasSingleLocaleResponse }: ResponseFactoryOptions = options;\n\n if (responses.length === 0 || typeof responses[0] === 'undefined') {\n return {};\n }\n\n this.cacheResponses(requests, responses);\n\n return hasSingleFileResponse && hasSingleLocaleResponse\n ? responses[0]\n : ResponseFactory.transformResponses(options);\n }\n\n protected cacheResponses(requests: ApiLocaleRequest[], responses: (object | string)[]): void {\n responses.forEach((response: object | string, index: number): void => {\n if (typeof requests[index] !== 'undefined') {\n const { metafileFile, metafileLocale }: Partial<CacheStoreLocalesRequest> = requests[index];\n\n if (metafileFile && metafileLocale) {\n this.context.cache.setIfMissed({ metafileFile, metafileLocale, data: response });\n }\n }\n });\n }\n\n protected static transformResponses(options: ResponseFactoryOptions): CdnResponse {\n const { requests, responses, hasSingleFileResponse }: ResponseFactoryOptions = options;\n\n return responses.reduce((acc: CdnResponse, cur: object | string, index: number) => {\n if (typeof requests[index] !== 'undefined') {\n const { metafileFile, metafileLocale }: Partial<CacheStoreLocalesRequest> = requests[index];\n\n if (metafileFile && metafileLocale) {\n if (hasSingleFileResponse) {\n // @ts-expect-error fix output type\n acc[metafileLocale.locale] = cur;\n } else {\n // @ts-expect-error fix output type\n if (!acc[metafileFile.id]) {\n // @ts-expect-error fix output type\n acc[metafileFile.id] = {};\n }\n\n // @ts-expect-error fix output type\n acc[metafileFile.id][metafileLocale.locale] = cur;\n }\n }\n }\n\n return acc;\n }, {});\n }\n}\n","import { Api } from '@/cdn/api/api';\nimport { LocalesCache } from '@/cdn/cache/locales-cache';\nimport { CdnClient } from '@/cdn/cdn-client';\nimport { MetafileContext } from '@/cdn/context/metafile-context';\nimport { ResponseFactory } from '@/cdn/response/response-factory';\nimport { IHttpAdapter } from '@/interfaces/i-http-adapter';\nimport { ContextOptions } from '@/types/context-options';\n\nexport class Context {\n public metafile: MetafileContext;\n\n public cdn: CdnClient;\n\n public client: IHttpAdapter;\n\n public api: Api;\n\n public cache: LocalesCache;\n\n public responseFactory: ResponseFactory;\n\n constructor(options: ContextOptions) {\n this.metafile = options.metafileContext;\n this.cdn = options.cdn;\n this.client = options.client;\n this.api = new Api(this);\n this.cache = new LocalesCache(this);\n this.responseFactory = new ResponseFactory(this);\n }\n}\n","import { MetafileLocale } from '@/cdn/metafile/metafile-locale';\nimport { IMetafileFile } from '@/interfaces/i-metafile-file';\nimport { CdnFile } from '@/types/cdn-file';\nimport { CdnFileLocale } from '@/types/cdn-file-locale';\nimport { MetafileFileOptions } from '@/types/metafile-file-options';\n\nexport class MetafileFile implements Omit<IMetafileFile, 'locales'> {\n public id: string;\n\n public file: string;\n\n public path: string;\n\n public library: string;\n\n public module: string;\n\n public buildType: string;\n\n public timestamp: number;\n\n public productFlavors: string[];\n\n public locales: MetafileLocale[];\n\n protected baseUrl: string;\n\n constructor(options: MetafileFileOptions) {\n this.id = options.id;\n this.file = options.file;\n this.path = options.path;\n this.library = options.library;\n this.module = options.module;\n this.buildType = options.buildType;\n this.timestamp = options.timestamp;\n this.productFlavors = options.productFlavors;\n this.locales = options.locales;\n this.baseUrl = options.baseUrl;\n }\n\n public toCdnFile(): CdnFile {\n return {\n id: this.id,\n file: this.file,\n path: this.path,\n library: this.library,\n module: this.module,\n buildType: this.buildType,\n productFlavors: this.productFlavors,\n locales: this.locales.map(\n (locale: MetafileLocale): CdnFileLocale => ({\n locale: locale.locale,\n isBaseLocale: locale.isBaseLocale,\n uri: `${this.baseUrl}${locale.uri}`,\n }),\n ),\n };\n }\n}\n","import { IMetafileFileLocale } from '@/interfaces/i-metafile-file-locale';\nimport { CdnLocale } from '@/types/cdn-locale';\n\nexport class MetafileLocale implements IMetafileFileLocale {\n public language: string;\n\n public region: string;\n\n public script: string;\n\n public isRtl: boolean;\n\n public name: string;\n\n public localizedName: string;\n\n public uri: string;\n\n public timestamp: number;\n\n protected baseLocale: string;\n\n constructor(options: IMetafileFileLocale, baseLocale: string) {\n this.language = options.language;\n this.region = options.region;\n this.script = options.script;\n this.isRtl = options.isRtl;\n this.name = options.name;\n this.localizedName = options.localizedName;\n this.uri = options.uri;\n this.timestamp = options.timestamp;\n this.baseLocale = baseLocale;\n }\n\n get locale(): string {\n if (this.language && this.region && this.script) {\n return `${this.language}_${this.region}#${this.script}`;\n }\n\n if (this.language && this.script) {\n return `${this.language}#${this.script}`;\n }\n\n if (this.language && this.region) {\n return `${this.language}_${this.region}`;\n }\n\n return this.language;\n }\n\n get isBaseLocale(): boolean {\n return this.locale === this.baseLocale;\n }\n\n public toCdnLocale(): CdnLocale {\n return {\n locale: this.locale,\n isBaseLocale: this.isBaseLocale,\n language: this.language,\n region: this.region,\n script: this.script,\n isRtl: this.isRtl,\n name: this.name,\n localizedName: this.localizedName,\n };\n }\n}\n","import { MetafileFile } from '@/cdn/metafile/metafile-file';\nimport { MetafileLocale } from '@/cdn/metafile/metafile-locale';\nimport { MetafileParams } from '@/cdn/metafile/metafile-params';\nimport { uniqBy } from '@/cdn/utils';\nimport { IMetafile } from '@/interfaces/i-metafile';\nimport { IMetafileFileLocale } from '@/interfaces/i-metafile-file-locale';\nimport { IMetafileFiles } from '@/interfaces/i-metafile-files';\nimport { CdnLocale } from '@/types/cdn-locale';\nimport { FilesMap } from '@/types/files-map';\nimport { MetafileOptions } from '@/types/metafile-options';\n\nexport class MetafileData implements Omit<IMetafile, 'files' | 'baseLocale'> {\n public projectUrl: string;\n\n public baseLocale: CdnLocale;\n\n public locales: CdnLocale[];\n\n public timestamp: number;\n\n public files: MetafileFile[];\n\n public filesMap: FilesMap;\n\n constructor(options: MetafileOptions, params: MetafileParams) {\n this.projectUrl = options.projectUrl;\n this.timestamp = options.timestamp;\n this.files = MetafileData.filesFactory(options.files, options.baseLocale, params);\n this.filesMap = MetafileData.filesMapFactory(this.files);\n this.locales = MetafileData.localesFactory(this.files);\n this.baseLocale = this.locales.find((locale: CdnLocale) => locale.isBaseLocale) as CdnLocale;\n }\n\n public static createEmpty(params: MetafileParams): MetafileData {\n return new MetafileData(\n {\n projectUrl: '',\n baseLocale: '',\n timestamp: 0,\n files: {},\n },\n params,\n );\n }\n\n protected static filesFactory(files: IMetafileFiles, baseLocale: string, params: MetafileParams): MetafileFile[] {\n return Object.keys(files).reduce((acc: MetafileFile[], cur: string) => {\n if (typeof files[cur] !== 'undefined') {\n const locales: MetafileLocale[] = files[cur].locales.map(\n (locale: IMetafileFileLocale) => new MetafileLocale(locale, baseLocale),\n );\n\n acc.push(\n new MetafileFile({\n ...files[cur],\n id: cur,\n locales,\n baseUrl: params.baseUrl,\n }),\n );\n }\n\n return acc;\n }, []);\n }\n\n protected static filesMapFactory(files: MetafileFile[]): FilesMap {\n return files.reduce((acc: FilesMap, cur: MetafileFile) => {\n acc[cur.id] = cur;\n\n return acc;\n }, {});\n }\n\n protected static localesFactory(files: MetafileFile[]): CdnLocale[] {\n const locales: CdnLocale[] = files.reduce((acc: CdnLocale[], cur: MetafileFile) => {\n acc.push(...cur.locales.map((locale: MetafileLocale): CdnLocale => locale.toCdnLocale()));\n return acc;\n }, []);\n\n return uniqBy(locales, (cdnLocale: CdnLocale): string => cdnLocale.locale);\n }\n}\n","import { IMetafileParams } from '@/interfaces/i-metafile-params';\n\nexport class MetafileParams implements IMetafileParams {\n protected options: IMetafileParams;\n\n constructor(metafileUrl: string) {\n this.options = MetafileParams.parseMetafileUrl(metafileUrl);\n }\n\n get url(): string {\n return this.options.url;\n }\n\n get baseUrl(): string {\n return this.options.baseUrl;\n }\n\n get cdnId(): string {\n return this.options.cdnId;\n }\n\n get jsonPath(): string {\n return this.options.jsonPath;\n }\n\n protected static parseMetafileUrl(metafileUrl: string): IMetafileParams {\n let url: URL;\n\n try {\n url = new URL(metafileUrl);\n } catch {\n throw new Error('Invalid param: \"options.metafile\" cannot be parsed as url.');\n }\n\n const matches: string[] | null = /^\\/(.*?)\\/(.*?)\\.(v2.json|js|ts)$/.exec(url.pathname);\n\n if (\n matches === null ||\n matches.length !== 4 ||\n typeof matches[1] === 'undefined' ||\n typeof matches[2] === 'undefined'\n ) {\n throw new Error('Invalid param: \"options.metafile\" contains invalid metafile url.');\n }\n\n const cdnId: string = matches[1];\n const tagId: string = matches[2];\n\n return {\n url: metafileUrl,\n baseUrl: url.origin,\n cdnId,\n jsonPath: `/${cdnId}/${tagId}.v2.json`,\n };\n }\n}\n","import { MetafileData } from '@/cdn/metafile/metafile-data';\nimport { MetafileParams } from '@/cdn/metafile/metafile-params';\nimport { IMetafile } from '@/interfaces/i-metafile';\nimport { CdnClientOptions } from '@/types/cdn-client-options';\n\nexport class MetafileContext {\n public params: MetafileParams;\n\n public parsedData: IMetafile | null;\n\n public data: MetafileData;\n\n constructor(options: CdnClientOptions) {\n this.params = new MetafileParams(options.metafile);\n this.parsedData = null;\n this.data = MetafileData.createEmpty(this.params);\n }\n\n public setMetafile(metafile: IMetafile): void {\n this.parsedData = metafile;\n\n this.data = new MetafileData(metafile, this.params);\n }\n}\n","import { IHttpAdapter } from '@/interfaces/i-http-adapter';\n\nexport class FetchHttpAdapter implements IHttpAdapter {\n protected baseUrl: string;\n\n constructor(baseUrl: string) {\n this.baseUrl = baseUrl;\n }\n\n async get(url: string): Promise<string | object> {\n const response: Response = await fetch(`${this.baseUrl}${url}`);\n const contentType: string | null = response.headers.get('content-type');\n const isJson: boolean = contentType === 'application/json5' || contentType === 'application/json';\n\n if (response.status >= 400) {\n throw new Error(`Request failed with status code ${response.status.toString()}`);\n }\n\n let result: string | object;\n\n if (isJson) {\n result = (await response.json()) as object;\n } else {\n result = await response.text();\n }\n\n return result;\n }\n}\n","import { Context } from '@/cdn/context/context';\n\nexport abstract class CdnBase {\n protected context: Context;\n\n constructor(context: Context) {\n this.context = context;\n }\n}\n","import { CdnBase } from '@/cdn/methods/cdn-base';\n\nexport class CdnCache extends CdnBase {\n public flush = (): void => {\n this.context.cache.flush();\n };\n}\n","import { MetafileData } from '@/cdn/metafile/metafile-data';\nimport { MetafileFile } from '@/cdn/metafile/metafile-file';\nimport { MetafileParams } from '@/cdn/metafile/metafile-params';\nimport { CdnBase } from '@/cdn/methods/cdn-base';\nimport { IMetafile } from '@/interfaces/i-metafile';\nimport { CdnClientOptions } from '@/types/cdn-client-options';\nimport { CdnFile } from '@/types/cdn-file';\nimport { CdnLocale } from '@/types/cdn-locale';\nimport { CdnLocalesOptions } from '@/types/cdn-locales-options';\n\nexport class CdnMetafile extends CdnBase {\n get projectUrl(): string {\n return this.context.metafile.data.projectUrl;\n }\n\n get baseLocale(): CdnLocale {\n return this.context.metafile.data.baseLocale;\n }\n\n get url(): string {\n return this.context.metafile.params.url;\n }\n\n get files(): CdnFile[] {\n return this.context.metafile.data.files.map((file: MetafileFile): CdnFile => file.toCdnFile());\n }\n\n public locales = (options?: CdnLocalesOptions): CdnLocale[] => {\n const { excludeBaseLocale }: CdnLocalesOptions = options || {};\n const { locales }: MetafileData = this.context.metafile.data;\n\n return excludeBaseLocale ? locales.filter((cdnLocale: CdnLocale): boolean => !cdnLocale.isBaseLocale) : locales;\n };\n\n public refresh = async (): Promise<void> => {\n const response: IMetafile = await this.context.api.fetchMetafile();\n\n this.context.metafile.setMetafile(response);\n };\n\n public switch = async (options: CdnClientOptions): Promise<void> => {\n this.context.metafile.params = new MetafileParams(options.metafile);\n\n await this.refresh();\n };\n}\n","import { Context } from '@/cdn/context/context';\nimport { LocalesMapData } from '@/types/locales-map-data';\nimport { LocalesMapOptions } from '@/types/locales-map-options';\n\nexport class LocalesMap {\n public data: LocalesMapData;\n\n protected context: Context;\n\n constructor(options: LocalesMapOptions) {\n this.context = options.context;\n this.data = options.data || {};\n }\n}\n","import { Context } from '@/cdn/context/context';\nimport { MetafileFile } from '@/cdn/metafile/metafile-file';\nimport { MetafileLocale } from '@/cdn/metafile/metafile-locale';\nimport { LocalesMap } from '@/cdn/request/locales-map';\nimport { ApiLocaleRequest } from '@/types/api-locale-request';\nimport { CdnResponse } from '@/types/cdn-response';\n\nexport class Request {\n public files: MetafileFile[];\n\n public localesMap: LocalesMap;\n\n public hasSingleFileResponse: boolean;\n\n public hasSingleLocaleResponse: boolean;\n\n protected context: Context;\n\n constructor(context: Context) {\n this.files = [];\n this.localesMap = new LocalesMap({ context });\n this.hasSingleFileResponse = false;\n this.hasSingleLocaleResponse = false;\n this.context = context;\n }\n\n public async execute(): Promise<CdnResponse> {\n const payload: [Promise<string | object>, ApiLocaleRequest][] = this.getPromises();\n const promises: Promise<string | object>[] = payload.map(\n (item: [Promise<string | object>, ApiLocaleRequest]) => item[0],\n );\n const requests: ApiLocaleRequest[] = payload.map((item: [Promise<string | object>, ApiLocaleRequest]) => item[1]);\n const responses: (string | object)[] = await Promise.all(promises);\n\n return this.context.responseFactory.createCdnResponse({\n requests,\n responses,\n localesMap: this.localesMap,\n hasSingleFileResponse: this.hasSingleFileResponse,\n hasSingleLocaleResponse: this.hasSingleLocaleResponse,\n });\n }\n\n protected getPromises(): [Promise<string | object>, ApiLocaleRequest][] {\n return this.files.reduce((acc: [Promise<string | object>, ApiLocaleRequest][], cur: MetafileFile) => {\n if (typeof this.localesMap.data?.[cur.id] !== 'undefined') {\n acc.push(\n // @ts-expect-error TODO fix type\n ...this.localesMap.data[cur.id].map(\n (metafileLocale: MetafileLocale): [Promise<string | object>, ApiLocaleRequest] => {\n const request: ApiLocaleRequest = {\n metafileFile: cur,\n metafileLocale,\n };\n\n return [this.context.api.fetchLocale(request), request];\n },\n ),\n );\n }\n return acc;\n }, []);\n }\n}\n","import { Context } from '@/cdn/context/context';\nimport { MetafileFile } from '@/cdn/metafile/metafile-file';\nimport { MetafileLocale } from '@/cdn/metafile/metafile-locale';\nimport { LocalesMap } from '@/cdn/request/locales-map';\nimport { Request } from '@/cdn/request/request';\nimport { isArray, isPlainObject, isString, isUndefined } from '@/cdn/utils';\nimport { IRequestBuilder } from '@/interfaces/i-request-builder';\nimport { CdnFile } from '@/types/cdn-file';\n\nexport class RequestBuilder implements IRequestBuilder {\n protected context: Context;\n\n protected request: Request;\n\n constructor(context: Context) {\n this.context = context;\n this.request = new Request(this.context);\n }\n\n public addFiles(files?: (CdnFile | string)[] | CdnFile | string): this {\n if (!(isPlainObject(files) || isString(files) || isUndefined(files) || isArray(files))) {\n throw new Error('Invalid param: \"request.files\" must be object, array, string or undefined.');\n }\n\n if (isArray(files)) {\n files.forEach((i: CdnFile | string): void => {\n if (!(isPlainObject(i) || isString(i))) {\n throw new Error('Invalid param: array \"request.files\" must contain objects or strings.');\n }\n });\n }\n\n if (isString(files)) {\n this.request.hasSingleFileResponse = true;\n\n const file: MetafileFile | undefined = this.context.metafile.data.files.find(\n (i: MetafileFile): boolean => i.id === files,\n );\n\n if (!(file instanceof MetafileFile)) {\n throw new Error(`File not found: \"${files}\".`);\n }\n\n this.request.files = [file];\n } else if (isUndefined(files)) {\n this.request.files = [...this.context.metafile.data.files];\n } else if (isArray(files)) {\n this.request.files = files.map((file: CdnFile | string): MetafileFile => {\n let metafileFile: MetafileFile;\n\n if (isString(file)) {\n const foundFile: MetafileFile | undefined = this.context.metafile.data.files.find(\n (i: MetafileFile): boolean => i.id === file,\n );\n\n if (isUndefined(foundFile)) {\n throw new Error(`File not found: \"${file}\".`);\n }\n\n metafileFile = foundFile;\n } else {\n const foundFile: MetafileFile | undefined = this.context.metafile.data.files.find(\n (i: MetafileFile): boolean => i.id === file.id,\n );\n\n if (isUndefined(foundFile)) {\n throw new Error(`File not found: \"${file.id}\".`);\n }\n\n metafileFile = foundFile;\n }\n\n return metafileFile;\n });\n } else if (isPlainObject(files)) {\n this.request.hasSingleFileResponse = true;\n\n const foundFile: MetafileFile | undefined = this.context.metafile.data.files.find(\n (i: MetafileFile): boolean => i.id === files.id,\n );\n\n if (isUndefined(foundFile)) {\n throw new Error(`File not found: \"${files.id}\".`);\n }\n\n this.request.files = [foundFile];\n }\n\n return this;\n }\n\n public addLocales(locales?: string[] | string, excludeBaseLocale?: boolean): this {\n if (!(isString(locales) || isUndefined(locales) || isArray(locales))) {\n throw new Error('Invalid param: \"request.locales\" must be array, string or undefined.');\n }\n\n if (isArray(locales)) {\n locales.forEach((i: MetafileFile | string): void => {\n if (!isString(i)) {\n throw new Error('Invalid param: array \"request.locales\" must contain strings.');\n }\n });\n }\n\n if (isString(locales)) {\n this.request.hasSingleLocaleResponse = true;\n this.request.files.reduce((acc: LocalesMap, cur: MetafileFile) => {\n acc.data[cur.id] = cur.locales.filter(\n (metafileLocale: MetafileLocale): boolean => metafileLocale.locale === locales,\n );\n\n return acc;\n }, this.request.localesMap);\n } else if (isUndefined(locales)) {\n this.request.files.reduce((acc: LocalesMap, cur: MetafileFile) => {\n acc.data[cur.id] = excludeBaseLocale\n ? cur.locales.filter((metafileLocale: MetafileLocale): boolean => !metafileLocale.isBaseLocale)\n : cur.locales;\n\n return acc;\n }, this.request.localesMap);\n } else if (isArray(locales)) {\n this.request.files.reduce((acc: LocalesMap, cur: MetafileFile) => {\n acc.data[cur.id] = cur.locales.filter((metafileLocale: MetafileLocale) =>\n locales.includes(metafileLocale.locale),\n );\n\n return acc;\n }, this.request.localesMap);\n }\n\n return this;\n }\n\n public getCdnRequest(): Request {\n const result: Request = this.request;\n this.request = new Request(this.context);\n return result;\n }\n}\n","import { Context } from '@/cdn/context/context';\nimport { MetafileContext } from '@/cdn/context/metafile-context';\nimport { FetchHttpAdapter } from '@/cdn/http/fetch-http-adapter';\nimport { CdnCache } from '@/cdn/methods/cdn-cache';\nimport { CdnMetafile } from '@/cdn/methods/cdn-metafile';\nimport { RequestBuilder } from '@/cdn/request/request-builder';\nimport { isString } from '@/cdn/utils';\nimport { CdnClientOptions } from '@/types/cdn-client-options';\nimport { CdnFetchOptions } from '@/types/cdn-fetch-options';\nimport { CdnResponse } from '@/types/cdn-response';\n\nexport class CdnClient {\n public metafile: CdnMetafile;\n\n public cache: CdnCache;\n\n protected context: Context;\n\n public static version = '__CLIENT_VERSION__';\n\n protected constructor(options: CdnClientOptions) {\n const metafileContext: MetafileContext = new MetafileContext(options);\n const client: FetchHttpAdapter = new FetchHttpAdapter(metafileContext.params.baseUrl);\n\n this.context = new Context({ metafileContext, cdn: this, client });\n this.metafile = new CdnMetafile(this.context);\n this.cache = new CdnCache(this.context);\n }\n\n public fetch = async (options?: CdnFetchOptions): Promise<CdnResponse> => {\n const { files, locales, excludeBaseLocale }: CdnFetchOptions = options || {};\n const requestBuilder: RequestBuilder = new RequestBuilder(this.context)\n .addFiles(files)\n .addLocales(locales, excludeBaseLocale);\n\n return requestBuilder.getCdnRequest().execute();\n };\n\n public static async create(options: CdnClientOptions): Promise<CdnClient> {\n if (!options) {\n throw new Error('Invalid param: missing required \"options\" parameter.');\n }\n\n if (!isString(options.metafile)) {\n throw new Error('Invalid param: \"options.metafile\" must be string.');\n }\n\n const cdn: CdnClient = new CdnClient(options);\n\n await cdn.metafile.refresh();\n\n return cdn;\n }\n}\n"],"names":[],"mappings":";;;;;;AAIO,MAAM,IAAI;AAAA,EAGf,YAAY,SAAkB;AAFpB;AAGR,SAAK,UAAU;AAAA,EAAA;AAAA,EAGjB,MAAa,YAAY,SAAqD;AAC5E,QAAI,KAAK,QAAQ,MAAM,IAAI,OAAO,GAAG;AAC5B,aAAA,IAAI,QAAQ,CAAC,YAAkB;AACpC,gBAAQ,KAAK,QAAQ,MAAM,IAAI,OAAO,CAAoB;AAAA,MAAA,CAC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