@stacksjs/orm 0.61.24 → 0.62.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/dist/index.js +99012 -10763
- package/package.json +1 -1
- package/src/generated/types.ts +16 -4
- package/src/utils.ts +7 -9
package/package.json
CHANGED
package/src/generated/types.ts
CHANGED
|
@@ -1,26 +1,38 @@
|
|
|
1
1
|
import type { ProjectsTable } from '../../../../orm/src/models/Project'
|
|
2
2
|
import type { SubscriberEmailsTable } from '../../../../orm/src/models/SubscriberEmail'
|
|
3
|
-
import type {
|
|
3
|
+
import type { PersonalAccessTokensTable } from '../../../../orm/src/models/AccessToken'
|
|
4
4
|
import type { TeamsTable } from '../../../../orm/src/models/Team'
|
|
5
5
|
import type { SubscribersTable } from '../../../../orm/src/models/Subscriber'
|
|
6
6
|
import type { DeploymentsTable } from '../../../../orm/src/models/Deployment'
|
|
7
|
+
import type { ReleasesTable } from '../../../../orm/src/models/Release'
|
|
7
8
|
import type { UsersTable } from '../../../../orm/src/models/User'
|
|
8
9
|
import type { PostsTable } from '../../../../orm/src/models/Post'
|
|
9
10
|
import type { Generated } from 'kysely'
|
|
10
11
|
|
|
11
|
-
export interface
|
|
12
|
+
export interface TeamPersonalAccessTokensTable {
|
|
12
13
|
id: Generated<number>
|
|
13
14
|
team_id: number
|
|
14
15
|
accesstoken_id: number
|
|
16
|
+
}export interface TeamUsersTable {
|
|
17
|
+
id: Generated<number>
|
|
18
|
+
team_id: number
|
|
19
|
+
user_id: number
|
|
20
|
+
}export interface UserTeamsTable {
|
|
21
|
+
id: Generated<number>
|
|
22
|
+
user_id: number
|
|
23
|
+
team_id: number
|
|
15
24
|
}
|
|
16
25
|
export interface Database {
|
|
17
26
|
projects: ProjectsTable
|
|
18
27
|
subscriber_emails: SubscriberEmailsTable
|
|
19
|
-
|
|
20
|
-
|
|
28
|
+
personal_access_tokens: PersonalAccessTokensTable
|
|
29
|
+
team_personal_access_tokens: UserTeamsTable
|
|
30
|
+
team_users: UserTeamsTable
|
|
21
31
|
teams: TeamsTable
|
|
22
32
|
subscribers: SubscribersTable
|
|
23
33
|
deployments: DeploymentsTable
|
|
34
|
+
releases: ReleasesTable
|
|
35
|
+
user_teams: UserTeamsTable
|
|
24
36
|
users: UsersTable
|
|
25
37
|
posts: PostsTable
|
|
26
38
|
}
|
package/src/utils.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { generator, parser, traverse } from '@stacksjs/build'
|
|
2
|
-
import { fs } from '@stacksjs/storage'
|
|
3
2
|
import { path } from '@stacksjs/path'
|
|
3
|
+
import { fs } from '@stacksjs/storage'
|
|
4
4
|
import { plural, snakeCase } from '@stacksjs/strings'
|
|
5
5
|
import type { Attributes } from '@stacksjs/types'
|
|
6
6
|
import type { Model } from '@stacksjs/types'
|
|
@@ -16,19 +16,17 @@ export async function modelTableName(model: Model | ModelPath): Promise<string>
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export function getModelName(model: Model, modelPath: string): string {
|
|
19
|
-
if (model.name)
|
|
20
|
-
return model.name
|
|
19
|
+
if (model.name) return model.name
|
|
21
20
|
|
|
22
|
-
const baseName =
|
|
21
|
+
const baseName = path.basename(modelPath)
|
|
23
22
|
|
|
24
|
-
return baseName.replace(/\.ts$/, '')
|
|
23
|
+
return baseName.replace(/\.ts$/, '')
|
|
25
24
|
}
|
|
26
25
|
|
|
27
26
|
export function getTableName(model: Model, modelPath: string): string {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return snakeCase(plural(getModelName(model, modelPath)))
|
|
27
|
+
if (model.table) return model.table
|
|
28
|
+
|
|
29
|
+
return snakeCase(plural(getModelName(model, modelPath)))
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
export async function extractFieldsFromModel(filePath: string) {
|