triangle-utils 1.4.146 → 1.4.148
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/UtilsRDS.d.ts +3 -0
- package/dist/src/UtilsRDS.js +5 -0
- package/dist/src/UtilsTwitter.d.ts +1 -0
- package/dist/src/UtilsTwitter.js +4 -1
- package/package.json +1 -1
- package/src/UtilsRDS.ts +12 -0
- package/src/UtilsTwitter.ts +6 -2
package/dist/src/UtilsRDS.d.ts
CHANGED
|
@@ -38,4 +38,7 @@ export declare class UtilsRDS {
|
|
|
38
38
|
batch_delete(table_id: string, primary_key: Record<string, any[]>, options?: {
|
|
39
39
|
is_verbose?: boolean;
|
|
40
40
|
}): Promise<any[]>;
|
|
41
|
+
set(table_id: string, primary_key: Record<string, any>, attributes: Record<string, any>, options?: {
|
|
42
|
+
is_verbose?: boolean;
|
|
43
|
+
}): Promise<any[]>;
|
|
41
44
|
}
|
package/dist/src/UtilsRDS.js
CHANGED
|
@@ -192,4 +192,9 @@ export class UtilsRDS {
|
|
|
192
192
|
const sql = "DELETE FROM " + table_id + " WHERE " + Object.entries(primary_key).map(([key_name, values]) => key_name + " IN " + "(" + values.map(value => convert_rds_input(value)).join(", ") + ")").join(" AND ");
|
|
193
193
|
return await this.exec(sql, options);
|
|
194
194
|
}
|
|
195
|
+
async set(table_id, primary_key, attributes, options = {}) {
|
|
196
|
+
const attribute_names = Object.keys(attributes).sort();
|
|
197
|
+
const sql = "UPDATE " + table_id + " SET " + attribute_names.map(attribute_name => attribute_name + " = " + convert_rds_input(attributes[attribute_name])).join(", ") + " WHERE " + Object.entries(primary_key).map(([key_name, value]) => key_name + " = " + convert_rds_input(value)).join(" AND ");
|
|
198
|
+
return await this.exec(sql, options);
|
|
199
|
+
}
|
|
195
200
|
}
|
package/dist/src/UtilsTwitter.js
CHANGED
|
@@ -77,6 +77,7 @@ export class UtilsTwitter {
|
|
|
77
77
|
}
|
|
78
78
|
async get_tweets(user_id, options) {
|
|
79
79
|
const compile = options.compile !== undefined ? options.compile : true;
|
|
80
|
+
const verbosity = options.verbosity || 0;
|
|
80
81
|
const results = [];
|
|
81
82
|
let token = undefined;
|
|
82
83
|
for (let p = 0; options.num_pages === undefined || p < options.num_pages; p++) {
|
|
@@ -105,7 +106,9 @@ export class UtilsTwitter {
|
|
|
105
106
|
}
|
|
106
107
|
results.push(...(response.data || []));
|
|
107
108
|
token = (response.meta || {}).nextToken;
|
|
108
|
-
|
|
109
|
+
if (verbosity > 0) {
|
|
110
|
+
console.log("Token:", token);
|
|
111
|
+
}
|
|
109
112
|
if (token === undefined || !compile) {
|
|
110
113
|
return results;
|
|
111
114
|
}
|
package/package.json
CHANGED
package/src/UtilsRDS.ts
CHANGED
|
@@ -267,6 +267,18 @@ export class UtilsRDS {
|
|
|
267
267
|
return await this.exec(sql, options)
|
|
268
268
|
}
|
|
269
269
|
|
|
270
|
+
async set(
|
|
271
|
+
table_id : string,
|
|
272
|
+
primary_key : Record<string, any>,
|
|
273
|
+
attributes : Record<string, any>,
|
|
274
|
+
options : {
|
|
275
|
+
is_verbose? : boolean
|
|
276
|
+
} = {}
|
|
277
|
+
) {
|
|
278
|
+
const attribute_names = Object.keys(attributes).sort()
|
|
279
|
+
const sql = "UPDATE " + table_id + " SET " + attribute_names.map(attribute_name => attribute_name + " = " + convert_rds_input(attributes[attribute_name])).join(", ") + " WHERE " + Object.entries(primary_key).map(([key_name, value]) => key_name + " = " + convert_rds_input(value)).join(" AND ")
|
|
280
|
+
return await this.exec(sql, options)
|
|
281
|
+
}
|
|
270
282
|
|
|
271
283
|
|
|
272
284
|
}
|
package/src/UtilsTwitter.ts
CHANGED
|
@@ -89,9 +89,11 @@ export class UtilsTwitter {
|
|
|
89
89
|
max_twitter_tweet_id? : string,
|
|
90
90
|
min_publish_time? : string,
|
|
91
91
|
max_publish_time? : string,
|
|
92
|
-
num_pages? : number
|
|
92
|
+
num_pages? : number,
|
|
93
|
+
verbosity? : number
|
|
93
94
|
}) : Promise<any[]> {
|
|
94
95
|
const compile = options.compile !== undefined ? options.compile : true
|
|
96
|
+
const verbosity = options.verbosity || 0
|
|
95
97
|
const results : any[] = []
|
|
96
98
|
let token : string | undefined = undefined
|
|
97
99
|
for (let p = 0; options.num_pages === undefined || p < options.num_pages; p++) {
|
|
@@ -119,7 +121,9 @@ export class UtilsTwitter {
|
|
|
119
121
|
}
|
|
120
122
|
results.push(...(response.data || []))
|
|
121
123
|
token = (response.meta || {}).nextToken
|
|
122
|
-
|
|
124
|
+
if (verbosity > 0) {
|
|
125
|
+
console.log("Token:", token)
|
|
126
|
+
}
|
|
123
127
|
if (token === undefined || !compile) {
|
|
124
128
|
return results
|
|
125
129
|
}
|