@naturalcycles/db-lib 8.36.0 → 8.36.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.
@@ -1,6 +1,5 @@
1
- import { CreatedUpdated, CreatedUpdatedId, ObjectWithId } from '@naturalcycles/js-lib';
1
+ import { CreatedUpdated, CreatedUpdatedId } from '@naturalcycles/js-lib';
2
2
  export declare function createdUpdatedFields(existingObject?: Partial<CreatedUpdated> | null): CreatedUpdated;
3
- export declare function createdUpdatedIdFields(existingObject?: Partial<CreatedUpdatedId> | null): CreatedUpdatedId;
4
- export declare function idField(existingObject?: Partial<CreatedUpdatedId> | null): ObjectWithId;
3
+ export declare function createdUpdatedIdFields(existingObject?: Partial<CreatedUpdatedId<string>> | null): CreatedUpdatedId<string>;
5
4
  export declare function deserializeJsonField<T = any>(f?: string): T;
6
5
  export declare function serializeJsonField(f: any): string | undefined;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeJsonField = exports.deserializeJsonField = exports.idField = exports.createdUpdatedIdFields = exports.createdUpdatedFields = void 0;
3
+ exports.serializeJsonField = exports.deserializeJsonField = exports.createdUpdatedIdFields = exports.createdUpdatedFields = void 0;
4
4
  const nodejs_lib_1 = require("@naturalcycles/nodejs-lib");
5
5
  function createdUpdatedFields(existingObject) {
6
6
  const now = Math.floor(Date.now() / 1000);
@@ -19,12 +19,6 @@ function createdUpdatedIdFields(existingObject) {
19
19
  };
20
20
  }
21
21
  exports.createdUpdatedIdFields = createdUpdatedIdFields;
22
- function idField(existingObject) {
23
- return {
24
- id: existingObject?.id || (0, nodejs_lib_1.stringId)(),
25
- };
26
- }
27
- exports.idField = idField;
28
22
  function deserializeJsonField(f) {
29
23
  return JSON.parse(f || '{}');
30
24
  }
package/package.json CHANGED
@@ -42,7 +42,7 @@
42
42
  "engines": {
43
43
  "node": ">=14.15"
44
44
  },
45
- "version": "8.36.0",
45
+ "version": "8.36.1",
46
46
  "description": "Lowest Common Denominator API to supported Databases",
47
47
  "keywords": [
48
48
  "db",
package/src/model.util.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { stringId } from '@naturalcycles/nodejs-lib'
2
- import { CreatedUpdated, CreatedUpdatedId, ObjectWithId } from '@naturalcycles/js-lib'
2
+ import { CreatedUpdated, CreatedUpdatedId } from '@naturalcycles/js-lib'
3
3
 
4
4
  export function createdUpdatedFields(
5
5
  existingObject?: Partial<CreatedUpdated> | null,
@@ -12,8 +12,8 @@ export function createdUpdatedFields(
12
12
  }
13
13
 
14
14
  export function createdUpdatedIdFields(
15
- existingObject?: Partial<CreatedUpdatedId> | null,
16
- ): CreatedUpdatedId {
15
+ existingObject?: Partial<CreatedUpdatedId<string>> | null,
16
+ ): CreatedUpdatedId<string> {
17
17
  const now = Math.floor(Date.now() / 1000)
18
18
  return {
19
19
  created: existingObject?.created || now,
@@ -22,12 +22,6 @@ export function createdUpdatedIdFields(
22
22
  }
23
23
  }
24
24
 
25
- export function idField(existingObject?: Partial<CreatedUpdatedId> | null): ObjectWithId {
26
- return {
27
- id: existingObject?.id || stringId(),
28
- }
29
- }
30
-
31
25
  export function deserializeJsonField<T = any>(f?: string): T {
32
26
  return JSON.parse(f || '{}')
33
27
  }