@cargo-ai/types 1.0.2 → 1.0.3

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 (95) hide show
  1. package/build/src/ai/ai.d.ts +462 -0
  2. package/build/src/ai/ai.d.ts.map +1 -0
  3. package/build/src/ai/ai.js +1 -0
  4. package/build/src/ai/index.d.ts +3 -0
  5. package/build/src/ai/index.d.ts.map +1 -0
  6. package/build/src/ai/index.js +2 -0
  7. package/build/src/ai/utils.d.ts +6 -0
  8. package/build/src/ai/utils.d.ts.map +1 -0
  9. package/build/src/ai/utils.js +82 -0
  10. package/build/src/billing/billing.d.ts +100 -0
  11. package/build/src/billing/billing.d.ts.map +1 -0
  12. package/build/src/billing/billing.js +1 -0
  13. package/build/src/billing/index.d.ts +2 -0
  14. package/build/src/billing/index.d.ts.map +1 -0
  15. package/build/src/billing/index.js +1 -0
  16. package/build/src/connection/connection.d.ts +650 -0
  17. package/build/src/connection/connection.d.ts.map +1 -0
  18. package/build/src/connection/connection.js +2 -0
  19. package/build/src/connection/index.d.ts +2 -0
  20. package/build/src/connection/index.d.ts.map +1 -0
  21. package/build/src/connection/index.js +1 -0
  22. package/build/src/expression/expression.d.ts +66 -0
  23. package/build/src/expression/expression.d.ts.map +1 -0
  24. package/build/src/expression/expression.js +2 -0
  25. package/build/src/expression/index.d.ts +3 -0
  26. package/build/src/expression/index.d.ts.map +1 -0
  27. package/build/src/expression/index.js +2 -0
  28. package/build/src/expression/utils.d.ts +4 -0
  29. package/build/src/expression/utils.d.ts.map +1 -0
  30. package/build/src/expression/utils.js +63 -0
  31. package/build/src/global/index.d.ts +2 -0
  32. package/build/src/global/index.d.ts.map +1 -0
  33. package/build/src/global/index.js +1 -0
  34. package/build/src/global/utils.d.ts +5 -0
  35. package/build/src/global/utils.d.ts.map +1 -0
  36. package/build/src/global/utils.js +32 -0
  37. package/build/src/index.d.ts +13 -0
  38. package/build/src/index.d.ts.map +1 -0
  39. package/build/src/index.js +12 -0
  40. package/build/src/orchestration/index.d.ts +3 -0
  41. package/build/src/orchestration/index.d.ts.map +1 -0
  42. package/build/src/orchestration/index.js +2 -0
  43. package/build/src/orchestration/orchestration.d.ts +534 -0
  44. package/build/src/orchestration/orchestration.d.ts.map +1 -0
  45. package/build/src/orchestration/orchestration.js +1 -0
  46. package/build/src/orchestration/utils.d.ts +7 -0
  47. package/build/src/orchestration/utils.d.ts.map +1 -0
  48. package/build/src/orchestration/utils.js +90 -0
  49. package/build/src/revenueOrganization/index.d.ts +2 -0
  50. package/build/src/revenueOrganization/index.d.ts.map +1 -0
  51. package/build/src/revenueOrganization/index.js +1 -0
  52. package/build/src/revenueOrganization/revenueOrganization.d.ts +114 -0
  53. package/build/src/revenueOrganization/revenueOrganization.d.ts.map +1 -0
  54. package/build/src/revenueOrganization/revenueOrganization.js +2 -0
  55. package/build/src/segmentation/index.d.ts +2 -0
  56. package/build/src/segmentation/index.d.ts.map +1 -0
  57. package/build/src/segmentation/index.js +1 -0
  58. package/build/src/segmentation/segmentation.d.ts +74 -0
  59. package/build/src/segmentation/segmentation.d.ts.map +1 -0
  60. package/build/src/segmentation/segmentation.js +1 -0
  61. package/build/src/storage/index.d.ts +2 -0
  62. package/build/src/storage/index.d.ts.map +1 -0
  63. package/build/src/storage/index.js +1 -0
  64. package/build/src/storage/storage.d.ts +144 -0
  65. package/build/src/storage/storage.d.ts.map +1 -0
  66. package/build/src/storage/storage.js +2 -0
  67. package/build/src/systemOfRecordIntegration/clients/bigQuery.d.ts +26 -0
  68. package/build/src/systemOfRecordIntegration/clients/bigQuery.d.ts.map +1 -0
  69. package/build/src/systemOfRecordIntegration/clients/bigQuery.js +1 -0
  70. package/build/src/systemOfRecordIntegration/clients/snowflake.d.ts +26 -0
  71. package/build/src/systemOfRecordIntegration/clients/snowflake.d.ts.map +1 -0
  72. package/build/src/systemOfRecordIntegration/clients/snowflake.js +1 -0
  73. package/build/src/systemOfRecordIntegration/index.d.ts +2 -0
  74. package/build/src/systemOfRecordIntegration/index.d.ts.map +1 -0
  75. package/build/src/systemOfRecordIntegration/index.js +1 -0
  76. package/build/src/systemOfRecordIntegration/systemOfRecordIntegration.d.ts +777 -0
  77. package/build/src/systemOfRecordIntegration/systemOfRecordIntegration.d.ts.map +1 -0
  78. package/build/src/systemOfRecordIntegration/systemOfRecordIntegration.js +2 -0
  79. package/build/src/userManagement/index.d.ts +2 -0
  80. package/build/src/userManagement/index.d.ts.map +1 -0
  81. package/build/src/userManagement/index.js +1 -0
  82. package/build/src/userManagement/userManagement.d.ts +21 -0
  83. package/build/src/userManagement/userManagement.d.ts.map +1 -0
  84. package/build/src/userManagement/userManagement.js +1 -0
  85. package/build/src/utils.d.ts +9 -0
  86. package/build/src/utils.d.ts.map +1 -0
  87. package/build/src/utils.js +1 -0
  88. package/build/src/workspaceManagement/index.d.ts +2 -0
  89. package/build/src/workspaceManagement/index.d.ts.map +1 -0
  90. package/build/src/workspaceManagement/index.js +1 -0
  91. package/build/src/workspaceManagement/workspaceManagement.d.ts +79 -0
  92. package/build/src/workspaceManagement/workspaceManagement.d.ts.map +1 -0
  93. package/build/src/workspaceManagement/workspaceManagement.js +1 -0
  94. package/build/tsconfig.tsbuildinfo +1 -0
  95. package/package.json +1 -1
@@ -0,0 +1,777 @@
1
+ import { type Schema as JsonSchema } from "jsonschema";
2
+ import { type BigQueryClientTypes } from "./clients/bigQuery.js";
3
+ import { type SnowflakeClientTypes } from "./clients/snowflake.js";
4
+ export declare namespace SystemOfRecordIntegrationTypes {
5
+ type BigQueryConfig = BigQueryClientTypes.BigQueryConfig;
6
+ type BigQueryScopeConfig = BigQueryClientTypes.BigQueryScopeConfig;
7
+ type SnowflakeConfig = SnowflakeClientTypes.SnowflakeConfig;
8
+ type SnowflakeScopeConfig = SnowflakeClientTypes.SnowflakeScopeConfig;
9
+ type SystemOfRecordKind = "bigQuery" | "snowflake";
10
+ type SystemOfRecordConfig = BigQueryConfig | SnowflakeConfig;
11
+ type MigrationStatus = "success" | "error" | "running";
12
+ type Migration = {
13
+ uuid: string;
14
+ workspaceUuid: string;
15
+ systemOfRecordUuid: string;
16
+ filename: string;
17
+ finishedAt: Date | null;
18
+ updatedAt: Date;
19
+ createdAt: Date;
20
+ status: MigrationStatus;
21
+ errorMessage: string | null;
22
+ };
23
+ type CutoverStatus = "running" | "success" | "error";
24
+ type Cutover = {
25
+ uuid: string;
26
+ workspaceUuid: string;
27
+ sourceSystemOfRecordUuid: string;
28
+ targetSystemOfRecordUuid: string;
29
+ status: CutoverStatus;
30
+ errorMessage: string | null;
31
+ tablesTotal: number;
32
+ tablesMigrated: number;
33
+ finishedAt: Date | null;
34
+ createdAt: Date;
35
+ updatedAt: Date;
36
+ };
37
+ type Usage = {
38
+ date: Date;
39
+ processedSecondsCount: number;
40
+ processedBytesCount: number;
41
+ queriesCount: number;
42
+ };
43
+ type SystemOfRecord = {
44
+ uuid: string;
45
+ workspaceUuid: string;
46
+ kind: SystemOfRecordKind;
47
+ config: SystemOfRecordConfig;
48
+ lastMigration: {
49
+ uuid: string;
50
+ finishedAt: Date | null;
51
+ createdAt: Date;
52
+ status: MigrationStatus;
53
+ errorMessage: string | null;
54
+ } | null;
55
+ cutover: {
56
+ uuid: string;
57
+ role: "source" | "target";
58
+ sourceSystemOfRecordUuid: string;
59
+ targetSystemOfRecordUuid: string;
60
+ status: CutoverStatus;
61
+ errorMessage: string | null;
62
+ tablesTotal: number;
63
+ tablesMigrated: number;
64
+ finishedAt: Date | null;
65
+ createdAt: Date;
66
+ } | null;
67
+ useCredits: boolean;
68
+ isActive: boolean;
69
+ createdAt: Date;
70
+ updatedAt: Date;
71
+ deletedAt: Date | null;
72
+ };
73
+ type LogStatus = "success" | "error";
74
+ type Log = {
75
+ uuid: string;
76
+ workspaceUuid: string;
77
+ systemOfRecordUuid: string;
78
+ query: string;
79
+ status: LogStatus;
80
+ processedBytesCount: number;
81
+ errorMessage: string | null;
82
+ startedAt: Date;
83
+ finishedAt: Date;
84
+ createdAt: Date;
85
+ };
86
+ type ObjectType = "account" | "contact" | "accountEvent" | "contactEvent";
87
+ type Column = {
88
+ slug: string;
89
+ type: ColumnType;
90
+ };
91
+ type ColumnWithFunction = Column & {
92
+ function?: Table;
93
+ args?: string | string[];
94
+ query?: string;
95
+ };
96
+ type DetailedColumn = Column & {
97
+ isNullable: boolean;
98
+ hasDefault: boolean;
99
+ isPrimaryKey: boolean;
100
+ isUniqueKey: boolean;
101
+ };
102
+ type ColumnMapping = {
103
+ slug: string;
104
+ alias: string;
105
+ };
106
+ type ColumnType = "string" | "number" | "object" | "array" | "date" | "boolean" | "vector" | "any";
107
+ type ColumnKind = "computed" | "custom" | "metric" | "lookup" | "original";
108
+ type Table = {
109
+ database: string;
110
+ schema: string;
111
+ name: string;
112
+ };
113
+ type Schema = {
114
+ database: string;
115
+ name: string;
116
+ };
117
+ type RecordsBatch = {
118
+ database: string;
119
+ schema: string;
120
+ table: string;
121
+ idColumnSlug: string;
122
+ action: "update" | "upsert" | "remove" | "insert";
123
+ override: boolean;
124
+ };
125
+ type PushFromSqsToStreamResult = {
126
+ outcome: "pushed";
127
+ } | {
128
+ outcome: "notPushed";
129
+ errorMessage: string;
130
+ };
131
+ type InsertFromStreamResult = {
132
+ outcome: "inserted";
133
+ insertedBatches: RecordsBatch[];
134
+ failedBatches: RecordsBatch[];
135
+ } | {
136
+ outcome: "notInserted";
137
+ errorMessage: string;
138
+ };
139
+ type InsertFromStreamCondition = {
140
+ kind: "table";
141
+ operator: "is" | "isNot";
142
+ table: Table;
143
+ } | {
144
+ kind: "schema";
145
+ operator: "is" | "isNot";
146
+ schema: Schema;
147
+ } | {
148
+ kind: "database";
149
+ operator: "is" | "isNot";
150
+ database: string;
151
+ };
152
+ type GetCountResult = {
153
+ outcome: "counted";
154
+ count: number;
155
+ } | {
156
+ outcome: "notCounted";
157
+ errorMessage: string;
158
+ };
159
+ type DownloadResult = {
160
+ outcome: "downloaded";
161
+ urls: string[];
162
+ uris: string[];
163
+ } | {
164
+ outcome: "notDownloaded";
165
+ errorMessage: string;
166
+ };
167
+ type DownloadOptions = {
168
+ expireAt?: Date;
169
+ format?: "csv" | "parquet";
170
+ };
171
+ type CreateTableFromUrisResult = {
172
+ outcome: "inserted";
173
+ rowsInserted: number;
174
+ } | {
175
+ outcome: "notInserted";
176
+ errorMessage: string;
177
+ };
178
+ type InsertFromUriOptions = {
179
+ format?: "csv" | "parquet";
180
+ };
181
+ type FetchOptions = {
182
+ limit?: number;
183
+ offset?: number;
184
+ sort?: {
185
+ columnSlug: string;
186
+ kind: "asc" | "desc";
187
+ }[];
188
+ };
189
+ type FetchResult = {
190
+ outcome: "fetched";
191
+ count: number;
192
+ records: Record<string, any>[];
193
+ } | {
194
+ outcome: "notFetched";
195
+ errorMessage: string;
196
+ };
197
+ type QueryResult = {
198
+ outcome: "queried";
199
+ rows: Record<string, any>[];
200
+ } | {
201
+ outcome: "notQueried";
202
+ errorMessage: string;
203
+ };
204
+ type QueryOptions = {
205
+ readOnly?: boolean;
206
+ };
207
+ type IsValidResult = {
208
+ outcome: "valid";
209
+ } | {
210
+ outcome: "notValid";
211
+ errorMessage: string;
212
+ };
213
+ type SetupResult = {
214
+ outcome: "setup";
215
+ config: SystemOfRecordConfig;
216
+ } | {
217
+ outcome: "notSetup";
218
+ errorMessage: string;
219
+ };
220
+ type CheckHasPermissionsResult = {
221
+ outcome: "valid";
222
+ } | {
223
+ outcome: "notValid";
224
+ errorMessage: string;
225
+ };
226
+ type TestConnectionResult = {
227
+ outcome: "connected";
228
+ } | {
229
+ outcome: "notConnected";
230
+ errorMessage: string;
231
+ };
232
+ type StreamHandle = (record: Record<string, any>) => Promise<void>;
233
+ type StreamOnStart = (payload: {
234
+ queryId: string;
235
+ }) => Promise<void>;
236
+ type StreamResult = {
237
+ outcome: "streamed";
238
+ } | {
239
+ outcome: "notStreamed";
240
+ errorMessage: string;
241
+ };
242
+ type GetColumnsResult = {
243
+ outcome: "retrieved";
244
+ columns: DetailedColumn[];
245
+ } | {
246
+ outcome: "notRetrieved";
247
+ errorMessage: string;
248
+ };
249
+ type CreateTableOptions = {
250
+ rule?: "createIfDoesntExist" | "replaceIfExists";
251
+ materialization?: "table" | "view";
252
+ isTemporary?: boolean;
253
+ expirationHours?: number;
254
+ };
255
+ type CreateTableResult = {
256
+ outcome: "created";
257
+ columns: DetailedColumn[];
258
+ } | {
259
+ outcome: "notCreated";
260
+ errorMessage: string;
261
+ };
262
+ type CreateTableDiffResult = {
263
+ outcome: "created";
264
+ addedRecordsCount: number;
265
+ updatedRecordsCount: number;
266
+ unchangedRecordsCount: number;
267
+ removedRecordsCount: number;
268
+ } | {
269
+ outcome: "notCreated";
270
+ errorMessage: string;
271
+ };
272
+ type DropTableOptions = {
273
+ rule?: "ifExists";
274
+ };
275
+ type GetTableDdlOptions = {
276
+ materialization?: "table" | "view";
277
+ };
278
+ type DropTableResult = {
279
+ outcome: "dropped";
280
+ } | {
281
+ outcome: "notDropped";
282
+ errorMessage: string;
283
+ };
284
+ type RenameTableResult = {
285
+ outcome: "renamed";
286
+ } | {
287
+ outcome: "notRenamed";
288
+ errorMessage: string;
289
+ };
290
+ type CreateTableDiffOptions = {
291
+ excludedColumnSlugs?: string[];
292
+ includedColumnSlugs?: string[];
293
+ };
294
+ type CreateSchemaResult = {
295
+ outcome: "created";
296
+ } | {
297
+ outcome: "notCreated";
298
+ errorMessage: string;
299
+ };
300
+ type DropSchemaResult = {
301
+ outcome: "dropped";
302
+ } | {
303
+ outcome: "notDropped";
304
+ errorMessage: string;
305
+ };
306
+ type ClientManifest = {
307
+ name: string;
308
+ slug: string;
309
+ icon: string;
310
+ description: string;
311
+ config: {
312
+ jsonSchema: JsonSchema;
313
+ uiSchema?: Record<string, any>;
314
+ };
315
+ };
316
+ type FilterConjonction = "or" | "and";
317
+ type FilterConditionKind = "sql" | "string" | "number" | "object" | "array" | "vector" | "any" | "date" | "boolean" | "occurrence" | "enrollment" | "segment" | "objectProperty";
318
+ type FilterConditionSql = {
319
+ kind: "sql";
320
+ name: string;
321
+ clause: string;
322
+ };
323
+ type FilterConditionString = {
324
+ kind: "string";
325
+ relatedModelUuid?: string;
326
+ columnSlug: string;
327
+ } & ({
328
+ operator: "is" | "isNot" | "contains" | "doesNotContain" | "startsWith" | "endsWith";
329
+ values: string[] | string;
330
+ } | {
331
+ operator: "isNull" | "isNotNull" | "isEmpty" | "isNotEmpty";
332
+ });
333
+ type FilterConditionNumber = {
334
+ kind: "number";
335
+ relatedModelUuid?: string;
336
+ columnSlug: string;
337
+ } & ({
338
+ operator: "is" | "isNot" | "greaterThan" | "lowerThan";
339
+ value: number;
340
+ } | {
341
+ operator: "between";
342
+ firstValue: number;
343
+ lastValue: number;
344
+ } | {
345
+ operator: "isNull" | "isNotNull";
346
+ });
347
+ type FilterConditionObjectPropertyOperator = "is" | "isNot" | "contains" | "greaterThan" | "lowerThan" | "doesNotContain" | "startsWith" | "endsWith" | "isNull" | "isNotNull" | "between";
348
+ type FilterConditionObjectProperty = {
349
+ kind: "objectProperty";
350
+ relatedModelUuid?: string;
351
+ columnSlug: string;
352
+ propertyName: string;
353
+ } & ({
354
+ operator: Exclude<FilterConditionObjectPropertyOperator, "isNull" | "isNotNull" | "between">;
355
+ value: string;
356
+ } | {
357
+ operator: "isNotNull" | "isNull" | "isEmpty" | "isNotEmpty";
358
+ } | {
359
+ operator: "between";
360
+ value: string;
361
+ otherValue: string;
362
+ });
363
+ type FilterConditionObject = {
364
+ kind: "object";
365
+ relatedModelUuid?: string;
366
+ columnSlug: string;
367
+ } & ({
368
+ operator: "isNull";
369
+ } | {
370
+ operator: "isNotNull";
371
+ } | {
372
+ operator: "matchConditions";
373
+ conjonction: FilterConjonction;
374
+ propertyConditions: FilterConditionObjectProperty[];
375
+ });
376
+ type FilterConditionArray = {
377
+ kind: "array";
378
+ relatedModelUuid?: string;
379
+ columnSlug: string;
380
+ } & ({
381
+ operator: "isNull";
382
+ } | {
383
+ operator: "isNotNull";
384
+ } | {
385
+ operator: "matchConditions";
386
+ conjonction: FilterConjonction;
387
+ propertyConditions: FilterConditionObjectProperty[];
388
+ });
389
+ type FilterConditionVector = {
390
+ kind: "vector";
391
+ relatedModelUuid?: string;
392
+ columnSlug: string;
393
+ operator: "isNull" | "isNotNull";
394
+ };
395
+ type FilterConditionAny = {
396
+ kind: "any";
397
+ relatedModelUuid?: string;
398
+ columnSlug: string;
399
+ operator: "isNull" | "isNotNull";
400
+ };
401
+ type FilterConditionDate = {
402
+ kind: "date";
403
+ relatedModelUuid?: string;
404
+ columnSlug: string;
405
+ } & ({
406
+ operator: "is" | "isNot" | "greaterThan" | "lowerThan";
407
+ value: string;
408
+ } | {
409
+ operator: "between";
410
+ firstValue: string;
411
+ lastValue: string;
412
+ } | {
413
+ operator: "isNull" | "isNotNull";
414
+ });
415
+ type FilterConditionBoolean = {
416
+ relatedModelUuid?: string;
417
+ kind: "boolean";
418
+ columnSlug: string;
419
+ operator: "isTrue" | "isFalse" | "isNull" | "isNotNull";
420
+ };
421
+ type FilterConditionSegment = {
422
+ kind: "segment";
423
+ segmentUuid: string;
424
+ operator: "in" | "notIn";
425
+ };
426
+ type FilterConditionOccurrenceFrequency = {
427
+ operator: "not";
428
+ } | {
429
+ operator: "moreThan" | "lessThan" | "exactly";
430
+ value: number;
431
+ };
432
+ type FilterConditionOccurrencePeriod = {
433
+ operator: "lessThan" | "moreThan" | "exactly";
434
+ value: number;
435
+ unit: "day";
436
+ };
437
+ type FilterConditionOccurrence = {
438
+ kind: "occurrence";
439
+ relatedModelUuid: string;
440
+ frequency: FilterConditionOccurrenceFrequency;
441
+ period: FilterConditionOccurrencePeriod;
442
+ conjonction: FilterConjonction;
443
+ conditions: (FilterConditionString | FilterConditionNumber | FilterConditionObject | FilterConditionArray | FilterConditionAny | FilterConditionVector | FilterConditionDate | FilterConditionBoolean)[];
444
+ };
445
+ type FilterConditionEnrollmentActivityKind = "workflowEntered" | "workflowNodeExecuted" | "workflowLeft";
446
+ type FilterConditionEnrollmentFrequency = {
447
+ operator: "not";
448
+ } | {
449
+ operator: "moreThan" | "lessThan" | "exactly";
450
+ value: number;
451
+ };
452
+ type FilterConditionEnrollmentPeriod = {
453
+ operator: "lessThan" | "moreThan" | "exactly";
454
+ value: number;
455
+ unit: "day";
456
+ };
457
+ type FilterConditionEnrollment = {
458
+ kind: "enrollment";
459
+ workflowUuid: string;
460
+ activityKind: FilterConditionEnrollmentActivityKind;
461
+ nodeSlug?: string;
462
+ frequency: FilterConditionEnrollmentFrequency;
463
+ period: FilterConditionEnrollmentPeriod;
464
+ };
465
+ type FilterCondition = FilterConditionSql | FilterConditionString | FilterConditionNumber | FilterConditionObject | FilterConditionArray | FilterConditionAny | FilterConditionVector | FilterConditionDate | FilterConditionBoolean | FilterConditionOccurrence | FilterConditionEnrollment | FilterConditionSegment | FilterConditionObjectProperty;
466
+ type FilterGroup = {
467
+ conjonction: FilterConjonction;
468
+ conditions: FilterCondition[];
469
+ };
470
+ type Filter = {
471
+ conjonction: FilterConjonction;
472
+ groups: FilterGroup[];
473
+ };
474
+ type Sort = {
475
+ columnSlug: string;
476
+ kind: "asc" | "desc";
477
+ }[];
478
+ type AggregationFunction = "AVG" | "COUNT" | "MAX" | "MIN" | "SUM" | "ANY_VALUE";
479
+ type ModelRelationship = {
480
+ rightModelUuid: string;
481
+ leftColumn: string;
482
+ rightColumn: string;
483
+ };
484
+ type ModelColumn = Column & {
485
+ originalSlug: string;
486
+ };
487
+ type Model = {
488
+ uuid: string;
489
+ slug: string;
490
+ datasetUuid: string;
491
+ datasetSlug: string;
492
+ idColumnSlug: string;
493
+ titleColumnSlug: string;
494
+ timeColumnSlug?: string;
495
+ columns: ModelColumn[];
496
+ customColumns: Column[];
497
+ hasOneRelationships: ModelRelationship[];
498
+ };
499
+ type Segment = {
500
+ name: string;
501
+ uuid: string;
502
+ slug: string;
503
+ };
504
+ type DetailedRecordMeta = {
505
+ storage?: {
506
+ runUuid: string;
507
+ };
508
+ };
509
+ type DetailedRecord = {
510
+ database: string;
511
+ schema: string;
512
+ table: string;
513
+ columns: Column[];
514
+ idColumnSlug: string;
515
+ override: boolean;
516
+ data: Record<string, any>;
517
+ action: "update" | "upsert" | "remove" | "insert";
518
+ mode: "sync" | "async";
519
+ meta?: DetailedRecordMeta;
520
+ emittedAt: Date;
521
+ };
522
+ type SimpleRecord = {
523
+ database: string;
524
+ schema: string;
525
+ table: string;
526
+ data: Record<string, any>;
527
+ } & ({
528
+ action: "update" | "upsert" | "remove";
529
+ idColumnSlug: string;
530
+ } | {
531
+ action: "insert";
532
+ });
533
+ type FilterModel = {
534
+ uuid: string;
535
+ slug: string;
536
+ datasetSlug: string;
537
+ };
538
+ type FilterRelationship = {
539
+ rightModelUuid: string;
540
+ rightDatasetSlug: string;
541
+ rightModelSlug: string;
542
+ rightColumnSlug: string;
543
+ leftColumnSlug: string;
544
+ timeColumnSlug?: string;
545
+ };
546
+ type WhereConditionKind = ColumnType | "reference" | "query";
547
+ type WhereCondition = {
548
+ kind: "number" | "date";
549
+ columnSlug: string;
550
+ operator: "lowerThan" | "lowerThanOrEquals" | "greaterThan" | "greaterThanOrEquals" | "is" | "isNot";
551
+ value: any;
552
+ } | {
553
+ kind: "number" | "date";
554
+ columnSlug: string;
555
+ operator: "between";
556
+ value: any;
557
+ otherValue: any;
558
+ } | {
559
+ kind: "string";
560
+ columnSlug: string;
561
+ operator: "is" | "isNot" | "contains" | "notContains";
562
+ values: any | any[];
563
+ } | {
564
+ kind: "boolean";
565
+ columnSlug: string;
566
+ operator: "is" | "isNot";
567
+ value: any;
568
+ } | {
569
+ kind: "reference";
570
+ columnSlug: string;
571
+ operator: "is" | "isNot";
572
+ value: string;
573
+ outerTableAlias?: string;
574
+ } | {
575
+ kind: "query";
576
+ operator: "is" | "isNot";
577
+ value: string;
578
+ } | {
579
+ kind: Exclude<WhereConditionKind, "query">;
580
+ columnSlug: string;
581
+ operator: "isNotNull" | "isNull";
582
+ };
583
+ type WhereConjunction = "or" | "and";
584
+ type Where = {
585
+ conjunction: WhereConjunction;
586
+ groups: {
587
+ conjunction: WhereConjunction;
588
+ conditions: WhereCondition[];
589
+ }[];
590
+ };
591
+ type GetTableSelectColumn = {
592
+ kind: "column";
593
+ slug: string;
594
+ alias?: string;
595
+ } | {
596
+ kind: "aggregation";
597
+ function: AggregationFunction;
598
+ columnSlug: string;
599
+ alias?: string;
600
+ };
601
+ type GetTableQueryPayload = {
602
+ table: Table;
603
+ where?: Where;
604
+ select?: GetTableSelectColumn[];
605
+ groupBy?: string[];
606
+ sort?: Sort;
607
+ limit?: number;
608
+ };
609
+ type GetModelQueryPayload = {
610
+ models: Model[];
611
+ rootModelUuid: string;
612
+ };
613
+ type GetEnrichedModelQueryPayload = {
614
+ query: string;
615
+ segments: Segment[];
616
+ };
617
+ type GetActivitiesFromChangeQueryPayload = {
618
+ segmentSlug: string;
619
+ changeSlug: string;
620
+ modelUuid: string;
621
+ segmentUuid: string;
622
+ changeUuid: string;
623
+ };
624
+ type GetModelWhereQueryPayload = {
625
+ relationships: FilterRelationship[];
626
+ model: FilterModel;
627
+ segments: Segment[];
628
+ filter: Filter;
629
+ };
630
+ type GetDailyAllocationsQueryPayload = {
631
+ subQuery: string;
632
+ connectorSlugsToColumnSlugMapping: Record<string, string>;
633
+ idColumnSlug: string;
634
+ timeColumnSlug: string;
635
+ };
636
+ type MergeUnificationMappingsQueryReshaper = "urlExtractDomain" | "urlExtractLinkedinIdOrHandle" | "urlExtractCrunchbaseId" | "urlExtractTwitterHandle" | "urlExtractSalesNavigatorId";
637
+ type MergeUnificationMappingsQueryPayload = {
638
+ unificationType: "account" | "contact" | "accountEvent" | "contactEvent";
639
+ datasetSlug: string;
640
+ modelSlug: string;
641
+ idColumnSlug: string;
642
+ uniqueColumns: {
643
+ slug: string;
644
+ reference: string;
645
+ reshaper?: MergeUnificationMappingsQueryReshaper;
646
+ }[];
647
+ };
648
+ type FunctionLanguage = "js" | "sql";
649
+ type ClientQueries = {
650
+ getModel: (payload: GetModelQueryPayload) => string;
651
+ getEnrichedModel: (payload: GetEnrichedModelQueryPayload) => string;
652
+ getModelWhere: (payload: GetModelWhereQueryPayload) => string | undefined;
653
+ getTable: (payload: GetTableQueryPayload) => string;
654
+ getActivitiesFromChange: (payload: GetActivitiesFromChangeQueryPayload) => string;
655
+ getDailyAllocations: (payload: GetDailyAllocationsQueryPayload) => string;
656
+ mergeUnificationMappings: (payload: MergeUnificationMappingsQueryPayload) => string | undefined;
657
+ migration: {
658
+ getTablesToMigrate: () => string;
659
+ };
660
+ };
661
+ type ClientReferences = {
662
+ database: string;
663
+ schema: Schema | undefined;
664
+ parseSchema: (schema: Schema) => string;
665
+ parseTable: (table: Table) => string;
666
+ getSchema: (schema: string) => Schema | undefined;
667
+ getTable: (schema: string, name: string) => Table;
668
+ isValidTable: (table: Table) => boolean;
669
+ computation: {
670
+ getSchema: () => Schema | undefined;
671
+ getTable: (name: string) => Table;
672
+ streams: {
673
+ getTable: () => Table;
674
+ };
675
+ activities: {
676
+ getTable: () => Table;
677
+ getColumns: () => Column[];
678
+ };
679
+ unificationMappings: {
680
+ getTable: () => Table;
681
+ getColumns: () => Column[];
682
+ };
683
+ };
684
+ storage: {
685
+ dataset: (slug: string) => {
686
+ getSchema: () => Schema | undefined;
687
+ };
688
+ model: (datasetSlug: string, slug: string) => {
689
+ getSourceTable: () => Table;
690
+ getCustomTable: () => Table;
691
+ getActivitiesTable: () => Table;
692
+ getStagingTable: () => Table;
693
+ getTable: () => Table;
694
+ getComputedColumnFunction: (columnSlug: string) => Table;
695
+ };
696
+ column: {
697
+ isValid: (columnSlug: string) => boolean;
698
+ match: (columnSlug: string, columns: Column[]) => Column | undefined;
699
+ getDiff: (currentColumns: Column[], newColumns: Column[]) => Column[];
700
+ getSlug: (slug: string, kind: ColumnKind, prefix?: string) => string;
701
+ };
702
+ };
703
+ segmentation: {
704
+ segment: (slug: string) => {
705
+ getSchema: () => Schema | undefined;
706
+ getTable: () => Table;
707
+ getReferenceTable: () => Table;
708
+ };
709
+ change: (segmentSlug: string, slug: string) => {
710
+ getTable: () => Table;
711
+ };
712
+ };
713
+ };
714
+ type AddColumnsOptions = {
715
+ outerTableAlias?: string;
716
+ };
717
+ type AddColumnsResult = {
718
+ outcome: "added";
719
+ } | {
720
+ outcome: "notAdded";
721
+ errorMessage: string;
722
+ };
723
+ type AlterColumnsOptions = {
724
+ outerTableAlias?: string;
725
+ };
726
+ type AlterColumnsResult = {
727
+ outcome: "altered";
728
+ } | {
729
+ outcome: "notAltered";
730
+ errorMessage: string;
731
+ };
732
+ interface Client {
733
+ kind: string;
734
+ references: ClientReferences;
735
+ queries: ClientQueries;
736
+ testConnection(): Promise<TestConnectionResult>;
737
+ isEmpty(): Promise<boolean>;
738
+ setup(): Promise<SetupResult>;
739
+ checkHasPermissions(): Promise<CheckHasPermissionsResult>;
740
+ upsertFunction(table: Table, code: string, language: FunctionLanguage, outputType: SystemOfRecordIntegrationTypes.ColumnType): Promise<void>;
741
+ removeFunction(table: Table, language: FunctionLanguage): Promise<void>;
742
+ getObjectColumnProperties(table: Table, columnSlug: string): Promise<string[]>;
743
+ getArrayColumnObjectProperties(table: Table, columnSlug: string): Promise<string[]>;
744
+ query(query: string, options?: QueryOptions): Promise<QueryResult>;
745
+ isValid(query: string): Promise<IsValidResult>;
746
+ bulkInsert(records: DetailedRecord[]): Promise<void>;
747
+ insertOne(record: SimpleRecord): Promise<void>;
748
+ pushFromSqsToStream: (s3Key: string) => Promise<PushFromSqsToStreamResult>;
749
+ insertFromStream(conditions?: InsertFromStreamCondition[]): Promise<InsertFromStreamResult>;
750
+ getCount(query: string): Promise<GetCountResult>;
751
+ download(query: string, options?: DownloadOptions): Promise<DownloadResult>;
752
+ fetch(query: string, options?: FetchOptions): Promise<FetchResult>;
753
+ stream(payload: {
754
+ query?: string;
755
+ queryId?: string;
756
+ handle: StreamHandle;
757
+ onStart?: StreamOnStart;
758
+ }): Promise<StreamResult>;
759
+ getColumns(table: Table, reset?: boolean): Promise<GetColumnsResult>;
760
+ addColumns(table: Table, columns: ColumnWithFunction[], options?: AddColumnsOptions): Promise<AddColumnsResult>;
761
+ alterColumns(table: Table, columns: ColumnWithFunction[], options?: AlterColumnsOptions): Promise<AlterColumnsResult>;
762
+ dropColumns(table: Table, columnSlugs: string[]): Promise<void>;
763
+ getTableDdl: (table: Table, options?: GetTableDdlOptions) => Promise<string | undefined>;
764
+ createTable(table: Table, query: string, options?: CreateTableOptions): Promise<CreateTableResult>;
765
+ createTableWithColumns(table: Table, columns: Column[], options?: CreateTableOptions): Promise<CreateTableResult>;
766
+ createTableFromUris(table: Table, uris: string[], options?: InsertFromUriOptions): Promise<CreateTableFromUrisResult>;
767
+ dropTable(table: Table, options?: DropTableOptions): Promise<DropTableResult>;
768
+ renameTable(table: Table, newName: string): Promise<RenameTableResult>;
769
+ createTableDiff(defaultTable: Table, referenceTable: Table, diffTable: Table, idColumnSlug: string, options?: CreateTableDiffOptions): Promise<CreateTableDiffResult>;
770
+ checkTableExists(table: Table): Promise<boolean>;
771
+ insert(table: Table, columnSlugs: string[], query: string): Promise<void>;
772
+ createSchema(schema: Schema, replaceIfExists?: boolean): Promise<CreateSchemaResult>;
773
+ dropSchema(schema: Schema): Promise<DropSchemaResult>;
774
+ getColumnValues(table: Table, column: Column): Promise<string[]>;
775
+ }
776
+ }
777
+ //# sourceMappingURL=systemOfRecordIntegration.d.ts.map