@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.js
CHANGED
|
@@ -2227,11 +2227,15 @@ var KVService = class extends BaseService {
|
|
|
2227
2227
|
}
|
|
2228
2228
|
/** Delay KV routing until an asynchronously loaded read-through is attached. */
|
|
2229
2229
|
setReadThroughReady(ready) {
|
|
2230
|
-
const
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2230
|
+
const start = () => {
|
|
2231
|
+
if (typeof ready === "function") ready = Promise.resolve().then(ready);
|
|
2232
|
+
const finish = () => {
|
|
2233
|
+
if (this.readThroughReady === start) this.readThroughReady = null;
|
|
2234
|
+
};
|
|
2235
|
+
return ready.then(finish, finish);
|
|
2236
|
+
};
|
|
2237
|
+
this.readThroughReady = start;
|
|
2238
|
+
if (typeof ready !== "function") void start();
|
|
2235
2239
|
}
|
|
2236
2240
|
/**
|
|
2237
2241
|
* Get the service configuration.
|
|
@@ -2478,7 +2482,6 @@ var KVService = class extends BaseService {
|
|
|
2478
2482
|
return aligned;
|
|
2479
2483
|
}
|
|
2480
2484
|
async batchRead(keys, action, options) {
|
|
2481
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
2482
2485
|
if (!this.requireAuth()) return err(authRequiredError("kv"));
|
|
2483
2486
|
if (keys.length === 0) return ok({ results: [], count: 0 });
|
|
2484
2487
|
if (keys.length > MAX_KV_BATCH_READ_ITEMS) {
|
|
@@ -2729,7 +2732,7 @@ var KVService = class extends BaseService {
|
|
|
2729
2732
|
*/
|
|
2730
2733
|
async get(key, options) {
|
|
2731
2734
|
return this.withTelemetry("get", key, async () => {
|
|
2732
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
2735
|
+
if (options?.source !== "network" && this.readThroughReady !== null) await this.readThroughReady();
|
|
2733
2736
|
if (!this.requireAuth()) {
|
|
2734
2737
|
return err(authRequiredError("kv"));
|
|
2735
2738
|
}
|
|
@@ -2848,7 +2851,7 @@ var KVService = class extends BaseService {
|
|
|
2848
2851
|
*/
|
|
2849
2852
|
async put(key, value, options) {
|
|
2850
2853
|
return this.withTelemetry("put", key, async () => {
|
|
2851
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
2854
|
+
if (this.readThroughReady !== null) await this.readThroughReady();
|
|
2852
2855
|
if (!this.requireAuth()) {
|
|
2853
2856
|
return err(authRequiredError("kv"));
|
|
2854
2857
|
}
|
|
@@ -2933,7 +2936,7 @@ var KVService = class extends BaseService {
|
|
|
2933
2936
|
*/
|
|
2934
2937
|
async batchPut(items, options) {
|
|
2935
2938
|
return this.withTelemetry("batchPut", String(items.length), async () => {
|
|
2936
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
2939
|
+
if (this.readThroughReady !== null) await this.readThroughReady();
|
|
2937
2940
|
if (!this.requireAuth()) {
|
|
2938
2941
|
return err(authRequiredError("kv"));
|
|
2939
2942
|
}
|
|
@@ -3132,7 +3135,7 @@ var KVService = class extends BaseService {
|
|
|
3132
3135
|
*/
|
|
3133
3136
|
async list(options) {
|
|
3134
3137
|
return this.withTelemetry("list", options?.prefix, async () => {
|
|
3135
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
3138
|
+
if (options?.source !== "network" && this.readThroughReady !== null) await this.readThroughReady();
|
|
3136
3139
|
if (!this.requireAuth()) {
|
|
3137
3140
|
return err(authRequiredError("kv"));
|
|
3138
3141
|
}
|
|
@@ -3420,7 +3423,7 @@ var KVService = class extends BaseService {
|
|
|
3420
3423
|
*/
|
|
3421
3424
|
async delete(key, options) {
|
|
3422
3425
|
return this.withTelemetry("delete", key, async () => {
|
|
3423
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
3426
|
+
if (this.readThroughReady !== null) await this.readThroughReady();
|
|
3424
3427
|
if (!this.requireAuth()) {
|
|
3425
3428
|
return err(authRequiredError("kv"));
|
|
3426
3429
|
}
|