@tinycloud/replica 0.4.5-beta.3 → 0.4.5-beta.5
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/kv-storage.js +1 -1
- package/dist/{kv-storage.worker.845167ca35516ebdaf4e9b2f667db81e465be7779dd4952a32c3d148241052fd.js → kv-storage.worker.4eb6410bd51645dbfb285409f17747981162454e86b9c68acb5ae2cdc8dfb3cd.js} +14 -11
- package/dist/kv-storage.worker.js +14 -11
- package/dist/kv-storage.worker.js.map +1 -1
- package/dist/replica.worker.js +14 -11
- package/dist/replica.worker.js.map +1 -1
- package/package.json +2 -2
package/dist/replica.worker.js
CHANGED
|
@@ -3662,11 +3662,15 @@ var KVService = class extends BaseService {
|
|
|
3662
3662
|
}
|
|
3663
3663
|
/** Delay KV routing until an asynchronously loaded read-through is attached. */
|
|
3664
3664
|
setReadThroughReady(ready) {
|
|
3665
|
-
const
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3665
|
+
const start = () => {
|
|
3666
|
+
if (typeof ready === "function") ready = Promise.resolve().then(ready);
|
|
3667
|
+
const finish = () => {
|
|
3668
|
+
if (this.readThroughReady === start) this.readThroughReady = null;
|
|
3669
|
+
};
|
|
3670
|
+
return ready.then(finish, finish);
|
|
3671
|
+
};
|
|
3672
|
+
this.readThroughReady = start;
|
|
3673
|
+
if (typeof ready !== "function") void start();
|
|
3670
3674
|
}
|
|
3671
3675
|
/**
|
|
3672
3676
|
* Get the service configuration.
|
|
@@ -3913,7 +3917,6 @@ var KVService = class extends BaseService {
|
|
|
3913
3917
|
return aligned;
|
|
3914
3918
|
}
|
|
3915
3919
|
async batchRead(keys, action, options) {
|
|
3916
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
3917
3920
|
if (!this.requireAuth()) return err(authRequiredError("kv"));
|
|
3918
3921
|
if (keys.length === 0) return ok({ results: [], count: 0 });
|
|
3919
3922
|
if (keys.length > MAX_KV_BATCH_READ_ITEMS) {
|
|
@@ -4164,7 +4167,7 @@ var KVService = class extends BaseService {
|
|
|
4164
4167
|
*/
|
|
4165
4168
|
async get(key, options) {
|
|
4166
4169
|
return this.withTelemetry("get", key, async () => {
|
|
4167
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
4170
|
+
if (options?.source !== "network" && this.readThroughReady !== null) await this.readThroughReady();
|
|
4168
4171
|
if (!this.requireAuth()) {
|
|
4169
4172
|
return err(authRequiredError("kv"));
|
|
4170
4173
|
}
|
|
@@ -4283,7 +4286,7 @@ var KVService = class extends BaseService {
|
|
|
4283
4286
|
*/
|
|
4284
4287
|
async put(key, value, options) {
|
|
4285
4288
|
return this.withTelemetry("put", key, async () => {
|
|
4286
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
4289
|
+
if (this.readThroughReady !== null) await this.readThroughReady();
|
|
4287
4290
|
if (!this.requireAuth()) {
|
|
4288
4291
|
return err(authRequiredError("kv"));
|
|
4289
4292
|
}
|
|
@@ -4368,7 +4371,7 @@ var KVService = class extends BaseService {
|
|
|
4368
4371
|
*/
|
|
4369
4372
|
async batchPut(items, options) {
|
|
4370
4373
|
return this.withTelemetry("batchPut", String(items.length), async () => {
|
|
4371
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
4374
|
+
if (this.readThroughReady !== null) await this.readThroughReady();
|
|
4372
4375
|
if (!this.requireAuth()) {
|
|
4373
4376
|
return err(authRequiredError("kv"));
|
|
4374
4377
|
}
|
|
@@ -4567,7 +4570,7 @@ var KVService = class extends BaseService {
|
|
|
4567
4570
|
*/
|
|
4568
4571
|
async list(options) {
|
|
4569
4572
|
return this.withTelemetry("list", options?.prefix, async () => {
|
|
4570
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
4573
|
+
if (options?.source !== "network" && this.readThroughReady !== null) await this.readThroughReady();
|
|
4571
4574
|
if (!this.requireAuth()) {
|
|
4572
4575
|
return err(authRequiredError("kv"));
|
|
4573
4576
|
}
|
|
@@ -4855,7 +4858,7 @@ var KVService = class extends BaseService {
|
|
|
4855
4858
|
*/
|
|
4856
4859
|
async delete(key, options) {
|
|
4857
4860
|
return this.withTelemetry("delete", key, async () => {
|
|
4858
|
-
if (this.readThroughReady !== null) await this.readThroughReady;
|
|
4861
|
+
if (this.readThroughReady !== null) await this.readThroughReady();
|
|
4859
4862
|
if (!this.requireAuth()) {
|
|
4860
4863
|
return err(authRequiredError("kv"));
|
|
4861
4864
|
}
|