jsgar 4.1.0 → 4.3.1

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 (3) hide show
  1. package/dist/gar.umd.js +24 -12
  2. package/gar.js +24 -12
  3. package/package.json +1 -1
package/dist/gar.umd.js CHANGED
@@ -123,6 +123,7 @@
123
123
  /**
124
124
  * Reset all connection-related state:
125
125
  * server/client topic/key mappings, counters, grace flags, and records.
126
+ * Note: Clients must call this to safely reconnect before running start() on a separate thread
126
127
  */
127
128
  clearConnectionState() {
128
129
  // Server assigned topic/key <-> name mappings
@@ -155,9 +156,6 @@
155
156
  * @param {number} [openTimeout=20] - Connection timeout in seconds
156
157
  */
157
158
  async connect(openTimeout = 20) {
158
- // Before attempting a new connection, clear any previous state
159
- this.clearConnectionState();
160
-
161
159
  let scaledOpenTimeout = openTimeout * this.timeoutScale;
162
160
 
163
161
  while (this.running && !this.connected) {
@@ -521,6 +519,9 @@
521
519
  * Start the client and send introduction message.
522
520
  */
523
521
  start() {
522
+ // Before attempting a new connection, clear any previous state
523
+ this.clearConnectionState();
524
+
524
525
  this.running = true;
525
526
  const introMsg = {
526
527
  message_type: 'Introduction',
@@ -916,7 +917,8 @@
916
917
  * @param {string|null} [excludeKeyFilter=null] - Exclude key filter regex (cannot use with keyName)
917
918
  * @param {string|null} [excludeTopicFilter=null] - Exclude topic filter regex (cannot use with topicName)
918
919
  * @param {string|null} [maxHistory] - Maximum history to include
919
- * @param {boolean} [includeDerived=false] - Include derived topics
920
+ * @param {boolean} [excludeDerived=false] - Exclude derived topics (derived topics are included by default)
921
+ * @param {boolean} [includeHeavy=false] - Include heavy derived topics (comprehensions, array-typed, heavy functions)
920
922
  * @param {boolean} [trimDefaultValues=false] - Trim records containing default values from the snapshot
921
923
  * @param {string|null} [workingNamespace] - Namespace for matching relative paths
922
924
  * @param {string|Array<string>|null} [restrictNamespace] - Restricts topics and keys to children of these namespaces (union). Defaults to the working namespace. Use ["::"] for root / no restriction.
@@ -940,7 +942,8 @@
940
942
  excludeKeyFilter = null,
941
943
  excludeTopicFilter = null,
942
944
  maxHistory = null,
943
- includeDerived = false,
945
+ excludeDerived = false,
946
+ includeHeavy = false,
944
947
  trimDefaultValues = false,
945
948
  workingNamespace = null,
946
949
  restrictNamespace = null,
@@ -1028,8 +1031,11 @@
1028
1031
  if (density) {
1029
1032
  valueDict.density = density;
1030
1033
  }
1031
- if (includeDerived) {
1032
- valueDict.include_derived = includeDerived;
1034
+ if (excludeDerived) {
1035
+ valueDict.exclude_derived = excludeDerived;
1036
+ }
1037
+ if (includeHeavy) {
1038
+ valueDict.include_heavy = includeHeavy;
1033
1039
  }
1034
1040
  if (restrictNamespace) {
1035
1041
  valueDict.restrict_namespace = typeof restrictNamespace === 'string' ? [restrictNamespace] : restrictNamespace;
@@ -1114,6 +1120,8 @@
1114
1120
  null,
1115
1121
  false,
1116
1122
  false,
1123
+ false,
1124
+ null,
1117
1125
  null,
1118
1126
  null,
1119
1127
  null,
@@ -1306,7 +1314,7 @@
1306
1314
  * @param {string|null} [workingNamespace]
1307
1315
  * @param {string|Array<string>|null} [restrictNamespace]
1308
1316
  * @param {string|Array<string>|null} [excludeNamespace]
1309
- * @param {boolean} [includeDerived=false]
1317
+ * @param {boolean} [excludeDerived=false]
1310
1318
  * @param {number} [timeout=10.0] seconds
1311
1319
  * @param {number} [subscriptionGroupServerKeys=650704]
1312
1320
  * @param {number} [subscriptionGroupServerRecords=650705]
@@ -1324,7 +1332,7 @@
1324
1332
  workingNamespace = null,
1325
1333
  restrictNamespace = null,
1326
1334
  excludeNamespace = null,
1327
- includeDerived = false,
1335
+ excludeDerived = false,
1328
1336
  timeout = 10.0,
1329
1337
  subscriptionGroupServerKeys = 650704,
1330
1338
  subscriptionGroupServerRecords = 650705,
@@ -1346,7 +1354,7 @@
1346
1354
  if (excludeKeyFilter != null) recordFilter.exclude_key_filter_regex = excludeKeyFilter;
1347
1355
  if (topicFilter != null) recordFilter.topic_filter_regex = topicFilter;
1348
1356
  if (excludeTopicFilter != null) recordFilter.exclude_topic_filter_regex = excludeTopicFilter;
1349
- if (includeDerived) recordFilter.include_derived = includeDerived;
1357
+ if (excludeDerived) recordFilter.exclude_derived = excludeDerived;
1350
1358
  if (Array.isArray(historyTypes)) recordFilter.history_types = historyTypes;
1351
1359
 
1352
1360
  const resultContainer = { };
@@ -1404,11 +1412,13 @@
1404
1412
  null,
1405
1413
  null,
1406
1414
  null,
1407
- true,
1415
+ false,
1416
+ false,
1408
1417
  false,
1409
1418
  'g::deployment::Server',
1410
1419
  null,
1411
1420
  null,
1421
+ null,
1412
1422
  subscriptionGroupServerRecords,
1413
1423
  );
1414
1424
  };
@@ -1452,11 +1462,13 @@
1452
1462
  null,
1453
1463
  null,
1454
1464
  null,
1455
- true,
1465
+ false,
1466
+ false,
1456
1467
  false,
1457
1468
  'g::deployment::RecordFilter',
1458
1469
  null,
1459
1470
  null,
1471
+ null,
1460
1472
  subscriptionGroupServerKeys,
1461
1473
  );
1462
1474
 
package/gar.js CHANGED
@@ -117,6 +117,7 @@ class GARClient {
117
117
  /**
118
118
  * Reset all connection-related state:
119
119
  * server/client topic/key mappings, counters, grace flags, and records.
120
+ * Note: Clients must call this to safely reconnect before running start() on a separate thread
120
121
  */
121
122
  clearConnectionState() {
122
123
  // Server assigned topic/key <-> name mappings
@@ -149,9 +150,6 @@ class GARClient {
149
150
  * @param {number} [openTimeout=20] - Connection timeout in seconds
150
151
  */
151
152
  async connect(openTimeout = 20) {
152
- // Before attempting a new connection, clear any previous state
153
- this.clearConnectionState();
154
-
155
153
  let scaledOpenTimeout = openTimeout * this.timeoutScale;
156
154
 
157
155
  while (this.running && !this.connected) {
@@ -515,6 +513,9 @@ class GARClient {
515
513
  * Start the client and send introduction message.
516
514
  */
517
515
  start() {
516
+ // Before attempting a new connection, clear any previous state
517
+ this.clearConnectionState();
518
+
518
519
  this.running = true;
519
520
  const introMsg = {
520
521
  message_type: 'Introduction',
@@ -910,7 +911,8 @@ class GARClient {
910
911
  * @param {string|null} [excludeKeyFilter=null] - Exclude key filter regex (cannot use with keyName)
911
912
  * @param {string|null} [excludeTopicFilter=null] - Exclude topic filter regex (cannot use with topicName)
912
913
  * @param {string|null} [maxHistory] - Maximum history to include
913
- * @param {boolean} [includeDerived=false] - Include derived topics
914
+ * @param {boolean} [excludeDerived=false] - Exclude derived topics (derived topics are included by default)
915
+ * @param {boolean} [includeHeavy=false] - Include heavy derived topics (comprehensions, array-typed, heavy functions)
914
916
  * @param {boolean} [trimDefaultValues=false] - Trim records containing default values from the snapshot
915
917
  * @param {string|null} [workingNamespace] - Namespace for matching relative paths
916
918
  * @param {string|Array<string>|null} [restrictNamespace] - Restricts topics and keys to children of these namespaces (union). Defaults to the working namespace. Use ["::"] for root / no restriction.
@@ -934,7 +936,8 @@ class GARClient {
934
936
  excludeKeyFilter = null,
935
937
  excludeTopicFilter = null,
936
938
  maxHistory = null,
937
- includeDerived = false,
939
+ excludeDerived = false,
940
+ includeHeavy = false,
938
941
  trimDefaultValues = false,
939
942
  workingNamespace = null,
940
943
  restrictNamespace = null,
@@ -1022,8 +1025,11 @@ class GARClient {
1022
1025
  if (density) {
1023
1026
  valueDict.density = density;
1024
1027
  }
1025
- if (includeDerived) {
1026
- valueDict.include_derived = includeDerived;
1028
+ if (excludeDerived) {
1029
+ valueDict.exclude_derived = excludeDerived;
1030
+ }
1031
+ if (includeHeavy) {
1032
+ valueDict.include_heavy = includeHeavy;
1027
1033
  }
1028
1034
  if (restrictNamespace) {
1029
1035
  valueDict.restrict_namespace = typeof restrictNamespace === 'string' ? [restrictNamespace] : restrictNamespace;
@@ -1108,6 +1114,8 @@ class GARClient {
1108
1114
  null,
1109
1115
  false,
1110
1116
  false,
1117
+ false,
1118
+ null,
1111
1119
  null,
1112
1120
  null,
1113
1121
  null,
@@ -1300,7 +1308,7 @@ class GARClient {
1300
1308
  * @param {string|null} [workingNamespace]
1301
1309
  * @param {string|Array<string>|null} [restrictNamespace]
1302
1310
  * @param {string|Array<string>|null} [excludeNamespace]
1303
- * @param {boolean} [includeDerived=false]
1311
+ * @param {boolean} [excludeDerived=false]
1304
1312
  * @param {number} [timeout=10.0] seconds
1305
1313
  * @param {number} [subscriptionGroupServerKeys=650704]
1306
1314
  * @param {number} [subscriptionGroupServerRecords=650705]
@@ -1318,7 +1326,7 @@ class GARClient {
1318
1326
  workingNamespace = null,
1319
1327
  restrictNamespace = null,
1320
1328
  excludeNamespace = null,
1321
- includeDerived = false,
1329
+ excludeDerived = false,
1322
1330
  timeout = 10.0,
1323
1331
  subscriptionGroupServerKeys = 650704,
1324
1332
  subscriptionGroupServerRecords = 650705,
@@ -1340,7 +1348,7 @@ class GARClient {
1340
1348
  if (excludeKeyFilter != null) recordFilter.exclude_key_filter_regex = excludeKeyFilter;
1341
1349
  if (topicFilter != null) recordFilter.topic_filter_regex = topicFilter;
1342
1350
  if (excludeTopicFilter != null) recordFilter.exclude_topic_filter_regex = excludeTopicFilter;
1343
- if (includeDerived) recordFilter.include_derived = includeDerived;
1351
+ if (excludeDerived) recordFilter.exclude_derived = excludeDerived;
1344
1352
  if (Array.isArray(historyTypes)) recordFilter.history_types = historyTypes;
1345
1353
 
1346
1354
  const resultContainer = { };
@@ -1398,11 +1406,13 @@ class GARClient {
1398
1406
  null,
1399
1407
  null,
1400
1408
  null,
1401
- true,
1409
+ false,
1410
+ false,
1402
1411
  false,
1403
1412
  'g::deployment::Server',
1404
1413
  null,
1405
1414
  null,
1415
+ null,
1406
1416
  subscriptionGroupServerRecords,
1407
1417
  );
1408
1418
  };
@@ -1446,11 +1456,13 @@ class GARClient {
1446
1456
  null,
1447
1457
  null,
1448
1458
  null,
1449
- true,
1459
+ false,
1460
+ false,
1450
1461
  false,
1451
1462
  'g::deployment::RecordFilter',
1452
1463
  null,
1453
1464
  null,
1465
+ null,
1454
1466
  subscriptionGroupServerKeys,
1455
1467
  );
1456
1468
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsgar",
3
- "version": "4.1.0",
3
+ "version": "4.3.1",
4
4
  "description": "A Javascript client for the GAR protocol",
5
5
  "type": "module",
6
6
  "main": "dist/gar.umd.js",