@automagik/omni 2.260714.2 → 2.260714.3
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/server/index.js
CHANGED
|
@@ -225883,7 +225883,7 @@ var init_sentry_scrub = __esm(() => {
|
|
|
225883
225883
|
var require_package7 = __commonJS((exports, module) => {
|
|
225884
225884
|
module.exports = {
|
|
225885
225885
|
name: "@omni/api",
|
|
225886
|
-
version: "2.260714.
|
|
225886
|
+
version: "2.260714.3",
|
|
225887
225887
|
type: "module",
|
|
225888
225888
|
exports: {
|
|
225889
225889
|
".": {
|
|
@@ -346441,7 +346441,7 @@ function registerAuthSchemas(registry4) {
|
|
|
346441
346441
|
registry4.register("AuthValidateResponse", AuthValidateResponseSchema);
|
|
346442
346442
|
registry4.registerPath({
|
|
346443
346443
|
method: "post",
|
|
346444
|
-
path: "/
|
|
346444
|
+
path: "/auth/validate",
|
|
346445
346445
|
operationId: "validateApiKey",
|
|
346446
346446
|
tags: ["Auth"],
|
|
346447
346447
|
summary: "Validate API key",
|
|
@@ -349888,9 +349888,28 @@ var init_webhooks2 = __esm(() => {
|
|
|
349888
349888
|
});
|
|
349889
349889
|
|
|
349890
349890
|
// ../api/src/routes/openapi.ts
|
|
349891
|
+
function annotateScopes(document2) {
|
|
349892
|
+
const paths = document2.paths;
|
|
349893
|
+
if (!paths)
|
|
349894
|
+
return;
|
|
349895
|
+
for (const [pathKey, pathItem] of Object.entries(paths)) {
|
|
349896
|
+
if (!pathItem)
|
|
349897
|
+
continue;
|
|
349898
|
+
const honoPath = pathKey.replace(/\{([^}]+)\}/g, ":$1");
|
|
349899
|
+
for (const method of HTTP_METHODS) {
|
|
349900
|
+
const operation = pathItem[method];
|
|
349901
|
+
if (!operation || typeof operation !== "object")
|
|
349902
|
+
continue;
|
|
349903
|
+
const scope = SCOPE_MAP[`${method.toUpperCase()} ${honoPath}`];
|
|
349904
|
+
if (scope) {
|
|
349905
|
+
operation["x-omni-scope"] = scope;
|
|
349906
|
+
}
|
|
349907
|
+
}
|
|
349908
|
+
}
|
|
349909
|
+
}
|
|
349891
349910
|
function generateOpenApiSpec() {
|
|
349892
349911
|
const generator = new OpenApiGeneratorV3(registry4.definitions);
|
|
349893
|
-
|
|
349912
|
+
const document2 = generator.generateDocument({
|
|
349894
349913
|
openapi: "3.0.3",
|
|
349895
349914
|
info: openApiInfo,
|
|
349896
349915
|
servers: [
|
|
@@ -349906,12 +349925,15 @@ function generateOpenApiSpec() {
|
|
|
349906
349925
|
],
|
|
349907
349926
|
tags: apiTags
|
|
349908
349927
|
});
|
|
349928
|
+
annotateScopes(document2);
|
|
349929
|
+
return document2;
|
|
349909
349930
|
}
|
|
349910
|
-
var registry4, openapiRoutes, openApiSpec;
|
|
349931
|
+
var registry4, openapiRoutes, HTTP_METHODS, openApiSpec;
|
|
349911
349932
|
var init_openapi2 = __esm(() => {
|
|
349912
349933
|
init_dist4();
|
|
349913
349934
|
init_dist5();
|
|
349914
349935
|
init_dist2();
|
|
349936
|
+
init_scopes();
|
|
349915
349937
|
init_openapi();
|
|
349916
349938
|
init_zod_openapi();
|
|
349917
349939
|
init_access2();
|
|
@@ -349963,6 +349985,7 @@ var init_openapi2 = __esm(() => {
|
|
|
349963
349985
|
registerFollowUpSchemas(registry4);
|
|
349964
349986
|
registerVoiceSchemas(registry4);
|
|
349965
349987
|
openapiRoutes = new Hono2;
|
|
349988
|
+
HTTP_METHODS = ["get", "put", "post", "delete", "patch", "options", "head", "trace"];
|
|
349966
349989
|
openApiSpec = generateOpenApiSpec();
|
|
349967
349990
|
openapiRoutes.get("/openapi.json", (c) => {
|
|
349968
349991
|
return c.json(openApiSpec);
|