@narrative.io/data-collaboration-sdk-ts 0.2.0 → 0.3.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.
@@ -26,6 +26,7 @@ declare class MappingsApi extends BaseApi {
26
26
  */
27
27
  createPrivateMapping(mapping: CreateMapping, companyId?: number): Promise<Mapping>;
28
28
  testMapping(mapping: CreateMapping): Promise<MappingTestResult>;
29
+ previewMapping(mappingId: string): Promise<MappingTestResult>;
29
30
  deleteMapping(mappingId: string): Promise<void>;
30
31
  /**
31
32
  * Retrieves the company ID from the API.
@@ -52,6 +52,9 @@ class MappingsApi extends BaseApi {
52
52
  async testMapping(mapping) {
53
53
  return await this.post(`${resourceName}/test`, mapping);
54
54
  }
55
+ async previewMapping(mappingId) {
56
+ return await this.get(`${resourceName}/${mappingId}/sample`);
57
+ }
55
58
  async deleteMapping(mappingId) {
56
59
  await this.delete(`${resourceName}/${mappingId}`);
57
60
  }
@@ -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(sample: SampleRecords): Promise<Mapping[]>;
13
+ getMappingRecommendationsFromSample(datasetId: string, sample: SampleRecords): Promise<Mapping[]>;
14
14
  }
15
15
  export { RosettaStoneApi, type SampleRecords, type RosettaStoneResponse, type SampleRecord, };
@@ -11,11 +11,14 @@ class RosettaStoneApi extends BaseApi {
11
11
  * @returns {Promise<Mapping[]>} - A promise that resolves to the created mapping.
12
12
  * @experimental
13
13
  */
14
- async getMappingRecommendationsFromSample(sample) {
14
+ async getMappingRecommendationsFromSample(datasetId, sample) {
15
15
  try {
16
16
  const resp = await fetch("https://rosetta-stone-api.narrative.io/predict", {
17
17
  method: "POST",
18
- body: JSON.stringify(sample),
18
+ body: JSON.stringify({
19
+ datasetId,
20
+ records: sample.sample,
21
+ }),
19
22
  headers: {
20
23
  "Content-Type": "application/json",
21
24
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",