New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

query-builder-for-driveapi

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

query-builder-for-driveapi - npm Package Compare versions

Comparing version 1.1.0 to 2.0.0

lib/constants.cjs

84

lib/index.d.ts

@@ -1,31 +0,73 @@

declare enum Collection {
PARENTS = "parents",
OWNERS = "owners",
WRITERS = "writers",
READERS = "readers"
}
import { Collection, FileType, VisibilityLevel } from './constants.js';
declare class QueryBuilder {
private readonly queries;
private negateNextTerm;
private lastTerm;
private addQuery;
/**
* Negate the immediately following input (query).
*/
not(): this;
contains(value: string): this;
isEqualTo(value: string): this;
isNotEqualTo(value: string): this;
isLessThan(value: string): this;
isLessThanOrEqualTo(value: string): this;
isGreaterThan(value: string): this;
isGreaterThanOrEqualTo(value: string): this;
inCollection(collection: Collection, values: string | string[]): this;
/**
* Indicates whether the collection contains the specified value.
*/
getByCollection(collection: Collection, value: string | string[]): this;
/**
* Indicates whether the file name is equal to the specified file name.
*/
getByFileName(filename: string | string[]): this;
/**
* Indicates whether the file name, description, indexableText or
* content text properties or metadata of the file contains the specified value.
*/
getByContent(value: string | string[]): this;
/**
* Indicates whether the MIME type of the file is equal to the specified file type.
*/
getByFileType(filetype: string | FileType | (string | FileType)[]): this;
/**
* Indicates whether the creation date of the file is equal to the specified timestamp.
*
* Uses RFC 3339 format, the default timezone is UTC, such as 2011-10-05T14:48:00Z.
*/
getByCreatedAt(timestamp: string | string[]): this;
/**
* Indicates whether the modified date of the file is equal to the specified timestamp.
*
* Uses RFC 3339 format, the default timezone is UTC, such as 2011-10-05T14:48:00Z.
*/
getByUpdatedAt(timestamp: string | string[]): this;
/**
* Indicates whether the visibility level of the file is equal to the specified visibility level.
*
* Valid values are found in the `VisibilityLevel` enumeration.
*/
getByVisibility(visibilityLevel: VisibilityLevel | VisibilityLevel[]): this;
/**
* Indicates whether the file has the specified public properties.
*/
getByPublicProp(properties: Record<string, unknown>): this;
/**
* Indicates whether the file has the specified private properties.
*/
getByPrivateProp(properties: Record<string, unknown>): this;
/**
* Indicates whether the file is in the trash or not.
*/
isTrashed(value: boolean): this;
name(): this;
fullText(): this;
mimeType(): this;
modifiedTime(): this;
createdTime(): this;
/**
* Indicates whether the file is starred or not.
*/
isStarred(value: boolean): this;
/**
* Indicates whether the shared drive is hidden or not.
*/
isHidden(value: boolean): this;
/**
* Joins the inputs into a single string with the `and` operator.
*/
build(): string;
}
export { Collection, QueryBuilder as default };
export { Collection, FileType, VisibilityLevel, QueryBuilder as default };
export = QueryBuilder

@@ -1,42 +0,14 @@

var Operator = /* @__PURE__ */ ((Operator2) => {
Operator2["CONTAINS"] = "contains";
Operator2["EQUAL"] = "=";
Operator2["UNEQUAL"] = "!=";
Operator2["LESS_THAN"] = "<";
Operator2["LESS_THAN_OR_EQUAL"] = "<=";
Operator2["GREATER_THAN"] = ">";
Operator2["GREATER_THAN_OR_EQUAL"] = ">=";
Operator2["IN"] = "in";
Operator2["AND"] = "and";
Operator2["OR"] = "or";
Operator2["NOT"] = "not";
Operator2["HAS"] = "has";
return Operator2;
})(Operator || {});
var Collection = /* @__PURE__ */ ((Collection2) => {
Collection2["PARENTS"] = "parents";
Collection2["OWNERS"] = "owners";
Collection2["WRITERS"] = "writers";
Collection2["READERS"] = "readers";
return Collection2;
})(Collection || {});
var File = /* @__PURE__ */ ((File2) => {
File2["NAME"] = "name";
File2["FULL_TEXT"] = "fullText";
File2["MIME_TYPE"] = "mimeType";
File2["MODIFIED_TIME"] = "modifiedTime";
File2["CREATED_TIME"] = "createdTime";
File2["TRASHED"] = "trashed";
return File2;
})(File || {});
var QueryType = /* @__PURE__ */ ((QueryType2) => {
QueryType2[QueryType2["COLLECTION"] = 0] = "COLLECTION";
QueryType2[QueryType2["STRING"] = 1] = "STRING";
QueryType2[QueryType2["BOOLEAN"] = 2] = "BOOLEAN";
return QueryType2;
})(QueryType || {});
import {
Collection,
File,
FileType,
Operator,
QueryType,
VisibilityLevel
} from "./constants.js";
const QueryTemplate = {
[0 /* COLLECTION */]: (value, operator, collection) => `'${value}' ${operator} ${collection}`,
[1 /* STRING */]: (value, operator, term) => `${term} ${operator} '${value}'`,
[2 /* BOOLEAN */]: (value, operator, term) => `${term} ${operator} ${value}`
[QueryType.COLLECTION]: ({ field, op, entry }) => `'${entry.value}' ${op} ${field}`,
[QueryType.STRING]: ({ field, op, entry }) => `${field} ${op} '${entry.value}'`,
[QueryType.BOOLEAN]: ({ field, op, entry }) => `${field} ${op} ${entry.value}`,
[QueryType.HASH]: ({ field, op, entry }) => `${field} ${op} { key='${entry?.key}' and value='${entry.value}' }`
};

@@ -47,19 +19,25 @@ class QueryBuilder {

this.negateNextTerm = false;
this.lastTerm = "parents" /* PARENTS */;
}
addQuery(type, operator, values) {
addQuery(type, options) {
const { field, op, entry } = options;
let query = "";
if (this.negateNextTerm) {
this.negateNextTerm = false;
query += `${"not" /* NOT */} `;
query += `${Operator.NOT} `;
}
if (typeof values === "string") {
query += QueryTemplate[type](values, operator, this.lastTerm);
const _queries = [];
for (const key in entry) {
const value = entry[key];
_queries.push(
QueryTemplate[type]({ field, op, entry: { key: `${key}`, value } })
);
}
if (Array.isArray(values)) {
query += `(${values.map((v) => QueryTemplate[type](v, operator, this.lastTerm)).join(` ${"or" /* OR */} `)})`;
}
query += `(${_queries.join(
` ${Array.isArray(entry) ? Operator.OR : Operator.AND} `
)})`;
this.queries.push(query);
}
// Comparison methods (query operators)
/**
* Negate the immediately following input (query).
*/
not() {

@@ -69,63 +47,146 @@ this.negateNextTerm = true;

}
contains(value) {
this.addQuery(1 /* STRING */, "contains" /* CONTAINS */, value);
/**
* Indicates whether the collection contains the specified value.
*/
getByCollection(collection, value) {
this.addQuery(QueryType.COLLECTION, {
field: collection,
op: Operator.IN,
entry: Array.isArray(value) ? value : [value]
});
return this;
}
isEqualTo(value) {
this.addQuery(1 /* STRING */, "=" /* EQUAL */, value);
/**
* Indicates whether the file name is equal to the specified file name.
*/
getByFileName(filename) {
this.addQuery(QueryType.STRING, {
field: File.NAME,
op: Operator.EQUAL,
entry: Array.isArray(filename) ? filename : [filename]
});
return this;
}
isNotEqualTo(value) {
this.addQuery(1 /* STRING */, "!=" /* UNEQUAL */, value);
/**
* Indicates whether the file name, description, indexableText or
* content text properties or metadata of the file contains the specified value.
*/
getByContent(value) {
this.addQuery(QueryType.STRING, {
field: File.FULL_TEXT,
op: Operator.CONTAINS,
entry: Array.isArray(value) ? value : [value]
});
return this;
}
isLessThan(value) {
this.addQuery(1 /* STRING */, "<" /* LESS_THAN */, value);
/**
* Indicates whether the MIME type of the file is equal to the specified file type.
*/
getByFileType(filetype) {
this.addQuery(QueryType.STRING, {
field: File.MIME_TYPE,
op: Operator.EQUAL,
entry: Array.isArray(filetype) ? filetype : [filetype]
});
return this;
}
isLessThanOrEqualTo(value) {
this.addQuery(1 /* STRING */, "<=" /* LESS_THAN_OR_EQUAL */, value);
/**
* Indicates whether the creation date of the file is equal to the specified timestamp.
*
* Uses RFC 3339 format, the default timezone is UTC, such as 2011-10-05T14:48:00Z.
*/
getByCreatedAt(timestamp) {
this.addQuery(QueryType.STRING, {
field: File.CREATED_TIME,
op: Operator.EQUAL,
entry: Array.isArray(timestamp) ? timestamp : [timestamp]
});
return this;
}
isGreaterThan(value) {
this.addQuery(1 /* STRING */, ">" /* GREATER_THAN */, value);
/**
* Indicates whether the modified date of the file is equal to the specified timestamp.
*
* Uses RFC 3339 format, the default timezone is UTC, such as 2011-10-05T14:48:00Z.
*/
getByUpdatedAt(timestamp) {
this.addQuery(QueryType.STRING, {
field: File.MODIFIED_TIME,
op: Operator.EQUAL,
entry: Array.isArray(timestamp) ? timestamp : [timestamp]
});
return this;
}
isGreaterThanOrEqualTo(value) {
this.addQuery(1 /* STRING */, ">=" /* GREATER_THAN_OR_EQUAL */, value);
/**
* Indicates whether the visibility level of the file is equal to the specified visibility level.
*
* Valid values are found in the `VisibilityLevel` enumeration.
*/
getByVisibility(visibilityLevel) {
this.addQuery(QueryType.STRING, {
field: File.VISIBILITY,
op: Operator.EQUAL,
entry: Array.isArray(visibilityLevel) ? visibilityLevel : [visibilityLevel]
});
return this;
}
// Term methods (query terms)
inCollection(collection, values) {
this.lastTerm = collection;
this.addQuery(0 /* COLLECTION */, "in" /* IN */, values);
/**
* Indicates whether the file has the specified public properties.
*/
getByPublicProp(properties) {
this.addQuery(QueryType.HASH, {
field: File.PROPERTIES,
op: Operator.HAS,
entry: properties
});
return this;
}
isTrashed(value) {
this.lastTerm = "trashed" /* TRASHED */;
this.addQuery(2 /* BOOLEAN */, "=" /* EQUAL */, `${value}`);
/**
* Indicates whether the file has the specified private properties.
*/
getByPrivateProp(properties) {
this.addQuery(QueryType.HASH, {
field: File.APP_PROPERTIES,
op: Operator.HAS,
entry: properties
});
return this;
}
name() {
this.lastTerm = "name" /* NAME */;
/**
* Indicates whether the file is in the trash or not.
*/
isTrashed(value) {
this.addQuery(QueryType.BOOLEAN, {
field: File.TRASHED,
op: Operator.EQUAL,
entry: [`${value}`]
});
return this;
}
fullText() {
this.lastTerm = "fullText" /* FULL_TEXT */;
/**
* Indicates whether the file is starred or not.
*/
isStarred(value) {
this.addQuery(QueryType.BOOLEAN, {
field: File.STARRED,
op: Operator.EQUAL,
entry: [`${value}`]
});
return this;
}
mimeType() {
this.lastTerm = "mimeType" /* MIME_TYPE */;
/**
* Indicates whether the shared drive is hidden or not.
*/
isHidden(value) {
this.addQuery(QueryType.BOOLEAN, {
field: File.HIDDEN,
op: Operator.EQUAL,
entry: [`${value}`]
});
return this;
}
modifiedTime() {
this.lastTerm = "modifiedTime" /* MODIFIED_TIME */;
return this;
}
createdTime() {
this.lastTerm = "createdTime" /* CREATED_TIME */;
return this;
}
/**
* Joins the inputs into a single string with the `and` operator.
*/
build() {
return this.queries.join(` ${"and" /* AND */} `);
return this.queries.join(` ${Operator.AND} `);
}

@@ -136,3 +197,5 @@ }

Collection,
FileType,
VisibilityLevel,
src_default as default
};

@@ -5,3 +5,3 @@ {

"description": "Easily generate queries for the Google Drive API.",
"version": "1.1.0",
"version": "2.0.0",
"license": "MIT",

@@ -26,4 +26,4 @@ "type": "module",

"prepare": "husky install",
"lint": "eslint src --ext .ts",
"lint:fix": "eslint src --ext .ts --fix",
"lint": "biome lint ./src",
"lint:fix": "biome check --apply ./src",
"prebuild": "npm run lint",

@@ -36,15 +36,10 @@ "build": "tsup --config tsup.config.json && fix-tsup-cjs --cwd lib"

"devDependencies": {
"@commitlint/cli": "^18.4.2",
"@commitlint/config-conventional": "^18.4.2",
"@typescript-eslint/eslint-plugin": "^6.11.0",
"eslint": "^8.54.0",
"eslint-config-standard-with-typescript": "^40.0.0",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-n": "^16.3.1",
"eslint-plugin-promise": "^6.1.1",
"@biomejs/biome": "^1.4.1",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"fix-tsup-cjs": "^1.2.0",
"husky": "^8.0.3",
"lint-staged": "^15.1.0",
"tsup": "^7.3.0",
"typescript": "^5.2.2"
"lint-staged": "^15.2.0",
"tsup": "^8.0.1",
"typescript": "^5.3.3"
},

@@ -51,0 +46,0 @@ "engines": {

# Query Builder for DriveAPI
![node-current](https://img.shields.io/node/v/query-builder-for-driveapi?color=darkgreen)
![npm](https://img.shields.io/npm/v/query-builder-for-driveapi?color=orange)
![npm](https://img.shields.io/npm/dm/query-builder-for-driveapi)
![Libraries.io SourceRank](https://img.shields.io/librariesio/sourcerank/npm/query-builder-for-driveapi)
![version](https://img.shields.io/npm/v/query-builder-for-driveapi?color=orange)
![downloads](https://img.shields.io/npm/dm/query-builder-for-driveapi)
Easily generate queries for the Google Drive API.
## 📦 Installation
## Installation

@@ -16,186 +15,333 @@ ```shell

## 🚀 Quick start
## Importing
### How to import
```js
// ECMAScript
import QueryBuilder, { Collection } from 'query-builder-for-driveapi'
// Using ES6 Imports
import QueryBuilder, { Collection, FileType, VisibilityLevel } from 'query-builder-for-driveapi'
// CommonJS
// Using CommonJS
const QueryBuilder = require('query-builder-for-driveapi')
const Collection = QueryBuilder.Collection
const { Collection, FileType, VisibilityLevel } = QueryBuilder
```
### How to build a query
## Usage
1. Create a new instance
```js
// Create an instance
const qb = new QueryBuilder()
```js
const query = new QueryBuilder()
```
// Add inputs (queries)
qb.getByCollection(Collection.PARENTS, 'parent-id')
qb.getByFileName('something')
2. Add inputs
// Build inputs (queries) in a query
const query = qb.build()
//=> ('parent-id' in parents) and (name = 'something')
```
```js
query.inCollection(Collection.PARENTS, 'folderId')
// ...
query.name().contains('something')
```
## API Reference
or
### Constructor
```js
query
.inCollection(Collection.PARENTS, 'folderId')
.name().contains('something')
```
Create an instance of QueryBuilder.
3. Build query
```js
new QueryBuilder()
```
```js
query.build() // return string
```
### Methods
## Methods
From now on all the examples of each method will use an instance of `QueryBuilder` associated to the constant `qb`.
Commonly used terms and operators are supported. You can find a list of all those supported by the Drive API at [Google Developers](https://developers.google.com/drive/api/guides/ref-search-terms).
#### getByCollection(collection, value)
### Term methods (query terms)
Indicates whether the collection contains the specified values.
<table>
<thead>
<tr>
<th>Term</th>
<th>Method</th>
<th>Return</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>
<code>parents</code>
</td>
<td rowspan=4>
<code>
inCollection(collection: Collection, values: string | string[])
</code>
</td>
<td rowspan=4>Instance</td>
<td rowspan=4>
Indicates whether the collection contains the specified values.
</td>
</tr>
<tr>
<td>
<code>owners</code>
</td>
</tr>
<tr>
<td>
<code>writers</code>
</td>
</tr>
<tr>
<td>
<code>readers</code>
</td>
</tr>
<tr>
<td>
<code>trashed</code>
</td>
<td>
<code>isTrashed(value: boolean)</code>
</td>
<td>Instance</td>
<td>
Whether the file is in the trash or not.
</td>
</tr>
<tr>
<td>
<code>name</code>
</td>
<td>
<code>name()</code>
</td>
<td>Instance</td>
<td>
Select the term <code>name</code> to be used with methods like: <code>contains()</code>, <code>isEqualTo()</code> and <code>isNotEqualTo()</code>
</td>
</tr>
<tr>
<td>
<code>fullText</code>
</td>
<td>
<code>fullText()</code>
</td>
<td>Instance</td>
<td>
Select the term <code>fullText</code> to be used with methods like: <code>contains()</code>
</td>
</tr>
<tr>
<td>
<code>mimeType</code>
</td>
<td>
<code>mimeType()</code>
</td>
<td>Instance</td>
<td>
Select the term <code>mimeType</code> to be used with methods like: <code>contains()</code>, <code>isEqualTo()</code> and <code>isNotEqualTo()</code>
</td>
</tr>
<tr>
<td>
<code>modifiedTime</code>
</td>
<td>
<code>modifiedTime()</code>
</td>
<td>Instance</td>
<td>
Select the term <code>modifiedTime</code> to be used with methods like: <code>isLessThan()</code>, <code>isLessThanOrEqualTo()</code>, <code>isEqualTo()</code>, <code>isNotEqualTo()</code>, <code>isGreaterThanOrEqualTo()</code> and <code>isGreaterThan()</code>
</td>
</tr>
<tr>
<td>
<code>createdTime</code>
</td>
<td>
<code>createdTime()</code>
</td>
<td>Instance</td>
<td>
Select the term <code>createdTime</code> to be used with methods like: <code>isLessThan()</code>, <code>isLessThanOrEqualTo()</code>, <code>isEqualTo()</code>, <code>isNotEqualTo()</code>, <code>isGreaterThanOrEqualTo()</code> and <code>isGreaterThan()</code>
</td>
</tr>
</tbody>
</table>
##### collection
### Comparison methods (query operators)
Type: `Collection`
| Operator | Method | Return | Description |
|-|-|-|-|
| `contains` | `contains(value: string)` | Instance | N/A |
| `=` | `isEqualTo(value: string)` | Instance | N/A |
| `!=` | `isNotEqualTo(value: string)` | Instance | N/A |
| `<` | `isLessThan(value: string)` | Instance | N/A |
| `<=` | `isLessThanOrEqualTo(value: string)` | Instance | N/A |
| `>` | `isGreaterThan(value: string)` | Instance | N/A |
| `>=` | `isGreaterThanOrEqualTo(value: string)` | Instance | N/A |
| `not` | `not()` | Instance | Negate the following term. |
- `Collection.PARENTS`:
```js
qb.getByCollection(Collection.PARENTS, ...).build()
//=> ('...' in parents)
```
### Build
- `Collection.OWNERS`:
```js
qb.getByCollection(Collection.OWNERS, ...).build()
//=> ('...' in owners)
```
| Method | Return | Description |
|-|-|-|
| `build()` | String | Returns a string with the inputs joined with the `and` operator. |
- `Collection.WRITERS`:
```js
qb.getByCollection(Collection.WRITERS, ...).build()
//=> ('...' in writers)
```
## License
- `Collection.READERS`:
```js
qb.getByCollection(Collection.READERS, ...).build()
//=> ('...' in readers)
```
MIT License © 2023 - [Brian Fernandez](https://twitter.com/br14n_sol)
##### value
Type: `string | string[]`
```js
qb.getByCollection(..., 'value').build()
//=> ('value' in ...)
qb.getByCollection(..., ['value-1', 'value-2']).build()
//=> ('value-1' in ... or 'value-2' in ...)
```
#### getByFileName(filename)
Indicates whether the file name is equal to the specified file name.
##### filename
Type: `string | string[]`
```js
qb.getByFileName('value').build()
//=> (name = 'value')
qb.getByFileName(['value-1', 'value-2']).build()
//=> (name = 'value-1' or name = 'value-2')
```
#### getByContent(value)
Indicates whether the file name, description, indexableText or content text properties or metadata of the file contains the specified value.
##### value
Type: `string | string[]`
```js
qb.getByContent('value').build()
//=> (fullText = 'value')
qb.getByContent(['value-1', 'value-2']).build()
//=> (fullText = 'value-1' or fullText = 'value-2')
```
#### getByFileType(filetype)
Indicates whether the MIME type of the file is equal to the specified file type.
##### filetype
Type: `string | FileType | (string | FileType)[]`
- `FileType.FOLDER`:
```js
qb.getByFileType(FileType.FOLDER).build()
//=> (mimeType = 'application/vnd.google-apps.folder')
```
- `FileType.DOCUMENT`:
```js
qb.getByFileType(FileType.DOCUMENT).build()
//=> (mimeType = 'application/vnd.google-apps.document')
```
- `FileType.SPREADSHEET`:
```js
qb.getByFileType(FileType.SPREADSHEET).build()
//=> (mimeType = 'application/vnd.google-apps.spreadsheet')
```
- `FileType.PRESENTATION`:
```js
qb.getByFileType(FileType.PRESENTATION).build()
//=> (mimeType = 'application/vnd.google-apps.presentation')
```
- `FileType.FORM`:
```js
qb.getByFileType(FileType.FORM).build()
//=> (mimeType = 'application/vnd.google-apps.form')
```
- `Others`:
```js
qb.getByFileType('image/jpeg').build()
//=> (mimeType = 'image/jpeg')
qb.getByFileType(['image/png', FileType.DOCUMENT]).build()
//=> (mimeType = 'image/png' or mimeType = 'application/vnd.google-apps.document')
```
#### getByCreatedAt(timestamp)
Indicates whether the creation date of the file is equal to the specified timestamp.
##### timestamp
Type: `string | string[]`
Uses [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) format, the default timezone is UTC, such as 2011-10-05T14:48:00Z.
```js
qb.getByCreatedAt('2011-10-05T14:48:00Z').build()
//=> (createdTime = '2011-10-05T14:48:00Z')
qb.getByCreatedAt(['2019-09-07T15:50Z', '2012-06-04T12:00:00Z']).build()
//=> (createdTime = '2019-09-07T15:50Z' or createdTime = '2012-06-04T12:00:00Z')
```
#### getByUpdatedAt(timestamp)
Indicates whether the modified date of the file is equal to the specified timestamp.
##### timestamp
Type: `string | string[]`
Uses [RFC 3339](https://datatracker.ietf.org/doc/html/rfc3339) format, the default timezone is UTC, such as 2011-10-05T14:48:00Z.
```js
qb.getByUpdatedAt('2011-10-05T14:48:00Z').build()
//=> (modifiedTime = '2011-10-05T14:48:00Z')
qb.getByUpdatedAt(['2019-09-07T15:50Z', '2012-06-04T12:00:00Z']).build()
//=> (modifiedTime = '2019-09-07T15:50Z' or modifiedTime = '2012-06-04T12:00:00Z')
```
#### getByVisibility(visibilityLevel)
Indicates whether the visibility level of the file is equal to the specified visibility level.
##### visibilityLevel
Type: `VisibilityLevel | VisibilityLevel[]`
- `VisibilityLevel.ANYONE_CAN_FIND`:
```js
qb.getByVisibility(VisibilityLevel.ANYONE_CAN_FIND).build()
//=> (visibilityLevel = 'anyoneCanFind')
```
- `VisibilityLevel.ANYONE_WITH_LINK`:
```js
qb.getByVisibility(VisibilityLevel.ANYONE_WITH_LINK).build()
//=> (visibilityLevel = 'anyoneWithLink')
```
- `VisibilityLevel.DOMAIN_CAN_FIND`:
```js
qb.getByVisibility(VisibilityLevel.DOMAIN_CAN_FIND).build()
//=> (visibilityLevel = 'domainCanFind')
```
- `VisibilityLevel.DOMAIN_WITH_LINK`:
```js
qb.getByVisibility(VisibilityLevel.DOMAIN_WITH_LINK).build()
//=> (visibilityLevel = 'domainWithLink')
```
- `VisibilityLevel.LIMITED`:
```js
qb.getByVisibility(VisibilityLevel.LIMITED).build()
//=> (visibilityLevel = 'limited')
```
#### getByPublicProp(properties)
Indicates whether the file has the specified public properties.
#### properties
Type: `Record<string, unknown>`
```js
qb.getByPublicProp({
name: 'wrench',
mass: 1.3 // kg
}).build()
//=> (properties has { key='name' and value='wrench' } and properties has { key='mass' and value='1.3' })
```
#### getByPrivateProp(properties)
Indicates whether the file has the specified private properties.
##### properties
Type: `Record<string, unknown>`
```js
qb.getByPrivateProp({
deviceId: 'd65dd82e-46fe-448f-a6fd-96009a8f97e4'
}).build()
//=> (appProperties has { key='deviceId' and value='d65dd82e-46fe-448f-a6fd-96009a8f97e4' })
```
#### isTrashed(boolean)
Indicates whether the file is in the trash or not.
```js
qb.isTrashed(true).build()
//=> (trashed = true)
```
#### isStarred(boolean)
Indicates whether the file is starred or not.
```js
qb.isStarred(true).build()
//=> (starred = true)
```
#### isHidden(boolean)
Indicates whether the shared drive is hidden or not.
```js
qb.isHidden(true).build()
//=> (hidden = true)
```
#### not()
Negate the immediately following input (query).
```js
qb.not().getByCollection(Collection.PARENTS, 'parent-id').build()
//=> not ('parent-id' in parents)
qb.not().getByCollection(Collection.PARENTS, ['parent-1', 'parent-2']).build()
//=> not ('parent-1' in parents or 'parent-2' in parents)
```
#### build()
Joins the inputs into a single string with the `and` operator.
```js
qb.getByCollection(Collection.PARENTS, 'parent-id')
qb.getByFileName('something')
qb.build()
//=> ('parent-id' in parents) and (name = 'something')
```
## Copyright & License
© 2023 - [Brian Fernandez](https://github.com/br14n-sol)
This project is licensed under the MIT license. See the file [LICENSE](LICENSE) for details.
## Disclaimer
No affiliation with Google Inc.
This package is a third-party offering and is not a product of Google Inc.
Google Drive™ is a trademark of Google Inc.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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