triangle-utils 1.4.70 → 1.4.72

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.
@@ -197,8 +197,7 @@ export class UtilsDynamoDB {
197
197
  const compile = options.compile !== undefined ? options.compile : true;
198
198
  // const project = options.project !== undefined ? options.project : false
199
199
  const attribute_names = options.attribute_names !== undefined ? options.attribute_names : [];
200
- if (index_name === undefined && Object.keys(primary_key).length !== 1 ||
201
- index_name !== undefined && Object.keys(primary_key).length !== index_name.split(".")[0].split("-").length) {
200
+ if (index_name === undefined && Object.keys(primary_key).length !== 1) {
202
201
  return [];
203
202
  }
204
203
  const projection_expression = attribute_names.map(attribute_name => "#" + attribute_name).join(", ");
@@ -251,8 +250,7 @@ export class UtilsDynamoDB {
251
250
  const undefined_attribute_names = options.undefined_attribute_names !== undefined ? options.undefined_attribute_names : [];
252
251
  const defined_attribute_names = options.defined_attribute_names !== undefined ? options.defined_attribute_names : [];
253
252
  const attribute_names = options.attribute_names !== undefined ? options.attribute_names : [];
254
- if (index_name === undefined && Object.keys(primary_key).length !== 1 ||
255
- index_name !== undefined && Object.keys(primary_key).length !== index_name.split(".")[0].split("-").length) {
253
+ if (index_name === undefined && Object.keys(primary_key).length !== 1) {
256
254
  return [];
257
255
  }
258
256
  const projection_expression = attribute_names.map(attribute_name => "#" + attribute_name).join(", ");
@@ -312,8 +310,7 @@ export class UtilsDynamoDB {
312
310
  const undefined_attribute_names = options.undefined_attribute_names !== undefined ? options.undefined_attribute_names : [];
313
311
  const defined_attribute_names = options.defined_attribute_names !== undefined ? options.defined_attribute_names : [];
314
312
  const attribute_names = options.attribute_names !== undefined ? options.attribute_names : [];
315
- if (index_name === undefined && Object.keys(primary_key).length !== 1 ||
316
- index_name !== undefined && Object.keys(primary_key).length !== index_name.split(".")[0].split("-").length) {
313
+ if (index_name === undefined && Object.keys(primary_key).length !== 1) {
317
314
  return [];
318
315
  }
319
316
  const projection_expression = attribute_names.map(attribute_name => "#" + attribute_name).join(", ");
@@ -6,5 +6,9 @@ export declare class UtilsTwitter {
6
6
  get_tweets(user_id: string, options: {
7
7
  compile?: boolean;
8
8
  min_twitter_tweet_id?: string;
9
- }): Promise<any>;
9
+ max_twitter_tweet_id?: string;
10
+ min_publish_time?: string;
11
+ max_publish_time?: string;
12
+ num_pages?: number;
13
+ }): Promise<any[]>;
10
14
  }
@@ -79,13 +79,16 @@ export class UtilsTwitter {
79
79
  const compile = options.compile !== undefined ? options.compile : true;
80
80
  const results = [];
81
81
  let token = undefined;
82
- while (true) {
82
+ for (let p = 0; options.num_pages === undefined || p < options.num_pages; p++) {
83
83
  let response = undefined;
84
84
  for (let i = 0;; i++) {
85
85
  try {
86
86
  response = await this.twitter.users.getPosts(user_id, {
87
87
  paginationToken: token,
88
88
  sinceId: options.min_twitter_tweet_id,
89
+ untilId: options.max_twitter_tweet_id,
90
+ startTime: options.min_publish_time,
91
+ endTime: options.max_publish_time,
89
92
  tweetFields: tweet_fields
90
93
  });
91
94
  break;
@@ -107,5 +110,6 @@ export class UtilsTwitter {
107
110
  return results;
108
111
  }
109
112
  }
113
+ return results;
110
114
  }
111
115
  }
package/dist/src/f.js CHANGED
@@ -211,8 +211,10 @@ const utils = new TriangleUtils(config);
211
211
  // ]
212
212
  // })
213
213
  // console.log(JSON.stringify(tweet, undefined, 4))
214
- const results = await utils.twitter.get_tweets("1603470469608374272", {
215
- compile: true,
216
- min_twitter_tweet_id: "2061610563679985813"
217
- });
218
- console.log(results);
214
+ // const results = await utils.twitter.get_tweets("1603470469608374272", {
215
+ // compile : true,
216
+ // min_twitter_tweet_id : "2061610563679985813"
217
+ // })
218
+ // console.log(results)
219
+ const f = await utils.dynamodb.query_range("federal_election_donations:donor_address_state_id.federal_election_committee_id-receipt_date-federal_election_donation_id", { donor_address_state_id: "NH", federal_election_committee_id: "C00694323" }, { receipt_date: ["2021", "2023"] }, { compile: false });
220
+ console.log(f);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "triangle-utils",
3
- "version": "1.4.70",
3
+ "version": "1.4.72",
4
4
  "main": "dist/src/index.js",
5
5
  "types": "dist/src/index.d.ts",
6
6
  "directories": {
@@ -244,8 +244,7 @@ export class UtilsDynamoDB {
244
244
  // const project = options.project !== undefined ? options.project : false
245
245
  const attribute_names : string[] = options.attribute_names !== undefined ? options.attribute_names : []
246
246
 
247
- if (index_name === undefined && Object.keys(primary_key).length !== 1 ||
248
- index_name !== undefined && Object.keys(primary_key).length !== index_name.split(".")[0].split("-").length
247
+ if (index_name === undefined && Object.keys(primary_key).length !== 1
249
248
  ) {
250
249
  return []
251
250
  }
@@ -314,8 +313,7 @@ export class UtilsDynamoDB {
314
313
  const defined_attribute_names : string[] = options.defined_attribute_names !== undefined ? options.defined_attribute_names : []
315
314
  const attribute_names : string[] = options.attribute_names !== undefined ? options.attribute_names : []
316
315
 
317
- if (index_name === undefined && Object.keys(primary_key).length !== 1 ||
318
- index_name !== undefined && Object.keys(primary_key).length !== index_name.split(".")[0].split("-").length
316
+ if (index_name === undefined && Object.keys(primary_key).length !== 1
319
317
  ) {
320
318
  return []
321
319
  }
@@ -391,8 +389,7 @@ export class UtilsDynamoDB {
391
389
  const defined_attribute_names : string[] = options.defined_attribute_names !== undefined ? options.defined_attribute_names : []
392
390
  const attribute_names : string[] = options.attribute_names !== undefined ? options.attribute_names : []
393
391
 
394
- if (index_name === undefined && Object.keys(primary_key).length !== 1 ||
395
- index_name !== undefined && Object.keys(primary_key).length !== index_name.split(".")[0].split("-").length
392
+ if (index_name === undefined && Object.keys(primary_key).length !== 1
396
393
  ) {
397
394
  return []
398
395
  }
@@ -85,18 +85,25 @@ export class UtilsTwitter {
85
85
 
86
86
  async get_tweets(user_id : string, options : {
87
87
  compile? : boolean
88
- min_twitter_tweet_id? : string
89
- }) : Promise<any> {
88
+ min_twitter_tweet_id? : string,
89
+ max_twitter_tweet_id? : string,
90
+ min_publish_time? : string,
91
+ max_publish_time? : string,
92
+ num_pages? : number
93
+ }) : Promise<any[]> {
90
94
  const compile = options.compile !== undefined ? options.compile : true
91
95
  const results : any[] = []
92
96
  let token : string | undefined = undefined
93
- while (true) {
97
+ for (let p = 0; options.num_pages === undefined || p < options.num_pages; p++) {
94
98
  let response : any = undefined
95
99
  for (let i = 0; ; i++) {
96
100
  try {
97
101
  response = await this.twitter.users.getPosts(user_id, {
98
102
  paginationToken : token,
99
103
  sinceId : options.min_twitter_tweet_id,
104
+ untilId : options.max_twitter_tweet_id,
105
+ startTime : options.min_publish_time,
106
+ endTime : options.max_publish_time,
100
107
  tweetFields : tweet_fields
101
108
  })
102
109
  break
@@ -116,6 +123,8 @@ export class UtilsTwitter {
116
123
  if (token === undefined || !compile) {
117
124
  return results
118
125
  }
126
+
119
127
  }
128
+ return results
120
129
  }
121
130
  }
package/src/f.ts CHANGED
@@ -243,9 +243,13 @@ const utils = new TriangleUtils(config)
243
243
 
244
244
  // console.log(JSON.stringify(tweet, undefined, 4))
245
245
 
246
- const results = await utils.twitter.get_tweets("1603470469608374272", {
247
- compile : true,
248
- min_twitter_tweet_id : "2061610563679985813"
249
- })
246
+ // const results = await utils.twitter.get_tweets("1603470469608374272", {
247
+ // compile : true,
248
+ // min_twitter_tweet_id : "2061610563679985813"
249
+ // })
250
+
251
+ // console.log(results)
252
+
253
+ const f = await utils.dynamodb.query_range("federal_election_donations:donor_address_state_id.federal_election_committee_id-receipt_date-federal_election_donation_id", { donor_address_state_id : "NH", federal_election_committee_id : "C00694323" }, { receipt_date : ["2021", "2023"] }, { compile : false })
250
254
 
251
- console.log(results)
255
+ console.log(f)
package/f.txt DELETED
Binary file