@exaudeus/workrail 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/manifest.json +136 -16
  2. package/dist/runtime/brand.d.ts +1 -3
  3. package/dist/v2/durable-core/canonical/hashing.d.ts +3 -1
  4. package/dist/v2/durable-core/canonical/hashing.js +9 -0
  5. package/dist/v2/durable-core/ids/index.d.ts +4 -0
  6. package/dist/v2/durable-core/ids/index.js +8 -0
  7. package/dist/v2/durable-core/projections/snapshot-state.d.ts +3 -0
  8. package/dist/v2/durable-core/projections/snapshot-state.js +14 -0
  9. package/dist/v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.d.ts +1042 -0
  10. package/dist/v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.js +119 -0
  11. package/dist/v2/durable-core/schemas/execution-snapshot/index.d.ts +4 -0
  12. package/dist/v2/durable-core/schemas/execution-snapshot/index.js +17 -0
  13. package/dist/v2/durable-core/schemas/execution-snapshot/step-instance-key.d.ts +21 -0
  14. package/dist/v2/durable-core/schemas/execution-snapshot/step-instance-key.js +67 -0
  15. package/dist/v2/durable-core/tokens/base64url.d.ts +7 -0
  16. package/dist/v2/durable-core/tokens/base64url.js +16 -0
  17. package/dist/v2/durable-core/tokens/index.d.ts +7 -0
  18. package/dist/v2/durable-core/tokens/index.js +20 -0
  19. package/dist/v2/durable-core/tokens/payloads.d.ts +210 -0
  20. package/dist/v2/durable-core/tokens/payloads.js +53 -0
  21. package/dist/v2/durable-core/tokens/token-codec.d.ts +31 -0
  22. package/dist/v2/durable-core/tokens/token-codec.js +64 -0
  23. package/dist/v2/durable-core/tokens/token-signer.d.ts +15 -0
  24. package/dist/v2/durable-core/tokens/token-signer.js +55 -0
  25. package/dist/v2/infra/local/data-dir/index.d.ts +4 -0
  26. package/dist/v2/infra/local/data-dir/index.js +12 -0
  27. package/dist/v2/infra/local/hmac-sha256/index.d.ts +5 -0
  28. package/dist/v2/infra/local/hmac-sha256/index.js +16 -0
  29. package/dist/v2/infra/local/keyring/index.d.ts +14 -0
  30. package/dist/v2/infra/local/keyring/index.js +103 -0
  31. package/dist/v2/infra/local/snapshot-store/index.d.ts +15 -0
  32. package/dist/v2/infra/local/snapshot-store/index.js +76 -0
  33. package/dist/v2/ports/data-dir.port.d.ts +4 -0
  34. package/dist/v2/ports/hmac-sha256.port.d.ts +4 -0
  35. package/dist/v2/ports/hmac-sha256.port.js +2 -0
  36. package/dist/v2/ports/keyring.port.d.ts +26 -0
  37. package/dist/v2/ports/keyring.port.js +2 -0
  38. package/dist/v2/ports/snapshot-store.port.d.ts +17 -0
  39. package/dist/v2/ports/snapshot-store.port.js +2 -0
  40. package/package.json +1 -1
@@ -682,8 +682,8 @@
682
682
  "bytes": 203
683
683
  },
684
684
  "runtime/brand.d.ts": {
685
- "sha256": "6ba575755cd70d822f9ee8f7784ae1d249d582d1917dd71f305f3295cbcc43fd",
686
- "bytes": 122
685
+ "sha256": "df90760acef03f2f72fbf56b0f591ce3939e93cd92bf28a817bea99a69873513",
686
+ "bytes": 75
687
687
  },
688
688
  "runtime/brand.js": {
689
689
  "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
@@ -834,12 +834,12 @@
834
834
  "bytes": 1657
835
835
  },
836
836
  "v2/durable-core/canonical/hashing.d.ts": {
837
- "sha256": "ec6ec6c2f4b2b680c60375d0dbc6ac43d918627f28c2bab9e7e973f37b2519ce",
838
- "bytes": 506
837
+ "sha256": "0c62bfc24f7c15994cf2aee07bae50b50c8cd4ae2bcdc28138bdea662b15d8e3",
838
+ "bytes": 761
839
839
  },
840
840
  "v2/durable-core/canonical/hashing.js": {
841
- "sha256": "7f31c6a4410e2442ae8a61b11c2ab1b230726bc35216654ed1b359622d9359d3",
842
- "bytes": 538
841
+ "sha256": "47c4e63841d99d7d4de001090aa878d27eacdc3f52901bbe4a19795b6af0205b",
842
+ "bytes": 931
843
843
  },
844
844
  "v2/durable-core/canonical/jcs.d.ts": {
845
845
  "sha256": "b41750449385163d746305425514af1b34d8c92fa82df65008245b1849e9661f",
@@ -874,12 +874,12 @@
874
874
  "bytes": 447
875
875
  },
876
876
  "v2/durable-core/ids/index.d.ts": {
877
- "sha256": "63b5f38f741478e22585a27db360e6f13e2b1301d68028431a20d7054b29952c",
878
- "bytes": 1426
877
+ "sha256": "47f0922ce721516b60c38cc827e3dbeea83074093c62e62cbbfa7e4ce0ea959c",
878
+ "bytes": 1678
879
879
  },
880
880
  "v2/durable-core/ids/index.js": {
881
- "sha256": "f329b3749ee778224555e6d4eadfed232ddb216a3348ff8b69984a0ee2bf6e6c",
882
- "bytes": 1042
881
+ "sha256": "8b348436b2ae504f6e57cc4332746fb2c8d639520071b373bdd0e7da409a59bb",
882
+ "bytes": 1224
883
883
  },
884
884
  "v2/durable-core/ids/with-healthy-session-lock.d.ts": {
885
885
  "sha256": "dc1812850b9ce69c0135d575b0994ac4fa7b874bf9db7a1838b6a3390ef31ae2",
@@ -889,6 +889,14 @@
889
889
  "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
890
890
  "bytes": 77
891
891
  },
892
+ "v2/durable-core/projections/snapshot-state.d.ts": {
893
+ "sha256": "0ce739459968dad16fb135730d8ea70fa04ce24539b74982801cc8eec01a6130",
894
+ "bytes": 252
895
+ },
896
+ "v2/durable-core/projections/snapshot-state.js": {
897
+ "sha256": "9a49a15ac4cdeecb7624e9199ce68823515ea1f56d45ce3030acd30023f73eeb",
898
+ "bytes": 428
899
+ },
892
900
  "v2/durable-core/schemas/compiled-workflow/index.d.ts": {
893
901
  "sha256": "caab753a39b7abc1e3c52bfd2fca93402a8a1b11c2ef13aaf5c2c0a86f7ba135",
894
902
  "bytes": 1171
@@ -897,6 +905,30 @@
897
905
  "sha256": "49e3b2f36fe18e75f864b402db0d58f8e1d66e6116fe381af9fc0c76e6f00f8f",
898
906
  "bytes": 621
899
907
  },
908
+ "v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.d.ts": {
909
+ "sha256": "96ad2f741274a55ecfeb3cd4c385938db6d4f4f25fee7ea460158b09e4422988",
910
+ "bytes": 30004
911
+ },
912
+ "v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.js": {
913
+ "sha256": "d93a81d14644459fd79b734077c101747b6d8a01f5989bc0ee90b82e87ab4322",
914
+ "bytes": 5081
915
+ },
916
+ "v2/durable-core/schemas/execution-snapshot/index.d.ts": {
917
+ "sha256": "3c312cda4aba0da547ca19041ba85a93ec596f8ac572574eaba0a7164746ec25",
918
+ "bytes": 641
919
+ },
920
+ "v2/durable-core/schemas/execution-snapshot/index.js": {
921
+ "sha256": "c628819ebb94610012d42e301f320c1550fa4f645d8ad9aa0379a5f5099e82a6",
922
+ "bytes": 2494
923
+ },
924
+ "v2/durable-core/schemas/execution-snapshot/step-instance-key.d.ts": {
925
+ "sha256": "183bf693b36827a93882732269ef0dab8380eb7e2426f0fd72fbc7407647ee04",
926
+ "bytes": 1147
927
+ },
928
+ "v2/durable-core/schemas/execution-snapshot/step-instance-key.js": {
929
+ "sha256": "600b896c6a23e064478f600ae82923317ce343d9a79e7fe919a8fe8d3354bd4e",
930
+ "bytes": 2983
931
+ },
900
932
  "v2/durable-core/schemas/session/events.d.ts": {
901
933
  "sha256": "8de8d8904b67ca93d985c1e215f216d929612fb14357888f88ff270f6ac3c40f",
902
934
  "bytes": 61834
@@ -929,6 +961,46 @@
929
961
  "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
930
962
  "bytes": 77
931
963
  },
964
+ "v2/durable-core/tokens/base64url.d.ts": {
965
+ "sha256": "0db76718338dbc78d647c0bb213059f6a127894a6bcc17e5acb837a99f6da323",
966
+ "bytes": 306
967
+ },
968
+ "v2/durable-core/tokens/base64url.js": {
969
+ "sha256": "fbcc82c734d32b150ecb1420ce6bbc684741437930ad98b10992130d000b6bab",
970
+ "bytes": 558
971
+ },
972
+ "v2/durable-core/tokens/index.d.ts": {
973
+ "sha256": "4409ca6cf0245ad850f61652884d9121c8442797e0602a41d2e32a63d04d9d35",
974
+ "bytes": 686
975
+ },
976
+ "v2/durable-core/tokens/index.js": {
977
+ "sha256": "7b4fe787fea9f215b42902ae08a5c94daa4941fb5283de9524feb0b4ef603bf7",
978
+ "bytes": 2594
979
+ },
980
+ "v2/durable-core/tokens/payloads.d.ts": {
981
+ "sha256": "2889ce061b4734cc3ccdc1df315bc58170a421de1661a5bb7cf08710a7e43d53",
982
+ "bytes": 6756
983
+ },
984
+ "v2/durable-core/tokens/payloads.js": {
985
+ "sha256": "f1026ba47d9b2e0ab3bbec47aa9e8afd5695805f6f4a83ecddd4610616ea4def",
986
+ "bytes": 2343
987
+ },
988
+ "v2/durable-core/tokens/token-codec.d.ts": {
989
+ "sha256": "f03dfaa7ce652ab0fb175f765e3d286c2713db6b40e53716a2b5aff74937705c",
990
+ "bytes": 1223
991
+ },
992
+ "v2/durable-core/tokens/token-codec.js": {
993
+ "sha256": "557c1ee23e4cdb050344d9c4944aec2a1b9e6a90018200290c4d6ea6185bd520",
994
+ "bytes": 3127
995
+ },
996
+ "v2/durable-core/tokens/token-signer.d.ts": {
997
+ "sha256": "2ce41a829043871a35f4d845eb8c56d038b5b877740cd3511457dbbf96ef2324",
998
+ "bytes": 1001
999
+ },
1000
+ "v2/durable-core/tokens/token-signer.js": {
1001
+ "sha256": "554c8fb8bf46a02edc019435c37a2d84ef174b29e850fe4b697f5c56e67004eb",
1002
+ "bytes": 3002
1003
+ },
932
1004
  "v2/infra/local/crypto/index.d.ts": {
933
1005
  "sha256": "d2f6cc8e812bd4fb5c83e59f46c4b5588baa1bf33c029239d8162f8669a64370",
934
1006
  "bytes": 279
@@ -938,12 +1010,12 @@
938
1010
  "bytes": 457
939
1011
  },
940
1012
  "v2/infra/local/data-dir/index.d.ts": {
941
- "sha256": "a544531e14c57499047676209f1a207044a4e5dee720a0e7f005ff4599bae14c",
942
- "bytes": 544
1013
+ "sha256": "cc5e40d0dd5d2d620c157c923e3c3d7786afe8a02387573d17252870104eea7a",
1014
+ "bytes": 669
943
1015
  },
944
1016
  "v2/infra/local/data-dir/index.js": {
945
- "sha256": "eb8cfda7db3e4d337f3e4c21b1a525fa5b00dbe4d729423f93d71b2cdead292f",
946
- "bytes": 2542
1017
+ "sha256": "105edb036f096d108338e5e5e4d1c33128a052e869dab2e4c9c432605f01808d",
1018
+ "bytes": 2882
947
1019
  },
948
1020
  "v2/infra/local/fs/index.d.ts": {
949
1021
  "sha256": "d830aed74ebb3372ea5efa21ec96680cd188fc76dea6078286f5788b3736d2bf",
@@ -953,6 +1025,22 @@
953
1025
  "sha256": "409030bf18b98fe09f0801a22826978b2cb6022f71bc7e83fad00cfc8aebb3fb",
954
1026
  "bytes": 6725
955
1027
  },
1028
+ "v2/infra/local/hmac-sha256/index.d.ts": {
1029
+ "sha256": "dda3865510dfaf2f13947410d998da6ffecc9a2e728b3574f81e69d5db859815",
1030
+ "bytes": 272
1031
+ },
1032
+ "v2/infra/local/hmac-sha256/index.js": {
1033
+ "sha256": "11917c1d29f34efcd7139f5573067ad20a4093a1c5190e6069ccdc25acf53f24",
1034
+ "bytes": 578
1035
+ },
1036
+ "v2/infra/local/keyring/index.d.ts": {
1037
+ "sha256": "e14c988729fc8bdf194d2e6520dc87f366f949f9fc0562b088b458482e799194",
1038
+ "bytes": 657
1039
+ },
1040
+ "v2/infra/local/keyring/index.js": {
1041
+ "sha256": "875ae8f90d0b13e0cea19e537ef0279b1b80d2ad155b5b602226a7271a0b3b7d",
1042
+ "bytes": 3839
1043
+ },
956
1044
  "v2/infra/local/pinned-workflow-store/index.d.ts": {
957
1045
  "sha256": "d2342ebedf9ce061615a85c1fd4c64de117ea943232da08beef7916c8ecd0a96",
958
1046
  "bytes": 809
@@ -985,9 +1073,17 @@
985
1073
  "sha256": "c2a799d22880f0ef9f50d004b44cf1d829c3c5afeec72dfd6e6d5d12bb6a1747",
986
1074
  "bytes": 457
987
1075
  },
1076
+ "v2/infra/local/snapshot-store/index.d.ts": {
1077
+ "sha256": "5fea7c8a5840b498d10adb51a1963d7fb31b1bb2bdf99e0cdde30b834743cf3f",
1078
+ "bytes": 1017
1079
+ },
1080
+ "v2/infra/local/snapshot-store/index.js": {
1081
+ "sha256": "2b8d3db16aec20de6cc697ed3ae1fc2143f9b6d7d1bda8c7d30c8e0feb7fdb21",
1082
+ "bytes": 3372
1083
+ },
988
1084
  "v2/ports/data-dir.port.d.ts": {
989
- "sha256": "997e81b3ec3d29d3097f34d9cee56d1cb55be45bc6606bae8c06a1749259eba7",
990
- "bytes": 342
1085
+ "sha256": "4f958bb4b89a87ede17942800903db3c8c55faffea514472fa916aad578050c9",
1086
+ "bytes": 467
991
1087
  },
992
1088
  "v2/ports/data-dir.port.js": {
993
1089
  "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
@@ -1001,6 +1097,22 @@
1001
1097
  "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
1002
1098
  "bytes": 77
1003
1099
  },
1100
+ "v2/ports/hmac-sha256.port.d.ts": {
1101
+ "sha256": "36bb3cffc90ce7e9ce5a60fb6cd1667d584e438ac273ca9e98e73094d98e6da9",
1102
+ "bytes": 164
1103
+ },
1104
+ "v2/ports/hmac-sha256.port.js": {
1105
+ "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
1106
+ "bytes": 77
1107
+ },
1108
+ "v2/ports/keyring.port.d.ts": {
1109
+ "sha256": "760953161ee37dba94d965d1e84ee15508e307325bd28f59eee7ab477a584e0a",
1110
+ "bytes": 737
1111
+ },
1112
+ "v2/ports/keyring.port.js": {
1113
+ "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
1114
+ "bytes": 77
1115
+ },
1004
1116
  "v2/ports/pinned-workflow-store.port.d.ts": {
1005
1117
  "sha256": "1803a47bad9777e37f1fef0fa51e67c0d0c39e0e2b5871f16c03546d3d1096b7",
1006
1118
  "bytes": 614
@@ -1033,6 +1145,14 @@
1033
1145
  "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
1034
1146
  "bytes": 77
1035
1147
  },
1148
+ "v2/ports/snapshot-store.port.d.ts": {
1149
+ "sha256": "2e41a43f36d71dc44dd5adf3202c612176a44ef81a90145f44d55c79fddee3b3",
1150
+ "bytes": 781
1151
+ },
1152
+ "v2/ports/snapshot-store.port.js": {
1153
+ "sha256": "d43aa81f5bc89faa359e0f97c814ba25155591ff078fbb9bfd40f8c7c9683230",
1154
+ "bytes": 77
1155
+ },
1036
1156
  "v2/projections/advance-outcomes.d.ts": {
1037
1157
  "sha256": "1c1283e2484b81c13428d6b4c80adb1ca079cf9b7c858cee8d178af1e0828e0f",
1038
1158
  "bytes": 903
@@ -1,5 +1,3 @@
1
- declare const brand: unique symbol;
2
1
  export type Brand<T, B extends string> = T & {
3
- readonly [brand]: B;
2
+ readonly __brand: B;
4
3
  };
5
- export {};
@@ -1,6 +1,7 @@
1
- import type { WorkflowHash, Sha256Digest, CanonicalBytes } from '../ids/index.js';
1
+ import type { WorkflowHash, Sha256Digest, CanonicalBytes, SnapshotRef } from '../ids/index.js';
2
2
  import type { JsonValue } from './json-types.js';
3
3
  import type { Result } from 'neverthrow';
4
+ import type { ExecutionSnapshotFileV1 } from '../schemas/execution-snapshot/index.js';
4
5
  export interface CryptoPortV2 {
5
6
  sha256(bytes: CanonicalBytes): Sha256Digest;
6
7
  }
@@ -9,3 +10,4 @@ export type HashingError = {
9
10
  readonly message: string;
10
11
  };
11
12
  export declare function workflowHashForCompiledSnapshot(compiled: JsonValue, crypto: CryptoPortV2): Result<WorkflowHash, HashingError>;
13
+ export declare function snapshotRefForExecutionSnapshotFileV1(snapshot: ExecutionSnapshotFileV1, crypto: CryptoPortV2): Result<SnapshotRef, HashingError>;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.workflowHashForCompiledSnapshot = workflowHashForCompiledSnapshot;
4
+ exports.snapshotRefForExecutionSnapshotFileV1 = snapshotRefForExecutionSnapshotFileV1;
4
5
  const index_js_1 = require("../ids/index.js");
5
6
  const jcs_js_1 = require("./jcs.js");
6
7
  function workflowHashForCompiledSnapshot(compiled, crypto) {
@@ -11,3 +12,11 @@ function workflowHashForCompiledSnapshot(compiled, crypto) {
11
12
  }))
12
13
  .map((bytes) => (0, index_js_1.asWorkflowHash)(crypto.sha256(bytes)));
13
14
  }
15
+ function snapshotRefForExecutionSnapshotFileV1(snapshot, crypto) {
16
+ return (0, jcs_js_1.toCanonicalBytes)(snapshot)
17
+ .mapErr((e) => ({
18
+ code: 'HASHING_CANONICALIZE_FAILED',
19
+ message: e.message,
20
+ }))
21
+ .map((bytes) => (0, index_js_1.asSnapshotRef)(crypto.sha256(bytes)));
22
+ }
@@ -10,6 +10,8 @@ export type EventId = Brand<string, 'v2.EventId'>;
10
10
  export type EventIndex = Brand<number, 'v2.EventIndex'>;
11
11
  export type ManifestIndex = Brand<number, 'v2.ManifestIndex'>;
12
12
  export type SnapshotRef = Brand<Sha256Digest, 'v2.SnapshotRef'>;
13
+ export type AttemptId = Brand<string, 'v2.AttemptId'>;
14
+ export type TokenStringV1 = Brand<string, 'v2.TokenStringV1'>;
13
15
  export declare function asWorkflowId(value: string): WorkflowId;
14
16
  export declare function asSha256Digest(value: string): Sha256Digest;
15
17
  export declare function asWorkflowHash(value: Sha256Digest): WorkflowHash;
@@ -21,3 +23,5 @@ export declare function asEventId(value: string): EventId;
21
23
  export declare function asEventIndex(value: number): EventIndex;
22
24
  export declare function asManifestIndex(value: number): ManifestIndex;
23
25
  export declare function asSnapshotRef(value: Sha256Digest): SnapshotRef;
26
+ export declare function asAttemptId(value: string): AttemptId;
27
+ export declare function asTokenStringV1(value: string): TokenStringV1;
@@ -11,6 +11,8 @@ exports.asEventId = asEventId;
11
11
  exports.asEventIndex = asEventIndex;
12
12
  exports.asManifestIndex = asManifestIndex;
13
13
  exports.asSnapshotRef = asSnapshotRef;
14
+ exports.asAttemptId = asAttemptId;
15
+ exports.asTokenStringV1 = asTokenStringV1;
14
16
  function asWorkflowId(value) {
15
17
  return value;
16
18
  }
@@ -44,3 +46,9 @@ function asManifestIndex(value) {
44
46
  function asSnapshotRef(value) {
45
47
  return value;
46
48
  }
49
+ function asAttemptId(value) {
50
+ return value;
51
+ }
52
+ function asTokenStringV1(value) {
53
+ return value;
54
+ }
@@ -0,0 +1,3 @@
1
+ import type { EngineStateV1, PendingStepV1 } from '../schemas/execution-snapshot/index.js';
2
+ export declare function deriveIsComplete(state: EngineStateV1): boolean;
3
+ export declare function derivePendingStep(state: EngineStateV1): PendingStepV1 | null;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deriveIsComplete = deriveIsComplete;
4
+ exports.derivePendingStep = derivePendingStep;
5
+ function deriveIsComplete(state) {
6
+ return state.kind === 'complete';
7
+ }
8
+ function derivePendingStep(state) {
9
+ if (state.kind !== 'running')
10
+ return null;
11
+ if (state.pending.kind !== 'some')
12
+ return null;
13
+ return state.pending.step;
14
+ }