@stacksjs/orm 0.75.250 → 0.75.253
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.
|
@@ -1,8 +1 @@
|
|
|
1
1
|
export declare function generateTraitTableInterfaces(): string;
|
|
2
|
-
export declare function generateTraitRequestTypes(): Promise<string>;
|
|
3
|
-
// Generate request types for each trait interface
|
|
4
|
-
export declare const traitInterfaces: TraitInterface[];
|
|
5
|
-
declare interface TraitInterface {
|
|
6
|
-
name: string
|
|
7
|
-
fields: Record<string, string>
|
|
8
|
-
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
function generateMigrationsTableInterface(){return`
|
|
2
2
|
export interface MigrationsTable {
|
|
3
3
|
name: string
|
|
4
4
|
timestamp: string
|
|
@@ -106,30 +106,4 @@ export interface CommentableUpvotesTable {
|
|
|
106
106
|
explain_plan?: string
|
|
107
107
|
optimization_suggestions?: string
|
|
108
108
|
}`}export function generateTraitTableInterfaces(){return[generateMigrationsTableInterface(),generatePasswordResetsTableInterface(),generatePasskeysTableInterface(),generateCommentableInterface(),generateCommentableUpvotesTableInterface(),generateCategorizableTableInterface(),generateTaggableTableInterface(),generateTaggableModelsTableInterface(),generateCategorizableModelsTableInterface(),generateQueryLogsTableInterface()].join(`
|
|
109
|
-
`)}
|
|
110
|
-
|
|
111
|
-
`;typeString+=`interface ValidationRule {
|
|
112
|
-
validate: (value: unknown) => { valid: boolean, errors?: Array<{ message: string }> }
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
`;typeString+=`interface ValidationField {
|
|
116
|
-
rule: ValidationRule
|
|
117
|
-
message: Record<string, string>
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
`;typeString+=`interface CustomAttributes {
|
|
121
|
-
[key: string]: ValidationField
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
`;let importTypesString="";for(let i=0;i<traitInterfaces.length;i++){const trait=traitInterfaces[i];if(!trait)continue;let fieldString="",fieldStringType="";for(const[field,type]of Object.entries(trait.fields))fieldString+=` ${field}: ${type}
|
|
125
|
-
`;fieldStringType+=" get: <T = string>(element: string, defaultValue?: T) => T";const types=`export interface ${trait.name}RequestType extends Request {
|
|
126
|
-
validate(attributes?: CustomAttributes): void
|
|
127
|
-
${fieldStringType}
|
|
128
|
-
all(): RequestData${trait.name}
|
|
129
|
-
${fieldString}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
`;typeString+=`interface RequestData${trait.name} {
|
|
133
|
-
${fieldString}
|
|
134
|
-
}
|
|
135
|
-
`;typeString+=types;importTypesString+=`${trait.name}RequestType`;if(i<traitInterfaces.length-1)importTypesString+=" | "}typeString+=`export type TraitRequest = ${importTypesString}`;const writer=Bun.file(path.frameworkPath("types/traits.d.ts")).writer();writer.write(typeString);await writer.end();return typeString}
|
|
109
|
+
`)}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@stacksjs/orm",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"sideEffects": false,
|
|
5
|
-
"version": "0.75.
|
|
5
|
+
"version": "0.75.253",
|
|
6
6
|
"description": "The Stacks ORM integration",
|
|
7
7
|
"author": "Chris Breuer",
|
|
8
8
|
"contributors": [
|
|
@@ -63,31 +63,31 @@
|
|
|
63
63
|
"prepublishOnly": "bun run build"
|
|
64
64
|
},
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@stacksjs/cache": "0.75.
|
|
67
|
-
"@stacksjs/cli": "0.75.
|
|
68
|
-
"@stacksjs/config": "0.75.
|
|
69
|
-
"@stacksjs/database": "0.75.
|
|
70
|
-
"@stacksjs/env": "0.75.
|
|
71
|
-
"@stacksjs/error-handling": "0.75.
|
|
72
|
-
"@stacksjs/events": "0.75.
|
|
73
|
-
"@stacksjs/logging": "0.75.
|
|
74
|
-
"@stacksjs/model-meta": "0.75.
|
|
75
|
-
"@stacksjs/pagination": "0.75.
|
|
76
|
-
"@stacksjs/path": "0.75.
|
|
77
|
-
"@stacksjs/query-builder": "0.75.
|
|
78
|
-
"@stacksjs/realtime": "0.75.
|
|
79
|
-
"@stacksjs/router": "0.75.
|
|
80
|
-
"@stacksjs/storage": "0.75.
|
|
81
|
-
"@stacksjs/strings": "0.75.
|
|
66
|
+
"@stacksjs/cache": "0.75.253",
|
|
67
|
+
"@stacksjs/cli": "0.75.253",
|
|
68
|
+
"@stacksjs/config": "0.75.253",
|
|
69
|
+
"@stacksjs/database": "0.75.253",
|
|
70
|
+
"@stacksjs/env": "0.75.253",
|
|
71
|
+
"@stacksjs/error-handling": "0.75.253",
|
|
72
|
+
"@stacksjs/events": "0.75.253",
|
|
73
|
+
"@stacksjs/logging": "0.75.253",
|
|
74
|
+
"@stacksjs/model-meta": "0.75.253",
|
|
75
|
+
"@stacksjs/pagination": "0.75.253",
|
|
76
|
+
"@stacksjs/path": "0.75.253",
|
|
77
|
+
"@stacksjs/query-builder": "0.75.253",
|
|
78
|
+
"@stacksjs/realtime": "0.75.253",
|
|
79
|
+
"@stacksjs/router": "0.75.253",
|
|
80
|
+
"@stacksjs/storage": "0.75.253",
|
|
81
|
+
"@stacksjs/strings": "0.75.253",
|
|
82
82
|
"@stacksjs/ts-validation": "^0.5.6",
|
|
83
|
-
"@stacksjs/validation": "0.75.
|
|
83
|
+
"@stacksjs/validation": "0.75.253",
|
|
84
84
|
"bun-query-builder": "^0.3.8"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
|
-
"@stacksjs/auth": "0.75.
|
|
88
|
-
"@stacksjs/payments": "0.75.
|
|
89
|
-
"@stacksjs/queue": "0.75.
|
|
90
|
-
"@stacksjs/search-engine": "0.75.
|
|
87
|
+
"@stacksjs/auth": "0.75.253",
|
|
88
|
+
"@stacksjs/payments": "0.75.253",
|
|
89
|
+
"@stacksjs/queue": "0.75.253",
|
|
90
|
+
"@stacksjs/search-engine": "0.75.253",
|
|
91
91
|
"stripe": "23.0.0"
|
|
92
92
|
},
|
|
93
93
|
"peerDependenciesMeta": {
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
}
|
|
109
109
|
},
|
|
110
110
|
"devDependencies": {
|
|
111
|
-
"@stacksjs/types": "0.75.
|
|
111
|
+
"@stacksjs/types": "0.75.253",
|
|
112
112
|
"better-dx": "^0.2.24",
|
|
113
113
|
"stripe": "23.0.0"
|
|
114
114
|
}
|