diff --git a/API.md b/API.md
index 5e13b823..57576076 100644
--- a/API.md
+++ b/API.md
@@ -11407,18 +11407,44 @@ public readonly type: ConnectorType;
---
-### TaskProperties
+### TaskProperty
-A generic bucket for the task properties.
+#### Initializer
-#### Initializer
+```typescript
+import { TaskProperty } from '@cdklabs/cdk-appflow'
+
+const taskProperty: TaskProperty = { ... }
+```
+
+#### Properties
+
+| **Name** | **Type** | **Description** |
+| --- | --- | --- |
+| key
| string
| *No description.* |
+| value
| string
| *No description.* |
+
+---
+
+##### `key`Required
```typescript
-import { TaskProperties } from '@cdklabs/cdk-appflow'
+public readonly key: string;
+```
+
+- *Type:* string
+
+---
-const taskProperties: TaskProperties = { ... }
+##### `value`Required
+
+```typescript
+public readonly value: string;
```
+- *Type:* string
+
+---
### TriggerConfig
@@ -12187,14 +12213,14 @@ A representation of a filter operation condtiion on a source record field.
```typescript
import { FilterCondition } from '@cdklabs/cdk-appflow'
-new FilterCondition(field: Field, filter: string, properties: TaskProperties)
+new FilterCondition(field: Field, filter: string, properties: TaskProperty[])
```
| **Name** | **Type** | **Description** |
| --- | --- | --- |
| field
| Field
| *No description.* |
| filter
| string
| *No description.* |
-| properties
| TaskProperties
| *No description.* |
+| properties
| TaskProperty[]
| *No description.* |
---
@@ -12212,7 +12238,7 @@ new FilterCondition(field: Field, filter: string, properties: TaskProperties)
##### `properties`Required
-- *Type:* TaskProperties
+- *Type:* TaskProperty[]
---
@@ -12644,7 +12670,7 @@ FilterCondition.timestampNotEquals(field: Field, val: Date | Date[])
| --- | --- | --- |
| field
| Field
| *No description.* |
| filter
| string
| *No description.* |
-| properties
| TaskProperties
| *No description.* |
+| properties
| TaskProperty[]
| *No description.* |
---
@@ -12671,10 +12697,10 @@ public readonly filter: string;
##### `properties`Required
```typescript
-public readonly properties: TaskProperties;
+public readonly properties: TaskProperty[];
```
-- *Type:* TaskProperties
+- *Type:* TaskProperty[]
---
@@ -14327,7 +14353,7 @@ A representation of a unitary action on the record fields.
```typescript
import { Task } from '@cdklabs/cdk-appflow'
-new Task(type: string, sourceFields: string[], connectorOperator: TaskConnectorOperator, properties: TaskProperties, destinationField?: string)
+new Task(type: string, sourceFields: string[], connectorOperator: TaskConnectorOperator, properties: TaskProperty[], destinationField?: string)
```
| **Name** | **Type** | **Description** |
@@ -14335,7 +14361,7 @@ new Task(type: string, sourceFields: string[], connectorOperator: TaskConnectorO
| type
| string
| *No description.* |
| sourceFields
| string[]
| *No description.* |
| connectorOperator
| TaskConnectorOperator
| *No description.* |
-| properties
| TaskProperties
| *No description.* |
+| properties
| TaskProperty[]
| *No description.* |
| destinationField
| string
| *No description.* |
---
@@ -14360,7 +14386,7 @@ new Task(type: string, sourceFields: string[], connectorOperator: TaskConnectorO
##### `properties`Required
-- *Type:* TaskProperties
+- *Type:* TaskProperty[]
---
diff --git a/src/core/tasks/filters.ts b/src/core/tasks/filters.ts
index 69638b5a..3ece528c 100644
--- a/src/core/tasks/filters.ts
+++ b/src/core/tasks/filters.ts
@@ -4,7 +4,7 @@ SPDX-License-Identifier: Apache-2.0
*/
import { Field } from './field';
import { IOperation, OperationBase } from './operation';
-import { Task, TaskProperties } from './tasks';
+import { Task, TaskProperty } from './tasks';
/**
* A representation of a filter operation condtiion on a source record field
@@ -101,71 +101,71 @@ export class FilterCondition {
}
public static timestampBetween(field: Field, lower: Date, upper: Date) {
- return new FilterCondition(field, 'BETWEEN', {
- DATA_TYPE: field.dataType!,
- LOWER_BOUND: this.valueToString(lower),
- UPPER_BOUND: this.valueToString(upper),
- });
+ return new FilterCondition(field, 'BETWEEN', [
+ { key: 'DATA_TYPE', value: field.dataType! },
+ { key: 'LOWER_BOUND', value: this.valueToString(lower) },
+ { key: 'UPPER_BOUND', value: this.valueToString(upper) },
+ ] );
}
private static stringCondition(field: Field, val: string | string[], filter: string) {
if (Array.isArray(val)) {
- return new FilterCondition(field, filter, {
- DATA_TYPE: field.dataType!,
- VALUES: val.map(m => this.valueToString(m)).join(','),
- });
+ return new FilterCondition(field, filter, [
+ { key: 'DATA_TYPE', value: field.dataType! },
+ { key: 'VALUES', value: val.map(m => this.valueToString(m)).join(',') },
+ ]);
}
- return new FilterCondition(field, filter, {
- DATA_TYPE: field.dataType!,
- VALUE: this.valueToString(val),
- });
+ return new FilterCondition(field, filter, [
+ { key: 'DATA_TYPE', value: field.dataType! },
+ { key: 'VALUE', value: this.valueToString(val) },
+ ]);
}
private static numberCondition(field: Field, val: number | number[], filter: string) {
if (Array.isArray(val)) {
- return new FilterCondition(field, filter, {
- DATA_TYPE: field.dataType!,
- VALUES: val.map(m => this.valueToString(m)).join(','),
- });
+ return new FilterCondition(field, filter, [
+ { key: 'DATA_TYPE', value: field.dataType! },
+ { key: 'VALUES', value: val.map(m => this.valueToString(m)).join(',') },
+ ]);
}
- return new FilterCondition(field, filter, {
- DATA_TYPE: field.dataType!,
- VALUE: this.valueToString(val),
- });
+ return new FilterCondition(field, filter, [
+ { key: 'DATA_TYPE', value: field.dataType! },
+ { key: 'VALUE', value: this.valueToString(val) },
+ ]);
}
private static booleanCondition(field: Field, val: boolean | boolean[], filter: string) {
if (Array.isArray(val)) {
- return new FilterCondition(field, filter, {
- DATA_TYPE: field.dataType!,
- VALUES: val.map(m => this.valueToString(m)).join(','),
- });
+ return new FilterCondition(field, filter, [
+ { key: 'DATA_TYPE', value: field.dataType! },
+ { key: 'VALUES', value: val.map(m => this.valueToString(m)).join(',') },
+ ]);
}
- return new FilterCondition(field, filter, {
- DATA_TYPE: field.dataType!,
- VALUE: this.valueToString(val),
- });
+ return new FilterCondition(field, filter, [
+ { key: 'DATA_TYPE', value: field.dataType! },
+ { key: 'VALUE', value: this.valueToString(val) },
+ ]);
}
private static timestampCondition(field: Field, val: Date | Date[], filter: string) {
if (Array.isArray(val)) {
- return new FilterCondition(field, filter, {
- DATA_TYPE: field.dataType!,
- VALUES: val.map(m => this.valueToString(m)).join(','),
- });
+ return new FilterCondition(field, filter, [
+ { key: 'DATA_TYPE', value: field.dataType! },
+ { key: 'VALUES', value: val.map(m => this.valueToString(m)).join(',') },
+ ]);
}
- return new FilterCondition(field, filter, {
- DATA_TYPE: field.dataType!,
- VALUE: this.valueToString(val),
- });
+ return new FilterCondition(field, filter, [
+ { key: 'DATA_TYPE', value: field.dataType! },
+ { key: 'VALUE', value: this.valueToString(val) },
+ ]);
}
private static valueToString(value: string | number | boolean | Date): string {
@@ -185,7 +185,7 @@ export class FilterCondition {
constructor(
public readonly field: Field,
public readonly filter: string,
- public readonly properties: TaskProperties) {
+ public readonly properties: TaskProperty[]) {
if (!field.dataType) {
throw new Error('field dataType required');
}
diff --git a/src/core/tasks/mappings.ts b/src/core/tasks/mappings.ts
index b4e8d921..260ae396 100644
--- a/src/core/tasks/mappings.ts
+++ b/src/core/tasks/mappings.ts
@@ -5,7 +5,7 @@ SPDX-License-Identifier: Apache-2.0
import { Fn } from 'aws-cdk-lib';
import { Field } from './field';
import { IOperation, OperationBase } from './operation';
-import { Task, TaskProperties } from './tasks';
+import { Task, TaskProperty } from './tasks';
const TT_MAPALL = 'Map_all';
const TT_MAP = 'Map';
@@ -43,18 +43,19 @@ export class Mapping extends OperationBase implements IMapping {
new Task(
TT_MAPALL, [],
{ operation: OP_NOOP },
- { EXCLUDE_SOURCE_FIELDS_LIST: config ? `["${Fn.join('","', config.exclude)}"]` : '[]' }),
+ [{ key: 'EXCLUDE_SOURCE_FIELDS_LIST', value: config ? `["${Fn.join('","', config.exclude)}"]` : '[]' }],
+ ),
]);
}
public static map(from: Field, to: Field): IMapping {
- const props: TaskProperties = {};
+ const props: TaskProperty[] = [];
if (from.dataType) {
- props[TP_SOURCE_DATA_TYPE] = from.dataType;
+ props.push({ key: TP_SOURCE_DATA_TYPE, value: from.dataType });
}
if (to.dataType) {
- props[TP_DESTINATION_DATA_TYPE] = to.dataType;
+ props.push({ key: TP_DESTINATION_DATA_TYPE, value: to.dataType });
}
return new Mapping([
@@ -78,11 +79,11 @@ export class Mapping extends OperationBase implements IMapping {
const tmpField = from.map(f => f.name).join(',');
return new Mapping([
new Task(TT_MERGE, from.map(f => f.name), { operation: OP_NOOP },
- { CONCAT_FORMAT: format }, tmpField),
- new Task(TT_MAP, [tmpField], { operation: OP_NOOP }, {
- DESTINATION_DATA_TYPE: to.dataType,
- SOURCE_DATA_TYPE: 'string',
- }),
+ [{ key: 'CONCAT_FORMAT', value: format }], tmpField),
+ new Task(TT_MAP, [tmpField], { operation: OP_NOOP }, [
+ { key: 'DESTINATION_DATA_TYPE', value: to.dataType },
+ { key: 'SOURCE_DATA_TYPE', value: 'string' },
+ ]),
]);
}
@@ -145,13 +146,13 @@ export class Mapping extends OperationBase implements IMapping {
const tmpField = `${sourceField1.name},${sourceField2.name}`;
return new Mapping([
- new Task(TT_ARITHMETIC, [sourceField1.name, sourceField2.name], { operation: operation }, {
- MATH_OPERATION_FIELDS_ORDER: tmpField,
- }, tmpField),
- new Task(TT_MAP, [tmpField], { operation: OP_NOOP }, {
- DESTINATION_DATA_TYPE: to.dataType,
- SOURCE_DATA_TYPE: 'string',
- },
+ new Task(TT_ARITHMETIC, [sourceField1.name, sourceField2.name], { operation: operation }, [{
+ key: 'MATH_OPERATION_FIELDS_ORDER', value: tmpField,
+ }], tmpField),
+ new Task(TT_MAP, [tmpField], { operation: OP_NOOP }, [
+ { key: 'DESTINATION_DATA_TYPE', value: to.dataType },
+ { key: 'SOURCE_DATA_TYPE', value: 'string' },
+ ],
to.name),
]);
}
diff --git a/src/core/tasks/tasks.ts b/src/core/tasks/tasks.ts
index 75bae134..1be5b52e 100644
--- a/src/core/tasks/tasks.ts
+++ b/src/core/tasks/tasks.ts
@@ -14,11 +14,9 @@ export interface ITask {
bind(flow: IFlow, source: ISource): CfnFlow.TaskProperty;
}
-/**
- * A generic bucket for the task properties
- */
-export interface TaskProperties {
- [key: string]: string;
+export interface TaskProperty {
+ readonly key: string;
+ readonly value: string;
}
/**
@@ -36,7 +34,7 @@ export class Task implements ITask {
constructor(protected type: string,
protected sourceFields: string[],
protected connectorOperator: TaskConnectorOperator,
- protected properties: TaskProperties,
+ protected properties: TaskProperty[],
protected destinationField?: string) { }
public bind(_flow: IFlow, source: ISource): CfnFlow.TaskProperty {
@@ -44,7 +42,7 @@ export class Task implements ITask {
return {
taskType: this.type,
sourceFields: this.sourceFields,
- taskProperties: Object.entries(this.properties).map(([key, value]) => ({ key: key, value: value })),
+ taskProperties: this.properties.map(({ key, value }) => ({ key: key, value: value })),
connectorOperator: this.buildOperatorFor(source),
destinationField: this.destinationField,
};
diff --git a/src/core/tasks/transforms.ts b/src/core/tasks/transforms.ts
index 2dded3f8..5ddc0978 100644
--- a/src/core/tasks/transforms.ts
+++ b/src/core/tasks/transforms.ts
@@ -39,9 +39,8 @@ export class Transform extends OperationBase implements ITransform {
'Truncate',
[typeof field === 'string' ? field : field.name],
{ operation: OP_NOOP },
- { TRUNCATE_LENGTH: `${length}` }),
- ],
- );
+ [{ key: 'TRUNCATE_LENGTH', value: `${length}` }]),
+ ]);
}
/**
@@ -60,11 +59,11 @@ export class Transform extends OperationBase implements ITransform {
'Mask',
[typeof field === 'string' ? field : field.name],
{ operation: 'MASK_ALL' },
- {
- // TODO: test this. The AWS Console generated transform has length, but what for?
- MASK_LENGTH: '5',
- MASK_VALUE: mask ?? '*',
+ [{
+ // TODO: test this. The AWS Console generated transform has length, but what for?
+ key: 'MASK_LENGTH', value: '5',
},
+ { key: 'MASK_VALUE', value: mask ?? '*' }],
),
]);
}
@@ -87,10 +86,10 @@ export class Transform extends OperationBase implements ITransform {
'Mask',
[typeof field === 'string' ? field : field.name],
{ operation: 'MASK_FIRST_N' },
- {
- MASK_LENGTH: `${length}`,
- MASK_VALUE: mask ?? '*',
- },
+ [
+ { key: 'MASK_LENGTH', value: `${length}` },
+ { key: 'MASK_VALUE', value: mask ?? '*' },
+ ],
),
]);
}
@@ -114,10 +113,10 @@ export class Transform extends OperationBase implements ITransform {
'Mask',
[typeof field === 'string' ? field : field.name],
{ operation: 'MASK_LAST_N' },
- {
- MASK_LENGTH: `${length}`,
- MASK_VALUE: mask ?? '*',
- },
+ [
+ { key: 'MASK_LENGTH', value: `${length}` },
+ { key: 'MASK_VALUE', value: mask ?? '*' },
+ ],
),
]);
}
diff --git a/src/core/tasks/validations.ts b/src/core/tasks/validations.ts
index 8748608a..18a321a3 100644
--- a/src/core/tasks/validations.ts
+++ b/src/core/tasks/validations.ts
@@ -86,7 +86,7 @@ export class Validation extends OperationBase implements IValidation {
* @param action a @see ValidationAction for the validation
* @returns a Validation instance
*/
- public static when(condition: ValidationCondition, action: ValidationAction) : IValidation {
+ public static when(condition: ValidationCondition, action: ValidationAction): IValidation {
return new Validation(condition, action);
}
@@ -96,6 +96,6 @@ export class Validation extends OperationBase implements IValidation {
super([new Task('Validate',
[condition.field],
{ operation: condition.validation },
- { VALIDATION_ACTION: action.action })]);
+ [{ key: 'VALIDATION_ACTION', value: action.action }])]);
}
}