@bagelink/sdk 1.15.407 → 1.15.413
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 +3 -0
- package/dist/index.mjs +3 -0
- package/package.json +1 -1
- package/src/index.ts +6 -0
package/dist/index.cjs
CHANGED
|
@@ -1608,6 +1608,9 @@ class ApiResponse extends Array {
|
|
|
1608
1608
|
* Factory method to handle both arrays and objects
|
|
1609
1609
|
*/
|
|
1610
1610
|
static create(data, response) {
|
|
1611
|
+
if (data === null || typeof data !== "object") {
|
|
1612
|
+
return data;
|
|
1613
|
+
}
|
|
1611
1614
|
if (!Array.isArray(data)) {
|
|
1612
1615
|
const obj = Object.assign(/* @__PURE__ */ Object.create(null), data);
|
|
1613
1616
|
obj.$raw = response;
|
package/dist/index.mjs
CHANGED
|
@@ -1602,6 +1602,9 @@ class ApiResponse extends Array {
|
|
|
1602
1602
|
* Factory method to handle both arrays and objects
|
|
1603
1603
|
*/
|
|
1604
1604
|
static create(data, response) {
|
|
1605
|
+
if (data === null || typeof data !== "object") {
|
|
1606
|
+
return data;
|
|
1607
|
+
}
|
|
1605
1608
|
if (!Array.isArray(data)) {
|
|
1606
1609
|
const obj = Object.assign(/* @__PURE__ */ Object.create(null), data);
|
|
1607
1610
|
obj.$raw = response;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -107,6 +107,12 @@ export class ApiResponse<TData = any> extends Array<TData extends Array<infer U>
|
|
|
107
107
|
* Factory method to handle both arrays and objects
|
|
108
108
|
*/
|
|
109
109
|
static create<T>(data: T, response: AxiosResponse): any {
|
|
110
|
+
// Primitive payloads cannot carry response metadata. Return them as-is
|
|
111
|
+
// instead of boxing them into an object that loses the actual value.
|
|
112
|
+
if (data === null || typeof data !== 'object') {
|
|
113
|
+
return data
|
|
114
|
+
}
|
|
115
|
+
|
|
110
116
|
// For single objects, attach metadata directly
|
|
111
117
|
if (!Array.isArray(data)) {
|
|
112
118
|
const obj = Object.assign(Object.create(null), data) as any
|