@unitn-asa/deliveroo-js-sdk 1.2.2 → 1.2.5
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.md +0 -0
- package/package.json +5 -5
- package/src/client/DjsConnect.js +19 -9
- package/src/client/index.js +1 -1
package/LICENSE.md
ADDED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unitn-asa/deliveroo-js-sdk",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.5",
|
|
4
4
|
"description": "Software development kit for Deliveroo.js",
|
|
5
5
|
"author": "Marco Robol <marco.robol@unitn.it>",
|
|
6
6
|
"type": "module",
|
|
@@ -24,9 +24,6 @@
|
|
|
24
24
|
"scripts": {
|
|
25
25
|
"test": "node test/DeliveroojsApiClient.test.js"
|
|
26
26
|
},
|
|
27
|
-
"dependencies": {
|
|
28
|
-
"args-parser": "^1.3.0"
|
|
29
|
-
},
|
|
30
27
|
"peerDependencies": {
|
|
31
28
|
"socket.io": "^4.7.2",
|
|
32
29
|
"socket.io-client": "^4.7.2"
|
|
@@ -34,5 +31,8 @@
|
|
|
34
31
|
"publishConfig": {
|
|
35
32
|
"access": "public"
|
|
36
33
|
},
|
|
37
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "273dca6458f39c3e2cfd6f4a5b174e9e5819955d",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"getopts": "^2.3.0"
|
|
37
|
+
}
|
|
38
38
|
}
|
package/src/client/DjsConnect.js
CHANGED
|
@@ -1,17 +1,27 @@
|
|
|
1
1
|
import { io } from "socket.io-client";
|
|
2
|
-
import { default as argsparser } from "args-parser";
|
|
3
2
|
import { DjsClientSocket } from "./DjsClientSocket.js";
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
4
|
/**
|
|
8
|
-
*
|
|
9
|
-
* token
|
|
10
|
-
* e.g:
|
|
11
|
-
* $ node index.js -token=... -name=marco
|
|
12
|
-
* $ npm start -- -token=... -name=marco
|
|
5
|
+
* Get command-line arguments for token and name (Node.js only)
|
|
6
|
+
* Usage: npm run dev -- -token=... -name=...
|
|
13
7
|
*/
|
|
14
|
-
|
|
8
|
+
function getArgs() {
|
|
9
|
+
if (typeof process !== 'undefined' && process?.argv) {
|
|
10
|
+
// Dynamic import only in Node.js environment
|
|
11
|
+
try {
|
|
12
|
+
const getopts = require('getopts');
|
|
13
|
+
return getopts(process.argv, {
|
|
14
|
+
string: ['token', 'name']
|
|
15
|
+
});
|
|
16
|
+
} catch {
|
|
17
|
+
// Fallback if require doesn't work (e.g., in bundler)
|
|
18
|
+
return { token: undefined, name: undefined };
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return { token: undefined, name: undefined };
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const args = getArgs();
|
|
15
25
|
|
|
16
26
|
|
|
17
27
|
|
package/src/client/index.js
CHANGED