@astrale-os/kernel-server 0.5.0-beta.73 → 0.5.0-beta.75

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 (84) hide show
  1. package/dist/index.d.ts +1 -6
  2. package/dist/index.js +0 -5
  3. package/dist/invocation/index.d.ts +1 -1
  4. package/dist/invocation/index.js +1 -1
  5. package/dist/invocation/release-route.d.ts +3 -7
  6. package/dist/invocation/release-route.js +4 -27
  7. package/dist/invocation/types.d.ts +2 -14
  8. package/dist/issuer/routes.js +28 -47
  9. package/dist/release/delivery/handler.d.ts +1 -5
  10. package/dist/release/delivery/handler.js +8 -29
  11. package/dist/release/delivery/index.d.ts +0 -1
  12. package/dist/release/delivery/index.js +1 -1
  13. package/dist/release/delivery/types.d.ts +3 -13
  14. package/dist/release/served.d.ts +6 -15
  15. package/dist/release/served.js +3 -7
  16. package/dist/release/snapshot.d.ts +2 -6
  17. package/dist/release/snapshot.js +2 -7
  18. package/dist/release/types.d.ts +1 -11
  19. package/dist/routes/address.d.ts +2 -0
  20. package/dist/routes/address.js +6 -0
  21. package/dist/routes/binary.d.ts +9 -0
  22. package/dist/routes/binary.js +110 -0
  23. package/dist/routes/bundle.d.ts +5 -0
  24. package/dist/routes/bundle.js +50 -0
  25. package/dist/routes/csrf.d.ts +16 -0
  26. package/dist/routes/csrf.js +35 -0
  27. package/dist/routes/document.d.ts +6 -0
  28. package/dist/routes/document.js +57 -0
  29. package/dist/routes/index.d.ts +3 -1
  30. package/dist/routes/index.js +2 -1
  31. package/dist/routes/model.d.ts +15 -0
  32. package/dist/routes/native.d.ts +17 -0
  33. package/dist/routes/native.js +126 -0
  34. package/dist/routes/preflight.d.ts +4 -0
  35. package/dist/routes/preflight.js +55 -0
  36. package/dist/routes/response.d.ts +14 -0
  37. package/dist/routes/response.js +33 -0
  38. package/dist/routes/routes.d.ts +5 -24
  39. package/dist/routes/routes.js +19 -625
  40. package/dist/routes/snapshot.d.ts +13 -0
  41. package/dist/routes/snapshot.js +39 -0
  42. package/dist/routes/stream.d.ts +6 -0
  43. package/dist/routes/stream.js +122 -0
  44. package/dist/server.js +12 -30
  45. package/dist/transport/http/binary.d.ts +6 -0
  46. package/dist/transport/http/binary.js +35 -0
  47. package/dist/transport/http/byte-stream.d.ts +4 -0
  48. package/dist/transport/http/byte-stream.js +123 -0
  49. package/dist/transport/http/control.d.ts +12 -0
  50. package/dist/transport/http/control.js +24 -0
  51. package/dist/transport/http/handler.d.ts +1 -1
  52. package/dist/transport/http/handler.js +4 -2
  53. package/dist/transport/http/index.d.ts +3 -1
  54. package/dist/transport/http/index.js +2 -1
  55. package/dist/transport/http/model.d.ts +20 -0
  56. package/dist/transport/http/model.js +1 -0
  57. package/dist/transport/http/render.d.ts +3 -36
  58. package/dist/transport/http/render.js +16 -412
  59. package/dist/transport/http/response.d.ts +14 -0
  60. package/dist/transport/http/response.js +77 -0
  61. package/dist/transport/http/stream.d.ts +5 -0
  62. package/dist/transport/http/stream.js +134 -0
  63. package/dist/transport/index.d.ts +2 -1
  64. package/dist/transport/index.js +2 -1
  65. package/dist/transport/result.d.ts +13 -0
  66. package/dist/transport/result.js +35 -0
  67. package/dist/transport/websocket/session.d.ts +1 -1
  68. package/dist/transport/websocket/session.js +3 -3
  69. package/dist/types.d.ts +13 -16
  70. package/package.json +5 -13
  71. package/dist/invocation/legacy/index.d.ts +0 -20
  72. package/dist/invocation/legacy/index.js +0 -20
  73. package/dist/invocation/legacy/publication-route.d.ts +0 -16
  74. package/dist/invocation/legacy/publication-route.js +0 -39
  75. package/dist/release/legacy/delivery.d.ts +0 -18
  76. package/dist/release/legacy/delivery.js +0 -2
  77. package/dist/release/legacy/index.d.ts +0 -39
  78. package/dist/release/legacy/index.js +0 -38
  79. package/dist/release/legacy/snapshot.d.ts +0 -26
  80. package/dist/release/legacy/snapshot.js +0 -55
  81. package/dist/release/legacy/table.d.ts +0 -5
  82. package/dist/release/legacy/table.js +0 -16
  83. package/dist/release/legacy/types.d.ts +0 -31
  84. /package/dist/{release/legacy/types.js → routes/model.js} +0 -0
@@ -1,8 +1,9 @@
1
+ export { renderBinary, renderRedirect } from './result.js';
1
2
  export { byteLength, readBoundedBody } from './body.js';
2
3
  export { loadCodecs, type LoadedCodec } from './codecs.js';
3
4
  export { resolveCredential, type CredentialResult } from './credential.js';
4
5
  export { createHttpHandler, type HttpHandlerConfig } from './http/index.js';
5
- export { encodeEnvelope, renderBinary, renderHttpError, renderHttpResult, renderHttpStale, renderRedirect, type CorsHeaders, type ErrorRenderOptions, type RenderContext, } from './http/index.js';
6
+ export { renderHttpError, renderHttpResult, renderHttpStale, type CorsHeaders, type ErrorRenderOptions, type RenderContext, } from './http/index.js';
6
7
  export { interruptedStreamError } from './stream-error.js';
7
8
  export { createServerRouter, type ServerRouter } from './router.js';
8
9
  export { createWebSocketSession, handleWebSocketUpgrade, type WebSocketHandlerConfig, type WebSocketSessionConfig, } from './websocket/index.js';
@@ -1,8 +1,9 @@
1
+ export { renderBinary, renderRedirect } from './result.js';
1
2
  export { byteLength, readBoundedBody } from './body.js';
2
3
  export { loadCodecs } from './codecs.js';
3
4
  export { resolveCredential } from './credential.js';
4
5
  export { createHttpHandler } from './http/index.js';
5
- export { encodeEnvelope, renderBinary, renderHttpError, renderHttpResult, renderHttpStale, renderRedirect, } from './http/index.js';
6
+ export { renderHttpError, renderHttpResult, renderHttpStale, } from './http/index.js';
6
7
  export { interruptedStreamError } from './stream-error.js';
7
8
  export { createServerRouter } from './router.js';
8
9
  export { createWebSocketSession, handleWebSocketUpgrade, } from './websocket/index.js';
@@ -0,0 +1,13 @@
1
+ import type { BufferedBinaryResult, StreamingBinaryResult } from '@astrale-os/kernel-core/callable';
2
+ import * as protocol from '@astrale-os/kernel-protocol/invocation';
3
+ import type { HandlerResult } from '../invocation/index.js';
4
+ /** Admit one buffered binary result into the shared Invocation envelope. */
5
+ export declare function renderBinary(requestId: protocol.RequestId, invocation: protocol.InvocationId, binary: BufferedBinaryResult): protocol.BinaryResponse;
6
+ /** Admit a semantic redirect without selecting an HTTP or WebSocket binding. */
7
+ export declare function renderRedirect(requestId: protocol.RequestId, invocation: protocol.InvocationId, redirect: Extract<HandlerResult, {
8
+ readonly kind: 'redirect';
9
+ }>['redirect']): protocol.RedirectResponse;
10
+ /** Identify a binary producer whose lifetime stays with its transport. */
11
+ export declare function isStreamingBinary(input: Extract<HandlerResult, {
12
+ readonly kind: 'binary';
13
+ }>['value']): input is StreamingBinaryResult;
@@ -0,0 +1,35 @@
1
+ import * as protocol from '@astrale-os/kernel-protocol/invocation';
2
+ import { HTTP_ROUTE_MISS, HTTP_ROUTE_STALE } from '@astrale-os/kernel-protocol/routes';
3
+ /** Admit one buffered binary result into the shared Invocation envelope. */
4
+ export function renderBinary(requestId, invocation, binary) {
5
+ const reserved = Object.keys(binary.headers ?? {}).find((name) => {
6
+ const normalized = name.toLowerCase();
7
+ return (normalized === protocol.http.INVOCATION_FIELD ||
8
+ normalized === HTTP_ROUTE_STALE ||
9
+ normalized === HTTP_ROUTE_MISS);
10
+ });
11
+ if (reserved !== undefined)
12
+ throw new TypeError(`${reserved} is reserved by Protocol.`);
13
+ return protocol.decodeBinaryResponse({
14
+ kind: 'binary',
15
+ requestId,
16
+ invocation,
17
+ body: binary.body,
18
+ mediaType: binary.mediaType,
19
+ status: binary.status ?? 200,
20
+ ...(binary.headers === undefined ? {} : { headers: binary.headers }),
21
+ });
22
+ }
23
+ /** Admit a semantic redirect without selecting an HTTP or WebSocket binding. */
24
+ export function renderRedirect(requestId, invocation, redirect) {
25
+ return protocol.decodeRedirectResponse({
26
+ kind: 'redirect',
27
+ requestId,
28
+ invocation,
29
+ redirect,
30
+ });
31
+ }
32
+ /** Identify a binary producer whose lifetime stays with its transport. */
33
+ export function isStreamingBinary(input) {
34
+ return !(input.body instanceof Uint8Array);
35
+ }
@@ -13,7 +13,7 @@ export interface WebSocketSessionConfig {
13
13
  readonly maximumRequestBytes: number;
14
14
  readonly maximumResponseBytes: number;
15
15
  readonly invocationTimeoutMs: number;
16
- /** Present exactly when the Server serves a release or a Publication; bound to the upgrade. */
16
+ /** Present exactly when the Server serves a Release; bound to the upgrade. */
17
17
  readonly serving?: RequestServing;
18
18
  readonly host?: ApplicationHost;
19
19
  }
@@ -1,13 +1,13 @@
1
1
  import * as errors from '@astrale-os/kernel-protocol/errors';
2
2
  import * as protocol from '@astrale-os/kernel-protocol/invocation';
3
- import { deploymentRetiredBody } from '@astrale-os/kernel-protocol/routes/deployment-retired';
3
+ import { deploymentRetiredBody } from '@astrale-os/kernel-protocol/routes';
4
4
  import { admissionRefusal, classifyError, classifyRequestError } from '../../errors/index.js';
5
5
  import { ResponseBodyTooLargeError } from '../../errors/index.js';
6
6
  import { admitVia, invocationContext, } from '../../invocation/index.js';
7
7
  import { pinned } from '../../release/served.js';
8
8
  import { byteLength } from '../body.js';
9
9
  import { resolveCredential } from '../credential.js';
10
- import { isStreamingBinary, renderBinary, renderRedirect } from '../http/render.js';
10
+ import { isStreamingBinary, renderBinary, renderRedirect } from '../result.js';
11
11
  import { interruptedStreamError } from '../stream-error.js';
12
12
  const WS_OPEN = 1;
13
13
  /** Build one socket-pinned transport session. */
@@ -107,7 +107,7 @@ export function createWebSocketSession(config) {
107
107
  if (serving !== undefined && served === undefined) {
108
108
  await sendError(socket, admittedCodec, envelope.requestId, assigned, {
109
109
  code: errors.CODES.BACKEND_UNAVAILABLE,
110
- message: `${serving.kind === 'release' ? 'Release' : 'Publication'} is unavailable.`,
110
+ message: 'Release is unavailable.',
111
111
  }, sendOutput);
112
112
  return;
113
113
  }
package/dist/types.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import type { CorsConfig } from './cors/index.js';
2
2
  import type { Handler, InvocationSource } from './invocation/index.js';
3
- import type { exchange, Issuer } from './issuer/index.js';
3
+ import type { Context as ExchangeContext, Provider as ExchangeProvider } from './issuer/exchange.js';
4
+ import type { Issuer } from './issuer/index.js';
4
5
  import type { Provider as DeliveryProvider } from './release/delivery/index.js';
5
6
  import type { ReleaseSource } from './release/index.js';
6
- import type { PublicationSource } from './release/legacy/index.js';
7
7
  import type { Application, WebSocketAdapter } from './transport/index.js';
8
8
  export interface ServerLimits {
9
9
  readonly maximumRequestBytes: number;
@@ -13,8 +13,8 @@ export interface ServerLimits {
13
13
  readonly maximumResponseBytes?: number;
14
14
  /** Maximum Server-owned active operations across all mounted protocol surfaces. */
15
15
  readonly maximumConcurrentOperations?: number;
16
- /** Maximum bytes of each served discovery document (`release.json` and `domain.json`). */
17
- readonly maximumPublicationBytes?: number;
16
+ /** Maximum bytes of each served discovery document (`release.json`). */
17
+ readonly maximumReleaseBytes?: number;
18
18
  readonly maximumBundleBytes?: number;
19
19
  readonly maximumDeliveryBytes?: number;
20
20
  /** Maximum lifetime of one invocation, including a returned stream. */
@@ -54,18 +54,11 @@ export interface ServerOptions {
54
54
  /** Present only for the configured self issuer; owns verification and signing. */
55
55
  readonly tokenExchange?: exchange.Provider;
56
56
  /**
57
- * The release this deployment serves: `release.json`, its frozen v3 projection at `domain.json`,
58
- * its bundle, Delivery v1 and v2, and its native routes; routed calls are admitted only for this
59
- * exact release. At most one of `release` and `publication`; with neither, the Server serves no
60
- * document and admits no routed call.
57
+ * Exact release, bundle, Delivery v2 and native routes served by this deployment. With no
58
+ * source the Server serves no document and admits no routed call.
61
59
  */
62
60
  readonly release?: ReleaseSource;
63
- /** @deprecated Use `release`. Publication sources allow ETag and Schema drift when routing. */
64
- readonly publication?: PublicationSource;
65
- /**
66
- * Required exactly when the current release or Publication advertises delivery. With `release`
67
- * it must answer Delivery v2 and v1; a v1-only provider fits only `publication`.
68
- */
61
+ /** Required exactly when the current release advertises Delivery. */
69
62
  readonly delivery?: DeliveryProvider;
70
63
  readonly websocket?: WebSocketAdapter;
71
64
  }
@@ -85,8 +78,12 @@ export interface Server {
85
78
  export type { CorsConfig } from './cors/index.js';
86
79
  export type { InvocationSource } from './invocation/index.js';
87
80
  export type { ApplicationHost, ExecutionControl, Handler, HandlerRequest, HandlerResult, HandlerStream, InvocationContext, RequestBackground, RequestEvidence, RequestSleep, } from './invocation/index.js';
88
- export type { exchange, Issuer } from './issuer/index.js';
81
+ /** Public token-exchange provider contract; transport capture and mounting stay private. */
82
+ export declare namespace exchange {
83
+ type Context = ExchangeContext;
84
+ type Provider = ExchangeProvider;
85
+ }
86
+ export type { Issuer } from './issuer/index.js';
89
87
  export type { Provider as DeliveryProvider } from './release/delivery/index.js';
90
88
  export type { ReleaseSnapshot, ReleaseSnapshotInput, ReleaseSource } from './release/index.js';
91
- export type { PublicationSnapshot, PublicationSnapshotInput, PublicationSource, } from './release/legacy/index.js';
92
89
  export type { Application, WebSocketAdapter, WebSocketHandlers, WebSocketLike, WebSocketUpgradeOptions, } from './transport/index.js';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@astrale-os/kernel-server",
3
- "version": "0.5.0-beta.73",
4
- "description": "Portable HTTP and WebSocket boundary for Astrale invocation, publication, installation, and issuer protocols",
3
+ "version": "0.5.0-beta.75",
4
+ "description": "Portable HTTP and WebSocket boundary for Astrale invocation, Release, installation, and issuer protocols",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
7
7
  "type": "git",
@@ -19,23 +19,15 @@
19
19
  "types": "./dist/index.d.ts",
20
20
  "import": "./dist/index.js"
21
21
  },
22
- "./publication/snapshot": {
23
- "types": "./dist/release/legacy/snapshot.d.ts",
24
- "import": "./dist/release/legacy/snapshot.js"
25
- },
26
- "./server": {
27
- "types": "./dist/server.d.ts",
28
- "import": "./dist/server.js"
29
- },
30
22
  "./package.json": "./package.json"
31
23
  },
32
24
  "publishConfig": {
33
25
  "access": "public"
34
26
  },
35
27
  "dependencies": {
36
- "@astrale-os/kernel-core": "0.9.0-beta.65",
37
- "@astrale-os/kernel-dsl": "0.2.0-beta.47",
38
- "@astrale-os/kernel-protocol": "0.5.0-beta.71",
28
+ "@astrale-os/kernel-core": "0.9.0-beta.67",
29
+ "@astrale-os/kernel-dsl": "0.2.0-beta.49",
30
+ "@astrale-os/kernel-protocol": "0.5.0-beta.73",
39
31
  "hono": "^4.6.20"
40
32
  },
41
33
  "devDependencies": {
@@ -1,20 +0,0 @@
1
- /**
2
- * Routed admission at a v3-input destination: #508 same-schema and schema-drift continuity
3
- * (`publicationRouteDecision`) admits a `PublicationVia` whose ETag or Schema differs from the
4
- * served Publication while origin and issuer stay equal, so a legacy stable Worker keeps serving
5
- * the installations made before the release snapshot with its latest code (Routage [.57929]). It
6
- * applies only to a Server built from a v2/v3 Publication, never to a release snapshot.
7
- *
8
- * @deprecated Use `releaseRouteDecision` and `releaseProjectionRouteDecision`
9
- * (`../release-route.ts`), which admit only the exact served release or its exact projection and
10
- * answer every other relation with DEPLOYMENT_RETIRED.
11
- *
12
- * Short-term consumers: the v3-input destinations of `server/release/legacy/` (legacy direct-mode
13
- * Workers, SDK Workers without a bound build digest, the Host's intrinsic publishers).
14
- *
15
- * Removal, in the separate breaking release that deletes `server/release/legacy/`, under its
16
- * condition. Then delete this folder, its laws (SV-PUBLICATION-CONTINUITY,
17
- * SV-PUBLICATION-ADMITS-LEGACY-VIA) and the `publication` branch of `admitVia`
18
- * (`../release-route.ts`).
19
- */
20
- export { publicationRouteDecision, type PublicationRouteDecision } from './publication-route.js';
@@ -1,20 +0,0 @@
1
- /**
2
- * Routed admission at a v3-input destination: #508 same-schema and schema-drift continuity
3
- * (`publicationRouteDecision`) admits a `PublicationVia` whose ETag or Schema differs from the
4
- * served Publication while origin and issuer stay equal, so a legacy stable Worker keeps serving
5
- * the installations made before the release snapshot with its latest code (Routage [.57929]). It
6
- * applies only to a Server built from a v2/v3 Publication, never to a release snapshot.
7
- *
8
- * @deprecated Use `releaseRouteDecision` and `releaseProjectionRouteDecision`
9
- * (`../release-route.ts`), which admit only the exact served release or its exact projection and
10
- * answer every other relation with DEPLOYMENT_RETIRED.
11
- *
12
- * Short-term consumers: the v3-input destinations of `server/release/legacy/` (legacy direct-mode
13
- * Workers, SDK Workers without a bound build digest, the Host's intrinsic publishers).
14
- *
15
- * Removal, in the separate breaking release that deletes `server/release/legacy/`, under its
16
- * condition. Then delete this folder, its laws (SV-PUBLICATION-CONTINUITY,
17
- * SV-PUBLICATION-ADMITS-LEGACY-VIA) and the `publication` branch of `admitVia`
18
- * (`../release-route.ts`).
19
- */
20
- export { publicationRouteDecision } from './publication-route.js';
@@ -1,16 +0,0 @@
1
- import type { ErrorPayload } from '@astrale-os/kernel-protocol/errors';
2
- import type { Publication } from '@astrale-os/kernel-protocol/publication/publication';
3
- import type { PublicationRef } from '@astrale-os/kernel-protocol/publication/reference';
4
- /** @deprecated Successor: `RouteDecision`, which also answers a retired deployment. */
5
- export type PublicationRouteDecision = {
6
- readonly kind: 'admitted';
7
- } | {
8
- readonly kind: 'rejected';
9
- readonly error: ErrorPayload;
10
- };
11
- /**
12
- * Accept ETag or Schema changes only while origin and issuer remain equal.
13
- *
14
- * @deprecated Use `releaseRouteDecision` or `releaseProjectionRouteDecision` for exact release admission.
15
- */
16
- export declare function publicationRouteDecision(current: Publication, installed: PublicationRef): PublicationRouteDecision;
@@ -1,39 +0,0 @@
1
- import { CODES } from '@astrale-os/kernel-protocol/errors';
2
- import { SERVICE_TRUST_REQUIRED } from '@astrale-os/kernel-protocol/invocation/service-reason';
3
- import { compareReference } from '@astrale-os/kernel-protocol/publication/reference';
4
- /**
5
- * Accept ETag or Schema changes only while origin and issuer remain equal.
6
- *
7
- * @deprecated Use `releaseRouteDecision` or `releaseProjectionRouteDecision` for exact release admission.
8
- */
9
- export function publicationRouteDecision(current, installed) {
10
- switch (compareReference(current, installed)) {
11
- case 'exact':
12
- case 'same-schema':
13
- case 'schema-drift':
14
- return Object.freeze({ kind: 'admitted' });
15
- case 'identity-drift':
16
- return rejected('Installed Domain Service identity requires explicit trust.', Object.freeze({
17
- code: SERVICE_TRUST_REQUIRED,
18
- details: Object.freeze({
19
- origin: installed.origin,
20
- installedIssuer: installed.identity.issuer,
21
- candidateIssuer: current.identity.issuer,
22
- }),
23
- }));
24
- case 'origin-drift':
25
- return Object.freeze({
26
- kind: 'rejected',
27
- error: Object.freeze({
28
- code: CODES.INVALID_REQUEST,
29
- message: 'Routed Publication origin differs from the served Domain.',
30
- }),
31
- });
32
- }
33
- }
34
- function rejected(message, data) {
35
- return Object.freeze({
36
- kind: 'rejected',
37
- error: Object.freeze({ code: CODES.CONFLICT, message, data }),
38
- });
39
- }
@@ -1,18 +0,0 @@
1
- import type * as release from '@astrale-os/kernel-protocol/release';
2
- import type { Context as DeliveryContext } from '../delivery/types.js';
3
- /** @deprecated Successor: `release.delivery.Context`, the same retrieval context. */
4
- export type Context = DeliveryContext;
5
- /**
6
- * The Delivery v1 provider of a v3-input destination, which only ever receives v1 requests. It
7
- * remains assignable to `release.delivery.Provider`, so existing providers keep configuring a
8
- * Server unchanged. Pass it only with `ServerOptions.publication`: a release-backed destination
9
- * also passes Delivery v2 requests, which this provider cannot answer.
10
- *
11
- * @deprecated Successor: `release.delivery.Provider`, which answers a v2 request over the release
12
- * and a v1 request over its frozen v3 projection.
13
- */
14
- export interface Provider {
15
- create(request: release.legacy.delivery.Request, context: Context): Promise<release.legacy.delivery.Delivery>;
16
- }
17
- /** @deprecated Successor: `release.delivery.handleDelivery`, which serves both snapshots. */
18
- export { handleDelivery, type Limits } from '../delivery/handler.js';
@@ -1,2 +0,0 @@
1
- /** @deprecated Successor: `release.delivery.handleDelivery`, which serves both snapshots. */
2
- export { handleDelivery } from '../delivery/handler.js';
@@ -1,39 +0,0 @@
1
- /**
2
- * The Publication snapshot of a v3-input destination: a Server built from a v2/v3 Publication
3
- * serves `domain.json`, its bundle, Delivery v1 and its native routes exactly as before the release
4
- * snapshot, and keeps the #508 same-schema and schema-drift continuity
5
- * (`server/invocation/legacy/publication-route.ts`). Its answers are pinned byte for byte by the
6
- * golden transcript of `server/__tests__/transcripts.test.ts`.
7
- *
8
- * @deprecated Use `ServerOptions.release` with `prepareReleaseSnapshot`, which serves a
9
- * `DomainRelease` at `release.json` beside its frozen v3 projection at `domain.json` and admits
10
- * only exact routing.
11
- *
12
- * Short-term consumers:
13
- * - the legacy direct-mode Workers built by an SDK that seals v2/v3 only: the domains platform
14
- * Domains, Shell, the Services `development` environment and `ui:domain`, until they serve
15
- * releases;
16
- * - an SDK Worker whose deployment host binds no build digest, which serves today's v3 document;
17
- * - the Host's intrinsic Kernel and Host Domain publishers (`host/kernel/publication/`) and the
18
- * FalkorDB qualification remote Domain, until the Host serves its intrinsic release.
19
- *
20
- * Removal, in a separate breaking release: the conditions of `protocol/release/legacy/index.ts`
21
- * hold (no stable Worker serves a v2/v3 document, no installation pins one), no supported SDK
22
- * builds a v3-input Worker, and the intrinsic Kernel and Host Domains serve a release. Then
23
- * delete, in the same PR:
24
- * - this folder with its `.spec` (its v1-only Delivery `Provider` included), the `publication`
25
- * namespace, `preparePublicationSnapshot` and the Publication snapshot types of
26
- * `server/index.ts` and `server/.spec/api.d.ts`, and the `./publication/snapshot` subpath
27
- * (source and `dist`) of `server/package.json`;
28
- * - `ServerOptions.publication` (`server/types.ts`) and `HandlerRequest.publication`
29
- * (`server/invocation/types.ts`), with the `publication` branch of `Served`
30
- * (`server/release/served.ts`) and every `kind === 'publication'` branch it selects in
31
- * `server/routes/routes.ts`, `server/release/delivery/handler.ts` and `admitVia`;
32
- * - `server/invocation/legacy/` (laws SV-PUBLICATION-CONTINUITY, SV-PUBLICATION-ADMITS-LEGACY-VIA);
33
- * - the golden transcript that records a v3-input server, keeping the one of a server without a
34
- * source.
35
- */
36
- export { preparePublicationSnapshot, readPreparedPublicationSnapshot, type PreparedPublicationSnapshot, } from './snapshot.js';
37
- export type { PublicationSnapshot, PublicationSnapshotInput, PublicationSource } from './types.js';
38
- /** @deprecated The Delivery v1 boundary of a v3-input destination; use `release.delivery`. */
39
- export * as delivery from './delivery.js';
@@ -1,38 +0,0 @@
1
- /**
2
- * The Publication snapshot of a v3-input destination: a Server built from a v2/v3 Publication
3
- * serves `domain.json`, its bundle, Delivery v1 and its native routes exactly as before the release
4
- * snapshot, and keeps the #508 same-schema and schema-drift continuity
5
- * (`server/invocation/legacy/publication-route.ts`). Its answers are pinned byte for byte by the
6
- * golden transcript of `server/__tests__/transcripts.test.ts`.
7
- *
8
- * @deprecated Use `ServerOptions.release` with `prepareReleaseSnapshot`, which serves a
9
- * `DomainRelease` at `release.json` beside its frozen v3 projection at `domain.json` and admits
10
- * only exact routing.
11
- *
12
- * Short-term consumers:
13
- * - the legacy direct-mode Workers built by an SDK that seals v2/v3 only: the domains platform
14
- * Domains, Shell, the Services `development` environment and `ui:domain`, until they serve
15
- * releases;
16
- * - an SDK Worker whose deployment host binds no build digest, which serves today's v3 document;
17
- * - the Host's intrinsic Kernel and Host Domain publishers (`host/kernel/publication/`) and the
18
- * FalkorDB qualification remote Domain, until the Host serves its intrinsic release.
19
- *
20
- * Removal, in a separate breaking release: the conditions of `protocol/release/legacy/index.ts`
21
- * hold (no stable Worker serves a v2/v3 document, no installation pins one), no supported SDK
22
- * builds a v3-input Worker, and the intrinsic Kernel and Host Domains serve a release. Then
23
- * delete, in the same PR:
24
- * - this folder with its `.spec` (its v1-only Delivery `Provider` included), the `publication`
25
- * namespace, `preparePublicationSnapshot` and the Publication snapshot types of
26
- * `server/index.ts` and `server/.spec/api.d.ts`, and the `./publication/snapshot` subpath
27
- * (source and `dist`) of `server/package.json`;
28
- * - `ServerOptions.publication` (`server/types.ts`) and `HandlerRequest.publication`
29
- * (`server/invocation/types.ts`), with the `publication` branch of `Served`
30
- * (`server/release/served.ts`) and every `kind === 'publication'` branch it selects in
31
- * `server/routes/routes.ts`, `server/release/delivery/handler.ts` and `admitVia`;
32
- * - `server/invocation/legacy/` (laws SV-PUBLICATION-CONTINUITY, SV-PUBLICATION-ADMITS-LEGACY-VIA);
33
- * - the golden transcript that records a v3-input server, keeping the one of a server without a
34
- * source.
35
- */
36
- export { preparePublicationSnapshot, readPreparedPublicationSnapshot, } from './snapshot.js';
37
- /** @deprecated The Delivery v1 boundary of a v3-input destination; use `release.delivery`. */
38
- export * as delivery from './delivery.js';
@@ -1,26 +0,0 @@
1
- import type { Domain } from '@astrale-os/kernel-dsl/v1';
2
- import type * as publication from '@astrale-os/kernel-protocol/publication';
3
- import type { Table } from '@astrale-os/kernel-protocol/routes/legacy';
4
- import type { PublicationSnapshot, PublicationSnapshotInput } from './types.js';
5
- /** @deprecated Successor: `PreparedReleaseSnapshot`. */
6
- export interface PreparedPublicationSnapshot {
7
- readonly kind: 'publication';
8
- readonly snapshot: PublicationSnapshot;
9
- readonly publication: publication.Publication;
10
- readonly publicationBytes: Uint8Array;
11
- readonly bundle: Uint8Array;
12
- readonly table: Table;
13
- readonly domain: Domain;
14
- }
15
- /**
16
- * Admit and detach one revision-coherent serving snapshot.
17
- *
18
- * @deprecated Use `prepareReleaseSnapshot` to serve a release and its v3 projection.
19
- */
20
- export declare function preparePublicationSnapshot(input: PublicationSnapshotInput): PublicationSnapshot;
21
- /**
22
- * Internal proof that a PublicationSource returned a Server-prepared snapshot without cloning it.
23
- *
24
- * @deprecated Successor: `readPreparedReleaseSnapshot`.
25
- */
26
- export declare function readPreparedPublicationSnapshot(input: unknown): PreparedPublicationSnapshot | undefined;
@@ -1,55 +0,0 @@
1
- import { bundleUrl } from '@astrale-os/kernel-protocol/publication';
2
- import { verifyBundleBytes } from '@astrale-os/kernel-protocol/publication/bundle-evidence';
3
- import { accept as acceptPublication, encode as encodePublication, } from '@astrale-os/kernel-protocol/publication/publication';
4
- import { admitTable } from './table.js';
5
- const snapshots = new WeakMap();
6
- /**
7
- * Admit and detach one revision-coherent serving snapshot.
8
- *
9
- * @deprecated Use `prepareReleaseSnapshot` to serve a release and its v3 projection.
10
- */
11
- export function preparePublicationSnapshot(input) {
12
- if (input === null || typeof input !== 'object' || !(input.bundle instanceof Uint8Array)) {
13
- throw new TypeError('Publication snapshot input is invalid.');
14
- }
15
- const admittedPublication = acceptPublication(input.publication);
16
- const bundleBytes = new Uint8Array(input.bundle);
17
- verifyBundleBytes(admittedPublication, bundleBytes);
18
- const domain = input.domain;
19
- if (domain.origin !== admittedPublication.origin ||
20
- domain.revision !== admittedPublication.schema.revision) {
21
- throw new TypeError('Publication snapshot Domain identity differs from its Publication.');
22
- }
23
- const table = admitTable(admittedPublication, input.table, domain);
24
- const addressed = new URL(bundleUrl(admittedPublication.identity.issuer, admittedPublication.schema.bundle.ref));
25
- const addressedDirectory = addressed.pathname.slice(0, addressed.pathname.lastIndexOf('/') + 1);
26
- const servingBundle = new URL(admittedPublication.schema.bundle.href);
27
- if (servingBundle.origin === addressed.origin &&
28
- servingBundle.pathname.startsWith(addressedDirectory) &&
29
- servingBundle.href !== addressed.href) {
30
- throw new TypeError('Publication bundle URL differs from its artifact digest.');
31
- }
32
- const publicationBytes = encodePublication(admittedPublication);
33
- const snapshot = Object.freeze({ publication: admittedPublication });
34
- const prepared = Object.freeze({
35
- kind: 'publication',
36
- snapshot,
37
- publication: admittedPublication,
38
- publicationBytes,
39
- bundle: bundleBytes,
40
- table,
41
- domain,
42
- });
43
- snapshots.set(snapshot, prepared);
44
- return snapshot;
45
- }
46
- /**
47
- * Internal proof that a PublicationSource returned a Server-prepared snapshot without cloning it.
48
- *
49
- * @deprecated Successor: `readPreparedReleaseSnapshot`.
50
- */
51
- export function readPreparedPublicationSnapshot(input) {
52
- if (input === null || typeof input !== 'object')
53
- return undefined;
54
- return snapshots.get(input);
55
- }
@@ -1,5 +0,0 @@
1
- import type { Domain } from '@astrale-os/kernel-dsl/v1';
2
- import type * as publication from '@astrale-os/kernel-protocol/publication';
3
- import { type Table } from '@astrale-os/kernel-protocol/routes/legacy';
4
- /** @deprecated Use `admitTable` in `server/release/table.ts` for release-bound routes. */
5
- export declare function admitTable(deployed: publication.Publication, input: Table | undefined, domain: Domain): Table;
@@ -1,16 +0,0 @@
1
- import { reference } from '@astrale-os/kernel-protocol/publication/reference';
2
- import { acceptTable, verifyTable } from '@astrale-os/kernel-protocol/routes/legacy';
3
- /** @deprecated Use `admitTable` in `server/release/table.ts` for release-bound routes. */
4
- export function admitTable(deployed, input, domain) {
5
- if (input === undefined) {
6
- if (deployed.routes.length !== 0) {
7
- throw new TypeError('A Publication with native routes requires a Route Table.');
8
- }
9
- return verifyTable(Object.freeze({
10
- publication: reference(deployed),
11
- entries: Object.freeze([]),
12
- }), deployed, domain);
13
- }
14
- const table = acceptTable(input);
15
- return verifyTable(table, deployed, domain);
16
- }
@@ -1,31 +0,0 @@
1
- import type { Domain } from '@astrale-os/kernel-dsl/v1';
2
- import type * as publication from '@astrale-os/kernel-protocol/publication';
3
- import type { Table } from '@astrale-os/kernel-protocol/routes/legacy';
4
- declare const PUBLICATION_SNAPSHOT: unique symbol;
5
- /** @deprecated Successor: `ReleaseSnapshotInput`, which serves a `DomainRelease`. */
6
- export interface PublicationSnapshotInput {
7
- readonly publication: publication.Publication;
8
- /** Exact artifact served at Publication.schema.bundle.href. */
9
- readonly bundle: Uint8Array;
10
- readonly table?: Table;
11
- readonly domain: Domain;
12
- }
13
- /**
14
- * Immutable admitted serving identity; bundle and compiled routes remain Server-private.
15
- *
16
- * @deprecated Successor: `ReleaseSnapshot`, which serves a `DomainRelease` and its v3 projection.
17
- */
18
- export interface PublicationSnapshot {
19
- readonly publication: publication.Publication;
20
- readonly [PUBLICATION_SNAPSHOT]: true;
21
- }
22
- /**
23
- * Atomically readable source swapped only after a complete snapshot is prepared.
24
- *
25
- * @deprecated Successor: `ReleaseSource`.
26
- */
27
- export interface PublicationSource {
28
- /** Undefined until the first revision-coherent snapshot is ready. */
29
- current(): PublicationSnapshot | undefined;
30
- }
31
- export {};