Skip to content

Commit 72fb98f

Browse files
authored
Merge pull request #9312 from platrofa/ms/MS-3808-review-sdk-docs
MS-3808 review sdk docs
2 parents d51091d + d8f2d03 commit 72fb98f

12 files changed

Lines changed: 49 additions & 59 deletions

content/en/docs/apidocs-mxsdk/mxsdk/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ description: "Presents documentation for Mendix SDKs, including Mendix Platform
66
---
77

88
{{% alert color="warning" %}}
9-
Mendix Platform SDK versions below 5.0 are deprecated. They depend on the [Projects API](/apidocs-mxsdk/apidocs/projects-api/) which will be removed early in 2024. A firm date will be communicated once a decision has been made.
9+
Mendix Platform SDK versions below 5.0 are deprecated.
1010
{{% /alert %}}
1111

1212
## Introduction

content/en/docs/apidocs-mxsdk/mxsdk/sdk-howtos/_index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ For an explanation on this topic, see [How to Manipulate Existing Models](/apido
4848
Some more explanation on manipulating existing models can be found in these documents:
4949

5050
* [How to Change Things in the Model](/apidocs-mxsdk/mxsdk/changing-things-in-the-model/)
51-
* [How to Close the Server Connection](/apidocs-mxsdk/mxsdk/closing-the-server-connection/)
5251
* [How to Find Things in the Model](/apidocs-mxsdk/mxsdk/finding-things-in-the-model/)
5352
* [How to Load Units and Elements](/apidocs-mxsdk/mxsdk/loading-units-and-elements/)
5453

content/en/docs/apidocs-mxsdk/mxsdk/sdk-howtos/creating-the-domain-model.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ customer.location = { x: 100, y: 100 };
5454
With these ingredients, you can create the two entities. Replace the snippet that creates a single entity in the script that you created in the [previous how-to steps](/apidocs-mxsdk/mxsdk/creating-your-first-script/) with the following snippet to create the two new entities:
5555

5656
```ts
57-
const domainModel = await loadDomainModel(workingCopy);
57+
const domainModel = await domainModelInterface.load();
5858
const customer = domainmodels.Entity.createIn(domainModel);
5959
customer.name = `Customer`;
6060
customer.location = { x: 100, y: 100 };
@@ -148,14 +148,16 @@ In the Model SDK, the [`Entity.generalization`](https://apidocs.rnd.mendix.com/m
148148
So, to set up entity `Customer` as a specialization of entity `Administration.Account`, you first need to look up the `Account` entity which [can be done in several ways](/apidocs-mxsdk/mxsdk/finding-things-in-the-model/). The following snippet looks up the `Account` entity in the `Administration` domain model, using the `findEntityByQualifiedName` function:
149149

150150
```ts
151-
const systemUser = workingCopy.model().findEntityByQualifiedName(`Administration.Account`);
151+
const systemUser = model.findEntityByQualifiedName(`Administration.Account`);
152152
```
153153

154154
The `domainmodels.Generalization` instance that will be used to configure the `Account` instance can now be created. The `generalization` property is set to the `System.User` entity instance that was looked up:
155155

156156
```ts
157-
const generalization = domainmodels.Generalization.createIn(customer);
158-
generalization.generalization = systemUser;
157+
if(systemUser){
158+
const generalization = domainmodels.Generalization.createIn(customer);
159+
generalization.generalization = systemUser;
160+
}
159161
```
160162

161163
Together, the creation of the `Customer` entity will look like the following code snippet. Replace the creation of the `customer` entity instance in the script with the following snippet:
@@ -166,8 +168,10 @@ customer.name = `Customer`;
166168
customer.location = { x: 100, y: 100 };
167169

168170
const generalization = domainmodels.Generalization.createIn(customer);
169-
const systemUser = workingCopy.model().findEntityByQualifiedName(`Administration.Account`);
170-
generalization.generalization = systemUser;
171+
const systemUser = model.findEntityByQualifiedName(`Administration.Account`);
172+
if (systemUser) {
173+
generalization.generalization = systemUser;
174+
}
171175
```
172176

173177
### Resources

content/en/docs/apidocs-mxsdk/mxsdk/sdk-howtos/creating-your-first-script.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ After setting up all the prerequisites, you can start writing a first script tha
4747

4848
Don't forget to [set up your personal access token](/apidocs-mxsdk/mxsdk/set-up-your-pat/) before executing the script.
4949

50+
{{% alert color="warning" %}}
51+
Working copy creation is a resource-intensive process. Consider reusing previously-created ones by invoking `app.getOnlineWorkingCopy(workingCopyId)`. All working copies are automatically deleted after 24 hours.
52+
{{% /alert %}}
53+
5054
### Code Explanation
5155

5256
Here are some explanations about the script:

content/en/docs/apidocs-mxsdk/mxsdk/sdk-howtos/manipulating-existing-models/changing-things-in-the-model.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,4 @@ All the parts of a *deleted* element are also *deleted* and cannot be accessed.
106106

107107
## Next Step
108108

109-
Continue with [How to Close the Server Connection](/apidocs-mxsdk/mxsdk/closing-the-server-connection/).
109+
Continue with [How to Find Things in the Model](/apidocs-mxsdk/mxsdk/finding-things-in-the-model/).

content/en/docs/apidocs-mxsdk/mxsdk/sdk-howtos/manipulating-existing-models/closing-the-server-connection.md

Lines changed: 0 additions & 27 deletions
This file was deleted.

content/en/docs/apidocs-mxsdk/mxsdk/sdk-howtos/manipulating-existing-models/finding-things-in-the-model.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ url: /apidocs-mxsdk/mxsdk/finding-things-in-the-model/
55

66
## Introduction
77

8-
The `model` object you get back from `workingCopy.model()` can be used to find and even manipulate units and elements. It provides three different means with which you can find units and elements.
8+
The `model` object you get back from `workingCopy.openModel()` can be used to find and even manipulate units and elements. It provides three different means with which you can find units and elements.
99

1010
## The model.root Property
1111

@@ -14,7 +14,8 @@ The `root` object refers to the `root` app node in the **App Explorer** in Studi
1414
For example, this snippet finds the name of the first attribute of the `Customer` entity in the first module of your app:
1515

1616
```js
17-
const model = workingCopy.model();
17+
const model = await workingCopy.openModel();
18+
1819
const domainModel = model.root.modules[0].domainModel;
1920
const customerEntity = domainModel.entities.filter(entity => entity.name === "Customer")[0]
2021

@@ -40,7 +41,9 @@ For all the referable concepts in a model (both units, such as a page, as well a
4041

4142
```js
4243
const customerEntity = model.findEntityByQualifiedName("Customers.Customer");
43-
const attributeName = customerEntity.attributes[0].name;
44+
if (customerEntity) {
45+
const attributeName = customerEntity.attributes[0].name;
46+
}
4447
```
4548

4649
For more information, see [How to Load Units and Elements](/apidocs-mxsdk/mxsdk/loading-units-and-elements/).
@@ -50,7 +53,7 @@ For more information, see [How to Load Units and Elements](/apidocs-mxsdk/mxsdk/
5053
Implement this snippet to fetch information on all the Marketplace modules used in your app:
5154

5255
```js
53-
const model = workingCopy.model();
56+
const model = await workingCopy.openModel();
5457
model.allModules()
5558
.filter(module => module.fromAppStore === true)
5659
.forEach(module =>

content/en/docs/apidocs-mxsdk/mxsdk/sdk-howtos/manipulating-existing-models/loading-units-and-elements.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@ Since a unit might already have been loaded before, you are also allowed to use
1414
The following (slightly) contrived example demonstrates the behavior of `load`. The type information is made explicit in this example for demonstration purposes, but you can just omit this code since the TypeScript compiler will infer it. Note that this example is contrived: a normal flow would be to call `load` on the `domainModel` and work with the fully-loaded domain model inside its callback.
1515

1616
```ts
17-
import {domainmodels} from "mendixmodelsdk";
18-
19-
const model = workingCopy.model();
17+
const model = await workingCopy.openModel();
2018

2119
// at first, only interfaces are available:
2220
const domainModel = model.allDomainModels()[0];

content/en/docs/apidocs-mxsdk/mxsdk/sdk-howtos/sdk-old-versions-howtos/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ deprecated: true
66
---
77

88
{{% alert color="warning" %}}
9-
Mendix Platform SDK versions below 5.0 are deprecated. They depend on the [Projects API](/apidocs-mxsdk/apidocs/projects-api/) which will be removed early in 2024. A firm date will be communicated once a decision has been made.
9+
Mendix Platform SDK versions below 5.0 are deprecated.
1010
{{% /alert %}}
1111

1212
The following how-tos present details for Mendix Platform SDK versions below 5.0:

content/en/docs/apidocs-mxsdk/mxsdk/sdk-howtos/setting-up-your-development-environment.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@ To set up your development tools, follow these steps:
3434

3535
```bash
3636
$ node --version
37-
v14.15.0
37+
v18.20.8
3838
```
3939

4040
For Debian-based Linux distributions such as Ubuntu, please refer to [NodeSource Node.js Binary Distributions](https://github.com/nodesource/distributions#user-content-installation-instructions) to properly set up your apt-get sources.
4141

4242
In the rest of the how-tos, in blocks such as the above, lines starting with a `$` represent commands to type into a terminal. Sometimes a line follows without a $, represents output of the command.
4343

4444
3. Install [Visual Studio Code](https://code.visualstudio.com/) (not to be confused with Visual Studio), a text editor/IDE with good support for [TypeScript](https://www.typescriptlang.org/). Make sure you have a recent version (v1.11.0+); check the version you are using through Help > About when you have Code opened.
45-
4. Install TypeScript 4.4.3 or higher with [`npm`](https://www.npmjs.com/) (or [`yarn`](https://yarnpkg.com/)), Node.js's package manager:
45+
4. Install TypeScript 4.6.2 or higher with [`npm`](https://www.npmjs.com/) (or [`yarn`](https://yarnpkg.com/)), Node.js's package manager:
4646
4747
```bash
4848
$ npm install -g typescript
@@ -52,7 +52,7 @@ To set up your development tools, follow these steps:
5252
5353
```bash
5454
$ tsc --version
55-
Version 4.4.3 (or higher)
55+
Version 4.6.2 (or higher)
5656
```
5757
5858
If the version number is much lower, it could be that you also have an outdated TypeScript SDK on your system, left over from a previous installation. You can either uninstall the old TypeScript SDK, or bypass it by removing the old TypeScript SDK from your system's PATH environment variable.

0 commit comments

Comments
 (0)