@squidcloud/client 1.0.501 → 1.0.502
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/dist/cjs/index.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/internal-common/src/ai/system-openai-compatible.d.ts +35 -0
- package/dist/internal-common/src/metric-name.d.ts +5 -0
- package/dist/internal-common/src/public-types/ai-agent.public-types.d.ts +3 -3
- package/dist/internal-common/src/public-types/ai-knowledge-base.public-types.d.ts +14 -0
- package/dist/internal-common/src/public-types-backend/api-call.public-context.d.ts +30 -0
- package/dist/internal-common/src/public-types-backend/mutation.public-context.d.ts +161 -0
- package/dist/internal-common/src/public-types-backend/native-query.public-context.d.ts +75 -0
- package/dist/internal-common/src/public-types-backend/query.public-context.d.ts +193 -0
- package/dist/internal-common/src/types/ai-agent.types.d.ts +304 -0
- package/dist/internal-common/src/types/ai-knowledge-base.types.d.ts +798 -0
- package/dist/internal-common/src/types/ai-matchmaking.types.d.ts +19 -0
- package/dist/internal-common/src/types/backend-function.types.d.ts +1 -0
- package/dist/internal-common/src/types/communication.types.d.ts +1 -0
- package/dist/internal-common/src/types/document.types.d.ts +1 -0
- package/dist/internal-common/src/types/file.types.d.ts +6 -0
- package/dist/internal-common/src/types/headers.types.d.ts +45 -0
- package/dist/internal-common/src/types/management-api-key.types.d.ts +92 -0
- package/dist/internal-common/src/types/mutation.types.d.ts +1 -0
- package/dist/internal-common/src/types/notification.types.d.ts +19 -0
- package/dist/internal-common/src/types/observability.types.d.ts +296 -0
- package/dist/internal-common/src/types/query.types.d.ts +21 -0
- package/dist/internal-common/src/types/secret.types.d.ts +7 -0
- package/dist/internal-common/src/types/socket.types.d.ts +1 -0
- package/dist/internal-common/src/types/stage.d.ts +9 -0
- package/dist/internal-common/src/types/time-units.d.ts +1 -0
- package/dist/internal-common/src/types/url-shortener.types.d.ts +45 -0
- package/dist/internal-common/src/utils/array.d.ts +7 -0
- package/dist/internal-common/src/utils/connector-path-status.d.ts +27 -0
- package/dist/internal-common/src/utils/e2e-test-utils.d.ts +2 -0
- package/dist/internal-common/src/utils/file-utils.d.ts +2 -0
- package/dist/internal-common/src/utils/global.utils.d.ts +1 -0
- package/dist/internal-common/src/utils/http-utils.d.ts +15 -0
- package/dist/internal-common/src/utils/http.d.ts +4 -0
- package/dist/internal-common/src/utils/integration-access-tokens.d.ts +15 -0
- package/dist/internal-common/src/utils/lock.manager.d.ts +14 -0
- package/dist/internal-common/src/utils/metric-utils.d.ts +4 -0
- package/dist/internal-common/src/utils/metrics.types.d.ts +7 -0
- package/dist/internal-common/src/utils/object.d.ts +93 -0
- package/dist/internal-common/src/utils/serialization.d.ts +30 -0
- package/dist/internal-common/src/utils/squid.constants.d.ts +3 -0
- package/dist/internal-common/src/utils/trace-id-generator.d.ts +1 -0
- package/dist/internal-common/src/utils/validation.d.ts +21 -0
- package/dist/internal-common/src/websocket.impl.d.ts +26 -0
- package/dist/typescript-client/src/integration-client.d.ts +125 -1
- package/dist/typescript-client/src/version.d.ts +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { AppId } from '../public-types/communication.public-types';
|
|
2
|
+
import { Stage } from '../types/stage';
|
|
3
|
+
export declare function getEnvironmentPrefix(shard: string | undefined, region: string, cloudId: string, stage: Stage): string;
|
|
4
|
+
export declare function getApplicationUrl(environmentPrefix: string, appId: string, path: string, appIdPlaceholder?: AppId, environmentPrefixPlaceholder?: string): string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AiChatRequestCredentials } from '../public-types/ai-agent.public-types';
|
|
2
|
+
import { IntegrationId } from '../public-types/communication.public-types';
|
|
3
|
+
/** Access tokens a caller supplies for one request, keyed by integration ID. */
|
|
4
|
+
export type IntegrationAccessTokens = Record<IntegrationId, string>;
|
|
5
|
+
/** Serializes [tokens] into the value of the {@link SquidHeaders.INTEGRATION_ACCESS_TOKENS} header. */
|
|
6
|
+
export declare function serializeIntegrationAccessTokens(tokens: IntegrationAccessTokens): string;
|
|
7
|
+
/** Parses the {@link SquidHeaders.INTEGRATION_ACCESS_TOKENS} header value; a malformed value is a bad request. */
|
|
8
|
+
export declare function parseIntegrationAccessTokens(headerValue: string): IntegrationAccessTokens;
|
|
9
|
+
/** Builds the request headers that carry [tokens]; empty when there is nothing to send. */
|
|
10
|
+
export declare function toIntegrationAccessTokenHeaders(tokens: IntegrationAccessTokens | undefined): Record<string, string>;
|
|
11
|
+
/** Splits the tokens off the call [options]: the headers that carry them, and the options the request body takes. */
|
|
12
|
+
export declare function splitIntegrationAccessTokens<T extends AiChatRequestCredentials>(options: T | undefined): {
|
|
13
|
+
headers: Record<string, string>;
|
|
14
|
+
options: Omit<T, 'integrationAccessTokens'> | undefined;
|
|
15
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
type LockMutex = string;
|
|
2
|
+
/**
|
|
3
|
+
* A simple lock manager that locks a list of mutexes.
|
|
4
|
+
* When locking a list of mutexes, the lock will start only when all the mutexes are available - preventing partial lock
|
|
5
|
+
* and potential deadlocks.
|
|
6
|
+
*/
|
|
7
|
+
export declare class LockManager {
|
|
8
|
+
private readonly locks;
|
|
9
|
+
lock(...mutexes: LockMutex[]): Promise<void>;
|
|
10
|
+
release(...mutexes: LockMutex[]): void;
|
|
11
|
+
canGetLock(...mutexes: LockMutex[]): boolean;
|
|
12
|
+
lockSync(...mutexes: LockMutex[]): void;
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { QueryMetricsRequestCommon, QueryMetricsResultGroup } from '../public-types/metric.public-types';
|
|
2
|
+
export type QueryMetricsRequestIntervals = Required<Pick<QueryMetricsRequestCommon, 'fillValue' | 'fn' | 'groupByTags' | 'periodEndSeconds' | 'periodStartSeconds' | 'pointIntervalAlignment' | 'pointIntervalSeconds' | 'tagDomains' | 'noDataBehavior'>>;
|
|
3
|
+
/** Adds missed known tag domain groups and fills all missed points with a request.fillValue. */
|
|
4
|
+
export declare function fillMissedPoints(request: QueryMetricsRequestIntervals, resultGroups: Array<QueryMetricsResultGroup>): void;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type suffixes defines the type of the metric and can be used for
|
|
3
|
+
* metric value validation for incoming metrics.
|
|
4
|
+
*/
|
|
5
|
+
export declare const SQUID_METRIC_TYPE_SUFFIXES: readonly ["_count", "_time", "_size", "_entries", "_value"];
|
|
6
|
+
/** Returns true if the given metric has a valid metric type. */
|
|
7
|
+
export declare function hasValidMetricTypeSuffix(metricName: string): boolean;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/** Splits a field path into the segments `getInPath` walks: a dot or a bracket separates them. */
|
|
2
|
+
export declare const SPLIT_REGEX_FOR_GET_IN_PATH: RegExp;
|
|
3
|
+
/** Returns a value by the `path`. Works with array indexes, like a.b[0]. */
|
|
4
|
+
export declare function getInPath(obj: unknown, path: string): any;
|
|
5
|
+
export declare function isDateObject(value: unknown): value is Date;
|
|
6
|
+
/** Sets a value by path . Does not support array indexes. */
|
|
7
|
+
export declare function setInPath(obj: object, path: string, value: unknown, delimiter?: string): void;
|
|
8
|
+
export declare function deleteInPath(obj: object, path: string, delimiter?: string): void;
|
|
9
|
+
export declare function replaceKeyInMap<K, T>(map: Map<K, T | undefined>, a: K, b: K): void;
|
|
10
|
+
export declare function replaceKeyInRecord<K extends keyof any, T>(record: Record<K, T>, a: K, b: K): void;
|
|
11
|
+
export declare function isNil(obj: unknown): obj is null | undefined;
|
|
12
|
+
export declare function isEqual(a: unknown, b: unknown): boolean;
|
|
13
|
+
export declare function isEmpty(a: unknown): boolean;
|
|
14
|
+
export declare function omit<T extends object, K extends PropertyKey[]>(object: T | null | undefined, ...fieldsToRemove: K): Pick<T, Exclude<keyof T, K[number]>>;
|
|
15
|
+
export type CloneCustomizer = (value: unknown) => unknown | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Creates a deep copy of the specified object, including all nested objects and specifically handling Date, Map, and
|
|
18
|
+
* Set fields.
|
|
19
|
+
*
|
|
20
|
+
* The customizer function can modify the cloning process for the object and its fields. If the customizer
|
|
21
|
+
* returns 'undefined' for any input, the function falls back to the standard cloning logic.
|
|
22
|
+
*
|
|
23
|
+
* The cloning process is recursive, ensuring deep cloning of all objects.
|
|
24
|
+
*
|
|
25
|
+
* Note: This function does not support cloning objects with circular dependencies and will throw a system stack
|
|
26
|
+
* overflow error if encountered.
|
|
27
|
+
*/
|
|
28
|
+
export declare function cloneDeep<R = unknown>(value: R, customizer?: CloneCustomizer): R;
|
|
29
|
+
/** Creates a shallow clone of the object. */
|
|
30
|
+
export declare function cloneShallow<T>(value: T): T;
|
|
31
|
+
export declare function deepMerge<T extends object, U extends object>(target: T, source: U): T & U;
|
|
32
|
+
/** Returns true if the `value` is a defined object and is not an array. */
|
|
33
|
+
export declare function isPlainObject(value: unknown): value is object;
|
|
34
|
+
/**
|
|
35
|
+
* Returns true if the `value` is an object that JSON can hold as it is: a plain object whose values are JSON at any
|
|
36
|
+
* depth, with no `__proto__` key. A `Date` or another class instance is not one.
|
|
37
|
+
*/
|
|
38
|
+
export declare function isJsonObject(value: unknown): value is Record<string, unknown>;
|
|
39
|
+
/** Compares 2 values. 'null' and 'undefined' values are considered equal and are less than any other values. */
|
|
40
|
+
export declare function compareValues(v1: unknown, v2: unknown): number;
|
|
41
|
+
/** Returns a new object with all top-level object fields re-mapped using `valueMapperFn`. */
|
|
42
|
+
export declare function mapValues<ResultType extends object = Record<string, unknown>, InputType extends Record<string, unknown> = Record<string, unknown>>(obj: InputType, valueMapperFn: (value: any, key: keyof InputType, obj: InputType) => unknown): ResultType;
|
|
43
|
+
/** Groups elements of the array by key. See _.groupBy for details. */
|
|
44
|
+
export declare function groupBy<T, K extends PropertyKey>(array: T[], getKey: (item: T) => K): Record<K, T[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Picks selected fields from the object and returns a new object with the fields selected.
|
|
47
|
+
* The selected fields are assigned by reference (there is no cloning).
|
|
48
|
+
*/
|
|
49
|
+
export declare function pick<T extends object, K extends keyof T>(obj: T, keys: ReadonlyArray<K>): Pick<T, K>;
|
|
50
|
+
/** Inverts the record: swaps keys and values. */
|
|
51
|
+
export declare function invert<K extends string | number, V extends string | number>(record: Record<K, V>): Record<V, K>;
|
|
52
|
+
/**
|
|
53
|
+
* Creates an array of numbers (positive and/or negative) progressing from start up to, but not including, end.
|
|
54
|
+
* If end is less than start a zero-length range is created unless a negative step is specified.
|
|
55
|
+
*
|
|
56
|
+
* Same as lodash range but with an additional parameter: `maximumNumberOfItems`.
|
|
57
|
+
*/
|
|
58
|
+
export declare function range(start: number, end: number, step: number, maximumNumberOfItems?: number): number[];
|
|
59
|
+
/** Returns count of top level properties in object. */
|
|
60
|
+
export declare function countObjectKeys(obj: object | undefined | null): number;
|
|
61
|
+
/** Returns object entries sorted by name. */
|
|
62
|
+
export declare function getSortedEntries<T>(record: Record<string, T>): Array<[string, T]>;
|
|
63
|
+
/** Removes top level fields which are empty objects. May be used for value formatting. */
|
|
64
|
+
export declare function removeEmptyTopLevelRecords<T extends object>(record: T): Partial<T>;
|
|
65
|
+
export declare function removeUndefinedValues<V>(tags: Record<string, V | undefined>): Record<string, V>;
|
|
66
|
+
export declare function extractKey(line: string | undefined): string | null;
|
|
67
|
+
/** Represents a line in a diff output */
|
|
68
|
+
export interface DiffLine {
|
|
69
|
+
lineNumber: number;
|
|
70
|
+
text: string;
|
|
71
|
+
type: 'unchanged' | 'added' | 'removed' | 'changed';
|
|
72
|
+
}
|
|
73
|
+
/** Result of computing a line-by-line diff between two objects */
|
|
74
|
+
export interface DiffResult {
|
|
75
|
+
leftLines: Array<DiffLine>;
|
|
76
|
+
rightLines: Array<DiffLine>;
|
|
77
|
+
hasChanges: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Computes a line-by-line diff between two objects.
|
|
81
|
+
* Objects are serialized to JSON with sorted keys for consistent comparison.
|
|
82
|
+
* @param before The previous/left object (can be undefined for new objects)
|
|
83
|
+
* @param after The current/right object
|
|
84
|
+
* @returns DiffResult with left and right lines and whether there are changes
|
|
85
|
+
*/
|
|
86
|
+
export declare function computeObjectDiff(before: unknown, after: unknown): DiffResult;
|
|
87
|
+
/**
|
|
88
|
+
* Formats an object as diff lines (all unchanged).
|
|
89
|
+
* Useful for displaying a single object without comparison.
|
|
90
|
+
* @param obj The object to format
|
|
91
|
+
* @returns Array of DiffLine with all lines marked as unchanged
|
|
92
|
+
*/
|
|
93
|
+
export declare function formatObjectAsLines(obj: unknown): Array<DiffLine>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare function sortKeys(json: unknown): any;
|
|
2
|
+
export declare function normalizeJsonAsString(json: unknown): string;
|
|
3
|
+
export declare function serializeObj(obj: unknown): string;
|
|
4
|
+
/**
|
|
5
|
+
* A `JSON.stringify` replacer writing a `Date` as `{ $date }`, the form {@link deserializeObj} reads back,
|
|
6
|
+
* for callers that keep every other value's own `toJSON`. The date is read off the holder, since a
|
|
7
|
+
* replacer is handed the `toJSON` text of a date; an invalid date keeps that text, `null`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function writeDateAsBson(this: Record<string, unknown>, key: string, value: unknown): unknown;
|
|
10
|
+
export declare function deserializeObj<T = any>(str: string): T;
|
|
11
|
+
/**
|
|
12
|
+
* Deserializes a multipart request payload when present.
|
|
13
|
+
* NestJS does not pull the body out of a multipart request, and leaves the JSON payload in its `body` form field;
|
|
14
|
+
* plain JSON requests carry the payload as-is.
|
|
15
|
+
*/
|
|
16
|
+
export declare function deserializeMultipartBody<T>(request: T): T;
|
|
17
|
+
export declare function encodeValueForMapping(value: unknown): string;
|
|
18
|
+
export declare function decodeValueForMapping(encodedString: string): any;
|
|
19
|
+
/**
|
|
20
|
+
* Compares 2 objects by their normalized JSON value.
|
|
21
|
+
* This function should not be used with objects with circular references.
|
|
22
|
+
* Returns true if the object are equal.
|
|
23
|
+
*/
|
|
24
|
+
export declare function compareByNormalizedJsonValue<T>(v1: T | undefined, v2: T | undefined): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Compares 2 objects by their normalized JSON value for specific fields only.
|
|
27
|
+
* This function should not be used with objects with circular references.
|
|
28
|
+
* Returns true if the specified fields are equal.
|
|
29
|
+
*/
|
|
30
|
+
export declare function compareByNormalizedJsonValueForFields<T>(v1: T | undefined, v2: T | undefined, fields: Array<keyof T>): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function generateTraceId(prefix?: string): string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HttpStatusCode } from '../public-types/http-status.public-types';
|
|
2
|
+
export declare class ValidationError extends Error {
|
|
3
|
+
readonly statusCode: HttpStatusCode;
|
|
4
|
+
readonly details?: any;
|
|
5
|
+
constructor(error: string, statusCode: HttpStatusCode, details?: Record<string, unknown>);
|
|
6
|
+
}
|
|
7
|
+
export declare function isValidId(id: unknown, maxLength?: number): boolean;
|
|
8
|
+
export declare function validateFieldSort(fieldSort: unknown): void;
|
|
9
|
+
/** The largest limit one query may carry. */
|
|
10
|
+
export declare const MAX_QUERY_LIMIT = 20000;
|
|
11
|
+
export declare function validateQueryLimit(limit: unknown): void;
|
|
12
|
+
/**
|
|
13
|
+
* All type names returned by 'typeof' supported by JavaScript:
|
|
14
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof}.
|
|
15
|
+
* and a few other supported types.
|
|
16
|
+
*/
|
|
17
|
+
export type JavascriptTypeName = 'undefined' | 'object' | 'boolean' | 'number' | 'bigint' | 'string' | 'symbol' | 'function';
|
|
18
|
+
/** Returns true if 'typeof' of the 'value' is 'type' or 'type[]'. */
|
|
19
|
+
export declare function isRightType(value: unknown, type: JavascriptTypeName): boolean;
|
|
20
|
+
/** Returns true if 'obj' has only keys listed in the 'keys'. Object can't be an array. */
|
|
21
|
+
export declare function hasOnlyKeys(obj: object, keys: string[]): boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
interface Options {
|
|
2
|
+
maxAttempts?: number;
|
|
3
|
+
protocols?: string[];
|
|
4
|
+
onmessage?: (event: any) => void;
|
|
5
|
+
onopen?: (event: any) => void;
|
|
6
|
+
onclose?: (event: any) => void;
|
|
7
|
+
onerror?: (event: any) => void;
|
|
8
|
+
onreconnect?: (event: any) => void;
|
|
9
|
+
onmaximum?: (event: any) => void;
|
|
10
|
+
timeoutMillis?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface WebSocketWrapper {
|
|
13
|
+
open: () => void;
|
|
14
|
+
reconnect: (e: any) => void;
|
|
15
|
+
json: (x: any) => void;
|
|
16
|
+
send: (x: string) => void;
|
|
17
|
+
close: (x?: number, y?: string) => void;
|
|
18
|
+
connected: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Websocket is explicitly closed by calling socket.close().
|
|
21
|
+
* Used to ignore errors after socket.closed() is called.
|
|
22
|
+
*/
|
|
23
|
+
closeCalled: boolean;
|
|
24
|
+
}
|
|
25
|
+
export declare function createWebSocketWrapper(url: string, opts?: Options): WebSocketWrapper;
|
|
26
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ConnectorPathStatusResult, DiscoverSourceRepositoriesResponse, IntegrationId, IntegrationInfo, IntegrationType } from './public-types';
|
|
1
|
+
import { ConnectorPathStatusResult, DiscoverSourceRepositoriesResponse, IntegrationId, IntegrationInfo, IntegrationType, JobId } from './public-types';
|
|
2
2
|
/**
|
|
3
3
|
* IntegrationClient manages integrations within an application,
|
|
4
4
|
* providing methods for listing, retrieving, updating, and deleting integrations.
|
|
@@ -136,6 +136,32 @@ export declare class IntegrationClient {
|
|
|
136
136
|
* @returns A promise that resolves with the discovered schema and collection readiness information.
|
|
137
137
|
*/
|
|
138
138
|
discoverDataConnectionSchema<SchemaType = Record<string, any>>(integrationId: IntegrationId): Promise<DiscoverDataConnectionSchemaResponse<SchemaType>>;
|
|
139
|
+
/**
|
|
140
|
+
* Starts inferring relationships from the data of a database integration, in the background, over its
|
|
141
|
+
* stored schema. It finds relationships no foreign key declares, discriminator columns, and columns that
|
|
142
|
+
* depend on each other, and writes the findings at the minimum confidence or above into the stored schema.
|
|
143
|
+
* Fails while another run of the integration is active.
|
|
144
|
+
*
|
|
145
|
+
* @param integrationId - The ID of the database integration.
|
|
146
|
+
* @param options - (Optional) What to look for and how much to spend on it.
|
|
147
|
+
* @returns A promise that resolves with the run's job ID, for `squid.jobs().awaitJob(jobId)`.
|
|
148
|
+
*/
|
|
149
|
+
startRelationshipInference(integrationId: IntegrationId, options?: RelationshipInferenceOptions): Promise<JobId>;
|
|
150
|
+
/**
|
|
151
|
+
* Returns the latest relationship-inference run of a database integration, with its progress and findings.
|
|
152
|
+
*
|
|
153
|
+
* @param integrationId - The ID of the database integration.
|
|
154
|
+
* @returns A promise that resolves with the run, or `undefined` when the integration never had one.
|
|
155
|
+
*/
|
|
156
|
+
getRelationshipInference<ItemType = Record<string, any>>(integrationId: IntegrationId): Promise<RelationshipInferenceRun<ItemType> | undefined>;
|
|
157
|
+
/**
|
|
158
|
+
* Stops the active relationship-inference run of a database integration. The run still writes what it
|
|
159
|
+
* found so far, and ends as 'cancelled'.
|
|
160
|
+
*
|
|
161
|
+
* @param integrationId - The ID of the database integration.
|
|
162
|
+
* @returns A promise that resolves when the run is asked to stop.
|
|
163
|
+
*/
|
|
164
|
+
cancelRelationshipInference(integrationId: IntegrationId): Promise<void>;
|
|
139
165
|
/**
|
|
140
166
|
* Tests a data connection (database) to verify it is working.
|
|
141
167
|
* Attempts to connect to the database and perform a basic operation to validate connectivity.
|
|
@@ -292,6 +318,104 @@ export interface DiscoverDataConnectionSchemaResponse<SchemaType = Record<string
|
|
|
292
318
|
* Information about collection readiness for CRUD operations and replication.
|
|
293
319
|
*/
|
|
294
320
|
collectionReadiness: Record<string, CollectionReadiness>;
|
|
321
|
+
/**
|
|
322
|
+
* What discovery could not read, such as the declared foreign keys, and kept as it was.
|
|
323
|
+
*/
|
|
324
|
+
warnings?: string[];
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Options for a relationship-inference run.
|
|
328
|
+
* @category Platform
|
|
329
|
+
*/
|
|
330
|
+
export interface RelationshipInferenceOptions {
|
|
331
|
+
/** What to look for. Defaults to all three. */
|
|
332
|
+
kinds?: Array<'relationships' | 'dependencies' | 'discriminators'>;
|
|
333
|
+
/** Collections to examine, on both sides. Defaults to every collection in the schema. */
|
|
334
|
+
collections?: string[];
|
|
335
|
+
/** Instructions about the data, for the AI; given, they turn `useAi` on. */
|
|
336
|
+
instructions?: string;
|
|
337
|
+
/** Lets the AI propose relationships that names miss, settle close calls, and describe the associations it adds. Off by default. */
|
|
338
|
+
useAi?: boolean;
|
|
339
|
+
/** The lowest confidence written to the schema. Defaults to 'medium'. */
|
|
340
|
+
minConfidence?: 'high' | 'medium' | 'low';
|
|
341
|
+
/** Rows sampled per collection; every finding is judged on them. Defaults to 1,000. */
|
|
342
|
+
sampleSize?: number;
|
|
343
|
+
/** Also checks every finding on all rows, at one more query each. Off by default. */
|
|
344
|
+
verifyOnAllRows?: boolean;
|
|
345
|
+
/** When the run stops and keeps what it has: 60 minutes by default, or 240 with `verifyOnAllRows`; at most 1,440. */
|
|
346
|
+
maxDurationMinutes?: number;
|
|
347
|
+
/** Queries in flight at once. Defaults to 2; at most 8 and the integration's pool size. */
|
|
348
|
+
concurrency?: number;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* A relationship-inference run of a database integration.
|
|
352
|
+
* @category Platform
|
|
353
|
+
*/
|
|
354
|
+
export interface RelationshipInferenceRun<ItemType = Record<string, any>> {
|
|
355
|
+
/** The ID of the database integration. */
|
|
356
|
+
integrationId: IntegrationId;
|
|
357
|
+
/** Whether the run is still going, and how it ended. */
|
|
358
|
+
status: 'running' | 'completed' | 'cancelled' | 'failed';
|
|
359
|
+
/** What the run does now, or 'done'. */
|
|
360
|
+
phase: 'profiling' | 'matching' | 'in-table' | 'verifying' | 'describing' | 'applying' | 'done';
|
|
361
|
+
/** The options the run was started with. */
|
|
362
|
+
options: RelationshipInferenceOptions;
|
|
363
|
+
/** How far the run got. */
|
|
364
|
+
progress: RelationshipInferenceProgress;
|
|
365
|
+
/** When the run started, in milliseconds since the epoch. */
|
|
366
|
+
startedAt: number;
|
|
367
|
+
/** When the run ended, in milliseconds since the epoch. */
|
|
368
|
+
endedAt?: number;
|
|
369
|
+
/** True when the time budget or a cancel ended the run before it judged every candidate. */
|
|
370
|
+
partial: boolean;
|
|
371
|
+
/** Why the run failed. */
|
|
372
|
+
error?: string;
|
|
373
|
+
/** Everything the run found, whether or not it went into the schema. Empty until the run ends. */
|
|
374
|
+
findings: Array<RelationshipInferenceFinding<ItemType>>;
|
|
375
|
+
/** Signatures of earlier inferred items this complete run did not find again, which it removed from the stored schema. */
|
|
376
|
+
removed?: Array<string>;
|
|
377
|
+
}
|
|
378
|
+
/**
|
|
379
|
+
* How far a relationship-inference run got.
|
|
380
|
+
* @category Platform
|
|
381
|
+
*/
|
|
382
|
+
export interface RelationshipInferenceProgress {
|
|
383
|
+
/** Collections to sample. */
|
|
384
|
+
collections: number;
|
|
385
|
+
/** Collections sampled so far. */
|
|
386
|
+
collectionsProfiled: number;
|
|
387
|
+
/** Key columns to check referencing columns against. */
|
|
388
|
+
keys: number;
|
|
389
|
+
/** Key columns checked so far. */
|
|
390
|
+
keysProbed: number;
|
|
391
|
+
/** Findings to check on all rows, with `verifyOnAllRows`. */
|
|
392
|
+
findingsToVerify: number;
|
|
393
|
+
/** Findings checked on all rows so far. */
|
|
394
|
+
findingsVerified: number;
|
|
395
|
+
/** Queries sent to the database so far. */
|
|
396
|
+
queries: number;
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* One thing a relationship-inference run found.
|
|
400
|
+
* @category Platform
|
|
401
|
+
*/
|
|
402
|
+
export interface RelationshipInferenceFinding<ItemType = Record<string, any>> {
|
|
403
|
+
/** Identifies the finding; without its kind prefix, it is the item's key in the schema. */
|
|
404
|
+
signature: string;
|
|
405
|
+
/** Which of `association`, `discriminator` and `dependency` holds the finding. */
|
|
406
|
+
kind: 'association' | 'discriminator' | 'dependency';
|
|
407
|
+
/** Whether the finding passed every check at the minimum confidence or above. */
|
|
408
|
+
eligible?: boolean;
|
|
409
|
+
/** Whether the finding went into the stored schema. */
|
|
410
|
+
applied: boolean;
|
|
411
|
+
/** Why the finding did not go into the stored schema. */
|
|
412
|
+
notAppliedReason?: string;
|
|
413
|
+
/** A relationship between two collections, as the schema's `associations` hold it. */
|
|
414
|
+
association?: ItemType;
|
|
415
|
+
/** A column whose value decides what the rest of its row means, as the schema's `discriminators` hold it. */
|
|
416
|
+
discriminator?: ItemType;
|
|
417
|
+
/** Two columns of a row that fix each other, as the schema's `columnDependencies` hold it. */
|
|
418
|
+
dependency?: ItemType;
|
|
295
419
|
}
|
|
296
420
|
/**
|
|
297
421
|
* Response from testing a data connection.
|