@plitzi/sdk-actions 0.39.3 → 0.39.4
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/CHANGELOG.md +10 -0
- package/dist/chunks/{load-DBWRZn7G.mjs → load-DTPs5l0C.mjs} +1 -1
- package/dist/chunks/{module-WdDzbjHy.mjs → module-HDpOahhW.mjs} +8 -3
- package/dist/chunks/{remote-DopPgCMK.mjs → remote-Cm3IDERi.mjs} +1 -1
- package/dist/chunks/{taskCatalog-S1IozUTD.mjs → taskCatalog-DBVODJX7.mjs} +1 -1
- package/dist/functions/index.mjs +7 -3
- package/dist/functions/local.d.ts +1 -1
- package/dist/index.mjs +2 -2
- package/dist/realtime/hub.d.ts +24 -1
- package/dist/realtime/index.mjs +90 -4
- package/dist/render/index.d.ts +1 -1
- package/dist/render/index.mjs +1 -1
- package/dist/render/remote.d.ts +1 -1
- package/dist/worker/index.mjs +6 -6
- package/dist/worker/pageEngine.d.ts +1 -1
- package/dist/worker/worker.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @plitzi/sdk-actions
|
|
2
2
|
|
|
3
|
+
## 0.39.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 35415a1: Released with every `@plitzi` package at this version. What changed in each, and what to do when you upgrade, is in
|
|
8
|
+
`@plitzi/cli`'s `CHANGELOG.md`: one copy of the notes, not one per package.
|
|
9
|
+
- Updated dependencies [35415a1]
|
|
10
|
+
- @plitzi/sdk-kernel@0.39.4
|
|
11
|
+
- @plitzi/sdk-shared@0.39.4
|
|
12
|
+
|
|
3
13
|
## 0.39.3
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as buildFunctions } from "./module-
|
|
1
|
+
import { i as buildFunctions } from "./module-HDpOahhW.mjs";
|
|
2
2
|
import { isRecord } from "@plitzi/sdk-shared/helpers";
|
|
3
3
|
import { readFunctionsSource } from "@plitzi/sdk-shared/actions";
|
|
4
4
|
import { readFile, readdir } from "node:fs/promises";
|
|
@@ -13,6 +13,7 @@ import { overloaded, processLoad, sampleProcessMemory } from "@plitzi/sdk-kernel
|
|
|
13
13
|
import { getHeapStatistics } from "node:v8";
|
|
14
14
|
import { ActionRefusal, FUNCTION_SIZES, FUNCTION_SIZE_NAMES, FunctionFailure, changeKv, changeListEntry, defineFunctions, functionSizesWithin, isActionRefusal, isFunctionLimit, isFunctionSize, isStreamedRouteAnswer, refusalCodeOf, responseOf, wireRequestOf, wireResponseFrom, wireResponseOf } from "@plitzi/sdk-shared/functions";
|
|
15
15
|
import { fleetStore, hostable, onAbort } from "@plitzi/sdk-kernel/http";
|
|
16
|
+
import { currentTrace } from "@plitzi/sdk-kernel/trace";
|
|
16
17
|
import { evaluateRuleGroup } from "@plitzi/sdk-shared/conditions";
|
|
17
18
|
import { lookup } from "node:dns/promises";
|
|
18
19
|
import { flagUserFromSSR, flagValues, resolveFlags, serverFlagsFor, undeclaredFlagOverrides } from "@plitzi/sdk-shared/flags";
|
|
@@ -1978,7 +1979,7 @@ var DEFAULT_LIMITS = {
|
|
|
1978
1979
|
/** Generous for an API answer and nowhere near what it takes to hurt a process holding several runs at once. */
|
|
1979
1980
|
maxResponseBytes: 5e6,
|
|
1980
1981
|
/**
|
|
1981
|
-
* Two answers at the response ceiling. A run holds a parsed answer at ~2.5–4× its size while it parses (
|
|
1982
|
+
* Two answers at the response ceiling. A run holds a parsed answer at ~2.5–4× its size while it parses (docs/en/server-packages.md
|
|
1982
1983
|
* §8.1), so this keeps one run under ~40 MB; what many runs hold together is the guards' `memoryShare`.
|
|
1983
1984
|
*/
|
|
1984
1985
|
maxRunBytes: 1e7
|
|
@@ -2820,8 +2821,12 @@ var createActionRunner = (config, registryFor, baseFetch = fetch, jobsQueue = ()
|
|
|
2820
2821
|
};
|
|
2821
2822
|
/** Never allowed to fail a run: a logging outage must not take an action down, the same rule metering follows. */
|
|
2822
2823
|
const record = async (entry) => {
|
|
2824
|
+
const trace = currentTrace();
|
|
2823
2825
|
try {
|
|
2824
|
-
await config.onRun?.(entry
|
|
2826
|
+
await config.onRun?.(trace && !entry.traceId ? {
|
|
2827
|
+
...entry,
|
|
2828
|
+
traceId: trace.traceId
|
|
2829
|
+
} : entry);
|
|
2825
2830
|
} catch (error) {
|
|
2826
2831
|
serverLog.error("Actions", "run record failed", error);
|
|
2827
2832
|
}
|
|
@@ -6608,7 +6613,7 @@ var entryModule = (files) => [
|
|
|
6608
6613
|
var MAX_FUNCTIONS_BYTES = 1e6;
|
|
6609
6614
|
/** The one package a space's code may import: the contract, which is all it needs of the platform. */
|
|
6610
6615
|
var CONTRACT_SPECIFIER = "@plitzi/sdk-runtime";
|
|
6611
|
-
/** Where the contract was imported from until it had a package of its own (
|
|
6616
|
+
/** Where the contract was imported from until it had a package of its own (docs/en/server-packages.md): refused, naming where it is. */
|
|
6612
6617
|
var FORMER_CONTRACT_SPECIFIER = "@plitzi/sdk-server/functions";
|
|
6613
6618
|
/**
|
|
6614
6619
|
* What that import is inside a bundle: the contract's own `defineFunctions` and `ActionRefusal`, each printed from
|
|
@@ -343,7 +343,7 @@ var subtreeOf = (flat, rootId) => {
|
|
|
343
343
|
};
|
|
344
344
|
var isAnswer = (value) => isRecord(value) && typeof value.ok === "boolean" && Array.isArray(value.runs);
|
|
345
345
|
/**
|
|
346
|
-
* A page's server elements resolved on a worker (
|
|
346
|
+
* A page's server elements resolved on a worker (docs/en/server-packages.md): each one asked at `/_render`, so this page server runs
|
|
347
347
|
* no action and no connector, and imports nothing of the engine to run. Handed to it with `engineOnWorker({ render })`.
|
|
348
348
|
*
|
|
349
349
|
* What fed the element comes back with its data — the runs, for a page that debugs — and a failure comes back as one:
|
package/dist/functions/index.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { c as oauthCallbackUrlOn, d as DEFAULT_FUNCTION_LIMITS, i as buildFunctions, l as readManifest, n as functionsInHand, o as DEFAULT_FUNCTION_JOB_LIMITS, r as FunctionsBuildError, t as createActionsModule, u as DEFAULT_FUNCTION_CEILINGS } from "../chunks/module-
|
|
2
|
-
import { i as readFunctionsDir, n as loadFunctions, r as loadFunctionsSource } from "../chunks/load-
|
|
1
|
+
import { c as oauthCallbackUrlOn, d as DEFAULT_FUNCTION_LIMITS, i as buildFunctions, l as readManifest, n as functionsInHand, o as DEFAULT_FUNCTION_JOB_LIMITS, r as FunctionsBuildError, t as createActionsModule, u as DEFAULT_FUNCTION_CEILINGS } from "../chunks/module-HDpOahhW.mjs";
|
|
2
|
+
import { i as readFunctionsDir, n as loadFunctions, r as loadFunctionsSource } from "../chunks/load-DTPs5l0C.mjs";
|
|
3
3
|
import { t as credentialsFromEnv } from "../chunks/credentials-DwxZeAvH.mjs";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
import { FUNCTIONS_PROTOCOL, FunctionFailure, failedAnswerOf, readResponseMessage } from "@plitzi/sdk-shared/functions";
|
|
6
6
|
import { frameText } from "@plitzi/sdk-kernel/http";
|
|
7
|
+
import { traceHeaders } from "@plitzi/sdk-kernel/trace";
|
|
7
8
|
import { lookup } from "node:dns/promises";
|
|
8
9
|
import { dataDirLookup } from "@plitzi/sdk-kernel/data";
|
|
9
10
|
import { isIP } from "node:net";
|
|
@@ -180,7 +181,10 @@ var createRemoteRunner = ({ url, secret, connectTimeoutMs = 5e3, graceMs = 5e3 }
|
|
|
180
181
|
};
|
|
181
182
|
const operate = ({ first, load, bundleId, address, deadlineMs, answer, signal, onUsage, onWaited, tellWaited }) => new Promise((resolve, reject) => {
|
|
182
183
|
const socket = new WebSocket(address, {
|
|
183
|
-
headers: {
|
|
184
|
+
headers: {
|
|
185
|
+
authorization: `Bearer ${secret}`,
|
|
186
|
+
...traceHeaders()
|
|
187
|
+
},
|
|
184
188
|
handshakeTimeout: connectTimeoutMs
|
|
185
189
|
});
|
|
186
190
|
let settled = false;
|
|
@@ -5,7 +5,7 @@ import { FunctionLimits, FunctionRunner } from '@plitzi/sdk-shared/functions';
|
|
|
5
5
|
export type LocalFunctionsOptions = {
|
|
6
6
|
/**
|
|
7
7
|
* What runs the code: an isolate, as on the platform — `createIsolateRunner({ concurrency: 1 })` of
|
|
8
|
-
* `@plitzi/sdk-runtime/runner`. Handed in, so what holds the runs never loads what runs a space's code (
|
|
8
|
+
* `@plitzi/sdk-runtime/runner`. Handed in, so what holds the runs never loads what runs a space's code (docs/en/server-packages.md, D8).
|
|
9
9
|
*/
|
|
10
10
|
runner: FunctionRunner;
|
|
11
11
|
/** Credentials `ctx.fetch` may name, by id — by default the project's own, from its environment (`PLITZI_CREDENTIALS`). */
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as schedulesFor, C as fleetJobQueue, D as DEFAULT_MAX_ATTEMPTS, E as createScheduler, I as fetchConnectorRecords, L as rebaseMedia, M as KEPT_CALLS_PER_SPACE, N as KEPT_CALL_MS, O as scheduleFor, R as writeConnectorRecord, T as createJobWorker, _ as DEFAULT_LIMITS, a as createTaskRegistry, b as MAX_LIST_ENTRIES, f as taskName, g as spaceKvPatterns, j as createMemoryJobQueue, k as scheduleJobId, m as createSigning, p as MIN_SIGNING_SECRET_LENGTH, s as jobViewOf, t as createActionsModule, v as createKvStore, w as fleetKv, x as createActionJobs, y as MAX_LIST_BYTES } from "./chunks/module-
|
|
2
|
-
import { n as describeTask, r as createConnectorResolver, t as describeCatalog } from "./chunks/taskCatalog-
|
|
1
|
+
import { A as schedulesFor, C as fleetJobQueue, D as DEFAULT_MAX_ATTEMPTS, E as createScheduler, I as fetchConnectorRecords, L as rebaseMedia, M as KEPT_CALLS_PER_SPACE, N as KEPT_CALL_MS, O as scheduleFor, R as writeConnectorRecord, T as createJobWorker, _ as DEFAULT_LIMITS, a as createTaskRegistry, b as MAX_LIST_ENTRIES, f as taskName, g as spaceKvPatterns, j as createMemoryJobQueue, k as scheduleJobId, m as createSigning, p as MIN_SIGNING_SECRET_LENGTH, s as jobViewOf, t as createActionsModule, v as createKvStore, w as fleetKv, x as createActionJobs, y as MAX_LIST_BYTES } from "./chunks/module-HDpOahhW.mjs";
|
|
2
|
+
import { n as describeTask, r as createConnectorResolver, t as describeCatalog } from "./chunks/taskCatalog-DBVODJX7.mjs";
|
|
3
3
|
import { n as stateOf, t as documentOf } from "./chunks/queueDocument-xYz-KZ5V.mjs";
|
|
4
4
|
import { a as emptyState, c as queueRules, i as changedBy, r as applyRule, s as queueOver } from "./chunks/queueRules-BCCVgeUE.mjs";
|
|
5
5
|
import { a as triggerParams, t as ActionRunError } from "./chunks/errors-bCBfIe7c.mjs";
|
package/dist/realtime/hub.d.ts
CHANGED
|
@@ -33,6 +33,24 @@ export type RealtimeConnection = {
|
|
|
33
33
|
};
|
|
34
34
|
/** A space's topic, as the adapter knows it: namespaced, so two spaces never hear each other. */
|
|
35
35
|
export declare const adapterTopic: ({ spaceId, environment }: RealtimeSpace, topic: string) => string;
|
|
36
|
+
/** What a relayed publish is answered with: the status, and what a refusal says. */
|
|
37
|
+
export type RelayedAnswer = {
|
|
38
|
+
status: number;
|
|
39
|
+
error?: string;
|
|
40
|
+
reason?: string;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* How a hub answers a page whose connection another replica holds (`ask`). Over Server-Sent Events a page publishes with
|
|
44
|
+
* a request, and with two replicas and no affinity that request reaches the one that did not open its stream — which
|
|
45
|
+
* knew nothing of its token and answered 401. Absent, a hub answers only its own connections' (a runner's, that holds
|
|
46
|
+
* none).
|
|
47
|
+
*/
|
|
48
|
+
export type HubRelay = {
|
|
49
|
+
/** What the replica holding the connection answers the publish with (`publishFrom`): its rate, its presence. */
|
|
50
|
+
answer: (connection: RealtimeConnection, publish: Record<string, unknown>) => Promise<RelayedAnswer>;
|
|
51
|
+
/** How long a replica waits for the one holding the token, in ms: past it, nobody does. */
|
|
52
|
+
waitMs?: number;
|
|
53
|
+
};
|
|
36
54
|
export type RealtimeHub = ReturnType<typeof createRealtimeHub>;
|
|
37
55
|
/**
|
|
38
56
|
* This process's connections, and the ONE adapter subscription per topic they share.
|
|
@@ -40,10 +58,15 @@ export type RealtimeHub = ReturnType<typeof createRealtimeHub>;
|
|
|
40
58
|
* A hundred pages on one board are a hundred connections here and a single subscription to the adapter: a message
|
|
41
59
|
* arrives once and is written to each of them. The last one to leave a topic unsubscribes it.
|
|
42
60
|
*/
|
|
43
|
-
export declare const createRealtimeHub: (pubsub: PubSubAdapter, retained: RealtimeRetained, presence?: RealtimePresence) => {
|
|
61
|
+
export declare const createRealtimeHub: (pubsub: PubSubAdapter, retained: RealtimeRetained, presence?: RealtimePresence, relay?: HubRelay) => {
|
|
44
62
|
publish: (space: RealtimeSpace, message: RealtimeMessage) => Promise<void>;
|
|
45
63
|
from: (connection: RealtimeConnection, topic: string, type: string, data: unknown, echo?: boolean) => RealtimeMessage;
|
|
46
64
|
find: (token: string) => RealtimeConnection | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* A publish whose connection this replica does not hold, asked of the replica that does — answered as it answers its
|
|
67
|
+
* own — or `undefined` when none answers within the wait (no such connection anywhere, or no relay).
|
|
68
|
+
*/
|
|
69
|
+
ask: (token: string, publish: Record<string, unknown>) => Promise<RelayedAnswer | undefined>;
|
|
47
70
|
/**
|
|
48
71
|
* Lets go of `topic` every connection, on every replica, that opened it with `grant` — or with any grant, naming
|
|
49
72
|
* none. What stops a grant that is already in use; `grants.revoke` is what stops it being used again.
|
package/dist/realtime/index.mjs
CHANGED
|
@@ -89,14 +89,70 @@ var parse$1 = (raw) => {
|
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
};
|
|
92
|
+
/** Every replica's: a publish whose connection the replica it reached does not hold. */
|
|
93
|
+
var RELAY_REQUESTS = "$relay:publish";
|
|
94
|
+
/** One replica's own: the answers to what it asked. */
|
|
95
|
+
var relayReplies = (instance) => `$relay:answers:${instance}`;
|
|
96
|
+
var RELAY_WAIT_MS = 1500;
|
|
97
|
+
/** A connection's token as `connectionFor` makes it: 24 bytes, base64url. Anything else is asked of nobody. */
|
|
98
|
+
var TOKEN = /^[A-Za-z0-9_-]{32}$/;
|
|
99
|
+
var isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
100
|
+
var parseJson = (raw) => {
|
|
101
|
+
try {
|
|
102
|
+
return JSON.parse(raw);
|
|
103
|
+
} catch {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
var relayRequestOf = (raw) => {
|
|
108
|
+
const value = parseJson(raw);
|
|
109
|
+
return isRecord$1(value) && typeof value.id === "string" && typeof value.replyTo === "string" && typeof value.token === "string" && isRecord$1(value.publish) ? {
|
|
110
|
+
id: value.id,
|
|
111
|
+
replyTo: value.replyTo,
|
|
112
|
+
token: value.token,
|
|
113
|
+
publish: value.publish
|
|
114
|
+
} : void 0;
|
|
115
|
+
};
|
|
116
|
+
var relayReplyOf = (raw) => {
|
|
117
|
+
const value = parseJson(raw);
|
|
118
|
+
if (!isRecord$1(value) || typeof value.id !== "string" || !isRecord$1(value.answer)) return;
|
|
119
|
+
const { status, error, reason } = value.answer;
|
|
120
|
+
return typeof status === "number" ? {
|
|
121
|
+
id: value.id,
|
|
122
|
+
answer: {
|
|
123
|
+
status,
|
|
124
|
+
...typeof error === "string" ? { error } : {},
|
|
125
|
+
...typeof reason === "string" ? { reason } : {}
|
|
126
|
+
}
|
|
127
|
+
} : void 0;
|
|
128
|
+
};
|
|
92
129
|
/**
|
|
93
130
|
* This process's connections, and the ONE adapter subscription per topic they share.
|
|
94
131
|
*
|
|
95
132
|
* A hundred pages on one board are a hundred connections here and a single subscription to the adapter: a message
|
|
96
133
|
* arrives once and is written to each of them. The last one to leave a topic unsubscribes it.
|
|
97
134
|
*/
|
|
98
|
-
var createRealtimeHub = (pubsub, retained, presence) => {
|
|
135
|
+
var createRealtimeHub = (pubsub, retained, presence, relay) => {
|
|
99
136
|
const byToken = /* @__PURE__ */ new Map();
|
|
137
|
+
const instance = randomUUID();
|
|
138
|
+
/** What this replica asked another, by the request's id, until it is answered or the wait runs out. */
|
|
139
|
+
const asked = /* @__PURE__ */ new Map();
|
|
140
|
+
const subscribed = (topic, listener) => pubsub.subscribe(topic, listener).catch((error) => {
|
|
141
|
+
warnRealtime(`the relay of publishes between replicas could not listen on ${topic}`)(error);
|
|
142
|
+
return () => Promise.resolve();
|
|
143
|
+
});
|
|
144
|
+
const relaying = relay ? [subscribed(RELAY_REQUESTS, (raw) => {
|
|
145
|
+
const request = relayRequestOf(raw);
|
|
146
|
+
const connection = request ? byToken.get(request.token) : void 0;
|
|
147
|
+
if (!request || !connection) return;
|
|
148
|
+
relay.answer(connection, request.publish).then((answer) => pubsub.publish(relayReplies(request.replyTo), JSON.stringify({
|
|
149
|
+
id: request.id,
|
|
150
|
+
answer
|
|
151
|
+
}))).catch(warnRealtime("a publish relayed from another replica was not answered"));
|
|
152
|
+
}), subscribed(relayReplies(instance), (raw) => {
|
|
153
|
+
const reply = relayReplyOf(raw);
|
|
154
|
+
if (reply) asked.get(reply.id)?.(reply.answer);
|
|
155
|
+
})] : [];
|
|
100
156
|
/** The presence topics a connection is counted on: those of a `presence: true` channel, for a page that is not watching. */
|
|
101
157
|
const counted = (connection) => connection.observer ? [] : [...connection.topics].flatMap(([topic, declaration]) => declaration.presence ? [topic] : []);
|
|
102
158
|
const memberOf = (connection) => ({
|
|
@@ -191,6 +247,34 @@ var createRealtimeHub = (pubsub, retained, presence) => {
|
|
|
191
247
|
from,
|
|
192
248
|
find: (token) => byToken.get(token),
|
|
193
249
|
/**
|
|
250
|
+
* A publish whose connection this replica does not hold, asked of the replica that does — answered as it answers its
|
|
251
|
+
* own — or `undefined` when none answers within the wait (no such connection anywhere, or no relay).
|
|
252
|
+
*/
|
|
253
|
+
ask: async (token, publish) => {
|
|
254
|
+
if (!relay || !TOKEN.test(token)) return;
|
|
255
|
+
await Promise.all(relaying);
|
|
256
|
+
const id = randomUUID();
|
|
257
|
+
return new Promise((resolve) => {
|
|
258
|
+
const done = (answer) => {
|
|
259
|
+
clearTimeout(timer);
|
|
260
|
+
asked.delete(id);
|
|
261
|
+
resolve(answer);
|
|
262
|
+
};
|
|
263
|
+
const timer = setTimeout(() => done(void 0), relay.waitMs ?? RELAY_WAIT_MS);
|
|
264
|
+
timer.unref();
|
|
265
|
+
asked.set(id, done);
|
|
266
|
+
pubsub.publish(RELAY_REQUESTS, JSON.stringify({
|
|
267
|
+
id,
|
|
268
|
+
replyTo: instance,
|
|
269
|
+
token,
|
|
270
|
+
publish
|
|
271
|
+
})).catch((error) => {
|
|
272
|
+
warnRealtime("a publish could not be relayed to the replica holding its connection")(error);
|
|
273
|
+
done(void 0);
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
},
|
|
277
|
+
/**
|
|
194
278
|
* Lets go of `topic` every connection, on every replica, that opened it with `grant` — or with any grant, naming
|
|
195
279
|
* none. What stops a grant that is already in use; `grants.revoke` is what stops it being used again.
|
|
196
280
|
*/
|
|
@@ -237,6 +321,8 @@ var createRealtimeHub = (pubsub, retained, presence) => {
|
|
|
237
321
|
*/
|
|
238
322
|
closeAll: () => {
|
|
239
323
|
clearInterval(heartbeat);
|
|
324
|
+
asked.forEach((done) => done(void 0));
|
|
325
|
+
Promise.all(relaying).then((releases) => Promise.all(releases.map((release) => release()))).catch(warnRealtime("the relay between replicas was not let go"));
|
|
240
326
|
[...byToken.values()].forEach((connection) => connection.end());
|
|
241
327
|
},
|
|
242
328
|
/** How many connections this process holds — for tests and for a health endpoint. */
|
|
@@ -597,7 +683,8 @@ var parseBody = (body) => {
|
|
|
597
683
|
var handleRealtimePublish = async ({ req, res, hub }) => {
|
|
598
684
|
const body = parseBody(req.body);
|
|
599
685
|
const connection = typeof body?.token === "string" ? hub.find(body.token) : void 0;
|
|
600
|
-
|
|
686
|
+
const result = body ? connection ? await publishFrom(hub, connection, body) : typeof body.token === "string" ? await hub.ask(body.token, { ...body }) : void 0 : void 0;
|
|
687
|
+
if (!result) {
|
|
601
688
|
answer(res, {
|
|
602
689
|
status: 401,
|
|
603
690
|
error: "Not connected: open /_realtime first and publish with its token",
|
|
@@ -605,7 +692,6 @@ var handleRealtimePublish = async ({ req, res, hub }) => {
|
|
|
605
692
|
});
|
|
606
693
|
return;
|
|
607
694
|
}
|
|
608
|
-
const result = await publishFrom(hub, connection, body);
|
|
609
695
|
if (result.status === 204) {
|
|
610
696
|
res.setStatus(204);
|
|
611
697
|
res.send("");
|
|
@@ -741,7 +827,7 @@ var createRealtimeModule = (options) => {
|
|
|
741
827
|
const kv = options.kv ?? createMemoryKv();
|
|
742
828
|
const retained = createRealtimeRetained(kv);
|
|
743
829
|
const presence = createRealtimePresence(kv);
|
|
744
|
-
const hub = createRealtimeHub(options.pubsub ?? createMemoryPubSub(), retained, presence);
|
|
830
|
+
const hub = createRealtimeHub(options.pubsub ?? createMemoryPubSub(), retained, presence, { answer: (connection, publish) => publishFrom(hub, connection, publish) });
|
|
745
831
|
const resolveChannels = createChannelResolver(options.getOfflineData);
|
|
746
832
|
const grants = createRealtimeGrants(kv);
|
|
747
833
|
let jobLookup;
|
package/dist/render/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Resolving a page's server element that names an action or a connector (
|
|
2
|
+
* Resolving a page's server element that names an action or a connector (docs/en/server-packages.md): in this process, over the
|
|
3
3
|
* engine (`createActionResolver`, what `createPageEngine` hands a page server), or on a worker (`createRemoteRenderResolver`,
|
|
4
4
|
* what `engineOnWorker({ render })` hands one that runs nothing).
|
|
5
5
|
*/
|
package/dist/render/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { n as RENDER_PATH, r as RENDER_PROTOCOL, a as createActionResolver, t as createRemoteRenderResolver } from "../chunks/remote-
|
|
1
|
+
export { n as RENDER_PATH, r as RENDER_PROTOCOL, a as createActionResolver, t as createRemoteRenderResolver } from "../chunks/remote-Cm3IDERi.mjs";
|
package/dist/render/remote.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type RemoteRenderOptions = {
|
|
|
6
6
|
secret: string;
|
|
7
7
|
};
|
|
8
8
|
/**
|
|
9
|
-
* A page's server elements resolved on a worker (
|
|
9
|
+
* A page's server elements resolved on a worker (docs/en/server-packages.md): each one asked at `/_render`, so this page server runs
|
|
10
10
|
* no action and no connector, and imports nothing of the engine to run. Handed to it with `engineOnWorker({ render })`.
|
|
11
11
|
*
|
|
12
12
|
* What fed the element comes back with its data — the runs, for a page that debugs — and a failure comes back as one:
|
package/dist/worker/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { handleRealtimePublish, handleRealtimeSocket, handleRealtimeSubscribe, realtimeModuleFor } from "../realtime/index.mjs";
|
|
2
|
-
import { a as createActionResolver, i as readRenderAsk, n as RENDER_PATH, t as createRemoteRenderResolver } from "../chunks/remote-
|
|
3
|
-
import { F as readKeptCall, P as keepCall, R as writeConnectorRecord, S as ACTIONS_FLEET_STORES, h as precheckRun, t as createActionsModule } from "../chunks/module-
|
|
2
|
+
import { a as createActionResolver, i as readRenderAsk, n as RENDER_PATH, t as createRemoteRenderResolver } from "../chunks/remote-Cm3IDERi.mjs";
|
|
3
|
+
import { F as readKeptCall, P as keepCall, R as writeConnectorRecord, S as ACTIONS_FLEET_STORES, h as precheckRun, t as createActionsModule } from "../chunks/module-HDpOahhW.mjs";
|
|
4
4
|
import { a as triggerParams, i as findTriggerNode, t as ActionRunError } from "../chunks/errors-bCBfIe7c.mjs";
|
|
5
|
-
import { r as createConnectorResolver, t as describeCatalog } from "../chunks/taskCatalog-
|
|
6
|
-
import { t as isFunctionsDefinition } from "../chunks/load-
|
|
5
|
+
import { r as createConnectorResolver, t as describeCatalog } from "../chunks/taskCatalog-DBVODJX7.mjs";
|
|
6
|
+
import { t as isFunctionsDefinition } from "../chunks/load-DTPs5l0C.mjs";
|
|
7
7
|
import { privateOriginsOf } from "@plitzi/sdk-kernel/outbound";
|
|
8
8
|
import { isConnectorManifestDraft, validateConnectorManifest } from "@plitzi/sdk-shared/connectors";
|
|
9
9
|
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
@@ -1412,7 +1412,7 @@ var createRealtimeStage = (realtime) => async (ctx) => {
|
|
|
1412
1412
|
};
|
|
1413
1413
|
// src/worker/pageEngine.ts
|
|
1414
1414
|
/**
|
|
1415
|
-
* The actions engine as a page server is handed it (
|
|
1415
|
+
* The actions engine as a page server is handed it (docs/en/server-packages.md, D11): the actions module, the realtime channels and the
|
|
1416
1416
|
* connectors' writes, each built once from the engine's own configuration — `action`, `functions`, `connectors`,
|
|
1417
1417
|
* `realtime` — and nothing of the page server's. Undefined when there is nothing of the engine to run.
|
|
1418
1418
|
*
|
|
@@ -1633,7 +1633,7 @@ var notFoundStage = ({ res }) => {
|
|
|
1633
1633
|
return true;
|
|
1634
1634
|
};
|
|
1635
1635
|
/**
|
|
1636
|
-
* The actions engine as a server of its own (
|
|
1636
|
+
* The actions engine as a server of its own (docs/en/server-packages.md, D8): `/_action` and its webhooks, `/fn/` routes, `/_realtime` and
|
|
1637
1637
|
* the job queue, on `@plitzi/sdk-kernel` alone — nothing of pages, RSC or signing in. It resolves the host's
|
|
1638
1638
|
* deployment and who is calling with the same adapters a page server is given, so a gateway may send those paths of a
|
|
1639
1639
|
* space's host here, beside the page servers or on another machine.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { EngineServerConfig } from '../types';
|
|
2
2
|
import { PageEngine } from '@plitzi/sdk-kernel/engine';
|
|
3
3
|
/**
|
|
4
|
-
* The actions engine as a page server is handed it (
|
|
4
|
+
* The actions engine as a page server is handed it (docs/en/server-packages.md, D11): the actions module, the realtime channels and the
|
|
5
5
|
* connectors' writes, each built once from the engine's own configuration — `action`, `functions`, `connectors`,
|
|
6
6
|
* `realtime` — and nothing of the page server's. Undefined when there is nothing of the engine to run.
|
|
7
7
|
*
|
package/dist/worker/worker.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export type WorkerConfig = Omit<EngineServerConfig, 'adapters'> & {
|
|
|
27
27
|
forward?: (spaceId: number) => string | undefined;
|
|
28
28
|
};
|
|
29
29
|
/**
|
|
30
|
-
* The actions engine as a server of its own (
|
|
30
|
+
* The actions engine as a server of its own (docs/en/server-packages.md, D8): `/_action` and its webhooks, `/fn/` routes, `/_realtime` and
|
|
31
31
|
* the job queue, on `@plitzi/sdk-kernel` alone — nothing of pages, RSC or signing in. It resolves the host's
|
|
32
32
|
* deployment and who is calling with the same adapters a page server is given, so a gateway may send those paths of a
|
|
33
33
|
* space's host here, beside the page servers or on another machine.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plitzi/sdk-actions",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.4",
|
|
4
4
|
"license": "AGPL-3.0",
|
|
5
5
|
"description": "The actions engine: server actions, a space's functions and runtimes as the platform holds them, the connectors, realtime, jobs, and the stock queues and stores. What a worker runs; what a page server is handed.",
|
|
6
6
|
"files": [
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"build:prod": "vite build"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@plitzi/sdk-kernel": "0.39.
|
|
41
|
-
"@plitzi/sdk-shared": "0.39.
|
|
40
|
+
"@plitzi/sdk-kernel": "0.39.4",
|
|
41
|
+
"@plitzi/sdk-shared": "0.39.4",
|
|
42
42
|
"nodemailer": "^10.4.0",
|
|
43
43
|
"ws": "^8.22.2"
|
|
44
44
|
},
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@plitzi/sdk-runtime": "0.39.
|
|
62
|
+
"@plitzi/sdk-runtime": "0.39.4",
|
|
63
63
|
"@types/node": "^26.6.6",
|
|
64
64
|
"@types/nodemailer": "^8.0.2",
|
|
65
65
|
"@types/ws": "^8.18.2",
|