s3db.js 3.1.0 → 3.2.0

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/s3db.cjs.js CHANGED
@@ -1365,7 +1365,7 @@ class Schema {
1365
1365
  this.reversedMap = lodashEs.invert(map);
1366
1366
  } else {
1367
1367
  const flatAttrs = flat.flatten(this.attributes, { safe: true });
1368
- this.reversedMap = { ...Object.keys(flatAttrs).filter((k) => !k.includes("$$type")) };
1368
+ this.reversedMap = { ...Object.keys(flatAttrs).filter((k) => !k.includes("$$")) };
1369
1369
  this.map = lodashEs.invert(this.reversedMap);
1370
1370
  }
1371
1371
  }
@@ -1678,6 +1678,16 @@ class Resource extends EventEmitter {
1678
1678
  this.emit("get", data);
1679
1679
  return data;
1680
1680
  }
1681
+ async exists(id) {
1682
+ try {
1683
+ await this.client.headObject(
1684
+ join(`resource=${this.name}`, `id=${id}`)
1685
+ );
1686
+ return true;
1687
+ } catch (error) {
1688
+ return false;
1689
+ }
1690
+ }
1681
1691
  async update(id, attributes) {
1682
1692
  const live = await this.get(id);
1683
1693
  const attrs = lodashEs.merge(live, attributes);