@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/index.cjs
CHANGED
|
@@ -2404,11 +2404,15 @@ var KVService = class extends BaseService {
|
|
|
2404
2404
|
}
|
|
2405
2405
|
/** Delay KV routing until an asynchronously loaded read-through is attached. */
|
|
2406
2406
|
setReadThroughReady(ready) {
|
|
2407
|
-
const
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2407
|
+
const start = () => {
|
|
2408
|
+
if (typeof ready === "function") ready = Promise.resolve().then(ready);
|
|
2409
|
+
const finish = () => {
|
|
2410
|
+
if (this.readThroughReady === start) this.readThroughReady = null;
|
|
2411
|
+
};
|
|
2412
|
+
return ready.then(finish, finish);
|
|
2413
|
+
};
|
|
2414
|
+
this.readThroughReady = start;
|
|
2415
|
+
if (typeof ready !== "function") void start();
|
|
2412
2416
|
}
|
|
2413
2417
|
/**
|
|
2414
2418
|
* Get the service configuration.
|
|
@@ -2655,7 +2659,6 @@ var KVService = class extends BaseService {
|
|
|
2655
2659
|
return aligned;
|
|
2656
2660
|
}
|
|
2657
2661
|
async batchRead(keys, action, options) {
|
|
2658
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
2659
2662
|
if (!this.requireAuth()) return err(authRequiredError("kv"));
|
|
2660
2663
|
if (keys.length === 0) return ok({ results: [], count: 0 });
|
|
2661
2664
|
if (keys.length > MAX_KV_BATCH_READ_ITEMS) {
|
|
@@ -2906,7 +2909,7 @@ var KVService = class extends BaseService {
|
|
|
2906
2909
|
*/
|
|
2907
2910
|
async get(key, options) {
|
|
2908
2911
|
return this.withTelemetry("get", key, async () => {
|
|
2909
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
2912
|
+
if (options?.source !== "network" && this.readThroughReady !== null) await this.readThroughReady();
|
|
2910
2913
|
if (!this.requireAuth()) {
|
|
2911
2914
|
return err(authRequiredError("kv"));
|
|
2912
2915
|
}
|
|
@@ -3025,7 +3028,7 @@ var KVService = class extends BaseService {
|
|
|
3025
3028
|
*/
|
|
3026
3029
|
async put(key, value, options) {
|
|
3027
3030
|
return this.withTelemetry("put", key, async () => {
|
|
3028
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
3031
|
+
if (this.readThroughReady !== null) await this.readThroughReady();
|
|
3029
3032
|
if (!this.requireAuth()) {
|
|
3030
3033
|
return err(authRequiredError("kv"));
|
|
3031
3034
|
}
|
|
@@ -3110,7 +3113,7 @@ var KVService = class extends BaseService {
|
|
|
3110
3113
|
*/
|
|
3111
3114
|
async batchPut(items, options) {
|
|
3112
3115
|
return this.withTelemetry("batchPut", String(items.length), async () => {
|
|
3113
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
3116
|
+
if (this.readThroughReady !== null) await this.readThroughReady();
|
|
3114
3117
|
if (!this.requireAuth()) {
|
|
3115
3118
|
return err(authRequiredError("kv"));
|
|
3116
3119
|
}
|
|
@@ -3309,7 +3312,7 @@ var KVService = class extends BaseService {
|
|
|
3309
3312
|
*/
|
|
3310
3313
|
async list(options) {
|
|
3311
3314
|
return this.withTelemetry("list", options?.prefix, async () => {
|
|
3312
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
3315
|
+
if (options?.source !== "network" && this.readThroughReady !== null) await this.readThroughReady();
|
|
3313
3316
|
if (!this.requireAuth()) {
|
|
3314
3317
|
return err(authRequiredError("kv"));
|
|
3315
3318
|
}
|
|
@@ -3597,7 +3600,7 @@ var KVService = class extends BaseService {
|
|
|
3597
3600
|
*/
|
|
3598
3601
|
async delete(key, options) {
|
|
3599
3602
|
return this.withTelemetry("delete", key, async () => {
|
|
3600
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
3603
|
+
if (this.readThroughReady !== null) await this.readThroughReady();
|
|
3601
3604
|
if (!this.requireAuth()) {
|
|
3602
3605
|
return err(authRequiredError("kv"));
|
|
3603
3606
|
}
|