@athenaintel/sdk 4.3.1117 → 4.3.1118

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.
Files changed (64) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/Client.d.ts +3 -0
  3. package/dist/cjs/Client.js +9 -4
  4. package/dist/cjs/api/errors/BadGatewayError.d.ts +6 -0
  5. package/dist/cjs/api/errors/BadGatewayError.js +50 -0
  6. package/dist/cjs/api/errors/index.d.ts +1 -0
  7. package/dist/cjs/api/errors/index.js +1 -0
  8. package/dist/cjs/api/resources/index.d.ts +2 -0
  9. package/dist/cjs/api/resources/index.js +3 -1
  10. package/dist/cjs/api/resources/semanticModel/client/Client.d.ts +65 -0
  11. package/dist/cjs/api/resources/semanticModel/client/Client.js +301 -0
  12. package/dist/cjs/api/resources/semanticModel/client/index.d.ts +1 -0
  13. package/dist/cjs/api/resources/semanticModel/client/index.js +17 -0
  14. package/dist/cjs/api/resources/semanticModel/client/requests/SemanticModelQueryRequestIn.d.ts +18 -0
  15. package/dist/cjs/api/resources/semanticModel/client/requests/SemanticModelQueryRequestIn.js +3 -0
  16. package/dist/cjs/api/resources/semanticModel/client/requests/index.d.ts +1 -0
  17. package/dist/cjs/api/resources/semanticModel/client/requests/index.js +2 -0
  18. package/dist/cjs/api/resources/semanticModel/index.d.ts +1 -0
  19. package/dist/cjs/api/resources/semanticModel/index.js +17 -0
  20. package/dist/cjs/api/types/SemanticModelErrorResponse.d.ts +6 -0
  21. package/dist/cjs/api/types/SemanticModelErrorResponse.js +3 -0
  22. package/dist/cjs/api/types/SemanticModelMetaResponseOut.d.ts +7 -0
  23. package/dist/cjs/api/types/SemanticModelMetaResponseOut.js +3 -0
  24. package/dist/cjs/api/types/SemanticModelQueryResponseOut.d.ts +9 -0
  25. package/dist/cjs/api/types/SemanticModelQueryResponseOut.js +3 -0
  26. package/dist/cjs/api/types/SemanticModelTokenResponseOut.d.ts +11 -0
  27. package/dist/cjs/api/types/SemanticModelTokenResponseOut.js +3 -0
  28. package/dist/cjs/api/types/index.d.ts +4 -0
  29. package/dist/cjs/api/types/index.js +4 -0
  30. package/dist/cjs/version.d.ts +1 -1
  31. package/dist/cjs/version.js +1 -1
  32. package/dist/esm/BaseClient.mjs +2 -2
  33. package/dist/esm/Client.d.mts +3 -0
  34. package/dist/esm/Client.mjs +5 -0
  35. package/dist/esm/api/errors/BadGatewayError.d.mts +6 -0
  36. package/dist/esm/api/errors/BadGatewayError.mjs +13 -0
  37. package/dist/esm/api/errors/index.d.mts +1 -0
  38. package/dist/esm/api/errors/index.mjs +1 -0
  39. package/dist/esm/api/resources/index.d.mts +2 -0
  40. package/dist/esm/api/resources/index.mjs +2 -0
  41. package/dist/esm/api/resources/semanticModel/client/Client.d.mts +65 -0
  42. package/dist/esm/api/resources/semanticModel/client/Client.mjs +264 -0
  43. package/dist/esm/api/resources/semanticModel/client/index.d.mts +1 -0
  44. package/dist/esm/api/resources/semanticModel/client/index.mjs +1 -0
  45. package/dist/esm/api/resources/semanticModel/client/requests/SemanticModelQueryRequestIn.d.mts +18 -0
  46. package/dist/esm/api/resources/semanticModel/client/requests/SemanticModelQueryRequestIn.mjs +2 -0
  47. package/dist/esm/api/resources/semanticModel/client/requests/index.d.mts +1 -0
  48. package/dist/esm/api/resources/semanticModel/client/requests/index.mjs +1 -0
  49. package/dist/esm/api/resources/semanticModel/index.d.mts +1 -0
  50. package/dist/esm/api/resources/semanticModel/index.mjs +1 -0
  51. package/dist/esm/api/types/SemanticModelErrorResponse.d.mts +6 -0
  52. package/dist/esm/api/types/SemanticModelErrorResponse.mjs +2 -0
  53. package/dist/esm/api/types/SemanticModelMetaResponseOut.d.mts +7 -0
  54. package/dist/esm/api/types/SemanticModelMetaResponseOut.mjs +2 -0
  55. package/dist/esm/api/types/SemanticModelQueryResponseOut.d.mts +9 -0
  56. package/dist/esm/api/types/SemanticModelQueryResponseOut.mjs +2 -0
  57. package/dist/esm/api/types/SemanticModelTokenResponseOut.d.mts +11 -0
  58. package/dist/esm/api/types/SemanticModelTokenResponseOut.mjs +2 -0
  59. package/dist/esm/api/types/index.d.mts +4 -0
  60. package/dist/esm/api/types/index.mjs +4 -0
  61. package/dist/esm/version.d.mts +1 -1
  62. package/dist/esm/version.mjs +1 -1
  63. package/package.json +1 -1
  64. package/reference.md +200 -0
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Response from a semantic model query.
3
+ */
4
+ export interface SemanticModelQueryResponseOut {
5
+ /** Query result rows */
6
+ data: Record<string, unknown>[];
7
+ /** Number of rows returned */
8
+ row_count: number;
9
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Response containing a short-lived Cube API token.
3
+ */
4
+ export interface SemanticModelTokenResponseOut {
5
+ /** Base URL of the Cube instance */
6
+ cube_url: string;
7
+ /** ISO 8601 timestamp when the token expires */
8
+ expires_at: string;
9
+ /** JWT for direct Cube REST API access */
10
+ token: string;
11
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -52,6 +52,10 @@ export * from "./PublicAssetOut.js";
52
52
  export * from "./ResearchAgentResponse.js";
53
53
  export * from "./RunTaskResponse.js";
54
54
  export * from "./SaveAssetRequestOut.js";
55
+ export * from "./SemanticModelErrorResponse.js";
56
+ export * from "./SemanticModelMetaResponseOut.js";
57
+ export * from "./SemanticModelQueryResponseOut.js";
58
+ export * from "./SemanticModelTokenResponseOut.js";
55
59
  export * from "./Sheet.js";
56
60
  export * from "./SheetOperationResponse.js";
57
61
  export * from "./SqlAgentResponse.js";
@@ -68,6 +68,10 @@ __exportStar(require("./PublicAssetOut.js"), exports);
68
68
  __exportStar(require("./ResearchAgentResponse.js"), exports);
69
69
  __exportStar(require("./RunTaskResponse.js"), exports);
70
70
  __exportStar(require("./SaveAssetRequestOut.js"), exports);
71
+ __exportStar(require("./SemanticModelErrorResponse.js"), exports);
72
+ __exportStar(require("./SemanticModelMetaResponseOut.js"), exports);
73
+ __exportStar(require("./SemanticModelQueryResponseOut.js"), exports);
74
+ __exportStar(require("./SemanticModelTokenResponseOut.js"), exports);
71
75
  __exportStar(require("./Sheet.js"), exports);
72
76
  __exportStar(require("./SheetOperationResponse.js"), exports);
73
77
  __exportStar(require("./SqlAgentResponse.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "4.3.1117";
1
+ export declare const SDK_VERSION = "4.3.1118";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "4.3.1117";
4
+ exports.SDK_VERSION = "4.3.1118";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "@athenaintel/sdk",
9
- "X-Fern-SDK-Version": "4.3.1117",
10
- "User-Agent": "@athenaintel/sdk/4.3.1117",
9
+ "X-Fern-SDK-Version": "4.3.1118",
10
+ "User-Agent": "@athenaintel/sdk/4.3.1118",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -3,6 +3,7 @@ import { AopClient } from "./api/resources/aop/client/Client.mjs";
3
3
  import { AssetsClient } from "./api/resources/assets/client/Client.mjs";
4
4
  import { DatabasesClient } from "./api/resources/databases/client/Client.mjs";
5
5
  import { QueryClient } from "./api/resources/query/client/Client.mjs";
6
+ import { SemanticModelClient } from "./api/resources/semanticModel/client/Client.mjs";
6
7
  import { ThreadsClient } from "./api/resources/threads/client/Client.mjs";
7
8
  import { ToolsClient } from "./api/resources/tools/client/Client.mjs";
8
9
  import type { BaseClientOptions, BaseRequestOptions } from "./BaseClient.mjs";
@@ -20,6 +21,7 @@ export declare class AthenaIntelligenceClient {
20
21
  protected _assets: AssetsClient | undefined;
21
22
  protected _databases: DatabasesClient | undefined;
22
23
  protected _query: QueryClient | undefined;
24
+ protected _semanticModel: SemanticModelClient | undefined;
23
25
  protected _threads: ThreadsClient | undefined;
24
26
  protected _tools: ToolsClient | undefined;
25
27
  constructor(options: AthenaIntelligenceClient.Options);
@@ -28,6 +30,7 @@ export declare class AthenaIntelligenceClient {
28
30
  get assets(): AssetsClient;
29
31
  get databases(): DatabasesClient;
30
32
  get query(): QueryClient;
33
+ get semanticModel(): SemanticModelClient;
31
34
  get threads(): ThreadsClient;
32
35
  get tools(): ToolsClient;
33
36
  }
@@ -4,6 +4,7 @@ import { AopClient } from "./api/resources/aop/client/Client.mjs";
4
4
  import { AssetsClient } from "./api/resources/assets/client/Client.mjs";
5
5
  import { DatabasesClient } from "./api/resources/databases/client/Client.mjs";
6
6
  import { QueryClient } from "./api/resources/query/client/Client.mjs";
7
+ import { SemanticModelClient } from "./api/resources/semanticModel/client/Client.mjs";
7
8
  import { ThreadsClient } from "./api/resources/threads/client/Client.mjs";
8
9
  import { ToolsClient } from "./api/resources/tools/client/Client.mjs";
9
10
  import { normalizeClientOptionsWithAuth } from "./BaseClient.mjs";
@@ -31,6 +32,10 @@ export class AthenaIntelligenceClient {
31
32
  var _a;
32
33
  return ((_a = this._query) !== null && _a !== void 0 ? _a : (this._query = new QueryClient(this._options)));
33
34
  }
35
+ get semanticModel() {
36
+ var _a;
37
+ return ((_a = this._semanticModel) !== null && _a !== void 0 ? _a : (this._semanticModel = new SemanticModelClient(this._options)));
38
+ }
34
39
  get threads() {
35
40
  var _a;
36
41
  return ((_a = this._threads) !== null && _a !== void 0 ? _a : (this._threads = new ThreadsClient(this._options)));
@@ -0,0 +1,6 @@
1
+ import type * as core from "../../core/index.mjs";
2
+ import * as errors from "../../errors/index.mjs";
3
+ import type * as AthenaIntelligence from "../index.mjs";
4
+ export declare class BadGatewayError extends errors.AthenaIntelligenceError {
5
+ constructor(body: AthenaIntelligence.SemanticModelErrorResponse, rawResponse?: core.RawResponse);
6
+ }
@@ -0,0 +1,13 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import * as errors from "../../errors/index.mjs";
3
+ export class BadGatewayError extends errors.AthenaIntelligenceError {
4
+ constructor(body, rawResponse) {
5
+ super({
6
+ message: "BadGatewayError",
7
+ statusCode: 502,
8
+ body: body,
9
+ rawResponse: rawResponse,
10
+ });
11
+ Object.setPrototypeOf(this, BadGatewayError.prototype);
12
+ }
13
+ }
@@ -1,3 +1,4 @@
1
+ export * from "./BadGatewayError.mjs";
1
2
  export * from "./BadRequestError.mjs";
2
3
  export * from "./ConflictError.mjs";
3
4
  export * from "./ContentTooLargeError.mjs";
@@ -1,3 +1,4 @@
1
+ export * from "./BadGatewayError.mjs";
1
2
  export * from "./BadRequestError.mjs";
2
3
  export * from "./ConflictError.mjs";
3
4
  export * from "./ContentTooLargeError.mjs";
@@ -7,6 +7,8 @@ export * from "./databases/client/requests/index.mjs";
7
7
  export * as databases from "./databases/index.mjs";
8
8
  export * from "./query/client/requests/index.mjs";
9
9
  export * as query from "./query/index.mjs";
10
+ export * from "./semanticModel/client/requests/index.mjs";
11
+ export * as semanticModel from "./semanticModel/index.mjs";
10
12
  export * as threads from "./threads/index.mjs";
11
13
  export * from "./tools/client/requests/index.mjs";
12
14
  export * as tools from "./tools/index.mjs";
@@ -7,6 +7,8 @@ export * from "./databases/client/requests/index.mjs";
7
7
  export * as databases from "./databases/index.mjs";
8
8
  export * from "./query/client/requests/index.mjs";
9
9
  export * as query from "./query/index.mjs";
10
+ export * from "./semanticModel/client/requests/index.mjs";
11
+ export * as semanticModel from "./semanticModel/index.mjs";
10
12
  export * as threads from "./threads/index.mjs";
11
13
  export * from "./tools/client/requests/index.mjs";
12
14
  export * as tools from "./tools/index.mjs";
@@ -0,0 +1,65 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.mjs";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.mjs";
3
+ import * as core from "../../../../core/index.mjs";
4
+ import * as AthenaIntelligence from "../../../index.mjs";
5
+ export declare namespace SemanticModelClient {
6
+ interface Options extends BaseClientOptions {
7
+ }
8
+ interface RequestOptions extends BaseRequestOptions {
9
+ }
10
+ }
11
+ export declare class SemanticModelClient {
12
+ protected readonly _options: NormalizedClientOptionsWithAuth<SemanticModelClient.Options>;
13
+ constructor(options: SemanticModelClient.Options);
14
+ /**
15
+ * Generate a short-lived JWT token for direct access to the semantic model's Cube REST API. Use this token to query /cubejs-api/v1/load and /cubejs-api/v1/meta directly. Token expires after 1 hour. The token carries only the model ID and schema hash — database credentials are NOT included and are resolved server-side by Cube via callback.
16
+ *
17
+ * @param {string} asset_id
18
+ * @param {SemanticModelClient.RequestOptions} requestOptions - Request-specific configuration.
19
+ *
20
+ * @throws {@link AthenaIntelligence.BadRequestError}
21
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
22
+ * @throws {@link AthenaIntelligence.NotFoundError}
23
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
24
+ *
25
+ * @example
26
+ * await client.semanticModel.generateToken("asset_id")
27
+ */
28
+ generateToken(asset_id: string, requestOptions?: SemanticModelClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.SemanticModelTokenResponseOut>;
29
+ private __generateToken;
30
+ /**
31
+ * Get metadata for a semantic model including all cubes, measures, dimensions, segments, and joins.
32
+ *
33
+ * @param {string} asset_id
34
+ * @param {SemanticModelClient.RequestOptions} requestOptions - Request-specific configuration.
35
+ *
36
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
37
+ * @throws {@link AthenaIntelligence.NotFoundError}
38
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
39
+ * @throws {@link AthenaIntelligence.BadGatewayError}
40
+ *
41
+ * @example
42
+ * await client.semanticModel.getMeta("asset_id")
43
+ */
44
+ getMeta(asset_id: string, requestOptions?: SemanticModelClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.SemanticModelMetaResponseOut>;
45
+ private __getMeta;
46
+ /**
47
+ * Execute a metric query against a semantic model. Specify measures, optional dimensions, filters, and time dimensions. Returns structured data rows.
48
+ *
49
+ * @param {string} asset_id
50
+ * @param {AthenaIntelligence.SemanticModelQueryRequestIn} request
51
+ * @param {SemanticModelClient.RequestOptions} requestOptions - Request-specific configuration.
52
+ *
53
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
54
+ * @throws {@link AthenaIntelligence.NotFoundError}
55
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
56
+ * @throws {@link AthenaIntelligence.BadGatewayError}
57
+ *
58
+ * @example
59
+ * await client.semanticModel.query("asset_id", {
60
+ * measures: ["orders.count", "orders.total_revenue"]
61
+ * })
62
+ */
63
+ query(asset_id: string, request: AthenaIntelligence.SemanticModelQueryRequestIn, requestOptions?: SemanticModelClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.SemanticModelQueryResponseOut>;
64
+ private __query;
65
+ }
@@ -0,0 +1,264 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
12
+ import { mergeHeaders } from "../../../../core/headers.mjs";
13
+ import * as core from "../../../../core/index.mjs";
14
+ import * as environments from "../../../../environments.mjs";
15
+ import * as errors from "../../../../errors/index.mjs";
16
+ import * as AthenaIntelligence from "../../../index.mjs";
17
+ export class SemanticModelClient {
18
+ constructor(options) {
19
+ this._options = normalizeClientOptionsWithAuth(options);
20
+ }
21
+ /**
22
+ * Generate a short-lived JWT token for direct access to the semantic model's Cube REST API. Use this token to query /cubejs-api/v1/load and /cubejs-api/v1/meta directly. Token expires after 1 hour. The token carries only the model ID and schema hash — database credentials are NOT included and are resolved server-side by Cube via callback.
23
+ *
24
+ * @param {string} asset_id
25
+ * @param {SemanticModelClient.RequestOptions} requestOptions - Request-specific configuration.
26
+ *
27
+ * @throws {@link AthenaIntelligence.BadRequestError}
28
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
29
+ * @throws {@link AthenaIntelligence.NotFoundError}
30
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
31
+ *
32
+ * @example
33
+ * await client.semanticModel.generateToken("asset_id")
34
+ */
35
+ generateToken(asset_id, requestOptions) {
36
+ return core.HttpResponsePromise.fromPromise(this.__generateToken(asset_id, requestOptions));
37
+ }
38
+ __generateToken(asset_id, requestOptions) {
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
41
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
42
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
43
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
44
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, `api/v0/semantic-model/${core.url.encodePathParam(asset_id)}/generate-token`),
45
+ method: "POST",
46
+ headers: _headers,
47
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
48
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
49
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
50
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
51
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
52
+ logging: this._options.logging,
53
+ });
54
+ if (_response.ok) {
55
+ return {
56
+ data: _response.body,
57
+ rawResponse: _response.rawResponse,
58
+ };
59
+ }
60
+ if (_response.error.reason === "status-code") {
61
+ switch (_response.error.statusCode) {
62
+ case 400:
63
+ throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
64
+ case 401:
65
+ throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
66
+ case 404:
67
+ throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
68
+ case 422:
69
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
70
+ default:
71
+ throw new errors.AthenaIntelligenceError({
72
+ statusCode: _response.error.statusCode,
73
+ body: _response.error.body,
74
+ rawResponse: _response.rawResponse,
75
+ });
76
+ }
77
+ }
78
+ switch (_response.error.reason) {
79
+ case "non-json":
80
+ throw new errors.AthenaIntelligenceError({
81
+ statusCode: _response.error.statusCode,
82
+ body: _response.error.rawBody,
83
+ rawResponse: _response.rawResponse,
84
+ });
85
+ case "body-is-null":
86
+ throw new errors.AthenaIntelligenceError({
87
+ statusCode: _response.error.statusCode,
88
+ rawResponse: _response.rawResponse,
89
+ });
90
+ case "timeout":
91
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/semantic-model/{asset_id}/generate-token.");
92
+ case "unknown":
93
+ throw new errors.AthenaIntelligenceError({
94
+ message: _response.error.errorMessage,
95
+ rawResponse: _response.rawResponse,
96
+ });
97
+ }
98
+ });
99
+ }
100
+ /**
101
+ * Get metadata for a semantic model including all cubes, measures, dimensions, segments, and joins.
102
+ *
103
+ * @param {string} asset_id
104
+ * @param {SemanticModelClient.RequestOptions} requestOptions - Request-specific configuration.
105
+ *
106
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
107
+ * @throws {@link AthenaIntelligence.NotFoundError}
108
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
109
+ * @throws {@link AthenaIntelligence.BadGatewayError}
110
+ *
111
+ * @example
112
+ * await client.semanticModel.getMeta("asset_id")
113
+ */
114
+ getMeta(asset_id, requestOptions) {
115
+ return core.HttpResponsePromise.fromPromise(this.__getMeta(asset_id, requestOptions));
116
+ }
117
+ __getMeta(asset_id, requestOptions) {
118
+ return __awaiter(this, void 0, void 0, function* () {
119
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
120
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
121
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
122
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
123
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, `api/v0/semantic-model/${core.url.encodePathParam(asset_id)}/meta`),
124
+ method: "GET",
125
+ headers: _headers,
126
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
127
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
128
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
129
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
130
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
131
+ logging: this._options.logging,
132
+ });
133
+ if (_response.ok) {
134
+ return {
135
+ data: _response.body,
136
+ rawResponse: _response.rawResponse,
137
+ };
138
+ }
139
+ if (_response.error.reason === "status-code") {
140
+ switch (_response.error.statusCode) {
141
+ case 401:
142
+ throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
143
+ case 404:
144
+ throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
145
+ case 422:
146
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
147
+ case 502:
148
+ throw new AthenaIntelligence.BadGatewayError(_response.error.body, _response.rawResponse);
149
+ default:
150
+ throw new errors.AthenaIntelligenceError({
151
+ statusCode: _response.error.statusCode,
152
+ body: _response.error.body,
153
+ rawResponse: _response.rawResponse,
154
+ });
155
+ }
156
+ }
157
+ switch (_response.error.reason) {
158
+ case "non-json":
159
+ throw new errors.AthenaIntelligenceError({
160
+ statusCode: _response.error.statusCode,
161
+ body: _response.error.rawBody,
162
+ rawResponse: _response.rawResponse,
163
+ });
164
+ case "body-is-null":
165
+ throw new errors.AthenaIntelligenceError({
166
+ statusCode: _response.error.statusCode,
167
+ rawResponse: _response.rawResponse,
168
+ });
169
+ case "timeout":
170
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/semantic-model/{asset_id}/meta.");
171
+ case "unknown":
172
+ throw new errors.AthenaIntelligenceError({
173
+ message: _response.error.errorMessage,
174
+ rawResponse: _response.rawResponse,
175
+ });
176
+ }
177
+ });
178
+ }
179
+ /**
180
+ * Execute a metric query against a semantic model. Specify measures, optional dimensions, filters, and time dimensions. Returns structured data rows.
181
+ *
182
+ * @param {string} asset_id
183
+ * @param {AthenaIntelligence.SemanticModelQueryRequestIn} request
184
+ * @param {SemanticModelClient.RequestOptions} requestOptions - Request-specific configuration.
185
+ *
186
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
187
+ * @throws {@link AthenaIntelligence.NotFoundError}
188
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
189
+ * @throws {@link AthenaIntelligence.BadGatewayError}
190
+ *
191
+ * @example
192
+ * await client.semanticModel.query("asset_id", {
193
+ * measures: ["orders.count", "orders.total_revenue"]
194
+ * })
195
+ */
196
+ query(asset_id, request, requestOptions) {
197
+ return core.HttpResponsePromise.fromPromise(this.__query(asset_id, request, requestOptions));
198
+ }
199
+ __query(asset_id, request, requestOptions) {
200
+ return __awaiter(this, void 0, void 0, function* () {
201
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
202
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
203
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
204
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
205
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, `api/v0/semantic-model/${core.url.encodePathParam(asset_id)}/query`),
206
+ method: "POST",
207
+ headers: _headers,
208
+ contentType: "application/json",
209
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
210
+ requestType: "json",
211
+ body: request,
212
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
213
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
214
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
215
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
216
+ logging: this._options.logging,
217
+ });
218
+ if (_response.ok) {
219
+ return {
220
+ data: _response.body,
221
+ rawResponse: _response.rawResponse,
222
+ };
223
+ }
224
+ if (_response.error.reason === "status-code") {
225
+ switch (_response.error.statusCode) {
226
+ case 401:
227
+ throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
228
+ case 404:
229
+ throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
230
+ case 422:
231
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
232
+ case 502:
233
+ throw new AthenaIntelligence.BadGatewayError(_response.error.body, _response.rawResponse);
234
+ default:
235
+ throw new errors.AthenaIntelligenceError({
236
+ statusCode: _response.error.statusCode,
237
+ body: _response.error.body,
238
+ rawResponse: _response.rawResponse,
239
+ });
240
+ }
241
+ }
242
+ switch (_response.error.reason) {
243
+ case "non-json":
244
+ throw new errors.AthenaIntelligenceError({
245
+ statusCode: _response.error.statusCode,
246
+ body: _response.error.rawBody,
247
+ rawResponse: _response.rawResponse,
248
+ });
249
+ case "body-is-null":
250
+ throw new errors.AthenaIntelligenceError({
251
+ statusCode: _response.error.statusCode,
252
+ rawResponse: _response.rawResponse,
253
+ });
254
+ case "timeout":
255
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/semantic-model/{asset_id}/query.");
256
+ case "unknown":
257
+ throw new errors.AthenaIntelligenceError({
258
+ message: _response.error.errorMessage,
259
+ rawResponse: _response.rawResponse,
260
+ });
261
+ }
262
+ });
263
+ }
264
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * measures: ["orders.count", "orders.total_revenue"]
5
+ * }
6
+ */
7
+ export interface SemanticModelQueryRequestIn {
8
+ /** Optional dimension identifiers for grouping */
9
+ dimensions?: string[];
10
+ /** Optional filters */
11
+ filters?: Record<string, unknown>[];
12
+ /** Maximum rows to return */
13
+ limit?: number;
14
+ /** List of measure identifiers, e.g. ["orders.total_revenue"] */
15
+ measures: string[];
16
+ /** Optional time dimension configs */
17
+ time_dimensions?: Record<string, unknown>[];
18
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1 @@
1
+ export type { SemanticModelQueryRequestIn } from "./SemanticModelQueryRequestIn.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./client/index.mjs";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Error response from semantic model operations.
3
+ */
4
+ export interface SemanticModelErrorResponse {
5
+ message: string;
6
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Metadata response listing cubes, measures, and dimensions.
3
+ */
4
+ export interface SemanticModelMetaResponseOut {
5
+ /** List of cubes with their measures and dimensions */
6
+ cubes: Record<string, unknown>[];
7
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Response from a semantic model query.
3
+ */
4
+ export interface SemanticModelQueryResponseOut {
5
+ /** Query result rows */
6
+ data: Record<string, unknown>[];
7
+ /** Number of rows returned */
8
+ row_count: number;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Response containing a short-lived Cube API token.
3
+ */
4
+ export interface SemanticModelTokenResponseOut {
5
+ /** Base URL of the Cube instance */
6
+ cube_url: string;
7
+ /** ISO 8601 timestamp when the token expires */
8
+ expires_at: string;
9
+ /** JWT for direct Cube REST API access */
10
+ token: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -52,6 +52,10 @@ export * from "./PublicAssetOut.mjs";
52
52
  export * from "./ResearchAgentResponse.mjs";
53
53
  export * from "./RunTaskResponse.mjs";
54
54
  export * from "./SaveAssetRequestOut.mjs";
55
+ export * from "./SemanticModelErrorResponse.mjs";
56
+ export * from "./SemanticModelMetaResponseOut.mjs";
57
+ export * from "./SemanticModelQueryResponseOut.mjs";
58
+ export * from "./SemanticModelTokenResponseOut.mjs";
55
59
  export * from "./Sheet.mjs";
56
60
  export * from "./SheetOperationResponse.mjs";
57
61
  export * from "./SqlAgentResponse.mjs";
@@ -52,6 +52,10 @@ export * from "./PublicAssetOut.mjs";
52
52
  export * from "./ResearchAgentResponse.mjs";
53
53
  export * from "./RunTaskResponse.mjs";
54
54
  export * from "./SaveAssetRequestOut.mjs";
55
+ export * from "./SemanticModelErrorResponse.mjs";
56
+ export * from "./SemanticModelMetaResponseOut.mjs";
57
+ export * from "./SemanticModelQueryResponseOut.mjs";
58
+ export * from "./SemanticModelTokenResponseOut.mjs";
55
59
  export * from "./Sheet.mjs";
56
60
  export * from "./SheetOperationResponse.mjs";
57
61
  export * from "./SqlAgentResponse.mjs";