polytomic 25.9.5 → 25.9.7
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.
- package/BaseClient.js +2 -2
- package/api/resources/bulkSync/client/Client.d.ts +4 -2
- package/api/resources/bulkSync/client/Client.js +4 -2
- package/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +1 -1
- package/api/resources/bulkSync/resources/schemas/client/Client.d.ts +1 -0
- package/api/resources/bulkSync/resources/schemas/client/Client.js +3 -0
- package/api/resources/harbors/client/Client.d.ts +424 -0
- package/api/resources/harbors/client/Client.js +946 -0
- package/api/resources/harbors/client/requests/CreateHarborSavedQueryDraftRequest.d.ts +24 -0
- package/api/resources/harbors/client/requests/CreateHarborSavedQueryDraftRequest.js +3 -0
- package/api/resources/harbors/client/requests/ExecuteHarborSavedQueryRequest.d.ts +10 -0
- package/api/resources/harbors/client/requests/ExecuteHarborSavedQueryRequest.js +3 -0
- package/api/resources/harbors/client/requests/HarborsGetSavedQueryRequest.d.ts +8 -0
- package/api/resources/harbors/client/requests/HarborsGetSavedQueryRequest.js +3 -0
- package/api/resources/harbors/client/requests/HarborsListSavedQueriesRequest.d.ts +15 -0
- package/api/resources/harbors/client/requests/HarborsListSavedQueriesRequest.js +3 -0
- package/api/resources/harbors/client/requests/HarborsListSavedQueryDraftsRequest.d.ts +13 -0
- package/api/resources/harbors/client/requests/HarborsListSavedQueryDraftsRequest.js +3 -0
- package/api/resources/harbors/client/requests/SaveHarborSavedQueryDraftRequest.d.ts +24 -0
- package/api/resources/harbors/client/requests/SaveHarborSavedQueryDraftRequest.js +3 -0
- package/api/resources/harbors/client/requests/index.d.ts +6 -0
- package/api/resources/modelSync/client/requests/CreateModelSyncV5Request.d.ts +3 -0
- package/api/resources/modelSync/client/requests/UpdateModelSyncV5Request.d.ts +3 -0
- package/api/types/DeletedHarborSavedQueryDraftEnvelope.d.ts +9 -0
- package/api/types/DeletedHarborSavedQueryDraftEnvelope.js +3 -0
- package/api/types/DeletedHarborSavedQueryEnvelope.d.ts +9 -0
- package/api/types/DeletedHarborSavedQueryEnvelope.js +3 -0
- package/api/types/ExecuteHarborSavedQueryEnvelope.d.ts +27 -0
- package/api/types/ExecuteHarborSavedQueryEnvelope.js +3 -0
- package/api/types/HarborResponse.d.ts +2 -0
- package/api/types/HarborSavedQueryDraftEnvelope.d.ts +4 -0
- package/api/types/HarborSavedQueryDraftEnvelope.js +3 -0
- package/api/types/HarborSavedQueryDraftListEnvelope.d.ts +5 -0
- package/api/types/HarborSavedQueryDraftListEnvelope.js +3 -0
- package/api/types/HarborSavedQueryDraftResponse.d.ts +33 -0
- package/api/types/HarborSavedQueryDraftResponse.js +3 -0
- package/api/types/HarborSavedQueryEnvelope.d.ts +4 -0
- package/api/types/HarborSavedQueryEnvelope.js +3 -0
- package/api/types/HarborSavedQueryListEnvelope.d.ts +5 -0
- package/api/types/HarborSavedQueryListEnvelope.js +3 -0
- package/api/types/HarborSavedQueryMetadataResponse.d.ts +20 -0
- package/api/types/HarborSavedQueryMetadataResponse.js +3 -0
- package/api/types/HarborSavedQueryParameter.d.ts +22 -0
- package/api/types/HarborSavedQueryParameter.js +16 -0
- package/api/types/HarborSavedQueryPreviewResponse.d.ts +8 -0
- package/api/types/HarborSavedQueryPreviewResponse.js +3 -0
- package/api/types/HarborSavedQueryResponse.d.ts +31 -0
- package/api/types/HarborSavedQueryResponse.js +3 -0
- package/api/types/HarborSavedQueryValidationEnvelope.d.ts +4 -0
- package/api/types/HarborSavedQueryValidationEnvelope.js +3 -0
- package/api/types/HarboractivityapiHarborActivityEvent.d.ts +1 -0
- package/api/types/HarboractivityapiHarborActivityMetadata.d.ts +3 -0
- package/api/types/HarboractivityapiHarborActivityQuerySource.d.ts +7 -0
- package/api/types/HarboractivityapiHarborActivityQuerySource.js +3 -0
- package/api/types/HarboractivityapiHarborActivitySavedQuerySource.d.ts +7 -0
- package/api/types/HarboractivityapiHarborActivitySavedQuerySource.js +3 -0
- package/api/types/HarboractivityapiHarborActivityTarget.d.ts +2 -0
- package/api/types/ModelSyncIdentities.d.ts +18 -0
- package/api/types/ModelSyncIdentities.js +12 -0
- package/api/types/ModelSyncProblem.d.ts +10 -0
- package/api/types/ModelSyncProblem.js +3 -0
- package/api/types/ModelSyncV5Response.d.ts +5 -0
- package/api/types/SyncDestinationProperties.d.ts +2 -0
- package/api/types/TypesDefinition.d.ts +4 -1
- package/api/types/UserFieldRequest.d.ts +3 -1
- package/api/types/index.d.ts +17 -0
- package/api/types/index.js +17 -0
- package/package.json +1 -1
- package/reference.md +956 -2
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -456,6 +456,11 @@ class HarborsClient {
|
|
|
456
456
|
*
|
|
457
457
|
* For `customer_managed`, `backing_connection_id` must identify a queryable Connection that your credential can access.
|
|
458
458
|
*
|
|
459
|
+
* Managed Harbors return with `status: provisioning` while Polytomic sets up their
|
|
460
|
+
* storage in the background. Poll `GET /api/harbors/{harbor_id}` until the status is
|
|
461
|
+
* `ready` before adding sources or querying data. If provisioning fails, the status
|
|
462
|
+
* is `provisioning_failed` and Polytomic retries automatically.
|
|
463
|
+
*
|
|
459
464
|
* @param {Polytomic.CreateHarborRequest} request
|
|
460
465
|
* @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
461
466
|
*
|
|
@@ -665,6 +670,10 @@ class HarborsClient {
|
|
|
665
670
|
* >
|
|
666
671
|
* > Deleting a Harbor revokes its credentials, context documents, and user assignments. A customer-managed backing Connection remains available. Polytomic deletes a managed backing Connection only when no other resource uses it.
|
|
667
672
|
*
|
|
673
|
+
* The response confirms that access has been revoked. Polytomic removes managed
|
|
674
|
+
* storage in the background and retries failed cleanup automatically. You can also
|
|
675
|
+
* delete a Harbor while it is provisioning.
|
|
676
|
+
*
|
|
668
677
|
* @param {string} harbor_id - Unique identifier of the Harbor.
|
|
669
678
|
* @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
670
679
|
*
|
|
@@ -1921,6 +1930,943 @@ class HarborsClient {
|
|
|
1921
1930
|
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/api/harbors/{harbor_id}/keys/{key_id}");
|
|
1922
1931
|
});
|
|
1923
1932
|
}
|
|
1933
|
+
/**
|
|
1934
|
+
* Lists current published saved queries for a Harbor.
|
|
1935
|
+
*
|
|
1936
|
+
* Saved queries are supported only for Polytomic-managed Harbors whose backing
|
|
1937
|
+
* Connection type is `polytomic_harbor`.
|
|
1938
|
+
*
|
|
1939
|
+
* Collection items contain current published metadata and omit SQL, parameter
|
|
1940
|
+
* values, and unpublished drafts. A Harbor profile credential can list saved
|
|
1941
|
+
* queries only when `harbor_id` identifies its own Harbor.
|
|
1942
|
+
*
|
|
1943
|
+
* ## Harbor Activity
|
|
1944
|
+
*
|
|
1945
|
+
* When you use a Harbor profile credential, send a new nonzero UUID in
|
|
1946
|
+
* `X-Polytomic-Activity-Request-ID` for each request, including each page. A
|
|
1947
|
+
* missing or invalid ID returns `400 Bad Request`. Reusing a consumed ID returns
|
|
1948
|
+
* `409 Conflict`.
|
|
1949
|
+
*
|
|
1950
|
+
* If you supply `X-Polytomic-Harbor-Session`, the session must be active and bound
|
|
1951
|
+
* to your credential and Harbor. An invalid session returns `403 Forbidden`.
|
|
1952
|
+
* Direct scoped REST requests may omit the session header.
|
|
1953
|
+
*
|
|
1954
|
+
* Polytomic records `saved_query.listed` before returning data. The event describes
|
|
1955
|
+
* only the returned page, including saved-query IDs, immutable revision IDs,
|
|
1956
|
+
* version numbers, and bounded name snapshots. Activity excludes SQL, parameter
|
|
1957
|
+
* values, and expected column names. If Polytomic cannot record the event, the
|
|
1958
|
+
* request returns `503 Service Unavailable` without saved-query data.
|
|
1959
|
+
*
|
|
1960
|
+
* @param {string} harbor_id - Unique identifier of the Harbor.
|
|
1961
|
+
* @param {Polytomic.HarborsListSavedQueriesRequest} request
|
|
1962
|
+
* @param {HarborsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
1963
|
+
*
|
|
1964
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
1965
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
1966
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
1967
|
+
* @throws {@link Polytomic.ConflictError}
|
|
1968
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
1969
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
1970
|
+
* @throws {@link Polytomic.ServiceUnavailableError}
|
|
1971
|
+
* @throws {@link errors.PolytomicError}
|
|
1972
|
+
* @throws {@link errors.PolytomicTimeoutError}
|
|
1973
|
+
*
|
|
1974
|
+
* @example
|
|
1975
|
+
* await client.harbors.listSavedQueries("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
1976
|
+
* limit: 1,
|
|
1977
|
+
* page_token: "page_token"
|
|
1978
|
+
* })
|
|
1979
|
+
*/
|
|
1980
|
+
listSavedQueries(harbor_id, request = {}, requestOptions) {
|
|
1981
|
+
return core.HttpResponsePromise.fromPromise(this.__listSavedQueries(harbor_id, request, requestOptions));
|
|
1982
|
+
}
|
|
1983
|
+
__listSavedQueries(harbor_id_1) {
|
|
1984
|
+
return __awaiter(this, arguments, void 0, function* (harbor_id, request = {}, requestOptions) {
|
|
1985
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
1986
|
+
const { limit, page_token: pageToken, "X-Polytomic-Harbor-Session": polytomicHarborSession, "X-Polytomic-Activity-Request-ID": polytomicActivityRequestId, } = request;
|
|
1987
|
+
const _queryParams = {
|
|
1988
|
+
limit,
|
|
1989
|
+
page_token: pageToken,
|
|
1990
|
+
};
|
|
1991
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
1992
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
|
|
1993
|
+
"X-Polytomic-Harbor-Session": polytomicHarborSession,
|
|
1994
|
+
"X-Polytomic-Activity-Request-ID": polytomicActivityRequestId,
|
|
1995
|
+
"X-Polytomic-Version": (_d = (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : "2025-09-18",
|
|
1996
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
1997
|
+
const _response = yield core.fetcher({
|
|
1998
|
+
url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.PolytomicEnvironment.Default, `api/harbors/${core.url.encodePathParam(harbor_id)}/saved-queries`),
|
|
1999
|
+
method: "GET",
|
|
2000
|
+
headers: _headers,
|
|
2001
|
+
queryString: core.url
|
|
2002
|
+
.queryBuilder()
|
|
2003
|
+
.addMany(_queryParams)
|
|
2004
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
2005
|
+
.build(),
|
|
2006
|
+
timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
|
|
2007
|
+
maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
|
|
2008
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2009
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
2010
|
+
logging: this._options.logging,
|
|
2011
|
+
});
|
|
2012
|
+
if (_response.ok) {
|
|
2013
|
+
return {
|
|
2014
|
+
data: _response.body,
|
|
2015
|
+
rawResponse: _response.rawResponse,
|
|
2016
|
+
};
|
|
2017
|
+
}
|
|
2018
|
+
if (_response.error.reason === "status-code") {
|
|
2019
|
+
switch (_response.error.statusCode) {
|
|
2020
|
+
case 400:
|
|
2021
|
+
throw new Polytomic.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2022
|
+
case 403:
|
|
2023
|
+
throw new Polytomic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2024
|
+
case 404:
|
|
2025
|
+
throw new Polytomic.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2026
|
+
case 409:
|
|
2027
|
+
throw new Polytomic.ConflictError(_response.error.body, _response.rawResponse);
|
|
2028
|
+
case 422:
|
|
2029
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
2030
|
+
case 500:
|
|
2031
|
+
throw new Polytomic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2032
|
+
case 503:
|
|
2033
|
+
throw new Polytomic.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
2034
|
+
default:
|
|
2035
|
+
throw new errors.PolytomicError({
|
|
2036
|
+
statusCode: _response.error.statusCode,
|
|
2037
|
+
body: _response.error.body,
|
|
2038
|
+
rawResponse: _response.rawResponse,
|
|
2039
|
+
});
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/api/harbors/{harbor_id}/saved-queries");
|
|
2043
|
+
});
|
|
2044
|
+
}
|
|
2045
|
+
/**
|
|
2046
|
+
* Creates a stable Harbor saved query with its initial mutable draft.
|
|
2047
|
+
*
|
|
2048
|
+
* Saved queries are supported only for Polytomic-managed Harbors whose backing
|
|
2049
|
+
* Connection type is `polytomic_harbor`. Customer-managed Harbor backings return
|
|
2050
|
+
* an unsupported-backing error.
|
|
2051
|
+
*
|
|
2052
|
+
* The saved query receives a stable ID, but it remains absent from published
|
|
2053
|
+
* saved-query reads until an administrator publishes its initial draft.
|
|
2054
|
+
*
|
|
2055
|
+
* Use `{{parameter_name}}` references in `sql_template`. Each reference must have
|
|
2056
|
+
* one scalar declaration. Validation values and defaults must match the declared
|
|
2057
|
+
* `string`, `number`, `boolean`, `date`, `timestamp`, or `uuid` type.
|
|
2058
|
+
*
|
|
2059
|
+
* Unknown JSON fields, including fields inside parameter declarations, return
|
|
2060
|
+
* `400 Bad Request` before the draft is saved. Use `default_value`, not `default`,
|
|
2061
|
+
* for parameter defaults.
|
|
2062
|
+
*
|
|
2063
|
+
* When you omit a parameter during execution, Polytomic uses its published
|
|
2064
|
+
* `default_value`, never its draft validation value. An omitted optional parameter
|
|
2065
|
+
* without a default binds SQL `NULL`. A required parameter allows omission when a
|
|
2066
|
+
* default exists, but rejects explicit `null` even with a default.
|
|
2067
|
+
*
|
|
2068
|
+
* For a report window, use a required parameter with a default so omission selects
|
|
2069
|
+
* a useful window and explicit `null` is rejected:
|
|
2070
|
+
*
|
|
2071
|
+
* ```json
|
|
2072
|
+
* {"name": "days", "type": "number", "required": true, "default_value": 7}
|
|
2073
|
+
* ```
|
|
2074
|
+
*
|
|
2075
|
+
* @param {string} harbor_id - Unique identifier of the Harbor.
|
|
2076
|
+
* @param {Polytomic.CreateHarborSavedQueryDraftRequest} request
|
|
2077
|
+
* @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
2078
|
+
*
|
|
2079
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
2080
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
2081
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
2082
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
2083
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
2084
|
+
* @throws {@link errors.PolytomicError}
|
|
2085
|
+
* @throws {@link errors.PolytomicTimeoutError}
|
|
2086
|
+
*
|
|
2087
|
+
* @example
|
|
2088
|
+
* await client.harbors.createSavedQueryDraft("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
2089
|
+
* name: "Monthly revenue",
|
|
2090
|
+
* sql_template: "SELECT account_id, sum(amount) AS revenue FROM orders WHERE created_at >= {{start_date}} GROUP BY account_id"
|
|
2091
|
+
* })
|
|
2092
|
+
*/
|
|
2093
|
+
createSavedQueryDraft(harbor_id, request, requestOptions) {
|
|
2094
|
+
return core.HttpResponsePromise.fromPromise(this.__createSavedQueryDraft(harbor_id, request, requestOptions));
|
|
2095
|
+
}
|
|
2096
|
+
__createSavedQueryDraft(harbor_id, request, requestOptions) {
|
|
2097
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2098
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2099
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
2100
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
|
|
2101
|
+
"Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey,
|
|
2102
|
+
"X-Polytomic-Version": (_d = (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : "2025-09-18",
|
|
2103
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2104
|
+
const _response = yield core.fetcher({
|
|
2105
|
+
url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.PolytomicEnvironment.Default, `api/harbors/${core.url.encodePathParam(harbor_id)}/saved-queries`),
|
|
2106
|
+
method: "POST",
|
|
2107
|
+
headers: _headers,
|
|
2108
|
+
contentType: "application/json",
|
|
2109
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
2110
|
+
requestType: "json",
|
|
2111
|
+
body: (0, requestBody_1.mergeAdditionalBodyParameters)(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
2112
|
+
timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
|
|
2113
|
+
maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
|
|
2114
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2115
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
2116
|
+
logging: this._options.logging,
|
|
2117
|
+
});
|
|
2118
|
+
if (_response.ok) {
|
|
2119
|
+
return {
|
|
2120
|
+
data: _response.body,
|
|
2121
|
+
rawResponse: _response.rawResponse,
|
|
2122
|
+
};
|
|
2123
|
+
}
|
|
2124
|
+
if (_response.error.reason === "status-code") {
|
|
2125
|
+
switch (_response.error.statusCode) {
|
|
2126
|
+
case 400:
|
|
2127
|
+
throw new Polytomic.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2128
|
+
case 403:
|
|
2129
|
+
throw new Polytomic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2130
|
+
case 404:
|
|
2131
|
+
throw new Polytomic.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2132
|
+
case 422:
|
|
2133
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
2134
|
+
case 500:
|
|
2135
|
+
throw new Polytomic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2136
|
+
default:
|
|
2137
|
+
throw new errors.PolytomicError({
|
|
2138
|
+
statusCode: _response.error.statusCode,
|
|
2139
|
+
body: _response.error.body,
|
|
2140
|
+
rawResponse: _response.rawResponse,
|
|
2141
|
+
});
|
|
2142
|
+
}
|
|
2143
|
+
}
|
|
2144
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/api/harbors/{harbor_id}/saved-queries");
|
|
2145
|
+
});
|
|
2146
|
+
}
|
|
2147
|
+
/**
|
|
2148
|
+
* Lists mutable Harbor saved-query drafts.
|
|
2149
|
+
*
|
|
2150
|
+
* Drafts are ordered from newest to oldest and include complete SQL, typed
|
|
2151
|
+
* parameter declarations, and author-supplied validation values. Harbor profile
|
|
2152
|
+
* credentials cannot access this endpoint.
|
|
2153
|
+
*
|
|
2154
|
+
* @param {string} harbor_id - Unique identifier of the Harbor.
|
|
2155
|
+
* @param {Polytomic.HarborsListSavedQueryDraftsRequest} request
|
|
2156
|
+
* @param {HarborsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
2157
|
+
*
|
|
2158
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
2159
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
2160
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
2161
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
2162
|
+
* @throws {@link errors.PolytomicError}
|
|
2163
|
+
* @throws {@link errors.PolytomicTimeoutError}
|
|
2164
|
+
*
|
|
2165
|
+
* @example
|
|
2166
|
+
* await client.harbors.listSavedQueryDrafts("248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
2167
|
+
* limit: 1,
|
|
2168
|
+
* page_token: "page_token"
|
|
2169
|
+
* })
|
|
2170
|
+
*/
|
|
2171
|
+
listSavedQueryDrafts(harbor_id, request = {}, requestOptions) {
|
|
2172
|
+
return core.HttpResponsePromise.fromPromise(this.__listSavedQueryDrafts(harbor_id, request, requestOptions));
|
|
2173
|
+
}
|
|
2174
|
+
__listSavedQueryDrafts(harbor_id_1) {
|
|
2175
|
+
return __awaiter(this, arguments, void 0, function* (harbor_id, request = {}, requestOptions) {
|
|
2176
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2177
|
+
const { limit, page_token: pageToken } = request;
|
|
2178
|
+
const _queryParams = {
|
|
2179
|
+
limit,
|
|
2180
|
+
page_token: pageToken,
|
|
2181
|
+
};
|
|
2182
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
2183
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
|
|
2184
|
+
"X-Polytomic-Version": (_d = (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : "2025-09-18",
|
|
2185
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2186
|
+
const _response = yield core.fetcher({
|
|
2187
|
+
url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.PolytomicEnvironment.Default, `api/harbors/${core.url.encodePathParam(harbor_id)}/saved-queries/drafts`),
|
|
2188
|
+
method: "GET",
|
|
2189
|
+
headers: _headers,
|
|
2190
|
+
queryString: core.url
|
|
2191
|
+
.queryBuilder()
|
|
2192
|
+
.addMany(_queryParams)
|
|
2193
|
+
.mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams)
|
|
2194
|
+
.build(),
|
|
2195
|
+
timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
|
|
2196
|
+
maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
|
|
2197
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2198
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
2199
|
+
logging: this._options.logging,
|
|
2200
|
+
});
|
|
2201
|
+
if (_response.ok) {
|
|
2202
|
+
return {
|
|
2203
|
+
data: _response.body,
|
|
2204
|
+
rawResponse: _response.rawResponse,
|
|
2205
|
+
};
|
|
2206
|
+
}
|
|
2207
|
+
if (_response.error.reason === "status-code") {
|
|
2208
|
+
switch (_response.error.statusCode) {
|
|
2209
|
+
case 403:
|
|
2210
|
+
throw new Polytomic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2211
|
+
case 404:
|
|
2212
|
+
throw new Polytomic.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2213
|
+
case 422:
|
|
2214
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
2215
|
+
case 500:
|
|
2216
|
+
throw new Polytomic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2217
|
+
default:
|
|
2218
|
+
throw new errors.PolytomicError({
|
|
2219
|
+
statusCode: _response.error.statusCode,
|
|
2220
|
+
body: _response.error.body,
|
|
2221
|
+
rawResponse: _response.rawResponse,
|
|
2222
|
+
});
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/api/harbors/{harbor_id}/saved-queries/drafts");
|
|
2226
|
+
});
|
|
2227
|
+
}
|
|
2228
|
+
/**
|
|
2229
|
+
* Returns the current published version of one Harbor saved query.
|
|
2230
|
+
*
|
|
2231
|
+
* The response contains the current immutable `revision_id`, SQL template,
|
|
2232
|
+
* parameter contract, expected columns, and publication provenance. Validation
|
|
2233
|
+
* inputs are draft-only and are never part of a published response.
|
|
2234
|
+
*
|
|
2235
|
+
* A Harbor profile credential can retrieve a saved query only from its own Harbor.
|
|
2236
|
+
*
|
|
2237
|
+
* ## Harbor Activity
|
|
2238
|
+
*
|
|
2239
|
+
* When you use a Harbor profile credential, send a new nonzero UUID in
|
|
2240
|
+
* `X-Polytomic-Activity-Request-ID` for each request. A missing or invalid ID
|
|
2241
|
+
* returns `400 Bad Request`. Reusing a consumed ID returns `409 Conflict`.
|
|
2242
|
+
*
|
|
2243
|
+
* If you supply `X-Polytomic-Harbor-Session`, the session must be active and bound
|
|
2244
|
+
* to your credential and Harbor. An invalid session returns `403 Forbidden`.
|
|
2245
|
+
* Direct scoped REST requests may omit the session header.
|
|
2246
|
+
*
|
|
2247
|
+
* Polytomic records `saved_query.fetched` before returning the definition. The
|
|
2248
|
+
* event identifies the saved query, exact immutable revision, published version,
|
|
2249
|
+
* and bounded name snapshot. It does not indicate query execution. Activity
|
|
2250
|
+
* excludes SQL, parameter defaults and validation values, expected column names,
|
|
2251
|
+
* and result rows. If Polytomic cannot record the event, the request returns
|
|
2252
|
+
* `503 Service Unavailable` without saved-query data.
|
|
2253
|
+
*
|
|
2254
|
+
* @param {string} harbor_id - Unique identifier of the Harbor.
|
|
2255
|
+
* @param {string} saved_query_id - Unique stable identifier of the saved query.
|
|
2256
|
+
* @param {Polytomic.HarborsGetSavedQueryRequest} request
|
|
2257
|
+
* @param {HarborsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
2258
|
+
*
|
|
2259
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
2260
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
2261
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
2262
|
+
* @throws {@link Polytomic.ConflictError}
|
|
2263
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
2264
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
2265
|
+
* @throws {@link Polytomic.ServiceUnavailableError}
|
|
2266
|
+
* @throws {@link errors.PolytomicError}
|
|
2267
|
+
* @throws {@link errors.PolytomicTimeoutError}
|
|
2268
|
+
*
|
|
2269
|
+
* @example
|
|
2270
|
+
* await client.harbors.getSavedQuery("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
2271
|
+
*/
|
|
2272
|
+
getSavedQuery(harbor_id, saved_query_id, request = {}, requestOptions) {
|
|
2273
|
+
return core.HttpResponsePromise.fromPromise(this.__getSavedQuery(harbor_id, saved_query_id, request, requestOptions));
|
|
2274
|
+
}
|
|
2275
|
+
__getSavedQuery(harbor_id_1, saved_query_id_1) {
|
|
2276
|
+
return __awaiter(this, arguments, void 0, function* (harbor_id, saved_query_id, request = {}, requestOptions) {
|
|
2277
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2278
|
+
const { "X-Polytomic-Harbor-Session": polytomicHarborSession, "X-Polytomic-Activity-Request-ID": polytomicActivityRequestId, } = request;
|
|
2279
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
2280
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
|
|
2281
|
+
"X-Polytomic-Harbor-Session": polytomicHarborSession,
|
|
2282
|
+
"X-Polytomic-Activity-Request-ID": polytomicActivityRequestId,
|
|
2283
|
+
"X-Polytomic-Version": (_d = (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : "2025-09-18",
|
|
2284
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2285
|
+
const _response = yield core.fetcher({
|
|
2286
|
+
url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.PolytomicEnvironment.Default, `api/harbors/${core.url.encodePathParam(harbor_id)}/saved-queries/${core.url.encodePathParam(saved_query_id)}`),
|
|
2287
|
+
method: "GET",
|
|
2288
|
+
headers: _headers,
|
|
2289
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
2290
|
+
timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
|
|
2291
|
+
maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
|
|
2292
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2293
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
2294
|
+
logging: this._options.logging,
|
|
2295
|
+
});
|
|
2296
|
+
if (_response.ok) {
|
|
2297
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2298
|
+
}
|
|
2299
|
+
if (_response.error.reason === "status-code") {
|
|
2300
|
+
switch (_response.error.statusCode) {
|
|
2301
|
+
case 400:
|
|
2302
|
+
throw new Polytomic.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2303
|
+
case 403:
|
|
2304
|
+
throw new Polytomic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2305
|
+
case 404:
|
|
2306
|
+
throw new Polytomic.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2307
|
+
case 409:
|
|
2308
|
+
throw new Polytomic.ConflictError(_response.error.body, _response.rawResponse);
|
|
2309
|
+
case 422:
|
|
2310
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
2311
|
+
case 500:
|
|
2312
|
+
throw new Polytomic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2313
|
+
case 503:
|
|
2314
|
+
throw new Polytomic.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
2315
|
+
default:
|
|
2316
|
+
throw new errors.PolytomicError({
|
|
2317
|
+
statusCode: _response.error.statusCode,
|
|
2318
|
+
body: _response.error.body,
|
|
2319
|
+
rawResponse: _response.rawResponse,
|
|
2320
|
+
});
|
|
2321
|
+
}
|
|
2322
|
+
}
|
|
2323
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/api/harbors/{harbor_id}/saved-queries/{saved_query_id}");
|
|
2324
|
+
});
|
|
2325
|
+
}
|
|
2326
|
+
/**
|
|
2327
|
+
* Archives one Harbor saved query and removes it from active reads.
|
|
2328
|
+
*
|
|
2329
|
+
* Archiving removes the saved query and any draft from active reads while
|
|
2330
|
+
* retaining its immutable revisions for provenance. The operation does not run
|
|
2331
|
+
* the saved SQL or modify the Harbor backing Connection. Archiving does not cancel
|
|
2332
|
+
* in-flight execution requests or queued executions.
|
|
2333
|
+
*
|
|
2334
|
+
* This REST operation archives the saved query; it does not merely unpublish it.
|
|
2335
|
+
* Unpublish is available only through the GraphQL `unpublishHarborSavedQuery`
|
|
2336
|
+
* mutation. There is no REST unpublish endpoint.
|
|
2337
|
+
*
|
|
2338
|
+
* @param {string} harbor_id - Unique identifier of the Harbor.
|
|
2339
|
+
* @param {string} saved_query_id - Unique stable identifier of the saved query.
|
|
2340
|
+
* @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
2341
|
+
*
|
|
2342
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
2343
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
2344
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
2345
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
2346
|
+
* @throws {@link errors.PolytomicError}
|
|
2347
|
+
* @throws {@link errors.PolytomicTimeoutError}
|
|
2348
|
+
*
|
|
2349
|
+
* @example
|
|
2350
|
+
* await client.harbors.deleteSavedQuery("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
2351
|
+
*/
|
|
2352
|
+
deleteSavedQuery(harbor_id, saved_query_id, requestOptions) {
|
|
2353
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteSavedQuery(harbor_id, saved_query_id, requestOptions));
|
|
2354
|
+
}
|
|
2355
|
+
__deleteSavedQuery(harbor_id, saved_query_id, requestOptions) {
|
|
2356
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2357
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2358
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
2359
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
|
|
2360
|
+
"Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey,
|
|
2361
|
+
"X-Polytomic-Version": (_d = (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : "2025-09-18",
|
|
2362
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2363
|
+
const _response = yield core.fetcher({
|
|
2364
|
+
url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.PolytomicEnvironment.Default, `api/harbors/${core.url.encodePathParam(harbor_id)}/saved-queries/${core.url.encodePathParam(saved_query_id)}`),
|
|
2365
|
+
method: "DELETE",
|
|
2366
|
+
headers: _headers,
|
|
2367
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
2368
|
+
timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
|
|
2369
|
+
maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
|
|
2370
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2371
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
2372
|
+
logging: this._options.logging,
|
|
2373
|
+
});
|
|
2374
|
+
if (_response.ok) {
|
|
2375
|
+
return {
|
|
2376
|
+
data: _response.body,
|
|
2377
|
+
rawResponse: _response.rawResponse,
|
|
2378
|
+
};
|
|
2379
|
+
}
|
|
2380
|
+
if (_response.error.reason === "status-code") {
|
|
2381
|
+
switch (_response.error.statusCode) {
|
|
2382
|
+
case 403:
|
|
2383
|
+
throw new Polytomic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2384
|
+
case 404:
|
|
2385
|
+
throw new Polytomic.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2386
|
+
case 422:
|
|
2387
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
2388
|
+
case 500:
|
|
2389
|
+
throw new Polytomic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2390
|
+
default:
|
|
2391
|
+
throw new errors.PolytomicError({
|
|
2392
|
+
statusCode: _response.error.statusCode,
|
|
2393
|
+
body: _response.error.body,
|
|
2394
|
+
rawResponse: _response.rawResponse,
|
|
2395
|
+
});
|
|
2396
|
+
}
|
|
2397
|
+
}
|
|
2398
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/api/harbors/{harbor_id}/saved-queries/{saved_query_id}");
|
|
2399
|
+
});
|
|
2400
|
+
}
|
|
2401
|
+
/**
|
|
2402
|
+
* Creates or completely replaces the mutable draft for a Harbor saved query.
|
|
2403
|
+
*
|
|
2404
|
+
* Replacement is complete rather than partial. The next validation or publication
|
|
2405
|
+
* uses the replacement SQL, parameter declarations, and validation values.
|
|
2406
|
+
*
|
|
2407
|
+
* Unknown JSON fields, including fields inside parameter declarations, return
|
|
2408
|
+
* `400 Bad Request` before the draft is saved. Use `default_value`, not `default`,
|
|
2409
|
+
* for parameter defaults.
|
|
2410
|
+
*
|
|
2411
|
+
* When you omit a parameter during execution, Polytomic uses its published
|
|
2412
|
+
* `default_value`, never its draft validation value. An omitted optional parameter
|
|
2413
|
+
* without a default binds SQL `NULL`. A required parameter allows omission when a
|
|
2414
|
+
* default exists, but rejects explicit `null` even with a default.
|
|
2415
|
+
*
|
|
2416
|
+
* For a report window, use a required parameter with a default so omission selects
|
|
2417
|
+
* a useful window and explicit `null` is rejected:
|
|
2418
|
+
*
|
|
2419
|
+
* ```json
|
|
2420
|
+
* {"name": "days", "type": "number", "required": true, "default_value": 7}
|
|
2421
|
+
* ```
|
|
2422
|
+
*
|
|
2423
|
+
* @param {string} harbor_id - Unique identifier of the Harbor.
|
|
2424
|
+
* @param {string} saved_query_id - Unique stable identifier of the saved query.
|
|
2425
|
+
* @param {Polytomic.SaveHarborSavedQueryDraftRequest} request
|
|
2426
|
+
* @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
2427
|
+
*
|
|
2428
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
2429
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
2430
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
2431
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
2432
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
2433
|
+
* @throws {@link errors.PolytomicError}
|
|
2434
|
+
* @throws {@link errors.PolytomicTimeoutError}
|
|
2435
|
+
*
|
|
2436
|
+
* @example
|
|
2437
|
+
* await client.harbors.saveSavedQueryDraft("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d", {
|
|
2438
|
+
* name: "Monthly revenue",
|
|
2439
|
+
* sql_template: "SELECT account_id, sum(amount) AS revenue FROM orders WHERE created_at >= {{start_date}} GROUP BY account_id"
|
|
2440
|
+
* })
|
|
2441
|
+
*/
|
|
2442
|
+
saveSavedQueryDraft(harbor_id, saved_query_id, request, requestOptions) {
|
|
2443
|
+
return core.HttpResponsePromise.fromPromise(this.__saveSavedQueryDraft(harbor_id, saved_query_id, request, requestOptions));
|
|
2444
|
+
}
|
|
2445
|
+
__saveSavedQueryDraft(harbor_id, saved_query_id, request, requestOptions) {
|
|
2446
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2447
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2448
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
2449
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
|
|
2450
|
+
"Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey,
|
|
2451
|
+
"X-Polytomic-Version": (_d = (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : "2025-09-18",
|
|
2452
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2453
|
+
const _response = yield core.fetcher({
|
|
2454
|
+
url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.PolytomicEnvironment.Default, `api/harbors/${core.url.encodePathParam(harbor_id)}/saved-queries/${core.url.encodePathParam(saved_query_id)}/draft`),
|
|
2455
|
+
method: "PUT",
|
|
2456
|
+
headers: _headers,
|
|
2457
|
+
contentType: "application/json",
|
|
2458
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
2459
|
+
requestType: "json",
|
|
2460
|
+
body: (0, requestBody_1.mergeAdditionalBodyParameters)(request, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
2461
|
+
timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
|
|
2462
|
+
maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
|
|
2463
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2464
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
2465
|
+
logging: this._options.logging,
|
|
2466
|
+
});
|
|
2467
|
+
if (_response.ok) {
|
|
2468
|
+
return {
|
|
2469
|
+
data: _response.body,
|
|
2470
|
+
rawResponse: _response.rawResponse,
|
|
2471
|
+
};
|
|
2472
|
+
}
|
|
2473
|
+
if (_response.error.reason === "status-code") {
|
|
2474
|
+
switch (_response.error.statusCode) {
|
|
2475
|
+
case 400:
|
|
2476
|
+
throw new Polytomic.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2477
|
+
case 403:
|
|
2478
|
+
throw new Polytomic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2479
|
+
case 404:
|
|
2480
|
+
throw new Polytomic.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2481
|
+
case 422:
|
|
2482
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
2483
|
+
case 500:
|
|
2484
|
+
throw new Polytomic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2485
|
+
default:
|
|
2486
|
+
throw new errors.PolytomicError({
|
|
2487
|
+
statusCode: _response.error.statusCode,
|
|
2488
|
+
body: _response.error.body,
|
|
2489
|
+
rawResponse: _response.rawResponse,
|
|
2490
|
+
});
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/api/harbors/{harbor_id}/saved-queries/{saved_query_id}/draft");
|
|
2494
|
+
});
|
|
2495
|
+
}
|
|
2496
|
+
/**
|
|
2497
|
+
* Discards the mutable draft for one Harbor saved query.
|
|
2498
|
+
*
|
|
2499
|
+
* Discarding an initial unpublished draft also removes its otherwise empty stable
|
|
2500
|
+
* saved-query identity. Discarding a later draft preserves every immutable
|
|
2501
|
+
* published version.
|
|
2502
|
+
*
|
|
2503
|
+
* @param {string} harbor_id - Unique identifier of the Harbor.
|
|
2504
|
+
* @param {string} saved_query_id - Unique stable identifier of the saved query.
|
|
2505
|
+
* @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
2506
|
+
*
|
|
2507
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
2508
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
2509
|
+
* @throws {@link Polytomic.ConflictError}
|
|
2510
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
2511
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
2512
|
+
* @throws {@link errors.PolytomicError}
|
|
2513
|
+
* @throws {@link errors.PolytomicTimeoutError}
|
|
2514
|
+
*
|
|
2515
|
+
* @example
|
|
2516
|
+
* await client.harbors.deleteSavedQueryDraft("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
2517
|
+
*/
|
|
2518
|
+
deleteSavedQueryDraft(harbor_id, saved_query_id, requestOptions) {
|
|
2519
|
+
return core.HttpResponsePromise.fromPromise(this.__deleteSavedQueryDraft(harbor_id, saved_query_id, requestOptions));
|
|
2520
|
+
}
|
|
2521
|
+
__deleteSavedQueryDraft(harbor_id, saved_query_id, requestOptions) {
|
|
2522
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2523
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2524
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
2525
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
|
|
2526
|
+
"Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey,
|
|
2527
|
+
"X-Polytomic-Version": (_d = (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : "2025-09-18",
|
|
2528
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2529
|
+
const _response = yield core.fetcher({
|
|
2530
|
+
url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.PolytomicEnvironment.Default, `api/harbors/${core.url.encodePathParam(harbor_id)}/saved-queries/${core.url.encodePathParam(saved_query_id)}/draft`),
|
|
2531
|
+
method: "DELETE",
|
|
2532
|
+
headers: _headers,
|
|
2533
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
2534
|
+
timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
|
|
2535
|
+
maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
|
|
2536
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2537
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
2538
|
+
logging: this._options.logging,
|
|
2539
|
+
});
|
|
2540
|
+
if (_response.ok) {
|
|
2541
|
+
return {
|
|
2542
|
+
data: _response.body,
|
|
2543
|
+
rawResponse: _response.rawResponse,
|
|
2544
|
+
};
|
|
2545
|
+
}
|
|
2546
|
+
if (_response.error.reason === "status-code") {
|
|
2547
|
+
switch (_response.error.statusCode) {
|
|
2548
|
+
case 403:
|
|
2549
|
+
throw new Polytomic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2550
|
+
case 404:
|
|
2551
|
+
throw new Polytomic.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2552
|
+
case 409:
|
|
2553
|
+
throw new Polytomic.ConflictError(_response.error.body, _response.rawResponse);
|
|
2554
|
+
case 422:
|
|
2555
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
2556
|
+
case 500:
|
|
2557
|
+
throw new Polytomic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2558
|
+
default:
|
|
2559
|
+
throw new errors.PolytomicError({
|
|
2560
|
+
statusCode: _response.error.statusCode,
|
|
2561
|
+
body: _response.error.body,
|
|
2562
|
+
rawResponse: _response.rawResponse,
|
|
2563
|
+
});
|
|
2564
|
+
}
|
|
2565
|
+
}
|
|
2566
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/api/harbors/{harbor_id}/saved-queries/{saved_query_id}/draft");
|
|
2567
|
+
});
|
|
2568
|
+
}
|
|
2569
|
+
/**
|
|
2570
|
+
* Validates and publishes the current draft as the next immutable saved-query version.
|
|
2571
|
+
*
|
|
2572
|
+
* Only organization administrators can publish. Publication executes and validates
|
|
2573
|
+
* the current draft with the Polytomic-managed Harbor's MotherDuck `read_scaling`
|
|
2574
|
+
* credential. It fails instead of using the Harbor writer credential when the
|
|
2575
|
+
* reader credential is missing or incomplete.
|
|
2576
|
+
*
|
|
2577
|
+
* After execution, publication verifies that the draft did not change. A
|
|
2578
|
+
* concurrent edit returns a conflict and remains a draft. Successful publication
|
|
2579
|
+
* creates the next immutable revision, records the observed ordered columns as its
|
|
2580
|
+
* output contract, removes validation inputs from the published definition, and
|
|
2581
|
+
* deletes the mutable draft. The response includes the immutable `revision_id`
|
|
2582
|
+
* that future executions use for exact provenance.
|
|
2583
|
+
*
|
|
2584
|
+
* @param {string} harbor_id - Unique identifier of the Harbor.
|
|
2585
|
+
* @param {string} saved_query_id - Unique stable identifier of the saved query.
|
|
2586
|
+
* @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
2587
|
+
*
|
|
2588
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
2589
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
2590
|
+
* @throws {@link Polytomic.ConflictError}
|
|
2591
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
2592
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
2593
|
+
* @throws {@link errors.PolytomicError}
|
|
2594
|
+
* @throws {@link errors.PolytomicTimeoutError}
|
|
2595
|
+
*
|
|
2596
|
+
* @example
|
|
2597
|
+
* await client.harbors.publishSavedQueryDraft("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
2598
|
+
*/
|
|
2599
|
+
publishSavedQueryDraft(harbor_id, saved_query_id, requestOptions) {
|
|
2600
|
+
return core.HttpResponsePromise.fromPromise(this.__publishSavedQueryDraft(harbor_id, saved_query_id, requestOptions));
|
|
2601
|
+
}
|
|
2602
|
+
__publishSavedQueryDraft(harbor_id, saved_query_id, requestOptions) {
|
|
2603
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2604
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2605
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
2606
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
|
|
2607
|
+
"Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey,
|
|
2608
|
+
"X-Polytomic-Version": (_d = (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : "2025-09-18",
|
|
2609
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2610
|
+
const _response = yield core.fetcher({
|
|
2611
|
+
url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.PolytomicEnvironment.Default, `api/harbors/${core.url.encodePathParam(harbor_id)}/saved-queries/${core.url.encodePathParam(saved_query_id)}/draft/publish`),
|
|
2612
|
+
method: "POST",
|
|
2613
|
+
headers: _headers,
|
|
2614
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
2615
|
+
timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
|
|
2616
|
+
maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
|
|
2617
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2618
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
2619
|
+
logging: this._options.logging,
|
|
2620
|
+
});
|
|
2621
|
+
if (_response.ok) {
|
|
2622
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2623
|
+
}
|
|
2624
|
+
if (_response.error.reason === "status-code") {
|
|
2625
|
+
switch (_response.error.statusCode) {
|
|
2626
|
+
case 403:
|
|
2627
|
+
throw new Polytomic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2628
|
+
case 404:
|
|
2629
|
+
throw new Polytomic.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2630
|
+
case 409:
|
|
2631
|
+
throw new Polytomic.ConflictError(_response.error.body, _response.rawResponse);
|
|
2632
|
+
case 422:
|
|
2633
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
2634
|
+
case 500:
|
|
2635
|
+
throw new Polytomic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2636
|
+
default:
|
|
2637
|
+
throw new errors.PolytomicError({
|
|
2638
|
+
statusCode: _response.error.statusCode,
|
|
2639
|
+
body: _response.error.body,
|
|
2640
|
+
rawResponse: _response.rawResponse,
|
|
2641
|
+
});
|
|
2642
|
+
}
|
|
2643
|
+
}
|
|
2644
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/api/harbors/{harbor_id}/saved-queries/{saved_query_id}/draft/publish");
|
|
2645
|
+
});
|
|
2646
|
+
}
|
|
2647
|
+
/**
|
|
2648
|
+
* Validates the exact current saved-query draft and returns a bounded ephemeral preview.
|
|
2649
|
+
*
|
|
2650
|
+
* Only organization administrators can validate drafts. Named template references
|
|
2651
|
+
* compile to DuckDB placeholders, and typed values are passed separately rather
|
|
2652
|
+
* than interpolated into SQL.
|
|
2653
|
+
*
|
|
2654
|
+
* The query runs with the Polytomic-managed Harbor's MotherDuck `read_scaling`
|
|
2655
|
+
* credential. Validation fails when that credential is missing or incomplete and
|
|
2656
|
+
* never falls back to the Harbor writer credential. Preview rows and serialized
|
|
2657
|
+
* response size are bounded. The preview and validation attempt are not persisted.
|
|
2658
|
+
*
|
|
2659
|
+
* @param {string} harbor_id - Unique identifier of the Harbor.
|
|
2660
|
+
* @param {string} saved_query_id - Unique stable identifier of the saved query.
|
|
2661
|
+
* @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
2662
|
+
*
|
|
2663
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
2664
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
2665
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
2666
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
2667
|
+
* @throws {@link errors.PolytomicError}
|
|
2668
|
+
* @throws {@link errors.PolytomicTimeoutError}
|
|
2669
|
+
*
|
|
2670
|
+
* @example
|
|
2671
|
+
* await client.harbors.validateSavedQueryDraft("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
2672
|
+
*/
|
|
2673
|
+
validateSavedQueryDraft(harbor_id, saved_query_id, requestOptions) {
|
|
2674
|
+
return core.HttpResponsePromise.fromPromise(this.__validateSavedQueryDraft(harbor_id, saved_query_id, requestOptions));
|
|
2675
|
+
}
|
|
2676
|
+
__validateSavedQueryDraft(harbor_id, saved_query_id, requestOptions) {
|
|
2677
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
2678
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2679
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
2680
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
|
|
2681
|
+
"Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey,
|
|
2682
|
+
"X-Polytomic-Version": (_d = (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : "2025-09-18",
|
|
2683
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2684
|
+
const _response = yield core.fetcher({
|
|
2685
|
+
url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.PolytomicEnvironment.Default, `api/harbors/${core.url.encodePathParam(harbor_id)}/saved-queries/${core.url.encodePathParam(saved_query_id)}/draft/validate`),
|
|
2686
|
+
method: "POST",
|
|
2687
|
+
headers: _headers,
|
|
2688
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
2689
|
+
timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
|
|
2690
|
+
maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
|
|
2691
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2692
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
2693
|
+
logging: this._options.logging,
|
|
2694
|
+
});
|
|
2695
|
+
if (_response.ok) {
|
|
2696
|
+
return {
|
|
2697
|
+
data: _response.body,
|
|
2698
|
+
rawResponse: _response.rawResponse,
|
|
2699
|
+
};
|
|
2700
|
+
}
|
|
2701
|
+
if (_response.error.reason === "status-code") {
|
|
2702
|
+
switch (_response.error.statusCode) {
|
|
2703
|
+
case 403:
|
|
2704
|
+
throw new Polytomic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2705
|
+
case 404:
|
|
2706
|
+
throw new Polytomic.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2707
|
+
case 422:
|
|
2708
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
2709
|
+
case 500:
|
|
2710
|
+
throw new Polytomic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2711
|
+
default:
|
|
2712
|
+
throw new errors.PolytomicError({
|
|
2713
|
+
statusCode: _response.error.statusCode,
|
|
2714
|
+
body: _response.error.body,
|
|
2715
|
+
rawResponse: _response.rawResponse,
|
|
2716
|
+
});
|
|
2717
|
+
}
|
|
2718
|
+
}
|
|
2719
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/api/harbors/{harbor_id}/saved-queries/{saved_query_id}/draft/validate");
|
|
2720
|
+
});
|
|
2721
|
+
}
|
|
2722
|
+
/**
|
|
2723
|
+
* Submits the current published Harbor saved query for asynchronous reader-only execution.
|
|
2724
|
+
*
|
|
2725
|
+
* Use a Harbor-bound scoped credential with query access to the Harbor's backing
|
|
2726
|
+
* Connection. Administrator credentials cannot submit executions here. Saved
|
|
2727
|
+
* queries require a Polytomic-managed Harbor.
|
|
2728
|
+
*
|
|
2729
|
+
* Polytomic selects the current published revision while processing your request.
|
|
2730
|
+
* The response identifies that exact immutable revision. Selection happens before
|
|
2731
|
+
* Polytomic accepts the execution. Drafts, unpublished queries, and archived
|
|
2732
|
+
* queries are unavailable for selection. You cannot select a historical revision
|
|
2733
|
+
* or supply SQL through this endpoint.
|
|
2734
|
+
*
|
|
2735
|
+
* > ⚠️ Concurrent publication changes
|
|
2736
|
+
* >
|
|
2737
|
+
* > Publishing, unpublishing, or archiving a saved query after selection does not
|
|
2738
|
+
* > change the selected revision. An in-flight request may still be accepted and
|
|
2739
|
+
* > execute that revision. Unpublishing or archiving does not cancel in-flight
|
|
2740
|
+
* > requests or queued executions. Query access is checked again before execution
|
|
2741
|
+
* > and result retrieval.
|
|
2742
|
+
*
|
|
2743
|
+
* Parameter values are bound separately from SQL. Omitted parameters use the
|
|
2744
|
+
* published `default_value`, never draft validation values. An omitted optional
|
|
2745
|
+
* parameter without a default binds SQL `NULL`. Required parameters allow omission
|
|
2746
|
+
* when a default exists, but reject explicit `null` even with a default. Missing
|
|
2747
|
+
* required values without defaults, explicit `null` for required parameters,
|
|
2748
|
+
* unknown parameter names, and invalid scalar types return
|
|
2749
|
+
* `422 Unprocessable Entity` without accepting an execution. Execution requires
|
|
2750
|
+
* reader credentials and never falls back to writer credentials.
|
|
2751
|
+
*
|
|
2752
|
+
* For report windows, define parameters with `required: true` and a
|
|
2753
|
+
* `default_value`, such as `7` for a `days` parameter. This allows omission while
|
|
2754
|
+
* preventing explicit `null` from turning a time filter into a SQL `NULL`
|
|
2755
|
+
* comparison.
|
|
2756
|
+
*
|
|
2757
|
+
* To archive a saved query through REST, use
|
|
2758
|
+
* [`DELETE /api/harbors/{harbor_id}/saved-queries/{saved_query_id}`](../../../../../../api-reference/harbors/delete-saved-query).
|
|
2759
|
+
* Unpublish is available only through the GraphQL `unpublishHarborSavedQuery`
|
|
2760
|
+
* mutation, not a REST endpoint.
|
|
2761
|
+
*
|
|
2762
|
+
* ## Results
|
|
2763
|
+
*
|
|
2764
|
+
* The response returns a task ID with status `created`, not result rows. Poll
|
|
2765
|
+
* [`GET /api/queries/{id}`](../../../../../../api-reference/query-runner/get-query) using a credential
|
|
2766
|
+
* from the same Harbor profile. Query access is checked again before execution and
|
|
2767
|
+
* result retrieval. Stop polling at `done`, `failed`, or `unknown`; `unknown` means
|
|
2768
|
+
* execution started but no durable terminal result is available.
|
|
2769
|
+
*
|
|
2770
|
+
* Results and detailed failure information expire after 24 hours. Use the
|
|
2771
|
+
* `expires` field and follow `links.next` to retrieve additional result pages.
|
|
2772
|
+
*
|
|
2773
|
+
* ## Harbor Activity
|
|
2774
|
+
*
|
|
2775
|
+
* Send a new nonzero UUID in `X-Polytomic-Activity-Request-ID`. Missing or invalid
|
|
2776
|
+
* IDs return `400 Bad Request`. Reusing a consumed ID returns `409 Conflict` and
|
|
2777
|
+
* does not create another execution.
|
|
2778
|
+
*
|
|
2779
|
+
* You may omit `X-Polytomic-Harbor-Session` for direct REST requests. If supplied,
|
|
2780
|
+
* the session must be active and bound to your credential and Harbor.
|
|
2781
|
+
*
|
|
2782
|
+
* Polytomic records `query.submitted` atomically with acceptance. The event
|
|
2783
|
+
* identifies the saved query, immutable revision, published version, and bounded
|
|
2784
|
+
* name snapshot. SQL, parameter values and defaults, column names, and result rows
|
|
2785
|
+
* remain outside Activity metadata. If Activity persistence is unavailable, the
|
|
2786
|
+
* request returns `503 Service Unavailable` without accepting an execution.
|
|
2787
|
+
*
|
|
2788
|
+
* `query.started` records provider invocation. `query.succeeded` means results are
|
|
2789
|
+
* available for authorized retrieval, not that you have consumed them.
|
|
2790
|
+
*
|
|
2791
|
+
* @param {string} harbor_id - Unique identifier of the Harbor.
|
|
2792
|
+
* @param {string} saved_query_id - Unique stable identifier of the saved query.
|
|
2793
|
+
* @param {Polytomic.ExecuteHarborSavedQueryRequest} request
|
|
2794
|
+
* @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
|
|
2795
|
+
*
|
|
2796
|
+
* @throws {@link Polytomic.BadRequestError}
|
|
2797
|
+
* @throws {@link Polytomic.ForbiddenError}
|
|
2798
|
+
* @throws {@link Polytomic.NotFoundError}
|
|
2799
|
+
* @throws {@link Polytomic.ConflictError}
|
|
2800
|
+
* @throws {@link Polytomic.UnprocessableEntityError}
|
|
2801
|
+
* @throws {@link Polytomic.InternalServerError}
|
|
2802
|
+
* @throws {@link Polytomic.ServiceUnavailableError}
|
|
2803
|
+
* @throws {@link errors.PolytomicError}
|
|
2804
|
+
* @throws {@link errors.PolytomicTimeoutError}
|
|
2805
|
+
*
|
|
2806
|
+
* @example
|
|
2807
|
+
* await client.harbors.executeSavedQuery("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
|
|
2808
|
+
*/
|
|
2809
|
+
executeSavedQuery(harbor_id, saved_query_id, request = {}, requestOptions) {
|
|
2810
|
+
return core.HttpResponsePromise.fromPromise(this.__executeSavedQuery(harbor_id, saved_query_id, request, requestOptions));
|
|
2811
|
+
}
|
|
2812
|
+
__executeSavedQuery(harbor_id_1, saved_query_id_1) {
|
|
2813
|
+
return __awaiter(this, arguments, void 0, function* (harbor_id, saved_query_id, request = {}, requestOptions) {
|
|
2814
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2815
|
+
const { "X-Polytomic-Harbor-Session": polytomicHarborSession, "X-Polytomic-Activity-Request-ID": polytomicActivityRequestId } = request, _body = __rest(request, ["X-Polytomic-Harbor-Session", "X-Polytomic-Activity-Request-ID"]);
|
|
2816
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
2817
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
|
|
2818
|
+
"X-Polytomic-Harbor-Session": polytomicHarborSession,
|
|
2819
|
+
"X-Polytomic-Activity-Request-ID": polytomicActivityRequestId,
|
|
2820
|
+
"Idempotency-Key": requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.idempotencyKey,
|
|
2821
|
+
"X-Polytomic-Version": (_d = (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.version) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.version) !== null && _d !== void 0 ? _d : "2025-09-18",
|
|
2822
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
2823
|
+
const _response = yield core.fetcher({
|
|
2824
|
+
url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.PolytomicEnvironment.Default, `api/harbors/${core.url.encodePathParam(harbor_id)}/saved-queries/${core.url.encodePathParam(saved_query_id)}/execute`),
|
|
2825
|
+
method: "POST",
|
|
2826
|
+
headers: _headers,
|
|
2827
|
+
contentType: "application/json",
|
|
2828
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams).build(),
|
|
2829
|
+
requestType: "json",
|
|
2830
|
+
body: (0, requestBody_1.mergeAdditionalBodyParameters)(_body, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.additionalBodyParameters),
|
|
2831
|
+
timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
|
|
2832
|
+
maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
|
|
2833
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
2834
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
2835
|
+
logging: this._options.logging,
|
|
2836
|
+
});
|
|
2837
|
+
if (_response.ok) {
|
|
2838
|
+
return {
|
|
2839
|
+
data: _response.body,
|
|
2840
|
+
rawResponse: _response.rawResponse,
|
|
2841
|
+
};
|
|
2842
|
+
}
|
|
2843
|
+
if (_response.error.reason === "status-code") {
|
|
2844
|
+
switch (_response.error.statusCode) {
|
|
2845
|
+
case 400:
|
|
2846
|
+
throw new Polytomic.BadRequestError(_response.error.body, _response.rawResponse);
|
|
2847
|
+
case 403:
|
|
2848
|
+
throw new Polytomic.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
2849
|
+
case 404:
|
|
2850
|
+
throw new Polytomic.NotFoundError(_response.error.body, _response.rawResponse);
|
|
2851
|
+
case 409:
|
|
2852
|
+
throw new Polytomic.ConflictError(_response.error.body, _response.rawResponse);
|
|
2853
|
+
case 422:
|
|
2854
|
+
throw new Polytomic.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
2855
|
+
case 500:
|
|
2856
|
+
throw new Polytomic.InternalServerError(_response.error.body, _response.rawResponse);
|
|
2857
|
+
case 503:
|
|
2858
|
+
throw new Polytomic.ServiceUnavailableError(_response.error.body, _response.rawResponse);
|
|
2859
|
+
default:
|
|
2860
|
+
throw new errors.PolytomicError({
|
|
2861
|
+
statusCode: _response.error.statusCode,
|
|
2862
|
+
body: _response.error.body,
|
|
2863
|
+
rawResponse: _response.rawResponse,
|
|
2864
|
+
});
|
|
2865
|
+
}
|
|
2866
|
+
}
|
|
2867
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/api/harbors/{harbor_id}/saved-queries/{saved_query_id}/execute");
|
|
2868
|
+
});
|
|
2869
|
+
}
|
|
1924
2870
|
/**
|
|
1925
2871
|
* Resolves documented source table and field identities to the names a Harbor's backing Connection accepts.
|
|
1926
2872
|
*
|