@inflector/optima 1.0.6 → 1.0.8

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/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DuckDBConnection, DuckDBInstance } from '@duckdb/node-api';
2
2
  import * as z from 'zod';
3
- export * from 'zod';
3
+ export { any, array, bigint, date, number, object, string } from 'zod';
4
4
 
5
5
  type SetFlag$1<C extends ColumnConfig, K extends keyof ColumnConfig> = Omit<C, K> & {
6
6
  [P in K]: true;
@@ -59,7 +59,6 @@ declare const Uuid: () => ColumnBuilder<string, SetFlag$1<Restrict<"defaultNow">
59
59
  declare const DateType: () => ColumnBuilder<Date, SetFlag$1<Restrict<"default">, "SQlType">, never>;
60
60
  declare const Timestamp: () => ColumnBuilder<Date, SetFlag$1<Restrict<"default">, "SQlType">, never>;
61
61
  declare const Enum: <T extends string | number>(vals: readonly T[]) => ColumnBuilder<T, SetFlag$1<SetFlag$1<Restrict<"defaultNow">, "validate">, "SQlType">, never>;
62
-
63
62
  declare const Json: <T extends z.ZodRawShape>(obj: T) => ColumnBuilder<z.core.$InferObjectOutput<T, {}>, SetFlag$1<Restrict<"primaryKey" | "unique" | "defaultNow">, "SQlType">, never>;
64
63
  declare const Array$1: <T extends z.ZodTypeAny>(schema: T) => ColumnBuilder<z.core.output<T>[], SetFlag$1<Restrict<"primaryKey" | "unique" | "defaultNow">, "SQlType">, never>;
65
64
  declare const Email: () => ColumnBuilder<string, SetFlag$1<SetFlag$1<Restrict<"defaultNow">, "SQlType">, "validate">, never>;
package/dist/index.js CHANGED
@@ -1,99 +1,8 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
-
19
- // src/index.ts
20
- var index_exports = {};
21
- __export(index_exports, {
22
- Array: () => Array2,
23
- BigInt: () => BigInt,
24
- Boolean: () => Boolean,
25
- Bytes: () => Bytes,
26
- Color: () => Color,
27
- DateType: () => DateType,
28
- Email: () => Email,
29
- Enum: () => Enum,
30
- Float: () => Float,
31
- GeoArea: () => GeoArea,
32
- GeoPoint: () => GeoPoint,
33
- Int: () => Int,
34
- Json: () => Json,
35
- OptimaDB: () => OptimaDB,
36
- Password: () => Password,
37
- SQLBuilder: () => SQLBuilder,
38
- Slug: () => Slug,
39
- Table: () => Table,
40
- Text: () => Text,
41
- Timestamp: () => Timestamp,
42
- Uuid: () => Uuid,
43
- between: () => between,
44
- cond: () => cond,
45
- contains: () => contains,
46
- endsWith: () => endsWith,
47
- eq: () => eq,
48
- gt: () => gt,
49
- gte: () => gte,
50
- inOp: () => inOp,
51
- is: () => is,
52
- isNot: () => isNot,
53
- like: () => like,
54
- lt: () => lt,
55
- lte: () => lte,
56
- ne: () => ne,
57
- notBetween: () => notBetween,
58
- notIn: () => notIn,
59
- notLike: () => notLike,
60
- notRegexp: () => notRegexp,
61
- refHelpers: () => refHelpers,
62
- regexp: () => regexp,
63
- startsWith: () => startsWith
64
- });
65
-
66
1
  // src/database.ts
67
2
  import { DuckDBInstance } from "@duckdb/node-api";
68
3
 
69
4
  // src/schema.ts
70
- var schema_exports = {};
71
- __export(schema_exports, {
72
- Array: () => Array2,
73
- BigInt: () => BigInt,
74
- Boolean: () => Boolean,
75
- Bytes: () => Bytes,
76
- Color: () => Color,
77
- DateType: () => DateType,
78
- Email: () => Email,
79
- Enum: () => Enum,
80
- Float: () => Float,
81
- GeoArea: () => GeoArea,
82
- GeoPoint: () => GeoPoint,
83
- Int: () => Int,
84
- Json: () => Json,
85
- Password: () => Password,
86
- SQLBuilder: () => SQLBuilder,
87
- Slug: () => Slug,
88
- Table: () => Table,
89
- Text: () => Text,
90
- Timestamp: () => Timestamp,
91
- Uuid: () => Uuid,
92
- refHelpers: () => refHelpers
93
- });
94
- __reExport(schema_exports, zod_star);
95
5
  import * as z from "zod";
96
- import * as zod_star from "zod";
97
6
  var refHelpers = {
98
7
  one: (ref) => ref,
99
8
  many: (ref) => ref
@@ -689,6 +598,7 @@ ${valuesBlock}${isReturning ? "\nRETURNING *" : ""};`;
689
598
  }
690
599
  async InitTable() {
691
600
  const SQL = SQLBuilder.BuildTable(this.Name, this.Columns);
601
+ console.log(SQL);
692
602
  await this.Connection.run(SQL);
693
603
  }
694
604
  static async create(name, Columns, Connection) {
@@ -1020,7 +930,7 @@ var SchemaMigrator = class {
1020
930
  for (const [tableName, fields] of Object.entries(desiredSchema)) {
1021
931
  if (!currentSchema[tableName]) {
1022
932
  const fieldDefs = Object.entries(fields).map(([colName, config]) => {
1023
- let def = `"${colName}" ${config.SQlType}`;
933
+ let def = `"${colName}" ${config.STRUCTType ? config.STRUCTType : config.SQlType}`;
1024
934
  if (config.primaryKey) def += " PRIMARY KEY";
1025
935
  if (config.notnull) def += " NOT NULL";
1026
936
  return def;
@@ -1119,7 +1029,7 @@ var SchemaMigrator = class {
1119
1029
  };
1120
1030
 
1121
1031
  // src/index.ts
1122
- __reExport(index_exports, schema_exports);
1032
+ import { number, string, object as object2, array, any, bigint, date } from "zod";
1123
1033
  export {
1124
1034
  Array2 as Array,
1125
1035
  BigInt,
@@ -1142,9 +1052,13 @@ export {
1142
1052
  Text,
1143
1053
  Timestamp,
1144
1054
  Uuid,
1055
+ any,
1056
+ array,
1145
1057
  between,
1058
+ bigint,
1146
1059
  cond,
1147
1060
  contains,
1061
+ date,
1148
1062
  endsWith,
1149
1063
  eq,
1150
1064
  gt,
@@ -1160,7 +1074,10 @@ export {
1160
1074
  notIn,
1161
1075
  notLike,
1162
1076
  notRegexp,
1077
+ number,
1078
+ object2 as object,
1163
1079
  refHelpers,
1164
1080
  regexp,
1165
- startsWith
1081
+ startsWith,
1082
+ string
1166
1083
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inflector/optima",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "author": "Inflector",
6
6
  "main": "./dist/index.js",