@web-ts-toolkit/access-router-client 0.29.0 → 0.31.0
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/index.js +7 -6
- package/index.mjs +13 -4
- package/package.json +2 -2
package/index.js
CHANGED
|
@@ -44,7 +44,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
44
44
|
|
|
45
45
|
// src/adapter.ts
|
|
46
46
|
var import_axios8 = __toESM(require("axios"));
|
|
47
|
-
var
|
|
47
|
+
var import_utils7 = require("@web-ts-toolkit/utils");
|
|
48
48
|
|
|
49
49
|
// src/services/model-service.ts
|
|
50
50
|
var import_axios4 = require("axios");
|
|
@@ -133,7 +133,7 @@ var Model = class _Model {
|
|
|
133
133
|
const currentKeys = Object.keys(this._data);
|
|
134
134
|
for (let x = 0; x < currentKeys.length; x++) {
|
|
135
135
|
const key = currentKeys[x];
|
|
136
|
-
if (!
|
|
136
|
+
if (!(0, import_utils.hasOwn)(nextData, key)) {
|
|
137
137
|
delete this._data[key];
|
|
138
138
|
}
|
|
139
139
|
}
|
|
@@ -189,7 +189,7 @@ var Model = class _Model {
|
|
|
189
189
|
if (key in this) continue;
|
|
190
190
|
Object.defineProperty(this, key, {
|
|
191
191
|
enumerable: true,
|
|
192
|
-
get: () =>
|
|
192
|
+
get: () => (0, import_utils.hasOwn)(this._data, key) ? this._data[key] : null,
|
|
193
193
|
set: (value) => this._data[key] = value
|
|
194
194
|
});
|
|
195
195
|
}
|
|
@@ -1633,6 +1633,7 @@ var import_axios7 = require("axios");
|
|
|
1633
1633
|
|
|
1634
1634
|
// src/services/cache-utils.ts
|
|
1635
1635
|
var import_axios6 = require("axios");
|
|
1636
|
+
var import_utils6 = require("@web-ts-toolkit/utils");
|
|
1636
1637
|
var normalizeConfigValue = (value) => {
|
|
1637
1638
|
if (value == null) return value;
|
|
1638
1639
|
if (value instanceof import_axios6.AxiosHeaders) {
|
|
@@ -1642,7 +1643,7 @@ var normalizeConfigValue = (value) => {
|
|
|
1642
1643
|
return value.map((item) => normalizeConfigValue(item));
|
|
1643
1644
|
}
|
|
1644
1645
|
if (typeof value === "object") {
|
|
1645
|
-
return Object.entries(
|
|
1646
|
+
return Object.entries((0, import_utils6.omitBy)(value, (item) => item === void 0)).sort(([left], [right]) => left.localeCompare(right)).reduce((acc, [key, item]) => {
|
|
1646
1647
|
acc[key] = normalizeConfigValue(item);
|
|
1647
1648
|
return acc;
|
|
1648
1649
|
}, {});
|
|
@@ -1850,7 +1851,7 @@ function createAdapter(axiosConfig, adapterOptions) {
|
|
|
1850
1851
|
let sharedConfig;
|
|
1851
1852
|
let sharedConfigKey;
|
|
1852
1853
|
const defs = proms.map((prom, index) => {
|
|
1853
|
-
if (!(0,
|
|
1854
|
+
if (!(0, import_utils7.isEmpty)(prom.__requestConfig)) {
|
|
1854
1855
|
const configKey = serializeRequestConfig(prom.__requestConfig);
|
|
1855
1856
|
if (sharedConfigKey && sharedConfigKey !== configKey) {
|
|
1856
1857
|
throw new Error("Grouped requests must share the same axios request config");
|
|
@@ -1881,7 +1882,7 @@ function createAdapter(axiosConfig, adapterOptions) {
|
|
|
1881
1882
|
_raw = result2.data[0];
|
|
1882
1883
|
_data = Model.create(result2.data[0], modelService);
|
|
1883
1884
|
} else if (!["distinct", "subList"].includes(op)) {
|
|
1884
|
-
_data = (0,
|
|
1885
|
+
_data = (0, import_utils7.castArray)(result2.data).map((item) => Model.create(item, modelService));
|
|
1885
1886
|
}
|
|
1886
1887
|
} else if (result2.kind === "single" && ["new", "read", "update", "upsert"].includes(op)) {
|
|
1887
1888
|
_data = Model.create(result2.data, modelService);
|
package/index.mjs
CHANGED
|
@@ -7,7 +7,15 @@ import { mergeConfig as mergeConfig3 } from "axios";
|
|
|
7
7
|
import { set as set3 } from "@web-ts-toolkit/utils";
|
|
8
8
|
|
|
9
9
|
// src/model.ts
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
assign as assignObject,
|
|
12
|
+
cloneDeep,
|
|
13
|
+
get as getValue,
|
|
14
|
+
hasOwn,
|
|
15
|
+
omit,
|
|
16
|
+
pick,
|
|
17
|
+
set as setValue
|
|
18
|
+
} from "@web-ts-toolkit/utils";
|
|
11
19
|
var Model = class _Model {
|
|
12
20
|
constructor(data, adapter) {
|
|
13
21
|
this.modifiedPaths = /* @__PURE__ */ new Set();
|
|
@@ -89,7 +97,7 @@ var Model = class _Model {
|
|
|
89
97
|
const currentKeys = Object.keys(this._data);
|
|
90
98
|
for (let x = 0; x < currentKeys.length; x++) {
|
|
91
99
|
const key = currentKeys[x];
|
|
92
|
-
if (!
|
|
100
|
+
if (!hasOwn(nextData, key)) {
|
|
93
101
|
delete this._data[key];
|
|
94
102
|
}
|
|
95
103
|
}
|
|
@@ -145,7 +153,7 @@ var Model = class _Model {
|
|
|
145
153
|
if (key in this) continue;
|
|
146
154
|
Object.defineProperty(this, key, {
|
|
147
155
|
enumerable: true,
|
|
148
|
-
get: () =>
|
|
156
|
+
get: () => hasOwn(this._data, key) ? this._data[key] : null,
|
|
149
157
|
set: (value) => this._data[key] = value
|
|
150
158
|
});
|
|
151
159
|
}
|
|
@@ -1589,6 +1597,7 @@ import { AxiosHeaders as AxiosHeaders3 } from "axios";
|
|
|
1589
1597
|
|
|
1590
1598
|
// src/services/cache-utils.ts
|
|
1591
1599
|
import { AxiosHeaders as AxiosHeaders2 } from "axios";
|
|
1600
|
+
import { omitBy } from "@web-ts-toolkit/utils";
|
|
1592
1601
|
var normalizeConfigValue = (value) => {
|
|
1593
1602
|
if (value == null) return value;
|
|
1594
1603
|
if (value instanceof AxiosHeaders2) {
|
|
@@ -1598,7 +1607,7 @@ var normalizeConfigValue = (value) => {
|
|
|
1598
1607
|
return value.map((item) => normalizeConfigValue(item));
|
|
1599
1608
|
}
|
|
1600
1609
|
if (typeof value === "object") {
|
|
1601
|
-
return Object.entries(value
|
|
1610
|
+
return Object.entries(omitBy(value, (item) => item === void 0)).sort(([left], [right]) => left.localeCompare(right)).reduce((acc, [key, item]) => {
|
|
1602
1611
|
acc[key] = normalizeConfigValue(item);
|
|
1603
1612
|
return acc;
|
|
1604
1613
|
}, {});
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@web-ts-toolkit/access-router-client",
|
|
3
3
|
"description": "Typed client utilities for @web-ts-toolkit/access-router APIs",
|
|
4
4
|
"homepage": "https://web-ts-toolkit.pages.dev/docs/packages/access-router-client",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.31.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"keywords": [
|
|
8
8
|
"axios",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"node": ">=20"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@web-ts-toolkit/utils": "0.
|
|
29
|
+
"@web-ts-toolkit/utils": "0.31.0",
|
|
30
30
|
"axios": "^1.18.1"
|
|
31
31
|
},
|
|
32
32
|
"files": [
|