@narrative.io/data-collaboration-sdk-ts 0.0.45 → 0.0.47
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.
|
@@ -12,7 +12,7 @@ declare class ForecastApi extends BaseApi {
|
|
|
12
12
|
* @description Gets a forecast for a subscription given the subscription details
|
|
13
13
|
* @returns {Promise<ApiRecords<ForcastResponse>>} A promise that resolves to forecast response.
|
|
14
14
|
*/
|
|
15
|
-
postForecast(): Promise<ForecastResponse>;
|
|
15
|
+
postForecast(payload: ForecastRequest): Promise<ForecastResponse>;
|
|
16
16
|
/**
|
|
17
17
|
* @function getForecast
|
|
18
18
|
* @memberof ForecastApi
|
|
@@ -26,7 +26,7 @@ declare class ForecastApi extends BaseApi {
|
|
|
26
26
|
* @description Gets a cost forecast for a subscription given the subscriptions details
|
|
27
27
|
* @returns {Promise<CostForcastResponse>} A promise that resolves to cost forecast response.
|
|
28
28
|
*/
|
|
29
|
-
postCostForecast(): Promise<CostForecastResponse>;
|
|
29
|
+
postCostForecast(payload: CostForecastRequest): Promise<CostForecastResponse>;
|
|
30
30
|
/**
|
|
31
31
|
* @function getCostForecast
|
|
32
32
|
* @memberof ForecastApi
|
|
@@ -40,7 +40,7 @@ declare class ForecastApi extends BaseApi {
|
|
|
40
40
|
* @description Gets a forecast for a subscription given the subscriptions details from the public endpoint
|
|
41
41
|
* @returns {Promise<ForcastResponse>} A promise that resolves to forecast response.
|
|
42
42
|
*/
|
|
43
|
-
postPublicForecast(): Promise<ForecastResponse>;
|
|
43
|
+
postPublicForecast(payload: ForecastRequest): Promise<ForecastResponse>;
|
|
44
44
|
/**
|
|
45
45
|
* @function getPublicForecast
|
|
46
46
|
* @memberof ForecastApi
|
package/build/forecast/index.js
CHANGED
|
@@ -12,8 +12,8 @@ class ForecastApi extends BaseApi {
|
|
|
12
12
|
* @description Gets a forecast for a subscription given the subscription details
|
|
13
13
|
* @returns {Promise<ApiRecords<ForcastResponse>>} A promise that resolves to forecast response.
|
|
14
14
|
*/
|
|
15
|
-
async postForecast() {
|
|
16
|
-
return await this.post(`${resourceName}/forecasts
|
|
15
|
+
async postForecast(payload) {
|
|
16
|
+
return await this.post(`${resourceName}/forecasts`, payload);
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* @function getForecast
|
|
@@ -30,8 +30,8 @@ class ForecastApi extends BaseApi {
|
|
|
30
30
|
* @description Gets a cost forecast for a subscription given the subscriptions details
|
|
31
31
|
* @returns {Promise<CostForcastResponse>} A promise that resolves to cost forecast response.
|
|
32
32
|
*/
|
|
33
|
-
async postCostForecast() {
|
|
34
|
-
return await this.post(`${resourceName}/cost-forecasts
|
|
33
|
+
async postCostForecast(payload) {
|
|
34
|
+
return await this.post(`${resourceName}/cost-forecasts`, payload);
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* @function getCostForecast
|
|
@@ -48,8 +48,8 @@ class ForecastApi extends BaseApi {
|
|
|
48
48
|
* @description Gets a forecast for a subscription given the subscriptions details from the public endpoint
|
|
49
49
|
* @returns {Promise<ForcastResponse>} A promise that resolves to forecast response.
|
|
50
50
|
*/
|
|
51
|
-
async postPublicForecast() {
|
|
52
|
-
return await this.post(`${resourceName}/public/forecasts
|
|
51
|
+
async postPublicForecast(payload) {
|
|
52
|
+
return await this.post(`${resourceName}/public/forecasts`, payload);
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
55
|
* @function getPublicForecast
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { type DataRules } from '../data-streams/types';
|
|
2
|
+
export interface CostForecastRequest {
|
|
3
|
+
asOf?: Date;
|
|
4
|
+
details: ForecastDetails;
|
|
5
|
+
}
|
|
6
|
+
export interface ForecastRequest extends CostForecastRequest {
|
|
7
|
+
fingerprint?: string;
|
|
8
|
+
skipCache?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type ForecastType = 'marketplace' | 'data_stream';
|
|
11
|
+
export interface ForecastDetails {
|
|
12
|
+
type: ForecastType;
|
|
13
|
+
}
|
|
14
|
+
export interface MarketplaceForecastDetails extends ForecastDetails {
|
|
15
|
+
type: 'marketplace';
|
|
16
|
+
company_constraint?: CompanyConstraint;
|
|
17
|
+
dataset_constraint?: DatasetConstraint;
|
|
18
|
+
data_rules: DataRules;
|
|
19
|
+
pricing: ForecastPricing;
|
|
20
|
+
}
|
|
21
|
+
export interface DataStreamPurchaseDetails {
|
|
22
|
+
type: 'data_stream';
|
|
23
|
+
data_stream_id: number;
|
|
24
|
+
offer_id: number;
|
|
25
|
+
data_shop_id?: number;
|
|
26
|
+
}
|
|
27
|
+
export type CompanyConstraintType = 'inclusion' | 'exclusion';
|
|
28
|
+
export interface CompanyConstraint {
|
|
29
|
+
type: CompanyConstraintType;
|
|
30
|
+
company_ids: number[];
|
|
31
|
+
}
|
|
32
|
+
export type DatasetConstraintType = 'inclusion' | 'exclusion' | 'all';
|
|
33
|
+
export interface DatasetConstraint {
|
|
34
|
+
type: DatasetConstraintType;
|
|
35
|
+
dataset_ids: number[];
|
|
36
|
+
}
|
|
37
|
+
export interface ForecastPricing {
|
|
38
|
+
micro_cents_usd: number;
|
|
39
|
+
}
|
|
40
|
+
export interface ForecastGenericResponse {
|
|
41
|
+
id: string;
|
|
42
|
+
companyId: number;
|
|
43
|
+
completedAt?: Date;
|
|
44
|
+
createdAt: Date;
|
|
45
|
+
failures: JobFailure[];
|
|
46
|
+
idempotencyKey: string;
|
|
47
|
+
input: ForecastInput;
|
|
48
|
+
requestSource: RequestSource;
|
|
49
|
+
state: JobState;
|
|
50
|
+
updatedAt: Date;
|
|
51
|
+
}
|
|
52
|
+
export interface ForecastResponse extends ForecastGenericResponse {
|
|
53
|
+
result?: ForecastResult;
|
|
54
|
+
}
|
|
55
|
+
export interface CostForecastResponse extends ForecastGenericResponse {
|
|
56
|
+
result?: CostForecastResult;
|
|
57
|
+
}
|
|
58
|
+
export interface CostForecastInput {
|
|
59
|
+
details: ForecastDetails;
|
|
60
|
+
}
|
|
61
|
+
export interface ForecastInput {
|
|
62
|
+
asOf?: Date;
|
|
63
|
+
dimensions: ForecastDimensions;
|
|
64
|
+
fingerprint?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface RequestSource {
|
|
67
|
+
company_id: number;
|
|
68
|
+
type: string;
|
|
69
|
+
user_id: number;
|
|
70
|
+
}
|
|
71
|
+
export interface ForecastDimensions {
|
|
72
|
+
distinctCounts: string[];
|
|
73
|
+
groupBy?: string;
|
|
74
|
+
}
|
|
75
|
+
export type JobState = 'pending' | 'running' | 'completed' | 'cancelled' | 'failed';
|
|
76
|
+
export interface ForecastResult {
|
|
77
|
+
cost: number;
|
|
78
|
+
datasets: DatasetForecastResponse[];
|
|
79
|
+
rows: number;
|
|
80
|
+
scanCost: ScanCostEstimate;
|
|
81
|
+
}
|
|
82
|
+
export interface CostForecastResult {
|
|
83
|
+
cost: ScanCostEstimate;
|
|
84
|
+
}
|
|
85
|
+
export interface DatasetForecastResponse {
|
|
86
|
+
companyId: number;
|
|
87
|
+
datasetId: number;
|
|
88
|
+
group?: string;
|
|
89
|
+
cost: number;
|
|
90
|
+
rows: number;
|
|
91
|
+
}
|
|
92
|
+
export interface ScanCostEstimate {
|
|
93
|
+
rows: number;
|
|
94
|
+
size: number;
|
|
95
|
+
sources: DataSourceCost[];
|
|
96
|
+
}
|
|
97
|
+
export interface DataSourceCost {
|
|
98
|
+
source: string | number;
|
|
99
|
+
rows: number;
|
|
100
|
+
size: number;
|
|
101
|
+
}
|
|
102
|
+
export interface JobFailure {
|
|
103
|
+
message: string;
|
|
104
|
+
timestamp: Date;
|
|
105
|
+
value: string;
|
|
106
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|