Skip to content

Commit efd13f8

Browse files
committed
feat(testing-sdk): Support ReplayChildren for context operations
1 parent 4946566 commit efd13f8

File tree

9 files changed

+334
-34
lines changed

9 files changed

+334
-34
lines changed

dex-internal-sdk/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/node_modules
22
/build
33
/dist
4-
/dist-cjs
54
/coverage
65
.husky
76
*.iml

dex-internal-sdk/dist-types/commands/CheckpointDurableExecutionCommand.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ declare const CheckpointDurableExecutionCommand_base: {
7878
* "STRING_VALUE",
7979
* ],
8080
* },
81+
* ContextOptions: { // ContextOptions
82+
* ReplayChildren: true || false,
83+
* },
8184
* StepOptions: { // StepOptions
8285
* NextAttemptDelaySeconds: Number("int"),
8386
* },
@@ -116,6 +119,7 @@ declare const CheckpointDurableExecutionCommand_base: {
116119
* // InputPayload: "STRING_VALUE",
117120
* // },
118121
* // ContextDetails: { // ContextDetails
122+
* // ReplayChildren: true || false,
119123
* // Result: "STRING_VALUE",
120124
* // Error: { // ErrorObject
121125
* // ErrorMessage: "STRING_VALUE",

dex-internal-sdk/dist-types/commands/GetDurableExecutionStateCommand.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ declare const GetDurableExecutionStateCommand_base: {
8181
* // InputPayload: "STRING_VALUE",
8282
* // },
8383
* // ContextDetails: { // ContextDetails
84+
* // ReplayChildren: true || false,
8485
* // Result: "STRING_VALUE",
8586
* // Error: { // ErrorObject
8687
* // ErrorMessage: "STRING_VALUE",

dex-internal-sdk/dist-types/models/models_0.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,12 @@ export declare const OperationAction: {
157157
*/
158158
export type OperationAction =
159159
(typeof OperationAction)[keyof typeof OperationAction];
160+
/**
161+
* @public
162+
*/
163+
export interface ContextOptions {
164+
ReplayChildren?: boolean | undefined;
165+
}
160166
/**
161167
* @public
162168
*/
@@ -205,6 +211,7 @@ export interface OperationUpdate {
205211
Action?: OperationAction | undefined;
206212
Payload?: string | undefined;
207213
Error?: ErrorObject | undefined;
214+
ContextOptions?: ContextOptions | undefined;
208215
StepOptions?: StepOptions | undefined;
209216
WaitOptions?: WaitOptions | undefined;
210217
CallbackOptions?: CallbackOptions | undefined;
@@ -234,6 +241,7 @@ export declare const CheckpointDurableExecutionRequestFilterSensitiveLog: (
234241
* @public
235242
*/
236243
export interface ContextDetails {
244+
ReplayChildren?: boolean | undefined;
237245
Result?: string | undefined;
238246
Error?: ErrorObject | undefined;
239247
}

dex-internal-sdk/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@
88
"build:es": "tsc -p tsconfig.es.json",
99
"build:types": "tsc -p tsconfig.types.json",
1010
"build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4",
11-
"clean": "node_modules/.bin/rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0",
11+
"clean": "rimraf ./dist-* && rimraf *.tsbuildinfo || exit 0",
1212
"prepack": "npm run clean && npm run build"
1313
},
14-
"main": "dist-cjs/index.js",
14+
"main": "./dist-cjs/index.js",
1515
"types": "./dist-types/index.d.ts",
16-
"module": "dist-es/index.js",
16+
"module": "./dist-es/index.js",
1717
"sideEffects": false,
1818
"dependencies": {
1919
"tslib": "^2.6.2",

lambda-durable-functions-testing-sdk-js/src/checkpoint-server/__tests__/checkpoint-server.test.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,7 @@ describe("checkpoint-server", () => {
349349
];
350350

351351
const mockStorage = {
352-
operationDataMap: new Map([
353-
["op1", { operation: mockOperations[0] }],
354-
["op2", { operation: mockOperations[1] }],
355-
]),
352+
getState: jest.fn().mockReturnValue(mockOperations),
356353
};
357354

358355
mockExecutionManager.getCheckpointsByToken.mockReturnValueOnce({

lambda-durable-functions-testing-sdk-js/src/checkpoint-server/checkpoint-server.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -189,12 +189,8 @@ export async function startCheckpointServer(port: number) {
189189
return;
190190
}
191191

192-
const operations = Array.from(
193-
executionData.storage.operationDataMap.values()
194-
).map((operationData) => operationData.operation);
195-
196192
const output: GetDurableExecutionStateResponse = {
197-
Operations: operations,
193+
Operations: executionData.storage.getState(),
198194
NextMarker: undefined,
199195
};
200196

0 commit comments

Comments
 (0)