@airalogy/aimd-recorder 1.24.1 → 1.24.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AimdCodeField-CPjcXY4D.js → AimdCodeField-6Qe-i2Fr.js} +1 -1
- package/dist/{AimdDnaSequenceField-Dz-IONoA.js → AimdDnaSequenceField-UkWAd5eE.js} +2916 -2911
- package/dist/{AimdEditor.vue_vue_type_style_index_0_lang-JAD--qFs.js → AimdEditor.vue_vue_type_style_index_0_lang-BzzZoCeB.js} +5 -3
- package/dist/{AimdEntityRefField-BE0s2o5T.js → AimdEntityRefField-DSaP0MiW.js} +1 -1
- package/dist/{AimdMarkdownField-BeD2t9JY.js → AimdMarkdownField-1QfCkIo7.js} +99 -94
- package/dist/{AimdMarkdownNoteField-DIgGEYpj.js → AimdMarkdownNoteField-DI9CGLRp.js} +3 -3
- package/dist/AimdRequiredMarker.vue_vue_type_script_setup_true_lang-oAsIq2Q_.js +24 -0
- package/dist/aimd-recorder.css +1 -1
- package/dist/{arc-CLJJdrm0.js → arc-DsbVIrtD.js} +1 -1
- package/dist/{architectureDiagram-3BPJPVTR-BizrFPnS.js → architectureDiagram-3BPJPVTR-BoKfuFBs.js} +2 -2
- package/dist/{blockDiagram-GPEHLZMM-IHDih8JW.js → blockDiagram-GPEHLZMM-CVI9ZAHu.js} +4 -4
- package/dist/{c4Diagram-AAUBKEIU-BQtg8m_M.js → c4Diagram-AAUBKEIU-DZjOGfIh.js} +2 -2
- package/dist/{channel-D8q7AX1Z.js → channel-ClyYV6L9.js} +1 -1
- package/dist/{chunk-2J33WTMH-C24lbKon.js → chunk-2J33WTMH-DAiwEd4z.js} +1 -1
- package/dist/{chunk-4BX2VUAB-1m_lB_xe.js → chunk-4BX2VUAB-C86LRjbo.js} +1 -1
- package/dist/{chunk-55IACEB6-BE5Nj-sd.js → chunk-55IACEB6-B240gM_h.js} +1 -1
- package/dist/{chunk-727SXJPM-Cg-Xw_d_.js → chunk-727SXJPM-DLSdClpw.js} +5 -5
- package/dist/{chunk-AQP2D5EJ-BvRpPCiY.js → chunk-AQP2D5EJ-CrvCTB0u.js} +3 -3
- package/dist/{chunk-FMBD7UC4-D_44MTsg.js → chunk-FMBD7UC4-CK8Xlkyf.js} +1 -1
- package/dist/{chunk-ND2GUHAM-tVBIo4LA.js → chunk-ND2GUHAM-BiTVkaJ4.js} +1 -1
- package/dist/{chunk-QZHKN3VN-B91HYLks.js → chunk-QZHKN3VN-DfLR8ET3.js} +1 -1
- package/dist/{classDiagram-v2-Q7XG4LA2-CkejvTAN.js → classDiagram-4FO5ZUOK-CdGgcwcI.js} +2 -2
- package/dist/{classDiagram-4FO5ZUOK-CkejvTAN.js → classDiagram-v2-Q7XG4LA2-CdGgcwcI.js} +2 -2
- package/dist/components.js +2493 -2459
- package/dist/composables.js +2 -2
- package/dist/{cose-bilkent-S5V4N54A-CNcuriOF.js → cose-bilkent-S5V4N54A-DNovPAAV.js} +1 -1
- package/dist/{dagre-BM42HDAG-DMqFGafq.js → dagre-BM42HDAG-B7Y59pTv.js} +3 -3
- package/dist/{diagram-2AECGRRQ-Cksd3pP3.js → diagram-2AECGRRQ-DedulIP4.js} +2 -2
- package/dist/{diagram-5GNKFQAL-SVjLnDJG.js → diagram-5GNKFQAL-CyLxoNz3.js} +3 -3
- package/dist/{diagram-KO2AKTUF-DfNIAG6w.js → diagram-KO2AKTUF-C-cOuKaw.js} +2 -2
- package/dist/{diagram-LMA3HP47-DPOyCMGB.js → diagram-LMA3HP47-Bkrl6O9n.js} +2 -2
- package/dist/{diagram-OG6HWLK6-BDURmT37.js → diagram-OG6HWLK6-BFgGWMrC.js} +3 -3
- package/dist/{erDiagram-TEJ5UH35-N991qII9.js → erDiagram-TEJ5UH35-CMkLSr99.js} +4 -4
- package/dist/{flowDiagram-I6XJVG4X-BABRFuk-.js → flowDiagram-I6XJVG4X-aBHYqu-v.js} +6 -6
- package/dist/{ganttDiagram-6RSMTGT7-BMDnK96S.js → ganttDiagram-6RSMTGT7-CPEIeMYJ.js} +2 -2
- package/dist/{gitGraphDiagram-PVQCEYII-cEvL7Dss.js → gitGraphDiagram-PVQCEYII-7xsKXhbX.js} +3 -3
- package/dist/{graph-BA09aCvZ.js → graph-C_zDc2Lu.js} +1 -1
- package/dist/index.js +107 -106
- package/dist/{infoDiagram-5YYISTIA-DpC1Zthd.js → infoDiagram-5YYISTIA-fqTV1DiG.js} +1 -1
- package/dist/{ishikawaDiagram-YF4QCWOH-CMEt_f-x.js → ishikawaDiagram-YF4QCWOH-oFqWJGC1.js} +1 -1
- package/dist/{journeyDiagram-JHISSGLW-C0Qw169C.js → journeyDiagram-JHISSGLW-DXKZrVVD.js} +4 -4
- package/dist/{kanban-definition-UN3LZRKU-caROmSUy.js → kanban-definition-UN3LZRKU-CyETGwWQ.js} +2 -2
- package/dist/{layout-CH65__O4.js → layout-CJbxE-hP.js} +2 -2
- package/dist/{linear-B1VXpcsy.js → linear-CA6cJfSx.js} +1 -1
- package/dist/{mermaid.core-Cbmwvfvk.js → mermaid.core-BfkFhA7S.js} +34 -34
- package/dist/{mindmap-definition-RKZ34NQL-DpTR5ilS.js → mindmap-definition-RKZ34NQL-K9_vO_sM.js} +3 -3
- package/dist/{pieDiagram-4H26LBE5-Cb_KrmWC.js → pieDiagram-4H26LBE5-7MAWO90T.js} +3 -3
- package/dist/{quadrantDiagram-W4KKPZXB-B5_NswmK.js → quadrantDiagram-W4KKPZXB-eKvwOhuh.js} +2 -2
- package/dist/record.js +19 -18
- package/dist/{requirementDiagram-4Y6WPE33-OFwfat5D.js → requirementDiagram-4Y6WPE33-BdTNg93D.js} +3 -3
- package/dist/{sankeyDiagram-5OEKKPKP-BaawdZEE.js → sankeyDiagram-5OEKKPKP-Co6Zc9b1.js} +1 -1
- package/dist/{sequenceDiagram-3UESZ5HK-DLv8X8ef.js → sequenceDiagram-3UESZ5HK-Aac-pALW.js} +3 -3
- package/dist/{stateDiagram-AJRCARHV-B6F3wrsd.js → stateDiagram-AJRCARHV-CKTvUK5C.js} +4 -4
- package/dist/{stateDiagram-v2-BHNVJYJU-BcNEoshv.js → stateDiagram-v2-BHNVJYJU-Dn0HRX6t.js} +2 -2
- package/dist/{timeline-definition-PNZ67QCA-CvdHJ4eQ.js → timeline-definition-PNZ67QCA-4kyjawEk.js} +2 -2
- package/dist/{useFieldRendering-Co4DOOvL.js → useFieldRendering-DXdYwpSA.js} +1 -1
- package/dist/{useVarHelpers-Du2obGza.js → useVarHelpers-sM7Fe3SM.js} +31 -27
- package/dist/{validation-oyqyD7Jp.js → validation-D8cXKg1z.js} +1431 -1403
- package/dist/{vennDiagram-CIIHVFJN-U0GlQDjX.js → vennDiagram-CIIHVFJN-DwkHwkFa.js} +1 -1
- package/dist/{wardleyDiagram-YWT4CUSO-CzF_KMcn.js → wardleyDiagram-YWT4CUSO-BPWdxrxm.js} +2 -2
- package/dist/{xychartDiagram-2RQKCTM6-Cljki2Vk.js → xychartDiagram-2RQKCTM6-DJVYSAwS.js} +2 -2
- package/package.json +6 -6
- package/src/__tests__/record-validation.test.ts +123 -1
- package/src/components/AimdCollectorField.vue +3 -0
- package/src/components/AimdDnaSequenceField.vue +5 -1
- package/src/components/AimdMarkdownField.vue +5 -1
- package/src/components/AimdQuizRecorder.vue +4 -0
- package/src/components/AimdRecorder.vue +14 -0
- package/src/components/AimdRequiredMarker.vue +14 -0
- package/src/components/AimdStepCheckField.vue +11 -1
- package/src/components/AimdVarField.vue +3 -0
- package/src/components/AimdVarTableField.vue +15 -4
- package/src/index.ts +2 -0
- package/src/locales.ts +3 -0
- package/src/record/index.ts +2 -0
- package/src/record/validation.ts +63 -1
- package/src/styles/recorder.css +11 -0
- package/src/type-plugins.ts +4 -0
- package/src/types.ts +1 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.js +0 -9
package/src/record/validation.ts
CHANGED
|
@@ -25,6 +25,11 @@ export interface ValidateAimdRecordOptions {
|
|
|
25
25
|
messages: AimdRecorderMessages["validation"]
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
export interface ResolveAimdRequiredFieldOptions {
|
|
29
|
+
fieldMeta?: Record<string, AimdFieldMeta>
|
|
30
|
+
schema?: AimdRecordValidationSchema
|
|
31
|
+
}
|
|
32
|
+
|
|
28
33
|
type SchemaSection = "var" | "step" | "check" | "quiz"
|
|
29
34
|
|
|
30
35
|
interface ResolvedSchemaSection {
|
|
@@ -42,7 +47,7 @@ const SCHEMA_SECTION_ALIASES: Array<{ section: SchemaSection; keys: string[] }>
|
|
|
42
47
|
const schemaAjv = new Ajv2020({
|
|
43
48
|
allErrors: true,
|
|
44
49
|
allowUnionTypes: true,
|
|
45
|
-
coerceTypes:
|
|
50
|
+
coerceTypes: "array",
|
|
46
51
|
strict: false,
|
|
47
52
|
})
|
|
48
53
|
addFormats(schemaAjv)
|
|
@@ -129,6 +134,7 @@ function normalizeValidationValue(value: unknown): unknown {
|
|
|
129
134
|
}
|
|
130
135
|
|
|
131
136
|
if (typeof value.airalogy_file_id === "string") return value.airalogy_file_id
|
|
137
|
+
if (typeof value.airalogyId === "string") return value.airalogyId
|
|
132
138
|
if ((value.type === "file" || value.type === "image") && typeof value.id === "string") return value.id
|
|
133
139
|
if (hasOwn(value, "value") && (hasOwn(value, "displayedValue") || hasOwn(value, "formattedValue") || hasOwn(value, "type"))) {
|
|
134
140
|
return normalizeValidationValue(value.value)
|
|
@@ -248,6 +254,62 @@ function getSchemaRequiredFieldKeys(schemaSections: ResolvedSchemaSection[]): Se
|
|
|
248
254
|
return keys
|
|
249
255
|
}
|
|
250
256
|
|
|
257
|
+
/** Resolve the canonical field selectors that the recorder treats as required. */
|
|
258
|
+
export function getAimdRequiredFieldKeys(
|
|
259
|
+
fields: ExtractedAimdFields,
|
|
260
|
+
options: ResolveAimdRequiredFieldOptions = {},
|
|
261
|
+
): Set<string> {
|
|
262
|
+
const keys = new Set<string>()
|
|
263
|
+
const fieldMeta = options.fieldMeta ?? {}
|
|
264
|
+
const schemaSections = resolveSchemaSections(options.schema)
|
|
265
|
+
const schemaCoveredKeys = getSchemaCoveredFieldKeys(schemaSections)
|
|
266
|
+
const schemaRequiredKeys = getSchemaRequiredFieldKeys(schemaSections)
|
|
267
|
+
|
|
268
|
+
const addWhenRequired = (
|
|
269
|
+
fieldKey: string,
|
|
270
|
+
kwargs: Record<string, unknown> | undefined,
|
|
271
|
+
inferredRequired: boolean,
|
|
272
|
+
) => {
|
|
273
|
+
const required = schemaCoveredKeys.has(fieldKey)
|
|
274
|
+
? schemaRequiredKeys.has(fieldKey) || fieldMeta[fieldKey]?.required === true
|
|
275
|
+
: resolveRequired(fieldMeta[fieldKey], kwargs, inferredRequired)
|
|
276
|
+
if (required) keys.add(fieldKey)
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
for (const field of fields.var_definitions ?? []) {
|
|
280
|
+
addWhenRequired(`var:${field.id}`, field.kwargs, !hasOwn(field, "default"))
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
for (const table of fields.var_table ?? []) {
|
|
284
|
+
const tableKey = `var_table:${table.id}`
|
|
285
|
+
addWhenRequired(tableKey, table.kwargs, !hasOwn(table, "default"))
|
|
286
|
+
const schemaCovered = schemaCoveredKeys.has(tableKey)
|
|
287
|
+
for (const column of table.subvars ?? []) {
|
|
288
|
+
const columnKey = `${tableKey}:${column.id}`
|
|
289
|
+
const required = schemaCovered
|
|
290
|
+
? schemaRequiredKeys.has(columnKey) || fieldMeta[columnKey]?.required === true
|
|
291
|
+
: resolveRequired(fieldMeta[columnKey], column.kwargs, !hasOwn(column, "default"))
|
|
292
|
+
if (required) keys.add(columnKey)
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
for (const id of fields.step ?? []) {
|
|
297
|
+
addWhenRequired(`step:${id}`, undefined, false)
|
|
298
|
+
}
|
|
299
|
+
for (const id of fields.check ?? []) {
|
|
300
|
+
addWhenRequired(`check:${id}`, undefined, false)
|
|
301
|
+
}
|
|
302
|
+
for (const quiz of fields.quiz ?? []) {
|
|
303
|
+
addWhenRequired(
|
|
304
|
+
`quiz:${quiz.id}`,
|
|
305
|
+
isRecord(quiz.extra) ? quiz.extra : undefined,
|
|
306
|
+
false,
|
|
307
|
+
)
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
return keys
|
|
311
|
+
}
|
|
312
|
+
|
|
251
313
|
function getFieldLabel(
|
|
252
314
|
fields: ExtractedAimdFields,
|
|
253
315
|
section: AimdRecorderFieldType,
|
package/src/styles/recorder.css
CHANGED
|
@@ -124,6 +124,17 @@
|
|
|
124
124
|
align-items: center;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
+
.aimd-field__required-marker {
|
|
128
|
+
display: inline-flex;
|
|
129
|
+
flex: 0 0 auto;
|
|
130
|
+
align-items: center;
|
|
131
|
+
margin-inline-start: 0.25rem;
|
|
132
|
+
color: #d03050;
|
|
133
|
+
font-size: 0.875em;
|
|
134
|
+
font-weight: 700;
|
|
135
|
+
line-height: 1;
|
|
136
|
+
}
|
|
137
|
+
|
|
127
138
|
.aimd-field--no-style.aimd-field__label .aimd-field__name--with-metadata {
|
|
128
139
|
align-items: flex-start;
|
|
129
140
|
justify-content: center;
|
package/src/type-plugins.ts
CHANGED
|
@@ -67,6 +67,7 @@ export const BUILT_IN_AIMD_TYPE_PLUGINS: AimdTypePlugin[] = [
|
|
|
67
67
|
node,
|
|
68
68
|
value,
|
|
69
69
|
disabled,
|
|
70
|
+
required,
|
|
70
71
|
locale,
|
|
71
72
|
messages,
|
|
72
73
|
extraClasses,
|
|
@@ -80,6 +81,7 @@ export const BUILT_IN_AIMD_TYPE_PLUGINS: AimdTypePlugin[] = [
|
|
|
80
81
|
varId: node.id,
|
|
81
82
|
modelValue: value,
|
|
82
83
|
disabled,
|
|
84
|
+
required,
|
|
83
85
|
locale,
|
|
84
86
|
messages,
|
|
85
87
|
assignerControl,
|
|
@@ -98,6 +100,7 @@ export const BUILT_IN_AIMD_TYPE_PLUGINS: AimdTypePlugin[] = [
|
|
|
98
100
|
node,
|
|
99
101
|
value,
|
|
100
102
|
disabled,
|
|
103
|
+
required,
|
|
101
104
|
placeholder,
|
|
102
105
|
messages,
|
|
103
106
|
extraClasses,
|
|
@@ -108,6 +111,7 @@ export const BUILT_IN_AIMD_TYPE_PLUGINS: AimdTypePlugin[] = [
|
|
|
108
111
|
varId: node.id,
|
|
109
112
|
modelValue: value,
|
|
110
113
|
disabled,
|
|
114
|
+
required,
|
|
111
115
|
placeholder,
|
|
112
116
|
messages,
|
|
113
117
|
'onUpdate:modelValue': (nextValue: unknown) => emitChange(nextValue),
|
package/src/types.ts
CHANGED
|
@@ -433,6 +433,7 @@ export interface AimdTypePluginParseContext extends AimdTypePluginInitContext {
|
|
|
433
433
|
export interface AimdTypePluginRenderContext extends AimdTypePluginValueContext {
|
|
434
434
|
readonly: boolean
|
|
435
435
|
disabled: boolean
|
|
436
|
+
required?: boolean
|
|
436
437
|
locale: string
|
|
437
438
|
messages: AimdRecorderMessages
|
|
438
439
|
record: AimdProtocolRecordData
|