@coraltravelcenter/b2c-landing-builder 2.12.1 → 2.12.2
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/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coraltravelcenter/b2c-landing-builder",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.2",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@coraltravelcenter/b2c-landing-builder",
|
|
9
|
-
"version": "2.12.
|
|
9
|
+
"version": "2.12.2",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@babel/parser": "7.28.6",
|
package/package.json
CHANGED
|
@@ -195,10 +195,25 @@ export class BackofficeClient {
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
async listFiles(remoteDirectory) {
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
198
|
+
const remotePath = remoteDirectory.replace(/^\/+/, "");
|
|
199
|
+
const files = [];
|
|
200
|
+
const seenTokens = new Set();
|
|
201
|
+
let pageToken;
|
|
202
|
+
let baseUrl;
|
|
203
|
+
do {
|
|
204
|
+
const result = await this.request("GET", "/FileManagement/ListFiles", {
|
|
205
|
+
query: {path: remotePath, ...(pageToken ? {pageToken} : {})},
|
|
206
|
+
});
|
|
207
|
+
const page = result?.result || result || {};
|
|
208
|
+
if (Array.isArray(page.files)) files.push(...page.files);
|
|
209
|
+
baseUrl ||= page.baseUrl;
|
|
210
|
+
pageToken = page.pageToken;
|
|
211
|
+
if (pageToken && seenTokens.has(pageToken)) {
|
|
212
|
+
throw new Error("Backoffice file listing returned a repeated page token");
|
|
213
|
+
}
|
|
214
|
+
if (pageToken) seenTokens.add(pageToken);
|
|
215
|
+
} while (pageToken);
|
|
216
|
+
return {baseUrl, files};
|
|
202
217
|
}
|
|
203
218
|
|
|
204
219
|
async uploadFile(remotePath, localPath) {
|