@hydradb/sdk 2.1.3 → 2.1.4
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/dist/api/client/requests/SearchQueryRequest.d.ts +12 -0
- package/dist/api/resources/connectors/client/Client.d.ts +22 -1
- package/dist/api/resources/connectors/client/Client.js +82 -1
- package/dist/api/resources/connectors/client/requests/HandlerConnectorCreateReq.d.ts +6 -0
- package/dist/api/resources/connectors/client/requests/HandlerConnectorUpdateReq.d.ts +6 -0
- package/dist/api/resources/connectors/client/requests/HandlerResourceCreateReq.d.ts +12 -0
- package/dist/api/resources/connectors/client/requests/UpdateResourceAclConnectorsRequest.d.ts +17 -0
- package/dist/api/resources/connectors/client/requests/UpdateResourceAclConnectorsRequest.js +3 -0
- package/dist/api/resources/connectors/client/requests/index.d.ts +1 -0
- package/dist/api/resources/context/client/Client.d.ts +19 -0
- package/dist/api/resources/context/client/Client.js +93 -2
- package/dist/api/resources/context/client/requests/HandlerContextMetadataUpdateRequest.d.ts +14 -0
- package/dist/api/resources/context/client/requests/IngestContextRequest.d.ts +1 -1
- package/dist/api/resources/context/client/requests/InspectContextRequest.d.ts +2 -0
- package/dist/api/resources/context/client/requests/ListV2ListContentRequest.d.ts +2 -0
- package/dist/api/resources/context/client/requests/RelationsContextRequest.d.ts +2 -0
- package/dist/api/resources/context/client/requests/SubgraphContextRequest.d.ts +31 -0
- package/dist/api/resources/context/client/requests/SubgraphContextRequest.js +3 -0
- package/dist/api/resources/context/client/requests/index.d.ts +1 -0
- package/dist/api/resources/context/types/SubgraphContextRequestType.d.ts +5 -0
- package/dist/api/resources/context/types/SubgraphContextRequestType.js +8 -0
- package/dist/api/resources/context/types/index.d.ts +1 -0
- package/dist/api/resources/context/types/index.js +1 -0
- package/dist/api/resources/webhooks/client/Client.d.ts +19 -0
- package/dist/api/resources/webhooks/client/Client.js +80 -0
- package/dist/api/resources/webhooks/client/requests/PostWebhooksSupabaseRequest.d.ts +14 -0
- package/dist/api/resources/webhooks/client/requests/PostWebhooksSupabaseRequest.js +3 -0
- package/dist/api/resources/webhooks/client/requests/index.d.ts +1 -0
- package/dist/api/types/ConnectorsResource.d.ts +43 -0
- package/dist/api/types/GithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.d.ts +30 -0
- package/dist/api/types/GraphEntity.d.ts +12 -0
- package/dist/api/types/GraphGraphRelationsResponse.d.ts +23 -0
- package/dist/api/types/GraphRelationEvidence.d.ts +8 -0
- package/dist/api/types/GraphSourceSubgraphResponse.d.ts +40 -0
- package/dist/api/types/GraphSourceSubgraphResponse.js +3 -0
- package/dist/api/types/GraphSubgraphSource.d.ts +28 -0
- package/dist/api/types/GraphSubgraphSource.js +3 -0
- package/dist/api/types/GraphTripletWithEvidence.d.ts +7 -0
- package/dist/api/types/HandlerCatalogConnector.d.ts +15 -0
- package/dist/api/types/HandlerConnectorApiView.d.ts +15 -0
- package/dist/api/types/HandlerConnectorCreateResponse.d.ts +15 -0
- package/dist/api/types/HandlerConnectorResourceStatus.d.ts +16 -0
- package/dist/api/types/HandlerConnectorUpdateResponse.d.ts +5 -0
- package/dist/api/types/HandlerEnvelopeGraphSourceSubgraphResponse.d.ts +9 -0
- package/dist/api/types/HandlerEnvelopeGraphSourceSubgraphResponse.js +3 -0
- package/dist/api/types/HandlerEnvelopeHandlerSupabaseWebhookAck.d.ts +9 -0
- package/dist/api/types/HandlerEnvelopeHandlerSupabaseWebhookAck.js +3 -0
- package/dist/api/types/HandlerResourceMapping.d.ts +14 -0
- package/dist/api/types/HandlerSupabaseWebhookAck.d.ts +7 -0
- package/dist/api/types/HandlerSupabaseWebhookAck.js +3 -0
- package/dist/api/types/SearchSourceFact.d.ts +18 -0
- package/dist/api/types/SearchSourceFact.js +3 -0
- package/dist/api/types/SearchSourceFilterInfo.d.ts +15 -0
- package/dist/api/types/SearchSourceFilterInfo.js +3 -0
- package/dist/api/types/SearchV2RetrievalResult.d.ts +6 -0
- package/dist/api/types/index.d.ts +7 -0
- package/dist/api/types/index.js +7 -0
- package/dist/serialization/client/requests/SearchQueryRequest.d.ts +1 -0
- package/dist/serialization/client/requests/SearchQueryRequest.js +1 -0
- package/dist/serialization/resources/connectors/client/index.d.ts +1 -0
- package/dist/serialization/resources/connectors/client/index.js +2 -1
- package/dist/serialization/resources/connectors/client/requests/HandlerConnectorCreateReq.d.ts +1 -0
- package/dist/serialization/resources/connectors/client/requests/HandlerConnectorCreateReq.js +1 -0
- package/dist/serialization/resources/connectors/client/requests/HandlerConnectorUpdateReq.d.ts +1 -0
- package/dist/serialization/resources/connectors/client/requests/HandlerConnectorUpdateReq.js +1 -0
- package/dist/serialization/resources/connectors/client/requests/HandlerResourceCreateReq.d.ts +2 -0
- package/dist/serialization/resources/connectors/client/requests/HandlerResourceCreateReq.js +2 -0
- package/dist/serialization/resources/connectors/client/updateResourceAcl.d.ts +10 -0
- package/dist/serialization/resources/connectors/client/updateResourceAcl.js +40 -0
- package/dist/serialization/resources/context/client/requests/HandlerContextMetadataUpdateRequest.d.ts +1 -0
- package/dist/serialization/resources/context/client/requests/HandlerContextMetadataUpdateRequest.js +1 -0
- package/dist/serialization/resources/context/client/requests/ListV2ListContentRequest.d.ts +1 -0
- package/dist/serialization/resources/context/client/requests/ListV2ListContentRequest.js +1 -0
- package/dist/serialization/resources/context/types/SubgraphContextRequestType.d.ts +7 -0
- package/dist/serialization/resources/context/types/SubgraphContextRequestType.js +39 -0
- package/dist/serialization/resources/context/types/index.d.ts +1 -0
- package/dist/serialization/resources/context/types/index.js +1 -0
- package/dist/serialization/resources/webhooks/client/index.d.ts +1 -0
- package/dist/serialization/resources/webhooks/client/index.js +24 -0
- package/dist/serialization/resources/webhooks/client/supabaseRowChangeWebhook.d.ts +6 -0
- package/dist/serialization/resources/webhooks/client/supabaseRowChangeWebhook.js +39 -0
- package/dist/serialization/types/ConnectorsResource.d.ts +6 -0
- package/dist/serialization/types/ConnectorsResource.js +6 -0
- package/dist/serialization/types/GithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.d.ts +5 -0
- package/dist/serialization/types/GithubComHydradbHydradbApplicationInternalServiceMetadataEditResult.js +5 -0
- package/dist/serialization/types/GraphEntity.d.ts +1 -0
- package/dist/serialization/types/GraphEntity.js +1 -0
- package/dist/serialization/types/GraphGraphRelationsResponse.d.ts +2 -0
- package/dist/serialization/types/GraphGraphRelationsResponse.js +2 -0
- package/dist/serialization/types/GraphRelationEvidence.d.ts +1 -0
- package/dist/serialization/types/GraphRelationEvidence.js +1 -0
- package/dist/serialization/types/GraphSourceSubgraphResponse.d.ts +19 -0
- package/dist/serialization/types/GraphSourceSubgraphResponse.js +51 -0
- package/dist/serialization/types/GraphSubgraphSource.d.ts +18 -0
- package/dist/serialization/types/GraphSubgraphSource.js +50 -0
- package/dist/serialization/types/GraphTripletWithEvidence.d.ts +1 -0
- package/dist/serialization/types/GraphTripletWithEvidence.js +1 -0
- package/dist/serialization/types/HandlerCatalogConnector.d.ts +3 -0
- package/dist/serialization/types/HandlerCatalogConnector.js +3 -0
- package/dist/serialization/types/HandlerConnectorApiView.d.ts +2 -0
- package/dist/serialization/types/HandlerConnectorApiView.js +2 -0
- package/dist/serialization/types/HandlerConnectorCreateResponse.d.ts +2 -0
- package/dist/serialization/types/HandlerConnectorCreateResponse.js +2 -0
- package/dist/serialization/types/HandlerConnectorResourceStatus.d.ts +4 -0
- package/dist/serialization/types/HandlerConnectorResourceStatus.js +4 -0
- package/dist/serialization/types/HandlerConnectorUpdateResponse.d.ts +1 -0
- package/dist/serialization/types/HandlerConnectorUpdateResponse.js +1 -0
- package/dist/serialization/types/HandlerEnvelopeGraphSourceSubgraphResponse.d.ts +15 -0
- package/dist/serialization/types/HandlerEnvelopeGraphSourceSubgraphResponse.js +47 -0
- package/dist/serialization/types/HandlerEnvelopeHandlerSupabaseWebhookAck.d.ts +15 -0
- package/dist/serialization/types/HandlerEnvelopeHandlerSupabaseWebhookAck.js +47 -0
- package/dist/serialization/types/HandlerResourceMapping.d.ts +2 -0
- package/dist/serialization/types/HandlerResourceMapping.js +2 -0
- package/dist/serialization/types/HandlerSupabaseWebhookAck.d.ts +11 -0
- package/dist/serialization/types/HandlerSupabaseWebhookAck.js +43 -0
- package/dist/serialization/types/SearchSourceFact.d.ts +20 -0
- package/dist/serialization/types/SearchSourceFact.js +52 -0
- package/dist/serialization/types/SearchSourceFilterInfo.d.ts +17 -0
- package/dist/serialization/types/SearchSourceFilterInfo.js +49 -0
- package/dist/serialization/types/SearchV2RetrievalResult.d.ts +4 -0
- package/dist/serialization/types/SearchV2RetrievalResult.js +4 -0
- package/dist/serialization/types/index.d.ts +7 -0
- package/dist/serialization/types/index.js +7 -0
- package/package.json +1 -1
|
@@ -4,6 +4,18 @@ import type * as HydraDB from "../../index.js";
|
|
|
4
4
|
* {}
|
|
5
5
|
*/
|
|
6
6
|
export interface SearchQueryRequest {
|
|
7
|
+
/**
|
|
8
|
+
* ACL scopes retrieval to documents the given principals may access
|
|
9
|
+
* (PRO-1684 document ACLs): a document matches when its stored ACL is
|
|
10
|
+
* empty (unrestricted, pre-RBAC content and connectors without permission
|
|
11
|
+
* support), contains __public__, or intersects these principals. Entries
|
|
12
|
+
* are bare emails or prefixed principals (user_email:/group:/domain:).
|
|
13
|
+
* Omitted, empty, or ["*"] disables ACL filtering entirely, today's
|
|
14
|
+
* behavior. Like IDs, the resulting clause survives the metadata
|
|
15
|
+
* zero-result retry. An entry that is not a known principal fails CLOSED:
|
|
16
|
+
* it matches only public and unrestricted documents, never restricted.
|
|
17
|
+
*/
|
|
18
|
+
acl?: string[];
|
|
7
19
|
/** Optional context string prepended to the query to improve retrieval relevance. */
|
|
8
20
|
additionalContext?: string;
|
|
9
21
|
/** Weighting balance between dense and sparse retrieval in hybrid mode. `"auto"` lets HydraDB choose; a number from 0 (full BM25) to 1 (full dense) sets it explicitly. */
|
|
@@ -94,7 +94,7 @@ export declare class ConnectorsClient {
|
|
|
94
94
|
delete(request: HydraDB.DeleteConnectorsRequest, requestOptions?: ConnectorsClient.RequestOptions): core.HttpResponsePromise<HydraDB.HandlerConnectorDeleteResponse>;
|
|
95
95
|
private __delete;
|
|
96
96
|
/**
|
|
97
|
-
* Update a connector's mutable settings. `sync_interval_seconds` sets the cadence at which the scheduler starts incremental syncs: the allowed range is provider-aware and returned in the response; values outside it are rejected rather than clamped; 0 resets to the provider default; changing it re-anchors the next sync so a shorter cadence takes effect immediately. `credentials` reconnects the connector in place: send the provider's full credential set (what create accepts); supplied keys replace their stored values, other stored keys survive, the bundle is re-validated against the provider's credential schema, and a pending needs-reauth flag is cleared — the connector keeps its id, resources, and sync cursors.
|
|
97
|
+
* Update a connector's mutable settings. `sync_interval_seconds` sets the cadence at which the scheduler starts incremental syncs: the allowed range is provider-aware and returned in the response; values outside it are rejected rather than clamped; 0 resets to the provider default; changing it re-anchors the next sync so a shorter cadence takes effect immediately. `credentials` reconnects the connector in place: send the provider's full credential set (what create accepts); supplied keys replace their stored values, other stored keys survive, the bundle is re-validated against the provider's credential schema, and a pending needs-reauth flag is cleared — the connector keeps its id, resources, and sync cursors. `custom_instructions` replaces the free-text steering applied when this connector's documents are ingested (an explicit empty string clears it); the change applies from the next sync cycle and does not re-process already-ingested documents. When several fields are supplied together they are validated up front and applied atomically: an invalid value rejects the whole request with nothing changed.
|
|
98
98
|
*
|
|
99
99
|
* @param {HydraDB.HandlerConnectorUpdateReq} request
|
|
100
100
|
* @param {ConnectorsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -234,6 +234,27 @@ export declare class ConnectorsClient {
|
|
|
234
234
|
*/
|
|
235
235
|
deleteResource(request: HydraDB.DeleteResourceConnectorsRequest, requestOptions?: ConnectorsClient.RequestOptions): core.HttpResponsePromise<HydraDB.HandlerResourceDeleteResponse>;
|
|
236
236
|
private __deleteResource;
|
|
237
|
+
/**
|
|
238
|
+
* Updates per-resource settings. `acl` sets the customer-declared ACL for one connector resource (PRO-1684): the rule is normalized (emails prefixed, __public__ dominates, explicit-empty becomes __private__), persisted on the resource, and applied to enforcement immediately via the resource's ACL row, every already-indexed document of the resource is governed by it on the next query, with no re-sync. For providers with provider-derived ACL capture enabled, the provider's own ACL takes precedence again at the next sync; the rule is the standing fallback. `custom_instructions` sets the resource-level ingestion-instructions override (max 4000 characters): when set it replaces the connector-level custom_instructions for documents synced from this resource, an explicit empty string clears the override back to inheriting the connector's value, and changes apply from the next sync cycle. At least one field must be supplied; omitted fields are left unchanged.
|
|
239
|
+
*
|
|
240
|
+
* @param {HydraDB.UpdateResourceAclConnectorsRequest} request
|
|
241
|
+
* @param {ConnectorsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
242
|
+
*
|
|
243
|
+
* @throws {@link HydraDB.BadRequestError}
|
|
244
|
+
* @throws {@link HydraDB.NotFoundError}
|
|
245
|
+
* @throws {@link HydraDB.InternalServerError}
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* await client.connectors.updateResourceAcl({
|
|
249
|
+
* id: "HydraDoc1234",
|
|
250
|
+
* resourceId: "C0123456789",
|
|
251
|
+
* body: {
|
|
252
|
+
* "key": "value"
|
|
253
|
+
* }
|
|
254
|
+
* })
|
|
255
|
+
*/
|
|
256
|
+
updateResourceAcl(request: HydraDB.UpdateResourceAclConnectorsRequest, requestOptions?: ConnectorsClient.RequestOptions): core.HttpResponsePromise<Record<string, unknown>>;
|
|
257
|
+
private __updateResourceAcl;
|
|
237
258
|
/**
|
|
238
259
|
* Report whether a connector is working, in one call: a rollup status (healthy, degraded, failed, checking) plus per-resource detail. `degraded` means the connector is syncing but at least one configured resource is failing — the state that is otherwise invisible, because a connector whose resources partly fail still reports an idle sync status and no error.
|
|
239
260
|
*
|
|
@@ -411,7 +411,7 @@ class ConnectorsClient {
|
|
|
411
411
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/connectors/{id}");
|
|
412
412
|
}
|
|
413
413
|
/**
|
|
414
|
-
* Update a connector's mutable settings. `sync_interval_seconds` sets the cadence at which the scheduler starts incremental syncs: the allowed range is provider-aware and returned in the response; values outside it are rejected rather than clamped; 0 resets to the provider default; changing it re-anchors the next sync so a shorter cadence takes effect immediately. `credentials` reconnects the connector in place: send the provider's full credential set (what create accepts); supplied keys replace their stored values, other stored keys survive, the bundle is re-validated against the provider's credential schema, and a pending needs-reauth flag is cleared — the connector keeps its id, resources, and sync cursors.
|
|
414
|
+
* Update a connector's mutable settings. `sync_interval_seconds` sets the cadence at which the scheduler starts incremental syncs: the allowed range is provider-aware and returned in the response; values outside it are rejected rather than clamped; 0 resets to the provider default; changing it re-anchors the next sync so a shorter cadence takes effect immediately. `credentials` reconnects the connector in place: send the provider's full credential set (what create accepts); supplied keys replace their stored values, other stored keys survive, the bundle is re-validated against the provider's credential schema, and a pending needs-reauth flag is cleared — the connector keeps its id, resources, and sync cursors. `custom_instructions` replaces the free-text steering applied when this connector's documents are ingested (an explicit empty string clears it); the change applies from the next sync cycle and does not re-process already-ingested documents. When several fields are supplied together they are validated up front and applied atomically: an invalid value rejects the whole request with nothing changed.
|
|
415
415
|
*
|
|
416
416
|
* @param {HydraDB.HandlerConnectorUpdateReq} request
|
|
417
417
|
* @param {ConnectorsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
@@ -973,6 +973,87 @@ class ConnectorsClient {
|
|
|
973
973
|
}
|
|
974
974
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/connectors/{id}/resources/{resource_id}");
|
|
975
975
|
}
|
|
976
|
+
/**
|
|
977
|
+
* Updates per-resource settings. `acl` sets the customer-declared ACL for one connector resource (PRO-1684): the rule is normalized (emails prefixed, __public__ dominates, explicit-empty becomes __private__), persisted on the resource, and applied to enforcement immediately via the resource's ACL row, every already-indexed document of the resource is governed by it on the next query, with no re-sync. For providers with provider-derived ACL capture enabled, the provider's own ACL takes precedence again at the next sync; the rule is the standing fallback. `custom_instructions` sets the resource-level ingestion-instructions override (max 4000 characters): when set it replaces the connector-level custom_instructions for documents synced from this resource, an explicit empty string clears the override back to inheriting the connector's value, and changes apply from the next sync cycle. At least one field must be supplied; omitted fields are left unchanged.
|
|
978
|
+
*
|
|
979
|
+
* @param {HydraDB.UpdateResourceAclConnectorsRequest} request
|
|
980
|
+
* @param {ConnectorsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
981
|
+
*
|
|
982
|
+
* @throws {@link HydraDB.BadRequestError}
|
|
983
|
+
* @throws {@link HydraDB.NotFoundError}
|
|
984
|
+
* @throws {@link HydraDB.InternalServerError}
|
|
985
|
+
*
|
|
986
|
+
* @example
|
|
987
|
+
* await client.connectors.updateResourceAcl({
|
|
988
|
+
* id: "HydraDoc1234",
|
|
989
|
+
* resourceId: "C0123456789",
|
|
990
|
+
* body: {
|
|
991
|
+
* "key": "value"
|
|
992
|
+
* }
|
|
993
|
+
* })
|
|
994
|
+
*/
|
|
995
|
+
updateResourceAcl(request, requestOptions) {
|
|
996
|
+
return core.HttpResponsePromise.fromPromise(this.__updateResourceAcl(request, requestOptions));
|
|
997
|
+
}
|
|
998
|
+
async __updateResourceAcl(request, requestOptions) {
|
|
999
|
+
const { id, resourceId, body: _body } = request;
|
|
1000
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
1001
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "API-Version": requestOptions?.apiVersion ?? this._options?.apiVersion ?? "2" }), requestOptions?.headers);
|
|
1002
|
+
const _response = await core.fetcher({
|
|
1003
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
1004
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
1005
|
+
environments.HydraDBEnvironment.Default, `connectors/${core.url.encodePathParam(id)}/resources/${core.url.encodePathParam(resourceId)}`),
|
|
1006
|
+
method: "PATCH",
|
|
1007
|
+
headers: _headers,
|
|
1008
|
+
contentType: "application/json",
|
|
1009
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
1010
|
+
requestType: "json",
|
|
1011
|
+
body: serializers.connectors.updateResourceAcl.Request.jsonOrThrow(_body, {
|
|
1012
|
+
unrecognizedObjectKeys: "strip",
|
|
1013
|
+
omitUndefined: true,
|
|
1014
|
+
}),
|
|
1015
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
1016
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
1017
|
+
abortSignal: requestOptions?.abortSignal,
|
|
1018
|
+
fetchFn: this._options?.fetch,
|
|
1019
|
+
logging: this._options.logging,
|
|
1020
|
+
});
|
|
1021
|
+
if (_response.ok) {
|
|
1022
|
+
return {
|
|
1023
|
+
data: serializers.connectors.updateResourceAcl.Response.parseOrThrow(_response.body, {
|
|
1024
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1025
|
+
allowUnrecognizedUnionMembers: true,
|
|
1026
|
+
allowUnrecognizedEnumValues: true,
|
|
1027
|
+
skipValidation: true,
|
|
1028
|
+
breadcrumbsPrefix: ["response"],
|
|
1029
|
+
}),
|
|
1030
|
+
rawResponse: _response.rawResponse,
|
|
1031
|
+
};
|
|
1032
|
+
}
|
|
1033
|
+
if (_response.error.reason === "status-code") {
|
|
1034
|
+
switch (_response.error.statusCode) {
|
|
1035
|
+
case 400:
|
|
1036
|
+
throw new HydraDB.BadRequestError(serializers.HandlerErrorResponse.parseOrThrow(_response.error.body, {
|
|
1037
|
+
unrecognizedObjectKeys: "passthrough",
|
|
1038
|
+
allowUnrecognizedUnionMembers: true,
|
|
1039
|
+
allowUnrecognizedEnumValues: true,
|
|
1040
|
+
skipValidation: true,
|
|
1041
|
+
breadcrumbsPrefix: ["response"],
|
|
1042
|
+
}), _response.rawResponse);
|
|
1043
|
+
case 404:
|
|
1044
|
+
throw new HydraDB.NotFoundError(_response.error.body, _response.rawResponse);
|
|
1045
|
+
case 500:
|
|
1046
|
+
throw new HydraDB.InternalServerError(_response.error.body, _response.rawResponse);
|
|
1047
|
+
default:
|
|
1048
|
+
throw new errors.HydraDBError({
|
|
1049
|
+
statusCode: _response.error.statusCode,
|
|
1050
|
+
body: _response.error.body,
|
|
1051
|
+
rawResponse: _response.rawResponse,
|
|
1052
|
+
});
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/connectors/{id}/resources/{resource_id}");
|
|
1056
|
+
}
|
|
976
1057
|
/**
|
|
977
1058
|
* Report whether a connector is working, in one call: a rollup status (healthy, degraded, failed, checking) plus per-resource detail. `degraded` means the connector is syncing but at least one configured resource is failing — the state that is otherwise invisible, because a connector whose resources partly fail still reports an idle sync status and no error.
|
|
978
1059
|
*
|
|
@@ -11,6 +11,12 @@ export interface HandlerConnectorCreateReq {
|
|
|
11
11
|
collection?: string;
|
|
12
12
|
/** Provider-specific credentials (typically `{"api_token": "..."}` or `{"access_token": "..."}`). */
|
|
13
13
|
credentials?: Record<string, unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* CustomInstructions optionally steers how this connector's synced
|
|
16
|
+
* documents are ingested and indexed. Max 4000 characters; editable later
|
|
17
|
+
* via PATCH.
|
|
18
|
+
*/
|
|
19
|
+
customInstructions?: string;
|
|
14
20
|
/**
|
|
15
21
|
* Database/Collection are the canonical v2 names; TenantID/SubTenantID are
|
|
16
22
|
* their deprecated aliases, reconciled by the TenantAliases middleware before
|
|
@@ -9,6 +9,12 @@ export interface HandlerConnectorUpdateReq {
|
|
|
9
9
|
id: string;
|
|
10
10
|
/** Provider-specific credentials (typically `{"api_token": "..."}` or `{"access_token": "..."}`). */
|
|
11
11
|
credentials?: Record<string, unknown>;
|
|
12
|
+
/**
|
|
13
|
+
* CustomInstructions replaces the guidance applied when this connector's
|
|
14
|
+
* documents are ingested. Omitted leaves it unchanged; an explicit empty
|
|
15
|
+
* string clears it. Max 4000 characters; applies from the next sync cycle.
|
|
16
|
+
*/
|
|
17
|
+
customInstructions?: string;
|
|
12
18
|
/** How frequently the scheduler triggers incremental syncs, in seconds. Bounded per provider; send 0 or omit to use the provider default. Change it later with PATCH /connectors/{id}. */
|
|
13
19
|
syncIntervalSeconds?: number;
|
|
14
20
|
}
|
|
@@ -8,9 +8,21 @@
|
|
|
8
8
|
export interface HandlerResourceCreateReq {
|
|
9
9
|
/** Connector ID */
|
|
10
10
|
id: string;
|
|
11
|
+
/**
|
|
12
|
+
* ACL restricts every object synced from this resource to the listed
|
|
13
|
+
* principals (see resourceMapping.ACL). Omitted means unrestricted.
|
|
14
|
+
*/
|
|
15
|
+
acl?: string[];
|
|
11
16
|
/** Key-value pairs merged into document metadata on every synced object from this resource. Capped at 1 KiB, measured on the compact JSON encoding of the whole map in UTF-8 bytes — keys, quotes, commas and braces count toward the budget. The cap is applied when synced objects are ingested, not to this request. */
|
|
12
17
|
additionalMetadata?: Record<string, unknown>;
|
|
13
18
|
collectionOverride?: string;
|
|
19
|
+
/**
|
|
20
|
+
* CustomInstructions optionally steers how documents synced from this
|
|
21
|
+
* resource are ingested and indexed. When set it replaces the
|
|
22
|
+
* connector-level custom_instructions for this resource; empty inherits
|
|
23
|
+
* the connector's value. Max 4000 characters.
|
|
24
|
+
*/
|
|
25
|
+
customInstructions?: string;
|
|
14
26
|
databaseOverride?: string;
|
|
15
27
|
/** Human-readable name for this resource. */
|
|
16
28
|
displayName?: string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* id: "HydraDoc1234",
|
|
5
|
+
* resourceId: "C0123456789",
|
|
6
|
+
* body: {
|
|
7
|
+
* "key": "value"
|
|
8
|
+
* }
|
|
9
|
+
* }
|
|
10
|
+
*/
|
|
11
|
+
export interface UpdateResourceAclConnectorsRequest {
|
|
12
|
+
/** Connector ID */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Resource ID */
|
|
15
|
+
resourceId: string;
|
|
16
|
+
body: Record<string, unknown>;
|
|
17
|
+
}
|
|
@@ -12,3 +12,4 @@ export type { ListResourcesConnectorsRequest } from "./ListResourcesConnectorsRe
|
|
|
12
12
|
export type { PatchConnectorsIdCredentialsRequest } from "./PatchConnectorsIdCredentialsRequest.js";
|
|
13
13
|
export type { StatusConnectorsRequest } from "./StatusConnectorsRequest.js";
|
|
14
14
|
export type { SyncConnectorsRequest } from "./SyncConnectorsRequest.js";
|
|
15
|
+
export type { UpdateResourceAclConnectorsRequest } from "./UpdateResourceAclConnectorsRequest.js";
|
|
@@ -131,6 +131,25 @@ export declare class ContextClient {
|
|
|
131
131
|
*/
|
|
132
132
|
status(request: HydraDB.StatusContextRequest, requestOptions?: ContextClient.RequestOptions): core.HttpResponsePromise<HydraDB.HandlerEnvelopeIngestionV2BatchProcessingStatus>;
|
|
133
133
|
private __status;
|
|
134
|
+
/**
|
|
135
|
+
* Return the connected subgraph of a source: every source reachable from it through source-level relations (RELATES_TO edges, shared thread, parent/child hierarchy, traversed BFS), the relations among them, and the auxiliary graph around them (entities, comments, attachments, actors). Chunk-level entity relations are not included.
|
|
136
|
+
*
|
|
137
|
+
* @param {HydraDB.SubgraphContextRequest} request
|
|
138
|
+
* @param {ContextClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
139
|
+
*
|
|
140
|
+
* @throws {@link HydraDB.BadRequestError}
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* await client.context.subgraph({
|
|
144
|
+
* database: "acme_corp",
|
|
145
|
+
* collection: "team_docs",
|
|
146
|
+
* tenantId: "tenant_1234",
|
|
147
|
+
* subTenantId: "sub_tenant_4567",
|
|
148
|
+
* id: "HydraDoc1234"
|
|
149
|
+
* })
|
|
150
|
+
*/
|
|
151
|
+
subgraph(request: HydraDB.SubgraphContextRequest, requestOptions?: ContextClient.RequestOptions): core.HttpResponsePromise<HydraDB.HandlerEnvelopeGraphSourceSubgraphResponse>;
|
|
152
|
+
private __subgraph;
|
|
134
153
|
/**
|
|
135
154
|
* Merge/upsert database_metadata and additional_metadata for one source. collection is required.
|
|
136
155
|
*
|
|
@@ -299,7 +299,7 @@ class ContextClient {
|
|
|
299
299
|
return core.HttpResponsePromise.fromPromise(this.__inspect(request, requestOptions));
|
|
300
300
|
}
|
|
301
301
|
async __inspect(request, requestOptions) {
|
|
302
|
-
const { id, database, collection, tenantId, subTenantId, expirySeconds, mode } = request;
|
|
302
|
+
const { id, database, collection, tenantId, subTenantId, expirySeconds, mode, acl } = request;
|
|
303
303
|
const _queryParams = {
|
|
304
304
|
id,
|
|
305
305
|
database,
|
|
@@ -308,6 +308,7 @@ class ContextClient {
|
|
|
308
308
|
sub_tenant_id: subTenantId,
|
|
309
309
|
expiry_seconds: expirySeconds,
|
|
310
310
|
mode,
|
|
311
|
+
acl,
|
|
311
312
|
};
|
|
312
313
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
313
314
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "API-Version": requestOptions?.apiVersion ?? this._options?.apiVersion ?? "2" }), requestOptions?.headers);
|
|
@@ -451,7 +452,7 @@ class ContextClient {
|
|
|
451
452
|
return core.HttpResponsePromise.fromPromise(this.__relations(request, requestOptions));
|
|
452
453
|
}
|
|
453
454
|
async __relations(request, requestOptions) {
|
|
454
|
-
const { database, collection, tenantId, subTenantId, id, type: type_, limit, cursor } = request;
|
|
455
|
+
const { database, collection, tenantId, subTenantId, id, type: type_, limit, cursor, acl } = request;
|
|
455
456
|
const _queryParams = {
|
|
456
457
|
database,
|
|
457
458
|
collection,
|
|
@@ -466,6 +467,7 @@ class ContextClient {
|
|
|
466
467
|
: undefined,
|
|
467
468
|
limit,
|
|
468
469
|
cursor,
|
|
470
|
+
acl,
|
|
469
471
|
};
|
|
470
472
|
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
471
473
|
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "API-Version": requestOptions?.apiVersion ?? this._options?.apiVersion ?? "2" }), requestOptions?.headers);
|
|
@@ -599,6 +601,95 @@ class ContextClient {
|
|
|
599
601
|
}
|
|
600
602
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/context/status");
|
|
601
603
|
}
|
|
604
|
+
/**
|
|
605
|
+
* Return the connected subgraph of a source: every source reachable from it through source-level relations (RELATES_TO edges, shared thread, parent/child hierarchy, traversed BFS), the relations among them, and the auxiliary graph around them (entities, comments, attachments, actors). Chunk-level entity relations are not included.
|
|
606
|
+
*
|
|
607
|
+
* @param {HydraDB.SubgraphContextRequest} request
|
|
608
|
+
* @param {ContextClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
609
|
+
*
|
|
610
|
+
* @throws {@link HydraDB.BadRequestError}
|
|
611
|
+
*
|
|
612
|
+
* @example
|
|
613
|
+
* await client.context.subgraph({
|
|
614
|
+
* database: "acme_corp",
|
|
615
|
+
* collection: "team_docs",
|
|
616
|
+
* tenantId: "tenant_1234",
|
|
617
|
+
* subTenantId: "sub_tenant_4567",
|
|
618
|
+
* id: "HydraDoc1234"
|
|
619
|
+
* })
|
|
620
|
+
*/
|
|
621
|
+
subgraph(request, requestOptions) {
|
|
622
|
+
return core.HttpResponsePromise.fromPromise(this.__subgraph(request, requestOptions));
|
|
623
|
+
}
|
|
624
|
+
async __subgraph(request, requestOptions) {
|
|
625
|
+
const { database, collection, tenantId, subTenantId, id, type: type_, depth, maxSources, acl } = request;
|
|
626
|
+
const _queryParams = {
|
|
627
|
+
database,
|
|
628
|
+
collection,
|
|
629
|
+
tenant_id: tenantId,
|
|
630
|
+
sub_tenant_id: subTenantId,
|
|
631
|
+
id,
|
|
632
|
+
type: type_ != null
|
|
633
|
+
? serializers.SubgraphContextRequestType.jsonOrThrow(type_, {
|
|
634
|
+
unrecognizedObjectKeys: "strip",
|
|
635
|
+
omitUndefined: true,
|
|
636
|
+
})
|
|
637
|
+
: undefined,
|
|
638
|
+
depth,
|
|
639
|
+
max_sources: maxSources,
|
|
640
|
+
acl,
|
|
641
|
+
};
|
|
642
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
643
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "API-Version": requestOptions?.apiVersion ?? this._options?.apiVersion ?? "2" }), requestOptions?.headers);
|
|
644
|
+
const _response = await core.fetcher({
|
|
645
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
646
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
647
|
+
environments.HydraDBEnvironment.Default, "context/subgraph"),
|
|
648
|
+
method: "GET",
|
|
649
|
+
headers: _headers,
|
|
650
|
+
queryString: core.url
|
|
651
|
+
.queryBuilder()
|
|
652
|
+
.addMany(_queryParams)
|
|
653
|
+
.mergeAdditional(requestOptions?.queryParams)
|
|
654
|
+
.build(),
|
|
655
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
656
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
657
|
+
abortSignal: requestOptions?.abortSignal,
|
|
658
|
+
fetchFn: this._options?.fetch,
|
|
659
|
+
logging: this._options.logging,
|
|
660
|
+
});
|
|
661
|
+
if (_response.ok) {
|
|
662
|
+
return {
|
|
663
|
+
data: serializers.HandlerEnvelopeGraphSourceSubgraphResponse.parseOrThrow(_response.body, {
|
|
664
|
+
unrecognizedObjectKeys: "passthrough",
|
|
665
|
+
allowUnrecognizedUnionMembers: true,
|
|
666
|
+
allowUnrecognizedEnumValues: true,
|
|
667
|
+
skipValidation: true,
|
|
668
|
+
breadcrumbsPrefix: ["response"],
|
|
669
|
+
}),
|
|
670
|
+
rawResponse: _response.rawResponse,
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
if (_response.error.reason === "status-code") {
|
|
674
|
+
switch (_response.error.statusCode) {
|
|
675
|
+
case 400:
|
|
676
|
+
throw new HydraDB.BadRequestError(serializers.HandlerErrorResponse.parseOrThrow(_response.error.body, {
|
|
677
|
+
unrecognizedObjectKeys: "passthrough",
|
|
678
|
+
allowUnrecognizedUnionMembers: true,
|
|
679
|
+
allowUnrecognizedEnumValues: true,
|
|
680
|
+
skipValidation: true,
|
|
681
|
+
breadcrumbsPrefix: ["response"],
|
|
682
|
+
}), _response.rawResponse);
|
|
683
|
+
default:
|
|
684
|
+
throw new errors.HydraDBError({
|
|
685
|
+
statusCode: _response.error.statusCode,
|
|
686
|
+
body: _response.error.body,
|
|
687
|
+
rawResponse: _response.rawResponse,
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/context/subgraph");
|
|
692
|
+
}
|
|
602
693
|
/**
|
|
603
694
|
* Merge/upsert database_metadata and additional_metadata for one source. collection is required.
|
|
604
695
|
*
|
|
@@ -7,6 +7,20 @@
|
|
|
7
7
|
export interface HandlerContextMetadataUpdateRequest {
|
|
8
8
|
/** Source ID */
|
|
9
9
|
id: string;
|
|
10
|
+
/**
|
|
11
|
+
* ACL, when present, REPLACES the source's access-control list without
|
|
12
|
+
* re-ingestion (PRO-1684): pass the COMPLETE new allow-list (adding a
|
|
13
|
+
* third user means sending all three), an empty list to make the source
|
|
14
|
+
* private, or ["__public__"] to open it to every identified caller. A
|
|
15
|
+
* pointer so omitted (nil, ACL untouched) is distinguishable from an
|
|
16
|
+
* explicit empty list (private).
|
|
17
|
+
* ACL uses RawMessage so the handler can tell three wire states apart:
|
|
18
|
+
* absent (leave the stored ACL untouched), explicit null (revoke to
|
|
19
|
+
* nobody, JSON-merge-patch semantics), and a list (replace). A plain
|
|
20
|
+
* *[]string cannot: encoding/json leaves the pointer nil for BOTH
|
|
21
|
+
* absent and null, which silently ignored an explicit null revocation.
|
|
22
|
+
*/
|
|
23
|
+
acl?: string[];
|
|
10
24
|
/** Free-form key-value pairs to merge into the source's `additional_metadata`. The only accepted spelling for document metadata on this endpoint. Capped at 1 KiB, measured on the compact JSON encoding of the whole map in UTF-8 bytes — keys, quotes, commas and braces count toward the budget. Over-cap returns 400 with the actual byte count. */
|
|
11
25
|
additionalMetadata?: Record<string, unknown>;
|
|
12
26
|
/** Collection scope. Defaults to the default collection when omitted. Formerly `sub_tenant_id`; the `sub_tenant_id` alias is still accepted (deprecated). */
|
|
@@ -7,7 +7,7 @@ import type * as HydraDB from "../../../../index.js";
|
|
|
7
7
|
* }
|
|
8
8
|
*/
|
|
9
9
|
export interface IngestContextRequest {
|
|
10
|
-
/** App-knowledge items as a JSON array (type=knowledge). Per item, `metadata` is capped at 16 KiB and `additional_metadata` at 1 KiB, measured on the compact JSON encoding of the whole map in UTF-8 bytes (keys and punctuation count). The deprecated `tenant_metadata` / `document_metadata` spellings are accepted here and held to the same caps. Over-cap returns 400 with the actual byte count. */
|
|
10
|
+
/** App-knowledge items as a JSON array (type=knowledge). Per item, `metadata` is capped at 16 KiB and `additional_metadata` at 1 KiB, measured on the compact JSON encoding of the whole map in UTF-8 bytes (keys and punctuation count). The deprecated `tenant_metadata` / `document_metadata` spellings are accepted here and held to the same caps. Over-cap returns 400 with the actual byte count. Each item may also carry `acl`, a list of principals (`user_email:<email>`, a bare email, `group:<provider>:<id>`, `domain:<domain>`, or `__public__`) restricting who may retrieve it; omit it to leave the document unrestricted, and send an empty list to restrict it to nobody. A malformed principal rejects the whole request with 400. */
|
|
11
11
|
appKnowledge?: string;
|
|
12
12
|
collection?: string;
|
|
13
13
|
database: string;
|
|
@@ -24,4 +24,6 @@ export interface InspectContextRequest {
|
|
|
24
24
|
expirySeconds?: number;
|
|
25
25
|
/** Fetch mode */
|
|
26
26
|
mode?: string;
|
|
27
|
+
/** Principals to answer as (PRO-1684 document ACLs): the source must be visible to them, or the response is 404. Repeated (acl=a&acl=b) or comma-separated. Omit for no ACL scoping. */
|
|
28
|
+
acl?: string | string[];
|
|
27
29
|
}
|
|
@@ -4,6 +4,8 @@ import type * as HydraDB from "../../../../index.js";
|
|
|
4
4
|
* {}
|
|
5
5
|
*/
|
|
6
6
|
export interface ListV2ListContentRequest {
|
|
7
|
+
/** ACL: see ListContentRequest.ACL (PRO-1684 document ACLs). */
|
|
8
|
+
acl?: string[];
|
|
7
9
|
/** Collection scope. Defaults to the default collection when omitted. Formerly `sub_tenant_id`; the `sub_tenant_id` alias is still accepted (deprecated). */
|
|
8
10
|
collection?: string;
|
|
9
11
|
/**
|
|
@@ -26,4 +26,6 @@ export interface RelationsContextRequest {
|
|
|
26
26
|
limit?: number;
|
|
27
27
|
/** Pagination cursor */
|
|
28
28
|
cursor?: number;
|
|
29
|
+
/** Principals to answer as (PRO-1684 document ACLs): only relations attributable to sources they may see are returned. Repeated (acl=a&acl=b) or comma-separated. Omit for no ACL scoping. */
|
|
30
|
+
acl?: string | string[];
|
|
29
31
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type * as HydraDB from "../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* database: "acme_corp",
|
|
6
|
+
* collection: "team_docs",
|
|
7
|
+
* tenantId: "tenant_1234",
|
|
8
|
+
* subTenantId: "sub_tenant_4567",
|
|
9
|
+
* id: "HydraDoc1234"
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
export interface SubgraphContextRequest {
|
|
13
|
+
/** Database (canonical name for the tenant scope) */
|
|
14
|
+
database: string;
|
|
15
|
+
/** Collection (canonical name for the sub-tenant scope) */
|
|
16
|
+
collection?: string;
|
|
17
|
+
/** Deprecated alias for database */
|
|
18
|
+
tenantId?: string;
|
|
19
|
+
/** Deprecated alias for collection */
|
|
20
|
+
subTenantId?: string;
|
|
21
|
+
/** Seed source ID */
|
|
22
|
+
id: string;
|
|
23
|
+
/** Corpus type: 'knowledge' or 'memory' */
|
|
24
|
+
type?: HydraDB.SubgraphContextRequestType;
|
|
25
|
+
/** Max BFS depth */
|
|
26
|
+
depth?: number;
|
|
27
|
+
/** Max subgraph members */
|
|
28
|
+
maxSources?: number;
|
|
29
|
+
/** Principals to answer as (PRO-1684 document ACLs): the subgraph contains only sources they may see, filtered at every hop. Repeated (acl=a&acl=b) or comma-separated. Omit for no ACL scoping. */
|
|
30
|
+
acl?: string | string[];
|
|
31
|
+
}
|
|
@@ -5,3 +5,4 @@ export type { ListV2ListContentRequest } from "./ListV2ListContentRequest.js";
|
|
|
5
5
|
export type { RelationsContextRequest } from "./RelationsContextRequest.js";
|
|
6
6
|
export type { SourcesV2SourceDeleteRequest } from "./SourcesV2SourceDeleteRequest.js";
|
|
7
7
|
export type { StatusContextRequest } from "./StatusContextRequest.js";
|
|
8
|
+
export type { SubgraphContextRequest } from "./SubgraphContextRequest.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SubgraphContextRequestType = void 0;
|
|
5
|
+
exports.SubgraphContextRequestType = {
|
|
6
|
+
Knowledge: "knowledge",
|
|
7
|
+
Memory: "memory",
|
|
8
|
+
};
|
|
@@ -19,3 +19,4 @@ __exportStar(require("./IngestContextRequestType.js"), exports);
|
|
|
19
19
|
__exportStar(require("./ListV2ListContentRequestType.js"), exports);
|
|
20
20
|
__exportStar(require("./RelationsContextRequestType.js"), exports);
|
|
21
21
|
__exportStar(require("./SourcesV2SourceDeleteRequestType.js"), exports);
|
|
22
|
+
__exportStar(require("./SubgraphContextRequestType.js"), exports);
|
|
@@ -124,4 +124,23 @@ export declare class WebhooksClient {
|
|
|
124
124
|
*/
|
|
125
125
|
test(requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<HydraDB.HandlerEnvelopeWebhooksWebhookTestResponse>;
|
|
126
126
|
private __test;
|
|
127
|
+
/**
|
|
128
|
+
* Ingest a Supabase INSERT/UPDATE/DELETE row change into the graph.
|
|
129
|
+
*
|
|
130
|
+
* @param {HydraDB.PostWebhooksSupabaseRequest} request
|
|
131
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
132
|
+
*
|
|
133
|
+
* @throws {@link HydraDB.BadRequestError}
|
|
134
|
+
* @throws {@link HydraDB.NotFoundError}
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* await client.webhooks.supabaseRowChangeWebhook({
|
|
138
|
+
* hydraDbConnector: "X-HydraDB-Connector",
|
|
139
|
+
* body: {
|
|
140
|
+
* "key": "value"
|
|
141
|
+
* }
|
|
142
|
+
* })
|
|
143
|
+
*/
|
|
144
|
+
supabaseRowChangeWebhook(request: HydraDB.PostWebhooksSupabaseRequest, requestOptions?: WebhooksClient.RequestOptions): core.HttpResponsePromise<HydraDB.HandlerEnvelopeHandlerSupabaseWebhookAck>;
|
|
145
|
+
private __supabaseRowChangeWebhook;
|
|
127
146
|
}
|
|
@@ -576,5 +576,85 @@ class WebhooksClient {
|
|
|
576
576
|
}
|
|
577
577
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/webhooks/indexing/test");
|
|
578
578
|
}
|
|
579
|
+
/**
|
|
580
|
+
* Ingest a Supabase INSERT/UPDATE/DELETE row change into the graph.
|
|
581
|
+
*
|
|
582
|
+
* @param {HydraDB.PostWebhooksSupabaseRequest} request
|
|
583
|
+
* @param {WebhooksClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
584
|
+
*
|
|
585
|
+
* @throws {@link HydraDB.BadRequestError}
|
|
586
|
+
* @throws {@link HydraDB.NotFoundError}
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* await client.webhooks.supabaseRowChangeWebhook({
|
|
590
|
+
* hydraDbConnector: "X-HydraDB-Connector",
|
|
591
|
+
* body: {
|
|
592
|
+
* "key": "value"
|
|
593
|
+
* }
|
|
594
|
+
* })
|
|
595
|
+
*/
|
|
596
|
+
supabaseRowChangeWebhook(request, requestOptions) {
|
|
597
|
+
return core.HttpResponsePromise.fromPromise(this.__supabaseRowChangeWebhook(request, requestOptions));
|
|
598
|
+
}
|
|
599
|
+
async __supabaseRowChangeWebhook(request, requestOptions) {
|
|
600
|
+
const { hydraDbConnector, body: _body } = request;
|
|
601
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
602
|
+
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, this._options?.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({
|
|
603
|
+
"X-HydraDB-Connector": hydraDbConnector,
|
|
604
|
+
"API-Version": requestOptions?.apiVersion ?? this._options?.apiVersion ?? "2",
|
|
605
|
+
}), requestOptions?.headers);
|
|
606
|
+
const _response = await core.fetcher({
|
|
607
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
608
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
609
|
+
environments.HydraDBEnvironment.Default, "webhooks/supabase"),
|
|
610
|
+
method: "POST",
|
|
611
|
+
headers: _headers,
|
|
612
|
+
contentType: "application/json",
|
|
613
|
+
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
614
|
+
requestType: "json",
|
|
615
|
+
body: serializers.webhooks.supabaseRowChangeWebhook.Request.jsonOrThrow(_body, {
|
|
616
|
+
unrecognizedObjectKeys: "strip",
|
|
617
|
+
omitUndefined: true,
|
|
618
|
+
}),
|
|
619
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
620
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
621
|
+
abortSignal: requestOptions?.abortSignal,
|
|
622
|
+
fetchFn: this._options?.fetch,
|
|
623
|
+
logging: this._options.logging,
|
|
624
|
+
});
|
|
625
|
+
if (_response.ok) {
|
|
626
|
+
return {
|
|
627
|
+
data: serializers.HandlerEnvelopeHandlerSupabaseWebhookAck.parseOrThrow(_response.body, {
|
|
628
|
+
unrecognizedObjectKeys: "passthrough",
|
|
629
|
+
allowUnrecognizedUnionMembers: true,
|
|
630
|
+
allowUnrecognizedEnumValues: true,
|
|
631
|
+
skipValidation: true,
|
|
632
|
+
breadcrumbsPrefix: ["response"],
|
|
633
|
+
}),
|
|
634
|
+
rawResponse: _response.rawResponse,
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
if (_response.error.reason === "status-code") {
|
|
638
|
+
switch (_response.error.statusCode) {
|
|
639
|
+
case 400:
|
|
640
|
+
throw new HydraDB.BadRequestError(serializers.HandlerErrorResponse.parseOrThrow(_response.error.body, {
|
|
641
|
+
unrecognizedObjectKeys: "passthrough",
|
|
642
|
+
allowUnrecognizedUnionMembers: true,
|
|
643
|
+
allowUnrecognizedEnumValues: true,
|
|
644
|
+
skipValidation: true,
|
|
645
|
+
breadcrumbsPrefix: ["response"],
|
|
646
|
+
}), _response.rawResponse);
|
|
647
|
+
case 404:
|
|
648
|
+
throw new HydraDB.NotFoundError(_response.error.body, _response.rawResponse);
|
|
649
|
+
default:
|
|
650
|
+
throw new errors.HydraDBError({
|
|
651
|
+
statusCode: _response.error.statusCode,
|
|
652
|
+
body: _response.error.body,
|
|
653
|
+
rawResponse: _response.rawResponse,
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/webhooks/supabase");
|
|
658
|
+
}
|
|
579
659
|
}
|
|
580
660
|
exports.WebhooksClient = WebhooksClient;
|