node-opcua-file-transfer 2.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mocharc.yml +11 -0
- package/LICENSE +20 -0
- package/dist/client/client_file.d.ts +68 -0
- package/dist/client/client_file.js +310 -0
- package/dist/client/client_file.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/open_mode.d.ts +39 -0
- package/dist/open_mode.js +45 -0
- package/dist/open_mode.js.map +1 -0
- package/dist/server/file_type_helpers.d.ts +68 -0
- package/dist/server/file_type_helpers.js +493 -0
- package/dist/server/file_type_helpers.js.map +1 -0
- package/package.json +58 -0
- package/readme.md +204 -0
- package/source/client/client_file.ts +322 -0
- package/source/index.ts +5 -0
- package/source/open_mode.ts +41 -0
- package/source/server/file_type_helpers.ts +643 -0
package/.mocharc.yml
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-2021 Etienne Rossignon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* @module node-opcua-file-transfer
|
|
4
|
+
*/
|
|
5
|
+
import { Int32, UInt16, UInt32, UInt64 } from "node-opcua-basic-types";
|
|
6
|
+
import { NodeId } from "node-opcua-nodeid";
|
|
7
|
+
import { IBasicSession } from "node-opcua-pseudo-session";
|
|
8
|
+
import { OpenFileMode } from "../open_mode";
|
|
9
|
+
export { OpenFileMode } from "../open_mode";
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
export declare class ClientFile {
|
|
15
|
+
static useGlobalMethod: boolean;
|
|
16
|
+
fileHandle: number;
|
|
17
|
+
protected session: IBasicSession;
|
|
18
|
+
protected readonly fileNodeId: NodeId;
|
|
19
|
+
private openMethodNodeId?;
|
|
20
|
+
private closeMethodNodeId?;
|
|
21
|
+
private setPositionNodeId?;
|
|
22
|
+
private getPositionNodeId?;
|
|
23
|
+
private readNodeId?;
|
|
24
|
+
private writeNodeId?;
|
|
25
|
+
private openCountNodeId?;
|
|
26
|
+
private sizeNodeId?;
|
|
27
|
+
constructor(session: IBasicSession, nodeId: NodeId);
|
|
28
|
+
open(mode: OpenFileMode): Promise<number>;
|
|
29
|
+
close(): Promise<void>;
|
|
30
|
+
getPosition(): Promise<UInt64>;
|
|
31
|
+
setPosition(position: UInt64 | UInt32): Promise<void>;
|
|
32
|
+
read(bytesToRead: Int32): Promise<Buffer>;
|
|
33
|
+
write(data: Buffer): Promise<void>;
|
|
34
|
+
openCount(): Promise<UInt16>;
|
|
35
|
+
size(): Promise<UInt64>;
|
|
36
|
+
protected extractMethodsIds(): Promise<void>;
|
|
37
|
+
protected ensureInitialized(): Promise<void>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* 5.2.10 UserRolePermissions
|
|
41
|
+
*
|
|
42
|
+
* The optional UserRolePermissions Attribute specifies the Permissions that apply to a Node for
|
|
43
|
+
* all Roles granted to current Session. The value of the Attribute is an array of
|
|
44
|
+
* RolePermissionType Structures (see Table 8).
|
|
45
|
+
* Clients may determine their effective Permissions by logically ORing the Permissions for each
|
|
46
|
+
* Role in the array.
|
|
47
|
+
* The value of this Attribute is derived from the rules used by the Server to map Sessions to
|
|
48
|
+
* Roles. This mapping may be vendor specific or it may use the standard Role model defined in 4.8.
|
|
49
|
+
* This Attribute shall not be writeable.
|
|
50
|
+
* If not specified, the value of DefaultUserRolePermissions Property from the Namespace
|
|
51
|
+
* Metadata Object associated with the Node is used instead. If the NamespaceMetadata Object
|
|
52
|
+
* does not define the Property or does not exist, then the Server does not publish any information
|
|
53
|
+
* about Roles mapped to the current Session.
|
|
54
|
+
*
|
|
55
|
+
*
|
|
56
|
+
* 5.2.11 AccessRestrictions
|
|
57
|
+
* The optional AccessRestrictions Attribute specifies the AccessRestrictions that apply to a Node.
|
|
58
|
+
* Its data type is defined in 8.56. If a Server supports AccessRestrictions for a particular
|
|
59
|
+
* Namespace it adds the DefaultAccessRestrictions Property to the NamespaceMetadata Object
|
|
60
|
+
* for that Namespace (see Figure 8). If a particular Node in the Namespace needs to override
|
|
61
|
+
* the default value the Server adds the AccessRestrictions Attribute to the Node.
|
|
62
|
+
* If a Server implements a vendor specific access restriction model for a Namespace, it does not
|
|
63
|
+
* add the DefaultAccessRestrictions Property to the NamespaceMetadata Object.
|
|
64
|
+
*
|
|
65
|
+
*
|
|
66
|
+
* DefaultAccessRestrictions
|
|
67
|
+
*
|
|
68
|
+
*/
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ClientFile = exports.OpenFileMode = void 0;
|
|
13
|
+
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
14
|
+
const node_opcua_nodeid_1 = require("node-opcua-nodeid");
|
|
15
|
+
const node_opcua_service_translate_browse_path_1 = require("node-opcua-service-translate-browse-path");
|
|
16
|
+
const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
17
|
+
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
18
|
+
const node_opcua_constants_1 = require("node-opcua-constants");
|
|
19
|
+
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
20
|
+
const debugLog = (0, node_opcua_debug_1.make_debugLog)("FileType");
|
|
21
|
+
const errorLog = (0, node_opcua_debug_1.make_errorLog)("FileType");
|
|
22
|
+
const doDebug = (0, node_opcua_debug_1.checkDebugFlag)("FileType");
|
|
23
|
+
const open_mode_1 = require("../open_mode");
|
|
24
|
+
var open_mode_2 = require("../open_mode");
|
|
25
|
+
Object.defineProperty(exports, "OpenFileMode", { enumerable: true, get: function () { return open_mode_2.OpenFileMode; } });
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
*
|
|
29
|
+
*/
|
|
30
|
+
class ClientFile {
|
|
31
|
+
constructor(session, nodeId) {
|
|
32
|
+
this.fileHandle = 0;
|
|
33
|
+
this.session = session;
|
|
34
|
+
this.fileNodeId = nodeId;
|
|
35
|
+
}
|
|
36
|
+
open(mode) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
if (mode === null || mode === undefined) {
|
|
39
|
+
throw new Error("expecting a validMode " + open_mode_1.OpenFileMode[mode]);
|
|
40
|
+
}
|
|
41
|
+
if (this.fileHandle) {
|
|
42
|
+
throw new Error("File has already be opened");
|
|
43
|
+
}
|
|
44
|
+
yield this.ensureInitialized();
|
|
45
|
+
const result = yield this.session.call({
|
|
46
|
+
inputArguments: [
|
|
47
|
+
{ dataType: node_opcua_variant_1.DataType.Byte, value: mode }
|
|
48
|
+
],
|
|
49
|
+
methodId: this.openMethodNodeId,
|
|
50
|
+
objectId: this.fileNodeId
|
|
51
|
+
});
|
|
52
|
+
if (result.statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
53
|
+
debugLog("Cannot open file : ");
|
|
54
|
+
throw new Error("cannot open file statusCode = " + result.statusCode.toString() + " mode = " + open_mode_1.OpenFileMode[mode]);
|
|
55
|
+
}
|
|
56
|
+
this.fileHandle = result.outputArguments[0].value;
|
|
57
|
+
return this.fileHandle;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
close() {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
if (!this.fileHandle) {
|
|
63
|
+
throw new Error("File has not been opened yet");
|
|
64
|
+
}
|
|
65
|
+
yield this.ensureInitialized();
|
|
66
|
+
const result = yield this.session.call({
|
|
67
|
+
inputArguments: [
|
|
68
|
+
{ dataType: node_opcua_variant_1.DataType.UInt32, value: this.fileHandle }
|
|
69
|
+
],
|
|
70
|
+
methodId: this.closeMethodNodeId,
|
|
71
|
+
objectId: this.fileNodeId
|
|
72
|
+
});
|
|
73
|
+
if (result.statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
74
|
+
debugLog("Cannot close file : ");
|
|
75
|
+
throw new Error("cannot close file statusCode = " + result.statusCode.toString());
|
|
76
|
+
}
|
|
77
|
+
this.fileHandle = 0;
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
getPosition() {
|
|
81
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
yield this.ensureInitialized();
|
|
83
|
+
if (!this.fileHandle) {
|
|
84
|
+
throw new Error("File has not been opened yet");
|
|
85
|
+
}
|
|
86
|
+
const result = yield this.session.call({
|
|
87
|
+
inputArguments: [
|
|
88
|
+
{ dataType: node_opcua_variant_1.DataType.UInt32, value: this.fileHandle }
|
|
89
|
+
],
|
|
90
|
+
methodId: this.getPositionNodeId,
|
|
91
|
+
objectId: this.fileNodeId
|
|
92
|
+
});
|
|
93
|
+
if (result.statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
94
|
+
throw new Error("Error " + result.statusCode.toString());
|
|
95
|
+
}
|
|
96
|
+
return result.outputArguments[0].value;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
setPosition(position) {
|
|
100
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
+
yield this.ensureInitialized();
|
|
102
|
+
if (!this.fileHandle) {
|
|
103
|
+
throw new Error("File has not been opened yet");
|
|
104
|
+
}
|
|
105
|
+
if (typeof position === "number") {
|
|
106
|
+
position = [0, position];
|
|
107
|
+
}
|
|
108
|
+
const result = yield this.session.call({
|
|
109
|
+
inputArguments: [
|
|
110
|
+
{ dataType: node_opcua_variant_1.DataType.UInt32, value: this.fileHandle },
|
|
111
|
+
{
|
|
112
|
+
arrayType: node_opcua_variant_1.VariantArrayType.Scalar,
|
|
113
|
+
dataType: node_opcua_variant_1.DataType.UInt64,
|
|
114
|
+
value: position
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
methodId: this.setPositionNodeId,
|
|
118
|
+
objectId: this.fileNodeId
|
|
119
|
+
});
|
|
120
|
+
if (result.statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
121
|
+
throw new Error("Error " + result.statusCode.toString());
|
|
122
|
+
}
|
|
123
|
+
return;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
read(bytesToRead) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
yield this.ensureInitialized();
|
|
129
|
+
if (!this.fileHandle) {
|
|
130
|
+
throw new Error("File has not been opened yet");
|
|
131
|
+
}
|
|
132
|
+
const result = yield this.session.call({
|
|
133
|
+
inputArguments: [
|
|
134
|
+
{ dataType: node_opcua_variant_1.DataType.UInt32, value: this.fileHandle },
|
|
135
|
+
{
|
|
136
|
+
arrayType: node_opcua_variant_1.VariantArrayType.Scalar,
|
|
137
|
+
dataType: node_opcua_variant_1.DataType.Int32,
|
|
138
|
+
value: bytesToRead
|
|
139
|
+
}
|
|
140
|
+
],
|
|
141
|
+
methodId: this.readNodeId,
|
|
142
|
+
objectId: this.fileNodeId
|
|
143
|
+
});
|
|
144
|
+
if (result.statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
145
|
+
throw new Error("Error " + result.statusCode.toString());
|
|
146
|
+
}
|
|
147
|
+
if (!result.outputArguments || result.outputArguments[0].dataType !== node_opcua_variant_1.DataType.ByteString) {
|
|
148
|
+
throw new Error("Error invalid output");
|
|
149
|
+
}
|
|
150
|
+
return result.outputArguments[0].value;
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
write(data) {
|
|
154
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
+
yield this.ensureInitialized();
|
|
156
|
+
if (!this.fileHandle) {
|
|
157
|
+
throw new Error("File has not been opened yet");
|
|
158
|
+
}
|
|
159
|
+
const result = yield this.session.call({
|
|
160
|
+
inputArguments: [
|
|
161
|
+
{ dataType: node_opcua_variant_1.DataType.UInt32, value: this.fileHandle },
|
|
162
|
+
{
|
|
163
|
+
arrayType: node_opcua_variant_1.VariantArrayType.Scalar,
|
|
164
|
+
dataType: node_opcua_variant_1.DataType.ByteString,
|
|
165
|
+
value: data
|
|
166
|
+
}
|
|
167
|
+
],
|
|
168
|
+
methodId: this.writeNodeId,
|
|
169
|
+
objectId: this.fileNodeId
|
|
170
|
+
});
|
|
171
|
+
if (result.statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
172
|
+
throw new Error("Error " + result.statusCode.toString());
|
|
173
|
+
}
|
|
174
|
+
return;
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
openCount() {
|
|
178
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
179
|
+
yield this.ensureInitialized();
|
|
180
|
+
const nodeToRead = { nodeId: this.openCountNodeId, attributeId: node_opcua_data_model_1.AttributeIds.Value };
|
|
181
|
+
const dataValue = yield this.session.read(nodeToRead);
|
|
182
|
+
if (doDebug) {
|
|
183
|
+
debugLog(" OpenCount ", nodeToRead.nodeId.toString(), dataValue.toString());
|
|
184
|
+
}
|
|
185
|
+
return dataValue.value.value;
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
size() {
|
|
189
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
190
|
+
yield this.ensureInitialized();
|
|
191
|
+
const nodeToRead = { nodeId: this.sizeNodeId, attributeId: node_opcua_data_model_1.AttributeIds.Value };
|
|
192
|
+
const dataValue = yield this.session.read(nodeToRead);
|
|
193
|
+
return dataValue.value.value;
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
// eslint-disable-next-line max-statements
|
|
197
|
+
extractMethodsIds() {
|
|
198
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
199
|
+
if (ClientFile.useGlobalMethod) {
|
|
200
|
+
debugLog("Using GlobalMethodId");
|
|
201
|
+
this.openMethodNodeId = (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.FileType_Open);
|
|
202
|
+
this.closeMethodNodeId = (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.FileType_Close);
|
|
203
|
+
this.setPositionNodeId = (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.FileType_SetPosition);
|
|
204
|
+
this.getPositionNodeId = (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.FileType_GetPosition);
|
|
205
|
+
this.writeNodeId = (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.FileType_Write);
|
|
206
|
+
this.readNodeId = (0, node_opcua_nodeid_1.resolveNodeId)(node_opcua_constants_1.MethodIds.FileType_Read);
|
|
207
|
+
const browsePaths = [
|
|
208
|
+
(0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.fileNodeId, "/OpenCount"),
|
|
209
|
+
(0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.fileNodeId, "/Size")
|
|
210
|
+
];
|
|
211
|
+
const results = yield this.session.translateBrowsePath(browsePaths);
|
|
212
|
+
if (results[0].statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
213
|
+
throw new Error("fileType object does not expose mandatory OpenCount Property");
|
|
214
|
+
}
|
|
215
|
+
if (results[1].statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
216
|
+
throw new Error("fileType object does not expose mandatory Size Property");
|
|
217
|
+
}
|
|
218
|
+
this.openCountNodeId = results[0].targets[0].targetId;
|
|
219
|
+
this.sizeNodeId = results[1].targets[0].targetId;
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
const browsePaths = [
|
|
223
|
+
(0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.fileNodeId, "/Open"),
|
|
224
|
+
(0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.fileNodeId, "/Close"),
|
|
225
|
+
(0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.fileNodeId, "/SetPosition"),
|
|
226
|
+
(0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.fileNodeId, "/GetPosition"),
|
|
227
|
+
(0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.fileNodeId, "/Write"),
|
|
228
|
+
(0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.fileNodeId, "/Read"),
|
|
229
|
+
(0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.fileNodeId, "/OpenCount"),
|
|
230
|
+
(0, node_opcua_service_translate_browse_path_1.makeBrowsePath)(this.fileNodeId, "/Size")
|
|
231
|
+
];
|
|
232
|
+
const results = yield this.session.translateBrowsePath(browsePaths);
|
|
233
|
+
if (results[0].statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
234
|
+
throw new Error("fileType object does not expose mandatory Open Method");
|
|
235
|
+
}
|
|
236
|
+
if (results[1].statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
237
|
+
throw new Error("fileType object does not expose mandatory Close Method");
|
|
238
|
+
}
|
|
239
|
+
if (results[2].statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
240
|
+
throw new Error("fileType object does not expose mandatory SetPosition Method");
|
|
241
|
+
}
|
|
242
|
+
if (results[3].statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
243
|
+
throw new Error("fileType object does not expose mandatory GetPosition Method");
|
|
244
|
+
}
|
|
245
|
+
if (results[4].statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
246
|
+
throw new Error("fileType object does not expose mandatory Write Method");
|
|
247
|
+
}
|
|
248
|
+
if (results[5].statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
249
|
+
throw new Error("fileType object does not expose mandatory Read Method");
|
|
250
|
+
}
|
|
251
|
+
if (results[6].statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
252
|
+
throw new Error("fileType object does not expose mandatory OpenCount Variable");
|
|
253
|
+
}
|
|
254
|
+
if (results[7].statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
255
|
+
throw new Error("fileType object does not expose mandatory Size Variable");
|
|
256
|
+
}
|
|
257
|
+
if (false && doDebug) {
|
|
258
|
+
results.map((x) => debugLog(x.toString()));
|
|
259
|
+
}
|
|
260
|
+
this.openMethodNodeId = results[0].targets[0].targetId;
|
|
261
|
+
this.closeMethodNodeId = results[1].targets[0].targetId;
|
|
262
|
+
this.setPositionNodeId = results[2].targets[0].targetId;
|
|
263
|
+
this.getPositionNodeId = results[3].targets[0].targetId;
|
|
264
|
+
this.writeNodeId = results[4].targets[0].targetId;
|
|
265
|
+
this.readNodeId = results[5].targets[0].targetId;
|
|
266
|
+
this.openCountNodeId = results[6].targets[0].targetId;
|
|
267
|
+
this.sizeNodeId = results[7].targets[0].targetId;
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
ensureInitialized() {
|
|
271
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
272
|
+
if (!this.openMethodNodeId) {
|
|
273
|
+
yield this.extractMethodsIds();
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
exports.ClientFile = ClientFile;
|
|
279
|
+
ClientFile.useGlobalMethod = false;
|
|
280
|
+
/**
|
|
281
|
+
* 5.2.10 UserRolePermissions
|
|
282
|
+
*
|
|
283
|
+
* The optional UserRolePermissions Attribute specifies the Permissions that apply to a Node for
|
|
284
|
+
* all Roles granted to current Session. The value of the Attribute is an array of
|
|
285
|
+
* RolePermissionType Structures (see Table 8).
|
|
286
|
+
* Clients may determine their effective Permissions by logically ORing the Permissions for each
|
|
287
|
+
* Role in the array.
|
|
288
|
+
* The value of this Attribute is derived from the rules used by the Server to map Sessions to
|
|
289
|
+
* Roles. This mapping may be vendor specific or it may use the standard Role model defined in 4.8.
|
|
290
|
+
* This Attribute shall not be writeable.
|
|
291
|
+
* If not specified, the value of DefaultUserRolePermissions Property from the Namespace
|
|
292
|
+
* Metadata Object associated with the Node is used instead. If the NamespaceMetadata Object
|
|
293
|
+
* does not define the Property or does not exist, then the Server does not publish any information
|
|
294
|
+
* about Roles mapped to the current Session.
|
|
295
|
+
*
|
|
296
|
+
*
|
|
297
|
+
* 5.2.11 AccessRestrictions
|
|
298
|
+
* The optional AccessRestrictions Attribute specifies the AccessRestrictions that apply to a Node.
|
|
299
|
+
* Its data type is defined in 8.56. If a Server supports AccessRestrictions for a particular
|
|
300
|
+
* Namespace it adds the DefaultAccessRestrictions Property to the NamespaceMetadata Object
|
|
301
|
+
* for that Namespace (see Figure 8). If a particular Node in the Namespace needs to override
|
|
302
|
+
* the default value the Server adds the AccessRestrictions Attribute to the Node.
|
|
303
|
+
* If a Server implements a vendor specific access restriction model for a Namespace, it does not
|
|
304
|
+
* add the DefaultAccessRestrictions Property to the NamespaceMetadata Object.
|
|
305
|
+
*
|
|
306
|
+
*
|
|
307
|
+
* DefaultAccessRestrictions
|
|
308
|
+
*
|
|
309
|
+
*/
|
|
310
|
+
//# sourceMappingURL=client_file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client_file.js","sourceRoot":"","sources":["../../source/client/client_file.ts"],"names":[],"mappings":";;;;;;;;;;;;AAIA,iEAAqD;AACrD,yDAA0D;AAG1D,uGAAsF;AACtF,mEAAqD;AACrD,2DAAgE;AAChE,+DAAiD;AAEjD,uDAAgF;AAEhF,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,UAAU,CAAC,CAAC;AAC3C,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,UAAU,CAAC,CAAC;AAE3C,4CAA4C;AAC5C,0CAA4C;AAAnC,yGAAA,YAAY,OAAA;AAErB;;;GAGG;AACH,MAAa,UAAU;IAiBnB,YAAY,OAAsB,EAAE,MAAc;QAbxC,eAAU,GAAG,CAAC,CAAC;QAcrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,MAAM,CAAC;IAC7B,CAAC;IAEY,IAAI,CAAC,IAAkB;;YAEhC,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,KA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AAI,CAAC,gBAAgB,EAAE;gBACxB,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;aAClC;QACL,CAAC;KAAA;;AAvQL,gCAwQC;AAtQiB,0BAAe,GAAG,KAAK,CAAC;AAwQ1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
10
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
/**
|
|
14
|
+
* @module node-opcua-file-transfer
|
|
15
|
+
*/
|
|
16
|
+
__exportStar(require("./client/client_file"), exports);
|
|
17
|
+
__exportStar(require("./server/file_type_helpers"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../source/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;GAEG;AACH,uDAAqC;AACrC,6DAA2C"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module node-opcua-file-transfer-server
|
|
3
|
+
*/
|
|
4
|
+
export declare enum OpenFileModeMask {
|
|
5
|
+
ReadBit = 1,
|
|
6
|
+
WriteBit = 2,
|
|
7
|
+
EraseExistingBit = 4,
|
|
8
|
+
AppendBit = 8
|
|
9
|
+
}
|
|
10
|
+
export declare enum OpenFileMode {
|
|
11
|
+
/**
|
|
12
|
+
* Read bit 0 The file is opened for reading. If this bit is not
|
|
13
|
+
* set the Read Method cannot be executed.
|
|
14
|
+
*/
|
|
15
|
+
Read = 1,
|
|
16
|
+
/**
|
|
17
|
+
* Write bit 1 The file is opened for writing. If this bit is not
|
|
18
|
+
* set the Write Method cannot be executed.
|
|
19
|
+
*
|
|
20
|
+
*/
|
|
21
|
+
Write = 2,
|
|
22
|
+
ReadWrite = 3,
|
|
23
|
+
/**
|
|
24
|
+
*
|
|
25
|
+
* WriteEraseExisting
|
|
26
|
+
* EraseExisting 2 This bit can only be set if the file is opened for writing
|
|
27
|
+
* (Write bit is set). The existing content of the file is
|
|
28
|
+
* erased and an empty file is provided.
|
|
29
|
+
*/
|
|
30
|
+
WriteEraseExisting = 6,
|
|
31
|
+
ReadWriteEraseExisting = 7,
|
|
32
|
+
/**
|
|
33
|
+
* Append 3 When the Append bit is set the file is opened at end
|
|
34
|
+
* of the file, otherwise at begin of the file.
|
|
35
|
+
* The SetPosition Method can be used to change the position.
|
|
36
|
+
*/
|
|
37
|
+
WriteAppend = 10,
|
|
38
|
+
ReadWriteAppend = 11
|
|
39
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.OpenFileMode = exports.OpenFileModeMask = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* @module node-opcua-file-transfer-server
|
|
6
|
+
*/
|
|
7
|
+
var OpenFileModeMask;
|
|
8
|
+
(function (OpenFileModeMask) {
|
|
9
|
+
OpenFileModeMask[OpenFileModeMask["ReadBit"] = 1] = "ReadBit";
|
|
10
|
+
OpenFileModeMask[OpenFileModeMask["WriteBit"] = 2] = "WriteBit";
|
|
11
|
+
OpenFileModeMask[OpenFileModeMask["EraseExistingBit"] = 4] = "EraseExistingBit";
|
|
12
|
+
OpenFileModeMask[OpenFileModeMask["AppendBit"] = 8] = "AppendBit";
|
|
13
|
+
})(OpenFileModeMask = exports.OpenFileModeMask || (exports.OpenFileModeMask = {}));
|
|
14
|
+
var OpenFileMode;
|
|
15
|
+
(function (OpenFileMode) {
|
|
16
|
+
/**
|
|
17
|
+
* Read bit 0 The file is opened for reading. If this bit is not
|
|
18
|
+
* set the Read Method cannot be executed.
|
|
19
|
+
*/
|
|
20
|
+
OpenFileMode[OpenFileMode["Read"] = 1] = "Read";
|
|
21
|
+
/**
|
|
22
|
+
* Write bit 1 The file is opened for writing. If this bit is not
|
|
23
|
+
* set the Write Method cannot be executed.
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
OpenFileMode[OpenFileMode["Write"] = 2] = "Write";
|
|
27
|
+
OpenFileMode[OpenFileMode["ReadWrite"] = 3] = "ReadWrite";
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* WriteEraseExisting
|
|
31
|
+
* EraseExisting 2 This bit can only be set if the file is opened for writing
|
|
32
|
+
* (Write bit is set). The existing content of the file is
|
|
33
|
+
* erased and an empty file is provided.
|
|
34
|
+
*/
|
|
35
|
+
OpenFileMode[OpenFileMode["WriteEraseExisting"] = 6] = "WriteEraseExisting";
|
|
36
|
+
OpenFileMode[OpenFileMode["ReadWriteEraseExisting"] = 7] = "ReadWriteEraseExisting";
|
|
37
|
+
/**
|
|
38
|
+
* Append 3 When the Append bit is set the file is opened at end
|
|
39
|
+
* of the file, otherwise at begin of the file.
|
|
40
|
+
* The SetPosition Method can be used to change the position.
|
|
41
|
+
*/
|
|
42
|
+
OpenFileMode[OpenFileMode["WriteAppend"] = 10] = "WriteAppend";
|
|
43
|
+
OpenFileMode[OpenFileMode["ReadWriteAppend"] = 11] = "ReadWriteAppend";
|
|
44
|
+
})(OpenFileMode = exports.OpenFileMode || (exports.OpenFileMode = {}));
|
|
45
|
+
//# sourceMappingURL=open_mode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open_mode.js","sourceRoot":"","sources":["../source/open_mode.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,IAAY,gBAKX;AALD,WAAY,gBAAgB;IACxB,6DAAc,CAAA;IACd,+DAAe,CAAA;IACf,+EAAuB,CAAA;IACvB,iEAAgB,CAAA;AACpB,CAAC,EALW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAK3B;AAED,IAAY,YA8BX;AA9BD,WAAY,YAAY;IACpB;;;OAGG;IACH,+CAA+B,CAAA;IAC/B;;;;OAIG;IACH,iDAAiC,CAAA;IACjC,yDAAgE,CAAA;IAEhE;;;;;;OAMG;IACH,2EAAkF,CAAA;IAClF,mFAAiH,CAAA;IACjH;;;;OAIG;IACH,8DAAoE,CAAA;IACpE,sEAAmG,CAAA;AACvG,CAAC,EA9BW,YAAY,GAAZ,oBAAY,KAAZ,oBAAY,QA8BvB"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Stats, PathLike, OpenMode, NoParamCallback, WriteFileOptions } from "fs";
|
|
3
|
+
import { UAFile, UAFile_Base, UAObjectType } from "node-opcua-address-space";
|
|
4
|
+
export interface AbstractFs {
|
|
5
|
+
stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void;
|
|
6
|
+
open(path: PathLike, flags: OpenMode, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
|
|
7
|
+
write<TBuffer extends NodeJS.ArrayBufferView>(fd: number, buffer: TBuffer, offset: number | undefined | null, length: number | undefined | null, position: number | undefined | null, callback: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffer: TBuffer) => void): void;
|
|
8
|
+
read<TBuffer extends NodeJS.ArrayBufferView>(fd: number, buffer: TBuffer, offset: number, length: number, position: number | null, callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void): void;
|
|
9
|
+
close(fd: number, callback: NoParamCallback): void;
|
|
10
|
+
writeFile(path: PathLike | number, data: string | NodeJS.ArrayBufferView, options: WriteFileOptions, callback: NoParamCallback): void;
|
|
11
|
+
readFile(path: PathLike | number, options: {
|
|
12
|
+
encoding: BufferEncoding;
|
|
13
|
+
flag?: string;
|
|
14
|
+
} | string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void;
|
|
15
|
+
existsSync(filename: string): boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
*
|
|
19
|
+
*/
|
|
20
|
+
export interface FileOptions {
|
|
21
|
+
/**
|
|
22
|
+
* the filaname of the physical file which is managed by the OPCUA filetpye
|
|
23
|
+
*/
|
|
24
|
+
filename: string;
|
|
25
|
+
/**
|
|
26
|
+
* the maximum allowed size of the phisical file.
|
|
27
|
+
*/
|
|
28
|
+
maxSize?: number;
|
|
29
|
+
/**
|
|
30
|
+
* an optional mimeType
|
|
31
|
+
*/
|
|
32
|
+
mineType?: string;
|
|
33
|
+
fileSystem?: AbstractFs;
|
|
34
|
+
}
|
|
35
|
+
export interface UAFileType extends UAObjectType, UAFile_Base {
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
export declare class FileTypeData {
|
|
41
|
+
_fs: AbstractFs;
|
|
42
|
+
filename: string;
|
|
43
|
+
maxSize: number;
|
|
44
|
+
mimeType: string;
|
|
45
|
+
private file;
|
|
46
|
+
private _openCount;
|
|
47
|
+
private _fileSize;
|
|
48
|
+
constructor(options: FileOptions, file: UAFile);
|
|
49
|
+
set openCount(value: number);
|
|
50
|
+
get openCount(): number;
|
|
51
|
+
set fileSize(value: number);
|
|
52
|
+
get fileSize(): number;
|
|
53
|
+
/**
|
|
54
|
+
* refresh position and size
|
|
55
|
+
* this method should be call by the server if the file
|
|
56
|
+
* is modified externally
|
|
57
|
+
*
|
|
58
|
+
*/
|
|
59
|
+
refresh(): Promise<void>;
|
|
60
|
+
}
|
|
61
|
+
export declare function getFileData(opcuaFile2: UAFileType): FileTypeData;
|
|
62
|
+
export declare const defaultMaxSize = 100000000;
|
|
63
|
+
/**
|
|
64
|
+
* bind all methods of a UAFileType OPCUA node
|
|
65
|
+
* @param file the OPCUA Node that has a typeDefinition of FileType
|
|
66
|
+
* @param options the options
|
|
67
|
+
*/
|
|
68
|
+
export declare function installFileType(file: UAFile, options: FileOptions): void;
|