@gooddata/api-client-tiger 11.67.0-alpha.2 → 11.67.0-alpha.4

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.
@@ -137,10 +137,15 @@ export declare class MetadataUtilities {
137
137
  * Given a function to get a paged list of metadata entities, API call parameters and options, this function will
138
138
  * retrieve all pages from the metadata.
139
139
  * Unlike to the getAllPagesOf, the requests will not be done in series. Instead, a first request will be done
140
- * with metaInclude=page to get the number of pages and all subsequent pages will be fetched in parallel.
140
+ * with metaInclude=page to get the number of pages and the subsequent pages will be fetched in parallel,
141
+ * at most four at a time. Once a page fails, no further pages are requested.
141
142
  *
142
- * The parameters are passed to the function as is. The options will be used as a 'template'. If the options specify
143
- * page `size`, it will be retained and used for paging.
143
+ * The parameters are passed to the function as is; `page` is added to any `metaInclude` they already contain.
144
+ * The options will be used as a 'template'. If the options specify page `size`, it will be retained and used
145
+ * for paging.
146
+ *
147
+ * When the backend does not return the number of pages, the subsequent pages are fetched in series until
148
+ * a page that is not full, the same way as getAllPagesOf does.
144
149
  *
145
150
  * @param client - API client to use, this is required so that function can correctly bind 'this' for
146
151
  * the entitiesGet function
@@ -1 +1 @@
1
- {"version":3,"file":"metadataUtilities.d.ts","sourceRoot":"","sources":["../src/metadataUtilities.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,YAAY,EAAE,KAAK,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAGvF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EACH,KAAK,iCAAiC,EACtC,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACpC,KAAK,6BAA6B,EAClC,KAAK,qBAAqB,EAC1B,KAAK,8BAA8B,EACnC,KAAK,kBAAkB,EACvB,KAAK,2BAA2B,EAChC,KAAK,mBA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C,CAAC,SAAS,yBAAyB,IACnC,CACA,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,0BAA0B,KAClC,YAAY,CAAC,CAAC,CAAC,CAAC;AAErB;;;;GAIG;AACH,qBAAa,iBAAiB;IAC1B;;;;;;;;;;;;;;OAcG;IAgCH;;;;;;;;;;;;;;;OAeG;IA6BH;;;;;;;;;OASG;IACH,OAAc,oBAAoB,CAAC,CAAC,SAAS,yBAAyB,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,CASrF;IAED;;;;;;OAMG;IACH,OAAc,mBAAmB,CAAC,CAAC,SAAS,yBAAyB,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAGnF;IAED,OAAc,aAAa,GACvB,CAAC,SAAS,yBAAyB,EACnC,CAAC,SAAS,yBAAyB,UAE3B,gBAAgB,eACX,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,UACnC,CAAC,YACA,0BAA0B,KACpC,OAAO,CAAC,CAAC,EAAE,CAAC,CAEb;IAEF;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,OAAc,qBAAqB,GAC/B,CAAC,SAAS,yBAAyB,EACnC,CAAC,SAAS,yBAAyB,UAE3B,gBAAgB,eACX,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,UACnC,CAAC,YACA,0BAA0B,KACpC,OAAO,CAAC,CAAC,EAAE,CAAC,CAuBb;CACL"}
@@ -1,14 +1,51 @@
1
1
  // (C) 2019-2026 GoodData Corporation
2
- import { merge, uniqBy } from "lodash-es";
2
+ import { merge, uniq, uniqBy } from "lodash-es";
3
3
  const DefaultPageSize = 250;
4
4
  const DefaultOptions = {
5
5
  params: {
6
6
  size: DefaultPageSize,
7
7
  },
8
8
  };
9
+ // pages are heavy backend requests (e.g. with X-GDC-VALIDATE-RELATIONS), so never fire all of them at once
10
+ const MaxParallelPageRequests = 4;
9
11
  function createOptionsForPage(page, options) {
10
12
  return merge({}, DefaultOptions, options, { params: { page } });
11
13
  }
14
+ // keeps whatever meta the caller asked for (e.g. permissions) next to the page count
15
+ function withPageMeta(params) {
16
+ const { metaInclude = [] } = params;
17
+ return { ...params, metaInclude: uniq([...metaInclude, "page"]) };
18
+ }
19
+ // requests the pages following `loadedPages` one by one until the backend returns a page that is not full
20
+ async function getRemainingPagesInSeries(client, entitiesGet, params, options, loadedPages) {
21
+ const pages = [...loadedPages];
22
+ const pageSize = options.params?.size ?? DefaultPageSize;
23
+ while (pages.length === 0 || pages[pages.length - 1].data.length >= pageSize) {
24
+ const result = await entitiesGet(client.axios, "", params, createOptionsForPage(pages.length, options));
25
+ pages.push(result.data);
26
+ }
27
+ return pages;
28
+ }
29
+ // runs at most `limit` tasks at a time and starts no new task once one of them fails
30
+ async function runWithConcurrencyLimit(tasks, limit) {
31
+ const results = [];
32
+ let nextTask = 0;
33
+ let failed = false;
34
+ const worker = async () => {
35
+ while (!failed && nextTask < tasks.length) {
36
+ const index = nextTask++;
37
+ try {
38
+ results[index] = await tasks[index]();
39
+ }
40
+ catch (e) {
41
+ failed = true;
42
+ throw e;
43
+ }
44
+ }
45
+ };
46
+ await Promise.all(Array.from({ length: Math.min(limit, tasks.length) }, worker));
47
+ return results;
48
+ }
12
49
  /**
13
50
  * Tiger metadata utility functions
14
51
  *
@@ -133,31 +170,21 @@ export class MetadataUtilities {
133
170
  return result;
134
171
  }
135
172
  static getAllPagesOf = async (client, entitiesGet, params, options = {}) => {
136
- const results = [];
137
- const pageSize = options.params?.size ?? DefaultPageSize;
138
- let reachedEnd = false;
139
- let nextPage = 0;
140
- while (!reachedEnd) {
141
- const optionsToUse = createOptionsForPage(nextPage, options);
142
- const result = await entitiesGet(client.axios, "", params, optionsToUse);
143
- results.push(result.data);
144
- if (result.data.data.length < pageSize) {
145
- reachedEnd = true;
146
- }
147
- else {
148
- nextPage += 1;
149
- }
150
- }
151
- return results;
173
+ return getRemainingPagesInSeries(client, entitiesGet, params, options, []);
152
174
  };
153
175
  /**
154
176
  * Given a function to get a paged list of metadata entities, API call parameters and options, this function will
155
177
  * retrieve all pages from the metadata.
156
178
  * Unlike to the getAllPagesOf, the requests will not be done in series. Instead, a first request will be done
157
- * with metaInclude=page to get the number of pages and all subsequent pages will be fetched in parallel.
179
+ * with metaInclude=page to get the number of pages and the subsequent pages will be fetched in parallel,
180
+ * at most four at a time. Once a page fails, no further pages are requested.
158
181
  *
159
- * The parameters are passed to the function as is. The options will be used as a 'template'. If the options specify
160
- * page `size`, it will be retained and used for paging.
182
+ * The parameters are passed to the function as is; `page` is added to any `metaInclude` they already contain.
183
+ * The options will be used as a 'template'. If the options specify page `size`, it will be retained and used
184
+ * for paging.
185
+ *
186
+ * When the backend does not return the number of pages, the subsequent pages are fetched in series until
187
+ * a page that is not full, the same way as getAllPagesOf does.
161
188
  *
162
189
  * @param client - API client to use, this is required so that function can correctly bind 'this' for
163
190
  * the entitiesGet function
@@ -167,14 +194,13 @@ export class MetadataUtilities {
167
194
  * @internal
168
195
  */
169
196
  static getAllPagesOfParallel = async (client, entitiesGet, params, options = {}) => {
170
- const initialOptions = createOptionsForPage(0, options);
171
- const initialGet = await entitiesGet(client.axios, "", { ...params, metaInclude: ["page"] }, initialOptions);
172
- const total = initialGet.data?.meta?.page?.totalPages || 1;
173
- const range = Array.from({ length: total - 1 }, (_v, i) => i + 1);
174
- const morePages = await Promise.all(range.map((page) => {
175
- const optionsToUse = createOptionsForPage(page, options);
176
- return entitiesGet(client.axios, "", params, optionsToUse);
177
- }));
197
+ const initialGet = await entitiesGet(client.axios, "", withPageMeta(params), createOptionsForPage(0, options));
198
+ const total = initialGet.data.meta?.page?.totalPages;
199
+ if (total === undefined) {
200
+ return getRemainingPagesInSeries(client, entitiesGet, params, options, [initialGet.data]);
201
+ }
202
+ const range = Array.from({ length: Math.max(total - 1, 0) }, (_v, i) => i + 1);
203
+ const morePages = await runWithConcurrencyLimit(range.map((page) => () => entitiesGet(client.axios, "", params, createOptionsForPage(page, options))), MaxParallelPageRequests);
178
204
  return [initialGet, ...morePages].map((item) => item.data);
179
205
  };
180
206
  }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=metadataUtilities.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadataUtilities.test.d.ts","sourceRoot":"","sources":["../src/metadataUtilities.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,97 @@
1
+ // (C) 2026 GoodData Corporation
2
+ import { describe, expect, it, vi } from "vitest";
3
+ import { MetadataUtilities, } from "./metadataUtilities.js";
4
+ const PAGE_SIZE = 2;
5
+ const client = { axios: {} };
6
+ const nextTimer = () => new Promise((resolve) => setTimeout(resolve));
7
+ function pageOf(entities, totalPages) {
8
+ return {
9
+ data: Array.from({ length: entities }, (_v, i) => ({ id: `metric${i}`, type: "metric" })),
10
+ ...(totalPages === undefined ? {} : { meta: { page: { totalPages } } }),
11
+ };
12
+ }
13
+ // serves `pages` by the requested page number; a page without meta mimics a backend that sends no page count
14
+ function backendOf(pages) {
15
+ return vi.fn(async (_axios, _basePath, _params, options) => {
16
+ await nextTimer();
17
+ return { data: pages[options.params.page] };
18
+ });
19
+ }
20
+ const loadAll = (get, params = { workspaceId: "ws" }) => MetadataUtilities.getAllPagesOfParallel(client, get, params, { params: { size: PAGE_SIZE } });
21
+ const requestedPages = (get) => get.mock.calls.map((call) => call[3].params?.page);
22
+ describe("MetadataUtilities.getAllPagesOfParallel", () => {
23
+ it("loads every page the backend counts, in page order", async () => {
24
+ const pages = [pageOf(2, 3), pageOf(2), pageOf(1)];
25
+ const get = backendOf(pages);
26
+ await expect(loadAll(get)).resolves.toEqual(pages);
27
+ expect(requestedPages(get)).toEqual([0, 1, 2]);
28
+ });
29
+ it("asks for the page count next to the meta the caller asked for, and only on the first page", async () => {
30
+ const get = backendOf([pageOf(2, 2), pageOf(1)]);
31
+ await loadAll(get, { workspaceId: "ws", metaInclude: ["permissions"] });
32
+ expect(get.mock.calls.map((call) => call[2].metaInclude)).toEqual([
33
+ ["permissions", "page"],
34
+ ["permissions"],
35
+ ]);
36
+ });
37
+ it("does not ask for the page count twice", async () => {
38
+ const get = backendOf([pageOf(1, 1)]);
39
+ await loadAll(get, { workspaceId: "ws", metaInclude: ["page"] });
40
+ expect(get.mock.calls[0][2].metaInclude).toEqual(["page"]);
41
+ });
42
+ it("loads the rest one page at a time when the backend sends no page count", async () => {
43
+ const pages = [pageOf(2), pageOf(2), pageOf(1)];
44
+ const get = backendOf(pages);
45
+ await expect(loadAll(get)).resolves.toEqual(pages);
46
+ expect(requestedPages(get)).toEqual([0, 1, 2]);
47
+ });
48
+ it("stops after a first page that is not full when the backend sends no page count", async () => {
49
+ const get = backendOf([pageOf(1)]);
50
+ await expect(loadAll(get)).resolves.toHaveLength(1);
51
+ expect(get).toHaveBeenCalledTimes(1);
52
+ });
53
+ it("makes a single request for an empty list", async () => {
54
+ const get = backendOf([pageOf(0, 0)]);
55
+ await expect(loadAll(get)).resolves.toEqual([pageOf(0, 0)]);
56
+ expect(get).toHaveBeenCalledTimes(1);
57
+ });
58
+ it("has at most four pages in flight at once", async () => {
59
+ const pages = [pageOf(2, 20), ...Array.from({ length: 19 }, () => pageOf(2))];
60
+ let inFlight = 0;
61
+ let maxInFlight = 0;
62
+ const get = vi.fn(async (_axios, _basePath, _params, options) => {
63
+ inFlight += 1;
64
+ maxInFlight = Math.max(maxInFlight, inFlight);
65
+ await nextTimer();
66
+ inFlight -= 1;
67
+ return { data: pages[options.params.page] };
68
+ });
69
+ await expect(loadAll(get)).resolves.toHaveLength(20);
70
+ expect(maxInFlight).toBe(4);
71
+ });
72
+ it("requests no further page once a page fails", async () => {
73
+ const pages = [pageOf(2, 20), ...Array.from({ length: 19 }, () => pageOf(2))];
74
+ const failure = new Error("page 1 failed");
75
+ const get = vi.fn(async (_axios, _basePath, _params, options) => {
76
+ const page = options.params.page;
77
+ if (page === 1) {
78
+ throw failure;
79
+ }
80
+ await nextTimer();
81
+ return { data: pages[page] };
82
+ });
83
+ await expect(loadAll(get)).rejects.toBe(failure);
84
+ // let the pages still in flight settle; none of them may start another one
85
+ await nextTimer();
86
+ // the first page, then the four started together
87
+ expect(requestedPages(get)).toEqual([0, 1, 2, 3, 4]);
88
+ });
89
+ });
90
+ describe("MetadataUtilities.getAllPagesOf", () => {
91
+ it("loads pages one by one until a page that is not full", async () => {
92
+ const pages = [pageOf(2), pageOf(2), pageOf(0)];
93
+ const get = backendOf(pages);
94
+ await expect(MetadataUtilities.getAllPagesOf(client, get, { workspaceId: "ws" }, { params: { size: PAGE_SIZE } })).resolves.toEqual(pages);
95
+ expect(requestedPages(get)).toEqual([0, 1, 2]);
96
+ });
97
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gooddata/api-client-tiger",
3
- "version": "11.67.0-alpha.2",
3
+ "version": "11.67.0-alpha.4",
4
4
  "description": "API Client for GoodData Cloud and GoodData.CN",
5
5
  "license": "MIT",
6
6
  "author": "GoodData",
@@ -45,24 +45,25 @@
45
45
  "axios-cache-interceptor": "1.12.3",
46
46
  "lodash-es": "^4.17.23",
47
47
  "tslib": "2.8.1",
48
- "@gooddata/sdk-model": "11.67.0-alpha.2"
48
+ "@gooddata/sdk-model": "11.67.0-alpha.4"
49
49
  },
50
50
  "devDependencies": {
51
- "@microsoft/api-documenter": "7.30.16",
51
+ "@microsoft/api-documenter": "7.30.20",
52
52
  "@microsoft/api-extractor": "7.59.2",
53
- "@openapitools/openapi-generator-cli": "2.41.0",
53
+ "@openapitools/openapi-generator-cli": "2.42.0",
54
54
  "@types/lodash-es": "4.17.12",
55
55
  "@typescript-eslint/eslint-plugin": "8.58.0",
56
56
  "@typescript-eslint/parser": "8.58.0",
57
57
  "commander": "8.3.0",
58
58
  "dependency-cruiser": "17.3.10",
59
59
  "dotenv": "16.4.5",
60
- "eslint": "^9.39.2",
60
+ "eslint": "^10.14.0",
61
61
  "eslint-plugin-headers": "1.3.3",
62
- "eslint-plugin-import-esm": "1.2.1",
63
- "eslint-plugin-jsdoc": "62.1.0",
62
+ "eslint-plugin-import-esm": "3.0.1",
63
+ "eslint-plugin-jsdoc": "65.4.2",
64
64
  "eslint-plugin-no-barrel-files": "1.2.2",
65
- "eslint-plugin-sonarjs": "3.0.6",
65
+ "eslint-plugin-sonarjs": "4.2.2",
66
+ "eslint-plugin-tsdoc": "0.5.4",
66
67
  "fix-esm-import-path": "1.10.3",
67
68
  "mkdirp": "1.0.4",
68
69
  "npm-run-all": "4.1.5",
@@ -72,8 +73,8 @@
72
73
  "oxlint-tsgolint": "7.0.2001",
73
74
  "typescript": "7.0.2",
74
75
  "vitest": "5.0.4",
75
- "@gooddata/oxlint-config": "11.67.0-alpha.2",
76
- "@gooddata/eslint-config": "11.67.0-alpha.2"
76
+ "@gooddata/oxlint-config": "11.67.0-alpha.4",
77
+ "@gooddata/eslint-config": "11.67.0-alpha.4"
77
78
  },
78
79
  "scripts": {
79
80
  "_phase:build": "npm run build",