foldkit-entity 0.14.0 → 0.16.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.
Files changed (93) hide show
  1. package/README.md +147 -5
  2. package/dist/collation.d.ts +33 -2
  3. package/dist/collation.d.ts.map +1 -0
  4. package/dist/conformance/index.d.ts +4 -4
  5. package/dist/conformance/index.d.ts.map +1 -1
  6. package/dist/conformance/index.js +5 -7
  7. package/dist/conformance/index.js.map +1 -1
  8. package/dist/conformance/operator.d.ts +1 -2
  9. package/dist/conformance/operator.d.ts.map +1 -1
  10. package/dist/conformance/operator.js +2 -6
  11. package/dist/conformance/operator.js.map +1 -1
  12. package/dist/conformance/relational.d.ts +17 -17
  13. package/dist/conformance/relational.d.ts.map +1 -1
  14. package/dist/conformance/relational.js +1 -3
  15. package/dist/conformance/relational.js.map +1 -1
  16. package/dist/conformance/variants.d.ts +47 -0
  17. package/dist/conformance/variants.d.ts.map +1 -0
  18. package/dist/conformance/variants.js +126 -0
  19. package/dist/conformance/variants.js.map +1 -0
  20. package/dist/context.d.ts +60 -2
  21. package/dist/context.d.ts.map +1 -0
  22. package/dist/descriptor.d.ts +33 -0
  23. package/dist/descriptor.d.ts.map +1 -0
  24. package/dist/descriptor.js +137 -0
  25. package/dist/descriptor.js.map +1 -0
  26. package/dist/entity.d.ts +231 -0
  27. package/dist/entity.d.ts.map +1 -0
  28. package/dist/entity.js +436 -0
  29. package/dist/entity.js.map +1 -0
  30. package/dist/evaluate.d.ts +204 -2
  31. package/dist/evaluate.d.ts.map +1 -0
  32. package/dist/evaluate.js +51 -7
  33. package/dist/evaluate.js.map +1 -1
  34. package/dist/expr.d.ts +915 -2
  35. package/dist/expr.d.ts.map +1 -0
  36. package/dist/expr.js +50 -10
  37. package/dist/expr.js.map +1 -1
  38. package/dist/held.d.ts +112 -2
  39. package/dist/held.d.ts.map +1 -0
  40. package/dist/held.js +13 -2
  41. package/dist/held.js.map +1 -1
  42. package/dist/ids.d.ts +8 -0
  43. package/dist/ids.d.ts.map +1 -0
  44. package/dist/ids.js +8 -0
  45. package/dist/ids.js.map +1 -0
  46. package/dist/index.d.ts +400 -6
  47. package/dist/index.d.ts.map +1 -0
  48. package/dist/index.js +113 -12
  49. package/dist/index.js.map +1 -0
  50. package/dist/invariant.d.ts +123 -2
  51. package/dist/invariant.d.ts.map +1 -0
  52. package/dist/invariant.js +236 -1
  53. package/dist/invariant.js.map +1 -0
  54. package/dist/law.d.ts +264 -2
  55. package/dist/law.d.ts.map +1 -0
  56. package/dist/law.js +1 -1
  57. package/dist/operators.d.ts +170 -2
  58. package/dist/operators.d.ts.map +1 -0
  59. package/dist/operators.js +3 -3
  60. package/dist/readFilter.d.ts +8 -2
  61. package/dist/readFilter.d.ts.map +1 -0
  62. package/dist/sets.d.ts +18 -2
  63. package/dist/sets.d.ts.map +1 -0
  64. package/dist/sets.js +1 -1
  65. package/dist/shape.d.ts +23 -2
  66. package/dist/shape.d.ts.map +1 -0
  67. package/dist/tested.d.ts +8 -2
  68. package/dist/tested.d.ts.map +1 -0
  69. package/dist/text.d.ts +27 -2
  70. package/dist/text.d.ts.map +1 -0
  71. package/dist/text.js +1 -1
  72. package/dist/variants.d.ts +72 -0
  73. package/dist/variants.d.ts.map +1 -0
  74. package/dist/variants.js +76 -0
  75. package/dist/variants.js.map +1 -0
  76. package/dist/words.d.ts +17 -2
  77. package/dist/words.d.ts.map +1 -0
  78. package/dist/write.d.ts +312 -2
  79. package/dist/write.d.ts.map +1 -0
  80. package/dist/write.js +3 -3
  81. package/package.json +3 -3
  82. package/dist/collation-BB4YTIbY.d.ts +0 -34
  83. package/dist/collation-BB4YTIbY.d.ts.map +0 -1
  84. package/dist/index-48JeXG0A.d.ts +0 -2585
  85. package/dist/index-48JeXG0A.d.ts.map +0 -1
  86. package/dist/readFilter-CWMnFRVw.d.ts +0 -9
  87. package/dist/readFilter-CWMnFRVw.d.ts.map +0 -1
  88. package/dist/shape-LAowRf9f.d.ts +0 -23
  89. package/dist/shape-LAowRf9f.d.ts.map +0 -1
  90. package/dist/src-DKhUqLoC.js +0 -731
  91. package/dist/src-DKhUqLoC.js.map +0 -1
  92. package/dist/words-a4e9o-TK.d.ts +0 -18
  93. package/dist/words-a4e9o-TK.d.ts.map +0 -1
package/dist/held.d.ts CHANGED
@@ -1,2 +1,112 @@
1
- import { an as Pointing, in as HeldTable, nn as HeldRow, on as idOfRef, rn as HeldRows, tn as Held } from "./index-48JeXG0A.js";
2
- export { Held, HeldRow, HeldRows, HeldTable, Pointing, idOfRef };
1
+ import { Option } from "effect";
2
+ import { AnyEntity, EntityIdentity } from "./index.js";
3
+ import { AnyQuery as AnyQuery$1, OneRelation } from "./expr.js";
4
+ /** A value a holder has, or why it does not have it. */
5
+ export type Held<A> = {
6
+ readonly _tag: 'Held';
7
+ readonly value: A;
8
+ } | {
9
+ readonly _tag: 'Unheld';
10
+ readonly reason: string;
11
+ };
12
+ /** The rows pointing at one row through a relation, as far as a holder has them. */
13
+ export interface Pointing {
14
+ readonly rows: ReadonlyArray<HeldRow>;
15
+ /**
16
+ * Why a row pointing here may be missing from `rows`; none when it holds
17
+ * every one whose fields hold the values `pinned` names.
18
+ */
19
+ readonly missing: Option.Option<string>;
20
+ }
21
+ /**
22
+ * The values an exists' filter fixes on the rows it counts, by field key (a
23
+ * link as the id it points at): a row with another value in one of them is
24
+ * not counted, so a holder holding every pointing row with these values holds
25
+ * every one that counts (`Judge.pins`).
26
+ */
27
+ export type Pinned = ReadonlyMap<string, unknown>;
28
+ /**
29
+ * One row as a holder has it. Values are **encoded**, as a store keeps them
30
+ * and as `evaluate` reads a row.
31
+ */
32
+ export interface HeldRow {
33
+ /** A field's value; unheld when the holder lacks it or may not see it. */
34
+ readonly field: (key: string) => Held<unknown>;
35
+ /**
36
+ * The row a `one` relation of this row points at: none for a null link, or
37
+ * a row the reader may not see when the holder knows it holds every row it may.
38
+ */
39
+ readonly follow: (relation: OneRelation) => Held<Option.Option<HeldRow>>;
40
+ /**
41
+ * The rows pointing at this one through `relation`, a `one` relation of
42
+ * another Entity, for an exists whose filter fixes `pinned`.
43
+ */
44
+ readonly pointing: (relation: OneRelation, pinned: Pinned) => Pointing;
45
+ }
46
+ /** One Entity's rows, as `Held.rows` takes them. */
47
+ export interface HeldTable {
48
+ readonly entity: AnyEntity;
49
+ /**
50
+ * Each row's values by key, encoded; a `one` relation's under its own key,
51
+ * as the id of the row it points at or null. A key a row lacks is unheld.
52
+ */
53
+ readonly rows: ReadonlyArray<Readonly<Record<string, unknown>>>;
54
+ /**
55
+ * Whether these are every row of the Entity the reader may see, so a row
56
+ * not among them is known absent. True when not given.
57
+ */
58
+ readonly complete?: boolean | undefined;
59
+ /** Keys the reader may not see on any of these rows. */
60
+ readonly hidden?: ReadonlyArray<string> | undefined;
61
+ }
62
+ /** The rows `Held.rows` holds, by Entity. */
63
+ export interface HeldRows {
64
+ /** The row of `entity` with this id, when it is held. */
65
+ readonly row: (entity: AnyEntity, id: unknown) => Option.Option<HeldRow>;
66
+ /** Every held row of `entity`. */
67
+ readonly rows: (entity: AnyEntity) => ReadonlyArray<HeldRow>;
68
+ /**
69
+ * The row of `entity` with this id as the holder can say: none when it
70
+ * knows there is no such row it may see, unheld when it cannot tell.
71
+ */
72
+ readonly find: (entity: AnyEntity, id: unknown) => Held<Option.Option<HeldRow>>;
73
+ }
74
+ declare const held: <A>(value: A) => Held<A>;
75
+ declare const unheld: <A = never>(reason: string) => Held<A>;
76
+ /**
77
+ * Rows held as plain records: each table complete or not, with keys hidden.
78
+ * What a test, a conformance check or a server that has the rows in hand
79
+ * judges over.
80
+ */
81
+ declare const rowsOf: (tables: ReadonlyArray<HeldTable>) => HeldRows;
82
+ /**
83
+ * A row as a Source answers it and a Remote store keeps it, each `one`
84
+ * relation as its ref key (`'User:ada'`), given as an interpreter reads it:
85
+ * each link `query` reads as the id it points at. The row itself when the
86
+ * query reads no link.
87
+ */
88
+ declare const fromRefs: (query: AnyQuery$1, row: Readonly<Record<string, unknown>>) => Readonly<Record<string, unknown>>;
89
+ /**
90
+ * Whether `key` is a `one` relation of the Entity `owner` names: what a
91
+ * ref-keyed holder reads as the id it points at on a row it knows only by
92
+ * identity, as a row pointing through `HeldRow.pointing`'s relation is.
93
+ */
94
+ declare const isLink: (owner: EntityIdentity<string>, key: string) => boolean;
95
+ /** The id a ref key (`'User:ada'`) names, refusing what is none, as `where` holds it. */
96
+ export declare const idOfRef: (ref: unknown, where: string) => string;
97
+ export declare const Held: {
98
+ /** A value the holder has. */
99
+ of: typeof held;
100
+ /** A value the holder does not have, and why. */
101
+ unheld: typeof unheld;
102
+ match: <A, B>(value: Held<A>, cases: {
103
+ readonly onHeld: (value: A) => B;
104
+ readonly onUnheld: (reason: string) => B;
105
+ }) => B;
106
+ /** Rows held as plain records; see `HeldTable`. */
107
+ rows: typeof rowsOf;
108
+ fromRefs: typeof fromRefs;
109
+ isLink: typeof isLink;
110
+ };
111
+ export {};
112
+ //# sourceMappingURL=held.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"held.d.ts","names":["AnyQuery"],"sources":["../src/held.ts"],"mappings":";;;;YAgBY,KAAK;WACF;WAAuB,OAAO;;WAC9B;WAAyB;;;iBAGvB;WACN,MAAM,cAAc;;;;;WAKpB,SAAS,OAAO;;;;;;;;YASf,SAAS;;;;;iBAMJ;;WAEN,QAAQ,gBAAgB;;;;;WAKxB,SAAS,UAAU,gBAAgB,KAAK,OAAO,OAAO;;;;;WAKtD,WAAW,UAAU,aAAa,QAAQ,WAAW;;;iBAI/C;WACN,QAAQ;;;;;WAKR,MAAM,cAAc,SAAS;;;;;WAK7B;;WAEA,SAAS;;;iBAIH;;WAEN,MAAM,QAAQ,WAAW,gBAAgB,OAAO,OAAO;;WAEvD,OAAO,QAAQ,cAAc,cAAc;;;;;WAK3C,OAAO,QAAQ,WAAW,gBAAgB,KAAK,OAAO,OAAO;;cAGlE,OAAQ,GAAC,OAAS,MAAI,KAAK;cAC3B,SAAU,WAAS,mBAAmB,KAAK;;;;;;cAO3C,SAAM,QAAY,cAAc,eAAa;;;;;;;cAwH7C,WAAQ,OACLA,YAAQ,KACV,SAAS,6BACb,SAAS;;;;;;cAiBN,SAAM,OAAW,wBAAsB;;qBAMhC,UAAO,cAAgB;qBAUvB;;;;;EAKH,QAAA,GAAG,GAAC,OACH,KAAK,IAAE;aACI,SAAS,OAAO,MAAM;aAAY,WAAW,mBAAmB;QACjF"}
package/dist/held.js CHANGED
@@ -1,6 +1,7 @@
1
+ import { Option } from "effect";
1
2
  import { own, put } from "./record.js";
3
+ import { relationsOf } from "./descriptor.js";
2
4
  import { Query } from "./expr.js";
3
- import { Option } from "effect";
4
5
  // src/held.ts
5
6
  /**
6
7
  * What a holder of rows has: the world `Judge` reads an `Expr` over.
@@ -123,6 +124,15 @@ const fromRefs = (query, row) => {
123
124
  }
124
125
  return read;
125
126
  };
127
+ /**
128
+ * Whether `key` is a `one` relation of the Entity `owner` names: what a
129
+ * ref-keyed holder reads as the id it points at on a row it knows only by
130
+ * identity, as a row pointing through `HeldRow.pointing`'s relation is.
131
+ */
132
+ const isLink = (owner, key) => {
133
+ const member = own(relationsOf(owner), key);
134
+ return member?._tag === "Relation" && member.cardinality === "one";
135
+ };
126
136
  /** The id a ref key (`'User:ada'`) names, refusing what is none, as `where` holds it. */
127
137
  const idOfRef = (ref, where) => {
128
138
  const separator = typeof ref === "string" ? ref.indexOf(":") : -1;
@@ -137,7 +147,8 @@ const Held = {
137
147
  match: (value, cases) => value._tag === "Held" ? cases.onHeld(value.value) : cases.onUnheld(value.reason),
138
148
  /** Rows held as plain records; see `HeldTable`. */
139
149
  rows: rowsOf,
140
- fromRefs
150
+ fromRefs,
151
+ isLink
141
152
  };
142
153
  export { Held, idOfRef };
143
154
 
package/dist/held.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"held.js","names":[],"sources":["../src/held.ts"],"sourcesContent":["/**\n * What a holder of rows has: the world `Judge` reads an `Expr` over.\n *\n * A server's database holds every row, so whatever an expression asks has an\n * answer there. A client holds what it was sent: some rows, some fields of\n * them, and none it may not see. `HeldRow` is how a holder says which, so an\n * interpreter can tell \"this field is null\" from \"I do not have this field\",\n * which a plain record cannot: both read as a missing key.\n */\nimport { Option } from 'effect'\nimport { Query, type AnyQuery, type OneRelation } from './expr.js'\nimport type { AnyEntity, EntityIdentity, EntityMember } from './index.js'\nimport { own, put } from './record.js'\n\n/** A value a holder has, or why it does not have it. */\nexport type Held<A> =\n | { readonly _tag: 'Held'; readonly value: A }\n | { readonly _tag: 'Unheld'; readonly reason: string }\n\n/** The rows pointing at one row through a relation, as far as a holder has them. */\nexport interface Pointing {\n readonly rows: ReadonlyArray<HeldRow>\n /** Why a row pointing here may be missing from `rows`; none when it holds every one. */\n readonly missing: Option.Option<string>\n}\n\n/**\n * One row as a holder has it. Values are **encoded**, as a store keeps them\n * and as `evaluate` reads a row.\n */\nexport interface HeldRow {\n /** A field's value; unheld when the holder lacks it or may not see it. */\n readonly field: (key: string) => Held<unknown>\n /**\n * The row a `one` relation of this row points at: none for a null link, or\n * a row the reader may not see when the holder knows it holds every row it may.\n */\n readonly follow: (relation: OneRelation) => Held<Option.Option<HeldRow>>\n /** The rows pointing at this one through `relation`, a `one` relation of another Entity. */\n readonly pointing: (relation: OneRelation) => Pointing\n}\n\n/** One Entity's rows, as `Held.rows` takes them. */\nexport interface HeldTable {\n readonly entity: AnyEntity\n /**\n * Each row's values by key, encoded; a `one` relation's under its own key,\n * as the id of the row it points at or null. A key a row lacks is unheld.\n */\n readonly rows: ReadonlyArray<Readonly<Record<string, unknown>>>\n /**\n * Whether these are every row of the Entity the reader may see, so a row\n * not among them is known absent. True when not given.\n */\n readonly complete?: boolean | undefined\n /** Keys the reader may not see on any of these rows. */\n readonly hidden?: ReadonlyArray<string> | undefined\n}\n\n/** The rows `Held.rows` holds, by Entity. */\nexport interface HeldRows {\n /** The row of `entity` with this id, when it is held. */\n readonly row: (entity: AnyEntity, id: unknown) => Option.Option<HeldRow>\n /** Every held row of `entity`. */\n readonly rows: (entity: AnyEntity) => ReadonlyArray<HeldRow>\n /**\n * The row of `entity` with this id as the holder can say: none when it\n * knows there is no such row it may see, unheld when it cannot tell.\n */\n readonly find: (entity: AnyEntity, id: unknown) => Held<Option.Option<HeldRow>>\n}\n\nconst held = <A>(value: A): Held<A> => ({ _tag: 'Held', value })\nconst unheld = <A = never>(reason: string): Held<A> => ({ _tag: 'Unheld', reason })\n\n/**\n * Rows held as plain records: each table complete or not, with keys hidden.\n * What a test, a conformance check or a server that has the rows in hand\n * judges over.\n */\nconst rowsOf = (tables: ReadonlyArray<HeldTable>): HeldRows => {\n interface Table {\n readonly entity: AnyEntity\n readonly complete: boolean\n readonly hidden: ReadonlySet<string>\n readonly byId: ReadonlyMap<unknown, HeldRow>\n readonly views: ReadonlyArray<HeldRow>\n }\n const byToken = new Map<symbol, Table>()\n const tableOf = (identity: EntityIdentity<string>) =>\n Option.fromUndefinedOr(byToken.get(identity.token))\n const find = (target: AnyEntity, id: unknown): Held<Option.Option<HeldRow>> =>\n Option.match(tableOf(target.identity), {\n onNone: () => unheld(`no ${target.name} is held`),\n onSome: reached =>\n Option.match(Option.fromUndefinedOr(reached.byId.get(id)), {\n onSome: row => held(Option.some(row)),\n onNone: () =>\n reached.complete\n ? held(Option.none<HeldRow>())\n : unheld(`${target.name} ${String(id)} is not held`),\n }),\n })\n\n const view = (table: Table, record: Readonly<Record<string, unknown>>): HeldRow => {\n const read = (key: string): Held<unknown> =>\n table.hidden.has(key)\n ? unheld(`${table.entity.name}.${key} is hidden from this reader`)\n : Object.hasOwn(record, key)\n ? held(record[key])\n : unheld(`${table.entity.name}.${key} is not held`)\n return {\n field: read,\n follow: relation => {\n const link = read(relation.key)\n if (link._tag === 'Unheld') return link\n if (link.value === null || link.value === undefined) return held(Option.none())\n return find(relation.target(), link.value)\n },\n pointing: relation =>\n Option.match(tableOf(relation.owner), {\n onNone: () => ({\n rows: [],\n missing: Option.some(`no ${relation.owner.name} is held`),\n }),\n onSome: from => {\n const id = record.id\n const named = `${relation.owner.name}.${relation.key}`\n const rows: Array<HeldRow> = []\n let missing = from.complete\n ? Option.none<string>()\n : Option.some(`not every ${relation.owner.name} is held`)\n for (const each of from.views) {\n const link = each.field(relation.key)\n if (link._tag === 'Unheld') {\n missing = Option.orElse(missing, () => Option.some(link.reason))\n } else if (link.value === id) {\n rows.push(each)\n }\n }\n return { rows, missing: Option.map(missing, reason => `${named}: ${reason}`) }\n },\n }),\n }\n }\n\n for (const given of tables) {\n const views: Array<HeldRow> = []\n const byId = new Map<unknown, HeldRow>()\n const table: Table = {\n entity: given.entity,\n complete: given.complete ?? true,\n hidden: new Set(given.hidden ?? []),\n byId,\n views,\n }\n for (const record of given.rows) {\n const each = view(table, record)\n views.push(each)\n byId.set(record.id, each)\n }\n byToken.set(given.entity.identity.token, table)\n }\n\n return {\n row: (entity, id) =>\n Option.flatMap(tableOf(entity.identity), table => Option.fromUndefinedOr(table.byId.get(id))),\n rows: entity =>\n Option.match(tableOf(entity.identity), { onNone: () => [], onSome: table => table.views }),\n find,\n }\n}\n\nconst linksRead = new WeakMap<AnyQuery, ReadonlyArray<string>>()\n\n/**\n * The links a query reads on its own row: each relation of its Entity it\n * reads (a body reads only a `one` relation as a value). A relation it reads\n * existed when it was built, so what it reads is known once.\n */\nconst linksOf = (query: AnyQuery): ReadonlyArray<string> => {\n const known = linksRead.get(query)\n if (known !== undefined) return known\n const relations: Readonly<Record<string, EntityMember>> = query.entity.relations\n const links = Query.dependencies(query)\n .fields.filter(\n field =>\n field.owner.token === query.entity.identity.token && Object.hasOwn(relations, field.key),\n )\n .map(field => field.key)\n linksRead.set(query, links)\n return links\n}\n\n/**\n * A row as a Source answers it and a Remote store keeps it, each `one`\n * relation as its ref key (`'User:ada'`), given as an interpreter reads it:\n * each link `query` reads as the id it points at. The row itself when the\n * query reads no link.\n */\nconst fromRefs = (\n query: AnyQuery,\n row: Readonly<Record<string, unknown>>,\n): Readonly<Record<string, unknown>> => {\n const links = linksOf(query)\n if (links.length === 0) return row\n const read: Record<string, unknown> = { ...row }\n for (const key of links) {\n const ref = own(row, key)\n if (ref !== null && ref !== undefined)\n put(read, key, idOfRef(ref, `${query.entity.name}.${key}`))\n }\n return read\n}\n\n/** The id a ref key (`'User:ada'`) names, refusing what is none, as `where` holds it. */\nexport const idOfRef = (ref: unknown, where: string): string => {\n const separator = typeof ref === 'string' ? ref.indexOf(':') : -1\n if (separator === -1) {\n throw new Error(\n `[foldkit-entity] ${where} holds ${JSON.stringify(ref)}, which is no ref key (\"Entity:id\")`,\n )\n }\n return (ref as string).slice(separator + 1)\n}\n\nexport const Held = {\n /** A value the holder has. */\n of: held,\n /** A value the holder does not have, and why. */\n unheld,\n match: <A, B>(\n value: Held<A>,\n cases: { readonly onHeld: (value: A) => B; readonly onUnheld: (reason: string) => B },\n ): B => (value._tag === 'Held' ? cases.onHeld(value.value) : cases.onUnheld(value.reason)),\n /** Rows held as plain records; see `HeldTable`. */\n rows: rowsOf,\n fromRefs,\n}\n"],"mappings":";;;;;;;;;;;;;AAwEA,MAAM,QAAW,WAAuB;CAAE,MAAM;CAAQ;AAAM;AAC9D,MAAM,UAAqB,YAA6B;CAAE,MAAM;CAAU;AAAO;;;;;;AAOjF,MAAM,UAAU,WAA+C;CAQ7D,MAAM,0BAAU,IAAI,IAAmB;CACvC,MAAM,WAAW,aACf,OAAO,gBAAgB,QAAQ,IAAI,SAAS,KAAK,CAAC;CACpD,MAAM,QAAQ,QAAmB,OAC/B,OAAO,MAAM,QAAQ,OAAO,QAAQ,GAAG;EACrC,cAAc,OAAO,MAAM,OAAO,KAAK,SAAS;EAChD,SAAQ,YACN,OAAO,MAAM,OAAO,gBAAgB,QAAQ,KAAK,IAAI,EAAE,CAAC,GAAG;GACzD,SAAQ,QAAO,KAAK,OAAO,KAAK,GAAG,CAAC;GACpC,cACE,QAAQ,WACJ,KAAK,OAAO,KAAc,CAAC,IAC3B,OAAO,GAAG,OAAO,KAAK,GAAG,OAA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K,MAAM,OAAO,OAAO;EACvB,MAAM,MAAM,IAAI,KAAK,GAAG;EACxB,IAAI,QAAQ,QAAQ,QAAQ,KAAA,GAC1B,IAAI,MAAM,KAAK,QAAQ,KAAK,GAAG,MAAM,OAAO,KAAK,GAAG,KAAK,CAAC;CAC9D;CACA,OAAO;AACT;;AAGA,MAAa,WAAW,KAAc,UAA0B;CAC9D,MAAM,YAAY,OAAO,QAAQ,WAAW,IAAI,QAAQ,GAAG,IAAI;CAC/D,IAAI,cAAc,IAChB,MAAM,IAAI,MACR,oBAAoB,MAAM,SAAS,KAAK,UAAU,GAAG,EAAE,oCACzD;CAEF,OAAQ,IAAe,MAAM,YAAY,CAAC;AAC5C;AAEA,MAAa,OAAO;;CAElB,IAAI;;CAEJ;CACA,QACE,OACA,UACO,MAAM,SAAS,SAAS,MAAM,OAAO,MAAM,KAAK,IAAI,MAAM,SAAS,MAAM,MAAM;;CAExF,MAAM;CACN;AACF"}
1
+ {"version":3,"file":"held.js","names":[],"sources":["../src/held.ts"],"sourcesContent":["/**\n * What a holder of rows has: the world `Judge` reads an `Expr` over.\n *\n * A server's database holds every row, so whatever an expression asks has an\n * answer there. A client holds what it was sent: some rows, some fields of\n * them, and none it may not see. `HeldRow` is how a holder says which, so an\n * interpreter can tell \"this field is null\" from \"I do not have this field\",\n * which a plain record cannot: both read as a missing key.\n */\nimport { Option } from 'effect'\nimport { relationsOf } from './descriptor.js'\nimport { Query, type AnyQuery, type OneRelation } from './expr.js'\nimport type { AnyEntity, EntityIdentity, EntityMember } from './index.js'\nimport { own, put } from './record.js'\n\n/** A value a holder has, or why it does not have it. */\nexport type Held<A> =\n | { readonly _tag: 'Held'; readonly value: A }\n | { readonly _tag: 'Unheld'; readonly reason: string }\n\n/** The rows pointing at one row through a relation, as far as a holder has them. */\nexport interface Pointing {\n readonly rows: ReadonlyArray<HeldRow>\n /**\n * Why a row pointing here may be missing from `rows`; none when it holds\n * every one whose fields hold the values `pinned` names.\n */\n readonly missing: Option.Option<string>\n}\n\n/**\n * The values an exists' filter fixes on the rows it counts, by field key (a\n * link as the id it points at): a row with another value in one of them is\n * not counted, so a holder holding every pointing row with these values holds\n * every one that counts (`Judge.pins`).\n */\nexport type Pinned = ReadonlyMap<string, unknown>\n\n/**\n * One row as a holder has it. Values are **encoded**, as a store keeps them\n * and as `evaluate` reads a row.\n */\nexport interface HeldRow {\n /** A field's value; unheld when the holder lacks it or may not see it. */\n readonly field: (key: string) => Held<unknown>\n /**\n * The row a `one` relation of this row points at: none for a null link, or\n * a row the reader may not see when the holder knows it holds every row it may.\n */\n readonly follow: (relation: OneRelation) => Held<Option.Option<HeldRow>>\n /**\n * The rows pointing at this one through `relation`, a `one` relation of\n * another Entity, for an exists whose filter fixes `pinned`.\n */\n readonly pointing: (relation: OneRelation, pinned: Pinned) => Pointing\n}\n\n/** One Entity's rows, as `Held.rows` takes them. */\nexport interface HeldTable {\n readonly entity: AnyEntity\n /**\n * Each row's values by key, encoded; a `one` relation's under its own key,\n * as the id of the row it points at or null. A key a row lacks is unheld.\n */\n readonly rows: ReadonlyArray<Readonly<Record<string, unknown>>>\n /**\n * Whether these are every row of the Entity the reader may see, so a row\n * not among them is known absent. True when not given.\n */\n readonly complete?: boolean | undefined\n /** Keys the reader may not see on any of these rows. */\n readonly hidden?: ReadonlyArray<string> | undefined\n}\n\n/** The rows `Held.rows` holds, by Entity. */\nexport interface HeldRows {\n /** The row of `entity` with this id, when it is held. */\n readonly row: (entity: AnyEntity, id: unknown) => Option.Option<HeldRow>\n /** Every held row of `entity`. */\n readonly rows: (entity: AnyEntity) => ReadonlyArray<HeldRow>\n /**\n * The row of `entity` with this id as the holder can say: none when it\n * knows there is no such row it may see, unheld when it cannot tell.\n */\n readonly find: (entity: AnyEntity, id: unknown) => Held<Option.Option<HeldRow>>\n}\n\nconst held = <A>(value: A): Held<A> => ({ _tag: 'Held', value })\nconst unheld = <A = never>(reason: string): Held<A> => ({ _tag: 'Unheld', reason })\n\n/**\n * Rows held as plain records: each table complete or not, with keys hidden.\n * What a test, a conformance check or a server that has the rows in hand\n * judges over.\n */\nconst rowsOf = (tables: ReadonlyArray<HeldTable>): HeldRows => {\n interface Table {\n readonly entity: AnyEntity\n readonly complete: boolean\n readonly hidden: ReadonlySet<string>\n readonly byId: ReadonlyMap<unknown, HeldRow>\n readonly views: ReadonlyArray<HeldRow>\n }\n const byToken = new Map<symbol, Table>()\n const tableOf = (identity: EntityIdentity<string>) =>\n Option.fromUndefinedOr(byToken.get(identity.token))\n const find = (target: AnyEntity, id: unknown): Held<Option.Option<HeldRow>> =>\n Option.match(tableOf(target.identity), {\n onNone: () => unheld(`no ${target.name} is held`),\n onSome: reached =>\n Option.match(Option.fromUndefinedOr(reached.byId.get(id)), {\n onSome: row => held(Option.some(row)),\n onNone: () =>\n reached.complete\n ? held(Option.none<HeldRow>())\n : unheld(`${target.name} ${String(id)} is not held`),\n }),\n })\n\n const view = (table: Table, record: Readonly<Record<string, unknown>>): HeldRow => {\n const read = (key: string): Held<unknown> =>\n table.hidden.has(key)\n ? unheld(`${table.entity.name}.${key} is hidden from this reader`)\n : Object.hasOwn(record, key)\n ? held(record[key])\n : unheld(`${table.entity.name}.${key} is not held`)\n return {\n field: read,\n follow: relation => {\n const link = read(relation.key)\n if (link._tag === 'Unheld') return link\n if (link.value === null || link.value === undefined) return held(Option.none())\n return find(relation.target(), link.value)\n },\n pointing: relation =>\n Option.match(tableOf(relation.owner), {\n onNone: () => ({\n rows: [],\n missing: Option.some(`no ${relation.owner.name} is held`),\n }),\n onSome: from => {\n const id = record.id\n const named = `${relation.owner.name}.${relation.key}`\n const rows: Array<HeldRow> = []\n let missing = from.complete\n ? Option.none<string>()\n : Option.some(`not every ${relation.owner.name} is held`)\n for (const each of from.views) {\n const link = each.field(relation.key)\n if (link._tag === 'Unheld') {\n missing = Option.orElse(missing, () => Option.some(link.reason))\n } else if (link.value === id) {\n rows.push(each)\n }\n }\n return { rows, missing: Option.map(missing, reason => `${named}: ${reason}`) }\n },\n }),\n }\n }\n\n for (const given of tables) {\n const views: Array<HeldRow> = []\n const byId = new Map<unknown, HeldRow>()\n const table: Table = {\n entity: given.entity,\n complete: given.complete ?? true,\n hidden: new Set(given.hidden ?? []),\n byId,\n views,\n }\n for (const record of given.rows) {\n const each = view(table, record)\n views.push(each)\n byId.set(record.id, each)\n }\n byToken.set(given.entity.identity.token, table)\n }\n\n return {\n row: (entity, id) =>\n Option.flatMap(tableOf(entity.identity), table => Option.fromUndefinedOr(table.byId.get(id))),\n rows: entity =>\n Option.match(tableOf(entity.identity), { onNone: () => [], onSome: table => table.views }),\n find,\n }\n}\n\nconst linksRead = new WeakMap<AnyQuery, ReadonlyArray<string>>()\n\n/**\n * The links a query reads on its own row: each relation of its Entity it\n * reads (a body reads only a `one` relation as a value). A relation it reads\n * existed when it was built, so what it reads is known once.\n */\nconst linksOf = (query: AnyQuery): ReadonlyArray<string> => {\n const known = linksRead.get(query)\n if (known !== undefined) return known\n const relations: Readonly<Record<string, EntityMember>> = query.entity.relations\n const links = Query.dependencies(query)\n .fields.filter(\n field =>\n field.owner.token === query.entity.identity.token && Object.hasOwn(relations, field.key),\n )\n .map(field => field.key)\n linksRead.set(query, links)\n return links\n}\n\n/**\n * A row as a Source answers it and a Remote store keeps it, each `one`\n * relation as its ref key (`'User:ada'`), given as an interpreter reads it:\n * each link `query` reads as the id it points at. The row itself when the\n * query reads no link.\n */\nconst fromRefs = (\n query: AnyQuery,\n row: Readonly<Record<string, unknown>>,\n): Readonly<Record<string, unknown>> => {\n const links = linksOf(query)\n if (links.length === 0) return row\n const read: Record<string, unknown> = { ...row }\n for (const key of links) {\n const ref = own(row, key)\n if (ref !== null && ref !== undefined)\n put(read, key, idOfRef(ref, `${query.entity.name}.${key}`))\n }\n return read\n}\n\n/**\n * Whether `key` is a `one` relation of the Entity `owner` names: what a\n * ref-keyed holder reads as the id it points at on a row it knows only by\n * identity, as a row pointing through `HeldRow.pointing`'s relation is.\n */\nconst isLink = (owner: EntityIdentity<string>, key: string): boolean => {\n const member = own(relationsOf(owner), key)\n return member?._tag === 'Relation' && member.cardinality === 'one'\n}\n\n/** The id a ref key (`'User:ada'`) names, refusing what is none, as `where` holds it. */\nexport const idOfRef = (ref: unknown, where: string): string => {\n const separator = typeof ref === 'string' ? ref.indexOf(':') : -1\n if (separator === -1) {\n throw new Error(\n `[foldkit-entity] ${where} holds ${JSON.stringify(ref)}, which is no ref key (\"Entity:id\")`,\n )\n }\n return (ref as string).slice(separator + 1)\n}\n\nexport const Held = {\n /** A value the holder has. */\n of: held,\n /** A value the holder does not have, and why. */\n unheld,\n match: <A, B>(\n value: Held<A>,\n cases: { readonly onHeld: (value: A) => B; readonly onUnheld: (reason: string) => B },\n ): B => (value._tag === 'Held' ? cases.onHeld(value.value) : cases.onUnheld(value.reason)),\n /** Rows held as plain records; see `HeldTable`. */\n rows: rowsOf,\n fromRefs,\n isLink,\n}\n"],"mappings":";;;;;;;;;;;;;;AAuFA,MAAM,QAAW,WAAuB;CAAE,MAAM;CAAQ;AAAM;AAC9D,MAAM,UAAqB,YAA6B;CAAE,MAAM;CAAU;AAAO;;;;;;AAOjF,MAAM,UAAU,WAA+C;CAQ7D,MAAM,0BAAU,IAAI,IAAmB;CACvC,MAAM,WAAW,aACf,OAAO,gBAAgB,QAAQ,IAAI,SAAS,KAAK,CAAC;CACpD,MAAM,QAAQ,QAAmB,OAC/B,OAAO,MAAM,QAAQ,OAAO,QAAQ,GAAG;EACrC,cAAc,OAAO,MAAM,OAAO,KAAK,SAAS;EAChD,SAAQ,YACN,OAAO,MAAM,OAAO,gBAAgB,QAAQ,KAAK,IAAI,EAAE,CAAC,GAAG;GACzD,SAAQ,QAAO,KAAK,OAAO,KAAK,GAAG,CAAC;GACpC,cACE,QAAQ,WACJ,KAAK,OAAO,KAAc,CAAC,IAC3B,OAAO,GAAG,OAAO,KAAK,GAAG,OAAO,EAAE,EAAE,aAAa;EACzD,CAAC;CACL,CAAC;CAEH,MAAM,QAAQ,OAAc,WAA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Q,QAAQ,QAAQ,KAAA,GAC1B,IAAI,MAAM,KAAK,QAAQ,KAAK,GAAG,MAAM,OAAO,KAAK,GAAG,KAAK,CAAC;CAC9D;CACA,OAAO;AACT;;;;;;AAOA,MAAM,UAAU,OAA+B,QAAyB;CACtE,MAAM,SAAS,IAAI,YAAY,KAAK,GAAG,GAAG;CAC1C,OAAO,QAAQ,SAAS,cAAc,OAAO,gBAAgB;AAC/D;;AAGA,MAAa,WAAW,KAAc,UAA0B;CAC9D,MAAM,YAAY,OAAO,QAAQ,WAAW,IAAI,QAAQ,GAAG,IAAI;CAC/D,IAAI,cAAc,IAChB,MAAM,IAAI,MACR,oBAAoB,MAAM,SAAS,KAAK,UAAU,GAAG,EAAE,oCACzD;CAEF,OAAQ,IAAe,MAAM,YAAY,CAAC;AAC5C;AAEA,MAAa,OAAO;;CAElB,IAAI;;CAEJ;CACA,QACE,OACA,UACO,MAAM,SAAS,SAAS,MAAM,OAAO,MAAM,KAAK,IAAI,MAAM,SAAS,MAAM,MAAM;;CAExF,MAAM;CACN;CACA;AACF"}
package/dist/ids.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /** The brands an Entity, a Selection and a Selection page carry, apart so each module can read them. */
2
+ export declare const EntityTypeId: unique symbol;
3
+ export type EntityTypeId = typeof EntityTypeId;
4
+ export declare const SelectionTypeId: unique symbol;
5
+ export type SelectionTypeId = typeof SelectionTypeId;
6
+ export declare const SelectionPageTypeId: unique symbol;
7
+ export type SelectionPageTypeId = typeof SelectionPageTypeId;
8
+ //# sourceMappingURL=ids.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.d.ts","names":[],"sources":["../src/ids.ts"],"mappings":";qBACa;YACD,sBAAsB;qBAErB;YACD,yBAAyB;qBAExB;YACD,6BAA6B"}
package/dist/ids.js ADDED
@@ -0,0 +1,8 @@
1
+ // src/ids.ts
2
+ /** The brands an Entity, a Selection and a Selection page carry, apart so each module can read them. */
3
+ const EntityTypeId = Symbol.for("foldkit-entity/Entity");
4
+ const SelectionTypeId = Symbol.for("foldkit-entity/Selection");
5
+ const SelectionPageTypeId = Symbol.for("foldkit-entity/SelectionPage");
6
+ export { EntityTypeId, SelectionPageTypeId, SelectionTypeId };
7
+
8
+ //# sourceMappingURL=ids.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ids.js","names":[],"sources":["../src/ids.ts"],"sourcesContent":["/** The brands an Entity, a Selection and a Selection page carry, apart so each module can read them. */\nexport const EntityTypeId: unique symbol = Symbol.for('foldkit-entity/Entity')\nexport type EntityTypeId = typeof EntityTypeId\n\nexport const SelectionTypeId: unique symbol = Symbol.for('foldkit-entity/Selection')\nexport type SelectionTypeId = typeof SelectionTypeId\n\nexport const SelectionPageTypeId: unique symbol = Symbol.for('foldkit-entity/SelectionPage')\nexport type SelectionPageTypeId = typeof SelectionPageTypeId\n"],"mappings":";;AACA,MAAa,eAA8B,OAAO,IAAI,uBAAuB;AAG7E,MAAa,kBAAiC,OAAO,IAAI,0BAA0B;AAGnF,MAAa,sBAAqC,OAAO,IAAI,8BAA8B"}