arkormx 2.9.1 → 2.9.3
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 +18 -24
- package/dist/cli.mjs +461 -337
- package/dist/{index-18M5gEFk.d.cts → index-BFNEyqme.d.cts} +77 -13
- package/dist/{index-CFXreeV7.d.mts → index-EVK8EOKN.d.mts} +77 -13
- package/dist/index.cjs +550 -516
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +550 -516
- package/dist/relationship/index.cjs +1 -1
- package/dist/relationship/index.d.cts +1 -1
- package/dist/relationship/index.d.mts +1 -1
- package/dist/relationship/index.mjs +1 -1
- package/dist/{relationship-DtNgcxxv.mjs → relationship-BD04hN72.mjs} +614 -549
- package/dist/{relationship-BVYP9lU2.cjs → relationship-DhdzLnKH.cjs} +614 -549
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -41,9 +41,9 @@ pnpm add arkormx@next kysely pg
|
|
|
41
41
|
Primary runtime path:
|
|
42
42
|
|
|
43
43
|
```ts
|
|
44
|
-
import { createKyselyAdapter, defineConfig } from 'arkormx'
|
|
45
|
-
import { Kysely, PostgresDialect } from 'kysely'
|
|
46
|
-
import { Pool } from 'pg'
|
|
44
|
+
import { createKyselyAdapter, defineConfig } from 'arkormx'
|
|
45
|
+
import { Kysely, PostgresDialect } from 'kysely'
|
|
46
|
+
import { Pool } from 'pg'
|
|
47
47
|
|
|
48
48
|
export default defineConfig({
|
|
49
49
|
adapter: createKyselyAdapter(
|
|
@@ -55,7 +55,7 @@ export default defineConfig({
|
|
|
55
55
|
}),
|
|
56
56
|
}),
|
|
57
57
|
),
|
|
58
|
-
})
|
|
58
|
+
})
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
Optional compatibility/runtime config for CLI and transaction helpers:
|
|
@@ -63,14 +63,14 @@ Optional compatibility/runtime config for CLI and transaction helpers:
|
|
|
63
63
|
Create `arkormx.config.js` in your project root:
|
|
64
64
|
|
|
65
65
|
```ts
|
|
66
|
-
import { defineConfig } from 'arkormx'
|
|
67
|
-
import { PrismaClient } from '@prisma/client'
|
|
66
|
+
import { defineConfig } from 'arkormx'
|
|
67
|
+
import { PrismaClient } from '@prisma/client'
|
|
68
68
|
|
|
69
|
-
const prisma = new PrismaClient()
|
|
69
|
+
const prisma = new PrismaClient()
|
|
70
70
|
|
|
71
71
|
export default defineConfig({
|
|
72
72
|
prisma: () => prisma,
|
|
73
|
-
})
|
|
73
|
+
})
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
Or run the Arkormˣ CLI command `npx arkorm init` to initialize your project along with configuration.
|
|
@@ -78,14 +78,14 @@ Or run the Arkormˣ CLI command `npx arkorm init` to initialize your project alo
|
|
|
78
78
|
### Define a model
|
|
79
79
|
|
|
80
80
|
```ts
|
|
81
|
-
import { Model } from 'arkormx'
|
|
81
|
+
import { Model } from 'arkormx'
|
|
82
82
|
|
|
83
83
|
type UserAttributes = {
|
|
84
|
-
id: number
|
|
85
|
-
email: string
|
|
86
|
-
name: string
|
|
87
|
-
isActive: boolean
|
|
88
|
-
}
|
|
84
|
+
id: number
|
|
85
|
+
email: string
|
|
86
|
+
name: string
|
|
87
|
+
isActive: boolean
|
|
88
|
+
}
|
|
89
89
|
|
|
90
90
|
export class User extends Model<UserAttributes> {}
|
|
91
91
|
```
|
|
@@ -100,11 +100,7 @@ pnpm add -D prisma
|
|
|
100
100
|
### Run queries
|
|
101
101
|
|
|
102
102
|
```ts
|
|
103
|
-
const users = await User.query()
|
|
104
|
-
.whereKey('isActive', true)
|
|
105
|
-
.latest()
|
|
106
|
-
.limit(10)
|
|
107
|
-
.get();
|
|
103
|
+
const users = await User.query().whereKey('isActive', true).latest().limit(10).get()
|
|
108
104
|
```
|
|
109
105
|
|
|
110
106
|
### Run a transaction
|
|
@@ -115,12 +111,10 @@ await User.transaction(async () => {
|
|
|
115
111
|
name: 'Mia',
|
|
116
112
|
email: 'mia@example.com',
|
|
117
113
|
isActive: 1,
|
|
118
|
-
})
|
|
114
|
+
})
|
|
119
115
|
|
|
120
|
-
await User.query()
|
|
121
|
-
|
|
122
|
-
.updateFrom({ isActive: 1 });
|
|
123
|
-
});
|
|
116
|
+
await User.query().where({ email: 'john@example.com' }).updateFrom({ isActive: 1 })
|
|
117
|
+
})
|
|
124
118
|
```
|
|
125
119
|
|
|
126
120
|
## Next steps
|