Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gmail-inbox

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gmail-inbox - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

5

lib/examples/test-email.js

@@ -72,2 +72,7 @@ "use strict";

},
before: {
// must be before now
date: new Date(),
precision: 'milliseconds',
},
subject: 'welcome',

@@ -74,0 +79,0 @@ })];

2

lib/Inbox.d.ts

@@ -63,2 +63,4 @@ import { InboxMethods } from './InboxMethods.interface';

private mapSearchQueryToSearchString;
private mapDateTypeToQuery;
private formatDate;
}

@@ -325,6 +325,44 @@ "use strict";

}
if (searchQuery.before) {
searchString += "before:" + this.mapDateTypeToQuery(searchQuery.before) + " ";
}
if (searchQuery.after) {
searchString += "after:" + this.mapDateTypeToQuery(searchQuery.after) + " ";
}
if (searchQuery.newer) {
searchString += "newer:" + this.mapDateTypeToQuery(searchQuery.newer) + " ";
}
if (searchQuery.older) {
searchString += "older:" + this.mapDateTypeToQuery(searchQuery.older) + " ";
}
return searchString;
};
Inbox.prototype.mapDateTypeToQuery = function (dateType) {
if (typeof dateType === 'number') {
return dateType;
}
var date = dateType.date;
switch (dateType.precision) {
case 'milliseconds':
return date.getTime();
case 'day':
return this.formatDate(date);
case 'year':
return date.getFullYear();
}
};
Inbox.prototype.formatDate = function (date) {
var month = '' + (date.getMonth() + 1);
var day = '' + date.getDate();
var year = date.getFullYear();
if (month.length < 2) {
month = '0' + month;
}
if (day.length < 2) {
day = '0' + day;
}
return [year, month, day].join('/');
};
return Inbox;
}());
exports.Inbox = Inbox;

@@ -1,2 +0,7 @@

declare type MessageFilterIsType = 'read' | 'unread' | 'snoozed' | 'starred' | 'important';
export declare type MessageIsType = 'read' | 'unread' | 'snoozed' | 'starred' | 'important';
export interface MessageDateType {
date: Date;
precision: 'year' | 'day' | 'milliseconds';
}
export declare type UnixTimestamp = number;
export interface SearchQuery {

@@ -30,3 +35,19 @@ /**

*/
is?: MessageFilterIsType | MessageFilterIsType[];
is?: MessageIsType | MessageIsType[];
/**
* same as 'newer'
*/
after?: MessageDateType | UnixTimestamp;
/**
* same as 'older'
*/
before?: MessageDateType | UnixTimestamp;
/**
* same as 'before'
*/
older?: MessageDateType | UnixTimestamp;
/**
* same as 'after'
*/
newer?: MessageDateType | UnixTimestamp;
olderThan?: {

@@ -48,2 +69,1 @@ /**

}
export {};

4

package.json
{
"name": "gmail-inbox",
"version": "1.1.1",
"version": "1.1.2",
"description": "Receive Gmail emails in code!",

@@ -38,3 +38,3 @@ "main": "lib/Inbox.js",

"@types/jest": "^24.0.25",
"@types/node": "^13.1.2",
"@types/node": "^13.1.4",
"jest": "^24.9.0",

@@ -41,0 +41,0 @@ "prettier": "^1.19.1",

@@ -113,4 +113,12 @@ [![npm version](https://badge.fury.io/js/gmail-inbox.svg)](https://badge.fury.io/js/gmail-inbox)

```typescript
type MessageFilterIsType = 'read' | 'unread' | 'snoozed' | 'starred' | 'important';
interface SearchQuery {
export type MessageIsType = 'read' | 'unread' | 'snoozed' | 'starred' | 'important';
export interface MessageDateType {
date: Date;
precision: "year" | "day" | "milliseconds";
}
export type UnixTimestamp = number; // this alias for number gives you a better autocomplete suggestion
export interface SearchQuery {
/**

@@ -133,3 +141,3 @@ * Search for one or multiple potential subjects

* Some possible extensions to search with, if not use "filename" property with your extension. e.g. filename: "png"
* Note: The filenames containing the extension will also be returned. E.g. 'filenameExtension:"pdf" will also return 'not-a-pdf.jpg'
* Note: The filenames containing the extension will also be returned. E.g. 'filenameExtension:"pdf" will also return 'not-a-pdf.jpg'
*/

@@ -144,4 +152,22 @@ filenameExtension?: 'pdf' | 'ppt' | 'doc' | 'docx' | 'zip' | 'rar';

*/
is?: MessageFilterIsType | MessageFilterIsType[];
is?: MessageIsType | MessageIsType[];
/**
* same as 'newer'
*/
after?: MessageDateType | UnixTimestamp,
/**
* same as 'older'
*/
before?: MessageDateType | UnixTimestamp,
/**
* same as 'before'
*/
older?: MessageDateType | UnixTimestamp,
/**
* same as 'after'
*/
newer?: MessageDateType | UnixTimestamp,
olderThan?: {

@@ -152,4 +178,4 @@ /**

amount: number;
period: "day" | "month" | "year"
},
period: 'day' | 'month' | 'year';
};
newerThan?: {

@@ -160,7 +186,6 @@ /**

amount: number;
period: "day" | "month" | "year"
}
category: "primary" | "social" | "promotions" | "updates" | "forums" | "reservations" | "purchases",
period: 'day' | 'month' | 'year';
};
category: 'primary' | 'social' | 'promotions' | 'updates' | 'forums' | 'reservations' | 'purchases';
}
```

@@ -167,0 +192,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc