@chromav/sizzler 0.1.3 → 0.1.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,10 +1,11 @@
1
- import { index as sqliteIndex, integer as sqliteInteger, real as sqliteReal, text as sqliteText } from "drizzle-orm/sqlite-core";
1
+ import { index as sqliteIndex, integer as sqliteInteger, real as sqliteReal, text as sqliteText, uniqueIndex as sqliteUniqueIndex } from "drizzle-orm/sqlite-core";
2
2
  type EnumValues = readonly [string, ...string[]];
3
3
  export declare const table: import("drizzle-orm/sqlite-core").SQLiteTableFn<undefined>;
4
4
  export declare const index: typeof sqliteIndex;
5
5
  export declare const integer: typeof sqliteInteger;
6
6
  export declare const real: typeof sqliteReal;
7
7
  export declare const text: typeof sqliteText;
8
+ export declare const uniqueIndex: typeof sqliteUniqueIndex;
8
9
  /**
9
10
  * Creates a boolean column stored as integer (0/1).
10
11
  *
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/columns/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,WAAW,EACpB,OAAO,IAAI,aAAa,EACxB,IAAI,IAAI,UAAU,EAElB,IAAI,IAAI,UAAU,EACnB,MAAM,yBAAyB,CAAC;AAEjC,KAAK,UAAU,GAAG,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;AAGjD,eAAO,MAAM,KAAK,4DAAc,CAAC;AACjC,eAAO,MAAM,KAAK,oBAAc,CAAC;AACjC,eAAO,MAAM,OAAO,sBAAgB,CAAC;AACrC,eAAO,MAAM,IAAI,mBAAa,CAAC;AAC/B,eAAO,MAAM,IAAI,mBAAa,CAAC;AAE/B;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,SAAU,MAAM,2DAAuC,CAAC;AAE5E;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,SAAS,UAAU,QAAQ,MAAM,UAAU,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,6HAGxC,CAAC;AAEtD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,GAAG,MAAM,EAAE,QAAQ,MAAM,4FAA4C,CAAC"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/columns/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,IAAI,WAAW,EACpB,OAAO,IAAI,aAAa,EACxB,IAAI,IAAI,UAAU,EAElB,IAAI,IAAI,UAAU,EAClB,WAAW,IAAI,iBAAiB,EACjC,MAAM,yBAAyB,CAAC;AAEjC,KAAK,UAAU,GAAG,SAAS,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC,CAAC;AAGjD,eAAO,MAAM,KAAK,4DAAc,CAAC;AACjC,eAAO,MAAM,KAAK,oBAAc,CAAC;AACjC,eAAO,MAAM,OAAO,sBAAgB,CAAC;AACrC,eAAO,MAAM,IAAI,mBAAa,CAAC;AAC/B,eAAO,MAAM,IAAI,mBAAa,CAAC;AAC/B,eAAO,MAAM,WAAW,0BAAoB,CAAC;AAE7C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,SAAU,MAAM,2DAAuC,CAAC;AAE5E;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,KAAK,GAAI,CAAC,SAAS,UAAU,QAAQ,MAAM,UAAU,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,6HAGxC,CAAC;AAEtD;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,GAAG,MAAM,EAAE,QAAQ,MAAM,4FAA4C,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export { foreignKey } from "./foreign-key";
2
- export { boolean, enums, index, integer, jsonArray, real, table, text, } from "./helpers";
2
+ export { boolean, enums, index, integer, jsonArray, real, table, text, uniqueIndex, } from "./helpers";
3
3
  export { primaryKey } from "./primary-key";
4
4
  export { createdAt, timestamp, timestamp_ms, updatedAt } from "./timestamps";
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/columns/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,OAAO,EACP,KAAK,EACL,KAAK,EACL,OAAO,EACP,SAAS,EACT,IAAI,EAEJ,KAAK,EACL,IAAI,GACL,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/columns/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,OAAO,EACP,KAAK,EACL,KAAK,EACL,OAAO,EACP,SAAS,EACT,IAAI,EAEJ,KAAK,EACL,IAAI,EACJ,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
package/dist/index.d.ts CHANGED
@@ -27,5 +27,5 @@
27
27
  * });
28
28
  * ```
29
29
  */
30
- export { boolean, createdAt, enums, foreignKey, index, integer, jsonArray, primaryKey, real, table, text, timestamp, timestamp_ms, updatedAt, } from "./columns";
30
+ export { boolean, createdAt, enums, foreignKey, index, integer, jsonArray, primaryKey, real, table, text, timestamp, timestamp_ms, uniqueIndex, updatedAt, } from "./columns";
31
31
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EACL,OAAO,EACP,SAAS,EACT,KAAK,EACL,UAAU,EACV,KAAK,EACL,OAAO,EACP,SAAS,EACT,UAAU,EACV,IAAI,EAEJ,KAAK,EACL,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,SAAS,GACV,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAGH,OAAO,EACL,OAAO,EACP,SAAS,EACT,KAAK,EACL,UAAU,EACV,KAAK,EACL,OAAO,EACP,SAAS,EACT,UAAU,EACV,IAAI,EAEJ,KAAK,EACL,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,WAAW,EACX,SAAS,GACV,MAAM,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -8,13 +8,15 @@ import {
8
8
  integer as sqliteInteger,
9
9
  real as sqliteReal,
10
10
  sqliteTable,
11
- text as sqliteText
11
+ text as sqliteText,
12
+ uniqueIndex as sqliteUniqueIndex
12
13
  } from "drizzle-orm/sqlite-core";
13
14
  var table = sqliteTable;
14
15
  var index = sqliteIndex;
15
16
  var integer2 = sqliteInteger;
16
17
  var real = sqliteReal;
17
18
  var text2 = sqliteText;
19
+ var uniqueIndex = sqliteUniqueIndex;
18
20
  var boolean = (name) => integer2(name, { mode: "boolean" });
19
21
  var enums = (name, values, defaultValue) => text2(name, {
20
22
  enum: values
@@ -47,5 +49,6 @@ export {
47
49
  text2 as text,
48
50
  timestamp,
49
51
  timestamp_ms,
52
+ uniqueIndex,
50
53
  updatedAt
51
54
  };
@@ -1 +1 @@
1
- {"version":3,"file":"wrangler-config.d.ts","sourceRoot":"","sources":["../../../src/node/connection/wrangler-config.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,YAAY,CAAC,EAAE,KAAK,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;CACJ;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,GAAE,MAAsB,GAAG,cAAc,CA4CvF"}
1
+ {"version":3,"file":"wrangler-config.d.ts","sourceRoot":"","sources":["../../../src/node/connection/wrangler-config.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,cAAc;IAC7B,YAAY,CAAC,EAAE,KAAK,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;CACJ;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,GAAE,MAAsB,GAAG,cAAc,CAevF"}
@@ -1 +1 @@
1
- {"version":3,"file":"snapshot.d.ts","sourceRoot":"","sources":["../../../src/node/snapshot/snapshot.ts"],"names":[],"mappings":"AAIA;;;;;;;;GAQG;AAEH,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,UAAU,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAInD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAOvD;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAQpE;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAM/E;AAED,kFAAkF;AAClF,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAO5D;AAED,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,MAAM,CAAC,EAAE,c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AY,EAAE,MAAM,EAAE,OAAO,GAAE,qBAA0B,GAAG,IAAI,CAkBpH;AAED,MAAM,WAAW,sBAAsB;IACrC,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kEAAkE;IAClE,MAAM,CAAC,EAAE,cAAc,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,sBAA2B,GAAG,IAAI,CA+BpH"}
package/dist/node.js CHANGED
@@ -14,30 +14,45 @@ function parseWranglerConfig(projectRoot = process.cwd()) {
14
14
  wranglerPath = join(projectRoot, "wrangler.jsonc");
15
15
  }
16
16
  const content = readFileSync(wranglerPath, "utf8");
17
- const cleanedContent = content.split("\n").map((line) => {
18
- let inString = false;
19
- let escaped = false;
20
- for (let i = 0; i < line.length; i++) {
21
- const char = line[i];
22
- if (escaped) {
23
- escaped = false;
24
- continue;
25
- }
26
- if (char === "\\" && inString) {
27
- escaped = true;
17
+ const cleanedContent = stripJsonComments(content).replaceAll(/,(\s*[}\]])/g, "$1");
18
+ return JSON.parse(cleanedContent);
19
+ }
20
+ function stripJsonComments(content) {
21
+ let out = "";
22
+ let inString = false;
23
+ let i = 0;
24
+ while (i < content.length) {
25
+ const char = content[i];
26
+ const next = content[i + 1];
27
+ if (inString) {
28
+ out += char;
29
+ if (char === "\\") {
30
+ out += next ?? "";
31
+ i += 2;
28
32
  continue;
29
33
  }
30
34
  if (char === '"') {
31
- inString = !inString;
32
- continue;
33
- }
34
- if (!inString && line.substring(i, i + 2) === "//") {
35
- return line.slice(0, i).trim();
35
+ inString = false;
36
36
  }
37
+ i++;
38
+ continue;
37
39
  }
38
- return line;
39
- }).join("\n").replace(/\/\*[\s\S]*?\*\//g, "").replace(/,(\s*[}\]])/g, "$1");
40
- return JSON.parse(cleanedContent);
40
+ if (char === '"') {
41
+ inString = true;
42
+ out += char;
43
+ i++;
44
+ } else if (char === "/" && next === "/") {
45
+ const newline = content.indexOf("\n", i);
46
+ i = newline === -1 ? content.length : newline;
47
+ } else if (char === "/" && next === "*") {
48
+ const close = content.indexOf("*/", i + 2);
49
+ i = close === -1 ? content.length : close + 2;
50
+ } else {
51
+ out += char;
52
+ i++;
53
+ }
54
+ }
55
+ return out;
41
56
  }
42
57
 
43
58
  // src/node/connection/d1-helpers.ts
@@ -241,7 +256,9 @@ function verifySnapshot(snapshotPath, countQuery) {
241
256
  }
242
257
  function removeOldSnapshot(snapshotPath) {
243
258
  const dir = dirname(snapshotPath);
244
- if (!existsSync(dir)) mkdirSync2(dir, { recursive: true });
259
+ if (!existsSync(dir)) {
260
+ mkdirSync2(dir, { recursive: true });
261
+ }
245
262
  if (existsSync(snapshotPath)) {
246
263
  rmSync(snapshotPath, { force: true });
247
264
  removeWalFiles(snapshotPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chromav/sizzler",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Sizzling column factories and utilities for Drizzle ORM with SQLite, D1, and Turso",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",