@narrative.io/data-collaboration-sdk-ts 1.1.0 → 2.0.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.
package/build/nql/NqlBuilder.js
CHANGED
|
@@ -144,7 +144,7 @@ export function compileOutput(n) {
|
|
|
144
144
|
case "dataset_column_ref":
|
|
145
145
|
return compileDatasetColumnRef(n.datasetId, n.column, n.as, false);
|
|
146
146
|
case "lit":
|
|
147
|
-
return compileLit(n.value, n.value_type, n.as);
|
|
147
|
+
return compileLit(n.value, n.value_type, n.as, false);
|
|
148
148
|
case "raw_ref":
|
|
149
149
|
return compileRawRef(n.nql, n.as);
|
|
150
150
|
case "nql":
|
|
@@ -281,7 +281,7 @@ function compileLike(value, pattern, negated, as) {
|
|
|
281
281
|
const op = !negated ? "LIKE" : "NOT LIKE";
|
|
282
282
|
return aliased(`${compileExpression(value)} ${op} ${str(pattern)}`, as);
|
|
283
283
|
}
|
|
284
|
-
function compileLit(value, valueType, as) {
|
|
284
|
+
function compileLit(value, valueType, as, aliasParens) {
|
|
285
285
|
let valueNql;
|
|
286
286
|
if (value !== null) {
|
|
287
287
|
switch (valueType.type) {
|
|
@@ -313,7 +313,7 @@ function compileLit(value, valueType, as) {
|
|
|
313
313
|
else {
|
|
314
314
|
valueNql = "NULL";
|
|
315
315
|
}
|
|
316
|
-
return aliased(valueNql, as);
|
|
316
|
+
return aliased(valueNql, as, aliasParens);
|
|
317
317
|
}
|
|
318
318
|
function compileNot(operand, as) {
|
|
319
319
|
return aliased(`NOT ${compileExpression(operand)}`, as);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type { Dataset } from "src/datasets";
|
|
1
2
|
import type { Mapping } from "src/mappings/types";
|
|
2
3
|
import { BaseApi } from "../base-api";
|
|
3
4
|
import type { RosettaStoneResponse, SampleRecord, SampleRecords } from "./types";
|
|
4
5
|
declare class RosettaStoneApi extends BaseApi {
|
|
5
|
-
getLabelsFromSample(sample: SampleRecords): Promise<RosettaStoneResponse[]>;
|
|
6
6
|
/**
|
|
7
7
|
* Fetches suggested mappings generated from sample records.
|
|
8
8
|
*
|
|
@@ -10,6 +10,6 @@ declare class RosettaStoneApi extends BaseApi {
|
|
|
10
10
|
* @returns {Promise<Mapping[]>} - A promise that resolves to the created mapping.
|
|
11
11
|
* @experimental
|
|
12
12
|
*/
|
|
13
|
-
getMappingRecommendationsFromSample(
|
|
13
|
+
getMappingRecommendationsFromSample(dataset: Partial<Dataset>, sample: SampleRecords): Promise<Mapping[]>;
|
|
14
14
|
}
|
|
15
15
|
export { RosettaStoneApi, type SampleRecords, type RosettaStoneResponse, type SampleRecord, };
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { BaseApi } from "../base-api";
|
|
2
|
-
const resourceName = "rosetta-stone";
|
|
3
2
|
class RosettaStoneApi extends BaseApi {
|
|
4
|
-
async getLabelsFromSample(sample) {
|
|
5
|
-
return await this.post(`${resourceName}/labels/sample`, sample);
|
|
6
|
-
}
|
|
7
3
|
/**
|
|
8
4
|
* Fetches suggested mappings generated from sample records.
|
|
9
5
|
*
|
|
@@ -11,20 +7,22 @@ class RosettaStoneApi extends BaseApi {
|
|
|
11
7
|
* @returns {Promise<Mapping[]>} - A promise that resolves to the created mapping.
|
|
12
8
|
* @experimental
|
|
13
9
|
*/
|
|
14
|
-
async getMappingRecommendationsFromSample(
|
|
10
|
+
async getMappingRecommendationsFromSample(dataset, sample) {
|
|
15
11
|
try {
|
|
16
|
-
const resp = await fetch("https://rosetta-stone-api.narrative.io/
|
|
12
|
+
const resp = await fetch("https://rosetta-stone-api.narrative.io/suggest", {
|
|
17
13
|
method: "POST",
|
|
18
14
|
body: JSON.stringify({
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
dataset,
|
|
16
|
+
sample: {
|
|
17
|
+
records: sample.sample,
|
|
18
|
+
},
|
|
21
19
|
}),
|
|
22
20
|
headers: {
|
|
23
21
|
"Content-Type": "application/json",
|
|
24
22
|
},
|
|
25
23
|
});
|
|
26
24
|
const mappings = (await resp.json());
|
|
27
|
-
return mappings
|
|
25
|
+
return mappings;
|
|
28
26
|
}
|
|
29
27
|
catch (e) {
|
|
30
28
|
console.error(e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@narrative.io/data-collaboration-sdk-ts",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"repository": "github:narrative-io/data-collaboration-sdk-ts",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"author": "",
|
|
21
21
|
"license": "ISC",
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@babel/core": "7.24.
|
|
24
|
-
"@babel/preset-env": "7.24.
|
|
23
|
+
"@babel/core": "7.24.3",
|
|
24
|
+
"@babel/preset-env": "7.24.3",
|
|
25
25
|
"@babel/preset-typescript": "7.24.1",
|
|
26
|
-
"@biomejs/biome": "1.6.
|
|
26
|
+
"@biomejs/biome": "1.6.2",
|
|
27
27
|
"@commitlint/cli": "19.2.1",
|
|
28
28
|
"@commitlint/config-conventional": "19.1.0",
|
|
29
29
|
"@types/jest": "29.5.12",
|