@lyxa.ai/core 1.0.21 → 1.0.22
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.js.map +1 -1
- package/dist/libraries/logger/index.d.ts +2 -0
- package/dist/libraries/logger/index.js +17 -1
- package/dist/libraries/logger/index.js.map +1 -1
- package/dist/libraries/mongo/index.js +49 -16
- package/dist/libraries/mongo/index.js.map +1 -1
- package/dist/libraries/mongo/models/areeba-card.model.d.ts +17 -0
- package/dist/libraries/mongo/models/areeba-card.model.js +73 -0
- package/dist/libraries/mongo/models/areeba-card.model.js.map +1 -0
- package/dist/libraries/mongo/models/auth-identity.model.d.ts +8 -0
- package/dist/libraries/mongo/models/auth-identity.model.js +33 -0
- package/dist/libraries/mongo/models/auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/base/base-coupon.model.js.map +1 -1
- package/dist/libraries/mongo/models/cart.model.js +9 -2
- package/dist/libraries/mongo/models/cart.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/attribute-item.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/attribute-map.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/business-development-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/charge-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/charge.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/courier-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/currency-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/currency.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/featured-item.mode.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/otp-fields.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/package.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/parent-document.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/payout-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/price-breakdown.model.d.ts +5 -0
- package/dist/libraries/mongo/models/embedded/price-breakdown.model.js +32 -0
- package/dist/libraries/mongo/models/embedded/price-breakdown.model.js.map +1 -0
- package/dist/libraries/mongo/models/embedded/price.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/product-nutrition.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/referral-discount-config.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/rider-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/service-fee-setting.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/shop-document.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/subscription-summary.model.js.map +1 -1
- package/dist/libraries/mongo/models/index.d.ts +24 -0
- package/dist/libraries/mongo/models/index.js +26 -2
- package/dist/libraries/mongo/models/index.js.map +1 -1
- package/dist/libraries/mongo/models/line-item.model.d.ts +4 -4
- package/dist/libraries/mongo/models/line-item.model.js +8 -8
- package/dist/libraries/mongo/models/line-item.model.js.map +1 -1
- package/dist/libraries/mongo/models/payout.model.js.map +1 -1
- package/dist/libraries/mongo/models/product.model.d.ts +5 -6
- package/dist/libraries/mongo/models/product.model.js +12 -17
- package/dist/libraries/mongo/models/product.model.js.map +1 -1
- package/dist/libraries/mongo/models/providers/apple-auth-identity.model.d.ts +6 -0
- package/dist/libraries/mongo/models/providers/apple-auth-identity.model.js +25 -0
- package/dist/libraries/mongo/models/providers/apple-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/email-auth-identity.model.d.ts +9 -0
- package/dist/libraries/mongo/models/providers/email-auth-identity.model.js +36 -0
- package/dist/libraries/mongo/models/providers/email-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/google-auth-identity.model.d.ts +6 -0
- package/dist/libraries/mongo/models/providers/google-auth-identity.model.js +25 -0
- package/dist/libraries/mongo/models/providers/google-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/phone-auth-identity.model.d.ts +8 -0
- package/dist/libraries/mongo/models/providers/phone-auth-identity.model.js +31 -0
- package/dist/libraries/mongo/models/providers/phone-auth-identity.model.js.map +1 -0
- package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.d.ts +10 -0
- package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.js +28 -0
- package/dist/libraries/mongo/models/providers/referral-code-coupon.mode.js.map +1 -0
- package/dist/libraries/mongo/models/role.model.ts.d.ts +8 -0
- package/dist/libraries/mongo/models/role.model.ts.js +37 -0
- package/dist/libraries/mongo/models/role.model.ts.js.map +1 -0
- package/dist/libraries/mongo/models/shared/duration.model.js.map +1 -1
- package/dist/libraries/mongo/models/shared/work-hour.model.js +1 -1
- package/dist/libraries/mongo/models/shared/work-hour.model.js.map +1 -1
- package/dist/libraries/mongo/models/shop-access-control.model.js +10 -6
- package/dist/libraries/mongo/models/shop-access-control.model.js.map +1 -1
- package/dist/libraries/mongo/models/shop-product.model.d.ts +4 -4
- package/dist/libraries/mongo/models/shop-product.model.js +7 -7
- package/dist/libraries/mongo/models/shop-product.model.js.map +1 -1
- package/dist/libraries/mongo/models/shop-review.d.ts +7 -0
- package/dist/libraries/mongo/models/shop-review.js +28 -0
- package/dist/libraries/mongo/models/shop-review.js.map +1 -0
- package/dist/libraries/mongo/models/shop.model.js.map +1 -1
- package/dist/libraries/mongo/models/transaction.model.js.map +1 -1
- package/dist/libraries/mongo/models/zone.model..d.ts +15 -0
- package/dist/libraries/mongo/models/zone.model..js +64 -0
- package/dist/libraries/mongo/models/zone.model..js.map +1 -0
- package/dist/utilities/common/password.d.ts +1 -0
- package/dist/utilities/common/password.js +12 -0
- package/dist/utilities/common/password.js.map +1 -0
- package/dist/utilities/common/week.d.ts +1 -0
- package/dist/utilities/common/week.js +5 -0
- package/dist/utilities/common/week.js.map +1 -0
- package/dist/utilities/enum.d.ts +9 -5
- package/dist/utilities/enum.js +21 -16
- package/dist/utilities/enum.js.map +1 -1
- package/dist/utilities/transformers.js.map +1 -1
- package/dist/utilities/validation/global-validation.js +1 -1
- package/dist/utilities/validation/global-validation.js.map +1 -1
- package/package.json +1 -1
- package/dist/libraries/mongo/models/cart-lineitem.model.d.ts +0 -29
- package/dist/libraries/mongo/models/cart-lineitem.model.js +0 -120
- package/dist/libraries/mongo/models/cart-lineitem.model.js.map +0 -1
- package/dist/libraries/mongo/models/cart-perticipant.model.d.ts +0 -22
- package/dist/libraries/mongo/models/cart-perticipant.model.js +0 -104
- package/dist/libraries/mongo/models/cart-perticipant.model.js.map +0 -1
- package/dist/libraries/mongo/models/embedded/payment-details.model.d.ts +0 -9
- package/dist/libraries/mongo/models/embedded/payment-details.model.js +0 -52
- package/dist/libraries/mongo/models/embedded/payment-details.model.js.map +0 -1
- package/dist/libraries/mongo/models/order-pricing.model.d.ts +0 -18
- package/dist/libraries/mongo/models/order-pricing.model.js +0 -88
- package/dist/libraries/mongo/models/order-pricing.model.js.map +0 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;AAmBA,sCAyBC;AAED,8CAyDC;AAED,oCAEC;AA3GD,2CAA2C;AAC3C,mCAAiC;AACjC,wDAAgC;AAChC,6DAAqF;AACrF,+GAA0G;AAC1G,+CAA8C;AAC9C,6CAA+C;AAC/C,6CAAuD;AACvD,iDAAyD;AACzD,uDAA8D;AAC9D,+CAAiD;AACjD,mDAAqD;AACrD,6CAAiE;AACjE,0FAAqF;AAGrF,6GAA4G;AAAnG,4IAAA,4BAA4B,OAAA;AACrC,2CAA4G;AAAnG,6GAAA,oBAAoB,OAAA;AAAE,0GAAA,iBAAiB,OAAA;AAAE,uHAAA,8BAA8B,OAAA;AAEzE,KAAK,UAAU,aAAa,CAAC,OAA8B;IACjE,IAAI,CAAC;QACJ,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAEjC,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C;IAEtC,MAAM,IAAA,oBAAY,EAAC,kFAAkF,CAAC,CAAC;IACvG,MAAM,gBAAgB,GAAG,2CAAoB,CAAC,mBAAmB,EAAE,CAAC;IAEpE,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAAiB,CAAC;IAEtD,KAAK,MAAM,EAAE,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,IAAI,gBAAgB,EAAE,CAAC;QAC3E,IAAI,QAAQ,GAAG,oBAAoB,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAC3D,IAAI,CAAC,QAAQ,EAAE,CAAC;YACf,QAAQ,GAAG,kBAAS,CAAC,GAAG,CAAC,iBAAwB,CAAC,CAAC;YACnD,oBAAoB,CAAC,GAAG,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;QACvD,CAAC;QAED,MAAM,IAAA,wBAAgB,EAAC,OAAO,EAAE,KAAK,EAAC,OAAO,EAAC,EAAE;YAC/C,OAAO,QAAQ,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC;AAED,SAAgB,YAAY;IAC3B,OAAO,kBAAS,CAAC,GAAG,CAAC,0BAAc,CAAC,CAAC;AACtC,CAAC","sourcesContent":["import {LibraryManager} from './libraries';\r\nimport {Container} from 'typedi';\r\nimport mongoose from 'mongoose';\r\nimport {ConfigurationOptions, ConfigurationService} from './libraries/configuration';\r\nimport {EnvironmentConfigurationType} from './libraries/configuration/types/EnvironmentConfigurationType';\r\nimport {LyxaLogger} from './libraries/logger';\r\nimport {RedisService} from './libraries/redis';\r\nimport {initGlobalConnection} from './libraries/mongo';\r\nimport {SecretManagerService} from './libraries/secrets';\r\nimport {MicroServiceDispatcher} from './libraries/dispatcher';\r\nimport {TwilioService} from './libraries/twilio';\r\nimport {FirebaseService} from './libraries/firebase';\r\nimport {initEventBus, subscribeToEvent} from './libraries/event';\r\nimport {SubscriptionRegistry} from './libraries/event/registry/SubscriptionRegistry';\r\n\r\nexport { ConfigurationOptions } from './libraries/configuration';\r\nexport { EnvironmentConfigurationType } from './libraries/configuration/types/EnvironmentConfigurationType';\r\nexport { initGlobalConnection, createGlobalModel, createGlobalDiscriminatorModel } from './libraries/mongo';\r\n\r\nexport async function bootstrapCore(options?: ConfigurationOptions) {\r\n\ttry {\r\n\t\tawait registerLibraries(options);\r\n\r\n\t\tgetLibraries().getLogger().logger.info('Successfully bootstrapped lyxa-core.');\r\n\r\n\t\tconst gracefulShutdown = async () => {\r\n\t\t\tgetLibraries().getLogger().logger.info('Received shutdown signal, shutting down gracefully...');\r\n\t\t\tprocess.exit()\r\n\t\t};\r\n\r\n\t\tprocess.on('SIGTERM', gracefulShutdown);\r\n\t\tprocess.on('SIGINT', gracefulShutdown);\r\n\t\tprocess.on('uncaughtException', err => {\r\n\t\t\tgetLibraries().getLogger().logger.error('Uncaught exception, shutting down...', err);\r\n\t\t\tgracefulShutdown();\r\n\t\t});\r\n\t\tprocess.on('exit', (code) => {\r\n\t\t\tgetLibraries().getLogger().logger.info(`Exiting with code: ${code}`);\r\n\t\t});\r\n\r\n\t\tconsole.log('Created hooks.');\r\n\t} catch (e) {\r\n\t\tconsole.error(e);\r\n\t}\r\n}\r\n\r\nexport async function registerLibraries(options?: ConfigurationOptions) {\r\n\t// Setup configuration.\r\n\tconst configurationInstance = new ConfigurationService(options);\r\n\tContainer.set(ConfigurationService, configurationInstance);\r\n\r\n\t// Setup redis.\r\n\tconst redisInstance = new RedisService(configurationInstance.options.redisURL!);\r\n\tContainer.set(RedisService, redisInstance);\r\n\r\n\t// Setup secret\r\n\tconst secretInstance = new SecretManagerService(configurationInstance, redisInstance);\r\n\tContainer.set(SecretManagerService, secretInstance);\r\n\r\n\tconst mongoUrl = await getLibraries().getSecretsService().getKey('MONGO_URL');\r\n\r\n\tawait mongoose.connect(mongoUrl!, { dbName: `lyxa-${options!.environment}-${options!.tenet}` });\r\n\tmongoose.set(\r\n\t\t'debug',\r\n\t\tgetLibraries().getConfigurationService().options.environment == EnvironmentConfigurationType.DEV\r\n\t);\r\n\r\n\tawait initGlobalConnection(mongoUrl!, options!.environment);\r\n\r\n\t// Setup logger\r\n\tconst loggerInstance = new LyxaLogger(options!.instanceType!, mongoUrl!);\r\n\tContainer.set(LyxaLogger, loggerInstance);\r\n\r\n\t// Setup firebase\r\n\tconst firebaseInstance = new FirebaseService(configurationInstance!);\r\n\tContainer.set(FirebaseService, firebaseInstance);\r\n\r\n\t// Setup microservice dispatcher\r\n\tconst microserviceDispatcherInstance = new MicroServiceDispatcher(secretInstance);\r\n\tContainer.set(MicroServiceDispatcher, microserviceDispatcherInstance);\r\n\r\n\t// Setup twilio\r\n\tconst twilioServiceInstance = new TwilioService();\r\n\tContainer.set(TwilioService, twilioServiceInstance);\r\n\r\n\tconsole.log('Initialized everything');\r\n\r\n\tawait initEventBus('amqps://vgyuplrd:wto6vUYnb4zeBI5lntKT4gj7rT8n1vwg@dog.lmq.cloudamqp.com/vgyuplrd');\r\n\tconst allSubscriptions = SubscriptionRegistry.getAllSubscriptions();\r\n\r\n\tconst instantiatedServices = new Map<Function, any>();\r\n\r\n\tfor (const { eventId, targetConstructor, methodName } of allSubscriptions) {\r\n\t\tlet instance = instantiatedServices.get(targetConstructor);\r\n\t\tif (!instance) {\r\n\t\t\tinstance = Container.get(targetConstructor as any);\r\n\t\t\tinstantiatedServices.set(targetConstructor, instance);\r\n\t\t}\r\n\r\n\t\tawait subscribeToEvent(eventId, async payload => {\r\n\t\t\treturn instance[methodName](payload);\r\n\t\t});\r\n\t}\r\n}\r\n\r\nexport function getLibraries(): LibraryManager {\r\n\treturn Container.get(LibraryManager);\r\n}\r\n"]}
|
|
@@ -8,13 +8,21 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.LyxaLogger = void 0;
|
|
16
|
+
const fs_1 = __importDefault(require("fs"));
|
|
17
|
+
const path_1 = __importDefault(require("path"));
|
|
13
18
|
const pino_1 = require("pino");
|
|
14
19
|
const typedi_1 = require("typedi");
|
|
15
20
|
let LyxaLogger = class LyxaLogger {
|
|
16
21
|
_logger;
|
|
22
|
+
logDirectory;
|
|
17
23
|
constructor(identifier, mongoURI) {
|
|
24
|
+
this.logDirectory = path_1.default.join(process.cwd(), 'logs');
|
|
25
|
+
this.ensureLogDirectoryExists();
|
|
18
26
|
const transports = pino_1.pino.transport({
|
|
19
27
|
targets: [
|
|
20
28
|
{
|
|
@@ -27,7 +35,7 @@ let LyxaLogger = class LyxaLogger {
|
|
|
27
35
|
{
|
|
28
36
|
target: 'pino/file',
|
|
29
37
|
options: {
|
|
30
|
-
destination: '
|
|
38
|
+
destination: path_1.default.join(this.logDirectory, 'error.log'),
|
|
31
39
|
},
|
|
32
40
|
level: 'error',
|
|
33
41
|
},
|
|
@@ -46,6 +54,14 @@ let LyxaLogger = class LyxaLogger {
|
|
|
46
54
|
level: 'info',
|
|
47
55
|
}, transports);
|
|
48
56
|
}
|
|
57
|
+
ensureLogDirectoryExists() {
|
|
58
|
+
try {
|
|
59
|
+
fs_1.default.mkdirSync(this.logDirectory, { recursive: true });
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
console.error('Failed to create log directory:', error);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
49
65
|
get logger() {
|
|
50
66
|
return this._logger;
|
|
51
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/logger/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index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AAC,CAAC;QACzD,CAAC;IACF,CAAC;IAED,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,OAAO,CAAC;IACrB,CAAC;CACD,CAAA;AAxDY,gCAAU;qBAAV,UAAU;IADtB,IAAA,gBAAO,GAAE;;GACG,UAAU,CAwDtB","sourcesContent":["import fs from 'fs';\r\nimport path from 'path';\r\nimport { pino, Logger } from 'pino';\r\nimport { Service } from 'typedi';\r\n\r\n@Service()\r\nexport class LyxaLogger {\r\n\tprivate readonly _logger: Logger;\r\n\tprivate readonly logDirectory: string;\r\n\r\n\tconstructor(identifier: string, mongoURI: string) {\r\n\t\tthis.logDirectory = path.join(process.cwd(), 'logs');\r\n\r\n\t\tthis.ensureLogDirectoryExists();\r\n\r\n\t\tconst transports = pino.transport({\r\n\t\t\ttargets: [\r\n\t\t\t\t{\r\n\t\t\t\t\ttarget: 'pino-pretty',\r\n\t\t\t\t\toptions: {\r\n\t\t\t\t\t\tcolorize: true,\r\n\t\t\t\t\t},\r\n\t\t\t\t\tlevel: 'info',\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\ttarget: 'pino/file',\r\n\t\t\t\t\toptions: {\r\n\t\t\t\t\t\tdestination: path.join(this.logDirectory, 'error.log'),\r\n\t\t\t\t\t},\r\n\t\t\t\t\tlevel: 'error',\r\n\t\t\t\t},\r\n\t\t\t\t{\r\n\t\t\t\t\ttarget: 'pino-mongodb',\r\n\t\t\t\t\toptions: {\r\n\t\t\t\t\t\turi: mongoURI,\r\n\t\t\t\t\t\tdatabase: 'lyxa-logs',\r\n\t\t\t\t\t\tcollection: identifier,\r\n\t\t\t\t\t},\r\n\t\t\t\t\tlevel: 'error',\r\n\t\t\t\t},\r\n\t\t\t],\r\n\t\t});\r\n\r\n\t\tthis._logger = pino(\r\n\t\t\t{\r\n\t\t\t\tlevel: 'info',\r\n\t\t\t},\r\n\t\t\ttransports\r\n\t\t);\r\n\t}\r\n\r\n\tprivate ensureLogDirectoryExists(): void {\r\n\t\ttry {\r\n\t\t\tfs.mkdirSync(this.logDirectory, { recursive: true });\r\n\t\t} catch (error) {\r\n\t\t\tconsole.error('Failed to create log directory:', error);\r\n\t\t}\r\n\t}\r\n\r\n\tget logger(): Logger {\r\n\t\treturn this._logger;\r\n\t}\r\n}\r\n"]}
|
|
@@ -18,7 +18,7 @@ async function initGlobalConnection(uri, environment) {
|
|
|
18
18
|
const connection = (0, mongoose_1.createConnection)(uri, {
|
|
19
19
|
dbName: `lyxa-${environment}-global`,
|
|
20
20
|
});
|
|
21
|
-
connection.once('connected', () => {
|
|
21
|
+
connection.once('connected', async () => {
|
|
22
22
|
console.log('Global connection successfully established');
|
|
23
23
|
globalConnection = connection;
|
|
24
24
|
for (const [modelName, { Class, options, resolve }] of pendingModels.entries()) {
|
|
@@ -29,12 +29,19 @@ async function initGlobalConnection(uri, environment) {
|
|
|
29
29
|
resolve(model);
|
|
30
30
|
}
|
|
31
31
|
pendingModels.clear();
|
|
32
|
-
for (const [modelName, {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
for (const [modelName, { baseModelPromise, subClass, discriminatorName, options, resolve },] of pendingDiscriminatorModels.entries()) {
|
|
33
|
+
try {
|
|
34
|
+
const actualBaseModel = await baseModelPromise;
|
|
35
|
+
const model = (0, typegoose_1.getDiscriminatorModelForClass)(actualBaseModel, subClass, discriminatorName, {
|
|
36
|
+
existingConnection: globalConnection,
|
|
37
|
+
...options,
|
|
38
|
+
});
|
|
39
|
+
resolve(model);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
console.error(`Failed to create discriminator model ${modelName}:`, error);
|
|
43
|
+
resolve(Promise.reject(error));
|
|
44
|
+
}
|
|
38
45
|
}
|
|
39
46
|
pendingDiscriminatorModels.clear();
|
|
40
47
|
resolve(connection);
|
|
@@ -53,12 +60,15 @@ function createGlobalModel(Class, options) {
|
|
|
53
60
|
}
|
|
54
61
|
console.log(`Registering model ${modelName} to be initialized when global connection is ready`);
|
|
55
62
|
let actualModel = null;
|
|
56
|
-
let modelReadyPromise
|
|
63
|
+
let modelReadyPromise;
|
|
57
64
|
modelReadyPromise = new Promise(resolve => {
|
|
58
65
|
pendingModels.set(modelName, { Class, options, resolve });
|
|
59
66
|
});
|
|
60
67
|
const modelProxy = new Proxy({}, {
|
|
61
68
|
get(target, prop, receiver) {
|
|
69
|
+
if (prop === 'then') {
|
|
70
|
+
return modelReadyPromise.then.bind(modelReadyPromise);
|
|
71
|
+
}
|
|
62
72
|
return async function (...args) {
|
|
63
73
|
if (!actualModel) {
|
|
64
74
|
actualModel = await modelReadyPromise;
|
|
@@ -76,6 +86,16 @@ function createGlobalModel(Class, options) {
|
|
|
76
86
|
function createGlobalDiscriminatorModel(baseModel, subClass, discriminatorName, options) {
|
|
77
87
|
const modelName = discriminatorName || subClass.name;
|
|
78
88
|
if (globalConnection) {
|
|
89
|
+
if (baseModel instanceof Promise || baseModel.then) {
|
|
90
|
+
const discriminatorPromise = (async () => {
|
|
91
|
+
const resolvedBaseModel = await baseModel;
|
|
92
|
+
return (0, typegoose_1.getDiscriminatorModelForClass)(resolvedBaseModel, subClass, discriminatorName, {
|
|
93
|
+
existingConnection: globalConnection,
|
|
94
|
+
...options,
|
|
95
|
+
});
|
|
96
|
+
})();
|
|
97
|
+
return createProxyForPromise(discriminatorPromise);
|
|
98
|
+
}
|
|
79
99
|
return (0, typegoose_1.getDiscriminatorModelForClass)(baseModel, subClass, discriminatorName, {
|
|
80
100
|
existingConnection: globalConnection,
|
|
81
101
|
...options,
|
|
@@ -83,30 +103,43 @@ function createGlobalDiscriminatorModel(baseModel, subClass, discriminatorName,
|
|
|
83
103
|
}
|
|
84
104
|
console.log(`Registering discriminator model ${modelName} to be initialized when global connection is ready`);
|
|
85
105
|
let actualModel = null;
|
|
86
|
-
let modelReadyPromise
|
|
106
|
+
let modelReadyPromise;
|
|
107
|
+
let baseModelPromise;
|
|
108
|
+
if (baseModel instanceof Promise || baseModel.then) {
|
|
109
|
+
baseModelPromise = Promise.resolve(baseModel);
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
baseModelPromise = Promise.resolve(baseModel);
|
|
113
|
+
}
|
|
87
114
|
modelReadyPromise = new Promise(resolve => {
|
|
88
115
|
pendingDiscriminatorModels.set(modelName, {
|
|
89
|
-
|
|
116
|
+
baseModelPromise,
|
|
90
117
|
subClass,
|
|
91
118
|
discriminatorName,
|
|
92
119
|
options,
|
|
93
120
|
resolve,
|
|
94
121
|
});
|
|
95
122
|
});
|
|
96
|
-
|
|
123
|
+
return createProxyForPromise(modelReadyPromise);
|
|
124
|
+
}
|
|
125
|
+
function createProxyForPromise(promise) {
|
|
126
|
+
let resolvedValue = null;
|
|
127
|
+
return new Proxy({}, {
|
|
97
128
|
get(target, prop, receiver) {
|
|
129
|
+
if (prop === 'then') {
|
|
130
|
+
return promise.then.bind(promise);
|
|
131
|
+
}
|
|
98
132
|
return async function (...args) {
|
|
99
|
-
if (!
|
|
100
|
-
|
|
133
|
+
if (!resolvedValue) {
|
|
134
|
+
resolvedValue = await promise;
|
|
101
135
|
}
|
|
102
|
-
const propValue =
|
|
136
|
+
const propValue = resolvedValue[prop];
|
|
103
137
|
if (typeof propValue === 'function') {
|
|
104
|
-
return propValue.apply(
|
|
138
|
+
return propValue.apply(resolvedValue, args);
|
|
105
139
|
}
|
|
106
140
|
return propValue;
|
|
107
141
|
};
|
|
108
142
|
},
|
|
109
143
|
});
|
|
110
|
-
return modelProxy;
|
|
111
144
|
}
|
|
112
145
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/mongo/index.ts"],"names":[],"mappings":";;AAkCA,oDAwCC;AAMD,8CA4CC;AAMD,wEAyDC;AA3LD,uCAAkE;AAClE,oDAAwG;AAExG,qEAAqE;AAGrE,IAAA,0CAAqB,GAAE,CAAC;AAGxB,IAAI,gBAAwC,CAAC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AC3C,CAAC;gBACD,OAAO,SAAS,CAAC;YAClB,CAAC,CAAC;QACH,CAAC;KACD,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACnB,CAAC","sourcesContent":["import mongoose, { Connection, createConnection } from 'mongoose';\r\nimport { getDiscriminatorModelForClass, getModelForClass, ReturnModelType } from '@typegoose/typegoose';\r\nimport { AnyParamConstructor, IModelOptions } from '@typegoose/typegoose/lib/types';\r\nimport { applySoftDeletePlugin } from './plugins/soft-delete-plugin';\r\n\r\n// Apply the soft delete plugin globally before any connections or models\r\napplySoftDeletePlugin();\r\n\r\n// Track connection status\r\nlet globalConnection: Connection | undefined;\r\nlet connectionPromise: Promise<Connection> | null = null;\r\nlet pendingModels = new Map<\r\n\tstring,\r\n\t{\r\n\t\tClass: AnyParamConstructor<any>;\r\n\t\toptions?: IModelOptions;\r\n\t\tresolve: (model: any) => void;\r\n\t}\r\n>();\r\n\r\nlet pendingDiscriminatorModels = new Map<\r\n\tstring,\r\n\t{\r\n\t\tbaseModel: any;\r\n\t\tsubClass: AnyParamConstructor<any>;\r\n\t\tdiscriminatorName?: string;\r\n\t\toptions?: IModelOptions;\r\n\t\tresolve: (model: any) => void;\r\n\t}\r\n>();\r\n\r\n/**\r\n * Initialize the global database connection\r\n */\r\nexport async function initGlobalConnection(uri: string, environment: string): Promise<Connection> {\r\n\tif (!connectionPromise) {\r\n\t\tconnectionPromise = new Promise<Connection>(resolve => {\r\n\t\t\tconsole.log(`Initializing global connection for environment: ${environment}`);\r\n\t\t\tconst connection = createConnection(uri, {\r\n\t\t\t\tdbName: `lyxa-${environment}-global`,\r\n\t\t\t});\r\n\r\n\t\t\tconnection.once('connected', () => {\r\n\t\t\t\tconsole.log('Global connection successfully established');\r\n\t\t\t\tglobalConnection = connection;\r\n\r\n\t\t\t\t// Initialize any pending models with the real connection\r\n\t\t\t\tfor (const [modelName, { Class, options, resolve }] of pendingModels.entries()) {\r\n\t\t\t\t\tconst model = getModelForClass(Class, {\r\n\t\t\t\t\t\texistingConnection: globalConnection,\r\n\t\t\t\t\t\t...options,\r\n\t\t\t\t\t});\r\n\t\t\t\t\tresolve(model);\r\n\t\t\t\t}\r\n\t\t\t\tpendingModels.clear();\r\n\r\n\t\t\t\t// Initialize any pending discriminator models\r\n\t\t\t\tfor (const [\r\n\t\t\t\t\tmodelName,\r\n\t\t\t\t\t{ baseModel, subClass, discriminatorName, options, resolve },\r\n\t\t\t\t] of pendingDiscriminatorModels.entries()) {\r\n\t\t\t\t\tconst model = getDiscriminatorModelForClass(baseModel, subClass, discriminatorName, {\r\n\t\t\t\t\t\texistingConnection: globalConnection,\r\n\t\t\t\t\t\t...options,\r\n\t\t\t\t\t});\r\n\t\t\t\t\tresolve(model);\r\n\t\t\t\t}\r\n\t\t\t\tpendingDiscriminatorModels.clear();\r\n\r\n\t\t\t\tresolve(connection);\r\n\t\t\t});\r\n\t\t});\r\n\t}\r\n\treturn connectionPromise;\r\n}\r\n\r\n/**\r\n * Creates a Typegoose model that will use the global connection when it's ready.\r\n * Safe to call during module initialization before initGlobalConnection.\r\n */\r\nexport function createGlobalModel<T extends AnyParamConstructor<any>>(\r\n\tClass: T,\r\n\toptions?: IModelOptions\r\n): ReturnModelType<T> {\r\n\tconst modelName = options?.schemaOptions?.collection || Class.name;\r\n\r\n\t// If the connection is already initialized, create the model directly\r\n\tif (globalConnection) {\r\n\t\treturn getModelForClass(Class, {\r\n\t\t\texistingConnection: globalConnection,\r\n\t\t\t...options,\r\n\t\t});\r\n\t}\r\n\r\n\tconsole.log(`Registering model ${modelName} to be initialized when global connection is ready`);\r\n\r\n\t// Create a lazy-loaded model instance that will initialize once the connection is ready\r\n\tlet actualModel: ReturnModelType<T> | null = null;\r\n\tlet modelReadyPromise: Promise<ReturnModelType<T>> | null = null;\r\n\r\n\t// Setup the promise that will resolve once the model is ready\r\n\tmodelReadyPromise = new Promise<ReturnModelType<T>>(resolve => {\r\n\t\t// Register this model to be initialized when connection is ready\r\n\t\tpendingModels.set(modelName, { Class, options, resolve });\r\n\t});\r\n\r\n\t// Create a proxy that forwards operations to the real model once it's available\r\n\tconst modelProxy = new Proxy({} as ReturnModelType<T>, {\r\n\t\tget(target, prop, receiver) {\r\n\t\t\treturn async function (...args: any[]) {\r\n\t\t\t\tif (!actualModel) {\r\n\t\t\t\t\tactualModel = await modelReadyPromise!;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst propValue = (actualModel as any)[prop];\r\n\t\t\t\tif (typeof propValue === 'function') {\r\n\t\t\t\t\treturn propValue.apply(actualModel, args);\r\n\t\t\t\t}\r\n\t\t\t\treturn propValue;\r\n\t\t\t};\r\n\t\t},\r\n\t});\r\n\r\n\treturn modelProxy;\r\n}\r\n\r\n/**\r\n * Creates a Typegoose discriminator model that will use the global connection when it's ready.\r\n * Safe to call during module initialization before initGlobalConnection.\r\n */\r\nexport function createGlobalDiscriminatorModel<\r\n\tBase extends AnyParamConstructor<any>,\r\n\tSub extends AnyParamConstructor<any>,\r\n>(\r\n\tbaseModel: ReturnModelType<Base>,\r\n\tsubClass: Sub,\r\n\tdiscriminatorName?: string,\r\n\toptions?: IModelOptions\r\n): ReturnModelType<Sub> {\r\n\tconst modelName = discriminatorName || subClass.name;\r\n\r\n\t// If the connection is already initialized, create the model directly\r\n\tif (globalConnection) {\r\n\t\treturn getDiscriminatorModelForClass(baseModel, subClass, discriminatorName, {\r\n\t\t\texistingConnection: globalConnection,\r\n\t\t\t...options,\r\n\t\t});\r\n\t}\r\n\r\n\tconsole.log(\r\n\t\t`Registering discriminator model ${modelName} to be initialized when global connection is ready`\r\n\t);\r\n\r\n\t// Create a lazy-loaded model instance that will initialize once the connection is ready\r\n\tlet actualModel: ReturnModelType<Sub> | null = null;\r\n\tlet modelReadyPromise: Promise<ReturnModelType<Sub>> | null = null;\r\n\r\n\t// Setup the promise that will resolve once the model is ready\r\n\tmodelReadyPromise = new Promise<ReturnModelType<Sub>>(resolve => {\r\n\t\t// Register this discriminator model to be initialized when connection is ready\r\n\t\tpendingDiscriminatorModels.set(modelName, {\r\n\t\t\tbaseModel,\r\n\t\t\tsubClass,\r\n\t\t\tdiscriminatorName,\r\n\t\t\toptions,\r\n\t\t\tresolve,\r\n\t\t});\r\n\t});\r\n\r\n\t// Create a proxy that forwards operations to the real model once it's available\r\n\tconst modelProxy = new Proxy({} as ReturnModelType<Sub>, {\r\n\t\tget(target, prop, receiver) {\r\n\t\t\treturn async function (...args: any[]) {\r\n\t\t\t\tif (!actualModel) {\r\n\t\t\t\t\tactualModel = await modelReadyPromise!;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst propValue = (actualModel as any)[prop];\r\n\t\t\t\tif (typeof propValue === 'function') {\r\n\t\t\t\t\treturn propValue.apply(actualModel, args);\r\n\t\t\t\t}\r\n\t\t\t\treturn propValue;\r\n\t\t\t};\r\n\t\t},\r\n\t});\r\n\r\n\treturn modelProxy;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/mongo/index.ts"],"names":[],"mappings":";;AAkCA,oDAmDC;AAMD,8CAiDC;AAMD,wEAgEC;AAlND,uCAAkE;AAClE,oDAAwG;AAExG,qEAAqE;AAGrE,IAAA,0CAAqB,GAAE,CAAC;AAGxB,IAAI,gBAAwC,CAAC;AAC7C,IAAI,iBAAiB,GAA+B,IAAI,CAAC;AACzD,IAAI,aAAa,GAAG,IAAI,GAAG,EAOxB,CAAC;AAEJ,IAAI,0BAA0B,GAAG,IAAI,GAAG,EASrC,CAAC;AAKG,KAAK,UAAU,oBAAoB,CAAC,GAAW,EAAE,WAAmB;IAC1E,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACxB,iBAAiB,GAAG,IAAI,OAAO,CAAa,OAAO,CAAC,EAAE;YACrD,OAAO,CAAC,GAAG,CAAC,mDAAmD,WAAW,EAAE,CAAC,CAAC;YAC9E,MAAM,UAAU,GAAG,IAAA,2BAAgB,EAAC,GAAG,EAAE;gBACxC,MAAM,EAAE,QAAQ,WAAW,SAA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AAO,CAAuB,OAAO,CAAC,EAAE;QAE/D,0BAA0B,CAAC,GAAG,CAAC,SAAS,EAAE;YACzC,gBAAgB;YAChB,QAAQ;YACR,iBAAiB;YACjB,OAAO;YACP,OAAO;SACP,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,qBAAqB,CAAC,iBAAiB,CAAC,CAAC;AACjD,CAAC;AAKD,SAAS,qBAAqB,CAAmB,OAAmB;IACnE,IAAI,aAAa,GAAa,IAAI,CAAC;IAEnC,OAAO,IAAI,KAAK,CAAC,EAAO,EAAE;QACzB,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ;YAEzB,IAAI,IAAI,KAAK,MAAM,EAAE,CAAC;gBACrB,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACnC,CAAC;YAED,OAAO,KAAK,WAAW,GAAG,IAAW;gBACpC,IAAI,CAAC,aAAa,EAAE,CAAC;oBACpB,aAAa,GAAG,MAAM,OAAO,CAAC;gBAC/B,CAAC;gBAED,MAAM,SAAS,GAAI,aAAqB,CAAC,IAAI,CAAC,CAAC;gBAC/C,IAAI,OAAO,SAAS,KAAK,UAAU,EAAE,CAAC;oBACrC,OAAO,SAAS,CAAC,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC;gBAC7C,CAAC;gBACD,OAAO,SAAS,CAAC;YAClB,CAAC,CAAC;QACH,CAAC;KACD,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import mongoose, { Connection, createConnection } from 'mongoose';\r\nimport { getDiscriminatorModelForClass, getModelForClass, ReturnModelType } from '@typegoose/typegoose';\r\nimport { AnyParamConstructor, IModelOptions } from '@typegoose/typegoose/lib/types';\r\nimport { applySoftDeletePlugin } from './plugins/soft-delete-plugin';\r\n\r\n// Apply the soft delete plugin globally before any connections or models\r\napplySoftDeletePlugin();\r\n\r\n// Track connection status\r\nlet globalConnection: Connection | undefined;\r\nlet connectionPromise: Promise<Connection> | null = null;\r\nlet pendingModels = new Map<\r\n\tstring,\r\n\t{\r\n\t\tClass: AnyParamConstructor<any>;\r\n\t\toptions?: IModelOptions;\r\n\t\tresolve: (model: any) => void;\r\n\t}\r\n>();\r\n\r\nlet pendingDiscriminatorModels = new Map<\r\n\tstring,\r\n\t{\r\n\t\tbaseModelPromise: Promise<any>; // Store the promise for the base model\r\n\t\tsubClass: AnyParamConstructor<any>;\r\n\t\tdiscriminatorName?: string;\r\n\t\toptions?: IModelOptions;\r\n\t\tresolve: (model: any) => void;\r\n\t}\r\n>();\r\n\r\n/**\r\n * Initialize the global database connection\r\n */\r\nexport async function initGlobalConnection(uri: string, environment: string): Promise<Connection> {\r\n\tif (!connectionPromise) {\r\n\t\tconnectionPromise = new Promise<Connection>(resolve => {\r\n\t\t\tconsole.log(`Initializing global connection for environment: ${environment}`);\r\n\t\t\tconst connection = createConnection(uri, {\r\n\t\t\t\tdbName: `lyxa-${environment}-global`,\r\n\t\t\t});\r\n\r\n\t\t\tconnection.once('connected', async () => {\r\n\t\t\t\tconsole.log('Global connection successfully established');\r\n\t\t\t\tglobalConnection = connection;\r\n\r\n\t\t\t\t// Initialize any pending models with the real connection\r\n\t\t\t\tfor (const [modelName, { Class, options, resolve }] of pendingModels.entries()) {\r\n\t\t\t\t\tconst model = getModelForClass(Class, {\r\n\t\t\t\t\t\texistingConnection: globalConnection,\r\n\t\t\t\t\t\t...options,\r\n\t\t\t\t\t});\r\n\t\t\t\t\tresolve(model);\r\n\t\t\t\t}\r\n\t\t\t\tpendingModels.clear();\r\n\r\n\t\t\t\t// Initialize any pending discriminator models\r\n\t\t\t\t// Process discriminators sequentially to ensure dependencies are resolved\r\n\t\t\t\tfor (const [\r\n\t\t\t\t\tmodelName,\r\n\t\t\t\t\t{ baseModelPromise, subClass, discriminatorName, options, resolve },\r\n\t\t\t\t] of pendingDiscriminatorModels.entries()) {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\t// Await the base model to be fully resolved\r\n\t\t\t\t\t\tconst actualBaseModel = await baseModelPromise;\r\n\r\n\t\t\t\t\t\t// Create the discriminator model with the actual base model\r\n\t\t\t\t\t\tconst model = getDiscriminatorModelForClass(actualBaseModel, subClass, discriminatorName, {\r\n\t\t\t\t\t\t\texistingConnection: globalConnection,\r\n\t\t\t\t\t\t\t...options,\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\tresolve(model);\r\n\t\t\t\t\t} catch (error) {\r\n\t\t\t\t\t\tconsole.error(`Failed to create discriminator model ${modelName}:`, error);\r\n\t\t\t\t\t\t// Resolve with error to unblock the promise chain\r\n\t\t\t\t\t\tresolve(Promise.reject(error));\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tpendingDiscriminatorModels.clear();\r\n\r\n\t\t\t\tresolve(connection);\r\n\t\t\t});\r\n\t\t});\r\n\t}\r\n\treturn connectionPromise;\r\n}\r\n\r\n/**\r\n * Creates a Typegoose model that will use the global connection when it's ready.\r\n * Safe to call during module initialization before initGlobalConnection.\r\n */\r\nexport function createGlobalModel<T extends AnyParamConstructor<any>>(\r\n\tClass: T,\r\n\toptions?: IModelOptions\r\n): ReturnModelType<T> {\r\n\tconst modelName = options?.schemaOptions?.collection || Class.name;\r\n\r\n\t// If the connection is already initialized, create the model directly\r\n\tif (globalConnection) {\r\n\t\treturn getModelForClass(Class, {\r\n\t\t\texistingConnection: globalConnection,\r\n\t\t\t...options,\r\n\t\t});\r\n\t}\r\n\r\n\tconsole.log(`Registering model ${modelName} to be initialized when global connection is ready`);\r\n\r\n\t// Create a lazy-loaded model instance that will initialize once the connection is ready\r\n\tlet actualModel: ReturnModelType<T> | null = null;\r\n\tlet modelReadyPromise: Promise<ReturnModelType<T>>;\r\n\r\n\t// Setup the promise that will resolve once the model is ready\r\n\tmodelReadyPromise = new Promise<ReturnModelType<T>>(resolve => {\r\n\t\t// Register this model to be initialized when connection is ready\r\n\t\tpendingModels.set(modelName, { Class, options, resolve });\r\n\t});\r\n\r\n\t// Create a proxy that forwards operations to the real model once it's available\r\n\tconst modelProxy = new Proxy({} as ReturnModelType<T>, {\r\n\t\tget(target, prop, receiver) {\r\n\t\t\t// Handle special case for 'then' to make the proxy thenable\r\n\t\t\tif (prop === 'then') {\r\n\t\t\t\treturn modelReadyPromise.then.bind(modelReadyPromise);\r\n\t\t\t}\r\n\r\n\t\t\treturn async function (...args: any[]) {\r\n\t\t\t\tif (!actualModel) {\r\n\t\t\t\t\tactualModel = await modelReadyPromise;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst propValue = (actualModel as any)[prop];\r\n\t\t\t\tif (typeof propValue === 'function') {\r\n\t\t\t\t\treturn propValue.apply(actualModel, args);\r\n\t\t\t\t}\r\n\t\t\t\treturn propValue;\r\n\t\t\t};\r\n\t\t},\r\n\t});\r\n\r\n\treturn modelProxy;\r\n}\r\n\r\n/**\r\n * Creates a Typegoose discriminator model that will use the global connection when it's ready.\r\n * Safe to call during module initialization before initGlobalConnection.\r\n */\r\nexport function createGlobalDiscriminatorModel<\r\n\tBase extends AnyParamConstructor<any>,\r\n\tSub extends AnyParamConstructor<any>,\r\n>(\r\n\tbaseModel: ReturnModelType<Base>,\r\n\tsubClass: Sub,\r\n\tdiscriminatorName?: string,\r\n\toptions?: IModelOptions\r\n): ReturnModelType<Sub> {\r\n\tconst modelName = discriminatorName || subClass.name;\r\n\r\n\t// If the connection is already initialized, create the model directly\r\n\tif (globalConnection) {\r\n\t\t// Ensure baseModel is fully resolved if it's a promise or proxy\r\n\t\tif (baseModel instanceof Promise || (baseModel as any).then) {\r\n\t\t\t// Create a new promise that will resolve with the discriminator model\r\n\t\t\tconst discriminatorPromise = (async () => {\r\n\t\t\t\tconst resolvedBaseModel = await baseModel;\r\n\t\t\t\treturn getDiscriminatorModelForClass(resolvedBaseModel, subClass, discriminatorName, {\r\n\t\t\t\t\texistingConnection: globalConnection,\r\n\t\t\t\t\t...options,\r\n\t\t\t\t});\r\n\t\t\t})();\r\n\r\n\t\t\t// Return a proxy that will await the discriminator model\r\n\t\t\treturn createProxyForPromise(discriminatorPromise);\r\n\t\t}\r\n\r\n\t\t// If baseModel is not a promise, create the discriminator directly\r\n\t\treturn getDiscriminatorModelForClass(baseModel, subClass, discriminatorName, {\r\n\t\t\texistingConnection: globalConnection,\r\n\t\t\t...options,\r\n\t\t});\r\n\t}\r\n\r\n\tconsole.log(\r\n\t\t`Registering discriminator model ${modelName} to be initialized when global connection is ready`\r\n\t);\r\n\r\n\t// Create a lazy-loaded model instance that will initialize once the connection is ready\r\n\tlet actualModel: ReturnModelType<Sub> | null = null;\r\n\tlet modelReadyPromise: Promise<ReturnModelType<Sub>>;\r\n\r\n\t// Handle the case where baseModel might be a proxy or promise\r\n\tlet baseModelPromise: Promise<any>;\r\n\tif (baseModel instanceof Promise || (baseModel as any).then) {\r\n\t\tbaseModelPromise = Promise.resolve(baseModel);\r\n\t} else {\r\n\t\tbaseModelPromise = Promise.resolve(baseModel);\r\n\t}\r\n\r\n\t// Setup the promise that will resolve once the model is ready\r\n\tmodelReadyPromise = new Promise<ReturnModelType<Sub>>(resolve => {\r\n\t\t// Register this discriminator model to be initialized when connection is ready\r\n\t\tpendingDiscriminatorModels.set(modelName, {\r\n\t\t\tbaseModelPromise,\r\n\t\t\tsubClass,\r\n\t\t\tdiscriminatorName,\r\n\t\t\toptions,\r\n\t\t\tresolve,\r\n\t\t});\r\n\t});\r\n\r\n\treturn createProxyForPromise(modelReadyPromise);\r\n}\r\n\r\n/**\r\n * Helper function to create a proxy for a promise that will resolve to a model\r\n */\r\nfunction createProxyForPromise<T extends object>(promise: Promise<T>): T {\r\n\tlet resolvedValue: T | null = null;\r\n\r\n\treturn new Proxy({} as T, {\r\n\t\tget(target, prop, receiver) {\r\n\t\t\t// Handle special case for 'then' to make the proxy thenable\r\n\t\t\tif (prop === 'then') {\r\n\t\t\t\treturn promise.then.bind(promise);\r\n\t\t\t}\r\n\r\n\t\t\treturn async function (...args: any[]) {\r\n\t\t\t\tif (!resolvedValue) {\r\n\t\t\t\t\tresolvedValue = await promise;\r\n\t\t\t\t}\r\n\r\n\t\t\t\tconst propValue = (resolvedValue as any)[prop];\r\n\t\t\t\tif (typeof propValue === 'function') {\r\n\t\t\t\t\treturn propValue.apply(resolvedValue, args);\r\n\t\t\t\t}\r\n\t\t\t\treturn propValue;\r\n\t\t\t};\r\n\t\t},\r\n\t});\r\n}\r\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Card } from "./card.model";
|
|
2
|
+
export declare enum AreebaCardStatus {
|
|
3
|
+
PENDING = "PENDING",
|
|
4
|
+
ACTIVE = "ACTIVE"
|
|
5
|
+
}
|
|
6
|
+
export declare class AreebaCard extends Card {
|
|
7
|
+
orderId?: string;
|
|
8
|
+
sessionId?: string;
|
|
9
|
+
brand?: string;
|
|
10
|
+
expiry?: string;
|
|
11
|
+
fundingMethod?: string;
|
|
12
|
+
nameOnCard?: string;
|
|
13
|
+
number?: string;
|
|
14
|
+
scheme?: string;
|
|
15
|
+
token?: string;
|
|
16
|
+
status?: AreebaCardStatus;
|
|
17
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AreebaCard = exports.AreebaCardStatus = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const card_model_1 = require("./card.model");
|
|
15
|
+
var AreebaCardStatus;
|
|
16
|
+
(function (AreebaCardStatus) {
|
|
17
|
+
AreebaCardStatus["PENDING"] = "PENDING";
|
|
18
|
+
AreebaCardStatus["ACTIVE"] = "ACTIVE";
|
|
19
|
+
})(AreebaCardStatus || (exports.AreebaCardStatus = AreebaCardStatus = {}));
|
|
20
|
+
class AreebaCard extends card_model_1.Card {
|
|
21
|
+
orderId;
|
|
22
|
+
sessionId;
|
|
23
|
+
brand;
|
|
24
|
+
expiry;
|
|
25
|
+
fundingMethod;
|
|
26
|
+
nameOnCard;
|
|
27
|
+
number;
|
|
28
|
+
scheme;
|
|
29
|
+
token;
|
|
30
|
+
status;
|
|
31
|
+
}
|
|
32
|
+
exports.AreebaCard = AreebaCard;
|
|
33
|
+
__decorate([
|
|
34
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
35
|
+
__metadata("design:type", String)
|
|
36
|
+
], AreebaCard.prototype, "orderId", void 0);
|
|
37
|
+
__decorate([
|
|
38
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
39
|
+
__metadata("design:type", String)
|
|
40
|
+
], AreebaCard.prototype, "sessionId", void 0);
|
|
41
|
+
__decorate([
|
|
42
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
43
|
+
__metadata("design:type", String)
|
|
44
|
+
], AreebaCard.prototype, "brand", void 0);
|
|
45
|
+
__decorate([
|
|
46
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
47
|
+
__metadata("design:type", String)
|
|
48
|
+
], AreebaCard.prototype, "expiry", void 0);
|
|
49
|
+
__decorate([
|
|
50
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
51
|
+
__metadata("design:type", String)
|
|
52
|
+
], AreebaCard.prototype, "fundingMethod", void 0);
|
|
53
|
+
__decorate([
|
|
54
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
55
|
+
__metadata("design:type", String)
|
|
56
|
+
], AreebaCard.prototype, "nameOnCard", void 0);
|
|
57
|
+
__decorate([
|
|
58
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
59
|
+
__metadata("design:type", String)
|
|
60
|
+
], AreebaCard.prototype, "number", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
63
|
+
__metadata("design:type", String)
|
|
64
|
+
], AreebaCard.prototype, "scheme", void 0);
|
|
65
|
+
__decorate([
|
|
66
|
+
(0, typegoose_1.prop)({ type: String }),
|
|
67
|
+
__metadata("design:type", String)
|
|
68
|
+
], AreebaCard.prototype, "token", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, typegoose_1.prop)({ type: String, enum: AreebaCardStatus, default: AreebaCardStatus.PENDING }),
|
|
71
|
+
__metadata("design:type", String)
|
|
72
|
+
], AreebaCard.prototype, "status", void 0);
|
|
73
|
+
//# sourceMappingURL=areeba-card.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"areeba-card.model.js","sourceRoot":"/","sources":["libraries/mongo/models/areeba-card.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA0C;AAC1C,6CAAkC;AAElC,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,uCAAmB,CAAA;IACnB,qCAAiB,CAAA;AACrB,CAAC,EAHW,gBAAgB,gCAAhB,gBAAgB,QAG3B;AAED,MAAa,UAAW,SAAQ,iBAAI;IAEzB,OAAO,CAAU;IAGjB,SAAS,CAAU;IAGnB,KAAK,CAAU;IAGf,MAAM,CAAU;IAGhB,aAAa,CAAU;IAGvB,UAAU,CAAU;IAGpB,MAAM,CAAU;IAGhB,MAAM,CAAU;IAGhB,KAAK,CAAU;IAGf,MAAM,CAAoB;CACpC;AA9BD,gCA8BC;AA5BU;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CACC;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;6CACG;AAGnB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCACD;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACA;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACO;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CACI;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACA;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACA;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCACD;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,gBAAgB,CAAC,OAAO,EAAE,CAAC;;0CACjD","sourcesContent":["import {prop} from \"@typegoose/typegoose\";\r\nimport {Card} from \"./card.model\";\r\n\r\nexport enum AreebaCardStatus {\r\n PENDING = \"PENDING\",\r\n ACTIVE = \"ACTIVE\"\r\n}\r\n\r\nexport class AreebaCard extends Card {\r\n @prop({ type: String })\r\n public orderId?: string;\r\n\r\n @prop({ type: String })\r\n public sessionId?: string;\r\n\r\n @prop({ type: String })\r\n public brand?: string;\r\n\r\n @prop({ type: String })\r\n public expiry?: string;\r\n\r\n @prop({ type: String })\r\n public fundingMethod?: string;\r\n\r\n @prop({ type: String })\r\n public nameOnCard?: string;\r\n\r\n @prop({ type: String })\r\n public number?: string;\r\n\r\n @prop({ type: String })\r\n public scheme?: string;\r\n\r\n @prop({ type: String })\r\n public token?: string;\r\n\r\n @prop({ type: String, enum: AreebaCardStatus, default: AreebaCardStatus.PENDING })\r\n public status?: AreebaCardStatus;\r\n}\r\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Ref, ReturnModelType } from '@typegoose/typegoose';
|
|
2
|
+
import { AuthIdentityType } from '../../../utilities/enum';
|
|
3
|
+
import { User } from './user.model';
|
|
4
|
+
export declare class AuthIdentity {
|
|
5
|
+
user: Ref<User>;
|
|
6
|
+
type: AuthIdentityType;
|
|
7
|
+
}
|
|
8
|
+
export declare const AuthIdentityModel: ReturnModelType<typeof AuthIdentity>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AuthIdentityModel = exports.AuthIdentity = void 0;
|
|
13
|
+
const typegoose_1 = require("@typegoose/typegoose");
|
|
14
|
+
const enum_1 = require("../../../utilities/enum");
|
|
15
|
+
const user_model_1 = require("./user.model");
|
|
16
|
+
let AuthIdentity = class AuthIdentity {
|
|
17
|
+
user;
|
|
18
|
+
type;
|
|
19
|
+
};
|
|
20
|
+
exports.AuthIdentity = AuthIdentity;
|
|
21
|
+
__decorate([
|
|
22
|
+
(0, typegoose_1.prop)({ required: true, ref: () => user_model_1.User }),
|
|
23
|
+
__metadata("design:type", Object)
|
|
24
|
+
], AuthIdentity.prototype, "user", void 0);
|
|
25
|
+
__decorate([
|
|
26
|
+
(0, typegoose_1.prop)({ required: true, type: String, enum: enum_1.AuthIdentityType }),
|
|
27
|
+
__metadata("design:type", String)
|
|
28
|
+
], AuthIdentity.prototype, "type", void 0);
|
|
29
|
+
exports.AuthIdentity = AuthIdentity = __decorate([
|
|
30
|
+
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'authIdentities', discriminatorKey: 'type' } })
|
|
31
|
+
], AuthIdentity);
|
|
32
|
+
exports.AuthIdentityModel = (0, typegoose_1.getModelForClass)(AuthIdentity);
|
|
33
|
+
//# sourceMappingURL=auth-identity.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-identity.model.js","sourceRoot":"/","sources":["libraries/mongo/models/auth-identity.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAkG;AAClG,kDAA2D;AAC3D,6CAAoC;AAG7B,IAAM,YAAY,GAAlB,MAAM,YAAY;IAEjB,IAAI,CAAa;IAGjB,IAAI,CAAoB;CAC/B,CAAA;AANY,oCAAY;AAEjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,iBAAI,EAAE,CAAC;;0CAClB;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAgB,EAAE,CAAC;;0CAChC;uBALnB,YAAY;IADxB,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,EAAE,EAAE,CAAC;GAC/E,YAAY,CAMxB;AAEY,QAAA,iBAAiB,GAAyC,IAAA,4BAAgB,EAAC,YAAY,CAAC,CAAC","sourcesContent":["import { getModelForClass, modelOptions, prop, Ref, ReturnModelType } from '@typegoose/typegoose';\r\nimport { AuthIdentityType } from '../../../utilities/enum';\r\nimport { User } from './user.model';\r\n\r\n@modelOptions({ schemaOptions: { collection: 'authIdentities', discriminatorKey: 'type' } })\r\nexport class AuthIdentity {\r\n\t@prop({ required: true, ref: () => User })\r\n\tpublic user!: Ref<User>;\r\n\r\n\t@prop({ required: true, type: String, enum: AuthIdentityType })\r\n\tpublic type!: AuthIdentityType;\r\n}\r\n\r\nexport const AuthIdentityModel: ReturnModelType<typeof AuthIdentity> = getModelForClass(AuthIdentity);\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/base/base-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAuF;AACvF,6DAAoD;AACpD,kDAAyC;AAEzC,MAAa,UAAW,SAAQ,qBAAM;IAE9B,SAAS,CAAa;IAGtB,KAAK,CAAU;IAGf,gBAAgB,CAAiB;IAGjC,QAAQ,CAAY;IAGpB,UAAU,CAAiB;IAG3B,eAAe,CAAiB;IAGhC,aAAa,CAAiB;IAG9B,cAAc,CAAW;IAGzB,MAAM,CAAU;IAGhB,gBAAgB,CAA0B;CACjD;AA9BD,gCA8BC;AA5BO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,CAAC;;6CAC3B;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCACjB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;oDACE;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,yBAAQ,EAAE,CAAC;8BACvB,yBAAQ;4CAAC;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;8CACJ;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;mDACC;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;iDACD;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;kDACR;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;0CACtC;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,6BAAsB,EAAE,CAAC;;oDACJ","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { CouponExpirationReason, Status, ValueType } from '../../../../utilities/enum';\nimport { Duration } from '../shared/duration.model';\nimport { Coupon } from '../coupon.model';\n\nexport class BaseCoupon extends Coupon {\n\t@prop({ required: true, type: String, enum: ValueType })\n\tpublic valueType!: ValueType;\n\n\t@prop({ required: true, type: Number })\n\tpublic value!: number;\n\n\t@prop({ type: Number, default: null }) // applicable when valueType percentage\n\tpublic maxDiscountLimit?: number | null;\n\n\t@prop({ required: true, type: Duration })\n\tpublic duration!: Duration;\n\n\t@prop({ type: Number, default: null })\n\tpublic spendLimit?: number | null;\n\n\t@prop({ type: Number, default: null })\n\tpublic totalOrderLimit?: number | null;\n\n\t@prop({ type: Number, default: null })\n\tpublic minOrderValue?: number | null;\n\n\t@prop({ type: Boolean, default: false })\n\tpublic forNewUserOnly?: boolean;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n\n\t@prop({ type: String, enum: CouponExpirationReason })\n\tpublic expirationReason?: CouponExpirationReason;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"base-coupon.model.js","sourceRoot":"/","sources":["libraries/mongo/models/base/base-coupon.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAuF;AACvF,6DAAoD;AACpD,kDAAyC;AAEzC,MAAa,UAAW,SAAQ,qBAAM;IAE9B,SAAS,CAAa;IAGtB,KAAK,CAAU;IAGf,gBAAgB,CAAiB;IAGjC,QAAQ,CAAY;IAGpB,UAAU,CAAiB;IAG3B,eAAe,CAAiB;IAGhC,aAAa,CAAiB;IAG9B,cAAc,CAAW;IAGzB,MAAM,CAAU;IAGhB,gBAAgB,CAA0B;CACjD;AA9BD,gCA8BC;AA5BO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,CAAC;;6CAC3B;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;yCACjB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;oDACE;AAGjC;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,yBAAQ,EAAE,CAAC;8BACvB,yBAAQ;4CAAC;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;8CACJ;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;mDACC;AAGhC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;iDACD;AAG9B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;kDACR;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;0CACtC;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,6BAAsB,EAAE,CAAC;;oDACJ","sourcesContent":["import { prop } from '@typegoose/typegoose';\r\nimport { CouponExpirationReason, Status, ValueType } from '../../../../utilities/enum';\r\nimport { Duration } from '../shared/duration.model';\r\nimport { Coupon } from '../coupon.model';\r\n\r\nexport class BaseCoupon extends Coupon {\r\n\t@prop({ required: true, type: String, enum: ValueType })\r\n\tpublic valueType!: ValueType;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic value!: number;\r\n\r\n\t@prop({ type: Number, default: null }) // applicable when valueType percentage\r\n\tpublic maxDiscountLimit?: number | null;\r\n\r\n\t@prop({ required: true, type: Duration })\r\n\tpublic duration!: Duration;\r\n\r\n\t@prop({ type: Number, default: null })\r\n\tpublic spendLimit?: number | null;\r\n\r\n\t@prop({ type: Number, default: null })\r\n\tpublic totalOrderLimit?: number | null;\r\n\r\n\t@prop({ type: Number, default: null })\r\n\tpublic minOrderValue?: number | null;\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic forNewUserOnly?: boolean;\r\n\r\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\r\n\tpublic status?: Status;\r\n\r\n\t@prop({ type: String, enum: CouponExpirationReason })\r\n\tpublic expirationReason?: CouponExpirationReason;\r\n}\r\n"]}
|
|
@@ -41,7 +41,7 @@ __decorate([
|
|
|
41
41
|
__metadata("design:type", String)
|
|
42
42
|
], Cart.prototype, "title", void 0);
|
|
43
43
|
__decorate([
|
|
44
|
-
(0, typegoose_1.prop)(
|
|
44
|
+
(0, typegoose_1.prop)(),
|
|
45
45
|
__metadata("design:type", String)
|
|
46
46
|
], Cart.prototype, "slug", void 0);
|
|
47
47
|
__decorate([
|
|
@@ -96,10 +96,17 @@ exports.Cart = Cart = __decorate([
|
|
|
96
96
|
allowMixed: typegoose_1.Severity.ALLOW,
|
|
97
97
|
},
|
|
98
98
|
}),
|
|
99
|
-
(0, typegoose_1.index)({ slug: 1 }, { unique: true }),
|
|
99
|
+
(0, typegoose_1.index)({ slug: 1 }, { unique: true, sparse: true }),
|
|
100
100
|
(0, typegoose_1.index)({ user: 1 }),
|
|
101
101
|
(0, typegoose_1.index)({ shop: 1 }),
|
|
102
102
|
(0, typegoose_1.index)({ status: 1 }),
|
|
103
|
+
(0, typegoose_1.index)({ user: 1, shop: 1 }, {
|
|
104
|
+
unique: true,
|
|
105
|
+
partialFilterExpression: {
|
|
106
|
+
status: { $in: [enum_1.CartStatus.ACTIVE, enum_1.CartStatus.LOCKED] },
|
|
107
|
+
deletedAt: null,
|
|
108
|
+
},
|
|
109
|
+
}),
|
|
103
110
|
(0, typegoose_1.pre)('save', async function (next) {
|
|
104
111
|
if (this.title && !this.slug) {
|
|
105
112
|
const baseSlug = (0, slugify_1.default)(this.title, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cart.model.js","sourceRoot":"/","sources":["libraries/mongo/models/cart.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAqF;AACrF,6CAAoC;AACpC,4EAAqE;AACrE,
|
|
1
|
+
{"version":3,"file":"cart.model.js","sourceRoot":"/","sources":["libraries/mongo/models/cart.model.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,oDAAqF;AACrF,6CAAoC;AACpC,4EAAqE;AACrE,kDAAwE;AACxE,0DAAqD;AACrD,sDAA8B;AAC9B,mCAA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AI,CAAC,KAAK,EAAE;gBACpC,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,IAAI;gBACZ,IAAI,EAAE,IAAI;aACV,CAAC,CAAC;YAEH,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAChD,IAAI,CAAC,IAAI,GAAG,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC;QACvC,CAAC;QACD,IAAI,EAAE,CAAC;IACR,CAAC,CAAC;GACW,IAAI,CAsChB","sourcesContent":["import { prop, Ref, index, modelOptions, Severity, pre } from '@typegoose/typegoose';\r\nimport { Shop } from './shop.model';\r\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\r\nimport { CartStatus, PaymentPreference } from '../../../utilities/enum';\r\nimport { UserAddress } from './shared/address.model';\r\nimport slugify from 'slugify';\r\nimport { randomBytes } from 'crypto';\r\n\r\nimport { Coupon } from './coupon.model';\r\nimport { User } from './user.model';\r\n\r\n/**\r\n * Cart configuration model using Typegoose with automatic slug generation\r\n */\r\n@modelOptions({\r\n\tschemaOptions: {\r\n\t\tcollection: 'carts',\r\n\t\ttoJSON: { virtuals: true },\r\n\t\ttoObject: { virtuals: true },\r\n\t},\r\n\toptions: {\r\n\t\tallowMixed: Severity.ALLOW,\r\n\t},\r\n})\r\n@index({ slug: 1 }, { unique: true, sparse: true })\r\n@index({ user: 1 })\r\n@index({ shop: 1 })\r\n@index({ status: 1 })\r\n@index(\r\n\t{ user: 1, shop: 1 },\r\n\t{\r\n\t\tunique: true,\r\n\t\tpartialFilterExpression: {\r\n\t\t\tstatus: { $in: [CartStatus.ACTIVE, CartStatus.LOCKED] },\r\n\t\t\tdeletedAt: null,\r\n\t\t},\r\n\t}\r\n)\r\n@pre<Cart>('save', async function (next) {\r\n\tif (this.title && !this.slug) {\r\n\t\tconst baseSlug = slugify(this.title, {\r\n\t\t\tlower: true,\r\n\t\t\tstrict: true,\r\n\t\t\ttrim: true,\r\n\t\t});\r\n\r\n\t\tconst uniqueId = randomBytes(8).toString('hex');\r\n\t\tthis.slug = `${baseSlug}-${uniqueId}`;\r\n\t}\r\n\tnext();\r\n})\r\nexport class Cart extends TimeStamps {\r\n\t@prop({ trim: true, maxlength: 100 })\r\n\tpublic title?: string;\r\n\r\n\t@prop()\r\n\tpublic slug?: string;\r\n\r\n\t@prop({ required: true, ref: () => User })\r\n\tpublic user!: Ref<User>;\r\n\r\n\t@prop({ required: true, ref: () => Shop })\r\n\tpublic shop!: Ref<Shop>;\r\n\r\n\t@prop({ required: false, type: UserAddress })\r\n\tpublic deliveryAddress?: UserAddress;\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tpublic isGroupOrder?: boolean;\r\n\r\n\t@prop({ type: Date })\r\n\tpublic deadlineToOrder?: Date;\r\n\r\n\t@prop({ type: String, enum: PaymentPreference })\r\n\tpublic paymentPreference?: PaymentPreference;\r\n\r\n\t@prop({ type: Number, default: Infinity })\r\n\tpublic spendingLimitForGuest?: number;\r\n\r\n\t@prop({\r\n\t\tenum: CartStatus,\r\n\t\ttype: String,\r\n\t\tdefault: CartStatus.ACTIVE,\r\n\t\trequired: true,\r\n\t})\r\n\tpublic status!: CartStatus;\r\n\r\n\t@prop({ ref: () => Coupon })\r\n\tpublic coupon?: Ref<Coupon>;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attribute-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/attribute-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,aAAa;IAElB,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,SAAS,CAAW;CAC3B;AATD,sCASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACjB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;gDACZ","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class AttributeItem {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: Number })\n\tpublic price!: number;\n\n\t@prop({ type: Boolean, default: true })\n\tpublic isVisible?: boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"attribute-item.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/attribute-item.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,aAAa;IAElB,IAAI,CAAU;IAGd,KAAK,CAAU;IAGf,SAAS,CAAW;CAC3B;AATD,sCASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;2CAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACjB;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;gDACZ","sourcesContent":["import { prop } from '@typegoose/typegoose';\r\n\r\nexport class AttributeItem {\r\n\t@prop({ required: true, type: String })\r\n\tpublic name!: string;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic price!: number;\r\n\r\n\t@prop({ type: Boolean, default: true })\r\n\tpublic isVisible?: boolean;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attribute-map.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/attribute-map.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAiC;AACjC,oDAAiD;AACjD,wDAA+C;AAE/C,MAAa,YAAY;IAEjB,SAAS,CAAkB;IAG3B,WAAW,CAAoB;CACtC;AAND,oCAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,2BAAS,EAAE,CAAC;;+CACb;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,gBAAK,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;iDACd","sourcesContent":["import { Types } from 'mongoose';\nimport { prop, Ref } from '@typegoose/typegoose';\nimport { Attribute } from '../attribute.model';\n\nexport class AttributeMap {\n\t@prop({ required: true, ref: () => Attribute })\n\tpublic attribute!: Ref<Attribute>;\n\n\t@prop({ type: () => [Types.ObjectId], default: [] })\n\tpublic hiddenItems?: Types.ObjectId[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"attribute-map.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/attribute-map.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uCAAiC;AACjC,oDAAiD;AACjD,wDAA+C;AAE/C,MAAa,YAAY;IAEjB,SAAS,CAAkB;IAG3B,WAAW,CAAoB;CACtC;AAND,oCAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,2BAAS,EAAE,CAAC;;+CACb;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,gBAAK,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;iDACd","sourcesContent":["import { Types } from 'mongoose';\r\nimport { prop, Ref } from '@typegoose/typegoose';\r\nimport { Attribute } from '../attribute.model';\r\n\r\nexport class AttributeMap {\r\n\t@prop({ required: true, ref: () => Attribute })\r\n\tpublic attribute!: Ref<Attribute>;\r\n\r\n\t@prop({ type: () => [Types.ObjectId], default: [] })\r\n\tpublic hiddenItems?: Types.ObjectId[];\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"business-development-setting.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/business-development-setting.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,0BAA0B;IAEtC,iBAAiB,CAAU;IAG3B,kBAAkB,CAAU;CAC5B;AAND,gEAMC;AAJA;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;qEACvB;AAG3B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;sEACf","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class BusinessDevelopmentSetting {\n\t@prop({ type: Number, default: Infinity, min: 0 })\n\tmonthlyShopTarget?: number;\n\n\t@prop({ type: Number, default: 0, min: 0 })\n\tmonthlyRewardPrize?: number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"business-development-setting.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/business-development-setting.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,0BAA0B;IAEtC,iBAAiB,CAAU;IAG3B,kBAAkB,CAAU;CAC5B;AAND,gEAMC;AAJA;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;qEACvB;AAG3B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;sEACf","sourcesContent":["import { prop } from '@typegoose/typegoose';\r\n\r\nexport class BusinessDevelopmentSetting {\r\n\t@prop({ type: Number, default: Infinity, min: 0 })\r\n\tmonthlyShopTarget?: number;\r\n\r\n\t@prop({ type: Number, default: 0, min: 0 })\r\n\tmonthlyRewardPrize?: number;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charge-setting.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/charge-setting.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAuD;AAEvD,MAAM,cAAc;IAEZ,IAAI,CAAU;IAGd,EAAE,CAAU;IAGZ,MAAM,CAAU;IAGhB,QAAQ,CAAU;CACzB;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;4CAC1B;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;0CAC5B;AAGZ;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;8CACxB;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;gDACtB;AAG1B,MAAa,aAAa;IAElB,SAAS,CAAa;IAGtB,KAAK,CAAU;IAGf,eAAe,CAAoB;IAGnC,yBAAyB,CAAoB;CACpD;AAZD,sCAYC;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,OAAO,EAAE,gBAAS,CAAC,UAAU,EAAE,CAAC;;gDAC1C;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;4CACT;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;sDACV;AAGnC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;gEACA","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { ValueType } from '../../../../utilities/enum';\n\nclass DeliveryCharge {\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic from!: number;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic to!: number;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic charge!: number;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic riderCut!: number;\n}\n\nexport class ChargeSetting {\n\t@prop({ type: String, enum: ValueType, default: ValueType.PERCENTAGE })\n\tpublic valueType?: ValueType;\n\n\t@prop({ type: Number, min: 0 })\n\tpublic value?: number;\n\n\t@prop({ type: () => [DeliveryCharge], default: [] })\n\tpublic deliveryCharges?: DeliveryCharge[];\n\n\t@prop({ type: () => [DeliveryCharge], default: [] })\n\tpublic deliveryChargesForCourier?: DeliveryCharge[];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"charge-setting.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/charge-setting.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAuD;AAEvD,MAAM,cAAc;IAEZ,IAAI,CAAU;IAGd,EAAE,CAAU;IAGZ,MAAM,CAAU;IAGhB,QAAQ,CAAU;CACzB;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;4CAC1B;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;0CAC5B;AAGZ;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;8CACxB;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;gDACtB;AAG1B,MAAa,aAAa;IAElB,SAAS,CAAa;IAGtB,KAAK,CAAU;IAGf,eAAe,CAAoB;IAGnC,yBAAyB,CAAoB;CACpD;AAZD,sCAYC;AAVO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,OAAO,EAAE,gBAAS,CAAC,UAAU,EAAE,CAAC;;gDAC1C;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;4CACT;AAGf;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;sDACV;AAGnC;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,cAAc,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;;gEACA","sourcesContent":["import { prop } from '@typegoose/typegoose';\r\nimport { ValueType } from '../../../../utilities/enum';\r\n\r\nclass DeliveryCharge {\r\n\t@prop({ required: true, type: Number, min: 0 })\r\n\tpublic from!: number;\r\n\r\n\t@prop({ required: true, type: Number, min: 0 })\r\n\tpublic to!: number;\r\n\r\n\t@prop({ required: true, type: Number, min: 0 })\r\n\tpublic charge!: number;\r\n\r\n\t@prop({ required: true, type: Number, min: 0 })\r\n\tpublic riderCut!: number;\r\n}\r\n\r\nexport class ChargeSetting {\r\n\t@prop({ type: String, enum: ValueType, default: ValueType.PERCENTAGE })\r\n\tpublic valueType?: ValueType;\r\n\r\n\t@prop({ type: Number, min: 0 })\r\n\tpublic value?: number;\r\n\r\n\t@prop({ type: () => [DeliveryCharge], default: [] })\r\n\tpublic deliveryCharges?: DeliveryCharge[];\r\n\r\n\t@prop({ type: () => [DeliveryCharge], default: [] })\r\n\tpublic deliveryChargesForCourier?: DeliveryCharge[];\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"charge.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/charge.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAuD;AAEvD,MAAa,MAAM;IAEX,SAAS,CAAa;IAGtB,KAAK,CAAU;CACtB;AAND,wBAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,OAAO,EAAE,gBAAS,CAAC,UAAU,EAAE,CAAC;;yCAC1C;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;qCACzB","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { ValueType } from '../../../../utilities/enum';\n\nexport class Charge {\n\t@prop({ type: String, enum: ValueType, default: ValueType.PERCENTAGE })\n\tpublic valueType?: ValueType;\n\n\t@prop({ required: true, type: Number, min: 0 })\n\tpublic value?: number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"charge.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/charge.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAuD;AAEvD,MAAa,MAAM;IAEX,SAAS,CAAa;IAGtB,KAAK,CAAU;CACtB;AAND,wBAMC;AAJO;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAE,OAAO,EAAE,gBAAS,CAAC,UAAU,EAAE,CAAC;;yCAC1C;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;qCACzB","sourcesContent":["import { prop } from '@typegoose/typegoose';\r\nimport { ValueType } from '../../../../utilities/enum';\r\n\r\nexport class Charge {\r\n\t@prop({ type: String, enum: ValueType, default: ValueType.PERCENTAGE })\r\n\tpublic valueType?: ValueType;\r\n\r\n\t@prop({ required: true, type: Number, min: 0 })\r\n\tpublic value?: number;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"courier-setting.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/courier-setting.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,cAAc;IAE1B,qBAAqB,CAAU;IAG/B,WAAW,CAAU;CACrB;AAND,wCAMC;AAJA;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;;6DACX;AAG/B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACF","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class CourierSetting {\n\t@prop({ type: Number, default: Infinity })\n\tmaxTotalEstItemsPrice?: number;\n\n\t@prop({ type: Number })\n\tmaxDistance?: number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"courier-setting.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/courier-setting.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,cAAc;IAE1B,qBAAqB,CAAU;IAG/B,WAAW,CAAU;CACrB;AAND,wCAMC;AAJA;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC;;6DACX;AAG/B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;mDACF","sourcesContent":["import { prop } from '@typegoose/typegoose';\r\n\r\nexport class CourierSetting {\r\n\t@prop({ type: Number, default: Infinity })\r\n\tmaxTotalEstItemsPrice?: number;\r\n\r\n\t@prop({ type: Number })\r\n\tmaxDistance?: number;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency-setting.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/currency-setting.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAA4C;AAE5C,MAAa,eAAe;IAE3B,YAAY,CAAY;IAGxB,iBAAiB,CAAY;IAG7B,qBAAqB,CAAW;IAGhC,YAAY,CAAU;CACtB;AAZD,0CAYC;AAVA;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,yBAAQ,EAAE,CAAC;8BAC1B,yBAAQ;qDAAC;AAGxB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,yBAAQ,EAAE,CAAC;8BACL,yBAAQ;0DAAC;AAG7B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;8DACR;AAGhC;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;qDACb","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { Currency } from './currency.model';\n\nexport class CurrencySetting {\n\t@prop({ required: true, type: Currency })\n\tbaseCurrency!: Currency;\n\n\t@prop({ type: Currency })\n\tsecondaryCurrency?: Currency;\n\n\t@prop({ type: Boolean, default: false })\n\tisDualCurrencyEnabled?: boolean;\n\n\t@prop({ type: Number, default: 0 })\n\texchangeRate?: number;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"currency-setting.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/currency-setting.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAA4C;AAE5C,MAAa,eAAe;IAE3B,YAAY,CAAY;IAGxB,iBAAiB,CAAY;IAG7B,qBAAqB,CAAW;IAGhC,YAAY,CAAU;CACtB;AAZD,0CAYC;AAVA;IADC,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,yBAAQ,EAAE,CAAC;8BAC1B,yBAAQ;qDAAC;AAGxB;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,yBAAQ,EAAE,CAAC;8BACL,yBAAQ;0DAAC;AAG7B;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;;8DACR;AAGhC;IADC,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;qDACb","sourcesContent":["import { prop } from '@typegoose/typegoose';\r\nimport { Currency } from './currency.model';\r\n\r\nexport class CurrencySetting {\r\n\t@prop({ required: true, type: Currency })\r\n\tbaseCurrency!: Currency;\r\n\r\n\t@prop({ type: Currency })\r\n\tsecondaryCurrency?: Currency;\r\n\r\n\t@prop({ type: Boolean, default: false })\r\n\tisDualCurrencyEnabled?: boolean;\r\n\r\n\t@prop({ type: Number, default: 0 })\r\n\texchangeRate?: number;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/currency.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,QAAQ;IAEb,MAAM,CAAU;IAGhB,IAAI,CAAU;IAGd,YAAY,CAAU;IAGtB,aAAa,CAAU;IAGvB,QAAQ,CAAU;IAGlB,IAAI,CAAU;IAGd,UAAU,CAAU;IAGpB,IAAI,CAAU;CACrB;AAxBD,4BAwBC;AAtBO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCAChB;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CACV;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CACT;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACd;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACZ;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCAClB","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class Currency {\n\t@prop({ required: true, type: String })\n\tpublic symbol!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic symbolNative!: string;\n\n\t@prop({ required: true, type: Number })\n\tpublic decimalDigits!: number;\n\n\t@prop({ required: true, type: Number })\n\tpublic rounding!: number;\n\n\t@prop({ required: true, type: String })\n\tpublic code!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic namePlural!: string;\n\n\t@prop({ required: true, type: String })\n\tpublic flag!: string;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"currency.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/currency.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,QAAQ;IAEb,MAAM,CAAU;IAGhB,IAAI,CAAU;IAGd,YAAY,CAAU;IAGtB,aAAa,CAAU;IAGvB,QAAQ,CAAU;IAGlB,IAAI,CAAU;IAGd,UAAU,CAAU;IAGpB,IAAI,CAAU;CACrB;AAxBD,4BAwBC;AAtBO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;wCAChB;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;8CACV;AAGtB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;+CACT;AAGvB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;0CACd;AAGlB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CACZ;AAGpB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCAClB","sourcesContent":["import { prop } from '@typegoose/typegoose';\r\n\r\nexport class Currency {\r\n\t@prop({ required: true, type: String })\r\n\tpublic symbol!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic name!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic symbolNative!: string;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic decimalDigits!: number;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic rounding!: number;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic code!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic namePlural!: string;\r\n\r\n\t@prop({ required: true, type: String })\r\n\tpublic flag!: string;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"featured-item.mode.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/featured-item.mode.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAoD;AAEpD,MAAa,YAAY;IAEjB,cAAc,CAAU;IAGxB,MAAM,CAAU;IAGhB,MAAM,CAAU;CACvB;AATD,oCASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDACR;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CAChB;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;4CACtC","sourcesContent":["import { prop } from '@typegoose/typegoose';\nimport { Status } from '../../../../utilities/enum';\n\nexport class FeaturedItem {\n\t@prop({ required: true, type: Number })\n\tpublic durationInDays!: number;\n\n\t@prop({ required: true, type: Number })\n\tpublic amount!: number;\n\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\n\tpublic status?: Status;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"featured-item.mode.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/featured-item.mode.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAoD;AAEpD,MAAa,YAAY;IAEjB,cAAc,CAAU;IAGxB,MAAM,CAAU;IAGhB,MAAM,CAAU;CACvB;AATD,oCASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDACR;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CAChB;AAGhB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAM,EAAE,OAAO,EAAE,aAAM,CAAC,MAAM,EAAE,CAAC;;4CACtC","sourcesContent":["import { prop } from '@typegoose/typegoose';\r\nimport { Status } from '../../../../utilities/enum';\r\n\r\nexport class FeaturedItem {\r\n\t@prop({ required: true, type: Number })\r\n\tpublic durationInDays!: number;\r\n\r\n\t@prop({ required: true, type: Number })\r\n\tpublic amount!: number;\r\n\r\n\t@prop({ type: String, enum: Status, default: Status.ACTIVE })\r\n\tpublic status?: Status;\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"otp-fields.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/otp-fields.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,SAAS;IAEd,GAAG,CAAU;IAGb,iBAAiB,CAAQ;IAGzB,eAAe,CAAQ;CAC9B;AATD,8BASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCACpB;AAGb;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACX,IAAI;oDAAC;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACb,IAAI;kDAAC","sourcesContent":["import { prop } from '@typegoose/typegoose';\n\nexport class OTPFields {\n\t@prop({ required: false, type: String })\n\tpublic otp?: string;\n\n\t@prop({ required: false, type: Date })\n\tpublic otpExpirationDate?: Date;\n\n\t@prop({ required: false, type: Date })\n\tpublic lastSentOtpDate?: Date;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"otp-fields.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/otp-fields.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAE5C,MAAa,SAAS;IAEd,GAAG,CAAU;IAGb,iBAAiB,CAAQ;IAGzB,eAAe,CAAQ;CAC9B;AATD,8BASC;AAPO;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;sCACpB;AAGb;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACX,IAAI;oDAAC;AAGzB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;8BACb,IAAI;kDAAC","sourcesContent":["import { prop } from '@typegoose/typegoose';\r\n\r\nexport class OTPFields {\r\n\t@prop({ required: false, type: String })\r\n\tpublic otp?: string;\r\n\r\n\t@prop({ required: false, type: Date })\r\n\tpublic otpExpirationDate?: Date;\r\n\r\n\t@prop({ required: false, type: Date })\r\n\tpublic lastSentOtpDate?: Date;\r\n}\r\n"]}
|