@narrative.io/data-collaboration-sdk-ts 0.0.41 → 0.0.43

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,3 +1,4 @@
1
+ import { type ApiRecords } from '../types';
1
2
  import { BaseApi } from '../base-api';
2
3
  import { type CompanyInfo } from './types';
3
4
  /**
@@ -6,5 +7,10 @@ import { type CompanyInfo } from './types';
6
7
  */
7
8
  declare class CompanyInfoApi extends BaseApi {
8
9
  companyId: () => Promise<number>;
10
+ /**
11
+ * Get a list of all providers in the Data Streams Market
12
+ * @returns {Promise<ApiRecords<CompanyInfo[]>>} - Promise resolving to an array of CompanyInfo records
13
+ */
14
+ getAllProvidersCompanyInfo(): Promise<ApiRecords<CompanyInfo[]>>;
9
15
  }
10
16
  export { type CompanyInfo, CompanyInfoApi };
@@ -14,5 +14,12 @@ class CompanyInfoApi extends BaseApi {
14
14
  companyId = async () => {
15
15
  return (await this.get(`${resourceName}/whoami`)).id;
16
16
  };
17
+ /**
18
+ * Get a list of all providers in the Data Streams Market
19
+ * @returns {Promise<ApiRecords<CompanyInfo[]>>} - Promise resolving to an array of CompanyInfo records
20
+ */
21
+ async getAllProvidersCompanyInfo() {
22
+ return await this.get(`${resourceName}/data-streams-markets`);
23
+ }
17
24
  }
18
25
  export { CompanyInfoApi };
@@ -2,7 +2,7 @@ import { type ApiRecords } from '../types';
2
2
  import { BaseApi } from '../base-api';
3
3
  import { type DataStream } from './types';
4
4
  /**
5
- * @module DataStreramsApi
5
+ * @module DataStreamsApi
6
6
  * @description This module provides methods for interacting with Data Streams.
7
7
  * @extends BaseApi
8
8
  */
@@ -1,7 +1,7 @@
1
1
  import { BaseApi } from '../base-api';
2
2
  const resourceName = 'data-stream';
3
3
  /**
4
- * @module DataStreramsApi
4
+ * @module DataStreamsApi
5
5
  * @description This module provides methods for interacting with Data Streams.
6
6
  * @extends BaseApi
7
7
  */
@@ -1,5 +1,4 @@
1
1
  import { type Dataset } from '../datasets/types';
2
- import { type DataRules } from './data-rules/types';
3
2
  export interface DataStream {
4
3
  id: number;
5
4
  company_id: number;
@@ -47,4 +46,83 @@ export interface AuthRules {
47
46
  export interface CompanyConstraint {
48
47
  type: InclusionType;
49
48
  }
49
+ export interface DataRules {
50
+ column_sets?: ColumnSet[];
51
+ attributes?: AttributeSet[];
52
+ deduplication?: Deduplication;
53
+ frequency_filter?: FrequencyFilter;
54
+ dataset_filter?: DatasetFilter;
55
+ ingestion_timestamp_filter?: TimestampFilter;
56
+ }
57
+ export interface ColumnSet {
58
+ dataset_id: string;
59
+ fields: ColumnWithFilterAndExport[];
60
+ }
61
+ export interface AttributeSet {
62
+ attribute_id: number;
63
+ fields: ColumnWithFilterAndExport[];
64
+ optional: boolean;
65
+ }
66
+ export interface Deduplication {
67
+ period: string;
68
+ column_references?: ColumnReferences[];
69
+ attribute_references?: AttributeReferences[];
70
+ }
71
+ export interface FrequencyFilter {
72
+ column_references?: ColumnReferences[];
73
+ attribute_references?: AttributeReferences[];
74
+ minInclusive?: number;
75
+ maxInclusive?: number;
76
+ }
77
+ export interface AttributeReferences {
78
+ attribute_id: number;
79
+ columnNames: string[];
80
+ }
81
+ export interface ColumnReferences {
82
+ dataset_id: number;
83
+ columnNames: string[];
84
+ }
85
+ export interface DatasetFilter {
86
+ dataset_id: string;
87
+ attribute: AttributeField;
88
+ }
89
+ export interface DatasetFilterEquality extends DatasetFilter {
90
+ parent?: AttributeField;
91
+ inclusion: InclusionType;
92
+ }
93
+ export interface AttributeField {
94
+ attribute_id: string;
95
+ field: string;
96
+ }
97
+ export interface DatasetFilterSpatial extends DatasetFilter {
98
+ predicate: SpatialPredicate;
99
+ }
100
+ export interface ColumnWithFilterAndExport {
101
+ field: string;
102
+ filter?: FilterDefinition;
103
+ exported: boolean;
104
+ }
105
+ export type FilterDefinition = 'include_all_values_including_nulls_filter' | 'include_only_if_not_null_filter' | EnumFilter | IntervalFilter | TimestampFilter | SparkSqlConstraintFilter;
106
+ export interface EnumFilter {
107
+ type: InclusionType;
108
+ list: string[];
109
+ }
110
+ export interface IntervalFilter {
111
+ min?: IntervalEnd;
112
+ max?: IntervalEnd;
113
+ }
114
+ export interface TimestampFilter {
115
+ recency?: string;
116
+ from?: IntervalEnd;
117
+ to?: IntervalEnd;
118
+ }
119
+ export interface SparkSqlConstraintFilter {
120
+ expressions: string[];
121
+ }
122
+ export type IntervalEndType = 'inclusive' | 'exclusive';
123
+ export interface IntervalEnd {
124
+ type: IntervalEndType;
125
+ value: string;
126
+ }
127
+ export type SpatialPredicate = 'contains' | 'intersects';
50
128
  export type InclusionType = 'include' | 'exclude';
package/build/index.d.ts CHANGED
@@ -20,6 +20,6 @@ import { NqlApi, type NqlCompileResult, type NqlQuery, type NqlResult } from './
20
20
  import { DataStreamsApi, type DataStream } from './data-streams';
21
21
  declare class NarrativeApi extends BaseApi {
22
22
  }
23
- interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi {
23
+ interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi {
24
24
  }
25
25
  export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi, type Resource, type UploadsResponse, type PingStatus, type Attribute, type Environment, type Config, type ApiRecords, type Dataset, type HealthCheckResult, type SampleRecords, type DatasetTableSummary, type DatasetTableSummaryAPIResponse, type Product, type MonetaryAmount, type CompanyInfo, type Installation, type FilePerSnapshotResponse, type BucketCreationRequest, type UpdateAccessTypeRequest, type NqlQuery, type NqlResult, type NqlCompileResult, type DataStream };
package/build/index.js CHANGED
@@ -14,5 +14,5 @@ import { NqlApi } from './nql';
14
14
  import { DataStreamsApi } from './data-streams';
15
15
  class NarrativeApi extends BaseApi {
16
16
  }
17
- applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi]);
17
+ applyMixins(NarrativeApi, [BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi]);
18
18
  export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, DataStreamsApi };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "0.0.41",
3
+ "version": "0.0.43",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",