@smplkit/sdk 3.0.45 → 3.0.47

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/index.cjs CHANGED
@@ -16953,6 +16953,18 @@ function _nextCursorFromLinks(body) {
16953
16953
  if (typeof next !== "string" || !next.includes("page[after]=")) return null;
16954
16954
  return next.split("page[after]=")[1].split("&")[0];
16955
16955
  }
16956
+ function _paginationFromBody(body) {
16957
+ const raw = body.meta?.pagination ?? {};
16958
+ const out = {
16959
+ page: Number(raw.page ?? 0),
16960
+ size: Number(raw.size ?? 0)
16961
+ };
16962
+ if (raw.total !== void 0 && raw.total !== null) out.total = Number(raw.total);
16963
+ if (raw.total_pages !== void 0 && raw.total_pages !== null) {
16964
+ out.totalPages = Number(raw.total_pages);
16965
+ }
16966
+ return out;
16967
+ }
16956
16968
  async function _throwForResponse(response) {
16957
16969
  const body = await response.text().catch(() => "");
16958
16970
  throwForStatus(response.status, body);
@@ -17051,12 +17063,13 @@ var ResourceTypesClient = class {
17051
17063
  *
17052
17064
  * Backed by a maintain-by-write side table (ADR-047 §2.5), so the
17053
17065
  * response time is independent of event volume. Sorted alphabetically;
17054
- * cursor pagination via `pageAfter`.
17066
+ * offset pagination via `pageNumber` / `pageSize`.
17055
17067
  */
17056
17068
  async list(params = {}) {
17057
17069
  const query = {};
17070
+ if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
17058
17071
  if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
17059
- if (params.pageAfter !== void 0) query["page[after]"] = params.pageAfter;
17072
+ if (params.metaTotal !== void 0) query["meta[total]"] = params.metaTotal;
17060
17073
  const result = await this._http.GET("/api/v1/resource_types", {
17061
17074
  params: { query }
17062
17075
  });
@@ -17069,7 +17082,7 @@ var ResourceTypesClient = class {
17069
17082
  createdAt: String(r.attributes.created_at ?? "")
17070
17083
  })
17071
17084
  );
17072
- return { resourceTypes, nextCursor: _nextCursorFromLinks(body) };
17085
+ return { resourceTypes, pagination: _paginationFromBody(body) };
17073
17086
  }
17074
17087
  };
17075
17088
  var ActionsClient = class {
@@ -17082,14 +17095,15 @@ var ActionsClient = class {
17082
17095
  * Without `filterResourceType`, returns one row per distinct action.
17083
17096
  * With `filterResourceType`, returns only the actions recorded with
17084
17097
  * that resource_type, powering cascading-filter UIs (ADR-047 §2.5).
17085
- * Sorted alphabetically; cursor pagination via `pageAfter`.
17098
+ * Sorted alphabetically; offset pagination via `pageNumber` / `pageSize`.
17086
17099
  */
17087
17100
  async list(params = {}) {
17088
17101
  const query = {};
17089
17102
  if (params.filterResourceType !== void 0)
17090
17103
  query["filter[resource_type]"] = params.filterResourceType;
17104
+ if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
17091
17105
  if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
17092
- if (params.pageAfter !== void 0) query["page[after]"] = params.pageAfter;
17106
+ if (params.metaTotal !== void 0) query["meta[total]"] = params.metaTotal;
17093
17107
  const result = await this._http.GET("/api/v1/actions", {
17094
17108
  params: { query }
17095
17109
  });
@@ -17102,7 +17116,7 @@ var ActionsClient = class {
17102
17116
  createdAt: String(r.attributes.created_at ?? "")
17103
17117
  })
17104
17118
  );
17105
- return { actions, nextCursor: _nextCursorFromLinks(body) };
17119
+ return { actions, pagination: _paginationFromBody(body) };
17106
17120
  }
17107
17121
  };
17108
17122
  var AuditClient = class {
@@ -19834,10 +19848,17 @@ function wrapFetchError4(err) {
19834
19848
  `Request failed: ${err instanceof Error ? err.message : String(err)}`
19835
19849
  );
19836
19850
  }
19837
- function _nextCursorFromLinks2(body) {
19838
- const next = body.links?.next;
19839
- if (typeof next !== "string" || !next.includes("page[after]=")) return null;
19840
- return next.split("page[after]=")[1].split("&")[0];
19851
+ function _paginationFromBody2(body) {
19852
+ const raw = body.meta?.pagination ?? {};
19853
+ const out = {
19854
+ page: Number(raw.page ?? 0),
19855
+ size: Number(raw.size ?? 0)
19856
+ };
19857
+ if (raw.total !== void 0 && raw.total !== null) out.total = Number(raw.total);
19858
+ if (raw.total_pages !== void 0 && raw.total_pages !== null) {
19859
+ out.totalPages = Number(raw.total_pages);
19860
+ }
19861
+ return out;
19841
19862
  }
19842
19863
  function _httpToWire(http) {
19843
19864
  return {
@@ -19916,8 +19937,9 @@ var ForwardersClient = class {
19916
19937
  const query = {};
19917
19938
  if (params.forwarderType !== void 0) query["filter[forwarder_type]"] = params.forwarderType;
19918
19939
  if (params.enabled !== void 0) query["filter[enabled]"] = params.enabled;
19940
+ if (params.pageNumber !== void 0) query["page[number]"] = params.pageNumber;
19919
19941
  if (params.pageSize !== void 0) query["page[size]"] = params.pageSize;
19920
- if (params.pageAfter !== void 0) query["page[after]"] = params.pageAfter;
19942
+ if (params.metaTotal !== void 0) query["meta[total]"] = params.metaTotal;
19921
19943
  let data;
19922
19944
  try {
19923
19945
  const result = await this._http.GET("/api/v1/forwarders", {
@@ -19930,7 +19952,7 @@ var ForwardersClient = class {
19930
19952
  }
19931
19953
  return {
19932
19954
  forwarders: (data?.data ?? []).map(_forwarderFromResource),
19933
- nextCursor: _nextCursorFromLinks2(data ?? {})
19955
+ pagination: _paginationFromBody2(data ?? {})
19934
19956
  };
19935
19957
  }
19936
19958
  async get(forwarderId) {