@superdurable/connector-amazon-dynamodb 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
@@ -2,6 +2,15 @@ import {
2
2
  ConfigSchema,
3
3
  Connection,
4
4
  ConnectorID,
5
+ CredentialMaterialError,
6
+ DeleteItemBranch,
7
+ DeleteItemBranchDefect,
8
+ DeleteItemBranchDeleted,
9
+ DeleteItemBranchInvalidResponse,
10
+ DeleteItemBranchProviderRejected,
11
+ DeleteItemDefinition,
12
+ DeleteItemInputSchema,
13
+ DeleteItemMetadata,
5
14
  GetItemBranch,
6
15
  GetItemBranchDefect,
7
16
  GetItemBranchFound,
@@ -11,16 +20,43 @@ import {
11
20
  GetItemDefinition,
12
21
  GetItemInputSchema,
13
22
  GetItemMetadata,
23
+ ItemPageSchema,
14
24
  ItemResultSchema,
25
+ ItemWriteResultSchema,
15
26
  ProviderID,
27
+ PutItemBranch,
28
+ PutItemBranchDefect,
29
+ PutItemBranchInvalidResponse,
30
+ PutItemBranchProviderRejected,
31
+ PutItemBranchWritten,
32
+ PutItemDefinition,
33
+ PutItemInputSchema,
34
+ PutItemMetadata,
35
+ ScanItemsBranch,
36
+ ScanItemsBranchDefect,
37
+ ScanItemsBranchInvalidResponse,
38
+ ScanItemsBranchProviderRejected,
39
+ ScanItemsBranchScanned,
40
+ ScanItemsDefinition,
41
+ ScanItemsInputSchema,
42
+ ScanItemsMetadata,
43
+ UpdateItemBranch,
44
+ UpdateItemBranchDefect,
45
+ UpdateItemBranchInvalidResponse,
46
+ UpdateItemBranchProviderRejected,
47
+ UpdateItemBranchUpdated,
48
+ UpdateItemDefinition,
49
+ UpdateItemInputSchema,
50
+ UpdateItemMetadata,
16
51
  decodeCredentials,
52
+ isCredentialMaterialError,
17
53
  newConnection,
18
54
  newConnectionWithOperations,
19
55
  newProjectConnection
20
- } from "./chunk-JOLOQV45.js";
56
+ } from "./chunk-NNCKP6U7.js";
21
57
 
22
58
  // src/generated/steps.ts
23
- import { goToBranch, newQueryStep } from "@superdurable/connectors-sdk";
59
+ import { goToBranch, newMutationStep, newQueryStep } from "@superdurable/connectors-sdk";
24
60
  function newGetItemStep(configuration) {
25
61
  const { connection, connectionName, found, missing, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
26
62
  if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
@@ -32,6 +68,46 @@ function newGetItemStep(configuration) {
32
68
  ...defect ? [goToBranch("defect", defect)] : []
33
69
  ] });
34
70
  }
71
+ function newPutItemStep(configuration) {
72
+ const { connection, connectionName, written, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
73
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
74
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.putItem(), connection: connection.reference, branches: [
75
+ goToBranch("written", written),
76
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
77
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
78
+ ...defect ? [goToBranch("defect", defect)] : []
79
+ ] });
80
+ }
81
+ function newUpdateItemStep(configuration) {
82
+ const { connection, connectionName, updated, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
83
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
84
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.updateItem(), connection: connection.reference, branches: [
85
+ goToBranch("updated", updated),
86
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
87
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
88
+ ...defect ? [goToBranch("defect", defect)] : []
89
+ ] });
90
+ }
91
+ function newDeleteItemStep(configuration) {
92
+ const { connection, connectionName, deleted, providerRejected, invalidResponse, defect, maxSends, ...stepConfiguration } = configuration;
93
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
94
+ return newMutationStep({ ...stepConfiguration, operation: connection.operations.deleteItem(), connection: connection.reference, branches: [
95
+ goToBranch("deleted", deleted),
96
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
97
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
98
+ ...defect ? [goToBranch("defect", defect)] : []
99
+ ] });
100
+ }
101
+ function newScanItemsStep(configuration) {
102
+ const { connection, connectionName, scanned, providerRejected, invalidResponse, defect, ...stepConfiguration } = configuration;
103
+ if (!connection || connection.reference.name !== connectionName) throw new TypeError("Step connection name differs from the bound connection");
104
+ return newQueryStep({ ...stepConfiguration, operation: connection.operations.scanItems(), connection: connection.reference, branches: [
105
+ goToBranch("scanned", scanned),
106
+ ...providerRejected ? [goToBranch("providerRejected", providerRejected)] : [],
107
+ ...invalidResponse ? [goToBranch("invalidResponse", invalidResponse)] : [],
108
+ ...defect ? [goToBranch("defect", defect)] : []
109
+ ] });
110
+ }
35
111
 
36
112
  // src/project.ts
37
113
  import { SecretString as SecretString2 } from "@superdurable/connectors-sdk";
@@ -39,8 +115,8 @@ import { z } from "zod";
39
115
 
40
116
  // src/client.ts
41
117
  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";
118
+ import { SecretString, newMutationBranch, newMutationRetry, newQueryBranch, newQueryRetry } from "@superdurable/connectors-sdk";
119
+ import { BodyTooLargeError, ProviderStalledError, ProviderTransportError, isHeaderSafeCredential, parseRetryAfter, sendProviderRequest, validateBaseURL } from "@superdurable/connectors-sdk/providerhttp";
44
120
  var emptyItem = () => ({ exists: false, item: {} });
45
121
  var regionPattern = /^[a-z]{2}(?:-gov)?-[a-z]+-[0-9]+$/;
46
122
  var tablePattern = /^[A-Za-z0-9_.-]{3,255}$/;
@@ -71,8 +147,28 @@ var AmazonDynamoDBClient = class {
71
147
  getItem() {
72
148
  return new GetItemOperation(this);
73
149
  }
150
+ /** Bind the complete replacement Mutation. */
151
+ putItem() {
152
+ return new PutItemOperation(this);
153
+ }
154
+ /** Bind the absolute update Mutation. */
155
+ updateItem() {
156
+ return new UpdateItemOperation(this);
157
+ }
158
+ /** Bind the repeat-safe delete Mutation. */
159
+ deleteItem() {
160
+ return new DeleteItemOperation(this);
161
+ }
162
+ /** Bind the bounded scan Query. */
163
+ scanItems() {
164
+ return new ScanItemsOperation(this);
165
+ }
74
166
  /** Sign and send one bounded GetItem request. */
75
167
  async readItem(call, body) {
168
+ return this.sendItemRequest(call, "GetItem", body);
169
+ }
170
+ /** Sign and send one bounded DynamoDB request using the configured endpoint and Region. */
171
+ async sendItemRequest(call, target, body) {
76
172
  let accessKey;
77
173
  let secretKey;
78
174
  let sessionToken;
@@ -93,7 +189,7 @@ var AmazonDynamoDBClient = class {
93
189
  "content-type": "application/x-amz-json-1.0",
94
190
  host: new URL(url).host,
95
191
  "x-amz-date": timestamp,
96
- "x-amz-target": "DynamoDB_20120810.GetItem"
192
+ "x-amz-target": `DynamoDB_20120810.${target}`
97
193
  };
98
194
  if (sessionToken) headersForSignature["x-amz-security-token"] = sessionToken;
99
195
  const signedHeaders = Object.keys(headersForSignature).sort().join(";");
@@ -139,6 +235,8 @@ ${createHash("sha256").update(canonicalRequest).digest("hex")}`;
139
235
  if (error instanceof BodyTooLargeError && error.status !== void 0) {
140
236
  response = { status: error.status, headers: error.headers ?? {}, body: new Uint8Array() };
141
237
  isTooLarge = true;
238
+ } else if ((error instanceof ProviderTransportError || error instanceof ProviderStalledError) && error.status !== void 0) {
239
+ return { status: error.status, body: new Uint8Array(), retryAfterMs: parseRetryAfter(header(error.headers ?? {}, "retry-after")), error: "interrupted" };
142
240
  } else return emptyExchange("request");
143
241
  }
144
242
  const retryAfterMs = parseRetryAfter(header(response.headers, "retry-after"));
@@ -172,6 +270,7 @@ var GetItemOperation = class {
172
270
  if (exchange.status === 408 || exchange.status >= 500) return retry("AVAILABILITY", "DynamoDB is temporarily unavailable", exchange.retryAfterMs);
173
271
  if (exchange.status !== 200) return terminal("providerRejected", "PROVIDER_REJECTION", `DynamoDB rejected HTTP ${exchange.status}`);
174
272
  if (exchange.error === "tooLarge") return terminal("invalidResponse", "RESPONSE_TOO_LARGE", "DynamoDB response exceeded the configured limit");
273
+ if (exchange.error === "interrupted") return retry("TRANSPORT", "DynamoDB response was interrupted");
175
274
  let document;
176
275
  try {
177
276
  document = JSON.parse(Buffer.from(exchange.body).toString("utf8"));
@@ -189,7 +288,7 @@ var GetItemOperation = class {
189
288
  function validKey(key) {
190
289
  if (!isObject(key) || ![1, 2].includes(Object.keys(key).length)) return false;
191
290
  return Object.entries(key).every(([name, attribute]) => {
192
- if (!name || name.length > 255 || [...name].some((character) => character.charCodeAt(0) === 0 || character === "\r" || character === "\n") || !isObject(attribute) || Object.keys(attribute).length !== 1) return false;
291
+ if (!name || Buffer.byteLength(name) > 255 || [...name].some((character) => character.charCodeAt(0) === 0 || character === "\r" || character === "\n") || !isObject(attribute) || Object.keys(attribute).length !== 1) return false;
193
292
  const [kind, value] = Object.entries(attribute)[0];
194
293
  if (typeof value !== "string" || !value) return false;
195
294
  if (kind === "S") return true;
@@ -226,6 +325,210 @@ function header(headers, name) {
226
325
  const entry = Object.entries(headers).find(([key]) => key.toLowerCase() === name.toLowerCase())?.[1];
227
326
  return Array.isArray(entry) ? entry[0] ?? "" : entry ?? "";
228
327
  }
328
+ var PutItemOperation = class {
329
+ /** Bind the provider client. */
330
+ constructor(client) {
331
+ this.client = client;
332
+ }
333
+ client;
334
+ /** Return the generated replacement contract. */
335
+ definition() {
336
+ return PutItemDefinition;
337
+ }
338
+ /** Correlate repeat-safe replacements with the Dex call. */
339
+ idempotencyKey(callId) {
340
+ return callId;
341
+ }
342
+ /** Replace the item using the supplied absolute values. */
343
+ async invoke(call, input) {
344
+ if (!tablePattern.test(input.tableName) || !validItem(input.item))
345
+ return invalidWrite("putItem", "DynamoDB table or item is invalid");
346
+ return writeItem(this.client, call, "putItem", "PutItem", "written", {
347
+ TableName: input.tableName,
348
+ Item: sortedMap(input.item)
349
+ });
350
+ }
351
+ };
352
+ var UpdateItemOperation = class {
353
+ /** Bind the provider client. */
354
+ constructor(client) {
355
+ this.client = client;
356
+ }
357
+ client;
358
+ /** Return the generated update contract. */
359
+ definition() {
360
+ return UpdateItemDefinition;
361
+ }
362
+ /** Correlate repeat-safe updates with the Dex call. */
363
+ idempotencyKey(callId) {
364
+ return callId;
365
+ }
366
+ /** Update the supplied attributes without changing the key. */
367
+ async invoke(call, input) {
368
+ const { tableName, key, attributes } = input;
369
+ if (!tablePattern.test(tableName) || !validKey(key) || !validItem(attributes))
370
+ return invalidWrite("updateItem", "DynamoDB table, key, or attributes are invalid");
371
+ const names = Object.keys(attributes).sort(compareUTF8);
372
+ if (names.some((name) => Object.hasOwn(key, name)))
373
+ return invalidWrite("updateItem", "DynamoDB key attributes cannot be updated");
374
+ const aliases = {};
375
+ const values = {};
376
+ const assignments = names.map((name, index) => {
377
+ const nameAlias = "#a" + index;
378
+ const valueAlias = ":v" + index;
379
+ aliases[nameAlias] = name;
380
+ values[valueAlias] = attributes[name];
381
+ return nameAlias + " = " + valueAlias;
382
+ });
383
+ return writeItem(this.client, call, "updateItem", "UpdateItem", "updated", {
384
+ TableName: tableName,
385
+ Key: sortedMap(key),
386
+ UpdateExpression: "SET " + assignments.join(", "),
387
+ ExpressionAttributeNames: sortedMap(aliases),
388
+ ExpressionAttributeValues: sortedMap(values)
389
+ });
390
+ }
391
+ };
392
+ var DeleteItemOperation = class {
393
+ /** Bind the provider client. */
394
+ constructor(client) {
395
+ this.client = client;
396
+ }
397
+ client;
398
+ /** Return the generated deletion contract. */
399
+ definition() {
400
+ return DeleteItemDefinition;
401
+ }
402
+ /** Correlate repeat-safe deletions with the Dex call. */
403
+ idempotencyKey(callId) {
404
+ return callId;
405
+ }
406
+ /** Delete the item or retry a temporary response. */
407
+ async invoke(call, input) {
408
+ if (!tablePattern.test(input.tableName) || !validKey(input.key))
409
+ return invalidWrite("deleteItem", "DynamoDB table or key is invalid");
410
+ return writeItem(this.client, call, "deleteItem", "DeleteItem", "deleted", {
411
+ TableName: input.tableName,
412
+ Key: sortedMap(input.key)
413
+ });
414
+ }
415
+ };
416
+ var ScanItemsOperation = class {
417
+ /** Bind the provider client. */
418
+ constructor(client) {
419
+ this.client = client;
420
+ }
421
+ client;
422
+ /** Return the generated scan contract. */
423
+ definition() {
424
+ return ScanItemsDefinition;
425
+ }
426
+ /** Scan one page using the supplied limit and cursor. */
427
+ async invoke(call, input) {
428
+ const { tableName, limit = 0, exclusiveStartKey } = input;
429
+ if (!tablePattern.test(tableName) || !Number.isInteger(limit) || limit < 0 || limit > 1e3 || exclusiveStartKey !== void 0 && !validKey(exclusiveStartKey))
430
+ return scanBranch("defect", "VALIDATION", "DynamoDB scan input is invalid");
431
+ const exchange = await this.client.sendItemRequest(call, "Scan", jsonBody({
432
+ TableName: tableName,
433
+ ...limit ? { Limit: limit } : {},
434
+ ...exclusiveStartKey ? { ExclusiveStartKey: sortedMap(exclusiveStartKey) } : {}
435
+ }));
436
+ if (exchange.error === "credential")
437
+ return scanBranch("defect", "AUTHENTICATION", "DynamoDB credentials are unavailable or invalid");
438
+ const transient = transientFailure(exchange, "scanItems", "scan");
439
+ if (transient) return newQueryRetry(transient.failure, transient.delay);
440
+ if (exchange.status !== 200) return scanBranch("providerRejected", "PROVIDER_REJECTION", `DynamoDB rejected HTTP ${exchange.status}`);
441
+ if (exchange.error === "tooLarge") return scanBranch("invalidResponse", "RESPONSE_TOO_LARGE", "DynamoDB response exceeded the configured limit");
442
+ if (exchange.error) return newQueryRetry(operationFailure("scanItems", "TRANSPORT", "DynamoDB response was interrupted"));
443
+ const page = decodePage(exchange.body);
444
+ if (!page) return scanBranch("invalidResponse", "PROTOCOL", "DynamoDB returned invalid scan JSON");
445
+ return newQueryBranch("scanned", page);
446
+ }
447
+ };
448
+ function validItem(value) {
449
+ if (!isObject(value)) return false;
450
+ const entries = Object.entries(value);
451
+ return entries.length >= 1 && entries.length <= 400 && entries.every(([name, attribute]) => name.length > 0 && Buffer.byteLength(name) <= 255 && !name.includes("\0") && !name.includes("\r") && !name.includes("\n") && isObject(attribute) && Object.keys(attribute).length === 1);
452
+ }
453
+ function compareUTF8(left, right) {
454
+ return Buffer.compare(Buffer.from(left), Buffer.from(right));
455
+ }
456
+ function sortedMap(values) {
457
+ return Object.fromEntries(Object.entries(values).sort(([left], [right]) => compareUTF8(left, right)));
458
+ }
459
+ function jsonBody(fields) {
460
+ const encoded = JSON.stringify(fields).replace(/[<>&\u2028\u2029]/g, (character) => "\\u" + character.charCodeAt(0).toString(16).padStart(4, "0"));
461
+ return Buffer.from(encoded);
462
+ }
463
+ function decodeObject(body) {
464
+ try {
465
+ const value = JSON.parse(Buffer.from(body).toString("utf8"));
466
+ return isObject(value) ? value : void 0;
467
+ } catch {
468
+ return void 0;
469
+ }
470
+ }
471
+ function decodePage(body) {
472
+ const document = decodeObject(body);
473
+ if (!document) return void 0;
474
+ const { Items: items, Count: count = 0, LastEvaluatedKey: lastEvaluatedKey = null } = document;
475
+ const itemCount = count ?? 0;
476
+ if (!Array.isArray(items) || itemCount !== items.length || !items.every(validItem) || lastEvaluatedKey !== null && !validKey(lastEvaluatedKey)) return void 0;
477
+ return { items, count: itemCount, lastEvaluatedKey: lastEvaluatedKey ?? {} };
478
+ }
479
+ async function writeItem(client, call, operation, target, branch, fields) {
480
+ let body;
481
+ try {
482
+ body = jsonBody(fields);
483
+ } catch {
484
+ return invalidWrite(operation, "DynamoDB write input could not be encoded");
485
+ }
486
+ const exchange = await client.sendItemRequest(call, target, body);
487
+ const attempt = call.context.attempt;
488
+ if (exchange.error === "credential") {
489
+ const failure2 = operationFailure(operation, "AUTHENTICATION", "DynamoDB credentials are unavailable or invalid");
490
+ return attempt > 1 ? newMutationRetry(failure2) : newMutationBranch("defect", { applied: false }, {}, failure2);
491
+ }
492
+ const transient = transientFailure(exchange, operation, "write");
493
+ if (transient) return newMutationRetry(transient.failure, transient.delay);
494
+ if (exchange.status !== 200) {
495
+ if (attempt <= 1 && isDefiniteRefusal(exchange)) {
496
+ const failure2 = operationFailure(operation, "PROVIDER_REJECTION", `DynamoDB rejected HTTP ${exchange.status}`);
497
+ return newMutationBranch("providerRejected", { applied: false }, {}, failure2);
498
+ }
499
+ return newMutationRetry(operationFailure(operation, "TRANSPORT", "DynamoDB write outcome is unknown"));
500
+ }
501
+ if (exchange.error === "tooLarge") return newMutationRetry(operationFailure(operation, "RESPONSE_TOO_LARGE", "DynamoDB response exceeded the configured limit"));
502
+ if (exchange.error) return newMutationRetry(operationFailure(operation, "TRANSPORT", "DynamoDB response was interrupted"));
503
+ if (!decodeObject(exchange.body)) return newMutationRetry(operationFailure(operation, "PROTOCOL", "DynamoDB returned invalid write JSON"));
504
+ return newMutationBranch(branch, { applied: true });
505
+ }
506
+ var refusalStatuses = /* @__PURE__ */ new Set([400, 401, 403, 404, 411, 413, 414, 415, 422]);
507
+ function isDefiniteRefusal(exchange) {
508
+ if (!refusalStatuses.has(exchange.status)) return false;
509
+ const document = decodeObject(exchange.body);
510
+ if (!document || Object.hasOwn(document, "Attributes")) return false;
511
+ const { __type, code } = document;
512
+ return (__type == null || typeof __type === "string") && (code == null || typeof code === "string") && Boolean(__type || code);
513
+ }
514
+ function transientFailure(exchange, operation, request) {
515
+ if (exchange.error === "request")
516
+ return { failure: operationFailure(operation, "TRANSPORT", "DynamoDB request failed"), delay: 0 };
517
+ if (exchange.status === 429 || exchange.status !== 200 && isThrottled(exchange.body))
518
+ return { failure: operationFailure(operation, "RATE_LIMIT", `DynamoDB rate limited the ${request}`), delay: exchange.retryAfterMs };
519
+ if (exchange.status === 408 || exchange.status >= 500)
520
+ return { failure: operationFailure(operation, "AVAILABILITY", "DynamoDB is temporarily unavailable"), delay: exchange.retryAfterMs };
521
+ return void 0;
522
+ }
523
+ function operationFailure(operation, kind, message) {
524
+ return { provider: "amazon-dynamodb", operation, kind, message };
525
+ }
526
+ function invalidWrite(operation, message) {
527
+ return newMutationBranch("defect", { applied: false }, {}, operationFailure(operation, "VALIDATION", message));
528
+ }
529
+ function scanBranch(branch, kind, message) {
530
+ return newQueryBranch(branch, { items: [], count: 0, lastEvaluatedKey: {} }, {}, operationFailure("scanItems", kind, message));
531
+ }
229
532
 
230
533
  // src/project.ts
231
534
  function newProjectConnection2(project, connectionName) {
@@ -268,6 +571,16 @@ export {
268
571
  ConfigSchema,
269
572
  Connection,
270
573
  ConnectorID,
574
+ CredentialMaterialError,
575
+ DeleteItemBranch,
576
+ DeleteItemBranchDefect,
577
+ DeleteItemBranchDeleted,
578
+ DeleteItemBranchInvalidResponse,
579
+ DeleteItemBranchProviderRejected,
580
+ DeleteItemDefinition,
581
+ DeleteItemInputSchema,
582
+ DeleteItemMetadata,
583
+ DeleteItemOperation,
271
584
  GetItemBranch,
272
585
  GetItemBranchDefect,
273
586
  GetItemBranchFound,
@@ -278,11 +591,45 @@ export {
278
591
  GetItemInputSchema,
279
592
  GetItemMetadata,
280
593
  GetItemOperation,
594
+ ItemPageSchema,
281
595
  ItemResultSchema,
596
+ ItemWriteResultSchema,
282
597
  ProviderID,
598
+ PutItemBranch,
599
+ PutItemBranchDefect,
600
+ PutItemBranchInvalidResponse,
601
+ PutItemBranchProviderRejected,
602
+ PutItemBranchWritten,
603
+ PutItemDefinition,
604
+ PutItemInputSchema,
605
+ PutItemMetadata,
606
+ PutItemOperation,
607
+ ScanItemsBranch,
608
+ ScanItemsBranchDefect,
609
+ ScanItemsBranchInvalidResponse,
610
+ ScanItemsBranchProviderRejected,
611
+ ScanItemsBranchScanned,
612
+ ScanItemsDefinition,
613
+ ScanItemsInputSchema,
614
+ ScanItemsMetadata,
615
+ ScanItemsOperation,
616
+ UpdateItemBranch,
617
+ UpdateItemBranchDefect,
618
+ UpdateItemBranchInvalidResponse,
619
+ UpdateItemBranchProviderRejected,
620
+ UpdateItemBranchUpdated,
621
+ UpdateItemDefinition,
622
+ UpdateItemInputSchema,
623
+ UpdateItemMetadata,
624
+ UpdateItemOperation,
283
625
  decodeCredentials,
626
+ isCredentialMaterialError,
284
627
  newConnection,
285
628
  newConnectionWithOperations,
629
+ newDeleteItemStep,
286
630
  newGetItemStep,
287
- newProjectConnection2 as newProjectConnection
631
+ newProjectConnection2 as newProjectConnection,
632
+ newPutItemStep,
633
+ newScanItemsStep,
634
+ newUpdateItemStep
288
635
  };
package/dist/mock.d.ts CHANGED
@@ -1,12 +1,24 @@
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 GetItemInput, I as ItemResult } from './connection-DjOgB3k-.js';
3
+ import { O as Operations, C as Connection, G as GetItemInput, a as ItemResult, P as PutItemInput, I as ItemWriteResult, U as UpdateItemInput, D as DeleteItemInput, S as ScanItemsInput, b as ItemPage } from './connection-D5oiDePw.js';
4
4
  import 'zod';
5
5
 
6
6
  /** Go zero value for GetItemInput in scripted cases. */
7
7
  declare const emptyGetItemInput: GetItemInput;
8
8
  /** Go zero value for ItemResult in scripted cases. */
9
9
  declare const emptyItemResult: ItemResult;
10
+ /** Go zero value for PutItemInput in scripted cases. */
11
+ declare const emptyPutItemInput: PutItemInput;
12
+ /** Go zero value for ItemWriteResult in scripted cases. */
13
+ declare const emptyItemWriteResult: ItemWriteResult;
14
+ /** Go zero value for UpdateItemInput in scripted cases. */
15
+ declare const emptyUpdateItemInput: UpdateItemInput;
16
+ /** Go zero value for DeleteItemInput in scripted cases. */
17
+ declare const emptyDeleteItemInput: DeleteItemInput;
18
+ /** Go zero value for ScanItemsInput in scripted cases. */
19
+ declare const emptyScanItemsInput: ScanItemsInput;
20
+ /** Go zero value for ItemPage in scripted cases. */
21
+ declare const emptyItemPage: ItemPage;
10
22
  /** Script the found branch. */
11
23
  declare function getItemFound(value: ItemResult, failure?: Failure): Case<ItemResult>;
12
24
  /** Script the missing branch. */
@@ -23,13 +35,73 @@ declare function getItemRetry(failure: Failure, retryAfterMs?: number): Case<Ite
23
35
  declare function getItemFoundDefault(): Case<ItemResult>;
24
36
  /** Default getItem scenario. */
25
37
  declare function getItemDefault(): Case<ItemResult>;
38
+ /** Script the written branch. */
39
+ declare function putItemWritten(value: ItemWriteResult, failure?: Failure): Case<ItemWriteResult>;
40
+ /** Script the providerRejected branch. */
41
+ declare function putItemProviderRejected(value: ItemWriteResult, failure?: Failure): Case<ItemWriteResult>;
42
+ /** Script the invalidResponse branch. */
43
+ declare function putItemInvalidResponse(value: ItemWriteResult, failure?: Failure): Case<ItemWriteResult>;
44
+ /** Script the defect branch. */
45
+ declare function putItemDefect(value: ItemWriteResult, failure?: Failure): Case<ItemWriteResult>;
46
+ /** Script a safe retry of putItem. */
47
+ declare function putItemRetry(failure: Failure, retryAfterMs?: number): Case<ItemWriteResult>;
48
+ /** Manifest scenario writtenDefault for putItem. */
49
+ declare function putItemWrittenDefault(): Case<ItemWriteResult>;
50
+ /** Default putItem scenario. */
51
+ declare function putItemDefault(): Case<ItemWriteResult>;
52
+ /** Script the updated branch. */
53
+ declare function updateItemUpdated(value: ItemWriteResult, failure?: Failure): Case<ItemWriteResult>;
54
+ /** Script the providerRejected branch. */
55
+ declare function updateItemProviderRejected(value: ItemWriteResult, failure?: Failure): Case<ItemWriteResult>;
56
+ /** Script the invalidResponse branch. */
57
+ declare function updateItemInvalidResponse(value: ItemWriteResult, failure?: Failure): Case<ItemWriteResult>;
58
+ /** Script the defect branch. */
59
+ declare function updateItemDefect(value: ItemWriteResult, failure?: Failure): Case<ItemWriteResult>;
60
+ /** Script a safe retry of updateItem. */
61
+ declare function updateItemRetry(failure: Failure, retryAfterMs?: number): Case<ItemWriteResult>;
62
+ /** Manifest scenario updatedDefault for updateItem. */
63
+ declare function updateItemUpdatedDefault(): Case<ItemWriteResult>;
64
+ /** Default updateItem scenario. */
65
+ declare function updateItemDefault(): Case<ItemWriteResult>;
66
+ /** Script the deleted branch. */
67
+ declare function deleteItemDeleted(value: ItemWriteResult, failure?: Failure): Case<ItemWriteResult>;
68
+ /** Script the providerRejected branch. */
69
+ declare function deleteItemProviderRejected(value: ItemWriteResult, failure?: Failure): Case<ItemWriteResult>;
70
+ /** Script the invalidResponse branch. */
71
+ declare function deleteItemInvalidResponse(value: ItemWriteResult, failure?: Failure): Case<ItemWriteResult>;
72
+ /** Script the defect branch. */
73
+ declare function deleteItemDefect(value: ItemWriteResult, failure?: Failure): Case<ItemWriteResult>;
74
+ /** Script a safe retry of deleteItem. */
75
+ declare function deleteItemRetry(failure: Failure, retryAfterMs?: number): Case<ItemWriteResult>;
76
+ /** Manifest scenario deletedDefault for deleteItem. */
77
+ declare function deleteItemDeletedDefault(): Case<ItemWriteResult>;
78
+ /** Default deleteItem scenario. */
79
+ declare function deleteItemDefault(): Case<ItemWriteResult>;
80
+ /** Script the scanned branch. */
81
+ declare function scanItemsScanned(value: ItemPage, failure?: Failure): Case<ItemPage>;
82
+ /** Script the providerRejected branch. */
83
+ declare function scanItemsProviderRejected(value: ItemPage, failure?: Failure): Case<ItemPage>;
84
+ /** Script the invalidResponse branch. */
85
+ declare function scanItemsInvalidResponse(value: ItemPage, failure?: Failure): Case<ItemPage>;
86
+ /** Script the defect branch. */
87
+ declare function scanItemsDefect(value: ItemPage, failure?: Failure): Case<ItemPage>;
88
+ /** Script a safe retry of scanItems. */
89
+ declare function scanItemsRetry(failure: Failure, retryAfterMs?: number): Case<ItemPage>;
90
+ /** Manifest scenario scannedDefault for scanItems. */
91
+ declare function scanItemsScannedDefault(): Case<ItemPage>;
92
+ /** Default scanItems scenario. */
93
+ declare function scanItemsDefault(): Case<ItemPage>;
26
94
  /** Scripted operations and manifest defaults for this connector. */
27
95
  declare class GeneratedMock implements Operations {
28
96
  #private;
29
97
  constructor(connectionName: string);
30
98
  connection(): Connection;
31
99
  getItem(): MockQuery<GetItemInput, ItemResult>;
100
+ putItem(): MockMutation<PutItemInput, ItemWriteResult>;
101
+ updateItem(): MockMutation<UpdateItemInput, ItemWriteResult>;
102
+ deleteItem(): MockMutation<DeleteItemInput, ItemWriteResult>;
103
+ scanItems(): MockQuery<ScanItemsInput, ItemPage>;
32
104
  assertNoFailures(): void;
33
105
  }
34
106
 
35
- export { GeneratedMock, GeneratedMock as Mock, emptyGetItemInput, emptyItemResult, getItemDefault, getItemDefect, getItemFound, getItemFoundDefault, getItemInvalidResponse, getItemMissing, getItemProviderRejected, getItemRetry };
107
+ export { GeneratedMock, GeneratedMock as Mock, deleteItemDefault, deleteItemDefect, deleteItemDeleted, deleteItemDeletedDefault, deleteItemInvalidResponse, deleteItemProviderRejected, deleteItemRetry, emptyDeleteItemInput, emptyGetItemInput, emptyItemPage, emptyItemResult, emptyItemWriteResult, emptyPutItemInput, emptyScanItemsInput, emptyUpdateItemInput, getItemDefault, getItemDefect, getItemFound, getItemFoundDefault, getItemInvalidResponse, getItemMissing, getItemProviderRejected, getItemRetry, putItemDefault, putItemDefect, putItemInvalidResponse, putItemProviderRejected, putItemRetry, putItemWritten, putItemWrittenDefault, scanItemsDefault, scanItemsDefect, scanItemsInvalidResponse, scanItemsProviderRejected, scanItemsRetry, scanItemsScanned, scanItemsScannedDefault, updateItemDefault, updateItemDefect, updateItemInvalidResponse, updateItemProviderRejected, updateItemRetry, updateItemUpdated, updateItemUpdatedDefault };