@pc-nexus/storage 0.5.0-next.23 → 0.5.0-next.24

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.
@@ -5,6 +5,7 @@ import type { DeleteOptions, FindOptions, InsertOptions, UpdateOptions } from "@
5
5
  * @template T Entity type extending Entity
6
6
  */
7
7
  export declare class CustomEntityStorage<T> {
8
+ #private;
8
9
  private readonly entityName;
9
10
  /**
10
11
  * @param entityName Entity name defined in manifest
@@ -24,7 +25,7 @@ export declare class CustomEntityStorage<T> {
24
25
  * @param options Find options, e.g. projection, hint, includes
25
26
  * @returns Matching entities
26
27
  */
27
- find(condition: (conditionBuilder: ConditionBuilder<T>) => void, options?: FindOptions<T>): Promise<T[]>;
28
+ find(condition?: (conditionBuilder: ConditionBuilder<T>) => void, options?: FindOptions<T>): Promise<T[]>;
28
29
  /**
29
30
  * Update all records matching the condition
30
31
  * @param condition Query condition
@@ -38,7 +39,7 @@ export declare class CustomEntityStorage<T> {
38
39
  * @param condition Query condition
39
40
  * @returns Record count
40
41
  */
41
- count(condition: (conditionBuilder: ConditionBuilder<T>) => void): Promise<number>;
42
+ count(condition?: (conditionBuilder: ConditionBuilder<T>) => void): Promise<number>;
42
43
  /**
43
44
  * Delete records matching the condition (soft delete)
44
45
  * @param condition Query condition
@@ -1 +1 @@
1
- {"version":3,"file":"entity-storage.d.ts","sourceRoot":"","sources":["../../../src/lib/ces/entity-storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAA0B,MAAM,8BAA8B,CAAC;AACxF,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnG;;;GAGG;AACH,qBAAa,mBAAmB,CAAC,CAAC;IAIX,OAAO,CAAC,QAAQ,CAAC,UAAU;IAH9C;;OAEG;gBACiC,UAAU,EAAE,MAAM;IAEtD;;;;;OAKG;IACU,MAAM,CAAC,KAAK,EA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U,EAAE,MAAM;IAYtD;;;;;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;IAalE;;;;;OAKG;IACU,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAatH;;;;;;OAMG;IACU,MAAM,CACf,SAAS,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,EAC1D,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,EAClB,OAAO,CAAC,EAAE,aAAa,GACxB,OAAO,CAAC,IAAI,CAAC;IAahB;;;;OAIG;IACU,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;IAYhG;;;;;OAKG;IACU,MAAM,CAAC,SAAS,EAAE,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;CAW1H"}
@@ -12,6 +12,15 @@ export class CustomEntityStorage {
12
12
  constructor(entityName) {
13
13
  this.entityName = entityName;
14
14
  }
15
+ #buildCondition(condition, options) {
16
+ let result = {};
17
+ if (condition) {
18
+ const conditionBuilder = ConditionBuilderHelper.create();
19
+ condition(conditionBuilder);
20
+ result = conditionBuilder.done();
21
+ }
22
+ return result;
23
+ }
15
24
  async insert(value, options) {
16
25
  const response = await invoke("storage/ces", "insert", {
17
26
  body: {
@@ -30,9 +39,7 @@ export class CustomEntityStorage {
30
39
  * @returns Matching entities
31
40
  */
32
41
  async find(condition, options) {
33
- const conditionBuilder = ConditionBuilderHelper.create();
34
- condition(conditionBuilder);
35
- const ast = conditionBuilder.done();
42
+ const ast = this.#buildCondition(condition);
36
43
  const response = await invoke("storage/ces", "find", {
37
44
  body: {
38
45
  entity_name: this.entityName,
@@ -51,9 +58,7 @@ export class CustomEntityStorage {
51
58
  * @returns void
52
59
  */
53
60
  async update(condition, value, options) {
54
- const conditionBuilder = ConditionBuilderHelper.create();
55
- condition(conditionBuilder);
56
- const ast = conditionBuilder.done();
61
+ const ast = this.#buildCondition(condition);
57
62
  const response = await invoke("storage/ces", "update", {
58
63
  body: {
59
64
  entity_name: this.entityName,
@@ -70,9 +75,7 @@ export class CustomEntityStorage {
70
75
  * @returns Record count
71
76
  */
72
77
  async count(condition) {
73
- const conditionBuilder = ConditionBuilderHelper.create();
74
- condition(conditionBuilder);
75
- const ast = conditionBuilder.done();
78
+ const ast = this.#buildCondition(condition);
76
79
  const response = await invoke("storage/ces", "count", {
77
80
  body: {
78
81
  entity_name: this.entityName,
@@ -89,9 +92,7 @@ export class CustomEntityStorage {
89
92
  * @returns void
90
93
  */
91
94
  async delete(condition, options) {
92
- const conditionBuilder = ConditionBuilderHelper.create();
93
- condition(conditionBuilder);
94
- const ast = conditionBuilder.done();
95
+ const ast = this.#buildCondition(condition);
95
96
  const response = await invoke("storage/ces", "delete", {
96
97
  body: {
97
98
  entity_name: this.entityName,
package/lib/nos/type.d.ts CHANGED
@@ -17,4 +17,7 @@ export interface ObjectMetadata {
17
17
  size: number;
18
18
  created_at?: number;
19
19
  }
20
+ export type GenerateUploadUrlPayload = Pick<UploadUrlBody, "size" | "checksum" | "checksum_type">;
21
+ export type PresignedURLToObjectMetadataMap = Record<string, UploadUrlBody>;
22
+ export type PresignedURLToObjectKeyMap = Record<string, string>;
20
23
  //# sourceMappingURL=type.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/lib/nos/type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;AAElE,MAAM,WAAW,aAAa;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,YAAY,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACjC,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB"}
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/lib/nos/type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;AAElE,MAAM,WAAW,aAAa;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,YAAY,CAAC;IAC5B,SAAS,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,MAAM,WAAW,oBAAoB;IACjC,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,MAAM,wBAAwB,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,UAAU,GAAG,eAAe,CAAC,CAAC;AAElG,MAAM,MAAM,+BAA+B,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAE5E,MAAM,MAAM,0BAA0B,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pc-nexus/storage",
3
- "version": "0.5.0-next.23",
3
+ "version": "0.5.0-next.24",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "type": "module",
32
32
  "dependencies": {
33
- "@pc-nexus/internal": "0.5.0-next.23",
33
+ "@pc-nexus/internal": "0.5.0-next.24",
34
34
  "lodash": "^4.17.21"
35
35
  },
36
36
  "devDependencies": {},