@aphexcms/cms-core 11.1.1 → 11.2.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/api/docs-ui.d.ts +22 -0
- package/dist/api/docs-ui.d.ts.map +1 -0
- package/dist/api/docs-ui.js +19 -0
- package/dist/api/schemas/assets.d.ts +11 -0
- package/dist/api/schemas/assets.d.ts.map +1 -1
- package/dist/api/schemas/assets.js +24 -0
- package/dist/auth/auth-hooks.d.ts.map +1 -1
- package/dist/auth/auth-hooks.js +4 -1
- package/dist/server/api/index.d.ts.map +1 -1
- package/dist/server/api/index.js +7 -0
- package/dist/server/api/openapi/generate.d.ts +13 -0
- package/dist/server/api/openapi/generate.d.ts.map +1 -0
- package/dist/server/api/openapi/generate.js +529 -0
- package/dist/server/api/openapi/json-schema.d.ts +45 -0
- package/dist/server/api/openapi/json-schema.d.ts.map +1 -0
- package/dist/server/api/openapi/json-schema.js +206 -0
- package/dist/server/api/openapi/registry.d.ts +78 -0
- package/dist/server/api/openapi/registry.d.ts.map +1 -0
- package/dist/server/api/openapi/registry.js +628 -0
- package/dist/server/api/routes/agent-change-sets.d.ts +6 -0
- package/dist/server/api/routes/agent-change-sets.d.ts.map +1 -1
- package/dist/server/api/routes/agent-change-sets.js +2 -1
- package/dist/server/api/routes/jobs.d.ts +32 -0
- package/dist/server/api/routes/jobs.d.ts.map +1 -1
- package/dist/server/api/routes/jobs.js +7 -3
- package/dist/server/api/routes/openapi.d.ts +34 -0
- package/dist/server/api/routes/openapi.d.ts.map +1 -0
- package/dist/server/api/routes/openapi.js +97 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -0
- package/dist/types/config.d.ts +15 -0
- package/dist/types/config.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this instance serves the rendered API reference at `GET /api/docs`.
|
|
3
|
+
*
|
|
4
|
+
* Its own tiny module, no imports, for the same reason as `limits.ts`: the
|
|
5
|
+
* route that mounts the page and the admin UI that links to it have to agree,
|
|
6
|
+
* and two copies of `!== false` agree right up until someone changes one of
|
|
7
|
+
* them. A link to a 404 is worse than no link.
|
|
8
|
+
*
|
|
9
|
+
* On by default. The page is authenticated, so anyone who can load it could
|
|
10
|
+
* already read `/api/openapi.json` — this instance's whole content model — and
|
|
11
|
+
* the page shows them nothing further. The one thing it does that the JSON
|
|
12
|
+
* endpoint doesn't is load Scalar from a public CDN, so `docsUi: false` is the
|
|
13
|
+
* switch for a deployment that shouldn't pull third-party scripts.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isApiDocsEnabled(config: {
|
|
16
|
+
openapi?: {
|
|
17
|
+
docsUi?: boolean;
|
|
18
|
+
};
|
|
19
|
+
} | null | undefined): boolean;
|
|
20
|
+
/** Where that reference lives, for anything that wants to link to it. */
|
|
21
|
+
export declare const API_DOCS_PATH = "/api/docs";
|
|
22
|
+
//# sourceMappingURL=docs-ui.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"docs-ui.d.ts","sourceRoot":"","sources":["../../src/lib/api/docs-ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,GAAG,IAAI,GAAG,SAAS,WAE7F;AAED,yEAAyE;AACzE,eAAO,MAAM,aAAa,cAAc,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether this instance serves the rendered API reference at `GET /api/docs`.
|
|
3
|
+
*
|
|
4
|
+
* Its own tiny module, no imports, for the same reason as `limits.ts`: the
|
|
5
|
+
* route that mounts the page and the admin UI that links to it have to agree,
|
|
6
|
+
* and two copies of `!== false` agree right up until someone changes one of
|
|
7
|
+
* them. A link to a 404 is worse than no link.
|
|
8
|
+
*
|
|
9
|
+
* On by default. The page is authenticated, so anyone who can load it could
|
|
10
|
+
* already read `/api/openapi.json` — this instance's whole content model — and
|
|
11
|
+
* the page shows them nothing further. The one thing it does that the JSON
|
|
12
|
+
* endpoint doesn't is load Scalar from a public CDN, so `docsUi: false` is the
|
|
13
|
+
* switch for a deployment that shouldn't pull third-party scripts.
|
|
14
|
+
*/
|
|
15
|
+
export function isApiDocsEnabled(config) {
|
|
16
|
+
return config?.openapi?.docsUi !== false;
|
|
17
|
+
}
|
|
18
|
+
/** Where that reference lives, for anything that wants to link to it. */
|
|
19
|
+
export const API_DOCS_PATH = '/api/docs';
|
|
@@ -91,6 +91,17 @@ export declare const listAssetsResponse: z.ZodObject<{
|
|
|
91
91
|
hasNextPage: z.ZodBoolean;
|
|
92
92
|
hasPrevPage: z.ZodBoolean;
|
|
93
93
|
}, z.core.$strip>;
|
|
94
|
+
indexing: z.ZodBoolean;
|
|
95
|
+
limits: z.ZodObject<{
|
|
96
|
+
maxUploadBytes: z.ZodNumber;
|
|
97
|
+
allowedMimeTypes: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
|
|
98
|
+
directUpload: z.ZodBoolean;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
images: z.ZodNullable<z.ZodObject<{
|
|
101
|
+
widths: z.ZodArray<z.ZodNumber>;
|
|
102
|
+
quality: z.ZodNumber;
|
|
103
|
+
configHash: z.ZodString;
|
|
104
|
+
}, z.core.$strip>>;
|
|
94
105
|
}, z.core.$strip>;
|
|
95
106
|
export declare const getAssetResponse: z.ZodObject<{
|
|
96
107
|
success: z.ZodLiteral<true>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../../src/lib/api/schemas/assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,WAA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0BAA0B,CAAC,CAAC;AAEpF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AACtF,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AAExF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC5E,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
|
|
@@ -81,7 +81,31 @@ export const listAssetsResponse = z.object({
|
|
|
81
81
|
totalPages: z.number(),
|
|
82
82
|
hasNextPage: z.boolean(),
|
|
83
83
|
hasPrevPage: z.boolean()
|
|
84
|
+
}),
|
|
85
|
+
/**
|
|
86
|
+
* True when a `usage` filter was requested before the asset-reference index
|
|
87
|
+
* exists, so the admin can say "indexing" rather than present an empty or
|
|
88
|
+
* wholly-unused library as fact.
|
|
89
|
+
*/
|
|
90
|
+
indexing: z.boolean(),
|
|
91
|
+
/**
|
|
92
|
+
* Server-side upload limits, reported so a client can refuse an oversized file
|
|
93
|
+
* before sending it instead of hardcoding a number that drifts.
|
|
94
|
+
*/
|
|
95
|
+
limits: z.object({
|
|
96
|
+
maxUploadBytes: z.number(),
|
|
97
|
+
allowedMimeTypes: z.array(z.string()).nullable().optional(),
|
|
98
|
+
/** Whether `/assets/upload-url` will work — depends on adapter and config. */
|
|
99
|
+
directUpload: z.boolean()
|
|
100
|
+
}),
|
|
101
|
+
/** Responsive-variant config, or null when image processing is off. */
|
|
102
|
+
images: z
|
|
103
|
+
.object({
|
|
104
|
+
widths: z.array(z.number()),
|
|
105
|
+
quality: z.number(),
|
|
106
|
+
configHash: z.string()
|
|
84
107
|
})
|
|
108
|
+
.nullable()
|
|
85
109
|
});
|
|
86
110
|
// ---------- GET /assets/[id] ----------
|
|
87
111
|
export const getAssetResponse = z.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-hooks.d.ts","sourceRoot":"","sources":["../../src/lib/auth/auth-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAQ,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAkB/C,wBAAsB,cAAc,CACnC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,SAAS,EACjB,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,eAAe,EACnB,YAAY,EAAE,YAAY,GACxB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"auth-hooks.d.ts","sourceRoot":"","sources":["../../src/lib/auth/auth-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAQ,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAkB/C,wBAAsB,cAAc,CACnC,KAAK,EAAE,YAAY,EACnB,MAAM,EAAE,SAAS,EACjB,YAAY,EAAE,YAAY,EAC1B,EAAE,EAAE,eAAe,EACnB,YAAY,EAAE,YAAY,GACxB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CA8J1B"}
|
package/dist/auth/auth-hooks.js
CHANGED
|
@@ -84,7 +84,10 @@ export async function handleAuthHook(event, config, authProvider, db, rolesServi
|
|
|
84
84
|
'/api/invitations',
|
|
85
85
|
'/api/roles',
|
|
86
86
|
'/api/settings',
|
|
87
|
-
'/api/instance-settings'
|
|
87
|
+
'/api/instance-settings',
|
|
88
|
+
// The generated spec enumerates this deployment's whole content model.
|
|
89
|
+
// No content, but not for anonymous callers either.
|
|
90
|
+
'/api/openapi.json'
|
|
88
91
|
];
|
|
89
92
|
if (graphqlEndpoint) {
|
|
90
93
|
protectedApiRoutes.push(graphqlEndpoint);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/server/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/server/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AA8B7C;;;;;;;;;;GAUG;AACH,MAAM,MAAM,QAAQ,GAAG;IACtB,SAAS,EAAE;QACV,QAAQ,EAAE,YAAY,CAAC;QACvB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;KAClB,CAAC;IACF,QAAQ,EAAE;QACT,QAAQ,EAAE,YAAY,CAAC;QACvB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;QAClB,wEAAwE;QACxE,aAAa,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;CACF,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,cAAc,kGAqC7B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,QAAQ,CAAC,QA0GrD;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AA0C1D;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,IACtE,GAAG,OAAO,MAAM,EAAE,OAAO,CAAC,QAAQ,CAAC,uBAejD"}
|
package/dist/server/api/index.js
CHANGED
|
@@ -26,6 +26,7 @@ import { workersRunRouter } from './routes/workers-run.js';
|
|
|
26
26
|
import { jobsRouter } from './routes/jobs.js';
|
|
27
27
|
import { agentChatRouter } from './routes/agent-chat.js';
|
|
28
28
|
import { agentChangeSetsRouter } from './routes/agent-change-sets.js';
|
|
29
|
+
import { openapiRouter, openapiDocsRouter } from './routes/openapi.js';
|
|
29
30
|
/**
|
|
30
31
|
* Build the Aphex API Hono app shell.
|
|
31
32
|
*
|
|
@@ -118,6 +119,12 @@ export function mountAphexBuiltins(app) {
|
|
|
118
119
|
app.route('/internal/workers', workersRunRouter);
|
|
119
120
|
// Read-only job/event history (observability). → GET /api/jobs, GET /api/events
|
|
120
121
|
app.route('/', jobsRouter);
|
|
122
|
+
// Machine-readable description of everything mounted above, generated from the
|
|
123
|
+
// zod contracts and this instance's schema types. → GET /api/openapi.json
|
|
124
|
+
app.route('/openapi.json', openapiRouter);
|
|
125
|
+
// Rendered reference over that document. Static shell; it fetches the spec
|
|
126
|
+
// client-side, so it needs no auth of its own. → GET /api/docs
|
|
127
|
+
app.route('/docs', openapiDocsRouter);
|
|
121
128
|
// In-admin agent streaming chat — 404s unless `aiProvider` is configured.
|
|
122
129
|
// → POST /api/agent/chat
|
|
123
130
|
app.route('/agent', agentChatRouter);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SchemaType } from '../../../types/schemas.js';
|
|
2
|
+
import { type JsonSchema } from './json-schema.js';
|
|
3
|
+
export interface OpenApiOptions {
|
|
4
|
+
/** Document types drive the per-collection request bodies. */
|
|
5
|
+
schemaTypes?: SchemaType[];
|
|
6
|
+
/** Server URL to advertise, e.g. `https://cms.example.com`. */
|
|
7
|
+
serverUrl?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
version?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Build the full OpenAPI document. */
|
|
12
|
+
export declare function generateOpenApiDocument(options?: OpenApiOptions): JsonSchema;
|
|
13
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../src/lib/server/api/openapi/generate.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGzD,OAAO,EAIN,KAAK,UAAU,EACf,MAAM,eAAe,CAAC;AAEvB,MAAM,WAAW,cAAc;IAC9B,8DAA8D;IAC9D,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC;IAC3B,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAmeD,uCAAuC;AACvC,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,cAAmB,GAAG,UAAU,CAyEhF"}
|