@cyaxis/ulvia 1.0.1 → 1.0.2

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 (2) hide show
  1. package/dist/index.js +51 -19
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -27186,19 +27186,27 @@ var init_cacheGeneration = __esm(() => {
27186
27186
  // packages/foundation/http-runner/src/core/compression/content.ts
27187
27187
  var {CryptoHasher, gzipSync } = globalThis.Bun;
27188
27188
  import { brotliCompressSync } from "zlib";
27189
- function compress(raw, contentType) {
27189
+ function compress(raw, contentType, codecs = CODECS) {
27190
27190
  const rawBytes = typeof raw === "string" ? new TextEncoder().encode(raw) : new Uint8Array(raw);
27191
- const brotliResult = brotliCompressSync(rawBytes);
27191
+ let brotli;
27192
+ let gzip;
27192
27193
  const hash = new CryptoHasher("sha256").update(rawBytes).digest("hex").slice(0, 10);
27193
27194
  return {
27194
27195
  raw: rawBytes,
27195
- brotli: new Uint8Array(brotliResult.buffer, brotliResult.byteOffset, brotliResult.byteLength),
27196
- gzip: new Uint8Array(gzipSync(rawBytes)),
27196
+ get brotli() {
27197
+ return brotli ??= new Uint8Array(codecs.brotli(rawBytes));
27198
+ },
27199
+ get gzip() {
27200
+ return gzip ??= new Uint8Array(codecs.gzip(rawBytes));
27201
+ },
27197
27202
  contentType,
27198
27203
  hash
27199
27204
  };
27200
27205
  }
27201
- var init_content = () => {};
27206
+ var CODECS;
27207
+ var init_content = __esm(() => {
27208
+ CODECS = { brotli: brotliCompressSync, gzip: (bytes) => gzipSync(new Uint8Array(bytes)) };
27209
+ });
27202
27210
 
27203
27211
  // packages/foundation/http-runner/src/core/buildCspContent.ts
27204
27212
  var init_buildCspContent = () => {};
@@ -27213,15 +27221,6 @@ var init_response2 = __esm(() => {
27213
27221
  init_cacheGeneration();
27214
27222
  init_headers();
27215
27223
  });
27216
-
27217
- // packages/foundation/http-runner/src/core/compression.ts
27218
- var init_compression = __esm(() => {
27219
- init_cacheGeneration();
27220
- init_content();
27221
- init_headers();
27222
- init_response2();
27223
- });
27224
-
27225
27224
  // packages/foundation/http-runner/src/core/byteRanges.ts
27226
27225
  function parseContentRange(value) {
27227
27226
  const match = /^bytes (\d+)-(\d+)\/(\d+)$/u.exec(value ?? "");
@@ -27231,6 +27230,18 @@ function parseContentRange(value) {
27231
27230
  return match && [start, end, size].every(Number.isSafeInteger) && start >= 0 && end >= start && end < size ? { start, end, size } : null;
27232
27231
  }
27233
27232
 
27233
+ // packages/foundation/http-runner/src/core/compression/streaming.ts
27234
+ var init_streaming = () => {};
27235
+
27236
+ // packages/foundation/http-runner/src/core/compression.ts
27237
+ var init_compression = __esm(() => {
27238
+ init_cacheGeneration();
27239
+ init_content();
27240
+ init_headers();
27241
+ init_response2();
27242
+ init_streaming();
27243
+ });
27244
+
27234
27245
  // packages/foundation/http-runner/src/exports/index.ts
27235
27246
  var init_exports2 = __esm(() => {
27236
27247
  init_BunRunner();
@@ -30356,8 +30367,8 @@ function localEdgeEnvironment(_instance, config, connection, services, image, pr
30356
30367
  }
30357
30368
 
30358
30369
  // packages/runtimes/ulvia-cli/src/runtime/stack/version.ts
30359
- var injectedCliVersion = "1.0.1";
30360
- var injectedStackVersion = "1.0.4";
30370
+ var injectedCliVersion = "1.0.2";
30371
+ var injectedStackVersion = "1.0.5";
30361
30372
  var CLI_VERSION = injectedCliVersion ?? "development";
30362
30373
  var DEFAULT_STACK_VERSION = injectedStackVersion ?? "unbundled";
30363
30374
  function defaultStackVersion() {
@@ -31078,6 +31089,9 @@ function toRecord(entry) {
31078
31089
  };
31079
31090
  }
31080
31091
 
31092
+ // packages/runtimes/ulvia-cli/src/runtime/stack/logs/OperatorObservabilityClient.ts
31093
+ init_compatibility();
31094
+
31081
31095
  // packages/features/cms-repository/src/providers/installations/core/errors.ts
31082
31096
  class ProviderInstallationValidationError extends TypeError {
31083
31097
  code;
@@ -31469,9 +31483,11 @@ function parseResourceMetadata(value) {
31469
31483
  throw new TypeError("Invalid resource metadata");
31470
31484
  }
31471
31485
  const record = value;
31472
- if (Object.keys(record).sort().join() !== "headers,status" || !STATUSES.has(Number(record.status)) || typeof record.status !== "number" || !record.headers || typeof record.headers !== "object" || Array.isArray(record.headers)) {
31486
+ if (Object.keys(record).some((key) => !["headers", "status", "vary", "cacheTags"].includes(key)) || !STATUSES.has(Number(record.status)) || typeof record.status !== "number" || !record.headers || typeof record.headers !== "object" || Array.isArray(record.headers)) {
31473
31487
  throw new TypeError("Invalid resource metadata");
31474
31488
  }
31489
+ const vary = boundedList(record.vary, 3, (value) => ["accept", "accept-language", "accept-encoding"].includes(value));
31490
+ const cacheTags = boundedList(record.cacheTags, 32, (value) => /^[a-z0-9][a-z0-9:._-]{0,127}$/u.test(value));
31475
31491
  const headers = {};
31476
31492
  for (const [name, content] of Object.entries(record.headers)) {
31477
31493
  if (!HEADERS.has(name) || typeof content !== "string" || content.length > 2048 || /[\x00-\x1f\x7f]/u.test(content)) {
@@ -31498,7 +31514,12 @@ function parseResourceMetadata(value) {
31498
31514
  if (headers["content-length"] !== undefined && !/^(?:0|[1-9][0-9]{0,14})$/u.test(headers["content-length"])) {
31499
31515
  throw new TypeError("Invalid resource length");
31500
31516
  }
31501
- return Object.freeze({ status: record.status, headers: Object.freeze(headers) });
31517
+ return Object.freeze({
31518
+ status: record.status,
31519
+ headers: Object.freeze(headers),
31520
+ ...vary ? { vary: Object.freeze(vary) } : {},
31521
+ ...cacheTags ? { cacheTags: Object.freeze(cacheTags) } : {}
31522
+ });
31502
31523
  }
31503
31524
  function decodeResourceMetadata(header) {
31504
31525
  if (header === null) {
@@ -31509,6 +31530,15 @@ function decodeResourceMetadata(header) {
31509
31530
  }
31510
31531
  return parseResourceMetadata(JSON.parse(header));
31511
31532
  }
31533
+ function boundedList(value, maximum, valid) {
31534
+ if (value === undefined) {
31535
+ return;
31536
+ }
31537
+ if (!Array.isArray(value) || value.length > maximum || new Set(value).size !== value.length || value.some((item) => typeof item !== "string" || !valid(item))) {
31538
+ throw new TypeError("Invalid resource cache metadata");
31539
+ }
31540
+ return [...value];
31541
+ }
31512
31542
 
31513
31543
  // packages/features/cms-gateway/src/invocation/http/response/validate.ts
31514
31544
  init_schema();
@@ -31897,6 +31927,7 @@ class HttpGatewayTransport {
31897
31927
  const firstByteTimeout = setTimeout(() => abort.abort(new DOMException("Provider first byte timed out", "TimeoutError")), this.#timeoutMs);
31898
31928
  const exchange = {
31899
31929
  ...prepared,
31930
+ ...request.onDispatch ? { onDispatch: request.onDispatch } : {},
31900
31931
  ...request.authorityReads ? { authorityReads: request.authorityReads } : {},
31901
31932
  requestId: request.requestId,
31902
31933
  installationId: request.installationId,
@@ -32471,6 +32502,7 @@ class NodeGatewayHttpNetwork {
32471
32502
  const addresses = await withAbort(() => (this.#options.resolveAddresses ?? defaultResolveAddresses)(hostname), request.signal);
32472
32503
  const address = selectGatewayAddress(origin, addresses, this.#options.allowPrivateAddresses);
32473
32504
  const authorization = await withAbort(() => this.#authorization(request), request.signal);
32505
+ request.onDispatch?.();
32474
32506
  return (this.#options.sendPinned ?? sendPinnedHttpRequest)({
32475
32507
  url,
32476
32508
  address,
@@ -32691,7 +32723,7 @@ class OperatorObservabilityClient {
32691
32723
  }
32692
32724
  const report = parseProviderRuntimeReportJson(JSON.stringify(await readResponse(response)));
32693
32725
  const control = report.implementations.find((item) => item.contractId === "ulvia.cms.installations" && item.status === "ready");
32694
- if (report.instanceId !== this.instanceId || !control || !["1.0.0", "1.1.0"].includes(control.version)) {
32726
+ if (report.instanceId !== this.instanceId || !control || !isCanonicalSemVer(control.version) || !satisfiesVersionRange(control.version, "^1.0.0")) {
32695
32727
  throw new Error("Local Provider control contract does not match the instance");
32696
32728
  }
32697
32729
  return control.version;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyaxis/ulvia",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Ulvia CMS installation and release CLI.",
5
5
  "license": "MIT",
6
6
  "type": "module",