turbine-orm 0.7.1 → 0.9.0
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/README.md +62 -40
- package/dist/cjs/cli/index.js +102 -10
- package/dist/cjs/cli/migrate.js +50 -13
- package/dist/cjs/cli/studio-ui.generated.js +6 -0
- package/dist/cjs/cli/studio.js +641 -0
- package/dist/cjs/client.js +43 -5
- package/dist/cjs/errors.js +43 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/pipeline-submittable.js +403 -0
- package/dist/cjs/pipeline.js +90 -37
- package/dist/cjs/query.js +865 -141
- package/dist/cjs/schema-builder.js +23 -3
- package/dist/cli/index.d.ts +1 -1
- package/dist/cli/index.js +103 -11
- package/dist/cli/migrate.d.ts +16 -0
- package/dist/cli/migrate.js +49 -13
- package/dist/cli/studio-ui.generated.d.ts +2 -0
- package/dist/cli/studio-ui.generated.js +4 -0
- package/dist/cli/studio.d.ts +75 -0
- package/dist/cli/studio.js +627 -0
- package/dist/client.d.ts +32 -3
- package/dist/client.js +44 -6
- package/dist/errors.d.ts +44 -0
- package/dist/errors.js +41 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/pipeline-submittable.d.ts +94 -0
- package/dist/pipeline-submittable.js +397 -0
- package/dist/pipeline.d.ts +37 -9
- package/dist/pipeline.js +89 -37
- package/dist/query.d.ts +142 -6
- package/dist/query.js +863 -141
- package/dist/schema-builder.js +23 -3
- package/package.json +8 -4
package/dist/schema-builder.js
CHANGED
|
@@ -255,15 +255,35 @@ export class ColumnBuilder {
|
|
|
255
255
|
return { ...this._config };
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
|
+
/** Type guard: is `prop` a known nullary ColumnBuilder type method? */
|
|
259
|
+
function isNullaryColumnType(prop) {
|
|
260
|
+
return (prop === 'serial' ||
|
|
261
|
+
prop === 'bigint' ||
|
|
262
|
+
prop === 'integer' ||
|
|
263
|
+
prop === 'smallint' ||
|
|
264
|
+
prop === 'text' ||
|
|
265
|
+
prop === 'boolean' ||
|
|
266
|
+
prop === 'timestamp' ||
|
|
267
|
+
prop === 'date' ||
|
|
268
|
+
prop === 'json' ||
|
|
269
|
+
prop === 'uuid' ||
|
|
270
|
+
prop === 'real' ||
|
|
271
|
+
prop === 'doublePrecision' ||
|
|
272
|
+
prop === 'numeric' ||
|
|
273
|
+
prop === 'bytea');
|
|
274
|
+
}
|
|
258
275
|
/** @deprecated Use defineSchema() with plain objects instead */
|
|
259
276
|
export const column = new Proxy({}, {
|
|
260
277
|
get(_target, prop) {
|
|
261
278
|
if (prop === 'varchar')
|
|
262
279
|
return (length) => new ColumnBuilder().varchar(length);
|
|
280
|
+
if (isNullaryColumnType(prop)) {
|
|
281
|
+
return () => {
|
|
282
|
+
const builder = new ColumnBuilder();
|
|
283
|
+
return builder[prop]();
|
|
284
|
+
};
|
|
285
|
+
}
|
|
263
286
|
return () => {
|
|
264
|
-
const builder = new ColumnBuilder();
|
|
265
|
-
if (typeof builder[prop] === 'function')
|
|
266
|
-
return builder[prop].call(builder);
|
|
267
287
|
throw new Error(`Unknown column type: ${prop}`);
|
|
268
288
|
};
|
|
269
289
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "turbine-orm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Postgres-native TypeScript ORM — runs on Neon, Vercel Postgres, Cloudflare, Supabase. Streaming cursors, typed errors, single-query nested relations. 1 dependency, ~110KB",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
],
|
|
37
37
|
"sideEffects": false,
|
|
38
38
|
"scripts": {
|
|
39
|
+
"prebuild": "node scripts/build-studio-ui.mjs",
|
|
39
40
|
"build": "tsc && tsc --project tsconfig.cjs.json && echo '{\"type\":\"commonjs\"}' > dist/cjs/package.json",
|
|
40
41
|
"dev": "tsc --watch",
|
|
41
42
|
"typecheck": "tsc --noEmit --project tsconfig.test.json",
|
|
@@ -43,13 +44,16 @@
|
|
|
43
44
|
"status": "tsx src/cli/index.ts status",
|
|
44
45
|
"examples": "tsx examples/examples.ts",
|
|
45
46
|
"test": "tsx --test src/test/*.test.ts",
|
|
46
|
-
"test:unit": "tsx --test src/test/schema-builder.test.ts src/test/errors.test.ts src/test/stress.test.ts src/test/migrate.test.ts src/test/update-operators.test.ts src/test/empty-where-guard.test.ts src/test/cli.test.ts src/test/serverless.test.ts src/test/pipeline.test.ts src/test/with-inference.test.ts src/test/operator-validation.test.ts src/test/unlimited-warning.test.ts src/test/generate-relations.test.ts",
|
|
47
|
-
"test:coverage": "c8 tsx --test src/test/schema-builder.test.ts src/test/errors.test.ts src/test/stress.test.ts src/test/migrate.test.ts src/test/update-operators.test.ts src/test/empty-where-guard.test.ts src/test/cli.test.ts src/test/serverless.test.ts src/test/pipeline.test.ts src/test/with-inference.test.ts src/test/operator-validation.test.ts src/test/unlimited-warning.test.ts src/test/generate-relations.test.ts",
|
|
47
|
+
"test:unit": "tsx --test src/test/schema-builder.test.ts src/test/errors.test.ts src/test/stress.test.ts src/test/migrate.test.ts src/test/update-operators.test.ts src/test/empty-where-guard.test.ts src/test/cli.test.ts src/test/serverless.test.ts src/test/pipeline.test.ts src/test/pipeline-submittable.test.ts src/test/with-inference.test.ts src/test/operator-validation.test.ts src/test/unlimited-warning.test.ts src/test/generate-relations.test.ts src/test/stream-and-parse.test.ts src/test/sql-cache.test.ts src/test/studio.test.ts src/test/sql-injection.test.ts src/test/cli-flags.test.ts",
|
|
48
|
+
"test:coverage": "c8 tsx --test src/test/schema-builder.test.ts src/test/errors.test.ts src/test/stress.test.ts src/test/migrate.test.ts src/test/update-operators.test.ts src/test/empty-where-guard.test.ts src/test/cli.test.ts src/test/serverless.test.ts src/test/pipeline.test.ts src/test/pipeline-submittable.test.ts src/test/with-inference.test.ts src/test/operator-validation.test.ts src/test/unlimited-warning.test.ts src/test/generate-relations.test.ts src/test/stream-and-parse.test.ts src/test/sql-cache.test.ts src/test/studio.test.ts src/test/sql-injection.test.ts src/test/cli-flags.test.ts",
|
|
48
49
|
"lint": "biome check src/",
|
|
49
50
|
"lint:fix": "biome check --write src/",
|
|
50
51
|
"format": "biome format --write src/",
|
|
51
52
|
"prepublishOnly": "npm run build && npm run typecheck && npm run lint && npm run test:unit",
|
|
52
|
-
"prepare": "husky"
|
|
53
|
+
"prepare": "husky",
|
|
54
|
+
"site:dev": "cd site && npm run dev",
|
|
55
|
+
"site:build": "cd site && npm run build",
|
|
56
|
+
"site:deploy": "cd site && vercel --prod"
|
|
53
57
|
},
|
|
54
58
|
"engines": {
|
|
55
59
|
"node": ">=18.0.0"
|