@timardex/cluemart-server-shared 1.0.164 → 1.0.165

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/dist/index.cjs CHANGED
@@ -1697,6 +1697,7 @@ __export(index_exports, {
1697
1697
  SchoolModel: () => SchoolModel,
1698
1698
  SocialMediaTypeSchema: () => SocialMediaTypeSchema,
1699
1699
  StallTypeSchema: () => StallTypeSchema,
1700
+ UnregisteredVendorModel: () => UnregisteredVendorModel,
1700
1701
  UserModel: () => UserModel,
1701
1702
  VendorInfoModel: () => VendorInfoModel,
1702
1703
  VendorModel: () => VendorModel,
@@ -1710,7 +1711,7 @@ __export(index_exports, {
1710
1711
  findEventOrImportedMarketById: () => findEventOrImportedMarketById,
1711
1712
  locationGeoSchema: () => locationGeoSchema,
1712
1713
  locationsSchema: () => locationsSchema,
1713
- mongoose: () => import_mongoose31.default,
1714
+ mongoose: () => import_mongoose32.default,
1714
1715
  refundPolicySchema: () => refundPolicySchema,
1715
1716
  relationDatesSchema: () => relationDatesSchema,
1716
1717
  resourceRelationsSchema: () => resourceRelationsSchema,
@@ -4737,10 +4738,10 @@ var Condition = class _Condition {
4737
4738
  otherwise
4738
4739
  } = config;
4739
4740
  let check = typeof is === "function" ? is : (...values) => values.every((value) => value === is);
4740
- return new _Condition(refs, (values, schema16) => {
4741
+ return new _Condition(refs, (values, schema17) => {
4741
4742
  var _branch;
4742
4743
  let branch = check(...values) ? then : otherwise;
4743
- return (_branch = branch == null ? void 0 : branch(schema16)) != null ? _branch : schema16;
4744
+ return (_branch = branch == null ? void 0 : branch(schema17)) != null ? _branch : schema17;
4744
4745
  });
4745
4746
  }
4746
4747
  constructor(refs, builder) {
@@ -4754,13 +4755,13 @@ var Condition = class _Condition {
4754
4755
  // TODO: ? operator here?
4755
4756
  ref.getValue(options == null ? void 0 : options.value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context)
4756
4757
  ));
4757
- let schema16 = this.fn(values, base, options);
4758
- if (schema16 === void 0 || // @ts-ignore this can be base
4759
- schema16 === base) {
4758
+ let schema17 = this.fn(values, base, options);
4759
+ if (schema17 === void 0 || // @ts-ignore this can be base
4760
+ schema17 === base) {
4760
4761
  return base;
4761
4762
  }
4762
- if (!isSchema(schema16)) throw new TypeError("conditions must return a schema object");
4763
- return schema16.resolve(options);
4763
+ if (!isSchema(schema17)) throw new TypeError("conditions must return a schema object");
4764
+ return schema17.resolve(options);
4764
4765
  }
4765
4766
  };
4766
4767
  var prefixes = {
@@ -4830,7 +4831,7 @@ function createValidation(config) {
4830
4831
  path = "",
4831
4832
  options,
4832
4833
  originalValue,
4833
- schema: schema16
4834
+ schema: schema17
4834
4835
  }, panic, next) {
4835
4836
  const {
4836
4837
  name,
@@ -4842,8 +4843,8 @@ function createValidation(config) {
4842
4843
  let {
4843
4844
  parent,
4844
4845
  context,
4845
- abortEarly = schema16.spec.abortEarly,
4846
- disableStackTrace = schema16.spec.disableStackTrace
4846
+ abortEarly = schema17.spec.abortEarly,
4847
+ disableStackTrace = schema17.spec.disableStackTrace
4847
4848
  } = options;
4848
4849
  function resolve(item) {
4849
4850
  return Reference.isRef(item) ? item.getValue(value, parent, context) : item;
@@ -4852,9 +4853,9 @@ function createValidation(config) {
4852
4853
  const nextParams = Object.assign({
4853
4854
  value,
4854
4855
  originalValue,
4855
- label: schema16.spec.label,
4856
+ label: schema17.spec.label,
4856
4857
  path: overrides.path || path,
4857
- spec: schema16.spec,
4858
+ spec: schema17.spec,
4858
4859
  disableStackTrace: overrides.disableStackTrace || disableStackTrace
4859
4860
  }, params, overrides.params);
4860
4861
  for (const key of Object.keys(nextParams)) nextParams[key] = resolve(nextParams[key]);
@@ -4872,7 +4873,7 @@ function createValidation(config) {
4872
4873
  resolve,
4873
4874
  options,
4874
4875
  originalValue,
4875
- schema: schema16
4876
+ schema: schema17
4876
4877
  };
4877
4878
  const handleResult = (validOrError) => {
4878
4879
  if (ValidationError.isError(validOrError)) invalid(validOrError);
@@ -4906,42 +4907,42 @@ function createValidation(config) {
4906
4907
  validate.OPTIONS = config;
4907
4908
  return validate;
4908
4909
  }
4909
- function getIn(schema16, path, value, context = value) {
4910
+ function getIn(schema17, path, value, context = value) {
4910
4911
  let parent, lastPart, lastPartDebug;
4911
4912
  if (!path) return {
4912
4913
  parent,
4913
4914
  parentPath: path,
4914
- schema: schema16
4915
+ schema: schema17
4915
4916
  };
4916
4917
  (0, import_property_expr.forEach)(path, (_part, isBracket, isArray) => {
4917
4918
  let part = isBracket ? _part.slice(1, _part.length - 1) : _part;
4918
- schema16 = schema16.resolve({
4919
+ schema17 = schema17.resolve({
4919
4920
  context,
4920
4921
  parent,
4921
4922
  value
4922
4923
  });
4923
- let isTuple = schema16.type === "tuple";
4924
+ let isTuple = schema17.type === "tuple";
4924
4925
  let idx = isArray ? parseInt(part, 10) : 0;
4925
- if (schema16.innerType || isTuple) {
4926
+ if (schema17.innerType || isTuple) {
4926
4927
  if (isTuple && !isArray) throw new Error(`Yup.reach cannot implicitly index into a tuple type. the path part "${lastPartDebug}" must contain an index to the tuple element, e.g. "${lastPartDebug}[0]"`);
4927
4928
  if (value && idx >= value.length) {
4928
4929
  throw new Error(`Yup.reach cannot resolve an array item at index: ${_part}, in the path: ${path}. because there is no value at that index. `);
4929
4930
  }
4930
4931
  parent = value;
4931
4932
  value = value && value[idx];
4932
- schema16 = isTuple ? schema16.spec.types[idx] : schema16.innerType;
4933
+ schema17 = isTuple ? schema17.spec.types[idx] : schema17.innerType;
4933
4934
  }
4934
4935
  if (!isArray) {
4935
- if (!schema16.fields || !schema16.fields[part]) throw new Error(`The schema does not contain the path: ${path}. (failed at: ${lastPartDebug} which is a type: "${schema16.type}")`);
4936
+ if (!schema17.fields || !schema17.fields[part]) throw new Error(`The schema does not contain the path: ${path}. (failed at: ${lastPartDebug} which is a type: "${schema17.type}")`);
4936
4937
  parent = value;
4937
4938
  value = value && value[part];
4938
- schema16 = schema16.fields[part];
4939
+ schema17 = schema17.fields[part];
4939
4940
  }
4940
4941
  lastPart = part;
4941
4942
  lastPartDebug = isBracket ? "[" + _part + "]" : "." + _part;
4942
4943
  });
4943
4944
  return {
4944
- schema: schema16,
4945
+ schema: schema17,
4945
4946
  parent,
4946
4947
  parentPath: lastPart
4947
4948
  };
@@ -5078,20 +5079,20 @@ var Schema = class {
5078
5079
  this._mutate = before;
5079
5080
  return result;
5080
5081
  }
5081
- concat(schema16) {
5082
- if (!schema16 || schema16 === this) return this;
5083
- if (schema16.type !== this.type && this.type !== "mixed") throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${schema16.type}`);
5082
+ concat(schema17) {
5083
+ if (!schema17 || schema17 === this) return this;
5084
+ if (schema17.type !== this.type && this.type !== "mixed") throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${schema17.type}`);
5084
5085
  let base = this;
5085
- let combined = schema16.clone();
5086
+ let combined = schema17.clone();
5086
5087
  const mergedSpec = Object.assign({}, base.spec, combined.spec);
5087
5088
  combined.spec = mergedSpec;
5088
5089
  combined.internalTests = Object.assign({}, base.internalTests, combined.internalTests);
5089
- combined._whitelist = base._whitelist.merge(schema16._whitelist, schema16._blacklist);
5090
- combined._blacklist = base._blacklist.merge(schema16._blacklist, schema16._whitelist);
5090
+ combined._whitelist = base._whitelist.merge(schema17._whitelist, schema17._blacklist);
5091
+ combined._blacklist = base._blacklist.merge(schema17._blacklist, schema17._whitelist);
5091
5092
  combined.tests = base.tests;
5092
5093
  combined.exclusiveTests = base.exclusiveTests;
5093
5094
  combined.withMutation((next) => {
5094
- schema16.tests.forEach((fn) => {
5095
+ schema17.tests.forEach((fn) => {
5095
5096
  next.test(fn.OPTIONS);
5096
5097
  });
5097
5098
  });
@@ -5107,15 +5108,15 @@ var Schema = class {
5107
5108
  return this._typeCheck(v);
5108
5109
  }
5109
5110
  resolve(options) {
5110
- let schema16 = this;
5111
- if (schema16.conditions.length) {
5112
- let conditions = schema16.conditions;
5113
- schema16 = schema16.clone();
5114
- schema16.conditions = [];
5115
- schema16 = conditions.reduce((prevSchema, condition) => condition.resolve(prevSchema, options), schema16);
5116
- schema16 = schema16.resolve(options);
5111
+ let schema17 = this;
5112
+ if (schema17.conditions.length) {
5113
+ let conditions = schema17.conditions;
5114
+ schema17 = schema17.clone();
5115
+ schema17.conditions = [];
5116
+ schema17 = conditions.reduce((prevSchema, condition) => condition.resolve(prevSchema, options), schema17);
5117
+ schema17 = schema17.resolve(options);
5117
5118
  }
5118
- return schema16;
5119
+ return schema17;
5119
5120
  }
5120
5121
  resolveOptions(options) {
5121
5122
  var _options$strict, _options$abortEarly, _options$recursive, _options$disableStack;
@@ -5269,11 +5270,11 @@ attempted value: ${formattedValue}
5269
5270
  }
5270
5271
  validate(value, options) {
5271
5272
  var _options$disableStack2;
5272
- let schema16 = this.resolve(Object.assign({}, options, {
5273
+ let schema17 = this.resolve(Object.assign({}, options, {
5273
5274
  value
5274
5275
  }));
5275
- let disableStackTrace = (_options$disableStack2 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack2 : schema16.spec.disableStackTrace;
5276
- return new Promise((resolve, reject) => schema16._validate(value, options, (error, parsed) => {
5276
+ let disableStackTrace = (_options$disableStack2 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack2 : schema17.spec.disableStackTrace;
5277
+ return new Promise((resolve, reject) => schema17._validate(value, options, (error, parsed) => {
5277
5278
  if (ValidationError.isError(error)) error.value = parsed;
5278
5279
  reject(error);
5279
5280
  }, (errors, validated) => {
@@ -5283,12 +5284,12 @@ attempted value: ${formattedValue}
5283
5284
  }
5284
5285
  validateSync(value, options) {
5285
5286
  var _options$disableStack3;
5286
- let schema16 = this.resolve(Object.assign({}, options, {
5287
+ let schema17 = this.resolve(Object.assign({}, options, {
5287
5288
  value
5288
5289
  }));
5289
5290
  let result;
5290
- let disableStackTrace = (_options$disableStack3 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack3 : schema16.spec.disableStackTrace;
5291
- schema16._validate(value, Object.assign({}, options, {
5291
+ let disableStackTrace = (_options$disableStack3 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack3 : schema17.spec.disableStackTrace;
5292
+ schema17._validate(value, Object.assign({}, options, {
5292
5293
  sync: true
5293
5294
  }), (error, parsed) => {
5294
5295
  if (ValidationError.isError(error)) error.value = parsed;
@@ -5322,8 +5323,8 @@ attempted value: ${formattedValue}
5322
5323
  return typeof defaultValue === "function" ? defaultValue.call(this, options) : clone(defaultValue);
5323
5324
  }
5324
5325
  getDefault(options) {
5325
- let schema16 = this.resolve(options || {});
5326
- return schema16._getDefault(options);
5326
+ let schema17 = this.resolve(options || {});
5327
+ return schema17._getDefault(options);
5327
5328
  }
5328
5329
  default(def) {
5329
5330
  if (arguments.length === 0) {
@@ -5558,9 +5559,9 @@ for (const method of ["validate", "validateSync"]) Schema.prototype[`${method}At
5558
5559
  const {
5559
5560
  parent,
5560
5561
  parentPath,
5561
- schema: schema16
5562
+ schema: schema17
5562
5563
  } = getIn(this, path, value, options.context);
5563
- return schema16[method](parent && parent[parentPath], Object.assign({}, options, {
5564
+ return schema17[method](parent && parent[parentPath], Object.assign({}, options, {
5564
5565
  parent,
5565
5566
  path
5566
5567
  }));
@@ -5734,7 +5735,7 @@ var StringSchema = class extends Schema {
5734
5735
  });
5735
5736
  }
5736
5737
  required(message) {
5737
- return super.required(message).withMutation((schema16) => schema16.test({
5738
+ return super.required(message).withMutation((schema17) => schema17.test({
5738
5739
  message: message || mixed.required,
5739
5740
  name: "required",
5740
5741
  skipAbsent: true,
@@ -5742,9 +5743,9 @@ var StringSchema = class extends Schema {
5742
5743
  }));
5743
5744
  }
5744
5745
  notRequired() {
5745
- return super.notRequired().withMutation((schema16) => {
5746
- schema16.tests = schema16.tests.filter((t) => t.OPTIONS.name !== "required");
5747
- return schema16;
5746
+ return super.notRequired().withMutation((schema17) => {
5747
+ schema17.tests = schema17.tests.filter((t) => t.OPTIONS.name !== "required");
5748
+ return schema17;
5748
5749
  });
5749
5750
  }
5750
5751
  length(length, message = string.length) {
@@ -6133,28 +6134,28 @@ var parseJson = (value, _, ctx) => {
6133
6134
  }
6134
6135
  return ctx.isType(parsed) ? parsed : value;
6135
6136
  };
6136
- function deepPartial(schema16) {
6137
- if ("fields" in schema16) {
6137
+ function deepPartial(schema17) {
6138
+ if ("fields" in schema17) {
6138
6139
  const partial = {};
6139
- for (const [key, fieldSchema] of Object.entries(schema16.fields)) {
6140
+ for (const [key, fieldSchema] of Object.entries(schema17.fields)) {
6140
6141
  partial[key] = deepPartial(fieldSchema);
6141
6142
  }
6142
- return schema16.setFields(partial);
6143
+ return schema17.setFields(partial);
6143
6144
  }
6144
- if (schema16.type === "array") {
6145
- const nextArray = schema16.optional();
6145
+ if (schema17.type === "array") {
6146
+ const nextArray = schema17.optional();
6146
6147
  if (nextArray.innerType) nextArray.innerType = deepPartial(nextArray.innerType);
6147
6148
  return nextArray;
6148
6149
  }
6149
- if (schema16.type === "tuple") {
6150
- return schema16.optional().clone({
6151
- types: schema16.spec.types.map(deepPartial)
6150
+ if (schema17.type === "tuple") {
6151
+ return schema17.optional().clone({
6152
+ types: schema17.spec.types.map(deepPartial)
6152
6153
  });
6153
6154
  }
6154
- if ("optional" in schema16) {
6155
- return schema16.optional();
6155
+ if ("optional" in schema17) {
6156
+ return schema17.optional();
6156
6157
  }
6157
- return schema16;
6158
+ return schema17;
6158
6159
  }
6159
6160
  var deepHas = (obj, p) => {
6160
6161
  const path = [...(0, import_property_expr.normalizePath)(p)];
@@ -6288,8 +6289,8 @@ var ObjectSchema = class extends Schema {
6288
6289
  next._sortErrors = this._sortErrors;
6289
6290
  return next;
6290
6291
  }
6291
- concat(schema16) {
6292
- let next = super.concat(schema16);
6292
+ concat(schema17) {
6293
+ let next = super.concat(schema17);
6293
6294
  let nextFields = next.fields;
6294
6295
  for (let [field, schemaOrRef] of Object.entries(this.fields)) {
6295
6296
  const target = nextFields[field];
@@ -6297,7 +6298,7 @@ var ObjectSchema = class extends Schema {
6297
6298
  }
6298
6299
  return next.withMutation((s) => (
6299
6300
  // XXX: excludes here is wrong
6300
- s.setFields(nextFields, [...this._excludedEdges, ...schema16._excludedEdges])
6301
+ s.setFields(nextFields, [...this._excludedEdges, ...schema17._excludedEdges])
6301
6302
  ));
6302
6303
  }
6303
6304
  _getDefault(options) {
@@ -6342,8 +6343,8 @@ var ObjectSchema = class extends Schema {
6342
6343
  }
6343
6344
  partial() {
6344
6345
  const partial = {};
6345
- for (const [key, schema16] of Object.entries(this.fields)) {
6346
- partial[key] = "optional" in schema16 && schema16.optional instanceof Function ? schema16.optional() : schema16;
6346
+ for (const [key, schema17] of Object.entries(this.fields)) {
6347
+ partial[key] = "optional" in schema17 && schema17.optional instanceof Function ? schema17.optional() : schema17;
6347
6348
  }
6348
6349
  return this.setFields(partial);
6349
6350
  }
@@ -6541,22 +6542,22 @@ var ArraySchema = class extends Schema {
6541
6542
  json() {
6542
6543
  return this.transform(parseJson);
6543
6544
  }
6544
- concat(schema16) {
6545
- let next = super.concat(schema16);
6545
+ concat(schema17) {
6546
+ let next = super.concat(schema17);
6546
6547
  next.innerType = this.innerType;
6547
- if (schema16.innerType)
6548
+ if (schema17.innerType)
6548
6549
  next.innerType = next.innerType ? (
6549
6550
  // @ts-expect-error Lazy doesn't have concat and will break
6550
- next.innerType.concat(schema16.innerType)
6551
- ) : schema16.innerType;
6551
+ next.innerType.concat(schema17.innerType)
6552
+ ) : schema17.innerType;
6552
6553
  return next;
6553
6554
  }
6554
- of(schema16) {
6555
+ of(schema17) {
6555
6556
  let next = this.clone();
6556
- if (!isSchema(schema16)) throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: " + printValue(schema16));
6557
- next.innerType = schema16;
6557
+ if (!isSchema(schema17)) throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: " + printValue(schema17));
6558
+ next.innerType = schema17;
6558
6559
  next.spec = Object.assign({}, next.spec, {
6559
- types: schema16
6560
+ types: schema17
6560
6561
  });
6561
6562
  return next;
6562
6563
  }
@@ -6700,7 +6701,7 @@ var TupleSchema = class extends Schema {
6700
6701
  describe(options) {
6701
6702
  const next = (options ? this.resolve(options) : this).clone();
6702
6703
  const base = super.describe(options);
6703
- base.innerType = next.spec.types.map((schema16, index) => {
6704
+ base.innerType = next.spec.types.map((schema17, index) => {
6704
6705
  var _innerOptions;
6705
6706
  let innerOptions = options;
6706
6707
  if ((_innerOptions = innerOptions) != null && _innerOptions.value) {
@@ -6709,7 +6710,7 @@ var TupleSchema = class extends Schema {
6709
6710
  value: innerOptions.value[index]
6710
6711
  });
6711
6712
  }
6712
- return schema16.describe(innerOptions);
6713
+ return schema17.describe(innerOptions);
6713
6714
  });
6714
6715
  return base;
6715
6716
  }
@@ -10602,7 +10603,7 @@ var stallTypesSchema = create$3({
10602
10603
  "",
10603
10604
  noLeadingZeros("Stall price", { allowDecimal: true })
10604
10605
  ),
10605
- stallCapacity: create$5().label("Stall Capacity").typeError("Stall capacity must be a number").min(1, "Stall capacity must be at least 1").integer("Stall capacity must be a whole number").required("Stall capacity is required").test("no-leading-zeros", "", noLeadingZeros("Stall capacity"))
10606
+ stallCapacity: create$5().label("Stall Capacity").typeError("Stall capacity must be a number").min(0, "Stall capacity cannot be negative").integer("Stall capacity must be a whole number").required("Stall capacity is required").test("no-leading-zeros", "", noLeadingZeros("Stall capacity"))
10606
10607
  });
10607
10608
  var dateTimeWithPriceSchema = dateTimeSchema.shape({
10608
10609
  stallTypes: create$2().of(stallTypesSchema).min(1, "At least one stall type is required").required("Stall types are required")
@@ -10629,7 +10630,7 @@ var socialMediaSchema = create$3({
10629
10630
  is: (name) => !!name,
10630
10631
  // If name has a value
10631
10632
  then: () => normalizedUrlTransform().required("Link is required when name is set").url("Link must be a valid URL").label("Social Media Link"),
10632
- otherwise: (schema16) => schema16.notRequired()
10633
+ otherwise: (schema17) => schema17.notRequired()
10633
10634
  })
10634
10635
  });
10635
10636
  var globalResourceSchema = create$3().shape({
@@ -10705,21 +10706,21 @@ var paymentInfoSchema = create$3({
10705
10706
  ).required("Please select a Payment method"),
10706
10707
  accountHolderName: create$6().when("paymentMethod", {
10707
10708
  is: "bank_transfer",
10708
- then: (schema16) => schema16.required("Account holder name is required for bank transfer").trim(),
10709
- otherwise: (schema16) => schema16.notRequired()
10709
+ then: (schema17) => schema17.required("Account holder name is required for bank transfer").trim(),
10710
+ otherwise: (schema17) => schema17.notRequired()
10710
10711
  }),
10711
10712
  accountNumber: create$6().when("paymentMethod", {
10712
10713
  is: "bank_transfer",
10713
- then: (schema16) => schema16.required("Account number is required for bank transfer").matches(
10714
+ then: (schema17) => schema17.required("Account number is required for bank transfer").matches(
10714
10715
  nzBankAccountRegex,
10715
10716
  "Account number must be in format: XX-XXXX-XXXXXXX-XX"
10716
10717
  ).trim(),
10717
- otherwise: (schema16) => schema16.notRequired()
10718
+ otherwise: (schema17) => schema17.notRequired()
10718
10719
  }),
10719
10720
  link: create$6().when("paymentMethod", {
10720
10721
  is: (val) => val === "paypal" || val === "stripe",
10721
10722
  then: () => normalizedUrlTransform().url("Link must be a valid URL").required("Link is required for PayPal/Stripe"),
10722
- otherwise: (schema16) => schema16.notRequired()
10723
+ otherwise: (schema17) => schema17.notRequired()
10723
10724
  })
10724
10725
  });
10725
10726
  var eventInfoSchema = create$3().shape({
@@ -10869,8 +10870,8 @@ var userSchema = create$3().shape({
10869
10870
  confirmPassword: create$6().nullable().trim().label("Confirm Password").when("password", {
10870
10871
  is: (val) => !!val,
10871
10872
  // only necessary if password typed
10872
- then: (schema16) => schema16.required("Confirm Password is required").oneOf([create$9("password")], "Passwords must match"),
10873
- otherwise: (schema16) => schema16.notRequired()
10873
+ then: (schema17) => schema17.required("Confirm Password is required").oneOf([create$9("password")], "Passwords must match"),
10874
+ otherwise: (schema17) => schema17.notRequired()
10874
10875
  }),
10875
10876
  role: create$8().oneOf(Object.values(EnumUserRole)).required("Role is required")
10876
10877
  });
@@ -10941,7 +10942,7 @@ var adSchema = create$3().shape({
10941
10942
  return endDate > now;
10942
10943
  }).when("start", {
10943
10944
  is: (val) => val && val.length > 0,
10944
- then: (schema16) => schema16.test(
10945
+ then: (schema17) => schema17.test(
10945
10946
  "is-after-start",
10946
10947
  "End date must be after start date",
10947
10948
  function(value) {
@@ -12217,7 +12218,7 @@ var schema9 = new MongooseSchema13(
12217
12218
  required: false,
12218
12219
  type: calendarWrapperSchema
12219
12220
  },
12220
- categories: [CategorySchema],
12221
+ categories: { required: true, type: [CategorySchema] },
12221
12222
  foodTruck: { required: true, type: Boolean },
12222
12223
  products: { required: false, type: productWrapperSchema },
12223
12224
  relations: {
@@ -12296,19 +12297,47 @@ var schema10 = new MongooseSchema14(
12296
12297
  );
12297
12298
  var VendorInfoModel = import_mongoose14.default.models.VendorInfo || import_mongoose14.default.model("VendorInfo", schema10);
12298
12299
 
12299
- // src/mongoose/event/Event.ts
12300
+ // src/mongoose/vendor/UnregisteredVendor.ts
12300
12301
  var import_mongoose15 = __toESM(require("mongoose"));
12301
12302
  var MongooseSchema15 = import_mongoose15.default.Schema;
12303
+ var invitationSchema = new MongooseSchema15(
12304
+ {
12305
+ dateTime: { required: true, type: [dateTimeSchema3] },
12306
+ eventId: {
12307
+ ref: "Event",
12308
+ required: true,
12309
+ type: String
12310
+ }
12311
+ },
12312
+ { _id: false }
12313
+ );
12302
12314
  var schema11 = new MongooseSchema15(
12315
+ {
12316
+ categoryIds: { required: true, type: [String] },
12317
+ deletedAt: { default: null, required: false, type: Date },
12318
+ email: { required: true, type: String },
12319
+ invitations: { required: true, type: [invitationSchema] },
12320
+ name: { required: true, type: String }
12321
+ },
12322
+ { timestamps: true }
12323
+ );
12324
+ schema11.index({ email: 1 }, { unique: true });
12325
+ schema11.index({ name: 1 });
12326
+ var UnregisteredVendorModel = import_mongoose15.default.models.UnregisteredVendor || import_mongoose15.default.model("UnregisteredVendor", schema11);
12327
+
12328
+ // src/mongoose/event/Event.ts
12329
+ var import_mongoose16 = __toESM(require("mongoose"));
12330
+ var MongooseSchema16 = import_mongoose16.default.Schema;
12331
+ var schema12 = new MongooseSchema16(
12303
12332
  {
12304
12333
  ...baseResourceFields,
12305
12334
  // Importing base resource fields from global.ts
12306
12335
  claimed: { default: true, required: false, type: Boolean },
12307
- dateTime: [dateTimeSchema3],
12336
+ dateTime: { required: true, type: [dateTimeSchema3] },
12308
12337
  eventInfoId: {
12309
12338
  ref: "EventInfo",
12310
12339
  required: false,
12311
- type: import_mongoose15.default.Schema.Types.ObjectId
12340
+ type: import_mongoose16.default.Schema.Types.ObjectId
12312
12341
  },
12313
12342
  eventType: {
12314
12343
  enum: Object.values(EnumEventType),
@@ -12337,18 +12366,18 @@ var schema11 = new MongooseSchema15(
12337
12366
  },
12338
12367
  { timestamps: true }
12339
12368
  );
12340
- schema11.index({ name: 1 });
12341
- schema11.index({ description: 1 });
12342
- schema11.index({ region: 1 });
12343
- schema11.index({ "location.geo": "2dsphere" });
12344
- schema11.index({ tags: 1 });
12345
- schema11.index({ "associates.email": 1 });
12346
- var EventModel = import_mongoose15.default.models.Event || import_mongoose15.default.model("Event", schema11);
12369
+ schema12.index({ name: 1 });
12370
+ schema12.index({ description: 1 });
12371
+ schema12.index({ region: 1 });
12372
+ schema12.index({ "location.geo": "2dsphere" });
12373
+ schema12.index({ tags: 1 });
12374
+ schema12.index({ "associates.email": 1 });
12375
+ var EventModel = import_mongoose16.default.models.Event || import_mongoose16.default.model("Event", schema12);
12347
12376
 
12348
12377
  // src/mongoose/Partner.ts
12349
- var import_mongoose16 = __toESM(require("mongoose"));
12350
- var MongooseSchema16 = import_mongoose16.default.Schema;
12351
- var schema12 = new MongooseSchema16(
12378
+ var import_mongoose17 = __toESM(require("mongoose"));
12379
+ var MongooseSchema17 = import_mongoose17.default.Schema;
12380
+ var schema13 = new MongooseSchema17(
12352
12381
  {
12353
12382
  ...baseResourceFields,
12354
12383
  location: {
@@ -12364,19 +12393,19 @@ var schema12 = new MongooseSchema16(
12364
12393
  },
12365
12394
  { timestamps: true }
12366
12395
  );
12367
- schema12.index({ name: 1 });
12368
- schema12.index({ description: 1 });
12369
- schema12.index({ region: 1 });
12370
- schema12.index({ "location.geo": "2dsphere" });
12371
- schema12.index({ "associates.email": 1 });
12372
- var PartnerModel = import_mongoose16.default.models.Partner || import_mongoose16.default.model("Partner", schema12);
12396
+ schema13.index({ name: 1 });
12397
+ schema13.index({ description: 1 });
12398
+ schema13.index({ region: 1 });
12399
+ schema13.index({ "location.geo": "2dsphere" });
12400
+ schema13.index({ "associates.email": 1 });
12401
+ var PartnerModel = import_mongoose17.default.models.Partner || import_mongoose17.default.model("Partner", schema13);
12373
12402
 
12374
12403
  // src/mongoose/Post.ts
12375
- var import_mongoose17 = __toESM(require("mongoose"));
12376
- var MongooseSchema17 = import_mongoose17.default.Schema;
12377
- var contentSchema = new MongooseSchema17(
12404
+ var import_mongoose18 = __toESM(require("mongoose"));
12405
+ var MongooseSchema18 = import_mongoose18.default.Schema;
12406
+ var contentSchema = new MongooseSchema18(
12378
12407
  {
12379
- contentData: import_mongoose17.Schema.Types.Mixed,
12408
+ contentData: import_mongoose18.Schema.Types.Mixed,
12380
12409
  contentOrder: { required: true, type: Number },
12381
12410
  contentType: {
12382
12411
  enum: Object.values(EnumPostContentType),
@@ -12386,7 +12415,7 @@ var contentSchema = new MongooseSchema17(
12386
12415
  },
12387
12416
  { _id: false }
12388
12417
  );
12389
- var schema13 = new MongooseSchema17(
12418
+ var schema14 = new MongooseSchema18(
12390
12419
  {
12391
12420
  active: { default: true, required: true, type: Boolean },
12392
12421
  caption: { required: true, type: String },
@@ -12422,15 +12451,15 @@ var schema13 = new MongooseSchema17(
12422
12451
  },
12423
12452
  { timestamps: true }
12424
12453
  );
12425
- schema13.index({ title: 1 });
12426
- schema13.index({ tags: 1 });
12427
- var PostModel = import_mongoose17.default.models.Post || import_mongoose17.default.model("Post", schema13);
12454
+ schema14.index({ title: 1 });
12455
+ schema14.index({ tags: 1 });
12456
+ var PostModel = import_mongoose18.default.models.Post || import_mongoose18.default.model("Post", schema14);
12428
12457
 
12429
12458
  // src/mongoose/AppSetting.ts
12430
- var import_mongoose18 = __toESM(require("mongoose"));
12431
- var MongooseSchema18 = import_mongoose18.default.Schema;
12459
+ var import_mongoose19 = __toESM(require("mongoose"));
12460
+ var MongooseSchema19 = import_mongoose19.default.Schema;
12432
12461
  var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
12433
- var AppSettingSchema = new MongooseSchema18(
12462
+ var AppSettingSchema = new MongooseSchema19(
12434
12463
  {
12435
12464
  activeSchoolsStudentCountTotal: {
12436
12465
  default: 0,
@@ -12456,18 +12485,18 @@ var AppSettingSchema = new MongooseSchema18(
12456
12485
  },
12457
12486
  { timestamps: true }
12458
12487
  );
12459
- var AppSettingModel = import_mongoose18.default.models.AppSetting || import_mongoose18.default.model("AppSetting", AppSettingSchema);
12488
+ var AppSettingModel = import_mongoose19.default.models.AppSetting || import_mongoose19.default.model("AppSetting", AppSettingSchema);
12460
12489
 
12461
12490
  // src/mongoose/game/Game.ts
12462
- var import_mongoose22 = __toESM(require("mongoose"));
12491
+ var import_mongoose23 = __toESM(require("mongoose"));
12463
12492
 
12464
12493
  // src/mongoose/game/DailyClue.ts
12465
- var import_mongoose20 = __toESM(require("mongoose"));
12494
+ var import_mongoose21 = __toESM(require("mongoose"));
12466
12495
 
12467
12496
  // src/mongoose/game/utils.ts
12468
- var import_mongoose19 = __toESM(require("mongoose"));
12469
- var MongooseSchema19 = import_mongoose19.default.Schema;
12470
- var schemaGameDate = new MongooseSchema19(
12497
+ var import_mongoose20 = __toESM(require("mongoose"));
12498
+ var MongooseSchema20 = import_mongoose20.default.Schema;
12499
+ var schemaGameDate = new MongooseSchema20(
12471
12500
  {
12472
12501
  endDate: { required: true, type: Date },
12473
12502
  startDate: { required: true, type: Date }
@@ -12476,8 +12505,8 @@ var schemaGameDate = new MongooseSchema19(
12476
12505
  );
12477
12506
 
12478
12507
  // src/mongoose/game/DailyClue.ts
12479
- var MongooseSchema20 = import_mongoose20.default.Schema;
12480
- var schemaLetters = new MongooseSchema20(
12508
+ var MongooseSchema21 = import_mongoose21.default.Schema;
12509
+ var schemaLetters = new MongooseSchema21(
12481
12510
  {
12482
12511
  collected: { required: false, type: [String] },
12483
12512
  solutionShuffled: { required: true, type: [String] }
@@ -12485,14 +12514,14 @@ var schemaLetters = new MongooseSchema20(
12485
12514
  },
12486
12515
  { _id: false }
12487
12516
  );
12488
- var schemaDailyClueBaseGame = new MongooseSchema20(
12517
+ var schemaDailyClueBaseGame = new MongooseSchema21(
12489
12518
  {
12490
12519
  gameDate: { required: true, type: schemaGameDate },
12491
12520
  gameSolution: { required: true, type: String }
12492
12521
  },
12493
12522
  { _id: false }
12494
12523
  );
12495
- var schemaDailyClueGameData = new MongooseSchema20(
12524
+ var schemaDailyClueGameData = new MongooseSchema21(
12496
12525
  {
12497
12526
  gameFields: { required: true, type: schemaDailyClueBaseGame },
12498
12527
  lastFoundDate: { default: null, required: false, type: Date },
@@ -12507,9 +12536,9 @@ var schemaDailyClueGameData = new MongooseSchema20(
12507
12536
  );
12508
12537
 
12509
12538
  // src/mongoose/game/MiniQuiz.ts
12510
- var import_mongoose21 = __toESM(require("mongoose"));
12511
- var MongooseSchema21 = import_mongoose21.default.Schema;
12512
- var schemaMiniQuizAnswer = new MongooseSchema21(
12539
+ var import_mongoose22 = __toESM(require("mongoose"));
12540
+ var MongooseSchema22 = import_mongoose22.default.Schema;
12541
+ var schemaMiniQuizAnswer = new MongooseSchema22(
12513
12542
  {
12514
12543
  answer: { required: true, type: String },
12515
12544
  answerId: { required: true, type: String },
@@ -12517,7 +12546,7 @@ var schemaMiniQuizAnswer = new MongooseSchema21(
12517
12546
  },
12518
12547
  { _id: false }
12519
12548
  );
12520
- var schemaMiniQuizQuestion = new MongooseSchema21(
12549
+ var schemaMiniQuizQuestion = new MongooseSchema22(
12521
12550
  {
12522
12551
  answers: { required: true, type: [schemaMiniQuizAnswer] },
12523
12552
  question: { required: true, type: String },
@@ -12525,20 +12554,20 @@ var schemaMiniQuizQuestion = new MongooseSchema21(
12525
12554
  },
12526
12555
  { _id: false }
12527
12556
  );
12528
- var schemaMiniQuizBaseGame = new MongooseSchema21(
12557
+ var schemaMiniQuizBaseGame = new MongooseSchema22(
12529
12558
  {
12530
12559
  questions: { required: true, type: [schemaMiniQuizQuestion] }
12531
12560
  },
12532
12561
  { _id: false }
12533
12562
  );
12534
- var schemaMiniQuizAnsweredQuestion = new MongooseSchema21(
12563
+ var schemaMiniQuizAnsweredQuestion = new MongooseSchema22(
12535
12564
  {
12536
12565
  questionId: { required: true, type: String },
12537
12566
  selectedAnswerId: { required: true, type: String }
12538
12567
  },
12539
12568
  { _id: false }
12540
12569
  );
12541
- var schemaMiniQuizGameData = new MongooseSchema21(
12570
+ var schemaMiniQuizGameData = new MongooseSchema22(
12542
12571
  {
12543
12572
  answeredQuestions: {
12544
12573
  default: null,
@@ -12553,18 +12582,18 @@ var schemaMiniQuizGameData = new MongooseSchema21(
12553
12582
  );
12554
12583
 
12555
12584
  // src/mongoose/game/Game.ts
12556
- var MongooseSchema22 = import_mongoose22.default.Schema;
12585
+ var MongooseSchema23 = import_mongoose23.default.Schema;
12557
12586
  var gameDataSchemas = {
12558
12587
  [EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
12559
12588
  [EnumGameType.MINI_QUIZ]: schemaMiniQuizGameData
12560
12589
  };
12561
12590
  var gameDataDefinition = Object.fromEntries(
12562
- Object.entries(gameDataSchemas).map(([key, schema16]) => [
12591
+ Object.entries(gameDataSchemas).map(([key, schema17]) => [
12563
12592
  key,
12564
- { default: null, required: false, type: schema16 }
12593
+ { default: null, required: false, type: schema17 }
12565
12594
  ])
12566
12595
  );
12567
- var gameHistorySchema = new MongooseSchema22(
12596
+ var gameHistorySchema = new MongooseSchema23(
12568
12597
  {
12569
12598
  createdAt: { required: true, type: Date },
12570
12599
  gameDate: { required: true, type: schemaGameDate },
@@ -12582,7 +12611,7 @@ var gameHistorySchema = new MongooseSchema22(
12582
12611
  },
12583
12612
  { _id: false }
12584
12613
  );
12585
- var gameTypeSchema = new MongooseSchema22(
12614
+ var gameTypeSchema = new MongooseSchema23(
12586
12615
  {
12587
12616
  active: { default: true, required: true, type: Boolean },
12588
12617
  gameData: gameDataDefinition,
@@ -12596,7 +12625,7 @@ var gameTypeSchema = new MongooseSchema22(
12596
12625
  },
12597
12626
  { timestamps: true }
12598
12627
  );
12599
- var schema14 = new MongooseSchema22(
12628
+ var schema15 = new MongooseSchema23(
12600
12629
  {
12601
12630
  active: { default: false, required: true, type: Boolean },
12602
12631
  deletedAt: { default: null, required: false, type: Date },
@@ -12609,12 +12638,12 @@ var schema14 = new MongooseSchema22(
12609
12638
  },
12610
12639
  { timestamps: true }
12611
12640
  );
12612
- var GameModel = import_mongoose22.default.models.Game || import_mongoose22.default.model("Game", schema14);
12641
+ var GameModel = import_mongoose23.default.models.Game || import_mongoose23.default.model("Game", schema15);
12613
12642
 
12614
12643
  // src/mongoose/School.ts
12615
- var import_mongoose23 = __toESM(require("mongoose"));
12616
- var MongooseSchema23 = import_mongoose23.default.Schema;
12617
- var campaignsSchema = new MongooseSchema23(
12644
+ var import_mongoose24 = __toESM(require("mongoose"));
12645
+ var MongooseSchema24 = import_mongoose24.default.Schema;
12646
+ var campaignsSchema = new MongooseSchema24(
12618
12647
  {
12619
12648
  endDate: { required: true, type: Date },
12620
12649
  name: { required: true, type: String },
@@ -12622,7 +12651,7 @@ var campaignsSchema = new MongooseSchema23(
12622
12651
  },
12623
12652
  { _id: false }
12624
12653
  );
12625
- var schema15 = new MongooseSchema23(
12654
+ var schema16 = new MongooseSchema24(
12626
12655
  {
12627
12656
  // New schools are active by default
12628
12657
  active: { default: true, required: true, type: Boolean },
@@ -12648,10 +12677,10 @@ var schema15 = new MongooseSchema23(
12648
12677
  },
12649
12678
  { timestamps: true }
12650
12679
  );
12651
- var SchoolModel = import_mongoose23.default.models.School || import_mongoose23.default.model("School", schema15);
12680
+ var SchoolModel = import_mongoose24.default.models.School || import_mongoose24.default.model("School", schema16);
12652
12681
 
12653
12682
  // src/service/database.ts
12654
- var import_mongoose24 = __toESM(require("mongoose"));
12683
+ var import_mongoose25 = __toESM(require("mongoose"));
12655
12684
  var connectToDatabase = async ({
12656
12685
  appName,
12657
12686
  dbName,
@@ -12664,7 +12693,7 @@ var connectToDatabase = async ({
12664
12693
  // Fallback to MongoDB Atlas connection string
12665
12694
  `mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
12666
12695
  );
12667
- await import_mongoose24.default.connect(mongoUri);
12696
+ await import_mongoose25.default.connect(mongoUri);
12668
12697
  const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
12669
12698
  console.log(
12670
12699
  `${connectionType} connected from server/src/service/database.ts`
@@ -12843,9 +12872,9 @@ async function updateAdStatuses() {
12843
12872
  }
12844
12873
 
12845
12874
  // src/service/associate.ts
12846
- var import_mongoose26 = __toESM(require("mongoose"));
12875
+ var import_mongoose27 = __toESM(require("mongoose"));
12847
12876
  function normalizeObjectId(id) {
12848
- return typeof id === "string" ? new import_mongoose26.default.Types.ObjectId(id) : id;
12877
+ return typeof id === "string" ? new import_mongoose27.default.Types.ObjectId(id) : id;
12849
12878
  }
12850
12879
  async function getAssociateEmailsForResource({
12851
12880
  normalizedResourceId,
@@ -12997,12 +13026,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
12997
13026
  }
12998
13027
 
12999
13028
  // src/service/objectIdToString.ts
13000
- var import_mongoose29 = __toESM(require("mongoose"));
13029
+ var import_mongoose30 = __toESM(require("mongoose"));
13001
13030
  function convertObjectIdsToStrings(obj) {
13002
13031
  if (obj === null || obj === void 0) {
13003
13032
  return obj;
13004
13033
  }
13005
- if (obj instanceof import_mongoose29.default.Types.ObjectId) {
13034
+ if (obj instanceof import_mongoose30.default.Types.ObjectId) {
13006
13035
  return obj.toString();
13007
13036
  }
13008
13037
  if (Array.isArray(obj)) {
@@ -13046,7 +13075,7 @@ function updateRelationDatesToUnavailable(relationDates, eventDateTime) {
13046
13075
 
13047
13076
  // src/types/index.ts
13048
13077
  var import_express = __toESM(require("express"));
13049
- var import_mongoose31 = __toESM(require("mongoose"));
13078
+ var import_mongoose32 = __toESM(require("mongoose"));
13050
13079
  var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
13051
13080
  EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
13052
13081
  EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
@@ -13080,6 +13109,7 @@ var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
13080
13109
  SchoolModel,
13081
13110
  SocialMediaTypeSchema,
13082
13111
  StallTypeSchema,
13112
+ UnregisteredVendorModel,
13083
13113
  UserModel,
13084
13114
  VendorInfoModel,
13085
13115
  VendorModel,