@memberjunction/task-graph 6.2.2 → 6.3.0-edge.1

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/TaskGraphDispatcher.d.ts +289 -2
  2. package/dist/TaskGraphDispatcher.d.ts.map +1 -1
  3. package/dist/TaskGraphDispatcher.js +1275 -330
  4. package/dist/TaskGraphDispatcher.js.map +1 -1
  5. package/dist/TaskGraphService.d.ts +68 -1
  6. package/dist/TaskGraphService.d.ts.map +1 -1
  7. package/dist/TaskGraphService.js +226 -24
  8. package/dist/TaskGraphService.js.map +1 -1
  9. package/dist/TaskGraphSubmitterImpl.d.ts +1 -0
  10. package/dist/TaskGraphSubmitterImpl.d.ts.map +1 -1
  11. package/dist/TaskGraphSubmitterImpl.js +5 -0
  12. package/dist/TaskGraphSubmitterImpl.js.map +1 -1
  13. package/dist/decision-node.d.ts +21 -0
  14. package/dist/decision-node.d.ts.map +1 -1
  15. package/dist/decision-node.js.map +1 -1
  16. package/dist/index.d.ts +2 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +2 -0
  19. package/dist/index.js.map +1 -1
  20. package/dist/operations/TaskGraphDebugOperations.d.ts +23 -0
  21. package/dist/operations/TaskGraphDebugOperations.d.ts.map +1 -1
  22. package/dist/operations/TaskGraphDebugOperations.js +13 -13
  23. package/dist/operations/TaskGraphDebugOperations.js.map +1 -1
  24. package/dist/operations/TaskGraphOperations.d.ts.map +1 -1
  25. package/dist/operations/TaskGraphOperations.js +12 -7
  26. package/dist/operations/TaskGraphOperations.js.map +1 -1
  27. package/dist/saga-compensation.d.ts +167 -0
  28. package/dist/saga-compensation.d.ts.map +1 -0
  29. package/dist/saga-compensation.js +392 -0
  30. package/dist/saga-compensation.js.map +1 -0
  31. package/dist/task-security.d.ts +96 -0
  32. package/dist/task-security.d.ts.map +1 -0
  33. package/dist/task-security.js +187 -0
  34. package/dist/task-security.js.map +1 -0
  35. package/dist/tsconfig.tsbuildinfo +1 -0
  36. package/dist/types.d.ts +57 -1
  37. package/dist/types.d.ts.map +1 -1
  38. package/dist/types.js +1 -0
  39. package/dist/types.js.map +1 -1
  40. package/package.json +12 -12
@@ -0,0 +1 @@
1
+ {"version":3,"file":"saga-compensation.js","sourceRoot":"","sources":["../src/saga-compensation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACH,gBAAgB,GAGnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA0DhD;;;;GAIG;AACH,MAAM,UAAU,8BAA8B,CAAC,MAAiD;IAC5F,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAC5E,IAAI,CAAC,MAAM,IAAI,CAAC,oBAAoB;QAAE,OAAO,IAAI,CAAC;IAClD,MAAM,YAAY,GAAG,sBAAsB,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC;IAC7E,OAAO;QACH,oBAAoB;QACpB,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACzC,GAAG,CAAC,OAAO,MAAM,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC7F,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,4BAA4B,CACxC,aAA8D,EAC9D,YAA6D;IAE7D,MAAM,oBAAoB,GAAG,gBAAgB,CAAC,YAAY,EAAE,oBAAoB,CAAC,IAAI,gBAAgB,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAAC;IAC3I,MAA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velope`, `@memberjunction/ai-core-plus`) is the submitting
5
+ * run's constraints. This module answers the three questions the dispatcher asks of it for one node:
6
+ * which constraints apply (the parent's and the node's stored envelopes, merged), whether the node's
7
+ * input is tainted, and which user the node runs as.
8
+ *
9
+ * @module @memberjunction/task-graph
10
+ */
11
+ import { type TaskSecurityEnvelope } from '@memberjunction/ai-core-plus';
12
+ import { type IMetadataProvider, type TenantContext, UserInfo } from '@memberjunction/core';
13
+ import type { MJTaskEntity } from '@memberjunction/core-entities';
14
+ /** A node's stored constraints, or why they cannot be enforced (the node is then refused). */
15
+ export type NodeSecurity = {
16
+ readonly Envelope: TaskSecurityEnvelope | undefined;
17
+ } | {
18
+ readonly Refusal: string;
19
+ };
20
+ /** The task columns {@link UpstreamCarriesTaint} reads. */
21
+ export type UpstreamTaskTaintFields = Pick<MJTaskEntity, 'ID' | 'StepType' | 'UserID' | 'Status' | 'Configuration'>;
22
+ /**
23
+ * The rows a task depends on, by that task's ID: how the taint check looks past a node that recorded
24
+ * no taint to what could have reached it. Returns `undefined` when they are not known.
25
+ */
26
+ export type UpstreamTaintLookup = (taskID: string) => readonly UpstreamTaskTaintFields[] | undefined;
27
+ /**
28
+ * The constraints a node runs under: its graph parent's stored envelope merged with its own, keeping
29
+ * the stricter of each part. An envelope that does not parse, is of an unknown version, or conflicts
30
+ * with the other refuses the node — it never runs as though it had no envelope.
31
+ */
32
+ export declare function ResolveStoredNodeSecurity(parentColumn: string | null | undefined, nodeColumn: string | null | undefined): NodeSecurity;
33
+ /**
34
+ * Whether a finished node's output carries taint into the nodes that depend on it.
35
+ *
36
+ * A `Human` step that its assignee completed in person never does: a person reviewed what flowed
37
+ * through it, which is the only thing that clears taint inside a graph ({@link HumanReviewClearsTaint}).
38
+ * Any other node carries what it recorded when it ran (`Configuration.runtime.isOutputTainted`, which
39
+ * every node the dispatcher runs writes as its input taint OR its own). In a graph whose steps record their
40
+ * taint (`recordsTaint`, every graph submitted since), a node `Complete` with nothing recorded and no person
41
+ * recorded as completing it is tainted: it was completed outside the dispatcher
42
+ * (forced, or saved or answered by code), so its output is nobody's vouched-for result, and what ran
43
+ * before it may not have run yet. Any other node that recorded nothing (a Human step a person other than
44
+ * its assignee completed, skipped, failed before recording) is never read as clean: it is tainted when the graph is, or when anything it depends on
45
+ * could be (followed through `upstreamOf`, transitively), and tainted outright when what it depends on
46
+ * is not known. So a Decision, a skipped branch or a failed step between an untrusted fetch and an
47
+ * egress action cannot launder the fetch's taint.
48
+ */
49
+ export declare function UpstreamCarriesTaint(upstream: UpstreamTaskTaintFields, graphTainted: boolean, upstreamOf?: UpstreamTaintLookup, recordsTaint?: boolean): boolean;
50
+ /**
51
+ * Whether a node is a Human step whose review clears taint: `StepType` is `Human` (a row with a null
52
+ * `StepType` and a `UserID` is not enough), it is `Complete`, and the server recorded a person's
53
+ * completion (`Configuration.runtime.completedByUserID`) as made by its assignee.
54
+ *
55
+ * The record is what tells a person's review apart from code: it is written only for a completion
56
+ * that came from a person, never for one made by server code such as an agent or action run (which
57
+ * runs as the same user as the graph's submitter, the step's assignee). `MJTaskEntityServer` writes
58
+ * it for a save that arrives as a direct client CRUD request (the Tasks UI) and records nothing for
59
+ * any other, and the dispatcher writes it from an answered request's server-recorded responder. Any
60
+ * other write of it is refused. A completion by someone other than the assignee does not count.
61
+ */
62
+ export declare function HumanReviewClearsTaint(node: Pick<UpstreamTaskTaintFields, 'StepType' | 'UserID' | 'Status' | 'Configuration'>): boolean;
63
+ /** The output taint a node recorded when it ran, or `undefined` when it recorded none. */
64
+ export declare function RecordedOutputTaint(configuration: string | null | undefined): boolean | undefined;
65
+ /**
66
+ * Whether a node's input is tainted. A node with no prerequisites reads only what the (possibly
67
+ * tainted) run wrote into the graph, so it takes the envelope's taint. A node with prerequisites is
68
+ * tainted when any of them carries taint ({@link UpstreamCarriesTaint}, which follows `UpstreamOf`
69
+ * past a prerequisite that recorded none); a compensation task also keeps the taint it inherited
70
+ * from the forward task it undoes.
71
+ */
72
+ export declare function ComputeNodeInputTaint(args: {
73
+ EnvelopeTainted: boolean;
74
+ IsCompensation: boolean;
75
+ Upstream: readonly UpstreamTaskTaintFields[];
76
+ /** The graph's prerequisites by task, for prerequisites that recorded no taint. Omitted: they read as tainted. */
77
+ UpstreamOf?: UpstreamTaintLookup;
78
+ /** The graph's steps record their taint (`TaskGraphParentMetadata.recordsTaint`). Omitted: true. */
79
+ RecordsTaint?: boolean;
80
+ }): boolean;
81
+ /**
82
+ * The envelope a node's runners receive: its stored constraints with the taint bit set to the node's
83
+ * input taint. `undefined` when the node has neither constraints nor taint.
84
+ */
85
+ export declare function WithInputTaint(envelope: TaskSecurityEnvelope | undefined, inputTainted: boolean): TaskSecurityEnvelope | undefined;
86
+ /** Whether an envelope constrains anything a runner must enforce. */
87
+ export declare function EnvelopeConstrains(envelope: TaskSecurityEnvelope | undefined): boolean;
88
+ /**
89
+ * A per-task copy of `user` carrying the caller's tenant context. The user a node runs as is the
90
+ * process-wide `UserCache` instance or the dispatcher's own user, and every other task — and every
91
+ * request — shares it; stamping the context onto it would pin it to this tenant for the life of the
92
+ * process. So the input is never stamped: this follows MJServer's `CloneUserForSessionContext`
93
+ * (spread the backing fields, hand the roles over explicitly, then stamp the clone).
94
+ */
95
+ export declare function CloneUserWithTenantContext(user: UserInfo, tenant: TenantContext, provider: IMetadataProvider): UserInfo;
96
+ //# sourceMappingURL=task-security.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-security.d.ts","sourceRoot":"","sources":["../src/task-security.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAIH,KAAK,oBAAoB,EAC5B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGlE,8FAA8F;AAC9F,MAAM,MAAM,YAAY,GAClB;IAAE,QAAQ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,CAAC;CAC1B,GAAG,OAAO,CAOV;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,oBAAoB,GAAG,SAAS,EAAE,YAAY,EAAE,OAAO,GAAG,oBAAoB,GAAG,SAAS,CAGlI;AAED,qEAAqE;AACrE,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,oBAAoB,GAAG,SAAS,GAAG,OAAO,CAOtF;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,iBAAiB,GAAG,QAAQ,CAWvH"}
@@ -0,0 +1,187 @@
1
+ /**
2
+ * @fileoverview How the dispatcher reads and applies a node's security envelope.
3
+ *
4
+ * The envelope itself (`TaskSecurityEnvelope`, `@memberjunction/ai-core-plus`) is the submitting
5
+ * run's constraints. This module answers the three questions the dispatcher asks of it for one node:
6
+ * which constraints apply (the parent's and the node's stored envelopes, merged), whether the node's
7
+ * input is tainted, and which user the node runs as.
8
+ *
9
+ * @module @memberjunction/task-graph
10
+ */
11
+ import { MergeTaskSecurityEnvelopes, ParseTaskSecurityEnvelope, TASK_SECURITY_ENVELOPE_VERSION, } from '@memberjunction/ai-core-plus';
12
+ import { UserInfo } from '@memberjunction/core';
13
+ import { UUIDMap, UUIDSet, UUIDsEqual } from '@memberjunction/global';
14
+ /**
15
+ * The constraints a node runs under: its graph parent's stored envelope merged with its own, keeping
16
+ * the stricter of each part. An envelope that does not parse, is of an unknown version, or conflicts
17
+ * with the other refuses the node — it never runs as though it had no envelope.
18
+ */
19
+ export function ResolveStoredNodeSecurity(parentColumn, nodeColumn) {
20
+ const parent = ParseTaskSecurityEnvelope(parentColumn);
21
+ if (parent.Status === 'Invalid')
22
+ return { Refusal: `On the workflow: ${parent.Reason}` };
23
+ const node = ParseTaskSecurityEnvelope(nodeColumn);
24
+ if (node.Status === 'Invalid')
25
+ return { Refusal: node.Reason };
26
+ const merged = MergeTaskSecurityEnvelopes(parent.Status === 'Valid' ? parent.Envelope : undefined, node.Status === 'Valid' ? node.Envelope : undefined);
27
+ if ('Reason' in merged) {
28
+ return { Refusal: `The task's security envelope cannot be enforced: ${merged.Reason}.` };
29
+ }
30
+ return { Envelope: merged.Envelope };
31
+ }
32
+ /**
33
+ * Whether a finished node's output carries taint into the nodes that depend on it.
34
+ *
35
+ * A `Human` step that its assignee completed in person never does: a person reviewed what flowed
36
+ * through it, which is the only thing that clears taint inside a graph ({@link HumanReviewClearsTaint}).
37
+ * Any other node carries what it recorded when it ran (`Configuration.runtime.isOutputTainted`, which
38
+ * every node the dispatcher runs writes as its input taint OR its own). In a graph whose steps record their
39
+ * taint (`recordsTaint`, every graph submitted since), a node `Complete` with nothing recorded and no person
40
+ * recorded as completing it is tainted: it was completed outside the dispatcher
41
+ * (forced, or saved or answered by code), so its output is nobody's vouched-for result, and what ran
42
+ * before it may not have run yet. Any other node that recorded nothing (a Human step a person other than
43
+ * its assignee completed, skipped, failed before recording) is never read as clean: it is tainted when the graph is, or when anything it depends on
44
+ * could be (followed through `upstreamOf`, transitively), and tainted outright when what it depends on
45
+ * is not known. So a Decision, a skipped branch or a failed step between an untrusted fetch and an
46
+ * egress action cannot launder the fetch's taint.
47
+ */
48
+ export function UpstreamCarriesTaint(upstream, graphTainted, upstreamOf, recordsTaint = true) {
49
+ return carriesTaint(upstream, newTaintWalk(graphTainted, upstreamOf, recordsTaint));
50
+ }
51
+ function newTaintWalk(graphTainted, upstreamOf, recordsTaint) {
52
+ return { GraphTainted: graphTainted, UpstreamOf: upstreamOf, RecordsTaint: recordsTaint, Known: new UUIDMap(), Visiting: new UUIDSet() };
53
+ }
54
+ /**
55
+ * Whether a node is a Human step whose review clears taint: `StepType` is `Human` (a row with a null
56
+ * `StepType` and a `UserID` is not enough), it is `Complete`, and the server recorded a person's
57
+ * completion (`Configuration.runtime.completedByUserID`) as made by its assignee.
58
+ *
59
+ * The record is what tells a person's review apart from code: it is written only for a completion
60
+ * that came from a person, never for one made by server code such as an agent or action run (which
61
+ * runs as the same user as the graph's submitter, the step's assignee). `MJTaskEntityServer` writes
62
+ * it for a save that arrives as a direct client CRUD request (the Tasks UI) and records nothing for
63
+ * any other, and the dispatcher writes it from an answered request's server-recorded responder. Any
64
+ * other write of it is refused. A completion by someone other than the assignee does not count.
65
+ */
66
+ export function HumanReviewClearsTaint(node) {
67
+ if (node.StepType !== 'Human' || node.Status !== 'Complete' || !node.UserID) {
68
+ return false;
69
+ }
70
+ const completedBy = runtimeOf(node.Configuration)?.completedByUserID;
71
+ return typeof completedBy === 'string' && UUIDsEqual(completedBy, node.UserID);
72
+ }
73
+ /**
74
+ * Whether the server recorded a person as completing this Human step. `completedByUserID` is written only for
75
+ * a person: the user whose own client request completed the step, or the responder of the request a person
76
+ * answered (`MJTaskEntityServer`, `MJAIAgentRequestEntityServer`).
77
+ */
78
+ function completedByAPerson(node) {
79
+ return node.StepType === 'Human' && typeof runtimeOf(node.Configuration)?.completedByUserID === 'string';
80
+ }
81
+ function carriesTaint(node, walk) {
82
+ if (HumanReviewClearsTaint(node)) {
83
+ return false;
84
+ }
85
+ const recorded = RecordedOutputTaint(node.Configuration);
86
+ if (recorded !== undefined) {
87
+ return recorded;
88
+ }
89
+ if (walk.RecordsTaint && node.Status === 'Complete' && !completedByAPerson(node)) {
90
+ // Complete with nothing recorded and no person recorded as completing it: it did not finish through the
91
+ // dispatcher, which records every run's taint. Its output (forced from the debugger, saved by code, or an
92
+ // answer server code gave) is untrusted whatever ran before it, which may not have run yet. A Human step
93
+ // a person other than its assignee completed (a delegated approval) cleared nothing, but its answer is
94
+ // that person's own, so it passes on what fed it, below.
95
+ return true;
96
+ }
97
+ if (walk.GraphTainted) {
98
+ return true;
99
+ }
100
+ const known = walk.Known.Get(node.ID);
101
+ if (known !== undefined) {
102
+ return known;
103
+ }
104
+ const inputs = walk.UpstreamOf?.(node.ID);
105
+ if (inputs === undefined || walk.Visiting.Has(node.ID)) {
106
+ return true;
107
+ }
108
+ walk.Visiting.Add(node.ID);
109
+ const tainted = inputs.some((input) => carriesTaint(input, walk));
110
+ walk.Visiting.Delete(node.ID);
111
+ walk.Known.Set(node.ID, tainted);
112
+ return tainted;
113
+ }
114
+ /** The output taint a node recorded when it ran, or `undefined` when it recorded none. */
115
+ export function RecordedOutputTaint(configuration) {
116
+ const flag = runtimeOf(configuration)?.isOutputTainted;
117
+ return typeof flag === 'boolean' ? flag : undefined;
118
+ }
119
+ /** The `runtime` object of a serialized `Task.Configuration`, or `undefined` when it has none or does not parse. */
120
+ function runtimeOf(configuration) {
121
+ if (!configuration)
122
+ return undefined;
123
+ try {
124
+ const parsed = JSON.parse(configuration);
125
+ return isRecord(parsed) && isRecord(parsed.runtime) ? parsed.runtime : undefined;
126
+ }
127
+ catch {
128
+ return undefined;
129
+ }
130
+ }
131
+ /**
132
+ * Whether a node's input is tainted. A node with no prerequisites reads only what the (possibly
133
+ * tainted) run wrote into the graph, so it takes the envelope's taint. A node with prerequisites is
134
+ * tainted when any of them carries taint ({@link UpstreamCarriesTaint}, which follows `UpstreamOf`
135
+ * past a prerequisite that recorded none); a compensation task also keeps the taint it inherited
136
+ * from the forward task it undoes.
137
+ */
138
+ export function ComputeNodeInputTaint(args) {
139
+ if (args.Upstream.length === 0) {
140
+ return args.EnvelopeTainted;
141
+ }
142
+ const walk = newTaintWalk(args.EnvelopeTainted, args.UpstreamOf, args.RecordsTaint !== false);
143
+ const fromUpstream = args.Upstream.some((u) => carriesTaint(u, walk));
144
+ return fromUpstream || (args.IsCompensation && args.EnvelopeTainted);
145
+ }
146
+ /**
147
+ * The envelope a node's runners receive: its stored constraints with the taint bit set to the node's
148
+ * input taint. `undefined` when the node has neither constraints nor taint.
149
+ */
150
+ export function WithInputTaint(envelope, inputTainted) {
151
+ if (!envelope && !inputTainted)
152
+ return undefined;
153
+ return { ...(envelope ?? { Version: TASK_SECURITY_ENVELOPE_VERSION }), IsRunTainted: inputTainted };
154
+ }
155
+ /** Whether an envelope constrains anything a runner must enforce. */
156
+ export function EnvelopeConstrains(envelope) {
157
+ if (!envelope)
158
+ return false;
159
+ return envelope.IsRunTainted
160
+ || envelope.Audience !== undefined
161
+ || envelope.RunScope !== undefined
162
+ || envelope.CallerTenantContext !== undefined
163
+ || (envelope.BoundActionParams !== undefined && Object.keys(envelope.BoundActionParams).length > 0);
164
+ }
165
+ /**
166
+ * A per-task copy of `user` carrying the caller's tenant context. The user a node runs as is the
167
+ * process-wide `UserCache` instance or the dispatcher's own user, and every other task — and every
168
+ * request — shares it; stamping the context onto it would pin it to this tenant for the life of the
169
+ * process. So the input is never stamped: this follows MJServer's `CloneUserForSessionContext`
170
+ * (spread the backing fields, hand the roles over explicitly, then stamp the clone).
171
+ */
172
+ export function CloneUserWithTenantContext(user, tenant, provider) {
173
+ const clone = new UserInfo(provider, { ...user, _UserRoles: undefined, UserRoles: user.UserRoles });
174
+ clone.MagicLinkScope = user.MagicLinkScope;
175
+ clone.ReturningVisitorContext = user.ReturningVisitorContext;
176
+ clone.WidgetGuestContext = user.WidgetGuestContext;
177
+ clone.IsMagicLinkAnonymous = user.IsMagicLinkAnonymous;
178
+ clone.AnonymousVisitorID = user.AnonymousVisitorID;
179
+ clone.APIKeyActingContext = user.APIKeyActingContext;
180
+ clone.APIKeyRowFilters = user.APIKeyRowFilters;
181
+ clone.TenantContext = { ...tenant };
182
+ return clone;
183
+ }
184
+ function isRecord(value) {
185
+ return !!value && typeof value === 'object' && !Array.isArray(value);
186
+ }
187
+ //# sourceMappingURL=task-security.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"task-security.js","sourceRoot":"","sources":["../src/task-security.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACH,0BAA0B,EAC1B,yBAAyB,EACzB,8BAA8B,GAEjC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAA8C,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE5F,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,UAA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