perspectapi-ts-sdk 6.3.0 → 6.4.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/index.js CHANGED
@@ -903,7 +903,9 @@ var CategoriesV2Client = class extends BaseV2Client {
903
903
  // src/v2/client/collections-client.ts
904
904
  var CollectionsV2Client = class extends BaseV2Client {
905
905
  async list(siteName, params) {
906
- return this.getList(this.sitePath(siteName, "collections"), params);
906
+ return this.getList(this.sitePath(siteName, "collections"), params, {
907
+ tags: [`collections:${siteName}`]
908
+ });
907
909
  }
908
910
  async getCurrent(siteName) {
909
911
  const result = await this.getOne(
@@ -916,26 +918,22 @@ var CollectionsV2Client = class extends BaseV2Client {
916
918
  }
917
919
  async create(siteName, data) {
918
920
  const result = await this.post(this.sitePath(siteName, "collections"), data);
919
- await this.invalidateCache({ keys: [this.sitePath(siteName, "collections")] });
921
+ await this.invalidateCache({ tags: [`collections:${siteName}`] });
920
922
  return result;
921
923
  }
922
924
  async update(siteName, id, data) {
923
925
  const result = await this.patchOne(this.sitePath(siteName, "collections", id), data);
924
926
  await this.invalidateCache({
925
- keys: [
926
- this.sitePath(siteName, "collections"),
927
- this.sitePath(siteName, "collections", id)
928
- ]
927
+ tags: [`collections:${siteName}`],
928
+ keys: [this.sitePath(siteName, "collections", id)]
929
929
  });
930
930
  return result;
931
931
  }
932
932
  async del(siteName, id) {
933
933
  const result = await this.deleteOne(this.sitePath(siteName, "collections", id));
934
934
  await this.invalidateCache({
935
- keys: [
936
- this.sitePath(siteName, "collections"),
937
- this.sitePath(siteName, "collections", id)
938
- ]
935
+ tags: [`collections:${siteName}`],
936
+ keys: [this.sitePath(siteName, "collections", id)]
939
937
  });
940
938
  return result;
941
939
  }
package/dist/index.mjs CHANGED
@@ -827,7 +827,9 @@ var CategoriesV2Client = class extends BaseV2Client {
827
827
  // src/v2/client/collections-client.ts
828
828
  var CollectionsV2Client = class extends BaseV2Client {
829
829
  async list(siteName, params) {
830
- return this.getList(this.sitePath(siteName, "collections"), params);
830
+ return this.getList(this.sitePath(siteName, "collections"), params, {
831
+ tags: [`collections:${siteName}`]
832
+ });
831
833
  }
832
834
  async getCurrent(siteName) {
833
835
  const result = await this.getOne(
@@ -840,26 +842,22 @@ var CollectionsV2Client = class extends BaseV2Client {
840
842
  }
841
843
  async create(siteName, data) {
842
844
  const result = await this.post(this.sitePath(siteName, "collections"), data);
843
- await this.invalidateCache({ keys: [this.sitePath(siteName, "collections")] });
845
+ await this.invalidateCache({ tags: [`collections:${siteName}`] });
844
846
  return result;
845
847
  }
846
848
  async update(siteName, id, data) {
847
849
  const result = await this.patchOne(this.sitePath(siteName, "collections", id), data);
848
850
  await this.invalidateCache({
849
- keys: [
850
- this.sitePath(siteName, "collections"),
851
- this.sitePath(siteName, "collections", id)
852
- ]
851
+ tags: [`collections:${siteName}`],
852
+ keys: [this.sitePath(siteName, "collections", id)]
853
853
  });
854
854
  return result;
855
855
  }
856
856
  async del(siteName, id) {
857
857
  const result = await this.deleteOne(this.sitePath(siteName, "collections", id));
858
858
  await this.invalidateCache({
859
- keys: [
860
- this.sitePath(siteName, "collections"),
861
- this.sitePath(siteName, "collections", id)
862
- ]
859
+ tags: [`collections:${siteName}`],
860
+ keys: [this.sitePath(siteName, "collections", id)]
863
861
  });
864
862
  return result;
865
863
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "perspectapi-ts-sdk",
3
- "version": "6.3.0",
3
+ "version": "6.4.0",
4
4
  "description": "TypeScript SDK for PerspectAPI - Cloudflare Workers compatible",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -11,7 +11,9 @@ import type {
11
11
  export class CollectionsV2Client extends BaseV2Client {
12
12
 
13
13
  async list(siteName: string, params?: V2PaginationParams): Promise<V2List<V2Collection>> {
14
- return this.getList<V2Collection>(this.sitePath(siteName, 'collections'), params);
14
+ return this.getList<V2Collection>(this.sitePath(siteName, 'collections'), params, {
15
+ tags: [`collections:${siteName}`],
16
+ });
15
17
  }
16
18
 
17
19
  async getCurrent(siteName: string): Promise<V2Collection | null> {
@@ -27,17 +29,15 @@ export class CollectionsV2Client extends BaseV2Client {
27
29
 
28
30
  async create(siteName: string, data: V2CollectionCreateParams): Promise<V2Collection> {
29
31
  const result = await this.post<V2Collection>(this.sitePath(siteName, 'collections'), data);
30
- await this.invalidateCache({ keys: [this.sitePath(siteName, 'collections')] });
32
+ await this.invalidateCache({ tags: [`collections:${siteName}`] });
31
33
  return result;
32
34
  }
33
35
 
34
36
  async update(siteName: string, id: string, data: V2CollectionUpdateParams): Promise<V2Collection> {
35
37
  const result = await this.patchOne<V2Collection>(this.sitePath(siteName, 'collections', id), data);
36
38
  await this.invalidateCache({
37
- keys: [
38
- this.sitePath(siteName, 'collections'),
39
- this.sitePath(siteName, 'collections', id),
40
- ],
39
+ tags: [`collections:${siteName}`],
40
+ keys: [this.sitePath(siteName, 'collections', id)],
41
41
  });
42
42
  return result;
43
43
  }
@@ -45,10 +45,8 @@ export class CollectionsV2Client extends BaseV2Client {
45
45
  async del(siteName: string, id: string): Promise<V2Deleted> {
46
46
  const result = await this.deleteOne(this.sitePath(siteName, 'collections', id));
47
47
  await this.invalidateCache({
48
- keys: [
49
- this.sitePath(siteName, 'collections'),
50
- this.sitePath(siteName, 'collections', id),
51
- ],
48
+ tags: [`collections:${siteName}`],
49
+ keys: [this.sitePath(siteName, 'collections', id)],
52
50
  });
53
51
  return result;
54
52
  }