@narrative.io/data-collaboration-sdk-ts 2.8.0 → 2.9.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.
@@ -297,4 +297,4 @@ export declare function isAstArray(n: NqlAst): n is NqlAstList;
297
297
  type NqlAst = {
298
298
  type: string;
299
299
  } & (NqlAstList | NqlAggFunction | NqlBinaryOp | NqlCase | NqlFunction | NqlLit | NqlIdent | NqlJoin | NqlTypeSpec | NqlOp | NqlWindow | NqlUnknown | NqlSelect | NqlCreateMaterializedView | NqlExplain | NqlWhen | NqlElse | NqlPlaceholder);
300
- export type { NqlAst, NqlAstList, NqlAggFunction, NqlBinaryOp, NqlBudget, NqlCase, NqlFunction, NqlSimpleType, NqlLit, NqlIdent, NqlIdentColumn, NqlIdentTable, NqlJoin, NqlJoinType, NqlJoinConditionType, NqlTypeSpec, NqlOp, NqlWindow, NqlUnknown, NqlSelect, NqlCreateMaterializedView, NqlExplain, NqlAstType, NqlPlaceholder, NqlTemplateConstraintLogicalOperator, NqlTemplateConstraint, NqlTemplateConstraintGroup, ExtractPlaceholderType, };
300
+ export type { NqlAst, NqlAstList, NqlAggFunction, NqlBinaryOp, NqlBudget, NqlCase, NqlFunction, NqlSimpleType, NqlLit, NqlIdent, NqlIdentColumn, NqlIdentTable, NqlJoin, NqlJoinType, NqlJoinConditionType, NqlTypeSpec, NqlOp, NqlWindow, NqlUnknown, NqlSelect, NqlCreateMaterializedView, NqlExplain, NqlAstType, NqlPlaceholder, NqlElse, NqlWhen, NqlTemplateConstraintLogicalOperator, NqlTemplateConstraint, NqlTemplateConstraintGroup, ExtractPlaceholderType, };
@@ -0,0 +1,30 @@
1
+ import type * as ast from "./Ast";
2
+ import type { And, Between, BooleanExpression, ColumnRef, CreateMaterializedView, Equals, Explain, Expression, Gt, Gte, In, IsNull, Like, Lit, Lt, Lte, Not, NotEquals, Or, Output, Raw, Select, Statement, Table } from "./AstParser";
3
+ export declare function buildAst(statement: Statement | Raw): ast.NqlAst;
4
+ export declare function buildCreateMaterializedView(create: CreateMaterializedView): ast.NqlCreateMaterializedView;
5
+ export declare function buildExplain(explain: Explain): ast.NqlExplain;
6
+ export declare function buildSelect(select: Select): ast.NqlSelect;
7
+ export declare function buildOutput(output: Output): ast.NqlAst;
8
+ export declare function buildFrom(from: Table[] | Raw): ast.NqlAst;
9
+ export declare function buildJoinChain(tables: Table[]): ast.NqlAst;
10
+ export declare function buildWhere(where: BooleanExpression | Raw): ast.NqlAst;
11
+ export declare function buildBooleanExpression(expression: BooleanExpression | Raw): ast.NqlAst;
12
+ export declare function buildColumnRef(ref: ColumnRef): ast.NqlIdentColumn | ast.NqlUnknown;
13
+ export declare function buildLit(lit: Lit): ast.NqlLit;
14
+ export declare function buildAnd(and: And): ast.NqlBinaryOp;
15
+ export declare function buildOr(or: Or): ast.NqlBinaryOp;
16
+ export declare function buildNot(not: Not): ast.NqlOp;
17
+ export declare function buildBetween(between: Between): ast.NqlOp;
18
+ export declare function buildEquals(equals: Equals): ast.NqlBinaryOp;
19
+ export declare function buildNotEquals(notEquals: NotEquals): ast.NqlBinaryOp;
20
+ export declare function buildGt(gt: Gt): ast.NqlBinaryOp;
21
+ export declare function buildGte(gte: Gte): ast.NqlBinaryOp;
22
+ export declare function buildLt(lt: Lt): ast.NqlBinaryOp;
23
+ export declare function buildLte(lte: Lte): ast.NqlBinaryOp;
24
+ export declare function buildIn(_in: In): ast.NqlBinaryOp;
25
+ export declare function buildIsNull(isNull: IsNull): ast.NqlOp;
26
+ export declare function buildLike(like: Like): ast.NqlBinaryOp;
27
+ export declare function buildExpression(expression: Expression): ast.NqlAst;
28
+ export declare function buildTable(table: Table): ast.NqlAst;
29
+ export declare function buildRaw(raw: Raw): ast.NqlUnknown;
30
+ export declare function buildPlaceholder(placeholder: ast.NqlPlaceholder): ast.NqlPlaceholder;
@@ -0,0 +1,407 @@
1
+ export function buildAst(statement) {
2
+ switch (statement.type) {
3
+ case "create_materialized_view":
4
+ return buildCreateMaterializedView(statement);
5
+ case "explain":
6
+ return buildExplain(statement);
7
+ case "nql":
8
+ return buildRaw(statement);
9
+ default:
10
+ throw new Error("unreachable");
11
+ }
12
+ }
13
+ export function buildCreateMaterializedView(create) {
14
+ return {
15
+ type: "create_materialized_view",
16
+ nql: "",
17
+ name: create.name,
18
+ select: buildSelect(create.select),
19
+ };
20
+ }
21
+ export function buildExplain(explain) {
22
+ return {
23
+ type: "explain",
24
+ nql: "",
25
+ query: buildSelect(explain.query),
26
+ };
27
+ }
28
+ export function buildSelect(select) {
29
+ return {
30
+ type: "select",
31
+ nql: "",
32
+ budget: select.budget,
33
+ columns: select.columns.map(buildOutput),
34
+ from: select.from !== null ? buildFrom(select.from) : null,
35
+ where: select.where !== null ? buildWhere(select.where) : null,
36
+ group_by: [],
37
+ having: null,
38
+ is_distinct: false,
39
+ limit: null,
40
+ order_by: [],
41
+ qualify: null,
42
+ windows: [],
43
+ with: null,
44
+ };
45
+ }
46
+ export function buildOutput(output) {
47
+ switch (output.type) {
48
+ case "attribute_ref":
49
+ case "dataset_column_ref":
50
+ case "raw_ref":
51
+ return buildColumnRef(output);
52
+ case "lit":
53
+ return buildLit(output);
54
+ case "nql":
55
+ return buildRaw(output);
56
+ case "placeholder":
57
+ return buildPlaceholder(output);
58
+ default:
59
+ throw new Error("unreachable");
60
+ }
61
+ }
62
+ export function buildFrom(from) {
63
+ if (Array.isArray(from)) {
64
+ if (from.length === 1) {
65
+ return buildTable(from[0]);
66
+ }
67
+ return buildJoinChain(from);
68
+ }
69
+ return buildRaw(from);
70
+ }
71
+ export function buildJoinChain(tables) {
72
+ const result = tables.reduce((left, table, index) => {
73
+ if (index === 0)
74
+ return buildTable(table);
75
+ const right = buildTable(table);
76
+ if ("join" in table && table.join !== null && table.join !== undefined) {
77
+ const join = table.join;
78
+ const condition = buildBooleanExpression(join.condition);
79
+ return {
80
+ type: "join",
81
+ condition: condition,
82
+ condition_type: join.conditionType,
83
+ join_type: join.joinType,
84
+ left: left,
85
+ right: right,
86
+ };
87
+ }
88
+ return left;
89
+ }, null);
90
+ if (result === null) {
91
+ throw new Error("Join chain could not be constructed");
92
+ }
93
+ return result;
94
+ }
95
+ export function buildWhere(where) {
96
+ if ("nql" in where) {
97
+ return buildRaw(where);
98
+ }
99
+ return buildBooleanExpression(where);
100
+ }
101
+ export function buildBooleanExpression(expression) {
102
+ switch (expression.type) {
103
+ case "and":
104
+ return buildAnd(expression);
105
+ case "or":
106
+ return buildOr(expression);
107
+ case "not":
108
+ return buildNot(expression);
109
+ case "between":
110
+ return buildBetween(expression);
111
+ case "=":
112
+ return buildEquals(expression);
113
+ case "<>":
114
+ return buildNotEquals(expression);
115
+ case "<":
116
+ return buildLt(expression);
117
+ case "<=":
118
+ return buildLte(expression);
119
+ case ">":
120
+ return buildGt(expression);
121
+ case ">=":
122
+ return buildGte(expression);
123
+ case "in":
124
+ return buildIn(expression);
125
+ case "is_null":
126
+ return buildIsNull(expression);
127
+ case "like":
128
+ return buildLike(expression);
129
+ default:
130
+ return buildRaw(expression);
131
+ }
132
+ }
133
+ export function buildColumnRef(ref) {
134
+ switch (ref.type) {
135
+ case "attribute_ref":
136
+ return {
137
+ type: "column",
138
+ nql: "",
139
+ as: ref.as,
140
+ db: null,
141
+ schema: "narrative",
142
+ table: "rosetta_stone",
143
+ column: ref.column,
144
+ };
145
+ case "dataset_column_ref":
146
+ return {
147
+ type: "column",
148
+ nql: "",
149
+ as: ref.as,
150
+ db: null,
151
+ schema: "company_data",
152
+ table: ref.datasetId.toString(),
153
+ column: ref.column,
154
+ };
155
+ case "raw_ref":
156
+ return {
157
+ type: "unknown",
158
+ nql: ref.nql,
159
+ };
160
+ default:
161
+ throw new Error("unreachable");
162
+ }
163
+ }
164
+ export function buildLit(lit) {
165
+ return {
166
+ type: "literal",
167
+ nql: "",
168
+ as: lit.as,
169
+ value_type: lit.value_type,
170
+ value: lit.value,
171
+ };
172
+ }
173
+ export function buildAnd(and) {
174
+ if (and.operands.length < 2) {
175
+ throw new Error("AND must have at least two operands");
176
+ }
177
+ return and.operands.slice(1).reduce((left, operand) => {
178
+ return {
179
+ type: "binary_op",
180
+ nql: "",
181
+ as: and.as,
182
+ name: "AND",
183
+ left: left,
184
+ right: buildExpression(operand),
185
+ };
186
+ }, buildExpression(and.operands[0]));
187
+ }
188
+ export function buildOr(or) {
189
+ if (or.operands.length < 2) {
190
+ throw new Error("OR must have at least two operands");
191
+ }
192
+ return or.operands.slice(1).reduce((left, operand) => {
193
+ return {
194
+ type: "binary_op",
195
+ nql: "",
196
+ as: or.as,
197
+ name: "OR",
198
+ left: left,
199
+ right: buildExpression(operand),
200
+ };
201
+ }, buildExpression(or.operands[0]));
202
+ }
203
+ export function buildNot(not) {
204
+ return {
205
+ type: "operator",
206
+ nql: "",
207
+ as: not.as,
208
+ name: "NOT",
209
+ args: [buildExpression(not.operand)],
210
+ };
211
+ }
212
+ export function buildBetween(between) {
213
+ return {
214
+ type: "operator",
215
+ nql: "",
216
+ as: between.as,
217
+ name: "BETWEEN ASYMMETRIC",
218
+ args: [
219
+ buildExpression(between.operand),
220
+ buildExpression(between.lower),
221
+ buildExpression(between.upper),
222
+ ],
223
+ };
224
+ }
225
+ export function buildEquals(equals) {
226
+ return {
227
+ type: "binary_op",
228
+ nql: "",
229
+ name: "=",
230
+ left: buildExpression(equals.left),
231
+ right: buildExpression(equals.right),
232
+ };
233
+ }
234
+ export function buildNotEquals(notEquals) {
235
+ return {
236
+ type: "binary_op",
237
+ nql: "",
238
+ as: notEquals.as,
239
+ name: "<>",
240
+ left: buildExpression(notEquals.left),
241
+ right: buildExpression(notEquals.right),
242
+ };
243
+ }
244
+ export function buildGt(gt) {
245
+ return {
246
+ type: "binary_op",
247
+ nql: "",
248
+ as: gt.as,
249
+ name: ">",
250
+ left: buildExpression(gt.left),
251
+ right: buildExpression(gt.right),
252
+ };
253
+ }
254
+ export function buildGte(gte) {
255
+ return {
256
+ type: "binary_op",
257
+ nql: "",
258
+ as: gte.as,
259
+ name: ">=",
260
+ left: buildExpression(gte.left),
261
+ right: buildExpression(gte.right),
262
+ };
263
+ }
264
+ export function buildLt(lt) {
265
+ return {
266
+ type: "binary_op",
267
+ nql: "",
268
+ as: lt.as,
269
+ name: "<",
270
+ left: buildExpression(lt.left),
271
+ right: buildExpression(lt.right),
272
+ };
273
+ }
274
+ export function buildLte(lte) {
275
+ return {
276
+ type: "binary_op",
277
+ nql: "",
278
+ as: lte.as,
279
+ name: "<=",
280
+ left: buildExpression(lte.left),
281
+ right: buildExpression(lte.right),
282
+ };
283
+ }
284
+ export function buildIn(_in) {
285
+ return {
286
+ type: "binary_op",
287
+ nql: "",
288
+ as: _in.as,
289
+ name: _in.negated ? "NOT IN" : "IN",
290
+ left: buildExpression(_in.expression),
291
+ right: _in.values.map(buildExpression),
292
+ };
293
+ }
294
+ export function buildIsNull(isNull) {
295
+ return {
296
+ type: "operator",
297
+ nql: "",
298
+ as: isNull.as,
299
+ name: isNull.negated ? "IS NOT NULL" : "IS NULL",
300
+ args: [buildExpression(isNull.operand)],
301
+ };
302
+ }
303
+ export function buildLike(like) {
304
+ return {
305
+ type: "binary_op",
306
+ nql: "",
307
+ as: like.as,
308
+ name: like.negated ? "NOT LIKE" : "LIKE",
309
+ left: buildExpression(like.value),
310
+ right: {
311
+ type: "literal",
312
+ nql: "",
313
+ value_type: { type: "string" },
314
+ value: like.pattern,
315
+ },
316
+ };
317
+ }
318
+ export function buildExpression(expression) {
319
+ switch (expression.type) {
320
+ case "and":
321
+ return buildAnd(expression);
322
+ case "or":
323
+ return buildOr(expression);
324
+ case "not":
325
+ return buildNot(expression);
326
+ case "between":
327
+ return buildBetween(expression);
328
+ case "=":
329
+ return buildEquals(expression);
330
+ case "<>":
331
+ return buildNotEquals(expression);
332
+ case "<":
333
+ return buildLt(expression);
334
+ case "<=":
335
+ return buildLte(expression);
336
+ case ">":
337
+ return buildGt(expression);
338
+ case ">=":
339
+ return buildGte(expression);
340
+ case "in":
341
+ return buildIn(expression);
342
+ case "is_null":
343
+ return buildIsNull(expression);
344
+ case "like":
345
+ return buildLike(expression);
346
+ case "attribute_ref":
347
+ case "dataset_column_ref":
348
+ case "raw_ref":
349
+ return buildColumnRef(expression);
350
+ case "lit":
351
+ return buildLit(expression);
352
+ case "nql":
353
+ return buildRaw(expression);
354
+ case "placeholder":
355
+ return buildPlaceholder(expression);
356
+ default:
357
+ throw new Error("unreachable");
358
+ }
359
+ }
360
+ export function buildTable(table) {
361
+ switch (table.type) {
362
+ case "rosetta_stone":
363
+ return {
364
+ type: "table",
365
+ nql: "",
366
+ as: table.as,
367
+ db: null,
368
+ schema: "narrative",
369
+ table: "rosetta_stone",
370
+ };
371
+ case "dataset":
372
+ return {
373
+ type: "table",
374
+ nql: "",
375
+ as: table.as,
376
+ db: null,
377
+ schema: "company_data",
378
+ table: table.datasetId.toString(),
379
+ };
380
+ case "raw_table":
381
+ return {
382
+ type: "unknown",
383
+ nql: table.nql,
384
+ };
385
+ case "placeholder":
386
+ return buildPlaceholder(table);
387
+ default:
388
+ throw new Error("unreachable");
389
+ }
390
+ }
391
+ export function buildRaw(raw) {
392
+ return {
393
+ type: "unknown",
394
+ nql: raw.nql,
395
+ };
396
+ }
397
+ export function buildPlaceholder(placeholder) {
398
+ return {
399
+ type: "placeholder",
400
+ identifier: placeholder.identifier,
401
+ expectedType: placeholder.expectedType,
402
+ optional: placeholder.optional,
403
+ cardinality: placeholder.cardinality,
404
+ constraints: placeholder.constraints,
405
+ nql: placeholder.nql,
406
+ };
407
+ }
@@ -0,0 +1,45 @@
1
+ import { BaseApi } from "../base-api";
2
+ import type { ApiRecords } from "../types";
3
+ import type { CreateNqlQueryRequest, NqlOwnedQueryResponse, NqlQueryCollaborators, NqlQueryMetadata, NqlQueryOwner, NqlQueryResponse, NqlSharedQueryResponse, UpdateNqlQueryRequest } from "./types";
4
+ /**
5
+ * A class for accessing the Queries API.
6
+ * @extends BaseApi
7
+ */
8
+ declare class QueriesApi extends BaseApi {
9
+ /**
10
+ * Gets a list of accessable queries from the API.
11
+ *
12
+ * @returns {Promise<ApiRecords<NqlQuery>>} A promise that resolves with the list of queries.
13
+ */
14
+ getQueries(): Promise<ApiRecords<NqlQueryResponse>>;
15
+ /**
16
+ * Gets a single query from the API by its ID.
17
+ *
18
+ * @param {number} queryId - The ID of the query to retrieve.
19
+ * @returns {Promise<NqlQueryResponse>} A promise that resolves with the query.
20
+ */
21
+ getQuery(queryId: string): Promise<NqlQueryResponse>;
22
+ /**
23
+ * Deletes a single query from the API by its ID.
24
+ *
25
+ * @param {number} queryId - The ID of the query to delete.
26
+ * @returns {Promise<void>} A promise that resolves when the delete operation is complete.
27
+ */
28
+ deleteQuery(queryId: string): Promise<void>;
29
+ /**
30
+ * Creates a new query on the API.
31
+ *
32
+ * @param {CreateNqlQueryRequest} data - The data for the new query.
33
+ * @returns {Promise<NqlQueryResponse>} A promise that resolves with the newly created query.
34
+ */
35
+ createQuery(data: CreateNqlQueryRequest): Promise<NqlQueryResponse>;
36
+ /**
37
+ * Updates an existing query on the API.
38
+ *
39
+ * @param {string} queryId - The ID of the query to update.
40
+ * @param {UpdateNqlQueryRequest} data - The updated data for the query.
41
+ * @returns {Promise<NqlQueryResponse>} A promise that resolves with the updated query.
42
+ */
43
+ updateQuery(queryId: string, data: UpdateNqlQueryRequest): Promise<NqlQueryResponse>;
44
+ }
45
+ export { QueriesApi, type CreateNqlQueryRequest, type UpdateNqlQueryRequest, type NqlQueryResponse, type NqlSharedQueryResponse, type NqlOwnedQueryResponse, type NqlQueryCollaborators, type NqlQueryOwner, type NqlQueryMetadata, };
@@ -0,0 +1,60 @@
1
+ import { BaseApi } from "../base-api";
2
+ /**
3
+ * The name of the resource to be used in API requests.
4
+ * @constant
5
+ * @private
6
+ * @type {string}
7
+ */
8
+ const resourceName = "queries";
9
+ /**
10
+ * A class for accessing the Queries API.
11
+ * @extends BaseApi
12
+ */
13
+ class QueriesApi extends BaseApi {
14
+ /**
15
+ * Gets a list of accessable queries from the API.
16
+ *
17
+ * @returns {Promise<ApiRecords<NqlQuery>>} A promise that resolves with the list of queries.
18
+ */
19
+ async getQueries() {
20
+ return await this.get(resourceName);
21
+ }
22
+ /**
23
+ * Gets a single query from the API by its ID.
24
+ *
25
+ * @param {number} queryId - The ID of the query to retrieve.
26
+ * @returns {Promise<NqlQueryResponse>} A promise that resolves with the query.
27
+ */
28
+ async getQuery(queryId) {
29
+ return await this.get(`${resourceName}/${queryId}`);
30
+ }
31
+ /**
32
+ * Deletes a single query from the API by its ID.
33
+ *
34
+ * @param {number} queryId - The ID of the query to delete.
35
+ * @returns {Promise<void>} A promise that resolves when the delete operation is complete.
36
+ */
37
+ async deleteQuery(queryId) {
38
+ await this.delete(`${resourceName}/${queryId}`);
39
+ }
40
+ /**
41
+ * Creates a new query on the API.
42
+ *
43
+ * @param {CreateNqlQueryRequest} data - The data for the new query.
44
+ * @returns {Promise<NqlQueryResponse>} A promise that resolves with the newly created query.
45
+ */
46
+ async createQuery(data) {
47
+ return await this.post(`${resourceName}`, data);
48
+ }
49
+ /**
50
+ * Updates an existing query on the API.
51
+ *
52
+ * @param {string} queryId - The ID of the query to update.
53
+ * @param {UpdateNqlQueryRequest} data - The updated data for the query.
54
+ * @returns {Promise<NqlQueryResponse>} A promise that resolves with the updated query.
55
+ */
56
+ async updateQuery(queryId, data) {
57
+ return await this.put(`${resourceName}/${queryId}`, data);
58
+ }
59
+ }
60
+ export { QueriesApi, };
@@ -0,0 +1,47 @@
1
+ import type { NqlAst } from "src/nql";
2
+ export interface CreateNqlQueryRequest {
3
+ name: string;
4
+ display_name?: string;
5
+ description?: string;
6
+ tags?: string[];
7
+ collaborators: NqlQueryCollaborators;
8
+ ast: NqlAst;
9
+ }
10
+ export interface UpdateNqlQueryRequest {
11
+ name?: string;
12
+ display_name?: string;
13
+ description?: string;
14
+ tags?: string[];
15
+ collaborators?: NqlQueryCollaborators;
16
+ ast?: NqlAst;
17
+ }
18
+ export type NqlQueryResponse = NqlSharedQueryResponse | NqlOwnedQueryResponse;
19
+ export interface NqlSharedQueryResponse {
20
+ id: string;
21
+ name: string;
22
+ display_name?: string;
23
+ description?: string;
24
+ tags?: string[];
25
+ owner: NqlQueryOwner;
26
+ is_owned?: boolean;
27
+ ast: NqlAst;
28
+ }
29
+ export interface NqlOwnedQueryResponse extends NqlSharedQueryResponse {
30
+ collaborators: NqlQueryCollaborators;
31
+ metadata: NqlQueryMetadata;
32
+ }
33
+ export interface NqlQueryCollaborators {
34
+ type: "inclusion" | "exclusion";
35
+ company_ids: number[];
36
+ }
37
+ export interface NqlQueryOwner {
38
+ company_id: number;
39
+ company_name: string;
40
+ company_slug?: string;
41
+ }
42
+ export interface NqlQueryMetadata {
43
+ created_by_user_id: number;
44
+ created_at: string;
45
+ updated_by_user_id?: number;
46
+ updated_at: string;
47
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -10,6 +10,8 @@ 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(dataset: Partial<Dataset>, sample: SampleRecords): Promise<Mapping[]>;
13
+ getMappingRecommendationsFromSample(dataset: Partial<Dataset>, sample: SampleRecords, remap_existing_mappings?: boolean): Promise<{
14
+ response: Mapping[];
15
+ }>;
14
16
  }
15
17
  export { RosettaStoneApi, type SampleRecords, type RosettaStoneResponse, type SampleRecord, };
@@ -7,31 +7,34 @@ class RosettaStoneApi extends BaseApi {
7
7
  * @returns {Promise<Mapping[]>} - A promise that resolves to the created mapping.
8
8
  * @experimental
9
9
  */
10
- async getMappingRecommendationsFromSample(dataset, sample) {
10
+ async getMappingRecommendationsFromSample(dataset, sample, remap_existing_mappings = false) {
11
11
  try {
12
- const resp = await fetch("https://rosetta-stone-api.narrative.io/suggest", {
12
+ const resp = await fetch("https://rosetta-stone-api.narrative.io/v1/rosetta_stone/suggest_mappings ", {
13
13
  method: "POST",
14
14
  body: JSON.stringify({
15
15
  dataset,
16
16
  sample: {
17
17
  records: sample.sample,
18
18
  },
19
+ remap_existing_mappings,
19
20
  }),
20
21
  headers: {
21
22
  "Content-Type": "application/json",
22
23
  },
23
24
  });
24
25
  const mappings = (await resp.json());
25
- return mappings.map((mapping) => {
26
- return {
27
- ...mapping,
28
- dataset_id: dataset.id ?? 0,
29
- };
30
- });
26
+ return {
27
+ response: mappings.response.map((mapping) => {
28
+ return {
29
+ ...mapping,
30
+ dataset_id: dataset.id ?? 0,
31
+ };
32
+ }),
33
+ };
31
34
  }
32
35
  catch (e) {
33
36
  console.error(e);
34
- return [];
37
+ return { response: [] };
35
38
  }
36
39
  }
37
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",
@@ -20,17 +20,17 @@
20
20
  "author": "",
21
21
  "license": "ISC",
22
22
  "devDependencies": {
23
- "@babel/core": "7.24.5",
24
- "@babel/preset-env": "7.24.5",
25
- "@babel/preset-typescript": "7.24.1",
23
+ "@babel/core": "7.24.6",
24
+ "@babel/preset-env": "7.24.6",
25
+ "@babel/preset-typescript": "7.24.6",
26
26
  "@biomejs/biome": "1.7.3",
27
27
  "@commitlint/cli": "19.3.0",
28
28
  "@commitlint/config-conventional": "19.2.2",
29
29
  "@types/jest": "29.5.12",
30
30
  "babel-jest": "29.7.0",
31
31
  "jest": "29.7.0",
32
- "lefthook": "1.6.12",
33
- "ts-jest": "29.1.2"
32
+ "lefthook": "1.6.15",
33
+ "ts-jest": "29.1.4"
34
34
  },
35
35
  "dependencies": {
36
36
  "mande": "2.0.9",