@narrative.io/data-collaboration-sdk-ts 3.7.0 → 4.0.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 (81) 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 +23 -2
  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/AstParser.js +29 -6
  55. package/build/nql/NqlBuilder.js +14 -1
  56. package/build/nql/types.d.ts +17 -7
  57. package/build/nql/types.js +5 -1
  58. package/build/ping/index.d.ts +5 -1
  59. package/build/ping/index.js +5 -1
  60. package/build/products/index.d.ts +4 -3
  61. package/build/products/index.js +2 -2
  62. package/build/products/types.d.ts +26 -23
  63. package/build/queries/index.d.ts +7 -6
  64. package/build/queries/index.js +34 -4
  65. package/build/queries/types.d.ts +15 -0
  66. package/build/resources/index.d.ts +2 -2
  67. package/build/resources/index.js +1 -1
  68. package/build/resources/types.d.ts +16 -8
  69. package/build/rosetta-stone/index.d.ts +8 -8
  70. package/build/rosetta-stone/index.js +16 -32
  71. package/build/subscriptions/types.d.ts +3 -3
  72. package/build/uploads/index.d.ts +4 -1
  73. package/build/uploads/index.js +5 -2
  74. package/build/views/index.d.ts +11 -10
  75. package/build/views/index.js +40 -7
  76. package/build/views/types.d.ts +25 -4
  77. package/build/whoami/types.d.ts +38 -9
  78. package/build/workflows/index.d.ts +6 -7
  79. package/build/workflows/index.js +3 -2
  80. package/build/workflows/types.d.ts +14 -3
  81. package/package.json +3 -3
@@ -1,6 +1,6 @@
1
1
  import { BaseApi } from "../base-api";
2
2
  import type { ApiRecords, ApiRecordsV2, PaginationOptions } from "../types";
3
- import type { AccessRule, AccessRuleV2, CreateAccessRuleV2Request, OwnedAccessRule, SharedAccessRule, UpdateAccessRuleV2Request } from "./types";
3
+ import type { AccessRule, AccessRuleMapping, AccessRuleMetadata, AccessRuleV2, CreateAccessRuleV2Request, OwnedAccessRule, SharedAccessRule, UpdateAccessRuleV2Request } from "./types";
4
4
  /**
5
5
  * Represents the parameters used to retrieve access rules.
6
6
  * This interface extends a generic record allowing for a range of value types including arrays.
@@ -127,6 +127,6 @@ declare class AccessRulesApi extends BaseApi {
127
127
  * @description This method updates an existing access rule in version 2 based on the provided access rule ID
128
128
  * and request data. It returns a promise that resolves to the updated access rule details.
129
129
  */
130
- updateccessRuleV2(accessRuleId: number, request: UpdateAccessRuleV2Request): Promise<AccessRuleV2>;
130
+ updateAccessRuleV2(accessRuleId: number, request: UpdateAccessRuleV2Request): Promise<AccessRuleV2>;
131
131
  }
132
- export { type AccessRule, AccessRulesApi, type AccessRuleV2, type CreateAccessRuleV2Request, type GetAccessRulesParameters, type OwnedAccessRule, type SharedAccessRule, type UpdateAccessRuleV2Request, };
132
+ export { type AccessRule, type AccessRuleMapping, type AccessRuleMetadata, AccessRulesApi, type AccessRuleV2, type CreateAccessRuleV2Request, type GetAccessRulesParameters, type OwnedAccessRule, type SharedAccessRule, type UpdateAccessRuleV2Request, };
@@ -115,7 +115,7 @@ class AccessRulesApi extends BaseApi {
115
115
  * @description This method updates an existing access rule in version 2 based on the provided access rule ID
116
116
  * and request data. It returns a promise that resolves to the updated access rule details.
117
117
  */
118
- async updateccessRuleV2(accessRuleId, request) {
118
+ async updateAccessRuleV2(accessRuleId, request) {
119
119
  return await this.put(`v2/${resourceName}/${accessRuleId}`, request);
120
120
  }
121
121
  }
@@ -28,27 +28,37 @@ interface AccessRulePolicy {
28
28
  type AccessRuleConstraints = string[];
29
29
  type AccessRuleDescription = string;
30
30
  type AccessRulePricing = number;
31
- interface AccessRuleMetadata {
31
+ export interface AccessRuleMetadata {
32
32
  created_at: string;
33
33
  updated_at: string;
34
34
  }
35
35
  export type AccessRuleSchema = Partial<Schema>;
36
36
  export type AccessRuleStatus = "active" | "archived";
37
37
  export type AccessRuleShareType = "implicit_share" | "explicit_share";
38
+ /** An attribute mapped to columns referenced by an access rule. */
39
+ export interface AccessRuleMapping {
40
+ attribute_id: number;
41
+ attribute_name: string;
42
+ /** Dot-separated paths of attribute properties exposed by the access rule. Empty for scalar attributes. */
43
+ properties: string[];
44
+ }
38
45
  export interface SharedAccessRule {
39
46
  name?: string;
40
47
  id: number;
41
48
  company_id: number;
42
49
  company_name: string;
43
50
  company_slug?: string;
51
+ data_plane_id: string;
44
52
  display_name?: string;
45
53
  description?: string;
46
54
  image?: string;
47
55
  tags?: string[];
48
- schema: AccessRuleSchema;
56
+ schema?: AccessRuleSchema;
49
57
  price_cpm_usd: number;
50
58
  metadata: AccessRuleMetadata;
51
59
  type: AccessRuleShareType;
60
+ is_owned: boolean;
61
+ mappings: AccessRuleMapping[];
52
62
  }
53
63
  export interface OwnedAccessRule {
54
64
  name?: string;
@@ -56,18 +66,21 @@ export interface OwnedAccessRule {
56
66
  company_id: number;
57
67
  company_name: string;
58
68
  company_slug?: string;
69
+ data_plane_id: string;
59
70
  display_name?: string;
60
71
  description?: string;
61
72
  image?: string;
62
73
  status: AccessRuleStatus;
63
74
  tags?: string[];
64
75
  nql?: string;
65
- schema: AccessRuleSchema;
76
+ schema?: AccessRuleSchema;
66
77
  collaborators: CollaboratorsConfig;
67
78
  price_cpm_usd: number;
68
79
  metadata: AccessRuleMetadata;
69
80
  type: "owned";
70
81
  dataset_ids: number[];
82
+ is_owned: boolean;
83
+ mappings: AccessRuleMapping[];
71
84
  }
72
85
  export interface CreateAccessRuleV2Request {
73
86
  name: string;
@@ -87,6 +100,7 @@ export interface UpdateAccessRuleV2Request {
87
100
  image?: string;
88
101
  collaborators?: CollaboratorsConfig;
89
102
  price_cpm_usd?: number;
103
+ status?: AccessRuleStatus;
90
104
  }
91
105
  export type AccessRuleV2 = OwnedAccessRule | SharedAccessRule;
92
106
  export {};
@@ -5,7 +5,7 @@ import { BaseApi } from "../base-api";
5
5
  * This class includes methods to get, create, update, and delete access tokens.
6
6
  */
7
7
  import type { ApiRecords } from "../types";
8
- import type { AccessTokenMetadata, CreateSystemAccessTokenRequest, CreateSystemAccessTokenResponse, UpdateSystemAccessTokenRequest } from "./types";
8
+ import type { Access, AccessTokenMetadata, CreateSystemAccessTokenRequest, CreateSystemAccessTokenResponse, Permission, Resource, UpdateSystemAccessTokenRequest } from "./types";
9
9
  declare class AccessTokensApi extends BaseApi {
10
10
  /**
11
11
  * Retrieves a list of access tokens.
@@ -44,7 +44,7 @@ declare class AccessTokensApi extends BaseApi {
44
44
  * Updates an existing access token by ID with the provided data.
45
45
  * @param {string} id - The unique identifier for the access token to update.
46
46
  * @param {UpdateSystemAccessTokenRequest} data - The data to update the access token with.
47
- * @returns {Promise<CreateSystemAccessTokenResponse>} A promise that resolves with the response containing the updated access token details.
47
+ * @returns {Promise<AccessTokenMetadata>} A promise that resolves with the response containing the updated access token details.
48
48
  * @example
49
49
  * const accessTokensApi = new AccessTokensApi();
50
50
  * const updateTokenData = {
@@ -54,7 +54,7 @@ declare class AccessTokensApi extends BaseApi {
54
54
  * const updatedToken = await accessTokensApi.updateAccessToken('your-token-id', updateTokenData);
55
55
  * console.log(updatedToken);
56
56
  */
57
- updateAccessToken(id: string, data: UpdateSystemAccessTokenRequest): Promise<CreateSystemAccessTokenResponse>;
57
+ updateAccessToken(id: string, data: UpdateSystemAccessTokenRequest): Promise<AccessTokenMetadata>;
58
58
  /**
59
59
  * Deletes an access token by its ID.
60
60
  * @param {string} id - The unique identifier for the access token to delete.
@@ -66,4 +66,4 @@ declare class AccessTokensApi extends BaseApi {
66
66
  */
67
67
  deleteAccessToken(id: string): Promise<void>;
68
68
  }
69
- export { type AccessTokenMetadata, AccessTokensApi, type CreateSystemAccessTokenRequest, type CreateSystemAccessTokenResponse, type UpdateSystemAccessTokenRequest, };
69
+ export { type Access, type AccessTokenMetadata, AccessTokensApi, type CreateSystemAccessTokenRequest, type CreateSystemAccessTokenResponse, type Permission as AccessTokenPermission, type Resource as AccessTokenResource, type UpdateSystemAccessTokenRequest, };
@@ -22,7 +22,8 @@ class AccessTokensApi extends BaseApi {
22
22
  * console.log(tokenMetadata);
23
23
  */
24
24
  async getAccessToken(id) {
25
- return await this.get(`${resourceName}/tokens/${id}`);
25
+ const response = await this.get(`${resourceName}/tokens/${id}`);
26
+ return response.record;
26
27
  }
27
28
  /**
28
29
  * Creates a new access token with the provided data.
@@ -44,7 +45,7 @@ class AccessTokensApi extends BaseApi {
44
45
  * Updates an existing access token by ID with the provided data.
45
46
  * @param {string} id - The unique identifier for the access token to update.
46
47
  * @param {UpdateSystemAccessTokenRequest} data - The data to update the access token with.
47
- * @returns {Promise<CreateSystemAccessTokenResponse>} A promise that resolves with the response containing the updated access token details.
48
+ * @returns {Promise<AccessTokenMetadata>} A promise that resolves with the response containing the updated access token details.
48
49
  * @example
49
50
  * const accessTokensApi = new AccessTokensApi();
50
51
  * const updateTokenData = {
@@ -1,4 +1,4 @@
1
- export type Access = string;
1
+ export type Access = "admin" | "read" | "write" | "create" | "revise";
2
2
  export declare const resources: {
3
3
  readonly access_tokens: "Access Tokens";
4
4
  readonly agent_conversations: "Agent Conversations";
@@ -51,14 +51,16 @@ export interface AccessTokenMetadata {
51
51
  name: string;
52
52
  permissions: Permission[];
53
53
  expires_at: string;
54
+ /** Not normally populated on list/get responses; present on the create response. */
55
+ access_token?: string;
54
56
  }
55
57
  export interface GetSystemAccessTokenResponse {
56
- access_token: AccessTokenMetadata;
58
+ record: AccessTokenMetadata;
57
59
  }
58
60
  export interface CreateSystemAccessTokenRequest {
59
61
  name: string;
60
62
  permissions?: Permission[];
61
- expires_at: string;
63
+ expires_at?: string;
62
64
  }
63
65
  export interface CreateSystemAccessTokenResponse {
64
66
  id: string;
@@ -149,15 +149,22 @@ export interface LiveRunTurn {
149
149
  turn_index: number;
150
150
  role: AgentMessageRole;
151
151
  content_blocks: ContentBlock[];
152
- created_at: string;
153
152
  }
154
153
  /**
155
- * In-flight progress for a non-terminal run. Empty (or omitted) once the run
156
- * reaches a terminal state at that point the same content is available on
154
+ * The conversation's current, still-mutating state. Always present on a run
155
+ * response (independent of `status`). `messages` streams the run's produced
156
+ * turns while non-terminal and is empty once the run reaches a terminal
157
+ * state — at that point the same content is available on
157
158
  * `GET /agents/conversations/{id}/messages?since={version}` as committed
158
159
  * turns with `sequence_no`.
159
160
  */
160
161
  export interface RunLiveProgress {
162
+ /**
163
+ * The conversation's current display name, or `null`/absent if it has
164
+ * none yet. The platform auto-generates one from the first user message
165
+ * shortly after the first run is created.
166
+ */
167
+ current_name?: string | null;
161
168
  messages: LiveRunTurn[];
162
169
  }
163
170
  export interface RunResponse {
@@ -174,16 +181,25 @@ export interface RunResponse {
174
181
  submitted_inference_job_ids: string[];
175
182
  pending_tool_calls: PendingToolCall[];
176
183
  final_text?: string | null;
184
+ /**
185
+ * The model's final answer as a JSON value conforming to the caller's
186
+ * `output_format_schema`. Populated on `status: completed` when the
187
+ * caller supplied an `output_format_schema` (structured mode). Mutually
188
+ * exclusive with `final_text`.
189
+ */
190
+ final_structured_output?: unknown;
177
191
  error?: RunError | null;
178
192
  started_at: string;
179
193
  completed_at?: string | null;
180
194
  /**
181
- * In-flight tool-loop progress while the run is non-terminal. Empty
182
- * (or absent) after finalize; consumers must then fall back to
195
+ * The conversation's current, still-mutating state (e.g. its
196
+ * auto-generated name) plus in-flight tool-loop progress while the run
197
+ * is non-terminal. Always present on a run response; `messages` is
198
+ * empty after finalize, at which point consumers should fall back to
183
199
  * `listAgentConversationMessages({ since: version-at-run-start })` for
184
200
  * the committed turns.
185
201
  */
186
- live?: RunLiveProgress | null;
202
+ live: RunLiveProgress;
187
203
  }
188
204
  export type AgentMessageRole = "user" | "assistant" | "tool";
189
205
  export interface TextContentBlock {
@@ -1,6 +1,6 @@
1
1
  import { BaseApi } from "../base-api";
2
2
  import type { JsonSchemaConnectorPolicy } from "../collaboration-policy/core/jsonschema/json-schema-types";
3
- import type { ApiRecords } from "../types";
3
+ import type { ApiRecords, ApiRecordsV2 } from "../types";
4
4
  import type { App, Installation } from "./types";
5
5
  /**
6
6
  * @module AppsApi
@@ -9,12 +9,25 @@ import type { App, Installation } from "./types";
9
9
  */
10
10
  declare class AppsApi extends BaseApi {
11
11
  /**
12
- * Get all installations for the current user
13
- * @param {number} appCategory - An optional filter for app categories.
14
- * @returns {Promise<ApiRecords<Installation>>} - Promise resolving with the list of installations.
12
+ * List apps available on the platform.
13
+ * @param {string | string[]} [appCategory] - Optional filter for app categories
14
+ * (`category` query param; repeatable).
15
+ * @returns {Promise<ApiRecords<App>>} - Promise resolving with the list of apps.
15
16
  */
16
- getApps(appCategory?: string): Promise<ApiRecords<App>>;
17
- getInstalledApps(appCategory?: string): Promise<ApiRecords<Installation>>;
17
+ getApps(appCategory?: string | string[]): Promise<ApiRecords<App>>;
18
+ /**
19
+ * List installations for the authenticated company (or, with an app
20
+ * client-credentials token, for the authenticated app across all
21
+ * companies). Delegates to the same paginated `/installations` endpoint as
22
+ * `InstallationsApi.getInstallations`.
23
+ * @param {string | string[]} [appCategory] - Optional filter for app categories
24
+ * (`app_category` query param; repeatable).
25
+ * @param {number} [companyId] - Optional company filter (`company_id` query
26
+ * param), only meaningful with an app client-credentials token.
27
+ * @returns {Promise<ApiRecordsV2<Installation>>} - Promise resolving with the
28
+ * paginated list of installations.
29
+ */
30
+ getInstalledApps(appCategory?: string | string[], companyId?: number): Promise<ApiRecordsV2<Installation>>;
18
31
  /**
19
32
  * Get all interfaces for the current user's installed connectors.
20
33
  * @param {string[]} [tags] - Optional tags to filter interfaces (e.g. ["audience_delivery"]).
@@ -7,19 +7,35 @@ const resourceName = "apps";
7
7
  */
8
8
  class AppsApi extends BaseApi {
9
9
  /**
10
- * Get all installations for the current user
11
- * @param {number} appCategory - An optional filter for app categories.
12
- * @returns {Promise<ApiRecords<Installation>>} - Promise resolving with the list of installations.
10
+ * List apps available on the platform.
11
+ * @param {string | string[]} [appCategory] - Optional filter for app categories
12
+ * (`category` query param; repeatable).
13
+ * @returns {Promise<ApiRecords<App>>} - Promise resolving with the list of apps.
13
14
  */
14
15
  async getApps(appCategory) {
15
- const appCategoryQuery = appCategory !== undefined ? `?app_category=${appCategory}` : "";
16
- const url = `${resourceName}${appCategoryQuery}`;
17
- return await this.get(url);
16
+ return appCategory === undefined
17
+ ? await this.get(resourceName)
18
+ : await this.get(resourceName, {
19
+ category: appCategory,
20
+ });
18
21
  }
19
- async getInstalledApps(appCategory) {
20
- const appCategoryQuery = appCategory !== undefined ? `?app_category=${appCategory}` : "";
21
- const url = `installations${appCategoryQuery}`;
22
- return await this.get(url);
22
+ /**
23
+ * List installations for the authenticated company (or, with an app
24
+ * client-credentials token, for the authenticated app across all
25
+ * companies). Delegates to the same paginated `/installations` endpoint as
26
+ * `InstallationsApi.getInstallations`.
27
+ * @param {string | string[]} [appCategory] - Optional filter for app categories
28
+ * (`app_category` query param; repeatable).
29
+ * @param {number} [companyId] - Optional company filter (`company_id` query
30
+ * param), only meaningful with an app client-credentials token.
31
+ * @returns {Promise<ApiRecordsV2<Installation>>} - Promise resolving with the
32
+ * paginated list of installations.
33
+ */
34
+ async getInstalledApps(appCategory, companyId) {
35
+ return await this.get("installations", {
36
+ app_category: appCategory,
37
+ company_id: companyId,
38
+ });
23
39
  }
24
40
  /**
25
41
  * Get all interfaces for the current user's installed connectors.
@@ -1,5 +1,5 @@
1
1
  interface Permission {
2
- access: "read" | "write";
2
+ access: "admin" | "read" | "write" | "create" | "revise";
3
3
  resource: string;
4
4
  }
5
5
  export interface Installation {
@@ -1,6 +1,6 @@
1
1
  import { BaseApi } from "../base-api";
2
- import type { ApiRecords, ApiRecordsV2, PaginationOptions, SearchParams } from "../types";
3
- import type { ArrayAttribute, Attribute, ObjectAttribute, PrimitiveAttribute, RefAttribute, ShallowAttribute, SubAttribute } from "./types";
2
+ import type { ApiRecords, PaginationOptions, SearchParams } from "../types";
3
+ import type { ArrayAttribute, Attribute, AttributeSearchOptions, ObjectAttribute, PrimitiveAttribute, RefAttribute, ShallowAttribute, SubAttribute } from "./types";
4
4
  /**
5
5
  * A class for accessing the Attribute API.
6
6
  * @extends BaseApi
@@ -19,27 +19,30 @@ declare class AttributeApi extends BaseApi {
19
19
  */
20
20
  declare class AttributeApiV2 extends BaseApi {
21
21
  /**
22
- * Gets a list of attributes from the API.
22
+ * Gets a list of attributes from the API. Note: the API does not return
23
+ * pagination metadata for this endpoint (only `records`), so the response
24
+ * is not further paginated beyond what `page`/`per_page` select.
23
25
  *
24
26
  * @param {PaginationOptions} [paginationOptions] - Optional pagination parameters.
25
27
  * @param {SearchParams} [searchParams] - Optional search parameters.
26
- * @returns {Promise<ApiRecordsV2<Attribute>>} A promise that resolves with the list of attributes.
28
+ * @param {AttributeSearchOptions} [options] - Optional `resolve`/`min_score` filters.
29
+ * @returns {Promise<ApiRecords<Attribute>>} A promise that resolves with the list of attributes.
27
30
  */
28
- getAttributesV2(paginationOptions?: PaginationOptions, searchParams?: SearchParams): Promise<ApiRecordsV2<Attribute>>;
31
+ getAttributesV2(paginationOptions?: PaginationOptions, searchParams?: SearchParams, options?: AttributeSearchOptions): Promise<ApiRecords<Attribute>>;
29
32
  /**
30
- * Gets a single attribute from the API by its ID.
33
+ * Gets a single attribute from the API by its ID or name.
31
34
  *
32
- * @param {number} attributeId - The ID of the attribute to retrieve.
35
+ * @param {number | string} attributeId - The ID or unique name of the attribute to retrieve.
33
36
  * @returns {Promise<Attribute>} A promise that resolves with the attribute.
34
37
  */
35
- getAttribute(attributeId: number): Promise<Attribute>;
38
+ getAttribute(attributeId: number | string): Promise<Attribute>;
36
39
  /**
37
- * Deletes a single attribute from the API by its ID.
40
+ * Deletes a single attribute from the API by its ID or name.
38
41
  *
39
- * @param {number} attributeId - The ID of the attribute to delete.
42
+ * @param {number | string} attributeId - The ID or unique name of the attribute to delete.
40
43
  * @returns {Promise<void>} A promise that resolves when the delete operation is complete.
41
44
  */
42
- deleteAttribute(attributeId: number): Promise<void>;
45
+ deleteAttribute(attributeId: number | string): Promise<void>;
43
46
  /**
44
47
  * Creates a new attribute on the API.
45
48
  *
@@ -48,4 +51,4 @@ declare class AttributeApiV2 extends BaseApi {
48
51
  */
49
52
  createAttribute(data: Attribute): Promise<Attribute>;
50
53
  }
51
- export { type ArrayAttribute, type Attribute, AttributeApi, AttributeApiV2, type ObjectAttribute, type PrimitiveAttribute, type RefAttribute, type ShallowAttribute, type SubAttribute, };
54
+ export { type ArrayAttribute, type Attribute, AttributeApi, AttributeApiV2, type AttributeSearchOptions, type ObjectAttribute, type PrimitiveAttribute, type RefAttribute, type ShallowAttribute, type SubAttribute, };
@@ -26,13 +26,16 @@ class AttributeApi extends BaseApi {
26
26
  */
27
27
  class AttributeApiV2 extends BaseApi {
28
28
  /**
29
- * Gets a list of attributes from the API.
29
+ * Gets a list of attributes from the API. Note: the API does not return
30
+ * pagination metadata for this endpoint (only `records`), so the response
31
+ * is not further paginated beyond what `page`/`per_page` select.
30
32
  *
31
33
  * @param {PaginationOptions} [paginationOptions] - Optional pagination parameters.
32
34
  * @param {SearchParams} [searchParams] - Optional search parameters.
33
- * @returns {Promise<ApiRecordsV2<Attribute>>} A promise that resolves with the list of attributes.
35
+ * @param {AttributeSearchOptions} [options] - Optional `resolve`/`min_score` filters.
36
+ * @returns {Promise<ApiRecords<Attribute>>} A promise that resolves with the list of attributes.
34
37
  */
35
- async getAttributesV2(paginationOptions, searchParams) {
38
+ async getAttributesV2(paginationOptions, searchParams, options) {
36
39
  const queryParams = new URLSearchParams();
37
40
  if (paginationOptions?.page) {
38
41
  queryParams.append("page", paginationOptions.page.toString());
@@ -43,22 +46,28 @@ class AttributeApiV2 extends BaseApi {
43
46
  if (searchParams?.q) {
44
47
  queryParams.append("q", searchParams.q);
45
48
  }
49
+ if (options?.resolve !== undefined) {
50
+ queryParams.append("resolve", options.resolve.toString());
51
+ }
52
+ if (options?.min_score !== undefined) {
53
+ queryParams.append("min_score", options.min_score.toString());
54
+ }
46
55
  const url = `${resourceName}?${queryParams.toString()}`;
47
56
  return await this.get(url);
48
57
  }
49
58
  /**
50
- * Gets a single attribute from the API by its ID.
59
+ * Gets a single attribute from the API by its ID or name.
51
60
  *
52
- * @param {number} attributeId - The ID of the attribute to retrieve.
61
+ * @param {number | string} attributeId - The ID or unique name of the attribute to retrieve.
53
62
  * @returns {Promise<Attribute>} A promise that resolves with the attribute.
54
63
  */
55
64
  async getAttribute(attributeId) {
56
65
  return await this.get(`${resourceName}/${attributeId}`);
57
66
  }
58
67
  /**
59
- * Deletes a single attribute from the API by its ID.
68
+ * Deletes a single attribute from the API by its ID or name.
60
69
  *
61
- * @param {number} attributeId - The ID of the attribute to delete.
70
+ * @param {number | string} attributeId - The ID or unique name of the attribute to delete.
62
71
  * @returns {Promise<void>} A promise that resolves when the delete operation is complete.
63
72
  */
64
73
  async deleteAttribute(attributeId) {
@@ -8,7 +8,7 @@ export type ParticipantsNone = {
8
8
  };
9
9
  export type ParticipantsInclusion = {
10
10
  type: "inclusion";
11
- company_ids: number[];
11
+ companies: number[];
12
12
  };
13
13
  export type Participants = ParticipantsAll | ParticipantsNone | ParticipantsInclusion;
14
14
  export interface AttributeCollaborators {
@@ -18,11 +18,14 @@ export interface AttributeCollaborators {
18
18
  export interface BaseAttribute {
19
19
  id: number;
20
20
  name: string;
21
- display_name?: string;
21
+ display_name: string;
22
22
  description?: string;
23
23
  type: string;
24
24
  validations?: string[];
25
25
  metadata?: AttributeMetadata;
26
+ /** Present only when the requesting company owns the attribute. */
27
+ company_id?: number;
28
+ /** Present only when the requesting company owns the attribute. */
26
29
  collaborators?: AttributeCollaborators;
27
30
  }
28
31
  export interface PrimitiveAttribute extends BaseAttribute {
@@ -54,3 +57,16 @@ export interface AttributeCooccurrence {
54
57
  attribute: Attribute;
55
58
  cooccurrence_pct: number;
56
59
  }
60
+ /**
61
+ * Options accepted by `GET /attributes` in addition to pagination and keyword search.
62
+ */
63
+ export interface AttributeSearchOptions {
64
+ /** Resolve `$ref` attribute references. Defaults to `true` server-side. */
65
+ resolve?: boolean;
66
+ /**
67
+ * Minimum relevance score in `(0, 1]`, restricting results to matches at or
68
+ * above this threshold. Only meaningful together with `searchParams.q`;
69
+ * supplying it without `q` is a 400 server-side.
70
+ */
71
+ min_score?: number;
72
+ }
@@ -8,7 +8,7 @@ export interface LoginResponse {
8
8
  name: string;
9
9
  company_id: number;
10
10
  company_name: string;
11
- role: UserRole;
11
+ role?: UserRole;
12
12
  };
13
13
  api_token: ApiToken;
14
14
  }
@@ -45,11 +45,11 @@ export interface RegistrationStatusRequest {
45
45
  }
46
46
  export interface RegistrationStatusB2bRequest {
47
47
  stytch_token: string;
48
- session_duration_minutes: number;
48
+ session_duration_minutes?: number;
49
49
  }
50
50
  export interface RegistrationStatusResponse {
51
51
  status: RegistrationStatus;
52
- email: string;
52
+ email?: string;
53
53
  stytch_session_token: string;
54
54
  stytch_session_jwt: string;
55
55
  }
@@ -12,9 +12,12 @@ export * from "./types";
12
12
  */
13
13
  export declare class CompaniesApi extends BaseApi {
14
14
  /**
15
- * List all active and pending companies, newest filter applied server-side
16
- * (archived excluded). Returns the `records` envelope only — no pagination
17
- * metadata is provided by the backend for this endpoint.
15
+ * List all active and pending companies (archived excluded server-side).
16
+ * Returns the `records` envelope only — no pagination metadata is provided
17
+ * by the backend for this endpoint.
18
+ *
19
+ * @param {string} [nameLike] - Optional case-insensitive substring filter
20
+ * applied server-side to the company name (`name_like` query param).
18
21
  */
19
- getCompanies(): Promise<ApiRecords<CompanyAdminResponse>>;
22
+ getCompanies(nameLike?: string): Promise<ApiRecords<CompanyAdminResponse>>;
20
23
  }
@@ -11,11 +11,16 @@ const resourceName = "admin/companies";
11
11
  */
12
12
  export class CompaniesApi extends BaseApi {
13
13
  /**
14
- * List all active and pending companies, newest filter applied server-side
15
- * (archived excluded). Returns the `records` envelope only — no pagination
16
- * metadata is provided by the backend for this endpoint.
14
+ * List all active and pending companies (archived excluded server-side).
15
+ * Returns the `records` envelope only — no pagination metadata is provided
16
+ * by the backend for this endpoint.
17
+ *
18
+ * @param {string} [nameLike] - Optional case-insensitive substring filter
19
+ * applied server-side to the company name (`name_like` query param).
17
20
  */
18
- async getCompanies() {
19
- return await this.get(resourceName);
21
+ async getCompanies(nameLike) {
22
+ return await this.get(resourceName, {
23
+ name_like: nameLike,
24
+ });
20
25
  }
21
26
  }
@@ -14,4 +14,14 @@ export interface CompanyInfo {
14
14
  export interface WhoAmI {
15
15
  id: number;
16
16
  userId?: number;
17
+ /**
18
+ * The company's credit limit in USD. Emitted camelCase (the route uses a
19
+ * plain `deriveEncoder`), always present.
20
+ */
21
+ creditLimitUSD: number;
22
+ /**
23
+ * Whether datashops credit limits are enforced for the company. Emitted
24
+ * camelCase, always present.
25
+ */
26
+ checkDatashopsCreditLimit: boolean;
17
27
  }
@@ -2,7 +2,12 @@ export type ComputePoolType = "owned" | "shared";
2
2
  export type ComputePoolStatus = "active" | "archived";
3
3
  export type ComputePoolSize = "x_small" | "small" | "medium" | "large" | "x_large" | "2x_large" | "3x_large" | "4x_large" | "5x_large" | "6x_large";
4
4
  export type SnowflakeWarehouseSize = ComputePoolSize;
5
- export type AwsEmrSize = ComputePoolSize;
5
+ /**
6
+ * EMR compute pool size. Includes every {@link ComputePoolSize} plus a `*_storage` variant of each
7
+ * (e.g. `medium_storage`) — same memory budget, but running on instances with local NVMe SSD
8
+ * storage for shuffle-/scratch-heavy jobs.
9
+ */
10
+ export type AwsEmrSize = ComputePoolSize | "x_small_storage" | "small_storage" | "medium_storage" | "large_storage" | "x_large_storage" | "2x_large_storage" | "3x_large_storage" | "4x_large_storage" | "5x_large_storage" | "6x_large_storage";
6
11
  export type SnowflakeWarehouseType = "standard" | "snowpark_optimized";
7
12
  export type ScalingPolicy = "standard" | "economy";
8
13
  export interface SnowflakeWarehouseExternalId {
@@ -35,7 +40,17 @@ export interface SnowflakeWarehouseProvider {
35
40
  export interface AwsEmrProvider {
36
41
  type: "aws_emr";
37
42
  size: AwsEmrSize;
43
+ /**
44
+ * EMR cluster auto-termination idle timeout, in seconds. Tri-state: omitted/`null` resets to the
45
+ * default (900s) on both create and update; `-1` disables idle termination; otherwise must be
46
+ * between 60 and 604800 (7 days).
47
+ */
38
48
  idle_timeout_seconds?: number;
49
+ /**
50
+ * Maximum time, in seconds, a single job's EMR step may stay `RUNNING` before it's cancelled.
51
+ * Omitted/`null` resets to the default (14400s) on both create and update; otherwise must be
52
+ * between 60 and 604800 (7 days).
53
+ */
39
54
  job_execution_timeout_seconds?: number;
40
55
  }
41
56
  export type ComputePoolProvider = SnowflakeWarehouseProvider | AwsEmrProvider;
@@ -45,11 +60,17 @@ export interface ParticipantsAll {
45
60
  export interface ParticipantsNone {
46
61
  type: "none";
47
62
  }
63
+ /** Only these companies. `company_ids` must be non-empty. */
48
64
  export interface ParticipantsInclusion {
49
65
  type: "inclusion";
50
66
  company_ids: number[];
51
67
  }
52
- export type Participants = ParticipantsAll | ParticipantsNone | ParticipantsInclusion;
68
+ /** Every company except these. `company_ids` must be non-empty. */
69
+ export interface ParticipantsExclusion {
70
+ type: "exclusion";
71
+ company_ids: number[];
72
+ }
73
+ export type Participants = ParticipantsAll | ParticipantsNone | ParticipantsInclusion | ParticipantsExclusion;
53
74
  export interface ComputePoolCollaborators {
54
75
  use: Participants;
55
76
  }