@basictech/react 0.2.0-beta.7 → 0.2.0-beta.9
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 +12 -0
- package/dist/index.d.mts +94 -2
- package/dist/index.d.ts +94 -2
- package/dist/index.js +184 -90
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +183 -90
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AuthContext.tsx +73 -44
- package/src/config.ts +2 -64
- package/src/index.ts +7 -1
- package/src/schema.ts +159 -0
- package/src/sync/index.ts +23 -4
- package/src/sync/syncProtocol.js +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @basictech/react@0.2.0-beta.
|
|
3
|
+
> @basictech/react@0.2.0-beta.7 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
|
+
[32mCJS[39m [1mdist/index.js [22m[32m22.22 KB[39m
|
|
15
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m45.33 KB[39m
|
|
16
|
+
[32mCJS[39m ⚡️ Build success in 14ms
|
|
17
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m19.99 KB[39m
|
|
18
|
+
[32mESM[39m [1mdist/index.mjs.map [22m[32m45.28 KB[39m
|
|
19
|
+
[32mESM[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 934ms
|
|
22
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m1003.00 B[39m
|
|
23
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m1003.00 B[39m
|
package/changelog.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { ErrorObject } from 'ajv';
|
|
3
4
|
|
|
4
5
|
declare enum DBStatus {
|
|
5
6
|
LOADING = "LOADING",
|
|
@@ -26,7 +27,7 @@ declare function BasicProvider({ children, project_id, schema, debug }: {
|
|
|
26
27
|
}): react_jsx_runtime.JSX.Element;
|
|
27
28
|
declare function useBasic(): {
|
|
28
29
|
unicorn: string;
|
|
29
|
-
|
|
30
|
+
isAuthReady: boolean;
|
|
30
31
|
isSignedIn: boolean;
|
|
31
32
|
user: User | null;
|
|
32
33
|
signout: () => void;
|
|
@@ -37,6 +38,97 @@ declare function useBasic(): {
|
|
|
37
38
|
dbStatus: DBStatus;
|
|
38
39
|
};
|
|
39
40
|
|
|
41
|
+
declare const basicJsonSchema: {
|
|
42
|
+
$schema: string;
|
|
43
|
+
type: string;
|
|
44
|
+
properties: {
|
|
45
|
+
project_id: {
|
|
46
|
+
type: string;
|
|
47
|
+
};
|
|
48
|
+
namespace: {
|
|
49
|
+
type: string;
|
|
50
|
+
};
|
|
51
|
+
version: {
|
|
52
|
+
type: string;
|
|
53
|
+
minimum: number;
|
|
54
|
+
};
|
|
55
|
+
tables: {
|
|
56
|
+
type: string;
|
|
57
|
+
patternProperties: {
|
|
58
|
+
"^[a-zA-Z0-9_]+$": {
|
|
59
|
+
type: string;
|
|
60
|
+
properties: {
|
|
61
|
+
name: {
|
|
62
|
+
type: string;
|
|
63
|
+
};
|
|
64
|
+
type: {
|
|
65
|
+
type: string;
|
|
66
|
+
enum: string[];
|
|
67
|
+
};
|
|
68
|
+
fields: {
|
|
69
|
+
type: string;
|
|
70
|
+
patternProperties: {
|
|
71
|
+
"^[a-zA-Z0-9_]+$": {
|
|
72
|
+
type: string;
|
|
73
|
+
properties: {
|
|
74
|
+
type: {
|
|
75
|
+
type: string;
|
|
76
|
+
enum: string[];
|
|
77
|
+
};
|
|
78
|
+
indexed: {
|
|
79
|
+
type: string;
|
|
80
|
+
};
|
|
81
|
+
required: {
|
|
82
|
+
type: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
required: string[];
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
additionalProperties: boolean;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
required: string[];
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
additionalProperties: boolean;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
required: string[];
|
|
98
|
+
};
|
|
99
|
+
type Schema = typeof basicJsonSchema;
|
|
100
|
+
declare function generateEmptySchema(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Validate a schema
|
|
103
|
+
* only checks if the schema is formatted correctly, not if can be published
|
|
104
|
+
* @param schema - The schema to validate
|
|
105
|
+
* @returns {valid: boolean, errors: any[]} - The validation result
|
|
106
|
+
*/
|
|
107
|
+
declare function validateSchema(schema: Schema): {
|
|
108
|
+
valid: boolean;
|
|
109
|
+
errors: ErrorObject[];
|
|
110
|
+
};
|
|
111
|
+
declare function validateData(schema: any, table: string, data: Record<string, any>, checkRequired?: boolean): {
|
|
112
|
+
valid: boolean;
|
|
113
|
+
errors: ErrorObject<string, Record<string, any>, unknown>[];
|
|
114
|
+
message: string;
|
|
115
|
+
} | {
|
|
116
|
+
valid: boolean;
|
|
117
|
+
errors: {
|
|
118
|
+
message: string;
|
|
119
|
+
}[];
|
|
120
|
+
message: string;
|
|
121
|
+
} | {
|
|
122
|
+
valid: boolean;
|
|
123
|
+
errors: never[];
|
|
124
|
+
message?: undefined;
|
|
125
|
+
};
|
|
126
|
+
|
|
40
127
|
declare function useQuery(queryable: any): any;
|
|
128
|
+
declare const sc: {
|
|
129
|
+
validateSchema: typeof validateSchema;
|
|
130
|
+
validateData: typeof validateData;
|
|
131
|
+
generateEmptySchema: typeof generateEmptySchema;
|
|
132
|
+
};
|
|
41
133
|
|
|
42
|
-
export { BasicProvider, useBasic, useQuery };
|
|
134
|
+
export { BasicProvider, sc, useBasic, useQuery };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import React from 'react';
|
|
3
|
+
import { ErrorObject } from 'ajv';
|
|
3
4
|
|
|
4
5
|
declare enum DBStatus {
|
|
5
6
|
LOADING = "LOADING",
|
|
@@ -26,7 +27,7 @@ declare function BasicProvider({ children, project_id, schema, debug }: {
|
|
|
26
27
|
}): react_jsx_runtime.JSX.Element;
|
|
27
28
|
declare function useBasic(): {
|
|
28
29
|
unicorn: string;
|
|
29
|
-
|
|
30
|
+
isAuthReady: boolean;
|
|
30
31
|
isSignedIn: boolean;
|
|
31
32
|
user: User | null;
|
|
32
33
|
signout: () => void;
|
|
@@ -37,6 +38,97 @@ declare function useBasic(): {
|
|
|
37
38
|
dbStatus: DBStatus;
|
|
38
39
|
};
|
|
39
40
|
|
|
41
|
+
declare const basicJsonSchema: {
|
|
42
|
+
$schema: string;
|
|
43
|
+
type: string;
|
|
44
|
+
properties: {
|
|
45
|
+
project_id: {
|
|
46
|
+
type: string;
|
|
47
|
+
};
|
|
48
|
+
namespace: {
|
|
49
|
+
type: string;
|
|
50
|
+
};
|
|
51
|
+
version: {
|
|
52
|
+
type: string;
|
|
53
|
+
minimum: number;
|
|
54
|
+
};
|
|
55
|
+
tables: {
|
|
56
|
+
type: string;
|
|
57
|
+
patternProperties: {
|
|
58
|
+
"^[a-zA-Z0-9_]+$": {
|
|
59
|
+
type: string;
|
|
60
|
+
properties: {
|
|
61
|
+
name: {
|
|
62
|
+
type: string;
|
|
63
|
+
};
|
|
64
|
+
type: {
|
|
65
|
+
type: string;
|
|
66
|
+
enum: string[];
|
|
67
|
+
};
|
|
68
|
+
fields: {
|
|
69
|
+
type: string;
|
|
70
|
+
patternProperties: {
|
|
71
|
+
"^[a-zA-Z0-9_]+$": {
|
|
72
|
+
type: string;
|
|
73
|
+
properties: {
|
|
74
|
+
type: {
|
|
75
|
+
type: string;
|
|
76
|
+
enum: string[];
|
|
77
|
+
};
|
|
78
|
+
indexed: {
|
|
79
|
+
type: string;
|
|
80
|
+
};
|
|
81
|
+
required: {
|
|
82
|
+
type: string;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
required: string[];
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
additionalProperties: boolean;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
required: string[];
|
|
92
|
+
};
|
|
93
|
+
};
|
|
94
|
+
additionalProperties: boolean;
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
required: string[];
|
|
98
|
+
};
|
|
99
|
+
type Schema = typeof basicJsonSchema;
|
|
100
|
+
declare function generateEmptySchema(): void;
|
|
101
|
+
/**
|
|
102
|
+
* Validate a schema
|
|
103
|
+
* only checks if the schema is formatted correctly, not if can be published
|
|
104
|
+
* @param schema - The schema to validate
|
|
105
|
+
* @returns {valid: boolean, errors: any[]} - The validation result
|
|
106
|
+
*/
|
|
107
|
+
declare function validateSchema(schema: Schema): {
|
|
108
|
+
valid: boolean;
|
|
109
|
+
errors: ErrorObject[];
|
|
110
|
+
};
|
|
111
|
+
declare function validateData(schema: any, table: string, data: Record<string, any>, checkRequired?: boolean): {
|
|
112
|
+
valid: boolean;
|
|
113
|
+
errors: ErrorObject<string, Record<string, any>, unknown>[];
|
|
114
|
+
message: string;
|
|
115
|
+
} | {
|
|
116
|
+
valid: boolean;
|
|
117
|
+
errors: {
|
|
118
|
+
message: string;
|
|
119
|
+
}[];
|
|
120
|
+
message: string;
|
|
121
|
+
} | {
|
|
122
|
+
valid: boolean;
|
|
123
|
+
errors: never[];
|
|
124
|
+
message?: undefined;
|
|
125
|
+
};
|
|
126
|
+
|
|
40
127
|
declare function useQuery(queryable: any): any;
|
|
128
|
+
declare const sc: {
|
|
129
|
+
validateSchema: typeof validateSchema;
|
|
130
|
+
validateData: typeof validateData;
|
|
131
|
+
generateEmptySchema: typeof generateEmptySchema;
|
|
132
|
+
};
|
|
41
133
|
|
|
42
|
-
export { BasicProvider, useBasic, useQuery };
|
|
134
|
+
export { BasicProvider, sc, useBasic, useQuery };
|