Comparing version 0.0.2 to 0.0.3
@@ -0,1 +1,7 @@ | ||
# v0.0.3 (Fri Sep 06 2019) | ||
--- | ||
# v0.0.2 (Wed Sep 04 2019) | ||
@@ -2,0 +8,0 @@ |
@@ -6,2 +6,3 @@ declare class Gravity { | ||
}; | ||
getAccessToken(credentials: Credentials): Promise<AccessTokenResponse>; | ||
get(endpoint: string): Promise<import("node-fetch").Response>; | ||
@@ -11,1 +12,9 @@ url(endpoint: string): string; | ||
export default Gravity; | ||
export interface Credentials { | ||
email: string; | ||
password: string; | ||
} | ||
interface AccessTokenResponse { | ||
access_token: string; | ||
expires_in: string; | ||
} |
@@ -5,5 +5,16 @@ "use strict"; | ||
class Gravity { | ||
async getAccessToken(credentials) { | ||
const gravityUrl = this.url("oauth2/access_token"); | ||
const body = Object.assign({ client_id: process.env.CLIENT_ID, client_secret: process.env.CLIENT_SECRET, grant_type: "credentials" }, credentials); | ||
const response = await node_fetch_1.default(gravityUrl, { | ||
method: "post", | ||
body: JSON.stringify(body), | ||
headers: { "Content-Type": "application/json" }, | ||
}); | ||
const json = await response.json(); | ||
return json; | ||
} | ||
async get(endpoint) { | ||
const token = process.env.TOKEN; // temp until our auth/token plumbing is hooked up | ||
const gravityUrl = this.url(endpoint); | ||
const gravityUrl = this.url(`api/v1/${endpoint}`); | ||
const headers = { "X-Access-Token": token }; | ||
@@ -15,3 +26,3 @@ const response = await node_fetch_1.default(gravityUrl, { headers }); | ||
const host = Gravity.HOSTS.staging; | ||
return `https://${host}/api/v1/${endpoint}`; | ||
return `https://${host}/${endpoint}`; | ||
} | ||
@@ -18,0 +29,0 @@ } |
@@ -1,1 +0,1 @@ | ||
{"version":"0.0.2","commands":{"hello":{"id":"hello","description":"describe the command here","pluginName":"artsy-cli","pluginType":"core","aliases":[],"examples":["$ artsy hello\nhello world from ./src/hello.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"name":{"name":"name","type":"option","char":"n","description":"name to print"},"force":{"name":"force","type":"boolean","char":"f","allowNo":false}},"args":[{"name":"file"}]}}} | ||
{"version":"0.0.3","commands":{"hello":{"id":"hello","description":"describe the command here","pluginName":"artsy-cli","pluginType":"core","aliases":[],"examples":["$ artsy hello\nhello world from ./src/hello.ts!\n"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"name":{"name":"name","type":"option","char":"n","description":"name to print"},"force":{"name":"force","type":"boolean","char":"f","allowNo":false}},"args":[{"name":"file"}]},"login":{"id":"login","description":"Log into the Artsy API. This is a prerequisite for many other commands.","pluginName":"artsy-cli","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]}}} |
{ | ||
"name": "artsy-cli", | ||
"description": "The artsy command line tool", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"author": "Jon Allured @jonallured", | ||
@@ -15,2 +15,4 @@ "bin": { | ||
"@types/node-fetch": "^2.5.0", | ||
"cli-ux": "^5.3.1", | ||
"dotenv": "^8.0.0", | ||
"node-fetch": "^2.6.0", | ||
@@ -17,0 +19,0 @@ "tslib": "^1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8336
14
128
8
4
+ Addedcli-ux@^5.3.1
+ Addeddotenv@^8.0.0
+ Added@oclif/screen@1.0.4(transitive)
+ Addedansi-escapes@4.3.2(transitive)
+ Addedansicolors@0.3.2(transitive)
+ Addedargparse@1.0.10(transitive)
+ Addedcardinal@2.1.1(transitive)
+ Addedcli-progress@3.12.0(transitive)
+ Addedcli-ux@5.6.7(transitive)
+ Addedcross-spawn@7.0.6(transitive)
+ Addeddotenv@8.6.0(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedextract-stack@2.0.0(transitive)
+ Addedhyperlinker@1.0.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedjs-yaml@3.14.1(transitive)
+ Addednatural-orderby@2.0.3(transitive)
+ Addedobject-treeify@1.1.33(transitive)
+ Addedpassword-prompt@1.1.3(transitive)
+ Addedpath-key@3.1.1(transitive)
+ Addedredeyed@2.1.1(transitive)
+ Addedshebang-command@2.0.0(transitive)
+ Addedshebang-regex@3.0.0(transitive)
+ Addedsprintf-js@1.0.3(transitive)
+ Addedsupports-color@8.1.1(transitive)
+ Addedsupports-hyperlinks@2.3.0(transitive)
+ Addedtype-fest@0.21.3(transitive)
+ Addedwhich@2.0.2(transitive)