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