suparisma 0.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.
Files changed (43) hide show
  1. package/.gitattributes +2 -0
  2. package/LICENSE +21 -0
  3. package/README.md +4 -0
  4. package/dist/config.js +7 -0
  5. package/dist/generated/supabase-client-generated.js +7 -0
  6. package/dist/generators/coreGenerator.js +1430 -0
  7. package/dist/generators/hookGenerator.js +108 -0
  8. package/dist/generators/indexGenerator.js +100 -0
  9. package/dist/generators/supabaseClientGenerator.js +29 -0
  10. package/dist/generators/typeGenerator.js +566 -0
  11. package/dist/hooks/generated/UserTypes.js +2 -0
  12. package/dist/hooks/generated/core.js +1089 -0
  13. package/dist/hooks/generated/index.js +33 -0
  14. package/dist/hooks/generated/useSuparismaUser.js +60 -0
  15. package/dist/index.js +259 -0
  16. package/dist/parser.js +117 -0
  17. package/dist/types.js +2 -0
  18. package/package.json +28 -0
  19. package/prisma/schema.prisma +22 -0
  20. package/src/config.ts +7 -0
  21. package/src/generated/hooks/useSuparismaUser.ts +77 -0
  22. package/src/generated/index.ts +50 -0
  23. package/src/generated/types/UserTypes.ts +400 -0
  24. package/src/generated/utils/core.ts +1413 -0
  25. package/src/generated/utils/supabase-client.ts +7 -0
  26. package/src/generators/coreGenerator.ts +1426 -0
  27. package/src/generators/hookGenerator.ts +110 -0
  28. package/src/generators/indexGenerator.ts +117 -0
  29. package/src/generators/supabaseClientGenerator.ts +24 -0
  30. package/src/generators/typeGenerator.ts +587 -0
  31. package/src/index.ts +339 -0
  32. package/src/parser.ts +134 -0
  33. package/src/suparisma/generated/UserTypes.ts +400 -0
  34. package/src/suparisma/generated/core.ts +1413 -0
  35. package/src/suparisma/generated/hooks/useSuparismaUser.ts +77 -0
  36. package/src/suparisma/generated/index.ts +50 -0
  37. package/src/suparisma/generated/supabase-client-generated.ts +9 -0
  38. package/src/suparisma/generated/types/UserTypes.ts +400 -0
  39. package/src/suparisma/generated/useSuparismaUser.ts +77 -0
  40. package/src/suparisma/generated/utils/core.ts +1413 -0
  41. package/src/suparisma/generated/utils/supabase-client.ts +7 -0
  42. package/src/types.ts +57 -0
  43. package/tsconfig.json +20 -0
@@ -0,0 +1,7 @@
1
+ // THIS FILE IS AUTO-GENERATED - DO NOT EDIT DIRECTLY
2
+ import { createClient } from '@supabase/supabase-js';
3
+
4
+ export const supabase = createClient(
5
+ process.env.NEXT_PUBLIC_SUPABASE_URL!,
6
+ process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY!
7
+ );
package/src/types.ts ADDED
@@ -0,0 +1,57 @@
1
+ // Define field types and metadata
2
+ export type FieldInfo = {
3
+ name: string;
4
+ type: string;
5
+ isRequired: boolean;
6
+ isOptional: boolean;
7
+ isId: boolean;
8
+ isUnique: boolean;
9
+ isUpdatedAt: boolean;
10
+ isCreatedAt: boolean;
11
+ hasDefaultValue: boolean;
12
+ defaultValue?: string; // Added to track the actual default value
13
+ isRelation: boolean;
14
+ };
15
+
16
+ // Search field information
17
+ export type SearchFieldInfo = {
18
+ name: string;
19
+ type: string;
20
+ };
21
+
22
+ // Search query type
23
+ export type SearchQuery = {
24
+ field: string;
25
+ value: string;
26
+ };
27
+
28
+ // Complete search state
29
+ export type SearchState = {
30
+ queries: SearchQuery[];
31
+ loading: boolean;
32
+ setQueries: (queries: SearchQuery[]) => void;
33
+ addQuery: (query: SearchQuery) => void;
34
+ removeQuery: (field: string) => void;
35
+ clearQueries: () => void;
36
+ };
37
+
38
+ // Model information
39
+ export type ModelInfo = {
40
+ name: string;
41
+ mappedName: string;
42
+ fields: FieldInfo[];
43
+ // Fields marked with @enableSearch annotation
44
+ searchFields?: SearchFieldInfo[];
45
+ };
46
+
47
+ // Processed model info with additional metadata
48
+ export type ProcessedModelInfo = {
49
+ modelName: string;
50
+ tableName: string;
51
+ hasCreatedAt: boolean;
52
+ hasUpdatedAt: boolean;
53
+ // All searchable fields
54
+ searchFields?: string[];
55
+ // Add default values map
56
+ defaultValues?: Record<string, string>;
57
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2023",
4
+ "module": "CommonJS",
5
+ "lib": ["es2023", "DOM"],
6
+ "outDir": "./dist",
7
+ "baseUrl": ".",
8
+ "strict": true,
9
+ "esModuleInterop": true,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "resolveJsonModule": true,
13
+ "paths": {
14
+ "@monorepo/*": ["./*"]
15
+ },
16
+ "jsx": "preserve"
17
+ },
18
+ "include": ["src/**/*", "../src/app/**/*.ts"],
19
+ "exclude": ["node_modules", "**/*.spec.ts"]
20
+ }