comty.js 0.47.1 → 0.47.4

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.
@@ -1,6 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }var _request = require('../../handlers/request'); var _request2 = _interopRequireDefault(_request);
2
2
  var _session = require('../session'); var _session2 = _interopRequireDefault(_session);
3
3
 
4
+ const emailRegex = new RegExp(/^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/)
5
+
4
6
  class AuthModel {
5
7
  static __initStatic() {this.login = async (payload) => {
6
8
  const response = await _request2.default.call(void 0, {
@@ -50,4 +52,31 @@ var _session = require('../session'); var _session2 = _interopRequireDefault(_se
50
52
 
51
53
  return response
52
54
  }}
53
- } AuthModel.__initStatic(); AuthModel.__initStatic2(); AuthModel.__initStatic3(); exports.default = AuthModel;
55
+
56
+ static __initStatic4() {this.usernameValidation = async (username) => {
57
+ let payload = {}
58
+
59
+ // check if usename arguemnt is an email
60
+ if (emailRegex.test(username)) {
61
+ payload.email = username
62
+ } else {
63
+ payload.username = username
64
+ }
65
+
66
+ const response = await _request2.default.call(void 0, {
67
+ method: "get",
68
+ url: "/auth/login/validation",
69
+ params: payload,
70
+ }).catch((error) => {
71
+ console.error(error)
72
+
73
+ return false
74
+ })
75
+
76
+ if (!response) {
77
+ throw new Error("Unable to validate user")
78
+ }
79
+
80
+ return response.data
81
+ }}
82
+ } AuthModel.__initStatic(); AuthModel.__initStatic2(); AuthModel.__initStatic3(); AuthModel.__initStatic4(); exports.default = AuthModel;
@@ -42,7 +42,7 @@
42
42
  const { data } = await _request2.default.call(void 0, {
43
43
  instance: PlaylistsModel.api_instance,
44
44
  method: "DELETE",
45
- url: `/playlist/${id}`,
45
+ url: `/playlists/${id}`,
46
46
  })
47
47
 
48
48
  return data
package/dist/remotes.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }function composeRemote(path) {
2
- return envOrigins[process.env.NODE_ENV][path]
2
+ return envOrigins[_nullishCoalesce(process.env.NODE_ENV, () => ( "production"))][path]
3
3
  }
4
4
 
5
5
  function getCurrentHostname() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "comty.js",
3
- "version": "0.47.1",
3
+ "version": "0.47.4",
4
4
  "main": "./dist/index.js",
5
5
  "author": "RageStudio <support@ragestudio.net>",
6
6
  "scripts": {