openyida 2026.11.5 → 2026.11.6
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/README.md +6 -2
- package/lib/app/create-form/batch.js +10 -1
- package/lib/app/create-form/default-view.js +50 -0
- package/lib/app/create-form.js +16 -2
- package/lib/app/form-view.js +2 -2
- package/lib/app/publish.js +6 -0
- package/lib/app/services/field-bindings.js +94 -0
- package/lib/app/subform-readback.js +11 -1
- package/lib/core/babel.js +7 -2
- package/lib/core/command-manifest.js +12 -8
- package/lib/core/data-seed.js +29 -23
- package/lib/core/locales/en.js +2 -1
- package/lib/core/locales/zh.js +2 -1
- package/lib/core/query-data.js +55 -20
- package/lib/process/configure-process.js +16 -5
- package/lib/process/create-process.js +7 -1
- package/lib/process/process-diagnostics.js +5 -1
- package/lib/process/services/process-compiler.js +18 -75
- package/lib/process/services/process-form-fields.js +54 -1
- package/lib/process/services/process-view-verifier.js +29 -0
- package/lib/samples/openyida-scaffold/canvas-data-source.jsx +74 -5
- package/package.json +1 -1
- package/yida-skills/SKILL.md +1 -1
- package/yida-skills/skills/yida-app/SKILL.md +5 -5
- package/yida-skills/skills/yida-app/workflow/fast-build.md +2 -2
- package/yida-skills/skills/yida-app/workflow/step-4-forms-processes.md +2 -2
- package/yida-skills/skills/yida-app/workflow/step-5-seed-records.md +17 -42
- package/yida-skills/skills/yida-app/workflow/step-7-page-code.md +1 -1
- package/yida-skills/skills/yida-app/workflow/step-9-output-finish.md +1 -1
- package/yida-skills/skills/yida-canvas-custom-page/SKILL.md +3 -3
- package/yida-skills/skills/yida-canvas-custom-page/references/data-bridge-guide.md +3 -3
- package/yida-skills/skills/yida-canvas-custom-page/references/page-generation-guide.md +3 -3
- package/yida-skills/skills/yida-canvas-data-binding/SKILL.md +14 -6
- package/yida-skills/skills/yida-create-form-page/SKILL.md +1 -0
- package/yida-skills/skills/yida-create-process/SKILL.md +59 -207
- package/yida-skills/skills/yida-data-management/SKILL.md +47 -158
- package/yida-skills/skills/yida-data-management/references/data-format-guide.md +14 -5
- package/yida-skills/skills/yida-data-management/references/process-seed-workflow.md +31 -0
- package/yida-skills/skills/yida-flow-node-config/references/conditions-variables.md +2 -0
- package/yida-skills/skills/yida-form-view/SKILL.md +4 -5
- package/yida-skills/skills/yida-process-rule/SKILL.md +6 -4
- package/yida-skills/skills-index.json +4 -2
package/README.md
CHANGED
|
@@ -278,6 +278,7 @@ openyida data query form APP_XXX FORM_XXX --dynamic-order '{"dateField_xxx":"-"}
|
|
|
278
278
|
openyida data query process APP_XXX FORM_XXX --current-approver USER_ID --count
|
|
279
279
|
openyida data create form APP_XXX FORM_XXX --expect-form-name 客户 --expect-form-type receipt --data-file .cache/openyida/data-import/record.json
|
|
280
280
|
openyida data seed form APP_XXX FORM_XXX --expect-form-name 客户 --records-file .cache/openyida/data-import/customers.json --timezone +08:00 --json
|
|
281
|
+
openyida data seed process APP_XXX FORM_XXX --process-code TPROC_XXX --expect-form-name 申请 --records-file .cache/openyida/data-import/applications.json --json
|
|
281
282
|
openyida get-permission APP_XXX FORM_XXX
|
|
282
283
|
```
|
|
283
284
|
|
|
@@ -285,6 +286,9 @@ openyida get-permission APP_XXX FORM_XXX
|
|
|
285
286
|
|
|
286
287
|
`data seed form` accepts one JSON array of 1–30 business records using real field IDs (or configured aliases with `--resolve-aliases`). It checks the whole batch against the live schema, then creates and reads back each record, returning `formInstIds`. Use `--check` to preview converted records without writing. `DateField` and date-range endpoints accept millisecond numbers, `YYYY-MM-DD`, or ISO date-times; date-times without an offset use `--timezone` (a fixed UTC offset, default `+08:00`). Subform dates are converted recursively. Invalid dates, reversed ranges and unknown fields/options fail before any write. Business values and real member/department/file/association IDs come from the caller; this command does not invent them or start workflows.
|
|
287
288
|
|
|
289
|
+
`data seed process` shares the schema, date conversion, receipt and readback behavior. It requires `--process-code`, starts real workflow instances and returns `processInstanceIds`. For application samples, create a temporary originator-only approval flow, seed and verify, then edit and publish the final flow on the same form. Existing samples retain their original workflow version.
|
|
290
|
+
|
|
291
|
+
|
|
288
292
|
Seed supports the 18 writable business components created by default with `create-form`, including associations, subforms, countries, domestic addresses, attachments and images. Serial numbers are server-generated. Addresses support the default domestic `ADDRESS` mode; location/international modes and unknown components follow the CLI's actual diagnostics. Unsupported fields proven optional with no validation are omitted and listed in `skippedFields`, with `requestedFieldsVerified=false`; all-omitted input returns `skipped=true` without creating empty records. Server defaults may still apply. Required or uncertain unsupported fields and invalid supported values fail before writes. Recover pending/unknown writes from the receipt. See [support and recovery](yida-skills/skills/yida-data-management/SKILL.md#组件支持与未适配配置).
|
|
289
293
|
|
|
290
294
|
The input file gets a sibling `.seed-receipt.json`. Rerunning the unchanged command reuses verified records and reads back known pending IDs before continuing. An uncertain write without a trusted ID stops for inspection. Keep the receipt: changing the input, target, identity, schema or omission policy rejects reuse instead of silently creating duplicates. A `.lock` prevents concurrent use of the same receipt; after a process crash, confirm it has stopped and inspect its pending writes before removing the stale lock. Field verification covers submitted values; server-side permissions and business rules still apply.
|
|
@@ -574,8 +578,8 @@ When preparing a PR that needs a personal Fork, or when you ask how to support t
|
|
|
574
578
|
|
|
575
579
|
| Command | Description |
|
|
576
580
|
|---------|-------------|
|
|
577
|
-
| `openyida configure-process <appType> <formUuid> <definition> [processCode] [--replace]` | Configure and publish process rules; Supports append/forward via JSON nodes[].actions.normalActions/appendActions |
|
|
578
|
-
| `openyida create-process <appType> <formTitle> <fieldsJsonFile> <processDefinitionFile> [--replace] \| create-process <appType> --formUuid <formUuid> <processDefinitionFile> [--replace]` | Create process form (all-in-one); Supports append/forward via JSON nodes[].actions.normalActions/appendActions |
|
|
581
|
+
| `openyida configure-process <appType> <formUuid> <definition> [processCode] [--replace] [--json]` | Configure and publish process rules; Supports append/forward via JSON nodes[].actions.normalActions/appendActions |
|
|
582
|
+
| `openyida create-process <appType> <formTitle> <fieldsJsonFile> <processDefinitionFile> [--replace] [--json] \| create-process <appType> --formUuid <formUuid> <processDefinitionFile> [--replace] [--json]` | Create process form (all-in-one); Supports append/forward via JSON nodes[].actions.normalActions/appendActions |
|
|
579
583
|
| `openyida ai-form-setting <get\|fields\|models\|enable\|disable\|save> <appType> ...` | Manage process form AI approval prompts |
|
|
580
584
|
| `openyida process preview <appType> ...` | Preview process instance (visual flowchart) |
|
|
581
585
|
| `openyida process fields <appType> <formUuid> [--json]` | Check process designer field loading and subtable field paths |
|
|
@@ -126,8 +126,12 @@ function normalizeAssociationReferences(value, appType) {
|
|
|
126
126
|
typeof association.$form === 'string'
|
|
127
127
|
) {
|
|
128
128
|
const reference = { $form: association.$form };
|
|
129
|
+
const metadata = { ...normalized.associationForm };
|
|
130
|
+
delete metadata.$form;
|
|
131
|
+
delete metadata.field;
|
|
129
132
|
normalized.associationForm = {
|
|
130
133
|
...(appType ? { appType } : {}),
|
|
134
|
+
...metadata,
|
|
131
135
|
formUuid: reference,
|
|
132
136
|
...(typeof association.field === 'string' && association.field.trim() ? {
|
|
133
137
|
mainFieldId: { ...reference, field: association.field },
|
|
@@ -331,7 +335,8 @@ async function schedule(forms, concurrency, results, worker, save) {
|
|
|
331
335
|
// A create may persist the form before a later schema/readback stage fails.
|
|
332
336
|
// Retry that known UUID once inside the same authoritative batch so its
|
|
333
337
|
// dependents remain pending and can run after conservative resume.
|
|
334
|
-
if (!hadKnownFormUuid && results[form.key].formUuid && !recoveryAttempted.has(form.key)
|
|
338
|
+
if (!hadKnownFormUuid && results[form.key].formUuid && !recoveryAttempted.has(form.key)
|
|
339
|
+
&& !error.output?.errorCode?.startsWith('CREATE_FORM_DEFAULT_VIEW_')) {
|
|
335
340
|
recoveryAttempted.add(form.key);
|
|
336
341
|
pending.add(form.key);
|
|
337
342
|
}
|
|
@@ -419,6 +424,7 @@ async function run(args, dependencies = {}) {
|
|
|
419
424
|
...(created.url ? { url: created.url } : {}),
|
|
420
425
|
...(created.formUrl ? { formUrl: created.formUrl } : {}),
|
|
421
426
|
...(created.appUrl ? { appUrl: created.appUrl } : {}),
|
|
427
|
+
...(created.defaultView ? { defaultView: created.defaultView } : {}),
|
|
422
428
|
};
|
|
423
429
|
} catch (error) {
|
|
424
430
|
const createdFormUuid = error.output?.formUuid || error.output?.details?.formUuid;
|
|
@@ -426,6 +432,7 @@ async function run(args, dependencies = {}) {
|
|
|
426
432
|
throw error;
|
|
427
433
|
}
|
|
428
434
|
formUuid = createdFormUuid;
|
|
435
|
+
if (error.output?.errorCode?.startsWith('CREATE_FORM_DEFAULT_VIEW_')) { throw error; }
|
|
429
436
|
shouldResume = true;
|
|
430
437
|
}
|
|
431
438
|
}
|
|
@@ -439,6 +446,7 @@ async function run(args, dependencies = {}) {
|
|
|
439
446
|
...(resumeOutput.url ? { url: resumeOutput.url } : {}),
|
|
440
447
|
...(resumeOutput.formUrl ? { formUrl: resumeOutput.formUrl } : {}),
|
|
441
448
|
...(resumeOutput.appUrl ? { appUrl: resumeOutput.appUrl } : {}),
|
|
449
|
+
...(resumeOutput.defaultView ? { defaultView: resumeOutput.defaultView } : {}),
|
|
442
450
|
};
|
|
443
451
|
resumed = true;
|
|
444
452
|
}
|
|
@@ -450,6 +458,7 @@ async function run(args, dependencies = {}) {
|
|
|
450
458
|
...(resumeOutput.url ? { url: resumeOutput.url } : {}),
|
|
451
459
|
...(resumeOutput.formUrl ? { formUrl: resumeOutput.formUrl } : {}),
|
|
452
460
|
...(resumeOutput.appUrl ? { appUrl: resumeOutput.appUrl } : {}),
|
|
461
|
+
...(resumeOutput.defaultView ? { defaultView: resumeOutput.defaultView } : {}),
|
|
453
462
|
};
|
|
454
463
|
resumed = true;
|
|
455
464
|
schema = await call(['get-schema', options.appType, formUuid, '--field-map-json']);
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { createYidaClient } = require('../../core/yida-client');
|
|
4
|
+
const { CliError } = require('../../core/cli-error');
|
|
5
|
+
const { t } = require('../../core/i18n');
|
|
6
|
+
const { execute } = require('../form-view');
|
|
7
|
+
|
|
8
|
+
const TITLE_IDS = ['processInstanceTitle', 'formInstanceTitle'];
|
|
9
|
+
// Same exclusions as the native data-management table (yc-utils).
|
|
10
|
+
const HIDDEN_COMPONENTS = ['TableField', 'EditorField', 'TimeSelectField', 'RichText', 'Link'];
|
|
11
|
+
|
|
12
|
+
async function configureCreatedFormView(authRef, appType, formUuid) {
|
|
13
|
+
const client = createYidaClient({ authRef });
|
|
14
|
+
const target = { appType, formUuid };
|
|
15
|
+
try {
|
|
16
|
+
const listed = await execute({ ...target, action: 'list', flags: {} }, client);
|
|
17
|
+
const view = listed.views.find(item => item.viewType === 'table');
|
|
18
|
+
if (!view) {
|
|
19
|
+
throw new CliError(t('form_view.unsupported'), { code: 'CREATE_FORM_DEFAULT_VIEW_MISSING' });
|
|
20
|
+
}
|
|
21
|
+
const viewTarget = { ...target, viewUuid: view.viewUuid };
|
|
22
|
+
const inspected = await execute({ ...viewTarget, action: 'inspect', flags: {} }, client);
|
|
23
|
+
const { config, fields, configHash } = inspected;
|
|
24
|
+
const configured = config.defaultConfig.showFields;
|
|
25
|
+
const allowed = config.staticConfig.columnFilter;
|
|
26
|
+
const showFields = Array.isArray(configured) && configured.length
|
|
27
|
+
? configured
|
|
28
|
+
: fields.filter(field => field.supportVisible === true && field.showTerm === 'y'
|
|
29
|
+
&& !HIDDEN_COMPONENTS.includes(field.componentName)
|
|
30
|
+
&& (!Array.isArray(allowed) || allowed.includes('all') || allowed.includes(field.id)))
|
|
31
|
+
.sort((a, b) => a.showOrder - b.showOrder).map(field => field.id);
|
|
32
|
+
const titleIds = showFields.filter(id => TITLE_IDS.includes(id));
|
|
33
|
+
const ordered = [...showFields.filter(id => !TITLE_IDS.includes(id)), ...titleIds];
|
|
34
|
+
// A hidden title stays hidden; a one-column view still gets a concrete server default.
|
|
35
|
+
if (!ordered.length) {
|
|
36
|
+
throw new CliError(t('form_view.invalid_config', 'showFields'), { code: 'CREATE_FORM_DEFAULT_VIEW_EMPTY' });
|
|
37
|
+
}
|
|
38
|
+
const saved = await execute({ ...viewTarget, action: 'save', flags: { '--expected-hash': configHash } },
|
|
39
|
+
client, { configPatch: { defaultConfig: { showFields: ordered } } });
|
|
40
|
+
return { viewUuid: view.viewUuid, changed: saved.changed, readbackVerified: saved.readbackVerified,
|
|
41
|
+
showFields: saved.config.defaultConfig.showFields, ...(saved.backupPath ? { backupPath: saved.backupPath } : {}) };
|
|
42
|
+
} catch (error) {
|
|
43
|
+
throw new CliError(error.message, { code: error.code?.startsWith('CREATE_FORM_DEFAULT_VIEW_')
|
|
44
|
+
? error.code : 'CREATE_FORM_DEFAULT_VIEW_FAILED', details: {
|
|
45
|
+
...error.details, ...target, causeCode: error.code, stage: 'configureDefaultView', formCreated: true,
|
|
46
|
+
} });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
module.exports = { configureCreatedFormView };
|
package/lib/app/create-form.js
CHANGED
|
@@ -83,6 +83,7 @@ const { createParseArgs } = require('./create-form/args');
|
|
|
83
83
|
const { createDefinitionReaders } = require('./create-form/definition-reader');
|
|
84
84
|
const { dispatchCreateFormCommand } = require('./create-form/commands');
|
|
85
85
|
const { buildApiPath } = require('./create-form/api-path');
|
|
86
|
+
const { configureCreatedFormView } = require('./create-form/default-view');
|
|
86
87
|
const {
|
|
87
88
|
FORM_NAV_ICON_GROUPS,
|
|
88
89
|
FORM_NAV_ICONS,
|
|
@@ -5004,6 +5005,7 @@ async function mainCreate(parsedArgs, authRef) {
|
|
|
5004
5005
|
const formUuid = createResult.content.formUuid || createResult.content;
|
|
5005
5006
|
success(t('create_form.blank_created', formUuid));
|
|
5006
5007
|
let postCreateStage = 'getFormSchema';
|
|
5008
|
+
let defaultView;
|
|
5007
5009
|
try {
|
|
5008
5010
|
const shellSchemaResult = await requestWithAutoLogin(function (auth) {
|
|
5009
5011
|
return sendGetRequest(
|
|
@@ -5052,6 +5054,8 @@ async function mainCreate(parsedArgs, authRef) {
|
|
|
5052
5054
|
await updateCreatedFormNavigationIcon(authRef, appType, formUuid, formIcon);
|
|
5053
5055
|
postCreateStage = 'verifyFinalSchema';
|
|
5054
5056
|
await verifyCreatedFormSchema(authRef, appType, formUuid, fields);
|
|
5057
|
+
postCreateStage = 'configureDefaultView';
|
|
5058
|
+
defaultView = await configureCreatedFormView(authRef, appType, formUuid);
|
|
5055
5059
|
} catch (err) {
|
|
5056
5060
|
emitCreateFormPostCreateFailure({
|
|
5057
5061
|
appType,
|
|
@@ -5071,7 +5075,7 @@ async function mainCreate(parsedArgs, authRef) {
|
|
|
5071
5075
|
['URL', formUrl],
|
|
5072
5076
|
]);
|
|
5073
5077
|
console.log(JSON.stringify(withBrowserHandoff(
|
|
5074
|
-
{ success: true, formUuid, formTitle, appType, fieldCount, icon: formIcon, iconSource: iconResolution.source, url: formUrl, formUrl, appUrl },
|
|
5078
|
+
{ success: true, formUuid, formTitle, appType, fieldCount, defaultView, icon: formIcon, iconSource: iconResolution.source, url: formUrl, formUrl, appUrl },
|
|
5075
5079
|
formUrl,
|
|
5076
5080
|
{ stage: 'create_form_success', title: formTitle },
|
|
5077
5081
|
parsedArgs.browserOpenMode
|
|
@@ -5159,7 +5163,8 @@ async function createFormForLegacyProcessQuiet(context, input) {
|
|
|
5159
5163
|
const saveResult = await saveFormSchema(authRef, appType, formUuid, schema, serverRevision, 4);
|
|
5160
5164
|
await verifyCreatedFormSchema(authRef, appType, formUuid, fields);
|
|
5161
5165
|
const navIconResult = await updateCreatedFormNavigationIcon(authRef, appType, formUuid, formIcon);
|
|
5162
|
-
await verifyCreatedFormSchema(authRef, appType, formUuid, fields);
|
|
5166
|
+
const verifiedSchema = await verifyCreatedFormSchema(authRef, appType, formUuid, fields);
|
|
5167
|
+
const defaultView = await configureCreatedFormView(authRef, appType, formUuid);
|
|
5163
5168
|
const { appUrl, formUrl } = buildFormDeliveryUrls(authRef.baseUrl, appType, formUuid);
|
|
5164
5169
|
return {
|
|
5165
5170
|
success: true,
|
|
@@ -5167,9 +5172,13 @@ async function createFormForLegacyProcessQuiet(context, input) {
|
|
|
5167
5172
|
formUuid,
|
|
5168
5173
|
formTitle,
|
|
5169
5174
|
fieldCount,
|
|
5175
|
+
fields: require('./schema-field-resolution').normalizeSchemaFields({ content: verifiedSchema })
|
|
5176
|
+
.filter(field => /Field$/.test(field.componentType)).map(field => ({ fieldId: field.fieldId,
|
|
5177
|
+
label: field.label, componentName: field.componentType, parentFieldId: field.parentFieldId, labelPath: field.labelPath, alias: field.alias })),
|
|
5170
5178
|
createResult,
|
|
5171
5179
|
saveResult,
|
|
5172
5180
|
navIconResult,
|
|
5181
|
+
defaultView,
|
|
5173
5182
|
icon: formIcon,
|
|
5174
5183
|
iconSource: iconResolution.source,
|
|
5175
5184
|
url: formUrl,
|
|
@@ -6176,6 +6185,7 @@ async function verifyCreatedFormSchema(authRef, appType, formUuid, fields) {
|
|
|
6176
6185
|
missingFieldCount: verified.missing.length, diagnostics: verified.conflicts,
|
|
6177
6186
|
});
|
|
6178
6187
|
}
|
|
6188
|
+
return readback.schema;
|
|
6179
6189
|
}
|
|
6180
6190
|
|
|
6181
6191
|
function isRetryableResumeSaveServerFailure(errorObject) {
|
|
@@ -6349,6 +6359,8 @@ async function mainResume(parsedArgs, authRef) {
|
|
|
6349
6359
|
});
|
|
6350
6360
|
}
|
|
6351
6361
|
completedStages.push('verify_final_schema');
|
|
6362
|
+
const defaultView = await configureCreatedFormView(authRef, appType, formUuid);
|
|
6363
|
+
completedStages.push('configure_default_view');
|
|
6352
6364
|
const { appUrl, formUrl } = buildFormDeliveryUrls(authRef.baseUrl, appType, formUuid);
|
|
6353
6365
|
const output = {
|
|
6354
6366
|
success: true,
|
|
@@ -6360,6 +6372,7 @@ async function mainResume(parsedArgs, authRef) {
|
|
|
6360
6372
|
addedFieldCount: plan.missing.length,
|
|
6361
6373
|
finalFieldCount: collectResumeFieldEvidence(finalContainer.children).length,
|
|
6362
6374
|
recoveredBlankShell,
|
|
6375
|
+
defaultView,
|
|
6363
6376
|
url: formUrl,
|
|
6364
6377
|
formUrl,
|
|
6365
6378
|
appUrl,
|
|
@@ -6587,6 +6600,7 @@ module.exports = {
|
|
|
6587
6600
|
run,
|
|
6588
6601
|
parseArgs,
|
|
6589
6602
|
_private: {
|
|
6603
|
+
readFieldsDefinition,
|
|
6590
6604
|
buildFormSchema,
|
|
6591
6605
|
buildEmptyFormSchema,
|
|
6592
6606
|
buildFormNodeComponent,
|
package/lib/app/form-view.js
CHANGED
|
@@ -243,7 +243,7 @@ function backup(value, filename) {
|
|
|
243
243
|
return output;
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
async function execute(parsed, client = createYidaClient({ authRef: createAuthRef() })) {
|
|
246
|
+
async function execute(parsed, client = createYidaClient({ authRef: createAuthRef() }), options = {}) {
|
|
247
247
|
const { action, appType, formUuid, viewUuid, flags } = parsed;
|
|
248
248
|
const prefix = `/dingtalk/web/${appType}/query/`;
|
|
249
249
|
const buttonUuid = flags['--button'];
|
|
@@ -338,7 +338,7 @@ async function execute(parsed, client = createYidaClient({ authRef: createAuthRe
|
|
|
338
338
|
endpoint = 'dataview/updateConfig.json';
|
|
339
339
|
} else if (action === 'save') {
|
|
340
340
|
if (views.find(view => view.viewUuid === viewUuid).viewType !== 'table') { fail('UNSUPPORTED', 'unsupported'); }
|
|
341
|
-
const patch = validatePatch(parseJson(fs.readFileSync(flags['--config'], 'utf8'), 'config'));
|
|
341
|
+
const patch = validatePatch(options.configPatch ?? parseJson(fs.readFileSync(flags['--config'], 'utf8'), 'config'));
|
|
342
342
|
if (flags['--replace'] && (!patch.staticConfig || !patch.defaultConfig || !flags['--expected-hash'])) {
|
|
343
343
|
fail('INVALID_CONFIG', 'invalid_config', '--replace requires staticConfig, defaultConfig, --expected-hash');
|
|
344
344
|
}
|
package/lib/app/publish.js
CHANGED
|
@@ -788,6 +788,12 @@ async function runMain(argv) {
|
|
|
788
788
|
let baseUrl = authRef.baseUrl;
|
|
789
789
|
await ensurePublishTargetOrExit(appType, formUuid, authRef, { force });
|
|
790
790
|
baseUrl = authRef.baseUrl;
|
|
791
|
+
if (isCanvas) {
|
|
792
|
+
await require('./services/field-bindings').verifyDeclaredBindings(sourceCode, (boundAppType, boundFormUuid) =>
|
|
793
|
+
requestWithAutoLogin(auth => httpGet(auth.baseUrl,
|
|
794
|
+
`/alibaba/web/${boundAppType}/_view/query/formdesign/getFormSchema.json`,
|
|
795
|
+
{ formUuid: boundFormUuid, schemaVersion: SCHEMA_VERSION }), authRef));
|
|
796
|
+
}
|
|
791
797
|
|
|
792
798
|
let schemaContent;
|
|
793
799
|
let expectedSchemaContent;
|
|
@@ -1,6 +1,98 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { normalizeSchemaFields } = require('../schema-field-resolution');
|
|
4
|
+
const Babel = require('../../core/babel');
|
|
5
|
+
const { buildWriteContract } = require('../form-data-contract');
|
|
6
|
+
const { CliError } = require('../../core/cli-error');
|
|
7
|
+
const { t } = require('../../core/i18n');
|
|
8
|
+
|
|
9
|
+
function invalidBinding(details) {
|
|
10
|
+
throw new CliError(t('data_verify.binding_invalid'), { code: 'PAGE_DATA_BINDING_INVALID',
|
|
11
|
+
details: { ...details, remoteWrites: 0, nextStep: 'bind_real_schema_fields_and_options' } });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Read JSON constants and aliases only; application code is never executed. */
|
|
15
|
+
function collectDeclaredBindings(source) {
|
|
16
|
+
const ast = Babel.packages.parser.parse(source, { sourceType: 'module', plugins: ['jsx', 'typescript'] });
|
|
17
|
+
const traverse = Babel.packages.traverse.default;
|
|
18
|
+
const unknown = Symbol('dynamic');
|
|
19
|
+
function literal(at, seen = new Set(), selectedKeys) {
|
|
20
|
+
if (!at?.node || seen.has(at.node) || seen.size > 40) {return unknown;}
|
|
21
|
+
seen = new Set(seen).add(at.node);
|
|
22
|
+
if (at.isStringLiteral() || at.isNumericLiteral() || at.isBooleanLiteral()) {return at.node.value;}
|
|
23
|
+
if (at.isNullLiteral()) {return null;}
|
|
24
|
+
if (at.isIdentifier()) {
|
|
25
|
+
const binding = at.scope.getBinding(at.node.name);
|
|
26
|
+
return binding?.constant && binding.path.isVariableDeclarator() && binding.path.parent.kind === 'const'
|
|
27
|
+
? literal(binding.path.get('init'), seen, selectedKeys) : unknown;
|
|
28
|
+
}
|
|
29
|
+
if (at.isMemberExpression()) {
|
|
30
|
+
const object = literal(at.get('object'), seen);
|
|
31
|
+
const key = at.node.computed ? literal(at.get('property'), seen) : at.node.property.name;
|
|
32
|
+
return object && typeof object === 'object' && Object.prototype.hasOwnProperty.call(object, key) ? object[key] : unknown;
|
|
33
|
+
}
|
|
34
|
+
if (at.isArrayExpression()) {
|
|
35
|
+
const items = at.get('elements').map(item => literal(item, seen));
|
|
36
|
+
return items.includes(unknown) ? unknown : items;
|
|
37
|
+
}
|
|
38
|
+
if (at.isObjectExpression()) {
|
|
39
|
+
const result = Object.create(null);
|
|
40
|
+
for (const item of at.get('properties')) {
|
|
41
|
+
if (item.isSpreadElement()) {
|
|
42
|
+
const spread = literal(item.get('argument'), seen, selectedKeys);
|
|
43
|
+
if (!spread || typeof spread !== 'object' || Array.isArray(spread)) {return unknown;}
|
|
44
|
+
Object.assign(result, spread);
|
|
45
|
+
} else if (item.isObjectProperty()) {
|
|
46
|
+
const key = item.node.computed ? literal(item.get('key'), seen) : item.node.key.name || item.node.key.value;
|
|
47
|
+
if (selectedKeys && key !== unknown && !selectedKeys.includes(key)) {continue;}
|
|
48
|
+
const value = literal(item.get('value'), seen);
|
|
49
|
+
if (key === unknown || value === unknown) {return unknown;}
|
|
50
|
+
result[key] = value;
|
|
51
|
+
} else {return unknown;}
|
|
52
|
+
}
|
|
53
|
+
return result;
|
|
54
|
+
}
|
|
55
|
+
return unknown;
|
|
56
|
+
}
|
|
57
|
+
const bindings = [];
|
|
58
|
+
traverse(ast, { ObjectExpression(at) {
|
|
59
|
+
const mode = at.get('properties').find(item => item.isObjectProperty() && !item.node.computed && (item.node.key.name || item.node.key.value) === 'mode');
|
|
60
|
+
const fields = at.get('properties').some(item => item.isObjectProperty() && !item.node.computed && (item.node.key.name || item.node.key.value) === 'fields');
|
|
61
|
+
if (!mode || !fields || !['form', 'process'].includes(literal(mode.get('value')))) {return;}
|
|
62
|
+
const value = literal(at, new Set(), ['mode', 'appType', 'formUuid', 'fields', 'optionValues']);
|
|
63
|
+
if (value === unknown || typeof value.appType !== 'string' || typeof value.formUuid !== 'string'
|
|
64
|
+
|| !value.fields || typeof value.fields !== 'object' || Array.isArray(value.fields)) {
|
|
65
|
+
invalidBinding({ reason: 'declared_binding_requires_static_resource_and_fields', line: at.node.loc?.start.line });
|
|
66
|
+
}
|
|
67
|
+
bindings.push(value);
|
|
68
|
+
} });
|
|
69
|
+
return bindings;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function verifyDeclaredBindings(source, readSchema) {
|
|
73
|
+
const bindings = collectDeclaredBindings(source);
|
|
74
|
+
const schemas = new Map();
|
|
75
|
+
for (const binding of bindings) {
|
|
76
|
+
const key = JSON.stringify([binding.appType, binding.formUuid]);
|
|
77
|
+
if (!schemas.has(key)) {schemas.set(key, await readSchema(binding.appType, binding.formUuid));}
|
|
78
|
+
const schema = schemas.get(key);
|
|
79
|
+
if (schema?.success !== true) {invalidBinding({ formUuid: binding.formUuid, reason: 'schema_unavailable' });}
|
|
80
|
+
const verification = verifyFieldBindings(schema, binding.fields);
|
|
81
|
+
if (verification.missing.length || verification.mismatched.length) {
|
|
82
|
+
invalidBinding({ formUuid: binding.formUuid, ...verification });
|
|
83
|
+
}
|
|
84
|
+
const contract = buildWriteContract(schema);
|
|
85
|
+
for (const [semantic, values] of Object.entries(binding.optionValues || {})) {
|
|
86
|
+
const fieldId = normalizeExpectedBinding(binding.fields[semantic]).fieldId;
|
|
87
|
+
const options = contract.props[fieldId]?.dataSource;
|
|
88
|
+
const allowed = Array.isArray(options) ? options.map(item => typeof item === 'object' && item ? item.value : item) : [];
|
|
89
|
+
if (!fieldId || !Array.isArray(values) || values.some(value => !allowed.includes(value))) {
|
|
90
|
+
invalidBinding({ formUuid: binding.formUuid, fieldId, reason: 'option_value_mismatch', values, allowed });
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return { verifiedBindings: bindings.length, schemaReads: schemas.size };
|
|
95
|
+
}
|
|
4
96
|
|
|
5
97
|
function normalizeSchemaResult(schemaResult) {
|
|
6
98
|
if (schemaResult && schemaResult.content) {
|
|
@@ -65,4 +157,6 @@ function verifyFieldBindings(schemaResult, expectedBindings, options) {
|
|
|
65
157
|
|
|
66
158
|
module.exports = {
|
|
67
159
|
verifyFieldBindings,
|
|
160
|
+
collectDeclaredBindings,
|
|
161
|
+
verifyDeclaredBindings,
|
|
68
162
|
};
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
// This endpoint leaves data unset when there are no stored rows. Hidden-field
|
|
4
|
+
// filtering instead supplies data:[] with totalCount:0; that shape is ambiguous.
|
|
5
|
+
function isOmittedEmptySubformPage(response) {
|
|
6
|
+
const page = response && response.content;
|
|
7
|
+
return response?.success === true && page !== null && typeof page === 'object' && !Array.isArray(page)
|
|
8
|
+
&& page.currentPage === 1 && page.totalCount === 0
|
|
9
|
+
&& Object.keys(page).every(key => ['idCursor', 'currentPage', 'totalCount'].includes(key))
|
|
10
|
+
&& !['data', 'dataList', 'rows'].some(key => Object.prototype.hasOwnProperty.call(page, key));
|
|
11
|
+
}
|
|
12
|
+
|
|
3
13
|
// Kept in sync with the standalone Canvas sample; no network or guessed clears.
|
|
4
14
|
function readCanvasSubformRows(row, fieldId) {
|
|
5
15
|
const own = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
@@ -57,4 +67,4 @@ function readCanvasSubformRows(row, fieldId) {
|
|
|
57
67
|
return { status: 'ready', rows, error: null };
|
|
58
68
|
}
|
|
59
69
|
|
|
60
|
-
module.exports = { readCanvasSubformRows };
|
|
70
|
+
module.exports = { readCanvasSubformRows, isOmittedEmptySubformPage };
|
package/lib/core/babel.js
CHANGED
|
@@ -2,9 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
const { transformSync } = require('@babel/core');
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// Keep compilation independent of project Babel and Browserslist configuration.
|
|
6
6
|
function transform(source, options = {}) {
|
|
7
|
-
return transformSync(source, {
|
|
7
|
+
return transformSync(source, {
|
|
8
|
+
...options,
|
|
9
|
+
babelrc: false,
|
|
10
|
+
configFile: false,
|
|
11
|
+
browserslistConfigFile: false,
|
|
12
|
+
});
|
|
8
13
|
}
|
|
9
14
|
|
|
10
15
|
module.exports = {
|
|
@@ -1483,7 +1483,7 @@ const COMMAND_GROUPS = [
|
|
|
1483
1483
|
{ name: 'check', type: 'boolean', source: 'option', builder_options: ['--check'], description: 'Validate definitions and dependency groups locally.' },
|
|
1484
1484
|
{ name: 'json', type: 'boolean', source: 'option', builder_options: ['--json'] },
|
|
1485
1485
|
],
|
|
1486
|
-
notes: ['Creates independent normal forms concurrently after dependency validation. Each plan item accepts layout (single/double/card/section), theme (default/compact/comfortable), labelAlign (top/left/right), icon and locale, and forwards them to create-form create. References resolve from successful schema readbacks. Existing formUuid entries are read-only reuse. Saves IDs and status beside the plan; recoveryAction and nextAction are enum values: rerun_unchanged_plan reuses successful results and resumes known form IDs; inspect_unknown_write_then_reconcile requires checking uncertain writes before rerunning. Results expose appUrl and formUrl; url remains the compatible form entry. Navigation ordering and shared app configuration follow the batch.'],
|
|
1486
|
+
notes: ['Creates independent normal forms concurrently after dependency validation. Each plan item accepts layout (single/double/card/section), theme (default/compact/comfortable), labelAlign (top/left/right), icon and locale, and forwards them to create-form create. References resolve from successful schema readbacks. Existing formUuid entries are read-only reuse. Saves IDs and status beside the plan; recoveryAction and nextAction are enum values: rerun_unchanged_plan reuses successful results and resumes known form IDs; inspect_unknown_write_then_reconcile requires checking uncertain writes before rerunning. Results expose appUrl and formUrl; url remains the compatible form entry. Newly created/resumed forms also expose verified defaultView column settings. View configuration failures retain the form ID and stop automatic recovery until remote state has been inspected. Navigation ordering and shared app configuration follow the batch.'],
|
|
1487
1487
|
}),
|
|
1488
1488
|
command('create-form.create', ['create-form', 'create'], 'create-form create <appType> "<formTitle>" <fieldsJsonFile> [--layout single|double|card|section] [--theme default|compact|comfortable] [--label-align top|left|right] [--icon auto|<iconName>] [--locale zh_CN|en_US|ja_JP] [--open|--no-open]', 'help.cmd_create_form', { managedRun: {'scope':'app','appPosition':1,'mutation':{'operation':'create_form'}},
|
|
1489
1489
|
args: [
|
|
@@ -1607,6 +1607,7 @@ const COMMAND_GROUPS = [
|
|
|
1607
1607
|
'openyida commands build create-form.create --app-type APP_XXX --form-title "访客登记" --fields-json-file .cache/openyida/visitor/fields.json --layout section --theme comfortable --label-align left --locale zh_CN --no-open --json',
|
|
1608
1608
|
],
|
|
1609
1609
|
notes: [
|
|
1610
|
+
'Creation saves and verifies the first native table view server-side, moving the visible instance title to the last data column while preserving other column visibility/order and view settings. Success includes defaultView with viewUuid, showFields and readbackVerified. A view configuration failure retains the created formUuid; recover that same form with create-form resume. User-specific column settings can be saved afterward using form-view save.',
|
|
1610
1611
|
'Divider accepts the 23 visible platform styles (none is excluded) through field JSON dividerType, not a CLI flag. Omission falls back to bold-with-thin; invalid supplied styles fail. Choose per business page and keep same-level sections consistent; see summary.core_workflows.full_app_build.divider_style_contract.',
|
|
1611
1612
|
'Divider colorType defaults to theme. If default bindings are unsuitable for the current theme, use custom with backgroundColor, secondaryColor and titleColor designed together; explicit user color values are not required. These are field JSON properties, not CLI flags. Dark-content and composite-title guidance is advisory, not a new validation or upload/save gate.',
|
|
1612
1613
|
],
|
|
@@ -1639,7 +1640,7 @@ const COMMAND_GROUPS = [
|
|
|
1639
1640
|
}),
|
|
1640
1641
|
command('create-form.update', ['create-form', 'update'], 'create-form update <appType> <formUuid> (<changesJsonOrFile> | --data-file <changesJsonOrFile>) [--locale zh_CN|en_US|ja_JP] [--open|--no-open]', 'help.cmd_update_form', { managedRun: { scope: 'app', appPosition: 1, mutation: { operation: 'update_form', formUuidPosition: 2 } } }),
|
|
1641
1642
|
command('create-form.resume', ['create-form', 'resume'], 'create-form resume <appType> <formUuid> <fieldsJsonOrFile> [--json]', 'help.cmd_update_form', { managedRun: { scope: 'app', appPosition: 1, mutation: { operation: 'update_form', formUuidPosition: 2 } },
|
|
1642
|
-
notes: ['On save-schema HTTP 5xx, read back the latest schema. Accept already-applied fields or retry missing compatible fields once with the latest revision; conflicts and other failures stop. Success includes appUrl, formUrl and the compatible url field.'],
|
|
1643
|
+
notes: ['On save-schema HTTP 5xx, read back the latest schema. Accept already-applied fields or retry missing compatible fields once with the latest revision; conflicts and other failures stop. Also saves and verifies server-side default view columns with the visible instance title last. Success includes defaultView, appUrl, formUrl and the compatible url field.'],
|
|
1643
1644
|
}),
|
|
1644
1645
|
command('create-form.patch', ['create-form', 'patch'], 'create-form patch <appType> <formUuid> <patchJsonOrFile> [--open|--no-open]', 'help.cmd_update_form', { managedRun: { scope: 'app', appPosition: 1, mutation: { operation: 'update_form', formUuidPosition: 2 } } }),
|
|
1645
1646
|
command('create-form.rule', ['create-form', 'rule'], 'create-form rule <appType> <formUuid> <rulesJsonOrFile> [--open|--no-open]', 'help.cmd_update_form', { managedRun: { scope: 'app', appPosition: 1, mutation: { operation: 'update_form', formUuidPosition: 2 } } }),
|
|
@@ -1842,6 +1843,8 @@ const COMMAND_GROUPS = [
|
|
|
1842
1843
|
seed: { scope: 'actions', actions: {
|
|
1843
1844
|
form: { scope: 'app', appPosition: 2,
|
|
1844
1845
|
mutation: { operation: 'create_form_data', formUuidPosition: 3, forbiddenFlags: ['--check'] } },
|
|
1846
|
+
process: { scope: 'app', appPosition: 2,
|
|
1847
|
+
mutation: { operation: 'create_form_data', formUuidPosition: 3, forbiddenFlags: ['--check'] } },
|
|
1845
1848
|
} },
|
|
1846
1849
|
update: { scope: 'actions', actions: {
|
|
1847
1850
|
form: { scope: 'app', appPosition: 2, mutation: { operation: 'update_form_data', formUuidOption: '--form-uuid' } },
|
|
@@ -1863,11 +1866,11 @@ const COMMAND_GROUPS = [
|
|
|
1863
1866
|
{ name: 'verifyWrite', type: 'boolean', source: 'option', builder_options: ['--verify-write'],
|
|
1864
1867
|
description: 'Ordinary form create/update only: live-schema payload preflight and submitted-field readback after one write.' },
|
|
1865
1868
|
{ name: 'recordsFile', type: 'string', source: 'option', builder_options: ['--records-file'],
|
|
1866
|
-
description: 'seed form
|
|
1869
|
+
description: 'seed form/process: JSON array of 1–30 schema-shaped records; process also requires --process-code and starts real approvals. Receipt saved beside this file.' },
|
|
1867
1870
|
{ name: 'timezone', type: 'string', source: 'option', builder_options: ['--timezone'],
|
|
1868
|
-
description: 'seed form
|
|
1871
|
+
description: 'seed form/process: fixed UTC offset for date strings without an offset, default +08:00.' },
|
|
1869
1872
|
{ name: 'check', type: 'boolean', source: 'option', builder_options: ['--check'],
|
|
1870
|
-
description: 'seed form
|
|
1873
|
+
description: 'seed form/process: return schema-validated, converted records without writing records or receipts.' },
|
|
1871
1874
|
],
|
|
1872
1875
|
notes: [
|
|
1873
1876
|
'--verify-write is opt-in for ordinary form create/update. It validates supplied field IDs, optional configured aliases, scoped subform references and supported value formats before writing, then reads the same instance and compares submitted fields. Labels are suggestions only; ambiguous aliases and unsupported formats fail before writing. ID/count alone is not field verification. Readback failure or mismatch exits nonzero, preserves partial.formInstId/candidateIds and mutationAccepted, and never repeats the write. Existing identity/permission gates and managed-run scope remain unchanged. Verification covers submitted business values, not all application acceptance criteria or server-side business rules.',
|
|
@@ -1879,6 +1882,7 @@ const COMMAND_GROUPS = [
|
|
|
1879
1882
|
],
|
|
1880
1883
|
examples: [
|
|
1881
1884
|
'openyida data seed form APP_XXX FORM_XXX --expect-form-name 客户 --records-file .cache/openyida/data-import/customers.json --timezone +08:00 --json',
|
|
1885
|
+
'openyida data seed process APP_XXX FORM_XXX --process-code TPROC_XXX --expect-form-name 申请 --records-file .cache/openyida/data-import/applications.json --json',
|
|
1882
1886
|
'openyida data query process APP_XXX FORM_XXX --current-approver USER_ID --count',
|
|
1883
1887
|
'openyida data query form APP_XXX FORM_XXX --page 1 --size 20 --search-json \'[{"key":"dateField_due","componentName":"DateField","type":"DOUBLE","operator":"is","value":""}]\'',
|
|
1884
1888
|
'openyida data create form APP_XXX FORM_XXX --expect-form-name 客户 --expect-form-type receipt --data-json \'{"textField_name":"客户 A","dateField_followUp":1787932800000}\'',
|
|
@@ -1938,11 +1942,11 @@ const COMMAND_GROUPS = [
|
|
|
1938
1942
|
id: 'process',
|
|
1939
1943
|
titleKey: 'help.group_process',
|
|
1940
1944
|
commands: [
|
|
1941
|
-
command('configure-process', ['configure-process'], 'configure-process <appType> <formUuid> <definition> [processCode] [--replace]', 'help.cmd_configure_process', { managedRun: {'scope':'app','appPosition':0,'mutation':{'operation':'update_process','formUuidPosition':1}},
|
|
1945
|
+
command('configure-process', ['configure-process'], 'configure-process <appType> <formUuid> <definition> [processCode] [--replace] [--json]', 'help.cmd_configure_process', { managedRun: {'scope':'app','appPosition':0,'mutation':{'operation':'update_process','formUuidPosition':1}},
|
|
1942
1946
|
resultReuse: { mode: 'non_replayable_write', inputs: ['definition'], onInputChange: 'read_back_and_confirm_new_update', reason: 'May create and publish a new process version; --replace is not an idempotency key.' },
|
|
1943
1947
|
examples: ['openyida configure-process APP_XXX FORM_XXX .cache/openyida/process/process-with-actions.json'],
|
|
1944
1948
|
}),
|
|
1945
|
-
command('create-process', ['create-process'], 'create-process <appType> <formTitle> <fieldsJsonFile> <processDefinitionFile> [--replace] | create-process <appType> --formUuid <formUuid> <processDefinitionFile> [--replace]', 'help.cmd_create_process', { managedRun: { scope: 'app', appPosition: 0, mutation: { operation: 'create_process' } },
|
|
1949
|
+
command('create-process', ['create-process'], 'create-process <appType> <formTitle> <fieldsJsonFile> <processDefinitionFile> [--replace] [--json] | create-process <appType> --formUuid <formUuid> <processDefinitionFile> [--replace] [--json]', 'help.cmd_create_process', { managedRun: { scope: 'app', appPosition: 0, mutation: { operation: 'create_process' } },
|
|
1946
1950
|
output: 'json',
|
|
1947
1951
|
noteKeys: ['help.create_process_notes'],
|
|
1948
1952
|
examples: [
|
|
@@ -2506,7 +2510,7 @@ function summarizeLocalizedCommands(commands) {
|
|
|
2506
2510
|
'yida-data-source-connectors',
|
|
2507
2511
|
'yida-dashboard',
|
|
2508
2512
|
],
|
|
2509
|
-
completion_contract: 'Clarify core functions and actual usage first, then resolve the required resource context and settle entry navigation before PRD planning. Fast creates/reuses the app immediately from clear scope, independently generates app_theme.css from theme/color, and develops independent pages; no prebuild Plan/full JSON/context gate; Plan uses design-plan init/preview/materialize/patch and confirms the current revision. Validate the selected mode input, create or reuse app and core forms/processes, seed and
|
|
2513
|
+
completion_contract: 'Clarify core functions and actual usage first, then resolve the required resource context and settle entry navigation before PRD planning. Fast creates/reuses the app immediately from clear scope, independently generates app_theme.css from theme/color, and develops independent pages; no prebuild Plan/full JSON/context gate; Plan uses design-plan init/preview/materialize/patch and confirms the current revision. Validate the selected mode input, create or reuse app and core forms/processes, seed and verify core normal-form samples, run confirmed process samples through temporary self-approval, seed verification, editing and final publication, or record an allowed skip reason, then implement the primary page in PRD resource order, publish it, apply PRD navigation order or lightweight fallback navigation order for platform navigation, or verify app and per-page hiding for application-wide custom navigation. For a standalone frontend in a platform-navigation app, verify that page independently and retain workspace navigation. Before returning up to three verified application entry URLs, persist and read back the verified in-scope frontend/management access addresses through app-entry get/set; final business links come from urls.frontend/management, not the last publish result. Include workbench when a management or unified workspace is in scope; backend-only delivers its business backend and developer admin URL without adding a frontend; frontend-only delivery includes its verified frontend entry and developer admin URL, without inventing a business backend. Always include developer adminUrl for complete application delivery unless explicitly excluded by the user, regardless of auth runtime; this is separate from the optional business backend. Use create-app or app-list URL fields and state any unavailable entry instead of silently omitting it. Put the verified business summary, results and remaining work in the delivery artifact description; use the final response when no delivery tool is available.',
|
|
2510
2514
|
},
|
|
2511
2515
|
},
|
|
2512
2516
|
};
|