openxiangda 1.0.264 → 2.0.0-alpha.2
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 +11 -666
- package/bin/run.js +11 -0
- package/dist/browser/AuthoritativeSelector.d.ts +37 -0
- package/dist/browser/AuthoritativeSelector.d.ts.map +1 -0
- package/dist/browser/AuthoritativeSelector.js +357 -0
- package/dist/browser/AuthoritativeSelector.js.map +1 -0
- package/dist/browser/FilePreviewPage.d.ts +2 -0
- package/dist/browser/FilePreviewPage.d.ts.map +1 -0
- package/dist/browser/FilePreviewPage.js +191 -0
- package/dist/browser/FilePreviewPage.js.map +1 -0
- package/dist/browser/Shell.d.ts +6 -0
- package/dist/browser/Shell.d.ts.map +1 -0
- package/dist/browser/Shell.js +198 -0
- package/dist/browser/Shell.js.map +1 -0
- package/dist/browser/appearance.d.ts +12 -0
- package/dist/browser/appearance.d.ts.map +1 -0
- package/dist/browser/appearance.js +100 -0
- package/dist/browser/appearance.js.map +1 -0
- package/dist/browser/application.d.ts +8 -0
- package/dist/browser/application.d.ts.map +1 -0
- package/dist/browser/application.js +42 -0
- package/dist/browser/application.js.map +1 -0
- package/dist/browser/components/platform-fields/AddressField.d.ts +12 -0
- package/dist/browser/components/platform-fields/AddressField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/AddressField.js +179 -0
- package/dist/browser/components/platform-fields/AddressField.js.map +1 -0
- package/dist/browser/components/platform-fields/AttachmentFileList.d.ts +9 -0
- package/dist/browser/components/platform-fields/AttachmentFileList.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/AttachmentFileList.js +164 -0
- package/dist/browser/components/platform-fields/AttachmentFileList.js.map +1 -0
- package/dist/browser/components/platform-fields/CascadeField.d.ts +13 -0
- package/dist/browser/components/platform-fields/CascadeField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/CascadeField.js +14 -0
- package/dist/browser/components/platform-fields/CascadeField.js.map +1 -0
- package/dist/browser/components/platform-fields/DateTimeField.d.ts +16 -0
- package/dist/browser/components/platform-fields/DateTimeField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/DateTimeField.js +51 -0
- package/dist/browser/components/platform-fields/DateTimeField.js.map +1 -0
- package/dist/browser/components/platform-fields/JsonField.d.ts +11 -0
- package/dist/browser/components/platform-fields/JsonField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/JsonField.js +40 -0
- package/dist/browser/components/platform-fields/JsonField.js.map +1 -0
- package/dist/browser/components/platform-fields/LocationField.d.ts +11 -0
- package/dist/browser/components/platform-fields/LocationField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/LocationField.js +73 -0
- package/dist/browser/components/platform-fields/LocationField.js.map +1 -0
- package/dist/browser/components/platform-fields/PlatformDirectoryPicker.d.ts +12 -0
- package/dist/browser/components/platform-fields/PlatformDirectoryPicker.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/PlatformDirectoryPicker.js +269 -0
- package/dist/browser/components/platform-fields/PlatformDirectoryPicker.js.map +1 -0
- package/dist/browser/components/platform-fields/ResourceReferenceField.d.ts +12 -0
- package/dist/browser/components/platform-fields/ResourceReferenceField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/ResourceReferenceField.js +22 -0
- package/dist/browser/components/platform-fields/ResourceReferenceField.js.map +1 -0
- package/dist/browser/components/platform-fields/RichTextField.d.ts +14 -0
- package/dist/browser/components/platform-fields/RichTextField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/RichTextField.js +214 -0
- package/dist/browser/components/platform-fields/RichTextField.js.map +1 -0
- package/dist/browser/components/platform-fields/SignatureField.d.ts +15 -0
- package/dist/browser/components/platform-fields/SignatureField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/SignatureField.js +179 -0
- package/dist/browser/components/platform-fields/SignatureField.js.map +1 -0
- package/dist/browser/components/platform-fields/SubtableField.d.ts +18 -0
- package/dist/browser/components/platform-fields/SubtableField.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/SubtableField.js +236 -0
- package/dist/browser/components/platform-fields/SubtableField.js.map +1 -0
- package/dist/browser/components/platform-fields/address-value.d.ts +13 -0
- package/dist/browser/components/platform-fields/address-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/address-value.js +70 -0
- package/dist/browser/components/platform-fields/address-value.js.map +1 -0
- package/dist/browser/components/platform-fields/cascade-value.d.ts +6 -0
- package/dist/browser/components/platform-fields/cascade-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/cascade-value.js +47 -0
- package/dist/browser/components/platform-fields/cascade-value.js.map +1 -0
- package/dist/browser/components/platform-fields/directory-value.d.ts +7 -0
- package/dist/browser/components/platform-fields/directory-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/directory-value.js +35 -0
- package/dist/browser/components/platform-fields/directory-value.js.map +1 -0
- package/dist/browser/components/platform-fields/field-form-codec.d.ts +10 -0
- package/dist/browser/components/platform-fields/field-form-codec.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/field-form-codec.js +82 -0
- package/dist/browser/components/platform-fields/field-form-codec.js.map +1 -0
- package/dist/browser/components/platform-fields/location-value.d.ts +20 -0
- package/dist/browser/components/platform-fields/location-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/location-value.js +57 -0
- package/dist/browser/components/platform-fields/location-value.js.map +1 -0
- package/dist/browser/components/platform-fields/resource-query.d.ts +14 -0
- package/dist/browser/components/platform-fields/resource-query.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/resource-query.js +102 -0
- package/dist/browser/components/platform-fields/resource-query.js.map +1 -0
- package/dist/browser/components/platform-fields/rich-text-value.d.ts +12 -0
- package/dist/browser/components/platform-fields/rich-text-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/rich-text-value.js +83 -0
- package/dist/browser/components/platform-fields/rich-text-value.js.map +1 -0
- package/dist/browser/components/platform-fields/subtable-value.d.ts +31 -0
- package/dist/browser/components/platform-fields/subtable-value.d.ts.map +1 -0
- package/dist/browser/components/platform-fields/subtable-value.js +120 -0
- package/dist/browser/components/platform-fields/subtable-value.js.map +1 -0
- package/dist/browser/components/resource/GeneratedResourceCrud.d.ts +8 -0
- package/dist/browser/components/resource/GeneratedResourceCrud.d.ts.map +1 -0
- package/dist/browser/components/resource/GeneratedResourceCrud.js +580 -0
- package/dist/browser/components/resource/GeneratedResourceCrud.js.map +1 -0
- package/dist/browser/components/resource/ResourceBatchActions.d.ts +25 -0
- package/dist/browser/components/resource/ResourceBatchActions.d.ts.map +1 -0
- package/dist/browser/components/resource/ResourceBatchActions.js +168 -0
- package/dist/browser/components/resource/ResourceBatchActions.js.map +1 -0
- package/dist/browser/components/resource/StandardResourcePages.d.ts +57 -0
- package/dist/browser/components/resource/StandardResourcePages.d.ts.map +1 -0
- package/dist/browser/components/resource/StandardResourcePages.js +89 -0
- package/dist/browser/components/resource/StandardResourcePages.js.map +1 -0
- package/dist/browser/components/resource/SurfaceFields.d.ts +88 -0
- package/dist/browser/components/resource/SurfaceFields.d.ts.map +1 -0
- package/dist/browser/components/resource/SurfaceFields.js +497 -0
- package/dist/browser/components/resource/SurfaceFields.js.map +1 -0
- package/dist/browser/components/resource/generated-resource-definition.d.ts +19 -0
- package/dist/browser/components/resource/generated-resource-definition.d.ts.map +1 -0
- package/dist/browser/components/resource/generated-resource-definition.js +2 -0
- package/dist/browser/components/resource/generated-resource-definition.js.map +1 -0
- package/dist/browser/components/resource/resource-import.d.ts +15 -0
- package/dist/browser/components/resource/resource-import.d.ts.map +1 -0
- package/dist/browser/components/resource/resource-import.js +197 -0
- package/dist/browser/components/resource/resource-import.js.map +1 -0
- package/dist/browser/data-provider.d.ts +4 -0
- package/dist/browser/data-provider.d.ts.map +1 -0
- package/dist/browser/data-provider.js +45 -0
- package/dist/browser/data-provider.js.map +1 -0
- package/dist/browser/platform-client.d.ts +81 -0
- package/dist/browser/platform-client.d.ts.map +1 -0
- package/dist/browser/platform-client.js +422 -0
- package/dist/browser/platform-client.js.map +1 -0
- package/dist/browser/resource-definitions.d.ts +8 -0
- package/dist/browser/resource-definitions.d.ts.map +1 -0
- package/dist/browser/resource-definitions.js +14 -0
- package/dist/browser/resource-definitions.js.map +1 -0
- package/dist/browser/runtime-meta.d.ts +22 -0
- package/dist/browser/runtime-meta.d.ts.map +1 -0
- package/dist/browser/runtime-meta.js +79 -0
- package/dist/browser/runtime-meta.js.map +1 -0
- package/dist/browser/runtime.d.ts +13 -0
- package/dist/browser/runtime.d.ts.map +1 -0
- package/dist/browser/runtime.js +47 -0
- package/dist/browser/runtime.js.map +1 -0
- package/dist/browser/styles.css +1941 -0
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -0
- package/dist/core.d.ts +6 -0
- package/dist/core.d.ts.map +1 -0
- package/dist/core.js +4 -0
- package/dist/core.js.map +1 -0
- package/dist/field-kit.d.ts +22 -0
- package/dist/field-kit.d.ts.map +1 -0
- package/dist/field-kit.js +22 -0
- package/dist/field-kit.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/nest.d.ts +10 -0
- package/dist/nest.d.ts.map +1 -0
- package/dist/nest.js +9 -0
- package/dist/nest.js.map +1 -0
- package/dist/react.d.ts +12 -0
- package/dist/react.d.ts.map +1 -0
- package/dist/react.js +11 -0
- package/dist/react.js.map +1 -0
- package/dist/testing.d.ts +4 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +4 -0
- package/dist/testing.js.map +1 -0
- package/package.json +95 -200
- package/skills/manifest.json +10 -0
- package/skills/openxiangda-v2/SKILL.md +55 -0
- package/skills/openxiangda-v2/references/architecture.md +7 -0
- package/skills/openxiangda-v2/references/backend.md +116 -0
- package/skills/openxiangda-v2/references/data-authz.md +93 -0
- package/skills/openxiangda-v2/references/delivery.md +11 -0
- package/skills/openxiangda-v2/references/discovery.md +15 -0
- package/skills/openxiangda-v2/references/frontend.md +10 -0
- package/skills/openxiangda-v2/references/testing.md +16 -0
- package/skills/openxiangda-v2/references/workflow-notification.md +69 -0
- package/skills/openxiangda-v2/references/workspace.md +21 -0
- package/bin/openxiangda.js +0 -26
- package/lib/app-function-invoke.js +0 -28
- package/lib/application-environments.js +0 -1134
- package/lib/change-baseline.js +0 -1359
- package/lib/cli.js +0 -31084
- package/lib/config.js +0 -450
- package/lib/content-cache.js +0 -97
- package/lib/delivery-v2-cli.js +0 -329
- package/lib/delivery-v2-executor.js +0 -1703
- package/lib/delivery-v2-package.js +0 -1176
- package/lib/dependency-capsule.js +0 -246
- package/lib/design-gates.js +0 -668
- package/lib/design-review.js +0 -220
- package/lib/developer-center.js +0 -160
- package/lib/form-field-contract.js +0 -79
- package/lib/form-schema-loader.js +0 -181
- package/lib/git-remote-identity.js +0 -89
- package/lib/http.js +0 -196
- package/lib/integration-bundle.js +0 -225
- package/lib/js-code-build.js +0 -175
- package/lib/open-api.js +0 -256
- package/lib/policy.js +0 -137
- package/lib/publish-context.js +0 -98
- package/lib/publish-lease-heartbeat.js +0 -182
- package/lib/publish-lease.js +0 -221
- package/lib/release-error-classification.js +0 -41
- package/lib/release-explain.js +0 -75
- package/lib/release-mainline.js +0 -654
- package/lib/release-plan.js +0 -550
- package/lib/release-telemetry.js +0 -182
- package/lib/resource-binding-contract.js +0 -210
- package/lib/role-resolution.js +0 -57
- package/lib/runtime-lineage.js +0 -326
- package/lib/sdd.js +0 -3306
- package/lib/skills.js +0 -453
- package/lib/source-dependencies.js +0 -921
- package/lib/task-status.js +0 -330
- package/lib/utils.js +0 -178
- package/lib/workspace-bootstrap.js +0 -268
- package/lib/workspace-init.js +0 -202
- package/lib/worktree-cleanup.js +0 -631
- package/lib/worktree-owner.js +0 -354
- package/openxiangda-skills/SKILL.md +0 -226
- package/openxiangda-skills/references/architecture-design.md +0 -409
- package/openxiangda-skills/references/architecture-patterns.md +0 -264
- package/openxiangda-skills/references/automation-v3.md +0 -349
- package/openxiangda-skills/references/best-practices.md +0 -272
- package/openxiangda-skills/references/component-guide.md +0 -287
- package/openxiangda-skills/references/connector-resources.md +0 -80
- package/openxiangda-skills/references/data-views.md +0 -360
- package/openxiangda-skills/references/forms/component-registry.md +0 -90
- package/openxiangda-skills/references/forms/form-schema.md +0 -146
- package/openxiangda-skills/references/forms/layout-and-rules.md +0 -24
- package/openxiangda-skills/references/notifications.md +0 -227
- package/openxiangda-skills/references/openxiangda-api.md +0 -971
- package/openxiangda-skills/references/pages/app-shell.md +0 -66
- package/openxiangda-skills/references/pages/page-sdk.md +0 -401
- package/openxiangda-skills/references/pages/publish-flow.md +0 -84
- package/openxiangda-skills/references/pages/workspace-structure.md +0 -41
- package/openxiangda-skills/references/permission-design-patterns.md +0 -313
- package/openxiangda-skills/references/permissions-settings.md +0 -468
- package/openxiangda-skills/references/platform-data-model.md +0 -340
- package/openxiangda-skills/references/resource-manifest-cheatsheet.md +0 -936
- package/openxiangda-skills/references/school-contact-relations.md +0 -224
- package/openxiangda-skills/references/style-system.md +0 -218
- package/openxiangda-skills/references/troubleshooting.md +0 -271
- package/openxiangda-skills/references/workflow-v3.md +0 -441
- package/openxiangda-skills/references/workspace-state.md +0 -115
- package/openxiangda-skills/skills/openxiangda-app/SKILL.md +0 -118
- package/openxiangda-skills/skills/openxiangda-architecture-design/SKILL.md +0 -137
- package/openxiangda-skills/skills/openxiangda-core/SKILL.md +0 -222
- package/openxiangda-skills/skills/openxiangda-form/SKILL.md +0 -184
- package/openxiangda-skills/skills/openxiangda-inspect/SKILL.md +0 -63
- package/openxiangda-skills/skills/openxiangda-open-api/SKILL.md +0 -57
- package/openxiangda-skills/skills/openxiangda-open-api/agents/openai.yaml +0 -4
- package/openxiangda-skills/skills/openxiangda-open-api/references/backend-authentication.md +0 -63
- package/openxiangda-skills/skills/openxiangda-open-api/references/dingtalk-api.openapi.json +0 -15653
- package/openxiangda-skills/skills/openxiangda-page/SKILL.md +0 -154
- package/openxiangda-skills/skills/openxiangda-permission-settings/SKILL.md +0 -209
- package/openxiangda-skills/skills/openxiangda-workflow-automation/SKILL.md +0 -201
- package/packages/sdk/bin/lowcode-workspace.mjs +0 -4
- package/packages/sdk/dist/ProcessPreview-DSUIJi5V.d.mts +0 -1292
- package/packages/sdk/dist/ProcessPreview-DSUIJi5V.d.ts +0 -1292
- package/packages/sdk/dist/build/index.cjs +0 -1
- package/packages/sdk/dist/build/index.d.mts +0 -60
- package/packages/sdk/dist/build/index.d.ts +0 -60
- package/packages/sdk/dist/build/index.mjs +0 -1
- package/packages/sdk/dist/components/index.cjs +0 -148
- package/packages/sdk/dist/components/index.d.mts +0 -970
- package/packages/sdk/dist/components/index.d.ts +0 -970
- package/packages/sdk/dist/components/index.mjs +0 -148
- package/packages/sdk/dist/dataManagementApi-Ro9itwm8.d.ts +0 -142
- package/packages/sdk/dist/dataManagementApi-p_HOhQnA.d.mts +0 -142
- package/packages/sdk/dist/runtime/index.cjs +0 -148
- package/packages/sdk/dist/runtime/index.d.mts +0 -171
- package/packages/sdk/dist/runtime/index.d.ts +0 -171
- package/packages/sdk/dist/runtime/index.mjs +0 -148
- package/packages/sdk/dist/runtime/react.cjs +0 -148
- package/packages/sdk/dist/runtime/react.d.mts +0 -3202
- package/packages/sdk/dist/runtime/react.d.ts +0 -3202
- package/packages/sdk/dist/runtime/react.mjs +0 -148
- package/packages/sdk/dist/styles/antd-theme.cjs +0 -1
- package/packages/sdk/dist/styles/antd-theme.d.mts +0 -6
- package/packages/sdk/dist/styles/antd-theme.d.ts +0 -6
- package/packages/sdk/dist/styles/antd-theme.mjs +0 -1
- package/packages/sdk/dist/styles/tailwind-preset.cjs +0 -1
- package/packages/sdk/dist/styles/tailwind-preset.d.mts +0 -74
- package/packages/sdk/dist/styles/tailwind-preset.d.ts +0 -74
- package/packages/sdk/dist/styles/tailwind-preset.mjs +0 -1
- package/packages/sdk/dist/styles/tokens.css +0 -74
- package/packages/sdk/dist/workflow/index.cjs +0 -3
- package/packages/sdk/dist/workflow/index.d.mts +0 -291
- package/packages/sdk/dist/workflow/index.d.ts +0 -291
- package/packages/sdk/dist/workflow/index.mjs +0 -3
- package/packages/sdk/source/admin-list/AdminList.tsx +0 -1734
- package/packages/sdk/source/admin-list/README.md +0 -12
- package/packages/sdk/source/admin-list/dataSources.ts +0 -345
- package/packages/sdk/source/admin-list/index.ts +0 -42
- package/packages/sdk/source/admin-list/preferences.ts +0 -174
- package/packages/sdk/source/admin-list/types.ts +0 -273
- package/packages/sdk/src/build-source/README.md +0 -9
- package/packages/sdk/src/build-source/bin/lowcode-workspace.mjs +0 -7
- package/packages/sdk/src/build-source/package.json +0 -34
- package/packages/sdk/src/build-source/scripts/build-forms.mjs +0 -1129
- package/packages/sdk/src/build-source/scripts/build-pages.mjs +0 -897
- package/packages/sdk/src/build-source/scripts/build-workspace.mjs +0 -89
- package/packages/sdk/src/build-source/scripts/publish-all.mjs +0 -190
- package/packages/sdk/src/build-source/scripts/publish-oss.mjs +0 -144
- package/packages/sdk/src/build-source/scripts/register-bundle.mjs +0 -1
- package/packages/sdk/src/build-source/scripts/register.mjs +0 -362
- package/packages/sdk/src/build-source/scripts/sync-schema.mjs +0 -381
- package/packages/sdk/src/build-source/scripts/utils/form-api.mjs +0 -1058
- package/packages/sdk/src/build-source/scripts/utils/form-runtime-assets.mjs +0 -57
- package/packages/sdk/src/build-source/scripts/utils/incremental.mjs +0 -348
- package/packages/sdk/src/build-source/scripts/utils/load-config.mjs +0 -331
- package/packages/sdk/src/build-source/scripts/utils/mime-types.mjs +0 -70
- package/packages/sdk/src/build-source/scripts/utils/namespace-css.mjs +0 -77
- package/packages/sdk/src/build-source/scripts/utils/oss-client.mjs +0 -128
- package/packages/sdk/src/build-source/scripts/utils/pages.mjs +0 -150
- package/packages/sdk/src/build-source/scripts/utils/progress.mjs +0 -57
- package/packages/sdk/src/build-source/scripts/utils/publish-oss-patterns.mjs +0 -20
- package/packages/sdk/src/build-source/scripts/utils/register-payload.mjs +0 -90
- package/packages/sdk/src/build-source/scripts/utils/runtime-css-check.mjs +0 -44
- package/packages/sdk/src/build-source/scripts/utils/schema-transform.mjs +0 -142
- package/packages/sdk/src/build-source/scripts/utils/static-assets.mjs +0 -165
- package/packages/sdk/src/build-source/scripts/utils/tailwind-config.mjs +0 -283
- package/packages/sdk/src/build-source/scripts/utils/tailwind-token-warnings.mjs +0 -146
- package/packages/sdk/src/build-source/scripts/utils/workspace-style-entry.mjs +0 -29
- package/packages/sdk/src/build-source/src/cli.mjs +0 -735
- package/policy/openxiangda-policy.json +0 -72
- package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-form.mdc +0 -24
- package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-page.mdc +0 -25
- package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-resources.mdc +0 -32
- package/templates/openxiangda-react-spa/.cursor/rules/openxiangda-workflow-automation.mdc +0 -26
- package/templates/openxiangda-react-spa/.cursor/rules/openxiangda.mdc +0 -68
- package/templates/openxiangda-react-spa/.env.example +0 -4
- package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-form.md +0 -37
- package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-page.md +0 -29
- package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-resources.md +0 -32
- package/templates/openxiangda-react-spa/.qoder/rules/openxiangda-workflow-automation.md +0 -34
- package/templates/openxiangda-react-spa/.qoder/rules/openxiangda.md +0 -66
- package/templates/openxiangda-react-spa/AGENTS.md +0 -192
- package/templates/openxiangda-react-spa/DELIVERY.md +0 -43
- package/templates/openxiangda-react-spa/app-workspace.config.ts +0 -50
- package/templates/openxiangda-react-spa/index.html +0 -12
- package/templates/openxiangda-react-spa/package.json +0 -53
- package/templates/openxiangda-react-spa/postcss.config.cjs +0 -6
- package/templates/openxiangda-react-spa/scripts/build-js-code.mjs +0 -600
- package/templates/openxiangda-react-spa/scripts/deploy.mjs +0 -18
- package/templates/openxiangda-react-spa/scripts/guard-publish.mjs +0 -21
- package/templates/openxiangda-react-spa/src/app/navigation.ts +0 -73
- package/templates/openxiangda-react-spa/src/app/router.tsx +0 -146
- package/templates/openxiangda-react-spa/src/app/starter-content.ts +0 -144
- package/templates/openxiangda-react-spa/src/forms/.gitkeep +0 -1
- package/templates/openxiangda-react-spa/src/layouts/AdminShell.tsx +0 -570
- package/templates/openxiangda-react-spa/src/main.tsx +0 -21
- package/templates/openxiangda-react-spa/src/pages/admin/AdminDashboardPage.tsx +0 -170
- package/templates/openxiangda-react-spa/src/pages/admin/LoginLogPage.tsx +0 -425
- package/templates/openxiangda-react-spa/src/pages/defaults/DataRoutePage.tsx +0 -36
- package/templates/openxiangda-react-spa/src/pages/defaults/FilePreviewRoutePage.tsx +0 -65
- package/templates/openxiangda-react-spa/src/pages/defaults/FormRoutePage.tsx +0 -235
- package/templates/openxiangda-react-spa/src/pages/public/PublicRegisterPage.tsx +0 -15
- package/templates/openxiangda-react-spa/src/pages/states/NotFoundPage.tsx +0 -31
- package/templates/openxiangda-react-spa/src/resources/menus/menus.json +0 -22
- package/templates/openxiangda-react-spa/src/resources/permissions/page-groups/app-admin.json +0 -8
- package/templates/openxiangda-react-spa/src/resources/permissions/page-groups/public-visitor.json +0 -8
- package/templates/openxiangda-react-spa/src/resources/public-access/public-register.json +0 -14
- package/templates/openxiangda-react-spa/src/resources/roles/roles.json +0 -15
- package/templates/openxiangda-react-spa/src/resources/routes/public-register.json +0 -8
- package/templates/openxiangda-react-spa/src/runtime/default-page-overrides.tsx +0 -35
- package/templates/openxiangda-react-spa/src/runtime/default-routes.ts +0 -16
- package/templates/openxiangda-react-spa/src/shared/form-schema.ts +0 -135
- package/templates/openxiangda-react-spa/src/shared/mac-admin.tsx +0 -651
- package/templates/openxiangda-react-spa/src/shared/ui.tsx +0 -22
- package/templates/openxiangda-react-spa/src/styles/index.css +0 -105
- package/templates/openxiangda-react-spa/tailwind.config.cjs +0 -37
- package/templates/openxiangda-react-spa/tsconfig.app.json +0 -36
- package/templates/openxiangda-react-spa/tsconfig.js-code-nodes.json +0 -19
- package/templates/openxiangda-react-spa/tsconfig.json +0 -7
- package/templates/openxiangda-react-spa/tsconfig.node.json +0 -10
- package/templates/openxiangda-react-spa/vite.config.ts +0 -209
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-form.mdc +0 -24
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-page.mdc +0 -21
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-resources.mdc +0 -40
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda-workflow-automation.mdc +0 -21
- package/templates/sy-lowcode-app-workspace/.cursor/rules/openxiangda.mdc +0 -81
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-form.md +0 -38
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-page.md +0 -39
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-resources.md +0 -59
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda-workflow-automation.md +0 -46
- package/templates/sy-lowcode-app-workspace/.qoder/rules/openxiangda.md +0 -82
- package/templates/sy-lowcode-app-workspace/AGENTS.md +0 -158
- package/templates/sy-lowcode-app-workspace/DELIVERY.md +0 -43
- package/templates/sy-lowcode-app-workspace/app-workspace.config.ts +0 -51
- package/templates/sy-lowcode-app-workspace/examples/best-practices/README.md +0 -43
- package/templates/sy-lowcode-app-workspace/examples/best-practices/access-governance.md +0 -239
- package/templates/sy-lowcode-app-workspace/examples/best-practices/catalog.json +0 -99
- package/templates/sy-lowcode-app-workspace/examples/best-practices/decision-guide.md +0 -94
- package/templates/sy-lowcode-app-workspace/examples/best-practices/design-style.md +0 -91
- package/templates/sy-lowcode-app-workspace/examples/best-practices/module-structure.md +0 -48
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/index.ts +0 -2
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/permissions.test.ts +0 -52
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/permissions.ts +0 -37
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/role-governance/types.ts +0 -19
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/index.ts +0 -4
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/permissions.test.ts +0 -42
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/permissions.ts +0 -25
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/state-machine.test.ts +0 -63
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/state-machine.ts +0 -73
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/ticket-query.test.ts +0 -34
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/ticket-query.ts +0 -73
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/domain/service-ticket/types.ts +0 -66
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/app-role/page.tsx +0 -1
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/app-role/schema.ts +0 -109
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/customer-profile/page.tsx +0 -1
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/customer-profile/schema.ts +0 -92
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/service-ticket/page.tsx +0 -1
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/service-ticket/schema.ts +0 -153
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/ticket-action-log/page.tsx +0 -1
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/forms/ticket-action-log/schema.ts +0 -65
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/js-code-nodes/daily_ticket_digest/index.ts +0 -44
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/js-code-nodes/sync_roles_to_platform/index.ts +0 -33
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/App.tsx +0 -8
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/GlassHomeDashboard.tsx +0 -232
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/glass-home-dashboard/styles.css +0 -196
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/App.tsx +0 -7
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/WorkbenchPage.tsx +0 -36
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/components/ConfigPanel.tsx +0 -34
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/components/PreviewPanel.tsx +0 -17
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/page.config.ts +0 -9
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/reducer.ts +0 -29
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/interactive-workbench/styles.css +0 -24
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/App.tsx +0 -8
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/MintAnalyticsDashboard.tsx +0 -279
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mint-analytics-dashboard/styles.css +0 -163
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/App.tsx +0 -7
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/MobilePortalShell.tsx +0 -31
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/modules/MobileHome.tsx +0 -13
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/routes.ts +0 -13
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/mobile-portal-shell/styles.css +0 -11
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/App.tsx +0 -8
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/OpsMonitorDashboard.tsx +0 -306
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/ops-monitor-dashboard/styles.css +0 -248
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/App.tsx +0 -7
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/PcPortalShell.tsx +0 -35
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/components/PortalMetric.tsx +0 -11
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/modules/HomeModule.tsx +0 -25
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/modules/TicketsModule.tsx +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/routes.ts +0 -19
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/pc-portal-shell/styles.css +0 -35
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/App.tsx +0 -7
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/TicketOpsPage.tsx +0 -105
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/components/TicketActionTimeline.tsx +0 -22
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/components/TicketDetailDrawer.tsx +0 -44
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/components/TicketTableActions.tsx +0 -57
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/page.config.ts +0 -9
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/service-ticket-ops/styles.css +0 -35
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/App.tsx +0 -8
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/WorkOrderListDrawerPage.tsx +0 -371
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/index.tsx +0 -10
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/page.config.ts +0 -14
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/pages/work-order-list-drawer/styles.css +0 -182
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/automations/daily-ticket-digest/automation.json +0 -25
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/automations/daily-ticket-digest/trigger.json +0 -9
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/notifications/daily-ticket-digest.json +0 -24
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/permissions/form-groups/service-ticket-college.json +0 -21
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/permissions/roles.json +0 -17
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/resources/workflows/expense-approval-workflow.json +0 -48
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/ConfirmAction.tsx +0 -22
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/QueryState.tsx +0 -37
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/StatusTag.tsx +0 -20
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/DashboardPrimitives.tsx +0 -832
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/chartOptions.ts +0 -140
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/sampleData.ts +0 -466
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/styles.css +0 -874
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/components/admin-ui-templates/types.ts +0 -150
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/hooks/useTicketOps.ts +0 -96
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/services/role-governance.ts +0 -48
- package/templates/sy-lowcode-app-workspace/examples/best-practices/src/shared/services/service-ticket.ts +0 -113
- package/templates/sy-lowcode-app-workspace/examples/forms/customer/page.tsx +0 -1
- package/templates/sy-lowcode-app-workspace/examples/forms/customer/schema.ts +0 -36
- package/templates/sy-lowcode-app-workspace/index.html +0 -12
- package/templates/sy-lowcode-app-workspace/package.json +0 -58
- package/templates/sy-lowcode-app-workspace/postcss.config.cjs +0 -9
- package/templates/sy-lowcode-app-workspace/scripts/build-js-code.mjs +0 -600
- package/templates/sy-lowcode-app-workspace/scripts/guard-publish.mjs +0 -29
- package/templates/sy-lowcode-app-workspace/src/dev/App.tsx +0 -820
- package/templates/sy-lowcode-app-workspace/src/forms/.gitkeep +0 -1
- package/templates/sy-lowcode-app-workspace/src/forms/README.md +0 -52
- package/templates/sy-lowcode-app-workspace/src/index.css +0 -26
- package/templates/sy-lowcode-app-workspace/src/js-code-nodes/.gitkeep +0 -1
- package/templates/sy-lowcode-app-workspace/src/js-code-nodes/types.d.ts +0 -3
- package/templates/sy-lowcode-app-workspace/src/main.tsx +0 -29
- package/templates/sy-lowcode-app-workspace/src/pages/.gitkeep +0 -1
- package/templates/sy-lowcode-app-workspace/src/runtime/builtin-overrides.tsx +0 -8
- package/templates/sy-lowcode-app-workspace/src/shared/form-schema.ts +0 -135
- package/templates/sy-lowcode-app-workspace/src/types/app-workspace.types.ts +0 -88
- package/templates/sy-lowcode-app-workspace/tailwind.config.cjs +0 -31
- package/templates/sy-lowcode-app-workspace/tsconfig.app.json +0 -40
- package/templates/sy-lowcode-app-workspace/tsconfig.examples.json +0 -24
- package/templates/sy-lowcode-app-workspace/tsconfig.js-code-nodes.json +0 -19
- package/templates/sy-lowcode-app-workspace/tsconfig.json +0 -7
- package/templates/sy-lowcode-app-workspace/tsconfig.node.json +0 -10
- package/templates/sy-lowcode-app-workspace/vite.config.ts +0 -85
- package/v2/README.md +0 -35
- package/v2/skills/manifest.json +0 -45
- package/v2/skills/openxiangda-v1-maintenance/SKILL.md +0 -21
- package/v2/skills/openxiangda-v1-maintenance/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2/SKILL.md +0 -38
- package/v2/skills/openxiangda-v2-architecture/SKILL.md +0 -29
- package/v2/skills/openxiangda-v2-architecture/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2-backend/SKILL.md +0 -28
- package/v2/skills/openxiangda-v2-backend/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2-data-authz/SKILL.md +0 -28
- package/v2/skills/openxiangda-v2-data-authz/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2-delivery/SKILL.md +0 -30
- package/v2/skills/openxiangda-v2-delivery/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2-frontend/SKILL.md +0 -21
- package/v2/skills/openxiangda-v2-frontend/agents/openai.yaml +0 -4
- package/v2/skills/openxiangda-v2-workflow-events/SKILL.md +0 -28
- package/v2/skills/openxiangda-v2-workflow-events/agents/openai.yaml +0 -4
- /package/{v2/skills → skills}/openxiangda-v2/agents/openai.yaml +0 -0
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
const crypto = require('crypto');
|
|
2
|
-
|
|
3
|
-
function legacyRemoteIdentity(value) {
|
|
4
|
-
const remote = String(value || '').trim();
|
|
5
|
-
try {
|
|
6
|
-
const url = new URL(remote);
|
|
7
|
-
url.username = '';
|
|
8
|
-
url.password = '';
|
|
9
|
-
url.search = '';
|
|
10
|
-
url.hash = '';
|
|
11
|
-
return url.toString();
|
|
12
|
-
} catch {
|
|
13
|
-
return remote
|
|
14
|
-
.replace(/^[^@/]+@([^:]+):/, '$1:')
|
|
15
|
-
.replace(/[?#].*$/, '');
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function toggleDotGit(value) {
|
|
20
|
-
const normalized = String(value || '').replace(/\/+$/, '');
|
|
21
|
-
return /\.git$/i.test(normalized)
|
|
22
|
-
? normalized.replace(/\.git$/i, '')
|
|
23
|
-
: `${normalized}.git`;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function canonicalRemoteIdentity(value) {
|
|
27
|
-
const legacy = legacyRemoteIdentity(value).replace(/\/+$/, '');
|
|
28
|
-
try {
|
|
29
|
-
const url = new URL(legacy);
|
|
30
|
-
const host = url.hostname.toLowerCase();
|
|
31
|
-
const port = url.port ? `:${url.port}` : '';
|
|
32
|
-
const pathname = url.pathname
|
|
33
|
-
.replace(/^\/+|\/+$/g, '')
|
|
34
|
-
.replace(/\.git$/i, '');
|
|
35
|
-
return `${host}${port}/${pathname}`.replace(/\/+$/, '');
|
|
36
|
-
} catch {
|
|
37
|
-
return legacy
|
|
38
|
-
.replace(/^([^:]+):/, '$1/')
|
|
39
|
-
.replace(/\.git$/i, '')
|
|
40
|
-
.replace(/\/+$/, '');
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function remoteIdentityVariants(value) {
|
|
45
|
-
const legacy = legacyRemoteIdentity(value).replace(/\/+$/, '');
|
|
46
|
-
return Array.from(
|
|
47
|
-
new Set(
|
|
48
|
-
[
|
|
49
|
-
legacy,
|
|
50
|
-
toggleDotGit(legacy),
|
|
51
|
-
canonicalRemoteIdentity(legacy),
|
|
52
|
-
].filter(Boolean)
|
|
53
|
-
)
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function sha256(value) {
|
|
58
|
-
return `sha256:${crypto
|
|
59
|
-
.createHash('sha256')
|
|
60
|
-
.update(String(value))
|
|
61
|
-
.digest('hex')}`;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
function remoteRepositoryHashes(value) {
|
|
65
|
-
return remoteIdentityVariants(value).map(identity =>
|
|
66
|
-
sha256(`remote:${identity}`)
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
function remoteUrlHashes(value) {
|
|
71
|
-
return remoteIdentityVariants(value).map(sha256);
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function identitiesIntersect(left, right) {
|
|
75
|
-
const leftSet = new Set(
|
|
76
|
-
(Array.isArray(left) ? left : [left]).filter(Boolean)
|
|
77
|
-
);
|
|
78
|
-
return (Array.isArray(right) ? right : [right]).some(value =>
|
|
79
|
-
leftSet.has(value)
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
module.exports = {
|
|
84
|
-
identitiesIntersect,
|
|
85
|
-
legacyRemoteIdentity,
|
|
86
|
-
remoteIdentityVariants,
|
|
87
|
-
remoteRepositoryHashes,
|
|
88
|
-
remoteUrlHashes,
|
|
89
|
-
};
|
package/lib/http.js
DELETED
|
@@ -1,196 +0,0 @@
|
|
|
1
|
-
const { formatFetchError, maskText } = require('./utils');
|
|
2
|
-
|
|
3
|
-
const DEFAULT_REQUEST_TIMEOUT_MS = normalizeTimeoutMs(
|
|
4
|
-
process.env.OPENXIANGDA_REQUEST_TIMEOUT_MS,
|
|
5
|
-
120000
|
|
6
|
-
);
|
|
7
|
-
const DEFAULT_CONNECT_TIMEOUT_MS = normalizeTimeoutMs(
|
|
8
|
-
process.env.OPENXIANGDA_CONNECT_TIMEOUT_MS,
|
|
9
|
-
30000
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
configureFetchDispatcher(DEFAULT_CONNECT_TIMEOUT_MS);
|
|
13
|
-
|
|
14
|
-
async function requestJson(baseUrl, apiPath, options = {}) {
|
|
15
|
-
if (typeof fetch !== 'function') {
|
|
16
|
-
throw new Error('当前 Node.js 版本不支持 fetch,请使用 Node.js 18 或更高版本');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const url = `${baseUrl.replace(/\/+$/, '')}${apiPath}`;
|
|
20
|
-
const timeoutMs = normalizeTimeoutMs(options.timeoutMs, DEFAULT_REQUEST_TIMEOUT_MS);
|
|
21
|
-
const controller = new AbortController();
|
|
22
|
-
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
23
|
-
const headers = {
|
|
24
|
-
accept: 'application/json',
|
|
25
|
-
...(options.headers || {}),
|
|
26
|
-
};
|
|
27
|
-
if (options.body !== undefined) {
|
|
28
|
-
headers['content-type'] = 'application/json';
|
|
29
|
-
}
|
|
30
|
-
if (options.accessToken) {
|
|
31
|
-
headers.authorization = `Bearer ${options.accessToken}`;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
let response;
|
|
35
|
-
try {
|
|
36
|
-
response = await fetch(url, {
|
|
37
|
-
method: options.method || 'GET',
|
|
38
|
-
headers,
|
|
39
|
-
body:
|
|
40
|
-
options.body === undefined ? undefined : JSON.stringify(options.body),
|
|
41
|
-
signal: controller.signal,
|
|
42
|
-
});
|
|
43
|
-
} catch (error) {
|
|
44
|
-
if (isAbortError(error)) {
|
|
45
|
-
throw new Error(maskText(`HTTP request timed out after ${timeoutMs}ms: ${apiPath}`));
|
|
46
|
-
}
|
|
47
|
-
throw new Error(formatFetchError(error, apiPath));
|
|
48
|
-
} finally {
|
|
49
|
-
clearTimeout(timer);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const text = await response.text();
|
|
53
|
-
let payload = null;
|
|
54
|
-
if (text) {
|
|
55
|
-
try {
|
|
56
|
-
payload = JSON.parse(text);
|
|
57
|
-
} catch {
|
|
58
|
-
payload = { message: text };
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
if (!response.ok) {
|
|
63
|
-
const message = payload?.message || response.statusText || 'request failed';
|
|
64
|
-
const error = new Error(maskText(`HTTP ${response.status}: ${message}`));
|
|
65
|
-
error.status = response.status;
|
|
66
|
-
error.payload = payload;
|
|
67
|
-
error.code = payload?.errorCode || payload?.code;
|
|
68
|
-
error.data = payload?.data;
|
|
69
|
-
throw error;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return payload;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function normalizeTimeoutMs(value, fallback) {
|
|
76
|
-
const parsed = Number(value);
|
|
77
|
-
if (Number.isFinite(parsed) && parsed > 0) return parsed;
|
|
78
|
-
return fallback;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function isAbortError(error) {
|
|
82
|
-
return (
|
|
83
|
-
error?.name === 'AbortError' ||
|
|
84
|
-
String(error?.message || '').toLowerCase().includes('aborted')
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
module.exports = {
|
|
89
|
-
requestJson,
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
function configureFetchDispatcher(timeoutMs) {
|
|
93
|
-
try {
|
|
94
|
-
// Node fetch uses undici internally but does not honor proxy environment
|
|
95
|
-
// variables by itself. Keep NO_PROXY-aware routing while extending the
|
|
96
|
-
// connect timeout for private and high-latency deployments.
|
|
97
|
-
const { Agent, ProxyAgent, setGlobalDispatcher } = require('undici');
|
|
98
|
-
const connect = { timeout: timeoutMs };
|
|
99
|
-
const directAgent = new Agent({ connect });
|
|
100
|
-
const httpProxyUrl = readProxyUrl('HTTP_PROXY');
|
|
101
|
-
const httpsProxyUrl = readProxyUrl('HTTPS_PROXY') || httpProxyUrl;
|
|
102
|
-
const allProxyUrl = readProxyUrl('ALL_PROXY');
|
|
103
|
-
const httpProxyAgent = createProxyAgent(
|
|
104
|
-
ProxyAgent,
|
|
105
|
-
httpProxyUrl || allProxyUrl,
|
|
106
|
-
connect
|
|
107
|
-
);
|
|
108
|
-
const httpsProxyAgent = createProxyAgent(
|
|
109
|
-
ProxyAgent,
|
|
110
|
-
httpsProxyUrl || allProxyUrl,
|
|
111
|
-
connect
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
setGlobalDispatcher({
|
|
115
|
-
dispatch(options, handler) {
|
|
116
|
-
const origin = new URL(String(options.origin));
|
|
117
|
-
if (shouldBypassProxy(origin)) {
|
|
118
|
-
return directAgent.dispatch(options, handler);
|
|
119
|
-
}
|
|
120
|
-
const proxyAgent =
|
|
121
|
-
origin.protocol === 'https:' ? httpsProxyAgent : httpProxyAgent;
|
|
122
|
-
return (proxyAgent || directAgent).dispatch(options, handler);
|
|
123
|
-
},
|
|
124
|
-
close() {
|
|
125
|
-
return closeDispatchers([
|
|
126
|
-
directAgent,
|
|
127
|
-
httpProxyAgent,
|
|
128
|
-
httpsProxyAgent,
|
|
129
|
-
]);
|
|
130
|
-
},
|
|
131
|
-
destroy(error) {
|
|
132
|
-
return destroyDispatchers(
|
|
133
|
-
[directAgent, httpProxyAgent, httpsProxyAgent],
|
|
134
|
-
error
|
|
135
|
-
);
|
|
136
|
-
},
|
|
137
|
-
});
|
|
138
|
-
} catch {
|
|
139
|
-
// Keep working on runtimes where undici is not directly importable.
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function readProxyUrl(name) {
|
|
144
|
-
const value = process.env[name] || process.env[name.toLowerCase()];
|
|
145
|
-
return String(value || '').trim();
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
function createProxyAgent(ProxyAgent, uri, connect) {
|
|
149
|
-
if (!uri) return null;
|
|
150
|
-
return new ProxyAgent({ uri, connect });
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function shouldBypassProxy(origin) {
|
|
154
|
-
const noProxy = readProxyUrl('NO_PROXY');
|
|
155
|
-
if (!noProxy) return false;
|
|
156
|
-
const hostname = origin.hostname.replace(/^\[|\]$/g, '').toLowerCase();
|
|
157
|
-
const port = origin.port || (origin.protocol === 'https:' ? '443' : '80');
|
|
158
|
-
|
|
159
|
-
return noProxy.split(',').some(rawEntry => {
|
|
160
|
-
const entry = rawEntry.trim().toLowerCase();
|
|
161
|
-
if (!entry) return false;
|
|
162
|
-
if (entry === '*') return true;
|
|
163
|
-
|
|
164
|
-
const normalized = entry.replace(/^https?:\/\//, '');
|
|
165
|
-
const separator = normalized.lastIndexOf(':');
|
|
166
|
-
const hasSinglePortSeparator =
|
|
167
|
-
separator > -1 && normalized.indexOf(':') === separator;
|
|
168
|
-
const entryHost = (hasSinglePortSeparator
|
|
169
|
-
? normalized.slice(0, separator)
|
|
170
|
-
: normalized
|
|
171
|
-
).replace(/^\[|\]$/g, '');
|
|
172
|
-
const entryPort = hasSinglePortSeparator
|
|
173
|
-
? normalized.slice(separator + 1)
|
|
174
|
-
: '';
|
|
175
|
-
if (entryPort && entryPort !== port) return false;
|
|
176
|
-
|
|
177
|
-
const suffix = entryHost.replace(/^\*?\./, '');
|
|
178
|
-
return hostname === suffix || hostname.endsWith(`.${suffix}`);
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
async function closeDispatchers(dispatchers) {
|
|
183
|
-
await Promise.all(
|
|
184
|
-
uniqueDispatchers(dispatchers).map(dispatcher => dispatcher.close())
|
|
185
|
-
);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
async function destroyDispatchers(dispatchers, error) {
|
|
189
|
-
await Promise.all(
|
|
190
|
-
uniqueDispatchers(dispatchers).map(dispatcher => dispatcher.destroy(error))
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function uniqueDispatchers(dispatchers) {
|
|
195
|
-
return [...new Set(dispatchers.filter(Boolean))];
|
|
196
|
-
}
|
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const { spawnSync } = require('child_process');
|
|
4
|
-
|
|
5
|
-
const TASK_RESULT_SCHEMA_VERSION = 'openxiangda_task_result_v2';
|
|
6
|
-
const LEGACY_TASK_RESULT_SCHEMA_VERSION = 'openxiangda_task_result_v1';
|
|
7
|
-
const INTEGRATION_BUNDLE_SCHEMA_VERSION = 'openxiangda_integration_bundle_v1';
|
|
8
|
-
|
|
9
|
-
function runGit(cwd, args, options = {}) {
|
|
10
|
-
const result = spawnSync('git', args, {
|
|
11
|
-
cwd,
|
|
12
|
-
encoding: 'utf8',
|
|
13
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
14
|
-
});
|
|
15
|
-
if (result.status !== 0 && !options.allowFailure) {
|
|
16
|
-
const error = new Error(
|
|
17
|
-
String(result.stderr || result.stdout || `git ${args.join(' ')} failed`).trim()
|
|
18
|
-
);
|
|
19
|
-
error.code = 'INTEGRATION_GIT_FAILED';
|
|
20
|
-
throw error;
|
|
21
|
-
}
|
|
22
|
-
return {
|
|
23
|
-
ok: result.status === 0,
|
|
24
|
-
stdout: String(result.stdout || '').trim(),
|
|
25
|
-
stderr: String(result.stderr || '').trim(),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function gitCommonStateDir(cwd) {
|
|
30
|
-
const root = runGit(cwd, ['rev-parse', '--show-toplevel']).stdout;
|
|
31
|
-
const common = runGit(cwd, ['rev-parse', '--git-common-dir']).stdout;
|
|
32
|
-
const commonDir = path.isAbsolute(common) ? common : path.resolve(root, common);
|
|
33
|
-
return path.join(commonDir, 'openxiangda');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function taskResultFile(cwd, changeId) {
|
|
37
|
-
return path.join(
|
|
38
|
-
gitCommonStateDir(cwd),
|
|
39
|
-
'task-results',
|
|
40
|
-
`${normalizeChangeId(changeId)}.json`
|
|
41
|
-
);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function normalizeChangeId(value) {
|
|
45
|
-
const changeId = String(value || '').trim();
|
|
46
|
-
if (!/^[a-z0-9][a-z0-9._-]*$/i.test(changeId)) {
|
|
47
|
-
const error = new Error(`INTEGRATION_CHANGE_ID_INVALID: ${value || '(empty)'}`);
|
|
48
|
-
error.code = 'INTEGRATION_CHANGE_ID_INVALID';
|
|
49
|
-
throw error;
|
|
50
|
-
}
|
|
51
|
-
return changeId.toLowerCase();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function recordIntegrationTaskResult(options = {}) {
|
|
55
|
-
const cwd = path.resolve(options.cwd || process.cwd());
|
|
56
|
-
const changeId = normalizeChangeId(options.changeId);
|
|
57
|
-
const dirty = runGit(cwd, ['status', '--porcelain']).stdout;
|
|
58
|
-
if (dirty) {
|
|
59
|
-
const error = new Error(
|
|
60
|
-
'INTEGRATION_TASK_RESULT_DIRTY: 请先提交该任务的实现、测试和 SDD 记录,再生成 task result'
|
|
61
|
-
);
|
|
62
|
-
error.code = 'INTEGRATION_TASK_RESULT_DIRTY';
|
|
63
|
-
throw error;
|
|
64
|
-
}
|
|
65
|
-
const commit = runGit(cwd, ['rev-parse', 'HEAD']).stdout;
|
|
66
|
-
const treeHash = runGit(cwd, ['rev-parse', 'HEAD^{tree}']).stdout;
|
|
67
|
-
const branch = runGit(cwd, ['branch', '--show-current']).stdout;
|
|
68
|
-
if (!branch) {
|
|
69
|
-
const error = new Error(
|
|
70
|
-
'INTEGRATION_TASK_BRANCH_REQUIRED: detached HEAD 不能生成可合并任务结果'
|
|
71
|
-
);
|
|
72
|
-
error.code = 'INTEGRATION_TASK_BRANCH_REQUIRED';
|
|
73
|
-
throw error;
|
|
74
|
-
}
|
|
75
|
-
const result = {
|
|
76
|
-
schemaVersion: TASK_RESULT_SCHEMA_VERSION,
|
|
77
|
-
changeId,
|
|
78
|
-
commit,
|
|
79
|
-
treeHash,
|
|
80
|
-
branch,
|
|
81
|
-
...(options.sourceBase?.baseCommit && options.sourceBase?.treeHash
|
|
82
|
-
? {
|
|
83
|
-
sourceBase: {
|
|
84
|
-
repo: options.sourceBase.repo,
|
|
85
|
-
baseCommit: options.sourceBase.baseCommit,
|
|
86
|
-
treeHash: options.sourceBase.treeHash,
|
|
87
|
-
},
|
|
88
|
-
baseRevision: options.sourceBase.baseCommit,
|
|
89
|
-
}
|
|
90
|
-
: {}),
|
|
91
|
-
targets: options.targets || {},
|
|
92
|
-
changedFiles: Array.from(
|
|
93
|
-
new Set((options.changedFiles || []).map(String).filter(Boolean))
|
|
94
|
-
).sort(),
|
|
95
|
-
recordedAt: new Date().toISOString(),
|
|
96
|
-
};
|
|
97
|
-
const file = taskResultFile(cwd, changeId);
|
|
98
|
-
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
99
|
-
fs.writeFileSync(file, `${JSON.stringify(result, null, 2)}\n`, {
|
|
100
|
-
mode: 0o600,
|
|
101
|
-
});
|
|
102
|
-
return { ...result, file };
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
function readIntegrationTaskResult(cwd, changeId) {
|
|
106
|
-
const file = taskResultFile(cwd, changeId);
|
|
107
|
-
if (!fs.existsSync(file)) return null;
|
|
108
|
-
try {
|
|
109
|
-
const value = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
110
|
-
return [
|
|
111
|
-
TASK_RESULT_SCHEMA_VERSION,
|
|
112
|
-
LEGACY_TASK_RESULT_SCHEMA_VERSION,
|
|
113
|
-
].includes(value?.schemaVersion)
|
|
114
|
-
? { ...value, file }
|
|
115
|
-
: null;
|
|
116
|
-
} catch {
|
|
117
|
-
return null;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function commitIsAncestor(cwd, commit, descendant = 'HEAD') {
|
|
122
|
-
return runGit(
|
|
123
|
-
cwd,
|
|
124
|
-
['merge-base', '--is-ancestor', String(commit), String(descendant)],
|
|
125
|
-
{ allowFailure: true }
|
|
126
|
-
).ok;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function collectIntegrationTaskResults(options = {}) {
|
|
130
|
-
const cwd = path.resolve(options.cwd || process.cwd());
|
|
131
|
-
const changeIds = Array.from(
|
|
132
|
-
new Set((options.changeIds || []).map(normalizeChangeId))
|
|
133
|
-
).sort();
|
|
134
|
-
const results = changeIds.map(changeId => {
|
|
135
|
-
const result = readIntegrationTaskResult(cwd, changeId);
|
|
136
|
-
if (!result) {
|
|
137
|
-
const error = new Error(
|
|
138
|
-
`INTEGRATION_TASK_RESULT_REQUIRED: ${changeId} 缺少 task result;请在任务提交后运行 openxiangda sdd ready ${changeId}`
|
|
139
|
-
);
|
|
140
|
-
error.code = 'INTEGRATION_TASK_RESULT_REQUIRED';
|
|
141
|
-
error.changeId = changeId;
|
|
142
|
-
throw error;
|
|
143
|
-
}
|
|
144
|
-
if (!commitIsAncestor(cwd, result.commit, 'HEAD')) {
|
|
145
|
-
const error = new Error(
|
|
146
|
-
`INTEGRATION_TASK_COMMIT_NOT_MERGED: ${changeId}@${String(result.commit).slice(0, 12)} 尚未合并到当前主线 HEAD`
|
|
147
|
-
);
|
|
148
|
-
error.code = 'INTEGRATION_TASK_COMMIT_NOT_MERGED';
|
|
149
|
-
error.changeId = changeId;
|
|
150
|
-
error.commit = result.commit;
|
|
151
|
-
throw error;
|
|
152
|
-
}
|
|
153
|
-
return result;
|
|
154
|
-
});
|
|
155
|
-
return {
|
|
156
|
-
schemaVersion: INTEGRATION_BUNDLE_SCHEMA_VERSION,
|
|
157
|
-
requiredChanges: changeIds,
|
|
158
|
-
requiredCommits: results.map(result => ({
|
|
159
|
-
changeId: result.changeId,
|
|
160
|
-
commit: result.commit,
|
|
161
|
-
treeHash: result.treeHash,
|
|
162
|
-
sourceBranch: result.branch,
|
|
163
|
-
...(result.sourceBase?.baseCommit && result.sourceBase?.treeHash
|
|
164
|
-
? {
|
|
165
|
-
sourceBase: result.sourceBase,
|
|
166
|
-
baseRevision:
|
|
167
|
-
result.baseRevision || result.sourceBase.baseCommit,
|
|
168
|
-
}
|
|
169
|
-
: {}),
|
|
170
|
-
})),
|
|
171
|
-
verifiedAgainst: runGit(cwd, ['rev-parse', 'HEAD']).stdout,
|
|
172
|
-
createdAt: new Date().toISOString(),
|
|
173
|
-
};
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function inspectIntegrationBundleCommits(integration, options = {}) {
|
|
177
|
-
const cwd = path.resolve(options.cwd || process.cwd());
|
|
178
|
-
const required = Array.isArray(integration?.requiredCommits)
|
|
179
|
-
? integration.requiredCommits
|
|
180
|
-
: [];
|
|
181
|
-
return {
|
|
182
|
-
schemaVersion:
|
|
183
|
-
integration?.schemaVersion || INTEGRATION_BUNDLE_SCHEMA_VERSION,
|
|
184
|
-
valid: required.length > 0,
|
|
185
|
-
requiredCommits: required.map(item => ({
|
|
186
|
-
...item,
|
|
187
|
-
mergedIntoHead: commitIsAncestor(cwd, item.commit, 'HEAD'),
|
|
188
|
-
})),
|
|
189
|
-
checkedHead: runGit(cwd, ['rev-parse', 'HEAD']).stdout,
|
|
190
|
-
checkedAt: new Date().toISOString(),
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function assertIntegrationBundleCommits(integration, options = {}) {
|
|
195
|
-
const inspection = inspectIntegrationBundleCommits(integration, options);
|
|
196
|
-
if (!inspection.valid) {
|
|
197
|
-
const error = new Error(
|
|
198
|
-
'INTEGRATION_BUNDLE_REQUIRED: mainline bundle 缺少 requiredCommits,禁止发布可能遗漏任务的主线'
|
|
199
|
-
);
|
|
200
|
-
error.code = 'INTEGRATION_BUNDLE_REQUIRED';
|
|
201
|
-
throw error;
|
|
202
|
-
}
|
|
203
|
-
const missing = inspection.requiredCommits.filter(item => !item.mergedIntoHead);
|
|
204
|
-
if (missing.length > 0) {
|
|
205
|
-
const error = new Error(
|
|
206
|
-
`INTEGRATION_TASK_COMMIT_NOT_MERGED: ${missing
|
|
207
|
-
.map(item => `${item.changeId}@${String(item.commit).slice(0, 12)}`)
|
|
208
|
-
.join(', ')} 尚未合并到当前主线 HEAD`
|
|
209
|
-
);
|
|
210
|
-
error.code = 'INTEGRATION_TASK_COMMIT_NOT_MERGED';
|
|
211
|
-
error.missing = missing;
|
|
212
|
-
throw error;
|
|
213
|
-
}
|
|
214
|
-
return inspection;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
module.exports = {
|
|
218
|
-
INTEGRATION_BUNDLE_SCHEMA_VERSION,
|
|
219
|
-
TASK_RESULT_SCHEMA_VERSION,
|
|
220
|
-
assertIntegrationBundleCommits,
|
|
221
|
-
collectIntegrationTaskResults,
|
|
222
|
-
inspectIntegrationBundleCommits,
|
|
223
|
-
readIntegrationTaskResult,
|
|
224
|
-
recordIntegrationTaskResult,
|
|
225
|
-
};
|
package/lib/js-code-build.js
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const { spawnSync } = require('child_process');
|
|
4
|
-
|
|
5
|
-
const JS_CODE_SOURCE_KINDS = new Set(['js-code-nodes', 'automations', 'functions']);
|
|
6
|
-
const CANONICAL_BUILD_SCRIPT = path.join(
|
|
7
|
-
__dirname,
|
|
8
|
-
'..',
|
|
9
|
-
'templates',
|
|
10
|
-
'openxiangda-react-spa',
|
|
11
|
-
'scripts',
|
|
12
|
-
'build-js-code.mjs'
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
function normalizeJsCodeBuildTargets(targets = []) {
|
|
16
|
-
const normalized = [];
|
|
17
|
-
const seen = new Set();
|
|
18
|
-
for (const target of targets) {
|
|
19
|
-
const sourceKind = String(target?.sourceKind || target?.kind || '').trim();
|
|
20
|
-
const scriptCode = String(target?.scriptCode || target?.code || '').trim();
|
|
21
|
-
if (!JS_CODE_SOURCE_KINDS.has(sourceKind)) {
|
|
22
|
-
throw new Error(`unsupported JS_CODE source: ${sourceKind || '<empty>'}`);
|
|
23
|
-
}
|
|
24
|
-
if (
|
|
25
|
-
!scriptCode ||
|
|
26
|
-
scriptCode === '.' ||
|
|
27
|
-
scriptCode === '..' ||
|
|
28
|
-
scriptCode.includes('/') ||
|
|
29
|
-
scriptCode.includes('\\')
|
|
30
|
-
) {
|
|
31
|
-
throw new Error(`invalid JS_CODE script code: ${scriptCode || '<empty>'}`);
|
|
32
|
-
}
|
|
33
|
-
const key = `${sourceKind}:${scriptCode}`;
|
|
34
|
-
if (seen.has(key)) continue;
|
|
35
|
-
seen.add(key);
|
|
36
|
-
normalized.push({ sourceKind, scriptCode });
|
|
37
|
-
}
|
|
38
|
-
return normalized;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function buildJsCodeBatchArgs(targets, options = {}) {
|
|
42
|
-
const normalized = normalizeJsCodeBuildTargets(targets);
|
|
43
|
-
if (normalized.length === 0) {
|
|
44
|
-
throw new Error('JS_CODE batch build requires at least one target');
|
|
45
|
-
}
|
|
46
|
-
const specs = normalized.map(target => `${target.sourceKind}:${target.scriptCode}`);
|
|
47
|
-
return [
|
|
48
|
-
'build-js-code',
|
|
49
|
-
'--scripts',
|
|
50
|
-
specs.join(','),
|
|
51
|
-
...(options.force ? ['--force'] : []),
|
|
52
|
-
];
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function readWorkspacePackage(workspaceRoot) {
|
|
56
|
-
try {
|
|
57
|
-
return JSON.parse(
|
|
58
|
-
fs.readFileSync(path.join(workspaceRoot, 'package.json'), 'utf8')
|
|
59
|
-
);
|
|
60
|
-
} catch {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function isStandardWorkspaceJsCodeBuilder(workspaceRoot) {
|
|
66
|
-
const command = String(
|
|
67
|
-
readWorkspacePackage(workspaceRoot)?.scripts?.['build-js-code'] || ''
|
|
68
|
-
).trim().replace(/\\/g, '/');
|
|
69
|
-
if (!command) return true;
|
|
70
|
-
// Only bypass the exact template-shaped command. Extra flags, command
|
|
71
|
-
// chaining, or wrappers may be meaningful custom preprocessing and must keep
|
|
72
|
-
// using the workspace builder.
|
|
73
|
-
const matched = command.match(
|
|
74
|
-
/^(?:node\s+)?((?:\.\/)?scripts\/build-js-code\.(?:mjs|cjs|js))$/
|
|
75
|
-
);
|
|
76
|
-
if (!matched) return false;
|
|
77
|
-
try {
|
|
78
|
-
const source = fs.readFileSync(path.resolve(workspaceRoot, matched[1]), 'utf8');
|
|
79
|
-
return [
|
|
80
|
-
'tsconfig.js-code-nodes.json',
|
|
81
|
-
'sourceKinds',
|
|
82
|
-
'buildScript',
|
|
83
|
-
].every(marker => source.includes(marker)) &&
|
|
84
|
-
(source.includes('resolveBuildTargets') ||
|
|
85
|
-
source.includes('resolveBuildSelection'));
|
|
86
|
-
} catch {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function findWorkspaceTargetEntry(workspaceRoot, target) {
|
|
92
|
-
const base = path.join(
|
|
93
|
-
workspaceRoot,
|
|
94
|
-
'src',
|
|
95
|
-
target.sourceKind,
|
|
96
|
-
target.scriptCode,
|
|
97
|
-
'index'
|
|
98
|
-
);
|
|
99
|
-
return ['.ts', '.tsx']
|
|
100
|
-
.map(extension => `${base}${extension}`)
|
|
101
|
-
.find(filePath => fs.existsSync(filePath));
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function canUseCanonicalJsCodeBuilder(workspaceRoot, targets, options = {}) {
|
|
105
|
-
if (
|
|
106
|
-
options.forceCanonical !== true &&
|
|
107
|
-
(options.preferWorkspaceBuilder ||
|
|
108
|
-
process.env.OPENXIANGDA_USE_WORKSPACE_JS_CODE_BUILDER === '1')
|
|
109
|
-
) {
|
|
110
|
-
return false;
|
|
111
|
-
}
|
|
112
|
-
if (
|
|
113
|
-
!fs.existsSync(CANONICAL_BUILD_SCRIPT) ||
|
|
114
|
-
!fs.existsSync(path.join(workspaceRoot, 'tsconfig.js-code-nodes.json')) ||
|
|
115
|
-
(options.forceCanonical !== true &&
|
|
116
|
-
!isStandardWorkspaceJsCodeBuilder(workspaceRoot))
|
|
117
|
-
) {
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
return targets.every(target => findWorkspaceTargetEntry(workspaceRoot, target));
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function resolveWorkspaceJsCodeBuildCommand(workspaceRoot, targets, options = {}) {
|
|
124
|
-
const normalized = normalizeJsCodeBuildTargets(targets);
|
|
125
|
-
const packageArgs = buildJsCodeBatchArgs(normalized, options);
|
|
126
|
-
if (canUseCanonicalJsCodeBuilder(workspaceRoot, normalized, options)) {
|
|
127
|
-
return {
|
|
128
|
-
mode: 'canonical-scoped',
|
|
129
|
-
command: options.nodeBinary || process.execPath,
|
|
130
|
-
args: [CANONICAL_BUILD_SCRIPT, ...packageArgs.slice(1)],
|
|
131
|
-
env: {
|
|
132
|
-
OPENXIANGDA_WORKSPACE_ROOT: path.resolve(workspaceRoot),
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
return {
|
|
137
|
-
mode: 'workspace-script',
|
|
138
|
-
command: options.packageManager || 'pnpm',
|
|
139
|
-
args: packageArgs,
|
|
140
|
-
env: {},
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function runWorkspaceJsCodeBuildBatch(workspaceRoot, targets, options = {}) {
|
|
145
|
-
const resolved = resolveWorkspaceJsCodeBuildCommand(
|
|
146
|
-
workspaceRoot,
|
|
147
|
-
targets,
|
|
148
|
-
options
|
|
149
|
-
);
|
|
150
|
-
const spawnOptions = {
|
|
151
|
-
cwd: workspaceRoot,
|
|
152
|
-
encoding: 'utf8',
|
|
153
|
-
...options.spawnOptions,
|
|
154
|
-
};
|
|
155
|
-
if (resolved.mode === 'canonical-scoped') {
|
|
156
|
-
spawnOptions.env = {
|
|
157
|
-
...process.env,
|
|
158
|
-
...(options.spawnOptions?.env || {}),
|
|
159
|
-
...resolved.env,
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
const result = spawnSync(resolved.command, resolved.args, spawnOptions);
|
|
163
|
-
Object.defineProperty(result, 'openxiangdaBuildMode', {
|
|
164
|
-
value: resolved.mode,
|
|
165
|
-
enumerable: false,
|
|
166
|
-
});
|
|
167
|
-
return result;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
module.exports = {
|
|
171
|
-
buildJsCodeBatchArgs,
|
|
172
|
-
normalizeJsCodeBuildTargets,
|
|
173
|
-
resolveWorkspaceJsCodeBuildCommand,
|
|
174
|
-
runWorkspaceJsCodeBuildBatch,
|
|
175
|
-
};
|