triangle-utils 1.4.41 → 1.4.43

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.
@@ -7,6 +7,7 @@ export declare class UtilsDynamoDB {
7
7
  undefined_attribute_names?: string[];
8
8
  defined_attribute_names?: string[];
9
9
  attribute_names?: string[];
10
+ segment?: number;
10
11
  concurrency?: number;
11
12
  }): Promise<Record<string, any>[]>;
12
13
  get(table: string, key: Record<string, any>, consistent?: boolean): Promise<Record<string, any> | undefined>;
@@ -108,6 +108,9 @@ export class UtilsDynamoDB {
108
108
  const attribute_names = options.attribute_names !== undefined ? options.attribute_names : [];
109
109
  const iterators = [];
110
110
  for (let i = 0; i < concurrency; i++) {
111
+ if (options.segment !== undefined && i !== options.segment) {
112
+ continue;
113
+ }
111
114
  const expression_attribute_names = Object.fromEntries([...Object.keys(filters), ...attribute_names, ...undefined_attribute_names, ...defined_attribute_names]
112
115
  .map(attribute_name => ["#" + attribute_name, attribute_name]));
113
116
  const expression_attribute_values = Object.fromEntries(Object.entries(filters)
package/dist/src/f.js CHANGED
@@ -15,3 +15,5 @@ const config = {
15
15
  const utils = new TriangleUtils(config);
16
16
  // const foods = await utils.dynamodb.query("triage_docket_documents:register_document_id", { register_document_id : "E6-17065" })
17
17
  // console.log(foods)
18
+ const federal_donations = await utils.dynamodb.scan("elections.federal_donations", { concurrency: 100000, segment: 0, attribute_names: ["federal_donation_id", "file_number", "fec_file_id"] });
19
+ console.log(federal_donations.length);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.4.41",
3
+ "version": "1.4.43",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
@@ -112,6 +112,7 @@ export class UtilsDynamoDB {
112
112
  undefined_attribute_names? : string[],
113
113
  defined_attribute_names? : string[],
114
114
  attribute_names? : string[],
115
+ segment? : number
115
116
  concurrency? : number
116
117
  } = {}
117
118
  ) : Promise<Record<string, any>[]> {
@@ -124,6 +125,9 @@ export class UtilsDynamoDB {
124
125
  const attribute_names : string[] = options.attribute_names !== undefined ? options.attribute_names : []
125
126
  const iterators = []
126
127
  for (let i = 0; i < concurrency; i++) {
128
+ if (options.segment !== undefined && i !== options.segment) {
129
+ continue
130
+ }
127
131
  const expression_attribute_names = Object.fromEntries(
128
132
  [...Object.keys(filters), ...attribute_names, ...undefined_attribute_names, ...defined_attribute_names]
129
133
  .map(attribute_name => ["#" + attribute_name, attribute_name])
package/src/f.ts CHANGED
@@ -22,4 +22,8 @@ const utils = new TriangleUtils(config)
22
22
 
23
23
  // const foods = await utils.dynamodb.query("triage_docket_documents:register_document_id", { register_document_id : "E6-17065" })
24
24
 
25
- // console.log(foods)
25
+ // console.log(foods)
26
+
27
+
28
+ const federal_donations = await utils.dynamodb.scan("elections.federal_donations", { concurrency : 100000, segment : 0, attribute_names : ["federal_donation_id", "file_number", "fec_file_id"]})
29
+ console.log(federal_donations.length)