openxiangda-cli 2.0.0-alpha.57 → 2.0.0-alpha.59

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.
Files changed (39) hide show
  1. package/dist/commands/create.d.ts.map +1 -1
  2. package/dist/commands/create.js +13 -5
  3. package/dist/commands/create.js.map +1 -1
  4. package/dist/create-workspace.d.ts +6 -1
  5. package/dist/create-workspace.d.ts.map +1 -1
  6. package/dist/create-workspace.js +12 -9
  7. package/dist/create-workspace.js.map +1 -1
  8. package/package.json +4 -4
  9. package/template/README.md +3 -1
  10. package/template/apps/server/package.json +1 -1
  11. package/template/apps/web/e2e/instruments.spec.ts +1197 -9
  12. package/template/apps/web/package.json +4 -2
  13. package/template/apps/web/scripts/check.mjs +2 -2
  14. package/template/apps/web/scripts/verify-build.mjs +14 -2
  15. package/template/apps/web/src/AuthoritativeSelector.tsx +371 -0
  16. package/template/apps/web/src/CollegePage.tsx +181 -0
  17. package/template/apps/web/src/FilePreviewPage.tsx +303 -0
  18. package/template/apps/web/src/InstrumentDetailPage.tsx +94 -20
  19. package/template/apps/web/src/InstrumentForm.tsx +347 -94
  20. package/template/apps/web/src/InstrumentFormPage.tsx +49 -9
  21. package/template/apps/web/src/InstrumentListPage.tsx +30 -35
  22. package/template/apps/web/src/Shell.tsx +229 -41
  23. package/template/apps/web/src/components/platform-fields/AttachmentFileList.tsx +226 -0
  24. package/template/apps/web/src/components/platform-fields/PlatformDirectoryPicker.tsx +698 -0
  25. package/template/apps/web/src/data-provider.ts +1 -1
  26. package/template/apps/web/src/fields.ts +17 -6
  27. package/template/apps/web/src/instrument.ts +1 -1
  28. package/template/apps/web/src/main.tsx +21 -1
  29. package/template/apps/web/src/platform-client.ts +248 -2
  30. package/template/apps/web/src/runtime-meta.ts +15 -0
  31. package/template/apps/web/src/runtime.tsx +4 -2
  32. package/template/apps/web/src/styles.css +1007 -28
  33. package/template/apps/web/test/contracts.test.ts +473 -10
  34. package/template/openxiangda.config.ts +24 -5
  35. package/template/package.json +3 -3
  36. package/template/packages/contracts/src/generated.ts +22 -0
  37. package/template/platform/data/colleges.ts +21 -0
  38. package/template/platform/data/instruments.ts +1 -1
  39. package/template/scripts/verify-template-budget.mjs +2 -2
@@ -0,0 +1,21 @@
1
+ import { SCHEMA_VERSIONS, type DataResource } from 'openxiangda-contracts';
2
+
3
+ export const colleges: DataResource = {
4
+ schemaVersion: SCHEMA_VERSIONS.dataResource,
5
+ appCode: 'instrument-center',
6
+ code: 'colleges',
7
+ name: '学院',
8
+ schema: {
9
+ fields: [
10
+ { code: 'name', type: 'string', nullable: false, indexed: true },
11
+ { code: 'enabled', type: 'boolean', nullable: false, indexed: true },
12
+ ],
13
+ },
14
+ capabilities: {
15
+ read: 'app:instrument-center:data:colleges:read',
16
+ create: 'app:instrument-center:data:colleges:create',
17
+ update: 'app:instrument-center:data:colleges:update',
18
+ delete: 'app:instrument-center:data:colleges:delete',
19
+ },
20
+ fieldPolicies: {},
21
+ };
@@ -49,7 +49,7 @@ export const instruments: DataResource = {
49
49
  { code: 'openToOutside', type: 'boolean', nullable: false },
50
50
  { code: 'subjectAreas', type: 'json' },
51
51
  { code: 'platformProperty', type: 'string' },
52
- { code: 'collegeId', type: 'string', nullable: false, indexed: true },
52
+ { code: 'collegeId', type: 'uuid', nullable: false, indexed: true },
53
53
  { code: 'manageDepartmentId', type: 'string', nullable: false },
54
54
  { code: 'useDepartmentId', type: 'string', nullable: false },
55
55
  { code: 'instrumentAdminIds', type: 'json', nullable: false, indexed: true },
@@ -16,7 +16,7 @@ function visit(directory) {
16
16
  }
17
17
  visit(root);
18
18
  const bytes = files.reduce((total, file) => total + statSync(file).size, 0);
19
- if (files.length > 50) throw new Error(`TEMPLATE_SOURCE_FILE_BUDGET_EXCEEDED:${files.length}>50`);
19
+ if (files.length > 52) throw new Error(`TEMPLATE_SOURCE_FILE_BUDGET_EXCEEDED:${files.length}>52`);
20
20
  if (bytes > 500_000) throw new Error(`TEMPLATE_SOURCE_BYTE_BUDGET_EXCEEDED:${bytes}>500000`);
21
21
  const productionFiles = files.filter(file => {
22
22
  const name = relative(root, file).replaceAll('\\', '/');
@@ -31,7 +31,7 @@ const productionFiles = files.filter(file => {
31
31
  );
32
32
  });
33
33
  const source = productionFiles.map(file => readFileSync(file, 'utf8')).join('\n');
34
- for (const marker of ['@umijs/', 'openxiangda-' + 'admin', 'openxiangda-' + 'user', 'instrument_query', 'instrument_save', 'function.invoke', 'departmentScopeKey', 'instrumentScopeKey', 'adminUserIds']) {
34
+ for (const marker of ['@umijs/', 'openxiangda-' + 'admin', 'openxiangda-' + 'user', 'instrument_query', 'instrument_save', 'function.invoke', 'departmentScopeKey', 'instrumentScopeKey', 'adminUserIds', 'college-' + 'am', 'user-' + 'wang', 'dept-' + 'am-test']) {
35
35
  if (source.includes(marker)) throw new Error(`TEMPLATE_FORBIDDEN_MARKER:${marker}`);
36
36
  }
37
37
  process.stdout.write(`Verified compact template: ${files.length} source files, ${bytes} bytes.\n`);