@justworkflowit/cdk-constructs 0.0.316 → 0.0.318

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.
@@ -371,6 +371,66 @@ describe('JustWorkflowItConstructs', () => {
371
371
  });
372
372
  }).not.toThrow();
373
373
  });
374
+ test('should accept workflow with marketplace step (placeholders auto-injected)', () => {
375
+ const app = new aws_cdk_lib_1.App();
376
+ const stack = new aws_cdk_lib_1.Stack(app, 'TestStack');
377
+ const workflowWithMarketplaceStep = JSON.stringify({
378
+ workflowName: 'marketplaceConsumerWorkflow',
379
+ steps: [
380
+ {
381
+ name: 'fetchData',
382
+ retries: 2,
383
+ timeoutSeconds: 1000,
384
+ transitionToStep: 'processMarketplace',
385
+ integrationDetails: {
386
+ type: 'testIntegration',
387
+ inputDefinition: {
388
+ $ref: '#/definitions/fetchDataInput',
389
+ },
390
+ outputDefinition: {
391
+ $ref: '#/definitions/fetchDataOutput',
392
+ },
393
+ },
394
+ },
395
+ {
396
+ name: 'processMarketplace',
397
+ retries: 2,
398
+ timeoutSeconds: 1000,
399
+ transitionToStep: null,
400
+ integrationDetails: {
401
+ type: '/justworkflowit/runMarketplaceJob',
402
+ config: {
403
+ publisherOrgKey: 'some-publisher',
404
+ listingKey: 'some-listing',
405
+ versionNumber: 1,
406
+ },
407
+ },
408
+ },
409
+ ],
410
+ definitions: {
411
+ fetchDataInput: {
412
+ type: 'object',
413
+ properties: {},
414
+ additionalProperties: false,
415
+ },
416
+ fetchDataOutput: {
417
+ type: 'object',
418
+ properties: {
419
+ result: { type: 'string' },
420
+ },
421
+ required: ['result'],
422
+ additionalProperties: false,
423
+ },
424
+ },
425
+ });
426
+ expect(() => {
427
+ new justWorkflowItConstructs_1.JustWorkflowItConstructs(stack, {
428
+ disambiguator: 'test',
429
+ organizationId: 'org123',
430
+ workflowDefinitions: [workflowWithMarketplaceStep],
431
+ });
432
+ }).not.toThrow();
433
+ });
374
434
  test('should accept workflow without workflowInput definition (backward compatibility)', () => {
375
435
  const app = new aws_cdk_lib_1.App();
376
436
  const stack = new aws_cdk_lib_1.Stack(app, 'TestStack');
@@ -60,6 +60,18 @@ class JustWorkflowItConstructs extends constructs_1.Construct {
60
60
  if (step?.integrationDetails?.type) {
61
61
  integrationTypes.add(step.integrationDetails.type);
62
62
  }
63
+ // For marketplace steps, inject permissive placeholder schemas so synth-time
64
+ // validation passes. The real schemas are injected at API registration time.
65
+ if (step?.integrationDetails?.type === '/justworkflowit/runMarketplaceJob' && step.name) {
66
+ const stepName = step.name;
67
+ if (!parsedWorkflow.definitions) {
68
+ parsedWorkflow.definitions = {};
69
+ }
70
+ parsedWorkflow.definitions[`${stepName}Input`] = { type: 'object', additionalProperties: true };
71
+ parsedWorkflow.definitions[`${stepName}Output`] = { type: 'object', additionalProperties: true };
72
+ step.integrationDetails.inputDefinition = { $ref: `#/definitions/${stepName}Input` };
73
+ step.integrationDetails.outputDefinition = { $ref: `#/definitions/${stepName}Output` };
74
+ }
63
75
  });
64
76
  }
65
77
  // Create dummy step executors for validation purposes
@@ -67,6 +79,8 @@ class JustWorkflowItConstructs extends constructs_1.Construct {
67
79
  type,
68
80
  execute: async () => ({ status: 'success', payload: {} }),
69
81
  }));
82
+ // Use the modified definition (with marketplace placeholders) for engine validation
83
+ const definitionForValidation = JSON.stringify(parsedWorkflow);
70
84
  // Generate fake workflow input if a workflowInput definition exists
71
85
  let fakeWorkflowInputForTypeValidation = undefined;
72
86
  if (parsedWorkflow.definitions?.workflowInput) {
@@ -85,7 +99,7 @@ class JustWorkflowItConstructs extends constructs_1.Construct {
85
99
  }
86
100
  // This will throw if the workflow definition is invalid
87
101
  new engine_1.JustWorkflowItEngine({
88
- workflowDefinition: definition,
102
+ workflowDefinition: definitionForValidation,
89
103
  stepExecutors: dummyExecutors,
90
104
  workflowInput: fakeWorkflowInputForTypeValidation,
91
105
  });
@@ -44270,7 +44270,8 @@ async function deployWorkflows(organizationId, bucket, keys) {
44270
44270
  console.log(`\u2705 Registered and tagged new $LIVE version for: ${workflowName}`);
44271
44271
  } catch (err) {
44272
44272
  console.error(`\u274C Error processing ${key}`, err);
44273
- throw err;
44273
+ const msg = err instanceof Error ? err.message : String(err);
44274
+ throw new Error(msg.length > 1e3 ? `${msg.slice(0, 1e3)}... (truncated)` : msg);
44274
44275
  }
44275
44276
  }
44276
44277
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justworkflowit/cdk-constructs",
3
3
  "description": "AWS CDK construct for integrating with the JustWorkflowIt platform",
4
- "version": "0.0.316",
4
+ "version": "0.0.318",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/justworkflowit/JustWorkflowItCDKConstructs"