-
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.
- Loading branch information
1 parent
cf81c7d
commit d7ae38d
Showing
11 changed files
with
88 additions
and
13 deletions.
There are no files selected for viewing
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,9 +1 @@ | ||
import {Configuration} from 'xdb-ts-api' | ||
// | ||
// console.log(new Configuration()) | ||
|
||
export function add(a: number, b: number): number { | ||
return a + b; | ||
} | ||
|
||
console.log(add(3, 5)); //output: 8 |
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,42 @@ | ||
import {RetryPolicy} from 'xdb-ts-api' | ||
import {Context} from "./context"; | ||
import {Persistence} from "./persistence"; | ||
import {Communication} from "./communication"; | ||
import {StateDecision} from "./state-decision"; | ||
import {CommandRequest} from "./command-request"; | ||
|
||
export interface AsyncState<Input>{ | ||
stateOptions?:AsyncStateOptions | ||
waitUntil?:WaitUntilMethod<Input> | ||
execute(ctx:Context, input:Input, persistence:Persistence, communication :Communication):StateDecision | ||
} | ||
|
||
export interface WaitUntilMethod<Input>{ | ||
waitUntil(ctx:Context, input:Input, communication: Communication):CommandRequest | ||
} | ||
export interface AsyncStateOptions{ | ||
// waitUntilTimeoutSeconds is the timeout for the waitUntil API call. | ||
// Default: 10 seconds(configurable in server) when set as 0 | ||
// It will be capped to 60 seconds by server (configurable in server) | ||
waitUntilTimeoutSeconds?: number | ||
// executeTimeoutSeconds is the timeout for the execute API call. | ||
// Default: 10 seconds(configurable in server) when set as 0 | ||
// It will be capped to 60 seconds by server (configurable in server) | ||
executeTimeoutSeconds?: number | ||
// waitUntilRetryPolicy is the retry policy for the waitUntil API call. | ||
// Default: infinite retry with 1 second initial interval, 120 seconds max interval, and 2 backoff factor, | ||
// when set as nil | ||
waitUntilRetryPolicy?:RetryPolicy | ||
// executeRetryPolicy is the retry policy for the execute API call. | ||
// Default: infinite retry with 1 second initial interval, 120 seconds max interval, and 2 backoff factor, | ||
// when set as nil | ||
executeRetryPolicy?:RetryPolicy | ||
// failureRecoveryState is the state to recover after current state execution fails | ||
// Default: no recovery when set as nil | ||
failureRecoveryState?: AsyncState<any> | ||
// persistencePolicyName is the name of loading policy for persistence if not using default policy | ||
persistencePolicyName?:string | ||
// stateId is the unique identifier of the state. | ||
// It is being used for WorkerService to choose the right AsyncState to execute Start/Execute APIs | ||
stateId?: string | ||
} |
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,3 @@ | ||
export interface CommandRequest{ | ||
// TODO | ||
} |
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,4 @@ | ||
|
||
export interface Communication{ | ||
// TODO | ||
} |
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,4 @@ | ||
|
||
export interface Context{ | ||
// TODO | ||
} |
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,3 @@ | ||
export interface PersistenceSchema{ | ||
// TODO | ||
} |
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,3 @@ | ||
export interface Persistence{ | ||
// TODO | ||
} |
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,21 @@ | ||
import {StateSchema} from "./state-schema"; | ||
import {PersistenceSchema} from "./persistence-schema"; | ||
import {ProcessIdReusePolicy} from "xdb-ts-api"; | ||
|
||
export interface Process{ | ||
stateSchema?:StateSchema | ||
persistenceSchema?:PersistenceSchema | ||
processOptions?:ProcessOptions | ||
} | ||
|
||
export interface ProcessOptions{ | ||
// TimeoutSeconds is the timeout for the process execution. | ||
// Default: 0, mean which means infinite timeout | ||
timeoutSeconds?:number | ||
// IdReusePolicy is the policy for reusing process id. | ||
// Default: xdbapi.ALLOW_IF_NO_RUNNING when set as nil | ||
idReusePolicy?:ProcessIdReusePolicy | ||
// processType defines the processType of this process definition. | ||
// GetFinalProcessType set the default value when return empty string | ||
processType?:string | ||
} |
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,3 @@ | ||
export interface StateDecision{ | ||
// TODO | ||
} |
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,3 @@ | ||
export interface StateSchema{ | ||
// TODO | ||
} |
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,6 +1,3 @@ | ||
import { add } from '../src'; | ||
|
||
test('adds two numbers correctly', () => { | ||
const result = add(2, 3); | ||
expect(result).toBe(5); | ||
test('TODO', () => { | ||
console.log("hello world") | ||
}); |