@open-commune/core 0.2.15 → 0.2.17

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/index.d.ts CHANGED
@@ -3,8 +3,8 @@ 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 ErrorType } from './shared/core.Cot86Med.js';
7
- export { m as AcceptInvitationDto, n as Address, o as ApiTokenCreateDto, p as ERROR_TYPES, q as InviteDto, L as LoginDto, r as MediaRequestUploadDto, t as NewUser, P as PublicUser, R as RequestPasswordResetDto, u as UpdateOwnProfileDto, v as UserUpdateDto, w as acceptInvitationDto, x as addressSchema, y as apiTokenCreateDto, z as apiTokens, B as collectionDefinitions, F as definitionCreateDto, G as definitionDto, H as definitionUpdateDto, J as entries, K as entryCreateDto, Q as entryDto, T as entrySearchHitDto, V as entryUpdateDto, W as invitations, X as inviteDto, Y as isErrorType, Z as loginDto, _ as media, $ as mediaFinalizeDto, a0 as mediaRequestUploadDto, a1 as mediaUpdateDto, a2 as organization, a3 as organizationInitDto, a4 as organizationUpdateDto, a5 as requestPasswordResetDto, a6 as sessions, a7 as toPublicUser, a8 as updateOwnProfileDto, a9 as userUpdateDto, aa as users } from './shared/core.Cot86Med.js';
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.Bj4FLkJh.js';
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.Bj4FLkJh.js';
8
8
  export { FIELD_TYPES, FieldType, PUBLICATION_STATUSES, PublicationStatus } from './domains/collections/constants.js';
9
9
  export { FIELD_VALUE_SCHEMAS, FieldDefinition, buildDataSchema, fieldDefinitionSchema } from './domains/collections/utils.js';
10
10
  import 'drizzle-orm/sqlite-core';
@@ -21,6 +21,9 @@ declare const envSchema: z.ZodObject<{
21
21
  COMMUN_EMAIL_WEBHOOK_TOKEN: z.ZodOptional<z.ZodString>;
22
22
  COMMUN_ADMIN_URL: z.ZodOptional<z.ZodString>;
23
23
  COMMUN_JWT_SECRET: z.ZodString;
24
+ OPEN_COMMUNE_AUDIENCE_URL: z.ZodOptional<z.ZodURL>;
25
+ OPEN_COMMUNE_AUDIENCE_TOKEN: z.ZodOptional<z.ZodString>;
26
+ OPEN_COMMUNE_AUDIENCE_VIEWERS: z.ZodOptional<z.ZodString>;
24
27
  }, z.core.$strip>;
25
28
  type CoreEnv = z.infer<typeof envSchema>;
26
29
  /**
@@ -406,6 +409,21 @@ declare class DefinitionRepository {
406
409
  delete(id: string): Promise<CollectionDefinition | undefined>;
407
410
  }
408
411
 
412
+ /** A period, its bounds ISO 8601 dates at the precision asked: `2026`, `2026-11`, `2026-11-13`. */
413
+ type EntryPeriod = {
414
+ gte?: string;
415
+ lte?: string;
416
+ };
417
+ /** How a listing may be narrowed. Every filter is optional, and they combine. */
418
+ type EntryNarrowing = {
419
+ /** One collection; every collection of the site when omitted. */
420
+ collectionId?: string;
421
+ status?: Entry['status'][];
422
+ search?: string;
423
+ date?: EntryPeriod;
424
+ references?: string[];
425
+ };
426
+ type EntryOrder = 'recent' | 'oldest' | 'title' | 'date_asc' | 'date_desc';
409
427
  /**
410
428
  * Database access for collection entries. Methods are async by contract, even
411
429
  * though bun:sqlite executes synchronously.
@@ -420,6 +438,24 @@ declare class EntryRepository {
420
438
  * entries would not fit in it anyway.
421
439
  */
422
440
  private narrowing;
441
+ /**
442
+ * The dates of an entry, as spans: an object of its fields that holds dates
443
+ * (a session, with its start and its end) is one span from the first to the
444
+ * last; a date on its own, at the top or in a list, is a span of one day.
445
+ * Read from any field, whatever its name, as the theme reads them.
446
+ */
447
+ private spans;
448
+ /**
449
+ * A span is within the period when it overlaps it, each bound compared at
450
+ * its own precision: `2026-11` keeps a session from 30/10 to 02/11.
451
+ */
452
+ private within;
453
+ /**
454
+ * The day an entry is sorted by: its first date within the period, or its
455
+ * last for a reverse order — so that « the last council » is the latest one
456
+ * held, and an entry with no date comes after every dated one.
457
+ */
458
+ private dateKey;
423
459
  /**
424
460
  * Text match on the title and the data. One LIKE is enough at a commune's
425
461
  * scale, and it leaves the title index usable.
@@ -436,18 +472,17 @@ declare class EntryRepository {
436
472
  limit: number;
437
473
  }): Promise<Entry[]>;
438
474
  /** The total a paginated listing is a window onto. Counted in SQL. */
439
- countMatching(options: {
440
- collectionId: string;
441
- status?: Entry['status'][];
442
- search?: string;
443
- }): Promise<number>;
444
- /** Admin listing: most recently updated first by default, paginated. */
445
- listPaginated(collectionId: string, options: {
475
+ countMatching(options: EntryNarrowing): Promise<number>;
476
+ /** The entries last touched, whatever their collection: what a home shows. */
477
+ listRecent(limit: number): Promise<Entry[]>;
478
+ /**
479
+ * Admin listing: most recently updated first by default, paginated. With a
480
+ * period and no order, the entries come by date, the earliest first.
481
+ */
482
+ listPaginated(options: EntryNarrowing & {
446
483
  skip: number;
447
484
  limit: number;
448
- status?: Entry['status'][];
449
- search?: string;
450
- order?: 'recent' | 'oldest' | 'title';
485
+ order?: EntryOrder;
451
486
  }): Promise<Entry[]>;
452
487
  listPublished(collectionId: string): Promise<Entry[]>;
453
488
  findBySlug(collectionId: string, slug: string): Promise<Entry | undefined>;
@@ -477,18 +512,22 @@ declare class CollectionsService {
477
512
  listEntries(collectionIdOrSlug: string): Promise<Entry[]>;
478
513
  getEntry(id: string): Promise<Entry>;
479
514
  /** Paginated admin listing, most recently updated first. */
480
- listEntriesPaginated(collectionIdOrSlug: string, options?: {
515
+ /**
516
+ * A page of entries, from one collection or, without one, from every
517
+ * collection of the site — narrowed by status, text, period and the entries
518
+ * they reference.
519
+ */
520
+ listEntriesPaginated(collectionIdOrSlug: string | undefined, options?: Omit<EntryNarrowing, 'collectionId'> & {
481
521
  skip?: number;
482
522
  limit?: number;
483
- status?: Entry['status'][];
484
- search?: string;
485
- order?: 'recent' | 'oldest' | 'title';
523
+ order?: EntryOrder;
486
524
  }): Promise<Entry[]>;
525
+ /** A collection's id from its id or its slug; none, for the whole site. */
526
+ private collectionIdOf;
527
+ /** The entries last touched across every collection, most recent first. */
528
+ listRecentEntries(limit?: number): Promise<Entry[]>;
487
529
  /** The total a listing is a window onto, under the same narrowing. */
488
- countEntries(collectionIdOrSlug: string, options?: {
489
- status?: Entry['status'][];
490
- search?: string;
491
- }): Promise<number>;
530
+ countEntries(collectionIdOrSlug: string | undefined, options?: Omit<EntryNarrowing, 'collectionId'>): Promise<number>;
492
531
  /**
493
532
  * Text search across collections, or within the ones named (by id or slug).
494
533
  * Each hit carries the slug of its collection.
@@ -514,6 +553,47 @@ declare class CollectionsService {
514
553
  private linkRelations;
515
554
  }
516
555
 
556
+ /**
557
+ * The audience panels' data: the site's, a collection's or an entry's, asked
558
+ * of the configured source (`OPEN_COMMUNE_AUDIENCE_URL`) and its most read
559
+ * pages named after the instance's own entries.
560
+ *
561
+ * The core measures nothing and holds no provider's key: a source is whatever
562
+ * answers the contract of `@open-commune/core/dtos` — the cloud's measurement
563
+ * service, or a converter in front of Matomo or Plausible.
564
+ */
565
+ declare class AudienceService {
566
+ private readonly collections;
567
+ private readonly config;
568
+ private readonly cache;
569
+ private names;
570
+ private readonly viewers;
571
+ constructor(collections: CollectionsService, config: {
572
+ url?: string;
573
+ token?: string;
574
+ /** Who sees the panels while they are previewed, comma-separated; unset, every user. */
575
+ viewers?: string;
576
+ fetchImpl?: typeof fetch;
577
+ });
578
+ /**
579
+ * Whether this user may see the audience panels: a source is configured,
580
+ * and the viewers are unset or name them. The admin reads it from the
581
+ * session and mounts no panel otherwise, so a refused user never sees one
582
+ * flash while `summary` answers; `summary` still refuses on its own.
583
+ */
584
+ visibleTo(viewer: string): boolean;
585
+ summary(ask: AudienceAsk, viewer: string): Promise<AudiencePanelData>;
586
+ /** The source's answer, or `null`: any failure only hides the panel. */
587
+ private ask;
588
+ private entrySlug;
589
+ /**
590
+ * Published entries by slug and collections by slug, to name the most read
591
+ * pages. A path is matched by its last segment, which every theme, old or
592
+ * new, ends an entry's URL with.
593
+ */
594
+ private knownNames;
595
+ }
596
+
517
597
  /** The domain services — the ONLY surface transport layers (tRPC, REST) talk to. */
518
598
  interface CoreServices {
519
599
  health: HealthService;
@@ -521,6 +601,7 @@ interface CoreServices {
521
601
  organization: OrganizationService;
522
602
  media: MediaService;
523
603
  collections: CollectionsService;
604
+ audience: AudienceService;
524
605
  }
525
606
  /** The fully-wired dependency graph returned by `createCore({ env })`. */
526
607
  interface Core {
@@ -537,6 +618,39 @@ interface CoreContext {
537
618
  requestMeta?: SessionMeta;
538
619
  }
539
620
 
621
+ declare const router: _trpc_server.TRPCRouterBuilder<{
622
+ ctx: CoreContext;
623
+ meta: object;
624
+ errorShape: {
625
+ data: {
626
+ type?: ErrorType | undefined;
627
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
628
+ httpStatus: number;
629
+ path?: string;
630
+ stack?: string;
631
+ };
632
+ message: string;
633
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
634
+ };
635
+ transformer: false;
636
+ }>;
637
+ declare const mergeRouters: <TRouters extends _trpc_server.AnyRouter[]>(...routerList: TRouters) => _trpc_server.TRPCMergeRouters<TRouters>;
638
+ declare const publicProcedure: _trpc_server.TRPCProcedureBuilder<CoreContext, object, object, _trpc_server.TRPCUnsetMarker, _trpc_server.TRPCUnsetMarker, _trpc_server.TRPCUnsetMarker, _trpc_server.TRPCUnsetMarker, false>;
639
+ declare const middleware: <$ContextOverrides>(fn: _trpc_server.TRPCMiddlewareFunction<CoreContext, object, object, $ContextOverrides, unknown>) => _trpc_server.TRPCMiddlewareBuilder<CoreContext, object, $ContextOverrides, unknown>;
640
+ declare const procedure: _trpc_server.TRPCProcedureBuilder<CoreContext, object, {}, _trpc_server.TRPCUnsetMarker, _trpc_server.TRPCUnsetMarker, _trpc_server.TRPCUnsetMarker, _trpc_server.TRPCUnsetMarker, false>;
641
+ /** Requires an authenticated session, whatever the role. */
642
+ declare const protectedProcedure: _trpc_server.TRPCProcedureBuilder<CoreContext, object, {
643
+ services: CoreServices;
644
+ session: AuthSession;
645
+ requestMeta: SessionMeta | undefined;
646
+ }, _trpc_server.TRPCUnsetMarker, _trpc_server.TRPCUnsetMarker, _trpc_server.TRPCUnsetMarker, _trpc_server.TRPCUnsetMarker, false>;
647
+ /** Requires an authenticated admin. */
648
+ declare const adminProcedure: _trpc_server.TRPCProcedureBuilder<CoreContext, object, {
649
+ services: CoreServices;
650
+ session: AuthSession;
651
+ requestMeta: SessionMeta | undefined;
652
+ }, _trpc_server.TRPCUnsetMarker, _trpc_server.TRPCUnsetMarker, _trpc_server.TRPCUnsetMarker, _trpc_server.TRPCUnsetMarker, false>;
653
+
540
654
  /**
541
655
  * Typed domain errors. Each domain exports its own catalogue
542
656
  * (`domains/<domain>/errors.ts`); the tRPC layer only forwards them —
@@ -798,6 +912,7 @@ declare const authRouter: _trpc_server.TRPCBuiltRouter<{
798
912
  token: string;
799
913
  expiresAt: string;
800
914
  user: {
915
+ audience: boolean;
801
916
  id: string;
802
917
  email: string;
803
918
  name: string;
@@ -817,6 +932,7 @@ declare const authRouter: _trpc_server.TRPCBuiltRouter<{
817
932
  input: void;
818
933
  output: {
819
934
  user: {
935
+ audience: boolean;
820
936
  id: string;
821
937
  email: string;
822
938
  name: string;
@@ -1640,12 +1756,17 @@ declare const collectionsRouter: _trpc_server.TRPCBuiltRouter<{
1640
1756
  /** Narrowing is optional: a caller that ignores it keeps the old behaviour. */
1641
1757
  list: _trpc_server.TRPCQueryProcedure<{
1642
1758
  input: {
1643
- collectionId: string;
1644
- status?: ("draft" | "waiting" | "ready" | "scheduled" | "published")[] | undefined;
1645
- search?: string | undefined;
1646
- order?: "title" | "recent" | "oldest" | undefined;
1759
+ order?: "title" | "recent" | "oldest" | "date_asc" | "date_desc" | undefined;
1647
1760
  skip?: number | undefined;
1648
1761
  limit?: number | undefined;
1762
+ collectionId?: string | undefined;
1763
+ status?: ("draft" | "waiting" | "ready" | "scheduled" | "published")[] | undefined;
1764
+ search?: string | undefined;
1765
+ date?: {
1766
+ gte?: string | undefined;
1767
+ lte?: string | undefined;
1768
+ } | undefined;
1769
+ references?: string[] | undefined;
1649
1770
  };
1650
1771
  output: {
1651
1772
  id: string;
@@ -1664,12 +1785,39 @@ declare const collectionsRouter: _trpc_server.TRPCBuiltRouter<{
1664
1785
  }[];
1665
1786
  meta: object;
1666
1787
  }>;
1788
+ /** What was last touched, across collections: the admin's home reads it. */
1789
+ recent: _trpc_server.TRPCQueryProcedure<{
1790
+ input: {
1791
+ limit?: number | undefined;
1792
+ } | undefined;
1793
+ output: {
1794
+ id: string;
1795
+ collectionId: string;
1796
+ title: string;
1797
+ slug: string;
1798
+ data: Record<string, unknown>;
1799
+ related: string[] | null;
1800
+ createdBy: string | null;
1801
+ updatedBy: string | null;
1802
+ status: "draft" | "waiting" | "ready" | "scheduled" | "published";
1803
+ publishedAt: string | null;
1804
+ legacyExtra: drizzle_zod.Json;
1805
+ createdAt: string;
1806
+ updatedAt: string;
1807
+ }[];
1808
+ meta: object;
1809
+ }>;
1667
1810
  /** The total a listing is a window onto, under the same narrowing. */
1668
1811
  count: _trpc_server.TRPCQueryProcedure<{
1669
1812
  input: {
1670
- collectionId: string;
1813
+ collectionId?: string | undefined;
1671
1814
  status?: ("draft" | "waiting" | "ready" | "scheduled" | "published")[] | undefined;
1672
1815
  search?: string | undefined;
1816
+ date?: {
1817
+ gte?: string | undefined;
1818
+ lte?: string | undefined;
1819
+ } | undefined;
1820
+ references?: string[] | undefined;
1673
1821
  };
1674
1822
  output: number;
1675
1823
  meta: object;
@@ -1694,8 +1842,8 @@ declare const collectionsRouter: _trpc_server.TRPCBuiltRouter<{
1694
1842
  legacyExtra: Record<string, unknown> | null;
1695
1843
  createdAt: string;
1696
1844
  updatedAt: string;
1697
- title: string;
1698
1845
  collectionId: string;
1846
+ title: string;
1699
1847
  related: string[] | null;
1700
1848
  status: "draft" | "waiting" | "ready" | "scheduled" | "published";
1701
1849
  publishedAt: string | null;
@@ -1723,8 +1871,8 @@ declare const collectionsRouter: _trpc_server.TRPCBuiltRouter<{
1723
1871
  legacyExtra: Record<string, unknown> | null;
1724
1872
  createdAt: string;
1725
1873
  updatedAt: string;
1726
- title: string;
1727
1874
  collectionId: string;
1875
+ title: string;
1728
1876
  related: string[] | null;
1729
1877
  status: "draft" | "waiting" | "ready" | "scheduled" | "published";
1730
1878
  publishedAt: string | null;
@@ -1808,6 +1956,55 @@ declare const DuplicateSlugError: {
1808
1956
  stackTraceLimit: number;
1809
1957
  };
1810
1958
 
1959
+ declare const audienceRouter: _trpc_server.TRPCBuiltRouter<{
1960
+ ctx: CoreContext;
1961
+ meta: object;
1962
+ errorShape: {
1963
+ data: {
1964
+ type?: ErrorType | undefined;
1965
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
1966
+ httpStatus: number;
1967
+ path?: string;
1968
+ stack?: string;
1969
+ };
1970
+ message: string;
1971
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
1972
+ };
1973
+ transformer: false;
1974
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
1975
+ summary: _trpc_server.TRPCQueryProcedure<{
1976
+ input: {
1977
+ period: unknown;
1978
+ collection?: string | undefined;
1979
+ entry?: string | undefined;
1980
+ };
1981
+ output: AudiencePanelData;
1982
+ meta: object;
1983
+ }>;
1984
+ }>>;
1985
+
1986
+ /**
1987
+ * No audience to show: no source is configured, this user is not among its
1988
+ * viewers, the entry is unknown, or the source did not answer. The panels
1989
+ * render nothing; they never tell which.
1990
+ */
1991
+ declare const AudienceUnavailableError: {
1992
+ new (message?: string): {
1993
+ readonly type: ErrorType;
1994
+ readonly trpcCode: TrpcErrorCode;
1995
+ name: string;
1996
+ message: string;
1997
+ stack?: string;
1998
+ cause?: unknown;
1999
+ };
2000
+ isError(error: unknown): error is Error;
2001
+ isError(value: unknown): value is Error;
2002
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
2003
+ captureStackTrace(targetObject: object, constructorOpt?: Function): void;
2004
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
2005
+ stackTraceLimit: number;
2006
+ };
2007
+
1811
2008
  declare function createCore({ env }?: {
1812
2009
  env?: CoreEnv;
1813
2010
  }): Core;
@@ -1874,6 +2071,7 @@ declare const appRouter: _trpc_server.TRPCBuiltRouter<{
1874
2071
  token: string;
1875
2072
  expiresAt: string;
1876
2073
  user: {
2074
+ audience: boolean;
1877
2075
  id: string;
1878
2076
  email: string;
1879
2077
  name: string;
@@ -1893,6 +2091,7 @@ declare const appRouter: _trpc_server.TRPCBuiltRouter<{
1893
2091
  input: void;
1894
2092
  output: {
1895
2093
  user: {
2094
+ audience: boolean;
1896
2095
  id: string;
1897
2096
  email: string;
1898
2097
  name: string;
@@ -2666,12 +2865,17 @@ declare const appRouter: _trpc_server.TRPCBuiltRouter<{
2666
2865
  }>;
2667
2866
  list: _trpc_server.TRPCQueryProcedure<{
2668
2867
  input: {
2669
- collectionId: string;
2670
- status?: ("draft" | "waiting" | "ready" | "scheduled" | "published")[] | undefined;
2671
- search?: string | undefined;
2672
- order?: "title" | "recent" | "oldest" | undefined;
2868
+ order?: "title" | "recent" | "oldest" | "date_asc" | "date_desc" | undefined;
2673
2869
  skip?: number | undefined;
2674
2870
  limit?: number | undefined;
2871
+ collectionId?: string | undefined;
2872
+ status?: ("draft" | "waiting" | "ready" | "scheduled" | "published")[] | undefined;
2873
+ search?: string | undefined;
2874
+ date?: {
2875
+ gte?: string | undefined;
2876
+ lte?: string | undefined;
2877
+ } | undefined;
2878
+ references?: string[] | undefined;
2675
2879
  };
2676
2880
  output: {
2677
2881
  id: string;
@@ -2690,11 +2894,37 @@ declare const appRouter: _trpc_server.TRPCBuiltRouter<{
2690
2894
  }[];
2691
2895
  meta: object;
2692
2896
  }>;
2693
- count: _trpc_server.TRPCQueryProcedure<{
2897
+ recent: _trpc_server.TRPCQueryProcedure<{
2694
2898
  input: {
2899
+ limit?: number | undefined;
2900
+ } | undefined;
2901
+ output: {
2902
+ id: string;
2695
2903
  collectionId: string;
2904
+ title: string;
2905
+ slug: string;
2906
+ data: Record<string, unknown>;
2907
+ related: string[] | null;
2908
+ createdBy: string | null;
2909
+ updatedBy: string | null;
2910
+ status: "draft" | "waiting" | "ready" | "scheduled" | "published";
2911
+ publishedAt: string | null;
2912
+ legacyExtra: drizzle_zod.Json;
2913
+ createdAt: string;
2914
+ updatedAt: string;
2915
+ }[];
2916
+ meta: object;
2917
+ }>;
2918
+ count: _trpc_server.TRPCQueryProcedure<{
2919
+ input: {
2920
+ collectionId?: string | undefined;
2696
2921
  status?: ("draft" | "waiting" | "ready" | "scheduled" | "published")[] | undefined;
2697
2922
  search?: string | undefined;
2923
+ date?: {
2924
+ gte?: string | undefined;
2925
+ lte?: string | undefined;
2926
+ } | undefined;
2927
+ references?: string[] | undefined;
2698
2928
  };
2699
2929
  output: number;
2700
2930
  meta: object;
@@ -2767,8 +2997,34 @@ declare const appRouter: _trpc_server.TRPCBuiltRouter<{
2767
2997
  }>;
2768
2998
  }>>;
2769
2999
  }>>;
3000
+ audience: _trpc_server.TRPCBuiltRouter<{
3001
+ ctx: CoreContext;
3002
+ meta: object;
3003
+ errorShape: {
3004
+ data: {
3005
+ type?: ErrorType | undefined;
3006
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
3007
+ httpStatus: number;
3008
+ path?: string;
3009
+ stack?: string;
3010
+ };
3011
+ message: string;
3012
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
3013
+ };
3014
+ transformer: false;
3015
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
3016
+ summary: _trpc_server.TRPCQueryProcedure<{
3017
+ input: {
3018
+ period: unknown;
3019
+ collection?: string | undefined;
3020
+ entry?: string | undefined;
3021
+ };
3022
+ output: AudiencePanelData;
3023
+ meta: object;
3024
+ }>;
3025
+ }>>;
2770
3026
  }>>;
2771
3027
  type AppRouter = typeof appRouter;
2772
3028
 
2773
- export { ALLOWED_MIME, ApiToken, 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, apiTokensRouter, appRouter, authRouter, collectionsRouter, connectDb, createCore, createStorage, createTypedError, invitationsRouter, isUniqueViolation, mediaRouter, organizationRouter, parseEnv, usersRouter };
3029
+ 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 };
2774
3030
  export type { AppRouter, AuthSession, Core, CoreContext, CoreEnv, CoreServices, EmailEvent, HealthStatus, S3Config, StorageDriver, StoreDb, TrpcErrorCode };