openxiangda-contracts 2.6.0 → 2.6.1

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.
@@ -1046,6 +1046,8 @@ function compileCapabilities(config) {
1046
1046
  });
1047
1047
  }
1048
1048
  for (const [fieldCode, rawPolicy] of Object.entries(resource.fieldPolicies)) {
1049
+ if (isDataAuditMetadataField(fieldCode))
1050
+ continue;
1049
1051
  const policy = object(rawPolicy, `${pointer}/fieldPolicies/${fieldCode}`);
1050
1052
  for (const operation of ['read', 'create', 'update']) {
1051
1053
  if (!Array.isArray(policy[operation]))
@@ -2799,6 +2801,17 @@ function validateAuthorizationReferences(config, capabilities) {
2799
2801
  config.data.resources.forEach((rawResource, index) => {
2800
2802
  const resourcePointer = `/config/data/resources/${index}`;
2801
2803
  const resource = object(rawResource, resourcePointer);
2804
+ for (const [fieldCode, rawPolicy] of Object.entries(resource.fieldPolicies || {})) {
2805
+ if (!isDataAuditMetadataField(fieldCode))
2806
+ continue;
2807
+ const pointer = `${resourcePointer}/fieldPolicies/${fieldCode}/read`;
2808
+ const policy = object(rawPolicy, `${resourcePointer}/fieldPolicies/${fieldCode}`);
2809
+ for (const capability of uniqueStrings(policy.read || [], pointer, 2000)) {
2810
+ if (!capabilityCodes.has(capability)) {
2811
+ fail('NATIVE_CAPABILITY_REFERENCE_MISSING', pointer);
2812
+ }
2813
+ }
2814
+ }
2802
2815
  const surface = resource.surface === undefined
2803
2816
  ? {}
2804
2817
  : object(resource.surface, `${resourcePointer}/surface`);