From f3486cc1d2602e4eb86aa95e3772c31570238dab Mon Sep 17 00:00:00 2001 From: Sasha Moak Date: Wed, 4 Oct 2023 22:45:10 -0700 Subject: [PATCH] fix: ensure axios-curlirize is a regular dependency --- .releaserc | 1 - dist/cjs/core.js | 44 ----- dist/cjs/index.js | 5 - dist/cjs/methods/auth.js | 32 --- dist/cjs/methods/event.js | 33 ---- dist/cjs/methods/test.js | 46 ----- dist/cjs/methods/user.js | 9 - dist/cjs/methods/user/get.js | 25 --- dist/cjs/methods/user/getNextTeamEvent.js | 28 --- dist/cjs/methods/user/getTeamEvents.js | 32 --- dist/cjs/methods/user/getTeamMessages.js | 34 ---- dist/cjs/methods/user/getTeams.js | 29 --- dist/cjs/methods/user/index.js | 17 -- dist/cjs/request/body.js | 24 --- dist/cjs/request/params.js | 22 --- dist/cjs/request/signature.js | 24 --- dist/cjs/request/types.js | 2 - dist/cjs/types.js | 2 - dist/cjs/version.js | 4 - dist/esm/core.d.ts | 13 -- dist/esm/core.js | 37 ---- dist/esm/index.d.ts | 2 - dist/esm/index.js | 1 - dist/esm/methods/auth.d.ts | 16 -- dist/esm/methods/auth.js | 28 --- dist/esm/methods/event.d.ts | 14 -- dist/esm/methods/event.js | 29 --- dist/esm/methods/test.d.ts | 13 -- dist/esm/methods/test.js | 42 ---- dist/esm/methods/user.d.ts | 3 - dist/esm/methods/user.js | 2 - dist/esm/methods/user/get.d.ts | 5 - dist/esm/methods/user/get.js | 21 -- dist/esm/methods/user/getNextTeamEvent.d.ts | 10 - dist/esm/methods/user/getNextTeamEvent.js | 24 --- dist/esm/methods/user/getTeamEvents.d.ts | 12 -- dist/esm/methods/user/getTeamEvents.js | 28 --- dist/esm/methods/user/getTeamMessages.d.ts | 14 -- dist/esm/methods/user/getTeamMessages.js | 30 --- dist/esm/methods/user/getTeams.d.ts | 9 - dist/esm/methods/user/getTeams.js | 25 --- dist/esm/methods/user/index.d.ts | 15 -- dist/esm/methods/user/index.js | 15 -- dist/esm/request/body.d.ts | 2 - dist/esm/request/body.js | 20 -- dist/esm/request/params.d.ts | 9 - dist/esm/request/params.js | 18 -- dist/esm/request/signature.d.ts | 7 - dist/esm/request/signature.js | 17 -- dist/esm/request/types.d.ts | 26 --- dist/esm/request/types.js | 1 - dist/esm/types.d.ts | 207 -------------------- dist/esm/types.js | 1 - dist/esm/version.d.ts | 1 - dist/esm/version.js | 1 - package-lock.json | 9 +- package.json | 2 +- 57 files changed, 5 insertions(+), 1137 deletions(-) delete mode 100644 dist/cjs/core.js delete mode 100644 dist/cjs/index.js delete mode 100644 dist/cjs/methods/auth.js delete mode 100644 dist/cjs/methods/event.js delete mode 100644 dist/cjs/methods/test.js delete mode 100644 dist/cjs/methods/user.js delete mode 100644 dist/cjs/methods/user/get.js delete mode 100644 dist/cjs/methods/user/getNextTeamEvent.js delete mode 100644 dist/cjs/methods/user/getTeamEvents.js delete mode 100644 dist/cjs/methods/user/getTeamMessages.js delete mode 100644 dist/cjs/methods/user/getTeams.js delete mode 100644 dist/cjs/methods/user/index.js delete mode 100644 dist/cjs/request/body.js delete mode 100644 dist/cjs/request/params.js delete mode 100644 dist/cjs/request/signature.js delete mode 100644 dist/cjs/request/types.js delete mode 100644 dist/cjs/types.js delete mode 100644 dist/cjs/version.js delete mode 100644 dist/esm/core.d.ts delete mode 100644 dist/esm/core.js delete mode 100644 dist/esm/index.d.ts delete mode 100644 dist/esm/index.js delete mode 100644 dist/esm/methods/auth.d.ts delete mode 100644 dist/esm/methods/auth.js delete mode 100644 dist/esm/methods/event.d.ts delete mode 100644 dist/esm/methods/event.js delete mode 100644 dist/esm/methods/test.d.ts delete mode 100644 dist/esm/methods/test.js delete mode 100644 dist/esm/methods/user.d.ts delete mode 100644 dist/esm/methods/user.js delete mode 100644 dist/esm/methods/user/get.d.ts delete mode 100644 dist/esm/methods/user/get.js delete mode 100644 dist/esm/methods/user/getNextTeamEvent.d.ts delete mode 100644 dist/esm/methods/user/getNextTeamEvent.js delete mode 100644 dist/esm/methods/user/getTeamEvents.d.ts delete mode 100644 dist/esm/methods/user/getTeamEvents.js delete mode 100644 dist/esm/methods/user/getTeamMessages.d.ts delete mode 100644 dist/esm/methods/user/getTeamMessages.js delete mode 100644 dist/esm/methods/user/getTeams.d.ts delete mode 100644 dist/esm/methods/user/getTeams.js delete mode 100644 dist/esm/methods/user/index.d.ts delete mode 100644 dist/esm/methods/user/index.js delete mode 100644 dist/esm/request/body.d.ts delete mode 100644 dist/esm/request/body.js delete mode 100644 dist/esm/request/params.d.ts delete mode 100644 dist/esm/request/params.js delete mode 100644 dist/esm/request/signature.d.ts delete mode 100644 dist/esm/request/signature.js delete mode 100644 dist/esm/request/types.d.ts delete mode 100644 dist/esm/request/types.js delete mode 100644 dist/esm/types.d.ts delete mode 100644 dist/esm/types.js delete mode 100644 dist/esm/version.d.ts delete mode 100644 dist/esm/version.js diff --git a/.releaserc b/.releaserc index bf2ec4f..2abe069 100644 --- a/.releaserc +++ b/.releaserc @@ -16,7 +16,6 @@ "@semantic-release/git", { "assets": [ - "dist/**/*.{js,d.ts}", "docs", "package.json" ], diff --git a/dist/cjs/core.js b/dist/cjs/core.js deleted file mode 100644 index 32741c9..0000000 --- a/dist/cjs/core.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TeamCowboy = void 0; -const universal_user_agent_1 = require("universal-user-agent"); -const version_1 = require("./version"); -const axios_1 = __importDefault(require("axios")); -const test_1 = require("./methods/test"); -const auth_1 = require("./methods/auth"); -const user_1 = require("./methods/user"); -const axios_curlirize_1 = __importDefault(require("axios-curlirize")); -const qs_1 = __importDefault(require("qs")); -const event_1 = require("./methods/event"); -class TeamCowboy { - constructor(options) { - var _a; - const requestDefaults = { - baseURL: "https://api.teamcowboy.com/v1", - headers: { - "user-agent": (_a = options.userAgent) !== null && _a !== void 0 ? _a : `teamcowboy.js/${version_1.VERSION} ${(0, universal_user_agent_1.getUserAgent)()}`, - "Content-Type": "application/x-www-form-urlencoded", - }, - paramsSerializer: (params) => { - return qs_1.default.stringify(params, { arrayFormat: "brackets" }); - }, - }; - this.client = { - privateApiKey: options.privateApiKey, - publicApiKey: options.publicApiKey, - auth: options.authToken, - axiosInstance: axios_1.default.create(requestDefaults), - }; - if (options.verbose) { - (0, axios_curlirize_1.default)(this.client.axiosInstance); - } - this.Test = Object.assign({}, (0, test_1.testMethods)(this.client)); - this.Auth = Object.assign({}, (0, auth_1.authMethods)(this.client)); - this.User = Object.assign({}, (0, user_1.userMethods)(this.client)); - this.Event = Object.assign({}, (0, event_1.eventMethods)(this.client)); - } -} -exports.TeamCowboy = TeamCowboy; diff --git a/dist/cjs/index.js b/dist/cjs/index.js deleted file mode 100644 index 698774f..0000000 --- a/dist/cjs/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.TeamCowboy = void 0; -var core_1 = require("./core"); -Object.defineProperty(exports, "TeamCowboy", { enumerable: true, get: function () { return core_1.TeamCowboy; } }); diff --git a/dist/cjs/methods/auth.js b/dist/cjs/methods/auth.js deleted file mode 100644 index 59b09bc..0000000 --- a/dist/cjs/methods/auth.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.authMethods = void 0; -const params_1 = require("../request/params"); -const getUserToken = (client, { username, password }) => __awaiter(void 0, void 0, void 0, function* () { - const params = (0, params_1.create)({ - client, - httpMethod: "POST", - params: { - method: "Auth_GetUserToken", - password, - username, - }, - }); - const response = yield client.axiosInstance.post("/", params); - return response.data; -}); -const authMethods = (client) => { - return { - getUserToken: (options) => getUserToken(client, options), - }; -}; -exports.authMethods = authMethods; diff --git a/dist/cjs/methods/event.js b/dist/cjs/methods/event.js deleted file mode 100644 index 2c154eb..0000000 --- a/dist/cjs/methods/event.js +++ /dev/null @@ -1,33 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.eventMethods = void 0; -const params_1 = require("../request/params"); -const get = (client, { eventId, teamId, includeRSVPInfo }) => __awaiter(void 0, void 0, void 0, function* () { - const params = (0, params_1.create)({ - client, - httpMethod: "GET", - params: { - eventId, - method: "Event_Get", - teamId, - includeRSVPInfo: includeRSVPInfo !== null && includeRSVPInfo !== void 0 ? includeRSVPInfo : null, - }, - }); - const { data } = yield client.axiosInstance.get("/", { params }); - return data; -}); -const eventMethods = (client) => { - return { - get: (options) => get(client, options), - }; -}; -exports.eventMethods = eventMethods; diff --git a/dist/cjs/methods/test.js b/dist/cjs/methods/test.js deleted file mode 100644 index f77e98d..0000000 --- a/dist/cjs/methods/test.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.testMethods = void 0; -const params_1 = require("../request/params"); -const getRequest = (client, testParam) => __awaiter(void 0, void 0, void 0, function* () { - const params = (0, params_1.create)({ - client, - httpMethod: "GET", - params: { - method: "Test_GetRequest", - testParam, - }, - }); - const response = yield client.axiosInstance.get("/", { - params, - }); - return response.data; -}); -const postRequest = (client, testParam) => __awaiter(void 0, void 0, void 0, function* () { - const params = (0, params_1.create)({ - client, - httpMethod: "POST", - params: { - method: "Test_PostRequest", - testParam, - }, - }); - const response = yield client.axiosInstance.post("/", params); - return response.data; -}); -const testMethods = (client) => { - return { - getRequest: (testParam) => getRequest(client, testParam), - postRequest: (testParam) => postRequest(client, testParam), - }; -}; -exports.testMethods = testMethods; diff --git a/dist/cjs/methods/user.js b/dist/cjs/methods/user.js deleted file mode 100644 index 1ad9385..0000000 --- a/dist/cjs/methods/user.js +++ /dev/null @@ -1,9 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.userMethods = void 0; -const index_1 = __importDefault(require("./user/index")); -const userMethods = (client) => (0, index_1.default)(client); -exports.userMethods = userMethods; diff --git a/dist/cjs/methods/user/get.js b/dist/cjs/methods/user/get.js deleted file mode 100644 index 1073fa3..0000000 --- a/dist/cjs/methods/user/get.js +++ /dev/null @@ -1,25 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getUser = void 0; -const params_1 = require("../../request/params"); -const getUser = (client) => __awaiter(void 0, void 0, void 0, function* () { - const params = (0, params_1.create)({ - client, - httpMethod: "GET", - params: { - method: "User_Get", - }, - }); - const { data } = yield client.axiosInstance.get("/", { params }); - return data; -}); -exports.getUser = getUser; diff --git a/dist/cjs/methods/user/getNextTeamEvent.js b/dist/cjs/methods/user/getNextTeamEvent.js deleted file mode 100644 index 52b1a37..0000000 --- a/dist/cjs/methods/user/getNextTeamEvent.js +++ /dev/null @@ -1,28 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getNextTeamEvent = void 0; -const params_1 = require("../../request/params"); -const defaultOptions = { - dashboardTeamsOnly: null, - teamId: null, -}; -const getNextTeamEvent = (client, options) => __awaiter(void 0, void 0, void 0, function* () { - const methodParams = Object.assign({ method: "User_GetNextTeamEvent" }, (options !== null && options !== void 0 ? options : defaultOptions)); - const params = (0, params_1.create)({ - client, - httpMethod: "GET", - params: methodParams, - }); - const { data } = yield client.axiosInstance.get("/", { params }); - return data; -}); -exports.getNextTeamEvent = getNextTeamEvent; diff --git a/dist/cjs/methods/user/getTeamEvents.js b/dist/cjs/methods/user/getTeamEvents.js deleted file mode 100644 index 0ee1253..0000000 --- a/dist/cjs/methods/user/getTeamEvents.js +++ /dev/null @@ -1,32 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getTeamEvents = void 0; -const params_1 = require("../../request/params"); -const defaultOptions = { - dashboardTeamsOnly: null, - endDateTime: null, - startDateTime: null, - teamId: null, -}; -const getTeamEvents = (client, options) => __awaiter(void 0, void 0, void 0, function* () { - const methodParams = Object.assign({ method: "User_GetTeamEvents" }, (options !== null && options !== void 0 ? options : defaultOptions)); - const params = (0, params_1.create)({ - client, - httpMethod: "GET", - params: methodParams, - }); - const { data } = yield client.axiosInstance.get("/", { - params, - }); - return data; -}); -exports.getTeamEvents = getTeamEvents; diff --git a/dist/cjs/methods/user/getTeamMessages.js b/dist/cjs/methods/user/getTeamMessages.js deleted file mode 100644 index e80da91..0000000 --- a/dist/cjs/methods/user/getTeamMessages.js +++ /dev/null @@ -1,34 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getTeamMessages = void 0; -const params_1 = require("../../request/params"); -const defaultOptions = { - messageId: null, - offset: 0, - qty: 10, - sortBy: "lastUpdated", - sortDirection: "ASC", - teamId: null, -}; -const getTeamMessages = (client, options) => __awaiter(void 0, void 0, void 0, function* () { - const methodParams = Object.assign({ method: "User_GetTeamMessages" }, (options !== null && options !== void 0 ? options : defaultOptions)); - const params = (0, params_1.create)({ - client, - httpMethod: "GET", - params: methodParams, - }); - const { data } = yield client.axiosInstance.get("/", { - params, - }); - return data; -}); -exports.getTeamMessages = getTeamMessages; diff --git a/dist/cjs/methods/user/getTeams.js b/dist/cjs/methods/user/getTeams.js deleted file mode 100644 index 2d33fce..0000000 --- a/dist/cjs/methods/user/getTeams.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.getTeams = void 0; -const params_1 = require("../../request/params"); -const defaultOptions = { - dashboardTeamsOnly: null, -}; -const getTeams = (client, options) => __awaiter(void 0, void 0, void 0, function* () { - const methodParams = Object.assign({ method: "User_GetTeams" }, (options !== null && options !== void 0 ? options : defaultOptions)); - const params = (0, params_1.create)({ - client, - httpMethod: "GET", - params: methodParams, - }); - const { data } = yield client.axiosInstance.get("/", { - params, - }); - return data; -}); -exports.getTeams = getTeams; diff --git a/dist/cjs/methods/user/index.js b/dist/cjs/methods/user/index.js deleted file mode 100644 index 1d80b37..0000000 --- a/dist/cjs/methods/user/index.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const get_1 = require("./get"); -const getNextTeamEvent_1 = require("./getNextTeamEvent"); -const getTeamEvents_1 = require("./getTeamEvents"); -const getTeamMessages_1 = require("./getTeamMessages"); -const getTeams_1 = require("./getTeams"); -const methods = (client) => { - return { - get: () => (0, get_1.getUser)(client), - getTeams: (options) => (0, getTeams_1.getTeams)(client, options), - getTeamEvents: (options) => (0, getTeamEvents_1.getTeamEvents)(client, options), - getNextTeamEvent: (options) => (0, getNextTeamEvent_1.getNextTeamEvent)(client, options), - getTeamMessages: (options) => (0, getTeamMessages_1.getTeamMessages)(client, options), - }; -}; -exports.default = methods; diff --git a/dist/cjs/request/body.js b/dist/cjs/request/body.js deleted file mode 100644 index cf1302d..0000000 --- a/dist/cjs/request/body.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.create = void 0; -const sortedURLSearchParams = (params) => { - const sorted = new URLSearchParams(params); - sorted.sort(); - return sorted; -}; -const withLowerCasedValues = (params) => { - const lowerCase = new URLSearchParams(); - params.forEach((value, key) => { - lowerCase.set(key.toLowerCase(), value.toLowerCase()); - }); - return lowerCase; -}; -const withEmptyParams = (params) => Object.entries(params).reduce((accum, [key, value]) => { - accum.set(key, value != null ? value : ""); - return accum; -}, new URLSearchParams()); -const create = (params) => { - const requestParams = withLowerCasedValues(withEmptyParams(params)); - return sortedURLSearchParams(requestParams).toString().replace(/\+/g, "%20"); -}; -exports.create = create; diff --git a/dist/cjs/request/params.js b/dist/cjs/request/params.js deleted file mode 100644 index 5ab751a..0000000 --- a/dist/cjs/request/params.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.create = void 0; -const signature_1 = require("./signature"); -const create = ({ client, httpMethod, overrides, params, }) => { - var _a, _b, _c; - const timestamp = (_a = overrides === null || overrides === void 0 ? void 0 : overrides.timestamp) !== null && _a !== void 0 ? _a : generateTimestamp(); - const nonce = (_b = overrides === null || overrides === void 0 ? void 0 : overrides.nonce) !== null && _b !== void 0 ? _b : generateNonce(); - const paramsWithoutSig = Object.assign({ api_key: client.publicApiKey, nonce, - timestamp }, params); - const requestParams = client.auth - ? Object.assign({ userToken: client.auth }, paramsWithoutSig) : paramsWithoutSig; - const sig = (_c = overrides === null || overrides === void 0 ? void 0 : overrides.sig) !== null && _c !== void 0 ? _c : (0, signature_1.create)({ - privateApiKey: client.privateApiKey, - httpMethod, - params: requestParams, - }); - return Object.assign({ sig }, requestParams); -}; -exports.create = create; -const generateTimestamp = () => Math.round(new Date().getTime() / 1000).toString(); -const generateNonce = () => (new Date().getTime() * 1000000).toString(); diff --git a/dist/cjs/request/signature.js b/dist/cjs/request/signature.js deleted file mode 100644 index eea229d..0000000 --- a/dist/cjs/request/signature.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.create = void 0; -const sha1_1 = __importDefault(require("crypto-js/sha1")); -const body_1 = require("./body"); -const sha1hash = (input) => { - return (0, sha1_1.default)(input).toString(); -}; -const create = ({ privateApiKey, httpMethod, params, }) => { - const requestBody = (0, body_1.create)(params); - const requestStr = [ - privateApiKey, - httpMethod.toUpperCase(), - params.method, - params.timestamp, - params.nonce, - requestBody, - ].join("|"); - return sha1hash(requestStr); -}; -exports.create = create; diff --git a/dist/cjs/request/types.js b/dist/cjs/request/types.js deleted file mode 100644 index c8ad2e5..0000000 --- a/dist/cjs/request/types.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/dist/cjs/types.js b/dist/cjs/types.js deleted file mode 100644 index c8ad2e5..0000000 --- a/dist/cjs/types.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/dist/cjs/version.js b/dist/cjs/version.js deleted file mode 100644 index 19c9075..0000000 --- a/dist/cjs/version.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.VERSION = void 0; -exports.VERSION = "0.0.0-development"; diff --git a/dist/esm/core.d.ts b/dist/esm/core.d.ts deleted file mode 100644 index 44c1f01..0000000 --- a/dist/esm/core.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { TeamcowboyOptions } from "./types"; -import { type TestMethods } from "./methods/test"; -import { AuthMethods } from "./methods/auth"; -import { userMethods } from "./methods/user"; -import { EventMethods } from "./methods/event"; -export declare class TeamCowboy { - private readonly client; - Test: TestMethods; - Auth: AuthMethods; - User: ReturnType; - Event: EventMethods; - constructor(options: TeamcowboyOptions); -} diff --git a/dist/esm/core.js b/dist/esm/core.js deleted file mode 100644 index 47942c2..0000000 --- a/dist/esm/core.js +++ /dev/null @@ -1,37 +0,0 @@ -import { getUserAgent } from "universal-user-agent"; -import { VERSION } from "./version"; -import axios from "axios"; -import { testMethods } from "./methods/test"; -import { authMethods } from "./methods/auth"; -import { userMethods } from "./methods/user"; -import AxiosCurlirize from "axios-curlirize"; -import Qs from "qs"; -import { eventMethods } from "./methods/event"; -export class TeamCowboy { - constructor(options) { - var _a; - const requestDefaults = { - baseURL: "https://api.teamcowboy.com/v1", - headers: { - "user-agent": (_a = options.userAgent) !== null && _a !== void 0 ? _a : `teamcowboy.js/${VERSION} ${getUserAgent()}`, - "Content-Type": "application/x-www-form-urlencoded", - }, - paramsSerializer: (params) => { - return Qs.stringify(params, { arrayFormat: "brackets" }); - }, - }; - this.client = { - privateApiKey: options.privateApiKey, - publicApiKey: options.publicApiKey, - auth: options.authToken, - axiosInstance: axios.create(requestDefaults), - }; - if (options.verbose) { - AxiosCurlirize(this.client.axiosInstance); - } - this.Test = Object.assign({}, testMethods(this.client)); - this.Auth = Object.assign({}, authMethods(this.client)); - this.User = Object.assign({}, userMethods(this.client)); - this.Event = Object.assign({}, eventMethods(this.client)); - } -} diff --git a/dist/esm/index.d.ts b/dist/esm/index.d.ts deleted file mode 100644 index 0c636fe..0000000 --- a/dist/esm/index.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { TeamCowboy } from "./core"; -export type { TCEvent, User } from "./types"; diff --git a/dist/esm/index.js b/dist/esm/index.js deleted file mode 100644 index 07394f2..0000000 --- a/dist/esm/index.js +++ /dev/null @@ -1 +0,0 @@ -export { TeamCowboy } from "./core"; diff --git a/dist/esm/methods/auth.d.ts b/dist/esm/methods/auth.d.ts deleted file mode 100644 index 378cd06..0000000 --- a/dist/esm/methods/auth.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { TCResponse } from "../request/types"; -import { Client } from "../types"; -type GetUserTokenResponse = TCResponse<{ - readonly userId: string; - readonly token: string; -}>; -type GetUserTokenOptions = { - readonly username: string; - readonly password: string; -}; -type GetUserToken = (options: GetUserTokenOptions) => Promise; -export type AuthMethods = { - readonly getUserToken: GetUserToken; -}; -export declare const authMethods: (client: Client) => AuthMethods; -export {}; diff --git a/dist/esm/methods/auth.js b/dist/esm/methods/auth.js deleted file mode 100644 index 26d5f5d..0000000 --- a/dist/esm/methods/auth.js +++ /dev/null @@ -1,28 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { create } from "../request/params"; -const getUserToken = (client, { username, password }) => __awaiter(void 0, void 0, void 0, function* () { - const params = create({ - client, - httpMethod: "POST", - params: { - method: "Auth_GetUserToken", - password, - username, - }, - }); - const response = yield client.axiosInstance.post("/", params); - return response.data; -}); -export const authMethods = (client) => { - return { - getUserToken: (options) => getUserToken(client, options), - }; -}; diff --git a/dist/esm/methods/event.d.ts b/dist/esm/methods/event.d.ts deleted file mode 100644 index 7390d81..0000000 --- a/dist/esm/methods/event.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { TCResponse } from "../request/types"; -import { Client, TCEvent } from "../types"; -type GetResponse = TCResponse; -type GetOptions = { - readonly teamId: number; - readonly eventId: number; - readonly includeRSVPInfo?: boolean | null; -}; -type Get = (options: GetOptions) => Promise; -export type EventMethods = { - readonly get: Get; -}; -export declare const eventMethods: (client: Client) => EventMethods; -export {}; diff --git a/dist/esm/methods/event.js b/dist/esm/methods/event.js deleted file mode 100644 index d98d49c..0000000 --- a/dist/esm/methods/event.js +++ /dev/null @@ -1,29 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { create } from "../request/params"; -const get = (client, { eventId, teamId, includeRSVPInfo }) => __awaiter(void 0, void 0, void 0, function* () { - const params = create({ - client, - httpMethod: "GET", - params: { - eventId, - method: "Event_Get", - teamId, - includeRSVPInfo: includeRSVPInfo !== null && includeRSVPInfo !== void 0 ? includeRSVPInfo : null, - }, - }); - const { data } = yield client.axiosInstance.get("/", { params }); - return data; -}); -export const eventMethods = (client) => { - return { - get: (options) => get(client, options), - }; -}; diff --git a/dist/esm/methods/test.d.ts b/dist/esm/methods/test.d.ts deleted file mode 100644 index 3fdfb12..0000000 --- a/dist/esm/methods/test.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { TCResponse } from "../request/types"; -import type { Client } from "../types"; -type GetRequestResponse = TCResponse<{ - readonly helloWorld: string; -}>; -type GetRequest = (testParam?: string) => Promise; -type PostRequest = GetRequest; -export type TestMethods = { - readonly getRequest: GetRequest; - readonly postRequest: PostRequest; -}; -export declare const testMethods: (client: Client) => TestMethods; -export {}; diff --git a/dist/esm/methods/test.js b/dist/esm/methods/test.js deleted file mode 100644 index af7491b..0000000 --- a/dist/esm/methods/test.js +++ /dev/null @@ -1,42 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { create } from "../request/params"; -const getRequest = (client, testParam) => __awaiter(void 0, void 0, void 0, function* () { - const params = create({ - client, - httpMethod: "GET", - params: { - method: "Test_GetRequest", - testParam, - }, - }); - const response = yield client.axiosInstance.get("/", { - params, - }); - return response.data; -}); -const postRequest = (client, testParam) => __awaiter(void 0, void 0, void 0, function* () { - const params = create({ - client, - httpMethod: "POST", - params: { - method: "Test_PostRequest", - testParam, - }, - }); - const response = yield client.axiosInstance.post("/", params); - return response.data; -}); -export const testMethods = (client) => { - return { - getRequest: (testParam) => getRequest(client, testParam), - postRequest: (testParam) => postRequest(client, testParam), - }; -}; diff --git a/dist/esm/methods/user.d.ts b/dist/esm/methods/user.d.ts deleted file mode 100644 index fffefe0..0000000 --- a/dist/esm/methods/user.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { Client } from "../types"; -import { UserMethods } from "./user/index"; -export declare const userMethods: (client: Client) => UserMethods; diff --git a/dist/esm/methods/user.js b/dist/esm/methods/user.js deleted file mode 100644 index f6d0148..0000000 --- a/dist/esm/methods/user.js +++ /dev/null @@ -1,2 +0,0 @@ -import methods from "./user/index"; -export const userMethods = (client) => methods(client); diff --git a/dist/esm/methods/user/get.d.ts b/dist/esm/methods/user/get.d.ts deleted file mode 100644 index 840f918..0000000 --- a/dist/esm/methods/user/get.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { TCResponse } from "../../request/types"; -import { Client, User } from "../../types"; -export type GetResponse = TCResponse; -export type Get = () => Promise; -export declare const getUser: (client: Client) => Promise; diff --git a/dist/esm/methods/user/get.js b/dist/esm/methods/user/get.js deleted file mode 100644 index e09905c..0000000 --- a/dist/esm/methods/user/get.js +++ /dev/null @@ -1,21 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { create } from "../../request/params"; -export const getUser = (client) => __awaiter(void 0, void 0, void 0, function* () { - const params = create({ - client, - httpMethod: "GET", - params: { - method: "User_Get", - }, - }); - const { data } = yield client.axiosInstance.get("/", { params }); - return data; -}); diff --git a/dist/esm/methods/user/getNextTeamEvent.d.ts b/dist/esm/methods/user/getNextTeamEvent.d.ts deleted file mode 100644 index f3df962..0000000 --- a/dist/esm/methods/user/getNextTeamEvent.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { TCResponse } from "../../request/types"; -import { Client, TCEvent } from "../../types"; -export type GetNextTeamEventResponse = TCResponse; -type GetNextTeamEventOptions = { - readonly teamId: number | null; - readonly dashboardTeamsOnly: boolean | null; -}; -export type GetNextTeamEvent = (options?: GetNextTeamEventOptions) => Promise; -export declare const getNextTeamEvent: (client: Client, options?: GetNextTeamEventOptions) => Promise; -export {}; diff --git a/dist/esm/methods/user/getNextTeamEvent.js b/dist/esm/methods/user/getNextTeamEvent.js deleted file mode 100644 index bf3b27e..0000000 --- a/dist/esm/methods/user/getNextTeamEvent.js +++ /dev/null @@ -1,24 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { create } from "../../request/params"; -const defaultOptions = { - dashboardTeamsOnly: null, - teamId: null, -}; -export const getNextTeamEvent = (client, options) => __awaiter(void 0, void 0, void 0, function* () { - const methodParams = Object.assign({ method: "User_GetNextTeamEvent" }, (options !== null && options !== void 0 ? options : defaultOptions)); - const params = create({ - client, - httpMethod: "GET", - params: methodParams, - }); - const { data } = yield client.axiosInstance.get("/", { params }); - return data; -}); diff --git a/dist/esm/methods/user/getTeamEvents.d.ts b/dist/esm/methods/user/getTeamEvents.d.ts deleted file mode 100644 index 0c16d3e..0000000 --- a/dist/esm/methods/user/getTeamEvents.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { TCResponse } from "../../request/types"; -import { Client, TCEvent } from "../../types"; -export type GetTeamEventsResponse = TCResponse; -export type GetTeamEvents = (options?: GetTeamEventsOptions) => Promise; -type GetTeamEventsOptions = { - readonly startDateTime: Date | null; - readonly endDateTime: Date | null; - readonly teamId: number | null; - readonly dashboardTeamsOnly: boolean | null; -}; -export declare const getTeamEvents: (client: Client, options?: GetTeamEventsOptions) => Promise; -export {}; diff --git a/dist/esm/methods/user/getTeamEvents.js b/dist/esm/methods/user/getTeamEvents.js deleted file mode 100644 index ec4ed8a..0000000 --- a/dist/esm/methods/user/getTeamEvents.js +++ /dev/null @@ -1,28 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { create } from "../../request/params"; -const defaultOptions = { - dashboardTeamsOnly: null, - endDateTime: null, - startDateTime: null, - teamId: null, -}; -export const getTeamEvents = (client, options) => __awaiter(void 0, void 0, void 0, function* () { - const methodParams = Object.assign({ method: "User_GetTeamEvents" }, (options !== null && options !== void 0 ? options : defaultOptions)); - const params = create({ - client, - httpMethod: "GET", - params: methodParams, - }); - const { data } = yield client.axiosInstance.get("/", { - params, - }); - return data; -}); diff --git a/dist/esm/methods/user/getTeamMessages.d.ts b/dist/esm/methods/user/getTeamMessages.d.ts deleted file mode 100644 index 31fa843..0000000 --- a/dist/esm/methods/user/getTeamMessages.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { TCResponse } from "../../request/types"; -import { Client, Message } from "../../types"; -export type GetTeamMessagesResponse = TCResponse; -export type GetTeamMessages = (options?: GetTeamMessagesOptions) => Promise; -type GetTeamMessagesOptions = { - readonly teamId: number | null; - readonly messageId: number | null; - readonly offset: number; - readonly qty: number; - readonly sortBy: "title" | "lastUpdated" | "type"; - readonly sortDirection: "ASC" | "DESC"; -}; -export declare const getTeamMessages: (client: Client, options?: GetTeamMessagesOptions) => Promise; -export {}; diff --git a/dist/esm/methods/user/getTeamMessages.js b/dist/esm/methods/user/getTeamMessages.js deleted file mode 100644 index 30aad31..0000000 --- a/dist/esm/methods/user/getTeamMessages.js +++ /dev/null @@ -1,30 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { create } from "../../request/params"; -const defaultOptions = { - messageId: null, - offset: 0, - qty: 10, - sortBy: "lastUpdated", - sortDirection: "ASC", - teamId: null, -}; -export const getTeamMessages = (client, options) => __awaiter(void 0, void 0, void 0, function* () { - const methodParams = Object.assign({ method: "User_GetTeamMessages" }, (options !== null && options !== void 0 ? options : defaultOptions)); - const params = create({ - client, - httpMethod: "GET", - params: methodParams, - }); - const { data } = yield client.axiosInstance.get("/", { - params, - }); - return data; -}); diff --git a/dist/esm/methods/user/getTeams.d.ts b/dist/esm/methods/user/getTeams.d.ts deleted file mode 100644 index 5676295..0000000 --- a/dist/esm/methods/user/getTeams.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { TCResponse } from "../../request/types"; -import { Client, Team } from "../../types"; -export type GetTeamsResponse = TCResponse; -export type GetTeams = (options?: GetTeamsOptions) => Promise; -type GetTeamsOptions = { - readonly dashboardTeamsOnly: boolean | null; -}; -export declare const getTeams: (client: Client, options?: GetTeamsOptions) => Promise; -export {}; diff --git a/dist/esm/methods/user/getTeams.js b/dist/esm/methods/user/getTeams.js deleted file mode 100644 index 670383f..0000000 --- a/dist/esm/methods/user/getTeams.js +++ /dev/null @@ -1,25 +0,0 @@ -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -import { create } from "../../request/params"; -const defaultOptions = { - dashboardTeamsOnly: null, -}; -export const getTeams = (client, options) => __awaiter(void 0, void 0, void 0, function* () { - const methodParams = Object.assign({ method: "User_GetTeams" }, (options !== null && options !== void 0 ? options : defaultOptions)); - const params = create({ - client, - httpMethod: "GET", - params: methodParams, - }); - const { data } = yield client.axiosInstance.get("/", { - params, - }); - return data; -}); diff --git a/dist/esm/methods/user/index.d.ts b/dist/esm/methods/user/index.d.ts deleted file mode 100644 index a1ae9f9..0000000 --- a/dist/esm/methods/user/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { Client } from "../../types"; -import { Get } from "./get"; -import { GetNextTeamEvent } from "./getNextTeamEvent"; -import { GetTeamEvents } from "./getTeamEvents"; -import { GetTeamMessages } from "./getTeamMessages"; -import { GetTeams } from "./getTeams"; -export type UserMethods = { - readonly get: Get; - readonly getTeams: GetTeams; - readonly getTeamEvents: GetTeamEvents; - readonly getNextTeamEvent: GetNextTeamEvent; - readonly getTeamMessages: GetTeamMessages; -}; -declare const methods: (client: Client) => UserMethods; -export default methods; diff --git a/dist/esm/methods/user/index.js b/dist/esm/methods/user/index.js deleted file mode 100644 index e4a6a22..0000000 --- a/dist/esm/methods/user/index.js +++ /dev/null @@ -1,15 +0,0 @@ -import { getUser } from "./get"; -import { getNextTeamEvent } from "./getNextTeamEvent"; -import { getTeamEvents } from "./getTeamEvents"; -import { getTeamMessages } from "./getTeamMessages"; -import { getTeams } from "./getTeams"; -const methods = (client) => { - return { - get: () => getUser(client), - getTeams: (options) => getTeams(client, options), - getTeamEvents: (options) => getTeamEvents(client, options), - getNextTeamEvent: (options) => getNextTeamEvent(client, options), - getTeamMessages: (options) => getTeamMessages(client, options), - }; -}; -export default methods; diff --git a/dist/esm/request/body.d.ts b/dist/esm/request/body.d.ts deleted file mode 100644 index 99eb109..0000000 --- a/dist/esm/request/body.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { ApiParams, ParamsWithoutSig } from "./types"; -export declare const create: (params: ParamsWithoutSig) => string; diff --git a/dist/esm/request/body.js b/dist/esm/request/body.js deleted file mode 100644 index b2c10ce..0000000 --- a/dist/esm/request/body.js +++ /dev/null @@ -1,20 +0,0 @@ -const sortedURLSearchParams = (params) => { - const sorted = new URLSearchParams(params); - sorted.sort(); - return sorted; -}; -const withLowerCasedValues = (params) => { - const lowerCase = new URLSearchParams(); - params.forEach((value, key) => { - lowerCase.set(key.toLowerCase(), value.toLowerCase()); - }); - return lowerCase; -}; -const withEmptyParams = (params) => Object.entries(params).reduce((accum, [key, value]) => { - accum.set(key, value != null ? value : ""); - return accum; -}, new URLSearchParams()); -export const create = (params) => { - const requestParams = withLowerCasedValues(withEmptyParams(params)); - return sortedURLSearchParams(requestParams).toString().replace(/\+/g, "%20"); -}; diff --git a/dist/esm/request/params.d.ts b/dist/esm/request/params.d.ts deleted file mode 100644 index 72b7371..0000000 --- a/dist/esm/request/params.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import type { Client } from "../types"; -import { ApiParams, AuthenticatedRequestParams, RequestOptions, RequestParams, RequiredParams } from "./types"; -type CreateOptions = RequestOptions & { - readonly client: Client; - readonly params: T; - readonly overrides?: Partial; -}; -export declare const create: ({ client, httpMethod, overrides, params, }: CreateOptions) => RequestParams | AuthenticatedRequestParams; -export {}; diff --git a/dist/esm/request/params.js b/dist/esm/request/params.js deleted file mode 100644 index deee6b4..0000000 --- a/dist/esm/request/params.js +++ /dev/null @@ -1,18 +0,0 @@ -import { create as createSignature } from "./signature"; -export const create = ({ client, httpMethod, overrides, params, }) => { - var _a, _b, _c; - const timestamp = (_a = overrides === null || overrides === void 0 ? void 0 : overrides.timestamp) !== null && _a !== void 0 ? _a : generateTimestamp(); - const nonce = (_b = overrides === null || overrides === void 0 ? void 0 : overrides.nonce) !== null && _b !== void 0 ? _b : generateNonce(); - const paramsWithoutSig = Object.assign({ api_key: client.publicApiKey, nonce, - timestamp }, params); - const requestParams = client.auth - ? Object.assign({ userToken: client.auth }, paramsWithoutSig) : paramsWithoutSig; - const sig = (_c = overrides === null || overrides === void 0 ? void 0 : overrides.sig) !== null && _c !== void 0 ? _c : createSignature({ - privateApiKey: client.privateApiKey, - httpMethod, - params: requestParams, - }); - return Object.assign({ sig }, requestParams); -}; -const generateTimestamp = () => Math.round(new Date().getTime() / 1000).toString(); -const generateNonce = () => (new Date().getTime() * 1000000).toString(); diff --git a/dist/esm/request/signature.d.ts b/dist/esm/request/signature.d.ts deleted file mode 100644 index cd356e3..0000000 --- a/dist/esm/request/signature.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { ApiParams, ParamsWithoutSig, RequestOptions } from "./types"; -type CreateOptions = RequestOptions & { - readonly privateApiKey: string; - readonly params: ParamsWithoutSig; -}; -export declare const create: ({ privateApiKey, httpMethod, params, }: CreateOptions) => string; -export {}; diff --git a/dist/esm/request/signature.js b/dist/esm/request/signature.js deleted file mode 100644 index 880e42c..0000000 --- a/dist/esm/request/signature.js +++ /dev/null @@ -1,17 +0,0 @@ -import sha1 from "crypto-js/sha1"; -import { create as createRequestBody } from "./body"; -const sha1hash = (input) => { - return sha1(input).toString(); -}; -export const create = ({ privateApiKey, httpMethod, params, }) => { - const requestBody = createRequestBody(params); - const requestStr = [ - privateApiKey, - httpMethod.toUpperCase(), - params.method, - params.timestamp, - params.nonce, - requestBody, - ].join("|"); - return sha1hash(requestStr); -}; diff --git a/dist/esm/request/types.d.ts b/dist/esm/request/types.d.ts deleted file mode 100644 index d2240cd..0000000 --- a/dist/esm/request/types.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -export type RequiredParams = { - readonly api_key: string; - readonly method: string; - readonly timestamp: string; - readonly nonce: string; - readonly sig: string; -}; -export type MethodParams = { - [Property in keyof T]: T[Property]; -}; -export type RequestParams = MethodParams & RequiredParams; -export type AuthenticatedRequestParams = RequestParams & { - readonly userToken: string; -}; -export type ApiParams = { - readonly method: string; -}; -export type RequestOptions = { - readonly httpMethod: "GET" | "POST"; -}; -export type ParamsWithoutSig = Omit & T; -export type TCResponse = { - readonly success: true; - readonly requestSecs: number; - readonly body: T; -}; diff --git a/dist/esm/request/types.js b/dist/esm/request/types.js deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/esm/request/types.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/esm/types.d.ts b/dist/esm/types.d.ts deleted file mode 100644 index 98e87de..0000000 --- a/dist/esm/types.d.ts +++ /dev/null @@ -1,207 +0,0 @@ -import type { AxiosInstance } from "axios"; -export type TeamcowboyOptions = { - readonly privateApiKey: string; - readonly publicApiKey: string; - readonly userAgent?: string; - readonly authToken?: string; - readonly verbose?: boolean; -}; -export type Client = { - readonly privateApiKey: string; - readonly publicApiKey: string; - readonly axiosInstance: AxiosInstance; - readonly auth?: string; -}; -export type EventType = "game" | "doubleheader" | "postseason" | "match" | "meet" | "tournament" | "jamboree" | "race" | "regatta" | "ride" | "bye" | "practice" | "scrimmage" | "pickup" | "meeting" | "other"; -export type EventStatus = "active" | "postponed" | "canceled" | "forfeited"; -export type EventResult = { - readonly scoreEntered: boolean; - readonly outcome: string; - readonly score1: number | null; - readonly score2: number | null; - readonly isWin: boolean; - readonly isTie: boolean; - readonly isLoss: boolean; - readonly scoreDisplay: string; - readonly dhScoreEntered: boolean; - readonly dhOutcome: string; - readonly dhScore1: number | null; - readonly dhScore2: number | null; - readonly dhIsWin: boolean; - readonly dhIsTie: boolean; - readonly dhIsLoss: boolean; - readonly dhScoreDisplay: string; -}; -export type DateTimeInfo = { - readonly timezoneId: string; - readonly startDateLocal: string; - readonly startTimeLocal: string; - readonly startDateTimeLocal: string; - readonly startDateLocalDisplay: string; - readonly startTimeLocalDisplay: string; - readonly startDateTimeLocalDisplay: string; - readonly startDateTimeUtc: string; - readonly startTimeTBD: boolean; - readonly endDateLocal: string; - readonly endTimeLocal: string; - readonly endDateTimeLocal: string; - readonly endDateLocalDisplay: string; - readonly endTimeLocalDisplay: string; - readonly endDateTimeLocalDisplay: string; - readonly endDateTimeUtc: string; - readonly endTimeTBD: boolean; - readonly inPast: boolean; - readonly inFuture: boolean; -}; -export type TCLocation = { - readonly locationId: number; - readonly name: string; - readonly surface: { - readonly type: string; - readonly typeDisplay: string; - readonly showType: boolean; - }; - readonly lights: { - readonly lights: string; - readonly lightsDisplay: string; - readonly hasLights: boolean; - }; - readonly address: { - readonly addressLine1: string; - readonly addressLine2: string; - readonly city: string; - readonly stateProvince: string; - readonly postalCode: string; - readonly partOfTown: string; - readonly displayMultiline: string; - readonly displaySingleLine: string; - readonly googleMapsUrl: string; - readonly googleMapsDirectionsUrl: string; - }; - readonly visibility: string; - readonly visibilityDisplay: string; - readonly comments: string; -}; -export type RSVPInstance = { - readonly userId: number; -}; -export type UserMetaInfo = { - readonly isTeamAdmin: boolean; - readonly showOnDashboard: boolean; -}; -export type Color = { - readonly name: string; - readonly hexCode: string; -}; -export type ColorSwatch = { - readonly label: string; - readonly colorCount: number; - readonly colors: Color[]; -}; -export type ShirtColors = { - readonly team1: ColorSwatch | null; - readonly team2: ColorSwatch | null; -}; -export type EventOption = { - readonly misc: { - readonly allowRSVPs: boolean; - }; - readonly rsvp: { - readonly limitTotalYesRSVPs: string; - readonly limitTotalYesRSVPs_gender_f_value: string; - readonly limitTotalYesRSVPs_gender_m_value: string; - readonly limitTotalYesRSVPs_gender_other_value: string; - readonly limitTotalYesRSVPs_mode: string; - readonly limitTotalYesRSVPs_total_value: string; - }; -}; -export type TCEvent = { - readonly eventId: number; - readonly team: { - readonly teamId: number; - readonly name: string; - }; - readonly seasonId: number; - readonly seasonName: string; - readonly eventType: EventType; - readonly eventTypeDisplay: string; - readonly status: EventStatus; - readonly statusDisplay: string; - readonly personNounSingular: string; - readonly personNounPlural: string; - readonly title: string; - readonly titleFull: string; - readonly titleLabel: string; - readonly homeAway: string; - readonly result: EventResult; - readonly rsvpInstances?: RSVPInstance[]; - readonly comments: string | null; - readonly options: EventOption; - readonly oneLineDisplay: string; - readonly oneLineDisplayShort: string; - readonly maleGenderDisplay: string; - readonly femaleGenderDisplay: string; - readonly otherGenderDisplay: string; - readonly dateTimeInfo: DateTimeInfo; - readonly locaton: TCLocation | object; - readonly shirtColors: ShirtColors; - readonly userMetaInfo: UserMetaInfo; - readonly dateCreatedUtc: Date; - readonly dateLastUpdatedUtc: Date; -}; -export type User = { - readonly userId: number; - readonly firstName: string; - readonly lastName: string; - readonly fullName: string; - readonly displayName: string; - readonly emailAddress1: string; - readonly emailAddress2: string | null; - readonly phone1: string; - readonly phone2: string | null; - readonly gender: "f" | "m" | "other"; - readonly genderDisplay: string; - readonly birthDate_month: string; - readonly birthDate_day: string; - readonly birthDate_year: string; - readonly shirtNumber: string; - readonly shirtSize: string; - readonly pantsSize: string; - readonly options: object; - readonly profilePhoto: { - readonly fullUrl: string; - readonly smallUrl: string; - readonly thumbUrl: string; - }; - readonly teamMeta?: object; - readonly linkedUsers?: object; - readonly dateCreatedUtc: Date; - readonly dateLastUpdatedUtc: Date; - readonly dateListSignInUtc: Date; -}; -export type Team = { - readonly teamId: number; - readonly name: string; - readonly shortName: string; - readonly type: { - readonly name: string; - readonly title: string; - }; - readonly activity: { - readonly activityId: number; - readonly name: string; - }; - readonly timezoneId: string; - readonly city: string; - readonly stateProvince: string; - readonly stateProvinceAbbrev: string; - readonly country: string; -}; -export type Message = { - readonly messageId: number; - readonly title: string; - readonly bodyHtml: string; - readonly bodyText: string; - readonly isPinned: boolean; - readonly allowComments: boolean; -}; diff --git a/dist/esm/types.js b/dist/esm/types.js deleted file mode 100644 index cb0ff5c..0000000 --- a/dist/esm/types.js +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/dist/esm/version.d.ts b/dist/esm/version.d.ts deleted file mode 100644 index 15711f0..0000000 --- a/dist/esm/version.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const VERSION = "0.0.0-development"; diff --git a/dist/esm/version.js b/dist/esm/version.js deleted file mode 100644 index 86383b1..0000000 --- a/dist/esm/version.js +++ /dev/null @@ -1 +0,0 @@ -export const VERSION = "0.0.0-development"; diff --git a/package-lock.json b/package-lock.json index 1b73ca4..fc4c055 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,16 @@ { "name": "teamcowboy.js", - "version": "1.0.0", + "version": "1.0.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "teamcowboy.js", - "version": "1.0.0", + "version": "1.0.2", "license": "MIT", "dependencies": { "axios": "^1.5.0", + "axios-curlirize": "^1.3.7", "crypto-js": "^4.1.1", "qs": "^6.11.2", "universal-user-agent": "^6.0.0" @@ -31,7 +32,6 @@ "@types/qs": "^6.9.8", "@typescript-eslint/eslint-plugin": "^6.6.0", "@typescript-eslint/parser": "^6.6.0", - "axios-curlirize": "^1.3.7", "babel-jest": "^29.6.4", "eslint": "^8.48.0", "fetch-mock": "^9.3.1", @@ -4319,8 +4319,7 @@ "node_modules/axios-curlirize": { "version": "1.3.7", "resolved": "https://registry.npmjs.org/axios-curlirize/-/axios-curlirize-1.3.7.tgz", - "integrity": "sha512-csSsuMyZj1dv1fL0zRPnDAHWrmlISMvK+wx9WJI/igRVDT4VMgbf2AVenaHghFLfI1nQijXUevYEguYV6u5hjA==", - "dev": true + "integrity": "sha512-csSsuMyZj1dv1fL0zRPnDAHWrmlISMvK+wx9WJI/igRVDT4VMgbf2AVenaHghFLfI1nQijXUevYEguYV6u5hjA==" }, "node_modules/babel-jest": { "version": "29.6.4", diff --git a/package.json b/package.json index 99714e1..d3ab261 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "license": "MIT", "dependencies": { "axios": "^1.5.0", + "axios-curlirize": "^1.3.7", "crypto-js": "^4.1.1", "qs": "^6.11.2", "universal-user-agent": "^6.0.0" @@ -50,7 +51,6 @@ "@types/qs": "^6.9.8", "@typescript-eslint/eslint-plugin": "^6.6.0", "@typescript-eslint/parser": "^6.6.0", - "axios-curlirize": "^1.3.7", "babel-jest": "^29.6.4", "eslint": "^8.48.0", "fetch-mock": "^9.3.1",