@memberjunction/core-entities 1.3.3 → 1.4.0

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.
@@ -0,0 +1,6 @@
1
+ import { EntitySaveOptions } from "@memberjunction/core";
2
+ import { EntityBehaviorEntity } from "../generated/entity_subclasses";
3
+ export declare class EntityBehaviorEntityExtended extends EntityBehaviorEntity {
4
+ Save(options?: EntitySaveOptions): Promise<boolean>;
5
+ }
6
+ //# sourceMappingURL=EntityBehaviorExtended.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntityBehaviorExtended.d.ts","sourceRoot":"","sources":["../../src/custom/EntityBehaviorExtended.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAsB,MAAM,sBAAsB,CAAC;AAEzF,OAAO,EAAmB,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEvF,qBACa,4BAA6B,SAAQ,oBAAoB;IAC5C,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;CAe5E"}
@@ -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
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.EntityBehaviorEntityExtended = void 0;
10
+ const core_1 = require("@memberjunction/core");
11
+ const global_1 = require("@memberjunction/global");
12
+ const entity_subclasses_1 = require("../generated/entity_subclasses");
13
+ let EntityBehaviorEntityExtended = class EntityBehaviorEntityExtended extends entity_subclasses_1.EntityBehaviorEntity {
14
+ async Save(options) {
15
+ // in this case we simply want to check to see if any of these conditions are true, and if so, we set the RegenerateCode flag
16
+ // (a) NewRecord
17
+ // (b) Description is dirty
18
+ // (c) Description is not empty but Code is empty and CodeGenerated === 1
19
+ if (this.CodeGenerated) {
20
+ if (this.NewRecord ||
21
+ this.Fields.find(f => f.Name === "Description").Dirty || (this.Description && this.Description.trim().length > 0 && (!this.Code || this.Code.trim().length === 0))) {
22
+ // set the flag
23
+ this.RegenerateCode = true;
24
+ }
25
+ }
26
+ return super.Save(options);
27
+ }
28
+ };
29
+ exports.EntityBehaviorEntityExtended = EntityBehaviorEntityExtended;
30
+ exports.EntityBehaviorEntityExtended = EntityBehaviorEntityExtended = __decorate([
31
+ (0, global_1.RegisterClass)(core_1.BaseEntity, 'Entity Behaviors', 2) // 2 priority so this gets used ahead of the generated sub-class
32
+ ], EntityBehaviorEntityExtended);
33
+ //# sourceMappingURL=EntityBehaviorExtended.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EntityBehaviorExtended.js","sourceRoot":"","sources":["../../src/custom/EntityBehaviorExtended.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAAyF;AACzF,mDAAuD;AACvD,sEAAuF;AAGhF,IAAM,4BAA4B,GAAlC,MAAM,4BAA6B,SAAQ,wCAAoB;IAClD,KAAK,CAAC,IAAI,CAAC,OAA2B;QAClD,6HAA6H;QAC7H,gBAAgB;QAChB,2BAA2B;QAC3B,yEAAyE;QAEzE,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,IAAI,IAAI,CAAC,SAAS;gBACd,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;gBACrK,eAAe;gBACf,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;YAC/B,CAAC;QACL,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,CAAC;CACJ,CAAA;AAhBY,oEAA4B;uCAA5B,4BAA4B;IADxC,IAAA,sBAAa,EAAC,iBAAU,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,gEAAgE;GACrG,4BAA4B,CAgBxC"}
@@ -2844,7 +2844,7 @@ export declare class ApplicationEntity extends BaseEntity {
2844
2844
  set Name(value: string);
2845
2845
  /**
2846
2846
  * * Field Name: Description
2847
- * * SQL Data Type: nvarchar(500)
2847
+ * * SQL Data Type: nvarchar(MAX)
2848
2848
  */
2849
2849
  get Description(): string | null;
2850
2850
  set Description(value: string | null);
@@ -10237,4 +10237,244 @@ export declare class DuplicateRunDetailEntity extends BaseEntity {
10237
10237
  */
10238
10238
  get UpdatedAt(): Date;
10239
10239
  }
10240
+ /**
10241
+ * Entity Behaviors - strongly typed entity sub-class
10242
+ * * Schema: __mj
10243
+ * * Base Table: EntityBehavior
10244
+ * * Base View: vwEntityBehaviors
10245
+ * * @description Stores the behaviors for each entity and is used for code generation and injection of behavior code into various areas of the system.
10246
+ * * Primary Key: ID
10247
+ * @extends {BaseEntity}
10248
+ * @class
10249
+ * @public
10250
+ */
10251
+ export declare class EntityBehaviorEntity extends BaseEntity {
10252
+ /**
10253
+ * Loads the Entity Behaviors record from the database
10254
+ * @param ID: number - primary key value to load the Entity Behaviors record.
10255
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
10256
+ * @returns {Promise<boolean>} - true if successful, false otherwise
10257
+ * @public
10258
+ * @async
10259
+ * @memberof EntityBehaviorEntity
10260
+ * @method
10261
+ * @override
10262
+ */
10263
+ Load(ID: number, EntityRelationshipsToLoad?: string[]): Promise<boolean>;
10264
+ /**
10265
+ * * Field Name: ID
10266
+ * * Display Name: ID
10267
+ * * SQL Data Type: int
10268
+ */
10269
+ get ID(): number;
10270
+ /**
10271
+ * * Field Name: EntityID
10272
+ * * Display Name: Entity ID
10273
+ * * SQL Data Type: int
10274
+ * * Related Entity/Foreign Key: Entities (vwEntities.ID)
10275
+ */
10276
+ get EntityID(): number;
10277
+ set EntityID(value: number);
10278
+ /**
10279
+ * * Field Name: BehaviorTypeID
10280
+ * * Display Name: Behavior Type ID
10281
+ * * SQL Data Type: int
10282
+ * * Related Entity/Foreign Key: Entity Behavior Types (vwEntityBehaviorTypes.ID)
10283
+ */
10284
+ get BehaviorTypeID(): number;
10285
+ set BehaviorTypeID(value: number);
10286
+ /**
10287
+ * * Field Name: Description
10288
+ * * Display Name: Description
10289
+ * * SQL Data Type: nvarchar(MAX)
10290
+ * * Description: This field will be used by the AI system to generate code that corresponds to the requested behavior and inject the code into the appropriate part(s) of the system.
10291
+ */
10292
+ get Description(): string;
10293
+ set Description(value: string);
10294
+ /**
10295
+ * * Field Name: RegenerateCode
10296
+ * * Display Name: Regenerate Code
10297
+ * * SQL Data Type: bit
10298
+ * * Default Value: 0
10299
+ * * Description: This bit field is automatically turned on whenever the Description field is changed so that a future server process will pick it up and regenerate the code. This might happen asynchronously or synchronously depending on system setup.
10300
+ */
10301
+ get RegenerateCode(): boolean;
10302
+ set RegenerateCode(value: boolean);
10303
+ /**
10304
+ * * Field Name: Code
10305
+ * * Display Name: Code
10306
+ * * SQL Data Type: nvarchar(MAX)
10307
+ * * Description: This is the code that implements the desired behavior. If the CodeGenerated bit is set to 1, each time CodeGen runs, it will use the Code specified here in the appropriate place(s). To override the generated code and prevent it from being changed in the future, set CodeGenerated = 0
10308
+ */
10309
+ get Code(): string | null;
10310
+ set Code(value: string | null);
10311
+ /**
10312
+ * * Field Name: CodeExplanation
10313
+ * * Display Name: Code Explanation
10314
+ * * SQL Data Type: nvarchar(MAX)
10315
+ * * Description: When an AI model generates code this will be populated with the AI's explanation of how the code works to meet the requirements of the behavior. For a non-generated piece of code a developer could manually place an explanation in this field.
10316
+ */
10317
+ get CodeExplanation(): string | null;
10318
+ set CodeExplanation(value: string | null);
10319
+ /**
10320
+ * * Field Name: CodeGenerated
10321
+ * * Display Name: Code Generated
10322
+ * * SQL Data Type: bit
10323
+ * * Default Value: 1
10324
+ */
10325
+ get CodeGenerated(): boolean;
10326
+ set CodeGenerated(value: boolean);
10327
+ /**
10328
+ * * Field Name: CreatedAt
10329
+ * * Display Name: Created At
10330
+ * * SQL Data Type: datetime
10331
+ * * Default Value: getdate()
10332
+ */
10333
+ get CreatedAt(): Date;
10334
+ /**
10335
+ * * Field Name: UpdatedAt
10336
+ * * Display Name: Updated At
10337
+ * * SQL Data Type: datetime
10338
+ * * Default Value: getdate()
10339
+ */
10340
+ get UpdatedAt(): Date;
10341
+ /**
10342
+ * * Field Name: Entity
10343
+ * * Display Name: Entity
10344
+ * * SQL Data Type: nvarchar(255)
10345
+ */
10346
+ get Entity(): string;
10347
+ }
10348
+ /**
10349
+ * Entity Behavior Types - strongly typed entity sub-class
10350
+ * * Schema: __mj
10351
+ * * Base Table: EntityBehaviorType
10352
+ * * Base View: vwEntityBehaviorTypes
10353
+ * * @description This table stores the list of possible behavior types to use in the Entity Behavior Types entity.
10354
+ * * Primary Key: ID
10355
+ * @extends {BaseEntity}
10356
+ * @class
10357
+ * @public
10358
+ */
10359
+ export declare class EntityBehaviorTypeEntity extends BaseEntity {
10360
+ /**
10361
+ * Loads the Entity Behavior Types record from the database
10362
+ * @param ID: number - primary key value to load the Entity Behavior Types record.
10363
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
10364
+ * @returns {Promise<boolean>} - true if successful, false otherwise
10365
+ * @public
10366
+ * @async
10367
+ * @memberof EntityBehaviorTypeEntity
10368
+ * @method
10369
+ * @override
10370
+ */
10371
+ Load(ID: number, EntityRelationshipsToLoad?: string[]): Promise<boolean>;
10372
+ /**
10373
+ * * Field Name: ID
10374
+ * * Display Name: ID
10375
+ * * SQL Data Type: int
10376
+ */
10377
+ get ID(): number;
10378
+ /**
10379
+ * * Field Name: Name
10380
+ * * Display Name: Name
10381
+ * * SQL Data Type: nvarchar(100)
10382
+ * * Description: The name of the behavior, a unique column for the table.
10383
+ */
10384
+ get Name(): string;
10385
+ set Name(value: string);
10386
+ /**
10387
+ * * Field Name: Description
10388
+ * * Display Name: Description
10389
+ * * SQL Data Type: nvarchar(MAX)
10390
+ */
10391
+ get Description(): string | null;
10392
+ set Description(value: string | null);
10393
+ /**
10394
+ * * Field Name: CreatedAt
10395
+ * * Display Name: Created At
10396
+ * * SQL Data Type: datetime
10397
+ */
10398
+ get CreatedAt(): Date;
10399
+ /**
10400
+ * * Field Name: UpdatedAt
10401
+ * * Display Name: Updated At
10402
+ * * SQL Data Type: datetime
10403
+ * * Default Value: getdate()
10404
+ */
10405
+ get UpdatedAt(): Date;
10406
+ }
10407
+ /**
10408
+ * Application Settings - strongly typed entity sub-class
10409
+ * * Schema: __mj
10410
+ * * Base Table: ApplicationSetting
10411
+ * * Base View: vwApplicationSettings
10412
+ * * Primary Key: ID
10413
+ * @extends {BaseEntity}
10414
+ * @class
10415
+ * @public
10416
+ */
10417
+ export declare class ApplicationSettingEntity extends BaseEntity {
10418
+ /**
10419
+ * Loads the Application Settings record from the database
10420
+ * @param ID: number - primary key value to load the Application Settings record.
10421
+ * @param EntityRelationshipsToLoad - (optional) the relationships to load
10422
+ * @returns {Promise<boolean>} - true if successful, false otherwise
10423
+ * @public
10424
+ * @async
10425
+ * @memberof ApplicationSettingEntity
10426
+ * @method
10427
+ * @override
10428
+ */
10429
+ Load(ID: number, EntityRelationshipsToLoad?: string[]): Promise<boolean>;
10430
+ /**
10431
+ * * Field Name: ID
10432
+ * * Display Name: ID
10433
+ * * SQL Data Type: int
10434
+ */
10435
+ get ID(): number;
10436
+ /**
10437
+ * * Field Name: ApplicationName
10438
+ * * Display Name: Application Name
10439
+ * * SQL Data Type: nvarchar(50)
10440
+ * * Related Entity/Foreign Key: Applications (vwApplications.Name)
10441
+ */
10442
+ get ApplicationName(): string;
10443
+ set ApplicationName(value: string);
10444
+ /**
10445
+ * * Field Name: Name
10446
+ * * Display Name: Name
10447
+ * * SQL Data Type: nvarchar(100)
10448
+ */
10449
+ get Name(): string;
10450
+ set Name(value: string);
10451
+ /**
10452
+ * * Field Name: Value
10453
+ * * Display Name: Value
10454
+ * * SQL Data Type: nvarchar(MAX)
10455
+ */
10456
+ get Value(): string;
10457
+ set Value(value: string);
10458
+ /**
10459
+ * * Field Name: Comments
10460
+ * * Display Name: Comments
10461
+ * * SQL Data Type: nvarchar(MAX)
10462
+ */
10463
+ get Comments(): string | null;
10464
+ set Comments(value: string | null);
10465
+ /**
10466
+ * * Field Name: CreatedAt
10467
+ * * Display Name: Created At
10468
+ * * SQL Data Type: datetime
10469
+ * * Default Value: getdate()
10470
+ */
10471
+ get CreatedAt(): Date;
10472
+ /**
10473
+ * * Field Name: UpdatedAt
10474
+ * * Display Name: Updated At
10475
+ * * SQL Data Type: datetime
10476
+ * * Default Value: getdate()
10477
+ */
10478
+ get UpdatedAt(): Date;
10479
+ }
10240
10480
  //# sourceMappingURL=entity_subclasses.d.ts.map