@timardex/cluemart-server-shared 1.0.132 → 1.0.134
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-OBW4LAAG.mjs → chunk-AMB6NVKD.mjs} +220 -100
- package/dist/chunk-AMB6NVKD.mjs.map +1 -0
- package/dist/index.cjs +226 -104
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +102 -60
- package/dist/index.d.ts +102 -60
- package/dist/index.mjs +224 -104
- package/dist/index.mjs.map +1 -1
- package/dist/mongoose/index.cjs +220 -98
- package/dist/mongoose/index.cjs.map +1 -1
- package/dist/mongoose/index.d.mts +102 -60
- package/dist/mongoose/index.d.ts +102 -60
- package/dist/mongoose/index.mjs +5 -1
- package/dist/service/index.cjs +218 -100
- package/dist/service/index.cjs.map +1 -1
- package/dist/service/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-OBW4LAAG.mjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1679,6 +1679,7 @@ __export(index_exports, {
|
|
|
1679
1679
|
CategorySchema: () => CategorySchema,
|
|
1680
1680
|
ChatModel: () => ChatModel,
|
|
1681
1681
|
ChatReportModel: () => ChatReportModel,
|
|
1682
|
+
ContactDetailsSchema: () => ContactDetailsSchema,
|
|
1682
1683
|
EnumPubSubEvents: () => EnumPubSubEvents,
|
|
1683
1684
|
EventInfoModel: () => EventInfoModel,
|
|
1684
1685
|
EventModel: () => EventModel,
|
|
@@ -1694,6 +1695,7 @@ __export(index_exports, {
|
|
|
1694
1695
|
RelationTypeSchema: () => RelationTypeSchema,
|
|
1695
1696
|
ResourceActivityModel: () => ResourceActivityModel,
|
|
1696
1697
|
ResourceImageTypeSchema: () => ResourceImageTypeSchema,
|
|
1698
|
+
SchoolModel: () => SchoolModel,
|
|
1697
1699
|
SocialMediaTypeSchema: () => SocialMediaTypeSchema,
|
|
1698
1700
|
StallTypeSchema: () => StallTypeSchema,
|
|
1699
1701
|
UserModel: () => UserModel,
|
|
@@ -1709,7 +1711,7 @@ __export(index_exports, {
|
|
|
1709
1711
|
findEventOrImportedMarketById: () => findEventOrImportedMarketById,
|
|
1710
1712
|
locationGeoSchema: () => locationGeoSchema,
|
|
1711
1713
|
locationsSchema: () => locationsSchema,
|
|
1712
|
-
mongoose: () =>
|
|
1714
|
+
mongoose: () => import_mongoose26.default,
|
|
1713
1715
|
refundPolicySchema: () => refundPolicySchema,
|
|
1714
1716
|
relationDatesSchema: () => relationDatesSchema,
|
|
1715
1717
|
resourceRelationsSchema: () => resourceRelationsSchema,
|
|
@@ -4735,10 +4737,10 @@ var Condition = class _Condition {
|
|
|
4735
4737
|
otherwise
|
|
4736
4738
|
} = config;
|
|
4737
4739
|
let check = typeof is === "function" ? is : (...values) => values.every((value) => value === is);
|
|
4738
|
-
return new _Condition(refs, (values,
|
|
4740
|
+
return new _Condition(refs, (values, schema16) => {
|
|
4739
4741
|
var _branch;
|
|
4740
4742
|
let branch = check(...values) ? then : otherwise;
|
|
4741
|
-
return (_branch = branch == null ? void 0 : branch(
|
|
4743
|
+
return (_branch = branch == null ? void 0 : branch(schema16)) != null ? _branch : schema16;
|
|
4742
4744
|
});
|
|
4743
4745
|
}
|
|
4744
4746
|
constructor(refs, builder) {
|
|
@@ -4752,13 +4754,13 @@ var Condition = class _Condition {
|
|
|
4752
4754
|
// TODO: ? operator here?
|
|
4753
4755
|
ref.getValue(options == null ? void 0 : options.value, options == null ? void 0 : options.parent, options == null ? void 0 : options.context)
|
|
4754
4756
|
));
|
|
4755
|
-
let
|
|
4756
|
-
if (
|
|
4757
|
-
|
|
4757
|
+
let schema16 = this.fn(values, base, options);
|
|
4758
|
+
if (schema16 === void 0 || // @ts-ignore this can be base
|
|
4759
|
+
schema16 === base) {
|
|
4758
4760
|
return base;
|
|
4759
4761
|
}
|
|
4760
|
-
if (!isSchema(
|
|
4761
|
-
return
|
|
4762
|
+
if (!isSchema(schema16)) throw new TypeError("conditions must return a schema object");
|
|
4763
|
+
return schema16.resolve(options);
|
|
4762
4764
|
}
|
|
4763
4765
|
};
|
|
4764
4766
|
var prefixes = {
|
|
@@ -4828,7 +4830,7 @@ function createValidation(config) {
|
|
|
4828
4830
|
path = "",
|
|
4829
4831
|
options,
|
|
4830
4832
|
originalValue,
|
|
4831
|
-
schema:
|
|
4833
|
+
schema: schema16
|
|
4832
4834
|
}, panic, next) {
|
|
4833
4835
|
const {
|
|
4834
4836
|
name,
|
|
@@ -4840,8 +4842,8 @@ function createValidation(config) {
|
|
|
4840
4842
|
let {
|
|
4841
4843
|
parent,
|
|
4842
4844
|
context,
|
|
4843
|
-
abortEarly =
|
|
4844
|
-
disableStackTrace =
|
|
4845
|
+
abortEarly = schema16.spec.abortEarly,
|
|
4846
|
+
disableStackTrace = schema16.spec.disableStackTrace
|
|
4845
4847
|
} = options;
|
|
4846
4848
|
function resolve(item) {
|
|
4847
4849
|
return Reference.isRef(item) ? item.getValue(value, parent, context) : item;
|
|
@@ -4850,9 +4852,9 @@ function createValidation(config) {
|
|
|
4850
4852
|
const nextParams = Object.assign({
|
|
4851
4853
|
value,
|
|
4852
4854
|
originalValue,
|
|
4853
|
-
label:
|
|
4855
|
+
label: schema16.spec.label,
|
|
4854
4856
|
path: overrides.path || path,
|
|
4855
|
-
spec:
|
|
4857
|
+
spec: schema16.spec,
|
|
4856
4858
|
disableStackTrace: overrides.disableStackTrace || disableStackTrace
|
|
4857
4859
|
}, params, overrides.params);
|
|
4858
4860
|
for (const key of Object.keys(nextParams)) nextParams[key] = resolve(nextParams[key]);
|
|
@@ -4870,7 +4872,7 @@ function createValidation(config) {
|
|
|
4870
4872
|
resolve,
|
|
4871
4873
|
options,
|
|
4872
4874
|
originalValue,
|
|
4873
|
-
schema:
|
|
4875
|
+
schema: schema16
|
|
4874
4876
|
};
|
|
4875
4877
|
const handleResult = (validOrError) => {
|
|
4876
4878
|
if (ValidationError.isError(validOrError)) invalid(validOrError);
|
|
@@ -4904,42 +4906,42 @@ function createValidation(config) {
|
|
|
4904
4906
|
validate.OPTIONS = config;
|
|
4905
4907
|
return validate;
|
|
4906
4908
|
}
|
|
4907
|
-
function getIn(
|
|
4909
|
+
function getIn(schema16, path, value, context = value) {
|
|
4908
4910
|
let parent, lastPart, lastPartDebug;
|
|
4909
4911
|
if (!path) return {
|
|
4910
4912
|
parent,
|
|
4911
4913
|
parentPath: path,
|
|
4912
|
-
schema:
|
|
4914
|
+
schema: schema16
|
|
4913
4915
|
};
|
|
4914
4916
|
(0, import_property_expr.forEach)(path, (_part, isBracket, isArray) => {
|
|
4915
4917
|
let part = isBracket ? _part.slice(1, _part.length - 1) : _part;
|
|
4916
|
-
|
|
4918
|
+
schema16 = schema16.resolve({
|
|
4917
4919
|
context,
|
|
4918
4920
|
parent,
|
|
4919
4921
|
value
|
|
4920
4922
|
});
|
|
4921
|
-
let isTuple =
|
|
4923
|
+
let isTuple = schema16.type === "tuple";
|
|
4922
4924
|
let idx = isArray ? parseInt(part, 10) : 0;
|
|
4923
|
-
if (
|
|
4925
|
+
if (schema16.innerType || isTuple) {
|
|
4924
4926
|
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]"`);
|
|
4925
4927
|
if (value && idx >= value.length) {
|
|
4926
4928
|
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. `);
|
|
4927
4929
|
}
|
|
4928
4930
|
parent = value;
|
|
4929
4931
|
value = value && value[idx];
|
|
4930
|
-
|
|
4932
|
+
schema16 = isTuple ? schema16.spec.types[idx] : schema16.innerType;
|
|
4931
4933
|
}
|
|
4932
4934
|
if (!isArray) {
|
|
4933
|
-
if (!
|
|
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}")`);
|
|
4934
4936
|
parent = value;
|
|
4935
4937
|
value = value && value[part];
|
|
4936
|
-
|
|
4938
|
+
schema16 = schema16.fields[part];
|
|
4937
4939
|
}
|
|
4938
4940
|
lastPart = part;
|
|
4939
4941
|
lastPartDebug = isBracket ? "[" + _part + "]" : "." + _part;
|
|
4940
4942
|
});
|
|
4941
4943
|
return {
|
|
4942
|
-
schema:
|
|
4944
|
+
schema: schema16,
|
|
4943
4945
|
parent,
|
|
4944
4946
|
parentPath: lastPart
|
|
4945
4947
|
};
|
|
@@ -5076,20 +5078,20 @@ var Schema = class {
|
|
|
5076
5078
|
this._mutate = before;
|
|
5077
5079
|
return result;
|
|
5078
5080
|
}
|
|
5079
|
-
concat(
|
|
5080
|
-
if (!
|
|
5081
|
-
if (
|
|
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
5084
|
let base = this;
|
|
5083
|
-
let combined =
|
|
5085
|
+
let combined = schema16.clone();
|
|
5084
5086
|
const mergedSpec = Object.assign({}, base.spec, combined.spec);
|
|
5085
5087
|
combined.spec = mergedSpec;
|
|
5086
5088
|
combined.internalTests = Object.assign({}, base.internalTests, combined.internalTests);
|
|
5087
|
-
combined._whitelist = base._whitelist.merge(
|
|
5088
|
-
combined._blacklist = base._blacklist.merge(
|
|
5089
|
+
combined._whitelist = base._whitelist.merge(schema16._whitelist, schema16._blacklist);
|
|
5090
|
+
combined._blacklist = base._blacklist.merge(schema16._blacklist, schema16._whitelist);
|
|
5089
5091
|
combined.tests = base.tests;
|
|
5090
5092
|
combined.exclusiveTests = base.exclusiveTests;
|
|
5091
5093
|
combined.withMutation((next) => {
|
|
5092
|
-
|
|
5094
|
+
schema16.tests.forEach((fn) => {
|
|
5093
5095
|
next.test(fn.OPTIONS);
|
|
5094
5096
|
});
|
|
5095
5097
|
});
|
|
@@ -5105,15 +5107,15 @@ var Schema = class {
|
|
|
5105
5107
|
return this._typeCheck(v);
|
|
5106
5108
|
}
|
|
5107
5109
|
resolve(options) {
|
|
5108
|
-
let
|
|
5109
|
-
if (
|
|
5110
|
-
let conditions =
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
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);
|
|
5115
5117
|
}
|
|
5116
|
-
return
|
|
5118
|
+
return schema16;
|
|
5117
5119
|
}
|
|
5118
5120
|
resolveOptions(options) {
|
|
5119
5121
|
var _options$strict, _options$abortEarly, _options$recursive, _options$disableStack;
|
|
@@ -5267,11 +5269,11 @@ attempted value: ${formattedValue}
|
|
|
5267
5269
|
}
|
|
5268
5270
|
validate(value, options) {
|
|
5269
5271
|
var _options$disableStack2;
|
|
5270
|
-
let
|
|
5272
|
+
let schema16 = this.resolve(Object.assign({}, options, {
|
|
5271
5273
|
value
|
|
5272
5274
|
}));
|
|
5273
|
-
let disableStackTrace = (_options$disableStack2 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack2 :
|
|
5274
|
-
return new Promise((resolve, reject) =>
|
|
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) => {
|
|
5275
5277
|
if (ValidationError.isError(error)) error.value = parsed;
|
|
5276
5278
|
reject(error);
|
|
5277
5279
|
}, (errors, validated) => {
|
|
@@ -5281,12 +5283,12 @@ attempted value: ${formattedValue}
|
|
|
5281
5283
|
}
|
|
5282
5284
|
validateSync(value, options) {
|
|
5283
5285
|
var _options$disableStack3;
|
|
5284
|
-
let
|
|
5286
|
+
let schema16 = this.resolve(Object.assign({}, options, {
|
|
5285
5287
|
value
|
|
5286
5288
|
}));
|
|
5287
5289
|
let result;
|
|
5288
|
-
let disableStackTrace = (_options$disableStack3 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack3 :
|
|
5289
|
-
|
|
5290
|
+
let disableStackTrace = (_options$disableStack3 = options == null ? void 0 : options.disableStackTrace) != null ? _options$disableStack3 : schema16.spec.disableStackTrace;
|
|
5291
|
+
schema16._validate(value, Object.assign({}, options, {
|
|
5290
5292
|
sync: true
|
|
5291
5293
|
}), (error, parsed) => {
|
|
5292
5294
|
if (ValidationError.isError(error)) error.value = parsed;
|
|
@@ -5320,8 +5322,8 @@ attempted value: ${formattedValue}
|
|
|
5320
5322
|
return typeof defaultValue === "function" ? defaultValue.call(this, options) : clone(defaultValue);
|
|
5321
5323
|
}
|
|
5322
5324
|
getDefault(options) {
|
|
5323
|
-
let
|
|
5324
|
-
return
|
|
5325
|
+
let schema16 = this.resolve(options || {});
|
|
5326
|
+
return schema16._getDefault(options);
|
|
5325
5327
|
}
|
|
5326
5328
|
default(def) {
|
|
5327
5329
|
if (arguments.length === 0) {
|
|
@@ -5556,9 +5558,9 @@ for (const method of ["validate", "validateSync"]) Schema.prototype[`${method}At
|
|
|
5556
5558
|
const {
|
|
5557
5559
|
parent,
|
|
5558
5560
|
parentPath,
|
|
5559
|
-
schema:
|
|
5561
|
+
schema: schema16
|
|
5560
5562
|
} = getIn(this, path, value, options.context);
|
|
5561
|
-
return
|
|
5563
|
+
return schema16[method](parent && parent[parentPath], Object.assign({}, options, {
|
|
5562
5564
|
parent,
|
|
5563
5565
|
path
|
|
5564
5566
|
}));
|
|
@@ -5732,7 +5734,7 @@ var StringSchema = class extends Schema {
|
|
|
5732
5734
|
});
|
|
5733
5735
|
}
|
|
5734
5736
|
required(message) {
|
|
5735
|
-
return super.required(message).withMutation((
|
|
5737
|
+
return super.required(message).withMutation((schema16) => schema16.test({
|
|
5736
5738
|
message: message || mixed.required,
|
|
5737
5739
|
name: "required",
|
|
5738
5740
|
skipAbsent: true,
|
|
@@ -5740,9 +5742,9 @@ var StringSchema = class extends Schema {
|
|
|
5740
5742
|
}));
|
|
5741
5743
|
}
|
|
5742
5744
|
notRequired() {
|
|
5743
|
-
return super.notRequired().withMutation((
|
|
5744
|
-
|
|
5745
|
-
return
|
|
5745
|
+
return super.notRequired().withMutation((schema16) => {
|
|
5746
|
+
schema16.tests = schema16.tests.filter((t) => t.OPTIONS.name !== "required");
|
|
5747
|
+
return schema16;
|
|
5746
5748
|
});
|
|
5747
5749
|
}
|
|
5748
5750
|
length(length, message = string.length) {
|
|
@@ -6131,28 +6133,28 @@ var parseJson = (value, _, ctx) => {
|
|
|
6131
6133
|
}
|
|
6132
6134
|
return ctx.isType(parsed) ? parsed : value;
|
|
6133
6135
|
};
|
|
6134
|
-
function deepPartial(
|
|
6135
|
-
if ("fields" in
|
|
6136
|
+
function deepPartial(schema16) {
|
|
6137
|
+
if ("fields" in schema16) {
|
|
6136
6138
|
const partial = {};
|
|
6137
|
-
for (const [key, fieldSchema] of Object.entries(
|
|
6139
|
+
for (const [key, fieldSchema] of Object.entries(schema16.fields)) {
|
|
6138
6140
|
partial[key] = deepPartial(fieldSchema);
|
|
6139
6141
|
}
|
|
6140
|
-
return
|
|
6142
|
+
return schema16.setFields(partial);
|
|
6141
6143
|
}
|
|
6142
|
-
if (
|
|
6143
|
-
const nextArray =
|
|
6144
|
+
if (schema16.type === "array") {
|
|
6145
|
+
const nextArray = schema16.optional();
|
|
6144
6146
|
if (nextArray.innerType) nextArray.innerType = deepPartial(nextArray.innerType);
|
|
6145
6147
|
return nextArray;
|
|
6146
6148
|
}
|
|
6147
|
-
if (
|
|
6148
|
-
return
|
|
6149
|
-
types:
|
|
6149
|
+
if (schema16.type === "tuple") {
|
|
6150
|
+
return schema16.optional().clone({
|
|
6151
|
+
types: schema16.spec.types.map(deepPartial)
|
|
6150
6152
|
});
|
|
6151
6153
|
}
|
|
6152
|
-
if ("optional" in
|
|
6153
|
-
return
|
|
6154
|
+
if ("optional" in schema16) {
|
|
6155
|
+
return schema16.optional();
|
|
6154
6156
|
}
|
|
6155
|
-
return
|
|
6157
|
+
return schema16;
|
|
6156
6158
|
}
|
|
6157
6159
|
var deepHas = (obj, p) => {
|
|
6158
6160
|
const path = [...(0, import_property_expr.normalizePath)(p)];
|
|
@@ -6286,8 +6288,8 @@ var ObjectSchema = class extends Schema {
|
|
|
6286
6288
|
next._sortErrors = this._sortErrors;
|
|
6287
6289
|
return next;
|
|
6288
6290
|
}
|
|
6289
|
-
concat(
|
|
6290
|
-
let next = super.concat(
|
|
6291
|
+
concat(schema16) {
|
|
6292
|
+
let next = super.concat(schema16);
|
|
6291
6293
|
let nextFields = next.fields;
|
|
6292
6294
|
for (let [field, schemaOrRef] of Object.entries(this.fields)) {
|
|
6293
6295
|
const target = nextFields[field];
|
|
@@ -6295,7 +6297,7 @@ var ObjectSchema = class extends Schema {
|
|
|
6295
6297
|
}
|
|
6296
6298
|
return next.withMutation((s) => (
|
|
6297
6299
|
// XXX: excludes here is wrong
|
|
6298
|
-
s.setFields(nextFields, [...this._excludedEdges, ...
|
|
6300
|
+
s.setFields(nextFields, [...this._excludedEdges, ...schema16._excludedEdges])
|
|
6299
6301
|
));
|
|
6300
6302
|
}
|
|
6301
6303
|
_getDefault(options) {
|
|
@@ -6340,8 +6342,8 @@ var ObjectSchema = class extends Schema {
|
|
|
6340
6342
|
}
|
|
6341
6343
|
partial() {
|
|
6342
6344
|
const partial = {};
|
|
6343
|
-
for (const [key,
|
|
6344
|
-
partial[key] = "optional" in
|
|
6345
|
+
for (const [key, schema16] of Object.entries(this.fields)) {
|
|
6346
|
+
partial[key] = "optional" in schema16 && schema16.optional instanceof Function ? schema16.optional() : schema16;
|
|
6345
6347
|
}
|
|
6346
6348
|
return this.setFields(partial);
|
|
6347
6349
|
}
|
|
@@ -6539,22 +6541,22 @@ var ArraySchema = class extends Schema {
|
|
|
6539
6541
|
json() {
|
|
6540
6542
|
return this.transform(parseJson);
|
|
6541
6543
|
}
|
|
6542
|
-
concat(
|
|
6543
|
-
let next = super.concat(
|
|
6544
|
+
concat(schema16) {
|
|
6545
|
+
let next = super.concat(schema16);
|
|
6544
6546
|
next.innerType = this.innerType;
|
|
6545
|
-
if (
|
|
6547
|
+
if (schema16.innerType)
|
|
6546
6548
|
next.innerType = next.innerType ? (
|
|
6547
6549
|
// @ts-expect-error Lazy doesn't have concat and will break
|
|
6548
|
-
next.innerType.concat(
|
|
6549
|
-
) :
|
|
6550
|
+
next.innerType.concat(schema16.innerType)
|
|
6551
|
+
) : schema16.innerType;
|
|
6550
6552
|
return next;
|
|
6551
6553
|
}
|
|
6552
|
-
of(
|
|
6554
|
+
of(schema16) {
|
|
6553
6555
|
let next = this.clone();
|
|
6554
|
-
if (!isSchema(
|
|
6555
|
-
next.innerType =
|
|
6556
|
+
if (!isSchema(schema16)) throw new TypeError("`array.of()` sub-schema must be a valid yup schema not: " + printValue(schema16));
|
|
6557
|
+
next.innerType = schema16;
|
|
6556
6558
|
next.spec = Object.assign({}, next.spec, {
|
|
6557
|
-
types:
|
|
6559
|
+
types: schema16
|
|
6558
6560
|
});
|
|
6559
6561
|
return next;
|
|
6560
6562
|
}
|
|
@@ -6698,7 +6700,7 @@ var TupleSchema = class extends Schema {
|
|
|
6698
6700
|
describe(options) {
|
|
6699
6701
|
const next = (options ? this.resolve(options) : this).clone();
|
|
6700
6702
|
const base = super.describe(options);
|
|
6701
|
-
base.innerType = next.spec.types.map((
|
|
6703
|
+
base.innerType = next.spec.types.map((schema16, index) => {
|
|
6702
6704
|
var _innerOptions;
|
|
6703
6705
|
let innerOptions = options;
|
|
6704
6706
|
if ((_innerOptions = innerOptions) != null && _innerOptions.value) {
|
|
@@ -6707,7 +6709,7 @@ var TupleSchema = class extends Schema {
|
|
|
6707
6709
|
value: innerOptions.value[index]
|
|
6708
6710
|
});
|
|
6709
6711
|
}
|
|
6710
|
-
return
|
|
6712
|
+
return schema16.describe(innerOptions);
|
|
6711
6713
|
});
|
|
6712
6714
|
return base;
|
|
6713
6715
|
}
|
|
@@ -6724,6 +6726,7 @@ var import_react2 = __toESM(require_react(), 1);
|
|
|
6724
6726
|
var React8 = __toESM(require_react(), 1);
|
|
6725
6727
|
var import_react3 = __toESM(require_react(), 1);
|
|
6726
6728
|
var import_react4 = __toESM(require_react(), 1);
|
|
6729
|
+
var import_react5 = __toESM(require_react(), 1);
|
|
6727
6730
|
var EnumInviteStatus = /* @__PURE__ */ ((EnumInviteStatus22) => {
|
|
6728
6731
|
EnumInviteStatus22["ACCEPTED"] = "Accepted";
|
|
6729
6732
|
EnumInviteStatus22["COMPLETED"] = "Completed";
|
|
@@ -8348,6 +8351,7 @@ var USER_FIELDS_FRAGMENT = gql`
|
|
|
8348
8351
|
promoCodes
|
|
8349
8352
|
refreshToken
|
|
8350
8353
|
role
|
|
8354
|
+
school
|
|
8351
8355
|
termsAgreement {
|
|
8352
8356
|
...TermsAgreementFields
|
|
8353
8357
|
}
|
|
@@ -10186,6 +10190,80 @@ var UPDATE_DAILY_CLUE_MUTATION = gql`
|
|
|
10186
10190
|
}
|
|
10187
10191
|
${GAME_DOC_FIELDS_FRAGMENT}
|
|
10188
10192
|
`;
|
|
10193
|
+
var SCHOOL = gql`
|
|
10194
|
+
fragment SchoolFields on SchoolType {
|
|
10195
|
+
_id
|
|
10196
|
+
active
|
|
10197
|
+
contactDetails {
|
|
10198
|
+
...ContactDetailsFields
|
|
10199
|
+
}
|
|
10200
|
+
location {
|
|
10201
|
+
...LocationFields
|
|
10202
|
+
}
|
|
10203
|
+
createdAt
|
|
10204
|
+
deletedAt
|
|
10205
|
+
logo {
|
|
10206
|
+
...ResourceImageFields
|
|
10207
|
+
}
|
|
10208
|
+
name
|
|
10209
|
+
owner {
|
|
10210
|
+
...OwnerFields
|
|
10211
|
+
}
|
|
10212
|
+
overallPoints
|
|
10213
|
+
region
|
|
10214
|
+
studentCount
|
|
10215
|
+
socialMedia {
|
|
10216
|
+
...SocialMediaFields
|
|
10217
|
+
}
|
|
10218
|
+
termsAgreement {
|
|
10219
|
+
...TermsAgreementFields
|
|
10220
|
+
}
|
|
10221
|
+
updatedAt
|
|
10222
|
+
}
|
|
10223
|
+
${OWNER_FIELDS_FRAGMENT}
|
|
10224
|
+
${LOCATION_FIELDS_FRAGMENT}
|
|
10225
|
+
${RESOURCE_IMAGE_FIELDS_FRAGMENT}
|
|
10226
|
+
${CONTACT_DETAILS_FIELDS_FRAGMENT}
|
|
10227
|
+
${TERMS_AGREEMENT_FIELDS_FRAGMENT}
|
|
10228
|
+
${SOCIAL_MEDIA_FIELDS_FRAGMENT}
|
|
10229
|
+
`;
|
|
10230
|
+
var GET_SCHOOL = gql`
|
|
10231
|
+
query getSchool($_id: ID!) {
|
|
10232
|
+
school(_id: $_id) {
|
|
10233
|
+
...SchoolFields
|
|
10234
|
+
}
|
|
10235
|
+
}
|
|
10236
|
+
${SCHOOL}
|
|
10237
|
+
`;
|
|
10238
|
+
var GET_SCHOOLS = gql`
|
|
10239
|
+
query getSchools {
|
|
10240
|
+
schools {
|
|
10241
|
+
...SchoolFields
|
|
10242
|
+
}
|
|
10243
|
+
}
|
|
10244
|
+
${SCHOOL}
|
|
10245
|
+
`;
|
|
10246
|
+
var CREATE_SCHOOL_MUTATION = gql`
|
|
10247
|
+
mutation createSchool($input: SchoolInputType!) {
|
|
10248
|
+
createSchool(input: $input) {
|
|
10249
|
+
...SchoolFields
|
|
10250
|
+
}
|
|
10251
|
+
}
|
|
10252
|
+
${SCHOOL}
|
|
10253
|
+
`;
|
|
10254
|
+
var UPDATE_SCHOOL_MUTATION = gql`
|
|
10255
|
+
mutation updateSchool($_id: ID!, $input: SchoolInputType!) {
|
|
10256
|
+
updateSchool(_id: $_id, input: $input) {
|
|
10257
|
+
...SchoolFields
|
|
10258
|
+
}
|
|
10259
|
+
}
|
|
10260
|
+
${SCHOOL}
|
|
10261
|
+
`;
|
|
10262
|
+
var DELETE_SCHOOL_MUTATION = gql`
|
|
10263
|
+
mutation deleteSchool($_id: ID!) {
|
|
10264
|
+
deleteSchool(_id: $_id)
|
|
10265
|
+
}
|
|
10266
|
+
`;
|
|
10189
10267
|
var nzBankAccountRegex = /^\d{2}-\d{4}-\d{7}-\d{2}$/;
|
|
10190
10268
|
var nzbnRegex = /^94\d{11}$/;
|
|
10191
10269
|
var normalizedUrlTransform = () => create$6().trim().transform(
|
|
@@ -10337,7 +10415,7 @@ var socialMediaSchema = create$3({
|
|
|
10337
10415
|
is: (name) => !!name,
|
|
10338
10416
|
// If name has a value
|
|
10339
10417
|
then: () => normalizedUrlTransform().required("Link is required when name is set").url("Link must be a valid URL").label("Social Media Link"),
|
|
10340
|
-
otherwise: (
|
|
10418
|
+
otherwise: (schema16) => schema16.notRequired()
|
|
10341
10419
|
})
|
|
10342
10420
|
});
|
|
10343
10421
|
var globalResourceSchema = create$3().shape({
|
|
@@ -10413,21 +10491,21 @@ var paymentInfoSchema = create$3({
|
|
|
10413
10491
|
).required("Please select a Payment method"),
|
|
10414
10492
|
accountHolderName: create$6().when("paymentMethod", {
|
|
10415
10493
|
is: "bank_transfer",
|
|
10416
|
-
then: (
|
|
10417
|
-
otherwise: (
|
|
10494
|
+
then: (schema16) => schema16.required("Account holder name is required for bank transfer").trim(),
|
|
10495
|
+
otherwise: (schema16) => schema16.notRequired()
|
|
10418
10496
|
}),
|
|
10419
10497
|
accountNumber: create$6().when("paymentMethod", {
|
|
10420
10498
|
is: "bank_transfer",
|
|
10421
|
-
then: (
|
|
10499
|
+
then: (schema16) => schema16.required("Account number is required for bank transfer").matches(
|
|
10422
10500
|
nzBankAccountRegex,
|
|
10423
10501
|
"Account number must be in format: XX-XXXX-XXXXXXX-XX"
|
|
10424
10502
|
).trim(),
|
|
10425
|
-
otherwise: (
|
|
10503
|
+
otherwise: (schema16) => schema16.notRequired()
|
|
10426
10504
|
}),
|
|
10427
10505
|
link: create$6().when("paymentMethod", {
|
|
10428
10506
|
is: (val) => val === "paypal" || val === "stripe",
|
|
10429
10507
|
then: () => normalizedUrlTransform().url("Link must be a valid URL").required("Link is required for PayPal/Stripe"),
|
|
10430
|
-
otherwise: (
|
|
10508
|
+
otherwise: (schema16) => schema16.notRequired()
|
|
10431
10509
|
})
|
|
10432
10510
|
});
|
|
10433
10511
|
var eventInfoSchema = create$3().shape({
|
|
@@ -10577,16 +10655,16 @@ var vendorInfoSchema = create$3().shape({
|
|
|
10577
10655
|
var userSchema = create$3().shape({
|
|
10578
10656
|
active: create$7().required("Active is required"),
|
|
10579
10657
|
email: emailRequiredSchema,
|
|
10580
|
-
firstName: create$6().label("First Name").required("First name is required"),
|
|
10581
|
-
lastName: create$6().label("Last Name").required("Last name is required"),
|
|
10658
|
+
firstName: create$6().label("First Name").trim().required("First name is required"),
|
|
10659
|
+
lastName: create$6().label("Last Name").trim().required("Last name is required"),
|
|
10582
10660
|
isTester: create$7().required("Tester status is required"),
|
|
10583
10661
|
password: create$6().nullable().trim().label("Password").min(8, "Password must be at least 8 characters long").notRequired(),
|
|
10584
10662
|
preferredRegion: create$6().label("Preferred Region").required("Preferred region is required"),
|
|
10585
10663
|
confirmPassword: create$6().nullable().trim().label("Confirm Password").when("password", {
|
|
10586
10664
|
is: (val) => !!val,
|
|
10587
10665
|
// only necessary if password typed
|
|
10588
|
-
then: (
|
|
10589
|
-
otherwise: (
|
|
10666
|
+
then: (schema16) => schema16.required("Confirm Password is required").oneOf([create$9("password")], "Passwords must match"),
|
|
10667
|
+
otherwise: (schema16) => schema16.notRequired()
|
|
10590
10668
|
}),
|
|
10591
10669
|
role: create$8().oneOf(Object.values(EnumUserRole)).required("Role is required")
|
|
10592
10670
|
});
|
|
@@ -10657,7 +10735,7 @@ var adSchema = create$3().shape({
|
|
|
10657
10735
|
return endDate > now;
|
|
10658
10736
|
}).when("start", {
|
|
10659
10737
|
is: (val) => val && val.length > 0,
|
|
10660
|
-
then: (
|
|
10738
|
+
then: (schema16) => schema16.test(
|
|
10661
10739
|
"is-after-start",
|
|
10662
10740
|
"End date must be after start date",
|
|
10663
10741
|
function(value) {
|
|
@@ -10801,6 +10879,15 @@ var contactUsSchema = create$3().shape({
|
|
|
10801
10879
|
lastName: create$6().label("Last Name").required("Last name is required"),
|
|
10802
10880
|
message: create$6().label("Message").required("Message is required")
|
|
10803
10881
|
});
|
|
10882
|
+
var schoolSchema = create$3().shape({
|
|
10883
|
+
active: create$7().required("Active is required"),
|
|
10884
|
+
contactDetails: contactDetailsSchema,
|
|
10885
|
+
location: locationSchema,
|
|
10886
|
+
name: create$6().trim().required("Name is required"),
|
|
10887
|
+
region: create$6().trim().required("Region is required"),
|
|
10888
|
+
socialMedia: create$2().of(socialMediaSchema).nullable().default(null),
|
|
10889
|
+
studentCount: create$5().label("Student Count").min(0, "Student count cannot be negative").required("Student count is required").test("no-leading-zeros", "", noLeadingZeros("Student Count"))
|
|
10890
|
+
});
|
|
10804
10891
|
var EnumActivity = /* @__PURE__ */ ((EnumActivity2) => {
|
|
10805
10892
|
EnumActivity2["FAVORITE"] = "FAVORITE";
|
|
10806
10893
|
EnumActivity2["GOING"] = "GOING";
|
|
@@ -11368,27 +11455,27 @@ var baseResourceFields = {
|
|
|
11368
11455
|
required: false,
|
|
11369
11456
|
type: [associatesSchema]
|
|
11370
11457
|
},
|
|
11371
|
-
contactDetails: ContactDetailsSchema,
|
|
11458
|
+
contactDetails: { required: false, type: ContactDetailsSchema },
|
|
11372
11459
|
cover: {
|
|
11373
11460
|
required: true,
|
|
11374
11461
|
type: ResourceImageTypeSchema
|
|
11375
11462
|
},
|
|
11376
11463
|
deletedAt: { default: null, required: false, type: Date },
|
|
11377
11464
|
description: { required: true, type: String },
|
|
11378
|
-
images: [ResourceImageTypeSchema],
|
|
11379
|
-
logo: ResourceImageTypeSchema,
|
|
11465
|
+
images: { required: false, type: [ResourceImageTypeSchema] },
|
|
11466
|
+
logo: { required: false, type: ResourceImageTypeSchema },
|
|
11380
11467
|
name: { required: true, type: String },
|
|
11381
11468
|
owner: {
|
|
11382
11469
|
required: false,
|
|
11383
11470
|
type: OwnerTypeSchema
|
|
11384
11471
|
},
|
|
11385
|
-
posterUsage: PosterUsageTypeSchema,
|
|
11472
|
+
posterUsage: { required: false, type: PosterUsageTypeSchema },
|
|
11386
11473
|
promoCodes: { required: false, type: [String] },
|
|
11387
11474
|
rating: { required: false, type: Number },
|
|
11388
11475
|
region: { required: true, type: String },
|
|
11389
11476
|
reviewCount: { required: false, type: Number },
|
|
11390
|
-
socialMedia: [SocialMediaTypeSchema],
|
|
11391
|
-
termsAgreement: termsAgreementSchema
|
|
11477
|
+
socialMedia: { required: false, type: [SocialMediaTypeSchema] },
|
|
11478
|
+
termsAgreement: { required: true, type: termsAgreementSchema }
|
|
11392
11479
|
};
|
|
11393
11480
|
|
|
11394
11481
|
// src/mongoose/GoogleImportedMarket.ts
|
|
@@ -11701,6 +11788,11 @@ var schema7 = new MongooseSchema11(
|
|
|
11701
11788
|
required: true,
|
|
11702
11789
|
type: String
|
|
11703
11790
|
},
|
|
11791
|
+
school: {
|
|
11792
|
+
ref: "School",
|
|
11793
|
+
required: false,
|
|
11794
|
+
type: import_mongoose11.default.Schema.Types.ObjectId
|
|
11795
|
+
},
|
|
11704
11796
|
stripe: {
|
|
11705
11797
|
required: false,
|
|
11706
11798
|
type: stripeSchema
|
|
@@ -12091,9 +12183,9 @@ var gameDataSchemas = {
|
|
|
12091
12183
|
[EnumGameType.DAILY_CLUE]: schemaDailyClue
|
|
12092
12184
|
};
|
|
12093
12185
|
var gameDataDefinition = Object.fromEntries(
|
|
12094
|
-
Object.entries(gameDataSchemas).map(([key,
|
|
12186
|
+
Object.entries(gameDataSchemas).map(([key, schema16]) => [
|
|
12095
12187
|
key,
|
|
12096
|
-
{ default: null, required: false, type:
|
|
12188
|
+
{ default: null, required: false, type: schema16 }
|
|
12097
12189
|
])
|
|
12098
12190
|
);
|
|
12099
12191
|
var gameHistorySchema = new MongooseSchema19(
|
|
@@ -12141,8 +12233,36 @@ var schema14 = new MongooseSchema19(
|
|
|
12141
12233
|
);
|
|
12142
12234
|
var GameModel = import_mongoose19.default.models.Game || import_mongoose19.default.model("Game", schema14);
|
|
12143
12235
|
|
|
12144
|
-
// src/
|
|
12236
|
+
// src/mongoose/School.ts
|
|
12145
12237
|
var import_mongoose20 = __toESM(require("mongoose"));
|
|
12238
|
+
var MongooseSchema20 = import_mongoose20.default.Schema;
|
|
12239
|
+
var schema15 = new MongooseSchema20(
|
|
12240
|
+
{
|
|
12241
|
+
active: { default: false, required: true, type: Boolean },
|
|
12242
|
+
contactDetails: { required: false, type: ContactDetailsSchema },
|
|
12243
|
+
deletedAt: { default: null, required: false, type: Date },
|
|
12244
|
+
location: {
|
|
12245
|
+
required: true,
|
|
12246
|
+
type: locationsSchema
|
|
12247
|
+
},
|
|
12248
|
+
logo: { required: false, type: ResourceImageTypeSchema },
|
|
12249
|
+
name: { required: true, type: String },
|
|
12250
|
+
overallPoints: { default: 0, required: false, type: Number },
|
|
12251
|
+
owner: {
|
|
12252
|
+
required: true,
|
|
12253
|
+
type: OwnerTypeSchema
|
|
12254
|
+
},
|
|
12255
|
+
region: { required: true, type: String },
|
|
12256
|
+
socialMedia: { required: false, type: [SocialMediaTypeSchema] },
|
|
12257
|
+
studentCount: { required: true, type: Number },
|
|
12258
|
+
termsAgreement: { required: true, type: termsAgreementSchema }
|
|
12259
|
+
},
|
|
12260
|
+
{ timestamps: true }
|
|
12261
|
+
);
|
|
12262
|
+
var SchoolModel = import_mongoose20.default.models.School || import_mongoose20.default.model("School", schema15);
|
|
12263
|
+
|
|
12264
|
+
// src/service/database.ts
|
|
12265
|
+
var import_mongoose21 = __toESM(require("mongoose"));
|
|
12146
12266
|
var connectToDatabase = async ({
|
|
12147
12267
|
appName,
|
|
12148
12268
|
dbName,
|
|
@@ -12155,7 +12275,7 @@ var connectToDatabase = async ({
|
|
|
12155
12275
|
// Fallback to MongoDB Atlas connection string
|
|
12156
12276
|
`mongodb+srv://${dbUser}:${dbPassword}@${dbName}.mongodb.net/?retryWrites=true&w=majority&appName=${appName}`
|
|
12157
12277
|
);
|
|
12158
|
-
await
|
|
12278
|
+
await import_mongoose21.default.connect(mongoUri);
|
|
12159
12279
|
const connectionType = mongodbUri ? "Local MongoDB" : "MongoDB Atlas";
|
|
12160
12280
|
console.log(
|
|
12161
12281
|
`${connectionType} connected from server/src/service/database.ts`
|
|
@@ -12391,12 +12511,12 @@ async function updateVendorBasedOnUserLicense(userId, licenceType) {
|
|
|
12391
12511
|
}
|
|
12392
12512
|
|
|
12393
12513
|
// src/service/objectIdToString.ts
|
|
12394
|
-
var
|
|
12514
|
+
var import_mongoose24 = __toESM(require("mongoose"));
|
|
12395
12515
|
function convertObjectIdsToStrings(obj) {
|
|
12396
12516
|
if (obj === null || obj === void 0) {
|
|
12397
12517
|
return obj;
|
|
12398
12518
|
}
|
|
12399
|
-
if (obj instanceof
|
|
12519
|
+
if (obj instanceof import_mongoose24.default.Types.ObjectId) {
|
|
12400
12520
|
return obj.toString();
|
|
12401
12521
|
}
|
|
12402
12522
|
if (Array.isArray(obj)) {
|
|
@@ -12427,7 +12547,7 @@ async function findEventOrImportedMarketById(resourceId) {
|
|
|
12427
12547
|
|
|
12428
12548
|
// src/types/index.ts
|
|
12429
12549
|
var import_express = __toESM(require("express"));
|
|
12430
|
-
var
|
|
12550
|
+
var import_mongoose26 = __toESM(require("mongoose"));
|
|
12431
12551
|
var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
12432
12552
|
EnumPubSubEvents2["GET_CHAT_MESSAGE"] = "GET_CHAT_MESSAGE";
|
|
12433
12553
|
EnumPubSubEvents2["GET_NOTIFICATIONS"] = "GET_NOTIFICATIONS";
|
|
@@ -12443,6 +12563,7 @@ var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
|
12443
12563
|
CategorySchema,
|
|
12444
12564
|
ChatModel,
|
|
12445
12565
|
ChatReportModel,
|
|
12566
|
+
ContactDetailsSchema,
|
|
12446
12567
|
EnumPubSubEvents,
|
|
12447
12568
|
EventInfoModel,
|
|
12448
12569
|
EventModel,
|
|
@@ -12458,6 +12579,7 @@ var EnumPubSubEvents = /* @__PURE__ */ ((EnumPubSubEvents2) => {
|
|
|
12458
12579
|
RelationTypeSchema,
|
|
12459
12580
|
ResourceActivityModel,
|
|
12460
12581
|
ResourceImageTypeSchema,
|
|
12582
|
+
SchoolModel,
|
|
12461
12583
|
SocialMediaTypeSchema,
|
|
12462
12584
|
StallTypeSchema,
|
|
12463
12585
|
UserModel,
|