Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mendixmodelsdk

Package Overview
Dependencies
Maintainers
1
Versions
1108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mendixmodelsdk - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

dist/sdk/internal/qualified-name-cache.d.ts

64

.test-output/create-unit-deltas-non-prefetch.json
[
{
"deltaType": "CREATE_UNIT",
"unitId": "ab1cbb2c-5474-4874-af9c-fabff1d973f5",
"unitId": "899f3e5e-68e2-4e6d-9430-693d0787a855",
"containerId": "eec3241d-13a9-4ba9-940c-5d5223624304",

@@ -10,4 +10,4 @@ "containmentName": "modules",

{
"unitId": "ab1cbb2c-5474-4874-af9c-fabff1d973f5",
"elementId": "ab1cbb2c-5474-4874-af9c-fabff1d973f5",
"unitId": "899f3e5e-68e2-4e6d-9430-693d0787a855",
"elementId": "899f3e5e-68e2-4e6d-9430-693d0787a855",
"deltaType": "UPDATE_PROPERTY_VALUE",

@@ -22,4 +22,4 @@ "propertyName": "name",

"deltaType": "CREATE_UNIT",
"unitId": "b557e69f-68fc-4b13-9dc2-69151728f6ad",
"containerId": "ab1cbb2c-5474-4874-af9c-fabff1d973f5",
"unitId": "bd958205-17fa-494f-a62d-117c87f4c895",
"containerId": "899f3e5e-68e2-4e6d-9430-693d0787a855",
"containmentName": "domainModel",

@@ -30,4 +30,4 @@ "contentType": "DomainModels$DomainModel"

"deltaType": "CREATE_UNIT",
"unitId": "19f2d494-7c2d-462c-86f5-ba5b953e5298",
"containerId": "ab1cbb2c-5474-4874-af9c-fabff1d973f5",
"unitId": "9fb1416a-7b92-4f7b-92d4-2ef29de31923",
"containerId": "899f3e5e-68e2-4e6d-9430-693d0787a855",
"containmentName": "folders",

@@ -37,4 +37,4 @@ "contentType": "Projects$Folder"

{
"unitId": "19f2d494-7c2d-462c-86f5-ba5b953e5298",
"elementId": "19f2d494-7c2d-462c-86f5-ba5b953e5298",
"unitId": "9fb1416a-7b92-4f7b-92d4-2ef29de31923",
"elementId": "9fb1416a-7b92-4f7b-92d4-2ef29de31923",
"deltaType": "UPDATE_PROPERTY_VALUE",

@@ -49,4 +49,4 @@ "propertyName": "name",

"deltaType": "CREATE_UNIT",
"unitId": "233b7947-bbee-462a-90c0-a26cec5b703b",
"containerId": "19f2d494-7c2d-462c-86f5-ba5b953e5298",
"unitId": "59434435-091e-4cfe-bede-d39dc6bc0565",
"containerId": "9fb1416a-7b92-4f7b-92d4-2ef29de31923",
"containmentName": "documents",

@@ -56,4 +56,4 @@ "contentType": "Pages$Page"

{
"unitId": "233b7947-bbee-462a-90c0-a26cec5b703b",
"elementId": "233b7947-bbee-462a-90c0-a26cec5b703b",
"unitId": "59434435-091e-4cfe-bede-d39dc6bc0565",
"elementId": "59434435-091e-4cfe-bede-d39dc6bc0565",
"deltaType": "UPDATE_PROPERTY_VALUE",

@@ -67,4 +67,4 @@ "propertyName": "canvasWidth",

{
"unitId": "233b7947-bbee-462a-90c0-a26cec5b703b",
"elementId": "233b7947-bbee-462a-90c0-a26cec5b703b",
"unitId": "59434435-091e-4cfe-bede-d39dc6bc0565",
"elementId": "59434435-091e-4cfe-bede-d39dc6bc0565",
"deltaType": "UPDATE_PROPERTY_VALUE",

@@ -78,28 +78,28 @@ "propertyName": "canvasHeight",

{
"parentId": "233b7947-bbee-462a-90c0-a26cec5b703b",
"parentId": "59434435-091e-4cfe-bede-d39dc6bc0565",
"elementType": "Pages$LayoutCall",
"parentPropertyName": "layoutCall",
"deltaType": "CREATE_ELEMENT",
"unitId": "233b7947-bbee-462a-90c0-a26cec5b703b",
"elementId": "8f60fc22-9d49-4351-b22e-b62e8bc2a668"
"unitId": "59434435-091e-4cfe-bede-d39dc6bc0565",
"elementId": "0ad8008a-46bf-4767-9922-fa0b5952ee9b"
},
{
"parentId": "233b7947-bbee-462a-90c0-a26cec5b703b",
"parentId": "59434435-091e-4cfe-bede-d39dc6bc0565",
"elementType": "Texts$Text",
"parentPropertyName": "title",
"deltaType": "CREATE_ELEMENT",
"unitId": "233b7947-bbee-462a-90c0-a26cec5b703b",
"elementId": "19e20f16-f4d5-4c33-bbda-bcaf61f6058b"
"unitId": "59434435-091e-4cfe-bede-d39dc6bc0565",
"elementId": "6b9b50ae-7471-4f54-b1f7-3414b530e015"
},
{
"parentId": "19e20f16-f4d5-4c33-bbda-bcaf61f6058b",
"parentId": "6b9b50ae-7471-4f54-b1f7-3414b530e015",
"elementType": "Texts$Translation",
"parentPropertyName": "translations",
"deltaType": "CREATE_ELEMENT",
"unitId": "233b7947-bbee-462a-90c0-a26cec5b703b",
"elementId": "46802e60-f547-49a5-a391-2fbb8144fd8b"
"unitId": "59434435-091e-4cfe-bede-d39dc6bc0565",
"elementId": "9ee34048-e842-4719-85b6-fa2c2d68b206"
},
{
"unitId": "233b7947-bbee-462a-90c0-a26cec5b703b",
"elementId": "46802e60-f547-49a5-a391-2fbb8144fd8b",
"unitId": "59434435-091e-4cfe-bede-d39dc6bc0565",
"elementId": "9ee34048-e842-4719-85b6-fa2c2d68b206",
"deltaType": "UPDATE_PROPERTY_VALUE",

@@ -113,4 +113,4 @@ "propertyName": "languageCode",

{
"unitId": "233b7947-bbee-462a-90c0-a26cec5b703b",
"elementId": "46802e60-f547-49a5-a391-2fbb8144fd8b",
"unitId": "59434435-091e-4cfe-bede-d39dc6bc0565",
"elementId": "9ee34048-e842-4719-85b6-fa2c2d68b206",
"deltaType": "UPDATE_PROPERTY_VALUE",

@@ -124,4 +124,4 @@ "propertyName": "text",

{
"unitId": "233b7947-bbee-462a-90c0-a26cec5b703b",
"elementId": "233b7947-bbee-462a-90c0-a26cec5b703b",
"unitId": "59434435-091e-4cfe-bede-d39dc6bc0565",
"elementId": "59434435-091e-4cfe-bede-d39dc6bc0565",
"deltaType": "UPDATE_PROPERTY_VALUE",

@@ -135,4 +135,4 @@ "propertyName": "popupResizable",

{
"unitId": "233b7947-bbee-462a-90c0-a26cec5b703b",
"elementId": "233b7947-bbee-462a-90c0-a26cec5b703b",
"unitId": "59434435-091e-4cfe-bede-d39dc6bc0565",
"elementId": "59434435-091e-4cfe-bede-d39dc6bc0565",
"deltaType": "UPDATE_PROPERTY_VALUE",

@@ -139,0 +139,0 @@ "propertyName": "name",

@@ -50,2 +50,3 @@ import * as internal from '../sdk/internal';

static create(model: IModel): AppServiceAction;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -77,2 +78,3 @@ }

static create(model: IModel): AppServiceActionParameter;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -79,0 +81,0 @@ }

@@ -69,2 +69,30 @@ import { IAbstractModel, AbstractModel } from '../sdk/internal/abstract-model';

allXmlSchemas(): xmlschemas.IXmlSchema[];
findAppServiceActionByQualifiedName(qname: string): appservices.IAppServiceAction;
findAppServiceActionParameterByQualifiedName(qname: string): appservices.IAppServiceActionParameter;
findConstantByQualifiedName(qname: string): constants.IConstant;
findDataSetByQualifiedName(qname: string): datasets.IDataSet;
findDocumentTemplateByQualifiedName(qname: string): documenttemplates.IDocumentTemplate;
findAssociationBaseByQualifiedName(qname: string): domainmodels.IAssociationBase;
findAttributeByQualifiedName(qname: string): domainmodels.IAttribute;
findEntityByQualifiedName(qname: string): domainmodels.IEntity;
findEnumerationByQualifiedName(qname: string): enumerations.IEnumeration;
findExportMappingByQualifiedName(qname: string): exportmappings.IExportMapping;
findImageByQualifiedName(qname: string): images.IImage;
findImportMappingByQualifiedName(qname: string): importmappings.IImportMapping;
findJavaActionByQualifiedName(qname: string): javaactions.IJavaAction;
findJavaActionParameterByQualifiedName(qname: string): javaactions.IJavaActionParameter;
findMenuDocumentByQualifiedName(qname: string): menus.IMenuDocument;
findMicroflowByQualifiedName(qname: string): microflows.IMicroflow;
findMicroflowParameterByQualifiedName(qname: string): microflows.IMicroflowParameter;
findRuleByQualifiedName(qname: string): microflows.IRule;
findRuleParameterByQualifiedName(qname: string): microflows.IRuleParameter;
findLayoutByQualifiedName(qname: string): pages.ILayout;
findLayoutParameterByQualifiedName(qname: string): pages.ILayoutParameter;
findPageByQualifiedName(qname: string): pages.IPage;
findSnippetByQualifiedName(qname: string): pages.ISnippet;
findRegularExpressionByQualifiedName(qname: string): regularexpressions.IRegularExpression;
findModuleRoleByQualifiedName(qname: string): security.IModuleRole;
findUserRoleByQualifiedName(qname: string): security.IUserRole;
findImportedWebServiceByQualifiedName(qname: string): webservices.IImportedWebService;
findXmlSchemaByQualifiedName(qname: string): xmlschemas.IXmlSchema;
}

@@ -117,4 +145,2 @@ /**

allXmlSchemas(): xmlschemas.IXmlSchema[];
}
export interface IByNameReferenceResolver {
findAppServiceActionByQualifiedName(qname: string): appservices.IAppServiceAction;

@@ -153,3 +179,3 @@ findAppServiceActionParameterByQualifiedName(qname: string): appservices.IAppServiceActionParameter;

*/
export interface IModel extends IBaseModel, IByNameReferenceResolver {
export interface IModel extends IBaseModel {
/**

@@ -156,0 +182,0 @@ * The actual contents of the model.

@@ -268,4 +268,88 @@ var __extends = (this && this.__extends) || function (d, b) {

};
BaseModel.prototype.findAppServiceActionByQualifiedName = function (qname) {
return this._resolveName("AppServices$AppServiceAction", qname);
};
BaseModel.prototype.findAppServiceActionParameterByQualifiedName = function (qname) {
return this._resolveName("AppServices$AppServiceActionParameter", qname);
};
BaseModel.prototype.findConstantByQualifiedName = function (qname) {
return this._resolveName("Constants$Constant", qname);
};
BaseModel.prototype.findDataSetByQualifiedName = function (qname) {
return this._resolveName("DataSets$DataSet", qname);
};
BaseModel.prototype.findDocumentTemplateByQualifiedName = function (qname) {
return this._resolveName("DocumentTemplates$DocumentTemplate", qname);
};
BaseModel.prototype.findAssociationBaseByQualifiedName = function (qname) {
return this._resolveName("DomainModels$AssociationBase", qname);
};
BaseModel.prototype.findAttributeByQualifiedName = function (qname) {
return this._resolveName("DomainModels$Attribute", qname);
};
BaseModel.prototype.findEntityByQualifiedName = function (qname) {
return this._resolveName("DomainModels$Entity", qname);
};
BaseModel.prototype.findEnumerationByQualifiedName = function (qname) {
return this._resolveName("Enumerations$Enumeration", qname);
};
BaseModel.prototype.findExportMappingByQualifiedName = function (qname) {
return this._resolveName("ExportMappings$ExportMapping", qname);
};
BaseModel.prototype.findImageByQualifiedName = function (qname) {
return this._resolveName("Images$Image", qname);
};
BaseModel.prototype.findImportMappingByQualifiedName = function (qname) {
return this._resolveName("ImportMappings$ImportMapping", qname);
};
BaseModel.prototype.findJavaActionByQualifiedName = function (qname) {
return this._resolveName("JavaActions$JavaAction", qname);
};
BaseModel.prototype.findJavaActionParameterByQualifiedName = function (qname) {
return this._resolveName("JavaActions$JavaActionParameter", qname);
};
BaseModel.prototype.findMenuDocumentByQualifiedName = function (qname) {
return this._resolveName("Menus$MenuDocument", qname);
};
BaseModel.prototype.findMicroflowByQualifiedName = function (qname) {
return this._resolveName("Microflows$Microflow", qname);
};
BaseModel.prototype.findMicroflowParameterByQualifiedName = function (qname) {
return this._resolveName("Microflows$MicroflowParameter", qname);
};
BaseModel.prototype.findRuleByQualifiedName = function (qname) {
return this._resolveName("Microflows$Rule", qname);
};
BaseModel.prototype.findRuleParameterByQualifiedName = function (qname) {
return this._resolveName("Microflows$RuleParameter", qname);
};
BaseModel.prototype.findLayoutByQualifiedName = function (qname) {
return this._resolveName("Pages$Layout", qname);
};
BaseModel.prototype.findLayoutParameterByQualifiedName = function (qname) {
return this._resolveName("Pages$LayoutParameter", qname);
};
BaseModel.prototype.findPageByQualifiedName = function (qname) {
return this._resolveName("Pages$Page", qname);
};
BaseModel.prototype.findSnippetByQualifiedName = function (qname) {
return this._resolveName("Pages$Snippet", qname);
};
BaseModel.prototype.findRegularExpressionByQualifiedName = function (qname) {
return this._resolveName("RegularExpressions$RegularExpression", qname);
};
BaseModel.prototype.findModuleRoleByQualifiedName = function (qname) {
return this._resolveName("Security$ModuleRole", qname);
};
BaseModel.prototype.findUserRoleByQualifiedName = function (qname) {
return this._resolveName("Security$UserRole", qname);
};
BaseModel.prototype.findImportedWebServiceByQualifiedName = function (qname) {
return this._resolveName("WebServices$ImportedWebService", qname);
};
BaseModel.prototype.findXmlSchemaByQualifiedName = function (qname) {
return this._resolveName("XmlSchemas$XmlSchema", qname);
};
return BaseModel;
})(abstract_model_1.AbstractModel);
exports.BaseModel = BaseModel;

@@ -38,2 +38,3 @@ import * as internal from '../sdk/internal';

static createIn(container: projects.IFolderBase): Constant;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -40,0 +41,0 @@ }

@@ -44,2 +44,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
Constant.prototype._isByNameReferrable = function () { return true; };
Constant.prototype._initializeDefaultProperties = function () {

@@ -46,0 +47,0 @@ _super.prototype._initializeDefaultProperties.call(this);

@@ -56,2 +56,3 @@ import * as internal from '../sdk/internal';

static createIn(container: projects.IFolderBase): DataSet;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -58,0 +59,0 @@ }

@@ -78,2 +78,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
DataSet.prototype._isByNameReferrable = function () { return true; };
DataSet.prototype._initializeDefaultProperties = function () {

@@ -80,0 +81,0 @@ _super.prototype._initializeDefaultProperties.call(this);

@@ -334,2 +334,3 @@ import * as internal from '../sdk/internal';

static createIn(container: projects.IFolderBase): DocumentTemplate;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -336,0 +337,0 @@ }

@@ -163,2 +163,3 @@ import * as internal from '../sdk/internal';

constructor(model: internal.AbstractModel, typeName: string, id: string, isPartial: boolean, unit: internal.ModelUnit, container: internal.AbstractElement);
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -257,2 +258,3 @@ }

static create(model: IModel): Attribute;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -610,2 +612,3 @@ }

static create(model: IModel): Entity;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -612,0 +615,0 @@ }

@@ -51,2 +51,3 @@ import * as internal from '../sdk/internal';

static createIn(container: projects.IFolderBase): Enumeration;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -53,0 +54,0 @@ }

@@ -72,2 +72,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
Enumeration.prototype._isByNameReferrable = function () { return true; };
Enumeration.prototype._initializeDefaultProperties = function () {

@@ -74,0 +75,0 @@ _super.prototype._initializeDefaultProperties.call(this);

@@ -40,2 +40,3 @@ import * as internal from '../sdk/internal';

static createIn(container: projects.IFolderBase): ExportMapping;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -42,0 +43,0 @@ }

@@ -51,2 +51,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
ExportMapping.prototype._isByNameReferrable = function () { return true; };
ExportMapping.prototype._initializeDefaultProperties = function () {

@@ -53,0 +54,0 @@ _super.prototype._initializeDefaultProperties.call(this);

@@ -30,2 +30,3 @@ import * as internal from '../sdk/internal';

static create(model: IModel): Image;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -32,0 +33,0 @@ }

@@ -50,2 +50,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
Image.prototype._isByNameReferrable = function () { return true; };
Image.prototype._initializeDefaultProperties = function () {

@@ -52,0 +53,0 @@ _super.prototype._initializeDefaultProperties.call(this);

@@ -36,2 +36,3 @@ import * as internal from '../sdk/internal';

static createIn(container: projects.IFolderBase): ImportMapping;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -38,0 +39,0 @@ }

@@ -46,2 +46,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
ImportMapping.prototype._isByNameReferrable = function () { return true; };
ImportMapping.prototype._initializeDefaultProperties = function () {

@@ -48,0 +49,0 @@ _super.prototype._initializeDefaultProperties.call(this);

@@ -43,2 +43,3 @@ import * as internal from '../sdk/internal';

static createIn(container: projects.IFolderBase): JavaAction;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -72,2 +73,3 @@ }

static create(model: IModel): JavaActionParameter;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -74,0 +76,0 @@ }

@@ -44,2 +44,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
JavaAction.prototype._isByNameReferrable = function () { return true; };
JavaAction.prototype._initializeDefaultProperties = function () {

@@ -106,2 +107,3 @@ _super.prototype._initializeDefaultProperties.call(this);

};
JavaActionParameter.prototype._isByNameReferrable = function () { return true; };
JavaActionParameter.prototype._initializeDefaultProperties = function () {

@@ -108,0 +110,0 @@ _super.prototype._initializeDefaultProperties.call(this);

@@ -33,2 +33,3 @@ import * as internal from '../sdk/internal';

static createIn(container: projects.IFolderBase): MenuDocument;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -35,0 +36,0 @@ }

@@ -34,2 +34,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
MenuDocument.prototype._isByNameReferrable = function () { return true; };
MenuDocument.prototype._initializeDefaultProperties = function () {

@@ -36,0 +37,0 @@ _super.prototype._initializeDefaultProperties.call(this);

@@ -33,2 +33,3 @@ import * as internal from '../sdk/internal';

static createIn(container: projects.IFolderBase): RegularExpression;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -35,0 +36,0 @@ }

@@ -34,2 +34,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
RegularExpression.prototype._isByNameReferrable = function () { return true; };
RegularExpression.prototype._initializeDefaultProperties = function () {

@@ -36,0 +37,0 @@ _super.prototype._initializeDefaultProperties.call(this);

@@ -124,2 +124,3 @@ import * as internal from '../sdk/internal';

static create(model: IModel): ModuleRole;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -285,2 +286,3 @@ }

static create(model: IModel): UserRole;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -287,0 +289,0 @@ }

@@ -221,2 +221,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
ModuleRole.prototype._isByNameReferrable = function () { return true; };
ModuleRole.prototype._initializeDefaultProperties = function () {

@@ -599,2 +600,3 @@ _super.prototype._initializeDefaultProperties.call(this);

};
UserRole.prototype._isByNameReferrable = function () { return true; };
UserRole.prototype._initializeDefaultProperties = function () {

@@ -601,0 +603,0 @@ _super.prototype._initializeDefaultProperties.call(this);

@@ -162,2 +162,3 @@ import * as internal from '../sdk/internal';

static createIn(container: projects.IFolderBase): ImportedWebService;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -164,0 +165,0 @@ }

@@ -49,2 +49,3 @@ import * as internal from '../sdk/internal';

static createIn(container: projects.IFolderBase): XmlSchema;
_isByNameReferrable(): boolean;
_initializeDefaultProperties(): void;

@@ -51,0 +52,0 @@ }

@@ -61,2 +61,3 @@ var __extends = (this && this.__extends) || function (d, b) {

};
XmlSchema.prototype._isByNameReferrable = function () { return true; };
XmlSchema.prototype._initializeDefaultProperties = function () {

@@ -63,0 +64,0 @@ _super.prototype._initializeDefaultProperties.call(this);

@@ -18,32 +18,4 @@ import * as classes from './gen/all-model-classes';

_allModelClasses(): any;
findModuleByQualifiedName(name: string): classes.projects.IModule;
findLayoutByQualifiedName(qname: string): classes.pages.ILayout;
findJavaActionByQualifiedName(qname: string): classes.javaactions.IJavaAction;
findMicroflowByQualifiedName(qname: string): classes.microflows.IMicroflow;
findSnippetByQualifiedName(qname: string): classes.pages.ISnippet;
findMenuDocumentByQualifiedName(qname: string): classes.menus.IMenuDocument;
findLayoutParameterByQualifiedName(qname: string): classes.pages.ILayoutParameter;
findMicroflowParameterByQualifiedName(qname: string): classes.microflows.IMicroflowParameter;
findRuleParameterByQualifiedName(qname: string): classes.microflows.IRuleParameter;
findPageByQualifiedName(qname: string): classes.pages.IPage;
findAssociationBaseByQualifiedName(qname: string): classes.domainmodels.IAssociationBase;
findEntityByQualifiedName(qname: string): classes.domainmodels.IEntity;
findAttributeByQualifiedName(qname: string): classes.domainmodels.IAttribute;
findAppServiceActionByQualifiedName(qname: string): classes.appservices.IAppServiceAction;
findAppServiceActionParameterByQualifiedName(qname: string): classes.appservices.IAppServiceActionParameter;
findXmlSchemaByQualifiedName(qname: string): classes.xmlschemas.IXmlSchema;
findExportMappingByQualifiedName(qname: string): classes.exportmappings.IExportMapping;
findImportMappingByQualifiedName(qname: string): classes.importmappings.IImportMapping;
findUserRoleByQualifiedName(qname: string): classes.security.IUserRole;
findRegularExpressionByQualifiedName(qname: string): classes.regularexpressions.IRegularExpression;
findModuleRoleByQualifiedName(qname: string): classes.security.IModuleRole;
findImportedWebServiceByQualifiedName(qname: string): classes.webservices.IImportedWebService;
findDocumentTemplateByQualifiedName(qname: string): classes.documenttemplates.IDocumentTemplate;
findRuleByQualifiedName(qname: string): classes.microflows.IRule;
findDataSetByQualifiedName(qname: string): classes.datasets.IDataSet;
findConstantByQualifiedName(qname: string): classes.constants.IConstant;
findImageByQualifiedName(qname: string): classes.images.IImage;
findJavaActionParameterByQualifiedName(qname: string): classes.javaactions.IJavaActionParameter;
findEnumerationByQualifiedName(qname: string): classes.enumerations.IEnumeration;
findModuleByQualifiedName(qname: string): classes.projects.IModule;
}
export declare type ModelSdkClient = ModelSdkClientImpl<IModel, Model>;

@@ -6,3 +6,2 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var classes = require('./gen/all-model-classes');
var lodash = require('lodash');

@@ -41,142 +40,7 @@ var base = require('./gen/base-model');

};
Model.prototype.findModuleByQualifiedName = function (name) {
return lodash.find(_super.prototype.allModules.call(this), function (m) { return m.name === name; });
Model.prototype.findModuleByQualifiedName = function (qname) {
return lodash.find(this._unitsByType["Projects$Module"], function (m) { return m.name === qname; });
};
Model.prototype.findLayoutByQualifiedName = function (qname) {
return _super.prototype._resolveInCollection.call(this, _super.prototype.allLayouts, qname);
};
Model.prototype.findJavaActionByQualifiedName = function (qname) {
return _super.prototype._resolveInCollection.call(this, _super.prototype.allJavaActions, qname);
};
Model.prototype.findMicroflowByQualifiedName = function (qname) {
return _super.prototype._resolveInCollection.call(this, _super.prototype.allMicroflows, qname);
};
Model.prototype.findSnippetByQualifiedName = function (qname) {
return _super.prototype._resolveInCollection.call(this, _super.prototype.allSnippets, qname);
};
Model.prototype.findMenuDocumentByQualifiedName = function (qname) {
return _super.prototype._resolveInCollection.call(this, _super.prototype.allMenuDocuments, qname);
};
Model.prototype.findLayoutParameterByQualifiedName = function (qname) {
// TODO implement
_super.prototype._warnAboutUnsupportedType.call(this, 'layoutParameter', qname);
return null;
};
Model.prototype.findMicroflowParameterByQualifiedName = function (qname) {
// TODO implement
_super.prototype._warnAboutUnsupportedType.call(this, 'microflowParameter', qname);
return null;
};
Model.prototype.findRuleParameterByQualifiedName = function (qname) {
// TODO implement
_super.prototype._warnAboutUnsupportedType.call(this, 'ruleParameter', qname);
return null;
};
Model.prototype.findPageByQualifiedName = function (qname) {
return _super.prototype._resolveInCollection.call(this, _super.prototype.allPages, qname);
};
Model.prototype.findAssociationBaseByQualifiedName = function (qname) {
var _this = this;
return _super.prototype._resolveElement.call(this, qname, //reuse resolveElement for pre condition checks..
function (assocQname) {
var parts = _super.prototype._parseQname.call(_this, assocQname, 2);
var module = _this.findModuleByQualifiedName(parts[0]);
if (!module || !module.domainModel)
return null;
var assoc = module.domainModel.associations.find(function (assoc) { return assoc.name === parts[1]; });
if (assoc)
return assoc;
return module.domainModel.crossAssociations.find(function (assoc) { return assoc.name === parts[1]; });
});
};
Model.prototype.findEntityByQualifiedName = function (qname) {
var _this = this;
return _super.prototype._resolveElement.call(this, qname, //reuse resolveElement for pre condition checks..
function (entityQName) {
var parts = _super.prototype._parseQname.call(_this, entityQName, 2);
var module = _this.findModuleByQualifiedName(parts[0]);
if (!module || !module.domainModel)
return null;
return module.domainModel.entities.find(function (entity) { return entity.name === parts[1]; });
});
};
Model.prototype.findAttributeByQualifiedName = function (qname) {
var _this = this;
return _super.prototype._resolveElement.call(this, qname, //reuse resolveElement for pre condition checks..
function (entityQName) { return _this.findEntityByQualifiedName(entityQName); }, function (entity, attrName) { return entity.attributes.find(function (attr) { return attr.name === attrName; }); });
};
Model.prototype.findAppServiceActionByQualifiedName = function (qname) {
var _this = this;
return _super.prototype._resolveElement.call(this, qname, function (appserviceName) { return _super.prototype._resolveInCollection.call(_this, _super.prototype.allConsumedAppServices, appserviceName); }, function (service, actionName) { return service.actions.find(function (action) { return action.name === actionName; }); });
};
Model.prototype.findAppServiceActionParameterByQualifiedName = function (qname) {
var _this = this;
return _super.prototype._resolveElement.call(this, qname, function (appserviceName) { return _super.prototype._resolveInCollection.call(_this, _super.prototype.allConsumedAppServices, appserviceName); }, function (service, actionName) { return service.actions.find(function (action) { return action.name === actionName; }); }, function (action, paramName) { return action.parameters.find(function (param) { return param.name === paramName; }); });
};
Model.prototype.findXmlSchemaByQualifiedName = function (qname) {
return _super.prototype._resolveInCollection.call(this, _super.prototype.allXmlSchemas, qname);
};
Model.prototype.findExportMappingByQualifiedName = function (qname) {
return _super.prototype._resolveInCollection.call(this, _super.prototype.allExportMappings, qname);
};
Model.prototype.findImportMappingByQualifiedName = function (qname) {
return _super.prototype._resolveInCollection.call(this, _super.prototype.allImportMappings, qname);
};
Model.prototype.findUserRoleByQualifiedName = function (qname) {
if (!qname)
return null;
var securities = _super.prototype.allProjectSecurities.call(this);
if (!securities.length)
return null;
// .. might be multiple securities in theory if there is an teamserver conflict..
securities[0].userRoles.find(function (role) { return role.name === qname; });
};
Model.prototype.findRegularExpressionByQualifiedName = function (qname) {
return _super.prototype._resolveInCollection.call(this, _super.prototype.allRegularExpressions, qname);
};
Model.prototype.findModuleRoleByQualifiedName = function (qname) {
var _this = this;
return _super.prototype._resolveElement.call(this, qname, //reuse resolveElement for pre condition checks..
function (assocQname) {
var parts = _super.prototype._parseQname.call(_this, assocQname, 2);
var module = _this.findModuleByQualifiedName(parts[0]);
if (!module || !module.moduleSecurity)
return null;
return module.moduleSecurity.moduleRoles.find(function (role) { return role.name === parts[1]; });
});
};
Model.prototype.findImportedWebServiceByQualifiedName = function (qname) {
return _super.prototype._resolveInCollection.call(this, _super.prototype.allImportedWebServices, qname);
};
Model.prototype.findDocumentTemplateByQualifiedName = function (qname) {
return _super.prototype._resolveInCollection.call(this, _super.prototype.allDocumentTemplates, qname);
};
Model.prototype.findRuleByQualifiedName = function (qname) {
return _super.prototype._resolveInCollection.call(this, _super.prototype.allRules, qname);
};
Model.prototype.findDataSetByQualifiedName = function (qname) {
return _super.prototype._resolveInCollection.call(this, _super.prototype.allDataSets, qname);
};
Model.prototype.findConstantByQualifiedName = function (qname) {
return _super.prototype._resolveInCollection.call(this, _super.prototype.allConstants, qname);
};
Model.prototype.findImageByQualifiedName = function (qname) {
if (!qname)
return null;
var parts = _super.prototype._parseQname.call(this, qname, 3, "image");
var imageCollectionQName = parts[0] + "." + parts[1];
var collection = lodash.find(this._unitsByType[classes.images.ImageCollection.typeName].slice(), function (c) { return c.qualifiedName === imageCollectionQName; });
if (!collection)
return null;
return collection.images.find(function (i) { return i.name === parts[2]; });
};
Model.prototype.findJavaActionParameterByQualifiedName = function (qname) {
var _this = this;
return _super.prototype._resolveElement.call(this, qname, function (javaActionName) { return _this.findJavaActionByQualifiedName(javaActionName); }, function (action, paramName) { return action.parameters.find(function (p) { return p.name === paramName; }); });
};
Model.prototype.findEnumerationByQualifiedName = function (qname) {
return _super.prototype._resolveInCollection.call(this, _super.prototype.allEnumerations, qname);
};
return Model;
})(base.BaseModel);
exports.Model = Model;
import { common } from '../../common';
import { configuration } from '../config';
import { IAbstractUnit } from './units';
import { IAbstractUnit, StructuralUnit } from './units';
import { IWorkingCopy, IDelta, IAbstractUnitJson } from './transport-interfaces';

@@ -11,2 +11,3 @@ import { ByNameReference } from './references';

import { Version } from './version-checks';
import QualifiedNameCache from "./qualified-name-cache";
/**

@@ -95,2 +96,7 @@ * This interface exposes a single Mendix Model.

/**
* Map qualifiedName -> AbstractElement[]; the same qualified name could potentially refer to different kind of objects;
* e.g. MyFirstModule.SecondThing could both be an entity or a microflow
*/
_qualifiedNameCache: QualifiedNameCache;
/**
* Map unitType -> units[], containing all units of this model, per type, but not sorted in any particular order.

@@ -150,2 +156,11 @@ * Please extend the type whenever applicable, for convenience of the programmer.

/**
* Structural units have children, (like folders have documents) but in storage the inverse is stored;
* documents specify in which parent they resided
* However, in the sdk we want to be able to read the children of a folder, so these kind of properties are expressed
* using StructuralChild(List)Property objects, see properties.ts.
* To avoid these properties to have re-evaluate on each read which children they have by visiting all the unit interfaces;
* we notify structural parents that a child was added upon loading a child structure.
*/
_addUnitToStructuralParent(unit: IAbstractUnit, parent: StructuralUnit): void;
/**
* If a reference is broken, it should be registered here, so that it can be restored once model elements are renamed.

@@ -183,11 +198,2 @@ */

_resolveName(typeName: string, qualifiedName: string): IAbstractElement;
/**
* Resolver methods for references by name
*/
protected _resolveElement(qname: string, docResolver: (qname: string) => IStructure, ...subResolvers: ISubResolver[]): any;
/**
* Finds an item in a colleciton
*/
protected _resolveInCollection<T extends IAbstractUnit>(collection: () => T[], qname: string): T;
protected _parseQname(qname: string, expectedNumberOfParts: number, target?: string): string[];
protected _warnAboutUnsupportedType(propertyName: string, qname: string): void;

@@ -194,0 +200,0 @@ findModuleByQualifiedName(qname: string): void;

@@ -1,3 +0,2 @@

var mobservable = require('mobservable');
var lodash = require('lodash');
var mobservable_1 = require('mobservable');
var deltas_1 = require('./deltas');

@@ -7,2 +6,4 @@ var instances_1 = require('./instances');

var utils_1 = require('../utils');
var properties_1 = require('./properties');
var qualified_name_cache_1 = require("./qualified-name-cache");
/**

@@ -22,2 +23,7 @@ * Abstract: this class should never be instantiated. Implementation of {@link IModel}.

/**
* Map qualifiedName -> AbstractElement[]; the same qualified name could potentially refer to different kind of objects;
* e.g. MyFirstModule.SecondThing could both be an entity or a microflow
*/
this._qualifiedNameCache = new qualified_name_cache_1.default(this);
/**
* Map unitType -> units[], containing all units of this model, per type, but not sorted in any particular order.

@@ -100,3 +106,3 @@ * Please extend the type whenever applicable, for convenience of the programmer.

if (!(typeName in this._unitsByType))
mobservable.extendObservable(this._unitsByType, (_a = {}, _a[typeName] = [], _a));
mobservable_1.extendObservable(this._unitsByType, (_a = {}, _a[typeName] = mobservable_1.fastArray(), _a));
return this._unitsByType[typeName];

@@ -163,6 +169,8 @@ var _a;

this._client.loadUnitById(this.metadata.id, id, function (data) {
unit._updateWithJson(data);
_this._resolveContainer(unit, data.containerId);
unit._resolveReferences();
unit._markLoaded();
mobservable_1.transaction(function () {
unit._updateWithJson(data);
_this._resolveContainer(unit, data.containerId);
unit._resolveReferences();
unit._markLoaded();
});
}, errorCallback || this._errorHandler);

@@ -196,13 +204,17 @@ }

var _this = this;
data.forEach(function (unitJson) {
instances_1.instancehelpers.abstractUnitJsonToInstance(_this, unitJson, true);
mobservable_1.transaction(function () {
data.forEach(function (unitJson) {
instances_1.instancehelpers.abstractUnitJsonToInstance(_this, unitJson, true);
});
// resolve all parents:
data.filter(function (unitJson) { return !!unitJson.containerId; }).forEach(function (unitJson) {
var unit = _this._unitsCache[unitJson.$ID];
_this._resolveContainer(unit, unitJson.containerId);
});
// resolve all qualified names:
Object.keys(_this._unitsCache).forEach(function (key) { return _this._qualifiedNameCache.addStructureToCache(_this._unitsCache[key]); });
// resolve all references:
Object.keys(_this._unitsCache).forEach(function (key) { return _this._unitsCache[key]._resolveReferences(); });
_this._areUnitInterfacesLoaded = true;
});
// resolve all parents:
data.filter(function (unitJson) { return !!unitJson.containerId; }).forEach(function (unitJson) {
var unit = _this._unitsCache[unitJson.$ID];
_this._resolveContainer(unit, unitJson.containerId);
});
// resolve all references:
Object.keys(this._unitsCache).forEach(function (key) { return _this._unitsCache[key]._resolveReferences(); });
this._areUnitInterfacesLoaded = true;
};

@@ -215,6 +227,29 @@ AbstractModel.prototype._resolveContainer = function (unit, containerId) {

throw new Error("Invalid container ID: " + containerId);
if (container != unit)
if (container != unit) {
unit.container = container;
// add unit to the structural parent in the project tree
this._addUnitToStructuralParent(unit, container);
}
};
/**
* Structural units have children, (like folders have documents) but in storage the inverse is stored;
* documents specify in which parent they resided
* However, in the sdk we want to be able to read the children of a folder, so these kind of properties are expressed
* using StructuralChild(List)Property objects, see properties.ts.
* To avoid these properties to have re-evaluate on each read which children they have by visiting all the unit interfaces;
* we notify structural parents that a child was added upon loading a child structure.
*/
AbstractModel.prototype._addUnitToStructuralParent = function (unit, parent) {
// In future: remove from old parent first if applicable
var prop = parent['__' + unit._containmentName];
parent._isUpdating = true;
if (prop instanceof properties_1.StructuralChildProperty)
prop.observableValue(unit);
else if (prop instanceof properties_1.StructuralChildListProperty)
prop.observableValue.push(unit);
else
throw new Error("Illegal state");
parent._isUpdating = false;
};
/**
* If a reference is broken, it should be registered here, so that it can be restored once model elements are renamed.

@@ -240,5 +275,8 @@ */

AbstractModel.prototype._processNameChange = function (element) {
for (var i = this._unresolvedReferences.length - 1; i >= 0; i--)
if (this._unresolvedReferences[i].resolve())
this._unresolvedReferences.splice(i, 1);
if (instances_1.instancehelpers.structureAffectsQualifiedNames(element)) {
this._qualifiedNameCache.processNameChange(element);
for (var i = this._unresolvedReferences.length - 1; i >= 0; i--)
if (this._unresolvedReferences[i].resolve())
this._unresolvedReferences.splice(i, 1);
}
};

@@ -281,51 +319,4 @@ AbstractModel.prototype._assertConnectionClosed = function () {

AbstractModel.prototype._resolveName = function (typeName, qualifiedName) {
if (!typeName)
throw new Error("Cannot resolve a name without a type");
if (!qualifiedName)
return null;
var parts = typeName.split("$");
if (parts.length !== 2)
throw new Error("Qualified type name does not have correct format: " + typeName);
var funcName = "find" + parts[1] + "ByQualifiedName";
if (typeof this[funcName] !== "function") {
throw new Error("Cannot resolve references of type: " + typeName);
}
return this[funcName](qualifiedName);
return this._qualifiedNameCache.resolve(typeName, qualifiedName);
};
/**
* Resolver methods for references by name
*/
AbstractModel.prototype._resolveElement = function (qname, docResolver) {
var subResolvers = [];
for (var _i = 2; _i < arguments.length; _i++) {
subResolvers[_i - 2] = arguments[_i];
}
if (!qname)
return null;
var parts = this._parseQname(qname, subResolvers.length + 2);
var parent = docResolver(parts[0] + "." + parts[1]);
var currentPart = 2;
while (!(parent === null || parent === undefined) && currentPart < parts.length) {
parent = subResolvers[currentPart - 2](parent, parts[currentPart]);
currentPart += 1;
}
return parent;
};
/**
* Finds an item in a colleciton
*/
AbstractModel.prototype._resolveInCollection = function (collection, qname) {
if (!qname)
return null;
var parts = this._parseQname(qname, 2, "resolve function " + collection['name']);
return lodash.find(collection.call(this), function (item) { return item.qualifiedName === qname; });
};
// Defensive programming, we want to discover implementation errors ASAP here..
AbstractModel.prototype._parseQname = function (qname, expectedNumberOfParts, target) {
var parts = qname.split('.');
if (parts.length !== expectedNumberOfParts) {
throw new Error("Invalid identifier '" + qname + "'" + (target ? " for " + target : "") + ": expected exactly " + expectedNumberOfParts + " parts.");
}
return parts;
};
AbstractModel.prototype._warnAboutUnsupportedType = function (propertyName, qname) {

@@ -332,0 +323,0 @@ utils_1.utils.warnOnce("Cannot resolve identifier; the type of the identifiers used by property '" + propertyName + "' is currently not supported. Please use the property '." + propertyName + "QualifiedName' instead to read or update this reference.");

@@ -53,2 +53,7 @@ import * as structures from './structures';

/**
* Return true if this is an abstractElement that might be referred to by some other element.
* If true, this element is maintained in the qualifiedNamesCache
*/
_isByNameReferrable(): boolean;
/**
* Adds a back reference, i.e. a reference pointing to us,

@@ -55,0 +60,0 @@ * which needs to be informed of changes to this element (including deletion).

@@ -78,2 +78,9 @@ var __extends = (this && this.__extends) || function (d, b) {

/**
* Return true if this is an abstractElement that might be referred to by some other element.
* If true, this element is maintained in the qualifiedNamesCache
*/
AbstractElement.prototype._isByNameReferrable = function () {
return false;
};
/**
* Adds a back reference, i.e. a reference pointing to us,

@@ -106,2 +113,4 @@ * which needs to be informed of changes to this element (including deletion).

this._backReferences = [];
// remove from qualifiedNamesCache
this._model._qualifiedNameCache.removeStructureFromCache(this);
// avoid roundtrip delete -> remove from parent -> delete etc, so enforce that an element is removed through its parent:

@@ -108,0 +117,0 @@ if (this.container) {

import { AbstractModel } from './abstract-model';
import * as versions from './version-checks';
import * as structures from './structures';
import * as units from './units';

@@ -54,2 +55,7 @@ import * as elements from './elements';

function createUnit(container: units.IStructuralUnit, constructor: units.IAbstractUnitConstructor): any;
/**
* Type -> class (constructor function) lookup, e.g. "DomainModels$Entity" -> DomainModels.Entity
*/
function lookupInitializer(qualifiedTypeName: string, classes: any): any;
function structureAffectsQualifiedNames(structure: structures.Structure): boolean;
}
var abstract_model_1 = require('./abstract-model');
var versions = require('./version-checks');
var units = require('./units');
var elements = require('./elements');
var utils_1 = require('../utils');

@@ -94,5 +95,29 @@ /**

model._cache(instance);
model._addUnitToStructuralParent(instance, container);
return instance;
}
instancehelpers.createUnit = createUnit;
/**
* Type -> class (constructor function) lookup, e.g. "DomainModels$Entity" -> DomainModels.Entity
*/
function lookupInitializer(qualifiedTypeName, classes) {
if (!qualifiedTypeName)
return nullWithError('cannot look up initializer for a falsy qualified type name');
var $index = qualifiedTypeName.indexOf('$');
if ($index < 0 || $index === qualifiedTypeName.length - 1)
return nullWithError("qualified type '" + qualifiedTypeName + "' is not of the form '<meta model>$<type name>");
var metaModelName = qualifiedTypeName.substring(0, $index).toLowerCase();
var className = qualifiedTypeName.substring($index + 1);
if (!classes[metaModelName])
return null; // As long as meta model isn't complete..
//return nullWithError(`no meta model with name '${metaModelName}' exists`);
if (!classes[metaModelName][className])
return nullWithError("no type with name '" + metaModelName + "$" + className + " exists");
return classes[metaModelName][className];
}
instancehelpers.lookupInitializer = lookupInitializer;
function structureAffectsQualifiedNames(structure) {
return structure._declaredAsNamespace || (structure instanceof elements.AbstractElement && structure._isByNameReferrable());
}
instancehelpers.structureAffectsQualifiedNames = structureAffectsQualifiedNames;
})(instancehelpers = exports.instancehelpers || (exports.instancehelpers = {}));

@@ -126,19 +151,1 @@ function checkStructureVersion(instance, includeWarnings) {

}
/**
* Type -> class (constructor function) lookup, e.g. "DomainModels$Entity" -> DomainModels.Entity
*/
function lookupInitializer(qualifiedTypeName, classes) {
if (!qualifiedTypeName)
return nullWithError('cannot look up initializer for a falsy qualified type name');
var $index = qualifiedTypeName.indexOf('$');
if ($index < 0 || $index === qualifiedTypeName.length - 1)
return nullWithError("qualified type '" + qualifiedTypeName + "' is not of the form '<meta model>$<type name>");
var metaModelName = qualifiedTypeName.substring(0, $index).toLowerCase();
var className = qualifiedTypeName.substring($index + 1);
if (!classes[metaModelName])
return null; // As long as meta model isn't complete..
//return nullWithError(`no meta model with name '${metaModelName}' exists`);
if (!classes[metaModelName][className])
return nullWithError("no type with name '" + metaModelName + "$" + className + " exists");
return classes[metaModelName][className];
}

@@ -221,2 +221,3 @@ import * as structures from './structures';

* Value of a property owned by a structural unit.
* Structural child values are updated through AbstractModel._addUnitToStructuralParent
*/

@@ -233,2 +234,3 @@ export declare class StructuralChildProperty<T> extends AbstractProperty<T, IObservableValue<T>> {

* Property instance that wraps a list of structural units.
* Structural child values are updated through AbstractModel._addUnitToStructuralParent
*/

@@ -235,0 +237,0 @@ export declare class StructuralChildListProperty<T> extends AbstractProperty<T[], IObservableArray<T>> {

@@ -6,3 +6,2 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var lodash = require('lodash');
var instances = require('./instances');

@@ -196,3 +195,3 @@ var deltas = require('./deltas');

PrimitiveListProperty.prototype.initialize = function (initialItems) {
return mobservable_1.observable(mobservable_1.asFlat(initialItems || []));
return mobservable_1.observable(mobservable_1.fastArray(initialItems || []));
};

@@ -346,4 +345,6 @@ PrimitiveListProperty.prototype.get = function () {

newValue.container = this.parent;
if (!this.parent._isNew)
if (!this.parent._isNew) {
newValue._updateElementsContainer(this.parent.unit);
this.parent._model._qualifiedNameCache.addStructureToCache(newValue);
}
newValue._sendCreateDelta(this.parent, this.name);

@@ -388,3 +389,3 @@ }

PartListProperty.prototype.initialize = function (initialItems) {
return mobservable_1.observable(mobservable_1.asFlat(initialItems || []));
return mobservable_1.observable(mobservable_1.fastArray(initialItems || []));
};

@@ -449,4 +450,6 @@ PartListProperty.prototype.get = function () {

item.container = this.parent;
if (!this.parent._isNew)
if (!this.parent._isNew) {
item._updateElementsContainer(this.parent.unit);
this.parent._model._qualifiedNameCache.addStructureToCache(item);
}
item.unit = this.parent.unit;

@@ -551,3 +554,3 @@ item._sendCreateDelta(this.parent, this.name); // TODO: send move as well, if index is not last

this._targetType = _targetType;
this.viewList = mobservable_1.observable(mobservable_1.asFlat([]));
this.viewList = mobservable_1.fastArray([]);
this.supressViewEvents = false;

@@ -590,3 +593,3 @@ this.viewListDisposer = this.viewList.observe(function (changeData) {

throw new Error("Illegal state: can only initialize with []");
return mobservable_1.observable(mobservable_1.asFlat([]));
return mobservable_1.fastArray([]);
};

@@ -699,2 +702,3 @@ ByNameReferenceListProperty.prototype.get = function () {

* Value of a property owned by a structural unit.
* Structural child values are updated through AbstractModel._addUnitToStructuralParent
*/

@@ -711,5 +715,4 @@ var StructuralChildProperty = (function (_super) {

StructuralChildProperty.prototype.get = function () {
var _this = this;
// naive implementation, could be cached in the future
return lodash.find(this.parent.unit._model._unitsCache, function (unit) { return unit.container === _this.parent && unit._containmentName === _this.name; });
this.assertReadable();
return this.observableValue();
};

@@ -728,2 +731,3 @@ StructuralChildProperty.prototype.set = function (value) {

* Property instance that wraps a list of structural units.
* Structural child values are updated through AbstractModel._addUnitToStructuralParent
*/

@@ -737,8 +741,7 @@ var StructuralChildListProperty = (function (_super) {

// TODO: throw / ignore?
return mobservable_1.observable(mobservable_1.asFlat(value || []));
return mobservable_1.fastArray(value || []);
};
StructuralChildListProperty.prototype.get = function () {
var _this = this;
// naive implementation, could be made smarter in the future
return lodash.filter(this.parent.unit._model._unitsCache, function (unit) { return unit.container === _this.parent && unit._containmentName === _this.name; });
this.assertReadable();
return this.observableValue;
};

@@ -745,0 +748,0 @@ StructuralChildListProperty.prototype.set = function (value) {

@@ -32,4 +32,13 @@ /**

* in depth-first order, and it returns synchronously after that.
* Traverse will visit all descendants of the structure, so make sure it is loaded first.
*/
traverse(visit: (structure: IStructure) => void): void;
/**
* Traverses this structure by calling the provided visitor function
* on itself and all the structures contained (as part) by it,
* in depth-first order, and it returns synchronously after that.
* This visitor will only access the parts of the structure that are publicly visible,
* in other words, which are part of the interface of the structure.
*/
traversePublicParts(visit: (structure: IStructure) => void): void;
}

@@ -46,2 +55,3 @@ export declare class Structure implements IStructure {

_properties: properties.AbstractProperty<any, any>[];
_registeredQualifiedName: string;
/**

@@ -105,2 +115,3 @@ * These deltas where created before the create delta of this element was submitted to the server.

traverse(visit: (structure: IStructure) => void): void;
traversePublicParts(visit: (structure: IStructure) => void): void;
}

@@ -107,0 +118,0 @@ import * as elements from './elements';

@@ -17,2 +17,4 @@ var Structure = (function () {

this._properties = []; // cache, it is used very often, and doesn't change over time
// used by qualified names cache to determine old name after a rename
this._registeredQualifiedName = undefined;
/**

@@ -256,2 +258,20 @@ * These deltas where created before the create delta of this element was submitted to the server.

};
Structure.prototype.traversePublicParts = function (visit) {
visit(this);
this._properties.forEach(function (property) {
if (!property.isPublic)
return;
if (property instanceof properties.PartProperty) {
var value = property.get();
if (value)
value.traversePublicParts(visit);
}
else if (property instanceof properties.PartListProperty) {
property.get().map(function (value) {
if (value)
value.traversePublicParts(visit);
});
}
});
};
return Structure;

@@ -258,0 +278,0 @@ })();

@@ -78,4 +78,3 @@ var version_1 = require('../../version');

statusCode: response.statusCode,
url: url,
requestPayload: data ? JSON.stringify(data) : null
url: url
});

@@ -87,4 +86,3 @@ })

statusCode: response.statusCode,
url: url,
requestPayload: data ? JSON.stringify(data) : null
url: url
});

@@ -117,3 +115,4 @@ })

error: "Timeout",
description: "The Mendix Model API Server timed out."
description: "The Mendix Model API Server timed out.",
url: url
});

@@ -120,0 +119,0 @@ });

@@ -27,2 +27,7 @@ import * as internal from './internal';

function serializeToJs(unit: internal.IAbstractUnit): string;
interface IMap<T> {
[key: string]: T;
}
function removeFromArray<T>(list: T[], item: T): void;
function getOrCreateMapEntry<T>(map: IMap<T>, key: string, initializer: () => T): T;
/**

@@ -29,0 +34,0 @@ * Prints a warning, but only if it has not been printed before

@@ -56,2 +56,15 @@ var node_uuid = require('node-uuid');

utils.serializeToJs = serializeToJs;
function removeFromArray(list, item) {
var idx = list.indexOf(item);
if (idx !== -1)
list.splice(idx, 1);
}
utils.removeFromArray = removeFromArray;
function getOrCreateMapEntry(map, key, initializer) {
var res = map[key];
if (res !== undefined)
return res;
return (map[key] = initializer());
}
utils.getOrCreateMapEntry = getOrCreateMapEntry;
var alreadyPrintedWarnings = {};

@@ -58,0 +71,0 @@ /**

@@ -1,2 +0,2 @@

/** Current SDK version: 1.1.0 */
/** Current SDK version: 1.1.1 */
export declare const SDK_VERSION: string;

@@ -1,2 +0,2 @@

/** Current SDK version: 1.1.0 */
exports.SDK_VERSION = "1.1.0";
/** Current SDK version: 1.1.1 */
exports.SDK_VERSION = "1.1.1";
{
"name": "mendixmodelsdk",
"version": "1.1.0",
"version": "1.1.1",
"description": "Mendix Model SDK",

@@ -41,3 +41,3 @@ "main": "dist/index.js",

"lodash": "^3.7.0",
"mobservable": "^1.0.8",
"mobservable": "^1.2.1",
"node-uuid": "^1.4.7",

@@ -44,0 +44,0 @@ "restler": "^3.2.2"

# Release notes Mendix Model SDK
## 1.1.1
| story# | impact | description |
|---|---|---|
| 615031, 610152 | Low | Fixed issue where the SDK would have very high CPU usage and throw timeouts for a reasonable amount of requests.
| 617263 | Low | The File API calls are accessible for working-copy members now. |
| 610152 | Low | Improved parsing of model elements in the SDK for better performance. |
| 614997 | None | Fixed internal-only test meta model, used for unit tests. |
## 1.1.0

@@ -4,0 +14,0 @@

import { common } from '../../common';
import { configuration } from '../config';
import { IAbstractUnit } from './units';
import { IAbstractUnit, StructuralUnit } from './units';
import { IWorkingCopy, IDelta, IAbstractUnitJson } from './transport-interfaces';

@@ -11,2 +11,3 @@ import { ByNameReference } from './references';

import { Version } from './version-checks';
import QualifiedNameCache from "./qualified-name-cache";
/**

@@ -95,2 +96,7 @@ * This interface exposes a single Mendix Model.

/**
* Map qualifiedName -> AbstractElement[]; the same qualified name could potentially refer to different kind of objects;
* e.g. MyFirstModule.SecondThing could both be an entity or a microflow
*/
_qualifiedNameCache: QualifiedNameCache;
/**
* Map unitType -> units[], containing all units of this model, per type, but not sorted in any particular order.

@@ -150,2 +156,11 @@ * Please extend the type whenever applicable, for convenience of the programmer.

/**
* Structural units have children, (like folders have documents) but in storage the inverse is stored;
* documents specify in which parent they resided
* However, in the sdk we want to be able to read the children of a folder, so these kind of properties are expressed
* using StructuralChild(List)Property objects, see properties.ts.
* To avoid these properties to have re-evaluate on each read which children they have by visiting all the unit interfaces;
* we notify structural parents that a child was added upon loading a child structure.
*/
_addUnitToStructuralParent(unit: IAbstractUnit, parent: StructuralUnit): void;
/**
* If a reference is broken, it should be registered here, so that it can be restored once model elements are renamed.

@@ -183,11 +198,2 @@ */

_resolveName(typeName: string, qualifiedName: string): IAbstractElement;
/**
* Resolver methods for references by name
*/
protected _resolveElement(qname: string, docResolver: (qname: string) => IStructure, ...subResolvers: ISubResolver[]): any;
/**
* Finds an item in a colleciton
*/
protected _resolveInCollection<T extends IAbstractUnit>(collection: () => T[], qname: string): T;
protected _parseQname(qname: string, expectedNumberOfParts: number, target?: string): string[];
protected _warnAboutUnsupportedType(propertyName: string, qname: string): void;

@@ -194,0 +200,0 @@ findModuleByQualifiedName(qname: string): void;

@@ -1,3 +0,2 @@

var mobservable = require('mobservable');
var lodash = require('lodash');
var mobservable_1 = require('mobservable');
var deltas_1 = require('./deltas');

@@ -7,2 +6,4 @@ var instances_1 = require('./instances');

var utils_1 = require('../utils');
var properties_1 = require('./properties');
var qualified_name_cache_1 = require("./qualified-name-cache");
/**

@@ -22,2 +23,7 @@ * Abstract: this class should never be instantiated. Implementation of {@link IModel}.

/**
* Map qualifiedName -> AbstractElement[]; the same qualified name could potentially refer to different kind of objects;
* e.g. MyFirstModule.SecondThing could both be an entity or a microflow
*/
this._qualifiedNameCache = new qualified_name_cache_1.default(this);
/**
* Map unitType -> units[], containing all units of this model, per type, but not sorted in any particular order.

@@ -100,3 +106,3 @@ * Please extend the type whenever applicable, for convenience of the programmer.

if (!(typeName in this._unitsByType))
mobservable.extendObservable(this._unitsByType, (_a = {}, _a[typeName] = [], _a));
mobservable_1.extendObservable(this._unitsByType, (_a = {}, _a[typeName] = mobservable_1.fastArray(), _a));
return this._unitsByType[typeName];

@@ -163,6 +169,8 @@ var _a;

this._client.loadUnitById(this.metadata.id, id, function (data) {
unit._updateWithJson(data);
_this._resolveContainer(unit, data.containerId);
unit._resolveReferences();
unit._markLoaded();
mobservable_1.transaction(function () {
unit._updateWithJson(data);
_this._resolveContainer(unit, data.containerId);
unit._resolveReferences();
unit._markLoaded();
});
}, errorCallback || this._errorHandler);

@@ -196,13 +204,17 @@ }

var _this = this;
data.forEach(function (unitJson) {
instances_1.instancehelpers.abstractUnitJsonToInstance(_this, unitJson, true);
mobservable_1.transaction(function () {
data.forEach(function (unitJson) {
instances_1.instancehelpers.abstractUnitJsonToInstance(_this, unitJson, true);
});
// resolve all parents:
data.filter(function (unitJson) { return !!unitJson.containerId; }).forEach(function (unitJson) {
var unit = _this._unitsCache[unitJson.$ID];
_this._resolveContainer(unit, unitJson.containerId);
});
// resolve all qualified names:
Object.keys(_this._unitsCache).forEach(function (key) { return _this._qualifiedNameCache.addStructureToCache(_this._unitsCache[key]); });
// resolve all references:
Object.keys(_this._unitsCache).forEach(function (key) { return _this._unitsCache[key]._resolveReferences(); });
_this._areUnitInterfacesLoaded = true;
});
// resolve all parents:
data.filter(function (unitJson) { return !!unitJson.containerId; }).forEach(function (unitJson) {
var unit = _this._unitsCache[unitJson.$ID];
_this._resolveContainer(unit, unitJson.containerId);
});
// resolve all references:
Object.keys(this._unitsCache).forEach(function (key) { return _this._unitsCache[key]._resolveReferences(); });
this._areUnitInterfacesLoaded = true;
};

@@ -215,6 +227,29 @@ AbstractModel.prototype._resolveContainer = function (unit, containerId) {

throw new Error("Invalid container ID: " + containerId);
if (container != unit)
if (container != unit) {
unit.container = container;
// add unit to the structural parent in the project tree
this._addUnitToStructuralParent(unit, container);
}
};
/**
* Structural units have children, (like folders have documents) but in storage the inverse is stored;
* documents specify in which parent they resided
* However, in the sdk we want to be able to read the children of a folder, so these kind of properties are expressed
* using StructuralChild(List)Property objects, see properties.ts.
* To avoid these properties to have re-evaluate on each read which children they have by visiting all the unit interfaces;
* we notify structural parents that a child was added upon loading a child structure.
*/
AbstractModel.prototype._addUnitToStructuralParent = function (unit, parent) {
// In future: remove from old parent first if applicable
var prop = parent['__' + unit._containmentName];
parent._isUpdating = true;
if (prop instanceof properties_1.StructuralChildProperty)
prop.observableValue(unit);
else if (prop instanceof properties_1.StructuralChildListProperty)
prop.observableValue.push(unit);
else
throw new Error("Illegal state");
parent._isUpdating = false;
};
/**
* If a reference is broken, it should be registered here, so that it can be restored once model elements are renamed.

@@ -240,5 +275,8 @@ */

AbstractModel.prototype._processNameChange = function (element) {
for (var i = this._unresolvedReferences.length - 1; i >= 0; i--)
if (this._unresolvedReferences[i].resolve())
this._unresolvedReferences.splice(i, 1);
if (instances_1.instancehelpers.structureAffectsQualifiedNames(element)) {
this._qualifiedNameCache.processNameChange(element);
for (var i = this._unresolvedReferences.length - 1; i >= 0; i--)
if (this._unresolvedReferences[i].resolve())
this._unresolvedReferences.splice(i, 1);
}
};

@@ -281,51 +319,4 @@ AbstractModel.prototype._assertConnectionClosed = function () {

AbstractModel.prototype._resolveName = function (typeName, qualifiedName) {
if (!typeName)
throw new Error("Cannot resolve a name without a type");
if (!qualifiedName)
return null;
var parts = typeName.split("$");
if (parts.length !== 2)
throw new Error("Qualified type name does not have correct format: " + typeName);
var funcName = "find" + parts[1] + "ByQualifiedName";
if (typeof this[funcName] !== "function") {
throw new Error("Cannot resolve references of type: " + typeName);
}
return this[funcName](qualifiedName);
return this._qualifiedNameCache.resolve(typeName, qualifiedName);
};
/**
* Resolver methods for references by name
*/
AbstractModel.prototype._resolveElement = function (qname, docResolver) {
var subResolvers = [];
for (var _i = 2; _i < arguments.length; _i++) {
subResolvers[_i - 2] = arguments[_i];
}
if (!qname)
return null;
var parts = this._parseQname(qname, subResolvers.length + 2);
var parent = docResolver(parts[0] + "." + parts[1]);
var currentPart = 2;
while (!(parent === null || parent === undefined) && currentPart < parts.length) {
parent = subResolvers[currentPart - 2](parent, parts[currentPart]);
currentPart += 1;
}
return parent;
};
/**
* Finds an item in a colleciton
*/
AbstractModel.prototype._resolveInCollection = function (collection, qname) {
if (!qname)
return null;
var parts = this._parseQname(qname, 2, "resolve function " + collection['name']);
return lodash.find(collection.call(this), function (item) { return item.qualifiedName === qname; });
};
// Defensive programming, we want to discover implementation errors ASAP here..
AbstractModel.prototype._parseQname = function (qname, expectedNumberOfParts, target) {
var parts = qname.split('.');
if (parts.length !== expectedNumberOfParts) {
throw new Error("Invalid identifier '" + qname + "'" + (target ? " for " + target : "") + ": expected exactly " + expectedNumberOfParts + " parts.");
}
return parts;
};
AbstractModel.prototype._warnAboutUnsupportedType = function (propertyName, qname) {

@@ -332,0 +323,0 @@ utils_1.utils.warnOnce("Cannot resolve identifier; the type of the identifiers used by property '" + propertyName + "' is currently not supported. Please use the property '." + propertyName + "QualifiedName' instead to read or update this reference.");

@@ -53,2 +53,7 @@ import * as structures from './structures';

/**
* Return true if this is an abstractElement that might be referred to by some other element.
* If true, this element is maintained in the qualifiedNamesCache
*/
_isByNameReferrable(): boolean;
/**
* Adds a back reference, i.e. a reference pointing to us,

@@ -55,0 +60,0 @@ * which needs to be informed of changes to this element (including deletion).

@@ -78,2 +78,9 @@ var __extends = (this && this.__extends) || function (d, b) {

/**
* Return true if this is an abstractElement that might be referred to by some other element.
* If true, this element is maintained in the qualifiedNamesCache
*/
AbstractElement.prototype._isByNameReferrable = function () {
return false;
};
/**
* Adds a back reference, i.e. a reference pointing to us,

@@ -106,2 +113,4 @@ * which needs to be informed of changes to this element (including deletion).

this._backReferences = [];
// remove from qualifiedNamesCache
this._model._qualifiedNameCache.removeStructureFromCache(this);
// avoid roundtrip delete -> remove from parent -> delete etc, so enforce that an element is removed through its parent:

@@ -108,0 +117,0 @@ if (this.container) {

import { AbstractModel } from './abstract-model';
import * as versions from './version-checks';
import * as structures from './structures';
import * as units from './units';

@@ -54,2 +55,7 @@ import * as elements from './elements';

function createUnit(container: units.IStructuralUnit, constructor: units.IAbstractUnitConstructor): any;
/**
* Type -> class (constructor function) lookup, e.g. "DomainModels$Entity" -> DomainModels.Entity
*/
function lookupInitializer(qualifiedTypeName: string, classes: any): any;
function structureAffectsQualifiedNames(structure: structures.Structure): boolean;
}
var abstract_model_1 = require('./abstract-model');
var versions = require('./version-checks');
var units = require('./units');
var elements = require('./elements');
var utils_1 = require('../utils');

@@ -94,5 +95,29 @@ /**

model._cache(instance);
model._addUnitToStructuralParent(instance, container);
return instance;
}
instancehelpers.createUnit = createUnit;
/**
* Type -> class (constructor function) lookup, e.g. "DomainModels$Entity" -> DomainModels.Entity
*/
function lookupInitializer(qualifiedTypeName, classes) {
if (!qualifiedTypeName)
return nullWithError('cannot look up initializer for a falsy qualified type name');
var $index = qualifiedTypeName.indexOf('$');
if ($index < 0 || $index === qualifiedTypeName.length - 1)
return nullWithError("qualified type '" + qualifiedTypeName + "' is not of the form '<meta model>$<type name>");
var metaModelName = qualifiedTypeName.substring(0, $index).toLowerCase();
var className = qualifiedTypeName.substring($index + 1);
if (!classes[metaModelName])
return null; // As long as meta model isn't complete..
//return nullWithError(`no meta model with name '${metaModelName}' exists`);
if (!classes[metaModelName][className])
return nullWithError("no type with name '" + metaModelName + "$" + className + " exists");
return classes[metaModelName][className];
}
instancehelpers.lookupInitializer = lookupInitializer;
function structureAffectsQualifiedNames(structure) {
return structure._declaredAsNamespace || (structure instanceof elements.AbstractElement && structure._isByNameReferrable());
}
instancehelpers.structureAffectsQualifiedNames = structureAffectsQualifiedNames;
})(instancehelpers = exports.instancehelpers || (exports.instancehelpers = {}));

@@ -126,19 +151,1 @@ function checkStructureVersion(instance, includeWarnings) {

}
/**
* Type -> class (constructor function) lookup, e.g. "DomainModels$Entity" -> DomainModels.Entity
*/
function lookupInitializer(qualifiedTypeName, classes) {
if (!qualifiedTypeName)
return nullWithError('cannot look up initializer for a falsy qualified type name');
var $index = qualifiedTypeName.indexOf('$');
if ($index < 0 || $index === qualifiedTypeName.length - 1)
return nullWithError("qualified type '" + qualifiedTypeName + "' is not of the form '<meta model>$<type name>");
var metaModelName = qualifiedTypeName.substring(0, $index).toLowerCase();
var className = qualifiedTypeName.substring($index + 1);
if (!classes[metaModelName])
return null; // As long as meta model isn't complete..
//return nullWithError(`no meta model with name '${metaModelName}' exists`);
if (!classes[metaModelName][className])
return nullWithError("no type with name '" + metaModelName + "$" + className + " exists");
return classes[metaModelName][className];
}

@@ -221,2 +221,3 @@ import * as structures from './structures';

* Value of a property owned by a structural unit.
* Structural child values are updated through AbstractModel._addUnitToStructuralParent
*/

@@ -233,2 +234,3 @@ export declare class StructuralChildProperty<T> extends AbstractProperty<T, IObservableValue<T>> {

* Property instance that wraps a list of structural units.
* Structural child values are updated through AbstractModel._addUnitToStructuralParent
*/

@@ -235,0 +237,0 @@ export declare class StructuralChildListProperty<T> extends AbstractProperty<T[], IObservableArray<T>> {

@@ -6,3 +6,2 @@ var __extends = (this && this.__extends) || function (d, b) {

};
var lodash = require('lodash');
var instances = require('./instances');

@@ -196,3 +195,3 @@ var deltas = require('./deltas');

PrimitiveListProperty.prototype.initialize = function (initialItems) {
return mobservable_1.observable(mobservable_1.asFlat(initialItems || []));
return mobservable_1.observable(mobservable_1.fastArray(initialItems || []));
};

@@ -346,4 +345,6 @@ PrimitiveListProperty.prototype.get = function () {

newValue.container = this.parent;
if (!this.parent._isNew)
if (!this.parent._isNew) {
newValue._updateElementsContainer(this.parent.unit);
this.parent._model._qualifiedNameCache.addStructureToCache(newValue);
}
newValue._sendCreateDelta(this.parent, this.name);

@@ -388,3 +389,3 @@ }

PartListProperty.prototype.initialize = function (initialItems) {
return mobservable_1.observable(mobservable_1.asFlat(initialItems || []));
return mobservable_1.observable(mobservable_1.fastArray(initialItems || []));
};

@@ -449,4 +450,6 @@ PartListProperty.prototype.get = function () {

item.container = this.parent;
if (!this.parent._isNew)
if (!this.parent._isNew) {
item._updateElementsContainer(this.parent.unit);
this.parent._model._qualifiedNameCache.addStructureToCache(item);
}
item.unit = this.parent.unit;

@@ -551,3 +554,3 @@ item._sendCreateDelta(this.parent, this.name); // TODO: send move as well, if index is not last

this._targetType = _targetType;
this.viewList = mobservable_1.observable(mobservable_1.asFlat([]));
this.viewList = mobservable_1.fastArray([]);
this.supressViewEvents = false;

@@ -590,3 +593,3 @@ this.viewListDisposer = this.viewList.observe(function (changeData) {

throw new Error("Illegal state: can only initialize with []");
return mobservable_1.observable(mobservable_1.asFlat([]));
return mobservable_1.fastArray([]);
};

@@ -699,2 +702,3 @@ ByNameReferenceListProperty.prototype.get = function () {

* Value of a property owned by a structural unit.
* Structural child values are updated through AbstractModel._addUnitToStructuralParent
*/

@@ -711,5 +715,4 @@ var StructuralChildProperty = (function (_super) {

StructuralChildProperty.prototype.get = function () {
var _this = this;
// naive implementation, could be cached in the future
return lodash.find(this.parent.unit._model._unitsCache, function (unit) { return unit.container === _this.parent && unit._containmentName === _this.name; });
this.assertReadable();
return this.observableValue();
};

@@ -728,2 +731,3 @@ StructuralChildProperty.prototype.set = function (value) {

* Property instance that wraps a list of structural units.
* Structural child values are updated through AbstractModel._addUnitToStructuralParent
*/

@@ -737,8 +741,7 @@ var StructuralChildListProperty = (function (_super) {

// TODO: throw / ignore?
return mobservable_1.observable(mobservable_1.asFlat(value || []));
return mobservable_1.fastArray(value || []);
};
StructuralChildListProperty.prototype.get = function () {
var _this = this;
// naive implementation, could be made smarter in the future
return lodash.filter(this.parent.unit._model._unitsCache, function (unit) { return unit.container === _this.parent && unit._containmentName === _this.name; });
this.assertReadable();
return this.observableValue;
};

@@ -745,0 +748,0 @@ StructuralChildListProperty.prototype.set = function (value) {

@@ -32,4 +32,13 @@ /**

* in depth-first order, and it returns synchronously after that.
* Traverse will visit all descendants of the structure, so make sure it is loaded first.
*/
traverse(visit: (structure: IStructure) => void): void;
/**
* Traverses this structure by calling the provided visitor function
* on itself and all the structures contained (as part) by it,
* in depth-first order, and it returns synchronously after that.
* This visitor will only access the parts of the structure that are publicly visible,
* in other words, which are part of the interface of the structure.
*/
traversePublicParts(visit: (structure: IStructure) => void): void;
}

@@ -46,2 +55,3 @@ export declare class Structure implements IStructure {

_properties: properties.AbstractProperty<any, any>[];
_registeredQualifiedName: string;
/**

@@ -105,2 +115,3 @@ * These deltas where created before the create delta of this element was submitted to the server.

traverse(visit: (structure: IStructure) => void): void;
traversePublicParts(visit: (structure: IStructure) => void): void;
}

@@ -107,0 +118,0 @@ import * as elements from './elements';

@@ -17,2 +17,4 @@ var Structure = (function () {

this._properties = []; // cache, it is used very often, and doesn't change over time
// used by qualified names cache to determine old name after a rename
this._registeredQualifiedName = undefined;
/**

@@ -256,2 +258,20 @@ * These deltas where created before the create delta of this element was submitted to the server.

};
Structure.prototype.traversePublicParts = function (visit) {
visit(this);
this._properties.forEach(function (property) {
if (!property.isPublic)
return;
if (property instanceof properties.PartProperty) {
var value = property.get();
if (value)
value.traversePublicParts(visit);
}
else if (property instanceof properties.PartListProperty) {
property.get().map(function (value) {
if (value)
value.traversePublicParts(visit);
});
}
});
};
return Structure;

@@ -258,0 +278,0 @@ })();

@@ -78,4 +78,3 @@ var version_1 = require('../../version');

statusCode: response.statusCode,
url: url,
requestPayload: data ? JSON.stringify(data) : null
url: url
});

@@ -87,4 +86,3 @@ })

statusCode: response.statusCode,
url: url,
requestPayload: data ? JSON.stringify(data) : null
url: url
});

@@ -117,3 +115,4 @@ })

error: "Timeout",
description: "The Mendix Model API Server timed out."
description: "The Mendix Model API Server timed out.",
url: url
});

@@ -120,0 +119,0 @@ });

@@ -27,2 +27,7 @@ import * as internal from './internal';

function serializeToJs(unit: internal.IAbstractUnit): string;
interface IMap<T> {
[key: string]: T;
}
function removeFromArray<T>(list: T[], item: T): void;
function getOrCreateMapEntry<T>(map: IMap<T>, key: string, initializer: () => T): T;
/**

@@ -29,0 +34,0 @@ * Prints a warning, but only if it has not been printed before

@@ -56,2 +56,15 @@ var node_uuid = require('node-uuid');

utils.serializeToJs = serializeToJs;
function removeFromArray(list, item) {
var idx = list.indexOf(item);
if (idx !== -1)
list.splice(idx, 1);
}
utils.removeFromArray = removeFromArray;
function getOrCreateMapEntry(map, key, initializer) {
var res = map[key];
if (res !== undefined)
return res;
return (map[key] = initializer());
}
utils.getOrCreateMapEntry = getOrCreateMapEntry;
var alreadyPrintedWarnings = {};

@@ -58,0 +71,0 @@ /**

@@ -1,2 +0,2 @@

/** Current SDK version: 1.1.0 */
/** Current SDK version: 1.1.1 */
export declare const SDK_VERSION: string;

@@ -1,2 +0,2 @@

/** Current SDK version: 1.1.0 */
exports.SDK_VERSION = "1.1.0";
/** Current SDK version: 1.1.1 */
exports.SDK_VERSION = "1.1.1";

@@ -14,4 +14,2 @@ import { IAbstractModel, AbstractModel } from '../../src/sdk/internal/abstract-model';

}
export interface IByNameReferenceResolver {
}
/**

@@ -21,3 +19,3 @@ * This interface exposes a single Mendix Model.

*/
export interface IModel extends IBaseModel, IByNameReferenceResolver {
export interface IModel extends IBaseModel {
/**

@@ -24,0 +22,0 @@ * The actual contents of the model.

@@ -327,4 +327,4 @@ import * as internal from '../../src/sdk/internal';

/**
* In version 6.0.5: added public, added required
* In version 6.0.2: removed public, removed required
* In version 6.0.5: added required
* In version 6.0.2: removed required
* In version 6.0.1: added public, added required

@@ -359,4 +359,4 @@ */

/**
* In version 6.0.5: added public, added required
* In version 6.0.2: removed public, removed required
* In version 6.0.5: added required
* In version 6.0.2: removed required
* In version 6.0.1: added public, added required

@@ -509,4 +509,2 @@ */

/**
* In version 6.0.9: added public
* In version 6.0.7: removed public
* In version 6.0.6: added public

@@ -532,4 +530,2 @@ */

/**
* In version 6.0.9: added public
* In version 6.0.7: removed public
* In version 6.0.6: added public

@@ -536,0 +532,0 @@ */

@@ -599,4 +599,4 @@ var __extends = (this && this.__extends) || function (d, b) {

/**
* In version 6.0.5: added public, added required
* In version 6.0.2: removed public, removed required
* In version 6.0.5: added required
* In version 6.0.2: removed required
* In version 6.0.1: added public, added required

@@ -709,3 +709,3 @@ */

"currentValue": true,
"changedIn": ["6.0.5", "6.0.2", "6.0.1"]
"changedIn": ["6.0.1"]
}

@@ -952,4 +952,2 @@ },

/**
* In version 6.0.9: added public
* In version 6.0.7: removed public
* In version 6.0.6: added public

@@ -994,3 +992,3 @@ */

"currentValue": true,
"changedIn": ["6.0.9", "6.0.7", "6.0.6"]
"changedIn": ["6.0.6"]
}

@@ -997,0 +995,0 @@ }

@@ -261,2 +261,5 @@ /// <reference path="../test-typings.d.ts"/>

chai_1.assert.equal(crossAssoc.childQualifiedName, "Expenses.Renamed");
model.findModuleByQualifiedName("Expenses").name = "Expenses2";
chai_1.assert.equal(crossAssoc.child, newEntity);
chai_1.assert.equal(crossAssoc.childQualifiedName, "Expenses2.Renamed");
model.closeConnection(function () {

@@ -372,3 +375,13 @@ // verify the deltas created during the process:

}
}
},
{
"unitId": d.container.id,
"elementId": d.container.id,
"deltaType": "UPDATE_PROPERTY_VALUE",
"propertyName": "name",
"mutator": {
"value": "Expenses2",
"mutatorType": "CHANGE"
}
},
]);

@@ -375,0 +388,0 @@ done();

@@ -8,2 +8,3 @@ /// <reference path="../../test-typings.d.ts"/>

var detection_helper_1 = require("../../helpers/detection-helper");
var utils_1 = require('../../../src/sdk/utils');
var toV = version.Version.parse;

@@ -96,4 +97,2 @@ function createSdkClient(version) {

chai_1.assert.equal(namePropertyVersionInfo.isPublic.isEnabledIn(toV("6.0.1")), true);
chai_1.assert.equal(namePropertyVersionInfo.isPublic.isEnabledIn(toV("6.0.2")), false);
chai_1.assert.equal(namePropertyVersionInfo.isPublic.isEnabledIn(toV("6.0.3")), false);
chai_1.assert.equal(namePropertyVersionInfo.isPublic.isEnabledIn(toV("6.0.5")), true);

@@ -127,5 +126,2 @@ chai_1.assert.equal(namePropertyVersionInfo.isPublic.isEnabledIn(toV("13.0.5")), true);

checkPublicProperty(done, "6.0.6", false);
checkPublicProperty(done, "6.0.7", true);
checkPublicProperty(done, "6.0.8", true);
checkPublicProperty(done, "6.0.9", false);
done();

@@ -242,2 +238,3 @@ });

withEntity("6.0.4", done, function (entity, domainModel, model) {
utils_1.utils.resetAlreadyPrintedWarningsState();
detection_helper_1.withWarnFunc(function (warning) {

@@ -255,2 +252,3 @@ //console.log("warn1: " + message);

var isDone = false;
utils_1.utils.resetAlreadyPrintedWarningsState();
detection_helper_1.withWarnFunc(function (warning) {

@@ -271,2 +269,3 @@ //console.log("warn2: " + warning);

var warnings = [];
utils_1.utils.resetAlreadyPrintedWarningsState();
detection_helper_1.withWarnFunc(function (warning) {

@@ -273,0 +272,0 @@ warnings.push(warning);

@@ -9,2 +9,3 @@ import {utils} from '../../src/sdk/utils';

allProjects(): domainmodels_simple.IProject[];
}

@@ -26,5 +27,3 @@

}
}
export interface IByNameReferenceResolver {
}

@@ -36,3 +35,3 @@

*/
export interface IModel extends IBaseModel, IByNameReferenceResolver {
export interface IModel extends IBaseModel {

@@ -39,0 +38,0 @@ /**

@@ -300,2 +300,6 @@ /// <reference path="../test-typings.d.ts"/>

model.findModuleByQualifiedName("Expenses").name = "Expenses2";
assert.equal(crossAssoc.child, newEntity);
assert.equal(crossAssoc.childQualifiedName, "Expenses2.Renamed");
model.closeConnection(() => {

@@ -411,3 +415,13 @@ // verify the deltas created during the process:

}
}
},
{
"unitId": d.container.id,
"elementId": d.container.id,
"deltaType": "UPDATE_PROPERTY_VALUE",
"propertyName": "name",
"mutator": {
"value": "Expenses2",
"mutatorType": "CHANGE"
}
},
]);

@@ -414,0 +428,0 @@

@@ -90,6 +90,5 @@ /// <reference path="../../test-typings.d.ts"/>

it('should work for modifiers of structures', () => {
const superCoolElemVersionInfo = domainmodels_simple.SuperCoolElement.versionInfo;
assert.equal(superCoolElemVersionInfo.isPublic.latestValue, false);

@@ -102,3 +101,3 @@ assert.equal(superCoolElemVersionInfo.isPublic.isEnabledIn(toV("0.0.0")), false);

assert.equal(superCoolElemVersionInfo.isPublic.isEnabledIn(toV("13.4.4")), false);
assert.equal(superCoolElemVersionInfo.isExperimental.latestValue, false);

@@ -112,6 +111,6 @@ assert.equal(superCoolElemVersionInfo.isExperimental.isEnabledIn(toV("0.0.0")), false);

});
it('should work for modifiers of properties', () => {
const namePropertyVersionInfo = domainmodels_simple.Entity.versionInfo.properties["name"];
assert.equal(namePropertyVersionInfo.isPublic.latestValue, true);

@@ -121,4 +120,2 @@ assert.equal(namePropertyVersionInfo.isPublic.isEnabledIn(toV("1.0.0")), false);

assert.equal(namePropertyVersionInfo.isPublic.isEnabledIn(toV("6.0.1")), true);
assert.equal(namePropertyVersionInfo.isPublic.isEnabledIn(toV("6.0.2")), false);
assert.equal(namePropertyVersionInfo.isPublic.isEnabledIn(toV("6.0.3")), false);
assert.equal(namePropertyVersionInfo.isPublic.isEnabledIn(toV("6.0.5")), true);

@@ -138,3 +135,3 @@ assert.equal(namePropertyVersionInfo.isPublic.isEnabledIn(toV("13.0.5")), true);

});
function checkPublicProperty(done:common.IErrorCallback, forMxVersion:string, shouldThrow:boolean) {

@@ -145,3 +142,3 @@ withEntity(forMxVersion, done, (entity, domainModel, model) => {

}
if (shouldThrow) {

@@ -154,12 +151,9 @@ assert.throws(accessPublicProperty, "not fully loaded");

}
it('should detect publicness of properties and structures', (done) => {
checkPublicProperty(done, "6.0.5", true);
checkPublicProperty(done, "6.0.6", false);
checkPublicProperty(done, "6.0.7", true);
checkPublicProperty(done, "6.0.8", true);
checkPublicProperty(done, "6.0.9", false);
done();
});
function checkRequiredProperty(done:common.IErrorCallback, forMxVersion:string, shouldThrow:boolean) {

@@ -286,2 +280,3 @@ withEntityLoaded(forMxVersion, done, (entity, domainModel, model) => {

withEntity("6.0.4", done, (entity, domainModel, model) => {
utils.resetAlreadyPrintedWarningsState();
withWarnFunc((warning) => {

@@ -300,2 +295,3 @@ //console.log("warn1: " + message);

let isDone = false;
utils.resetAlreadyPrintedWarningsState();
withWarnFunc((warning) => {

@@ -317,2 +313,3 @@ //console.log("warn2: " + warning);

const warnings = [];
utils.resetAlreadyPrintedWarningsState();
withWarnFunc((warning) => {

@@ -319,0 +316,0 @@ warnings.push(warning);

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc