@latticecms/core 0.1.0 → 0.3.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 (83) hide show
  1. package/README.md +183 -60
  2. package/dist/access.d.ts +2 -3
  3. package/dist/access.d.ts.map +1 -1
  4. package/dist/access.js +21 -5
  5. package/dist/access.js.map +1 -1
  6. package/dist/build.d.ts +52 -4
  7. package/dist/build.d.ts.map +1 -1
  8. package/dist/build.js +78 -21
  9. package/dist/build.js.map +1 -1
  10. package/dist/collection.d.ts.map +1 -1
  11. package/dist/collection.js +12 -5
  12. package/dist/collection.js.map +1 -1
  13. package/dist/crud.d.ts +24 -8
  14. package/dist/crud.d.ts.map +1 -1
  15. package/dist/crud.js +47 -59
  16. package/dist/crud.js.map +1 -1
  17. package/dist/errors.d.ts +5 -1
  18. package/dist/errors.d.ts.map +1 -1
  19. package/dist/errors.js +5 -1
  20. package/dist/errors.js.map +1 -1
  21. package/dist/family.js +15 -19
  22. package/dist/family.js.map +1 -1
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js.map +1 -1
  26. package/dist/mask.d.ts +11 -11
  27. package/dist/mask.d.ts.map +1 -1
  28. package/dist/mask.js +24 -2
  29. package/dist/mask.js.map +1 -1
  30. package/dist/populate.d.ts +9 -2
  31. package/dist/populate.d.ts.map +1 -1
  32. package/dist/populate.js +3 -4
  33. package/dist/populate.js.map +1 -1
  34. package/dist/relations.d.ts +2 -1
  35. package/dist/relations.d.ts.map +1 -1
  36. package/dist/relations.js +18 -2
  37. package/dist/relations.js.map +1 -1
  38. package/dist/repo.d.ts +1 -1
  39. package/dist/repo.d.ts.map +1 -1
  40. package/dist/repo.js +15 -6
  41. package/dist/repo.js.map +1 -1
  42. package/dist/sort.d.ts +32 -7
  43. package/dist/sort.d.ts.map +1 -1
  44. package/dist/sort.js +66 -24
  45. package/dist/sort.js.map +1 -1
  46. package/dist/store/conformance.d.ts.map +1 -1
  47. package/dist/store/conformance.js +146 -5
  48. package/dist/store/conformance.js.map +1 -1
  49. package/dist/store/index.d.ts +1 -1
  50. package/dist/store/index.d.ts.map +1 -1
  51. package/dist/store/index.js +1 -1
  52. package/dist/store/index.js.map +1 -1
  53. package/dist/store.d.ts +6 -0
  54. package/dist/store.d.ts.map +1 -1
  55. package/dist/store.js +1 -1
  56. package/dist/store.js.map +1 -1
  57. package/dist/where.d.ts +3 -1
  58. package/dist/where.d.ts.map +1 -1
  59. package/dist/where.js +31 -5
  60. package/dist/where.js.map +1 -1
  61. package/package.json +12 -11
  62. package/skills/lattice/SKILL.md +2 -2
  63. package/skills/lattice/references/access.md +19 -5
  64. package/skills/lattice/references/collection.md +4 -1
  65. package/skills/lattice/references/method.md +3 -0
  66. package/skills/lattice/references/override.md +89 -6
  67. package/skills/lattice/references/relations.md +3 -2
  68. package/src/access.ts +24 -4
  69. package/src/build.ts +214 -48
  70. package/src/collection.ts +12 -5
  71. package/src/crud.ts +74 -72
  72. package/src/errors.ts +5 -1
  73. package/src/family.ts +21 -21
  74. package/src/index.ts +2 -0
  75. package/src/mask.ts +31 -2
  76. package/src/populate.ts +11 -4
  77. package/src/relations.ts +19 -2
  78. package/src/repo.ts +16 -7
  79. package/src/sort.ts +92 -35
  80. package/src/store/conformance.ts +193 -4
  81. package/src/store/index.ts +7 -1
  82. package/src/store.ts +7 -1
  83. package/src/where.ts +36 -9
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Collections that compile into hexok use cases, hexok event classes and a ts-pf contract. A collection is a Zod schema with a slug. `framework()` turns a set of them into a typed RPC contract, and `build()` wires that contract to a store and an event publisher. Every generated piece is a real hexok `UseCase`, `Event`, `Errors` and `Port`, and a real ts-pf `router`, so a hand-written one can take its place with the same types.
4
4
 
5
- Status: before 1.0, not yet published. Breaking changes are free until 1.0. The design and the reasons behind it are in [docs/architecture.md](../../docs/architecture.md).
5
+ Status: before 1.0. Breaking changes are free until 1.0. The design and the reasons behind it are in [docs/architecture.md](../../docs/architecture.md).
6
6
 
7
7
  ## Install
8
8
 
@@ -80,7 +80,7 @@ It links `.agents/skills/lattice` to `node_modules/@latticecms/core/skills/latti
80
80
 
81
81
  ## Concepts
82
82
 
83
- The examples come from [`examples/crm`](../../examples/crm): a CRM with tenanted companies, contacts and deals on MongoDB, served to signed-in members of an organization.
83
+ The examples come from [`examples/crm`](../../examples/crm): a CRM with tenanted companies, contacts, deals, activities and tasks on MongoDB, served to signed-in members of an organization.
84
84
 
85
85
  ### Collections
86
86
 
@@ -93,9 +93,14 @@ import { z } from 'zod';
93
93
 
94
94
  export const Contacts = collection('contacts', {
95
95
  schema: z.object({
96
- name: z.string().min(1),
97
- email: z.email(),
96
+ // The messages are what a form shows at the field.
97
+ name: z.string().min(1, 'Enter a name'),
98
+ email: z.email('Enter an email address, like ana@example.com'),
99
+ phone: z.string().optional(),
100
+ // The contact's job title.
101
+ title: z.string().optional(),
98
102
  // A company with contacts cannot be deleted: restrict, the default.
103
+ // Like every ref, it refuses '': "Choose the company".
99
104
  companyId: ref('companies'),
100
105
  }),
101
106
  tenant: 'organizationId',
@@ -197,14 +202,19 @@ export class CloseDeal extends AppUseCase('deals.close', {
197
202
  ```ts
198
203
  // examples/crm/src/servers/rpc/contract.ts
199
204
  import { framework } from '@latticecms/core';
205
+ import { LogActivity } from '../../app/use-cases/activities/log-activity.js';
200
206
  import { AppUseCase } from '../../app/use-cases/context.js';
201
207
  import { ArchiveDeal } from '../../app/use-cases/deals/archive-deal.js';
202
208
  import { CloseDeal } from '../../app/use-cases/deals/close-deal.js';
209
+ import { CreateDeal } from '../../app/use-cases/deals/create-deal.js';
210
+ import { UpdateDeal } from '../../app/use-cases/deals/update-deal.js';
211
+ import { Activities } from '../../domain/collections/activities.js';
203
212
  import { Companies } from '../../domain/collections/companies.js';
204
213
  import { Contacts } from '../../domain/collections/contacts.js';
205
214
  import { Deals } from '../../domain/collections/deals.js';
206
215
  import { Memberships } from '../../domain/collections/memberships.js';
207
216
  import { Organizations } from '../../domain/collections/organizations.js';
217
+ import { Tasks } from '../../domain/collections/tasks.js';
208
218
  import { clientErrors, toRpcError } from './errors.js';
209
219
 
210
220
  /** Any signed-in caller may do this. The edge has already checked the actor. */
@@ -213,7 +223,15 @@ const anyone = () => true;
213
223
  // An archived deal is hidden from every read and can no longer change.
214
224
  const live = () => ({ archived: { eq: false } });
215
225
 
216
- /** The CRM's API: five collections, one override and one method. No ports. */
226
+ // A closed deal can no longer change either. Like an archived one, it
227
+ // answers update with NOT_FOUND. It closes through deals.close, which
228
+ // refuses a second close as AlreadyClosed.
229
+ const editable = () => ({
230
+ archived: { eq: false },
231
+ closedAt: { exists: false },
232
+ });
233
+
234
+ /** The CRM's API: seven collections, three overrides and two methods. No ports. */
217
235
  export const crm = framework({
218
236
  family: AppUseCase,
219
237
  errors: { declared: clientErrors, map: toRpcError },
@@ -228,7 +246,7 @@ export const crm = framework({
228
246
  access: {
229
247
  read: live,
230
248
  create: anyone,
231
- update: live,
249
+ update: editable,
232
250
  delete: live,
233
251
  close: live,
234
252
  },
@@ -239,14 +257,36 @@ export const crm = framework({
239
257
  },
240
258
  },
241
259
  methods: { close: CloseDeal },
242
- overrides: { delete: ArchiveDeal },
260
+ // A deal closes only through deals.close: create and update refuse to.
261
+ overrides: { create: CreateDeal, update: UpdateDeal, delete: ArchiveDeal },
262
+ })
263
+ .collection(Activities, {
264
+ // Any member reads the timeline. Only the author changes or removes an
265
+ // activity, as a filter: another member's is NOT_FOUND. No create: log
266
+ // is the only way in, so the author is always the caller.
267
+ access: {
268
+ read: anyone,
269
+ update: ({ actor }) => ({ authorId: { eq: actor.userId } }),
270
+ delete: ({ actor }) => ({ authorId: { eq: actor.userId } }),
271
+ log: anyone,
272
+ },
273
+ methods: { log: LogActivity },
274
+ })
275
+ .collection(Tasks, {
276
+ access: { read: anyone, create: anyone, update: anyone, delete: anyone },
243
277
  })
244
278
  .collection(Memberships, {
245
- // A caller lists its own memberships, in every organization. An
246
- // organization switcher uses /auth organizations instead, since /rpc
279
+ // A member reads the memberships of the organization it acts in: its
280
+ // team, for a team list or an owner picker. Support reads every one.
281
+ // An organization switcher uses /auth organizations instead, since /rpc
247
282
  // needs an organization first. No create, update or delete: only
248
283
  // trusted code writes them.
249
- access: { read: ({ actor }) => ({ userId: { eq: actor.userId } }) },
284
+ access: {
285
+ read: ({ actor }) =>
286
+ 'support' in actor
287
+ ? true
288
+ : { organizationId: { eq: actor.organizationId } },
289
+ },
250
290
  })
251
291
  .collection(Organizations, {
252
292
  // A member reads the organization it acts in, and support every one.
@@ -260,7 +300,16 @@ export const crm = framework({
260
300
  /** What clients and codegen import. */
261
301
  export const contract = crm.contract;
262
302
 
263
- export { AppUseCase, Companies, Contacts, Deals, Memberships, Organizations };
303
+ export {
304
+ Activities,
305
+ AppUseCase,
306
+ Companies,
307
+ Contacts,
308
+ Deals,
309
+ Memberships,
310
+ Organizations,
311
+ Tasks,
312
+ };
264
313
  ```
265
314
 
266
315
  `framework({ family, errors? })` starts a definition. `errors` is the app's `{ declared, map }`; an app with no domain errors leaves it out.
@@ -277,14 +326,17 @@ export { AppUseCase, Companies, Contacts, Deals, Memberships, Organizations };
277
326
 
278
327
  ### `build()`
279
328
 
280
- `build()` wires the definition to a store and a publisher. The method and override instances get the typed repos.
329
+ `build()` wires the definition to a store and a publisher. The method and override instances get the typed repos, and the overrides the generated operations they replace.
281
330
 
282
331
  ```ts
283
332
  // examples/crm/src/servers/app.ts
284
333
  import type { CollectionStore } from '@latticecms/core';
285
334
  import type { DomainEventPublisher } from '../app/ports/events/domain-event-publisher.js';
335
+ import { LogActivity } from '../app/use-cases/activities/log-activity.js';
286
336
  import { ArchiveDeal } from '../app/use-cases/deals/archive-deal.js';
287
337
  import { CloseDeal } from '../app/use-cases/deals/close-deal.js';
338
+ import { CreateDeal } from '../app/use-cases/deals/create-deal.js';
339
+ import { UpdateDeal } from '../app/use-cases/deals/update-deal.js';
288
340
  import { crm } from './rpc/contract.js';
289
341
 
290
342
  export type AppPorts = {
@@ -299,9 +351,16 @@ export function createApp({ store, events }: AppPorts) {
299
351
  events,
300
352
  methods: ({ repos }) => ({
301
353
  deals: { close: new CloseDeal({ deals: repos.deals, events }) },
354
+ activities: {
355
+ log: new LogActivity({ activities: repos.activities, events }),
356
+ },
302
357
  }),
303
- overrides: ({ repos }) => ({
304
- deals: { delete: new ArchiveDeal({ deals: repos.deals }) },
358
+ overrides: ({ repos, generated }) => ({
359
+ deals: {
360
+ create: new CreateDeal({ create: generated.deals.create }),
361
+ update: new UpdateDeal({ update: generated.deals.update }),
362
+ delete: new ArchiveDeal({ deals: repos.deals }),
363
+ },
305
364
  }),
306
365
  });
307
366
  }
@@ -314,19 +373,66 @@ export type CrmApp = ReturnType<typeof createApp>;
314
373
  | Output | What it is |
315
374
  | --- | --- |
316
375
  | `app` | The implemented ts-pf router, for `FetchHandler` and `createLocalClient` |
317
- | `useCases` | The hexok instance that serves each procedure: generated, override or method, each typed precisely |
376
+ | `useCases` | The hexok instance that serves each procedure: generated, override or method, each typed precisely. Server code: it returns whole documents, unmasked. A second gateway that serves clients from it must call through `createLocalClient(app)`, or withhold maskable fields itself |
318
377
  | `repos` | A `Repo<C>` per collection: the objects the factories received |
319
378
  | `onError` | `onError(logger)` for `FetchHandler` |
320
379
  | `context` | `context({ actor, logger })`: the context for a direct `useCases.*.execute` call |
321
380
  | `ensure` | `ensure()`: creates each collection's declared indexes, in definition order, and never drops one |
322
381
 
323
- - `methods` and `overrides` are factories, `({ repos }) => instances`, keyed by slug and then name. Each is required exactly when a collection declared one.
382
+ - `methods` and `overrides` are factories, `({ repos }) => instances`, keyed by slug and then name. Each is required exactly when a collection declared one. `overrides` also receives `generated`; see [An override that adds a rule](#an-override-that-adds-a-rule).
324
383
  - `access` replaces the functions given at `.collection()` with another `Access` adapter.
325
384
  - `app` adds a fresh `access` to each call's context. A direct caller gets one from `context()`. Access answers are kept on the context, so make one per call or per job.
326
385
  - `events` must take every collection's events. One that cannot is a compile error that names each refused token.
327
386
  - Await `ensure()` after the store has started and before serving, as the CRM's [`server.ts`](#build) does.
328
387
  - `Framework<Actor, D, E, Tenanted>` is the definition's type.
329
388
 
389
+ #### An override that adds a rule
390
+
391
+ An override that only adds a rule checks the input, then returns the generated operation through `generated`. The crm's deals close only through `deals.close`, so its create and update refuse a won or lost stage, and any `closedAt`, then do what the generated ones do:
392
+
393
+ ```ts
394
+ // examples/crm/src/app/use-cases/deals/update-deal.ts
395
+ export class UpdateDeal extends AppUseCase('deals.update', {
396
+ collection: Deals,
397
+ }) {
398
+ constructor(
399
+ private readonly deps: {
400
+ update: (
401
+ ctx: AppCtx,
402
+ input: UpdateInput<typeof Deals>,
403
+ ) => Promise<Doc<typeof Deals>>;
404
+ },
405
+ ) {
406
+ super();
407
+ }
408
+
409
+ async execute(
410
+ ctx: AppCtx,
411
+ input: UpdateInput<typeof Deals>,
412
+ ): Promise<Doc<typeof Deals>> {
413
+ refuseClosing(input);
414
+ return this.deps.update(ctx, input);
415
+ }
416
+ }
417
+ ```
418
+
419
+ ```ts
420
+ // examples/crm/src/servers/app.ts
421
+ overrides: ({ repos, generated }) => ({
422
+ deals: {
423
+ create: new CreateDeal({ create: generated.deals.create }),
424
+ update: new UpdateDeal({ update: generated.deals.update }),
425
+ delete: new ArchiveDeal({ deals: repos.deals }),
426
+ },
427
+ }),
428
+ ```
429
+
430
+ - `generated.<slug>.<operation>(ctx, input)` runs that generated operation: it parses the input, takes the call's access scope, runs the hooks, writes, and publishes the event. A relation's is `generated.<slug>.<relation>.<op>`. It holds only the operations the app overrides: `generated.deals.update` exists because deals overrides update, and `generated.companies.create` does not.
431
+ - Each body checks what its own action needs: create's access, with the data it writes; a field withheld from the caller in an update patch, or in a find's or count's `where` or `sort`; and a read's `populate` keys. So a call from another override, such as a create override that calls `generated.deals.update`, skips nothing.
432
+ - It runs no guards, logging or spans. The override's own use case has run them, so they run once, and the access function runs once.
433
+ - It is typed as a direct caller sees the generated use case: it takes the schema's input type and returns the stored document. The router masks the override's result, as it masks every result.
434
+ - An override that changes what the operation does, such as `ArchiveDeal`, writes through `repos` instead, and publishes its own events.
435
+
330
436
  The server starts the store, runs the migrations, creates the indexes, then serves:
331
437
 
332
438
  ```ts
@@ -377,7 +483,7 @@ Access decides what a call may see and change. It is a filter in the query: Latt
377
483
  - A `Where` on a field `C` lacks, a key that is not an action or a method, and a method with no function are compile errors.
378
484
  - An access `Where` is ANDed with the caller's `where`, so a caller can only narrow it.
379
485
 
380
- A family guard checks access before every `execute`: generated operations, overrides and methods. The refusal is logged once. Each function runs once per call.
486
+ A family guard checks access before every `execute`: generated operations, overrides and methods. The refusal is logged once. Each function runs once per call. Create's function receives the parsed data, and runs again only when an override hands create's body different data.
381
487
 
382
488
  A hand-written use case gets its filter with `ctx.access.scope(C, action)`, and passes the `Scope` to its repo calls. It may ask for another collection's scope too, such as `ctx.access.scope(Posts, 'find')`.
383
489
 
@@ -445,7 +551,8 @@ const Projects = collection('projects', {
445
551
  });
446
552
  ```
447
553
 
448
- - A ref is a string: Zod's methods work on it, and `ref('users').min(1).optional()` is still a ref.
554
+ - A ref is a string: Zod's methods work on it, and `ref('users').max(64).optional()` is still a ref.
555
+ - A ref refuses an empty id with `VALIDATION` at its path: no document has one. The message is "Choose the company", from the slug's label, or "Choose one" when the label has no singular core can find, such as `people`. An optional ref may still be left out.
449
556
  - A slug that is not a collection of the framework is a compile error and a throw at `build()`, and on `.contract`. Collections may be added in any order.
450
557
  - A write does not check that the referenced document exists. Deleting it is where refs are kept whole.
451
558
  - Each ref gets an index in `ensure()`, led by the tenant field, unless the collection declares one with the same keys.
@@ -533,14 +640,20 @@ A collection names the fields a caller's rules may withhold, with `maskable`. Co
533
640
  // examples/crm/src/domain/collections/deals.ts
534
641
  export const Deals = collection('deals', {
535
642
  schema: z.object({
536
- title: z.string().min(1),
643
+ // The messages are what a form shows at the field.
644
+ title: z.string().min(1, 'Enter a title'),
537
645
  // An archived deal still refers to its company, so it restricts too.
538
646
  companyId: ref('companies'),
539
- amount: z.number().nonnegative(),
647
+ amount: z
648
+ .number({ error: 'Enter an amount' })
649
+ .nonnegative('An amount cannot be negative'),
540
650
  stage: z.enum(dealStages).default('lead'),
541
651
  // deals.delete archives: the row stays, with archived set.
542
652
  archived: z.boolean().default(false),
543
653
  closedAt: z.iso.datetime().optional(),
654
+ // The user who works the deal. A deal may be unassigned.
655
+ ownerId: z.string().min(1).optional(),
656
+ expectedCloseDate: z.iso.date().optional(),
544
657
  }),
545
658
  tenant: 'organizationId',
546
659
  // The people on a deal, and what each is to it. A contact on a deal
@@ -553,9 +666,6 @@ export const Deals = collection('deals', {
553
666
  },
554
667
  // Only managers and support see amounts: the contract's fields rule.
555
668
  maskable: ['amount'],
556
- // The pipeline view: one organization's deals in a stage, newest first.
557
- indexes: [{ fields: { organizationId: 1, stage: 1, createdAt: -1 } }],
558
- });
559
669
  ```
560
670
 
561
671
  - A withheld field is left out of what a client receives: `get`, `find`, `create`, `update` and `delete`, a relation's `list`, and documents populated into another collection's read, under the caller's rule for that collection. It is masked where every procedure returns to a client (HTTP, `createLocalClient`, MCP), so overrides and methods are masked too.
@@ -590,6 +700,12 @@ export class DomainEvents extends EventCatalog('domain-events', {
590
700
  dealsCreated: Deals.events.created,
591
701
  dealsUpdated: Deals.events.updated,
592
702
  dealsDeleted: Deals.events.deleted,
703
+ activitiesCreated: Activities.events.created,
704
+ activitiesUpdated: Activities.events.updated,
705
+ activitiesDeleted: Activities.events.deleted,
706
+ tasksCreated: Tasks.events.created,
707
+ tasksUpdated: Tasks.events.updated,
708
+ tasksDeleted: Tasks.events.deleted,
593
709
  membershipsCreated: Memberships.events.created,
594
710
  membershipsUpdated: Memberships.events.updated,
595
711
  membershipsDeleted: Memberships.events.deleted,
@@ -603,7 +719,7 @@ export class DomainEvents extends EventCatalog('domain-events', {
603
719
  }) {}
604
720
  ```
605
721
 
606
- - Generated writes publish through `build({ events })` after the store write succeeds. A publish failure reaches the caller, and the write stays. Reads publish nothing. Overrides and methods publish their own events.
722
+ - Generated writes publish through `build({ events })` after the store write succeeds. A publish failure reaches the caller, and the write stays. Reads publish nothing. An override that calls `generated` publishes what the generated operation does. Other overrides and methods publish their own events.
607
723
  - Collection events stay inside the product. Another product or a customer gets a mapping of its own: an integration event or a webhook. See [A worker](#a-worker-webhooks-and-integration-events).
608
724
 
609
725
  ### Tracing
@@ -658,8 +774,8 @@ The root README's [Getting started](../../README.md#4-the-server) has the smalle
658
774
  Lattice never imports auth. The edge decides who the actor is, and passes it in the call context. In the crm, a `@hexok/auth` session proves the user, and a membership lookup checks the organization the request names, on every request:
659
775
 
660
776
  ```ts
661
- // examples/crm/src/servers/http/handler.ts
662
- async function signedIn(
777
+ // examples/crm/src/servers/http/caller.ts
778
+ export async function signedIn(
663
779
  deps: HttpDeps,
664
780
  request: Request,
665
781
  logger: Logger,
@@ -679,8 +795,8 @@ async function signedIn(
679
795
  ```
680
796
 
681
797
  ```ts
682
- // examples/crm/src/servers/http/handler.ts
683
- function actorContext(deps: HttpDeps) {
798
+ // examples/crm/src/servers/http/caller.ts
799
+ export function actorContext(deps: HttpDeps) {
684
800
  const memberships = deps.crm.repos.memberships;
685
801
  return async (
686
802
  userId: string,
@@ -756,7 +872,8 @@ Sign-in is not a Lattice procedure: every Lattice procedure has an actor, and a
756
872
  export const authContract = router({
757
873
  login: procedure
758
874
  .input(loginInput)
759
- .output(z.object({ token: z.string().min(1) }))
875
+ // The user's id too, so a client can find its own membership and tasks.
876
+ .output(z.object({ token: z.string().min(1), userId: z.string().min(1) }))
760
877
  .errors({
761
878
  UNAUTHORIZED: { status: 401, message: 'The credentials are not valid' },
762
879
  }),
@@ -783,7 +900,7 @@ export const authContract = router({
783
900
  { logger: context.logger },
784
901
  input,
785
902
  );
786
- return { token: await deps.sessions.open({ userId }) };
903
+ return { token: await deps.sessions.open({ userId }), userId };
787
904
  } catch (error) {
788
905
  if (!LoginError.is(error)) throw error;
789
906
  throw new PFError({
@@ -895,7 +1012,9 @@ const tk = createToolkit(contract).$context<CallContext<Actor>>();
895
1012
 
896
1013
  // No access rule allows these, so every call is FORBIDDEN: as tools they
897
1014
  // would only cost a model context and wrong turns. They stay on /rpc.
1015
+ // activities.log is how an activity is created.
898
1016
  const alwaysDenied = [
1017
+ tk.activities.create,
899
1018
  tk.memberships.create,
900
1019
  tk.memberships.update,
901
1020
  tk.memberships.delete,
@@ -921,7 +1040,7 @@ tk.$coverage({ toolsets: [crmTools], exclude: alwaysDenied });
921
1040
  The tools run in process through the implemented router, so access, tenancy, masking, errors and spans are the same as on `/rpc`. The edge checks the session before the MCP SDK reads the request, and the tool context reuses the auth edge's `actorContext`:
922
1041
 
923
1042
  ```ts
924
- // examples/crm/src/servers/http/handler.ts
1043
+ // examples/crm/src/servers/http/mcp-edge.ts
925
1044
  const tools = bindTools(crmTools, {
926
1045
  app: deps.crm.app,
927
1046
  onError,
@@ -966,36 +1085,36 @@ The crm serves it at `GET /openapi.json`, and the catalog itself at `GET /catalo
966
1085
  [`@latticecms/admin`](../admin) renders the app from the catalog it serves. The crm's page signs in through `/auth`, lists the user's organizations for a switcher from `/auth organizations`, which needs no organization header, and calls the API with the picked one:
967
1086
 
968
1087
  ```tsx
969
- // examples/crm/src/web/app.tsx
970
- const auth = useMemo(
971
- () => authClient(sessionFetch(token, undefined, onSignedOut)),
972
- [token, onSignedOut],
973
- );
974
- // A 401 signs out through the session's fetch. Anything else, such as a
975
- // dropped connection, can be tried again.
976
- const load = useCallback(() => {
977
- setFailed(false);
978
- auth.organizations({}).then(setOrganizations, () => setFailed(true));
979
- }, [auth]);
980
- useEffect(load, [load]);
981
- const current =
982
- organizations?.find(({ id }) => id === picked) ?? organizations?.[0];
983
- const fetch = useMemo(
984
- () => sessionFetch(token, current?.id, onSignedOut),
985
- [token, current, onSignedOut],
986
- );
1088
+ // examples/crm/src/web/signed-in.tsx
1089
+ const auth = useMemo(
1090
+ () => authClient(sessionFetch(signed.token, undefined, onSignedOut)),
1091
+ [signed.token, onSignedOut],
1092
+ );
1093
+ // A 401 signs out through the session's fetch. Anything else, such as a
1094
+ // dropped connection, can be tried again.
1095
+ const load = useCallback(() => {
1096
+ setFailed(false);
1097
+ auth.organizations({}).then(setOrganizations, () => setFailed(true));
1098
+ }, [auth]);
1099
+ useEffect(load, [load]);
1100
+ const organization =
1101
+ organizations?.find(({ id }) => id === picked) ?? organizations?.[0];
1102
+ const fetch = useMemo(
1103
+ () => sessionFetch(signed.token, organization?.id, onSignedOut),
1104
+ [signed.token, organization, onSignedOut],
1105
+ );
987
1106
  ```
988
1107
 
989
- `<Admin>` is keyed by the organization, so a switch starts with an empty cache and never shows another organization's rows:
1108
+ Every page, `<Admin>` among them, sits under a cache keyed by the organization, so a switch remounts them with an empty cache and never shows another organization's rows:
990
1109
 
991
1110
  ```tsx
992
- // examples/crm/src/web/app.tsx
993
- <Admin
994
- // A new organization is a new admin, with an empty cache.
995
- key={current?.id ?? 'support'}
996
- fetch={fetch}
997
- catalogUrl="/catalog.json"
998
- basePath="/admin"
1111
+ // examples/crm/src/web/api.tsx
1112
+ <SWRConfig
1113
+ key={organizationId ?? 'support'}
1114
+ value={{ provider: () => new Map(), shouldRetryOnError: retryable }}
1115
+ >
1116
+ <ListsProvider>{children}</ListsProvider>
1117
+ </SWRConfig>
999
1118
  ```
1000
1119
 
1001
1120
  The edge checks the organization header on every call, as in [The auth edge](#the-auth-edge). The admin's README has its props, the catalog route and what it renders. The smallest page, a token form, is in the root README's [Getting started](../../README.md#5-the-admin-page).
@@ -1041,13 +1160,14 @@ Returns a `Collection` with `slug`, `label`, `schema`, `tenant`, `indexes`, `out
1041
1160
  | string | `eq`, `ne`, `in`, `nin`, `gt`, `gte`, `lt`, `lte`, `contains`, `exists` |
1042
1161
  | number | `eq`, `ne`, `in`, `nin`, `gt`, `gte`, `lt`, `lte`, `exists` |
1043
1162
  | boolean, enum | `eq`, `ne`, `in`, `nin`, `exists` |
1044
- | array of strings, numbers or enum values | `has`, `exists` |
1163
+ | array of strings, numbers or enum values | `has`, `nhas`, `exists` |
1045
1164
  | array of anything else, object, anything else | `exists` |
1046
1165
 
1047
1166
  - Several fields or operators must all match. `and` and `or` nest. Null and missing follow MongoDB's semantics.
1048
1167
  - `contains` is a case-insensitive substring, never a regex.
1049
- - `has` matches an array with an element equal to its value. A missing or null array has none.
1050
- - `sort` is an array such as `['-createdAt', 'title']`. Only required, non-null string, number and enum fields sort. The default is `['-createdAt']`, and `id` is always the last tiebreak. Its JSON Schema lists every key it accepts, so a client sees the valid keys.
1168
+ - `has` matches an array with an element equal to its value. `nhas` matches an array with no such element. A missing or null array has none, so `nhas` matches it; add `exists: true` to require the array.
1169
+ - `sort` is an array such as `['-createdAt', 'title']`. String, number and enum fields sort, optional and nullable ones too. The default is `['-createdAt']`, and `id` is always the last tiebreak. Its JSON Schema lists every key it accepts, so a client sees the valid keys.
1170
+ - A document with no value for a sort field, missing or null, comes after every document with one, ascending or descending. Documents with no value order by the remaining keys, then `id`. The cursor records that its document had no value, so pages stay stable across that boundary.
1051
1171
  - `limit` is 1 to 100, default 20. `next` is an opaque cursor for `after`, or null on the last page.
1052
1172
  - A field or operator the schema does not allow is a type error and `VALIDATION`.
1053
1173
 
@@ -1119,6 +1239,8 @@ export class ArchiveDeal extends AppUseCase('deals.delete', {
1119
1239
 
1120
1240
  `@latticecms/core/store` has what an adapter needs: the `CollectionStore` port, its types (`StoredDoc`, `Patch`, `FindQuery`, `Page`, `Index`), the parsed filter (`AnyWhere`, with `FieldOps` for each field's operators), and the cursor helpers (`orderOf`, `Order`, `after`, `encodeCursor`). A store receives values Lattice has parsed. Filters follow MongoDB's null and missing rules, and the keyset of `after` is itself an `AnyWhere`, so a store applies it like any filter.
1121
1241
 
1242
+ `FindQuery.optional` names the sort fields a document may lack. Pass it to `orderOf(query.sort, query.optional)`: each `Order` key then says whether it is optional, and `after` and `encodeCursor` handle a missing value. The store must order a document with no value for a key, missing or null, after every document with one, in either direction, and tie such documents on that key. A plain sort is enough wherever no ascending key is optional.
1243
+
1122
1244
  `@latticecms/core/store/conformance` has `storeCases`: the cases every store passes, asserted with `node:assert`, so any test runner runs them. Give each case a fresh store:
1123
1245
 
1124
1246
  ```ts
@@ -1146,6 +1268,7 @@ it.each(storeCases.filter((c) => !c.needs?.includes('transactions')))('$name', (
1146
1268
  - `Withheld` is `{ id: string }`: a populated document the caller may not read.
1147
1269
  - `LatticeMeta` is the `lattice` key of each procedure's meta; see [MCP and OpenAPI](#mcp-and-openapi).
1148
1270
  - `ClientDoc<C>` is a collection's document as a client receives it, each maskable field optional.
1271
+ - `CreateInput<C>` is what create takes: the schema's input, so a defaulted field may be left out. `UpdateInput<C>` is what update takes: the `id`, and each field to change, with `null` on each field it clears. An override of create or update declares them as its input. Neither has the tenant field.
1149
1272
  - `ReadUseCase<Proc, Ctx>` is the type of a populating read in `useCases`: its `execute` is generic in the `populate` list.
1150
1273
  - `Ref<Slug, OnDelete>`, `Many<Target, Through, Fields, OnDelete>`, `RelationsOf` and `JoinShape` are the types of refs, relations and join collections. `OnDelete` and `ManyOnDelete` are their `onDelete` values. An app names them only when it exports its collections from a package with declarations.
1151
1274
  - `CallAccess` is the type of `ctx.access`. `AccessRequest<Actor>` is what `Access.check` receives.
package/dist/access.d.ts CHANGED
@@ -188,9 +188,8 @@ export declare class CallAccess {
188
188
  readonly maskable: readonly string[];
189
189
  }): Promise<ReadonlySet<string>>;
190
190
  /**
191
- * The tenant id a generated create stamps on `collection`, without asking
192
- * access again: the guard did, with the create's data. Undefined for a
193
- * global collection.
191
+ * The tenant id a generated create stamps on `collection`. Undefined for
192
+ * a global collection.
194
193
  */
195
194
  static stampOf(access: CallAccess, collection: AnyCollection): string | undefined;
196
195
  private answer;
@@ -1 +1 @@
1
- {"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../src/access.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,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,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IAuB5B;;;;;OAKG;IACH,MAAM,CAAC,QAAQ,CACb,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE;QACV,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;KACtC,GACA,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAgB/B;;;OAGG;IACH,MAAM,CAAC,OAAO,CACZ,MAAM,EAAE,UAAU,EAClB,UAAU,EAAE,aAAa,GACxB,MAAM,GAAG,SAAS;IAiCrB,OAAO,CAAC,MAAM;CAgCf;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EACjC,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,EACrB,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,EACxB,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC,GAC5D,aAAa,CAAC,KAAK,CAAC,CA+BtB;AAED,kFAAkF;AAClF,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,KAAK,GAAG,OAAO,QAAQ,GAC7B,QAAQ,GAAG,SAAS,CAQtB"}
package/dist/access.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { isDeepStrictEqual } from 'node:util';
1
2
  import { Adapter, Port, validate } from 'hexok';
2
3
  import { LatticeError } from './errors.js';
3
4
  import { Scope, tenancy, tenantClause } from './tenancy.js';
@@ -71,6 +72,8 @@ export class CallAccess {
71
72
  #logged = new Set();
72
73
  /** The maskable fields withheld from the caller, by collection slug. */
73
74
  #withheld = new Map();
75
+ /** The last create answer by collection slug, with the data it was asked for. */
76
+ #created = new Map();
74
77
  /**
75
78
  * @param actor The call's actor as the family's schema parsed it, or a
76
79
  * failed parse. The family's first guard reads it: nothing after that
@@ -131,9 +134,8 @@ export class CallAccess {
131
134
  return answer;
132
135
  }
133
136
  /**
134
- * The tenant id a generated create stamps on `collection`, without asking
135
- * access again: the guard did, with the create's data. Undefined for a
136
- * global collection.
137
+ * The tenant id a generated create stamps on `collection`. Undefined for
138
+ * a global collection.
137
139
  */
138
140
  static stampOf(access, collection) {
139
141
  const tenant = access.#tenantOf(collection);
@@ -164,8 +166,22 @@ export class CallAccess {
164
166
  this.caller.bypassed(slug, action);
165
167
  }
166
168
  answer(slug, action, data) {
167
- if (action === 'create')
168
- return this.caller.check(slug, action, data);
169
+ if (action === 'create') {
170
+ // Create's answer depends on its data. The family guard and the
171
+ // create body both ask (0036): with equal data, the function runs
172
+ // once; an override that changed the data is asked again. So is a
173
+ // create whose schema has a default that differs per parse, such as a
174
+ // generated id or a timestamp: the two parses are unequal, which costs
175
+ // a second run and nothing else. The key is a copy, because the body
176
+ // hands its data to beforeChange, which may change it in place.
177
+ const kept = this.#created.get(slug);
178
+ if (kept !== undefined && isDeepStrictEqual(kept.data, data)) {
179
+ return kept.answer;
180
+ }
181
+ const answer = this.caller.check(slug, action, data);
182
+ this.#created.set(slug, { data: structuredClone(data), answer });
183
+ return answer;
184
+ }
169
185
  let answers = this.#answers.get(slug);
170
186
  if (answers === undefined) {
171
187
  answers = new Map();
@@ -1 +1 @@
1
- {"version":3,"file":"access.js","sourceRoot":"","sources":["../src/access.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGhD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EAAE,KAAK,EAAe,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAiB,IAAI,EAA+B,MAAM,YAAY,CAAC;AAY9E;;;;;GAKG;AACH,MAAM,OAAgB,MAAwB,SAAQ,IAAI,CAAC,QAAQ,CAAC;CAYnE;AA+FD;;;GAGG;AACH,MAAM,OAAO,gBAAi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