@science-corporation/synapse 0.13.0 → 1.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.
Files changed (54) hide show
  1. package/README.md +4 -2
  2. package/dist/api/api.d.ts +124 -6
  3. package/dist/api/api.js +293 -20
  4. package/dist/api/api.js.map +1 -1
  5. package/dist/api/proto.json +25 -2
  6. package/dist/demo.js +125 -32
  7. package/dist/demo.js.map +1 -1
  8. package/dist/nodes/stream_out.d.ts +12 -5
  9. package/dist/nodes/stream_out.d.ts.map +1 -1
  10. package/dist/nodes/stream_out.js +58 -40
  11. package/dist/nodes/stream_out.js.map +1 -1
  12. package/dist/utils/ip.d.ts +2 -0
  13. package/dist/utils/ip.d.ts.map +1 -0
  14. package/dist/utils/ip.js +52 -0
  15. package/dist/utils/ip.js.map +1 -0
  16. package/package.json +6 -5
  17. package/scripts/postinstall.sh +50 -10
  18. package/src/api/api.d.ts +124 -6
  19. package/src/api/api.js +311 -20
  20. package/src/api/proto.json +25 -2
  21. package/src/demo.ts +20 -8
  22. package/src/nodes/stream_out.ts +67 -50
  23. package/src/utils/ip.ts +35 -0
  24. package/synapse-api/README.md +1 -1
  25. package/synapse-api/api/nodes/stream_out.proto +31 -1
  26. package/dist/api-science-device/api.d.ts +0 -3
  27. package/dist/api-science-device/api.d.ts.map +0 -1
  28. package/dist/api-science-device/api.js +0 -3822
  29. package/dist/api-science-device/api.js.map +0 -1
  30. package/dist/api-science-device/proto.json +0 -258
  31. package/dist/nodejs.d.ts +0 -8
  32. package/dist/nodejs.d.ts.map +0 -1
  33. package/dist/nodejs.js +0 -32
  34. package/dist/nodejs.js.map +0 -1
  35. package/dist/science-device-api/api.d.ts +0 -3
  36. package/dist/science-device-api/api.d.ts.map +0 -1
  37. package/dist/science-device-api/api.js +0 -3822
  38. package/dist/science-device-api/api.js.map +0 -1
  39. package/dist/types/index.d.ts +0 -3
  40. package/dist/types/index.d.ts.map +0 -1
  41. package/dist/types/index.js +0 -19
  42. package/dist/types/index.js.map +0 -1
  43. package/dist/types.d.ts +0 -5
  44. package/dist/types.d.ts.map +0 -1
  45. package/dist/types.js +0 -19
  46. package/dist/types.js.map +0 -1
  47. package/dist/utils/device-management.d.ts +0 -37
  48. package/dist/utils/device-management.d.ts.map +0 -1
  49. package/dist/utils/device-management.js +0 -126
  50. package/dist/utils/device-management.js.map +0 -1
  51. package/dist/utils/ndtp.d.ts +0 -40
  52. package/dist/utils/ndtp.d.ts.map +0 -1
  53. package/dist/utils/ndtp.js +0 -140
  54. package/dist/utils/ndtp.js.map +0 -1
@@ -1,5 +1,19 @@
1
1
  #!/bin/bash
2
2
 
3
+ # Platform detection
4
+ IS_WINDOWS=false
5
+ if [ "$OS" = "Windows_NT" ] || [ "$OSTYPE" = "msys" ] || [ "$OSTYPE" = "cygwin" ]; then
6
+ IS_WINDOWS=true
7
+ fi
8
+
9
+ # If running on Windows, ensure we're using bash
10
+ if [ "$IS_WINDOWS" = true ]; then
11
+ if ! command -v bash >/dev/null 2>&1; then
12
+ echo "Error: bash is required to run this script on Windows"
13
+ exit 1
14
+ fi
15
+ fi
16
+
3
17
  echo "Postinstall - downloading synapse-api"
4
18
 
5
19
  # If synapse-api directory already exists, skip download
@@ -22,7 +36,6 @@ if command -v git >/dev/null 2>&1 && git rev-parse --git-dir >/dev/null 2>&1; th
22
36
  fi
23
37
  fi
24
38
 
25
-
26
39
  # Else, fallback to downloading from github
27
40
  echo "Downloading synapse-api..."
28
41
 
@@ -71,22 +84,49 @@ fi
71
84
 
72
85
  echo "- Found synapse-api ref \"$REF_API\""
73
86
 
74
- TMP_DIR=$(mktemp -d)
87
+ # Create temp directory in a cross-platform way
88
+ if [ "$IS_WINDOWS" = true ]; then
89
+ # Use a more reliable temp directory path on Windows
90
+ TMP_DIR="C:\\Users\\$USERNAME\\AppData\\Local\\Temp\\synapse-api-temp"
91
+ mkdir -p "$TMP_DIR"
92
+ else
93
+ TMP_DIR=$(mktemp -d)
94
+ fi
95
+
96
+ # Download using curl or fallback to PowerShell on Windows if curl fails
75
97
  if ! curl -s -L "https://github.com/sciencecorp/synapse-api/archive/${REF_API}.zip" -o "$TMP_DIR/synapse-api.zip"; then
76
- echo " - Failed to download synapse-api"
77
- exit 1
98
+ if [ "$IS_WINDOWS" = true ]; then
99
+ echo " - Curl failed, attempting download with PowerShell..."
100
+ powershell -Command "Invoke-WebRequest -Uri 'https://github.com/sciencecorp/synapse-api/archive/${REF_API}.zip' -OutFile '$TMP_DIR\\synapse-api.zip'"
101
+ else
102
+ echo " - Failed to download synapse-api"
103
+ exit 1
104
+ fi
78
105
  fi
79
106
 
80
- if ! unzip -q "$TMP_DIR/synapse-api.zip" -d "$TMP_DIR"; then
81
- echo " - Failed to unzip synapse-api"
82
- exit 1
107
+ # Unzip in a cross-platform way
108
+ if [ "$IS_WINDOWS" = true ]; then
109
+ if ! unzip -q "$TMP_DIR/synapse-api.zip" -d "$TMP_DIR" 2>/dev/null; then
110
+ echo " - Unzip failed, attempting with PowerShell..."
111
+ powershell -Command "Expand-Archive -Path '$TMP_DIR\\synapse-api.zip' -DestinationPath '$TMP_DIR' -Force"
112
+ fi
113
+ else
114
+ if ! unzip -q "$TMP_DIR/synapse-api.zip" -d "$TMP_DIR"; then
115
+ echo " - Failed to unzip synapse-api"
116
+ exit 1
117
+ fi
83
118
  fi
84
119
 
120
+ # Create directory and copy files in a cross-platform way
85
121
  mkdir -p synapse-api
86
- cp -r "$TMP_DIR/synapse-api-${REF_API}/"* synapse-api/
87
-
88
- rm "$TMP_DIR/synapse-api.zip"
122
+ if [ "$IS_WINDOWS" = true ]; then
123
+ powershell -Command "Copy-Item -Path \"$TMP_DIR\\synapse-api-${REF_API}\\*\" -Destination \"synapse-api\\\" -Recurse -Force"
124
+ else
125
+ cp -r "$TMP_DIR/synapse-api-${REF_API}/"* synapse-api/
126
+ fi
89
127
 
128
+ # Clean up temp files
129
+ rm -rf "$TMP_DIR"
90
130
 
91
131
  if [ ! -f "synapse-api/README.md" ] || [ ! -f "synapse-api/COPYRIGHT" ] || [ ! -d "synapse-api/api" ]; then
92
132
  echo " - Failed to download synapse-api - missing required files"
package/src/api/api.d.ts CHANGED
@@ -1325,17 +1325,123 @@ export namespace synapse {
1325
1325
  public static getTypeUrl(typeUrlPrefix?: string): string;
1326
1326
  }
1327
1327
 
1328
+ /** Properties of a UDPUnicastConfig. */
1329
+ interface IUDPUnicastConfig {
1330
+
1331
+ /** UDPUnicastConfig destinationAddress */
1332
+ destinationAddress?: (string|null);
1333
+
1334
+ /** UDPUnicastConfig destinationPort */
1335
+ destinationPort?: (number|null);
1336
+ }
1337
+
1338
+ /** UDPUnicastConfig defines the configuration parameters for UDP unicast transport. */
1339
+ class UDPUnicastConfig implements IUDPUnicastConfig {
1340
+
1341
+ /**
1342
+ * Constructs a new UDPUnicastConfig.
1343
+ * @param [properties] Properties to set
1344
+ */
1345
+ constructor(properties?: synapse.IUDPUnicastConfig);
1346
+
1347
+ /** UDPUnicastConfig destinationAddress. */
1348
+ public destinationAddress: string;
1349
+
1350
+ /** UDPUnicastConfig destinationPort. */
1351
+ public destinationPort: number;
1352
+
1353
+ /**
1354
+ * Creates a new UDPUnicastConfig instance using the specified properties.
1355
+ * @param [properties] Properties to set
1356
+ * @returns UDPUnicastConfig instance
1357
+ */
1358
+ public static create(properties?: synapse.IUDPUnicastConfig): synapse.UDPUnicastConfig;
1359
+
1360
+ /**
1361
+ * Encodes the specified UDPUnicastConfig message. Does not implicitly {@link synapse.UDPUnicastConfig.verify|verify} messages.
1362
+ * @param message UDPUnicastConfig message or plain object to encode
1363
+ * @param [writer] Writer to encode to
1364
+ * @returns Writer
1365
+ */
1366
+ public static encode(message: synapse.IUDPUnicastConfig, writer?: $protobuf.Writer): $protobuf.Writer;
1367
+
1368
+ /**
1369
+ * Encodes the specified UDPUnicastConfig message, length delimited. Does not implicitly {@link synapse.UDPUnicastConfig.verify|verify} messages.
1370
+ * @param message UDPUnicastConfig message or plain object to encode
1371
+ * @param [writer] Writer to encode to
1372
+ * @returns Writer
1373
+ */
1374
+ public static encodeDelimited(message: synapse.IUDPUnicastConfig, writer?: $protobuf.Writer): $protobuf.Writer;
1375
+
1376
+ /**
1377
+ * Decodes a UDPUnicastConfig message from the specified reader or buffer.
1378
+ * @param reader Reader or buffer to decode from
1379
+ * @param [length] Message length if known beforehand
1380
+ * @returns UDPUnicastConfig
1381
+ * @throws {Error} If the payload is not a reader or valid buffer
1382
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1383
+ */
1384
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): synapse.UDPUnicastConfig;
1385
+
1386
+ /**
1387
+ * Decodes a UDPUnicastConfig message from the specified reader or buffer, length delimited.
1388
+ * @param reader Reader or buffer to decode from
1389
+ * @returns UDPUnicastConfig
1390
+ * @throws {Error} If the payload is not a reader or valid buffer
1391
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
1392
+ */
1393
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): synapse.UDPUnicastConfig;
1394
+
1395
+ /**
1396
+ * Verifies a UDPUnicastConfig message.
1397
+ * @param message Plain object to verify
1398
+ * @returns `null` if valid, otherwise the reason why it is not
1399
+ */
1400
+ public static verify(message: { [k: string]: any }): (string|null);
1401
+
1402
+ /**
1403
+ * Creates a UDPUnicastConfig message from a plain object. Also converts values to their respective internal types.
1404
+ * @param object Plain object
1405
+ * @returns UDPUnicastConfig
1406
+ */
1407
+ public static fromObject(object: { [k: string]: any }): synapse.UDPUnicastConfig;
1408
+
1409
+ /**
1410
+ * Creates a plain object from a UDPUnicastConfig message. Also converts values to other types if specified.
1411
+ * @param message UDPUnicastConfig
1412
+ * @param [options] Conversion options
1413
+ * @returns Plain object
1414
+ */
1415
+ public static toObject(message: synapse.UDPUnicastConfig, options?: $protobuf.IConversionOptions): { [k: string]: any };
1416
+
1417
+ /**
1418
+ * Converts this UDPUnicastConfig to JSON.
1419
+ * @returns JSON object
1420
+ */
1421
+ public toJSON(): { [k: string]: any };
1422
+
1423
+ /**
1424
+ * Gets the default type url for UDPUnicastConfig
1425
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
1426
+ * @returns The default type url
1427
+ */
1428
+ public static getTypeUrl(typeUrlPrefix?: string): string;
1429
+ }
1430
+
1328
1431
  /** Properties of a StreamOutConfig. */
1329
1432
  interface IStreamOutConfig {
1330
1433
 
1331
1434
  /** StreamOutConfig label */
1332
1435
  label?: (string|null);
1333
1436
 
1334
- /** StreamOutConfig multicastGroup */
1335
- multicastGroup?: (string|null);
1437
+ /** StreamOutConfig udpUnicast */
1438
+ udpUnicast?: (synapse.IUDPUnicastConfig|null);
1336
1439
  }
1337
1440
 
1338
- /** Represents a StreamOutConfig. */
1441
+ /**
1442
+ * StreamOutConfig defines the configuration for an outbound data stream.
1443
+ * Clients can request to create a new outbound stream by providing a transport
1444
+ */
1339
1445
  class StreamOutConfig implements IStreamOutConfig {
1340
1446
 
1341
1447
  /**
@@ -1347,8 +1453,11 @@ export namespace synapse {
1347
1453
  /** StreamOutConfig label. */
1348
1454
  public label: string;
1349
1455
 
1350
- /** StreamOutConfig multicastGroup. */
1351
- public multicastGroup: string;
1456
+ /** StreamOutConfig udpUnicast. */
1457
+ public udpUnicast?: (synapse.IUDPUnicastConfig|null);
1458
+
1459
+ /** StreamOutConfig transport. */
1460
+ public transport?: "udpUnicast";
1352
1461
 
1353
1462
  /**
1354
1463
  * Creates a new StreamOutConfig instance using the specified properties.
@@ -1433,9 +1542,15 @@ export namespace synapse {
1433
1542
 
1434
1543
  /** StreamOutStatus throughputMbps */
1435
1544
  throughputMbps?: (number|null);
1545
+
1546
+ /** StreamOutStatus failedSendCount */
1547
+ failedSendCount?: (Long|null);
1436
1548
  }
1437
1549
 
1438
- /** Represents a StreamOutStatus. */
1550
+ /**
1551
+ * StreamOutStatus provides status information for an outbound stream.
1552
+ * It contains data about the instantaneous performance of the stream
1553
+ */
1439
1554
  class StreamOutStatus implements IStreamOutStatus {
1440
1555
 
1441
1556
  /**
@@ -1447,6 +1562,9 @@ export namespace synapse {
1447
1562
  /** StreamOutStatus throughputMbps. */
1448
1563
  public throughputMbps: number;
1449
1564
 
1565
+ /** StreamOutStatus failedSendCount. */
1566
+ public failedSendCount: Long;
1567
+
1450
1568
  /**
1451
1569
  * Creates a new StreamOutStatus instance using the specified properties.
1452
1570
  * @param [properties] Properties to set