@narrative.io/data-collaboration-sdk-ts 3.8.0 → 4.0.0-beta.1

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 (79) hide show
  1. package/build/access-rules/index.d.ts +3 -3
  2. package/build/access-rules/index.js +1 -1
  3. package/build/access-rules/types.d.ts +17 -3
  4. package/build/access-tokens/index.d.ts +4 -4
  5. package/build/access-tokens/index.js +3 -2
  6. package/build/access-tokens/types.d.ts +5 -3
  7. package/build/agents/types.d.ts +22 -6
  8. package/build/apps/index.d.ts +19 -6
  9. package/build/apps/index.js +26 -10
  10. package/build/apps/types.d.ts +1 -1
  11. package/build/attributes/index.d.ts +15 -12
  12. package/build/attributes/index.js +16 -7
  13. package/build/attributes/types.d.ts +18 -2
  14. package/build/authentication/types.d.ts +3 -3
  15. package/build/companies/index.d.ts +7 -4
  16. package/build/companies/index.js +10 -5
  17. package/build/company-info/types.d.ts +10 -0
  18. package/build/compute-pools/types.d.ts +16 -1
  19. package/build/connections/index.d.ts +29 -25
  20. package/build/connections/index.js +48 -29
  21. package/build/connections/types.d.ts +69 -16
  22. package/build/contracts/index.d.ts +10 -19
  23. package/build/contracts/index.js +8 -22
  24. package/build/contracts/types.d.ts +6 -2
  25. package/build/data-planes/index.d.ts +5 -1
  26. package/build/data-planes/index.js +7 -1
  27. package/build/data-planes/types.d.ts +95 -15
  28. package/build/data-streams/types.d.ts +13 -11
  29. package/build/datasets/index.d.ts +15 -4
  30. package/build/datasets/index.js +5 -3
  31. package/build/datasets/types.d.ts +17 -11
  32. package/build/encryption-materials/index.d.ts +5 -3
  33. package/build/encryption-materials/index.js +3 -1
  34. package/build/encryption-materials/types.d.ts +17 -5
  35. package/build/forecast/types.d.ts +42 -18
  36. package/build/health/index.d.ts +5 -0
  37. package/build/health/index.js +5 -0
  38. package/build/health/types.d.ts +8 -2
  39. package/build/installations/index.d.ts +6 -0
  40. package/build/installations/index.js +2 -1
  41. package/build/installations/types.d.ts +7 -1
  42. package/build/jobs/index.d.ts +7 -3
  43. package/build/jobs/index.js +5 -3
  44. package/build/jobs/types.d.ts +14 -14
  45. package/build/mappings/index.d.ts +15 -5
  46. package/build/mappings/index.js +9 -4
  47. package/build/mappings/types.d.ts +5 -3
  48. package/build/model-inference/index.d.ts +2 -2
  49. package/build/model-inference/types.d.ts +23 -4
  50. package/build/model-training/types.d.ts +16 -1
  51. package/build/models/index.d.ts +13 -12
  52. package/build/models/index.js +29 -8
  53. package/build/models/types.d.ts +96 -10
  54. package/build/nql/types.d.ts +17 -7
  55. package/build/nql/types.js +5 -1
  56. package/build/ping/index.d.ts +5 -1
  57. package/build/ping/index.js +5 -1
  58. package/build/products/index.d.ts +4 -3
  59. package/build/products/index.js +2 -2
  60. package/build/products/types.d.ts +26 -23
  61. package/build/queries/index.d.ts +7 -6
  62. package/build/queries/index.js +34 -4
  63. package/build/queries/types.d.ts +15 -0
  64. package/build/resources/index.d.ts +2 -2
  65. package/build/resources/index.js +1 -1
  66. package/build/resources/types.d.ts +16 -8
  67. package/build/rosetta-stone/index.d.ts +8 -8
  68. package/build/rosetta-stone/index.js +16 -32
  69. package/build/subscriptions/types.d.ts +3 -3
  70. package/build/uploads/index.d.ts +4 -1
  71. package/build/uploads/index.js +5 -2
  72. package/build/views/index.d.ts +11 -10
  73. package/build/views/index.js +40 -7
  74. package/build/views/types.d.ts +25 -4
  75. package/build/whoami/types.d.ts +38 -9
  76. package/build/workflows/index.d.ts +6 -7
  77. package/build/workflows/index.js +9 -4
  78. package/build/workflows/types.d.ts +23 -4
  79. package/package.json +3 -3
@@ -20,7 +20,7 @@ export interface DataStream {
20
20
  export interface DataStreamContent {
21
21
  description: string;
22
22
  icon?: string;
23
- sections?: string[];
23
+ sections?: Record<string, unknown>[];
24
24
  }
25
25
  export type SalesChannel = "data_streams_market" | "data_shop";
26
26
  export interface Offer {
@@ -33,7 +33,7 @@ export interface Offer {
33
33
  export interface OfferLicensing {
34
34
  period: string;
35
35
  license: {
36
- id: string;
36
+ name: string;
37
37
  };
38
38
  }
39
39
  export interface OfferPricing {
@@ -41,10 +41,12 @@ export interface OfferPricing {
41
41
  type: "per_record" | "max_price_per_record";
42
42
  }
43
43
  export interface AuthRules {
44
- company_contstraint: CompanyConstraint;
44
+ company_constraint?: CompanyConstraint;
45
45
  }
46
+ export type CompanyConstraintType = "inclusion" | "exclusion";
46
47
  export interface CompanyConstraint {
47
- type: InclusionType;
48
+ type: CompanyConstraintType;
49
+ company_ids: number[];
48
50
  }
49
51
  export interface DataRules {
50
52
  column_sets?: ColumnSet[];
@@ -55,7 +57,7 @@ export interface DataRules {
55
57
  ingestion_timestamp_filter?: TimestampFilter;
56
58
  }
57
59
  export interface ColumnSet {
58
- dataset_id: string;
60
+ dataset_id: number;
59
61
  fields: ColumnWithFilterAndExport[];
60
62
  }
61
63
  export interface AttributeSet {
@@ -71,19 +73,19 @@ export interface Deduplication {
71
73
  export interface FrequencyFilter {
72
74
  column_references?: ColumnReferences[];
73
75
  attribute_references?: AttributeReferences[];
74
- minInclusive?: number;
75
- maxInclusive?: number;
76
+ min_inclusive?: number;
77
+ max_inclusive?: number;
76
78
  }
77
79
  export interface AttributeReferences {
78
80
  attribute_id: number;
79
- columnNames: string[];
81
+ column_names: string[];
80
82
  }
81
83
  export interface ColumnReferences {
82
84
  dataset_id: number;
83
- columnNames: string[];
85
+ column_names: string[];
84
86
  }
85
87
  export interface DatasetFilter {
86
- dataset_id: string;
88
+ dataset_id: number;
87
89
  attribute: AttributeField;
88
90
  }
89
91
  export interface DatasetFilterEquality extends DatasetFilter {
@@ -91,7 +93,7 @@ export interface DatasetFilterEquality extends DatasetFilter {
91
93
  inclusion: InclusionType;
92
94
  }
93
95
  export interface AttributeField {
94
- attribute_id: string;
96
+ attribute_id: number;
95
97
  field: string;
96
98
  }
97
99
  export interface DatasetFilterSpatial extends DatasetFilter {
@@ -3,8 +3,18 @@ import type { UnknownJob } from "../jobs/types";
3
3
  import type { ApiRecords } from "../types";
4
4
  import type { DatasetStatisticsConfiguration, StatisticsConfigurationResponse } from "./statistics-types";
5
5
  import type { AdvancedStatistics, AdvancedStatisticsMetadata, BasicStatistics, ColumnStatistics, ColumnSummary, Columns, Configuration, CreateDatasetRefreshScheduleRequest, CreateDatasetRequest, Dataset, DatasetInterfaceError, DatasetInterfaceRef, DatasetInterfaceValidation, DatasetStatus, DatasetTableSummary, DatasetTableSummaryAPIResponse, DatasetWriteMode, FilePerSnapshotResponse, Histogram, IngestDatasetFileRequest, JsonSchemaValidationNode, RecalculationInfo, RetentionPolicy, RetentionScheduleConfig, RowClock, RowTTLPolicy, Schema, SchemaArrayItems, SchemaArrayItemsArray, SchemaArrayItemsObject, SchemaArrayItemsPrimitive, SchemaArrayProperty, SchemaFileConfig, SchemaFileConfigType, SchemaObjectProperty, SchemaPrimitiveProperty, SchemaProperties, SchemaPropertiesType, SchemaProperty, SnapshotAgeExpression, SnapshotRange, SnapshotTTLPolicy, TableClock, TableClockKind, TableTTLPolicy, TTLPolicy, TTLPolicyKind, UpdateDatasetRefreshScheduleRequest, UpdateDatasetRequest, UpsertRetentionPoliciesRequest, Value } from "./types";
6
+ interface GetDatasetsParameters extends Record<string, string | number | boolean | string[] | undefined> {
7
+ /** Page number, starting from 1. */
8
+ page?: number;
9
+ per_page?: number;
10
+ /** Free-text keyword query matched against dataset name. */
11
+ q?: string;
12
+ data_plane_id?: string;
13
+ /** Filter to datasets carrying this tag. Repeat to require every supplied tag (all-of semantics). */
14
+ tag?: string | string[];
15
+ }
6
16
  export type { CronRefresh, DatasetFieldConfig, DatasetFieldNamespace, DatasetStatisticsConfiguration, HistogramOptions, HistogramOverflow, ManualRefresh, NestedNodeConfig, NestedPropertyConfig, NonPrimitiveNodeConfig, OnUpdateRefresh, PrimitiveNodeConfig, RefreshTrigger, RosettaStoneFieldConfig, RosettaStoneFieldNamespace, StatConfig, StatisticsConfigurationResponse, StatName, StatOptions, } from "./statistics-types";
7
- export type { AdvancedStatistics, AdvancedStatisticsMetadata, BasicStatistics, ColumnStatistics, ColumnSummary, Columns, Configuration, CreateDatasetRefreshScheduleRequest, CreateDatasetRequest, Dataset, DatasetInterfaceError, DatasetInterfaceRef, DatasetInterfaceValidation, DatasetStatus, DatasetTableSummaryAPIResponse, DatasetWriteMode, FilePerSnapshotResponse, Histogram, JsonSchemaValidationNode, RetentionPolicy, RetentionScheduleConfig, RowClock, RowTTLPolicy, Schema, SchemaArrayItems, SchemaArrayItemsArray, SchemaArrayItemsObject, SchemaArrayItemsPrimitive, SchemaArrayProperty, SchemaFileConfig, SchemaFileConfigType, SchemaObjectProperty, SchemaPrimitiveProperty, SchemaProperties, SchemaPropertiesType, SchemaProperty, SnapshotAgeExpression, SnapshotRange, SnapshotTTLPolicy, TableClock, TableClockKind, TableTTLPolicy, TTLPolicy, TTLPolicyKind, UpdateDatasetRefreshScheduleRequest, UpdateDatasetRequest, UpsertRetentionPoliciesRequest, Value, };
17
+ export type { AdvancedStatistics, AdvancedStatisticsMetadata, BasicStatistics, ColumnStatistics, ColumnSummary, Columns, Configuration, CreateDatasetRefreshScheduleRequest, CreateDatasetRequest, Dataset, DatasetInterfaceError, DatasetInterfaceRef, DatasetInterfaceValidation, DatasetStatus, DatasetTableSummaryAPIResponse, DatasetWriteMode, FilePerSnapshotResponse, GetDatasetsParameters, Histogram, JsonSchemaValidationNode, RetentionPolicy, RetentionScheduleConfig, RowClock, RowTTLPolicy, Schema, SchemaArrayItems, SchemaArrayItemsArray, SchemaArrayItemsObject, SchemaArrayItemsPrimitive, SchemaArrayProperty, SchemaFileConfig, SchemaFileConfigType, SchemaObjectProperty, SchemaPrimitiveProperty, SchemaProperties, SchemaPropertiesType, SchemaProperty, SnapshotAgeExpression, SnapshotRange, SnapshotTTLPolicy, TableClock, TableClockKind, TableTTLPolicy, TTLPolicy, TTLPolicyKind, UpdateDatasetRefreshScheduleRequest, UpdateDatasetRequest, UpsertRetentionPoliciesRequest, Value, };
8
18
  /**
9
19
  * @module DatasetApi
10
20
  * @description This module provides methods for fetching datasets.
@@ -19,9 +29,10 @@ export declare class DatasetApi extends BaseApi {
19
29
  getDataset(datasetId: number): Promise<Dataset>;
20
30
  /**
21
31
  * Get a list of all datasets
32
+ * @param {GetDatasetsParameters} [parameters] - Optional filtering/pagination parameters.
22
33
  * @returns {Promise<ApiRecords<Dataset>>} - Promise resolving to an array of datasets
23
34
  */
24
- getDatasets(): Promise<ApiRecords<Dataset>>;
35
+ getDatasets(parameters?: GetDatasetsParameters): Promise<ApiRecords<Dataset>>;
25
36
  /**
26
37
  * Deletes a specific dataset from the system.
27
38
  * This method sends a DELETE request to the specified endpoint to remove the dataset.
@@ -74,7 +85,7 @@ export declare class DatasetApi extends BaseApi {
74
85
  * Activates a dataset with the specified dataset ID.
75
86
  *
76
87
  * @param {number} datasetId - The ID of the dataset to activate.
77
- * @returns {Promise<Dataset>} A promise that resolves with the activated dataset.
88
+ * @returns {Promise<void>} A promise that resolves when the dataset has been activated.
78
89
  */
79
90
  activateDataset(datasetId: number): Promise<void>;
80
91
  /**
@@ -134,7 +145,7 @@ export declare class DatasetApi extends BaseApi {
134
145
  * @memberof DatasetApi
135
146
  * @public
136
147
  */
137
- getDatasetFileDownloadUrl(datasetId: number, snapshotId: number, fileId: string): Promise<{
148
+ getDatasetFileDownloadUrl(datasetId: number, snapshotId: string, fileId: string): Promise<{
138
149
  download_url: string;
139
150
  }>;
140
151
  /**
@@ -16,10 +16,12 @@ export class DatasetApi extends BaseApi {
16
16
  }
17
17
  /**
18
18
  * Get a list of all datasets
19
+ * @param {GetDatasetsParameters} [parameters] - Optional filtering/pagination parameters.
19
20
  * @returns {Promise<ApiRecords<Dataset>>} - Promise resolving to an array of datasets
20
21
  */
21
- async getDatasets() {
22
- return await this.get(`${resourceName}`);
22
+ async getDatasets(parameters) {
23
+ const queryString = this.constructQueryString(parameters);
24
+ return await this.get(`${resourceName}${queryString}`);
23
25
  }
24
26
  /**
25
27
  * Deletes a specific dataset from the system.
@@ -102,7 +104,7 @@ export class DatasetApi extends BaseApi {
102
104
  * Activates a dataset with the specified dataset ID.
103
105
  *
104
106
  * @param {number} datasetId - The ID of the dataset to activate.
105
- * @returns {Promise<Dataset>} A promise that resolves with the activated dataset.
107
+ * @returns {Promise<void>} A promise that resolves when the dataset has been activated.
106
108
  */
107
109
  async activateDataset(datasetId) {
108
110
  await this.put(`${resourceName}/${datasetId}/activate`, null);
@@ -4,23 +4,23 @@ export interface Dataset {
4
4
  id: number;
5
5
  company_id: number;
6
6
  created_at: string;
7
- description: string;
7
+ description?: string;
8
8
  name: string;
9
9
  display_name: string;
10
10
  retention_policy: RetentionPolicy;
11
11
  schema: Schema;
12
12
  status: DatasetStatus;
13
- tags?: string[];
13
+ tags: string[];
14
14
  updated_at: string;
15
15
  write_mode: DatasetWriteMode;
16
16
  last_snapshot_created_at?: string;
17
17
  active_dataset_stored_bytes?: number;
18
- mappings?: Mapping[];
18
+ mappings: Mapping[];
19
19
  subscription_id?: string;
20
20
  stats?: DatasetStats;
21
21
  is_narrative_managed: boolean;
22
22
  external_id?: string;
23
- data_plane?: DataPlane;
23
+ data_plane: DataPlane;
24
24
  materialized_view_config?: {
25
25
  nql: string;
26
26
  refresh_schedule_config?: {
@@ -55,10 +55,10 @@ export interface DatasetSummaryStatistics {
55
55
  est_total_dataset_stored_records: number;
56
56
  }
57
57
  export interface RecalculationInfo {
58
- recalculation_id: string;
58
+ recalculation_id?: string;
59
59
  snapshots: string[];
60
- from_snapshot_timestamp: string;
61
- until_snapshot_timestamp: string;
60
+ from_snapshot_timestamp?: string;
61
+ until_snapshot_timestamp?: string;
62
62
  }
63
63
  export interface DatasetColumnSummary {
64
64
  id: number;
@@ -82,7 +82,6 @@ export interface DatasetTableSummary extends DatasetSummaryStatistics {
82
82
  snapshot_added_delete_files: number;
83
83
  snapshot_removed_delete_files: number;
84
84
  snapshot_removed_bytes: number;
85
- column_summary: DatasetColumnSummary[];
86
85
  }
87
86
  export interface DatasetTableSummaryAPIResponse {
88
87
  dataset_id: number;
@@ -220,13 +219,14 @@ interface File {
220
219
  }
221
220
  interface Snapshot {
222
221
  files: File[];
223
- snapshot_id: number;
222
+ snapshot_id: string;
224
223
  timestamp: string;
224
+ is_downloadable: boolean;
225
225
  }
226
226
  export interface FilePerSnapshotResponse {
227
227
  files_per_snapshot: Snapshot[];
228
228
  has_next: boolean;
229
- next_snapshot: number | null;
229
+ next_snapshot: string | null;
230
230
  }
231
231
  export interface ColumnStatistics {
232
232
  advanced_statistics_metadata: AdvancedStatisticsMetadata | null;
@@ -296,7 +296,9 @@ export interface UpdateDatasetRequest {
296
296
  export interface CreateDatasetRequest {
297
297
  name: string;
298
298
  schema: Schema;
299
- write_mode: DatasetWriteMode;
299
+ /** Defaults to `"append"` server-side when omitted. */
300
+ write_mode?: DatasetWriteMode;
301
+ display_name?: string;
300
302
  description?: string;
301
303
  tags?: string[];
302
304
  derive_metrics_config?: boolean;
@@ -305,6 +307,10 @@ export interface CreateDatasetRequest {
305
307
  * falls back to the company's default data plane. Validated server-side.
306
308
  */
307
309
  data_plane_id?: string;
310
+ /** Optional external identifier; must be excluded when registering a dataset in an external data plane. */
311
+ external_id?: string;
312
+ /** Whether the dataset is managed by Narrative. Optional for backwards compatibility. */
313
+ is_narrative_managed?: boolean;
308
314
  }
309
315
  export interface IngestDatasetFileRequest {
310
316
  source_file: string;
@@ -1,15 +1,17 @@
1
1
  import { BaseApi } from "../base-api";
2
2
  import type { ApiRecords } from "../types";
3
- import type { CreateEncryptionMaterialRequest, DataEncryptionMaterial, UpdateEncryptionMaterialRequest } from "./types";
3
+ import type { CreateEncryptionMaterialRequest, DataEncryptionMaterial, DecryptedDataEncryptionMaterial, UpdateEncryptionMaterialRequest } from "./types";
4
4
  export declare class EncryptionMaterialApi extends BaseApi {
5
5
  /**
6
6
  * Get all accessible encryption materials
7
7
  */
8
8
  getEncryptionMaterials(): Promise<ApiRecords<DataEncryptionMaterial>>;
9
9
  /**
10
- * Get decrypted encryption materials
10
+ * Get decrypted encryption materials. Unlike the other endpoints on this
11
+ * API, the response carries the raw (base64-encoded) key material rather
12
+ * than the display/tagging metadata.
11
13
  */
12
- getDecryptedEncryptionMaterials(): Promise<ApiRecords<DataEncryptionMaterial>>;
14
+ getDecryptedEncryptionMaterials(): Promise<ApiRecords<DecryptedDataEncryptionMaterial>>;
13
15
  /**
14
16
  * Get an encryption material by ID
15
17
  */
@@ -8,7 +8,9 @@ export class EncryptionMaterialApi extends BaseApi {
8
8
  return await this.get(`${resourceName}`);
9
9
  }
10
10
  /**
11
- * Get decrypted encryption materials
11
+ * Get decrypted encryption materials. Unlike the other endpoints on this
12
+ * API, the response carries the raw (base64-encoded) key material rather
13
+ * than the display/tagging metadata.
12
14
  */
13
15
  async getDecryptedEncryptionMaterials() {
14
16
  return await this.get(`${resourceName}/decrypted`);
@@ -3,7 +3,7 @@ export interface BaseDataEncryptionMaterial {
3
3
  id: string;
4
4
  company_id: number;
5
5
  created_at: string;
6
- description: string;
6
+ description: string | null;
7
7
  display_name: string;
8
8
  tags: string[];
9
9
  updated_at: string;
@@ -17,15 +17,27 @@ export interface SharedDataEncryptionMaterial extends BaseDataEncryptionMaterial
17
17
  type: "shared";
18
18
  }
19
19
  export type DataEncryptionMaterial = OwnedDataEncryptionMaterial | SharedDataEncryptionMaterial;
20
+ /**
21
+ * Shape returned by `GET /encryption-materials/decrypted`. Unlike the other
22
+ * encryption material responses, this exposes the raw (base64-encoded) key
23
+ * material and does not carry any of the display/tagging metadata.
24
+ */
25
+ export interface DecryptedDataEncryptionMaterial {
26
+ id: string;
27
+ company_id: number;
28
+ /** Base64-encoded decrypted encryption key. */
29
+ key: string;
30
+ /** Base64-encoded encryption salt. */
31
+ salt: string;
32
+ }
20
33
  export interface CreateEncryptionMaterialRequest {
21
34
  display_name: string;
22
35
  description?: string;
23
- tags: string[];
24
- status: EncryptionMaterialStatus;
36
+ tags?: string[];
25
37
  }
26
38
  export interface UpdateEncryptionMaterialRequest {
27
- display_name?: string;
39
+ display_name: string;
28
40
  description?: string;
41
+ /** If provided, must contain at least one tag. */
29
42
  tags?: string[];
30
- status?: EncryptionMaterialStatus;
31
43
  }
@@ -4,14 +4,16 @@ export interface CostForecastRequest {
4
4
  details: ForecastDetails;
5
5
  }
6
6
  export interface ForecastRequest extends CostForecastRequest {
7
+ /** Additional dimensions to compute alongside the forecast. */
8
+ dimensions?: ForecastDimensions;
7
9
  fingerprint?: string;
8
10
  skip_cache?: boolean;
11
+ /** When true, schedules an unsampled forecast run in addition to the sampled one. */
12
+ schedule_unsampled_forecast?: boolean;
9
13
  }
10
- export type ForecastType = "marketplace" | "data_stream";
11
- export interface ForecastDetails {
12
- type: ForecastType;
13
- }
14
- export interface MarketplaceForecastDetails extends ForecastDetails {
14
+ export type ForecastType = "marketplace" | "data_stream" | "data_stream_creation";
15
+ export type ForecastDetails = DataStreamPurchaseDetails | DataStreamCreationDetails | MarketplaceForecastDetails;
16
+ export interface MarketplaceForecastDetails {
15
17
  type: "marketplace";
16
18
  company_constraint?: CompanyConstraint;
17
19
  dataset_constraint?: DatasetConstraint;
@@ -22,7 +24,12 @@ export interface DataStreamPurchaseDetails {
22
24
  type: "data_stream";
23
25
  data_stream_id: string;
24
26
  offer_id: string;
25
- data_shop_id?: number;
27
+ data_shop_id?: string;
28
+ }
29
+ /** Details for forecasting the creation of a new data stream directly from a set of data rules. */
30
+ export interface DataStreamCreationDetails {
31
+ type: "data_stream_creation";
32
+ data_rules: DataRules;
26
33
  }
27
34
  export type CompanyConstraintType = "inclusion" | "exclusion";
28
35
  export interface CompanyConstraint {
@@ -32,27 +39,28 @@ export interface CompanyConstraint {
32
39
  export type DatasetConstraintType = "inclusion" | "exclusion" | "all";
33
40
  export interface DatasetConstraint {
34
41
  type: DatasetConstraintType;
35
- dataset_ids: number[];
42
+ /** Required when `type` is `inclusion` or `exclusion`; unused for `all`. */
43
+ dataset_ids?: number[];
36
44
  }
37
45
  export interface ForecastPricing {
38
46
  micro_cents_usd: number;
39
47
  }
40
- export interface ForecastGenericResponse {
48
+ export interface ForecastGenericResponse<TInput = ForecastInput> {
41
49
  id: string;
42
50
  company_id: number;
43
51
  completed_at?: Date;
44
52
  created_at: Date;
45
53
  failures: JobFailure[];
46
54
  idempotency_key: string;
47
- input: ForecastInput;
55
+ input: TInput;
48
56
  request_source: RequestSource;
49
57
  state: JobState;
50
58
  updated_at: Date;
51
59
  }
52
- export interface ForecastResponse extends ForecastGenericResponse {
53
- result?: ForecastResult | ForecastResultFailure;
60
+ export interface ForecastResponse extends ForecastGenericResponse<ForecastInput> {
61
+ result?: ForecastResult | ForecastOverBudgetResult | ForecastResultFailure;
54
62
  }
55
- export interface CostForecastResponse extends ForecastGenericResponse {
63
+ export interface CostForecastResponse extends ForecastGenericResponse<CostForecastInput> {
56
64
  result?: CostForecastResult | ForecastResultFailure;
57
65
  }
58
66
  export interface CostForecastInput {
@@ -64,9 +72,9 @@ export interface ForecastInput {
64
72
  fingerprint?: string;
65
73
  }
66
74
  export interface RequestSource {
67
- company_id: number;
68
75
  type: string;
69
- user_id: number;
76
+ company_id?: number;
77
+ user_id?: number;
70
78
  }
71
79
  export interface ForecastDimensions {
72
80
  distinct_counts: string[];
@@ -74,11 +82,17 @@ export interface ForecastDimensions {
74
82
  }
75
83
  export type JobState = "pending" | "scheduled" | "running" | "completed" | "pending_cancellation" | "cancelled" | "failed";
76
84
  export interface ForecastResult {
85
+ type: "success";
77
86
  cost: number;
78
87
  datasets: DatasetForecastResponse[];
79
88
  rows: number;
80
89
  scan_cost: ScanCostEstimate;
81
90
  }
91
+ /** Returned instead of {@link ForecastResult} when the forecast exceeds the subscription's budget. */
92
+ export interface ForecastOverBudgetResult {
93
+ type: "over_budget";
94
+ cost: ScanCostEstimate;
95
+ }
82
96
  export interface CostForecastResult {
83
97
  cost: ScanCostEstimate;
84
98
  }
@@ -100,12 +114,22 @@ export interface ScanCostEstimate {
100
114
  sources: DataSourceCost[];
101
115
  }
102
116
  export interface DataSourceCost {
103
- source: string | number;
117
+ source: DataSource;
104
118
  rows: number;
105
119
  size: number;
106
120
  }
121
+ export type DataSource = DatasetSource | TableSource;
122
+ export interface DatasetSource {
123
+ type: "dataset";
124
+ dataset_id: number;
125
+ }
126
+ export interface TableSource {
127
+ type: "table";
128
+ name: string;
129
+ }
107
130
  export interface JobFailure {
108
- message: string;
109
- timestamp: Date;
110
- value: string;
131
+ message?: string;
132
+ timestamp?: Date;
133
+ /** Free-form diagnostic information, e.g. an Apache Spark stacktrace. */
134
+ value?: Record<string, unknown>;
111
135
  }
@@ -8,6 +8,11 @@ export declare class HealthCheckApi extends BaseApi {
8
8
  /**
9
9
  * Gets the result of a health check from the API.
10
10
  *
11
+ * The backend reports success/failure via the HTTP status code (200 healthy, 500 unhealthy) as
12
+ * well as the body's `success` field, so an unhealthy response may surface as a rejected promise
13
+ * rather than a resolved one with `success: false`, depending on how the underlying HTTP client
14
+ * handles non-2xx responses.
15
+ *
11
16
  * @returns {Promise<HealthCheckResult>} A promise that resolves with the result of the health check.
12
17
  */
13
18
  getHealthCheck(): Promise<HealthCheckResult>;
@@ -14,6 +14,11 @@ export class HealthCheckApi extends BaseApi {
14
14
  /**
15
15
  * Gets the result of a health check from the API.
16
16
  *
17
+ * The backend reports success/failure via the HTTP status code (200 healthy, 500 unhealthy) as
18
+ * well as the body's `success` field, so an unhealthy response may surface as a rejected promise
19
+ * rather than a resolved one with `success: false`, depending on how the underlying HTTP client
20
+ * handles non-2xx responses.
21
+ *
17
22
  * @returns {Promise<HealthCheckResult>} A promise that resolves with the result of the health check.
18
23
  */
19
24
  async getHealthCheck() {
@@ -1,6 +1,12 @@
1
1
  export interface HealthCheckResult {
2
2
  success: boolean;
3
- checks: CheckResult[];
3
+ /**
4
+ * Per-dependency check detail. The backend only includes this for callers that present a valid
5
+ * `X-Narrative-Health-Check-Secret` header (an internal, stage-specific secret) — this SDK does
6
+ * not send that header, so in normal use the response is summary-only (`checks` absent) and only
7
+ * `success` is populated.
8
+ */
9
+ checks?: CheckResult[];
4
10
  }
5
11
  export interface CheckResult {
6
12
  name: string;
@@ -8,4 +14,4 @@ export interface CheckResult {
8
14
  success: boolean;
9
15
  error_message?: string | null;
10
16
  }
11
- export type HealthCheckResultType = "postgresql" | "s3";
17
+ export type HealthCheckResultType = "postgresql" | "s3" | "stytch-api" | "product-skus";
@@ -3,6 +3,12 @@ import type { ApiRecords, ApiRecordsV2 } from "../types";
3
3
  import type { AppCategory, CreateInstallationRequest, Installation, InstallationAccessToken, InstallationInfo, Profile } from "./types";
4
4
  export interface ListInstallationsOptions {
5
5
  appCategory?: AppCategory | AppCategory[];
6
+ /**
7
+ * Narrow the results to a single company. Only meaningful with an app
8
+ * client-credentials token; with a company-scoped token the value must
9
+ * match the authenticated company.
10
+ */
11
+ companyId?: number;
6
12
  page?: number;
7
13
  perPage?: number;
8
14
  }
@@ -10,9 +10,10 @@ class InstallationsApi extends BaseApi {
10
10
  * List installations for the authenticated company.
11
11
  */
12
12
  async getInstallations(options = {}) {
13
- const { appCategory, page, perPage } = options;
13
+ const { appCategory, companyId, page, perPage } = options;
14
14
  return await this.get(resourceName, {
15
15
  app_category: appCategory,
16
+ company_id: companyId,
16
17
  page,
17
18
  per_page: perPage,
18
19
  });
@@ -23,8 +23,14 @@ export type ProfileStatus = "enabled" | "disabled" | "archived";
23
23
  export interface Profile {
24
24
  id: string;
25
25
  name: string;
26
- description: string;
26
+ description: string | null;
27
27
  status: ProfileStatus;
28
+ /** The unique identifier of the app. */
29
+ app_id: string | null;
30
+ /** The name of the app. */
31
+ app_name: string | null;
32
+ /** Tags associated with the profile. */
33
+ tags: string[];
28
34
  }
29
35
  export interface InstallationAccessToken {
30
36
  access_token: string;
@@ -4,12 +4,14 @@ import type { CalculateAffectedRowsInput, CalculateAffectedRowsJob, CollectAcces
4
4
  import { isKnownJob, KNOWN_JOB_TYPES } from "./types";
5
5
  type JobStateFilter = "cancelled" | "completed" | "failed" | "pending" | "pending_cancellation" | "running" | "scheduled";
6
6
  interface GetJobsParameters extends Record<string, string | number | boolean | string[] | undefined> {
7
+ data_plane_id?: string;
7
8
  dataset_id?: number;
8
9
  per_page?: number;
9
10
  offset?: number;
10
11
  order_by?: "created_at_asc" | "created_at_desc" | "updated_at_asc" | "updated_at_desc";
11
12
  state?: JobStateFilter | JobStateFilter[];
12
13
  type?: string | string[];
14
+ tag?: string | string[];
13
15
  }
14
16
  /**
15
17
  * @module JobsApi
@@ -29,9 +31,11 @@ declare class JobsApi extends BaseApi {
29
31
  */
30
32
  getJob(jobId: string): Promise<Job>;
31
33
  /**
32
- * Cancel a job by id
33
- * @returns {Promise<void>} - Promise resolving with void.
34
+ * Requests cancellation of a job by id, moving a `pending`/`running` job to
35
+ * `pending_cancellation` so the data plane can stop the work. Use the `jobs/{id}/cancel`
36
+ * endpoint (not yet exposed by this SDK) to finalize cancellation afterwards.
37
+ * @returns {Promise<Job>} - Promise resolving with the job's state after the request.
34
38
  */
35
- cancelJob(jobId: string): Promise<void>;
39
+ cancelJob(jobId: string): Promise<Job>;
36
40
  }
37
41
  export { type CalculateAffectedRowsInput, type CalculateAffectedRowsJob, type CollectAccessRulesBillingDataInput, type CollectAccessRulesBillingDataJob, type CollectAccessRulesBillingDataResult, type ColumnDetails, type ColumnStatDataType, type CostsInput, type CostsJob, type CreateTableInput, type DatasetsCalculateColumnStatsJob, type DatasetsCreateTableJob, type DatasetsDeleteTableJob, type DatasetsDeliverDataJob, type DatasetsEnforceRowTtlRetentionPolicyJob, type DatasetsEnforceTableTtlRetentionPolicyJob, type DatasetsExecuteDmlJob, type DatasetsExecuteSelectJob, type DatasetsSampleJob, type DatasetsSuggestMappingsJob, type DatasetsTruncateTableJob, type DeleteInput, type DeliverInput, type EnabledColumnStatFlags, type EnforceRowTtlRetentionPolicyInput, type EnforceTableTtlRetentionPolicyInput, type ExecuteDmlInput, type ExecuteDmlResult, type ExecuteSelectInput, type ExecuteSelectResult, type ExplainInput, type ExplainJob, type ExplainOutput, type ForecastInput, type ForecastInternalJob, type ForecastJob, type GetJobsParameters, type HealthCheckJob, isKnownJob, type Job, type JobExecutionCluster, type JobRequestSource, type JobRequestSourceApiUser, type JobRequestSourceProcess, type JobStateFilter, JobsApi, type JobType, KNOWN_JOB_TYPES, type KnownJob, type MaterializedViewInput, type MaterializedViewJob, type MaterializedViewOutput, type MaterializedViewRowStats, type ModelInferenceRunInput, type ModelInferenceRunJob, type ModelInferenceRunJobResult, type ModelsDeliverModelInput, type ModelsDeliverModelJob, type ModelsTrainClassifierJob, type ModelTrainingRunInput, type ModelTrainingRunJob, type RefreshMaterializedViewResult, type SampleInput, type StatsInput, type StatsInputV2, type SuggestMappingsInput, type SuggestMappingsResult, type TruncateTableInput, };
@@ -24,11 +24,13 @@ class JobsApi extends BaseApi {
24
24
  return await this.get(`${resourceName}/${jobId}`);
25
25
  }
26
26
  /**
27
- * Cancel a job by id
28
- * @returns {Promise<void>} - Promise resolving with void.
27
+ * Requests cancellation of a job by id, moving a `pending`/`running` job to
28
+ * `pending_cancellation` so the data plane can stop the work. Use the `jobs/{id}/cancel`
29
+ * endpoint (not yet exposed by this SDK) to finalize cancellation afterwards.
30
+ * @returns {Promise<Job>} - Promise resolving with the job's state after the request.
29
31
  */
30
32
  async cancelJob(jobId) {
31
- await this.post(`${resourceName}/${jobId}/request-cancellation`);
33
+ return await this.post(`${resourceName}/${jobId}/request-cancellation`);
32
34
  }
33
35
  }
34
36
  export { isKnownJob, JobsApi, KNOWN_JOB_TYPES, };
@@ -265,23 +265,23 @@ export interface DatasetsSuggestMappingsJob extends BaseJob {
265
265
  }
266
266
  export type ColumnStatDataType = "boolean" | "double" | "long" | "string" | "timestamp_tz" | "array" | "object";
267
267
  export interface EnabledColumnStatFlags {
268
- nan_value_count?: boolean;
269
- null_value_count?: boolean;
270
- value_count?: boolean;
271
- lower_bound?: boolean;
272
- upper_bound?: boolean;
273
- column_stored_bytes?: boolean;
274
- approx_count_distinct?: boolean;
275
- count_distinct?: boolean;
276
- histogram?: boolean;
277
- mean?: boolean;
278
- standard_deviation?: boolean;
279
- completeness?: boolean;
280
- observed_types?: boolean;
268
+ nan_value_count: boolean;
269
+ null_value_count: boolean;
270
+ value_count: boolean;
271
+ lower_bound: boolean;
272
+ upper_bound: boolean;
273
+ column_stored_bytes: boolean;
274
+ approx_count_distinct: boolean;
275
+ count_distinct: boolean;
276
+ histogram: boolean;
277
+ mean: boolean;
278
+ standard_deviation: boolean;
279
+ completeness: boolean;
280
+ observed_types: boolean;
281
281
  }
282
282
  export interface ColumnDetails {
283
283
  data_type: ColumnStatDataType;
284
- enabled_column_stats?: EnabledColumnStatFlags;
284
+ enabled_column_stats: EnabledColumnStatFlags;
285
285
  }
286
286
  export interface StatsInput {
287
287
  dataset_id: number;