@lyxa.ai/core 1.3.9 → 1.3.10
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/libraries/event/index.js +0 -1
- package/dist/libraries/event/index.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/frequency-configuration.model.d.ts +1 -1
- package/dist/libraries/mongo/models/embedded/frequency-configuration.model.js +2 -2
- package/dist/libraries/mongo/models/embedded/frequency-configuration.model.js.map +1 -1
- package/dist/libraries/mongo/models/embedded/service-order-settings.model.d.ts +3 -3
- package/dist/libraries/mongo/models/embedded/service-order-settings.model.js +13 -13
- package/dist/libraries/mongo/models/embedded/service-order-settings.model.js.map +1 -1
- package/dist/libraries/mongo/models/service-package.model.d.ts +2 -0
- package/dist/libraries/mongo/models/service-package.model.js +5 -0
- package/dist/libraries/mongo/models/service-package.model.js.map +1 -1
- package/dist/types/README.md +1 -1
- package/dist/types/package.json +1 -1
- package/package.json +1 -1
|
@@ -27,7 +27,6 @@ function getChannel() {
|
|
|
27
27
|
return channel;
|
|
28
28
|
}
|
|
29
29
|
async function publishEvent(event) {
|
|
30
|
-
console.log('taking event', event);
|
|
31
30
|
const ch = getChannel();
|
|
32
31
|
const messageBuffer = Buffer.from(JSON.stringify(event.payload));
|
|
33
32
|
ch.publish(exports.EXCHANGE_NAME, event.eventId, messageBuffer, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/event/index.ts"],"names":[],"mappings":";;;;;;AASA,oCAKC;AAED,gCAGC;AAED,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/event/index.ts"],"names":[],"mappings":";;;;;;AASA,oCAKC;AAED,gCAGC;AAED,oCAQC;AAED,4CAiCC;AAED,sCAIC;AAtED,sDAA2B;AAE3B,mEAA+D;AAE/D,IAAI,UAA6B,CAAC;AAClC,IAAI,OAAqB,CAAC;AACb,QAAA,aAAa,GAAG,aAA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EAAE,CAAC,OAAO,CACf,SAAS,EACT,KAAK,EAAC,GAAG,EAAC,EAAE;QACX,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;YAClB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;YACnD,IAAI,CAAC;gBACJ,MAAM,SAAS,CAAC,OAAO,CAAC,CAAC;gBACzB,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACb,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACd,OAAO,CAAC,KAAK,CAAC,yBAAyB,OAAO,kBAAkB,IAAA,8BAAa,GAAE,GAAG,EAAE,GAAG,CAAC,CAAC;YAC1F,CAAC;QACF,CAAC;IACF,CAAC,EACD,EAAE,KAAK,EAAE,KAAK,EAAE,CAChB,CAAC;IAGF,OAAO,CAAC,GAAG,CAAC,wBAAwB,OAAO,GAAG,CAAC,CAAC;AACjD,CAAC;AAEM,KAAK,UAAU,aAAa;IAClC,IAAI,OAAO;QAAE,MAAM,OAAO,CAAC,KAAK,EAAE,CAAC;IACnC,IAAI,UAAU;QAAE,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;IACzC,OAAO,CAAC,GAAG,CAAC,iCAAiC,IAAA,8BAAa,GAAE,GAAG,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import amqp from 'amqplib';\nimport { BaseEvent } from './BaseEvent';\nimport { getInstanceId } from '../../utilities/instance.utils';\n\nlet connection: amqp.ChannelModel;\nlet channel: amqp.Channel;\nexport const EXCHANGE_NAME = 'lyxa.events';\nexport const INSTANCE_ROUTE_PREFIX = 'instance'; // routing key: instance.{instanceName}.{eventType}\n\nexport async function initEventBus(rabbitUrl: string) {\n\tconnection = await amqp.connect(rabbitUrl);\n\tchannel = await connection.createChannel();\n\tawait channel.assertExchange(EXCHANGE_NAME, 'topic', { durable: true });\n\tconsole.log(`EventBus initialized with instance ID: ${getInstanceId()}`);\n}\n\nexport function getChannel(): amqp.Channel {\n\tif (!channel) throw new Error('Channel not initialized. Call initEventBus first.');\n\treturn channel;\n}\n\nexport async function publishEvent<TPayload extends Record<string, unknown>>(\n\tevent: BaseEvent<TPayload>\n): Promise<void> {\n\tconst ch = getChannel();\n\tconst messageBuffer = Buffer.from(JSON.stringify(event.payload));\n\tch.publish(EXCHANGE_NAME, event.eventId, messageBuffer, {\n\t\tcontentType: 'application/json',\n\t});\n}\n\nexport async function subscribeToEvent(\n\teventId: string,\n\tonMessage: (payload: any) => Promise<void>\n): Promise<void> {\n\tconst ch = getChannel();\n\tconst queueName = `${eventId}`;\n\n\tawait ch.assertQueue(queueName, {\n\t\tdurable: true, // survive broker restart\n\t\texclusive: false, // Allow multiple consumers to attach. Only one connection can use it (each pod has own queue). Set to TRUE if each pod needs it's own queue\n\t\tautoDelete: false, // Queue removed when pod disconnects when set to TRUE\n\t});\n\n\tawait ch.bindQueue(queueName, EXCHANGE_NAME, eventId);\n\n\tawait ch.consume(\n\t\tqueueName,\n\t\tasync msg => {\n\t\t\tif (msg !== null) {\n\t\t\t\tconst payload = JSON.parse(msg.content.toString());\n\t\t\t\ttry {\n\t\t\t\t\tawait onMessage(payload);\n\t\t\t\t\tch.ack(msg);\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.error(`Error handling event [${eventId}] on instance [${getInstanceId()}]`, err);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t{ noAck: false }\n\t);\n\n\t// console.log(`Subscribed to event [${eventId}] on queue [${queueName}]`);\n\tconsole.log(`Subscribed to event [${eventId}]`);\n}\n\nexport async function closeEventBus(): Promise<void> {\n\tif (channel) await channel.close();\n\tif (connection) await connection.close();\n\tconsole.log(`EventBus closed for instance [${getInstanceId()}]`);\n}"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ServiceOrderRecurrencePattern, ValueType } from "../../../../utilities/enum";
|
|
2
2
|
export declare class FrequencyConfig {
|
|
3
|
-
recurrencePattern
|
|
3
|
+
recurrencePattern: ServiceOrderRecurrencePattern;
|
|
4
4
|
enabled: boolean;
|
|
5
5
|
discountType?: ValueType;
|
|
6
6
|
discountValue?: number;
|
|
@@ -24,11 +24,11 @@ __decorate([
|
|
|
24
24
|
__metadata("design:type", String)
|
|
25
25
|
], FrequencyConfig.prototype, "recurrencePattern", void 0);
|
|
26
26
|
__decorate([
|
|
27
|
-
(0, typegoose_1.prop)({ required: true
|
|
27
|
+
(0, typegoose_1.prop)({ required: true }),
|
|
28
28
|
__metadata("design:type", Boolean)
|
|
29
29
|
], FrequencyConfig.prototype, "enabled", void 0);
|
|
30
30
|
__decorate([
|
|
31
|
-
(0, typegoose_1.prop)({ type: String, enum: enum_1.ValueType
|
|
31
|
+
(0, typegoose_1.prop)({ type: String, enum: enum_1.ValueType }),
|
|
32
32
|
__metadata("design:type", String)
|
|
33
33
|
], FrequencyConfig.prototype, "discountType", void 0);
|
|
34
34
|
__decorate([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frequency-configuration.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/frequency-configuration.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAsF;AAEtF,MAAa,eAAe;IAEjB,iBAAiB,CAAgC;IAGjD,OAAO,CAAU;IAGjB,YAAY,CAAY;IAGxB,aAAa,CAAS;CAChC;AAZD,0CAYC;AAVU;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,oCAA6B,EAAE,CAAC;;0DACN;AAGjD;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"frequency-configuration.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/frequency-configuration.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA4C;AAC5C,qDAAsF;AAEtF,MAAa,eAAe;IAEjB,iBAAiB,CAAgC;IAGjD,OAAO,CAAU;IAGjB,YAAY,CAAY;IAGxB,aAAa,CAAS;CAChC;AAZD,0CAYC;AAVU;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,oCAA6B,EAAE,CAAC;;0DACN;AAGjD;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACD;AAGjB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAS,EAAC,CAAC;;qDACR;AAGxB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;;sDACF","sourcesContent":["import { prop } from \"@typegoose/typegoose\";\nimport { ServiceOrderRecurrencePattern, ValueType } from \"../../../../utilities/enum\";\n\nexport class FrequencyConfig {\n @prop({ required: true, enum: ServiceOrderRecurrencePattern })\n public recurrencePattern!: ServiceOrderRecurrencePattern\n\n @prop({ required: true })\n public enabled!: boolean\n\n @prop({ type: String, enum: ValueType})\n public discountType?: ValueType\n\n @prop({ type: Number, min: 0 })\n public discountValue?: number\n} "]}
|
|
@@ -2,8 +2,8 @@ import { FrequencyConfig } from './frequency-configuration.model';
|
|
|
2
2
|
export declare class ServiceOrderSettings {
|
|
3
3
|
frequencyConfigs?: FrequencyConfig[];
|
|
4
4
|
slotInterval: number;
|
|
5
|
-
servicePreparationTime?: number;
|
|
6
|
-
maxAdvanceOrderDay?: number;
|
|
7
|
-
autoUrgencyTimeLimit?: number;
|
|
8
5
|
bufferTime: number;
|
|
6
|
+
servicePreparationTime: number;
|
|
7
|
+
maxAdvanceOrderDay: number;
|
|
8
|
+
autoUrgencyTimeLimit: number;
|
|
9
9
|
}
|
|
@@ -15,10 +15,10 @@ const frequency_configuration_model_1 = require("./frequency-configuration.model
|
|
|
15
15
|
let ServiceOrderSettings = class ServiceOrderSettings {
|
|
16
16
|
frequencyConfigs;
|
|
17
17
|
slotInterval;
|
|
18
|
+
bufferTime;
|
|
18
19
|
servicePreparationTime;
|
|
19
20
|
maxAdvanceOrderDay;
|
|
20
21
|
autoUrgencyTimeLimit;
|
|
21
|
-
bufferTime;
|
|
22
22
|
};
|
|
23
23
|
exports.ServiceOrderSettings = ServiceOrderSettings;
|
|
24
24
|
__decorate([
|
|
@@ -33,12 +33,20 @@ __decorate([
|
|
|
33
33
|
}),
|
|
34
34
|
__metadata("design:type", Number)
|
|
35
35
|
], ServiceOrderSettings.prototype, "slotInterval", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
(0, typegoose_1.prop)({
|
|
38
|
+
min: 0,
|
|
39
|
+
max: 60,
|
|
40
|
+
default: 0,
|
|
41
|
+
}),
|
|
42
|
+
__metadata("design:type", Number)
|
|
43
|
+
], ServiceOrderSettings.prototype, "bufferTime", void 0);
|
|
36
44
|
__decorate([
|
|
37
45
|
(0, typegoose_1.prop)({
|
|
38
46
|
type: Number,
|
|
39
47
|
min: 0,
|
|
40
|
-
max:
|
|
41
|
-
default:
|
|
48
|
+
max: 12000,
|
|
49
|
+
default: 180,
|
|
42
50
|
}),
|
|
43
51
|
__metadata("design:type", Number)
|
|
44
52
|
], ServiceOrderSettings.prototype, "servicePreparationTime", void 0);
|
|
@@ -49,20 +57,12 @@ __decorate([
|
|
|
49
57
|
__decorate([
|
|
50
58
|
(0, typegoose_1.prop)({
|
|
51
59
|
type: Number,
|
|
52
|
-
default:
|
|
60
|
+
default: 360,
|
|
53
61
|
min: 0,
|
|
54
|
-
max:
|
|
62
|
+
max: 4320,
|
|
55
63
|
}),
|
|
56
64
|
__metadata("design:type", Number)
|
|
57
65
|
], ServiceOrderSettings.prototype, "autoUrgencyTimeLimit", void 0);
|
|
58
|
-
__decorate([
|
|
59
|
-
(0, typegoose_1.prop)({
|
|
60
|
-
min: 5,
|
|
61
|
-
max: 60,
|
|
62
|
-
default: 5,
|
|
63
|
-
}),
|
|
64
|
-
__metadata("design:type", Number)
|
|
65
|
-
], ServiceOrderSettings.prototype, "bufferTime", void 0);
|
|
66
66
|
exports.ServiceOrderSettings = ServiceOrderSettings = __decorate([
|
|
67
67
|
(0, typegoose_1.modelOptions)({ schemaOptions: { collection: 'serviceOrderSettings' } })
|
|
68
68
|
], ServiceOrderSettings);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-order-settings.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/service-order-settings.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA0D;AAC1D,mFAAkE;AAG3D,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAEzB,gBAAgB,CAAqB;IAOrC,YAAY,CAAS;
|
|
1
|
+
{"version":3,"file":"service-order-settings.model.js","sourceRoot":"/","sources":["libraries/mongo/models/embedded/service-order-settings.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA0D;AAC1D,mFAAkE;AAG3D,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAEzB,gBAAgB,CAAqB;IAOrC,YAAY,CAAS;IAOrB,UAAU,CAAS;IAQnB,sBAAsB,CAAS;IAG/B,kBAAkB,CAAS;IAQ3B,oBAAoB,CAAS;CAIpC,CAAA;AAvCY,oDAAoB;AAEzB;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,+CAAe,CAAC,EAAE,CAAC;;8DACI;AAOrC;IALN,IAAA,gBAAI,EAAC;QACL,GAAG,EAAE,EAAE;QACP,GAAG,EAAE,GAAG;QACR,OAAO,EAAE,EAAE;KACX,CAAC;;0DAC0B;AAOrB;IALN,IAAA,gBAAI,EAAC;QACL,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,EAAE;QACP,OAAO,EAAE,CAAC;KACV,CAAC;;wDACwB;AAQnB;IANN,IAAA,gBAAI,EAAC;QACL,IAAI,EAAE,MAAM;QACZ,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,KAAK;QACV,OAAO,EAAE,GAAG;KACZ,CAAC;;oEACoC;AAG/B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;;gEAClB;AAQ3B;IANN,IAAA,gBAAI,EAAC;QACL,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,GAAG;QACZ,GAAG,EAAE,CAAC;QACN,GAAG,EAAE,IAAI;KACT,CAAC;;kEACkC;+BAnCxB,oBAAoB;IADhC,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,sBAAsB,EAAE,EAAE,CAAC;GAC3D,oBAAoB,CAuChC","sourcesContent":["import { modelOptions, prop } from '@typegoose/typegoose';\nimport { FrequencyConfig } from './frequency-configuration.model';\n\n@modelOptions({ schemaOptions: { collection: 'serviceOrderSettings' } })\nexport class ServiceOrderSettings {\n\t@prop({ type: () => [FrequencyConfig] })\n\tpublic frequencyConfigs?: FrequencyConfig[];\n\n\t@prop({\n\t\tmin: 30,\n\t\tmax: 120,\n\t\tdefault: 30,\n\t})\n\tpublic slotInterval: number; // minutes\n\n\t@prop({\n\t\tmin: 0,\n\t\tmax: 60,\n\t\tdefault: 0,\n\t})\n\tpublic bufferTime: number; // minutes\n\n\t@prop({\n\t\ttype: Number,\n\t\tmin: 0,\n\t\tmax: 12000,\n\t\tdefault: 180,\n\t})\n\tpublic servicePreparationTime: number; // minutes\n\n\t@prop({ type: Number, min: 1, max: 60, default: 1 })\n\tpublic maxAdvanceOrderDay: number;\n\n\t@prop({\n\t\ttype: Number,\n\t\tdefault: 360,\n\t\tmin: 0,\n\t\tmax: 4320,\n\t})\n\tpublic autoUrgencyTimeLimit: number; // minutes\n\n\n\n}\n"]}
|
|
@@ -4,6 +4,7 @@ import { Status } from '../../../utilities/enum';
|
|
|
4
4
|
import { Vendor } from './vendor.model';
|
|
5
5
|
import { ServiceCategory } from './service-category.model';
|
|
6
6
|
import { Service } from "./service.model";
|
|
7
|
+
import { AddOn } from './index';
|
|
7
8
|
export declare class ServicePackage extends TimeStamps {
|
|
8
9
|
name: string;
|
|
9
10
|
vendor: Ref<Vendor>;
|
|
@@ -16,6 +17,7 @@ export declare class ServicePackage extends TimeStamps {
|
|
|
16
17
|
description?: string;
|
|
17
18
|
image: string;
|
|
18
19
|
vendorNotes?: string;
|
|
20
|
+
addons?: Ref<AddOn>[];
|
|
19
21
|
status: Status;
|
|
20
22
|
includeMaterials: boolean;
|
|
21
23
|
materialsCost?: number;
|
|
@@ -29,6 +29,7 @@ let ServicePackage = class ServicePackage extends defaultClasses_1.TimeStamps {
|
|
|
29
29
|
description;
|
|
30
30
|
image;
|
|
31
31
|
vendorNotes;
|
|
32
|
+
addons;
|
|
32
33
|
status;
|
|
33
34
|
includeMaterials;
|
|
34
35
|
materialsCost;
|
|
@@ -88,6 +89,10 @@ __decorate([
|
|
|
88
89
|
(0, typegoose_1.prop)({ type: String, maxlength: 250 }),
|
|
89
90
|
__metadata("design:type", String)
|
|
90
91
|
], ServicePackage.prototype, "vendorNotes", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, typegoose_1.prop)({ ref: () => index_1.AddOn, default: [], type: [String] }),
|
|
94
|
+
__metadata("design:type", Array)
|
|
95
|
+
], ServicePackage.prototype, "addons", void 0);
|
|
91
96
|
__decorate([
|
|
92
97
|
(0, typegoose_1.prop)({ type: String, enum: enum_1.Status, default: enum_1.Status.ACTIVE }),
|
|
93
98
|
__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-package.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-package.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAA2E;AAC3E,4EAAqE;AACrE,kDAAiD;AACjD,iDAAwC;AACxC,qEAA2D;AAC3D,mDAA0C;AAC1C,mCAAqD;AA8B9C,IAAM,cAAc,GAApB,MAAM,cAAe,S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oose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { Status } from '../../../utilities/enum';\nimport { Vendor } from './vendor.model';\nimport { ServiceCategory } from './service-category.model';\nimport { Service } from \"./service.model\";\nimport { AddOn, ServicePackageModel } from './index';\n\n\n@modelOptions({ schemaOptions: { collection: 'servicePackages', timestamps: true } })\n@Index(\n { name: 1, vendor: 1 },\n { unique: true, partialFilterExpression: { deletedAt: null } }\n)\n@pre<ServicePackage>('save', async function (next) {\n // Only set sortingOrder if it's a new document or sortingOrder is not set\n if (this.isNew || typeof this.sortingOrder === 'undefined') {\n try {\n // Find the maximum sortingOrder for shops with the same itemType that aren't deleted\n const maxSortingOrder = await ServicePackageModel.aggregate<{ maxSortingOrder: number }>([\n {\n $group: {\n _id: null,\n maxSortingOrder: { $max: '$sortingOrder' },\n },\n },\n ]).exec();\n\n // Set the new sortingOrder to max + 1 (or 0 if no items found)\n this.sortingOrder = (maxSortingOrder[0]?.maxSortingOrder ?? -1) + 1;\n } catch (error) {\n return next(error as Error);\n }\n }\n next();\n})\nexport class ServicePackage extends TimeStamps {\n @prop({ required: true, type: String, trim: true, maxlength: 20 })\n public name!: string;\n\n @prop({ required: true, ref: () => Vendor })\n public vendor!: Ref<Vendor>;\n\n @prop({ required: true, ref: () => Service })\n public service: Ref<Service>\n\n @prop({ required: true, ref: () => ServiceCategory })\n public category!: Ref<ServiceCategory>;\n\n @prop({ required: true, type: Number, min: 0 })\n public price!: number;\n\n @prop({\n required: true,\n type: Number,\n min: 0,\n })\n public hours!: number;\n\n @prop({\n required: true,\n type: Number,\n min: 0,\n max: 59,\n })\n public minutes!: number;\n\n @prop({ required: true, type: Number, min: 1 })\n public numberOfProfessionals?: number; // no need for furniture cleaning\n\n @prop({ type: String, trim: true })\n public description?: string;\n\n @prop({ type: String })\n public image!: string;\n\n @prop({ type: String, maxlength: 250 })\n public vendorNotes?: string;\n\n @prop({ ref: () => AddOn, default: [], type: [String] })\n public addons?: Ref<AddOn>[];\n\n @prop({ type: String, enum: Status, default: Status.ACTIVE })\n public status: Status;\n\n @prop({ type: Boolean, default: false })\n public includeMaterials!: boolean;\n\n @prop({ type: Number, default: 0, min: 0 })\n public materialsCost?: number;\n\n @prop({ type: Number })\n public sortingOrder?: number;\n}\n\n"]}
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED