sasat 0.22.1 → 0.22.3

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.
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- const require_migrate = require("../migrate-Cc47Mufl.cjs");
2
+ const require_migrate = require("../migrate-BRNxkHCx.cjs");
3
3
  let node_fs = require("node:fs");
4
4
  node_fs = require_migrate.__toESM(node_fs, 1);
5
5
  let node_path = require("node:path");
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { A as writeYmlFile, C as Directory, E as defaultConf, O as mkDirIfNotExist, S as capitalizeFirstLetter, T as config, _ as Console, a as getDbClient, f as getMigrationFileNames, g as defaultGQLOption, h as columnTypeToGqlPrimitive, i as compileMigrationFiles, k as writeCurrentSchema, l as defaultColumnOption, n as DataStoreHandler, p as CodeGen_v2, r as createCurrentMigrationDataStore, t as migrate, u as SqlString, w as DBColumnTypes, x as camelize } from "../migrate-DfAkhVPb.mjs";
2
+ import { A as writeYmlFile, C as Directory, E as defaultConf, O as mkDirIfNotExist, S as capitalizeFirstLetter, T as config, _ as Console, a as getDbClient, f as getMigrationFileNames, g as defaultGQLOption, h as columnTypeToGqlPrimitive, i as compileMigrationFiles, k as writeCurrentSchema, l as defaultColumnOption, n as DataStoreHandler, p as CodeGen_v2, r as createCurrentMigrationDataStore, t as migrate, u as SqlString, w as DBColumnTypes, x as camelize } from "../migrate-Cbj2OVbY.mjs";
3
3
  import * as fs$1 from "node:fs";
4
4
  import fs from "node:fs";
5
5
  import path, { join } from "node:path";
package/dist/index.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_migrate = require("./migrate-Cc47Mufl.cjs");
2
+ const require_migrate = require("./migrate-BRNxkHCx.cjs");
3
3
  let sqlstring = require("sqlstring");
4
4
  sqlstring = require_migrate.__toESM(sqlstring, 1);
5
5
  let mysql2_promise = require("mysql2/promise");
package/dist/index.d.cts CHANGED
@@ -290,7 +290,7 @@ type MakeConditionArg<Context = unknown, Entity = unknown> = {
290
290
  parent: Partial<Entity>;
291
291
  parentTableAlias?: undefined;
292
292
  });
293
- type MakeCondition<Context, Entity = unknown> = (arg: MakeConditionArg<Context, Entity>) => BooleanValueExpression;
293
+ type MakeCondition<Context, Entity = any> = (arg: MakeConditionArg<Context, Entity>) => BooleanValueExpression;
294
294
  type RelationInfo<Context = unknown> = {
295
295
  table: string;
296
296
  condition: MakeCondition<Context>;
@@ -346,7 +346,7 @@ type QueryOptions = {
346
346
  };
347
347
  declare abstract class SasatDBDatasource<Entity extends EntityType, Identifiable extends object, Creatable extends EntityType, Updatable extends Identifiable, EntityFields extends Fields<Entity>, QueryResult extends Partial<Entity> & Identifiable> implements Repository<Entity, Identifiable, Creatable, Updatable> {
348
348
  protected client: SQLExecutor;
349
- protected abstract relationMap: RelationMap<unknown>;
349
+ protected abstract relationMap: RelationMap<any>;
350
350
  protected abstract tableInfo: TableInfo;
351
351
  abstract readonly tableName: string;
352
352
  abstract readonly fields: string[];
@@ -378,7 +378,7 @@ declare abstract class SasatDBDatasource<Entity extends EntityType, Identifiable
378
378
  private executeQuery;
379
379
  private createIdentifiableExpression;
380
380
  getRelationMap(): {
381
- [to: string]: RelationInfo<unknown>;
381
+ [to: string]: RelationInfo<any>;
382
382
  };
383
383
  protected fieldToColumn(fields: string[]): string[];
384
384
  }
@@ -1170,7 +1170,7 @@ declare const Sql: {
1170
1170
  };
1171
1171
  //#endregion
1172
1172
  //#region src/runtime/gqlResolveInfoToField.d.ts
1173
- declare const gqlResolveInfoToField: <T extends Fields<unknown> = Fields<unknown>>(info: GraphQLResolveInfo) => T;
1173
+ declare const gqlResolveInfoToField: <T extends Fields<any> = Fields<unknown>>(info: GraphQLResolveInfo) => T;
1174
1174
  //#endregion
1175
1175
  //#region src/runtime/id.d.ts
1176
1176
  type NumberIdEncoder = {
package/dist/index.d.mts CHANGED
@@ -290,7 +290,7 @@ type MakeConditionArg<Context = unknown, Entity = unknown> = {
290
290
  parent: Partial<Entity>;
291
291
  parentTableAlias?: undefined;
292
292
  });
293
- type MakeCondition<Context, Entity = unknown> = (arg: MakeConditionArg<Context, Entity>) => BooleanValueExpression;
293
+ type MakeCondition<Context, Entity = any> = (arg: MakeConditionArg<Context, Entity>) => BooleanValueExpression;
294
294
  type RelationInfo<Context = unknown> = {
295
295
  table: string;
296
296
  condition: MakeCondition<Context>;
@@ -346,7 +346,7 @@ type QueryOptions = {
346
346
  };
347
347
  declare abstract class SasatDBDatasource<Entity extends EntityType, Identifiable extends object, Creatable extends EntityType, Updatable extends Identifiable, EntityFields extends Fields<Entity>, QueryResult extends Partial<Entity> & Identifiable> implements Repository<Entity, Identifiable, Creatable, Updatable> {
348
348
  protected client: SQLExecutor;
349
- protected abstract relationMap: RelationMap<unknown>;
349
+ protected abstract relationMap: RelationMap<any>;
350
350
  protected abstract tableInfo: TableInfo;
351
351
  abstract readonly tableName: string;
352
352
  abstract readonly fields: string[];
@@ -378,7 +378,7 @@ declare abstract class SasatDBDatasource<Entity extends EntityType, Identifiable
378
378
  private executeQuery;
379
379
  private createIdentifiableExpression;
380
380
  getRelationMap(): {
381
- [to: string]: RelationInfo<unknown>;
381
+ [to: string]: RelationInfo<any>;
382
382
  };
383
383
  protected fieldToColumn(fields: string[]): string[];
384
384
  }
@@ -1170,7 +1170,7 @@ declare const Sql: {
1170
1170
  };
1171
1171
  //#endregion
1172
1172
  //#region src/runtime/gqlResolveInfoToField.d.ts
1173
- declare const gqlResolveInfoToField: <T extends Fields<unknown> = Fields<unknown>>(info: GraphQLResolveInfo) => T;
1173
+ declare const gqlResolveInfoToField: <T extends Fields<any> = Fields<unknown>>(info: GraphQLResolveInfo) => T;
1174
1174
  //#endregion
1175
1175
  //#region src/runtime/id.d.ts
1176
1176
  type NumberIdEncoder = {
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { D as setConfig, a as getDbClient, b as unique, c as formatQuery, d as SasatError, j as assignDeep, m as Conditions, o as MySqlTransaction, s as DBClient, t as migrate, u as SqlString, v as nonNullable, y as pick } from "./migrate-DfAkhVPb.mjs";
1
+ import { D as setConfig, a as getDbClient, b as unique, c as formatQuery, d as SasatError, j as assignDeep, m as Conditions, o as MySqlTransaction, s as DBClient, t as migrate, u as SqlString, v as nonNullable, y as pick } from "./migrate-Cbj2OVbY.mjs";
2
2
  import * as SqlString$1 from "sqlstring";
3
3
  import { createConnection } from "mysql2/promise";
4
4
  //#region src/db/connectors/mysql/client.ts
@@ -55,7 +55,7 @@ const assignDeep = (base, ...objects) => {
55
55
  //#region src/util/fsUtil.ts
56
56
  const readYmlFile = (filepath) => js_yaml.default.load((0, node_fs.readFileSync)(filepath, "utf8"));
57
57
  const mkDirIfNotExist = (path) => {
58
- if (!(0, node_fs.existsSync)(path)) (0, node_fs.mkdirSync)(path);
58
+ if (!(0, node_fs.existsSync)(path)) (0, node_fs.mkdirSync)(path, { recursive: true });
59
59
  };
60
60
  const writeFileIfNotExist = (path, data) => {
61
61
  if ((0, node_fs.existsSync)(path)) return Promise.resolve();
@@ -144,7 +144,10 @@ async function emptyDir(dir) {
144
144
  try {
145
145
  items = await (0, node_fs_promises.readdir)(dir);
146
146
  } catch {
147
- return (0, node_fs_promises.mkdir)(dir, { mode: 511 });
147
+ return (0, node_fs_promises.mkdir)(dir, {
148
+ mode: 511,
149
+ recursive: true
150
+ });
148
151
  }
149
152
  return Promise.all(items.map((item) => (0, node_fs_promises.rm)(node_path.default.join(dir, item), {
150
153
  recursive: true,
@@ -3907,20 +3910,14 @@ const runMigration = async (client, store, migrationName, direction, options) =>
3907
3910
  var MigrationController = class {
3908
3911
  async migrate(client, options) {
3909
3912
  const fileNames = getMigrationFileNames();
3910
- console.log(4, options);
3911
3913
  const currentMigration = await getCurrentMigration(options);
3912
3914
  if (!options.silent) Console.log("--current migration--: " + currentMigration);
3913
- console.log(2);
3914
3915
  let store = await createCurrentMigrationDataStore(currentMigration);
3915
3916
  if (store.getUpdateConfig()) setConfig(store.getUpdateConfig());
3916
- console.log(1);
3917
3917
  const target = getMigrationTargets(fileNames, currentMigration);
3918
- console.log(2);
3919
3918
  for (const tsFileName of target.files) {
3920
3919
  if (!options.silent) Console.log("---------\n" + tsFileName);
3921
- console.log(3, tsFileName);
3922
3920
  store = await readMigration(store, tsFileName, target.direction);
3923
- console.log(4);
3924
3921
  await runMigration(client, store, tsFileName, target.direction, options);
3925
3922
  store.resetQueue();
3926
3923
  }
@@ -28,7 +28,7 @@ const assignDeep = (base, ...objects) => {
28
28
  //#region src/util/fsUtil.ts
29
29
  const readYmlFile = (filepath) => yaml.load(readFileSync(filepath, "utf8"));
30
30
  const mkDirIfNotExist = (path) => {
31
- if (!existsSync(path)) mkdirSync(path);
31
+ if (!existsSync(path)) mkdirSync(path, { recursive: true });
32
32
  };
33
33
  const writeFileIfNotExist = (path, data) => {
34
34
  if (existsSync(path)) return Promise.resolve();
@@ -117,7 +117,10 @@ async function emptyDir(dir) {
117
117
  try {
118
118
  items = await readdir(dir);
119
119
  } catch {
120
- return mkdir(dir, { mode: 511 });
120
+ return mkdir(dir, {
121
+ mode: 511,
122
+ recursive: true
123
+ });
121
124
  }
122
125
  return Promise.all(items.map((item) => rm(path.join(dir, item), {
123
126
  recursive: true,
@@ -3880,20 +3883,14 @@ const runMigration = async (client, store, migrationName, direction, options) =>
3880
3883
  var MigrationController = class {
3881
3884
  async migrate(client, options) {
3882
3885
  const fileNames = getMigrationFileNames();
3883
- console.log(4, options);
3884
3886
  const currentMigration = await getCurrentMigration(options);
3885
3887
  if (!options.silent) Console.log("--current migration--: " + currentMigration);
3886
- console.log(2);
3887
3888
  let store = await createCurrentMigrationDataStore(currentMigration);
3888
3889
  if (store.getUpdateConfig()) setConfig(store.getUpdateConfig());
3889
- console.log(1);
3890
3890
  const target = getMigrationTargets(fileNames, currentMigration);
3891
- console.log(2);
3892
3891
  for (const tsFileName of target.files) {
3893
3892
  if (!options.silent) Console.log("---------\n" + tsFileName);
3894
- console.log(3, tsFileName);
3895
3893
  store = await readMigration(store, tsFileName, target.direction);
3896
- console.log(4);
3897
3894
  await runMigration(client, store, tsFileName, target.direction, options);
3898
3895
  store.resetQueue();
3899
3896
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sasat",
3
- "version": "0.22.1",
3
+ "version": "0.22.3",
4
4
  "repository": "https://github.com/nin138/sasat.git",
5
5
  "author": "nin138 <ninian138@gmail.com>",
6
6
  "license": "MIT",