@rushdb/javascript-sdk 0.2.9 → 0.3.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/CHANGELOG.md +12 -0
- package/cjs/sdk/record.js +7 -0
- package/esm/sdk/record.js +7 -0
- package/package.json +1 -1
- package/types/sdk/record.d.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @rushdb/javascript-sdk
|
|
2
2
|
|
|
3
|
+
## 0.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 70d108d: CLI commands & datetime helpers in the Javascript SDK
|
|
8
|
+
|
|
9
|
+
## 0.2.10
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 89f2783: Update readme and license
|
|
14
|
+
|
|
3
15
|
## 0.2.9
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/cjs/sdk/record.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DBRecordsArrayInstance = exports.DBRecordInstance = exports.DBRecordDraft = exports.DBRecordsBatchDraft = void 0;
|
|
4
4
|
const rest_api_proxy_js_1 = require("../api/rest-api-proxy.js");
|
|
5
|
+
const utils_js_1 = require("./utils.js");
|
|
5
6
|
class DBRecordsBatchDraft {
|
|
6
7
|
constructor({ label, options = {
|
|
7
8
|
returnResult: true,
|
|
@@ -39,6 +40,12 @@ class DBRecordInstance extends rest_api_proxy_js_1.RestApiProxy {
|
|
|
39
40
|
this.data = data;
|
|
40
41
|
this.searchParams = searchParams;
|
|
41
42
|
}
|
|
43
|
+
__date() {
|
|
44
|
+
return (0, utils_js_1.idToDate)(this.data.__id);
|
|
45
|
+
}
|
|
46
|
+
__timestamp() {
|
|
47
|
+
return (0, utils_js_1.idToTimestamp)(this.data.__id);
|
|
48
|
+
}
|
|
42
49
|
async delete(transaction) {
|
|
43
50
|
if (this.data) {
|
|
44
51
|
return await this.apiProxy.records.deleteById(this.data.__id, transaction);
|
package/esm/sdk/record.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RestApiProxy } from '../api/rest-api-proxy.js';
|
|
2
|
+
import { idToDate, idToTimestamp } from './utils.js';
|
|
2
3
|
export class DBRecordsBatchDraft {
|
|
3
4
|
constructor({ label, options = {
|
|
4
5
|
returnResult: true,
|
|
@@ -34,6 +35,12 @@ export class DBRecordInstance extends RestApiProxy {
|
|
|
34
35
|
this.data = data;
|
|
35
36
|
this.searchParams = searchParams;
|
|
36
37
|
}
|
|
38
|
+
__date() {
|
|
39
|
+
return idToDate(this.data.__id);
|
|
40
|
+
}
|
|
41
|
+
__timestamp() {
|
|
42
|
+
return idToTimestamp(this.data.__id);
|
|
43
|
+
}
|
|
37
44
|
async delete(transaction) {
|
|
38
45
|
if (this.data) {
|
|
39
46
|
return await this.apiProxy.records.deleteById(this.data.__id, transaction);
|
package/package.json
CHANGED
package/types/sdk/record.d.ts
CHANGED
|
@@ -88,6 +88,8 @@ export declare class DBRecordInstance<S extends Schema = Schema> extends RestApi
|
|
|
88
88
|
data?: DBRecord<S>;
|
|
89
89
|
searchParams?: SearchQuery<S>;
|
|
90
90
|
constructor(data?: DBRecord<S>, searchParams?: SearchQuery<S>);
|
|
91
|
+
__date(): Date;
|
|
92
|
+
__timestamp(): number;
|
|
91
93
|
delete(transaction?: Transaction | string): Promise<import("../api/types.js").ApiResponse<{
|
|
92
94
|
message: string;
|
|
93
95
|
}, Record<string, any>> | undefined>;
|