suparisma 1.0.0 → 1.0.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.
@@ -1,391 +0,0 @@
1
- // THIS FILE IS AUTO-GENERATED - DO NOT EDIT DIRECTLY
2
- // Edit the generator script instead
3
-
4
- import type { AuditLog } from '@prisma/client';
5
- import type { ModelResult, SuparismaOptions, SearchQuery, SearchState } from '../utils/core';
6
-
7
- /**
8
- * Extended AuditLog type that includes relation fields.
9
- * This represents the complete shape of AuditLog records returned from the database.
10
- */
11
- export interface AuditLogWithRelations {
12
- id: string;
13
- action: string;
14
- details?: string;
15
- createdAt: string;
16
- }
17
-
18
- /**
19
- * Input type for creating a new AuditLog record.
20
- * Fields with default values are optional and will be filled automatically if not provided.
21
- *
22
- * @example
23
- * // Create a minimal auditlog
24
- * auditlog.create({
25
- * // Required fields only
26
- * action: string,
27
- * });
28
- *
29
- * @example
30
- * // Create with optional fields
31
- * auditlog.create({
32
- * // All fields including optional ones
33
- * id?: string,
34
- * action: string,
35
- * details?: string,
36
- * });
37
- */
38
- export interface AuditLogCreateInput {
39
- id?: string;
40
- action: string;
41
- details?: string;
42
- }
43
-
44
- /**
45
- * Input type for updating an existing AuditLog record.
46
- * All fields are optional since you only need to specify the fields you want to change.
47
- *
48
- * @example
49
- * // Update a auditlog's fields
50
- * auditlog.update({
51
- * where: { id: "123" },
52
- * data: {
53
- * id?: string,
54
- * action: string,
55
- * }
56
- * });
57
- */
58
- export type AuditLogUpdateInput = Partial<AuditLogCreateInput>;
59
-
60
- /**
61
- * Filter type for querying AuditLog records.
62
- * You can filter by any field in the model using equality or advanced filter operators.
63
- *
64
- * @example
65
- * // Basic filtering
66
- * auditlog.findMany({
67
- * where: {
68
- * id: "value",
69
- * action: "value"
70
- * }
71
- * });
72
- *
73
- * @example
74
- * // Advanced filtering
75
- * auditlog.findMany({
76
- * where: {
77
- * // Use advanced operators
78
- * id: { contains: "partial" }
79
- * }
80
- * });
81
- */
82
- export type AuditLogWhereInput = Partial<AuditLogWithRelations>;
83
-
84
- /**
85
- * Unique identifier for finding a specific AuditLog record.
86
- * Usually uses the ID field but can be any field marked as @unique in the schema.
87
- *
88
- * @example
89
- * // Find by ID
90
- * auditlog.findUnique({ id: "123" });
91
- *
92
- * @example
93
- * // Delete by ID
94
- * auditlog.delete({ id: "123" });
95
- */
96
- export type AuditLogWhereUniqueInput = {
97
- id: string;
98
- };
99
-
100
- /**
101
- * Sort options for AuditLog queries.
102
- * Specify the field to sort by and the direction ('asc' or 'desc').
103
- *
104
- * @example
105
- * // Sort by creation date, newest first
106
- * auditlog.findMany({
107
- * orderBy: { created_at: 'desc' }
108
- * });
109
- *
110
- * @example
111
- * // Sort alphabetically
112
- * auditlog.findMany({
113
- * orderBy: { name: 'asc' }
114
- * });
115
- */
116
- export type AuditLogOrderByInput = {
117
- [key in keyof AuditLogWithRelations]?: 'asc' | 'desc';
118
- };
119
-
120
- /**
121
- * Result type for operations that return a single AuditLog record.
122
- */
123
- export type AuditLogSingleResult = ModelResult<AuditLogWithRelations>;
124
-
125
- /**
126
- * Result type for operations that return multiple AuditLog records.
127
- */
128
- export type AuditLogManyResult = ModelResult<AuditLogWithRelations[]>;
129
-
130
- /**
131
- * Configuration options for the AuditLog hook.
132
- */
133
- export type UseAuditLogOptions = SuparismaOptions<AuditLogWhereInput, AuditLogOrderByInput>;
134
-
135
- /**
136
- * The complete API for interacting with AuditLog records.
137
- * This interface defines all available operations and state properties.
138
- */
139
- export interface AuditLogHookApi {
140
- /**
141
- * Current array of AuditLog records.
142
- * This is automatically updated when:
143
- * - The initial data is loaded
144
- * - Mutations are performed (create, update, delete)
145
- * - Real-time updates are received from other clients
146
- * - The refresh method is called
147
- *
148
- * @example
149
- * // Render a list of auditlog records
150
- * const { data } = auditlog;
151
- * return (
152
- * <ul>
153
- * {data.map(item => (
154
- * <li key={item.id}>{item.name}</li>
155
- * ))}
156
- * </ul>
157
- * );
158
- */
159
- data: AuditLogWithRelations[];
160
-
161
- /**
162
- * Error object if the last operation failed, null otherwise.
163
- *
164
- * @example
165
- * // Handle potential errors
166
- * const { error } = auditlog;
167
- * if (error) {
168
- * return <div>Error: {error.message}</div>;
169
- * }
170
- */
171
- error: Error | null;
172
-
173
- /**
174
- * Boolean indicating if an operation is in progress.
175
- *
176
- * @example
177
- * // Show loading state
178
- * const { loading } = auditlog;
179
- * if (loading) {
180
- * return <div>Loading...</div>;
181
- * }
182
- */
183
- loading: boolean;
184
-
185
- /**
186
- * The current count of records matching the filter criteria.
187
- * This automatically updates with the data, including realtime updates.
188
- * It always reflects the current length of the data array, respecting any filters.
189
- *
190
- * @example
191
- * // Display the count in the UI
192
- * const { count } = auditlog;
193
- * return <div>Total records: {count}</div>;
194
- */
195
- count: number;
196
-
197
-
198
-
199
- /**
200
- * Find a single AuditLog record by its unique identifier.
201
- *
202
- * @param where - The unique identifier to find the record by
203
- * @returns A promise with the found record or error
204
- *
205
- * @example
206
- * // Find auditlog by ID
207
- * const result = await auditlog.findUnique({ id: "123" });
208
- * if (result.data) {
209
- * console.log("Found auditlog:", result.data);
210
- * }
211
- */
212
- findUnique: (where: AuditLogWhereUniqueInput) => AuditLogSingleResult;
213
-
214
- /**
215
- * Find multiple AuditLog records matching the filter criteria.
216
- * Supports filtering, sorting, and pagination.
217
- *
218
- * @param params - Optional query parameters
219
- * @returns A promise with the matching records or error
220
- *
221
- * @example
222
- * // Get all auditlog records
223
- * const result = await auditlog.findMany();
224
- *
225
- * @example
226
- * // Filter and sort records
227
- * const result = await auditlog.findMany({
228
- * where: { active: true },
229
- * orderBy: { created_at: 'desc' },
230
- * take: 10,
231
- * skip: 0
232
- * });
233
- */
234
- findMany: (params?: {
235
- where?: AuditLogWhereInput;
236
- orderBy?: AuditLogOrderByInput;
237
- take?: number;
238
- skip?: number;
239
- }) => AuditLogManyResult;
240
-
241
- /**
242
- * Find the first AuditLog record matching the filter criteria.
243
- *
244
- * @param params - Optional query parameters
245
- * @returns A promise with the first matching record or error
246
- *
247
- * @example
248
- * // Find the first active auditlog
249
- * const result = await auditlog.findFirst({
250
- * where: { active: true }
251
- * });
252
- *
253
- * @example
254
- * // Find the oldest auditlog
255
- * const result = await auditlog.findFirst({
256
- * orderBy: { created_at: 'asc' }
257
- * });
258
- */
259
- findFirst: (params?: {
260
- where?: AuditLogWhereInput;
261
- orderBy?: AuditLogOrderByInput;
262
- }) => AuditLogSingleResult;
263
-
264
- /**
265
- * Create a new AuditLog record.
266
- * Fields with default values are optional and will use their defaults if not provided.
267
- *
268
- * @param data - The data for the new record
269
- * @returns A promise with the created record or error
270
- *
271
- * @example
272
- * // Create a new auditlog
273
- * const result = await auditlog.create({
274
- * action: "value"
275
- * });
276
- *
277
- * @example
278
- * // Create with custom ID (overriding default)
279
- * const result = await auditlog.create({
280
- * id: "custom-id",
281
- * action: "value"
282
- * });
283
- */
284
- create: (data: AuditLogCreateInput) => AuditLogSingleResult;
285
-
286
- /**
287
- * Update an existing AuditLog record.
288
- *
289
- * @param params - Object with the record identifier and fields to update
290
- * @returns A promise with the updated record or error
291
- *
292
- * @example
293
- * // Update a auditlog's fields
294
- * const result = await auditlog.update({
295
- * where: { id: "123" },
296
- * data: {
297
- * id?: "updated value",
298
- * action: "updated value"
299
- * }
300
- * });
301
- */
302
- update: (params: {
303
- where: AuditLogWhereUniqueInput;
304
- data: AuditLogUpdateInput;
305
- }) => AuditLogSingleResult;
306
-
307
- /**
308
- * Delete a AuditLog record by its unique identifier.
309
- *
310
- * @param where - The unique identifier of the record to delete
311
- * @returns A promise with the deleted record or error
312
- *
313
- * @example
314
- * // Delete a auditlog by ID
315
- * const result = await auditlog.delete({ id: "123" });
316
- * if (result.data) {
317
- * console.log("Deleted auditlog:", result.data);
318
- * }
319
- */
320
- delete: (where: AuditLogWhereUniqueInput) => AuditLogSingleResult;
321
-
322
- /**
323
- * Delete multiple AuditLog records matching the filter criteria.
324
- *
325
- * @param params - Optional filter parameters
326
- * @returns A promise with the count of deleted records or error
327
- *
328
- * @example
329
- * // Delete all inactive auditlog records
330
- * const result = await auditlog.deleteMany({
331
- * where: { active: false }
332
- * });
333
- * console.log(`Deleted ${result.count} records`);
334
- *
335
- * @example
336
- * // Delete all auditlog records (use with caution!)
337
- * const result = await auditlog.deleteMany();
338
- */
339
- deleteMany: (params?: {
340
- where?: AuditLogWhereInput;
341
- }) => Promise<{ count: number; error: Error | null }>;
342
-
343
- /**
344
- * Create a record if it doesn't exist, or update it if it does.
345
- *
346
- * @param params - Object with the identifier, update data, and create data
347
- * @returns A promise with the created or updated record or error
348
- *
349
- * @example
350
- * // Upsert a auditlog by ID
351
- * const result = await auditlog.upsert({
352
- * where: { id: "123" },
353
- * update: { name: "Updated Name" },
354
- * create: {
355
- * id: "123",
356
- * name: "New Name",
357
- * action: "value"
358
- * }
359
- * });
360
- */
361
- upsert: (params: {
362
- where: AuditLogWhereUniqueInput;
363
- update: AuditLogUpdateInput;
364
- create: AuditLogCreateInput;
365
- }) => AuditLogSingleResult;
366
-
367
- /**
368
- * Manually refresh the data with current filter settings.
369
- * Useful after external operations or when realtime is disabled.
370
- *
371
- * @param params - Optional override parameters for this specific refresh
372
- * @returns A promise with the refreshed data or error
373
- *
374
- * @example
375
- * // Refresh with current filter settings
376
- * await auditlog.refresh();
377
- *
378
- * @example
379
- * // Refresh with different filters for this call only
380
- * await auditlog.refresh({
381
- * where: { active: true },
382
- * orderBy: { name: 'asc' }
383
- * });
384
- */
385
- refresh: (params?: {
386
- where?: AuditLogWhereInput;
387
- orderBy?: AuditLogOrderByInput;
388
- take?: number;
389
- skip?: number;
390
- }) => AuditLogManyResult;
391
- }