suparisma 1.2.2 → 1.2.6
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/README.md +51 -2
- package/dist/generators/coreGenerator.js +200 -15
- package/dist/generators/hookGenerator.js +20 -2
- package/dist/generators/typeGenerator.js +55 -5
- package/dist/index.js +6 -1
- package/package.json +1 -1
- package/tmp/generated-test/hooks/useSuparismaAsset.ts +94 -0
- package/tmp/generated-test/hooks/useSuparismaChapter.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaCourse.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaDeviceSession.ts +94 -0
- package/tmp/generated-test/hooks/useSuparismaEnrollment.ts +92 -0
- package/tmp/generated-test/hooks/useSuparismaLesson.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaLessonPurchase.ts +92 -0
- package/tmp/generated-test/hooks/useSuparismaLessonQuestion.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaPayoutMethod.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaPayoutRequest.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaQuestionOption.ts +92 -0
- package/tmp/generated-test/hooks/useSuparismaSavedPaymentMethod.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaTeacherPayoutInfo.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaThing.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaUser.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaVideoNote.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaWallet.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaWalletTransaction.ts +96 -0
- package/tmp/generated-test/hooks/useSuparismaWatchProgress.ts +96 -0
- package/tmp/generated-test/index.ts +140 -0
- package/tmp/generated-test/types/AssetTypes.ts +485 -0
- package/tmp/generated-test/types/ChapterTypes.ts +488 -0
- package/tmp/generated-test/types/CourseTypes.ts +519 -0
- package/tmp/generated-test/types/DeviceSessionTypes.ts +489 -0
- package/tmp/generated-test/types/EnrollmentTypes.ts +495 -0
- package/tmp/generated-test/types/LessonPurchaseTypes.ts +490 -0
- package/tmp/generated-test/types/LessonQuestionTypes.ts +496 -0
- package/tmp/generated-test/types/LessonTypes.ts +517 -0
- package/tmp/generated-test/types/PayoutMethodTypes.ts +517 -0
- package/tmp/generated-test/types/PayoutRequestTypes.ts +528 -0
- package/tmp/generated-test/types/QuestionOptionTypes.ts +479 -0
- package/tmp/generated-test/types/SavedPaymentMethodTypes.ts +497 -0
- package/tmp/generated-test/types/TeacherPayoutInfoTypes.ts +480 -0
- package/tmp/generated-test/types/ThingTypes.ts +482 -0
- package/tmp/generated-test/types/UserTypes.ts +487 -0
- package/tmp/generated-test/types/VideoNoteTypes.ts +489 -0
- package/tmp/generated-test/types/WalletTransactionTypes.ts +505 -0
- package/tmp/generated-test/types/WalletTypes.ts +480 -0
- package/tmp/generated-test/types/WatchProgressTypes.ts +493 -0
- package/tmp/generated-test/utils/core.ts +2306 -0
- package/tmp/generated-test/utils/supabase-client.ts +17 -0
- package/tmp/generated-test2/hooks/useSuparismaAsset.ts +94 -0
- package/tmp/generated-test2/hooks/useSuparismaChapter.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaCourse.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaDeviceSession.ts +94 -0
- package/tmp/generated-test2/hooks/useSuparismaEnrollment.ts +92 -0
- package/tmp/generated-test2/hooks/useSuparismaLesson.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaLessonPurchase.ts +92 -0
- package/tmp/generated-test2/hooks/useSuparismaLessonQuestion.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaPayoutMethod.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaPayoutRequest.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaQuestionOption.ts +92 -0
- package/tmp/generated-test2/hooks/useSuparismaSavedPaymentMethod.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaTeacherPayoutInfo.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaThing.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaUser.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaVideoNote.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaWallet.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaWalletTransaction.ts +96 -0
- package/tmp/generated-test2/hooks/useSuparismaWatchProgress.ts +96 -0
- package/tmp/generated-test2/index.ts +140 -0
- package/tmp/generated-test2/types/AssetTypes.ts +485 -0
- package/tmp/generated-test2/types/ChapterTypes.ts +488 -0
- package/tmp/generated-test2/types/CourseTypes.ts +522 -0
- package/tmp/generated-test2/types/DeviceSessionTypes.ts +489 -0
- package/tmp/generated-test2/types/EnrollmentTypes.ts +495 -0
- package/tmp/generated-test2/types/LessonPurchaseTypes.ts +490 -0
- package/tmp/generated-test2/types/LessonQuestionTypes.ts +496 -0
- package/tmp/generated-test2/types/LessonTypes.ts +517 -0
- package/tmp/generated-test2/types/PayoutMethodTypes.ts +517 -0
- package/tmp/generated-test2/types/PayoutRequestTypes.ts +528 -0
- package/tmp/generated-test2/types/QuestionOptionTypes.ts +479 -0
- package/tmp/generated-test2/types/SavedPaymentMethodTypes.ts +497 -0
- package/tmp/generated-test2/types/TeacherPayoutInfoTypes.ts +480 -0
- package/tmp/generated-test2/types/ThingTypes.ts +482 -0
- package/tmp/generated-test2/types/UserTypes.ts +490 -0
- package/tmp/generated-test2/types/VideoNoteTypes.ts +489 -0
- package/tmp/generated-test2/types/WalletTransactionTypes.ts +505 -0
- package/tmp/generated-test2/types/WalletTypes.ts +480 -0
- package/tmp/generated-test2/types/WatchProgressTypes.ts +493 -0
- package/tmp/generated-test2/utils/core.ts +2306 -0
- package/tmp/generated-test2/utils/supabase-client.ts +17 -0
- package/tmp/generated-test3/hooks/useSuparismaAsset.ts +94 -0
- package/tmp/generated-test3/hooks/useSuparismaChapter.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaCourse.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaDeviceSession.ts +94 -0
- package/tmp/generated-test3/hooks/useSuparismaEnrollment.ts +94 -0
- package/tmp/generated-test3/hooks/useSuparismaLesson.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaLessonPurchase.ts +94 -0
- package/tmp/generated-test3/hooks/useSuparismaLessonQuestion.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaPayoutMethod.ts +96 -0
- package/tmp/generated-test3/hooks/useSuparismaPayoutRequest.ts +96 -0
- package/tmp/generated-test3/hooks/useSuparismaQuestionOption.ts +94 -0
- package/tmp/generated-test3/hooks/useSuparismaSavedPaymentMethod.ts +96 -0
- package/tmp/generated-test3/hooks/useSuparismaTeacherPayoutInfo.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaThing.ts +96 -0
- package/tmp/generated-test3/hooks/useSuparismaUser.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaVideoNote.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaWallet.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaWalletTransaction.ts +98 -0
- package/tmp/generated-test3/hooks/useSuparismaWatchProgress.ts +98 -0
- package/tmp/generated-test3/index.ts +140 -0
- package/tmp/generated-test3/types/AssetTypes.ts +485 -0
- package/tmp/generated-test3/types/ChapterTypes.ts +488 -0
- package/tmp/generated-test3/types/CourseTypes.ts +522 -0
- package/tmp/generated-test3/types/DeviceSessionTypes.ts +489 -0
- package/tmp/generated-test3/types/EnrollmentTypes.ts +495 -0
- package/tmp/generated-test3/types/LessonPurchaseTypes.ts +490 -0
- package/tmp/generated-test3/types/LessonQuestionTypes.ts +496 -0
- package/tmp/generated-test3/types/LessonTypes.ts +517 -0
- package/tmp/generated-test3/types/PayoutMethodTypes.ts +517 -0
- package/tmp/generated-test3/types/PayoutRequestTypes.ts +528 -0
- package/tmp/generated-test3/types/QuestionOptionTypes.ts +479 -0
- package/tmp/generated-test3/types/SavedPaymentMethodTypes.ts +497 -0
- package/tmp/generated-test3/types/TeacherPayoutInfoTypes.ts +480 -0
- package/tmp/generated-test3/types/ThingTypes.ts +482 -0
- package/tmp/generated-test3/types/UserTypes.ts +490 -0
- package/tmp/generated-test3/types/VideoNoteTypes.ts +489 -0
- package/tmp/generated-test3/types/WalletTransactionTypes.ts +505 -0
- package/tmp/generated-test3/types/WalletTypes.ts +480 -0
- package/tmp/generated-test3/types/WatchProgressTypes.ts +493 -0
- package/tmp/generated-test3/utils/core.ts +2316 -0
- package/tmp/generated-test3/utils/supabase-client.ts +17 -0
- package/tmp/prisma-test-schema-2.prisma +339 -0
- package/tmp/prisma-test-schema.prisma +317 -0
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
// THIS FILE IS AUTO-GENERATED - DO NOT EDIT DIRECTLY
|
|
2
|
+
// Edit the generator script instead
|
|
3
|
+
|
|
4
|
+
import type { Asset } from '@prisma/client';
|
|
5
|
+
import type { ModelResult, SuparismaOptions, SearchQuery, SearchState, FilterOperators, IncludeValue } from '../utils/core';
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Extended Asset type that includes relation fields.
|
|
10
|
+
* This represents the complete shape of Asset records returned from the database.
|
|
11
|
+
*/
|
|
12
|
+
export interface AssetWithRelations {
|
|
13
|
+
id: string;
|
|
14
|
+
title: string;
|
|
15
|
+
type: string;
|
|
16
|
+
url: string;
|
|
17
|
+
lessonId: string;
|
|
18
|
+
createdAt: Date;
|
|
19
|
+
size?: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Input type for creating a new Asset record.
|
|
24
|
+
* Fields with default values are optional and will be filled automatically if not provided.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* // Create a minimal asset
|
|
28
|
+
* asset.create({
|
|
29
|
+
* // Required fields only
|
|
30
|
+
* title: string,
|
|
31
|
+
* type: string,
|
|
32
|
+
* });
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* // Create with optional fields
|
|
36
|
+
* asset.create({
|
|
37
|
+
* // All fields including optional ones
|
|
38
|
+
* id?: string,
|
|
39
|
+
* title: string,
|
|
40
|
+
* type: string,
|
|
41
|
+
* });
|
|
42
|
+
*/
|
|
43
|
+
export interface AssetCreateInput {
|
|
44
|
+
id?: string;
|
|
45
|
+
title: string;
|
|
46
|
+
type: string;
|
|
47
|
+
url: string;
|
|
48
|
+
lessonId: string;
|
|
49
|
+
size?: number;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Input type for updating an existing Asset record.
|
|
54
|
+
* All fields are optional since you only need to specify the fields you want to change.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* // Update a asset's fields
|
|
58
|
+
* asset.update({
|
|
59
|
+
* where: { id: "123" },
|
|
60
|
+
* data: {
|
|
61
|
+
* id?: string,
|
|
62
|
+
* title: string,
|
|
63
|
+
* }
|
|
64
|
+
* });
|
|
65
|
+
*/
|
|
66
|
+
export type AssetUpdateInput = Partial<AssetCreateInput>;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Filter type for querying Asset records.
|
|
70
|
+
* You can filter by any field in the model using equality or advanced filter operators.
|
|
71
|
+
* Supports OR and AND logical operations for complex queries.
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* // Basic filtering
|
|
75
|
+
* asset.findMany({
|
|
76
|
+
* where: {
|
|
77
|
+
* id: "value",
|
|
78
|
+
* title: "value"
|
|
79
|
+
* }
|
|
80
|
+
* });
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* // Advanced filtering
|
|
84
|
+
* asset.findMany({
|
|
85
|
+
* where: {
|
|
86
|
+
* // Use advanced operators
|
|
87
|
+
* id: { contains: "partial" }
|
|
88
|
+
* }
|
|
89
|
+
* });
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* // OR conditions - match ANY condition
|
|
93
|
+
* asset.findMany({
|
|
94
|
+
* where: {
|
|
95
|
+
* OR: [
|
|
96
|
+
* { id: "value1" },
|
|
97
|
+
* { title: { contains: "value2" } }
|
|
98
|
+
* ]
|
|
99
|
+
* }
|
|
100
|
+
* });
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* // AND conditions - match ALL conditions
|
|
104
|
+
* asset.findMany({
|
|
105
|
+
* where: {
|
|
106
|
+
* AND: [
|
|
107
|
+
* { id: "value1" },
|
|
108
|
+
* { title: { gt: 100 } }
|
|
109
|
+
* ]
|
|
110
|
+
* }
|
|
111
|
+
* });
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* // Complex nested logic
|
|
115
|
+
* asset.findMany({
|
|
116
|
+
* where: {
|
|
117
|
+
* active: true, // Regular condition (implicit AND)
|
|
118
|
+
* OR: [
|
|
119
|
+
* { role: "admin" },
|
|
120
|
+
* { role: "moderator" }
|
|
121
|
+
* ]
|
|
122
|
+
* }
|
|
123
|
+
* });
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* // Array filtering (for array fields)
|
|
127
|
+
* asset.findMany({
|
|
128
|
+
* where: {
|
|
129
|
+
* // Array contains specific items
|
|
130
|
+
|
|
131
|
+
* }
|
|
132
|
+
* });
|
|
133
|
+
*/
|
|
134
|
+
export type AssetWhereInput = {
|
|
135
|
+
id?: string | FilterOperators<string>;
|
|
136
|
+
title?: string | FilterOperators<string>;
|
|
137
|
+
type?: string | FilterOperators<string>;
|
|
138
|
+
url?: string | FilterOperators<string>;
|
|
139
|
+
lessonId?: string | FilterOperators<string>;
|
|
140
|
+
createdAt?: Date | FilterOperators<Date>;
|
|
141
|
+
size?: number | FilterOperators<number>;
|
|
142
|
+
} & {
|
|
143
|
+
/** Match ANY of the provided conditions */
|
|
144
|
+
OR?: AssetWhereInput[];
|
|
145
|
+
/** Match ALL of the provided conditions */
|
|
146
|
+
AND?: AssetWhereInput[];
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Unique identifier for finding a specific Asset record.
|
|
151
|
+
* Usually uses the ID field but can be any field marked as @unique in the schema.
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* // Find by ID
|
|
155
|
+
* asset.findUnique({ id: "123" });
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* // Delete by ID
|
|
159
|
+
* asset.delete({ id: "123" });
|
|
160
|
+
*/
|
|
161
|
+
export type AssetWhereUniqueInput = {
|
|
162
|
+
id: string;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Sort options for Asset queries.
|
|
167
|
+
* Specify the field to sort by and the direction ('asc' or 'desc').
|
|
168
|
+
*
|
|
169
|
+
* @example
|
|
170
|
+
* // Sort by creation date, newest first
|
|
171
|
+
* asset.findMany({
|
|
172
|
+
* orderBy: { created_at: 'desc' }
|
|
173
|
+
* });
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* // Sort alphabetically
|
|
177
|
+
* asset.findMany({
|
|
178
|
+
* orderBy: { name: 'asc' }
|
|
179
|
+
* });
|
|
180
|
+
*/
|
|
181
|
+
export type AssetOrderByInput = {
|
|
182
|
+
[key in keyof AssetSelectInput]?: 'asc' | 'desc';
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Select specific scalar fields to return from Asset queries.
|
|
187
|
+
* Relation fields are intentionally excluded; use `include` for relations.
|
|
188
|
+
*/
|
|
189
|
+
export type AssetSelectInput = {
|
|
190
|
+
id?: boolean;
|
|
191
|
+
title?: boolean;
|
|
192
|
+
type?: boolean;
|
|
193
|
+
url?: boolean;
|
|
194
|
+
lessonId?: boolean;
|
|
195
|
+
createdAt?: boolean;
|
|
196
|
+
size?: boolean;
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Include related records when querying Asset.
|
|
201
|
+
* Only real Prisma relation fields are allowed here.
|
|
202
|
+
*/
|
|
203
|
+
export type AssetIncludeInput = {
|
|
204
|
+
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Result type for operations that return a single Asset record.
|
|
209
|
+
*/
|
|
210
|
+
export type AssetSingleResult = ModelResult<AssetWithRelations>;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Result type for operations that return multiple Asset records.
|
|
214
|
+
*/
|
|
215
|
+
export type AssetManyResult = ModelResult<AssetWithRelations[]>;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Configuration options for the Asset hook.
|
|
219
|
+
* Includes where filters, ordering, pagination, and field selection.
|
|
220
|
+
*/
|
|
221
|
+
export type UseAssetOptions = SuparismaOptions<
|
|
222
|
+
AssetWhereInput,
|
|
223
|
+
AssetOrderByInput,
|
|
224
|
+
AssetSelectInput,
|
|
225
|
+
AssetIncludeInput
|
|
226
|
+
>;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* The complete API for interacting with Asset records.
|
|
230
|
+
* This interface defines all available operations and state properties.
|
|
231
|
+
*/
|
|
232
|
+
export interface AssetHookApi {
|
|
233
|
+
/**
|
|
234
|
+
* Current array of Asset records.
|
|
235
|
+
* This is automatically updated when:
|
|
236
|
+
* - The initial data is loaded
|
|
237
|
+
* - Mutations are performed (create, update, delete)
|
|
238
|
+
* - Real-time updates are received from other clients
|
|
239
|
+
* - The refresh method is called
|
|
240
|
+
*
|
|
241
|
+
* @example
|
|
242
|
+
* // Render a list of asset records
|
|
243
|
+
* const { data } = asset;
|
|
244
|
+
* return (
|
|
245
|
+
* <ul>
|
|
246
|
+
* {data.map(item => (
|
|
247
|
+
* <li key={item.id}>{item.name}</li>
|
|
248
|
+
* ))}
|
|
249
|
+
* </ul>
|
|
250
|
+
* );
|
|
251
|
+
*/
|
|
252
|
+
data: AssetWithRelations[];
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Error object if the last operation failed, null otherwise.
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* // Handle potential errors
|
|
259
|
+
* const { error } = asset;
|
|
260
|
+
* if (error) {
|
|
261
|
+
* return <div>Error: {error.message}</div>;
|
|
262
|
+
* }
|
|
263
|
+
*/
|
|
264
|
+
error: Error | null;
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Boolean indicating if an operation is in progress.
|
|
268
|
+
*
|
|
269
|
+
* @example
|
|
270
|
+
* // Show loading state
|
|
271
|
+
* const { loading } = asset;
|
|
272
|
+
* if (loading) {
|
|
273
|
+
* return <div>Loading...</div>;
|
|
274
|
+
* }
|
|
275
|
+
*/
|
|
276
|
+
loading: boolean;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* The current count of records matching the filter criteria.
|
|
280
|
+
* This automatically updates with the data, including realtime updates.
|
|
281
|
+
* It always reflects the current length of the data array, respecting any filters.
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* // Display the count in the UI
|
|
285
|
+
* const { count } = asset;
|
|
286
|
+
* return <div>Total records: {count}</div>;
|
|
287
|
+
*/
|
|
288
|
+
count: number;
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Find a single Asset record by its unique identifier.
|
|
294
|
+
*
|
|
295
|
+
* @param where - The unique identifier to find the record by
|
|
296
|
+
* @returns A promise with the found record or error
|
|
297
|
+
*
|
|
298
|
+
* @example
|
|
299
|
+
* // Find asset by ID
|
|
300
|
+
* const result = await asset.findUnique({ id: "123" });
|
|
301
|
+
* if (result.data) {
|
|
302
|
+
* console.log("Found asset:", result.data);
|
|
303
|
+
* }
|
|
304
|
+
*/
|
|
305
|
+
findUnique: (where: AssetWhereUniqueInput) => AssetSingleResult;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Find multiple Asset records matching the filter criteria.
|
|
309
|
+
* Supports filtering, sorting, and pagination.
|
|
310
|
+
*
|
|
311
|
+
* @param params - Optional query parameters
|
|
312
|
+
* @returns A promise with the matching records or error
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
* // Get all asset records
|
|
316
|
+
* const result = await asset.findMany();
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* // Filter and sort records
|
|
320
|
+
* const result = await asset.findMany({
|
|
321
|
+
* where: { active: true },
|
|
322
|
+
* orderBy: { created_at: 'desc' },
|
|
323
|
+
* take: 10,
|
|
324
|
+
* skip: 0
|
|
325
|
+
* });
|
|
326
|
+
*/
|
|
327
|
+
findMany: (params?: {
|
|
328
|
+
where?: AssetWhereInput;
|
|
329
|
+
orderBy?: AssetOrderByInput;
|
|
330
|
+
take?: number;
|
|
331
|
+
skip?: number;
|
|
332
|
+
}) => AssetManyResult;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Find the first Asset record matching the filter criteria.
|
|
336
|
+
*
|
|
337
|
+
* @param params - Optional query parameters
|
|
338
|
+
* @returns A promise with the first matching record or error
|
|
339
|
+
*
|
|
340
|
+
* @example
|
|
341
|
+
* // Find the first active asset
|
|
342
|
+
* const result = await asset.findFirst({
|
|
343
|
+
* where: { active: true }
|
|
344
|
+
* });
|
|
345
|
+
*
|
|
346
|
+
* @example
|
|
347
|
+
* // Find the oldest asset
|
|
348
|
+
* const result = await asset.findFirst({
|
|
349
|
+
* orderBy: { created_at: 'asc' }
|
|
350
|
+
* });
|
|
351
|
+
*/
|
|
352
|
+
findFirst: (params?: {
|
|
353
|
+
where?: AssetWhereInput;
|
|
354
|
+
orderBy?: AssetOrderByInput;
|
|
355
|
+
}) => AssetSingleResult;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Create a new Asset record.
|
|
359
|
+
* Fields with default values are optional and will use their defaults if not provided.
|
|
360
|
+
*
|
|
361
|
+
* @param data - The data for the new record
|
|
362
|
+
* @returns A promise with the created record or error
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* // Create a new asset
|
|
366
|
+
* const result = await asset.create({
|
|
367
|
+
* title: "value",
|
|
368
|
+
* type: "value"
|
|
369
|
+
* });
|
|
370
|
+
*
|
|
371
|
+
* @example
|
|
372
|
+
* // Create with custom ID (overriding default)
|
|
373
|
+
* const result = await asset.create({
|
|
374
|
+
* id: "custom-id",
|
|
375
|
+
* title: "value"
|
|
376
|
+
* });
|
|
377
|
+
*/
|
|
378
|
+
create: (data: AssetCreateInput) => AssetSingleResult;
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Update an existing Asset record.
|
|
382
|
+
*
|
|
383
|
+
* @param params - Object with the record identifier and fields to update
|
|
384
|
+
* @returns A promise with the updated record or error
|
|
385
|
+
*
|
|
386
|
+
* @example
|
|
387
|
+
* // Update a asset's fields
|
|
388
|
+
* const result = await asset.update({
|
|
389
|
+
* where: { id: "123" },
|
|
390
|
+
* data: {
|
|
391
|
+
* id?: "updated value",
|
|
392
|
+
* title: "updated value"
|
|
393
|
+
* }
|
|
394
|
+
* });
|
|
395
|
+
*/
|
|
396
|
+
update: (params: {
|
|
397
|
+
where: AssetWhereUniqueInput;
|
|
398
|
+
data: AssetUpdateInput;
|
|
399
|
+
}) => AssetSingleResult;
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Delete a Asset record by its unique identifier.
|
|
403
|
+
*
|
|
404
|
+
* @param where - The unique identifier of the record to delete
|
|
405
|
+
* @returns A promise with the deleted record or error
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* // Delete a asset by ID
|
|
409
|
+
* const result = await asset.delete({ id: "123" });
|
|
410
|
+
* if (result.data) {
|
|
411
|
+
* console.log("Deleted asset:", result.data);
|
|
412
|
+
* }
|
|
413
|
+
*/
|
|
414
|
+
delete: (where: AssetWhereUniqueInput) => AssetSingleResult;
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Delete multiple Asset records matching the filter criteria.
|
|
418
|
+
*
|
|
419
|
+
* @param params - Optional filter parameters
|
|
420
|
+
* @returns A promise with the count of deleted records or error
|
|
421
|
+
*
|
|
422
|
+
* @example
|
|
423
|
+
* // Delete all inactive asset records
|
|
424
|
+
* const result = await asset.deleteMany({
|
|
425
|
+
* where: { active: false }
|
|
426
|
+
* });
|
|
427
|
+
* console.log(`Deleted ${result.count} records`);
|
|
428
|
+
*
|
|
429
|
+
* @example
|
|
430
|
+
* // Delete all asset records (use with caution!)
|
|
431
|
+
* const result = await asset.deleteMany();
|
|
432
|
+
*/
|
|
433
|
+
deleteMany: (params?: {
|
|
434
|
+
where?: AssetWhereInput;
|
|
435
|
+
}) => Promise<{ count: number; error: Error | null }>;
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Create a record if it doesn't exist, or update it if it does.
|
|
439
|
+
*
|
|
440
|
+
* @param params - Object with the identifier, update data, and create data
|
|
441
|
+
* @returns A promise with the created or updated record or error
|
|
442
|
+
*
|
|
443
|
+
* @example
|
|
444
|
+
* // Upsert a asset by ID
|
|
445
|
+
* const result = await asset.upsert({
|
|
446
|
+
* where: { id: "123" },
|
|
447
|
+
* update: { name: "Updated Name" },
|
|
448
|
+
* create: {
|
|
449
|
+
* id: "123",
|
|
450
|
+
* name: "New Name",
|
|
451
|
+
* title: "value"
|
|
452
|
+
* }
|
|
453
|
+
* });
|
|
454
|
+
*/
|
|
455
|
+
upsert: (params: {
|
|
456
|
+
where: AssetWhereUniqueInput;
|
|
457
|
+
update: AssetUpdateInput;
|
|
458
|
+
create: AssetCreateInput;
|
|
459
|
+
}) => AssetSingleResult;
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* Manually refresh the data with current filter settings.
|
|
463
|
+
* Useful after external operations or when realtime is disabled.
|
|
464
|
+
*
|
|
465
|
+
* @param params - Optional override parameters for this specific refresh
|
|
466
|
+
* @returns A promise with the refreshed data or error
|
|
467
|
+
*
|
|
468
|
+
* @example
|
|
469
|
+
* // Refresh with current filter settings
|
|
470
|
+
* await asset.refresh();
|
|
471
|
+
*
|
|
472
|
+
* @example
|
|
473
|
+
* // Refresh with different filters for this call only
|
|
474
|
+
* await asset.refresh({
|
|
475
|
+
* where: { active: true },
|
|
476
|
+
* orderBy: { name: 'asc' }
|
|
477
|
+
* });
|
|
478
|
+
*/
|
|
479
|
+
refresh: (params?: {
|
|
480
|
+
where?: AssetWhereInput;
|
|
481
|
+
orderBy?: AssetOrderByInput;
|
|
482
|
+
take?: number;
|
|
483
|
+
skip?: number;
|
|
484
|
+
}) => AssetManyResult;
|
|
485
|
+
}
|