@setupless/drizzle 0.1.0 → 0.1.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.
@@ -0,0 +1,2 @@
1
+ export * as pg from "./pg/index.js";
2
+ export * as sqlite from "./sqlite/index.js";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sqlite = exports.pg = void 0;
4
+ exports.pg = require("./pg/index.js");
5
+ exports.sqlite = require("./sqlite/index.js");
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Defines an `id` primary-key column.
3
+ *
4
+ * PostgreSQL generates UUID values through the column's database default.
5
+ */
6
+ export default function id(strategy?: "auto" | "uuid"): {
7
+ id: import("drizzle-orm").IsIdentity<import("drizzle-orm").IsPrimaryKey<import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgIntegerBuilderInitial<"">>>, "always">;
8
+ } | {
9
+ id: import("drizzle-orm").HasDefault<import("drizzle-orm").IsPrimaryKey<import("drizzle-orm").NotNull<import("drizzle-orm/pg-core").PgUUIDBuilderInitial<"">>>>;
10
+ };
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = id;
4
+ const pg_core_1 = require("drizzle-orm/pg-core");
5
+ /**
6
+ * Defines an `id` primary-key column.
7
+ *
8
+ * PostgreSQL generates UUID values through the column's database default.
9
+ */
10
+ function id(strategy = "auto") {
11
+ switch (strategy) {
12
+ case "auto":
13
+ return { id: (0, pg_core_1.integer)().primaryKey().generatedAlwaysAsIdentity() };
14
+ case "uuid":
15
+ return {
16
+ id: (0, pg_core_1.uuid)().primaryKey().defaultRandom(),
17
+ };
18
+ }
19
+ }
@@ -0,0 +1 @@
1
+ export { default as id } from "./id.js";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.id = void 0;
4
+ var id_js_1 = require("./id.js");
5
+ Object.defineProperty(exports, "id", { enumerable: true, get: function () { return id_js_1.default; } });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Defines an `id` primary-key column.
3
+ *
4
+ * Drizzle generates UUID values in the application through `$defaultFn`.
5
+ */
6
+ export default function id(strategy?: "auto" | "uuid"): {
7
+ id: import("drizzle-orm").IsPrimaryKey<import("drizzle-orm").HasDefault<import("drizzle-orm").NotNull<import("drizzle-orm/sqlite-core").SQLiteIntegerBuilderInitial<"">>>>;
8
+ } | {
9
+ id: import("drizzle-orm").HasRuntimeDefault<import("drizzle-orm").HasDefault<import("drizzle-orm").IsPrimaryKey<import("drizzle-orm").NotNull<import("drizzle-orm/sqlite-core").SQLiteTextBuilderInitial<"", [string, ...string[]], undefined>>>>>;
10
+ };
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = id;
4
+ const sqlite_core_1 = require("drizzle-orm/sqlite-core");
5
+ /**
6
+ * Defines an `id` primary-key column.
7
+ *
8
+ * Drizzle generates UUID values in the application through `$defaultFn`.
9
+ */
10
+ function id(strategy = "auto") {
11
+ switch (strategy) {
12
+ case "auto":
13
+ return { id: (0, sqlite_core_1.integer)().primaryKey({ autoIncrement: true }) };
14
+ case "uuid":
15
+ return {
16
+ id: (0, sqlite_core_1.text)()
17
+ .primaryKey()
18
+ .$defaultFn(() => crypto.randomUUID()),
19
+ };
20
+ }
21
+ }
@@ -0,0 +1 @@
1
+ export { default as id } from "./id.js";
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.id = void 0;
4
+ var id_js_1 = require("./id.js");
5
+ Object.defineProperty(exports, "id", { enumerable: true, get: function () { return id_js_1.default; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@setupless/drizzle",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Small, typed helpers for defining Drizzle ORM schemas",
5
5
  "homepage": "https://github.com/Setupless/drizzle#readme",
6
6
  "bugs": {
@@ -16,21 +16,39 @@
16
16
  ],
17
17
  "type": "module",
18
18
  "sideEffects": false,
19
- "main": "./dist/index.js",
19
+ "main": "./dist/cjs/index.js",
20
20
  "module": "./dist/index.js",
21
21
  "types": "./dist/index.d.ts",
22
22
  "exports": {
23
23
  ".": {
24
- "types": "./dist/index.d.ts",
25
- "import": "./dist/index.js"
24
+ "import": {
25
+ "types": "./dist/index.d.ts",
26
+ "default": "./dist/index.js"
27
+ },
28
+ "require": {
29
+ "types": "./dist/cjs/index.d.ts",
30
+ "default": "./dist/cjs/index.js"
31
+ }
26
32
  },
27
33
  "./pg": {
28
- "types": "./dist/pg/index.d.ts",
29
- "import": "./dist/pg/index.js"
34
+ "import": {
35
+ "types": "./dist/pg/index.d.ts",
36
+ "default": "./dist/pg/index.js"
37
+ },
38
+ "require": {
39
+ "types": "./dist/cjs/pg/index.d.ts",
40
+ "default": "./dist/cjs/pg/index.js"
41
+ }
30
42
  },
31
43
  "./sqlite": {
32
- "types": "./dist/sqlite/index.d.ts",
33
- "import": "./dist/sqlite/index.js"
44
+ "import": {
45
+ "types": "./dist/sqlite/index.d.ts",
46
+ "default": "./dist/sqlite/index.js"
47
+ },
48
+ "require": {
49
+ "types": "./dist/cjs/sqlite/index.d.ts",
50
+ "default": "./dist/cjs/sqlite/index.js"
51
+ }
34
52
  }
35
53
  },
36
54
  "publishConfig": {