@lyxa.ai/core 1.3.103 → 1.3.104

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.
@@ -45,8 +45,8 @@ exports.ServiceControl = ServiceControl = __decorate([
45
45
  if (this.sortingOrder !== undefined)
46
46
  return;
47
47
  const lastItem = await index_1.ServiceControlModel.findOne({
48
- serviceItemType: this.serviceItemType,
49
48
  deletedAt: null,
49
+ sortingOrder: { $exists: true },
50
50
  })
51
51
  .sort({ sortingOrder: -1 })
52
52
  .select('sortingOrder')
@@ -1 +1 @@
1
- {"version":3,"file":"service-control.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-control.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAmD;AACnD,oDAAsE;AACtE,4EAAqE;AACrE,mCAA8C;AAgDvC,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,2BAAU;IAEtC,IAAI,CAAU;IAGd,eAAe,CAAY;IAG3B,kBAAkB,CAAW;IAG7B,YAAY,CAAU;CAC7B,CAAA;AAZY,wCAAc;AAEnB;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;4CAClB;AAGd;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,eAAQ,EAAE,CAAC;;uDACP;AAG3B;IADN,IAAA,gBAAI,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;;0DACJ;AAG7B;IADN,IAAA,gBAAI,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDACM;yBAXjB,cAAc;IA7C1B,IAAA,iBAAK,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAAC;IAClF,IAAA,iBAAK,EACL,EAAE,eAAe,EAAE,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,EACvC,EAAE,MAAM,EAAE,IAAI,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,CAC9D;IACA,IAAA,wBAAY,EAAC,EAAE,aAAa,EAAE,EAAE,UAAU,EAAE,iBAAiB,EAAE,EAAE,CAAC;IAKlE,IAAA,eAAG,EAAiB,MAAM,EAAE,KAAK;QACjC,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS;YAAE,OAAO;QAE5C,MAAM,QAAQ,GAAG,MAAM,2BAAmB,CAAC,OAAO,CAAC;YAClD,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,SAAS,EAAE,IAAI;SACf,CAAC;aACA,IAAI,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC;aAC1B,MAAM,CAAC,cAAc,CAAC;aACtB,IAAI,EAAE,CAAC;QAET,IAAI,CAAC,YAAY,GAAG,CAAC,QAAQ,EAAE,YAAY,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACvD,CAAC,CAAC;IAMD,IAAA,eAAG,EAAiB,kBAAkB,EAAE;QACxC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAS,CAAC;QAEvC,IAAI,CAAC,MAAM;YAAE,OAAO;QAGpB,IAAI,CAAC,MAAM,CAAC,IAAI;YAAE,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC;QAGnC,IAAI,cAAc,IAAI,MAAM,EAAE,CAAC;YAC9B,MAAM,CAAC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;YAC/C,OAAO,MAAM,CAAC,YAAY,CAAC;QAC5B,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC,CAAC;GAEW,cAAc,CAY1B","sourcesContent":["import { ItemType } from '../../../utilities/enum';\nimport { Index, modelOptions, pre, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceControlModel } from './index';\nimport { Query } from 'mongoose';\n\n@Index({ name: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@Index(\n\t{ serviceItemType: 1, sortingOrder: 1 },\n\t{ unique: true, partialFilterExpression: { deletedAt: null } }\n)\n@modelOptions({ schemaOptions: { collection: 'service-control' } })\n/**\n * PRE SAVE\n * Auto assign sortingOrder if missing\n */\n@pre<ServiceControl>('save', async function () {\n\tif (this.sortingOrder !== undefined) return;\n\n\tconst lastItem = await ServiceControlModel.findOne({\n\t\tserviceItemType: this.serviceItemType,\n\t\tdeletedAt: null,\n\t})\n\t\t.sort({ sortingOrder: -1 })\n\t\t.select('sortingOrder')\n\t\t.lean();\n\n\tthis.sortingOrder = (lastItem?.sortingOrder ?? 0) + 1;\n})\n\n/**\n * PRE FINDONEANDUPDATE\n * Prevent clearing sortingOrder accidentally\n */\n@pre<ServiceControl>('findOneAndUpdate', function (this: Query<any, ServiceControl>) {\n\tconst update = this.getUpdate() as any;\n\n\tif (!update) return;\n\n\t// normalize $set\n\tif (!update.$set) update.$set = {};\n\n\t// if sortingOrder is explicitly set → allow it\n\tif ('sortingOrder' in update) {\n\t\tupdate.$set.sortingOrder = update.sortingOrder;\n\t\tdelete update.sortingOrder;\n\t}\n\n\tthis.setUpdate(update);\n})\n\nexport class ServiceControl extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, enum: ItemType })\n\tpublic serviceItemType!: ItemType;\n\n\t@prop({ required: true, type: Boolean })\n\tpublic isVisibleToUserApp!: boolean;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}"]}
1
+ {"version":3,"file":"service-control.model.js","sourceRoot":"/","sources":["libraries/mongo/models/service-control.model.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,kDAAmD;AACnD,oDAAsE;AACtE,4EAAqE;AACrE,mCAA8C;AAgDvC,IAAM,cAAc,GAApB,M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AC1B,MAAM,CAAC,cAAc,CAAC;aACtB,IAAI,EAAE,CAAC;QAET,IAAI,CAAC,YAAY,GAAG,CAAC,QAAQ,EAAE,YAAY,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;IACvD,CAAC,CAAC;IAMD,IAAA,eAAG,EAAiB,kBAAkB,EAAE;QACxC,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,EAAS,CAAC;QAEvC,IAAI,CAAC,MAAM;YAAE,OAAO;QAGpB,IAAI,CAAC,MAAM,CAAC,IAAI;YAAE,MAAM,CAAC,IAAI,GAAG,EAAE,CAAC;QAGnC,IAAI,cAAc,IAAI,MAAM,EAAE,CAAC;YAC9B,MAAM,CAAC,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;YAC/C,OAAO,MAAM,CAAC,YAAY,CAAC;QAC5B,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC,CAAC;GAEW,cAAc,CAY1B","sourcesContent":["import { ItemType } from '../../../utilities/enum';\nimport { Index, modelOptions, pre, prop } from '@typegoose/typegoose';\nimport { TimeStamps } from '@typegoose/typegoose/lib/defaultClasses';\nimport { ServiceControlModel } from './index';\nimport { Query } from 'mongoose';\n\n@Index({ name: 1 }, { unique: true, partialFilterExpression: { deletedAt: null } })\n@Index(\n\t{ serviceItemType: 1, sortingOrder: 1 },\n\t{ unique: true, partialFilterExpression: { deletedAt: null } }\n)\n@modelOptions({ schemaOptions: { collection: 'service-control' } })\n/**\n * PRE SAVE\n * Auto assign sortingOrder if missing\n */\n@pre<ServiceControl>('save', async function () {\n\tif (this.sortingOrder !== undefined) return;\n\n\tconst lastItem = await ServiceControlModel.findOne({\n\t\tdeletedAt: null,\n\t\tsortingOrder: { $exists: true },\n\t})\n\t\t.sort({ sortingOrder: -1 })\n\t\t.select('sortingOrder')\n\t\t.lean();\n\n\tthis.sortingOrder = (lastItem?.sortingOrder ?? 0) + 1;\n})\n\n/**\n * PRE FINDONEANDUPDATE\n * Prevent clearing sortingOrder accidentally\n */\n@pre<ServiceControl>('findOneAndUpdate', function (this: Query<any, ServiceControl>) {\n\tconst update = this.getUpdate() as any;\n\n\tif (!update) return;\n\n\t// normalize $set\n\tif (!update.$set) update.$set = {};\n\n\t// if sortingOrder is explicitly set → allow it\n\tif ('sortingOrder' in update) {\n\t\tupdate.$set.sortingOrder = update.sortingOrder;\n\t\tdelete update.sortingOrder;\n\t}\n\n\tthis.setUpdate(update);\n})\n\nexport class ServiceControl extends TimeStamps {\n\t@prop({ required: true, type: String })\n\tpublic name!: string;\n\n\t@prop({ required: true, enum: ItemType })\n\tpublic serviceItemType!: ItemType;\n\n\t@prop({ required: true, type: Boolean })\n\tpublic isVisibleToUserApp!: boolean;\n\n\t@prop({ type: Number })\n\tpublic sortingOrder?: number;\n}"]}
@@ -22,7 +22,7 @@ Perfect for sharing types between frontend and backend applications.
22
22
 
23
23
  ## Version
24
24
 
25
- Version: 1.3.103
25
+ Version: 1.3.104
26
26
 
27
27
  ## Dependencies
28
28
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/types",
3
- "version": "1.3.103",
3
+ "version": "1.3.104",
4
4
  "description": "Lyxa type definitions and validation schemas for both frontend and backend",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lyxa.ai/core",
3
- "version": "1.3.103",
3
+ "version": "1.3.104",
4
4
  "description": "The Core system of the Lyxa services.",
5
5
  "author": "elie <42282499+Internalizable@users.noreply.github.com>",
6
6
  "license": "MIT",