abb-rws-client 0.1.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/LICENSE +21 -0
- package/README.md +261 -0
- package/dist/HttpSession.d.ts +92 -0
- package/dist/HttpSession.d.ts.map +1 -0
- package/dist/HttpSession.js +321 -0
- package/dist/HttpSession.js.map +1 -0
- package/dist/ResourceMapper.d.ts +95 -0
- package/dist/ResourceMapper.d.ts.map +1 -0
- package/dist/ResourceMapper.js +146 -0
- package/dist/ResourceMapper.js.map +1 -0
- package/dist/ResponseParser.d.ts +73 -0
- package/dist/ResponseParser.d.ts.map +1 -0
- package/dist/ResponseParser.js +294 -0
- package/dist/ResponseParser.js.map +1 -0
- package/dist/RwsClient.d.ts +156 -0
- package/dist/RwsClient.d.ts.map +1 -0
- package/dist/RwsClient.js +353 -0
- package/dist/RwsClient.js.map +1 -0
- package/dist/WsSubscriber.d.ts +33 -0
- package/dist/WsSubscriber.d.ts.map +1 -0
- package/dist/WsSubscriber.js +234 -0
- package/dist/WsSubscriber.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +90 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +21 -0
- package/dist/types.js.map +1 -0
- package/package.json +33 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* abb-rws-client — public API
|
|
3
|
+
*
|
|
4
|
+
* Typed HTTP/WebSocket client for ABB IRC5 robot controllers (RWS 1.0, RobotWare 6.x only).
|
|
5
|
+
* Not compatible with RWS 2.0 / RobotWare 7.x / OmniCore.
|
|
6
|
+
*/
|
|
7
|
+
export { RwsClient } from './RwsClient.js';
|
|
8
|
+
export { RwsError } from './types.js';
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export type ControllerState = 'init' | 'motoroff' | 'motoron' | 'guardstop' | 'emergencystop' | 'emergencystopreset' | 'sysfail';
|
|
2
|
+
export type OperationMode = 'AUTO' | 'MANR' | 'MANF';
|
|
3
|
+
export type ExecutionState = 'running' | 'stopped';
|
|
4
|
+
export interface JointTarget {
|
|
5
|
+
rax_1: number;
|
|
6
|
+
rax_2: number;
|
|
7
|
+
rax_3: number;
|
|
8
|
+
rax_4: number;
|
|
9
|
+
rax_5: number;
|
|
10
|
+
rax_6: number;
|
|
11
|
+
}
|
|
12
|
+
export interface RobTarget {
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
z: number;
|
|
16
|
+
q1: number;
|
|
17
|
+
q2: number;
|
|
18
|
+
q3: number;
|
|
19
|
+
q4: number;
|
|
20
|
+
}
|
|
21
|
+
export interface Signal {
|
|
22
|
+
name: string;
|
|
23
|
+
value: string;
|
|
24
|
+
type: 'DI' | 'DO' | 'AI' | 'AO' | 'GI' | 'GO';
|
|
25
|
+
lvalue: string;
|
|
26
|
+
}
|
|
27
|
+
export interface RapidTask {
|
|
28
|
+
name: string;
|
|
29
|
+
type: string;
|
|
30
|
+
taskstate: string;
|
|
31
|
+
excstate: ExecutionState;
|
|
32
|
+
active: boolean;
|
|
33
|
+
motiontask: boolean;
|
|
34
|
+
}
|
|
35
|
+
export interface RwsClientOptions {
|
|
36
|
+
/** IP address or hostname, e.g. '192.168.125.1' or '127.0.0.1' for RobotStudio */
|
|
37
|
+
host: string;
|
|
38
|
+
/** HTTP port; default 80 */
|
|
39
|
+
port?: number;
|
|
40
|
+
/** Default 'Default User' */
|
|
41
|
+
username?: string;
|
|
42
|
+
/** Default 'robotics' */
|
|
43
|
+
password?: string;
|
|
44
|
+
/** Minimum ms between requests; default 55ms (enforces <20 req/sec RWS rate limit) */
|
|
45
|
+
requestIntervalMs?: number;
|
|
46
|
+
/** Request timeout in ms; default 5000 */
|
|
47
|
+
timeout?: number;
|
|
48
|
+
}
|
|
49
|
+
export type SubscriptionResource = 'execution' | 'controllerstate' | 'operationmode' | {
|
|
50
|
+
type: 'signal';
|
|
51
|
+
name: string;
|
|
52
|
+
} | {
|
|
53
|
+
type: 'persvar';
|
|
54
|
+
name: string;
|
|
55
|
+
};
|
|
56
|
+
export interface SubscriptionEvent {
|
|
57
|
+
resource: string;
|
|
58
|
+
value: string;
|
|
59
|
+
timestamp: Date;
|
|
60
|
+
}
|
|
61
|
+
export type RwsErrorCode = 'SESSION_EXPIRED' | 'AUTH_FAILED' | 'MOTORS_OFF' | 'MODULE_NOT_FOUND' | 'RATE_LIMITED' | 'CONTROLLER_BUSY' | 'NETWORK_ERROR' | 'PARSE_ERROR' | 'UNKNOWN';
|
|
62
|
+
/**
|
|
63
|
+
* Typed error thrown by all abb-rws-client public methods.
|
|
64
|
+
* Always check `code` for programmatic error handling.
|
|
65
|
+
*/
|
|
66
|
+
export declare class RwsError extends Error {
|
|
67
|
+
readonly code: RwsErrorCode;
|
|
68
|
+
readonly httpStatus?: number;
|
|
69
|
+
readonly rwsDetail?: string;
|
|
70
|
+
constructor(message: string, code: RwsErrorCode, httpStatus?: number, rwsDetail?: string);
|
|
71
|
+
}
|
|
72
|
+
/** @internal Parsed fields from a WWW-Authenticate: Digest ... header (RFC 2617) */
|
|
73
|
+
export interface DigestChallenge {
|
|
74
|
+
realm: string;
|
|
75
|
+
nonce: string;
|
|
76
|
+
opaque?: string;
|
|
77
|
+
/** 'auth' | 'auth-int' — if absent, use RFC 2069 compat mode */
|
|
78
|
+
qop?: string;
|
|
79
|
+
/** Hash algorithm — typically 'MD5' (default) */
|
|
80
|
+
algorithm?: string;
|
|
81
|
+
stale?: boolean;
|
|
82
|
+
domain?: string;
|
|
83
|
+
}
|
|
84
|
+
/** @internal Return type for all HttpSession HTTP methods */
|
|
85
|
+
export interface HttpResponse {
|
|
86
|
+
status: number;
|
|
87
|
+
body: string;
|
|
88
|
+
headers: Headers;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,UAAU,GACV,SAAS,GACT,WAAW,GACX,eAAe,GACf,oBAAoB,GACpB,SAAS,CAAC;AAEd,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AACrD,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,SAAS,CAAC;AAEnD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,SAAS;IACxB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAC9C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,SAA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AAE,YAAY,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;CASzF;AAID,oFAAoF;AACpF,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,6DAA6D;AAC7D,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CAClB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// abb-rws-client — type definitions
|
|
2
|
+
// Targets RWS 1.0 (RobotWare 6.x) only. Not compatible with RWS 2.0 / RobotWare 7.x / OmniCore.
|
|
3
|
+
/**
|
|
4
|
+
* Typed error thrown by all abb-rws-client public methods.
|
|
5
|
+
* Always check `code` for programmatic error handling.
|
|
6
|
+
*/
|
|
7
|
+
export class RwsError extends Error {
|
|
8
|
+
code;
|
|
9
|
+
httpStatus;
|
|
10
|
+
rwsDetail;
|
|
11
|
+
constructor(message, code, httpStatus, rwsDetail) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.name = 'RwsError';
|
|
14
|
+
this.code = code;
|
|
15
|
+
this.httpStatus = httpStatus;
|
|
16
|
+
this.rwsDetail = rwsDetail;
|
|
17
|
+
// Restore prototype chain so instanceof checks work correctly when targeting ES2022
|
|
18
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,gGAAgG;AAwFhG;;;GAGG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,IAAI,CAAe;IACnB,UAAU,CAAU;IACpB,SAAS,CAAU;IAE5B,YAAY,OAAe,EAAE,IAAkB,EAAE,UAAmB,EAAE,SAAkB;QACtF,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,oFAAoF;QACpF,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;CACF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "abb-rws-client",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"types": "./dist/index.d.ts"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"test": "vitest run",
|
|
19
|
+
"test:watch": "vitest",
|
|
20
|
+
"lint": "eslint src"
|
|
21
|
+
},
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^20.0.0",
|
|
24
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
25
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
26
|
+
"eslint": "^9.0.0",
|
|
27
|
+
"typescript": "^5.4.0",
|
|
28
|
+
"vitest": "^1.6.0"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"ws": "^8.20.0"
|
|
32
|
+
}
|
|
33
|
+
}
|