@rushdb/javascript-sdk 0.2.10 → 0.3.1

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @rushdb/javascript-sdk
2
2
 
3
+ ## 0.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - d3b73ac: Minor fixes
8
+
9
+ ## 0.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 70d108d: CLI commands & datetime helpers in the Javascript SDK
14
+
3
15
  ## 0.2.10
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
@@ -12,7 +12,7 @@
12
12
  "rushdb"
13
13
  ],
14
14
  "license": "Apache-2.0",
15
- "version": "0.2.10",
15
+ "version": "0.3.1",
16
16
  "type": "module",
17
17
  "main": "cjs/index.cjs.node.js",
18
18
  "types": "types/index.d.ts",
@@ -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>;