@digitraffic/common 2025.2.4-2 → 2025.2.4-3

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.
@@ -37,8 +37,9 @@ export interface ClusterImportConfiguration {
37
37
  * -> <i>stackenv-stackenvxxx-xxx</i>
38
38
  * @param clusterImport ClusterImportConfiguration to resolve cluster identifier
39
39
  * @param fallbackValue If parse fails return fallback value. If not given will throw error.
40
+ * @throws Error If not cluster is found and no fallbackValue is given.
40
41
  */
41
- export declare function parseClusterIdentifier(clusterImport: ClusterImportConfiguration, fallbackValue?: string): string;
42
+ export declare function parseClusterIdentifier(clusterImport?: ClusterImportConfiguration, fallbackValue?: string): string;
42
43
  /**
43
44
  * Stack that creates DatabaseCluster.
44
45
  *
@@ -10,9 +10,11 @@ import { createParameter } from "../stack/parameters.js";
10
10
  * -> <i>stackenv-stackenvxxx-xxx</i>
11
11
  * @param clusterImport ClusterImportConfiguration to resolve cluster identifier
12
12
  * @param fallbackValue If parse fails return fallback value. If not given will throw error.
13
+ * @throws Error If not cluster is found and no fallbackValue is given.
13
14
  */
14
15
  export function parseClusterIdentifier(clusterImport, fallbackValue) {
15
- if (clusterImport.clusterWriteEndpoint.includes(".cluster") &&
16
+ if (clusterImport &&
17
+ clusterImport.clusterWriteEndpoint.includes(".cluster") &&
16
18
  clusterImport.clusterWriteEndpoint.split(".cluster")[0]) {
17
19
  // @ts-ignore this is checked above
18
20
  return clusterImport.clusterWriteEndpoint.split(".cluster")[0];
@@ -20,9 +22,9 @@ export function parseClusterIdentifier(clusterImport, fallbackValue) {
20
22
  if (fallbackValue) {
21
23
  return fallbackValue;
22
24
  }
23
- throw new Error("Could not resolve 'clusterIdentifier' from 'configuration.clusterImport': " +
24
- clusterImport.clusterWriteEndpoint +
25
- ". 'configuration.clusterImport.clusterWriteEndpoint' didn't contain '.cluster'");
25
+ throw new Error([`Could not resolve 'clusterIdentifier' from 'configuration.clusterImport': ${clusterImport?.clusterWriteEndpoint}.,
26
+ 'configuration.clusterImport.clusterWriteEndpoint' didn't contain '.cluster'`]
27
+ .join(" "));
26
28
  }
27
29
  /**
28
30
  * Stack that creates DatabaseCluster.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitraffic/common",
3
- "version": "2025.2.4-2",
3
+ "version": "2025.2.4-3",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "repository": {