@superdurable/connector-elasticsearch 0.0.0-stage → 0.1.1

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.
@@ -0,0 +1,210 @@
1
+ import { D as DeleteDocumentInput, a as DeletedDocument, C as Connection, I as IndexDocumentInput, b as IndexedDocument, S as SearchDocumentsInput, c as SearchPage, d as Config, e as Credentials, O as Operations } from './connection-Du7eKAvn.js';
2
+ export { f as ConfigSchema, g as CredentialMaterialError, h as CredentialSource, i as DeleteDocumentInputSchema, j as DeletedDocumentSchema, k as IndexDocumentInputSchema, l as IndexedDocumentSchema, m as SearchDocumentsInputSchema, n as SearchHit, o as SearchHitSchema, p as SearchPageSchema, q as decodeCredentials, r as isCredentialMaterialError, s as newConnection, t as newConnectionWithOperations } from './connection-Du7eKAvn.js';
3
+ import * as _superdurable_connectors_sdk from '@superdurable/connectors-sdk';
4
+ import { MutationDefinition, QueryDefinition, MutationStepConfig, Mutation, MutationResult, QueryStepConfig, Query, QueryResult, MutationStep, QueryStep, CredentialProvider, Call, MutationAttempt, QueryAttempt } from '@superdurable/connectors-sdk';
5
+ import { StepTarget } from '@superdurable/dex';
6
+ import { LoadedProject } from '@superdurable/connectors-sdk/projectconfig';
7
+ import { ProviderRequest, ProviderResponse } from '@superdurable/connectors-sdk/providerhttp';
8
+ import 'zod';
9
+
10
+ /** Stable connector identity. */
11
+ declare const ConnectorID = "elasticsearch";
12
+ /** Provider identity for named connections. */
13
+ declare const ProviderID = "elasticsearch";
14
+ /** Branch IDs for indexDocument. */
15
+ declare const IndexDocumentBranch: {
16
+ readonly Indexed: "indexed";
17
+ readonly ProviderRejected: "providerRejected";
18
+ readonly Defect: "defect";
19
+ };
20
+ /** Elasticsearch stored the requested document at the stable ID. */
21
+ declare const IndexDocumentBranchIndexed: "indexed";
22
+ /** Elasticsearch conclusively rejected the document replacement. */
23
+ declare const IndexDocumentBranchProviderRejected: "providerRejected";
24
+ /** Local document input or credentials are invalid. */
25
+ declare const IndexDocumentBranchDefect: "defect";
26
+ /** Manifest definition for indexDocument. */
27
+ declare const IndexDocumentDefinition: MutationDefinition;
28
+ /** Manifest metadata for indexDocument. */
29
+ declare const IndexDocumentMetadata: {
30
+ readonly kind: "mutation";
31
+ readonly idempotency: "required";
32
+ readonly authorization: "required";
33
+ };
34
+ /** Branch IDs for deleteDocument. */
35
+ declare const DeleteDocumentBranch: {
36
+ readonly Absent: "absent";
37
+ readonly IndexNotFound: "indexNotFound";
38
+ readonly ProviderRejected: "providerRejected";
39
+ readonly Defect: "defect";
40
+ };
41
+ /** The document is absent, whether deleted now or already missing. */
42
+ declare const DeleteDocumentBranchAbsent: "absent";
43
+ /** The requested index does not exist. */
44
+ declare const DeleteDocumentBranchIndexNotFound: "indexNotFound";
45
+ /** Elasticsearch conclusively rejected the deletion. */
46
+ declare const DeleteDocumentBranchProviderRejected: "providerRejected";
47
+ /** Local document ID or credentials are invalid. */
48
+ declare const DeleteDocumentBranchDefect: "defect";
49
+ /** Manifest definition for deleteDocument. */
50
+ declare const DeleteDocumentDefinition: MutationDefinition;
51
+ /** Manifest metadata for deleteDocument. */
52
+ declare const DeleteDocumentMetadata: {
53
+ readonly kind: "mutation";
54
+ readonly idempotency: "required";
55
+ readonly authorization: "required";
56
+ };
57
+ /** Branch IDs for searchDocuments. */
58
+ declare const SearchDocumentsBranch: {
59
+ readonly Found: "found";
60
+ readonly IndexNotFound: "indexNotFound";
61
+ readonly ProviderRejected: "providerRejected";
62
+ readonly InvalidResponse: "invalidResponse";
63
+ readonly Defect: "defect";
64
+ };
65
+ /** Elasticsearch returned a search page, possibly empty. */
66
+ declare const SearchDocumentsBranchFound: "found";
67
+ /** The requested index does not exist. */
68
+ declare const SearchDocumentsBranchIndexNotFound: "indexNotFound";
69
+ /** Elasticsearch conclusively rejected the search. */
70
+ declare const SearchDocumentsBranchProviderRejected: "providerRejected";
71
+ /** Elasticsearch returned malformed or oversized search data. */
72
+ declare const SearchDocumentsBranchInvalidResponse: "invalidResponse";
73
+ /** Local input or credentials are invalid. */
74
+ declare const SearchDocumentsBranchDefect: "defect";
75
+ /** Manifest definition for searchDocuments. */
76
+ declare const SearchDocumentsDefinition: QueryDefinition;
77
+ /** Manifest metadata for searchDocuments. */
78
+ declare const SearchDocumentsMetadata: {
79
+ readonly kind: "query";
80
+ readonly idempotency: "none";
81
+ readonly authorization: "required";
82
+ };
83
+
84
+ /** Configuration for the indexDocument connector Step. */
85
+ interface IndexDocumentStepConfig<StepInput, OperationInput = IndexDocumentInput, OperationOutput = IndexedDocument> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
86
+ /** Named connection supplying this operation. */
87
+ connection: Connection<{
88
+ indexDocument(): Mutation<OperationInput, OperationOutput>;
89
+ }>;
90
+ /** Name matching the bound connection. */
91
+ connectionName: string;
92
+ /** Elasticsearch stored the requested document at the stable ID. */
93
+ indexed: StepTarget<MutationResult<OperationOutput>>;
94
+ /** Elasticsearch conclusively rejected the document replacement. */
95
+ providerRejected?: StepTarget<MutationResult<OperationOutput>>;
96
+ /** Local document input or credentials are invalid. */
97
+ defect?: StepTarget<MutationResult<OperationOutput>>;
98
+ }
99
+ /** Build the indexDocument Step from a named connection. */
100
+ declare function newIndexDocumentStep<StepInput, OperationInput = IndexDocumentInput, OperationOutput = IndexedDocument>(configuration: IndexDocumentStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
101
+ /** Configuration for the deleteDocument connector Step. */
102
+ interface DeleteDocumentStepConfig<StepInput, OperationInput = DeleteDocumentInput, OperationOutput = DeletedDocument> extends Omit<MutationStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
103
+ /** Named connection supplying this operation. */
104
+ connection: Connection<{
105
+ deleteDocument(): Mutation<OperationInput, OperationOutput>;
106
+ }>;
107
+ /** Name matching the bound connection. */
108
+ connectionName: string;
109
+ /** The document is absent, whether deleted now or already missing. */
110
+ absent: StepTarget<MutationResult<OperationOutput>>;
111
+ /** The requested index does not exist. */
112
+ indexNotFound?: StepTarget<MutationResult<OperationOutput>>;
113
+ /** Elasticsearch conclusively rejected the deletion. */
114
+ providerRejected?: StepTarget<MutationResult<OperationOutput>>;
115
+ /** Local document ID or credentials are invalid. */
116
+ defect?: StepTarget<MutationResult<OperationOutput>>;
117
+ }
118
+ /** Build the deleteDocument Step from a named connection. */
119
+ declare function newDeleteDocumentStep<StepInput, OperationInput = DeleteDocumentInput, OperationOutput = DeletedDocument>(configuration: DeleteDocumentStepConfig<StepInput, OperationInput, OperationOutput>): MutationStep<StepInput, OperationInput, OperationOutput>;
120
+ /** Configuration for the searchDocuments connector Step. */
121
+ interface SearchDocumentsStepConfig<StepInput, OperationInput = SearchDocumentsInput, OperationOutput = SearchPage> extends Omit<QueryStepConfig<StepInput, OperationInput, OperationOutput>, 'operation' | 'connection' | 'branches'> {
122
+ /** Named connection supplying this operation. */
123
+ connection: Connection<{
124
+ searchDocuments(): Query<OperationInput, OperationOutput>;
125
+ }>;
126
+ /** Name matching the bound connection. */
127
+ connectionName: string;
128
+ /** Elasticsearch returned a search page, possibly empty. */
129
+ found: StepTarget<QueryResult<OperationOutput>>;
130
+ /** The requested index does not exist. */
131
+ indexNotFound?: StepTarget<QueryResult<OperationOutput>>;
132
+ /** Elasticsearch conclusively rejected the search. */
133
+ providerRejected?: StepTarget<QueryResult<OperationOutput>>;
134
+ /** Elasticsearch returned malformed or oversized search data. */
135
+ invalidResponse?: StepTarget<QueryResult<OperationOutput>>;
136
+ /** Local input or credentials are invalid. */
137
+ defect?: StepTarget<QueryResult<OperationOutput>>;
138
+ }
139
+ /** Build the searchDocuments Step from a named connection. */
140
+ declare function newSearchDocumentsStep<StepInput, OperationInput = SearchDocumentsInput, OperationOutput = SearchPage>(configuration: SearchDocumentsStepConfig<StepInput, OperationInput, OperationOutput>): QueryStep<StepInput, OperationInput, OperationOutput>;
141
+
142
+ /** Injectable HTTP sender and clock for provider replay. */
143
+ interface ElasticsearchClientOptions {
144
+ /** Provider sender; omitted uses the SDK's redirect-safe transport. */
145
+ send?: (request: ProviderRequest) => Promise<ProviderResponse>;
146
+ /** Clock for Retry-After dates. */
147
+ now?: () => Date;
148
+ }
149
+ /** One bounded provider outcome without credential-bearing request data. */
150
+ interface ElasticsearchExchange {
151
+ /** HTTP status, or zero without a response. */ status: number;
152
+ /** Complete bounded response body. */ body: Uint8Array;
153
+ /** Retry-After delay in milliseconds. */ retryAfterMs: number;
154
+ /** Safe transport or response classification. */ error?: 'request' | 'tooLarge';
155
+ }
156
+ /** Elasticsearch REST client with call-time Basic credentials. */
157
+ declare class ElasticsearchClient {
158
+ /** Validated cluster URL without a trailing slash. */ readonly clusterUrl: string;
159
+ /** Maximum complete document request size in bytes. */ readonly maxDocumentBytes: number;
160
+ private readonly timeoutMs;
161
+ private readonly maxResponseBytes;
162
+ private readonly credentials;
163
+ private readonly send;
164
+ private readonly now;
165
+ /** Validate cluster settings without contacting Elasticsearch. */
166
+ constructor(config: Config, credentials: CredentialProvider<Credentials>, options?: ElasticsearchClientOptions);
167
+ /** Bind the absolute replacement Mutation. */ indexDocument(): IndexDocumentOperation;
168
+ /** Bind the stable-ID deletion Mutation. */ deleteDocument(): DeleteDocumentOperation;
169
+ /** Bind the bounded search Query. */ searchDocuments(): SearchDocumentsOperation;
170
+ /** Resolve Basic authorization without returning credentials in failures. */
171
+ authorization(call: Call): Promise<string | undefined>;
172
+ /** Return null for a transient credential failure and undefined for a terminal or invalid one. */
173
+ private resolveAuthorization;
174
+ /** Send one bounded request without automatic redirects. */
175
+ exchange(call: Call, method: 'GET' | 'PUT' | 'DELETE', url: string, headers: Record<string, string>, body?: Uint8Array): Promise<ElasticsearchExchange>;
176
+ private retryAfter;
177
+ }
178
+ /** Fully replace one document under a stable caller-selected ID. */
179
+ declare class IndexDocumentOperation implements Mutation<IndexDocumentInput, IndexedDocument> {
180
+ private readonly client;
181
+ /** Bind the provider client. */ constructor(client: ElasticsearchClient);
182
+ /** Return the generated Mutation contract. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
183
+ /** Use stable Dex call identity; absolute PUT is safe to retry. */
184
+ idempotencyKey(callId: string): string;
185
+ /** Retry unconfirmed responses with the same absolute document source. */
186
+ invoke(call: Call, input: IndexDocumentInput): Promise<MutationAttempt<IndexedDocument>>;
187
+ }
188
+ /** Ensure one stable document ID is absent. */
189
+ declare class DeleteDocumentOperation implements Mutation<DeleteDocumentInput, DeletedDocument> {
190
+ private readonly client;
191
+ /** Bind the provider client. */ constructor(client: ElasticsearchClient);
192
+ /** Return the generated Mutation contract. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
193
+ /** Use stable Dex call identity; repeating DELETE is safe. */
194
+ idempotencyKey(callId: string): string;
195
+ /** Treat both deleted and already absent as success. */
196
+ invoke(call: Call, input: DeleteDocumentInput): Promise<MutationAttempt<DeletedDocument>>;
197
+ }
198
+ /** Search one Elasticsearch index with bounded query-string pagination. */
199
+ declare class SearchDocumentsOperation implements Query<SearchDocumentsInput, SearchPage> {
200
+ private readonly client;
201
+ /** Bind the provider client. */ constructor(client: ElasticsearchClient);
202
+ /** Return the generated Query contract. */ definition(): _superdurable_connectors_sdk.QueryDefinition;
203
+ /** Reject partial results and retry timed-out or shard-failed searches. */
204
+ invoke(call: Call, input: SearchDocumentsInput): Promise<QueryAttempt<SearchPage>>;
205
+ }
206
+
207
+ /** Bind one named Elasticsearch connection declared in a Dex project. */
208
+ declare function newProjectConnection(project: LoadedProject, connectionName: string, options?: ElasticsearchClientOptions): Connection<Operations>;
209
+
210
+ export { Config, Connection, ConnectorID, Credentials, DeleteDocumentBranch, DeleteDocumentBranchAbsent, DeleteDocumentBranchDefect, DeleteDocumentBranchIndexNotFound, DeleteDocumentBranchProviderRejected, DeleteDocumentDefinition, DeleteDocumentInput, DeleteDocumentMetadata, DeleteDocumentOperation, type DeleteDocumentStepConfig, DeletedDocument, ElasticsearchClient, type ElasticsearchClientOptions, IndexDocumentBranch, IndexDocumentBranchDefect, IndexDocumentBranchIndexed, IndexDocumentBranchProviderRejected, IndexDocumentDefinition, IndexDocumentInput, IndexDocumentMetadata, IndexDocumentOperation, type IndexDocumentStepConfig, IndexedDocument, ProviderID, SearchDocumentsBranch, SearchDocumentsBranchDefect, SearchDocumentsBranchFound, SearchDocumentsBranchIndexNotFound, SearchDocumentsBranchInvalidResponse, SearchDocumentsBranchProviderRejected, SearchDocumentsDefinition, SearchDocumentsInput, SearchDocumentsMetadata, SearchDocumentsOperation, type SearchDocumentsStepConfig, SearchPage, newDeleteDocumentStep, newIndexDocumentStep, newProjectConnection, newSearchDocumentsStep };