xansql 1.1.10 → 1.1.12
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/model/types.d.ts +12 -3
- package/package.json +1 -1
package/model/types.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ import XqlRelationOne from '../xt/fields/RelationOne.js';
|
|
|
5
5
|
import { XqlField } from '../xt/types.js';
|
|
6
6
|
import XqlIDField from '../xt/fields/IDField.js';
|
|
7
7
|
import ModelWhere from './ModelWhere.js';
|
|
8
|
-
import { ExecuterResult } from '../core/types.js';
|
|
8
|
+
import { XansqlFileMeta, ExecuterResult } from '../core/types.js';
|
|
9
|
+
import XqlFile from '../xt/fields/File.js';
|
|
9
10
|
|
|
10
11
|
type ModelRowObject<S extends SchemaShape> = {
|
|
11
12
|
[column in keyof S as S[column] extends XqlRelationMany<any> ? never : column]: S[column];
|
|
@@ -149,7 +150,11 @@ type FindArgs<S extends SchemaShape> = {
|
|
|
149
150
|
type FindResultFullSchema<S extends SchemaShape> = {
|
|
150
151
|
[K in keyof S as S[K] extends {
|
|
151
152
|
isRelation: true;
|
|
152
|
-
} ? never : K]:
|
|
153
|
+
} ? never : K]: (S[K] extends XqlFile ? (S[K] extends {
|
|
154
|
+
meta: {
|
|
155
|
+
nullable: true;
|
|
156
|
+
};
|
|
157
|
+
} ? XansqlFileMeta | null : XansqlFileMeta) : Infer<S[K]>);
|
|
153
158
|
};
|
|
154
159
|
type FindResultColumnMap<T extends FindArgs<any>, S extends SchemaShape> = {
|
|
155
160
|
[K in keyof T['select'] & keyof S as T['select'][K] extends any ? (S[K] extends {
|
|
@@ -165,7 +170,11 @@ type FindResultMap<T extends FindArgs<any>, S extends SchemaShape> = {
|
|
|
165
170
|
} ? (T['select'][K] extends FindArgs<any> ? (keyof T['select'][K] extends never ? Normalize<FindResultFullSchema<S[K]['schema']>> : FindResult<T["select"][K], S[K]['schema']>[]) : Normalize<FindResultFullSchema<S[K]['schema']>>[]) : S[K] extends {
|
|
166
171
|
type: "relation-one";
|
|
167
172
|
schema: SchemaShape;
|
|
168
|
-
} ? (T['select'][K] extends FindArgs<any> ? (keyof T['select'][K] extends never ? Normalize<FindResultFullSchema<S[K]['schema']>> : FindResult<T["select"][K], S[K]['schema']>) : Normalize<FindResultFullSchema<S[K]['schema']>>) :
|
|
173
|
+
} ? (T['select'][K] extends FindArgs<any> ? (keyof T['select'][K] extends never ? Normalize<FindResultFullSchema<S[K]['schema']>> : FindResult<T["select"][K], S[K]['schema']>) : Normalize<FindResultFullSchema<S[K]['schema']>>) : (S[K] extends XqlFile ? (S[K] extends {
|
|
174
|
+
meta: {
|
|
175
|
+
nullable: true;
|
|
176
|
+
};
|
|
177
|
+
} ? XansqlFileMeta | null : XansqlFileMeta) : Infer<S[K]>));
|
|
169
178
|
};
|
|
170
179
|
type FindResult<T extends FindArgs<any>, S extends SchemaShape> = Normalize<keyof T['select'] extends never ? Normalize<FindResultFullSchema<S>> : keyof FindResultColumnMap<T, S> extends never ? Normalize<FindResultFullSchema<S>> & Normalize<FindResultMap<T, S>> : Normalize<FindResultMap<T, S>>>;
|
|
171
180
|
type CreateDataValue<F extends XqlField> = F extends XqlRelationOne<any> ? (F extends {
|