viewkitjs 0.0.0-stage → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/LICENSE.md +7 -0
- package/README.md +36 -2
- package/fields/CHANGELOG.md +1299 -0
- package/fields/NOTICE.md +12 -0
- package/fields/README.md +134 -0
- package/fields/dist/accept.d.ts +39 -0
- package/fields/dist/accept.js +309 -0
- package/fields/dist/actor.d.ts +16 -0
- package/fields/dist/actor.js +44 -0
- package/fields/dist/bands.d.ts +5 -0
- package/fields/dist/bands.js +12 -0
- package/fields/dist/close.d.ts +19 -0
- package/fields/dist/close.js +1 -0
- package/fields/dist/codecs.d.ts +32 -0
- package/fields/dist/codecs.js +119 -0
- package/fields/dist/conventions.d.ts +61 -0
- package/fields/dist/conventions.js +97 -0
- package/fields/dist/countries.d.ts +11 -0
- package/fields/dist/countries.js +98 -0
- package/fields/dist/creatable.d.ts +85 -0
- package/fields/dist/creatable.js +188 -0
- package/fields/dist/date-codec.d.ts +17 -0
- package/fields/dist/date-codec.js +41 -0
- package/fields/dist/definitions.d.ts +2 -0
- package/fields/dist/definitions.js +2 -0
- package/fields/dist/derived.d.ts +84 -0
- package/fields/dist/derived.js +126 -0
- package/fields/dist/design/category-colors.d.ts +17 -0
- package/fields/dist/design/category-colors.js +41 -0
- package/fields/dist/design/stage-marks.d.ts +26 -0
- package/fields/dist/design/stage-marks.js +1 -0
- package/fields/dist/design/status-slots.d.ts +34 -0
- package/fields/dist/design/status-slots.js +72 -0
- package/fields/dist/domain.d.ts +6 -0
- package/fields/dist/domain.js +34 -0
- package/fields/dist/entities.d.ts +67 -0
- package/fields/dist/entities.js +528 -0
- package/fields/dist/equality.d.ts +41 -0
- package/fields/dist/equality.js +114 -0
- package/fields/dist/errors.d.ts +3 -0
- package/fields/dist/errors.js +6 -0
- package/fields/dist/format/time.d.ts +25 -0
- package/fields/dist/format/time.js +77 -0
- package/fields/dist/formula.d.ts +54 -0
- package/fields/dist/formula.js +510 -0
- package/fields/dist/index.d.ts +35 -0
- package/fields/dist/index.js +32 -0
- package/fields/dist/kit.d.ts +23 -0
- package/fields/dist/kit.js +25 -0
- package/fields/dist/labels.d.ts +3 -0
- package/fields/dist/labels.js +5 -0
- package/fields/dist/link.d.ts +33 -0
- package/fields/dist/link.js +58 -0
- package/fields/dist/location.d.ts +26 -0
- package/fields/dist/location.js +92 -0
- package/fields/dist/markdown.d.ts +7 -0
- package/fields/dist/markdown.js +64 -0
- package/fields/dist/messages.d.ts +374 -0
- package/fields/dist/messages.js +332 -0
- package/fields/dist/name.d.ts +23 -0
- package/fields/dist/name.js +53 -0
- package/fields/dist/normalize.d.ts +6 -0
- package/fields/dist/normalize.js +17 -0
- package/fields/dist/optimistic.d.ts +37 -0
- package/fields/dist/optimistic.js +56 -0
- package/fields/dist/options.d.ts +26 -0
- package/fields/dist/options.js +31 -0
- package/fields/dist/parse-number.d.ts +55 -0
- package/fields/dist/parse-number.js +142 -0
- package/fields/dist/phone.d.ts +47 -0
- package/fields/dist/phone.js +121 -0
- package/fields/dist/places/format.d.ts +29 -0
- package/fields/dist/places/format.js +97 -0
- package/fields/dist/places/formats.d.ts +25 -0
- package/fields/dist/places/formats.js +260 -0
- package/fields/dist/places/index.d.ts +13 -0
- package/fields/dist/places/index.js +21 -0
- package/fields/dist/places/load-regions.d.ts +7 -0
- package/fields/dist/places/load-regions.js +65 -0
- package/fields/dist/places/regions/AD.d.ts +4 -0
- package/fields/dist/places/regions/AD.js +11 -0
- package/fields/dist/places/regions/AE.d.ts +4 -0
- package/fields/dist/places/regions/AE.js +11 -0
- package/fields/dist/places/regions/AM.d.ts +4 -0
- package/fields/dist/places/regions/AM.js +15 -0
- package/fields/dist/places/regions/AR.d.ts +4 -0
- package/fields/dist/places/regions/AR.js +28 -0
- package/fields/dist/places/regions/AU.d.ts +4 -0
- package/fields/dist/places/regions/AU.js +13 -0
- package/fields/dist/places/regions/BB.d.ts +4 -0
- package/fields/dist/places/regions/BB.js +15 -0
- package/fields/dist/places/regions/BR.d.ts +4 -0
- package/fields/dist/places/regions/BR.js +31 -0
- package/fields/dist/places/regions/BS.d.ts +4 -0
- package/fields/dist/places/regions/BS.js +23 -0
- package/fields/dist/places/regions/BY.d.ts +4 -0
- package/fields/dist/places/regions/BY.js +11 -0
- package/fields/dist/places/regions/CA.d.ts +4 -0
- package/fields/dist/places/regions/CA.js +17 -0
- package/fields/dist/places/regions/CL.d.ts +4 -0
- package/fields/dist/places/regions/CL.js +20 -0
- package/fields/dist/places/regions/CN.d.ts +4 -0
- package/fields/dist/places/regions/CN.js +38 -0
- package/fields/dist/places/regions/CO.d.ts +4 -0
- package/fields/dist/places/regions/CO.js +37 -0
- package/fields/dist/places/regions/CR.d.ts +4 -0
- package/fields/dist/places/regions/CR.js +11 -0
- package/fields/dist/places/regions/CU.d.ts +4 -0
- package/fields/dist/places/regions/CU.js +20 -0
- package/fields/dist/places/regions/CV.d.ts +4 -0
- package/fields/dist/places/regions/CV.js +13 -0
- package/fields/dist/places/regions/EE.d.ts +4 -0
- package/fields/dist/places/regions/EE.js +19 -0
- package/fields/dist/places/regions/EG.d.ts +4 -0
- package/fields/dist/places/regions/EG.js +31 -0
- package/fields/dist/places/regions/ES.d.ts +4 -0
- package/fields/dist/places/regions/ES.js +56 -0
- package/fields/dist/places/regions/FM.d.ts +4 -0
- package/fields/dist/places/regions/FM.js +8 -0
- package/fields/dist/places/regions/HK.d.ts +4 -0
- package/fields/dist/places/regions/HK.js +7 -0
- package/fields/dist/places/regions/HN.d.ts +4 -0
- package/fields/dist/places/regions/HN.js +22 -0
- package/fields/dist/places/regions/ID.d.ts +4 -0
- package/fields/dist/places/regions/ID.js +38 -0
- package/fields/dist/places/regions/IE.d.ts +4 -0
- package/fields/dist/places/regions/IE.js +30 -0
- package/fields/dist/places/regions/IN.d.ts +4 -0
- package/fields/dist/places/regions/IN.js +40 -0
- package/fields/dist/places/regions/IQ.d.ts +4 -0
- package/fields/dist/places/regions/IQ.js +23 -0
- package/fields/dist/places/regions/IR.d.ts +4 -0
- package/fields/dist/places/regions/IR.js +35 -0
- package/fields/dist/places/regions/IT.d.ts +4 -0
- package/fields/dist/places/regions/IT.js +115 -0
- package/fields/dist/places/regions/JM.d.ts +4 -0
- package/fields/dist/places/regions/JM.js +18 -0
- package/fields/dist/places/regions/JP.d.ts +4 -0
- package/fields/dist/places/regions/JP.js +51 -0
- package/fields/dist/places/regions/KN.d.ts +4 -0
- package/fields/dist/places/regions/KN.js +6 -0
- package/fields/dist/places/regions/KP.d.ts +4 -0
- package/fields/dist/places/regions/KP.js +17 -0
- package/fields/dist/places/regions/KR.d.ts +4 -0
- package/fields/dist/places/regions/KR.js +21 -0
- package/fields/dist/places/regions/KY.d.ts +4 -0
- package/fields/dist/places/regions/KY.js +7 -0
- package/fields/dist/places/regions/KZ.d.ts +4 -0
- package/fields/dist/places/regions/KZ.js +24 -0
- package/fields/dist/places/regions/MN.d.ts +4 -0
- package/fields/dist/places/regions/MN.js +26 -0
- package/fields/dist/places/regions/MX.d.ts +4 -0
- package/fields/dist/places/regions/MX.js +36 -0
- package/fields/dist/places/regions/MY.d.ts +4 -0
- package/fields/dist/places/regions/MY.js +20 -0
- package/fields/dist/places/regions/MZ.d.ts +4 -0
- package/fields/dist/places/regions/MZ.js +15 -0
- package/fields/dist/places/regions/NG.d.ts +4 -0
- package/fields/dist/places/regions/NG.js +41 -0
- package/fields/dist/places/regions/NI.d.ts +4 -0
- package/fields/dist/places/regions/NI.js +21 -0
- package/fields/dist/places/regions/NR.d.ts +4 -0
- package/fields/dist/places/regions/NR.js +18 -0
- package/fields/dist/places/regions/PA.d.ts +4 -0
- package/fields/dist/places/regions/PA.js +18 -0
- package/fields/dist/places/regions/PE.d.ts +4 -0
- package/fields/dist/places/regions/PE.js +30 -0
- package/fields/dist/places/regions/PG.d.ts +4 -0
- package/fields/dist/places/regions/PG.js +26 -0
- package/fields/dist/places/regions/PH.d.ts +4 -0
- package/fields/dist/places/regions/PH.js +86 -0
- package/fields/dist/places/regions/PW.d.ts +4 -0
- package/fields/dist/places/regions/PW.js +20 -0
- package/fields/dist/places/regions/RO.d.ts +4 -0
- package/fields/dist/places/regions/RO.js +46 -0
- package/fields/dist/places/regions/RU.d.ts +4 -0
- package/fields/dist/places/regions/RU.js +89 -0
- package/fields/dist/places/regions/SO.d.ts +4 -0
- package/fields/dist/places/regions/SO.js +22 -0
- package/fields/dist/places/regions/SR.d.ts +4 -0
- package/fields/dist/places/regions/SR.js +14 -0
- package/fields/dist/places/regions/SV.d.ts +4 -0
- package/fields/dist/places/regions/SV.js +18 -0
- package/fields/dist/places/regions/TH.d.ts +4 -0
- package/fields/dist/places/regions/TH.js +81 -0
- package/fields/dist/places/regions/TR.d.ts +4 -0
- package/fields/dist/places/regions/TR.js +85 -0
- package/fields/dist/places/regions/TV.d.ts +4 -0
- package/fields/dist/places/regions/TV.js +13 -0
- package/fields/dist/places/regions/TW.d.ts +4 -0
- package/fields/dist/places/regions/TW.js +26 -0
- package/fields/dist/places/regions/UA.d.ts +4 -0
- package/fields/dist/places/regions/UA.js +31 -0
- package/fields/dist/places/regions/US.d.ts +4 -0
- package/fields/dist/places/regions/US.js +66 -0
- package/fields/dist/places/regions/UY.d.ts +4 -0
- package/fields/dist/places/regions/UY.js +23 -0
- package/fields/dist/places/regions/UZ.d.ts +4 -0
- package/fields/dist/places/regions/UZ.js +18 -0
- package/fields/dist/places/regions/VE.d.ts +4 -0
- package/fields/dist/places/regions/VE.js +29 -0
- package/fields/dist/places/regions/VN.d.ts +4 -0
- package/fields/dist/places/regions/VN.js +67 -0
- package/fields/dist/query/board.d.ts +28 -0
- package/fields/dist/query/board.js +44 -0
- package/fields/dist/query/buckets.d.ts +95 -0
- package/fields/dist/query/buckets.js +453 -0
- package/fields/dist/query/change.d.ts +8 -0
- package/fields/dist/query/change.js +43 -0
- package/fields/dist/query/collate.d.ts +10 -0
- package/fields/dist/query/collate.js +22 -0
- package/fields/dist/query/column-state.d.ts +25 -0
- package/fields/dist/query/column-state.js +10 -0
- package/fields/dist/query/date.d.ts +82 -0
- package/fields/dist/query/date.js +254 -0
- package/fields/dist/query/evaluate.d.ts +69 -0
- package/fields/dist/query/evaluate.js +84 -0
- package/fields/dist/query/figure-kinds.d.ts +26 -0
- package/fields/dist/query/figure-kinds.js +27 -0
- package/fields/dist/query/figures.d.ts +69 -0
- package/fields/dist/query/figures.js +169 -0
- package/fields/dist/query/filter.d.ts +138 -0
- package/fields/dist/query/filter.js +475 -0
- package/fields/dist/query/fold.d.ts +1 -0
- package/fields/dist/query/fold.js +4 -0
- package/fields/dist/query/group.d.ts +15 -0
- package/fields/dist/query/group.js +7 -0
- package/fields/dist/query/hold.d.ts +35 -0
- package/fields/dist/query/hold.js +70 -0
- package/fields/dist/query/index.d.ts +25 -0
- package/fields/dist/query/index.js +25 -0
- package/fields/dist/query/kit.d.ts +57 -0
- package/fields/dist/query/kit.js +29 -0
- package/fields/dist/query/layer.d.ts +35 -0
- package/fields/dist/query/layer.js +51 -0
- package/fields/dist/query/link.d.ts +8 -0
- package/fields/dist/query/link.js +18 -0
- package/fields/dist/query/list-link.d.ts +65 -0
- package/fields/dist/query/list-link.js +174 -0
- package/fields/dist/query/location.d.ts +20 -0
- package/fields/dist/query/location.js +36 -0
- package/fields/dist/query/name.d.ts +6 -0
- package/fields/dist/query/name.js +23 -0
- package/fields/dist/query/number.d.ts +94 -0
- package/fields/dist/query/number.js +180 -0
- package/fields/dist/query/option-counts.d.ts +38 -0
- package/fields/dist/query/option-counts.js +89 -0
- package/fields/dist/query/range.d.ts +22 -0
- package/fields/dist/query/range.js +79 -0
- package/fields/dist/query/read-rule.d.ts +3 -0
- package/fields/dist/query/read-rule.js +13 -0
- package/fields/dist/query/search.d.ts +20 -0
- package/fields/dist/query/search.js +77 -0
- package/fields/dist/query/set-aside.d.ts +82 -0
- package/fields/dist/query/set-aside.js +172 -0
- package/fields/dist/query/settings.d.ts +94 -0
- package/fields/dist/query/settings.js +195 -0
- package/fields/dist/query/sort.d.ts +32 -0
- package/fields/dist/query/sort.js +270 -0
- package/fields/dist/query/text.d.ts +55 -0
- package/fields/dist/query/text.js +80 -0
- package/fields/dist/range.d.ts +25 -0
- package/fields/dist/range.js +63 -0
- package/fields/dist/registry.d.ts +114 -0
- package/fields/dist/registry.js +864 -0
- package/fields/dist/relation.d.ts +84 -0
- package/fields/dist/relation.js +106 -0
- package/fields/dist/root-domain.d.ts +4 -0
- package/fields/dist/root-domain.js +12 -0
- package/fields/dist/settlement.d.ts +4 -0
- package/fields/dist/settlement.js +11 -0
- package/fields/dist/spec-changes.d.ts +20 -0
- package/fields/dist/spec-changes.js +170 -0
- package/fields/dist/testing/backend.d.ts +75 -0
- package/fields/dist/testing/backend.js +1 -0
- package/fields/dist/testing/cases.d.ts +14 -0
- package/fields/dist/testing/cases.js +327 -0
- package/fields/dist/testing/compare.d.ts +39 -0
- package/fields/dist/testing/compare.js +123 -0
- package/fields/dist/testing/index.d.ts +7 -0
- package/fields/dist/testing/index.js +5 -0
- package/fields/dist/testing/memory.d.ts +4 -0
- package/fields/dist/testing/memory.js +90 -0
- package/fields/dist/testing/now.d.ts +4 -0
- package/fields/dist/testing/now.js +2 -0
- package/fields/dist/testing/query-of.d.ts +8 -0
- package/fields/dist/testing/query-of.js +16 -0
- package/fields/dist/testing/question.d.ts +3 -0
- package/fields/dist/testing/question.js +10 -0
- package/fields/dist/testing/reader.d.ts +11 -0
- package/fields/dist/testing/reader.js +12 -0
- package/fields/dist/testing/reference.d.ts +20 -0
- package/fields/dist/testing/reference.js +58 -0
- package/fields/dist/testing/runner.d.ts +32 -0
- package/fields/dist/testing/runner.js +145 -0
- package/fields/dist/testing/samples.d.ts +5 -0
- package/fields/dist/testing/samples.js +338 -0
- package/fields/dist/testing/speed.d.ts +35 -0
- package/fields/dist/testing/speed.js +134 -0
- package/fields/dist/testing/sweep.d.ts +11 -0
- package/fields/dist/testing/sweep.js +154 -0
- package/fields/dist/testing/text-order.d.ts +8 -0
- package/fields/dist/testing/text-order.js +73 -0
- package/fields/dist/testing/worked-out.d.ts +16 -0
- package/fields/dist/testing/worked-out.js +234 -0
- package/fields/dist/types.d.ts +722 -0
- package/fields/dist/types.js +1 -0
- package/fields/dist/value-list.d.ts +56 -0
- package/fields/dist/value-list.js +75 -0
- package/fields/dist/write-result.d.ts +49 -0
- package/fields/dist/write-result.js +34 -0
- package/fields/dist/zod.d.ts +29 -0
- package/fields/dist/zod.js +419 -0
- package/fields/docs/getting-started.md +147 -0
- package/fields/docs/guides/checking-definitions.md +517 -0
- package/fields/docs/guides/contact-values.md +466 -0
- package/fields/docs/guides/conventions.md +312 -0
- package/fields/docs/guides/derived-fields.md +701 -0
- package/fields/docs/guides/field-types.md +665 -0
- package/fields/docs/guides/names-and-places.md +356 -0
- package/fields/docs/guides/narrowing-names.md +146 -0
- package/fields/docs/guides/options.md +348 -0
- package/fields/docs/guides/queries.md +1055 -0
- package/fields/docs/guides/the-index.md +415 -0
- package/fields/docs/guides/validation-and-acceptance.md +314 -0
- package/fields/docs/guides/who-may-change.md +299 -0
- package/fields/docs/index.md +47 -0
- package/fields/docs/reference/definitions.md +22 -0
- package/fields/docs/reference/design-category-colors.md +8 -0
- package/fields/docs/reference/design-stage-marks.md +4 -0
- package/fields/docs/reference/design-status-slots.md +6 -0
- package/fields/docs/reference/fields.md +275 -0
- package/fields/docs/reference/format-time.md +9 -0
- package/fields/docs/reference/phone.md +17 -0
- package/fields/docs/reference/places.md +9 -0
- package/fields/docs/reference/query.md +295 -0
- package/fields/docs/reference/root-domain.md +5 -0
- package/fields/docs/reference/testing.md +87 -0
- package/fields/docs/reference/types.md +95 -0
- package/fields/skills/viewkit/SKILL.md +377 -0
- package/package.json +261 -3
- package/postgres/CHANGELOG.md +676 -0
- package/postgres/README.md +35 -0
- package/postgres/dist/access.d.ts +131 -0
- package/postgres/dist/access.js +168 -0
- package/postgres/dist/actor.d.ts +3 -0
- package/postgres/dist/actor.js +6 -0
- package/postgres/dist/bounds.d.ts +16 -0
- package/postgres/dist/bounds.js +69 -0
- package/postgres/dist/calendar.d.ts +31 -0
- package/postgres/dist/calendar.js +64 -0
- package/postgres/dist/check.d.ts +53 -0
- package/postgres/dist/check.js +326 -0
- package/postgres/dist/counts.d.ts +44 -0
- package/postgres/dist/counts.js +96 -0
- package/postgres/dist/cursor.d.ts +26 -0
- package/postgres/dist/cursor.js +210 -0
- package/postgres/dist/date-groups.d.ts +45 -0
- package/postgres/dist/date-groups.js +176 -0
- package/postgres/dist/definitions/build.d.ts +28 -0
- package/postgres/dist/definitions/build.js +174 -0
- package/postgres/dist/definitions/float.d.ts +55 -0
- package/postgres/dist/definitions/float.js +108 -0
- package/postgres/dist/definitions/formula-forms.d.ts +29 -0
- package/postgres/dist/definitions/formula-forms.js +209 -0
- package/postgres/dist/definitions/formula.d.ts +14 -0
- package/postgres/dist/definitions/formula.js +209 -0
- package/postgres/dist/definitions/index.d.ts +3 -0
- package/postgres/dist/definitions/index.js +2 -0
- package/postgres/dist/definitions/json.d.ts +14 -0
- package/postgres/dist/definitions/json.js +68 -0
- package/postgres/dist/definitions/label.d.ts +8 -0
- package/postgres/dist/definitions/label.js +35 -0
- package/postgres/dist/definitions/lookup.d.ts +8 -0
- package/postgres/dist/definitions/lookup.js +88 -0
- package/postgres/dist/definitions/money.d.ts +29 -0
- package/postgres/dist/definitions/money.js +80 -0
- package/postgres/dist/definitions/place.d.ts +50 -0
- package/postgres/dist/definitions/place.js +38 -0
- package/postgres/dist/definitions/relations.d.ts +9 -0
- package/postgres/dist/definitions/relations.js +48 -0
- package/postgres/dist/definitions/rollup.d.ts +17 -0
- package/postgres/dist/definitions/rollup.js +343 -0
- package/postgres/dist/definitions/storage.d.ts +120 -0
- package/postgres/dist/definitions/storage.js +334 -0
- package/postgres/dist/definitions/stored.d.ts +3 -0
- package/postgres/dist/definitions/stored.js +72 -0
- package/postgres/dist/definitions/user.d.ts +7 -0
- package/postgres/dist/definitions/user.js +42 -0
- package/postgres/dist/double.d.ts +6 -0
- package/postgres/dist/double.js +10 -0
- package/postgres/dist/field-values.d.ts +16 -0
- package/postgres/dist/field-values.js +75 -0
- package/postgres/dist/figures.d.ts +37 -0
- package/postgres/dist/figures.js +88 -0
- package/postgres/dist/filled.d.ts +7 -0
- package/postgres/dist/filled.js +47 -0
- package/postgres/dist/fold.d.ts +15 -0
- package/postgres/dist/fold.js +21 -0
- package/postgres/dist/groups.d.ts +85 -0
- package/postgres/dist/groups.js +189 -0
- package/postgres/dist/ids.d.ts +8 -0
- package/postgres/dist/ids.js +16 -0
- package/postgres/dist/index.d.ts +21 -0
- package/postgres/dist/index.js +20 -0
- package/postgres/dist/kept.d.ts +36 -0
- package/postgres/dist/kept.js +43 -0
- package/postgres/dist/keyed.d.ts +48 -0
- package/postgres/dist/keyed.js +269 -0
- package/postgres/dist/lanes.d.ts +26 -0
- package/postgres/dist/lanes.js +69 -0
- package/postgres/dist/limits.d.ts +12 -0
- package/postgres/dist/limits.js +1 -0
- package/postgres/dist/map.d.ts +198 -0
- package/postgres/dist/map.js +475 -0
- package/postgres/dist/page.d.ts +116 -0
- package/postgres/dist/page.js +577 -0
- package/postgres/dist/parts.d.ts +10 -0
- package/postgres/dist/parts.js +82 -0
- package/postgres/dist/phone.d.ts +28 -0
- package/postgres/dist/phone.js +54 -0
- package/postgres/dist/predicates.d.ts +8 -0
- package/postgres/dist/predicates.js +35 -0
- package/postgres/dist/range-groups.d.ts +22 -0
- package/postgres/dist/range-groups.js +97 -0
- package/postgres/dist/records.d.ts +24 -0
- package/postgres/dist/records.js +183 -0
- package/postgres/dist/refusals.d.ts +38 -0
- package/postgres/dist/refusals.js +46 -0
- package/postgres/dist/relations.d.ts +23 -0
- package/postgres/dist/relations.js +71 -0
- package/postgres/dist/rules.d.ts +60 -0
- package/postgres/dist/rules.js +218 -0
- package/postgres/dist/search-indexes.d.ts +62 -0
- package/postgres/dist/search-indexes.js +189 -0
- package/postgres/dist/search.d.ts +56 -0
- package/postgres/dist/search.js +152 -0
- package/postgres/dist/several.d.ts +49 -0
- package/postgres/dist/several.js +174 -0
- package/postgres/dist/sort.d.ts +104 -0
- package/postgres/dist/sort.js +368 -0
- package/postgres/dist/sql.d.ts +60 -0
- package/postgres/dist/sql.js +247 -0
- package/postgres/dist/statement.d.ts +4 -0
- package/postgres/dist/statement.js +7 -0
- package/postgres/dist/steps.d.ts +18 -0
- package/postgres/dist/steps.js +18 -0
- package/postgres/dist/users.d.ts +35 -0
- package/postgres/dist/users.js +33 -0
- package/postgres/dist/value-rows.d.ts +23 -0
- package/postgres/dist/value-rows.js +64 -0
- package/postgres/dist/values.d.ts +56 -0
- package/postgres/dist/values.js +160 -0
- package/postgres/dist/view-counts.d.ts +14 -0
- package/postgres/dist/view-counts.js +50 -0
- package/postgres/dist/walker.d.ts +12 -0
- package/postgres/dist/walker.js +18 -0
- package/postgres/docs/guides/definitions.md +221 -0
- package/postgres/docs/guides/field-map.md +705 -0
- package/postgres/docs/guides/test-kit.md +110 -0
- package/postgres/docs/index.md +11 -0
- package/postgres/docs/reference/definitions.md +41 -0
- package/postgres/docs/reference/postgres.md +108 -0
- package/views/CHANGELOG.md +3582 -0
- package/views/README.md +104 -0
- package/views/dist/atoms/Avatar.d.ts +2 -0
- package/views/dist/atoms/Avatar.js +13 -0
- package/views/dist/atoms/CellMore.d.ts +2 -0
- package/views/dist/atoms/CellMore.js +4 -0
- package/views/dist/atoms/CommandMenu.d.ts +2 -0
- package/views/dist/atoms/CommandMenu.js +24 -0
- package/views/dist/atoms/DisabledReason.d.ts +13 -0
- package/views/dist/atoms/DisabledReason.js +27 -0
- package/views/dist/atoms/DrillRows.d.ts +3 -0
- package/views/dist/atoms/DrillRows.js +27 -0
- package/views/dist/atoms/List.d.ts +2 -0
- package/views/dist/atoms/List.js +6 -0
- package/views/dist/atoms/LoadMore.d.ts +2 -0
- package/views/dist/atoms/LoadMore.js +35 -0
- package/views/dist/atoms/Loading.d.ts +8 -0
- package/views/dist/atoms/Loading.js +10 -0
- package/views/dist/atoms/PanelRows.d.ts +5 -0
- package/views/dist/atoms/PanelRows.js +38 -0
- package/views/dist/atoms/PanelSearch.d.ts +2 -0
- package/views/dist/atoms/PanelSearch.js +23 -0
- package/views/dist/atoms/Pill.d.ts +2 -0
- package/views/dist/atoms/Pill.js +25 -0
- package/views/dist/atoms/PlatformMark.d.ts +2 -0
- package/views/dist/atoms/PlatformMark.js +4 -0
- package/views/dist/atoms/RangeCalendar.d.ts +8 -0
- package/views/dist/atoms/RangeCalendar.js +30 -0
- package/views/dist/atoms/RelationLink.d.ts +2 -0
- package/views/dist/atoms/RelationLink.js +6 -0
- package/views/dist/atoms/RelationRoles.d.ts +2 -0
- package/views/dist/atoms/RelationRoles.js +6 -0
- package/views/dist/atoms/Row.d.ts +3 -0
- package/views/dist/atoms/Row.js +31 -0
- package/views/dist/atoms/RowMenu.d.ts +2 -0
- package/views/dist/atoms/RowMenu.js +116 -0
- package/views/dist/atoms/SelectionSheet.d.ts +3 -0
- package/views/dist/atoms/SelectionSheet.js +31 -0
- package/views/dist/atoms/StatusBadge.d.ts +2 -0
- package/views/dist/atoms/StatusBadge.js +7 -0
- package/views/dist/atoms/StatusMarker.d.ts +2 -0
- package/views/dist/atoms/StatusMarker.js +21 -0
- package/views/dist/atoms/Tag.d.ts +2 -0
- package/views/dist/atoms/Tag.js +14 -0
- package/views/dist/atoms/TickBox.d.ts +2 -0
- package/views/dist/atoms/TickBox.js +8 -0
- package/views/dist/atoms/ToolbarButton.d.ts +2 -0
- package/views/dist/atoms/ToolbarButton.js +50 -0
- package/views/dist/atoms/defaults.d.ts +2 -0
- package/views/dist/atoms/defaults.js +51 -0
- package/views/dist/atoms/tones.d.ts +5 -0
- package/views/dist/atoms/tones.js +28 -0
- package/views/dist/atoms/types.d.ts +496 -0
- package/views/dist/atoms/types.js +3 -0
- package/views/dist/cells/cell-format.d.ts +147 -0
- package/views/dist/cells/cell-format.js +16 -0
- package/views/dist/cells/cell-title.d.ts +20 -0
- package/views/dist/cells/cell-title.js +8 -0
- package/views/dist/cells/cell-values.d.ts +28 -0
- package/views/dist/cells/cell-values.js +107 -0
- package/views/dist/cells/index.d.ts +4 -0
- package/views/dist/cells/index.js +4 -0
- package/views/dist/cells/legacy-field.d.ts +52 -0
- package/views/dist/cells/legacy-field.js +164 -0
- package/views/dist/cells/relation-wrap.d.ts +3 -0
- package/views/dist/cells/relation-wrap.js +26 -0
- package/views/dist/cells/use-cell-format.d.ts +5 -0
- package/views/dist/cells/use-cell-format.js +10 -0
- package/views/dist/contract.d.ts +1337 -0
- package/views/dist/contract.js +1824 -0
- package/views/dist/display/actor.d.ts +4 -0
- package/views/dist/display/actor.js +26 -0
- package/views/dist/display/boolean.d.ts +18 -0
- package/views/dist/display/boolean.js +50 -0
- package/views/dist/display/breakdown.d.ts +15 -0
- package/views/dist/display/breakdown.js +32 -0
- package/views/dist/display/converted.d.ts +19 -0
- package/views/dist/display/converted.js +12 -0
- package/views/dist/display/currency.d.ts +9 -0
- package/views/dist/display/currency.js +29 -0
- package/views/dist/display/date.d.ts +12 -0
- package/views/dist/display/date.js +28 -0
- package/views/dist/display/display-cores.d.ts +31 -0
- package/views/dist/display/display-cores.js +57 -0
- package/views/dist/display/entity-chip.d.ts +29 -0
- package/views/dist/display/entity-chip.js +8 -0
- package/views/dist/display/fit-values.d.ts +34 -0
- package/views/dist/display/fit-values.js +45 -0
- package/views/dist/display/format.d.ts +66 -0
- package/views/dist/display/format.js +206 -0
- package/views/dist/display/index.d.ts +9 -0
- package/views/dist/display/index.js +8 -0
- package/views/dist/display/link-click.d.ts +11 -0
- package/views/dist/display/link-click.js +3 -0
- package/views/dist/display/link.d.ts +29 -0
- package/views/dist/display/link.js +56 -0
- package/views/dist/display/location.d.ts +8 -0
- package/views/dist/display/location.js +22 -0
- package/views/dist/display/multi-value.d.ts +18 -0
- package/views/dist/display/multi-value.js +93 -0
- package/views/dist/display/name.d.ts +6 -0
- package/views/dist/display/name.js +14 -0
- package/views/dist/display/number.d.ts +11 -0
- package/views/dist/display/number.js +27 -0
- package/views/dist/display/options.d.ts +167 -0
- package/views/dist/display/options.js +1 -0
- package/views/dist/display/percent.d.ts +4 -0
- package/views/dist/display/percent.js +41 -0
- package/views/dist/display/phone.d.ts +11 -0
- package/views/dist/display/phone.js +49 -0
- package/views/dist/display/range.d.ts +6 -0
- package/views/dist/display/range.js +19 -0
- package/views/dist/display/relation.d.ts +4 -0
- package/views/dist/display/relation.js +44 -0
- package/views/dist/display/rich-text.d.ts +10 -0
- package/views/dist/display/rich-text.js +46 -0
- package/views/dist/display/select.d.ts +6 -0
- package/views/dist/display/select.js +40 -0
- package/views/dist/display/status-steps.d.ts +8 -0
- package/views/dist/display/status-steps.js +18 -0
- package/views/dist/display/text-class.d.ts +23 -0
- package/views/dist/display/text-class.js +5 -0
- package/views/dist/display/text.d.ts +19 -0
- package/views/dist/display/text.js +8 -0
- package/views/dist/display/use-display-options.d.ts +2 -0
- package/views/dist/display/use-display-options.js +14 -0
- package/views/dist/display/user.d.ts +11 -0
- package/views/dist/display/user.js +10 -0
- package/views/dist/display/value-list.d.ts +10 -0
- package/views/dist/display/value-list.js +12 -0
- package/views/dist/display/viewer.d.ts +4 -0
- package/views/dist/display/viewer.js +12 -0
- package/views/dist/display/web-href.d.ts +16 -0
- package/views/dist/display/web-href.js +19 -0
- package/views/dist/editors/BodyFrame.d.ts +30 -0
- package/views/dist/editors/BodyFrame.js +86 -0
- package/views/dist/editors/ChipsEditor.d.ts +76 -0
- package/views/dist/editors/ChipsEditor.js +118 -0
- package/views/dist/editors/DateEditor.d.ts +42 -0
- package/views/dist/editors/DateEditor.js +298 -0
- package/views/dist/editors/EditorPanel.d.ts +71 -0
- package/views/dist/editors/EditorPanel.js +158 -0
- package/views/dist/editors/LocationEditor.d.ts +33 -0
- package/views/dist/editors/LocationEditor.js +320 -0
- package/views/dist/editors/NameEditor.d.ts +29 -0
- package/views/dist/editors/NameEditor.js +119 -0
- package/views/dist/editors/NumberEditor.d.ts +90 -0
- package/views/dist/editors/NumberEditor.js +126 -0
- package/views/dist/editors/RangeEditor.d.ts +51 -0
- package/views/dist/editors/RangeEditor.js +125 -0
- package/views/dist/editors/RelationEditor.d.ts +52 -0
- package/views/dist/editors/RelationEditor.js +55 -0
- package/views/dist/editors/RelationSetEditor.d.ts +63 -0
- package/views/dist/editors/RelationSetEditor.js +222 -0
- package/views/dist/editors/SelectEditor.d.ts +104 -0
- package/views/dist/editors/SelectEditor.js +154 -0
- package/views/dist/editors/TextEditor.d.ts +61 -0
- package/views/dist/editors/TextEditor.js +102 -0
- package/views/dist/editors/ValueListEditor.d.ts +51 -0
- package/views/dist/editors/ValueListEditor.js +239 -0
- package/views/dist/editors/body-panel.d.ts +11 -0
- package/views/dist/editors/body-panel.js +11 -0
- package/views/dist/editors/body-step.d.ts +12 -0
- package/views/dist/editors/body-step.js +6 -0
- package/views/dist/editors/edit-cores.d.ts +86 -0
- package/views/dist/editors/edit-cores.js +39 -0
- package/views/dist/editors/edit-session.d.ts +113 -0
- package/views/dist/editors/edit-session.js +97 -0
- package/views/dist/editors/escape-rule.d.ts +34 -0
- package/views/dist/editors/escape-rule.js +15 -0
- package/views/dist/editors/inner-escape.d.ts +12 -0
- package/views/dist/editors/inner-escape.js +10 -0
- package/views/dist/editors/keep-inside.d.ts +12 -0
- package/views/dist/editors/keep-inside.js +20 -0
- package/views/dist/editors/leave-scope.d.ts +31 -0
- package/views/dist/editors/leave-scope.js +29 -0
- package/views/dist/editors/link-roles.d.ts +9 -0
- package/views/dist/editors/link-roles.js +19 -0
- package/views/dist/editors/number-body.d.ts +30 -0
- package/views/dist/editors/number-body.js +38 -0
- package/views/dist/editors/number-step.d.ts +39 -0
- package/views/dist/editors/number-step.js +47 -0
- package/views/dist/editors/open-value.d.ts +22 -0
- package/views/dist/editors/open-value.js +37 -0
- package/views/dist/editors/open-values.d.ts +32 -0
- package/views/dist/editors/open-values.js +33 -0
- package/views/dist/editors/option-add-flow.d.ts +66 -0
- package/views/dist/editors/option-add-flow.js +155 -0
- package/views/dist/editors/parts-body.d.ts +68 -0
- package/views/dist/editors/parts-body.js +117 -0
- package/views/dist/editors/picker-slot.d.ts +25 -0
- package/views/dist/editors/picker-slot.js +37 -0
- package/views/dist/editors/relation-kinds.d.ts +7 -0
- package/views/dist/editors/relation-kinds.js +21 -0
- package/views/dist/editors/relation-links-body.d.ts +36 -0
- package/views/dist/editors/relation-links-body.js +22 -0
- package/views/dist/editors/relation-panel.d.ts +69 -0
- package/views/dist/editors/relation-panel.js +40 -0
- package/views/dist/editors/relation-picker.d.ts +63 -0
- package/views/dist/editors/relation-picker.js +58 -0
- package/views/dist/editors/relation-source.d.ts +67 -0
- package/views/dist/editors/relation-source.js +108 -0
- package/views/dist/editors/tab-ends.d.ts +7 -0
- package/views/dist/editors/tab-ends.js +10 -0
- package/views/dist/editors/text-body.d.ts +16 -0
- package/views/dist/editors/text-body.js +30 -0
- package/views/dist/editors/values-body.d.ts +47 -0
- package/views/dist/editors/values-body.js +140 -0
- package/views/dist/field-row/FieldNoteLine.d.ts +14 -0
- package/views/dist/field-row/FieldNoteLine.js +15 -0
- package/views/dist/field-row/FieldRow.d.ts +81 -0
- package/views/dist/field-row/FieldRow.js +232 -0
- package/views/dist/field-row/FieldRowLane.d.ts +19 -0
- package/views/dist/field-row/FieldRowLane.js +21 -0
- package/views/dist/field-row/drawn-text.d.ts +7 -0
- package/views/dist/field-row/drawn-text.js +27 -0
- package/views/dist/field-row/editors/RowChipsEditor.d.ts +11 -0
- package/views/dist/field-row/editors/RowChipsEditor.js +27 -0
- package/views/dist/field-row/editors/RowDateEditor.d.ts +16 -0
- package/views/dist/field-row/editors/RowDateEditor.js +18 -0
- package/views/dist/field-row/editors/RowEditor.d.ts +39 -0
- package/views/dist/field-row/editors/RowEditor.js +66 -0
- package/views/dist/field-row/editors/RowNameEditor.d.ts +7 -0
- package/views/dist/field-row/editors/RowNameEditor.js +23 -0
- package/views/dist/field-row/editors/RowNumberEditor.d.ts +12 -0
- package/views/dist/field-row/editors/RowNumberEditor.js +34 -0
- package/views/dist/field-row/editors/RowPlaceEditor.d.ts +9 -0
- package/views/dist/field-row/editors/RowPlaceEditor.js +20 -0
- package/views/dist/field-row/editors/RowRangeEditor.d.ts +7 -0
- package/views/dist/field-row/editors/RowRangeEditor.js +25 -0
- package/views/dist/field-row/editors/RowRelationEditor.d.ts +20 -0
- package/views/dist/field-row/editors/RowRelationEditor.js +80 -0
- package/views/dist/field-row/editors/RowSelectEditor.d.ts +13 -0
- package/views/dist/field-row/editors/RowSelectEditor.js +26 -0
- package/views/dist/field-row/editors/RowTextEditor.d.ts +15 -0
- package/views/dist/field-row/editors/RowTextEditor.js +25 -0
- package/views/dist/field-row/editors/RowValueListEditor.d.ts +6 -0
- package/views/dist/field-row/editors/RowValueListEditor.js +34 -0
- package/views/dist/field-row/editors/host.d.ts +65 -0
- package/views/dist/field-row/editors/host.js +1 -0
- package/views/dist/field-row/editors/row-frame.d.ts +2 -0
- package/views/dist/field-row/editors/row-frame.js +1 -0
- package/views/dist/field-row/editors/row-session.d.ts +63 -0
- package/views/dist/field-row/editors/row-session.js +102 -0
- package/views/dist/field-row/field-row-button.d.ts +40 -0
- package/views/dist/field-row/field-row-button.js +18 -0
- package/views/dist/field-row/field-row-checkbox.d.ts +9 -0
- package/views/dist/field-row/field-row-checkbox.js +7 -0
- package/views/dist/field-row/index.d.ts +5 -0
- package/views/dist/field-row/index.js +5 -0
- package/views/dist/field-row/row-target.d.ts +20 -0
- package/views/dist/field-row/row-target.js +3 -0
- package/views/dist/field-row/useFieldWrite.d.ts +45 -0
- package/views/dist/field-row/useFieldWrite.js +233 -0
- package/views/dist/field-row/useRowSettlement.d.ts +33 -0
- package/views/dist/field-row/useRowSettlement.js +23 -0
- package/views/dist/fields/binding.d.ts +96 -0
- package/views/dist/fields/binding.js +128 -0
- package/views/dist/fields/currency.d.ts +82 -0
- package/views/dist/fields/currency.js +41 -0
- package/views/dist/fields/denomination.d.ts +42 -0
- package/views/dist/fields/denomination.js +11 -0
- package/views/dist/fields/edit-core-types.d.ts +40 -0
- package/views/dist/fields/edit-core-types.js +29 -0
- package/views/dist/fields/format-knobs.d.ts +34 -0
- package/views/dist/fields/format-knobs.js +36 -0
- package/views/dist/fields/menus.d.ts +30 -0
- package/views/dist/fields/menus.js +1 -0
- package/views/dist/fields/money.d.ts +65 -0
- package/views/dist/fields/money.js +88 -0
- package/views/dist/fields/number-edit.d.ts +17 -0
- package/views/dist/fields/number-edit.js +21 -0
- package/views/dist/fields/option-add.d.ts +25 -0
- package/views/dist/fields/option-add.js +9 -0
- package/views/dist/fields/prepare-write.d.ts +55 -0
- package/views/dist/fields/prepare-write.js +72 -0
- package/views/dist/fields/range-unit.d.ts +7 -0
- package/views/dist/fields/range-unit.js +13 -0
- package/views/dist/fields/relation-source-types.d.ts +66 -0
- package/views/dist/fields/relation-source-types.js +1 -0
- package/views/dist/fields/write-target.d.ts +56 -0
- package/views/dist/fields/write-target.js +10 -0
- package/views/dist/figures.d.ts +9 -0
- package/views/dist/figures.js +1 -0
- package/views/dist/filters/date-filter.d.ts +2 -0
- package/views/dist/filters/date-filter.js +1 -0
- package/views/dist/filters/filter-model.d.ts +181 -0
- package/views/dist/filters/filter-model.js +41 -0
- package/views/dist/filters/filter-tree.d.ts +146 -0
- package/views/dist/filters/filter-tree.js +256 -0
- package/views/dist/filters/number-filter.d.ts +2 -0
- package/views/dist/filters/number-filter.js +1 -0
- package/views/dist/filters/range-filter.d.ts +2 -0
- package/views/dist/filters/range-filter.js +1 -0
- package/views/dist/filters/registry.d.ts +103 -0
- package/views/dist/filters/registry.js +8 -0
- package/views/dist/filters/relation-filter.d.ts +16 -0
- package/views/dist/filters/relation-filter.js +63 -0
- package/views/dist/filters/text-filter.d.ts +2 -0
- package/views/dist/filters/text-filter.js +1 -0
- package/views/dist/grid/chrome/GridAddColumn.d.ts +23 -0
- package/views/dist/grid/chrome/GridAddColumn.js +106 -0
- package/views/dist/grid/chrome/GridAggregateMenu.d.ts +36 -0
- package/views/dist/grid/chrome/GridAggregateMenu.js +60 -0
- package/views/dist/grid/chrome/GridCellEditors.d.ts +81 -0
- package/views/dist/grid/chrome/GridCellEditors.js +156 -0
- package/views/dist/grid/chrome/GridCellOutline.d.ts +53 -0
- package/views/dist/grid/chrome/GridCellOutline.js +36 -0
- package/views/dist/grid/chrome/GridChipsEditor.d.ts +40 -0
- package/views/dist/grid/chrome/GridChipsEditor.js +39 -0
- package/views/dist/grid/chrome/GridColumnColorSection.d.ts +13 -0
- package/views/dist/grid/chrome/GridColumnColorSection.js +40 -0
- package/views/dist/grid/chrome/GridColumnDateSection.d.ts +27 -0
- package/views/dist/grid/chrome/GridColumnDateSection.js +23 -0
- package/views/dist/grid/chrome/GridColumnDurationSection.d.ts +23 -0
- package/views/dist/grid/chrome/GridColumnDurationSection.js +24 -0
- package/views/dist/grid/chrome/GridColumnMenu.d.ts +113 -0
- package/views/dist/grid/chrome/GridColumnMenu.js +149 -0
- package/views/dist/grid/chrome/GridColumnNumberSection.d.ts +29 -0
- package/views/dist/grid/chrome/GridColumnNumberSection.js +27 -0
- package/views/dist/grid/chrome/GridColumnPercentSection.d.ts +16 -0
- package/views/dist/grid/chrome/GridColumnPercentSection.js +16 -0
- package/views/dist/grid/chrome/GridColumnSortSection.d.ts +38 -0
- package/views/dist/grid/chrome/GridColumnSortSection.js +33 -0
- package/views/dist/grid/chrome/GridDateEditor.d.ts +41 -0
- package/views/dist/grid/chrome/GridDateEditor.js +26 -0
- package/views/dist/grid/chrome/GridFlyout.d.ts +44 -0
- package/views/dist/grid/chrome/GridFlyout.js +80 -0
- package/views/dist/grid/chrome/GridFooter.d.ts +40 -0
- package/views/dist/grid/chrome/GridFooter.js +55 -0
- package/views/dist/grid/chrome/GridGroupMenu.d.ts +47 -0
- package/views/dist/grid/chrome/GridGroupMenu.js +101 -0
- package/views/dist/grid/chrome/GridHeader.d.ts +83 -0
- package/views/dist/grid/chrome/GridHeader.js +58 -0
- package/views/dist/grid/chrome/GridLongTextEditor.d.ts +55 -0
- package/views/dist/grid/chrome/GridLongTextEditor.js +73 -0
- package/views/dist/grid/chrome/GridMenuRow.d.ts +15 -0
- package/views/dist/grid/chrome/GridMenuRow.js +15 -0
- package/views/dist/grid/chrome/GridNameEditor.d.ts +24 -0
- package/views/dist/grid/chrome/GridNameEditor.js +25 -0
- package/views/dist/grid/chrome/GridNumberEditor.d.ts +56 -0
- package/views/dist/grid/chrome/GridNumberEditor.js +42 -0
- package/views/dist/grid/chrome/GridPager.d.ts +7 -0
- package/views/dist/grid/chrome/GridPager.js +34 -0
- package/views/dist/grid/chrome/GridPlaceEditor.d.ts +29 -0
- package/views/dist/grid/chrome/GridPlaceEditor.js +26 -0
- package/views/dist/grid/chrome/GridRangeEditor.d.ts +35 -0
- package/views/dist/grid/chrome/GridRangeEditor.js +32 -0
- package/views/dist/grid/chrome/GridRelationEditor.d.ts +47 -0
- package/views/dist/grid/chrome/GridRelationEditor.js +99 -0
- package/views/dist/grid/chrome/GridResizeHandle.d.ts +19 -0
- package/views/dist/grid/chrome/GridResizeHandle.js +19 -0
- package/views/dist/grid/chrome/GridRow.d.ts +32 -0
- package/views/dist/grid/chrome/GridRow.js +171 -0
- package/views/dist/grid/chrome/GridRowActions.d.ts +37 -0
- package/views/dist/grid/chrome/GridRowActions.js +36 -0
- package/views/dist/grid/chrome/GridRowCells.d.ts +4 -0
- package/views/dist/grid/chrome/GridRowCells.js +157 -0
- package/views/dist/grid/chrome/GridRowGlyph.d.ts +14 -0
- package/views/dist/grid/chrome/GridRowGlyph.js +18 -0
- package/views/dist/grid/chrome/GridSelectEditor.d.ts +35 -0
- package/views/dist/grid/chrome/GridSelectEditor.js +58 -0
- package/views/dist/grid/chrome/GridStructure.d.ts +64 -0
- package/views/dist/grid/chrome/GridStructure.js +87 -0
- package/views/dist/grid/chrome/GridTable.d.ts +4 -0
- package/views/dist/grid/chrome/GridTable.js +394 -0
- package/views/dist/grid/chrome/GridTableSurface.d.ts +80 -0
- package/views/dist/grid/chrome/GridTableSurface.js +39 -0
- package/views/dist/grid/chrome/GridTextEditor.d.ts +49 -0
- package/views/dist/grid/chrome/GridTextEditor.js +51 -0
- package/views/dist/grid/chrome/GridValueListEditor.d.ts +38 -0
- package/views/dist/grid/chrome/GridValueListEditor.js +29 -0
- package/views/dist/grid/chrome/StuckMarker.d.ts +26 -0
- package/views/dist/grid/chrome/StuckMarker.js +44 -0
- package/views/dist/grid/chrome/cell-clipboard.d.ts +10 -0
- package/views/dist/grid/chrome/cell-clipboard.js +28 -0
- package/views/dist/grid/chrome/cell-cut-off.d.ts +11 -0
- package/views/dist/grid/chrome/cell-cut-off.js +20 -0
- package/views/dist/grid/chrome/cells.d.ts +23 -0
- package/views/dist/grid/chrome/cells.js +19 -0
- package/views/dist/grid/chrome/checks.d.ts +56 -0
- package/views/dist/grid/chrome/checks.js +48 -0
- package/views/dist/grid/chrome/column-glyph.d.ts +16 -0
- package/views/dist/grid/chrome/column-glyph.js +52 -0
- package/views/dist/grid/chrome/editors.d.ts +9 -0
- package/views/dist/grid/chrome/editors.js +10 -0
- package/views/dist/grid/chrome/grid-add-column-items.d.ts +13 -0
- package/views/dist/grid/chrome/grid-add-column-items.js +47 -0
- package/views/dist/grid/chrome/grid-body-place.d.ts +4 -0
- package/views/dist/grid/chrome/grid-body-place.js +15 -0
- package/views/dist/grid/chrome/grid-button.d.ts +32 -0
- package/views/dist/grid/chrome/grid-button.js +12 -0
- package/views/dist/grid/chrome/grid-cell-classes.d.ts +96 -0
- package/views/dist/grid/chrome/grid-cell-classes.js +70 -0
- package/views/dist/grid/chrome/grid-cell-link.d.ts +13 -0
- package/views/dist/grid/chrome/grid-cell-link.js +9 -0
- package/views/dist/grid/chrome/grid-column-menu-items.d.ts +78 -0
- package/views/dist/grid/chrome/grid-column-menu-items.js +292 -0
- package/views/dist/grid/chrome/grid-columns-template.d.ts +45 -0
- package/views/dist/grid/chrome/grid-columns-template.js +18 -0
- package/views/dist/grid/chrome/grid-edit-escape.d.ts +4 -0
- package/views/dist/grid/chrome/grid-edit-escape.js +12 -0
- package/views/dist/grid/chrome/grid-edit-session.d.ts +67 -0
- package/views/dist/grid/chrome/grid-edit-session.js +141 -0
- package/views/dist/grid/chrome/grid-editor-layer.d.ts +7 -0
- package/views/dist/grid/chrome/grid-editor-layer.js +1 -0
- package/views/dist/grid/chrome/grid-figure-value.d.ts +25 -0
- package/views/dist/grid/chrome/grid-figure-value.js +40 -0
- package/views/dist/grid/chrome/grid-fitted-box.d.ts +15 -0
- package/views/dist/grid/chrome/grid-fitted-box.js +26 -0
- package/views/dist/grid/chrome/grid-group-menu-items.d.ts +38 -0
- package/views/dist/grid/chrome/grid-group-menu-items.js +92 -0
- package/views/dist/grid/chrome/grid-group-menu-parts.d.ts +31 -0
- package/views/dist/grid/chrome/grid-group-menu-parts.js +21 -0
- package/views/dist/grid/chrome/grid-hover.d.ts +74 -0
- package/views/dist/grid/chrome/grid-hover.js +150 -0
- package/views/dist/grid/chrome/grid-lab.d.ts +7 -0
- package/views/dist/grid/chrome/grid-lab.js +7 -0
- package/views/dist/grid/chrome/grid-menu-focus.d.ts +65 -0
- package/views/dist/grid/chrome/grid-menu-focus.js +160 -0
- package/views/dist/grid/chrome/grid-menu-search.d.ts +7 -0
- package/views/dist/grid/chrome/grid-menu-search.js +7 -0
- package/views/dist/grid/chrome/grid-pages.d.ts +15 -0
- package/views/dist/grid/chrome/grid-pages.js +9 -0
- package/views/dist/grid/chrome/grid-row-menu-items.d.ts +49 -0
- package/views/dist/grid/chrome/grid-row-menu-items.js +159 -0
- package/views/dist/grid/chrome/grid-row-menu-key.d.ts +15 -0
- package/views/dist/grid/chrome/grid-row-menu-key.js +36 -0
- package/views/dist/grid/chrome/grid-row-props.d.ts +155 -0
- package/views/dist/grid/chrome/grid-row-props.js +1 -0
- package/views/dist/grid/chrome/grid-row-window.d.ts +78 -0
- package/views/dist/grid/chrome/grid-row-window.js +280 -0
- package/views/dist/grid/chrome/grid-rows-menu.d.ts +42 -0
- package/views/dist/grid/chrome/grid-rows-menu.js +85 -0
- package/views/dist/grid/chrome/grid-scroll-owner.d.ts +38 -0
- package/views/dist/grid/chrome/grid-scroll-owner.js +75 -0
- package/views/dist/grid/chrome/grid-styles.d.ts +50 -0
- package/views/dist/grid/chrome/grid-styles.js +11 -0
- package/views/dist/grid/chrome/grid-table-props.d.ts +310 -0
- package/views/dist/grid/chrome/grid-table-props.js +1 -0
- package/views/dist/grid/chrome/grid-wait.d.ts +22 -0
- package/views/dist/grid/chrome/grid-wait.js +4 -0
- package/views/dist/grid/chrome/useBarRoom.d.ts +19 -0
- package/views/dist/grid/chrome/useBarRoom.js +96 -0
- package/views/dist/grid/chrome/useGridBandFigures.d.ts +26 -0
- package/views/dist/grid/chrome/useGridBandFigures.js +50 -0
- package/views/dist/grid/chrome/useGridBatchApi.d.ts +34 -0
- package/views/dist/grid/chrome/useGridBatchApi.js +36 -0
- package/views/dist/grid/chrome/useGridBoxes.d.ts +22 -0
- package/views/dist/grid/chrome/useGridBoxes.js +22 -0
- package/views/dist/grid/chrome/useGridCellPick.d.ts +30 -0
- package/views/dist/grid/chrome/useGridCellPick.js +77 -0
- package/views/dist/grid/chrome/useGridColumnLayout.d.ts +32 -0
- package/views/dist/grid/chrome/useGridColumnLayout.js +251 -0
- package/views/dist/grid/chrome/useGridFocus.d.ts +48 -0
- package/views/dist/grid/chrome/useGridFocus.js +129 -0
- package/views/dist/grid/chrome/useGridHeaderDrag.d.ts +20 -0
- package/views/dist/grid/chrome/useGridHeaderDrag.js +37 -0
- package/views/dist/grid/chrome/useGridKeyboard.d.ts +65 -0
- package/views/dist/grid/chrome/useGridKeyboard.js +463 -0
- package/views/dist/grid/chrome/useGridLongPress.d.ts +30 -0
- package/views/dist/grid/chrome/useGridLongPress.js +98 -0
- package/views/dist/grid/chrome/useGridPartColumns.d.ts +5 -0
- package/views/dist/grid/chrome/useGridPartColumns.js +9 -0
- package/views/dist/grid/chrome/useGridPendingReconciliation.d.ts +12 -0
- package/views/dist/grid/chrome/useGridPendingReconciliation.js +32 -0
- package/views/dist/grid/chrome/useGridRailReveal.d.ts +57 -0
- package/views/dist/grid/chrome/useGridRailReveal.js +67 -0
- package/views/dist/grid/chrome/useGridRangeActions.d.ts +51 -0
- package/views/dist/grid/chrome/useGridRangeActions.js +199 -0
- package/views/dist/grid/chrome/useGridRangeGestures.d.ts +33 -0
- package/views/dist/grid/chrome/useGridRangeGestures.js +241 -0
- package/views/dist/grid/chrome/useGridRecorder.d.ts +16 -0
- package/views/dist/grid/chrome/useGridRecorder.js +144 -0
- package/views/dist/grid/chrome/useGridRowOpener.d.ts +41 -0
- package/views/dist/grid/chrome/useGridRowOpener.js +83 -0
- package/views/dist/grid/chrome/useGridScaleStyles.d.ts +3 -0
- package/views/dist/grid/chrome/useGridScaleStyles.js +28 -0
- package/views/dist/grid/chrome/useGridScrollArea.d.ts +47 -0
- package/views/dist/grid/chrome/useGridScrollArea.js +120 -0
- package/views/dist/grid/chrome/useGridTableInteractionModel.d.ts +81 -0
- package/views/dist/grid/chrome/useGridTableInteractionModel.js +336 -0
- package/views/dist/grid/chrome/useGridTableSelection.d.ts +31 -0
- package/views/dist/grid/chrome/useGridTableSelection.js +55 -0
- package/views/dist/grid/chrome/useHeaderDragReorder.d.ts +21 -0
- package/views/dist/grid/chrome/useHeaderDragReorder.js +218 -0
- package/views/dist/grid/core/clipboard-model.d.ts +123 -0
- package/views/dist/grid/core/clipboard-model.js +388 -0
- package/views/dist/grid/core/column-values.d.ts +27 -0
- package/views/dist/grid/core/column-values.js +76 -0
- package/views/dist/grid/core/commit-model.d.ts +48 -0
- package/views/dist/grid/core/commit-model.js +3 -0
- package/views/dist/grid/core/coordinates.d.ts +48 -0
- package/views/dist/grid/core/coordinates.js +27 -0
- package/views/dist/grid/core/edge-scroll.d.ts +21 -0
- package/views/dist/grid/core/edge-scroll.js +23 -0
- package/views/dist/grid/core/edit-values.d.ts +9 -0
- package/views/dist/grid/core/edit-values.js +1 -0
- package/views/dist/grid/core/editing-controller.d.ts +146 -0
- package/views/dist/grid/core/editing-controller.js +563 -0
- package/views/dist/grid/core/editing-model.d.ts +113 -0
- package/views/dist/grid/core/editing-model.js +168 -0
- package/views/dist/grid/core/flat-rows.d.ts +35 -0
- package/views/dist/grid/core/flat-rows.js +20 -0
- package/views/dist/grid/core/grid-aria.d.ts +31 -0
- package/views/dist/grid/core/grid-aria.js +41 -0
- package/views/dist/grid/core/grid-focus.d.ts +60 -0
- package/views/dist/grid/core/grid-focus.js +171 -0
- package/views/dist/grid/core/grid-recorder.d.ts +111 -0
- package/views/dist/grid/core/grid-recorder.js +223 -0
- package/views/dist/grid/core/grid-scale.d.ts +14 -0
- package/views/dist/grid/core/grid-scale.js +8 -0
- package/views/dist/grid/core/nav.d.ts +94 -0
- package/views/dist/grid/core/nav.js +92 -0
- package/views/dist/grid/core/part-edits.d.ts +18 -0
- package/views/dist/grid/core/part-edits.js +48 -0
- package/views/dist/grid/core/pending-reconciliation.d.ts +53 -0
- package/views/dist/grid/core/pending-reconciliation.js +60 -0
- package/views/dist/grid/core/range-model.d.ts +25 -0
- package/views/dist/grid/core/range-model.js +59 -0
- package/views/dist/grid/core/refusal-sentence.d.ts +3 -0
- package/views/dist/grid/core/refusal-sentence.js +15 -0
- package/views/dist/grid/core/row-opened-from.d.ts +21 -0
- package/views/dist/grid/core/row-opened-from.js +11 -0
- package/views/dist/grid/core/row-window.d.ts +40 -0
- package/views/dist/grid/core/row-window.js +43 -0
- package/views/dist/grid/core/spreadsheet-operations.d.ts +101 -0
- package/views/dist/grid/core/spreadsheet-operations.js +282 -0
- package/views/dist/grid/core/useGridEditing.d.ts +72 -0
- package/views/dist/grid/core/useGridEditing.js +105 -0
- package/views/dist/grid/core/useGridRange.d.ts +22 -0
- package/views/dist/grid/core/useGridRange.js +27 -0
- package/views/dist/grid/core/value-equality.d.ts +72 -0
- package/views/dist/grid/core/value-equality.js +104 -0
- package/views/dist/grid/core/write-states.d.ts +20 -0
- package/views/dist/grid/core/write-states.js +21 -0
- package/views/dist/grid/grid-format-props.d.ts +26 -0
- package/views/dist/grid/grid-format-props.js +65 -0
- package/views/dist/grid/index.d.ts +23 -0
- package/views/dist/grid/index.js +7 -0
- package/views/dist/grid/useGridTablePrefs.d.ts +48 -0
- package/views/dist/grid/useGridTablePrefs.js +47 -0
- package/views/dist/grid/useGridTableSettings.d.ts +60 -0
- package/views/dist/grid/useGridTableSettings.js +61 -0
- package/views/dist/grid-lab.d.ts +18 -0
- package/views/dist/grid-lab.js +16 -0
- package/views/dist/grouping/sort-groups.d.ts +17 -0
- package/views/dist/grouping/sort-groups.js +33 -0
- package/views/dist/grouping/types.d.ts +10 -0
- package/views/dist/grouping/types.js +1 -0
- package/views/dist/index.d.ts +31 -0
- package/views/dist/index.js +30 -0
- package/views/dist/internal/chip.d.ts +4 -0
- package/views/dist/internal/chip.js +3 -0
- package/views/dist/internal/count.d.ts +3 -0
- package/views/dist/internal/count.js +3 -0
- package/views/dist/internal/cx.d.ts +3 -0
- package/views/dist/internal/cx.js +3 -0
- package/views/dist/internal/reset.d.ts +9 -0
- package/views/dist/internal/reset.js +1 -0
- package/views/dist/internal/use-idle-write.d.ts +1 -0
- package/views/dist/internal/use-idle-write.js +13 -0
- package/views/dist/internal/viewport.d.ts +3 -0
- package/views/dist/internal/viewport.js +15 -0
- package/views/dist/internal/zone-clock.d.ts +20 -0
- package/views/dist/internal/zone-clock.js +77 -0
- package/views/dist/model/aggregates.d.ts +61 -0
- package/views/dist/model/aggregates.js +134 -0
- package/views/dist/model/body-frame.d.ts +34 -0
- package/views/dist/model/body-frame.js +15 -0
- package/views/dist/model/card-density.d.ts +8 -0
- package/views/dist/model/card-density.js +10 -0
- package/views/dist/model/card-layout.d.ts +85 -0
- package/views/dist/model/card-layout.js +90 -0
- package/views/dist/model/column-capabilities.d.ts +193 -0
- package/views/dist/model/column-capabilities.js +280 -0
- package/views/dist/model/column-filters.d.ts +109 -0
- package/views/dist/model/column-filters.js +348 -0
- package/views/dist/model/column-format.d.ts +103 -0
- package/views/dist/model/column-format.js +1 -0
- package/views/dist/model/column-from.d.ts +28 -0
- package/views/dist/model/column-from.js +165 -0
- package/views/dist/model/column-inspect.d.ts +28 -0
- package/views/dist/model/column-inspect.js +17 -0
- package/views/dist/model/column-knobs.d.ts +20 -0
- package/views/dist/model/column-knobs.js +16 -0
- package/views/dist/model/column-mark.d.ts +13 -0
- package/views/dist/model/column-mark.js +10 -0
- package/views/dist/model/column-money.d.ts +13 -0
- package/views/dist/model/column-money.js +27 -0
- package/views/dist/model/column-order.d.ts +36 -0
- package/views/dist/model/column-order.js +68 -0
- package/views/dist/model/column-schema.d.ts +355 -0
- package/views/dist/model/column-schema.js +1 -0
- package/views/dist/model/column-sort.d.ts +28 -0
- package/views/dist/model/column-sort.js +25 -0
- package/views/dist/model/column-state.d.ts +72 -0
- package/views/dist/model/column-state.js +92 -0
- package/views/dist/model/column-types.d.ts +97 -0
- package/views/dist/model/column-types.js +50 -0
- package/views/dist/model/column-warnings.d.ts +44 -0
- package/views/dist/model/column-warnings.js +24 -0
- package/views/dist/model/density.d.ts +3 -0
- package/views/dist/model/density.js +13 -0
- package/views/dist/model/field-type-of.d.ts +21 -0
- package/views/dist/model/field-type-of.js +11 -0
- package/views/dist/model/filter-capabilities.d.ts +1 -0
- package/views/dist/model/filter-capabilities.js +1 -0
- package/views/dist/model/index.d.ts +38 -0
- package/views/dist/model/index.js +20 -0
- package/views/dist/model/one-value.d.ts +6 -0
- package/views/dist/model/one-value.js +5 -0
- package/views/dist/model/part-columns.d.ts +17 -0
- package/views/dist/model/part-columns.js +69 -0
- package/views/dist/model/part-rows.d.ts +21 -0
- package/views/dist/model/part-rows.js +35 -0
- package/views/dist/model/part-write.d.ts +11 -0
- package/views/dist/model/part-write.js +52 -0
- package/views/dist/model/place-parts.d.ts +6 -0
- package/views/dist/model/place-parts.js +14 -0
- package/views/dist/model/preferences.d.ts +131 -0
- package/views/dist/model/preferences.js +67 -0
- package/views/dist/model/prefs-buckets.d.ts +145 -0
- package/views/dist/model/prefs-buckets.js +68 -0
- package/views/dist/model/relation-filters.d.ts +64 -0
- package/views/dist/model/relation-filters.js +93 -0
- package/views/dist/model/render-count.d.ts +8 -0
- package/views/dist/model/render-count.js +35 -0
- package/views/dist/model/row-icon.d.ts +29 -0
- package/views/dist/model/row-icon.js +5 -0
- package/views/dist/model/settings-columns.d.ts +34 -0
- package/views/dist/model/settings-columns.js +146 -0
- package/views/dist/model/settings-look.d.ts +17 -0
- package/views/dist/model/settings-look.js +23 -0
- package/views/dist/model/view-rules.d.ts +92 -0
- package/views/dist/model/view-rules.js +300 -0
- package/views/dist/panels/availability.d.ts +26 -0
- package/views/dist/panels/availability.js +28 -0
- package/views/dist/panels/customize-body.d.ts +45 -0
- package/views/dist/panels/customize-body.js +292 -0
- package/views/dist/panels/filter/DateFilterBody.d.ts +44 -0
- package/views/dist/panels/filter/DateFilterBody.js +84 -0
- package/views/dist/panels/filter/DateFilterCalendar.d.ts +19 -0
- package/views/dist/panels/filter/DateFilterCalendar.js +37 -0
- package/views/dist/panels/filter/DateFilterInput.d.ts +16 -0
- package/views/dist/panels/filter/DateFilterInput.js +36 -0
- package/views/dist/panels/filter/FilterIcon.d.ts +7 -0
- package/views/dist/panels/filter/FilterIcon.js +15 -0
- package/views/dist/panels/filter/MenuSelect.d.ts +12 -0
- package/views/dist/panels/filter/MenuSelect.js +50 -0
- package/views/dist/panels/filter/NumberFilterBody.d.ts +21 -0
- package/views/dist/panels/filter/NumberFilterBody.js +75 -0
- package/views/dist/panels/filter/RangeFilterBody.d.ts +19 -0
- package/views/dist/panels/filter/RangeFilterBody.js +78 -0
- package/views/dist/panels/filter/RelationFilterBody.d.ts +17 -0
- package/views/dist/panels/filter/RelationFilterBody.js +20 -0
- package/views/dist/panels/filter/TextFilterBody.d.ts +31 -0
- package/views/dist/panels/filter/TextFilterBody.js +43 -0
- package/views/dist/panels/filter/TimeScopeDetail.d.ts +6 -0
- package/views/dist/panels/filter/TimeScopeDetail.js +47 -0
- package/views/dist/panels/filter/details.d.ts +21 -0
- package/views/dist/panels/filter/details.js +100 -0
- package/views/dist/panels/filter/filter-list.d.ts +23 -0
- package/views/dist/panels/filter/filter-list.js +38 -0
- package/views/dist/panels/group-sort.d.ts +24 -0
- package/views/dist/panels/group-sort.js +58 -0
- package/views/dist/panels/index.d.ts +31 -0
- package/views/dist/panels/index.js +22 -0
- package/views/dist/panels/labels.d.ts +37 -0
- package/views/dist/panels/labels.js +166 -0
- package/views/dist/panels/model.d.ts +429 -0
- package/views/dist/panels/model.js +95 -0
- package/views/dist/panels/panel-button.d.ts +50 -0
- package/views/dist/panels/panel-button.js +21 -0
- package/views/dist/panels/quick/model.d.ts +102 -0
- package/views/dist/panels/quick/model.js +102 -0
- package/views/dist/panels/react/GroupBucketsList.d.ts +16 -0
- package/views/dist/panels/react/GroupBucketsList.js +44 -0
- package/views/dist/panels/react/LayoutColumnsList.d.ts +24 -0
- package/views/dist/panels/react/LayoutColumnsList.js +101 -0
- package/views/dist/panels/react/PopoverColumnDetail.d.ts +11 -0
- package/views/dist/panels/react/PopoverColumnDetail.js +24 -0
- package/views/dist/panels/react/chrome.d.ts +20 -0
- package/views/dist/panels/react/chrome.js +9 -0
- package/views/dist/panels/react/column-refusals.d.ts +7 -0
- package/views/dist/panels/react/column-refusals.js +14 -0
- package/views/dist/panels/react/customize-body.d.ts +15 -0
- package/views/dist/panels/react/customize-body.js +63 -0
- package/views/dist/panels/react/customize.d.ts +33 -0
- package/views/dist/panels/react/customize.js +113 -0
- package/views/dist/panels/react/drag-kit.d.ts +55 -0
- package/views/dist/panels/react/drag-kit.js +89 -0
- package/views/dist/panels/react/drag-load.d.ts +8 -0
- package/views/dist/panels/react/drag-load.js +24 -0
- package/views/dist/panels/react/drag.d.ts +2 -0
- package/views/dist/panels/react/drag.js +5 -0
- package/views/dist/panels/react/field-editor.d.ts +10 -0
- package/views/dist/panels/react/field-editor.js +1 -0
- package/views/dist/panels/react/filter/FilterEditor.d.ts +24 -0
- package/views/dist/panels/react/filter/FilterEditor.js +344 -0
- package/views/dist/panels/react/filter/FilterFieldList.d.ts +15 -0
- package/views/dist/panels/react/filter/FilterFieldList.js +57 -0
- package/views/dist/panels/react/filter/FilterValueBody.d.ts +5 -0
- package/views/dist/panels/react/filter/FilterValueBody.js +22 -0
- package/views/dist/panels/react/filter/PhoneFilterEditor.d.ts +22 -0
- package/views/dist/panels/react/filter/PhoneFilterEditor.js +186 -0
- package/views/dist/panels/react/filter/editor-ctx.d.ts +98 -0
- package/views/dist/panels/react/filter/editor-ctx.js +131 -0
- package/views/dist/panels/react/filter/filter-body.d.ts +19 -0
- package/views/dist/panels/react/filter/filter-body.js +72 -0
- package/views/dist/panels/react/filter/filter-part-body.d.ts +20 -0
- package/views/dist/panels/react/filter/filter-part-body.js +23 -0
- package/views/dist/panels/react/filter/rule-writes.d.ts +56 -0
- package/views/dist/panels/react/filter/rule-writes.js +152 -0
- package/views/dist/panels/react/filter-panel.d.ts +18 -0
- package/views/dist/panels/react/filter-panel.js +48 -0
- package/views/dist/panels/react/layout-detail.d.ts +4 -0
- package/views/dist/panels/react/layout-detail.js +29 -0
- package/views/dist/panels/react/order-details.d.ts +32 -0
- package/views/dist/panels/react/order-details.js +89 -0
- package/views/dist/panels/react/panel-header.d.ts +10 -0
- package/views/dist/panels/react/panel-header.js +20 -0
- package/views/dist/panels/react/panel-sheet.d.ts +23 -0
- package/views/dist/panels/react/panel-sheet.js +24 -0
- package/views/dist/panels/react/popover.d.ts +71 -0
- package/views/dist/panels/react/popover.js +47 -0
- package/views/dist/panels/react/quick/QuickFiltersPanel.d.ts +12 -0
- package/views/dist/panels/react/quick/QuickFiltersPanel.js +148 -0
- package/views/dist/panels/react/quick/QuickFiltersReminder.d.ts +13 -0
- package/views/dist/panels/react/quick/QuickFiltersReminder.js +46 -0
- package/views/dist/panels/react/root-list.d.ts +6 -0
- package/views/dist/panels/react/root-list.js +31 -0
- package/views/dist/panels/react/sort/SortEditor.d.ts +24 -0
- package/views/dist/panels/react/sort/SortEditor.js +290 -0
- package/views/dist/panels/react/sort/SortFieldList.d.ts +12 -0
- package/views/dist/panels/react/sort/SortFieldList.js +34 -0
- package/views/dist/panels/react/sort/use-sort-drag.d.ts +17 -0
- package/views/dist/panels/react/sort/use-sort-drag.js +39 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.d.ts +62 -0
- package/views/dist/panels/react/toolbar/ReadyToolbar.js +240 -0
- package/views/dist/panels/react/toolbar/Toolbar.d.ts +30 -0
- package/views/dist/panels/react/toolbar/Toolbar.js +113 -0
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.d.ts +25 -0
- package/views/dist/panels/react/toolbar/ToolbarAdvancedFilters.js +85 -0
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.d.ts +20 -0
- package/views/dist/panels/react/toolbar/ToolbarAsideFilter.js +78 -0
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.d.ts +21 -0
- package/views/dist/panels/react/toolbar/ToolbarBarFilter.js +126 -0
- package/views/dist/panels/react/toolbar/ToolbarButton.d.ts +5 -0
- package/views/dist/panels/react/toolbar/ToolbarButton.js +9 -0
- package/views/dist/panels/react/toolbar/ToolbarFilter.d.ts +28 -0
- package/views/dist/panels/react/toolbar/ToolbarFilter.js +42 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.d.ts +12 -0
- package/views/dist/panels/react/toolbar/ToolbarFilterSheet.js +30 -0
- package/views/dist/panels/react/toolbar/ToolbarFilters.d.ts +19 -0
- package/views/dist/panels/react/toolbar/ToolbarFilters.js +281 -0
- package/views/dist/panels/react/toolbar/ToolbarNew.d.ts +12 -0
- package/views/dist/panels/react/toolbar/ToolbarNew.js +31 -0
- package/views/dist/panels/react/toolbar/ToolbarOptions.d.ts +29 -0
- package/views/dist/panels/react/toolbar/ToolbarOptions.js +33 -0
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.d.ts +14 -0
- package/views/dist/panels/react/toolbar/ToolbarQuickFilters.js +16 -0
- package/views/dist/panels/react/toolbar/ToolbarSave.d.ts +8 -0
- package/views/dist/panels/react/toolbar/ToolbarSave.js +42 -0
- package/views/dist/panels/react/toolbar/ToolbarSearch.d.ts +9 -0
- package/views/dist/panels/react/toolbar/ToolbarSearch.js +84 -0
- package/views/dist/panels/react/toolbar/ToolbarSort.d.ts +14 -0
- package/views/dist/panels/react/toolbar/ToolbarSort.js +29 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.d.ts +18 -0
- package/views/dist/panels/react/toolbar/ToolbarSortPill.js +81 -0
- package/views/dist/panels/react/toolbar/ToolbarViews.d.ts +13 -0
- package/views/dist/panels/react/toolbar/ToolbarViews.js +29 -0
- package/views/dist/panels/react/toolbar/bar-writes.d.ts +31 -0
- package/views/dist/panels/react/toolbar/bar-writes.js +82 -0
- package/views/dist/panels/react/toolbar/context.d.ts +83 -0
- package/views/dist/panels/react/toolbar/context.js +74 -0
- package/views/dist/panels/react/toolbar/panel-part.d.ts +54 -0
- package/views/dist/panels/react/toolbar/panel-part.js +49 -0
- package/views/dist/panels/react/toolbar/panel-state.d.ts +9 -0
- package/views/dist/panels/react/toolbar/panel-state.js +12 -0
- package/views/dist/panels/react/toolbar/use-box-narrow.d.ts +2 -0
- package/views/dist/panels/react/toolbar/use-box-narrow.js +18 -0
- package/views/dist/panels/react/toolbar/use-give-way.d.ts +4 -0
- package/views/dist/panels/react/toolbar/use-give-way.js +110 -0
- package/views/dist/panels/react/toolbar/use-list-settings-state.d.ts +10 -0
- package/views/dist/panels/react/toolbar/use-list-settings-state.js +10 -0
- package/views/dist/panels/react/view-actions.d.ts +4 -0
- package/views/dist/panels/react/view-actions.js +47 -0
- package/views/dist/panels/react/view-footer.d.ts +20 -0
- package/views/dist/panels/react/view-footer.js +41 -0
- package/views/dist/panels/react/views-row/FoldingViewRow.d.ts +5 -0
- package/views/dist/panels/react/views-row/FoldingViewRow.js +137 -0
- package/views/dist/panels/react/views-row/HScrollRow.d.ts +7 -0
- package/views/dist/panels/react/views-row/HScrollRow.js +42 -0
- package/views/dist/panels/react/views-row/PillGroup.d.ts +30 -0
- package/views/dist/panels/react/views-row/PillGroup.js +85 -0
- package/views/dist/panels/react/views-row/ViewAxes.d.ts +9 -0
- package/views/dist/panels/react/views-row/ViewAxes.js +16 -0
- package/views/dist/panels/react/views-row/ViewCreatePill.d.ts +7 -0
- package/views/dist/panels/react/views-row/ViewCreatePill.js +28 -0
- package/views/dist/panels/react/views-row/ViewPicker.d.ts +5 -0
- package/views/dist/panels/react/views-row/ViewPicker.js +112 -0
- package/views/dist/panels/react/views-row/ViewPickerRow.d.ts +7 -0
- package/views/dist/panels/react/views-row/ViewPickerRow.js +47 -0
- package/views/dist/panels/react/views-row/ViewTabs.d.ts +31 -0
- package/views/dist/panels/react/views-row/ViewTabs.js +29 -0
- package/views/dist/panels/react/views-row/in-frame.d.ts +8 -0
- package/views/dist/panels/react/views-row/in-frame.js +9 -0
- package/views/dist/panels/react/views-row/menu-classes.d.ts +6 -0
- package/views/dist/panels/react/views-row/menu-classes.js +3 -0
- package/views/dist/panels/react/views-row/use-anchored-toggle.d.ts +19 -0
- package/views/dist/panels/react/views-row/use-anchored-toggle.js +31 -0
- package/views/dist/panels/react.d.ts +67 -0
- package/views/dist/panels/react.js +58 -0
- package/views/dist/panels/settings/axes.d.ts +28 -0
- package/views/dist/panels/settings/axes.js +71 -0
- package/views/dist/panels/settings/filter-groups.d.ts +58 -0
- package/views/dist/panels/settings/filter-groups.js +305 -0
- package/views/dist/panels/settings/filters.d.ts +20 -0
- package/views/dist/panels/settings/filters.js +128 -0
- package/views/dist/panels/settings/group-buckets.d.ts +24 -0
- package/views/dist/panels/settings/group-buckets.js +69 -0
- package/views/dist/panels/settings/input.d.ts +84 -0
- package/views/dist/panels/settings/input.js +1 -0
- package/views/dist/panels/settings/layout.d.ts +5 -0
- package/views/dist/panels/settings/layout.js +259 -0
- package/views/dist/panels/settings/order.d.ts +21 -0
- package/views/dist/panels/settings/order.js +227 -0
- package/views/dist/panels/settings/settings-panels.d.ts +21 -0
- package/views/dist/panels/settings/settings-panels.js +33 -0
- package/views/dist/panels/settings/sort-keys.d.ts +25 -0
- package/views/dist/panels/settings/sort-keys.js +74 -0
- package/views/dist/panels/settings/sorts.d.ts +33 -0
- package/views/dist/panels/settings/sorts.js +135 -0
- package/views/dist/panels/sort-body-options.d.ts +4 -0
- package/views/dist/panels/sort-body-options.js +10 -0
- package/views/dist/panels/toolbar/clear.d.ts +9 -0
- package/views/dist/panels/toolbar/clear.js +33 -0
- package/views/dist/panels/toolbar/counts.d.ts +21 -0
- package/views/dist/panels/toolbar/counts.js +29 -0
- package/views/dist/panels/toolbar/edit-view.d.ts +5 -0
- package/views/dist/panels/toolbar/edit-view.js +18 -0
- package/views/dist/panels/toolbar/filter-words.d.ts +42 -0
- package/views/dist/panels/toolbar/filter-words.js +145 -0
- package/views/dist/panels/toolbar/model.d.ts +74 -0
- package/views/dist/panels/toolbar/model.js +110 -0
- package/views/dist/panels/use-filter-opened.d.ts +8 -0
- package/views/dist/panels/use-filter-opened.js +11 -0
- package/views/dist/panels/view-state.d.ts +38 -0
- package/views/dist/panels/view-state.js +1 -0
- package/views/dist/panels/views-row/model.d.ts +141 -0
- package/views/dist/panels/views-row/model.js +24 -0
- package/views/dist/provider/ViewsProvider.d.ts +103 -0
- package/views/dist/provider/ViewsProvider.js +75 -0
- package/views/dist/provider/components.d.ts +1375 -0
- package/views/dist/provider/components.js +5 -0
- package/views/dist/provider/context.d.ts +58 -0
- package/views/dist/provider/context.js +10 -0
- package/views/dist/provider/desktop.d.ts +12 -0
- package/views/dist/provider/desktop.js +25 -0
- package/views/dist/provider/icons.d.ts +6 -0
- package/views/dist/provider/icons.js +1 -0
- package/views/dist/provider/menu-groups.d.ts +9 -0
- package/views/dist/provider/menu-groups.js +44 -0
- package/views/dist/provider/missing-slot.d.ts +10 -0
- package/views/dist/provider/missing-slot.js +15 -0
- package/views/dist/provider/plain-input.d.ts +9 -0
- package/views/dist/provider/plain-input.js +7 -0
- package/views/dist/provider/ports.d.ts +57 -0
- package/views/dist/provider/ports.js +9 -0
- package/views/dist/react.d.ts +14 -0
- package/views/dist/react.js +5 -0
- package/views/dist/selection/SelectCheckbox.d.ts +19 -0
- package/views/dist/selection/SelectCheckbox.js +11 -0
- package/views/dist/selection/SelectionBar.d.ts +18 -0
- package/views/dist/selection/SelectionBar.js +100 -0
- package/views/dist/selection/SelectionBarPhone.d.ts +3 -0
- package/views/dist/selection/SelectionBarPhone.js +14 -0
- package/views/dist/selection/bar-overflow.d.ts +12 -0
- package/views/dist/selection/bar-overflow.js +55 -0
- package/views/dist/selection/bar-parts.d.ts +17 -0
- package/views/dist/selection/bar-parts.js +19 -0
- package/views/dist/selection/bar-room.d.ts +7 -0
- package/views/dist/selection/bar-room.js +3 -0
- package/views/dist/selection/index.d.ts +9 -0
- package/views/dist/selection/index.js +7 -0
- package/views/dist/selection/model.d.ts +55 -0
- package/views/dist/selection/model.js +86 -0
- package/views/dist/selection/row-click.d.ts +35 -0
- package/views/dist/selection/row-click.js +20 -0
- package/views/dist/selection/types.d.ts +21 -0
- package/views/dist/selection/types.js +1 -0
- package/views/dist/selection/useCheckDragSelect.d.ts +61 -0
- package/views/dist/selection/useCheckDragSelect.js +166 -0
- package/views/dist/selection/useListSelection.d.ts +39 -0
- package/views/dist/selection/useListSelection.js +48 -0
- package/views/dist/selection/useListSelectionShortcuts.d.ts +7 -0
- package/views/dist/selection/useListSelectionShortcuts.js +14 -0
- package/views/dist/selection/useRestIntent.d.ts +18 -0
- package/views/dist/selection/useRestIntent.js +35 -0
- package/views/dist/selection/verbs.d.ts +41 -0
- package/views/dist/selection/verbs.js +1 -0
- package/views/docs/contract.md +1181 -0
- package/views/docs/getting-started.md +250 -0
- package/views/docs/guides/atoms.md +305 -0
- package/views/docs/guides/cells.md +302 -0
- package/views/docs/guides/columns.md +413 -0
- package/views/docs/guides/display.md +205 -0
- package/views/docs/guides/editors.md +496 -0
- package/views/docs/guides/ports.md +246 -0
- package/views/docs/guides/selection.md +284 -0
- package/views/docs/guides/the-grid.md +736 -0
- package/views/docs/guides/the-provider.md +478 -0
- package/views/docs/index.md +54 -0
- package/views/docs/install.md +74 -0
- package/views/docs/reference/cells.md +28 -0
- package/views/docs/reference/display.md +46 -0
- package/views/docs/reference/editors-chips.md +6 -0
- package/views/docs/reference/editors-date.md +8 -0
- package/views/docs/reference/editors-location.md +12 -0
- package/views/docs/reference/editors-name.md +8 -0
- package/views/docs/reference/editors-number.md +13 -0
- package/views/docs/reference/editors-open-values.md +10 -0
- package/views/docs/reference/editors-panel.md +12 -0
- package/views/docs/reference/editors-range.md +8 -0
- package/views/docs/reference/editors-relation.md +12 -0
- package/views/docs/reference/editors-select.md +9 -0
- package/views/docs/reference/editors-session.md +13 -0
- package/views/docs/reference/editors-text.md +9 -0
- package/views/docs/reference/editors-value-list.md +6 -0
- package/views/docs/reference/editors.md +5 -0
- package/views/docs/reference/field-row.md +16 -0
- package/views/docs/reference/grid.md +64 -0
- package/views/docs/reference/panels-react.md +172 -0
- package/views/docs/reference/panels.md +220 -0
- package/views/docs/reference/react.md +164 -0
- package/views/docs/reference/selection.md +41 -0
- package/views/docs/reference/views.md +638 -0
- package/views/docs/reshaping.md +19 -0
- package/views/skills/views/SKILL.md +103 -0
|
@@ -0,0 +1,705 @@
|
|
|
1
|
+
# The field map and the permission condition
|
|
2
|
+
|
|
3
|
+
A list's settings name fields, not tables or columns. The field map tells the translator where each field lives; the permission condition tells it which rows the reader may see. It writes SQL text and its values, and your app runs them.
|
|
4
|
+
|
|
5
|
+
To build the map from your field definitions and a storage declaration instead of writing it, see [a field map from your definitions](definitions.md).
|
|
6
|
+
|
|
7
|
+
## The field map
|
|
8
|
+
|
|
9
|
+
`defineFieldMap` checks the map once, and refuses with a `FieldMapError` naming the place of the first thing it can't hold. What comes back is frozen and built from copies, so nothing you do to your input afterwards changes it.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import assert from "node:assert/strict";
|
|
13
|
+
import type { FieldDef } from "viewkitjs/fields";
|
|
14
|
+
import { defineFieldMap, EVERY_ROW, FieldMapError, identifier, keysQuery, pageQuery, RefusedRequest, sql, type SqlQuery } from "viewkitjs/postgres";
|
|
15
|
+
|
|
16
|
+
const definitions: FieldDef[] = [
|
|
17
|
+
{ key: "title", label: "Title", type: "text" },
|
|
18
|
+
{ key: "total", label: "Total", type: "number" },
|
|
19
|
+
{ key: "company", label: "Company", type: "relation", relation: { kind: "company" } } as FieldDef,
|
|
20
|
+
];
|
|
21
|
+
|
|
22
|
+
const map = defineFieldMap({
|
|
23
|
+
table: "deals",
|
|
24
|
+
tables: {
|
|
25
|
+
deals: { name: "crm.deals", key: "id", softDelete: "deleted_at" },
|
|
26
|
+
companies: { name: "crm.companies", key: "id", softDelete: null },
|
|
27
|
+
},
|
|
28
|
+
relations: { company: { from: "deals", to: "companies", column: "company_id" } },
|
|
29
|
+
definitions,
|
|
30
|
+
fields: {
|
|
31
|
+
title: { value: "title", stored: "text" },
|
|
32
|
+
total: { value: (row) => sql`${row.column("net")} + ${row.column("tax")}`, stored: "numeric" },
|
|
33
|
+
company: { value: { relation: "company" }, stored: "uuid" },
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
assert.equal(map.fields.total?.type, "number");
|
|
37
|
+
|
|
38
|
+
assert.throws(
|
|
39
|
+
() => defineFieldMap({ table: "deals", tables: {}, definitions, fields: {} }),
|
|
40
|
+
(error) => error instanceof FieldMapError && error.path === "table"
|
|
41
|
+
);
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- **Tables.** Each is a table or a view, named `table` or `schema.table`, with its key column and its soft-delete column. `softDelete` is required: a column (a row with it set is never read) or `null` for a table that deletes nothing softly. Every name is used exactly as written, case included: `crm.Deals` names the table `"Deals"`, never `deals`. A table may also name its `label`: what a person reads one of its records by (a company's name), a column or your expression over its row returning text (a person's given and family names joined). A search, a sort or a group by a relation to it, the names of option counts and open values, and `valuesQuery`'s relations read it, under that table's own condition. `keyStored` says how the key is kept (`uuid`, `text`, `integer` or `bigint`); a page of the table and a read by id need it. A table other than the main one may carry its own `definitions` and `fields`, written as the map's own are: the fields a relation rule reads on its records ("any company whose tier is gold").
|
|
45
|
+
- **Fields.** Each field reads a column (`"title"`), your own expression over the row (`(row) => sql\`…\``), or, for a relation field, its relation (`{ relation: "company" }`). `stored` says the SQL type the value is kept as; it is required. A select or a status is kept as `text`, or as `uuid` when its options' keys are uuids: its rules then compare the column itself, so its statistics and indexes serve them; a key that isn't a uuid in canonical form (lowercase, hyphenated) matches no row, as text would compare it; it sorts by option order as with text keys; it is not read from a row of its own yet.
|
|
46
|
+
- **Relations.** A one relation (`column`: this table's column holds the other's key, or your expression over the row returns it, such as an id kept in a `jsonb` member), a many relation whose rows point back (`back`), or one through a link table (`through`). A relation field always reads its relation, so the record it points at is held to that table's own condition.
|
|
47
|
+
- **A relation's lead row.** A relation through a link table that names its `lead` (a boolean column of the link row, such as `is_main`, or your condition over it) reaches one record: the far record its lead row points at, a person's main company among all its companies. The lead is written inside the link's own reading, beside its pick, soft delete and condition. A sort, a group and a lookup through it join the lead row onto the record once, then its far record; a read by id probes the lead row by record, the page's keys first, then joins its far record; a rule and a search word probe the lead row by record, never through that join. A search over a lead link and another field (an `or`) is probed by record on a page, each lead row's far record by its key, so the page stops when it is full ("ana" over a name and a person's company, a million people: 363 ms → 4.4 ms); a word no record holds then reads every reachable record's lead row in turn (0.68 s → 3.4–5.0 s for a reader who sees the million). A total, capped or exact, reads the matching links once, as Postgres plans it. A record with no lead row, or one whose lead points at a record the reader may not see, has none. A second relation over the same link table, with no `lead`, reaches every link, for a rule across all of them.
|
|
48
|
+
- **A user read through its users' table.** A user field may read a relation of one record kept in a column of its row (`value: { relation: "owner" }`), to the table its users are kept in, which names a `label`. It is read as a user the builder builds is: its value is its id only while the reader may see that user, it sorts and is searched by that table's label through one join, and a read by id gives it as `{ id, label }`. It takes no `sort` or `search` of its own.
|
|
49
|
+
- **Parts, several values, sort and search.** A name, a place and a range are read from their `parts`, and a phone may be; a field of several values says how they are kept (`several`): an array column, a `jsonb` list, or rows of their own in one of the map's tables (`table`, the column holding the record's key, the column holding the value). `sort` and `search` name what a sort and a search read.
|
|
50
|
+
|
|
51
|
+
### Tables many kinds, fields or relations share
|
|
52
|
+
|
|
53
|
+
An app that lets a workspace make its own objects and fields keeps them in a few tables every object and workspace shares: one of records; one of values per value type (text, an option's id too; number; date; yes-or-no), one row per value, its value never NULL; one per type made of parts (a name, a place, a range, a phone, an amount and its code), its parts in typed columns; and one of links. The map reads them through three optional keys.
|
|
54
|
+
|
|
55
|
+
- **A kind kept in a shared table.** A table's `pick` names the columns that pick its kind's records out of it, each with the value it holds: `{ object_id: "…" }`. It is written inside the table's opening, beside its soft delete and your condition, wherever the table is read, as a far table too. An index for it leads with the pick's columns, or is partial on the pick: `searchIndexes` prints each search index on such a table with the pick as its `where`.
|
|
56
|
+
- **A field of one value kept in a row of its own** (`row`): the table (one of the map's), its column holding the record's key (`record`), the typed column holding the value (`value`), and the `pick` of the field's rows (`{ field_id: "…" }`). An empty value has no row, and a record has at most one row per field of one value: your write path keeps that, as nothing in the table can. Broken anyway, a count, a filter and a search count the record once; a page, a group, figures and the values read it once per row, and a walk still ends. A sort, a group and figures read the row LEFT JOINed onto the record, once per field. The values of given records (`valuesQuery`) bind the keys first and probe each such row by record, a `LEFT JOIN LATERAL (… OFFSET 0)` through the table's index on its record and field (the workspace first when its condition names it), so a page reads only its own records' rows however many fields it shows: a page of 51 companies with 19 fields kept in rows of a table per type, out of 100,000, reads its values in 6.7 ms warm, where a plain join of them read every row of every field first (about a second; 0.4 s from seven fields on). A rule or a search word on such a row under an `or` (a search over a name and the row) is probed by record on a page, so the page stops when it is full ("ana" over a name and a text kept in a table of values, a million people: 78–120 ms → 2.4–3.7 ms); a word no row holds then reads every reachable record's row in turn (0.37–0.39 s → 2.4–3.3 s for a reader who sees the million). A total, capped or exact, reads the matching rows once, as Postgres plans it, which a trigram index on the fold of the value column serves.
|
|
57
|
+
- **A value made of parts kept in its type's own table** (`row.parts`): a name's, a place's or a range's parts, each named as a field's own `parts` are and each a column of the row's table, `{ given: "given", family: "family" }`, with no `value`; a phone's `number` and `extension` as parts, its number as typed as `value`, or both. Every part is read through the row's one join, a rule and a search word by record, as a value of one column is. Keep a part trimmed and a blank part NULL, as fields' own values hold it: a page sorted by a part walks the part as kept, so `''` sorts first among the values and `' Paris'` before `'Amsterdam'`, where a list in memory would trim them.
|
|
58
|
+
- **An amount and its code on one row.** The amount's `row` names its table, its `value` the amount's column; the code field's `row` names the same table, record column and pick, its `value` the code's column. Each is read through its own join of the row, but a sort by the amount, which reads the code through the amount's one join.
|
|
59
|
+
- **Several values or a relation's links in a shared table.** Several values kept as rows of their own and a relation `through` a link table take a `pick` too: `{ field_id: "…" }`, `{ relation_id: "…" }`. Both ends of a relation read the same links, each with its own `from` and `to`. A field's or a link's pick never names a column its table's own pick names.
|
|
60
|
+
- **Written as they are.** A pick's values are written into the SQL, never bound, so the planner reads the statistics kept for that field and a partial index on the pick can match: text of 1 to 200 characters with no quote, backslash or control character.
|
|
61
|
+
- **Not yet.** An amount that converts, and a select or a status kept by uuid, aren't read from a row of their own.
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
const objects = defineFieldMap({
|
|
65
|
+
table: "deals",
|
|
66
|
+
tables: {
|
|
67
|
+
deals: { name: "objects.record", key: "id", softDelete: "deleted_at", keyStored: "uuid", pick: { object_id: "0b6f8c1e-7d2a-4c3b-9e5f-1a2b3c4d5e6f" } },
|
|
68
|
+
values: { name: "objects.value_number", key: "record_id", softDelete: null },
|
|
69
|
+
},
|
|
70
|
+
definitions: [{ key: "budget", label: "Budget", type: "number" }],
|
|
71
|
+
fields: {
|
|
72
|
+
budget: { row: { table: "values", record: "record_id", value: "value", pick: { field_id: "6a1f0e2b-3c4d-4e5f-8a9b-0c1d2e3f4a5b" } }, stored: "numeric" },
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
const sorted = pageQuery({
|
|
76
|
+
map: objects,
|
|
77
|
+
access: { deals: EVERY_ROW, values: (row) => sql`${row.column("workspace_id")} = ${"w1"}::uuid` },
|
|
78
|
+
sorts: [{ fieldKey: "budget", direction: "asc" }],
|
|
79
|
+
size: 50,
|
|
80
|
+
});
|
|
81
|
+
assert.ok(sorted.text.includes("UNION ALL"));
|
|
82
|
+
const probed = keysQuery({
|
|
83
|
+
map: objects,
|
|
84
|
+
access: { deals: EVERY_ROW, values: (row) => sql`${row.column("workspace_id")} = ${"w1"}::uuid` },
|
|
85
|
+
filter: { op: "and", items: [{ fieldKey: "budget", operator: "gt", value: 5 }] },
|
|
86
|
+
});
|
|
87
|
+
assert.ok(probed.text.includes("EXISTS ("));
|
|
88
|
+
|
|
89
|
+
// A name kept in the table of names: its parts are columns of that table, a rule on one probes the row by record.
|
|
90
|
+
const contacts = defineFieldMap({
|
|
91
|
+
table: "people",
|
|
92
|
+
tables: {
|
|
93
|
+
people: { name: "objects.record", key: "id", softDelete: "deleted_at", keyStored: "uuid", pick: { object_id: "0b6f8c1e-7d2a-4c3b-9e5f-1a2b3c4d5e6f" } },
|
|
94
|
+
names: { name: "objects.value_name", key: "record_id", softDelete: null },
|
|
95
|
+
},
|
|
96
|
+
definitions: [{ key: "contact", label: "Contact", type: "name" }],
|
|
97
|
+
fields: {
|
|
98
|
+
contact: { row: { table: "names", record: "record_id", parts: { given: "given", family: "family" }, pick: { field_id: "7b2e1f3c-4d5e-4f6a-9b0c-1d2e3f4a5b6c" } }, stored: "text" },
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
const byFamily = keysQuery({
|
|
102
|
+
map: contacts,
|
|
103
|
+
access: { people: EVERY_ROW, names: (row) => sql`${row.column("workspace_id")} = ${"w1"}::uuid` },
|
|
104
|
+
filter: { op: "and", items: [{ fieldKey: "contact", part: "family", operator: "contains", value: "pop" }] },
|
|
105
|
+
});
|
|
106
|
+
assert.ok(byFamily.text.includes(`EXISTS (SELECT 1 FROM (SELECT * FROM "objects"."value_name"`));
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## The permission condition
|
|
110
|
+
|
|
111
|
+
Every request hands in `access`: for each table of the map the query reaches, a function of that table's row returning its condition, or `EVERY_ROW` for a table whose every row the reader may read. The translator writes the condition into the table's own `FROM`, beside the soft-delete column, so no statement can name a table without it. With no condition for a table it reaches, it writes no SQL at all and throws a `RefusedRequest`.
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
const deals = defineFieldMap({
|
|
115
|
+
table: "deals",
|
|
116
|
+
tables: { deals: { name: "crm.deals", key: "id", softDelete: "deleted_at" } },
|
|
117
|
+
definitions: [{ key: "title", label: "Title", type: "text" }],
|
|
118
|
+
fields: { title: { value: "title", stored: "text" } },
|
|
119
|
+
});
|
|
120
|
+
const workspaceId = "00000000-0000-0000-0000-00000000000a";
|
|
121
|
+
|
|
122
|
+
const query = keysQuery({ map: deals, access: { deals: (row) => sql`${row.column("workspace_id")} = ${workspaceId}` } });
|
|
123
|
+
assert.equal(
|
|
124
|
+
query.text,
|
|
125
|
+
'SELECT "vk_r0"."id" AS "key" FROM (SELECT * FROM "crm"."deals" AS "vk_r0" WHERE "vk_r0"."deleted_at" IS NULL AND ("vk_r0"."workspace_id" = $1)) AS "vk_r0"'
|
|
126
|
+
);
|
|
127
|
+
assert.deepEqual(query.values, [workspaceId]);
|
|
128
|
+
|
|
129
|
+
assert.equal(keysQuery({ map: deals, access: { deals: EVERY_ROW } }).values.length, 0);
|
|
130
|
+
assert.throws(
|
|
131
|
+
() => keysQuery({ map: deals, access: {} }),
|
|
132
|
+
(error) => error instanceof RefusedRequest && error.code === "no-condition"
|
|
133
|
+
);
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
A condition stands only inside an AND, never under NOT, so a condition that comes out NULL for a row reads as "not seen". Write it however your app thinks of access: a workspace, one borrowed through a parent, shared records, anything SQL can say.
|
|
137
|
+
|
|
138
|
+
A condition your app already writes for a row alias, with subqueries of its own, takes the row's `alias`: the plain name the translator opened the row under (`vk_` and a letter and a number), which reads the same quoted or bare. Quote it with `identifier` as you would any name. A subquery of your condition may alias its own table by the row's alias and a suffix (`${row.alias}_teams`): the translator's own names are `vk_`, a letter and a number, so such a name never meets one of them. Every row the translator opens names its alias; the type leaves it optional only so a row your own code builds needs none.
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
const reach = (alias: string) => sql`${identifier(alias, "workspace_id")} = ${workspaceId}`;
|
|
142
|
+
// A row with no alias (one your own code built) would name "", which identifier refuses.
|
|
143
|
+
const byAlias = keysQuery({ map: deals, access: { deals: (row) => reach(row.alias ?? "") } });
|
|
144
|
+
assert.equal(byAlias.text, query.text);
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## What the translator trusts
|
|
148
|
+
|
|
149
|
+
An expression in the map is your own SQL. The translator writes it as you wrote it, so build it only with `sql`, from your own code, never from text a person typed. An expression that reads another table answers for access itself: the translator holds the tables it reaches to their conditions, not the tables your SQL reaches. A permission condition is your own SQL in the same way: it is written inside parentheses, so write it whole, since one with an unbalanced parenthesis could reach past them; and never end one with a `--` comment, which would swallow the rest of the statement.
|
|
150
|
+
|
|
151
|
+
Postgres may read an expression on a row your condition then hides: it pulls each table the translator opens up into the query, and orders the checks as it likes. So an expression in the map (a value, a part, a sort, a search, a label, a one relation's key) must never raise on any row its table holds: guard a cast (`CASE WHEN … ~ '^[0-9]+$' THEN …::integer END`, or `pg_input_is_valid` from Postgres 16), and never divide by a column. A label returns text. A one relation's key reads only the row it is given and returns the far table's key in its own type; a value that is no record's key reads as no record.
|
|
152
|
+
|
|
153
|
+
A relation's lead row is one per record: your write path keeps that, as it keeps a value kept in a row of its own to one row (a trigger, or a unique index on the record's column where the lead is marked). Broken anyway, a page sorted by that relation shows the record once per lead row, and a read by id of that field gives it once per lead row; a count, a filter and a search count it once, since they probe the lead rows by record; a group puts it under its first lead row's record. Rows of their own named `oneMain` hold at most one main row per record, in the same way (a unique index on the record's column where main is marked): broken, a page sorted by that field shows the record once per main row, while a count, a filter and a search count it once.
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
const contactsMap = defineFieldMap({
|
|
157
|
+
table: "people",
|
|
158
|
+
tables: {
|
|
159
|
+
people: { name: "contacts.person", key: "id", softDelete: "deleted_at", keyStored: "uuid" },
|
|
160
|
+
members: { name: "platform.member", key: "user_id", softDelete: null, label: "name" },
|
|
161
|
+
companies: { name: "contacts.company", key: "id", softDelete: "deleted_at", label: "name" },
|
|
162
|
+
companyLinks: { name: "contacts.person_company", key: "id", softDelete: null },
|
|
163
|
+
},
|
|
164
|
+
relations: {
|
|
165
|
+
owner: { from: "people", to: "members", column: "owner_id" },
|
|
166
|
+
// The main company: the link row marked is_main. A second relation over the same links, with no lead, reaches all.
|
|
167
|
+
company: { from: "people", to: "companies", through: { table: "companyLinks", from: "person_id", to: "company_id", lead: "is_main" } },
|
|
168
|
+
},
|
|
169
|
+
definitions: [
|
|
170
|
+
{ key: "owner", label: "Owner", type: "user" },
|
|
171
|
+
{ key: "company", label: "Company", type: "relation", relation: { kind: "company" } } as FieldDef,
|
|
172
|
+
],
|
|
173
|
+
fields: { owner: { value: { relation: "owner" }, stored: "uuid" }, company: { value: { relation: "company" }, stored: "uuid" } },
|
|
174
|
+
});
|
|
175
|
+
const contactsAccess = { people: EVERY_ROW, members: EVERY_ROW, companies: EVERY_ROW, companyLinks: EVERY_ROW } as const;
|
|
176
|
+
// Sorted by the main company: the lead row joined once, then its company, never a subquery per row.
|
|
177
|
+
const byCompany = pageQuery({ map: contactsMap, access: contactsAccess, sorts: [{ fieldKey: "company", direction: "asc" }], size: 50 });
|
|
178
|
+
assert.ok(byCompany.text.includes(`LEFT JOIN (SELECT * FROM "contacts"."person_company"`) && !byCompany.text.includes("ARRAY("));
|
|
179
|
+
// A rule probes the lead row by record.
|
|
180
|
+
const noCompany = keysQuery({ map: contactsMap, access: contactsAccess, filter: { op: "and", items: [{ fieldKey: "company", operator: "is_empty", value: null }] } });
|
|
181
|
+
assert.ok(noCompany.text.includes("EXISTS (") && !noCompany.text.includes("LEFT JOIN"));
|
|
182
|
+
// Sorted by owner: the users' table joined once, sorted by its label.
|
|
183
|
+
const byOwner = pageQuery({ map: contactsMap, access: contactsAccess, sorts: [{ fieldKey: "owner", direction: "asc" }], size: 50 });
|
|
184
|
+
assert.ok(byOwner.text.includes(`LEFT JOIN (SELECT * FROM "platform"."member"`));
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
```ts
|
|
188
|
+
const worked = defineFieldMap({
|
|
189
|
+
table: "runs",
|
|
190
|
+
tables: {
|
|
191
|
+
runs: { name: "app.runs", key: "id", softDelete: null },
|
|
192
|
+
clients: {
|
|
193
|
+
name: "crm.clients",
|
|
194
|
+
key: "id",
|
|
195
|
+
softDelete: "deleted_at",
|
|
196
|
+
label: (row) => sql`NULLIF(concat_ws(' ', ${row.column("given")}, ${row.column("family")}), '')`,
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
relations: {
|
|
200
|
+
client: {
|
|
201
|
+
from: "runs",
|
|
202
|
+
to: "clients",
|
|
203
|
+
// The id is kept in a json member: read as a uuid only when it is one, so no row can make it raise.
|
|
204
|
+
column: (row) =>
|
|
205
|
+
sql`(CASE WHEN (${row.column("refs")} ->> 'client_id') ~* ${"^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"}::text THEN (${row.column("refs")} ->> 'client_id')::uuid END)`,
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
definitions: [{ key: "client", label: "Client", type: "relation", relation: { kind: "client" } } as FieldDef],
|
|
209
|
+
fields: { client: { value: { relation: "client" }, stored: "uuid" } },
|
|
210
|
+
});
|
|
211
|
+
const byClient = keysQuery({ map: worked, access: { runs: EVERY_ROW, clients: EVERY_ROW }, search: { text: "ana", fields: ["client"] } });
|
|
212
|
+
assert.ok(byClient.text.includes(`concat_ws(' ', "vk_f1"."given", "vk_f1"."family")`));
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Every value goes as a numbered parameter, never into the text, and every name the map gives is quoted. The translator's own aliases are `vk_` followed by a letter and a number; never alias a table `vk_…` in your own SQL, but for a name built from a row's `alias` and a suffix of your own (`${row.alias}_teams`), which can't be one of them.
|
|
216
|
+
|
|
217
|
+
## Running the SQL
|
|
218
|
+
|
|
219
|
+
The package runs nothing: `text` and `values` go to whatever reaches your database, a `pg` pool or Prisma's raw query among them.
|
|
220
|
+
|
|
221
|
+
```ts
|
|
222
|
+
type Pool = { query(text: string, values: unknown[]): Promise<{ rows: unknown[] }> };
|
|
223
|
+
async function readWithPool(pool: Pool, sent: SqlQuery): Promise<unknown[]> {
|
|
224
|
+
const { rows } = await pool.query(sent.text, [...sent.values]);
|
|
225
|
+
return rows;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
type Prisma = { $queryRawUnsafe(text: string, ...values: unknown[]): Promise<unknown[]> };
|
|
229
|
+
async function readWithPrisma(prisma: Prisma, sent: SqlQuery): Promise<unknown[]> {
|
|
230
|
+
return prisma.$queryRawUnsafe(sent.text, ...sent.values);
|
|
231
|
+
}
|
|
232
|
+
void [readWithPool, readWithPrisma];
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Filtering
|
|
236
|
+
|
|
237
|
+
`keysQuery` takes a list's filter tree, the same one `matchesTree` reads, and keeps exactly the rows ViewKit keeps in memory. Every predicate it writes is true or false, never NULL, so a rule under `not` keeps the rows ViewKit keeps. A rule still being typed, one set aside, and a group of only those filter nothing. A date rule reads the request's `context`: the reader's time zone, and the moment relative days count from; a phone reads its `region`. The context's `currencies` name, per field whose definition converts, the currency it is read in: a field it names is filtered, sorted, added up and paged by its value alone, and a page's cursor is bound to it. It is what the builder's converted amounts read (`viewkitjs/postgres/definitions`). An expression you write yourself can't read it, so name a currency only for a field the builder converts: one you map by hand would be sorted by its raw amounts alone.
|
|
238
|
+
|
|
239
|
+
```ts
|
|
240
|
+
const filtered = keysQuery({
|
|
241
|
+
map: deals,
|
|
242
|
+
access: { deals: EVERY_ROW },
|
|
243
|
+
filter: { op: "and", items: [{ fieldKey: "title", operator: "is_empty", value: null }] },
|
|
244
|
+
context: { timeZone: "Europe/Bucharest", now: new Date("2026-11-05T09:00:00.000Z") },
|
|
245
|
+
});
|
|
246
|
+
assert.ok(filtered.text.endsWith(`WHERE ((btrim(COALESCE(("vk_r0"."title"), ''), $1::text) = ''))`));
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
It answers text, numbers, dates, options, yes-or-no, and the shapes below. A number's equals is read at the field's decimals; a day is bounded by the instants it starts and ends in the reader's zone. Text folds accents and case as ViewKit does, which needs a UTF8 database with the ICU collation `und-x-icu`, on Postgres 14 or later (a `numeric` may hold `Infinity` there, and a rule reads it as empty). A predicate converts a row's value only where that can't fail, and never divides, so none can fail on a row your condition hides. A `numeric` or a `bigint` is compared as the double ViewKit reads (beyond a double's range it reads as empty, so close to zero as 0), so a number rule on one doesn't use the column's index, and an expression mapped to one is written out a few times inside that comparison.
|
|
250
|
+
|
|
251
|
+
A rule on a field kept in a row of its own probes that row by record, inside an `EXISTS` on the table of values under its own condition and pick, so a filter never reads the field's join; a rule that holds on an empty value also keeps a record with no row. A number compares its value `+ 0`, and a range its ends, so a range rule goes by record and never through the value's own index, as the storage test measured; a date's or an instant's rule reads its value through the guard that reads an endless day as none, which no value index serves either. A value made of parts is probed the same way, its rule reading the row's part columns. A search word reaches a text, a select, a status or a phone kept that way the same way.
|
|
252
|
+
|
|
253
|
+
**Your condition names the workspace as a value.** Each table's condition is written inside that table's own reading, so a table of values shared by every workspace takes one too: bind the workspace, ``sql`${row.column("workspace_id")} = ${workspaceId}::uuid` ``, never the record's column. In a total, under an `or`, Postgres may read a rule's rows once for the whole list (a hashed subquery) instead of probing each record; with the workspace as a value it still leads the value index with it (1,245 ms against 13 ms, in the storage test), and without it the subquery reads every workspace's rows of the field.
|
|
254
|
+
|
|
255
|
+
### Values of more than one shape
|
|
256
|
+
|
|
257
|
+
A rule reads each field the way ViewKit reads the value your map makes of it:
|
|
258
|
+
|
|
259
|
+
- **Several values.** A list matches when some value does, `is not` and `does not contain` when every value does, and `is empty` asks about the list itself; empty and blank values don't count. A `jsonb` column holding a single value, not a list, reads as a list of that one value, and JSON null or `""` as none; inside a list an item `{ value, label, main }` reads as its value. Several options (a multiselect) read every element as a key, as ViewKit does: a missing one as `"null"`, a record `{ id, label }` as its id, nothing unwrapped. Rows of their own are read under their own table's condition and soft delete, like any table the query reaches. A rule on them under an `or` (a search over a name and the emails) is probed by record in a page and in a total with a cap: the walk of the list's order reads each record's rows through an index on the rows table's record column (its workspace first, when the rows' condition names it) and stops when the page is full, as a hand-written correlated `EXISTS` does (one million people, "ana", newest first: 5.3 ms a page, where reading every matching row first took 472 ms). A word no row holds then reads every reachable record's rows in turn, as the hand-written `EXISTS` does (the same million, a word nobody holds: 6.9 s a page, against 5.0 s reading the matching rows once). An exact total, a count by option and a group read the matching rows once, as Postgres plans them: a trigram index on the fold of their value column, the expression `searchIndexes` prints for a text, serves that read. A number or a nested list inside a `jsonb` list, and a two-dimensional array, are read as Postgres writes them, which may differ from how JavaScript writes them. A sort reads one value of the list, its main one, as ViewKit picks it: an array's first value that isn't blank; a `jsonb` list's first item marked `main` that isn't blank, else its first value that isn't (a single value as itself); rows of their own, the row their `several.main` marks (a boolean column, or your condition over the row), under their table's condition and soft delete, the lowest key that isn't blank when several are marked, and none when none is or every marked one is blank. Name `oneMain: true` beside `main` when at most one row per record holds the mark, as a unique index on the record where main keeps it (`CREATE UNIQUE INDEX … ON <rows> (<record>) WHERE <main>`): a sort then reads the main rows through one join Postgres can hash, a million people by main email in about the time of the join written by hand, instead of once per record. At most one is your write path's promise; when it breaks, a page shows the record once per main row, while a count, a filter and a search count it once. A phone sorts by its number when it is in international form, else by its text as typed. Several options (a multiselect) sort by every value instead, as ViewKit does: the list's elements joined with `","` as JavaScript's `join` writes them (a missing one as nothing, a `jsonb` object as `[object Object]`), in the order they are kept, an array's and a `jsonb` list's own and rows of their own by their key, never put in order first; compared as one text, under the map's `textSort` when it names one; empty when no value isn't blank, and a single `jsonb` value, not a list, as itself.
|
|
260
|
+
- **A relation holding several records.** An options rule reads the keys of the related records the reader may see.
|
|
261
|
+
- **Parts.** A rule may name a part: a name's full, given or family name, a place's country (its code, compared exactly), region, city or postal code, a range's low or high end (a number rule). A whole name is read across its parts and as it is written; a whole range as ViewKit's range rules read it. A part your map leaves out reads as empty, which is wrong only when your app does keep that part: a mistake in the map. A link's platform is not answered yet (`not-yet`).
|
|
262
|
+
- **A phone.** Read from its `parts` (its number, and its extension when you keep one), a phone in international form is compared by its number, the query read as ViewKit reads it in the reader's `region` from the `context` (so `0722 123 456` finds `+40722123456` in Romania); any other phone, and one read as a plain `value`, is text as typed. Given both, the number wins and the plain value is read for a row with no number.
|
|
263
|
+
- **An actor** is kept as its key (`user:…`, `automation:…`, `system`); text that is no actor's key reads as no actor.
|
|
264
|
+
|
|
265
|
+
### Relation rules
|
|
266
|
+
|
|
267
|
+
A relation rule keeps a row when any, none or every of its related records match a filter of their own. The related table is read under its own condition and soft delete, and so is a link table between them: a record the reader may not see is no record, so "every" is true for a row with none the reader may see. A rule inside it reads the related table's own `fields`, and may itself follow that table's relations.
|
|
268
|
+
|
|
269
|
+
```ts
|
|
270
|
+
const withCompanies = defineFieldMap({
|
|
271
|
+
table: "deals",
|
|
272
|
+
tables: {
|
|
273
|
+
deals: { name: "crm.deals", key: "id", softDelete: "deleted_at" },
|
|
274
|
+
companies: {
|
|
275
|
+
name: "crm.companies",
|
|
276
|
+
key: "id",
|
|
277
|
+
softDelete: "deleted_at",
|
|
278
|
+
definitions: [{ key: "tier", label: "Tier", type: "select", options: [] } as FieldDef],
|
|
279
|
+
fields: { tier: { value: "tier", stored: "text" } },
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
relations: { company: { from: "deals", to: "companies", column: "company_id" } },
|
|
283
|
+
definitions: [{ key: "company", label: "Company", type: "relation", relation: { kind: "company" } } as FieldDef],
|
|
284
|
+
fields: { company: { value: { relation: "company" }, stored: "uuid" } },
|
|
285
|
+
});
|
|
286
|
+
const gold = keysQuery({
|
|
287
|
+
map: withCompanies,
|
|
288
|
+
access: { deals: EVERY_ROW, companies: EVERY_ROW },
|
|
289
|
+
filter: {
|
|
290
|
+
op: "and",
|
|
291
|
+
items: [
|
|
292
|
+
{
|
|
293
|
+
fieldKey: "company",
|
|
294
|
+
quantifier: "any",
|
|
295
|
+
where: { op: "and", items: [{ fieldKey: "tier", operator: "is_any_of", value: ["gold"] }] },
|
|
296
|
+
},
|
|
297
|
+
],
|
|
298
|
+
},
|
|
299
|
+
});
|
|
300
|
+
assert.ok(gold.text.includes("EXISTS (SELECT 1 FROM (SELECT * FROM \"crm\".\"companies\""));
|
|
301
|
+
assert.deepEqual(gold.values, [["gold"]]);
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
A relation of several records whose definition carries its own `where` (a filter over its records' own fields) reaches only the records it keeps, in every answer that reads them: a rule across it, an options rule on it, its option counts, its groups, its open values, a far value read across it, its sort and `valuesQuery`. Its rules are held to the related table's fields as a rule's `where` is; it holds no rule across another relation (refused as `bad-rule`, as `viewkitjs/fields` refuses one), and no date or phone rule yet (`not-yet`), since a page's cursor can't see what those read. One whose definition names `within`, a related instant field, reads a rule across it over the records at or after the request's `context.since` (none given, all of them); `since` is never bound into a cursor, so a `since` you work out afresh on each request pages on. A relation of one record carrying `where` or `within` is refused when the map is defined.
|
|
305
|
+
|
|
306
|
+
```ts
|
|
307
|
+
const narrowed = defineFieldMap({
|
|
308
|
+
table: "deals",
|
|
309
|
+
tables: {
|
|
310
|
+
deals: { name: "crm.deals", key: "id", softDelete: "deleted_at" },
|
|
311
|
+
companies: {
|
|
312
|
+
name: "crm.companies",
|
|
313
|
+
key: "id",
|
|
314
|
+
softDelete: "deleted_at",
|
|
315
|
+
definitions: [{ key: "tier", label: "Tier", type: "select", options: [] } as FieldDef],
|
|
316
|
+
fields: { tier: { value: "tier", stored: "text" } },
|
|
317
|
+
},
|
|
318
|
+
links: { name: "crm.deal_partners", key: "id", softDelete: null },
|
|
319
|
+
},
|
|
320
|
+
relations: { partners: { from: "deals", to: "companies", through: { table: "links", from: "deal_id", to: "company_id" } } },
|
|
321
|
+
definitions: [
|
|
322
|
+
{
|
|
323
|
+
key: "partners",
|
|
324
|
+
label: "Gold partners",
|
|
325
|
+
type: "relation",
|
|
326
|
+
relation: { kind: "company" },
|
|
327
|
+
cardinality: "many",
|
|
328
|
+
where: { op: "and", items: [{ fieldKey: "tier", operator: "is_any_of", value: ["gold"] }] },
|
|
329
|
+
} as FieldDef,
|
|
330
|
+
],
|
|
331
|
+
fields: { partners: { value: { relation: "partners" }, stored: "uuid" } },
|
|
332
|
+
});
|
|
333
|
+
const withPartners = keysQuery({
|
|
334
|
+
map: narrowed,
|
|
335
|
+
access: { deals: EVERY_ROW, companies: EVERY_ROW, links: EVERY_ROW },
|
|
336
|
+
filter: { op: "and", items: [{ fieldKey: "partners", operator: "is_not_empty", value: null }] },
|
|
337
|
+
});
|
|
338
|
+
assert.deepEqual(withPartners.values, [["gold"]]);
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
Inside a relation rule, a rule on a field the related table doesn't define has no opinion, as ViewKit's in-memory answer drops it, where a stricter answer would stand the whole relation rule down; a field it defines but your map doesn't place is refused as `unknown-field`, and a relation rule reaching a table whose fields your map doesn't describe as `no-fields`.
|
|
342
|
+
|
|
343
|
+
### What is refused
|
|
344
|
+
|
|
345
|
+
A rule ViewKit wouldn't accept (an operator its field doesn't offer, a value of the wrong shape, a part its type doesn't have, a day that doesn't exist) is refused as `bad-rule`, at its place in the tree, and so is a date rule sent with no `context`, or a `context` whose time zone, region or moment can't be read. A rule naming a field your map doesn't hold is refused as `unknown-field`, where ViewKit in memory would have no opinion: a list's settings set such a rule aside before it reaches you.
|
|
346
|
+
|
|
347
|
+
A request is held to caps before anything reads its tree (`REQUEST_LIMITS`): 500 rules and groups in the filter it compiles, the quick-filter hold on top and the root among them; 32 levels deep, the root 1 and each group and each relation rule's `where` one deeper than the group holding it; 50 search words; and 30,000 values in any one statement, under Postgres's own 65,535. Past one, it is refused as `too-big`, its message naming the cap and the place (`filter: a filter holds at most 500 rules and groups`), never answered with a statement your database refuses or a stack that overflows. The busiest saved views we have seen hold a handful of rules three levels deep, so the caps are far above any real list. Lower any of them for a map with `limits` (`defineFieldMap({ …, limits: { depth: 3 } })` holds a request to the depth a list's settings allow); a cap above ViewKit's is refused as a `FieldMapError`.
|
|
348
|
+
|
|
349
|
+
### A quick-filter hold
|
|
350
|
+
|
|
351
|
+
A request's `hold` is what a quick filter holds on top of the view (`viewkitjs/fields`' `ListHold`, `[{ fieldKey, values }]`): a row stays when it holds any of a field's held values and passes every held field. The translator writes it on top of the filter as ordinary rules, with fields' own `withHold`, and compiles that tree, so every statement takes it: the keys, a page, the ids, the values, the total, the groups and their pages, a board's lanes, a calendar's month, the figures, an open field's values and each view's count. A held value is an option key as an option's count keys it: an option's value, a relation's, a user's or an actor's key, `"true"` or `"false"`, and `""` for no value. A held field your map doesn't define, one whose values aren't options, and a yes-or-no holding both or neither narrow nothing, as in memory. A hold `listHoldSchema` refuses (an unknown key, a field held twice, past its limits) is refused as `bad-hold`, at its place. A page's cursor is bound to the hold, so one read under another hold is refused as `bad-cursor`; with no hold, a cursor is as it was. The filter picker's counts (`optionCountsQuery`) take no hold; a quick filter's are `holdCountsQuery`'s.
|
|
352
|
+
|
|
353
|
+
## Searching
|
|
354
|
+
|
|
355
|
+
`keysQuery` takes a list's search, the same one `matchesSearch` reads, and keeps exactly the rows ViewKit keeps in memory. The text is cut into words on whitespace, each folded (accents and case ignored) and stripped of what is not a letter or a digit at its ends; a token with none is no word, and a search with no word keeps every row. A row is kept when every word appears in at least one field the search names, or when the whole trimmed text is its key, in lower case: a pasted id finds its record.
|
|
356
|
+
|
|
357
|
+
```ts
|
|
358
|
+
const searched = keysQuery({
|
|
359
|
+
map: deals,
|
|
360
|
+
access: { deals: EVERY_ROW },
|
|
361
|
+
search: { text: "Ștefan, acme", fields: ["title"] },
|
|
362
|
+
});
|
|
363
|
+
assert.equal(searched.values[0], "ștefan, acme");
|
|
364
|
+
assert.ok(searched.values.includes("%stefan%") && searched.values.includes("%acme%"));
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
A field is searched by what a person reads in it. Its `search` read, when the map gives one, is searched as text, whatever the field's type. Otherwise text, a link, a domain, an email and rich text are searched by their own `contains`; a select or a status by its options' labels, an archived option's too, and a value no option names by itself; a relation of one record by its far record's `label`, read under that table's own condition, so a record the condition hides is never found by its label (one kept on a link's lead row, the lead row probed by record); a user read through its users' table by that table's label, under its condition. Numbers, dates, yes-or-no and ranges are never searched. A relation whose far table names no `label` is refused as `no-label`. A phone is searched by its own `contains` rule: a word's separators stripped, compared with its number, or as typed when it isn't in international form. A name, a place, an actor, a user, a field of several values and a relation of several records are refused as `not-yet` unless the map gives them a `search` read, and a text holding a NUL or a lone surrogate, which Postgres can't keep, is refused as `bad-rule` at `search`. Every predicate is true or false, never NULL.
|
|
368
|
+
|
|
369
|
+
### A search over a large list
|
|
370
|
+
|
|
371
|
+
Each word of three characters or more is matched by a `LIKE` over each field's folded text, so a trigram index on that same folded text serves it; a word under three characters, which no trigram serves and whose `LIKE` would read the whole index, is matched by `strpos` over the same folded text, the same rows either way. A word of three or more made mostly of punctuation (`50%`, `a_b`) holds few trigrams: the same rows, less use of the index. The same holds for a "contains" rule. A relation's far keys are read once per word, under the far table's own condition; a word under three characters, which no trigram index serves, reads every row, and its far keys are read as a set Postgres hashes. A lead link searched beside another field, on a page, is the exception: each lead row probes its far record by key (a relation's lead row, above). A pasted id is compared as the key's own value when the table names its `keyStored`. With the right indexes, a search over a whole list reads through them instead of every row. `searchIndexes` prints each one, rendered from the same SQL the search writes, its values written as literals, so your migration's expression is exactly the one the planner matches:
|
|
372
|
+
|
|
373
|
+
```ts
|
|
374
|
+
import { searchIndexes } from "viewkitjs/postgres";
|
|
375
|
+
|
|
376
|
+
const { indexes, unserved, statistics } = searchIndexes({ map: deals, fields: ["title"] });
|
|
377
|
+
assert.deepEqual(unserved, []);
|
|
378
|
+
// indexes[0]: { table: "deals", name, fields: ["title"], method: "gin", expression, using, where? }
|
|
379
|
+
// In a migration: CREATE INDEX deals_title_folded_trgm_idx ON <name> <using> WHERE <where, when printed>;
|
|
380
|
+
// statistics[0]: { table, name, fields, expression, statisticsName, statement }; run the statement, then ANALYZE <name>.
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
- A text field, a link, a domain, an email, rich text, a field with a `search` read, and a formula with a text result read from the row alone each take a trigram index (`gin_trgm_ops`, from the `pg_trgm` extension, which must be on the migration's search path).
|
|
384
|
+
- A relation of one record takes a trigram index on the far table's folded label and a btree on the relation's column. A uuid, integer or bigint key is served by its primary key; a text key, or one the map doesn't type, by a btree on its lowercased text.
|
|
385
|
+
- A text, a link, a domain, an email or rich text kept in a row of a table of values (`row`) takes one trigram index on that table's folded value column, which serves every field the table holds, so it is printed once with all of them in its `fields`. It carries the table's own pick, never the field's: one index for every field, as the storage test measured (a search for a word nobody holds, on a million people: 5.4 s with no index, 2.6 ms through it).
|
|
386
|
+
- An index on a table many kinds share (its `pick`) is printed with the pick as its `where`, so it holds one kind's rows: on 2,200,000 records half of them people, the people's title index took 21 MB instead of 51 MB, and another kind's writes don't pay for it. Create it with the statistics printed beside it: Postgres reads no statistics from a partial index, so with the index alone a word nobody holds is estimated at thousands of rows, and a page in an index's order walks every record of the kind (657 ms, against 1.0 ms with the statistics).
|
|
387
|
+
- Each trigram index comes with its statistics in `statistics`: run each `statement` as printed, then `ANALYZE` the table (*A "contains" no index serves*, below).
|
|
388
|
+
- A field in `unserved` (a phone, a select or a status, a read through another table) reads every row, and so does any search that names one: a word's fields are ORed, and one arm no index serves makes Postgres read the whole table.
|
|
389
|
+
- A word of one or two letters reads every row: a trigram index has nothing to look it up by.
|
|
390
|
+
- The indexes serve a statement Postgres plans with its values, as it plans one sent unnamed (`pg`, Prisma's driver adapters, a transaction pooler). A prepared statement planned generically reads every row, with the same answers.
|
|
391
|
+
- A relation's column, when it is your expression, now runs on every row a search reads, so it must never raise.
|
|
392
|
+
- An index holds only immutable SQL: a `search` read or a formula that reaches a stable function (`to_char`, `unaccent`) is printed, and `CREATE INDEX` refuses it (`42P17`).
|
|
393
|
+
- Each trigram index adds cost to every insert and update on its table, so index only the fields a list searches. Built without `CONCURRENTLY` inside a migration's transaction, an index blocks writes to its table until the migration commits.
|
|
394
|
+
|
|
395
|
+
Measured on a list of about 26,000 records searched across five fields, one a formula and one a relation: with every word of three letters or more, each statement took under 50 ms through its indexes, where reading every row took 110–270 ms.
|
|
396
|
+
|
|
397
|
+
### A "contains" no index serves
|
|
398
|
+
|
|
399
|
+
Postgres keeps no statistics on the folded text a "contains" rule reads, so it guesses the share of rows a word matches, and guesses a tiny one. For a page in an index's order (newest first), it may then read every match and sort them, instead of walking the index until the page is full. Make one of two things on the field's table, from the expression `searchIndexes` prints for the field, written into your migration exactly as printed (a tool that rewrites its backslashes, such as a shell's `echo`, makes an expression Postgres no longer matches):
|
|
400
|
+
|
|
401
|
+
- **The statistics `searchIndexes` prints for it**: run its `statement` exactly as printed, `CREATE STATISTICS IF NOT EXISTS <statisticsName> ON (<expression>) FROM <table>`, then `ANALYZE <table>;`. Statistics on an expression need Postgres 14 or later. They cost nothing on writes. Their name is the table's and the field's, or the table's and its value column's on a table of values, then eight hex digits of the table and the expression, at most 63 bytes, so two expressions never share one. Two maps that print the same statement (one table of values, or one field read the same way) leave it to the first run; two fields reading one column print two names, the same statistics twice, which costs only their `ANALYZE`.
|
|
402
|
+
- **The trigram index** above, which costs every write, and also serves a rare word.
|
|
403
|
+
|
|
404
|
+
Either brings the estimate to the real share, and the planner walks the order index again. A trigram index that is partial (on a table many kinds share) gives no estimate: it always goes with the statistics. A million people, a reader who sees a tenth, "job title contains sales", newest first: 54–61 ms with neither, 4.0–4.6 ms with the statistics, 4.3–4.4 ms with the index, where a page that doesn't fold took 3.4–4.5 ms (measured on a copy of a million-record database). Like the indexes, the statistics serve a statement Postgres plans with its values.
|
|
405
|
+
|
|
406
|
+
On a table many fields share (a table of values), statistics on the expression are the whole table's, every field's text together: Postgres keeps none per field, and doesn't read a partial index's for an estimate. A word common in one field and rare in the others is then estimated by the mix. This is not measured.
|
|
407
|
+
|
|
408
|
+
## Ordering a page
|
|
409
|
+
|
|
410
|
+
`pageQuery` writes one page of keys: the rows the reader may see and the filter keeps, in the list's sorts, then the key. Its `readPage` turns the rows your driver handed back into the page's keys and `next`, the cursor the next page starts after, or `null` after the last page. The query asks for one row more than `size`, so a page knows whether another follows.
|
|
411
|
+
|
|
412
|
+
```ts
|
|
413
|
+
const list = defineFieldMap({
|
|
414
|
+
table: "deals",
|
|
415
|
+
tables: { deals: { name: "crm.deals", key: "id", softDelete: "deleted_at", keyStored: "uuid" } },
|
|
416
|
+
definitions: [
|
|
417
|
+
{ key: "title", label: "Title", type: "text" },
|
|
418
|
+
{ key: "total", label: "Total", type: "number" },
|
|
419
|
+
],
|
|
420
|
+
fields: { title: { value: "title", stored: "text" }, total: { value: "total", stored: "numeric" } },
|
|
421
|
+
});
|
|
422
|
+
const ordered = {
|
|
423
|
+
map: list,
|
|
424
|
+
access: { deals: EVERY_ROW },
|
|
425
|
+
sorts: [
|
|
426
|
+
{ fieldKey: "total", direction: "desc" },
|
|
427
|
+
{ fieldKey: "title", direction: "asc" },
|
|
428
|
+
],
|
|
429
|
+
size: 2,
|
|
430
|
+
} as const;
|
|
431
|
+
|
|
432
|
+
const firstPage = pageQuery(ordered);
|
|
433
|
+
// The page's rows are cut by its sorts and the key; the cursor's text is written over those rows only.
|
|
434
|
+
assert.ok(
|
|
435
|
+
firstPage.text.includes(
|
|
436
|
+
`ORDER BY "vk_r0"."total" DESC NULLS LAST, NULLIF("vk_r0"."title", '') ASC NULLS LAST, "vk_r0"."id" ASC LIMIT $1::bigint`
|
|
437
|
+
)
|
|
438
|
+
);
|
|
439
|
+
|
|
440
|
+
// The rows a pool hands back for it: `key`, and `vk_keys`, the sort values the cursor carries (each sort value also
|
|
441
|
+
// comes back as a column of its own, which readPage leaves alone).
|
|
442
|
+
const read = firstPage.readPage([
|
|
443
|
+
{ key: "6f1c1c3e-0000-4000-8000-000000000001", vk_keys: '["900", "Acme"]' },
|
|
444
|
+
{ key: "6f1c1c3e-0000-4000-8000-000000000002", vk_keys: '["900", "Bolt"]' },
|
|
445
|
+
{ key: "6f1c1c3e-0000-4000-8000-000000000003", vk_keys: '["120", "Zeta"]' },
|
|
446
|
+
]);
|
|
447
|
+
assert.deepEqual(read.keys, ["6f1c1c3e-0000-4000-8000-000000000001", "6f1c1c3e-0000-4000-8000-000000000002"]);
|
|
448
|
+
assert.ok(read.next !== null);
|
|
449
|
+
|
|
450
|
+
// The next page starts strictly after the last row of this one.
|
|
451
|
+
const secondPage = pageQuery({ ...ordered, after: read.next });
|
|
452
|
+
assert.ok(secondPage.values.includes("900"));
|
|
453
|
+
|
|
454
|
+
// A cursor from other settings is refused, never answered as if it fit.
|
|
455
|
+
assert.throws(
|
|
456
|
+
() => pageQuery({ ...ordered, sorts: [{ fieldKey: "total", direction: "asc" }], after: read.next }),
|
|
457
|
+
(error) => error instanceof RefusedRequest && error.code === "bad-cursor"
|
|
458
|
+
);
|
|
459
|
+
|
|
460
|
+
// A map that names how its texts sort: every text part cut and collated, written into the text.
|
|
461
|
+
const collated = defineFieldMap({
|
|
462
|
+
table: "deals",
|
|
463
|
+
tables: { deals: { name: "crm.deals", key: "id", softDelete: "deleted_at", keyStored: "uuid" } },
|
|
464
|
+
definitions: [{ key: "title", label: "Title", type: "text" }],
|
|
465
|
+
fields: { title: { value: "title", stored: "text" } },
|
|
466
|
+
textSort: { collation: "und-x-icu", length: 512 },
|
|
467
|
+
});
|
|
468
|
+
const byTitle = pageQuery({ map: collated, access: { deals: EVERY_ROW }, sorts: [{ fieldKey: "title", direction: "asc" }], size: 2 });
|
|
469
|
+
assert.ok(byTitle.text.includes(`ORDER BY left(NULLIF("vk_r0"."title", ''), 512) COLLATE "und-x-icu" ASC NULLS LAST, "vk_r0"."id" ASC`));
|
|
470
|
+
|
|
471
|
+
// Several emails kept as rows of their own sort by the row their main mark names, worked out once per row.
|
|
472
|
+
const people = defineFieldMap({
|
|
473
|
+
table: "people",
|
|
474
|
+
tables: {
|
|
475
|
+
people: { name: "crm.people", key: "id", softDelete: "deleted_at", keyStored: "uuid" },
|
|
476
|
+
emails: { name: "crm.person_emails", key: "id", softDelete: "deleted_at" },
|
|
477
|
+
},
|
|
478
|
+
definitions: [{ key: "emails", label: "Emails", type: "email", multiple: true } as FieldDef],
|
|
479
|
+
fields: { emails: { stored: "text", several: { kept: "rows", table: "emails", record: "person_id", value: "email", main: "is_main" } } },
|
|
480
|
+
});
|
|
481
|
+
const byEmail = pageQuery({ map: people, access: { people: EVERY_ROW, emails: EVERY_ROW }, sorts: [{ fieldKey: "emails", direction: "asc" }], size: 2 });
|
|
482
|
+
assert.ok(byEmail.text.includes(`AND ("vk_f2"."is_main")`));
|
|
483
|
+
assert.ok(byEmail.text.includes(`ORDER BY NULLIF("vk_f1"."value", '') ASC NULLS LAST`));
|
|
484
|
+
|
|
485
|
+
// With oneMain, at most one row per person marked main (a unique index keeps it): the main rows are joined once.
|
|
486
|
+
const peopleOneMain = defineFieldMap({
|
|
487
|
+
table: "people",
|
|
488
|
+
tables: {
|
|
489
|
+
people: { name: "crm.people", key: "id", softDelete: "deleted_at", keyStored: "uuid" },
|
|
490
|
+
emails: { name: "crm.person_emails", key: "id", softDelete: "deleted_at" },
|
|
491
|
+
},
|
|
492
|
+
definitions: [{ key: "emails", label: "Emails", type: "email", multiple: true } as FieldDef],
|
|
493
|
+
fields: { emails: { stored: "text", several: { kept: "rows", table: "emails", record: "person_id", value: "email", main: "is_main", oneMain: true } } },
|
|
494
|
+
});
|
|
495
|
+
const byOneEmail = pageQuery({ map: peopleOneMain, access: { people: EVERY_ROW, emails: EVERY_ROW }, sorts: [{ fieldKey: "emails", direction: "asc" }], size: 2 });
|
|
496
|
+
assert.ok(byOneEmail.text.includes("LEFT JOIN (SELECT") && !byOneEmail.text.includes("LATERAL"));
|
|
497
|
+
|
|
498
|
+
// A field the map marks notNull sorts by its direction alone, so one index serves newest first and oldest first.
|
|
499
|
+
const stamped = defineFieldMap({
|
|
500
|
+
table: "deals",
|
|
501
|
+
tables: { deals: { name: "crm.deals", key: "id", softDelete: "deleted_at", keyStored: "uuid" } },
|
|
502
|
+
definitions: [{ key: "created", label: "Created", type: "datetime" }],
|
|
503
|
+
fields: { created: { value: "created_at", stored: "timestamptz", notNull: true } },
|
|
504
|
+
});
|
|
505
|
+
const newestFirst = pageQuery({ map: stamped, access: { deals: EVERY_ROW }, sorts: [{ fieldKey: "created", direction: "desc" }], size: 2 });
|
|
506
|
+
assert.ok(newestFirst.text.includes(`ORDER BY "vk_r0"."created_at" DESC, "vk_r0"."id" DESC`));
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
- **A set-aside sort orders nothing.** A sort a list's settings set aside (it carries `setAside`, fields' `readListSettings`) is left out unchecked, the next one deciding, so one naming a field your map no longer holds is never refused.
|
|
510
|
+
- **Up to 3 sorts, a field once.** Each sorts by its whole value or, for a name, a place or a range, by the order of its parts it names (`by`): a name as written, by family name then given, or by given name then family; a place by its city, region, postal code or country (by its name in the request's `language`, else its `locale`); a range by its low end then its high end, or the other way. An empty value (no value, `""`, a name or a place with no part, a range with neither end) is last whichever the direction; a value without the part a sort reads (a name with no family name, sorted by it) comes after the rest and before the empties. Options sort in the order the field declares them, a status in its lifecycle's order, a value the field doesn't list after them all. A relation sorts by its records' names, read from its far table's `label` under that table's own condition: one record by its name, several by their names put in A-to-Z order and compared one by one, a value whose names run out first coming first. A relation of one record whose definition names `sortBy` sorts by that far field instead (a number, a percent, a date or an instant: a deal's stage by its position), read on its far record under that table's own condition, its own `sort` if it has one; a record the reader may not see, a deleted one or no value is empty, and the far table needs no `label`. A user sorts by the name its map's `sort` reads, or, read through its users' table, by that table's label; a relation of one record kept on a link table's lead row sorts as one kept in a column. Several emails, links, domains or phones sort by their main value (*Values of more than one shape*), a list with none empty, or by their `sort` when the map gives one; rows of their own need their `several.main` to sort. Several options sort by their values joined with `","` as one text, not in the order the field declares its options, or by their `sort` as text, `""` empty; rows of their own need no `several.main`. A lookup, a phone and an actor sort by their map's `sort` too: a lookup as the type it shows sorts a value (options in their order, text with `""` empty); a lookup of a name, a place, a range or money by its read alone, and of a relation by its read as a name; a lookup of a place with no `sort` and its `parts` by those parts, as a place sorts (every `by` a place takes, its country by name in the request's `language`, else its `locale`); a phone by its read as text, `""` empty; an actor by its read as a name, as a user does. A lookup's `sort` is your own expression: one that reads another table answers for access itself. A field's `sort` stands in for its value for every type read from one value, so a sort can read a column of its own; a name, a place and a range sort by their parts, and a relation by its far records. It must read a value of the type the field's `stored` names (text, for a user's or a relation's name), since a cursor carries it back as that type.
|
|
511
|
+
- **A field that is never empty.** A number, a percent, a date, an instant or a yes-or-no on the list's own table that the map marks `notNull` orders by its direction alone: it promises no row holds NULL there, so its empties need no place of their own. Broken anyway: the NULL rows show only on a first page that reaches them (ascending, after the last valued row; descending, first; for a later sort, within each run of the ones before it, where a later page may reach them too); load more after a valued row never reaches them, and load more after a page ending on one is refused (`bad-cursor`). Never a wrong or repeated page. A rollup or a formula you map to a column of the row takes `notNull` as your promise too; a lookup and a far table's field are refused it. A cursor written before you marked a field reads back after.
|
|
512
|
+
- **Text sorts in your database's order, or in the one your map names.** With no `textSort`, text compares as its column does, so on a `C` or libc database a page may come in another order than ViewKit's. `textSort.collation` names the one collation every text part a sort reads compares under (a text, a link, a domain, an email, an open select, a closed select's or a status's tie-break, a money field's code, a name's and a place's parts, a relation's or a user's name, a `sort` read of text), quoted whole as Postgres names it (`en_US.utf8` is one name). ViewKit's own order is its collator for the request's locale at base strength, so the collation to name is that locale's ICU one. For a locale with no ordering of its own, English among them, that is ICU root, `und-x-icu`: a page comes in ViewKit's order, but for texts ViewKit counts equal ("ana" and "Ana"), which ICU orders, and that order decides before a later part does (a name's given name after its family name, a relation's second name). A nondeterministic ICU collation at base strength counts them equal as ViewKit does, so the later part decides and the order is ViewKit's own: `CREATE COLLATION vk_base (provider = icu, locale = 'und-u-ks-level1', deterministic = false)`, then `textSort: { collation: "vk_base" }`. A locale with an ordering of its own (Romanian puts "ă" after "a", Swedish "ä" after "z") names its own: `ro-x-icu`, or `ro-u-ks-level1` the same way at base strength. One map names one collation, while ViewKit follows each request's locale, so a map read in several locales agrees with one of them. `textSort.length` reads at most that many characters of each text, so a cursor stays small; two texts alike that far come in key order. A list's groups order by name the same way, collated and cut, so a list and its groups never disagree about the alphabet. A number, a day and an instant compare as their columns. An endless day (`infinity`) sorts as the latest day, though a filter reads it as no day.
|
|
513
|
+
- **Manual order.** With `rowOrderMode: "manual"`, the rows the settings' `itemPositions` place come first, by position then key, and every other row follows by key; the sorts are left out, as `evaluateView` leaves them out. A position for a record that can't be a key of the table is left out.
|
|
514
|
+
- **A sort by a field kept in a row of its own.** A page whose first sort is a text, a link, a domain, an email, a number, a percent, an amount read as one number, a day, an instant, a yes-or-no, a select or a status kept in a row of its own, with no `sort` read, is two ranges from its first page on: the records holding a value, walked in the order the value's own index keeps (`(workspace_id, field_id, value, record_id)`), then those holding none, by key, read without the row's join. A later page seeks with a row comparison of the value and the row's record, `(value, record) > (x, y)`, when the sort is one part: the record column holds the list's key in its own type. A select with options or a status sorted alone, of up to 32 options, reads one range per option in the value index's order by record (`value = 'o1'`, then `'o2'` …), then the values no option names by their text, then the records with none: descending, the values no option names first and the options from the last. Its cursor holds the option order, so one written before the options were reordered, added or archived is refused (`bad-cursor`). One of more options, or one with a later sort, has its values range sorted by option rank over the field's rows. The values no option names are read by the gaps between the options (`value < 'o1' OR (value > 'o1' AND value < 'o2') … OR value > 'o5'`, beside `value <> ALL(…)`), so that range costs what it holds; the gaps assume the column's collation is deterministic: under a nondeterministic one (case-insensitive), a value that compares equal to an option drops out of the page. An amount sorted alone whose code is a select of up to 32 options kept on the amount's own row reads one range per code, in the option order both ways, each by amount then record on `(workspace_id, field_id, code, amount, record_id)`, then the codes no option names by their text, then the amounts with no code, then the records with none; its cursor holds the code order, as a select's does. A name, a place or a range kept in its type's own table, sorted alone by one part (a place by any part but its country, a name by its family or given name, a range by either end), reads three ranges: the values on the part's index by part then record (a name by one name, then the other as kept, then the name as written), then the records holding the value but not that part (first for an open low end ascending or an open high end descending), then the records with none. Give each walked part its index: a place's text part `(workspace_id, field_id, (left(city, 512) COLLATE <textSort's collation>), record_id)`, as a text value's; a name `(…, family, given, record_id)` and `(…, given, family, record_id)`, each text part under the same expression; a range `(workspace_id, field_id, low, high, record_id)` and `(…, high, low, record_id)`, so the records missing the part read in order too. Any other sort by such a field, a later sort, a page whose later sort or group reads the walked field (that field itself, or an amount whose currency it is), and each lane's first cards on a board read its joined value in one range.
|
|
515
|
+
- **What the app makes for its tables of values**, each in the migration that makes the table:
|
|
516
|
+
- **The probe**, on every table of values: `(workspace_id, record_id, field_id)`, led by what your condition on the table names.
|
|
517
|
+
- **The value**, on each table of one value: `(workspace_id, field_id, value, record_id)`; on an amount's, `(workspace_id, field_id, code, amount, record_id)`; on a type made of parts, `(workspace_id, field_id, <part>, record_id)` for each part a list filters or sorts by, a name's `(…, family, given, record_id)` and `(…, given, family, record_id)` and a range's `(…, low, high, record_id)` and `(…, high, low, record_id)`, so a sort by one part reads the records missing it in order too.
|
|
518
|
+
- **The text order**, for a text sort under `textSort`: `(workspace_id, field_id, (left(value, 512) COLLATE "und-x-icu"), record_id)` on the text table and on every text part a list sorts by (a place's city or region, a name's family and given name), the length and collation exactly as the map names them.
|
|
519
|
+
- **"Contains"**: a trigram GIN index on the fold of the text table's value, one for every field: the index `searchIndexes` prints for a text kept there, with its statistics.
|
|
520
|
+
- **The extended statistics**, so a rule's estimate is its own field's and its own workspace's: on text, number and date, `(workspace_id, field_id)`, `(field_id, value)` and `(workspace_id, field_id, value)`; on a yes-or-no, `(workspace_id, field_id)`; on a part a list filters by (a country's code, a currency's code), `(workspace_id, field_id, <part>)`. For example `CREATE STATISTICS value_text_wfv (mcv, ndistinct, dependencies) ON workspace_id, field_id, value FROM objects.value_text;`, then `ANALYZE objects.value_text;`.
|
|
521
|
+
- **No NULL value, and no partial index on the value.** A value is never NULL, so no value index needs `WHERE value IS NOT NULL`: such a condition hides the index from "contains", whose fold reads NULL as `''`, so the query never implies it. A condition on the table's own pick, as `searchIndexes` prints it, is one every read of the table writes, so it serves.
|
|
522
|
+
- **Keyset paging.** A page starts strictly after the last row of the page before, by every sort value and then the key, so a row added or removed elsewhere never makes a page repeat or skip one. The key turns with the last sort's direction. An index on a sort's expression and the key seeks a later page: `(total, id)` for a number, a day or an instant; `(NULLIF(title, ''), id)` for text, or, under a `textSort`, the expression it writes, its length and its collation exactly as the map names them: `((left(NULLIF(title, ''), 512) COLLATE "und-x-icu"), id)`; `(total DESC NULLS LAST, id DESC)` where the sort is descending. A field marked `notNull` is served both ways by one index, `(created_at DESC, id DESC)`: scanned forward newest first and backward oldest first, the expression exactly as the map reads it. When the first sort value can be empty and the cursor's isn't, the page reads two ranges, the rows from that value on and the rows with none, so each can seek. A first sort part that is a sort the translator reads through a join it writes (a relation of one record's name or far field, a user read through its users' table, a lookup, a rollup worked out for the whole list, a list's main value, several options' joined values, a value kept in a row of its own when its walk is off) has no index to seek, so it reads both in one pass, in the same order; a column, your own expression (a lookup's own `sort` among them), a relation of several records, a `first` or converted rollup, a formula, a converted amount and manual positions keep their two ranges.
|
|
523
|
+
- **The cursor** is opaque text: its sort values and its key, bound to the table, the filter, the search, the sorts or the positions, the zone when a rule reads a day, the names language (`language`, else `locale`) when a sort reads a country's name, and the map's `textSort` when it names one. A page read with no zone pages on under the reader's zone when no rule reads a day. One read under other settings, cut short, or holding a value that doesn't fit the type its sort is kept as is refused as `bad-cursor` before any SQL is written, so none ever makes your database fail on a cast. One edited by hand that still fits only moves where the page starts, among the rows the reader may see. A double in it is written with 17 significant digits, so it reads back exactly on any connection, whatever `extra_float_digits` says. A page that ends on a day outside the years 1 to 9999 (before Christ, or past 9999) hands back a cursor the next request refuses.
|
|
524
|
+
- **What it refuses.** A fourth sort, a field sorted twice, an order of parts the type doesn't have, a user with no `sort` that reads no users' table, a sort by country with neither `language` nor `locale`, money whose currency field doesn't keep one text value, a `rowOrderMode` other than `"fields"` or `"manual"`, item positions that aren't a list of `{ recordId, position }` and more than 5000 of them are refused as `bad-sort`. A `size` that isn't a whole number from 1 to 1000 throws a `RangeError`. A `by` other than the first on a field sorted by its `sort` alone, a `sortBy` on a relation of several records and a `sortBy` far field that isn't a number, a percent, a date or an instant are refused as `bad-sort`, a `sortBy` far field your map doesn't place as `unknown-field`, and one on a table whose fields your map doesn't describe as `no-fields`. A sort by a relation whose far table names no `label`, and no `sortBy`, is refused as `no-label`. A sort on several values kept as rows with no `several.main` and no `sort` is refused as `bad-sort`. A sort on a single phone, an actor or a related record's field (a lookup, but for a lookup of a place given its `parts`) with no `sort`, isn't answered yet and is refused by name (`not-yet`). A table with no `keyStored` is refused as `unsafe-mapping`.
|
|
525
|
+
|
|
526
|
+
## Reading the values
|
|
527
|
+
|
|
528
|
+
`valuesQuery` reads the values of the records you name by key, so you never open a table yourself to draw a page: a page's rows, a group's or a lane's cards, a calendar's month, a record opened by id. It takes a request like every other statement, with the records' keys as text (`ids`) and the keys of the fields to read (`fields`), and it is a `Step`: run it with `answer`.
|
|
529
|
+
|
|
530
|
+
```ts
|
|
531
|
+
import { answer as answered, valuesQuery } from "viewkitjs/postgres";
|
|
532
|
+
|
|
533
|
+
const cards = defineFieldMap({
|
|
534
|
+
table: "deals",
|
|
535
|
+
tables: {
|
|
536
|
+
deals: { name: "crm.deals", key: "id", softDelete: "deleted_at", keyStored: "uuid" },
|
|
537
|
+
companies: { name: "crm.companies", key: "id", softDelete: "deleted_at", label: "name" },
|
|
538
|
+
},
|
|
539
|
+
relations: { company: { from: "deals", to: "companies", column: "company_id" } },
|
|
540
|
+
definitions,
|
|
541
|
+
fields: { title: { value: "title", stored: "text" }, company: { value: { relation: "company" }, stored: "uuid" } },
|
|
542
|
+
});
|
|
543
|
+
const opened = valuesQuery({
|
|
544
|
+
map: cards,
|
|
545
|
+
access: { deals: EVERY_ROW, companies: EVERY_ROW },
|
|
546
|
+
ids: ["6f1c1c3e-0000-4000-8000-000000000001"],
|
|
547
|
+
fields: ["title", "company"],
|
|
548
|
+
});
|
|
549
|
+
assert.ok(opened.query.text.includes('FROM unnest($1::uuid[]) WITH ORDINALITY'));
|
|
550
|
+
void answered(opened, async () => [
|
|
551
|
+
{
|
|
552
|
+
key: "6f1c1c3e-0000-4000-8000-000000000001",
|
|
553
|
+
vk_values: '[["Acme", {"id": "6f1c1c3e-0000-4000-8000-0000000000c1", "label": "Acme Ltd"}]]',
|
|
554
|
+
},
|
|
555
|
+
]).then((records) =>
|
|
556
|
+
assert.deepEqual(records, [
|
|
557
|
+
{
|
|
558
|
+
key: "6f1c1c3e-0000-4000-8000-000000000001",
|
|
559
|
+
values: { title: "Acme", company: { id: "6f1c1c3e-0000-4000-8000-0000000000c1", label: "Acme Ltd" } },
|
|
560
|
+
},
|
|
561
|
+
])
|
|
562
|
+
);
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
- **Which records.** Each record the reader may see comes back once, in the order you named it. A key your condition or the soft delete hides, one that can't be a key of the table, and one named twice after its first are left out; a key is matched as the database spells it (a uuid in any case). A filter and a search in the request narrow the records further: the selected rows a view still keeps. It reads 1,000 keys a statement (`VALUES_PAGE`), one step after another, with no cap, and needs the table's `keyStored`.
|
|
566
|
+
- **Each value, as ViewKit draws it.** A column or your expression as kept; an actor by its key (text that is no actor's key reads `null`); a value read from its parts as an object of the parts your map gives, a name with all three of `full`, `given` and `family`, one your map doesn't place `null`, and `null` when ViewKit reads it as empty (a name or a place whose parts are all null or blank, a range with neither end); a phone as a filter reads it: in international form (an E.164 number, an extension of digits or none) as `{ number, extension }`, `extension` null when your map places none, otherwise as its text as typed, its number, or, when that is blank, its plain value, and `null` when it has neither; several values as a list, an empty one for none (an array column holding NULL reads as none; a `jsonb` column holding one value reads as a list of one, JSON null or `""` as none; rows of their own in their key order, read under their own condition); a relation of one record as `{ id, label }`, its far record read under its own condition, and `null` when that record is hidden or deleted; a relation of several records as a list of them, in the order its links (or its far keys) come. A label is text, `""` when the far table names none or the record has none.
|
|
567
|
+
- **What crosses the wire.** One JSON column a row, so every driver hands back the same thing: numbers and days come as Postgres writes JSON, read back as JavaScript reads JSON. An instant, kept as `timestamp` or `timestamptz`, comes as Postgres writes a `timestamptz` under UTC (`"2026-03-07T09:00:00.123456+00:00"`, the fraction's trailing zeros trimmed), whatever the connection's `TimeZone` or `DateStyle`: a timestamp without a zone holds UTC. One held as `infinity` or `-infinity`, or outside the years 1 to 9999, reads as `null`. A value kept as a double (`float8`) is written with 17 significant digits, so it reads back as the same double on any connection, whatever `extra_float_digits` it, its role or its database sets; NaN and the infinities come as the strings `"NaN"`, `"Infinity"` and `"-Infinity"`. The translator goes by the `stored` your map gives: an expression you declare `numeric` that hands back a double is written as Postgres writes it. Every value is worked out in the statement's projection, after your condition kept the row, so none is ever read on a row the reader may not see. A field your map doesn't hold is refused as `unknown-field`, and more than 10,000 fields in one request throw a `RangeError`.
|
|
568
|
+
|
|
569
|
+
## Counting and grouping
|
|
570
|
+
|
|
571
|
+
Each count is a `Step`: its `query` (SQL text and its values) and `read(rows)`, which reads the rows your database handed back as `{ answer }`, or as `{ next }` when the answer takes another query. `answer(step, run)` runs the steps one after another through your own `run`. Every count counts the rows `keysQuery` keeps, under the same permission condition, filter and search.
|
|
572
|
+
|
|
573
|
+
- **`totalQuery`** counts the rows: exact, or, with `cap`, exact up to the cap. `{ count, exact }` says which: past the cap, `count` is the cap and `exact` is false.
|
|
574
|
+
- **`optionCountsQuery(request, fieldKey)`** counts each option of a select, a status, a tag list, a user, a relation, an actor or a yes-or-no with that field's own rules left out, as ViewKit's `countOptions` does: every rule on the field the whole filter requires, so its picker shows the alternatives while every other rule still narrows. It answers `{ counts, labels }`: every option the field declares, and the empty key `""`, is listed in `counts`, at 0 when no row holds it; `labels` names a relation's record, a user or an actor by what the database read for it. A row counts once under each value its list holds and under each record a relation of several records reaches, every related table read under its own condition. No quick-filter hold narrows it.
|
|
575
|
+
- **`holdCountsQuery(request, fieldKey)`** counts each value a quick filter offers on the same fields, as ViewKit's `countHoldValues` does: under the whole filter, the field's own rules included, the search and the request's hold on the OTHER fields, never the field's own, so a value's count is the rows a press on it shows. It answers and refuses as `optionCountsQuery` does.
|
|
576
|
+
- **`groupsQuery`** splits the rows by one field, as ViewKit's `bucketRows` does: each group's `key` (`""` for rows with no value), its `count`, the `label` the database read for a relation, a user or an actor, and whether the app's placing or `hideEmpty` hides it. The empty group comes last, the groups the app placed by hand first, then by count, name, the field's own order or the app's order. A relation of one record whose definition names `sortBy` opens a group for every far record its table's condition lets the reader see, one no row points at included, at 0; in the field's own order (`lifecycle`) they are ordered by that far field, read on the far record under that condition: the direction applied, a record with no value after the rest, a tie by name, then by key. A relation with no `sortBy` is ordered by its records' names. Names are ordered as the map's sorts order text: under its `textSort`, collated and cut, else in the database's own order. A field whose type makes no groups answers one group, `"_all"`.
|
|
577
|
+
- **A set-aside group** (it carries `setAside`, fields' `readListSettings`) splits nothing: `groupsQuery` answers one group of every row, `"_all"`, as for a field that makes no groups, and its field is never checked.
|
|
578
|
+
- **`groupKeysQuery(request, key)`** is one group's keys, unordered: exactly the rows its count counted. A key the field could never hold selects no row.
|
|
579
|
+
|
|
580
|
+
```ts
|
|
581
|
+
import { answer, groupKeysQuery, groupsQuery, optionCountsQuery, totalQuery, type KeysRequest } from "viewkitjs/postgres";
|
|
582
|
+
|
|
583
|
+
const pipeline = defineFieldMap({
|
|
584
|
+
table: "deals",
|
|
585
|
+
tables: { deals: { name: "crm.deals", key: "id", softDelete: "deleted_at" } },
|
|
586
|
+
definitions: [
|
|
587
|
+
{
|
|
588
|
+
key: "stage",
|
|
589
|
+
label: "Stage",
|
|
590
|
+
type: "select",
|
|
591
|
+
options: [
|
|
592
|
+
{ value: "lead", label: "Lead" },
|
|
593
|
+
{ value: "won", label: "Won" },
|
|
594
|
+
],
|
|
595
|
+
} as FieldDef,
|
|
596
|
+
{ key: "due", label: "Due", type: "date" },
|
|
597
|
+
],
|
|
598
|
+
fields: { stage: { value: "stage", stored: "text" }, due: { value: "due", stored: "date" } },
|
|
599
|
+
});
|
|
600
|
+
const counting: KeysRequest = { map: pipeline, access: { deals: EVERY_ROW } };
|
|
601
|
+
|
|
602
|
+
const total = totalQuery({ ...counting, cap: 10000 });
|
|
603
|
+
assert.ok(total.query.text.startsWith('SELECT count(*) AS "total" FROM (SELECT 1 FROM'));
|
|
604
|
+
void answer(total, async () => [{ total: "10001" }]).then((counted) =>
|
|
605
|
+
assert.deepEqual(counted, { count: 10000, exact: false })
|
|
606
|
+
);
|
|
607
|
+
|
|
608
|
+
void answer(optionCountsQuery(counting, "stage"), async () => [{ key: "won", count: "3", label: null }]).then((counted) =>
|
|
609
|
+
assert.deepEqual(counted, { counts: { lead: 0, won: 3, "": 0 }, labels: {} })
|
|
610
|
+
);
|
|
611
|
+
|
|
612
|
+
const byStage = { ...counting, group: { fieldKey: "stage", order: { mode: "count", dir: "desc" }, buckets: [] } } as const;
|
|
613
|
+
void answer(groupsQuery(byStage), async () => [{ key: "won", count: "3", label: null }]).then((groups) =>
|
|
614
|
+
assert.deepEqual(groups, [{ key: "won", count: 3, label: null, hidden: false }])
|
|
615
|
+
);
|
|
616
|
+
assert.ok(groupKeysQuery(byStage, "won").text.endsWith(`WHERE COALESCE(("vk_r0"."stage") = $1::text, FALSE)`));
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
A date groups by day, week, month, year, or the reader's rolling windows (`relative`, `due`), in the request's `context`: its time zone and now. The database never reads a zone. The first step reads the range of the list's dates; ViewKit works out each bucket between them and the instant it starts in the zone; the second step counts each row against those bounds. A group's keys read the same bounds, so a group never holds a row its count left out. If a row's date moves outside the range between the two steps, the read throws and you ask again. The bucket holding 9999-12-31, a common "never expires", has no end, as everything after today has none; a date outside the years 1 to 9999 holds no bucket and is refused as `bad-rule`.
|
|
620
|
+
|
|
621
|
+
```ts
|
|
622
|
+
const byMonth = {
|
|
623
|
+
...counting,
|
|
624
|
+
group: { fieldKey: "due", granularity: "month", order: { mode: "name", dir: "asc" }, buckets: [] },
|
|
625
|
+
context: { timeZone: "Europe/Bucharest", now: new Date("2026-11-05T09:00:00.000Z") },
|
|
626
|
+
} as const;
|
|
627
|
+
assert.match(groupsQuery(byMonth).query.text, /^SELECT \(min\(/);
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
A value is grouped as it is kept and turned into text only once grouped, so nothing converts a value on a row your condition hides. Counting or grouping more than 1,000 distinct keys (`DISTINCT_LIMIT`), or a date group whose range spans more than 10,000 buckets (`DATE_BUCKET_LIMIT`), is refused as `too-many`, never cut off. So is a relation that names `sortBy` whose far table holds more than 1,000 records the reader may see: it opens every far record it can see, so such a relation can no longer be grouped. Its far field is checked as a sort by it is (`bad-sort`, `unknown-field`, `no-fields`). A field with no options to count is refused as `no-options`. A tag list groups each row under every tag it holds (an empty tag and no tag are one empty group); a relation of several records groups each row by its first record, the one its lowest link (or, pointing back, its lowest far key) reaches under the tables' conditions; an actor by its key, headed by the field's `sort` or `search` read, else by its kind; a place by its city, region or country (`group.by`), a country headed by its name in the request's `language`, else its `locale`; a range by the first preset whose ends hold it, else by its own ends, keyed and named by ViewKit itself in two steps, so no number is ever written by the database. Refused by name (`not-yet`): grouping a relation whose definition names its lead link (`links.primary`), grouping several values of any type but a tag list, and any other value read from its parts. A relation's group is headed by its far record's `label`, read under that table's own condition, or by its key when the table names no label.
|
|
631
|
+
|
|
632
|
+
## Figures
|
|
633
|
+
|
|
634
|
+
**`figuresQuery`** works out what a list shows under its columns, over the rows its filter and search keep, as fields' `figuresOf` does: the rows it counted, and per field in `keys`, of any type, the sum, the count of numbers present, the smallest and the largest (a number field's; null, 0, null and null for any other), and `filled`, its values present as fields' Filled counts them. An average and a filled count follow from those with fields' `figureFor`; unique and ratio are not the database's to answer.
|
|
635
|
+
|
|
636
|
+
```ts
|
|
637
|
+
import { figuresQuery } from "viewkitjs/postgres";
|
|
638
|
+
|
|
639
|
+
const ledger = defineFieldMap({
|
|
640
|
+
table: "deals",
|
|
641
|
+
tables: { deals: { name: "crm.deals", key: "id", softDelete: "deleted_at" } },
|
|
642
|
+
definitions: [{ key: "amount", label: "Amount", type: "currency", code: { fixed: "EUR" } } as FieldDef],
|
|
643
|
+
fields: { amount: { value: "amount", stored: "numeric" } },
|
|
644
|
+
});
|
|
645
|
+
const figures = figuresQuery({ map: ledger, access: { deals: EVERY_ROW }, keys: ["amount"] });
|
|
646
|
+
assert.ok(figures.query.text.startsWith('SELECT count(*) AS "rows", ARRAY[(SELECT'));
|
|
647
|
+
void answer(figures, async () => [
|
|
648
|
+
{ rows: "2", vk_sums: [String(30.5 * 2 ** -64)], vk_counts: ["2"], vk_mins: ["1.0000000000000000e+01"], vk_maxes: ["2.0500000000000000e+01"], vk_filled: ["2"] },
|
|
649
|
+
]).then((answered) => assert.deepEqual(answered.fields.amount, { sum: 30.5, count: 2, min: 10, max: 20.5, filled: 2 }));
|
|
650
|
+
```
|
|
651
|
+
|
|
652
|
+
A value reads as ViewKit reads a number: NaN, the infinities and a `numeric` beyond a double's range are no value, and a blank is never a zero. The sums, the smallest and the largest come back as text with 17 significant digits, so each reads back as the same double on any connection. A sum adds those doubles as JavaScript does, scaled down by a power of two inside the database so it can never overflow there, and the reader scales it back: a figure never raises, on a row your condition hides or on one it keeps, and a sum past a double's range reads as an infinity. Money is one number per column, read as your map reads it: an app whose rows hold several currencies converts in its field map's expression, or through the builder's money function, read in the currency the request names for it. A group's figures come in its own group query: give `groupsQuery` the fields in `figures`, and each group carries its `figures` beside its `count`, over exactly the rows it counts; a group no row fell in carries every figure empty. A figure adds the numbers of a number, a percent or a money amount (or a lookup, rollup or formula whose result is one); a figure asked of any other field answers its values present alone. Filled reads a value as fields' `figureOfValues` does: several values filled by having one, a place, a name and a phone by their text, a range with neither end set blank, anything else as it is, null and an empty text blank (a text of spaces is filled).
|
|
653
|
+
|
|
654
|
+
## The rest a list asks
|
|
655
|
+
|
|
656
|
+
Each of these counts or pages the rows `keysQuery` keeps, under the same permission condition.
|
|
657
|
+
|
|
658
|
+
- **`fieldValuesQuery(request, fieldKey)`** is an open field's values, for a filter's options when the field has no fixed list: an open select's or tag list's values, a relation's, a user's or an actor's records, each named in `labels`, the most held first, then by value in the database's order, cut at 1,000 (`FIELD_VALUES_LIMIT`). It reads the request's whole filter and search: hand in the rows you mean (a record tab's pin, say, and no view filter, so picking a value never makes the others vanish). Any other field is refused as `no-options`. A record its own table's condition hides is never offered. It also answers a far field's values, for a Where row inside a relation rule, through a path of one or two relations: `<relation>.<far field>` or `<relation>.<relation>.<far field>`, each relation a field of the table the one before reaches. They are the distinct values of the far records the kept rows reach, each relation's own `where` applied (never its `within`), named as the list's own are, every table read under its own condition, and counted by the rows that reach them. A key your map holds as written is its own field. A path it can't follow is refused as `unknown-field`, one reaching a table whose fields your map doesn't describe as `no-fields`.
|
|
659
|
+
- **`viewCountsQuery`** counts each view in one statement, each view's `filter` beside the request's own filter and search (a quick filter, a pin), at most 100 views (`VIEW_COUNTS_LIMIT`).
|
|
660
|
+
- **`idsQuery`** is every key the list keeps, in the order its pages hold them, read a page of 1,000 a step with no cap: the ids behind "select all matching", and with manual order and no filter, the order a drag splices into.
|
|
661
|
+
- **`groupPageQuery`** pages one group's rows, by keyset, under the list's sorts or its manual order: exactly the rows the group counts. Its cursor is bound to the group and its key, so a cursor of one group is refused for another.
|
|
662
|
+
- **`lanesQuery`** is a board's lanes: every lane's count, then one statement holding the first `size` cards (25, `LANE_ROWS`) of the first `fill` lanes shown (10, `LANES_FILLED`). Hand the board's field as a group (fields' `boardAxis`): a status, a select, a yes-or-no, a relation of one record or a user; a board by a relation that names `sortBy` opens a lane for each far record the reader may see, an empty one answered filled, with no cards; any other is refused as `no-layout`. A set-aside board field is no board field: replace it with `boardAxis(defaultBoardField(…), lanes)` before you ask; a `board` that still carries the mark gets one `"_all"` lane of every row. Each lane's `next` is read by `groupPageQuery` for that lane.
|
|
663
|
+
- **`calendarQuery`** is a calendar's month in the request's zone, in one statement: each day's count, the first 500 rows in date order (`CALENDAR_ROWS_LIMIT`), and every day those didn't reach topped up with its first 2 (`CALENDAR_DAY_ROWS`), so each cell draws what it holds and its "+N" is the day's real count. At most 42 days (`CALENDAR_DAYS_LIMIT`); a date or a date and time only, else `no-layout`. The zone is read only in each day's first instant, worked out in JavaScript.
|
|
664
|
+
- **A page's cursor is bound to the region** (`context.region`) when a phone rule reads it: a cursor made under one region is refused under another.
|
|
665
|
+
- **A page's cursor is bound to the currencies** it reads (`context.currencies`) when it sorts, filters or groups by a field whose definition converts: a cursor made under one is refused under another.
|
|
666
|
+
|
|
667
|
+
```ts
|
|
668
|
+
import { lanesQuery, viewCountsQuery } from "viewkitjs/postgres";
|
|
669
|
+
|
|
670
|
+
const pills = viewCountsQuery({
|
|
671
|
+
...counting,
|
|
672
|
+
views: [
|
|
673
|
+
{ id: "won", filter: { op: "and", items: [{ fieldKey: "stage", operator: "is_any_of", value: ["won"] }] } },
|
|
674
|
+
{ id: "all", filter: { op: "and", items: [] } },
|
|
675
|
+
],
|
|
676
|
+
});
|
|
677
|
+
assert.ok(pills.query.text.startsWith("SELECT array_to_json(ARRAY[count(*) FILTER (WHERE "));
|
|
678
|
+
void answer(pills, async () => [{ counts: "[3,10]" }]).then((counted) => assert.deepEqual(counted, { won: 3, all: 10 }));
|
|
679
|
+
|
|
680
|
+
const board = defineFieldMap({
|
|
681
|
+
table: "deals",
|
|
682
|
+
tables: { deals: { name: "crm.deals", key: "id", softDelete: "deleted_at", keyStored: "uuid" } },
|
|
683
|
+
definitions: pipeline.fields.stage ? [pipeline.fields.stage.def] : [],
|
|
684
|
+
fields: { stage: { value: "stage", stored: "text" } },
|
|
685
|
+
});
|
|
686
|
+
const lanes = lanesQuery({
|
|
687
|
+
map: board,
|
|
688
|
+
access: { deals: EVERY_ROW },
|
|
689
|
+
board: { fieldKey: "stage", order: { mode: "lifecycle", dir: "asc" }, buckets: [] },
|
|
690
|
+
});
|
|
691
|
+
// No lane holds a card, so the lanes are read in one step.
|
|
692
|
+
void answer(lanes, async () => [
|
|
693
|
+
{ key: "lead", count: "0", label: null },
|
|
694
|
+
{ key: "won", count: "0", label: null },
|
|
695
|
+
]).then((answered) =>
|
|
696
|
+
assert.deepEqual(
|
|
697
|
+
answered.map((lane) => [lane.key, lane.count, lane.filled]),
|
|
698
|
+
[["lead", 0, true], ["won", 0, true]]
|
|
699
|
+
)
|
|
700
|
+
);
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
## What it answers so far
|
|
704
|
+
|
|
705
|
+
The keys of the main table's rows the reader may see and the filter, the quick-filter hold and the search keep (`keysQuery`), unordered, and a page of them in the list's sorts or by hand (`pageQuery`); every one of them in order (`idsQuery`); the values of given records (`valuesQuery`); the total, exact or capped (`totalQuery`); each filter option's count and name (`optionCountsQuery`), each quick-filter value's (`holdCountsQuery`), and an open field's values, on the list's own table or across one or two relations (`fieldValuesQuery`); each other view's count (`viewCountsQuery`); each group's key, count, figures and rows by a whole value, a value of a list, a relation, an actor, a place's part, a range or a date in the reader's zone (`groupsQuery`, `groupKeysQuery`), and a group's page (`groupPageQuery`); a board's lanes (`lanesQuery`); a calendar's month (`calendarQuery`); and the figures under each column (`figuresQuery`).
|