@machhub-dev/node-red-nodes 1.0.6 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -112,12 +112,14 @@ class HTTPAPIService {
112
112
  });
113
113
  }
114
114
  // Collection Example
115
- static getCollectionsExample(settings, collectionID) {
115
+ static getCollectionsExample(settings, collectionID, isSelectQuery) {
116
116
  return __awaiter(this, void 0, void 0, function* () {
117
117
  try {
118
118
  const res = yield this.service(settings).request
119
119
  .post('collections/example', undefined, {
120
- collectionID
120
+ collectionID,
121
+ // @ts-ignore: need to pass as boolean not string
122
+ isSelectQuery: isSelectQuery
121
123
  });
122
124
  return res;
123
125
  }
@@ -5,7 +5,13 @@
5
5
  defaults: {
6
6
  name: { value: "" },
7
7
  useConfigNode: { value: false }, // Toggle between JSON file and config node
8
- machhub: { value: "", type: "machhub-config" }
8
+ machhub: {
9
+ value: "",
10
+ type: "machhub-config",
11
+ validate: function(v) {
12
+ return !this.useConfigNode || (this.useConfigNode && v !== "");
13
+ }
14
+ }
9
15
  },
10
16
  paletteLabel: "Bulk Tag Write",
11
17
  inputs: 1,
@@ -5,7 +5,13 @@
5
5
  defaults: {
6
6
  name: { value: "" },
7
7
  useConfigNode: { value: false },
8
- machhub: { value: "", type: "machhub-config" },
8
+ machhub: {
9
+ value: "",
10
+ type: "machhub-config",
11
+ validate: function(v) {
12
+ return !this.useConfigNode || (this.useConfigNode && v !== "");
13
+ }
14
+ },
9
15
  collectionID: { value: "" },
10
16
  action: { value: "select" },
11
17
  selectFields: { value: [] },
@@ -205,7 +211,8 @@
205
211
  let url = "/collections/example";
206
212
 
207
213
  const requestBody = {
208
- collectionID: collectionID
214
+ collectionID,
215
+ isSelectQuery: $action.val() === "select"
209
216
  };
210
217
 
211
218
  if (useConfigNode) {
@@ -208,7 +208,7 @@ function default_1(RED) {
208
208
  // HTTP endpoint to fetch collection example for admin UI
209
209
  RED.httpAdmin.post("/collections/example", (req, res) => __awaiter(this, void 0, void 0, function* () {
210
210
  try {
211
- const { collectionID, host, httpPort, clientId, clientSecret } = req.body;
211
+ const { collectionID, isSelectQuery, host, httpPort, clientId, clientSecret } = req.body;
212
212
  let configData;
213
213
  // Check if credentials are provided (config node)
214
214
  if (clientId && clientSecret) {
@@ -229,7 +229,7 @@ function default_1(RED) {
229
229
  clientSecret: envConfig.clientSecret
230
230
  };
231
231
  }
232
- const result = yield http_api_services_1.HTTPAPIService.getCollectionsExample(configData, collectionID);
232
+ const result = yield http_api_services_1.HTTPAPIService.getCollectionsExample(configData, collectionID, isSelectQuery);
233
233
  res.json(result);
234
234
  }
235
235
  catch (e) {
@@ -5,7 +5,13 @@
5
5
  defaults: {
6
6
  name: { value: "" },
7
7
  useConfigNode: { value: false },
8
- machhub: { value: "", type: "machhub-config" },
8
+ machhub: {
9
+ value: "",
10
+ type: "machhub-config",
11
+ validate: function(v) {
12
+ return !this.useConfigNode || (this.useConfigNode && v !== "");
13
+ }
14
+ },
9
15
  query: { value: "" }
10
16
  },
11
17
  paletteLabel: "DB Query",
@@ -6,7 +6,13 @@
6
6
  name: { value: "" },
7
7
  selectedTag: { value: "", required: true },
8
8
  useConfigNode: { value: false }, // Toggle between JSON file and config node
9
- machhub: { value: "", type: "machhub-config" } // Will fill in below if empty
9
+ machhub: {
10
+ value: "",
11
+ type: "machhub-config",
12
+ validate: function(v) {
13
+ return !this.useConfigNode || (this.useConfigNode && v !== "");
14
+ }
15
+ } // Will fill in below if empty
10
16
  },
11
17
  paletteLabel: "Tag Read",
12
18
  outputs: 1,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@machhub-dev/node-red-nodes",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Node-RED API for MACHHUB EDGE",
5
5
  "scripts": {
6
6
  "build": "yarn clean && npx tsc && yarn copy-files",