@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,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
|
-
var __publicField = (obj, key, value) =>
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
/* @localazy/cdn-client@1.5.2
|
|
9
|
-
* (c) 2024 Localazy <team@localazy.com>
|
|
4
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
|
+
/* @localazy/cdn-client@1.5.3
|
|
6
|
+
* (c) 2025 Localazy <team@localazy.com>
|
|
10
7
|
* @license MIT */
|
|
11
8
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
12
9
|
class Api {
|
|
@@ -26,22 +23,6 @@ class Api {
|
|
|
26
23
|
return await this.context.client.get(this.context.metafile.params.jsonPath);
|
|
27
24
|
}
|
|
28
25
|
}
|
|
29
|
-
const isString = (value) => typeof value === "string";
|
|
30
|
-
const isUndefined = (value) => typeof value === "undefined";
|
|
31
|
-
const isArray = (value) => Array.isArray(value);
|
|
32
|
-
const isPlainObject = (value) => Object.prototype.toString.call(value) === "[object Object]";
|
|
33
|
-
const uniq = (array) => [...new Set(array)];
|
|
34
|
-
const uniqBy = (array, predicate) => {
|
|
35
|
-
const seen = {};
|
|
36
|
-
return array.filter((item) => {
|
|
37
|
-
const key = predicate(item);
|
|
38
|
-
if (!Object.hasOwn(seen, key)) {
|
|
39
|
-
seen[key] = true;
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
return false;
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
26
|
class MemoryCacheAdapter {
|
|
46
27
|
constructor() {
|
|
47
28
|
__publicField(this, "map");
|
|
@@ -60,6 +41,22 @@ class MemoryCacheAdapter {
|
|
|
60
41
|
this.map = /* @__PURE__ */ new Map();
|
|
61
42
|
}
|
|
62
43
|
}
|
|
44
|
+
const isString = (value) => typeof value === "string";
|
|
45
|
+
const isUndefined = (value) => typeof value === "undefined";
|
|
46
|
+
const isArray = (value) => Array.isArray(value);
|
|
47
|
+
const isPlainObject = (value) => Object.prototype.toString.call(value) === "[object Object]";
|
|
48
|
+
const uniq = (array) => [...new Set(array)];
|
|
49
|
+
const uniqBy = (array, predicate) => {
|
|
50
|
+
const seen = {};
|
|
51
|
+
return array.filter((item) => {
|
|
52
|
+
const key = predicate(item);
|
|
53
|
+
if (!Object.hasOwn(seen, key)) {
|
|
54
|
+
seen[key] = true;
|
|
55
|
+
return true;
|
|
56
|
+
}
|
|
57
|
+
return false;
|
|
58
|
+
});
|
|
59
|
+
};
|
|
63
60
|
class LocalesCache {
|
|
64
61
|
constructor(context) {
|
|
65
62
|
__publicField(this, "context");
|
|
@@ -106,19 +103,106 @@ class LocalesCache {
|
|
|
106
103
|
return indices.filter((key) => key !== "").join("-");
|
|
107
104
|
}
|
|
108
105
|
}
|
|
109
|
-
class
|
|
106
|
+
class ResponseFactory {
|
|
110
107
|
constructor(context) {
|
|
111
108
|
__publicField(this, "context");
|
|
112
109
|
this.context = context;
|
|
113
110
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
111
|
+
createCdnResponse(options) {
|
|
112
|
+
const { requests, responses, hasSingleFileResponse, hasSingleLocaleResponse } = options;
|
|
113
|
+
if (responses.length === 0 || typeof responses[0] === "undefined") {
|
|
114
|
+
return {};
|
|
115
|
+
}
|
|
116
|
+
this.cacheResponses(requests, responses);
|
|
117
|
+
return hasSingleFileResponse && hasSingleLocaleResponse ? responses[0] : ResponseFactory.transformResponses(options);
|
|
118
|
+
}
|
|
119
|
+
cacheResponses(requests, responses) {
|
|
120
|
+
responses.forEach((response, index) => {
|
|
121
|
+
if (typeof requests[index] !== "undefined") {
|
|
122
|
+
const { metafileFile, metafileLocale } = requests[index];
|
|
123
|
+
if (metafileFile && metafileLocale) {
|
|
124
|
+
this.context.cache.setIfMissed({ metafileFile, metafileLocale, data: response });
|
|
125
|
+
}
|
|
126
|
+
}
|
|
120
127
|
});
|
|
121
128
|
}
|
|
129
|
+
static transformResponses(options) {
|
|
130
|
+
const { requests, responses, hasSingleFileResponse } = options;
|
|
131
|
+
return responses.reduce((acc, cur, index) => {
|
|
132
|
+
if (typeof requests[index] !== "undefined") {
|
|
133
|
+
const { metafileFile, metafileLocale } = requests[index];
|
|
134
|
+
if (metafileFile && metafileLocale) {
|
|
135
|
+
if (hasSingleFileResponse) {
|
|
136
|
+
acc[metafileLocale.locale] = cur;
|
|
137
|
+
} else {
|
|
138
|
+
if (!acc[metafileFile.id]) {
|
|
139
|
+
acc[metafileFile.id] = {};
|
|
140
|
+
}
|
|
141
|
+
acc[metafileFile.id][metafileLocale.locale] = cur;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return acc;
|
|
146
|
+
}, {});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
class Context {
|
|
150
|
+
constructor(options) {
|
|
151
|
+
__publicField(this, "metafile");
|
|
152
|
+
__publicField(this, "cdn");
|
|
153
|
+
__publicField(this, "client");
|
|
154
|
+
__publicField(this, "api");
|
|
155
|
+
__publicField(this, "cache");
|
|
156
|
+
__publicField(this, "responseFactory");
|
|
157
|
+
this.metafile = options.metafileContext;
|
|
158
|
+
this.cdn = options.cdn;
|
|
159
|
+
this.client = options.client;
|
|
160
|
+
this.api = new Api(this);
|
|
161
|
+
this.cache = new LocalesCache(this);
|
|
162
|
+
this.responseFactory = new ResponseFactory(this);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
class MetafileFile {
|
|
166
|
+
constructor(options) {
|
|
167
|
+
__publicField(this, "id");
|
|
168
|
+
__publicField(this, "file");
|
|
169
|
+
__publicField(this, "path");
|
|
170
|
+
__publicField(this, "library");
|
|
171
|
+
__publicField(this, "module");
|
|
172
|
+
__publicField(this, "buildType");
|
|
173
|
+
__publicField(this, "timestamp");
|
|
174
|
+
__publicField(this, "productFlavors");
|
|
175
|
+
__publicField(this, "locales");
|
|
176
|
+
__publicField(this, "baseUrl");
|
|
177
|
+
this.id = options.id;
|
|
178
|
+
this.file = options.file;
|
|
179
|
+
this.path = options.path;
|
|
180
|
+
this.library = options.library;
|
|
181
|
+
this.module = options.module;
|
|
182
|
+
this.buildType = options.buildType;
|
|
183
|
+
this.timestamp = options.timestamp;
|
|
184
|
+
this.productFlavors = options.productFlavors;
|
|
185
|
+
this.locales = options.locales;
|
|
186
|
+
this.baseUrl = options.baseUrl;
|
|
187
|
+
}
|
|
188
|
+
toCdnFile() {
|
|
189
|
+
return {
|
|
190
|
+
id: this.id,
|
|
191
|
+
file: this.file,
|
|
192
|
+
path: this.path,
|
|
193
|
+
library: this.library,
|
|
194
|
+
module: this.module,
|
|
195
|
+
buildType: this.buildType,
|
|
196
|
+
productFlavors: this.productFlavors,
|
|
197
|
+
locales: this.locales.map(
|
|
198
|
+
(locale) => ({
|
|
199
|
+
locale: locale.locale,
|
|
200
|
+
isBaseLocale: locale.isBaseLocale,
|
|
201
|
+
uri: `${this.baseUrl}${locale.uri}`
|
|
202
|
+
})
|
|
203
|
+
)
|
|
204
|
+
};
|
|
205
|
+
}
|
|
122
206
|
}
|
|
123
207
|
class MetafileLocale {
|
|
124
208
|
constructor(options, baseLocale) {
|
|
@@ -169,48 +253,6 @@ class MetafileLocale {
|
|
|
169
253
|
};
|
|
170
254
|
}
|
|
171
255
|
}
|
|
172
|
-
class MetafileFile {
|
|
173
|
-
constructor(options) {
|
|
174
|
-
__publicField(this, "id");
|
|
175
|
-
__publicField(this, "file");
|
|
176
|
-
__publicField(this, "path");
|
|
177
|
-
__publicField(this, "library");
|
|
178
|
-
__publicField(this, "module");
|
|
179
|
-
__publicField(this, "buildType");
|
|
180
|
-
__publicField(this, "timestamp");
|
|
181
|
-
__publicField(this, "productFlavors");
|
|
182
|
-
__publicField(this, "locales");
|
|
183
|
-
__publicField(this, "baseUrl");
|
|
184
|
-
this.id = options.id;
|
|
185
|
-
this.file = options.file;
|
|
186
|
-
this.path = options.path;
|
|
187
|
-
this.library = options.library;
|
|
188
|
-
this.module = options.module;
|
|
189
|
-
this.buildType = options.buildType;
|
|
190
|
-
this.timestamp = options.timestamp;
|
|
191
|
-
this.productFlavors = options.productFlavors;
|
|
192
|
-
this.locales = options.locales;
|
|
193
|
-
this.baseUrl = options.baseUrl;
|
|
194
|
-
}
|
|
195
|
-
toCdnFile() {
|
|
196
|
-
return {
|
|
197
|
-
id: this.id,
|
|
198
|
-
file: this.file,
|
|
199
|
-
path: this.path,
|
|
200
|
-
library: this.library,
|
|
201
|
-
module: this.module,
|
|
202
|
-
buildType: this.buildType,
|
|
203
|
-
productFlavors: this.productFlavors,
|
|
204
|
-
locales: this.locales.map(
|
|
205
|
-
(locale) => ({
|
|
206
|
-
locale: locale.locale,
|
|
207
|
-
isBaseLocale: locale.isBaseLocale,
|
|
208
|
-
uri: `${this.baseUrl}${locale.uri}`
|
|
209
|
-
})
|
|
210
|
-
)
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
256
|
class MetafileData {
|
|
215
257
|
constructor(options, params) {
|
|
216
258
|
__publicField(this, "projectUrl");
|
|
@@ -239,17 +281,19 @@ class MetafileData {
|
|
|
239
281
|
}
|
|
240
282
|
static filesFactory(files, baseLocale, params) {
|
|
241
283
|
return Object.keys(files).reduce((acc, cur) => {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
284
|
+
if (typeof files[cur] !== "undefined") {
|
|
285
|
+
const locales = files[cur].locales.map(
|
|
286
|
+
(locale) => new MetafileLocale(locale, baseLocale)
|
|
287
|
+
);
|
|
288
|
+
acc.push(
|
|
289
|
+
new MetafileFile({
|
|
290
|
+
...files[cur],
|
|
291
|
+
id: cur,
|
|
292
|
+
locales,
|
|
293
|
+
baseUrl: params.baseUrl
|
|
294
|
+
})
|
|
295
|
+
);
|
|
296
|
+
}
|
|
253
297
|
return acc;
|
|
254
298
|
}, []);
|
|
255
299
|
}
|
|
@@ -288,11 +332,11 @@ class MetafileParams {
|
|
|
288
332
|
let url;
|
|
289
333
|
try {
|
|
290
334
|
url = new URL(metafileUrl);
|
|
291
|
-
} catch
|
|
335
|
+
} catch {
|
|
292
336
|
throw new Error('Invalid param: "options.metafile" cannot be parsed as url.');
|
|
293
337
|
}
|
|
294
|
-
const matches =
|
|
295
|
-
if (matches === null || matches.length !== 4) {
|
|
338
|
+
const matches = /^\/(.*?)\/(.*?)\.(v2.json|js|ts)$/.exec(url.pathname);
|
|
339
|
+
if (matches === null || matches.length !== 4 || typeof matches[1] === "undefined" || typeof matches[2] === "undefined") {
|
|
296
340
|
throw new Error('Invalid param: "options.metafile" contains invalid metafile url.');
|
|
297
341
|
}
|
|
298
342
|
const cdnId = matches[1];
|
|
@@ -319,59 +363,39 @@ class MetafileContext {
|
|
|
319
363
|
this.data = new MetafileData(metafile, this.params);
|
|
320
364
|
}
|
|
321
365
|
}
|
|
322
|
-
class
|
|
323
|
-
constructor(
|
|
324
|
-
__publicField(this, "
|
|
325
|
-
this.
|
|
366
|
+
class FetchHttpAdapter {
|
|
367
|
+
constructor(baseUrl) {
|
|
368
|
+
__publicField(this, "baseUrl");
|
|
369
|
+
this.baseUrl = baseUrl;
|
|
326
370
|
}
|
|
327
|
-
|
|
328
|
-
const
|
|
329
|
-
|
|
330
|
-
|
|
371
|
+
async get(url) {
|
|
372
|
+
const response = await fetch(`${this.baseUrl}${url}`);
|
|
373
|
+
const contentType = response.headers.get("content-type");
|
|
374
|
+
const isJson = contentType === "application/json5" || contentType === "application/json";
|
|
375
|
+
if (response.status >= 400) {
|
|
376
|
+
throw new Error(`Request failed with status code ${response.status.toString()}`);
|
|
331
377
|
}
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
this.context.cache.setIfMissed({ metafileFile, metafileLocale, data: response });
|
|
340
|
-
}
|
|
341
|
-
});
|
|
378
|
+
let result;
|
|
379
|
+
if (isJson) {
|
|
380
|
+
result = await response.json();
|
|
381
|
+
} else {
|
|
382
|
+
result = await response.text();
|
|
383
|
+
}
|
|
384
|
+
return result;
|
|
342
385
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
if (hasSingleFileResponse) {
|
|
349
|
-
acc[metafileLocale.locale] = cur;
|
|
350
|
-
} else {
|
|
351
|
-
if (!acc[metafileFile.id]) {
|
|
352
|
-
acc[metafileFile.id] = {};
|
|
353
|
-
}
|
|
354
|
-
acc[metafileFile.id][metafileLocale.locale] = cur;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return acc;
|
|
358
|
-
}, {});
|
|
386
|
+
}
|
|
387
|
+
class CdnBase {
|
|
388
|
+
constructor(context) {
|
|
389
|
+
__publicField(this, "context");
|
|
390
|
+
this.context = context;
|
|
359
391
|
}
|
|
360
392
|
}
|
|
361
|
-
class
|
|
362
|
-
constructor(
|
|
363
|
-
|
|
364
|
-
__publicField(this, "
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
__publicField(this, "cache");
|
|
368
|
-
__publicField(this, "responseFactory");
|
|
369
|
-
this.metafile = options.metafileContext;
|
|
370
|
-
this.cdn = options.cdn;
|
|
371
|
-
this.client = options.client;
|
|
372
|
-
this.api = new Api(this);
|
|
373
|
-
this.cache = new LocalesCache(this);
|
|
374
|
-
this.responseFactory = new ResponseFactory(this);
|
|
393
|
+
class CdnCache extends CdnBase {
|
|
394
|
+
constructor() {
|
|
395
|
+
super(...arguments);
|
|
396
|
+
__publicField(this, "flush", () => {
|
|
397
|
+
this.context.cache.flush();
|
|
398
|
+
});
|
|
375
399
|
}
|
|
376
400
|
}
|
|
377
401
|
class CdnMetafile extends CdnBase {
|
|
@@ -442,7 +466,8 @@ class Request {
|
|
|
442
466
|
}
|
|
443
467
|
getPromises() {
|
|
444
468
|
return this.files.reduce((acc, cur) => {
|
|
445
|
-
|
|
469
|
+
var _a;
|
|
470
|
+
if (typeof ((_a = this.localesMap.data) == null ? void 0 : _a[cur.id]) !== "undefined") {
|
|
446
471
|
acc.push(
|
|
447
472
|
...this.localesMap.data[cur.id].map(
|
|
448
473
|
(metafileLocale) => {
|
|
@@ -562,27 +587,6 @@ class RequestBuilder {
|
|
|
562
587
|
return result;
|
|
563
588
|
}
|
|
564
589
|
}
|
|
565
|
-
class FetchHttpAdapter {
|
|
566
|
-
constructor(baseUrl) {
|
|
567
|
-
__publicField(this, "baseUrl");
|
|
568
|
-
this.baseUrl = baseUrl;
|
|
569
|
-
}
|
|
570
|
-
async get(url) {
|
|
571
|
-
const response = await fetch(`${this.baseUrl}${url}`);
|
|
572
|
-
const contentType = response.headers.get("content-type");
|
|
573
|
-
const isJson = contentType === "application/json5" || contentType === "application/json";
|
|
574
|
-
if (response.status >= 400) {
|
|
575
|
-
throw new Error(`Request failed with status code ${response.status}`);
|
|
576
|
-
}
|
|
577
|
-
let result;
|
|
578
|
-
if (isJson) {
|
|
579
|
-
result = await response.json();
|
|
580
|
-
} else {
|
|
581
|
-
result = await response.text();
|
|
582
|
-
}
|
|
583
|
-
return result;
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
590
|
const _CdnClient = class _CdnClient {
|
|
587
591
|
constructor(options) {
|
|
588
592
|
__publicField(this, "metafile");
|
|
@@ -611,7 +615,7 @@ const _CdnClient = class _CdnClient {
|
|
|
611
615
|
return cdn;
|
|
612
616
|
}
|
|
613
617
|
};
|
|
614
|
-
__publicField(_CdnClient, "version", "1.5.
|
|
618
|
+
__publicField(_CdnClient, "version", "1.5.3");
|
|
615
619
|
let CdnClient = _CdnClient;
|
|
616
620
|
exports.Api = Api;
|
|
617
621
|
exports.CdnBase = CdnBase;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localazy-cdn-client.cjs","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\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rE;AAEM,UAAA,MAAiB,IAAI,WAAU,OAAO;AAEtC,UAAA,IAAI,SAAS;AAEZ,WAAA;AAAA,EACT;AACF;AAnCE,cAPW,YAOG,WAAU;AAPnB,IAAM,YAAN;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"localazy-cdn-client.cjs","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;AAC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