s3db.js 19.5.1 → 19.5.2
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/core/resource-partitions.class.js +16 -13
- package/dist/s3db-lite.cjs +18 -15
- package/dist/s3db-lite.es.js +18 -15
- package/dist/s3db.cjs +18 -15
- package/dist/s3db.es.js +18 -15
- package/package.json +1 -1
- package/src/core/resource-partitions.class.ts +17 -13
|
@@ -322,19 +322,22 @@ export class ResourcePartitions {
|
|
|
322
322
|
});
|
|
323
323
|
await Promise.allSettled(updatePromises);
|
|
324
324
|
const id = newData.id || oldData.id;
|
|
325
|
-
const
|
|
326
|
-
|
|
327
|
-
const
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
325
|
+
const isNewInsert = !oldData || Object.keys(oldData).length === 0;
|
|
326
|
+
if (!isNewInsert) {
|
|
327
|
+
const cleanupPromises = Object.entries(partitions).map(async ([partitionName]) => {
|
|
328
|
+
const prefix = `resource=${this.resource.name}/partition=${partitionName}`;
|
|
329
|
+
const [okKeys, , keys] = await tryFn(() => this.resource.client.getAllKeys({ prefix }));
|
|
330
|
+
if (!okKeys || !keys) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
const validKey = this.getKey({ partitionName, id, data: newData });
|
|
334
|
+
const staleKeys = keys.filter(key => key.endsWith(`/id=${id}`) && key !== validKey);
|
|
335
|
+
if (staleKeys.length > 0) {
|
|
336
|
+
await tryFn(() => this.resource.client.deleteObjects(staleKeys));
|
|
337
|
+
}
|
|
338
|
+
});
|
|
339
|
+
await Promise.allSettled(cleanupPromises);
|
|
340
|
+
}
|
|
338
341
|
}
|
|
339
342
|
async handleReferenceUpdate(partitionName, partition, oldData, newData) {
|
|
340
343
|
const id = newData.id || oldData.id;
|
package/dist/s3db-lite.cjs
CHANGED
|
@@ -67003,19 +67003,22 @@ class ResourcePartitions {
|
|
|
67003
67003
|
});
|
|
67004
67004
|
await Promise.allSettled(updatePromises);
|
|
67005
67005
|
const id = newData.id || oldData.id;
|
|
67006
|
-
const
|
|
67007
|
-
|
|
67008
|
-
const
|
|
67009
|
-
|
|
67010
|
-
|
|
67011
|
-
|
|
67012
|
-
|
|
67013
|
-
|
|
67014
|
-
|
|
67015
|
-
|
|
67016
|
-
|
|
67017
|
-
|
|
67018
|
-
|
|
67006
|
+
const isNewInsert = !oldData || Object.keys(oldData).length === 0;
|
|
67007
|
+
if (!isNewInsert) {
|
|
67008
|
+
const cleanupPromises = Object.entries(partitions).map(async ([partitionName]) => {
|
|
67009
|
+
const prefix = `resource=${this.resource.name}/partition=${partitionName}`;
|
|
67010
|
+
const [okKeys, , keys] = await tryFn$1(() => this.resource.client.getAllKeys({ prefix }));
|
|
67011
|
+
if (!okKeys || !keys) {
|
|
67012
|
+
return;
|
|
67013
|
+
}
|
|
67014
|
+
const validKey = this.getKey({ partitionName, id, data: newData });
|
|
67015
|
+
const staleKeys = keys.filter(key => key.endsWith(`/id=${id}`) && key !== validKey);
|
|
67016
|
+
if (staleKeys.length > 0) {
|
|
67017
|
+
await tryFn$1(() => this.resource.client.deleteObjects(staleKeys));
|
|
67018
|
+
}
|
|
67019
|
+
});
|
|
67020
|
+
await Promise.allSettled(cleanupPromises);
|
|
67021
|
+
}
|
|
67019
67022
|
}
|
|
67020
67023
|
async handleReferenceUpdate(partitionName, partition, oldData, newData) {
|
|
67021
67024
|
const id = newData.id || oldData.id;
|
|
@@ -70670,8 +70673,8 @@ class Database extends SafeEventEmitter {
|
|
|
70670
70673
|
})();
|
|
70671
70674
|
this.version = '1';
|
|
70672
70675
|
this.s3dbVersion = (() => {
|
|
70673
|
-
const [ok, , version] = tryFnSync(() => (typeof globalThis['19.5.
|
|
70674
|
-
? globalThis['19.5.
|
|
70676
|
+
const [ok, , version] = tryFnSync(() => (typeof globalThis['19.5.2'] !== 'undefined' && globalThis['19.5.2'] !== '19.5.2'
|
|
70677
|
+
? globalThis['19.5.2']
|
|
70675
70678
|
: 'latest'));
|
|
70676
70679
|
return ok ? version : 'latest';
|
|
70677
70680
|
})();
|
package/dist/s3db-lite.es.js
CHANGED
|
@@ -66980,19 +66980,22 @@ class ResourcePartitions {
|
|
|
66980
66980
|
});
|
|
66981
66981
|
await Promise.allSettled(updatePromises);
|
|
66982
66982
|
const id = newData.id || oldData.id;
|
|
66983
|
-
const
|
|
66984
|
-
|
|
66985
|
-
const
|
|
66986
|
-
|
|
66987
|
-
|
|
66988
|
-
|
|
66989
|
-
|
|
66990
|
-
|
|
66991
|
-
|
|
66992
|
-
|
|
66993
|
-
|
|
66994
|
-
|
|
66995
|
-
|
|
66983
|
+
const isNewInsert = !oldData || Object.keys(oldData).length === 0;
|
|
66984
|
+
if (!isNewInsert) {
|
|
66985
|
+
const cleanupPromises = Object.entries(partitions).map(async ([partitionName]) => {
|
|
66986
|
+
const prefix = `resource=${this.resource.name}/partition=${partitionName}`;
|
|
66987
|
+
const [okKeys, , keys] = await tryFn$1(() => this.resource.client.getAllKeys({ prefix }));
|
|
66988
|
+
if (!okKeys || !keys) {
|
|
66989
|
+
return;
|
|
66990
|
+
}
|
|
66991
|
+
const validKey = this.getKey({ partitionName, id, data: newData });
|
|
66992
|
+
const staleKeys = keys.filter(key => key.endsWith(`/id=${id}`) && key !== validKey);
|
|
66993
|
+
if (staleKeys.length > 0) {
|
|
66994
|
+
await tryFn$1(() => this.resource.client.deleteObjects(staleKeys));
|
|
66995
|
+
}
|
|
66996
|
+
});
|
|
66997
|
+
await Promise.allSettled(cleanupPromises);
|
|
66998
|
+
}
|
|
66996
66999
|
}
|
|
66997
67000
|
async handleReferenceUpdate(partitionName, partition, oldData, newData) {
|
|
66998
67001
|
const id = newData.id || oldData.id;
|
|
@@ -70647,8 +70650,8 @@ class Database extends SafeEventEmitter {
|
|
|
70647
70650
|
})();
|
|
70648
70651
|
this.version = '1';
|
|
70649
70652
|
this.s3dbVersion = (() => {
|
|
70650
|
-
const [ok, , version] = tryFnSync(() => (typeof globalThis['19.5.
|
|
70651
|
-
? globalThis['19.5.
|
|
70653
|
+
const [ok, , version] = tryFnSync(() => (typeof globalThis['19.5.2'] !== 'undefined' && globalThis['19.5.2'] !== '19.5.2'
|
|
70654
|
+
? globalThis['19.5.2']
|
|
70652
70655
|
: 'latest'));
|
|
70653
70656
|
return ok ? version : 'latest';
|
|
70654
70657
|
})();
|
package/dist/s3db.cjs
CHANGED
|
@@ -16492,19 +16492,22 @@ class ResourcePartitions {
|
|
|
16492
16492
|
});
|
|
16493
16493
|
await Promise.allSettled(updatePromises);
|
|
16494
16494
|
const id = newData.id || oldData.id;
|
|
16495
|
-
const
|
|
16496
|
-
|
|
16497
|
-
const
|
|
16498
|
-
|
|
16499
|
-
|
|
16500
|
-
|
|
16501
|
-
|
|
16502
|
-
|
|
16503
|
-
|
|
16504
|
-
|
|
16505
|
-
|
|
16506
|
-
|
|
16507
|
-
|
|
16495
|
+
const isNewInsert = !oldData || Object.keys(oldData).length === 0;
|
|
16496
|
+
if (!isNewInsert) {
|
|
16497
|
+
const cleanupPromises = Object.entries(partitions).map(async ([partitionName]) => {
|
|
16498
|
+
const prefix = `resource=${this.resource.name}/partition=${partitionName}`;
|
|
16499
|
+
const [okKeys, , keys] = await tryFn(() => this.resource.client.getAllKeys({ prefix }));
|
|
16500
|
+
if (!okKeys || !keys) {
|
|
16501
|
+
return;
|
|
16502
|
+
}
|
|
16503
|
+
const validKey = this.getKey({ partitionName, id, data: newData });
|
|
16504
|
+
const staleKeys = keys.filter(key => key.endsWith(`/id=${id}`) && key !== validKey);
|
|
16505
|
+
if (staleKeys.length > 0) {
|
|
16506
|
+
await tryFn(() => this.resource.client.deleteObjects(staleKeys));
|
|
16507
|
+
}
|
|
16508
|
+
});
|
|
16509
|
+
await Promise.allSettled(cleanupPromises);
|
|
16510
|
+
}
|
|
16508
16511
|
}
|
|
16509
16512
|
async handleReferenceUpdate(partitionName, partition, oldData, newData) {
|
|
16510
16513
|
const id = newData.id || oldData.id;
|
|
@@ -20159,8 +20162,8 @@ class Database extends SafeEventEmitter {
|
|
|
20159
20162
|
})();
|
|
20160
20163
|
this.version = '1';
|
|
20161
20164
|
this.s3dbVersion = (() => {
|
|
20162
|
-
const [ok, , version] = tryFnSync(() => (typeof globalThis['19.5.
|
|
20163
|
-
? globalThis['19.5.
|
|
20165
|
+
const [ok, , version] = tryFnSync(() => (typeof globalThis['19.5.2'] !== 'undefined' && globalThis['19.5.2'] !== '19.5.2'
|
|
20166
|
+
? globalThis['19.5.2']
|
|
20164
20167
|
: 'latest'));
|
|
20165
20168
|
return ok ? version : 'latest';
|
|
20166
20169
|
})();
|
package/dist/s3db.es.js
CHANGED
|
@@ -16467,19 +16467,22 @@ class ResourcePartitions {
|
|
|
16467
16467
|
});
|
|
16468
16468
|
await Promise.allSettled(updatePromises);
|
|
16469
16469
|
const id = newData.id || oldData.id;
|
|
16470
|
-
const
|
|
16471
|
-
|
|
16472
|
-
const
|
|
16473
|
-
|
|
16474
|
-
|
|
16475
|
-
|
|
16476
|
-
|
|
16477
|
-
|
|
16478
|
-
|
|
16479
|
-
|
|
16480
|
-
|
|
16481
|
-
|
|
16482
|
-
|
|
16470
|
+
const isNewInsert = !oldData || Object.keys(oldData).length === 0;
|
|
16471
|
+
if (!isNewInsert) {
|
|
16472
|
+
const cleanupPromises = Object.entries(partitions).map(async ([partitionName]) => {
|
|
16473
|
+
const prefix = `resource=${this.resource.name}/partition=${partitionName}`;
|
|
16474
|
+
const [okKeys, , keys] = await tryFn(() => this.resource.client.getAllKeys({ prefix }));
|
|
16475
|
+
if (!okKeys || !keys) {
|
|
16476
|
+
return;
|
|
16477
|
+
}
|
|
16478
|
+
const validKey = this.getKey({ partitionName, id, data: newData });
|
|
16479
|
+
const staleKeys = keys.filter(key => key.endsWith(`/id=${id}`) && key !== validKey);
|
|
16480
|
+
if (staleKeys.length > 0) {
|
|
16481
|
+
await tryFn(() => this.resource.client.deleteObjects(staleKeys));
|
|
16482
|
+
}
|
|
16483
|
+
});
|
|
16484
|
+
await Promise.allSettled(cleanupPromises);
|
|
16485
|
+
}
|
|
16483
16486
|
}
|
|
16484
16487
|
async handleReferenceUpdate(partitionName, partition, oldData, newData) {
|
|
16485
16488
|
const id = newData.id || oldData.id;
|
|
@@ -20134,8 +20137,8 @@ class Database extends SafeEventEmitter {
|
|
|
20134
20137
|
})();
|
|
20135
20138
|
this.version = '1';
|
|
20136
20139
|
this.s3dbVersion = (() => {
|
|
20137
|
-
const [ok, , version] = tryFnSync(() => (typeof globalThis['19.5.
|
|
20138
|
-
? globalThis['19.5.
|
|
20140
|
+
const [ok, , version] = tryFnSync(() => (typeof globalThis['19.5.2'] !== 'undefined' && globalThis['19.5.2'] !== '19.5.2'
|
|
20141
|
+
? globalThis['19.5.2']
|
|
20139
20142
|
: 'latest'));
|
|
20140
20143
|
return ok ? version : 'latest';
|
|
20141
20144
|
})();
|
package/package.json
CHANGED
|
@@ -487,22 +487,26 @@ export class ResourcePartitions {
|
|
|
487
487
|
await Promise.allSettled(updatePromises);
|
|
488
488
|
|
|
489
489
|
const id = newData.id || oldData.id;
|
|
490
|
-
const
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
490
|
+
const isNewInsert = !oldData || Object.keys(oldData).length === 0;
|
|
491
|
+
|
|
492
|
+
if (!isNewInsert) {
|
|
493
|
+
const cleanupPromises = Object.entries(partitions).map(async ([partitionName]) => {
|
|
494
|
+
const prefix = `resource=${this.resource.name}/partition=${partitionName}`;
|
|
495
|
+
const [okKeys, , keys] = await tryFn<string[]>(() => this.resource.client.getAllKeys({ prefix }));
|
|
496
|
+
if (!okKeys || !keys) {
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
496
499
|
|
|
497
|
-
|
|
498
|
-
|
|
500
|
+
const validKey = this.getKey({ partitionName, id, data: newData });
|
|
501
|
+
const staleKeys = keys.filter(key => key.endsWith(`/id=${id}`) && key !== validKey);
|
|
499
502
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
503
|
+
if (staleKeys.length > 0) {
|
|
504
|
+
await tryFn(() => this.resource.client.deleteObjects(staleKeys));
|
|
505
|
+
}
|
|
506
|
+
});
|
|
504
507
|
|
|
505
|
-
|
|
508
|
+
await Promise.allSettled(cleanupPromises);
|
|
509
|
+
}
|
|
506
510
|
}
|
|
507
511
|
|
|
508
512
|
async handleReferenceUpdate(
|