@startinblox/core 0.19.14-beta.1 → 0.19.15-beta.1

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -36
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -11311,7 +11311,11 @@ class Store {
11311
11311
  this.resolveResource = function(id2, resolve2) {
11312
11312
  const handler = function(event) {
11313
11313
  if (event.detail.id === id2) {
11314
- resolve2(event.detail.resource);
11314
+ if (event.detail.resource) {
11315
+ resolve2(event.detail.resource);
11316
+ } else {
11317
+ resolve2(event.detail.fetchedResource);
11318
+ }
11315
11319
  document.removeEventListener("resourceReady", handler);
11316
11320
  }
11317
11321
  };
@@ -11374,13 +11378,13 @@ class Store {
11374
11378
  }
11375
11379
  if (!resource) {
11376
11380
  this.loadingList.delete(key);
11377
- resolve2(null);
11381
+ document.dispatchEvent(new CustomEvent("resourceReady", { detail: { id: key, resource: null, fetchedResource: null } }));
11378
11382
  return;
11379
11383
  }
11380
11384
  const serverContext = await myParser.parse([resource["@context"] || base_context]);
11381
11385
  await this.cacheGraph(resource, clientContext, serverContext, parentId ? parentId : key, serverPagination, serverSearch);
11382
11386
  this.loadingList.delete(key);
11383
- document.dispatchEvent(new CustomEvent("resourceReady", { detail: { id: key, resource: this.get(key) } }));
11387
+ document.dispatchEvent(new CustomEvent("resourceReady", { detail: { id: key, resource: this.get(key), fetchedResource: resource } }));
11384
11388
  });
11385
11389
  }
11386
11390
  async fetchAuthn(iri, options) {
@@ -11393,10 +11397,6 @@ class Store {
11393
11397
  if (options.headers)
11394
11398
  options.headers = this._convertHeaders(options.headers);
11395
11399
  return fetch(iri, options).then(function(response) {
11396
- if (options.method === "PURGE" && !response.ok && response.status === 404) {
11397
- const err = new Error("PURGE call is returning 404");
11398
- throw err;
11399
- }
11400
11400
  return response;
11401
11401
  });
11402
11402
  }
@@ -11655,35 +11655,6 @@ class Store {
11655
11655
  async patch(resource, id2) {
11656
11656
  return this._updateResource("PATCH", resource, id2);
11657
11657
  }
11658
- /**
11659
- * Send a PURGE request to remove a resource from REDIS AD cache
11660
- * @param id - uri of the resource to patch
11661
- *
11662
- * @returns id of the edited resource
11663
- */
11664
- async purge(id2) {
11665
- await this.fetchAuthn(id2, {
11666
- method: "PURGE",
11667
- headers: this.headers
11668
- }).catch(function(error2) {
11669
- console.warn("No purge method allowed: " + error2);
11670
- });
11671
- try {
11672
- const fullURL = new URL(id2);
11673
- var pathArray = fullURL.pathname.split("/");
11674
- var containerUrl = fullURL.origin + "/" + pathArray[1] + "/";
11675
- const headers = { ...this.headers, "X-Cache-Purge-Match": "startswith" };
11676
- await this.fetchAuthn(containerUrl, {
11677
- method: "PURGE",
11678
- headers
11679
- }).catch(function(error2) {
11680
- console.warn("No purge method allowed: " + error2);
11681
- });
11682
- } catch (error2) {
11683
- console.warn("The resource ID is not a complete URL: " + error2);
11684
- return;
11685
- }
11686
- }
11687
11658
  /**
11688
11659
  * Send a DELETE request to delete a resource
11689
11660
  * @param id - uri of the resource to delete
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startinblox/core",
3
- "version": "0.19.14-beta.1",
3
+ "version": "0.19.15-beta.1",
4
4
  "description": "This is a series of web component respecting both the web components standards and the Linked Data Platform convention.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",