@sqlpm/types-ts
Advanced tools
Comparing version 1.1.1 to 1.2.0
{ | ||
"name": "@sqlpm/types-ts", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Types shared between packages in the @sqlpm mono-repo", | ||
@@ -34,3 +34,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "49068ff2b0b1ec4f781571453e961835d819c66c" | ||
"gitHead": "09d832552d30c13e480d141b1d5b77e9ccfe735e" | ||
} |
161
src/index.ts
@@ -101,1 +101,162 @@ /** | ||
} | ||
/** | ||
* Supported database platforms. The name of the database platform is also | ||
* the name of the directory for that platform. For postgresql sql script would | ||
* be in a directory {project_root}/schemas/postgresql/* | ||
* | ||
* **@remarks** | ||
* We intend to add 'sqlite' | 'mssql' | 'mysql' | 'mariadb' | 'snowflake'. | ||
* | ||
* **@remarks** | ||
* When adding a new DatabasePlatform, be sure to updated the root | ||
* package.json to include the new database platform schema directory. | ||
* | ||
* **@example** | ||
* Adding postgresql packages required the following update to `package.json`. | ||
* ```json | ||
* { | ||
* // ... | ||
* "workspaces": [ | ||
* "schemas/postgresql/*", | ||
* ], | ||
* } | ||
* ``` | ||
*/ | ||
export enum DatabasePlatform { | ||
Postgresql = 'postgresql', | ||
} | ||
/** | ||
* Provides information about the database schemas defined in a module such | ||
* as the database platform the sql script is written for. | ||
* | ||
* **@remarks** | ||
* Intend to add other attributes like schemaName and domainsCovered | ||
* (business domains like person, invoice, etc.) | ||
* | ||
* **@interface** | ||
* **@member {@link DatabaseInformation.platform}** | ||
*/ | ||
export interface DatabaseInformation { | ||
/** | ||
* The database platform(s) of all sql scripts for a given package are | ||
* written for. In cases where the database platforms are compatible, | ||
* one of the {@link DatabasePlatform}s will be chosen to represent all | ||
* compatible database platforms. | ||
*/ | ||
// eslint-disable-next-line no-use-before-define | ||
platform: DatabasePlatform | DatabasePlatforms | ||
} | ||
/** | ||
* An array of {@link DatabasePlatform}. | ||
*/ | ||
export type DatabasePlatforms = DatabasePlatform[]; | ||
/** | ||
* The primary purpose of the database. For example, readwrite, readonly, | ||
* replication, etc. | ||
* | ||
* **@enum** | ||
* * **@members - {@link DatabasePurpose.Readonly}** | ||
* * **@members - {@link DatabasePurpose.Readwrite}** | ||
*/ | ||
export enum DatabasePurpose { | ||
/** | ||
* The database is a readonly database. Tables, indexes etc. are all | ||
* optimized for querying. Roles are mostly setup for data querying. | ||
*/ | ||
Readonly = 'readonly', | ||
/** | ||
* The database is a readwrite database. Tables, indexes etc. are all | ||
* optimized for inserts and updates. Roles are mostly setup for data | ||
* mutations. | ||
*/ | ||
Readwrite = 'readwrite', | ||
} | ||
/** | ||
* Defines directory names and the intent of the sql script located in the | ||
* directory. | ||
* | ||
* **@remarks** | ||
* Support is available to run sql form other directories. These directories | ||
* are provided as defaults. | ||
* | ||
* **@example** | ||
* Sql located the {@link RunActionDirectory.Test} directory | ||
* is used for testing. | ||
* | ||
* **@enum** | ||
* * **@members - {@link RunActionDirectory.Prerun}** | ||
* * **@members - {@link RunActionDirectory.Run}** | ||
* * **@members - {@link RunActionDirectory.Postrun}** | ||
* * **@members - {@link RunActionDirectory.Seed}** | ||
* * **@members - {@link RunActionDirectory.Test}** | ||
* * **@members - {@link RunActionDirectory.Reset}** | ||
*/ | ||
export enum RunActionDirectory { | ||
/** | ||
* Anything sql script that must run before script in the `run` directory | ||
* is applied. | ||
* | ||
* **@example** | ||
* | ||
* Setting session variables | ||
*/ | ||
Prerun = 'prerun', | ||
/** | ||
* Any sql script in the run directory is used to create core | ||
* entities(schemas, table, views), test scripts, and populate meta - | ||
* data(such as tags, lookups, defaults). | ||
*/ | ||
Run = 'run', | ||
/** | ||
* Any sql script to run after running all script in `run` and `seed`. | ||
* | ||
* **@example** | ||
* A quick sanity check. | ||
* | ||
*/ | ||
Postrun = 'postrun', | ||
/** | ||
* The intent of sql script in this directory is to pre - load a database | ||
* with seed data for developers and staging environments. Though possible, | ||
* seed data is not meant for production or before each test run. | ||
* | ||
* **@example** | ||
* * Populate data required in production / testing via the `run` directory. | ||
* * Populate data required for each test in the test itself. | ||
*/ | ||
Seed = 'seed', | ||
/** | ||
* The intent of sql in this directory is to test the behavior and features | ||
* of the entities created by the sql in the `run` directory. This is to | ||
* support behavior driven development. | ||
* | ||
* **@example** | ||
* | ||
* We created a url domain and want to check that the logic for verifying | ||
* a url is correct. | ||
* | ||
*/ | ||
Test = 'test', | ||
/** | ||
* The intent of sql in this directory is to tear down and reset everything | ||
* setup/created by the sql script in the `run` directory. | ||
*/ | ||
Reset = 'reset', | ||
} | ||
// eslint-disable-next-line max-len | ||
export const runActionDirectoryAsArray = (): RunActionDirectory[] => Object.values(RunActionDirectory); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7997
233