fiberx-backend-toolkit 1.0.1 → 1.0.4
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.
|
@@ -56,8 +56,8 @@ exports.GENERATE_UTIL_METHOD_CODE = GENERATE_UTIL_METHOD_CODE;
|
|
|
56
56
|
const GENERATE_UTIL_CLASS_CODE = (types_file_name, generated_content) => {
|
|
57
57
|
return `
|
|
58
58
|
import { EmailAttachmentInterface } from "fiberx-backend-toolkit";
|
|
59
|
-
import { EmailEnqueueProcessor } from "fiberx-backend-toolkit/
|
|
60
|
-
import { LoggerUtil } from "fiberx-backend-toolkit/
|
|
59
|
+
import { EmailEnqueueProcessor } from "fiberx-backend-toolkit/mailer";
|
|
60
|
+
import { LoggerUtil } from "fiberx-backend-toolkit/utils";
|
|
61
61
|
import * as Types from "@/${types_file_name.replace(".ts", "")}";
|
|
62
62
|
|
|
63
63
|
class GeneratedEmailEnqueueUtil {
|
|
@@ -84,7 +84,7 @@ const serializeSequelizeIndexesArray = (indexes) => {
|
|
|
84
84
|
const SEQUELIZE_SCHEMA_CODE_TEMPLATE = (schema_name, table_name, model_name, migration_priority) => {
|
|
85
85
|
return `
|
|
86
86
|
import { DataTypes } from "sequelize";
|
|
87
|
-
import { SchemaDefinitionInterface } from "fiberx-backend-toolkit/
|
|
87
|
+
import { SchemaDefinitionInterface } from "fiberx-backend-toolkit/types/schema_type";
|
|
88
88
|
|
|
89
89
|
const ${schema_name}: SchemaDefinitionInterface = {
|
|
90
90
|
connection_name: "default",
|
|
@@ -132,7 +132,7 @@ const SEQUELIZE_CREATE_NEW_SCHEMA_MIGRATION_FILE_CODE_TEMPLATE = (schema_table_n
|
|
|
132
132
|
const rendered_indexes = serializeSequelizeIndexesArray(schema_definition.indexes || []);
|
|
133
133
|
return `
|
|
134
134
|
import { QueryInterface, Sequelize, DataTypes } from "sequelize";
|
|
135
|
-
import { LoggerUtil } from "fiberx-backend-toolkit/
|
|
135
|
+
import { LoggerUtil } from "fiberx-backend-toolkit/utils";
|
|
136
136
|
|
|
137
137
|
class Create${schema_model_name}TableMigration {
|
|
138
138
|
private name: string = "create_table_${schema_table_name}_migration_file";
|
|
@@ -190,7 +190,7 @@ exports.SEQUELIZE_CREATE_NEW_SCHEMA_MIGRATION_FILE_CODE_TEMPLATE = SEQUELIZE_CRE
|
|
|
190
190
|
const SEQUELIZE_UPDATE_EXISTING_SCHEMA_MIGRATION_FILE_CODE_TEMPLATE = (table_name, model_name, diff, current_schema, previous_schema) => {
|
|
191
191
|
return `
|
|
192
192
|
import { QueryInterface, Sequelize, DataTypes } from "sequelize";
|
|
193
|
-
import { LoggerUtil } from "fiberx-backend-toolkit/
|
|
193
|
+
import { LoggerUtil } from "fiberx-backend-toolkit/utils";
|
|
194
194
|
|
|
195
195
|
class Update${model_name}TableMigration {
|
|
196
196
|
private readonly name: string = "update_table_${table_name}_migration_file";
|
|
@@ -517,7 +517,7 @@ const SEQUELIZE_MODELS_INDEX_CODE_TEMPLATE = (model_names, imports) => {
|
|
|
517
517
|
const export_initialized = model_names.map((m) => ` ${m}: ${m}Model`).join(",\n");
|
|
518
518
|
const export_raw = model_names.join(",\n ");
|
|
519
519
|
return `
|
|
520
|
-
import { SequelizeConnector } from "fiberx-backend-toolkit/
|
|
520
|
+
import { SequelizeConnector } from "fiberx-backend-toolkit/database";
|
|
521
521
|
${imports}
|
|
522
522
|
|
|
523
523
|
const seqelize_connector = SequelizeConnector.getInstance();
|
|
@@ -66,7 +66,7 @@ class MigrationRunnerScript {
|
|
|
66
66
|
async getAppliedMigrations() {
|
|
67
67
|
const sequelize = await this.getSequelizeInstance();
|
|
68
68
|
const queryInterface = sequelize.getQueryInterface();
|
|
69
|
-
const table_name = queryInterface
|
|
69
|
+
const table_name = queryInterface?.quoteTable(constants_1.SEQUELIZE_META_TABLE_NAME) ?? constants_1.SEQUELIZE_META_TABLE_NAME;
|
|
70
70
|
const column_name = queryInterface.quoteIdentifier("name");
|
|
71
71
|
const results = await sequelize.query(`SELECT ${column_name} FROM ${table_name};`, { type: sequelize_1.QueryTypes.SELECT });
|
|
72
72
|
return results.map((row) => row.name);
|
|
@@ -62,7 +62,7 @@ class SeederRunnerScript {
|
|
|
62
62
|
async getAppliedSeeders() {
|
|
63
63
|
const sequelize = await this.getSequelizeInstance();
|
|
64
64
|
const queryInterface = sequelize.getQueryInterface();
|
|
65
|
-
const table_name = queryInterface
|
|
65
|
+
const table_name = queryInterface?.quoteTable(constants_1.SEQUELIZE_SEEDER_META_TABLE_NAME) ?? constants_1.SEQUELIZE_SEEDER_META_TABLE_NAME;
|
|
66
66
|
const column_name = queryInterface.quoteIdentifier("name");
|
|
67
67
|
const results = await sequelize.query(`SELECT ${column_name} FROM ${table_name};`, { type: sequelize_1.QueryTypes.SELECT });
|
|
68
68
|
return results.map((row) => row.name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fiberx-backend-toolkit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A TypeScript backend toolkit providing shared domain logic, infrastructure helpers, and utilities for FiberX server-side applications and services.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./dist/index.js",
|