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.
- package/.gitattributes +2 -0
- package/LICENSE +21 -0
- package/README.md +4 -0
- package/dist/config.js +7 -0
- package/dist/generated/supabase-client-generated.js +7 -0
- package/dist/generators/coreGenerator.js +1430 -0
- package/dist/generators/hookGenerator.js +108 -0
- package/dist/generators/indexGenerator.js +100 -0
- package/dist/generators/supabaseClientGenerator.js +29 -0
- package/dist/generators/typeGenerator.js +566 -0
- package/dist/hooks/generated/UserTypes.js +2 -0
- package/dist/hooks/generated/core.js +1089 -0
- package/dist/hooks/generated/index.js +33 -0
- package/dist/hooks/generated/useSuparismaUser.js +60 -0
- package/dist/index.js +259 -0
- package/dist/parser.js +117 -0
- package/dist/types.js +2 -0
- package/package.json +28 -0
- package/prisma/schema.prisma +22 -0
- package/src/config.ts +7 -0
- package/src/generated/hooks/useSuparismaUser.ts +77 -0
- package/src/generated/index.ts +50 -0
- package/src/generated/types/UserTypes.ts +400 -0
- package/src/generated/utils/core.ts +1413 -0
- package/src/generated/utils/supabase-client.ts +7 -0
- package/src/generators/coreGenerator.ts +1426 -0
- package/src/generators/hookGenerator.ts +110 -0
- package/src/generators/indexGenerator.ts +117 -0
- package/src/generators/supabaseClientGenerator.ts +24 -0
- package/src/generators/typeGenerator.ts +587 -0
- package/src/index.ts +339 -0
- package/src/parser.ts +134 -0
- package/src/suparisma/generated/UserTypes.ts +400 -0
- package/src/suparisma/generated/core.ts +1413 -0
- package/src/suparisma/generated/hooks/useSuparismaUser.ts +77 -0
- package/src/suparisma/generated/index.ts +50 -0
- package/src/suparisma/generated/supabase-client-generated.ts +9 -0
- package/src/suparisma/generated/types/UserTypes.ts +400 -0
- package/src/suparisma/generated/useSuparismaUser.ts +77 -0
- package/src/suparisma/generated/utils/core.ts +1413 -0
- package/src/suparisma/generated/utils/supabase-client.ts +7 -0
- package/src/types.ts +57 -0
- package/tsconfig.json +20 -0
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
|
+
}
|