@basictech/react 0.1.1-beta.0 → 0.2.0-beta.10

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,6 +1,6 @@
1
1
 
2
2
  
3
- > @basictech/react@1.1.0 build
3
+ > @basictech/react@0.2.0-beta.9 build
4
4
  > tsup
5
5
 
6
6
  CLI Building entry: src/index.ts
@@ -11,13 +11,13 @@
11
11
  CLI Cleaning output folder
12
12
  CJS Build start
13
13
  ESM Build start
14
- CJS dist/index.js 8.50 KB
15
- CJS dist/index.js.map 15.26 KB
16
- CJS ⚡️ Build success in 21ms
17
- ESM dist/index.mjs 7.26 KB
18
- ESM dist/index.mjs.map 15.11 KB
19
- ESM ⚡️ Build success in 21ms
14
+ ESM dist/index.mjs 22.64 KB
15
+ ESM dist/index.mjs.map 51.47 KB
16
+ ESM ⚡️ Build success in 13ms
17
+ CJS dist/index.js 24.94 KB
18
+ CJS dist/index.js.map 51.58 KB
19
+ CJS ⚡️ Build success in 14ms
20
20
  DTS Build start
21
- DTS ⚡️ Build success in 1165ms
22
- DTS dist/index.d.ts 689.00 B
23
- DTS dist/index.d.mts 689.00 B
21
+ DTS ⚡️ Build success in 865ms
22
+ DTS dist/index.d.ts 3.90 KB
23
+ DTS dist/index.d.mts 3.90 KB
package/changelog.md CHANGED
@@ -1,5 +1,84 @@
1
1
  # 1.3.4
2
2
 
3
+ ## 0.2.0-beta.10
4
+
5
+ ### Minor Changes
6
+
7
+ - added schema package - test
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @basictech/schema@0.1.0-beta.0
13
+
14
+ ## 0.2.0-beta.9
15
+
16
+ ### Minor Changes
17
+
18
+ - add schema validation
19
+
20
+ ## 0.2.0-beta.8
21
+
22
+ ### Minor Changes
23
+
24
+ - changed isLoaded to isAuthReady and fixed dbStatus hooks for useBasic
25
+
26
+ ## 0.2.0-beta.7
27
+
28
+ ### Minor Changes
29
+
30
+ - update useQuery hook
31
+
32
+ - no need to pass param as a function, can now enter query directly
33
+ - defaults to empty array when loading
34
+
35
+ ## 0.2.0-beta.6
36
+
37
+ ### Minor Changes
38
+
39
+ - add debug option
40
+
41
+ ## 0.2.0-beta.5
42
+
43
+ ### Minor Changes
44
+
45
+ - schema validation bugfix
46
+
47
+ ## 0.2.0-beta.4
48
+
49
+ ### Minor Changes
50
+
51
+ - add schema validation
52
+
53
+ ## 0.2.0-beta.3
54
+
55
+ ### Minor Changes
56
+
57
+ - remove sync lib
58
+ - 4841960: test build
59
+ - remove sync library
60
+
61
+ ## 0.2.0-beta.2
62
+
63
+ ### Minor Changes
64
+
65
+ - rebuild tsup
66
+
67
+ ## 0.2.0-beta.1
68
+
69
+ ### Minor Changes
70
+
71
+ - dependency updates
72
+ - 13594a9: added basic-sync
73
+ - dependency update
74
+
75
+ ### Patch Changes
76
+
77
+ - 3c7b34e: version changes mostly
78
+ - Updated dependencies [3c7b34e]
79
+ - Updated dependencies
80
+ - @repo/sync@0.1.0-beta.0
81
+
3
82
  ## 0.1.1-beta.0
4
83
 
5
84
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
- export { useLiveQuery as useQuery } from 'dexie-react-hooks';
3
+ import { ErrorObject } from 'ajv';
4
+ export { default as hello } from '@basictech/schema';
4
5
 
5
6
  declare enum DBStatus {
6
7
  LOADING = "LOADING",
@@ -19,14 +20,15 @@ type User = {
19
20
  };
20
21
  fullName?: string;
21
22
  };
22
- declare function BasicProvider({ children, project_id, schema }: {
23
+ declare function BasicProvider({ children, project_id, schema, debug }: {
23
24
  children: React.ReactNode;
24
25
  project_id: string;
25
26
  schema: any;
27
+ debug?: boolean;
26
28
  }): react_jsx_runtime.JSX.Element;
27
29
  declare function useBasic(): {
28
30
  unicorn: string;
29
- isLoaded: boolean;
31
+ isAuthReady: boolean;
30
32
  isSignedIn: boolean;
31
33
  user: User | null;
32
34
  signout: () => void;
@@ -37,4 +39,97 @@ declare function useBasic(): {
37
39
  dbStatus: DBStatus;
38
40
  };
39
41
 
40
- export { BasicProvider, useBasic };
42
+ declare const basicJsonSchema: {
43
+ $schema: string;
44
+ type: string;
45
+ properties: {
46
+ project_id: {
47
+ type: string;
48
+ };
49
+ namespace: {
50
+ type: string;
51
+ };
52
+ version: {
53
+ type: string;
54
+ minimum: number;
55
+ };
56
+ tables: {
57
+ type: string;
58
+ patternProperties: {
59
+ "^[a-zA-Z0-9_]+$": {
60
+ type: string;
61
+ properties: {
62
+ name: {
63
+ type: string;
64
+ };
65
+ type: {
66
+ type: string;
67
+ enum: string[];
68
+ };
69
+ fields: {
70
+ type: string;
71
+ patternProperties: {
72
+ "^[a-zA-Z0-9_]+$": {
73
+ type: string;
74
+ properties: {
75
+ type: {
76
+ type: string;
77
+ enum: string[];
78
+ };
79
+ indexed: {
80
+ type: string;
81
+ };
82
+ required: {
83
+ type: string;
84
+ };
85
+ };
86
+ required: string[];
87
+ };
88
+ };
89
+ additionalProperties: boolean;
90
+ };
91
+ };
92
+ required: string[];
93
+ };
94
+ };
95
+ additionalProperties: boolean;
96
+ };
97
+ };
98
+ required: string[];
99
+ };
100
+ type Schema = typeof basicJsonSchema;
101
+ declare function generateEmptySchema(): void;
102
+ /**
103
+ * Validate a schema
104
+ * only checks if the schema is formatted correctly, not if can be published
105
+ * @param schema - The schema to validate
106
+ * @returns {valid: boolean, errors: any[]} - The validation result
107
+ */
108
+ declare function validateSchema(schema: Schema): {
109
+ valid: boolean;
110
+ errors: ErrorObject[];
111
+ };
112
+ declare function validateData(schema: any, table: string, data: Record<string, any>, checkRequired?: boolean): {
113
+ valid: boolean;
114
+ errors: ErrorObject<string, Record<string, any>, unknown>[];
115
+ message: string;
116
+ } | {
117
+ valid: boolean;
118
+ errors: {
119
+ message: string;
120
+ }[];
121
+ message: string;
122
+ } | {
123
+ valid: boolean;
124
+ errors: never[];
125
+ message?: undefined;
126
+ };
127
+
128
+ declare function useQuery(queryable: any): any;
129
+ declare const sc: {
130
+ validateSchema: typeof validateSchema;
131
+ validateData: typeof validateData;
132
+ generateEmptySchema: typeof generateEmptySchema;
133
+ };
134
+
135
+ export { BasicProvider, sc, useBasic, useQuery };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React from 'react';
3
- export { useLiveQuery as useQuery } from 'dexie-react-hooks';
3
+ import { ErrorObject } from 'ajv';
4
+ export { default as hello } from '@basictech/schema';
4
5
 
5
6
  declare enum DBStatus {
6
7
  LOADING = "LOADING",
@@ -19,14 +20,15 @@ type User = {
19
20
  };
20
21
  fullName?: string;
21
22
  };
22
- declare function BasicProvider({ children, project_id, schema }: {
23
+ declare function BasicProvider({ children, project_id, schema, debug }: {
23
24
  children: React.ReactNode;
24
25
  project_id: string;
25
26
  schema: any;
27
+ debug?: boolean;
26
28
  }): react_jsx_runtime.JSX.Element;
27
29
  declare function useBasic(): {
28
30
  unicorn: string;
29
- isLoaded: boolean;
31
+ isAuthReady: boolean;
30
32
  isSignedIn: boolean;
31
33
  user: User | null;
32
34
  signout: () => void;
@@ -37,4 +39,97 @@ declare function useBasic(): {
37
39
  dbStatus: DBStatus;
38
40
  };
39
41
 
40
- export { BasicProvider, useBasic };
42
+ declare const basicJsonSchema: {
43
+ $schema: string;
44
+ type: string;
45
+ properties: {
46
+ project_id: {
47
+ type: string;
48
+ };
49
+ namespace: {
50
+ type: string;
51
+ };
52
+ version: {
53
+ type: string;
54
+ minimum: number;
55
+ };
56
+ tables: {
57
+ type: string;
58
+ patternProperties: {
59
+ "^[a-zA-Z0-9_]+$": {
60
+ type: string;
61
+ properties: {
62
+ name: {
63
+ type: string;
64
+ };
65
+ type: {
66
+ type: string;
67
+ enum: string[];
68
+ };
69
+ fields: {
70
+ type: string;
71
+ patternProperties: {
72
+ "^[a-zA-Z0-9_]+$": {
73
+ type: string;
74
+ properties: {
75
+ type: {
76
+ type: string;
77
+ enum: string[];
78
+ };
79
+ indexed: {
80
+ type: string;
81
+ };
82
+ required: {
83
+ type: string;
84
+ };
85
+ };
86
+ required: string[];
87
+ };
88
+ };
89
+ additionalProperties: boolean;
90
+ };
91
+ };
92
+ required: string[];
93
+ };
94
+ };
95
+ additionalProperties: boolean;
96
+ };
97
+ };
98
+ required: string[];
99
+ };
100
+ type Schema = typeof basicJsonSchema;
101
+ declare function generateEmptySchema(): void;
102
+ /**
103
+ * Validate a schema
104
+ * only checks if the schema is formatted correctly, not if can be published
105
+ * @param schema - The schema to validate
106
+ * @returns {valid: boolean, errors: any[]} - The validation result
107
+ */
108
+ declare function validateSchema(schema: Schema): {
109
+ valid: boolean;
110
+ errors: ErrorObject[];
111
+ };
112
+ declare function validateData(schema: any, table: string, data: Record<string, any>, checkRequired?: boolean): {
113
+ valid: boolean;
114
+ errors: ErrorObject<string, Record<string, any>, unknown>[];
115
+ message: string;
116
+ } | {
117
+ valid: boolean;
118
+ errors: {
119
+ message: string;
120
+ }[];
121
+ message: string;
122
+ } | {
123
+ valid: boolean;
124
+ errors: never[];
125
+ message?: undefined;
126
+ };
127
+
128
+ declare function useQuery(queryable: any): any;
129
+ declare const sc: {
130
+ validateSchema: typeof validateSchema;
131
+ validateData: typeof validateData;
132
+ generateEmptySchema: typeof generateEmptySchema;
133
+ };
134
+
135
+ export { BasicProvider, sc, useBasic, useQuery };