@narrative.io/data-collaboration-sdk-ts 2.17.0 → 2.18.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.
@@ -1,5 +1,5 @@
1
1
  import { BaseApi } from "../base-api";
2
- import type { ApiRecords } from "../types";
2
+ import type { ApiRecords, ApiRecordsV2, PaginationOptions, SearchParams } from "../types";
3
3
  import type { ArrayAttribute, Attribute, ObjectAttribute, PrimitiveAttribute, RefAttribute, ShallowAttribute, SubAttribute } from "./types";
4
4
  /**
5
5
  * A class for accessing the Attribute API.
@@ -12,6 +12,20 @@ declare class AttributeApi extends BaseApi {
12
12
  * @returns {Promise<ApiRecords<Attribute>>} A promise that resolves with the list of attributes.
13
13
  */
14
14
  getAttributes(): Promise<ApiRecords<Attribute>>;
15
+ }
16
+ /**
17
+ * A class for accessing the Attribute API.
18
+ * @extends BaseApi
19
+ */
20
+ declare class AttributeApiV2 extends BaseApi {
21
+ /**
22
+ * Gets a list of attributes from the API.
23
+ *
24
+ * @param {PaginationOptions} [paginationOptions] - Optional pagination parameters.
25
+ * @param {SearchParams} [searchParams] - Optional search parameters.
26
+ * @returns {Promise<ApiRecordsV2<Attribute>>} A promise that resolves with the list of attributes.
27
+ */
28
+ getAttributesV2(paginationOptions?: PaginationOptions, searchParams?: SearchParams): Promise<ApiRecordsV2<Attribute>>;
15
29
  /**
16
30
  * Gets a single attribute from the API by its ID.
17
31
  *
@@ -34,4 +48,4 @@ declare class AttributeApi extends BaseApi {
34
48
  */
35
49
  createAttribute(data: Attribute): Promise<Attribute>;
36
50
  }
37
- export { AttributeApi, type Attribute, type ShallowAttribute, type RefAttribute, type SubAttribute, type PrimitiveAttribute, type ArrayAttribute, type ObjectAttribute, };
51
+ export { AttributeApi, AttributeApiV2, type Attribute, type ShallowAttribute, type RefAttribute, type SubAttribute, type PrimitiveAttribute, type ArrayAttribute, type ObjectAttribute, };
@@ -19,6 +19,33 @@ class AttributeApi extends BaseApi {
19
19
  async getAttributes() {
20
20
  return await this.get(resourceName);
21
21
  }
22
+ }
23
+ /**
24
+ * A class for accessing the Attribute API.
25
+ * @extends BaseApi
26
+ */
27
+ class AttributeApiV2 extends BaseApi {
28
+ /**
29
+ * Gets a list of attributes from the API.
30
+ *
31
+ * @param {PaginationOptions} [paginationOptions] - Optional pagination parameters.
32
+ * @param {SearchParams} [searchParams] - Optional search parameters.
33
+ * @returns {Promise<ApiRecordsV2<Attribute>>} A promise that resolves with the list of attributes.
34
+ */
35
+ async getAttributesV2(paginationOptions, searchParams) {
36
+ const queryParams = new URLSearchParams();
37
+ if (paginationOptions?.page) {
38
+ queryParams.append("page", paginationOptions.page.toString());
39
+ }
40
+ if (paginationOptions?.per_page) {
41
+ queryParams.append("per_page", paginationOptions.per_page.toString());
42
+ }
43
+ if (searchParams?.q) {
44
+ queryParams.append("q", searchParams.q);
45
+ }
46
+ const url = `${resourceName}?${queryParams.toString()}`;
47
+ return await this.get(url);
48
+ }
22
49
  /**
23
50
  * Gets a single attribute from the API by its ID.
24
51
  *
@@ -47,4 +74,4 @@ class AttributeApi extends BaseApi {
47
74
  return await this.post(`${resourceName}`, data);
48
75
  }
49
76
  }
50
- export { AttributeApi, };
77
+ export { AttributeApi, AttributeApiV2, };
package/build/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import type { AccessRuleSchema } from "./access-rules/types";
3
3
  import { type AccessTokenMetadata, AccessTokensApi, type CreateSystemAccessTokenRequest, type CreateSystemAccessTokenResponse, type UpdateSystemAccessTokenRequest } from "./access-tokens";
4
4
  import { type Permission, resources } from "./access-tokens/types";
5
5
  import { type App, AppsApi } from "./apps";
6
- import { AttributeApi } from "./attributes";
6
+ import { AttributeApi, AttributeApiV2 } from "./attributes";
7
7
  import type { ArrayAttribute, Attribute, ObjectAttribute, PrimitiveAttribute, RefAttribute, ShallowAttribute, SubAttribute } from "./attributes/types";
8
8
  import { type ApiToken, AuthenticationApi, type LoggedInUser, type LoginRequest, type LoginResponse, type RegisterRequest, type RegisterResponse, type RegistrationStatus, type RegistrationStatusRequest, type RegistrationStatusResponse, type StytchToken, type UserRole } from "./authentication";
9
9
  import { BaseApi } from "./base-api";
@@ -42,6 +42,6 @@ import { WhoAmIApi } from "./whoami";
42
42
  import type { User } from "./whoami/types";
43
43
  declare class NarrativeApi extends BaseApi {
44
44
  }
45
- interface NarrativeApi extends BaseApi, HealthCheckApi, AccessTokensApi, DataPlaneApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, ConnectionsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, MappingsApi, AccessRulesApi, AppsApi, SubscriptionsApi, JobsApi, QueriesApi, WhoAmIApi {
45
+ interface NarrativeApi extends BaseApi, HealthCheckApi, AccessTokensApi, DataPlaneApi, DatasetApi, RosettaStoneApi, AttributeApi, AttributeApiV2, PingApi, CompanyInfoApi, InstallationsApi, ConnectionsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, MappingsApi, AccessRulesApi, AppsApi, SubscriptionsApi, JobsApi, QueriesApi, WhoAmIApi {
46
46
  }
47
- export { NarrativeApi, AttributeApi, AccessTokensApi, DataPlaneApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, ConnectionsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, MappingsApi, AccessRulesApi, SubscriptionsApi, JobsApi, QueriesApi, WhoAmIApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall, isRosettaRequestMessage, isConversationAssistantMessageWithoutFunctionCall, resources, type DataPlane, type AccessTokenMetadata, type CreateSystemAccessTokenRequest, type CreateSystemAccessTokenResponse, type UpdateSystemAccessTokenRequest, type App, type Resource, type AccessRuleV2, type GetAccessRulesParameters, type UploadsResponse, type PingStatus, type Attribute, type ShallowAttribute, type Connection, type RefAttribute, type SubAttribute, type PrimitiveAttribute, type ArrayAttribute, type ObjectAttribute, type Environment, type Config, type ApiRecords, type ApiRecordsV2, type Dataset, type HealthCheckResult, type SampleRecords, type Permission, type DatasetTableSummary, type DatasetTableSummaryAPIResponse, type UpdateDatasetRequest, type SchemaFileConfigType, type SchemaPropertiesType, type DatasetStatus, type DatasetWriteMode, type SchemaFileConfig, type SchemaProperties, type SchemaProperty, type SchemaPrimitiveProperty, type SchemaObjectProperty, type SchemaArrayProperty, type SchemaArrayItems, type SchemaArrayItemsPrimitive, type SchemaArrayItemsObject, type SchemaArrayItemsArray, type Schema, type AdvancedStatisticsMetadata, type SnapshotRange, type Configuration, type Columns, type ColumnSummary, type ColumnStatistics, type BasicStatistics, type AdvancedStatistics, type Histogram, type Value, type CreateDatasetRequest, type IngestDatasetFileRequest, type Product, type MonetaryAmount, type CompanyInfo, type Installation, type Profile, type FilePerSnapshotResponse, type BucketCreationRequest, type UpdateAccessTypeRequest, type CompiledNql, type CreateMaterializedView, type GetJobsParameters, type Deduplication, type Explain, type Expression, type Raw, type Select, type Statement, type Table, type Nql, type NqlAst, type NqlField, type NqlResult, type NqlQueryInput, type NqlCompileResult, type NqlExpression, type NqlWhere, type NqlFilterExpression, type NqlBooleanExpression, type NqlFilterBinaryExpression, type NqlFilterUnaryExpression, type DataStream, type DataRules, type ColumnSet, type ColumnWithFilterAndExport, type AttributeSet, type ForecastRequest, type ForecastResponse, type CostForecastRequest, type CostForecastResponse, type ForecastResult, type CostForecastResult, type ForecastResultFailure, type JobState, type ContractDetails, type CustomerContract, type PaymentMethod, type ContractRateView, type LoginRequest, type LoginResponse, type RegisterRequest, type RegisterResponse, type LoggedInUser, type StytchToken, type ApiToken, type UserRole, type RegistrationStatus, type RegistrationStatusRequest, type RegistrationStatusResponse, type ForecastBody, type AstNodeType, type AstNodeMetadata, type SharedAccessRule, type OwnedAccessRule, type ConversationAssistantMessage, type ConversationFunctionMessage, type ConversationIOMessage, type ConversationMessage, type ConversationMessageName, type ConversationMessageRole, type AccessRuleSchema, type ConversationMessages, type ConversationSystemMessage, type ConversationUserMessage, type RosettaRequestMessage, type ConversationMessageFunctionCall, type ConversationAssistantMessageWithFunctionCall, type RosettaResponseMessage, type ConversationAssistantMessageWithoutFunctionCall, type RetentionPolicy, type AccessRule, type Subscription, type SubscriptionDetails, type DataStreamSubscriptionDetails, type MarketplaceSubscriptionDetails, type SubscriptionOutput, type SubscriptionType, type SubscriptionStatus, type SubscriptionBudget, type Job, type ExplainInput, type MaterializedViewInput, type ExplainOutput, type MaterializedViewOutput, type User, type Mapping, type MappingTestResult, type ValueMapping, type ObjectMapping, type CreateMapping, type CreateNqlQueryRequest, type UpdateNqlQueryRequest, type NqlQueryResponse, type NqlSharedQueryResponse, type NqlOwnedQueryResponse, type NqlQueryCollaborators, type NqlQueryOwner, type NqlQueryMetadata, compileStatement, parseStatement, };
47
+ export { NarrativeApi, AttributeApi, AttributeApiV2, AccessTokensApi, DataPlaneApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, ConnectionsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, MappingsApi, AccessRulesApi, SubscriptionsApi, JobsApi, QueriesApi, WhoAmIApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall, isRosettaRequestMessage, isConversationAssistantMessageWithoutFunctionCall, resources, type DataPlane, type AccessTokenMetadata, type CreateSystemAccessTokenRequest, type CreateSystemAccessTokenResponse, type UpdateSystemAccessTokenRequest, type App, type Resource, type AccessRuleV2, type GetAccessRulesParameters, type UploadsResponse, type PingStatus, type Attribute, type ShallowAttribute, type Connection, type RefAttribute, type SubAttribute, type PrimitiveAttribute, type ArrayAttribute, type ObjectAttribute, type Environment, type Config, type ApiRecords, type ApiRecordsV2, type Dataset, type HealthCheckResult, type SampleRecords, type Permission, type DatasetTableSummary, type DatasetTableSummaryAPIResponse, type UpdateDatasetRequest, type SchemaFileConfigType, type SchemaPropertiesType, type DatasetStatus, type DatasetWriteMode, type SchemaFileConfig, type SchemaProperties, type SchemaProperty, type SchemaPrimitiveProperty, type SchemaObjectProperty, type SchemaArrayProperty, type SchemaArrayItems, type SchemaArrayItemsPrimitive, type SchemaArrayItemsObject, type SchemaArrayItemsArray, type Schema, type AdvancedStatisticsMetadata, type SnapshotRange, type Configuration, type Columns, type ColumnSummary, type ColumnStatistics, type BasicStatistics, type AdvancedStatistics, type Histogram, type Value, type CreateDatasetRequest, type IngestDatasetFileRequest, type Product, type MonetaryAmount, type CompanyInfo, type Installation, type Profile, type FilePerSnapshotResponse, type BucketCreationRequest, type UpdateAccessTypeRequest, type CompiledNql, type CreateMaterializedView, type GetJobsParameters, type Deduplication, type Explain, type Expression, type Raw, type Select, type Statement, type Table, type Nql, type NqlAst, type NqlField, type NqlResult, type NqlQueryInput, type NqlCompileResult, type NqlExpression, type NqlWhere, type NqlFilterExpression, type NqlBooleanExpression, type NqlFilterBinaryExpression, type NqlFilterUnaryExpression, type DataStream, type DataRules, type ColumnSet, type ColumnWithFilterAndExport, type AttributeSet, type ForecastRequest, type ForecastResponse, type CostForecastRequest, type CostForecastResponse, type ForecastResult, type CostForecastResult, type ForecastResultFailure, type JobState, type ContractDetails, type CustomerContract, type PaymentMethod, type ContractRateView, type LoginRequest, type LoginResponse, type RegisterRequest, type RegisterResponse, type LoggedInUser, type StytchToken, type ApiToken, type UserRole, type RegistrationStatus, type RegistrationStatusRequest, type RegistrationStatusResponse, type ForecastBody, type AstNodeType, type AstNodeMetadata, type SharedAccessRule, type OwnedAccessRule, type ConversationAssistantMessage, type ConversationFunctionMessage, type ConversationIOMessage, type ConversationMessage, type ConversationMessageName, type ConversationMessageRole, type AccessRuleSchema, type ConversationMessages, type ConversationSystemMessage, type ConversationUserMessage, type RosettaRequestMessage, type ConversationMessageFunctionCall, type ConversationAssistantMessageWithFunctionCall, type RosettaResponseMessage, type ConversationAssistantMessageWithoutFunctionCall, type RetentionPolicy, type AccessRule, type Subscription, type SubscriptionDetails, type DataStreamSubscriptionDetails, type MarketplaceSubscriptionDetails, type SubscriptionOutput, type SubscriptionType, type SubscriptionStatus, type SubscriptionBudget, type Job, type ExplainInput, type MaterializedViewInput, type ExplainOutput, type MaterializedViewOutput, type User, type Mapping, type MappingTestResult, type ValueMapping, type ObjectMapping, type CreateMapping, type CreateNqlQueryRequest, type UpdateNqlQueryRequest, type NqlQueryResponse, type NqlSharedQueryResponse, type NqlOwnedQueryResponse, type NqlQueryCollaborators, type NqlQueryOwner, type NqlQueryMetadata, compileStatement, parseStatement, };
package/build/index.js CHANGED
@@ -2,7 +2,7 @@ import { AccessRulesApi, } from "./access-rules/";
2
2
  import { AccessTokensApi, } from "./access-tokens";
3
3
  import { resources } from "./access-tokens/types";
4
4
  import { AppsApi } from "./apps";
5
- import { AttributeApi } from "./attributes";
5
+ import { AttributeApi, AttributeApiV2 } from "./attributes";
6
6
  import { AuthenticationApi, } from "./authentication";
7
7
  import { BaseApi } from "./base-api";
8
8
  import { CompanyInfoApi } from "./company-info";
@@ -39,6 +39,7 @@ applyMixins(NarrativeApi, [
39
39
  DataPlaneApi,
40
40
  RosettaStoneApi,
41
41
  AttributeApi,
42
+ AttributeApiV2,
42
43
  PingApi,
43
44
  CompanyInfoApi,
44
45
  InstallationsApi,
@@ -60,4 +61,4 @@ applyMixins(NarrativeApi, [
60
61
  ]);
61
62
  export {
62
63
  // biome-ignore lint/style/useExportType: We need to export the class
63
- NarrativeApi, AttributeApi, AccessTokensApi, DataPlaneApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, ConnectionsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, MappingsApi, AccessRulesApi, SubscriptionsApi, JobsApi, QueriesApi, WhoAmIApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall, isRosettaRequestMessage, isConversationAssistantMessageWithoutFunctionCall, resources, compileStatement, parseStatement, };
64
+ NarrativeApi, AttributeApi, AttributeApiV2, AccessTokensApi, DataPlaneApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, ConnectionsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, MappingsApi, AccessRulesApi, SubscriptionsApi, JobsApi, QueriesApi, WhoAmIApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall, isRosettaRequestMessage, isConversationAssistantMessageWithoutFunctionCall, resources, compileStatement, parseStatement, };
package/build/types.d.ts CHANGED
@@ -44,4 +44,10 @@ export interface PaginationOptions {
44
44
  page?: number | null;
45
45
  per_page?: number | null;
46
46
  }
47
+ /**
48
+ * Interface for search parameters
49
+ */
50
+ export interface SearchParams {
51
+ q?: string;
52
+ }
47
53
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "2.17.0",
3
+ "version": "2.18.0",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",
@@ -8,8 +8,8 @@
8
8
  "description": "",
9
9
  "scripts": {
10
10
  "build": "tsc",
11
- "lint": "npx @biomejs/biome check --apply ./src",
12
- "prepare": "npx @biomejs/biome check --apply ./src && npm run build",
11
+ "lint": "npx @biomejs/biome check --write ./src",
12
+ "prepare": "npx @biomejs/biome check --write ./src && npm run build",
13
13
  "prepublishOnly": "npm test && npm run lint",
14
14
  "preversion": "npm run lint",
15
15
  "version": "npm run && git add -A src",
@@ -20,16 +20,16 @@
20
20
  "author": "",
21
21
  "license": "ISC",
22
22
  "devDependencies": {
23
- "@babel/core": "7.25.2",
24
- "@babel/preset-env": "7.25.4",
25
- "@babel/preset-typescript": "7.24.7",
26
- "@biomejs/biome": "1.9.1",
23
+ "@babel/core": "7.25.8",
24
+ "@babel/preset-env": "7.25.8",
25
+ "@babel/preset-typescript": "7.25.7",
26
+ "@biomejs/biome": "1.9.3",
27
27
  "@commitlint/cli": "19.5.0",
28
28
  "@commitlint/config-conventional": "19.5.0",
29
29
  "@types/jest": "29.5.13",
30
30
  "babel-jest": "29.7.0",
31
31
  "jest": "29.7.0",
32
- "lefthook": "1.7.15",
32
+ "lefthook": "1.7.18",
33
33
  "ts-jest": "29.2.5"
34
34
  },
35
35
  "dependencies": {
@@ -42,4 +42,4 @@
42
42
  "files": [
43
43
  "build"
44
44
  ]
45
- }
45
+ }