@pc-nexus/storage 0.5.0-next.6 → 0.5.0-next.8

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/index.d.ts CHANGED
@@ -2,5 +2,5 @@ export * from "./lib/ces/type.js";
2
2
  export * from "./lib/ces/condition-builder/index.js";
3
3
  export * from "./lib/ces/index.js";
4
4
  export * from "./lib/kvs/index.js";
5
- export * from "./lib/os/index.js";
5
+ export * from "./lib/nos/index.js";
6
6
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sCAAsC,CAAC;AACrD,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,sCAAsC,CAAC;AACrD,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC"}
package/index.js CHANGED
@@ -2,4 +2,4 @@ export * from "./lib/ces/type.js";
2
2
  export * from "./lib/ces/condition-builder/index.js";
3
3
  export * from "./lib/ces/index.js";
4
4
  export * from "./lib/kvs/index.js";
5
- export * from "./lib/os/index.js";
5
+ export * from "./lib/nos/index.js";
@@ -1 +1 @@
1
- {"version":3,"file":"entity-storage.d.ts","sourceRoot":"","sources":["../../../src/lib/ces/entity-storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,KAAK,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1F;;;GAGG;AACH,qBAAa,mBAA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aAAa,EAAE,MAAM,WAAW,CAAC;AAE1F;;;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;IAalE;;;;;OAKG;IACU,IAAI,CAAC,SAAS,EAAE,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAexH;;;;;;OAMG;IACU,MAAM,CACf,SAAS,EAAE,CAAC,gBAAgB,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;IAehB;;;;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;CAa7H"}
@@ -20,8 +20,8 @@ export class CustomEntityStorage {
20
20
  options: options,
21
21
  },
22
22
  });
23
- const result = await response.json();
24
- return result;
23
+ const result = (await response.json());
24
+ return result.value;
25
25
  }
26
26
  /**
27
27
  * Find records matching the condition
@@ -40,8 +40,8 @@ export class CustomEntityStorage {
40
40
  options: options,
41
41
  },
42
42
  });
43
- const result = await response.json();
44
- return result;
43
+ const result = (await response.json());
44
+ return result.value;
45
45
  }
46
46
  /**
47
47
  * Update all records matching the condition
@@ -62,8 +62,7 @@ export class CustomEntityStorage {
62
62
  options: options,
63
63
  },
64
64
  });
65
- const result = await response.json();
66
- return result;
65
+ await response.json();
67
66
  }
68
67
  /**
69
68
  * Count records matching the condition
@@ -80,8 +79,8 @@ export class CustomEntityStorage {
80
79
  condition: ast,
81
80
  },
82
81
  });
83
- const result = await response.json();
84
- return result;
82
+ const result = (await response.json());
83
+ return result.value;
85
84
  }
86
85
  /**
87
86
  * Delete records matching the condition (soft delete)
@@ -100,7 +99,6 @@ export class CustomEntityStorage {
100
99
  options: options,
101
100
  },
102
101
  });
103
- const result = await response.json();
104
- return result;
102
+ await response.json();
105
103
  }
106
104
  }
@@ -6,4 +6,5 @@ export declare const ces: {
6
6
  */
7
7
  entity<T>(entityName: string): CustomEntityStorage<T>;
8
8
  };
9
+ export type { CustomEntityStorage };
9
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/ces/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,uCAAuC;AACvC,eAAO,MAAM,GAAG;IACZ;;OAEG;WACI,CAAC,cAAc,MAAM,GAAG,mBAAmB,CAAC,CAAC,CAAC;CAGxD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/ces/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,uCAAuC;AACvC,eAAO,MAAM,GAAG;IACZ;;OAEG;WACI,CAAC,cAAc,MAAM,GAAG,mBAAmB,CAAC,CAAC,CAAC;CAGxD,CAAC;AAEF,YAAY,EAAE,mBAAmB,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./nos.js";
2
+ export * from "./type.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/nos/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./nos.js";
2
+ export * from "./type.js";
@@ -0,0 +1,10 @@
1
+ import { ObjectMetadata, PresignedUrlResponse, UploadUrlBody } from "./type.js";
2
+ declare class NOS {
3
+ createUploadUrl(body: UploadUrlBody): Promise<PresignedUrlResponse>;
4
+ createDownloadUrl(key: string): Promise<PresignedUrlResponse>;
5
+ getMetadata(key: string): Promise<ObjectMetadata>;
6
+ delete(key: string): Promise<void>;
7
+ }
8
+ export declare const nos: NOS;
9
+ export {};
10
+ //# sourceMappingURL=nos.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nos.d.ts","sourceRoot":"","sources":["../../../src/lib/nos/nos.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAEhF,cAAM,GAAG;IACQ,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAQnE,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAQ7D,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAQjD,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAKlD;AACD,eAAO,MAAM,GAAG,KAAY,CAAC"}
package/lib/nos/nos.js ADDED
@@ -0,0 +1,30 @@
1
+ import { invoke } from "@pc-nexus/internal";
2
+ class NOS {
3
+ async createUploadUrl(body) {
4
+ const response = await invoke("storage/nos", "createUploadUrl", {
5
+ body,
6
+ });
7
+ const result = (await response.json());
8
+ return result.value;
9
+ }
10
+ async createDownloadUrl(key) {
11
+ const response = await invoke("storage/nos", "createDownloadUrl", {
12
+ key,
13
+ });
14
+ const result = (await response.json());
15
+ return result.value;
16
+ }
17
+ async getMetadata(key) {
18
+ const response = await invoke("storage/nos", "getMetadata", {
19
+ key,
20
+ });
21
+ const result = (await response.json());
22
+ return result.value;
23
+ }
24
+ async delete(key) {
25
+ await invoke("storage/nos", "delete", {
26
+ key,
27
+ });
28
+ }
29
+ }
30
+ export const nos = new NOS();
@@ -0,0 +1,19 @@
1
+ export interface UploadUrlBody {
2
+ key: string;
3
+ length: number;
4
+ checksum: string;
5
+ checksum_type: "SHA1" | "SHA256" | "CRC32" | "CRC32C";
6
+ overwrite?: boolean;
7
+ }
8
+ export interface PresignedUrlResponse {
9
+ url: string;
10
+ }
11
+ export interface ObjectMetadata {
12
+ key: string;
13
+ name: string;
14
+ mime_type?: string;
15
+ checksum: string;
16
+ size: number;
17
+ created_at?: string;
18
+ }
19
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../src/lib/nos/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,QAAQ,CAAC;IACtD,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pc-nexus/storage",
3
- "version": "0.5.0-next.6",
3
+ "version": "0.5.0-next.8",
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.6",
33
+ "@pc-nexus/internal": "0.5.0-next.8",
34
34
  "lodash": "^4.17.21"
35
35
  },
36
36
  "devDependencies": {},
package/lib/os/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- /**
2
- * EAP (Early Access Program)
3
- */
4
- export {};
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/os/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,CAAC"}
File without changes