@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldDescriptor.cjs","names":["QueryValueTypes","QueryValueKind","\"UNKNOWN\"","\"NULL\"","\"SCALAR\"","\"OBJECT\"","\"ARRAY\"","\"UNION\"","QueryFieldRoles","SensitivityLevel","\"DISPLAY\"","\"CONFIDENTIAL\""],"sources":["../../src/dsl/fieldDescriptor.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 { AggregationGroupType } from './aggregation/groups.js';\nimport type { AggregationFunction } from './aggregation/metrics.js';\nimport type { FilterOperator } from './filter/index.js';\nimport type { QuerySemanticType } from './semanticTypes.js';\n\n/**\n * The value types Wow names in a field's `types`. The set is open, like\n * {@link QueryModels}.\n */\nexport const QueryValueTypes = Object.freeze({\n /** A JSON string. */\n STRING: 'string',\n /** A whole number. */\n INTEGER: 'integer',\n /** A number with a fraction. */\n DECIMAL: 'decimal',\n /** `true` or `false`. */\n BOOLEAN: 'boolean',\n /** A JSON object. */\n OBJECT: 'object',\n} as const);\n\n/** A field's value type: one of {@link QueryValueTypes}, or one a server added. */\nexport type QueryValueType =\n (typeof QueryValueTypes)[keyof typeof QueryValueTypes] | (string & {});\n\n/** The structural shape of a field's value, sent as its `kind`. */\nexport enum QueryValueKind {\n /** Wow could not tell. */\n UNKNOWN = 'unknown',\n /** Always `null`. */\n NULL = 'null',\n /** A single string, number or boolean. */\n SCALAR = 'scalar',\n /** An object. */\n OBJECT = 'object',\n /** An array. */\n ARRAY = 'array',\n /** One of several of the above. */\n UNION = 'union',\n}\n\n/**\n * The system roles Wow names in a field's `role`: the system fields a root\n * operator targets, and the model's times. The set is open, like\n * {@link QueryModels}.\n */\nexport const QueryFieldRoles = Object.freeze({\n /** The record's own identity, `record.identity`. */\n IDENTITY: 'identity',\n /** The aggregate id. */\n AGGREGATE_ID: 'aggregate-id',\n /** The tenant id. */\n TENANT_ID: 'tenant-id',\n /** The owner id. */\n OWNER_ID: 'owner-id',\n /** The space id. */\n SPACE_ID: 'space-id',\n /** Whether the aggregate is deleted. */\n DELETED: 'deleted',\n /**\n * When the record's events happened: a snapshot's last event\n * (`eventTime`), an event stream's events (`createTime`). `FIRST` and\n * `LAST` order by it when they name no `orderBy`. Wow 9.2 and later.\n */\n EVENT_TIME: 'event-time',\n /**\n * When a snapshot's aggregate got its first event, i.e. was created\n * (`firstEventTime`). Wow 9.2 and later.\n */\n FIRST_EVENT_TIME: 'first-event-time',\n} as const);\n\n/** A system field's role: one of {@link QueryFieldRoles}, or one a server added. */\nexport type QueryFieldRole =\n (typeof QueryFieldRoles)[keyof typeof QueryFieldRoles] | (string & {});\n\n/** One declared value of an enum field, with its description when it has one. */\nexport interface EnumValueDescriptor {\n /** The value as it is stored and filtered by. */\n value: unknown;\n /**\n * What the value means, when the model describes it: set by the `enum`\n * entry of the model's declaration file.\n */\n description?: string;\n}\n\n/**\n * How much Wow protects a sensitive field's raw value, sent as its\n * `sensitivity.level`. Both levels mask the value in every query result;\n * they differ in what a query may do with the raw value.\n */\nexport enum SensitivityLevel {\n /**\n * Masked in results. Filters and paged sorts still compare the raw value,\n * unless the server turned that off; grouping, `ANY`, field metrics,\n * arithmetic references and cursor sorts are refused.\n */\n DISPLAY = 'display',\n /**\n * Masked in results and never compared: no filter, sort, search, grouping\n * or metric may name it.\n */\n CONFIDENTIAL = 'confidential',\n}\n\n/**\n * Why a field is deprecated. The field can still be queried, but new\n * queries and view definitions should avoid it.\n */\nexport interface QueryDeprecation {\n /** Why, or what to use instead; absent when the declaration gave no reason. */\n message?: string;\n}\n\n/** How a sensitive field is protected. */\nexport interface SensitivityDescriptor {\n /** How much its raw value is protected. */\n level: SensitivityLevel | (string & {});\n /**\n * Whether filters and paged sorts may still compare its raw value: `false`\n * for {@link SensitivityLevel.CONFIDENTIAL}, and for\n * {@link SensitivityLevel.DISPLAY} when the server turned comparison off.\n * A field that is not comparable lists no filter operators, has\n * `sort.paged` `false` and is left out of `record.search`; naming it in a\n * filter, sort or search is refused with `PROTECTED_COMPARISON`.\n */\n comparable: boolean;\n}\n\n/** The filter operators a field admits. */\nexport interface FieldFilterDescriptor {\n /**\n * Each operator admitted on this field when used alone; empty when none,\n * as for a sensitive field that is not comparable.\n */\n operators: (FilterOperator | (string & {}))[];\n}\n\n/** Where a field may appear in a sort. */\nexport interface FieldSortDescriptor {\n /** In the sort of a list or paged query; never for a field that is not comparable. */\n paged: boolean;\n /** In the sort of a cursor query. */\n cursor: boolean;\n /**\n * Whether an index backs the sort, as the storage says: `false` marks a\n * sort it runs without one, which may be slow on a large model; absent\n * when the storage does not say.\n */\n indexed?: boolean;\n}\n\n/** How a field may be used in an aggregation. */\nexport interface FieldAggregateDescriptor {\n /**\n * The group types it may be grouped by; a time field lists both\n * `DATE_HISTOGRAM` and `DATE_PART`.\n */\n groups: (AggregationGroupType | (string & {}))[];\n /** Whether a terms group on it may set `missingKey`. */\n missingKey: boolean;\n /** The numeric functions (`SUM`, `AVG`, …) it may feed. */\n functions: (AggregationFunction | (string & {}))[];\n /** Whether it may feed a `DISTINCT_COUNT` metric. */\n distinctCount: boolean;\n /** Whether it may feed a `PERCENTILE` metric. */\n percentile: boolean;\n /** Whether it may feed an `ANY` metric. */\n any: boolean;\n /** Whether a `FIRST` or `LAST` metric may read its value. */\n firstLast: boolean;\n /** Whether it may appear in an arithmetic expression. */\n expressionInput: boolean;\n /** Whether a metric's filter may name it. */\n inMetricFilter: boolean;\n}\n\n/** One queryable field, by the logical path a query names it with. */\nexport interface FieldDescriptor {\n /** The logical path, such as `state.items.productId`. */\n path: string;\n /** The system role of a system field; absent on ordinary fields. */\n role?: QueryFieldRole;\n /** The value types it holds. */\n types: QueryValueType[];\n /** The structural shape of its value. */\n kind: QueryValueKind | (string & {});\n /** Whether it may be `null`. */\n nullable: boolean;\n /** What its value means beyond its type; absent when nothing more. */\n semantic?: QuerySemanticType;\n /** Its declared values; never listed for a protected field. */\n enum?: EnumValueDescriptor[];\n /** Its description, when the model gives one. */\n description?: string;\n /** How it is protected; absent when it is not sensitive. */\n sensitivity?: SensitivityDescriptor;\n /** Whether a projection may select it. */\n project: boolean;\n /** The filter operators it admits. */\n filter: FieldFilterDescriptor;\n /** Where it may be sorted by. */\n sort: FieldSortDescriptor;\n /** How it may be aggregated; absent when it cannot be at all. */\n aggregate?: FieldAggregateDescriptor;\n /**\n * The element (array field) it lives in, by path; absent at the record\n * level. A filter on it goes inside `ELEMENT_MATCH` on that element.\n */\n scope?: string;\n /**\n * Set when the field is deprecated: still queryable, but new queries\n * should avoid it. An object, so it is truthy even without a message.\n */\n deprecated?: QueryDeprecation;\n /**\n * Other paths a query may name this field by, sorted; empty when none.\n * The server replaces an alias with `path` before it checks and runs a\n * query, so results, projections and errors use `path`, and an alias is\n * never listed as a field of its own. A variant's field lists them\n * relative to the element, like its `path`.\n */\n aliases: string[];\n}\n\n/**\n * The fields under a map's dynamic keys, written with `{key}` in place of\n * the key: any key matches, except those in `excludedKeys`. Each pattern\n * has one entry, resolved as the server resolves a concrete key: a pattern\n * whose values are arrays is one `ARRAY` entry, its items implicit.\n */\nexport interface DynamicFieldDescriptor {\n /** The path pattern, such as `state.attributes.{key}`. */\n pattern: string;\n /** The value types they hold. */\n types: QueryValueType[];\n /** The structural shape of their values. */\n kind: QueryValueKind | (string & {});\n /** Whether their values may be `null`, as a field's `nullable` says. */\n nullable: boolean;\n /**\n * What their values mean beyond their type, as a field's `semantic`\n * says; absent when nothing more.\n */\n semantic?: QuerySemanticType;\n /** The filter operators they admit. */\n filter: FieldFilterDescriptor;\n /** Where a concrete key may be sorted by. */\n sort: FieldSortDescriptor;\n /** How a concrete key may be aggregated; absent when it cannot be at all. */\n aggregate?: FieldAggregateDescriptor;\n /**\n * The map's keys that are declared as fields of their own and so are not\n * covered by this pattern; absent when there are none. For\n * `state.attributes.{key}` with `state.attributes.color` declared, it is\n * `['color']`: a filter on `state.attributes.color` takes that field's\n * entry in `fields`, with its own operators, not this pattern's.\n */\n excludedKeys?: string[];\n}\n"],"mappings":"AAsBA,IAAaA,EAAkB,OAAO,OAAO,CAE3C,OAAQ,SAER,QAAS,UAET,QAAS,UAET,QAAS,UAET,OAAQ,QACV,CAAU,EAOEC,EAAL,SAAA,EAAA,C,MAEL,GAAAC,QAAA,UAEA,EAAAC,KAAA,OAEA,EAAAC,OAAA,SAEA,EAAAC,OAAA,SAEA,EAAAC,MAAA,QAEA,EAAAC,MAAA,Q,CACF,EAAA,CAAA,CAAA,EAOaC,EAAkB,OAAO,OAAO,CAE3C,SAAU,WAEV,aAAc,eAEd,UAAW,YAEX,SAAU,WAEV,SAAU,WAEV,QAAS,UAMT,WAAY,aAKZ,iBAAkB,kBACpB,CAAU,EAsBEC,EAAL,SAAA,EAAA,C,MAML,GAAAC,QAAA,UAKA,EAAAC,aAAA,e,CACF,EAAA,CAAA,CAAA,E"}
@@ -0,0 +1,246 @@
1
+ import { AggregationGroupType } from './aggregation/groups.cjs';
2
+ import { AggregationFunction } from './aggregation/metrics.cjs';
3
+ import { FilterOperator } from './filter/index.cjs';
4
+ import { QuerySemanticType } from './semanticTypes.cjs';
5
+ /**
6
+ * The value types Wow names in a field's `types`. The set is open, like
7
+ * {@link QueryModels}.
8
+ */
9
+ export declare const QueryValueTypes: Readonly<{
10
+ /** A JSON string. */
11
+ readonly STRING: "string";
12
+ /** A whole number. */
13
+ readonly INTEGER: "integer";
14
+ /** A number with a fraction. */
15
+ readonly DECIMAL: "decimal";
16
+ /** `true` or `false`. */
17
+ readonly BOOLEAN: "boolean";
18
+ /** A JSON object. */
19
+ readonly OBJECT: "object";
20
+ }>;
21
+ /** A field's value type: one of {@link QueryValueTypes}, or one a server added. */
22
+ export type QueryValueType = (typeof QueryValueTypes)[keyof typeof QueryValueTypes] | (string & {});
23
+ /** The structural shape of a field's value, sent as its `kind`. */
24
+ export declare enum QueryValueKind {
25
+ /** Wow could not tell. */
26
+ UNKNOWN = "unknown",
27
+ /** Always `null`. */
28
+ NULL = "null",
29
+ /** A single string, number or boolean. */
30
+ SCALAR = "scalar",
31
+ /** An object. */
32
+ OBJECT = "object",
33
+ /** An array. */
34
+ ARRAY = "array",
35
+ /** One of several of the above. */
36
+ UNION = "union"
37
+ }
38
+ /**
39
+ * The system roles Wow names in a field's `role`: the system fields a root
40
+ * operator targets, and the model's times. The set is open, like
41
+ * {@link QueryModels}.
42
+ */
43
+ export declare const QueryFieldRoles: Readonly<{
44
+ /** The record's own identity, `record.identity`. */
45
+ readonly IDENTITY: "identity";
46
+ /** The aggregate id. */
47
+ readonly AGGREGATE_ID: "aggregate-id";
48
+ /** The tenant id. */
49
+ readonly TENANT_ID: "tenant-id";
50
+ /** The owner id. */
51
+ readonly OWNER_ID: "owner-id";
52
+ /** The space id. */
53
+ readonly SPACE_ID: "space-id";
54
+ /** Whether the aggregate is deleted. */
55
+ readonly DELETED: "deleted";
56
+ /**
57
+ * When the record's events happened: a snapshot's last event
58
+ * (`eventTime`), an event stream's events (`createTime`). `FIRST` and
59
+ * `LAST` order by it when they name no `orderBy`. Wow 9.2 and later.
60
+ */
61
+ readonly EVENT_TIME: "event-time";
62
+ /**
63
+ * When a snapshot's aggregate got its first event, i.e. was created
64
+ * (`firstEventTime`). Wow 9.2 and later.
65
+ */
66
+ readonly FIRST_EVENT_TIME: "first-event-time";
67
+ }>;
68
+ /** A system field's role: one of {@link QueryFieldRoles}, or one a server added. */
69
+ export type QueryFieldRole = (typeof QueryFieldRoles)[keyof typeof QueryFieldRoles] | (string & {});
70
+ /** One declared value of an enum field, with its description when it has one. */
71
+ export interface EnumValueDescriptor {
72
+ /** The value as it is stored and filtered by. */
73
+ value: unknown;
74
+ /**
75
+ * What the value means, when the model describes it: set by the `enum`
76
+ * entry of the model's declaration file.
77
+ */
78
+ description?: string;
79
+ }
80
+ /**
81
+ * How much Wow protects a sensitive field's raw value, sent as its
82
+ * `sensitivity.level`. Both levels mask the value in every query result;
83
+ * they differ in what a query may do with the raw value.
84
+ */
85
+ export declare enum SensitivityLevel {
86
+ /**
87
+ * Masked in results. Filters and paged sorts still compare the raw value,
88
+ * unless the server turned that off; grouping, `ANY`, field metrics,
89
+ * arithmetic references and cursor sorts are refused.
90
+ */
91
+ DISPLAY = "display",
92
+ /**
93
+ * Masked in results and never compared: no filter, sort, search, grouping
94
+ * or metric may name it.
95
+ */
96
+ CONFIDENTIAL = "confidential"
97
+ }
98
+ /**
99
+ * Why a field is deprecated. The field can still be queried, but new
100
+ * queries and view definitions should avoid it.
101
+ */
102
+ export interface QueryDeprecation {
103
+ /** Why, or what to use instead; absent when the declaration gave no reason. */
104
+ message?: string;
105
+ }
106
+ /** How a sensitive field is protected. */
107
+ export interface SensitivityDescriptor {
108
+ /** How much its raw value is protected. */
109
+ level: SensitivityLevel | (string & {});
110
+ /**
111
+ * Whether filters and paged sorts may still compare its raw value: `false`
112
+ * for {@link SensitivityLevel.CONFIDENTIAL}, and for
113
+ * {@link SensitivityLevel.DISPLAY} when the server turned comparison off.
114
+ * A field that is not comparable lists no filter operators, has
115
+ * `sort.paged` `false` and is left out of `record.search`; naming it in a
116
+ * filter, sort or search is refused with `PROTECTED_COMPARISON`.
117
+ */
118
+ comparable: boolean;
119
+ }
120
+ /** The filter operators a field admits. */
121
+ export interface FieldFilterDescriptor {
122
+ /**
123
+ * Each operator admitted on this field when used alone; empty when none,
124
+ * as for a sensitive field that is not comparable.
125
+ */
126
+ operators: (FilterOperator | (string & {}))[];
127
+ }
128
+ /** Where a field may appear in a sort. */
129
+ export interface FieldSortDescriptor {
130
+ /** In the sort of a list or paged query; never for a field that is not comparable. */
131
+ paged: boolean;
132
+ /** In the sort of a cursor query. */
133
+ cursor: boolean;
134
+ /**
135
+ * Whether an index backs the sort, as the storage says: `false` marks a
136
+ * sort it runs without one, which may be slow on a large model; absent
137
+ * when the storage does not say.
138
+ */
139
+ indexed?: boolean;
140
+ }
141
+ /** How a field may be used in an aggregation. */
142
+ export interface FieldAggregateDescriptor {
143
+ /**
144
+ * The group types it may be grouped by; a time field lists both
145
+ * `DATE_HISTOGRAM` and `DATE_PART`.
146
+ */
147
+ groups: (AggregationGroupType | (string & {}))[];
148
+ /** Whether a terms group on it may set `missingKey`. */
149
+ missingKey: boolean;
150
+ /** The numeric functions (`SUM`, `AVG`, …) it may feed. */
151
+ functions: (AggregationFunction | (string & {}))[];
152
+ /** Whether it may feed a `DISTINCT_COUNT` metric. */
153
+ distinctCount: boolean;
154
+ /** Whether it may feed a `PERCENTILE` metric. */
155
+ percentile: boolean;
156
+ /** Whether it may feed an `ANY` metric. */
157
+ any: boolean;
158
+ /** Whether a `FIRST` or `LAST` metric may read its value. */
159
+ firstLast: boolean;
160
+ /** Whether it may appear in an arithmetic expression. */
161
+ expressionInput: boolean;
162
+ /** Whether a metric's filter may name it. */
163
+ inMetricFilter: boolean;
164
+ }
165
+ /** One queryable field, by the logical path a query names it with. */
166
+ export interface FieldDescriptor {
167
+ /** The logical path, such as `state.items.productId`. */
168
+ path: string;
169
+ /** The system role of a system field; absent on ordinary fields. */
170
+ role?: QueryFieldRole;
171
+ /** The value types it holds. */
172
+ types: QueryValueType[];
173
+ /** The structural shape of its value. */
174
+ kind: QueryValueKind | (string & {});
175
+ /** Whether it may be `null`. */
176
+ nullable: boolean;
177
+ /** What its value means beyond its type; absent when nothing more. */
178
+ semantic?: QuerySemanticType;
179
+ /** Its declared values; never listed for a protected field. */
180
+ enum?: EnumValueDescriptor[];
181
+ /** Its description, when the model gives one. */
182
+ description?: string;
183
+ /** How it is protected; absent when it is not sensitive. */
184
+ sensitivity?: SensitivityDescriptor;
185
+ /** Whether a projection may select it. */
186
+ project: boolean;
187
+ /** The filter operators it admits. */
188
+ filter: FieldFilterDescriptor;
189
+ /** Where it may be sorted by. */
190
+ sort: FieldSortDescriptor;
191
+ /** How it may be aggregated; absent when it cannot be at all. */
192
+ aggregate?: FieldAggregateDescriptor;
193
+ /**
194
+ * The element (array field) it lives in, by path; absent at the record
195
+ * level. A filter on it goes inside `ELEMENT_MATCH` on that element.
196
+ */
197
+ scope?: string;
198
+ /**
199
+ * Set when the field is deprecated: still queryable, but new queries
200
+ * should avoid it. An object, so it is truthy even without a message.
201
+ */
202
+ deprecated?: QueryDeprecation;
203
+ /**
204
+ * Other paths a query may name this field by, sorted; empty when none.
205
+ * The server replaces an alias with `path` before it checks and runs a
206
+ * query, so results, projections and errors use `path`, and an alias is
207
+ * never listed as a field of its own. A variant's field lists them
208
+ * relative to the element, like its `path`.
209
+ */
210
+ aliases: string[];
211
+ }
212
+ /**
213
+ * The fields under a map's dynamic keys, written with `{key}` in place of
214
+ * the key: any key matches, except those in `excludedKeys`. Each pattern
215
+ * has one entry, resolved as the server resolves a concrete key: a pattern
216
+ * whose values are arrays is one `ARRAY` entry, its items implicit.
217
+ */
218
+ export interface DynamicFieldDescriptor {
219
+ /** The path pattern, such as `state.attributes.{key}`. */
220
+ pattern: string;
221
+ /** The value types they hold. */
222
+ types: QueryValueType[];
223
+ /** The structural shape of their values. */
224
+ kind: QueryValueKind | (string & {});
225
+ /** Whether their values may be `null`, as a field's `nullable` says. */
226
+ nullable: boolean;
227
+ /**
228
+ * What their values mean beyond their type, as a field's `semantic`
229
+ * says; absent when nothing more.
230
+ */
231
+ semantic?: QuerySemanticType;
232
+ /** The filter operators they admit. */
233
+ filter: FieldFilterDescriptor;
234
+ /** Where a concrete key may be sorted by. */
235
+ sort: FieldSortDescriptor;
236
+ /** How a concrete key may be aggregated; absent when it cannot be at all. */
237
+ aggregate?: FieldAggregateDescriptor;
238
+ /**
239
+ * The map's keys that are declared as fields of their own and so are not
240
+ * covered by this pattern; absent when there are none. For
241
+ * `state.attributes.{key}` with `state.attributes.color` declared, it is
242
+ * `['color']`: a filter on `state.attributes.color` takes that field's
243
+ * entry in `fields`, with its own operators, not this pattern's.
244
+ */
245
+ excludedKeys?: string[];
246
+ }
@@ -0,0 +1,246 @@
1
+ import { AggregationGroupType } from './aggregation/groups.js';
2
+ import { AggregationFunction } from './aggregation/metrics.js';
3
+ import { FilterOperator } from './filter/index.js';
4
+ import { QuerySemanticType } from './semanticTypes.js';
5
+ /**
6
+ * The value types Wow names in a field's `types`. The set is open, like
7
+ * {@link QueryModels}.
8
+ */
9
+ export declare const QueryValueTypes: Readonly<{
10
+ /** A JSON string. */
11
+ readonly STRING: "string";
12
+ /** A whole number. */
13
+ readonly INTEGER: "integer";
14
+ /** A number with a fraction. */
15
+ readonly DECIMAL: "decimal";
16
+ /** `true` or `false`. */
17
+ readonly BOOLEAN: "boolean";
18
+ /** A JSON object. */
19
+ readonly OBJECT: "object";
20
+ }>;
21
+ /** A field's value type: one of {@link QueryValueTypes}, or one a server added. */
22
+ export type QueryValueType = (typeof QueryValueTypes)[keyof typeof QueryValueTypes] | (string & {});
23
+ /** The structural shape of a field's value, sent as its `kind`. */
24
+ export declare enum QueryValueKind {
25
+ /** Wow could not tell. */
26
+ UNKNOWN = "unknown",
27
+ /** Always `null`. */
28
+ NULL = "null",
29
+ /** A single string, number or boolean. */
30
+ SCALAR = "scalar",
31
+ /** An object. */
32
+ OBJECT = "object",
33
+ /** An array. */
34
+ ARRAY = "array",
35
+ /** One of several of the above. */
36
+ UNION = "union"
37
+ }
38
+ /**
39
+ * The system roles Wow names in a field's `role`: the system fields a root
40
+ * operator targets, and the model's times. The set is open, like
41
+ * {@link QueryModels}.
42
+ */
43
+ export declare const QueryFieldRoles: Readonly<{
44
+ /** The record's own identity, `record.identity`. */
45
+ readonly IDENTITY: "identity";
46
+ /** The aggregate id. */
47
+ readonly AGGREGATE_ID: "aggregate-id";
48
+ /** The tenant id. */
49
+ readonly TENANT_ID: "tenant-id";
50
+ /** The owner id. */
51
+ readonly OWNER_ID: "owner-id";
52
+ /** The space id. */
53
+ readonly SPACE_ID: "space-id";
54
+ /** Whether the aggregate is deleted. */
55
+ readonly DELETED: "deleted";
56
+ /**
57
+ * When the record's events happened: a snapshot's last event
58
+ * (`eventTime`), an event stream's events (`createTime`). `FIRST` and
59
+ * `LAST` order by it when they name no `orderBy`. Wow 9.2 and later.
60
+ */
61
+ readonly EVENT_TIME: "event-time";
62
+ /**
63
+ * When a snapshot's aggregate got its first event, i.e. was created
64
+ * (`firstEventTime`). Wow 9.2 and later.
65
+ */
66
+ readonly FIRST_EVENT_TIME: "first-event-time";
67
+ }>;
68
+ /** A system field's role: one of {@link QueryFieldRoles}, or one a server added. */
69
+ export type QueryFieldRole = (typeof QueryFieldRoles)[keyof typeof QueryFieldRoles] | (string & {});
70
+ /** One declared value of an enum field, with its description when it has one. */
71
+ export interface EnumValueDescriptor {
72
+ /** The value as it is stored and filtered by. */
73
+ value: unknown;
74
+ /**
75
+ * What the value means, when the model describes it: set by the `enum`
76
+ * entry of the model's declaration file.
77
+ */
78
+ description?: string;
79
+ }
80
+ /**
81
+ * How much Wow protects a sensitive field's raw value, sent as its
82
+ * `sensitivity.level`. Both levels mask the value in every query result;
83
+ * they differ in what a query may do with the raw value.
84
+ */
85
+ export declare enum SensitivityLevel {
86
+ /**
87
+ * Masked in results. Filters and paged sorts still compare the raw value,
88
+ * unless the server turned that off; grouping, `ANY`, field metrics,
89
+ * arithmetic references and cursor sorts are refused.
90
+ */
91
+ DISPLAY = "display",
92
+ /**
93
+ * Masked in results and never compared: no filter, sort, search, grouping
94
+ * or metric may name it.
95
+ */
96
+ CONFIDENTIAL = "confidential"
97
+ }
98
+ /**
99
+ * Why a field is deprecated. The field can still be queried, but new
100
+ * queries and view definitions should avoid it.
101
+ */
102
+ export interface QueryDeprecation {
103
+ /** Why, or what to use instead; absent when the declaration gave no reason. */
104
+ message?: string;
105
+ }
106
+ /** How a sensitive field is protected. */
107
+ export interface SensitivityDescriptor {
108
+ /** How much its raw value is protected. */
109
+ level: SensitivityLevel | (string & {});
110
+ /**
111
+ * Whether filters and paged sorts may still compare its raw value: `false`
112
+ * for {@link SensitivityLevel.CONFIDENTIAL}, and for
113
+ * {@link SensitivityLevel.DISPLAY} when the server turned comparison off.
114
+ * A field that is not comparable lists no filter operators, has
115
+ * `sort.paged` `false` and is left out of `record.search`; naming it in a
116
+ * filter, sort or search is refused with `PROTECTED_COMPARISON`.
117
+ */
118
+ comparable: boolean;
119
+ }
120
+ /** The filter operators a field admits. */
121
+ export interface FieldFilterDescriptor {
122
+ /**
123
+ * Each operator admitted on this field when used alone; empty when none,
124
+ * as for a sensitive field that is not comparable.
125
+ */
126
+ operators: (FilterOperator | (string & {}))[];
127
+ }
128
+ /** Where a field may appear in a sort. */
129
+ export interface FieldSortDescriptor {
130
+ /** In the sort of a list or paged query; never for a field that is not comparable. */
131
+ paged: boolean;
132
+ /** In the sort of a cursor query. */
133
+ cursor: boolean;
134
+ /**
135
+ * Whether an index backs the sort, as the storage says: `false` marks a
136
+ * sort it runs without one, which may be slow on a large model; absent
137
+ * when the storage does not say.
138
+ */
139
+ indexed?: boolean;
140
+ }
141
+ /** How a field may be used in an aggregation. */
142
+ export interface FieldAggregateDescriptor {
143
+ /**
144
+ * The group types it may be grouped by; a time field lists both
145
+ * `DATE_HISTOGRAM` and `DATE_PART`.
146
+ */
147
+ groups: (AggregationGroupType | (string & {}))[];
148
+ /** Whether a terms group on it may set `missingKey`. */
149
+ missingKey: boolean;
150
+ /** The numeric functions (`SUM`, `AVG`, …) it may feed. */
151
+ functions: (AggregationFunction | (string & {}))[];
152
+ /** Whether it may feed a `DISTINCT_COUNT` metric. */
153
+ distinctCount: boolean;
154
+ /** Whether it may feed a `PERCENTILE` metric. */
155
+ percentile: boolean;
156
+ /** Whether it may feed an `ANY` metric. */
157
+ any: boolean;
158
+ /** Whether a `FIRST` or `LAST` metric may read its value. */
159
+ firstLast: boolean;
160
+ /** Whether it may appear in an arithmetic expression. */
161
+ expressionInput: boolean;
162
+ /** Whether a metric's filter may name it. */
163
+ inMetricFilter: boolean;
164
+ }
165
+ /** One queryable field, by the logical path a query names it with. */
166
+ export interface FieldDescriptor {
167
+ /** The logical path, such as `state.items.productId`. */
168
+ path: string;
169
+ /** The system role of a system field; absent on ordinary fields. */
170
+ role?: QueryFieldRole;
171
+ /** The value types it holds. */
172
+ types: QueryValueType[];
173
+ /** The structural shape of its value. */
174
+ kind: QueryValueKind | (string & {});
175
+ /** Whether it may be `null`. */
176
+ nullable: boolean;
177
+ /** What its value means beyond its type; absent when nothing more. */
178
+ semantic?: QuerySemanticType;
179
+ /** Its declared values; never listed for a protected field. */
180
+ enum?: EnumValueDescriptor[];
181
+ /** Its description, when the model gives one. */
182
+ description?: string;
183
+ /** How it is protected; absent when it is not sensitive. */
184
+ sensitivity?: SensitivityDescriptor;
185
+ /** Whether a projection may select it. */
186
+ project: boolean;
187
+ /** The filter operators it admits. */
188
+ filter: FieldFilterDescriptor;
189
+ /** Where it may be sorted by. */
190
+ sort: FieldSortDescriptor;
191
+ /** How it may be aggregated; absent when it cannot be at all. */
192
+ aggregate?: FieldAggregateDescriptor;
193
+ /**
194
+ * The element (array field) it lives in, by path; absent at the record
195
+ * level. A filter on it goes inside `ELEMENT_MATCH` on that element.
196
+ */
197
+ scope?: string;
198
+ /**
199
+ * Set when the field is deprecated: still queryable, but new queries
200
+ * should avoid it. An object, so it is truthy even without a message.
201
+ */
202
+ deprecated?: QueryDeprecation;
203
+ /**
204
+ * Other paths a query may name this field by, sorted; empty when none.
205
+ * The server replaces an alias with `path` before it checks and runs a
206
+ * query, so results, projections and errors use `path`, and an alias is
207
+ * never listed as a field of its own. A variant's field lists them
208
+ * relative to the element, like its `path`.
209
+ */
210
+ aliases: string[];
211
+ }
212
+ /**
213
+ * The fields under a map's dynamic keys, written with `{key}` in place of
214
+ * the key: any key matches, except those in `excludedKeys`. Each pattern
215
+ * has one entry, resolved as the server resolves a concrete key: a pattern
216
+ * whose values are arrays is one `ARRAY` entry, its items implicit.
217
+ */
218
+ export interface DynamicFieldDescriptor {
219
+ /** The path pattern, such as `state.attributes.{key}`. */
220
+ pattern: string;
221
+ /** The value types they hold. */
222
+ types: QueryValueType[];
223
+ /** The structural shape of their values. */
224
+ kind: QueryValueKind | (string & {});
225
+ /** Whether their values may be `null`, as a field's `nullable` says. */
226
+ nullable: boolean;
227
+ /**
228
+ * What their values mean beyond their type, as a field's `semantic`
229
+ * says; absent when nothing more.
230
+ */
231
+ semantic?: QuerySemanticType;
232
+ /** The filter operators they admit. */
233
+ filter: FieldFilterDescriptor;
234
+ /** Where a concrete key may be sorted by. */
235
+ sort: FieldSortDescriptor;
236
+ /** How a concrete key may be aggregated; absent when it cannot be at all. */
237
+ aggregate?: FieldAggregateDescriptor;
238
+ /**
239
+ * The map's keys that are declared as fields of their own and so are not
240
+ * covered by this pattern; absent when there are none. For
241
+ * `state.attributes.{key}` with `state.attributes.color` declared, it is
242
+ * `['color']`: a filter on `state.attributes.color` takes that field's
243
+ * entry in `fields`, with its own operators, not this pattern's.
244
+ */
245
+ excludedKeys?: string[];
246
+ }
@@ -0,0 +1,24 @@
1
+ // src/dsl/fieldDescriptor.ts
2
+ var e = Object.freeze({
3
+ STRING: "string",
4
+ INTEGER: "integer",
5
+ DECIMAL: "decimal",
6
+ BOOLEAN: "boolean",
7
+ OBJECT: "object"
8
+ }), t = /* @__PURE__ */ function(e) {
9
+ return e.UNKNOWN = "unknown", e.NULL = "null", e.SCALAR = "scalar", e.OBJECT = "object", e.ARRAY = "array", e.UNION = "union", e;
10
+ }({}), n = Object.freeze({
11
+ IDENTITY: "identity",
12
+ AGGREGATE_ID: "aggregate-id",
13
+ TENANT_ID: "tenant-id",
14
+ OWNER_ID: "owner-id",
15
+ SPACE_ID: "space-id",
16
+ DELETED: "deleted",
17
+ EVENT_TIME: "event-time",
18
+ FIRST_EVENT_TIME: "first-event-time"
19
+ }), r = /* @__PURE__ */ function(e) {
20
+ return e.DISPLAY = "display", e.CONFIDENTIAL = "confidential", e;
21
+ }({});
22
+ export { n as QueryFieldRoles, t as QueryValueKind, e as QueryValueTypes, r as SensitivityLevel };
23
+
24
+ //# sourceMappingURL=fieldDescriptor.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldDescriptor.es.js","names":["QueryValueTypes","QueryValueKind","\"UNKNOWN\"","\"NULL\"","\"SCALAR\"","\"OBJECT\"","\"ARRAY\"","\"UNION\"","QueryFieldRoles","SensitivityLevel","\"DISPLAY\"","\"CONFIDENTIAL\""],"sources":["../../src/dsl/fieldDescriptor.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 { AggregationGroupType } from './aggregation/groups.js';\nimport type { AggregationFunction } from './aggregation/metrics.js';\nimport type { FilterOperator } from './filter/index.js';\nimport type { QuerySemanticType } from './semanticTypes.js';\n\n/**\n * The value types Wow names in a field's `types`. The set is open, like\n * {@link QueryModels}.\n */\nexport const QueryValueTypes = Object.freeze({\n /** A JSON string. */\n STRING: 'string',\n /** A whole number. */\n INTEGER: 'integer',\n /** A number with a fraction. */\n DECIMAL: 'decimal',\n /** `true` or `false`. */\n BOOLEAN: 'boolean',\n /** A JSON object. */\n OBJECT: 'object',\n} as const);\n\n/** A field's value type: one of {@link QueryValueTypes}, or one a server added. */\nexport type QueryValueType =\n (typeof QueryValueTypes)[keyof typeof QueryValueTypes] | (string & {});\n\n/** The structural shape of a field's value, sent as its `kind`. */\nexport enum QueryValueKind {\n /** Wow could not tell. */\n UNKNOWN = 'unknown',\n /** Always `null`. */\n NULL = 'null',\n /** A single string, number or boolean. */\n SCALAR = 'scalar',\n /** An object. */\n OBJECT = 'object',\n /** An array. */\n ARRAY = 'array',\n /** One of several of the above. */\n UNION = 'union',\n}\n\n/**\n * The system roles Wow names in a field's `role`: the system fields a root\n * operator targets, and the model's times. The set is open, like\n * {@link QueryModels}.\n */\nexport const QueryFieldRoles = Object.freeze({\n /** The record's own identity, `record.identity`. */\n IDENTITY: 'identity',\n /** The aggregate id. */\n AGGREGATE_ID: 'aggregate-id',\n /** The tenant id. */\n TENANT_ID: 'tenant-id',\n /** The owner id. */\n OWNER_ID: 'owner-id',\n /** The space id. */\n SPACE_ID: 'space-id',\n /** Whether the aggregate is deleted. */\n DELETED: 'deleted',\n /**\n * When the record's events happened: a snapshot's last event\n * (`eventTime`), an event stream's events (`createTime`). `FIRST` and\n * `LAST` order by it when they name no `orderBy`. Wow 9.2 and later.\n */\n EVENT_TIME: 'event-time',\n /**\n * When a snapshot's aggregate got its first event, i.e. was created\n * (`firstEventTime`). Wow 9.2 and later.\n */\n FIRST_EVENT_TIME: 'first-event-time',\n} as const);\n\n/** A system field's role: one of {@link QueryFieldRoles}, or one a server added. */\nexport type QueryFieldRole =\n (typeof QueryFieldRoles)[keyof typeof QueryFieldRoles] | (string & {});\n\n/** One declared value of an enum field, with its description when it has one. */\nexport interface EnumValueDescriptor {\n /** The value as it is stored and filtered by. */\n value: unknown;\n /**\n * What the value means, when the model describes it: set by the `enum`\n * entry of the model's declaration file.\n */\n description?: string;\n}\n\n/**\n * How much Wow protects a sensitive field's raw value, sent as its\n * `sensitivity.level`. Both levels mask the value in every query result;\n * they differ in what a query may do with the raw value.\n */\nexport enum SensitivityLevel {\n /**\n * Masked in results. Filters and paged sorts still compare the raw value,\n * unless the server turned that off; grouping, `ANY`, field metrics,\n * arithmetic references and cursor sorts are refused.\n */\n DISPLAY = 'display',\n /**\n * Masked in results and never compared: no filter, sort, search, grouping\n * or metric may name it.\n */\n CONFIDENTIAL = 'confidential',\n}\n\n/**\n * Why a field is deprecated. The field can still be queried, but new\n * queries and view definitions should avoid it.\n */\nexport interface QueryDeprecation {\n /** Why, or what to use instead; absent when the declaration gave no reason. */\n message?: string;\n}\n\n/** How a sensitive field is protected. */\nexport interface SensitivityDescriptor {\n /** How much its raw value is protected. */\n level: SensitivityLevel | (string & {});\n /**\n * Whether filters and paged sorts may still compare its raw value: `false`\n * for {@link SensitivityLevel.CONFIDENTIAL}, and for\n * {@link SensitivityLevel.DISPLAY} when the server turned comparison off.\n * A field that is not comparable lists no filter operators, has\n * `sort.paged` `false` and is left out of `record.search`; naming it in a\n * filter, sort or search is refused with `PROTECTED_COMPARISON`.\n */\n comparable: boolean;\n}\n\n/** The filter operators a field admits. */\nexport interface FieldFilterDescriptor {\n /**\n * Each operator admitted on this field when used alone; empty when none,\n * as for a sensitive field that is not comparable.\n */\n operators: (FilterOperator | (string & {}))[];\n}\n\n/** Where a field may appear in a sort. */\nexport interface FieldSortDescriptor {\n /** In the sort of a list or paged query; never for a field that is not comparable. */\n paged: boolean;\n /** In the sort of a cursor query. */\n cursor: boolean;\n /**\n * Whether an index backs the sort, as the storage says: `false` marks a\n * sort it runs without one, which may be slow on a large model; absent\n * when the storage does not say.\n */\n indexed?: boolean;\n}\n\n/** How a field may be used in an aggregation. */\nexport interface FieldAggregateDescriptor {\n /**\n * The group types it may be grouped by; a time field lists both\n * `DATE_HISTOGRAM` and `DATE_PART`.\n */\n groups: (AggregationGroupType | (string & {}))[];\n /** Whether a terms group on it may set `missingKey`. */\n missingKey: boolean;\n /** The numeric functions (`SUM`, `AVG`, …) it may feed. */\n functions: (AggregationFunction | (string & {}))[];\n /** Whether it may feed a `DISTINCT_COUNT` metric. */\n distinctCount: boolean;\n /** Whether it may feed a `PERCENTILE` metric. */\n percentile: boolean;\n /** Whether it may feed an `ANY` metric. */\n any: boolean;\n /** Whether a `FIRST` or `LAST` metric may read its value. */\n firstLast: boolean;\n /** Whether it may appear in an arithmetic expression. */\n expressionInput: boolean;\n /** Whether a metric's filter may name it. */\n inMetricFilter: boolean;\n}\n\n/** One queryable field, by the logical path a query names it with. */\nexport interface FieldDescriptor {\n /** The logical path, such as `state.items.productId`. */\n path: string;\n /** The system role of a system field; absent on ordinary fields. */\n role?: QueryFieldRole;\n /** The value types it holds. */\n types: QueryValueType[];\n /** The structural shape of its value. */\n kind: QueryValueKind | (string & {});\n /** Whether it may be `null`. */\n nullable: boolean;\n /** What its value means beyond its type; absent when nothing more. */\n semantic?: QuerySemanticType;\n /** Its declared values; never listed for a protected field. */\n enum?: EnumValueDescriptor[];\n /** Its description, when the model gives one. */\n description?: string;\n /** How it is protected; absent when it is not sensitive. */\n sensitivity?: SensitivityDescriptor;\n /** Whether a projection may select it. */\n project: boolean;\n /** The filter operators it admits. */\n filter: FieldFilterDescriptor;\n /** Where it may be sorted by. */\n sort: FieldSortDescriptor;\n /** How it may be aggregated; absent when it cannot be at all. */\n aggregate?: FieldAggregateDescriptor;\n /**\n * The element (array field) it lives in, by path; absent at the record\n * level. A filter on it goes inside `ELEMENT_MATCH` on that element.\n */\n scope?: string;\n /**\n * Set when the field is deprecated: still queryable, but new queries\n * should avoid it. An object, so it is truthy even without a message.\n */\n deprecated?: QueryDeprecation;\n /**\n * Other paths a query may name this field by, sorted; empty when none.\n * The server replaces an alias with `path` before it checks and runs a\n * query, so results, projections and errors use `path`, and an alias is\n * never listed as a field of its own. A variant's field lists them\n * relative to the element, like its `path`.\n */\n aliases: string[];\n}\n\n/**\n * The fields under a map's dynamic keys, written with `{key}` in place of\n * the key: any key matches, except those in `excludedKeys`. Each pattern\n * has one entry, resolved as the server resolves a concrete key: a pattern\n * whose values are arrays is one `ARRAY` entry, its items implicit.\n */\nexport interface DynamicFieldDescriptor {\n /** The path pattern, such as `state.attributes.{key}`. */\n pattern: string;\n /** The value types they hold. */\n types: QueryValueType[];\n /** The structural shape of their values. */\n kind: QueryValueKind | (string & {});\n /** Whether their values may be `null`, as a field's `nullable` says. */\n nullable: boolean;\n /**\n * What their values mean beyond their type, as a field's `semantic`\n * says; absent when nothing more.\n */\n semantic?: QuerySemanticType;\n /** The filter operators they admit. */\n filter: FieldFilterDescriptor;\n /** Where a concrete key may be sorted by. */\n sort: FieldSortDescriptor;\n /** How a concrete key may be aggregated; absent when it cannot be at all. */\n aggregate?: FieldAggregateDescriptor;\n /**\n * The map's keys that are declared as fields of their own and so are not\n * covered by this pattern; absent when there are none. For\n * `state.attributes.{key}` with `state.attributes.color` declared, it is\n * `['color']`: a filter on `state.attributes.color` takes that field's\n * entry in `fields`, with its own operators, not this pattern's.\n */\n excludedKeys?: string[];\n}\n"],"mappings":";AAsBA,IAAaA,IAAkB,OAAO,OAAO;CAE3C,QAAQ;CAER,SAAS;CAET,SAAS;CAET,SAAS;CAET,QAAQ;AACV,CAAU,GAOEC,IAAL,yBAAA,GAAA;C,OAEL,EAAAC,UAAA,WAEA,EAAAC,OAAA,QAEA,EAAAC,SAAA,UAEA,EAAAC,SAAA,UAEA,EAAAC,QAAA,SAEA,EAAAC,QAAA,S;AACF,EAAA,CAAA,CAAA,GAOaC,IAAkB,OAAO,OAAO;CAE3C,UAAU;CAEV,cAAc;CAEd,WAAW;CAEX,UAAU;CAEV,UAAU;CAEV,SAAS;CAMT,YAAY;CAKZ,kBAAkB;AACpB,CAAU,GAsBEC,IAAL,yBAAA,GAAA;C,OAML,EAAAC,UAAA,WAKA,EAAAC,eAAA,gB;AACF,EAAA,CAAA,CAAA"}
@@ -1,2 +1,2 @@
1
- const e=require("./operator.cjs"),t=require("../constantName.cjs"),n=require("../aggregation/types.cjs"),r=require("../aggregation/expressionTrees.cjs"),i=require("../deletionState.cjs"),a=require("../field.cjs"),o=require("./scope.cjs"),s=require("./validate.cjs");function c(e,n){return{op:e,value:s.requiredString(`${t.constantName(e)} value`,n)}}function l(e,n){return s.requireNonEmpty(`${t.constantName(e)} values`,n),n.forEach(n=>s.requiredString(`${t.constantName(e)} value`,n)),{op:e,values:[...n]}}function u(e,n){return s.requireNonEmpty(`${t.constantName(e)} operands`,n),{op:e,operands:[...n]}}function d(e,t,n){return{op:e,field:a.queryField(t),value:s.filterLiteral(n,!0)}}function f(e,t,n){return{op:e,field:a.queryField(t),value:s.filterLiteral(n,!1)}}function p(e,n,r,i){return s.validateStringComparison(i),{op:e,field:a.queryField(n),value:s.requiredString(`${t.constantName(e)} value`,r),stringComparison:i}}function m(e,n,r){return s.requireNonEmpty(`${t.constantName(e)} values`,r),r.forEach(e=>s.filterLiteral(e,!1)),{op:e,field:a.queryField(n),values:[...r]}}function h(e,t){return{op:e,field:a.queryField(t)}}function g(e,t,n){return{...s.validateRelativeTimeOptions(n),op:e,field:a.queryField(t)}}function _(e,t,n,r){return s.validateDays(e,n),{...s.validateRelativeTimeOptions(r),op:e,field:a.queryField(t),days:n}}function v(e,t,n,r){return s.requireDuration(e,n),{...s.validateRelativeTimeOptions(r),op:e,field:a.queryField(t),offset:n}}function y(t){return u(e.FilterOperator.AND,t)}function b(t){return u(e.FilterOperator.OR,t)}function x(t){return u(e.FilterOperator.NOR,t)}function S(t,n){if(typeof t!=`string`||!t.trim())throw TypeError(`SEARCH query cannot be blank.`);if(n!==void 0&&(typeof n!=`object`||!n||Array.isArray(n)))throw TypeError(`SEARCH options must be a non-null object.`);let{fields:r=[],mode:i=e.SearchMode.TERMS}=n??{};if(!Object.values(e.SearchMode).includes(i))throw TypeError(`SEARCH mode is invalid: [${String(i)}].`);return{op:e.FilterOperator.SEARCH,query:t,mode:i,fields:r.map(a.queryField)}}var C={matchAll(){return{op:e.FilterOperator.MATCH_ALL}},matchNone(){return{op:e.FilterOperator.MATCH_NONE}},id(t){return c(e.FilterOperator.ID,t)},ids(t){return l(e.FilterOperator.IDS,t)},aggregateId(t){return c(e.FilterOperator.AGGREGATE_ID,t)},aggregateIds(t){return l(e.FilterOperator.AGGREGATE_IDS,t)},tenantId(t){return c(e.FilterOperator.TENANT_ID,t)},ownerId(t){return c(e.FilterOperator.OWNER_ID,t)},spaceId(t){return c(e.FilterOperator.SPACE_ID,t)},and:y,or:b,nor:x,eq(t,n){return d(e.FilterOperator.EQ,t,n)},ne(t,n){return d(e.FilterOperator.NE,t,n)},gt(t,n){return f(e.FilterOperator.GT,t,n)},gte(t,n){return f(e.FilterOperator.GTE,t,n)},lt(t,n){return f(e.FilterOperator.LT,t,n)},lte(t,n){return f(e.FilterOperator.LTE,t,n)},contains(t,n,r=e.StringComparison.CASE_SENSITIVE){return p(e.FilterOperator.CONTAINS,t,n,r)},startsWith(t,n,r=e.StringComparison.CASE_SENSITIVE){return p(e.FilterOperator.STARTS_WITH,t,n,r)},endsWith(t,n,r=e.StringComparison.CASE_SENSITIVE){return p(e.FilterOperator.ENDS_WITH,t,n,r)},isIn(t,n){return m(e.FilterOperator.IN,t,n)},notIn(t,n){return m(e.FilterOperator.NOT_IN,t,n)},containsAll(t,n){return m(e.FilterOperator.CONTAINS_ALL,t,n)},between(t,n,r){return{op:e.FilterOperator.BETWEEN,field:a.queryField(t),lowerBound:s.filterLiteral(n,!1),upperBound:s.filterLiteral(r,!1)}},isEmpty(t){return h(e.FilterOperator.IS_EMPTY,t)},isEmptyString(t){return h(e.FilterOperator.IS_EMPTY_STRING,t)},isNotEmptyString(t){return h(e.FilterOperator.IS_NOT_EMPTY_STRING,t)},isNull(t){return h(e.FilterOperator.IS_NULL,t)},isNotNull(t){return h(e.FilterOperator.IS_NOT_NULL,t)},exists(t){return h(e.FilterOperator.EXISTS,t)},notExists(t){return h(e.FilterOperator.NOT_EXISTS,t)},deletion(t){if(t!==i.DeletionState.ACTIVE&&t!==i.DeletionState.DELETED&&t!==i.DeletionState.ALL)throw TypeError(`Deletion state is invalid: [${String(t)}].`);return{op:e.FilterOperator.DELETION,state:t}},elementMatch(t,n){return o.requireElementScopedFilter(n,`ELEMENT_MATCH predicate`),{op:e.FilterOperator.ELEMENT_MATCH,field:a.queryField(t),predicate:n}},search:S,today(t,n={}){return g(e.FilterOperator.TODAY,t,n)},beforeToday(t,n,r={}){let i=s.requireLocalTime(n);return{...s.validateRelativeTimeOptions(r),op:e.FilterOperator.BEFORE_TODAY,field:a.queryField(t),time:i}},tomorrow(t,n={}){return g(e.FilterOperator.TOMORROW,t,n)},thisWeek(t,n={}){return g(e.FilterOperator.THIS_WEEK,t,n)},nextWeek(t,n={}){return g(e.FilterOperator.NEXT_WEEK,t,n)},lastWeek(t,n={}){return g(e.FilterOperator.LAST_WEEK,t,n)},thisMonth(t,n={}){return g(e.FilterOperator.THIS_MONTH,t,n)},lastMonth(t,n={}){return g(e.FilterOperator.LAST_MONTH,t,n)},yesterday(t,n={}){return g(e.FilterOperator.YESTERDAY,t,n)},nextMonth(t,n={}){return g(e.FilterOperator.NEXT_MONTH,t,n)},lastYear(t,n={}){return g(e.FilterOperator.LAST_YEAR,t,n)},thisYear(t,n={}){return g(e.FilterOperator.THIS_YEAR,t,n)},nextYear(t,n={}){return g(e.FilterOperator.NEXT_YEAR,t,n)},recentDays(t,n,r={}){return _(e.FilterOperator.RECENT_DAYS,t,n,r)},earlierDays(t,n,r={}){return _(e.FilterOperator.EARLIER_DAYS,t,n,r)},beforeNow(t,n=`PT0S`,r={}){return v(e.FilterOperator.BEFORE_NOW,t,n,r)},afterNow(t,n=`PT0S`,r={}){return v(e.FilterOperator.AFTER_NOW,t,n,r)},expression(t,i,a){if(!Number.isFinite(a))throw TypeError(`EXPRESSION value must be finite.`);if(!Object.values(n.ComparisonOperator).includes(i))throw TypeError(`EXPRESSION comparison is invalid: [${String(i)}].`);if(r.expressionFields(t).length===0)throw TypeError(`EXPRESSION must read at least one field.`);return r.requireValidExpressionTrees([t]),{op:e.FilterOperator.EXPRESSION,expression:t,comparison:i,value:a}}};exports.filter=C;
1
+ const e=require("./expressionFilter.cjs"),t=require("./fieldFilters.cjs"),n=require("./logicalFilters.cjs"),r=require("./metadataFilters.cjs"),i=require("./searchFilter.cjs"),a=require("./timeFilters.cjs");var o={...r.metadataFilters,...n.logicalFilters,...t.fieldFilters,...i.searchFilters,...a.timeFilters,...e.expressionFilters};exports.filter=o;
2
2
  //# sourceMappingURL=builders.cjs.map