@narrative.io/data-collaboration-sdk-ts 2.101.0 → 2.101.1-beta.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/build/apps/index.d.ts +7 -0
- package/build/apps/index.js +9 -0
- package/build/collaboration-policy/core/filter-builder.js +7 -1
- package/build/collaboration-policy/core/jsonschema/json-schema-types.d.ts +45 -0
- package/build/collaboration-policy/core/jsonschema/json-schema-types.js +1 -0
- package/build/collaboration-policy/core/jsonschema/policy-branches.d.ts +49 -0
- package/build/collaboration-policy/core/jsonschema/policy-branches.js +1 -0
- package/build/collaboration-policy/core/jsonschema/policy-evaluator.d.ts +22 -0
- package/build/collaboration-policy/core/jsonschema/policy-evaluator.js +250 -0
- package/build/collaboration-policy/core/jsonschema/sql-builder.d.ts +79 -0
- package/build/collaboration-policy/core/jsonschema/sql-builder.js +306 -0
- package/build/collaboration-policy/core/jsonschema/sql-poc.d.ts +79 -0
- package/build/collaboration-policy/core/jsonschema/sql-poc.js +305 -0
- package/build/collaboration-policy/core/types.d.ts +81 -10
- package/build/collaboration-policy/index.d.ts +5 -4
- package/build/collaboration-policy/index.js +4 -3
- package/build/collaboration-policy/types/collaboration-policy.d.ts +20 -20
- package/build/collaboration-policy/useCollaborationPolicy.d.ts +13 -4
- package/build/collaboration-policy/useCollaborationPolicy.js +23 -1
- package/build/collaboration-policy/utils/path-helpers.d.ts +7 -3
- package/build/collaboration-policy/utils/path-helpers.js +6 -22
- package/build/datasets/index.d.ts +11 -2
- package/build/datasets/index.js +12 -0
- package/build/datasets/types.d.ts +25 -0
- package/build/nql/SubstraitParser.d.ts +771 -0
- package/build/nql/SubstraitParser.js +797 -0
- package/build/nql/types.d.ts +8 -8
- package/package.json +2 -1
|
@@ -1,20 +1,91 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
/**
|
|
2
|
+
* PathValue describes a path to a subfield, expressed as either dot notation
|
|
3
|
+
* or a JSON Pointer. Used in filter attribute references to specify which
|
|
4
|
+
* subfield of an attribute to operate on.
|
|
5
|
+
*/
|
|
6
|
+
export type PathValue = {
|
|
7
|
+
dot: string;
|
|
8
|
+
} | {
|
|
9
|
+
pointer: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* An attribute reference within a filter expression.
|
|
13
|
+
*/
|
|
14
|
+
export interface FilterAttributeRef {
|
|
15
|
+
type: "attribute";
|
|
16
|
+
attribute_name: string;
|
|
17
|
+
path?: PathValue;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A filter expression: a literal value or an attribute reference.
|
|
21
|
+
*/
|
|
22
|
+
export type FilterExpression = string | number | boolean | FilterAttributeRef;
|
|
23
|
+
/**
|
|
24
|
+
* PolicyFilter is a single filter entry in a policy definition.
|
|
25
|
+
*
|
|
26
|
+
* This is the canonical filter type used across the codebase (JSON-Schema
|
|
27
|
+
* filters, SQL builder, etc.).
|
|
28
|
+
*/
|
|
29
|
+
export type PolicyFilter = PolicyFilterAndOr | PolicyFilterNot | PolicyFilterIsNull | PolicyFilterIn | PolicyFilterCompare | PolicyFilterBetween;
|
|
30
|
+
interface PolicyFilterBase {
|
|
31
|
+
stage?: "generation";
|
|
32
|
+
name?: string;
|
|
33
|
+
required?: boolean;
|
|
34
|
+
}
|
|
35
|
+
interface PolicyFilterAndOr extends PolicyFilterBase {
|
|
36
|
+
op: "and" | "or";
|
|
37
|
+
args: FilterExpression[];
|
|
38
|
+
}
|
|
39
|
+
interface PolicyFilterNot extends PolicyFilterBase {
|
|
40
|
+
op: "not";
|
|
41
|
+
args: FilterExpression[];
|
|
42
|
+
}
|
|
43
|
+
interface PolicyFilterIsNull extends PolicyFilterBase {
|
|
44
|
+
op: "is_null" | "is_not_null";
|
|
45
|
+
left: FilterExpression;
|
|
46
|
+
}
|
|
47
|
+
interface PolicyFilterIn extends PolicyFilterBase {
|
|
48
|
+
op: "in" | "not in";
|
|
49
|
+
left: FilterExpression;
|
|
50
|
+
right: FilterExpression[];
|
|
51
|
+
}
|
|
52
|
+
interface PolicyFilterCompare extends PolicyFilterBase {
|
|
53
|
+
op: "=" | "<>" | ">" | ">=" | "<" | "<=" | "like" | "not like";
|
|
54
|
+
left: FilterExpression;
|
|
55
|
+
right: FilterExpression;
|
|
56
|
+
}
|
|
57
|
+
interface PolicyFilterBetween extends PolicyFilterBase {
|
|
58
|
+
op: "between";
|
|
59
|
+
operand: FilterExpression;
|
|
60
|
+
lower: FilterExpression;
|
|
61
|
+
upper: FilterExpression;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Map from attribute name -> set of normalized paths that must be selected
|
|
65
|
+
* for SQL generation.
|
|
66
|
+
*/
|
|
9
67
|
export type AttributePathIndex = Map<string, Set<string>>;
|
|
68
|
+
/**
|
|
69
|
+
* A logical group of SQL fragments combined by an operation.
|
|
70
|
+
*/
|
|
10
71
|
export interface PolicySqlGroup {
|
|
11
72
|
fragments: Array<string | PolicySqlGroup>;
|
|
12
73
|
operation: "AND" | "OR";
|
|
13
74
|
}
|
|
75
|
+
/**
|
|
76
|
+
* Core SQL fragments required to represent a set of collaboration policies.
|
|
77
|
+
*/
|
|
14
78
|
export interface PolicySqlFragments {
|
|
15
79
|
select: string[];
|
|
16
80
|
where: Array<PolicySqlGroup | string>;
|
|
17
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Full result of applying collaboration policies to a dataset, including:
|
|
84
|
+
* - which policies were applied
|
|
85
|
+
* - which were skipped and why
|
|
86
|
+
* - warnings
|
|
87
|
+
* - the minimum refresh schedule across applied policies
|
|
88
|
+
*/
|
|
18
89
|
export interface PolicyMatchResult extends PolicySqlFragments {
|
|
19
90
|
appliedPolicies: string[];
|
|
20
91
|
skippedPolicies: Array<{
|
|
@@ -23,7 +94,7 @@ export interface PolicyMatchResult extends PolicySqlFragments {
|
|
|
23
94
|
details: string[];
|
|
24
95
|
}>;
|
|
25
96
|
warnings: string[];
|
|
26
|
-
/** The minimum refresh schedule
|
|
27
|
-
refresh_schedule:
|
|
97
|
+
/** The minimum refresh schedule as an ISO 8601 duration string across all evaluated policies */
|
|
98
|
+
refresh_schedule: string;
|
|
28
99
|
}
|
|
29
100
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export {
|
|
1
|
+
export type { JsonSchemaConnectorPolicy } from "./core/jsonschema/json-schema-types";
|
|
2
|
+
export { evaluateJsonSchemaPolicies } from "./core/jsonschema/policy-evaluator";
|
|
3
|
+
export { buildPolicySql, buildPolicySqlWithJsonSchema, buildPolicySqlWithValidation, categorizePolicies, type JsonSchemaPolicyMatchResult, } from "./core/jsonschema/sql-builder";
|
|
4
|
+
export type { AttributePathIndex, FilterAttributeRef, FilterExpression, PathValue, PolicyFilter, PolicyMatchResult, PolicySqlFragments, PolicySqlGroup, } from "./core/types";
|
|
5
|
+
export { default as useCollaborationPolicy } from "./useCollaborationPolicy";
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export { buildPolicySql, buildPolicySqlWithValidation, categorizePolicies, } from "./core/sql-builder";
|
|
3
|
-
|
|
1
|
+
export { evaluateJsonSchemaPolicies } from "./core/jsonschema/policy-evaluator";
|
|
2
|
+
export { buildPolicySql, buildPolicySqlWithJsonSchema, buildPolicySqlWithValidation, categorizePolicies, } from "./core/jsonschema/sql-builder";
|
|
3
|
+
// Hook-style entrypoint
|
|
4
|
+
export { default as useCollaborationPolicy } from "./useCollaborationPolicy";
|
|
@@ -551,12 +551,12 @@ declare const CollaborationPolicy: z.ZodObject<{
|
|
|
551
551
|
name: z.ZodOptional<z.ZodString>;
|
|
552
552
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
553
553
|
args: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
554
|
-
type: z.ZodLiteral<"attribute">;
|
|
555
554
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
556
555
|
dot: z.ZodString;
|
|
557
556
|
}, z.core.$strict>, z.ZodObject<{
|
|
558
557
|
pointer: z.ZodString;
|
|
559
558
|
}, z.core.$strict>]>>;
|
|
559
|
+
type: z.ZodLiteral<"attribute">;
|
|
560
560
|
attribute_name: z.ZodString;
|
|
561
561
|
}, z.core.$strict>]>>;
|
|
562
562
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -565,12 +565,12 @@ declare const CollaborationPolicy: z.ZodObject<{
|
|
|
565
565
|
name: z.ZodOptional<z.ZodString>;
|
|
566
566
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
567
567
|
args: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
568
|
-
type: z.ZodLiteral<"attribute">;
|
|
569
568
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
570
569
|
dot: z.ZodString;
|
|
571
570
|
}, z.core.$strict>, z.ZodObject<{
|
|
572
571
|
pointer: z.ZodString;
|
|
573
572
|
}, z.core.$strict>]>>;
|
|
573
|
+
type: z.ZodLiteral<"attribute">;
|
|
574
574
|
attribute_name: z.ZodString;
|
|
575
575
|
}, z.core.$strict>]>>;
|
|
576
576
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -582,12 +582,12 @@ declare const CollaborationPolicy: z.ZodObject<{
|
|
|
582
582
|
name: z.ZodOptional<z.ZodString>;
|
|
583
583
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
584
584
|
left: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
585
|
-
type: z.ZodLiteral<"attribute">;
|
|
586
585
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
587
586
|
dot: z.ZodString;
|
|
588
587
|
}, z.core.$strict>, z.ZodObject<{
|
|
589
588
|
pointer: z.ZodString;
|
|
590
589
|
}, z.core.$strict>]>>;
|
|
590
|
+
type: z.ZodLiteral<"attribute">;
|
|
591
591
|
attribute_name: z.ZodString;
|
|
592
592
|
}, z.core.$strict>]>;
|
|
593
593
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -599,21 +599,21 @@ declare const CollaborationPolicy: z.ZodObject<{
|
|
|
599
599
|
name: z.ZodOptional<z.ZodString>;
|
|
600
600
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
601
601
|
left: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
602
|
-
type: z.ZodLiteral<"attribute">;
|
|
603
602
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
604
603
|
dot: z.ZodString;
|
|
605
604
|
}, z.core.$strict>, z.ZodObject<{
|
|
606
605
|
pointer: z.ZodString;
|
|
607
606
|
}, z.core.$strict>]>>;
|
|
607
|
+
type: z.ZodLiteral<"attribute">;
|
|
608
608
|
attribute_name: z.ZodString;
|
|
609
609
|
}, z.core.$strict>]>;
|
|
610
610
|
right: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
611
|
-
type: z.ZodLiteral<"attribute">;
|
|
612
611
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
613
612
|
dot: z.ZodString;
|
|
614
613
|
}, z.core.$strict>, z.ZodObject<{
|
|
615
614
|
pointer: z.ZodString;
|
|
616
615
|
}, z.core.$strict>]>>;
|
|
616
|
+
type: z.ZodLiteral<"attribute">;
|
|
617
617
|
attribute_name: z.ZodString;
|
|
618
618
|
}, z.core.$strict>]>>;
|
|
619
619
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -631,21 +631,21 @@ declare const CollaborationPolicy: z.ZodObject<{
|
|
|
631
631
|
name: z.ZodOptional<z.ZodString>;
|
|
632
632
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
633
633
|
left: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
634
|
-
type: z.ZodLiteral<"attribute">;
|
|
635
634
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
636
635
|
dot: z.ZodString;
|
|
637
636
|
}, z.core.$strict>, z.ZodObject<{
|
|
638
637
|
pointer: z.ZodString;
|
|
639
638
|
}, z.core.$strict>]>>;
|
|
639
|
+
type: z.ZodLiteral<"attribute">;
|
|
640
640
|
attribute_name: z.ZodString;
|
|
641
641
|
}, z.core.$strict>]>;
|
|
642
642
|
right: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
643
|
-
type: z.ZodLiteral<"attribute">;
|
|
644
643
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
645
644
|
dot: z.ZodString;
|
|
646
645
|
}, z.core.$strict>, z.ZodObject<{
|
|
647
646
|
pointer: z.ZodString;
|
|
648
647
|
}, z.core.$strict>]>>;
|
|
648
|
+
type: z.ZodLiteral<"attribute">;
|
|
649
649
|
attribute_name: z.ZodString;
|
|
650
650
|
}, z.core.$strict>]>;
|
|
651
651
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -654,30 +654,30 @@ declare const CollaborationPolicy: z.ZodObject<{
|
|
|
654
654
|
name: z.ZodOptional<z.ZodString>;
|
|
655
655
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
656
656
|
operand: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
657
|
-
type: z.ZodLiteral<"attribute">;
|
|
658
657
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
659
658
|
dot: z.ZodString;
|
|
660
659
|
}, z.core.$strict>, z.ZodObject<{
|
|
661
660
|
pointer: z.ZodString;
|
|
662
661
|
}, z.core.$strict>]>>;
|
|
662
|
+
type: z.ZodLiteral<"attribute">;
|
|
663
663
|
attribute_name: z.ZodString;
|
|
664
664
|
}, z.core.$strict>]>;
|
|
665
665
|
lower: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
666
|
-
type: z.ZodLiteral<"attribute">;
|
|
667
666
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
668
667
|
dot: z.ZodString;
|
|
669
668
|
}, z.core.$strict>, z.ZodObject<{
|
|
670
669
|
pointer: z.ZodString;
|
|
671
670
|
}, z.core.$strict>]>>;
|
|
671
|
+
type: z.ZodLiteral<"attribute">;
|
|
672
672
|
attribute_name: z.ZodString;
|
|
673
673
|
}, z.core.$strict>]>;
|
|
674
674
|
upper: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
675
|
-
type: z.ZodLiteral<"attribute">;
|
|
676
675
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
677
676
|
dot: z.ZodString;
|
|
678
677
|
}, z.core.$strict>, z.ZodObject<{
|
|
679
678
|
pointer: z.ZodString;
|
|
680
679
|
}, z.core.$strict>]>>;
|
|
680
|
+
type: z.ZodLiteral<"attribute">;
|
|
681
681
|
attribute_name: z.ZodString;
|
|
682
682
|
}, z.core.$strict>]>;
|
|
683
683
|
}, z.core.$strict>]>>>;
|
|
@@ -1235,12 +1235,12 @@ export declare function buildCollaborationPolicyJsonSchema(options?: JsonSchemaO
|
|
|
1235
1235
|
name: z.ZodOptional<z.ZodString>;
|
|
1236
1236
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
1237
1237
|
args: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
1238
|
-
type: z.ZodLiteral<"attribute">;
|
|
1239
1238
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1240
1239
|
dot: z.ZodString;
|
|
1241
1240
|
}, z.core.$strict>, z.ZodObject<{
|
|
1242
1241
|
pointer: z.ZodString;
|
|
1243
1242
|
}, z.core.$strict>]>>;
|
|
1243
|
+
type: z.ZodLiteral<"attribute">;
|
|
1244
1244
|
attribute_name: z.ZodString;
|
|
1245
1245
|
}, z.core.$strict>]>>;
|
|
1246
1246
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -1249,12 +1249,12 @@ export declare function buildCollaborationPolicyJsonSchema(options?: JsonSchemaO
|
|
|
1249
1249
|
name: z.ZodOptional<z.ZodString>;
|
|
1250
1250
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
1251
1251
|
args: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
1252
|
-
type: z.ZodLiteral<"attribute">;
|
|
1253
1252
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1254
1253
|
dot: z.ZodString;
|
|
1255
1254
|
}, z.core.$strict>, z.ZodObject<{
|
|
1256
1255
|
pointer: z.ZodString;
|
|
1257
1256
|
}, z.core.$strict>]>>;
|
|
1257
|
+
type: z.ZodLiteral<"attribute">;
|
|
1258
1258
|
attribute_name: z.ZodString;
|
|
1259
1259
|
}, z.core.$strict>]>>;
|
|
1260
1260
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -1266,12 +1266,12 @@ export declare function buildCollaborationPolicyJsonSchema(options?: JsonSchemaO
|
|
|
1266
1266
|
name: z.ZodOptional<z.ZodString>;
|
|
1267
1267
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
1268
1268
|
left: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
1269
|
-
type: z.ZodLiteral<"attribute">;
|
|
1270
1269
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1271
1270
|
dot: z.ZodString;
|
|
1272
1271
|
}, z.core.$strict>, z.ZodObject<{
|
|
1273
1272
|
pointer: z.ZodString;
|
|
1274
1273
|
}, z.core.$strict>]>>;
|
|
1274
|
+
type: z.ZodLiteral<"attribute">;
|
|
1275
1275
|
attribute_name: z.ZodString;
|
|
1276
1276
|
}, z.core.$strict>]>;
|
|
1277
1277
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -1283,21 +1283,21 @@ export declare function buildCollaborationPolicyJsonSchema(options?: JsonSchemaO
|
|
|
1283
1283
|
name: z.ZodOptional<z.ZodString>;
|
|
1284
1284
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
1285
1285
|
left: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
1286
|
-
type: z.ZodLiteral<"attribute">;
|
|
1287
1286
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1288
1287
|
dot: z.ZodString;
|
|
1289
1288
|
}, z.core.$strict>, z.ZodObject<{
|
|
1290
1289
|
pointer: z.ZodString;
|
|
1291
1290
|
}, z.core.$strict>]>>;
|
|
1291
|
+
type: z.ZodLiteral<"attribute">;
|
|
1292
1292
|
attribute_name: z.ZodString;
|
|
1293
1293
|
}, z.core.$strict>]>;
|
|
1294
1294
|
right: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
1295
|
-
type: z.ZodLiteral<"attribute">;
|
|
1296
1295
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1297
1296
|
dot: z.ZodString;
|
|
1298
1297
|
}, z.core.$strict>, z.ZodObject<{
|
|
1299
1298
|
pointer: z.ZodString;
|
|
1300
1299
|
}, z.core.$strict>]>>;
|
|
1300
|
+
type: z.ZodLiteral<"attribute">;
|
|
1301
1301
|
attribute_name: z.ZodString;
|
|
1302
1302
|
}, z.core.$strict>]>>;
|
|
1303
1303
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -1315,21 +1315,21 @@ export declare function buildCollaborationPolicyJsonSchema(options?: JsonSchemaO
|
|
|
1315
1315
|
name: z.ZodOptional<z.ZodString>;
|
|
1316
1316
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
1317
1317
|
left: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
1318
|
-
type: z.ZodLiteral<"attribute">;
|
|
1319
1318
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1320
1319
|
dot: z.ZodString;
|
|
1321
1320
|
}, z.core.$strict>, z.ZodObject<{
|
|
1322
1321
|
pointer: z.ZodString;
|
|
1323
1322
|
}, z.core.$strict>]>>;
|
|
1323
|
+
type: z.ZodLiteral<"attribute">;
|
|
1324
1324
|
attribute_name: z.ZodString;
|
|
1325
1325
|
}, z.core.$strict>]>;
|
|
1326
1326
|
right: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
1327
|
-
type: z.ZodLiteral<"attribute">;
|
|
1328
1327
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1329
1328
|
dot: z.ZodString;
|
|
1330
1329
|
}, z.core.$strict>, z.ZodObject<{
|
|
1331
1330
|
pointer: z.ZodString;
|
|
1332
1331
|
}, z.core.$strict>]>>;
|
|
1332
|
+
type: z.ZodLiteral<"attribute">;
|
|
1333
1333
|
attribute_name: z.ZodString;
|
|
1334
1334
|
}, z.core.$strict>]>;
|
|
1335
1335
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -1338,30 +1338,30 @@ export declare function buildCollaborationPolicyJsonSchema(options?: JsonSchemaO
|
|
|
1338
1338
|
name: z.ZodOptional<z.ZodString>;
|
|
1339
1339
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
1340
1340
|
operand: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
1341
|
-
type: z.ZodLiteral<"attribute">;
|
|
1342
1341
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1343
1342
|
dot: z.ZodString;
|
|
1344
1343
|
}, z.core.$strict>, z.ZodObject<{
|
|
1345
1344
|
pointer: z.ZodString;
|
|
1346
1345
|
}, z.core.$strict>]>>;
|
|
1346
|
+
type: z.ZodLiteral<"attribute">;
|
|
1347
1347
|
attribute_name: z.ZodString;
|
|
1348
1348
|
}, z.core.$strict>]>;
|
|
1349
1349
|
lower: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
1350
|
-
type: z.ZodLiteral<"attribute">;
|
|
1351
1350
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1352
1351
|
dot: z.ZodString;
|
|
1353
1352
|
}, z.core.$strict>, z.ZodObject<{
|
|
1354
1353
|
pointer: z.ZodString;
|
|
1355
1354
|
}, z.core.$strict>]>>;
|
|
1355
|
+
type: z.ZodLiteral<"attribute">;
|
|
1356
1356
|
attribute_name: z.ZodString;
|
|
1357
1357
|
}, z.core.$strict>]>;
|
|
1358
1358
|
upper: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
|
|
1359
|
-
type: z.ZodLiteral<"attribute">;
|
|
1360
1359
|
path: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
1361
1360
|
dot: z.ZodString;
|
|
1362
1361
|
}, z.core.$strict>, z.ZodObject<{
|
|
1363
1362
|
pointer: z.ZodString;
|
|
1364
1363
|
}, z.core.$strict>]>>;
|
|
1364
|
+
type: z.ZodLiteral<"attribute">;
|
|
1365
1365
|
attribute_name: z.ZodString;
|
|
1366
1366
|
}, z.core.$strict>]>;
|
|
1367
1367
|
}, z.core.$strict>]>>>;
|
|
@@ -1,8 +1,17 @@
|
|
|
1
1
|
import type { Attribute } from "../attributes/types";
|
|
2
2
|
import type { Dataset } from "../datasets/types";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { JsonSchemaConnectorPolicy } from "./core/jsonschema/json-schema-types";
|
|
4
|
+
import type { PolicyMatchResult, PolicySqlFragments } from "./core/types";
|
|
5
|
+
/**
|
|
6
|
+
* Hook-style wrapper that exposes collaboration policy helpers.
|
|
7
|
+
*
|
|
8
|
+
* Public API surface:
|
|
9
|
+
* - categorizePolicies
|
|
10
|
+
* - buildPolicySql
|
|
11
|
+
* - buildPolicySqlWithValidation
|
|
12
|
+
*/
|
|
5
13
|
export default function useCollaborationPolicy(): {
|
|
6
|
-
getEligibleConnectorsPolicies: (dataset: Dataset, policies:
|
|
7
|
-
buildPolicySqlFragments: (dataset: Dataset, policies:
|
|
14
|
+
getEligibleConnectorsPolicies: (dataset: Dataset, policies: JsonSchemaConnectorPolicy[], attributes: Attribute[]) => JsonSchemaConnectorPolicy[];
|
|
15
|
+
buildPolicySqlFragments: (dataset: Dataset, policies: JsonSchemaConnectorPolicy[], attributes: Attribute[]) => PolicySqlFragments;
|
|
16
|
+
buildPolicySqlWithValidationJsonSchema: (dataset: Dataset, policies: JsonSchemaConnectorPolicy[], attributes: Attribute[]) => PolicyMatchResult;
|
|
8
17
|
};
|
|
@@ -1,14 +1,36 @@
|
|
|
1
|
-
import { buildPolicySql, categorizePolicies } from "./core/sql-builder";
|
|
1
|
+
import { buildPolicySql, buildPolicySqlWithValidation, categorizePolicies, } from "./core/jsonschema/sql-builder";
|
|
2
|
+
/**
|
|
3
|
+
* Hook-style wrapper that exposes collaboration policy helpers.
|
|
4
|
+
*
|
|
5
|
+
* Public API surface:
|
|
6
|
+
* - categorizePolicies
|
|
7
|
+
* - buildPolicySql
|
|
8
|
+
* - buildPolicySqlWithValidation
|
|
9
|
+
*/
|
|
2
10
|
export default function useCollaborationPolicy() {
|
|
11
|
+
/**
|
|
12
|
+
* Get policies that are compatible with a dataset using the JSON-Schema policy system.
|
|
13
|
+
*/
|
|
3
14
|
const getEligibleConnectorsPolicies = (dataset, policies, attributes) => {
|
|
4
15
|
const { matching } = categorizePolicies(policies, dataset, attributes);
|
|
5
16
|
return matching;
|
|
6
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Build SQL fragments using JSON-Schema policies, without per-policy validation.
|
|
20
|
+
*/
|
|
7
21
|
const buildPolicySqlFragments = (dataset, policies, attributes) => {
|
|
8
22
|
return buildPolicySql(dataset, policies, attributes);
|
|
9
23
|
};
|
|
24
|
+
/**
|
|
25
|
+
* Validate each JSON-Schema policy against the dataset and build SQL
|
|
26
|
+
* plus metadata (appliedPolicies, skippedPolicies, etc.).
|
|
27
|
+
*/
|
|
28
|
+
const buildPolicySqlWithValidationJsonSchema = (dataset, policies, attributes) => {
|
|
29
|
+
return buildPolicySqlWithValidation(dataset, policies, attributes);
|
|
30
|
+
};
|
|
10
31
|
return {
|
|
11
32
|
getEligibleConnectorsPolicies,
|
|
12
33
|
buildPolicySqlFragments,
|
|
34
|
+
buildPolicySqlWithValidationJsonSchema,
|
|
13
35
|
};
|
|
14
36
|
}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { PathValue } from "../core/types";
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes a PathValue (dot notation or JSON pointer) into a simple dot-notation string.
|
|
4
|
+
*
|
|
5
|
+
* @param path - A PathValue with either `{ dot: "..." }` or `{ pointer: "..." }` format.
|
|
6
|
+
* @returns Normalized dot-notation string, or empty string for undefined/null.
|
|
7
|
+
*/
|
|
4
8
|
export declare function normalizePathValue(path?: PathValue): string;
|
|
@@ -1,25 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
attributePaths.add(normalized);
|
|
8
|
-
index.set(attribute.name, attributePaths);
|
|
9
|
-
}
|
|
10
|
-
function determineDefaultPath(attribute) {
|
|
11
|
-
if (attribute.type === "object" && "properties" in attribute) {
|
|
12
|
-
const properties = attribute.properties ?? {};
|
|
13
|
-
if ("value" in properties) {
|
|
14
|
-
return "value";
|
|
15
|
-
}
|
|
16
|
-
const [firstKey] = Object.keys(properties);
|
|
17
|
-
if (firstKey) {
|
|
18
|
-
return firstKey;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return "";
|
|
22
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Normalizes a PathValue (dot notation or JSON pointer) into a simple dot-notation string.
|
|
3
|
+
*
|
|
4
|
+
* @param path - A PathValue with either `{ dot: "..." }` or `{ pointer: "..." }` format.
|
|
5
|
+
* @returns Normalized dot-notation string, or empty string for undefined/null.
|
|
6
|
+
*/
|
|
23
7
|
export function normalizePathValue(path) {
|
|
24
8
|
if (!path) {
|
|
25
9
|
return "";
|
|
@@ -2,9 +2,9 @@ import type { UnknownJob } from "src/jobs/types";
|
|
|
2
2
|
import { BaseApi } from "../base-api";
|
|
3
3
|
import type { ApiRecords } from "../types";
|
|
4
4
|
import type { DatasetStatisticsConfiguration, StatisticsConfigurationResponse } from "./statistics-types";
|
|
5
|
-
import type { AdvancedStatistics, AdvancedStatisticsMetadata, BasicStatistics, ColumnStatistics, ColumnSummary, Columns, Configuration, CreateDatasetRefreshScheduleRequest, CreateDatasetRequest, Dataset, DatasetStatus, DatasetTableSummary, DatasetTableSummaryAPIResponse, DatasetWriteMode, FilePerSnapshotResponse, Histogram, IngestDatasetFileRequest, RecalculationInfo, RetentionPolicy, RetentionScheduleConfig, RowClock, RowTTLPolicy, Schema, SchemaArrayItems, SchemaArrayItemsArray, SchemaArrayItemsObject, SchemaArrayItemsPrimitive, SchemaArrayProperty, SchemaFileConfig, SchemaFileConfigType, SchemaObjectProperty, SchemaPrimitiveProperty, SchemaProperties, SchemaPropertiesType, SchemaProperty, SnapshotAgeExpression, SnapshotRange, SnapshotTTLPolicy, TableClock, TableClockKind, TableTTLPolicy, TTLPolicy, TTLPolicyKind, UpdateDatasetRefreshScheduleRequest, UpdateDatasetRequest, UpsertRetentionPoliciesRequest, Value } from "./types";
|
|
5
|
+
import type { AdvancedStatistics, AdvancedStatisticsMetadata, BasicStatistics, ColumnStatistics, ColumnSummary, Columns, Configuration, CreateDatasetRefreshScheduleRequest, CreateDatasetRequest, Dataset, DatasetInterfaceError, DatasetInterfaceRef, DatasetInterfaceValidation, DatasetStatus, DatasetTableSummary, DatasetTableSummaryAPIResponse, DatasetWriteMode, FilePerSnapshotResponse, Histogram, IngestDatasetFileRequest, JsonSchemaValidationNode, RecalculationInfo, RetentionPolicy, RetentionScheduleConfig, RowClock, RowTTLPolicy, Schema, SchemaArrayItems, SchemaArrayItemsArray, SchemaArrayItemsObject, SchemaArrayItemsPrimitive, SchemaArrayProperty, SchemaFileConfig, SchemaFileConfigType, SchemaObjectProperty, SchemaPrimitiveProperty, SchemaProperties, SchemaPropertiesType, SchemaProperty, SnapshotAgeExpression, SnapshotRange, SnapshotTTLPolicy, TableClock, TableClockKind, TableTTLPolicy, TTLPolicy, TTLPolicyKind, UpdateDatasetRefreshScheduleRequest, UpdateDatasetRequest, UpsertRetentionPoliciesRequest, Value } from "./types";
|
|
6
6
|
export type { CronRefresh, DatasetFieldConfig, DatasetFieldNamespace, DatasetStatisticsConfiguration, HistogramOptions, HistogramOverflow, ManualRefresh, NestedNodeConfig, NestedPropertyConfig, NonPrimitiveNodeConfig, OnUpdateRefresh, PrimitiveNodeConfig, RefreshTrigger, RosettaStoneFieldConfig, RosettaStoneFieldNamespace, StatConfig, StatisticsConfigurationResponse, StatName, StatOptions, } from "./statistics-types";
|
|
7
|
-
export type { AdvancedStatistics, AdvancedStatisticsMetadata, BasicStatistics, ColumnStatistics, ColumnSummary, Columns, Configuration, CreateDatasetRefreshScheduleRequest, CreateDatasetRequest, Dataset, DatasetStatus, DatasetTableSummaryAPIResponse, DatasetWriteMode, FilePerSnapshotResponse, Histogram, RetentionPolicy, RetentionScheduleConfig, RowClock, RowTTLPolicy, Schema, SchemaArrayItems, SchemaArrayItemsArray, SchemaArrayItemsObject, SchemaArrayItemsPrimitive, SchemaArrayProperty, SchemaFileConfig, SchemaFileConfigType, SchemaObjectProperty, SchemaPrimitiveProperty, SchemaProperties, SchemaPropertiesType, SchemaProperty, SnapshotAgeExpression, SnapshotRange, SnapshotTTLPolicy, TableClock, TableClockKind, TableTTLPolicy, TTLPolicy, TTLPolicyKind, UpdateDatasetRefreshScheduleRequest, UpdateDatasetRequest, UpsertRetentionPoliciesRequest, Value, };
|
|
7
|
+
export type { AdvancedStatistics, AdvancedStatisticsMetadata, BasicStatistics, ColumnStatistics, ColumnSummary, Columns, Configuration, CreateDatasetRefreshScheduleRequest, CreateDatasetRequest, Dataset, DatasetInterfaceError, DatasetInterfaceRef, DatasetInterfaceValidation, DatasetStatus, DatasetTableSummaryAPIResponse, DatasetWriteMode, FilePerSnapshotResponse, Histogram, JsonSchemaValidationNode, RetentionPolicy, RetentionScheduleConfig, RowClock, RowTTLPolicy, Schema, SchemaArrayItems, SchemaArrayItemsArray, SchemaArrayItemsObject, SchemaArrayItemsPrimitive, SchemaArrayProperty, SchemaFileConfig, SchemaFileConfigType, SchemaObjectProperty, SchemaPrimitiveProperty, SchemaProperties, SchemaPropertiesType, SchemaProperty, SnapshotAgeExpression, SnapshotRange, SnapshotTTLPolicy, TableClock, TableClockKind, TableTTLPolicy, TTLPolicy, TTLPolicyKind, UpdateDatasetRefreshScheduleRequest, UpdateDatasetRequest, UpsertRetentionPoliciesRequest, Value, };
|
|
8
8
|
/**
|
|
9
9
|
* @module DatasetApi
|
|
10
10
|
* @description This module provides methods for fetching datasets.
|
|
@@ -221,6 +221,15 @@ export declare class DatasetApi extends BaseApi {
|
|
|
221
221
|
createDatasetRefreshSchedule(datasetId: number, refreshSchedule: CreateDatasetRefreshScheduleRequest): Promise<void>;
|
|
222
222
|
updateDatasetRefreshSchedule(datasetId: number, refreshSchedule: UpdateDatasetRefreshScheduleRequest): Promise<void>;
|
|
223
223
|
deleteDatasetRefreshSchedule(datasetId: number): Promise<void>;
|
|
224
|
+
/**
|
|
225
|
+
* Validate which connector interfaces are compatible with a dataset.
|
|
226
|
+
* Filtered by the user's installed apps and optionally by tags.
|
|
227
|
+
*
|
|
228
|
+
* @param {number} datasetId - The ID of the dataset to validate interfaces against.
|
|
229
|
+
* @param {string[]} [tags] - Optional tags to filter interfaces (e.g. ["audience_delivery"]).
|
|
230
|
+
* @returns {Promise<DatasetInterfaceValidation>} - Accepted interface IDs and per-interface validation errors.
|
|
231
|
+
*/
|
|
232
|
+
getDatasetInterfaces(datasetId: number, tags?: string[]): Promise<DatasetInterfaceValidation>;
|
|
224
233
|
putStatisticsConfiguration(datasetId: number, configuration: DatasetStatisticsConfiguration): Promise<StatisticsConfigurationResponse>;
|
|
225
234
|
getStatisticsConfiguration(datasetId: number): Promise<StatisticsConfigurationResponse>;
|
|
226
235
|
deleteStatisticsConfiguration(datasetId: number): Promise<StatisticsConfigurationResponse>;
|
package/build/datasets/index.js
CHANGED
|
@@ -295,6 +295,18 @@ export class DatasetApi extends BaseApi {
|
|
|
295
295
|
async deleteDatasetRefreshSchedule(datasetId) {
|
|
296
296
|
await this.delete(`${resourceName}/${datasetId}/refresh-schedule`);
|
|
297
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Validate which connector interfaces are compatible with a dataset.
|
|
300
|
+
* Filtered by the user's installed apps and optionally by tags.
|
|
301
|
+
*
|
|
302
|
+
* @param {number} datasetId - The ID of the dataset to validate interfaces against.
|
|
303
|
+
* @param {string[]} [tags] - Optional tags to filter interfaces (e.g. ["audience_delivery"]).
|
|
304
|
+
* @returns {Promise<DatasetInterfaceValidation>} - Accepted interface IDs and per-interface validation errors.
|
|
305
|
+
*/
|
|
306
|
+
async getDatasetInterfaces(datasetId, tags) {
|
|
307
|
+
const queryString = this.constructQueryString(tags != null ? { tags } : undefined);
|
|
308
|
+
return await this.get(`${resourceName}/${datasetId}/interfaces${queryString}`);
|
|
309
|
+
}
|
|
298
310
|
async putStatisticsConfiguration(datasetId, configuration) {
|
|
299
311
|
return await this.put(`${resourceName}/${datasetId}/statistics-configuration`, configuration);
|
|
300
312
|
}
|
|
@@ -294,6 +294,31 @@ export interface CreateDatasetRequest {
|
|
|
294
294
|
export interface IngestDatasetFileRequest {
|
|
295
295
|
source_file: string;
|
|
296
296
|
}
|
|
297
|
+
export interface DatasetInterfaceRef {
|
|
298
|
+
app_id: number;
|
|
299
|
+
interface_id: string;
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* A JSON-Schema 2020-12 "Basic" output node, used recursively in validation errors.
|
|
303
|
+
* `errors` is keyed by JSON-Schema keyword (`"required"`, `"type"`, etc.); values
|
|
304
|
+
* are human-readable strings.
|
|
305
|
+
*/
|
|
306
|
+
export interface JsonSchemaValidationNode {
|
|
307
|
+
valid: boolean;
|
|
308
|
+
evaluationPath: string;
|
|
309
|
+
schemaLocation: string;
|
|
310
|
+
instanceLocation: string;
|
|
311
|
+
errors?: Record<string, string>;
|
|
312
|
+
details?: JsonSchemaValidationNode[];
|
|
313
|
+
}
|
|
314
|
+
export interface DatasetInterfaceError extends DatasetInterfaceRef {
|
|
315
|
+
details: JsonSchemaValidationNode;
|
|
316
|
+
}
|
|
317
|
+
export interface DatasetInterfaceValidation {
|
|
318
|
+
dataset_id: number;
|
|
319
|
+
accepted: DatasetInterfaceRef[];
|
|
320
|
+
errors: DatasetInterfaceError[];
|
|
321
|
+
}
|
|
297
322
|
export interface UpdateDatasetRefreshScheduleRequest {
|
|
298
323
|
cron?: string;
|
|
299
324
|
cron_zone_id?: string;
|