@naturalcycles/js-lib 14.161.3 → 14.161.4

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,3 +1,3 @@
1
1
  import type { BaseDBEntity, SavedDBEntity } from '../types';
2
- export declare const baseDBEntityJsonSchema: import("./jsonSchemaBuilder").JsonSchemaObjectBuilder<BaseDBEntity<string>>;
3
- export declare const savedDBEntityJsonSchema: import("./jsonSchemaBuilder").JsonSchemaObjectBuilder<SavedDBEntity<string>>;
2
+ export declare const baseDBEntityJsonSchema: import("./jsonSchemaBuilder").JsonSchemaObjectBuilder<BaseDBEntity>;
3
+ export declare const savedDBEntityJsonSchema: import("./jsonSchemaBuilder").JsonSchemaObjectBuilder<SavedDBEntity>;
package/dist/types.d.ts CHANGED
@@ -15,22 +15,22 @@ export type AnyObject = Record<string, any>;
15
15
  export type AnyEnum = NumberEnum;
16
16
  export type NumberEnum = Record<string, number | string>;
17
17
  export type StringEnum = Record<string, string>;
18
- export interface CreatedUpdated {
18
+ export type CreatedUpdated = {
19
19
  created: number;
20
20
  updated: number;
21
- }
21
+ };
22
22
  export interface CreatedUpdatedId<ID extends string | number = string | number> extends CreatedUpdated {
23
23
  id: ID;
24
24
  }
25
- export interface ObjectWithId<ID extends string | number = string | number> {
25
+ export type ObjectWithId<ID extends string | number = string | number> = {
26
26
  id: ID;
27
- }
27
+ };
28
28
  export interface AnyObjectWithId<ID extends string | number = string | number> extends AnyObject, ObjectWithId<ID> {
29
29
  }
30
30
  /**
31
31
  * Base interface for any Entity that was saved to DB.
32
32
  */
33
- export interface SavedDBEntity<ID extends string | number = string> {
33
+ export type SavedDBEntity<ID extends string | number = string> = {
34
34
  id: ID;
35
35
  /**
36
36
  * unixTimestamp of when the entity was first created (in the DB).
@@ -40,14 +40,14 @@ export interface SavedDBEntity<ID extends string | number = string> {
40
40
  * unixTimestamp of when the entity was last updated (in the DB).
41
41
  */
42
42
  updated: UnixTimestampNumber;
43
- }
43
+ };
44
44
  /**
45
45
  * Base interface for any Entity that can be saved to DB.
46
46
  * This interface fits when entity was NOT YET saved to DB,
47
47
  * hence `id`, `created` and `updated` fields CAN BE undefined (yet).
48
48
  * When it's known to be saved - `SavedDBEntity` interface can be used instead.
49
49
  */
50
- export interface BaseDBEntity<ID extends string | number = string> {
50
+ export type BaseDBEntity<ID extends string | number = string> = {
51
51
  id?: ID;
52
52
  /**
53
53
  * unixTimestamp of when the entity was first created (in the DB).
@@ -57,7 +57,7 @@ export interface BaseDBEntity<ID extends string | number = string> {
57
57
  * unixTimestamp of when the entity was last updated (in the DB).
58
58
  */
59
59
  updated?: UnixTimestampNumber;
60
- }
60
+ };
61
61
  export type Saved<T extends Partial<ObjectWithId>> = T extends AnyObject ? Omit<T, 'id' | 'created' | 'updated'> & SavedDBEntity<NonNullable<T['id']>> : T;
62
62
  export type Unsaved<T extends Partial<ObjectWithId>> = T extends AnyObject ? Omit<T, 'id' | 'created' | 'updated'> & BaseDBEntity<NonNullable<T['id']>> : T;
63
63
  export type UnsavedId<T extends Partial<ObjectWithId>> = Omit<T, 'id'> & {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/js-lib",
3
- "version": "14.161.3",
3
+ "version": "14.161.4",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "build-prod": "build-prod-esm-cjs",
package/src/types.ts CHANGED
@@ -19,7 +19,8 @@ export type AnyEnum = NumberEnum
19
19
  export type NumberEnum = Record<string, number | string>
20
20
  export type StringEnum = Record<string, string>
21
21
 
22
- export interface CreatedUpdated {
22
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
23
+ export type CreatedUpdated = {
23
24
  created: number
24
25
  updated: number
25
26
  }
@@ -29,7 +30,8 @@ export interface CreatedUpdatedId<ID extends string | number = string | number>
29
30
  id: ID
30
31
  }
31
32
 
32
- export interface ObjectWithId<ID extends string | number = string | number> {
33
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
34
+ export type ObjectWithId<ID extends string | number = string | number> = {
33
35
  id: ID
34
36
  }
35
37
 
@@ -40,7 +42,8 @@ export interface AnyObjectWithId<ID extends string | number = string | number>
40
42
  /**
41
43
  * Base interface for any Entity that was saved to DB.
42
44
  */
43
- export interface SavedDBEntity<ID extends string | number = string> {
45
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
46
+ export type SavedDBEntity<ID extends string | number = string> = {
44
47
  id: ID
45
48
 
46
49
  /**
@@ -60,7 +63,8 @@ export interface SavedDBEntity<ID extends string | number = string> {
60
63
  * hence `id`, `created` and `updated` fields CAN BE undefined (yet).
61
64
  * When it's known to be saved - `SavedDBEntity` interface can be used instead.
62
65
  */
63
- export interface BaseDBEntity<ID extends string | number = string> {
66
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions
67
+ export type BaseDBEntity<ID extends string | number = string> = {
64
68
  id?: ID
65
69
 
66
70
  /**