@casekit/orm 0.0.1-alpha.0 → 0.0.1-alpha.2

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.
@@ -12,6 +12,7 @@ runs:
12
12
  with:
13
13
  node-version: 21
14
14
  cache: pnpm
15
+ registry-url: "https://registry.npmjs.org"
15
16
 
16
17
  - name: Install dependencies
17
18
  run: pnpm install
@@ -74,6 +74,31 @@ jobs:
74
74
  - name: Prettier
75
75
  run: pnpm prettier
76
76
 
77
+ publish:
78
+ name: "🔥 Publish"
79
+ needs: [test, typecheck, lint, prettier]
80
+ runs-on: ubuntu-latest
81
+ if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
82
+ steps:
83
+ - uses: actions/checkout@v4
84
+ - name: Set up Git config
85
+ run: |
86
+ git config user.name "$(git log -n 1 --pretty=format:%an)"
87
+ git config user.email "$(git log -n 1 --pretty=format:%ae)"
88
+ - uses: ./.github/actions/ci-setup
89
+ - name: Build
90
+ run: pnpm build
91
+ - name: Version
92
+ run: pnpm version prerelease --preid=alpha
93
+ - name: Publish
94
+ run: pnpm publish
95
+ env:
96
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
97
+ - name: Push
98
+ run: git push
99
+ - name: Push tag
100
+ run: git push --tags
101
+
77
102
  dependabot:
78
103
  name: "🤖 Dependabot"
79
104
  needs: [test, typecheck, lint, prettier]
@@ -1,3 +1,5 @@
1
+ import { ModelName } from "../helpers/ModelName";
2
+ import { LooseModelDefinitions } from "./LooseModelDefinitions";
1
3
  import { LooseRelationDefinition } from "./LooseRelationDefinition";
2
- export type LooseRelationsDefinition = Record<string, LooseRelationDefinition>;
4
+ export type LooseRelationsDefinition<Models extends LooseModelDefinitions, _M extends ModelName<Models>> = Record<string, LooseRelationDefinition>;
3
5
  //# sourceMappingURL=LooseRelationsDefinition.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LooseRelationsDefinition.d.ts","sourceRoot":"","sources":["../../../../src/schema/types/loose/LooseRelationsDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC"}
1
+ {"version":3,"file":"LooseRelationsDefinition.d.ts","sourceRoot":"","sources":["../../../../src/schema/types/loose/LooseRelationsDefinition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,MAAM,MAAM,wBAAwB,CAChC,MAAM,SAAS,qBAAqB,EACpC,EAAE,SAAS,SAAS,CAAC,MAAM,CAAC,IAC5B,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC"}
@@ -2,6 +2,6 @@ import { ModelName } from "../helpers/ModelName";
2
2
  import { LooseModelDefinitions } from "./LooseModelDefinitions";
3
3
  import { LooseRelationsDefinition } from "./LooseRelationsDefinition";
4
4
  export type LooseRelationsDefinitions<Models extends LooseModelDefinitions> = {
5
- [M in ModelName<Models>]?: LooseRelationsDefinition;
5
+ [M in ModelName<Models>]?: LooseRelationsDefinition<Models, M>;
6
6
  };
7
7
  //# sourceMappingURL=LooseRelationsDefinitions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"LooseRelationsDefinitions.d.ts","sourceRoot":"","sources":["../../../../src/schema/types/loose/LooseRelationsDefinitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,MAAM,yBAAyB,CAAC,MAAM,SAAS,qBAAqB,IAAI;KACzE,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,wBAAwB;CACtD,CAAC"}
1
+ {"version":3,"file":"LooseRelationsDefinitions.d.ts","sourceRoot":"","sources":["../../../../src/schema/types/loose/LooseRelationsDefinitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AAEtE,MAAM,MAAM,yBAAyB,CAAC,MAAM,SAAS,qBAAqB,IAAI;KACzE,CAAC,IAAI,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,wBAAwB,CAAC,MAAM,EAAE,CAAC,CAAC;CACjE,CAAC"}
@@ -2,7 +2,7 @@ export declare const post: {
2
2
  readonly columns: {
3
3
  readonly id: {
4
4
  readonly type: "uuid";
5
- readonly default: import("../../../sql").SQLStatement;
5
+ readonly default: import("../../..").SQLStatement;
6
6
  readonly primaryKey: true;
7
7
  };
8
8
  readonly title: {
@@ -2,7 +2,7 @@ export declare const tenant: {
2
2
  readonly columns: {
3
3
  readonly id: {
4
4
  readonly type: "uuid";
5
- readonly default: import("../../../sql").SQLStatement;
5
+ readonly default: import("../../..").SQLStatement;
6
6
  readonly primaryKey: true;
7
7
  };
8
8
  readonly name: {
@@ -10,7 +10,7 @@ export declare const tenant: {
10
10
  };
11
11
  readonly createdAt: {
12
12
  readonly type: "timestamp";
13
- readonly default: import("../../../sql").SQLStatement;
13
+ readonly default: import("../../..").SQLStatement;
14
14
  };
15
15
  };
16
16
  };
@@ -3,7 +3,7 @@ export declare const tenantUser: {
3
3
  readonly columns: {
4
4
  readonly id: {
5
5
  readonly type: "uuid";
6
- readonly default: import("../../../sql").SQLStatement;
6
+ readonly default: import("../../..").SQLStatement;
7
7
  readonly primaryKey: true;
8
8
  };
9
9
  readonly tenantId: {
@@ -22,7 +22,7 @@ export declare const tenantUser: {
22
22
  };
23
23
  readonly createdAt: {
24
24
  readonly type: "timestamp with time zone";
25
- readonly default: import("../../../sql").SQLStatement;
25
+ readonly default: import("../../..").SQLStatement;
26
26
  };
27
27
  readonly deletedAt: {
28
28
  readonly type: "timestamp with time zone";
@@ -3,7 +3,7 @@ export declare const user: {
3
3
  readonly columns: {
4
4
  readonly id: {
5
5
  readonly type: "uuid";
6
- readonly default: import("../../../sql").SQLStatement;
6
+ readonly default: import("../../..").SQLStatement;
7
7
  };
8
8
  readonly username: {
9
9
  readonly zodSchema: z.ZodString;
@@ -28,7 +28,7 @@ export declare const user: {
28
28
  readonly primaryKey: ["id"];
29
29
  readonly uniqueConstraints: [{
30
30
  readonly columns: ["username"];
31
- readonly where: import("../../../sql").SQLStatement;
31
+ readonly where: import("../../..").SQLStatement;
32
32
  }];
33
33
  };
34
34
  //# sourceMappingURL=user.model.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casekit/orm",
3
- "version": "0.0.1-alpha.0",
3
+ "version": "0.0.1-alpha.2",
4
4
  "description": "A simple ORM",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -50,7 +50,7 @@
50
50
  "lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
51
51
  "prettier": "prettier -c src",
52
52
  "prettier:write": "prettier -w src",
53
- "release": "pnpm build && pnpm version --prerelease --preid=snapshot && pnpm publish --access private",
53
+ "release": "pnpm build && pnpm version --prerelease --preid=alpha && pnpm publish",
54
54
  "test": "vitest --typecheck",
55
55
  "test:coverage": "vitest --typecheck --coverage",
56
56
  "typecheck": "tsc --noEmit"
@@ -1,3 +1,8 @@
1
+ import { ModelName } from "../helpers/ModelName";
2
+ import { LooseModelDefinitions } from "./LooseModelDefinitions";
1
3
  import { LooseRelationDefinition } from "./LooseRelationDefinition";
2
4
 
3
- export type LooseRelationsDefinition = Record<string, LooseRelationDefinition>;
5
+ export type LooseRelationsDefinition<
6
+ Models extends LooseModelDefinitions,
7
+ _M extends ModelName<Models>,
8
+ > = Record<string, LooseRelationDefinition>;
@@ -3,5 +3,5 @@ import { LooseModelDefinitions } from "./LooseModelDefinitions";
3
3
  import { LooseRelationsDefinition } from "./LooseRelationsDefinition";
4
4
 
5
5
  export type LooseRelationsDefinitions<Models extends LooseModelDefinitions> = {
6
- [M in ModelName<Models>]?: LooseRelationsDefinition;
6
+ [M in ModelName<Models>]?: LooseRelationsDefinition<Models, M>;
7
7
  };
@@ -1,4 +1,4 @@
1
- import { RelationsDefinition } from "../../../schema/types/strict/RelationsDefinition";
1
+ import { RelationsDefinition } from "../../..";
2
2
  import { Models } from "../models";
3
3
 
4
4
  export const foo = {} as const satisfies RelationsDefinition<Models, "foo">;
@@ -1,4 +1,4 @@
1
- import { ModelDefinition } from "../../../schema/types/strict/ModelDefinition";
1
+ import { ModelDefinition } from "../../..";
2
2
  import { sql } from "../../../sql";
3
3
 
4
4
  export const post = {
@@ -1,4 +1,4 @@
1
- import { RelationsDefinition } from "../../../schema/types/strict/RelationsDefinition";
1
+ import { RelationsDefinition } from "../../..";
2
2
  import { Models } from "../models";
3
3
 
4
4
  export const post = {
@@ -1,4 +1,4 @@
1
- import { ModelDefinition } from "../../../schema/types/strict/ModelDefinition";
1
+ import { ModelDefinition } from "../../..";
2
2
  import { sql } from "../../../sql";
3
3
 
4
4
  export const tenant = {
@@ -1,4 +1,4 @@
1
- import { RelationsDefinition } from "../../../schema/types/strict/RelationsDefinition";
1
+ import { RelationsDefinition } from "../../..";
2
2
  import { Models } from "../models";
3
3
 
4
4
  export const tenant = {
@@ -1,4 +1,4 @@
1
- import { ModelDefinition } from "../../../schema/types/strict/ModelDefinition";
1
+ import { ModelDefinition } from "../../..";
2
2
  import { sql } from "../../../sql";
3
3
 
4
4
  export const tenantUser = {
@@ -1,4 +1,4 @@
1
- import { RelationsDefinition } from "../../../schema/types/strict/RelationsDefinition";
1
+ import { RelationsDefinition } from "../../..";
2
2
  import { Models } from "../models";
3
3
 
4
4
  export const tenantUser = {
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
 
3
- import { ModelDefinition } from "../../../schema/types/strict/ModelDefinition";
3
+ import { ModelDefinition } from "../../..";
4
4
  import { sql } from "../../../sql";
5
5
 
6
6
  export const user = {
@@ -1,4 +1,4 @@
1
- import { RelationsDefinition } from "../../../schema/types/strict/RelationsDefinition";
1
+ import { RelationsDefinition } from "../../..";
2
2
  import { Models } from "../models";
3
3
 
4
4
  export const user = {