triangle-utils 1.4.76 → 1.4.78
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.
|
@@ -3,12 +3,14 @@ export declare class UtilsDynamoDB {
|
|
|
3
3
|
constructor(region: string);
|
|
4
4
|
get_table_key_names(table_name: string): Promise<string[] | undefined>;
|
|
5
5
|
scan(table_index_name: string, options?: {
|
|
6
|
+
compile?: boolean;
|
|
6
7
|
filters?: Record<string, any>;
|
|
7
8
|
undefined_attribute_names?: string[];
|
|
8
9
|
defined_attribute_names?: string[];
|
|
9
10
|
attribute_names?: string[];
|
|
10
11
|
segment_id?: number;
|
|
11
12
|
num_segments?: number;
|
|
13
|
+
max_num_items?: number;
|
|
12
14
|
last_key?: Record<string, any>;
|
|
13
15
|
}): Promise<Record<string, any>[]>;
|
|
14
16
|
get(table: string, key: Record<string, any>, consistent?: boolean): Promise<Record<string, any> | undefined>;
|
|
@@ -101,6 +101,7 @@ export class UtilsDynamoDB {
|
|
|
101
101
|
async scan(table_index_name, options = {}) {
|
|
102
102
|
const table_name = table_index_name.split(":")[0];
|
|
103
103
|
const index_name = table_index_name.split(":")[1];
|
|
104
|
+
const compile = options.compile !== undefined ? options.compile : true;
|
|
104
105
|
const filters = options.filters !== undefined ? options.filters : {};
|
|
105
106
|
const undefined_attribute_names = options.undefined_attribute_names !== undefined ? options.undefined_attribute_names : [];
|
|
106
107
|
const defined_attribute_names = options.defined_attribute_names !== undefined ? options.defined_attribute_names : [];
|
|
@@ -131,9 +132,10 @@ export class UtilsDynamoDB {
|
|
|
131
132
|
ProjectionExpression: projection_expression.length > 0 ? projection_expression : undefined,
|
|
132
133
|
Segment: i,
|
|
133
134
|
TotalSegments: num_segments,
|
|
135
|
+
Limit: options.max_num_items,
|
|
134
136
|
ExclusiveStartKey: options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
135
137
|
};
|
|
136
|
-
iterators.push(compile_pages(request, (request) => this.dynamodb.scan(request)));
|
|
138
|
+
iterators.push(compile_pages(request, (request) => this.dynamodb.scan(request), compile));
|
|
137
139
|
}
|
|
138
140
|
const segments = await Promise.all(iterators);
|
|
139
141
|
const items = segments.flat().filter(is_item);
|
|
@@ -5,6 +5,7 @@ export declare class GlobalConfig {
|
|
|
5
5
|
readonly auth_url: string;
|
|
6
6
|
readonly s3_elections: string;
|
|
7
7
|
readonly s3_prism: string;
|
|
8
|
+
readonly s3_scout: string;
|
|
8
9
|
readonly s3_triage: string;
|
|
9
10
|
readonly super_federal_gov_api_keys: string;
|
|
10
11
|
readonly federal_gov_api_keys: string;
|
|
@@ -5,6 +5,7 @@ export class GlobalConfig {
|
|
|
5
5
|
auth_url;
|
|
6
6
|
s3_elections;
|
|
7
7
|
s3_prism;
|
|
8
|
+
s3_scout;
|
|
8
9
|
s3_triage;
|
|
9
10
|
super_federal_gov_api_keys;
|
|
10
11
|
federal_gov_api_keys;
|
|
@@ -23,6 +24,7 @@ export class GlobalConfig {
|
|
|
23
24
|
this.auth_url = global_config.auth_url;
|
|
24
25
|
this.s3_elections = global_config.s3_elections;
|
|
25
26
|
this.s3_prism = global_config.s3_prism;
|
|
27
|
+
this.s3_scout = global_config.s3_scout;
|
|
26
28
|
this.s3_triage = global_config.s3_triage;
|
|
27
29
|
this.super_federal_gov_api_keys = global_config.super_federal_gov_api_keys;
|
|
28
30
|
this.federal_gov_api_keys = global_config.federal_gov_api_keys;
|
|
@@ -40,6 +42,7 @@ export class GlobalConfig {
|
|
|
40
42
|
typeof global_config.auth_url === "string" &&
|
|
41
43
|
typeof global_config.s3_elections === "string" &&
|
|
42
44
|
typeof global_config.s3_prism === "string" &&
|
|
45
|
+
typeof global_config.s3_scout === "string" &&
|
|
43
46
|
typeof global_config.s3_triage === "string" &&
|
|
44
47
|
typeof global_config.super_federal_gov_api_keys === "string" &&
|
|
45
48
|
typeof global_config.federal_gov_api_keys === "string" &&
|
package/package.json
CHANGED
package/src/UtilsDynamoDB.ts
CHANGED
|
@@ -108,17 +108,20 @@ export class UtilsDynamoDB {
|
|
|
108
108
|
async scan(
|
|
109
109
|
table_index_name : string,
|
|
110
110
|
options : {
|
|
111
|
+
compile? : boolean,
|
|
111
112
|
filters? : Record<string, any>,
|
|
112
113
|
undefined_attribute_names? : string[],
|
|
113
114
|
defined_attribute_names? : string[],
|
|
114
115
|
attribute_names? : string[],
|
|
115
116
|
segment_id? : number
|
|
116
117
|
num_segments? : number,
|
|
118
|
+
max_num_items? : number,
|
|
117
119
|
last_key? : Record<string, any>
|
|
118
120
|
} = {}
|
|
119
121
|
) : Promise<Record<string, any>[]> {
|
|
120
122
|
const table_name : string = table_index_name.split(":")[0]
|
|
121
123
|
const index_name : string | undefined = table_index_name.split(":")[1]
|
|
124
|
+
const compile = options.compile !== undefined ? options.compile : true
|
|
122
125
|
const filters = options.filters !== undefined ? options.filters : {}
|
|
123
126
|
const undefined_attribute_names : string[] = options.undefined_attribute_names !== undefined ? options.undefined_attribute_names : []
|
|
124
127
|
const defined_attribute_names : string[] = options.defined_attribute_names !== undefined ? options.defined_attribute_names : []
|
|
@@ -153,9 +156,10 @@ export class UtilsDynamoDB {
|
|
|
153
156
|
ProjectionExpression : projection_expression.length > 0 ? projection_expression : undefined,
|
|
154
157
|
Segment : i,
|
|
155
158
|
TotalSegments : num_segments,
|
|
159
|
+
Limit : options.max_num_items,
|
|
156
160
|
ExclusiveStartKey : options.last_key !== undefined ? convert_input(options.last_key)?.M : undefined
|
|
157
161
|
}
|
|
158
|
-
iterators.push(compile_pages(request, (request : ScanCommandInput) => this.dynamodb.scan(request)))
|
|
162
|
+
iterators.push(compile_pages(request, (request : ScanCommandInput) => this.dynamodb.scan(request), compile))
|
|
159
163
|
}
|
|
160
164
|
const segments = await Promise.all(iterators)
|
|
161
165
|
const items = segments.flat().filter(is_item)
|
|
@@ -5,6 +5,7 @@ export class GlobalConfig {
|
|
|
5
5
|
readonly auth_url : string
|
|
6
6
|
readonly s3_elections : string
|
|
7
7
|
readonly s3_prism : string
|
|
8
|
+
readonly s3_scout : string
|
|
8
9
|
readonly s3_triage : string
|
|
9
10
|
readonly super_federal_gov_api_keys : string
|
|
10
11
|
readonly federal_gov_api_keys : string
|
|
@@ -25,6 +26,7 @@ export class GlobalConfig {
|
|
|
25
26
|
this.auth_url = global_config.auth_url
|
|
26
27
|
this.s3_elections = global_config.s3_elections
|
|
27
28
|
this.s3_prism = global_config.s3_prism
|
|
29
|
+
this.s3_scout = global_config.s3_scout
|
|
28
30
|
this.s3_triage = global_config.s3_triage
|
|
29
31
|
this.super_federal_gov_api_keys = global_config.super_federal_gov_api_keys
|
|
30
32
|
this.federal_gov_api_keys = global_config.federal_gov_api_keys
|
|
@@ -44,6 +46,7 @@ export class GlobalConfig {
|
|
|
44
46
|
typeof global_config.auth_url === "string" &&
|
|
45
47
|
typeof global_config.s3_elections === "string" &&
|
|
46
48
|
typeof global_config.s3_prism === "string" &&
|
|
49
|
+
typeof global_config.s3_scout === "string" &&
|
|
47
50
|
typeof global_config.s3_triage === "string" &&
|
|
48
51
|
typeof global_config.super_federal_gov_api_keys === "string" &&
|
|
49
52
|
typeof global_config.federal_gov_api_keys === "string" &&
|