@nocobase/database 1.4.0-alpha.20240906133133 → 1.4.0-alpha.20240910145333

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.
Files changed (36) hide show
  1. package/lib/collection.d.ts +2 -2
  2. package/lib/collection.js +3 -0
  3. package/lib/database.d.ts +3 -3
  4. package/lib/database.js +2 -2
  5. package/lib/fields/date-field.d.ts +7 -2
  6. package/lib/fields/date-field.js +89 -0
  7. package/lib/fields/date-only-field.d.ts +15 -0
  8. package/lib/fields/date-only-field.js +45 -0
  9. package/lib/fields/datetime-field.d.ts +15 -0
  10. package/lib/fields/datetime-field.js +41 -0
  11. package/lib/fields/datetime-no-tz-field.d.ts +24 -0
  12. package/lib/fields/datetime-no-tz-field.js +128 -0
  13. package/lib/fields/datetime-tz-field.d.ts +15 -0
  14. package/lib/fields/datetime-tz-field.js +41 -0
  15. package/lib/fields/field.d.ts +1 -1
  16. package/lib/fields/field.js +3 -2
  17. package/lib/fields/index.d.ts +10 -1
  18. package/lib/fields/index.js +11 -1
  19. package/lib/fields/unix-timestamp-field.d.ts +22 -0
  20. package/lib/fields/unix-timestamp-field.js +94 -0
  21. package/lib/model.d.ts +1 -0
  22. package/lib/model.js +12 -0
  23. package/lib/operators/date.js +65 -24
  24. package/lib/options-parser.d.ts +1 -0
  25. package/lib/options-parser.js +24 -7
  26. package/lib/relation-repository/hasmany-repository.js +8 -11
  27. package/lib/relation-repository/multiple-relation-repository.d.ts +1 -0
  28. package/lib/relation-repository/multiple-relation-repository.js +11 -3
  29. package/lib/relation-repository/relation-repository.d.ts +6 -3
  30. package/lib/relation-repository/relation-repository.js +22 -2
  31. package/lib/repository.d.ts +5 -2
  32. package/lib/repository.js +26 -15
  33. package/lib/update-associations.d.ts +2 -1
  34. package/lib/view/field-type-map.d.ts +2 -2
  35. package/lib/view/field-type-map.js +17 -17
  36. package/package.json +4 -4
@@ -8,6 +8,7 @@
8
8
  */
9
9
  import { Association, BelongsToMany, Hookable, Transactionable } from 'sequelize';
10
10
  import { Model } from './model';
11
+ import { TargetKey } from './repository';
11
12
  export declare function modelAssociations(instance: Model): {
12
13
  [key: string]: Association<import("sequelize").Model<any, any>, import("sequelize").Model<any, any>>;
13
14
  };
@@ -18,7 +19,7 @@ type UpdateValue = {
18
19
  };
19
20
  interface UpdateOptions extends Transactionable {
20
21
  filter?: any;
21
- filterByTk?: number | string;
22
+ filterByTk?: TargetKey;
22
23
  whitelist?: string[];
23
24
  blacklist?: string[];
24
25
  updateAssociationValues?: string[];
@@ -62,7 +62,7 @@ declare const fieldTypeMap: {
62
62
  boolean: string;
63
63
  decimal: string;
64
64
  year: string[];
65
- datetime: string;
65
+ datetime: string[];
66
66
  timestamp: string;
67
67
  json: string[];
68
68
  enum: string;
@@ -104,7 +104,7 @@ declare const fieldTypeMap: {
104
104
  boolean: string;
105
105
  decimal: string;
106
106
  year: string[];
107
- datetime: string;
107
+ datetime: string[];
108
108
  timestamp: string;
109
109
  json: string[];
110
110
  enum: string;
@@ -30,24 +30,24 @@ __export(field_type_map_exports, {
30
30
  });
31
31
  module.exports = __toCommonJS(field_type_map_exports);
32
32
  const postgres = {
33
- "character varying": ["string", "uuid", "nanoid", "encryption"],
34
- varchar: ["string", "uuid", "nanoid", "encryption"],
35
- char: ["string", "uuid", "nanoid", "encryption"],
33
+ "character varying": ["string", "uuid", "nanoid", "encryption", "datetimeNoTz"],
34
+ varchar: ["string", "uuid", "nanoid", "encryption", "datetimeNoTz"],
35
+ char: ["string", "uuid", "nanoid", "encryption", "datetimeNoTz"],
36
36
  character: "string",
37
37
  text: "text",
38
38
  oid: "string",
39
39
  name: "string",
40
40
  smallint: ["integer", "sort"],
41
- integer: ["integer", "sort"],
42
- bigint: ["bigInt", "sort"],
41
+ integer: ["integer", "unixTimestamp", "sort"],
42
+ bigint: ["bigInt", "unixTimestamp", "sort"],
43
43
  decimal: "decimal",
44
44
  numeric: "float",
45
45
  real: "float",
46
46
  "double precision": "float",
47
- "timestamp without time zone": "date",
48
- "timestamp with time zone": "date",
47
+ "timestamp without time zone": "datetimeNoTz",
48
+ "timestamp with time zone": "datetimeTz",
49
49
  "time without time zone": "time",
50
- date: "date",
50
+ date: "dateOnly",
51
51
  boolean: "boolean",
52
52
  json: ["json", "array"],
53
53
  jsonb: ["json", "array", "jsonb"],
@@ -68,24 +68,24 @@ const mysql = {
68
68
  "mediumint unsigned": ["integer", "boolean", "sort"],
69
69
  char: ["string", "uuid", "nanoid", "encryption"],
70
70
  varchar: ["string", "uuid", "nanoid", "encryption"],
71
- date: "date",
71
+ date: "dateOnly",
72
72
  time: "time",
73
73
  tinytext: "text",
74
74
  text: "text",
75
75
  mediumtext: "text",
76
76
  longtext: "text",
77
- int: ["integer", "sort"],
78
- "int unsigned": ["integer", "sort"],
79
- integer: ["integer", "sort"],
80
- bigint: ["bigInt", "sort"],
81
- "bigint unsigned": ["bigInt", "sort"],
77
+ int: ["integer", "unixTimestamp", "sort"],
78
+ "int unsigned": ["integer", "unixTimestamp", "sort"],
79
+ integer: ["integer", "unixTimestamp", "sort"],
80
+ bigint: ["bigInt", "unixTimestamp", "sort"],
81
+ "bigint unsigned": ["bigInt", "unixTimestamp", "sort"],
82
82
  float: "float",
83
83
  double: "float",
84
84
  boolean: "boolean",
85
85
  decimal: "decimal",
86
86
  year: ["string", "integer"],
87
- datetime: "date",
88
- timestamp: "date",
87
+ datetime: ["datetimeNoTz", "datetimeTz"],
88
+ timestamp: "datetimeTz",
89
89
  json: ["json", "array"],
90
90
  enum: "string"
91
91
  };
@@ -94,7 +94,7 @@ const sqlite = {
94
94
  varchar: ["string", "uuid", "nanoid", "encryption"],
95
95
  integer: "integer",
96
96
  real: "real",
97
- datetime: "date",
97
+ datetime: "datetimeTz",
98
98
  date: "date",
99
99
  time: "time",
100
100
  boolean: "boolean",
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/database",
3
- "version": "1.4.0-alpha.20240906133133",
3
+ "version": "1.4.0-alpha.20240910145333",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
7
  "license": "AGPL-3.0",
8
8
  "dependencies": {
9
- "@nocobase/logger": "1.4.0-alpha.20240906133133",
10
- "@nocobase/utils": "1.4.0-alpha.20240906133133",
9
+ "@nocobase/logger": "1.4.0-alpha.20240910145333",
10
+ "@nocobase/utils": "1.4.0-alpha.20240910145333",
11
11
  "async-mutex": "^0.3.2",
12
12
  "chalk": "^4.1.1",
13
13
  "cron-parser": "4.4.0",
@@ -38,5 +38,5 @@
38
38
  "url": "git+https://github.com/nocobase/nocobase.git",
39
39
  "directory": "packages/database"
40
40
  },
41
- "gitHead": "e87488347b8376ba6877306986ecc0c1d2d41542"
41
+ "gitHead": "87807593da799e557718f8e69172244c28c08d98"
42
42
  }