@agentage/extension 0.9.0 → 0.10.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/openapi-doc.js +11 -8
- package/dist/api/routes.d.ts +15 -6
- package/dist/auth/part-auth.d.ts +2 -0
- package/dist/auth/part-auth.js +11 -0
- package/dist/auth/route-access.d.ts +1 -0
- package/dist/auth/route-access.js +1 -1
- package/dist/context/context.d.ts +8 -0
- package/dist/context/context.js +12 -1
- package/dist/context/test-context.d.ts +2 -1
- package/dist/context/test-context.js +2 -1
- package/dist/envelope/envelope.d.ts +8 -5
- package/dist/envelope/envelope.js +15 -3
- package/dist/envelope/envelope.schema.d.ts +3 -5
- package/dist/envelope/envelope.schema.js +7 -3
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1 -0
- package/dist/pages/inline-hashes.d.ts +3 -0
- package/dist/pages/inline-hashes.js +27 -0
- package/dist/pages/pages-app.js +20 -8
- package/dist/pages/pages.d.ts +5 -1
- package/dist/pages/site-from-dir.d.ts +7 -0
- package/dist/pages/site-from-dir.js +31 -0
- package/dist/pages/types.d.ts +3 -0
- package/dist/pages/types.js +40 -0
- package/dist/runtime/part-runners.js +2 -1
- package/dist/runtime/run-part.js +2 -1
- package/dist/server/api-routes.js +15 -2
- package/dist/server/app.d.ts +4 -0
- package/dist/server/app.js +13 -2
- package/dist/testing/test-server.js +1 -1
- package/package.json +1 -1
- package/schemas/error-envelope.schema.json +27 -27
package/dist/api/openapi-doc.js
CHANGED
|
@@ -13,7 +13,8 @@ const bare = (zod, io) => {
|
|
|
13
13
|
const json = (schema) => ({ 'application/json': { schema } });
|
|
14
14
|
const content = (description, schema) => ({ description, content: json(schema) });
|
|
15
15
|
const STRING = { type: 'string' };
|
|
16
|
-
const okResponse = ({
|
|
16
|
+
const okResponse = (spec) => spec.status === 204 ? { description: 'no content' } : okBody(spec);
|
|
17
|
+
const okBody = ({ output, etag }) => ({
|
|
17
18
|
...content('the envelope', {
|
|
18
19
|
type: 'object',
|
|
19
20
|
properties: {
|
|
@@ -36,17 +37,19 @@ const pathParameters = ({ path, spec }) => {
|
|
|
36
37
|
schema: typed[name] ?? STRING,
|
|
37
38
|
}));
|
|
38
39
|
};
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const { properties = {}, required = [] } = fields(entry.spec.input);
|
|
43
|
-
return Object.entries(properties).map(([name, schema]) => ({
|
|
40
|
+
const queryOf = (schema) => {
|
|
41
|
+
const { properties = {}, required = [] } = fields(schema);
|
|
42
|
+
return Object.entries(properties).map(([name, field]) => ({
|
|
44
43
|
name,
|
|
45
44
|
in: 'query',
|
|
46
45
|
required: required.includes(name),
|
|
47
|
-
schema,
|
|
46
|
+
schema: field,
|
|
48
47
|
}));
|
|
49
48
|
};
|
|
49
|
+
const queryParameters = ({ method, spec }) => [
|
|
50
|
+
...(spec.input && inQuery(method) ? queryOf(spec.input) : []),
|
|
51
|
+
...(spec.query ? queryOf(spec.query) : []),
|
|
52
|
+
];
|
|
50
53
|
const IF_MATCH = { name: 'If-Match', in: 'header', required: false, schema: STRING };
|
|
51
54
|
const parameters = (entry) => [
|
|
52
55
|
...pathParameters(entry),
|
|
@@ -56,7 +59,7 @@ const parameters = (entry) => [
|
|
|
56
59
|
const responses = (entry) => {
|
|
57
60
|
const { input, params, scope, etag } = entry.spec;
|
|
58
61
|
return {
|
|
59
|
-
|
|
62
|
+
[entry.spec.status ?? 200]: okResponse(entry.spec),
|
|
60
63
|
...((input || params) && { '400': refusal('VALIDATION_ERROR') }),
|
|
61
64
|
...(scope !== 'public' && { '401': refusal('UNAUTHORIZED'), '403': refusal('FORBIDDEN') }),
|
|
62
65
|
...(entry.path.includes('{') && { '404': refusal('NOT_FOUND') }),
|
package/dist/api/routes.d.ts
CHANGED
|
@@ -6,26 +6,35 @@ import { type WellKnownRegistrar } from './well-known.js';
|
|
|
6
6
|
export declare const ROUTE_METHODS: readonly ["get", "post", "put", "patch", "delete"];
|
|
7
7
|
export type RouteMethod = (typeof ROUTE_METHODS)[number];
|
|
8
8
|
type ObjectSchema = z.ZodObject;
|
|
9
|
-
export interface RouteSpec<I extends ObjectSchema, O extends z.ZodType, S extends Access = Access, Q extends ObjectSchema = never> {
|
|
9
|
+
export interface RouteSpec<I extends ObjectSchema, O extends z.ZodType, S extends Access = Access, Q extends ObjectSchema = never, Y extends ObjectSchema = never> {
|
|
10
10
|
summary: string;
|
|
11
11
|
scope?: S;
|
|
12
12
|
input?: I;
|
|
13
13
|
output?: O;
|
|
14
14
|
params?: Q;
|
|
15
|
+
query?: Y;
|
|
15
16
|
etag?: true;
|
|
17
|
+
status?: 200 | 201 | 204;
|
|
16
18
|
}
|
|
17
19
|
export type ParamsOf<P extends string> = P extends `${string}{${infer N}}${infer R}` ? {
|
|
18
20
|
[K in N]: string;
|
|
19
21
|
} & ParamsOf<R> : Record<never, string>;
|
|
20
|
-
export interface RouteRequest<I, P extends string, S extends Access = Access, Q = never> {
|
|
22
|
+
export interface RouteRequest<I, P extends string, S extends Access = Access, Q = never, Y = never> {
|
|
21
23
|
input: I;
|
|
24
|
+
query: [Y] extends [never] ? Record<never, never> : Y;
|
|
25
|
+
ip: string;
|
|
22
26
|
params: [Q] extends [never] ? ParamsOf<P> : Q;
|
|
23
27
|
caller: S extends 'public' | 'optional' ? Caller | null : Caller;
|
|
24
28
|
ifMatch?: string;
|
|
29
|
+
header: (name: string) => string | undefined;
|
|
25
30
|
}
|
|
26
31
|
type Answer<T> = T | Reply<T>;
|
|
27
|
-
export type RouteHandler<I extends ObjectSchema, O extends z.ZodType, P extends string, S extends Access = Access, Q extends ObjectSchema = never> = (request: RouteRequest<z.output<I>, P, S, [
|
|
28
|
-
|
|
32
|
+
export type RouteHandler<I extends ObjectSchema, O extends z.ZodType, P extends string, S extends Access = Access, Q extends ObjectSchema = never, Y extends ObjectSchema = never> = (request: RouteRequest<z.output<I>, P, S, [
|
|
33
|
+
Q
|
|
34
|
+
] extends [never] ? never : z.output<Q>, [
|
|
35
|
+
Y
|
|
36
|
+
] extends [never] ? never : z.output<Y>>) => Answer<z.input<O>> | Promise<Answer<z.input<O>>>;
|
|
37
|
+
export type RouteRegistrar = <P extends string, I extends ObjectSchema = z.ZodObject<Record<never, z.ZodType>>, O extends z.ZodType = z.ZodUnknown, S extends Access = 'read', Q extends ObjectSchema = never, Y extends ObjectSchema = never>(method: RouteMethod, path: P, spec: RouteSpec<I, O, S, Q, Y>, handler: RouteHandler<I, O, P, S, Q, Y>) => void;
|
|
29
38
|
export interface ApiContext extends PartContext {
|
|
30
39
|
readonly route: RouteRegistrar;
|
|
31
40
|
readonly wellKnown: WellKnownRegistrar;
|
|
@@ -34,8 +43,8 @@ type Params = Record<string, unknown>;
|
|
|
34
43
|
export interface RouteEntry {
|
|
35
44
|
method: RouteMethod;
|
|
36
45
|
path: string;
|
|
37
|
-
spec: RouteSpec<ObjectSchema, z.ZodType, Access, ObjectSchema>;
|
|
38
|
-
handler: (request: RouteRequest<Record<string, unknown>, string, 'public', Params>) => unknown;
|
|
46
|
+
spec: RouteSpec<ObjectSchema, z.ZodType, Access, ObjectSchema, ObjectSchema>;
|
|
47
|
+
handler: (request: RouteRequest<Record<string, unknown>, string, 'public', Params, Params>) => unknown;
|
|
39
48
|
}
|
|
40
49
|
export declare const createRouteRegistry: () => {
|
|
41
50
|
wellKnown: WellKnownRegistrar;
|
package/dist/auth/part-auth.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { type PlatformInfo } from '../context/context.js';
|
|
1
2
|
import { type Log } from '../log/log.js';
|
|
2
3
|
import { type Env } from '../runtime/build-info.js';
|
|
3
4
|
export declare const isAudience: (audience: string) => boolean;
|
|
5
|
+
export declare const platformOf: (env: Env) => PlatformInfo;
|
|
4
6
|
export declare const covers: (audience: string, host: string) => boolean;
|
|
5
7
|
export declare const partAuth: (env: Env, id: string, log: Log, scopes: string[]) => Promise<{
|
|
6
8
|
tokenCheck: import("./token-check.js").TokenCheck;
|
package/dist/auth/part-auth.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import {} from '../context/context.js';
|
|
2
3
|
import { OriginSchema } from '../discovery/discovery.schema.js';
|
|
3
4
|
import { messageOf } from '../log/log.js';
|
|
4
5
|
import { formatIssues } from '../manifest/read-manifest.js';
|
|
@@ -18,6 +19,16 @@ const AuthEnvSchema = z.object({
|
|
|
18
19
|
AGENTAGE_AUDIENCE: z.string().refine(isAudience, '*.{domain} or one host'),
|
|
19
20
|
AGENTAGE_ORIGIN: z.url(),
|
|
20
21
|
});
|
|
22
|
+
const valid = (env, key) => {
|
|
23
|
+
const parsed = AuthEnvSchema.shape[key].safeParse(env[key]);
|
|
24
|
+
return parsed.success ? parsed.data : '';
|
|
25
|
+
};
|
|
26
|
+
// ctx.platform from the token check's env; pages and worker start without it and get ''.
|
|
27
|
+
export const platformOf = (env) => {
|
|
28
|
+
const telemetry = env['AGENTAGE_TELEMETRY_URL'] || undefined;
|
|
29
|
+
const issuer = valid(env, 'AGENTAGE_ISSUER');
|
|
30
|
+
return { issuer, audience: valid(env, 'AGENTAGE_AUDIENCE'), ...(telemetry && { telemetry }) };
|
|
31
|
+
};
|
|
21
32
|
// *.agentage.io covers the domain and every host under it at any depth; else one exact host.
|
|
22
33
|
export const covers = (audience, host) => audience.startsWith('*.')
|
|
23
34
|
? host === audience.slice(2) || host.endsWith(audience.slice(1))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { accessOfSecurity, strongest } from './token-check.js';
|
|
2
2
|
const PARAM = /^\{.+\}$/;
|
|
3
3
|
// As Express routes: without case, and one trailing slash ignored.
|
|
4
|
-
const sameShape = (template, path) => {
|
|
4
|
+
export const sameShape = (template, path) => {
|
|
5
5
|
const want = template.toLowerCase().split('/');
|
|
6
6
|
const got = path
|
|
7
7
|
.toLowerCase()
|
|
@@ -15,6 +15,12 @@ export interface ExtensionInfo {
|
|
|
15
15
|
commit: string;
|
|
16
16
|
store?: StoreKind;
|
|
17
17
|
}
|
|
18
|
+
export interface PlatformInfo {
|
|
19
|
+
issuer: string;
|
|
20
|
+
audience: string;
|
|
21
|
+
telemetry?: string;
|
|
22
|
+
}
|
|
23
|
+
export declare const NO_PLATFORM: PlatformInfo;
|
|
18
24
|
export interface PartContext {
|
|
19
25
|
readonly extension: Readonly<ExtensionInfo>;
|
|
20
26
|
readonly auth: {
|
|
@@ -25,6 +31,7 @@ export interface PartContext {
|
|
|
25
31
|
readonly settings: Readonly<Record<string, SettingValue>>;
|
|
26
32
|
readonly store: Store;
|
|
27
33
|
readonly secrets: Secrets;
|
|
34
|
+
readonly platform: Readonly<PlatformInfo>;
|
|
28
35
|
}
|
|
29
36
|
export declare const NO_STORE: Store;
|
|
30
37
|
export declare const settingDefaults: (pkg: ExtensionPackage) => Record<string, SettingValue>;
|
|
@@ -37,5 +44,6 @@ export interface ContextInput {
|
|
|
37
44
|
settings?: Record<string, SettingValue>;
|
|
38
45
|
store?: Store;
|
|
39
46
|
secrets?: Secrets;
|
|
47
|
+
platform?: PlatformInfo;
|
|
40
48
|
}
|
|
41
49
|
export declare const createContext: (input: ContextInput) => PartContext;
|
package/dist/context/context.js
CHANGED
|
@@ -6,6 +6,7 @@ import { createLog } from '../log/log.js';
|
|
|
6
6
|
import { createSpan } from '../log/span.js';
|
|
7
7
|
import {} from '../store/store.types.js';
|
|
8
8
|
import {} from './secrets.js';
|
|
9
|
+
export const NO_PLATFORM = Object.freeze({ issuer: '', audience: '' });
|
|
9
10
|
// ctx.store is always there; without a store part in the manifest it says so on first use.
|
|
10
11
|
export const NO_STORE = {
|
|
11
12
|
query: async () => {
|
|
@@ -29,5 +30,15 @@ export const createContext = (input) => {
|
|
|
29
30
|
const auth = Object.freeze({ caller: callerOf });
|
|
30
31
|
const secrets = input.secrets ?? {};
|
|
31
32
|
const span = createSpan(log);
|
|
32
|
-
|
|
33
|
+
const platform = Object.freeze({ ...(input.platform ?? NO_PLATFORM) });
|
|
34
|
+
return Object.freeze({
|
|
35
|
+
extension,
|
|
36
|
+
auth,
|
|
37
|
+
log,
|
|
38
|
+
span,
|
|
39
|
+
settings,
|
|
40
|
+
store: store ?? NO_STORE,
|
|
41
|
+
secrets,
|
|
42
|
+
platform,
|
|
43
|
+
});
|
|
33
44
|
};
|
|
@@ -5,7 +5,7 @@ import { type ToolEntry, type ToolRegistrar } from '../mcp/tools.js';
|
|
|
5
5
|
import { type JobOptions } from '../worker/job-options.js';
|
|
6
6
|
import { type JobRun } from '../worker/runs.js';
|
|
7
7
|
import { type Schedule } from '../worker/scheduler.js';
|
|
8
|
-
import { type ExtensionInfo, type PartContext, type SettingValue } from './context.js';
|
|
8
|
+
import { type ExtensionInfo, type PlatformInfo, type PartContext, type SettingValue } from './context.js';
|
|
9
9
|
import { type LogEntry } from './recording-log.js';
|
|
10
10
|
import { type TestCommandContext, type TestCommandOptions } from './test-command-context.js';
|
|
11
11
|
export { type LogEntry } from './recording-log.js';
|
|
@@ -35,6 +35,7 @@ export interface TestContextOptions {
|
|
|
35
35
|
store?: boolean | {
|
|
36
36
|
dir: string;
|
|
37
37
|
};
|
|
38
|
+
platform?: PlatformInfo;
|
|
38
39
|
}
|
|
39
40
|
export declare function createTestContext(options: TestCommandOptions): TestCommandContext;
|
|
40
41
|
export declare function createTestContext(options?: TestContextOptions): TestContext;
|
|
@@ -10,7 +10,7 @@ import { runLog } from '../worker/run-log.js';
|
|
|
10
10
|
import { memoryRuns } from '../worker/runs.js';
|
|
11
11
|
import { createScheduler } from '../worker/scheduler.js';
|
|
12
12
|
import {} from '../manifest/primitives.schema.js';
|
|
13
|
-
import { NO_STORE } from './context.js';
|
|
13
|
+
import { NO_PLATFORM, NO_STORE, } from './context.js';
|
|
14
14
|
import { packageExtension } from './package-extension.js';
|
|
15
15
|
import { recordingLog } from './recording-log.js';
|
|
16
16
|
import { commandContext, } from './test-command-context.js';
|
|
@@ -72,6 +72,7 @@ const serverContext = (options) => {
|
|
|
72
72
|
settings: { ...options.settings },
|
|
73
73
|
store: store ?? NO_STORE,
|
|
74
74
|
secrets: Object.freeze({ ...options.secrets }),
|
|
75
|
+
platform: Object.freeze({ ...(options.platform ?? NO_PLATFORM) }),
|
|
75
76
|
close: async () => store?.close(),
|
|
76
77
|
...recorders(log),
|
|
77
78
|
};
|
|
@@ -8,25 +8,27 @@ export interface OkEnvelope<T> {
|
|
|
8
8
|
data: T;
|
|
9
9
|
meta?: Record<string, unknown>;
|
|
10
10
|
}
|
|
11
|
+
export type ErrorDetails = ErrorDetail[] | Record<string, unknown>;
|
|
11
12
|
export interface ErrorBody {
|
|
12
|
-
code:
|
|
13
|
+
code: string;
|
|
13
14
|
message: string;
|
|
14
15
|
agcid: string;
|
|
15
|
-
details?:
|
|
16
|
+
details?: ErrorDetails;
|
|
16
17
|
}
|
|
17
18
|
export interface ErrorEnvelope {
|
|
18
19
|
success: false;
|
|
19
20
|
error: ErrorBody;
|
|
20
21
|
}
|
|
21
22
|
export interface Failure extends Error {
|
|
22
|
-
readonly code:
|
|
23
|
+
readonly code: string;
|
|
23
24
|
readonly status: number;
|
|
24
|
-
readonly details?:
|
|
25
|
+
readonly details?: ErrorDetails;
|
|
25
26
|
readonly retryAfter?: number;
|
|
26
27
|
readonly headers?: Readonly<Record<string, string>>;
|
|
27
28
|
}
|
|
28
29
|
export interface FailOptions {
|
|
29
|
-
details?:
|
|
30
|
+
details?: ErrorDetails;
|
|
31
|
+
code?: string;
|
|
30
32
|
retryAfter?: number;
|
|
31
33
|
headers?: Record<string, string>;
|
|
32
34
|
}
|
|
@@ -34,6 +36,7 @@ declare const REPLY: unique symbol;
|
|
|
34
36
|
export interface ReplyOptions {
|
|
35
37
|
meta?: Record<string, unknown>;
|
|
36
38
|
etag?: string;
|
|
39
|
+
status?: 200 | 201 | 204;
|
|
37
40
|
}
|
|
38
41
|
export interface Reply<T> extends ReplyOptions {
|
|
39
42
|
readonly [REPLY]: true;
|
|
@@ -15,10 +15,18 @@ const retryAfterOf = (code, given) => {
|
|
|
15
15
|
return given;
|
|
16
16
|
return RETRY_AFTER_CODES.includes(code) ? DEFAULT_RETRY_AFTER_SECONDS : undefined;
|
|
17
17
|
};
|
|
18
|
+
const UPPER_SNAKE = /^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$/;
|
|
19
|
+
const wireCode = (code, override) => {
|
|
20
|
+
if (override === undefined)
|
|
21
|
+
return code;
|
|
22
|
+
if (ERROR_STATUS[code] >= 500 || !UPPER_SNAKE.test(override))
|
|
23
|
+
throw new Error(`fail code ${override}: UPPER_SNAKE on a 4xx only`);
|
|
24
|
+
return override;
|
|
25
|
+
};
|
|
18
26
|
// Returned, not thrown, so a route reads `throw fail(...)`; the kit turns it into the envelope.
|
|
19
27
|
export const fail = (code, message, options = {}) => Object.assign(new Error(message), {
|
|
20
28
|
[FAILURE]: true,
|
|
21
|
-
code,
|
|
29
|
+
code: wireCode(code, options.code),
|
|
22
30
|
status: ERROR_STATUS[code],
|
|
23
31
|
details: options.details,
|
|
24
32
|
retryAfter: retryAfterOf(code, options.retryAfter),
|
|
@@ -27,7 +35,11 @@ export const fail = (code, message, options = {}) => Object.assign(new Error(mes
|
|
|
27
35
|
export const isFailure = (err) => err instanceof Error && err[FAILURE] === true;
|
|
28
36
|
export const errorEnvelope = (failure, agcid) => {
|
|
29
37
|
const error = { code: failure.code, message: failure.message, agcid };
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
const details = failure.status >= 500 ? undefined : failure.details;
|
|
39
|
+
const filled = Array.isArray(details)
|
|
40
|
+
? details.length > 0
|
|
41
|
+
: details && Object.keys(details).length > 0;
|
|
42
|
+
if (details && filled)
|
|
43
|
+
error.details = details;
|
|
32
44
|
return { success: false, error };
|
|
33
45
|
};
|
|
@@ -2,15 +2,13 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const ErrorEnvelopeSchema: z.ZodObject<{
|
|
3
3
|
success: z.ZodLiteral<false>;
|
|
4
4
|
error: z.ZodObject<{
|
|
5
|
-
code: z.
|
|
6
|
-
[x: string]: string;
|
|
7
|
-
}>;
|
|
5
|
+
code: z.ZodString;
|
|
8
6
|
message: z.ZodString;
|
|
9
7
|
agcid: z.ZodString;
|
|
10
|
-
details: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
8
|
+
details: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodObject<{
|
|
11
9
|
field: z.ZodString;
|
|
12
10
|
message: z.ZodString;
|
|
13
|
-
}, z.core.$strict
|
|
11
|
+
}, z.core.$strict>>, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
14
12
|
}, z.core.$strict>;
|
|
15
13
|
}, z.core.$strict>;
|
|
16
14
|
export declare const OkEnvelopeSchema: z.ZodObject<{
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { AGCID_PATTERN } from '../agcid/header.js';
|
|
3
|
-
import { ERROR_CODES } from './codes.js';
|
|
4
3
|
const AgcidSchema = z.string().regex(AGCID_PATTERN);
|
|
5
|
-
const ErrorCodeSchema = z.
|
|
4
|
+
const ErrorCodeSchema = z.string().regex(/^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$/);
|
|
6
5
|
export const ErrorEnvelopeSchema = z.strictObject({
|
|
7
6
|
success: z.literal(false),
|
|
8
7
|
error: z.strictObject({
|
|
9
8
|
code: ErrorCodeSchema,
|
|
10
9
|
message: z.string().min(1),
|
|
11
10
|
agcid: AgcidSchema,
|
|
12
|
-
details: z
|
|
11
|
+
details: z
|
|
12
|
+
.union([
|
|
13
|
+
z.array(z.strictObject({ field: z.string(), message: z.string() })),
|
|
14
|
+
z.record(z.string(), z.unknown()),
|
|
15
|
+
])
|
|
16
|
+
.optional(),
|
|
13
17
|
}),
|
|
14
18
|
});
|
|
15
19
|
export const OkEnvelopeSchema = z.strictObject({
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { type Access, type Caller } from './auth/token-check.js';
|
|
|
4
4
|
export { type ArgValue } from './command/args.js';
|
|
5
5
|
export { type CliClient, type CliContext, type CliCreate, type CommandExtension, type CommandHandler, } from './command/command.types.js';
|
|
6
6
|
export { type Out } from './command/out.js';
|
|
7
|
-
export { type ExtensionInfo, type PartContext, type ServerPartKind, type SettingValue, } from './context/context.js';
|
|
7
|
+
export { type ExtensionInfo, type PartContext, type PlatformInfo, type ServerPartKind, type SettingValue, } from './context/context.js';
|
|
8
8
|
export { type Secrets } from './context/secrets.js';
|
|
9
9
|
export { createTestContext, type ClientCall, type LogEntry, type ScheduledJob, type TestCommandContext, type TestCommandOptions, type TestContext, type TestContextOptions, } from './context/test-context.js';
|
|
10
10
|
export { type DiscoveryDocument, type ExtensionRecord } from './discovery/discovery.schema.js';
|
|
@@ -17,7 +17,8 @@ export { type HealthBody, type HealthStatus } from './health/health.schema.js';
|
|
|
17
17
|
export { type Log, type LogFields } from './log/log.js';
|
|
18
18
|
export { type Span, type SpanRecord } from './log/span.js';
|
|
19
19
|
export { type McpContext, type ToolHandler, type ToolRegistrar, type ToolSpec, } from './mcp/tools.js';
|
|
20
|
-
export { versionPage, type PagesContext, type PagesSite } from './pages/pages.js';
|
|
20
|
+
export { versionPage, type PagesContext, type PagesEntry, type PagesSite } from './pages/pages.js';
|
|
21
|
+
export { siteFromDir, type SiteFromDirOptions } from './pages/site-from-dir.js';
|
|
21
22
|
export { type ApiCreate, type ApiHandler, type ApiPart } from './server/part.types.js';
|
|
22
23
|
export { type QueryResult, type Row, type Store } from './store/store.types.js';
|
|
23
24
|
export { startTestMcp, startTestServer, type TestMcp, type TestMcpOptions, type TestServer, type TestServerOptions, } from './testing/test-server.js';
|
package/dist/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export {} from './log/log.js';
|
|
|
19
19
|
export {} from './log/span.js';
|
|
20
20
|
export {} from './mcp/tools.js';
|
|
21
21
|
export { versionPage } from './pages/pages.js';
|
|
22
|
+
export { siteFromDir } from './pages/site-from-dir.js';
|
|
22
23
|
export {} from './server/part.types.js';
|
|
23
24
|
export {} from './store/store.types.js';
|
|
24
25
|
export { startTestMcp, startTestServer, } from './testing/test-server.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import {} from './pages.js';
|
|
3
|
+
import { typeOf } from './types.js';
|
|
4
|
+
const SCRIPT = /<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi;
|
|
5
|
+
const EXECUTES = /\btype\s*=\s*["']?(module|text\/javascript|application\/javascript)\b|^((?!\btype\s*=).)*$/is;
|
|
6
|
+
const sha256 = (text) => `'sha256-${createHash('sha256').update(text, 'utf8').digest('base64')}'`;
|
|
7
|
+
// CSP hashes of the inline scripts an HTML page runs, so script-src never needs 'unsafe-inline'.
|
|
8
|
+
export const inlineScriptHashes = (html) => {
|
|
9
|
+
const hashes = new Set();
|
|
10
|
+
for (const [, attrs = '', body = ''] of html.matchAll(SCRIPT))
|
|
11
|
+
if (body.trim() !== '' && !/\bsrc\s*=/i.test(attrs) && EXECUTES.test(attrs))
|
|
12
|
+
hashes.add(sha256(body));
|
|
13
|
+
return [...hashes];
|
|
14
|
+
};
|
|
15
|
+
// Path -> hashes, for the HTML entries that have inline scripts.
|
|
16
|
+
export const siteScriptHashes = (site) => {
|
|
17
|
+
const found = new Map();
|
|
18
|
+
for (const [path, entry] of Object.entries(site)) {
|
|
19
|
+
const { type = typeOf(path), body = entry } = typeof entry === 'object' && 'type' in entry ? entry : {};
|
|
20
|
+
if (!type.startsWith('text/html') || typeof body !== 'string')
|
|
21
|
+
continue;
|
|
22
|
+
const hashes = inlineScriptHashes(body);
|
|
23
|
+
if (hashes.length > 0)
|
|
24
|
+
found.set(path, hashes);
|
|
25
|
+
}
|
|
26
|
+
return found;
|
|
27
|
+
};
|
package/dist/pages/pages-app.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {} from 'node:http';
|
|
2
2
|
import {} from 'express';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { isAudience } from '../auth/part-auth.js';
|
|
5
5
|
import {} from '../runtime/build-info.js';
|
|
6
6
|
import { createPartApp } from '../server/app.js';
|
|
7
|
+
import { siteScriptHashes } from './inline-hashes.js';
|
|
7
8
|
import {} from './pages.js';
|
|
9
|
+
import { typeOf } from './types.js';
|
|
8
10
|
const WEB = ['http:', 'https:'];
|
|
9
11
|
const webUrl = (url) => {
|
|
10
12
|
const parsed = url && URL.canParse(url) ? new URL(url) : undefined;
|
|
@@ -17,15 +19,18 @@ export const platformSources = (env) => {
|
|
|
17
19
|
const audience = env['AGENTAGE_AUDIENCE'] ?? '';
|
|
18
20
|
return [issuer, isAudience(audience) ? `${scheme}//${audience}` : undefined].filter((source) => Boolean(source));
|
|
19
21
|
};
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
+
const BODY = z.union([z.string(), z.instanceof(Uint8Array)]);
|
|
23
|
+
const ENTRY = z.union([BODY, z.object({ type: z.string().min(1), body: BODY })]);
|
|
24
|
+
const SiteSchema = z.record(z.string().regex(/^\/[A-Za-z0-9._~$/-]*$/), ENTRY);
|
|
22
25
|
export const NOT_FOUND_PAGE = '<!doctype html>\n<html lang="en"><head><meta charset="utf-8"><title>Not found</title></head><body><p>Not found</p></body></html>\n';
|
|
23
26
|
const serve = (site) => (req, res, next) => {
|
|
24
|
-
const
|
|
25
|
-
if (
|
|
27
|
+
const entry = site[req.path];
|
|
28
|
+
if (entry === undefined)
|
|
26
29
|
return next();
|
|
27
|
-
|
|
28
|
-
res.
|
|
30
|
+
const { type, body } = typeof entry === 'object' && 'type' in entry ? entry : { body: entry };
|
|
31
|
+
res.type(type ?? typeOf(req.path)).setHeader('Cache-Control', 'no-cache');
|
|
32
|
+
// express sends a Buffer as bytes but a plain Uint8Array as JSON.
|
|
33
|
+
res.send(typeof body === 'string' ? body : Buffer.from(body.buffer, body.byteOffset, body.length));
|
|
29
34
|
};
|
|
30
35
|
const missing = (_req, res) => {
|
|
31
36
|
res.status(404).type('html').send(NOT_FOUND_PAGE);
|
|
@@ -33,13 +38,20 @@ const missing = (_req, res) => {
|
|
|
33
38
|
// Everything the gateway does not reserve comes here: a site map entry (typed by its extension), or an HTML 404.
|
|
34
39
|
export const createPagesApp = (options) => {
|
|
35
40
|
const site = SiteSchema.parse(options.site);
|
|
41
|
+
const hashes = siteScriptHashes(site);
|
|
42
|
+
const platform = options.platform ?? [];
|
|
43
|
+
const scripts = (req) => [
|
|
44
|
+
"'self'",
|
|
45
|
+
...platform,
|
|
46
|
+
...(hashes.get(new URL(req.url ?? '/', 'http://x').pathname) ?? []),
|
|
47
|
+
].join(' ');
|
|
36
48
|
return createPartApp({
|
|
37
49
|
...options,
|
|
38
50
|
part: 'pages',
|
|
39
51
|
helmet: {
|
|
40
52
|
contentSecurityPolicy: {
|
|
41
53
|
directives: {
|
|
42
|
-
scriptSrc: [
|
|
54
|
+
scriptSrc: [scripts],
|
|
43
55
|
connectSrc: ["'self'", ...(options.platform ?? [])],
|
|
44
56
|
upgradeInsecureRequests: null,
|
|
45
57
|
},
|
package/dist/pages/pages.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { type PartContext } from '../context/context.js';
|
|
2
2
|
export type PagesContext = PartContext;
|
|
3
|
-
export type
|
|
3
|
+
export type PagesEntry = string | Uint8Array | {
|
|
4
|
+
type: string;
|
|
5
|
+
body: string | Uint8Array;
|
|
6
|
+
};
|
|
7
|
+
export type PagesSite = Readonly<Record<string, PagesEntry>>;
|
|
4
8
|
export declare const versionPage: (ctx: PagesContext) => string;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { readdirSync, readFileSync } from 'node:fs';
|
|
2
|
+
import { join, relative, sep } from 'node:path';
|
|
3
|
+
import {} from './pages.js';
|
|
4
|
+
import { isText, typeOf } from './types.js';
|
|
5
|
+
const SITE_PLACEHOLDER = 'site-fqdn.sentinel.invalid';
|
|
6
|
+
// index.html is /, a/index.html and a.html are /a; every other file keeps its path.
|
|
7
|
+
const pathOf = (file) => `/${file.split(sep).join('/')}`.replace(/\/index\.html$|\.html$/, '') || '/';
|
|
8
|
+
const escaped = (token) => token.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
9
|
+
const entryOf = (bytes, type, own, rewrite, host) => {
|
|
10
|
+
const body = isText(type) ? bytes.toString('utf8').replace(rewrite, host) : bytes;
|
|
11
|
+
return own ? { type, body } : body;
|
|
12
|
+
};
|
|
13
|
+
// A static export (Next.js out/) as a pages site: text with the placeholder host rewritten, the rest as bytes.
|
|
14
|
+
export const siteFromDir = (dir, opts) => {
|
|
15
|
+
const host = new URL(opts.origin).host;
|
|
16
|
+
const rewrite = new RegExp(escaped(opts.placeholder ?? SITE_PLACEHOLDER), 'gi');
|
|
17
|
+
const files = readdirSync(dir, { recursive: true, withFileTypes: true }).filter((e) => e.isFile());
|
|
18
|
+
const site = {};
|
|
19
|
+
const from = {};
|
|
20
|
+
for (const file of files) {
|
|
21
|
+
const name = relative(dir, join(file.parentPath, file.name));
|
|
22
|
+
const path = pathOf(name);
|
|
23
|
+
if (path in from)
|
|
24
|
+
throw new Error(`siteFromDir: ${from[path]} and ${name} both map to ${path}`);
|
|
25
|
+
from[path] = name;
|
|
26
|
+
const own = opts.types?.[path];
|
|
27
|
+
const bytes = readFileSync(join(file.parentPath, file.name));
|
|
28
|
+
site[path] = entryOf(bytes, own ?? typeOf(path), own !== undefined, rewrite, host);
|
|
29
|
+
}
|
|
30
|
+
return site;
|
|
31
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { extname } from 'node:path';
|
|
2
|
+
// Content type by extension; an extension-less path is HTML, an unknown extension is bytes.
|
|
3
|
+
const TEXT_TYPES = {
|
|
4
|
+
'.html': 'text/html',
|
|
5
|
+
'.txt': 'text/plain',
|
|
6
|
+
'.md': 'text/markdown',
|
|
7
|
+
'.xml': 'application/xml',
|
|
8
|
+
'.json': 'application/json',
|
|
9
|
+
'.js': 'text/javascript',
|
|
10
|
+
'.mjs': 'text/javascript',
|
|
11
|
+
'.css': 'text/css',
|
|
12
|
+
'.svg': 'image/svg+xml',
|
|
13
|
+
'.webmanifest': 'application/manifest+json',
|
|
14
|
+
'.map': 'application/json',
|
|
15
|
+
};
|
|
16
|
+
export const TYPES = {
|
|
17
|
+
...TEXT_TYPES,
|
|
18
|
+
'.png': 'image/png',
|
|
19
|
+
'.jpg': 'image/jpeg',
|
|
20
|
+
'.jpeg': 'image/jpeg',
|
|
21
|
+
'.gif': 'image/gif',
|
|
22
|
+
'.webp': 'image/webp',
|
|
23
|
+
'.ico': 'image/x-icon',
|
|
24
|
+
'.mp4': 'video/mp4',
|
|
25
|
+
'.woff2': 'font/woff2',
|
|
26
|
+
'.woff': 'font/woff',
|
|
27
|
+
'.ttf': 'font/ttf',
|
|
28
|
+
'.avif': 'image/avif',
|
|
29
|
+
'.webm': 'video/webm',
|
|
30
|
+
};
|
|
31
|
+
const TEXT_APPLICATION = /^application\/(json|javascript|xml|manifest\+json)$|\+(json|xml)$/;
|
|
32
|
+
// A text type is read as a string (parameters like charset ignored); every other type as bytes.
|
|
33
|
+
export const isText = (type) => {
|
|
34
|
+
const media = (type.split(';')[0] ?? '').trim().toLowerCase();
|
|
35
|
+
return media.startsWith('text/') || TEXT_APPLICATION.test(media);
|
|
36
|
+
};
|
|
37
|
+
export const typeOf = (path) => {
|
|
38
|
+
const ext = extname(path);
|
|
39
|
+
return TYPES[ext] ?? (ext === '' ? 'text/html' : 'application/octet-stream');
|
|
40
|
+
};
|
|
@@ -10,6 +10,7 @@ import { createSpan } from '../log/span.js';
|
|
|
10
10
|
import { createMcpApp } from '../mcp/mcp-app.js';
|
|
11
11
|
import { createToolRegistry } from '../mcp/tools.js';
|
|
12
12
|
import { createPagesApp, platformSources } from '../pages/pages-app.js';
|
|
13
|
+
import {} from '../pages/pages.js';
|
|
13
14
|
import { createApiApp, createPartApp } from '../server/app.js';
|
|
14
15
|
import { mountApi } from '../server/api-routes.js';
|
|
15
16
|
import {} from './build-info.js';
|
|
@@ -24,7 +25,7 @@ const api = async (input) => {
|
|
|
24
25
|
const { router, routes, documents } = await mountApi(ctx, (api) => callCreate(input, 'api', api));
|
|
25
26
|
// Declared routes guard at their own scope, whatever the committed file says.
|
|
26
27
|
const openapi = routes.length > 0 ? generatedOpenapi(input.pkg, routes) : input.openapi;
|
|
27
|
-
return { app: createApiApp({ ...input.base, router, openapi, wellKnown: documents }) };
|
|
28
|
+
return { app: createApiApp({ ...input.base, router, routes, openapi, wellKnown: documents }) };
|
|
28
29
|
};
|
|
29
30
|
const mcp = async (input) => {
|
|
30
31
|
const registry = createToolRegistry();
|
package/dist/runtime/run-part.js
CHANGED
|
@@ -4,7 +4,7 @@ import { readSecrets, SECRETS_DIR } from '../context/secrets.js';
|
|
|
4
4
|
import { settingsFromEnv } from '../context/settings.js';
|
|
5
5
|
import { DEFAULT_RECORD_FILE, loadRecord } from '../discovery/discovery.js';
|
|
6
6
|
import {} from '../discovery/discovery.schema.js';
|
|
7
|
-
import { declaredScopes, partAuth } from '../auth/part-auth.js';
|
|
7
|
+
import { declaredScopes, partAuth, platformOf } from '../auth/part-auth.js';
|
|
8
8
|
import { readOpenapi } from '../discovery/openapi.js';
|
|
9
9
|
import { createLog } from '../log/log.js';
|
|
10
10
|
import {} from '../manifest/entry.js';
|
|
@@ -42,6 +42,7 @@ const contextFor = (start, part, store) => createContext({
|
|
|
42
42
|
settings: settingsFromEnv(start.pkg, start.env, start.log),
|
|
43
43
|
store,
|
|
44
44
|
secrets: start.secrets,
|
|
45
|
+
platform: platformOf(start.env),
|
|
45
46
|
});
|
|
46
47
|
// Built on first use, so the ui runner, which never asks, has no ctx at all.
|
|
47
48
|
const lazyContext = (start, store) => {
|
|
@@ -16,14 +16,27 @@ const inputOf = ({ method, spec }, query, body) => {
|
|
|
16
16
|
// Validated in, the handler's data (bare or a reply) parsed by its output schema and sent in the envelope.
|
|
17
17
|
const handlerOf = (ctx, entry) => async (req, res) => {
|
|
18
18
|
const input = inputOf(entry, req.query, req.body);
|
|
19
|
+
const { query: shape } = entry.spec;
|
|
20
|
+
const query = shape ? parse(shape, req.query, 'Invalid query') : {};
|
|
19
21
|
const caller = ctx.auth.caller(req);
|
|
20
22
|
const { params: schema } = entry.spec;
|
|
21
23
|
const params = schema ? parse(schema, req.params, 'Invalid path') : req.params;
|
|
22
24
|
const ifMatch = req.get('if-match');
|
|
23
|
-
const answer = await entry.handler({
|
|
24
|
-
|
|
25
|
+
const answer = await entry.handler({
|
|
26
|
+
input,
|
|
27
|
+
query,
|
|
28
|
+
params,
|
|
29
|
+
caller,
|
|
30
|
+
ifMatch,
|
|
31
|
+
ip: req.ip ?? '',
|
|
32
|
+
header: (name) => req.get(name),
|
|
33
|
+
});
|
|
34
|
+
const { data, meta, etag, status = 200 } = isReply(answer) ? answer : reply(answer);
|
|
25
35
|
if (etag)
|
|
26
36
|
res.setHeader('ETag', etag);
|
|
37
|
+
if (status === 204)
|
|
38
|
+
return void res.status(204).end();
|
|
39
|
+
res.status(status);
|
|
27
40
|
res.json(ok(entry.spec.output ? entry.spec.output.parse(data) : data, meta));
|
|
28
41
|
};
|
|
29
42
|
// /items/{id} as Express writes it.
|
package/dist/server/app.d.ts
CHANGED
|
@@ -30,6 +30,10 @@ export interface ApiAppOptions extends PartAppBase {
|
|
|
30
30
|
router: ApiHandler;
|
|
31
31
|
openapi?: Record<string, unknown> | null;
|
|
32
32
|
wellKnown?: WellKnownEntry[];
|
|
33
|
+
routes?: {
|
|
34
|
+
method: string;
|
|
35
|
+
path: string;
|
|
36
|
+
}[];
|
|
33
37
|
}
|
|
34
38
|
export declare const PUBLIC_CORS: CorsOptions;
|
|
35
39
|
export declare const BODY_LIMIT = "1mb";
|
package/dist/server/app.js
CHANGED
|
@@ -3,7 +3,7 @@ import express, {} from 'express';
|
|
|
3
3
|
import helmet, {} from 'helmet';
|
|
4
4
|
import {} from '../api/well-known.js';
|
|
5
5
|
import { agcidMiddleware } from '../agcid/scope.js';
|
|
6
|
-
import { routeAccess } from '../auth/route-access.js';
|
|
6
|
+
import { routeAccess, sameShape } from '../auth/route-access.js';
|
|
7
7
|
import { setCaller } from '../auth/token-check.js';
|
|
8
8
|
import { discoveryDocument, recordOf, } from '../discovery/discovery.js';
|
|
9
9
|
import {} from '../discovery/discovery.schema.js';
|
|
@@ -18,7 +18,14 @@ import {} from './part.types.js';
|
|
|
18
18
|
export const PUBLIC_CORS = {
|
|
19
19
|
origin: '*',
|
|
20
20
|
credentials: false,
|
|
21
|
-
allowedHeaders: [
|
|
21
|
+
allowedHeaders: [
|
|
22
|
+
'Authorization',
|
|
23
|
+
'Content-Type',
|
|
24
|
+
'agcid',
|
|
25
|
+
'traceparent',
|
|
26
|
+
'If-Match',
|
|
27
|
+
'If-None-Match',
|
|
28
|
+
],
|
|
22
29
|
exposedHeaders: ['agcid', 'ETag', 'Retry-After', 'RateLimit', 'WWW-Authenticate'],
|
|
23
30
|
};
|
|
24
31
|
// api-standards section 5: parts take bearer tokens only, so no handler or log ever sees a cookie.
|
|
@@ -78,6 +85,10 @@ const wellKnownHandler = (render) => async (_req, res) => {
|
|
|
78
85
|
const routeGuard = (options) => async (req, res, next) => {
|
|
79
86
|
if (!options.tokenCheck)
|
|
80
87
|
return next();
|
|
88
|
+
const { routes } = options;
|
|
89
|
+
const known = routes?.some((r) => r.method === req.method.toLowerCase() && sameShape(r.path, req.path));
|
|
90
|
+
if (routes?.length && !known)
|
|
91
|
+
return next();
|
|
81
92
|
const access = routeAccess(options.openapi, req.method, `/api/v1${req.path}`);
|
|
82
93
|
const caller = await options.tokenCheck(req.get('authorization'), access);
|
|
83
94
|
if (caller)
|
|
@@ -43,7 +43,7 @@ export const startTestServer = async (options) => {
|
|
|
43
43
|
openapi: generatedOpenapi(pkg, mounted.routes),
|
|
44
44
|
};
|
|
45
45
|
const base = { pkg, build: TEST_BUILD, log: ctx.log, wellKnown: mounted.documents };
|
|
46
|
-
return startOn(createApiApp({ ...base, router: mounted.router, ...guard }));
|
|
46
|
+
return startOn(createApiApp({ ...base, router: mounted.router, routes: mounted.routes, ...guard }));
|
|
47
47
|
};
|
|
48
48
|
// Runs an mcp part's create(ctx) inside the kit's real /mcp app: tools named {id}__{name}.
|
|
49
49
|
export const startTestMcp = async (options) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentage/extension",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "The agentage extension kit: create(ctx) per part (pages, ui, api, mcp, worker, cli), the store, /health, discovery, the envelope, and the build tool with up and token",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,18 +13,7 @@
|
|
|
13
13
|
"properties": {
|
|
14
14
|
"code": {
|
|
15
15
|
"type": "string",
|
|
16
|
-
"
|
|
17
|
-
"VALIDATION_ERROR",
|
|
18
|
-
"UNAUTHORIZED",
|
|
19
|
-
"FORBIDDEN",
|
|
20
|
-
"NOT_FOUND",
|
|
21
|
-
"CONFLICT",
|
|
22
|
-
"PRECONDITION_FAILED",
|
|
23
|
-
"PAYLOAD_TOO_LARGE",
|
|
24
|
-
"RATE_LIMITED",
|
|
25
|
-
"INTERNAL",
|
|
26
|
-
"UNAVAILABLE"
|
|
27
|
-
]
|
|
16
|
+
"pattern": "^[A-Z][A-Z0-9]*(_[A-Z0-9]+)*$"
|
|
28
17
|
},
|
|
29
18
|
"message": {
|
|
30
19
|
"type": "string",
|
|
@@ -35,23 +24,34 @@
|
|
|
35
24
|
"pattern": "^[A-Za-z0-9._:-]{8,128}$"
|
|
36
25
|
},
|
|
37
26
|
"details": {
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
27
|
+
"anyOf": [
|
|
28
|
+
{
|
|
29
|
+
"type": "array",
|
|
30
|
+
"items": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"properties": {
|
|
33
|
+
"field": {
|
|
34
|
+
"type": "string"
|
|
35
|
+
},
|
|
36
|
+
"message": {
|
|
37
|
+
"type": "string"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"required": [
|
|
41
|
+
"field",
|
|
42
|
+
"message"
|
|
43
|
+
],
|
|
44
|
+
"additionalProperties": false
|
|
47
45
|
}
|
|
48
46
|
},
|
|
49
|
-
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
{
|
|
48
|
+
"type": "object",
|
|
49
|
+
"propertyNames": {
|
|
50
|
+
"type": "string"
|
|
51
|
+
},
|
|
52
|
+
"additionalProperties": {}
|
|
53
|
+
}
|
|
54
|
+
]
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
57
|
"required": [
|