@astrale-os/adapter-cloudflare 0.5.0-beta.191 → 0.5.0-beta.193

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/README.md CHANGED
@@ -95,8 +95,9 @@ Every line is readable. Namespace mode is a thin layer over the hosting kit belo
95
95
  key while the script exists, and the call target `{ kind: 'namespace', namespace, script }`. Its
96
96
  state is `active`, `retiring` (tombstoned, script not deleted yet), `retired` (script deleted) or
97
97
  `failed` (activated, script gone).
98
- - **Refused.** A direct-mode parameter beside `namespace` (`route`, `workerName`, `identityIssuer`,
99
- `addressing`, `signingIdentity`), a `router.binding` other than `ROUTER`, and any `wrangler` key
98
+ - **Refused.** A removed direct-mode parameter (`route`, `workerName`, `identityIssuer`,
99
+ `addressing`, `signingIdentity`), any `router` key but `service`, `hostSuffix` and `minLabels`
100
+ (the binding is always `ROUTER`), and any `wrangler` key
100
101
  but `services`, `dispatch_namespaces` and `compatibility_flags`, `triggers` first: an immutable
101
102
  deployment runs no cron of its own. A `dispatch_namespaces` entry is exactly
102
103
  `{ binding, namespace }`; it is frozen into the configuration (`bindings.dispatchNamespaces`), so
@@ -40,7 +40,7 @@ export async function admitWorkerBundle(path) {
40
40
  export async function admitDurableEngineBundle(path) {
41
41
  admitCompiledWasm();
42
42
  const engine = (await import(`${pathToFileURL(path).href}?admit=${Date.now()}`));
43
- if (['createEndpointHandler', 'workflow', 'TerminalError', 'CancelledError'].some((key) => typeof engine[key] !== 'function')) {
43
+ if (['createEndpointHandler', 'workflow', 'TerminalError', 'CancelledError', 'TimeoutError'].some((key) => typeof engine[key] !== 'function')) {
44
44
  throw new TypeError('Generated durable engine bundle does not export the platform Fetch entrypoint.');
45
45
  }
46
46
  }
@@ -76,7 +76,7 @@ export async function prepareExecution(input) {
76
76
  if (declaresDurable(input.context.build)) {
77
77
  await bundle('restate', RELEASE_RESTATE,
78
78
  // Wrangler requires a default export to classify an independently bundled ESM entry.
79
- `export { createEndpointHandler, workflow, TerminalError, CancelledError } from ${JSON.stringify(restateModuleSpecifier())}\nexport default {}\n`, admitDurableEngineBundle);
79
+ `export { createEndpointHandler, workflow, TerminalError, CancelledError, TimeoutError } from ${JSON.stringify(restateModuleSpecifier())}\nexport default {}\n`, admitDurableEngineBundle);
80
80
  }
81
81
  const sourcePath = join(input.directory, 'worker.gen.ts');
82
82
  const frontend = generatedMaterial(input.context.build).material.frontend;
@@ -2,6 +2,7 @@ import { spawn } from 'node:child_process';
2
2
  import { existsSync, readFileSync } from 'node:fs';
3
3
  import { createRequire } from 'node:module';
4
4
  import { dirname, join, resolve } from 'node:path';
5
+ import { StringDecoder } from 'node:string_decoder';
5
6
  export function wranglerCommand(projectDir, runtime = {
6
7
  executable: process.execPath,
7
8
  bun: process.versions.bun !== undefined,
@@ -41,6 +42,8 @@ export function runCapture(cmd, args, cwd, onLog, signal, redact = (input) => in
41
42
  let stdout = '';
42
43
  let stderr = '';
43
44
  let outputBytes = 0;
45
+ // One decoder per stream: a chunk can end inside a multi-byte UTF-8 character.
46
+ const decoders = { stdout: new StringDecoder('utf8'), stderr: new StringDecoder('utf8') };
44
47
  let terminating;
45
48
  const timeout = setTimeout(() => terminate(new Error('Wrangler process timed out.')), 300_000);
46
49
  const abort = () => terminate(new Error('Wrangler process cancelled.'));
@@ -68,7 +71,7 @@ export function runCapture(cmd, args, cwd, onLog, signal, redact = (input) => in
68
71
  terminate(new Error('Wrangler process exceeded its output limit.'));
69
72
  return;
70
73
  }
71
- const chunk = buffer.toString();
74
+ const chunk = decoders[stream].write(buffer);
72
75
  out += chunk;
73
76
  if (stream === 'stdout')
74
77
  stdout += chunk;
@@ -82,6 +85,14 @@ export function runCapture(cmd, args, cwd, onLog, signal, redact = (input) => in
82
85
  if (terminating !== undefined)
83
86
  reject(terminating);
84
87
  else {
88
+ for (const stream of ['stdout', 'stderr']) {
89
+ const rest = decoders[stream].end();
90
+ out += rest;
91
+ if (stream === 'stdout')
92
+ stdout += rest;
93
+ else
94
+ stderr += rest;
95
+ }
85
96
  const safe = redact(out);
86
97
  for (const line of safe.split('\n'))
87
98
  if (line.trim())
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrale-os/adapter-cloudflare",
3
- "version": "0.5.0-beta.191",
3
+ "version": "0.5.0-beta.193",
4
4
  "description": "Deploy an Astrale Domain through Cloudflare Workers",
5
5
  "keywords": [
6
6
  "adapter",
@@ -61,7 +61,7 @@
61
61
  "registry": "https://registry.npmjs.org/"
62
62
  },
63
63
  "dependencies": {
64
- "@astrale-os/sdk": "0.6.0-beta.36",
64
+ "@astrale-os/sdk": "0.6.0-beta.38",
65
65
  "@noble/hashes": "2.3.0",
66
66
  "@restatedev/restate-sdk-cloudflare-workers": "1.17.0",
67
67
  "hono": "^4.6.20",