@domain.js/main 0.4.24 → 0.5.2

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.
@@ -203,7 +203,7 @@ function Utils(cnf, deps) {
203
203
  const RELATIVE_RANGE_ERROR = errors.notAllowed(`相对时间跨度最多 ${RELATIVE_MAX_RANGE} 天`);
204
204
  // findOptFilter 的处理
205
205
  // eslint-disable-next-line complexity
206
- const findOptFilter = (params, name, where, col = name) => {
206
+ const findOptFilter = (params, name, where, modelAlias4Ins, col = name) => {
207
207
  let value;
208
208
  if (!params)
209
209
  return;
@@ -334,14 +334,14 @@ function Utils(cnf, deps) {
334
334
  if (_.isString(params[`${name}_ins`]) || _.isNumber(params[`${name}_ins`])) {
335
335
  if (!where[sequelize_1.Op.and])
336
336
  where[sequelize_1.Op.and] = [];
337
- where[sequelize_1.Op.and].push(sequelize_1.Sequelize.where(sequelize_1.Sequelize.fn("FIND_IN_SET", params[`${name}_ins`], sequelize_1.Sequelize.col(name)), sequelize_1.Op.gte, 1));
337
+ where[sequelize_1.Op.and].push(sequelize_1.Sequelize.where(sequelize_1.Sequelize.fn("FIND_IN_SET", params[`${name}_ins`], sequelize_1.Sequelize.col(`${modelAlias4Ins}.${col}`)), sequelize_1.Op.gte, 1));
338
338
  }
339
339
  // 处理 find_in_set 方式的过滤 _ins_and
340
340
  if (_.isString(params[`${name}_ins_and`])) {
341
341
  if (!where[sequelize_1.Op.and])
342
342
  where[sequelize_1.Op.and] = [];
343
343
  for (const v of params[`${name}_ins_and`].split(",")) {
344
- where[sequelize_1.Op.and].push(sequelize_1.Sequelize.where(sequelize_1.Sequelize.fn("FIND_IN_SET", v.trim(), sequelize_1.Sequelize.col(name)), sequelize_1.Op.gte, 1));
344
+ where[sequelize_1.Op.and].push(sequelize_1.Sequelize.where(sequelize_1.Sequelize.fn("FIND_IN_SET", v.trim(), sequelize_1.Sequelize.col(`${modelAlias4Ins}.${col}`)), sequelize_1.Op.gte, 1));
345
345
  }
346
346
  }
347
347
  // 处理 find_in_set 方式的过滤 _ins_or
@@ -349,7 +349,7 @@ function Utils(cnf, deps) {
349
349
  if (!where[sequelize_1.Op.and])
350
350
  where[sequelize_1.Op.and] = [];
351
351
  where[sequelize_1.Op.and].push({
352
- [sequelize_1.Op.or]: params[`${name}_ins_or`].split(",").map((v) => sequelize_1.Sequelize.where(sequelize_1.Sequelize.fn("FIND_IN_SET", v.trim(), sequelize_1.Sequelize.col(name)), sequelize_1.Op.gte, 1)),
352
+ [sequelize_1.Op.or]: params[`${name}_ins_or`].split(",").map((v) => sequelize_1.Sequelize.where(sequelize_1.Sequelize.fn("FIND_IN_SET", v.trim(), sequelize_1.Sequelize.col(`${modelAlias4Ins}.${col}`)), sequelize_1.Op.gte, 1)),
353
353
  });
354
354
  }
355
355
  // 处理 find_in_set 方式的过滤 _ins_not
@@ -357,7 +357,7 @@ function Utils(cnf, deps) {
357
357
  if (!where[sequelize_1.Op.and])
358
358
  where[sequelize_1.Op.and] = [];
359
359
  for (const v of params[`${name}_ins_not`].split(",")) {
360
- where[sequelize_1.Op.and].push(sequelize_1.Sequelize.where(sequelize_1.Sequelize.fn("FIND_IN_SET", v.trim(), sequelize_1.Sequelize.col(name)), sequelize_1.Op.lt, 1));
360
+ where[sequelize_1.Op.and].push(sequelize_1.Sequelize.where(sequelize_1.Sequelize.fn("FIND_IN_SET", v.trim(), sequelize_1.Sequelize.col(`${modelAlias4Ins}.${col}`)), sequelize_1.Op.lt, 1));
361
361
  }
362
362
  }
363
363
  };
@@ -367,7 +367,7 @@ function Utils(cnf, deps) {
367
367
  const searchOrs = [];
368
368
  const includes = modelInclude(params, Model.includes);
369
369
  _.each(Model.filterAttrs || _.keys(Model.rawAttributes), (name) => {
370
- findOptFilter(params, name, where);
370
+ findOptFilter(params, name, where, Model.name);
371
371
  });
372
372
  if (!params._showDeleted) {
373
373
  if (Model.rawAttributes.isDeleted)
@@ -384,7 +384,7 @@ function Utils(cnf, deps) {
384
384
  const includeWhere = {};
385
385
  const filterAttrs = x.model.filterAttrs || _.keys(x.model.rawAttributes);
386
386
  _.each(filterAttrs, (name) => {
387
- findOptFilter(params, `${x.as}.${name}`, includeWhere, name);
387
+ findOptFilter(params, `${x.as}.${name}`, includeWhere, x.as, name);
388
388
  });
389
389
  if (!params._showDeleted) {
390
390
  if (x.model.rawAttributes.isDeleted) {
@@ -13,6 +13,7 @@ export declare type Client = Socket<DefaultEventsMap, DefaultEventsMap, DefaultE
13
13
  operator?: any;
14
14
  /** 退出房间回调函数 */
15
15
  quit?: Function;
16
+ entranceOpts?: any[];
16
17
  };
17
18
  declare const makeProfile: (client: Client, type: string | undefined, auth: string | Signature, extra?: Profile["extra"]) => Profile;
18
19
  export declare function BridgeSocket(io: Server, domain: Domain): void;
@@ -109,10 +109,12 @@ function BridgeSocket(io, domain) {
109
109
  console.error(e);
110
110
  }
111
111
  });
112
- client.on("entrance", async (roomId) => {
112
+ client.on("entrance", async (roomId, ...opts) => {
113
113
  try {
114
114
  if (!client.profile || !client.inited)
115
115
  return;
116
+ if (opts.length)
117
+ Object.assign(client, { entranceOpts: opts });
116
118
  const ret = await entrance({ ...client.profile, roomId }, client);
117
119
  client.profile.roomId = roomId;
118
120
  client.roomId = roomId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domain.js/main",
3
- "version": "0.4.24",
3
+ "version": "0.5.2",
4
4
  "description": "DDD framework",
5
5
  "main": "dist/index.js",
6
6
  "bin": {