@narrative.io/data-collaboration-sdk-ts 2.94.0 → 2.95.0-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.
Files changed (40) hide show
  1. package/build/apps/index.d.ts +7 -0
  2. package/build/apps/index.js +9 -0
  3. package/build/collaboration-policy/core/filter-builder.js +7 -1
  4. package/build/collaboration-policy/core/jsonschema/json-schema-types.d.ts +45 -0
  5. package/build/collaboration-policy/core/jsonschema/json-schema-types.js +1 -0
  6. package/build/collaboration-policy/core/jsonschema/policy-branches.d.ts +49 -0
  7. package/build/collaboration-policy/core/jsonschema/policy-branches.js +1 -0
  8. package/build/collaboration-policy/core/jsonschema/policy-evaluator.d.ts +22 -0
  9. package/build/collaboration-policy/core/jsonschema/policy-evaluator.js +260 -0
  10. package/build/collaboration-policy/core/jsonschema/sql-builder.d.ts +79 -0
  11. package/build/collaboration-policy/core/jsonschema/sql-builder.js +305 -0
  12. package/build/collaboration-policy/core/jsonschema/sql-poc.d.ts +79 -0
  13. package/build/collaboration-policy/core/jsonschema/sql-poc.js +305 -0
  14. package/build/collaboration-policy/core/sql-builder.js +11 -9
  15. package/build/collaboration-policy/core/types.d.ts +81 -10
  16. package/build/collaboration-policy/index.d.ts +5 -4
  17. package/build/collaboration-policy/index.js +4 -3
  18. package/build/collaboration-policy/useCollaborationPolicy.d.ts +13 -4
  19. package/build/collaboration-policy/useCollaborationPolicy.js +23 -1
  20. package/build/collaboration-policy/utils/path-helpers.d.ts +7 -3
  21. package/build/collaboration-policy/utils/path-helpers.js +6 -22
  22. package/build/compute-pools/index.d.ts +10 -0
  23. package/build/compute-pools/index.js +21 -0
  24. package/build/compute-pools/types.d.ts +97 -0
  25. package/build/compute-pools/types.js +1 -0
  26. package/build/data-planes/index.d.ts +2 -0
  27. package/build/data-planes/index.js +6 -0
  28. package/build/data-planes/types.d.ts +11 -1
  29. package/build/datasets/index.d.ts +11 -2
  30. package/build/datasets/index.js +12 -0
  31. package/build/datasets/types.d.ts +4 -0
  32. package/build/index.d.ts +4 -1
  33. package/build/index.js +4 -0
  34. package/build/nql/SubstraitParser.d.ts +771 -0
  35. package/build/nql/SubstraitParser.js +797 -0
  36. package/package.json +10 -9
  37. package/build/collaboration-policy/types/collaboration-policy.d.ts +0 -1370
  38. package/build/collaboration-policy/types/collaboration-policy.js +0 -274
  39. package/build/collaboration-policy/types/index.d.ts +0 -2
  40. package/build/collaboration-policy/types/index.js +0 -1
@@ -1,4 +1,5 @@
1
1
  import { BaseApi } from "../base-api";
2
+ import type { JsonSchemaConnectorPolicy } from "../collaboration-policy/core/jsonschema/json-schema-types";
2
3
  import type { ApiRecords } from "../types";
3
4
  import type { App, Installation } from "./types";
4
5
  /**
@@ -14,5 +15,11 @@ declare class AppsApi extends BaseApi {
14
15
  */
15
16
  getApps(appCategory?: string): Promise<ApiRecords<App>>;
16
17
  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>>;
17
24
  }
18
25
  export { type App, type Installation, AppsApi };
@@ -21,5 +21,14 @@ 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
+ }
24
33
  }
25
34
  export { AppsApi };
@@ -1,6 +1,12 @@
1
1
  import { normalizePathValue } from "../utils/path-helpers";
2
2
  import { resolveAttributeExpression } from "../utils/sql-helpers";
3
- import { isAttributeReference } from "./filter-utils";
3
+ function isAttributeReference(node) {
4
+ return (!!node &&
5
+ typeof node === "object" &&
6
+ "type" in node &&
7
+ node.type === "attribute" &&
8
+ "attribute_name" in node);
9
+ }
4
10
  export function filterToSql(filter, attributeByName, datasetName) {
5
11
  const op = filter.op.toLowerCase();
6
12
  switch (op) {
@@ -0,0 +1,45 @@
1
+ import type { JSONSchema7 } from "json-schema";
2
+ /**
3
+ * Base JSON Schema type used for connector policies.
4
+ *
5
+ * Uses JSONSchema7 as a structural base. The real API schemas declare
6
+ * `$schema: "https://json-schema.org/draft/2020-12/schema"` and are
7
+ * validated with AJV 2020-12.
8
+ */
9
+ export type JsonSchema = JSONSchema7;
10
+ /**
11
+ * Shape of a JSON-Schema-based connector policy as returned by the backend API.
12
+ *
13
+ * The `policy` field is a JSON Schema document that must be satisfied
14
+ * by `dataset.schema`. Refresh schedule lives in `metadata.refresh_schedule.max`.
15
+ *
16
+ * Filters live on property definitions inside the schema (as `filters` arrays
17
+ * on individual attribute entries), not on anyOf branches.
18
+ */
19
+ export interface JsonSchemaConnectorPolicy {
20
+ /** Stable identifier (e.g., "audience_first_party_new"). */
21
+ name: string;
22
+ /** Policy ID, typically matches name. */
23
+ id: string;
24
+ /** The app this policy belongs to. */
25
+ app_id: number;
26
+ /** Metadata including tags and refresh schedule. */
27
+ metadata: {
28
+ tags?: string[];
29
+ refresh_schedule?: {
30
+ min: string | null;
31
+ max: string;
32
+ };
33
+ };
34
+ /**
35
+ * The JSON Schema that must be satisfied by dataset.schema.
36
+ * Contains `properties`, `required`, `anyOf`/`allOf` for branch structure.
37
+ * Filters are on property definitions (sibling `properties` next to `anyOf`).
38
+ * May declare `$schema: "https://json-schema.org/draft/2020-12/schema"`.
39
+ */
40
+ policy: JsonSchema;
41
+ /** UI form schema — not used by the SDK. */
42
+ schema?: any;
43
+ /** UI schema — not used by the SDK. */
44
+ uischema?: any;
45
+ }
@@ -0,0 +1,49 @@
1
+ import type { PolicyFilter } from "../types";
2
+ import type { JsonSchemaConnectorPolicy } from "./json-schema-types";
3
+ /**
4
+ * A single logical branch within a JSON-Schema policy that matched the dataset.
5
+ * Typically corresponds to one entry in schema.properties.properties.anyOf[*],
6
+ * or an allOf group inside one of those entries.
7
+ */
8
+ export interface PolicyBranchMatch {
9
+ /**
10
+ * Index into the top-level anyOf array under the policy's
11
+ * `policy.properties.properties.anyOf`.
12
+ */
13
+ branchIndex: number;
14
+ /**
15
+ * Required attribute names for this branch. These correspond to Schema.properties keys
16
+ * like "sha256_hashed_email", "postal_code", etc.
17
+ */
18
+ requiredAttributes: string[];
19
+ /**
20
+ * Filters collected from the property definitions for this branch's required attributes.
21
+ * Filters live on the property definitions (sibling `properties` to `anyOf`), not on branches.
22
+ * These follow the existing PolicyFilter structure and can be fed directly into filterToSql.
23
+ */
24
+ filters: PolicyFilter[];
25
+ /**
26
+ * Additional required subfield paths per attribute, used to generate IS NOT NULL WHERE clauses.
27
+ * Derived from `$ref` resolution against `$defs` in the JSON Schema.
28
+ *
29
+ * Example: for `sha256_hashed_phone_number` referencing an object-type `$def`,
30
+ * this produces `(company_data."ds"."_rosetta_stone"."sha256_hashed_phone_number"."type" IS NOT NULL)`.
31
+ */
32
+ additionalRequiredProperties: Array<{
33
+ attributeName: string;
34
+ paths: string[];
35
+ }>;
36
+ }
37
+ /**
38
+ * Evaluation result for a single JSON-Schema-based policy.
39
+ */
40
+ export interface PolicyEvaluation {
41
+ /** The policy that was evaluated. */
42
+ policy: JsonSchemaConnectorPolicy;
43
+ /** Whether dataset.schema is compatible with the policy's JSON Schema. */
44
+ isValid: boolean;
45
+ /** Branches within the policy that are satisfied for this dataset. */
46
+ matches: PolicyBranchMatch[];
47
+ /** Human-readable validation issues if isValid === false. */
48
+ errors: string[];
49
+ }
@@ -0,0 +1,22 @@
1
+ import type { Attribute } from "../../../attributes/types";
2
+ import type { Dataset } from "../../../datasets/types";
3
+ import type { JsonSchemaConnectorPolicy } from "./json-schema-types";
4
+ import type { PolicyEvaluation } from "./policy-branches";
5
+ /**
6
+ * Evaluate an array of JSON-Schema-based connector policies against a dataset.
7
+ *
8
+ * Eligibility is determined by checking whether the dataset's Rosetta Stone
9
+ * attributes satisfy at least one anyOf branch in the policy schema. This uses
10
+ * the `attributes` array (resolved from dataset mappings) as the source of truth,
11
+ * NOT the raw dataset.schema — the raw schema contains storage-level column names
12
+ * and flat types that don't match the policy's Rosetta Stone attribute names.
13
+ *
14
+ * A policy is considered valid (compatible) if `findMatchingBranches` finds at
15
+ * least one satisfied branch.
16
+ *
17
+ * @param _dataset - The dataset (currently unused; attributes carry the relevant info).
18
+ * @param attributes - Rosetta Stone attributes associated with the dataset.
19
+ * @param policies - JSON-Schema-based connector policies to evaluate.
20
+ * @returns An array of PolicyEvaluation results, one per policy.
21
+ */
22
+ export declare function evaluateJsonSchemaPolicies(_dataset: Dataset, attributes: Attribute[], policies: JsonSchemaConnectorPolicy[]): PolicyEvaluation[];
@@ -0,0 +1,260 @@
1
+ /**
2
+ * Collect filters for a list of required attribute names by looking them up
3
+ * in the property definitions object (sibling to anyOf).
4
+ *
5
+ * In the real API shape, filters live on individual property definitions:
6
+ *
7
+ * schema.properties.properties.properties = {
8
+ * "sha256_hashed_email": {
9
+ * "$ref": "#/$defs/object_value",
10
+ * "attribute": "https://api.narrative.io/attributes/sha256_hashed_email",
11
+ * "filters": [ ... ]
12
+ * }
13
+ * }
14
+ *
15
+ * @param requiredAttrs - Attribute names whose filters should be collected.
16
+ * @param propertyDefs - The property definitions object from the schema.
17
+ * @returns Collected filters from all matching property definitions.
18
+ */
19
+ function collectFiltersForAttributes(requiredAttrs, propertyDefs) {
20
+ if (!propertyDefs)
21
+ return [];
22
+ const filters = [];
23
+ for (const attrName of requiredAttrs) {
24
+ const propDef = propertyDefs[attrName];
25
+ if (propDef?.filters && Array.isArray(propDef.filters)) {
26
+ filters.push(...propDef.filters);
27
+ }
28
+ }
29
+ return filters;
30
+ }
31
+ /**
32
+ * Resolve a `$ref` on a property definition to its `$defs` entry and extract
33
+ * the required data subfields that should generate IS NOT NULL WHERE clauses.
34
+ *
35
+ * Only object-type `$defs` (where `properties.type.const === "object"`) have
36
+ * data subfields. For these:
37
+ * - Top-level `required` entries (excluding "properties") map to data subfields (e.g., "type")
38
+ * - Inner `properties.properties.required` entries map to nested data subfields (e.g., "value")
39
+ *
40
+ * Primitive types (like `string_value_type`) return no subfields.
41
+ *
42
+ * @param propDef - The property definition that may have a `$ref`.
43
+ * @param defs - The `$defs` object from the schema root.
44
+ * @returns Array of subfield names that require IS NOT NULL checks.
45
+ */
46
+ function resolveRefRequiredSubfields(propDef, defs) {
47
+ if (!propDef.$ref || !defs)
48
+ return [];
49
+ const defName = propDef.$ref.replace(/^#\/\$defs\//, "");
50
+ const def = defs[defName];
51
+ if (!def)
52
+ return [];
53
+ const defProperties = def.properties;
54
+ if (!defProperties)
55
+ return [];
56
+ // Only object-type $defs have data subfields
57
+ const typeProperty = defProperties.type;
58
+ if (typeProperty?.const !== "object")
59
+ return [];
60
+ const subfields = [];
61
+ // Top-level required, minus "properties" (structural wrapper)
62
+ const topRequired = def.required;
63
+ if (topRequired) {
64
+ for (const field of topRequired) {
65
+ if (field !== "properties")
66
+ subfields.push(field);
67
+ }
68
+ }
69
+ // Inner properties.properties.required
70
+ const innerProps = defProperties.properties;
71
+ const innerRequired = innerProps?.required;
72
+ if (innerRequired) {
73
+ for (const field of innerRequired) {
74
+ if (!subfields.includes(field))
75
+ subfields.push(field);
76
+ }
77
+ }
78
+ return subfields;
79
+ }
80
+ /**
81
+ * Collect required data subfields for a list of attribute names by resolving
82
+ * their `$ref` entries against the schema's `$defs`.
83
+ *
84
+ * These generate IS NOT NULL WHERE clauses in the SQL builder.
85
+ *
86
+ * @param requiredAttrs - Attribute names whose required subfields should be collected.
87
+ * @param propertyDefs - The property definitions object from the schema.
88
+ * @param defs - The `$defs` object from the schema root.
89
+ * @returns Per-attribute list of subfield paths that require IS NOT NULL checks.
90
+ */
91
+ function collectRequiredSubfieldsFromRefs(requiredAttrs, propertyDefs, defs) {
92
+ if (!propertyDefs)
93
+ return [];
94
+ const result = [];
95
+ for (const attrName of requiredAttrs) {
96
+ const propDef = propertyDefs[attrName];
97
+ if (!propDef)
98
+ continue;
99
+ const paths = resolveRefRequiredSubfields(propDef, defs);
100
+ if (paths.length > 0) {
101
+ result.push({ attributeName: attrName, paths });
102
+ }
103
+ }
104
+ return result;
105
+ }
106
+ /**
107
+ * Determine which branches in a JSON-Schema policy are satisfied for the given attributes.
108
+ *
109
+ * Expects the real API structure:
110
+ *
111
+ * schema.properties.properties = {
112
+ * anyOf: [
113
+ * { required: ["sha256_hashed_email"] },
114
+ * { allOf: [
115
+ * { required: ["person_name"] },
116
+ * { required: ["iso_3166_1_country"] },
117
+ * { required: ["postal_address"] }
118
+ * ]
119
+ * }
120
+ * ],
121
+ * properties: {
122
+ * "sha256_hashed_email": {
123
+ * "$ref": "#/$defs/attribute_value",
124
+ * "attribute": "https://api.narrative.io/attributes/sha256_hashed_email",
125
+ * "filters": [ ... ],
126
+ * "$ref": "#/$defs/object_value"
127
+ * },
128
+ * ...
129
+ * }
130
+ * }
131
+ *
132
+ * Branches only contain `required` arrays. Filters are defined on the property
133
+ * definitions (sibling `properties` object next to `anyOf`). Required subfields
134
+ * for IS NOT NULL clauses are derived by resolving `$ref` entries against `$defs`.
135
+ *
136
+ * A branch is considered satisfied if:
137
+ * - For a simple branch: all required property names exist as Attributes by name.
138
+ * - For an allOf group: all sub-branches' required property names exist as Attributes.
139
+ *
140
+ * @param policy - The JSON-Schema connector policy to inspect.
141
+ * @param attributes - Attributes available on the dataset.
142
+ * @returns A list of matching branches with their required attributes, filters, and additional requirements.
143
+ */
144
+ function findMatchingBranches(policy, attributes) {
145
+ const attributeByName = new Map();
146
+ for (const attr of attributes) {
147
+ attributeByName.set(attr.name, attr);
148
+ }
149
+ const schema = policy.policy;
150
+ const schemaProps = schema.properties;
151
+ // Extract $defs from the schema root for $ref resolution
152
+ const defs = schema.$defs;
153
+ // Expect something like: schema.properties.properties.anyOf
154
+ const propertiesObj = schemaProps &&
155
+ schemaProps.properties;
156
+ const anyOfBranches = propertiesObj?.anyOf;
157
+ if (!Array.isArray(anyOfBranches)) {
158
+ return [];
159
+ }
160
+ // Property definitions live as a sibling to anyOf — this is where filters are.
161
+ const propertyDefs = propertiesObj?.properties;
162
+ const matches = [];
163
+ anyOfBranches.forEach((branch, index) => {
164
+ if (!branch || typeof branch !== "object")
165
+ return;
166
+ const branchObj = branch;
167
+ // Case 1: "allOf" group branch (bundle of multiple fields)
168
+ if (Array.isArray(branchObj.allOf)) {
169
+ const groupRequiredAttrs = [];
170
+ let allSubBranchesSatisfied = true;
171
+ for (const sub of branchObj.allOf) {
172
+ if (!sub || typeof sub !== "object") {
173
+ allSubBranchesSatisfied = false;
174
+ break;
175
+ }
176
+ const subObj = sub;
177
+ const subRequired = Array.isArray(subObj.required)
178
+ ? subObj.required
179
+ : [];
180
+ // Sub-branch is satisfied if all required keys exist as attributes.
181
+ const missingSub = subRequired.filter((key) => !attributeByName.has(key));
182
+ if (missingSub.length > 0) {
183
+ allSubBranchesSatisfied = false;
184
+ break;
185
+ }
186
+ groupRequiredAttrs.push(...subRequired);
187
+ }
188
+ if (!allSubBranchesSatisfied) {
189
+ return; // this outer anyOf branch is not satisfied
190
+ }
191
+ const deduped = Array.from(new Set(groupRequiredAttrs));
192
+ matches.push({
193
+ branchIndex: index,
194
+ requiredAttributes: deduped,
195
+ filters: collectFiltersForAttributes(deduped, propertyDefs),
196
+ additionalRequiredProperties: collectRequiredSubfieldsFromRefs(deduped, propertyDefs, defs),
197
+ });
198
+ return;
199
+ }
200
+ // Case 2: simple single-field branch
201
+ const branchRequired = Array.isArray(branchObj.required)
202
+ ? branchObj.required
203
+ : [];
204
+ const missing = branchRequired.filter((key) => !attributeByName.has(key));
205
+ if (missing.length > 0) {
206
+ return; // this branch is not satisfied
207
+ }
208
+ matches.push({
209
+ branchIndex: index,
210
+ requiredAttributes: branchRequired,
211
+ filters: collectFiltersForAttributes(branchRequired, propertyDefs),
212
+ additionalRequiredProperties: collectRequiredSubfieldsFromRefs(branchRequired, propertyDefs, defs),
213
+ });
214
+ });
215
+ return matches;
216
+ }
217
+ /**
218
+ * Evaluate an array of JSON-Schema-based connector policies against a dataset.
219
+ *
220
+ * Eligibility is determined by checking whether the dataset's Rosetta Stone
221
+ * attributes satisfy at least one anyOf branch in the policy schema. This uses
222
+ * the `attributes` array (resolved from dataset mappings) as the source of truth,
223
+ * NOT the raw dataset.schema — the raw schema contains storage-level column names
224
+ * and flat types that don't match the policy's Rosetta Stone attribute names.
225
+ *
226
+ * A policy is considered valid (compatible) if `findMatchingBranches` finds at
227
+ * least one satisfied branch.
228
+ *
229
+ * @param _dataset - The dataset (currently unused; attributes carry the relevant info).
230
+ * @param attributes - Rosetta Stone attributes associated with the dataset.
231
+ * @param policies - JSON-Schema-based connector policies to evaluate.
232
+ * @returns An array of PolicyEvaluation results, one per policy.
233
+ */
234
+ export function evaluateJsonSchemaPolicies(_dataset, attributes, policies) {
235
+ const evaluations = [];
236
+ for (const policy of policies) {
237
+ // Determine which branches within the policy are satisfied by the
238
+ // dataset's Rosetta Stone attributes.
239
+ const matches = findMatchingBranches(policy, attributes);
240
+ if (matches.length > 0) {
241
+ evaluations.push({
242
+ policy,
243
+ isValid: true,
244
+ matches,
245
+ errors: [],
246
+ });
247
+ }
248
+ else {
249
+ evaluations.push({
250
+ policy,
251
+ isValid: false,
252
+ matches: [],
253
+ errors: [
254
+ `No anyOf branches are satisfied by the available attributes for policy "${policy.name}"`,
255
+ ],
256
+ });
257
+ }
258
+ }
259
+ return evaluations;
260
+ }
@@ -0,0 +1,79 @@
1
+ import type { Attribute } from "../../../attributes/types";
2
+ import type { Dataset } from "../../../datasets/types";
3
+ import type { PolicyMatchResult, PolicySqlFragments } from "../types";
4
+ import type { JsonSchemaConnectorPolicy } from "./json-schema-types";
5
+ import type { PolicyBranchMatch } from "./policy-branches";
6
+ /**
7
+ * JSON-Schema-based equivalent of PolicyMatchResult, but instead of fully-built SQL,
8
+ * it carries branch-level matches that your existing SQL builder can consume.
9
+ */
10
+ export interface JsonSchemaPolicyMatchResult {
11
+ /** Names of policies whose JSON Schemas were compatible with the dataset. */
12
+ appliedPolicies: string[];
13
+ /** Policies that were skipped because validation failed. */
14
+ skippedPolicies: PolicyMatchResult["skippedPolicies"];
15
+ /** Non-fatal warnings (e.g. some policies were skipped). */
16
+ warnings: string[];
17
+ /**
18
+ * The minimum refresh schedule (most frequent) across all applied policies,
19
+ * expressed as an ISO 8601 duration string.
20
+ */
21
+ refresh_schedule: string;
22
+ /**
23
+ * For each applied policy, which branches matched and what filters/attributes
24
+ * they require. This is what your SQL builder layer should consume.
25
+ */
26
+ branchMatches: Array<{
27
+ policyName: string;
28
+ branches: PolicyBranchMatch[];
29
+ }>;
30
+ }
31
+ /**
32
+ * Categorize JSON-Schema-based connector policies into matching and non-matching
33
+ * groups based on dataset compatibility.
34
+ *
35
+ * @param policies - JSON-Schema-based connector policies.
36
+ * @param dataset - Dataset whose schema is used for validation.
37
+ * @param attributes - Attributes associated with the dataset.
38
+ * @returns Object with matching policies, nonMatching policies, and skip details.
39
+ */
40
+ export declare function categorizePolicies(policies: JsonSchemaConnectorPolicy[], dataset: Dataset, attributes: Attribute[]): {
41
+ matching: JsonSchemaConnectorPolicy[];
42
+ nonMatching: JsonSchemaConnectorPolicy[];
43
+ skippedDetails: PolicyMatchResult["skippedPolicies"];
44
+ };
45
+ /**
46
+ * Helper that evaluates JSON-Schema-based policies and returns branch-level
47
+ * matches plus scheduling information.
48
+ *
49
+ * This is intended to be consumed by a separate SQL builder layer or for
50
+ * inspection of branch-level match details.
51
+ *
52
+ * @param dataset - The dataset against which policies should be evaluated.
53
+ * @param policies - JSON-Schema-based connector policies.
54
+ * @param attributes - Attributes associated with the dataset.
55
+ * @returns JsonSchemaPolicyMatchResult with applied/skipped policies and branch matches.
56
+ * @throws If no policies are compatible with the dataset.
57
+ */
58
+ export declare function buildPolicySqlWithJsonSchema(dataset: Dataset, policies: JsonSchemaConnectorPolicy[], attributes: Attribute[]): JsonSchemaPolicyMatchResult;
59
+ /**
60
+ * Uses JSON Schema branch matching to determine valid policies, then builds
61
+ * SELECT and WHERE SQL fragments.
62
+ *
63
+ * @param dataset - Dataset for which to evaluate policies and produce SQL.
64
+ * @param policies - JSON-Schema-based connector policies.
65
+ * @param attributes - Attributes associated with the dataset.
66
+ * @returns PolicyMatchResult with select, where, applied/skipped policies, warnings, and refresh schedule.
67
+ */
68
+ export declare function buildPolicySqlWithValidation(dataset: Dataset, policies: JsonSchemaConnectorPolicy[], attributes: Attribute[]): PolicyMatchResult;
69
+ /**
70
+ * Build SQL fragments without validation. Assumes you already filtered the policies
71
+ * however you want (e.g. via categorizePolicies). Builds SELECT and WHERE SQL
72
+ * fragments from all provided policies.
73
+ *
74
+ * @param dataset - Dataset for which to build SQL fragments.
75
+ * @param policies - JSON-Schema-based connector policies.
76
+ * @param attributes - Attributes associated with the dataset.
77
+ * @returns PolicySqlFragments with select and where arrays.
78
+ */
79
+ export declare function buildPolicySql(dataset: Dataset, policies: JsonSchemaConnectorPolicy[], attributes: Attribute[]): PolicySqlFragments;