drizzle-kit 1.0.0-beta.1-fd8bfcc → 1.0.0-beta.1-860c2f2

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 (4) hide show
  1. package/api.js +35 -4
  2. package/api.mjs +35 -4
  3. package/bin.cjs +261 -2223
  4. package/package.json +1 -1
package/api.js CHANGED
@@ -23732,7 +23732,10 @@ function mapRelationalRow(row, buildQueryResultSelection, mapColumnValue = (valu
23732
23732
  if (selectionItem.selection) {
23733
23733
  const currentPath = `${path2 ? `${path2}.` : ""}${selectionItem.key}`;
23734
23734
  if (row[selectionItem.key] === null) continue;
23735
- if (parseJson) row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
23735
+ if (parseJson) {
23736
+ row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
23737
+ if (row[selectionItem.key] === null) continue;
23738
+ }
23736
23739
  if (parseJsonIfString && typeof row[selectionItem.key] === "string") {
23737
23740
  row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
23738
23741
  }
@@ -37796,8 +37799,12 @@ var init_bigint2 = __esm({
37796
37799
  getSQLType() {
37797
37800
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
37798
37801
  }
37802
+ mapToDriverValue(value) {
37803
+ return value.toString();
37804
+ }
37799
37805
  // eslint-disable-next-line unicorn/prefer-native-coercion-functions
37800
37806
  mapFromDriverValue(value) {
37807
+ if (typeof value === "bigint") return value;
37801
37808
  return BigInt(value);
37802
37809
  }
37803
37810
  };
@@ -38067,6 +38074,10 @@ var init_date2 = __esm({
38067
38074
  getSQLType() {
38068
38075
  return `date`;
38069
38076
  }
38077
+ mapFromDriverValue(value) {
38078
+ if (typeof value === "string") return value;
38079
+ return value.toISOString().slice(0, -14);
38080
+ }
38070
38081
  };
38071
38082
  __publicField(MySqlDateString, _a283, "MySqlDateString");
38072
38083
  }
@@ -38115,7 +38126,8 @@ var init_datetime = __esm({
38115
38126
  return value.toISOString().replace("T", " ").replace("Z", "");
38116
38127
  }
38117
38128
  mapFromDriverValue(value) {
38118
- return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
38129
+ if (typeof value === "string") return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
38130
+ return value;
38119
38131
  }
38120
38132
  };
38121
38133
  __publicField(MySqlDateTime, _a285, "MySqlDateTime");
@@ -38143,6 +38155,10 @@ var init_datetime = __esm({
38143
38155
  const precision = this.fsp === void 0 ? "" : `(${this.fsp})`;
38144
38156
  return `datetime${precision}`;
38145
38157
  }
38158
+ mapFromDriverValue(value) {
38159
+ if (typeof value === "string") return value;
38160
+ return value.toISOString().slice(0, -5).replace("T", " ");
38161
+ }
38146
38162
  };
38147
38163
  __publicField(MySqlDateTimeString, _a287, "MySqlDateTimeString");
38148
38164
  }
@@ -38797,6 +38813,10 @@ var init_time2 = __esm({
38797
38813
  const precision = this.fsp === void 0 ? "" : `(${this.fsp})`;
38798
38814
  return `time${precision}`;
38799
38815
  }
38816
+ mapFromDriverValue(value) {
38817
+ if (typeof value === "string") return value;
38818
+ return value.toTimeString().split(" ").shift();
38819
+ }
38800
38820
  };
38801
38821
  __publicField(MySqlTime, _a317, "MySqlTime");
38802
38822
  }
@@ -38871,7 +38891,8 @@ var init_timestamp2 = __esm({
38871
38891
  return `timestamp${precision}`;
38872
38892
  }
38873
38893
  mapFromDriverValue(value) {
38874
- return /* @__PURE__ */ new Date(value + "+0000");
38894
+ if (typeof value === "string") return /* @__PURE__ */ new Date(value + "+0000");
38895
+ return value;
38875
38896
  }
38876
38897
  mapToDriverValue(value) {
38877
38898
  return value.toISOString().slice(0, -1).replace("T", " ");
@@ -38901,6 +38922,12 @@ var init_timestamp2 = __esm({
38901
38922
  const precision = this.fsp === void 0 ? "" : `(${this.fsp})`;
38902
38923
  return `timestamp${precision}`;
38903
38924
  }
38925
+ mapFromDriverValue(value) {
38926
+ if (typeof value === "string") return value;
38927
+ const shortened = value.toISOString().slice(0, -1).replace("T", " ");
38928
+ if (shortened.endsWith(".000")) return shortened.slice(0, -4);
38929
+ return shortened;
38930
+ }
38904
38931
  };
38905
38932
  __publicField(MySqlTimestampString, _a323, "MySqlTimestampString");
38906
38933
  }
@@ -39057,6 +39084,10 @@ var init_year = __esm({
39057
39084
  getSQLType() {
39058
39085
  return `year`;
39059
39086
  }
39087
+ mapFromDriverValue(value) {
39088
+ if (typeof value === "number") return value;
39089
+ return Number(value);
39090
+ }
39060
39091
  };
39061
39092
  __publicField(MySqlYear, _a331, "MySqlYear");
39062
39093
  }
@@ -39556,7 +39587,7 @@ var init_utils8 = __esm({
39556
39587
  "../drizzle-orm/dist/mysql-core/utils.js"() {
39557
39588
  "use strict";
39558
39589
  init_entity();
39559
- init_dist();
39590
+ init_sql();
39560
39591
  init_subquery();
39561
39592
  init_table();
39562
39593
  init_view_common();
package/api.mjs CHANGED
@@ -23737,7 +23737,10 @@ function mapRelationalRow(row, buildQueryResultSelection, mapColumnValue = (valu
23737
23737
  if (selectionItem.selection) {
23738
23738
  const currentPath = `${path2 ? `${path2}.` : ""}${selectionItem.key}`;
23739
23739
  if (row[selectionItem.key] === null) continue;
23740
- if (parseJson) row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
23740
+ if (parseJson) {
23741
+ row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
23742
+ if (row[selectionItem.key] === null) continue;
23743
+ }
23741
23744
  if (parseJsonIfString && typeof row[selectionItem.key] === "string") {
23742
23745
  row[selectionItem.key] = JSON.parse(row[selectionItem.key]);
23743
23746
  }
@@ -37801,8 +37804,12 @@ var init_bigint2 = __esm({
37801
37804
  getSQLType() {
37802
37805
  return `bigint${this.config.unsigned ? " unsigned" : ""}`;
37803
37806
  }
37807
+ mapToDriverValue(value) {
37808
+ return value.toString();
37809
+ }
37804
37810
  // eslint-disable-next-line unicorn/prefer-native-coercion-functions
37805
37811
  mapFromDriverValue(value) {
37812
+ if (typeof value === "bigint") return value;
37806
37813
  return BigInt(value);
37807
37814
  }
37808
37815
  };
@@ -38072,6 +38079,10 @@ var init_date2 = __esm({
38072
38079
  getSQLType() {
38073
38080
  return `date`;
38074
38081
  }
38082
+ mapFromDriverValue(value) {
38083
+ if (typeof value === "string") return value;
38084
+ return value.toISOString().slice(0, -14);
38085
+ }
38075
38086
  };
38076
38087
  __publicField(MySqlDateString, _a283, "MySqlDateString");
38077
38088
  }
@@ -38120,7 +38131,8 @@ var init_datetime = __esm({
38120
38131
  return value.toISOString().replace("T", " ").replace("Z", "");
38121
38132
  }
38122
38133
  mapFromDriverValue(value) {
38123
- return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
38134
+ if (typeof value === "string") return /* @__PURE__ */ new Date(value.replace(" ", "T") + "Z");
38135
+ return value;
38124
38136
  }
38125
38137
  };
38126
38138
  __publicField(MySqlDateTime, _a285, "MySqlDateTime");
@@ -38148,6 +38160,10 @@ var init_datetime = __esm({
38148
38160
  const precision = this.fsp === void 0 ? "" : `(${this.fsp})`;
38149
38161
  return `datetime${precision}`;
38150
38162
  }
38163
+ mapFromDriverValue(value) {
38164
+ if (typeof value === "string") return value;
38165
+ return value.toISOString().slice(0, -5).replace("T", " ");
38166
+ }
38151
38167
  };
38152
38168
  __publicField(MySqlDateTimeString, _a287, "MySqlDateTimeString");
38153
38169
  }
@@ -38802,6 +38818,10 @@ var init_time2 = __esm({
38802
38818
  const precision = this.fsp === void 0 ? "" : `(${this.fsp})`;
38803
38819
  return `time${precision}`;
38804
38820
  }
38821
+ mapFromDriverValue(value) {
38822
+ if (typeof value === "string") return value;
38823
+ return value.toTimeString().split(" ").shift();
38824
+ }
38805
38825
  };
38806
38826
  __publicField(MySqlTime, _a317, "MySqlTime");
38807
38827
  }
@@ -38876,7 +38896,8 @@ var init_timestamp2 = __esm({
38876
38896
  return `timestamp${precision}`;
38877
38897
  }
38878
38898
  mapFromDriverValue(value) {
38879
- return /* @__PURE__ */ new Date(value + "+0000");
38899
+ if (typeof value === "string") return /* @__PURE__ */ new Date(value + "+0000");
38900
+ return value;
38880
38901
  }
38881
38902
  mapToDriverValue(value) {
38882
38903
  return value.toISOString().slice(0, -1).replace("T", " ");
@@ -38906,6 +38927,12 @@ var init_timestamp2 = __esm({
38906
38927
  const precision = this.fsp === void 0 ? "" : `(${this.fsp})`;
38907
38928
  return `timestamp${precision}`;
38908
38929
  }
38930
+ mapFromDriverValue(value) {
38931
+ if (typeof value === "string") return value;
38932
+ const shortened = value.toISOString().slice(0, -1).replace("T", " ");
38933
+ if (shortened.endsWith(".000")) return shortened.slice(0, -4);
38934
+ return shortened;
38935
+ }
38909
38936
  };
38910
38937
  __publicField(MySqlTimestampString, _a323, "MySqlTimestampString");
38911
38938
  }
@@ -39062,6 +39089,10 @@ var init_year = __esm({
39062
39089
  getSQLType() {
39063
39090
  return `year`;
39064
39091
  }
39092
+ mapFromDriverValue(value) {
39093
+ if (typeof value === "number") return value;
39094
+ return Number(value);
39095
+ }
39065
39096
  };
39066
39097
  __publicField(MySqlYear, _a331, "MySqlYear");
39067
39098
  }
@@ -39561,7 +39592,7 @@ var init_utils8 = __esm({
39561
39592
  "../drizzle-orm/dist/mysql-core/utils.js"() {
39562
39593
  "use strict";
39563
39594
  init_entity();
39564
- init_dist();
39595
+ init_sql();
39565
39596
  init_subquery();
39566
39597
  init_table();
39567
39598
  init_view_common();