@aopslab/domain-kit-docman 0.1.4
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/LICENSE +202 -0
- package/NOTICE +6 -0
- package/README.md +79 -0
- package/dist/config/config.d.ts +55 -0
- package/dist/config/config.js +176 -0
- package/dist/domain-services/index.d.ts +7 -0
- package/dist/domain-services/index.js +7 -0
- package/dist/domain-services/jwt.d.ts +1 -0
- package/dist/domain-services/jwt.js +5 -0
- package/dist/domain-services/metrics.d.ts +5 -0
- package/dist/domain-services/metrics.js +7 -0
- package/dist/domain-services/presets.d.ts +3 -0
- package/dist/domain-services/presets.js +4 -0
- package/dist/domain-services/provider.d.ts +2 -0
- package/dist/domain-services/provider.js +564 -0
- package/dist/domain-services/resilience.d.ts +6 -0
- package/dist/domain-services/resilience.js +19 -0
- package/dist/domain-services/types.d.ts +179 -0
- package/dist/domain-services/types.js +1 -0
- package/dist/domain-services/unified.d.ts +272 -0
- package/dist/domain-services/unified.js +210 -0
- package/dist/errors/error.map.d.ts +21 -0
- package/dist/errors/error.map.js +47 -0
- package/dist/errors/friendly.d.ts +31 -0
- package/dist/errors/friendly.js +407 -0
- package/dist/errors/i18n.d.ts +4 -0
- package/dist/errors/i18n.js +10 -0
- package/dist/errors/index.d.ts +3 -0
- package/dist/errors/index.js +3 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +7 -0
- package/dist/operations/catalog.d.ts +11 -0
- package/dist/operations/catalog.js +299 -0
- package/dist/operations/contract.d.ts +31 -0
- package/dist/operations/contract.js +667 -0
- package/dist/operations/dcm.d.ts +58 -0
- package/dist/operations/dcm.js +168 -0
- package/dist/operations/definition.d.ts +6 -0
- package/dist/operations/definition.js +140 -0
- package/dist/operations/executor.d.ts +10 -0
- package/dist/operations/executor.js +269 -0
- package/dist/operations/host-projection.d.ts +11 -0
- package/dist/operations/host-projection.js +156 -0
- package/dist/operations/index.d.ts +10 -0
- package/dist/operations/index.js +10 -0
- package/dist/operations/io-types.d.ts +125 -0
- package/dist/operations/io-types.js +1 -0
- package/dist/operations/schemas.d.ts +10 -0
- package/dist/operations/schemas.js +872 -0
- package/dist/operations/scope-owned-create.d.ts +3 -0
- package/dist/operations/scope-owned-create.js +12 -0
- package/dist/operations/tool-input.d.ts +11 -0
- package/dist/operations/tool-input.js +357 -0
- package/dist/operations/types.d.ts +37 -0
- package/dist/operations/types.js +1 -0
- package/dist/resources/index.d.ts +1 -0
- package/dist/resources/index.js +1 -0
- package/dist/resources/resources.docman.server.errors.d.ts +14 -0
- package/dist/resources/resources.docman.server.errors.js +36 -0
- package/dist/shared/index.d.ts +5 -0
- package/dist/shared/index.js +1 -0
- package/dist/shared/tool-input-guard.d.ts +1 -0
- package/dist/shared/tool-input-guard.js +1 -0
- package/package.json +69 -0
|
@@ -0,0 +1,872 @@
|
|
|
1
|
+
import { normalizeDocmanOperationId } from './definition.js';
|
|
2
|
+
const CRUD_KINDS = new Set(['list', 'get', 'create', 'update', 'delete']);
|
|
3
|
+
const GENERIC_LIST_INPUT_SCHEMA = {
|
|
4
|
+
type: 'object',
|
|
5
|
+
additionalProperties: false,
|
|
6
|
+
properties: {
|
|
7
|
+
filter: { type: 'object', additionalProperties: true },
|
|
8
|
+
options: { type: 'object', additionalProperties: true },
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
const GENERIC_GET_INPUT_SCHEMA = {
|
|
12
|
+
type: 'object',
|
|
13
|
+
additionalProperties: false,
|
|
14
|
+
required: ['id'],
|
|
15
|
+
properties: {
|
|
16
|
+
id: { type: 'string', minLength: 1 },
|
|
17
|
+
options: { type: 'object', additionalProperties: true },
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
const GENERIC_CREATE_INPUT_SCHEMA = {
|
|
21
|
+
type: 'object',
|
|
22
|
+
additionalProperties: false,
|
|
23
|
+
required: ['data'],
|
|
24
|
+
properties: {
|
|
25
|
+
data: { type: 'object', additionalProperties: true },
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
const GENERIC_UPDATE_INPUT_SCHEMA = {
|
|
29
|
+
type: 'object',
|
|
30
|
+
additionalProperties: false,
|
|
31
|
+
required: ['id', 'patch'],
|
|
32
|
+
properties: {
|
|
33
|
+
id: { type: 'string', minLength: 1 },
|
|
34
|
+
patch: { type: 'object', additionalProperties: true },
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const GENERIC_DELETE_INPUT_SCHEMA = {
|
|
38
|
+
type: 'object',
|
|
39
|
+
additionalProperties: false,
|
|
40
|
+
required: ['id'],
|
|
41
|
+
properties: {
|
|
42
|
+
id: { type: 'string', minLength: 1 },
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
const GENERIC_LIST_OUTPUT_SCHEMA = {
|
|
46
|
+
type: 'array',
|
|
47
|
+
items: { type: 'object', additionalProperties: true },
|
|
48
|
+
};
|
|
49
|
+
const GENERIC_GET_OUTPUT_SCHEMA = {
|
|
50
|
+
anyOf: [{ type: 'object', additionalProperties: true }, { type: 'null' }],
|
|
51
|
+
};
|
|
52
|
+
const GENERIC_OBJECT_OUTPUT_SCHEMA = {
|
|
53
|
+
type: 'object',
|
|
54
|
+
additionalProperties: true,
|
|
55
|
+
};
|
|
56
|
+
const GENERIC_VOID_OUTPUT_SCHEMA = {
|
|
57
|
+
anyOf: [{ type: 'null' }, { type: 'object', additionalProperties: true }],
|
|
58
|
+
};
|
|
59
|
+
const GENERIC_CUSTOM_INPUT_SCHEMA = {
|
|
60
|
+
type: 'object',
|
|
61
|
+
additionalProperties: true,
|
|
62
|
+
};
|
|
63
|
+
const GENERIC_CUSTOM_OUTPUT_SCHEMA = {};
|
|
64
|
+
const DOCMAN_OPERATION_SCHEMA_REFS = {
|
|
65
|
+
documentListInput: 'document.list.input',
|
|
66
|
+
documentListOutput: 'document.list.output',
|
|
67
|
+
documentGetInput: 'document.get.input',
|
|
68
|
+
documentGetOutput: 'document.get.output',
|
|
69
|
+
documentCreateInput: 'document.create.input',
|
|
70
|
+
documentCreateOutput: 'document.create.output',
|
|
71
|
+
documentUpdateInput: 'document.update.input',
|
|
72
|
+
documentUpdateOutput: 'document.update.output',
|
|
73
|
+
documentComposeIndexInput: 'document.compose.index.input',
|
|
74
|
+
documentComposeIndexOutput: 'document.compose.index.output',
|
|
75
|
+
documentIndexBuildInput: 'document.index.build.input',
|
|
76
|
+
documentIndexBuildOutput: 'document.index.build.output',
|
|
77
|
+
documentIndexGetInput: 'document.index.get.input',
|
|
78
|
+
documentIndexGetOutput: 'document.index.get.output',
|
|
79
|
+
documentSummaryBuildInput: 'document.summary.build.input',
|
|
80
|
+
documentSummaryBuildOutput: 'document.summary.build.output',
|
|
81
|
+
documentSummaryGetInput: 'document.summary.get.input',
|
|
82
|
+
documentSummaryGetOutput: 'document.summary.get.output',
|
|
83
|
+
documentSearchInput: 'document.search.input',
|
|
84
|
+
documentSearchOutput: 'document.search.output',
|
|
85
|
+
documentScopeSearchInput: 'document.scope.search.input',
|
|
86
|
+
documentScopeSearchOutput: 'document.scope.search.output',
|
|
87
|
+
documentAnswerPackInput: 'document.answer-pack.input',
|
|
88
|
+
documentAnswerPackOutput: 'document.answer-pack.output',
|
|
89
|
+
documentComposeFetchInput: 'document.compose.fetch.input',
|
|
90
|
+
documentComposeFetchOutput: 'document.compose.fetch.output',
|
|
91
|
+
documentPublishMaterializeInput: 'document.publish.materialize.input',
|
|
92
|
+
documentPublishMaterializeOutput: 'document.publish.materialize.output',
|
|
93
|
+
};
|
|
94
|
+
const OPERATION_IO_SCHEMA_REF_OVERRIDES = {
|
|
95
|
+
'document.list': {
|
|
96
|
+
inputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentListInput,
|
|
97
|
+
outputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentListOutput,
|
|
98
|
+
},
|
|
99
|
+
'document.get': {
|
|
100
|
+
inputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentGetInput,
|
|
101
|
+
outputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentGetOutput,
|
|
102
|
+
},
|
|
103
|
+
'document.create': {
|
|
104
|
+
inputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentCreateInput,
|
|
105
|
+
outputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentCreateOutput,
|
|
106
|
+
},
|
|
107
|
+
'document.update': {
|
|
108
|
+
inputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentUpdateInput,
|
|
109
|
+
outputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentUpdateOutput,
|
|
110
|
+
},
|
|
111
|
+
'document.compose.index': {
|
|
112
|
+
inputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentComposeIndexInput,
|
|
113
|
+
outputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentComposeIndexOutput,
|
|
114
|
+
},
|
|
115
|
+
'document.index.build': {
|
|
116
|
+
inputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentIndexBuildInput,
|
|
117
|
+
outputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentIndexBuildOutput,
|
|
118
|
+
},
|
|
119
|
+
'document.index.get': {
|
|
120
|
+
inputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentIndexGetInput,
|
|
121
|
+
outputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentIndexGetOutput,
|
|
122
|
+
},
|
|
123
|
+
'document.summary.build': {
|
|
124
|
+
inputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentSummaryBuildInput,
|
|
125
|
+
outputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentSummaryBuildOutput,
|
|
126
|
+
},
|
|
127
|
+
'document.summary.get': {
|
|
128
|
+
inputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentSummaryGetInput,
|
|
129
|
+
outputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentSummaryGetOutput,
|
|
130
|
+
},
|
|
131
|
+
'document.search': {
|
|
132
|
+
inputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentSearchInput,
|
|
133
|
+
outputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentSearchOutput,
|
|
134
|
+
},
|
|
135
|
+
'document.scope.search': {
|
|
136
|
+
inputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentScopeSearchInput,
|
|
137
|
+
outputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentScopeSearchOutput,
|
|
138
|
+
},
|
|
139
|
+
'document.answer-pack': {
|
|
140
|
+
inputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentAnswerPackInput,
|
|
141
|
+
outputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentAnswerPackOutput,
|
|
142
|
+
},
|
|
143
|
+
'document.compose.fetch': {
|
|
144
|
+
inputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentComposeFetchInput,
|
|
145
|
+
outputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentComposeFetchOutput,
|
|
146
|
+
},
|
|
147
|
+
'document.publish.materialize': {
|
|
148
|
+
inputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentPublishMaterializeInput,
|
|
149
|
+
outputRef: DOCMAN_OPERATION_SCHEMA_REFS.documentPublishMaterializeOutput,
|
|
150
|
+
},
|
|
151
|
+
};
|
|
152
|
+
const OVERRIDE_SCHEMAS_BY_REF = {
|
|
153
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentListInput]: GENERIC_LIST_INPUT_SCHEMA,
|
|
154
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentListOutput]: GENERIC_LIST_OUTPUT_SCHEMA,
|
|
155
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentGetInput]: GENERIC_GET_INPUT_SCHEMA,
|
|
156
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentGetOutput]: GENERIC_GET_OUTPUT_SCHEMA,
|
|
157
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentCreateInput]: GENERIC_CREATE_INPUT_SCHEMA,
|
|
158
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentCreateOutput]: GENERIC_OBJECT_OUTPUT_SCHEMA,
|
|
159
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentUpdateInput]: GENERIC_UPDATE_INPUT_SCHEMA,
|
|
160
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentUpdateOutput]: GENERIC_OBJECT_OUTPUT_SCHEMA,
|
|
161
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentComposeIndexInput]: {
|
|
162
|
+
type: 'object',
|
|
163
|
+
additionalProperties: false,
|
|
164
|
+
required: ['documentVersionId'],
|
|
165
|
+
properties: {
|
|
166
|
+
documentVersionId: { type: 'string', minLength: 1 },
|
|
167
|
+
options: {
|
|
168
|
+
type: 'object',
|
|
169
|
+
additionalProperties: false,
|
|
170
|
+
properties: {
|
|
171
|
+
locale: { type: 'string' },
|
|
172
|
+
fallbackLocale: { type: 'string' },
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
},
|
|
177
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentComposeIndexOutput]: {
|
|
178
|
+
type: 'object',
|
|
179
|
+
additionalProperties: false,
|
|
180
|
+
required: ['documentId', 'documentVersionId', 'title', 'items', 'pages'],
|
|
181
|
+
properties: {
|
|
182
|
+
documentId: { type: 'string' },
|
|
183
|
+
documentVersionId: { type: 'string' },
|
|
184
|
+
title: { type: 'string' },
|
|
185
|
+
items: {
|
|
186
|
+
type: 'array',
|
|
187
|
+
items: {
|
|
188
|
+
type: 'object',
|
|
189
|
+
additionalProperties: true,
|
|
190
|
+
properties: {
|
|
191
|
+
kind: { enum: ['section', 'page'] },
|
|
192
|
+
format: { enum: ['md', 'mdx'] },
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
pages: {
|
|
197
|
+
type: 'array',
|
|
198
|
+
items: {
|
|
199
|
+
type: 'object',
|
|
200
|
+
additionalProperties: true,
|
|
201
|
+
properties: {
|
|
202
|
+
pageNumber: { type: 'number' },
|
|
203
|
+
format: { enum: ['md', 'mdx'] },
|
|
204
|
+
formats: { type: 'array', items: { enum: ['md', 'mdx'] } },
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentIndexBuildInput]: {
|
|
211
|
+
type: 'object',
|
|
212
|
+
additionalProperties: false,
|
|
213
|
+
required: ['documentVersionId'],
|
|
214
|
+
properties: {
|
|
215
|
+
documentVersionId: { type: 'string', minLength: 1 },
|
|
216
|
+
locale: { type: 'string' },
|
|
217
|
+
fallbackLocale: { type: 'string' },
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentIndexBuildOutput]: {
|
|
221
|
+
type: 'object',
|
|
222
|
+
additionalProperties: false,
|
|
223
|
+
required: ['documentVersionId', 'built', 'entries', 'counts'],
|
|
224
|
+
properties: {
|
|
225
|
+
documentId: { type: 'string' },
|
|
226
|
+
documentVersionId: { type: 'string' },
|
|
227
|
+
title: { type: 'string' },
|
|
228
|
+
locale: { type: 'string' },
|
|
229
|
+
fallbackLocale: { type: 'string' },
|
|
230
|
+
built: { type: 'boolean' },
|
|
231
|
+
buildFingerprint: { type: 'string' },
|
|
232
|
+
documentAnchor: { type: 'string' },
|
|
233
|
+
entries: {
|
|
234
|
+
type: 'array',
|
|
235
|
+
items: {
|
|
236
|
+
type: 'object',
|
|
237
|
+
additionalProperties: false,
|
|
238
|
+
required: ['itemKind', 'anchor', 'depth', 'position', 'title', 'breadcrumb', 'titleVisible', 'pageBreakBefore', 'pageBreakAfter'],
|
|
239
|
+
properties: {
|
|
240
|
+
itemKind: { enum: ['section', 'page'] },
|
|
241
|
+
linkId: { type: 'string' },
|
|
242
|
+
parentLinkId: { type: 'string' },
|
|
243
|
+
anchor: { type: 'string' },
|
|
244
|
+
parentAnchor: { type: 'string' },
|
|
245
|
+
number: { type: 'string' },
|
|
246
|
+
depth: { type: 'number' },
|
|
247
|
+
position: { type: 'number' },
|
|
248
|
+
title: { type: 'string' },
|
|
249
|
+
breadcrumb: { type: 'string' },
|
|
250
|
+
titleVisible: { type: 'boolean' },
|
|
251
|
+
pageBreakBefore: { type: 'boolean' },
|
|
252
|
+
pageBreakAfter: { type: 'boolean' },
|
|
253
|
+
sectionId: { type: 'string' },
|
|
254
|
+
sectionUid: { type: 'string' },
|
|
255
|
+
sectionSlug: { type: 'string' },
|
|
256
|
+
pageId: { type: 'string' },
|
|
257
|
+
pageUid: { type: 'string' },
|
|
258
|
+
pageVersionId: { type: 'string' },
|
|
259
|
+
format: { enum: ['md', 'mdx'] },
|
|
260
|
+
pageNumberStart: { type: 'number' },
|
|
261
|
+
pageNumberEnd: { type: 'number' },
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
counts: {
|
|
266
|
+
type: 'object',
|
|
267
|
+
additionalProperties: false,
|
|
268
|
+
required: ['sections', 'pages'],
|
|
269
|
+
properties: {
|
|
270
|
+
sections: { type: 'number' },
|
|
271
|
+
pages: { type: 'number' },
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
},
|
|
276
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentIndexGetInput]: {
|
|
277
|
+
type: 'object',
|
|
278
|
+
additionalProperties: false,
|
|
279
|
+
required: ['documentVersionId'],
|
|
280
|
+
properties: {
|
|
281
|
+
documentVersionId: { type: 'string', minLength: 1 },
|
|
282
|
+
locale: { type: 'string' },
|
|
283
|
+
fallbackLocale: { type: 'string' },
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentIndexGetOutput]: {
|
|
287
|
+
$ref: DOCMAN_OPERATION_SCHEMA_REFS.documentIndexBuildOutput,
|
|
288
|
+
},
|
|
289
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentSummaryBuildInput]: {
|
|
290
|
+
$ref: DOCMAN_OPERATION_SCHEMA_REFS.documentIndexBuildInput,
|
|
291
|
+
},
|
|
292
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentSummaryBuildOutput]: {
|
|
293
|
+
type: 'object',
|
|
294
|
+
additionalProperties: false,
|
|
295
|
+
required: ['documentVersionId', 'built', 'entries', 'counts'],
|
|
296
|
+
properties: {
|
|
297
|
+
documentId: { type: 'string' },
|
|
298
|
+
documentVersionId: { type: 'string' },
|
|
299
|
+
title: { type: 'string' },
|
|
300
|
+
locale: { type: 'string' },
|
|
301
|
+
fallbackLocale: { type: 'string' },
|
|
302
|
+
built: { type: 'boolean' },
|
|
303
|
+
buildFingerprint: { type: 'string' },
|
|
304
|
+
documentAnchor: { type: 'string' },
|
|
305
|
+
entries: {
|
|
306
|
+
type: 'array',
|
|
307
|
+
items: {
|
|
308
|
+
type: 'object',
|
|
309
|
+
additionalProperties: false,
|
|
310
|
+
required: [
|
|
311
|
+
'itemKind',
|
|
312
|
+
'anchor',
|
|
313
|
+
'depth',
|
|
314
|
+
'position',
|
|
315
|
+
'title',
|
|
316
|
+
'breadcrumb',
|
|
317
|
+
'titleVisible',
|
|
318
|
+
'pageBreakBefore',
|
|
319
|
+
'pageBreakAfter',
|
|
320
|
+
'summaryText',
|
|
321
|
+
'sourceCharCount',
|
|
322
|
+
'sourceWordCount',
|
|
323
|
+
'summaryCharCount',
|
|
324
|
+
'summaryWordCount',
|
|
325
|
+
],
|
|
326
|
+
properties: {
|
|
327
|
+
itemKind: { enum: ['document', 'section', 'page'] },
|
|
328
|
+
linkId: { type: 'string' },
|
|
329
|
+
parentLinkId: { type: 'string' },
|
|
330
|
+
anchor: { type: 'string' },
|
|
331
|
+
parentAnchor: { type: 'string' },
|
|
332
|
+
number: { type: 'string' },
|
|
333
|
+
depth: { type: 'number' },
|
|
334
|
+
position: { type: 'number' },
|
|
335
|
+
title: { type: 'string' },
|
|
336
|
+
breadcrumb: { type: 'string' },
|
|
337
|
+
titleVisible: { type: 'boolean' },
|
|
338
|
+
pageBreakBefore: { type: 'boolean' },
|
|
339
|
+
pageBreakAfter: { type: 'boolean' },
|
|
340
|
+
sectionId: { type: 'string' },
|
|
341
|
+
sectionUid: { type: 'string' },
|
|
342
|
+
sectionSlug: { type: 'string' },
|
|
343
|
+
pageId: { type: 'string' },
|
|
344
|
+
pageUid: { type: 'string' },
|
|
345
|
+
pageVersionId: { type: 'string' },
|
|
346
|
+
format: { enum: ['md', 'mdx'] },
|
|
347
|
+
pageNumberStart: { type: 'number' },
|
|
348
|
+
pageNumberEnd: { type: 'number' },
|
|
349
|
+
summaryText: { type: 'string' },
|
|
350
|
+
sourceCharCount: { type: 'number' },
|
|
351
|
+
sourceWordCount: { type: 'number' },
|
|
352
|
+
summaryCharCount: { type: 'number' },
|
|
353
|
+
summaryWordCount: { type: 'number' },
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
counts: {
|
|
358
|
+
type: 'object',
|
|
359
|
+
additionalProperties: false,
|
|
360
|
+
required: ['documents', 'sections', 'pages'],
|
|
361
|
+
properties: {
|
|
362
|
+
documents: { type: 'number' },
|
|
363
|
+
sections: { type: 'number' },
|
|
364
|
+
pages: { type: 'number' },
|
|
365
|
+
},
|
|
366
|
+
},
|
|
367
|
+
},
|
|
368
|
+
},
|
|
369
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentSummaryGetInput]: {
|
|
370
|
+
$ref: DOCMAN_OPERATION_SCHEMA_REFS.documentSummaryBuildInput,
|
|
371
|
+
},
|
|
372
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentSummaryGetOutput]: {
|
|
373
|
+
$ref: DOCMAN_OPERATION_SCHEMA_REFS.documentSummaryBuildOutput,
|
|
374
|
+
},
|
|
375
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentSearchInput]: {
|
|
376
|
+
type: 'object',
|
|
377
|
+
additionalProperties: false,
|
|
378
|
+
required: ['documentVersionId', 'q'],
|
|
379
|
+
properties: {
|
|
380
|
+
documentVersionId: { type: 'string', minLength: 1 },
|
|
381
|
+
q: { type: 'string', minLength: 1 },
|
|
382
|
+
limit: { type: 'number' },
|
|
383
|
+
retrievalStrategy: { enum: ['lexical', 'hybrid', 'semantic'] },
|
|
384
|
+
locale: { type: 'string' },
|
|
385
|
+
fallbackLocale: { type: 'string' },
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentScopeSearchInput]: {
|
|
389
|
+
type: 'object',
|
|
390
|
+
additionalProperties: false,
|
|
391
|
+
required: ['scopeId', 'q'],
|
|
392
|
+
properties: {
|
|
393
|
+
scopeId: { type: 'string', minLength: 1 },
|
|
394
|
+
q: { type: 'string', minLength: 1 },
|
|
395
|
+
limit: { type: 'number' },
|
|
396
|
+
retrievalStrategy: { enum: ['lexical', 'hybrid', 'semantic'] },
|
|
397
|
+
locale: { type: 'string' },
|
|
398
|
+
fallbackLocale: { type: 'string' },
|
|
399
|
+
},
|
|
400
|
+
},
|
|
401
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentSearchOutput]: {
|
|
402
|
+
type: 'object',
|
|
403
|
+
additionalProperties: false,
|
|
404
|
+
required: ['documentVersionId', 'q', 'built', 'hits', 'provenance'],
|
|
405
|
+
properties: {
|
|
406
|
+
documentVersionId: { type: 'string' },
|
|
407
|
+
locale: { type: 'string' },
|
|
408
|
+
fallbackLocale: { type: 'string' },
|
|
409
|
+
q: { type: 'string' },
|
|
410
|
+
built: { type: 'boolean' },
|
|
411
|
+
buildFingerprint: { type: 'string' },
|
|
412
|
+
hits: {
|
|
413
|
+
type: 'array',
|
|
414
|
+
items: {
|
|
415
|
+
type: 'object',
|
|
416
|
+
additionalProperties: false,
|
|
417
|
+
required: [
|
|
418
|
+
'itemKind',
|
|
419
|
+
'anchor',
|
|
420
|
+
'depth',
|
|
421
|
+
'title',
|
|
422
|
+
'breadcrumb',
|
|
423
|
+
'score',
|
|
424
|
+
'excerpt',
|
|
425
|
+
'matchedBy',
|
|
426
|
+
'lexicalScore',
|
|
427
|
+
],
|
|
428
|
+
properties: {
|
|
429
|
+
itemKind: { enum: ['section', 'page'] },
|
|
430
|
+
anchor: { type: 'string' },
|
|
431
|
+
parentAnchor: { type: 'string' },
|
|
432
|
+
number: { type: 'string' },
|
|
433
|
+
depth: { type: 'number' },
|
|
434
|
+
title: { type: 'string' },
|
|
435
|
+
breadcrumb: { type: 'string' },
|
|
436
|
+
sectionId: { type: 'string' },
|
|
437
|
+
sectionUid: { type: 'string' },
|
|
438
|
+
sectionSlug: { type: 'string' },
|
|
439
|
+
pageId: { type: 'string' },
|
|
440
|
+
pageUid: { type: 'string' },
|
|
441
|
+
pageVersionId: { type: 'string' },
|
|
442
|
+
format: { enum: ['md', 'mdx'] },
|
|
443
|
+
pageNumberStart: { type: 'number' },
|
|
444
|
+
pageNumberEnd: { type: 'number' },
|
|
445
|
+
score: { type: 'number' },
|
|
446
|
+
excerpt: { type: 'string' },
|
|
447
|
+
matchedBy: {
|
|
448
|
+
type: 'array',
|
|
449
|
+
items: { enum: ['title', 'breadcrumb', 'number', 'bodyText', 'summaryText', 'semanticVector'] },
|
|
450
|
+
},
|
|
451
|
+
lexicalScore: { type: 'number' },
|
|
452
|
+
semanticScore: { type: 'number' },
|
|
453
|
+
},
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
provenance: {
|
|
457
|
+
type: 'object',
|
|
458
|
+
additionalProperties: false,
|
|
459
|
+
required: ['strategy', 'retrievalStrategy', 'vectorAvailable'],
|
|
460
|
+
properties: {
|
|
461
|
+
strategy: { enum: ['lexical-search-v1', 'hybrid-search-v1', 'semantic-search-v1'] },
|
|
462
|
+
retrievalStrategy: { enum: ['lexical', 'hybrid', 'semantic'] },
|
|
463
|
+
vectorAvailable: { type: 'boolean' },
|
|
464
|
+
vectorProvider: { type: 'string' },
|
|
465
|
+
vectorModel: { type: 'string' },
|
|
466
|
+
},
|
|
467
|
+
},
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentScopeSearchOutput]: {
|
|
471
|
+
type: 'object',
|
|
472
|
+
additionalProperties: false,
|
|
473
|
+
required: ['scopeId', 'q', 'hits', 'provenance', 'buildReport'],
|
|
474
|
+
properties: {
|
|
475
|
+
scopeId: { type: 'string' },
|
|
476
|
+
locale: { type: 'string' },
|
|
477
|
+
fallbackLocale: { type: 'string' },
|
|
478
|
+
q: { type: 'string' },
|
|
479
|
+
hits: {
|
|
480
|
+
type: 'array',
|
|
481
|
+
items: {
|
|
482
|
+
type: 'object',
|
|
483
|
+
additionalProperties: false,
|
|
484
|
+
required: [
|
|
485
|
+
'documentId',
|
|
486
|
+
'documentTitle',
|
|
487
|
+
'documentVersionId',
|
|
488
|
+
'documentVersionTitle',
|
|
489
|
+
'itemKind',
|
|
490
|
+
'anchor',
|
|
491
|
+
'depth',
|
|
492
|
+
'title',
|
|
493
|
+
'breadcrumb',
|
|
494
|
+
'score',
|
|
495
|
+
'excerpt',
|
|
496
|
+
'matchedBy',
|
|
497
|
+
'lexicalScore',
|
|
498
|
+
],
|
|
499
|
+
properties: {
|
|
500
|
+
documentId: { type: 'string' },
|
|
501
|
+
documentTitle: { type: 'string' },
|
|
502
|
+
documentSlug: { type: 'string' },
|
|
503
|
+
documentVersionId: { type: 'string' },
|
|
504
|
+
documentVersionTitle: { type: 'string' },
|
|
505
|
+
documentVersionNumber: { type: 'number' },
|
|
506
|
+
itemKind: { enum: ['section', 'page'] },
|
|
507
|
+
anchor: { type: 'string' },
|
|
508
|
+
parentAnchor: { type: 'string' },
|
|
509
|
+
number: { type: 'string' },
|
|
510
|
+
depth: { type: 'number' },
|
|
511
|
+
title: { type: 'string' },
|
|
512
|
+
breadcrumb: { type: 'string' },
|
|
513
|
+
sectionId: { type: 'string' },
|
|
514
|
+
sectionUid: { type: 'string' },
|
|
515
|
+
sectionSlug: { type: 'string' },
|
|
516
|
+
pageId: { type: 'string' },
|
|
517
|
+
pageUid: { type: 'string' },
|
|
518
|
+
pageVersionId: { type: 'string' },
|
|
519
|
+
format: { enum: ['md', 'mdx'] },
|
|
520
|
+
pageNumberStart: { type: 'number' },
|
|
521
|
+
pageNumberEnd: { type: 'number' },
|
|
522
|
+
score: { type: 'number' },
|
|
523
|
+
excerpt: { type: 'string' },
|
|
524
|
+
matchedBy: {
|
|
525
|
+
type: 'array',
|
|
526
|
+
items: { enum: ['title', 'breadcrumb', 'number', 'bodyText', 'summaryText', 'semanticVector'] },
|
|
527
|
+
},
|
|
528
|
+
lexicalScore: { type: 'number' },
|
|
529
|
+
semanticScore: { type: 'number' },
|
|
530
|
+
},
|
|
531
|
+
},
|
|
532
|
+
},
|
|
533
|
+
provenance: {
|
|
534
|
+
type: 'object',
|
|
535
|
+
additionalProperties: false,
|
|
536
|
+
required: [
|
|
537
|
+
'strategy',
|
|
538
|
+
'retrievalStrategy',
|
|
539
|
+
'totalDocumentCount',
|
|
540
|
+
'searchedDocumentCount',
|
|
541
|
+
'autoBuiltDocumentCount',
|
|
542
|
+
'failedDocumentCount',
|
|
543
|
+
],
|
|
544
|
+
properties: {
|
|
545
|
+
strategy: { enum: ['lexical-search-v1', 'hybrid-search-v1', 'semantic-search-v1'] },
|
|
546
|
+
retrievalStrategy: { enum: ['lexical', 'hybrid', 'semantic'] },
|
|
547
|
+
totalDocumentCount: { type: 'number' },
|
|
548
|
+
searchedDocumentCount: { type: 'number' },
|
|
549
|
+
autoBuiltDocumentCount: { type: 'number' },
|
|
550
|
+
failedDocumentCount: { type: 'number' },
|
|
551
|
+
},
|
|
552
|
+
},
|
|
553
|
+
buildReport: {
|
|
554
|
+
type: 'object',
|
|
555
|
+
additionalProperties: false,
|
|
556
|
+
required: ['autoBuiltDocumentVersionIds', 'failures'],
|
|
557
|
+
properties: {
|
|
558
|
+
autoBuiltDocumentVersionIds: {
|
|
559
|
+
type: 'array',
|
|
560
|
+
items: { type: 'string' },
|
|
561
|
+
},
|
|
562
|
+
failures: {
|
|
563
|
+
type: 'array',
|
|
564
|
+
items: {
|
|
565
|
+
type: 'object',
|
|
566
|
+
additionalProperties: false,
|
|
567
|
+
required: ['stage', 'message'],
|
|
568
|
+
properties: {
|
|
569
|
+
documentId: { type: 'string' },
|
|
570
|
+
documentTitle: { type: 'string' },
|
|
571
|
+
documentVersionId: { type: 'string' },
|
|
572
|
+
stage: { enum: ['resolve-latest-version', 'build-index', 'search'] },
|
|
573
|
+
message: { type: 'string' },
|
|
574
|
+
},
|
|
575
|
+
},
|
|
576
|
+
},
|
|
577
|
+
},
|
|
578
|
+
},
|
|
579
|
+
},
|
|
580
|
+
},
|
|
581
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentAnswerPackInput]: {
|
|
582
|
+
$ref: DOCMAN_OPERATION_SCHEMA_REFS.documentSearchInput,
|
|
583
|
+
},
|
|
584
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentAnswerPackOutput]: {
|
|
585
|
+
type: 'object',
|
|
586
|
+
additionalProperties: false,
|
|
587
|
+
required: ['documentVersionId', 'q', 'built', 'answer', 'answerSource', 'citations', 'provenance'],
|
|
588
|
+
properties: {
|
|
589
|
+
documentVersionId: { type: 'string' },
|
|
590
|
+
locale: { type: 'string' },
|
|
591
|
+
fallbackLocale: { type: 'string' },
|
|
592
|
+
q: { type: 'string' },
|
|
593
|
+
built: { type: 'boolean' },
|
|
594
|
+
buildFingerprint: { type: 'string' },
|
|
595
|
+
answer: { type: 'string' },
|
|
596
|
+
answerSource: { enum: ['summary', 'excerpt', 'title', 'none'] },
|
|
597
|
+
citations: {
|
|
598
|
+
type: 'array',
|
|
599
|
+
items: {
|
|
600
|
+
type: 'object',
|
|
601
|
+
additionalProperties: false,
|
|
602
|
+
required: [
|
|
603
|
+
'itemKind',
|
|
604
|
+
'anchor',
|
|
605
|
+
'depth',
|
|
606
|
+
'title',
|
|
607
|
+
'breadcrumb',
|
|
608
|
+
'score',
|
|
609
|
+
'excerpt',
|
|
610
|
+
'matchedBy',
|
|
611
|
+
'lexicalScore',
|
|
612
|
+
],
|
|
613
|
+
properties: {
|
|
614
|
+
itemKind: { enum: ['document', 'section', 'page'] },
|
|
615
|
+
anchor: { type: 'string' },
|
|
616
|
+
parentAnchor: { type: 'string' },
|
|
617
|
+
number: { type: 'string' },
|
|
618
|
+
depth: { type: 'number' },
|
|
619
|
+
title: { type: 'string' },
|
|
620
|
+
breadcrumb: { type: 'string' },
|
|
621
|
+
sectionId: { type: 'string' },
|
|
622
|
+
sectionUid: { type: 'string' },
|
|
623
|
+
sectionSlug: { type: 'string' },
|
|
624
|
+
pageId: { type: 'string' },
|
|
625
|
+
pageUid: { type: 'string' },
|
|
626
|
+
pageVersionId: { type: 'string' },
|
|
627
|
+
format: { enum: ['md', 'mdx'] },
|
|
628
|
+
pageNumberStart: { type: 'number' },
|
|
629
|
+
pageNumberEnd: { type: 'number' },
|
|
630
|
+
score: { type: 'number' },
|
|
631
|
+
excerpt: { type: 'string' },
|
|
632
|
+
summaryText: { type: 'string' },
|
|
633
|
+
lexicalScore: { type: 'number' },
|
|
634
|
+
semanticScore: { type: 'number' },
|
|
635
|
+
matchedBy: {
|
|
636
|
+
type: 'array',
|
|
637
|
+
items: { enum: ['title', 'breadcrumb', 'number', 'bodyText', 'summaryText', 'semanticVector'] },
|
|
638
|
+
},
|
|
639
|
+
},
|
|
640
|
+
},
|
|
641
|
+
},
|
|
642
|
+
provenance: {
|
|
643
|
+
type: 'object',
|
|
644
|
+
additionalProperties: false,
|
|
645
|
+
required: [
|
|
646
|
+
'strategy',
|
|
647
|
+
'retrievalStrategy',
|
|
648
|
+
'citationCount',
|
|
649
|
+
'primaryMatchedBy',
|
|
650
|
+
'vectorAvailable',
|
|
651
|
+
],
|
|
652
|
+
properties: {
|
|
653
|
+
strategy: {
|
|
654
|
+
enum: ['deterministic-answer-pack-v1', 'hybrid-answer-pack-v1', 'semantic-answer-pack-v1'],
|
|
655
|
+
},
|
|
656
|
+
retrievalStrategy: { enum: ['lexical', 'hybrid', 'semantic'] },
|
|
657
|
+
citationCount: { type: 'number' },
|
|
658
|
+
selectedAnchor: { type: 'string' },
|
|
659
|
+
selectedItemKind: { enum: ['document', 'section', 'page'] },
|
|
660
|
+
primaryMatchedBy: {
|
|
661
|
+
type: 'array',
|
|
662
|
+
items: { enum: ['title', 'breadcrumb', 'number', 'bodyText', 'summaryText', 'semanticVector'] },
|
|
663
|
+
},
|
|
664
|
+
vectorAvailable: { type: 'boolean' },
|
|
665
|
+
vectorProvider: { type: 'string' },
|
|
666
|
+
vectorModel: { type: 'string' },
|
|
667
|
+
},
|
|
668
|
+
},
|
|
669
|
+
},
|
|
670
|
+
},
|
|
671
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentComposeFetchInput]: {
|
|
672
|
+
type: 'object',
|
|
673
|
+
additionalProperties: false,
|
|
674
|
+
required: ['documentVersionId'],
|
|
675
|
+
properties: {
|
|
676
|
+
documentVersionId: { type: 'string', minLength: 1 },
|
|
677
|
+
sectionId: { type: 'string' },
|
|
678
|
+
pageVersionId: { type: 'string' },
|
|
679
|
+
pageNumber: { type: 'number' },
|
|
680
|
+
locale: { type: 'string' },
|
|
681
|
+
fallbackLocale: { type: 'string' },
|
|
682
|
+
},
|
|
683
|
+
},
|
|
684
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentComposeFetchOutput]: {
|
|
685
|
+
type: 'object',
|
|
686
|
+
additionalProperties: false,
|
|
687
|
+
required: ['documentVersionId', 'kind', 'format', 'formats', 'content', 'assets'],
|
|
688
|
+
properties: {
|
|
689
|
+
documentVersionId: { type: 'string' },
|
|
690
|
+
kind: { enum: ['document', 'section', 'page'] },
|
|
691
|
+
format: { enum: ['md', 'mdx'] },
|
|
692
|
+
formats: { type: 'array', items: { enum: ['md', 'mdx'] } },
|
|
693
|
+
content: { type: 'string' },
|
|
694
|
+
assets: {
|
|
695
|
+
type: 'array',
|
|
696
|
+
items: {
|
|
697
|
+
type: 'object',
|
|
698
|
+
additionalProperties: false,
|
|
699
|
+
required: ['token', 'ref', 'assetId', 'assetVersionId', 'assetVersion', 'kind', 'mime', 'href'],
|
|
700
|
+
properties: {
|
|
701
|
+
token: { type: 'string' },
|
|
702
|
+
ref: { type: 'string' },
|
|
703
|
+
assetId: { type: 'string' },
|
|
704
|
+
assetVersionId: { type: 'string' },
|
|
705
|
+
assetVersion: { type: 'number' },
|
|
706
|
+
assetUid: { type: 'string' },
|
|
707
|
+
slug: { type: 'string' },
|
|
708
|
+
title: { type: 'string' },
|
|
709
|
+
altText: { type: 'string' },
|
|
710
|
+
kind: { type: 'string' },
|
|
711
|
+
mime: { type: 'string' },
|
|
712
|
+
href: { type: 'string' },
|
|
713
|
+
width: { type: 'number' },
|
|
714
|
+
height: { type: 'number' },
|
|
715
|
+
},
|
|
716
|
+
},
|
|
717
|
+
},
|
|
718
|
+
pageNumber: { type: 'number' },
|
|
719
|
+
sectionId: { type: 'string' },
|
|
720
|
+
pageVersionId: { type: 'string' },
|
|
721
|
+
},
|
|
722
|
+
},
|
|
723
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentPublishMaterializeInput]: {
|
|
724
|
+
type: 'object',
|
|
725
|
+
additionalProperties: false,
|
|
726
|
+
required: ['documentVersionId', 'target'],
|
|
727
|
+
properties: {
|
|
728
|
+
documentVersionId: { type: 'string', minLength: 1 },
|
|
729
|
+
target: { enum: ['markdown', 'html'] },
|
|
730
|
+
sectionId: { type: 'string' },
|
|
731
|
+
pageVersionId: { type: 'string' },
|
|
732
|
+
pageNumber: { type: 'number' },
|
|
733
|
+
locale: { type: 'string' },
|
|
734
|
+
fallbackLocale: { type: 'string' },
|
|
735
|
+
},
|
|
736
|
+
},
|
|
737
|
+
[DOCMAN_OPERATION_SCHEMA_REFS.documentPublishMaterializeOutput]: {
|
|
738
|
+
type: 'object',
|
|
739
|
+
additionalProperties: false,
|
|
740
|
+
required: ['documentVersionId', 'kind', 'target', 'mediaType', 'format', 'formats', 'content', 'assets', 'warnings'],
|
|
741
|
+
properties: {
|
|
742
|
+
documentVersionId: { type: 'string' },
|
|
743
|
+
kind: { enum: ['document', 'section', 'page'] },
|
|
744
|
+
target: { enum: ['markdown', 'html'] },
|
|
745
|
+
mediaType: { type: 'string' },
|
|
746
|
+
format: { enum: ['md', 'mdx'] },
|
|
747
|
+
formats: { type: 'array', items: { enum: ['md', 'mdx'] } },
|
|
748
|
+
content: { type: 'string' },
|
|
749
|
+
assets: {
|
|
750
|
+
type: 'array',
|
|
751
|
+
items: {
|
|
752
|
+
type: 'object',
|
|
753
|
+
additionalProperties: false,
|
|
754
|
+
required: ['token', 'ref', 'assetId', 'assetVersionId', 'assetVersion', 'kind', 'mime', 'href'],
|
|
755
|
+
properties: {
|
|
756
|
+
token: { type: 'string' },
|
|
757
|
+
ref: { type: 'string' },
|
|
758
|
+
assetId: { type: 'string' },
|
|
759
|
+
assetVersionId: { type: 'string' },
|
|
760
|
+
assetVersion: { type: 'number' },
|
|
761
|
+
assetUid: { type: 'string' },
|
|
762
|
+
slug: { type: 'string' },
|
|
763
|
+
title: { type: 'string' },
|
|
764
|
+
altText: { type: 'string' },
|
|
765
|
+
kind: { type: 'string' },
|
|
766
|
+
mime: { type: 'string' },
|
|
767
|
+
href: { type: 'string' },
|
|
768
|
+
width: { type: 'number' },
|
|
769
|
+
height: { type: 'number' },
|
|
770
|
+
},
|
|
771
|
+
},
|
|
772
|
+
},
|
|
773
|
+
warnings: {
|
|
774
|
+
type: 'array',
|
|
775
|
+
items: {
|
|
776
|
+
type: 'object',
|
|
777
|
+
additionalProperties: false,
|
|
778
|
+
required: ['code', 'message'],
|
|
779
|
+
properties: {
|
|
780
|
+
code: { type: 'string' },
|
|
781
|
+
message: { type: 'string' },
|
|
782
|
+
},
|
|
783
|
+
},
|
|
784
|
+
},
|
|
785
|
+
pageNumber: { type: 'number' },
|
|
786
|
+
sectionId: { type: 'string' },
|
|
787
|
+
pageVersionId: { type: 'string' },
|
|
788
|
+
},
|
|
789
|
+
},
|
|
790
|
+
};
|
|
791
|
+
function inferOperationKind(operationId) {
|
|
792
|
+
const segments = operationId.split('.').map((segment) => segment.trim()).filter(Boolean);
|
|
793
|
+
const last = segments[segments.length - 1] ?? '';
|
|
794
|
+
if (CRUD_KINDS.has(last)) {
|
|
795
|
+
return last;
|
|
796
|
+
}
|
|
797
|
+
return 'custom';
|
|
798
|
+
}
|
|
799
|
+
function buildDefaultSchemaRefs(operationId) {
|
|
800
|
+
return {
|
|
801
|
+
inputRef: `${operationId}.input`,
|
|
802
|
+
outputRef: `${operationId}.output`,
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
function parseSchemaRef(ref) {
|
|
806
|
+
const normalized = String(ref ?? '').trim();
|
|
807
|
+
if (!normalized)
|
|
808
|
+
return null;
|
|
809
|
+
if (normalized.endsWith('.input')) {
|
|
810
|
+
const operationId = normalized.slice(0, -'.input'.length);
|
|
811
|
+
if (!operationId)
|
|
812
|
+
return null;
|
|
813
|
+
return { operationId, direction: 'input' };
|
|
814
|
+
}
|
|
815
|
+
if (normalized.endsWith('.output')) {
|
|
816
|
+
const operationId = normalized.slice(0, -'.output'.length);
|
|
817
|
+
if (!operationId)
|
|
818
|
+
return null;
|
|
819
|
+
return { operationId, direction: 'output' };
|
|
820
|
+
}
|
|
821
|
+
return null;
|
|
822
|
+
}
|
|
823
|
+
function getGenericSchemaByKind(kind, direction) {
|
|
824
|
+
if (kind === 'list')
|
|
825
|
+
return direction === 'input' ? GENERIC_LIST_INPUT_SCHEMA : GENERIC_LIST_OUTPUT_SCHEMA;
|
|
826
|
+
if (kind === 'get')
|
|
827
|
+
return direction === 'input' ? GENERIC_GET_INPUT_SCHEMA : GENERIC_GET_OUTPUT_SCHEMA;
|
|
828
|
+
if (kind === 'create')
|
|
829
|
+
return direction === 'input' ? GENERIC_CREATE_INPUT_SCHEMA : GENERIC_OBJECT_OUTPUT_SCHEMA;
|
|
830
|
+
if (kind === 'update')
|
|
831
|
+
return direction === 'input' ? GENERIC_UPDATE_INPUT_SCHEMA : GENERIC_OBJECT_OUTPUT_SCHEMA;
|
|
832
|
+
if (kind === 'delete')
|
|
833
|
+
return direction === 'input' ? GENERIC_DELETE_INPUT_SCHEMA : GENERIC_VOID_OUTPUT_SCHEMA;
|
|
834
|
+
return direction === 'input' ? GENERIC_CUSTOM_INPUT_SCHEMA : GENERIC_CUSTOM_OUTPUT_SCHEMA;
|
|
835
|
+
}
|
|
836
|
+
export function createDocmanSchemaRef(ref) {
|
|
837
|
+
return { $ref: String(ref ?? '').trim() };
|
|
838
|
+
}
|
|
839
|
+
export function getDocmanOperationIoSchemaRefs(operationId) {
|
|
840
|
+
const normalized = normalizeDocmanOperationId(operationId);
|
|
841
|
+
if (!normalized)
|
|
842
|
+
return undefined;
|
|
843
|
+
const override = OPERATION_IO_SCHEMA_REF_OVERRIDES[normalized];
|
|
844
|
+
if (override)
|
|
845
|
+
return override;
|
|
846
|
+
return buildDefaultSchemaRefs(normalized);
|
|
847
|
+
}
|
|
848
|
+
export function getDocmanContractSchema(ref) {
|
|
849
|
+
const normalizedRef = String(ref ?? '').trim();
|
|
850
|
+
if (!normalizedRef)
|
|
851
|
+
return undefined;
|
|
852
|
+
const override = OVERRIDE_SCHEMAS_BY_REF[normalizedRef];
|
|
853
|
+
if (override)
|
|
854
|
+
return override;
|
|
855
|
+
const parsed = parseSchemaRef(normalizedRef);
|
|
856
|
+
if (!parsed)
|
|
857
|
+
return undefined;
|
|
858
|
+
const operationId = normalizeDocmanOperationId(parsed.operationId);
|
|
859
|
+
if (!operationId)
|
|
860
|
+
return undefined;
|
|
861
|
+
const kind = inferOperationKind(operationId);
|
|
862
|
+
return getGenericSchemaByKind(kind, parsed.direction);
|
|
863
|
+
}
|
|
864
|
+
export function resolveDocmanSchemaRefName(schema) {
|
|
865
|
+
if (!schema || typeof schema !== 'object' || Array.isArray(schema))
|
|
866
|
+
return undefined;
|
|
867
|
+
const maybeRef = schema.$ref;
|
|
868
|
+
if (typeof maybeRef !== 'string')
|
|
869
|
+
return undefined;
|
|
870
|
+
const normalized = maybeRef.trim();
|
|
871
|
+
return normalized || undefined;
|
|
872
|
+
}
|