@jam-comments/server-utilities 5.8.3 → 5.9.1
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/cjs/index.js +6 -1
- package/dist/cjs/markupFetcher.js +1 -0
- package/dist/cjs/store.js +14 -9
- package/dist/esm/index.js +2 -0
- package/dist/esm/markupFetcher.js +1 -0
- package/dist/esm/store.js +14 -9
- package/dist/types/index.d.ts +2 -0
- package/dist/types/markupFetcher.d.ts +1 -1
- package/dist/types/store.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.logError = exports.log = exports.removeFalseyValues = exports.fetchAll = exports.markupFetcher = void 0;
|
|
6
|
+
exports.store = exports.logError = exports.log = exports.removeFalseyValues = exports.fetchAll = exports.markupFetcher = void 0;
|
|
7
|
+
const store_1 = __importDefault(require("./store"));
|
|
8
|
+
exports.store = store_1.default;
|
|
4
9
|
var markupFetcher_1 = require("./markupFetcher");
|
|
5
10
|
Object.defineProperty(exports, "markupFetcher", { enumerable: true, get: function () { return markupFetcher_1.markupFetcher; } });
|
|
6
11
|
Object.defineProperty(exports, "fetchAll", { enumerable: true, get: function () { return markupFetcher_1.fetchAll; } });
|
|
@@ -46,6 +46,7 @@ async function fetchAll({ tz = undefined, dateFormat = undefined, domain, apiKey
|
|
|
46
46
|
store_1.default.clear();
|
|
47
47
|
throw error;
|
|
48
48
|
}
|
|
49
|
+
return store_1.default.store;
|
|
49
50
|
}
|
|
50
51
|
function batchMarkupFetcher(platform, fetchImplementation = fetch) {
|
|
51
52
|
return async ({ tz, copy, domain, apiKey, dateFormat, baseUrl = BASE_URL, environment = (0, utils_1.getEnvironment)(), page = 1, }) => {
|
package/dist/cjs/store.js
CHANGED
|
@@ -1,30 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
3
|
+
let STORE = null;
|
|
4
4
|
const store = {
|
|
5
5
|
init() {
|
|
6
|
-
|
|
6
|
+
if (!STORE) {
|
|
7
|
+
STORE = new Map();
|
|
8
|
+
}
|
|
7
9
|
},
|
|
8
10
|
isInitialized() {
|
|
9
|
-
return
|
|
11
|
+
return STORE !== null;
|
|
10
12
|
},
|
|
11
13
|
set(path, markup) {
|
|
12
|
-
|
|
14
|
+
STORE.set(store.toPathKey(path), markup);
|
|
13
15
|
},
|
|
14
16
|
get(path) {
|
|
15
|
-
return
|
|
17
|
+
return STORE.get(store.toPathKey(path)) || null;
|
|
16
18
|
},
|
|
17
19
|
clear() {
|
|
18
|
-
if (
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
if (STORE) {
|
|
21
|
+
STORE.clear();
|
|
22
|
+
STORE = null;
|
|
21
23
|
}
|
|
22
24
|
},
|
|
23
25
|
getEmptyMarkup() {
|
|
24
|
-
return
|
|
26
|
+
return STORE.get("EMPTY");
|
|
25
27
|
},
|
|
26
28
|
toPathKey(path) {
|
|
27
29
|
return path.replace(/^\//, "").replace(/\//g, "::");
|
|
28
30
|
},
|
|
31
|
+
get store() {
|
|
32
|
+
return STORE;
|
|
33
|
+
},
|
|
29
34
|
};
|
|
30
35
|
exports.default = store;
|
package/dist/esm/index.js
CHANGED
|
@@ -36,6 +36,7 @@ export async function fetchAll({ tz = undefined, dateFormat = undefined, domain,
|
|
|
36
36
|
store.clear();
|
|
37
37
|
throw error;
|
|
38
38
|
}
|
|
39
|
+
return store.store;
|
|
39
40
|
}
|
|
40
41
|
export function batchMarkupFetcher(platform, fetchImplementation = fetch) {
|
|
41
42
|
return async ({ tz, copy, domain, apiKey, dateFormat, baseUrl = BASE_URL, environment = getEnvironment(), page = 1, }) => {
|
package/dist/esm/store.js
CHANGED
|
@@ -1,28 +1,33 @@
|
|
|
1
|
-
|
|
1
|
+
let STORE = null;
|
|
2
2
|
const store = {
|
|
3
3
|
init() {
|
|
4
|
-
|
|
4
|
+
if (!STORE) {
|
|
5
|
+
STORE = new Map();
|
|
6
|
+
}
|
|
5
7
|
},
|
|
6
8
|
isInitialized() {
|
|
7
|
-
return
|
|
9
|
+
return STORE !== null;
|
|
8
10
|
},
|
|
9
11
|
set(path, markup) {
|
|
10
|
-
|
|
12
|
+
STORE.set(store.toPathKey(path), markup);
|
|
11
13
|
},
|
|
12
14
|
get(path) {
|
|
13
|
-
return
|
|
15
|
+
return STORE.get(store.toPathKey(path)) || null;
|
|
14
16
|
},
|
|
15
17
|
clear() {
|
|
16
|
-
if (
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
if (STORE) {
|
|
19
|
+
STORE.clear();
|
|
20
|
+
STORE = null;
|
|
19
21
|
}
|
|
20
22
|
},
|
|
21
23
|
getEmptyMarkup() {
|
|
22
|
-
return
|
|
24
|
+
return STORE.get("EMPTY");
|
|
23
25
|
},
|
|
24
26
|
toPathKey(path) {
|
|
25
27
|
return path.replace(/^\//, "").replace(/\//g, "::");
|
|
26
28
|
},
|
|
29
|
+
get store() {
|
|
30
|
+
return STORE;
|
|
31
|
+
},
|
|
27
32
|
};
|
|
28
33
|
export default store;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ interface IBatchResponse {
|
|
|
48
48
|
total: number;
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
-
export declare function fetchAll({ tz, dateFormat, domain, apiKey, baseUrl, environment, copy, }: IBatchFetchData, platform: string, fetchImplementation?: any, batchMarkupFetcherImpl?: any): Promise<
|
|
51
|
+
export declare function fetchAll({ tz, dateFormat, domain, apiKey, baseUrl, environment, copy, }: IBatchFetchData, platform: string, fetchImplementation?: any, batchMarkupFetcherImpl?: any): Promise<Map<string, string>>;
|
|
52
52
|
export declare function batchMarkupFetcher(platform: string, fetchImplementation?: typeof fetch): (args: IBatchFetchData) => Promise<IBatchResponse>;
|
|
53
53
|
export declare function fetchFreshMarkup({ tz, path, copy, domain, apiKey, dateFormat, baseUrl, environment, }: IFetchData, fetchImplementation: typeof fetch, platform: string): Promise<string>;
|
|
54
54
|
export declare function makeMarkupRequest<T extends Partial<IBatchFetchData & IFetchData>>({ tz, path, page, domain, apiKey, dateFormat, copy, baseUrl, environment, }: T, baseServicePath: string, fetchImplementation: typeof fetch, platform: string): Promise<Response>;
|
package/dist/types/store.d.ts
CHANGED