@ahoo-wang/wow-client 10.0.0-beta.1 → 10.0.0-beta.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 (233) hide show
  1. package/README.md +4 -2
  2. package/README.zh-CN.md +1 -1
  3. package/dist/commands.cjs +1 -1
  4. package/dist/commands.cjs.map +1 -1
  5. package/dist/commands.d.cts +1 -8
  6. package/dist/commands.d.ts +1 -8
  7. package/dist/commands.es.js +45 -51
  8. package/dist/commands.es.js.map +1 -1
  9. package/dist/dsl/aggregation/admit.cjs +1 -1
  10. package/dist/dsl/aggregation/admit.cjs.map +1 -1
  11. package/dist/dsl/aggregation/admit.es.js +73 -69
  12. package/dist/dsl/aggregation/admit.es.js.map +1 -1
  13. package/dist/dsl/aggregation/aliases.cjs +2 -0
  14. package/dist/dsl/aggregation/aliases.cjs.map +1 -0
  15. package/dist/dsl/aggregation/aliases.d.cts +2 -0
  16. package/dist/dsl/aggregation/aliases.d.ts +2 -0
  17. package/dist/dsl/aggregation/aliases.es.js +13 -0
  18. package/dist/dsl/aggregation/aliases.es.js.map +1 -0
  19. package/dist/dsl/aggregation/builders.cjs +1 -1
  20. package/dist/dsl/aggregation/builders.cjs.map +1 -1
  21. package/dist/dsl/aggregation/builders.d.cts +17 -243
  22. package/dist/dsl/aggregation/builders.d.ts +17 -243
  23. package/dist/dsl/aggregation/builders.es.js +36 -171
  24. package/dist/dsl/aggregation/builders.es.js.map +1 -1
  25. package/dist/dsl/aggregation/derived.cjs +1 -1
  26. package/dist/dsl/aggregation/derived.cjs.map +1 -1
  27. package/dist/dsl/aggregation/derived.d.cts +123 -1
  28. package/dist/dsl/aggregation/derived.d.ts +123 -1
  29. package/dist/dsl/aggregation/derived.es.js +43 -28
  30. package/dist/dsl/aggregation/derived.es.js.map +1 -1
  31. package/dist/dsl/aggregation/groups.cjs +2 -0
  32. package/dist/dsl/aggregation/groups.cjs.map +1 -0
  33. package/dist/dsl/aggregation/groups.d.cts +325 -0
  34. package/dist/dsl/aggregation/groups.d.ts +325 -0
  35. package/dist/dsl/aggregation/groups.es.js +80 -0
  36. package/dist/dsl/aggregation/groups.es.js.map +1 -0
  37. package/dist/dsl/aggregation/having.cjs +1 -1
  38. package/dist/dsl/aggregation/having.cjs.map +1 -1
  39. package/dist/dsl/aggregation/having.d.cts +63 -1
  40. package/dist/dsl/aggregation/having.d.ts +63 -1
  41. package/dist/dsl/aggregation/having.es.js +33 -30
  42. package/dist/dsl/aggregation/having.es.js.map +1 -1
  43. package/dist/dsl/aggregation/index.d.cts +4 -2
  44. package/dist/dsl/aggregation/index.d.ts +4 -2
  45. package/dist/dsl/aggregation/metrics.cjs +2 -0
  46. package/dist/dsl/aggregation/metrics.cjs.map +1 -0
  47. package/dist/dsl/aggregation/metrics.d.cts +279 -0
  48. package/dist/dsl/aggregation/metrics.d.ts +279 -0
  49. package/dist/dsl/aggregation/metrics.es.js +75 -0
  50. package/dist/dsl/aggregation/metrics.es.js.map +1 -0
  51. package/dist/dsl/aggregation/types.cjs +1 -1
  52. package/dist/dsl/aggregation/types.cjs.map +1 -1
  53. package/dist/dsl/aggregation/types.d.cts +4 -524
  54. package/dist/dsl/aggregation/types.d.ts +4 -524
  55. package/dist/dsl/aggregation/types.es.js +5 -25
  56. package/dist/dsl/aggregation/types.es.js.map +1 -1
  57. package/dist/dsl/cursorQuery.cjs +1 -1
  58. package/dist/dsl/cursorQuery.cjs.map +1 -1
  59. package/dist/dsl/cursorQuery.d.cts +18 -7
  60. package/dist/dsl/cursorQuery.d.ts +18 -7
  61. package/dist/dsl/cursorQuery.es.js +13 -12
  62. package/dist/dsl/cursorQuery.es.js.map +1 -1
  63. package/dist/dsl/descriptor.cjs +1 -1
  64. package/dist/dsl/descriptor.cjs.map +1 -1
  65. package/dist/dsl/descriptor.d.cts +17 -379
  66. package/dist/dsl/descriptor.d.ts +17 -379
  67. package/dist/dsl/descriptor.es.js +4 -31
  68. package/dist/dsl/descriptor.es.js.map +1 -1
  69. package/dist/dsl/fieldDescriptor.cjs +2 -0
  70. package/dist/dsl/fieldDescriptor.cjs.map +1 -0
  71. package/dist/dsl/fieldDescriptor.d.cts +246 -0
  72. package/dist/dsl/fieldDescriptor.d.ts +246 -0
  73. package/dist/dsl/fieldDescriptor.es.js +24 -0
  74. package/dist/dsl/fieldDescriptor.es.js.map +1 -0
  75. package/dist/dsl/filter/builders.cjs +1 -1
  76. package/dist/dsl/filter/builders.cjs.map +1 -1
  77. package/dist/dsl/filter/builders.d.cts +7 -949
  78. package/dist/dsl/filter/builders.d.ts +7 -949
  79. package/dist/dsl/filter/builders.es.js +14 -285
  80. package/dist/dsl/filter/builders.es.js.map +1 -1
  81. package/dist/dsl/filter/expressionFilter.cjs +2 -0
  82. package/dist/dsl/filter/expressionFilter.cjs.map +1 -0
  83. package/dist/dsl/filter/expressionFilter.d.cts +35 -0
  84. package/dist/dsl/filter/expressionFilter.d.ts +35 -0
  85. package/dist/dsl/filter/expressionFilter.es.js +18 -0
  86. package/dist/dsl/filter/expressionFilter.es.js.map +1 -0
  87. package/dist/dsl/filter/fieldFilters.cjs +2 -0
  88. package/dist/dsl/filter/fieldFilters.cjs.map +1 -0
  89. package/dist/dsl/filter/fieldFilters.d.cts +297 -0
  90. package/dist/dsl/filter/fieldFilters.d.ts +297 -0
  91. package/dist/dsl/filter/fieldFilters.es.js +110 -0
  92. package/dist/dsl/filter/fieldFilters.es.js.map +1 -0
  93. package/dist/dsl/filter/index.d.cts +2 -1
  94. package/dist/dsl/filter/index.d.ts +2 -1
  95. package/dist/dsl/filter/logicalFilters.cjs +2 -0
  96. package/dist/dsl/filter/logicalFilters.cjs.map +1 -0
  97. package/dist/dsl/filter/logicalFilters.d.cts +109 -0
  98. package/dist/dsl/filter/logicalFilters.d.ts +109 -0
  99. package/dist/dsl/filter/logicalFilters.es.js +36 -0
  100. package/dist/dsl/filter/logicalFilters.es.js.map +1 -0
  101. package/dist/dsl/filter/metadataFilters.cjs +2 -0
  102. package/dist/dsl/filter/metadataFilters.cjs.map +1 -0
  103. package/dist/dsl/filter/metadataFilters.d.cts +132 -0
  104. package/dist/dsl/filter/metadataFilters.d.ts +132 -0
  105. package/dist/dsl/filter/metadataFilters.es.js +56 -0
  106. package/dist/dsl/filter/metadataFilters.es.js.map +1 -0
  107. package/dist/dsl/filter/operator.cjs +1 -1
  108. package/dist/dsl/filter/operator.cjs.map +1 -1
  109. package/dist/dsl/filter/operator.d.cts +11 -9
  110. package/dist/dsl/filter/operator.d.ts +11 -9
  111. package/dist/dsl/filter/operator.es.js +1 -1
  112. package/dist/dsl/filter/operator.es.js.map +1 -1
  113. package/dist/dsl/filter/searchFilter.cjs +2 -0
  114. package/dist/dsl/filter/searchFilter.cjs.map +1 -0
  115. package/dist/dsl/filter/searchFilter.d.cts +39 -0
  116. package/dist/dsl/filter/searchFilter.d.ts +39 -0
  117. package/dist/dsl/filter/searchFilter.es.js +19 -0
  118. package/dist/dsl/filter/searchFilter.es.js.map +1 -0
  119. package/dist/dsl/filter/timeFilters.cjs +2 -0
  120. package/dist/dsl/filter/timeFilters.cjs.map +1 -0
  121. package/dist/dsl/filter/timeFilters.d.cts +290 -0
  122. package/dist/dsl/filter/timeFilters.d.ts +290 -0
  123. package/dist/dsl/filter/timeFilters.es.js +89 -0
  124. package/dist/dsl/filter/timeFilters.es.js.map +1 -0
  125. package/dist/dsl/filter/types.d.cts +4 -14
  126. package/dist/dsl/filter/types.d.ts +4 -14
  127. package/dist/dsl/filter/validate.cjs +1 -1
  128. package/dist/dsl/filter/validate.cjs.map +1 -1
  129. package/dist/dsl/filter/validate.d.cts +2 -4
  130. package/dist/dsl/filter/validate.d.ts +2 -4
  131. package/dist/dsl/filter/validate.es.js +25 -31
  132. package/dist/dsl/filter/validate.es.js.map +1 -1
  133. package/dist/dsl/queryErrorCodes.cjs +1 -1
  134. package/dist/dsl/queryErrorCodes.cjs.map +1 -1
  135. package/dist/dsl/queryErrorCodes.d.cts +0 -2
  136. package/dist/dsl/queryErrorCodes.d.ts +0 -2
  137. package/dist/dsl/queryErrorCodes.es.js +0 -1
  138. package/dist/dsl/queryErrorCodes.es.js.map +1 -1
  139. package/dist/dsl/queryFilter.cjs +2 -0
  140. package/dist/dsl/queryFilter.cjs.map +1 -0
  141. package/dist/dsl/queryFilter.d.cts +3 -0
  142. package/dist/dsl/queryFilter.d.ts +3 -0
  143. package/dist/dsl/queryFilter.es.js +9 -0
  144. package/dist/dsl/queryFilter.es.js.map +1 -0
  145. package/dist/dsl/queryable.cjs +1 -1
  146. package/dist/dsl/queryable.cjs.map +1 -1
  147. package/dist/dsl/queryable.es.js +12 -16
  148. package/dist/dsl/queryable.es.js.map +1 -1
  149. package/dist/dsl/semanticTypes.cjs +2 -0
  150. package/dist/dsl/semanticTypes.cjs.map +1 -0
  151. package/dist/dsl/semanticTypes.d.cts +128 -0
  152. package/dist/dsl/semanticTypes.d.ts +128 -0
  153. package/dist/dsl/semanticTypes.es.js +13 -0
  154. package/dist/dsl/semanticTypes.es.js.map +1 -0
  155. package/dist/dsl.cjs +1 -1
  156. package/dist/dsl.d.cts +2 -0
  157. package/dist/dsl.d.ts +2 -0
  158. package/dist/dsl.es.js +14 -8
  159. package/dist/exactJson.cjs +2 -2
  160. package/dist/exactJson.cjs.map +1 -1
  161. package/dist/exactJson.d.cts +41 -16
  162. package/dist/exactJson.d.ts +41 -16
  163. package/dist/exactJson.es.js +104 -102
  164. package/dist/exactJson.es.js.map +1 -1
  165. package/dist/frameworkErrors.cjs.map +1 -1
  166. package/dist/frameworkErrors.d.cts +4 -4
  167. package/dist/frameworkErrors.d.ts +4 -4
  168. package/dist/frameworkErrors.es.js.map +1 -1
  169. package/dist/http.cjs +1 -1
  170. package/dist/http.cjs.map +1 -1
  171. package/dist/http.d.cts +29 -9
  172. package/dist/http.d.ts +29 -9
  173. package/dist/http.es.js +24 -19
  174. package/dist/http.es.js.map +1 -1
  175. package/dist/index.cjs +1 -1
  176. package/dist/index.d.cts +3 -3
  177. package/dist/index.d.ts +3 -3
  178. package/dist/index.es.js +12 -12
  179. package/dist/manifest.cjs +1 -1
  180. package/dist/manifest.cjs.map +1 -1
  181. package/dist/manifest.d.cts +24 -0
  182. package/dist/manifest.d.ts +24 -0
  183. package/dist/manifest.es.js +34 -6
  184. package/dist/manifest.es.js.map +1 -1
  185. package/dist/manifestTypes.d.cts +16 -1
  186. package/dist/manifestTypes.d.ts +16 -1
  187. package/dist/queries.cjs +1 -1
  188. package/dist/queries.cjs.map +1 -1
  189. package/dist/queries.d.cts +18 -8
  190. package/dist/queries.d.ts +18 -8
  191. package/dist/queries.es.js +46 -35
  192. package/dist/queries.es.js.map +1 -1
  193. package/dist/routes.cjs +1 -1
  194. package/dist/routes.cjs.map +1 -1
  195. package/dist/routes.d.cts +16 -3
  196. package/dist/routes.d.ts +16 -3
  197. package/dist/routes.es.js +24 -25
  198. package/dist/routes.es.js.map +1 -1
  199. package/dist/state.cjs +1 -1
  200. package/dist/state.cjs.map +1 -1
  201. package/dist/state.d.cts +21 -19
  202. package/dist/state.d.ts +21 -19
  203. package/dist/state.es.js +27 -22
  204. package/dist/state.es.js.map +1 -1
  205. package/dist/streams.cjs +1 -1
  206. package/dist/streams.cjs.map +1 -1
  207. package/dist/streams.d.cts +14 -7
  208. package/dist/streams.d.ts +14 -7
  209. package/dist/streams.es.js +65 -50
  210. package/dist/streams.es.js.map +1 -1
  211. package/dist/testing/wire.cjs +1 -1
  212. package/dist/testing/wire.cjs.map +1 -1
  213. package/dist/testing/wire.es.js +1 -1
  214. package/dist/testing/wire.es.js.map +1 -1
  215. package/dist/wait.cjs +1 -1
  216. package/dist/wait.cjs.map +1 -1
  217. package/dist/wait.d.cts +17 -4
  218. package/dist/wait.d.ts +17 -4
  219. package/dist/wait.es.js +36 -34
  220. package/dist/wait.es.js.map +1 -1
  221. package/dist/wire.cjs +1 -1
  222. package/dist/wire.cjs.map +1 -1
  223. package/dist/wire.d.cts +75 -31
  224. package/dist/wire.d.ts +75 -31
  225. package/dist/wire.es.js +1 -3
  226. package/dist/wire.es.js.map +1 -1
  227. package/package.json +5 -5
  228. package/dist/dsl/filter/datePattern.cjs +0 -2
  229. package/dist/dsl/filter/datePattern.cjs.map +0 -1
  230. package/dist/dsl/filter/datePattern.d.cts +0 -8
  231. package/dist/dsl/filter/datePattern.d.ts +0 -8
  232. package/dist/dsl/filter/datePattern.es.js +0 -96
  233. package/dist/dsl/filter/datePattern.es.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"queryable.cjs","names":["filter","filters","DEFAULT_PAGINATION","require_builders","require_pagination","queryFilter","filter$1","singleQuery","filter","listQuery","pagedQuery","pagedList","total","list"],"sources":["../../src/dsl/queryable.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n filter as filters,\n type FilterCapable,\n type FilterExpression,\n} from './filter/index.js';\nimport { type SortCapable } from './sort.js';\nimport { DEFAULT_PAGINATION, type Pagination } from './pagination.js';\nimport { type ProjectionCapable } from './projection.js';\n\n/** A query that filters, projects and sorts with Wow's `FilterExpression`. */\nexport interface FilterQueryable<FIELDS extends string = string>\n extends\n FilterCapable<FIELDS>,\n ProjectionCapable<FIELDS>,\n SortCapable<FIELDS> {}\n\n/** The body of a `single` query: the first match of the filter, or nothing. */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface FilterSingleQuery<\n FIELDS extends string = string,\n> extends FilterQueryable<FIELDS> {}\n\n/** The body of a `list` or `stream` query. */\nexport interface FilterListQuery<\n FIELDS extends string = string,\n> extends FilterQueryable<FIELDS> {\n /**\n * The most rows to return, at least 1. Absent, the server applies its\n * default list size (100 unless it configures another). A limit below 1 is\n * refused with 400 `wow.query.malformed`, and so is a value above the\n * server's maximum list size (1000 by default) with 400\n * `wow.query.invalid`.\n */\n limit?: number;\n}\n\n/** The body of a `paged` query. */\nexport interface FilterPagedQuery<\n FIELDS extends string = string,\n> extends FilterQueryable<FIELDS> {\n pagination?: Pagination;\n}\n\n/** How a paged query counts its total (`TotalMode`). */\nexport type TotalMode = 'exact' | 'bounded' | 'none';\n\n/** A paged query of a query route: a page, and how its total is counted. */\nexport interface PagedQuery<\n FIELDS extends string = string,\n> extends FilterPagedQuery<FIELDS> {\n /** `bounded` (the server's default) counts up to the budget's limit. */\n total?: TotalMode;\n}\n\n/**\n * A page of a paged query: `total` is exact when `exact`, a lower bound\n * otherwise, and null for total `none`. Kotlin's `PagedList`.\n */\nexport interface PagedList<T> {\n readonly total: number | null;\n readonly exact: boolean;\n readonly list: readonly T[];\n}\n\n/** What `singleQuery`, `listQuery` and `pagedQuery` take in common. */\ntype QueryOptions<FIELDS extends string = string> = Partial<\n FilterQueryable<FIELDS>\n>;\n\nfunction queryFilter<FIELDS extends string>(\n filter: FilterExpression<FIELDS> | undefined,\n): FilterExpression<FIELDS> {\n if (filter === null) {\n throw new TypeError('filter cannot be null.');\n }\n return filter ?? filters.matchAll();\n}\n\n/**\n * Builds the body of a `single` query.\n *\n * @param options.filter - What to match. Defaults to `filter.matchAll()`.\n * @param options.projection - Which fields to return. Optional.\n * @param options.sort - Which match counts as the first. Optional.\n * @throws TypeError when `filter` is `null`.\n *\n * @example\n * ```typescript\n * singleQuery({ filter: filter.eq('status', 'ACTIVE') });\n * ```\n */\nexport function singleQuery<FIELDS extends string = string>({\n filter,\n projection,\n sort,\n}: QueryOptions<FIELDS> = {}): FilterSingleQuery<FIELDS> {\n return { filter: queryFilter(filter), projection, sort };\n}\n\n/**\n * Builds the body of a `list` or `stream` query.\n *\n * @param options.filter - What to match. Defaults to `filter.matchAll()`.\n * @param options.projection - Which fields to return. Optional.\n * @param options.sort - The order of the rows. Optional.\n * @param options.limit - The most rows to return. Absent is sent as absent:\n * Wow 9.1.5 and later apply the server's default list size, Wow 8.11 to\n * 9.1.3 reject the query, so pass it for those servers; see\n * {@link FilterListQuery.limit}.\n * @throws TypeError when `filter` is `null`.\n *\n * @example\n * ```typescript\n * listQuery({ filter: filter.eq('status', 'ACTIVE'), limit: 20 });\n * ```\n */\nexport function listQuery<FIELDS extends string = string>({\n filter,\n projection,\n sort,\n limit,\n}: QueryOptions<FIELDS> & { limit?: number } = {}): FilterListQuery<FIELDS> {\n return { filter: queryFilter(filter), projection, sort, limit };\n}\n\n/**\n * Builds the body of a `paged` query.\n *\n * @param options.filter - What to match. Defaults to `filter.matchAll()`.\n * @param options.projection - Which fields to return. Optional.\n * @param options.sort - The order of the rows. Optional.\n * @param options.pagination - Which page. Defaults to a copy of\n * {@link DEFAULT_PAGINATION}: the first page of ten.\n * @throws TypeError when `filter` is `null`.\n *\n * @example\n * ```typescript\n * pagedQuery({ filter: filter.matchAll(), pagination: { index: 2, size: 20 } });\n * ```\n */\nexport function pagedQuery<FIELDS extends string = string>({\n filter,\n projection,\n sort,\n pagination = { ...DEFAULT_PAGINATION },\n}: QueryOptions<FIELDS> & {\n pagination?: Pagination;\n} = {}): FilterPagedQuery<FIELDS> {\n return { filter: queryFilter(filter), projection, sort, pagination };\n}\n\n/**\n * Builds a `PagedList`, for a placeholder page or a test double.\n *\n * @param options.total - How many rows match in total. Defaults to the length\n * of `list`.\n * @param options.exact - Whether `total` is exact. Defaults to true.\n * @param options.list - The rows of this page. Defaults to a new empty array.\n */\nexport function pagedList<T>({\n total,\n exact = true,\n list = [],\n}: Partial<PagedList<T>> = {}): PagedList<T> {\n return { total: total === undefined ? list.length : total, exact, list };\n}\n"],"mappings":"A,uEAkFA,SAASK,EACP,EAC0B,CAC1B,GAAIL,IAAW,KACb,MAAU,UAAU,wBAAwB,EAE9C,OAAOA,GAAUC,EAAAA,OAAQ,SAAS,CACpC,CAeA,SAAgBM,EAA4C,CAC1D,SACA,aACA,QACwB,CAAC,EAA8B,CACvD,MAAO,CAAE,OAAQF,EAAYG,CAAM,EAAG,aAAY,MAAK,CACzD,CAmBA,SAAgBC,EAA0C,CACxD,SACA,aACA,OACA,SAC6C,CAAC,EAA4B,CAC1E,MAAO,CAAE,OAAQJ,EAAYG,CAAM,EAAG,aAAY,OAAM,OAAM,CAChE,CAiBA,SAAgBE,EAA2C,CACzD,SACA,aACA,OACA,aAAa,CAAE,GAAGR,EAAAA,kBAAmB,GAGnC,CAAC,EAA6B,CAChC,MAAO,CAAE,OAAQG,EAAYG,CAAM,EAAG,aAAY,OAAM,YAAW,CACrE,CAUA,SAAgBG,EAAa,CAC3B,QACA,QAAQ,GACR,OAAO,CAAC,GACiB,CAAC,EAAiB,CAC3C,MAAO,CAAE,MAAOC,IAAU,IAAA,GAAYC,EAAK,OAASD,EAAO,QAAO,MAAK,CACzE,C"}
1
+ {"version":3,"file":"queryable.cjs","names":["queryFilter","DEFAULT_PAGINATION","require_pagination","require_queryFilter","singleQuery","filter","listQuery","pagedQuery","pagedList","total","list"],"sources":["../../src/dsl/queryable.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type FilterCapable } from './filter/index.js';\nimport { queryFilter } from './queryFilter.js';\nimport { type SortCapable } from './sort.js';\nimport { DEFAULT_PAGINATION, type Pagination } from './pagination.js';\nimport { type ProjectionCapable } from './projection.js';\n\n/** A query that filters, projects and sorts with Wow's `FilterExpression`. */\nexport interface FilterQueryable<FIELDS extends string = string>\n extends\n FilterCapable<FIELDS>,\n ProjectionCapable<FIELDS>,\n SortCapable<FIELDS> {}\n\n/** The body of a `single` query: the first match of the filter, or nothing. */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface FilterSingleQuery<\n FIELDS extends string = string,\n> extends FilterQueryable<FIELDS> {}\n\n/** The body of a `list` or `stream` query. */\nexport interface FilterListQuery<\n FIELDS extends string = string,\n> extends FilterQueryable<FIELDS> {\n /**\n * The most rows to return, at least 1. Absent, the server applies its\n * default list size (100 unless it configures another). A limit below 1 is\n * refused with 400 `wow.query.malformed`, and so is a value above the\n * server's maximum list size (1000 by default) with 400\n * `wow.query.invalid`.\n */\n limit?: number;\n}\n\n/** The body of a `paged` query. */\nexport interface FilterPagedQuery<\n FIELDS extends string = string,\n> extends FilterQueryable<FIELDS> {\n pagination?: Pagination;\n}\n\n/** How a paged query counts its total (`TotalMode`). */\nexport type TotalMode = 'exact' | 'bounded' | 'none';\n\n/** A paged query of a query route: a page, and how its total is counted. */\nexport interface PagedQuery<\n FIELDS extends string = string,\n> extends FilterPagedQuery<FIELDS> {\n /** `bounded` (the server's default) counts up to the budget's limit. */\n total?: TotalMode;\n}\n\n/**\n * A page of a paged query: `total` is exact when `exact`, a lower bound\n * otherwise, and null for total `none`. Kotlin's `PagedList`.\n */\nexport interface PagedList<T> {\n readonly total: number | null;\n readonly exact: boolean;\n readonly list: readonly T[];\n}\n\n/** What `singleQuery`, `listQuery` and `pagedQuery` take in common. */\ntype QueryOptions<FIELDS extends string = string> = Partial<\n FilterQueryable<FIELDS>\n>;\n\n/**\n * Builds the body of a `single` query.\n *\n * @param options.filter - What to match. Defaults to `filter.matchAll()`.\n * @param options.projection - Which fields to return. Optional.\n * @param options.sort - Which match counts as the first. Optional.\n * @throws TypeError when `filter` is `null`.\n *\n * @example\n * ```typescript\n * singleQuery({ filter: filter.eq('status', 'ACTIVE') });\n * ```\n */\nexport function singleQuery<FIELDS extends string = string>({\n filter,\n projection,\n sort,\n}: QueryOptions<FIELDS> = {}): FilterSingleQuery<FIELDS> {\n return { filter: queryFilter(filter), projection, sort };\n}\n\n/**\n * Builds the body of a `list` or `stream` query.\n *\n * @param options.filter - What to match. Defaults to `filter.matchAll()`.\n * @param options.projection - Which fields to return. Optional.\n * @param options.sort - The order of the rows. Optional.\n * @param options.limit - The most rows to return. Absent is sent as absent:\n * Wow 9.1.5 and later apply the server's default list size, Wow 8.11 to\n * 9.1.3 reject the query, so pass it for those servers; see\n * {@link FilterListQuery.limit}.\n * @throws TypeError when `filter` is `null`.\n *\n * @example\n * ```typescript\n * listQuery({ filter: filter.eq('status', 'ACTIVE'), limit: 20 });\n * ```\n */\nexport function listQuery<FIELDS extends string = string>({\n filter,\n projection,\n sort,\n limit,\n}: QueryOptions<FIELDS> & { limit?: number } = {}): FilterListQuery<FIELDS> {\n return { filter: queryFilter(filter), projection, sort, limit };\n}\n\n/**\n * Builds the body of a `paged` query.\n *\n * @param options.filter - What to match. Defaults to `filter.matchAll()`.\n * @param options.projection - Which fields to return. Optional.\n * @param options.sort - The order of the rows. Optional.\n * @param options.pagination - Which page. Defaults to a copy of\n * {@link DEFAULT_PAGINATION}: the first page of ten.\n * @throws TypeError when `filter` is `null`.\n *\n * @example\n * ```typescript\n * pagedQuery({ filter: filter.matchAll(), pagination: { index: 2, size: 20 } });\n * ```\n */\nexport function pagedQuery<FIELDS extends string = string>({\n filter,\n projection,\n sort,\n pagination = { ...DEFAULT_PAGINATION },\n}: QueryOptions<FIELDS> & {\n pagination?: Pagination;\n} = {}): FilterPagedQuery<FIELDS> {\n return { filter: queryFilter(filter), projection, sort, pagination };\n}\n\n/**\n * Builds a `PagedList`, for a placeholder page or a test double.\n *\n * @param options.total - How many rows match in total. Defaults to the length\n * of `list`.\n * @param options.exact - Whether `total` is exact. Defaults to true.\n * @param options.list - The rows of this page. Defaults to a new empty array.\n */\nexport function pagedList<T>({\n total,\n exact = true,\n list = [],\n}: Partial<PagedList<T>> = {}): PagedList<T> {\n return { total: total === undefined ? list.length : total, exact, list };\n}\n"],"mappings":"A,mEA4FA,SAAgBI,EAA4C,CAC1D,SACA,aACA,QACwB,CAAC,EAA8B,CACvD,MAAO,CAAE,OAAQJ,EAAAA,YAAYK,CAAM,EAAG,aAAY,MAAK,CACzD,CAmBA,SAAgBC,EAA0C,CACxD,SACA,aACA,OACA,SAC6C,CAAC,EAA4B,CAC1E,MAAO,CAAE,OAAQN,EAAAA,YAAYK,CAAM,EAAG,aAAY,OAAM,OAAM,CAChE,CAiBA,SAAgBE,EAA2C,CACzD,SACA,aACA,OACA,aAAa,CAAE,GAAGN,EAAAA,kBAAmB,GAGnC,CAAC,EAA6B,CAChC,MAAO,CAAE,OAAQD,EAAAA,YAAYK,CAAM,EAAG,aAAY,OAAM,YAAW,CACrE,CAUA,SAAgBG,EAAa,CAC3B,QACA,QAAQ,GACR,OAAO,CAAC,GACiB,CAAC,EAAiB,CAC3C,MAAO,CAAE,MAAOC,IAAU,IAAA,GAAYC,EAAK,OAASD,EAAO,QAAO,MAAK,CACzE,C"}
@@ -1,40 +1,36 @@
1
- import { filter as e } from "./filter/builders.es.js";
2
- import { DEFAULT_PAGINATION as t } from "./pagination.es.js";
1
+ import { DEFAULT_PAGINATION as e } from "./pagination.es.js";
2
+ import { queryFilter as t } from "./queryFilter.es.js";
3
3
  // src/dsl/queryable.ts
4
- function n(t) {
5
- if (t === null) throw TypeError("filter cannot be null.");
6
- return t ?? e.matchAll();
7
- }
8
- function r({ filter: e, projection: t, sort: r } = {}) {
4
+ function n({ filter: e, projection: n, sort: r } = {}) {
9
5
  return {
10
- filter: n(e),
11
- projection: t,
6
+ filter: t(e),
7
+ projection: n,
12
8
  sort: r
13
9
  };
14
10
  }
15
- function i({ filter: e, projection: t, sort: r, limit: i } = {}) {
11
+ function r({ filter: e, projection: n, sort: r, limit: i } = {}) {
16
12
  return {
17
- filter: n(e),
18
- projection: t,
13
+ filter: t(e),
14
+ projection: n,
19
15
  sort: r,
20
16
  limit: i
21
17
  };
22
18
  }
23
- function a({ filter: e, projection: r, sort: i, pagination: a = { ...t } } = {}) {
19
+ function i({ filter: n, projection: r, sort: i, pagination: a = { ...e } } = {}) {
24
20
  return {
25
- filter: n(e),
21
+ filter: t(n),
26
22
  projection: r,
27
23
  sort: i,
28
24
  pagination: a
29
25
  };
30
26
  }
31
- function o({ total: e, exact: t = !0, list: n = [] } = {}) {
27
+ function a({ total: e, exact: t = !0, list: n = [] } = {}) {
32
28
  return {
33
29
  total: e === void 0 ? n.length : e,
34
30
  exact: t,
35
31
  list: n
36
32
  };
37
33
  }
38
- export { i as listQuery, o as pagedList, a as pagedQuery, r as singleQuery };
34
+ export { r as listQuery, a as pagedList, i as pagedQuery, n as singleQuery };
39
35
 
40
36
  //# sourceMappingURL=queryable.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"queryable.es.js","names":["filter","filters","queryFilter","filter$1","filter","singleQuery","listQuery","pagedQuery","DEFAULT_PAGINATION","pagedList","total","list"],"sources":["../../src/dsl/queryable.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n filter as filters,\n type FilterCapable,\n type FilterExpression,\n} from './filter/index.js';\nimport { type SortCapable } from './sort.js';\nimport { DEFAULT_PAGINATION, type Pagination } from './pagination.js';\nimport { type ProjectionCapable } from './projection.js';\n\n/** A query that filters, projects and sorts with Wow's `FilterExpression`. */\nexport interface FilterQueryable<FIELDS extends string = string>\n extends\n FilterCapable<FIELDS>,\n ProjectionCapable<FIELDS>,\n SortCapable<FIELDS> {}\n\n/** The body of a `single` query: the first match of the filter, or nothing. */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface FilterSingleQuery<\n FIELDS extends string = string,\n> extends FilterQueryable<FIELDS> {}\n\n/** The body of a `list` or `stream` query. */\nexport interface FilterListQuery<\n FIELDS extends string = string,\n> extends FilterQueryable<FIELDS> {\n /**\n * The most rows to return, at least 1. Absent, the server applies its\n * default list size (100 unless it configures another). A limit below 1 is\n * refused with 400 `wow.query.malformed`, and so is a value above the\n * server's maximum list size (1000 by default) with 400\n * `wow.query.invalid`.\n */\n limit?: number;\n}\n\n/** The body of a `paged` query. */\nexport interface FilterPagedQuery<\n FIELDS extends string = string,\n> extends FilterQueryable<FIELDS> {\n pagination?: Pagination;\n}\n\n/** How a paged query counts its total (`TotalMode`). */\nexport type TotalMode = 'exact' | 'bounded' | 'none';\n\n/** A paged query of a query route: a page, and how its total is counted. */\nexport interface PagedQuery<\n FIELDS extends string = string,\n> extends FilterPagedQuery<FIELDS> {\n /** `bounded` (the server's default) counts up to the budget's limit. */\n total?: TotalMode;\n}\n\n/**\n * A page of a paged query: `total` is exact when `exact`, a lower bound\n * otherwise, and null for total `none`. Kotlin's `PagedList`.\n */\nexport interface PagedList<T> {\n readonly total: number | null;\n readonly exact: boolean;\n readonly list: readonly T[];\n}\n\n/** What `singleQuery`, `listQuery` and `pagedQuery` take in common. */\ntype QueryOptions<FIELDS extends string = string> = Partial<\n FilterQueryable<FIELDS>\n>;\n\nfunction queryFilter<FIELDS extends string>(\n filter: FilterExpression<FIELDS> | undefined,\n): FilterExpression<FIELDS> {\n if (filter === null) {\n throw new TypeError('filter cannot be null.');\n }\n return filter ?? filters.matchAll();\n}\n\n/**\n * Builds the body of a `single` query.\n *\n * @param options.filter - What to match. Defaults to `filter.matchAll()`.\n * @param options.projection - Which fields to return. Optional.\n * @param options.sort - Which match counts as the first. Optional.\n * @throws TypeError when `filter` is `null`.\n *\n * @example\n * ```typescript\n * singleQuery({ filter: filter.eq('status', 'ACTIVE') });\n * ```\n */\nexport function singleQuery<FIELDS extends string = string>({\n filter,\n projection,\n sort,\n}: QueryOptions<FIELDS> = {}): FilterSingleQuery<FIELDS> {\n return { filter: queryFilter(filter), projection, sort };\n}\n\n/**\n * Builds the body of a `list` or `stream` query.\n *\n * @param options.filter - What to match. Defaults to `filter.matchAll()`.\n * @param options.projection - Which fields to return. Optional.\n * @param options.sort - The order of the rows. Optional.\n * @param options.limit - The most rows to return. Absent is sent as absent:\n * Wow 9.1.5 and later apply the server's default list size, Wow 8.11 to\n * 9.1.3 reject the query, so pass it for those servers; see\n * {@link FilterListQuery.limit}.\n * @throws TypeError when `filter` is `null`.\n *\n * @example\n * ```typescript\n * listQuery({ filter: filter.eq('status', 'ACTIVE'), limit: 20 });\n * ```\n */\nexport function listQuery<FIELDS extends string = string>({\n filter,\n projection,\n sort,\n limit,\n}: QueryOptions<FIELDS> & { limit?: number } = {}): FilterListQuery<FIELDS> {\n return { filter: queryFilter(filter), projection, sort, limit };\n}\n\n/**\n * Builds the body of a `paged` query.\n *\n * @param options.filter - What to match. Defaults to `filter.matchAll()`.\n * @param options.projection - Which fields to return. Optional.\n * @param options.sort - The order of the rows. Optional.\n * @param options.pagination - Which page. Defaults to a copy of\n * {@link DEFAULT_PAGINATION}: the first page of ten.\n * @throws TypeError when `filter` is `null`.\n *\n * @example\n * ```typescript\n * pagedQuery({ filter: filter.matchAll(), pagination: { index: 2, size: 20 } });\n * ```\n */\nexport function pagedQuery<FIELDS extends string = string>({\n filter,\n projection,\n sort,\n pagination = { ...DEFAULT_PAGINATION },\n}: QueryOptions<FIELDS> & {\n pagination?: Pagination;\n} = {}): FilterPagedQuery<FIELDS> {\n return { filter: queryFilter(filter), projection, sort, pagination };\n}\n\n/**\n * Builds a `PagedList`, for a placeholder page or a test double.\n *\n * @param options.total - How many rows match in total. Defaults to the length\n * of `list`.\n * @param options.exact - Whether `total` is exact. Defaults to true.\n * @param options.list - The rows of this page. Defaults to a new empty array.\n */\nexport function pagedList<T>({\n total,\n exact = true,\n list = [],\n}: Partial<PagedList<T>> = {}): PagedList<T> {\n return { total: total === undefined ? list.length : total, exact, list };\n}\n"],"mappings":";;;AAkFA,SAASE,EACP,GAC0B;CAC1B,IAAIF,MAAW,MACb,MAAU,UAAU,wBAAwB;CAE9C,OAAOA,KAAUC,EAAQ,SAAS;AACpC;AAeA,SAAgBI,EAA4C,EAC1D,WACA,eACA,YACwB,CAAC,GAA8B;CACvD,OAAO;EAAE,QAAQH,EAAYE,CAAM;EAAG;EAAY;CAAK;AACzD;AAmBA,SAAgBE,EAA0C,EACxD,WACA,eACA,SACA,aAC6C,CAAC,GAA4B;CAC1E,OAAO;EAAE,QAAQJ,EAAYE,CAAM;EAAG;EAAY;EAAM;CAAM;AAChE;AAiBA,SAAgBG,EAA2C,EACzD,WACA,eACA,SACA,gBAAa,EAAE,GAAGC,EAAmB,MAGnC,CAAC,GAA6B;CAChC,OAAO;EAAE,QAAQN,EAAYE,CAAM;EAAG;EAAY;EAAM;CAAW;AACrE;AAUA,SAAgBK,EAAa,EAC3B,UACA,WAAQ,IACR,UAAO,CAAC,MACiB,CAAC,GAAiB;CAC3C,OAAO;EAAE,OAAOC,MAAU,KAAA,IAAYC,EAAK,SAASD;EAAO;EAAO;CAAK;AACzE"}
1
+ {"version":3,"file":"queryable.es.js","names":["singleQuery","queryFilter","filter","listQuery","pagedQuery","DEFAULT_PAGINATION","pagedList","total","list"],"sources":["../../src/dsl/queryable.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { type FilterCapable } from './filter/index.js';\nimport { queryFilter } from './queryFilter.js';\nimport { type SortCapable } from './sort.js';\nimport { DEFAULT_PAGINATION, type Pagination } from './pagination.js';\nimport { type ProjectionCapable } from './projection.js';\n\n/** A query that filters, projects and sorts with Wow's `FilterExpression`. */\nexport interface FilterQueryable<FIELDS extends string = string>\n extends\n FilterCapable<FIELDS>,\n ProjectionCapable<FIELDS>,\n SortCapable<FIELDS> {}\n\n/** The body of a `single` query: the first match of the filter, or nothing. */\n// eslint-disable-next-line @typescript-eslint/no-empty-object-type\nexport interface FilterSingleQuery<\n FIELDS extends string = string,\n> extends FilterQueryable<FIELDS> {}\n\n/** The body of a `list` or `stream` query. */\nexport interface FilterListQuery<\n FIELDS extends string = string,\n> extends FilterQueryable<FIELDS> {\n /**\n * The most rows to return, at least 1. Absent, the server applies its\n * default list size (100 unless it configures another). A limit below 1 is\n * refused with 400 `wow.query.malformed`, and so is a value above the\n * server's maximum list size (1000 by default) with 400\n * `wow.query.invalid`.\n */\n limit?: number;\n}\n\n/** The body of a `paged` query. */\nexport interface FilterPagedQuery<\n FIELDS extends string = string,\n> extends FilterQueryable<FIELDS> {\n pagination?: Pagination;\n}\n\n/** How a paged query counts its total (`TotalMode`). */\nexport type TotalMode = 'exact' | 'bounded' | 'none';\n\n/** A paged query of a query route: a page, and how its total is counted. */\nexport interface PagedQuery<\n FIELDS extends string = string,\n> extends FilterPagedQuery<FIELDS> {\n /** `bounded` (the server's default) counts up to the budget's limit. */\n total?: TotalMode;\n}\n\n/**\n * A page of a paged query: `total` is exact when `exact`, a lower bound\n * otherwise, and null for total `none`. Kotlin's `PagedList`.\n */\nexport interface PagedList<T> {\n readonly total: number | null;\n readonly exact: boolean;\n readonly list: readonly T[];\n}\n\n/** What `singleQuery`, `listQuery` and `pagedQuery` take in common. */\ntype QueryOptions<FIELDS extends string = string> = Partial<\n FilterQueryable<FIELDS>\n>;\n\n/**\n * Builds the body of a `single` query.\n *\n * @param options.filter - What to match. Defaults to `filter.matchAll()`.\n * @param options.projection - Which fields to return. Optional.\n * @param options.sort - Which match counts as the first. Optional.\n * @throws TypeError when `filter` is `null`.\n *\n * @example\n * ```typescript\n * singleQuery({ filter: filter.eq('status', 'ACTIVE') });\n * ```\n */\nexport function singleQuery<FIELDS extends string = string>({\n filter,\n projection,\n sort,\n}: QueryOptions<FIELDS> = {}): FilterSingleQuery<FIELDS> {\n return { filter: queryFilter(filter), projection, sort };\n}\n\n/**\n * Builds the body of a `list` or `stream` query.\n *\n * @param options.filter - What to match. Defaults to `filter.matchAll()`.\n * @param options.projection - Which fields to return. Optional.\n * @param options.sort - The order of the rows. Optional.\n * @param options.limit - The most rows to return. Absent is sent as absent:\n * Wow 9.1.5 and later apply the server's default list size, Wow 8.11 to\n * 9.1.3 reject the query, so pass it for those servers; see\n * {@link FilterListQuery.limit}.\n * @throws TypeError when `filter` is `null`.\n *\n * @example\n * ```typescript\n * listQuery({ filter: filter.eq('status', 'ACTIVE'), limit: 20 });\n * ```\n */\nexport function listQuery<FIELDS extends string = string>({\n filter,\n projection,\n sort,\n limit,\n}: QueryOptions<FIELDS> & { limit?: number } = {}): FilterListQuery<FIELDS> {\n return { filter: queryFilter(filter), projection, sort, limit };\n}\n\n/**\n * Builds the body of a `paged` query.\n *\n * @param options.filter - What to match. Defaults to `filter.matchAll()`.\n * @param options.projection - Which fields to return. Optional.\n * @param options.sort - The order of the rows. Optional.\n * @param options.pagination - Which page. Defaults to a copy of\n * {@link DEFAULT_PAGINATION}: the first page of ten.\n * @throws TypeError when `filter` is `null`.\n *\n * @example\n * ```typescript\n * pagedQuery({ filter: filter.matchAll(), pagination: { index: 2, size: 20 } });\n * ```\n */\nexport function pagedQuery<FIELDS extends string = string>({\n filter,\n projection,\n sort,\n pagination = { ...DEFAULT_PAGINATION },\n}: QueryOptions<FIELDS> & {\n pagination?: Pagination;\n} = {}): FilterPagedQuery<FIELDS> {\n return { filter: queryFilter(filter), projection, sort, pagination };\n}\n\n/**\n * Builds a `PagedList`, for a placeholder page or a test double.\n *\n * @param options.total - How many rows match in total. Defaults to the length\n * of `list`.\n * @param options.exact - Whether `total` is exact. Defaults to true.\n * @param options.list - The rows of this page. Defaults to a new empty array.\n */\nexport function pagedList<T>({\n total,\n exact = true,\n list = [],\n}: Partial<PagedList<T>> = {}): PagedList<T> {\n return { total: total === undefined ? list.length : total, exact, list };\n}\n"],"mappings":";;;AA4FA,SAAgBA,EAA4C,EAC1D,WACA,eACA,YACwB,CAAC,GAA8B;CACvD,OAAO;EAAE,QAAQC,EAAYC,CAAM;EAAG;EAAY;CAAK;AACzD;AAmBA,SAAgBC,EAA0C,EACxD,WACA,eACA,SACA,aAC6C,CAAC,GAA4B;CAC1E,OAAO;EAAE,QAAQF,EAAYC,CAAM;EAAG;EAAY;EAAM;CAAM;AAChE;AAiBA,SAAgBE,EAA2C,EACzD,WACA,eACA,SACA,gBAAa,EAAE,GAAGC,EAAmB,MAGnC,CAAC,GAA6B;CAChC,OAAO;EAAE,QAAQJ,EAAYC,CAAM;EAAG;EAAY;EAAM;CAAW;AACrE;AAUA,SAAgBI,EAAa,EAC3B,UACA,WAAQ,IACR,UAAO,CAAC,MACiB,CAAC,GAAiB;CAC3C,OAAO;EAAE,OAAOC,MAAU,KAAA,IAAYC,EAAK,SAASD;EAAO;EAAO;CAAK;AACzE"}
@@ -0,0 +1,2 @@
1
+ var e=Object.freeze({TEMPORAL_DATE:`temporal-date`,TEMPORAL_EPOCH:`temporal-epoch`,TEMPORAL_FORMATTED:`temporal-formatted`,DECIMAL:`decimal`,MONEY:`money`,DURATION:`duration`,REFERENCE:`reference`});exports.QuerySemanticTypes=e;
2
+ //# sourceMappingURL=semanticTypes.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semanticTypes.cjs","names":["QuerySemanticTypes"],"sources":["../../src/dsl/semanticTypes.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { TimeUnit } from './filter/index.js';\n\n/**\n * The semantics Wow names in a field's `semantic.type`, one per member of\n * {@link QuerySemanticType}: read a descriptor's semantic by these rather\n * than by its spelling.\n */\nexport const QuerySemanticTypes = Object.freeze({\n /** A calendar date: {@link TemporalDate}. */\n TEMPORAL_DATE: 'temporal-date',\n /** A number of time units since the epoch: {@link TemporalEpoch}. */\n TEMPORAL_EPOCH: 'temporal-epoch',\n /** A time written as text in a pattern: {@link TemporalFormatted}. */\n TEMPORAL_FORMATTED: 'temporal-formatted',\n /** A fixed-point decimal: {@link NumericDecimal}. */\n DECIMAL: 'decimal',\n /** An amount of money: {@link NumericMoney}. */\n MONEY: 'money',\n /** A length of time: {@link DurationSemantic}. */\n DURATION: 'duration',\n /** The id of an aggregate: {@link ReferenceSemantic}. */\n REFERENCE: 'reference',\n} as const);\n\n/** A field that holds a calendar date. */\nexport interface TemporalDate {\n /** The discriminator. */\n type: typeof QuerySemanticTypes.TEMPORAL_DATE;\n}\n\n/** A field that holds a number of time units since the epoch. */\nexport interface TemporalEpoch {\n /** The discriminator. */\n type: typeof QuerySemanticTypes.TEMPORAL_EPOCH;\n /** The unit the number counts; milliseconds when absent. */\n timeUnit?: TimeUnit;\n}\n\n/** A field that holds a time written as text in a `java.time` pattern. */\nexport interface TemporalFormatted {\n /** The discriminator. */\n type: typeof QuerySemanticTypes.TEMPORAL_FORMATTED;\n /** The `java.time` pattern, such as `yyyy-MM-dd`. */\n pattern: string;\n}\n\n/**\n * A number field meant as a fixed-point decimal with `scale` fraction\n * digits: format and total it at that precision. Declared on the model\n * (`@QueryDecimal`), never inferred. Wow 9.2 and later.\n */\nexport interface NumericDecimal {\n /** The discriminator. */\n type: typeof QuerySemanticTypes.DECIMAL;\n /** The number of digits after the decimal point, 0 or more. */\n scale: number;\n}\n\n/**\n * A number field meant as an amount of money, in exactly one of a fixed\n * ISO 4217 `currency` or the currency held by the sibling string field\n * `currencyField` (a property of the same object or element). `scale` is\n * always sent: with a fixed currency the server resolves an omitted one to\n * that currency's standard fraction digits (2 for CNY, 0 for JPY).\n * Amounts in different currencies must not be totalled together. Declared\n * on the model (`@QueryMoney`), never inferred. Wow 9.2 and later.\n */\nexport type NumericMoney = {\n /** The discriminator. */\n type: typeof QuerySemanticTypes.MONEY;\n /** The number of digits after the decimal point, 0 or more. */\n scale: number;\n} & (\n | {\n /** The fixed ISO 4217 currency code, such as `CNY`. */\n currency: string;\n currencyField?: undefined;\n }\n | {\n currency?: undefined;\n /** The sibling property that holds each value's currency code. */\n currencyField: string;\n }\n);\n\n/**\n * A number field that is a length of time counted in `timeUnit`, such as a\n * timeout in seconds: format it as a duration. Declared on the model\n * (`@QueryDuration`), never inferred. Wow 9.2 and later.\n */\nexport interface DurationSemantic {\n /** The discriminator. */\n type: typeof QuerySemanticTypes.DURATION;\n /** The unit the number counts; always sent. */\n timeUnit: TimeUnit;\n}\n\n/**\n * A field whose value is the id of an aggregate, to look it up and link to\n * it: either a fixed aggregate, `contextName` and `aggregateName`, or per\n * record the aggregate the sibling string fields `contextNameField` and\n * `aggregateNameField` name (as in an `AggregateId`). The id is always the\n * aggregate's own. Declared on the model (`@QueryReference`), or inferred\n * for an `AggregateId`. Wow 9.2 and later.\n */\nexport type ReferenceSemantic = {\n /** The discriminator. */\n type: typeof QuerySemanticTypes.REFERENCE;\n} & (\n | {\n /** The referenced aggregate's bounded context. */\n contextName: string;\n /** The referenced aggregate's name. */\n aggregateName: string;\n contextNameField?: undefined;\n aggregateNameField?: undefined;\n }\n | {\n contextName?: undefined;\n aggregateName?: undefined;\n /** The sibling property that holds each value's bounded context. */\n contextNameField: string;\n /** The sibling property that holds each value's aggregate name. */\n aggregateNameField: string;\n }\n);\n\n/**\n * What a field's value means beyond its type, sent as its `semantic`: one\n * of the three temporal kinds, which the relative time filters (`TODAY`,\n * `RECENT_DAYS`, …) and date histograms need; one of the two numeric\n * formats, which say how a number is read and displayed; a duration; or a\n * reference to an aggregate. A field has one; an array field's is its\n * items'.\n *\n * The union grows in minor releases, as the server learns a semantic, and a\n * server newer than this client may send a `type` not listed here. The\n * descriptor is read as JSON, not parsed, so it arrives as it is: keep a\n * `default` branch in a `switch` over `type`, and treat a `type` you do not\n * know as no semantic at all. The union stays closed so that narrowing on\n * `type` still works.\n */\nexport type QuerySemanticType =\n | TemporalDate\n | TemporalEpoch\n | TemporalFormatted\n | NumericDecimal\n | NumericMoney\n | DurationSemantic\n | ReferenceSemantic;\n"],"mappings":"AAoBA,IAAaA,EAAqB,OAAO,OAAO,CAE9C,cAAe,gBAEf,eAAgB,iBAEhB,mBAAoB,qBAEpB,QAAS,UAET,MAAO,QAEP,SAAU,WAEV,UAAW,WACb,CAAU,E"}
@@ -0,0 +1,128 @@
1
+ import { TimeUnit } from './filter/index.cjs';
2
+ /**
3
+ * The semantics Wow names in a field's `semantic.type`, one per member of
4
+ * {@link QuerySemanticType}: read a descriptor's semantic by these rather
5
+ * than by its spelling.
6
+ */
7
+ export declare const QuerySemanticTypes: Readonly<{
8
+ /** A calendar date: {@link TemporalDate}. */
9
+ readonly TEMPORAL_DATE: "temporal-date";
10
+ /** A number of time units since the epoch: {@link TemporalEpoch}. */
11
+ readonly TEMPORAL_EPOCH: "temporal-epoch";
12
+ /** A time written as text in a pattern: {@link TemporalFormatted}. */
13
+ readonly TEMPORAL_FORMATTED: "temporal-formatted";
14
+ /** A fixed-point decimal: {@link NumericDecimal}. */
15
+ readonly DECIMAL: "decimal";
16
+ /** An amount of money: {@link NumericMoney}. */
17
+ readonly MONEY: "money";
18
+ /** A length of time: {@link DurationSemantic}. */
19
+ readonly DURATION: "duration";
20
+ /** The id of an aggregate: {@link ReferenceSemantic}. */
21
+ readonly REFERENCE: "reference";
22
+ }>;
23
+ /** A field that holds a calendar date. */
24
+ export interface TemporalDate {
25
+ /** The discriminator. */
26
+ type: typeof QuerySemanticTypes.TEMPORAL_DATE;
27
+ }
28
+ /** A field that holds a number of time units since the epoch. */
29
+ export interface TemporalEpoch {
30
+ /** The discriminator. */
31
+ type: typeof QuerySemanticTypes.TEMPORAL_EPOCH;
32
+ /** The unit the number counts; milliseconds when absent. */
33
+ timeUnit?: TimeUnit;
34
+ }
35
+ /** A field that holds a time written as text in a `java.time` pattern. */
36
+ export interface TemporalFormatted {
37
+ /** The discriminator. */
38
+ type: typeof QuerySemanticTypes.TEMPORAL_FORMATTED;
39
+ /** The `java.time` pattern, such as `yyyy-MM-dd`. */
40
+ pattern: string;
41
+ }
42
+ /**
43
+ * A number field meant as a fixed-point decimal with `scale` fraction
44
+ * digits: format and total it at that precision. Declared on the model
45
+ * (`@QueryDecimal`), never inferred. Wow 9.2 and later.
46
+ */
47
+ export interface NumericDecimal {
48
+ /** The discriminator. */
49
+ type: typeof QuerySemanticTypes.DECIMAL;
50
+ /** The number of digits after the decimal point, 0 or more. */
51
+ scale: number;
52
+ }
53
+ /**
54
+ * A number field meant as an amount of money, in exactly one of a fixed
55
+ * ISO 4217 `currency` or the currency held by the sibling string field
56
+ * `currencyField` (a property of the same object or element). `scale` is
57
+ * always sent: with a fixed currency the server resolves an omitted one to
58
+ * that currency's standard fraction digits (2 for CNY, 0 for JPY).
59
+ * Amounts in different currencies must not be totalled together. Declared
60
+ * on the model (`@QueryMoney`), never inferred. Wow 9.2 and later.
61
+ */
62
+ export type NumericMoney = {
63
+ /** The discriminator. */
64
+ type: typeof QuerySemanticTypes.MONEY;
65
+ /** The number of digits after the decimal point, 0 or more. */
66
+ scale: number;
67
+ } & ({
68
+ /** The fixed ISO 4217 currency code, such as `CNY`. */
69
+ currency: string;
70
+ currencyField?: undefined;
71
+ } | {
72
+ currency?: undefined;
73
+ /** The sibling property that holds each value's currency code. */
74
+ currencyField: string;
75
+ });
76
+ /**
77
+ * A number field that is a length of time counted in `timeUnit`, such as a
78
+ * timeout in seconds: format it as a duration. Declared on the model
79
+ * (`@QueryDuration`), never inferred. Wow 9.2 and later.
80
+ */
81
+ export interface DurationSemantic {
82
+ /** The discriminator. */
83
+ type: typeof QuerySemanticTypes.DURATION;
84
+ /** The unit the number counts; always sent. */
85
+ timeUnit: TimeUnit;
86
+ }
87
+ /**
88
+ * A field whose value is the id of an aggregate, to look it up and link to
89
+ * it: either a fixed aggregate, `contextName` and `aggregateName`, or per
90
+ * record the aggregate the sibling string fields `contextNameField` and
91
+ * `aggregateNameField` name (as in an `AggregateId`). The id is always the
92
+ * aggregate's own. Declared on the model (`@QueryReference`), or inferred
93
+ * for an `AggregateId`. Wow 9.2 and later.
94
+ */
95
+ export type ReferenceSemantic = {
96
+ /** The discriminator. */
97
+ type: typeof QuerySemanticTypes.REFERENCE;
98
+ } & ({
99
+ /** The referenced aggregate's bounded context. */
100
+ contextName: string;
101
+ /** The referenced aggregate's name. */
102
+ aggregateName: string;
103
+ contextNameField?: undefined;
104
+ aggregateNameField?: undefined;
105
+ } | {
106
+ contextName?: undefined;
107
+ aggregateName?: undefined;
108
+ /** The sibling property that holds each value's bounded context. */
109
+ contextNameField: string;
110
+ /** The sibling property that holds each value's aggregate name. */
111
+ aggregateNameField: string;
112
+ });
113
+ /**
114
+ * What a field's value means beyond its type, sent as its `semantic`: one
115
+ * of the three temporal kinds, which the relative time filters (`TODAY`,
116
+ * `RECENT_DAYS`, …) and date histograms need; one of the two numeric
117
+ * formats, which say how a number is read and displayed; a duration; or a
118
+ * reference to an aggregate. A field has one; an array field's is its
119
+ * items'.
120
+ *
121
+ * The union grows in minor releases, as the server learns a semantic, and a
122
+ * server newer than this client may send a `type` not listed here. The
123
+ * descriptor is read as JSON, not parsed, so it arrives as it is: keep a
124
+ * `default` branch in a `switch` over `type`, and treat a `type` you do not
125
+ * know as no semantic at all. The union stays closed so that narrowing on
126
+ * `type` still works.
127
+ */
128
+ export type QuerySemanticType = TemporalDate | TemporalEpoch | TemporalFormatted | NumericDecimal | NumericMoney | DurationSemantic | ReferenceSemantic;
@@ -0,0 +1,128 @@
1
+ import { TimeUnit } from './filter/index.js';
2
+ /**
3
+ * The semantics Wow names in a field's `semantic.type`, one per member of
4
+ * {@link QuerySemanticType}: read a descriptor's semantic by these rather
5
+ * than by its spelling.
6
+ */
7
+ export declare const QuerySemanticTypes: Readonly<{
8
+ /** A calendar date: {@link TemporalDate}. */
9
+ readonly TEMPORAL_DATE: "temporal-date";
10
+ /** A number of time units since the epoch: {@link TemporalEpoch}. */
11
+ readonly TEMPORAL_EPOCH: "temporal-epoch";
12
+ /** A time written as text in a pattern: {@link TemporalFormatted}. */
13
+ readonly TEMPORAL_FORMATTED: "temporal-formatted";
14
+ /** A fixed-point decimal: {@link NumericDecimal}. */
15
+ readonly DECIMAL: "decimal";
16
+ /** An amount of money: {@link NumericMoney}. */
17
+ readonly MONEY: "money";
18
+ /** A length of time: {@link DurationSemantic}. */
19
+ readonly DURATION: "duration";
20
+ /** The id of an aggregate: {@link ReferenceSemantic}. */
21
+ readonly REFERENCE: "reference";
22
+ }>;
23
+ /** A field that holds a calendar date. */
24
+ export interface TemporalDate {
25
+ /** The discriminator. */
26
+ type: typeof QuerySemanticTypes.TEMPORAL_DATE;
27
+ }
28
+ /** A field that holds a number of time units since the epoch. */
29
+ export interface TemporalEpoch {
30
+ /** The discriminator. */
31
+ type: typeof QuerySemanticTypes.TEMPORAL_EPOCH;
32
+ /** The unit the number counts; milliseconds when absent. */
33
+ timeUnit?: TimeUnit;
34
+ }
35
+ /** A field that holds a time written as text in a `java.time` pattern. */
36
+ export interface TemporalFormatted {
37
+ /** The discriminator. */
38
+ type: typeof QuerySemanticTypes.TEMPORAL_FORMATTED;
39
+ /** The `java.time` pattern, such as `yyyy-MM-dd`. */
40
+ pattern: string;
41
+ }
42
+ /**
43
+ * A number field meant as a fixed-point decimal with `scale` fraction
44
+ * digits: format and total it at that precision. Declared on the model
45
+ * (`@QueryDecimal`), never inferred. Wow 9.2 and later.
46
+ */
47
+ export interface NumericDecimal {
48
+ /** The discriminator. */
49
+ type: typeof QuerySemanticTypes.DECIMAL;
50
+ /** The number of digits after the decimal point, 0 or more. */
51
+ scale: number;
52
+ }
53
+ /**
54
+ * A number field meant as an amount of money, in exactly one of a fixed
55
+ * ISO 4217 `currency` or the currency held by the sibling string field
56
+ * `currencyField` (a property of the same object or element). `scale` is
57
+ * always sent: with a fixed currency the server resolves an omitted one to
58
+ * that currency's standard fraction digits (2 for CNY, 0 for JPY).
59
+ * Amounts in different currencies must not be totalled together. Declared
60
+ * on the model (`@QueryMoney`), never inferred. Wow 9.2 and later.
61
+ */
62
+ export type NumericMoney = {
63
+ /** The discriminator. */
64
+ type: typeof QuerySemanticTypes.MONEY;
65
+ /** The number of digits after the decimal point, 0 or more. */
66
+ scale: number;
67
+ } & ({
68
+ /** The fixed ISO 4217 currency code, such as `CNY`. */
69
+ currency: string;
70
+ currencyField?: undefined;
71
+ } | {
72
+ currency?: undefined;
73
+ /** The sibling property that holds each value's currency code. */
74
+ currencyField: string;
75
+ });
76
+ /**
77
+ * A number field that is a length of time counted in `timeUnit`, such as a
78
+ * timeout in seconds: format it as a duration. Declared on the model
79
+ * (`@QueryDuration`), never inferred. Wow 9.2 and later.
80
+ */
81
+ export interface DurationSemantic {
82
+ /** The discriminator. */
83
+ type: typeof QuerySemanticTypes.DURATION;
84
+ /** The unit the number counts; always sent. */
85
+ timeUnit: TimeUnit;
86
+ }
87
+ /**
88
+ * A field whose value is the id of an aggregate, to look it up and link to
89
+ * it: either a fixed aggregate, `contextName` and `aggregateName`, or per
90
+ * record the aggregate the sibling string fields `contextNameField` and
91
+ * `aggregateNameField` name (as in an `AggregateId`). The id is always the
92
+ * aggregate's own. Declared on the model (`@QueryReference`), or inferred
93
+ * for an `AggregateId`. Wow 9.2 and later.
94
+ */
95
+ export type ReferenceSemantic = {
96
+ /** The discriminator. */
97
+ type: typeof QuerySemanticTypes.REFERENCE;
98
+ } & ({
99
+ /** The referenced aggregate's bounded context. */
100
+ contextName: string;
101
+ /** The referenced aggregate's name. */
102
+ aggregateName: string;
103
+ contextNameField?: undefined;
104
+ aggregateNameField?: undefined;
105
+ } | {
106
+ contextName?: undefined;
107
+ aggregateName?: undefined;
108
+ /** The sibling property that holds each value's bounded context. */
109
+ contextNameField: string;
110
+ /** The sibling property that holds each value's aggregate name. */
111
+ aggregateNameField: string;
112
+ });
113
+ /**
114
+ * What a field's value means beyond its type, sent as its `semantic`: one
115
+ * of the three temporal kinds, which the relative time filters (`TODAY`,
116
+ * `RECENT_DAYS`, …) and date histograms need; one of the two numeric
117
+ * formats, which say how a number is read and displayed; a duration; or a
118
+ * reference to an aggregate. A field has one; an array field's is its
119
+ * items'.
120
+ *
121
+ * The union grows in minor releases, as the server learns a semantic, and a
122
+ * server newer than this client may send a `type` not listed here. The
123
+ * descriptor is read as JSON, not parsed, so it arrives as it is: keep a
124
+ * `default` branch in a `switch` over `type`, and treat a `type` you do not
125
+ * know as no semantic at all. The union stays closed so that narrowing on
126
+ * `type` still works.
127
+ */
128
+ export type QuerySemanticType = TemporalDate | TemporalEpoch | TemporalFormatted | NumericDecimal | NumericMoney | DurationSemantic | ReferenceSemantic;
@@ -0,0 +1,13 @@
1
+ // src/dsl/semanticTypes.ts
2
+ var e = Object.freeze({
3
+ TEMPORAL_DATE: "temporal-date",
4
+ TEMPORAL_EPOCH: "temporal-epoch",
5
+ TEMPORAL_FORMATTED: "temporal-formatted",
6
+ DECIMAL: "decimal",
7
+ MONEY: "money",
8
+ DURATION: "duration",
9
+ REFERENCE: "reference"
10
+ });
11
+ export { e as QuerySemanticTypes };
12
+
13
+ //# sourceMappingURL=semanticTypes.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"semanticTypes.es.js","names":["QuerySemanticTypes"],"sources":["../../src/dsl/semanticTypes.ts"],"sourcesContent":["/*\n * Copyright [2021-present] [ahoo wang <ahoowang@qq.com> (https://github.com/Ahoo-Wang)].\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * http://www.apache.org/licenses/LICENSE-2.0\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { TimeUnit } from './filter/index.js';\n\n/**\n * The semantics Wow names in a field's `semantic.type`, one per member of\n * {@link QuerySemanticType}: read a descriptor's semantic by these rather\n * than by its spelling.\n */\nexport const QuerySemanticTypes = Object.freeze({\n /** A calendar date: {@link TemporalDate}. */\n TEMPORAL_DATE: 'temporal-date',\n /** A number of time units since the epoch: {@link TemporalEpoch}. */\n TEMPORAL_EPOCH: 'temporal-epoch',\n /** A time written as text in a pattern: {@link TemporalFormatted}. */\n TEMPORAL_FORMATTED: 'temporal-formatted',\n /** A fixed-point decimal: {@link NumericDecimal}. */\n DECIMAL: 'decimal',\n /** An amount of money: {@link NumericMoney}. */\n MONEY: 'money',\n /** A length of time: {@link DurationSemantic}. */\n DURATION: 'duration',\n /** The id of an aggregate: {@link ReferenceSemantic}. */\n REFERENCE: 'reference',\n} as const);\n\n/** A field that holds a calendar date. */\nexport interface TemporalDate {\n /** The discriminator. */\n type: typeof QuerySemanticTypes.TEMPORAL_DATE;\n}\n\n/** A field that holds a number of time units since the epoch. */\nexport interface TemporalEpoch {\n /** The discriminator. */\n type: typeof QuerySemanticTypes.TEMPORAL_EPOCH;\n /** The unit the number counts; milliseconds when absent. */\n timeUnit?: TimeUnit;\n}\n\n/** A field that holds a time written as text in a `java.time` pattern. */\nexport interface TemporalFormatted {\n /** The discriminator. */\n type: typeof QuerySemanticTypes.TEMPORAL_FORMATTED;\n /** The `java.time` pattern, such as `yyyy-MM-dd`. */\n pattern: string;\n}\n\n/**\n * A number field meant as a fixed-point decimal with `scale` fraction\n * digits: format and total it at that precision. Declared on the model\n * (`@QueryDecimal`), never inferred. Wow 9.2 and later.\n */\nexport interface NumericDecimal {\n /** The discriminator. */\n type: typeof QuerySemanticTypes.DECIMAL;\n /** The number of digits after the decimal point, 0 or more. */\n scale: number;\n}\n\n/**\n * A number field meant as an amount of money, in exactly one of a fixed\n * ISO 4217 `currency` or the currency held by the sibling string field\n * `currencyField` (a property of the same object or element). `scale` is\n * always sent: with a fixed currency the server resolves an omitted one to\n * that currency's standard fraction digits (2 for CNY, 0 for JPY).\n * Amounts in different currencies must not be totalled together. Declared\n * on the model (`@QueryMoney`), never inferred. Wow 9.2 and later.\n */\nexport type NumericMoney = {\n /** The discriminator. */\n type: typeof QuerySemanticTypes.MONEY;\n /** The number of digits after the decimal point, 0 or more. */\n scale: number;\n} & (\n | {\n /** The fixed ISO 4217 currency code, such as `CNY`. */\n currency: string;\n currencyField?: undefined;\n }\n | {\n currency?: undefined;\n /** The sibling property that holds each value's currency code. */\n currencyField: string;\n }\n);\n\n/**\n * A number field that is a length of time counted in `timeUnit`, such as a\n * timeout in seconds: format it as a duration. Declared on the model\n * (`@QueryDuration`), never inferred. Wow 9.2 and later.\n */\nexport interface DurationSemantic {\n /** The discriminator. */\n type: typeof QuerySemanticTypes.DURATION;\n /** The unit the number counts; always sent. */\n timeUnit: TimeUnit;\n}\n\n/**\n * A field whose value is the id of an aggregate, to look it up and link to\n * it: either a fixed aggregate, `contextName` and `aggregateName`, or per\n * record the aggregate the sibling string fields `contextNameField` and\n * `aggregateNameField` name (as in an `AggregateId`). The id is always the\n * aggregate's own. Declared on the model (`@QueryReference`), or inferred\n * for an `AggregateId`. Wow 9.2 and later.\n */\nexport type ReferenceSemantic = {\n /** The discriminator. */\n type: typeof QuerySemanticTypes.REFERENCE;\n} & (\n | {\n /** The referenced aggregate's bounded context. */\n contextName: string;\n /** The referenced aggregate's name. */\n aggregateName: string;\n contextNameField?: undefined;\n aggregateNameField?: undefined;\n }\n | {\n contextName?: undefined;\n aggregateName?: undefined;\n /** The sibling property that holds each value's bounded context. */\n contextNameField: string;\n /** The sibling property that holds each value's aggregate name. */\n aggregateNameField: string;\n }\n);\n\n/**\n * What a field's value means beyond its type, sent as its `semantic`: one\n * of the three temporal kinds, which the relative time filters (`TODAY`,\n * `RECENT_DAYS`, …) and date histograms need; one of the two numeric\n * formats, which say how a number is read and displayed; a duration; or a\n * reference to an aggregate. A field has one; an array field's is its\n * items'.\n *\n * The union grows in minor releases, as the server learns a semantic, and a\n * server newer than this client may send a `type` not listed here. The\n * descriptor is read as JSON, not parsed, so it arrives as it is: keep a\n * `default` branch in a `switch` over `type`, and treat a `type` you do not\n * know as no semantic at all. The union stays closed so that narrowing on\n * `type` still works.\n */\nexport type QuerySemanticType =\n | TemporalDate\n | TemporalEpoch\n | TemporalFormatted\n | NumericDecimal\n | NumericMoney\n | DurationSemantic\n | ReferenceSemantic;\n"],"mappings":";AAoBA,IAAaA,IAAqB,OAAO,OAAO;CAE9C,eAAe;CAEf,gBAAgB;CAEhB,oBAAoB;CAEpB,SAAS;CAET,OAAO;CAEP,UAAU;CAEV,WAAW;AACb,CAAU"}
package/dist/dsl.cjs CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./dsl/filter/operator.cjs"),t=require("./dsl/aggregation/types.cjs"),n=require("./dsl/deletionState.cjs"),r=require("./dsl/filter/builders.cjs"),i=require("./dsl/sort.cjs"),a=require("./dsl/aggregation/builders.cjs"),o=require("./dsl/projection.cjs"),s=require("./dsl/pagination.cjs"),c=require("./dsl/cursorQuery.cjs"),l=require("./dsl/queryable.cjs"),u=require("./dsl/descriptor.cjs"),d=require("./dsl/queryErrorCodes.cjs");exports.AGGREGATION_LIMITS=t.AGGREGATION_LIMITS,exports.AggregationDatePart=t.AggregationDatePart,exports.AggregationDateUnit=t.AggregationDateUnit,exports.AggregationExpressionOperator=t.AggregationExpressionOperator,exports.AggregationExpressionType=t.AggregationExpressionType,exports.AggregationFunction=t.AggregationFunction,exports.AggregationGroupScope=t.AggregationGroupScope,exports.AggregationGroupType=t.AggregationGroupType,exports.AggregationMetricType=t.AggregationMetricType,exports.ComparisonOperator=t.ComparisonOperator,exports.DEFAULT_CURSOR_SIZE=c.DEFAULT_CURSOR_SIZE,exports.DEFAULT_PAGINATION=s.DEFAULT_PAGINATION,exports.DateDiffUnit=t.DateDiffUnit,exports.DeletionState=n.DeletionState,exports.DerivedExpressionType=t.DerivedExpressionType,exports.FilterOperator=e.FilterOperator,exports.HavingExpressionType=t.HavingExpressionType,exports.MAX_CURSOR_SIZE=c.MAX_CURSOR_SIZE,exports.MAX_CURSOR_SORT_FIELDS=c.MAX_CURSOR_SORT_FIELDS,exports.PagingMode=u.PagingMode,exports.QueryConstraintTypes=u.QueryConstraintTypes,exports.QueryErrorCodes=d.QueryErrorCodes,exports.QueryFieldRoles=u.QueryFieldRoles,exports.QueryModels=u.QueryModels,exports.QuerySemanticTypes=u.QuerySemanticTypes,exports.QueryValueKind=u.QueryValueKind,exports.QueryValueTypes=u.QueryValueTypes,exports.RunningFunction=t.RunningFunction,exports.SearchMode=e.SearchMode,exports.SensitivityLevel=u.SensitivityLevel,exports.SortDirection=i.SortDirection,exports.StringComparison=e.StringComparison,exports.TimeUnit=e.TimeUnit,exports.WindowFunction=t.WindowFunction,exports.aggregation=a.aggregation,exports.asc=i.asc,exports.cursorQuery=c.cursorQuery,exports.desc=i.desc,exports.filter=r.filter,exports.listQuery=l.listQuery,exports.pagedList=l.pagedList,exports.pagedQuery=l.pagedQuery,exports.pagination=s.pagination,exports.projection=o.projection,exports.singleQuery=l.singleQuery;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./dsl/filter/operator.cjs"),t=require("./dsl/aggregation/types.cjs"),n=require("./dsl/deletionState.cjs"),r=require("./dsl/filter/builders.cjs"),i=require("./dsl/aggregation/groups.cjs"),a=require("./dsl/aggregation/metrics.cjs"),o=require("./dsl/aggregation/derived.cjs"),s=require("./dsl/aggregation/having.cjs"),c=require("./dsl/sort.cjs"),l=require("./dsl/aggregation/builders.cjs"),u=require("./dsl/projection.cjs"),d=require("./dsl/pagination.cjs"),f=require("./dsl/cursorQuery.cjs"),p=require("./dsl/queryable.cjs"),m=require("./dsl/descriptor.cjs"),h=require("./dsl/fieldDescriptor.cjs"),g=require("./dsl/semanticTypes.cjs"),_=require("./dsl/queryErrorCodes.cjs");exports.AGGREGATION_LIMITS=t.AGGREGATION_LIMITS,exports.AggregationDatePart=i.AggregationDatePart,exports.AggregationDateUnit=i.AggregationDateUnit,exports.AggregationExpressionOperator=t.AggregationExpressionOperator,exports.AggregationExpressionType=t.AggregationExpressionType,exports.AggregationFunction=a.AggregationFunction,exports.AggregationGroupScope=i.AggregationGroupScope,exports.AggregationGroupType=i.AggregationGroupType,exports.AggregationMetricType=a.AggregationMetricType,exports.ComparisonOperator=t.ComparisonOperator,exports.DEFAULT_PAGINATION=d.DEFAULT_PAGINATION,exports.DateDiffUnit=t.DateDiffUnit,exports.DeletionState=n.DeletionState,exports.DerivedExpressionType=o.DerivedExpressionType,exports.FilterOperator=e.FilterOperator,exports.HavingExpressionType=s.HavingExpressionType,exports.MAX_CURSOR_SIZE=f.MAX_CURSOR_SIZE,exports.MAX_CURSOR_SORT_FIELDS=f.MAX_CURSOR_SORT_FIELDS,exports.PagingMode=m.PagingMode,exports.QueryConstraintTypes=m.QueryConstraintTypes,exports.QueryErrorCodes=_.QueryErrorCodes,exports.QueryFieldRoles=h.QueryFieldRoles,exports.QueryModels=m.QueryModels,exports.QuerySemanticTypes=g.QuerySemanticTypes,exports.QueryValueKind=h.QueryValueKind,exports.QueryValueTypes=h.QueryValueTypes,exports.RunningFunction=o.RunningFunction,exports.SearchMode=e.SearchMode,exports.SensitivityLevel=h.SensitivityLevel,exports.SortDirection=c.SortDirection,exports.StringComparison=e.StringComparison,exports.TimeUnit=e.TimeUnit,exports.WindowFunction=o.WindowFunction,exports.aggregation=l.aggregation,exports.asc=c.asc,exports.cursorQuery=f.cursorQuery,exports.desc=c.desc,exports.filter=r.filter,exports.listQuery=p.listQuery,exports.pagedList=p.pagedList,exports.pagedQuery=p.pagedQuery,exports.pagination=d.pagination,exports.projection=u.projection,exports.singleQuery=p.singleQuery;
package/dist/dsl.d.cts CHANGED
@@ -19,4 +19,6 @@ export * from './dsl/queryable.cjs';
19
19
  export * from './dsl/deletionState.cjs';
20
20
  export * from './dsl/documents.cjs';
21
21
  export * from './dsl/descriptor.cjs';
22
+ export * from './dsl/fieldDescriptor.cjs';
23
+ export * from './dsl/semanticTypes.cjs';
22
24
  export * from './dsl/queryErrorCodes.cjs';
package/dist/dsl.d.ts CHANGED
@@ -19,4 +19,6 @@ export * from './dsl/queryable.js';
19
19
  export * from './dsl/deletionState.js';
20
20
  export * from './dsl/documents.js';
21
21
  export * from './dsl/descriptor.js';
22
+ export * from './dsl/fieldDescriptor.js';
23
+ export * from './dsl/semanticTypes.js';
22
24
  export * from './dsl/queryErrorCodes.js';
package/dist/dsl.es.js CHANGED
@@ -1,13 +1,19 @@
1
1
  import { FilterOperator as e, SearchMode as t, StringComparison as n, TimeUnit as r } from "./dsl/filter/operator.es.js";
2
- import { AGGREGATION_LIMITS as i, AggregationDatePart as a, AggregationDateUnit as o, AggregationExpressionOperator as s, AggregationExpressionType as c, AggregationFunction as l, AggregationGroupScope as u, AggregationGroupType as d, AggregationMetricType as f, ComparisonOperator as p, DateDiffUnit as m, DerivedExpressionType as h, HavingExpressionType as g, RunningFunction as _, WindowFunction as v } from "./dsl/aggregation/types.es.js";
3
- import { DeletionState as y } from "./dsl/deletionState.es.js";
4
- import { filter as b } from "./dsl/filter/builders.es.js";
2
+ import { AGGREGATION_LIMITS as i, AggregationExpressionOperator as a, AggregationExpressionType as o, ComparisonOperator as s, DateDiffUnit as c } from "./dsl/aggregation/types.es.js";
3
+ import { DeletionState as l } from "./dsl/deletionState.es.js";
4
+ import { filter as u } from "./dsl/filter/builders.es.js";
5
+ import { AggregationDatePart as d, AggregationDateUnit as f, AggregationGroupScope as p, AggregationGroupType as m } from "./dsl/aggregation/groups.es.js";
6
+ import { AggregationFunction as h, AggregationMetricType as g } from "./dsl/aggregation/metrics.es.js";
7
+ import { DerivedExpressionType as _, RunningFunction as v, WindowFunction as y } from "./dsl/aggregation/derived.es.js";
8
+ import { HavingExpressionType as b } from "./dsl/aggregation/having.es.js";
5
9
  import { SortDirection as x, asc as S, desc as C } from "./dsl/sort.es.js";
6
10
  import { aggregation as w } from "./dsl/aggregation/builders.es.js";
7
11
  import { projection as T } from "./dsl/projection.es.js";
8
12
  import { DEFAULT_PAGINATION as E, pagination as D } from "./dsl/pagination.es.js";
9
- import { DEFAULT_CURSOR_SIZE as O, MAX_CURSOR_SIZE as k, MAX_CURSOR_SORT_FIELDS as A, cursorQuery as j } from "./dsl/cursorQuery.es.js";
10
- import { listQuery as M, pagedList as N, pagedQuery as P, singleQuery as F } from "./dsl/queryable.es.js";
11
- import { PagingMode as I, QueryConstraintTypes as L, QueryFieldRoles as R, QueryModels as z, QuerySemanticTypes as B, QueryValueKind as V, QueryValueTypes as H, SensitivityLevel as U } from "./dsl/descriptor.es.js";
12
- import { QueryErrorCodes as W } from "./dsl/queryErrorCodes.es.js";
13
- export { i as AGGREGATION_LIMITS, a as AggregationDatePart, o as AggregationDateUnit, s as AggregationExpressionOperator, c as AggregationExpressionType, l as AggregationFunction, u as AggregationGroupScope, d as AggregationGroupType, f as AggregationMetricType, p as ComparisonOperator, O as DEFAULT_CURSOR_SIZE, E as DEFAULT_PAGINATION, m as DateDiffUnit, y as DeletionState, h as DerivedExpressionType, e as FilterOperator, g as HavingExpressionType, k as MAX_CURSOR_SIZE, A as MAX_CURSOR_SORT_FIELDS, I as PagingMode, L as QueryConstraintTypes, W as QueryErrorCodes, R as QueryFieldRoles, z as QueryModels, B as QuerySemanticTypes, V as QueryValueKind, H as QueryValueTypes, _ as RunningFunction, t as SearchMode, U as SensitivityLevel, x as SortDirection, n as StringComparison, r as TimeUnit, v as WindowFunction, w as aggregation, S as asc, j as cursorQuery, C as desc, b as filter, M as listQuery, N as pagedList, P as pagedQuery, D as pagination, T as projection, F as singleQuery };
13
+ import { MAX_CURSOR_SIZE as O, MAX_CURSOR_SORT_FIELDS as k, cursorQuery as A } from "./dsl/cursorQuery.es.js";
14
+ import { listQuery as j, pagedList as M, pagedQuery as N, singleQuery as P } from "./dsl/queryable.es.js";
15
+ import { PagingMode as F, QueryConstraintTypes as I, QueryModels as L } from "./dsl/descriptor.es.js";
16
+ import { QueryFieldRoles as R, QueryValueKind as z, QueryValueTypes as B, SensitivityLevel as V } from "./dsl/fieldDescriptor.es.js";
17
+ import { QuerySemanticTypes as H } from "./dsl/semanticTypes.es.js";
18
+ import { QueryErrorCodes as U } from "./dsl/queryErrorCodes.es.js";
19
+ export { i as AGGREGATION_LIMITS, d as AggregationDatePart, f as AggregationDateUnit, a as AggregationExpressionOperator, o as AggregationExpressionType, h as AggregationFunction, p as AggregationGroupScope, m as AggregationGroupType, g as AggregationMetricType, s as ComparisonOperator, E as DEFAULT_PAGINATION, c as DateDiffUnit, l as DeletionState, _ as DerivedExpressionType, e as FilterOperator, b as HavingExpressionType, O as MAX_CURSOR_SIZE, k as MAX_CURSOR_SORT_FIELDS, F as PagingMode, I as QueryConstraintTypes, U as QueryErrorCodes, R as QueryFieldRoles, L as QueryModels, H as QuerySemanticTypes, z as QueryValueKind, B as QueryValueTypes, v as RunningFunction, t as SearchMode, V as SensitivityLevel, x as SortDirection, n as StringComparison, r as TimeUnit, y as WindowFunction, w as aggregation, S as asc, A as cursorQuery, C as desc, u as filter, j as listQuery, M as pagedList, N as pagedQuery, D as pagination, T as projection, P as singleQuery };
@@ -1,3 +1,3 @@
1
- var e=Symbol(`wow.textNumbersBy`);function t(t,n,r){return{[e]:{discriminant:t,member:n,cases:r}}}function n(t){return t===void 0?!0:t===!0?!1:e in t?Object.values(t[e].cases).every(n):Object.values(t).every(n)}var r=class{constructor(e){this.text=e}};function i(t,n){if(!(t===void 0||t===!0||e in t))return Object.prototype.hasOwnProperty.call(t,n)?t[n]:Object.prototype.hasOwnProperty.call(t,`*`)?t[`*`]:void 0}function a(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function o(t,n){if(t instanceof r)return n===!0?t.text:Number(t.text);if(Array.isArray(t)){for(let e=0;e<t.length;e++)t[e]=o(t[e],i(n,String(e)));return t}if(typeof t==`object`&&t){let r=t,s=n!==void 0&&n!==!0&&e in n?n[e]:void 0,c=s===void 0?void 0:r[s.discriminant];for(let e of Object.keys(r)){let t=s===void 0?i(n,e):e===s.member&&typeof c==`string`?s.cases[c]:void 0;a(r,e,o(r[e],t))}}return t}var s={TAB:9,LF:10,CR:13,SPACE:32,QUOTE:34,PLUS:43,COMMA:44,MINUS:45,DOT:46,ZERO:48,NINE:57,COLON:58,UPPER_E:69,OPEN_BRACKET:91,BACKSLASH:92,CLOSE_BRACKET:93,LOWER_E:101,OPEN_BRACE:123,CLOSE_BRACE:125},c={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
2
- `,r:`\r`,t:` `},l=class{constructor(e){this.text=e,this.at=0}parse(e){this.skipSpaces();let t=this.value(e,!1);return this.skipSpaces(),this.at<this.text.length&&this.fail(),t}value(e,t){switch(this.text.charCodeAt(this.at)){case s.OPEN_BRACE:return this.object(e,t);case s.OPEN_BRACKET:return this.array(e,t);case s.QUOTE:return this.string();case 116:return this.literal(`true`,!0);case 102:return this.literal(`false`,!1);case 110:return this.literal(`null`,null);default:{let n=this.number();return t?new r(n):e===!0?n:Number(n)}}}object(t,n){this.at++;let r={},c=!n&&t!==void 0&&t!==!0&&e in t?t[e]:void 0;if(this.skipSpaces(),this.text.charCodeAt(this.at)===s.CLOSE_BRACE)return this.at++,r;for(;;){this.text.charCodeAt(this.at)!==s.QUOTE&&this.fail();let e=this.string();this.skipSpaces(),this.expect(s.COLON),this.skipSpaces(),a(r,e,c!==void 0&&e===c.member?this.value(void 0,!0):this.value(n?void 0:i(t,e),n)),this.skipSpaces();let o=this.text.charCodeAt(this.at++);if(o===s.CLOSE_BRACE)break;o!==s.COMMA&&this.fail(this.at-1),this.skipSpaces()}if(c!==void 0&&Object.prototype.hasOwnProperty.call(r,c.member)){let e=r[c.discriminant];a(r,c.member,o(r[c.member],typeof e==`string`?c.cases[e]:void 0))}return r}array(e,t){this.at++;let n=[];if(this.skipSpaces(),this.text.charCodeAt(this.at)===s.CLOSE_BRACKET)return this.at++,n;let r=t?void 0:i(e,`*`);for(;;){n.push(this.value(r,t)),this.skipSpaces();let e=this.text.charCodeAt(this.at++);if(e===s.CLOSE_BRACKET)return n;e!==s.COMMA&&this.fail(this.at-1),this.skipSpaces()}}string(){let e=this.text,t=++this.at,n=``;for(;;){let r=e.charCodeAt(this.at);if(r===s.QUOTE)return n+=e.slice(t,this.at++),n;if(r===s.BACKSLASH){n+=e.slice(t,this.at);let r=e[this.at+1];if(r===`u`){let t=e.slice(this.at+2,this.at+6);/^[0-9a-fA-F]{4}$/.test(t)||this.fail(this.at),n+=String.fromCharCode(Number.parseInt(t,16)),this.at+=6}else{let e=r===void 0?void 0:c[r];e===void 0&&this.fail(this.at),n+=e,this.at+=2}t=this.at}else r<s.SPACE||Number.isNaN(r)?this.fail():this.at++}}number(){let e=this.text,t=this.at;e.charCodeAt(this.at)===s.MINUS&&this.at++;let n=e.charCodeAt(this.at);n===s.ZERO?this.at++:n>s.ZERO&&n<=s.NINE?this.digits():this.fail(),e.charCodeAt(this.at)===s.DOT&&(this.at++,this.digits()||this.fail());let r=e.charCodeAt(this.at);if(r===s.LOWER_E||r===s.UPPER_E){this.at++;let t=e.charCodeAt(this.at);(t===s.PLUS||t===s.MINUS)&&this.at++,this.digits()||this.fail()}return e.slice(t,this.at)}digits(){let e=this.at,t=this.text.charCodeAt(this.at);for(;t>=s.ZERO&&t<=s.NINE;)t=this.text.charCodeAt(++this.at);return this.at>e}literal(e,t){return this.text.startsWith(e,this.at)||this.fail(),this.at+=e.length,t}skipSpaces(){let e=this.text.charCodeAt(this.at);for(;e===s.SPACE||e===s.LF||e===s.CR||e===s.TAB;)e=this.text.charCodeAt(++this.at)}expect(e){this.text.charCodeAt(this.at)!==e&&this.fail(),this.at++}fail(e=this.at){throw SyntaxError(e>=this.text.length?`Unexpected end of JSON input`:`Unexpected token in JSON at position ${e}`)}};function u(e,t){return n(t)?JSON.parse(e):new l(e).parse(t)}var d=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function f(e,t){if(n(t))return JSON.stringify(e);let r=[],i=`\u0000wow-number-${Math.random().toString(36).slice(2)}:`,a=p(e,t,r,i),o=JSON.stringify(a);if(r.length===0)return o;let s=RegExp(`"${JSON.stringify(i).slice(1,-1).replace(/\\/g,`\\\\`)}(\\d+)"`,`g`);return o.replace(s,(e,t)=>r[Number(t)])}function p(t,n,r,o){if(n===void 0||t==null)return t;if(n===!0){if(typeof t!=`string`)return t;if(!d.test(t))throw TypeError(`Not a JSON number: [${t}].`);return r.push(t),`${o}${r.length-1}`}if(Array.isArray(t))return t.map((e,t)=>p(e,i(n,String(t)),r,o));if(typeof t!=`object`)return t;let s=t;if(typeof s.toJSON==`function`)return t;let c=e in n?n[e]:void 0,l=c===void 0?void 0:s[c.discriminant],u={};for(let e of Object.keys(s)){let t=c===void 0?i(n,e):e===c.member&&typeof l==`string`?c.cases[l]:void 0;a(u,e,p(s[e],t,r,o))}return u}function m(e){let n=e.textNumbers?.events;return n===void 0?void 0:t(`name`,`body`,n)}exports.eventNumbers=m,exports.marksNothing=n,exports.parseJson=u,exports.stringifyJson=f,exports.textNumbersBy=t;
1
+ var e=Symbol(`wow.textNumberOr`),t=Symbol(`wow.textNumbersBy`);function n(t){return{[e]:t}}function r(e,n){return{[t]:{discriminant:e,cases:n}}}function i(n){return n===void 0?!0:n===!0||typeof n==`function`||e in n?!1:Object.values(t in n?n[t].cases:n).every(i)}var a=class{constructor(e){this.text=e}};function o(t,n){for(;typeof t==`function`;)t=t();return t!==void 0&&t!==!0&&e in t?!n||o(t[e],!0):t}function s(e,n){let r=typeof n==`object`&&!!n,i=o(e,r);if(i===void 0||i===!0||!(t in i))return i;let{discriminant:a,cases:c}=i[t],l=r?n[a]:void 0;return typeof l==`string`&&Object.prototype.hasOwnProperty.call(c,l)?s(c[l],n):void 0}function c(e,t){if(e===void 0||e===!0||typeof e==`function`)return;let n=e;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:Object.prototype.hasOwnProperty.call(n,`*`)?n[`*`]:void 0}function l(e,t,n){t===`__proto__`?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function u(e,t){if(e instanceof a)return o(t,!1)===!0?e.text:Number(e.text);let n=s(t,e);if(Array.isArray(e))for(let t=0;t<e.length;t++)e[t]=u(e[t],c(n,String(t)));else if(typeof e==`object`&&e){let t=e;for(let e of Object.keys(t))l(t,e,u(t[e],c(n,e)))}return e}var d={TAB:9,LF:10,CR:13,SPACE:32,QUOTE:34,PLUS:43,COMMA:44,MINUS:45,DOT:46,ZERO:48,NINE:57,COLON:58,UPPER_E:69,OPEN_BRACKET:91,BACKSLASH:92,CLOSE_BRACKET:93,LOWER_E:101,OPEN_BRACE:123,CLOSE_BRACE:125},f={'"':`"`,"\\":`\\`,"/":`/`,b:`\b`,f:`\f`,n:`
2
+ `,r:`\r`,t:` `},p=class{constructor(e){this.text=e,this.at=0}parse(e){this.skipSpaces();let t=this.value(e,!1);return this.skipSpaces(),this.at<this.text.length&&this.fail(),t}value(e,n){let r=this.text.charCodeAt(this.at);switch(r){case d.OPEN_BRACE:case d.OPEN_BRACKET:{if(n)return this.compound(r,void 0,!0);let i=o(e,!0);return i!==void 0&&i!==!0&&t in i?u(this.compound(r,void 0,!0),i):this.compound(r,i,!1)}case d.QUOTE:return this.string();case 116:return this.literal(`true`,!0);case 102:return this.literal(`false`,!1);case 110:return this.literal(`null`,null);default:{let t=this.number();return n?new a(t):o(e,!1)===!0?t:Number(t)}}}compound(e,t,n){let r=e===d.OPEN_BRACKET,i=r?d.CLOSE_BRACKET:d.CLOSE_BRACE,a=[],o={};if(this.at++,this.skipSpaces(),this.text.charCodeAt(this.at)===i)return this.at++,r?a:o;for(;;){if(r)a.push(this.value(c(t,`*`),n));else{this.text.charCodeAt(this.at)!==d.QUOTE&&this.fail();let e=this.string();this.skipSpaces(),this.expect(d.COLON),this.skipSpaces(),l(o,e,this.value(c(t,e),n))}this.skipSpaces();let e=this.text.charCodeAt(this.at++);if(e===i)return r?a:o;e!==d.COMMA&&this.fail(this.at-1),this.skipSpaces()}}string(){let e=this.text,t=++this.at,n=``;for(;;){let r=e.charCodeAt(this.at);if(r===d.QUOTE)return n+=e.slice(t,this.at++),n;if(r===d.BACKSLASH){n+=e.slice(t,this.at);let r=e[this.at+1];if(r===`u`){let t=e.slice(this.at+2,this.at+6);/^[0-9a-fA-F]{4}$/.test(t)||this.fail(this.at),n+=String.fromCharCode(Number.parseInt(t,16)),this.at+=6}else{let e=r===void 0?void 0:f[r];e===void 0&&this.fail(this.at),n+=e,this.at+=2}t=this.at}else r<d.SPACE||Number.isNaN(r)?this.fail():this.at++}}number(){let e=this.text,t=this.at;e.charCodeAt(this.at)===d.MINUS&&this.at++;let n=e.charCodeAt(this.at);n===d.ZERO?this.at++:n>d.ZERO&&n<=d.NINE?this.digits():this.fail(),e.charCodeAt(this.at)===d.DOT&&(this.at++,this.digits()||this.fail());let r=e.charCodeAt(this.at);if(r===d.LOWER_E||r===d.UPPER_E){this.at++;let t=e.charCodeAt(this.at);(t===d.PLUS||t===d.MINUS)&&this.at++,this.digits()||this.fail()}return e.slice(t,this.at)}digits(){let e=this.at,t=this.text.charCodeAt(this.at);for(;t>=d.ZERO&&t<=d.NINE;)t=this.text.charCodeAt(++this.at);return this.at>e}literal(e,t){return this.text.startsWith(e,this.at)||this.fail(),this.at+=e.length,t}skipSpaces(){let e=this.text.charCodeAt(this.at);for(;e===d.SPACE||e===d.LF||e===d.CR||e===d.TAB;)e=this.text.charCodeAt(++this.at)}expect(e){this.text.charCodeAt(this.at)!==e&&this.fail(),this.at++}fail(e=this.at){throw SyntaxError(e>=this.text.length?`Unexpected end of JSON input`:`Unexpected token in JSON at position ${e}`)}};function m(e,t){return i(t)?JSON.parse(e):new p(e).parse(t)}var h=/^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;function g(e,t){if(i(t))return JSON.stringify(e);let n=[],r=`\u0000wow-number-${Math.random().toString(36).slice(2)}:`,a=_(e,t,n,r),o=JSON.stringify(a);if(n.length===0)return o;let s=RegExp(`"${JSON.stringify(r).slice(1,-1).replace(/\\/g,`\\\\`)}(\\d+)"`,`g`);return o.replace(s,(e,t)=>n[Number(t)])}function _(e,t,n,r){let i=s(t,e);if(i===void 0||e==null)return e;if(i===!0){if(typeof e!=`string`)return e;if(!h.test(e))throw TypeError(`Not a JSON number: [${e}].`);return n.push(e),`${r}${n.length-1}`}if(Array.isArray(e))return e.map((e,t)=>_(e,c(i,String(t)),n,r));if(typeof e!=`object`)return e;let a=e;if(typeof a.toJSON==`function`)return e;let o={};for(let e of Object.keys(a))l(o,e,_(a[e],c(i,e),n,r));return o}function v(e){let t=Object.entries(e).filter(e=>e[1]!==void 0);return t.length===0?void 0:Object.fromEntries(t)}function y(e){let t=e.textNumbers?.events;return t===void 0?void 0:r(`name`,Object.fromEntries(Object.entries(t).map(([e,t])=>[e,{body:t}])))}exports.eventNumbers=y,exports.marksNothing=i,exports.parseJson=m,exports.recordNumbers=v,exports.stringifyJson=g,exports.textNumberOr=n,exports.textNumbersBy=r;
3
3
  //# sourceMappingURL=exactJson.cjs.map