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 2.0.1 to 2.0.2

2

lib/index.js

@@ -1,1 +0,1 @@

var A=(i=>(i.PARENTS="parents",i.OWNERS="owners",i.WRITERS="writers",i.READERS="readers",i))(A||{});var E=(r=>(r.ANYONE_CAN_FIND="anyoneCanFind",r.ANYONE_WITH_LINK="anyoneWithLink",r.DOMAIN_CAN_FIND="domainCanFind",r.DOMAIN_WITH_LINK="domainWithLink",r.LIMITED="limited",r))(E||{}),p=(r=>(r.FOLDER="application/vnd.google-apps.folder",r.DOCUMENT="application/vnd.google-apps.document",r.SPREADSHEET="application/vnd.google-apps.spreadsheet",r.PRESENTATION="application/vnd.google-apps.presentation",r.FORM="application/vnd.google-apps.form",r))(p||{});var u={0:({field:n,op:t,entry:e})=>`'${e.value}' ${t} ${n}`,1:({field:n,op:t,entry:e})=>`${n} ${t} '${e.value}'`,2:({field:n,op:t,entry:e})=>`${n} ${t} ${e.value}`,3:({field:n,op:t,entry:e})=>`${n} ${t} { key='${e?.key}' and value='${e.value}' }`},o=class{constructor(){this.queries=[];this.negateNextTerm=!1}addQuery(t,e){let{field:y,op:i,entry:r}=e,s="";this.negateNextTerm&&(this.negateNextTerm=!1,s+="not ");let a=[];for(let d in r){let T=r[d];a.push(u[t]({field:y,op:i,entry:{key:`${d}`,value:T}}))}s+=`(${a.join(` ${Array.isArray(r)?"or":"and"} `)})`,this.queries.push(s)}not(){return this.negateNextTerm=!0,this}getByCollection(t,e){return this.addQuery(0,{field:t,op:"in",entry:Array.isArray(e)?e:[e]}),this}getByFileName(t){return this.addQuery(1,{field:"name",op:"=",entry:Array.isArray(t)?t:[t]}),this}getByContent(t){return this.addQuery(1,{field:"fullText",op:"contains",entry:Array.isArray(t)?t:[t]}),this}getByFileType(t){return this.addQuery(1,{field:"mimeType",op:"=",entry:Array.isArray(t)?t:[t]}),this}getByCreatedAt(t){return this.addQuery(1,{field:"createdTime",op:"=",entry:Array.isArray(t)?t:[t]}),this}getByUpdatedAt(t){return this.addQuery(1,{field:"modifiedTime",op:"=",entry:Array.isArray(t)?t:[t]}),this}getByVisibility(t){return this.addQuery(1,{field:"visibility",op:"=",entry:Array.isArray(t)?t:[t]}),this}getByPublicProp(t){return this.addQuery(3,{field:"properties",op:"has",entry:t}),this}getByPrivateProp(t){return this.addQuery(3,{field:"appProperties",op:"has",entry:t}),this}isTrashed(t){return this.addQuery(2,{field:"trashed",op:"=",entry:[`${t}`]}),this}isStarred(t){return this.addQuery(2,{field:"starred",op:"=",entry:[`${t}`]}),this}isHidden(t){return this.addQuery(2,{field:"hidden",op:"=",entry:[`${t}`]}),this}build(){return this.queries.join(" and ")}};var R=o;export{A as Collection,p as FileType,E as VisibilityLevel,R as default};
var Collection=(e=>(e.PARENTS="parents",e.OWNERS="owners",e.WRITERS="writers",e.READERS="readers",e))(Collection||{}),VisibilityLevel=(e=>(e.ANYONE_CAN_FIND="anyoneCanFind",e.ANYONE_WITH_LINK="anyoneWithLink",e.DOMAIN_CAN_FIND="domainCanFind",e.DOMAIN_WITH_LINK="domainWithLink",e.LIMITED="limited",e))(VisibilityLevel||{}),FileType=(e=>(e.FOLDER="application/vnd.google-apps.folder",e.DOCUMENT="application/vnd.google-apps.document",e.SPREADSHEET="application/vnd.google-apps.spreadsheet",e.PRESENTATION="application/vnd.google-apps.presentation",e.FORM="application/vnd.google-apps.form",e))(FileType||{});function _escape(e){return String(e).replace(/'/g,"\\'")}var QueryTemplate={0:({field:e,op:r,entry:t})=>`'${_escape(t.value)}' ${r} ${e}`,1:({field:e,op:r,entry:t})=>`${e} ${r} '${_escape(t.value)}'`,2:({field:e,op:r,entry:t})=>`${e} ${r} ${t.value}`,3:({field:e,op:r,entry:t})=>`${e} ${r} { key='${t?.key}' and value='${_escape(t.value)}' }`},QueryBuilder=class{constructor(){this.queries=[],this.negateNextTerm=!1}addQuery(e,r){const{field:t,op:i,entry:a}=r;let n="";this.negateNextTerm&&(this.negateNextTerm=!1,n+="not ");const s=[];for(const r in a){const n=a[r];s.push(QueryTemplate[e]({field:t,op:i,entry:{key:`${r}`,value:n}}))}n+=`(${s.join(` ${Array.isArray(a)?"or":"and"} `)})`,this.queries.push(n)}not(){return this.negateNextTerm=!0,this}getByCollection(e,r){return this.addQuery(0,{field:e,op:"in",entry:Array.isArray(r)?r:[r]}),this}getByFileName(e){return this.addQuery(1,{field:"name",op:"=",entry:Array.isArray(e)?e:[e]}),this}getByContent(e){return this.addQuery(1,{field:"fullText",op:"contains",entry:Array.isArray(e)?e:[e]}),this}getByFileType(e){return this.addQuery(1,{field:"mimeType",op:"=",entry:Array.isArray(e)?e:[e]}),this}getByCreatedAt(e){return this.addQuery(1,{field:"createdTime",op:"=",entry:Array.isArray(e)?e:[e]}),this}getByUpdatedAt(e){return this.addQuery(1,{field:"modifiedTime",op:"=",entry:Array.isArray(e)?e:[e]}),this}getByVisibility(e){return this.addQuery(1,{field:"visibility",op:"=",entry:Array.isArray(e)?e:[e]}),this}getByPublicProp(e){return this.addQuery(3,{field:"properties",op:"has",entry:e}),this}getByPrivateProp(e){return this.addQuery(3,{field:"appProperties",op:"has",entry:e}),this}isTrashed(e){return this.addQuery(2,{field:"trashed",op:"=",entry:[`${e}`]}),this}isStarred(e){return this.addQuery(2,{field:"starred",op:"=",entry:[`${e}`]}),this}isHidden(e){return this.addQuery(2,{field:"hidden",op:"=",entry:[`${e}`]}),this}build(){return this.queries.join(" and ")}},src_default=QueryBuilder;export{Collection,FileType,VisibilityLevel,src_default as default};

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

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

@@ -29,3 +29,4 @@ "type": "module",

"prebuild": "npm run lint",
"build": "tsup --config tsup.config.json && fix-tsup-cjs --cwd lib"
"build": "tsup --config tsup.config.json",
"postbuild": "node --no-warnings=ExperimentalWarning fix-cjs-output.js"
},

@@ -42,2 +43,3 @@ "lint-staged": {

"lint-staged": "^15.2.0",
"terser": "^5.26.0",
"tsup": "^8.0.1",

@@ -44,0 +46,0 @@ "typescript": "^5.3.3"

@@ -0,0 +0,0 @@ # Query Builder for DriveAPI

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