@panneau/protocol 5.0.0-alpha.14 → 5.0.0-alpha.16
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/addresses.d.ts +23 -0
- package/dist/addresses.d.ts.map +1 -0
- package/dist/addresses.js +52 -0
- package/dist/addresses.js.map +1 -0
- package/dist/conformance/index.d.ts.map +1 -1
- package/dist/conformance/index.js +222 -2
- package/dist/conformance/index.js.map +1 -1
- package/dist/constants.d.ts +63 -2
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +94 -3
- package/dist/constants.js.map +1 -1
- package/dist/currencies.d.ts +22 -0
- package/dist/currencies.d.ts.map +1 -0
- package/dist/currencies.js +231 -0
- package/dist/currencies.js.map +1 -0
- package/dist/index.js +7 -4
- package/dist/links.d.ts +38 -0
- package/dist/links.d.ts.map +1 -0
- package/dist/links.js +65 -0
- package/dist/links.js.map +1 -0
- package/dist/lint.js +6 -2
- package/dist/lint.js.map +1 -1
- package/dist/mock/auth.d.ts +71 -0
- package/dist/mock/auth.d.ts.map +1 -0
- package/dist/mock/auth.js +346 -0
- package/dist/mock/auth.js.map +1 -0
- package/dist/mock/index.d.ts +8 -0
- package/dist/mock/index.d.ts.map +1 -1
- package/dist/mock/index.js +27 -3
- package/dist/mock/index.js.map +1 -1
- package/dist/openapi.d.ts.map +1 -1
- package/dist/openapi.js +227 -30
- package/dist/openapi.js.map +1 -1
- package/dist/query.d.ts +4 -0
- package/dist/query.d.ts.map +1 -1
- package/dist/query.js +23 -7
- package/dist/query.js.map +1 -1
- package/dist/rules.d.ts +4 -1
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +165 -7
- package/dist/rules.js.map +1 -1
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/runtime/index.js +5 -2
- package/dist/schemas/action.d.ts +46 -1
- package/dist/schemas/action.d.ts.map +1 -1
- package/dist/schemas/api.d.ts +78 -3
- package/dist/schemas/api.d.ts.map +1 -1
- package/dist/schemas/api.js +58 -1
- package/dist/schemas/api.js.map +1 -1
- package/dist/schemas/boot.d.ts +1 -0
- package/dist/schemas/boot.d.ts.map +1 -1
- package/dist/schemas/definition.d.ts +95 -3
- package/dist/schemas/definition.d.ts.map +1 -1
- package/dist/schemas/definition.js +6 -5
- package/dist/schemas/definition.js.map +1 -1
- package/dist/schemas/field.d.ts +193 -2
- package/dist/schemas/field.d.ts.map +1 -1
- package/dist/schemas/field.js +91 -7
- package/dist/schemas/field.js.map +1 -1
- package/dist/schemas/index.d.ts +476 -14
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +20 -4
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/list.d.ts +2 -2
- package/dist/schemas/resource.d.ts +93 -3
- package/dist/schemas/resource.d.ts.map +1 -1
- package/dist/validate.d.ts +2 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +18 -4
- package/dist/validate.js.map +1 -1
- package/package.json +1 -1
- package/schema/boot.schema.json +167 -2
- package/schema/definition.schema.json +167 -2
- package/schema/openapi.json +1842 -117
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAsBH,cAAc,EAoBjB,MAAM,OAAO,CAAC;AACf,OAAO,EAAa,SAAS,EAA8B,MAAM,UAAU,CAAC;AAC5E,OAAO,EAQH,QAAQ,EAKX,MAAM,cAAc,CAAC;AACtB,OAAO,EAEH,SAAS,EAGT,KAAK,EAOR,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,UAAU,EAAE,MA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyFY,CAAC;AAEtC,0FAA0F;AAC1F,wBAAgB,oBAAoB;QACE,MAAM;4GAK3C"}
|
package/dist/schemas/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Abilities, Condition, Id, Option, RouteReference } from "./common.js";
|
|
2
|
-
import { BlockType, Field, RichTextSettings, RichTextStyle, Rule } from "./field.js";
|
|
2
|
+
import { AddressSettings, BlockType, DateRangeSettings, DurationSettings, Field, LinkSettings, LinkTypeSetting, MoneySettings, RichTextSettings, RichTextStyle, Rule } from "./field.js";
|
|
3
3
|
import { actionJsonRules } from "./jsonRules.js";
|
|
4
4
|
import { LayoutNode } from "./layout.js";
|
|
5
5
|
import { Action, ActionConfirm, ActionPlacement, ActionScope } from "./action.js";
|
|
@@ -7,7 +7,7 @@ import { Column, Filter, ListCalendar, ListDefinition } from "./list.js";
|
|
|
7
7
|
import { Resource, ResourceFeatures } from "./resource.js";
|
|
8
8
|
import { DefinitionTheme, Theme, ThemeFont, ThemeFontFace, ThemeFontStylesheet, ThemeTokens, ToneInput, ToneValues } from "./theme.js";
|
|
9
9
|
import { Auth, AuthProvider, AuthToken, ContextOption, ContextParam, Definition, DefinitionContext, MenuItem, Page, Uploads, User, Widget } from "./definition.js";
|
|
10
|
-
import { ActionItemResult, ActionRequest, ActionResult, ActionRun, ActionRunResponse, ContextOptionsResponse, CursorPagination, EmbedResponse, EmbedValue, FieldCheckRequest, FieldCheckResponse, Item, ItemResponse, ListResponse, LocationValue, MediaInfo, MediaItem, MediaReference, MediaTransform, Pagination, PreviewResponse, Problem, SearchResponse, Selection, Session, StoredFile, Upload, UploadReference, UploadResponse, UploadSignRequest, UploadSignResponse } from "./api.js";
|
|
10
|
+
import { ActionItemResult, ActionRequest, ActionResult, ActionRun, ActionRunResponse, AddressValue, ContextOptionsResponse, CursorPagination, DateRangeValue, EmbedResponse, EmbedValue, FieldCheckRequest, FieldCheckResponse, Item, ItemResponse, LinkValue, ListResponse, LocationValue, MediaInfo, MediaItem, MediaReference, MediaTransform, MoneyValue, Pagination, Passkey, PreviewResponse, Problem, RecoveryCodes, SearchResponse, Selection, Session, StoredFile, TwoFactorChallenge, TwoFactorSetup, TwoFactorStatus, Upload, UploadReference, UploadResponse, UploadSignRequest, UploadSignResponse, WebAuthnOptions } from "./api.js";
|
|
11
11
|
import { BootConfig } from "./boot.js";
|
|
12
12
|
import { z } from "zod";
|
|
13
13
|
//#region src/schemas/index.ts
|
|
@@ -23,6 +23,12 @@ var namedSchemas = {
|
|
|
23
23
|
Field,
|
|
24
24
|
RichTextStyle,
|
|
25
25
|
RichTextSettings,
|
|
26
|
+
LinkTypeSetting,
|
|
27
|
+
LinkSettings,
|
|
28
|
+
AddressSettings,
|
|
29
|
+
DateRangeSettings,
|
|
30
|
+
MoneySettings,
|
|
31
|
+
DurationSettings,
|
|
26
32
|
LayoutNode,
|
|
27
33
|
Column,
|
|
28
34
|
Filter,
|
|
@@ -79,12 +85,22 @@ var namedSchemas = {
|
|
|
79
85
|
MediaItem,
|
|
80
86
|
MediaReference,
|
|
81
87
|
Session,
|
|
88
|
+
TwoFactorChallenge,
|
|
89
|
+
TwoFactorStatus,
|
|
90
|
+
TwoFactorSetup,
|
|
91
|
+
RecoveryCodes,
|
|
92
|
+
WebAuthnOptions,
|
|
93
|
+
Passkey,
|
|
82
94
|
SearchResponse,
|
|
83
95
|
ContextOptionsResponse,
|
|
84
96
|
PreviewResponse,
|
|
85
97
|
EmbedValue,
|
|
86
98
|
EmbedResponse,
|
|
87
|
-
LocationValue
|
|
99
|
+
LocationValue,
|
|
100
|
+
AddressValue,
|
|
101
|
+
LinkValue,
|
|
102
|
+
DateRangeValue,
|
|
103
|
+
MoneyValue
|
|
88
104
|
};
|
|
89
105
|
/** A registry of the named schemas, used to reference them by name in generated files. */
|
|
90
106
|
function createSchemaRegistry() {
|
|
@@ -97,6 +113,6 @@ function createSchemaRegistry() {
|
|
|
97
113
|
return registry;
|
|
98
114
|
}
|
|
99
115
|
//#endregion
|
|
100
|
-
export { Abilities, Action, ActionConfirm, ActionItemResult, ActionPlacement, ActionRequest, ActionResult, ActionRun, ActionRunResponse, ActionScope, Auth, AuthProvider, AuthToken, BlockType, BootConfig, Column, Condition, ContextOption, ContextOptionsResponse, ContextParam, CursorPagination, Definition, DefinitionContext, DefinitionTheme, EmbedResponse, EmbedValue, Field, FieldCheckRequest, FieldCheckResponse, Filter, Id, Item, ItemResponse, LayoutNode, ListCalendar, ListDefinition, ListResponse, LocationValue, MediaInfo, MediaItem, MediaReference, MediaTransform, MenuItem, Option, Page, Pagination, PreviewResponse, Problem, Resource, ResourceFeatures, RichTextSettings, RichTextStyle, RouteReference, Rule, SearchResponse, Selection, Session, StoredFile, Theme, ThemeFont, ThemeFontFace, ThemeFontStylesheet, ThemeTokens, ToneInput, ToneValues, Upload, UploadReference, UploadResponse, UploadSignRequest, UploadSignResponse, Uploads, User, Widget, createSchemaRegistry, namedSchemas };
|
|
116
|
+
export { Abilities, Action, ActionConfirm, ActionItemResult, ActionPlacement, ActionRequest, ActionResult, ActionRun, ActionRunResponse, ActionScope, AddressSettings, AddressValue, Auth, AuthProvider, AuthToken, BlockType, BootConfig, Column, Condition, ContextOption, ContextOptionsResponse, ContextParam, CursorPagination, DateRangeSettings, DateRangeValue, Definition, DefinitionContext, DefinitionTheme, DurationSettings, EmbedResponse, EmbedValue, Field, FieldCheckRequest, FieldCheckResponse, Filter, Id, Item, ItemResponse, LayoutNode, LinkSettings, LinkTypeSetting, LinkValue, ListCalendar, ListDefinition, ListResponse, LocationValue, MediaInfo, MediaItem, MediaReference, MediaTransform, MenuItem, MoneySettings, MoneyValue, Option, Page, Pagination, Passkey, PreviewResponse, Problem, RecoveryCodes, Resource, ResourceFeatures, RichTextSettings, RichTextStyle, RouteReference, Rule, SearchResponse, Selection, Session, StoredFile, Theme, ThemeFont, ThemeFontFace, ThemeFontStylesheet, ThemeTokens, ToneInput, ToneValues, TwoFactorChallenge, TwoFactorSetup, TwoFactorStatus, Upload, UploadReference, UploadResponse, UploadSignRequest, UploadSignResponse, Uploads, User, WebAuthnOptions, Widget, createSchemaRegistry, namedSchemas };
|
|
101
117
|
|
|
102
118
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/schemas/index.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { Action, ActionConfirm, ActionPlacement, ActionScope } from './action';\nimport {\n ActionItemResult,\n ActionRequest,\n ActionResult,\n ActionRun,\n ActionRunResponse,\n ContextOptionsResponse,\n CursorPagination,\n EmbedResponse,\n EmbedValue,\n FieldCheckRequest,\n FieldCheckResponse,\n Item,\n ItemResponse,\n ListResponse,\n LocationValue,\n MediaInfo,\n MediaItem,\n MediaReference,\n MediaTransform,\n Pagination,\n PreviewResponse,\n Problem,\n SearchResponse,\n Selection,\n Session,\n StoredFile,\n Upload,\n UploadReference,\n UploadResponse,\n UploadSignRequest,\n UploadSignResponse,\n} from './api';\nimport { Abilities, Condition, Id, Option, RouteReference } from './common';\nimport {\n Auth,\n AuthProvider,\n AuthToken,\n ContextOption,\n ContextParam,\n Definition,\n DefinitionContext,\n MenuItem,\n Page,\n Uploads,\n User,\n Widget,\n} from './definition';\nimport {
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/schemas/index.ts"],"sourcesContent":["import { z } from 'zod';\n\nimport { Action, ActionConfirm, ActionPlacement, ActionScope } from './action';\nimport {\n ActionItemResult,\n ActionRequest,\n ActionResult,\n ActionRun,\n ActionRunResponse,\n AddressValue,\n ContextOptionsResponse,\n CursorPagination,\n DateRangeValue,\n EmbedResponse,\n EmbedValue,\n FieldCheckRequest,\n FieldCheckResponse,\n Item,\n ItemResponse,\n LinkValue,\n ListResponse,\n LocationValue,\n MediaInfo,\n MediaItem,\n MediaReference,\n MediaTransform,\n MoneyValue,\n Pagination,\n Passkey,\n PreviewResponse,\n Problem,\n RecoveryCodes,\n SearchResponse,\n Selection,\n Session,\n StoredFile,\n TwoFactorChallenge,\n TwoFactorSetup,\n TwoFactorStatus,\n Upload,\n UploadReference,\n UploadResponse,\n UploadSignRequest,\n UploadSignResponse,\n WebAuthnOptions,\n} from './api';\nimport { Abilities, Condition, Id, Option, RouteReference } from './common';\nimport {\n Auth,\n AuthProvider,\n AuthToken,\n ContextOption,\n ContextParam,\n Definition,\n DefinitionContext,\n MenuItem,\n Page,\n Uploads,\n User,\n Widget,\n} from './definition';\nimport {\n AddressSettings,\n BlockType,\n DateRangeSettings,\n DurationSettings,\n Field,\n LinkSettings,\n LinkTypeSetting,\n MoneySettings,\n RichTextSettings,\n RichTextStyle,\n Rule,\n} from './field';\nimport { actionJsonRules } from './jsonRules';\nimport { LayoutNode } from './layout';\nimport { Column, Filter, ListCalendar, ListDefinition } from './list';\nimport { Resource, ResourceFeatures } from './resource';\nimport {\n DefinitionTheme,\n Theme,\n ThemeFont,\n ThemeFontFace,\n ThemeFontStylesheet,\n ThemeTokens,\n ToneInput,\n ToneValues,\n} from './theme';\n\nexport * from './common';\nexport * from './field';\nexport * from './layout';\nexport * from './list';\nexport * from './action';\nexport * from './resource';\nexport * from './theme';\nexport * from './definition';\nexport * from './api';\nexport * from './boot';\n\n/** The named schemas of the protocol, as they appear in the generated JSON Schema and OpenAPI files. */\nexport const namedSchemas = {\n Id,\n Abilities,\n RouteReference,\n Condition,\n Option,\n Rule,\n BlockType,\n Field,\n RichTextStyle,\n RichTextSettings,\n LinkTypeSetting,\n LinkSettings,\n AddressSettings,\n DateRangeSettings,\n MoneySettings,\n DurationSettings,\n LayoutNode,\n Column,\n Filter,\n ListCalendar,\n ListDefinition,\n ActionScope,\n ActionPlacement,\n ActionConfirm,\n Action,\n ResourceFeatures,\n Resource,\n User,\n AuthProvider,\n AuthToken,\n Auth,\n MenuItem,\n Page,\n Widget,\n Uploads,\n ContextOption,\n ContextParam,\n DefinitionContext,\n ThemeTokens,\n ToneValues,\n ToneInput,\n ThemeFontFace,\n ThemeFontStylesheet,\n ThemeFont,\n Theme,\n DefinitionTheme,\n Definition,\n Item,\n Pagination,\n CursorPagination,\n ItemResponse,\n ListResponse,\n Problem,\n Selection,\n ActionRequest,\n ActionItemResult,\n ActionResult,\n ActionRun,\n ActionRunResponse,\n MediaTransform,\n StoredFile,\n UploadReference,\n Upload,\n UploadResponse,\n UploadSignRequest,\n UploadSignResponse,\n FieldCheckRequest,\n FieldCheckResponse,\n MediaInfo,\n MediaItem,\n MediaReference,\n Session,\n TwoFactorChallenge,\n TwoFactorStatus,\n TwoFactorSetup,\n RecoveryCodes,\n WebAuthnOptions,\n Passkey,\n SearchResponse,\n ContextOptionsResponse,\n PreviewResponse,\n EmbedValue,\n EmbedResponse,\n LocationValue,\n AddressValue,\n LinkValue,\n DateRangeValue,\n MoneyValue,\n} satisfies Record<string, z.ZodType>;\n\n/** A registry of the named schemas, used to reference them by name in generated files. */\nexport function createSchemaRegistry() {\n const registry = z.registry<{ id: string } & Record<string, unknown>>();\n Object.entries(namedSchemas).forEach(([id, schema]) => registry.add(schema, { id }));\n // Checks that Zod makes in code, which the JSON Schema of the definition must make too.\n registry.add(Action, { id: 'Action', ...actionJsonRules });\n return registry;\n}\n"],"mappings":";;;;;;;;;;;;;;AAqGA,IAAa,eAAe;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;;AAGA,SAAgB,uBAAuB;CACnC,MAAM,WAAW,EAAE,SAAmD;CACtE,OAAO,QAAQ,YAAY,CAAC,CAAC,SAAS,CAAC,IAAI,YAAY,SAAS,IAAI,QAAQ,EAAE,GAAG,CAAC,CAAC;CAEnF,SAAS,IAAI,QAAQ;EAAE,IAAI;EAAU,GAAG;CAAgB,CAAC;CACzD,OAAO;AACX"}
|
package/dist/schemas/list.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export declare const Column: z.ZodObject<{
|
|
|
8
8
|
width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
9
9
|
align: z.ZodOptional<z.ZodEnum<{
|
|
10
10
|
start: "start";
|
|
11
|
-
center: "center";
|
|
12
11
|
end: "end";
|
|
12
|
+
center: "center";
|
|
13
13
|
}>>;
|
|
14
14
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
15
15
|
hideable: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -44,8 +44,8 @@ export declare const ListDefinition: z.ZodObject<{
|
|
|
44
44
|
width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
45
45
|
align: z.ZodOptional<z.ZodEnum<{
|
|
46
46
|
start: "start";
|
|
47
|
-
center: "center";
|
|
48
47
|
end: "end";
|
|
48
|
+
center: "center";
|
|
49
49
|
}>>;
|
|
50
50
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
51
51
|
hideable: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -73,7 +73,6 @@ export declare const Resource: z.ZodObject<{
|
|
|
73
73
|
rule: z.ZodEnum<{
|
|
74
74
|
email: "email";
|
|
75
75
|
url: "url";
|
|
76
|
-
tel: "tel";
|
|
77
76
|
json: "json";
|
|
78
77
|
}>;
|
|
79
78
|
message: z.ZodOptional<z.ZodString>;
|
|
@@ -81,6 +80,34 @@ export declare const Resource: z.ZodObject<{
|
|
|
81
80
|
update: "update";
|
|
82
81
|
create: "create";
|
|
83
82
|
}>>;
|
|
83
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
84
|
+
rule: z.ZodLiteral<"tel">;
|
|
85
|
+
extension: z.ZodOptional<z.ZodBoolean>;
|
|
86
|
+
message: z.ZodOptional<z.ZodString>;
|
|
87
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
88
|
+
update: "update";
|
|
89
|
+
create: "create";
|
|
90
|
+
}>>;
|
|
91
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
92
|
+
rule: z.ZodLiteral<"daterange">;
|
|
93
|
+
open: z.ZodOptional<z.ZodEnum<{
|
|
94
|
+
start: "start";
|
|
95
|
+
end: "end";
|
|
96
|
+
both: "both";
|
|
97
|
+
}>>;
|
|
98
|
+
message: z.ZodOptional<z.ZodString>;
|
|
99
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
100
|
+
update: "update";
|
|
101
|
+
create: "create";
|
|
102
|
+
}>>;
|
|
103
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
104
|
+
rule: z.ZodLiteral<"money">;
|
|
105
|
+
currencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
106
|
+
message: z.ZodOptional<z.ZodString>;
|
|
107
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
108
|
+
update: "update";
|
|
109
|
+
create: "create";
|
|
110
|
+
}>>;
|
|
84
111
|
}, z.core.$loose>, z.ZodObject<{
|
|
85
112
|
rule: z.ZodLiteral<"in">;
|
|
86
113
|
value: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
@@ -118,6 +145,16 @@ export declare const Resource: z.ZodObject<{
|
|
|
118
145
|
update: "update";
|
|
119
146
|
create: "create";
|
|
120
147
|
}>>;
|
|
148
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
149
|
+
rule: z.ZodLiteral<"postalCode">;
|
|
150
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
151
|
+
field: z.ZodString;
|
|
152
|
+
}, z.core.$loose>]>>;
|
|
153
|
+
message: z.ZodOptional<z.ZodString>;
|
|
154
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
155
|
+
update: "update";
|
|
156
|
+
create: "create";
|
|
157
|
+
}>>;
|
|
121
158
|
}, z.core.$loose>, z.ZodObject<{
|
|
122
159
|
rule: z.ZodLiteral<"crop">;
|
|
123
160
|
value: z.ZodObject<{
|
|
@@ -129,6 +166,14 @@ export declare const Resource: z.ZodObject<{
|
|
|
129
166
|
update: "update";
|
|
130
167
|
create: "create";
|
|
131
168
|
}>>;
|
|
169
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
170
|
+
rule: z.ZodLiteral<"providers">;
|
|
171
|
+
value: z.ZodArray<z.ZodString>;
|
|
172
|
+
message: z.ZodOptional<z.ZodString>;
|
|
173
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
174
|
+
update: "update";
|
|
175
|
+
create: "create";
|
|
176
|
+
}>>;
|
|
132
177
|
}, z.core.$loose>, z.ZodObject<{
|
|
133
178
|
rule: z.ZodString;
|
|
134
179
|
message: z.ZodOptional<z.ZodString>;
|
|
@@ -205,8 +250,8 @@ export declare const Resource: z.ZodObject<{
|
|
|
205
250
|
width: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
206
251
|
align: z.ZodOptional<z.ZodEnum<{
|
|
207
252
|
start: "start";
|
|
208
|
-
center: "center";
|
|
209
253
|
end: "end";
|
|
254
|
+
center: "center";
|
|
210
255
|
}>>;
|
|
211
256
|
hidden: z.ZodOptional<z.ZodBoolean>;
|
|
212
257
|
hideable: z.ZodOptional<z.ZodBoolean>;
|
|
@@ -314,7 +359,6 @@ export declare const Resource: z.ZodObject<{
|
|
|
314
359
|
rule: z.ZodEnum<{
|
|
315
360
|
email: "email";
|
|
316
361
|
url: "url";
|
|
317
|
-
tel: "tel";
|
|
318
362
|
json: "json";
|
|
319
363
|
}>;
|
|
320
364
|
message: z.ZodOptional<z.ZodString>;
|
|
@@ -322,6 +366,34 @@ export declare const Resource: z.ZodObject<{
|
|
|
322
366
|
update: "update";
|
|
323
367
|
create: "create";
|
|
324
368
|
}>>;
|
|
369
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
370
|
+
rule: z.ZodLiteral<"tel">;
|
|
371
|
+
extension: z.ZodOptional<z.ZodBoolean>;
|
|
372
|
+
message: z.ZodOptional<z.ZodString>;
|
|
373
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
374
|
+
update: "update";
|
|
375
|
+
create: "create";
|
|
376
|
+
}>>;
|
|
377
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
378
|
+
rule: z.ZodLiteral<"daterange">;
|
|
379
|
+
open: z.ZodOptional<z.ZodEnum<{
|
|
380
|
+
start: "start";
|
|
381
|
+
end: "end";
|
|
382
|
+
both: "both";
|
|
383
|
+
}>>;
|
|
384
|
+
message: z.ZodOptional<z.ZodString>;
|
|
385
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
386
|
+
update: "update";
|
|
387
|
+
create: "create";
|
|
388
|
+
}>>;
|
|
389
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
390
|
+
rule: z.ZodLiteral<"money">;
|
|
391
|
+
currencies: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
392
|
+
message: z.ZodOptional<z.ZodString>;
|
|
393
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
394
|
+
update: "update";
|
|
395
|
+
create: "create";
|
|
396
|
+
}>>;
|
|
325
397
|
}, z.core.$loose>, z.ZodObject<{
|
|
326
398
|
rule: z.ZodLiteral<"in">;
|
|
327
399
|
value: z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
@@ -359,6 +431,16 @@ export declare const Resource: z.ZodObject<{
|
|
|
359
431
|
update: "update";
|
|
360
432
|
create: "create";
|
|
361
433
|
}>>;
|
|
434
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
435
|
+
rule: z.ZodLiteral<"postalCode">;
|
|
436
|
+
value: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
437
|
+
field: z.ZodString;
|
|
438
|
+
}, z.core.$loose>]>>;
|
|
439
|
+
message: z.ZodOptional<z.ZodString>;
|
|
440
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
441
|
+
update: "update";
|
|
442
|
+
create: "create";
|
|
443
|
+
}>>;
|
|
362
444
|
}, z.core.$loose>, z.ZodObject<{
|
|
363
445
|
rule: z.ZodLiteral<"crop">;
|
|
364
446
|
value: z.ZodObject<{
|
|
@@ -370,6 +452,14 @@ export declare const Resource: z.ZodObject<{
|
|
|
370
452
|
update: "update";
|
|
371
453
|
create: "create";
|
|
372
454
|
}>>;
|
|
455
|
+
}, z.core.$loose>, z.ZodObject<{
|
|
456
|
+
rule: z.ZodLiteral<"providers">;
|
|
457
|
+
value: z.ZodArray<z.ZodString>;
|
|
458
|
+
message: z.ZodOptional<z.ZodString>;
|
|
459
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
460
|
+
update: "update";
|
|
461
|
+
create: "create";
|
|
462
|
+
}>>;
|
|
373
463
|
}, z.core.$loose>, z.ZodObject<{
|
|
374
464
|
rule: z.ZodString;
|
|
375
465
|
message: z.ZodOptional<z.ZodString>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/schemas/resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CA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AChD,sEAAsE;AACtE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,QAAQ,CAAC,CAAC"}
|
package/dist/validate.d.ts
CHANGED
|
@@ -18,7 +18,8 @@ export declare function validate<T extends z.ZodType>(schema: T, input: unknown)
|
|
|
18
18
|
/**
|
|
19
19
|
* Validates a definition, as returned by `GET /definition`: against the schema, then the
|
|
20
20
|
* references between its parts (see `lintDefinition()`), and the settings of field types that
|
|
21
|
-
* the protocol describes (`RichTextSettings`
|
|
21
|
+
* the protocol describes (`RichTextSettings`, `DurationSettings`, `DateRangeSettings`,
|
|
22
|
+
* `MoneySettings`, `LinkSettings`, `AddressSettings`).
|
|
22
23
|
*/
|
|
23
24
|
export declare function validateDefinition(input: unknown): ValidationResult<Definition>;
|
|
24
25
|
/**
|
package/dist/validate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAG7B,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAWlD,MAAM,WAAW,eAAe;IAC5B,uFAAuF;IACvF,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAC1B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC;AAE/E,+DAA+D;AAC/D,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,EACxC,MAAM,EAAE,CAAC,EACT,KAAK,EAAE,OAAO,GACf,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAY9B;AAqCD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAwB/E;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAAC,UAAU,CAAC,CAU/E"}
|
package/dist/validate.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { lintDefinition } from "./lint.js";
|
|
2
|
-
import { RichTextSettings } from "./schemas/field.js";
|
|
2
|
+
import { AddressSettings, DateRangeSettings, DurationSettings, LinkSettings, MoneySettings, RichTextSettings } from "./schemas/field.js";
|
|
3
3
|
import { Definition } from "./schemas/definition.js";
|
|
4
4
|
import { BootConfig } from "./schemas/boot.js";
|
|
5
5
|
//#region src/validate.ts
|
|
@@ -18,12 +18,25 @@ function validate(schema, input) {
|
|
|
18
18
|
}))
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
21
|
+
/** The schemas of the settings of the types that the protocol describes. */
|
|
22
|
+
var SETTINGS = {
|
|
23
|
+
richtext: RichTextSettings,
|
|
24
|
+
duration: DurationSettings,
|
|
25
|
+
daterange: DateRangeSettings,
|
|
26
|
+
money: MoneySettings,
|
|
27
|
+
link: LinkSettings,
|
|
28
|
+
address: AddressSettings
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Checks the settings of the fields whose type the protocol describes the settings of (`richtext`,
|
|
32
|
+
* `duration`, `daterange`, `money`, `link`, `address`), nested ones included.
|
|
33
|
+
*/
|
|
22
34
|
function checkFieldSettings(fields, path) {
|
|
23
35
|
return fields.flatMap((field, index) => {
|
|
24
36
|
const fieldPath = `${path}.${String(index)}`;
|
|
37
|
+
const schema = SETTINGS[field.type];
|
|
25
38
|
return [
|
|
26
|
-
...
|
|
39
|
+
...schema !== void 0 && field.settings !== void 0 ? (schema.safeParse(field.settings).error?.issues ?? []).map((issue) => ({
|
|
27
40
|
path: [`${fieldPath}.settings`, ...issue.path.map(String)].join("."),
|
|
28
41
|
message: issue.message
|
|
29
42
|
})) : [],
|
|
@@ -35,7 +48,8 @@ function checkFieldSettings(fields, path) {
|
|
|
35
48
|
/**
|
|
36
49
|
* Validates a definition, as returned by `GET /definition`: against the schema, then the
|
|
37
50
|
* references between its parts (see `lintDefinition()`), and the settings of field types that
|
|
38
|
-
* the protocol describes (`RichTextSettings`
|
|
51
|
+
* the protocol describes (`RichTextSettings`, `DurationSettings`, `DateRangeSettings`,
|
|
52
|
+
* `MoneySettings`, `LinkSettings`, `AddressSettings`).
|
|
39
53
|
*/
|
|
40
54
|
function validateDefinition(input) {
|
|
41
55
|
const result = validate(Definition, input);
|
package/dist/validate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.js","names":[],"sources":["../src/validate.ts"],"sourcesContent":["import type { z } from 'zod';\n\nimport { lintDefinition } from './lint';\nimport { BootConfig } from './schemas/boot';\nimport { Definition } from './schemas/definition';\nimport {
|
|
1
|
+
{"version":3,"file":"validate.js","names":[],"sources":["../src/validate.ts"],"sourcesContent":["import type { z } from 'zod';\n\nimport { lintDefinition } from './lint';\nimport { BootConfig } from './schemas/boot';\nimport { Definition } from './schemas/definition';\nimport {\n AddressSettings,\n DateRangeSettings,\n DurationSettings,\n type Field,\n LinkSettings,\n MoneySettings,\n RichTextSettings,\n} from './schemas/field';\n\nexport interface ValidationIssue {\n /** Dot path of the invalid value (`resources.0.fields.2.type`), empty for the root. */\n path: string;\n message: string;\n}\n\nexport type ValidationResult<T> =\n { success: true; data: T } | { success: false; issues: ValidationIssue[] };\n\n/** Validates a value against one of the protocol's schemas. */\nexport function validate<T extends z.ZodType>(\n schema: T,\n input: unknown,\n): ValidationResult<z.infer<T>> {\n const result = schema.safeParse(input);\n if (result.success) {\n return { success: true, data: result.data };\n }\n return {\n success: false,\n issues: result.error.issues.map((issue) => ({\n path: issue.path.map(String).join('.'),\n message: issue.message,\n })),\n };\n}\n\n/** The schemas of the settings of the types that the protocol describes. */\nconst SETTINGS: Readonly<Record<string, z.ZodType>> = {\n richtext: RichTextSettings,\n duration: DurationSettings,\n daterange: DateRangeSettings,\n money: MoneySettings,\n link: LinkSettings,\n address: AddressSettings,\n};\n\n/**\n * Checks the settings of the fields whose type the protocol describes the settings of (`richtext`,\n * `duration`, `daterange`, `money`, `link`, `address`), nested ones included.\n */\nfunction checkFieldSettings(fields: readonly Field[], path: string): ValidationIssue[] {\n return fields.flatMap((field, index) => {\n const fieldPath = `${path}.${String(index)}`;\n const schema = SETTINGS[field.type];\n const own =\n schema !== undefined && field.settings !== undefined\n ? (schema.safeParse(field.settings).error?.issues ?? []).map((issue) => ({\n path: [`${fieldPath}.settings`, ...issue.path.map(String)].join('.'),\n message: issue.message,\n }))\n : [];\n return [\n ...own,\n ...checkFieldSettings(field.fields ?? [], `${fieldPath}.fields`),\n ...(field.types ?? []).flatMap((type, typeIndex) =>\n checkFieldSettings(type.fields, `${fieldPath}.types.${String(typeIndex)}.fields`),\n ),\n ];\n });\n}\n\n/**\n * Validates a definition, as returned by `GET /definition`: against the schema, then the\n * references between its parts (see `lintDefinition()`), and the settings of field types that\n * the protocol describes (`RichTextSettings`, `DurationSettings`, `DateRangeSettings`,\n * `MoneySettings`, `LinkSettings`, `AddressSettings`).\n */\nexport function validateDefinition(input: unknown): ValidationResult<Definition> {\n const result = validate(Definition, input);\n if (!result.success) {\n return result;\n }\n const issues = [\n ...lintDefinition(result.data),\n ...result.data.resources.flatMap((resource, index) => [\n ...checkFieldSettings(resource.fields, `resources.${String(index)}.fields`),\n ...(resource.types ?? []).flatMap((type, typeIndex) =>\n checkFieldSettings(\n type.fields,\n `resources.${String(index)}.types.${String(typeIndex)}.fields`,\n ),\n ),\n ...(resource.actions ?? []).flatMap((action, actionIndex) =>\n checkFieldSettings(\n action.fields ?? [],\n `resources.${String(index)}.actions.${String(actionIndex)}.fields`,\n ),\n ),\n ]),\n ];\n return issues.length > 0 ? { success: false, issues } : result;\n}\n\n/**\n * Validates a boot config, as a server writes it in the page: against the schema, then the\n * references between the parts of its inlined definition, if any.\n */\nexport function validateBootConfig(input: unknown): ValidationResult<BootConfig> {\n const result = validate(BootConfig, input);\n if (!result.success || result.data.definition === undefined) {\n return result;\n }\n const issues = lintDefinition(result.data.definition).map((issue) => ({\n ...issue,\n path: issue.path === '' ? 'definition' : `definition.${issue.path}`,\n }));\n return issues.length > 0 ? { success: false, issues } : result;\n}\n"],"mappings":";;;;;;AAyBA,SAAgB,SACZ,QACA,OAC4B;CAC5B,MAAM,SAAS,OAAO,UAAU,KAAK;CACrC,IAAI,OAAO,SACP,OAAO;EAAE,SAAS;EAAM,MAAM,OAAO;CAAK;CAE9C,OAAO;EACH,SAAS;EACT,QAAQ,OAAO,MAAM,OAAO,KAAK,WAAW;GACxC,MAAM,MAAM,KAAK,IAAI,MAAM,CAAC,CAAC,KAAK,GAAG;GACrC,SAAS,MAAM;EACnB,EAAE;CACN;AACJ;;AAGA,IAAM,WAAgD;CAClD,UAAU;CACV,UAAU;CACV,WAAW;CACX,OAAO;CACP,MAAM;CACN,SAAS;AACb;;;;;AAMA,SAAS,mBAAmB,QAA0B,MAAiC;CACnF,OAAO,OAAO,SAAS,OAAO,UAAU;EACpC,MAAM,YAAY,GAAG,KAAK,GAAG,OAAO,KAAK;EACzC,MAAM,SAAS,SAAS,MAAM;EAQ9B,OAAO;GACH,GAPA,WAAW,KAAA,KAAa,MAAM,aAAa,KAAA,KACpC,OAAO,UAAU,MAAM,QAAQ,CAAC,CAAC,OAA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KAAK,WAAW;EAClE,GAAG;EACH,MAAM,MAAM,SAAS,KAAK,eAAe,cAAc,MAAM;CACjE,EAAE;CACF,OAAO,OAAO,SAAS,IAAI;EAAE,SAAS;EAAO;CAAO,IAAI;AAC5D"}
|
package/package.json
CHANGED
package/schema/boot.schema.json
CHANGED
|
@@ -522,8 +522,7 @@
|
|
|
522
522
|
"enum": [
|
|
523
523
|
"email",
|
|
524
524
|
"url",
|
|
525
|
-
"json"
|
|
526
|
-
"tel"
|
|
525
|
+
"json"
|
|
527
526
|
]
|
|
528
527
|
},
|
|
529
528
|
"message": {
|
|
@@ -542,6 +541,93 @@
|
|
|
542
541
|
],
|
|
543
542
|
"additionalProperties": {}
|
|
544
543
|
},
|
|
544
|
+
{
|
|
545
|
+
"type": "object",
|
|
546
|
+
"properties": {
|
|
547
|
+
"rule": {
|
|
548
|
+
"type": "string",
|
|
549
|
+
"const": "tel"
|
|
550
|
+
},
|
|
551
|
+
"extension": {
|
|
552
|
+
"type": "boolean"
|
|
553
|
+
},
|
|
554
|
+
"message": {
|
|
555
|
+
"type": "string"
|
|
556
|
+
},
|
|
557
|
+
"mode": {
|
|
558
|
+
"type": "string",
|
|
559
|
+
"enum": [
|
|
560
|
+
"create",
|
|
561
|
+
"update"
|
|
562
|
+
]
|
|
563
|
+
}
|
|
564
|
+
},
|
|
565
|
+
"required": [
|
|
566
|
+
"rule"
|
|
567
|
+
],
|
|
568
|
+
"additionalProperties": {}
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
"type": "object",
|
|
572
|
+
"properties": {
|
|
573
|
+
"rule": {
|
|
574
|
+
"type": "string",
|
|
575
|
+
"const": "daterange"
|
|
576
|
+
},
|
|
577
|
+
"open": {
|
|
578
|
+
"type": "string",
|
|
579
|
+
"enum": [
|
|
580
|
+
"start",
|
|
581
|
+
"end",
|
|
582
|
+
"both"
|
|
583
|
+
]
|
|
584
|
+
},
|
|
585
|
+
"message": {
|
|
586
|
+
"type": "string"
|
|
587
|
+
},
|
|
588
|
+
"mode": {
|
|
589
|
+
"type": "string",
|
|
590
|
+
"enum": [
|
|
591
|
+
"create",
|
|
592
|
+
"update"
|
|
593
|
+
]
|
|
594
|
+
}
|
|
595
|
+
},
|
|
596
|
+
"required": [
|
|
597
|
+
"rule"
|
|
598
|
+
],
|
|
599
|
+
"additionalProperties": {}
|
|
600
|
+
},
|
|
601
|
+
{
|
|
602
|
+
"type": "object",
|
|
603
|
+
"properties": {
|
|
604
|
+
"rule": {
|
|
605
|
+
"type": "string",
|
|
606
|
+
"const": "money"
|
|
607
|
+
},
|
|
608
|
+
"currencies": {
|
|
609
|
+
"type": "array",
|
|
610
|
+
"items": {
|
|
611
|
+
"type": "string",
|
|
612
|
+
"pattern": "^[A-Z]{3}$"
|
|
613
|
+
}
|
|
614
|
+
},
|
|
615
|
+
"message": {
|
|
616
|
+
"type": "string"
|
|
617
|
+
},
|
|
618
|
+
"mode": {
|
|
619
|
+
"type": "string",
|
|
620
|
+
"enum": [
|
|
621
|
+
"create",
|
|
622
|
+
"update"
|
|
623
|
+
]
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
"required": [
|
|
627
|
+
"rule"
|
|
628
|
+
],
|
|
629
|
+
"additionalProperties": {}
|
|
630
|
+
},
|
|
545
631
|
{
|
|
546
632
|
"type": "object",
|
|
547
633
|
"properties": {
|
|
@@ -683,6 +769,50 @@
|
|
|
683
769
|
],
|
|
684
770
|
"additionalProperties": {}
|
|
685
771
|
},
|
|
772
|
+
{
|
|
773
|
+
"type": "object",
|
|
774
|
+
"properties": {
|
|
775
|
+
"rule": {
|
|
776
|
+
"type": "string",
|
|
777
|
+
"const": "postalCode"
|
|
778
|
+
},
|
|
779
|
+
"value": {
|
|
780
|
+
"anyOf": [
|
|
781
|
+
{
|
|
782
|
+
"type": "string",
|
|
783
|
+
"pattern": "^[A-Z]{2}$"
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
"type": "object",
|
|
787
|
+
"properties": {
|
|
788
|
+
"field": {
|
|
789
|
+
"type": "string",
|
|
790
|
+
"minLength": 1
|
|
791
|
+
}
|
|
792
|
+
},
|
|
793
|
+
"required": [
|
|
794
|
+
"field"
|
|
795
|
+
],
|
|
796
|
+
"additionalProperties": {}
|
|
797
|
+
}
|
|
798
|
+
]
|
|
799
|
+
},
|
|
800
|
+
"message": {
|
|
801
|
+
"type": "string"
|
|
802
|
+
},
|
|
803
|
+
"mode": {
|
|
804
|
+
"type": "string",
|
|
805
|
+
"enum": [
|
|
806
|
+
"create",
|
|
807
|
+
"update"
|
|
808
|
+
]
|
|
809
|
+
}
|
|
810
|
+
},
|
|
811
|
+
"required": [
|
|
812
|
+
"rule"
|
|
813
|
+
],
|
|
814
|
+
"additionalProperties": {}
|
|
815
|
+
},
|
|
686
816
|
{
|
|
687
817
|
"type": "object",
|
|
688
818
|
"properties": {
|
|
@@ -723,6 +853,38 @@
|
|
|
723
853
|
],
|
|
724
854
|
"additionalProperties": {}
|
|
725
855
|
},
|
|
856
|
+
{
|
|
857
|
+
"type": "object",
|
|
858
|
+
"properties": {
|
|
859
|
+
"rule": {
|
|
860
|
+
"type": "string",
|
|
861
|
+
"const": "providers"
|
|
862
|
+
},
|
|
863
|
+
"value": {
|
|
864
|
+
"minItems": 1,
|
|
865
|
+
"type": "array",
|
|
866
|
+
"items": {
|
|
867
|
+
"type": "string",
|
|
868
|
+
"minLength": 1
|
|
869
|
+
}
|
|
870
|
+
},
|
|
871
|
+
"message": {
|
|
872
|
+
"type": "string"
|
|
873
|
+
},
|
|
874
|
+
"mode": {
|
|
875
|
+
"type": "string",
|
|
876
|
+
"enum": [
|
|
877
|
+
"create",
|
|
878
|
+
"update"
|
|
879
|
+
]
|
|
880
|
+
}
|
|
881
|
+
},
|
|
882
|
+
"required": [
|
|
883
|
+
"rule",
|
|
884
|
+
"value"
|
|
885
|
+
],
|
|
886
|
+
"additionalProperties": {}
|
|
887
|
+
},
|
|
726
888
|
{
|
|
727
889
|
"type": "object",
|
|
728
890
|
"properties": {
|
|
@@ -1433,6 +1595,9 @@
|
|
|
1433
1595
|
"$ref": "#/$defs/AuthProvider"
|
|
1434
1596
|
}
|
|
1435
1597
|
},
|
|
1598
|
+
"account": {
|
|
1599
|
+
"type": "boolean"
|
|
1600
|
+
},
|
|
1436
1601
|
"passwordReset": {
|
|
1437
1602
|
"type": "boolean"
|
|
1438
1603
|
},
|