baja-lite 1.3.26 → 1.3.28

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 (3) hide show
  1. package/package.json +2 -2
  2. package/sql.d.ts +10 -0
  3. package/sql.js +37 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baja-lite",
3
- "version": "1.3.26",
3
+ "version": "1.3.28",
4
4
  "description": "some util for self",
5
5
  "homepage": "https://github.com/void-soul/util-man",
6
6
  "repository": {
@@ -38,7 +38,7 @@
38
38
  "@msgpack/msgpack": "3.1.1",
39
39
  "@types/request-promise": "4.1.51",
40
40
  "axios": "1.8.4",
41
- "baja-lite-field": "1.3.21",
41
+ "baja-lite-field": "1.3.27",
42
42
  "decimal.js": "10.5.0",
43
43
  "html-parse-stringify": "3.0.1",
44
44
  "iterare": "1.2.1",
package/sql.d.ts CHANGED
@@ -1517,6 +1517,15 @@ declare class StreamQuery<T extends object> {
1517
1517
  skipEmptyString?: boolean | undefined;
1518
1518
  breakExcuteIfSkip?: boolean | undefined;
1519
1519
  }): this;
1520
+ in2(key: (keyof T)[], value: string | number, { paramName, breakExcuteIfSkip }?: {
1521
+ paramName?: string | undefined;
1522
+ breakExcuteIfSkip?: boolean | undefined;
1523
+ }): this;
1524
+ notIn2(key: (keyof T)[], value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1525
+ paramName?: string | undefined;
1526
+ skipEmptyString?: boolean | undefined;
1527
+ breakExcuteIfSkip?: boolean | undefined;
1528
+ }): this;
1520
1529
  isNULL(key: keyof T): this;
1521
1530
  isNotNULL(key: keyof T): this;
1522
1531
  between(key: keyof T, value1: string | number, value2: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
@@ -1710,6 +1719,7 @@ declare class StreamQuery<T extends object> {
1710
1719
  private _key;
1711
1720
  private _between;
1712
1721
  private _in;
1722
+ private _in2;
1713
1723
  private _shift;
1714
1724
  private _match;
1715
1725
  private _pow;
package/sql.js CHANGED
@@ -3464,6 +3464,8 @@ class StreamQuery {
3464
3464
  notPreciseGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._like(key, value, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfSkip, op: 'GLOB' }); }
3465
3465
  in(key, value, { paramName = '', breakExcuteIfSkip = false } = {}) { return this._in(key, value, { paramName, breakExcuteIfSkip }); }
3466
3466
  notIn(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._in(key, value, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfSkip }); }
3467
+ in2(key, value, { paramName = '', breakExcuteIfSkip = false } = {}) { return this._in2(key, value, { paramName, breakExcuteIfSkip }); }
3468
+ notIn2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._in2(key, value, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfSkip }); }
3467
3469
  isNULL(key) { return this._null(key); }
3468
3470
  isNotNULL(key) { return this._null(key, 'NOT'); }
3469
3471
  between(key, value1, value2, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._between(key, value1, value2, { paramName, skipEmptyString, breakExcuteIfSkip }); }
@@ -3833,6 +3835,9 @@ class StreamQuery {
3833
3835
  return this;
3834
3836
  }
3835
3837
  _in(key, value, { not = '', paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) {
3838
+ if (value && value.length > 0 && skipEmptyString === true) {
3839
+ value = value.filter(v => !emptyString(`${v ?? ''}`));
3840
+ }
3836
3841
  if (value && value.length > 0) {
3837
3842
  if (paramName !== undefined && this._paramKeys.hasOwnProperty(paramName)) {
3838
3843
  this._param[this._paramKeys[paramName]] = value;
@@ -3851,6 +3856,26 @@ class StreamQuery {
3851
3856
  }
3852
3857
  return this;
3853
3858
  }
3859
+ _in2(key, value, { not = '', paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) {
3860
+ const skip = emptyString(`${value ?? ''}`) && skipEmptyString === true;
3861
+ if (!skip) {
3862
+ if (paramName !== undefined && this._paramKeys.hasOwnProperty(paramName)) {
3863
+ this._param[this._paramKeys[paramName]] = value;
3864
+ }
3865
+ else {
3866
+ const pkey = `p${this._prefix}${this._index++}`;
3867
+ this._wheres.push(`AND :${pkey} ${not} IN (${key.map(k => this[_fields][String(k)]?.C2()).join(',')}) `);
3868
+ this._param[pkey] = value;
3869
+ if (paramName) {
3870
+ this._paramKeys[paramName] = pkey;
3871
+ }
3872
+ }
3873
+ }
3874
+ else if (breakExcuteIfSkip !== true) {
3875
+ this.if_exec = false;
3876
+ }
3877
+ return this;
3878
+ }
3854
3879
  _shift(key1, key2, value, op, { not = '', paramName = '', breakExcuteIfSkip = false } = {}) {
3855
3880
  if (value === null
3856
3881
  || value === undefined
@@ -4184,6 +4209,18 @@ __decorate([
4184
4209
  __metadata("design:paramtypes", [Object, Array, Object]),
4185
4210
  __metadata("design:returntype", void 0)
4186
4211
  ], StreamQuery.prototype, "notIn", null);
4212
+ __decorate([
4213
+ IF_PROCEED(),
4214
+ __metadata("design:type", Function),
4215
+ __metadata("design:paramtypes", [Array, Object, Object]),
4216
+ __metadata("design:returntype", void 0)
4217
+ ], StreamQuery.prototype, "in2", null);
4218
+ __decorate([
4219
+ IF_PROCEED(),
4220
+ __metadata("design:type", Function),
4221
+ __metadata("design:paramtypes", [Array, Object, Object]),
4222
+ __metadata("design:returntype", void 0)
4223
+ ], StreamQuery.prototype, "notIn2", null);
4187
4224
  __decorate([
4188
4225
  IF_PROCEED(),
4189
4226
  __metadata("design:type", Function),