arkormx 2.12.7 → 2.12.8

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.
@@ -843,7 +843,8 @@ const loadRuntimeConfigSync = () => {
843
843
  for (const configPath of syncConfigPaths) {
844
844
  if (!existsSync$1(configPath)) continue;
845
845
  try {
846
- resolveAndApplyConfig(require(configPath));
846
+ const imported = require(configPath);
847
+ resolveAndApplyConfig(imported);
847
848
  return true;
848
849
  } catch {
849
850
  continue;
@@ -871,7 +872,8 @@ const loadArkormConfig = async () => {
871
872
  for (const configPath of configPaths) {
872
873
  if (!existsSync$1(configPath)) continue;
873
874
  try {
874
- resolveAndApplyConfig(await importConfigFile(configPath));
875
+ const imported = await importConfigFile(configPath);
876
+ resolveAndApplyConfig(imported);
875
877
  await awaitConfiguredModelsRegistration();
876
878
  return;
877
879
  } catch {
@@ -932,6 +934,8 @@ const getRuntimeAdapter = () => {
932
934
  * processes (the CLI) so the Node event loop drains and the process exits
933
935
  * promptly instead of hanging on pool idle timeouts. Teardown failures are
934
936
  * swallowed because the process is shutting down anyway.
937
+ *
938
+ * @returns
935
939
  */
936
940
  const disposeArkormRuntime = async () => {
937
941
  let adapterDisposed = false;
@@ -1386,7 +1390,8 @@ const expressionBuilder = {
1386
1390
  */
1387
1391
  const resolveGeneratedExpression = (expression) => {
1388
1392
  if (typeof expression === "string") return expression;
1389
- return expressionNodeToSql(expression(expressionBuilder).toExpressionNode());
1393
+ const built = expression(expressionBuilder);
1394
+ return expressionNodeToSql(built.toExpressionNode());
1390
1395
  };
1391
1396
  const quoteIdentifier = (name) => name.split(".").map((part) => `"${part.replace(/"/g, "\"\"")}"`).join(".");
1392
1397
  const quoteLiteral = (value) => {
@@ -2874,7 +2879,8 @@ const applyCreateTableOperation = (schema, operation) => {
2874
2879
  if (findModelBlock(schema, operation.table)) throw new ArkormException(`Prisma model for table [${operation.table}] already exists.`);
2875
2880
  const schemaWithEnums = ensureEnumBlocks(schema, operation.columns);
2876
2881
  const block = buildModelBlock(operation);
2877
- return applyInverseRelations(`${schemaWithEnums.trimEnd()}\n\n${block}\n`, toModelName(operation.table), operation.foreignKeys ?? [], operation.columns);
2882
+ const nextSchema = `${schemaWithEnums.trimEnd()}\n\n${block}\n`;
2883
+ return applyInverseRelations(nextSchema, toModelName(operation.table), operation.foreignKeys ?? [], operation.columns);
2878
2884
  };
2879
2885
  /**
2880
2886
  * Apply an alter table operation to a Prisma schema string, modifying the model
@@ -2887,7 +2893,8 @@ const applyCreateTableOperation = (schema, operation) => {
2887
2893
  const applyAlterTableOperation = (schema, operation) => {
2888
2894
  const model = findModelBlock(schema, operation.table);
2889
2895
  if (!model) throw new ArkormException(`Prisma model for table [${operation.table}] was not found.`);
2890
- const schemaWithEnums = ensureEnumBlocks(schema, [...operation.addColumns, ...operation.changeColumns ?? []]);
2896
+ const enumColumns = [...operation.addColumns, ...operation.changeColumns ?? []];
2897
+ const schemaWithEnums = ensureEnumBlocks(schema, enumColumns);
2891
2898
  const refreshedModel = findModelBlock(schemaWithEnums, operation.table);
2892
2899
  if (!refreshedModel) throw new ArkormException(`Prisma model for table [${operation.table}] was not found.`);
2893
2900
  let block = refreshedModel.block;
@@ -2939,7 +2946,8 @@ const applyAlterTableOperation = (schema, operation) => {
2939
2946
  injectLineIntoModelBody(bodyLines, relationLine, (line) => relationRegex.test(line));
2940
2947
  }
2941
2948
  block = bodyLines.join("\n");
2942
- return applyInverseRelations(`${schemaWithEnums.slice(0, refreshedModel.start)}${block}${schemaWithEnums.slice(refreshedModel.end)}`, model.modelName, operation.addForeignKeys ?? [], operation.addColumns);
2949
+ const nextSchema = `${schemaWithEnums.slice(0, refreshedModel.start)}${block}${schemaWithEnums.slice(refreshedModel.end)}`;
2950
+ return applyInverseRelations(nextSchema, model.modelName, operation.addForeignKeys ?? [], operation.addColumns);
2943
2951
  };
2944
2952
  /**
2945
2953
  * Apply a drop table operation to a Prisma schema string, removing the model block
@@ -3194,8 +3202,9 @@ const applyMigrationRollbackToPrismaSchema = async (migration, options = {}) =>
3194
3202
  */
3195
3203
  const runMigrationWithPrisma = async (migration, options = {}) => {
3196
3204
  const cwd = options.cwd ?? process.cwd();
3205
+ const schemaPath = options.schemaPath ?? join(cwd, "prisma", "schema.prisma");
3197
3206
  const applied = await applyMigrationToPrismaSchema(migration, {
3198
- schemaPath: options.schemaPath ?? join(cwd, "prisma", "schema.prisma"),
3207
+ schemaPath,
3199
3208
  write: options.write
3200
3209
  });
3201
3210
  const shouldGenerate = options.runGenerate ?? true;
@@ -3203,12 +3212,15 @@ const runMigrationWithPrisma = async (migration, options = {}) => {
3203
3212
  const mode = options.migrateMode ?? "dev";
3204
3213
  if (shouldGenerate) runPrismaCommand(["generate"], cwd);
3205
3214
  if (shouldMigrate) if (mode === "deploy") runPrismaCommand(["migrate", "deploy"], cwd);
3206
- else runPrismaCommand([
3207
- "migrate",
3208
- "dev",
3209
- "--name",
3210
- options.migrationName ?? `arkorm_${createMigrationTimestamp()}`
3211
- ], cwd);
3215
+ else {
3216
+ const migrationName = options.migrationName ?? `arkorm_${createMigrationTimestamp()}`;
3217
+ runPrismaCommand([
3218
+ "migrate",
3219
+ "dev",
3220
+ "--name",
3221
+ migrationName
3222
+ ], cwd);
3223
+ }
3212
3224
  return {
3213
3225
  schemaPath: applied.schemaPath,
3214
3226
  operations: applied.operations
@@ -3337,7 +3349,8 @@ const readPersistedColumnMappingsState = (filePath) => {
3337
3349
  return empty;
3338
3350
  }
3339
3351
  try {
3340
- const normalized = normalizePersistedColumnMappingsState(JSON.parse(readFileSync(filePath, "utf-8")));
3352
+ const parsed = JSON.parse(readFileSync(filePath, "utf-8"));
3353
+ const normalized = normalizePersistedColumnMappingsState(parsed);
3341
3354
  cachedColumnMappingsPath = filePath;
3342
3355
  cachedColumnMappingsState = normalized;
3343
3356
  return normalized;
@@ -6327,11 +6340,13 @@ var BelongsToManyRelation = class BelongsToManyRelation extends Relation {
6327
6340
  });
6328
6341
  decorated.paginate = (async (perPage = 15, page, options = {}) => {
6329
6342
  const paginator = await originalPaginate(perPage, page, options);
6330
- return new LengthAwarePaginator(this.attachPivotToResults(paginator.data, pivotRows), paginator.meta.total, paginator.meta.perPage, paginator.meta.currentPage, options);
6343
+ const data = this.attachPivotToResults(paginator.data, pivotRows);
6344
+ return new LengthAwarePaginator(data, paginator.meta.total, paginator.meta.perPage, paginator.meta.currentPage, options);
6331
6345
  });
6332
6346
  decorated.simplePaginate = (async (perPage = 15, page, options = {}) => {
6333
6347
  const paginator = await originalSimplePaginate(perPage, page, options);
6334
- return new Paginator(this.attachPivotToResults(paginator.data, pivotRows), paginator.meta.perPage, paginator.meta.currentPage, paginator.meta.hasMorePages, options);
6348
+ const data = this.attachPivotToResults(paginator.data, pivotRows);
6349
+ return new Paginator(data, paginator.meta.perPage, paginator.meta.currentPage, paginator.meta.hasMorePages, options);
6335
6350
  });
6336
6351
  decorated.clone = (() => {
6337
6352
  return this.decorateQueryBuilder(originalClone(), pivotRows);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arkormx",
3
- "version": "2.12.7",
3
+ "version": "2.12.8",
4
4
  "description": "Modern TypeScript-first ORM for Node.js.",
5
5
  "keywords": [
6
6
  "orm",
@@ -66,7 +66,7 @@
66
66
  "eslint": "^10.3.0",
67
67
  "prisma": "^7.6.0",
68
68
  "reflect-metadata": "^0.2.2",
69
- "tsdown": "^0.22.0",
69
+ "tsdown": "^0.22.2",
70
70
  "typescript": "^6.0.0",
71
71
  "typescript-eslint": "^8.59.2",
72
72
  "unplugin-swc": "^1.5.9",
@@ -78,13 +78,13 @@
78
78
  "vitest": "^4.1.8"
79
79
  },
80
80
  "engines": {
81
- "node": ">=20.0.0"
81
+ "node": ">=22.0.0"
82
82
  },
83
83
  "dependencies": {
84
84
  "@h3ravel/collect.js": "^5.4.0",
85
- "@h3ravel/musket": "^2.2.2",
86
- "@h3ravel/shared": "^2.2.1",
87
- "@h3ravel/support": "^2.2.1",
85
+ "@h3ravel/musket": "^2.2.13",
86
+ "@h3ravel/shared": "^2.2.7",
87
+ "@h3ravel/support": "^2.2.7",
88
88
  "dotenv": "^17.3.1",
89
89
  "jiti": "^2.7.0",
90
90
  "kysely": "^0.28.15",