openxiangda-devkit-core 2.53.1 → 2.56.0

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 (33) hide show
  1. package/dist/application-services.js +1 -1
  2. package/dist/backend-image-build.d.ts.map +1 -1
  3. package/dist/backend-image-build.js +8 -5
  4. package/dist/backend-image-build.js.map +1 -1
  5. package/dist/backend-image-candidate.d.ts +4 -1
  6. package/dist/backend-image-candidate.d.ts.map +1 -1
  7. package/dist/backend-image-candidate.js +42 -11
  8. package/dist/backend-image-candidate.js.map +1 -1
  9. package/dist/backend-image-inputs.d.ts +3 -0
  10. package/dist/backend-image-inputs.d.ts.map +1 -0
  11. package/dist/backend-image-inputs.js +19 -0
  12. package/dist/backend-image-inputs.js.map +1 -0
  13. package/dist/compiler/bundle.d.ts.map +1 -1
  14. package/dist/compiler/bundle.js +18 -2
  15. package/dist/compiler/bundle.js.map +1 -1
  16. package/dist/compiler/config.d.ts +5 -0
  17. package/dist/compiler/config.d.ts.map +1 -1
  18. package/dist/compiler/config.js +32 -4
  19. package/dist/compiler/config.js.map +1 -1
  20. package/dist/compiler/field-policy-path.d.ts.map +1 -1
  21. package/dist/compiler/field-policy-path.js +2 -0
  22. package/dist/compiler/field-policy-path.js.map +1 -1
  23. package/dist/control-plane-client.d.ts +4 -0
  24. package/dist/control-plane-client.d.ts.map +1 -1
  25. package/dist/control-plane-client.js +87 -0
  26. package/dist/control-plane-client.js.map +1 -1
  27. package/dist/optional-backend.d.ts.map +1 -1
  28. package/dist/optional-backend.js +6 -0
  29. package/dist/optional-backend.js.map +1 -1
  30. package/package.json +4 -2
  31. package/templates/backend/Dockerfile +13 -6
  32. package/templates/backend/Dockerfile.dockerignore +19 -0
  33. package/templates/backend-inputs/legacy.Dockerfile +21 -0
@@ -1,4 +1,6 @@
1
+ import { parseNativeParentReadPolicy, validateNativeParentReadPolicies, NativeParentReadPolicyError, NativeDataPolicyExpressionV2Error } from 'openxiangda-contracts/native-compiler';
1
2
  import { assertWorkflowNativeStagePolicy } from 'openxiangda-contracts';
3
+ import { WORKFLOW_LAUNCH_MAX_INPUTS } from 'openxiangda-contracts';
2
4
  import { validateAuthenticatedPublicRead, AuthenticatedPublicReadContractError } from 'openxiangda-contracts/native-compiler';
3
5
  import { DATE_EVENT_RESERVED_DATA_FIELDS_V2, dateEventProjectionFieldsV2, dateEventProjectionEnvelopeSchemaV2 } from 'openxiangda-contracts/native-compiler';
4
6
  import { validateUserCandidateReferences, validateWorkflowUserCandidateBindings, UserCandidateContractError } from 'openxiangda-contracts';
@@ -1556,6 +1558,7 @@ export function validateAppConfig(value) {
1556
1558
  const policyFields = resourceFieldTypes.get(string(policy.resourceCode));
1557
1559
  policyRuleNodes(policy, policyPath, diagnostics).forEach(({ rule, path: rulePath }) => {
1558
1560
  const unknownRuleKeys = Object.keys(rule).filter(key => ![
1561
+ 'parentRead',
1559
1562
  'subject',
1560
1563
  'dimensionCode',
1561
1564
  'relationCode',
@@ -1584,8 +1587,17 @@ export function validateAppConfig(value) {
1584
1587
  dimensionCode,
1585
1588
  relationCode,
1586
1589
  dbNow ? 'db_now' : '',
1590
+ rule.parentRead !== undefined ? 'parent_read' : '',
1587
1591
  constantPredicate || nullPredicate ? 'constant' : '',
1588
1592
  ].filter(Boolean);
1593
+ let validParentRead = false;
1594
+ if (rule.parentRead !== undefined) {
1595
+ try {
1596
+ parseNativeParentReadPolicy(rule.parentRead, `${rulePath}.parentRead`);
1597
+ validParentRead = true;
1598
+ }
1599
+ catch { /* The shared cross-resource validator reports the exact failure. */ }
1600
+ }
1589
1601
  const validCurrentUser = subject === 'current_user';
1590
1602
  const validDimension = Boolean(dimensionCode) && dimensionCodes.has(dimensionCode);
1591
1603
  const validRelationship = Boolean(relationCode) && Boolean(string(rule.resourceCode));
@@ -1606,15 +1618,16 @@ export function validateAppConfig(value) {
1606
1618
  ['lt', 'lte', 'gt', 'gte'].includes(operator) &&
1607
1619
  rule.value === undefined &&
1608
1620
  policyFields?.get(string(rule.field)) === 'datetime';
1609
- if (!/^[A-Za-z_][A-Za-z0-9_]{0,127}$/.test(string(rule.field)) ||
1621
+ if ((!validParentRead && !/^[A-Za-z_][A-Za-z0-9_]{0,127}$/.test(string(rule.field))) ||
1610
1622
  modes.length !== 1 ||
1611
1623
  (!validCurrentUser &&
1612
1624
  !validDimension &&
1613
1625
  !validRelationship &&
1614
1626
  !validConstant &&
1615
1627
  !validNull &&
1616
- !validDbNow)) {
1617
- diagnostics.push(diagnostic('APP_CONFIG_AUTHZ_POLICY_RULE_INVALID', '策略规则必须且只能声明 current_user、dimension、relationship、constant/null 或 datetime db_now 中的一种', rulePath));
1628
+ !validDbNow &&
1629
+ !validParentRead)) {
1630
+ diagnostics.push(diagnostic('APP_CONFIG_AUTHZ_POLICY_RULE_INVALID', '策略规则必须且只能声明 current_user、dimension、relationship、constant/null、datetime db_now 或只读 parentRead 中的一种', rulePath));
1618
1631
  }
1619
1632
  if (dbNow && !validDbNow) {
1620
1633
  diagnostics.push(diagnostic('APP_CONFIG_AUTHZ_POLICY_DB_NOW_FIELD_INVALID', 'db_now 只支持 datetime 字段及 lt/lte/gt/gte 操作符', `${rulePath}.field`));
@@ -1639,6 +1652,17 @@ export function validateAppConfig(value) {
1639
1652
  }
1640
1653
  });
1641
1654
  });
1655
+ try {
1656
+ validateNativeParentReadPolicies(dataResources.map(object), policies.map(object), 'authz.dataPolicies');
1657
+ }
1658
+ catch (error) {
1659
+ if (error instanceof NativeParentReadPolicyError) {
1660
+ diagnostics.push(diagnostic(error.code, 'parentRead 必须绑定唯一的真实父子表关系且只用于读取', error.pointer));
1661
+ }
1662
+ else if (!(error instanceof NativeDataPolicyExpressionV2Error))
1663
+ throw error;
1664
+ // Malformed expressions were already reported by policyRuleNodes.
1665
+ }
1642
1666
  scopeSources.forEach((rawSource, sourceIndex) => {
1643
1667
  const source = object(rawSource);
1644
1668
  if (string(source.failureMode) !== 'last_known_good')
@@ -2177,7 +2201,7 @@ export function validateAppConfig(value) {
2177
2201
  const sourceCounts = new Map();
2178
2202
  let inputsInvalid = !isRecord(intent.inputs) ||
2179
2203
  inputEntries.length === 0 ||
2180
- inputEntries.length > 64;
2204
+ inputEntries.length > WORKFLOW_LAUNCH_MAX_INPUTS;
2181
2205
  for (const [inputCode, rawBinding] of inputEntries) {
2182
2206
  const binding = object(rawBinding);
2183
2207
  const source = string(binding.source);
@@ -4510,6 +4534,10 @@ export function currentUserDataPolicy(input) {
4510
4534
  };
4511
4535
  }
4512
4536
  export const dataPolicyExpression = {
4537
+ parentRead: (input) => ({
4538
+ parentRead: { resourceCode: input.resourceCode, subtableFieldCode: input.subtableFieldCode },
4539
+ ...(input.roleCodes ? { roleCodes: [...input.roleCodes] } : {}),
4540
+ }),
4513
4541
  allOf: (...values) => ({ allOf: values }),
4514
4542
  anyOf: (...values) => ({ anyOf: values }),
4515
4543
  constant: (input) => ({ ...input }),