`forge-database-utils` is a JavaScript/TypeScript package designed to provide shared database utility functions specifically for Forge services. Currently at version 1.4.1, it centralizes common database-related logic to ensure consistency and reduce code duplication across various internal Forge components like control, authentication, metadata, and UI services. Key features include a centralized definition of supported field types, utility functions for validating and querying field type properties (e.g., `isSupportedFieldType`, `getPostgresColumnType`), and functions for generating PostgreSQL-compatible base names from instance IDs. The package is developed to align with the specific architectural needs of the Forge ecosystem, serving as a foundational library rather than a general-purpose database utility. Its release cadence is typically tied to internal project development cycles, ensuring tight integration and stability within the Forge suite.
npm install forge-database-utilsVerified import paths — ran on the pinned version, not inferred.
Demonstrates importing various utility functions and types, using `getSupportedFieldTypes`, checking field type support, deriving PostgreSQL column types, handling 'Generated' field properties, and generating base names.
Ensure the second argument to `getPostgresColumnType` is a complete `fieldTypeProperties` object when `fieldType` is 'Generated'.
Prefer `import` statements over `require()`. If using Node.js, ensure your `package.json` specifies `"type": "module"` or use a transpiler like Babel/TypeScript to convert to ESM.
Regularly update `forge-database-utils` to benefit from new features and synchronize with the latest field type definitions across Forge services. Always validate user input against `isSupportedFieldType` or `SUPPORTED_FIELD_TYPES`.
Change `const { getSupportedFieldTypes } = require('forge-database-utils');` to `import { getSupportedFieldTypes } from 'forge-database-utils';`. Ensure your project and bundler are configured for ESM.Verify the field type string against `SUPPORTED_FIELD_TYPES` or use `isSupportedFieldType()` to check validity before processing. Correct any typos or ensure the field type is part of the Forge system.
Ensure the value passed is one of the types defined in the `FieldType` union. If it's a new custom type, it needs to be added to the internal Forge system and the `forge-database-utils` package.
No dependency data recorded yet.