@stacksjs/orm 0.64.5 → 0.65.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.
@@ -0,0 +1,8 @@
1
+ export interface OrmDriver {
2
+ find: (id: number) => Promise<any>;
3
+ create: (data: any) => Promise<any>;
4
+ update: (id: number, data: any) => Promise<any>;
5
+ delete: (id: number) => Promise<any>;
6
+ all: () => Promise<any[]>;
7
+ where: (column: string, value: any) => Promise<any[]>;
8
+ }
@@ -0,0 +1,33 @@
1
+ import type { Attributes, Model, ModelElement, RelationConfig } from "@stacksjs/types";
2
+ type ModelPath = string;
3
+ export declare function modelTableName(model: Model | ModelPath): Promise<string>;
4
+ export declare function getModelName(model: Model, modelPath: string): string;
5
+ export declare function getTableName(model: Model, modelPath: string): string;
6
+ export declare function getPivotTableName(formattedModelName: string, modelRelationTable: string): string;
7
+ export declare function hasRelations(obj: any, key: string): boolean;
8
+ export declare function getRelations(model: Model, modelName: string): Promise<RelationConfig[]>;
9
+ export declare function getRelationType(relation: string): string;
10
+ export declare function getRelationCount(relation: string): string;
11
+ export declare function getPivotTables(model: Model, modelPath: string): Promise<{
12
+ table: string;
13
+ firstForeignKey?: string;
14
+ secondForeignKey?: string;
15
+ }[]>;
16
+ export declare function fetchOtherModelRelations(model: Model, modelName?: string): Promise<RelationConfig[]>;
17
+ export declare function getHiddenAttributes(attributes: Attributes | undefined): string[];
18
+ export declare function getFillableAttributes(attributes: Attributes | undefined): string[];
19
+ export declare function writeModelNames(): Promise<void>;
20
+ export declare function writeModelRequest(): Promise<void>;
21
+ export declare function writeOrmActions(apiRoute: string, modelName: string, actionPath?: string): Promise<void>;
22
+ export declare function extractFields(model: Model, modelFile: string): Promise<ModelElement[]>;
23
+ export declare function generateApiRoutes(modelFiles: string[]): Promise<void>;
24
+ export declare function deleteExistingModels(modelStringFile?: string): Promise<void>;
25
+ export declare function deleteExistingOrmActions(modelStringFile?: string): Promise<void>;
26
+ export declare function deleteExistingModelNameTypes(): Promise<void>;
27
+ export declare function deleteExistingModelRequest(modelStringFile?: string): Promise<void>;
28
+ export declare function deleteExistingOrmRoute(): Promise<void>;
29
+ export declare function generateKyselyTypes(): Promise<void>;
30
+ export declare function generateModelString(tableName: string, modelName: string, model: Model, attributes: ModelElement[]): Promise<string>;
31
+ export declare function generateModelFiles(modelStringFile?: string): Promise<void>;
32
+ export declare function extractAttributesFromModel(filePath: string): Promise<Attributes>;
33
+ export {};
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@stacksjs/orm",
3
3
  "type": "module",
4
- "version": "0.64.5",
4
+ "version": "0.65.0",
5
5
  "description": "The Stacks ORM integration",
6
6
  "author": "Chris Breuer",
7
+ "contributors": ["Chris Breuer <chris@stacksjs.org>"],
7
8
  "license": "MIT",
8
9
  "funding": "https://github.com/sponsors/chrisbbreuer",
9
10
  "homepage": "https://github.com/stacksjs/stacks/tree/main/storage/framework/core/orm#readme",
@@ -15,10 +16,7 @@
15
16
  "bugs": {
16
17
  "url": "https://github.com/stacksjs/stacks/issues"
17
18
  },
18
- "keywords": [
19
- "stacks",
20
- "kysely"
21
- ],
19
+ "keywords": ["stacks", "kysely"],
22
20
  "exports": {
23
21
  ".": {
24
22
  "bun": "./src/index.ts",
@@ -31,25 +29,19 @@
31
29
  },
32
30
  "module": "dist/index.js",
33
31
  "types": "dist/index.d.ts",
34
- "contributors": [
35
- "Chris Breuer <chris@stacksjs.org>"
36
- ],
37
- "files": [
38
- "README.md",
39
- "dist",
40
- "src"
41
- ],
32
+ "files": ["README.md", "dist", "src"],
42
33
  "scripts": {
43
- "build": "bun --bun build.ts",
44
- "typecheck": "bun --bun tsc --noEmit",
34
+ "build": "bun build.ts",
35
+ "typecheck": "bun tsc --noEmit",
45
36
  "prepublishOnly": "bun run build"
46
37
  },
47
38
  "dependencies": {
48
- "@stacksjs/config": "latest",
49
- "@stacksjs/query-builder": "latest",
50
- "@stacksjs/types": "latest"
39
+ "@stacksjs/build": "0.64.6",
40
+ "@stacksjs/config": "0.64.6",
41
+ "@stacksjs/query-builder": "0.64.6",
42
+ "@stacksjs/types": "0.64.6"
51
43
  },
52
44
  "devDependencies": {
53
- "@stacksjs/development": "latest"
45
+ "@stacksjs/development": "0.64.6"
54
46
  }
55
47
  }
@@ -1,38 +0,0 @@
1
- import type { ProjectsTable } from '../../../../orm/src/models/Project'
2
- import type { SubscriberEmailsTable } from '../../../../orm/src/models/SubscriberEmail'
3
- import type { PersonalAccessTokensTable } from '../../../../orm/src/models/AccessToken'
4
- import type { TeamsTable } from '../../../../orm/src/models/Team'
5
- import type { SubscribersTable } from '../../../../orm/src/models/Subscriber'
6
- import type { DeploymentsTable } from '../../../../orm/src/models/Deployment'
7
- import type { ReleasesTable } from '../../../../orm/src/models/Release'
8
- import type { UsersTable } from '../../../../orm/src/models/User'
9
- import type { PostsTable } from '../../../../orm/src/models/Post'
10
- import type { Generated } from 'kysely'
11
-
12
- export interface TeamPersonalAccessTokensTable {
13
- id: Generated<number>
14
- team_id: number
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
24
- }
25
- export interface Database {
26
- projects: ProjectsTable
27
- subscriber_emails: SubscriberEmailsTable
28
- personal_access_tokens: PersonalAccessTokensTable
29
- team_personal_access_tokens: UserTeamsTable
30
- team_users: UserTeamsTable
31
- teams: TeamsTable
32
- subscribers: SubscribersTable
33
- deployments: DeploymentsTable
34
- releases: ReleasesTable
35
- user_teams: UserTeamsTable
36
- users: UsersTable
37
- posts: PostsTable
38
- }
package/src/index.ts CHANGED
@@ -12,5 +12,5 @@
12
12
  // })
13
13
  // }
14
14
 
15
+ export * from '../../../orm/src/types'
15
16
  export * from './utils'
16
- export * from './generated/types'