@ancon/wildcat-utils 1.41.13 → 1.41.15
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.
|
@@ -13,6 +13,7 @@ declare class APIFilterOperatorBuilder {
|
|
|
13
13
|
null(): APIFilterBuilder;
|
|
14
14
|
notNull(): APIFilterBuilder;
|
|
15
15
|
notIn(value: APIFilterValue | APIFilterValue[]): APIFilterBuilder;
|
|
16
|
+
andBitwise(value: number): APIFilterBuilder;
|
|
16
17
|
}
|
|
17
18
|
export default class APIFilterBuilder {
|
|
18
19
|
operatorBuildPending: boolean | undefined;
|
package/api/APIFilterBuilder.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var l=Object.defineProperty;var p=(o,r,e)=>r in o?l(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e;var i=(o,r,e)=>(p(o,typeof r!="symbol"?r+"":r,e),e);const t=require("./types.js");class s{constructor(r,e){i(this,"propertyName");i(this,"parentBuilder");this.propertyName=e,this.parentBuilder=r}has(r){return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.Has,this.parentBuilder.addFilter(this.propertyName,Array.isArray(r)?r.map(e=>`${t.APIFilterOperator.Has}:${e}`):`${t.APIFilterOperator.Has}:${r}`)}in(r){const e=Array.isArray(r)?r:[r];return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.In,this.parentBuilder.addFilter(this.propertyName,`${t.APIFilterOperator.In}:${e.join(",")}`)}greaterThan(r){return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.GT,this.parentBuilder.addFilter(this.propertyName,`${t.APIFilterOperator.GT}:${r}`)}greaterThanOrEqual(r){return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.GTE,this.parentBuilder.addFilter(this.propertyName,`${t.APIFilterOperator.GTE}:${r}`)}lessThan(r){return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.LT,this.parentBuilder.addFilter(this.propertyName,`${t.APIFilterOperator.LT}:${r}`)}lessThanOrEqual(r){return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.LTE,this.parentBuilder.addFilter(this.propertyName,`${t.APIFilterOperator.LTE}:${r}`)}null(){return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.Null,this.parentBuilder.addFilter(this.propertyName,t.APIFilterOperator.Null)}notNull(){return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.NotNull,this.parentBuilder.addFilter(this.propertyName,t.APIFilterOperator.NotNull)}notIn(r){const e=Array.isArray(r)?r:[r];return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.NotIn,this.parentBuilder.addFilter(this.propertyName,`${t.APIFilterOperator.NotIn}:${e.join(",")}`)}}class d{constructor(){i(this,"operatorBuildPending");i(this,"conditionBuildPending");i(this,"recentPropertyName");i(this,"recentPropertyOperator");i(this,"filters",{})}addProperty(r){if(this.operatorBuildPending===!0)throw new Error("API Filter operator configuration is incomplete");return this.operatorBuildPending=!0,this.recentPropertyName=r,new s(this,r)}addFilter(r,e){if(this.filters[r]){const n=this.filters[r],a=Array.isArray(e)?e:[e];this.filters[r]=Array.isArray(n)?n.concat(a):[n,...a]}else this.filters[r]=e;return this.operatorBuildPending=!1,this.conditionBuildPending=!1,this}build(){return this.filters}or(){if(this.operatorBuildPending===!0)throw new Error("API Filter operator configuration is incomplete");if(this.conditionBuildPending===!0)throw new Error("API Filter condition configuration is incomplete");if(!this.recentPropertyOperator||![t.APIFilterOperator.GT,t.APIFilterOperator.GTE,t.APIFilterOperator.LT,t.APIFilterOperator.LTE,t.APIFilterOperator.In,t.APIFilterOperator.Has].includes(this.recentPropertyOperator))throw new Error("Last operator not compatible for OR condition");const r=this.filters[this.recentPropertyName];if(Array.isArray(r))throw new Error("Last operator not compatible for OR condition");const e=`${r}:${t.APIFilterCondition.Or}`;return this.filters[this.recentPropertyName]=e,this.conditionBuildPending=!0,this}}module.exports=d;
|
|
1
|
+
"use strict";var l=Object.defineProperty;var p=(o,r,e)=>r in o?l(o,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):o[r]=e;var i=(o,r,e)=>(p(o,typeof r!="symbol"?r+"":r,e),e);const t=require("./types.js");class s{constructor(r,e){i(this,"propertyName");i(this,"parentBuilder");this.propertyName=e,this.parentBuilder=r}has(r){return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.Has,this.parentBuilder.addFilter(this.propertyName,Array.isArray(r)?r.map(e=>`${t.APIFilterOperator.Has}:${e}`):`${t.APIFilterOperator.Has}:${r}`)}in(r){const e=Array.isArray(r)?r:[r];return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.In,this.parentBuilder.addFilter(this.propertyName,`${t.APIFilterOperator.In}:${e.join(",")}`)}greaterThan(r){return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.GT,this.parentBuilder.addFilter(this.propertyName,`${t.APIFilterOperator.GT}:${r}`)}greaterThanOrEqual(r){return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.GTE,this.parentBuilder.addFilter(this.propertyName,`${t.APIFilterOperator.GTE}:${r}`)}lessThan(r){return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.LT,this.parentBuilder.addFilter(this.propertyName,`${t.APIFilterOperator.LT}:${r}`)}lessThanOrEqual(r){return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.LTE,this.parentBuilder.addFilter(this.propertyName,`${t.APIFilterOperator.LTE}:${r}`)}null(){return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.Null,this.parentBuilder.addFilter(this.propertyName,t.APIFilterOperator.Null)}notNull(){return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.NotNull,this.parentBuilder.addFilter(this.propertyName,t.APIFilterOperator.NotNull)}notIn(r){const e=Array.isArray(r)?r:[r];return this.parentBuilder.recentPropertyOperator=t.APIFilterOperator.NotIn,this.parentBuilder.addFilter(this.propertyName,`${t.APIFilterOperator.NotIn}:${e.join(",")}`)}andBitwise(r){return this.parentBuilder.addFilter(this.propertyName,`${t.APIFilterOperator.And}:${r}`)}}class d{constructor(){i(this,"operatorBuildPending");i(this,"conditionBuildPending");i(this,"recentPropertyName");i(this,"recentPropertyOperator");i(this,"filters",{})}addProperty(r){if(this.operatorBuildPending===!0)throw new Error("API Filter operator configuration is incomplete");return this.operatorBuildPending=!0,this.recentPropertyName=r,new s(this,r)}addFilter(r,e){if(this.filters[r]){const n=this.filters[r],a=Array.isArray(e)?e:[e];this.filters[r]=Array.isArray(n)?n.concat(a):[n,...a]}else this.filters[r]=e;return this.operatorBuildPending=!1,this.conditionBuildPending=!1,this}build(){return this.filters}or(){if(this.operatorBuildPending===!0)throw new Error("API Filter operator configuration is incomplete");if(this.conditionBuildPending===!0)throw new Error("API Filter condition configuration is incomplete");if(!this.recentPropertyOperator||![t.APIFilterOperator.GT,t.APIFilterOperator.GTE,t.APIFilterOperator.LT,t.APIFilterOperator.LTE,t.APIFilterOperator.In,t.APIFilterOperator.Has].includes(this.recentPropertyOperator))throw new Error("Last operator not compatible for OR condition");const r=this.filters[this.recentPropertyName];if(Array.isArray(r))throw new Error("Last operator not compatible for OR condition");const e=`${r}:${t.APIFilterCondition.Or}`;return this.filters[this.recentPropertyName]=e,this.conditionBuildPending=!0,this}}module.exports=d;
|
package/api/APIFilterBuilder.mjs
CHANGED
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ declare type TimeFormat = 'HH:mm' | 'HH:mm:ss';
|
|
|
7
7
|
* This function calculates the end time of a time period with the duration.
|
|
8
8
|
*
|
|
9
9
|
* @param timePeriod The time period object with `from` and `duration`.
|
|
10
|
-
* @param
|
|
10
|
+
* @param format The format of the time. Default is `HH:mm`.
|
|
11
11
|
* @returns The end time of the time period.
|
|
12
12
|
*/
|
|
13
13
|
export default function getEndTimeSpanOfTimePeriod(timePeriod: TimePeriod, format?: TimeFormat): string;
|