@void/platform 1.1.11 → 1.1.12

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/dist/index.d.mts CHANGED
@@ -432,15 +432,25 @@ type PlatformDiscoveryDocument = Readonly<{
432
432
  capabilities: PlatformCapabilities;
433
433
  displayName: string;
434
434
  dashboardUrl?: string;
435
+ /**
436
+ * The API accepts Worker modules uploaded to R2 through
437
+ * `POST /projects/:id/deploy/worker-upload-urls`. Older platforms omit it.
438
+ */
439
+ directWorkerUpload?: boolean;
435
440
  installationId: string | null;
436
441
  platformVersion: string;
437
442
  proxyUrl: string;
438
443
  schemaVersion: typeof PLATFORM_DISCOVERY_SCHEMA_VERSION | 2 | 3;
439
444
  usageProtocolVersion: 0 | 1 | 2;
440
445
  }>;
441
- export declare function createPlatformDiscoveryDocument(input: Omit<PlatformDiscoveryDocument, "schemaVersion" | "usageProtocolVersion"> & {
446
+ type PlatformDiscoveryInput = Omit<PlatformDiscoveryDocument, "directWorkerUpload" | "schemaVersion" | "usageProtocolVersion"> & {
442
447
  usageProtocolVersion?: 0 | 1 | 2;
443
- }): PlatformDiscoveryDocument;
448
+ };
449
+ /**
450
+ * Builds the document a platform serves at `/.well-known/void-platform`.
451
+ * Every platform built from this source accepts direct Worker uploads.
452
+ */
453
+ export declare function createPlatformDiscoveryDocument(input: PlatformDiscoveryInput): PlatformDiscoveryDocument;
444
454
  export declare function parsePlatformDiscoveryDocument(value: unknown): PlatformDiscoveryDocument;
445
455
  //#endregion
446
456
  //#region src/worker-config.d.ts
package/dist/index.mjs CHANGED
@@ -1005,7 +1005,17 @@ function normalizeOrigin(value, name) {
1005
1005
  if (url.pathname !== "" && url.pathname !== "/" || url.search || url.hash) throw new Error(`${name} must be an origin without a path, query, or fragment.`);
1006
1006
  return url.origin;
1007
1007
  }
1008
+ /**
1009
+ * Builds the document a platform serves at `/.well-known/void-platform`.
1010
+ * Every platform built from this source accepts direct Worker uploads.
1011
+ */
1008
1012
  function createPlatformDiscoveryDocument(input) {
1013
+ return {
1014
+ ...normalizeDiscoveryDocument(input),
1015
+ directWorkerUpload: true
1016
+ };
1017
+ }
1018
+ function normalizeDiscoveryDocument(input) {
1009
1019
  if (!input.displayName.trim()) throw new Error("displayName must not be empty.");
1010
1020
  if (!input.platformVersion.trim()) throw new Error("platformVersion must not be empty.");
1011
1021
  if (input.applicationRouting) {
@@ -1069,7 +1079,9 @@ function parsePlatformDiscoveryDocument(value) {
1069
1079
  };
1070
1080
  const apiUrl = string("apiUrl");
1071
1081
  const proxyUrl = string("proxyUrl");
1072
- return createPlatformDiscoveryDocument({
1082
+ const directWorkerUpload = document.directWorkerUpload;
1083
+ if (directWorkerUpload !== void 0 && typeof directWorkerUpload !== "boolean") throw new Error("directWorkerUpload must be a boolean.");
1084
+ const parsed = normalizeDiscoveryDocument({
1073
1085
  apiUrl,
1074
1086
  applicationDomain: string("applicationDomain"),
1075
1087
  ...document.applicationRouting !== void 0 ? { applicationRouting: parsePlatformApplication(document.applicationRouting) } : {},
@@ -1083,6 +1095,10 @@ function parsePlatformDiscoveryDocument(value) {
1083
1095
  proxyUrl,
1084
1096
  usageProtocolVersion: parseUsageProtocolVersion(document.usageProtocolVersion)
1085
1097
  });
1098
+ return directWorkerUpload === void 0 ? parsed : {
1099
+ ...parsed,
1100
+ directWorkerUpload
1101
+ };
1086
1102
  }
1087
1103
  function parseAuthentication(value) {
1088
1104
  const authentication = record(value, "Authentication discovery");