@strapi/database 4.14.0-beta.0 → 4.14.1
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/lib/fields/index.js +1 -0
- package/lib/index.d.ts +32 -18
- package/lib/schema/schema.js +1 -0
- package/lib/types/index.js +1 -0
- package/package.json +3 -3
package/lib/fields/index.js
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { Knex } from 'knex';
|
|
|
2
2
|
import { LifecycleProvider } from './lifecycles';
|
|
3
3
|
import { MigrationProvider } from './migrations';
|
|
4
4
|
import { SchemaProvider } from './schema';
|
|
5
|
+
export * as errors from './errors';
|
|
5
6
|
|
|
6
7
|
type ID = number | string;
|
|
7
8
|
|
|
@@ -71,7 +72,7 @@ interface CreateManyParams<T> {
|
|
|
71
72
|
data: T[keyof T][];
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
interface Pagination {
|
|
75
|
+
export interface Pagination {
|
|
75
76
|
page: number;
|
|
76
77
|
pageSize: number;
|
|
77
78
|
pageCount: number;
|
|
@@ -115,33 +116,38 @@ interface EntityManager {
|
|
|
115
116
|
): Promise<T[SK]>;
|
|
116
117
|
}
|
|
117
118
|
|
|
118
|
-
interface QueryFromContentType<T extends keyof AllTypes> {
|
|
119
|
-
findOne(params
|
|
120
|
-
findMany(params
|
|
121
|
-
findWithCount(params
|
|
122
|
-
findPage(params
|
|
119
|
+
export interface QueryFromContentType<T extends keyof AllTypes> {
|
|
120
|
+
findOne(params?: any): Promise<any>;
|
|
121
|
+
findMany(params?: any): Promise<any[]>;
|
|
122
|
+
findWithCount(params?: any): Promise<[any[], number]>;
|
|
123
|
+
findPage(params?: any): Promise<{ results: any[]; pagination: Pagination }>;
|
|
123
124
|
|
|
124
|
-
create(params
|
|
125
|
-
createMany(params
|
|
125
|
+
create(params?: any): Promise<any>;
|
|
126
|
+
createMany(params?: any): Promise<{ count: number; ids: ID[] }>;
|
|
126
127
|
|
|
127
|
-
update(params
|
|
128
|
-
updateMany(params
|
|
128
|
+
update(params?: any): Promise<any>;
|
|
129
|
+
updateMany(params?: any): Promise<{ count: number }>;
|
|
129
130
|
|
|
130
|
-
delete(params
|
|
131
|
-
deleteMany(params
|
|
131
|
+
delete(params?: any): Promise<any>;
|
|
132
|
+
deleteMany(params?: any): Promise<{ count: number }>;
|
|
132
133
|
|
|
133
|
-
count(params
|
|
134
|
+
count(params?: any): Promise<number>;
|
|
134
135
|
|
|
135
136
|
attachRelations(id: ID, data: any): Promise<any>;
|
|
136
137
|
updateRelations(id: ID, data: any): Promise<any>;
|
|
137
138
|
deleteRelations(id: ID): Promise<any>;
|
|
138
139
|
|
|
139
140
|
populate<S extends AllTypes[T]>(entity: S, populate: PopulateParams): Promise<S>;
|
|
140
|
-
|
|
141
|
-
load<S extends AllTypes[T], K extends
|
|
141
|
+
clone<S extends AllTypes[T]>(cloneId: ID, params?: Params<S>): Promise<S>;
|
|
142
|
+
load<S extends AllTypes[T], K extends string>(
|
|
142
143
|
entity: S,
|
|
143
|
-
field: K,
|
|
144
|
-
populate
|
|
144
|
+
field: K | K[],
|
|
145
|
+
populate?: PopulateParams
|
|
146
|
+
): Promise<S[K]>;
|
|
147
|
+
loadPages<S extends AllTypes[T], K extends string>(
|
|
148
|
+
entity: S,
|
|
149
|
+
field: K | K[],
|
|
150
|
+
populate?: PopulateParams
|
|
145
151
|
): Promise<S[K]>;
|
|
146
152
|
}
|
|
147
153
|
|
|
@@ -164,8 +170,15 @@ export interface Database {
|
|
|
164
170
|
queryBuilder: any;
|
|
165
171
|
metadata: any;
|
|
166
172
|
connection: Knex;
|
|
173
|
+
dialect: {
|
|
174
|
+
client: string;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
destroy(): Promise<void>;
|
|
178
|
+
|
|
179
|
+
getSchemaConnection: () => Knex.SchemaBuilder;
|
|
167
180
|
|
|
168
|
-
query<T extends keyof AllTypes>(uid: T)
|
|
181
|
+
query: <T extends keyof AllTypes>(uid: T) => QueryFromContentType<T>;
|
|
169
182
|
transaction(
|
|
170
183
|
cb?: (params: {
|
|
171
184
|
trx: Knex.Transaction;
|
|
@@ -177,6 +190,7 @@ export interface Database {
|
|
|
177
190
|
):
|
|
178
191
|
| Promise<unknown>
|
|
179
192
|
| { get: () => Knex.Transaction; rollback: () => Promise<void>; commit: () => Promise<void> };
|
|
193
|
+
inTransaction: () => boolean;
|
|
180
194
|
}
|
|
181
195
|
export class Database implements Database {
|
|
182
196
|
static transformContentTypes(contentTypes: any[]): ModelConfig[];
|
package/lib/schema/schema.js
CHANGED
package/lib/types/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/database",
|
|
3
|
-
"version": "4.14.
|
|
3
|
+
"version": "4.14.1",
|
|
4
4
|
"description": "Strapi's database layer",
|
|
5
5
|
"homepage": "https://strapi.io",
|
|
6
6
|
"bugs": {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"lint": "run -T eslint ."
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@strapi/utils": "4.14.
|
|
36
|
+
"@strapi/utils": "4.14.1",
|
|
37
37
|
"date-fns": "2.30.0",
|
|
38
38
|
"debug": "4.3.4",
|
|
39
39
|
"fs-extra": "10.0.0",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"node": ">=16.0.0 <=20.x.x",
|
|
47
47
|
"npm": ">=6.0.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "09b6d7a4b46a87142d29665052ca22ced29fa56a"
|
|
50
50
|
}
|