@narrative.io/data-collaboration-sdk-ts 0.0.38 → 0.0.40
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.
- package/build/index.d.ts +2 -2
- package/build/installations/index.js +3 -2
- package/build/nql/index.d.ts +10 -3
- package/build/nql/index.js +12 -2
- package/build/nql/types.d.ts +5 -0
- package/package.json +4 -4
package/build/index.d.ts
CHANGED
|
@@ -16,9 +16,9 @@ import { type PingStatus } from './ping/types';
|
|
|
16
16
|
import { type Product, ProductsApi } from './products';
|
|
17
17
|
import { CompanyInfoApi, type CompanyInfo } from './company-info';
|
|
18
18
|
import { InstallationsApi, type Installation } from './installations';
|
|
19
|
-
import { NqlApi, type NqlQuery, type NqlResult } from './nql';
|
|
19
|
+
import { NqlApi, type NqlCompileResult, type NqlQuery, type NqlResult } from './nql';
|
|
20
20
|
declare class NarrativeApi extends BaseApi {
|
|
21
21
|
}
|
|
22
22
|
interface NarrativeApi extends BaseApi, HealthCheckApi, DatasetApi, RosettaStoneApi, AttributeApi, PingApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi {
|
|
23
23
|
}
|
|
24
|
-
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, 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 };
|
|
24
|
+
export { NarrativeApi, AttributeApi, HealthCheckApi, DatasetApi, PingApi, ProductsApi, CompanyInfoApi, InstallationsApi, UploadsApi, ResourceApi, NqlApi, 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 };
|
|
@@ -12,8 +12,9 @@ class InstallationsApi extends BaseApi {
|
|
|
12
12
|
* @returns {Promise<ApiRecords<Installation>>} - Promise resolving with the list of installations.
|
|
13
13
|
*/
|
|
14
14
|
async getInstallations(appCategory) {
|
|
15
|
-
const appCategoryQuery = `?app_category=${appCategory
|
|
16
|
-
|
|
15
|
+
const appCategoryQuery = appCategory !== undefined ? `?app_category=${appCategory}` : '';
|
|
16
|
+
const url = `${resourceName}${appCategoryQuery}`;
|
|
17
|
+
return await this.get(url);
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
export { InstallationsApi };
|
package/build/nql/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseApi } from '../base-api';
|
|
2
|
-
import {
|
|
2
|
+
import type { NqlCompileResult, NqlQuery, NqlResult } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* A class for accessing the NQL API.
|
|
5
5
|
* @extends BaseApi
|
|
@@ -9,8 +9,15 @@ declare class NqlApi extends BaseApi {
|
|
|
9
9
|
* Executes an NQL query and returns the result.
|
|
10
10
|
*
|
|
11
11
|
* @param {string} nqlQuery - The NQL query to execute.
|
|
12
|
-
* @returns {Promise<
|
|
12
|
+
* @returns {Promise<NqlResult>} A promise that resolves with the result of the NQL query.
|
|
13
13
|
*/
|
|
14
14
|
executeNql(nqlQuery: NqlQuery): Promise<NqlResult>;
|
|
15
|
+
/**
|
|
16
|
+
* Compiles an NQL query and returns the result, including any errors.
|
|
17
|
+
*
|
|
18
|
+
* @param {string} nqlQuery - The NQL query to compile.
|
|
19
|
+
* @returns {Promise<NqlCompileResult>} A promise that resolves with the result of the NQL compilation.
|
|
20
|
+
*/
|
|
21
|
+
compileNql(nqlQuery: NqlQuery): Promise<NqlCompileResult>;
|
|
15
22
|
}
|
|
16
|
-
export { NqlApi, type NqlResult, type NqlQuery };
|
|
23
|
+
export { NqlApi, type NqlResult, type NqlQuery, type NqlCompileResult };
|
package/build/nql/index.js
CHANGED
|
@@ -16,10 +16,20 @@ class NqlApi extends BaseApi {
|
|
|
16
16
|
* Executes an NQL query and returns the result.
|
|
17
17
|
*
|
|
18
18
|
* @param {string} nqlQuery - The NQL query to execute.
|
|
19
|
-
* @returns {Promise<
|
|
19
|
+
* @returns {Promise<NqlResult>} A promise that resolves with the result of the NQL query.
|
|
20
20
|
*/
|
|
21
21
|
async executeNql(nqlQuery) {
|
|
22
|
-
const response = await this.post(resourceName
|
|
22
|
+
const response = await this.post(`${resourceName}/run`, nqlQuery);
|
|
23
|
+
return response;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Compiles an NQL query and returns the result, including any errors.
|
|
27
|
+
*
|
|
28
|
+
* @param {string} nqlQuery - The NQL query to compile.
|
|
29
|
+
* @returns {Promise<NqlCompileResult>} A promise that resolves with the result of the NQL compilation.
|
|
30
|
+
*/
|
|
31
|
+
async compileNql(nqlQuery) {
|
|
32
|
+
const response = await this.post(`${resourceName}/compile`, nqlQuery);
|
|
23
33
|
return response;
|
|
24
34
|
}
|
|
25
35
|
}
|
package/build/nql/types.d.ts
CHANGED
|
@@ -26,6 +26,11 @@ export interface NqlResult {
|
|
|
26
26
|
state: string;
|
|
27
27
|
updated_at: string;
|
|
28
28
|
}
|
|
29
|
+
export type NqlMappingErrors = Record<number, string>;
|
|
30
|
+
export interface NqlCompileResult {
|
|
31
|
+
sql: string;
|
|
32
|
+
mappingErrors?: NqlMappingErrors;
|
|
33
|
+
}
|
|
29
34
|
export interface NqlQuery {
|
|
30
35
|
nql: string;
|
|
31
36
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@narrative.io/data-collaboration-sdk-ts",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"repository": "github:narrative-io/data-collaboration-sdk-ts",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@babel/preset-typescript": "^7.18.6",
|
|
26
26
|
"@commitlint/cli": "^17.4.2",
|
|
27
27
|
"@commitlint/config-conventional": "^17.4.2",
|
|
28
|
-
"@types/jest": "^29.
|
|
28
|
+
"@types/jest": "^29.5.0",
|
|
29
29
|
"@typescript-eslint/eslint-plugin": "^5.51.0",
|
|
30
30
|
"babel-jest": "^29.4.3",
|
|
31
31
|
"eslint": "^8.33.0",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"eslint-plugin-import": "^2.27.5",
|
|
34
34
|
"eslint-plugin-n": "^15.6.1",
|
|
35
35
|
"eslint-plugin-promise": "^6.1.1",
|
|
36
|
+
"husky": "^8.0.0",
|
|
36
37
|
"jest": "^29.4.3",
|
|
37
38
|
"ts-jest": "^29.0.5",
|
|
38
|
-
"typescript": "^5.0.2"
|
|
39
|
-
"husky": "^8.0.0"
|
|
39
|
+
"typescript": "^5.0.2"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"mande": "^2.0.3"
|