lamp-core-lst 2025.11.1-3.1 → 2025.11.14

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.
@@ -90,11 +90,11 @@ var ActivityService = /** @class */ (function () {
90
90
  * @param participantId
91
91
  */
92
92
  ActivityService.prototype.allByParticipant = function (participantId, transform, ignore_binary, limit, offset) {
93
- var _a;
93
+ var _a, _b, _c;
94
94
  return __awaiter(this, void 0, void 0, function () {
95
- var auth_2, credential, output, total, paginatedOutput, params, queryString, result, activitiesArray, totalCount, responseData;
96
- return __generator(this, function (_b) {
97
- switch (_b.label) {
95
+ var auth_2, credential, output, total, paginatedOutput, params, queryString, result, activitiesArray, totalCount;
96
+ return __generator(this, function (_d) {
97
+ switch (_d.label) {
98
98
  case 0:
99
99
  if (participantId === null || participantId === undefined)
100
100
  throw new Error("Required parameter participantId was null or undefined when calling activityAllByParticipant.");
@@ -131,25 +131,18 @@ var ActivityService = /** @class */ (function () {
131
131
  queryString = params.toString();
132
132
  return [4 /*yield*/, Fetch_1.Fetch.get("/participant/" + participantId + "/activity?" + queryString, this.configuration)
133
133
  // Handle the response structure:
134
- // - With pagination: { data: { data: Activity[], total: number } }
134
+ // - With pagination: { data: Activity[], total: number }
135
135
  // - Without pagination: { data: Activity[] } (backward compatible)
136
136
  ];
137
137
  case 1:
138
- result = _b.sent();
138
+ result = _d.sent();
139
139
  activitiesArray = [];
140
140
  totalCount = 0;
141
141
  if (result && result.data) {
142
- responseData = result.data;
143
- // Check if responseData is the paginated format { data: Activity[], total: number }
144
- if (responseData && typeof responseData === 'object' && !Array.isArray(responseData) && Array.isArray(responseData.data)) {
145
- activitiesArray = responseData.data;
146
- totalCount = responseData.total || 0;
147
- }
148
- else if (Array.isArray(responseData)) {
149
- // Backward compatible: responseData is directly an array (no pagination)
150
- activitiesArray = responseData;
151
- totalCount = responseData.length;
152
- }
142
+ // result.data is always an array
143
+ activitiesArray = Array.isArray(result.data) ? result.data : [];
144
+ // total exists only when pagination was provided
145
+ totalCount = typeof ((_b = result.data) === null || _b === void 0 ? void 0 : _b.total) === 'number' ? (_c = result.data) === null || _c === void 0 ? void 0 : _c.total : activitiesArray.length;
153
146
  }
154
147
  else if (Array.isArray(result)) {
155
148
  // Legacy fallback: if result is directly an array
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lamp-core-lst",
3
- "version": "2025.11.1-3.1",
3
+ "version": "2025.11.14",
4
4
  "author": "BIDMC Division of Digital Psychiatry <team@digitalpsych.org>",
5
5
  "description": "The JavaScript and TypeScript API client for the LAMP Platform.",
6
6
  "homepage": "https://docs.lamp.digital/",
@@ -79,22 +79,16 @@ export class ActivityService {
79
79
  )
80
80
 
81
81
  // Handle the response structure:
82
- // - With pagination: { data: { data: Activity[], total: number } }
82
+ // - With pagination: { data: Activity[], total: number }
83
83
  // - Without pagination: { data: Activity[] } (backward compatible)
84
84
  let activitiesArray: any[] = []
85
85
  let totalCount = 0
86
86
 
87
87
  if (result && result.data) {
88
- const responseData = result.data
89
- // Check if responseData is the paginated format { data: Activity[], total: number }
90
- if (responseData && typeof responseData === 'object' && !Array.isArray(responseData) && Array.isArray(responseData.data)) {
91
- activitiesArray = responseData.data
92
- totalCount = responseData.total || 0
93
- } else if (Array.isArray(responseData)) {
94
- // Backward compatible: responseData is directly an array (no pagination)
95
- activitiesArray = responseData
96
- totalCount = responseData.length
97
- }
88
+ // result.data is always an array
89
+ activitiesArray = Array.isArray(result.data) ? result.data : []
90
+ // total exists only when pagination was provided
91
+ totalCount = typeof result.data?.total === 'number' ? result.data?.total : activitiesArray.length
98
92
  } else if (Array.isArray(result)) {
99
93
  // Legacy fallback: if result is directly an array
100
94
  activitiesArray = result