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.
Files changed (131) hide show
  1. package/README.md +51 -2
  2. package/dist/generators/coreGenerator.js +200 -15
  3. package/dist/generators/hookGenerator.js +20 -2
  4. package/dist/generators/typeGenerator.js +55 -5
  5. package/dist/index.js +6 -1
  6. package/package.json +1 -1
  7. package/tmp/generated-test/hooks/useSuparismaAsset.ts +94 -0
  8. package/tmp/generated-test/hooks/useSuparismaChapter.ts +96 -0
  9. package/tmp/generated-test/hooks/useSuparismaCourse.ts +96 -0
  10. package/tmp/generated-test/hooks/useSuparismaDeviceSession.ts +94 -0
  11. package/tmp/generated-test/hooks/useSuparismaEnrollment.ts +92 -0
  12. package/tmp/generated-test/hooks/useSuparismaLesson.ts +96 -0
  13. package/tmp/generated-test/hooks/useSuparismaLessonPurchase.ts +92 -0
  14. package/tmp/generated-test/hooks/useSuparismaLessonQuestion.ts +96 -0
  15. package/tmp/generated-test/hooks/useSuparismaPayoutMethod.ts +96 -0
  16. package/tmp/generated-test/hooks/useSuparismaPayoutRequest.ts +96 -0
  17. package/tmp/generated-test/hooks/useSuparismaQuestionOption.ts +92 -0
  18. package/tmp/generated-test/hooks/useSuparismaSavedPaymentMethod.ts +96 -0
  19. package/tmp/generated-test/hooks/useSuparismaTeacherPayoutInfo.ts +96 -0
  20. package/tmp/generated-test/hooks/useSuparismaThing.ts +96 -0
  21. package/tmp/generated-test/hooks/useSuparismaUser.ts +96 -0
  22. package/tmp/generated-test/hooks/useSuparismaVideoNote.ts +96 -0
  23. package/tmp/generated-test/hooks/useSuparismaWallet.ts +96 -0
  24. package/tmp/generated-test/hooks/useSuparismaWalletTransaction.ts +96 -0
  25. package/tmp/generated-test/hooks/useSuparismaWatchProgress.ts +96 -0
  26. package/tmp/generated-test/index.ts +140 -0
  27. package/tmp/generated-test/types/AssetTypes.ts +485 -0
  28. package/tmp/generated-test/types/ChapterTypes.ts +488 -0
  29. package/tmp/generated-test/types/CourseTypes.ts +519 -0
  30. package/tmp/generated-test/types/DeviceSessionTypes.ts +489 -0
  31. package/tmp/generated-test/types/EnrollmentTypes.ts +495 -0
  32. package/tmp/generated-test/types/LessonPurchaseTypes.ts +490 -0
  33. package/tmp/generated-test/types/LessonQuestionTypes.ts +496 -0
  34. package/tmp/generated-test/types/LessonTypes.ts +517 -0
  35. package/tmp/generated-test/types/PayoutMethodTypes.ts +517 -0
  36. package/tmp/generated-test/types/PayoutRequestTypes.ts +528 -0
  37. package/tmp/generated-test/types/QuestionOptionTypes.ts +479 -0
  38. package/tmp/generated-test/types/SavedPaymentMethodTypes.ts +497 -0
  39. package/tmp/generated-test/types/TeacherPayoutInfoTypes.ts +480 -0
  40. package/tmp/generated-test/types/ThingTypes.ts +482 -0
  41. package/tmp/generated-test/types/UserTypes.ts +487 -0
  42. package/tmp/generated-test/types/VideoNoteTypes.ts +489 -0
  43. package/tmp/generated-test/types/WalletTransactionTypes.ts +505 -0
  44. package/tmp/generated-test/types/WalletTypes.ts +480 -0
  45. package/tmp/generated-test/types/WatchProgressTypes.ts +493 -0
  46. package/tmp/generated-test/utils/core.ts +2306 -0
  47. package/tmp/generated-test/utils/supabase-client.ts +17 -0
  48. package/tmp/generated-test2/hooks/useSuparismaAsset.ts +94 -0
  49. package/tmp/generated-test2/hooks/useSuparismaChapter.ts +96 -0
  50. package/tmp/generated-test2/hooks/useSuparismaCourse.ts +96 -0
  51. package/tmp/generated-test2/hooks/useSuparismaDeviceSession.ts +94 -0
  52. package/tmp/generated-test2/hooks/useSuparismaEnrollment.ts +92 -0
  53. package/tmp/generated-test2/hooks/useSuparismaLesson.ts +96 -0
  54. package/tmp/generated-test2/hooks/useSuparismaLessonPurchase.ts +92 -0
  55. package/tmp/generated-test2/hooks/useSuparismaLessonQuestion.ts +96 -0
  56. package/tmp/generated-test2/hooks/useSuparismaPayoutMethod.ts +96 -0
  57. package/tmp/generated-test2/hooks/useSuparismaPayoutRequest.ts +96 -0
  58. package/tmp/generated-test2/hooks/useSuparismaQuestionOption.ts +92 -0
  59. package/tmp/generated-test2/hooks/useSuparismaSavedPaymentMethod.ts +96 -0
  60. package/tmp/generated-test2/hooks/useSuparismaTeacherPayoutInfo.ts +96 -0
  61. package/tmp/generated-test2/hooks/useSuparismaThing.ts +96 -0
  62. package/tmp/generated-test2/hooks/useSuparismaUser.ts +96 -0
  63. package/tmp/generated-test2/hooks/useSuparismaVideoNote.ts +96 -0
  64. package/tmp/generated-test2/hooks/useSuparismaWallet.ts +96 -0
  65. package/tmp/generated-test2/hooks/useSuparismaWalletTransaction.ts +96 -0
  66. package/tmp/generated-test2/hooks/useSuparismaWatchProgress.ts +96 -0
  67. package/tmp/generated-test2/index.ts +140 -0
  68. package/tmp/generated-test2/types/AssetTypes.ts +485 -0
  69. package/tmp/generated-test2/types/ChapterTypes.ts +488 -0
  70. package/tmp/generated-test2/types/CourseTypes.ts +522 -0
  71. package/tmp/generated-test2/types/DeviceSessionTypes.ts +489 -0
  72. package/tmp/generated-test2/types/EnrollmentTypes.ts +495 -0
  73. package/tmp/generated-test2/types/LessonPurchaseTypes.ts +490 -0
  74. package/tmp/generated-test2/types/LessonQuestionTypes.ts +496 -0
  75. package/tmp/generated-test2/types/LessonTypes.ts +517 -0
  76. package/tmp/generated-test2/types/PayoutMethodTypes.ts +517 -0
  77. package/tmp/generated-test2/types/PayoutRequestTypes.ts +528 -0
  78. package/tmp/generated-test2/types/QuestionOptionTypes.ts +479 -0
  79. package/tmp/generated-test2/types/SavedPaymentMethodTypes.ts +497 -0
  80. package/tmp/generated-test2/types/TeacherPayoutInfoTypes.ts +480 -0
  81. package/tmp/generated-test2/types/ThingTypes.ts +482 -0
  82. package/tmp/generated-test2/types/UserTypes.ts +490 -0
  83. package/tmp/generated-test2/types/VideoNoteTypes.ts +489 -0
  84. package/tmp/generated-test2/types/WalletTransactionTypes.ts +505 -0
  85. package/tmp/generated-test2/types/WalletTypes.ts +480 -0
  86. package/tmp/generated-test2/types/WatchProgressTypes.ts +493 -0
  87. package/tmp/generated-test2/utils/core.ts +2306 -0
  88. package/tmp/generated-test2/utils/supabase-client.ts +17 -0
  89. package/tmp/generated-test3/hooks/useSuparismaAsset.ts +94 -0
  90. package/tmp/generated-test3/hooks/useSuparismaChapter.ts +98 -0
  91. package/tmp/generated-test3/hooks/useSuparismaCourse.ts +98 -0
  92. package/tmp/generated-test3/hooks/useSuparismaDeviceSession.ts +94 -0
  93. package/tmp/generated-test3/hooks/useSuparismaEnrollment.ts +94 -0
  94. package/tmp/generated-test3/hooks/useSuparismaLesson.ts +98 -0
  95. package/tmp/generated-test3/hooks/useSuparismaLessonPurchase.ts +94 -0
  96. package/tmp/generated-test3/hooks/useSuparismaLessonQuestion.ts +98 -0
  97. package/tmp/generated-test3/hooks/useSuparismaPayoutMethod.ts +96 -0
  98. package/tmp/generated-test3/hooks/useSuparismaPayoutRequest.ts +96 -0
  99. package/tmp/generated-test3/hooks/useSuparismaQuestionOption.ts +94 -0
  100. package/tmp/generated-test3/hooks/useSuparismaSavedPaymentMethod.ts +96 -0
  101. package/tmp/generated-test3/hooks/useSuparismaTeacherPayoutInfo.ts +98 -0
  102. package/tmp/generated-test3/hooks/useSuparismaThing.ts +96 -0
  103. package/tmp/generated-test3/hooks/useSuparismaUser.ts +98 -0
  104. package/tmp/generated-test3/hooks/useSuparismaVideoNote.ts +98 -0
  105. package/tmp/generated-test3/hooks/useSuparismaWallet.ts +98 -0
  106. package/tmp/generated-test3/hooks/useSuparismaWalletTransaction.ts +98 -0
  107. package/tmp/generated-test3/hooks/useSuparismaWatchProgress.ts +98 -0
  108. package/tmp/generated-test3/index.ts +140 -0
  109. package/tmp/generated-test3/types/AssetTypes.ts +485 -0
  110. package/tmp/generated-test3/types/ChapterTypes.ts +488 -0
  111. package/tmp/generated-test3/types/CourseTypes.ts +522 -0
  112. package/tmp/generated-test3/types/DeviceSessionTypes.ts +489 -0
  113. package/tmp/generated-test3/types/EnrollmentTypes.ts +495 -0
  114. package/tmp/generated-test3/types/LessonPurchaseTypes.ts +490 -0
  115. package/tmp/generated-test3/types/LessonQuestionTypes.ts +496 -0
  116. package/tmp/generated-test3/types/LessonTypes.ts +517 -0
  117. package/tmp/generated-test3/types/PayoutMethodTypes.ts +517 -0
  118. package/tmp/generated-test3/types/PayoutRequestTypes.ts +528 -0
  119. package/tmp/generated-test3/types/QuestionOptionTypes.ts +479 -0
  120. package/tmp/generated-test3/types/SavedPaymentMethodTypes.ts +497 -0
  121. package/tmp/generated-test3/types/TeacherPayoutInfoTypes.ts +480 -0
  122. package/tmp/generated-test3/types/ThingTypes.ts +482 -0
  123. package/tmp/generated-test3/types/UserTypes.ts +490 -0
  124. package/tmp/generated-test3/types/VideoNoteTypes.ts +489 -0
  125. package/tmp/generated-test3/types/WalletTransactionTypes.ts +505 -0
  126. package/tmp/generated-test3/types/WalletTypes.ts +480 -0
  127. package/tmp/generated-test3/types/WatchProgressTypes.ts +493 -0
  128. package/tmp/generated-test3/utils/core.ts +2316 -0
  129. package/tmp/generated-test3/utils/supabase-client.ts +17 -0
  130. package/tmp/prisma-test-schema-2.prisma +339 -0
  131. package/tmp/prisma-test-schema.prisma +317 -0
@@ -0,0 +1,17 @@
1
+ // THIS FILE IS AUTO-GENERATED - DO NOT EDIT DIRECTLY
2
+ // Platform: Web (Next.js, Remix, etc.)
3
+ import { createClient } from '@supabase/supabase-js';
4
+
5
+ // For Next.js, use NEXT_PUBLIC_ prefix
6
+ // For other frameworks, adjust the environment variable names as needed
7
+ const SUPABASE_URL = process.env.NEXT_PUBLIC_SUPABASE_URL || process.env.SUPABASE_URL || '';
8
+ const SUPABASE_ANON_KEY = process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY || process.env.SUPABASE_ANON_KEY || '';
9
+
10
+ if (!SUPABASE_URL || !SUPABASE_ANON_KEY) {
11
+ console.warn(
12
+ '[Suparisma] Supabase credentials not found. Please set NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY ' +
13
+ '(or SUPABASE_URL and SUPABASE_ANON_KEY) in your environment variables.'
14
+ );
15
+ }
16
+
17
+ export const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
@@ -0,0 +1,94 @@
1
+ // THIS FILE IS AUTO-GENERATED - DO NOT EDIT DIRECTLY
2
+ // Edit the generator script instead: scripts/generate-realtime-hooks.ts
3
+
4
+ // Corrected import for core hook factory
5
+ import { createSuparismaHook } from '../utils/core';
6
+ import type {
7
+ AssetWithRelations,
8
+ AssetCreateInput,
9
+ AssetUpdateInput,
10
+ AssetWhereInput,
11
+ AssetWhereUniqueInput,
12
+ AssetOrderByInput,
13
+ AssetSelectInput,
14
+ AssetIncludeInput,
15
+ AssetHookApi,
16
+ UseAssetOptions
17
+ } from '../types/AssetTypes';
18
+
19
+ /**
20
+ * A Prisma-like hook for interacting with Asset records with real-time capabilities.
21
+ *
22
+ * This hook provides CRUD operations, real-time updates, and search functionality.
23
+ *
24
+ * @param options - Optional configuration options for the hook
25
+ * @returns An object with data state and methods for interacting with Asset records
26
+ *
27
+ * @example
28
+ * // Basic usage - get all Asset records with realtime updates
29
+ * const asset = useSuparismaAsset();
30
+ * const { data, loading, error } = asset;
31
+ *
32
+ * @example
33
+ * // With filtering and ordering
34
+ * const asset = useSuparismaAsset({
35
+ * where: { active: true },
36
+ * orderBy: { createdAt: 'desc' }, // Note: Using actual Prisma field name
37
+ * limit: 10
38
+ * });
39
+ *
40
+ * @example
41
+ * // Create a new record
42
+ * const result = await asset.create({
43
+ * name: "Example Name",
44
+ * // other fields...
45
+ * });
46
+ *
47
+ * @example
48
+ * // Update a record
49
+ * const result = await asset.update({
50
+ * where: { id: "123" },
51
+ * data: { name: "Updated Name" }
52
+ * });
53
+ *
54
+ * @example
55
+ * // Delete a record
56
+ * const result = await asset.delete({ id: "123" });
57
+ *
58
+ * @example
59
+ * // Find records with specific criteria
60
+ * const result = await asset.findMany({
61
+ * where: { // filters },
62
+ * orderBy: { // ordering },
63
+ * take: 20 // limit
64
+ * });
65
+ *
66
+ * @example
67
+ * // Select specific fields only
68
+ * const asset = useSuparismaAsset({
69
+ * select: { id: true, name: true }
70
+ * });
71
+ *
72
+ * @example
73
+ * // Include related records
74
+ * const asset = useSuparismaAsset({
75
+ * include: { relatedModel: true }
76
+ * });
77
+ */
78
+ export const useSuparismaAsset = createSuparismaHook<
79
+ AssetWithRelations,
80
+ AssetWithRelations,
81
+ AssetCreateInput,
82
+ AssetUpdateInput,
83
+ AssetWhereInput,
84
+ AssetWhereUniqueInput,
85
+ AssetOrderByInput
86
+ >({
87
+ tableName: 'Asset',
88
+ hasCreatedAt: true,
89
+ hasUpdatedAt: false,
90
+ // Default values from schema
91
+ defaultValues: {"id":"uuid(","createdAt":"now("},
92
+ // Field name for createdAt from Prisma schema
93
+ createdAtField: "createdAt"
94
+ }) as unknown as (options?: UseAssetOptions) => AssetHookApi;
@@ -0,0 +1,98 @@
1
+ // THIS FILE IS AUTO-GENERATED - DO NOT EDIT DIRECTLY
2
+ // Edit the generator script instead: scripts/generate-realtime-hooks.ts
3
+
4
+ // Corrected import for core hook factory
5
+ import { createSuparismaHook } from '../utils/core';
6
+ import type {
7
+ ChapterWithRelations,
8
+ ChapterCreateInput,
9
+ ChapterUpdateInput,
10
+ ChapterWhereInput,
11
+ ChapterWhereUniqueInput,
12
+ ChapterOrderByInput,
13
+ ChapterSelectInput,
14
+ ChapterIncludeInput,
15
+ ChapterHookApi,
16
+ UseChapterOptions
17
+ } from '../types/ChapterTypes';
18
+
19
+ /**
20
+ * A Prisma-like hook for interacting with Chapter records with real-time capabilities.
21
+ *
22
+ * This hook provides CRUD operations, real-time updates, and search functionality.
23
+ *
24
+ * @param options - Optional configuration options for the hook
25
+ * @returns An object with data state and methods for interacting with Chapter records
26
+ *
27
+ * @example
28
+ * // Basic usage - get all Chapter records with realtime updates
29
+ * const chapter = useSuparismaChapter();
30
+ * const { data, loading, error } = chapter;
31
+ *
32
+ * @example
33
+ * // With filtering and ordering
34
+ * const chapter = useSuparismaChapter({
35
+ * where: { active: true },
36
+ * orderBy: { createdAt: 'desc' }, // Note: Using actual Prisma field name
37
+ * limit: 10
38
+ * });
39
+ *
40
+ * @example
41
+ * // Create a new record
42
+ * const result = await chapter.create({
43
+ * name: "Example Name",
44
+ * // other fields...
45
+ * });
46
+ *
47
+ * @example
48
+ * // Update a record
49
+ * const result = await chapter.update({
50
+ * where: { id: "123" },
51
+ * data: { name: "Updated Name" }
52
+ * });
53
+ *
54
+ * @example
55
+ * // Delete a record
56
+ * const result = await chapter.delete({ id: "123" });
57
+ *
58
+ * @example
59
+ * // Find records with specific criteria
60
+ * const result = await chapter.findMany({
61
+ * where: { // filters },
62
+ * orderBy: { // ordering },
63
+ * take: 20 // limit
64
+ * });
65
+ *
66
+ * @example
67
+ * // Select specific fields only
68
+ * const chapter = useSuparismaChapter({
69
+ * select: { id: true, name: true }
70
+ * });
71
+ *
72
+ * @example
73
+ * // Include related records
74
+ * const chapter = useSuparismaChapter({
75
+ * include: { relatedModel: true }
76
+ * });
77
+ */
78
+ export const useSuparismaChapter = createSuparismaHook<
79
+ ChapterWithRelations,
80
+ ChapterWithRelations,
81
+ ChapterCreateInput,
82
+ ChapterUpdateInput,
83
+ ChapterWhereInput,
84
+ ChapterWhereUniqueInput,
85
+ ChapterOrderByInput
86
+ >({
87
+ tableName: 'Chapter',
88
+ hasCreatedAt: true,
89
+ hasUpdatedAt: true,
90
+ // Default values from schema
91
+ defaultValues: {"id":"uuid(","order":"0","createdAt":"now("},
92
+ // Field name for createdAt from Prisma schema
93
+ createdAtField: "createdAt",
94
+ // Field name for updatedAt from Prisma schema
95
+ updatedAtField: "updatedAt",
96
+ // Relation mappings for PostgREST embedding
97
+ relationMappings: {"course":"Course","lessons":"Lesson"}
98
+ }) as unknown as (options?: UseChapterOptions) => ChapterHookApi;
@@ -0,0 +1,98 @@
1
+ // THIS FILE IS AUTO-GENERATED - DO NOT EDIT DIRECTLY
2
+ // Edit the generator script instead: scripts/generate-realtime-hooks.ts
3
+
4
+ // Corrected import for core hook factory
5
+ import { createSuparismaHook } from '../utils/core';
6
+ import type {
7
+ CourseWithRelations,
8
+ CourseCreateInput,
9
+ CourseUpdateInput,
10
+ CourseWhereInput,
11
+ CourseWhereUniqueInput,
12
+ CourseOrderByInput,
13
+ CourseSelectInput,
14
+ CourseIncludeInput,
15
+ CourseHookApi,
16
+ UseCourseOptions
17
+ } from '../types/CourseTypes';
18
+
19
+ /**
20
+ * A Prisma-like hook for interacting with Course records with real-time capabilities.
21
+ *
22
+ * This hook provides CRUD operations, real-time updates, and search functionality.
23
+ *
24
+ * @param options - Optional configuration options for the hook
25
+ * @returns An object with data state and methods for interacting with Course records
26
+ *
27
+ * @example
28
+ * // Basic usage - get all Course records with realtime updates
29
+ * const course = useSuparismaCourse();
30
+ * const { data, loading, error } = course;
31
+ *
32
+ * @example
33
+ * // With filtering and ordering
34
+ * const course = useSuparismaCourse({
35
+ * where: { active: true },
36
+ * orderBy: { createdAt: 'desc' }, // Note: Using actual Prisma field name
37
+ * limit: 10
38
+ * });
39
+ *
40
+ * @example
41
+ * // Create a new record
42
+ * const result = await course.create({
43
+ * name: "Example Name",
44
+ * // other fields...
45
+ * });
46
+ *
47
+ * @example
48
+ * // Update a record
49
+ * const result = await course.update({
50
+ * where: { id: "123" },
51
+ * data: { name: "Updated Name" }
52
+ * });
53
+ *
54
+ * @example
55
+ * // Delete a record
56
+ * const result = await course.delete({ id: "123" });
57
+ *
58
+ * @example
59
+ * // Find records with specific criteria
60
+ * const result = await course.findMany({
61
+ * where: { // filters },
62
+ * orderBy: { // ordering },
63
+ * take: 20 // limit
64
+ * });
65
+ *
66
+ * @example
67
+ * // Select specific fields only
68
+ * const course = useSuparismaCourse({
69
+ * select: { id: true, name: true }
70
+ * });
71
+ *
72
+ * @example
73
+ * // Include related records
74
+ * const course = useSuparismaCourse({
75
+ * include: { relatedModel: true }
76
+ * });
77
+ */
78
+ export const useSuparismaCourse = createSuparismaHook<
79
+ CourseWithRelations,
80
+ CourseWithRelations,
81
+ CourseCreateInput,
82
+ CourseUpdateInput,
83
+ CourseWhereInput,
84
+ CourseWhereUniqueInput,
85
+ CourseOrderByInput
86
+ >({
87
+ tableName: 'Course',
88
+ hasCreatedAt: true,
89
+ hasUpdatedAt: true,
90
+ // Default values from schema
91
+ defaultValues: {"id":"uuid(","published":"false","createdAt":"now(","allowIndividualLessonPurchase":"false","blockScreenRecording":"true","maxDevices":"0","price":"0","pricingType":"\"paid\"","defaultLessonPrice":"0"},
92
+ // Field name for createdAt from Prisma schema
93
+ createdAtField: "createdAt",
94
+ // Field name for updatedAt from Prisma schema
95
+ updatedAtField: "updatedAt",
96
+ // Relation mappings for PostgREST embedding
97
+ relationMappings: {"teacher":"User","chapters":"Chapter","enrollments":"Enrollment","purchases":"LessonPurchase"}
98
+ }) as unknown as (options?: UseCourseOptions) => CourseHookApi;
@@ -0,0 +1,94 @@
1
+ // THIS FILE IS AUTO-GENERATED - DO NOT EDIT DIRECTLY
2
+ // Edit the generator script instead: scripts/generate-realtime-hooks.ts
3
+
4
+ // Corrected import for core hook factory
5
+ import { createSuparismaHook } from '../utils/core';
6
+ import type {
7
+ DeviceSessionWithRelations,
8
+ DeviceSessionCreateInput,
9
+ DeviceSessionUpdateInput,
10
+ DeviceSessionWhereInput,
11
+ DeviceSessionWhereUniqueInput,
12
+ DeviceSessionOrderByInput,
13
+ DeviceSessionSelectInput,
14
+ DeviceSessionIncludeInput,
15
+ DeviceSessionHookApi,
16
+ UseDeviceSessionOptions
17
+ } from '../types/DeviceSessionTypes';
18
+
19
+ /**
20
+ * A Prisma-like hook for interacting with DeviceSession records with real-time capabilities.
21
+ *
22
+ * This hook provides CRUD operations, real-time updates, and search functionality.
23
+ *
24
+ * @param options - Optional configuration options for the hook
25
+ * @returns An object with data state and methods for interacting with DeviceSession records
26
+ *
27
+ * @example
28
+ * // Basic usage - get all DeviceSession records with realtime updates
29
+ * const devicesession = useSuparismaDeviceSession();
30
+ * const { data, loading, error } = devicesession;
31
+ *
32
+ * @example
33
+ * // With filtering and ordering
34
+ * const devicesession = useSuparismaDeviceSession({
35
+ * where: { active: true },
36
+ * orderBy: { createdAt: 'desc' }, // Note: Using actual Prisma field name
37
+ * limit: 10
38
+ * });
39
+ *
40
+ * @example
41
+ * // Create a new record
42
+ * const result = await devicesession.create({
43
+ * name: "Example Name",
44
+ * // other fields...
45
+ * });
46
+ *
47
+ * @example
48
+ * // Update a record
49
+ * const result = await devicesession.update({
50
+ * where: { id: "123" },
51
+ * data: { name: "Updated Name" }
52
+ * });
53
+ *
54
+ * @example
55
+ * // Delete a record
56
+ * const result = await devicesession.delete({ id: "123" });
57
+ *
58
+ * @example
59
+ * // Find records with specific criteria
60
+ * const result = await devicesession.findMany({
61
+ * where: { // filters },
62
+ * orderBy: { // ordering },
63
+ * take: 20 // limit
64
+ * });
65
+ *
66
+ * @example
67
+ * // Select specific fields only
68
+ * const devicesession = useSuparismaDeviceSession({
69
+ * select: { id: true, name: true }
70
+ * });
71
+ *
72
+ * @example
73
+ * // Include related records
74
+ * const devicesession = useSuparismaDeviceSession({
75
+ * include: { relatedModel: true }
76
+ * });
77
+ */
78
+ export const useSuparismaDeviceSession = createSuparismaHook<
79
+ DeviceSessionWithRelations,
80
+ DeviceSessionWithRelations,
81
+ DeviceSessionCreateInput,
82
+ DeviceSessionUpdateInput,
83
+ DeviceSessionWhereInput,
84
+ DeviceSessionWhereUniqueInput,
85
+ DeviceSessionOrderByInput
86
+ >({
87
+ tableName: 'DeviceSession',
88
+ hasCreatedAt: true,
89
+ hasUpdatedAt: false,
90
+ // Default values from schema
91
+ defaultValues: {"id":"uuid(","lastActiveAt":"now(","createdAt":"now("},
92
+ // Field name for createdAt from Prisma schema
93
+ createdAtField: "createdAt"
94
+ }) as unknown as (options?: UseDeviceSessionOptions) => DeviceSessionHookApi;
@@ -0,0 +1,94 @@
1
+ // THIS FILE IS AUTO-GENERATED - DO NOT EDIT DIRECTLY
2
+ // Edit the generator script instead: scripts/generate-realtime-hooks.ts
3
+
4
+ // Corrected import for core hook factory
5
+ import { createSuparismaHook } from '../utils/core';
6
+ import type {
7
+ EnrollmentWithRelations,
8
+ EnrollmentCreateInput,
9
+ EnrollmentUpdateInput,
10
+ EnrollmentWhereInput,
11
+ EnrollmentWhereUniqueInput,
12
+ EnrollmentOrderByInput,
13
+ EnrollmentSelectInput,
14
+ EnrollmentIncludeInput,
15
+ EnrollmentHookApi,
16
+ UseEnrollmentOptions
17
+ } from '../types/EnrollmentTypes';
18
+
19
+ /**
20
+ * A Prisma-like hook for interacting with Enrollment records with real-time capabilities.
21
+ *
22
+ * This hook provides CRUD operations, real-time updates, and search functionality.
23
+ *
24
+ * @param options - Optional configuration options for the hook
25
+ * @returns An object with data state and methods for interacting with Enrollment records
26
+ *
27
+ * @example
28
+ * // Basic usage - get all Enrollment records with realtime updates
29
+ * const enrollment = useSuparismaEnrollment();
30
+ * const { data, loading, error } = enrollment;
31
+ *
32
+ * @example
33
+ * // With filtering and ordering
34
+ * const enrollment = useSuparismaEnrollment({
35
+ * where: { active: true },
36
+ * orderBy: { createdAt: 'desc' }, // Note: Using actual Prisma field name
37
+ * limit: 10
38
+ * });
39
+ *
40
+ * @example
41
+ * // Create a new record
42
+ * const result = await enrollment.create({
43
+ * name: "Example Name",
44
+ * // other fields...
45
+ * });
46
+ *
47
+ * @example
48
+ * // Update a record
49
+ * const result = await enrollment.update({
50
+ * where: { id: "123" },
51
+ * data: { name: "Updated Name" }
52
+ * });
53
+ *
54
+ * @example
55
+ * // Delete a record
56
+ * const result = await enrollment.delete({ id: "123" });
57
+ *
58
+ * @example
59
+ * // Find records with specific criteria
60
+ * const result = await enrollment.findMany({
61
+ * where: { // filters },
62
+ * orderBy: { // ordering },
63
+ * take: 20 // limit
64
+ * });
65
+ *
66
+ * @example
67
+ * // Select specific fields only
68
+ * const enrollment = useSuparismaEnrollment({
69
+ * select: { id: true, name: true }
70
+ * });
71
+ *
72
+ * @example
73
+ * // Include related records
74
+ * const enrollment = useSuparismaEnrollment({
75
+ * include: { relatedModel: true }
76
+ * });
77
+ */
78
+ export const useSuparismaEnrollment = createSuparismaHook<
79
+ EnrollmentWithRelations,
80
+ EnrollmentWithRelations,
81
+ EnrollmentCreateInput,
82
+ EnrollmentUpdateInput,
83
+ EnrollmentWhereInput,
84
+ EnrollmentWhereUniqueInput,
85
+ EnrollmentOrderByInput
86
+ >({
87
+ tableName: 'Enrollment',
88
+ hasCreatedAt: false,
89
+ hasUpdatedAt: false,
90
+ // Default values from schema
91
+ defaultValues: {"id":"uuid(","enrolledAt":"now(","screenshotAttempts":"0","screenRecordingAttempts":"0"},
92
+ // Relation mappings for PostgREST embedding
93
+ relationMappings: {"course":"Course"}
94
+ }) as unknown as (options?: UseEnrollmentOptions) => EnrollmentHookApi;
@@ -0,0 +1,98 @@
1
+ // THIS FILE IS AUTO-GENERATED - DO NOT EDIT DIRECTLY
2
+ // Edit the generator script instead: scripts/generate-realtime-hooks.ts
3
+
4
+ // Corrected import for core hook factory
5
+ import { createSuparismaHook } from '../utils/core';
6
+ import type {
7
+ LessonWithRelations,
8
+ LessonCreateInput,
9
+ LessonUpdateInput,
10
+ LessonWhereInput,
11
+ LessonWhereUniqueInput,
12
+ LessonOrderByInput,
13
+ LessonSelectInput,
14
+ LessonIncludeInput,
15
+ LessonHookApi,
16
+ UseLessonOptions
17
+ } from '../types/LessonTypes';
18
+
19
+ /**
20
+ * A Prisma-like hook for interacting with Lesson records with real-time capabilities.
21
+ *
22
+ * This hook provides CRUD operations, real-time updates, and search functionality.
23
+ *
24
+ * @param options - Optional configuration options for the hook
25
+ * @returns An object with data state and methods for interacting with Lesson records
26
+ *
27
+ * @example
28
+ * // Basic usage - get all Lesson records with realtime updates
29
+ * const lesson = useSuparismaLesson();
30
+ * const { data, loading, error } = lesson;
31
+ *
32
+ * @example
33
+ * // With filtering and ordering
34
+ * const lesson = useSuparismaLesson({
35
+ * where: { active: true },
36
+ * orderBy: { createdAt: 'desc' }, // Note: Using actual Prisma field name
37
+ * limit: 10
38
+ * });
39
+ *
40
+ * @example
41
+ * // Create a new record
42
+ * const result = await lesson.create({
43
+ * name: "Example Name",
44
+ * // other fields...
45
+ * });
46
+ *
47
+ * @example
48
+ * // Update a record
49
+ * const result = await lesson.update({
50
+ * where: { id: "123" },
51
+ * data: { name: "Updated Name" }
52
+ * });
53
+ *
54
+ * @example
55
+ * // Delete a record
56
+ * const result = await lesson.delete({ id: "123" });
57
+ *
58
+ * @example
59
+ * // Find records with specific criteria
60
+ * const result = await lesson.findMany({
61
+ * where: { // filters },
62
+ * orderBy: { // ordering },
63
+ * take: 20 // limit
64
+ * });
65
+ *
66
+ * @example
67
+ * // Select specific fields only
68
+ * const lesson = useSuparismaLesson({
69
+ * select: { id: true, name: true }
70
+ * });
71
+ *
72
+ * @example
73
+ * // Include related records
74
+ * const lesson = useSuparismaLesson({
75
+ * include: { relatedModel: true }
76
+ * });
77
+ */
78
+ export const useSuparismaLesson = createSuparismaHook<
79
+ LessonWithRelations,
80
+ LessonWithRelations,
81
+ LessonCreateInput,
82
+ LessonUpdateInput,
83
+ LessonWhereInput,
84
+ LessonWhereUniqueInput,
85
+ LessonOrderByInput
86
+ >({
87
+ tableName: 'Lesson',
88
+ hasCreatedAt: true,
89
+ hasUpdatedAt: true,
90
+ // Default values from schema
91
+ defaultValues: {"id":"uuid(","order":"0","createdAt":"now(","isFree":"false","price":"0"},
92
+ // Field name for createdAt from Prisma schema
93
+ createdAtField: "createdAt",
94
+ // Field name for updatedAt from Prisma schema
95
+ updatedAtField: "updatedAt",
96
+ // Relation mappings for PostgREST embedding
97
+ relationMappings: {"chapter":"Chapter","purchases":"LessonPurchase","questions":"LessonQuestion","videoNotes":"VideoNote","watchProgress":"WatchProgress"}
98
+ }) as unknown as (options?: UseLessonOptions) => LessonHookApi;
@@ -0,0 +1,94 @@
1
+ // THIS FILE IS AUTO-GENERATED - DO NOT EDIT DIRECTLY
2
+ // Edit the generator script instead: scripts/generate-realtime-hooks.ts
3
+
4
+ // Corrected import for core hook factory
5
+ import { createSuparismaHook } from '../utils/core';
6
+ import type {
7
+ LessonPurchaseWithRelations,
8
+ LessonPurchaseCreateInput,
9
+ LessonPurchaseUpdateInput,
10
+ LessonPurchaseWhereInput,
11
+ LessonPurchaseWhereUniqueInput,
12
+ LessonPurchaseOrderByInput,
13
+ LessonPurchaseSelectInput,
14
+ LessonPurchaseIncludeInput,
15
+ LessonPurchaseHookApi,
16
+ UseLessonPurchaseOptions
17
+ } from '../types/LessonPurchaseTypes';
18
+
19
+ /**
20
+ * A Prisma-like hook for interacting with LessonPurchase records with real-time capabilities.
21
+ *
22
+ * This hook provides CRUD operations, real-time updates, and search functionality.
23
+ *
24
+ * @param options - Optional configuration options for the hook
25
+ * @returns An object with data state and methods for interacting with LessonPurchase records
26
+ *
27
+ * @example
28
+ * // Basic usage - get all LessonPurchase records with realtime updates
29
+ * const lessonpurchase = useSuparismaLessonPurchase();
30
+ * const { data, loading, error } = lessonpurchase;
31
+ *
32
+ * @example
33
+ * // With filtering and ordering
34
+ * const lessonpurchase = useSuparismaLessonPurchase({
35
+ * where: { active: true },
36
+ * orderBy: { createdAt: 'desc' }, // Note: Using actual Prisma field name
37
+ * limit: 10
38
+ * });
39
+ *
40
+ * @example
41
+ * // Create a new record
42
+ * const result = await lessonpurchase.create({
43
+ * name: "Example Name",
44
+ * // other fields...
45
+ * });
46
+ *
47
+ * @example
48
+ * // Update a record
49
+ * const result = await lessonpurchase.update({
50
+ * where: { id: "123" },
51
+ * data: { name: "Updated Name" }
52
+ * });
53
+ *
54
+ * @example
55
+ * // Delete a record
56
+ * const result = await lessonpurchase.delete({ id: "123" });
57
+ *
58
+ * @example
59
+ * // Find records with specific criteria
60
+ * const result = await lessonpurchase.findMany({
61
+ * where: { // filters },
62
+ * orderBy: { // ordering },
63
+ * take: 20 // limit
64
+ * });
65
+ *
66
+ * @example
67
+ * // Select specific fields only
68
+ * const lessonpurchase = useSuparismaLessonPurchase({
69
+ * select: { id: true, name: true }
70
+ * });
71
+ *
72
+ * @example
73
+ * // Include related records
74
+ * const lessonpurchase = useSuparismaLessonPurchase({
75
+ * include: { relatedModel: true }
76
+ * });
77
+ */
78
+ export const useSuparismaLessonPurchase = createSuparismaHook<
79
+ LessonPurchaseWithRelations,
80
+ LessonPurchaseWithRelations,
81
+ LessonPurchaseCreateInput,
82
+ LessonPurchaseUpdateInput,
83
+ LessonPurchaseWhereInput,
84
+ LessonPurchaseWhereUniqueInput,
85
+ LessonPurchaseOrderByInput
86
+ >({
87
+ tableName: 'LessonPurchase',
88
+ hasCreatedAt: false,
89
+ hasUpdatedAt: false,
90
+ // Default values from schema
91
+ defaultValues: {"id":"uuid(","purchasedAt":"now("},
92
+ // Relation mappings for PostgREST embedding
93
+ relationMappings: {"course":"Course","lesson":"Lesson"}
94
+ }) as unknown as (options?: UseLessonPurchaseOptions) => LessonPurchaseHookApi;