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

@honkandgo/googleads

Package Overview
Dependencies
Maintainers
2
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@honkandgo/googleads - npm Package Compare versions

Comparing version 4.1.0 to 5.0.0

2

dist/googleads.js

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

var e,t=(e=require("node-fetch"))&&"object"==typeof e&&"default"in e?e.default:e;module.exports=function(e){void 0===e&&(e={});var r=function(e){var r=e.clientId,n=e.clientSecret,o=e.developerToken,s=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)t.indexOf(r=s[n])>=0||(o[r]=e[r]);return o}(e,["clientId","clientSecret","developerToken"]),u=function(e){void 0===e&&(e=3600);var t={},r=function(e){var r=t[e];if(r){var n=Date.now();if(r.inserted+1e3*r.maxAge>n)return r.value;delete t[e]}};return{get:r,set:function(r,n,o){t[r]={value:n,maxAge:o||e,inserted:Date.now()}},has:function(e){return void 0!==r(e)}}}(1800),i=function(e,i,c,a){try{return void 0===a&&(a=s.refreshToken),Promise.resolve(function(e){try{return u.has(e)||u.set(e,function(e){try{return Promise.resolve(t("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:r,client_secret:n,refresh_token:e,grant_type:"refresh_token"})}).then(function(e){return e.json()}).then(function(e){return e.access_token}))}catch(e){return Promise.reject(e)}}(e)),Promise.resolve(u.get(e))}catch(e){return Promise.reject(e)}}(a)).then(function(r){var n="https://googleads.googleapis.com/v6"+(i.startsWith("/")?"":"/")+i;return Promise.resolve(t(n,{method:e,headers:{"Content-Type":"application/json",Authorization:"Bearer "+r,"Developer-Token":o},body:c?JSON.stringify(c):null})).then(function(e){return Promise.resolve(e.json()).then(function(e){if(e.error)throw new Error(JSON.stringify(e.error));return e})})})}catch(e){return Promise.reject(e)}};return{get:function(e,t,r){return i("GET",e,t,r)},post:function(e,t,r){return i("POST",e,t,r)}}}(e),n=r.get,o=r.post;return{suggestGeoTargetConstants:function(e,t){return o("/geoTargetConstants:suggest",e,t)},listAccessibleCustomers:function(e){return n("/customers:listAccessibleCustomers",null,e)},get:n,post:o,search:function(e,t,r){return o("/customers/"+e+"/googleAds:search",t,r)},searchStream:function(e,t,r){return o("/customers/"+e+"/googleAds:searchStream",t,r)},mutate:function(e,t,r){return o("/customers/"+e+"/googleAds:mutate",t,r)},mutateCampaigns:function(e,t,r){return o("/customers/"+e+"/campaigns:mutate",t,r)},mutateCustomAudiences:function(e,t,r){return o("/customers/"+e+"/customAudiences:mutate",t,r)}}};
var e,t=(e=require("node-fetch"))&&"object"==typeof e&&"default"in e?e.default:e;module.exports=function(e){void 0===e&&(e={});var r=function(e){var r=e.clientId,n=e.clientSecret,o=e.developerToken,s=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)t.indexOf(r=s[n])>=0||(o[r]=e[r]);return o}(e,["clientId","clientSecret","developerToken"]),u=function(e){void 0===e&&(e=3600);var t={},r=function(e){var r=t[e];if(r){var n=Date.now();if(r.inserted+1e3*r.maxAge>n)return r.value;delete t[e]}};return{get:r,set:function(r,n,o){t[r]={value:n,maxAge:o||e,inserted:Date.now()}},has:function(e){return void 0!==r(e)}}}(1800),i=function(e,i,c,a){try{return void 0===a&&(a=s.refreshToken),Promise.resolve(function(e){try{return u.has(e)||u.set(e,function(e){try{return Promise.resolve(t("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:r,client_secret:n,refresh_token:e,grant_type:"refresh_token"})}).then(function(e){return e.json()}).then(function(e){return e.access_token}))}catch(e){return Promise.reject(e)}}(e)),Promise.resolve(u.get(e))}catch(e){return Promise.reject(e)}}(a)).then(function(r){var n="https://googleads.googleapis.com/v8"+(i.startsWith("/")?"":"/")+i;return Promise.resolve(t(n,{method:e,headers:{"Content-Type":"application/json",Authorization:"Bearer "+r,"Developer-Token":o},body:c?JSON.stringify(c):null})).then(function(e){return Promise.resolve(e.json()).then(function(e){if(e.error)throw new Error(JSON.stringify(e.error));return e})})})}catch(e){return Promise.reject(e)}};return{get:function(e,t,r){return i("GET",e,t,r)},post:function(e,t,r){return i("POST",e,t,r)}}}(e),n=r.get,o=r.post;return{suggestGeoTargetConstants:function(e,t){return o("/geoTargetConstants:suggest",e,t)},listAccessibleCustomers:function(e){return n("/customers:listAccessibleCustomers",null,e)},get:n,post:o,search:function(e,t,r){return o("/customers/"+e+"/googleAds:search",t,r)},searchStream:function(e,t,r){return o("/customers/"+e+"/googleAds:searchStream",t,r)},mutate:function(e,t,r){return o("/customers/"+e+"/googleAds:mutate",t,r)},mutateCampaigns:function(e,t,r){return o("/customers/"+e+"/campaigns:mutate",t,r)},mutateCustomAudiences:function(e,t,r){return o("/customers/"+e+"/customAudiences:mutate",t,r)}}};
//# sourceMappingURL=googleads.js.map

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

import e from"node-fetch";export default function(t={}){const{get:s,post:o}=(t=>{let{clientId:s,clientSecret:o,developerToken:n}=t,r=function(e,t){if(null==e)return{};var s,o,n={},r=Object.keys(e);for(o=0;o<r.length;o++)t.indexOf(s=r[o])>=0||(n[s]=e[s]);return n}(t,["clientId","clientSecret","developerToken"]);const a=((e=3600)=>{const t={},s=e=>{const s=t[e];if(s){const o=Date.now();if(s.inserted+1e3*s.maxAge>o)return s.value;delete t[e]}};return{get:s,set:(s,o,n)=>{t[s]={value:o,maxAge:n||e,inserted:Date.now()}},has:e=>void 0!==s(e)}})(1800),c=async(t,c,i,u=r.refreshToken)=>{const g=await(async t=>(a.has(t)||a.set(t,(async t=>e("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:s,client_secret:o,refresh_token:t,grant_type:"refresh_token"})}).then(e=>e.json()).then(e=>e.access_token))(t)),a.get(t)))(u),l=`https://googleads.googleapis.com/v6${c.startsWith("/")?"":"/"}${c}`,m=await e(l,{method:t,headers:{"Content-Type":"application/json",Authorization:"Bearer "+g,"Developer-Token":n},body:i?JSON.stringify(i):null}),d=await m.json();if(d.error)throw new Error(JSON.stringify(d.error));return d};return{get:async(e,t,s)=>c("GET",e,t,s),post:async(e,t,s)=>c("POST",e,t,s)}})(t);return{suggestGeoTargetConstants:(e,t)=>o("/geoTargetConstants:suggest",e,t),listAccessibleCustomers:e=>s("/customers:listAccessibleCustomers",null,e),get:s,post:o,search:(e,t,s)=>o(`/customers/${e}/googleAds:search`,t,s),searchStream:(e,t,s)=>o(`/customers/${e}/googleAds:searchStream`,t,s),mutate:(e,t,s)=>o(`/customers/${e}/googleAds:mutate`,t,s),mutateCampaigns:(e,t,s)=>o(`/customers/${e}/campaigns:mutate`,t,s),mutateCustomAudiences:(e,t,s)=>o(`/customers/${e}/customAudiences:mutate`,t,s)}}
import e from"node-fetch";export default function(t={}){const{get:s,post:o}=(t=>{let{clientId:s,clientSecret:o,developerToken:n}=t,r=function(e,t){if(null==e)return{};var s,o,n={},r=Object.keys(e);for(o=0;o<r.length;o++)t.indexOf(s=r[o])>=0||(n[s]=e[s]);return n}(t,["clientId","clientSecret","developerToken"]);const a=((e=3600)=>{const t={},s=e=>{const s=t[e];if(s){const o=Date.now();if(s.inserted+1e3*s.maxAge>o)return s.value;delete t[e]}};return{get:s,set:(s,o,n)=>{t[s]={value:o,maxAge:n||e,inserted:Date.now()}},has:e=>void 0!==s(e)}})(1800),c=async(t,c,i,u=r.refreshToken)=>{const g=await(async t=>(a.has(t)||a.set(t,(async t=>e("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:s,client_secret:o,refresh_token:t,grant_type:"refresh_token"})}).then(e=>e.json()).then(e=>e.access_token))(t)),a.get(t)))(u),l=`https://googleads.googleapis.com/v8${c.startsWith("/")?"":"/"}${c}`,m=await e(l,{method:t,headers:{"Content-Type":"application/json",Authorization:"Bearer "+g,"Developer-Token":n},body:i?JSON.stringify(i):null}),d=await m.json();if(d.error)throw new Error(JSON.stringify(d.error));return d};return{get:async(e,t,s)=>c("GET",e,t,s),post:async(e,t,s)=>c("POST",e,t,s)}})(t);return{suggestGeoTargetConstants:(e,t)=>o("/geoTargetConstants:suggest",e,t),listAccessibleCustomers:e=>s("/customers:listAccessibleCustomers",null,e),get:s,post:o,search:(e,t,s)=>o(`/customers/${e}/googleAds:search`,t,s),searchStream:(e,t,s)=>o(`/customers/${e}/googleAds:searchStream`,t,s),mutate:(e,t,s)=>o(`/customers/${e}/googleAds:mutate`,t,s),mutateCampaigns:(e,t,s)=>o(`/customers/${e}/campaigns:mutate`,t,s),mutateCustomAudiences:(e,t,s)=>o(`/customers/${e}/customAudiences:mutate`,t,s)}}
//# sourceMappingURL=googleads.modern.js.map

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

import e from"node-fetch";export default function(t){void 0===t&&(t={});var r=function(t){var r=t.clientId,n=t.clientSecret,o=t.developerToken,s=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)t.indexOf(r=s[n])>=0||(o[r]=e[r]);return o}(t,["clientId","clientSecret","developerToken"]),u=function(e){void 0===e&&(e=3600);var t={},r=function(e){var r=t[e];if(r){var n=Date.now();if(r.inserted+1e3*r.maxAge>n)return r.value;delete t[e]}};return{get:r,set:function(r,n,o){t[r]={value:n,maxAge:o||e,inserted:Date.now()}},has:function(e){return void 0!==r(e)}}}(1800),i=function(t,i,c,a){try{return void 0===a&&(a=s.refreshToken),Promise.resolve(function(t){try{return u.has(t)||u.set(t,function(t){try{return Promise.resolve(e("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:r,client_secret:n,refresh_token:t,grant_type:"refresh_token"})}).then(function(e){return e.json()}).then(function(e){return e.access_token}))}catch(e){return Promise.reject(e)}}(t)),Promise.resolve(u.get(t))}catch(e){return Promise.reject(e)}}(a)).then(function(r){var n="https://googleads.googleapis.com/v6"+(i.startsWith("/")?"":"/")+i;return Promise.resolve(e(n,{method:t,headers:{"Content-Type":"application/json",Authorization:"Bearer "+r,"Developer-Token":o},body:c?JSON.stringify(c):null})).then(function(e){return Promise.resolve(e.json()).then(function(e){if(e.error)throw new Error(JSON.stringify(e.error));return e})})})}catch(e){return Promise.reject(e)}};return{get:function(e,t,r){return i("GET",e,t,r)},post:function(e,t,r){return i("POST",e,t,r)}}}(t),n=r.get,o=r.post;return{suggestGeoTargetConstants:function(e,t){return o("/geoTargetConstants:suggest",e,t)},listAccessibleCustomers:function(e){return n("/customers:listAccessibleCustomers",null,e)},get:n,post:o,search:function(e,t,r){return o("/customers/"+e+"/googleAds:search",t,r)},searchStream:function(e,t,r){return o("/customers/"+e+"/googleAds:searchStream",t,r)},mutate:function(e,t,r){return o("/customers/"+e+"/googleAds:mutate",t,r)},mutateCampaigns:function(e,t,r){return o("/customers/"+e+"/campaigns:mutate",t,r)},mutateCustomAudiences:function(e,t,r){return o("/customers/"+e+"/customAudiences:mutate",t,r)}}}
import e from"node-fetch";export default function(t){void 0===t&&(t={});var r=function(t){var r=t.clientId,n=t.clientSecret,o=t.developerToken,s=function(e,t){if(null==e)return{};var r,n,o={},s=Object.keys(e);for(n=0;n<s.length;n++)t.indexOf(r=s[n])>=0||(o[r]=e[r]);return o}(t,["clientId","clientSecret","developerToken"]),u=function(e){void 0===e&&(e=3600);var t={},r=function(e){var r=t[e];if(r){var n=Date.now();if(r.inserted+1e3*r.maxAge>n)return r.value;delete t[e]}};return{get:r,set:function(r,n,o){t[r]={value:n,maxAge:o||e,inserted:Date.now()}},has:function(e){return void 0!==r(e)}}}(1800),i=function(t,i,c,a){try{return void 0===a&&(a=s.refreshToken),Promise.resolve(function(t){try{return u.has(t)||u.set(t,function(t){try{return Promise.resolve(e("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:r,client_secret:n,refresh_token:t,grant_type:"refresh_token"})}).then(function(e){return e.json()}).then(function(e){return e.access_token}))}catch(e){return Promise.reject(e)}}(t)),Promise.resolve(u.get(t))}catch(e){return Promise.reject(e)}}(a)).then(function(r){var n="https://googleads.googleapis.com/v8"+(i.startsWith("/")?"":"/")+i;return Promise.resolve(e(n,{method:t,headers:{"Content-Type":"application/json",Authorization:"Bearer "+r,"Developer-Token":o},body:c?JSON.stringify(c):null})).then(function(e){return Promise.resolve(e.json()).then(function(e){if(e.error)throw new Error(JSON.stringify(e.error));return e})})})}catch(e){return Promise.reject(e)}};return{get:function(e,t,r){return i("GET",e,t,r)},post:function(e,t,r){return i("POST",e,t,r)}}}(t),n=r.get,o=r.post;return{suggestGeoTargetConstants:function(e,t){return o("/geoTargetConstants:suggest",e,t)},listAccessibleCustomers:function(e){return n("/customers:listAccessibleCustomers",null,e)},get:n,post:o,search:function(e,t,r){return o("/customers/"+e+"/googleAds:search",t,r)},searchStream:function(e,t,r){return o("/customers/"+e+"/googleAds:searchStream",t,r)},mutate:function(e,t,r){return o("/customers/"+e+"/googleAds:mutate",t,r)},mutateCampaigns:function(e,t,r){return o("/customers/"+e+"/campaigns:mutate",t,r)},mutateCustomAudiences:function(e,t,r){return o("/customers/"+e+"/customAudiences:mutate",t,r)}}}
//# sourceMappingURL=googleads.module.js.map

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("node-fetch")):"function"==typeof define&&define.amd?define(["node-fetch"],t):(e=e||self).googleads=t(e.nodeFetch)}(this,function(e){return e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e,function(t){void 0===t&&(t={});var n=function(t){var n=t.clientId,r=t.clientSecret,o=t.developerToken,s=function(e,t){if(null==e)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)t.indexOf(n=s[r])>=0||(o[n]=e[n]);return o}(t,["clientId","clientSecret","developerToken"]),u=function(e){void 0===e&&(e=3600);var t={},n=function(e){var n=t[e];if(n){var r=Date.now();if(n.inserted+1e3*n.maxAge>r)return n.value;delete t[e]}};return{get:n,set:function(n,r,o){t[n]={value:r,maxAge:o||e,inserted:Date.now()}},has:function(e){return void 0!==n(e)}}}(1800),i=function(t,i,c,a){try{return void 0===a&&(a=s.refreshToken),Promise.resolve(function(t){try{return u.has(t)||u.set(t,function(t){try{return Promise.resolve(e("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:n,client_secret:r,refresh_token:t,grant_type:"refresh_token"})}).then(function(e){return e.json()}).then(function(e){return e.access_token}))}catch(e){return Promise.reject(e)}}(t)),Promise.resolve(u.get(t))}catch(e){return Promise.reject(e)}}(a)).then(function(n){var r="https://googleads.googleapis.com/v6"+(i.startsWith("/")?"":"/")+i;return Promise.resolve(e(r,{method:t,headers:{"Content-Type":"application/json",Authorization:"Bearer "+n,"Developer-Token":o},body:c?JSON.stringify(c):null})).then(function(e){return Promise.resolve(e.json()).then(function(e){if(e.error)throw new Error(JSON.stringify(e.error));return e})})})}catch(e){return Promise.reject(e)}};return{get:function(e,t,n){return i("GET",e,t,n)},post:function(e,t,n){return i("POST",e,t,n)}}}(t),r=n.get,o=n.post;return{suggestGeoTargetConstants:function(e,t){return o("/geoTargetConstants:suggest",e,t)},listAccessibleCustomers:function(e){return r("/customers:listAccessibleCustomers",null,e)},get:r,post:o,search:function(e,t,n){return o("/customers/"+e+"/googleAds:search",t,n)},searchStream:function(e,t,n){return o("/customers/"+e+"/googleAds:searchStream",t,n)},mutate:function(e,t,n){return o("/customers/"+e+"/googleAds:mutate",t,n)},mutateCampaigns:function(e,t,n){return o("/customers/"+e+"/campaigns:mutate",t,n)},mutateCustomAudiences:function(e,t,n){return o("/customers/"+e+"/customAudiences:mutate",t,n)}}}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("node-fetch")):"function"==typeof define&&define.amd?define(["node-fetch"],t):(e=e||self).googleads=t(e.nodeFetch)}(this,function(e){return e=e&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e,function(t){void 0===t&&(t={});var n=function(t){var n=t.clientId,r=t.clientSecret,o=t.developerToken,s=function(e,t){if(null==e)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)t.indexOf(n=s[r])>=0||(o[n]=e[n]);return o}(t,["clientId","clientSecret","developerToken"]),u=function(e){void 0===e&&(e=3600);var t={},n=function(e){var n=t[e];if(n){var r=Date.now();if(n.inserted+1e3*n.maxAge>r)return n.value;delete t[e]}};return{get:n,set:function(n,r,o){t[n]={value:r,maxAge:o||e,inserted:Date.now()}},has:function(e){return void 0!==n(e)}}}(1800),i=function(t,i,c,a){try{return void 0===a&&(a=s.refreshToken),Promise.resolve(function(t){try{return u.has(t)||u.set(t,function(t){try{return Promise.resolve(e("https://www.googleapis.com/oauth2/v4/token",{method:"POST",body:JSON.stringify({client_id:n,client_secret:r,refresh_token:t,grant_type:"refresh_token"})}).then(function(e){return e.json()}).then(function(e){return e.access_token}))}catch(e){return Promise.reject(e)}}(t)),Promise.resolve(u.get(t))}catch(e){return Promise.reject(e)}}(a)).then(function(n){var r="https://googleads.googleapis.com/v8"+(i.startsWith("/")?"":"/")+i;return Promise.resolve(e(r,{method:t,headers:{"Content-Type":"application/json",Authorization:"Bearer "+n,"Developer-Token":o},body:c?JSON.stringify(c):null})).then(function(e){return Promise.resolve(e.json()).then(function(e){if(e.error)throw new Error(JSON.stringify(e.error));return e})})})}catch(e){return Promise.reject(e)}};return{get:function(e,t,n){return i("GET",e,t,n)},post:function(e,t,n){return i("POST",e,t,n)}}}(t),r=n.get,o=n.post;return{suggestGeoTargetConstants:function(e,t){return o("/geoTargetConstants:suggest",e,t)},listAccessibleCustomers:function(e){return r("/customers:listAccessibleCustomers",null,e)},get:r,post:o,search:function(e,t,n){return o("/customers/"+e+"/googleAds:search",t,n)},searchStream:function(e,t,n){return o("/customers/"+e+"/googleAds:searchStream",t,n)},mutate:function(e,t,n){return o("/customers/"+e+"/googleAds:mutate",t,n)},mutateCampaigns:function(e,t,n){return o("/customers/"+e+"/campaigns:mutate",t,n)},mutateCustomAudiences:function(e,t,n){return o("/customers/"+e+"/customAudiences:mutate",t,n)}}}});
//# sourceMappingURL=googleads.umd.js.map
{
"name": "@honkandgo/googleads",
"version": "4.1.0",
"version": "5.0.0",
"license": "MIT",

@@ -5,0 +5,0 @@ "publishConfig": {

@@ -29,3 +29,3 @@ import fetch from 'node-fetch'

const accessToken = await getCachedAccessToken(refreshToken)
const url = `https://googleads.googleapis.com/v6${
const url = `https://googleads.googleapis.com/v8${
endpoint.startsWith('/') ? '' : '/'

@@ -32,0 +32,0 @@ }${endpoint}`

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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