@narrative.io/data-collaboration-sdk-ts 2.95.0-beta.0 → 2.95.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 +0 -7
- package/build/apps/index.js +0 -9
- package/build/collaboration-policy/core/filter-builder.js +1 -7
- package/build/collaboration-policy/core/sql-builder.js +9 -11
- package/build/collaboration-policy/core/types.d.ts +10 -81
- package/build/collaboration-policy/index.d.ts +4 -5
- package/build/collaboration-policy/index.js +3 -4
- package/build/collaboration-policy/types/collaboration-policy.d.ts +1370 -0
- package/build/collaboration-policy/types/collaboration-policy.js +274 -0
- package/build/collaboration-policy/types/index.d.ts +2 -0
- package/build/collaboration-policy/types/index.js +1 -0
- package/build/collaboration-policy/useCollaborationPolicy.d.ts +4 -13
- package/build/collaboration-policy/useCollaborationPolicy.js +1 -23
- package/build/collaboration-policy/utils/path-helpers.d.ts +3 -7
- package/build/collaboration-policy/utils/path-helpers.js +22 -6
- package/build/data-planes/types.d.ts +1 -1
- package/build/datasets/index.d.ts +12 -12
- package/build/datasets/index.js +18 -13
- package/build/datasets/statistics-types.d.ts +81 -0
- package/build/datasets/types.d.ts +60 -13
- package/build/datasets/types.js +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/jobs/types.d.ts +1 -0
- package/package.json +7 -8
- package/build/collaboration-policy/core/jsonschema/json-schema-types.d.ts +0 -45
- package/build/collaboration-policy/core/jsonschema/policy-branches.d.ts +0 -49
- package/build/collaboration-policy/core/jsonschema/policy-branches.js +0 -1
- package/build/collaboration-policy/core/jsonschema/policy-evaluator.d.ts +0 -22
- package/build/collaboration-policy/core/jsonschema/policy-evaluator.js +0 -260
- package/build/collaboration-policy/core/jsonschema/sql-builder.d.ts +0 -79
- package/build/collaboration-policy/core/jsonschema/sql-builder.js +0 -305
- package/build/collaboration-policy/core/jsonschema/sql-poc.d.ts +0 -79
- package/build/collaboration-policy/core/jsonschema/sql-poc.js +0 -305
- package/build/nql/SubstraitParser.d.ts +0 -771
- package/build/nql/SubstraitParser.js +0 -797
- /package/build/{collaboration-policy/core/jsonschema/json-schema-types.js → datasets/statistics-types.js} +0 -0
package/build/apps/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { BaseApi } from "../base-api";
|
|
2
|
-
import type { JsonSchemaConnectorPolicy } from "../collaboration-policy/core/jsonschema/json-schema-types";
|
|
3
2
|
import type { ApiRecords } from "../types";
|
|
4
3
|
import type { App, Installation } from "./types";
|
|
5
4
|
/**
|
|
@@ -15,11 +14,5 @@ declare class AppsApi extends BaseApi {
|
|
|
15
14
|
*/
|
|
16
15
|
getApps(appCategory?: string): Promise<ApiRecords<App>>;
|
|
17
16
|
getInstalledApps(appCategory?: string): Promise<ApiRecords<Installation>>;
|
|
18
|
-
/**
|
|
19
|
-
* Get all interfaces for the current user's installed connectors.
|
|
20
|
-
* @param {string[]} [tags] - Optional tags to filter interfaces (e.g. ["audience_delivery"]).
|
|
21
|
-
* @returns {Promise<ApiRecords<JsonSchemaConnectorPolicy>>} - Promise resolving with the list of interfaces.
|
|
22
|
-
*/
|
|
23
|
-
getInstalledInterfaces(tags?: string[]): Promise<ApiRecords<JsonSchemaConnectorPolicy>>;
|
|
24
17
|
}
|
|
25
18
|
export { type App, type Installation, AppsApi };
|
package/build/apps/index.js
CHANGED
|
@@ -21,14 +21,5 @@ class AppsApi extends BaseApi {
|
|
|
21
21
|
const url = `installations${appCategoryQuery}`;
|
|
22
22
|
return await this.get(url);
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Get all interfaces for the current user's installed connectors.
|
|
26
|
-
* @param {string[]} [tags] - Optional tags to filter interfaces (e.g. ["audience_delivery"]).
|
|
27
|
-
* @returns {Promise<ApiRecords<JsonSchemaConnectorPolicy>>} - Promise resolving with the list of interfaces.
|
|
28
|
-
*/
|
|
29
|
-
async getInstalledInterfaces(tags) {
|
|
30
|
-
const queryString = this.constructQueryString(tags != null ? { tags } : undefined);
|
|
31
|
-
return await this.get(`${resourceName}/installed/interfaces${queryString}`);
|
|
32
|
-
}
|
|
33
24
|
}
|
|
34
25
|
export { AppsApi };
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
import { normalizePathValue } from "../utils/path-helpers";
|
|
2
2
|
import { resolveAttributeExpression } from "../utils/sql-helpers";
|
|
3
|
-
|
|
4
|
-
return (!!node &&
|
|
5
|
-
typeof node === "object" &&
|
|
6
|
-
"type" in node &&
|
|
7
|
-
node.type === "attribute" &&
|
|
8
|
-
"attribute_name" in node);
|
|
9
|
-
}
|
|
3
|
+
import { isAttributeReference } from "./filter-utils";
|
|
10
4
|
export function filterToSql(filter, attributeByName, datasetName) {
|
|
11
5
|
const op = filter.op.toLowerCase();
|
|
12
6
|
switch (op) {
|
|
@@ -41,34 +41,30 @@ function parseDurationToMilliseconds(duration) {
|
|
|
41
41
|
* The smallest duration means the most frequent refresh rate.
|
|
42
42
|
*
|
|
43
43
|
* @param schedules - Array of ISO 8601 duration strings
|
|
44
|
-
* @returns The smallest duration
|
|
44
|
+
* @returns The smallest duration in milliseconds, or 2592000000 (30 days/1 month) if no schedules provided
|
|
45
45
|
*/
|
|
46
46
|
function getSmallestRefreshSchedule(schedules) {
|
|
47
|
-
// Default to monthly
|
|
48
|
-
const
|
|
47
|
+
// Default to monthly (30 days in milliseconds)
|
|
48
|
+
const defaultMonthlyMs = 30 * 24 * 60 * 60 * 1000;
|
|
49
49
|
if (schedules.length === 0) {
|
|
50
|
-
return
|
|
50
|
+
return defaultMonthlyMs;
|
|
51
51
|
}
|
|
52
52
|
if (schedules.length === 1) {
|
|
53
53
|
try {
|
|
54
|
-
|
|
55
|
-
parseDurationToMilliseconds(schedules[0]);
|
|
56
|
-
return schedules[0];
|
|
54
|
+
return parseDurationToMilliseconds(schedules[0]);
|
|
57
55
|
}
|
|
58
56
|
catch (error) {
|
|
59
57
|
console.warn(`Invalid refresh schedule: ${schedules[0]}, using default`, error);
|
|
60
|
-
return
|
|
58
|
+
return defaultMonthlyMs;
|
|
61
59
|
}
|
|
62
60
|
}
|
|
63
61
|
// Find the schedule with the smallest duration (most frequent refresh)
|
|
64
62
|
let smallestValue = Number.MAX_SAFE_INTEGER;
|
|
65
|
-
let smallestSchedule = null;
|
|
66
63
|
for (const schedule of schedules) {
|
|
67
64
|
try {
|
|
68
65
|
const value = parseDurationToMilliseconds(schedule);
|
|
69
66
|
if (value < smallestValue) {
|
|
70
67
|
smallestValue = value;
|
|
71
|
-
smallestSchedule = schedule;
|
|
72
68
|
}
|
|
73
69
|
}
|
|
74
70
|
catch (error) {
|
|
@@ -77,7 +73,9 @@ function getSmallestRefreshSchedule(schedules) {
|
|
|
77
73
|
}
|
|
78
74
|
}
|
|
79
75
|
// If all schedules failed to parse, return default
|
|
80
|
-
return
|
|
76
|
+
return smallestValue === Number.MAX_SAFE_INTEGER
|
|
77
|
+
? defaultMonthlyMs
|
|
78
|
+
: smallestValue;
|
|
81
79
|
}
|
|
82
80
|
/**
|
|
83
81
|
* Builds structured WHERE clauses for a single branch node
|
|
@@ -1,91 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
*/
|
|
1
|
+
import type { CollaborationPolicyType } from "../types";
|
|
2
|
+
type PolicyDefinition = CollaborationPolicyType["policy"]["definition"];
|
|
3
|
+
export type StructureNode = PolicyDefinition["structure"];
|
|
4
|
+
export type ExtendedAttributeNode = Extract<StructureNode, {
|
|
5
|
+
field: unknown;
|
|
6
|
+
}>;
|
|
7
|
+
export type PolicyFilter = NonNullable<PolicyDefinition["filters"]>[number];
|
|
8
|
+
export type PathValue = NonNullable<ExtendedAttributeNode["field"]["additional_required_properties"]>[number];
|
|
67
9
|
export type AttributePathIndex = Map<string, Set<string>>;
|
|
68
|
-
/**
|
|
69
|
-
* A logical group of SQL fragments combined by an operation.
|
|
70
|
-
*/
|
|
71
10
|
export interface PolicySqlGroup {
|
|
72
11
|
fragments: Array<string | PolicySqlGroup>;
|
|
73
12
|
operation: "AND" | "OR";
|
|
74
13
|
}
|
|
75
|
-
/**
|
|
76
|
-
* Core SQL fragments required to represent a set of collaboration policies.
|
|
77
|
-
*/
|
|
78
14
|
export interface PolicySqlFragments {
|
|
79
15
|
select: string[];
|
|
80
16
|
where: Array<PolicySqlGroup | string>;
|
|
81
17
|
}
|
|
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
|
-
*/
|
|
89
18
|
export interface PolicyMatchResult extends PolicySqlFragments {
|
|
90
19
|
appliedPolicies: string[];
|
|
91
20
|
skippedPolicies: Array<{
|
|
@@ -94,7 +23,7 @@ export interface PolicyMatchResult extends PolicySqlFragments {
|
|
|
94
23
|
details: string[];
|
|
95
24
|
}>;
|
|
96
25
|
warnings: string[];
|
|
97
|
-
/** The minimum refresh schedule
|
|
98
|
-
refresh_schedule:
|
|
26
|
+
/** The minimum refresh schedule in milliseconds across all evaluated policies */
|
|
27
|
+
refresh_schedule: number;
|
|
99
28
|
}
|
|
100
29
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
5
|
-
export { default as useCollaborationPolicy } from "./useCollaborationPolicy";
|
|
1
|
+
export { buildPolicySql, buildPolicySqlWithValidation, categorizePolicies, } from "./core/sql-builder";
|
|
2
|
+
export type { AttributePathIndex, ExtendedAttributeNode, PathValue, PolicyFilter, PolicyMatchResult, PolicySqlFragments, PolicySqlGroup, StructureNode, } from "./core/types";
|
|
3
|
+
export type { CollaborationPolicyInput, CollaborationPolicyType, } from "./types";
|
|
4
|
+
export { buildCollaborationPolicyJsonSchema, CollaborationPolicy, } from "./types";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export { buildPolicySql,
|
|
3
|
-
|
|
4
|
-
export { default as useCollaborationPolicy } from "./useCollaborationPolicy";
|
|
1
|
+
// Export the main functions
|
|
2
|
+
export { buildPolicySql, buildPolicySqlWithValidation, categorizePolicies, } from "./core/sql-builder";
|
|
3
|
+
export { buildCollaborationPolicyJsonSchema, CollaborationPolicy, } from "./types";
|