speedly 1.2.29 → 1.2.31

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.
@@ -61,4 +61,7 @@ declare const models: {
61
61
  __v: number;
62
62
  }>>;
63
63
  };
64
- export { auth, db, uploader, validator, models };
64
+ declare const modules: {
65
+ translation: import("express-serve-static-core").Router;
66
+ };
67
+ export { auth, db, uploader, validator, models, modules };
package/dist/cjs/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.models = exports.validator = exports.uploader = exports.db = exports.auth = void 0;
6
+ exports.modules = exports.models = exports.validator = exports.uploader = exports.db = exports.auth = void 0;
7
7
  const auth_1 = __importDefault(require("./auth/auth"));
8
8
  exports.auth = auth_1.default;
9
9
  const db_1 = __importDefault(require("./db/db"));
@@ -17,3 +17,4 @@ const translation_routes_1 = __importDefault(require("./modules/translation/tran
17
17
  const models = { translation: translation_1.default };
18
18
  exports.models = models;
19
19
  const modules = { translation: translation_routes_1.default };
20
+ exports.modules = modules;
@@ -1,5 +1,9 @@
1
1
  declare const put: {
2
- params: any;
2
+ params: import("yup").ObjectSchema<{
3
+ id: string;
4
+ }, import("yup").AnyObject, {
5
+ id: undefined;
6
+ }, "">;
3
7
  body: any;
4
8
  };
5
9
  export { put };
@@ -5,12 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.put = void 0;
7
7
  const makeOptional_1 = __importDefault(require("../../util/makeOptional"));
8
- const yup_config_1 = require("./../../yup.config");
9
- const paramId = (0, yup_config_1.object)({
10
- id: (0, yup_config_1.string)().required('id is required').oid('id is invalid')
8
+ const yup_1 = require("yup");
9
+ const paramId = (0, yup_1.object)({
10
+ id: (0, yup_1.string)().required('id is required').matches(/^[0-9a-fA-F]{24}$/, 'id is invalid')
11
11
  });
12
- const schema = (0, yup_config_1.object)({
13
- translatedText: (0, yup_config_1.string)().required('translatedText is required'),
12
+ const schema = (0, yup_1.object)({
13
+ translatedText: (0, yup_1.string)().required('translatedText is required'),
14
14
  });
15
15
  //? exports
16
16
  const put = {
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = default_1;
7
- const yup_config_1 = __importDefault(require("./../yup.config"));
7
+ const yup_1 = __importDefault(require("yup"));
8
8
  function default_1(schema) {
9
9
  if (schema.fields) {
10
10
  const shape = {};
11
11
  for (const key in schema.fields) {
12
12
  shape[key] = schema.fields[key].optional();
13
13
  }
14
- return yup_config_1.default.object().shape(shape);
14
+ return yup_1.default.object().shape(shape);
15
15
  }
16
16
  return schema;
17
17
  }
@@ -0,0 +1,2 @@
1
+ import yup from "yup";
2
+ export default yup;
@@ -0,0 +1,24 @@
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
+ const mongoose_1 = require("mongoose");
7
+ const yup_1 = __importDefault(require("yup"));
8
+ yup_1.default.addMethod(yup_1.default.string, "oid", function (errorMessage = "آیدی درست نیست") {
9
+ return this.test({
10
+ name: "oid",
11
+ message: errorMessage,
12
+ test(value) {
13
+ if (!value)
14
+ return true;
15
+ if (value == "$$REMOVE")
16
+ return true;
17
+ if (!value || !(0, mongoose_1.isValidObjectId)(value)) {
18
+ return false; // Invalid ObjectId
19
+ }
20
+ return true; // Valid ObjectId
21
+ },
22
+ });
23
+ });
24
+ exports.default = yup_1.default;
@@ -61,4 +61,7 @@ declare const models: {
61
61
  __v: number;
62
62
  }>>;
63
63
  };
64
- export { auth, db, uploader, validator, models };
64
+ declare const modules: {
65
+ translation: import("express-serve-static-core").Router;
66
+ };
67
+ export { auth, db, uploader, validator, models, modules };
package/dist/esm/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.models = exports.validator = exports.uploader = exports.db = exports.auth = void 0;
6
+ exports.modules = exports.models = exports.validator = exports.uploader = exports.db = exports.auth = void 0;
7
7
  const auth_1 = __importDefault(require("./auth/auth"));
8
8
  exports.auth = auth_1.default;
9
9
  const db_1 = __importDefault(require("./db/db"));
@@ -17,3 +17,4 @@ const translation_routes_1 = __importDefault(require("./modules/translation/tran
17
17
  const models = { translation: translation_1.default };
18
18
  exports.models = models;
19
19
  const modules = { translation: translation_routes_1.default };
20
+ exports.modules = modules;
@@ -1,5 +1,9 @@
1
1
  declare const put: {
2
- params: any;
2
+ params: import("yup").ObjectSchema<{
3
+ id: string;
4
+ }, import("yup").AnyObject, {
5
+ id: undefined;
6
+ }, "">;
3
7
  body: any;
4
8
  };
5
9
  export { put };
@@ -5,12 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.put = void 0;
7
7
  const makeOptional_1 = __importDefault(require("../../util/makeOptional"));
8
- const yup_config_1 = require("./../../yup.config");
9
- const paramId = (0, yup_config_1.object)({
10
- id: (0, yup_config_1.string)().required('id is required').oid('id is invalid')
8
+ const yup_1 = require("yup");
9
+ const paramId = (0, yup_1.object)({
10
+ id: (0, yup_1.string)().required('id is required').matches(/^[0-9a-fA-F]{24}$/, 'id is invalid')
11
11
  });
12
- const schema = (0, yup_config_1.object)({
13
- translatedText: (0, yup_config_1.string)().required('translatedText is required'),
12
+ const schema = (0, yup_1.object)({
13
+ translatedText: (0, yup_1.string)().required('translatedText is required'),
14
14
  });
15
15
  //? exports
16
16
  const put = {
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.default = default_1;
7
- const yup_config_1 = __importDefault(require("./../yup.config"));
7
+ const yup_1 = __importDefault(require("yup"));
8
8
  function default_1(schema) {
9
9
  if (schema.fields) {
10
10
  const shape = {};
11
11
  for (const key in schema.fields) {
12
12
  shape[key] = schema.fields[key].optional();
13
13
  }
14
- return yup_config_1.default.object().shape(shape);
14
+ return yup_1.default.object().shape(shape);
15
15
  }
16
16
  return schema;
17
17
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "speedly",
3
- "version": "1.2.29",
3
+ "version": "1.2.31",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/esm/index.d.ts",