@lingjingai/lj-awb-cli-pre 0.4.7 → 0.4.8

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.
@@ -435,136 +435,6 @@ function normalizeList(data = {}, keys) {
435
435
  });
436
436
  }
437
437
 
438
- function normalizeArtifactList(commandName, data) {
439
- if (Array.isArray(data)) {
440
- return compactRecord({ count: data.length, items: cleanNested(data) });
441
- }
442
- if (!isPlainObject(data)) return cleanNested(data);
443
- const arrayKey = Object.keys(data).find((key) => Array.isArray(data[key]));
444
- if (arrayKey) {
445
- return compactRecord({
446
- count: data.count ?? data[arrayKey].length,
447
- [arrayKey]: cleanNested(data[arrayKey]),
448
- ...Object.fromEntries(
449
- Object.entries(data)
450
- .filter(([key]) => key !== arrayKey && key !== 'raw')
451
- .map(([key, value]) => [key, cleanNested(value)]),
452
- ),
453
- });
454
- }
455
- return cleanNested(data);
456
- }
457
-
458
- function normalizeArtifactRecord(data) {
459
- if (!isPlainObject(data)) return cleanNested(data);
460
- const out = compactRecord({
461
- id: data.id,
462
- projectId: data.projectId,
463
- rowKind: data.rowKind,
464
- entityKey: data.entityKey,
465
- parentKey: data.parentKey,
466
- sortOrder: data.sortOrder,
467
- actorKey: data.actorKey,
468
- propKey: data.propKey,
469
- locationKey: data.locationKey,
470
- stateKey: data.stateKey,
471
- episodeId: data.episodeId,
472
- sceneId: data.sceneId,
473
- clipId: data.clipId,
474
- videoEpisodeId: data.videoEpisodeId,
475
- status: data.status,
476
- title: data.title,
477
- name: data.name,
478
- displayName: data.displayName,
479
- description: data.description,
480
- });
481
- for (const [key, value] of Object.entries(data)) {
482
- if (key in out) continue;
483
- if (Array.isArray(value)) out[`${key}Count`] = value.length;
484
- else if (!isPlainObject(value)) out[key] = value;
485
- }
486
- return cleanNested(out);
487
- }
488
-
489
- function normalizeArtifactFull(data) {
490
- if (!isPlainObject(data)) return cleanNested(data);
491
- const out = compactRecord({
492
- projectId: data.projectId,
493
- id: data.id,
494
- title: data.title,
495
- status: data.status,
496
- });
497
- for (const [key, value] of Object.entries(data)) {
498
- if (Array.isArray(value)) out[`${key}Count`] = value.length;
499
- else if (isPlainObject(value)) {
500
- const innerKey = Object.keys(value).find((k) => Array.isArray(value[k]));
501
- if (innerKey) out[`${key}.${innerKey}Count`] = value[innerKey].length;
502
- } else if (!(key in out)) out[key] = value;
503
- }
504
- return out;
505
- }
506
-
507
- function normalizeArtifactImport(data = {}) {
508
- if (!isPlainObject(data)) return cleanNested(data);
509
- return compactRecord({
510
- imported: data.imported,
511
- dryRun: data.dryRun,
512
- action: data.action,
513
- projectId: data.projectId,
514
- sourceFile: data.sourceFile,
515
- inputDir: data.inputDir,
516
- inputFile: data.inputFile,
517
- rowCount: data.rowCount,
518
- actorCount: data.actorCount,
519
- propCount: data.propCount,
520
- locationCount: data.locationCount,
521
- episodeCount: data.episodeCount,
522
- sceneCount: data.sceneCount,
523
- clipCount: data.clipCount,
524
- batchCount: Array.isArray(data.batch) ? data.batch.length : undefined,
525
- rowsByKind: data.rowsByKind,
526
- files: isPlainObject(data.files)
527
- ? compactRecord({
528
- actors: data.files.actorsFile,
529
- props: data.files.propsFile,
530
- locations: data.files.locationsFile,
531
- })
532
- : undefined,
533
- });
534
- }
535
-
536
- function normalizeArtifactWrite(data) {
537
- if (!isPlainObject(data)) return cleanNested(data);
538
- return normalizeArtifactRecord(data);
539
- }
540
-
541
- function normalizeArtifactDelete(data) {
542
- if (!isPlainObject(data)) return cleanNested(data);
543
- return compactRecord({
544
- deleted: data.deleted ?? true,
545
- action: data.action,
546
- projectId: data.projectId,
547
- key: data.key,
548
- stateKey: data.stateKey,
549
- episodeId: data.episodeId,
550
- sceneId: data.sceneId,
551
- clipId: data.clipId,
552
- videoEpisodeId: data.videoEpisodeId,
553
- rowKind: data.rowKind,
554
- entityKey: data.entityKey,
555
- });
556
- }
557
-
558
- function normalizeArtifactStatus(data) {
559
- if (!isPlainObject(data)) return cleanNested(data);
560
- return compactRecord({
561
- updated: data.updated ?? true,
562
- videoEpisodeId: data.videoEpisodeId ?? data.id,
563
- status: data.status,
564
- messageCount: Array.isArray(data.messages) ? data.messages.length : undefined,
565
- });
566
- }
567
-
568
438
  export function normalizeOutputData(commandName, data) {
569
439
  if (!isPlainObject(data)) return cleanNested(data);
570
440
  switch (commandName) {
@@ -595,7 +465,7 @@ export function normalizeOutputData(commandName, data) {
595
465
  case 'credits balance':
596
466
  return normalizeCredits(data);
597
467
  case 'project current':
598
- case 'project use':
468
+ case 'project switch':
599
469
  case 'project create':
600
470
  case 'project update':
601
471
  case 'project ensure':
@@ -645,88 +515,6 @@ export function normalizeOutputData(commandName, data) {
645
515
  default:
646
516
  break;
647
517
  }
648
- if (commandName?.startsWith('artifact ')) {
649
- return normalizeArtifactByCommand(commandName, data);
650
- }
651
- return cleanNested(data);
652
- }
653
-
654
- const ARTIFACT_LIST_COMMANDS = new Set([
655
- 'artifact script rows',
656
- 'artifact script children',
657
- 'artifact asset actors',
658
- 'artifact asset props',
659
- 'artifact asset locations',
660
- 'artifact video episodes',
661
- 'artifact video scenes',
662
- 'artifact video clips',
663
- 'artifact clip episodes',
664
- ]);
665
-
666
- const ARTIFACT_RECORD_COMMANDS = new Set([
667
- 'artifact script document',
668
- 'artifact script row',
669
- 'artifact asset actor',
670
- 'artifact asset prop',
671
- 'artifact asset location',
672
- 'artifact video episode',
673
- 'artifact video scene',
674
- 'artifact video clip',
675
- 'artifact clip episode',
676
- 'artifact clip episode-by-id',
677
- ]);
678
-
679
- const ARTIFACT_FULL_COMMANDS = new Set([
680
- 'artifact script get',
681
- 'artifact asset get',
682
- 'artifact video get',
683
- 'artifact clip get',
684
- ]);
685
-
686
- const ARTIFACT_IMPORT_COMMANDS = new Set([
687
- 'artifact script import',
688
- 'artifact asset import',
689
- 'artifact video import-storyboard',
690
- 'artifact clip upsert-batch',
691
- ]);
692
-
693
- const ARTIFACT_WRITE_COMMANDS = new Set([
694
- 'artifact script upsert-row',
695
- 'artifact asset upsert-actor',
696
- 'artifact asset upsert-prop',
697
- 'artifact asset upsert-location',
698
- 'artifact asset upsert-actor-state',
699
- 'artifact asset upsert-prop-state',
700
- 'artifact asset upsert-location-state',
701
- 'artifact video upsert-episode',
702
- 'artifact video upsert-scene',
703
- 'artifact video upsert-clip',
704
- 'artifact video update-clip-urls',
705
- 'artifact clip upsert-episode',
706
- ]);
707
-
708
- const ARTIFACT_DELETE_COMMANDS = new Set([
709
- 'artifact script delete-row',
710
- 'artifact asset delete-actor',
711
- 'artifact asset delete-prop',
712
- 'artifact asset delete-location',
713
- 'artifact asset delete-actor-state',
714
- 'artifact asset delete-prop-state',
715
- 'artifact asset delete-location-state',
716
- 'artifact video delete-episode',
717
- 'artifact video delete-scene',
718
- 'artifact video delete-clip',
719
- 'artifact clip delete-episode',
720
- ]);
721
-
722
- function normalizeArtifactByCommand(commandName, data) {
723
- if (ARTIFACT_LIST_COMMANDS.has(commandName)) return normalizeArtifactList(commandName, data);
724
- if (ARTIFACT_RECORD_COMMANDS.has(commandName)) return normalizeArtifactRecord(data);
725
- if (ARTIFACT_FULL_COMMANDS.has(commandName)) return normalizeArtifactFull(data);
726
- if (ARTIFACT_IMPORT_COMMANDS.has(commandName)) return normalizeArtifactImport(data);
727
- if (ARTIFACT_WRITE_COMMANDS.has(commandName)) return normalizeArtifactWrite(data);
728
- if (ARTIFACT_DELETE_COMMANDS.has(commandName)) return normalizeArtifactDelete(data);
729
- if (commandName === 'artifact clip update-status') return normalizeArtifactStatus(data);
730
518
  return cleanNested(data);
731
519
  }
732
520
 
@@ -1393,7 +1181,7 @@ const OUTPUT_KIND_BY_COMMAND = {
1393
1181
  'account switch-team': 'generic',
1394
1182
  'project list': 'project_list',
1395
1183
  'project current': 'project_summary',
1396
- 'project use': 'generic',
1184
+ 'project switch': 'generic',
1397
1185
  'project users': 'project_user_list',
1398
1186
  'project create': 'generic',
1399
1187
  'project update': 'generic',
@@ -1432,57 +1220,6 @@ const OUTPUT_KIND_BY_COMMAND = {
1432
1220
  'create asset-group': 'asset_group_write_result',
1433
1221
  'create asset-group-update': 'asset_group_write_result',
1434
1222
  'create asset': 'asset_register_result',
1435
- 'artifact script get': 'artifact_full',
1436
- 'artifact script document': 'artifact_record',
1437
- 'artifact script rows': 'artifact_list',
1438
- 'artifact script row': 'artifact_record',
1439
- 'artifact script children': 'artifact_list',
1440
- 'artifact script upsert-row': 'artifact_write_result',
1441
- 'artifact script delete-row': 'artifact_delete_result',
1442
- 'artifact script import': 'artifact_import_result',
1443
- 'artifact asset get': 'artifact_full',
1444
- 'artifact asset actors': 'artifact_list',
1445
- 'artifact asset actor': 'artifact_record',
1446
- 'artifact asset props': 'artifact_list',
1447
- 'artifact asset prop': 'artifact_record',
1448
- 'artifact asset locations': 'artifact_list',
1449
- 'artifact asset location': 'artifact_record',
1450
- 'artifact asset upsert-actor': 'artifact_write_result',
1451
- 'artifact asset upsert-prop': 'artifact_write_result',
1452
- 'artifact asset upsert-location': 'artifact_write_result',
1453
- 'artifact asset upsert-actor-state': 'artifact_write_result',
1454
- 'artifact asset upsert-prop-state': 'artifact_write_result',
1455
- 'artifact asset upsert-location-state': 'artifact_write_result',
1456
- 'artifact asset delete-actor': 'artifact_delete_result',
1457
- 'artifact asset delete-prop': 'artifact_delete_result',
1458
- 'artifact asset delete-location': 'artifact_delete_result',
1459
- 'artifact asset delete-actor-state': 'artifact_delete_result',
1460
- 'artifact asset delete-prop-state': 'artifact_delete_result',
1461
- 'artifact asset delete-location-state': 'artifact_delete_result',
1462
- 'artifact asset import': 'artifact_import_result',
1463
- 'artifact video get': 'artifact_full',
1464
- 'artifact video episodes': 'artifact_list',
1465
- 'artifact video episode': 'artifact_record',
1466
- 'artifact video scenes': 'artifact_list',
1467
- 'artifact video scene': 'artifact_record',
1468
- 'artifact video clips': 'artifact_list',
1469
- 'artifact video clip': 'artifact_record',
1470
- 'artifact video upsert-episode': 'artifact_write_result',
1471
- 'artifact video upsert-scene': 'artifact_write_result',
1472
- 'artifact video upsert-clip': 'artifact_write_result',
1473
- 'artifact video update-clip-urls': 'artifact_write_result',
1474
- 'artifact video delete-episode': 'artifact_delete_result',
1475
- 'artifact video delete-scene': 'artifact_delete_result',
1476
- 'artifact video delete-clip': 'artifact_delete_result',
1477
- 'artifact video import-storyboard': 'artifact_import_result',
1478
- 'artifact clip get': 'artifact_full',
1479
- 'artifact clip episodes': 'artifact_list',
1480
- 'artifact clip episode': 'artifact_record',
1481
- 'artifact clip episode-by-id': 'artifact_record',
1482
- 'artifact clip upsert-episode': 'artifact_write_result',
1483
- 'artifact clip upsert-batch': 'artifact_import_result',
1484
- 'artifact clip update-status': 'artifact_status_update',
1485
- 'artifact clip delete-episode': 'artifact_delete_result',
1486
1223
  'create subject-list': 'subject_list',
1487
1224
  'create subject': 'subject_publish_result',
1488
1225
  'create subject-wait': 'subject_status',
@@ -1495,13 +1232,6 @@ const OUTPUT_KIND_BY_COMMAND = {
1495
1232
 
1496
1233
  const KIND_TITLES = {
1497
1234
  account_summary: '账号概览',
1498
- artifact_delete_result: '最终产物删除结果',
1499
- artifact_full: '最终产物详情',
1500
- artifact_import_result: '最终产物导入结果',
1501
- artifact_list: '最终产物列表',
1502
- artifact_record: '最终产物记录',
1503
- artifact_status_update: '剪辑状态更新结果',
1504
- artifact_write_result: '最终产物写入结果',
1505
1235
  asset_group_detail: '素材组详情',
1506
1236
  asset_group_list: '素材组列表',
1507
1237
  asset_group_write_result: '素材组写入结果',
@@ -1552,7 +1282,7 @@ const COMMAND_TITLES = {
1552
1282
  'auth clear': '清空认证结果',
1553
1283
  'auth logout': '退出登录结果',
1554
1284
  'account switch-team': '团队切换结果',
1555
- 'project use': '项目组切换结果',
1285
+ 'project switch': '项目组切换结果',
1556
1286
  'project create': '项目组创建结果',
1557
1287
  'project update': '项目组更新结果',
1558
1288
  'project ensure': '项目组确保结果',
@@ -1757,12 +1487,6 @@ const FIELD_LABELS = {
1757
1487
 
1758
1488
  const DETAIL_FIELDS_BY_KIND = {
1759
1489
  account_summary: ['userId', 'userName', 'groupId', 'groupName', 'currentProjectGroupNo', 'currentProjectGroupName', 'billingPointBalance', 'projectBudgetBalance', 'projectBudgetMax'],
1760
- artifact_delete_result: ['deleted', 'action', 'projectId', 'rowKind', 'entityKey', 'key', 'stateKey', 'episodeId', 'sceneId', 'clipId', 'videoEpisodeId'],
1761
- artifact_full: ['projectId', 'id', 'title', 'status', 'rowCount', 'actorCount', 'propCount', 'locationCount', 'episodeCount', 'sceneCount', 'clipCount'],
1762
- artifact_import_result: ['imported', 'dryRun', 'action', 'projectId', 'sourceFile', 'inputDir', 'inputFile', 'rowCount', 'actorCount', 'propCount', 'locationCount', 'episodeCount', 'sceneCount', 'clipCount', 'batchCount'],
1763
- artifact_record: ['id', 'projectId', 'rowKind', 'entityKey', 'parentKey', 'actorKey', 'propKey', 'locationKey', 'stateKey', 'episodeId', 'sceneId', 'clipId', 'videoEpisodeId', 'status', 'title', 'name', 'displayName', 'description'],
1764
- artifact_status_update: ['updated', 'videoEpisodeId', 'status', 'messageCount'],
1765
- artifact_write_result: ['id', 'projectId', 'rowKind', 'entityKey', 'parentKey', 'actorKey', 'propKey', 'locationKey', 'stateKey', 'episodeId', 'sceneId', 'clipId', 'videoEpisodeId', 'status', 'title', 'name', 'displayName'],
1766
1490
  asset_group_detail: ['groupId', 'platform', 'name', 'projectName', 'description', 'status', 'assetCount'],
1767
1491
  asset_group_write_result: ['created', 'updated', 'groupId', 'platform', 'name', 'projectName', 'assetPath'],
1768
1492
  asset_register_result: ['created', 'updated', 'registered', 'assetId', 'groupId', 'platform', 'assetType', 'name', 'projectName', 'assetPath', 'validationLegal', 'conversionRequired', 'converted', 'conversionReason', 'conversionTargetFormat', 'conversionTargetWidth', 'conversionTargetHeight', 'conversionTargetPixels', 'conversionTargetFps', 'conversionTargetDuration', 'uploadBackendPath', 'uploadUrl'],
@@ -1796,7 +1520,7 @@ const DRY_RUN_FIELDS_BY_COMMAND = {
1796
1520
  'auth login': ['dryRun', 'saved', 'verified', 'accessKey'],
1797
1521
  'auth clear': ['dryRun', 'action', 'cleared'],
1798
1522
  'account switch-team': ['dryRun', 'action', 'groupId', 'selected'],
1799
- 'project use': ['dryRun', 'action', 'projectGroupNo', 'selected'],
1523
+ 'project switch': ['dryRun', 'action', 'projectGroupNo', 'selected'],
1800
1524
  'project create': ['dryRun', 'action', 'projectGroupName', 'point', 'memberCount', 'note'],
1801
1525
  'project update': ['dryRun', 'action', 'projectGroupNo', 'projectGroupName', 'point', 'memberCount'],
1802
1526
  'project ensure': ['dryRun', 'action', 'projectGroupName', 'point', 'memberCount', 'note'],
@@ -1815,15 +1539,9 @@ const DRY_RUN_FIELDS_BY_COMMAND = {
1815
1539
  'create subject': ['dryRun', 'action', 'name', 'modelCode', 'elementFrontalImage', 'assetCount', 'localFileCount', 'nextRefSubject'],
1816
1540
  'create subject-voice': ['dryRun', 'action', 'name', 'voiceName', 'voiceUrl', 'remoteUrl', 'remoteUpload', 'localFileCount', 'nextVoiceArg'],
1817
1541
  'create subject-batch': ['dryRun', 'count', 'modelCode'],
1818
- 'artifact script import': ['dryRun', 'action', 'projectId', 'sourceFile', 'inputFile', 'rowCount', 'actorCount', 'episodeCount', 'sceneCount', 'clipCount'],
1819
- 'artifact asset import': ['dryRun', 'action', 'projectId', 'inputDir', 'actorCount', 'propCount', 'locationCount'],
1820
- 'artifact video import-storyboard': ['dryRun', 'action', 'projectId', 'inputFile', 'episodeId', 'sceneCount', 'clipCount'],
1821
- 'artifact clip upsert-batch': ['dryRun', 'action', 'projectId', 'episodeCount'],
1822
- 'artifact clip update-status': ['dryRun', 'action', 'projectId', 'videoEpisodeId', 'status', 'messageCount'],
1823
1542
  };
1824
1543
 
1825
1544
  const LIST_KEY_BY_KIND = {
1826
- artifact_list: 'items',
1827
1545
  asset_group_list: 'groups',
1828
1546
  asset_match_list: 'matches',
1829
1547
  asset_review_model_list: 'models',
@@ -746,13 +746,13 @@ export async function selectProjectGroupCommand(kwargs = {}) {
746
746
  if (toBool(kwargs.dryRun)) {
747
747
  return {
748
748
  dryRun: true,
749
- action: 'project use',
749
+ action: 'project switch',
750
750
  selected: false,
751
751
  request: { projectGroupNo },
752
752
  };
753
753
  }
754
754
  ensureConfirmed(kwargs, '切换项目组会改变后续生成任务归属,需要确认', {
755
- action: 'project use',
755
+ action: 'project switch',
756
756
  projectGroupNo,
757
757
  });
758
758
  await awbApi.selectProjectGroup(projectGroupNo);