gridify-client 2.0.0-preview.3 → 2.0.0-preview.5

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/README.md CHANGED
@@ -8,14 +8,12 @@
8
8
  ![CodeQL](https://github.com/alirezanet/Gridify/actions/workflows/codeql.yml/badge.svg)
9
9
  [![Static Badge](https://img.shields.io/badge/fuget-f88445?logo=readme&logoColor=white)](https://www.fuget.org/packages/Gridify)
10
10
  [![Static Badge](https://img.shields.io/badge/Documentation-42bc00?logo=readme&logoColor=white)](https://alirezanet.github.io/Gridify/)
11
- [![Discord](https://img.shields.io/badge/Discord-Join%20our%20server-blue?style=flat-square&logo=discord)](https://discord.gg/jaSXnDMv)
12
11
 
13
12
 
14
-
15
-
16
- [![Gridify](https://raw.githubusercontent.com/alirezanet/Gridify/master/docs/.vuepress/public/gridify-readme-logo.svg)](https://alirezanet.github.io/Gridify/)
13
+ [![Gridify](https://raw.githubusercontent.com/alirezanet/Gridify/master/docs/pages/public/gridify-readme-logo.svg)](https://alirezanet.github.io/Gridify/)
17
14
 
18
15
  ## Introduction
16
+
19
17
  Gridify is a dynamic LINQ library that simplifies the process of converting strings to LINQ queries. With exceptional performance and ease-of-use, Gridify makes it effortless to apply filtering, sorting, and pagination using text-based data.
20
18
 
21
19
  ## Features
@@ -31,7 +29,8 @@ Gridify is a dynamic LINQ library that simplifies the process of converting stri
31
29
  - Compatible with ORMs, especially Entity Framework
32
30
  - Can be used on every collection that LINQ supports
33
31
  - Compatible with object-mappers like AutoMapper
34
- - Compatible with Elasticsearch 🔥🔥
32
+ - Compatible with Elasticsearch
33
+ - Javascript/Typescript client
35
34
 
36
35
  ## Documentation
37
36
 
@@ -54,6 +53,14 @@ Check out our docs at [https://alirezanet.github.io/Gridify/](https://alirezanet
54
53
 
55
54
  We welcome contributions! Feel free to send us a pull request. Check out our [Contribution Page](https://alirezanet.github.io/Gridify/contribution) for more information.
56
55
 
56
+ ## Contributors
57
+
58
+ Thank you to everyone who has contributed to the Gridify codebase. We appreciate you!
59
+
60
+ <a href="https://github.com/alirezanet/gridify/graphs/contributors">
61
+ <img src="https://contrib.rocks/image?repo=alirezanet/gridify" />
62
+ </a>
63
+
57
64
  ## License
58
65
 
59
66
  This project is licensed under the [MIT License](https://github.com/alirezanet/gridify/blob/master/LICENSE).
@@ -5,7 +5,7 @@ export declare enum ConditionalOperator {
5
5
  GreaterThan = ">",
6
6
  GreaterThanOrEqual = ">=",
7
7
  LessThanOrEqual = "<=",
8
- Contains = "*",
8
+ Contains = "=*",
9
9
  NotContains = "!*",
10
10
  StartsWith = "^",
11
11
  NotStartsWith = "!^",
@@ -1,6 +1,6 @@
1
1
  import { ConditionalOperator } from "./GridifyOperator";
2
- import IGridifyQuery from "./IGridifyQuery";
3
- declare class GridifyQueryBuilder {
2
+ import { IGridifyQuery } from "./IGridifyQuery";
3
+ export declare class GridifyQueryBuilder {
4
4
  private query;
5
5
  private filteringExpressions;
6
6
  setPage(page: number): GridifyQueryBuilder;
@@ -13,4 +13,3 @@ declare class GridifyQueryBuilder {
13
13
  or(): GridifyQueryBuilder;
14
14
  build(): IGridifyQuery;
15
15
  }
16
- export default GridifyQueryBuilder;
@@ -1,6 +1,12 @@
1
- export default interface IGridifyQuery {
2
- page?: number;
3
- pageSize?: number;
4
- orderBy?: string;
1
+ export interface IGridifyQuery extends IGridifyPagination, IGridifyFiltering, IGridifyOrdering {
2
+ }
3
+ export interface IGridifyFiltering {
5
4
  filter?: string;
6
5
  }
6
+ export interface IGridifyOrdering {
7
+ orderBy?: string;
8
+ }
9
+ export interface IGridifyPagination {
10
+ page: number;
11
+ pageSize: number;
12
+ }
@@ -0,0 +1,4 @@
1
+ export interface Paging<T> {
2
+ count: number;
3
+ data: T[];
4
+ }
package/dist/index.cjs.js CHANGED
@@ -1 +1,2 @@
1
- (()=>{"use strict";var r,e,t={d:(r,e)=>{for(var o in e)t.o(e,o)&&!t.o(r,o)&&Object.defineProperty(r,o,{enumerable:!0,get:e[o]})},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},o={};t.r(o),t.d(o,{ConditionalOperator:()=>r,GridifyQueryBuilder:()=>i,LogicalOperator:()=>e}),function(r){r.Equal="=",r.NotEqual="!=",r.LessThan="<",r.GreaterThan=">",r.GreaterThanOrEqual=">=",r.LessThanOrEqual="<=",r.Contains="*",r.NotContains="!*",r.StartsWith="^",r.NotStartsWith="!^",r.EndsWith="$",r.NotEndsWith="!$"}(r||(r={})),function(r){r.And=",",r.Or="|"}(e||(e={}));const i=class{constructor(){this.query={page:1,pageSize:20,orderBy:"",filter:""},this.filteringExpressions=[]}setPage(r){return this.query.page=r,this}setPageSize(r){return this.query.pageSize=r,this}addOrderBy(r,e=!1){const t=`${r.trim()} ${e?"desc":""}`.trim();return this.query.orderBy=this.query.orderBy?`${this.query.orderBy}, ${t}`:t,this}addCondition(r,e,t,o=!0,i=!0){let n=t;i&&"string"==typeof t&&(n=t.replace(/([(),|]|\/i)/g,"\\$1")),n=o?n.toString():`${n.toString()}/i`;var s=`${r.trim()}${e}${n}`;return this.filteringExpressions.push({value:s,type:"filter"}),this}startGroup(){return this.filteringExpressions.push({value:"(",type:"startGroup"}),this}endGroup(){return this.filteringExpressions.push({value:")",type:"endGroup"}),this}and(){return this.filteringExpressions.push({value:e.And,type:"op"}),this}or(){return this.filteringExpressions.push({value:e.Or,type:"op"}),this}build(){let r=null,e=0;if(this.filteringExpressions.forEach((t=>{if("startGroup"===t.type&&e++,"endGroup"===t.type&&e--,null===r&&"op"===t.type)throw new Error("expression cannot start with a logical operator");if("filter"===r&&"filter"===t.type)throw new Error("consecutive conditions are not allowed, consider adding a logical operator");if("op"===r&&"op"===t.type)throw new Error("consecutive operators are not allowed, consider adding a filter");if("startGroup"===r&&"op"===t.type)throw new Error("logical operator immediately after startGroup is not allowed");if("endGroup"===r&&"filter"===t.type)throw new Error("Missing logical operator after endGroup");if("startGroup"===r&&"endGroup"===t.type)throw new Error("Empty groups are not allowed");if("endGroup"===r&&"startGroup"===t.type)throw new Error("Missing a logical operator between groups");r=t.type,this.query.filter+=t.value})),0!=e)throw new Error("Group not properly closed");return this.query}};module.exports.GridifyClient=o})();
1
+ "use strict";var r,t;exports.ConditionalOperator=void 0,(r=exports.ConditionalOperator||(exports.ConditionalOperator={})).Equal="=",r.NotEqual="!=",r.LessThan="<",r.GreaterThan=">",r.GreaterThanOrEqual=">=",r.LessThanOrEqual="<=",r.Contains="=*",r.NotContains="!*",r.StartsWith="^",r.NotStartsWith="!^",r.EndsWith="$",r.NotEndsWith="!$",exports.LogicalOperator=void 0,(t=exports.LogicalOperator||(exports.LogicalOperator={})).And=",",t.Or="|";var o=function(){function r(){this.query={page:1,pageSize:20,orderBy:"",filter:""},this.filteringExpressions=[]}return r.prototype.setPage=function(r){return this.query.page=r,this},r.prototype.setPageSize=function(r){return this.query.pageSize=r,this},r.prototype.addOrderBy=function(r,t){void 0===t&&(t=!1);var o="".concat(r.trim()," ").concat(t?"desc":"").trim();return this.query.orderBy=this.query.orderBy?"".concat(this.query.orderBy,", ").concat(o):o,this},r.prototype.addCondition=function(r,t,o,e,i){void 0===e&&(e=!0),void 0===i&&(i=!0);var n=o;i&&"string"==typeof o&&(n=o.replace(/([(),|]|\/i)/g,"\\$1")),n=e?n.toString():"".concat(n.toString(),"/i");var p="".concat(r.trim()).concat(t).concat(n);return this.filteringExpressions.push({value:p,type:"filter"}),this},r.prototype.startGroup=function(){return this.filteringExpressions.push({value:"(",type:"startGroup"}),this},r.prototype.endGroup=function(){return this.filteringExpressions.push({value:")",type:"endGroup"}),this},r.prototype.and=function(){return this.filteringExpressions.push({value:exports.LogicalOperator.And,type:"op"}),this},r.prototype.or=function(){return this.filteringExpressions.push({value:exports.LogicalOperator.Or,type:"op"}),this},r.prototype.build=function(){var r=this,t=null,o=0;if(this.filteringExpressions.forEach((function(e){if("startGroup"===e.type&&o++,"endGroup"===e.type&&o--,null===t&&"op"===e.type)throw new Error("expression cannot start with a logical operator");if("filter"===t&&"filter"===e.type)throw new Error("consecutive conditions are not allowed, consider adding a logical operator");if("op"===t&&"op"===e.type)throw new Error("consecutive operators are not allowed, consider adding a filter");if("startGroup"===t&&"op"===e.type)throw new Error("logical operator immediately after startGroup is not allowed");if("endGroup"===t&&"filter"===e.type)throw new Error("Missing logical operator after endGroup");if("startGroup"===t&&"endGroup"===e.type)throw new Error("Empty groups are not allowed");if("endGroup"===t&&"startGroup"===e.type)throw new Error("Missing a logical operator between groups");t=e.type,r.query.filter+=e.value})),0!=o)throw new Error("Group not properly closed");return this.query},r}();exports.GridifyQueryBuilder=o;
2
+ //# sourceMappingURL=index.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs.js","sources":["../src/GridifyOperator.ts","../src/GridifyQueryBuilder.ts"],"sourcesContent":[null,null],"names":["ConditionalOperator","LogicalOperator","GridifyQueryBuilder","this","query","page","pageSize","orderBy","filter","filteringExpressions","prototype","setPage","setPageSize","addOrderBy","field","descending","concat","trim","addCondition","operator","value","caseSensitive","escapeValue","filterValue","replace","toString","filterExpression","push","type","startGroup","endGroup","and","And","or","Or","build","_this","previousType","groupCounter","forEach","exp","Error"],"mappings":"aAAA,IAAYA,EAeAC,EAfAD,QAaXA,yBAAA,GAbWA,EAAAA,8BAAAA,QAAAA,oBAaX,CAAA,IAZE,MAAA,IACAA,EAAA,SAAA,KACAA,EAAA,SAAA,IACAA,EAAA,YAAA,IACAA,EAAA,mBAAA,KACAA,EAAA,gBAAA,KACAA,EAAA,SAAA,KACAA,EAAA,YAAA,KACAA,EAAA,WAAA,IACAA,EAAA,cAAA,KACAA,EAAA,SAAA,IACAA,EAAA,YAAA,KAGSC,QAGXA,qBAAA,GAHWA,EAAAA,QAAeA,kBAAfA,wBAGX,CAAA,IAFE,IAAA,IACAA,EAAA,GAAA,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CAC5BP,MAAOnB,QAAeA,gBAAC+B,IACvBJ,KAAM,OAEFzB,MAGVD,EAAAQ,UAAAuB,GAAA,WAEG,OADA9B,KAAKM,qBAAqBkB,KAAK,CAAEP,MAAOnB,QAAeA,gBAACiC,GAAIN,KAAM,OAC3DzB,MAGVD,EAAAQ,UAAAyB,MAAA,WAAA,IA8DCC,EAAAjC,KA7DMkC,EACD,KACCC,EAAe,EAsDnB,GArDAnC,KAAKM,qBAAqB8B,SAAQ,SAACC,GAShC,GARiB,eAAbA,EAAIZ,MACLU,IAEc,aAAbE,EAAIZ,MACLU,IAIkB,OAAjBD,GAAsC,OAAbG,EAAIZ,KAC9B,MAAM,IAAIa,MAAM,mDAInB,GAAqB,WAAjBJ,GAA0C,WAAbG,EAAIZ,KAClC,MAAM,IAAIa,MACP,8EAKN,GAAqB,OAAjBJ,GAAsC,OAAbG,EAAIZ,KAC9B,MAAM,IAAIa,MACP,mEAKN,GAAqB,eAAjBJ,GAA8C,OAAbG,EAAIZ,KACtC,MAAM,IAAIa,MACP,gEAKN,GAAqB,aAAjBJ,GAA4C,WAAbG,EAAIZ,KACpC,MAAM,IAAIa,MAAM,2CAInB,GAAqB,eAAjBJ,GAA8C,aAAbG,EAAIZ,KACtC,MAAM,IAAIa,MAAM,gCAInB,GAAqB,aAAjBJ,GAA4C,eAAbG,EAAIZ,KACpC,MAAM,IAAIa,MAAM,6CAGnBJ,EAAeG,EAAIZ,KACnBQ,EAAKhC,MAAMI,QAAUgC,EAAIpB,KAC5B,IAEoB,GAAhBkB,EACD,MAAM,IAAIG,MAAM,6BAGnB,OAAOtC,KAAKC,OAEjBF,CAAD"}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- export { default as GridifyQueryBuilder } from './GridifyQueryBuilder';
2
- export type { default as IGridifyQuery } from './IGridifyQuery';
1
+ export * from './GridifyQueryBuilder';
3
2
  export * from './GridifyOperator';
3
+ export * from './IGridifyQuery';
4
+ export * from './IPaging';
package/dist/index.esm.js CHANGED
@@ -1 +1,2 @@
1
- var r,t,e={d:(r,t)=>{for(var o in t)e.o(t,o)&&!e.o(r,o)&&Object.defineProperty(r,o,{enumerable:!0,get:t[o]})},o:(r,t)=>Object.prototype.hasOwnProperty.call(r,t)},o={};e.d(o,{SQ:()=>r,Fw:()=>i,Fn:()=>t}),function(r){r.Equal="=",r.NotEqual="!=",r.LessThan="<",r.GreaterThan=">",r.GreaterThanOrEqual=">=",r.LessThanOrEqual="<=",r.Contains="*",r.NotContains="!*",r.StartsWith="^",r.NotStartsWith="!^",r.EndsWith="$",r.NotEndsWith="!$"}(r||(r={})),function(r){r.And=",",r.Or="|"}(t||(t={}));const i=class{constructor(){this.query={page:1,pageSize:20,orderBy:"",filter:""},this.filteringExpressions=[]}setPage(r){return this.query.page=r,this}setPageSize(r){return this.query.pageSize=r,this}addOrderBy(r,t=!1){const e=`${r.trim()} ${t?"desc":""}`.trim();return this.query.orderBy=this.query.orderBy?`${this.query.orderBy}, ${e}`:e,this}addCondition(r,t,e,o=!0,i=!0){let s=e;i&&"string"==typeof e&&(s=e.replace(/([(),|]|\/i)/g,"\\$1")),s=o?s.toString():`${s.toString()}/i`;var n=`${r.trim()}${t}${s}`;return this.filteringExpressions.push({value:n,type:"filter"}),this}startGroup(){return this.filteringExpressions.push({value:"(",type:"startGroup"}),this}endGroup(){return this.filteringExpressions.push({value:")",type:"endGroup"}),this}and(){return this.filteringExpressions.push({value:t.And,type:"op"}),this}or(){return this.filteringExpressions.push({value:t.Or,type:"op"}),this}build(){let r=null,t=0;if(this.filteringExpressions.forEach((e=>{if("startGroup"===e.type&&t++,"endGroup"===e.type&&t--,null===r&&"op"===e.type)throw new Error("expression cannot start with a logical operator");if("filter"===r&&"filter"===e.type)throw new Error("consecutive conditions are not allowed, consider adding a logical operator");if("op"===r&&"op"===e.type)throw new Error("consecutive operators are not allowed, consider adding a filter");if("startGroup"===r&&"op"===e.type)throw new Error("logical operator immediately after startGroup is not allowed");if("endGroup"===r&&"filter"===e.type)throw new Error("Missing logical operator after endGroup");if("startGroup"===r&&"endGroup"===e.type)throw new Error("Empty groups are not allowed");if("endGroup"===r&&"startGroup"===e.type)throw new Error("Missing a logical operator between groups");r=e.type,this.query.filter+=e.value})),0!=t)throw new Error("Group not properly closed");return this.query}};var s=o.SQ,n=o.Fw,a=o.Fn;export{s as ConditionalOperator,n as GridifyQueryBuilder,a as LogicalOperator};
1
+ var t,r;!function(t){t.Equal="=",t.NotEqual="!=",t.LessThan="<",t.GreaterThan=">",t.GreaterThanOrEqual=">=",t.LessThanOrEqual="<=",t.Contains="=*",t.NotContains="!*",t.StartsWith="^",t.NotStartsWith="!^",t.EndsWith="$",t.NotEndsWith="!$"}(t||(t={})),function(t){t.And=",",t.Or="|"}(r||(r={}));var o=function(){function t(){this.query={page:1,pageSize:20,orderBy:"",filter:""},this.filteringExpressions=[]}return t.prototype.setPage=function(t){return this.query.page=t,this},t.prototype.setPageSize=function(t){return this.query.pageSize=t,this},t.prototype.addOrderBy=function(t,r){void 0===r&&(r=!1);var o="".concat(t.trim()," ").concat(r?"desc":"").trim();return this.query.orderBy=this.query.orderBy?"".concat(this.query.orderBy,", ").concat(o):o,this},t.prototype.addCondition=function(t,r,o,e,i){void 0===e&&(e=!0),void 0===i&&(i=!0);var n=o;i&&"string"==typeof o&&(n=o.replace(/([(),|]|\/i)/g,"\\$1")),n=e?n.toString():"".concat(n.toString(),"/i");var s="".concat(t.trim()).concat(r).concat(n);return this.filteringExpressions.push({value:s,type:"filter"}),this},t.prototype.startGroup=function(){return this.filteringExpressions.push({value:"(",type:"startGroup"}),this},t.prototype.endGroup=function(){return this.filteringExpressions.push({value:")",type:"endGroup"}),this},t.prototype.and=function(){return this.filteringExpressions.push({value:r.And,type:"op"}),this},t.prototype.or=function(){return this.filteringExpressions.push({value:r.Or,type:"op"}),this},t.prototype.build=function(){var t=this,r=null,o=0;if(this.filteringExpressions.forEach((function(e){if("startGroup"===e.type&&o++,"endGroup"===e.type&&o--,null===r&&"op"===e.type)throw new Error("expression cannot start with a logical operator");if("filter"===r&&"filter"===e.type)throw new Error("consecutive conditions are not allowed, consider adding a logical operator");if("op"===r&&"op"===e.type)throw new Error("consecutive operators are not allowed, consider adding a filter");if("startGroup"===r&&"op"===e.type)throw new Error("logical operator immediately after startGroup is not allowed");if("endGroup"===r&&"filter"===e.type)throw new Error("Missing logical operator after endGroup");if("startGroup"===r&&"endGroup"===e.type)throw new Error("Empty groups are not allowed");if("endGroup"===r&&"startGroup"===e.type)throw new Error("Missing a logical operator between groups");r=e.type,t.query.filter+=e.value})),0!=o)throw new Error("Group not properly closed");return this.query},t}();export{t as ConditionalOperator,o as GridifyQueryBuilder,r as LogicalOperator};
2
+ //# sourceMappingURL=index.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.esm.js","sources":["../src/GridifyOperator.ts","../src/GridifyQueryBuilder.ts"],"sourcesContent":[null,null],"names":["ConditionalOperator","LogicalOperator","GridifyQueryBuilder","this","query","page","pageSize","orderBy","filter","filteringExpressions","prototype","setPage","setPageSize","addOrderBy","field","descending","concat","trim","addCondition","operator","value","caseSensitive","escapeValue","filterValue","replace","toString","filterExpression","push","type","startGroup","endGroup","and","And","or","Or","build","_this","previousType","groupCounter","forEach","exp","Error"],"mappings":"IAAYA,EAeAC,GAfZ,SAAYD,GACTA,EAAA,MAAA,IACAA,EAAA,SAAA,KACAA,EAAA,SAAA,IACAA,EAAA,YAAA,IACAA,EAAA,mBAAA,KACAA,EAAA,gBAAA,KACAA,EAAA,SAAA,KACAA,EAAA,YAAA,KACAA,EAAA,WAAA,IACAA,EAAA,cAAA,KACAA,EAAA,SAAA,IACAA,EAAA,YAAA,IACF,CAbD,CAAYA,IAAAA,EAaX,CAAA,IAED,SAAYC,GACTA,EAAA,IAAA,IACAA,EAAA,GAAA,GACF,CAHD,CAAYA,IAAAA,EAGX,CAAA,ICfD,IAAAC,EAAA,WAAA,SAAAA,IACWC,KAAAC,MAAuB,CAC5BC,KAAM,EACNC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,GAAA,WAEG,OADA9B,KAAKM,qBAAqBkB,KAAK,CAAEP,MAAOnB,EAAgBiC,GAAIN,KAAM,OAC3DzB,MAGVD,EAAAQ,UAAAyB,MAAA,WAAA,IA8DCC,EAAAjC,KA7DMkC,EACD,KACCC,EAAe,EAsDnB,GArDAnC,KAAKM,qBAAqB8B,SAAQ,SAACC,GAShC,GARiB,eAAbA,EAAIZ,MACLU,IAEc,aAAbE,EAAIZ,MACLU,IAIkB,OAAjBD,GAAsC,OAAbG,EAAIZ,KAC9B,MAAM,IAAIa,MAAM,mDAInB,GAAqB,WAAjBJ,GAA0C,WAAbG,EAAIZ,KAClC,MAAM,IAAIa,MACP,8EAKN,GAAqB,OAAjBJ,GAAsC,OAAbG,EAAIZ,KAC9B,MAAM,IAAIa,MACP,mEAKN,GAAqB,eAAjBJ,GAA8C,OAAbG,EAAIZ,KACtC,MAAM,IAAIa,MACP,gEAKN,GAAqB,aAAjBJ,GAA4C,WAAbG,EAAIZ,KACpC,MAAM,IAAIa,MAAM,2CAInB,GAAqB,eAAjBJ,GAA8C,aAAbG,EAAIZ,KACtC,MAAM,IAAIa,MAAM,gCAInB,GAAqB,aAAjBJ,GAA4C,eAAbG,EAAIZ,KACpC,MAAM,IAAIa,MAAM,6CAGnBJ,EAAeG,EAAIZ,KACnBQ,EAAKhC,MAAMI,QAAUgC,EAAIpB,KAC5B,IAEoB,GAAhBkB,EACD,MAAM,IAAIG,MAAM,6BAGnB,OAAOtC,KAAKC,OAEjBF,CAAD"}
package/dist/index.umd.js CHANGED
@@ -1 +1,2 @@
1
- !function(r,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.GridifyClient=e():r.GridifyClient=e()}(this,(()=>(()=>{"use strict";var r,e,t={d:(r,e)=>{for(var o in e)t.o(e,o)&&!t.o(r,o)&&Object.defineProperty(r,o,{enumerable:!0,get:e[o]})},o:(r,e)=>Object.prototype.hasOwnProperty.call(r,e),r:r=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})}},o={};t.r(o),t.d(o,{ConditionalOperator:()=>r,GridifyQueryBuilder:()=>i,LogicalOperator:()=>e}),function(r){r.Equal="=",r.NotEqual="!=",r.LessThan="<",r.GreaterThan=">",r.GreaterThanOrEqual=">=",r.LessThanOrEqual="<=",r.Contains="*",r.NotContains="!*",r.StartsWith="^",r.NotStartsWith="!^",r.EndsWith="$",r.NotEndsWith="!$"}(r||(r={})),function(r){r.And=",",r.Or="|"}(e||(e={}));const i=class{constructor(){this.query={page:1,pageSize:20,orderBy:"",filter:""},this.filteringExpressions=[]}setPage(r){return this.query.page=r,this}setPageSize(r){return this.query.pageSize=r,this}addOrderBy(r,e=!1){const t=`${r.trim()} ${e?"desc":""}`.trim();return this.query.orderBy=this.query.orderBy?`${this.query.orderBy}, ${t}`:t,this}addCondition(r,e,t,o=!0,i=!0){let n=t;i&&"string"==typeof t&&(n=t.replace(/([(),|]|\/i)/g,"\\$1")),n=o?n.toString():`${n.toString()}/i`;var s=`${r.trim()}${e}${n}`;return this.filteringExpressions.push({value:s,type:"filter"}),this}startGroup(){return this.filteringExpressions.push({value:"(",type:"startGroup"}),this}endGroup(){return this.filteringExpressions.push({value:")",type:"endGroup"}),this}and(){return this.filteringExpressions.push({value:e.And,type:"op"}),this}or(){return this.filteringExpressions.push({value:e.Or,type:"op"}),this}build(){let r=null,e=0;if(this.filteringExpressions.forEach((t=>{if("startGroup"===t.type&&e++,"endGroup"===t.type&&e--,null===r&&"op"===t.type)throw new Error("expression cannot start with a logical operator");if("filter"===r&&"filter"===t.type)throw new Error("consecutive conditions are not allowed, consider adding a logical operator");if("op"===r&&"op"===t.type)throw new Error("consecutive operators are not allowed, consider adding a filter");if("startGroup"===r&&"op"===t.type)throw new Error("logical operator immediately after startGroup is not allowed");if("endGroup"===r&&"filter"===t.type)throw new Error("Missing logical operator after endGroup");if("startGroup"===r&&"endGroup"===t.type)throw new Error("Empty groups are not allowed");if("endGroup"===r&&"startGroup"===t.type)throw new Error("Missing a logical operator between groups");r=t.type,this.query.filter+=t.value})),0!=e)throw new Error("Group not properly closed");return this.query}};return o})()));
1
+ !function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((t="undefined"!=typeof globalThis?globalThis:t||self).GridifyClient={})}(this,(function(t){"use strict";var r,o;t.ConditionalOperator=void 0,(r=t.ConditionalOperator||(t.ConditionalOperator={})).Equal="=",r.NotEqual="!=",r.LessThan="<",r.GreaterThan=">",r.GreaterThanOrEqual=">=",r.LessThanOrEqual="<=",r.Contains="=*",r.NotContains="!*",r.StartsWith="^",r.NotStartsWith="!^",r.EndsWith="$",r.NotEndsWith="!$",t.LogicalOperator=void 0,(o=t.LogicalOperator||(t.LogicalOperator={})).And=",",o.Or="|";var e=function(){function r(){this.query={page:1,pageSize:20,orderBy:"",filter:""},this.filteringExpressions=[]}return r.prototype.setPage=function(t){return this.query.page=t,this},r.prototype.setPageSize=function(t){return this.query.pageSize=t,this},r.prototype.addOrderBy=function(t,r){void 0===r&&(r=!1);var o="".concat(t.trim()," ").concat(r?"desc":"").trim();return this.query.orderBy=this.query.orderBy?"".concat(this.query.orderBy,", ").concat(o):o,this},r.prototype.addCondition=function(t,r,o,e,i){void 0===e&&(e=!0),void 0===i&&(i=!0);var n=o;i&&"string"==typeof o&&(n=o.replace(/([(),|]|\/i)/g,"\\$1")),n=e?n.toString():"".concat(n.toString(),"/i");var a="".concat(t.trim()).concat(r).concat(n);return this.filteringExpressions.push({value:a,type:"filter"}),this},r.prototype.startGroup=function(){return this.filteringExpressions.push({value:"(",type:"startGroup"}),this},r.prototype.endGroup=function(){return this.filteringExpressions.push({value:")",type:"endGroup"}),this},r.prototype.and=function(){return this.filteringExpressions.push({value:t.LogicalOperator.And,type:"op"}),this},r.prototype.or=function(){return this.filteringExpressions.push({value:t.LogicalOperator.Or,type:"op"}),this},r.prototype.build=function(){var t=this,r=null,o=0;if(this.filteringExpressions.forEach((function(e){if("startGroup"===e.type&&o++,"endGroup"===e.type&&o--,null===r&&"op"===e.type)throw new Error("expression cannot start with a logical operator");if("filter"===r&&"filter"===e.type)throw new Error("consecutive conditions are not allowed, consider adding a logical operator");if("op"===r&&"op"===e.type)throw new Error("consecutive operators are not allowed, consider adding a filter");if("startGroup"===r&&"op"===e.type)throw new Error("logical operator immediately after startGroup is not allowed");if("endGroup"===r&&"filter"===e.type)throw new Error("Missing logical operator after endGroup");if("startGroup"===r&&"endGroup"===e.type)throw new Error("Empty groups are not allowed");if("endGroup"===r&&"startGroup"===e.type)throw new Error("Missing a logical operator between groups");r=e.type,t.query.filter+=e.value})),0!=o)throw new Error("Group not properly closed");return this.query},r}();t.GridifyQueryBuilder=e}));
2
+ //# sourceMappingURL=index.umd.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.umd.js","sources":["../src/GridifyOperator.ts","../src/GridifyQueryBuilder.ts"],"sourcesContent":[null,null],"names":["ConditionalOperator","LogicalOperator","exports","GridifyQueryBuilder","this","query","page","pageSize","orderBy","filter","filteringExpressions","prototype","setPage","setPageSize","addOrderBy","field","descending","concat","trim","addCondition","operator","value","caseSensitive","escapeValue","filterValue","replace","toString","filterExpression","push","type","startGroup","endGroup","and","And","or","Or","build","_this","previousType","groupCounter","forEach","exp","Error"],"mappings":"qPAAA,IAAYA,EAeAC,EAFXC,EAAAF,yBAAA,GAbWA,EAAAA,wBAAAA,EAAAA,oBAaX,CAAA,IAZE,MAAA,IACAA,EAAA,SAAA,KACAA,EAAA,SAAA,IACAA,EAAA,YAAA,IACAA,EAAA,mBAAA,KACAA,EAAA,gBAAA,KACAA,EAAA,SAAA,KACAA,EAAA,YAAA,KACAA,EAAA,WAAA,IACAA,EAAA,cAAA,KACAA,EAAA,SAAA,IACAA,EAAA,YAAA,KAMFE,EAAAD,qBAAA,GAHWA,EAAAA,EAAeA,kB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AqB,IAAA,WAKG,OAJA5B,KAAKM,qBAAqBkB,KAAK,CAC5BP,MAAOpB,EAAeA,gBAACgC,IACvBJ,KAAM,OAEFzB,MAGVD,EAAAQ,UAAAuB,GAAA,WAEG,OADA9B,KAAKM,qBAAqBkB,KAAK,CAAEP,MAAOpB,EAAeA,gBAACkC,GAAIN,KAAM,OAC3DzB,MAGVD,EAAAQ,UAAAyB,MAAA,WAAA,IA8DCC,EAAAjC,KA7DMkC,EACD,KACCC,EAAe,EAsDnB,GArDAnC,KAAKM,qBAAqB8B,SAAQ,SAACC,GAShC,GARiB,eAAbA,EAAIZ,MACLU,IAEc,aAAbE,EAAIZ,MACLU,IAIkB,OAAjBD,GAAsC,OAAbG,EAAIZ,KAC9B,MAAM,IAAIa,MAAM,mDAInB,GAAqB,WAAjBJ,GAA0C,WAAbG,EAAIZ,KAClC,MAAM,IAAIa,MACP,8EAKN,GAAqB,OAAjBJ,GAAsC,OAAbG,EAAIZ,KAC9B,MAAM,IAAIa,MACP,mEAKN,GAAqB,eAAjBJ,GAA8C,OAAbG,EAAIZ,KACtC,MAAM,IAAIa,MACP,gEAKN,GAAqB,aAAjBJ,GAA4C,WAAbG,EAAIZ,KACpC,MAAM,IAAIa,MAAM,2CAInB,GAAqB,eAAjBJ,GAA8C,aAAbG,EAAIZ,KACtC,MAAM,IAAIa,MAAM,gCAInB,GAAqB,aAAjBJ,GAA4C,eAAbG,EAAIZ,KACpC,MAAM,IAAIa,MAAM,6CAGnBJ,EAAeG,EAAIZ,KACnBQ,EAAKhC,MAAMI,QAAUgC,EAAIpB,KAC5B,IAEoB,GAAhBkB,EACD,MAAM,IAAIG,MAAM,6BAGnB,OAAOtC,KAAKC,OAEjBF,CAAD"}
package/package.json CHANGED
@@ -1,30 +1,30 @@
1
1
  {
2
2
  "name": "gridify-client",
3
- "version": "2.0.0-preview.3",
3
+ "version": "2.0.0-preview.5",
4
4
  "description": "Client JS library for the dotnet Gridify project",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
7
+ "browser": "dist/index.umd.js",
7
8
  "types": "dist/index.d.ts",
8
9
  "repository": "https://github.com/alirezanet/Gridify/",
9
10
  "homepage": "https://alirezanet.github.io/Gridify/guide/gridify-client/",
10
11
  "author": "AliReza Sabouri",
11
12
  "license": "MIT",
12
13
  "scripts": {
13
- "build": "webpack",
14
- "watch": "webpack --watch",
14
+ "build": "rollup -c",
15
15
  "test": "jest"
16
16
  },
17
17
  "devDependencies": {
18
+ "@rollup/plugin-commonjs": "^25.0.7",
19
+ "@rollup/plugin-node-resolve": "^15.2.3",
20
+ "@rollup/plugin-typescript": "^11.1.5",
18
21
  "@types/jest": "^29.5.8",
19
22
  "jest": "^29.7.0",
20
- "terser-webpack-plugin": "^5.3.9",
21
23
  "ts-jest": "^29.1.1",
22
- "ts-loader": "^9.5.0",
23
- "typescript": "^5.2.2",
24
- "uglifyjs-webpack-plugin": "^2.2.0",
25
- "webpack": "^5.89.0",
26
- "webpack-cli": "^5.1.4",
27
- "webpack-merge": "^5.10.0"
24
+ "rollup": "^4.4.0",
25
+ "rollup-plugin-terser": "^7.0.2",
26
+ "tslib": "^2.6.2",
27
+ "typescript": "^5.2.2"
28
28
  },
29
29
  "files": [
30
30
  "dist/**/*"