-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP - Update Node SDK to match recent breaking changes (#159)
* chore(version control): init commit for wip pr * refactor(workflow-node-sdk): reduced API drift and now node sdk resembles browser sdk more closely * refactor(workflow-core): renamed instances of workflowDefinition to definition matches latest data model of the workflow service * refactor(workflow-core): replaced instance of workflowDefinitionType with definitionType * refactor(workflow-node-sdk): replaced instances of workflowDefinition with definition matches workflow-core's latest API * refactor(workflow-node-sdk): replaced instances of workflowDefinitionType with definitionType * refactor(workflow-browser-sdk): renamed instances of workflowDefinition to match workflow-core's API * refactor(workflow-browser-sdk): renamed instances of workflowDefinitionType to match workflow-core * fix(workflow-core): fixed an instance of definition that was supposed to be definitionType * feat(*): checkpoint * fix(workflow-core): fixed extensions null breaking workflow-core
- Loading branch information
Showing
25 changed files
with
294 additions
and
230 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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@ballerine/workflow-node-sdk': patch | ||
--- | ||
|
||
reduced API drift and now node sdk resembles the browser sdk more closely |
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
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 |
---|---|---|
@@ -1,7 +1,2 @@ | ||
import { createNodeWorkflow, NodeWorkflowOptions, NodeWorkflow } from "./lib/node-workflow"; | ||
|
||
type TInitNodeWorkflow = (options: NodeWorkflowOptions) => NodeWorkflow; | ||
|
||
export const initNodeWorkflow: TInitNodeWorkflow = (options) => { | ||
return createNodeWorkflow(options); | ||
} | ||
export { createWorkflow, WorkflowNodeSDK } from './lib'; | ||
export type { WorkflowOptionsNode } from './lib'; |
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 @@ | ||
export { MemoryStore } from './memory-store'; |
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,43 +1,38 @@ | ||
import { StoreAdapter, TPutWorkflow, TRemoveWorkflow, WorkflowData } from "./adapter"; | ||
import { StoreAdapter, WorkflowData } from './types'; | ||
|
||
export class MemoryStore implements StoreAdapter { | ||
|
||
|
||
#__store: Record<PropertyKey, Record<PropertyKey, WorkflowData>>; | ||
|
||
constructor() { | ||
this.#__store = {} | ||
} | ||
|
||
|
||
|
||
// Get all active workflows for entity | ||
find(entityId: string) { | ||
const entityWorkflows: string[] = []; | ||
for (const workflowId in this.#__store) { | ||
if (this.#__store[workflowId]![entityId]) { | ||
entityWorkflows.push(workflowId); | ||
} | ||
} | ||
|
||
return entityWorkflows; | ||
#__store: Record<PropertyKey, Record<PropertyKey, WorkflowData>>; | ||
|
||
constructor() { | ||
this.#__store = {}; | ||
} | ||
|
||
// Get all active workflows for entity | ||
find(entityId: string) { | ||
const entityWorkflows: string[] = []; | ||
for (const workflowId in this.#__store) { | ||
if (this.#__store[workflowId]![entityId]) { | ||
entityWorkflows.push(workflowId); | ||
} | ||
} | ||
|
||
get(workflowId: string, entityId: string): WorkflowData|undefined { | ||
return this.#__store[workflowId]?.[entityId]; | ||
} | ||
return entityWorkflows; | ||
} | ||
|
||
put( workflowId:string, entityId: string, data: WorkflowData ) { | ||
get(workflowId: string, entityId: string): WorkflowData | undefined { | ||
return this.#__store[workflowId]?.[entityId]; | ||
} | ||
|
||
if (this.#__store[workflowId] === undefined) { | ||
this.#__store[workflowId] = {}; | ||
} | ||
this.#__store[workflowId]![entityId] = data; | ||
put(workflowId: string, entityId: string, data: WorkflowData) { | ||
if (this.#__store[workflowId] === undefined) { | ||
this.#__store[workflowId] = {}; | ||
} | ||
this.#__store[workflowId]![entityId] = data; | ||
} | ||
|
||
remove( workflowId: string, entityId: string) { | ||
if (this.#__store[workflowId] !== undefined) { | ||
delete this.#__store[workflowId]![entityId] | ||
} | ||
remove(workflowId: string, entityId: string) { | ||
if (this.#__store[workflowId] !== undefined) { | ||
delete this.#__store[workflowId]![entityId]; | ||
} | ||
} | ||
} |
Oops, something went wrong.