@objectstack/runtime 6.3.0 → 6.4.0

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.cjs CHANGED
@@ -2108,6 +2108,7 @@ __export(index_exports, {
2108
2108
  RouteGroupBuilder: () => import_rest.RouteGroupBuilder,
2109
2109
  RouteManager: () => import_rest.RouteManager,
2110
2110
  Runtime: () => Runtime,
2111
+ RuntimeConfigPlugin: () => RuntimeConfigPlugin,
2111
2112
  SYSTEM_ENVIRONMENT_ID: () => SYSTEM_ENVIRONMENT_ID,
2112
2113
  SandboxError: () => SandboxError,
2113
2114
  SeedLoaderService: () => SeedLoaderService,
@@ -8105,6 +8106,52 @@ var MarketplaceProxyPlugin = class _MarketplaceProxyPlugin {
8105
8106
  }
8106
8107
  };
8107
8108
 
8109
+ // src/cloud/runtime-config-plugin.ts
8110
+ var RuntimeConfigPlugin = class {
8111
+ constructor(config = {}) {
8112
+ this.name = "com.objectstack.runtime.runtime-config";
8113
+ this.version = "1.0.0";
8114
+ this.init = async (_ctx) => {
8115
+ };
8116
+ this.start = async (ctx) => {
8117
+ ctx.hook("kernel:ready", async () => {
8118
+ let httpServer;
8119
+ try {
8120
+ httpServer = ctx.getService("http-server");
8121
+ } catch {
8122
+ ctx.logger?.warn?.("[RuntimeConfigPlugin] http-server not available \u2014 runtime/config not mounted");
8123
+ return;
8124
+ }
8125
+ if (!httpServer || typeof httpServer.getRawApp !== "function") {
8126
+ ctx.logger?.warn?.("[RuntimeConfigPlugin] http-server missing getRawApp() \u2014 runtime/config not mounted");
8127
+ return;
8128
+ }
8129
+ const rawApp = httpServer.getRawApp();
8130
+ const payload = {
8131
+ cloudUrl: this.cloudUrl,
8132
+ singleEnvironment: this.singleEnvironment,
8133
+ features: {
8134
+ installLocal: this.installLocal,
8135
+ marketplace: true
8136
+ }
8137
+ };
8138
+ const handler = (c) => c.json(payload);
8139
+ rawApp.get("/api/v1/runtime/config", handler);
8140
+ rawApp.get("/api/v1/studio/runtime-config", handler);
8141
+ ctx.logger?.info?.("[RuntimeConfigPlugin] mounted /api/v1/runtime/config", {
8142
+ cloudUrl: this.cloudUrl || "(empty)",
8143
+ installLocal: this.installLocal
8144
+ });
8145
+ });
8146
+ };
8147
+ this.destroy = async () => {
8148
+ };
8149
+ this.cloudUrl = config.controlPlaneUrl === "" ? "" : resolveCloudUrl(config.controlPlaneUrl) ?? "";
8150
+ this.installLocal = !!config.installLocal;
8151
+ this.singleEnvironment = !!config.singleEnvironment;
8152
+ }
8153
+ };
8154
+
8108
8155
  // src/cloud/file-artifact-api-client.ts
8109
8156
  var import_promises2 = require("fs/promises");
8110
8157
  var import_node_path5 = require("path");
@@ -8331,7 +8378,7 @@ async function createObjectOSStack(config) {
8331
8378
  };
8332
8379
  const enginePlugins = await createHostEnginePlugins();
8333
8380
  return {
8334
- plugins: [...enginePlugins, new ObjectOSEnvironmentPlugin(merged), new AuthProxyPlugin(), new MarketplaceProxyPlugin({ controlPlaneUrl: merged.controlPlaneUrl === "file" ? void 0 : merged.controlPlaneUrl })],
8381
+ plugins: [...enginePlugins, new ObjectOSEnvironmentPlugin(merged), new AuthProxyPlugin(), new MarketplaceProxyPlugin({ controlPlaneUrl: merged.controlPlaneUrl === "file" ? void 0 : merged.controlPlaneUrl }), new RuntimeConfigPlugin({ controlPlaneUrl: merged.controlPlaneUrl === "file" ? void 0 : merged.controlPlaneUrl, installLocal: false })],
8335
8382
  api: {
8336
8383
  enableProjectScoping: true,
8337
8384
  projectResolution: "auto",
@@ -8862,6 +8909,7 @@ __reExport(index_exports, require("@objectstack/core"), module.exports);
8862
8909
  RouteGroupBuilder,
8863
8910
  RouteManager,
8864
8911
  Runtime,
8912
+ RuntimeConfigPlugin,
8865
8913
  SYSTEM_ENVIRONMENT_ID,
8866
8914
  SandboxError,
8867
8915
  SeedLoaderService,