@basictech/react 0.2.0-beta.1 → 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.
- package/.turbo/turbo-build.log +10 -10
- package/changelog.md +64 -0
- package/dist/index.d.mts +99 -4
- package/dist/index.d.ts +99 -4
- package/dist/index.js +345 -7935
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +315 -7930
- package/dist/index.mjs.map +1 -1
- package/package.json +11 -5
- package/readme.md +101 -29
- package/src/AuthContext.tsx +198 -76
- package/src/config.ts +27 -0
- package/src/index.ts +22 -3
- package/src/schema.ts +159 -0
- package/src/sync/index.ts +223 -0
- package/src/sync/syncProtocol.js +179 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @basictech/react@
|
|
3
|
+
> @basictech/react@0.2.0-beta.9 build
|
|
4
4
|
> tsup
|
|
5
5
|
|
|
6
6
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
[34mCLI[39m Cleaning output folder
|
|
12
12
|
[34mCJS[39m Build start
|
|
13
13
|
[34mESM[39m Build start
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
14
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m22.64 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m51.47 KB[39m
|
|
16
|
+
[32mESM[39m ⚡️ Build success in 13ms
|
|
17
|
+
[32mCJS[39m [1mdist/index.js [22m[32m24.94 KB[39m
|
|
18
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m51.58 KB[39m
|
|
19
|
+
[32mCJS[39m ⚡️ Build success in 14ms
|
|
20
20
|
[34mDTS[39m Build start
|
|
21
|
-
[32mDTS[39m ⚡️ Build success in
|
|
22
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[
|
|
23
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[
|
|
21
|
+
[32mDTS[39m ⚡️ Build success in 865ms
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.90 KB[39m
|
|
23
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.90 KB[39m
|
package/changelog.md
CHANGED
|
@@ -1,5 +1,69 @@
|
|
|
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
|
+
|
|
3
67
|
## 0.2.0-beta.1
|
|
4
68
|
|
|
5
69
|
### Minor 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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 };
|