@narrative.io/data-collaboration-sdk-ts 0.0.12 → 0.0.14

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.
@@ -0,0 +1,6 @@
1
+ import { type ApiRecords } from '../types';
2
+ import { BaseApi } from '../base-api';
3
+ import { type Attribute } from './types';
4
+ export declare class AttributeApi extends BaseApi {
5
+ getAttributes(): Promise<ApiRecords<Attribute>>;
6
+ }
@@ -0,0 +1,7 @@
1
+ import { BaseApi } from '../base-api';
2
+ const resourceName = 'attributes';
3
+ export class AttributeApi extends BaseApi {
4
+ async getAttributes() {
5
+ return await this.get(resourceName);
6
+ }
7
+ }
@@ -0,0 +1,17 @@
1
+ export interface Attribute {
2
+ id: number;
3
+ name: string;
4
+ description?: string;
5
+ display_name: string;
6
+ type: string;
7
+ enum?: string[] | number[];
8
+ validations?: string[];
9
+ properties?: Record<string, {
10
+ type: string;
11
+ description?: string;
12
+ validations?: string[];
13
+ enum?: string[];
14
+ items?: unknown;
15
+ }>;
16
+ required?: string[];
17
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { type ApiRecords } from '../types';
2
2
  import { BaseApi } from '../base-api';
3
- import { type DatasetTableSummary, type Dataset } from './types';
3
+ import { type Dataset, type DatasetTableSummaryAPIResponse } from './types';
4
4
  /**
5
5
  * @module DatasetApi
6
6
  * @description This module provides methods for fetching datasets.
@@ -25,7 +25,7 @@ export declare class DatasetApi extends BaseApi {
25
25
  * @param {boolean} [allRecords=false] - If `true`, all records in the dataset will be returned. If `false`, only a limited number of records will be returned.
26
26
  * @param {number} [perPage=100] - The number of records to return per page.
27
27
  * @param {number} [offset=0] - The offset to start returning records from.
28
- * @returns {Promise<ApiRecords<DatasetTableSummary>>} A promise that resolves with the dataset summary information.
28
+ * @returns {Promise<DatasetTableSummaryAPIResponse>} A promise that resolves with the dataset summary information.
29
29
  */
30
- getDatasetSummary(datasetId: number, allRecords?: boolean, perPage?: number, offset?: number): Promise<ApiRecords<DatasetTableSummary>>;
30
+ getDatasetSummary(datasetId: number, allRecords?: boolean, perPage?: number, offset?: number): Promise<DatasetTableSummaryAPIResponse>;
31
31
  }
@@ -28,7 +28,7 @@ export class DatasetApi extends BaseApi {
28
28
  * @param {boolean} [allRecords=false] - If `true`, all records in the dataset will be returned. If `false`, only a limited number of records will be returned.
29
29
  * @param {number} [perPage=100] - The number of records to return per page.
30
30
  * @param {number} [offset=0] - The offset to start returning records from.
31
- * @returns {Promise<ApiRecords<DatasetTableSummary>>} A promise that resolves with the dataset summary information.
31
+ * @returns {Promise<DatasetTableSummaryAPIResponse>} A promise that resolves with the dataset summary information.
32
32
  */
33
33
  async getDatasetSummary(datasetId, allRecords = false, perPage = 100, offset = 0) {
34
34
  return await this.get(`${resourceName}/${datasetId}/stats?all_records=${String(allRecords)}&per_page=${perPage}&offset=${offset}`);
@@ -40,6 +40,10 @@ export interface DatasetTableSummary {
40
40
  snapshot_removed_bytes: number;
41
41
  column_sumary: DatasetColumnSummary[];
42
42
  }
43
+ export interface DatasetTableSummaryAPIResponse {
44
+ dataset_id: number;
45
+ records: DatasetTableSummary[];
46
+ }
43
47
  type SchemaFileConfigType = 'flat';
44
48
  type SchemaPropertiesType = 'string' | 'number' | 'boolean';
45
49
  type DatasetStatus = 'active' | 'archived';
package/build/index.d.ts CHANGED
@@ -3,11 +3,12 @@ import { DatasetApi } from './datasets';
3
3
  import { HealthCheckApi } from './health';
4
4
  import { RosettaStoneApi } from './rosetta-stone';
5
5
  import { type Environment, type Config, type ApiRecords } from './types';
6
- import { type Dataset, type DatasetTableSummary } from './datasets/types';
6
+ import { type DatasetTableSummaryAPIResponse, type Dataset, type DatasetTableSummary } from './datasets/types';
7
7
  import { type HealthCheckResult } from './health/types';
8
8
  import { type SampleRecords } from './rosetta-stone/types';
9
+ import { AttributeApi } from './attributes';
9
10
  declare class NarrativeApi extends BaseApi {
10
11
  }
11
- interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi {
12
+ interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi {
12
13
  }
13
- export { NarrativeApi, type Environment, type Config, type ApiRecords, type Dataset, type HealthCheckResult, type SampleRecords, type DatasetTableSummary };
14
+ export { NarrativeApi, AttributeApi, type Environment, type Config, type ApiRecords, type Dataset, type HealthCheckResult, type SampleRecords, type DatasetTableSummary, type DatasetTableSummaryAPIResponse };
package/build/index.js CHANGED
@@ -3,7 +3,8 @@ import { DatasetApi } from './datasets';
3
3
  import { HealthCheckApi } from './health';
4
4
  import { RosettaStoneApi } from './rosetta-stone';
5
5
  import { applyMixins } from './utils';
6
+ import { AttributeApi } from './attributes';
6
7
  class NarrativeApi extends BaseApi {
7
8
  }
8
- applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi]);
9
- export { NarrativeApi };
9
+ applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi]);
10
+ export { NarrativeApi, AttributeApi };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "0.0.12",
3
+ "version": "0.0.14",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",