@digitraffic/common 2025.2.4-1 → 2025.2.4-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.
@@ -35,9 +35,10 @@ export interface ClusterImportConfiguration {
|
|
35
35
|
* Parse cluster identifier from cluster writer endpoint.
|
36
36
|
* i.e. <i>stackenv-stackenvxxx-xxx.cluster-xxx.region.rds.amazonaws.com</i>
|
37
37
|
* -> <i>stackenv-stackenvxxx-xxx</i>
|
38
|
-
* @param clusterImport
|
38
|
+
* @param clusterImport ClusterImportConfiguration to resolve cluster identifier
|
39
|
+
* @param fallbackValue If parse fails return fallback value. If not given will throw error.
|
39
40
|
*/
|
40
|
-
export declare function parseClusterIdentifier(clusterImport: ClusterImportConfiguration): string;
|
41
|
+
export declare function parseClusterIdentifier(clusterImport: ClusterImportConfiguration, fallbackValue?: string): string;
|
41
42
|
/**
|
42
43
|
* Stack that creates DatabaseCluster.
|
43
44
|
*
|
@@ -8,14 +8,18 @@ import { createParameter } from "../stack/parameters.js";
|
|
8
8
|
* Parse cluster identifier from cluster writer endpoint.
|
9
9
|
* i.e. <i>stackenv-stackenvxxx-xxx.cluster-xxx.region.rds.amazonaws.com</i>
|
10
10
|
* -> <i>stackenv-stackenvxxx-xxx</i>
|
11
|
-
* @param clusterImport
|
11
|
+
* @param clusterImport ClusterImportConfiguration to resolve cluster identifier
|
12
|
+
* @param fallbackValue If parse fails return fallback value. If not given will throw error.
|
12
13
|
*/
|
13
|
-
export function parseClusterIdentifier(clusterImport) {
|
14
|
+
export function parseClusterIdentifier(clusterImport, fallbackValue) {
|
14
15
|
if (clusterImport.clusterWriteEndpoint.includes(".cluster") &&
|
15
16
|
clusterImport.clusterWriteEndpoint.split(".cluster")[0]) {
|
16
17
|
// @ts-ignore this is checked above
|
17
18
|
return clusterImport.clusterWriteEndpoint.split(".cluster")[0];
|
18
19
|
}
|
20
|
+
if (fallbackValue) {
|
21
|
+
return fallbackValue;
|
22
|
+
}
|
19
23
|
throw new Error("Could not resolve 'clusterIdentifier' from 'configuration.clusterImport': " +
|
20
24
|
clusterImport.clusterWriteEndpoint +
|
21
25
|
". 'configuration.clusterImport.clusterWriteEndpoint' didn't contain '.cluster'");
|