vona-module-a-version 5.0.44 → 5.0.46

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.
Files changed (2) hide show
  1. package/dist/index.js +7 -17
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { BeanInfo, $Class, BeanBase, BeanScopeBase } from 'vona';
2
- import { Api, v } from 'vona-module-a-openapi';
2
+ import { Api, v } from 'vona-module-a-openapiutils';
3
3
  import { Entity, EntityBaseSimple, Model, BeanModelBase } from 'vona-module-a-orm';
4
4
  import chalk from 'chalk';
5
- import moment from 'moment';
5
+ import { DateTime } from 'luxon';
6
6
  import { Service, Scope } from 'vona-module-a-bean';
7
7
  import { Event, BeanEventBase } from 'vona-module-a-event';
8
8
  import fse from 'fs-extra';
@@ -124,7 +124,7 @@ let ModelViewRecord = (_dec$8 = Model({
124
124
 
125
125
  var _dec$7, _dec2$7, _class$7;
126
126
  const __separator = '-';
127
- const __timeFormat = `YYYYMMDD${__separator}HHmmss`;
127
+ const __timeFormat = `yyyyMMdd${__separator}HHmmss`;
128
128
  let ServiceDatabase = (_dec$7 = Service(), _dec2$7 = BeanInfo({
129
129
  module: "a-version"
130
130
  }), _dec$7(_class$7 = _dec2$7(_class$7 = class ServiceDatabase extends BeanBase {
@@ -150,22 +150,12 @@ let ServiceDatabase = (_dec$7 = Service(), _dec2$7 = BeanInfo({
150
150
  }
151
151
  async __fetchDatabases(client, instanceName, configInstanceBase) {
152
152
  const databasePrefix = this.getDatabasePrefix(instanceName, configInstanceBase);
153
- // dbs
154
- let dbs = await client.connection.schema.fetchDatabases(databasePrefix);
155
- // filter
156
- dbs = dbs.filter(db => {
157
- const _time = db.name.substring(databasePrefix.length);
158
- return _time.length === __timeFormat.length;
159
- });
160
- // ok
161
- return dbs;
153
+ return await client.connection.schema.fetchDatabases(databasePrefix);
162
154
  }
163
155
  async __createDatabase(client, instanceName, configInstanceBase) {
164
156
  const databasePrefix = this.getDatabasePrefix(instanceName, configInstanceBase);
165
- // create
166
- const databaseName = `${databasePrefix}${moment().format(__timeFormat)}`;
167
- await client.connection.schema.createDatabase(databaseName);
168
- return databaseName;
157
+ const databaseName = `${databasePrefix}${DateTime.now().toFormat(__timeFormat)}`;
158
+ return await client.connection.schema.createDatabase(databaseName);
169
159
  }
170
160
  async __prepareDatabases(versionStart) {
171
161
  // default
@@ -196,7 +186,7 @@ let ServiceDatabase = (_dec$7 = Service(), _dec2$7 = BeanInfo({
196
186
  const client = this.bean.database.current.client;
197
187
  // get current database name
198
188
  let databaseName = client.getDatabaseName();
199
- const isTestDatabase = databaseName.indexOf(databasePrefix) === 0;
189
+ const isTestDatabase = databaseName.includes(databasePrefix);
200
190
  // dev/debug db
201
191
  if (this.app.meta.isDev) {
202
192
  // if enable testDatabase
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vona-module-a-version",
3
3
  "type": "module",
4
- "version": "5.0.44",
4
+ "version": "5.0.46",
5
5
  "vonaModule": {
6
6
  "fileVersion": 1,
7
7
  "dependencies": {},