@constructive-io/schema-builder 0.2.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.
- package/CHANGELOG.md +26 -0
- package/LICENSE +21 -0
- package/README.md +33 -0
- package/dist/core.cjs +213 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +54 -0
- package/dist/core.d.ts +54 -0
- package/dist/core.js +202 -0
- package/dist/core.js.map +1 -0
- package/dist/fields.cjs +7764 -0
- package/dist/fields.cjs.map +1 -0
- package/dist/fields.d.cts +49 -0
- package/dist/fields.d.ts +49 -0
- package/dist/fields.js +7737 -0
- package/dist/fields.js.map +1 -0
- package/dist/generated-types-CnAlqHU_.d.cts +25 -0
- package/dist/generated-types-CnAlqHU_.d.ts +25 -0
- package/dist/index.cjs +13752 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +13720 -0
- package/dist/index.js.map +1 -0
- package/dist/indexes.cjs +1043 -0
- package/dist/indexes.cjs.map +1 -0
- package/dist/indexes.d.cts +36 -0
- package/dist/indexes.d.ts +36 -0
- package/dist/indexes.js +1018 -0
- package/dist/indexes.js.map +1 -0
- package/dist/policies.cjs +5940 -0
- package/dist/policies.cjs.map +1 -0
- package/dist/policies.d.cts +103 -0
- package/dist/policies.d.ts +103 -0
- package/dist/policies.js +5913 -0
- package/dist/policies.js.map +1 -0
- package/dist/policy-types-CEYAR5TN.d.cts +79 -0
- package/dist/policy-types-CEYAR5TN.d.ts +79 -0
- package/dist/relationships.cjs +4329 -0
- package/dist/relationships.cjs.map +1 -0
- package/dist/relationships.d.cts +121 -0
- package/dist/relationships.d.ts +121 -0
- package/dist/relationships.js +4302 -0
- package/dist/relationships.js.map +1 -0
- package/dist/tables.cjs +5645 -0
- package/dist/tables.cjs.map +1 -0
- package/dist/tables.d.cts +29 -0
- package/dist/tables.d.ts +29 -0
- package/dist/tables.js +5620 -0
- package/dist/tables.js.map +1 -0
- package/dist/testing.cjs +69 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +7 -0
- package/dist/testing.d.ts +7 -0
- package/dist/testing.js +67 -0
- package/dist/testing.js.map +1 -0
- package/dist/types-Du86atZ8.d.cts +199 -0
- package/dist/types-Du86atZ8.d.ts +199 -0
- package/dist/types-bX2dCrdl.d.cts +52 -0
- package/dist/types-bX2dCrdl.d.ts +52 -0
- package/package.json +165 -0
- package/src/styles.css +2 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { CardComponent } from '@constructive-io/ui/stack';
|
|
3
|
+
import { C as CrudOperation } from './policy-types-CEYAR5TN.cjs';
|
|
4
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
|
+
import { a as GeneratedMutationResult } from './generated-types-CnAlqHU_.cjs';
|
|
6
|
+
export { p as SchemaBuilderPoliciesCapabilities } from './types-Du86atZ8.cjs';
|
|
7
|
+
import 'lucide-react';
|
|
8
|
+
|
|
9
|
+
declare function PoliciesView(): react.JSX.Element;
|
|
10
|
+
|
|
11
|
+
interface TablePolicyConfigCardProps {
|
|
12
|
+
/** If provided, skip table creation and create policies for this existing table */
|
|
13
|
+
tableId?: string;
|
|
14
|
+
tableName: string;
|
|
15
|
+
selectedPolicyType: string;
|
|
16
|
+
/** Pre-select only this operation in the config step */
|
|
17
|
+
preSelectedOperation?: CrudOperation;
|
|
18
|
+
onTableCreated?: (table: {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
}) => void;
|
|
22
|
+
/** Called when policies are created for an existing table (when tableId is provided) */
|
|
23
|
+
onPoliciesCreated?: () => void;
|
|
24
|
+
onComplete?: () => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Config card for table policy settings.
|
|
28
|
+
* Shows access rule config and creates all 4 CRUD operation policies by default.
|
|
29
|
+
*/
|
|
30
|
+
declare const TablePolicyConfigCard: CardComponent<TablePolicyConfigCardProps>;
|
|
31
|
+
|
|
32
|
+
interface PermissionNode {
|
|
33
|
+
bitnum: number | null;
|
|
34
|
+
bitstr: string | null;
|
|
35
|
+
description: string | null;
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
}
|
|
39
|
+
type AppPermission = PermissionNode;
|
|
40
|
+
type MembershipPermission = PermissionNode;
|
|
41
|
+
interface UsePermissionsOptions {
|
|
42
|
+
enabled?: boolean;
|
|
43
|
+
}
|
|
44
|
+
declare function usePermissions(options?: UsePermissionsOptions): _tanstack_react_query.UseQueryResult<NoInfer<{
|
|
45
|
+
appPermissions: AppPermission[];
|
|
46
|
+
membershipPermissions: MembershipPermission[];
|
|
47
|
+
}>, Error>;
|
|
48
|
+
|
|
49
|
+
interface CreateTableGrantInput {
|
|
50
|
+
databaseId: string;
|
|
51
|
+
tableName: string;
|
|
52
|
+
privileges: string[];
|
|
53
|
+
fieldNames?: string[];
|
|
54
|
+
roleName?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Hook for creating table grants (permissions).
|
|
58
|
+
* Supports both table-level grants (all fields) and field-level grants (specific fields).
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* // Table-level grant (all fields)
|
|
62
|
+
* createGrant({
|
|
63
|
+
* databaseId: 'xxx',
|
|
64
|
+
* tableName: 'products',
|
|
65
|
+
* privileges: ['select', 'delete']
|
|
66
|
+
* })
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* // Field-level grant (specific fields only)
|
|
70
|
+
* createGrant({
|
|
71
|
+
* databaseId: 'xxx',
|
|
72
|
+
* tableName: 'products',
|
|
73
|
+
* privileges: ['insert'],
|
|
74
|
+
* fieldNames: ['name', 'description', 'price']
|
|
75
|
+
* })
|
|
76
|
+
*/
|
|
77
|
+
declare function useCreateTableGrant(): _tanstack_react_query.UseMutationResult<GeneratedMutationResult[], Error, CreateTableGrantInput, unknown>;
|
|
78
|
+
/**
|
|
79
|
+
* Hook for creating multiple table grants in batch.
|
|
80
|
+
* Useful when setting up a new table with standard permissions.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* batchCreateGrants({
|
|
84
|
+
* databaseId: 'xxx',
|
|
85
|
+
* tableName: 'products',
|
|
86
|
+
* grants: [
|
|
87
|
+
* { privileges: ['select', 'delete'] }, // All fields
|
|
88
|
+
* { privileges: ['insert'], fieldNames: ['name', 'price'] }, // Specific fields
|
|
89
|
+
* { privileges: ['update'], fieldNames: ['name', 'description'] },
|
|
90
|
+
* ]
|
|
91
|
+
* })
|
|
92
|
+
*/
|
|
93
|
+
declare function useBatchCreateTableGrants(): _tanstack_react_query.UseMutationResult<GeneratedMutationResult[][], Error, {
|
|
94
|
+
databaseId: string;
|
|
95
|
+
tableName: string;
|
|
96
|
+
grants: Array<{
|
|
97
|
+
privileges: string[];
|
|
98
|
+
fieldNames?: string[];
|
|
99
|
+
roleName?: string;
|
|
100
|
+
}>;
|
|
101
|
+
}, unknown>;
|
|
102
|
+
|
|
103
|
+
export { type CreateTableGrantInput, PoliciesView, TablePolicyConfigCard, useBatchCreateTableGrants, useCreateTableGrant, usePermissions };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { CardComponent } from '@constructive-io/ui/stack';
|
|
3
|
+
import { C as CrudOperation } from './policy-types-CEYAR5TN.js';
|
|
4
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
5
|
+
import { a as GeneratedMutationResult } from './generated-types-CnAlqHU_.js';
|
|
6
|
+
export { p as SchemaBuilderPoliciesCapabilities } from './types-Du86atZ8.js';
|
|
7
|
+
import 'lucide-react';
|
|
8
|
+
|
|
9
|
+
declare function PoliciesView(): react.JSX.Element;
|
|
10
|
+
|
|
11
|
+
interface TablePolicyConfigCardProps {
|
|
12
|
+
/** If provided, skip table creation and create policies for this existing table */
|
|
13
|
+
tableId?: string;
|
|
14
|
+
tableName: string;
|
|
15
|
+
selectedPolicyType: string;
|
|
16
|
+
/** Pre-select only this operation in the config step */
|
|
17
|
+
preSelectedOperation?: CrudOperation;
|
|
18
|
+
onTableCreated?: (table: {
|
|
19
|
+
id: string;
|
|
20
|
+
name: string;
|
|
21
|
+
}) => void;
|
|
22
|
+
/** Called when policies are created for an existing table (when tableId is provided) */
|
|
23
|
+
onPoliciesCreated?: () => void;
|
|
24
|
+
onComplete?: () => void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Config card for table policy settings.
|
|
28
|
+
* Shows access rule config and creates all 4 CRUD operation policies by default.
|
|
29
|
+
*/
|
|
30
|
+
declare const TablePolicyConfigCard: CardComponent<TablePolicyConfigCardProps>;
|
|
31
|
+
|
|
32
|
+
interface PermissionNode {
|
|
33
|
+
bitnum: number | null;
|
|
34
|
+
bitstr: string | null;
|
|
35
|
+
description: string | null;
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
}
|
|
39
|
+
type AppPermission = PermissionNode;
|
|
40
|
+
type MembershipPermission = PermissionNode;
|
|
41
|
+
interface UsePermissionsOptions {
|
|
42
|
+
enabled?: boolean;
|
|
43
|
+
}
|
|
44
|
+
declare function usePermissions(options?: UsePermissionsOptions): _tanstack_react_query.UseQueryResult<NoInfer<{
|
|
45
|
+
appPermissions: AppPermission[];
|
|
46
|
+
membershipPermissions: MembershipPermission[];
|
|
47
|
+
}>, Error>;
|
|
48
|
+
|
|
49
|
+
interface CreateTableGrantInput {
|
|
50
|
+
databaseId: string;
|
|
51
|
+
tableName: string;
|
|
52
|
+
privileges: string[];
|
|
53
|
+
fieldNames?: string[];
|
|
54
|
+
roleName?: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Hook for creating table grants (permissions).
|
|
58
|
+
* Supports both table-level grants (all fields) and field-level grants (specific fields).
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* // Table-level grant (all fields)
|
|
62
|
+
* createGrant({
|
|
63
|
+
* databaseId: 'xxx',
|
|
64
|
+
* tableName: 'products',
|
|
65
|
+
* privileges: ['select', 'delete']
|
|
66
|
+
* })
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* // Field-level grant (specific fields only)
|
|
70
|
+
* createGrant({
|
|
71
|
+
* databaseId: 'xxx',
|
|
72
|
+
* tableName: 'products',
|
|
73
|
+
* privileges: ['insert'],
|
|
74
|
+
* fieldNames: ['name', 'description', 'price']
|
|
75
|
+
* })
|
|
76
|
+
*/
|
|
77
|
+
declare function useCreateTableGrant(): _tanstack_react_query.UseMutationResult<GeneratedMutationResult[], Error, CreateTableGrantInput, unknown>;
|
|
78
|
+
/**
|
|
79
|
+
* Hook for creating multiple table grants in batch.
|
|
80
|
+
* Useful when setting up a new table with standard permissions.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* batchCreateGrants({
|
|
84
|
+
* databaseId: 'xxx',
|
|
85
|
+
* tableName: 'products',
|
|
86
|
+
* grants: [
|
|
87
|
+
* { privileges: ['select', 'delete'] }, // All fields
|
|
88
|
+
* { privileges: ['insert'], fieldNames: ['name', 'price'] }, // Specific fields
|
|
89
|
+
* { privileges: ['update'], fieldNames: ['name', 'description'] },
|
|
90
|
+
* ]
|
|
91
|
+
* })
|
|
92
|
+
*/
|
|
93
|
+
declare function useBatchCreateTableGrants(): _tanstack_react_query.UseMutationResult<GeneratedMutationResult[][], Error, {
|
|
94
|
+
databaseId: string;
|
|
95
|
+
tableName: string;
|
|
96
|
+
grants: Array<{
|
|
97
|
+
privileges: string[];
|
|
98
|
+
fieldNames?: string[];
|
|
99
|
+
roleName?: string;
|
|
100
|
+
}>;
|
|
101
|
+
}, unknown>;
|
|
102
|
+
|
|
103
|
+
export { type CreateTableGrantInput, PoliciesView, TablePolicyConfigCard, useBatchCreateTableGrants, useCreateTableGrant, usePermissions };
|