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.
Files changed (71) hide show
  1. package/BaseClient.js +2 -2
  2. package/api/resources/bulkSync/client/Client.d.ts +4 -2
  3. package/api/resources/bulkSync/client/Client.js +4 -2
  4. package/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +1 -1
  5. package/api/resources/bulkSync/resources/schemas/client/Client.d.ts +1 -0
  6. package/api/resources/bulkSync/resources/schemas/client/Client.js +3 -0
  7. package/api/resources/harbors/client/Client.d.ts +424 -0
  8. package/api/resources/harbors/client/Client.js +946 -0
  9. package/api/resources/harbors/client/requests/CreateHarborSavedQueryDraftRequest.d.ts +24 -0
  10. package/api/resources/harbors/client/requests/CreateHarborSavedQueryDraftRequest.js +3 -0
  11. package/api/resources/harbors/client/requests/ExecuteHarborSavedQueryRequest.d.ts +10 -0
  12. package/api/resources/harbors/client/requests/ExecuteHarborSavedQueryRequest.js +3 -0
  13. package/api/resources/harbors/client/requests/HarborsGetSavedQueryRequest.d.ts +8 -0
  14. package/api/resources/harbors/client/requests/HarborsGetSavedQueryRequest.js +3 -0
  15. package/api/resources/harbors/client/requests/HarborsListSavedQueriesRequest.d.ts +15 -0
  16. package/api/resources/harbors/client/requests/HarborsListSavedQueriesRequest.js +3 -0
  17. package/api/resources/harbors/client/requests/HarborsListSavedQueryDraftsRequest.d.ts +13 -0
  18. package/api/resources/harbors/client/requests/HarborsListSavedQueryDraftsRequest.js +3 -0
  19. package/api/resources/harbors/client/requests/SaveHarborSavedQueryDraftRequest.d.ts +24 -0
  20. package/api/resources/harbors/client/requests/SaveHarborSavedQueryDraftRequest.js +3 -0
  21. package/api/resources/harbors/client/requests/index.d.ts +6 -0
  22. package/api/resources/modelSync/client/requests/CreateModelSyncV5Request.d.ts +3 -0
  23. package/api/resources/modelSync/client/requests/UpdateModelSyncV5Request.d.ts +3 -0
  24. package/api/types/DeletedHarborSavedQueryDraftEnvelope.d.ts +9 -0
  25. package/api/types/DeletedHarborSavedQueryDraftEnvelope.js +3 -0
  26. package/api/types/DeletedHarborSavedQueryEnvelope.d.ts +9 -0
  27. package/api/types/DeletedHarborSavedQueryEnvelope.js +3 -0
  28. package/api/types/ExecuteHarborSavedQueryEnvelope.d.ts +27 -0
  29. package/api/types/ExecuteHarborSavedQueryEnvelope.js +3 -0
  30. package/api/types/HarborResponse.d.ts +2 -0
  31. package/api/types/HarborSavedQueryDraftEnvelope.d.ts +4 -0
  32. package/api/types/HarborSavedQueryDraftEnvelope.js +3 -0
  33. package/api/types/HarborSavedQueryDraftListEnvelope.d.ts +5 -0
  34. package/api/types/HarborSavedQueryDraftListEnvelope.js +3 -0
  35. package/api/types/HarborSavedQueryDraftResponse.d.ts +33 -0
  36. package/api/types/HarborSavedQueryDraftResponse.js +3 -0
  37. package/api/types/HarborSavedQueryEnvelope.d.ts +4 -0
  38. package/api/types/HarborSavedQueryEnvelope.js +3 -0
  39. package/api/types/HarborSavedQueryListEnvelope.d.ts +5 -0
  40. package/api/types/HarborSavedQueryListEnvelope.js +3 -0
  41. package/api/types/HarborSavedQueryMetadataResponse.d.ts +20 -0
  42. package/api/types/HarborSavedQueryMetadataResponse.js +3 -0
  43. package/api/types/HarborSavedQueryParameter.d.ts +22 -0
  44. package/api/types/HarborSavedQueryParameter.js +16 -0
  45. package/api/types/HarborSavedQueryPreviewResponse.d.ts +8 -0
  46. package/api/types/HarborSavedQueryPreviewResponse.js +3 -0
  47. package/api/types/HarborSavedQueryResponse.d.ts +31 -0
  48. package/api/types/HarborSavedQueryResponse.js +3 -0
  49. package/api/types/HarborSavedQueryValidationEnvelope.d.ts +4 -0
  50. package/api/types/HarborSavedQueryValidationEnvelope.js +3 -0
  51. package/api/types/HarboractivityapiHarborActivityEvent.d.ts +1 -0
  52. package/api/types/HarboractivityapiHarborActivityMetadata.d.ts +3 -0
  53. package/api/types/HarboractivityapiHarborActivityQuerySource.d.ts +7 -0
  54. package/api/types/HarboractivityapiHarborActivityQuerySource.js +3 -0
  55. package/api/types/HarboractivityapiHarborActivitySavedQuerySource.d.ts +7 -0
  56. package/api/types/HarboractivityapiHarborActivitySavedQuerySource.js +3 -0
  57. package/api/types/HarboractivityapiHarborActivityTarget.d.ts +2 -0
  58. package/api/types/ModelSyncIdentities.d.ts +18 -0
  59. package/api/types/ModelSyncIdentities.js +12 -0
  60. package/api/types/ModelSyncProblem.d.ts +10 -0
  61. package/api/types/ModelSyncProblem.js +3 -0
  62. package/api/types/ModelSyncV5Response.d.ts +5 -0
  63. package/api/types/SyncDestinationProperties.d.ts +2 -0
  64. package/api/types/TypesDefinition.d.ts +4 -1
  65. package/api/types/UserFieldRequest.d.ts +3 -1
  66. package/api/types/index.d.ts +17 -0
  67. package/api/types/index.js +17 -0
  68. package/package.json +1 -1
  69. package/reference.md +956 -2
  70. package/version.d.ts +1 -1
  71. package/version.js +1 -1
package/BaseClient.js CHANGED
@@ -44,8 +44,8 @@ function normalizeClientOptions(options) {
44
44
  const headers = (0, headers_1.mergeHeaders)({
45
45
  "X-Fern-Language": "JavaScript",
46
46
  "X-Fern-SDK-Name": "polytomic",
47
- "X-Fern-SDK-Version": "25.9.5",
48
- "User-Agent": "polytomic/25.9.5",
47
+ "X-Fern-SDK-Version": "25.9.7",
48
+ "User-Agent": "polytomic/25.9.7",
49
49
  "X-Fern-Runtime": core.RUNTIME.type,
50
50
  "X-Fern-Runtime-Version": core.RUNTIME.version,
51
51
  "X-Polytomic-Version": (_a = options === null || options === void 0 ? void 0 : options.version) !== null && _a !== void 0 ? _a : "2025-09-18",
@@ -173,11 +173,13 @@ export declare class BulkSyncClient {
173
173
  * - `normalize_names` resets to enabled.
174
174
  *
175
175
  * Send the existing values explicitly if you want to preserve a non-default or
176
- * non-empty setting, including schema and field selections.
176
+ * non-empty setting.
177
177
  *
178
178
  * > 📘 Updating schemas
179
179
  * >
180
- * > Schema updates are not performed through this endpoint. Use the
180
+ * > When `schemas` is present, it replaces the sync's schema selection: schemas
181
+ * > not in the list are disabled. When `schemas` is omitted or empty, the sync's
182
+ * > schemas are left unchanged. Use the
181
183
  * > [Update Bulk Sync Schemas](../../../../api-reference/bulk-sync/schemas/patch)
182
184
  * > endpoint to change a subset of schemas, or
183
185
  * > [Update Bulk Sync Schema](../../../../api-reference/bulk-sync/schemas/update)
@@ -362,11 +362,13 @@ class BulkSyncClient {
362
362
  * - `normalize_names` resets to enabled.
363
363
  *
364
364
  * Send the existing values explicitly if you want to preserve a non-default or
365
- * non-empty setting, including schema and field selections.
365
+ * non-empty setting.
366
366
  *
367
367
  * > 📘 Updating schemas
368
368
  * >
369
- * > Schema updates are not performed through this endpoint. Use the
369
+ * > When `schemas` is present, it replaces the sync's schema selection: schemas
370
+ * > not in the list are disabled. When `schemas` is omitted or empty, the sync's
371
+ * > schemas are left unchanged. Use the
370
372
  * > [Update Bulk Sync Schemas](../../../../api-reference/bulk-sync/schemas/patch)
371
373
  * > endpoint to change a subset of schemas, or
372
374
  * > [Update Bulk Sync Schema](../../../../api-reference/bulk-sync/schemas/update)
@@ -41,7 +41,7 @@ export interface UpdateBulkSyncRequest {
41
41
  policies?: string[];
42
42
  /** Override the default resync concurrency limit for this sync. */
43
43
  resync_concurrency_limit?: number;
44
- /** List of schemas to sync; if omitted, all schemas will be selected for syncing. */
44
+ /** Schemas to sync. Schemas not in the list are disabled; if omitted or empty, the sync's schemas are left unchanged. */
45
45
  schemas?: UpdateBulkSyncRequest.Schemas.Item[];
46
46
  /** Source-specific bulk sync configuration (e.g. replication slot name, sync lookback). The accepted keys depend on the source connection type. */
47
47
  source_configuration?: Record<string, unknown>;
@@ -119,6 +119,7 @@ export declare class SchemasClient {
119
119
  * @param {Polytomic.bulkSync.UpdateBulkSchema} request
120
120
  * @param {SchemasClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
121
121
  *
122
+ * @throws {@link Polytomic.BadRequestError}
122
123
  * @throws {@link Polytomic.ForbiddenError}
123
124
  * @throws {@link Polytomic.NotFoundError}
124
125
  * @throws {@link Polytomic.InternalServerError}
@@ -296,6 +296,7 @@ class SchemasClient {
296
296
  * @param {Polytomic.bulkSync.UpdateBulkSchema} request
297
297
  * @param {SchemasClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
298
298
  *
299
+ * @throws {@link Polytomic.BadRequestError}
299
300
  * @throws {@link Polytomic.ForbiddenError}
300
301
  * @throws {@link Polytomic.NotFoundError}
301
302
  * @throws {@link Polytomic.InternalServerError}
@@ -335,6 +336,8 @@ class SchemasClient {
335
336
  }
336
337
  if (_response.error.reason === "status-code") {
337
338
  switch (_response.error.statusCode) {
339
+ case 400:
340
+ throw new Polytomic.BadRequestError(_response.error.body, _response.rawResponse);
338
341
  case 403:
339
342
  throw new Polytomic.ForbiddenError(_response.error.body, _response.rawResponse);
340
343
  case 404:
@@ -125,6 +125,11 @@ export declare class HarborsClient {
125
125
  *
126
126
  * For `customer_managed`, `backing_connection_id` must identify a queryable Connection that your credential can access.
127
127
  *
128
+ * Managed Harbors return with `status: provisioning` while Polytomic sets up their
129
+ * storage in the background. Poll `GET /api/harbors/{harbor_id}` until the status is
130
+ * `ready` before adding sources or querying data. If provisioning fails, the status
131
+ * is `provisioning_failed` and Polytomic retries automatically.
132
+ *
128
133
  * @param {Polytomic.CreateHarborRequest} request
129
134
  * @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
130
135
  *
@@ -197,6 +202,10 @@ export declare class HarborsClient {
197
202
  * >
198
203
  * > 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.
199
204
  *
205
+ * The response confirms that access has been revoked. Polytomic removes managed
206
+ * storage in the background and retries failed cleanup automatically. You can also
207
+ * delete a Harbor while it is provisioning.
208
+ *
200
209
  * @param {string} harbor_id - Unique identifier of the Harbor.
201
210
  * @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
202
211
  *
@@ -632,6 +641,421 @@ export declare class HarborsClient {
632
641
  */
633
642
  deleteKey(harbor_id: string, key_id: string, requestOptions?: HarborsClient.IdempotentRequestOptions): core.HttpResponsePromise<Polytomic.RevokedHarborKeyEnvelope>;
634
643
  private __deleteKey;
644
+ /**
645
+ * Lists current published saved queries for a Harbor.
646
+ *
647
+ * Saved queries are supported only for Polytomic-managed Harbors whose backing
648
+ * Connection type is `polytomic_harbor`.
649
+ *
650
+ * Collection items contain current published metadata and omit SQL, parameter
651
+ * values, and unpublished drafts. A Harbor profile credential can list saved
652
+ * queries only when `harbor_id` identifies its own Harbor.
653
+ *
654
+ * ## Harbor Activity
655
+ *
656
+ * When you use a Harbor profile credential, send a new nonzero UUID in
657
+ * `X-Polytomic-Activity-Request-ID` for each request, including each page. A
658
+ * missing or invalid ID returns `400 Bad Request`. Reusing a consumed ID returns
659
+ * `409 Conflict`.
660
+ *
661
+ * If you supply `X-Polytomic-Harbor-Session`, the session must be active and bound
662
+ * to your credential and Harbor. An invalid session returns `403 Forbidden`.
663
+ * Direct scoped REST requests may omit the session header.
664
+ *
665
+ * Polytomic records `saved_query.listed` before returning data. The event describes
666
+ * only the returned page, including saved-query IDs, immutable revision IDs,
667
+ * version numbers, and bounded name snapshots. Activity excludes SQL, parameter
668
+ * values, and expected column names. If Polytomic cannot record the event, the
669
+ * request returns `503 Service Unavailable` without saved-query data.
670
+ *
671
+ * @param {string} harbor_id - Unique identifier of the Harbor.
672
+ * @param {Polytomic.HarborsListSavedQueriesRequest} request
673
+ * @param {HarborsClient.RequestOptions} requestOptions - Request-specific configuration.
674
+ *
675
+ * @throws {@link Polytomic.BadRequestError}
676
+ * @throws {@link Polytomic.ForbiddenError}
677
+ * @throws {@link Polytomic.NotFoundError}
678
+ * @throws {@link Polytomic.ConflictError}
679
+ * @throws {@link Polytomic.UnprocessableEntityError}
680
+ * @throws {@link Polytomic.InternalServerError}
681
+ * @throws {@link Polytomic.ServiceUnavailableError}
682
+ * @throws {@link errors.PolytomicError}
683
+ * @throws {@link errors.PolytomicTimeoutError}
684
+ *
685
+ * @example
686
+ * await client.harbors.listSavedQueries("248df4b7-aa70-47b8-a036-33ac447e668d", {
687
+ * limit: 1,
688
+ * page_token: "page_token"
689
+ * })
690
+ */
691
+ listSavedQueries(harbor_id: string, request?: Polytomic.HarborsListSavedQueriesRequest, requestOptions?: HarborsClient.RequestOptions): core.HttpResponsePromise<Polytomic.HarborSavedQueryListEnvelope>;
692
+ private __listSavedQueries;
693
+ /**
694
+ * Creates a stable Harbor saved query with its initial mutable draft.
695
+ *
696
+ * Saved queries are supported only for Polytomic-managed Harbors whose backing
697
+ * Connection type is `polytomic_harbor`. Customer-managed Harbor backings return
698
+ * an unsupported-backing error.
699
+ *
700
+ * The saved query receives a stable ID, but it remains absent from published
701
+ * saved-query reads until an administrator publishes its initial draft.
702
+ *
703
+ * Use `{{parameter_name}}` references in `sql_template`. Each reference must have
704
+ * one scalar declaration. Validation values and defaults must match the declared
705
+ * `string`, `number`, `boolean`, `date`, `timestamp`, or `uuid` type.
706
+ *
707
+ * Unknown JSON fields, including fields inside parameter declarations, return
708
+ * `400 Bad Request` before the draft is saved. Use `default_value`, not `default`,
709
+ * for parameter defaults.
710
+ *
711
+ * When you omit a parameter during execution, Polytomic uses its published
712
+ * `default_value`, never its draft validation value. An omitted optional parameter
713
+ * without a default binds SQL `NULL`. A required parameter allows omission when a
714
+ * default exists, but rejects explicit `null` even with a default.
715
+ *
716
+ * For a report window, use a required parameter with a default so omission selects
717
+ * a useful window and explicit `null` is rejected:
718
+ *
719
+ * ```json
720
+ * {"name": "days", "type": "number", "required": true, "default_value": 7}
721
+ * ```
722
+ *
723
+ * @param {string} harbor_id - Unique identifier of the Harbor.
724
+ * @param {Polytomic.CreateHarborSavedQueryDraftRequest} request
725
+ * @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
726
+ *
727
+ * @throws {@link Polytomic.BadRequestError}
728
+ * @throws {@link Polytomic.ForbiddenError}
729
+ * @throws {@link Polytomic.NotFoundError}
730
+ * @throws {@link Polytomic.UnprocessableEntityError}
731
+ * @throws {@link Polytomic.InternalServerError}
732
+ * @throws {@link errors.PolytomicError}
733
+ * @throws {@link errors.PolytomicTimeoutError}
734
+ *
735
+ * @example
736
+ * await client.harbors.createSavedQueryDraft("248df4b7-aa70-47b8-a036-33ac447e668d", {
737
+ * name: "Monthly revenue",
738
+ * sql_template: "SELECT account_id, sum(amount) AS revenue FROM orders WHERE created_at >= {{start_date}} GROUP BY account_id"
739
+ * })
740
+ */
741
+ createSavedQueryDraft(harbor_id: string, request: Polytomic.CreateHarborSavedQueryDraftRequest, requestOptions?: HarborsClient.IdempotentRequestOptions): core.HttpResponsePromise<Polytomic.HarborSavedQueryDraftEnvelope>;
742
+ private __createSavedQueryDraft;
743
+ /**
744
+ * Lists mutable Harbor saved-query drafts.
745
+ *
746
+ * Drafts are ordered from newest to oldest and include complete SQL, typed
747
+ * parameter declarations, and author-supplied validation values. Harbor profile
748
+ * credentials cannot access this endpoint.
749
+ *
750
+ * @param {string} harbor_id - Unique identifier of the Harbor.
751
+ * @param {Polytomic.HarborsListSavedQueryDraftsRequest} request
752
+ * @param {HarborsClient.RequestOptions} requestOptions - Request-specific configuration.
753
+ *
754
+ * @throws {@link Polytomic.ForbiddenError}
755
+ * @throws {@link Polytomic.NotFoundError}
756
+ * @throws {@link Polytomic.UnprocessableEntityError}
757
+ * @throws {@link Polytomic.InternalServerError}
758
+ * @throws {@link errors.PolytomicError}
759
+ * @throws {@link errors.PolytomicTimeoutError}
760
+ *
761
+ * @example
762
+ * await client.harbors.listSavedQueryDrafts("248df4b7-aa70-47b8-a036-33ac447e668d", {
763
+ * limit: 1,
764
+ * page_token: "page_token"
765
+ * })
766
+ */
767
+ listSavedQueryDrafts(harbor_id: string, request?: Polytomic.HarborsListSavedQueryDraftsRequest, requestOptions?: HarborsClient.RequestOptions): core.HttpResponsePromise<Polytomic.HarborSavedQueryDraftListEnvelope>;
768
+ private __listSavedQueryDrafts;
769
+ /**
770
+ * Returns the current published version of one Harbor saved query.
771
+ *
772
+ * The response contains the current immutable `revision_id`, SQL template,
773
+ * parameter contract, expected columns, and publication provenance. Validation
774
+ * inputs are draft-only and are never part of a published response.
775
+ *
776
+ * A Harbor profile credential can retrieve a saved query only from its own Harbor.
777
+ *
778
+ * ## Harbor Activity
779
+ *
780
+ * When you use a Harbor profile credential, send a new nonzero UUID in
781
+ * `X-Polytomic-Activity-Request-ID` for each request. A missing or invalid ID
782
+ * returns `400 Bad Request`. Reusing a consumed ID returns `409 Conflict`.
783
+ *
784
+ * If you supply `X-Polytomic-Harbor-Session`, the session must be active and bound
785
+ * to your credential and Harbor. An invalid session returns `403 Forbidden`.
786
+ * Direct scoped REST requests may omit the session header.
787
+ *
788
+ * Polytomic records `saved_query.fetched` before returning the definition. The
789
+ * event identifies the saved query, exact immutable revision, published version,
790
+ * and bounded name snapshot. It does not indicate query execution. Activity
791
+ * excludes SQL, parameter defaults and validation values, expected column names,
792
+ * and result rows. If Polytomic cannot record the event, the request returns
793
+ * `503 Service Unavailable` without saved-query data.
794
+ *
795
+ * @param {string} harbor_id - Unique identifier of the Harbor.
796
+ * @param {string} saved_query_id - Unique stable identifier of the saved query.
797
+ * @param {Polytomic.HarborsGetSavedQueryRequest} request
798
+ * @param {HarborsClient.RequestOptions} requestOptions - Request-specific configuration.
799
+ *
800
+ * @throws {@link Polytomic.BadRequestError}
801
+ * @throws {@link Polytomic.ForbiddenError}
802
+ * @throws {@link Polytomic.NotFoundError}
803
+ * @throws {@link Polytomic.ConflictError}
804
+ * @throws {@link Polytomic.UnprocessableEntityError}
805
+ * @throws {@link Polytomic.InternalServerError}
806
+ * @throws {@link Polytomic.ServiceUnavailableError}
807
+ * @throws {@link errors.PolytomicError}
808
+ * @throws {@link errors.PolytomicTimeoutError}
809
+ *
810
+ * @example
811
+ * await client.harbors.getSavedQuery("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
812
+ */
813
+ getSavedQuery(harbor_id: string, saved_query_id: string, request?: Polytomic.HarborsGetSavedQueryRequest, requestOptions?: HarborsClient.RequestOptions): core.HttpResponsePromise<Polytomic.HarborSavedQueryEnvelope>;
814
+ private __getSavedQuery;
815
+ /**
816
+ * Archives one Harbor saved query and removes it from active reads.
817
+ *
818
+ * Archiving removes the saved query and any draft from active reads while
819
+ * retaining its immutable revisions for provenance. The operation does not run
820
+ * the saved SQL or modify the Harbor backing Connection. Archiving does not cancel
821
+ * in-flight execution requests or queued executions.
822
+ *
823
+ * This REST operation archives the saved query; it does not merely unpublish it.
824
+ * Unpublish is available only through the GraphQL `unpublishHarborSavedQuery`
825
+ * mutation. There is no REST unpublish endpoint.
826
+ *
827
+ * @param {string} harbor_id - Unique identifier of the Harbor.
828
+ * @param {string} saved_query_id - Unique stable identifier of the saved query.
829
+ * @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
830
+ *
831
+ * @throws {@link Polytomic.ForbiddenError}
832
+ * @throws {@link Polytomic.NotFoundError}
833
+ * @throws {@link Polytomic.UnprocessableEntityError}
834
+ * @throws {@link Polytomic.InternalServerError}
835
+ * @throws {@link errors.PolytomicError}
836
+ * @throws {@link errors.PolytomicTimeoutError}
837
+ *
838
+ * @example
839
+ * await client.harbors.deleteSavedQuery("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
840
+ */
841
+ deleteSavedQuery(harbor_id: string, saved_query_id: string, requestOptions?: HarborsClient.IdempotentRequestOptions): core.HttpResponsePromise<Polytomic.DeletedHarborSavedQueryEnvelope>;
842
+ private __deleteSavedQuery;
843
+ /**
844
+ * Creates or completely replaces the mutable draft for a Harbor saved query.
845
+ *
846
+ * Replacement is complete rather than partial. The next validation or publication
847
+ * uses the replacement SQL, parameter declarations, and validation values.
848
+ *
849
+ * Unknown JSON fields, including fields inside parameter declarations, return
850
+ * `400 Bad Request` before the draft is saved. Use `default_value`, not `default`,
851
+ * for parameter defaults.
852
+ *
853
+ * When you omit a parameter during execution, Polytomic uses its published
854
+ * `default_value`, never its draft validation value. An omitted optional parameter
855
+ * without a default binds SQL `NULL`. A required parameter allows omission when a
856
+ * default exists, but rejects explicit `null` even with a default.
857
+ *
858
+ * For a report window, use a required parameter with a default so omission selects
859
+ * a useful window and explicit `null` is rejected:
860
+ *
861
+ * ```json
862
+ * {"name": "days", "type": "number", "required": true, "default_value": 7}
863
+ * ```
864
+ *
865
+ * @param {string} harbor_id - Unique identifier of the Harbor.
866
+ * @param {string} saved_query_id - Unique stable identifier of the saved query.
867
+ * @param {Polytomic.SaveHarborSavedQueryDraftRequest} request
868
+ * @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
869
+ *
870
+ * @throws {@link Polytomic.BadRequestError}
871
+ * @throws {@link Polytomic.ForbiddenError}
872
+ * @throws {@link Polytomic.NotFoundError}
873
+ * @throws {@link Polytomic.UnprocessableEntityError}
874
+ * @throws {@link Polytomic.InternalServerError}
875
+ * @throws {@link errors.PolytomicError}
876
+ * @throws {@link errors.PolytomicTimeoutError}
877
+ *
878
+ * @example
879
+ * await client.harbors.saveSavedQueryDraft("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d", {
880
+ * name: "Monthly revenue",
881
+ * sql_template: "SELECT account_id, sum(amount) AS revenue FROM orders WHERE created_at >= {{start_date}} GROUP BY account_id"
882
+ * })
883
+ */
884
+ saveSavedQueryDraft(harbor_id: string, saved_query_id: string, request: Polytomic.SaveHarborSavedQueryDraftRequest, requestOptions?: HarborsClient.IdempotentRequestOptions): core.HttpResponsePromise<Polytomic.HarborSavedQueryDraftEnvelope>;
885
+ private __saveSavedQueryDraft;
886
+ /**
887
+ * Discards the mutable draft for one Harbor saved query.
888
+ *
889
+ * Discarding an initial unpublished draft also removes its otherwise empty stable
890
+ * saved-query identity. Discarding a later draft preserves every immutable
891
+ * published version.
892
+ *
893
+ * @param {string} harbor_id - Unique identifier of the Harbor.
894
+ * @param {string} saved_query_id - Unique stable identifier of the saved query.
895
+ * @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
896
+ *
897
+ * @throws {@link Polytomic.ForbiddenError}
898
+ * @throws {@link Polytomic.NotFoundError}
899
+ * @throws {@link Polytomic.ConflictError}
900
+ * @throws {@link Polytomic.UnprocessableEntityError}
901
+ * @throws {@link Polytomic.InternalServerError}
902
+ * @throws {@link errors.PolytomicError}
903
+ * @throws {@link errors.PolytomicTimeoutError}
904
+ *
905
+ * @example
906
+ * await client.harbors.deleteSavedQueryDraft("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
907
+ */
908
+ deleteSavedQueryDraft(harbor_id: string, saved_query_id: string, requestOptions?: HarborsClient.IdempotentRequestOptions): core.HttpResponsePromise<Polytomic.DeletedHarborSavedQueryDraftEnvelope>;
909
+ private __deleteSavedQueryDraft;
910
+ /**
911
+ * Validates and publishes the current draft as the next immutable saved-query version.
912
+ *
913
+ * Only organization administrators can publish. Publication executes and validates
914
+ * the current draft with the Polytomic-managed Harbor's MotherDuck `read_scaling`
915
+ * credential. It fails instead of using the Harbor writer credential when the
916
+ * reader credential is missing or incomplete.
917
+ *
918
+ * After execution, publication verifies that the draft did not change. A
919
+ * concurrent edit returns a conflict and remains a draft. Successful publication
920
+ * creates the next immutable revision, records the observed ordered columns as its
921
+ * output contract, removes validation inputs from the published definition, and
922
+ * deletes the mutable draft. The response includes the immutable `revision_id`
923
+ * that future executions use for exact provenance.
924
+ *
925
+ * @param {string} harbor_id - Unique identifier of the Harbor.
926
+ * @param {string} saved_query_id - Unique stable identifier of the saved query.
927
+ * @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
928
+ *
929
+ * @throws {@link Polytomic.ForbiddenError}
930
+ * @throws {@link Polytomic.NotFoundError}
931
+ * @throws {@link Polytomic.ConflictError}
932
+ * @throws {@link Polytomic.UnprocessableEntityError}
933
+ * @throws {@link Polytomic.InternalServerError}
934
+ * @throws {@link errors.PolytomicError}
935
+ * @throws {@link errors.PolytomicTimeoutError}
936
+ *
937
+ * @example
938
+ * await client.harbors.publishSavedQueryDraft("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
939
+ */
940
+ publishSavedQueryDraft(harbor_id: string, saved_query_id: string, requestOptions?: HarborsClient.IdempotentRequestOptions): core.HttpResponsePromise<Polytomic.HarborSavedQueryEnvelope>;
941
+ private __publishSavedQueryDraft;
942
+ /**
943
+ * Validates the exact current saved-query draft and returns a bounded ephemeral preview.
944
+ *
945
+ * Only organization administrators can validate drafts. Named template references
946
+ * compile to DuckDB placeholders, and typed values are passed separately rather
947
+ * than interpolated into SQL.
948
+ *
949
+ * The query runs with the Polytomic-managed Harbor's MotherDuck `read_scaling`
950
+ * credential. Validation fails when that credential is missing or incomplete and
951
+ * never falls back to the Harbor writer credential. Preview rows and serialized
952
+ * response size are bounded. The preview and validation attempt are not persisted.
953
+ *
954
+ * @param {string} harbor_id - Unique identifier of the Harbor.
955
+ * @param {string} saved_query_id - Unique stable identifier of the saved query.
956
+ * @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
957
+ *
958
+ * @throws {@link Polytomic.ForbiddenError}
959
+ * @throws {@link Polytomic.NotFoundError}
960
+ * @throws {@link Polytomic.UnprocessableEntityError}
961
+ * @throws {@link Polytomic.InternalServerError}
962
+ * @throws {@link errors.PolytomicError}
963
+ * @throws {@link errors.PolytomicTimeoutError}
964
+ *
965
+ * @example
966
+ * await client.harbors.validateSavedQueryDraft("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
967
+ */
968
+ validateSavedQueryDraft(harbor_id: string, saved_query_id: string, requestOptions?: HarborsClient.IdempotentRequestOptions): core.HttpResponsePromise<Polytomic.HarborSavedQueryValidationEnvelope>;
969
+ private __validateSavedQueryDraft;
970
+ /**
971
+ * Submits the current published Harbor saved query for asynchronous reader-only execution.
972
+ *
973
+ * Use a Harbor-bound scoped credential with query access to the Harbor's backing
974
+ * Connection. Administrator credentials cannot submit executions here. Saved
975
+ * queries require a Polytomic-managed Harbor.
976
+ *
977
+ * Polytomic selects the current published revision while processing your request.
978
+ * The response identifies that exact immutable revision. Selection happens before
979
+ * Polytomic accepts the execution. Drafts, unpublished queries, and archived
980
+ * queries are unavailable for selection. You cannot select a historical revision
981
+ * or supply SQL through this endpoint.
982
+ *
983
+ * > ⚠️ Concurrent publication changes
984
+ * >
985
+ * > Publishing, unpublishing, or archiving a saved query after selection does not
986
+ * > change the selected revision. An in-flight request may still be accepted and
987
+ * > execute that revision. Unpublishing or archiving does not cancel in-flight
988
+ * > requests or queued executions. Query access is checked again before execution
989
+ * > and result retrieval.
990
+ *
991
+ * Parameter values are bound separately from SQL. Omitted parameters use the
992
+ * published `default_value`, never draft validation values. An omitted optional
993
+ * parameter without a default binds SQL `NULL`. Required parameters allow omission
994
+ * when a default exists, but reject explicit `null` even with a default. Missing
995
+ * required values without defaults, explicit `null` for required parameters,
996
+ * unknown parameter names, and invalid scalar types return
997
+ * `422 Unprocessable Entity` without accepting an execution. Execution requires
998
+ * reader credentials and never falls back to writer credentials.
999
+ *
1000
+ * For report windows, define parameters with `required: true` and a
1001
+ * `default_value`, such as `7` for a `days` parameter. This allows omission while
1002
+ * preventing explicit `null` from turning a time filter into a SQL `NULL`
1003
+ * comparison.
1004
+ *
1005
+ * To archive a saved query through REST, use
1006
+ * [`DELETE /api/harbors/{harbor_id}/saved-queries/{saved_query_id}`](../../../../../../api-reference/harbors/delete-saved-query).
1007
+ * Unpublish is available only through the GraphQL `unpublishHarborSavedQuery`
1008
+ * mutation, not a REST endpoint.
1009
+ *
1010
+ * ## Results
1011
+ *
1012
+ * The response returns a task ID with status `created`, not result rows. Poll
1013
+ * [`GET /api/queries/{id}`](../../../../../../api-reference/query-runner/get-query) using a credential
1014
+ * from the same Harbor profile. Query access is checked again before execution and
1015
+ * result retrieval. Stop polling at `done`, `failed`, or `unknown`; `unknown` means
1016
+ * execution started but no durable terminal result is available.
1017
+ *
1018
+ * Results and detailed failure information expire after 24 hours. Use the
1019
+ * `expires` field and follow `links.next` to retrieve additional result pages.
1020
+ *
1021
+ * ## Harbor Activity
1022
+ *
1023
+ * Send a new nonzero UUID in `X-Polytomic-Activity-Request-ID`. Missing or invalid
1024
+ * IDs return `400 Bad Request`. Reusing a consumed ID returns `409 Conflict` and
1025
+ * does not create another execution.
1026
+ *
1027
+ * You may omit `X-Polytomic-Harbor-Session` for direct REST requests. If supplied,
1028
+ * the session must be active and bound to your credential and Harbor.
1029
+ *
1030
+ * Polytomic records `query.submitted` atomically with acceptance. The event
1031
+ * identifies the saved query, immutable revision, published version, and bounded
1032
+ * name snapshot. SQL, parameter values and defaults, column names, and result rows
1033
+ * remain outside Activity metadata. If Activity persistence is unavailable, the
1034
+ * request returns `503 Service Unavailable` without accepting an execution.
1035
+ *
1036
+ * `query.started` records provider invocation. `query.succeeded` means results are
1037
+ * available for authorized retrieval, not that you have consumed them.
1038
+ *
1039
+ * @param {string} harbor_id - Unique identifier of the Harbor.
1040
+ * @param {string} saved_query_id - Unique stable identifier of the saved query.
1041
+ * @param {Polytomic.ExecuteHarborSavedQueryRequest} request
1042
+ * @param {HarborsClient.IdempotentRequestOptions} requestOptions - Request-specific configuration.
1043
+ *
1044
+ * @throws {@link Polytomic.BadRequestError}
1045
+ * @throws {@link Polytomic.ForbiddenError}
1046
+ * @throws {@link Polytomic.NotFoundError}
1047
+ * @throws {@link Polytomic.ConflictError}
1048
+ * @throws {@link Polytomic.UnprocessableEntityError}
1049
+ * @throws {@link Polytomic.InternalServerError}
1050
+ * @throws {@link Polytomic.ServiceUnavailableError}
1051
+ * @throws {@link errors.PolytomicError}
1052
+ * @throws {@link errors.PolytomicTimeoutError}
1053
+ *
1054
+ * @example
1055
+ * await client.harbors.executeSavedQuery("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
1056
+ */
1057
+ executeSavedQuery(harbor_id: string, saved_query_id: string, request?: Polytomic.ExecuteHarborSavedQueryRequest, requestOptions?: HarborsClient.IdempotentRequestOptions): core.HttpResponsePromise<Polytomic.ExecuteHarborSavedQueryEnvelope>;
1058
+ private __executeSavedQuery;
635
1059
  /**
636
1060
  * Resolves documented source table and field identities to the names a Harbor's backing Connection accepts.
637
1061
  *