@superdurable/connector-amazon-redshift 0.1.0 → 0.2.0

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/index.js CHANGED
@@ -1,7 +1,35 @@
1
1
  import {
2
+ CancelStatementBranch,
3
+ CancelStatementBranchCanceled,
4
+ CancelStatementBranchDefect,
5
+ CancelStatementBranchInvalidResponse,
6
+ CancelStatementBranchMissing,
7
+ CancelStatementBranchNotCanceled,
8
+ CancelStatementBranchProviderRejected,
9
+ CancelStatementDefinition,
10
+ CancelStatementInputSchema,
11
+ CancelStatementMetadata,
2
12
  ConfigSchema,
3
13
  Connection,
4
14
  ConnectorID,
15
+ CredentialMaterialError,
16
+ DescribeStatementBranch,
17
+ DescribeStatementBranchDefect,
18
+ DescribeStatementBranchDescribed,
19
+ DescribeStatementBranchInvalidResponse,
20
+ DescribeStatementBranchMissing,
21
+ DescribeStatementBranchProviderRejected,
22
+ DescribeStatementDefinition,
23
+ DescribeStatementInputSchema,
24
+ DescribeStatementMetadata,
25
+ ExecuteStatementBranch,
26
+ ExecuteStatementBranchDefect,
27
+ ExecuteStatementBranchInvalidResponse,
28
+ ExecuteStatementBranchProviderRejected,
29
+ ExecuteStatementBranchSubmitted,
30
+ ExecuteStatementDefinition,
31
+ ExecuteStatementInputSchema,
32
+ ExecuteStatementMetadata,
5
33
  GetStatementResultBranch,
6
34
  GetStatementResultBranchDefect,
7
35
  GetStatementResultBranchFetched,
@@ -11,25 +39,81 @@ import {
11
39
  GetStatementResultDefinition,
12
40
  GetStatementResultInputSchema,
13
41
  GetStatementResultMetadata,
42
+ ListStatementsBranch,
43
+ ListStatementsBranchDefect,
44
+ ListStatementsBranchInvalidResponse,
45
+ ListStatementsBranchListed,
46
+ ListStatementsBranchProviderRejected,
47
+ ListStatementsDefinition,
48
+ ListStatementsInputSchema,
49
+ ListStatementsMetadata,
14
50
  ProviderID,
51
+ StatementCancellationSchema,
52
+ StatementIdentitySchema,
53
+ StatementPageSchema,
15
54
  StatementResultPageSchema,
55
+ StatementStatusSchema,
16
56
  decodeCredentials,
57
+ isCredentialMaterialError,
17
58
  newConnection,
18
59
  newConnectionWithOperations,
19
60
  newProjectConnection
20
- } from "./chunk-OEV6UKQQ.js";
61
+ } from "./chunk-V4IZMGI7.js";
21
62
 
22
63
  // src/generated/steps.ts
23
- import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
64
+ import { goToBranch, newMutationStep, newQueryStep } from "@superdurable/connectors-sdk";
24
65
  function newGetStatementResultStep(configuration) {
25
- const { connection, connectionName, fetched, missing, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
66
+ const { connection, connectionName, fetched, missing, providerRejected, invalidResponse: invalidResponse2, defect: defect2, ...stepConfiguration } = configuration;
26
67
  if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
27
68
  return newQueryStep({ ...stepConfiguration, operation: connection.operations.getStatementResult(), connection: connection.reference, branches: [
28
69
  goToBranch("fetched", fetched),
29
70
  ...missing ? [goToBranch("missing", missing)] : [],
30
71
  ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
31
- ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
32
- ...defect ? [goToBranch("defect", defect)] : []
72
+ ...invalidResponse2 ? [goToBranch("invalidResponse", invalidResponse2)] : [],
73
+ ...defect2 ? [goToBranch("defect", defect2)] : []
74
+ ] });
75
+ }
76
+ function newExecuteStatementStep(configuration) {
77
+ const { connection, connectionName, submitted, providerRejected, invalidResponse: invalidResponse2, defect: defect2, maxSends, ...stepConfiguration } = configuration;
78
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
79
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.executeStatement(), connection: connection.reference, branches: [
80
+ goToBranch("submitted", submitted),
81
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
82
+ ...invalidResponse2 ? [goToBranch("invalidResponse", invalidResponse2)] : [],
83
+ ...defect2 ? [goToBranch("defect", defect2)] : []
84
+ ] });
85
+ }
86
+ function newDescribeStatementStep(configuration) {
87
+ const { connection, connectionName, described, missing, providerRejected, invalidResponse: invalidResponse2, defect: defect2, ...stepConfiguration } = configuration;
88
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
89
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.describeStatement(), connection: connection.reference, branches: [
90
+ goToBranch("described", described),
91
+ ...missing ? [goToBranch("missing", missing)] : [],
92
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
93
+ ...invalidResponse2 ? [goToBranch("invalidResponse", invalidResponse2)] : [],
94
+ ...defect2 ? [goToBranch("defect", defect2)] : []
95
+ ] });
96
+ }
97
+ function newListStatementsStep(configuration) {
98
+ const { connection, connectionName, listed, providerRejected, invalidResponse: invalidResponse2, defect: defect2, ...stepConfiguration } = configuration;
99
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
100
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.listStatements(), connection: connection.reference, branches: [
101
+ goToBranch("listed", listed),
102
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
103
+ ...invalidResponse2 ? [goToBranch("invalidResponse", invalidResponse2)] : [],
104
+ ...defect2 ? [goToBranch("defect", defect2)] : []
105
+ ] });
106
+ }
107
+ function newCancelStatementStep(configuration) {
108
+ const { connection, connectionName, canceled, notCanceled, missing, providerRejected, invalidResponse: invalidResponse2, defect: defect2, maxSends, ...stepConfiguration } = configuration;
109
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
110
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.cancelStatement(), connection: connection.reference, branches: [
111
+ goToBranch("canceled", canceled),
112
+ ...notCanceled ? [goToBranch("notCanceled", notCanceled)] : [],
113
+ ...missing ? [goToBranch("missing", missing)] : [],
114
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
115
+ ...invalidResponse2 ? [goToBranch("invalidResponse", invalidResponse2)] : [],
116
+ ...defect2 ? [goToBranch("defect", defect2)] : []
33
117
  ] });
34
118
  }
35
119
 
@@ -39,8 +123,8 @@ import { z } from "zod";
39
123
 
40
124
  // src/client.ts
41
125
  import { createHash, createHmac } from "crypto";
42
- import { SecretString, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
43
- import { BodyTooLargeError, isHeaderSafeCredential, parseRetryAfter, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
126
+ import { SecretString, newMutationBranch, newMutationRetry, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
127
+ import { BodyTooLargeError, ProviderStalledError, ProviderTransportError, isHeaderSafeCredential, parseRetryAfter, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
44
128
  var emptyPage = () => ({ records: [], nextToken: "", totalNumRows: 0 });
45
129
  var regionPattern = /^[a-z]{2}(?:-gov)?-[a-z]+-[0-9]+$/;
46
130
  var statementIDPattern = /^[a-z0-9]{8}(?:-[a-z0-9]{4}){3}-[a-z0-9]{12}(?::[0-9]{1,2})?$/;
@@ -70,8 +154,28 @@ var AmazonRedshiftClient = class {
70
154
  getStatementResult() {
71
155
  return new GetStatementResultOperation(this);
72
156
  }
157
+ /** Bind the idempotent submission Mutation. */
158
+ executeStatement() {
159
+ return new ExecuteStatementOperation(this);
160
+ }
161
+ /** Bind the statement status Query. */
162
+ describeStatement() {
163
+ return new DescribeStatementOperation(this);
164
+ }
165
+ /** Bind the bounded statement listing Query. */
166
+ listStatements() {
167
+ return new ListStatementsOperation(this);
168
+ }
169
+ /** Bind the repeat-safe cancellation Mutation. */
170
+ cancelStatement() {
171
+ return new CancelStatementOperation(this);
172
+ }
73
173
  /** Sign and send one bounded GetStatementResult request. */
74
174
  async readStatementResult(call, body) {
175
+ return this.sendStatementRequest(call, "GetStatementResult", body);
176
+ }
177
+ /** Sign and send one bounded Redshift Data API request. */
178
+ async sendStatementRequest(call, target, body) {
75
179
  let accessKey;
76
180
  let secretKey;
77
181
  let sessionToken;
@@ -92,7 +196,7 @@ var AmazonRedshiftClient = class {
92
196
  "content-type": "application/x-amz-json-1.1",
93
197
  host: new URL(url).host,
94
198
  "x-amz-date": timestamp,
95
- "x-amz-target": "RedshiftData.GetStatementResult"
199
+ "x-amz-target": `RedshiftData.${target}`
96
200
  };
97
201
  if (sessionToken) headersForSignature["x-amz-security-token"] = sessionToken;
98
202
  const signedHeaders = Object.keys(headersForSignature).sort().join(";");
@@ -138,6 +242,13 @@ ${createHash("sha256").update(canonicalRequest).digest("hex")}`;
138
242
  if (error instanceof BodyTooLargeError && error.status !== void 0) {
139
243
  response = { status: error.status, headers: error.headers ?? {}, body: new Uint8Array() };
140
244
  isTooLarge = true;
245
+ } else if ((error instanceof ProviderTransportError || error instanceof ProviderStalledError) && error.status !== void 0) {
246
+ return {
247
+ status: error.status,
248
+ body: new Uint8Array(),
249
+ retryAfterMs: parseRetryAfter(header(error.headers ?? {}, "retry-after")),
250
+ error: "interrupted"
251
+ };
141
252
  } else return emptyExchange("request");
142
253
  }
143
254
  const retryAfterMs = parseRetryAfter(header(response.headers, "retry-after"));
@@ -172,6 +283,7 @@ var GetStatementResultOperation = class {
172
283
  return newQueryBranch("missing", emptyPage());
173
284
  if (exchange.status !== 200) return terminal("providerRejected", "PROVIDER_REJECTION", `Redshift rejected HTTP ${exchange.status}`);
174
285
  if (exchange.error === "tooLarge") return terminal("invalidResponse", "RESPONSE_TOO_LARGE", "Redshift response exceeded the configured limit");
286
+ if (exchange.error === "interrupted") return retry("TRANSPORT", "Redshift response was interrupted");
175
287
  let document;
176
288
  try {
177
289
  document = JSON.parse(Buffer.from(exchange.body).toString("utf8"));
@@ -213,6 +325,208 @@ function header(headers, name) {
213
325
  const entry = Object.entries(headers).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
214
326
  return Array.isArray(entry) ? entry[0] ?? "" : entry ?? "";
215
327
  }
328
+ var ExecuteStatementOperation = class {
329
+ /** Bind the provider client. */
330
+ constructor(client) {
331
+ this.client = client;
332
+ }
333
+ client;
334
+ /** Return the generated submission contract. */
335
+ definition() {
336
+ return ExecuteStatementDefinition;
337
+ }
338
+ /** Use the stable Dex call ID to deduplicate submissions. */
339
+ idempotencyKey(callId) {
340
+ return callId;
341
+ }
342
+ /** Submit one statement and retry unknown outcomes with the same token. */
343
+ async invoke(call, input) {
344
+ const operation = "executeStatement";
345
+ const empty = { id: "" };
346
+ if (!workgroupNamePattern.test(input.workgroupName) || !input.database.trim() || Buffer.byteLength(input.database) > 127 || !input.sql.trim() || Buffer.byteLength(input.sql) > 200 * 1024 || !call.idempotencyKey)
347
+ return classifiedMutation(defect(operation, "Redshift execution input is invalid"), empty);
348
+ const body = encodeRequest({
349
+ ClientToken: call.idempotencyKey,
350
+ WorkgroupName: input.workgroupName,
351
+ Database: input.database,
352
+ Sql: input.sql,
353
+ ResultFormat: "JSON"
354
+ });
355
+ const exchange = await this.client.sendStatementRequest(call, "ExecuteStatement", body);
356
+ const rejected = classifyResponse(exchange, operation, call);
357
+ if (rejected) return classifiedMutation(rejected, empty);
358
+ const result = decodeObject(exchange.body);
359
+ if (!isStatementID(result?.Id)) return newMutationRetry(operationFailure(operation, "PROTOCOL", "Redshift returned invalid statement ID"));
360
+ return newMutationBranch("submitted", { id: result.Id });
361
+ }
362
+ };
363
+ var DescribeStatementOperation = class {
364
+ /** Bind the provider client. */
365
+ constructor(client) {
366
+ this.client = client;
367
+ }
368
+ client;
369
+ /** Return the generated status query contract. */
370
+ definition() {
371
+ return DescribeStatementDefinition;
372
+ }
373
+ /** Validate the returned ID and status before returning the result. */
374
+ async invoke(call, input) {
375
+ const operation = "describeStatement";
376
+ const empty = { id: "", status: "", hasResultSet: false };
377
+ if (!isStatementID(input.statementId))
378
+ return classifiedQuery(defect(operation, "Redshift statement ID is invalid"), empty);
379
+ const exchange = await this.client.sendStatementRequest(call, "DescribeStatement", encodeRequest({ Id: input.statementId }));
380
+ const rejected = classifyResponse(exchange, operation);
381
+ if (rejected) return classifiedQuery(rejected, empty);
382
+ const result = decodeObject(exchange.body);
383
+ const hasResultSet = result?.HasResultSet ?? false;
384
+ if (result?.Id !== input.statementId || !isStatementStatus(result.Status) || typeof hasResultSet !== "boolean")
385
+ return classifiedQuery(invalidResponse(operation, "Redshift returned invalid statement status"), empty);
386
+ return newQueryBranch("described", { id: input.statementId, status: result.Status, hasResultSet });
387
+ }
388
+ };
389
+ var ListStatementsOperation = class {
390
+ /** Bind the provider client. */
391
+ constructor(client) {
392
+ this.client = client;
393
+ }
394
+ client;
395
+ /** Return the generated list query contract. */
396
+ definition() {
397
+ return ListStatementsDefinition;
398
+ }
399
+ /** List one page with the requested limit and continuation. */
400
+ async invoke(call, input) {
401
+ const operation = "listStatements";
402
+ const empty = { statements: [], nextToken: "" };
403
+ const { maxResults, nextToken } = input;
404
+ if (!Number.isInteger(maxResults) || maxResults < 0 || maxResults > 100 || Buffer.byteLength(nextToken) > 4096 || nextToken.includes("\0") || nextToken.includes("\r") || nextToken.includes("\n"))
405
+ return classifiedQuery(defect(operation, "Redshift list input is invalid"), empty);
406
+ const body = encodeRequest({ ...maxResults ? { MaxResults: maxResults } : {}, ...nextToken ? { NextToken: nextToken } : {} });
407
+ const exchange = await this.client.sendStatementRequest(call, "ListStatements", body);
408
+ const rejected = classifyResponse(exchange, operation);
409
+ if (rejected) return classifiedQuery(rejected, empty);
410
+ const result = decodeObject(exchange.body);
411
+ const token = result?.NextToken ?? "";
412
+ if (!Array.isArray(result?.Statements) || result.Statements.length > 100 || typeof token !== "string" || Buffer.byteLength(token) > 4096)
413
+ return classifiedQuery(invalidResponse(operation, "Redshift returned invalid statement page"), empty);
414
+ const statements = [];
415
+ for (const statement of result.Statements) {
416
+ if (!isObject(statement) || !isStatementID(statement.Id) || !isStatementStatus(statement.Status))
417
+ return classifiedQuery(invalidResponse(operation, "Redshift returned invalid statement identity"), empty);
418
+ statements.push({ id: statement.Id, status: statement.Status, hasResultSet: false });
419
+ }
420
+ return newQueryBranch("listed", { statements, nextToken: token });
421
+ }
422
+ };
423
+ var CancelStatementOperation = class {
424
+ /** Bind the provider client. */
425
+ constructor(client) {
426
+ this.client = client;
427
+ }
428
+ client;
429
+ /** Return the generated cancellation contract. */
430
+ definition() {
431
+ return CancelStatementDefinition;
432
+ }
433
+ /** Identify one repeat-safe Dex cancellation call. */
434
+ idempotencyKey(callId) {
435
+ return callId;
436
+ }
437
+ /** Confirm cancellation or classify a statement that already finished or failed. */
438
+ async invoke(call, input) {
439
+ const operation = "cancelStatement";
440
+ const empty = { canceled: false };
441
+ if (!isStatementID(input.statementId))
442
+ return classifiedMutation(defect(operation, "Redshift statement ID is invalid"), empty);
443
+ const body = encodeRequest({ Id: input.statementId });
444
+ const exchange = await this.client.sendStatementRequest(call, "CancelStatement", body);
445
+ const rejected = classifyResponse(exchange, operation, call);
446
+ if (rejected) return classifiedMutation(rejected, empty);
447
+ const canceled = decodeObject(exchange.body)?.Status;
448
+ if (typeof canceled !== "boolean")
449
+ return newMutationRetry(operationFailure(operation, "PROTOCOL", "Redshift returned invalid cancellation status"));
450
+ if (canceled) return newMutationBranch("canceled", { canceled: true });
451
+ const confirmation = await this.client.sendStatementRequest(call, "DescribeStatement", body);
452
+ if (confirmation.error || confirmation.status !== 200)
453
+ return newMutationRetry(operationFailure(operation, "AVAILABILITY", "Redshift cancellation could not be confirmed"), confirmation.retryAfterMs);
454
+ const status = decodeObject(confirmation.body)?.Status;
455
+ if (!isStatementStatus(status))
456
+ return newMutationRetry(operationFailure(operation, "PROTOCOL", "Redshift cancellation status is unknown"));
457
+ if (status === "ABORTED") return newMutationBranch("canceled", { canceled: true });
458
+ if (status === "FINISHED" || status === "FAILED") return newMutationBranch("notCanceled", empty);
459
+ return newMutationRetry(operationFailure(operation, "AVAILABILITY", "Redshift statement is still running"));
460
+ }
461
+ };
462
+ var workgroupNamePattern = /^[a-z0-9-]{3,63}$/;
463
+ var statementStatuses = /* @__PURE__ */ new Set(["SUBMITTED", "PICKED", "STARTED", "FINISHED", "ABORTED", "FAILED"]);
464
+ var refusalStatuses = /* @__PURE__ */ new Set([400, 401, 403, 404, 411, 413, 414, 415, 422]);
465
+ function classifyResponse(exchange, operation, mutationCall) {
466
+ if (exchange.error === "credential") return defect(operation, "Redshift credentials are unavailable", "AUTHENTICATION");
467
+ if (exchange.error === "request") return { failure: operationFailure(operation, "TRANSPORT", "Redshift request failed") };
468
+ if (exchange.status === 429 || isThrottled(exchange.body))
469
+ return { failure: operationFailure(operation, "RATE_LIMIT", "Redshift rate limited the request"), delay: exchange.retryAfterMs };
470
+ if (exchange.status === 408 || exchange.status >= 500)
471
+ return { failure: operationFailure(operation, "AVAILABILITY", "Redshift is temporarily unavailable"), delay: exchange.retryAfterMs };
472
+ if (exchange.status !== 200) {
473
+ const definite = !mutationCall || isDefiniteRefusal(mutationCall, exchange);
474
+ const missing = exchange.status === 404 || exchange.status === 400 && hasErrorCode(exchange.body, "ResourceNotFoundException");
475
+ if (definite && missing && (operation === "describeStatement" || operation === "cancelStatement"))
476
+ return { branch: "missing" };
477
+ if (definite)
478
+ return { branch: "providerRejected", failure: operationFailure(operation, "PROVIDER_REJECTION", `Redshift rejected HTTP ${exchange.status}`) };
479
+ return { failure: operationFailure(operation, "TRANSPORT", "Redshift write outcome is unknown") };
480
+ }
481
+ if (exchange.error === "tooLarge") {
482
+ const failure2 = operationFailure(operation, "RESPONSE_TOO_LARGE", "Redshift response exceeded the configured limit");
483
+ return mutationCall ? { failure: failure2 } : { branch: "invalidResponse", failure: failure2 };
484
+ }
485
+ if (exchange.error) return { failure: operationFailure(operation, "TRANSPORT", "Redshift response was interrupted") };
486
+ return void 0;
487
+ }
488
+ function isDefiniteRefusal(call, exchange) {
489
+ if (call.context.attempt > 1 || !refusalStatuses.has(exchange.status)) return false;
490
+ const body = decodeObject(exchange.body);
491
+ if (!body) return false;
492
+ const fields = Object.fromEntries(Object.entries(body).map(([key, value]) => [key.toLowerCase(), value]));
493
+ const { message, id, status } = fields;
494
+ return typeof message === "string" && message.length > 0 && (id == null || id === "") && status == null;
495
+ }
496
+ function isStatementID(value) {
497
+ return typeof value === "string" && statementIDPattern.test(value);
498
+ }
499
+ function isStatementStatus(value) {
500
+ return typeof value === "string" && statementStatuses.has(value);
501
+ }
502
+ function decodeObject(body) {
503
+ try {
504
+ const value = JSON.parse(Buffer.from(body).toString("utf8"));
505
+ return isObject(value) ? value : void 0;
506
+ } catch {
507
+ return void 0;
508
+ }
509
+ }
510
+ function encodeRequest(fields) {
511
+ return Buffer.from(JSON.stringify(fields).replace(/[<>&\u2028\u2029]/g, (character) => "\\u" + character.charCodeAt(0).toString(16).padStart(4, "0")));
512
+ }
513
+ function classifiedQuery(response, empty) {
514
+ if (response.branch !== void 0) return newQueryBranch(response.branch, empty, {}, response.failure);
515
+ return newQueryRetry(response.failure, response.delay);
516
+ }
517
+ function classifiedMutation(response, empty) {
518
+ if (response.branch !== void 0) return newMutationBranch(response.branch, empty, {}, response.failure);
519
+ return newMutationRetry(response.failure, response.delay);
520
+ }
521
+ function operationFailure(operation, kind, message) {
522
+ return { provider: "amazon-redshift", operation, kind, message };
523
+ }
524
+ function defect(operation, message, kind = "VALIDATION") {
525
+ return { branch: "defect", failure: operationFailure(operation, kind, message) };
526
+ }
527
+ function invalidResponse(operation, message) {
528
+ return { branch: "invalidResponse", failure: operationFailure(operation, "PROTOCOL", message) };
529
+ }
216
530
 
217
531
  // src/project.ts
218
532
  function newProjectConnection2(project, connectionName) {
@@ -252,9 +566,40 @@ function parseDurationMilliseconds(value) {
252
566
  }
253
567
  export {
254
568
  AmazonRedshiftClient,
569
+ CancelStatementBranch,
570
+ CancelStatementBranchCanceled,
571
+ CancelStatementBranchDefect,
572
+ CancelStatementBranchInvalidResponse,
573
+ CancelStatementBranchMissing,
574
+ CancelStatementBranchNotCanceled,
575
+ CancelStatementBranchProviderRejected,
576
+ CancelStatementDefinition,
577
+ CancelStatementInputSchema,
578
+ CancelStatementMetadata,
579
+ CancelStatementOperation,
255
580
  ConfigSchema,
256
581
  Connection,
257
582
  ConnectorID,
583
+ CredentialMaterialError,
584
+ DescribeStatementBranch,
585
+ DescribeStatementBranchDefect,
586
+ DescribeStatementBranchDescribed,
587
+ DescribeStatementBranchInvalidResponse,
588
+ DescribeStatementBranchMissing,
589
+ DescribeStatementBranchProviderRejected,
590
+ DescribeStatementDefinition,
591
+ DescribeStatementInputSchema,
592
+ DescribeStatementMetadata,
593
+ DescribeStatementOperation,
594
+ ExecuteStatementBranch,
595
+ ExecuteStatementBranchDefect,
596
+ ExecuteStatementBranchInvalidResponse,
597
+ ExecuteStatementBranchProviderRejected,
598
+ ExecuteStatementBranchSubmitted,
599
+ ExecuteStatementDefinition,
600
+ ExecuteStatementInputSchema,
601
+ ExecuteStatementMetadata,
602
+ ExecuteStatementOperation,
258
603
  GetStatementResultBranch,
259
604
  GetStatementResultBranchDefect,
260
605
  GetStatementResultBranchFetched,
@@ -265,11 +610,29 @@ export {
265
610
  GetStatementResultInputSchema,
266
611
  GetStatementResultMetadata,
267
612
  GetStatementResultOperation,
613
+ ListStatementsBranch,
614
+ ListStatementsBranchDefect,
615
+ ListStatementsBranchInvalidResponse,
616
+ ListStatementsBranchListed,
617
+ ListStatementsBranchProviderRejected,
618
+ ListStatementsDefinition,
619
+ ListStatementsInputSchema,
620
+ ListStatementsMetadata,
621
+ ListStatementsOperation,
268
622
  ProviderID,
623
+ StatementCancellationSchema,
624
+ StatementIdentitySchema,
625
+ StatementPageSchema,
269
626
  StatementResultPageSchema,
627
+ StatementStatusSchema,
270
628
  decodeCredentials,
629
+ isCredentialMaterialError,
630
+ newCancelStatementStep,
271
631
  newConnection,
272
632
  newConnectionWithOperations,
633
+ newDescribeStatementStep,
634
+ newExecuteStatementStep,
273
635
  newGetStatementResultStep,
636
+ newListStatementsStep,
274
637
  newProjectConnection2 as newProjectConnection
275
638
  };
package/dist/mock.d.ts CHANGED
@@ -1,12 +1,28 @@
1
- import { MockQuery, Case } from '@superdurable/connectors-sdk/connectormock';
1
+ import { MockQuery, MockMutation, Case } from '@superdurable/connectors-sdk/connectormock';
2
2
  import { Failure } from '@superdurable/connectors-sdk';
3
- import { O as Operations, C as Connection, G as GetStatementResultInput, S as StatementResultPage } from './connection-BikiyVDi.js';
3
+ import { O as Operations, a as Connection, G as GetStatementResultInput, d as StatementResultPage, E as ExecuteStatementInput, c as StatementIdentity, D as DescribeStatementInput, b as StatementStatus, L as ListStatementsInput, e as StatementPage, C as CancelStatementInput, S as StatementCancellation } from './connection-QfejfWYW.js';
4
4
  import 'zod';
5
5
 
6
6
  /** Go zero value for GetStatementResultInput in scripted cases. */
7
7
  declare const emptyGetStatementResultInput: GetStatementResultInput;
8
8
  /** Go zero value for StatementResultPage in scripted cases. */
9
9
  declare const emptyStatementResultPage: StatementResultPage;
10
+ /** Go zero value for ExecuteStatementInput in scripted cases. */
11
+ declare const emptyExecuteStatementInput: ExecuteStatementInput;
12
+ /** Go zero value for StatementIdentity in scripted cases. */
13
+ declare const emptyStatementIdentity: StatementIdentity;
14
+ /** Go zero value for DescribeStatementInput in scripted cases. */
15
+ declare const emptyDescribeStatementInput: DescribeStatementInput;
16
+ /** Go zero value for StatementStatus in scripted cases. */
17
+ declare const emptyStatementStatus: StatementStatus;
18
+ /** Go zero value for ListStatementsInput in scripted cases. */
19
+ declare const emptyListStatementsInput: ListStatementsInput;
20
+ /** Go zero value for StatementPage in scripted cases. */
21
+ declare const emptyStatementPage: StatementPage;
22
+ /** Go zero value for CancelStatementInput in scripted cases. */
23
+ declare const emptyCancelStatementInput: CancelStatementInput;
24
+ /** Go zero value for StatementCancellation in scripted cases. */
25
+ declare const emptyStatementCancellation: StatementCancellation;
10
26
  /** Script the fetched branch. */
11
27
  declare function getStatementResultFetched(value: StatementResultPage, failure?: Failure): Case<StatementResultPage>;
12
28
  /** Script the missing branch. */
@@ -23,13 +39,79 @@ declare function getStatementResultRetry(failure: Failure, retryAfterMs?: number
23
39
  declare function getStatementResultFetchedDefault(): Case<StatementResultPage>;
24
40
  /** Default getStatementResult scenario. */
25
41
  declare function getStatementResultDefault(): Case<StatementResultPage>;
42
+ /** Script the submitted branch. */
43
+ declare function executeStatementSubmitted(value: StatementIdentity, failure?: Failure): Case<StatementIdentity>;
44
+ /** Script the providerRejected branch. */
45
+ declare function executeStatementProviderRejected(value: StatementIdentity, failure?: Failure): Case<StatementIdentity>;
46
+ /** Script the invalidResponse branch. */
47
+ declare function executeStatementInvalidResponse(value: StatementIdentity, failure?: Failure): Case<StatementIdentity>;
48
+ /** Script the defect branch. */
49
+ declare function executeStatementDefect(value: StatementIdentity, failure?: Failure): Case<StatementIdentity>;
50
+ /** Script a safe retry of executeStatement. */
51
+ declare function executeStatementRetry(failure: Failure, retryAfterMs?: number): Case<StatementIdentity>;
52
+ /** Manifest scenario submittedDefault for executeStatement. */
53
+ declare function executeStatementSubmittedDefault(): Case<StatementIdentity>;
54
+ /** Default executeStatement scenario. */
55
+ declare function executeStatementDefault(): Case<StatementIdentity>;
56
+ /** Script the described branch. */
57
+ declare function describeStatementDescribed(value: StatementStatus, failure?: Failure): Case<StatementStatus>;
58
+ /** Script the missing branch. */
59
+ declare function describeStatementMissing(value: StatementStatus, failure?: Failure): Case<StatementStatus>;
60
+ /** Script the providerRejected branch. */
61
+ declare function describeStatementProviderRejected(value: StatementStatus, failure?: Failure): Case<StatementStatus>;
62
+ /** Script the invalidResponse branch. */
63
+ declare function describeStatementInvalidResponse(value: StatementStatus, failure?: Failure): Case<StatementStatus>;
64
+ /** Script the defect branch. */
65
+ declare function describeStatementDefect(value: StatementStatus, failure?: Failure): Case<StatementStatus>;
66
+ /** Script a safe retry of describeStatement. */
67
+ declare function describeStatementRetry(failure: Failure, retryAfterMs?: number): Case<StatementStatus>;
68
+ /** Manifest scenario describedDefault for describeStatement. */
69
+ declare function describeStatementDescribedDefault(): Case<StatementStatus>;
70
+ /** Default describeStatement scenario. */
71
+ declare function describeStatementDefault(): Case<StatementStatus>;
72
+ /** Script the listed branch. */
73
+ declare function listStatementsListed(value: StatementPage, failure?: Failure): Case<StatementPage>;
74
+ /** Script the providerRejected branch. */
75
+ declare function listStatementsProviderRejected(value: StatementPage, failure?: Failure): Case<StatementPage>;
76
+ /** Script the invalidResponse branch. */
77
+ declare function listStatementsInvalidResponse(value: StatementPage, failure?: Failure): Case<StatementPage>;
78
+ /** Script the defect branch. */
79
+ declare function listStatementsDefect(value: StatementPage, failure?: Failure): Case<StatementPage>;
80
+ /** Script a safe retry of listStatements. */
81
+ declare function listStatementsRetry(failure: Failure, retryAfterMs?: number): Case<StatementPage>;
82
+ /** Manifest scenario listedDefault for listStatements. */
83
+ declare function listStatementsListedDefault(): Case<StatementPage>;
84
+ /** Default listStatements scenario. */
85
+ declare function listStatementsDefault(): Case<StatementPage>;
86
+ /** Script the canceled branch. */
87
+ declare function cancelStatementCanceled(value: StatementCancellation, failure?: Failure): Case<StatementCancellation>;
88
+ /** Script the notCanceled branch. */
89
+ declare function cancelStatementNotCanceled(value: StatementCancellation, failure?: Failure): Case<StatementCancellation>;
90
+ /** Script the missing branch. */
91
+ declare function cancelStatementMissing(value: StatementCancellation, failure?: Failure): Case<StatementCancellation>;
92
+ /** Script the providerRejected branch. */
93
+ declare function cancelStatementProviderRejected(value: StatementCancellation, failure?: Failure): Case<StatementCancellation>;
94
+ /** Script the invalidResponse branch. */
95
+ declare function cancelStatementInvalidResponse(value: StatementCancellation, failure?: Failure): Case<StatementCancellation>;
96
+ /** Script the defect branch. */
97
+ declare function cancelStatementDefect(value: StatementCancellation, failure?: Failure): Case<StatementCancellation>;
98
+ /** Script a safe retry of cancelStatement. */
99
+ declare function cancelStatementRetry(failure: Failure, retryAfterMs?: number): Case<StatementCancellation>;
100
+ /** Manifest scenario canceledDefault for cancelStatement. */
101
+ declare function cancelStatementCanceledDefault(): Case<StatementCancellation>;
102
+ /** Default cancelStatement scenario. */
103
+ declare function cancelStatementDefault(): Case<StatementCancellation>;
26
104
  /** Scripted operations and manifest defaults for this connector. */
27
105
  declare class GeneratedMock implements Operations {
28
106
  #private;
29
107
  constructor(connectionName: string);
30
108
  connection(): Connection;
31
109
  getStatementResult(): MockQuery<GetStatementResultInput, StatementResultPage>;
110
+ executeStatement(): MockMutation<ExecuteStatementInput, StatementIdentity>;
111
+ describeStatement(): MockQuery<DescribeStatementInput, StatementStatus>;
112
+ listStatements(): MockQuery<ListStatementsInput, StatementPage>;
113
+ cancelStatement(): MockMutation<CancelStatementInput, StatementCancellation>;
32
114
  assertNoFailures(): void;
33
115
  }
34
116
 
35
- export { GeneratedMock, GeneratedMock as Mock, emptyGetStatementResultInput, emptyStatementResultPage, getStatementResultDefault, getStatementResultDefect, getStatementResultFetched, getStatementResultFetchedDefault, getStatementResultInvalidResponse, getStatementResultMissing, getStatementResultProviderRejected, getStatementResultRetry };
117
+ export { GeneratedMock, GeneratedMock as Mock, cancelStatementCanceled, cancelStatementCanceledDefault, cancelStatementDefault, cancelStatementDefect, cancelStatementInvalidResponse, cancelStatementMissing, cancelStatementNotCanceled, cancelStatementProviderRejected, cancelStatementRetry, describeStatementDefault, describeStatementDefect, describeStatementDescribed, describeStatementDescribedDefault, describeStatementInvalidResponse, describeStatementMissing, describeStatementProviderRejected, describeStatementRetry, emptyCancelStatementInput, emptyDescribeStatementInput, emptyExecuteStatementInput, emptyGetStatementResultInput, emptyListStatementsInput, emptyStatementCancellation, emptyStatementIdentity, emptyStatementPage, emptyStatementResultPage, emptyStatementStatus, executeStatementDefault, executeStatementDefect, executeStatementInvalidResponse, executeStatementProviderRejected, executeStatementRetry, executeStatementSubmitted, executeStatementSubmittedDefault, getStatementResultDefault, getStatementResultDefect, getStatementResultFetched, getStatementResultFetchedDefault, getStatementResultInvalidResponse, getStatementResultMissing, getStatementResultProviderRejected, getStatementResultRetry, listStatementsDefault, listStatementsDefect, listStatementsInvalidResponse, listStatementsListed, listStatementsListedDefault, listStatementsProviderRejected, listStatementsRetry };