anbaric-tsapi 1.21.4 → 1.22.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 (149) hide show
  1. package/dist/api/actions/Action.d.ts +14 -0
  2. package/dist/api/actions/Action.d.ts.map +1 -0
  3. package/dist/api/actions/Action.js +16 -0
  4. package/dist/api/actions/Action.js.map +1 -0
  5. package/dist/api/actions/AgenticAction.d.ts +11 -0
  6. package/dist/api/actions/AgenticAction.d.ts.map +1 -0
  7. package/dist/api/actions/AgenticAction.js +14 -0
  8. package/dist/api/actions/AgenticAction.js.map +1 -0
  9. package/dist/api/actions/Await.d.ts +15 -0
  10. package/dist/api/actions/Await.d.ts.map +1 -0
  11. package/{src/api/actions/Await.ts → dist/api/actions/Await.js} +12 -18
  12. package/dist/api/actions/Await.js.map +1 -0
  13. package/dist/api/actions/WaitForInput.d.ts +19 -0
  14. package/dist/api/actions/WaitForInput.d.ts.map +1 -0
  15. package/dist/api/actions/WaitForInput.js +25 -0
  16. package/dist/api/actions/WaitForInput.js.map +1 -0
  17. package/dist/api/actors/Actor.d.ts +8 -0
  18. package/dist/api/actors/Actor.d.ts.map +1 -0
  19. package/dist/api/actors/Actor.js +2 -0
  20. package/dist/api/actors/Actor.js.map +1 -0
  21. package/dist/api/actors/SystemActor.d.ts +9 -0
  22. package/dist/api/actors/SystemActor.d.ts.map +1 -0
  23. package/dist/api/actors/SystemActor.js +8 -0
  24. package/dist/api/actors/SystemActor.js.map +1 -0
  25. package/dist/api/actors/agents/Agent.d.ts +16 -0
  26. package/dist/api/actors/agents/Agent.d.ts.map +1 -0
  27. package/dist/api/actors/agents/Agent.js +21 -0
  28. package/dist/api/actors/agents/Agent.js.map +1 -0
  29. package/dist/api/actors/agents/AgentMessage.d.ts +6 -0
  30. package/dist/api/actors/agents/AgentMessage.d.ts.map +1 -0
  31. package/dist/api/actors/agents/AgentMessage.js +2 -0
  32. package/dist/api/actors/agents/AgentMessage.js.map +1 -0
  33. package/dist/api/actors/agents/AgentRequest.d.ts +7 -0
  34. package/dist/api/actors/agents/AgentRequest.d.ts.map +1 -0
  35. package/dist/api/actors/agents/AgentRequest.js +2 -0
  36. package/dist/api/actors/agents/AgentRequest.js.map +1 -0
  37. package/dist/api/auditing/Auditor.d.ts +6 -0
  38. package/dist/api/auditing/Auditor.d.ts.map +1 -0
  39. package/dist/api/auditing/Auditor.js +2 -0
  40. package/dist/api/auditing/Auditor.js.map +1 -0
  41. package/dist/api/auditing/NoOpAuditor.d.ts +7 -0
  42. package/dist/api/auditing/NoOpAuditor.d.ts.map +1 -0
  43. package/dist/api/auditing/NoOpAuditor.js +9 -0
  44. package/dist/api/auditing/NoOpAuditor.js.map +1 -0
  45. package/dist/api/cloud/AppAware.d.ts +7 -0
  46. package/dist/api/cloud/AppAware.d.ts.map +1 -0
  47. package/dist/api/cloud/AppAware.js +5 -0
  48. package/dist/api/cloud/AppAware.js.map +1 -0
  49. package/dist/api/cloud/AuditRecord.d.ts +14 -0
  50. package/dist/api/cloud/AuditRecord.d.ts.map +1 -0
  51. package/dist/api/cloud/AuditRecord.js +2 -0
  52. package/dist/api/cloud/AuditRecord.js.map +1 -0
  53. package/dist/api/cloud/QueueMessage.d.ts +8 -0
  54. package/dist/api/cloud/QueueMessage.d.ts.map +1 -0
  55. package/dist/api/cloud/QueueMessage.js +2 -0
  56. package/dist/api/cloud/QueueMessage.js.map +1 -0
  57. package/dist/api/cloud/WorkflowDefinition.d.ts +32 -0
  58. package/dist/api/cloud/WorkflowDefinition.d.ts.map +1 -0
  59. package/dist/api/cloud/WorkflowDefinition.js +24 -0
  60. package/dist/api/cloud/WorkflowDefinition.js.map +1 -0
  61. package/dist/api/documents/JsonSchema.d.ts +11 -0
  62. package/dist/api/documents/JsonSchema.d.ts.map +1 -0
  63. package/dist/api/documents/JsonSchema.js +40 -0
  64. package/dist/api/documents/JsonSchema.js.map +1 -0
  65. package/dist/api/documents/JsonStore.d.ts +27 -0
  66. package/dist/api/documents/JsonStore.d.ts.map +1 -0
  67. package/dist/api/documents/JsonStore.js +43 -0
  68. package/dist/api/documents/JsonStore.js.map +1 -0
  69. package/dist/api/jobs/Job.d.ts +24 -0
  70. package/dist/api/jobs/Job.d.ts.map +1 -0
  71. package/{src/api/jobs/Job.ts → dist/api/jobs/Job.js} +19 -32
  72. package/dist/api/jobs/Job.js.map +1 -0
  73. package/dist/api/jobs/JobPersistence.d.ts +43 -0
  74. package/dist/api/jobs/JobPersistence.d.ts.map +1 -0
  75. package/dist/api/jobs/JobPersistence.js +87 -0
  76. package/dist/api/jobs/JobPersistence.js.map +1 -0
  77. package/dist/api/jobs/JobSerialization.d.ts +21 -0
  78. package/dist/api/jobs/JobSerialization.d.ts.map +1 -0
  79. package/dist/api/jobs/JobSerialization.js +22 -0
  80. package/dist/api/jobs/JobSerialization.js.map +1 -0
  81. package/dist/api/jobs/PropertyDefinition.d.ts +8 -0
  82. package/dist/api/jobs/PropertyDefinition.d.ts.map +1 -0
  83. package/dist/api/jobs/PropertyDefinition.js +10 -0
  84. package/dist/api/jobs/PropertyDefinition.js.map +1 -0
  85. package/dist/api/secrets/SecretStore.d.ts +26 -0
  86. package/dist/api/secrets/SecretStore.d.ts.map +1 -0
  87. package/dist/api/secrets/SecretStore.js +42 -0
  88. package/dist/api/secrets/SecretStore.js.map +1 -0
  89. package/dist/api/sessions/SessionResolver.d.ts +10 -0
  90. package/dist/api/sessions/SessionResolver.d.ts.map +1 -0
  91. package/dist/api/sessions/SessionResolver.js +2 -0
  92. package/dist/api/sessions/SessionResolver.js.map +1 -0
  93. package/dist/api/sql/SqlStore.d.ts +19 -0
  94. package/dist/api/sql/SqlStore.d.ts.map +1 -0
  95. package/dist/api/sql/SqlStore.js +29 -0
  96. package/dist/api/sql/SqlStore.js.map +1 -0
  97. package/dist/api/state-machine/Consumer.d.ts +6 -0
  98. package/dist/api/state-machine/Consumer.d.ts.map +1 -0
  99. package/dist/api/state-machine/Consumer.js +2 -0
  100. package/dist/api/state-machine/Consumer.js.map +1 -0
  101. package/dist/api/state-machine/Queue.d.ts +13 -0
  102. package/dist/api/state-machine/Queue.d.ts.map +1 -0
  103. package/dist/api/state-machine/Queue.js +7 -0
  104. package/dist/api/state-machine/Queue.js.map +1 -0
  105. package/dist/api/states/State.d.ts +13 -0
  106. package/dist/api/states/State.d.ts.map +1 -0
  107. package/dist/api/states/State.js +17 -0
  108. package/dist/api/states/State.js.map +1 -0
  109. package/dist/api/states/Terminal.d.ts +13 -0
  110. package/dist/api/states/Terminal.d.ts.map +1 -0
  111. package/dist/api/states/Terminal.js +19 -0
  112. package/dist/api/states/Terminal.js.map +1 -0
  113. package/dist/api/transitions/Transition.d.ts +8 -0
  114. package/dist/api/transitions/Transition.d.ts.map +1 -0
  115. package/dist/api/transitions/Transition.js +10 -0
  116. package/dist/api/transitions/Transition.js.map +1 -0
  117. package/dist/index.d.ts +30 -0
  118. package/dist/index.d.ts.map +1 -0
  119. package/dist/index.js +30 -0
  120. package/dist/index.js.map +1 -0
  121. package/package.json +14 -5
  122. package/src/api/actions/Action.ts +0 -25
  123. package/src/api/actions/AgenticAction.ts +0 -24
  124. package/src/api/actions/WaitForInput.ts +0 -43
  125. package/src/api/actors/Actor.ts +0 -11
  126. package/src/api/actors/SystemActor.ts +0 -13
  127. package/src/api/actors/agents/Agent.ts +0 -32
  128. package/src/api/actors/agents/AgentMessage.ts +0 -8
  129. package/src/api/actors/agents/AgentRequest.ts +0 -10
  130. package/src/api/auditing/Auditor.ts +0 -13
  131. package/src/api/auditing/NoOpAuditor.ts +0 -15
  132. package/src/api/cloud/AppAware.ts +0 -14
  133. package/src/api/cloud/AuditRecord.ts +0 -14
  134. package/src/api/cloud/QueueMessage.ts +0 -8
  135. package/src/api/cloud/WorkflowDefinition.ts +0 -49
  136. package/src/api/documents/JsonSchema.ts +0 -53
  137. package/src/api/documents/JsonStore.ts +0 -56
  138. package/src/api/jobs/JobPersistence.ts +0 -141
  139. package/src/api/jobs/JobSerialization.ts +0 -45
  140. package/src/api/jobs/PropertyDefinition.ts +0 -12
  141. package/src/api/secrets/SecretStore.ts +0 -57
  142. package/src/api/sessions/SessionResolver.ts +0 -20
  143. package/src/api/sql/SqlStore.ts +0 -41
  144. package/src/api/state-machine/Consumer.ts +0 -8
  145. package/src/api/state-machine/Queue.ts +0 -22
  146. package/src/api/states/State.ts +0 -25
  147. package/src/api/states/Terminal.ts +0 -25
  148. package/src/api/transitions/Transition.ts +0 -13
  149. package/src/index.ts +0 -29
@@ -1,141 +0,0 @@
1
- import {Actor} from "../actors/Actor";
2
- import {Auditor} from "../auditing/Auditor";
3
- import {Job} from "./Job";
4
- import {serializeWaitForInput} from "../actions/WaitForInput";
5
- import {currentAppId} from "../cloud/AppAware";
6
-
7
- /* Persists jobs and audits every interaction. Public methods record the
8
- interaction against the injected auditor and then defer to the abstract
9
- ...Internal methods a concrete store implements. */
10
- abstract class JobPersistence {
11
-
12
- constructor(protected auditor : Auditor) {
13
- }
14
-
15
- async create(actor : Actor,
16
- job : Job) : Promise<void> {
17
-
18
- await this.auditor.audit(job.appId, "job", job.id, actor, [JobPersistence.Interaction.CREATE], "Job created", job);
19
-
20
- this.saveInternal(job);
21
- }
22
-
23
- async save(actor : Actor,
24
- changeDescription : string,
25
- job : Job,
26
- properties? : Map<string, any>,
27
- state? : string) : Promise<void> {
28
-
29
- const change : { properties? : any, state? : any, metadata? : Record<string, any> } = {
30
- properties: properties ? this.generatePropertiesDiff(job.properties, properties) : undefined,
31
- state: state ? {from : job.state, to : state} : undefined
32
- }
33
-
34
- const interaction : Array<string> = [];
35
- if (properties) interaction.push(JobPersistence.Interaction.UPDATE_PROPERTIES);
36
- if (state) interaction.push(JobPersistence.Interaction.CHANGE_STATE);
37
- if (job.status === Job.Status.AWAITING_INPUT && job.awaitMetadata) {
38
- interaction.push(JobPersistence.Interaction.AWAIT);
39
- change.metadata = serializeWaitForInput(job.awaitMetadata);
40
- }
41
-
42
- await this.auditor.audit(job.appId, "job", job.id, actor, interaction, changeDescription, change);
43
-
44
- const updatedJob = new Job(
45
- job.id,
46
- properties ? this.updateProperties(job.properties, properties) : job.properties,
47
- state ? state : job.state,
48
- job.workflowId,
49
- job.appId,
50
- job.startedBy,
51
- job.startedAt,
52
- new Date(),
53
- job.killed,
54
- job.status,
55
- job.awaitMetadata,
56
- job.waitingFor
57
- )
58
-
59
- this.saveInternal(updatedJob);
60
- }
61
-
62
- async kill(id : string, actor : Actor) : Promise<void> {
63
- await this.auditor.audit(currentAppId(), "job", id, actor, [JobPersistence.Interaction.KILL], "Job killed", null);
64
- await this.killInternal(id);
65
- }
66
-
67
- async killOlderThan(lastUpdatedBefore : Date, actor : Actor) : Promise<number> {
68
- await this.auditor.audit(currentAppId(), "job", "*", actor, [JobPersistence.Interaction.KILL],
69
- `Jobs not updated since ${lastUpdatedBefore.toISOString()} killed`, null);
70
- return this.killOlderThanInternal(lastUpdatedBefore);
71
- }
72
-
73
- async countByState(actor : Actor) : Promise<Array<JobPersistence.StateCount>> {
74
- await this.auditor.audit(currentAppId(), "job", "*", actor, [JobPersistence.Interaction.LIST], "", null);
75
- return this.countByStateInternal();
76
- }
77
-
78
- private generatePropertiesDiff(oldVersion : Map<string, any>, newVersion : Map<string, any>) : Map<string, {from: any, to: any}> {
79
- const diff: Map<string, { from: any; to: any; }> = new Map();
80
-
81
- for (const [key, value] of newVersion) {
82
- diff.set(key, {from: oldVersion.get(key), to: value});
83
- }
84
- return diff;
85
- }
86
-
87
- private updateProperties(oldVersion : Map<string, any>, newVersion : Map<string, any>) : Map<string, any> {
88
- const updated = new Map(oldVersion);
89
- for (const [key, value] of newVersion) {
90
- updated.set(key, value);
91
- }
92
- return updated;
93
- }
94
-
95
- async retrieve(id : string, actor : Actor) : Promise<Job> {
96
- await this.auditor.audit(currentAppId(), "job", id, actor, [JobPersistence.Interaction.READ], "", null);
97
- return this.retrieveInternal(id);
98
- }
99
-
100
- async delete(id : string, actor : Actor) : Promise<void> {
101
- await this.auditor.audit(currentAppId(), "job", id, actor, [JobPersistence.Interaction.DELETE], "", null);
102
- await this.deleteInternal(id);
103
- }
104
-
105
- async list(actor : Actor, pageSize? : number, page? : number) : Promise<Array<Job>> {
106
- await this.auditor.audit(currentAppId(), "job", "*", actor, [JobPersistence.Interaction.LIST], "", null);
107
- return this.listInternal(pageSize, page);
108
- }
109
-
110
- protected abstract saveInternal(job : Job) : Promise<void>;
111
- protected abstract retrieveInternal(id : string) : Promise<Job>;
112
- protected abstract deleteInternal(id : string) : Promise<void>;
113
- protected abstract listInternal(pageSize? : number, page? : number) : Promise<Array<Job>>;
114
- protected abstract killInternal(id : string) : Promise<void>;
115
- protected abstract killOlderThanInternal(lastUpdatedBefore : Date) : Promise<number>;
116
- protected abstract countByStateInternal() : Promise<Array<JobPersistence.StateCount>>;
117
-
118
- }
119
-
120
- namespace JobPersistence {
121
-
122
- export enum Interaction {
123
- CREATE = "CREATE",
124
- UPDATE_PROPERTIES = "UPDATE_PROPERTIES",
125
- CHANGE_STATE = "CHANGE_STATE",
126
- AWAIT = "AWAIT",
127
- DELETE = "DELETE",
128
- READ = "READ",
129
- LIST = "LIST",
130
- KILL = "KILL",
131
- }
132
-
133
- export type StateCount = {
134
- state : string,
135
- killed : boolean,
136
- count : number,
137
- };
138
-
139
- }
140
-
141
- export { JobPersistence }
@@ -1,45 +0,0 @@
1
- import {Job} from "./Job";
2
- import {SerializedWaitForInput, serializeWaitForInput, deserializeWaitForInput} from "../actions/WaitForInput";
3
-
4
- type SerializedJob = {
5
- id : string,
6
- state : string,
7
- properties : Record<string, any>,
8
- workflowId? : string,
9
- appId? : string,
10
- startedAt? : string,
11
- startedBy? : string,
12
- lastUpdated? : string,
13
- killed? : boolean,
14
- status? : string,
15
- waitingFor? : string,
16
- awaitMetadata? : SerializedWaitForInput,
17
- };
18
-
19
- const serializeJob = (job : Job) : SerializedJob => ({
20
- id: job.id,
21
- state: job.state,
22
- properties: Object.fromEntries(job.properties),
23
- workflowId: job.workflowId,
24
- appId: job.appId,
25
- startedAt: job.startedAt.toISOString(),
26
- startedBy: job.startedBy,
27
- lastUpdated: job.lastUpdated.toISOString(),
28
- killed: job.killed,
29
- status: job.status,
30
- waitingFor: job.waitingFor,
31
- awaitMetadata: job.awaitMetadata ? serializeWaitForInput(job.awaitMetadata) : undefined,
32
- });
33
-
34
- const deserializeJob = (serialized : SerializedJob) : Job => {
35
- const startedAt = serialized.startedAt ? new Date(serialized.startedAt) : new Date();
36
- return new Job(serialized.id, new Map(Object.entries(serialized.properties)), serialized.state,
37
- serialized.workflowId, serialized.appId, serialized.startedBy ?? "system", startedAt,
38
- serialized.lastUpdated ? new Date(serialized.lastUpdated) : startedAt, serialized.killed ?? false,
39
- serialized.status ?? Job.Status.ACTIVE,
40
- serialized.awaitMetadata ? deserializeWaitForInput(serialized.awaitMetadata) : undefined,
41
- serialized.waitingFor);
42
- };
43
-
44
- export { serializeJob, deserializeJob };
45
- export type { SerializedJob };
@@ -1,12 +0,0 @@
1
- class PropertyDefinition {
2
-
3
- id : string;
4
- required : boolean = false;
5
- validation : (arg0: any) => boolean = (value : any) => true;
6
-
7
- constructor(id : string) {
8
- this.id = id;
9
- }
10
- }
11
-
12
- export { PropertyDefinition }
@@ -1,57 +0,0 @@
1
- import {Actor} from "../actors/Actor";
2
- import {Auditor} from "../auditing/Auditor";
3
- import {currentAppId} from "../cloud/AppAware";
4
-
5
- /* Stores named secrets and audits every interaction. The secret value is
6
- never included in an audit record. Public methods audit then defer to the
7
- abstract ...Internal methods. */
8
- abstract class SecretStore {
9
-
10
- constructor(protected auditor : Auditor) {
11
- }
12
-
13
- async create(actor : Actor, name : string, value : string) : Promise<void> {
14
- await this.auditor.audit(currentAppId(), "secret", name, actor, [SecretStore.Interaction.CREATE], "Secret created", null);
15
- await this.saveInternal(name, value);
16
- }
17
-
18
- async save(actor : Actor, changeDescription : string, name : string, value : string) : Promise<void> {
19
- await this.auditor.audit(currentAppId(), "secret", name, actor, [SecretStore.Interaction.SAVE], changeDescription, null);
20
- await this.saveInternal(name, value);
21
- }
22
-
23
- async retrieve(name : string, actor : Actor) : Promise<string> {
24
- await this.auditor.audit(currentAppId(), "secret", name, actor, [SecretStore.Interaction.READ], "", null);
25
- return this.retrieveInternal(name);
26
- }
27
-
28
- async delete(name : string, actor : Actor) : Promise<void> {
29
- await this.auditor.audit(currentAppId(), "secret", name, actor, [SecretStore.Interaction.DELETE], "", null);
30
- await this.deleteInternal(name);
31
- }
32
-
33
- async list(actor : Actor) : Promise<Array<string>> {
34
- await this.auditor.audit(currentAppId(), "secret", "*", actor, [SecretStore.Interaction.LIST], "", null);
35
- return this.listInternal();
36
- }
37
-
38
- protected abstract saveInternal(name : string, value : string) : Promise<void>;
39
- protected abstract retrieveInternal(name : string) : Promise<string>;
40
- protected abstract deleteInternal(name : string) : Promise<void>;
41
- protected abstract listInternal() : Promise<Array<string>>;
42
-
43
- }
44
-
45
- namespace SecretStore {
46
-
47
- export enum Interaction {
48
- CREATE = "CREATE",
49
- SAVE = "SAVE",
50
- READ = "READ",
51
- DELETE = "DELETE",
52
- LIST = "LIST",
53
- }
54
-
55
- }
56
-
57
- export { SecretStore }
@@ -1,20 +0,0 @@
1
- /* The identity behind a platform session token, as resolved by the platform. */
2
- type ResolvedSession = {
3
-
4
- id : string,
5
- roles : Array<string>,
6
- tenant? : string,
7
-
8
- };
9
-
10
- /* Resolves a platform session token (the anbaric_session cookie) into the
11
- user's identity. A deployed app cannot verify the token itself - it is signed
12
- with a platform-only secret - so the resolution is a call to the platform.
13
- Returns undefined when the token is missing, invalid or expired. */
14
- interface SessionResolver {
15
-
16
- resolve(sessionToken : string) : Promise<ResolvedSession | undefined>;
17
-
18
- }
19
-
20
- export type { SessionResolver, ResolvedSession }
@@ -1,41 +0,0 @@
1
- import {Actor} from "../actors/Actor";
2
- import {Auditor} from "../auditing/Auditor";
3
- import {currentAppId} from "../cloud/AppAware";
4
-
5
- /* A relational (SQL) store for application data. Public methods audit the
6
- interaction then defer to the abstract ...Internal. `query` returns rows;
7
- `execute` runs a statement and returns the number of affected rows. The
8
- backing engine (SQLite locally, PostgreSQL in the cloud) is chosen by the
9
- factory; SQL placeholder syntax differs between them (see the docs). */
10
- abstract class SqlStore {
11
-
12
- constructor(protected auditor : Auditor) {
13
- }
14
-
15
- async query(actor : Actor, sql : string, parameters : Array<any> = []) : Promise<Array<Record<string, any>>> {
16
- await this.auditor.audit(currentAppId(), "sql", "*", actor, [SqlStore.Interaction.QUERY], sql, null);
17
- return this.queryInternal(sql, parameters);
18
- }
19
-
20
- async execute(actor : Actor, sql : string, parameters : Array<any> = []) : Promise<number> {
21
- await this.auditor.audit(currentAppId(), "sql", "*", actor, [SqlStore.Interaction.EXECUTE], sql, null);
22
- return this.executeInternal(sql, parameters);
23
- }
24
-
25
- abstract close() : Promise<void>;
26
-
27
- protected abstract queryInternal(sql : string, parameters : Array<any>) : Promise<Array<Record<string, any>>>;
28
- protected abstract executeInternal(sql : string, parameters : Array<any>) : Promise<number>;
29
-
30
- }
31
-
32
- namespace SqlStore {
33
-
34
- export enum Interaction {
35
- QUERY = "QUERY",
36
- EXECUTE = "EXECUTE",
37
- }
38
-
39
- }
40
-
41
- export { SqlStore }
@@ -1,8 +0,0 @@
1
- interface Consumer {
2
-
3
- subscribe(appId : string | undefined, workflowId : string, processJob : (jobId : string) => Promise<void>) : void;
4
- cleanUp() : Promise<void>;
5
-
6
- }
7
-
8
- export { Consumer }
@@ -1,22 +0,0 @@
1
- import {QueueMessage} from "../cloud/QueueMessage";
2
-
3
- interface Queue {
4
-
5
- enqueue(jobId : string, appId : string | undefined, workflowId : string) : Promise<void>;
6
- schedule(jobId : string, appId : string | undefined, workflowId : string, due : Date) : Promise<void>;
7
-
8
- }
9
-
10
- interface Dequeue extends Queue {
11
-
12
- dequeueSome() : Promise<Array<QueueMessage>>;
13
-
14
- }
15
-
16
- const Dequeue = {
17
- supports(queue : Queue) : queue is Dequeue {
18
- return "dequeueSome" in queue;
19
- },
20
- };
21
-
22
- export { Queue, Dequeue }
@@ -1,25 +0,0 @@
1
- import {Action} from "../actions/Action";
2
- import {Await} from "../actions/Await";
3
- import {Transition} from "../transitions/Transition";
4
-
5
- class State {
6
-
7
- readonly id : string;
8
- actions : Array<Action | Await>;
9
- transitions : Array<Transition>;
10
- readonly isTerminal : boolean;
11
-
12
- constructor(id : string, actions : Array<Action | Await> = [], transitions : Array<Transition> = [], isTerminal : boolean = false) {
13
- this.id = id;
14
- this.actions = actions;
15
- this.transitions = transitions;
16
- this.isTerminal = isTerminal;
17
- }
18
-
19
- subscribe(action : Action | Await) : void {
20
- this.actions.push(action);
21
- }
22
-
23
- }
24
-
25
- export { State }
@@ -1,25 +0,0 @@
1
- import {State} from "./State";
2
-
3
- /* An end state: a job that reaches a Terminal stops progressing and is never
4
- re-enqueued. The outcome records whether the workflow succeeded or failed. */
5
- class Terminal extends State {
6
-
7
- readonly outcome : Terminal.Outcome;
8
-
9
- constructor(id : string, outcome : Terminal.Outcome) {
10
- super(id, [], [], true);
11
- this.outcome = outcome;
12
- }
13
-
14
- }
15
-
16
- namespace Terminal {
17
-
18
- export enum Outcome {
19
- SUCCESS = "SUCCESS",
20
- FAILURE = "FAILURE",
21
- }
22
-
23
- }
24
-
25
- export { Terminal }
@@ -1,13 +0,0 @@
1
- import {Job} from "../jobs/Job";
2
-
3
- class Transition {
4
- to: string;
5
- predicate: (job: Job) => boolean;
6
-
7
- constructor(to: string, predicate: (job: Job) => boolean) {
8
- this.to = to;
9
- this.predicate = predicate;
10
- }
11
- }
12
-
13
- export { Transition }
package/src/index.ts DELETED
@@ -1,29 +0,0 @@
1
- export * from "./api/jobs/Job";
2
- export * from "./api/jobs/JobPersistence"
3
- export * from "./api/jobs/JobSerialization"
4
- export * from "./api/jobs/PropertyDefinition"
5
- export * from "./api/states/State"
6
- export * from "./api/states/Terminal"
7
- export * from "./api/actions/Action"
8
- export * from "./api/actions/Await"
9
- export * from "./api/actions/WaitForInput"
10
- export * from "./api/actions/AgenticAction"
11
- export * from "./api/actors/agents/AgentMessage"
12
- export * from "./api/actors/agents/AgentRequest"
13
- export * from "./api/actors/agents/Agent"
14
- export * from "./api/auditing/Auditor"
15
- export * from "./api/auditing/NoOpAuditor"
16
- export * from "./api/transitions/Transition"
17
- export * from "./api/actors/Actor"
18
- export * from "./api/actors/SystemActor"
19
- export * from "./api/sessions/SessionResolver"
20
- export * from "./api/documents/JsonStore"
21
- export * from "./api/secrets/SecretStore"
22
- export * from "./api/sql/SqlStore"
23
- export * from "./api/documents/JsonSchema"
24
- export * from "./api/state-machine/Queue"
25
- export * from "./api/state-machine/Consumer"
26
- export * from "./api/cloud/QueueMessage"
27
- export * from "./api/cloud/WorkflowDefinition"
28
- export * from "./api/cloud/AuditRecord"
29
- export * from "./api/cloud/AppAware"