@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/{chunk-RGSAG3WZ.mjs → chunk-5F477CH2.mjs} +178 -149
- package/dist/chunk-5F477CH2.mjs.map +1 -0
- package/dist/index.cjs +187 -157
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.mjs +185 -156
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +179 -149
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +13 -2
- package/dist/mongoose/index.d.ts +13 -2
- package/dist/mongoose/index.mjs +3 -1
- package/dist/service/index.cjs +181 -153
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-RGSAG3WZ.mjs.map +0 -1
package/dist/service/index.cjs
CHANGED
|
@@ -4722,10 +4722,10 @@ var Condition = class _Condition {
|
|
|
4722
4722
|
otherwise
|
|
4723
4723
|
} = config;
|
|
4724
4724
|
let check = typeof is === "function" ? is : (...values) => values.every((value) => value === is);
|
|
4725
|
-
return new _Condition(refs, (values,
|
|
4725
|
+
return new _Condition(refs, (values, schema17) => {
|
|
4726
4726
|
var _branch;
|
|
4727
4727
|
let branch = check(...values) ? then : otherwise;
|
|
4728
|
-
return (_branch = branch == null ? void 0 : branch(
|
|
4728
|
+
return (_branch = branch == null ? void 0 : branch(schema17)) != null ? _branch : schema17;
|
|
4729
4729
|
});
|
|
4730
4730
|
}
|
|
4731
4731
|
constructor(refs, builder) {
|
|
@@ -4739,13 +4739,13 @@ var Condition = class _Condition {
|
|
|
4739
4739
|
// TODO: ? operator here?
|
|
4740
4740
|
ref.getValue(options == null ? void 0 : options.value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context)
|
|
4741
4741
|
));
|
|
4742
|
-
let
|
|
4743
|
-
if (
|
|
4744
|
-
|
|
4742
|
+
let schema17 = this.fn(values, base, options);
|
|
4743
|
+
if (schema17 === void 0 || // @ts-ignore this can be base
|
|
4744
|
+
schema17 === base) {
|
|
4745
4745
|
return base;
|
|
4746
4746
|
}
|
|
4747
|
-
if (!isSchema(
|
|
4748
|
-
return
|
|
4747
|
+
if (!isSchema(schema17)) throw new TypeError("conditions must return a schema object");
|
|
4748
|
+
return schema17.resolve(options);
|
|
4749
4749
|
}
|
|
4750
4750
|
};
|
|
4751
4751
|
var prefixes = {
|
|
@@ -4815,7 +4815,7 @@ function createValidation(config) {
|
|
|
4815
4815
|
path = "",
|
|
4816
4816
|
options,
|
|
4817
4817
|
originalValue,
|
|
4818
|
-
schema:
|
|
4818
|
+
schema: schema17
|
|
4819
4819
|
}, panic, next) {
|
|
4820
4820
|
const {
|
|
4821
4821
|
name,
|
|
@@ -4827,8 +4827,8 @@ function createValidation(config) {
|
|
|
4827
4827
|
let {
|
|
4828
4828
|
parent,
|
|
4829
4829
|
context,
|
|
4830
|
-
abortEarly =
|
|
4831
|
-
disableStackTrace =
|
|
4830
|
+
abortEarly = schema17.spec.abortEarly,
|
|
4831
|
+
disableStackTrace = schema17.spec.disableStackTrace
|
|
4832
4832
|
} = options;
|
|
4833
4833
|
function resolve(item) {
|
|
4834
4834
|
return Reference.isRef(item) ? item.getValue(value, parent, context) : item;
|
|
@@ -4837,9 +4837,9 @@ function createValidation(config) {
|
|
|
4837
4837
|
const nextParams = Object.assign({
|
|
4838
4838
|
value,
|
|
4839
4839
|
originalValue,
|
|
4840
|
-
label:
|
|
4840
|
+
label: schema17.spec.label,
|
|
4841
4841
|
path: overrides.path || path,
|
|
4842
|
-
spec:
|
|
4842
|
+
spec: schema17.spec,
|
|
4843
4843
|
disableStackTrace: overrides.disableStackTrace || disableStackTrace
|
|
4844
4844
|
}, params, overrides.params);
|
|
4845
4845
|
for (const key of Object.keys(nextParams)) nextParams[key] = resolve(nextParams[key]);
|
|
@@ -4857,7 +4857,7 @@ function createValidation(config) {
|
|
|
4857
4857
|
resolve,
|
|
4858
4858
|
options,
|
|
4859
4859
|
originalValue,
|
|
4860
|
-
schema:
|
|
4860
|
+
schema: schema17
|
|
4861
4861
|
};
|
|
4862
4862
|
const handleResult = (validOrError) => {
|
|
4863
4863
|
if (ValidationError.isError(validOrError)) invalid(validOrError);
|
|
@@ -4891,42 +4891,42 @@ function createValidation(config) {
|
|
|
4891
4891
|
validate.OPTIONS = config;
|
|
4892
4892
|
return validate;
|
|
4893
4893
|
}
|
|
4894
|
-
function getIn(
|
|
4894
|
+
function getIn(schema17, path, value, context = value) {
|
|
4895
4895
|
let parent, lastPart, lastPartDebug;
|
|
4896
4896
|
if (!path) return {
|
|
4897
4897
|
parent,
|
|
4898
4898
|
parentPath: path,
|
|
4899
|
-
schema:
|
|
4899
|
+
schema: schema17
|
|
4900
4900
|
};
|
|
4901
4901
|
(0, import_property_expr.forEach)(path, (_part, isBracket, isArray) => {
|
|
4902
4902
|
let part = isBracket ? _part.slice(1, _part.length - 1) : _part;
|
|
4903
|
-
|
|
4903
|
+
schema17 = schema17.resolve({
|
|
4904
4904
|
context,
|
|
4905
4905
|
parent,
|
|
4906
4906
|
value
|
|
4907
4907
|
});
|
|
4908
|
-
let isTuple =
|
|
4908
|
+
let isTuple = schema17.type === "tuple";
|
|
4909
4909
|
let idx = isArray ? parseInt(part, 10) : 0;
|
|
4910
|
-
if (
|
|
4910
|
+
if (schema17.innerType || isTuple) {
|
|
4911
4911
|
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]"`);
|
|
4912
4912
|
if (value && idx >= value.length) {
|
|
4913
4913
|
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. `);
|
|
4914
4914
|
}
|
|
4915
4915
|
parent = value;
|
|
4916
4916
|
value = value && value[idx];
|
|
4917
|
-
|
|
4917
|
+
schema17 = isTuple ? schema17.spec.types[idx] : schema17.innerType;
|
|
4918
4918
|
}
|
|
4919
4919
|
if (!isArray) {
|
|
4920
|
-
if (!
|
|
4920
|
+
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}")`);
|
|
4921
4921
|
parent = value;
|
|
4922
4922
|
value = value && value[part];
|
|
4923
|
-
|
|
4923
|
+
schema17 = schema17.fields[part];
|
|
4924
4924
|
}
|
|
4925
4925
|
lastPart = part;
|
|
4926
4926
|
lastPartDebug = isBracket ? "[" + _part + "]" : "." + _part;
|
|
4927
4927
|
});
|
|
4928
4928
|
return {
|
|
4929
|
-
schema:
|
|
4929
|
+
schema: schema17,
|
|
4930
4930
|
parent,
|
|
4931
4931
|
parentPath: lastPart
|
|
4932
4932
|
};
|
|
@@ -5063,20 +5063,20 @@ var Schema = class {
|
|
|
5063
5063
|
this._mutate = before;
|
|
5064
5064
|
return result;
|
|
5065
5065
|
}
|
|
5066
|
-
concat(
|
|
5067
|
-
if (!
|
|
5068
|
-
if (
|
|
5066
|
+
concat(schema17) {
|
|
5067
|
+
if (!schema17 || schema17 === this) return this;
|
|
5068
|
+
if (schema17.type !== this.type && this.type !== "mixed") throw new TypeError(`You cannot \`concat()\` schema's of different types: ${this.type} and ${schema17.type}`);
|
|
5069
5069
|
let base = this;
|
|
5070
|
-
let combined =
|
|
5070
|
+
let combined = schema17.clone();
|
|
5071
5071
|
const mergedSpec = Object.assign({}, base.spec, combined.spec);
|
|
5072
5072
|
combined.spec = mergedSpec;
|
|
5073
5073
|
combined.internalTests = Object.assign({}, base.internalTests, combined.internalTests);
|
|
5074
|
-
combined._whitelist = base._whitelist.merge(
|
|
5075
|
-
combined._blacklist = base._blacklist.merge(
|
|
5074
|
+
combined._whitelist = base._whitelist.merge(schema17._whitelist, schema17._blacklist);
|
|
5075
|
+
combined._blacklist = base._blacklist.merge(schema17._blacklist, schema17._whitelist);
|
|
5076
5076
|
combined.tests = base.tests;
|
|
5077
5077
|
combined.exclusiveTests = base.exclusiveTests;
|
|
5078
5078
|
combined.withMutation((next) => {
|
|
5079
|
-
|
|
5079
|
+
schema17.tests.forEach((fn) => {
|
|
5080
5080
|
next.test(fn.OPTIONS);
|
|
5081
5081
|
});
|
|
5082
5082
|
});
|
|
@@ -5092,15 +5092,15 @@ var Schema = class {
|
|
|
5092
5092
|
return this._typeCheck(v);
|
|
5093
5093
|
}
|
|
5094
5094
|
resolve(options) {
|
|
5095
|
-
let
|
|
5096
|
-
if (
|
|
5097
|
-
let conditions =
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5095
|
+
let schema17 = this;
|
|
5096
|
+
if (schema17.conditions.length) {
|
|
5097
|
+
let conditions = schema17.conditions;
|
|
5098
|
+
schema17 = schema17.clone();
|
|
5099
|
+
schema17.conditions = [];
|
|
5100
|
+
schema17 = conditions.reduce((prevSchema, condition) => condition.resolve(prevSchema, options), schema17);
|
|
5101
|
+
schema17 = schema17.resolve(options);
|
|
5102
5102
|
}
|
|
5103
|
-
return
|
|
5103
|
+
return schema17;
|
|
5104
5104
|
}
|
|
5105
5105
|
resolveOptions(options) {
|
|
5106
5106
|
var _options$strict, _options$abortEarly, _options$recursive, _options$disableStack;
|
|
@@ -5254,11 +5254,11 @@ attempted value: ${formattedValue}
|
|
|
5254
5254
|
}
|
|
5255
5255
|
validate(value, options) {
|
|
5256
5256
|
var _options$disableStack2;
|
|
5257
|
-
let
|
|
5257
|
+
let schema17 = this.resolve(Object.assign({}, options, {
|
|
5258
5258
|
value
|
|
5259
5259
|
}));
|
|
5260
|
-
let disableStackTrace = (_options$disableStack2 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack2 :
|
|
5261
|
-
return new Promise((resolve, reject) =>
|
|
5260
|
+
let disableStackTrace = (_options$disableStack2 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack2 : schema17.spec.disableStackTrace;
|
|
5261
|
+
return new Promise((resolve, reject) => schema17._validate(value, options, (error, parsed) => {
|
|
5262
5262
|
if (ValidationError.isError(error)) error.value = parsed;
|
|
5263
5263
|
reject(error);
|
|
5264
5264
|
}, (errors, validated) => {
|
|
@@ -5268,12 +5268,12 @@ attempted value: ${formattedValue}
|
|
|
5268
5268
|
}
|
|
5269
5269
|
validateSync(value, options) {
|
|
5270
5270
|
var _options$disableStack3;
|
|
5271
|
-
let
|
|
5271
|
+
let schema17 = this.resolve(Object.assign({}, options, {
|
|
5272
5272
|
value
|
|
5273
5273
|
}));
|
|
5274
5274
|
let result;
|
|
5275
|
-
let disableStackTrace = (_options$disableStack3 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack3 :
|
|
5276
|
-
|
|
5275
|
+
let disableStackTrace = (_options$disableStack3 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack3 : schema17.spec.disableStackTrace;
|
|
5276
|
+
schema17._validate(value, Object.assign({}, options, {
|
|
5277
5277
|
sync: true
|
|
5278
5278
|
}), (error, parsed) => {
|
|
5279
5279
|
if (ValidationError.isError(error)) error.value = parsed;
|
|
@@ -5307,8 +5307,8 @@ attempted value: ${formattedValue}
|
|
|
5307
5307
|
return typeof defaultValue === "function" ? defaultValue.call(this, options) : clone(defaultValue);
|
|
5308
5308
|
}
|
|
5309
5309
|
getDefault(options) {
|
|
5310
|
-
let
|
|
5311
|
-
return
|
|
5310
|
+
let schema17 = this.resolve(options || {});
|
|
5311
|
+
return schema17._getDefault(options);
|
|
5312
5312
|
}
|
|
5313
5313
|
default(def) {
|
|
5314
5314
|
if (arguments.length === 0) {
|
|
@@ -5543,9 +5543,9 @@ for (const method of ["validate", "validateSync"]) Schema.prototype[`${method}At
|
|
|
5543
5543
|
const {
|
|
5544
5544
|
parent,
|
|
5545
5545
|
parentPath,
|
|
5546
|
-
schema:
|
|
5546
|
+
schema: schema17
|
|
5547
5547
|
} = getIn(this, path, value, options.context);
|
|
5548
|
-
return
|
|
5548
|
+
return schema17[method](parent && parent[parentPath], Object.assign({}, options, {
|
|
5549
5549
|
parent,
|
|
5550
5550
|
path
|
|
5551
5551
|
}));
|
|
@@ -5719,7 +5719,7 @@ var StringSchema = class extends Schema {
|
|
|
5719
5719
|
});
|
|
5720
5720
|
}
|
|
5721
5721
|
required(message) {
|
|
5722
|
-
return super.required(message).withMutation((
|
|
5722
|
+
return super.required(message).withMutation((schema17) => schema17.test({
|
|
5723
5723
|
message: message || mixed.required,
|
|
5724
5724
|
name: "required",
|
|
5725
5725
|
skipAbsent: true,
|
|
@@ -5727,9 +5727,9 @@ var StringSchema = class extends Schema {
|
|
|
5727
5727
|
}));
|
|
5728
5728
|
}
|
|
5729
5729
|
notRequired() {
|
|
5730
|
-
return super.notRequired().withMutation((
|
|
5731
|
-
|
|
5732
|
-
return
|
|
5730
|
+
return super.notRequired().withMutation((schema17) => {
|
|
5731
|
+
schema17.tests = schema17.tests.filter((t) => t.OPTIONS.name !== "required");
|
|
5732
|
+
return schema17;
|
|
5733
5733
|
});
|
|
5734
5734
|
}
|
|
5735
5735
|
length(length, message = string.length) {
|
|
@@ -6118,28 +6118,28 @@ var parseJson = (value, _, ctx) => {
|
|
|
6118
6118
|
}
|
|
6119
6119
|
return ctx.isType(parsed) ? parsed : value;
|
|
6120
6120
|
};
|
|
6121
|
-
function deepPartial(
|
|
6122
|
-
if ("fields" in
|
|
6121
|
+
function deepPartial(schema17) {
|
|
6122
|
+
if ("fields" in schema17) {
|
|
6123
6123
|
const partial = {};
|
|
6124
|
-
for (const [key, fieldSchema] of Object.entries(
|
|
6124
|
+
for (const [key, fieldSchema] of Object.entries(schema17.fields)) {
|
|
6125
6125
|
partial[key] = deepPartial(fieldSchema);
|
|
6126
6126
|
}
|
|
6127
|
-
return
|
|
6127
|
+
return schema17.setFields(partial);
|
|
6128
6128
|
}
|
|
6129
|
-
if (
|
|
6130
|
-
const nextArray =
|
|
6129
|
+
if (schema17.type === "array") {
|
|
6130
|
+
const nextArray = schema17.optional();
|
|
6131
6131
|
if (nextArray.innerType) nextArray.innerType = deepPartial(nextArray.innerType);
|
|
6132
6132
|
return nextArray;
|
|
6133
6133
|
}
|
|
6134
|
-
if (
|
|
6135
|
-
return
|
|
6136
|
-
types:
|
|
6134
|
+
if (schema17.type === "tuple") {
|
|
6135
|
+
return schema17.optional().clone({
|
|
6136
|
+
types: schema17.spec.types.map(deepPartial)
|
|
6137
6137
|
});
|
|
6138
6138
|
}
|
|
6139
|
-
if ("optional" in
|
|
6140
|
-
return
|
|
6139
|
+
if ("optional" in schema17) {
|
|
6140
|
+
return schema17.optional();
|
|
6141
6141
|
}
|
|
6142
|
-
return
|
|
6142
|
+
return schema17;
|
|
6143
6143
|
}
|
|
6144
6144
|
var deepHas = (obj, p) => {
|
|
6145
6145
|
const path = [...(0, import_property_expr.normalizePath)(p)];
|
|
@@ -6273,8 +6273,8 @@ var ObjectSchema = class extends Schema {
|
|
|
6273
6273
|
next._sortErrors = this._sortErrors;
|
|
6274
6274
|
return next;
|
|
6275
6275
|
}
|
|
6276
|
-
concat(
|
|
6277
|
-
let next = super.concat(
|
|
6276
|
+
concat(schema17) {
|
|
6277
|
+
let next = super.concat(schema17);
|
|
6278
6278
|
let nextFields = next.fields;
|
|
6279
6279
|
for (let [field, schemaOrRef] of Object.entries(this.fields)) {
|
|
6280
6280
|
const target = nextFields[field];
|
|
@@ -6282,7 +6282,7 @@ var ObjectSchema = class extends Schema {
|
|
|
6282
6282
|
}
|
|
6283
6283
|
return next.withMutation((s) => (
|
|
6284
6284
|
// XXX: excludes here is wrong
|
|
6285
|
-
s.setFields(nextFields, [...this._excludedEdges, ...
|
|
6285
|
+
s.setFields(nextFields, [...this._excludedEdges, ...schema17._excludedEdges])
|
|
6286
6286
|
));
|
|
6287
6287
|
}
|
|
6288
6288
|
_getDefault(options) {
|
|
@@ -6327,8 +6327,8 @@ var ObjectSchema = class extends Schema {
|
|
|
6327
6327
|
}
|
|
6328
6328
|
partial() {
|
|
6329
6329
|
const partial = {};
|
|
6330
|
-
for (const [key,
|
|
6331
|
-
partial[key] = "optional" in
|
|
6330
|
+
for (const [key, schema17] of Object.entries(this.fields)) {
|
|
6331
|
+
partial[key] = "optional" in schema17 && schema17.optional instanceof Function ? schema17.optional() : schema17;
|
|
6332
6332
|
}
|
|
6333
6333
|
return this.setFields(partial);
|
|
6334
6334
|
}
|
|
@@ -6526,22 +6526,22 @@ var ArraySchema = class extends Schema {
|
|
|
6526
6526
|
json() {
|
|
6527
6527
|
return this.transform(parseJson);
|
|
6528
6528
|
}
|
|
6529
|
-
concat(
|
|
6530
|
-
let next = super.concat(
|
|
6529
|
+
concat(schema17) {
|
|
6530
|
+
let next = super.concat(schema17);
|
|
6531
6531
|
next.innerType = this.innerType;
|
|
6532
|
-
if (
|
|
6532
|
+
if (schema17.innerType)
|
|
6533
6533
|
next.innerType = next.innerType ? (
|
|
6534
6534
|
// @ts-expect-error Lazy doesn't have concat and will break
|
|
6535
|
-
next.innerType.concat(
|
|
6536
|
-
) :
|
|
6535
|
+
next.innerType.concat(schema17.innerType)
|
|
6536
|
+
) : schema17.innerType;
|
|
6537
6537
|
return next;
|
|
6538
6538
|
}
|
|
6539
|
-
of(
|
|
6539
|
+
of(schema17) {
|
|
6540
6540
|
let next = this.clone();
|
|
6541
|
-
if (!isSchema(
|
|
6542
|
-
next.innerType =
|
|
6541
|
+
if (!isSchema(schema17)) throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: " + printValue(schema17));
|
|
6542
|
+
next.innerType = schema17;
|
|
6543
6543
|
next.spec = Object.assign({}, next.spec, {
|
|
6544
|
-
types:
|
|
6544
|
+
types: schema17
|
|
6545
6545
|
});
|
|
6546
6546
|
return next;
|
|
6547
6547
|
}
|
|
@@ -6685,7 +6685,7 @@ var TupleSchema = class extends Schema {
|
|
|
6685
6685
|
describe(options) {
|
|
6686
6686
|
const next = (options ? this.resolve(options) : this).clone();
|
|
6687
6687
|
const base = super.describe(options);
|
|
6688
|
-
base.innerType = next.spec.types.map((
|
|
6688
|
+
base.innerType = next.spec.types.map((schema17, index) => {
|
|
6689
6689
|
var _innerOptions;
|
|
6690
6690
|
let innerOptions = options;
|
|
6691
6691
|
if ((_innerOptions = innerOptions) != null && _innerOptions.value) {
|
|
@@ -6694,7 +6694,7 @@ var TupleSchema = class extends Schema {
|
|
|
6694
6694
|
value: innerOptions.value[index]
|
|
6695
6695
|
});
|
|
6696
6696
|
}
|
|
6697
|
-
return
|
|
6697
|
+
return schema17.describe(innerOptions);
|
|
6698
6698
|
});
|
|
6699
6699
|
return base;
|
|
6700
6700
|
}
|
|
@@ -10587,7 +10587,7 @@ var stallTypesSchema = create$3({
|
|
|
10587
10587
|
"",
|
|
10588
10588
|
noLeadingZeros("Stall price", { allowDecimal: true })
|
|
10589
10589
|
),
|
|
10590
|
-
stallCapacity: create$5().label("Stall Capacity").typeError("Stall capacity must be a number").min(
|
|
10590
|
+
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"))
|
|
10591
10591
|
});
|
|
10592
10592
|
var dateTimeWithPriceSchema = dateTimeSchema.shape({
|
|
10593
10593
|
stallTypes: create$2().of(stallTypesSchema).min(1, "At least one stall type is required").required("Stall types are required")
|
|
@@ -10614,7 +10614,7 @@ var socialMediaSchema = create$3({
|
|
|
10614
10614
|
is: (name) => !!name,
|
|
10615
10615
|
// If name has a value
|
|
10616
10616
|
then: () => normalizedUrlTransform().required("Link is required when name is set").url("Link must be a valid URL").label("Social Media Link"),
|
|
10617
|
-
otherwise: (
|
|
10617
|
+
otherwise: (schema17) => schema17.notRequired()
|
|
10618
10618
|
})
|
|
10619
10619
|
});
|
|
10620
10620
|
var globalResourceSchema = create$3().shape({
|
|
@@ -10690,21 +10690,21 @@ var paymentInfoSchema = create$3({
|
|
|
10690
10690
|
).required("Please select a Payment method"),
|
|
10691
10691
|
accountHolderName: create$6().when("paymentMethod", {
|
|
10692
10692
|
is: "bank_transfer",
|
|
10693
|
-
then: (
|
|
10694
|
-
otherwise: (
|
|
10693
|
+
then: (schema17) => schema17.required("Account holder name is required for bank transfer").trim(),
|
|
10694
|
+
otherwise: (schema17) => schema17.notRequired()
|
|
10695
10695
|
}),
|
|
10696
10696
|
accountNumber: create$6().when("paymentMethod", {
|
|
10697
10697
|
is: "bank_transfer",
|
|
10698
|
-
then: (
|
|
10698
|
+
then: (schema17) => schema17.required("Account number is required for bank transfer").matches(
|
|
10699
10699
|
nzBankAccountRegex,
|
|
10700
10700
|
"Account number must be in format: XX-XXXX-XXXXXXX-XX"
|
|
10701
10701
|
).trim(),
|
|
10702
|
-
otherwise: (
|
|
10702
|
+
otherwise: (schema17) => schema17.notRequired()
|
|
10703
10703
|
}),
|
|
10704
10704
|
link: create$6().when("paymentMethod", {
|
|
10705
10705
|
is: (val) => val === "paypal" || val === "stripe",
|
|
10706
10706
|
then: () => normalizedUrlTransform().url("Link must be a valid URL").required("Link is required for PayPal/Stripe"),
|
|
10707
|
-
otherwise: (
|
|
10707
|
+
otherwise: (schema17) => schema17.notRequired()
|
|
10708
10708
|
})
|
|
10709
10709
|
});
|
|
10710
10710
|
var eventInfoSchema = create$3().shape({
|
|
@@ -10854,8 +10854,8 @@ var userSchema = create$3().shape({
|
|
|
10854
10854
|
confirmPassword: create$6().nullable().trim().label("Confirm Password").when("password", {
|
|
10855
10855
|
is: (val) => !!val,
|
|
10856
10856
|
// only necessary if password typed
|
|
10857
|
-
then: (
|
|
10858
|
-
otherwise: (
|
|
10857
|
+
then: (schema17) => schema17.required("Confirm Password is required").oneOf([create$9("password")], "Passwords must match"),
|
|
10858
|
+
otherwise: (schema17) => schema17.notRequired()
|
|
10859
10859
|
}),
|
|
10860
10860
|
role: create$8().oneOf(Object.values(EnumUserRole)).required("Role is required")
|
|
10861
10861
|
});
|
|
@@ -10926,7 +10926,7 @@ var adSchema = create$3().shape({
|
|
|
10926
10926
|
return endDate > now;
|
|
10927
10927
|
}).when("start", {
|
|
10928
10928
|
is: (val) => val && val.length > 0,
|
|
10929
|
-
then: (
|
|
10929
|
+
then: (schema17) => schema17.test(
|
|
10930
10930
|
"is-after-start",
|
|
10931
10931
|
"End date must be after start date",
|
|
10932
10932
|
function(value) {
|
|
@@ -12336,7 +12336,7 @@ var schema9 = new MongooseSchema13(
|
|
|
12336
12336
|
required: false,
|
|
12337
12337
|
type: calendarWrapperSchema
|
|
12338
12338
|
},
|
|
12339
|
-
categories: [CategorySchema],
|
|
12339
|
+
categories: { required: true, type: [CategorySchema] },
|
|
12340
12340
|
foodTruck: { required: true, type: Boolean },
|
|
12341
12341
|
products: { required: false, type: productWrapperSchema },
|
|
12342
12342
|
relations: {
|
|
@@ -12415,19 +12415,47 @@ var schema10 = new MongooseSchema14(
|
|
|
12415
12415
|
);
|
|
12416
12416
|
var VendorInfoModel = import_mongoose15.default.models.VendorInfo || import_mongoose15.default.model("VendorInfo", schema10);
|
|
12417
12417
|
|
|
12418
|
-
// src/mongoose/
|
|
12418
|
+
// src/mongoose/vendor/UnregisteredVendor.ts
|
|
12419
12419
|
var import_mongoose16 = __toESM(require("mongoose"));
|
|
12420
12420
|
var MongooseSchema15 = import_mongoose16.default.Schema;
|
|
12421
|
+
var invitationSchema = new MongooseSchema15(
|
|
12422
|
+
{
|
|
12423
|
+
dateTime: { required: true, type: [dateTimeSchema3] },
|
|
12424
|
+
eventId: {
|
|
12425
|
+
ref: "Event",
|
|
12426
|
+
required: true,
|
|
12427
|
+
type: String
|
|
12428
|
+
}
|
|
12429
|
+
},
|
|
12430
|
+
{ _id: false }
|
|
12431
|
+
);
|
|
12421
12432
|
var schema11 = new MongooseSchema15(
|
|
12433
|
+
{
|
|
12434
|
+
categoryIds: { required: true, type: [String] },
|
|
12435
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
12436
|
+
email: { required: true, type: String },
|
|
12437
|
+
invitations: { required: true, type: [invitationSchema] },
|
|
12438
|
+
name: { required: true, type: String }
|
|
12439
|
+
},
|
|
12440
|
+
{ timestamps: true }
|
|
12441
|
+
);
|
|
12442
|
+
schema11.index({ email: 1 }, { unique: true });
|
|
12443
|
+
schema11.index({ name: 1 });
|
|
12444
|
+
var UnregisteredVendorModel = import_mongoose16.default.models.UnregisteredVendor || import_mongoose16.default.model("UnregisteredVendor", schema11);
|
|
12445
|
+
|
|
12446
|
+
// src/mongoose/event/Event.ts
|
|
12447
|
+
var import_mongoose17 = __toESM(require("mongoose"));
|
|
12448
|
+
var MongooseSchema16 = import_mongoose17.default.Schema;
|
|
12449
|
+
var schema12 = new MongooseSchema16(
|
|
12422
12450
|
{
|
|
12423
12451
|
...baseResourceFields,
|
|
12424
12452
|
// Importing base resource fields from global.ts
|
|
12425
12453
|
claimed: { default: true, required: false, type: Boolean },
|
|
12426
|
-
dateTime: [dateTimeSchema3],
|
|
12454
|
+
dateTime: { required: true, type: [dateTimeSchema3] },
|
|
12427
12455
|
eventInfoId: {
|
|
12428
12456
|
ref: "EventInfo",
|
|
12429
12457
|
required: false,
|
|
12430
|
-
type:
|
|
12458
|
+
type: import_mongoose17.default.Schema.Types.ObjectId
|
|
12431
12459
|
},
|
|
12432
12460
|
eventType: {
|
|
12433
12461
|
enum: Object.values(EnumEventType),
|
|
@@ -12456,18 +12484,18 @@ var schema11 = new MongooseSchema15(
|
|
|
12456
12484
|
},
|
|
12457
12485
|
{ timestamps: true }
|
|
12458
12486
|
);
|
|
12459
|
-
|
|
12460
|
-
|
|
12461
|
-
|
|
12462
|
-
|
|
12463
|
-
|
|
12464
|
-
|
|
12465
|
-
var EventModel =
|
|
12487
|
+
schema12.index({ name: 1 });
|
|
12488
|
+
schema12.index({ description: 1 });
|
|
12489
|
+
schema12.index({ region: 1 });
|
|
12490
|
+
schema12.index({ "location.geo": "2dsphere" });
|
|
12491
|
+
schema12.index({ tags: 1 });
|
|
12492
|
+
schema12.index({ "associates.email": 1 });
|
|
12493
|
+
var EventModel = import_mongoose17.default.models.Event || import_mongoose17.default.model("Event", schema12);
|
|
12466
12494
|
|
|
12467
12495
|
// src/mongoose/Partner.ts
|
|
12468
|
-
var
|
|
12469
|
-
var
|
|
12470
|
-
var
|
|
12496
|
+
var import_mongoose18 = __toESM(require("mongoose"));
|
|
12497
|
+
var MongooseSchema17 = import_mongoose18.default.Schema;
|
|
12498
|
+
var schema13 = new MongooseSchema17(
|
|
12471
12499
|
{
|
|
12472
12500
|
...baseResourceFields,
|
|
12473
12501
|
location: {
|
|
@@ -12483,19 +12511,19 @@ var schema12 = new MongooseSchema16(
|
|
|
12483
12511
|
},
|
|
12484
12512
|
{ timestamps: true }
|
|
12485
12513
|
);
|
|
12486
|
-
|
|
12487
|
-
|
|
12488
|
-
|
|
12489
|
-
|
|
12490
|
-
|
|
12491
|
-
var PartnerModel =
|
|
12514
|
+
schema13.index({ name: 1 });
|
|
12515
|
+
schema13.index({ description: 1 });
|
|
12516
|
+
schema13.index({ region: 1 });
|
|
12517
|
+
schema13.index({ "location.geo": "2dsphere" });
|
|
12518
|
+
schema13.index({ "associates.email": 1 });
|
|
12519
|
+
var PartnerModel = import_mongoose18.default.models.Partner || import_mongoose18.default.model("Partner", schema13);
|
|
12492
12520
|
|
|
12493
12521
|
// src/mongoose/Post.ts
|
|
12494
|
-
var
|
|
12495
|
-
var
|
|
12496
|
-
var contentSchema = new
|
|
12522
|
+
var import_mongoose19 = __toESM(require("mongoose"));
|
|
12523
|
+
var MongooseSchema18 = import_mongoose19.default.Schema;
|
|
12524
|
+
var contentSchema = new MongooseSchema18(
|
|
12497
12525
|
{
|
|
12498
|
-
contentData:
|
|
12526
|
+
contentData: import_mongoose19.Schema.Types.Mixed,
|
|
12499
12527
|
contentOrder: { required: true, type: Number },
|
|
12500
12528
|
contentType: {
|
|
12501
12529
|
enum: Object.values(EnumPostContentType),
|
|
@@ -12505,7 +12533,7 @@ var contentSchema = new MongooseSchema17(
|
|
|
12505
12533
|
},
|
|
12506
12534
|
{ _id: false }
|
|
12507
12535
|
);
|
|
12508
|
-
var
|
|
12536
|
+
var schema14 = new MongooseSchema18(
|
|
12509
12537
|
{
|
|
12510
12538
|
active: { default: true, required: true, type: Boolean },
|
|
12511
12539
|
caption: { required: true, type: String },
|
|
@@ -12541,15 +12569,15 @@ var schema13 = new MongooseSchema17(
|
|
|
12541
12569
|
},
|
|
12542
12570
|
{ timestamps: true }
|
|
12543
12571
|
);
|
|
12544
|
-
|
|
12545
|
-
|
|
12546
|
-
var PostModel =
|
|
12572
|
+
schema14.index({ title: 1 });
|
|
12573
|
+
schema14.index({ tags: 1 });
|
|
12574
|
+
var PostModel = import_mongoose19.default.models.Post || import_mongoose19.default.model("Post", schema14);
|
|
12547
12575
|
|
|
12548
12576
|
// src/mongoose/AppSetting.ts
|
|
12549
|
-
var
|
|
12550
|
-
var
|
|
12577
|
+
var import_mongoose20 = __toESM(require("mongoose"));
|
|
12578
|
+
var MongooseSchema19 = import_mongoose20.default.Schema;
|
|
12551
12579
|
var APP_SETTINGS_ID = "APP_SETTINGS_DOCUMENT_ID";
|
|
12552
|
-
var AppSettingSchema = new
|
|
12580
|
+
var AppSettingSchema = new MongooseSchema19(
|
|
12553
12581
|
{
|
|
12554
12582
|
activeSchoolsStudentCountTotal: {
|
|
12555
12583
|
default: 0,
|
|
@@ -12575,18 +12603,18 @@ var AppSettingSchema = new MongooseSchema18(
|
|
|
12575
12603
|
},
|
|
12576
12604
|
{ timestamps: true }
|
|
12577
12605
|
);
|
|
12578
|
-
var AppSettingModel =
|
|
12606
|
+
var AppSettingModel = import_mongoose20.default.models.AppSetting || import_mongoose20.default.model("AppSetting", AppSettingSchema);
|
|
12579
12607
|
|
|
12580
12608
|
// src/mongoose/game/Game.ts
|
|
12581
|
-
var
|
|
12609
|
+
var import_mongoose24 = __toESM(require("mongoose"));
|
|
12582
12610
|
|
|
12583
12611
|
// src/mongoose/game/DailyClue.ts
|
|
12584
|
-
var
|
|
12612
|
+
var import_mongoose22 = __toESM(require("mongoose"));
|
|
12585
12613
|
|
|
12586
12614
|
// src/mongoose/game/utils.ts
|
|
12587
|
-
var
|
|
12588
|
-
var
|
|
12589
|
-
var schemaGameDate = new
|
|
12615
|
+
var import_mongoose21 = __toESM(require("mongoose"));
|
|
12616
|
+
var MongooseSchema20 = import_mongoose21.default.Schema;
|
|
12617
|
+
var schemaGameDate = new MongooseSchema20(
|
|
12590
12618
|
{
|
|
12591
12619
|
endDate: { required: true, type: Date },
|
|
12592
12620
|
startDate: { required: true, type: Date }
|
|
@@ -12595,8 +12623,8 @@ var schemaGameDate = new MongooseSchema19(
|
|
|
12595
12623
|
);
|
|
12596
12624
|
|
|
12597
12625
|
// src/mongoose/game/DailyClue.ts
|
|
12598
|
-
var
|
|
12599
|
-
var schemaLetters = new
|
|
12626
|
+
var MongooseSchema21 = import_mongoose22.default.Schema;
|
|
12627
|
+
var schemaLetters = new MongooseSchema21(
|
|
12600
12628
|
{
|
|
12601
12629
|
collected: { required: false, type: [String] },
|
|
12602
12630
|
solutionShuffled: { required: true, type: [String] }
|
|
@@ -12604,14 +12632,14 @@ var schemaLetters = new MongooseSchema20(
|
|
|
12604
12632
|
},
|
|
12605
12633
|
{ _id: false }
|
|
12606
12634
|
);
|
|
12607
|
-
var schemaDailyClueBaseGame = new
|
|
12635
|
+
var schemaDailyClueBaseGame = new MongooseSchema21(
|
|
12608
12636
|
{
|
|
12609
12637
|
gameDate: { required: true, type: schemaGameDate },
|
|
12610
12638
|
gameSolution: { required: true, type: String }
|
|
12611
12639
|
},
|
|
12612
12640
|
{ _id: false }
|
|
12613
12641
|
);
|
|
12614
|
-
var schemaDailyClueGameData = new
|
|
12642
|
+
var schemaDailyClueGameData = new MongooseSchema21(
|
|
12615
12643
|
{
|
|
12616
12644
|
gameFields: { required: true, type: schemaDailyClueBaseGame },
|
|
12617
12645
|
lastFoundDate: { default: null, required: false, type: Date },
|
|
@@ -12626,9 +12654,9 @@ var schemaDailyClueGameData = new MongooseSchema20(
|
|
|
12626
12654
|
);
|
|
12627
12655
|
|
|
12628
12656
|
// src/mongoose/game/MiniQuiz.ts
|
|
12629
|
-
var
|
|
12630
|
-
var
|
|
12631
|
-
var schemaMiniQuizAnswer = new
|
|
12657
|
+
var import_mongoose23 = __toESM(require("mongoose"));
|
|
12658
|
+
var MongooseSchema22 = import_mongoose23.default.Schema;
|
|
12659
|
+
var schemaMiniQuizAnswer = new MongooseSchema22(
|
|
12632
12660
|
{
|
|
12633
12661
|
answer: { required: true, type: String },
|
|
12634
12662
|
answerId: { required: true, type: String },
|
|
@@ -12636,7 +12664,7 @@ var schemaMiniQuizAnswer = new MongooseSchema21(
|
|
|
12636
12664
|
},
|
|
12637
12665
|
{ _id: false }
|
|
12638
12666
|
);
|
|
12639
|
-
var schemaMiniQuizQuestion = new
|
|
12667
|
+
var schemaMiniQuizQuestion = new MongooseSchema22(
|
|
12640
12668
|
{
|
|
12641
12669
|
answers: { required: true, type: [schemaMiniQuizAnswer] },
|
|
12642
12670
|
question: { required: true, type: String },
|
|
@@ -12644,20 +12672,20 @@ var schemaMiniQuizQuestion = new MongooseSchema21(
|
|
|
12644
12672
|
},
|
|
12645
12673
|
{ _id: false }
|
|
12646
12674
|
);
|
|
12647
|
-
var schemaMiniQuizBaseGame = new
|
|
12675
|
+
var schemaMiniQuizBaseGame = new MongooseSchema22(
|
|
12648
12676
|
{
|
|
12649
12677
|
questions: { required: true, type: [schemaMiniQuizQuestion] }
|
|
12650
12678
|
},
|
|
12651
12679
|
{ _id: false }
|
|
12652
12680
|
);
|
|
12653
|
-
var schemaMiniQuizAnsweredQuestion = new
|
|
12681
|
+
var schemaMiniQuizAnsweredQuestion = new MongooseSchema22(
|
|
12654
12682
|
{
|
|
12655
12683
|
questionId: { required: true, type: String },
|
|
12656
12684
|
selectedAnswerId: { required: true, type: String }
|
|
12657
12685
|
},
|
|
12658
12686
|
{ _id: false }
|
|
12659
12687
|
);
|
|
12660
|
-
var schemaMiniQuizGameData = new
|
|
12688
|
+
var schemaMiniQuizGameData = new MongooseSchema22(
|
|
12661
12689
|
{
|
|
12662
12690
|
answeredQuestions: {
|
|
12663
12691
|
default: null,
|
|
@@ -12672,18 +12700,18 @@ var schemaMiniQuizGameData = new MongooseSchema21(
|
|
|
12672
12700
|
);
|
|
12673
12701
|
|
|
12674
12702
|
// src/mongoose/game/Game.ts
|
|
12675
|
-
var
|
|
12703
|
+
var MongooseSchema23 = import_mongoose24.default.Schema;
|
|
12676
12704
|
var gameDataSchemas = {
|
|
12677
12705
|
[EnumGameType.DAILY_CLUE]: schemaDailyClueGameData,
|
|
12678
12706
|
[EnumGameType.MINI_QUIZ]: schemaMiniQuizGameData
|
|
12679
12707
|
};
|
|
12680
12708
|
var gameDataDefinition = Object.fromEntries(
|
|
12681
|
-
Object.entries(gameDataSchemas).map(([key,
|
|
12709
|
+
Object.entries(gameDataSchemas).map(([key, schema17]) => [
|
|
12682
12710
|
key,
|
|
12683
|
-
{ default: null, required: false, type:
|
|
12711
|
+
{ default: null, required: false, type: schema17 }
|
|
12684
12712
|
])
|
|
12685
12713
|
);
|
|
12686
|
-
var gameHistorySchema = new
|
|
12714
|
+
var gameHistorySchema = new MongooseSchema23(
|
|
12687
12715
|
{
|
|
12688
12716
|
createdAt: { required: true, type: Date },
|
|
12689
12717
|
gameDate: { required: true, type: schemaGameDate },
|
|
@@ -12701,7 +12729,7 @@ var gameHistorySchema = new MongooseSchema22(
|
|
|
12701
12729
|
},
|
|
12702
12730
|
{ _id: false }
|
|
12703
12731
|
);
|
|
12704
|
-
var gameTypeSchema = new
|
|
12732
|
+
var gameTypeSchema = new MongooseSchema23(
|
|
12705
12733
|
{
|
|
12706
12734
|
active: { default: true, required: true, type: Boolean },
|
|
12707
12735
|
gameData: gameDataDefinition,
|
|
@@ -12715,7 +12743,7 @@ var gameTypeSchema = new MongooseSchema22(
|
|
|
12715
12743
|
},
|
|
12716
12744
|
{ timestamps: true }
|
|
12717
12745
|
);
|
|
12718
|
-
var
|
|
12746
|
+
var schema15 = new MongooseSchema23(
|
|
12719
12747
|
{
|
|
12720
12748
|
active: { default: false, required: true, type: Boolean },
|
|
12721
12749
|
deletedAt: { default: null, required: false, type: Date },
|
|
@@ -12728,12 +12756,12 @@ var schema14 = new MongooseSchema22(
|
|
|
12728
12756
|
},
|
|
12729
12757
|
{ timestamps: true }
|
|
12730
12758
|
);
|
|
12731
|
-
var GameModel =
|
|
12759
|
+
var GameModel = import_mongoose24.default.models.Game || import_mongoose24.default.model("Game", schema15);
|
|
12732
12760
|
|
|
12733
12761
|
// src/mongoose/School.ts
|
|
12734
|
-
var
|
|
12735
|
-
var
|
|
12736
|
-
var campaignsSchema = new
|
|
12762
|
+
var import_mongoose25 = __toESM(require("mongoose"));
|
|
12763
|
+
var MongooseSchema24 = import_mongoose25.default.Schema;
|
|
12764
|
+
var campaignsSchema = new MongooseSchema24(
|
|
12737
12765
|
{
|
|
12738
12766
|
endDate: { required: true, type: Date },
|
|
12739
12767
|
name: { required: true, type: String },
|
|
@@ -12741,7 +12769,7 @@ var campaignsSchema = new MongooseSchema23(
|
|
|
12741
12769
|
},
|
|
12742
12770
|
{ _id: false }
|
|
12743
12771
|
);
|
|
12744
|
-
var
|
|
12772
|
+
var schema16 = new MongooseSchema24(
|
|
12745
12773
|
{
|
|
12746
12774
|
// New schools are active by default
|
|
12747
12775
|
active: { default: true, required: true, type: Boolean },
|
|
@@ -12767,7 +12795,7 @@ var schema15 = new MongooseSchema23(
|
|
|
12767
12795
|
},
|
|
12768
12796
|
{ timestamps: true }
|
|
12769
12797
|
);
|
|
12770
|
-
var SchoolModel =
|
|
12798
|
+
var SchoolModel = import_mongoose25.default.models.School || import_mongoose25.default.model("School", schema16);
|
|
12771
12799
|
|
|
12772
12800
|
// src/service/updateAdStatus.ts
|
|
12773
12801
|
async function updateAdStatuses() {
|
|
@@ -12805,9 +12833,9 @@ async function updateAdStatuses() {
|
|
|
12805
12833
|
}
|
|
12806
12834
|
|
|
12807
12835
|
// src/service/associate.ts
|
|
12808
|
-
var
|
|
12836
|
+
var import_mongoose27 = __toESM(require("mongoose"));
|
|
12809
12837
|
function normalizeObjectId(id) {
|
|
12810
|
-
return typeof id === "string" ? new
|
|
12838
|
+
return typeof id === "string" ? new import_mongoose27.default.Types.ObjectId(id) : id;
|
|
12811
12839
|
}
|
|
12812
12840
|
async function getAssociateEmailsForResource({
|
|
12813
12841
|
normalizedResourceId,
|
|
@@ -12959,12 +12987,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
|
|
|
12959
12987
|
}
|
|
12960
12988
|
|
|
12961
12989
|
// src/service/objectIdToString.ts
|
|
12962
|
-
var
|
|
12990
|
+
var import_mongoose30 = __toESM(require("mongoose"));
|
|
12963
12991
|
function convertObjectIdsToStrings(obj) {
|
|
12964
12992
|
if (obj === null || obj === void 0) {
|
|
12965
12993
|
return obj;
|
|
12966
12994
|
}
|
|
12967
|
-
if (obj instanceof
|
|
12995
|
+
if (obj instanceof import_mongoose30.default.Types.ObjectId) {
|
|
12968
12996
|
return obj.toString();
|
|
12969
12997
|
}
|
|
12970
12998
|
if (Array.isArray(obj)) {
|