@agentic-kit/harness 0.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.
Files changed (87) hide show
  1. package/LICENSE +23 -0
  2. package/README.md +176 -0
  3. package/blueprint/blueprint-defaults.d.ts +2 -0
  4. package/blueprint/blueprint-defaults.js +123 -0
  5. package/blueprint/blueprint-schema.d.ts +138 -0
  6. package/blueprint/blueprint-schema.js +86 -0
  7. package/blueprint/field-type.d.ts +25 -0
  8. package/blueprint/field-type.js +99 -0
  9. package/blueprint/internal-policies.d.ts +2 -0
  10. package/blueprint/internal-policies.js +14 -0
  11. package/blueprint/policy-provisioning.d.ts +79 -0
  12. package/blueprint/policy-provisioning.js +570 -0
  13. package/esm/blueprint/blueprint-defaults.d.ts +2 -0
  14. package/esm/blueprint/blueprint-defaults.js +120 -0
  15. package/esm/blueprint/blueprint-schema.d.ts +138 -0
  16. package/esm/blueprint/blueprint-schema.js +83 -0
  17. package/esm/blueprint/field-type.d.ts +25 -0
  18. package/esm/blueprint/field-type.js +94 -0
  19. package/esm/blueprint/internal-policies.d.ts +2 -0
  20. package/esm/blueprint/internal-policies.js +10 -0
  21. package/esm/blueprint/policy-provisioning.d.ts +79 -0
  22. package/esm/blueprint/policy-provisioning.js +553 -0
  23. package/esm/gating/confirm-gate.d.ts +46 -0
  24. package/esm/gating/confirm-gate.js +55 -0
  25. package/esm/gating/decline-guard.d.ts +7 -0
  26. package/esm/gating/decline-guard.js +48 -0
  27. package/esm/gating/preview.d.ts +37 -0
  28. package/esm/gating/preview.js +5 -0
  29. package/esm/gating/prompts.d.ts +8 -0
  30. package/esm/gating/prompts.js +175 -0
  31. package/esm/index.d.ts +20 -0
  32. package/esm/index.js +20 -0
  33. package/esm/skills/fetch.d.ts +31 -0
  34. package/esm/skills/fetch.js +84 -0
  35. package/esm/skills/frontmatter.d.ts +7 -0
  36. package/esm/skills/frontmatter.js +28 -0
  37. package/esm/skills/integrity.d.ts +8 -0
  38. package/esm/skills/integrity.js +28 -0
  39. package/esm/skills/manifest.d.ts +39 -0
  40. package/esm/skills/manifest.js +36 -0
  41. package/esm/skills/materialize.d.ts +13 -0
  42. package/esm/skills/materialize.js +26 -0
  43. package/esm/skills/overlay.d.ts +11 -0
  44. package/esm/skills/overlay.js +25 -0
  45. package/esm/skills/registry.d.ts +36 -0
  46. package/esm/skills/registry.js +30 -0
  47. package/esm/skills/source.d.ts +21 -0
  48. package/esm/skills/source.js +51 -0
  49. package/esm/skills/update-check.d.ts +36 -0
  50. package/esm/skills/update-check.js +74 -0
  51. package/esm/stash.d.ts +20 -0
  52. package/esm/stash.js +19 -0
  53. package/esm/types.d.ts +60 -0
  54. package/esm/types.js +8 -0
  55. package/gating/confirm-gate.d.ts +46 -0
  56. package/gating/confirm-gate.js +58 -0
  57. package/gating/decline-guard.d.ts +7 -0
  58. package/gating/decline-guard.js +52 -0
  59. package/gating/preview.d.ts +37 -0
  60. package/gating/preview.js +6 -0
  61. package/gating/prompts.d.ts +8 -0
  62. package/gating/prompts.js +179 -0
  63. package/index.d.ts +20 -0
  64. package/index.js +36 -0
  65. package/package.json +42 -0
  66. package/skills/fetch.d.ts +31 -0
  67. package/skills/fetch.js +122 -0
  68. package/skills/frontmatter.d.ts +7 -0
  69. package/skills/frontmatter.js +31 -0
  70. package/skills/integrity.d.ts +8 -0
  71. package/skills/integrity.js +64 -0
  72. package/skills/manifest.d.ts +39 -0
  73. package/skills/manifest.js +40 -0
  74. package/skills/materialize.d.ts +13 -0
  75. package/skills/materialize.js +62 -0
  76. package/skills/overlay.d.ts +11 -0
  77. package/skills/overlay.js +28 -0
  78. package/skills/registry.d.ts +36 -0
  79. package/skills/registry.js +34 -0
  80. package/skills/source.d.ts +21 -0
  81. package/skills/source.js +88 -0
  82. package/skills/update-check.d.ts +36 -0
  83. package/skills/update-check.js +110 -0
  84. package/stash.d.ts +20 -0
  85. package/stash.js +55 -0
  86. package/types.d.ts +60 -0
  87. package/types.js +9 -0
@@ -0,0 +1,138 @@
1
+ import { type Static, Type } from 'typebox';
2
+ declare const FieldBlueprint: Type.TObject<{
3
+ name: Type.TString;
4
+ type: Type.TString;
5
+ is_required: Type.TOptional<Type.TBoolean>;
6
+ default: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
7
+ }>;
8
+ declare const PolicyBlueprint: Type.TObject<{
9
+ $type: Type.TString;
10
+ data: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
11
+ privileges: Type.TOptional<Type.TArray<Type.TString>>;
12
+ policy_role: Type.TOptional<Type.TString>;
13
+ permissive: Type.TOptional<Type.TBoolean>;
14
+ }>;
15
+ declare const NodeBlueprint: Type.TUnion<[Type.TString, Type.TObject<{
16
+ $type: Type.TString;
17
+ data: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
18
+ }>]>;
19
+ declare const RelationBlueprint: Type.TUnion<[Type.TObject<{
20
+ $type: Type.TLiteral<"RelationBelongsTo">;
21
+ source_table: Type.TString;
22
+ target_table: Type.TString;
23
+ field_name: Type.TString;
24
+ delete_action: Type.TOptional<Type.TUnion<[Type.TLiteral<"c">, Type.TLiteral<"r">, Type.TLiteral<"n">, Type.TLiteral<"a">, Type.TLiteral<"d">]>>;
25
+ is_required: Type.TOptional<Type.TBoolean>;
26
+ }>, Type.TObject<{
27
+ $type: Type.TLiteral<"RelationManyToMany">;
28
+ source_table: Type.TString;
29
+ target_table: Type.TString;
30
+ junction_table_name: Type.TString;
31
+ delete_action: Type.TOptional<Type.TUnion<[Type.TLiteral<"c">, Type.TLiteral<"r">, Type.TLiteral<"n">, Type.TLiteral<"a">, Type.TLiteral<"d">]>>;
32
+ }>]>;
33
+ declare const TableBlueprint: Type.TObject<{
34
+ table_name: Type.TString;
35
+ nodes: Type.TOptional<Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
36
+ $type: Type.TString;
37
+ data: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
38
+ }>]>>>;
39
+ fields: Type.TOptional<Type.TArray<Type.TObject<{
40
+ name: Type.TString;
41
+ type: Type.TString;
42
+ is_required: Type.TOptional<Type.TBoolean>;
43
+ default: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
44
+ }>>>;
45
+ policies: Type.TArray<Type.TObject<{
46
+ $type: Type.TString;
47
+ data: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
48
+ privileges: Type.TOptional<Type.TArray<Type.TString>>;
49
+ policy_role: Type.TOptional<Type.TString>;
50
+ permissive: Type.TOptional<Type.TBoolean>;
51
+ }>>;
52
+ }>;
53
+ export declare const BlueprintDefinitionSchema: Type.TObject<{
54
+ tables: Type.TArray<Type.TObject<{
55
+ table_name: Type.TString;
56
+ nodes: Type.TOptional<Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
57
+ $type: Type.TString;
58
+ data: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
59
+ }>]>>>;
60
+ fields: Type.TOptional<Type.TArray<Type.TObject<{
61
+ name: Type.TString;
62
+ type: Type.TString;
63
+ is_required: Type.TOptional<Type.TBoolean>;
64
+ default: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
65
+ }>>>;
66
+ policies: Type.TArray<Type.TObject<{
67
+ $type: Type.TString;
68
+ data: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
69
+ privileges: Type.TOptional<Type.TArray<Type.TString>>;
70
+ policy_role: Type.TOptional<Type.TString>;
71
+ permissive: Type.TOptional<Type.TBoolean>;
72
+ }>>;
73
+ }>>;
74
+ relations: Type.TOptional<Type.TArray<Type.TUnion<[Type.TObject<{
75
+ $type: Type.TLiteral<"RelationBelongsTo">;
76
+ source_table: Type.TString;
77
+ target_table: Type.TString;
78
+ field_name: Type.TString;
79
+ delete_action: Type.TOptional<Type.TUnion<[Type.TLiteral<"c">, Type.TLiteral<"r">, Type.TLiteral<"n">, Type.TLiteral<"a">, Type.TLiteral<"d">]>>;
80
+ is_required: Type.TOptional<Type.TBoolean>;
81
+ }>, Type.TObject<{
82
+ $type: Type.TLiteral<"RelationManyToMany">;
83
+ source_table: Type.TString;
84
+ target_table: Type.TString;
85
+ junction_table_name: Type.TString;
86
+ delete_action: Type.TOptional<Type.TUnion<[Type.TLiteral<"c">, Type.TLiteral<"r">, Type.TLiteral<"n">, Type.TLiteral<"a">, Type.TLiteral<"d">]>>;
87
+ }>]>>>;
88
+ }>;
89
+ export declare const BlueprintSchema: Type.TObject<{
90
+ name: Type.TString;
91
+ description: Type.TString;
92
+ definition: Type.TObject<{
93
+ tables: Type.TArray<Type.TObject<{
94
+ table_name: Type.TString;
95
+ nodes: Type.TOptional<Type.TArray<Type.TUnion<[Type.TString, Type.TObject<{
96
+ $type: Type.TString;
97
+ data: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
98
+ }>]>>>;
99
+ fields: Type.TOptional<Type.TArray<Type.TObject<{
100
+ name: Type.TString;
101
+ type: Type.TString;
102
+ is_required: Type.TOptional<Type.TBoolean>;
103
+ default: Type.TOptional<Type.TUnion<[Type.TString, Type.TNull]>>;
104
+ }>>>;
105
+ policies: Type.TArray<Type.TObject<{
106
+ $type: Type.TString;
107
+ data: Type.TOptional<Type.TRecord<"^.*$", Type.TUnknown>>;
108
+ privileges: Type.TOptional<Type.TArray<Type.TString>>;
109
+ policy_role: Type.TOptional<Type.TString>;
110
+ permissive: Type.TOptional<Type.TBoolean>;
111
+ }>>;
112
+ }>>;
113
+ relations: Type.TOptional<Type.TArray<Type.TUnion<[Type.TObject<{
114
+ $type: Type.TLiteral<"RelationBelongsTo">;
115
+ source_table: Type.TString;
116
+ target_table: Type.TString;
117
+ field_name: Type.TString;
118
+ delete_action: Type.TOptional<Type.TUnion<[Type.TLiteral<"c">, Type.TLiteral<"r">, Type.TLiteral<"n">, Type.TLiteral<"a">, Type.TLiteral<"d">]>>;
119
+ is_required: Type.TOptional<Type.TBoolean>;
120
+ }>, Type.TObject<{
121
+ $type: Type.TLiteral<"RelationManyToMany">;
122
+ source_table: Type.TString;
123
+ target_table: Type.TString;
124
+ junction_table_name: Type.TString;
125
+ delete_action: Type.TOptional<Type.TUnion<[Type.TLiteral<"c">, Type.TLiteral<"r">, Type.TLiteral<"n">, Type.TLiteral<"a">, Type.TLiteral<"d">]>>;
126
+ }>]>>>;
127
+ }>;
128
+ categories: Type.TOptional<Type.TArray<Type.TString>>;
129
+ tags: Type.TOptional<Type.TArray<Type.TString>>;
130
+ }>;
131
+ export type Blueprint = Static<typeof BlueprintSchema>;
132
+ export type BlueprintDefinition = Static<typeof BlueprintDefinitionSchema>;
133
+ export type TableBlueprint = Static<typeof TableBlueprint>;
134
+ export type FieldBlueprint = Static<typeof FieldBlueprint>;
135
+ export type PolicyBlueprint = Static<typeof PolicyBlueprint>;
136
+ export type RelationBlueprint = Static<typeof RelationBlueprint>;
137
+ export type NodeBlueprint = Static<typeof NodeBlueprint>;
138
+ export {};
@@ -0,0 +1,83 @@
1
+ import { Type } from 'typebox';
2
+ const FieldBlueprint = Type.Object({
3
+ name: Type.String({ description: 'Field name in snake_case' }),
4
+ type: Type.String({
5
+ description: 'PostgreSQL type: uuid, text, integer, smallint, numeric, boolean, date, timestamp, timestamptz, time, json, jsonb, inet, citext, email, url, image, upload',
6
+ }),
7
+ is_required: Type.Optional(Type.Boolean({ description: 'Whether the field is NOT NULL' })),
8
+ default: Type.Optional(Type.Union([Type.String(), Type.Null()], {
9
+ description: 'SQL default expression, e.g. "uuidv7()", "now()", "\'draft\'"',
10
+ })),
11
+ });
12
+ const PolicyBlueprint = Type.Object({
13
+ $type: Type.String({
14
+ description: 'Policy type: AuthzDirectOwner, AuthzEntityMembership, AuthzAllowAll, AuthzPublishable, AuthzAppMembership',
15
+ }),
16
+ data: Type.Optional(Type.Record(Type.String(), Type.Unknown(), { description: 'Policy config overrides' })),
17
+ privileges: Type.Optional(Type.Array(Type.String(), {
18
+ description: 'SQL privileges this policy applies to, lowercase, e.g. ["select","insert","update","delete"]. Defaults to all.',
19
+ })),
20
+ policy_role: Type.Optional(Type.String({ description: 'Role name. Defaults to "authenticated".' })),
21
+ permissive: Type.Optional(Type.Boolean({
22
+ description: 'Whether permissive (true) or restrictive (false). Defaults to true.',
23
+ })),
24
+ });
25
+ const NodeBlueprint = Type.Union([
26
+ Type.String({ description: 'Node type shorthand, e.g. "DataTimestamps"' }),
27
+ Type.Object({
28
+ $type: Type.String({ description: 'Node type, e.g. "DataDirectOwner"' }),
29
+ data: Type.Optional(Type.Record(Type.String(), Type.Unknown(), { description: 'Node configuration data' })),
30
+ }),
31
+ ]);
32
+ const DeleteAction = Type.Union([
33
+ Type.Literal('c'),
34
+ Type.Literal('r'),
35
+ Type.Literal('n'),
36
+ Type.Literal('a'),
37
+ Type.Literal('d'),
38
+ ], {
39
+ description: 'FK delete action: c=CASCADE, r=RESTRICT, n=SET NULL, a=NO ACTION (default), d=SET DEFAULT',
40
+ });
41
+ const BelongsToRelation = Type.Object({
42
+ $type: Type.Literal('RelationBelongsTo'),
43
+ source_table: Type.String({ description: 'Source table name' }),
44
+ target_table: Type.String({ description: 'Target table name' }),
45
+ field_name: Type.String({ description: 'FK column name on the source table, e.g. "author_id"' }),
46
+ delete_action: Type.Optional(DeleteAction),
47
+ is_required: Type.Optional(Type.Boolean({ description: 'Whether the FK is NOT NULL (default: true)' })),
48
+ });
49
+ const ManyToManyRelation = Type.Object({
50
+ $type: Type.Literal('RelationManyToMany'),
51
+ source_table: Type.String({ description: 'Source table name' }),
52
+ target_table: Type.String({ description: 'Target table name' }),
53
+ junction_table_name: Type.String({ description: 'Junction table name, e.g. "post_tags"' }),
54
+ delete_action: Type.Optional(DeleteAction),
55
+ });
56
+ const RelationBlueprint = Type.Union([BelongsToRelation, ManyToManyRelation]);
57
+ const TableBlueprint = Type.Object({
58
+ table_name: Type.String({ description: 'PostgreSQL table name in snake_case, plural' }),
59
+ nodes: Type.Optional(Type.Array(NodeBlueprint, {
60
+ description: 'Data behavior nodes (e.g. DataTimestamps, DataSoftDelete). DataId and DataTimestamps are auto-included.',
61
+ })),
62
+ fields: Type.Optional(Type.Array(FieldBlueprint, {
63
+ description: 'Custom fields only — do NOT include id, timestamps, or node-generated fields (owner_id, entity_id, is_published, published_at)',
64
+ })),
65
+ policies: Type.Array(PolicyBlueprint, {
66
+ description: 'RLS policies for this table. At least one required.',
67
+ }),
68
+ });
69
+ export const BlueprintDefinitionSchema = Type.Object({
70
+ tables: Type.Array(TableBlueprint, { description: 'Tables to create' }),
71
+ relations: Type.Optional(Type.Array(RelationBlueprint, { description: 'Relations between tables' })),
72
+ });
73
+ export const BlueprintSchema = Type.Object({
74
+ name: Type.String({ description: 'Blueprint name in snake_case' }),
75
+ description: Type.String({ description: 'Brief description of what this schema is for' }),
76
+ definition: BlueprintDefinitionSchema,
77
+ categories: Type.Optional(Type.Array(Type.String(), {
78
+ description: 'Template categories if saved as template, e.g. ["e-commerce", "healthcare"]',
79
+ })),
80
+ tags: Type.Optional(Type.Array(Type.String(), {
81
+ description: 'Freeform search tags if saved as template, e.g. ["products", "orders"]',
82
+ })),
83
+ });
@@ -0,0 +1,25 @@
1
+ export interface FieldType {
2
+ name: string;
3
+ schema?: string;
4
+ args?: (string | number | boolean)[];
5
+ array_dimensions?: number;
6
+ range?: string[];
7
+ }
8
+ export type FieldDefault = {
9
+ value: string | number | boolean | null | unknown[] | Record<string, unknown>;
10
+ cast?: FieldType;
11
+ } | {
12
+ function: string;
13
+ schema?: string;
14
+ args?: (FieldDefault | string | number | boolean | null)[];
15
+ cast?: FieldType;
16
+ } | {
17
+ operator: '+' | '-';
18
+ left: FieldDefault;
19
+ right: FieldDefault;
20
+ } | {
21
+ sql_keyword: string;
22
+ };
23
+ export declare function fieldTypeToTypeName(t: unknown): string;
24
+ export declare function toFieldType(typeName: string): FieldType;
25
+ export declare function toFieldDefault(def?: string | null): FieldDefault | undefined;
@@ -0,0 +1,94 @@
1
+ const SQL_KEYWORDS = new Set([
2
+ 'CURRENT_TIMESTAMP',
3
+ 'CURRENT_DATE',
4
+ 'CURRENT_TIME',
5
+ 'LOCALTIME',
6
+ 'LOCALTIMESTAMP',
7
+ 'CURRENT_ROLE',
8
+ 'CURRENT_USER',
9
+ 'SESSION_USER',
10
+ 'USER',
11
+ 'CURRENT_CATALOG',
12
+ 'CURRENT_SCHEMA',
13
+ ]);
14
+ export function fieldTypeToTypeName(t) {
15
+ if (t == null)
16
+ return '';
17
+ if (typeof t === 'string')
18
+ return t;
19
+ if (typeof t === 'object') {
20
+ const obj = t;
21
+ if (typeof obj.name === 'string') {
22
+ const dims = typeof obj.array_dimensions === 'number' && obj.array_dimensions > 0
23
+ ? obj.array_dimensions
24
+ : 0;
25
+ return obj.name + '[]'.repeat(dims);
26
+ }
27
+ }
28
+ return '';
29
+ }
30
+ export function toFieldType(typeName) {
31
+ const raw = (typeName ?? '').trim();
32
+ let base = raw;
33
+ let dims = 0;
34
+ while (base.endsWith('[]')) {
35
+ base = base.slice(0, -2);
36
+ dims += 1;
37
+ }
38
+ base = base.trim();
39
+ const result = { name: base };
40
+ if (dims > 0)
41
+ result.array_dimensions = dims;
42
+ return result;
43
+ }
44
+ function parseScalarLiteral(token) {
45
+ const t = token.trim();
46
+ if (t === '')
47
+ return '';
48
+ if (t === 'true')
49
+ return true;
50
+ if (t === 'false')
51
+ return false;
52
+ if (t.toLowerCase() === 'null')
53
+ return null;
54
+ if (/^-?\d+(\.\d+)?$/.test(t))
55
+ return Number(t);
56
+ if ((t.startsWith("'") && t.endsWith("'")) || (t.startsWith('"') && t.endsWith('"'))) {
57
+ return t.slice(1, -1);
58
+ }
59
+ return t;
60
+ }
61
+ export function toFieldDefault(def) {
62
+ if (def === undefined || def === null)
63
+ return undefined;
64
+ const raw = String(def).trim();
65
+ if (raw === '')
66
+ return undefined;
67
+ if (SQL_KEYWORDS.has(raw.toUpperCase())) {
68
+ return { sql_keyword: raw.toUpperCase() };
69
+ }
70
+ const fnMatch = raw.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\s*\(([\s\S]*)\)$/);
71
+ if (fnMatch) {
72
+ const fnName = fnMatch[1];
73
+ const argsRaw = fnMatch[2].trim();
74
+ const result = {
75
+ function: fnName,
76
+ };
77
+ if (argsRaw !== '') {
78
+ const args = argsRaw.split(',').map((a) => parseScalarLiteral(a));
79
+ if (args.length > 0)
80
+ result.args = args;
81
+ }
82
+ return result;
83
+ }
84
+ if (raw === 'true')
85
+ return { value: true };
86
+ if (raw === 'false')
87
+ return { value: false };
88
+ if (/^-?\d+(\.\d+)?$/.test(raw))
89
+ return { value: Number(raw) };
90
+ if ((raw.startsWith("'") && raw.endsWith("'")) || (raw.startsWith('"') && raw.endsWith('"'))) {
91
+ return { value: raw.slice(1, -1) };
92
+ }
93
+ return { value: raw };
94
+ }
@@ -0,0 +1,2 @@
1
+ export declare function isInternalPolicy(policyType: string | null | undefined): boolean;
2
+ export declare function filterInternalPolicies(policyTypes: string[]): string[];
@@ -0,0 +1,10 @@
1
+ // System-managed policies that the platform attaches automatically; they are
2
+ // noise in a schema overview and not something the agent can act on, so they
3
+ // are hidden from both the agent's tool output and the UI policy pills.
4
+ const INTERNAL_POLICY_TYPES = new Set(['AuthzNotReadOnly']);
5
+ export function isInternalPolicy(policyType) {
6
+ return !policyType || INTERNAL_POLICY_TYPES.has(policyType);
7
+ }
8
+ export function filterInternalPolicies(policyTypes) {
9
+ return policyTypes.filter((type) => !isInternalPolicy(type));
10
+ }
@@ -0,0 +1,79 @@
1
+ /**
2
+ * VENDORED — verbatim from @constructive-io/data (workspace-only, unpublished):
3
+ * constructive-client/packages/data/src/policy-provisioning.ts
4
+ *
5
+ * Zero-import pure-config module. Vendored because the package is not published
6
+ * to npm. Keep in sync with the upstream source. Do not edit by hand except to
7
+ * re-sync from upstream.
8
+ */
9
+ export declare const MEMBERSHIP_TYPES: {
10
+ readonly APP: 1;
11
+ readonly ORGANIZATION: 2;
12
+ readonly GROUP: 3;
13
+ };
14
+ export type PolicyFieldType = 'string' | 'boolean' | 'integer' | 'uuid' | 'uuid[]';
15
+ export type PolicyFieldComponent = 'table-select' | 'membership-type-select' | 'permission-select';
16
+ export type PolicyProvisioningCategory = 'has-module' | 'needs-fields' | 'needs-table' | 'no-fields';
17
+ export interface PolicyFieldOverride {
18
+ type?: PolicyFieldType;
19
+ component?: PolicyFieldComponent;
20
+ label?: string;
21
+ placeholder?: string;
22
+ description?: string;
23
+ defaultValue?: unknown;
24
+ required?: boolean;
25
+ hidden?: boolean;
26
+ pgType?: 'uuid' | 'uuid[]' | 'timestamptz' | 'boolean';
27
+ dependsOn?: string;
28
+ options?: {
29
+ value: string;
30
+ label: string;
31
+ description?: string;
32
+ }[];
33
+ }
34
+ export interface PolicyProvisioningConfig {
35
+ category: PolicyProvisioningCategory;
36
+ hasDataNode: boolean;
37
+ dataNodeType?: string;
38
+ fieldOverrides?: Record<string, PolicyFieldOverride>;
39
+ disabled?: boolean;
40
+ }
41
+ export interface GeneratedField {
42
+ name: string;
43
+ type: string;
44
+ nullable: boolean;
45
+ description: string;
46
+ }
47
+ export type CrudOperation = 'create' | 'read' | 'update' | 'delete';
48
+ export interface CrudOperationPolicyConfig {
49
+ roleName: string;
50
+ isPermissive: boolean;
51
+ }
52
+ export interface GroupedCrudPrivileges {
53
+ roleName: string;
54
+ isPermissive: boolean;
55
+ privileges: string[];
56
+ }
57
+ export declare const CRUD_OPERATIONS: CrudOperation[];
58
+ export declare const CRUD_TO_PRIVILEGE: Record<CrudOperation, string>;
59
+ export declare const DEFAULT_CRUD_GRANT_PRIVILEGES: Record<string, unknown>[];
60
+ export declare const POLICY_PROVISIONING_CONFIG: Record<string, PolicyProvisioningConfig>;
61
+ export declare const DATA_NODE_GENERATED_FIELDS: Record<string, GeneratedField[]>;
62
+ export declare function getPolicyProvisioningConfig(policyType: string): PolicyProvisioningConfig | undefined;
63
+ export declare function getPolicyCategory(policyType: string): PolicyProvisioningCategory;
64
+ export declare function getDataNodeForPolicy(policyType: string): string | undefined;
65
+ export declare function policyRequiresDataNode(policyType: string): boolean;
66
+ export declare function policyCanBeNodeless(policyType: string): boolean;
67
+ export declare function getGeneratedFields(dataNodeType: string): GeneratedField[];
68
+ export declare function hasGeneratedFields(dataNodeType: string): boolean;
69
+ export declare function getPolicyFieldDefaults(policyType: string): Record<string, unknown>;
70
+ export declare function getFieldsRequiringColumns(policyType: string): {
71
+ key: string;
72
+ defaultName: string | string[];
73
+ pgType: NonNullable<PolicyFieldOverride['pgType']>;
74
+ }[];
75
+ export declare function sanitizePolicyData(data: Record<string, unknown>): Record<string, unknown>;
76
+ export declare function injectSchemaFields(policyData: Record<string, unknown>, schemaId: string, policyType: string): Record<string, unknown>;
77
+ export declare function buildNodeDataForDataNodeType(dataNodeType: string | undefined, policyData: Record<string, unknown>): Record<string, unknown>;
78
+ export declare function buildNodeData(policyType: string, policyData: Record<string, unknown>): Record<string, unknown>;
79
+ export declare function groupCrudOperationsByConfig<T extends string>(enabledOperations: T[], operations: Record<T, CrudOperationPolicyConfig>, privilegeMap: Record<T, string>): GroupedCrudPrivileges[];