@zenstackhq/client-helpers 3.1.0

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.
@@ -0,0 +1,37 @@
1
+ import type { FieldDef, SchemaDef } from '@zenstackhq/schema';
2
+
3
+ /**
4
+ * Helper to create a mock schema for testing
5
+ */
6
+ export function createSchema(models: SchemaDef['models']): SchemaDef {
7
+ return {
8
+ provider: { type: 'postgresql' },
9
+ models,
10
+ plugins: {},
11
+ };
12
+ }
13
+
14
+ /**
15
+ * Helper to create a field definition
16
+ */
17
+ export function createField(name: string, type: string, optional = false): FieldDef {
18
+ return {
19
+ name,
20
+ type,
21
+ optional,
22
+ };
23
+ }
24
+
25
+ /**
26
+ * Helper to create a relation field
27
+ */
28
+ export function createRelationField(name: string, type: string, optional = false): FieldDef {
29
+ return {
30
+ name,
31
+ type,
32
+ optional,
33
+ relation: {
34
+ opposite: 'user',
35
+ },
36
+ };
37
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "@zenstackhq/typescript-config/base.json",
3
+ "include": ["src/**/*.ts"]
4
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "@zenstackhq/typescript-config/base.json",
3
+ "include": ["src/**/*.ts", "test/**/*.ts"],
4
+ "compilerOptions": {
5
+ "lib": ["ESNext"]
6
+ }
7
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { defineConfig } from 'tsup';
2
+
3
+ export default defineConfig({
4
+ entry: {
5
+ index: 'src/index.ts',
6
+ fetch: 'src/fetch.ts',
7
+ },
8
+ outDir: 'dist',
9
+ splitting: false,
10
+ sourcemap: true,
11
+ clean: true,
12
+ dts: true,
13
+ format: ['esm'],
14
+ });
@@ -0,0 +1,4 @@
1
+ import base from '@zenstackhq/vitest-config/base';
2
+ import { defineConfig, mergeConfig } from 'vitest/config';
3
+
4
+ export default mergeConfig(base, defineConfig({}));