@narrative.io/data-collaboration-sdk-ts 0.17.1 → 0.19.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.
@@ -4,7 +4,7 @@ import { type PaginationOptions, type Config } from "./types";
4
4
  * BaseApi class provides basic functionality for making API requests.
5
5
  */
6
6
  export declare abstract class BaseApi {
7
- protected readonly apiKey?: string;
7
+ protected apiKey?: string;
8
8
  protected readonly environment: string;
9
9
  protected readonly base_api: MandeInstance;
10
10
  protected readonly headers: Record<string, string>;
@@ -33,6 +33,12 @@ export declare abstract class BaseApi {
33
33
  * @returns The API key as a string if it is set, or undefined if not set.
34
34
  */
35
35
  getApiKey(): string | undefined;
36
+ /**
37
+ * Sets the API key for the API instance.
38
+ *
39
+ * @param {string} apiKey - The API key to set.
40
+ */
41
+ setApiKey(apiKey: string): void;
36
42
  /**
37
43
  * Retrieves the environment associated with the API instance.
38
44
  *
package/build/base-api.js CHANGED
@@ -56,6 +56,14 @@ export class BaseApi {
56
56
  getApiKey() {
57
57
  return this.apiKey;
58
58
  }
59
+ /**
60
+ * Sets the API key for the API instance.
61
+ *
62
+ * @param {string} apiKey - The API key to set.
63
+ */
64
+ setApiKey(apiKey) {
65
+ this.apiKey = apiKey;
66
+ }
59
67
  /**
60
68
  * Retrieves the environment associated with the API instance.
61
69
  *
@@ -221,7 +221,17 @@ function compileBinaryOperator(op, operands, as) {
221
221
  return aliased(`(${operands.map((e) => compileExpression(e)).join(` ${op} `)})`, as);
222
222
  }
223
223
  function compileDatasetColumnRef(datasetId, column, as) {
224
- return aliased(`company_data.${quote(datasetId.toString())}.${quote(column)}`, as);
224
+ const formattedColumn = column
225
+ .split(".")
226
+ .reduce((acc, segment, index) => {
227
+ if (index === 0) {
228
+ return `${acc}${quote(segment)}`;
229
+ }
230
+ else {
231
+ return `${acc}.${quote(segment)}`;
232
+ }
233
+ }, "");
234
+ return aliased(`company_data.${quote(datasetId.toString())}.${formattedColumn}`, as);
225
235
  }
226
236
  function compileFunctionCall(name, args, as) {
227
237
  // Calling convenions for functions are all over the place:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@narrative.io/data-collaboration-sdk-ts",
3
- "version": "0.17.1",
3
+ "version": "0.19.0",
4
4
  "main": "build/index.js",
5
5
  "repository": "github:narrative-io/data-collaboration-sdk-ts",
6
6
  "source": "src/index.ts",