@sonoransoftware/sonoran.js 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm-publish.yml +34 -0
- package/dist/builders/cad/DispatchCall.d.ts +92 -0
- package/dist/builders/cad/DispatchCall.js +144 -0
- package/dist/builders/cad/index.d.ts +1 -0
- package/dist/builders/cad/index.js +17 -0
- package/dist/builders/index.d.ts +1 -0
- package/dist/builders/index.js +19 -0
- package/dist/constants.d.ts +156 -0
- package/dist/constants.js +27 -0
- package/dist/errors/LibraryErrors.d.ts +19 -0
- package/dist/errors/LibraryErrors.js +47 -0
- package/dist/errors/Messages.d.ts +1 -0
- package/dist/errors/Messages.js +8 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.js +18 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +24 -0
- package/dist/instance/Instance.d.ts +23 -0
- package/dist/instance/Instance.js +134 -0
- package/dist/instance/instance.types.d.ts +16 -0
- package/dist/instance/instance.types.js +2 -0
- package/dist/libs/rest/src/index.d.ts +6 -0
- package/dist/libs/rest/src/index.js +22 -0
- package/dist/libs/rest/src/lib/REST.d.ts +99 -0
- package/dist/libs/rest/src/lib/REST.js +97 -0
- package/dist/libs/rest/src/lib/RequestManager.d.ts +58 -0
- package/dist/libs/rest/src/lib/RequestManager.js +201 -0
- package/dist/libs/rest/src/lib/errors/APIError.d.ts +9 -0
- package/dist/libs/rest/src/lib/errors/APIError.js +17 -0
- package/dist/libs/rest/src/lib/errors/HTTPError.d.ts +17 -0
- package/dist/libs/rest/src/lib/errors/HTTPError.js +23 -0
- package/dist/libs/rest/src/lib/errors/RateLimitError.d.ts +13 -0
- package/dist/libs/rest/src/lib/errors/RateLimitError.js +19 -0
- package/dist/libs/rest/src/lib/errors/index.d.ts +4 -0
- package/dist/libs/rest/src/lib/errors/index.js +20 -0
- package/dist/libs/rest/src/lib/handlers/IHandler.d.ts +7 -0
- package/dist/libs/rest/src/lib/handlers/IHandler.js +2 -0
- package/dist/libs/rest/src/lib/handlers/SequentialHandler.d.ts +45 -0
- package/dist/libs/rest/src/lib/handlers/SequentialHandler.js +155 -0
- package/dist/libs/rest/src/lib/utils/Utils.d.ts +1 -0
- package/dist/libs/rest/src/lib/utils/Utils.js +22 -0
- package/dist/libs/rest/src/lib/utils/constants.d.ts +493 -0
- package/dist/libs/rest/src/lib/utils/constants.js +408 -0
- package/dist/managers/BaseManager.d.ts +14 -0
- package/dist/managers/BaseManager.js +18 -0
- package/dist/managers/CADActiveUnitsManager.d.ts +15 -0
- package/dist/managers/CADActiveUnitsManager.js +49 -0
- package/dist/managers/CADManager.d.ts +27 -0
- package/dist/managers/CADManager.js +93 -0
- package/dist/managers/CADServerManager.d.ts +8 -0
- package/dist/managers/CADServerManager.js +37 -0
- package/dist/managers/CMSManager.d.ts +62 -0
- package/dist/managers/CMSManager.js +181 -0
- package/dist/managers/CMSServerManager.d.ts +8 -0
- package/dist/managers/CMSServerManager.js +37 -0
- package/dist/managers/CacheManager.d.ts +10 -0
- package/dist/managers/CacheManager.js +39 -0
- package/dist/managers/DataManager.d.ts +31 -0
- package/dist/managers/DataManager.js +61 -0
- package/dist/structures/Base.d.ts +9 -0
- package/dist/structures/Base.js +24 -0
- package/dist/structures/CADActiveUnit.d.ts +47 -0
- package/dist/structures/CADActiveUnit.js +66 -0
- package/dist/structures/CADServer.d.ts +26 -0
- package/dist/structures/CADServer.js +15 -0
- package/dist/structures/CMSServer.d.ts +18 -0
- package/dist/structures/CMSServer.js +12 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +17 -0
- package/dist/utils/utils.d.ts +13 -0
- package/dist/utils/utils.js +82 -0
- package/package.json +8 -4
- package/tsconfig.json +3 -3
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./utils"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function mergeDefault(def: any, given: any): any;
|
|
2
|
+
/**
|
|
3
|
+
* Shallow-copies an object with its class/prototype intact.
|
|
4
|
+
* @param {Object} obj Object to clone
|
|
5
|
+
* @returns {Object}
|
|
6
|
+
* @private
|
|
7
|
+
*/
|
|
8
|
+
export declare function cloneObject(obj: any): any;
|
|
9
|
+
export declare function flatten(obj: any, ...props: any[]): any;
|
|
10
|
+
export declare function warnLog(message: string): void;
|
|
11
|
+
export declare function infoLog(message: string): void;
|
|
12
|
+
export declare function errorLog(message: string): void;
|
|
13
|
+
export declare function debugLog(message: string): void;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.debugLog = exports.errorLog = exports.infoLog = exports.warnLog = exports.flatten = exports.cloneObject = exports.mergeDefault = void 0;
|
|
7
|
+
const collection_1 = __importDefault(require("@discordjs/collection"));
|
|
8
|
+
const isObject = (d) => typeof d === 'object' && d !== null;
|
|
9
|
+
function mergeDefault(def, given) {
|
|
10
|
+
if (!given)
|
|
11
|
+
return def;
|
|
12
|
+
for (const key in def) {
|
|
13
|
+
if (!Object.prototype.hasOwnProperty.call(given, key) || given[key] === undefined) {
|
|
14
|
+
given[key] = def[key];
|
|
15
|
+
}
|
|
16
|
+
else if (given[key] === Object(given[key])) {
|
|
17
|
+
given[key] = mergeDefault(def[key], given[key]);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return given;
|
|
21
|
+
}
|
|
22
|
+
exports.mergeDefault = mergeDefault;
|
|
23
|
+
/**
|
|
24
|
+
* Shallow-copies an object with its class/prototype intact.
|
|
25
|
+
* @param {Object} obj Object to clone
|
|
26
|
+
* @returns {Object}
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
function cloneObject(obj) {
|
|
30
|
+
return Object.assign(Object.create(obj), obj);
|
|
31
|
+
}
|
|
32
|
+
exports.cloneObject = cloneObject;
|
|
33
|
+
function flatten(obj, ...props) {
|
|
34
|
+
if (!isObject(obj))
|
|
35
|
+
return obj;
|
|
36
|
+
const objProps = Object.keys(obj)
|
|
37
|
+
.filter((k) => !k.startsWith('_'))
|
|
38
|
+
.map((k) => ({ [k]: true }));
|
|
39
|
+
props = objProps.length ? Object.assign([...objProps], ...props) : Object.assign({}, ...props); // eslint-disable-line
|
|
40
|
+
const out = {};
|
|
41
|
+
for (let [prop, newProp] of Object.entries(props)) {
|
|
42
|
+
if (!newProp)
|
|
43
|
+
continue;
|
|
44
|
+
newProp = newProp === true ? prop : newProp;
|
|
45
|
+
const element = obj[prop];
|
|
46
|
+
const elemIsObj = isObject(element);
|
|
47
|
+
const valueOf = elemIsObj && typeof element.valueOf === 'function' ? element.valueOf() : null;
|
|
48
|
+
// If it's a Collection, make the array of keys
|
|
49
|
+
if (element instanceof collection_1.default)
|
|
50
|
+
out[newProp] = Array.from(element.keys());
|
|
51
|
+
// If the valueOf is a Collection, use its array of keys
|
|
52
|
+
else if (valueOf instanceof collection_1.default)
|
|
53
|
+
out[newProp] = Array.from(valueOf.keys());
|
|
54
|
+
// If it's an array, flatten each element
|
|
55
|
+
else if (Array.isArray(element))
|
|
56
|
+
out[newProp] = element.map(e => flatten(e));
|
|
57
|
+
// If it's an object with a primitive `valueOf`, use that value
|
|
58
|
+
else if (typeof valueOf !== 'object')
|
|
59
|
+
out[newProp] = valueOf;
|
|
60
|
+
// If it's a primitive
|
|
61
|
+
else if (!elemIsObj)
|
|
62
|
+
out[newProp] = element;
|
|
63
|
+
}
|
|
64
|
+
return out;
|
|
65
|
+
}
|
|
66
|
+
exports.flatten = flatten;
|
|
67
|
+
function warnLog(message) {
|
|
68
|
+
return console.log(`[Sonoran.js - DEBUG] ${message}`);
|
|
69
|
+
}
|
|
70
|
+
exports.warnLog = warnLog;
|
|
71
|
+
function infoLog(message) {
|
|
72
|
+
return console.log(`[Sonoran.js - INFO] ${message}`);
|
|
73
|
+
}
|
|
74
|
+
exports.infoLog = infoLog;
|
|
75
|
+
function errorLog(message) {
|
|
76
|
+
return console.log(`[Sonoran.js - ERROR] ${message}`);
|
|
77
|
+
}
|
|
78
|
+
exports.errorLog = errorLog;
|
|
79
|
+
function debugLog(message) {
|
|
80
|
+
return console.log(`[Sonoran.js - DEBUG] ${message}`);
|
|
81
|
+
}
|
|
82
|
+
exports.debugLog = debugLog;
|
package/package.json
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonoransoftware/sonoran.js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Sonoran.js is a library that allows you to interact with the Sonoran CAD and Sonoran CMS API. Based off of and utilizes several Discord.js library techniques for ease of use.",
|
|
5
|
-
"main": "index.js",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
-
"start": "ts-node src/index.ts"
|
|
9
|
+
"start": "ts-node src/index.ts",
|
|
10
|
+
"build": "rimraf ./dist && tsc"
|
|
9
11
|
},
|
|
10
12
|
"repository": {
|
|
11
13
|
"type": "git",
|
|
@@ -22,6 +24,7 @@
|
|
|
22
24
|
"eslint-plugin-import": "^2.25.4",
|
|
23
25
|
"eslint-plugin-prettier": "^4.0.0",
|
|
24
26
|
"prettier": "^2.5.1",
|
|
27
|
+
"rimraf": "^3.0.2",
|
|
25
28
|
"ts-loader": "^9.2.7",
|
|
26
29
|
"ts-node": "^10.7.0",
|
|
27
30
|
"tslint": "^6.1.3",
|
|
@@ -38,5 +41,6 @@
|
|
|
38
41
|
"@sapphire/async-queue": "^1.3.0",
|
|
39
42
|
"@sapphire/snowflake": "^3.2.0",
|
|
40
43
|
"node-fetch": "^2.6.5"
|
|
41
|
-
}
|
|
44
|
+
},
|
|
45
|
+
"prepublish": "npm run build"
|
|
42
46
|
}
|
package/tsconfig.json
CHANGED
|
@@ -5,16 +5,16 @@
|
|
|
5
5
|
/* Basic Options */
|
|
6
6
|
// "incremental": true, /* Enable incremental compilation */
|
|
7
7
|
"target": "ES2015" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */,
|
|
8
|
-
|
|
8
|
+
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
|
|
9
9
|
// "lib": [], /* Specify library files to be included in the compilation. */
|
|
10
10
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|
|
11
11
|
// "checkJs": true, /* Report errors in .js files. */
|
|
12
12
|
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
|
13
|
-
|
|
13
|
+
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
14
14
|
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
15
15
|
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
|
16
16
|
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
17
|
-
|
|
17
|
+
"outDir": "./dist", /* Redirect output structure to the directory. */
|
|
18
18
|
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
19
19
|
// "composite": true, /* Enable project compilation */
|
|
20
20
|
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|