@justworkflowit/cdk-constructs 0.0.213 → 0.0.215
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.
|
@@ -3,6 +3,7 @@ export interface JustWorkflowItConstructsProps {
|
|
|
3
3
|
disambiguator: string;
|
|
4
4
|
organizationId: string;
|
|
5
5
|
workflowDefinitions: string[];
|
|
6
|
+
ignoreDefinitionDeployerFailures?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare class JustWorkflowItConstructs extends Construct {
|
|
8
9
|
private static readonly CONSTRUCT_ID_PREFIX;
|
|
@@ -126,7 +126,8 @@ class JustWorkflowItConstructs extends constructs_1.Construct {
|
|
|
126
126
|
ORGANIZATION_ID: props.organizationId,
|
|
127
127
|
API_BASE_URL: 'https://api.justworkflowit.com',
|
|
128
128
|
DEFINITION_BUCKET: bucket.bucketName,
|
|
129
|
-
DEFINITION_KEYS_JSON: JSON.stringify(definitionKeys)
|
|
129
|
+
DEFINITION_KEYS_JSON: JSON.stringify(definitionKeys),
|
|
130
|
+
IGNORE_FAILURES: String(props.ignoreDefinitionDeployerFailures ?? false),
|
|
130
131
|
},
|
|
131
132
|
});
|
|
132
133
|
secret.grantRead(integrationLambda);
|
|
@@ -3,5 +3,24 @@ export declare const handler: (event: CloudFormationCustomResourceEvent) => Prom
|
|
|
3
3
|
PhysicalResourceId: string;
|
|
4
4
|
Data: {
|
|
5
5
|
Message: string;
|
|
6
|
+
PlaceholderTokenDetected: string;
|
|
7
|
+
FailureIgnored?: undefined;
|
|
8
|
+
Error?: undefined;
|
|
9
|
+
};
|
|
10
|
+
} | {
|
|
11
|
+
PhysicalResourceId: string;
|
|
12
|
+
Data: {
|
|
13
|
+
Message: string;
|
|
14
|
+
FailureIgnored: string;
|
|
15
|
+
Error: string;
|
|
16
|
+
PlaceholderTokenDetected?: undefined;
|
|
17
|
+
};
|
|
18
|
+
} | {
|
|
19
|
+
PhysicalResourceId: string;
|
|
20
|
+
Data: {
|
|
21
|
+
Message: string;
|
|
22
|
+
PlaceholderTokenDetected?: undefined;
|
|
23
|
+
FailureIgnored?: undefined;
|
|
24
|
+
Error?: undefined;
|
|
6
25
|
};
|
|
7
26
|
}>;
|
|
@@ -67642,6 +67642,7 @@ var getApiClient = () => {
|
|
|
67642
67642
|
|
|
67643
67643
|
// src/lambda/definitionDeployerLambda.ts
|
|
67644
67644
|
var s3 = new import_client_s3.S3Client();
|
|
67645
|
+
var PLACEHOLDER_TOKEN = "REPLACE_ME_WITH_JUST_WORKFLOW_IT_AUTH_TOKEN";
|
|
67645
67646
|
var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
67646
67647
|
var parseNumberEnv = (value, fallback) => {
|
|
67647
67648
|
const parsed = Number(value);
|
|
@@ -67762,18 +67763,51 @@ var handler = async (event) => {
|
|
|
67762
67763
|
const { RequestType } = event;
|
|
67763
67764
|
const bucket = process.env.DEFINITION_BUCKET;
|
|
67764
67765
|
const organizationId = process.env.ORGANIZATION_ID;
|
|
67766
|
+
const authSecretName = process.env.AUTH_SECRET_NAME;
|
|
67765
67767
|
const keys = JSON.parse(process.env.DEFINITION_KEYS_JSON || "[]");
|
|
67768
|
+
const ignoreFailures = process.env.IGNORE_FAILURES === "true";
|
|
67766
67769
|
if (!bucket) {
|
|
67767
67770
|
throw new Error("Missing S3 bucket from environment variables");
|
|
67768
67771
|
}
|
|
67769
67772
|
if (!organizationId) {
|
|
67770
67773
|
throw new Error("Missing organization ID from environment variables");
|
|
67771
67774
|
}
|
|
67775
|
+
if (!authSecretName) {
|
|
67776
|
+
throw new Error("Missing auth secret name from environment variables");
|
|
67777
|
+
}
|
|
67778
|
+
const authToken = await getSecretValueByName(authSecretName);
|
|
67779
|
+
if (authToken === PLACEHOLDER_TOKEN) {
|
|
67780
|
+
console.log("\u26A0\uFE0F API token is still the placeholder value. Skipping workflow deployment.");
|
|
67781
|
+
console.log("\u2139\uFE0F To deploy workflows, update the secret with a real JustWorkflowIt API token and trigger a stack update.");
|
|
67782
|
+
return {
|
|
67783
|
+
PhysicalResourceId: "JustWorkflowItIntegrationTrigger",
|
|
67784
|
+
Data: {
|
|
67785
|
+
Message: `Skipped ${RequestType} - placeholder token detected`,
|
|
67786
|
+
PlaceholderTokenDetected: "true"
|
|
67787
|
+
}
|
|
67788
|
+
};
|
|
67789
|
+
}
|
|
67772
67790
|
if (RequestType === "Create" || RequestType === "Update") {
|
|
67773
67791
|
if (keys.length === 0) {
|
|
67774
67792
|
console.log("No definitions to deploy");
|
|
67775
67793
|
} else {
|
|
67776
|
-
|
|
67794
|
+
try {
|
|
67795
|
+
await deployWorkflows(organizationId, bucket, keys);
|
|
67796
|
+
} catch (error2) {
|
|
67797
|
+
if (ignoreFailures) {
|
|
67798
|
+
console.warn("\u26A0\uFE0F Workflow deployment failed, but IGNORE_FAILURES is enabled");
|
|
67799
|
+
console.warn("Error details:", error2);
|
|
67800
|
+
return {
|
|
67801
|
+
PhysicalResourceId: "JustWorkflowItIntegrationTrigger",
|
|
67802
|
+
Data: {
|
|
67803
|
+
Message: `${RequestType} completed with ignored failures`,
|
|
67804
|
+
FailureIgnored: "true",
|
|
67805
|
+
Error: error2 instanceof Error ? error2.message : String(error2)
|
|
67806
|
+
}
|
|
67807
|
+
};
|
|
67808
|
+
}
|
|
67809
|
+
throw error2;
|
|
67810
|
+
}
|
|
67777
67811
|
}
|
|
67778
67812
|
} else if (RequestType === "Delete") {
|
|
67779
67813
|
console.log("Delete event received. No cleanup required.");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justworkflowit/cdk-constructs",
|
|
3
3
|
"description": "",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.215",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"publishConfig": {
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"@types/jest": "^29.5.12",
|
|
34
34
|
"@types/node": "^20.12.5",
|
|
35
35
|
"cdk-cli": "^1.1.0",
|
|
36
|
+
"esbuild": "^0.25.11",
|
|
36
37
|
"eslint": "^9.29.0",
|
|
37
38
|
"eslint-config-prettier": "^9.1.0",
|
|
38
39
|
"eslint-plugin-jest": "^28.10.0",
|