@narrative.io/data-collaboration-sdk-ts 0.7.0 → 0.9.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,6 +1,37 @@
1
- import type { ApiRecords } from "../types";
1
+ import type { ApiRecords, ApiRecordsV2 } from "../types";
2
2
  import { BaseApi } from "../base-api";
3
- import type { AccessRule } from "./types";
3
+ import type { AccessRule, AccessRuleV2 } from "./types";
4
+ /**
5
+ * Represents the parameters used to retrieve access rules.
6
+ * This interface extends a generic record allowing for string, number, boolean, or undefined values.
7
+ *
8
+ * @interface GetAccessRulesParameters
9
+ * @extends {Record<string, string | number | boolean | undefined>}
10
+ *
11
+ * @property {boolean} [owned_only] - Optional filter to retrieve only the access rules owned by the user.
12
+ * Setting this to true will fetch only the access rules that are owned.
13
+ *
14
+ * @property {boolean} [shared_only] - Optional filter to retrieve only the access rules shared with the user.
15
+ * Setting this to true will fetch only the access rules that are shared.
16
+ *
17
+ * @property {string} [tag] - Optional filter to retrieve access rules that are tagged with a specific tag.
18
+ * Provide the tag string to fetch access rules associated with it.
19
+ *
20
+ * @property {number} [company_id] - Optional filter to retrieve access rules associated with a specific company.
21
+ * Provide the company ID to fetch access rules related to that company.
22
+ *
23
+ * @property {number} [offset] - Optional pagination parameter that specifies the starting point for the list of results.
24
+ * Provide an offset number to skip a specific number of records in the result set.
25
+ *
26
+ * @property {number} [per_page] - Optional pagination parameter that specifies the number of records to return per page.
27
+ * Provide a number to set the maximum number of records returned in one page of results.
28
+ */
29
+ interface GetAccessRulesParameters extends Record<string, string | number | boolean | undefined> {
30
+ owned_only?: boolean;
31
+ shared_only?: boolean;
32
+ tag?: string;
33
+ company_id?: number;
34
+ }
4
35
  /**
5
36
  * @module AccessRulesApi
6
37
  * @description This module provides methods for working with access rules.
@@ -12,6 +43,7 @@ declare class AccessRulesApi extends BaseApi {
12
43
  *
13
44
  * @returns {Promise<ApiRecords<AccessRule>>} A promise that resolves to an object containing access rules.
14
45
  * @example
46
+ * @deprecated This method is deprecated. Use getAccessableAccessRules() instead.
15
47
  * const api = new AccessRulesApi();
16
48
  * api.getAccessRules().then(rules => {
17
49
  * console.log(rules);
@@ -40,5 +72,39 @@ declare class AccessRulesApi extends BaseApi {
40
72
  * @returns {Promise<AccessRule>} A promise that resolves to the updated access rule.
41
73
  */
42
74
  updateAccessRule(id: number, rule: Partial<Omit<AccessRule, "id" | "created_at" | "updated_at" | "dataset_id">>): Promise<AccessRule>;
75
+ /**
76
+ * Retrieves a specific access rule by its ID.
77
+ *
78
+ * @public
79
+ * @async
80
+ * @param {number} id - The unique identifier of the access rule to retrieve.
81
+ * @returns {Promise<AccessRuleV2>} A promise that resolves to an AccessRuleV2 object.
82
+ * @description This method fetches a single access rule based on the provided ID. It returns a promise
83
+ * that resolves to the detailed information of the access rule.
84
+ */
85
+ getAccessRule(id: number): Promise<AccessRuleV2>;
86
+ /**
87
+ * Retrieves a specific access rule by the company slug and access rule name.
88
+ *
89
+ * @public
90
+ * @async
91
+ * @param {string} companySlug - The slug of the company that owns the access rule.
92
+ * @param {string} accessRuleName - The name of the access rule to retrieve.
93
+ * @returns {Promise<AccessRuleV2>} A promise that resolves to an AccessRuleV2 object.
94
+ * @description This method fetches a single access rule based on the company slug and the access rule's name.
95
+ * It's particularly useful when access rule IDs are not known or used.
96
+ */
97
+ getAccessRuleByName(companySlug: string, accessRuleName: string): Promise<AccessRuleV2>;
98
+ /**
99
+ * Retrieves a list of access rules that a user has access to, based on the provided parameters.
100
+ *
101
+ * @public
102
+ * @async
103
+ * @param {GetAccessRulesParameters} parameters - Parameters to filter and paginate the list of access rules.
104
+ * @returns {Promise<ApiRecords<AccessRuleV2>>} A promise that resolves to a collection of AccessRuleV2 objects.
105
+ * @description This method fetches access rules based on the specified filters and pagination options provided in the parameters.
106
+ * It returns a promise that resolves to a list of access rules that match the criteria.
107
+ */
108
+ getAccessableAccessRules(parameters: GetAccessRulesParameters): Promise<ApiRecordsV2<AccessRuleV2>>;
43
109
  }
44
- export { AccessRulesApi, type AccessRule };
110
+ export { AccessRulesApi, type AccessRule, type AccessRuleV2, type GetAccessRulesParameters, };
@@ -11,6 +11,7 @@ class AccessRulesApi extends BaseApi {
11
11
  *
12
12
  * @returns {Promise<ApiRecords<AccessRule>>} A promise that resolves to an object containing access rules.
13
13
  * @example
14
+ * @deprecated This method is deprecated. Use getAccessableAccessRules() instead.
14
15
  * const api = new AccessRulesApi();
15
16
  * api.getAccessRules().then(rules => {
16
17
  * console.log(rules);
@@ -50,5 +51,45 @@ class AccessRulesApi extends BaseApi {
50
51
  async updateAccessRule(id, rule) {
51
52
  return await this.put(`${resourceName}/${id}`, rule);
52
53
  }
54
+ /**
55
+ * Retrieves a specific access rule by its ID.
56
+ *
57
+ * @public
58
+ * @async
59
+ * @param {number} id - The unique identifier of the access rule to retrieve.
60
+ * @returns {Promise<AccessRuleV2>} A promise that resolves to an AccessRuleV2 object.
61
+ * @description This method fetches a single access rule based on the provided ID. It returns a promise
62
+ * that resolves to the detailed information of the access rule.
63
+ */
64
+ async getAccessRule(id) {
65
+ return await this.get(`v2/${resourceName}/${id}`);
66
+ }
67
+ /**
68
+ * Retrieves a specific access rule by the company slug and access rule name.
69
+ *
70
+ * @public
71
+ * @async
72
+ * @param {string} companySlug - The slug of the company that owns the access rule.
73
+ * @param {string} accessRuleName - The name of the access rule to retrieve.
74
+ * @returns {Promise<AccessRuleV2>} A promise that resolves to an AccessRuleV2 object.
75
+ * @description This method fetches a single access rule based on the company slug and the access rule's name.
76
+ * It's particularly useful when access rule IDs are not known or used.
77
+ */
78
+ async getAccessRuleByName(companySlug, accessRuleName) {
79
+ return await this.get(`v2/${resourceName}/${companySlug}/${accessRuleName}`);
80
+ }
81
+ /**
82
+ * Retrieves a list of access rules that a user has access to, based on the provided parameters.
83
+ *
84
+ * @public
85
+ * @async
86
+ * @param {GetAccessRulesParameters} parameters - Parameters to filter and paginate the list of access rules.
87
+ * @returns {Promise<ApiRecords<AccessRuleV2>>} A promise that resolves to a collection of AccessRuleV2 objects.
88
+ * @description This method fetches access rules based on the specified filters and pagination options provided in the parameters.
89
+ * It returns a promise that resolves to a list of access rules that match the criteria.
90
+ */
91
+ async getAccessableAccessRules(parameters) {
92
+ return await this.get(`v2/${resourceName}`, parameters);
93
+ }
53
94
  }
54
- export { AccessRulesApi };
95
+ export { AccessRulesApi, };
@@ -26,4 +26,53 @@ interface AccessRuleCompanyConstraint {
26
26
  type AccessRuleConstraints = string[];
27
27
  type AccessRuleDescription = string;
28
28
  type AccessRulePricing = number;
29
+ interface AccessRuleMetadata {
30
+ created_at: string;
31
+ updated_at: string;
32
+ }
33
+ type AccessRuleCollaboratorsType = "inclusion" | "exclusion";
34
+ interface AccessRuleCollaborators {
35
+ type: AccessRuleCollaboratorsType;
36
+ company_ids: number[];
37
+ }
38
+ interface AccessRuleSchema {
39
+ type: string;
40
+ properties: Record<string, any>;
41
+ required?: string[];
42
+ }
43
+ type AccessRuleStatus = "active" | "archived";
44
+ interface SharedAccessRule {
45
+ name?: string;
46
+ id: number;
47
+ company_id: number;
48
+ company_name: string;
49
+ company_slug?: string;
50
+ display_name?: string;
51
+ description?: string;
52
+ image?: string;
53
+ tags?: string[];
54
+ schema: AccessRuleSchema;
55
+ price_cpm_usd: number;
56
+ metadata: AccessRuleMetadata;
57
+ type: "shared";
58
+ }
59
+ interface OwnedAccessRule {
60
+ name?: string;
61
+ id: number;
62
+ company_id: number;
63
+ company_name: string;
64
+ company_slug?: string;
65
+ display_name?: string;
66
+ description?: string;
67
+ image?: string;
68
+ status: AccessRuleStatus;
69
+ tags?: string[];
70
+ nql?: string;
71
+ schema: AccessRuleSchema;
72
+ collaborators: AccessRuleCollaborators;
73
+ price_cpm_usd: number;
74
+ metadata: AccessRuleMetadata;
75
+ type: "owned";
76
+ }
77
+ export type AccessRuleV2 = OwnedAccessRule | SharedAccessRule;
29
78
  export {};
@@ -1,5 +1,5 @@
1
1
  import { type MandeInstance } from "mande";
2
- import { type Config } from "./types";
2
+ import { type PaginationOptions, type Config } from "./types";
3
3
  /**
4
4
  * BaseApi class provides basic functionality for making API requests.
5
5
  */
@@ -46,7 +46,7 @@ export declare abstract class BaseApi {
46
46
  * @returns {Promise<T>} - Promise that resolves with the response data.
47
47
  * @template T - Type of the response data.
48
48
  */
49
- protected get<T>(endpoint: string): Promise<T>;
49
+ protected get<T>(endpoint: string, params?: Record<string, any> & PaginationOptions): Promise<T>;
50
50
  /**
51
51
  * Makes a POST request to the given endpoint with the given data.
52
52
  *
@@ -87,5 +87,5 @@ export declare abstract class BaseApi {
87
87
  * @private
88
88
  */
89
89
  private constructHeaders;
90
- constructQueryString<T extends Record<string, number | string | boolean | undefined>>(parameters?: T): string;
90
+ protected constructQueryString<T extends Record<string, any>>(parameters?: T): string;
91
91
  }
package/build/base-api.js CHANGED
@@ -70,13 +70,15 @@ export class BaseApi {
70
70
  * @returns {Promise<T>} - Promise that resolves with the response data.
71
71
  * @template T - Type of the response data.
72
72
  */
73
- async get(endpoint) {
73
+ async get(endpoint, params) {
74
+ const queryString = this.constructQueryString(params);
75
+ const url = `${endpoint}${queryString}`;
74
76
  if (this.verbose) {
75
- console.log(`Making GET request to ${endpoint}...`);
76
- const resp = await this.base_api.get(endpoint);
77
+ console.log(`Making GET request to ${url}...`);
78
+ const resp = await this.base_api.get(url);
77
79
  console.log(`Response: ${JSON.stringify(resp)}`);
78
80
  }
79
- return await this.base_api.get(endpoint);
81
+ return await this.base_api.get(url);
80
82
  }
81
83
  /**
82
84
  * Makes a POST request to the given endpoint with the given data.
@@ -153,16 +155,13 @@ export class BaseApi {
153
155
  }
154
156
  constructQueryString(parameters) {
155
157
  const queryParameters = [];
156
- if (parameters !== undefined) {
157
- Object.keys(parameters)
158
- .filter((key) => key in parameters)
159
- .forEach((key) => queryParameters.push({ [key]: String(parameters[key]) }));
158
+ if (parameters != null) {
159
+ for (const [key, value] of Object.entries(parameters)) {
160
+ if (value !== undefined && value !== null) {
161
+ queryParameters.push(`${encodeURIComponent(key)}=${encodeURIComponent(String(value))}`);
162
+ }
163
+ }
160
164
  }
161
- const queryString = queryParameters.length > 0
162
- ? queryParameters
163
- .map((param) => Object.entries(param).map(([key, value]) => `${key}=${value}`))
164
- .join("&")
165
- : "";
166
- return queryString.length > 0 ? `?${queryString}` : "";
165
+ return queryParameters.length > 0 ? `?${queryParameters.join("&")}` : "";
167
166
  }
168
167
  }
@@ -9,7 +9,7 @@ export interface Dataset {
9
9
  retention_policy: RetentionPolicy;
10
10
  schema: Schema;
11
11
  status: DatasetStatus;
12
- tags: string[];
12
+ tags?: string[];
13
13
  updated_at: string;
14
14
  write_mode: DatasetWriteMode;
15
15
  last_snapshot_created_at?: string;
package/build/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import { BaseApi } from "./base-api";
2
2
  import { DatasetApi } from "./datasets";
3
3
  import { HealthCheckApi } from "./health";
4
4
  import { RosettaStoneApi } from "./rosetta-stone";
5
- import { type Environment, type Config, type ApiRecords, type MonetaryAmount } from "./types";
5
+ import { type Environment, type Config, type ApiRecords, type ApiRecordsV2, type MonetaryAmount } from "./types";
6
6
  import type { DatasetTableSummaryAPIResponse, Dataset, DatasetTableSummary, FilePerSnapshotResponse, RetentionPolicy, UpdateDatasetRequest, SchemaFileConfigType, SchemaPropertiesType, DatasetStatus, DatasetWriteMode, SchemaFileConfig, SchemaProperties, SchemaProperty, SchemaPrimitiveProperty, SchemaObjectProperty, SchemaArrayProperty, SchemaArrayItems, SchemaArrayItemsPrimitive, SchemaArrayItemsObject, SchemaArrayItemsArray, Schema, AdvancedStatisticsMetadata, SnapshotRange, Configuration, Columns, ColumnSummary, ColumnStatistics, BasicStatistics, AdvancedStatistics, Histogram, Value, CreateDatasetRequest, IngestDatasetFileRequest } from "./datasets/types";
7
7
  import { type User } from "./whoami/types";
8
8
  import { type HealthCheckResult } from "./health/types";
@@ -29,7 +29,7 @@ import type { ForecastBody } from "./nql/types";
29
29
  import { type ConversationMessageRole, isConversationMessageRole, type ConversationMessageName, isConversationMessageName, type ConversationUserMessage, isConversationUserMessage, type ConversationAssistantMessage, isConversationAssistantMessage, type ConversationSystemMessage, isConversationSystemMessage, type ConversationFunctionMessage, isConversationFunctionMessage, type ConversationMessage, isConversationMessage, type ConversationIOMessage, isConversationInputMessage, type ConversationMessages, isConversationMessages, isType, type RosettaRequestMessage, isRosettaRequestMessage, type ConversationMessageFunctionCall, isConversationMessageFunctionCall, type ConversationAssistantMessageWithFunctionCall, isConversationAssistantMessageWithFunctionCall, type RosettaResponseMessage, type ConversationAssistantMessageWithoutFunctionCall, isConversationAssistantMessageWithoutFunctionCall } from "./rosetta/types";
30
30
  import { MappingsApi, type Mapping, type MappingTestResult } from "./mappings";
31
31
  import type { ValueMapping, ObjectMapping, CreateMapping } from "./mappings/types";
32
- import { type AccessRule, AccessRulesApi } from "./access-rules/";
32
+ import { type AccessRule, AccessRulesApi, type GetAccessRulesParameters, type AccessRuleV2 } from "./access-rules/";
33
33
  import { type Subscription, type SubscriptionDetails, type DataStreamSubscriptionDetails, type MarketplaceSubscriptionDetails, type SubscriptionOutput, type SubscriptionType, type SubscriptionStatus, type SubscriptionBudget, SubscriptionsApi } from "./subscriptions";
34
34
  import { type Job, type GetJobsParameters, JobsApi } from "./jobs";
35
35
  import { WhoAmIApi } from "./whoami";
@@ -38,4 +38,4 @@ declare class NarrativeApi extends BaseApi {
38
38
  }
39
39
  interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, ConnectionsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, MappingsApi, AccessRulesApi, AppsApi, SubscriptionsApi, JobsApi, WhoAmIApi {
40
40
  }
41
- export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, ConnectionsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, MappingsApi, AccessRulesApi, SubscriptionsApi, JobsApi, WhoAmIApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall, isRosettaRequestMessage, isConversationAssistantMessageWithoutFunctionCall, type App, type Resource, 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 Dataset, type HealthCheckResult, type SampleRecords, 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 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 ConversationAssistantMessage, type ConversationFunctionMessage, type ConversationIOMessage, type ConversationMessage, type ConversationMessageName, type ConversationMessageRole, 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 User, type Mapping, type MappingTestResult, type ValueMapping, type ObjectMapping, type CreateMapping, compileStatement, parseStatement, };
41
+ export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, ConnectionsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, ForecastApi, ContractsApi, AuthenticationApi, AppsApi, MappingsApi, AccessRulesApi, SubscriptionsApi, JobsApi, WhoAmIApi, getNqlObject, buildNql, convertNqlObjectToForecastBody, isConversationAssistantMessage, isConversationFunctionMessage, isConversationInputMessage, isConversationMessage, isConversationMessageName, isConversationMessageRole, isConversationMessages, isConversationSystemMessage, isConversationUserMessage, isType, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall, isRosettaRequestMessage, isConversationAssistantMessageWithoutFunctionCall, 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 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 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 ConversationAssistantMessage, type ConversationFunctionMessage, type ConversationIOMessage, type ConversationMessage, type ConversationMessageName, type ConversationMessageRole, 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 User, type Mapping, type MappingTestResult, type ValueMapping, type ObjectMapping, type CreateMapping, compileStatement, parseStatement, };
package/build/index.js CHANGED
@@ -20,7 +20,7 @@ import { AuthenticationApi, } from "./authentication";
20
20
  import { AppsApi } from "./apps";
21
21
  import { isConversationMessageRole, isConversationMessageName, isConversationUserMessage, isConversationAssistantMessage, isConversationSystemMessage, isConversationFunctionMessage, isConversationMessage, isConversationInputMessage, isConversationMessages, isType, isRosettaRequestMessage, isConversationMessageFunctionCall, isConversationAssistantMessageWithFunctionCall, isConversationAssistantMessageWithoutFunctionCall, } from "./rosetta/types";
22
22
  import { MappingsApi } from "./mappings";
23
- import { AccessRulesApi } from "./access-rules/";
23
+ import { AccessRulesApi, } from "./access-rules/";
24
24
  import { SubscriptionsApi, } from "./subscriptions";
25
25
  import { JobsApi } from "./jobs";
26
26
  import { WhoAmIApi } from "./whoami";
package/build/types.d.ts CHANGED
@@ -17,6 +17,9 @@ export interface Config {
17
17
  headers?: Record<string, string>;
18
18
  verbose?: boolean;
19
19
  }
20
+ export interface ApiRecordsV2<T> extends PaginationMetadata {
21
+ records: T[];
22
+ }
20
23
  export interface ApiRecords<T> {
21
24
  records: T[];
22
25
  }
@@ -30,4 +33,15 @@ export interface MonetaryAmount {
30
33
  microCentsUsd: number;
31
34
  }
32
35
  type CurrencyCode = "USD";
36
+ export interface PaginationMetadata {
37
+ prev_page: number | null;
38
+ current_page: number;
39
+ next_page: number | null;
40
+ total_records: number;
41
+ total_pages: number;
42
+ }
43
+ export interface PaginationOptions {
44
+ page?: number | null;
45
+ per_page?: number | null;
46
+ }
33
47
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "0.7.0",
3
+ "version": "0.9.0",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",