sasat 0.20.0 → 0.20.1

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.
package/dist/cli/cli.cjs CHANGED
@@ -4,7 +4,7 @@
4
4
  const cac = require('cac');
5
5
  const fs = require('fs');
6
6
  const path = require('path');
7
- const error = require('../shared/sasat.850e110a.cjs');
7
+ const error = require('../shared/sasat.64d247b2.cjs');
8
8
  require('pluralize');
9
9
  const chalk = require('chalk');
10
10
  const console$1 = require('console');
@@ -3483,6 +3483,12 @@ const makeThrowExpressions = (condition) => {
3483
3483
  ...condition.right.kind === "range" ? makeJoinRangeConditionThrowExpressions(condition.right) : []
3484
3484
  ];
3485
3485
  }
3486
+ if (condition.operator === "IN") {
3487
+ return [
3488
+ makeJoinConditionThrowExpressions(condition.left),
3489
+ ...condition.right.map(makeJoinConditionThrowExpressions)
3490
+ ];
3491
+ }
3486
3492
  return [
3487
3493
  makeJoinConditionThrowExpressions(condition.left),
3488
3494
  makeJoinConditionThrowExpressions(condition.right)
@@ -3537,6 +3543,15 @@ const makeConditionExpr = (entity, condition) => {
3537
3543
  ...makeRangeCondition(entity, condition.right)
3538
3544
  );
3539
3545
  }
3546
+ if (condition.operator === "IN") {
3547
+ return qExpr.property("comparison").call(
3548
+ makeJoinConditionValueQExpr(entity, condition.left),
3549
+ tsg.string(condition.operator),
3550
+ tsg.array(
3551
+ condition.right.map((it) => makeJoinConditionValueQExpr(entity, it))
3552
+ )
3553
+ );
3554
+ }
3540
3555
  return qExpr.property("comparison").call(
3541
3556
  makeJoinConditionValueQExpr(entity, condition.left),
3542
3557
  tsg.string(condition.operator),
@@ -3570,6 +3585,12 @@ const getConditionChildColumnNames = (getConditionValue) => (c) => {
3570
3585
  if (c.kind === "custom")
3571
3586
  return c.childRequiredFields || [];
3572
3587
  const result = [getConditionValue(c.left)];
3588
+ if (c.operator === "IN") {
3589
+ result.push(getConditionValue(c.left));
3590
+ c.right.forEach((it) => {
3591
+ result.push(getConditionValue(it));
3592
+ });
3593
+ }
3573
3594
  if (c.operator !== "BETWEEN") {
3574
3595
  result.push(getConditionValue(c.right));
3575
3596
  } else {
@@ -4750,6 +4771,12 @@ const reverseConditionNode = (condition) => {
4750
4771
  reverseRangeCondition(condition.right)
4751
4772
  );
4752
4773
  }
4774
+ if (condition.operator === "IN") {
4775
+ return error.Conditions.rel.in(
4776
+ reverseConditionValue(condition.left),
4777
+ condition.right.map(reverseConditionValue)
4778
+ );
4779
+ }
4753
4780
  return error.Conditions.rel.comparison(
4754
4781
  reverseConditionValue(condition.right),
4755
4782
  condition.operator,
package/dist/cli/cli.mjs CHANGED
@@ -4,7 +4,7 @@ import * as fs from 'fs';
4
4
  import fs__default from 'fs';
5
5
  import * as path from 'path';
6
6
  import path__default, { join } from 'path';
7
- import { c as config, m as mkDirIfNotExist, S as SqlString, g as getDbClient, a as SasatError, r as readInitialSchema, n as nonNullable, u as unique, C as Conditions, w as writeFileIfNotExist, b as writeCurrentSchema, d as writeYmlFile, e as defaultConf } from '../shared/sasat.e820cbe5.mjs';
7
+ import { c as config, m as mkDirIfNotExist, S as SqlString, g as getDbClient, a as SasatError, r as readInitialSchema, n as nonNullable, u as unique, C as Conditions, w as writeFileIfNotExist, b as writeCurrentSchema, d as writeYmlFile, e as defaultConf } from '../shared/sasat.c6691258.mjs';
8
8
  import 'pluralize';
9
9
  import chalk from 'chalk';
10
10
  import * as console$1 from 'console';
@@ -3459,6 +3459,12 @@ const makeThrowExpressions = (condition) => {
3459
3459
  ...condition.right.kind === "range" ? makeJoinRangeConditionThrowExpressions(condition.right) : []
3460
3460
  ];
3461
3461
  }
3462
+ if (condition.operator === "IN") {
3463
+ return [
3464
+ makeJoinConditionThrowExpressions(condition.left),
3465
+ ...condition.right.map(makeJoinConditionThrowExpressions)
3466
+ ];
3467
+ }
3462
3468
  return [
3463
3469
  makeJoinConditionThrowExpressions(condition.left),
3464
3470
  makeJoinConditionThrowExpressions(condition.right)
@@ -3513,6 +3519,15 @@ const makeConditionExpr = (entity, condition) => {
3513
3519
  ...makeRangeCondition(entity, condition.right)
3514
3520
  );
3515
3521
  }
3522
+ if (condition.operator === "IN") {
3523
+ return qExpr.property("comparison").call(
3524
+ makeJoinConditionValueQExpr(entity, condition.left),
3525
+ tsg.string(condition.operator),
3526
+ tsg.array(
3527
+ condition.right.map((it) => makeJoinConditionValueQExpr(entity, it))
3528
+ )
3529
+ );
3530
+ }
3516
3531
  return qExpr.property("comparison").call(
3517
3532
  makeJoinConditionValueQExpr(entity, condition.left),
3518
3533
  tsg.string(condition.operator),
@@ -3546,6 +3561,12 @@ const getConditionChildColumnNames = (getConditionValue) => (c) => {
3546
3561
  if (c.kind === "custom")
3547
3562
  return c.childRequiredFields || [];
3548
3563
  const result = [getConditionValue(c.left)];
3564
+ if (c.operator === "IN") {
3565
+ result.push(getConditionValue(c.left));
3566
+ c.right.forEach((it) => {
3567
+ result.push(getConditionValue(it));
3568
+ });
3569
+ }
3549
3570
  if (c.operator !== "BETWEEN") {
3550
3571
  result.push(getConditionValue(c.right));
3551
3572
  } else {
@@ -4726,6 +4747,12 @@ const reverseConditionNode = (condition) => {
4726
4747
  reverseRangeCondition(condition.right)
4727
4748
  );
4728
4749
  }
4750
+ if (condition.operator === "IN") {
4751
+ return Conditions.rel.in(
4752
+ reverseConditionValue(condition.left),
4753
+ condition.right.map(reverseConditionValue)
4754
+ );
4755
+ }
4729
4756
  return Conditions.rel.comparison(
4730
4757
  reverseConditionValue(condition.right),
4731
4758
  condition.operator,
package/dist/index.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const nodeToSql_js = require('runtime/dsl/query/sql/nodeToSql.js');
4
4
  const sqlString_js = require('runtime/sql/sqlString.js');
5
- const error = require('./shared/sasat.850e110a.cjs');
5
+ const error = require('./shared/sasat.64d247b2.cjs');
6
6
  const SqlString = require('sqlstring');
7
7
  require('mysql2');
8
8
  require('util');
package/dist/index.d.cts CHANGED
@@ -407,6 +407,11 @@ type JoinConditionNode = {
407
407
  left: JoinConditionValue;
408
408
  operator: 'BETWEEN';
409
409
  right: JoinConditionRangeValue;
410
+ } | {
411
+ kind: 'comparison';
412
+ left: JoinConditionValue;
413
+ operator: 'IN';
414
+ right: JoinConditionValue[];
410
415
  } | JoinCustomConditionNode;
411
416
  type JoinCustomConditionNode = {
412
417
  kind: 'custom';
@@ -609,6 +614,7 @@ declare const Conditions: {
609
614
  readonly rel: {
610
615
  readonly between: (left: JoinConditionValue, range: JoinConditionRangeValue) => JoinConditionNode;
611
616
  readonly comparison: (left: JoinConditionValue, operator: ComparisonOperators, right: JoinConditionValue) => JoinConditionNode;
617
+ readonly in: (left: JoinConditionValue, right: JoinConditionValue[]) => JoinConditionNode;
612
618
  };
613
619
  readonly query: {
614
620
  readonly between: (left: QueryConditionValue, begin: QueryConditionValue, end: QueryConditionValue) => QueryConditionNode;
package/dist/index.d.mts CHANGED
@@ -407,6 +407,11 @@ type JoinConditionNode = {
407
407
  left: JoinConditionValue;
408
408
  operator: 'BETWEEN';
409
409
  right: JoinConditionRangeValue;
410
+ } | {
411
+ kind: 'comparison';
412
+ left: JoinConditionValue;
413
+ operator: 'IN';
414
+ right: JoinConditionValue[];
410
415
  } | JoinCustomConditionNode;
411
416
  type JoinCustomConditionNode = {
412
417
  kind: 'custom';
@@ -609,6 +614,7 @@ declare const Conditions: {
609
614
  readonly rel: {
610
615
  readonly between: (left: JoinConditionValue, range: JoinConditionRangeValue) => JoinConditionNode;
611
616
  readonly comparison: (left: JoinConditionValue, operator: ComparisonOperators, right: JoinConditionValue) => JoinConditionNode;
617
+ readonly in: (left: JoinConditionValue, right: JoinConditionValue[]) => JoinConditionNode;
612
618
  };
613
619
  readonly query: {
614
620
  readonly between: (left: QueryConditionValue, begin: QueryConditionValue, end: QueryConditionValue) => QueryConditionNode;
package/dist/index.d.ts CHANGED
@@ -407,6 +407,11 @@ type JoinConditionNode = {
407
407
  left: JoinConditionValue;
408
408
  operator: 'BETWEEN';
409
409
  right: JoinConditionRangeValue;
410
+ } | {
411
+ kind: 'comparison';
412
+ left: JoinConditionValue;
413
+ operator: 'IN';
414
+ right: JoinConditionValue[];
410
415
  } | JoinCustomConditionNode;
411
416
  type JoinCustomConditionNode = {
412
417
  kind: 'custom';
@@ -609,6 +614,7 @@ declare const Conditions: {
609
614
  readonly rel: {
610
615
  readonly between: (left: JoinConditionValue, range: JoinConditionRangeValue) => JoinConditionNode;
611
616
  readonly comparison: (left: JoinConditionValue, operator: ComparisonOperators, right: JoinConditionValue) => JoinConditionNode;
617
+ readonly in: (left: JoinConditionValue, right: JoinConditionValue[]) => JoinConditionNode;
612
618
  };
613
619
  readonly query: {
614
620
  readonly between: (left: QueryConditionValue, begin: QueryConditionValue, end: QueryConditionValue) => QueryConditionNode;
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  export { Sql } from 'runtime/dsl/query/sql/nodeToSql.js';
2
2
  import { SqlString as SqlString$1 } from 'runtime/sql/sqlString.js';
3
3
  export { SqlString } from 'runtime/sql/sqlString.js';
4
- import { n as nonNullable, S as SqlString$2, u as unique, g as getDbClient, a as SasatError } from './shared/sasat.e820cbe5.mjs';
5
- export { C as Conditions, p as pick } from './shared/sasat.e820cbe5.mjs';
4
+ import { n as nonNullable, S as SqlString$2, u as unique, g as getDbClient, a as SasatError } from './shared/sasat.c6691258.mjs';
5
+ export { C as Conditions, p as pick } from './shared/sasat.c6691258.mjs';
6
6
  import * as SqlString from 'sqlstring';
7
7
  import 'mysql2';
8
8
  import 'util';
@@ -107,6 +107,12 @@ const comparisonRel = (left, operator, right) => ({
107
107
  right,
108
108
  operator
109
109
  });
110
+ const inRel = (left, right) => ({
111
+ kind: "comparison",
112
+ left,
113
+ right,
114
+ operator: "IN"
115
+ });
110
116
  const comparisonQuery = (left, operator, right) => ({
111
117
  kind: "comparison",
112
118
  left,
@@ -119,7 +125,8 @@ const Conditions = {
119
125
  custom,
120
126
  rel: {
121
127
  between: betweenRel,
122
- comparison: comparisonRel
128
+ comparison: comparisonRel,
129
+ in: inRel
123
130
  },
124
131
  query: {
125
132
  between: betweenQuery,
@@ -85,6 +85,12 @@ const comparisonRel = (left, operator, right) => ({
85
85
  right,
86
86
  operator
87
87
  });
88
+ const inRel = (left, right) => ({
89
+ kind: "comparison",
90
+ left,
91
+ right,
92
+ operator: "IN"
93
+ });
88
94
  const comparisonQuery = (left, operator, right) => ({
89
95
  kind: "comparison",
90
96
  left,
@@ -97,7 +103,8 @@ const Conditions = {
97
103
  custom,
98
104
  rel: {
99
105
  between: betweenRel,
100
- comparison: comparisonRel
106
+ comparison: comparisonRel,
107
+ in: inRel
101
108
  },
102
109
  query: {
103
110
  between: betweenQuery,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sasat",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "repository": "https://github.com/nin138/sasat.git",
5
5
  "author": "nin138 <ninian138@gmail.com>",
6
6
  "license": "MIT",