ag-common 0.0.751 → 0.0.753

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.
@@ -279,7 +279,9 @@ const executePartiQLQuery = (params) => __awaiter(void 0, void 0, void 0, functi
279
279
  Limit: params.limit,
280
280
  NextToken: nextToken,
281
281
  };
282
- const result = yield (0, withRetry_1.withRetry)(() => _1.dynamoDb.send(new lib_dynamodb_1.ExecuteStatementCommand(executeParams)), 'batchQueryDynamo');
282
+ const result = yield (0, withRetry_1.withRetry)(() => _1.dynamoDb.send(new lib_dynamodb_1.ExecuteStatementCommand(executeParams)), 'batchQueryDynamo', {
283
+ maxRetries: params.maxRetries === undefined ? 3 : params.maxRetries,
284
+ });
283
285
  if (result.Items) {
284
286
  allItems.push(...result.Items);
285
287
  }
@@ -20,7 +20,10 @@ const putDynamo = (item, tableName, opt) => __awaiter(void 0, void 0, void 0, fu
20
20
  ConditionExpression: `attribute_not_exists(${opt.pkName})`,
21
21
  }));
22
22
  try {
23
- yield (0, withRetry_1.withRetry)(() => _1.dynamoDb.send(new lib_dynamodb_1.PutCommand(putParams)), 'putDynamo');
23
+ const res = yield (0, withRetry_1.withRetry)(() => _1.dynamoDb.send(new lib_dynamodb_1.PutCommand(putParams)), 'putDynamo');
24
+ if (res.$metadata.httpStatusCode !== 200) {
25
+ return { error: res.toString() };
26
+ }
24
27
  return { data: undefined };
25
28
  }
26
29
  catch (e) {
@@ -37,6 +37,7 @@ export interface DynamoQueryParams {
37
37
  limit?: number;
38
38
  filter?: DynamoFilter;
39
39
  sortAscending?: boolean;
40
+ /** default 3, set to null to disable retries */
40
41
  maxRetries?: number | null;
41
42
  }
42
43
  export interface DynamoBatchQueryParams {
@@ -46,5 +47,7 @@ export interface DynamoBatchQueryParams {
46
47
  indexName?: string;
47
48
  limit?: number;
48
49
  filter?: DynamoFilter;
50
+ /** default 3, set to null to disable retries */
51
+ maxRetries?: number | null;
49
52
  }
50
53
  export declare const isError: <T>(result: DynamoDBResult<T>) => result is DynamoDBError;
@@ -46,26 +46,4 @@ export interface ILambdaConfig {
46
46
  export type ILambdaConfigs = Partial<Record<string, ILambdaConfig & {
47
47
  default?: ILambdaConfig;
48
48
  }>>;
49
- export type TSkOperator = 'BETWEEN' | '<' | '<=' | '=' | '>=' | '>' | '<>' | 'BEGINS_WITH';
50
- export interface IQueryDynamo {
51
- pkName: string;
52
- pkValue: string | number;
53
- /** default, = */
54
- pkOperator?: string;
55
- skName?: string;
56
- skValue?: string | number | string[] | number[];
57
- /** default, = */
58
- skOperator?: TSkOperator;
59
- tableName: string;
60
- indexName?: string;
61
- /** default 1000. if null will not apply */
62
- limit?: number | null;
63
- startKey?: Key;
64
- filterName?: string;
65
- filterValue?: string | number | boolean;
66
- /** default, = */
67
- filterOperator?: string;
68
- /** default = true */
69
- sortAscending?: boolean;
70
- }
71
49
  export type * from './aws';
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.751",
2
+ "version": "0.0.753",
3
3
  "name": "ag-common",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",