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

suyamiko-api

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

suyamiko-api - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

11

index.js
const rootdir = require('easypathutil')(__dirname);
const Client = rootdir.src.struct.client.Client.$require;
const Client = rootdir.src.struct.client.Client.$require_default;
function SuyamikoApiClient(auth) {
if (!(this instanceof SuyamikoApiClient)) return new SuyamikoApiClient(auth);
return new Client(rootdir, auth);
return new Proxy(new Client(rootdir, auth), {
has: () => true,
get: (o, p) => {
if (p in o) return o[p];
if (typeof p !== 'string') return undefined;
return Client._endpoints[p].run.bind(o);
},
});
}
module.exports = SuyamikoApiClient.SuyamikoApiClient = SuyamikoApiClient.default = SuyamikoApiClient;

4

package.json
{
"name": "suyamiko-api",
"version": "1.0.1",
"version": "1.0.2",
"description": "A suyamiko/suya.moe api client",

@@ -25,4 +25,4 @@ "main": "index.js",

"dependencies": {
"easypathutil": "^1.0.2"
"easypathutil": "^1.2.4"
}
}
exports.default_options = {
hostname: 'api.suya.moe',
port: 443,
hostname: process.env.SUYAMIKOAPI_BETA ? 'api.localhost' : 'api.suya.moe',
port: process.env.SUYAMIKOAPI_BETA ? 2087 : 443,
headers: { 'Cache-Control': 'no-cache' },
rejectUnauthorized: !process.env.SUYAMIKOAPI_BETA,
};
exports.base_url = 'https://api.suya.moe';
exports.base_url = process.env.SUYAMIKOAPI_BETA ? 'https://api.localhost:2087' : 'https://api.suya.moe';
exports.NetConstants = require('./constants/NetConstants');
let __warned__ = false;
const { default: EndpointFactory } = require('./endpoints/default_endpoin.t');
const endpoints = ['neko', 'awoo', 'bang', 'bite', 'blush', 'cat', 'cry', 'cuddle', 'dance', 'hug', 'kiss', 'lewd', 'lick', 'lizard',
'neko', 'nom', 'nuzzle', 'pat', 'poke', 'pout', 'shrug', 'slap', 'sleepy', 'tickle'];
const endpoints = ['neko', 'awoo', 'bang', 'bird', 'bite', 'blush', 'cat', 'cry', 'cuddle', 'dance', 'hug', 'kiss', 'lewd', 'lick',
'lizard', 'neko', 'nom', 'nuzzle', 'pat', 'poke', 'pout', 'shrug', 'slap', 'sleepy', 'tickle'];
exports.endpoints = {};
const _endpoints = {};
for (const endpoint of endpoints) {

@@ -12,6 +12,20 @@ try {

if (typeof exported.run !== 'function') throw new Error(`Endpoint file ${endpoint} has no run function.`);
exports.endpoints[endpoint] = exported;
_endpoints[endpoint] = exported;
} catch (err) {
exports.endpoints[endpoint] = { name: endpoint, run: EndpointFactory(endpoint) };
_endpoints[endpoint] = { name: endpoint, run: EndpointFactory(endpoint) };
}
}
exports.endpoints = new Proxy(_endpoints, {
has: () => !0,
get: (o, p) => {
if (p in _endpoints) return _endpoints[p];
if (typeof p !== 'string') return undefined;
if (!__warned__) {
__warned__ = true;
process.emitWarning(`You tried to access the [${p}] endpoint, which may or may not exist.
Please note, no support will be given for any issues and you use this experimental endpoint at your own risk!`);
}
return { name: p, run: EndpointFactory(p) };
},
});

@@ -7,8 +7,10 @@ 'use strict';

const authstore = new WeakMap;
let _endpoints = null;
const Client = class Client {
constructor(rootdir, auth) {
constructor(rootdir, auth = '') {
if (!_endpoints) _endpoints = rootdir.src.deps.$require.endpoints;
authstore.set(this, auth);
this.requester = new Requester(rootdir, auth);
for (const { name, run } of Object.values(rootdir.src.deps.$require.endpoints)) {
for (const { name, run } of Object.values(_endpoints)) {
this[name] = run.bind(this);

@@ -21,4 +23,7 @@ }

}
static get _endpoints() {
return _endpoints;
}
};
exports.default = Client;

@@ -5,2 +5,3 @@ 'use strict';

const https = require('https');
const qs = require('querystring');

@@ -22,2 +23,6 @@ const option_store = new WeakMap;

get query() {
return qs.stringify;
}
buffer(path, headers = {}) {

@@ -40,2 +45,3 @@ const options = Object.assign({}, option_store.get(this));

let message = buf.toString('utf-8');
if (process.env.SUYAMIKOAPI_DEBUG) console.log(message); // eslint-disable-line no-console
try {

@@ -42,0 +48,0 @@ message = JSON.parse(message);

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