-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from allanhvam/dev
fix: workflow services optional, docs, lint
- Loading branch information
Showing
20 changed files
with
112 additions
and
44 deletions.
There are no files selected for viewing
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export { serializeError, deserializeError } from "./serialize-error.js"; | ||
export { ISerializer } from "./ISerializer.js"; | ||
export { DefaultSerializer } from "./DefaultSerializer.js"; | ||
export type { ISerializer } from "./ISerializer.js"; | ||
export { DefaultSerializer } from "./DefaultSerializer.js"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,4 @@ import { add } from "../activities/add.js"; | |
|
||
export class MathService { | ||
public add = add; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { test } from "node:test"; | ||
import assert from "node:assert"; | ||
import { Worker } from "../worker/Worker.js"; | ||
import { DurableFunctionsWorkflowHistoryStore } from "../stores/index.js"; | ||
import { startup } from "./workflows/startup.js"; | ||
import { sleep } from "../sleep.js"; | ||
|
||
test.before(async () => { | ||
const worker = Worker.getInstance(); | ||
|
||
let isStorageEmulatorRunning = false; | ||
try { | ||
const response = await fetch("http://127.0.0.1:10000"); | ||
if (response.status === 400) { | ||
isStorageEmulatorRunning = true; | ||
} | ||
} catch { | ||
console.log("Storage emulator not running, using memory."); | ||
} | ||
|
||
if (isStorageEmulatorRunning) { | ||
const store = new DurableFunctionsWorkflowHistoryStore({ | ||
connectionString: "UseDevelopmentStorage=true", | ||
taskHubName: "Workflows", | ||
}); | ||
await store.clear(); | ||
worker.store = store; | ||
} | ||
worker.log = (s: string) => console.log(`[${new Date().toISOString()}] ${s}`); | ||
}); | ||
|
||
void test("startup trigger args", async (t) => { | ||
// Arrange | ||
const workflow = startup; | ||
const worker = Worker.getInstance(); | ||
const store = worker.store; | ||
|
||
// Act | ||
await workflow.start(); | ||
await sleep("1s"); // Wait for trigger to fire | ||
|
||
// Assert | ||
const result = await store.getInstances(); | ||
const instanceHeader = result.instances.find(i => i.instanceId.startsWith(workflow.name)); | ||
assert.ok(instanceHeader); | ||
|
||
const instance = await store.getInstance(instanceHeader.instanceId); | ||
|
||
assert.ok(instance); | ||
assert.deepEqual(instance?.args, [undefined]); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { startup as startupTrigger } from "../../triggers/startup.js"; | ||
import { workflow } from "../../workflows/index.js"; | ||
|
||
export const startup = workflow({ | ||
name: "startup", | ||
description: "Test for startup trigger.", | ||
trigger: startupTrigger(), | ||
run: () => async () => { | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters