@tinycloud/sdk-services 3.12.0-beta.10 → 3.12.0-beta.16
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 +14 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -11
- package/dist/index.js.map +1 -1
- package/dist/kv/index.cjs +14 -11
- package/dist/kv/index.cjs.map +1 -1
- package/dist/kv/index.d.cts +1 -1
- package/dist/kv/index.d.ts +1 -1
- package/dist/kv/index.js +14 -11
- package/dist/kv/index.js.map +1 -1
- package/package.json +1 -1
package/dist/kv/index.cjs
CHANGED
|
@@ -1013,11 +1013,15 @@ var KVService = class extends BaseService {
|
|
|
1013
1013
|
}
|
|
1014
1014
|
/** Delay KV routing until an asynchronously loaded read-through is attached. */
|
|
1015
1015
|
setReadThroughReady(ready) {
|
|
1016
|
-
const
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1016
|
+
const start = () => {
|
|
1017
|
+
if (typeof ready === "function") ready = Promise.resolve().then(ready);
|
|
1018
|
+
const finish = () => {
|
|
1019
|
+
if (this.readThroughReady === start) this.readThroughReady = null;
|
|
1020
|
+
};
|
|
1021
|
+
return ready.then(finish, finish);
|
|
1022
|
+
};
|
|
1023
|
+
this.readThroughReady = start;
|
|
1024
|
+
if (typeof ready !== "function") void start();
|
|
1021
1025
|
}
|
|
1022
1026
|
/**
|
|
1023
1027
|
* Get the service configuration.
|
|
@@ -1264,7 +1268,6 @@ var KVService = class extends BaseService {
|
|
|
1264
1268
|
return aligned;
|
|
1265
1269
|
}
|
|
1266
1270
|
async batchRead(keys, action, options) {
|
|
1267
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
1268
1271
|
if (!this.requireAuth()) return err(authRequiredError("kv"));
|
|
1269
1272
|
if (keys.length === 0) return ok({ results: [], count: 0 });
|
|
1270
1273
|
if (keys.length > MAX_KV_BATCH_READ_ITEMS) {
|
|
@@ -1515,7 +1518,7 @@ var KVService = class extends BaseService {
|
|
|
1515
1518
|
*/
|
|
1516
1519
|
async get(key, options) {
|
|
1517
1520
|
return this.withTelemetry("get", key, async () => {
|
|
1518
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
1521
|
+
if (options?.source !== "network" && this.readThroughReady !== null) await this.readThroughReady();
|
|
1519
1522
|
if (!this.requireAuth()) {
|
|
1520
1523
|
return err(authRequiredError("kv"));
|
|
1521
1524
|
}
|
|
@@ -1634,7 +1637,7 @@ var KVService = class extends BaseService {
|
|
|
1634
1637
|
*/
|
|
1635
1638
|
async put(key, value, options) {
|
|
1636
1639
|
return this.withTelemetry("put", key, async () => {
|
|
1637
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
1640
|
+
if (this.readThroughReady !== null) await this.readThroughReady();
|
|
1638
1641
|
if (!this.requireAuth()) {
|
|
1639
1642
|
return err(authRequiredError("kv"));
|
|
1640
1643
|
}
|
|
@@ -1719,7 +1722,7 @@ var KVService = class extends BaseService {
|
|
|
1719
1722
|
*/
|
|
1720
1723
|
async batchPut(items, options) {
|
|
1721
1724
|
return this.withTelemetry("batchPut", String(items.length), async () => {
|
|
1722
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
1725
|
+
if (this.readThroughReady !== null) await this.readThroughReady();
|
|
1723
1726
|
if (!this.requireAuth()) {
|
|
1724
1727
|
return err(authRequiredError("kv"));
|
|
1725
1728
|
}
|
|
@@ -1918,7 +1921,7 @@ var KVService = class extends BaseService {
|
|
|
1918
1921
|
*/
|
|
1919
1922
|
async list(options) {
|
|
1920
1923
|
return this.withTelemetry("list", options?.prefix, async () => {
|
|
1921
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
1924
|
+
if (options?.source !== "network" && this.readThroughReady !== null) await this.readThroughReady();
|
|
1922
1925
|
if (!this.requireAuth()) {
|
|
1923
1926
|
return err(authRequiredError("kv"));
|
|
1924
1927
|
}
|
|
@@ -2206,7 +2209,7 @@ var KVService = class extends BaseService {
|
|
|
2206
2209
|
*/
|
|
2207
2210
|
async delete(key, options) {
|
|
2208
2211
|
return this.withTelemetry("delete", key, async () => {
|
|
2209
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
2212
|
+
if (this.readThroughReady !== null) await this.readThroughReady();
|
|
2210
2213
|
if (!this.requireAuth()) {
|
|
2211
2214
|
return err(authRequiredError("kv"));
|
|
2212
2215
|
}
|