@react-querybuilder/datetime 8.8.4 → 8.9.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.
Files changed (132) hide show
  1. package/dist/cjs/date-fns.d.ts +1 -0
  2. package/dist/cjs/dayjs.d.ts +1 -0
  3. package/dist/cjs/getDatetimeRuleProcessorSQL-D95jgDK6.js +2 -0
  4. package/dist/cjs/getDatetimeRuleProcessorSQL-D95jgDK6.js.map +1 -0
  5. package/dist/cjs/index.d.ts +1 -0
  6. package/dist/cjs/jsdate.d.ts +1 -0
  7. package/dist/cjs/luxon.d.ts +1 -0
  8. package/dist/cjs/react-querybuilder_datetime.cjs.development.d.ts +108 -0
  9. package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.d.ts +53 -0
  10. package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js +12 -11
  11. package/dist/cjs/react-querybuilder_datetime.cjs.development.date-fns.js.map +1 -1
  12. package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.d.ts +53 -0
  13. package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js +12 -11
  14. package/dist/cjs/react-querybuilder_datetime.cjs.development.dayjs.js.map +1 -1
  15. package/dist/cjs/react-querybuilder_datetime.cjs.development.js +5 -4
  16. package/dist/cjs/react-querybuilder_datetime.cjs.development.js.map +1 -1
  17. package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.d.ts +56 -0
  18. package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js +10 -10
  19. package/dist/cjs/react-querybuilder_datetime.cjs.development.jsdate.js.map +1 -1
  20. package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.d.ts +53 -0
  21. package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js +12 -11
  22. package/dist/cjs/react-querybuilder_datetime.cjs.development.luxon.js.map +1 -1
  23. package/dist/cjs/react-querybuilder_datetime.cjs.production.d.ts +108 -0
  24. package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.d.ts +53 -0
  25. package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.js +1 -1
  26. package/dist/cjs/react-querybuilder_datetime.cjs.production.date-fns.js.map +1 -1
  27. package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.d.ts +53 -0
  28. package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.js +1 -1
  29. package/dist/cjs/react-querybuilder_datetime.cjs.production.dayjs.js.map +1 -1
  30. package/dist/cjs/react-querybuilder_datetime.cjs.production.js +1 -1
  31. package/dist/cjs/react-querybuilder_datetime.cjs.production.js.map +1 -1
  32. package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.d.ts +56 -0
  33. package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.js +1 -1
  34. package/dist/cjs/react-querybuilder_datetime.cjs.production.jsdate.js.map +1 -1
  35. package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.d.ts +53 -0
  36. package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.js +1 -1
  37. package/dist/cjs/react-querybuilder_datetime.cjs.production.luxon.js.map +1 -1
  38. package/dist/cjs/types-QCQUGVZa.d.ts +1694 -0
  39. package/dist/{getDatetimeRuleProcessorSQL-CutYTD23.js → getDatetimeRuleProcessorSQL-CN80oEFK.js} +23 -29
  40. package/dist/getDatetimeRuleProcessorSQL-CN80oEFK.js.map +1 -0
  41. package/dist/{getDatetimeRuleProcessorSQL-CocyaiI5.mjs → getDatetimeRuleProcessorSQL-KYRPP9qd.mjs} +17 -23
  42. package/dist/getDatetimeRuleProcessorSQL-KYRPP9qd.mjs.map +1 -0
  43. package/dist/react-querybuilder_datetime.d.mts +108 -0
  44. package/dist/react-querybuilder_datetime.date-fns.d.mts +53 -0
  45. package/dist/react-querybuilder_datetime.date-fns.mjs +10 -10
  46. package/dist/react-querybuilder_datetime.date-fns.mjs.map +1 -1
  47. package/dist/react-querybuilder_datetime.dayjs.d.mts +53 -0
  48. package/dist/react-querybuilder_datetime.dayjs.mjs +10 -10
  49. package/dist/react-querybuilder_datetime.dayjs.mjs.map +1 -1
  50. package/dist/react-querybuilder_datetime.jsdate.d.mts +56 -0
  51. package/dist/react-querybuilder_datetime.jsdate.mjs +10 -10
  52. package/dist/react-querybuilder_datetime.jsdate.mjs.map +1 -1
  53. package/dist/react-querybuilder_datetime.legacy-esm.d.ts +108 -0
  54. package/dist/react-querybuilder_datetime.legacy-esm.date-fns.d.ts +53 -0
  55. package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js +10 -10
  56. package/dist/react-querybuilder_datetime.legacy-esm.date-fns.js.map +1 -1
  57. package/dist/react-querybuilder_datetime.legacy-esm.dayjs.d.ts +53 -0
  58. package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js +10 -10
  59. package/dist/react-querybuilder_datetime.legacy-esm.dayjs.js.map +1 -1
  60. package/dist/react-querybuilder_datetime.legacy-esm.js +4 -4
  61. package/dist/react-querybuilder_datetime.legacy-esm.js.map +1 -1
  62. package/dist/react-querybuilder_datetime.legacy-esm.jsdate.d.ts +56 -0
  63. package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js +11 -11
  64. package/dist/react-querybuilder_datetime.legacy-esm.jsdate.js.map +1 -1
  65. package/dist/react-querybuilder_datetime.legacy-esm.luxon.d.ts +53 -0
  66. package/dist/react-querybuilder_datetime.legacy-esm.luxon.js +10 -10
  67. package/dist/react-querybuilder_datetime.legacy-esm.luxon.js.map +1 -1
  68. package/dist/react-querybuilder_datetime.luxon.d.mts +53 -0
  69. package/dist/react-querybuilder_datetime.luxon.mjs +10 -10
  70. package/dist/react-querybuilder_datetime.luxon.mjs.map +1 -1
  71. package/dist/react-querybuilder_datetime.mjs +3 -3
  72. package/dist/react-querybuilder_datetime.mjs.map +1 -1
  73. package/dist/react-querybuilder_datetime.production.d.mts +108 -0
  74. package/dist/react-querybuilder_datetime.production.date-fns.d.mts +53 -0
  75. package/dist/react-querybuilder_datetime.production.date-fns.mjs +1 -1
  76. package/dist/react-querybuilder_datetime.production.date-fns.mjs.map +1 -1
  77. package/dist/react-querybuilder_datetime.production.dayjs.d.mts +53 -0
  78. package/dist/react-querybuilder_datetime.production.dayjs.mjs +1 -1
  79. package/dist/react-querybuilder_datetime.production.dayjs.mjs.map +1 -1
  80. package/dist/react-querybuilder_datetime.production.jsdate.d.mts +56 -0
  81. package/dist/react-querybuilder_datetime.production.jsdate.mjs +1 -1
  82. package/dist/react-querybuilder_datetime.production.jsdate.mjs.map +1 -1
  83. package/dist/react-querybuilder_datetime.production.luxon.d.mts +53 -0
  84. package/dist/react-querybuilder_datetime.production.luxon.mjs +1 -1
  85. package/dist/react-querybuilder_datetime.production.luxon.mjs.map +1 -1
  86. package/dist/react-querybuilder_datetime.production.mjs +1 -1
  87. package/dist/react-querybuilder_datetime.production.mjs.map +1 -1
  88. package/dist/types-CDEkL2M_.d.mts +1694 -0
  89. package/dist/types-EgfSemtR.d.ts +1694 -0
  90. package/package.json +23 -23
  91. package/dist/cjs/getDatetimeRuleProcessorSQL-npwUe9aM.js +0 -2
  92. package/dist/cjs/getDatetimeRuleProcessorSQL-npwUe9aM.js.map +0 -1
  93. package/dist/getDatetimeRuleProcessorSQL-CocyaiI5.mjs.map +0 -1
  94. package/dist/getDatetimeRuleProcessorSQL-CutYTD23.js.map +0 -1
  95. package/dist/types/QueryBuilderDateTime.d.ts +0 -4
  96. package/dist/types/datetimeRuleProcessorJsonLogic.d.ts +0 -10
  97. package/dist/types/getDatetimeJsonLogicOperations.d.ts +0 -6
  98. package/dist/types/getDatetimeRuleProcessorCEL.d.ts +0 -7
  99. package/dist/types/getDatetimeRuleProcessorJSONata.d.ts +0 -7
  100. package/dist/types/getDatetimeRuleProcessorMongoDBQuery.d.ts +0 -7
  101. package/dist/types/getDatetimeRuleProcessorNL.d.ts +0 -13
  102. package/dist/types/getDatetimeRuleProcessorSQL.d.ts +0 -32
  103. package/dist/types/index.d.ts +0 -8
  104. package/dist/types/index.date-fns.d.ts +0 -48
  105. package/dist/types/index.dayjs.d.ts +0 -48
  106. package/dist/types/index.jsdate.d.ts +0 -48
  107. package/dist/types/index.luxon.d.ts +0 -48
  108. package/dist/types/rqbDateTimeLibraryAPI.date-fns.d.ts +0 -5
  109. package/dist/types/rqbDateTimeLibraryAPI.dayjs.d.ts +0 -5
  110. package/dist/types/rqbDateTimeLibraryAPI.jsdate.d.ts +0 -8
  111. package/dist/types/rqbDateTimeLibraryAPI.luxon.d.ts +0 -5
  112. package/dist/types/types.d.ts +0 -111
  113. package/dist/types/utils.d.ts +0 -5
  114. package/dist/types-esm/QueryBuilderDateTime.d.mts +0 -4
  115. package/dist/types-esm/datetimeRuleProcessorJsonLogic.d.mts +0 -10
  116. package/dist/types-esm/getDatetimeJsonLogicOperations.d.mts +0 -6
  117. package/dist/types-esm/getDatetimeRuleProcessorCEL.d.mts +0 -7
  118. package/dist/types-esm/getDatetimeRuleProcessorJSONata.d.mts +0 -7
  119. package/dist/types-esm/getDatetimeRuleProcessorMongoDBQuery.d.mts +0 -7
  120. package/dist/types-esm/getDatetimeRuleProcessorNL.d.mts +0 -13
  121. package/dist/types-esm/getDatetimeRuleProcessorSQL.d.mts +0 -32
  122. package/dist/types-esm/index.d.mts +0 -8
  123. package/dist/types-esm/index.date-fns.d.mts +0 -48
  124. package/dist/types-esm/index.dayjs.d.mts +0 -48
  125. package/dist/types-esm/index.jsdate.d.mts +0 -48
  126. package/dist/types-esm/index.luxon.d.mts +0 -48
  127. package/dist/types-esm/rqbDateTimeLibraryAPI.date-fns.d.mts +0 -5
  128. package/dist/types-esm/rqbDateTimeLibraryAPI.dayjs.d.mts +0 -5
  129. package/dist/types-esm/rqbDateTimeLibraryAPI.jsdate.d.mts +0 -8
  130. package/dist/types-esm/rqbDateTimeLibraryAPI.luxon.d.mts +0 -5
  131. package/dist/types-esm/types.d.mts +0 -111
  132. package/dist/types-esm/utils.d.mts +0 -5
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-querybuilder/datetime",
3
3
  "description": "Date/time features for react-querybuilder",
4
- "version": "8.8.4",
4
+ "version": "8.9.2",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -11,56 +11,56 @@
11
11
  "./package.json": "./package.json",
12
12
  ".": {
13
13
  "import": {
14
- "types": "./dist/types-esm/index.d.mts",
14
+ "types": "./dist/react-querybuilder_datetime.d.mts",
15
15
  "default": "./dist/react-querybuilder_datetime.mjs"
16
16
  },
17
17
  "require": {
18
- "types": "./dist/types/index.d.ts",
18
+ "types": "./dist/cjs/index.d.ts",
19
19
  "default": "./dist/cjs/index.js"
20
20
  }
21
21
  },
22
22
  "./date-fns": {
23
23
  "import": {
24
- "types": "./dist/types-esm/index.date-fns.d.mts",
24
+ "types": "./dist/react-querybuilder_datetime.date-fns.d.mts",
25
25
  "default": "./dist/react-querybuilder_datetime.date-fns.mjs"
26
26
  },
27
27
  "require": {
28
- "types": "./dist/types/index.date-fns.d.ts",
28
+ "types": "./dist/cjs/date-fns.d.ts",
29
29
  "default": "./dist/cjs/date-fns.js"
30
30
  }
31
31
  },
32
32
  "./dayjs": {
33
33
  "import": {
34
- "types": "./dist/types-esm/index.dayjs.d.mts",
34
+ "types": "./dist/react-querybuilder_datetime.dayjs.d.mts",
35
35
  "default": "./dist/react-querybuilder_datetime.dayjs.mjs"
36
36
  },
37
37
  "require": {
38
- "types": "./dist/types/index.dayjs.d.ts",
38
+ "types": "./dist/cjs/dayjs.d.ts",
39
39
  "default": "./dist/cjs/dayjs.js"
40
40
  }
41
41
  },
42
42
  "./jsdate": {
43
43
  "import": {
44
- "types": "./dist/types-esm/index.jsdate.d.mts",
44
+ "types": "./dist/react-querybuilder_datetime.jsdate.d.mts",
45
45
  "default": "./dist/react-querybuilder_datetime.jsdate.mjs"
46
46
  },
47
47
  "require": {
48
- "types": "./dist/types/index.jsdate.d.ts",
48
+ "types": "./dist/cjs/jsdate.d.ts",
49
49
  "default": "./dist/cjs/jsdate.js"
50
50
  }
51
51
  },
52
52
  "./luxon": {
53
53
  "import": {
54
- "types": "./dist/types-esm/index.luxon.d.mts",
54
+ "types": "./dist/react-querybuilder_datetime.luxon.d.mts",
55
55
  "default": "./dist/react-querybuilder_datetime.luxon.mjs"
56
56
  },
57
57
  "require": {
58
- "types": "./dist/types/index.luxon.d.ts",
58
+ "types": "./dist/cjs/luxon.d.ts",
59
59
  "default": "./dist/cjs/luxon.js"
60
60
  }
61
61
  }
62
62
  },
63
- "types": "./dist/types/index.d.ts",
63
+ "types": "./dist/react-querybuilder_datetime.legacy-esm.d.ts",
64
64
  "files": [
65
65
  "dist"
66
66
  ],
@@ -87,33 +87,33 @@
87
87
  },
88
88
  "devDependencies": {
89
89
  "@date-fns/tz": "^1.4.1",
90
- "@electric-sql/pglite": "^0.3.7",
90
+ "@electric-sql/pglite": "^0.3.8",
91
91
  "@testing-library/dom": "^10.4.1",
92
92
  "@testing-library/react": "^16.3.0",
93
93
  "@testing-library/user-event": "14.5.2",
94
94
  "@types/luxon": "^3.7.1",
95
- "@types/react": "^19.1.12",
96
- "@vitejs/plugin-react": "^5.0.1",
95
+ "@types/react": "^19.1.13",
96
+ "@vitejs/plugin-react": "^5.0.3",
97
97
  "date-fns": "^4.1.0",
98
- "dayjs": "^1.11.14",
98
+ "dayjs": "^1.11.18",
99
99
  "json-logic-js": "^2.0.5",
100
100
  "jsonata": "^2.1.0",
101
- "luxon": "^3.7.1",
102
- "mongodb-memory-server-core": "^10.2.0",
103
- "mongoose": "^8.18.0",
101
+ "luxon": "^3.7.2",
102
+ "mongodb-memory-server-core": "^10.2.1",
103
+ "mongoose": "^8.18.1",
104
104
  "react": "^19.1.1",
105
105
  "react-dom": "^19.1.1",
106
- "react-querybuilder": "8.8.4",
106
+ "react-querybuilder": "8.9.2",
107
107
  "rollup-plugin-visualizer": "^6.0.3",
108
108
  "typescript": "^5.9.2",
109
- "vite": "^7.1.3"
109
+ "vite": "^7.1.6"
110
110
  },
111
111
  "peerDependencies": {
112
112
  "date-fns": "^4.1.0",
113
113
  "dayjs": "^1.11.13",
114
114
  "luxon": "^3.5.0",
115
115
  "react": ">=18",
116
- "react-querybuilder": "8.8.4"
116
+ "react-querybuilder": "8.9.2"
117
117
  },
118
118
  "peerDependenciesMeta": {
119
119
  "date-fns": {
@@ -126,5 +126,5 @@
126
126
  "optional": true
127
127
  }
128
128
  },
129
- "gitHead": "92e5cce89acdc98c00f4a9cb4d63052981d54d24"
129
+ "gitHead": "23337611f82e9ba31fa918689ed6ec9d78d3d7e6"
130
130
  }
@@ -1,2 +0,0 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=s(require(`react-querybuilder`)),l=e=>typeof e==`string`&&/^\d{4}-\d{2}-\d{2}$/.test(e),u=(...[e,t])=>e.operator!==`contains`&&e.operator!==`beginsWith`&&e.operator!==`endsWith`&&e.operator!==`doesNotContain`&&e.operator!==`doesNotBeginWith`&&e.operator!==`doesNotEndWith`&&e.operator!==`null`&&e.operator!==`notNull`&&/^(?:date|datetime|datetimeoffset|timestamp)\b/i.test(t?.fieldData?.datatype),d=(e,...[t,n])=>typeof e==`boolean`?e:typeof e==`function`?e(t,n):Array.isArray(e)?e.some(e=>Object.entries(e).every(([e,t])=>n?.fieldData?.[e]===t)):typeof e==`object`?Object.entries(e).every(([e,t])=>n?.fieldData?.[e]===t):u(t,n),f=({isAfter:e,isBefore:t,isSame:n})=>({dateAfter:(t,n)=>e(t,n),dateBefore:(e,n)=>t(e,n),dateBetween:(r,i,a)=>n(i,r)||n(i,a)||e(i,r)&&t(i,a)||e(i,a)&&t(i,r),dateNotBetween:(r,i,a)=>!n(i,r)&&!n(i,a)&&(t(r,a)&&(t(i,r)||e(i,a))||e(r,a)&&(t(i,a)||e(i,r))),dateIn:(e,t)=>t.some(t=>n(e,t)),dateNotIn:(e,t)=>t.every(t=>!n(e,t)),dateNotOn:(e,t)=>!n(e,t),dateOn:(e,t)=>n(e,t),dateOnOrAfter:(t,r)=>e(t,r)||n(t,r),dateOnOrBefore:(e,r)=>t(e,r)||n(e,r)}),p=e=>/^(does)?not/i.test(e),m=e=>(t,n)=>{let r=n??{},{context:i={}}=r;if(t.valueSource===`field`||!d(i.isDateField,t,r))return(0,c.defaultRuleProcessorCEL)(t,r);let a=t=>`timestamp("${e.toISOString(t)}")`,o=(0,c.lc)(t.operator.replace(/^=$/,`==`));switch(o){case`<`:case`<=`:case`==`:case`!=`:case`>`:case`>=`:return`${t.field} ${o} ${a(t.value)}`}let s=(0,c.toArray)(t.value,{retainEmptyStrings:!1}),l=s.map(t=>e.toDate(t)).filter(t=>e.isValid(t));switch(o){case`in`:case`notin`:{if(l.length===0)return``;let[e,n]=p(o)?[`!(`,`)`]:[``,``];return`${e}${t.field} in [${l.map(e=>a(e)).join(`, `)}]${n}`}case`between`:case`notbetween`:{if(l.length<2)return``;let[n,r]=l,[i,s]=e.isBefore(n,r)?[n,r]:[r,n];return o===`between`?`(${t.field} >= ${a(i)} && ${t.field} <= ${a(s)})`:`(${t.field} < ${a(i)} || ${t.field} > ${a(s)})`}}return(0,c.defaultRuleProcessorCEL)(t,r)},h=e=>(t,n)=>{let r=n??{},{field:i,operator:a,value:o,valueSource:s}=t;if(s===`field`||!d(r.context?.isDateField,t,r))return(0,c.defaultRuleProcessorMongoDBQuery)(t,r);if(a===`=`)return{[i]:e.toDate(o)};switch(a){case`<`:case`<=`:case`!=`:case`>`:case`>=`:return{[i]:{[c.mongoOperators[a]]:e.toDate(o)}}}let l=(0,c.toArray)(t.value,{retainEmptyStrings:!1}),u=l.map(t=>e.toDate(t)).filter(t=>e.isValid(t));switch(a){case`in`:case`notIn`:return{[i]:{[c.mongoOperators[a]]:u}};case`between`:case`notBetween`:{if(u.length<2)return``;let[t,n]=u,r=e.isBefore(t,n)?[t,n]:[n,t];return a===`between`?{[i]:{$gte:r[0],$lte:r[1]}}:{$or:[{[i]:{$lt:r[0]}},{[i]:{$gt:r[1]}}]}}}return(0,c.defaultRuleProcessorMongoDBQuery)(t,r)},g={"<":`is before`,">":`is after`,"<=":`is on or before`,">=":`is on or after`,in:[`is one of the dates`,`is the same as a date in`],notin:[`is not one of the dates`,`is not the same as any date in`],between:[`is between`,`is between the dates in`],notbetween:[`is not between`,`is not between the dates in`]},_=(e,t)=>l(t?.context?.originalValue)?new Intl.DateTimeFormat(t?.context?.locales,{dateStyle:`full`,...t?.context?.dateFormat}).format(e.value):new Intl.DateTimeFormat(t?.context?.locales,{dateStyle:`full`,timeStyle:`long`,...t?.context?.dateTimeFormat}).format(e.value),v=e=>(t,n)=>{let r=n??{},i=(0,c.lc)(t.operator),a=``,{fieldData:o,quoteFieldNamesWith:s=[``,``],fieldIdentifierSeparator:l=``,operatorProcessor:u=c.defaultOperatorProcessorNL,wordOrder:f=`SVO`,context:p={},operatorMap:m=g}=r;if(!d(p.isDateField,t,r))return(0,c.defaultRuleProcessorNL)(t,r);if(t.valueSource===`field`)return(0,c.defaultRuleProcessorNL)(t,{...r,operatorMap:g});if((i===`in`||i===`notin`||i===`between`||i===`notbetween`)&&!t.value)return``;let h=(0,c.toArray)(t.value,{retainEmptyStrings:!1}),v=h.map(t=>[t,e.toDate(t)]).filter(t=>e.isValid(t[1]));switch(i){case`in`:case`notin`:if(v.length===0)return``;a=`(${v.map(e=>_({field:t.field,operator:`=`,value:e[1]},{...r,context:{...p,originalValue:e[0]}})).join(`, `)})`;break;case`between`:case`notbetween`:{if(v.length<2)return``;let[n,i]=v,o=e.isBefore(n[1],i[1])?[n,i]:[i,n];a=o.map(([e,n])=>_({field:t.field,operator:`=`,value:n},{...r,context:{...p,originalValue:e}})).join(` ${r.translations?.and??`and`} `)}break;default:{let[e,n]=v[0]??[``,``];a=e?_({field:t.field,operator:`=`,value:n},{...r,context:{...p,originalValue:e}}):``}}let y=(0,c.getQuotedFieldName)(o?.label??t.field,{quoteFieldNamesWith:s,fieldIdentifierSeparator:l}),b=u(t,{...r,operatorMap:{...g,...m}}),x={S:y,V:b,O:a};return(0,c.normalizeConstituentWordOrder)(f).map(e=>`${x[e]}`).join(` `).trim()},y=({toISOStringDateOnly:e,toISOString:t})=>(n,r)=>l(r?.context?.originalValue)?(0,c.defaultValueProcessorByRule)({...n,value:e(n.value)},r):(0,c.defaultValueProcessorByRule)({...n,value:t(n.value)},r),b=({toISOStringDateOnly:e,toISOString:t})=>(n,r)=>{let i=/^(?:small)?datetime/i.test(r?.fieldData?.datatype)?`datetimeoffset`:`date`,a=i===`datetimeoffset`?t(n.value):e(n.value);return(0,c.defaultValueProcessorByRule)({...n,value:a},{...r,wrapValueWith:[`cast(`,` as ${i})`]})},x=({toISOStringDateOnly:e,toISOString:t})=>(n,r)=>{let i=/^(?:datetime|timestamp)/i.test(r?.fieldData?.datatype)?`datetime`:`date`,a=i===`datetime`?t(n.value):e(n.value);return(0,c.defaultValueProcessorByRule)({...n,value:a},{...r,wrapValueWith:[`cast(`,` as ${i})`]})},S=({toISOStringDateOnly:e,toISOString:t})=>(n,r)=>{let i=/^timestamp/i.test(r?.fieldData?.datatype)?`timestamp`:`date`,a=i===`timestamp`?t(n.value).replaceAll(`T`,` `).replace(`Z`,` UTC`):e(n.value);return(0,c.defaultValueProcessorByRule)({...n,value:a},{...r,wrapValueWith:[i,``]})},C=({toISOStringDateOnly:e,toISOString:t})=>(n,r)=>{let i=/^timestamp/i.test(r?.fieldData?.datatype)?`timestamp`:`date`,a=i===`timestamp`?t(n.value):e(n.value);return(0,c.defaultValueProcessorByRule)({...n,value:a},{...r,wrapValueWith:[i,``]})},w={ansi:y,mssql:b,mysql:x,oracle:S,postgresql:C,sqlite:y},T=e=>(t,n)=>{let r=n??{},i=(0,c.mapSQLOperator)(t.operator),a=(0,c.lc)(i),{quoteFieldNamesWith:o=[``,``],fieldIdentifierSeparator:s=``,context:l={}}=r,u=``;if(t.valueSource===`field`||!d(l.isDateField,t,r))return(0,c.defaultRuleProcessorSQL)(t,r);let f=w[r.preset](e),p=(0,c.toArray)(t.value,{retainEmptyStrings:!1}),m=p.map(t=>[t,e.toDate(t)]).filter(t=>e.isValid(t[1]));switch(a){case`in`:case`not in`:if(m.length===0)return``;u=`(${m.map(e=>f({field:t.field,operator:`=`,value:e[1]},{...r,context:{originalValue:e[0]}})).join(`, `)})`;break;case`between`:case`not between`:{if(m.length<2)return``;let[n,i]=m,a=e.isBefore(n[1],i[1])?[n,i]:[i,n];u=a.map(([e,n])=>f({field:t.field,operator:`=`,value:n},{...r,context:{originalValue:e}})).join(` and `)}break;default:{let[e,n]=m[0]??[``,``];u=f({field:t.field,operator:`=`,value:n},{...r,context:{originalValue:e}})}}return`${(0,c.getQuotedFieldName)(t.field,{quoteFieldNamesWith:o,fieldIdentifierSeparator:s})} ${i} ${u}`.trim()};Object.defineProperty(exports,`__toESM`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`datetimeValueProcessorNL`,{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,`defaultDateTimeNLOperatorMap`,{enumerable:!0,get:function(){return g}}),Object.defineProperty(exports,`getDatetimeJsonLogicOperations`,{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,`getDatetimeRuleProcessorCEL`,{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,`getDatetimeRuleProcessorMongoDBQuery`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`getDatetimeRuleProcessorNL`,{enumerable:!0,get:function(){return v}}),Object.defineProperty(exports,`getDatetimeRuleProcessorSQL`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`getDatetimeValueProcessorANSI`,{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,`getDatetimeValueProcessorMSSQL`,{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,`getDatetimeValueProcessorMySQL`,{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,`getDatetimeValueProcessorOracle`,{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,`getDatetimeValueProcessorPostgreSQL`,{enumerable:!0,get:function(){return C}}),Object.defineProperty(exports,`isISOStringDateOnly`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`processIsDateField`,{enumerable:!0,get:function(){return d}});
2
- //# sourceMappingURL=getDatetimeRuleProcessorSQL-npwUe9aM.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDatetimeRuleProcessorSQL-npwUe9aM.js","names":["defaultIsDateField: IsDateFieldFunction","valueAsArray: string[]","mongoOperators","valueAsArray: string[]","defaultDateTimeNLOperatorMap: ExportOperatorMap","datetimeValueProcessorNL: ValueProcessorByRule","defaultOperatorProcessorNL","valueAsArray: string[]","valueAsArray: string[]"],"sources":["../../src/utils.ts","../../src/getDatetimeJsonLogicOperations.ts","../../src/getDatetimeRuleProcessorCEL.ts","../../src/getDatetimeRuleProcessorMongoDBQuery.ts","../../src/getDatetimeRuleProcessorNL.ts","../../src/getDatetimeRuleProcessorSQL.ts"],"sourcesContent":["import type { RuleProcessor } from 'react-querybuilder';\nimport type { IsDateField, IsDateFieldFunction } from './types';\n\nexport const isISOStringDateOnly = (\n date: unknown\n): date is `${number}${number}${number}${number}-${number}${number}-${number}${number}` =>\n typeof date === 'string' && /^\\d{4}-\\d{2}-\\d{2}$/.test(date);\n\nexport const defaultIsDateField: IsDateFieldFunction = (\n ...[rule, opts]: Parameters<RuleProcessor>\n): boolean =>\n rule.operator !== 'contains' &&\n rule.operator !== 'beginsWith' &&\n rule.operator !== 'endsWith' &&\n rule.operator !== 'doesNotContain' &&\n rule.operator !== 'doesNotBeginWith' &&\n rule.operator !== 'doesNotEndWith' &&\n rule.operator !== 'null' &&\n rule.operator !== 'notNull' &&\n /^(?:date|datetime|datetimeoffset|timestamp)\\b/i.test(opts?.fieldData?.datatype as string);\n\nexport const processIsDateField = (\n isDateField: IsDateField,\n ...[rule, opts]: Parameters<RuleProcessor>\n): boolean => {\n if (typeof isDateField === 'boolean') {\n return isDateField;\n }\n\n if (typeof isDateField === 'function') {\n return isDateField(rule, opts);\n }\n\n if (Array.isArray(isDateField)) {\n return isDateField.some(condition =>\n Object.entries(condition).every(([key, value]) => opts?.fieldData?.[key] === value)\n );\n }\n\n if (typeof isDateField === 'object') {\n return Object.entries(isDateField).every(([key, value]) => opts?.fieldData?.[key] === value);\n }\n\n return defaultIsDateField(rule, opts);\n};\n","import type { RQBDateTimeLibraryAPI, RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom operations for use with JsonLogic objects generated by\n * {@link datetimeRuleProcessorJsonLogic}.\n */\nexport const getDatetimeJsonLogicOperations = ({\n isAfter,\n isBefore,\n isSame,\n}: RQBDateTimeLibraryAPI): RQBJsonLogicDateTimeOperations => ({\n dateAfter: (a, b) => isAfter(a, b),\n dateBefore: (a, b) => isBefore(a, b),\n dateBetween: (a, b, c) =>\n isSame(b, a) ||\n isSame(b, c) ||\n (isAfter(b, a) && isBefore(b, c)) ||\n (isAfter(b, c) && isBefore(b, a)),\n dateNotBetween: (a, b, c) =>\n !isSame(b, a) &&\n !isSame(b, c) &&\n ((isBefore(a, c) && (isBefore(b, a) || isAfter(b, c))) ||\n (isAfter(a, c) && (isBefore(b, c) || isAfter(b, a)))),\n dateIn: (a, b) => b.some(v => isSame(a, v)),\n dateNotIn: (a, b) => b.every(v => !isSame(a, v)),\n dateNotOn: (a, b) => !isSame(a, b),\n dateOn: (a, b) => isSame(a, b),\n dateOnOrAfter: (a, b) => isAfter(a, b) || isSame(a, b),\n dateOnOrBefore: (a, b) => isBefore(a, b) || isSame(a, b),\n});\n","import type { RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorCEL, lc, toArray } from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { processIsDateField } from './utils';\n\nconst shouldNegate = (op: string) => /^(does)?not/i.test(op);\n\n/**\n * Generates a rule processor with date/time features for use by\n * {@link react-querybuilder!index.formatQuery formatQuery} with the \"cel\" format.\n */\nexport const getDatetimeRuleProcessorCEL =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const { context = {} } = opts;\n\n if (rule.valueSource === 'field' || !processIsDateField(context.isDateField, rule, opts)) {\n return defaultRuleProcessorCEL(rule, opts);\n }\n\n const ts = (d: string | Date) => `timestamp(\"${apiFns.toISOString(d)}\")`;\n\n const operatorTL = lc(rule.operator.replace(/^=$/, '=='));\n\n switch (operatorTL) {\n case '<':\n case '<=':\n case '==':\n case '!=':\n case '>':\n case '>=':\n return `${rule.field} ${operatorTL} ${ts(rule.value)}`;\n }\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map(v => apiFns.toDate(v))\n .filter(dateVal => apiFns.isValid(dateVal));\n\n switch (operatorTL) {\n case 'in':\n case 'notin': {\n if (valueAsDateArray.length === 0) return '';\n const [prefix, suffix] = shouldNegate(operatorTL) ? ['!(', ')'] : ['', ''];\n return `${prefix}${rule.field} in [${valueAsDateArray\n .map(val => ts(val))\n .join(', ')}]${suffix}`;\n }\n\n case 'between':\n case 'notbetween': {\n if (valueAsDateArray.length < 2) return '';\n const [first, second] = valueAsDateArray;\n const [firstDate, secondDate] = apiFns.isBefore(first, second)\n ? [first, second]\n : [second, first];\n return operatorTL === 'between'\n ? `(${rule.field} >= ${ts(firstDate)} && ${rule.field} <= ${ts(secondDate)})`\n : `(${rule.field} < ${ts(firstDate)} || ${rule.field} > ${ts(secondDate)})`;\n }\n }\n\n return defaultRuleProcessorCEL(rule, opts);\n };\n","import type { RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorMongoDBQuery, mongoOperators, toArray } from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { processIsDateField } from './utils';\n\n/**\n * Generates a rule processor with date/time features for use by\n * {@link react-querybuilder!index.formatQuery formatQuery} with the \"mongodb_query\" format.\n */\nexport const getDatetimeRuleProcessorMongoDBQuery =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const { field, operator, value, valueSource } = rule;\n\n if (valueSource === 'field' || !processIsDateField(opts.context?.isDateField, rule, opts)) {\n return defaultRuleProcessorMongoDBQuery(rule, opts);\n }\n\n if (operator === '=') {\n return { [field]: apiFns.toDate(value) };\n }\n\n switch (operator) {\n case '<':\n case '<=':\n case '!=':\n case '>':\n case '>=':\n return { [field]: { [mongoOperators[operator]]: apiFns.toDate(value) } };\n }\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map(v => apiFns.toDate(v))\n .filter(dateVal => apiFns.isValid(dateVal));\n\n switch (operator) {\n case 'in':\n case 'notIn':\n return { [field]: { [mongoOperators[operator]]: valueAsDateArray } };\n\n case 'between':\n case 'notBetween': {\n if (valueAsDateArray.length < 2) return '';\n const [first, second] = valueAsDateArray;\n const orderedArray = apiFns.isBefore(first, second) ? [first, second] : [second, first];\n return operator === 'between'\n ? { [field]: { $gte: orderedArray[0], $lte: orderedArray[1] } }\n : {\n $or: [{ [field]: { $lt: orderedArray[0] } }, { [field]: { $gt: orderedArray[1] } }],\n };\n }\n }\n\n return defaultRuleProcessorMongoDBQuery(rule, opts);\n };\n","import type { ExportOperatorMap, RuleProcessor, ValueProcessorByRule } from 'react-querybuilder';\nimport {\n defaultOperatorProcessorNL,\n defaultRuleProcessorNL,\n getQuotedFieldName,\n lc,\n normalizeConstituentWordOrder,\n toArray,\n} from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly, processIsDateField } from './utils';\n\nexport const defaultDateTimeNLOperatorMap: ExportOperatorMap = {\n // '=': 'is',\n // '!=': 'is not',\n '<': 'is before',\n '>': 'is after',\n '<=': 'is on or before',\n '>=': 'is on or after',\n in: ['is one of the dates', 'is the same as a date in'],\n notin: ['is not one of the dates', 'is not the same as any date in'],\n between: ['is between', 'is between the dates in'],\n notbetween: ['is not between', 'is not between the dates in'],\n};\n\n/**\n * Generates a value processor with date/time features for use by\n * {@link react-querybuilder!index.formatQuery formatQuery} with the \"natural_language\" format.\n */\nexport const datetimeValueProcessorNL: ValueProcessorByRule = (rule, opts) => {\n if (isISOStringDateOnly(opts?.context?.originalValue)) {\n return new Intl.DateTimeFormat(opts?.context?.locales, {\n dateStyle: 'full',\n ...opts?.context?.dateFormat,\n }).format(rule.value);\n }\n return new Intl.DateTimeFormat(opts?.context?.locales, {\n dateStyle: 'full',\n timeStyle: 'long',\n ...opts?.context?.dateTimeFormat,\n }).format(rule.value);\n};\n\n/**\n * Generates a rule processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"natural_language\" format.\n */\nexport const getDatetimeRuleProcessorNL =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const operatorLowerCase = lc(rule.operator);\n let finalValue = '';\n\n // istanbul ignore next\n const {\n fieldData,\n quoteFieldNamesWith = ['', ''] as [string, string],\n fieldIdentifierSeparator = '',\n operatorProcessor = defaultOperatorProcessorNL,\n // valueProcessor = datetimeValueProcessorNL,\n wordOrder = 'SVO',\n context = {},\n operatorMap = defaultDateTimeNLOperatorMap,\n } = opts;\n\n if (!processIsDateField(context.isDateField, rule, opts)) {\n return defaultRuleProcessorNL(rule, opts);\n }\n\n if (rule.valueSource === 'field') {\n return defaultRuleProcessorNL(rule, { ...opts, operatorMap: defaultDateTimeNLOperatorMap });\n }\n\n if (\n (operatorLowerCase === 'in' ||\n operatorLowerCase === 'notin' ||\n operatorLowerCase === 'between' ||\n operatorLowerCase === 'notbetween') &&\n !rule.value\n ) {\n return '';\n }\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map((v): [string, Date] => [v, apiFns.toDate(v)])\n .filter(v => apiFns.isValid(v[1]));\n\n switch (operatorLowerCase) {\n case 'in':\n case 'notin':\n {\n if (valueAsDateArray.length === 0) return '';\n finalValue = `(${valueAsDateArray\n .map(value =>\n datetimeValueProcessorNL(\n { field: rule.field, operator: '=', value: value[1] },\n { ...opts, context: { ...context, originalValue: value[0] } }\n )\n )\n .join(', ')})`;\n }\n break;\n\n case 'between':\n case 'notbetween':\n {\n if (valueAsDateArray.length < 2) return '';\n const [first, second] = valueAsDateArray;\n const orderedArray = apiFns.isBefore(first[1], second[1])\n ? [first, second]\n : [second, first];\n finalValue = orderedArray\n .map(([originalValue, value]) =>\n datetimeValueProcessorNL(\n { field: rule.field, operator: '=', value },\n { ...opts, context: { ...context, originalValue } }\n )\n )\n .join(` ${opts.translations?.and ?? 'and'} `);\n }\n break;\n\n default: {\n const [originalValue, value] = valueAsDateArray[0] ?? ['', ''];\n finalValue = originalValue\n ? datetimeValueProcessorNL(\n { field: rule.field, operator: '=', value },\n { ...opts, context: { ...context, originalValue } }\n )\n : '';\n }\n }\n\n const processedField = getQuotedFieldName(fieldData?.label ?? rule.field, {\n quoteFieldNamesWith,\n fieldIdentifierSeparator,\n });\n\n const processedOperator = operatorProcessor(rule, {\n ...opts,\n operatorMap: { ...defaultDateTimeNLOperatorMap, ...operatorMap },\n });\n\n const wordOrderMap = {\n S: processedField,\n V: processedOperator,\n O: finalValue,\n };\n\n return normalizeConstituentWordOrder(wordOrder)\n .map(term => `${wordOrderMap[term]}`)\n .join(' ')\n .trim();\n };\n","import type { RuleProcessor, SQLPreset, ValueProcessorByRule } from 'react-querybuilder';\nimport {\n defaultRuleProcessorSQL,\n defaultValueProcessorByRule,\n getQuotedFieldName,\n lc,\n mapSQLOperator,\n toArray,\n} from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly, processIsDateField } from './utils';\n\n/**\n * Generates a value processor with date/time features for use by\n * {@link react-querybuilder!index.formatQuery formatQuery} with the \"sql\" format and \"ansi\" preset.\n */\nexport const getDatetimeValueProcessorANSI =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n if (isISOStringDateOnly(opts?.context?.originalValue)) {\n return defaultValueProcessorByRule({ ...rule, value: toISOStringDateOnly(rule.value) }, opts);\n }\n return defaultValueProcessorByRule({ ...rule, value: toISOString(rule.value as Date) }, opts);\n };\n\n/**\n * Generates a value processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"sql\" format and \"mssql\" preset.\n */\nexport const getDatetimeValueProcessorMSSQL =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n const datatype = /^(?:small)?datetime/i.test(opts?.fieldData?.datatype as string)\n ? 'datetimeoffset'\n : 'date';\n const value =\n datatype === 'datetimeoffset' ? toISOString(rule.value) : toISOStringDateOnly(rule.value);\n return defaultValueProcessorByRule(\n { ...rule, value },\n { ...opts, wrapValueWith: [`cast(`, ` as ${datatype})`] }\n );\n };\n\n/**\n * Generates a value processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"sql\" format and \"mysql\" preset.\n */\nexport const getDatetimeValueProcessorMySQL =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n const datatype = /^(?:datetime|timestamp)/i.test(opts?.fieldData?.datatype as string)\n ? 'datetime'\n : 'date';\n const value =\n datatype === 'datetime' ? toISOString(rule.value) : toISOStringDateOnly(rule.value);\n return defaultValueProcessorByRule(\n { ...rule, value },\n { ...opts, wrapValueWith: [`cast(`, ` as ${datatype})`] }\n );\n };\n\n/**\n * Generates a value processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"sql\" format and \"oracle\" preset.\n */\nexport const getDatetimeValueProcessorOracle =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n // Oracle date format for _reading_ ISO 8601: 'YYYY-MM-DD\"T\"HH24:MI:SS.ff3\"Z\"'\n const datatype = /^timestamp/i.test(opts?.fieldData?.datatype as string) ? 'timestamp' : 'date';\n const value =\n datatype === 'timestamp'\n ? toISOString(rule.value).replaceAll('T', ' ').replace('Z', ' UTC')\n : toISOStringDateOnly(rule.value);\n return defaultValueProcessorByRule(\n { ...rule, value },\n { ...opts, wrapValueWith: [datatype, ``] }\n );\n };\n\n/**\n * Generates a value processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"sql\" format and \"postgresql\" preset.\n */\nexport const getDatetimeValueProcessorPostgreSQL =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n const datatype = /^timestamp/i.test(opts?.fieldData?.datatype as string) ? 'timestamp' : 'date';\n const value =\n datatype === 'timestamp' ? toISOString(rule.value) : toISOStringDateOnly(rule.value);\n return defaultValueProcessorByRule(\n { ...rule, value },\n { ...opts, wrapValueWith: [datatype, ``] }\n );\n };\n\nconst presetToValueProcessorMap = {\n ansi: getDatetimeValueProcessorANSI,\n mssql: getDatetimeValueProcessorMSSQL,\n mysql: getDatetimeValueProcessorMySQL,\n oracle: getDatetimeValueProcessorOracle,\n postgresql: getDatetimeValueProcessorPostgreSQL,\n sqlite: getDatetimeValueProcessorANSI,\n} satisfies Record<SQLPreset, (apiFns: RQBDateTimeLibraryAPI) => ValueProcessorByRule>;\n\n/**\n * Generates a rule processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"sql\" format.\n */\nexport const getDatetimeRuleProcessorSQL =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const operator = mapSQLOperator(rule.operator);\n const operatorLowerCase = lc(operator);\n // istanbul ignore next\n const {\n quoteFieldNamesWith = ['', ''] as [string, string],\n fieldIdentifierSeparator = '',\n context = {},\n } = opts;\n let finalValue = '';\n\n if (rule.valueSource === 'field' || !processIsDateField(context.isDateField, rule, opts)) {\n return defaultRuleProcessorSQL(rule, opts);\n }\n\n const valueProcessor = presetToValueProcessorMap[opts.preset!](apiFns);\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map((v): [string, Date] => [v, apiFns.toDate(v)])\n .filter(v => apiFns.isValid(v[1]));\n\n switch (operatorLowerCase) {\n case 'in':\n case 'not in':\n {\n if (valueAsDateArray.length === 0) return '';\n finalValue = `(${valueAsDateArray\n .map(value =>\n valueProcessor(\n { field: rule.field, operator: '=', value: value[1] },\n { ...opts, context: { originalValue: value[0] } }\n )\n )\n .join(', ')})`;\n }\n break;\n\n case 'between':\n case 'not between':\n {\n if (valueAsDateArray.length < 2) return '';\n const [first, second] = valueAsDateArray;\n const orderedArray = apiFns.isBefore(first[1], second[1])\n ? [first, second]\n : [second, first];\n finalValue = orderedArray\n .map(([originalValue, value]) =>\n valueProcessor(\n { field: rule.field, operator: '=', value },\n { ...opts, context: { originalValue } }\n )\n )\n .join(' and ');\n }\n break;\n\n default: {\n const [originalValue, value] = valueAsDateArray[0] ?? ['', ''];\n finalValue = valueProcessor(\n { field: rule.field, operator: '=', value },\n { ...opts, context: { originalValue } }\n );\n }\n }\n\n return `${getQuotedFieldName(rule.field, { quoteFieldNamesWith, fieldIdentifierSeparator })} ${operator} ${finalValue}`.trim();\n };\n"],"mappings":"ugBAGa,EACX,GAEA,OAAO,GAAS,UAAY,sBAAsB,KAAK,GAE5CA,GACX,GAAG,CAAC,EAAM,KAEV,EAAK,WAAa,YAClB,EAAK,WAAa,cAClB,EAAK,W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AAK,EAAO,QAAQ,EAAE,KAEhC,OAAQ,EAAR,CACE,IAAK,KACL,IAAK,SAED,GAAI,EAAiB,SAAW,EAAG,MAAO,GAC1C,EAAa,IAAI,EACd,IAAI,GACH,EACE,CAAE,MAAO,EAAK,MAAO,SAAU,IAAK,MAAO,EAAM,IACjD,CAAE,GAAG,EAAM,QAAS,CAAE,cAAe,EAAM,OAG9C,KAAK,MAAM,GAEhB,MAEF,IAAK,UACL,IAAK,cACH,CACE,GAAI,EAAiB,OAAS,EAAG,MAAO,GACxC,GAAM,CAAC,EAAO,GAAU,EAClB,EAAe,EAAO,SAAS,EAAM,GAAI,EAAO,IAClD,CAAC,EAAO,GACR,CAAC,EAAQ,GACb,EAAa,EACV,KAAK,CAAC,EAAe,KACpB,EACE,CAAE,MAAO,EAAK,MAAO,SAAU,IAAK,SACpC,CAAE,GAAG,EAAM,QAAS,CAAE,oBAGzB,KAAK,SAEV,MAEF,QAAS,CACP,GAAM,CAAC,EAAe,GAAS,EAAiB,IAAM,CAAC,GAAI,IAC3D,EAAa,EACX,CAAE,MAAO,EAAK,MAAO,SAAU,IAAK,SACpC,CAAE,GAAG,EAAM,QAAS,CAAE,oBAK5B,MAAO,IAAA,EAAA,EAAA,oBAAsB,EAAK,MAAO,CAAE,sBAAqB,6BAA4B,GAAG,EAAS,GAAG,IAAa"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDatetimeRuleProcessorSQL-CocyaiI5.mjs","names":["defaultIsDateField: IsDateFieldFunction","valueAsArray: string[]","valueAsArray: string[]","defaultDateTimeNLOperatorMap: ExportOperatorMap","datetimeValueProcessorNL: ValueProcessorByRule","valueAsArray: string[]","valueAsArray: string[]"],"sources":["../src/utils.ts","../src/getDatetimeJsonLogicOperations.ts","../src/getDatetimeRuleProcessorCEL.ts","../src/getDatetimeRuleProcessorMongoDBQuery.ts","../src/getDatetimeRuleProcessorNL.ts","../src/getDatetimeRuleProcessorSQL.ts"],"sourcesContent":["import type { RuleProcessor } from 'react-querybuilder';\nimport type { IsDateField, IsDateFieldFunction } from './types';\n\nexport const isISOStringDateOnly = (\n date: unknown\n): date is `${number}${number}${number}${number}-${number}${number}-${number}${number}` =>\n typeof date === 'string' && /^\\d{4}-\\d{2}-\\d{2}$/.test(date);\n\nexport const defaultIsDateField: IsDateFieldFunction = (\n ...[rule, opts]: Parameters<RuleProcessor>\n): boolean =>\n rule.operator !== 'contains' &&\n rule.operator !== 'beginsWith' &&\n rule.operator !== 'endsWith' &&\n rule.operator !== 'doesNotContain' &&\n rule.operator !== 'doesNotBeginWith' &&\n rule.operator !== 'doesNotEndWith' &&\n rule.operator !== 'null' &&\n rule.operator !== 'notNull' &&\n /^(?:date|datetime|datetimeoffset|timestamp)\\b/i.test(opts?.fieldData?.datatype as string);\n\nexport const processIsDateField = (\n isDateField: IsDateField,\n ...[rule, opts]: Parameters<RuleProcessor>\n): boolean => {\n if (typeof isDateField === 'boolean') {\n return isDateField;\n }\n\n if (typeof isDateField === 'function') {\n return isDateField(rule, opts);\n }\n\n if (Array.isArray(isDateField)) {\n return isDateField.some(condition =>\n Object.entries(condition).every(([key, value]) => opts?.fieldData?.[key] === value)\n );\n }\n\n if (typeof isDateField === 'object') {\n return Object.entries(isDateField).every(([key, value]) => opts?.fieldData?.[key] === value);\n }\n\n return defaultIsDateField(rule, opts);\n};\n","import type { RQBDateTimeLibraryAPI, RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom operations for use with JsonLogic objects generated by\n * {@link datetimeRuleProcessorJsonLogic}.\n */\nexport const getDatetimeJsonLogicOperations = ({\n isAfter,\n isBefore,\n isSame,\n}: RQBDateTimeLibraryAPI): RQBJsonLogicDateTimeOperations => ({\n dateAfter: (a, b) => isAfter(a, b),\n dateBefore: (a, b) => isBefore(a, b),\n dateBetween: (a, b, c) =>\n isSame(b, a) ||\n isSame(b, c) ||\n (isAfter(b, a) && isBefore(b, c)) ||\n (isAfter(b, c) && isBefore(b, a)),\n dateNotBetween: (a, b, c) =>\n !isSame(b, a) &&\n !isSame(b, c) &&\n ((isBefore(a, c) && (isBefore(b, a) || isAfter(b, c))) ||\n (isAfter(a, c) && (isBefore(b, c) || isAfter(b, a)))),\n dateIn: (a, b) => b.some(v => isSame(a, v)),\n dateNotIn: (a, b) => b.every(v => !isSame(a, v)),\n dateNotOn: (a, b) => !isSame(a, b),\n dateOn: (a, b) => isSame(a, b),\n dateOnOrAfter: (a, b) => isAfter(a, b) || isSame(a, b),\n dateOnOrBefore: (a, b) => isBefore(a, b) || isSame(a, b),\n});\n","import type { RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorCEL, lc, toArray } from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { processIsDateField } from './utils';\n\nconst shouldNegate = (op: string) => /^(does)?not/i.test(op);\n\n/**\n * Generates a rule processor with date/time features for use by\n * {@link react-querybuilder!index.formatQuery formatQuery} with the \"cel\" format.\n */\nexport const getDatetimeRuleProcessorCEL =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const { context = {} } = opts;\n\n if (rule.valueSource === 'field' || !processIsDateField(context.isDateField, rule, opts)) {\n return defaultRuleProcessorCEL(rule, opts);\n }\n\n const ts = (d: string | Date) => `timestamp(\"${apiFns.toISOString(d)}\")`;\n\n const operatorTL = lc(rule.operator.replace(/^=$/, '=='));\n\n switch (operatorTL) {\n case '<':\n case '<=':\n case '==':\n case '!=':\n case '>':\n case '>=':\n return `${rule.field} ${operatorTL} ${ts(rule.value)}`;\n }\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map(v => apiFns.toDate(v))\n .filter(dateVal => apiFns.isValid(dateVal));\n\n switch (operatorTL) {\n case 'in':\n case 'notin': {\n if (valueAsDateArray.length === 0) return '';\n const [prefix, suffix] = shouldNegate(operatorTL) ? ['!(', ')'] : ['', ''];\n return `${prefix}${rule.field} in [${valueAsDateArray\n .map(val => ts(val))\n .join(', ')}]${suffix}`;\n }\n\n case 'between':\n case 'notbetween': {\n if (valueAsDateArray.length < 2) return '';\n const [first, second] = valueAsDateArray;\n const [firstDate, secondDate] = apiFns.isBefore(first, second)\n ? [first, second]\n : [second, first];\n return operatorTL === 'between'\n ? `(${rule.field} >= ${ts(firstDate)} && ${rule.field} <= ${ts(secondDate)})`\n : `(${rule.field} < ${ts(firstDate)} || ${rule.field} > ${ts(secondDate)})`;\n }\n }\n\n return defaultRuleProcessorCEL(rule, opts);\n };\n","import type { RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorMongoDBQuery, mongoOperators, toArray } from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { processIsDateField } from './utils';\n\n/**\n * Generates a rule processor with date/time features for use by\n * {@link react-querybuilder!index.formatQuery formatQuery} with the \"mongodb_query\" format.\n */\nexport const getDatetimeRuleProcessorMongoDBQuery =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const { field, operator, value, valueSource } = rule;\n\n if (valueSource === 'field' || !processIsDateField(opts.context?.isDateField, rule, opts)) {\n return defaultRuleProcessorMongoDBQuery(rule, opts);\n }\n\n if (operator === '=') {\n return { [field]: apiFns.toDate(value) };\n }\n\n switch (operator) {\n case '<':\n case '<=':\n case '!=':\n case '>':\n case '>=':\n return { [field]: { [mongoOperators[operator]]: apiFns.toDate(value) } };\n }\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map(v => apiFns.toDate(v))\n .filter(dateVal => apiFns.isValid(dateVal));\n\n switch (operator) {\n case 'in':\n case 'notIn':\n return { [field]: { [mongoOperators[operator]]: valueAsDateArray } };\n\n case 'between':\n case 'notBetween': {\n if (valueAsDateArray.length < 2) return '';\n const [first, second] = valueAsDateArray;\n const orderedArray = apiFns.isBefore(first, second) ? [first, second] : [second, first];\n return operator === 'between'\n ? { [field]: { $gte: orderedArray[0], $lte: orderedArray[1] } }\n : {\n $or: [{ [field]: { $lt: orderedArray[0] } }, { [field]: { $gt: orderedArray[1] } }],\n };\n }\n }\n\n return defaultRuleProcessorMongoDBQuery(rule, opts);\n };\n","import type { ExportOperatorMap, RuleProcessor, ValueProcessorByRule } from 'react-querybuilder';\nimport {\n defaultOperatorProcessorNL,\n defaultRuleProcessorNL,\n getQuotedFieldName,\n lc,\n normalizeConstituentWordOrder,\n toArray,\n} from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly, processIsDateField } from './utils';\n\nexport const defaultDateTimeNLOperatorMap: ExportOperatorMap = {\n // '=': 'is',\n // '!=': 'is not',\n '<': 'is before',\n '>': 'is after',\n '<=': 'is on or before',\n '>=': 'is on or after',\n in: ['is one of the dates', 'is the same as a date in'],\n notin: ['is not one of the dates', 'is not the same as any date in'],\n between: ['is between', 'is between the dates in'],\n notbetween: ['is not between', 'is not between the dates in'],\n};\n\n/**\n * Generates a value processor with date/time features for use by\n * {@link react-querybuilder!index.formatQuery formatQuery} with the \"natural_language\" format.\n */\nexport const datetimeValueProcessorNL: ValueProcessorByRule = (rule, opts) => {\n if (isISOStringDateOnly(opts?.context?.originalValue)) {\n return new Intl.DateTimeFormat(opts?.context?.locales, {\n dateStyle: 'full',\n ...opts?.context?.dateFormat,\n }).format(rule.value);\n }\n return new Intl.DateTimeFormat(opts?.context?.locales, {\n dateStyle: 'full',\n timeStyle: 'long',\n ...opts?.context?.dateTimeFormat,\n }).format(rule.value);\n};\n\n/**\n * Generates a rule processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"natural_language\" format.\n */\nexport const getDatetimeRuleProcessorNL =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const operatorLowerCase = lc(rule.operator);\n let finalValue = '';\n\n // istanbul ignore next\n const {\n fieldData,\n quoteFieldNamesWith = ['', ''] as [string, string],\n fieldIdentifierSeparator = '',\n operatorProcessor = defaultOperatorProcessorNL,\n // valueProcessor = datetimeValueProcessorNL,\n wordOrder = 'SVO',\n context = {},\n operatorMap = defaultDateTimeNLOperatorMap,\n } = opts;\n\n if (!processIsDateField(context.isDateField, rule, opts)) {\n return defaultRuleProcessorNL(rule, opts);\n }\n\n if (rule.valueSource === 'field') {\n return defaultRuleProcessorNL(rule, { ...opts, operatorMap: defaultDateTimeNLOperatorMap });\n }\n\n if (\n (operatorLowerCase === 'in' ||\n operatorLowerCase === 'notin' ||\n operatorLowerCase === 'between' ||\n operatorLowerCase === 'notbetween') &&\n !rule.value\n ) {\n return '';\n }\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map((v): [string, Date] => [v, apiFns.toDate(v)])\n .filter(v => apiFns.isValid(v[1]));\n\n switch (operatorLowerCase) {\n case 'in':\n case 'notin':\n {\n if (valueAsDateArray.length === 0) return '';\n finalValue = `(${valueAsDateArray\n .map(value =>\n datetimeValueProcessorNL(\n { field: rule.field, operator: '=', value: value[1] },\n { ...opts, context: { ...context, originalValue: value[0] } }\n )\n )\n .join(', ')})`;\n }\n break;\n\n case 'between':\n case 'notbetween':\n {\n if (valueAsDateArray.length < 2) return '';\n const [first, second] = valueAsDateArray;\n const orderedArray = apiFns.isBefore(first[1], second[1])\n ? [first, second]\n : [second, first];\n finalValue = orderedArray\n .map(([originalValue, value]) =>\n datetimeValueProcessorNL(\n { field: rule.field, operator: '=', value },\n { ...opts, context: { ...context, originalValue } }\n )\n )\n .join(` ${opts.translations?.and ?? 'and'} `);\n }\n break;\n\n default: {\n const [originalValue, value] = valueAsDateArray[0] ?? ['', ''];\n finalValue = originalValue\n ? datetimeValueProcessorNL(\n { field: rule.field, operator: '=', value },\n { ...opts, context: { ...context, originalValue } }\n )\n : '';\n }\n }\n\n const processedField = getQuotedFieldName(fieldData?.label ?? rule.field, {\n quoteFieldNamesWith,\n fieldIdentifierSeparator,\n });\n\n const processedOperator = operatorProcessor(rule, {\n ...opts,\n operatorMap: { ...defaultDateTimeNLOperatorMap, ...operatorMap },\n });\n\n const wordOrderMap = {\n S: processedField,\n V: processedOperator,\n O: finalValue,\n };\n\n return normalizeConstituentWordOrder(wordOrder)\n .map(term => `${wordOrderMap[term]}`)\n .join(' ')\n .trim();\n };\n","import type { RuleProcessor, SQLPreset, ValueProcessorByRule } from 'react-querybuilder';\nimport {\n defaultRuleProcessorSQL,\n defaultValueProcessorByRule,\n getQuotedFieldName,\n lc,\n mapSQLOperator,\n toArray,\n} from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly, processIsDateField } from './utils';\n\n/**\n * Generates a value processor with date/time features for use by\n * {@link react-querybuilder!index.formatQuery formatQuery} with the \"sql\" format and \"ansi\" preset.\n */\nexport const getDatetimeValueProcessorANSI =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n if (isISOStringDateOnly(opts?.context?.originalValue)) {\n return defaultValueProcessorByRule({ ...rule, value: toISOStringDateOnly(rule.value) }, opts);\n }\n return defaultValueProcessorByRule({ ...rule, value: toISOString(rule.value as Date) }, opts);\n };\n\n/**\n * Generates a value processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"sql\" format and \"mssql\" preset.\n */\nexport const getDatetimeValueProcessorMSSQL =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n const datatype = /^(?:small)?datetime/i.test(opts?.fieldData?.datatype as string)\n ? 'datetimeoffset'\n : 'date';\n const value =\n datatype === 'datetimeoffset' ? toISOString(rule.value) : toISOStringDateOnly(rule.value);\n return defaultValueProcessorByRule(\n { ...rule, value },\n { ...opts, wrapValueWith: [`cast(`, ` as ${datatype})`] }\n );\n };\n\n/**\n * Generates a value processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"sql\" format and \"mysql\" preset.\n */\nexport const getDatetimeValueProcessorMySQL =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n const datatype = /^(?:datetime|timestamp)/i.test(opts?.fieldData?.datatype as string)\n ? 'datetime'\n : 'date';\n const value =\n datatype === 'datetime' ? toISOString(rule.value) : toISOStringDateOnly(rule.value);\n return defaultValueProcessorByRule(\n { ...rule, value },\n { ...opts, wrapValueWith: [`cast(`, ` as ${datatype})`] }\n );\n };\n\n/**\n * Generates a value processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"sql\" format and \"oracle\" preset.\n */\nexport const getDatetimeValueProcessorOracle =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n // Oracle date format for _reading_ ISO 8601: 'YYYY-MM-DD\"T\"HH24:MI:SS.ff3\"Z\"'\n const datatype = /^timestamp/i.test(opts?.fieldData?.datatype as string) ? 'timestamp' : 'date';\n const value =\n datatype === 'timestamp'\n ? toISOString(rule.value).replaceAll('T', ' ').replace('Z', ' UTC')\n : toISOStringDateOnly(rule.value);\n return defaultValueProcessorByRule(\n { ...rule, value },\n { ...opts, wrapValueWith: [datatype, ``] }\n );\n };\n\n/**\n * Generates a value processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"sql\" format and \"postgresql\" preset.\n */\nexport const getDatetimeValueProcessorPostgreSQL =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n const datatype = /^timestamp/i.test(opts?.fieldData?.datatype as string) ? 'timestamp' : 'date';\n const value =\n datatype === 'timestamp' ? toISOString(rule.value) : toISOStringDateOnly(rule.value);\n return defaultValueProcessorByRule(\n { ...rule, value },\n { ...opts, wrapValueWith: [datatype, ``] }\n );\n };\n\nconst presetToValueProcessorMap = {\n ansi: getDatetimeValueProcessorANSI,\n mssql: getDatetimeValueProcessorMSSQL,\n mysql: getDatetimeValueProcessorMySQL,\n oracle: getDatetimeValueProcessorOracle,\n postgresql: getDatetimeValueProcessorPostgreSQL,\n sqlite: getDatetimeValueProcessorANSI,\n} satisfies Record<SQLPreset, (apiFns: RQBDateTimeLibraryAPI) => ValueProcessorByRule>;\n\n/**\n * Generates a rule processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"sql\" format.\n */\nexport const getDatetimeRuleProcessorSQL =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const operator = mapSQLOperator(rule.operator);\n const operatorLowerCase = lc(operator);\n // istanbul ignore next\n const {\n quoteFieldNamesWith = ['', ''] as [string, string],\n fieldIdentifierSeparator = '',\n context = {},\n } = opts;\n let finalValue = '';\n\n if (rule.valueSource === 'field' || !processIsDateField(context.isDateField, rule, opts)) {\n return defaultRuleProcessorSQL(rule, opts);\n }\n\n const valueProcessor = presetToValueProcessorMap[opts.preset!](apiFns);\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map((v): [string, Date] => [v, apiFns.toDate(v)])\n .filter(v => apiFns.isValid(v[1]));\n\n switch (operatorLowerCase) {\n case 'in':\n case 'not in':\n {\n if (valueAsDateArray.length === 0) return '';\n finalValue = `(${valueAsDateArray\n .map(value =>\n valueProcessor(\n { field: rule.field, operator: '=', value: value[1] },\n { ...opts, context: { originalValue: value[0] } }\n )\n )\n .join(', ')})`;\n }\n break;\n\n case 'between':\n case 'not between':\n {\n if (valueAsDateArray.length < 2) return '';\n const [first, second] = valueAsDateArray;\n const orderedArray = apiFns.isBefore(first[1], second[1])\n ? [first, second]\n : [second, first];\n finalValue = orderedArray\n .map(([originalValue, value]) =>\n valueProcessor(\n { field: rule.field, operator: '=', value },\n { ...opts, context: { originalValue } }\n )\n )\n .join(' and ');\n }\n break;\n\n default: {\n const [originalValue, value] = valueAsDateArray[0] ?? ['', ''];\n finalValue = valueProcessor(\n { field: rule.field, operator: '=', value },\n { ...opts, context: { originalValue } }\n );\n }\n }\n\n return `${getQuotedFieldName(rule.field, { quoteFieldNamesWith, fieldIdentifierSeparator })} ${operator} ${finalValue}`.trim();\n };\n"],"mappings":";;;AAGA,MAAa,uBACX,SAEA,OAAO,SAAS,YAAY,sBAAsB,KAAK;AAEzD,MAAaA,sBACX,GAAG,CAAC,MAAM,UAEV,KAAK,aAAa,cAClB,KAAK,aAAa,gBAClB,KAAK,aAAa,cAClB,KAAK,aAAa,oBAClB,KAAK,aAAa,sBAClB,KAAK,aAAa,oBAClB,KAAK,aAAa,UAClB,KAAK,aAAa,aAClB,iDAAiD,KAAK,MAAM,WAAW;AAEzE,MAAa,sBACX,aACA,GAAG,CAAC,MAAM,UACE;AACZ,KAAI,OAAO,gBAAgB,UACzB,QAAO;AAGT,KAAI,OAAO,gBAAgB,WACzB,QAAO,YAAY,MAAM;AAG3B,KAAI,MAAM,QAAQ,aAChB,QAAO,YAAY,MAAK,cACtB,OAAO,QAAQ,WAAW,OAAO,CAAC,KAAK,WAAW,MAAM,YAAY,SAAS;AAIjF,KAAI,OAAO,gBAAgB,SACzB,QAAO,OAAO,QAAQ,aAAa,OAAO,CAAC,KAAK,WAAW,MAAM,YAAY,SAAS;AAGxF,QAAO,mBAAmB,MAAM;;;;;;;;;ACrClC,MAAa,kCAAkC,EAC7C,SACA,UACA,cAC4D;CAC5D,YAAY,GAAG,MAAM,QAAQ,GAAG;CAChC,aAAa,GAAG,MAAM,SAAS,GAAG;CAClC,cAAc,GAAG,GAAG,MAClB,OAAO,GAAG,MACV,OAAO,GAAG,MACT,QAAQ,GAAG,MAAM,SAAS,GAAG,MAC7B,QAAQ,GAAG,MAAM,SAAS,GAAG;CAChC,iBAAiB,GAAG,GAAG,MACrB,CAAC,OAAO,GAAG,MACX,CAAC,O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,iBAAiB,MAAM,CAAC,IAAI;AAC3D,gBAAa,eACX;IAAE,OAAO,KAAK;IAAO,UAAU;IAAK;MACpC;IAAE,GAAG;IAAM,SAAS,EAAE;;;;AAK5B,QAAO,GAAG,mBAAmB,KAAK,OAAO;EAAE;EAAqB;IAA4B,GAAG,SAAS,GAAG,aAAa"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getDatetimeRuleProcessorSQL-CutYTD23.js","names":["defaultIsDateField: IsDateFieldFunction","valueAsArray: string[]","valueAsArray: string[]","o","r","defaultDateTimeNLOperatorMap: ExportOperatorMap","datetimeValueProcessorNL: ValueProcessorByRule","valueAsArray: string[]","valueAsArray: string[]"],"sources":["../src/utils.ts","../src/getDatetimeJsonLogicOperations.ts","../src/getDatetimeRuleProcessorCEL.ts","../src/getDatetimeRuleProcessorMongoDBQuery.ts","../../../node_modules/tsdown/node_modules/rolldown/node_modules/@oxc-project/runtime/src/helpers/esm/typeof.js","../../../node_modules/tsdown/node_modules/rolldown/node_modules/@oxc-project/runtime/src/helpers/esm/toPrimitive.js","../../../node_modules/tsdown/node_modules/rolldown/node_modules/@oxc-project/runtime/src/helpers/esm/toPropertyKey.js","../../../node_modules/tsdown/node_modules/rolldown/node_modules/@oxc-project/runtime/src/helpers/esm/defineProperty.js","../../../node_modules/tsdown/node_modules/rolldown/node_modules/@oxc-project/runtime/src/helpers/esm/objectSpread2.js","../src/getDatetimeRuleProcessorNL.ts","../src/getDatetimeRuleProcessorSQL.ts"],"sourcesContent":["import type { RuleProcessor } from 'react-querybuilder';\nimport type { IsDateField, IsDateFieldFunction } from './types';\n\nexport const isISOStringDateOnly = (\n date: unknown\n): date is `${number}${number}${number}${number}-${number}${number}-${number}${number}` =>\n typeof date === 'string' && /^\\d{4}-\\d{2}-\\d{2}$/.test(date);\n\nexport const defaultIsDateField: IsDateFieldFunction = (\n ...[rule, opts]: Parameters<RuleProcessor>\n): boolean =>\n rule.operator !== 'contains' &&\n rule.operator !== 'beginsWith' &&\n rule.operator !== 'endsWith' &&\n rule.operator !== 'doesNotContain' &&\n rule.operator !== 'doesNotBeginWith' &&\n rule.operator !== 'doesNotEndWith' &&\n rule.operator !== 'null' &&\n rule.operator !== 'notNull' &&\n /^(?:date|datetime|datetimeoffset|timestamp)\\b/i.test(opts?.fieldData?.datatype as string);\n\nexport const processIsDateField = (\n isDateField: IsDateField,\n ...[rule, opts]: Parameters<RuleProcessor>\n): boolean => {\n if (typeof isDateField === 'boolean') {\n return isDateField;\n }\n\n if (typeof isDateField === 'function') {\n return isDateField(rule, opts);\n }\n\n if (Array.isArray(isDateField)) {\n return isDateField.some(condition =>\n Object.entries(condition).every(([key, value]) => opts?.fieldData?.[key] === value)\n );\n }\n\n if (typeof isDateField === 'object') {\n return Object.entries(isDateField).every(([key, value]) => opts?.fieldData?.[key] === value);\n }\n\n return defaultIsDateField(rule, opts);\n};\n","import type { RQBDateTimeLibraryAPI, RQBJsonLogicDateTimeOperations } from './types';\n\n/**\n * Custom operations for use with JsonLogic objects generated by\n * {@link datetimeRuleProcessorJsonLogic}.\n */\nexport const getDatetimeJsonLogicOperations = ({\n isAfter,\n isBefore,\n isSame,\n}: RQBDateTimeLibraryAPI): RQBJsonLogicDateTimeOperations => ({\n dateAfter: (a, b) => isAfter(a, b),\n dateBefore: (a, b) => isBefore(a, b),\n dateBetween: (a, b, c) =>\n isSame(b, a) ||\n isSame(b, c) ||\n (isAfter(b, a) && isBefore(b, c)) ||\n (isAfter(b, c) && isBefore(b, a)),\n dateNotBetween: (a, b, c) =>\n !isSame(b, a) &&\n !isSame(b, c) &&\n ((isBefore(a, c) && (isBefore(b, a) || isAfter(b, c))) ||\n (isAfter(a, c) && (isBefore(b, c) || isAfter(b, a)))),\n dateIn: (a, b) => b.some(v => isSame(a, v)),\n dateNotIn: (a, b) => b.every(v => !isSame(a, v)),\n dateNotOn: (a, b) => !isSame(a, b),\n dateOn: (a, b) => isSame(a, b),\n dateOnOrAfter: (a, b) => isAfter(a, b) || isSame(a, b),\n dateOnOrBefore: (a, b) => isBefore(a, b) || isSame(a, b),\n});\n","import type { RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorCEL, lc, toArray } from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { processIsDateField } from './utils';\n\nconst shouldNegate = (op: string) => /^(does)?not/i.test(op);\n\n/**\n * Generates a rule processor with date/time features for use by\n * {@link react-querybuilder!index.formatQuery formatQuery} with the \"cel\" format.\n */\nexport const getDatetimeRuleProcessorCEL =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const { context = {} } = opts;\n\n if (rule.valueSource === 'field' || !processIsDateField(context.isDateField, rule, opts)) {\n return defaultRuleProcessorCEL(rule, opts);\n }\n\n const ts = (d: string | Date) => `timestamp(\"${apiFns.toISOString(d)}\")`;\n\n const operatorTL = lc(rule.operator.replace(/^=$/, '=='));\n\n switch (operatorTL) {\n case '<':\n case '<=':\n case '==':\n case '!=':\n case '>':\n case '>=':\n return `${rule.field} ${operatorTL} ${ts(rule.value)}`;\n }\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map(v => apiFns.toDate(v))\n .filter(dateVal => apiFns.isValid(dateVal));\n\n switch (operatorTL) {\n case 'in':\n case 'notin': {\n if (valueAsDateArray.length === 0) return '';\n const [prefix, suffix] = shouldNegate(operatorTL) ? ['!(', ')'] : ['', ''];\n return `${prefix}${rule.field} in [${valueAsDateArray\n .map(val => ts(val))\n .join(', ')}]${suffix}`;\n }\n\n case 'between':\n case 'notbetween': {\n if (valueAsDateArray.length < 2) return '';\n const [first, second] = valueAsDateArray;\n const [firstDate, secondDate] = apiFns.isBefore(first, second)\n ? [first, second]\n : [second, first];\n return operatorTL === 'between'\n ? `(${rule.field} >= ${ts(firstDate)} && ${rule.field} <= ${ts(secondDate)})`\n : `(${rule.field} < ${ts(firstDate)} || ${rule.field} > ${ts(secondDate)})`;\n }\n }\n\n return defaultRuleProcessorCEL(rule, opts);\n };\n","import type { RuleProcessor } from 'react-querybuilder';\nimport { defaultRuleProcessorMongoDBQuery, mongoOperators, toArray } from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { processIsDateField } from './utils';\n\n/**\n * Generates a rule processor with date/time features for use by\n * {@link react-querybuilder!index.formatQuery formatQuery} with the \"mongodb_query\" format.\n */\nexport const getDatetimeRuleProcessorMongoDBQuery =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const { field, operator, value, valueSource } = rule;\n\n if (valueSource === 'field' || !processIsDateField(opts.context?.isDateField, rule, opts)) {\n return defaultRuleProcessorMongoDBQuery(rule, opts);\n }\n\n if (operator === '=') {\n return { [field]: apiFns.toDate(value) };\n }\n\n switch (operator) {\n case '<':\n case '<=':\n case '!=':\n case '>':\n case '>=':\n return { [field]: { [mongoOperators[operator]]: apiFns.toDate(value) } };\n }\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map(v => apiFns.toDate(v))\n .filter(dateVal => apiFns.isValid(dateVal));\n\n switch (operator) {\n case 'in':\n case 'notIn':\n return { [field]: { [mongoOperators[operator]]: valueAsDateArray } };\n\n case 'between':\n case 'notBetween': {\n if (valueAsDateArray.length < 2) return '';\n const [first, second] = valueAsDateArray;\n const orderedArray = apiFns.isBefore(first, second) ? [first, second] : [second, first];\n return operator === 'between'\n ? { [field]: { $gte: orderedArray[0], $lte: orderedArray[1] } }\n : {\n $or: [{ [field]: { $lt: orderedArray[0] } }, { [field]: { $gt: orderedArray[1] } }],\n };\n }\n }\n\n return defaultRuleProcessorMongoDBQuery(rule, opts);\n };\n","function _typeof(o) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) {\n return typeof o;\n } : function (o) {\n return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o;\n }, _typeof(o);\n}\nexport { _typeof as default };","import _typeof from \"./typeof.js\";\nfunction toPrimitive(t, r) {\n if (\"object\" != _typeof(t) || !t) return t;\n var e = t[Symbol.toPrimitive];\n if (void 0 !== e) {\n var i = e.call(t, r || \"default\");\n if (\"object\" != _typeof(i)) return i;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (\"string\" === r ? String : Number)(t);\n}\nexport { toPrimitive as default };","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nfunction toPropertyKey(t) {\n var i = toPrimitive(t, \"string\");\n return \"symbol\" == _typeof(i) ? i : i + \"\";\n}\nexport { toPropertyKey as default };","import toPropertyKey from \"./toPropertyKey.js\";\nfunction _defineProperty(e, r, t) {\n return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {\n value: t,\n enumerable: !0,\n configurable: !0,\n writable: !0\n }) : e[r] = t, e;\n}\nexport { _defineProperty as default };","import defineProperty from \"./defineProperty.js\";\nfunction ownKeys(e, r) {\n var t = Object.keys(e);\n if (Object.getOwnPropertySymbols) {\n var o = Object.getOwnPropertySymbols(e);\n r && (o = o.filter(function (r) {\n return Object.getOwnPropertyDescriptor(e, r).enumerable;\n })), t.push.apply(t, o);\n }\n return t;\n}\nfunction _objectSpread2(e) {\n for (var r = 1; r < arguments.length; r++) {\n var t = null != arguments[r] ? arguments[r] : {};\n r % 2 ? ownKeys(Object(t), !0).forEach(function (r) {\n defineProperty(e, r, t[r]);\n }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {\n Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));\n });\n }\n return e;\n}\nexport { _objectSpread2 as default };","import type { ExportOperatorMap, RuleProcessor, ValueProcessorByRule } from 'react-querybuilder';\nimport {\n defaultOperatorProcessorNL,\n defaultRuleProcessorNL,\n getQuotedFieldName,\n lc,\n normalizeConstituentWordOrder,\n toArray,\n} from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly, processIsDateField } from './utils';\n\nexport const defaultDateTimeNLOperatorMap: ExportOperatorMap = {\n // '=': 'is',\n // '!=': 'is not',\n '<': 'is before',\n '>': 'is after',\n '<=': 'is on or before',\n '>=': 'is on or after',\n in: ['is one of the dates', 'is the same as a date in'],\n notin: ['is not one of the dates', 'is not the same as any date in'],\n between: ['is between', 'is between the dates in'],\n notbetween: ['is not between', 'is not between the dates in'],\n};\n\n/**\n * Generates a value processor with date/time features for use by\n * {@link react-querybuilder!index.formatQuery formatQuery} with the \"natural_language\" format.\n */\nexport const datetimeValueProcessorNL: ValueProcessorByRule = (rule, opts) => {\n if (isISOStringDateOnly(opts?.context?.originalValue)) {\n return new Intl.DateTimeFormat(opts?.context?.locales, {\n dateStyle: 'full',\n ...opts?.context?.dateFormat,\n }).format(rule.value);\n }\n return new Intl.DateTimeFormat(opts?.context?.locales, {\n dateStyle: 'full',\n timeStyle: 'long',\n ...opts?.context?.dateTimeFormat,\n }).format(rule.value);\n};\n\n/**\n * Generates a rule processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"natural_language\" format.\n */\nexport const getDatetimeRuleProcessorNL =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const operatorLowerCase = lc(rule.operator);\n let finalValue = '';\n\n // istanbul ignore next\n const {\n fieldData,\n quoteFieldNamesWith = ['', ''] as [string, string],\n fieldIdentifierSeparator = '',\n operatorProcessor = defaultOperatorProcessorNL,\n // valueProcessor = datetimeValueProcessorNL,\n wordOrder = 'SVO',\n context = {},\n operatorMap = defaultDateTimeNLOperatorMap,\n } = opts;\n\n if (!processIsDateField(context.isDateField, rule, opts)) {\n return defaultRuleProcessorNL(rule, opts);\n }\n\n if (rule.valueSource === 'field') {\n return defaultRuleProcessorNL(rule, { ...opts, operatorMap: defaultDateTimeNLOperatorMap });\n }\n\n if (\n (operatorLowerCase === 'in' ||\n operatorLowerCase === 'notin' ||\n operatorLowerCase === 'between' ||\n operatorLowerCase === 'notbetween') &&\n !rule.value\n ) {\n return '';\n }\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map((v): [string, Date] => [v, apiFns.toDate(v)])\n .filter(v => apiFns.isValid(v[1]));\n\n switch (operatorLowerCase) {\n case 'in':\n case 'notin':\n {\n if (valueAsDateArray.length === 0) return '';\n finalValue = `(${valueAsDateArray\n .map(value =>\n datetimeValueProcessorNL(\n { field: rule.field, operator: '=', value: value[1] },\n { ...opts, context: { ...context, originalValue: value[0] } }\n )\n )\n .join(', ')})`;\n }\n break;\n\n case 'between':\n case 'notbetween':\n {\n if (valueAsDateArray.length < 2) return '';\n const [first, second] = valueAsDateArray;\n const orderedArray = apiFns.isBefore(first[1], second[1])\n ? [first, second]\n : [second, first];\n finalValue = orderedArray\n .map(([originalValue, value]) =>\n datetimeValueProcessorNL(\n { field: rule.field, operator: '=', value },\n { ...opts, context: { ...context, originalValue } }\n )\n )\n .join(` ${opts.translations?.and ?? 'and'} `);\n }\n break;\n\n default: {\n const [originalValue, value] = valueAsDateArray[0] ?? ['', ''];\n finalValue = originalValue\n ? datetimeValueProcessorNL(\n { field: rule.field, operator: '=', value },\n { ...opts, context: { ...context, originalValue } }\n )\n : '';\n }\n }\n\n const processedField = getQuotedFieldName(fieldData?.label ?? rule.field, {\n quoteFieldNamesWith,\n fieldIdentifierSeparator,\n });\n\n const processedOperator = operatorProcessor(rule, {\n ...opts,\n operatorMap: { ...defaultDateTimeNLOperatorMap, ...operatorMap },\n });\n\n const wordOrderMap = {\n S: processedField,\n V: processedOperator,\n O: finalValue,\n };\n\n return normalizeConstituentWordOrder(wordOrder)\n .map(term => `${wordOrderMap[term]}`)\n .join(' ')\n .trim();\n };\n","import type { RuleProcessor, SQLPreset, ValueProcessorByRule } from 'react-querybuilder';\nimport {\n defaultRuleProcessorSQL,\n defaultValueProcessorByRule,\n getQuotedFieldName,\n lc,\n mapSQLOperator,\n toArray,\n} from 'react-querybuilder';\nimport type { RQBDateTimeLibraryAPI } from './types';\nimport { isISOStringDateOnly, processIsDateField } from './utils';\n\n/**\n * Generates a value processor with date/time features for use by\n * {@link react-querybuilder!index.formatQuery formatQuery} with the \"sql\" format and \"ansi\" preset.\n */\nexport const getDatetimeValueProcessorANSI =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n if (isISOStringDateOnly(opts?.context?.originalValue)) {\n return defaultValueProcessorByRule({ ...rule, value: toISOStringDateOnly(rule.value) }, opts);\n }\n return defaultValueProcessorByRule({ ...rule, value: toISOString(rule.value as Date) }, opts);\n };\n\n/**\n * Generates a value processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"sql\" format and \"mssql\" preset.\n */\nexport const getDatetimeValueProcessorMSSQL =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n const datatype = /^(?:small)?datetime/i.test(opts?.fieldData?.datatype as string)\n ? 'datetimeoffset'\n : 'date';\n const value =\n datatype === 'datetimeoffset' ? toISOString(rule.value) : toISOStringDateOnly(rule.value);\n return defaultValueProcessorByRule(\n { ...rule, value },\n { ...opts, wrapValueWith: [`cast(`, ` as ${datatype})`] }\n );\n };\n\n/**\n * Generates a value processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"sql\" format and \"mysql\" preset.\n */\nexport const getDatetimeValueProcessorMySQL =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n const datatype = /^(?:datetime|timestamp)/i.test(opts?.fieldData?.datatype as string)\n ? 'datetime'\n : 'date';\n const value =\n datatype === 'datetime' ? toISOString(rule.value) : toISOStringDateOnly(rule.value);\n return defaultValueProcessorByRule(\n { ...rule, value },\n { ...opts, wrapValueWith: [`cast(`, ` as ${datatype})`] }\n );\n };\n\n/**\n * Generates a value processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"sql\" format and \"oracle\" preset.\n */\nexport const getDatetimeValueProcessorOracle =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n // Oracle date format for _reading_ ISO 8601: 'YYYY-MM-DD\"T\"HH24:MI:SS.ff3\"Z\"'\n const datatype = /^timestamp/i.test(opts?.fieldData?.datatype as string) ? 'timestamp' : 'date';\n const value =\n datatype === 'timestamp'\n ? toISOString(rule.value).replaceAll('T', ' ').replace('Z', ' UTC')\n : toISOStringDateOnly(rule.value);\n return defaultValueProcessorByRule(\n { ...rule, value },\n { ...opts, wrapValueWith: [datatype, ``] }\n );\n };\n\n/**\n * Generates a value processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"sql\" format and \"postgresql\" preset.\n */\nexport const getDatetimeValueProcessorPostgreSQL =\n ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI): ValueProcessorByRule =>\n (rule, opts) => {\n const datatype = /^timestamp/i.test(opts?.fieldData?.datatype as string) ? 'timestamp' : 'date';\n const value =\n datatype === 'timestamp' ? toISOString(rule.value) : toISOStringDateOnly(rule.value);\n return defaultValueProcessorByRule(\n { ...rule, value },\n { ...opts, wrapValueWith: [datatype, ``] }\n );\n };\n\nconst presetToValueProcessorMap = {\n ansi: getDatetimeValueProcessorANSI,\n mssql: getDatetimeValueProcessorMSSQL,\n mysql: getDatetimeValueProcessorMySQL,\n oracle: getDatetimeValueProcessorOracle,\n postgresql: getDatetimeValueProcessorPostgreSQL,\n sqlite: getDatetimeValueProcessorANSI,\n} satisfies Record<SQLPreset, (apiFns: RQBDateTimeLibraryAPI) => ValueProcessorByRule>;\n\n/**\n * Generates a rule processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with\n * the \"sql\" format.\n */\nexport const getDatetimeRuleProcessorSQL =\n (apiFns: RQBDateTimeLibraryAPI): RuleProcessor =>\n (rule, options) => {\n const opts = options ?? /* istanbul ignore next */ {};\n const operator = mapSQLOperator(rule.operator);\n const operatorLowerCase = lc(operator);\n // istanbul ignore next\n const {\n quoteFieldNamesWith = ['', ''] as [string, string],\n fieldIdentifierSeparator = '',\n context = {},\n } = opts;\n let finalValue = '';\n\n if (rule.valueSource === 'field' || !processIsDateField(context.isDateField, rule, opts)) {\n return defaultRuleProcessorSQL(rule, opts);\n }\n\n const valueProcessor = presetToValueProcessorMap[opts.preset!](apiFns);\n\n const valueAsArray: string[] = toArray(rule.value, { retainEmptyStrings: false });\n const valueAsDateArray = valueAsArray\n .map((v): [string, Date] => [v, apiFns.toDate(v)])\n .filter(v => apiFns.isValid(v[1]));\n\n switch (operatorLowerCase) {\n case 'in':\n case 'not in':\n {\n if (valueAsDateArray.length === 0) return '';\n finalValue = `(${valueAsDateArray\n .map(value =>\n valueProcessor(\n { field: rule.field, operator: '=', value: value[1] },\n { ...opts, context: { originalValue: value[0] } }\n )\n )\n .join(', ')})`;\n }\n break;\n\n case 'between':\n case 'not between':\n {\n if (valueAsDateArray.length < 2) return '';\n const [first, second] = valueAsDateArray;\n const orderedArray = apiFns.isBefore(first[1], second[1])\n ? [first, second]\n : [second, first];\n finalValue = orderedArray\n .map(([originalValue, value]) =>\n valueProcessor(\n { field: rule.field, operator: '=', value },\n { ...opts, context: { originalValue } }\n )\n )\n .join(' and ');\n }\n break;\n\n default: {\n const [originalValue, value] = valueAsDateArray[0] ?? ['', ''];\n finalValue = valueProcessor(\n { field: rule.field, operator: '=', value },\n { ...opts, context: { originalValue } }\n );\n }\n }\n\n return `${getQuotedFieldName(rule.field, { quoteFieldNamesWith, fieldIdentifierSeparator })} ${operator} ${finalValue}`.trim();\n };\n"],"x_google_ign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,OAAO;EAAE;EAAqB;IAA4B,GAAG,SAAS,GAAG,aAAa"}
@@ -1,4 +0,0 @@
1
- import * as React from "react";
2
- import type { QueryBuilderContextProvider, ValueEditorProps } from "react-querybuilder";
3
- export declare const DateTimeValueEditor: (props: ValueEditorProps) => React.JSX.Element;
4
- export declare const QueryBuilderDateTime: QueryBuilderContextProvider;
@@ -1,10 +0,0 @@
1
- import type { RuleProcessor } from "react-querybuilder";
2
- /**
3
- * Date/time rule processor for use by {@link react-querybuilder!index.formatQuery formatQuery}
4
- * with the "jsonlogic" format.
5
- *
6
- * Note: Unlike other date/time rule processors from this library, this function does
7
- * not require a date/time library API. Instead, the date/time library API is used by
8
- * {@link getDatetimeJsonLogicOperations} during the evaluation process.
9
- */
10
- export declare const datetimeRuleProcessorJsonLogic: RuleProcessor;
@@ -1,6 +0,0 @@
1
- import type { RQBDateTimeLibraryAPI, RQBJsonLogicDateTimeOperations } from "./types";
2
- /**
3
- * Custom operations for use with JsonLogic objects generated by
4
- * {@link datetimeRuleProcessorJsonLogic}.
5
- */
6
- export declare const getDatetimeJsonLogicOperations: ({ isAfter, isBefore, isSame }: RQBDateTimeLibraryAPI) => RQBJsonLogicDateTimeOperations;
@@ -1,7 +0,0 @@
1
- import type { RuleProcessor } from "react-querybuilder";
2
- import type { RQBDateTimeLibraryAPI } from "./types";
3
- /**
4
- * Generates a rule processor with date/time features for use by
5
- * {@link react-querybuilder!index.formatQuery formatQuery} with the "cel" format.
6
- */
7
- export declare const getDatetimeRuleProcessorCEL: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
@@ -1,7 +0,0 @@
1
- import type { RuleProcessor } from "react-querybuilder";
2
- import type { RQBDateTimeLibraryAPI } from "./types";
3
- /**
4
- * Generates a rule processor with date/time features for use by
5
- * {@link react-querybuilder!index.formatQuery formatQuery} with the "jsonata" format.
6
- */
7
- export declare const getDatetimeRuleProcessorJSONata: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
@@ -1,7 +0,0 @@
1
- import type { RuleProcessor } from "react-querybuilder";
2
- import type { RQBDateTimeLibraryAPI } from "./types";
3
- /**
4
- * Generates a rule processor with date/time features for use by
5
- * {@link react-querybuilder!index.formatQuery formatQuery} with the "mongodb_query" format.
6
- */
7
- export declare const getDatetimeRuleProcessorMongoDBQuery: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
@@ -1,13 +0,0 @@
1
- import type { ExportOperatorMap, RuleProcessor, ValueProcessorByRule } from "react-querybuilder";
2
- import type { RQBDateTimeLibraryAPI } from "./types";
3
- export declare const defaultDateTimeNLOperatorMap: ExportOperatorMap;
4
- /**
5
- * Generates a value processor with date/time features for use by
6
- * {@link react-querybuilder!index.formatQuery formatQuery} with the "natural_language" format.
7
- */
8
- export declare const datetimeValueProcessorNL: ValueProcessorByRule;
9
- /**
10
- * Generates a rule processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with
11
- * the "natural_language" format.
12
- */
13
- export declare const getDatetimeRuleProcessorNL: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
@@ -1,32 +0,0 @@
1
- import type { RuleProcessor, ValueProcessorByRule } from "react-querybuilder";
2
- import type { RQBDateTimeLibraryAPI } from "./types";
3
- /**
4
- * Generates a value processor with date/time features for use by
5
- * {@link react-querybuilder!index.formatQuery formatQuery} with the "sql" format and "ansi" preset.
6
- */
7
- export declare const getDatetimeValueProcessorANSI: ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
8
- /**
9
- * Generates a value processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with
10
- * the "sql" format and "mssql" preset.
11
- */
12
- export declare const getDatetimeValueProcessorMSSQL: ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
13
- /**
14
- * Generates a value processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with
15
- * the "sql" format and "mysql" preset.
16
- */
17
- export declare const getDatetimeValueProcessorMySQL: ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
18
- /**
19
- * Generates a value processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with
20
- * the "sql" format and "oracle" preset.
21
- */
22
- export declare const getDatetimeValueProcessorOracle: ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
23
- /**
24
- * Generates a value processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with
25
- * the "sql" format and "postgresql" preset.
26
- */
27
- export declare const getDatetimeValueProcessorPostgreSQL: ({ toISOStringDateOnly, toISOString }: RQBDateTimeLibraryAPI) => ValueProcessorByRule;
28
- /**
29
- * Generates a rule processor with date/time features for use by {@link react-querybuilder!index.formatQuery formatQuery} with
30
- * the "sql" format.
31
- */
32
- export declare const getDatetimeRuleProcessorSQL: (apiFns: RQBDateTimeLibraryAPI) => RuleProcessor;
@@ -1,8 +0,0 @@
1
- export * from "./datetimeRuleProcessorJsonLogic";
2
- export * from "./getDatetimeJsonLogicOperations";
3
- export * from "./getDatetimeRuleProcessorCEL";
4
- export * from "./getDatetimeRuleProcessorJSONata";
5
- export * from "./getDatetimeRuleProcessorMongoDBQuery";
6
- export * from "./getDatetimeRuleProcessorNL";
7
- export * from "./getDatetimeRuleProcessorSQL";
8
- export * from "./types";
@@ -1,48 +0,0 @@
1
- /**
2
- * Import from `"@react-querybuilder/datetime/date-fns"` for enhanced date/time support using [date-fns](https://date-fns.org/).
3
- *
4
- * @module date-fns
5
- */
6
- import type { RuleProcessor, ValueProcessorByRule } from "react-querybuilder";
7
- import type { RQBJsonLogicDateTimeOperations } from "./types";
8
- /**
9
- * Custom JsonLogic date/time operations using date-fns
10
- */
11
- export declare const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations;
12
- /**
13
- * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "sql" format using date-fns
14
- */
15
- export declare const datetimeRuleProcessorSQL: RuleProcessor;
16
- /**
17
- * {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("ansi" preset) using date-fns
18
- */
19
- export declare const datetimeValueProcessorANSI: ValueProcessorByRule;
20
- /**
21
- * {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("mssql" preset) using date-fns
22
- */
23
- export declare const datetimeValueProcessorMSSQL: ValueProcessorByRule;
24
- /**
25
- * {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("mysql" preset) using date-fns
26
- */
27
- export declare const datetimeValueProcessorMySQL: ValueProcessorByRule;
28
- /**
29
- * {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("oracle" preset) using date-fns
30
- */
31
- export declare const datetimeValueProcessorOracle: ValueProcessorByRule;
32
- /**
33
- * {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("postgresql" preset) using date-fns
34
- */
35
- export declare const datetimeValueProcessorPostgreSQL: ValueProcessorByRule;
36
- /**
37
- * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "cel" format using date-fns
38
- */
39
- export declare const datetimeRuleProcessorCEL: ValueProcessorByRule;
40
- /**
41
- * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "mongodb_query" format using date-fns
42
- */
43
- export declare const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule;
44
- /**
45
- * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "natural_language" format using date-fns
46
- */
47
- export declare const datetimeRuleProcessorNL: ValueProcessorByRule;
48
- export * from "./rqbDateTimeLibraryAPI.date-fns";
@@ -1,48 +0,0 @@
1
- /**
2
- * Import from `"@react-querybuilder/datetime/dayjs"` for enhanced date/time support using [Day.js](https://day.js.org/).
3
- *
4
- * @module dayjs
5
- */
6
- import type { RuleProcessor, ValueProcessorByRule } from "react-querybuilder";
7
- import type { RQBJsonLogicDateTimeOperations } from "./types";
8
- /**
9
- * Custom JsonLogic date/time operations using Day.js
10
- */
11
- export declare const jsonLogicDateTimeOperations: RQBJsonLogicDateTimeOperations;
12
- /**
13
- * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "sql" format using Day.js
14
- */
15
- export declare const datetimeRuleProcessorSQL: RuleProcessor;
16
- /**
17
- * {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("ansi" preset) using Day.js
18
- */
19
- export declare const datetimeValueProcessorANSI: ValueProcessorByRule;
20
- /**
21
- * {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("mssql" preset) using Day.js
22
- */
23
- export declare const datetimeValueProcessorMSSQL: ValueProcessorByRule;
24
- /**
25
- * {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("mysql" preset) using Day.js
26
- */
27
- export declare const datetimeValueProcessorMySQL: ValueProcessorByRule;
28
- /**
29
- * {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("oracle" preset) using Day.js
30
- */
31
- export declare const datetimeValueProcessorOracle: ValueProcessorByRule;
32
- /**
33
- * {@link react-querybuilder!index.formatQuery formatQuery} value processor for "sql" format ("postgresql" preset) using Day.js
34
- */
35
- export declare const datetimeValueProcessorPostgreSQL: ValueProcessorByRule;
36
- /**
37
- * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "cel" format using Day.js
38
- */
39
- export declare const datetimeRuleProcessorCEL: ValueProcessorByRule;
40
- /**
41
- * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "mongodb_query" format using Day.js
42
- */
43
- export declare const datetimeRuleProcessorMongoDBQuery: ValueProcessorByRule;
44
- /**
45
- * {@link react-querybuilder!index.formatQuery formatQuery} rule processor for "natural_language" format using Day.js
46
- */
47
- export declare const datetimeRuleProcessorNL: ValueProcessorByRule;
48
- export * from "./rqbDateTimeLibraryAPI.dayjs";