@timardex/cluemart-server-shared 1.0.86 → 1.0.88

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.
@@ -1670,9 +1670,9 @@ function __extends(d, b) {
1670
1670
  }
1671
1671
  var __assign = function() {
1672
1672
  __assign = Object.assign || function __assign2(t) {
1673
- for (var s2, i = 1, n = arguments.length; i < n; i++) {
1674
- s2 = arguments[i];
1675
- for (var p in s2) if (Object.prototype.hasOwnProperty.call(s2, p)) t[p] = s2[p];
1673
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
1674
+ s = arguments[i];
1675
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
1676
1676
  }
1677
1677
  return t;
1678
1678
  };
@@ -4764,20 +4764,19 @@ function createValidation(config) {
4764
4764
  abortEarly = schema14.spec.abortEarly,
4765
4765
  disableStackTrace = schema14.spec.disableStackTrace
4766
4766
  } = options;
4767
- const resolveOptions = {
4768
- value,
4769
- parent,
4770
- context
4771
- };
4767
+ function resolve(item) {
4768
+ return Reference.isRef(item) ? item.getValue(value, parent, context) : item;
4769
+ }
4772
4770
  function createError(overrides = {}) {
4773
- const nextParams = resolveParams(Object.assign({
4771
+ const nextParams = Object.assign({
4774
4772
  value,
4775
4773
  originalValue,
4776
4774
  label: schema14.spec.label,
4777
4775
  path: overrides.path || path,
4778
4776
  spec: schema14.spec,
4779
4777
  disableStackTrace: overrides.disableStackTrace || disableStackTrace
4780
- }, params, overrides.params), resolveOptions);
4778
+ }, params, overrides.params);
4779
+ for (const key of Object.keys(nextParams)) nextParams[key] = resolve(nextParams[key]);
4781
4780
  const error = new ValidationError(ValidationError.formatError(overrides.message || message, nextParams), value, nextParams.path, overrides.type || name, nextParams.disableStackTrace);
4782
4781
  error.params = nextParams;
4783
4782
  return error;
@@ -4789,9 +4788,7 @@ function createValidation(config) {
4789
4788
  type: name,
4790
4789
  from: options.from,
4791
4790
  createError,
4792
- resolve(item) {
4793
- return resolveMaybeRef(item, resolveOptions);
4794
- },
4791
+ resolve,
4795
4792
  options,
4796
4793
  originalValue,
4797
4794
  schema: schema14
@@ -4828,16 +4825,6 @@ function createValidation(config) {
4828
4825
  validate.OPTIONS = config;
4829
4826
  return validate;
4830
4827
  }
4831
- function resolveParams(params, options) {
4832
- if (!params) return params;
4833
- for (const key of Object.keys(params)) {
4834
- params[key] = resolveMaybeRef(params[key], options);
4835
- }
4836
- return params;
4837
- }
4838
- function resolveMaybeRef(item, options) {
4839
- return Reference.isRef(item) ? item.getValue(options.value, options.parent, options.context) : item;
4840
- }
4841
4828
  function getIn(schema14, path, value, context = value) {
4842
4829
  let parent, lastPart, lastPartDebug;
4843
4830
  if (!path) return {
@@ -4934,69 +4921,6 @@ function clone(src, seen = /* @__PURE__ */ new Map()) {
4934
4921
  }
4935
4922
  return copy;
4936
4923
  }
4937
- function createStandardPath(path) {
4938
- if (!(path != null && path.length)) {
4939
- return void 0;
4940
- }
4941
- const segments = [];
4942
- let currentSegment = "";
4943
- let inBrackets = false;
4944
- let inQuotes = false;
4945
- for (let i = 0; i < path.length; i++) {
4946
- const char = path[i];
4947
- if (char === "[" && !inQuotes) {
4948
- if (currentSegment) {
4949
- segments.push(...currentSegment.split(".").filter(Boolean));
4950
- currentSegment = "";
4951
- }
4952
- inBrackets = true;
4953
- continue;
4954
- }
4955
- if (char === "]" && !inQuotes) {
4956
- if (currentSegment) {
4957
- if (/^\d+$/.test(currentSegment)) {
4958
- segments.push(currentSegment);
4959
- } else {
4960
- segments.push(currentSegment.replace(/^"|"$/g, ""));
4961
- }
4962
- currentSegment = "";
4963
- }
4964
- inBrackets = false;
4965
- continue;
4966
- }
4967
- if (char === '"') {
4968
- inQuotes = !inQuotes;
4969
- continue;
4970
- }
4971
- if (char === "." && !inBrackets && !inQuotes) {
4972
- if (currentSegment) {
4973
- segments.push(currentSegment);
4974
- currentSegment = "";
4975
- }
4976
- continue;
4977
- }
4978
- currentSegment += char;
4979
- }
4980
- if (currentSegment) {
4981
- segments.push(...currentSegment.split(".").filter(Boolean));
4982
- }
4983
- return segments;
4984
- }
4985
- function createStandardIssues(error, parentPath) {
4986
- const path = parentPath ? `${parentPath}.${error.path}` : error.path;
4987
- return error.errors.map((err) => ({
4988
- message: err,
4989
- path: createStandardPath(path)
4990
- }));
4991
- }
4992
- function issuesFromValidationError(error, parentPath) {
4993
- var _error$inner;
4994
- if (!((_error$inner = error.inner) != null && _error$inner.length) && error.errors.length) {
4995
- return createStandardIssues(error, parentPath);
4996
- }
4997
- const path = parentPath ? `${parentPath}.${error.path}` : error.path;
4998
- return error.inner.flatMap((err) => issuesFromValidationError(err, path));
4999
- }
5000
4924
  var Schema = class {
5001
4925
  constructor(options) {
5002
4926
  this.type = void 0;
@@ -5028,8 +4952,8 @@ var Schema = class {
5028
4952
  optional: true,
5029
4953
  coerce: true
5030
4954
  }, options == null ? void 0 : options.spec);
5031
- this.withMutation((s2) => {
5032
- s2.nonNullable();
4955
+ this.withMutation((s) => {
4956
+ s.nonNullable();
5033
4957
  });
5034
4958
  }
5035
4959
  // TODO: remove
@@ -5126,11 +5050,9 @@ var Schema = class {
5126
5050
  * Run the configured transform pipeline over an input value.
5127
5051
  */
5128
5052
  cast(value, options = {}) {
5129
- let resolvedSchema = this.resolve(Object.assign({}, options, {
5053
+ let resolvedSchema = this.resolve(Object.assign({
5130
5054
  value
5131
- // parent: options.parent,
5132
- // context: options.context,
5133
- }));
5055
+ }, options));
5134
5056
  let allowOptionality = options.assert === "ignore-optionality";
5135
5057
  let result = resolvedSchema._cast(value, options);
5136
5058
  if (options.assert !== false && !resolvedSchema.isType(result)) {
@@ -5147,7 +5069,7 @@ attempted value: ${formattedValue}
5147
5069
  return result;
5148
5070
  }
5149
5071
  _cast(rawValue, options) {
5150
- let value = rawValue === void 0 ? rawValue : this.transforms.reduce((prevValue, fn) => fn.call(this, prevValue, rawValue, this, options), rawValue);
5072
+ let value = rawValue === void 0 ? rawValue : this.transforms.reduce((prevValue, fn) => fn.call(this, prevValue, rawValue, this), rawValue);
5151
5073
  if (value === void 0) {
5152
5074
  value = this.getDefault(options);
5153
5075
  }
@@ -5542,41 +5464,13 @@ attempted value: ${formattedValue}
5542
5464
  type: next.type,
5543
5465
  oneOf: next._whitelist.describe(),
5544
5466
  notOneOf: next._blacklist.describe(),
5545
- tests: next.tests.filter((n, idx, list) => list.findIndex((c) => c.OPTIONS.name === n.OPTIONS.name) === idx).map((fn) => {
5546
- const params = fn.OPTIONS.params && options ? resolveParams(Object.assign({}, fn.OPTIONS.params), options) : fn.OPTIONS.params;
5547
- return {
5548
- name: fn.OPTIONS.name,
5549
- params
5550
- };
5551
- })
5467
+ tests: next.tests.map((fn) => ({
5468
+ name: fn.OPTIONS.name,
5469
+ params: fn.OPTIONS.params
5470
+ })).filter((n, idx, list) => list.findIndex((c) => c.name === n.name) === idx)
5552
5471
  };
5553
5472
  return description;
5554
5473
  }
5555
- get ["~standard"]() {
5556
- const schema14 = this;
5557
- const standard = {
5558
- version: 1,
5559
- vendor: "yup",
5560
- async validate(value) {
5561
- try {
5562
- const result = await schema14.validate(value, {
5563
- abortEarly: false
5564
- });
5565
- return {
5566
- value: result
5567
- };
5568
- } catch (err) {
5569
- if (err instanceof ValidationError) {
5570
- return {
5571
- issues: issuesFromValidationError(err)
5572
- };
5573
- }
5574
- throw err;
5575
- }
5576
- }
5577
- };
5578
- return standard;
5579
- }
5580
5474
  };
5581
5475
  Schema.prototype.__isYupSchema__ = true;
5582
5476
  for (const method of ["validate", "validateSync"]) Schema.prototype[`${method}At`] = function(path, value, options = {}) {
@@ -5621,8 +5515,8 @@ var BooleanSchema = class extends Schema {
5621
5515
  }
5622
5516
  });
5623
5517
  this.withMutation(() => {
5624
- this.transform((value, _raw) => {
5625
- if (this.spec.coerce && !this.isType(value)) {
5518
+ this.transform((value, _raw, ctx) => {
5519
+ if (ctx.spec.coerce && !ctx.isType(value)) {
5626
5520
  if (/^(true|1)$/i.test(String(value))) return true;
5627
5521
  if (/^(false|0)$/i.test(String(value))) return false;
5628
5522
  }
@@ -5749,8 +5643,8 @@ var StringSchema = class extends Schema {
5749
5643
  }
5750
5644
  });
5751
5645
  this.withMutation(() => {
5752
- this.transform((value, _raw) => {
5753
- if (!this.spec.coerce || this.isType(value)) return value;
5646
+ this.transform((value, _raw, ctx) => {
5647
+ if (!ctx.spec.coerce || ctx.isType(value)) return value;
5754
5648
  if (Array.isArray(value)) return value;
5755
5649
  const strValue = value != null && value.toString ? value.toString() : value;
5756
5650
  if (strValue === objStringTag) return value;
@@ -5952,15 +5846,15 @@ var NumberSchema = class extends Schema {
5952
5846
  }
5953
5847
  });
5954
5848
  this.withMutation(() => {
5955
- this.transform((value, _raw) => {
5956
- if (!this.spec.coerce) return value;
5849
+ this.transform((value, _raw, ctx) => {
5850
+ if (!ctx.spec.coerce) return value;
5957
5851
  let parsed = value;
5958
5852
  if (typeof parsed === "string") {
5959
5853
  parsed = parsed.replace(/\s/g, "");
5960
5854
  if (parsed === "") return NaN;
5961
5855
  parsed = +parsed;
5962
5856
  }
5963
- if (this.isType(parsed) || parsed === null) return parsed;
5857
+ if (ctx.isType(parsed) || parsed === null) return parsed;
5964
5858
  return parseFloat(parsed);
5965
5859
  });
5966
5860
  });
@@ -6062,8 +5956,8 @@ var DateSchema = class _DateSchema extends Schema {
6062
5956
  }
6063
5957
  });
6064
5958
  this.withMutation(() => {
6065
- this.transform((value, _raw) => {
6066
- if (!this.spec.coerce || this.isType(value) || value === null) return value;
5959
+ this.transform((value, _raw, ctx) => {
5960
+ if (!ctx.spec.coerce || ctx.isType(value) || value === null) return value;
6067
5961
  value = parseIsoDate(value);
6068
5962
  return !isNaN(value) ? new Date(value) : _DateSchema.INVALID_DATE;
6069
5963
  });
@@ -6147,7 +6041,7 @@ function sortByKeyOrder(keys) {
6147
6041
  return findIndex(keys, a) - findIndex(keys, b);
6148
6042
  };
6149
6043
  }
6150
- var parseJson = (value, _, schema14) => {
6044
+ var parseJson = (value, _, ctx) => {
6151
6045
  if (typeof value !== "string") {
6152
6046
  return value;
6153
6047
  }
@@ -6156,7 +6050,7 @@ var parseJson = (value, _, schema14) => {
6156
6050
  parsed = JSON.parse(value);
6157
6051
  } catch (err) {
6158
6052
  }
6159
- return schema14.isType(parsed) ? parsed : value;
6053
+ return ctx.isType(parsed) ? parsed : value;
6160
6054
  };
6161
6055
  function deepPartial(schema14) {
6162
6056
  if ("fields" in schema14) {
@@ -6232,9 +6126,9 @@ var ObjectSchema = class extends Schema {
6232
6126
  for (const prop of props) {
6233
6127
  let field = fields[prop];
6234
6128
  let exists = prop in value;
6235
- let inputValue = value[prop];
6236
6129
  if (field) {
6237
6130
  let fieldValue;
6131
+ let inputValue = value[prop];
6238
6132
  innerOptions.path = (options.path ? `${options.path}.` : "") + prop;
6239
6133
  field = field.resolve({
6240
6134
  value: inputValue,
@@ -6247,14 +6141,17 @@ var ObjectSchema = class extends Schema {
6247
6141
  isChanged = isChanged || prop in value;
6248
6142
  continue;
6249
6143
  }
6250
- fieldValue = !options.__validating || !strict ? field.cast(inputValue, innerOptions) : inputValue;
6144
+ fieldValue = !options.__validating || !strict ? (
6145
+ // TODO: use _cast, this is double resolving
6146
+ field.cast(value[prop], innerOptions)
6147
+ ) : value[prop];
6251
6148
  if (fieldValue !== void 0) {
6252
6149
  intermediateValue[prop] = fieldValue;
6253
6150
  }
6254
6151
  } else if (exists && !strip) {
6255
- intermediateValue[prop] = inputValue;
6152
+ intermediateValue[prop] = value[prop];
6256
6153
  }
6257
- if (exists !== prop in intermediateValue || intermediateValue[prop] !== inputValue) {
6154
+ if (exists !== prop in intermediateValue || intermediateValue[prop] !== value[prop]) {
6258
6155
  isChanged = true;
6259
6156
  }
6260
6157
  }
@@ -6317,9 +6214,9 @@ var ObjectSchema = class extends Schema {
6317
6214
  const target = nextFields[field];
6318
6215
  nextFields[field] = target === void 0 ? schemaOrRef : target;
6319
6216
  }
6320
- return next.withMutation((s2) => (
6217
+ return next.withMutation((s) => (
6321
6218
  // XXX: excludes here is wrong
6322
- s2.setFields(nextFields, [...this._excludedEdges, ...schema14._excludedEdges])
6219
+ s.setFields(nextFields, [...this._excludedEdges, ...schema14._excludedEdges])
6323
6220
  ));
6324
6221
  }
6325
6222
  _getDefault(options) {
@@ -6515,11 +6412,7 @@ var ArraySchema = class extends Schema {
6515
6412
  let isChanged = false;
6516
6413
  const castArray = value.map((v, idx) => {
6517
6414
  const castElement = this.innerType.cast(v, Object.assign({}, _opts, {
6518
- path: `${_opts.path || ""}[${idx}]`,
6519
- parent: value,
6520
- originalValue: v,
6521
- value: v,
6522
- index: idx
6415
+ path: `${_opts.path || ""}[${idx}]`
6523
6416
  }));
6524
6417
  if (castElement !== v) {
6525
6418
  isChanged = true;
@@ -6689,11 +6582,7 @@ var TupleSchema = class extends Schema {
6689
6582
  let isChanged = false;
6690
6583
  const castArray = types.map((type, idx) => {
6691
6584
  const castElement = type.cast(value[idx], Object.assign({}, options, {
6692
- path: `${options.path || ""}[${idx}]`,
6693
- parent: value,
6694
- originalValue: value[idx],
6695
- value: value[idx],
6696
- index: idx
6585
+ path: `${options.path || ""}[${idx}]`
6697
6586
  }));
6698
6587
  if (castElement !== value[idx]) isChanged = true;
6699
6588
  return castElement;
@@ -9134,22 +9023,28 @@ var GET_CHATS_BY_REGION = gql`
9134
9023
  }
9135
9024
  ${CHAT_FIELDS_FRAGMENT}
9136
9025
  `;
9026
+ var CHAT_REPORT_FIELDS_FRAGMENT = gql`
9027
+ fragment ChatReportFields on ReportChatUserType {
9028
+ _id
9029
+ chatId
9030
+ createdAt
9031
+ reason {
9032
+ reasonType
9033
+ details
9034
+ }
9035
+ reportedUserId
9036
+ reporterUserId
9037
+ resolved
9038
+ updatedAt
9039
+ }
9040
+ `;
9137
9041
  var GET_REPORTED_CHAT_USERS = gql`
9138
9042
  query getReportedChatUsers {
9139
9043
  reportedChatUsers {
9140
- _id
9141
- chatId
9142
- createdAt
9143
- reason {
9144
- reasonType
9145
- details
9146
- }
9147
- reportedUserId
9148
- reporterUserId
9149
- resolved
9150
- updatedAt
9044
+ ...ChatReportFields
9151
9045
  }
9152
9046
  }
9047
+ ${CHAT_REPORT_FIELDS_FRAGMENT}
9153
9048
  `;
9154
9049
  var SEND_CHAT_MESSAGE_MUTATION = gql`
9155
9050
  mutation sendChatMessage($_id: ID!, $input: ChatMessageInputType!) {
@@ -9199,9 +9094,10 @@ var MARK_CHAT_MESSAGES_SEEN_MUTATION = gql`
9199
9094
  var REPORT_CHAT_USER_MUTATION = gql`
9200
9095
  mutation reportChatUser($input: ReportChatUserInputType!) {
9201
9096
  reportChatUser(input: $input) {
9202
- success
9097
+ ...ChatReportFields
9203
9098
  }
9204
9099
  }
9100
+ ${CHAT_REPORT_FIELDS_FRAGMENT}
9205
9101
  `;
9206
9102
  var GET_CHAT_MESSAGE = gql`
9207
9103
  subscription {
@@ -10066,6 +9962,10 @@ var POST_FIELDS_FRAGMENT = gql`
10066
9962
  createdAt
10067
9963
  deletedAt
10068
9964
  postType
9965
+ resource {
9966
+ resourceId
9967
+ resourceType
9968
+ }
10069
9969
  tags
10070
9970
  title
10071
9971
  updatedAt
@@ -10769,6 +10669,10 @@ var postSchema = create$3().shape({
10769
10669
  caption: create$6().required(),
10770
10670
  content: create$2().of(postContentSchema).required(),
10771
10671
  postType: create$8().oneOf(Object.values(EnumPostType)).required(),
10672
+ resource: create$3({
10673
+ resourceId: create$6().required(),
10674
+ resourceType: create$8().oneOf(Object.values(EnumResourceType)).required()
10675
+ }).nullable().optional(),
10772
10676
  tags: create$2().of(create$6().required()).nullable().optional(),
10773
10677
  title: create$6().required()
10774
10678
  });
@@ -12182,6 +12086,17 @@ var schema13 = new MongooseSchema18(
12182
12086
  required: true,
12183
12087
  type: String
12184
12088
  },
12089
+ resource: {
12090
+ required: false,
12091
+ type: {
12092
+ resourceId: { required: true, type: String },
12093
+ resourceType: {
12094
+ enum: Object.values(EnumResourceType),
12095
+ required: true,
12096
+ type: String
12097
+ }
12098
+ }
12099
+ },
12185
12100
  tags: { default: [], required: false, type: [String] },
12186
12101
  title: { required: true, type: String }
12187
12102
  },
@@ -12274,4 +12189,4 @@ react/cjs/react.development.js:
12274
12189
  * LICENSE file in the root directory of this source tree.
12275
12190
  *)
12276
12191
  */
12277
- //# sourceMappingURL=chunk-FVFOQT5F.mjs.map
12192
+ //# sourceMappingURL=chunk-H4HID6QS.mjs.map