@memberjunction/core-entities 2.87.0 → 2.89.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,12 @@
1
+ import { EntitySaveOptions } from "@memberjunction/core";
2
+ import { ComponentEntity } from "../generated/entity_subclasses";
3
+ export declare class ComponentEntityExtended extends ComponentEntity {
4
+ /**
5
+ * Whenever a Component record is saved, if it is a new record or if the Specification field
6
+ * has changed, we will recalculate the values of the hasCustomProps, hasCustomEvents, RequiresData and DependencyCount fields
7
+ * @param options
8
+ * @returns
9
+ */
10
+ Save(options?: EntitySaveOptions): Promise<boolean>;
11
+ }
12
+ //# sourceMappingURL=ComponentEntityExtended.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentEntityExtended.d.ts","sourceRoot":"","sources":["../../src/custom/ComponentEntityExtended.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AAIjE,qBACa,uBAAwB,SAAQ,eAAe;IACxD;;;;;OAKG;IACmB,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;CAkB5E"}
@@ -0,0 +1,43 @@
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.ComponentEntityExtended = void 0;
10
+ const core_1 = require("@memberjunction/core");
11
+ const entity_subclasses_1 = require("../generated/entity_subclasses");
12
+ const global_1 = require("@memberjunction/global");
13
+ let ComponentEntityExtended = class ComponentEntityExtended extends entity_subclasses_1.ComponentEntity {
14
+ /**
15
+ * Whenever a Component record is saved, if it is a new record or if the Specification field
16
+ * has changed, we will recalculate the values of the hasCustomProps, hasCustomEvents, RequiresData and DependencyCount fields
17
+ * @param options
18
+ * @returns
19
+ */
20
+ async Save(options) {
21
+ const specField = this.Fields.find(f => f.Name === 'Specification');
22
+ if (!this.IsSaved || specField.Dirty) {
23
+ try {
24
+ const spec = JSON.parse(this.Specification || '{}');
25
+ if (spec) {
26
+ this.HasCustomProps = spec.properties?.length > 0;
27
+ this.HasCustomEvents = spec.events?.length > 0;
28
+ this.RequiresData = spec.dataRequirements?.mode?.length > 0; // check one element of the dataRequirements
29
+ this.DependencyCount = spec.dependencies?.length || 0;
30
+ }
31
+ }
32
+ catch (ex) {
33
+ console.error('Error saving ComponentEntityExtended:', ex);
34
+ }
35
+ }
36
+ return await super.Save(options);
37
+ }
38
+ };
39
+ exports.ComponentEntityExtended = ComponentEntityExtended;
40
+ exports.ComponentEntityExtended = ComponentEntityExtended = __decorate([
41
+ (0, global_1.RegisterClass)(core_1.BaseEntity, 'MJ: Components')
42
+ ], ComponentEntityExtended);
43
+ //# sourceMappingURL=ComponentEntityExtended.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ComponentEntityExtended.js","sourceRoot":"","sources":["../../src/custom/ComponentEntityExtended.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAAqE;AACrE,sEAAiE;AACjE,mDAAuD;AAIhD,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,mCAAe;IACxD;;;;;OAKG;IACa,KAAK,CAAC,IAAI,CAAC,OAA2B;QAClD,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,eAAe,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,SAAS,CAAC,KAAK,EAAE,CAAC;YACnC,IAAI,CAAC;gBACD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAkB,CAAC;gBACrE,IAAI,IAAI,EAAE,CAAC;oBACP,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,CAAC,CAAC;oBAClD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC;oBAC/C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAAC,CAAC,4CAA4C;oBACzG,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,IAAI,CAAC,CAAC;gBAC1D,CAAC;YACL,CAAC;YACD,OAAO,EAAE,EAAE,CAAC;gBACR,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,EAAE,CAAC,CAAC;YAC/D,CAAC;QACL,CAAC;QACD,OAAO,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACJ,CAAA;AAzBY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,sBAAa,EAAC,iBAAU,EAAE,gBAAgB,CAAC;GAC/B,uBAAuB,CAyBnC"}
@@ -5969,6 +5969,10 @@ export declare const ComponentSchema: z.ZodObject<{
5969
5969
  TechnicalDesign: z.ZodNullable<z.ZodString>;
5970
5970
  FunctionalRequirementsVector: z.ZodNullable<z.ZodString>;
5971
5971
  TechnicalDesignVector: z.ZodNullable<z.ZodString>;
5972
+ HasCustomProps: z.ZodBoolean;
5973
+ HasCustomEvents: z.ZodBoolean;
5974
+ RequiresData: z.ZodBoolean;
5975
+ DependencyCount: z.ZodNumber;
5972
5976
  SourceRegistry: z.ZodNullable<z.ZodString>;
5973
5977
  }, "strip", z.ZodTypeAny, {
5974
5978
  ID?: string;
@@ -5993,6 +5997,10 @@ export declare const ComponentSchema: z.ZodObject<{
5993
5997
  TechnicalDesign?: string;
5994
5998
  FunctionalRequirementsVector?: string;
5995
5999
  TechnicalDesignVector?: string;
6000
+ HasCustomProps?: boolean;
6001
+ HasCustomEvents?: boolean;
6002
+ RequiresData?: boolean;
6003
+ DependencyCount?: number;
5996
6004
  SourceRegistry?: string;
5997
6005
  }, {
5998
6006
  ID?: string;
@@ -6017,6 +6025,10 @@ export declare const ComponentSchema: z.ZodObject<{
6017
6025
  TechnicalDesign?: string;
6018
6026
  FunctionalRequirementsVector?: string;
6019
6027
  TechnicalDesignVector?: string;
6028
+ HasCustomProps?: boolean;
6029
+ HasCustomEvents?: boolean;
6030
+ RequiresData?: boolean;
6031
+ DependencyCount?: number;
6020
6032
  SourceRegistry?: string;
6021
6033
  }>;
6022
6034
  export type ComponentEntityType = z.infer<typeof ComponentSchema>;
@@ -25716,6 +25728,42 @@ export declare class ComponentEntity extends BaseEntity<ComponentEntityType> {
25716
25728
  get TechnicalDesignVector(): string | null;
25717
25729
  set TechnicalDesignVector(value: string | null);
25718
25730
  /**
25731
+ * * Field Name: HasCustomProps
25732
+ * * Display Name: Has Custom Props
25733
+ * * SQL Data Type: bit
25734
+ * * Default Value: 0
25735
+ * * Description: Indicates if the component has custom properties defined in its specification. Components with custom props cannot be used directly by deterministic containers.
25736
+ */
25737
+ get HasCustomProps(): boolean;
25738
+ set HasCustomProps(value: boolean);
25739
+ /**
25740
+ * * Field Name: HasCustomEvents
25741
+ * * Display Name: Has Custom Events
25742
+ * * SQL Data Type: bit
25743
+ * * Default Value: 0
25744
+ * * Description: Indicates if the component has custom events defined in its specification. Components with custom events may have limited functionality in generic containers.
25745
+ */
25746
+ get HasCustomEvents(): boolean;
25747
+ set HasCustomEvents(value: boolean);
25748
+ /**
25749
+ * * Field Name: RequiresData
25750
+ * * Display Name: Requires Data
25751
+ * * SQL Data Type: bit
25752
+ * * Default Value: 0
25753
+ * * Description: Indicates if the component requires data access (utilities object with md, rv, rq). Used to determine if component needs data context.
25754
+ */
25755
+ get RequiresData(): boolean;
25756
+ set RequiresData(value: boolean);
25757
+ /**
25758
+ * * Field Name: DependencyCount
25759
+ * * Display Name: Dependency Count
25760
+ * * SQL Data Type: int
25761
+ * * Default Value: 0
25762
+ * * Description: Number of component dependencies defined in the specification. Used to assess component complexity.
25763
+ */
25764
+ get DependencyCount(): number;
25765
+ set DependencyCount(value: number);
25766
+ /**
25719
25767
  * * Field Name: SourceRegistry
25720
25768
  * * Display Name: Source Registry
25721
25769
  * * SQL Data Type: nvarchar(255)