UNPKG

30.5 kBMarkdownView Raw
1
2<!-- markdownlint-disable MD033 MD041 -->
3<p align="center">
4<img src="images/mindconnect-nodejs-new-logo.svg" alt="mindconnect-nodejs" width="300px"/>
5</p>
6<h1 align="center">MindConnect-NodeJS</h1>
7<p align="center">
8<a href="#getting-started">NodeJS Library for MindSphere Connectivity</a> - <a href="#mindsphere-typescript-sdk">TypeScript SDK for MindSphere</a> - <a href="#command-line-interface">MindSphere Command Line Interface</a> - <a href="#mindsphere-development-proxy">MindSphere Development Proxy</a>
9
10<!-- markdownlint-enableMD033 -->
11
12[![Build](https://github.com/mindsphere/mindconnect-nodejs/actions/workflows/build.yml/badge.svg)](https://github.com/mindsphere/mindconnect-nodejs/actions/workflows/build.yml) [![The MIT License](https://img.shields.io/badge/license-MIT-009999.svg?style=flat)](./LICENSE.md)
13[![npm](https://img.shields.io/npm/v/@mindconnect/mindconnect-nodejs/latest.svg?style=flat)](https://www.npmjs.com/package/@mindconnect/mindconnect-nodejs) ![downloads](https://img.shields.io/npm/dw/@mindconnect/mindconnect-nodejs.svg?colorB=009999)
14[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/mindsphere/mindconnect-nodejs.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/mindsphere/mindconnect-nodejs/context:javascript)
15[![Documentation](https://img.shields.io/badge/mindsphere-documentation-%23009999.svg)](https://opensource.mindsphere.io/docs/mindconnect-nodejs/index.html)
16[![SDK](https://img.shields.io/badge/SDK-full%20documentation-%23009999.svg)](https://opensource.mindsphere.io/docs/mindconnect-nodejs/sdk/index.html)
17[![Documentation](https://img.shields.io/badge/cli-full%20documentation-%23009999.svg)](https://opensource.mindsphere.io/docs/mindconnect-nodejs/cli/index.html)
18[![Forum](https://img.shields.io/badge/mindsphere-community-%23009999.svg)](https://community.plm.automation.siemens.com/t5/Developer-Space/bd-p/MindSphere-platform-forum) [![StartForFree](https://img.shields.io/badge/mindsphere-%23startForFree!-%23005578.svg)](https://siemens.mindsphere.io/en/start) [![Contributors](https://img.shields.io/badge/shoutout-thank%20you%21-%23faa50a.svg)](#community)
19
20</p>
21
22## Full documentation
23
24The full documentation can be found at [https://opensource.mindsphere.io/docs/mindconnect-nodejs/index.html](https://opensource.mindsphere.io/docs/mindconnect-nodejs/index.html)
25
26## Installing the library
27
28There are several ways to install the library. The most common one is via npm registry:
29
30```bash
31# install the latest stable library from the npm registry
32npm install @mindconnect/mindconnect-nodejs --save
33# install the latest alpha library from the npm registry
34npm install @mindconnect/mindconnect-nodejs@alpha --save
35```
36
37## Getting started
38
39[![Documentation](https://img.shields.io/badge/cli-documentation-%23009999.svg)](https://opensource.mindsphere.io/docs/mindconnect-nodejs/cli/index.html)
40
41The easiest way to start is to use the provided command line interface to create a starter project:
42
43```bash
44# for typescript nodejs project run
45npx @mindconnect/mindconnect-nodejs starter-ts
46
47# for javascript nodejs project run
48npx @mindconnect/mindconnect-nodejs starter-js
49```
50
51## How to create a nodejs MindSphere agent
52
53The following steps describe the easiest way to test the library. You can of course create the required dependencies also programmatically via API calls.
54
55### Step 0: Create an asset type and aspect types
56
57MindSphere V3 IoT model requires that you create an asset type and aspect types to describe your assets. For the example we will create an asset type of type Engine with two aspect types: Environment and Vibration. (Note that my tenant is called castidev, you will have to use your own tenant name)
58
59![assetype](images/types.png)
60
61More information about [MindSphere Data Model](https://siemens.mindsphere.io/en/docs/tutorials/asset-manager).
62
63### Step 1: Create an asset
64
65Create an asset (In example it is called **AcmeMotor**) of type Engine in AssetManager for your data.
66
67### Step 2: Create an agent of type MindConnectLib in MindSphere
68
69Create an agent in Asset Manager of type core.MindConnectLib create initial JSON token and store it to file (e.g. agentconfig.json)
70
71```json
72{
73 "content": {
74 "baseUrl": "https://southgate.eu1.mindsphere.io",
75 "iat": "<yourtokenishere>",
76 "clientCredentialProfile": [
77 "SHARED_SECRET"
78 ],
79 "clientId": "a3ac5ae889544717b02fa8282a30d1b4",
80 "tenant": "<yourtenantishere>"
81 },
82 "expiration": "2018-04-06T00:47:39.000Z"
83}
84```
85
86### Step 3 : Create an agent
87
88Read the initial configuration from the config file and create the agent.
89If you are using the **SHARED_SECRET** profile there is no need to setup the local certificate for the communication (recommended for smaller devices).
90
91```typescript
92 const configuration = require("../../agentconfig.json");
93 const agent = new MindConnectAgent(configuration);
94```
95
96 If you want to use the **RSA_3072** profile you must also set up the agent certificate.
97
98```typescript
99// you can create the private.key for example using openssl:
100// openssl genrsa -out private.key 3072
101
102agent.SetupAgentCertificate(fs.readFileSync("private.key"));
103```
104
105### Step 4: Onboard the agent
106
107The first operation is onboarding of the agent. This creates a client secret which is used for the communication with MindSphere.
108
109This data is stored by default in the .mc folder in your application if you don't change the base path in the constructor of the agent.
110
111**Important**: Make sure that your folder with the configurations is not reachable from the internet as it contains the client_secret for the authentication.
112
113```typescript
114if (!agent.IsOnBoarded()) {
115 await agent.OnBoard();
116}
117```
118
119### Step 5: Configure the data model and data mappings to asset variables. (via code)
120
121**Important**: From the version 3.8.0 it is possible to create the data source configuration and data mappings fully automatic via code
122
123First you need to create a data source configuration
124
125```typescript
126// create data source configuration for an asset type castidev.Engine
127const generatedConfig = await agent.GenerateDataSourceConfiguration(`${agent.GetTenant()}.Engine`);
128await agent.PutDataSourceConfiguration(generatedConfig);
129```
130
131and then the data mappings:
132
133```typescript
134const mappings = await agent.GenerateMappings(targetAssetId);
135await agent.PutDataMappings(mappings);
136```
137
138The agents have now access to MindSphere TypeScript SDK (in beta)
139
140```typescript
141agent.Sdk();
142// the sdk gives you access to e.g. asset management client with which you can get asset types or assets from mindsphere
143// which can be used for automatic data source configuration and automatic mappings
144
145const assetMgmt = agent.Sdk().GetAssetManagementClient();
146await assetMgmt.GetAssets(...);
147await assetMgmt.GetAspectTypes(...);
148
149```
150
151If you take a look at the MindSphere configuration of your agent now it should look like this:
152
153![datasources](images/datasources.png)
154
155And the data mappings should be in place
156
157![mappings](images/mappings.png)
158
159### Step 6 After this you can send the data in the code
160
161```typescript
162for (let index = 0; index < 5; index++) {
163
164 const values: DataPointValue[] = [
165 { "dataPointId": "DP-Temperature", "qualityCode": "0", "value": (Math.sin(index) * (20 + index % 2) + 25).toString() },
166 { "dataPointId": "DP-Pressure", "qualityCode": "0", "value": (Math.cos(index) * (20 + index % 25) + 25).toString() },
167 { "dataPointId": "DP-Humidity", "qualityCode": "0", "value": ((index + 30) % 100).toString() },
168 { "dataPointId": "DP-Acceleration", "qualityCode": "0", "value": (1000.0 + index).toString() },
169 { "dataPointId": "DP-Frequency", "qualityCode": "0", "value": (60.0 + (index * 0.1)).toString() },
170 { "dataPointId": "DP-Displacement", "qualityCode": "0", "value": (index % 10).toString() },
171 { "dataPointId": "DP-Velocity", "qualityCode": "0", "value": (50.0 + index).toString() }
172 ];
173
174 // there is an optional timestamp parameter if you need to use something else instead of Date.now()
175 const result = await agent.PostData(values);
176}
177```
178
179(If you were using UI to configure data mappings you will have long integers instead of human-readable data point Ids.)
180
181### Step 6.1 using bulk upload
182
183If you don't want to send the data points one by one, you can also use the BulkPostData method
184
185```typescript
186const bulk: TimeStampedDataPoint[] =
187 [{
188 "timestamp": "2018-08-23T18:38:02.135Z",
189 "values":
190 [{ "dataPointId": "DP-Temperature", "qualityCode": "0", "value": "10" },
191 { "dataPointId": "DP-Pressure", "qualityCode": "0", "value": "10" }]
192 },
193 {
194 "timestamp": "2018-08-23T19:38:02.135Z",
195 "values": [{ "dataPointId": "DP-Temperature", "qualityCode": "0", "value": "10" },
196 { "dataPointId": "DP-Pressure", "qualityCode": "0", "value": "10" }]
197 }];
198
199await agent.BulkPostData (bulk);
200```
201
202## Events
203
204Events can now be created with the library. You can create events for your agent or for your entities. In order to create an event for your entity you need to know the assetId of the asset.
205
206```javascript
207const configuration = require("../../agentconfig.json");
208const agent = new MindConnectAgent(configuration);
209
210if (!agent.IsOnBoarded()) {
211 await agent.OnBoard();
212}
213
214const event: MindsphereStandardEvent = {
215 "entityId": configuration.content.clientId, // use assetid if you dont want to store event in the agent :)
216 "sourceType": "Event",
217 "sourceId": "application",
218 "source": "Meowz",
219 "severity": 20, // 0-99 : 20:error, 30:warning, 40: information
220 "timestamp": new Date().toISOString(),
221 "description": "Test"
222};
223
224// send event with current timestamp
225await agent.PostEvent(event);
226```
227
228![events](images/events.png)
229
230## File Upload
231
232Files can now be uploaded via the library. You can upload files for your agent or for your entities. In order to create an event for your entity you need to know the assetid of the asset.
233
234Since version 3.5.1. the agents are using the multipart upload API of the MindSphere. This means that the agents can upload files also bigger > 8 MB, The
235multipart upload must be switched on (chunk:true) if you want to activate this behavior. The parameter parallelUploads determine the maximal number of parallel uploads. You can increase this on a powerful computer to speed up the upload or decrease to prevent network congestion.
236
237```javascript
238const configuration = require("../../agentconfig.json");
239const agent = new MindConnectAgent(configuration);
240
241if (!agent.IsOnBoarded()) {
242 await agent.OnBoard();
243}
244
245
246await agent.UploadFile(agent.ClientId(), "custom/mindsphere/path/package.json", "package.json", {
247 retry: RETRYTIMES,
248 description: "File uploaded with MindConnect-NodeJS Library",
249 parallelUploads: 5,
250 chunk: true
251});
252```
253
254![files](images/files.png)
255
256## Full Agent
257
258Here is a demo agent implementation.
259
260[![mindsphere-agent](https://img.shields.io/badge/mindsphere-agent-green.svg)](src/demoagent/test-agent.ts)
261
262## Making sure that the data arrives also with flaky internet connection
263
264You can wrap all asynchronous object calls into the retry function which will automatically retry the operation for n times before throwing an exception.
265
266```typescript
267import { MindConnectAgent, MindsphereStandardEvent, retry, TimeStampedDataPoint } from "@mindconnect/mindconnect-nodejs";
268
269// if you want to be more resillient you can wrap every async method
270// in the retry function which will try to retry several times before throwing an exception
271
272// onboarding over flaky connection
273await retry (5, ()=>agent.OnBoard())
274
275// bulk upload with 5 retries
276const bulk: TimeStampedDataPoint[] =
277[{
278 "timestamp": "2018-08-23T18:38:02.135Z",
279 "values":
280 [{ "dataPointId": "DP-Temperature", "qualityCode": "0", "value": "10" },
281 { "dataPointId": "DP-Pressure", "qualityCode": "0", "value": "10" }]
282},
283{
284 "timestamp": "2018-08-23T19:38:02.135Z",
285 "values": [{ "dataPointId": "DP-Temperature", "qualityCode": "0", "value": "10" },
286 { "dataPointId": "DP-Pressure", "qualityCode": "0", "value": "10" }]
287}];
288
289await retry(5, () => agent.BulkPostData(bulk));
290
291```
292
293The data in the MindSphere can be observed in the fleet manager.
294
295## Proxy support
296
297Set the http_proxy or HTTP_PROXY environment variable if you need to connect via proxy.
298
299```bash
300# set http proxy environment variable if you are using e.g. fiddler on the localhost.
301
302export HTTP_PROXY=http://localhost:8888
303```
304
305## MindSphere TypeScript SDK
306
307The library comes with the typescript SDK which can be used to access MindSphere APIs
308
309[![SDK](https://img.shields.io/badge/SDK-full%20documentation-%23009999.svg)](https://opensource.mindsphere.io/docs/mindconnect-nodejs/sdk/index.html)
310
311It implements support for both frontend (browser e.g. angular, react...) and backend development in node.js. and different MindSphere authentication types:
312
313**Frontend:**
314 - Browser (Session, Cookies)
315
316**Backend (node.js):**
317 - UserCredentials
318 - AppCredentials
319 - ServiceCredentials
320 - MindSphere Agents
321
322### Platform Core APIs
323
324| Name |SDK - Client | Command |
325| --- | --- | --- |
326| Identity Management | :heavy_check_mark: | :heavy_check_mark: |
327| Oauth Authorization | :heavy_check_mark: | :heavy_check_mark: |
328| Tenant Management | :heavy_check_mark: | :heavy_check_mark: |
329| Token Management | :heavy_check_mark: | :heavy_check_mark: |
330| Message Broker* (preview) | :heavy_check_mark: | :heavy_check_mark: |
331| Usage Transparency | :heavy_check_mark: | |
332
333*) Message Broker is only available on preview tenants
334
335### IoT and Storage
336
337| Name |SDK - Client | Command |
338| --- | --- | --- |
339| IoT File | :heavy_check_mark: | :heavy_check_mark: |
340| IoT Time Series | :heavy_check_mark: | :heavy_check_mark: |
341| IoT TS Aggregates (v3, v4) | :heavy_check_mark: | :heavy_check_mark: |
342| IoT TS Bulk | :heavy_check_mark: | :heavy_check_mark: |
343| Integrated Data Lake | :heavy_check_mark: | :heavy_check_mark: |
344
345### Connectivity
346
347| Name |SDK - Client | Command |
348| --- | --- | --- |
349| Agent Management | :heavy_check_mark: | :heavy_check_mark: |
350| MindConnect API | :heavy_check_mark: | :heavy_check_mark: |
351| OPC UA PubSub | | :heavy_check_mark: |
352
353### Advanced Services
354
355| Name |SDK - Client | Command |
356| --- | --- | --- |
357| Asset Management | :heavy_check_mark: | :heavy_check_mark: |
358| Event Management | :heavy_check_mark: | :heavy_check_mark: |
359| Notification | :heavy_check_mark: | :heavy_check_mark: |
360
361### Analytics Services
362
363| Name |SDK - Client | Command |
364| --- | --- | --- |
365| Anomaly Detection | :heavy_check_mark: | :heavy_check_mark: |
366| Data Exchange | :heavy_check_mark: | :heavy_check_mark: |
367| Event Analytics | :heavy_check_mark: | :heavy_check_mark: |
368| Job Manager | :heavy_check_mark: | :heavy_check_mark: |
369| KPI Calculation | :heavy_check_mark: | :heavy_check_mark: |
370| Model Management | :heavy_check_mark: | :heavy_check_mark: |
371| Signal Calculation | :heavy_check_mark: | :heavy_check_mark: |
372| Signal Validation | :heavy_check_mark: | :heavy_check_mark: |
373| Spectrum Analysis | :heavy_check_mark: | :heavy_check_mark: |
374| Trend Prediction | :heavy_check_mark: | :heavy_check_mark: |
375
376### MindConnect Open Edge
377
378| Name |SDK - Client | Command |
379| --- | --- | --- |
380| Device Management | :heavy_check_mark: | :heavy_check_mark: |
381| Device Status | :heavy_check_mark: | :heavy_check_mark: |
382| Deployment Workflow | :heavy_check_mark: | :heavy_check_mark: |
383| Device Configuration | :heavy_check_mark: | :heavy_check_mark: |
384| Edge App Deployment | :heavy_check_mark: | :heavy_check_mark: |
385| Edge App Instance Management | :heavy_check_mark: | :heavy_check_mark: |
386| Firmware Deployment | :heavy_check_mark: | :heavy_check_mark: |
387
388### Semantic Data Interconnect
389
390| Name |SDK - Client | Command |
391| --- | --- | --- |
392| SDI Data Management | :heavy_check_mark: | :heavy_check_mark: |
393| SDI Data Query | :heavy_check_mark: | :heavy_check_mark: |
394| SDI Semantic Modelling | :heavy_check_mark: | :heavy_check_mark: |
395
396### Example
397
398The example below shows how to use the sdk.
399
400``` typescript
401// The example shows how to Get Assets from MindSphere with custom AssetType using frontend authentication
402// you can pass an instance an Authorizer (BrowserAuth, UserAuth, CredentialsAuth, TokenManagerAuth, MindConnectAgent)
403// to use different authorization types in MindSphere or implement the TokenRotation interface if you want to
404// provide your own authorizer.
405//
406// The default constructor uses frontend authorization.
407
408const sdk = new MindSphereSdk ();
409const am = sdk.GetAssetManagementClient();
410
411const assets = await am.GetAssets({
412 filter: JSON.stringify({
413 typeId: {
414 startsWith: `${tenant}`,
415 },
416 }),
417 });
418
419// you will get fully typed assets in response
420```
421
422If an API is missing and you would like to contribute a Client for it take a look at [CONTRIBUTING.md](./CONTRIBUTING.md).
423
424## Command Line Interface
425
426The full documentation for the command line interface can be found at
427
428[![Documentation](https://img.shields.io/badge/cli-full%20documentation-%23009999.svg)](https://opensource.mindsphere.io/docs/mindconnect-nodejs/cli/index.html)
429
430The library comes with a command line interface which can also be installed globally. You can use the command line mode to upload timeseries, files and create events in the MindSphere.
431
432```bash
433# install the library globaly if you want to use its command line interface.
434 npm install -g @mindconnect/mindconnect-nodejs
435```
436
437### Binary Releases
438
439The library can also be downloaded as executable from the [GitHub release page](https://github.com/mindsphere/mindconnect-nodejs/releases).
440
441Download the version for your system and place it in folder which is in your PATH.
442
443- `mc.exe` for windows
444- `mc-macos` for macOS
445- `mc-linux` for Linux
446
447Linux, macOS: Rename the file to `mc` and make sure that the file is marked as executable (`chmod +x`).
448
449### Configuring CLI
450
451First step is to configure the CLI. For this you will need a session cookie from MindSphere, service credentials (which have been deprecated) or application credentials from your developer cockpit.
452
453- [SESSION and XSRF-TOKEN cookie](https://developer.mindsphere.io/howto/howto-local-development.html#generate-user-credentials)
454- [Application Credentials](https://documentation.mindsphere.io/resources/html/developer-cockpit/en-US/124342231819.html)
455- [Service Credentials](https://developer.mindsphere.io/howto/howto-selfhosted-api-access.html#creating-service-credentials)
456
457First start the credentials configuration. This will start a web server on your local computer where you can enter the credentials.
458
459```bash
460# run mc service-credentials --help for full information
461
462$ mc service-credentials
463navigate to http://localhost:4994 to configure the CLI
464press CTRL + C to exit
465
466```
467
468Navigate to [http://localhost:4994](http://localhost:4994) to configure the CLI. (see [full documentation](https://opensource.mindsphere.io/docs/mindconnect-nodejs/cli/index.html) for XSRF-TOKEN and SESSION)
469
470The image below shows the dialog for adding new credentials (press on the + sign in the upper left corner)
471
472![CLI](images/servicecredentials.png)
473
474You can get the application credentials from your developer or operator cockpit in MindSphere. (if you don't have any application you can register a dummy one just for CLI)
475
476![CLI](images/cockpit.png)
477
478Once configured you can press CTRL + C to stop the configuration server and start using the CLI. Remember the passkey you have created as you will be using it with almost all CLI commands.
479
480### Using CLI
481
482The CLI can be used to create starter projects, upload timeseries, events and files, read agent diagnostics etc.
483The CLI commands should only be used **in secure environments!** (e.g on your working station, not on the agents).
484
485Here is an overview of CLI commands:
486
487```bash
488# run mc --help to get a full list of the commands
489mc --help
490```
491
492```text
493Usage: mc [options] [command]
494
495Options:
496 -V, --version output the version number
497 -h, --help display help for command
498
499Commands:
500 onboard|ob [options] onboard the agent with configuration stored in the config file
501 configure-agent|co [options] create data source configuration and mappings (optional: passkey) *
502 agent-token|atk [options] displays the agent token for use in other tools (e.g. postman)
503 upload-timeseries|ts [options] parse .csv file with timeseriesdata and upload the timeseries data to mindsphere
504 upload-file|uf [options] upload the file to the mindsphere file service (optional: passkey) *
505 create-event|ce [options] create an event in the mindsphere (optional: passkey) *
506 agent-status|as [options] displays the agent status and agent onboarding status *
507 create-agent|ca [options] create an agent in the mindsphere *
508 offboard-agent|of [options] offboards the agent in the mindsphere *
509 renew-agent|rn [options] renews the agent secrets *
510 service-credentials|sc [options] provide login for commands which require technical user credentials *
511 service-token|stk [options] displays the service token for use in other tools (e.g. postman) *
512 register-diagnostic|rd [options] register agent for diagnostic *
513 get-diagnostic|gd [options] get diagnostic information *
514 unregister-diagnostic|ud [options] unregister agent from diagnostic *
515 prepare-bulk|pb [options] creates a template directory for timeseries (bulk) upload *
516 run-bulk|rb [options] runs the timeseries (bulk) upload job from <directoryname> directory *
517 check-bulk|cb [options] checks the progress of the upload jobs from <directoryname> directory *
518 download-bulk|db [options] download the timeseries data in bulk from mindsphere *
519 asset-lock|lck [options] lock/unlock asset model modifications *
520 asset-info|ai [options] get infos about asset *
521 assets|ast [options] list, create or delete assets *
522 asset-types|at [options] list, create or delete asset types *
523 aspects|as [options] list, create or delete aspects *
524 event-types|et [options] list, create or delete event types *
525 events|ev [options] list, create or delete events *
526 events-bulk|dn [options] download or delete the events in bulk *
527 aggregates|ag [options] list timeseries aggregates *
528 notifications|nt [options] send email, sms and push notifications *
529 oe-device-types|oedt [options] list, create or delete device types (open edge) *
530 oe-devices|oed [options] list, create or delete (open edge) devices *
531 oe-device-status|oeds [options] list, get, or update (open edge) device status information *
532 oe-app-inst|oeai [options] list, create, configure or delete app instance (open edge) *
533 oe-app-deploy|oead [options] list, create, update app installation task(s) (open edge) *
534 oe-deploy-workflow|oedw [options] list, create/instantiate, update or delete/cancel workflow deployment model or instance(s) (open edge) *
535 oe-firm-deploy|oefd [options] list, create, update firmware deployment task(s) (open edge) *
536 tenant|ti [options] create or delete tenant legal configuration and logo *
537 subtenants|st [options] list, create or delete subtenants *
538 list-assets|la [options] list assets in the tenant *
539 delete-asset|da [options] delete asset with id <assetid> from mindsphere *
540 list-files|ls [options] list files stored with the asset *
541 download-file|df [options] download the file from mindsphere file service *
542 delete-file|de [options] delete the file from mindsphere file service *
543 identity-management|iam [options] manage mindsphere users and groups *
544 data-lake|dlk [options] manage data lake, data lake access permissions and STS tokens *
545 sdi-data-lakes|sdl [options] manage data lakes for SDI *
546 sdi-data-registries|sdr [options] manage data registries for SDI *
547 sdi-iot-registries|sdt [options] manage iot data registries for SDI *
548 sdi-data-types|sdy [options] manage data types for SDI *
549 sdi-file-upload|sdu [options] upload file to SDI *
550 sdi-ingest-jobs|sdj [options] manage ingest jobs for SDI *
551 sdi-search-schemas|sds [options] search SDI schemas *
552 sdi-data-queries|sdq [options] manage data queries for SDI *
553 sdi-execution-jobs|sdx [options] manage data execution jobs for SDI *
554 sdi-ontologies|sdo [options] manage ontologies for SDI *
555 sdi-ontology-jobs|sdb [options] manage ontology jobs for SDI *
556 mobile-apps|mb [options] list, create or delete mobile apps *
557 mobile-app-instances|mbi [options] list, create or delete mobile app instances *
558 spectrum-analysis|sp [options] perform spectrum analysis on a sound file @
559 signal-validation|sv [options] perform signal validation @
560 signal-calculation|cal [options] process timeseries data *
561 trend-prediction|tp [options] perform trend prediction (linear/polynomial) @
562 kpi-calculation|kp [options] calculate kpi states or compute kpis @
563 event-analytics|ea [options] analyze mindsphere events @
564 models|ml [options] list, create or delete analytic models *
565 jobs|jb [options] list, create or stop jobs *
566 schedules|js [options] list, create, start, stop or delete job schedules *
567 data-exchange|dx [options] list, upload, download and manage data exchange files and directories *
568 anomaly-detection|ad [options] train anomaly detection models and detect timeseries anomalies *
569 dev-proxy|px [options] starts mindsphere development proxy & (optional passkey) *
570 mqtt-createjwt|jw [options] creates a signed token for opcua pub sub authentication #
571 starter-ts|st [options] creates a starter project in typescript #
572 starter-js|sj [options] creates a starter project in javascript #
573 help [command] display help for command
574
575 Documentation:
576
577 the magenta colored commands * use app or service credentials or borrowed mindsphere cookies
578 the cyan colored commands require mindconnectlib (agent) credentials
579 the blue colored commands @ use analytical functions of MindSphere
580 the green colored commands # are used as setup and utility commands
581 the yellow colored commands & use borrowed mindsphere application cookies
582 the credentials and cookies should only be used in secure environments
583 Full documentation: https://opensource.mindsphere.io
584```
585
586## MindSphere Development Proxy
587
588The CLI comes with a development proxy which can be used to kickstart your MindSphere development. It provides an endpoint
589at your local machine at
590
591[http://localhost:7707](http://localhost:7707)
592
593which will authenticate all requests using either [a borrowed SESSION and XSRF-TOKEN cookie from MindSphere](https://developer.mindsphere.io/howto/howto-local-development.html#generate-user-credentials) or the the configured app credentials or service credentials.
594
595The command below will start your development proxy without any installation and configuration (you just need the cookies from an existing app):
596
597```bash
598npx @mindconnect/mindconnect-nodejs dev-proxy --session <SESSION-TOKEN> --xsrftoken <XSRF-TOKEN> --host <appname>.<tenant>.<region>.mindsphere.io
599```
600
601For more complex tasks install and configure the CLI
602
603```text
604Usage: mc dev-proxy|px [options]
605
606starts mindsphere development proxy (optional passkey) *
607
608Options:
609 -m, --mode [credentials|session] service/app credentials authentication of
610 session authentication (default: "session")
611 -o, --port <port> port for web server (default: "7707")
612 -r, --norewrite don't rewrite hal+json urls
613 -w, --nowarn don't warn for missing headers
614 -d, --dontkeepalive don't keep the session alive
615 -v, --verbose verbose output
616 -s, --session <session> borrowed SESSION cookie from brower
617 -x, --xsrftoken <xsrftoken> borrowed XSRF-TOKEN cookie from browser
618 -h, --host <host> the address where SESSION and XSRF-TOKEN
619 have been borrowed from
620 -t, --timeout <timeout> keep alive timeout in seconds (default:
621 "60")
622 -k, --passkey <passkey> passkey
623 --help display help for command
624
625 Examples:
626
627 mc dev-proxy runs on default port (7707) using cookies
628 mc dev-proxy --port 7777 --passkey passkey runs on port 7777 using app/service credentials
629
630 Configuration:
631
632 - create environment variables: MDSP_HOST, MDSP_SESSION and MDSP_XSRF_TOKEN using borrowed cookies
633
634 see more documentation at https://opensource.mindsphere.io/docs/mindconnect-nodejs/development-proxy.html
635
636````
637
638## Community
639
640[![Stargazers repo roster for @mindsphere/mindconnect-nodejs](https://reporoster.com/stars/mindsphere/mindconnect-nodejs)](https://github.com/mindsphere/mindconnect-nodejs/stargazers)
641
642[![Forkers repo roster for @mindsphere/mindconnect-nodejs](https://reporoster.com/forks/mindsphere/mindconnect-nodejs)](https://github.com/mindsphere/mindconnect-nodejs/network/members)
643
644## Legal
645
646This project has been released under an [Open Source license](./LICENSE.md). The release may include and/or use APIs to Siemens’ or third parties’ products or services. In no event shall the project’s Open Source license grant any rights in or to these APIs, products or services that would alter, expand, be inconsistent with, or supersede any terms of separate license agreements applicable to those APIs. “API” means application programming interfaces and their specifications and implementing code that allows other software to communicate with or call on Siemens’ or third parties’ products or services and may be made available through Siemens’ or third parties’ products, documentations or otherwise.
647
\No newline at end of file