@open-commune/core 0.2.21 → 0.2.22

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/dist/dtos.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { o as AUDIENCE_PERIODS, p as AcceptInvitationDto, r as ApiTokenCreateDto, l as AudienceAsk, m as AudiencePanelData, t as AudienceQuery, u as AudienceSummary, D as DefinitionCreateDto, h as DefinitionUpdateDto, v as ERROR_TYPES, j as EntryCreateDto, i as EntrySearchHit, k as EntryUpdateDto, n as ErrorType, w as InviteDto, L as LoginDto, d as MediaFinalizeDto, x as MediaRequestUploadDto, e as MediaUpdateDto, a as OrganizationInitDto, b as OrganizationUpdateDto, P as PublicUser, R as RequestPasswordResetDto, z as SessionUser, B as UpdateOwnProfileDto, F as UserUpdateDto, G as acceptInvitationDto, J as apiTokenCreateDto, Q as audienceAskDto, T as audienceQuerySchema, V as audienceSummarySchema, X as definitionCreateDto, Y as definitionDto, Z as definitionUpdateDto, $ as entryCreateDto, a0 as entryDto, a1 as entrySearchHitDto, a2 as entryUpdateDto, a4 as inviteDto, a5 as isErrorType, a6 as loginDto, a8 as mediaFinalizeDto, a9 as mediaRequestUploadDto, aa as mediaUpdateDto, ac as organizationInitDto, ad as organizationUpdateDto, ae as requestPasswordResetDto, ag as toPublicUser, ah as toSessionUser, ai as updateOwnProfileDto, aj as userUpdateDto } from './shared/core.C8czg6gz.mjs';
1
+ export { o as AUDIENCE_PERIODS, p as AcceptInvitationDto, r as ApiTokenCreateDto, l as AudienceAsk, m as AudiencePanelData, t as AudienceQuery, u as AudienceSummary, D as DefinitionCreateDto, h as DefinitionUpdateDto, v as ERROR_TYPES, j as EntryCreateDto, i as EntrySearchHit, k as EntryUpdateDto, n as ErrorType, w as InviteDto, L as LoginDto, d as MediaFinalizeDto, x as MediaRequestUploadDto, e as MediaUpdateDto, a as OrganizationInitDto, b as OrganizationUpdateDto, P as PublicUser, R as RequestPasswordResetDto, z as SessionUser, B as UpdateOwnProfileDto, F as UserUpdateDto, G as acceptInvitationDto, J as apiTokenCreateDto, Q as audienceAskDto, T as audienceQuerySchema, V as audienceSummarySchema, X as definitionCreateDto, Y as definitionDto, Z as definitionUpdateDto, $ as entryCreateDto, a0 as entryDto, a1 as entryListedDto, a2 as entrySearchHitDto, a3 as entryUpdateDto, a5 as inviteDto, a6 as isErrorType, a7 as loginDto, a9 as mediaFinalizeDto, aa as mediaRequestUploadDto, ab as mediaUpdateDto, ad as organizationInitDto, ae as organizationUpdateDto, af as requestPasswordResetDto, ah as toPublicUser, ai as toSessionUser, aj as updateOwnProfileDto, ak as userUpdateDto } from './shared/core.C-cdTqDU.mjs';
2
2
  import 'drizzle-zod';
3
3
  import 'drizzle-orm/sqlite-core';
4
4
  import 'zod';
package/dist/dtos.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { o as AUDIENCE_PERIODS, p as AcceptInvitationDto, r as ApiTokenCreateDto, l as AudienceAsk, m as AudiencePanelData, t as AudienceQuery, u as AudienceSummary, D as DefinitionCreateDto, h as DefinitionUpdateDto, v as ERROR_TYPES, j as EntryCreateDto, i as EntrySearchHit, k as EntryUpdateDto, n as ErrorType, w as InviteDto, L as LoginDto, d as MediaFinalizeDto, x as MediaRequestUploadDto, e as MediaUpdateDto, a as OrganizationInitDto, b as OrganizationUpdateDto, P as PublicUser, R as RequestPasswordResetDto, z as SessionUser, B as UpdateOwnProfileDto, F as UserUpdateDto, G as acceptInvitationDto, J as apiTokenCreateDto, Q as audienceAskDto, T as audienceQuerySchema, V as audienceSummarySchema, X as definitionCreateDto, Y as definitionDto, Z as definitionUpdateDto, $ as entryCreateDto, a0 as entryDto, a1 as entrySearchHitDto, a2 as entryUpdateDto, a4 as inviteDto, a5 as isErrorType, a6 as loginDto, a8 as mediaFinalizeDto, a9 as mediaRequestUploadDto, aa as mediaUpdateDto, ac as organizationInitDto, ad as organizationUpdateDto, ae as requestPasswordResetDto, ag as toPublicUser, ah as toSessionUser, ai as updateOwnProfileDto, aj as userUpdateDto } from './shared/core.bkXizwPE.js';
1
+ export { o as AUDIENCE_PERIODS, p as AcceptInvitationDto, r as ApiTokenCreateDto, l as AudienceAsk, m as AudiencePanelData, t as AudienceQuery, u as AudienceSummary, D as DefinitionCreateDto, h as DefinitionUpdateDto, v as ERROR_TYPES, j as EntryCreateDto, i as EntrySearchHit, k as EntryUpdateDto, n as ErrorType, w as InviteDto, L as LoginDto, d as MediaFinalizeDto, x as MediaRequestUploadDto, e as MediaUpdateDto, a as OrganizationInitDto, b as OrganizationUpdateDto, P as PublicUser, R as RequestPasswordResetDto, z as SessionUser, B as UpdateOwnProfileDto, F as UserUpdateDto, G as acceptInvitationDto, J as apiTokenCreateDto, Q as audienceAskDto, T as audienceQuerySchema, V as audienceSummarySchema, X as definitionCreateDto, Y as definitionDto, Z as definitionUpdateDto, $ as entryCreateDto, a0 as entryDto, a1 as entryListedDto, a2 as entrySearchHitDto, a3 as entryUpdateDto, a5 as inviteDto, a6 as isErrorType, a7 as loginDto, a9 as mediaFinalizeDto, aa as mediaRequestUploadDto, ab as mediaUpdateDto, ad as organizationInitDto, ae as organizationUpdateDto, af as requestPasswordResetDto, ah as toPublicUser, ai as toSessionUser, aj as updateOwnProfileDto, ak as userUpdateDto } from './shared/core.BLcc-Hxe.js';
2
2
  import 'drizzle-zod';
3
3
  import 'drizzle-orm/sqlite-core';
4
4
  import 'zod';
package/dist/dtos.mjs CHANGED
@@ -1 +1 @@
1
- export{A as AUDIENCE_PERIODS,E as ERROR_TYPES,a as acceptInvitationDto,b as apiTokenCreateDto,c as audienceAskDto,d as audienceQuerySchema,e as audienceSummarySchema,f as definitionCreateDto,g as definitionDto,h as definitionUpdateDto,i as entryCreateDto,j as entryDto,k as entrySearchHitDto,l as entryUpdateDto,m as inviteDto,n as isErrorType,o as loginDto,p as mediaFinalizeDto,q as mediaRequestUploadDto,r as mediaUpdateDto,s as organizationInitDto,t as organizationUpdateDto,u as requestPasswordResetDto,v as toPublicUser,w as toSessionUser,x as updateOwnProfileDto,y as userUpdateDto}from"./shared/core.BR6-3c3l.mjs";import"drizzle-zod";import"zod";import"./domains/collections/utils.mjs";import"./domains/collections/constants.mjs";import"drizzle-orm/sqlite-core";
1
+ export{A as AUDIENCE_PERIODS,E as ERROR_TYPES,a as acceptInvitationDto,b as apiTokenCreateDto,c as audienceAskDto,d as audienceQuerySchema,e as audienceSummarySchema,f as definitionCreateDto,g as definitionDto,h as definitionUpdateDto,i as entryCreateDto,j as entryDto,k as entryListedDto,l as entrySearchHitDto,m as entryUpdateDto,n as inviteDto,o as isErrorType,p as loginDto,q as mediaFinalizeDto,r as mediaRequestUploadDto,s as mediaUpdateDto,t as organizationInitDto,u as organizationUpdateDto,v as requestPasswordResetDto,w as toPublicUser,x as toSessionUser,y as updateOwnProfileDto,z as userUpdateDto}from"./shared/core.W03pfXvx.mjs";import"drizzle-zod";import"zod";import"./domains/collections/utils.mjs";import"./domains/collections/constants.mjs";import"drizzle-orm/sqlite-core";
package/dist/index.d.mts CHANGED
@@ -3,11 +3,12 @@ import * as _trpc_server from '@trpc/server';
3
3
  import { z } from 'zod';
4
4
  import * as drizzle_orm_bun_sqlite from 'drizzle-orm/bun-sqlite';
5
5
  import { Database } from 'bun:sqlite';
6
- import { s as schema, U as User, S as Session, I as Invitation, A as ApiToken, O as Organization, N as NewOrganization, a as OrganizationInitDto, b as OrganizationUpdateDto, c as NewMedia, M as Media, d as MediaFinalizeDto, e as MediaUpdateDto, C as CollectionDefinition, f as NewCollectionDefinition, E as Entry, g as NewEntry, D as DefinitionCreateDto, h as DefinitionUpdateDto, i as EntrySearchHit, j as EntryCreateDto, k as EntryUpdateDto, l as AudienceAsk, m as AudiencePanelData, n as ErrorType } from './shared/core.C8czg6gz.mjs';
7
- export { o as AUDIENCE_PERIODS, p as AcceptInvitationDto, q as Address, r as ApiTokenCreateDto, t as AudienceQuery, u as AudienceSummary, v as ERROR_TYPES, w as InviteDto, L as LoginDto, x as MediaRequestUploadDto, y as NewUser, P as PublicUser, R as RequestPasswordResetDto, z as SessionUser, B as UpdateOwnProfileDto, F as UserUpdateDto, G as acceptInvitationDto, H as addressSchema, J as apiTokenCreateDto, K as apiTokens, Q as audienceAskDto, T as audienceQuerySchema, V as audienceSummarySchema, W as collectionDefinitions, X as definitionCreateDto, Y as definitionDto, Z as definitionUpdateDto, _ as entries, $ as entryCreateDto, a0 as entryDto, a1 as entrySearchHitDto, a2 as entryUpdateDto, a3 as invitations, a4 as inviteDto, a5 as isErrorType, a6 as loginDto, a7 as media, a8 as mediaFinalizeDto, a9 as mediaRequestUploadDto, aa as mediaUpdateDto, ab as organization, ac as organizationInitDto, ad as organizationUpdateDto, ae as requestPasswordResetDto, af as sessions, ag as toPublicUser, ah as toSessionUser, ai as updateOwnProfileDto, aj as userUpdateDto, ak as users } from './shared/core.C8czg6gz.mjs';
6
+ import { s as schema, U as User, S as Session, I as Invitation, A as ApiToken, O as Organization, N as NewOrganization, a as OrganizationInitDto, b as OrganizationUpdateDto, c as NewMedia, M as Media, d as MediaFinalizeDto, e as MediaUpdateDto, C as CollectionDefinition, f as NewCollectionDefinition, E as Entry, g as NewEntry, D as DefinitionCreateDto, h as DefinitionUpdateDto, i as EntrySearchHit, j as EntryCreateDto, k as EntryUpdateDto, l as AudienceAsk, m as AudiencePanelData, n as ErrorType } from './shared/core.C-cdTqDU.mjs';
7
+ export { o as AUDIENCE_PERIODS, p as AcceptInvitationDto, q as Address, r as ApiTokenCreateDto, t as AudienceQuery, u as AudienceSummary, v as ERROR_TYPES, w as InviteDto, L as LoginDto, x as MediaRequestUploadDto, y as NewUser, P as PublicUser, R as RequestPasswordResetDto, z as SessionUser, B as UpdateOwnProfileDto, F as UserUpdateDto, G as acceptInvitationDto, H as addressSchema, J as apiTokenCreateDto, K as apiTokens, Q as audienceAskDto, T as audienceQuerySchema, V as audienceSummarySchema, W as collectionDefinitions, X as definitionCreateDto, Y as definitionDto, Z as definitionUpdateDto, _ as entries, $ as entryCreateDto, a0 as entryDto, a1 as entryListedDto, a2 as entrySearchHitDto, a3 as entryUpdateDto, a4 as invitations, a5 as inviteDto, a6 as isErrorType, a7 as loginDto, a8 as media, a9 as mediaFinalizeDto, aa as mediaRequestUploadDto, ab as mediaUpdateDto, ac as organization, ad as organizationInitDto, ae as organizationUpdateDto, af as requestPasswordResetDto, ag as sessions, ah as toPublicUser, ai as toSessionUser, aj as updateOwnProfileDto, ak as userUpdateDto, al as users } from './shared/core.C-cdTqDU.mjs';
8
+ import * as drizzle_orm from 'drizzle-orm';
9
+ import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
8
10
  export { FIELD_TYPES, FieldType, PUBLICATION_STATUSES, PublicationStatus } from './domains/collections/constants.mjs';
9
11
  export { FIELD_VALUE_SCHEMAS, FieldDefinition, buildDataSchema, fieldDefinitionSchema } from './domains/collections/utils.mjs';
10
- import 'drizzle-orm/sqlite-core';
11
12
 
12
13
  declare const envSchema: z.ZodObject<{
13
14
  COMMUN_DATA_DIR: z.ZodDefault<z.ZodString>;
@@ -296,13 +297,13 @@ declare class UsersService {
296
297
  verifyApiToken(token: string): Promise<boolean>;
297
298
  revokeApiToken(id: string): Promise<void>;
298
299
  listApiTokens(): Promise<Pick<{
299
- id: string;
300
300
  name: string;
301
+ id: string;
301
302
  createdAt: string;
302
303
  revokedAt: string | null;
303
304
  tokenHash: string;
304
305
  lastUsedAt: string | null;
305
- }, "id" | "name" | "createdAt" | "revokedAt" | "lastUsedAt">[]>;
306
+ }, "name" | "id" | "createdAt" | "revokedAt" | "lastUsedAt">[]>;
306
307
  }
307
308
 
308
309
  /**
@@ -406,7 +407,7 @@ declare class MediaService {
406
407
  * even though bun:sqlite executes synchronously.
407
408
  */
408
409
  declare class DefinitionRepository {
409
- private readonly db;
410
+ protected readonly db: StoreDb;
410
411
  constructor(db: StoreDb);
411
412
  list(): Promise<CollectionDefinition[]>;
412
413
  findBySlug(slug: string): Promise<CollectionDefinition | undefined>;
@@ -438,7 +439,8 @@ type EntryOrder = 'recent' | 'oldest' | 'title' | 'date_asc' | 'date_desc';
438
439
  * though bun:sqlite executes synchronously.
439
440
  */
440
441
  declare class EntryRepository {
441
- private readonly db;
442
+ protected readonly db: StoreDb;
443
+ private readonly fullText;
442
444
  constructor(db: StoreDb);
443
445
  list(collectionId: string): Promise<Entry[]>;
444
446
  /**
@@ -466,13 +468,16 @@ declare class EntryRepository {
466
468
  */
467
469
  private dateKey;
468
470
  /**
469
- * Text match on the title and the data. One LIKE is enough at a commune's
470
- * scale, and it leaves the title index usable.
471
+ * The entries, joined to what the full-text index finds for a search when
472
+ * there is one: an entry it does not find is left out, and `rank` orders
473
+ * the others, the best first.
471
474
  */
472
- private matching;
475
+ private found;
473
476
  /**
474
- * Text search across collections, most recently updated first — how one
475
- * finds content without knowing where it lives.
477
+ * Text search across collections, the closest first — how one finds content
478
+ * without knowing where it lives. The full-text index ranks them: a word in
479
+ * the title counts more than one in the body. When no entry holds every
480
+ * word, those that hold any of them are returned instead.
476
481
  */
477
482
  search(options: {
478
483
  search: string;
@@ -505,6 +510,79 @@ declare class EntryRepository {
505
510
  delete(id: string): Promise<Entry | undefined>;
506
511
  }
507
512
 
513
+ /** An entry's title and texts, with the words a search found between OPEN and CLOSE. */
514
+ interface MarkedRow {
515
+ entryId: string;
516
+ title: string;
517
+ body: string;
518
+ extra: string;
519
+ }
520
+ /**
521
+ * Database access for the full-text index of the entries. What an entry gives
522
+ * it is computed by SQLite itself, in the view `entries_search_text`: writing
523
+ * the index is copying from it.
524
+ */
525
+ declare class SearchRepository {
526
+ private readonly db;
527
+ constructor(db: StoreDb);
528
+ /** (Re)indexes one entry as it now is; a deleted one leaves the index. */
529
+ reindexEntry(entryId: string): void;
530
+ /** (Re)indexes every entry of a collection: its fields decide what each gives. */
531
+ reindexCollection(collectionId: string): void;
532
+ /**
533
+ * The entries a search matches, to join a query on: `entryId`, and `rank`
534
+ * to order by, the best first. Undefined when nothing searchable was typed.
535
+ */
536
+ matching(search: string, every?: boolean): drizzle_orm_sqlite_core.SubqueryWithSelection<{
537
+ entryId: drizzle_orm_sqlite_core.SQLiteColumn<{
538
+ name: "entry_id";
539
+ tableName: "entries_fts";
540
+ dataType: "string";
541
+ columnType: "SQLiteText";
542
+ data: string;
543
+ driverParam: string;
544
+ notNull: true;
545
+ hasDefault: false;
546
+ isPrimaryKey: false;
547
+ isAutoincrement: false;
548
+ hasRuntimeDefault: false;
549
+ enumValues: [string, ...string[]];
550
+ baseColumn: never;
551
+ identity: undefined;
552
+ generated: undefined;
553
+ }, {}, {
554
+ length: number | undefined;
555
+ }>;
556
+ rank: drizzle_orm.SQL.Aliased<number>;
557
+ }, "fts"> | undefined;
558
+ /** The title of these entries with the found words marked, and a passage of each text around them. */
559
+ marked(search: string, entryIds: string[]): MarkedRow[];
560
+ /** The words of these entries, field by field, in their collection's order. */
561
+ words(entryIds: string[]): {
562
+ entryId: string;
563
+ position: number;
564
+ field: string;
565
+ extra: boolean;
566
+ word: string;
567
+ }[];
568
+ }
569
+
570
+ /**
571
+ * Where a search found an entry: its title and texts as the index marked
572
+ * them, the words found between \u0002 and \u0003, and the field the first
573
+ * one comes from. Cutting them into what a screen shows is the screen's
574
+ * business.
575
+ */
576
+ interface Found {
577
+ title: string;
578
+ /** A passage of what a reader may search, around the words found. */
579
+ body: string;
580
+ /** A passage of what only the admin searches. */
581
+ extra: string;
582
+ /** The label of the field holding the first word found outside the title. */
583
+ field?: string;
584
+ }
585
+
508
586
  /**
509
587
  * The content engine: collection definitions over a closed field-type set, and
510
588
  * their entries, validated against the Zod schema generated from each definition.
@@ -513,7 +591,8 @@ declare class CollectionsService {
513
591
  private readonly definitions;
514
592
  private readonly entries;
515
593
  private readonly media;
516
- constructor(definitions: DefinitionRepository, entries: EntryRepository, media: MediaService);
594
+ private readonly fullText;
595
+ constructor(definitions: DefinitionRepository, entries: EntryRepository, media: MediaService, fullText: SearchRepository);
517
596
  listDefinitions(): Promise<CollectionDefinition[]>;
518
597
  getDefinition(idOrSlug: string): Promise<CollectionDefinition>;
519
598
  createDefinition(input: DefinitionCreateDto, actorId?: string): Promise<CollectionDefinition>;
@@ -538,7 +617,9 @@ declare class CollectionsService {
538
617
  skip?: number;
539
618
  limit?: number;
540
619
  order?: EntryOrder;
541
- }): Promise<Entry[]>;
620
+ }): Promise<(Entry & {
621
+ found?: Found;
622
+ })[]>;
542
623
  /** A collection's id from its id or its slug; none, for the whole site. */
543
624
  private collectionIdOf;
544
625
  /** The entries last touched across every collection, most recent first. */
@@ -754,14 +835,10 @@ declare const organizationRouter: _trpc_server.TRPCBuiltRouter<{
754
835
  input: void;
755
836
  output: {
756
837
  type: "commune" | "intercommunality" | "syndicate" | "other";
757
- id: number;
838
+ description: string | null;
758
839
  name: string;
840
+ id: number;
759
841
  slug: string;
760
- description: string | null;
761
- updatedBy: string | null;
762
- legacyExtra: Record<string, unknown> | null;
763
- createdAt: string;
764
- updatedAt: string;
765
842
  address: {
766
843
  street?: string | undefined;
767
844
  postalCode?: string | undefined;
@@ -769,6 +846,10 @@ declare const organizationRouter: _trpc_server.TRPCBuiltRouter<{
769
846
  } | null;
770
847
  deployment: Record<string, unknown> | null;
771
848
  settings: Record<string, unknown> | null;
849
+ updatedBy: string | null;
850
+ legacyExtra: Record<string, unknown> | null;
851
+ createdAt: string;
852
+ updatedAt: string;
772
853
  } | null;
773
854
  meta: object;
774
855
  }>;
@@ -788,14 +869,10 @@ declare const organizationRouter: _trpc_server.TRPCBuiltRouter<{
788
869
  };
789
870
  output: {
790
871
  type: "commune" | "intercommunality" | "syndicate" | "other";
791
- id: number;
872
+ description: string | null;
792
873
  name: string;
874
+ id: number;
793
875
  slug: string;
794
- description: string | null;
795
- updatedBy: string | null;
796
- legacyExtra: Record<string, unknown> | null;
797
- createdAt: string;
798
- updatedAt: string;
799
876
  address: {
800
877
  street?: string | undefined;
801
878
  postalCode?: string | undefined;
@@ -803,15 +880,19 @@ declare const organizationRouter: _trpc_server.TRPCBuiltRouter<{
803
880
  } | null;
804
881
  deployment: Record<string, unknown> | null;
805
882
  settings: Record<string, unknown> | null;
883
+ updatedBy: string | null;
884
+ legacyExtra: Record<string, unknown> | null;
885
+ createdAt: string;
886
+ updatedAt: string;
806
887
  };
807
888
  meta: object;
808
889
  }>;
809
890
  update: _trpc_server.TRPCMutationProcedure<{
810
891
  input: {
811
892
  type?: "commune" | "intercommunality" | "syndicate" | "other" | undefined;
893
+ description?: string | null | undefined;
812
894
  name?: string | undefined;
813
895
  slug?: string | undefined;
814
- description?: string | null | undefined;
815
896
  address?: {
816
897
  street?: string | undefined;
817
898
  postalCode?: string | undefined;
@@ -822,14 +903,10 @@ declare const organizationRouter: _trpc_server.TRPCBuiltRouter<{
822
903
  };
823
904
  output: {
824
905
  type: "commune" | "intercommunality" | "syndicate" | "other";
825
- id: number;
906
+ description: string | null;
826
907
  name: string;
908
+ id: number;
827
909
  slug: string;
828
- description: string | null;
829
- updatedBy: string | null;
830
- legacyExtra: Record<string, unknown> | null;
831
- createdAt: string;
832
- updatedAt: string;
833
910
  address: {
834
911
  street?: string | undefined;
835
912
  postalCode?: string | undefined;
@@ -837,6 +914,10 @@ declare const organizationRouter: _trpc_server.TRPCBuiltRouter<{
837
914
  } | null;
838
915
  deployment: Record<string, unknown> | null;
839
916
  settings: Record<string, unknown> | null;
917
+ updatedBy: string | null;
918
+ legacyExtra: Record<string, unknown> | null;
919
+ createdAt: string;
920
+ updatedAt: string;
840
921
  };
841
922
  meta: object;
842
923
  }>;
@@ -1169,13 +1250,13 @@ declare const apiTokensRouter: _trpc_server.TRPCBuiltRouter<{
1169
1250
  list: _trpc_server.TRPCQueryProcedure<{
1170
1251
  input: void;
1171
1252
  output: Pick<{
1172
- id: string;
1173
1253
  name: string;
1254
+ id: string;
1174
1255
  createdAt: string;
1175
1256
  revokedAt: string | null;
1176
1257
  tokenHash: string;
1177
1258
  lastUsedAt: string | null;
1178
- }, "id" | "name" | "createdAt" | "revokedAt" | "lastUsedAt">[];
1259
+ }, "name" | "id" | "createdAt" | "revokedAt" | "lastUsedAt">[];
1179
1260
  meta: object;
1180
1261
  }>;
1181
1262
  /** The plaintext token is returned ONCE — only its hash is stored. */
@@ -1402,38 +1483,38 @@ declare const mediaRouter: _trpc_server.TRPCBuiltRouter<{
1402
1483
  metaData?: Record<string, unknown> | undefined;
1403
1484
  };
1404
1485
  output: {
1486
+ filename: string;
1405
1487
  id: string;
1406
- createdBy: string | null;
1407
1488
  updatedBy: string | null;
1408
1489
  legacyExtra: Record<string, unknown> | null;
1409
1490
  createdAt: string;
1410
1491
  updatedAt: string;
1411
- filename: string;
1412
1492
  mime: string;
1413
1493
  size: number;
1414
1494
  alt: string | null;
1415
1495
  caption: string | null;
1416
1496
  objects: Record<string, unknown>;
1417
1497
  metaData: Record<string, unknown> | null;
1498
+ createdBy: string | null;
1418
1499
  };
1419
1500
  meta: object;
1420
1501
  }>;
1421
1502
  list: _trpc_server.TRPCQueryProcedure<{
1422
1503
  input: void;
1423
1504
  output: ({
1505
+ filename: string;
1424
1506
  id: string;
1425
- createdBy: string | null;
1426
1507
  updatedBy: string | null;
1427
1508
  legacyExtra: Record<string, unknown> | null;
1428
1509
  createdAt: string;
1429
1510
  updatedAt: string;
1430
- filename: string;
1431
1511
  mime: string;
1432
1512
  size: number;
1433
1513
  alt: string | null;
1434
1514
  caption: string | null;
1435
1515
  objects: Record<string, unknown>;
1436
1516
  metaData: Record<string, unknown> | null;
1517
+ createdBy: string | null;
1437
1518
  } & {
1438
1519
  objects: Record<string, string>;
1439
1520
  })[];
@@ -1444,19 +1525,19 @@ declare const mediaRouter: _trpc_server.TRPCBuiltRouter<{
1444
1525
  id: string;
1445
1526
  };
1446
1527
  output: {
1528
+ filename: string;
1447
1529
  id: string;
1448
- createdBy: string | null;
1449
1530
  updatedBy: string | null;
1450
1531
  legacyExtra: Record<string, unknown> | null;
1451
1532
  createdAt: string;
1452
1533
  updatedAt: string;
1453
- filename: string;
1454
1534
  mime: string;
1455
1535
  size: number;
1456
1536
  alt: string | null;
1457
1537
  caption: string | null;
1458
1538
  objects: Record<string, unknown>;
1459
1539
  metaData: Record<string, unknown> | null;
1540
+ createdBy: string | null;
1460
1541
  } & {
1461
1542
  objects: Record<string, string>;
1462
1543
  };
@@ -1468,19 +1549,19 @@ declare const mediaRouter: _trpc_server.TRPCBuiltRouter<{
1468
1549
  ids: string[];
1469
1550
  };
1470
1551
  output: ({
1552
+ filename: string;
1471
1553
  id: string;
1472
- createdBy: string | null;
1473
1554
  updatedBy: string | null;
1474
1555
  legacyExtra: Record<string, unknown> | null;
1475
1556
  createdAt: string;
1476
1557
  updatedAt: string;
1477
- filename: string;
1478
1558
  mime: string;
1479
1559
  size: number;
1480
1560
  alt: string | null;
1481
1561
  caption: string | null;
1482
1562
  objects: Record<string, unknown>;
1483
1563
  metaData: Record<string, unknown> | null;
1564
+ createdBy: string | null;
1484
1565
  } & {
1485
1566
  objects: Record<string, string>;
1486
1567
  })[];
@@ -1496,19 +1577,19 @@ declare const mediaRouter: _trpc_server.TRPCBuiltRouter<{
1496
1577
  };
1497
1578
  };
1498
1579
  output: {
1580
+ filename: string;
1499
1581
  id: string;
1500
- createdBy: string | null;
1501
1582
  updatedBy: string | null;
1502
1583
  legacyExtra: Record<string, unknown> | null;
1503
1584
  createdAt: string;
1504
1585
  updatedAt: string;
1505
- filename: string;
1506
1586
  mime: string;
1507
1587
  size: number;
1508
1588
  alt: string | null;
1509
1589
  caption: string | null;
1510
1590
  objects: Record<string, unknown>;
1511
1591
  metaData: Record<string, unknown> | null;
1592
+ createdBy: string | null;
1512
1593
  };
1513
1594
  meta: object;
1514
1595
  }>;
@@ -1572,6 +1653,25 @@ declare const UploadIncompleteError: {
1572
1653
  stackTraceLimit: number;
1573
1654
  };
1574
1655
 
1656
+ declare class IndexedEntryRepository extends EntryRepository {
1657
+ private readonly index;
1658
+ insert(input: NewEntry): Promise<Entry>;
1659
+ update(id: string, input: Partial<NewEntry>): Promise<Entry | undefined>;
1660
+ delete(id: string): Promise<Entry | undefined>;
1661
+ }
1662
+ declare class IndexedDefinitionRepository extends DefinitionRepository {
1663
+ private readonly index;
1664
+ update(id: string, input: Partial<NewCollectionDefinition>): Promise<CollectionDefinition | undefined>;
1665
+ delete(id: string): Promise<CollectionDefinition | undefined>;
1666
+ }
1667
+
1668
+ /**
1669
+ * What someone typed, as an FTS5 query: every word must be found, each as the
1670
+ * start of a word (« ecol » finds « école »). Quoted, so that nothing typed is
1671
+ * read as FTS5 syntax. With `every` false, any one word is enough.
1672
+ */
1673
+ declare function toMatchQuery(search: string, every?: boolean): string;
1674
+
1575
1675
  declare const collectionsRouter: _trpc_server.TRPCBuiltRouter<{
1576
1676
  ctx: CoreContext;
1577
1677
  meta: object;
@@ -1591,14 +1691,19 @@ declare const collectionsRouter: _trpc_server.TRPCBuiltRouter<{
1591
1691
  list: _trpc_server.TRPCQueryProcedure<{
1592
1692
  input: void;
1593
1693
  output: {
1594
- id: string;
1694
+ description: string | null;
1595
1695
  name: string;
1696
+ id: string;
1596
1697
  slug: string;
1597
- description: string | null;
1698
+ updatedBy: string | null;
1699
+ legacyExtra: Record<string, unknown> | null;
1700
+ createdAt: string;
1701
+ updatedAt: string;
1702
+ createdBy: string | null;
1598
1703
  fields: {
1599
1704
  name: string;
1600
1705
  label: string;
1601
- type: "number" | "boolean" | "json" | "date" | "text" | "rich-text" | "media" | "relation" | "select" | "steps";
1706
+ type: "number" | "boolean" | "text" | "rich-text" | "date" | "media" | "relation" | "select" | "steps" | "json";
1602
1707
  required: boolean;
1603
1708
  hidden: boolean;
1604
1709
  options?: string[] | undefined;
@@ -1607,11 +1712,6 @@ declare const collectionsRouter: _trpc_server.TRPCBuiltRouter<{
1607
1712
  editor: Record<string, unknown> | null;
1608
1713
  display: Record<string, unknown> | null;
1609
1714
  headings: Record<string, unknown> | null;
1610
- createdBy: string | null;
1611
- updatedBy: string | null;
1612
- legacyExtra: Record<string, unknown> | null;
1613
- createdAt: string;
1614
- updatedAt: string;
1615
1715
  }[];
1616
1716
  meta: object;
1617
1717
  }>;
@@ -1651,7 +1751,7 @@ declare const collectionsRouter: _trpc_server.TRPCBuiltRouter<{
1651
1751
  fields: {
1652
1752
  name: string;
1653
1753
  label: string;
1654
- type: "number" | "boolean" | "json" | "date" | "text" | "rich-text" | "media" | "relation" | "select" | "steps";
1754
+ type: "number" | "boolean" | "text" | "rich-text" | "date" | "media" | "relation" | "select" | "steps" | "json";
1655
1755
  required?: boolean | undefined;
1656
1756
  hidden?: boolean | undefined;
1657
1757
  options?: string[] | undefined;
@@ -1664,14 +1764,19 @@ declare const collectionsRouter: _trpc_server.TRPCBuiltRouter<{
1664
1764
  slug?: string | undefined;
1665
1765
  };
1666
1766
  output: {
1667
- id: string;
1767
+ description: string | null;
1668
1768
  name: string;
1769
+ id: string;
1669
1770
  slug: string;
1670
- description: string | null;
1771
+ updatedBy: string | null;
1772
+ legacyExtra: Record<string, unknown> | null;
1773
+ createdAt: string;
1774
+ updatedAt: string;
1775
+ createdBy: string | null;
1671
1776
  fields: {
1672
1777
  name: string;
1673
1778
  label: string;
1674
- type: "number" | "boolean" | "json" | "date" | "text" | "rich-text" | "media" | "relation" | "select" | "steps";
1779
+ type: "number" | "boolean" | "text" | "rich-text" | "date" | "media" | "relation" | "select" | "steps" | "json";
1675
1780
  required: boolean;
1676
1781
  hidden: boolean;
1677
1782
  options?: string[] | undefined;
@@ -1680,11 +1785,6 @@ declare const collectionsRouter: _trpc_server.TRPCBuiltRouter<{
1680
1785
  editor: Record<string, unknown> | null;
1681
1786
  display: Record<string, unknown> | null;
1682
1787
  headings: Record<string, unknown> | null;
1683
- createdBy: string | null;
1684
- updatedBy: string | null;
1685
- legacyExtra: Record<string, unknown> | null;
1686
- createdAt: string;
1687
- updatedAt: string;
1688
1788
  };
1689
1789
  meta: object;
1690
1790
  }>;
@@ -1692,16 +1792,16 @@ declare const collectionsRouter: _trpc_server.TRPCBuiltRouter<{
1692
1792
  input: {
1693
1793
  id: string;
1694
1794
  data: {
1795
+ description?: string | null | undefined;
1695
1796
  name?: string | undefined;
1696
1797
  slug?: string | undefined;
1697
- description?: string | null | undefined;
1698
1798
  editor?: Record<string, unknown> | null | undefined;
1699
1799
  display?: Record<string, unknown> | null | undefined;
1700
1800
  headings?: Record<string, unknown> | null | undefined;
1701
1801
  fields?: {
1702
1802
  name: string;
1703
1803
  label: string;
1704
- type: "number" | "boolean" | "json" | "date" | "text" | "rich-text" | "media" | "relation" | "select" | "steps";
1804
+ type: "number" | "boolean" | "text" | "rich-text" | "date" | "media" | "relation" | "select" | "steps" | "json";
1705
1805
  required?: boolean | undefined;
1706
1806
  hidden?: boolean | undefined;
1707
1807
  options?: string[] | undefined;
@@ -1710,14 +1810,19 @@ declare const collectionsRouter: _trpc_server.TRPCBuiltRouter<{
1710
1810
  };
1711
1811
  };
1712
1812
  output: {
1713
- id: string;
1813
+ description: string | null;
1714
1814
  name: string;
1815
+ id: string;
1715
1816
  slug: string;
1716
- description: string | null;
1817
+ updatedBy: string | null;
1818
+ legacyExtra: Record<string, unknown> | null;
1819
+ createdAt: string;
1820
+ updatedAt: string;
1821
+ createdBy: string | null;
1717
1822
  fields: {
1718
1823
  name: string;
1719
1824
  label: string;
1720
- type: "number" | "boolean" | "json" | "date" | "text" | "rich-text" | "media" | "relation" | "select" | "steps";
1825
+ type: "number" | "boolean" | "text" | "rich-text" | "date" | "media" | "relation" | "select" | "steps" | "json";
1721
1826
  required: boolean;
1722
1827
  hidden: boolean;
1723
1828
  options?: string[] | undefined;
@@ -1726,11 +1831,6 @@ declare const collectionsRouter: _trpc_server.TRPCBuiltRouter<{
1726
1831
  editor: Record<string, unknown> | null;
1727
1832
  display: Record<string, unknown> | null;
1728
1833
  headings: Record<string, unknown> | null;
1729
- createdBy: string | null;
1730
- updatedBy: string | null;
1731
- legacyExtra: Record<string, unknown> | null;
1732
- createdAt: string;
1733
- updatedAt: string;
1734
1834
  };
1735
1835
  meta: object;
1736
1836
  }>;
@@ -1857,6 +1957,12 @@ declare const collectionsRouter: _trpc_server.TRPCBuiltRouter<{
1857
1957
  legacyExtra: drizzle_zod.Json;
1858
1958
  createdAt: string;
1859
1959
  updatedAt: string;
1960
+ found?: {
1961
+ title: string;
1962
+ body: string;
1963
+ extra: string;
1964
+ field?: string | undefined;
1965
+ } | undefined;
1860
1966
  }[];
1861
1967
  meta: object;
1862
1968
  }>;
@@ -1912,11 +2018,11 @@ declare const collectionsRouter: _trpc_server.TRPCBuiltRouter<{
1912
2018
  id: string;
1913
2019
  data: Record<string, unknown>;
1914
2020
  slug: string;
1915
- createdBy: string | null;
1916
2021
  updatedBy: string | null;
1917
2022
  legacyExtra: Record<string, unknown> | null;
1918
2023
  createdAt: string;
1919
2024
  updatedAt: string;
2025
+ createdBy: string | null;
1920
2026
  collectionId: string;
1921
2027
  title: string;
1922
2028
  related: string[] | null;
@@ -1941,11 +2047,11 @@ declare const collectionsRouter: _trpc_server.TRPCBuiltRouter<{
1941
2047
  id: string;
1942
2048
  data: Record<string, unknown>;
1943
2049
  slug: string;
1944
- createdBy: string | null;
1945
2050
  updatedBy: string | null;
1946
2051
  legacyExtra: Record<string, unknown> | null;
1947
2052
  createdAt: string;
1948
2053
  updatedAt: string;
2054
+ createdBy: string | null;
1949
2055
  collectionId: string;
1950
2056
  title: string;
1951
2057
  related: string[] | null;
@@ -3010,6 +3116,12 @@ declare const appRouter: _trpc_server.TRPCBuiltRouter<{
3010
3116
  legacyExtra: drizzle_zod.Json;
3011
3117
  createdAt: string;
3012
3118
  updatedAt: string;
3119
+ found?: {
3120
+ title: string;
3121
+ body: string;
3122
+ extra: string;
3123
+ field?: string | undefined;
3124
+ } | undefined;
3013
3125
  }[];
3014
3126
  meta: object;
3015
3127
  }>;
@@ -3145,5 +3257,5 @@ declare const appRouter: _trpc_server.TRPCBuiltRouter<{
3145
3257
  }>>;
3146
3258
  type AppRouter = typeof appRouter;
3147
3259
 
3148
- export { ALLOWED_MIME, ApiToken, AudienceAsk, AudiencePanelData, AudienceService, AudienceUnavailableError, CannotRemoveSelfError, CollectionDefinition, CollectionNotFoundError, CollectionsService, DefinitionCreateDto, DefinitionRepository, DefinitionUpdateDto, DeployFailedError, DeployHookMissingError, DomainError, DuplicateSlugError, EmailService, Entry, EntryCreateDto, EntryNotFoundError, EntryRepository, EntrySearchHit, EntryUpdateDto, ErrorType, HealthService, InvalidEntryDataError, Invitation, InvitationInvalidError, Media, MediaFinalizeDto, MediaNotFoundError, MediaRepository, MediaService, MediaUpdateDto, NewCollectionDefinition, NewEntry, NewMedia, NewOrganization, Organization, OrganizationAlreadyInitializedError, OrganizationInitDto, OrganizationNotInitializedError, OrganizationRepository, OrganizationService, OrganizationUpdateDto, S3Storage, Session, SessionNotFoundError, TooManyAttemptsError, UnsupportedMimeError, UploadIncompleteError, User, UserNotFoundError, UsersRepository, UsersService, adminProcedure, apiTokensRouter, appRouter, audienceRouter, authRouter, collectionsRouter, connectDb, createCore, createStorage, createTypedError, invitationsRouter, isUniqueViolation, mediaRouter, mergeRouters, middleware, organizationRouter, parseEnv, procedure, protectedProcedure, publicProcedure, router, usersRouter };
3149
- export type { AppRouter, AuthSession, Core, CoreContext, CoreEnv, CoreServices, EmailEvent, HealthStatus, S3Config, StorageDriver, StoreDb, TrpcErrorCode };
3260
+ export { ALLOWED_MIME, ApiToken, AudienceAsk, AudiencePanelData, AudienceService, AudienceUnavailableError, CannotRemoveSelfError, CollectionDefinition, CollectionNotFoundError, CollectionsService, DefinitionCreateDto, IndexedDefinitionRepository as DefinitionRepository, DefinitionUpdateDto, DeployFailedError, DeployHookMissingError, DomainError, DuplicateSlugError, EmailService, Entry, EntryCreateDto, EntryNotFoundError, IndexedEntryRepository as EntryRepository, EntrySearchHit, EntryUpdateDto, ErrorType, HealthService, InvalidEntryDataError, Invitation, InvitationInvalidError, Media, MediaFinalizeDto, MediaNotFoundError, MediaRepository, MediaService, MediaUpdateDto, NewCollectionDefinition, NewEntry, NewMedia, NewOrganization, Organization, OrganizationAlreadyInitializedError, OrganizationInitDto, OrganizationNotInitializedError, OrganizationRepository, OrganizationService, OrganizationUpdateDto, S3Storage, SearchRepository, Session, SessionNotFoundError, TooManyAttemptsError, UnsupportedMimeError, UploadIncompleteError, User, UserNotFoundError, UsersRepository, UsersService, adminProcedure, apiTokensRouter, appRouter, audienceRouter, authRouter, collectionsRouter, connectDb, createCore, createStorage, createTypedError, invitationsRouter, isUniqueViolation, mediaRouter, mergeRouters, middleware, organizationRouter, parseEnv, procedure, protectedProcedure, publicProcedure, router, toMatchQuery, usersRouter };
3261
+ export type { AppRouter, AuthSession, Core, CoreContext, CoreEnv, CoreServices, EmailEvent, Found, HealthStatus, S3Config, StorageDriver, StoreDb, TrpcErrorCode };