feat(utilities): add readGlobalFieldSchemas utility function#2650
Conversation
Adds a thin wrapper around readContentTypeSchemas specifically for global
fields, enabling callers to read per-file {uid}.json exports from the
global_fields directory with a semantically accurate function name.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
…e list Prevents silent data corruption when a CLI v1 export archive containing global_fields/globalfields.json is passed to readGlobalFieldSchemas — the bulk array file is now skipped instead of being parsed as a single schema element. readContentTypeSchemas is unaffected. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
…dContentTypeSchemas unchanged Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
🔒 Security Scan Results
⏱️ SLA Breach Summary
ℹ️ Vulnerabilities Without Available Fixes (Informational Only)The following vulnerabilities were detected but do not have fixes available (no upgrade or patch). These are excluded from failure thresholds:
✅ BUILD PASSED - All security checks passed |
Summary
readGlobalFieldSchemas(dirPath, ignoredFiles?)to@contentstack/cli-utilitiesreadContentTypeSchemas— identical behaviour, purpose-specific nameWhy
Global fields now export as individual
{uid}.jsonfiles (one per field) rather than a single bulkglobalfields.jsonarray. Import, content-types, and audit modules need to scan a directory and read all those files. UsingreadContentTypeSchemasdirectly would work but is semantically misleading — callers working with global fields should call a function that names its intent clearly.Changes
packages/contentstack-utilities/src/content-type-utils.tsreadGlobalFieldSchemaswrapper beforereadContentTypeSchemasNotes
readContentTypeSchemas— it is unchangedreadContentTypeSchemasand applies equally to global field directoriesTest plan
pnpm --filter @contentstack/cli-utilities buildcompletes without errorsreadGlobalFieldSchemasis present in the compiledlib/content-type-utils.d.tsreadGlobalFieldSchemasfrom@contentstack/cli-utilitiesresolves correctly in downstream packages after rebuild🤖 Generated with Claude Code