@digitraffic/common 2026.1.23-1 → 2026.2.4-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.
@@ -7,10 +7,6 @@ test("database import ok?", () => {
7
7
  const database = import("../database/database.js");
8
8
  return expect(database).resolves.toBeDefined();
9
9
  });
10
- test("cached import ok?", () => {
11
- const cached = import("../database/cached.js");
12
- return expect(cached).resolves.toBeDefined();
13
- });
14
10
  test("models import ok?", () => {
15
11
  const models = import("../database/models.js");
16
12
  return expect(models).resolves.toBeDefined();
@@ -4,7 +4,7 @@ import { CanaryAlarm } from "./canary-alarm.js";
4
4
  export class DigitrafficCanary extends Canary {
5
5
  constructor(scope, canaryName, role, params, environmentVariables) {
6
6
  super(scope, canaryName, {
7
- runtime: params.runtime ?? Runtime.SYNTHETICS_NODEJS_PUPPETEER_9_0,
7
+ runtime: params.runtime ?? Runtime.SYNTHETICS_NODEJS_PUPPETEER_13_0,
8
8
  role,
9
9
  test: Test.custom({
10
10
  code: new AssetCode("dist", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitraffic/common",
3
- "version": "2026.1.23-1",
3
+ "version": "2026.2.4-1",
4
4
  "private": false,
5
5
  "description": "",
6
6
  "repository": {
@@ -12,7 +12,6 @@
12
12
  "exports": {
13
13
  ".": "./dist/index.js",
14
14
  "./dist/database/database": "./dist/database/database.js",
15
- "./dist/database/cached": "./dist/database/cached.js",
16
15
  "./dist/database/models": "./dist/database/models.js",
17
16
  "./dist/database/last-updated": "./dist/database/last-updated.js",
18
17
  "./dist/types/geojson": "./dist/types/geojson.js",
@@ -141,7 +140,7 @@
141
140
  "jest-junit": "16.0.0",
142
141
  "ky": "1.14.2",
143
142
  "lefthook": "2.0.13",
144
- "lodash-es": "4.17.22",
143
+ "lodash-es": "4.17.23",
145
144
  "madge": "8.0.0",
146
145
  "pg-native": "3.5.2",
147
146
  "pg-promise": "12.3.0",
@@ -168,7 +167,7 @@
168
167
  "es-toolkit": "1.43.0",
169
168
  "geojson-validation": "1.0.2",
170
169
  "ky": "1.14.2",
171
- "lodash-es": "4.17.22",
170
+ "lodash-es": "4.17.23",
172
171
  "pg-native": "3.5.2",
173
172
  "pg-promise": "12.3.0",
174
173
  "zod": "4.3.5"
@@ -1,19 +0,0 @@
1
- import type { DTDatabase, DTTransaction } from "./database.js";
2
- export interface CachedValue<T> {
3
- content: T;
4
- last_updated: Date;
5
- modified: Date;
6
- }
7
- export declare enum JSON_CACHE_KEY {
8
- NAUTICAL_WARNINGS_ACTIVE = "nautical-warnings-active",
9
- NAUTICAL_WARNINGS_ARCHIVED = "nautical-warnings-archived"
10
- }
11
- /**
12
- * @param db
13
- * @param cacheKey
14
- * @param value
15
- * @param lastUpdated time when data was created or updated
16
- */
17
- export declare function updateCachedJson<T>(db: DTDatabase | DTTransaction, cacheKey: JSON_CACHE_KEY, value: T, lastUpdated: Date): Promise<void>;
18
- export declare function getJsonFromCache<T>(db: DTDatabase | DTTransaction, cacheKey: JSON_CACHE_KEY): Promise<T | undefined>;
19
- export declare function getFromCache<T>(db: DTDatabase | DTTransaction, cacheKey: JSON_CACHE_KEY): Promise<CachedValue<T> | undefined>;
@@ -1,40 +0,0 @@
1
- import pg from "pg-promise";
2
- const { PreparedStatement } = pg;
3
- const PS_UPDATE_CACHE_VALUE = new PreparedStatement({
4
- name: "update-cache-value",
5
- text: `insert into cached_json(cache_id, content, last_updated)
6
- values ($1, $2, $3)
7
- on conflict(cache_id) do
8
- update set content = $2, last_updated = $3`,
9
- });
10
- const PS_GET_CACHE_VALUE = new PreparedStatement({
11
- name: "get-cache-value",
12
- text: "select content, last_updated, modified from cached_json where cache_id = $1",
13
- });
14
- export var JSON_CACHE_KEY;
15
- (function (JSON_CACHE_KEY) {
16
- JSON_CACHE_KEY["NAUTICAL_WARNINGS_ACTIVE"] = "nautical-warnings-active";
17
- JSON_CACHE_KEY["NAUTICAL_WARNINGS_ARCHIVED"] = "nautical-warnings-archived";
18
- })(JSON_CACHE_KEY || (JSON_CACHE_KEY = {}));
19
- /**
20
- * @param db
21
- * @param cacheKey
22
- * @param value
23
- * @param lastUpdated time when data was created or updated
24
- */
25
- export async function updateCachedJson(db, cacheKey, value, lastUpdated) {
26
- await db.none(PS_UPDATE_CACHE_VALUE, [cacheKey, value, lastUpdated]);
27
- }
28
- export function getJsonFromCache(db, cacheKey) {
29
- return db
30
- .oneOrNone(PS_GET_CACHE_VALUE, [cacheKey])
31
- .then((value) => value?.content ?? undefined);
32
- }
33
- export async function getFromCache(db, cacheKey) {
34
- return db
35
- .oneOrNone(PS_GET_CACHE_VALUE, [cacheKey])
36
- .then((result) => {
37
- return result ?? undefined;
38
- });
39
- }
40
- //# sourceMappingURL=cached.js.map