@mcesystems/logging-g4 1.0.70 → 1.0.72

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.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=sendBatchAfterOneMinute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sendBatchAfterOneMinute.d.ts","sourceRoot":"","sources":["../../../src/example/sendBatchAfterOneMinute.ts"],"names":[],"mappings":""}
@@ -1,2 +1,3 @@
1
1
  export { LogClient } from "./logic/logClient";
2
+ export type { LogSendResult } from "./types/logSendResult";
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,YAAY,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Returns the epoch ms of the next run at a clock boundary.
3
+ * E.g. intervalMs = 10 * 60 * 1000 (10 min) → at 13:49 next is 13:50, at 13:50 next is 14:00.
4
+ */
5
+ export declare function getNextCronRun(intervalMs: number): number;
6
+ //# sourceMappingURL=cronSchedule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cronSchedule.d.ts","sourceRoot":"","sources":["../../../src/logic/cronSchedule.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAWzD"}
@@ -1,11 +1,21 @@
1
+ import type { LogSendResult } from "@/types/logSendResult";
1
2
  import type { UploadEventsInput } from "@mcesystems/logging-interfaces/lib/sdk";
2
3
  export declare class LogClient {
3
4
  private credentials;
4
5
  private loggingClient;
5
- private offlinetime;
6
6
  private cachedEvents;
7
7
  private initialized;
8
+ private firstOfflineTime;
9
+ private sendTimeoutId;
10
+ private timeBetweenLogMs;
11
+ private maxOfflineTimeMs;
12
+ private pendingEventsPath;
13
+ private sendInProgress;
14
+ private schedulerStarted;
8
15
  init(): Promise<void>;
9
- logEvent(event: Omit<UploadEventsInput["events"][number], "event_id" | "event_time" | "framework_id" | "event_source">): Promise<import("@mcesystems/logging-interfaces/lib/sdk").UploadEventsMutation | undefined>;
16
+ private scheduleNextRun;
17
+ private runScheduledSend;
18
+ private sendBatch;
19
+ logEvent(event: Omit<UploadEventsInput["events"][number], "event_id" | "event_time" | "framework_id" | "event_source">): Promise<LogSendResult>;
10
20
  }
11
21
  //# sourceMappingURL=logClient.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"logClient.d.ts","sourceRoot":"","sources":["../../../src/logic/logClient.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAYhF,qBAAa,SAAS;IACrB,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,YAAY,CAAmC;IACvD,OAAO,CAAC,WAAW,CAAS;IAEtB,IAAI;IA8DJ,QAAQ,CACb,KAAK,EAAE,IAAI,CACV,iBAAiB,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EACnC,UAAU,GAAG,YAAY,GAAG,cAAc,GAAG,cAAc,CAC3D;CAmDF"}
1
+ {"version":3,"file":"logClient.d.ts","sourceRoot":"","sources":["../../../src/logic/logClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAS3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAQhF,qBAAa,SAAS;IACrB,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,aAAa,CAA4B;IACjD,OAAO,CAAC,YAAY,CAAmC;IACvD,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,aAAa,CAA4C;IACjE,OAAO,CAAC,gBAAgB,CAAU;IAClC,OAAO,CAAC,gBAAgB,CAAU;IAClC,OAAO,CAAC,iBAAiB,CAAU;IACnC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,gBAAgB,CAAS;IAE3B,IAAI;IAkFV,OAAO,CAAC,eAAe;YAYT,gBAAgB;YAUhB,SAAS;IA8CjB,QAAQ,CACb,KAAK,EAAE,IAAI,CACV,iBAAiB,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,EACnC,UAAU,GAAG,YAAY,GAAG,cAAc,GAAG,cAAc,CAC3D,GACC,OAAO,CAAC,aAAa,CAAC;CAmBzB"}
@@ -0,0 +1,5 @@
1
+ import type { UploadEventsInput } from "@mcesystems/logging-interfaces/lib/sdk";
2
+ export declare function readPendingEvents(filePath: string): Promise<UploadEventsInput["events"]>;
3
+ export declare function writePendingEvents(filePath: string, events: UploadEventsInput["events"]): Promise<void>;
4
+ export declare function deletePendingEvents(filePath: string): Promise<void>;
5
+ //# sourceMappingURL=pendingEventsStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pendingEventsStorage.d.ts","sourceRoot":"","sources":["../../../src/logic/pendingEventsStorage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAEhF,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAW9F;AAED,wBAAsB,kBAAkB,CACvC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,iBAAiB,CAAC,QAAQ,CAAC,GACjC,OAAO,CAAC,IAAI,CAAC,CAEf;AAED,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CASzE"}
@@ -0,0 +1,2 @@
1
+ export type LogSendResult = "success" | "MAX_OFFLINE_TIME passed" | "delayed";
2
+ //# sourceMappingURL=logSendResult.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logSendResult.d.ts","sourceRoot":"","sources":["../../../src/types/logSendResult.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,yBAAyB,GAAG,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcesystems/logging-g4",
3
- "version": "1.0.70",
3
+ "version": "1.0.72",
4
4
  "description": "Logging toolkit for device management",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -26,8 +26,8 @@
26
26
  "dotenv": "^17.2.3",
27
27
  "tsx": "^4.21.0",
28
28
  "uuid": "^13.0.0",
29
- "@mcesystems/auth-g4": "1.0.70",
30
- "@mcesystems/tool-debug-g4": "1.0.70"
29
+ "@mcesystems/tool-debug-g4": "1.0.72",
30
+ "@mcesystems/auth-g4": "1.0.72"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@mcesystems/logging-interfaces": "^3.163.4",
@@ -35,17 +35,21 @@
35
35
  "cross-env": "^10.1.0",
36
36
  "esbuild": "^0.27.0",
37
37
  "rimraf": "^6.0.1",
38
- "typescript": "^5.7.2"
38
+ "typescript": "^5.7.2",
39
+ "vitest": "^2.1.8"
39
40
  },
40
41
  "files": [
41
42
  "dist",
42
- "README.md"
43
+ "README.md",
44
+ "Example.md"
43
45
  ],
44
46
  "scripts": {
45
47
  "build": "tsx esbuild.config.mts && tsc --emitDeclarationOnly",
46
48
  "build:all": "pnpm --filter @mcesystems/logging-g4... build",
47
49
  "check:types": "tsc --noEmit",
48
50
  "clean": "rimraf dist",
49
- "pack": "npm pack"
51
+ "pack": "npm pack",
52
+ "test": "vitest run",
53
+ "test:watch": "vitest"
50
54
  }
51
55
  }