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

gist-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gist-wrapper - npm Package Compare versions

Comparing version 0.4.1 to 1.0.0

.github/workflows/linux.yml

31

dist/gist-client.d.ts

@@ -1,33 +0,22 @@

import { AxiosInstance } from 'axios';
import { Config, Data } from './types';
export declare class HTTPError extends Error {
status: number;
statusText: string;
data: Data;
config: Config;
constructor(status: number, statusText: string, data: Data, config: Config);
}
declare class GistClient {
token: string;
server: string;
_axios: AxiosInstance;
userAgentHeader: string;
constructor(token: string, userAgentHeader?: string);
request(config: Config): Promise<import("axios").AxiosResponse<any>>;
get(url: string, config?: {}): Promise<import("axios").AxiosResponse<any>>;
delete(url: string, config?: {}): Promise<import("axios").AxiosResponse<any>>;
post(url: string, data?: Data | undefined, config?: {}): Promise<import("axios").AxiosResponse<any>>;
put(url: string, data?: Data | undefined, config?: {}): Promise<import("axios").AxiosResponse<any>>;
patch(url: string, data?: Data | undefined, config?: {}): Promise<import("axios").AxiosResponse<any>>;
create(data: Data, conf: Config | undefined): Promise<import("axios").AxiosResponse<any>>;
update(gistId: string, data: Data, conf: Config | undefined): Promise<import("axios").AxiosResponse<any>>;
getOne(gistId: string, conf: Config | undefined): Promise<import("axios").AxiosResponse<any>>;
delOne(gistId: string, conf: Config | undefined): Promise<import("axios").AxiosResponse<any>>;
request(config: Config): Promise<import("axios").AxiosResponse<any, any>>;
get(url: string, config?: {}): Promise<import("axios").AxiosResponse<any, any>>;
delete(url: string, config?: {}): Promise<import("axios").AxiosResponse<any, any>>;
post(url: string, data?: Data | undefined, config?: {}): Promise<import("axios").AxiosResponse<any, any>>;
put(url: string, data?: Data | undefined, config?: {}): Promise<import("axios").AxiosResponse<any, any>>;
patch(url: string, data?: Data | undefined, config?: {}): Promise<import("axios").AxiosResponse<any, any>>;
create(data: Data, conf: Config | undefined): Promise<import("axios").AxiosResponse<any, any>>;
update(gistId: string, data: Data, conf: Config | undefined): Promise<import("axios").AxiosResponse<any, any>>;
getOne(gistId: string, conf: Config | undefined): Promise<import("axios").AxiosResponse<any, any>>;
delOne(gistId: string, conf: Config | undefined): Promise<import("axios").AxiosResponse<any, any>>;
_patchHeaders(headers: Data): {
'X-User-Agent': string;
Accept: string;
Authorization: string;
} | {
'X-User-Agent': string;
Accept: string;
Authorization?: undefined;

@@ -34,0 +23,0 @@ };

{
"name": "gist-wrapper",
"version": "0.4.1",
"version": "1.0.0",
"description": "Github gist API wrapper.",
"author": "ZHAO Xudong <zxdong@gmail.com>",
"license": "MIT",
"main": "dist/gist.js",
"module": "src/gist-client.ts",
"types": "dist/gitee",
"main": "dist/gist-client.js",
"module": "dist/gist-client.mjs",
"types": "dist/gist-client.d.ts",
"scripts": {
"test": "./node_modules/.bin/standard && jest",
"lint": "./node_modules/.bin/standard",
"fix": "./node_modules/.bin/standard --fix",
"release": "webpack --progress",
"prepublishOnly": "npm run release"
"test": "TS_NODE_PROJECT=./tsconfig.test.json jest",
"build": "npm run build:commonjs && npm run build:esm && npm run version",
"version": "node bin/version.js",
"build:commonjs": "tsc && npm run append-export",
"append-export": "echo \"\nmodule.exports = GistClient;\" >> dist/gist-client.js",
"rename": "cp esm/gist-client.js dist/gist-client.mjs",
"build:esm": "tsc -p tsconfig.mjs.json && npm run rename",
"prepublishOnly": "npm run build"
},

@@ -21,37 +24,18 @@ "peerDependencies": {

"devDependencies": {
"@babel/core": "7.12.10",
"@babel/preset-env": "7.12.11",
"@babel/preset-typescript": "^7.12.7",
"@babel/register": "7.12.10",
"@tsconfig/recommended": "^1.0.1",
"axios": "*",
"babel-core": "6.26.3",
"babel-eslint": "10.1.0",
"babel-jest": "26.6.3",
"babel-loader": "8.2.2",
"@types/jest": "^29.5.2",
"@types/node": "^20.0.0",
"axios": "0.26.0",
"dotenv-override-true": "6.2.2",
"jest": "26.6.3",
"standard": "16.0.3",
"ts-loader": "^8.0.14",
"ts-standard": "^10.0.0",
"typescript": "^4.1.3",
"webpack": "5.11.1",
"webpack-cli": "4.3.1"
"eslint": "^8.44.0",
"eslint-config-standard": "^17.1.0",
"eslint-config-standard-with-typescript": "^36.0.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"jest": "^29.6.1",
"ts-jest": "^29.1.1",
"typescript": "^5.1.3"
},
"jest": {
"testEnvironment": "node",
"roots": [
"./test"
],
"setupFiles": [
"dotenv-override-true/config"
]
},
"standard": {
"parser": "babel-eslint",
"ignore": [
"*-compiled.js",
"/dist/"
]
},
"directories": {

@@ -58,0 +42,0 @@ "test": "test"

@@ -8,23 +8,5 @@ // based on tyler's work: https://github.com/tylerlong/ringcentral-js-concise

export class HTTPError extends Error {
status: number
statusText: string
data: Data
config: Config
constructor (status: number, statusText: string, data: Data, config: Config) {
super(`status: ${status}
statusText: ${statusText}
data: ${JSON.stringify(data, null, 2)}
config: ${JSON.stringify(config, null, 2)}`)
this.status = status
this.statusText = statusText
this.data = data
this.config = config
}
}
class GistClient {
token: string
server: string
_axios: AxiosInstance
userAgentHeader: string

@@ -38,15 +20,2 @@ constructor (

this.userAgentHeader = userAgentHeader
this._axios = axios.create()
const request = this._axios.request.bind(this._axios)
this._axios.request = (config) => {
try {
return request(config)
} catch (e) {
if (e.response) {
throw new HTTPError(e.response.status, e.response.statusText, e.response.data, e.response.config)
} else {
throw e
}
}
}
}

@@ -58,6 +27,6 @@

: this.server + config.url
return this._axios.request({
return axios({
...config,
url: uri.toString(),
headers: this._patchHeaders(config.headers)
headers: this._patchHeaders(config.headers) as any
})

@@ -106,3 +75,2 @@ }

'X-User-Agent': this.userAgentHeader,
Accept: 'application/vnd.github+json',
...headers

@@ -109,0 +77,0 @@ }

{
"compilerOptions": {
"target": "ES2015",
"target": "ES2020",
"module": "commonjs",

@@ -12,3 +12,2 @@ "outDir": "./dist",

},
"useUnknownInCatchVariables": false,
"include": ["./src/*.ts"],

@@ -15,0 +14,0 @@ "$schema": "https://json.schemastore.org/tsconfig",

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