Skip to content

Commit b8f344b

Browse files
committed
feat: add getVersionHash to workflow class
1 parent b99106d commit b8f344b

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

packages/project/src/Workflow.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as l from '@openfn/lexicon';
22
import slugify from './util/slugify';
3+
import { generateHash } from './util/version';
34

45
const clone = (obj) => JSON.parse(JSON.stringify(obj));
56

@@ -162,6 +163,10 @@ class Workflow {
162163
getUUIDMap(): Record<string, string> {
163164
return this.index.uuid;
164165
}
166+
167+
getVersionHash() {
168+
return generateHash(this);
169+
}
165170
}
166171

167172
export default Workflow;

packages/project/test/util/version-workflow.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ test('generate an 12 character version hash for a basic workflow', (t) => {
1313
`
1414
);
1515

16-
const hash = generateHash(workflow);
16+
const hash = workflow.getVersionHash();
1717
t.log(hash);
1818
t.is(hash, 'cli:7e5ca7843721');
1919
});

0 commit comments

Comments
 (0)