@objectstack/runtime 6.7.1 → 6.8.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.js CHANGED
@@ -3091,6 +3091,15 @@ var _HttpDispatcher = class _HttpDispatcher {
3091
3091
  async handleMetadata(path, _context, method, body, query) {
3092
3092
  const parts = path.replace(/^\/+/, "").split("/").filter(Boolean);
3093
3093
  if (parts[0] === "types") {
3094
+ const protocol = await this.resolveService("protocol");
3095
+ if (protocol && typeof protocol.getMetaTypes === "function") {
3096
+ try {
3097
+ const result = await protocol.getMetaTypes({});
3098
+ return { handled: true, response: this.success(result) };
3099
+ } catch (e) {
3100
+ console.warn("[HttpDispatcher] protocol.getMetaTypes() failed:", e?.message);
3101
+ }
3102
+ }
3094
3103
  const metadataService = await this.resolveService("metadata", _context.environmentId);
3095
3104
  if (metadataService && typeof metadataService.getRegisteredTypes === "function") {
3096
3105
  try {
@@ -3100,11 +3109,6 @@ var _HttpDispatcher = class _HttpDispatcher {
3100
3109
  console.warn("[HttpDispatcher] MetadataService.getRegisteredTypes() failed:", e.message);
3101
3110
  }
3102
3111
  }
3103
- const protocol = await this.resolveService("protocol");
3104
- if (protocol && typeof protocol.getMetaTypes === "function") {
3105
- const result = await protocol.getMetaTypes({});
3106
- return { handled: true, response: this.success(result) };
3107
- }
3108
3112
  return { handled: true, response: this.success({ types: ["object", "app", "plugin"] }) };
3109
3113
  }
3110
3114
  if (parts.length >= 3 && parts[parts.length - 1] === "published" && (!method || method === "GET")) {
@@ -3252,6 +3256,14 @@ var _HttpDispatcher = class _HttpDispatcher {
3252
3256
  return { handled: true, response: this.error("Not found", 404) };
3253
3257
  }
3254
3258
  if (parts.length === 0) {
3259
+ const protocol = await this.resolveService("protocol");
3260
+ if (protocol && typeof protocol.getMetaTypes === "function") {
3261
+ try {
3262
+ const result = await protocol.getMetaTypes({});
3263
+ return { handled: true, response: this.success(result) };
3264
+ } catch {
3265
+ }
3266
+ }
3255
3267
  const metadataService = await this.resolveService("metadata", _context.environmentId);
3256
3268
  if (metadataService && typeof metadataService.getRegisteredTypes === "function") {
3257
3269
  try {
@@ -3260,11 +3272,6 @@ var _HttpDispatcher = class _HttpDispatcher {
3260
3272
  } catch {
3261
3273
  }
3262
3274
  }
3263
- const protocol = await this.resolveService("protocol");
3264
- if (protocol && typeof protocol.getMetaTypes === "function") {
3265
- const result = await protocol.getMetaTypes({});
3266
- return { handled: true, response: this.success(result) };
3267
- }
3268
3275
  return { handled: true, response: this.success({ types: ["object", "app", "plugin"] }) };
3269
3276
  }
3270
3277
  return { handled: false };
@@ -5842,6 +5849,9 @@ function mountRouteOnServer(route, server, routePath, securityHeaders) {
5842
5849
  } else if (m === "delete" && typeof server.delete === "function") {
5843
5850
  server.delete(routePath, handler);
5844
5851
  return true;
5852
+ } else if (m === "patch" && typeof server.patch === "function") {
5853
+ server.patch(routePath, handler);
5854
+ return true;
5845
5855
  }
5846
5856
  return false;
5847
5857
  }