triangle-utils 1.4.0 → 1.4.2
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/src/UtilsBee.js
CHANGED
|
@@ -11,14 +11,17 @@ export declare class UtilsDynamoDB {
|
|
|
11
11
|
get(table: string, key: Record<string, any>, consistent?: boolean): Promise<Record<string, any> | undefined>;
|
|
12
12
|
get_max(table: string, primary_key: Record<string, any>): Promise<Record<string, any> | undefined>;
|
|
13
13
|
query(table: string, primary_key: Record<string, any>, options?: {
|
|
14
|
+
index_name?: string;
|
|
14
15
|
reverse?: boolean;
|
|
15
16
|
compile?: boolean;
|
|
16
17
|
}): Promise<Record<string, any>[]>;
|
|
17
18
|
query_prefix(table: string, primary_key: Record<string, any>, secondary_key_prefix: Record<string, string>, options?: {
|
|
19
|
+
index_name?: string;
|
|
18
20
|
reverse?: boolean;
|
|
19
21
|
compile?: boolean;
|
|
20
22
|
}): Promise<Record<string, any>[]>;
|
|
21
23
|
query_range(table: string, primary_key: Record<string, any>, secondary_key_range: Record<string, (string | number)[]>, options?: {
|
|
24
|
+
index_name?: string;
|
|
22
25
|
reverse?: boolean;
|
|
23
26
|
compile?: boolean;
|
|
24
27
|
}): Promise<Record<string, any>[]>;
|
|
@@ -174,6 +174,7 @@ export class UtilsDynamoDB {
|
|
|
174
174
|
return converted_output;
|
|
175
175
|
}
|
|
176
176
|
async query(table, primary_key, options = {}) {
|
|
177
|
+
const index_name = options.index_name !== undefined ? options.index_name : undefined;
|
|
177
178
|
const reverse = options.reverse !== undefined ? options.reverse : false;
|
|
178
179
|
const compile = options.compile !== undefined ? options.compile : true;
|
|
179
180
|
if (Object.keys(primary_key).length !== 1) {
|
|
@@ -186,6 +187,7 @@ export class UtilsDynamoDB {
|
|
|
186
187
|
}
|
|
187
188
|
const request = {
|
|
188
189
|
TableName: table,
|
|
190
|
+
IndexName: index_name,
|
|
189
191
|
ExpressionAttributeNames: {
|
|
190
192
|
"#a": key
|
|
191
193
|
},
|
|
@@ -198,6 +200,7 @@ export class UtilsDynamoDB {
|
|
|
198
200
|
return await compile_pages(request, (request) => this.dynamodb.query(request), compile);
|
|
199
201
|
}
|
|
200
202
|
async query_prefix(table, primary_key, secondary_key_prefix, options = {}) {
|
|
203
|
+
const index_name = options.index_name !== undefined ? options.index_name : undefined;
|
|
201
204
|
const reverse = options.reverse !== undefined ? options.reverse : false;
|
|
202
205
|
const compile = options.compile !== undefined ? options.compile : true;
|
|
203
206
|
if (Object.keys(primary_key).length !== 1 || Object.keys(secondary_key_prefix).length !== 1) {
|
|
@@ -210,6 +213,7 @@ export class UtilsDynamoDB {
|
|
|
210
213
|
}
|
|
211
214
|
const request = {
|
|
212
215
|
TableName: table,
|
|
216
|
+
IndexName: index_name,
|
|
213
217
|
ExpressionAttributeNames: {
|
|
214
218
|
"#a": Object.keys(primary_key)[0],
|
|
215
219
|
"#b": Object.keys(secondary_key_prefix)[0]
|
|
@@ -224,6 +228,7 @@ export class UtilsDynamoDB {
|
|
|
224
228
|
return await compile_pages(request, (request) => this.dynamodb.query(request), compile);
|
|
225
229
|
}
|
|
226
230
|
async query_range(table, primary_key, secondary_key_range, options = {}) {
|
|
231
|
+
const index_name = options.index_name !== undefined ? options.index_name : undefined;
|
|
227
232
|
const reverse = options.reverse !== undefined ? options.reverse : false;
|
|
228
233
|
const compile = options.compile !== undefined ? options.compile : true;
|
|
229
234
|
if (Object.keys(primary_key).length !== 1 || Object.keys(secondary_key_range).length !== 1 || Object.values(secondary_key_range)[0].length !== 2) {
|
|
@@ -237,6 +242,7 @@ export class UtilsDynamoDB {
|
|
|
237
242
|
}
|
|
238
243
|
const request = {
|
|
239
244
|
TableName: table,
|
|
245
|
+
IndexName: index_name,
|
|
240
246
|
ExpressionAttributeNames: {
|
|
241
247
|
"#a": Object.keys(primary_key)[0],
|
|
242
248
|
"#b": Object.keys(secondary_key_range)[0]
|
package/package.json
CHANGED
package/src/UtilsBee.ts
CHANGED
|
@@ -20,10 +20,6 @@ export class UtilsBee {
|
|
|
20
20
|
url : url,
|
|
21
21
|
params : params
|
|
22
22
|
})
|
|
23
|
-
if (response.status !== 200) {
|
|
24
|
-
console.log("Status", response.status)
|
|
25
|
-
return undefined
|
|
26
|
-
}
|
|
27
23
|
const text = this.text_decoder.decode(response.data)
|
|
28
24
|
return text
|
|
29
25
|
} catch (error) {
|
package/src/UtilsDynamoDB.ts
CHANGED
|
@@ -204,10 +204,12 @@ export class UtilsDynamoDB {
|
|
|
204
204
|
table : string,
|
|
205
205
|
primary_key : Record<string, any>,
|
|
206
206
|
options : {
|
|
207
|
+
index_name? : string,
|
|
207
208
|
reverse? : boolean,
|
|
208
209
|
compile? : boolean
|
|
209
210
|
} = {}
|
|
210
211
|
) : Promise<Record<string, any>[]>{
|
|
212
|
+
const index_name = options.index_name !== undefined ? options.index_name : undefined
|
|
211
213
|
const reverse = options.reverse !== undefined ? options.reverse : false
|
|
212
214
|
const compile = options.compile !== undefined ? options.compile : true
|
|
213
215
|
if (Object.keys(primary_key).length !== 1) {
|
|
@@ -220,6 +222,7 @@ export class UtilsDynamoDB {
|
|
|
220
222
|
}
|
|
221
223
|
const request : QueryCommandInput = {
|
|
222
224
|
TableName : table,
|
|
225
|
+
IndexName : index_name,
|
|
223
226
|
ExpressionAttributeNames: {
|
|
224
227
|
"#a": key
|
|
225
228
|
},
|
|
@@ -237,10 +240,12 @@ export class UtilsDynamoDB {
|
|
|
237
240
|
primary_key : Record<string, any>,
|
|
238
241
|
secondary_key_prefix : Record<string, string>,
|
|
239
242
|
options : {
|
|
243
|
+
index_name? : string,
|
|
240
244
|
reverse? : boolean,
|
|
241
245
|
compile? : boolean
|
|
242
246
|
} = {}
|
|
243
247
|
) : Promise<Record<string, any>[]>{
|
|
248
|
+
const index_name = options.index_name !== undefined ? options.index_name : undefined
|
|
244
249
|
const reverse = options.reverse !== undefined ? options.reverse : false
|
|
245
250
|
const compile = options.compile !== undefined ? options.compile : true
|
|
246
251
|
if (Object.keys(primary_key).length !== 1 || Object.keys(secondary_key_prefix).length !== 1) {
|
|
@@ -253,6 +258,7 @@ export class UtilsDynamoDB {
|
|
|
253
258
|
}
|
|
254
259
|
const request : QueryCommandInput = {
|
|
255
260
|
TableName : table,
|
|
261
|
+
IndexName : index_name,
|
|
256
262
|
ExpressionAttributeNames: {
|
|
257
263
|
"#a": Object.keys(primary_key)[0],
|
|
258
264
|
"#b": Object.keys(secondary_key_prefix)[0]
|
|
@@ -272,10 +278,12 @@ export class UtilsDynamoDB {
|
|
|
272
278
|
primary_key : Record<string, any>,
|
|
273
279
|
secondary_key_range : Record<string, (string|number)[]>,
|
|
274
280
|
options : {
|
|
281
|
+
index_name? : string,
|
|
275
282
|
reverse? : boolean,
|
|
276
283
|
compile? : boolean
|
|
277
284
|
} = {}
|
|
278
285
|
) : Promise<Record<string, any>[]>{
|
|
286
|
+
const index_name = options.index_name !== undefined ? options.index_name : undefined
|
|
279
287
|
const reverse = options.reverse !== undefined ? options.reverse : false
|
|
280
288
|
const compile = options.compile !== undefined ? options.compile : true
|
|
281
289
|
if (Object.keys(primary_key).length !== 1 || Object.keys(secondary_key_range).length !== 1 || Object.values(secondary_key_range)[0].length !== 2) {
|
|
@@ -289,6 +297,7 @@ export class UtilsDynamoDB {
|
|
|
289
297
|
}
|
|
290
298
|
const request : QueryCommandInput = {
|
|
291
299
|
TableName : table,
|
|
300
|
+
IndexName : index_name,
|
|
292
301
|
ExpressionAttributeNames: {
|
|
293
302
|
"#a": Object.keys(primary_key)[0],
|
|
294
303
|
"#b": Object.keys(secondary_key_range)[0]
|