@requence/task 0.8.2-edge.1154 → 0.8.2-edge.1155
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.
- package/build/chunk-vnx9bdvh.js +181 -0
- package/build/chunk-vnx9bdvh.js.map +14 -0
- package/build/cli.js +11 -13
- package/build/cli.js.map +3 -3
- package/build/index.js +11 -11
- package/build/index.js.map +6 -6
- package/build/types/helpers/src/index.d.ts +4 -0
- package/build/types/helpers/src/index.d.ts.map +1 -1
- package/build/types/helpers/src/protocol/NodeTree.d.ts +20 -0
- package/build/types/helpers/src/protocol/NodeTree.d.ts.map +1 -1
- package/build/types/helpers/src/protocol/command.d.ts +74 -13
- package/build/types/helpers/src/protocol/command.d.ts.map +1 -1
- package/build/types/helpers/src/protocol/update.d.ts +128 -10
- package/build/types/helpers/src/protocol/update.d.ts.map +1 -1
- package/build/types/helpers/src/utils/matchSchema.d.ts +14 -0
- package/build/types/helpers/src/utils/matchSchema.d.ts.map +1 -1
- package/build/types/helpers/src/utils/serviceRender.d.ts +73 -0
- package/build/types/helpers/src/utils/serviceRender.d.ts.map +1 -0
- package/build/types/helpers/src/utils/surfaceComponent.d.ts +116 -0
- package/build/types/helpers/src/utils/surfaceComponent.d.ts.map +1 -0
- package/build/types/helpers/src/utils/surfaceHandler.d.ts +171 -0
- package/build/types/helpers/src/utils/surfaceHandler.d.ts.map +1 -0
- package/build/types/helpers/src/utils/uiRebuild.d.ts +48 -0
- package/build/types/helpers/src/utils/uiRebuild.d.ts.map +1 -0
- package/build/types/task/src/createTask.d.ts.map +1 -1
- package/build/types/task/src/getTask.d.ts.map +1 -1
- package/build/types/task/src/types.d.ts +4 -4
- package/build/types/task/src/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/build/chunk-f7g9gsa0.js +0 -65
- package/build/chunk-f7g9gsa0.js.map +0 -11
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
/**
|
|
3
|
+
* The reference tag of a **surface handler** — a function a service put in a
|
|
4
|
+
* surface's props, which a viewer's interaction runs back in the service that
|
|
5
|
+
* issued the render (#103).
|
|
6
|
+
*
|
|
7
|
+
* Deliberately not a `RequenceCallback`, even though the connection-bound arm
|
|
8
|
+
* is routed the same way today. The two answer different questions and address
|
|
9
|
+
* different things: a callback reference is a peer-to-peer control-flow handle
|
|
10
|
+
* whose `outputName`/`propertyPath` address a position in the node's declared
|
|
11
|
+
* *output schema*, while a handler reference addresses a **prop of a UI**, has
|
|
12
|
+
* no output behind it, and — in its durable arm — names no connection at all.
|
|
13
|
+
* Merging them would put a lifetime on every callback in the fabric and make a
|
|
14
|
+
* durable reference look like something the operator should route by `sourceId`.
|
|
15
|
+
*/
|
|
16
|
+
export declare const SURFACE_HANDLER_TAG = "RequenceHandler";
|
|
17
|
+
/**
|
|
18
|
+
* How long a handler can be reached, decided by **where the function was
|
|
19
|
+
* written** — which is the only thing that actually bounds the closure's life:
|
|
20
|
+
*
|
|
21
|
+
* - `durable` — a function in the UI's default props. It closes over module
|
|
22
|
+
* scope, so *any* instance of the service version can run it, now or after a
|
|
23
|
+
* redeploy, and an invocation waits in the version's handler queue when none
|
|
24
|
+
* is running. Addressed by `(uiId, path)`, because that pair is what survives
|
|
25
|
+
* a rebuild and a restart; the component's content hash does not.
|
|
26
|
+
* - `connection` — a function written inline at `context.render(...)`. It closes
|
|
27
|
+
* over the running handler, so only that process can serve it and it dies when
|
|
28
|
+
* the handler returns. Addressed by the registering connection plus an id in
|
|
29
|
+
* its registry, exactly as a callback is.
|
|
30
|
+
*
|
|
31
|
+
* `uiId`/`path` ride on both arms: the connection-bound arm does not need them
|
|
32
|
+
* to be *routed*, but they are what says which prop of which component this
|
|
33
|
+
* handle belongs to, which is what the row-level `live` flag could never say
|
|
34
|
+
* (#106).
|
|
35
|
+
*/
|
|
36
|
+
export declare const surfaceHandlerObjectSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
37
|
+
__REQUENCE_type: z.ZodLiteral<"RequenceHandler">;
|
|
38
|
+
lifetime: z.ZodLiteral<"durable">;
|
|
39
|
+
uiId: z.ZodString;
|
|
40
|
+
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodInt]>>;
|
|
41
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
42
|
+
__REQUENCE_type: z.ZodLiteral<"RequenceHandler">;
|
|
43
|
+
lifetime: z.ZodLiteral<"connection">;
|
|
44
|
+
uiId: z.ZodString;
|
|
45
|
+
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodInt]>>;
|
|
46
|
+
connectionId: z.ZodString;
|
|
47
|
+
handlerId: z.ZodUUID;
|
|
48
|
+
}, z.core.$strip>], "lifetime">;
|
|
49
|
+
export type SurfaceHandlerObject = z.infer<typeof surfaceHandlerObjectSchema>;
|
|
50
|
+
export type SurfaceHandlerLifetime = SurfaceHandlerObject['lifetime'];
|
|
51
|
+
export declare function isSurfaceHandlerObject(data: unknown): data is SurfaceHandlerObject;
|
|
52
|
+
/**
|
|
53
|
+
* The per-version **handler queue**: where a durable invocation waits until
|
|
54
|
+
* some instance of that service version consumes it.
|
|
55
|
+
*
|
|
56
|
+
* Derived from the version's dispatch queue rather than composed from the
|
|
57
|
+
* service and version names, so the two can never drift and a dev-overlay
|
|
58
|
+
* connection — which consumes a rewritten dispatch queue — gets a handler queue
|
|
59
|
+
* of its own for free.
|
|
60
|
+
*/
|
|
61
|
+
export declare function serviceHandlerQueueName(dispatchQueue: string): string;
|
|
62
|
+
/**
|
|
63
|
+
* How long a durable invocation may wait in the handler queue before the broker
|
|
64
|
+
* drops it (#116).
|
|
65
|
+
*
|
|
66
|
+
* The queue is **not a mailbox**. Reachability is checked before the click — a
|
|
67
|
+
* version with no consumers reports `reachable: false` and the control is
|
|
68
|
+
* withheld — so all this has to bridge is the seconds between that check and the
|
|
69
|
+
* consume: a rolling redeploy, a scale-to-zero that started a moment ago, a
|
|
70
|
+
* replica that took the invocation and died. Long enough that a normal restart
|
|
71
|
+
* still serves the click, short enough that nobody is surprised by an effect
|
|
72
|
+
* they pressed for hours ago.
|
|
73
|
+
*
|
|
74
|
+
* That is the half the flag cannot do on its own: the flag only makes the click
|
|
75
|
+
* harder to fire, and a click that IS fired into an empty queue must expire and
|
|
76
|
+
* be *reported* rather than sit there waiting for whoever deploys next.
|
|
77
|
+
*
|
|
78
|
+
* Expiry is not a drop: the queue dead-letters to `error`, so an expired
|
|
79
|
+
* invocation comes back to the operator carrying its own `taskId` and surface
|
|
80
|
+
* row, and is recorded as an `interactionError` (#107).
|
|
81
|
+
*/
|
|
82
|
+
export declare const SURFACE_HANDLER_INVOCATION_TTL_MS = 60000;
|
|
83
|
+
/**
|
|
84
|
+
* The handler queue's declaration arguments, as **one** object, because two
|
|
85
|
+
* parties declare that queue — ui/backend's provisioner and the service SDK on
|
|
86
|
+
* connect — and a broker answers a mismatch with a 406 that kills the declaring
|
|
87
|
+
* channel. Anything short of a shared literal is a service that will not start.
|
|
88
|
+
*
|
|
89
|
+
* `deadLetterExchange` is what turns expiry into a *report*: `error` fans back
|
|
90
|
+
* into the operator's own shard family, so an expired invocation arrives at the
|
|
91
|
+
* error consumer still carrying its `taskId`, its surface row and its
|
|
92
|
+
* `surfaceHandlerInvocation` marker. Without it the broker would simply drop the
|
|
93
|
+
* message, which is the silent outcome #116 replaced.
|
|
94
|
+
*
|
|
95
|
+
* Note for whoever changes this: declaring a queue with a dead-letter exchange
|
|
96
|
+
* needs WRITE permission on that exchange, so the service AMQP user is granted
|
|
97
|
+
* it (`assertService`). It costs nothing — `error` is an internal exchange and
|
|
98
|
+
* the broker refuses a client publish to one however the permissions read.
|
|
99
|
+
*/
|
|
100
|
+
export declare const SURFACE_HANDLER_QUEUE_ARGUMENTS: {
|
|
101
|
+
readonly messageTtl: 60000;
|
|
102
|
+
readonly deadLetterExchange: 'error';
|
|
103
|
+
};
|
|
104
|
+
export declare function isDevOverlayHandlerQueue(queueName: string): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* The header a durable invocation is stamped with, so the party that has to
|
|
107
|
+
* answer an **unroutable** one can tell it from a dispatch (#104).
|
|
108
|
+
*
|
|
109
|
+
* A durable invocation is published `mandatory` into the `service` exchange, so
|
|
110
|
+
* one whose queue is gone comes back to the operator looking like any other
|
|
111
|
+
* undeliverable service message — and every other arm there fails the task's
|
|
112
|
+
* node, which a viewer's click must never do.
|
|
113
|
+
*
|
|
114
|
+
* A header rather than the routing key's `-handlers` suffix, which is *nearly*
|
|
115
|
+
* unambiguous and therefore worse: a version named `…-handlers` gives a dispatch
|
|
116
|
+
* queue that ends the same way, and the failure that buys is a real service
|
|
117
|
+
* dispatch silently swallowed instead of failing its node. This is exact, and it
|
|
118
|
+
* is set by the only publisher there is.
|
|
119
|
+
*/
|
|
120
|
+
export declare const SURFACE_HANDLER_INVOCATION_HEADER = "surfaceHandlerInvocation";
|
|
121
|
+
/**
|
|
122
|
+
* One durable handler invocation, as it travels on the queue above.
|
|
123
|
+
*
|
|
124
|
+
* The pair `(uiId, path)` is the whole address: the consuming instance looks the
|
|
125
|
+
* UI up in its own registry and resolves the path against that UI's default
|
|
126
|
+
* props. `taskId` is not part of the address — it is what makes the failure of
|
|
127
|
+
* an invocation that names nothing say *which run* it belonged to.
|
|
128
|
+
*/
|
|
129
|
+
export declare const surfaceHandlerInvocationSchema: z.ZodObject<{
|
|
130
|
+
taskId: z.ZodUUID;
|
|
131
|
+
surface: z.ZodUUID;
|
|
132
|
+
uiId: z.ZodString;
|
|
133
|
+
path: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodInt]>>;
|
|
134
|
+
arg: z.ZodOptional<z.ZodUnknown>;
|
|
135
|
+
}, z.core.$strip>;
|
|
136
|
+
export type SurfaceHandlerInvocation = z.infer<typeof surfaceHandlerInvocationSchema>;
|
|
137
|
+
/**
|
|
138
|
+
* How long a recorded interaction failure may be (#107).
|
|
139
|
+
*
|
|
140
|
+
* A thrown error's message is author-supplied text of no bounded length, and it
|
|
141
|
+
* ends up on a row that is pushed to every viewer of the task on every render.
|
|
142
|
+
* Truncated rather than rejected: a long message is still the most useful thing
|
|
143
|
+
* anyone has about the failure, and its first characters are where the cause is.
|
|
144
|
+
*/
|
|
145
|
+
export declare const MAX_SURFACE_INTERACTION_ERROR_CHARS = 500;
|
|
146
|
+
/**
|
|
147
|
+
* The header a **surface interaction failure report** is stamped with (#107), so
|
|
148
|
+
* the operator can tell it from an ordinary service result.
|
|
149
|
+
*
|
|
150
|
+
* A report carries no message id and no index: the handler that failed was not
|
|
151
|
+
* running for any message of the operator's — that is the whole of what makes a
|
|
152
|
+
* durable handler durable — so it cannot ride the ordered dispatch buffer, and
|
|
153
|
+
* every other arm of the result path would fail the node the surface is painted
|
|
154
|
+
* on. It names a task, a surface row and what went wrong, and the operator
|
|
155
|
+
* forwards it as a task update.
|
|
156
|
+
*/
|
|
157
|
+
export declare const SURFACE_INTERACTION_ERROR_HEADER = "surfaceInteractionError";
|
|
158
|
+
/**
|
|
159
|
+
* One interaction failure, as a service reports it back to the operator (#107).
|
|
160
|
+
*
|
|
161
|
+
* The failing party writes the sentence: only it knows whether the component was
|
|
162
|
+
* unregistered, the prop held nothing invokable, or the handler threw — and only
|
|
163
|
+
* it can quote the error. The operator forwards the text verbatim; ui/backend
|
|
164
|
+
* masks it and stores it on the row.
|
|
165
|
+
*/
|
|
166
|
+
export declare const surfaceInteractionErrorReportSchema: z.ZodObject<{
|
|
167
|
+
surface: z.ZodUUID;
|
|
168
|
+
message: z.ZodString;
|
|
169
|
+
}, z.core.$strip>;
|
|
170
|
+
export type SurfaceInteractionErrorReport = z.infer<typeof surfaceInteractionErrorReportSchema>;
|
|
171
|
+
//# sourceMappingURL=surfaceHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surfaceHandler.d.ts","sourceRoot":"","sources":["../../../../../../helpers/src/utils/surfaceHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,M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0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
/**
|
|
3
|
+
* Marks a service message as a **dev-loop bundle swap** (#108) rather than a
|
|
4
|
+
* result for one of the operator's dispatches.
|
|
5
|
+
*
|
|
6
|
+
* A rebuild changes which bytes the frame imports and nothing else — not the
|
|
7
|
+
* props, not the handlers, not the node — so it is deliberately not a render. A
|
|
8
|
+
* render would need the registering message to be unsettled and its registry
|
|
9
|
+
* alive, which is what took the dev loop away from a deferred form: the handler
|
|
10
|
+
* that drew it returned at the defer, so there is nothing left to re-render
|
|
11
|
+
* through. A swap needs none of that, and so works identically for a live panel,
|
|
12
|
+
* a deferred form, and a surface on a task that has already finished.
|
|
13
|
+
*
|
|
14
|
+
* Read on the same path as a result, and answered before it — like
|
|
15
|
+
* `SURFACE_INTERACTION_ERROR_HEADER`, this message has no correlation id, no
|
|
16
|
+
* index and no place in the ordered dispatch buffer, because it belongs to no
|
|
17
|
+
* message of the operator's.
|
|
18
|
+
*/
|
|
19
|
+
export declare const UI_REBUILD_HEADER = "uiRebuild";
|
|
20
|
+
/**
|
|
21
|
+
* What a rebuild says: *this component of this dev session is now these bytes*.
|
|
22
|
+
*
|
|
23
|
+
* `devSession` is opaque here and produced by the service SDK, which is the only
|
|
24
|
+
* party that can: it is the one identity that survives the process being
|
|
25
|
+
* restarted (a dev token plus the service version it is overlaying), so the
|
|
26
|
+
* surfaces a session drew before a restart are still the same session's
|
|
27
|
+
* afterwards. It deliberately carries no dev token in the clear — the token is
|
|
28
|
+
* hashed into it — because it comes to rest in `task_surface`.
|
|
29
|
+
*
|
|
30
|
+
* `uiId` is the component's stable id (#103), which is what makes the swap
|
|
31
|
+
* addressable at all: the hash is the thing that changed, so it cannot be the
|
|
32
|
+
* thing looked up. A surface repoints when it belongs to this session AND shows
|
|
33
|
+
* this component, whatever hash it is currently on — which is why a swap reaches
|
|
34
|
+
* a surface that has sat through several rebuilds unseen.
|
|
35
|
+
*
|
|
36
|
+
* `source` always travels. The render payload's per-task dedup does not apply: a
|
|
37
|
+
* swap is the first anyone has heard of this hash, and the surfaces it repoints
|
|
38
|
+
* are precisely the ones that would otherwise be left naming a bundle nobody
|
|
39
|
+
* stored.
|
|
40
|
+
*/
|
|
41
|
+
export declare const uiRebuildSchema: z.ZodObject<{
|
|
42
|
+
devSession: z.ZodString;
|
|
43
|
+
uiId: z.ZodString;
|
|
44
|
+
hash: z.ZodString;
|
|
45
|
+
source: z.ZodString;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
export type UiRebuild = z.infer<typeof uiRebuildSchema>;
|
|
48
|
+
//# sourceMappingURL=uiRebuild.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uiRebuild.d.ts","sourceRoot":"","sources":["../../../../../../helpers/src/utils/uiRebuild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,iBAAiB,cAAc,CAAA;AAE5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,eAAe;;;;;iBAK1B,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTask.d.ts","sourceRoot":"","sources":["../../../../src/createTask.ts"],"names":[],"mappings":"AAmBA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,MAAM,EACX,KAAK,MAAM,EAGZ,MAAM,YAAY,CAAA;AAGnB,cAAM,gBAAiB,SAAQ,KAAK;aAGhB,YAAY,EAAE,MAAM;IAFtC,YACE,OAAO,EAAE,MAAM,EACC,YAAY,EAAE,MAAM,EAGrC;CACF;AAED,qBAAa,SAAU,SAAQ,gBAAgB;aAG3B,YAAY,EAAE,MAAM;aACpB,MAAM,EAAE,MAAM;IAHhC,YACE,OAAO,EA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,YAAY,EAAE,MAAM;aACpB,MAAM,EAAE,MAAM;IAHhC,YACE,OAAO,EAAE,MAAM,EACC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EAG/B;CACF;AAED,KAAK,iBAAiB,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,CAAA;AAEvD,KAAK,IAAI,CAAC,CAAC,SAAS,MAAM,YAAY,CAAC,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,IACjE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GACtB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,GAAG;IACvD,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IAC5B,UAAU,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAA;IACpC,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;CACzB,CAAA;AAEL,wBAAgB,UAAU,CACxB,CAAC,SAAS,MAAM,YAAY,CAAC,YAAY,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EACzD,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CA0ezE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTask.d.ts","sourceRoot":"","sources":["../../../../src/getTask.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getTask.d.ts","sourceRoot":"","sources":["../../../../src/getTask.ts"],"names":[],"mappings":"AAmCA,UAAU,cAAc;IACtB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,MAAM,CAAA;CACf;AAED,wBAAsB,OAAO,CAAC,eAAe,EAAE,MAAM,GAAG,cAAc;;;;;;;;;;;;;;;;;;;GA0DrE"}
|
|
@@ -35,7 +35,7 @@ declare const updateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
35
35
|
name: z.ZodString;
|
|
36
36
|
updateId: z.ZodUUID;
|
|
37
37
|
type: z.ZodLiteral<"taskStart">;
|
|
38
|
-
input: z.ZodUnknown
|
|
38
|
+
input: z.ZodOptional<z.ZodUnknown>;
|
|
39
39
|
rootTaskId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
|
|
40
40
|
}, z.core.$strip>, z.ZodObject<{
|
|
41
41
|
timestamp: z.ZodCoercedDate<unknown>;
|
|
@@ -84,7 +84,7 @@ declare const updateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
84
84
|
type: z.ZodLiteral<"logic" | "or" | "reference" | "service">;
|
|
85
85
|
alias: z.ZodOptional<z.ZodString>;
|
|
86
86
|
}, z.core.$strip>;
|
|
87
|
-
data: z.ZodUnknown
|
|
87
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
88
88
|
output: z.ZodUnion<readonly [z.ZodNull, z.ZodString]>;
|
|
89
89
|
}, z.core.$strip>, z.ZodObject<{
|
|
90
90
|
timestamp: z.ZodCoercedDate<unknown>;
|
|
@@ -151,7 +151,7 @@ export declare const eventSchema: z.ZodPipe<z.ZodPipe<z.ZodObject<{
|
|
|
151
151
|
name: z.ZodString;
|
|
152
152
|
updateId: z.ZodUUID;
|
|
153
153
|
type: z.ZodLiteral<"taskStart">;
|
|
154
|
-
input: z.ZodUnknown
|
|
154
|
+
input: z.ZodOptional<z.ZodUnknown>;
|
|
155
155
|
rootTaskId: z.ZodDefault<z.ZodNullable<z.ZodUUID>>;
|
|
156
156
|
}, z.core.$strip>, z.ZodObject<{
|
|
157
157
|
timestamp: z.ZodCoercedDate<unknown>;
|
|
@@ -200,7 +200,7 @@ export declare const eventSchema: z.ZodPipe<z.ZodPipe<z.ZodObject<{
|
|
|
200
200
|
type: z.ZodLiteral<"logic" | "or" | "reference" | "service">;
|
|
201
201
|
alias: z.ZodOptional<z.ZodString>;
|
|
202
202
|
}, z.core.$strip>;
|
|
203
|
-
data: z.ZodUnknown
|
|
203
|
+
data: z.ZodOptional<z.ZodUnknown>;
|
|
204
204
|
output: z.ZodUnion<readonly [z.ZodNull, z.ZodString]>;
|
|
205
205
|
}, z.core.$strip>, z.ZodObject<{
|
|
206
206
|
timestamp: z.ZodCoercedDate<unknown>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE1B,KAAK,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,OAAO,SAAS,CAAC,GAC7C,CAAC,SAAS,OAAO,GACf,IAAI,GACJ,IAAI,GACN,IAAI,CAAA;AAER,KAAK,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,IAAI,CAAC,SAAS,IAAI,GACvC,IAAI,SAAS,CAAC,GACZ,IAAI,GACJ,IAAI,GACN,IAAI,CAAA;AAER,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI;IACjC,YAAY,EAAE,CAAC,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB,GAAG,MAAM,CACR,KAAK,CAAC,CAAC,CAAC,EACR;IAAE,KAAK,CAAC,EAAE,IAAI,CAAA;CAAE,EAChB,SAAS,CAAC,KAAK,CAAC,CAAC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build/cli.js"
|
|
7
7
|
},
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"ajv": "^8.17.1",
|
|
24
|
-
"chalk": "^5.6.2",
|
|
25
24
|
"eventsource-client": "^1.2.0",
|
|
26
25
|
"mime-types": "^3.0.1",
|
|
27
26
|
"yargs": "^17.7.2",
|
|
@@ -31,6 +30,7 @@
|
|
|
31
30
|
"@requence/callbacks": "workspace:*",
|
|
32
31
|
"@requence/files": "workspace:*",
|
|
33
32
|
"@requence/helpers": "workspace:*",
|
|
33
|
+
"@requence/logger": "workspace:*",
|
|
34
34
|
"@requence/transformer": "workspace:*",
|
|
35
35
|
"@requence/utils": "workspace:*",
|
|
36
36
|
"@types/bun": "^1.2.23",
|
package/build/chunk-f7g9gsa0.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// ../helpers/src/utils/obfuscate.ts
|
|
2
|
-
var separator = "";
|
|
3
|
-
var base65Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";
|
|
4
|
-
var base65CharToIndex = {};
|
|
5
|
-
for (let i = 0;i < base65Chars.length; i++) {
|
|
6
|
-
base65CharToIndex[base65Chars[i]] = i;
|
|
7
|
-
}
|
|
8
|
-
function deobfuscate(str) {
|
|
9
|
-
const paddingCount = parseInt(str.slice(-1), 10);
|
|
10
|
-
str = str.slice(0, -1);
|
|
11
|
-
let binaryString = "";
|
|
12
|
-
for (let i = 0;i < str.length; i++) {
|
|
13
|
-
const decimalValue = base65CharToIndex[str[i]];
|
|
14
|
-
const binaryChunk = decimalValue.toString(2).padStart(6, "0");
|
|
15
|
-
binaryString += binaryChunk;
|
|
16
|
-
}
|
|
17
|
-
if (paddingCount > 0) {
|
|
18
|
-
binaryString = binaryString.slice(0, -paddingCount);
|
|
19
|
-
}
|
|
20
|
-
let decodedString = "";
|
|
21
|
-
const charSize = 16;
|
|
22
|
-
for (let i = 0;i < binaryString.length; i += charSize) {
|
|
23
|
-
const byte = binaryString.substring(i, i + charSize);
|
|
24
|
-
if (byte.length === 16) {
|
|
25
|
-
const charCode = parseInt(byte, 2);
|
|
26
|
-
decodedString += String.fromCharCode(charCode);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return decodedString.split(separator);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// src/errors.ts
|
|
33
|
-
var UNREACHABLE_STATUS = new Set([502, 503, 504]);
|
|
34
|
-
|
|
35
|
-
class RequenceUnreachableError extends Error {
|
|
36
|
-
status;
|
|
37
|
-
constructor(status, options) {
|
|
38
|
-
super("The requence system is currently not reachable. Please retry later.", options);
|
|
39
|
-
this.status = status;
|
|
40
|
-
this.name = "RequenceUnreachableError";
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
function isUnreachableStatus(status) {
|
|
44
|
-
return UNREACHABLE_STATUS.has(status);
|
|
45
|
-
}
|
|
46
|
-
function assertReachable(response) {
|
|
47
|
-
if (isUnreachableStatus(response.status)) {
|
|
48
|
-
throw new RequenceUnreachableError(response.status);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
async function reachableFetch(input, init) {
|
|
52
|
-
let response;
|
|
53
|
-
try {
|
|
54
|
-
response = await fetch(input, init);
|
|
55
|
-
} catch (error) {
|
|
56
|
-
throw new RequenceUnreachableError(undefined, { cause: error });
|
|
57
|
-
}
|
|
58
|
-
assertReachable(response);
|
|
59
|
-
return response;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export { deobfuscate, RequenceUnreachableError, isUnreachableStatus, reachableFetch };
|
|
63
|
-
|
|
64
|
-
//# debugId=BB37885AF7B09DA164756E2164756E21
|
|
65
|
-
//# sourceMappingURL=chunk-f7g9gsa0.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../helpers/src/utils/obfuscate.ts", "../src/errors.ts"],
|
|
4
|
-
"sourcesContent": [
|
|
5
|
-
"const separator = '\\u{f6ee}'\n\nconst base65Chars =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$'\n\nconst base65CharToIndex: Record<string, number> = {}\nfor (let i = 0; i < base65Chars.length; i++) {\n base65CharToIndex[base65Chars[i]] = i\n}\n\nexport function obfuscate(...parts: Array<string>) {\n const str = parts.join(separator)\n let binaryString = ''\n\n for (let i = 0; i < str.length; i++) {\n const charCode = str.charCodeAt(i)\n binaryString += charCode.toString(2).padStart(16, '0')\n }\n\n let encodedString = ''\n const chunkSize = 6\n let paddingCount = 0\n\n for (let i = 0; i < binaryString.length; i += chunkSize) {\n let chunk = binaryString.substring(i, i + chunkSize)\n\n if (chunk.length < chunkSize) {\n paddingCount = chunkSize - chunk.length\n chunk = chunk.padEnd(chunkSize, '0')\n }\n\n const decimalValue = parseInt(chunk, 2)\n encodedString += base65Chars[decimalValue]\n }\n\n return encodedString + paddingCount.toString()\n}\n\nexport function randomString(length: number) {\n const randomValues = new Uint8Array(length)\n crypto.getRandomValues(randomValues)\n\n let randomString = ''\n for (let i = 0; i < length; i++) {\n randomString += base65Chars[randomValues[i] % base65Chars.length]\n }\n\n return randomString\n}\n\nexport function deobfuscate(str: string) {\n const paddingCount = parseInt(str.slice(-1), 10)\n str = str.slice(0, -1)\n\n let binaryString = ''\n\n for (let i = 0; i < str.length; i++) {\n const decimalValue = base65CharToIndex[str[i]]\n const binaryChunk = decimalValue.toString(2).padStart(6, '0')\n binaryString += binaryChunk\n }\n\n if (paddingCount > 0) {\n binaryString = binaryString.slice(0, -paddingCount)\n }\n\n let decodedString = ''\n const charSize = 16\n\n for (let i = 0; i < binaryString.length; i += charSize) {\n const byte = binaryString.substring(i, i + charSize)\n if (byte.length === 16) {\n const charCode = parseInt(byte, 2)\n decodedString += String.fromCharCode(charCode)\n }\n }\n\n return decodedString.split(separator)\n}\n",
|
|
6
|
-
"// Gateway statuses an ingress/load balancer emits when no healthy backend is\n// available (maintenance window, deploy, cutover). The task endpoints never\n// return these themselves, so treating them as \"unreachable\" is unambiguous.\nconst UNREACHABLE_STATUS = new Set([502, 503, 504])\n\n/**\n * Signals that the requence system could not be reached — e.g. during a\n * maintenance window or deploy, when the ui backend is unreachable (connection\n * refused / timeout / DNS failure) or an ingress returns a gateway error\n * (502/503/504). Callers should treat this as transient and retry later.\n */\nexport class RequenceUnreachableError extends Error {\n constructor(\n public readonly status?: number,\n options?: { cause?: unknown },\n ) {\n super(\n 'The requence system is currently not reachable. Please retry later.',\n options,\n )\n this.name = 'RequenceUnreachableError'\n }\n}\n\nexport function isUnreachableStatus(status: number): boolean {\n return UNREACHABLE_STATUS.has(status)\n}\n\n/**\n * Throws a {@link RequenceUnreachableError} when the response carries a gateway\n * status indicating the system is unreachable. Call right after a fetch, before\n * inspecting `response.ok`.\n */\nexport function assertReachable(response: Response): void {\n if (isUnreachableStatus(response.status)) {\n throw new RequenceUnreachableError(response.status)\n }\n}\n\n/**\n * Wraps `fetch` so a transport-level failure (connection refused, DNS failure,\n * timeout) surfaces as a {@link RequenceUnreachableError} instead of a raw\n * TypeError, and gateway statuses (502/503/504) do the same. The returned\n * response is guaranteed not to be a gateway-error response.\n */\nexport async function reachableFetch(\n input: Parameters<typeof fetch>[0],\n init?: Parameters<typeof fetch>[1],\n): Promise<Response> {\n let response: Response\n try {\n response = await fetch(input, init)\n } catch (error) {\n throw new RequenceUnreachableError(undefined, { cause: error })\n }\n assertReachable(response)\n return response\n}\n"
|
|
7
|
-
],
|
|
8
|
-
"mappings": ";AAAA,IAAM,YAAY;AAElB,IAAM,cACJ;AAEF,IAAM,oBAA4C,CAAC;AACnD,SAAS,IAAI,EAAG,IAAI,YAAY,QAAQ,KAAK;AAAA,EAC3C,kBAAkB,YAAY,MAAM;AACtC;AA0CO,SAAS,WAAW,CAAC,KAAa;AAAA,EACvC,MAAM,eAAe,SAAS,IAAI,MAAM,EAAE,GAAG,EAAE;AAAA,E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