@narrative.io/data-collaboration-sdk-ts 1.2.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.
|
@@ -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",
|