Skip to content

Commit b4eb4cf

Browse files
committed
remove startorch changes from this pr
1 parent 60d8599 commit b4eb4cf

File tree

3 files changed

+6
-84
lines changed

3 files changed

+6
-84
lines changed

packages/durabletask-js/src/client/client.ts

Lines changed: 5 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,8 @@ import { HistoryEvent } from "../orchestration/history-event";
2525
import { convertProtoHistoryEvent } from "../utils/history-event-converter";
2626
import { Logger, ConsoleLogger } from "../types/logger.type";
2727

28-
/**
29-
* Options for scheduling a new orchestration instance.
30-
*/
31-
export interface StartOrchestrationOptions {
32-
/** The input to pass to the orchestration. */
33-
input?: TInput;
34-
/** The unique ID for the orchestration instance. If not specified, a new GUID is generated. */
35-
instanceId?: string;
36-
/** The time when the orchestration should start executing. If not specified, starts immediately. */
37-
startAt?: Date;
38-
/** Tags to associate with the orchestration instance. */
39-
tags?: Record<string, string>;
40-
}
28+
// Re-export MetadataGenerator for backward compatibility
29+
export { MetadataGenerator } from "../utils/grpc-helper.util";
4130

4231
/**
4332
* Options for creating a TaskHubGrpcClient.
@@ -139,36 +128,14 @@ export class TaskHubGrpcClient {
139128
* Schedules a new orchestrator using the DurableTask client.
140129
*
141130
* @param {TOrchestrator | string} orchestrator - The orchestrator or the name of the orchestrator to be scheduled.
142-
* @param {TInput | StartOrchestrationOptions} inputOrOptions - The input to pass to the orchestrator, or an options object.
143-
* @param {string} instanceId - (Deprecated) Use options object instead. The unique ID for the orchestration instance.
144-
* @param {Date} startAt - (Deprecated) Use options object instead. The time when the orchestration should start.
145131
* @return {Promise<string>} A Promise resolving to the unique ID of the scheduled orchestrator instance.
146132
*/
147133
async scheduleNewOrchestration(
148134
orchestrator: TOrchestrator | string,
149-
inputOrOptions?: TInput | StartOrchestrationOptions,
135+
input?: TInput,
150136
instanceId?: string,
151137
startAt?: Date,
152138
): Promise<string> {
153-
// Determine if inputOrOptions is an options object or raw input
154-
let input: TInput | undefined;
155-
let resolvedInstanceId: string | undefined = instanceId;
156-
let resolvedStartAt: Date | undefined = startAt;
157-
let tags: Record<string, string> | undefined;
158-
159-
if (inputOrOptions !== null && typeof inputOrOptions === 'object' && !Array.isArray(inputOrOptions) &&
160-
('input' in inputOrOptions || 'instanceId' in inputOrOptions || 'startAt' in inputOrOptions || 'tags' in inputOrOptions)) {
161-
// It's an options object
162-
const options = inputOrOptions as StartOrchestrationOptions;
163-
input = options.input;
164-
resolvedInstanceId = options.instanceId ?? instanceId;
165-
resolvedStartAt = options.startAt ?? startAt;
166-
tags = options.tags;
167-
} else {
168-
// It's raw input (backward compatible)
169-
input = inputOrOptions as TInput;
170-
}
171-
172139
let name;
173140
if (typeof orchestrator === "string") {
174141
name = orchestrator;
@@ -177,25 +144,17 @@ export class TaskHubGrpcClient {
177144
}
178145
const req = new pb.CreateInstanceRequest();
179146
req.setName(name);
180-
req.setInstanceid(resolvedInstanceId ?? randomUUID());
147+
req.setInstanceid(instanceId ?? randomUUID());
181148

182149
const i = new StringValue();
183150
i.setValue(JSON.stringify(input));
184151

185152
const ts = new Timestamp();
186-
ts.fromDate(new Date(resolvedStartAt?.getTime() ?? 0));
153+
ts.fromDate(new Date(startAt?.getTime() ?? 0));
187154

188155
req.setInput(i);
189156
req.setScheduledstarttimestamp(ts);
190157

191-
// Set tags if provided
192-
if (tags) {
193-
const tagsMap = req.getTagsMap();
194-
for (const [key, value] of Object.entries(tags)) {
195-
tagsMap.set(key, value);
196-
}
197-
}
198-
199158
this._logger.info(`Starting new ${name} instance with ID = ${req.getInstanceid()}`);
200159

201160
const res = await callWithMetadata<pb.CreateInstanceRequest, pb.CreateInstanceResponse>(

packages/durabletask-js/src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
// Licensed under the MIT License.
33

44
// Client and Worker
5-
export { TaskHubGrpcClient, TaskHubGrpcClientOptions, StartOrchestrationOptions } from "./client/client";
6-
export { MetadataGenerator } from "./utils/grpc-helper.util";
5+
export { TaskHubGrpcClient, TaskHubGrpcClientOptions, MetadataGenerator } from "./client/client";
76
export { TaskHubGrpcWorker, TaskHubGrpcWorkerOptions } from "./worker/task-hub-grpc-worker";
87

98
// Contexts

test/e2e-azuremanaged/history.spec.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -341,42 +341,6 @@ describe("getOrchestrationHistory E2E Tests", () => {
341341
expect(executionCompletedEvents.length).toBe(1);
342342
}, 31000);
343343

344-
it("should include tags in ExecutionStarted event", async () => {
345-
const taggedOrchestrator: TOrchestrator = async (_: OrchestrationContext) => {
346-
return "Tagged result";
347-
};
348-
349-
taskHubWorker.addOrchestrator(taggedOrchestrator);
350-
await taskHubWorker.start();
351-
352-
const tags = {
353-
"environment": "test",
354-
"owner": "copilot",
355-
"priority": "high"
356-
};
357-
358-
const id = await taskHubClient.scheduleNewOrchestration(taggedOrchestrator, {
359-
tags: tags
360-
});
361-
await taskHubClient.waitForOrchestrationCompletion(id, undefined, 30);
362-
363-
const history = await taskHubClient.getOrchestrationHistory(id);
364-
365-
expect(history).toBeDefined();
366-
expect(history.length).toBeGreaterThan(0);
367-
368-
// Check for ExecutionStarted event with tags
369-
const startedEvents = history.filter(e => e.type === HistoryEventType.ExecutionStarted) as ExecutionStartedEvent[];
370-
expect(startedEvents.length).toBe(1);
371-
372-
const startedEvent = startedEvents[0];
373-
expect(startedEvent.tags).toBeDefined();
374-
expect(startedEvent.tags).toEqual(tags);
375-
expect(startedEvent.tags?.["environment"]).toBe("test");
376-
expect(startedEvent.tags?.["owner"]).toBe("copilot");
377-
expect(startedEvent.tags?.["priority"]).toBe("high");
378-
}, 31000);
379-
380344
it("should validate complete history event sequence for orchestration with activity, sub-orchestration, and timer", async () => {
381345
// Define activity
382346
const greetActivity = async (_: ActivityContext, name: string) => {

0 commit comments

Comments
 (0)