@nanolink/mirrors 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -1,30 +1,37 @@
1
1
  # @nanolink/mirrors
2
2
 
3
- GraphQL subscription client + mirror synchronization helper utilities.
3
+ GraphQL subscription client + in‑memory mirror synchronization utilities. Optimized for incremental change streams that send START / UPDATED / DELETED / DONE / VERSION_ERROR frames.
4
4
 
5
5
  ## Features
6
- - Lightweight `SubscriptionClient` around `graphql-ws` with manual reconnect & lifecycle events.
7
- - `MirrorSync` keeps a local in‑memory mirror using START / UPDATED / DELETED / DONE / VERSION_ERROR messages.
8
- - Deferred `loaded` promise resolves after first full sync DONE.
9
- - Automatic resubscribe after reconnect (from last version) without duplicating items.
10
- - Read‑only delegated map interface for safe consumer access.
11
- - `Connection` helper to manage multiple named mirrors and re‑emit namespaced events (`mirror:start`, `mirror:updated`, ...).
12
- - Optional global proxy support via `global-agent` (enable before creating the client).
6
+ * Lightweight `SubscriptionClient` around `graphql-ws` with explicit connect, controlled reconnect, and small event surface.
7
+ * Dual version support in `MirrorSync` (`version` numeric + `opVersion` string) for hybrid sequence + causality ordering (either dimension can drive resync logic).
8
+ * Stale delete & update guards: ignores events older in either version dimension to prevent resurrecting removed or outdated entities.
9
+ * Efficient updates: UPDATED replaces item wholesale only when newer; no deep merge overhead.
10
+ * Full sync cycle handling via START/DONE gates; `loaded` promise resolves after first DONE and re-arms on VERSION_ERROR.
11
+ * Automatic resubscribe after reconnect using last known versions (no duplicate inserts).
12
+ * Read‑only delegated map interface for consumers (prevents accidental mutation of internal state).
13
+ * `Connection` helper manages multiple mirrors, re‑emitting namespaced events (`mirror:start`, `mirror:updated`, ...).
14
+ * Proxy-aware WebSocket resolution: if proxy env vars are present (ALL_PROXY / HTTPS_PROXY / HTTP_PROXY / GLOBAL_AGENT_HTTP_PROXY) the client prefers the Node `ws` implementation; otherwise uses existing global WebSocket (browser / Node >=18) or falls back to `ws`.
15
+ * Minimal dependencies; event system via `eventemitter3`.
13
16
 
14
17
  ## Install
15
- ```
18
+ ```bash
16
19
  npm install @nanolink/mirrors
17
20
  ```
18
21
 
19
- If you need a proxy:
22
+ Optional (proxy via global-agent for generic HTTP(S) requests—WebSocket selection is still handled automatically as described):
20
23
  ```js
21
- // enableGlobalProxy.js
24
+ // enableProxy.js
22
25
  import 'global-agent/bootstrap';
23
26
  process.env.GLOBAL_AGENT_HTTP_PROXY = 'http://proxy:3128';
24
27
  ```
25
- Run node with: `node -r global-agent/bootstrap yourApp.js`
28
+ Run with:
29
+ ```bash
30
+ node -r global-agent/bootstrap app.js
31
+ ```
26
32
 
27
33
  ## Usage
34
+ ### Quick (multi‑mirror connection)
28
35
  ```ts
29
36
  import { Connection } from '@nanolink/mirrors';
30
37
 
@@ -32,42 +39,89 @@ const conn = new Connection('https://api.example.com', 'TOKEN');
32
39
  conn.connect();
33
40
 
34
41
  conn.on('connected', () => console.log('socket up'));
35
- conn.on('mirror:updated', e => console.log('item updated', e.mirrorName, e.item.id));
42
+ conn.on('mirror:updated', e => console.log('updated', e.mirrorName, e.item.id));
36
43
 
37
- async function start() {
44
+ async function main() {
38
45
  const users = await conn.getMirror('users', /* GraphQL subscription */ `
39
- subscription Users($version: Long!) {
40
- users(version: $version) { type total deleteId deleteVersion data { id version name } }
46
+ subscription Users($version: Long, $opVersion: String) {
47
+ users(version: $version, opVersion: $opVersion) {
48
+ type
49
+ total
50
+ deleteId
51
+ deleteVersion
52
+ deleteOpVersion
53
+ data { id version opVersion name }
54
+ }
41
55
  }
42
56
  `, {});
43
57
 
44
- // Waits until first DONE; then you can read:
45
58
  console.log('Initial size', users.size);
46
- for (const [id, user] of users) console.log(user);
59
+ for (const user of users.values()) {
60
+ console.log(user);
61
+ }
47
62
  }
48
- start();
63
+ main();
64
+ ```
65
+
66
+ ### Direct low‑level client
67
+ ```ts
68
+ import { SubscriptionClient } from '@nanolink/mirrors';
69
+
70
+ const sc = new SubscriptionClient({ url: 'https://api.example.com', maxReconnectAttempts: 10 });
71
+ sc.connect();
72
+ sc.on('connected', () => {
73
+ const dispose = sc.subscribe({
74
+ query: 'subscription Ping { ping }'
75
+ }, {
76
+ next: (msg) => console.log(msg),
77
+ error: (e) => console.error('err', e),
78
+ complete: () => console.log('done')
79
+ });
80
+ });
49
81
  ```
50
82
 
51
83
  ## Events
52
84
  `SubscriptionClient` emits:
53
- - connecting, connected, reconnected, disconnected, retry, error
85
+ * connecting
86
+ * connected (first successful connect)
87
+ * reconnected (subsequent successful connect after a disconnect)
88
+ * disconnected ({ code, reason, wasClean })
89
+ * retry ({ attempt }) before a reconnect attempt delay
90
+ * error (network/protocol)
54
91
 
55
92
  `Connection` re‑emits mirror events as `mirror:<event>` with payload `{ mirrorName, ... }`:
56
- - start, updated, deleted, done, versionError, resubscribe, error, removed, cleared
93
+ * start
94
+ * updated (only when a newer item actually replaced stored data)
95
+ * deleted
96
+ * done (end of full sync batch)
97
+ * versionError (triggered resync)
98
+ * resubscribe (automatic after reconnect)
99
+ * error
100
+ * removed (mirror explicitly removed)
101
+ * cleared (mirror internal state cleared)
57
102
 
58
103
  ## API Surface
59
- - `SubscriptionClient` - low level client (call `connect()` then `subscribe()`)
60
- - `MirrorSync` - single mirror controller (normally use via `Connection.getMirror()`)
61
- - `Connection` - multi‑mirror manager extending `SubscriptionClient`
62
- - `ReadonlyMapView` - interface returned by `getMirror()` / `MirrorSync.load()`
104
+ * `SubscriptionClient` low level websocket subscription wrapper.
105
+ * `MirrorSync` single mirror controller (dual version tracking).
106
+ * `Connection` manages multiple mirrors + namespaced events.
107
+ * `ReadonlyMapView` immutable view returned by `getMirror()` / `MirrorSync.load()`.
63
108
 
64
109
  ## Notes
65
- - Always call `connect()` explicitly; there is no implicit lazy connect.
66
- - A VERSION_ERROR triggers an automatic full resync (resetting the loaded promise).
67
- - The first (and only the first) field in the GraphQL payload is used as the sync message wrapper.
110
+ * Always call `connect()` explicitly; no implicit lazy connect.
111
+ * VERSION_ERROR triggers automatic full resync (re-arms `loaded`).
112
+ * First top-level field in GraphQL subscription payload is treated as the sync envelope.
113
+ * Provide `webSocketImpl` manually if bundling for environments without a global WebSocket and you do NOT want `ws` as fallback.
114
+ * When proxy env vars are set in Node, `SubscriptionClient` prefers `ws` (allowing external agent configuration); browsers ignore these env vars.
68
115
 
69
- ## Build
70
- TypeScript compiles to `dist/`. Published package exposes `dist/index.js` and types.
116
+ ## Build & Publish
117
+ TypeScript sources compile to `dist/`.
118
+
119
+ Scripts:
120
+ ```bash
121
+ npm run build # compile
122
+ npm run publish:dry # preview publish contents
123
+ npm run release # build + publish (public)
124
+ ```
71
125
 
72
126
  ## License
73
127
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nanolink/mirrors",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "GraphQL subscription client + mirror synchronization utilities.",
5
5
  "license": "MIT",
6
6
  "author": "Nanolink ApS, Mogens Bak Nielsen",
@@ -13,9 +13,9 @@
13
13
  "dev": "tsx watch src/index.ts",
14
14
  "start": "node dist/index.js",
15
15
  "typecheck": "tsc -p . --noEmit",
16
- "prepublishOnly": "npm run build",
17
- "publish:dry": "npm publish --dry-run",
18
- "release": "npm run build && npm publish --access public",
16
+ "prepublishOnly": "npm run build",
17
+ "publish:dry": "npm publish --dry-run",
18
+ "release": "npm run build && npm publish --access public",
19
19
  "test": "echo \"No tests\""
20
20
  },
21
21
  "devDependencies": {
package/dist/mirrors.d.ts DELETED
@@ -1,38 +0,0 @@
1
- export declare const Subscriptions: {
2
- references: string;
3
- trackers: string;
4
- groups: string;
5
- servicePlans: string;
6
- trackerLinks: string;
7
- referenceLinks: string;
8
- lostTransmitters: string;
9
- reports: string;
10
- jobs: string;
11
- cycles: string;
12
- meshDiagnostics: string;
13
- gps: string;
14
- linkconnected: string;
15
- connected: string;
16
- voltage: string;
17
- internalvoltage: string;
18
- unplug: string;
19
- temperature: string;
20
- meshscanner: string;
21
- meshdisconnectslasthour: string;
22
- activecounter: string;
23
- workseconds: string;
24
- calculatedodometer: string;
25
- batterypercent: string;
26
- workignition: string;
27
- tripignition: string;
28
- activecycles: string;
29
- activesteps: string;
30
- referenceGeoLinks: string;
31
- trips: string;
32
- messages: string;
33
- };
34
- export declare const RequiredMirrors: {
35
- systemSettings: string;
36
- settings: string;
37
- };
38
- export declare const TempSubscriptions: {};
package/dist/mirrors.js DELETED
@@ -1,1044 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TempSubscriptions = exports.RequiredMirrors = exports.Subscriptions = void 0;
4
- const commonFields = 'id:idStr version createdDateTime';
5
- const commonReferenceFields = 'groupId groupName groupPath labels canAnonymize tokenCount';
6
- const lastLogFields = 'id eventCode stamp serviceDataId userId comment';
7
- const serviceDataCommonFields = `id createdDateTime servicePlanId userId lastServiceDate lastLog {${lastLogFields}}`;
8
- const mCommonFields = 'type total deleteId deleteVersion';
9
- const mServiceCommonFields = `name description createdDate createdBy ${commonFields}`;
10
- exports.Subscriptions = {
11
- references: `
12
- subscription References($version:Int!) {
13
- mreference_getbulk(version: $version, subscribe:true)
14
- {
15
- ${mCommonFields}
16
- data {
17
- __typename
18
- ... on QMUser {
19
- ${commonFields}
20
- ${commonReferenceFields}
21
- mobilePhoneNumber
22
- mobileCountryCode
23
- firstName
24
- middleName
25
- lastName
26
- fullName
27
- email
28
- documents {
29
- id name url createdDate mimeType fileName
30
- }
31
- serviceData {
32
- __typename
33
- ... on QMServiceDataOneshot { ${serviceDataCommonFields} due dueSlackInDays }
34
- ... on QMServiceDataPeriodic { ${serviceDataCommonFields} startDate lastServiceDate period intervalType due dueSlackInDays }
35
- ... on QMServiceDataWarranty { ${serviceDataCommonFields} purchaseDate warrantyInMonths due dueSlackInDays }
36
- ... on QMServiceDataTrackerStateInt { ${serviceDataCommonFields} dueSlackSeconds : dueSlack nextDueSeconds : nextDue trackerVID }
37
- ... on QMServiceDataTrackerStateDouble { ${serviceDataCommonFields} dueSlackKM : dueSlack nextDueKM : nextDue trackerVID }
38
- },
39
- isAzureADUser
40
- authProvider
41
- externalKeys
42
- externalIds { key value }
43
- externalBag
44
- deleted
45
- }
46
- ... on QMAsset {
47
- ${commonFields}
48
- ${commonReferenceFields}
49
- brand
50
- model
51
- keyWords
52
- description
53
- serial
54
- documents {
55
- id name url createdDate mimeType fileName
56
- }
57
- serviceData {
58
- __typename
59
- ... on QMServiceDataOneshot { ${serviceDataCommonFields} due dueSlackInDays }
60
- ... on QMServiceDataPeriodic { ${serviceDataCommonFields} startDate lastServiceDate period intervalType due dueSlackInDays }
61
- ... on QMServiceDataWarranty { ${serviceDataCommonFields} purchaseDate warrantyInMonths due dueSlackInDays }
62
- ... on QMServiceDataTrackerStateInt { ${serviceDataCommonFields} dueSlackSeconds : dueSlack nextDueSeconds : nextDue trackerVID }
63
- ... on QMServiceDataTrackerStateDouble { ${serviceDataCommonFields} dueSlackKM : dueSlack nextDueKM : nextDue trackerVID }
64
- }
65
- externalKeys
66
- externalIds { key value }
67
- externalBag
68
- deleted
69
- }
70
- ... on QMVehicle {
71
- ${commonFields}
72
- ${commonReferenceFields}
73
- documents {
74
- id name url createdDate mimeType fileName
75
- }
76
- serviceData {
77
- __typename
78
- ... on QMServiceDataOneshot { ${serviceDataCommonFields} due dueSlackInDays }
79
- ... on QMServiceDataPeriodic { ${serviceDataCommonFields} startDate lastServiceDate period intervalType due dueSlackInDays }
80
- ... on QMServiceDataWarranty { ${serviceDataCommonFields} purchaseDate warrantyInMonths due dueSlackInDays }
81
- ... on QMServiceDataTrackerStateInt { ${serviceDataCommonFields} dueSlackSeconds : dueSlack nextDueSeconds : nextDue trackerVID }
82
- ... on QMServiceDataTrackerStateDouble { ${serviceDataCommonFields} dueSlackKM : dueSlack nextDueKM : nextDue trackerVID }
83
- }
84
- externalKeys
85
- externalIds { key value }
86
- externalBag
87
- deleted
88
- registration
89
- registrationStatus
90
- vin
91
- brand
92
- brandId
93
- model
94
- modelId
95
- serial
96
- modelYear
97
- keyWords
98
- description
99
- variant
100
- variantId
101
- vVersion
102
- vVersionId
103
- bodyType
104
- usage
105
- extended {
106
- category
107
- ecTypeApproval
108
- euVariant
109
- euVersion
110
- extraEquipment
111
- firstRegistrationDate
112
- fuelType
113
- kind
114
- lastInspectionDate
115
- lastInspectionKind
116
- lastInspectionResult
117
- leasingPeriodEnd
118
- leasingPeriodStart
119
- mileage
120
- mileageAnnualAverage
121
- ncapFive
122
- registrationStatusUpdatedAt
123
- status
124
- statusUpdatedAt
125
- weight {
126
- technicalTotalWeight
127
- totalWeight
128
- vehicleWeight
129
- driveableWeightMinimum
130
- driveableWeightMaximum
131
- vValueAirSuspension
132
- vValueMechanicalSuspension
133
- roadTrainWeight
134
- couplingDevice
135
- couplingDeviceLoadMaximum
136
- trailerWithBrakesWeightMaximum
137
- trailerWithoutBrakesWeightMaximum
138
- trailerTotalWeightMaximum
139
- division
140
- }
141
- age {
142
- years
143
- months
144
- }
145
- axle {
146
- axles
147
- axleTrack
148
- pullingAxlesString
149
- driveShaftPressureMaximum
150
- trailerAllowedPressureMaximum
151
- }
152
- body {
153
- doors
154
- vinPlacement
155
- trackWidthFront
156
- trackWidthRear
157
- passengers
158
- seatsMinimum
159
- seatsMaximum
160
- standingPassengersMinimum
161
- standingPassengersMaximum
162
- rimsAndTires
163
- color
164
- }
165
- periodicTaxes {
166
- taxes {
167
- name
168
- amount
169
- paymentFrequency
170
- }
171
- totalAmount
172
- paymentFrequency
173
- }
174
- leasingPeriods {
175
- leasingPeriodStart
176
- leasingPeriodEnd
177
- }
178
- permits {
179
- id
180
- name
181
- comment
182
- validFrom
183
- validTo
184
- }
185
- manufacturer {
186
- name
187
- region
188
- country
189
- }
190
- drivingLicense {
191
- category
192
- }
193
- emission {
194
- co2
195
- co
196
- hcPlusNox
197
- nox
198
- particles
199
- particleFilter
200
- smokeDensity
201
- smokeDensityEngineSpeed
202
- energyClass
203
- euronorm
204
- }
205
- engine {
206
- fuelEfficiency
207
- electricityEfficiency
208
- topSpeed
209
- fuelType
210
- cylinders
211
- engineCode
212
- engineDisplacement
213
- enginePower
214
- horsepower
215
- powerToWeightRatio
216
- }
217
- equipment {
218
- id
219
- name
220
- quantity
221
- }
222
- inspections {
223
- id
224
- vehicleId
225
- registration
226
- vin
227
- date
228
- result
229
- mileage
230
- pdf
231
- }
232
- }
233
- }
234
- ... on QMSite {
235
- ${commonFields}
236
- ${commonReferenceFields}
237
- name
238
- type
239
- geoArea {
240
- longitude
241
- latitude
242
- }
243
- documents {
244
- id name url createdDate mimeType fileName
245
- }
246
- serviceData {
247
- __typename
248
- ... on QMServiceDataOneshot { ${serviceDataCommonFields} due dueSlackInDays }
249
- ... on QMServiceDataPeriodic { ${serviceDataCommonFields} startDate lastServiceDate period intervalType due dueSlackInDays }
250
- ... on QMServiceDataWarranty { ${serviceDataCommonFields} purchaseDate warrantyInMonths due dueSlackInDays }
251
- ... on QMServiceDataTrackerStateInt { ${serviceDataCommonFields} dueSlackSeconds : dueSlack nextDueSeconds : nextDue trackerVID }
252
- ... on QMServiceDataTrackerStateDouble { ${serviceDataCommonFields} dueSlackKM : dueSlack nextDueKM : nextDue trackerVID }
253
- }
254
- externalKeys
255
- externalIds { key value }
256
- externalBag
257
- deleted
258
- }
259
- }
260
- }
261
- }`,
262
- trackers: `
263
- subscription Trackers($version:Int!) {
264
- mtrackers_getbulk(version: $version, subscribe:true)
265
- {
266
- ${mCommonFields}
267
- data
268
- {
269
- ${commonFields}
270
- objId: id
271
- vID
272
- pID
273
- key
274
- type
275
- model
276
- revision
277
- trackerName
278
- referenceId
279
- deleted
280
- }
281
- }
282
- }`,
283
- groups: `
284
- subscription Groups($version:Int!)
285
- {
286
- mcommon_getgroups(version: $version, subscribe: true)
287
- {
288
- ${mCommonFields}
289
- data {
290
- id:idStr
291
- version
292
- parentId
293
- name
294
- level
295
- type
296
- }
297
- }
298
- }`,
299
- servicePlans: `
300
- subscription Service($version: Int!)
301
- {
302
- mservice_get(version: $version, subscribe: true)
303
- {
304
- ${mCommonFields}
305
- data {
306
- __typename
307
- ... on QMServicePlanOneshot
308
- {
309
- ${mServiceCommonFields}
310
- dueSlackInDays
311
- deleted
312
- }
313
- ... on QMServicePlanPeriodic {
314
- ${mServiceCommonFields}
315
- dueSlackInDays
316
- period
317
- intervalType
318
- deleted
319
- }
320
- ... on QMServicePlanWarranty {
321
- ${mServiceCommonFields}
322
- dueSlackInDays
323
- warrantyInMonths
324
- deleted
325
- }
326
- ... on QMServicePlanKM {
327
- ${mServiceCommonFields}
328
- dueSlackKM : dueSlack
329
- intervalKM : interval
330
- deleted
331
- }
332
- ... on QMServicePlanWorkSeconds {
333
- ${mServiceCommonFields}
334
- dueSlackSeconds : dueSlack
335
- intervalSeconds : interval
336
- deleted
337
- }
338
- }
339
- }
340
- }`,
341
- trackerLinks: `
342
- subscription BLELinks($opVersion: String)
343
- {
344
- otrackers_getlinksbulk(opversion: $opVersion, subscribe: true, subscriberssiupdates: true)
345
- {
346
- ${mCommonFields}
347
- data {
348
- id
349
- createdDateTime: creationTime
350
- receiverVID
351
- rSSI
352
- transmitterVID
353
- opVersion
354
- deleted
355
- disabled
356
- }
357
- }
358
- }`,
359
- referenceLinks: `
360
- subscription ReferenceLink($version: Int!, $opVersion: String)
361
- {
362
- oreference_getlinks(version: $version, opversion: $opVersion, subscribe: true)
363
- {
364
- ${mCommonFields}
365
- data {
366
- id
367
- type
368
- createdDateTime: creationTime
369
- referenceId1
370
- referenceId2
371
- autoGenerated
372
- version,
373
- opVersion,
374
- deleted
375
- }
376
- }
377
- }`,
378
- lostTransmitters: `
379
- subscription lostTransmitters($opVersion: String) {
380
- otrackers_losttransmitters(
381
- subscribe: true
382
- opversion: $opVersion
383
- ) {
384
- type
385
- total
386
- deleteId
387
- data {
388
- id:transmitterVID
389
- opVersion
390
- transmitterReferenceGroupId
391
- transmitterReferenceType
392
- transmitterReferenceGroupPath
393
- lostBy {
394
- transmitterVID
395
- receiverVID
396
- startTime
397
- endTime
398
- locationInfo {
399
- date
400
- speed
401
- bearing
402
- accuracy
403
- altitude
404
- longitude
405
- latitude
406
- }
407
- receiverTrackerType
408
- }
409
- }
410
- deleteVersion
411
- }
412
- }
413
- `,
414
- reports: `
415
- subscription Reports($version: Int!) {
416
- mreports_getreport(version: $version, subscribe: true)
417
- {
418
- ${mCommonFields}
419
- data {
420
- id
421
- name
422
- description
423
- route
424
- version
425
- }
426
- }
427
- }
428
- `,
429
- jobs: `subscription jobs($version: Int!) {
430
- mjob_get(version:$version, subscribe: true) {
431
- ${mCommonFields}
432
- data {
433
- id
434
- createdDateTime
435
- name
436
- description
437
- version
438
- disabled
439
- deleted
440
- trigger {
441
- __typename
442
- ... on QMJobTriggerAssetFound {
443
- assetId
444
- }
445
- ... on QMJobTriggerOneshot {
446
- when
447
- }
448
- ... on QMJobTriggerScheduleTimeOfDay {
449
- startTime
450
- period
451
- lastRun
452
- interval
453
- }
454
- ... on QMJobTriggerMonitor
455
- {
456
- initialCount
457
- initialCheck
458
- url
459
- }
460
- ... on QMJobTriggerReferenceLost
461
- {
462
- referenceId
463
- trackerVID
464
- }
465
- }
466
- action {
467
- __typename
468
- ... on QMJobActionAssetFoundMail {
469
- actionType
470
- assetId
471
- references
472
- groups
473
- }
474
- ... on QMJobActionReport {
475
- actionType
476
- reports {
477
- reportId
478
- args {name value }
479
- }
480
- groups
481
- references
482
- dontSendEmptyReport
483
- }
484
- ... on QMJobActionSMS {
485
- actionType
486
- userId
487
- }
488
- }
489
- }
490
- }
491
- }`,
492
- cycles: `subscription cycles($version: Int!) {
493
- mcycle_getcycles(version: $version, subscribe: true) {
494
- ${mCommonFields}
495
- data {
496
- id
497
- name
498
- isActive
499
- labelFilter
500
- startStepId
501
- stopStepId
502
- cancelStepId
503
- deleted
504
- version
505
- steps {
506
- stepId
507
- name
508
- estimateDurationInSeconds
509
- displayOrder
510
- onlyOnce
511
- enterRules {
512
- __typename
513
- ... on QMFlowRuleOnExitSteps {
514
- ruleId
515
- exitStepIds
516
- }
517
- ... on QMTrackingEnterRuleReferenceLink {
518
- ruleId
519
- referenceIds
520
- gracePeriodInSeconds
521
- whenActive
522
- }
523
- ... on QMEnterRuleOnReferenceCreate {
524
- ruleId
525
- }
526
- ... on QMFlowForeignEnterRuleOnEnter {
527
- foreignCycleRelations{
528
- foreignCycleId
529
- foreignStepId
530
- }
531
- ruleId
532
- }
533
- ... on QMTrackingEnterRuleNearestReferenceLink {
534
- referenceIds
535
- ruleId
536
- gracePeriodInSeconds
537
- }
538
- }
539
- exitRules {
540
- __typename
541
- ... on QMFlowRuleOnEnterSteps {
542
- ruleId
543
- enterStepIds
544
- }
545
- ... on QMTrackingExitRuleReferenceLink {
546
- ruleId
547
- referenceIds
548
- gracePeriodInSeconds
549
- whenActive
550
- }
551
- ... on QMFlowForeignExitRuleOnEnter {
552
- foreignCycleRelations {
553
- foreignCycleId
554
- foreignStepId
555
- }
556
- ruleId
557
- }
558
- ... on QMTrackingExitRuleNearestReferenceLink {
559
- referenceIds
560
- ruleId
561
- gracePeriodInSeconds
562
- }
563
- }
564
- }
565
- }
566
- }
567
- }`,
568
- meshDiagnostics: `
569
- subscription meshdiagnostics($opVersion: String) {
570
- otrackers_meshdiagnostics(
571
- opversion: $opVersion,
572
- subscribe: true
573
- ) {
574
- type
575
- total
576
- deleteId
577
- data {
578
- id: vID
579
- vID
580
- stamp
581
- opVersion
582
- advertiserCost
583
- errorCodes
584
- nextHopAddress
585
- nextHopVID
586
- nextHopPower
587
- nextHopQuality
588
- nextHopRSSI
589
- qualityIndicator
590
- routersInNeighborhood
591
- sinkAddress
592
- sinkVID
593
- }
594
- deleteVersion
595
- }
596
- }
597
- `,
598
- gps: `
599
- subscription getpositionbulk($opVersion: String) {
600
- otrackers_getpositionsbulk(
601
- includeInitial: true
602
- subscribe: true
603
- opversion: $opVersion
604
- ) {
605
- type
606
- total
607
- deleteId
608
- data {
609
- opVersion
610
- referenceGroupId
611
- referenceType
612
- referenceGroupPath
613
- stamp
614
- locationInfo {
615
- date
616
- speed
617
- bearing
618
- accuracy
619
- altitude
620
- longitude
621
- latitude
622
- }
623
- isFixed
624
- id:trackerVID
625
- }
626
- deleteVersion
627
- }
628
- }
629
- `,
630
- linkconnected: `subscription linkconnected($opVersion: String) {
631
- otrackers_linkconnectedbulk(subscribe: true, includeInitial: true, opVersion: $opVersion) {
632
- type
633
- total
634
- deleteId
635
- data{
636
- id: vID
637
- opVersion
638
- when
639
- }
640
- deleteVersion
641
- }
642
- }`,
643
- connected: `subscription connected($opVersion: String) {
644
- otrackers_connectedbulk(subscribe: true, includeInitial: true, opVersion: $opVersion) {
645
- type
646
- total
647
- deleteId
648
- data{
649
- id: vID
650
- opVersion
651
- when
652
- }
653
- deleteVersion
654
- }
655
- }`,
656
- voltage: `subscription voltage($opVersion: String) {
657
- otrackers_infoanybulk(subscribe: true, includeInitial: true, fields:[EXTERNAL_VOLTAGE], opVersion: $opVersion) {
658
- type
659
- total
660
- deleteId
661
- deleteVersion
662
- data {
663
- id: vID
664
- opVersion
665
- field
666
- value
667
- stamp
668
- }
669
- }
670
- }`,
671
- internalvoltage: `subscription internalvoltage($opVersion: String) {
672
- otrackers_infoanybulk(subscribe: true, includeInitial: true, fields:[INTERNAL_VOLTAGE, BATTERY_LEVEL], opVersion: $opVersion) {
673
- type
674
- total
675
- deleteId
676
- deleteVersion
677
- data {
678
- id: vID
679
- opVersion
680
- field
681
- value
682
- stamp
683
- }
684
- }
685
- }`,
686
- unplug: `subscription unplug($opVersion: String) {
687
- otrackers_infoanybulk(subscribe: true, includeInitial: true, fields:[UNPLUG], opVersion: $opVersion) {
688
- type
689
- total
690
- deleteId
691
- deleteVersion
692
- data {
693
- id: vID
694
- opVersion
695
- field
696
- value
697
- stamp
698
- }
699
- }
700
- }`,
701
- temperature: `subscription temperature($opVersion: String) {
702
- otrackers_infoanybulk(subscribe: true, includeInitial: true, fields:[TEMPERATURE], opVersion: $opVersion) {
703
- type
704
- total
705
- deleteId
706
- deleteVersion
707
- data {
708
- id: vID
709
- opVersion
710
- value
711
- stamp
712
- }
713
- }
714
- }`,
715
- meshscanner: `subscription temperature($opVersion: String) {
716
- otrackers_infoanybulk(subscribe: true, includeInitial: true, fields:[MESH_GATE_ON], opVersion: $opVersion) {
717
- type
718
- total
719
- deleteId
720
- deleteVersion
721
- data {
722
- id: vID
723
- opVersion
724
- value
725
- stamp
726
- }
727
- }
728
- }`,
729
- meshdisconnectslasthour: `subscription disconnects($opVersion: String) {
730
- otrackers_infoanybulk(subscribe: true, includeInitial: true, fields:[DISCONNECTED_IN_THE_LAST_HOUR], opVersion: $opVersion) {
731
- type
732
- total
733
- deleteId
734
- deleteVersion
735
- data {
736
- id: vID
737
- opVersion
738
- value
739
- stamp
740
- }
741
- }
742
- }`,
743
- activecounter: `subscription activecounter($opVersion: String) {
744
- otrackers_infoanybulk(subscribe: true, includeInitial: true, fields:[ACTIVE_COUNTER], opVersion: $opVersion) {
745
- type
746
- total
747
- deleteId
748
- deleteVersion
749
- data {
750
- id: vID
751
- opVersion
752
- value
753
- stamp
754
- }
755
- }
756
- }`,
757
- workseconds: `subscription workseconds($opVersion: String) {
758
- otrackers_infoanybulk(subscribe: true, includeInitial: true, fields:[WORK_SECONDS], opVersion: $opVersion) {
759
- type
760
- total
761
- deleteId
762
- deleteVersion
763
- data {
764
- id: vID
765
- opVersion
766
- value
767
- stamp
768
- }
769
- }
770
- }`,
771
- calculatedodometer: `subscription calculatedodometer($opVersion: String) {
772
- otrackers_infoanybulk(subscribe: true, includeInitial: true, fields:[CALCULATED_ODOMETER], opVersion: $opVersion) {
773
- type
774
- total
775
- deleteId
776
- deleteVersion
777
- data {
778
- id: vID
779
- opVersion
780
- value
781
- stamp
782
- }
783
- }
784
- }`,
785
- batterypercent: `subscription batterypercent($opVersion: String) {
786
- otrackers_infoanybulk(subscribe: true, includeInitial: true, fields:[BATTERY_PERCENT], opVersion: $opVersion) {
787
- type
788
- total
789
- deleteId
790
- deleteVersion
791
- data {
792
- id: vID
793
- opVersion
794
- value
795
- stamp
796
- }
797
- }
798
- }`,
799
- workignition: `subscription workignition($opVersion: String) {
800
- otrackers_infoanybulk(subscribe: true, includeInitial: true, fields:[WORK_IGNITION], opVersion: $opVersion) {
801
- type
802
- total
803
- deleteId
804
- deleteVersion
805
- data {
806
- id: vID
807
- opVersion
808
- field
809
- value
810
- stamp
811
- }
812
- }
813
- }`,
814
- tripignition: `subscription tripignition($opVersion: String) {
815
- otrackers_infoanybulk(subscribe: true, includeInitial: true, fields:[TRIP_IGNITION], opVersion: $opVersion) {
816
- type
817
- total
818
- deleteId
819
- deleteVersion
820
- data {
821
- id: vID
822
- opVersion
823
- field
824
- value
825
- stamp
826
- }
827
- }
828
- }`,
829
- activecycles: `subscription activecycles($opVersion: String){
830
- ocycle_activecycles(
831
- includeInitial: true
832
- subscribe: true
833
- opversion: $opVersion
834
- ) {
835
- type
836
- total
837
- deleteId
838
- data {
839
- id
840
- cycleId
841
- startedAt
842
- finishedAt
843
- status
844
- referenceId
845
- opVersion
846
- }
847
- deleteVersion
848
- }
849
- }`,
850
- activesteps: `subscription activesteps($opVersion: String) {
851
- ocycle_activesteps(
852
- includeInitial: true
853
- subscribe: true
854
- opversion: $opVersion
855
- ) {
856
- type
857
- total
858
- deleteId
859
- data {
860
- id
861
- stepId
862
- name
863
- estimateDurationInSeconds
864
- displayOrder
865
- cycleStateId
866
- enterStamp
867
- exitStamp
868
- timeSpentInSeconds
869
- opVersion
870
- }
871
- deleteVersion
872
- },
873
- }
874
- `,
875
- referenceGeoLinks: `subscription referenceGeoLinks($opversion: String){
876
- oreference_getreferencegeolinksBulk(
877
- opversion: $opversion
878
- subscribe: true
879
- ) {
880
- type
881
- total
882
- deleteId
883
- data {
884
- id
885
- creationTime
886
- siteId
887
- referenceId
888
- opVersion
889
- deleted
890
- }
891
- deleteVersion
892
- }
893
- }`,
894
- trips: `subscription trips($opVersion: String) {
895
- otrip_trips(opversion: $opVersion, subscribe: true) {
896
- type
897
- total
898
- deleteId
899
- data {
900
- id: vID
901
- vID
902
- start
903
- stop
904
- routeDistanceInMeters
905
- opVersion
906
- referenceGroupId
907
- referenceType
908
- referenceGroupPath
909
- startPoint: startWayPoint {
910
- date
911
- speed
912
- longitude
913
- latitude
914
- }
915
- endPoint: endWayPoint {
916
- date
917
- speed
918
- longitude
919
- latitude
920
- }
921
- wayPoints: waypoints {
922
- date
923
- latitude
924
- longitude
925
- speed
926
- }
927
- }
928
- deleteVersion
929
- }
930
- }`,
931
- messages: `
932
- subscription Messages($version:Int!) {
933
- message_getweb(version: $version) {
934
- ${mCommonFields}
935
- data {
936
- id
937
- multiId
938
- version
939
- createdAt
940
- from { id fullName mobilePhoneNumber mobileCountryCode email language }
941
- to { id fullName mobilePhoneNumber mobileCountryCode email language }
942
- title
943
- content
944
- shortContent
945
- attachmentUrl
946
- type
947
- status
948
- transportTypes
949
- emailStatus { success errorMessage }
950
- smsStatus { success errorMessage }
951
- additionalInfo
952
- emailTemplate
953
- deleted
954
- }
955
- }
956
- }
957
- `,
958
- // trips2: `subscription trips($opVersion: String) {
959
- // otrip_trips2(subscribe: true, opversion: $opVersion) {
960
- // type
961
- // total
962
- // deleteId
963
- // data {
964
- // id: trackerVID
965
- // opVersion
966
- // trips {
967
- // start {
968
- // timestamp
969
- // time
970
- // latitude
971
- // longitude
972
- // }
973
- // end {
974
- // timestamp
975
- // time
976
- // latitude
977
- // longitude
978
- // }
979
- // distance
980
- // completed
981
- // }
982
- // }
983
- // deleteVersion
984
- // }
985
- // }`
986
- };
987
- exports.RequiredMirrors = {
988
- systemSettings: `subscription systemsetting($version: Int!) {
989
- mcommon_systemsettings(version: $version, subscribe: true) {
990
- type
991
- total
992
- deleteId
993
- data {
994
- version
995
- id: groupName
996
- settings {
997
- id
998
- name
999
- level
1000
- parent
1001
- valueOrigin
1002
- value {
1003
- isVisible
1004
- hasChildren
1005
- settingValue
1006
- type
1007
- }
1008
- inputHtml
1009
- }
1010
- }
1011
- deleteVersion
1012
- }
1013
- }`,
1014
- settings: `
1015
- subscription settings($version: Int!){
1016
- mcommon_settings(version: $version, subscribe: true) {
1017
- type
1018
- total
1019
- deleteId
1020
- data {
1021
- id: groupId
1022
- version
1023
- groupName
1024
- settings {
1025
- id
1026
- name
1027
- level
1028
- parent
1029
- valueOrigin
1030
- value {
1031
- isVisible
1032
- hasChildren
1033
- settingValue
1034
- type
1035
- }
1036
- inputHtml
1037
- }
1038
- }
1039
- deleteVersion
1040
- }
1041
- }`
1042
- };
1043
- exports.TempSubscriptions = {};
1044
- //# sourceMappingURL=mirrors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mirrors.js","sourceRoot":"","sources":["../src/mirrors.ts"],"names":[],"mappings":";;;AAAA,MAAM,YAAY,GAAG,kCAAkC,CAAA;AACvD,MAAM,qBAAqB,GAAG,4DAA4D,CAAA;AAC1F,MAAM,aAAa,GAAG,iDAAiD,CAAA;AACvE,MAAM,uBAAuB,GAAG,oEAAoE,aAAa,GAAG,CAAA;AACpH,MAAM,aAAa,GAAG,mCAAmC,CAAA;AACzD,MAAM,oBAAoB,GAAG,0CAA0C,YAAY,EAAE,CAAA;AAExE,QAAA,aAAa,GAAG;IAC3B,UAAU,EAAE;;;;cAIA,aAAa;;;;sBAIL,YAAY;sBACZ,qBAAqB;;;;;;;;;;;;;wDAaa,uBAAuB;yDACtB,uBAAuB;yDACvB,uBAAuB;gEAChB,uBAAuB;mEACpB,uBAAuB;;;;;;;;;;sBAUpE,YAAY;sBACZ,qBAAqB;;;;;;;;;;;wDAWa,uBAAuB;0DACrB,uBAAuB;0DACvB,uBAAuB;gEACjB,uBAAuB;mEACpB,uBAAuB;;;;;;;;sBAQpE,YAAY;sBACZ,qBAAqB;;;;;;wDAMa,uBAAuB;0DACrB,uBAAuB;0DACvB,uBAAuB;gEACjB,uBAAuB;mEACpB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,QAAA,iBAAiB,GAAG,EAEhC,CAAA"}
package/dist/proxy.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function enableGlobalProxy(proxyUrl?: string): void;
package/dist/proxy.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- // Simple helper to enable global proxy support using global-agent without modifying SubscriptionClient.
3
- // Usage: set environment variable GLOBAL_AGENT_HTTP_PROXY (or HTTPS) before importing this file, or call enableGlobalProxy with a URL.
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.enableGlobalProxy = enableGlobalProxy;
6
- // We lazy require to avoid adding types; global-agent patches http(s) & ws fetches.
7
- function enableGlobalProxy(proxyUrl) {
8
- if (proxyUrl) {
9
- process.env.GLOBAL_AGENT_HTTP_PROXY = proxyUrl;
10
- }
11
- if (global.__GLOBAL_AGENT_INITIALIZED__)
12
- return;
13
- // eslint-disable-next-line @typescript-eslint/no-var-requires
14
- const { bootstrap } = require('global-agent');
15
- global.__GLOBAL_AGENT_INITIALIZED__ = true;
16
- bootstrap();
17
- }
18
- //# sourceMappingURL=proxy.js.map
package/dist/proxy.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"proxy.js","sourceRoot":"","sources":["../src/proxy.ts"],"names":[],"mappings":";AAAA,wGAAwG;AACxG,uIAAuI;;AAGvI,8CASC;AAVD,oFAAoF;AACpF,SAAgB,iBAAiB,CAAC,QAAiB;IACjD,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,uBAAuB,GAAG,QAAQ,CAAC;IACjD,CAAC;IACD,IAAK,MAAc,CAAC,4BAA4B;QAAE,OAAO;IACzD,8DAA8D;IAC9D,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC7C,MAAc,CAAC,4BAA4B,GAAG,IAAI,CAAC;IACpD,SAAS,EAAE,CAAC;AACd,CAAC"}
package/dist/test.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/test.js DELETED
@@ -1,73 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- /**
7
- * Entry point for the mirrors TypeScript project.
8
- * Replace this placeholder logic with real application code.
9
- */
10
- const proxy_1 = require("./proxy");
11
- const SubscriptionClient_1 = require("./SubscriptionClient");
12
- const MirrorSync_1 = require("./MirrorSync");
13
- const mirrors_1 = require("./mirrors");
14
- const axios_1 = __importDefault(require("axios"));
15
- const server = process.env.SERVER_URL ?? "";
16
- const accessToken = process.env.ACCESS_TOKEN ?? "";
17
- const loginQuery = `{
18
- auth_externallogin(logintoken: "${accessToken}") {
19
- result
20
- groupVersion
21
- errors {
22
- stackTrace
23
- message
24
- errorKey
25
- detailDescription
26
- }
27
- }
28
- }`;
29
- function performquery(url, query, variables, timeout, token) {
30
- return axios_1.default.post(url, {
31
- query: query,
32
- variables: variables
33
- }, {
34
- timeout: timeout ?? 20000,
35
- headers: { Authorization: `Bearer ${token}` },
36
- validateStatus: function (status) {
37
- return (status >= 200 && status < 300) || status == 400 || status == 500;
38
- }
39
- });
40
- }
41
- async function main() {
42
- // Enable proxy if GLOBAL_AGENT_HTTP_PROXY env var or CLI arg provided
43
- const proxyArg = process.env.GLOBAL_AGENT_HTTP_PROXY || process.env.HTTP_PROXY || process.env.HTTPS_PROXY;
44
- if (proxyArg)
45
- (0, proxy_1.enableGlobalProxy)(proxyArg);
46
- let loginResult = await performquery(server, loginQuery, {});
47
- if (loginResult.data.errors || !loginResult.data.data || !loginResult.data.data.auth_externallogin) {
48
- console.error('Login failed', loginResult.data.errors ?? loginResult.data.data.auth_externallogin.errors);
49
- return;
50
- }
51
- let token = loginResult.data.data.auth_externallogin.result;
52
- let subClient = new SubscriptionClient_1.SubscriptionClient({
53
- url: server,
54
- connectionParams: { authToken: token },
55
- maxReconnectAttempts: Infinity,
56
- });
57
- subClient.on('connecting', () => console.log('[events] connecting'));
58
- subClient.on('connected', () => console.log('[events] connected'));
59
- subClient.on('reconnected', () => console.log('[events] reconnected'));
60
- subClient.on('retry', (i) => console.log('[events] retry', i));
61
- subClient.on('disconnected', (i) => console.log('[events] disconnected', i));
62
- subClient.on('error', (e) => console.error('[events] error', e));
63
- subClient.connect();
64
- const mirrorSync = new MirrorSync_1.MirrorSync(subClient, { subscription: mirrors_1.Subscriptions.references });
65
- mirrorSync.on('updated', (info) => { if (info.__typename === 'QMUser')
66
- console.log('MirrorSync update', info); });
67
- await mirrorSync.load();
68
- console.log('MirrorSync loaded');
69
- }
70
- if (require.main === module) {
71
- main();
72
- }
73
- //# sourceMappingURL=test.js.map
package/dist/test.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"test.js","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":";;;;;AAAA;;;GAGG;AACH,mCAA4C;AAC5C,6DAA0D;AAC1D,6CAA0C;AAC1C,uCAA0C;AAC1C,kDAA0B;AAC1B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,UAAU,IAAI,EAAE,CAAA;AAC3C,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE,CAAA;AAGlD,MAAM,UAAU,GAAG;sCACmB,WAAW;;;;;;;;;;EAU/C,CAAA;AAEF,SAAS,YAAY,CAAC,GAAW,EAAE,KAAa,EAAE,SAAc,EAAE,OAAgB,EAAE,KAAc;IAC9F,OAAO,eAAK,CAAC,IAAI,CACb,GAAG,EACH;QACI,KAAK,EAAE,KAAK;QACZ,SAAS,EAAE,SAAS;KACvB,EACD;QACI,OAAO,EAAE,OAAO,IAAI,KAAK;QACzB,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,KAAK,EAAE,EAAE;QAC7C,cAAc,EAAE,UAAU,MAAM;YAC5B,OAAO,CAAC,MAAM,IAAI,GAAG,IAAI,MAAM,GAAG,GAAG,CAAC,IAAI,MAAM,IAAI,GAAG,IAAI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