@pc-nexus/storage 0.0.1-next.2 → 0.0.1-next.3

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.
@@ -1,5 +1,5 @@
1
1
  import { type ConditionBuilderApi } from "./condition-builder/condition-builder.js";
2
- import type { InsertOptions, FindOptions, UpdateOptions, DeleteOptions } from "./type.js";
2
+ import type { DeleteOptions, FindOptions, InsertOptions, UpdateOptions } from "./type.js";
3
3
  /**
4
4
  * Entity storage API implementation, provides CRUD operations for entities via CES hook
5
5
  * @template T Entity type extending Entity
@@ -1 +1 @@
1
- {"version":3,"file":"entity-storage.d.ts","sourceRoot":"","sources":["../../../src/lib/ces/entity-storage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AACtG,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG1F;;;GAGG;AACH,qBAAa,mBAAmB,CAAC,CAAC;IAIX,OAAO,CAAC,QAAQ,CAAC,UAAU;IAH9C;;OAEG;gBACiC,UAAU,EAAE,MAAM;IAEtD;;;;;OAKG;IACU,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IACzD,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,CAAC,CAAC;IAOlE;;;;;OAKG;IACU,IAAI,CAAC,SAAS,EAAE,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IASrH;;;;;;OAMG;IACU,MAAM,CACf,SAAS,EAAE,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAA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EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,EAC7D,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAClB,OAAO,CAAC,EAAE,aAAa,GACxB,OAAO,CAAC,IAAI,CAAC;IAchB;;;;OAIG;IACU,KAAK,CAAC,SAAS,EAAE,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IAclG;;;;;OAKG;IACU,MAAM,CAAC,SAAS,EAAE,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAY7H"}
@@ -1,5 +1,5 @@
1
+ import { invoke } from "@pc-nexus/core";
1
2
  import { ConditionBuilder } from "./condition-builder/condition-builder.js";
2
- import { hook } from "@pc-nexus/core";
3
3
  /**
4
4
  * Entity storage API implementation, provides CRUD operations for entities via CES hook
5
5
  * @template T Entity type extending Entity
@@ -13,7 +13,13 @@ export class CustomEntityStorage {
13
13
  this.entityName = entityName;
14
14
  }
15
15
  async insert(value, options) {
16
- const response = await hook("storage/ces").insert(this.entityName, value, options);
16
+ const response = await invoke("storage/ces", "insert", {
17
+ body: {
18
+ table_name: this.entityName,
19
+ value: value,
20
+ options: options,
21
+ },
22
+ });
17
23
  const result = await response.json();
18
24
  return result;
19
25
  }
@@ -27,7 +33,13 @@ export class CustomEntityStorage {
27
33
  const conditionBuilder = new ConditionBuilder();
28
34
  condition(conditionBuilder);
29
35
  const ast = conditionBuilder.done();
30
- const response = await hook("storage/ces").find(this.entityName, ast, options);
36
+ const response = await invoke("storage/ces", "find", {
37
+ body: {
38
+ table_name: this.entityName,
39
+ condition: ast,
40
+ options: options,
41
+ },
42
+ });
31
43
  const result = await response.json();
32
44
  return result;
33
45
  }
@@ -42,7 +54,14 @@ export class CustomEntityStorage {
42
54
  const conditionBuilder = new ConditionBuilder();
43
55
  condition(conditionBuilder);
44
56
  const ast = conditionBuilder.done();
45
- await hook("storage/ces").update(this.entityName, ast, value, options);
57
+ await invoke("storage/ces", "update", {
58
+ body: {
59
+ table_name: this.entityName,
60
+ condition: ast,
61
+ value: value,
62
+ options: options,
63
+ },
64
+ });
46
65
  }
47
66
  /**
48
67
  * Count records matching the condition
@@ -53,7 +72,12 @@ export class CustomEntityStorage {
53
72
  const conditionBuilder = new ConditionBuilder();
54
73
  condition(conditionBuilder);
55
74
  const ast = conditionBuilder.done();
56
- const response = await hook("storage/ces").count(this.entityName, ast);
75
+ const response = await invoke("storage/ces", "count", {
76
+ body: {
77
+ table_name: this.entityName,
78
+ condition: ast,
79
+ },
80
+ });
57
81
  const result = await response.json();
58
82
  return result;
59
83
  }
@@ -67,6 +91,12 @@ export class CustomEntityStorage {
67
91
  const conditionBuilder = new ConditionBuilder();
68
92
  condition(conditionBuilder);
69
93
  const ast = conditionBuilder.done();
70
- await hook("storage/ces").delete(this.entityName, ast, options);
94
+ await invoke("storage/ces", "delete", {
95
+ body: {
96
+ table_name: this.entityName,
97
+ condition: ast,
98
+ options: options,
99
+ },
100
+ });
71
101
  }
72
102
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pc-nexus/storage",
3
- "version": "0.0.1-next.2",
3
+ "version": "0.0.1-next.3",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {