c8y-nitro 0.10.0 → 0.10.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.
@@ -1,4 +1,4 @@
1
- import { n as name, r as version, t as description } from "../package-CX0mgzB-.mjs";
1
+ import { n as name, r as version, t as description } from "../package-CNi0saSw.mjs";
2
2
  import { defineCommand, runMain } from "citty";
3
3
  //#region src/cli/index.ts
4
4
  const main = defineCommand({
@@ -265,6 +265,7 @@ function useUserClient(requestOrEvent) {
265
265
  const headers = convertRequestHeadersToC8yFormat(request);
266
266
  const auth = new MicroserviceClientRequestAuth(headers);
267
267
  const client = new Client(auth, process.env.C8Y_BASEURL);
268
+ client.core.defaultHeaders["X-Forwarded-Host"] = request.headers.get("x-forwarded-host") ?? process.env.C8Y_BASEURL;
268
269
  request.context ??= {};
269
270
  request.context["c8y_user_client"] = client;
270
271
  return client;
@@ -381,6 +381,12 @@ interface C8YZipOptions {
381
381
  * @default './'
382
382
  */
383
383
  outputDir?: string;
384
+ /**
385
+ * ZIP DEFLATE compression level used for `image.tar` and `cumulocity.json`.
386
+ * Valid values are 1 (faster, larger) to 9 (slower, smaller).
387
+ * @default 6
388
+ */
389
+ compressionLevel?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
384
390
  /**
385
391
  * Configuration of the "cumulocity.json" manifest file used for the zip.
386
392
  */
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as C8yNitroModuleOptions } from "./index-DHd7xpBX.mjs";
1
+ import { n as C8yNitroModuleOptions } from "./index-BEFoDy-y.mjs";
2
2
  import { t as TenantCredentials } from "./credentials-eKnJ7m9Y.mjs";
3
3
  import { NitroModule } from "nitro/types";
4
4
  //#region src/index.d.ts
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { a as GENERATED_INVALIDATE_TENANT_OPTIONS_ROUTE, i as C8Y_NITRO_TYPES_FILE, n as createC8yManifestFromNitro, o as GENERATED_LIVENESS_ROUTE, r as C8Y_NITRO_TYPES_DIR, s as GENERATED_READINESS_ROUTE, t as createC8yManifest } from "./manifest-DV3UW9Dl.mjs";
2
2
  import { t as writeAPIClient } from "./apiClient-kxv5KHYJ.mjs";
3
3
  import { t as autoBootstrap } from "./autoBootstrap-DUjHuHe_.mjs";
4
- import { n as name } from "./package-CX0mgzB-.mjs";
4
+ import { n as name } from "./package-CNi0saSw.mjs";
5
5
  import { basename, join, resolve } from "node:path";
6
6
  import { copyFile, mkdir, writeFile } from "node:fs/promises";
7
7
  import { x } from "tinyexec";
@@ -159,9 +159,11 @@ async function createC8yZip(nitro, options = {}, dockerOptions = {}) {
159
159
  const zip = new JSZip();
160
160
  zip.file("image.tar", imageTarBuffer);
161
161
  zip.file("cumulocity.json", JSON.stringify(manifest, null, 2));
162
+ const compressionLevel = options.compressionLevel ?? 6;
162
163
  const zipBuffer = await zip.generateAsync({
163
164
  type: "nodebuffer",
164
- compression: "STORE"
165
+ compression: "DEFLATE",
166
+ compressionOptions: { level: compressionLevel }
165
167
  });
166
168
  const outputFile = resolveZipOutputPath(nitro.options.rootDir, options, manifest);
167
169
  const outputDir = join$1(outputFile, "..");
@@ -1,6 +1,6 @@
1
1
  //#region package.json
2
2
  var name = "c8y-nitro";
3
- var version = "0.10.0";
3
+ var version = "0.10.2";
4
4
  var description = "Lightning fast Cumulocity IoT microservice development powered by Nitro";
5
5
  //#endregion
6
6
  export { name as n, version as r, description as t };
@@ -1,5 +1,5 @@
1
1
  import { t as createError } from "../../logging-BUYT8Z2V.mjs";
2
- import { t as useDeployedTenantClient } from "../../client-BjA5bBxj.mjs";
2
+ import { t as useDeployedTenantClient } from "../../client-CT8zR8b-.mjs";
3
3
  import { c8yTenantOptionKeys } from "c8y-nitro/runtime";
4
4
  import { defineCachedFunction } from "nitro/cache";
5
5
  import { useRuntimeConfig } from "nitro/runtime-config";
@@ -1,4 +1,4 @@
1
- import { r as tryGetUserTenantDomainFast } from "../../client-BjA5bBxj.mjs";
1
+ import { r as tryGetUserTenantDomainFast } from "../../client-CT8zR8b-.mjs";
2
2
  import { c8yManifest } from "c8y-nitro/runtime";
3
3
  import { useRuntimeConfig } from "nitro/runtime-config";
4
4
  import { getRequestURL } from "nitro/h3";
@@ -1,4 +1,4 @@
1
- import { n as buildPublicRequestUrl, r as tryGetUserTenantDomainFast } from "../../client-BjA5bBxj.mjs";
1
+ import { n as buildPublicRequestUrl, r as tryGetUserTenantDomainFast } from "../../client-CT8zR8b-.mjs";
2
2
  import { c8yManifest } from "c8y-nitro/runtime";
3
3
  import { defineMiddleware } from "nitro";
4
4
  //#region src/module/runtime/handlers/rewriteRequestUrl.ts
package/dist/types.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { a as C8YTenantOptionKey, c as C8yDockerOptions, d as C8YManifest, f as C8YManifestOptions, g as C8YAPIClientOptions, h as C8YKnownRole, i as C8YSettingsCategory, l as C8yCacheOptions, m as C8YRoles, n as C8yNitroModuleOptions, o as C8YTenantOptionKeysCacheConfig, p as C8YRole, r as C8yOpenAPIOptions, s as C8yRealtimeOptions, t as C8yDevOptions, u as C8YZipOptions } from "./index-DHd7xpBX.mjs";
1
+ import { a as C8YTenantOptionKey, c as C8yDockerOptions, d as C8YManifest, f as C8YManifestOptions, g as C8YAPIClientOptions, h as C8YKnownRole, i as C8YSettingsCategory, l as C8yCacheOptions, m as C8YRoles, n as C8yNitroModuleOptions, o as C8YTenantOptionKeysCacheConfig, p as C8YRole, r as C8yOpenAPIOptions, s as C8yRealtimeOptions, t as C8yDevOptions, u as C8YZipOptions } from "./index-BEFoDy-y.mjs";
2
2
  import { t as TenantCredentials } from "./credentials-eKnJ7m9Y.mjs";
3
3
  export { C8YAPIClientOptions, type C8YKnownRole, type C8YManifest, type C8YManifestOptions, C8YRole, C8YRoles, C8YSettingsCategory, C8YTenantOptionKey, C8YTenantOptionKeysCacheConfig, type C8YZipOptions, type C8yCacheOptions, C8yDevOptions, type C8yDockerOptions, C8yNitroModuleOptions, C8yOpenAPIOptions, type C8yRealtimeOptions, type TenantCredentials };
package/dist/utils.mjs CHANGED
@@ -328,6 +328,7 @@ function useUserClient(requestOrEvent) {
328
328
  const headers = convertRequestHeadersToC8yFormat(request);
329
329
  const auth = new MicroserviceClientRequestAuth(headers);
330
330
  const client = new Client(auth, process.env.C8Y_BASEURL);
331
+ client.core.defaultHeaders["X-Forwarded-Host"] = request.headers.get("x-forwarded-host") ?? process.env.C8Y_BASEURL;
331
332
  request.context ??= {};
332
333
  request.context["c8y_user_client"] = client;
333
334
  return client;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "c8y-nitro",
3
- "version": "0.10.0",
3
+ "version": "0.10.2",
4
4
  "type": "module",
5
5
  "description": "Lightning fast Cumulocity IoT microservice development powered by Nitro",
6
6
  "keywords": [