@jam-comments/server-utilities 4.2.0 → 4.3.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 +8 -1
- package/dist/cjs/markupFetcher.js +93 -33
- package/dist/cjs/markupFetcher.test.js +223 -28
- package/dist/cjs/utils.js +52 -15
- package/dist/cjs/utils.test.js +43 -0
- package/dist/esm/index.js +4 -2
- package/dist/esm/markupFetcher.js +89 -33
- package/dist/esm/markupFetcher.test.js +212 -17
- package/dist/esm/utils.js +46 -14
- package/dist/esm/utils.test.js +44 -1
- package/dist/types/index.d.ts +3 -2
- package/dist/types/markupFetcher.d.ts +24 -1
- package/dist/types/utils.d.ts +7 -0
- package/package.json +1 -1
|
@@ -7,4 +7,27 @@ export interface IFetchData {
|
|
|
7
7
|
baseUrl?: string;
|
|
8
8
|
environment?: string;
|
|
9
9
|
}
|
|
10
|
-
export
|
|
10
|
+
export type IBatchFetchData = Omit<IFetchData, "path" | "schema"> & {
|
|
11
|
+
page?: number;
|
|
12
|
+
};
|
|
13
|
+
interface IBatchResponse {
|
|
14
|
+
data: {
|
|
15
|
+
path: string;
|
|
16
|
+
markup: string;
|
|
17
|
+
}[];
|
|
18
|
+
meta: {
|
|
19
|
+
current_page: number;
|
|
20
|
+
from: number;
|
|
21
|
+
last_page: number;
|
|
22
|
+
path: string;
|
|
23
|
+
per_page: number;
|
|
24
|
+
to: number;
|
|
25
|
+
total: number;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export declare function fetchAll({ tz, domain, apiKey, baseUrl, environment, }: IBatchFetchData, platform: string, fetchImplementation?: any, batchMarkupFetcherImpl?: any): Promise<void>;
|
|
29
|
+
export declare function batchMarkupFetcher(platform: string, fetchImplementation?: typeof fetch): (args: IBatchFetchData) => Promise<IBatchResponse>;
|
|
30
|
+
export declare function fetchFreshMarkup({ tz, path, domain, apiKey, baseUrl, environment, }: IFetchData, fetchImplementation: typeof fetch, platform: string): Promise<string>;
|
|
31
|
+
export declare function makeMarkupRequest<T extends Partial<IBatchFetchData & IFetchData>>({ tz, path, domain, apiKey, baseUrl, environment, page, }: T, baseServicePath: string, fetchImplementation: typeof fetch, platform: string): Promise<Response>;
|
|
32
|
+
export declare function markupFetcher(platform: string, fetchImplementation?: typeof fetch): (args: IFetchData) => Promise<string>;
|
|
33
|
+
export {};
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { existsSync, mkdirSync, readFileSync } from "fs";
|
|
1
3
|
export declare function isValidTimezone(tz: string): boolean;
|
|
2
4
|
export declare function getEnvironment(): string;
|
|
3
5
|
export declare function reAppendMarkup(element: HTMLElement, markup: string): void;
|
|
4
6
|
export declare function parseJson(json: string): any;
|
|
5
7
|
export declare function unescapeHTML(str: any): any;
|
|
8
|
+
export declare function deleteTempDirectory(): void;
|
|
9
|
+
export declare function createTempDirectory(mkdirSyncImpl?: typeof mkdirSync, existsSyncImpl?: typeof existsSync): void;
|
|
10
|
+
export declare function toSavedFileName(name: string): string;
|
|
11
|
+
export declare function readFile(name: any, readFileSyncImpl?: typeof readFileSync): string;
|
|
12
|
+
export declare function saveFile(name: string, data: string, writeFileImpl?: any): Promise<void>;
|