@shapio/client 0.2.1 → 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.
@@ -1,4 +1,4 @@
1
- import { ChangeSummary, ClassifiedChange, DefinitionInput, LocaleDefinition, LockFile, SchemaChange, SchemaDefinition, SyncDecision, ValidationIssue } from "@shapio/schema";
1
+ import { ChangeSummary, ClassifiedChange, DefinitionInput, ExportedDefinition, LocaleDefinition, LockFile, SchemaChange, SchemaDefinition, SyncDecision, ValidationIssue } from "@shapio/schema";
2
2
  //#region src/request.d.ts
3
3
  /** Fetch's `credentials` mode (spelled out: the DOM lib type is not available to Node consumers). */
4
4
  type FetchCredentials = 'omit' | 'same-origin' | 'include';
@@ -625,8 +625,13 @@ type PreviewTarget = {
625
625
  */
626
626
  /** `/api/admin/models` serves collections and singletons; `/api/admin/components` serves components. */
627
627
  type DefinitionCategory = 'model' | 'component';
628
+ /** Where a definition lives: one site (`site`), or shared with every site (`network`). */
629
+ type DefinitionScope = 'network' | 'site';
628
630
  type ActiveDefinition = {
629
631
  definition: SchemaDefinition;
632
+ scope: DefinitionScope;
633
+ /** The site a `site` definition belongs to; null when shared. */
634
+ siteId: string | null;
630
635
  /** Per-definition version: send it back as `expectedVersion` when changing the definition. */
631
636
  version: number;
632
637
  hash: string;
@@ -671,6 +676,8 @@ type ChangePlan = {
671
676
  kind: SchemaDefinition['kind'];
672
677
  apiKey: string;
673
678
  operation: 'create' | 'update' | 'delete';
679
+ /** The definition's site after the change; null when shared. */
680
+ siteId?: string | null;
674
681
  fromVersion: number | null;
675
682
  changes: ClassifiedChange[];
676
683
  summary: ChangeSummary;
@@ -711,7 +718,25 @@ type Acknowledgement = {
711
718
  };
712
719
  type CreateDefinitionInput = {
713
720
  definition: DefinitionPayload;
721
+ /** Default `site`: the request's site. `network` shares it with all sites (schema.create on every site). */
722
+ scope?: DefinitionScope;
714
723
  } & Acknowledgement;
724
+ /** `PUT /api/admin/{models,components}/:id/scope`: share with all sites, or keep on one site. */
725
+ type ChangeScopeInput = {
726
+ scope: DefinitionScope;
727
+ /** For `site`: the site to keep it on (default: the request's site). */
728
+ siteId?: string;
729
+ /** The definition's active version (409 SCHEMA_VERSION_CONFLICT when it moved). */
730
+ version: number;
731
+ };
732
+ type ChangeScopeOutcome = {
733
+ status: 'activated' | 'unchanged';
734
+ definitionId: string;
735
+ scope: DefinitionScope;
736
+ siteId: string | null;
737
+ version: number;
738
+ schemaVersion: number;
739
+ };
715
740
  type UpdateDefinitionInput = {
716
741
  definition: DefinitionPayload;
717
742
  expectedVersion: number;
@@ -736,6 +761,8 @@ type SchemaSummaryItem = {
736
761
  label: string;
737
762
  version: number;
738
763
  hash: string;
764
+ /** The key of the site the definition belongs to; null when shared. */
765
+ site: string | null;
739
766
  };
740
767
  type SchemaSummary = {
741
768
  schemaVersion: number;
@@ -887,6 +914,8 @@ type SchemaDraft = {
887
914
  baseVersion: number | null;
888
915
  /** Null when the draft deletes the definition. */
889
916
  definition: SchemaDefinition | null;
917
+ /** A new definition the draft creates shared with all sites (otherwise it belongs to the set's site). */
918
+ shared: boolean;
890
919
  version: number;
891
920
  updatedBy: ChangeSetActor;
892
921
  createdAt: string;
@@ -898,6 +927,8 @@ type PutSchemaDraftInput = {
898
927
  definition: DefinitionPayload | null;
899
928
  /** The active version the edit is based on (null: a new definition). */
900
929
  baseVersion: number | null;
930
+ /** For a new definition: create it shared with all sites (default false: the set's site). */
931
+ shared?: boolean;
901
932
  /** The draft row version the caller saw; omit when creating the draft. */
902
933
  expectedDraftVersion?: number;
903
934
  };
@@ -941,6 +972,11 @@ type ReviewSchemaItem = {
941
972
  stale: boolean;
942
973
  plan: ChangePlan | null;
943
974
  impact: PlanImpact | null;
975
+ /** Entries of the affected models per site (a shared definition converts every site's content). */
976
+ affectedEntriesBySite: Array<{
977
+ site: SiteRef;
978
+ entries: number;
979
+ }>;
944
980
  issues: ReviewIssue[];
945
981
  alsoChangedIn: Array<{
946
982
  id: string;
@@ -958,6 +994,8 @@ type NotRestorable = {
958
994
  detail: string;
959
995
  };
960
996
  type FieldConsumer = {
997
+ /** The site the reads were made on. */
998
+ site: SiteRef;
961
999
  /** `token:<id>`, `app_users` or `anonymous`. */
962
1000
  principalKey: string;
963
1001
  label: string | null;
@@ -971,6 +1009,14 @@ type FieldConsumers = {
971
1009
  fieldId: string;
972
1010
  apiKey: string;
973
1011
  consumers: FieldConsumer[];
1012
+ /**
1013
+ * Readers on other sites, as totals, when the viewer holds no role on every site; null when the viewer
1014
+ * sees every site's readers in `consumers`.
1015
+ */
1016
+ otherSites: {
1017
+ consumers: number;
1018
+ reads: number;
1019
+ } | null;
974
1020
  };
975
1021
  type ChangeSetReview = {
976
1022
  changeSet: ChangeSet;
@@ -1112,10 +1158,15 @@ type MeResponse = {
1112
1158
  site: SiteSummary;
1113
1159
  /** Every site this admin holds a role on (all of them for a role assigned on every site). */
1114
1160
  sites: SiteSummary[];
1161
+ /** Sites on this instance (whether or not the admin holds a role on them); scope is shown only above 1. */
1162
+ siteCount: number;
1115
1163
  /** Network actions (roles assigned on every site only). */
1116
1164
  networkPermissions: NetworkAction[];
1117
- /** Site actions on the request's site. */
1118
- sitePermissions: SiteAction[];
1165
+ /**
1166
+ * Site actions on the request's site, plus `schema.create` when a role on the site grants it for the
1167
+ * site's own definitions (`networkPermissions` lists it when shared definitions may be created too).
1168
+ */
1169
+ sitePermissions: Array<SiteAction | 'schema.create'>;
1119
1170
  /** `networkPermissions` and `sitePermissions` together. */
1120
1171
  globalPermissions: GlobalAction[];
1121
1172
  /** Content actions per model ID on the request's site (models without any action are left out). */
@@ -1531,11 +1582,13 @@ type UploadGrant = {
1531
1582
  */
1532
1583
  type SchemaExport = {
1533
1584
  schemaVersion: number;
1534
- definitions: Array<{
1535
- definition: SchemaDefinition;
1536
- version: number;
1537
- hash: string;
1538
- }>;
1585
+ /** The site whose view this is (shared definitions and its own); null on a network request. */
1586
+ site: {
1587
+ id: string;
1588
+ key: string;
1589
+ } | null;
1590
+ /** Each with its scope: `site` is the site key, null when shared. */
1591
+ definitions: ExportedDefinition[];
1539
1592
  };
1540
1593
  type SchemaSyncResult = {
1541
1594
  definitionId: string;
@@ -1562,6 +1615,11 @@ type SchemaApplyResult = {
1562
1615
  type SchemaApplyInput = {
1563
1616
  /** Definition files as read (untrusted JSON; the server parses and validates them). */
1564
1617
  definitions: unknown[];
1618
+ /**
1619
+ * Each file's scope, parallel to `definitions` (its folder: `models/` → network, `sites/<key>/` →
1620
+ * site). Omit for a tree without site folders: every file is shared. Only creates use it.
1621
+ */
1622
+ scopes?: DefinitionScope[];
1565
1623
  /** The lock file the files came from: the versions the local copy is based on. */
1566
1624
  base: LockFile;
1567
1625
  prune: boolean;
@@ -1852,10 +1910,13 @@ declare const createClient: ({ baseUrl, token, fetch, credentials, headers, site
1852
1910
  };
1853
1911
  };
1854
1912
  models: {
1855
- list: () => Promise<DefinitionListItem[]>;
1913
+ list: (options?: {
1914
+ scope?: DefinitionScope;
1915
+ }) => Promise<DefinitionListItem[]>;
1856
1916
  get: (id: string) => Promise<DefinitionDetail>;
1857
1917
  create: (body: CreateDefinitionInput) => Promise<ChangeOutcome>;
1858
- planCreate: (definition: DefinitionPayload) => Promise<PlanPreview>;
1918
+ planCreate: (definition: DefinitionPayload, scope?: DefinitionScope) => Promise<PlanPreview>;
1919
+ changeScope: (id: string, body: ChangeScopeInput) => Promise<ChangeScopeOutcome>;
1859
1920
  update: (id: string, body: UpdateDefinitionInput) => Promise<ChangeOutcome>;
1860
1921
  planUpdate: (id: string, body: PlanUpdateInput) => Promise<PlanPreview>;
1861
1922
  remove: (id: string, expectedVersion: number) => Promise<ChangeOutcome>;
@@ -1863,10 +1924,13 @@ declare const createClient: ({ baseUrl, token, fetch, credentials, headers, site
1863
1924
  changes: (id: string) => Promise<SchemaChangeJob[]>;
1864
1925
  };
1865
1926
  components: {
1866
- list: () => Promise<DefinitionListItem[]>;
1927
+ list: (options?: {
1928
+ scope?: DefinitionScope;
1929
+ }) => Promise<DefinitionListItem[]>;
1867
1930
  get: (id: string) => Promise<DefinitionDetail>;
1868
1931
  create: (body: CreateDefinitionInput) => Promise<ChangeOutcome>;
1869
- planCreate: (definition: DefinitionPayload) => Promise<PlanPreview>;
1932
+ planCreate: (definition: DefinitionPayload, scope?: DefinitionScope) => Promise<PlanPreview>;
1933
+ changeScope: (id: string, body: ChangeScopeInput) => Promise<ChangeScopeOutcome>;
1870
1934
  update: (id: string, body: UpdateDefinitionInput) => Promise<ChangeOutcome>;
1871
1935
  planUpdate: (id: string, body: PlanUpdateInput) => Promise<PlanPreview>;
1872
1936
  remove: (id: string, expectedVersion: number) => Promise<ChangeOutcome>;
@@ -1876,7 +1940,9 @@ declare const createClient: ({ baseUrl, token, fetch, credentials, headers, site
1876
1940
  schema: {
1877
1941
  summary: () => Promise<SchemaSummary>;
1878
1942
  change: (changeId: string) => Promise<SchemaChangeJob>;
1879
- export: () => Promise<SchemaExport>;
1943
+ export: (options?: {
1944
+ scope?: DefinitionScope;
1945
+ }) => Promise<SchemaExport>;
1880
1946
  apply: (body: SchemaApplyInput) => Promise<SchemaApplyResult>;
1881
1947
  settings: () => Promise<SchemaSettings>;
1882
1948
  updateSettings: (body: UpdateSchemaSettingsInput) => Promise<SchemaSettings>;
@@ -2494,10 +2560,13 @@ declare const createAdminApi: (request: RequestFn) => {
2494
2560
  };
2495
2561
  };
2496
2562
  models: {
2497
- list: () => Promise<DefinitionListItem[]>;
2563
+ list: (options?: {
2564
+ scope?: DefinitionScope;
2565
+ }) => Promise<DefinitionListItem[]>;
2498
2566
  get: (id: string) => Promise<DefinitionDetail>;
2499
2567
  create: (body: CreateDefinitionInput) => Promise<ChangeOutcome>;
2500
- planCreate: (definition: DefinitionPayload) => Promise<PlanPreview>;
2568
+ planCreate: (definition: DefinitionPayload, scope?: DefinitionScope) => Promise<PlanPreview>;
2569
+ changeScope: (id: string, body: ChangeScopeInput) => Promise<ChangeScopeOutcome>;
2501
2570
  update: (id: string, body: UpdateDefinitionInput) => Promise<ChangeOutcome>;
2502
2571
  planUpdate: (id: string, body: PlanUpdateInput) => Promise<PlanPreview>;
2503
2572
  remove: (id: string, expectedVersion: number) => Promise<ChangeOutcome>;
@@ -2505,10 +2574,13 @@ declare const createAdminApi: (request: RequestFn) => {
2505
2574
  changes: (id: string) => Promise<SchemaChangeJob[]>;
2506
2575
  };
2507
2576
  components: {
2508
- list: () => Promise<DefinitionListItem[]>;
2577
+ list: (options?: {
2578
+ scope?: DefinitionScope;
2579
+ }) => Promise<DefinitionListItem[]>;
2509
2580
  get: (id: string) => Promise<DefinitionDetail>;
2510
2581
  create: (body: CreateDefinitionInput) => Promise<ChangeOutcome>;
2511
- planCreate: (definition: DefinitionPayload) => Promise<PlanPreview>;
2582
+ planCreate: (definition: DefinitionPayload, scope?: DefinitionScope) => Promise<PlanPreview>;
2583
+ changeScope: (id: string, body: ChangeScopeInput) => Promise<ChangeScopeOutcome>;
2512
2584
  update: (id: string, body: UpdateDefinitionInput) => Promise<ChangeOutcome>;
2513
2585
  planUpdate: (id: string, body: PlanUpdateInput) => Promise<PlanPreview>;
2514
2586
  remove: (id: string, expectedVersion: number) => Promise<ChangeOutcome>;
@@ -2518,7 +2590,9 @@ declare const createAdminApi: (request: RequestFn) => {
2518
2590
  schema: {
2519
2591
  summary: () => Promise<SchemaSummary>;
2520
2592
  change: (changeId: string) => Promise<SchemaChangeJob>;
2521
- export: () => Promise<SchemaExport>;
2593
+ export: (options?: {
2594
+ scope?: DefinitionScope;
2595
+ }) => Promise<SchemaExport>;
2522
2596
  apply: (body: SchemaApplyInput) => Promise<SchemaApplyResult>;
2523
2597
  settings: () => Promise<SchemaSettings>;
2524
2598
  updateSettings: (body: UpdateSchemaSettingsInput) => Promise<SchemaSettings>;
@@ -2764,5 +2838,5 @@ declare const codeChallengeOf: (codeVerifier: string) => Promise<string>;
2764
2838
  /** A fresh verifier (32 random bytes, 43 characters) and its S256 challenge. */
2765
2839
  declare const createPkcePair: () => Promise<AppPkcePair>;
2766
2840
  //#endregion
2767
- export { AltTextResult as $, UpdateDeploymentConnectionInput as $i, SetupInput as $n, DefinitionRevision as $r, MoveMediaAssetsResult as $t, ADMIN_PATHS as A, ContentFilter as Aa, DeploymentRunTrigger as Ai, CsrfResponse as An, ReviewSchemaItem as Ar, SnapshotChange as At, HEALTH_RULES as B, EntryAuthor as Ba, JobSummary as Bi, NETWORK_ACTIONS as Bn, SnapshotSource as Br, MediaAsset as Bt, AdminApi as C, DeliveryList as Ca, DEPLOYMENT_TRIGGERS as Ci, AuditQuery as Cn, FieldDiff as Cr, ShapioClientOptions as Ct, toContentQueryString as D, AdminEntry as Da, DeploymentRun as Di, CreateApiTokenInput as Dn, PutSchemaDraftInput as Dr, ReadyResponse as Dt, resolveUploadUrl as E, DeliveryPagination as Ea, DeploymentProvider as Ei, ContentAction as En, NotRestorableReason as Er, HealthResponse as Et, ContentHealthFinding as F, ContentPagination as Fa, DeploymentTriggerPolicy as Fi, Invitation as Fn, ShipChangeSetInput as Fr, SchemaApplyResult as Ft, PreflightLocale as G, EntryReferrer as Ga, PreviewTarget as Gi, Role as Gn, ChangeOutcome as Gr, MediaFolder as Gt, ModelPresence as H, EntryLocaleState as Ha, OpenPreviewResult as Hi, PasswordResetConfirmInput as Hn, UpdateChangeSetInput as Hr, MediaAssetQuery as Ht, ContentHealthPage as I, ContentSort as Ia, JOB_STATUSES as Ii, InvitationLink as In, ShipPhase as Ir, SchemaExport as It, PresenceHeartbeatInput as J, RevisionSummary as Ja, PublicationAction as Ji, RoleKind as Jn, CreateLocaleInput as Jr, MediaUsagePage as Jt, PreflightResponse as K, EntryStatus as Ka, PreviewToken as Ki, RoleAssignment as Kn, ChangePlan as Kr, MediaStorageDriver as Kt, ContentHealthQuery as L, CreateEntryInput as La, Job as Li, InviteUserInput as Ln, Snapshot as Lr, SchemaSyncResult as Lt, CheckSeverity as M, ContentFilterValue as Ma, DeploymentSecretsInput as Mi, GLOBAL_ACTIONS as Mn, ScheduleChangeSetInput as Mr, SnapshotChangesPage as Mt, ContentCount as N, ContentIssue as Na, DeploymentSettings as Ni, GlobalAction as Nn, SchemaDraft as Nr, SnapshotChangesQuery as Nt, SITES_PATHS as O, AdminEntryListItem as Oa, DeploymentRunQuery as Oi, CreateRoleInput as On, ReviewEntryItem as Or, VersionResponse as Ot, ContentCounts as P, ContentListQuery as Pa, DeploymentTimelineEvent as Pi, InspectInvitationResponse as Pn, SchemaOperation as Pr, SchemaApplyInput as Pt, AltTextInput as Q, ScheduledPublication as Qi, SessionStarted as Qn, DefinitionPayload as Qr, MoveMediaAssetsInput as Qt, ContentHealthSummary as R, EditorManifest as Ra, JobQuery as Ri, LoginInput as Rn, SnapshotPage as Rr, CreateMediaFolderInput as Rt, DeliveryApi as S, DeliveryItem as Sa, DEPLOYMENT_RUN_STATUSES as Si, AuditPage as Sn, FieldConsumers as Sr, ShapioClient as St, buildUploadForm as T, DeliveryMeta as Ta, DeploymentConnectionCreated as Ti, ChangePasswordInput as Tn, NotRestorable as Tr, CheckStatus as Tt, PreflightCheck as U, EntryLocaleStatus as Ua, PUBLICATION_ACTIONS as Ui, PasswordResetRequestInput as Un, Acknowledgement as Ur, MediaAssetStatus as Ut, HealthRule as V, EntryData as Va, OpenPreviewInput as Vi, NetworkAction as Vn, UnassignedEntry as Vr, MediaAssetPage as Vt, PreflightInput as W, EntryLocalesInput as Wa, Page as Wi, PermissionAction as Wn, ActiveDefinition as Wr, MediaFocalPoint as Wt, AltMissingResult as X, RequestFn as Xa, ScheduleQuery as Xi, RoleSummary as Xn, DefinitionDetail as Xr, MediaVariantStatus as Xt, PresencePerson as Y, UpdateEntryInput as Ya, SCHEDULE_STATUSES as Yi, RolePermission as Yn, DefinitionCategory as Yr, MediaVariant as Yt, AltProposal as Z, RequestOptions as Za, ScheduleStatus as Zi, SITE_ACTIONS as Zn, DefinitionListItem as Zr, MediaVisibility as Zt, WebhookSignatureCheck as _, SiteAppRoles as _a, CreateDeploymentConnectionInput as _i, AdminUser as _n, ChangeSetStatus as _r, SummarizeInput as _t, AppAuthApi as a, WebhookEventBody as aa, PlanStepImpact as ai, AdminAppUser as an, AddChangeSetEntryInput as ar, CONTENT_OPS_RULES as at, SITE_QUERY_PARAMETER as b, UpdateSiteInput as ba, CreateWebhookInput as bi, AuditActorType as bn, CreateChangeSetInput as br, ShapioApiError as bt, AppOAuthProvider as c, FieldPrincipalUsage as ca, SchemaChangeStatus as ci, AppRolePermission as cn, ChangeSetActor as cr, ContentOpsRule as ct, AppSession as d, ModelFieldUsage as da, SchemaSummaryItem as di, BUILT_IN_APP_ROLE_KEYS as dn, ChangeSetItem as dr, ContentOpsStatus as dt, UpdateWebhookInput as ea, DeleteLocaleResult as ei, ReplaceUploadInput as en, SetupStatusResponse as er, AssistIssue as et, AppUser as f, PrincipalUsageSummary as fa, SetDefaultLocaleResult as fi, CreateAppRoleInput as fn, ChangeSetItemStatus as fr, ContentOpsWritten as ft, WEBHOOK_TOLERANCE_SECONDS as g, Site as ga, ConnectionTestResult as gi, AdminSession as gn, ChangeSetSource as gr, SchemaDraftResult as gt, WEBHOOK_TIMESTAMP_HEADER as h, SetSiteAppRolesInput as ha, UpdateSchemaSettingsInput as hi, AcceptInvitationInput as hn, ChangeSetSchemaItem as hr, SchemaDraftInput as ht, APP_AUTH_PATHS as i, WebhookDeliveryStatus as ia, PlanStep as ii, APP_CONTENT_ACTIONS as in, UpdateRoleInput as ir, AssistUsage as it, CheckParams as j, ContentFilterOperator as ja, DeploymentSecretState as ji, EmailDelivery as jn, SNAPSHOT_SOURCES as jr, SnapshotChangeKind as jt, SITE_HEADER as k, AdminEntryPage as ka, DeploymentRunStatus as ki, CreatedApiToken as kn, ReviewIssue as kr, CurrentSnapshot as kt, AppRegisterInput as l, FieldUsageQuery as la, SchemaSettings as li, AppUserPage as ln, ChangeSetEntryItem as lr, ContentOpsRun as lt, WEBHOOK_SIGNATURE_HEADER as m, CreateSiteInput as ma, UpdateLocaleInput as mi, UpdateAppUserInput as mn, ChangeSetReview as mr, RewriteInput as mt, codeChallengeOf as n, WebhookAttempt as na, PlanImpact as ni, UpdateMediaFolderInput as nn, UpdateAdminUserInput as nr, AssistStatus as nt, AppChangePasswordInput as o, WebhookEventType as oa, PlanUpdateInput as oi, AppContentAction as on, CHANGE_SET_STATUSES as or, ContentOpsInput as ot, WEBHOOK_EVENT_HEADER as p, UsageSelection as pa, UpdateDefinitionInput as pi, UpdateAppRoleInput as pn, ChangeSetQuery as pr, LocaleMissingResult as pt, PreflightRule as q, RevisionDetail as qa, PreviewTokenCreated as qi, RoleCondition as qn, CreateDefinitionInput as qr, MediaUsage as qt, createPkcePair as r, WebhookDelivery as ra, PlanPreview as ri, UploadGrant as rn, UpdateProfileInput as rr, AssistTextResult as rt, AppLoginInput as s, WebhookWithSecret as sa, SchemaChangeJob as si, AppRole as sn, ChangeSet as sr, ContentOpsResult as st, AppPkcePair as t, Webhook as ta, Locale as ti, UpdateMediaAssetInput as tn, SiteAction as tr, AssistProvider as tt, AppRegisterResult as u, FieldUsageResponse as ua, SchemaSummary as ui, AppUserQuery as un, ChangeSetError as ur, ContentOpsSkip as ut, WebhookSignatureInput as v, SiteRef as va, CreatePreviewTokenInput as vi, AdminUserStatus as vn, ChangeSetSummary as vr, TranslateInput as vt, ASSIST_PATHS as w, DeliveryListQuery as wa, DeploymentConnection as wi, CONTENT_ACTIONS as wn, NOT_RESTORABLE_REASONS as wr, createClient as wt, DELIVERY_PATH as x, DeliveryGetQuery as xa, DEPLOYMENT_PROVIDERS as xi, AuditEvent as xn, FieldConsumer as xr, ShapioErrorBody as xt, verifyWebhookSignature as y, SiteSummary as ya, CreateScheduleInput as yi, ApiToken as yn, ChangeSetTimelineEvent as yr, TranslateResult as yt, EntryPresence as z, EditorManifestItem as za, JobStatus as zi, MeResponse as zn, SnapshotQuery as zr, CreateUploadInput as zt };
2768
- //# sourceMappingURL=index-BpSg5A3V.d.ts.map
2841
+ export { AltTextResult as $, RequestFn as $a, ScheduleQuery as $i, SetupInput as $n, DefinitionListItem as $r, MoveMediaAssetsResult as $t, ADMIN_PATHS as A, AdminEntry as Aa, DeploymentRun as Ai, CsrfResponse as An, ReviewSchemaItem as Ar, SnapshotChange as At, HEALTH_RULES as B, CreateEntryInput as Ba, Job as Bi, NETWORK_ACTIONS as Bn, SnapshotSource as Br, MediaAsset as Bt, AdminApi as C, UpdateSiteInput as Ca, CreateWebhookInput as Ci, AuditQuery as Cn, FieldDiff as Cr, ShapioClientOptions as Ct, toContentQueryString as D, DeliveryListQuery as Da, DeploymentConnection as Di, CreateApiTokenInput as Dn, PutSchemaDraftInput as Dr, ReadyResponse as Dt, resolveUploadUrl as E, DeliveryList as Ea, DEPLOYMENT_TRIGGERS as Ei, ContentAction as En, NotRestorableReason as Er, HealthResponse as Et, ContentHealthFinding as F, ContentFilterValue as Fa, DeploymentSecretsInput as Fi, Invitation as Fn, ShipChangeSetInput as Fr, SchemaApplyResult as Ft, PreflightLocale as G, EntryLocaleState as Ga, OpenPreviewResult as Gi, Role as Gn, ChangeOutcome as Gr, MediaFolder as Gt, ModelPresence as H, EditorManifestItem as Ha, JobStatus as Hi, PasswordResetConfirmInput as Hn, UpdateChangeSetInput as Hr, MediaAssetQuery as Ht, ContentHealthPage as I, ContentIssue as Ia, DeploymentSettings as Ii, InvitationLink as In, ShipPhase as Ir, SchemaExport as It, PresenceHeartbeatInput as J, EntryReferrer as Ja, PreviewTarget as Ji, RoleKind as Jn, ChangeScopeOutcome as Jr, MediaUsagePage as Jt, PreflightResponse as K, EntryLocaleStatus as Ka, PUBLICATION_ACTIONS as Ki, RoleAssignment as Kn, ChangePlan as Kr, MediaStorageDriver as Kt, ContentHealthQuery as L, ContentListQuery as La, DeploymentTimelineEvent as Li, InviteUserInput as Ln, Snapshot as Lr, SchemaSyncResult as Lt, CheckSeverity as M, AdminEntryPage as Ma, DeploymentRunStatus as Mi, GLOBAL_ACTIONS as Mn, ScheduleChangeSetInput as Mr, SnapshotChangesPage as Mt, ContentCount as N, ContentFilter as Na, DeploymentRunTrigger as Ni, GlobalAction as Nn, SchemaDraft as Nr, SnapshotChangesQuery as Nt, SITES_PATHS as O, DeliveryMeta as Oa, DeploymentConnectionCreated as Oi, CreateRoleInput as On, ReviewEntryItem as Or, VersionResponse as Ot, ContentCounts as P, ContentFilterOperator as Pa, DeploymentSecretState as Pi, InspectInvitationResponse as Pn, SchemaOperation as Pr, SchemaApplyInput as Pt, AltTextInput as Q, UpdateEntryInput as Qa, SCHEDULE_STATUSES as Qi, SessionStarted as Qn, DefinitionDetail as Qr, MoveMediaAssetsInput as Qt, ContentHealthSummary as R, ContentPagination as Ra, DeploymentTriggerPolicy as Ri, LoginInput as Rn, SnapshotPage as Rr, CreateMediaFolderInput as Rt, DeliveryApi as S, SiteSummary as Sa, CreateScheduleInput as Si, AuditPage as Sn, FieldConsumers as Sr, ShapioClient as St, buildUploadForm as T, DeliveryItem as Ta, DEPLOYMENT_RUN_STATUSES as Ti, ChangePasswordInput as Tn, NotRestorable as Tr, CheckStatus as Tt, PreflightCheck as U, EntryAuthor as Ua, JobSummary as Ui, PasswordResetRequestInput as Un, Acknowledgement as Ur, MediaAssetStatus as Ut, HealthRule as V, EditorManifest as Va, JobQuery as Vi, NetworkAction as Vn, UnassignedEntry as Vr, MediaAssetPage as Vt, PreflightInput as W, EntryData as Wa, OpenPreviewInput as Wi, PermissionAction as Wn, ActiveDefinition as Wr, MediaFocalPoint as Wt, AltMissingResult as X, RevisionDetail as Xa, PreviewTokenCreated as Xi, RoleSummary as Xn, CreateLocaleInput as Xr, MediaVariantStatus as Xt, PresencePerson as Y, EntryStatus as Ya, PreviewToken as Yi, RolePermission as Yn, CreateDefinitionInput as Yr, MediaVariant as Yt, AltProposal as Z, RevisionSummary as Za, PublicationAction as Zi, SITE_ACTIONS as Zn, DefinitionCategory as Zr, MediaVisibility as Zt, WebhookSignatureCheck as _, CreateSiteInput as _a, UpdateLocaleInput as _i, AdminUser as _n, ChangeSetStatus as _r, SummarizeInput as _t, AppAuthApi as a, WebhookAttempt as aa, PlanImpact as ai, AdminAppUser as an, AddChangeSetEntryInput as ar, CONTENT_OPS_RULES as at, SITE_QUERY_PARAMETER as b, SiteAppRoles as ba, CreateDeploymentConnectionInput as bi, AuditActorType as bn, CreateChangeSetInput as br, ShapioApiError as bt, AppOAuthProvider as c, WebhookEventBody as ca, PlanStepImpact as ci, AppRolePermission as cn, ChangeSetActor as cr, ContentOpsRule as ct, AppSession as d, FieldPrincipalUsage as da, SchemaChangeStatus as di, BUILT_IN_APP_ROLE_KEYS as dn, ChangeSetItem as dr, ContentOpsStatus as dt, ScheduleStatus as ea, DefinitionPayload as ei, ReplaceUploadInput as en, RequestOptions as eo, SetupStatusResponse as er, AssistIssue as et, AppUser as f, FieldUsageQuery as fa, SchemaSettings as fi, CreateAppRoleInput as fn, ChangeSetItemStatus as fr, ContentOpsWritten as ft, WEBHOOK_TOLERANCE_SECONDS as g, UsageSelection as ga, UpdateDefinitionInput as gi, AdminSession as gn, ChangeSetSource as gr, SchemaDraftResult as gt, WEBHOOK_TIMESTAMP_HEADER as h, PrincipalUsageSummary as ha, SetDefaultLocaleResult as hi, AcceptInvitationInput as hn, ChangeSetSchemaItem as hr, SchemaDraftInput as ht, APP_AUTH_PATHS as i, Webhook as ia, Locale as ii, APP_CONTENT_ACTIONS as in, UpdateRoleInput as ir, AssistUsage as it, CheckParams as j, AdminEntryListItem as ja, DeploymentRunQuery as ji, EmailDelivery as jn, SNAPSHOT_SOURCES as jr, SnapshotChangeKind as jt, SITE_HEADER as k, DeliveryPagination as ka, DeploymentProvider as ki, CreatedApiToken as kn, ReviewIssue as kr, CurrentSnapshot as kt, AppRegisterInput as l, WebhookEventType as la, PlanUpdateInput as li, AppUserPage as ln, ChangeSetEntryItem as lr, ContentOpsRun as lt, WEBHOOK_SIGNATURE_HEADER as m, ModelFieldUsage as ma, SchemaSummaryItem as mi, UpdateAppUserInput as mn, ChangeSetReview as mr, RewriteInput as mt, codeChallengeOf as n, UpdateDeploymentConnectionInput as na, DefinitionScope as ni, UpdateMediaFolderInput as nn, UpdateAdminUserInput as nr, AssistStatus as nt, AppChangePasswordInput as o, WebhookDelivery as oa, PlanPreview as oi, AppContentAction as on, CHANGE_SET_STATUSES as or, ContentOpsInput as ot, WEBHOOK_EVENT_HEADER as p, FieldUsageResponse as pa, SchemaSummary as pi, UpdateAppRoleInput as pn, ChangeSetQuery as pr, LocaleMissingResult as pt, PreflightRule as q, EntryLocalesInput as qa, Page as qi, RoleCondition as qn, ChangeScopeInput as qr, MediaUsage as qt, createPkcePair as r, UpdateWebhookInput as ra, DeleteLocaleResult as ri, UploadGrant as rn, UpdateProfileInput as rr, AssistTextResult as rt, AppLoginInput as s, WebhookDeliveryStatus as sa, PlanStep as si, AppRole as sn, ChangeSet as sr, ContentOpsResult as st, AppPkcePair as t, ScheduledPublication as ta, DefinitionRevision as ti, UpdateMediaAssetInput as tn, SiteAction as tr, AssistProvider as tt, AppRegisterResult as u, WebhookWithSecret as ua, SchemaChangeJob as ui, AppUserQuery as un, ChangeSetError as ur, ContentOpsSkip as ut, WebhookSignatureInput as v, SetSiteAppRolesInput as va, UpdateSchemaSettingsInput as vi, AdminUserStatus as vn, ChangeSetSummary as vr, TranslateInput as vt, ASSIST_PATHS as w, DeliveryGetQuery as wa, DEPLOYMENT_PROVIDERS as wi, CONTENT_ACTIONS as wn, NOT_RESTORABLE_REASONS as wr, createClient as wt, DELIVERY_PATH as x, SiteRef as xa, CreatePreviewTokenInput as xi, AuditEvent as xn, FieldConsumer as xr, ShapioErrorBody as xt, verifyWebhookSignature as y, Site as ya, ConnectionTestResult as yi, ApiToken as yn, ChangeSetTimelineEvent as yr, TranslateResult as yt, EntryPresence as z, ContentSort as za, JOB_STATUSES as zi, MeResponse as zn, SnapshotQuery as zr, CreateUploadInput as zt };
2842
+ //# sourceMappingURL=index-DJopnXJu.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as AltTextResult, $i as UpdateDeploymentConnectionInput, $n as SetupInput, $r as DefinitionRevision, $t as MoveMediaAssetsResult, A as ADMIN_PATHS, Aa as ContentFilter, Ai as DeploymentRunTrigger, An as CsrfResponse, Ar as ReviewSchemaItem, At as SnapshotChange, B as HEALTH_RULES, Ba as EntryAuthor, Bi as JobSummary, Bn as NETWORK_ACTIONS, Br as SnapshotSource, Bt as MediaAsset, C as AdminApi, Ca as DeliveryList, Ci as DEPLOYMENT_TRIGGERS, Cn as AuditQuery, Cr as FieldDiff, Ct as ShapioClientOptions, D as toContentQueryString, Da as AdminEntry, Di as DeploymentRun, Dn as CreateApiTokenInput, Dr as PutSchemaDraftInput, Dt as ReadyResponse, E as resolveUploadUrl, Ea as DeliveryPagination, Ei as DeploymentProvider, En as ContentAction, Er as NotRestorableReason, Et as HealthResponse, F as ContentHealthFinding, Fa as ContentPagination, Fi as DeploymentTriggerPolicy, Fn as Invitation, Fr as ShipChangeSetInput, Ft as SchemaApplyResult, G as PreflightLocale, Ga as EntryReferrer, Gi as PreviewTarget, Gn as Role, Gr as ChangeOutcome, Gt as MediaFolder, H as ModelPresence, Ha as EntryLocaleState, Hi as OpenPreviewResult, Hn as PasswordResetConfirmInput, Hr as UpdateChangeSetInput, Ht as MediaAssetQuery, I as ContentHealthPage, Ia as ContentSort, Ii as JOB_STATUSES, In as InvitationLink, Ir as ShipPhase, It as SchemaExport, J as PresenceHeartbeatInput, Ja as RevisionSummary, Ji as PublicationAction, Jn as RoleKind, Jr as CreateLocaleInput, Jt as MediaUsagePage, K as PreflightResponse, Ka as EntryStatus, Ki as PreviewToken, Kn as RoleAssignment, Kr as ChangePlan, Kt as MediaStorageDriver, L as ContentHealthQuery, La as CreateEntryInput, Li as Job, Ln as InviteUserInput, Lr as Snapshot, Lt as SchemaSyncResult, M as CheckSeverity, Ma as ContentFilterValue, Mi as DeploymentSecretsInput, Mn as GLOBAL_ACTIONS, Mr as ScheduleChangeSetInput, Mt as SnapshotChangesPage, N as ContentCount, Na as ContentIssue, Ni as DeploymentSettings, Nn as GlobalAction, Nr as SchemaDraft, Nt as SnapshotChangesQuery, O as SITES_PATHS, Oa as AdminEntryListItem, Oi as DeploymentRunQuery, On as CreateRoleInput, Or as ReviewEntryItem, Ot as VersionResponse, P as ContentCounts, Pa as ContentListQuery, Pi as DeploymentTimelineEvent, Pn as InspectInvitationResponse, Pr as SchemaOperation, Pt as SchemaApplyInput, Q as AltTextInput, Qi as ScheduledPublication, Qn as SessionStarted, Qr as DefinitionPayload, Qt as MoveMediaAssetsInput, R as ContentHealthSummary, Ra as EditorManifest, Ri as JobQuery, Rn as LoginInput, Rr as SnapshotPage, Rt as CreateMediaFolderInput, S as DeliveryApi, Sa as DeliveryItem, Si as DEPLOYMENT_RUN_STATUSES, Sn as AuditPage, Sr as FieldConsumers, St as ShapioClient, T as buildUploadForm, Ta as DeliveryMeta, Ti as DeploymentConnectionCreated, Tn as ChangePasswordInput, Tr as NotRestorable, Tt as CheckStatus, U as PreflightCheck, Ua as EntryLocaleStatus, Ui as PUBLICATION_ACTIONS, Un as PasswordResetRequestInput, Ur as Acknowledgement, Ut as MediaAssetStatus, V as HealthRule, Va as EntryData, Vi as OpenPreviewInput, Vn as NetworkAction, Vr as UnassignedEntry, Vt as MediaAssetPage, W as PreflightInput, Wa as EntryLocalesInput, Wi as Page, Wn as PermissionAction, Wr as ActiveDefinition, Wt as MediaFocalPoint, X as AltMissingResult, Xa as RequestFn, Xi as ScheduleQuery, Xn as RoleSummary, Xr as DefinitionDetail, Xt as MediaVariantStatus, Y as PresencePerson, Ya as UpdateEntryInput, Yi as SCHEDULE_STATUSES, Yn as RolePermission, Yr as DefinitionCategory, Yt as MediaVariant, Z as AltProposal, Za as RequestOptions, Zi as ScheduleStatus, Zn as SITE_ACTIONS, Zr as DefinitionListItem, Zt as MediaVisibility, _ as WebhookSignatureCheck, _a as SiteAppRoles, _i as CreateDeploymentConnectionInput, _n as AdminUser, _r as ChangeSetStatus, _t as SummarizeInput, a as AppAuthApi, aa as WebhookEventBody, ai as PlanStepImpact, an as AdminAppUser, ar as AddChangeSetEntryInput, at as CONTENT_OPS_RULES, b as SITE_QUERY_PARAMETER, ba as UpdateSiteInput, bi as CreateWebhookInput, bn as AuditActorType, br as CreateChangeSetInput, bt as ShapioApiError, c as AppOAuthProvider, ca as FieldPrincipalUsage, ci as SchemaChangeStatus, cn as AppRolePermission, cr as ChangeSetActor, ct as ContentOpsRule, d as AppSession, da as ModelFieldUsage, di as SchemaSummaryItem, dn as BUILT_IN_APP_ROLE_KEYS, dr as ChangeSetItem, dt as ContentOpsStatus, ea as UpdateWebhookInput, ei as DeleteLocaleResult, en as ReplaceUploadInput, er as SetupStatusResponse, et as AssistIssue, f as AppUser, fa as PrincipalUsageSummary, fi as SetDefaultLocaleResult, fn as CreateAppRoleInput, fr as ChangeSetItemStatus, ft as ContentOpsWritten, g as WEBHOOK_TOLERANCE_SECONDS, ga as Site, gi as ConnectionTestResult, gn as AdminSession, gr as ChangeSetSource, gt as SchemaDraftResult, h as WEBHOOK_TIMESTAMP_HEADER, ha as SetSiteAppRolesInput, hi as UpdateSchemaSettingsInput, hn as AcceptInvitationInput, hr as ChangeSetSchemaItem, ht as SchemaDraftInput, i as APP_AUTH_PATHS, ia as WebhookDeliveryStatus, ii as PlanStep, in as APP_CONTENT_ACTIONS, ir as UpdateRoleInput, it as AssistUsage, j as CheckParams, ja as ContentFilterOperator, ji as DeploymentSecretState, jn as EmailDelivery, jr as SNAPSHOT_SOURCES, jt as SnapshotChangeKind, k as SITE_HEADER, ka as AdminEntryPage, ki as DeploymentRunStatus, kn as CreatedApiToken, kr as ReviewIssue, kt as CurrentSnapshot, l as AppRegisterInput, la as FieldUsageQuery, li as SchemaSettings, ln as AppUserPage, lr as ChangeSetEntryItem, lt as ContentOpsRun, m as WEBHOOK_SIGNATURE_HEADER, ma as CreateSiteInput, mi as UpdateLocaleInput, mn as UpdateAppUserInput, mr as ChangeSetReview, mt as RewriteInput, n as codeChallengeOf, na as WebhookAttempt, ni as PlanImpact, nn as UpdateMediaFolderInput, nr as UpdateAdminUserInput, nt as AssistStatus, o as AppChangePasswordInput, oa as WebhookEventType, oi as PlanUpdateInput, on as AppContentAction, or as CHANGE_SET_STATUSES, ot as ContentOpsInput, p as WEBHOOK_EVENT_HEADER, pa as UsageSelection, pi as UpdateDefinitionInput, pn as UpdateAppRoleInput, pr as ChangeSetQuery, pt as LocaleMissingResult, q as PreflightRule, qa as RevisionDetail, qi as PreviewTokenCreated, qn as RoleCondition, qr as CreateDefinitionInput, qt as MediaUsage, r as createPkcePair, ra as WebhookDelivery, ri as PlanPreview, rn as UploadGrant, rr as UpdateProfileInput, rt as AssistTextResult, s as AppLoginInput, sa as WebhookWithSecret, si as SchemaChangeJob, sn as AppRole, sr as ChangeSet, st as ContentOpsResult, t as AppPkcePair, ta as Webhook, ti as Locale, tn as UpdateMediaAssetInput, tr as SiteAction, tt as AssistProvider, u as AppRegisterResult, ua as FieldUsageResponse, ui as SchemaSummary, un as AppUserQuery, ur as ChangeSetError, ut as ContentOpsSkip, v as WebhookSignatureInput, va as SiteRef, vi as CreatePreviewTokenInput, vn as AdminUserStatus, vr as ChangeSetSummary, vt as TranslateInput, w as ASSIST_PATHS, wa as DeliveryListQuery, wi as DeploymentConnection, wn as CONTENT_ACTIONS, wr as NOT_RESTORABLE_REASONS, wt as createClient, x as DELIVERY_PATH, xa as DeliveryGetQuery, xi as DEPLOYMENT_PROVIDERS, xn as AuditEvent, xr as FieldConsumer, xt as ShapioErrorBody, y as verifyWebhookSignature, ya as SiteSummary, yi as CreateScheduleInput, yn as ApiToken, yr as ChangeSetTimelineEvent, yt as TranslateResult, z as EntryPresence, za as EditorManifestItem, zi as JobStatus, zn as MeResponse, zr as SnapshotQuery, zt as CreateUploadInput } from "./index-BpSg5A3V.js";
2
- export { ADMIN_PATHS, APP_AUTH_PATHS, APP_CONTENT_ACTIONS, ASSIST_PATHS, type AcceptInvitationInput, type Acknowledgement, type ActiveDefinition, type AddChangeSetEntryInput, type AdminApi, type AdminAppUser, type AdminEntry, type AdminEntryListItem, type AdminEntryPage, type AdminSession, type AdminUser, type AdminUserStatus, type AltMissingResult, type AltProposal, type AltTextInput, type AltTextResult, type ApiToken, type AppAuthApi, type AppChangePasswordInput, type AppContentAction, type AppLoginInput, type AppOAuthProvider, type AppPkcePair, type AppRegisterInput, type AppRegisterResult, type AppRole, type AppRolePermission, type AppSession, type AppUser, type AppUserPage, type AppUserQuery, type AssistIssue, type AssistProvider, type AssistStatus, type AssistTextResult, type AssistUsage, type AuditActorType, type AuditEvent, type AuditPage, type AuditQuery, BUILT_IN_APP_ROLE_KEYS, CHANGE_SET_STATUSES, CONTENT_ACTIONS, CONTENT_OPS_RULES, type ChangeOutcome, type ChangePasswordInput, type ChangePlan, type ChangeSet, type ChangeSetActor, type ChangeSetEntryItem, type ChangeSetError, type ChangeSetItem, type ChangeSetItemStatus, type ChangeSetQuery, type ChangeSetReview, type ChangeSetSchemaItem, type ChangeSetSource, type ChangeSetStatus, type ChangeSetSummary, type ChangeSetTimelineEvent, type CheckParams, type CheckSeverity, type CheckStatus, type ConnectionTestResult, type ContentAction, type ContentCount, type ContentCounts, type ContentFilter, type ContentFilterOperator, type ContentFilterValue, type ContentHealthFinding, type ContentHealthPage, type ContentHealthQuery, type ContentHealthSummary, type ContentIssue, type ContentListQuery, type ContentOpsInput, type ContentOpsResult, type ContentOpsRule, type ContentOpsRun, type ContentOpsSkip, type ContentOpsStatus, type ContentOpsWritten, type ContentPagination, type ContentSort, type CreateApiTokenInput, type CreateAppRoleInput, type CreateChangeSetInput, type CreateDefinitionInput, type CreateDeploymentConnectionInput, type CreateEntryInput, type CreateLocaleInput, type CreateMediaFolderInput, type CreatePreviewTokenInput, type CreateRoleInput, type CreateScheduleInput, type CreateSiteInput, type CreateUploadInput, type CreateWebhookInput, type CreatedApiToken, type CsrfResponse, type CurrentSnapshot, DELIVERY_PATH, DEPLOYMENT_PROVIDERS, DEPLOYMENT_RUN_STATUSES, DEPLOYMENT_TRIGGERS, type DefinitionCategory, type DefinitionDetail, type DefinitionListItem, type DefinitionPayload, type DefinitionRevision, type DeleteLocaleResult, type DeliveryApi, type DeliveryGetQuery, type DeliveryItem, type DeliveryList, type DeliveryListQuery, type DeliveryMeta, type DeliveryPagination, type DeploymentConnection, type DeploymentConnectionCreated, type DeploymentProvider, type DeploymentRun, type DeploymentRunQuery, type DeploymentRunStatus, type DeploymentRunTrigger, type DeploymentSecretState, type DeploymentSecretsInput, type DeploymentSettings, type DeploymentTimelineEvent, type DeploymentTriggerPolicy, type EditorManifest, type EditorManifestItem, type EmailDelivery, type EntryAuthor, type EntryData, type EntryLocaleState, type EntryLocaleStatus, type EntryLocalesInput, type EntryPresence, type EntryReferrer, type EntryStatus, type FieldConsumer, type FieldConsumers, type FieldDiff, type FieldPrincipalUsage, type FieldUsageQuery, type FieldUsageResponse, GLOBAL_ACTIONS, type GlobalAction, HEALTH_RULES, type HealthResponse, type HealthRule, type InspectInvitationResponse, type Invitation, type InvitationLink, type InviteUserInput, JOB_STATUSES, type Job, type JobQuery, type JobStatus, type JobSummary, type Locale, type LocaleMissingResult, type LoginInput, type MeResponse, type MediaAsset, type MediaAssetPage, type MediaAssetQuery, type MediaAssetStatus, type MediaFocalPoint, type MediaFolder, type MediaStorageDriver, type MediaUsage, type MediaUsagePage, type MediaVariant, type MediaVariantStatus, type MediaVisibility, type ModelFieldUsage, type ModelPresence, type MoveMediaAssetsInput, type MoveMediaAssetsResult, NETWORK_ACTIONS, NOT_RESTORABLE_REASONS, type NetworkAction, type NotRestorable, type NotRestorableReason, type OpenPreviewInput, type OpenPreviewResult, PUBLICATION_ACTIONS, type Page, type PasswordResetConfirmInput, type PasswordResetRequestInput, type PermissionAction, type PlanImpact, type PlanPreview, type PlanStep, type PlanStepImpact, type PlanUpdateInput, type PreflightCheck, type PreflightInput, type PreflightLocale, type PreflightResponse, type PreflightRule, type PresenceHeartbeatInput, type PresencePerson, type PreviewTarget, type PreviewToken, type PreviewTokenCreated, type PrincipalUsageSummary, type PublicationAction, type PutSchemaDraftInput, type ReadyResponse, type ReplaceUploadInput, type RequestFn, type RequestOptions, type ReviewEntryItem, type ReviewIssue, type ReviewSchemaItem, type RevisionDetail, type RevisionSummary, type RewriteInput, type Role, type RoleAssignment, type RoleCondition, type RoleKind, type RolePermission, type RoleSummary, SCHEDULE_STATUSES, SITES_PATHS, SITE_ACTIONS, SITE_HEADER, SITE_QUERY_PARAMETER, SNAPSHOT_SOURCES, type ScheduleChangeSetInput, type ScheduleQuery, type ScheduleStatus, type ScheduledPublication, type SchemaApplyInput, type SchemaApplyResult, type SchemaChangeJob, type SchemaChangeStatus, type SchemaDraft, type SchemaDraftInput, type SchemaDraftResult, type SchemaExport, type SchemaOperation, type SchemaSettings, type SchemaSummary, type SchemaSummaryItem, type SchemaSyncResult, type SessionStarted, type SetDefaultLocaleResult, type SetSiteAppRolesInput, type SetupInput, type SetupStatusResponse, ShapioApiError, type ShapioClient, type ShapioClientOptions, type ShapioErrorBody, type ShipChangeSetInput, type ShipPhase, type Site, type SiteAction, type SiteAppRoles, type SiteRef, type SiteSummary, type Snapshot, type SnapshotChange, type SnapshotChangeKind, type SnapshotChangesPage, type SnapshotChangesQuery, type SnapshotPage, type SnapshotQuery, type SnapshotSource, type SummarizeInput, type TranslateInput, type TranslateResult, type UnassignedEntry, type UpdateAdminUserInput, type UpdateAppRoleInput, type UpdateAppUserInput, type UpdateChangeSetInput, type UpdateDefinitionInput, type UpdateDeploymentConnectionInput, type UpdateEntryInput, type UpdateLocaleInput, type UpdateMediaAssetInput, type UpdateMediaFolderInput, type UpdateProfileInput, type UpdateRoleInput, type UpdateSchemaSettingsInput, type UpdateSiteInput, type UpdateWebhookInput, type UploadGrant, type UsageSelection, type VersionResponse, WEBHOOK_EVENT_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, WEBHOOK_TOLERANCE_SECONDS, type Webhook, type WebhookAttempt, type WebhookDelivery, type WebhookDeliveryStatus, type WebhookEventBody, type WebhookEventType, type WebhookSignatureCheck, type WebhookSignatureInput, type WebhookWithSecret, buildUploadForm, codeChallengeOf, createClient, createPkcePair, resolveUploadUrl, toContentQueryString, verifyWebhookSignature };
1
+ import { $ as AltTextResult, $a as RequestFn, $i as ScheduleQuery, $n as SetupInput, $r as DefinitionListItem, $t as MoveMediaAssetsResult, A as ADMIN_PATHS, Aa as AdminEntry, Ai as DeploymentRun, An as CsrfResponse, Ar as ReviewSchemaItem, At as SnapshotChange, B as HEALTH_RULES, Ba as CreateEntryInput, Bi as Job, Bn as NETWORK_ACTIONS, Br as SnapshotSource, Bt as MediaAsset, C as AdminApi, Ca as UpdateSiteInput, Ci as CreateWebhookInput, Cn as AuditQuery, Cr as FieldDiff, Ct as ShapioClientOptions, D as toContentQueryString, Da as DeliveryListQuery, Di as DeploymentConnection, Dn as CreateApiTokenInput, Dr as PutSchemaDraftInput, Dt as ReadyResponse, E as resolveUploadUrl, Ea as DeliveryList, Ei as DEPLOYMENT_TRIGGERS, En as ContentAction, Er as NotRestorableReason, Et as HealthResponse, F as ContentHealthFinding, Fa as ContentFilterValue, Fi as DeploymentSecretsInput, Fn as Invitation, Fr as ShipChangeSetInput, Ft as SchemaApplyResult, G as PreflightLocale, Ga as EntryLocaleState, Gi as OpenPreviewResult, Gn as Role, Gr as ChangeOutcome, Gt as MediaFolder, H as ModelPresence, Ha as EditorManifestItem, Hi as JobStatus, Hn as PasswordResetConfirmInput, Hr as UpdateChangeSetInput, Ht as MediaAssetQuery, I as ContentHealthPage, Ia as ContentIssue, Ii as DeploymentSettings, In as InvitationLink, Ir as ShipPhase, It as SchemaExport, J as PresenceHeartbeatInput, Ja as EntryReferrer, Ji as PreviewTarget, Jn as RoleKind, Jr as ChangeScopeOutcome, Jt as MediaUsagePage, K as PreflightResponse, Ka as EntryLocaleStatus, Ki as PUBLICATION_ACTIONS, Kn as RoleAssignment, Kr as ChangePlan, Kt as MediaStorageDriver, L as ContentHealthQuery, La as ContentListQuery, Li as DeploymentTimelineEvent, Ln as InviteUserInput, Lr as Snapshot, Lt as SchemaSyncResult, M as CheckSeverity, Ma as AdminEntryPage, Mi as DeploymentRunStatus, Mn as GLOBAL_ACTIONS, Mr as ScheduleChangeSetInput, Mt as SnapshotChangesPage, N as ContentCount, Na as ContentFilter, Ni as DeploymentRunTrigger, Nn as GlobalAction, Nr as SchemaDraft, Nt as SnapshotChangesQuery, O as SITES_PATHS, Oa as DeliveryMeta, Oi as DeploymentConnectionCreated, On as CreateRoleInput, Or as ReviewEntryItem, Ot as VersionResponse, P as ContentCounts, Pa as ContentFilterOperator, Pi as DeploymentSecretState, Pn as InspectInvitationResponse, Pr as SchemaOperation, Pt as SchemaApplyInput, Q as AltTextInput, Qa as UpdateEntryInput, Qi as SCHEDULE_STATUSES, Qn as SessionStarted, Qr as DefinitionDetail, Qt as MoveMediaAssetsInput, R as ContentHealthSummary, Ra as ContentPagination, Ri as DeploymentTriggerPolicy, Rn as LoginInput, Rr as SnapshotPage, Rt as CreateMediaFolderInput, S as DeliveryApi, Sa as SiteSummary, Si as CreateScheduleInput, Sn as AuditPage, Sr as FieldConsumers, St as ShapioClient, T as buildUploadForm, Ta as DeliveryItem, Ti as DEPLOYMENT_RUN_STATUSES, Tn as ChangePasswordInput, Tr as NotRestorable, Tt as CheckStatus, U as PreflightCheck, Ua as EntryAuthor, Ui as JobSummary, Un as PasswordResetRequestInput, Ur as Acknowledgement, Ut as MediaAssetStatus, V as HealthRule, Va as EditorManifest, Vi as JobQuery, Vn as NetworkAction, Vr as UnassignedEntry, Vt as MediaAssetPage, W as PreflightInput, Wa as EntryData, Wi as OpenPreviewInput, Wn as PermissionAction, Wr as ActiveDefinition, Wt as MediaFocalPoint, X as AltMissingResult, Xa as RevisionDetail, Xi as PreviewTokenCreated, Xn as RoleSummary, Xr as CreateLocaleInput, Xt as MediaVariantStatus, Y as PresencePerson, Ya as EntryStatus, Yi as PreviewToken, Yn as RolePermission, Yr as CreateDefinitionInput, Yt as MediaVariant, Z as AltProposal, Za as RevisionSummary, Zi as PublicationAction, Zn as SITE_ACTIONS, Zr as DefinitionCategory, Zt as MediaVisibility, _ as WebhookSignatureCheck, _a as CreateSiteInput, _i as UpdateLocaleInput, _n as AdminUser, _r as ChangeSetStatus, _t as SummarizeInput, a as AppAuthApi, aa as WebhookAttempt, ai as PlanImpact, an as AdminAppUser, ar as AddChangeSetEntryInput, at as CONTENT_OPS_RULES, b as SITE_QUERY_PARAMETER, ba as SiteAppRoles, bi as CreateDeploymentConnectionInput, bn as AuditActorType, br as CreateChangeSetInput, bt as ShapioApiError, c as AppOAuthProvider, ca as WebhookEventBody, ci as PlanStepImpact, cn as AppRolePermission, cr as ChangeSetActor, ct as ContentOpsRule, d as AppSession, da as FieldPrincipalUsage, di as SchemaChangeStatus, dn as BUILT_IN_APP_ROLE_KEYS, dr as ChangeSetItem, dt as ContentOpsStatus, ea as ScheduleStatus, ei as DefinitionPayload, en as ReplaceUploadInput, eo as RequestOptions, er as SetupStatusResponse, et as AssistIssue, f as AppUser, fa as FieldUsageQuery, fi as SchemaSettings, fn as CreateAppRoleInput, fr as ChangeSetItemStatus, ft as ContentOpsWritten, g as WEBHOOK_TOLERANCE_SECONDS, ga as UsageSelection, gi as UpdateDefinitionInput, gn as AdminSession, gr as ChangeSetSource, gt as SchemaDraftResult, h as WEBHOOK_TIMESTAMP_HEADER, ha as PrincipalUsageSummary, hi as SetDefaultLocaleResult, hn as AcceptInvitationInput, hr as ChangeSetSchemaItem, ht as SchemaDraftInput, i as APP_AUTH_PATHS, ia as Webhook, ii as Locale, in as APP_CONTENT_ACTIONS, ir as UpdateRoleInput, it as AssistUsage, j as CheckParams, ja as AdminEntryListItem, ji as DeploymentRunQuery, jn as EmailDelivery, jr as SNAPSHOT_SOURCES, jt as SnapshotChangeKind, k as SITE_HEADER, ka as DeliveryPagination, ki as DeploymentProvider, kn as CreatedApiToken, kr as ReviewIssue, kt as CurrentSnapshot, l as AppRegisterInput, la as WebhookEventType, li as PlanUpdateInput, ln as AppUserPage, lr as ChangeSetEntryItem, lt as ContentOpsRun, m as WEBHOOK_SIGNATURE_HEADER, ma as ModelFieldUsage, mi as SchemaSummaryItem, mn as UpdateAppUserInput, mr as ChangeSetReview, mt as RewriteInput, n as codeChallengeOf, na as UpdateDeploymentConnectionInput, ni as DefinitionScope, nn as UpdateMediaFolderInput, nr as UpdateAdminUserInput, nt as AssistStatus, o as AppChangePasswordInput, oa as WebhookDelivery, oi as PlanPreview, on as AppContentAction, or as CHANGE_SET_STATUSES, ot as ContentOpsInput, p as WEBHOOK_EVENT_HEADER, pa as FieldUsageResponse, pi as SchemaSummary, pn as UpdateAppRoleInput, pr as ChangeSetQuery, pt as LocaleMissingResult, q as PreflightRule, qa as EntryLocalesInput, qi as Page, qn as RoleCondition, qr as ChangeScopeInput, qt as MediaUsage, r as createPkcePair, ra as UpdateWebhookInput, ri as DeleteLocaleResult, rn as UploadGrant, rr as UpdateProfileInput, rt as AssistTextResult, s as AppLoginInput, sa as WebhookDeliveryStatus, si as PlanStep, sn as AppRole, sr as ChangeSet, st as ContentOpsResult, t as AppPkcePair, ta as ScheduledPublication, ti as DefinitionRevision, tn as UpdateMediaAssetInput, tr as SiteAction, tt as AssistProvider, u as AppRegisterResult, ua as WebhookWithSecret, ui as SchemaChangeJob, un as AppUserQuery, ur as ChangeSetError, ut as ContentOpsSkip, v as WebhookSignatureInput, va as SetSiteAppRolesInput, vi as UpdateSchemaSettingsInput, vn as AdminUserStatus, vr as ChangeSetSummary, vt as TranslateInput, w as ASSIST_PATHS, wa as DeliveryGetQuery, wi as DEPLOYMENT_PROVIDERS, wn as CONTENT_ACTIONS, wr as NOT_RESTORABLE_REASONS, wt as createClient, x as DELIVERY_PATH, xa as SiteRef, xi as CreatePreviewTokenInput, xn as AuditEvent, xr as FieldConsumer, xt as ShapioErrorBody, y as verifyWebhookSignature, ya as Site, yi as ConnectionTestResult, yn as ApiToken, yr as ChangeSetTimelineEvent, yt as TranslateResult, z as EntryPresence, za as ContentSort, zi as JOB_STATUSES, zn as MeResponse, zr as SnapshotQuery, zt as CreateUploadInput } from "./index-DJopnXJu.js";
2
+ export { ADMIN_PATHS, APP_AUTH_PATHS, APP_CONTENT_ACTIONS, ASSIST_PATHS, type AcceptInvitationInput, type Acknowledgement, type ActiveDefinition, type AddChangeSetEntryInput, type AdminApi, type AdminAppUser, type AdminEntry, type AdminEntryListItem, type AdminEntryPage, type AdminSession, type AdminUser, type AdminUserStatus, type AltMissingResult, type AltProposal, type AltTextInput, type AltTextResult, type ApiToken, type AppAuthApi, type AppChangePasswordInput, type AppContentAction, type AppLoginInput, type AppOAuthProvider, type AppPkcePair, type AppRegisterInput, type AppRegisterResult, type AppRole, type AppRolePermission, type AppSession, type AppUser, type AppUserPage, type AppUserQuery, type AssistIssue, type AssistProvider, type AssistStatus, type AssistTextResult, type AssistUsage, type AuditActorType, type AuditEvent, type AuditPage, type AuditQuery, BUILT_IN_APP_ROLE_KEYS, CHANGE_SET_STATUSES, CONTENT_ACTIONS, CONTENT_OPS_RULES, type ChangeOutcome, type ChangePasswordInput, type ChangePlan, type ChangeScopeInput, type ChangeScopeOutcome, type ChangeSet, type ChangeSetActor, type ChangeSetEntryItem, type ChangeSetError, type ChangeSetItem, type ChangeSetItemStatus, type ChangeSetQuery, type ChangeSetReview, type ChangeSetSchemaItem, type ChangeSetSource, type ChangeSetStatus, type ChangeSetSummary, type ChangeSetTimelineEvent, type CheckParams, type CheckSeverity, type CheckStatus, type ConnectionTestResult, type ContentAction, type ContentCount, type ContentCounts, type ContentFilter, type ContentFilterOperator, type ContentFilterValue, type ContentHealthFinding, type ContentHealthPage, type ContentHealthQuery, type ContentHealthSummary, type ContentIssue, type ContentListQuery, type ContentOpsInput, type ContentOpsResult, type ContentOpsRule, type ContentOpsRun, type ContentOpsSkip, type ContentOpsStatus, type ContentOpsWritten, type ContentPagination, type ContentSort, type CreateApiTokenInput, type CreateAppRoleInput, type CreateChangeSetInput, type CreateDefinitionInput, type CreateDeploymentConnectionInput, type CreateEntryInput, type CreateLocaleInput, type CreateMediaFolderInput, type CreatePreviewTokenInput, type CreateRoleInput, type CreateScheduleInput, type CreateSiteInput, type CreateUploadInput, type CreateWebhookInput, type CreatedApiToken, type CsrfResponse, type CurrentSnapshot, DELIVERY_PATH, DEPLOYMENT_PROVIDERS, DEPLOYMENT_RUN_STATUSES, DEPLOYMENT_TRIGGERS, type DefinitionCategory, type DefinitionDetail, type DefinitionListItem, type DefinitionPayload, type DefinitionRevision, type DefinitionScope, type DeleteLocaleResult, type DeliveryApi, type DeliveryGetQuery, type DeliveryItem, type DeliveryList, type DeliveryListQuery, type DeliveryMeta, type DeliveryPagination, type DeploymentConnection, type DeploymentConnectionCreated, type DeploymentProvider, type DeploymentRun, type DeploymentRunQuery, type DeploymentRunStatus, type DeploymentRunTrigger, type DeploymentSecretState, type DeploymentSecretsInput, type DeploymentSettings, type DeploymentTimelineEvent, type DeploymentTriggerPolicy, type EditorManifest, type EditorManifestItem, type EmailDelivery, type EntryAuthor, type EntryData, type EntryLocaleState, type EntryLocaleStatus, type EntryLocalesInput, type EntryPresence, type EntryReferrer, type EntryStatus, type FieldConsumer, type FieldConsumers, type FieldDiff, type FieldPrincipalUsage, type FieldUsageQuery, type FieldUsageResponse, GLOBAL_ACTIONS, type GlobalAction, HEALTH_RULES, type HealthResponse, type HealthRule, type InspectInvitationResponse, type Invitation, type InvitationLink, type InviteUserInput, JOB_STATUSES, type Job, type JobQuery, type JobStatus, type JobSummary, type Locale, type LocaleMissingResult, type LoginInput, type MeResponse, type MediaAsset, type MediaAssetPage, type MediaAssetQuery, type MediaAssetStatus, type MediaFocalPoint, type MediaFolder, type MediaStorageDriver, type MediaUsage, type MediaUsagePage, type MediaVariant, type MediaVariantStatus, type MediaVisibility, type ModelFieldUsage, type ModelPresence, type MoveMediaAssetsInput, type MoveMediaAssetsResult, NETWORK_ACTIONS, NOT_RESTORABLE_REASONS, type NetworkAction, type NotRestorable, type NotRestorableReason, type OpenPreviewInput, type OpenPreviewResult, PUBLICATION_ACTIONS, type Page, type PasswordResetConfirmInput, type PasswordResetRequestInput, type PermissionAction, type PlanImpact, type PlanPreview, type PlanStep, type PlanStepImpact, type PlanUpdateInput, type PreflightCheck, type PreflightInput, type PreflightLocale, type PreflightResponse, type PreflightRule, type PresenceHeartbeatInput, type PresencePerson, type PreviewTarget, type PreviewToken, type PreviewTokenCreated, type PrincipalUsageSummary, type PublicationAction, type PutSchemaDraftInput, type ReadyResponse, type ReplaceUploadInput, type RequestFn, type RequestOptions, type ReviewEntryItem, type ReviewIssue, type ReviewSchemaItem, type RevisionDetail, type RevisionSummary, type RewriteInput, type Role, type RoleAssignment, type RoleCondition, type RoleKind, type RolePermission, type RoleSummary, SCHEDULE_STATUSES, SITES_PATHS, SITE_ACTIONS, SITE_HEADER, SITE_QUERY_PARAMETER, SNAPSHOT_SOURCES, type ScheduleChangeSetInput, type ScheduleQuery, type ScheduleStatus, type ScheduledPublication, type SchemaApplyInput, type SchemaApplyResult, type SchemaChangeJob, type SchemaChangeStatus, type SchemaDraft, type SchemaDraftInput, type SchemaDraftResult, type SchemaExport, type SchemaOperation, type SchemaSettings, type SchemaSummary, type SchemaSummaryItem, type SchemaSyncResult, type SessionStarted, type SetDefaultLocaleResult, type SetSiteAppRolesInput, type SetupInput, type SetupStatusResponse, ShapioApiError, type ShapioClient, type ShapioClientOptions, type ShapioErrorBody, type ShipChangeSetInput, type ShipPhase, type Site, type SiteAction, type SiteAppRoles, type SiteRef, type SiteSummary, type Snapshot, type SnapshotChange, type SnapshotChangeKind, type SnapshotChangesPage, type SnapshotChangesQuery, type SnapshotPage, type SnapshotQuery, type SnapshotSource, type SummarizeInput, type TranslateInput, type TranslateResult, type UnassignedEntry, type UpdateAdminUserInput, type UpdateAppRoleInput, type UpdateAppUserInput, type UpdateChangeSetInput, type UpdateDefinitionInput, type UpdateDeploymentConnectionInput, type UpdateEntryInput, type UpdateLocaleInput, type UpdateMediaAssetInput, type UpdateMediaFolderInput, type UpdateProfileInput, type UpdateRoleInput, type UpdateSchemaSettingsInput, type UpdateSiteInput, type UpdateWebhookInput, type UploadGrant, type UsageSelection, type VersionResponse, WEBHOOK_EVENT_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, WEBHOOK_TOLERANCE_SECONDS, type Webhook, type WebhookAttempt, type WebhookDelivery, type WebhookDeliveryStatus, type WebhookEventBody, type WebhookEventType, type WebhookSignatureCheck, type WebhookSignatureInput, type WebhookWithSecret, buildUploadForm, codeChallengeOf, createClient, createPkcePair, resolveUploadUrl, toContentQueryString, verifyWebhookSignature };
package/dist/index.js CHANGED
@@ -328,7 +328,8 @@ const DEFINITION_PATHS = {
328
328
  const createDefinitionApi = (request, category) => {
329
329
  const base = DEFINITION_PATHS[category];
330
330
  return {
331
- list: async () => (await request(base)).items,
331
+ /** The site's view (shared definitions and its own); `{ scope: 'network' }` lists the shared ones. */
332
+ list: async (options = {}) => (await request(`${base}${toQueryString(options)}`)).items,
332
333
  get: (id) => request(withId(base, id)),
333
334
  /** Creates and activates a definition (`pending` when prerequisites must run first). */
334
335
  create: (body) => request(base, {
@@ -336,9 +337,17 @@ const createDefinitionApi = (request, category) => {
336
337
  body
337
338
  }),
338
339
  /** Plan preview of a create: classification and impact, nothing written. */
339
- planCreate: (definition) => request(`${base}/plan`, {
340
+ planCreate: (definition, scope) => request(`${base}/plan`, {
340
341
  method: "POST",
341
- body: { definition }
342
+ body: scope ? {
343
+ definition,
344
+ scope
345
+ } : { definition }
346
+ }),
347
+ /** Shares a definition with all sites, or keeps it on one (needs schema.create on every site). */
348
+ changeScope: (id, body) => request(`${withId(base, id)}/scope`, {
349
+ method: "PUT",
350
+ body
342
351
  }),
343
352
  /** Changes a definition; 409 SCHEMA_VERSION_CONFLICT when `expectedVersion` is stale. */
344
353
  update: (id, body) => request(withId(base, id), {
@@ -364,7 +373,7 @@ const createSchemaApi = (request) => ({
364
373
  summary: () => request(ADMIN_PATHS.schema),
365
374
  change: (changeId) => request(withId(ADMIN_PATHS.schemaChanges, changeId)),
366
375
  /** Every definition in the pull format, with the schema version they come from (`shapio schema pull`). */
367
- export: () => request(ADMIN_PATHS.schemaExport),
376
+ export: (options = {}) => request(`${ADMIN_PATHS.schemaExport}${toQueryString(options)}`),
368
377
  /** Applies definition files live through the change planner; refuses when the base moved (409). */
369
378
  apply: (body) => request(ADMIN_PATHS.schemaApply, {
370
379
  method: "POST",
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["entryPath"],"sources":["../src/admin/appUsers.ts","../src/admin/assist.ts","../src/admin/changeSets.ts","../src/admin/contentQuery.ts","../src/admin/content.ts","../src/admin/editing.ts","../src/admin/publishing.ts","../src/admin/schema.ts","../src/admin/sites.ts","../src/admin/usage.ts","../src/admin/types.ts","../src/admin/publishingTypes.ts","../src/admin/appUsersTypes.ts","../src/admin/changeSetTypes.ts","../src/admin/editingTypes.ts","../src/admin/assistTypes.ts","../src/admin/index.ts","../src/appAuth/index.ts","../src/delivery.ts","../src/snapshots.ts","../src/site.ts","../src/request.ts","../src/client.ts","../src/webhooks.ts","../src/appAuth/pkce.ts"],"sourcesContent":["import type { RequestFn } from '../request.js';\nimport type {\n AdminAppUser,\n AppRole,\n AppUserPage,\n AppUserQuery,\n CreateAppRoleInput,\n UpdateAppRoleInput,\n UpdateAppUserInput,\n} from './appUsersTypes.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport { toQueryString } from './query.js';\n\n/** App users (Users → App users) and app roles (Settings → Roles → App roles). */\nexport const createAppUsersApi = (request: RequestFn) => ({\n appUsers: {\n list: (query: AppUserQuery = {}) =>\n request<AppUserPage>(`${ADMIN_PATHS.appUsers}${toQueryString(query)}`),\n get: (id: string) => request<AdminAppUser>(withId(ADMIN_PATHS.appUsers, id)),\n /** Block/unblock and replace custom roles. Blocking takes effect on the user's next request. */\n update: (id: string, body: UpdateAppUserInput) =>\n request<AdminAppUser>(withId(ADMIN_PATHS.appUsers, id), { method: 'PATCH', body }),\n remove: (id: string) => request<void>(withId(ADMIN_PATHS.appUsers, id), { method: 'DELETE' }),\n /** 409 NOT_CONFIGURED without APP_AUTH_CONFIRM_EMAIL_URL; 409 ALREADY_CONFIRMED. */\n resendConfirmation: (id: string) =>\n request<void>(`${withId(ADMIN_PATHS.appUsers, id)}/resend-confirmation`, { method: 'POST' }),\n },\n appRoles: {\n list: () => request<AppRole[]>(ADMIN_PATHS.appRoles),\n get: (id: string) => request<AppRole>(withId(ADMIN_PATHS.appRoles, id)),\n create: (body: CreateAppRoleInput) => request<AppRole>(ADMIN_PATHS.appRoles, { method: 'POST', body }),\n /** 409 VERSION_CONFLICT when `expectedVersion` is stale. */\n update: (id: string, body: UpdateAppRoleInput) =>\n request<AppRole>(withId(ADMIN_PATHS.appRoles, id), { method: 'PATCH', body }),\n remove: (id: string) => request<void>(withId(ADMIN_PATHS.appRoles, id), { method: 'DELETE' }),\n },\n});\n","import type { RequestFn } from '../request.js';\nimport type {\n AltTextInput,\n AltTextResult,\n AssistStatus,\n AssistTextResult,\n ContentOpsInput,\n ContentOpsRun,\n RewriteInput,\n SchemaDraftInput,\n SchemaDraftResult,\n SummarizeInput,\n TranslateInput,\n TranslateResult,\n} from './assistTypes.js';\nimport { withId } from './paths.js';\n\nexport const ASSIST_PATHS = {\n status: '/api/admin/assist/status',\n altText: '/api/admin/assist/alt-text',\n summarize: '/api/admin/assist/summarize',\n translate: '/api/admin/assist/translate',\n rewrite: '/api/admin/assist/rewrite',\n schemaDraft: '/api/admin/assist/schema/draft',\n contentOpsPropose: '/api/admin/assist/content-ops/propose',\n contentOps: '/api/admin/assist/content-ops',\n} as const;\n\n/** Editor assists with the instance's own model provider (documentation/assist.md). */\nexport const createAssistApi = (request: RequestFn) => ({\n assist: {\n status: () => request<AssistStatus>(ASSIST_PATHS.status),\n altText: (body: AltTextInput) => request<AltTextResult>(ASSIST_PATHS.altText, { method: 'POST', body }),\n summarize: (body: SummarizeInput) =>\n request<AssistTextResult>(ASSIST_PATHS.summarize, { method: 'POST', body }),\n translate: (body: TranslateInput) =>\n request<TranslateResult>(ASSIST_PATHS.translate, { method: 'POST', body }),\n rewrite: (body: RewriteInput) =>\n request<AssistTextResult>(ASSIST_PATHS.rewrite, { method: 'POST', body }),\n schemaDraft: (body: SchemaDraftInput) =>\n request<SchemaDraftResult>(ASSIST_PATHS.schemaDraft, { method: 'POST', body }),\n /** Starts a background run (202); poll it with `contentOpsRun`. */\n proposeContentOps: (body: ContentOpsInput) =>\n request<{ runId: string }>(ASSIST_PATHS.contentOpsPropose, { method: 'POST', body }),\n contentOpsRun: (runId: string) => request<ContentOpsRun>(withId(ASSIST_PATHS.contentOps, runId)),\n },\n});\n","import type { RequestFn } from '../request.js';\nimport type {\n AddChangeSetEntryInput,\n ChangeSet,\n ChangeSetQuery,\n ChangeSetReview,\n ChangeSetSummary,\n ChangeSetTimelineEvent,\n CreateChangeSetInput,\n PutSchemaDraftInput,\n ScheduleChangeSetInput,\n SchemaDraft,\n ShipChangeSetInput,\n Snapshot,\n SnapshotPage,\n SnapshotQuery,\n UnassignedEntry,\n UpdateChangeSetInput,\n} from './changeSetTypes.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport type { Page } from './publishingTypes.js';\nimport { toQueryString } from './query.js';\n\nconst setPath = (id: string) => withId(ADMIN_PATHS.changeSets, id);\nconst draftPath = (id: string, definitionId: string) =>\n `${setPath(id)}/schema/${encodeURIComponent(definitionId)}`;\n\n/** Change sets (schema + content shipped as one snapshot) and the snapshot ledger. */\nexport const createChangeSetsApi = (request: RequestFn) => ({\n changeSets: {\n list: (query: ChangeSetQuery = {}) =>\n request<Page<ChangeSetSummary>>(`${ADMIN_PATHS.changeSets}${toQueryString(query)}`),\n get: (id: string) => request<ChangeSet>(setPath(id)),\n create: (body: CreateChangeSetInput) =>\n request<ChangeSet>(ADMIN_PATHS.changeSets, { method: 'POST', body }),\n update: (id: string, body: UpdateChangeSetInput) =>\n request<ChangeSet>(setPath(id), { method: 'PATCH', body }),\n /** Keeps the set as history (`discarded`) and deletes its schema drafts. */\n discard: (id: string) => request<ChangeSet>(`${setPath(id)}/discard`, { method: 'POST' }),\n addEntry: (id: string, body: AddChangeSetEntryInput) =>\n request<ChangeSet>(`${setPath(id)}/items`, { method: 'POST', body }),\n removeItem: (id: string, itemId: string) =>\n request<ChangeSet>(`${setPath(id)}/items/${encodeURIComponent(itemId)}`, { method: 'DELETE' }),\n getSchemaDraft: (id: string, definitionId: string) => request<SchemaDraft>(draftPath(id, definitionId)),\n putSchemaDraft: (id: string, definitionId: string, body: PutSchemaDraftInput) =>\n request<SchemaDraft>(draftPath(id, definitionId), { method: 'PUT', body }),\n removeSchemaDraft: (id: string, definitionId: string) =>\n request<ChangeSet>(draftPath(id, definitionId), { method: 'DELETE' }),\n review: (id: string) => request<ChangeSetReview>(`${setPath(id)}/review`),\n /**\n * Resolves with the set: `shipped` (or `failed`) when it shipped inline, `shipping` (HTTP 202) when\n * prerequisites run in the background. Poll `get` until it leaves `shipping`.\n */\n ship: (id: string, body: ShipChangeSetInput) =>\n request<ChangeSet>(`${setPath(id)}/ship`, { method: 'POST', body }),\n schedule: (id: string, body: ScheduleChangeSetInput) =>\n request<ChangeSet>(`${setPath(id)}/schedule`, { method: 'POST', body }),\n unschedule: (id: string) => request<ChangeSet>(`${setPath(id)}/unschedule`, { method: 'POST' }),\n timeline: async (id: string) =>\n (await request<{ items: ChangeSetTimelineEvent[] }>(`${setPath(id)}/timeline`)).items,\n unassigned: (query: { cursor?: string; limit?: number } = {}) =>\n request<Page<UnassignedEntry>>(`${ADMIN_PATHS.changeSets}/unassigned${toQueryString(query)}`),\n },\n snapshots: {\n list: (query: SnapshotQuery = {}) =>\n request<SnapshotPage>(`${ADMIN_PATHS.snapshots}${toQueryString(query)}`),\n get: (seq: number) => request<Snapshot>(`${ADMIN_PATHS.snapshots}/${seq}`),\n /** Creates an open restore change set (reviewable); nothing goes live until it ships. */\n restore: (seq: number) =>\n request<ChangeSet>(`${ADMIN_PATHS.snapshots}/${seq}/restore`, { method: 'POST' }),\n },\n});\n","import type { ContentFilter, ContentListQuery } from './contentTypes.js';\n\n/**\n * Serialises a content list query into the bracket querystring the content compiler parses\n * (`filters[title][$eq]=A&sort=title:asc&page=2`). Lists repeat the key (`filters[id][$in]=a&filters[id][$in]=b`).\n */\nconst appendFilter = (params: URLSearchParams, prefix: string, value: unknown) => {\n if (value === undefined || value === null) {\n return;\n }\n if (Array.isArray(value)) {\n value.forEach((item: unknown, index) => {\n if (typeof item === 'object' && item !== null) {\n appendFilter(params, `${prefix}[${index}]`, item);\n } else {\n params.append(prefix, String(item));\n }\n });\n return;\n }\n if (typeof value === 'object') {\n for (const [key, child] of Object.entries(value as ContentFilter)) {\n appendFilter(params, `${prefix}[${key}]`, child);\n }\n return;\n }\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n params.append(prefix, String(value));\n }\n};\n\nexport const toContentQueryString = (query: ContentListQuery = {}): string => {\n const params = new URLSearchParams();\n if (query.filters) {\n appendFilter(params, 'filters', query.filters);\n }\n for (const term of query.sort ?? []) {\n params.append('sort', `${term.field}:${term.direction}`);\n }\n if (query.page !== undefined) {\n params.set('page', String(query.page));\n }\n if (query.pageSize !== undefined) {\n params.set('pageSize', String(query.pageSize));\n }\n if (query.q) {\n params.set('q', query.q);\n }\n if (query.locale) {\n params.set('locale', query.locale);\n }\n for (const field of query.fields ?? []) {\n params.append('fields', field);\n }\n for (const path of query.populate ?? []) {\n params.append('populate', path);\n }\n if (query.status) {\n params.set('status', query.status);\n }\n if (query.author) {\n params.set('author', query.author);\n }\n const serialised = params.toString();\n return serialised ? `?${serialised}` : '';\n};\n","import type { RequestFn } from '../request.js';\nimport { toContentQueryString } from './contentQuery.js';\nimport type {\n AdminEntry,\n AdminEntryPage,\n ContentListQuery,\n CreateEntryInput,\n EditorManifest,\n EntryLocalesInput,\n RevisionDetail,\n RevisionSummary,\n UpdateEntryInput,\n} from './contentTypes.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport { toQueryString } from './query.js';\n\nconst modelPath = (modelKey: string) => withId(ADMIN_PATHS.content, modelKey);\nconst entryPath = (modelKey: string, id: string) => withId(modelPath(modelKey), id);\nconst revisionsPath = (modelKey: string, id: string) => `${entryPath(modelKey, id)}/revisions`;\n\n/**\n * Content of any model through the generic admin routes (`/api/admin/content/:modelKey`, where `modelKey`\n * is the model's singular API ID for collections too; only the delivery API uses the plural). Drafts are read\n * and written here; publishing is per locale. Writes carry the draft `version` the editor saw and fail with\n * 409 CONTENT_VERSION_CONFLICT (or SCHEMA_CHANGED) when it moved.\n */\nexport const createContentApi = (request: RequestFn) => ({\n content: {\n list: (modelKey: string, query: ContentListQuery = {}) =>\n request<AdminEntryPage>(`${modelPath(modelKey)}${toContentQueryString(query)}`),\n get: (modelKey: string, id: string, { locale }: { locale?: string } = {}) =>\n request<AdminEntry>(`${entryPath(modelKey, id)}${toQueryString({ locale })}`),\n /** Fully validated (`required` included); 422 CONTENT_INVALID with `details.issues`. */\n create: (modelKey: string, body: CreateEntryInput) =>\n request<AdminEntry>(modelPath(modelKey), { method: 'POST', body }),\n /** Saves a patch of one locale's draft; `autosave` skips `required` and creates no revision. */\n update: (modelKey: string, id: string, body: UpdateEntryInput) =>\n request<AdminEntry>(entryPath(modelKey, id), { method: 'PUT', body }),\n /** 409 ENTRY_REFERENCED with `details.referrers` while other entries point at it. */\n remove: (modelKey: string, id: string) => request<void>(entryPath(modelKey, id), { method: 'DELETE' }),\n duplicate: (modelKey: string, id: string) =>\n request<AdminEntry>(`${entryPath(modelKey, id)}/duplicate`, { method: 'POST' }),\n publish: (modelKey: string, id: string, body: EntryLocalesInput = {}) =>\n request<AdminEntry>(`${entryPath(modelKey, id)}/publish`, { method: 'POST', body }),\n unpublish: (modelKey: string, id: string, body: EntryLocalesInput = {}) =>\n request<AdminEntry>(`${entryPath(modelKey, id)}/unpublish`, { method: 'POST', body }),\n revisions: async (modelKey: string, id: string, { locale }: { locale?: string } = {}) =>\n (\n await request<{ items: RevisionSummary[] }>(\n `${revisionsPath(modelKey, id)}${toQueryString({ locale })}`,\n )\n ).items,\n revision: (modelKey: string, id: string, revisionId: string) =>\n request<RevisionDetail>(withId(revisionsPath(modelKey, id), revisionId)),\n /** Brings an older revision back as the new draft of its locale (a new revision). */\n restore: (modelKey: string, id: string, revisionId: string, expectedVersion: number) =>\n request<AdminEntry>(`${withId(revisionsPath(modelKey, id), revisionId)}/restore`, {\n method: 'POST',\n body: { expectedVersion },\n }),\n },\n extensions: {\n /** Custom field editors the project installed (`shapio.config` + `extensions/editors/*.js`). */\n editors: () => request<EditorManifest>(ADMIN_PATHS.editorManifest),\n },\n});\n","import type { RequestFn } from '../request.js';\nimport type {\n ContentCounts,\n ContentHealthPage,\n ContentHealthQuery,\n ContentHealthSummary,\n EntryPresence,\n ModelPresence,\n PresenceHeartbeatInput,\n PreflightInput,\n PreflightResponse,\n} from './editingTypes.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport { toQueryString } from './query.js';\n\nconst entryPath = (base: string, modelKey: string, id: string) => withId(withId(base, modelKey), id);\n\n/** The entry document's endpoints: pre-flight, content health (the Inbox), presence and counts. */\nexport const createEditingApi = (request: RequestFn) => ({\n preflight: {\n /** What publishing these locales would run into, without publishing (no hooks, no locks). */\n run: (modelKey: string, id: string, body: PreflightInput = {}) =>\n request<PreflightResponse>(`${entryPath(ADMIN_PATHS.content, modelKey, id)}/preflight`, {\n method: 'POST',\n body,\n }),\n },\n contentHealth: {\n list: (query: ContentHealthQuery = {}) =>\n request<ContentHealthPage>(`${ADMIN_PATHS.contentHealth}${toQueryString(query)}`),\n summary: () => request<ContentHealthSummary>(`${ADMIN_PATHS.contentHealth}/summary`),\n },\n presence: {\n /** Heartbeat (every 15s while the document is visible); returns who else has the entry open. */\n heartbeat: (modelKey: string, id: string, body: PresenceHeartbeatInput) =>\n request<EntryPresence>(entryPath(ADMIN_PATHS.presence, modelKey, id), { method: 'PUT', body }),\n entry: (modelKey: string, id: string) =>\n request<EntryPresence>(entryPath(ADMIN_PATHS.presence, modelKey, id)),\n /** Everyone editing an entry of the model (list rows). */\n model: (modelKey: string) => request<ModelPresence>(withId(ADMIN_PATHS.presence, modelKey)),\n leave: (modelKey: string, id: string, tabId: string) =>\n request<void>(`${entryPath(ADMIN_PATHS.presence, modelKey, id)}${toQueryString({ tabId })}`, {\n method: 'DELETE',\n }),\n },\n contentCounts: {\n list: () => request<ContentCounts>(ADMIN_PATHS.contentCounts),\n },\n});\n","import type { RequestFn } from '../request.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport type {\n ConnectionTestResult,\n CreateDeploymentConnectionInput,\n CreatePreviewTokenInput,\n CreateScheduleInput,\n CreateWebhookInput,\n DeploymentConnection,\n DeploymentConnectionCreated,\n DeploymentRun,\n DeploymentRunQuery,\n Job,\n JobQuery,\n JobSummary,\n OpenPreviewInput,\n OpenPreviewResult,\n PreviewTarget,\n Page,\n PreviewToken,\n PreviewTokenCreated,\n ScheduledPublication,\n ScheduleQuery,\n UpdateDeploymentConnectionInput,\n UpdateWebhookInput,\n Webhook,\n WebhookDelivery,\n WebhookEventType,\n WebhookWithSecret,\n} from './publishingTypes.js';\nimport { toQueryString } from './query.js';\n\n/** Jobs, scheduled publications, webhooks, deployment connections and runs, preview (package H). */\nexport const createPublishingApi = (request: RequestFn) => ({\n jobs: {\n list: (query: JobQuery = {}) => request<Page<Job>>(`${ADMIN_PATHS.jobs}${toQueryString(query)}`),\n summary: () => request<JobSummary>(`${ADMIN_PATHS.jobs}/summary`),\n get: (id: string) => request<Job>(withId(ADMIN_PATHS.jobs, id)),\n /** Dead jobs only: runs again from attempt 1. 409 JOB_NOT_RETRYABLE otherwise. */\n retry: (id: string) => request<Job>(`${withId(ADMIN_PATHS.jobs, id)}/retry`, { method: 'POST' }),\n },\n schedules: {\n list: (query: ScheduleQuery = {}) =>\n request<Page<ScheduledPublication>>(`${ADMIN_PATHS.schedules}${toQueryString(query)}`),\n create: (body: CreateScheduleInput) =>\n request<ScheduledPublication>(ADMIN_PATHS.schedules, { method: 'POST', body }),\n cancel: (id: string) => request<void>(withId(ADMIN_PATHS.schedules, id), { method: 'DELETE' }),\n },\n webhooks: {\n list: () => request<Webhook[]>(ADMIN_PATHS.webhooks),\n events: async () =>\n (await request<{ items: WebhookEventType[] }>(`${ADMIN_PATHS.webhooks}/events`)).items,\n get: (id: string) => request<Webhook>(withId(ADMIN_PATHS.webhooks, id)),\n create: (body: CreateWebhookInput) =>\n request<WebhookWithSecret>(ADMIN_PATHS.webhooks, { method: 'POST', body }),\n update: (id: string, body: UpdateWebhookInput) =>\n request<Webhook>(withId(ADMIN_PATHS.webhooks, id), { method: 'PATCH', body }),\n remove: (id: string) => request<void>(withId(ADMIN_PATHS.webhooks, id), { method: 'DELETE' }),\n rotateSecret: (id: string) =>\n request<WebhookWithSecret>(`${withId(ADMIN_PATHS.webhooks, id)}/rotate-secret`, { method: 'POST' }),\n /** Queues a `webhook.test` delivery; poll the delivery log for its outcome. */\n test: (id: string) =>\n request<WebhookDelivery>(`${withId(ADMIN_PATHS.webhooks, id)}/test`, { method: 'POST' }),\n deliveries: (id: string, query: { cursor?: string; limit?: number } = {}) =>\n request<Page<WebhookDelivery>>(`${withId(ADMIN_PATHS.webhooks, id)}/deliveries${toQueryString(query)}`),\n /** Sends the same payload again as a new delivery. */\n redeliver: (id: string, deliveryId: string) =>\n request<WebhookDelivery>(\n `${withId(ADMIN_PATHS.webhooks, id)}/deliveries/${encodeURIComponent(deliveryId)}/redeliver`,\n { method: 'POST' },\n ),\n },\n deployments: {\n connections: {\n list: () => request<DeploymentConnection[]>(ADMIN_PATHS.deploymentConnections),\n get: (id: string) => request<DeploymentConnection>(withId(ADMIN_PATHS.deploymentConnections, id)),\n create: (body: CreateDeploymentConnectionInput) =>\n request<DeploymentConnectionCreated>(ADMIN_PATHS.deploymentConnections, { method: 'POST', body }),\n update: (id: string, body: UpdateDeploymentConnectionInput) =>\n request<DeploymentConnection>(withId(ADMIN_PATHS.deploymentConnections, id), {\n method: 'PATCH',\n body,\n }),\n remove: (id: string) =>\n request<void>(withId(ADMIN_PATHS.deploymentConnections, id), { method: 'DELETE' }),\n test: (id: string) =>\n request<ConnectionTestResult>(`${withId(ADMIN_PATHS.deploymentConnections, id)}/test`, {\n method: 'POST',\n }),\n /** A manual run at the current publication snapshot. */\n trigger: (id: string) =>\n request<DeploymentRun>(`${withId(ADMIN_PATHS.deploymentConnections, id)}/runs`, { method: 'POST' }),\n },\n runs: {\n list: (query: DeploymentRunQuery = {}) =>\n request<Page<DeploymentRun>>(`${ADMIN_PATHS.deploymentRuns}${toQueryString(query)}`),\n get: (id: string) => request<DeploymentRun>(withId(ADMIN_PATHS.deploymentRuns, id)),\n /** A new run (linked by `retryOf`) at the current snapshot. */\n retry: (id: string) =>\n request<DeploymentRun>(`${withId(ADMIN_PATHS.deploymentRuns, id)}/retry`, { method: 'POST' }),\n },\n },\n preview: {\n tokens: {\n list: (query: { entryId?: string } = {}) =>\n request<PreviewToken[]>(`${ADMIN_PATHS.previewTokens}${toQueryString(query)}`),\n create: (body: CreatePreviewTokenInput) =>\n request<PreviewTokenCreated>(ADMIN_PATHS.previewTokens, { method: 'POST', body }),\n revoke: (id: string) => request<void>(withId(ADMIN_PATHS.previewTokens, id), { method: 'DELETE' }),\n },\n /** The site's connections with a preview URL (the entry form's Preview pane). */\n targets: () => request<PreviewTarget[]>(`${ADMIN_PATHS.preview}/targets`),\n /** The entry form's Preview action: a short-lived entry token and the rendered preview URL. */\n open: (body: OpenPreviewInput) =>\n request<OpenPreviewResult>(`${ADMIN_PATHS.preview}/open`, { method: 'POST', body }),\n },\n});\n","import type { RequestFn } from '../request.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport { toQueryString } from './query.js';\nimport type { SchemaApplyInput, SchemaApplyResult, SchemaExport } from './schemaSyncTypes.js';\nimport type {\n ChangeOutcome,\n CreateDefinitionInput,\n CreateLocaleInput,\n DefinitionCategory,\n DefinitionPayload,\n DefinitionDetail,\n DefinitionListItem,\n DefinitionRevision,\n DeleteLocaleResult,\n Locale,\n PlanPreview,\n PlanUpdateInput,\n SchemaChangeJob,\n SchemaSettings,\n SchemaSummary,\n SetDefaultLocaleResult,\n UpdateDefinitionInput,\n UpdateLocaleInput,\n UpdateSchemaSettingsInput,\n} from './schemaTypes.js';\n\nconst DEFINITION_PATHS = {\n model: ADMIN_PATHS.models,\n component: ADMIN_PATHS.components,\n} as const satisfies Record<DefinitionCategory, string>;\n\n/** Models (collections and singletons) and components share one set of endpoints under their own base. */\nexport const createDefinitionApi = (request: RequestFn, category: DefinitionCategory) => {\n const base = DEFINITION_PATHS[category];\n return {\n list: async () => (await request<{ items: DefinitionListItem[] }>(base)).items,\n get: (id: string) => request<DefinitionDetail>(withId(base, id)),\n /** Creates and activates a definition (`pending` when prerequisites must run first). */\n create: (body: CreateDefinitionInput) => request<ChangeOutcome>(base, { method: 'POST', body }),\n /** Plan preview of a create: classification and impact, nothing written. */\n planCreate: (definition: DefinitionPayload) =>\n request<PlanPreview>(`${base}/plan`, { method: 'POST', body: { definition } }),\n /** Changes a definition; 409 SCHEMA_VERSION_CONFLICT when `expectedVersion` is stale. */\n update: (id: string, body: UpdateDefinitionInput) =>\n request<ChangeOutcome>(withId(base, id), { method: 'PUT', body }),\n planUpdate: (id: string, body: PlanUpdateInput) =>\n request<PlanPreview>(`${withId(base, id)}/plan`, { method: 'POST', body }),\n /** Soft delete: entries are kept and reappear if the definition is applied again. */\n remove: (id: string, expectedVersion: number) =>\n request<ChangeOutcome>(`${withId(base, id)}${toQueryString({ expectedVersion })}`, {\n method: 'DELETE',\n }),\n revisions: async (id: string) =>\n (await request<{ items: DefinitionRevision[] }>(`${withId(base, id)}/revisions`)).items,\n changes: async (id: string) =>\n (await request<{ items: SchemaChangeJob[] }>(`${withId(base, id)}/changes`)).items,\n };\n};\n\n/** Schema-wide endpoints: the version summary, planned-change status, the read-only lock, locales. */\nexport const createSchemaApi = (request: RequestFn) => ({\n models: createDefinitionApi(request, 'model'),\n components: createDefinitionApi(request, 'component'),\n schema: {\n /** The global schema version and every visible definition's version (cheap; poll it for changes). */\n summary: () => request<SchemaSummary>(ADMIN_PATHS.schema),\n change: (changeId: string) => request<SchemaChangeJob>(withId(ADMIN_PATHS.schemaChanges, changeId)),\n /** Every definition in the pull format, with the schema version they come from (`shapio schema pull`). */\n export: () => request<SchemaExport>(ADMIN_PATHS.schemaExport),\n /** Applies definition files live through the change planner; refuses when the base moved (409). */\n apply: (body: SchemaApplyInput) =>\n request<SchemaApplyResult>(ADMIN_PATHS.schemaApply, { method: 'POST', body }),\n settings: () => request<SchemaSettings>(ADMIN_PATHS.schemaSettings),\n updateSettings: (body: UpdateSchemaSettingsInput) =>\n request<SchemaSettings>(ADMIN_PATHS.schemaSettings, { method: 'PUT', body }),\n },\n locales: {\n list: async () => (await request<{ items: Locale[] }>(ADMIN_PATHS.locales)).items,\n create: (body: CreateLocaleInput) => request<Locale>(ADMIN_PATHS.locales, { method: 'POST', body }),\n update: (code: string, body: UpdateLocaleInput) =>\n request<Locale>(withId(ADMIN_PATHS.locales, code), { method: 'PUT', body }),\n /** A contract change: without `acknowledgeBreaking` the server answers 409 SCHEMA_CHANGE_NOT_ACKNOWLEDGED. */\n setDefault: (code: string, acknowledgeBreaking: boolean) =>\n request<SetDefaultLocaleResult>(`${withId(ADMIN_PATHS.locales, code)}/default`, {\n method: 'POST',\n body: { acknowledgeBreaking },\n }),\n /**\n * Deletes a locale and purges its content. When content exists and `acknowledgeDestructive` is false,\n * the server answers 409 SCHEMA_CHANGE_NOT_ACKNOWLEDGED with `details.plan.impact.affectedHeads`.\n */\n remove: (code: string, acknowledgeDestructive: boolean) =>\n request<DeleteLocaleResult>(\n `${withId(ADMIN_PATHS.locales, code)}${toQueryString({ acknowledgeDestructive: acknowledgeDestructive || undefined })}`,\n { method: 'DELETE' },\n ),\n },\n});\n","import type { RequestFn } from '../request.js';\nimport type {\n CreateSiteInput,\n SetSiteAppRolesInput,\n Site,\n SiteAppRoles,\n UpdateSiteInput,\n} from './sitesTypes.js';\n\nexport const SITES_PATHS = { sites: '/api/admin/sites' } as const;\n\n/** The admin API header that names the site a site-scoped request is about (default: the primary site). */\nexport const SITE_HEADER = 'shapio-site';\n\nconst sitePath = (id: string) => `${SITES_PATHS.sites}/${encodeURIComponent(id)}`;\n\n/** Sites (network routes): listing shows the sites the caller holds a role on; changes need `sites.manage`. */\nexport const createSitesApi = (request: RequestFn) => ({\n sites: {\n list: () => request<Site[]>(SITES_PATHS.sites),\n get: (id: string) => request<Site>(sitePath(id)),\n create: (body: CreateSiteInput) => request<Site>(SITES_PATHS.sites, { method: 'POST', body }),\n update: (id: string, body: UpdateSiteInput) => request<Site>(sitePath(id), { method: 'PATCH', body }),\n /** Only an empty site (409 `SITE_NOT_EMPTY`); never the primary site (409 `SITE_IS_PRIMARY`). */\n remove: (id: string) => request<void>(sitePath(id), { method: 'DELETE' }),\n /** The app roles bound to the site's anonymous callers (`public`) and signed-in app users (`authenticated`). */\n appRoles: {\n get: (id: string) => request<SiteAppRoles>(`${sitePath(id)}/app-roles`),\n /** Replaces both bindings (`roles.manage`). */\n set: (id: string, body: SetSiteAppRolesInput) =>\n request<SiteAppRoles>(`${sitePath(id)}/app-roles`, { method: 'PUT', body }),\n },\n },\n});\n","import type { RequestFn } from '../request.js';\nimport { toQueryString } from './query.js';\nimport type { FieldUsageQuery, FieldUsageResponse } from './usageTypes.js';\n\nexport const USAGE_PATHS = { fields: '/api/admin/usage/fields' } as const;\n\n/** Who reads which fields (needs `tokens.manage`). */\nexport const createUsageApi = (request: RequestFn) => ({\n usage: {\n fields: (query: FieldUsageQuery) =>\n request<FieldUsageResponse>(`${USAGE_PATHS.fields}${toQueryString(query)}`),\n },\n});\n","import type { SiteSummary } from './sitesTypes.js';\n/**\n * Admin identity API shapes (package B, build plan §4.B), mirroring the TypeBox route schemas in\n * apps/api/src/routes/admin/** and routes/schemas/adminIdentity.ts. JSON is camelCase; timestamps are ISO-8601.\n */\n\nexport type AdminUserStatus = 'active' | 'disabled';\n\n/** A role held on one site, or on every site (`siteId` null). */\nexport type RoleAssignment = { roleId: string; siteId: string | null };\n\nexport type AdminUser = {\n id: string;\n email: string;\n name: string;\n status: AdminUserStatus;\n /** Where each role applies. */\n assignments: RoleAssignment[];\n /** Deprecated: the distinct roles of `assignments`, on any site. */\n roleIds: string[];\n lastLoginAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport const CONTENT_ACTIONS = ['read', 'create', 'update', 'delete', 'publish', 'schemaManage'] as const;\nexport type ContentAction = (typeof CONTENT_ACTIONS)[number];\n\n/**\n * Network actions: about the whole instance. Only roles assigned on every site grant them, so a role held\n * on one site never reaches the network.\n */\nexport const NETWORK_ACTIONS = [\n 'schema.create',\n 'users.manage',\n 'roles.manage',\n 'audit.read',\n 'sites.manage',\n] as const;\nexport type NetworkAction = (typeof NETWORK_ACTIONS)[number];\n\n/** Site actions: about one site's library, tokens and publishing. */\nexport const SITE_ACTIONS = [\n 'tokens.manage',\n 'media.read',\n 'media.write',\n 'media.manage',\n 'publishing.manage',\n 'webhooks.manage',\n 'deployments.manage',\n 'deployments.trigger',\n 'changes.manage',\n 'changes.ship',\n] as const;\nexport type SiteAction = (typeof SITE_ACTIONS)[number];\n\n/** Actions not scoped to a model: network actions and site actions. */\nexport const GLOBAL_ACTIONS = [\n 'schema.create',\n 'users.manage',\n 'roles.manage',\n 'tokens.manage',\n 'audit.read',\n 'sites.manage',\n 'media.read',\n 'media.write',\n 'media.manage',\n 'publishing.manage',\n 'webhooks.manage',\n 'deployments.manage',\n 'deployments.trigger',\n 'changes.manage',\n 'changes.ship',\n] as const;\nexport type GlobalAction = (typeof GLOBAL_ACTIONS)[number];\n\nexport type PermissionAction = ContentAction | GlobalAction;\n\nexport type RoleSummary = { id: string; key: string; name: string };\n\n/** Returned whenever a session starts (setup, login, accepting an invitation). */\nexport type SessionStarted = { user: AdminUser; csrfToken: string };\n\nexport type MeResponse = {\n user: AdminUser;\n roles: RoleSummary[];\n /** The site this response is about: the request's `Shapio-Site`, else the primary site. */\n site: SiteSummary;\n /** Every site this admin holds a role on (all of them for a role assigned on every site). */\n sites: SiteSummary[];\n /** Network actions (roles assigned on every site only). */\n networkPermissions: NetworkAction[];\n /** Site actions on the request's site. */\n sitePermissions: SiteAction[];\n /** `networkPermissions` and `sitePermissions` together. */\n globalPermissions: GlobalAction[];\n /** Content actions per model ID on the request's site (models without any action are left out). */\n modelPermissions: Record<string, ContentAction[]>;\n /** How the server sends email: `console` writes it to the server log (no real delivery is set up). */\n emailDelivery: EmailDelivery;\n csrfToken: string;\n};\n\nexport type EmailDelivery = 'console' | 'smtp';\n\nexport type SetupStatusResponse = {\n /** No admin exists yet. */\n required: boolean;\n /** SETUP_REQUIRE_TOKEN is set: setup also needs the one-time token from the server log. */\n requiresToken: boolean;\n};\n\n/** `token` is needed only when the server requires it (`requiresToken`); otherwise it is ignored. */\nexport type SetupInput = { token?: string; email: string; name: string; password: string };\n\nexport type LoginInput = { email: string; password: string };\n\nexport type CsrfResponse = { csrfToken: string };\n\nexport type UpdateProfileInput = { name: string };\n\nexport type ChangePasswordInput = { currentPassword: string; newPassword: string };\n\nexport type PasswordResetRequestInput = { email: string };\n\nexport type PasswordResetConfirmInput = { token: string; password: string };\n\nexport type AcceptInvitationInput = { token: string; name: string; password: string };\n\nexport type InspectInvitationResponse = { email: string; expiresAt: string };\n\nexport type AdminSession = {\n id: string;\n current: boolean;\n ip: string | null;\n userAgent: string | null;\n createdAt: string;\n lastSeenAt: string;\n expiresAt: string;\n};\n\nexport type Invitation = {\n id: string;\n email: string;\n /** The role assignments the invitee gets on accepting. */\n assignments: RoleAssignment[];\n /** Deprecated: the distinct roles of `assignments`. */\n roleIds: string[];\n invitedBy: string | null;\n expiresAt: string;\n createdAt: string;\n};\n\n/** A fresh accept link, shown once; issuing it makes earlier links (emailed or copied) stop working. */\nexport type InvitationLink = { acceptUrl: string; expiresAt: string };\n\n/**\n * Either `assignments` or (deprecated) `roleIds`, meaning those roles on every site; never both. Updating\n * either replaces every assignment.\n */\ntype AssignmentsInput =\n { assignments: RoleAssignment[]; roleIds?: never } | { roleIds: string[]; assignments?: never };\n\nexport type InviteUserInput = { email: string } & AssignmentsInput;\n\nexport type UpdateAdminUserInput = { name?: string; status?: AdminUserStatus } & (\n AssignmentsInput | { assignments?: never; roleIds?: never }\n);\n\nexport type RoleKind = 'admin' | 'delivery';\n\nexport type RoleCondition = 'ownedByPrincipal';\n\nexport type RolePermission = {\n action: PermissionAction;\n /** `null` grants the action on every model (and is required for global actions). */\n modelId: string | null;\n condition: RoleCondition | null;\n /** `null` = every field; otherwise only these stable field IDs. */\n fieldIds: string[] | null;\n};\n\nexport type Role = {\n id: string;\n key: string;\n name: string;\n description: string;\n kind: RoleKind;\n isSystem: boolean;\n /** Optimistic-concurrency version: send it back as `expectedVersion` on update. */\n version: number;\n permissions: RolePermission[];\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CreateRoleInput = {\n key: string;\n name: string;\n description?: string;\n kind?: RoleKind;\n permissions: RolePermission[];\n};\n\nexport type UpdateRoleInput = {\n expectedVersion: number;\n name?: string;\n description?: string;\n permissions?: RolePermission[];\n};\n\nexport type ApiToken = {\n id: string;\n name: string;\n /** First characters of the token (`shp_` + 6), for telling tokens apart. */\n tokenPrefix: string;\n roleId: string;\n scope: RoleKind;\n /** The token's site; null for a network admin token (its role applies on every site). */\n siteId: string | null;\n createdBy: string | null;\n expiresAt: string | null;\n lastUsedAt: string | null;\n revokedAt: string | null;\n createdAt: string;\n};\n\nexport type CreateApiTokenInput = {\n name: string;\n roleId: string;\n expiresAt?: string | null;\n /**\n * A network admin token (every site and network actions; needs `users.manage`). Omitted: a network token\n * when the creator may create one, else a token of the request's site. Delivery tokens are always per site.\n */\n network?: boolean;\n};\n\n/** `token` is the plain secret, returned once at creation and never again. */\nexport type CreatedApiToken = { token: string; apiToken: ApiToken };\n\nexport type AuditActorType = 'admin' | 'app_user' | 'token' | 'anonymous' | 'system';\n\nexport type AuditEvent = {\n id: string;\n occurredAt: string;\n actorType: AuditActorType;\n actorId: string | null;\n /** The acting admin's (or app user's) display name, when the actor is a known account. */\n actorName: string | null;\n actorEmail: string | null;\n action: string;\n targetType: string | null;\n targetId: string | null;\n outcome: 'success' | 'failure';\n requestId: string | null;\n ip: string | null;\n metadata: unknown;\n};\n\n/** Newest first, cursor-paginated. */\nexport type AuditQuery = {\n cursor?: string;\n limit?: number;\n actorType?: AuditActorType;\n actorId?: string;\n action?: string;\n actionPrefix?: string;\n targetType?: string;\n targetId?: string;\n outcome?: 'success' | 'failure';\n from?: string;\n to?: string;\n};\n\nexport type AuditPage = { items: AuditEvent[]; nextCursor: string | null };\n","/**\n * Publishing types (package H, `apps/api/src/routes/admin/{jobs,publishing,webhooks,deployments,preview}`).\n * Dates are ISO-8601 strings.\n */\nimport type { SiteRef } from './sitesTypes.js';\n\nexport type Page<T> = { items: T[]; nextCursor: string | null };\n\n// Jobs ---------------------------------------------------------------------------------------------\n\nexport const JOB_STATUSES = ['pending', 'running', 'succeeded', 'dead'] as const;\nexport type JobStatus = (typeof JOB_STATUSES)[number];\n\nexport type Job = {\n id: string;\n type: string;\n status: JobStatus;\n attempts: number;\n maxAttempts: number;\n /** When it runs next (pending) or ran last. */\n runAt: string;\n idempotencyKey: string | null;\n lockedBy: string | null;\n lockedUntil: string | null;\n /** Payload and result with secret-looking values replaced by `[redacted]`. */\n payload: unknown;\n result: unknown;\n /** Progress a long job saved (e.g. an import's phase and counts); null when it saved none. */\n progress: unknown;\n lastError: string | null;\n createdAt: string;\n updatedAt: string;\n finishedAt: string | null;\n};\n\nexport type JobQuery = { status?: JobStatus; type?: string; cursor?: string; limit?: number };\n\nexport type JobSummary = { counts: Record<JobStatus, number>; types: string[] };\n\n// Scheduled publications ---------------------------------------------------------------------------\n\nexport const PUBLICATION_ACTIONS = ['publish', 'unpublish'] as const;\nexport type PublicationAction = (typeof PUBLICATION_ACTIONS)[number];\n\nexport const SCHEDULE_STATUSES = ['scheduled', 'done', 'failed', 'cancelled'] as const;\nexport type ScheduleStatus = (typeof SCHEDULE_STATUSES)[number];\n\nexport type ScheduledPublication = {\n id: string;\n entryId: string;\n modelId: string;\n /** Null when the model no longer exists. */\n modelKey: string | null;\n locale: string;\n action: PublicationAction;\n runAt: string;\n status: ScheduleStatus;\n error: string | null;\n /** Publication sequence the change was published at (once done). */\n snapshot: number | null;\n createdBy: string | null;\n createdAt: string;\n executedAt: string | null;\n};\n\nexport type ScheduleQuery = { status?: ScheduleStatus; entryId?: string; cursor?: string; limit?: number };\n\nexport type CreateScheduleInput = {\n modelKey: string;\n entryId: string;\n /** Omit for non-localized models (and for the default locale). */\n locale?: string;\n action: PublicationAction;\n runAt: string;\n};\n\n// Webhooks -----------------------------------------------------------------------------------------\n\nexport type WebhookEventType = { type: string; group: string };\n\nexport type WebhookDeliveryStatus = 'pending' | 'retrying' | 'succeeded' | 'dead';\n\nexport type Webhook = {\n id: string;\n name: string;\n url: string;\n /** Event types or `group.*` patterns. */\n events: string[];\n enabled: boolean;\n allowPrivateNetwork: boolean;\n maxAttempts: number;\n /** The site whose events it receives; null for a network-wide webhook (every site's events). */\n site: SiteRef | null;\n lastDelivery: { status: WebhookDeliveryStatus; at: string } | null;\n createdBy: string | null;\n createdAt: string;\n updatedAt: string;\n version: number;\n};\n\nexport type CreateWebhookInput = {\n name: string;\n url: string;\n events: string[];\n enabled?: boolean;\n allowPrivateNetwork?: boolean;\n maxAttempts?: number;\n /** A network-wide webhook (every site's events); otherwise it belongs to the request's site. */\n network?: boolean;\n};\n\n/** A webhook's site is fixed once created. */\nexport type UpdateWebhookInput = Partial<Omit<CreateWebhookInput, 'network'>> & { expectedVersion: number };\n\n/** The JSON body every webhook delivery sends (signed; verify it with `verifyWebhookSignature`). */\nexport type WebhookEventBody = {\n id: string;\n type: string;\n createdAt: string;\n /** The site the event is about; null for events about no site (network-wide). */\n site: SiteRef | null;\n data: unknown;\n};\n\n/** `secret` is shown once: on creation and after rotation. */\nexport type WebhookWithSecret = { webhook: Webhook; secret: string };\n\nexport type WebhookAttempt = {\n attempt: number;\n at: string;\n durationMs: number;\n request: { method: string; url: string; headers: Record<string, string> };\n /** Null when no response arrived (refused, timeout, blocked by the network policy). */\n response: { status: number; headers: Record<string, string>; body: string; truncated: boolean } | null;\n error: string | null;\n};\n\nexport type WebhookDelivery = {\n id: string;\n webhookId: string;\n eventId: string | null;\n eventType: string;\n isTest: boolean;\n status: WebhookDeliveryStatus;\n attempts: number;\n lastResponseStatus: number | null;\n lastError: string | null;\n payload: unknown;\n attemptLog: WebhookAttempt[];\n createdAt: string;\n updatedAt: string;\n deliveredAt: string | null;\n};\n\n// Deployments --------------------------------------------------------------------------------------\n\nexport const DEPLOYMENT_PROVIDERS = [\n 'generic_webhook',\n 'cloudflare_pages',\n 'vercel',\n 'netlify',\n 'github',\n] as const;\nexport type DeploymentProvider = (typeof DEPLOYMENT_PROVIDERS)[number];\n\nexport const DEPLOYMENT_TRIGGERS = ['publish', 'change_set', 'schema', 'manual'] as const;\nexport type DeploymentTriggerPolicy = (typeof DEPLOYMENT_TRIGGERS)[number];\n\nexport const DEPLOYMENT_RUN_STATUSES = [\n 'queued',\n 'triggered',\n 'building',\n 'deployed',\n 'failed',\n 'unknown',\n] as const;\nexport type DeploymentRunStatus = (typeof DEPLOYMENT_RUN_STATUSES)[number];\n\nexport type DeploymentRunTrigger = 'publish' | 'change_set' | 'schema' | 'manual' | 'retry';\n\n/**\n * Provider settings (not secret). Generic: `{ url }`. Cloudflare Pages: `{ accountId, projectName }`.\n * GitHub: `{ owner, repo, branch, mode: 'commit' | 'pull_request', directory }`.\n */\nexport type DeploymentSettings = Record<string, string>;\n\n/**\n * Secret names per provider. Generic: `signingSecret` (generated when omitted). Cloudflare Pages:\n * `deployHookUrl`, `apiToken`. GitHub: `token`. Values are write-only. A value of `${ENV:VAR_NAME}`\n * makes the server read the secret from that environment variable instead of storing it.\n */\nexport type DeploymentSecretsInput = Record<string, string>;\n\n/** Which secrets are set; values never leave the server. `envVar`: read from this environment variable. */\nexport type DeploymentSecretState = Record<string, { set: boolean; envVar: string | null }>;\n\nexport type DeploymentTimelineEvent = {\n status: DeploymentRunStatus;\n at: string;\n source: 'shapio' | 'callback' | 'provider';\n message: string | null;\n};\n\nexport type DeploymentRun = {\n id: string;\n connectionId: string;\n connectionName: string;\n provider: DeploymentProvider;\n status: DeploymentRunStatus;\n trigger: DeploymentRunTrigger;\n /** Publication sequence the run was triggered at (`?snapshot=` on delivery). */\n snapshot: number | null;\n schemaVersion: number | null;\n retryOf: string | null;\n providerRef: string | null;\n logUrl: string | null;\n siteUrl: string | null;\n error: string | null;\n /** False for providers that cannot report completion without callbacks (shown as \"completion unknown\"). */\n completionReported: boolean;\n timeline: DeploymentTimelineEvent[];\n triggeredAt: string | null;\n finishedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type DeploymentConnection = {\n id: string;\n name: string;\n provider: DeploymentProvider;\n settings: DeploymentSettings;\n secrets: DeploymentSecretState;\n previewUrlTemplate: string | null;\n /** Preview tokens issued for this connection show exactly what this delivery role reads. */\n deliveryRoleId: string | null;\n triggerPolicy: DeploymentTriggerPolicy[];\n debounceSeconds: number;\n allowPrivateNetwork: boolean;\n enabled: boolean;\n /** Where the site posts signed build callbacks (generic webhook connections). */\n callbackUrl: string;\n latestRun: DeploymentRun | null;\n /** The newest deployed run by snapshot: what the site is serving, as far as Shapio knows. */\n currentRun: DeploymentRun | null;\n createdBy: string | null;\n createdAt: string;\n updatedAt: string;\n version: number;\n};\n\nexport type CreateDeploymentConnectionInput = {\n name: string;\n provider: DeploymentProvider;\n settings: DeploymentSettings;\n secrets: DeploymentSecretsInput;\n previewUrlTemplate?: string | null;\n triggerPolicy: DeploymentTriggerPolicy[];\n debounceSeconds?: number;\n allowPrivateNetwork?: boolean;\n enabled?: boolean;\n deliveryRoleId?: string | null;\n};\n\nexport type UpdateDeploymentConnectionInput = Partial<Omit<CreateDeploymentConnectionInput, 'provider'>> & {\n expectedVersion: number;\n};\n\n/** `generatedSecrets` holds secrets Shapio generated (the generic signing secret), shown once. */\nexport type DeploymentConnectionCreated = {\n connection: DeploymentConnection;\n generatedSecrets: Record<string, string>;\n};\n\nexport type ConnectionTestResult = {\n ok: boolean;\n checks: Array<{ name: string; ok: boolean; message: string }>;\n};\n\nexport type DeploymentRunQuery = { connectionId?: string; cursor?: string; limit?: number };\n\n// Preview ------------------------------------------------------------------------------------------\n\nexport type PreviewToken = {\n id: string;\n tokenPrefix: string;\n modelId: string;\n modelKey: string | null;\n entryId: string | null;\n locale: string | null;\n connectionId: string | null;\n /** Fields follow this delivery role (within the creator's access); null = the public fields. */\n deliveryRoleId: string | null;\n createdBy: string;\n expiresAt: string;\n revokedAt: string | null;\n lastUsedAt: string | null;\n createdAt: string;\n};\n\nexport type CreatePreviewTokenInput = {\n modelKey: string;\n entryId?: string;\n locale?: string;\n /** Default 1 hour, at most 30 days. */\n ttlSeconds?: number;\n connectionId?: string;\n /** Defaults to the connection's delivery role. */\n deliveryRoleId?: string;\n};\n\n/** `token` is shown once. `url` is rendered from the connection's preview URL template (null without one). */\nexport type PreviewTokenCreated = { token: string; previewToken: PreviewToken; url: string | null };\n\nexport type OpenPreviewInput = {\n modelKey: string;\n entryId: string;\n locale?: string;\n /** Defaults to the first enabled connection with a preview URL template. */\n connectionId?: string;\n};\n\n/** What the entry form's Preview button opens. `apiUrl` is the preview read endpoint for this entry. */\nexport type OpenPreviewResult = {\n /** The token's ID (revoke it when the preview closes). */\n id: string;\n url: string | null;\n apiUrl: string;\n token: string;\n expiresAt: string;\n connectionId: string | null;\n};\n\n/** A connection the site's previews open on (names and origins only). */\nexport type PreviewTarget = {\n connectionId: string;\n name: string;\n /** null when the preview URL template's origin depends on a variable. */\n origin: string | null;\n /** Whether the admin can show it in its preview frame. */\n framable: boolean;\n};\n","/**\n * App users and app roles as administrators manage them (package I), mirroring the TypeBox route schemas in\n * apps/api/src/routes/admin/{appUsers,appRoles}. JSON is camelCase; timestamps are ISO-8601.\n */\nimport type { RoleCondition } from './types.js';\n\nexport type AdminAppUser = {\n id: string;\n email: string;\n name: string;\n confirmed: boolean;\n blocked: boolean;\n /** False for accounts that only sign in with an OAuth provider. */\n hasPassword: boolean;\n /** OAuth providers linked to the account (`google`, `github`). */\n providers: string[];\n /** Custom app roles; `authenticated` applies to every app user implicitly. */\n roleIds: string[];\n lastLoginAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\n/** Newest first, cursor-paginated; `search` matches email or name. */\nexport type AppUserQuery = { search?: string; cursor?: string; limit?: number };\n\nexport type AppUserPage = { items: AdminAppUser[]; nextCursor: string | null };\n\nexport type UpdateAppUserInput = { blocked?: boolean; roleIds?: string[] };\n\n/** What app roles may grant: content actions only. */\nexport const APP_CONTENT_ACTIONS = ['read', 'create', 'update', 'delete', 'publish'] as const;\nexport type AppContentAction = (typeof APP_CONTENT_ACTIONS)[number];\n\n/** Built-in app role keys: `public` applies to anonymous callers, `authenticated` to every app user. */\nexport const BUILT_IN_APP_ROLE_KEYS = ['public', 'authenticated'] as const;\n\nexport type AppRolePermission = {\n action: AppContentAction;\n /** `null` grants the action on every model, including ones created later. */\n modelId: string | null;\n condition: RoleCondition | null;\n /** `null` = every public field; otherwise exactly these stable field IDs (non-public ones included). */\n fieldIds: string[] | null;\n};\n\nexport type AppRole = {\n id: string;\n key: string;\n name: string;\n description: string;\n isSystem: boolean;\n version: number;\n permissions: AppRolePermission[];\n userCount: number;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CreateAppRoleInput = {\n key: string;\n name: string;\n description?: string;\n permissions: AppRolePermission[];\n};\n\n/** Built-in roles accept `permissions` only. */\nexport type UpdateAppRoleInput = {\n expectedVersion: number;\n name?: string;\n description?: string;\n permissions?: AppRolePermission[];\n};\n","import type { SchemaDefinition } from '@shapio/schema';\nimport type { DeploymentRunStatus, Page, PublicationAction } from './publishingTypes.js';\nimport type { ChangePlan, DefinitionCategory, DefinitionPayload, PlanImpact } from './schemaTypes.js';\n\n/**\n * Change sets and snapshots (developer-face plan §5), mirroring the TypeBox route schemas in\n * apps/api/src/routes/admin/{changeSets,snapshots}/schemas.ts. Dates are ISO-8601 strings.\n */\n\nexport const CHANGE_SET_STATUSES = [\n 'open',\n 'scheduled',\n 'shipping',\n 'shipped',\n 'failed',\n 'discarded',\n] as const;\nexport type ChangeSetStatus = (typeof CHANGE_SET_STATUSES)[number];\n/** While `shipping`: preparing (prerequisite dry runs, index builds) or activating (the final transaction). */\nexport type ShipPhase = 'preparing' | 'activating';\nexport type ChangeSetSource = 'manual' | 'release' | 'restore' | 'builder' | 'assist';\nexport type ChangeSetItemStatus = 'pending' | 'done' | 'failed';\nexport type SchemaOperation = 'create' | 'update' | 'delete';\n\nexport type ChangeSetActor = { type: 'admin' | 'token' | 'system'; id: string | null; name: string | null };\n\n/** Why a ship failed, and the item that stopped it (null when not tied to one item). */\nexport type ChangeSetError = { code: string; message: string; itemId: string | null; details?: unknown };\n\nexport type ChangeSetEntryItem = {\n id: string;\n kind: 'entry';\n position: number;\n entryId: string;\n modelId: string;\n modelKey: string | null;\n title: string | null;\n locale: string;\n action: PublicationAction;\n /** Restore items publish this exact revision instead of the current draft. */\n sourceRevisionId: string | null;\n status: ChangeSetItemStatus;\n error: string | null;\n};\n\nexport type ChangeSetSchemaItem = {\n id: string;\n kind: 'schema';\n position: number;\n draftId: string;\n definitionId: string;\n category: DefinitionCategory;\n apiKey: string;\n operation: SchemaOperation;\n /** The active version the draft was based on; null for a new definition. */\n baseVersion: number | null;\n draftVersion: number;\n status: ChangeSetItemStatus;\n error: string | null;\n};\n\nexport type ChangeSetItem = ChangeSetEntryItem | ChangeSetSchemaItem;\n\nexport type ChangeSetSummary = {\n id: string;\n title: string;\n description: string;\n status: ChangeSetStatus;\n shipPhase: ShipPhase | null;\n source: ChangeSetSource;\n restoreOfSnapshot: number | null;\n scheduledFor: string | null;\n /** Connection whose deploy is triggered (pinned to the shipped snapshot) after the set ships. */\n deploymentConnectionId: string | null;\n deploymentRunId: string | null;\n shippedAt: string | null;\n /** The publication snapshot the set went live in. */\n shippedSnapshot: number | null;\n schemaVersionAfter: number | null;\n error: ChangeSetError | null;\n entryItemCount: number;\n schemaItemCount: number;\n createdBy: ChangeSetActor;\n createdAt: string;\n updatedAt: string;\n version: number;\n};\n\nexport type ChangeSet = ChangeSetSummary & { items: ChangeSetItem[] };\n\nexport type ChangeSetQuery = {\n /** Comma-separated statuses; default: everything except `discarded`. */\n status?: string;\n cursor?: string;\n limit?: number;\n};\n\nexport type CreateChangeSetInput = {\n title: string;\n description?: string;\n /** `builder`: a one-item set the model builder ships at once (\"Review & ship now\"). Default `manual`. */\n source?: 'manual' | 'builder';\n};\nexport type UpdateChangeSetInput = {\n title?: string;\n description?: string;\n deploymentConnectionId?: string | null;\n expectedVersion: number;\n};\nexport type AddChangeSetEntryInput = {\n modelKey: string;\n entryId: string;\n /** Omit for non-localized models (and for the default locale). */\n locale?: string;\n action: PublicationAction;\n};\n\nexport type SchemaDraft = {\n id: string;\n changeSetId: string;\n definitionId: string;\n category: DefinitionCategory;\n operation: SchemaOperation;\n baseVersion: number | null;\n /** Null when the draft deletes the definition. */\n definition: SchemaDefinition | null;\n version: number;\n updatedBy: ChangeSetActor;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type PutSchemaDraftInput = {\n category: DefinitionCategory;\n /** The whole proposed definition, or null to delete the definition when the set ships. */\n definition: DefinitionPayload | null;\n /** The active version the edit is based on (null: a new definition). */\n baseVersion: number | null;\n /** The draft row version the caller saw; omit when creating the draft. */\n expectedDraftVersion?: number;\n};\n\nexport type FieldDiff = { fieldId: string; apiKey: string; label: string; before: unknown; after: unknown };\nexport type ReviewIssue = { path: string; code: string; message: string };\n\nexport type ReviewEntryItem = {\n itemId: string;\n entryId: string;\n modelId: string;\n modelKey: string | null;\n title: string | null;\n locale: string;\n action: PublicationAction;\n sourceRevisionId: string | null;\n /** Send back in `ship.itemVersions` (strict ship). Null when the item does not publish the draft. */\n draftVersion: number | null;\n liveState: 'unpublished' | 'published' | 'modified' | 'missing';\n fields: FieldDiff[];\n issues: ReviewIssue[];\n};\n\nexport type ReviewSchemaItem = {\n itemId: string;\n draftId: string;\n definitionId: string;\n category: DefinitionCategory;\n apiKey: string;\n operation: SchemaOperation;\n baseVersion: number | null;\n activeVersion: number | null;\n /** The active version moved since the draft was based on it: shipping refuses until it is rebased. */\n stale: boolean;\n plan: ChangePlan | null;\n impact: PlanImpact | null;\n issues: ReviewIssue[];\n alsoChangedIn: Array<{ id: string; title: string }>;\n};\n\nexport const NOT_RESTORABLE_REASONS = [\n 'entry_deleted',\n 'model_missing',\n 'publishing_disabled',\n 'localization_changed',\n 'locale_missing',\n 'invalid',\n 'unique_conflict',\n] as const;\nexport type NotRestorableReason = (typeof NOT_RESTORABLE_REASONS)[number];\n\nexport type NotRestorable = {\n entryId: string;\n modelId: string;\n modelKey: string | null;\n locale: string;\n reason: NotRestorableReason;\n detail: string;\n};\n\nexport type FieldConsumer = {\n /** `token:<id>`, `app_users` or `anonymous`. */\n principalKey: string;\n label: string | null;\n reads: number;\n lastReadAt: string | null;\n /** `implicit`: the reader requested the whole model (no field selection). */\n selection: 'explicit' | 'implicit';\n};\n\nexport type FieldConsumers = { modelId: string; fieldId: string; apiKey: string; consumers: FieldConsumer[] };\n\nexport type ChangeSetReview = {\n changeSet: ChangeSet;\n entries: ReviewEntryItem[];\n schema: ReviewSchemaItem[];\n notRestorable: NotRestorable[];\n consumers: FieldConsumers[];\n usageDays: number;\n checks: { breaking: boolean; destructive: boolean; blocking: ReviewIssue[]; warnings: ReviewIssue[] };\n /** Fixed notices, e.g. `NEW_FIELDS_AFTER_SHIP`. */\n notices: string[];\n};\n\nexport type ShipChangeSetInput = {\n expectedVersion: number;\n acknowledgeBreaking?: boolean;\n acknowledgeDestructive?: boolean;\n /** Draft versions the review showed; a moved draft makes the ship refuse with 409 CHANGE_SET_STALE. */\n itemVersions?: Array<{ itemId: string; draftVersion: number }>;\n};\n\nexport type ScheduleChangeSetInput = {\n at: string;\n expectedVersion: number;\n acknowledgeBreaking?: boolean;\n acknowledgeDestructive?: boolean;\n};\n\nexport type ChangeSetTimelineEvent = {\n at: string;\n kind: string;\n actor: ChangeSetActor | null;\n message: string | null;\n snapshot: number | null;\n deploymentRunId: string | null;\n /** `item.changedAfterReview`: the entry whose draft moved between review and a scheduled ship. */\n item: { entryId: string; locale: string; fromVersion: number; toVersion: number } | null;\n};\n\nexport type UnassignedEntry = {\n entryId: string;\n modelId: string;\n modelKey: string | null;\n title: string | null;\n locale: string;\n status: 'draft' | 'modified';\n updatedAt: string;\n};\n\n// Snapshots ----------------------------------------------------------------------------------------\n\nexport const SNAPSHOT_SOURCES = [\n 'publish',\n 'unpublish',\n 'delete',\n 'schedule',\n 'change_set',\n 'schema',\n 'conversion',\n 'import',\n 'legacy',\n] as const;\nexport type SnapshotSource = (typeof SNAPSHOT_SOURCES)[number];\n\nexport type Snapshot = {\n seq: number;\n schemaVersion: number | null;\n source: SnapshotSource;\n changeSetId: string | null;\n changeSetTitle: string | null;\n actor: { type: string; id: string | null };\n changedEntries: number;\n deploymentRuns: Array<{ id: string; connectionId: string; status: DeploymentRunStatus }>;\n createdAt: string;\n};\n\nexport type SnapshotPage = Page<Snapshot> & { current: number };\nexport type SnapshotQuery = { cursor?: string; limit?: number };\n","/**\n * Shapes of the entry document's endpoints (editor experience, E0b): publish pre-flight, content health\n * findings, presence and per-model counts. Sentences are never sent: the admin builds them from `rule` and\n * `params` with its translations.\n */\n\n/** Health rules evaluated per entry (`apps/api/src/services/contentHealth.ts`). */\nexport const HEALTH_RULES = [\n 'requiredEmpty',\n 'altMissing',\n 'localeMissing',\n 'relationMissing',\n 'relationUnpublished',\n 'uniqueConflict',\n 'staleDraft',\n 'unpublishedChanges',\n] as const;\nexport type HealthRule = (typeof HEALTH_RULES)[number];\n\n/** Pre-flight adds the publish checks that are not health rules: validator issues and missing media. */\nexport type PreflightRule = HealthRule | 'invalid' | 'mediaMissing';\n\nexport type CheckSeverity = 'error' | 'warning';\n\n/** Values a sentence needs (field ID, asset ID, locale, counts…). */\nexport type CheckParams = Record<string, string | number | null>;\n\nexport type PreflightCheck = {\n rule: PreflightRule;\n /** Errors block publishing; warnings are informational. */\n severity: CheckSeverity;\n /** JSON pointer (API keys) of the value to fix, e.g. `/body` or `/sections/2/title`. */\n path?: string;\n /** The validator's issue code, for `invalid` and `requiredEmpty` errors. */\n code?: string;\n params: CheckParams;\n};\n\nexport type PreflightLocale = {\n locale: string;\n /** No error-severity check: publishing this locale is expected to succeed. */\n ready: boolean;\n checks: PreflightCheck[];\n};\n\nexport type PreflightInput = { locales?: string[] };\n\nexport type PreflightResponse = {\n locales: PreflightLocale[];\n /** Checks about the entry as a whole, not one locale (e.g. a configured locale not started yet). */\n entry: PreflightCheck[];\n};\n\n/** A finding of the health engine, open until its rule passes again. */\nexport type ContentHealthFinding = {\n id: string;\n entryId: string;\n modelId: string;\n modelKey: string;\n /** The entry's title in the finding's locale (or the default locale), when readable. */\n entryTitle: string | null;\n /** `*` for a finding about the entry as a whole. */\n locale: string;\n rule: HealthRule;\n /** Distinguishes several findings of one rule on one entry (e.g. two images without alt text). */\n subject: string;\n severity: CheckSeverity;\n path?: string;\n params: CheckParams;\n firstSeenAt: string;\n lastSeenAt: string;\n};\n\nexport type ContentHealthQuery = { rule?: HealthRule; modelKey?: string; cursor?: string; limit?: number };\n\nexport type ContentHealthPage = { items: ContentHealthFinding[]; nextCursor: string | null };\n\nexport type ContentHealthSummary = { rules: { rule: HealthRule; count: number }[] };\n\n/** Someone with the entry open. */\nexport type PresencePerson = {\n userId: string;\n name: string;\n /** The locale they are editing, when the model is localized. */\n locale: string | null;\n /** When this tab started editing. */\n since: string;\n /** The caller's own other tab (the calling tab itself is never listed). */\n you: boolean;\n};\n\nexport type PresenceHeartbeatInput = {\n /** A random ID per browser tab, so two tabs of one person are counted apart. */\n tabId: string;\n locale?: string | null;\n};\n\nexport type EntryPresence = { people: PresencePerson[] };\n\nexport type ModelPresence = { entries: { entryId: string; people: PresencePerson[] }[] };\n\nexport type ContentCount = { modelId: string; modelKey: string; total: number };\n\nexport type ContentCounts = { counts: ContentCount[] };\n","import type { SchemaDefinition } from '@shapio/schema';\n\n/** Editor assists (plan agentic-ecosystem §A0). Agents propose, people ship: nothing here publishes. */\nexport type AssistProvider = 'anthropic' | 'openai' | 'openai-compatible';\n\nexport type AssistUsage = { month: string; runs: number; inputTokens: number; outputTokens: number };\n\n/** `usage` only for admins with `changes.manage`; provider and model only while assist is on. */\nexport type AssistStatus = {\n enabled: boolean;\n provider?: AssistProvider;\n model?: string;\n usage?: AssistUsage;\n};\n\nexport type AltTextInput = { assetId: string; locale?: string };\nexport type AltTextResult = { alt: string; model: string };\n\n/** A model-written text; `truncated` when it was cut to the field's or the request's limit. */\nexport type AssistTextResult = { text: string; truncated: boolean; model: string };\n\nexport type SummarizeInput = { modelKey: string; entryId: string; locale?: string; fieldApiKey: string };\n\nexport type TranslateInput = { modelKey: string; entryId: string; from: string; to: string };\nexport type AssistIssue = { path: string; code: string; message: string };\n/** `data` is in the editor's save format: save it as the `to` locale's draft. */\nexport type TranslateResult = { data: Record<string, unknown>; issues: AssistIssue[]; model: string };\n\nexport type RewriteInput = { text: string; instruction: string; maxLength?: number };\n\nexport type SchemaDraftInput = { description: string };\n/** New definitions with new stable IDs, in save order (references first). Nothing is written. */\nexport type SchemaDraftResult = { definitions: SchemaDefinition[]; model: string };\n\nexport const CONTENT_OPS_RULES = ['altMissing', 'localeMissing'] as const;\nexport type ContentOpsRule = (typeof CONTENT_OPS_RULES)[number];\nexport type ContentOpsInput = { rule: ContentOpsRule; modelKey?: string; fromLocale?: string };\nexport type ContentOpsStatus = 'queued' | 'running' | 'succeeded' | 'failed';\n\n/** One library asset's proposed alt text; apply it with the media update at `assetVersion`. */\nexport type AltProposal = {\n assetId: string;\n filename: string;\n currentAlt: string | null;\n proposedAlt: string;\n assetVersion: number;\n findingCount: number;\n};\n\n/** A finding the run left alone, and why (an error code or a reason such as `publishesOnSave`). */\nexport type ContentOpsSkip = {\n key: string;\n entryId?: string;\n assetId?: string;\n locale?: string;\n reason: string;\n detail?: unknown;\n};\nexport type ContentOpsWritten = { entryId: string; modelKey: string; locale: string; version: number };\n\nexport type AltMissingResult = { rule: 'altMissing'; proposals: AltProposal[]; skipped: ContentOpsSkip[] };\n/** The drafts were written into the change set `changeSetId` (null when nothing was written). */\nexport type LocaleMissingResult = {\n rule: 'localeMissing';\n changeSetId: string | null;\n fromLocale: string;\n written: ContentOpsWritten[];\n skipped: ContentOpsSkip[];\n};\nexport type ContentOpsResult = AltMissingResult | LocaleMissingResult;\n\nexport type ContentOpsRun = {\n runId: string;\n rule: ContentOpsRule;\n status: ContentOpsStatus;\n model: string;\n createdAt: string;\n finishedAt: string | null;\n error: { code: string } | null;\n /** Once succeeded (null before, or partial progress while running). */\n result: ContentOpsResult | null;\n};\n","import type { RequestFn } from '../request.js';\nimport { createAppUsersApi } from './appUsers.js';\nimport { createAssistApi } from './assist.js';\nimport { createChangeSetsApi } from './changeSets.js';\nimport { createContentApi } from './content.js';\nimport { createEditingApi } from './editing.js';\nimport { createMediaApi } from './media.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport { createPublishingApi } from './publishing.js';\nimport { toQueryString } from './query.js';\nimport { createSchemaApi } from './schema.js';\nimport { createSitesApi } from './sites.js';\nimport type {\n AcceptInvitationInput,\n AdminSession,\n AdminUser,\n ApiToken,\n AuditPage,\n AuditQuery,\n ChangePasswordInput,\n CreateApiTokenInput,\n CreatedApiToken,\n CreateRoleInput,\n CsrfResponse,\n InspectInvitationResponse,\n Invitation,\n InvitationLink,\n InviteUserInput,\n LoginInput,\n MeResponse,\n PasswordResetConfirmInput,\n PasswordResetRequestInput,\n Role,\n SessionStarted,\n SetupInput,\n SetupStatusResponse,\n UpdateAdminUserInput,\n UpdateProfileInput,\n UpdateRoleInput,\n} from './types.js';\nimport { createUsageApi } from './usage.js';\n\n/**\n * Admin endpoints: identity (setup, auth, sessions, users, invitations, roles, tokens, audit) and the schema\n * registry (models, components, schema, locales), the media library and content.\n */\nexport const createAdminApi = (request: RequestFn) => ({\n setup: {\n status: () => request<SetupStatusResponse>(ADMIN_PATHS.setup),\n complete: (body: SetupInput) => request<SessionStarted>(ADMIN_PATHS.setup, { method: 'POST', body }),\n },\n auth: {\n csrf: () => request<CsrfResponse>(ADMIN_PATHS.csrf),\n login: (body: LoginInput) => request<SessionStarted>(ADMIN_PATHS.login, { method: 'POST', body }),\n logout: () => request<void>(ADMIN_PATHS.logout, { method: 'POST' }),\n me: () => request<MeResponse>(ADMIN_PATHS.me),\n updateProfile: (body: UpdateProfileInput) =>\n request<AdminUser>(ADMIN_PATHS.me, { method: 'PATCH', body }),\n /** The session is rotated: the response carries the new session's CSRF token. */\n changePassword: (body: ChangePasswordInput) =>\n request<CsrfResponse>(ADMIN_PATHS.password, { method: 'POST', body }),\n requestPasswordReset: (body: PasswordResetRequestInput) =>\n request<void>(ADMIN_PATHS.passwordReset, { method: 'POST', body }),\n confirmPasswordReset: (body: PasswordResetConfirmInput) =>\n request<void>(ADMIN_PATHS.passwordResetConfirm, { method: 'POST', body }),\n },\n sessions: {\n list: () => request<AdminSession[]>(ADMIN_PATHS.sessions),\n revoke: (id: string) => request<void>(withId(ADMIN_PATHS.sessions, id), { method: 'DELETE' }),\n },\n users: {\n list: () => request<AdminUser[]>(ADMIN_PATHS.users),\n get: (id: string) => request<AdminUser>(withId(ADMIN_PATHS.users, id)),\n update: (id: string, body: UpdateAdminUserInput) =>\n request<AdminUser>(withId(ADMIN_PATHS.users, id), { method: 'PATCH', body }),\n remove: (id: string) => request<void>(withId(ADMIN_PATHS.users, id), { method: 'DELETE' }),\n revokeSessions: (id: string) =>\n request<void>(`${withId(ADMIN_PATHS.users, id)}/sessions`, { method: 'DELETE' }),\n },\n invitations: {\n list: () => request<Invitation[]>(ADMIN_PATHS.invitations),\n create: (body: InviteUserInput) => request<Invitation>(ADMIN_PATHS.invitations, { method: 'POST', body }),\n revoke: (id: string) => request<void>(withId(ADMIN_PATHS.invitations, id), { method: 'DELETE' }),\n /** A fresh link to send by hand; any earlier link for this invitation stops working. */\n link: (id: string) =>\n request<InvitationLink>(`${withId(ADMIN_PATHS.invitations, id)}/link`, { method: 'POST' }),\n /** Public: the token travels in the body, never in a URL the server logs. */\n inspect: (token: string) =>\n request<InspectInvitationResponse>(ADMIN_PATHS.inspectInvitation, { method: 'POST', body: { token } }),\n accept: (body: AcceptInvitationInput) =>\n request<SessionStarted>(ADMIN_PATHS.acceptInvitation, { method: 'POST', body }),\n },\n roles: {\n list: () => request<Role[]>(ADMIN_PATHS.roles),\n get: (id: string) => request<Role>(withId(ADMIN_PATHS.roles, id)),\n create: (body: CreateRoleInput) => request<Role>(ADMIN_PATHS.roles, { method: 'POST', body }),\n update: (id: string, body: UpdateRoleInput) =>\n request<Role>(withId(ADMIN_PATHS.roles, id), { method: 'PATCH', body }),\n remove: (id: string) => request<void>(withId(ADMIN_PATHS.roles, id), { method: 'DELETE' }),\n },\n tokens: {\n list: () => request<ApiToken[]>(ADMIN_PATHS.tokens),\n create: (body: CreateApiTokenInput) =>\n request<CreatedApiToken>(ADMIN_PATHS.tokens, { method: 'POST', body }),\n revoke: (id: string) => request<void>(withId(ADMIN_PATHS.tokens, id), { method: 'DELETE' }),\n },\n audit: {\n list: (query: AuditQuery = {}) => request<AuditPage>(`${ADMIN_PATHS.audit}${toQueryString(query)}`),\n },\n ...createSchemaApi(request),\n ...createMediaApi(request),\n ...createContentApi(request),\n ...createEditingApi(request),\n ...createPublishingApi(request),\n ...createAppUsersApi(request),\n ...createChangeSetsApi(request),\n ...createUsageApi(request),\n ...createSitesApi(request),\n ...createAssistApi(request),\n});\n\nexport type AdminApi = ReturnType<typeof createAdminApi>;\nexport { ADMIN_PATHS } from './paths.js';\nexport * from './types.js';\nexport * from './schemaTypes.js';\nexport * from './schemaSyncTypes.js';\nexport * from './mediaTypes.js';\nexport * from './contentTypes.js';\nexport * from './publishingTypes.js';\nexport * from './appUsersTypes.js';\nexport * from './changeSetTypes.js';\nexport * from './usageTypes.js';\nexport * from './sitesTypes.js';\nexport { SITE_HEADER, SITES_PATHS } from './sites.js';\nexport { toContentQueryString } from './contentQuery.js';\nexport { buildUploadForm, resolveUploadUrl } from './media.js';\nexport { HEALTH_RULES } from './editingTypes.js';\nexport { ASSIST_PATHS } from './assist.js';\nexport { CONTENT_OPS_RULES } from './assistTypes.js';\n","import type { RequestFn } from '../request.js';\nimport type {\n AppChangePasswordInput,\n AppLoginInput,\n AppOAuthProvider,\n AppRegisterInput,\n AppRegisterResult,\n AppSession,\n AppUser,\n} from './types.js';\n\nexport const APP_AUTH_PATHS = {\n register: '/api/app-auth/register',\n login: '/api/app-auth/login',\n refresh: '/api/app-auth/refresh',\n logout: '/api/app-auth/logout',\n me: '/api/app-auth/me',\n password: '/api/app-auth/me/password',\n confirmEmail: '/api/app-auth/confirm-email',\n resendConfirmation: '/api/app-auth/confirm-email/resend',\n passwordReset: '/api/app-auth/password-reset',\n passwordResetConfirm: '/api/app-auth/password-reset/confirm',\n providers: '/api/app-auth/providers',\n oauthExchange: '/api/app-auth/oauth/exchange',\n} as const;\n\n/**\n * App-user endpoints. Calls that act as the signed-in user need a client created with `token: accessToken`.\n * `baseUrl` is the client's base URL, used to build the OAuth start link the browser navigates to.\n */\nexport const createAppAuthApi = (request: RequestFn, baseUrl: string) => ({\n register: (body: AppRegisterInput) =>\n request<AppRegisterResult>(APP_AUTH_PATHS.register, { method: 'POST', body }),\n login: (body: AppLoginInput) => request<AppSession>(APP_AUTH_PATHS.login, { method: 'POST', body }),\n refresh: (refreshToken: string) =>\n request<AppSession>(APP_AUTH_PATHS.refresh, { method: 'POST', body: { refreshToken } }),\n /**\n * Signs the account out everywhere: this login's refresh tokens are revoked, and every access token the\n * account holds (on any device) is refused from the next request. Other logins recover with their own\n * refresh token.\n */\n logout: (refreshToken: string) =>\n request<void>(APP_AUTH_PATHS.logout, { method: 'POST', body: { refreshToken } }),\n /** The signed-in user. Answers 401 once the account logged out anywhere, changed its password or was blocked. */\n me: () => request<AppUser>(APP_AUTH_PATHS.me),\n updateMe: (body: { name: string }) => request<AppUser>(APP_AUTH_PATHS.me, { method: 'PATCH', body }),\n /** Returns a new session; every other sign-in of the account is revoked. */\n changePassword: (body: AppChangePasswordInput) =>\n request<AppSession>(APP_AUTH_PATHS.password, { method: 'POST', body }),\n deleteMe: (body: { password?: string } = {}) =>\n request<void>(APP_AUTH_PATHS.me, { method: 'DELETE', body }),\n /** The token from the `#token=` fragment of the confirmation link. */\n confirmEmail: (token: string) =>\n request<void>(APP_AUTH_PATHS.confirmEmail, { method: 'POST', body: { token } }),\n resendConfirmation: (email: string) =>\n request<void>(APP_AUTH_PATHS.resendConfirmation, { method: 'POST', body: { email } }),\n requestPasswordReset: (email: string) =>\n request<void>(APP_AUTH_PATHS.passwordReset, { method: 'POST', body: { email } }),\n confirmPasswordReset: (body: { token: string; password: string }) =>\n request<void>(APP_AUTH_PATHS.passwordResetConfirm, { method: 'POST', body }),\n providers: async () =>\n (await request<{ providers: AppOAuthProvider[] }>(APP_AUTH_PATHS.providers)).providers,\n /**\n * Where to send the browser to sign in with a provider. `codeChallenge` comes from `createPkcePair()`;\n * keep its `codeVerifier` until the browser returns. It comes back to `redirectTo` (an allowed return URL,\n * by default an origin listed in CORS_ORIGINS) with `?code=` (pass it to `exchangeCode`) or `?error=`.\n */\n oauthStartUrl: (provider: AppOAuthProvider, redirectTo: string, codeChallenge: string) =>\n `${baseUrl.replace(/\\/+$/, '')}/api/app-auth/oauth/${provider}/start?redirectTo=${encodeURIComponent(redirectTo)}&codeChallenge=${encodeURIComponent(codeChallenge)}`,\n /** Trades the one-time code for a session. A wrong verifier spends the code: start the sign-in again. */\n exchangeCode: (code: string, codeVerifier: string) =>\n request<AppSession>(APP_AUTH_PATHS.oauthExchange, { method: 'POST', body: { code, codeVerifier } }),\n});\n\nexport type AppAuthApi = ReturnType<typeof createAppAuthApi>;\n","import { toContentQueryString } from './admin/contentQuery.js';\nimport type { DeliveryGetQuery, DeliveryItem, DeliveryList, DeliveryListQuery } from './deliveryTypes.js';\nimport type { RequestFn } from './request.js';\n\nexport const DELIVERY_PATH = '/api/content';\n\nconst routePath = (routeKey: string) => `${DELIVERY_PATH}/${encodeURIComponent(routeKey)}`;\n\n/** The content query string plus `snapshot`, which only delivery reads take. */\nconst deliveryQueryString = ({ snapshot, ...query }: DeliveryListQuery): string => {\n const base = toContentQueryString(query);\n if (snapshot === undefined) {\n return base;\n }\n const pinned = `snapshot=${encodeURIComponent(String(snapshot))}`;\n return base ? `${base}&${pinned}` : `?${pinned}`;\n};\n\n/**\n * Published content, typed by the caller (`delivery.list<Article>('articles', { locale: 'fr', snapshot })`).\n * A collection is read with `list` (a page) and `get` (one entry); a singleton with `singleton`.\n */\nexport const createDeliveryApi = (request: RequestFn) => ({\n list: <T = Record<string, unknown>>(routeKey: string, query: DeliveryListQuery = {}) =>\n request<DeliveryList<T>>(`${routePath(routeKey)}${deliveryQueryString(query)}`),\n singleton: <T = Record<string, unknown>>(apiKey: string, query: DeliveryGetQuery = {}) =>\n request<DeliveryItem<T>>(`${routePath(apiKey)}${deliveryQueryString(query)}`),\n get: <T = Record<string, unknown>>(routeKey: string, id: string, query: DeliveryGetQuery = {}) =>\n request<DeliveryItem<T>>(`${routePath(routeKey)}/${encodeURIComponent(id)}${deliveryQueryString(query)}`),\n});\n\nexport type DeliveryApi = ReturnType<typeof createDeliveryApi>;\n","import { toQueryString } from './admin/query.js';\nimport type { RequestFn } from './request.js';\nimport type {\n CurrentSnapshot,\n SnapshotChange,\n SnapshotChangesPage,\n SnapshotChangesQuery,\n} from './snapshotTypes.js';\n\nexport const SNAPSHOT_PATHS = {\n current: '/api/snapshots/current',\n changes: '/api/snapshots/changes',\n} as const;\n\n/** Snapshots and the diff between two of them, for incremental site builds (delivery credentials). */\nexport const createSnapshotsApi = (request: RequestFn) => {\n const changes = (query: SnapshotChangesQuery) =>\n request<SnapshotChangesPage>(`${SNAPSHOT_PATHS.changes}${toQueryString(query)}`);\n return {\n current: () => request<CurrentSnapshot>(SNAPSHOT_PATHS.current),\n changes,\n /** Every change between `from` and `to`, following `nextCursor` until the last page. */\n allChanges: async (query: Omit<SnapshotChangesQuery, 'after'>) => {\n const items: SnapshotChange[] = [];\n let page = await changes(query);\n items.push(...page.items);\n while (page.nextCursor !== null) {\n page = await changes({ ...query, to: page.to, after: page.nextCursor });\n items.push(...page.items);\n }\n return { from: page.from, to: page.to, schemaVersions: page.schemaVersions, items };\n },\n };\n};\n","import { SITE_HEADER } from './admin/sites.js';\nimport { DELIVERY_PATH } from './delivery.js';\nimport { SNAPSHOT_PATHS } from './snapshots.js';\n\n/** Delivery reads name their site with `?site=`; everything else with the `Shapio-Site` header. */\nexport const SITE_QUERY_PARAMETER = 'site';\n\n/** Delivery reads (content and snapshots): a GET there carries the site in its URL. */\nconst DELIVERY_READ_PREFIXES = [`${DELIVERY_PATH}/`, `${DELIVERY_PATH}?`, '/api/snapshots/'] as const;\n\nconst isDeliveryRead = (method: string, path: string) =>\n method === 'GET' &&\n (path === DELIVERY_PATH ||\n Object.values(SNAPSHOT_PATHS).some((snapshotPath) => path === snapshotPath) ||\n DELIVERY_READ_PREFIXES.some((prefix) => path.startsWith(prefix)));\n\nconst namesSite = (path: string) => {\n const index = path.indexOf('?');\n return index !== -1 && new URLSearchParams(path.slice(index + 1)).has(SITE_QUERY_PARAMETER);\n};\n\n/**\n * Where a request names the client's site (sites plan §H). Delivery GETs put it in the query string: a\n * simple cross-origin GET needs no CORS preflight, and URL-keyed CDN caches keep sites apart. Every other\n * request sends the `Shapio-Site` header. A path that already names a site is left as it is.\n */\nexport const applySite = (\n site: string | undefined,\n method: string,\n path: string,\n): { path: string; headers: Record<string, string> } => {\n if (site === undefined || namesSite(path)) {\n return { path, headers: {} };\n }\n if (isDeliveryRead(method, path)) {\n const parameter = `${SITE_QUERY_PARAMETER}=${encodeURIComponent(site)}`;\n return { path: `${path}${path.includes('?') ? '&' : '?'}${parameter}`, headers: {} };\n }\n return { path, headers: { [SITE_HEADER]: site } };\n};\n","import { ShapioApiError } from './errors.js';\nimport { applySite } from './site.js';\n\n/** Fetch's `credentials` mode (spelled out: the DOM lib type is not available to Node consumers). */\nexport type FetchCredentials = 'omit' | 'same-origin' | 'include';\n\nexport type RequestOptions = { method?: string; body?: unknown; signal?: AbortSignal };\n\nexport type RequestFn = <T>(path: string, options?: RequestOptions) => Promise<T>;\n\nexport type RequestConfig = {\n baseUrl: string;\n token: string | undefined;\n fetch: typeof globalThis.fetch;\n credentials: FetchCredentials | undefined;\n headers: (() => Readonly<Record<string, string>>) | undefined;\n /** The site key every request names (see site.ts); undefined: the credential's site, else the primary. */\n site: string | undefined;\n};\n\nconst parseBody = async (response: Response): Promise<unknown> => {\n const text = await response.text();\n if (text.length === 0) {\n return undefined;\n }\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n};\n\n/** Builds the JSON request function every endpoint group uses. Non-2xx responses throw ShapioApiError. */\nexport const createRequest = ({\n baseUrl,\n token,\n fetch,\n credentials,\n headers,\n site,\n}: RequestConfig): RequestFn => {\n const origin = baseUrl.replace(/\\/+$/, '');\n return async <T>(\n requestPath: string,\n { method = 'GET', body, signal }: RequestOptions = {},\n ): Promise<T> => {\n const { path, headers: siteHeaders } = applySite(site, method, requestPath);\n const requestHeaders: Record<string, string> = {\n accept: 'application/json',\n ...siteHeaders,\n ...headers?.(),\n };\n if (token) {\n requestHeaders.authorization = `Bearer ${token}`;\n }\n if (body !== undefined) {\n requestHeaders['content-type'] = 'application/json';\n }\n const response = await fetch(`${origin}${path}`, {\n method,\n headers: requestHeaders,\n ...(body !== undefined ? { body: JSON.stringify(body) } : {}),\n ...(signal ? { signal } : {}),\n ...(credentials ? { credentials } : {}),\n });\n const parsed = await parseBody(response);\n if (!response.ok) {\n throw new ShapioApiError(response.status, parsed);\n }\n return parsed as T;\n };\n};\n","import { createAdminApi } from './admin/index.js';\nimport { createAppAuthApi } from './appAuth/index.js';\nimport { createDeliveryApi } from './delivery.js';\nimport { createRequest, type FetchCredentials } from './request.js';\nimport { createSnapshotsApi } from './snapshots.js';\nimport type { HealthResponse, ReadyResponse, VersionResponse } from './types.js';\n\nexport type ShapioClientOptions = {\n /** Base URL of the Shapio server including any BASE_PATH, e.g. `https://cms.example.com/cms`. */\n baseUrl: string;\n /** API token sent as a bearer token. */\n token?: string;\n /** Defaults to the global fetch; injectable for tests and custom agents. */\n fetch?: typeof globalThis.fetch;\n /** Fetch credentials mode. The admin uses `same-origin` so its session cookie is sent. */\n credentials?: FetchCredentials;\n /** Extra headers computed per request (the admin's CSRF token). */\n headers?: () => Readonly<Record<string, string>>;\n /**\n * The site key (multi-site instances). Delivery reads send it as `?site=`, every other request as the\n * `Shapio-Site` header. Leave it out to use the token's site, else the primary site. A site token only\n * ever reads its own site: naming another one is refused (403 `SITE_MISMATCH`).\n */\n site?: string;\n};\n\nexport const createClient = ({\n baseUrl,\n token,\n fetch = globalThis.fetch,\n credentials,\n headers,\n site,\n}: ShapioClientOptions) => {\n const request = createRequest({ baseUrl, token, fetch, credentials, headers, site });\n\n return {\n /**\n * Any Shapio route, e.g. the delivery API. Delivery paths use the model's route key: a collection's\n * plural API ID (`request('/api/content/articles')`, `/api/content/articles/<id>`), a singleton's API ID\n * (`/api/content/homepage`). The admin API (`admin.*`) always uses the singular API ID.\n */\n request,\n system: {\n health: (signal?: AbortSignal) => request<HealthResponse>('/api/health', signal ? { signal } : {}),\n ready: (signal?: AbortSignal) => request<ReadyResponse>('/api/ready', signal ? { signal } : {}),\n version: (signal?: AbortSignal) => request<VersionResponse>('/api/version', signal ? { signal } : {}),\n },\n /** Published content (the delivery API), typed by the caller. */\n delivery: createDeliveryApi(request),\n admin: createAdminApi(request),\n /** Publication snapshots and the diff between two (incremental builds). */\n snapshots: createSnapshotsApi(request),\n /** End users of your sites and apps: sign-up, sign-in, tokens, OAuth. */\n appAuth: createAppAuthApi(request, baseUrl),\n };\n};\n\nexport type ShapioClient = ReturnType<typeof createClient>;\n","/**\n * Verifying Shapio's signed webhooks and deploy triggers on the receiving side (a site's revalidate route,\n * a build hook). The scheme is the server's (`apps/api/src/publishing/signature.ts`):\n * `X-Shapio-Signature: v1=<hex HMAC-SHA256(secret, \"<timestamp>.<raw body>\")>` with\n * `X-Shapio-Timestamp: <unix seconds>`; several comma-separated `v1=` values are accepted (secret rotation).\n * Uses Web Crypto, so it runs in Node, edge runtimes and browsers alike.\n */\nexport const WEBHOOK_SIGNATURE_HEADER = 'x-shapio-signature';\nexport const WEBHOOK_TIMESTAMP_HEADER = 'x-shapio-timestamp';\nexport const WEBHOOK_EVENT_HEADER = 'x-shapio-event';\n/** Requests signed further from now than this are rejected (replay protection). */\nexport const WEBHOOK_TOLERANCE_SECONDS = 300;\n\nconst SIGNATURE_VERSION = 'v1';\n\nexport type WebhookSignatureInput = {\n /** The webhook's or connection's signing secret. */\n secret: string;\n /** The `X-Shapio-Signature` header. */\n signature: string | null | undefined;\n /** The `X-Shapio-Timestamp` header. */\n timestamp: string | null | undefined;\n /** The raw request body, exactly as received (not re-serialised JSON). */\n body: string;\n /** Defaults to the current time. */\n now?: Date;\n /** Defaults to WEBHOOK_TOLERANCE_SECONDS. */\n toleranceSeconds?: number;\n};\n\nexport type WebhookSignatureCheck = { ok: true } | { ok: false; reason: string };\n\nconst toHex = (bytes: ArrayBuffer) =>\n Array.from(new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, '0')).join('');\n\n/** Compares two strings without returning early on the first difference. */\nconst constantTimeEqual = (a: string, b: string) => {\n let difference = a.length ^ b.length;\n for (let index = 0; index < Math.max(a.length, b.length); index += 1) {\n difference |= (a.charCodeAt(index) || 0) ^ (b.charCodeAt(index) || 0);\n }\n return difference === 0;\n};\n\nconst expectedSignature = async (secret: string, timestamp: number, body: string) => {\n const encoder = new TextEncoder();\n const key = await globalThis.crypto.subtle.importKey(\n 'raw',\n encoder.encode(secret),\n { name: 'HMAC', hash: 'SHA-256' },\n false,\n ['sign'],\n );\n const mac = await globalThis.crypto.subtle.sign('HMAC', key, encoder.encode(`${timestamp}.${body}`));\n return `${SIGNATURE_VERSION}=${toHex(mac)}`;\n};\n\n/** Checks a Shapio signature; `{ ok: false, reason }` says why it was refused (never throws for bad input). */\nexport const verifyWebhookSignature = async ({\n secret,\n signature,\n timestamp,\n body,\n now = new Date(),\n toleranceSeconds = WEBHOOK_TOLERANCE_SECONDS,\n}: WebhookSignatureInput): Promise<WebhookSignatureCheck> => {\n if (!signature || !timestamp || !/^\\d{1,12}$/.test(timestamp)) {\n return { ok: false, reason: 'missing signature or timestamp' };\n }\n const seconds = Number(timestamp);\n if (Math.abs(now.getTime() / 1000 - seconds) > toleranceSeconds) {\n return { ok: false, reason: 'timestamp outside the allowed window' };\n }\n const expected = await expectedSignature(secret, seconds, body);\n const matches = signature\n .split(',')\n .map((candidate) => candidate.trim())\n .some((candidate) => constantTimeEqual(candidate, expected));\n return matches ? { ok: true } : { ok: false, reason: 'signature mismatch' };\n};\n","/**\n * PKCE (RFC 7636) for the app side of Shapio's OAuth sign-in: the app keeps the verifier (e.g. in\n * sessionStorage) and sends the S256 challenge with the start link; the one-time code it gets back is only\n * exchanged together with that verifier. Uses Web Crypto, so it works in browsers and Node alike.\n */\nexport type AppPkcePair = { codeVerifier: string; codeChallenge: string };\n\nconst toBase64Url = (bytes: Uint8Array): string =>\n btoa(String.fromCharCode(...bytes))\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/, '');\n\n/** The S256 challenge of a verifier: base64url(SHA-256(verifier)). */\nexport const codeChallengeOf = async (codeVerifier: string): Promise<string> =>\n toBase64Url(\n new Uint8Array(await globalThis.crypto.subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier))),\n );\n\n/** A fresh verifier (32 random bytes, 43 characters) and its S256 challenge. */\nexport const createPkcePair = async (): Promise<AppPkcePair> => {\n const codeVerifier = toBase64Url(globalThis.crypto.getRandomValues(new Uint8Array(32)));\n return { codeVerifier, codeChallenge: await codeChallengeOf(codeVerifier) };\n};\n"],"mappings":";;;AAcA,MAAa,qBAAqB,aAAwB;CACxD,UAAU;EACR,OAAO,QAAsB,CAAC,MAC5B,QAAqB,GAAG,YAAY,WAAW,cAAc,KAAK,GAAG;EACvE,MAAM,OAAe,QAAsB,OAAO,YAAY,UAAU,EAAE,CAAC;;EAE3E,SAAS,IAAY,SACnB,QAAsB,OAAO,YAAY,UAAU,EAAE,GAAG;GAAE,QAAQ;GAAS;EAAK,CAAC;EACnF,SAAS,OAAe,QAAc,OAAO,YAAY,UAAU,EAAE,GAAG,EAAE,QAAQ,SAAS,CAAC;;EAE5F,qBAAqB,OACnB,QAAc,GAAG,OAAO,YAAY,UAAU,EAAE,EAAE,uBAAuB,EAAE,QAAQ,OAAO,CAAC;CAC/F;CACA,UAAU;EACR,YAAY,QAAmB,YAAY,QAAQ;EACnD,MAAM,OAAe,QAAiB,OAAO,YAAY,UAAU,EAAE,CAAC;EACtE,SAAS,SAA6B,QAAiB,YAAY,UAAU;GAAE,QAAQ;GAAQ;EAAK,CAAC;;EAErG,SAAS,IAAY,SACnB,QAAiB,OAAO,YAAY,UAAU,EAAE,GAAG;GAAE,QAAQ;GAAS;EAAK,CAAC;EAC9E,SAAS,OAAe,QAAc,OAAO,YAAY,UAAU,EAAE,GAAG,EAAE,QAAQ,SAAS,CAAC;CAC9F;AACF;;;ACnBA,MAAa,eAAe;CAC1B,QAAQ;CACR,SAAS;CACT,WAAW;CACX,WAAW;CACX,SAAS;CACT,aAAa;CACb,mBAAmB;CACnB,YAAY;AACd;;AAGA,MAAa,mBAAmB,aAAwB,EACtD,QAAQ;CACN,cAAc,QAAsB,aAAa,MAAM;CACvD,UAAU,SAAuB,QAAuB,aAAa,SAAS;EAAE,QAAQ;EAAQ;CAAK,CAAC;CACtG,YAAY,SACV,QAA0B,aAAa,WAAW;EAA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Q,CAC/C,IAAI,EAAE,IAAI,KAAK,IAAI;EAAE,IAAI;EAAO,QAAQ;CAAqB;AAC5E;;;ACxEA,MAAM,eAAe,UACnB,KAAK,OAAO,aAAa,GAAG,KAAK,CAAC,CAAC,CAChC,QAAQ,OAAO,GAAG,CAAC,CACnB,QAAQ,OAAO,GAAG,CAAC,CACnB,QAAQ,OAAO,EAAE;;AAGtB,MAAa,kBAAkB,OAAO,iBACpC,YACE,IAAI,WAAW,MAAM,WAAW,OAAO,OAAO,OAAO,WAAW,IAAI,YAAY,CAAC,CAAC,OAAO,YAAY,CAAC,CAAC,CACzG;;AAGF,MAAa,iBAAiB,YAAkC;CAC9D,MAAM,eAAe,YAAY,WAAW,OAAO,gCAAgB,IAAI,WAAW,EAAE,CAAC,CAAC;CACtF,OAAO;EAAE;EAAc,eAAe,MAAM,gBAAgB,YAAY;CAAE;AAC5E"}
1
+ {"version":3,"file":"index.js","names":["entryPath"],"sources":["../src/admin/appUsers.ts","../src/admin/assist.ts","../src/admin/changeSets.ts","../src/admin/contentQuery.ts","../src/admin/content.ts","../src/admin/editing.ts","../src/admin/publishing.ts","../src/admin/schema.ts","../src/admin/sites.ts","../src/admin/usage.ts","../src/admin/types.ts","../src/admin/publishingTypes.ts","../src/admin/appUsersTypes.ts","../src/admin/changeSetTypes.ts","../src/admin/editingTypes.ts","../src/admin/assistTypes.ts","../src/admin/index.ts","../src/appAuth/index.ts","../src/delivery.ts","../src/snapshots.ts","../src/site.ts","../src/request.ts","../src/client.ts","../src/webhooks.ts","../src/appAuth/pkce.ts"],"sourcesContent":["import type { RequestFn } from '../request.js';\nimport type {\n AdminAppUser,\n AppRole,\n AppUserPage,\n AppUserQuery,\n CreateAppRoleInput,\n UpdateAppRoleInput,\n UpdateAppUserInput,\n} from './appUsersTypes.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport { toQueryString } from './query.js';\n\n/** App users (Users → App users) and app roles (Settings → Roles → App roles). */\nexport const createAppUsersApi = (request: RequestFn) => ({\n appUsers: {\n list: (query: AppUserQuery = {}) =>\n request<AppUserPage>(`${ADMIN_PATHS.appUsers}${toQueryString(query)}`),\n get: (id: string) => request<AdminAppUser>(withId(ADMIN_PATHS.appUsers, id)),\n /** Block/unblock and replace custom roles. Blocking takes effect on the user's next request. */\n update: (id: string, body: UpdateAppUserInput) =>\n request<AdminAppUser>(withId(ADMIN_PATHS.appUsers, id), { method: 'PATCH', body }),\n remove: (id: string) => request<void>(withId(ADMIN_PATHS.appUsers, id), { method: 'DELETE' }),\n /** 409 NOT_CONFIGURED without APP_AUTH_CONFIRM_EMAIL_URL; 409 ALREADY_CONFIRMED. */\n resendConfirmation: (id: string) =>\n request<void>(`${withId(ADMIN_PATHS.appUsers, id)}/resend-confirmation`, { method: 'POST' }),\n },\n appRoles: {\n list: () => request<AppRole[]>(ADMIN_PATHS.appRoles),\n get: (id: string) => request<AppRole>(withId(ADMIN_PATHS.appRoles, id)),\n create: (body: CreateAppRoleInput) => request<AppRole>(ADMIN_PATHS.appRoles, { method: 'POST', body }),\n /** 409 VERSION_CONFLICT when `expectedVersion` is stale. */\n update: (id: string, body: UpdateAppRoleInput) =>\n request<AppRole>(withId(ADMIN_PATHS.appRoles, id), { method: 'PATCH', body }),\n remove: (id: string) => request<void>(withId(ADMIN_PATHS.appRoles, id), { method: 'DELETE' }),\n },\n});\n","import type { RequestFn } from '../request.js';\nimport type {\n AltTextInput,\n AltTextResult,\n AssistStatus,\n AssistTextResult,\n ContentOpsInput,\n ContentOpsRun,\n RewriteInput,\n SchemaDraftInput,\n SchemaDraftResult,\n SummarizeInput,\n TranslateInput,\n TranslateResult,\n} from './assistTypes.js';\nimport { withId } from './paths.js';\n\nexport const ASSIST_PATHS = {\n status: '/api/admin/assist/status',\n altText: '/api/admin/assist/alt-text',\n summarize: '/api/admin/assist/summarize',\n translate: '/api/admin/assist/translate',\n rewrite: '/api/admin/assist/rewrite',\n schemaDraft: '/api/admin/assist/schema/draft',\n contentOpsPropose: '/api/admin/assist/content-ops/propose',\n contentOps: '/api/admin/assist/content-ops',\n} as const;\n\n/** Editor assists with the instance's own model provider (documentation/assist.md). */\nexport const createAssistApi = (request: RequestFn) => ({\n assist: {\n status: () => request<AssistStatus>(ASSIST_PATHS.status),\n altText: (body: AltTextInput) => request<AltTextResult>(ASSIST_PATHS.altText, { method: 'POST', body }),\n summarize: (body: SummarizeInput) =>\n request<AssistTextResult>(ASSIST_PATHS.summarize, { method: 'POST', body }),\n translate: (body: TranslateInput) =>\n request<TranslateResult>(ASSIST_PATHS.translate, { method: 'POST', body }),\n rewrite: (body: RewriteInput) =>\n request<AssistTextResult>(ASSIST_PATHS.rewrite, { method: 'POST', body }),\n schemaDraft: (body: SchemaDraftInput) =>\n request<SchemaDraftResult>(ASSIST_PATHS.schemaDraft, { method: 'POST', body }),\n /** Starts a background run (202); poll it with `contentOpsRun`. */\n proposeContentOps: (body: ContentOpsInput) =>\n request<{ runId: string }>(ASSIST_PATHS.contentOpsPropose, { method: 'POST', body }),\n contentOpsRun: (runId: string) => request<ContentOpsRun>(withId(ASSIST_PATHS.contentOps, runId)),\n },\n});\n","import type { RequestFn } from '../request.js';\nimport type {\n AddChangeSetEntryInput,\n ChangeSet,\n ChangeSetQuery,\n ChangeSetReview,\n ChangeSetSummary,\n ChangeSetTimelineEvent,\n CreateChangeSetInput,\n PutSchemaDraftInput,\n ScheduleChangeSetInput,\n SchemaDraft,\n ShipChangeSetInput,\n Snapshot,\n SnapshotPage,\n SnapshotQuery,\n UnassignedEntry,\n UpdateChangeSetInput,\n} from './changeSetTypes.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport type { Page } from './publishingTypes.js';\nimport { toQueryString } from './query.js';\n\nconst setPath = (id: string) => withId(ADMIN_PATHS.changeSets, id);\nconst draftPath = (id: string, definitionId: string) =>\n `${setPath(id)}/schema/${encodeURIComponent(definitionId)}`;\n\n/** Change sets (schema + content shipped as one snapshot) and the snapshot ledger. */\nexport const createChangeSetsApi = (request: RequestFn) => ({\n changeSets: {\n list: (query: ChangeSetQuery = {}) =>\n request<Page<ChangeSetSummary>>(`${ADMIN_PATHS.changeSets}${toQueryString(query)}`),\n get: (id: string) => request<ChangeSet>(setPath(id)),\n create: (body: CreateChangeSetInput) =>\n request<ChangeSet>(ADMIN_PATHS.changeSets, { method: 'POST', body }),\n update: (id: string, body: UpdateChangeSetInput) =>\n request<ChangeSet>(setPath(id), { method: 'PATCH', body }),\n /** Keeps the set as history (`discarded`) and deletes its schema drafts. */\n discard: (id: string) => request<ChangeSet>(`${setPath(id)}/discard`, { method: 'POST' }),\n addEntry: (id: string, body: AddChangeSetEntryInput) =>\n request<ChangeSet>(`${setPath(id)}/items`, { method: 'POST', body }),\n removeItem: (id: string, itemId: string) =>\n request<ChangeSet>(`${setPath(id)}/items/${encodeURIComponent(itemId)}`, { method: 'DELETE' }),\n getSchemaDraft: (id: string, definitionId: string) => request<SchemaDraft>(draftPath(id, definitionId)),\n putSchemaDraft: (id: string, definitionId: string, body: PutSchemaDraftInput) =>\n request<SchemaDraft>(draftPath(id, definitionId), { method: 'PUT', body }),\n removeSchemaDraft: (id: string, definitionId: string) =>\n request<ChangeSet>(draftPath(id, definitionId), { method: 'DELETE' }),\n review: (id: string) => request<ChangeSetReview>(`${setPath(id)}/review`),\n /**\n * Resolves with the set: `shipped` (or `failed`) when it shipped inline, `shipping` (HTTP 202) when\n * prerequisites run in the background. Poll `get` until it leaves `shipping`.\n */\n ship: (id: string, body: ShipChangeSetInput) =>\n request<ChangeSet>(`${setPath(id)}/ship`, { method: 'POST', body }),\n schedule: (id: string, body: ScheduleChangeSetInput) =>\n request<ChangeSet>(`${setPath(id)}/schedule`, { method: 'POST', body }),\n unschedule: (id: string) => request<ChangeSet>(`${setPath(id)}/unschedule`, { method: 'POST' }),\n timeline: async (id: string) =>\n (await request<{ items: ChangeSetTimelineEvent[] }>(`${setPath(id)}/timeline`)).items,\n unassigned: (query: { cursor?: string; limit?: number } = {}) =>\n request<Page<UnassignedEntry>>(`${ADMIN_PATHS.changeSets}/unassigned${toQueryString(query)}`),\n },\n snapshots: {\n list: (query: SnapshotQuery = {}) =>\n request<SnapshotPage>(`${ADMIN_PATHS.snapshots}${toQueryString(query)}`),\n get: (seq: number) => request<Snapshot>(`${ADMIN_PATHS.snapshots}/${seq}`),\n /** Creates an open restore change set (reviewable); nothing goes live until it ships. */\n restore: (seq: number) =>\n request<ChangeSet>(`${ADMIN_PATHS.snapshots}/${seq}/restore`, { method: 'POST' }),\n },\n});\n","import type { ContentFilter, ContentListQuery } from './contentTypes.js';\n\n/**\n * Serialises a content list query into the bracket querystring the content compiler parses\n * (`filters[title][$eq]=A&sort=title:asc&page=2`). Lists repeat the key (`filters[id][$in]=a&filters[id][$in]=b`).\n */\nconst appendFilter = (params: URLSearchParams, prefix: string, value: unknown) => {\n if (value === undefined || value === null) {\n return;\n }\n if (Array.isArray(value)) {\n value.forEach((item: unknown, index) => {\n if (typeof item === 'object' && item !== null) {\n appendFilter(params, `${prefix}[${index}]`, item);\n } else {\n params.append(prefix, String(item));\n }\n });\n return;\n }\n if (typeof value === 'object') {\n for (const [key, child] of Object.entries(value as ContentFilter)) {\n appendFilter(params, `${prefix}[${key}]`, child);\n }\n return;\n }\n if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {\n params.append(prefix, String(value));\n }\n};\n\nexport const toContentQueryString = (query: ContentListQuery = {}): string => {\n const params = new URLSearchParams();\n if (query.filters) {\n appendFilter(params, 'filters', query.filters);\n }\n for (const term of query.sort ?? []) {\n params.append('sort', `${term.field}:${term.direction}`);\n }\n if (query.page !== undefined) {\n params.set('page', String(query.page));\n }\n if (query.pageSize !== undefined) {\n params.set('pageSize', String(query.pageSize));\n }\n if (query.q) {\n params.set('q', query.q);\n }\n if (query.locale) {\n params.set('locale', query.locale);\n }\n for (const field of query.fields ?? []) {\n params.append('fields', field);\n }\n for (const path of query.populate ?? []) {\n params.append('populate', path);\n }\n if (query.status) {\n params.set('status', query.status);\n }\n if (query.author) {\n params.set('author', query.author);\n }\n const serialised = params.toString();\n return serialised ? `?${serialised}` : '';\n};\n","import type { RequestFn } from '../request.js';\nimport { toContentQueryString } from './contentQuery.js';\nimport type {\n AdminEntry,\n AdminEntryPage,\n ContentListQuery,\n CreateEntryInput,\n EditorManifest,\n EntryLocalesInput,\n RevisionDetail,\n RevisionSummary,\n UpdateEntryInput,\n} from './contentTypes.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport { toQueryString } from './query.js';\n\nconst modelPath = (modelKey: string) => withId(ADMIN_PATHS.content, modelKey);\nconst entryPath = (modelKey: string, id: string) => withId(modelPath(modelKey), id);\nconst revisionsPath = (modelKey: string, id: string) => `${entryPath(modelKey, id)}/revisions`;\n\n/**\n * Content of any model through the generic admin routes (`/api/admin/content/:modelKey`, where `modelKey`\n * is the model's singular API ID for collections too; only the delivery API uses the plural). Drafts are read\n * and written here; publishing is per locale. Writes carry the draft `version` the editor saw and fail with\n * 409 CONTENT_VERSION_CONFLICT (or SCHEMA_CHANGED) when it moved.\n */\nexport const createContentApi = (request: RequestFn) => ({\n content: {\n list: (modelKey: string, query: ContentListQuery = {}) =>\n request<AdminEntryPage>(`${modelPath(modelKey)}${toContentQueryString(query)}`),\n get: (modelKey: string, id: string, { locale }: { locale?: string } = {}) =>\n request<AdminEntry>(`${entryPath(modelKey, id)}${toQueryString({ locale })}`),\n /** Fully validated (`required` included); 422 CONTENT_INVALID with `details.issues`. */\n create: (modelKey: string, body: CreateEntryInput) =>\n request<AdminEntry>(modelPath(modelKey), { method: 'POST', body }),\n /** Saves a patch of one locale's draft; `autosave` skips `required` and creates no revision. */\n update: (modelKey: string, id: string, body: UpdateEntryInput) =>\n request<AdminEntry>(entryPath(modelKey, id), { method: 'PUT', body }),\n /** 409 ENTRY_REFERENCED with `details.referrers` while other entries point at it. */\n remove: (modelKey: string, id: string) => request<void>(entryPath(modelKey, id), { method: 'DELETE' }),\n duplicate: (modelKey: string, id: string) =>\n request<AdminEntry>(`${entryPath(modelKey, id)}/duplicate`, { method: 'POST' }),\n publish: (modelKey: string, id: string, body: EntryLocalesInput = {}) =>\n request<AdminEntry>(`${entryPath(modelKey, id)}/publish`, { method: 'POST', body }),\n unpublish: (modelKey: string, id: string, body: EntryLocalesInput = {}) =>\n request<AdminEntry>(`${entryPath(modelKey, id)}/unpublish`, { method: 'POST', body }),\n revisions: async (modelKey: string, id: string, { locale }: { locale?: string } = {}) =>\n (\n await request<{ items: RevisionSummary[] }>(\n `${revisionsPath(modelKey, id)}${toQueryString({ locale })}`,\n )\n ).items,\n revision: (modelKey: string, id: string, revisionId: string) =>\n request<RevisionDetail>(withId(revisionsPath(modelKey, id), revisionId)),\n /** Brings an older revision back as the new draft of its locale (a new revision). */\n restore: (modelKey: string, id: string, revisionId: string, expectedVersion: number) =>\n request<AdminEntry>(`${withId(revisionsPath(modelKey, id), revisionId)}/restore`, {\n method: 'POST',\n body: { expectedVersion },\n }),\n },\n extensions: {\n /** Custom field editors the project installed (`shapio.config` + `extensions/editors/*.js`). */\n editors: () => request<EditorManifest>(ADMIN_PATHS.editorManifest),\n },\n});\n","import type { RequestFn } from '../request.js';\nimport type {\n ContentCounts,\n ContentHealthPage,\n ContentHealthQuery,\n ContentHealthSummary,\n EntryPresence,\n ModelPresence,\n PresenceHeartbeatInput,\n PreflightInput,\n PreflightResponse,\n} from './editingTypes.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport { toQueryString } from './query.js';\n\nconst entryPath = (base: string, modelKey: string, id: string) => withId(withId(base, modelKey), id);\n\n/** The entry document's endpoints: pre-flight, content health (the Inbox), presence and counts. */\nexport const createEditingApi = (request: RequestFn) => ({\n preflight: {\n /** What publishing these locales would run into, without publishing (no hooks, no locks). */\n run: (modelKey: string, id: string, body: PreflightInput = {}) =>\n request<PreflightResponse>(`${entryPath(ADMIN_PATHS.content, modelKey, id)}/preflight`, {\n method: 'POST',\n body,\n }),\n },\n contentHealth: {\n list: (query: ContentHealthQuery = {}) =>\n request<ContentHealthPage>(`${ADMIN_PATHS.contentHealth}${toQueryString(query)}`),\n summary: () => request<ContentHealthSummary>(`${ADMIN_PATHS.contentHealth}/summary`),\n },\n presence: {\n /** Heartbeat (every 15s while the document is visible); returns who else has the entry open. */\n heartbeat: (modelKey: string, id: string, body: PresenceHeartbeatInput) =>\n request<EntryPresence>(entryPath(ADMIN_PATHS.presence, modelKey, id), { method: 'PUT', body }),\n entry: (modelKey: string, id: string) =>\n request<EntryPresence>(entryPath(ADMIN_PATHS.presence, modelKey, id)),\n /** Everyone editing an entry of the model (list rows). */\n model: (modelKey: string) => request<ModelPresence>(withId(ADMIN_PATHS.presence, modelKey)),\n leave: (modelKey: string, id: string, tabId: string) =>\n request<void>(`${entryPath(ADMIN_PATHS.presence, modelKey, id)}${toQueryString({ tabId })}`, {\n method: 'DELETE',\n }),\n },\n contentCounts: {\n list: () => request<ContentCounts>(ADMIN_PATHS.contentCounts),\n },\n});\n","import type { RequestFn } from '../request.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport type {\n ConnectionTestResult,\n CreateDeploymentConnectionInput,\n CreatePreviewTokenInput,\n CreateScheduleInput,\n CreateWebhookInput,\n DeploymentConnection,\n DeploymentConnectionCreated,\n DeploymentRun,\n DeploymentRunQuery,\n Job,\n JobQuery,\n JobSummary,\n OpenPreviewInput,\n OpenPreviewResult,\n PreviewTarget,\n Page,\n PreviewToken,\n PreviewTokenCreated,\n ScheduledPublication,\n ScheduleQuery,\n UpdateDeploymentConnectionInput,\n UpdateWebhookInput,\n Webhook,\n WebhookDelivery,\n WebhookEventType,\n WebhookWithSecret,\n} from './publishingTypes.js';\nimport { toQueryString } from './query.js';\n\n/** Jobs, scheduled publications, webhooks, deployment connections and runs, preview (package H). */\nexport const createPublishingApi = (request: RequestFn) => ({\n jobs: {\n list: (query: JobQuery = {}) => request<Page<Job>>(`${ADMIN_PATHS.jobs}${toQueryString(query)}`),\n summary: () => request<JobSummary>(`${ADMIN_PATHS.jobs}/summary`),\n get: (id: string) => request<Job>(withId(ADMIN_PATHS.jobs, id)),\n /** Dead jobs only: runs again from attempt 1. 409 JOB_NOT_RETRYABLE otherwise. */\n retry: (id: string) => request<Job>(`${withId(ADMIN_PATHS.jobs, id)}/retry`, { method: 'POST' }),\n },\n schedules: {\n list: (query: ScheduleQuery = {}) =>\n request<Page<ScheduledPublication>>(`${ADMIN_PATHS.schedules}${toQueryString(query)}`),\n create: (body: CreateScheduleInput) =>\n request<ScheduledPublication>(ADMIN_PATHS.schedules, { method: 'POST', body }),\n cancel: (id: string) => request<void>(withId(ADMIN_PATHS.schedules, id), { method: 'DELETE' }),\n },\n webhooks: {\n list: () => request<Webhook[]>(ADMIN_PATHS.webhooks),\n events: async () =>\n (await request<{ items: WebhookEventType[] }>(`${ADMIN_PATHS.webhooks}/events`)).items,\n get: (id: string) => request<Webhook>(withId(ADMIN_PATHS.webhooks, id)),\n create: (body: CreateWebhookInput) =>\n request<WebhookWithSecret>(ADMIN_PATHS.webhooks, { method: 'POST', body }),\n update: (id: string, body: UpdateWebhookInput) =>\n request<Webhook>(withId(ADMIN_PATHS.webhooks, id), { method: 'PATCH', body }),\n remove: (id: string) => request<void>(withId(ADMIN_PATHS.webhooks, id), { method: 'DELETE' }),\n rotateSecret: (id: string) =>\n request<WebhookWithSecret>(`${withId(ADMIN_PATHS.webhooks, id)}/rotate-secret`, { method: 'POST' }),\n /** Queues a `webhook.test` delivery; poll the delivery log for its outcome. */\n test: (id: string) =>\n request<WebhookDelivery>(`${withId(ADMIN_PATHS.webhooks, id)}/test`, { method: 'POST' }),\n deliveries: (id: string, query: { cursor?: string; limit?: number } = {}) =>\n request<Page<WebhookDelivery>>(`${withId(ADMIN_PATHS.webhooks, id)}/deliveries${toQueryString(query)}`),\n /** Sends the same payload again as a new delivery. */\n redeliver: (id: string, deliveryId: string) =>\n request<WebhookDelivery>(\n `${withId(ADMIN_PATHS.webhooks, id)}/deliveries/${encodeURIComponent(deliveryId)}/redeliver`,\n { method: 'POST' },\n ),\n },\n deployments: {\n connections: {\n list: () => request<DeploymentConnection[]>(ADMIN_PATHS.deploymentConnections),\n get: (id: string) => request<DeploymentConnection>(withId(ADMIN_PATHS.deploymentConnections, id)),\n create: (body: CreateDeploymentConnectionInput) =>\n request<DeploymentConnectionCreated>(ADMIN_PATHS.deploymentConnections, { method: 'POST', body }),\n update: (id: string, body: UpdateDeploymentConnectionInput) =>\n request<DeploymentConnection>(withId(ADMIN_PATHS.deploymentConnections, id), {\n method: 'PATCH',\n body,\n }),\n remove: (id: string) =>\n request<void>(withId(ADMIN_PATHS.deploymentConnections, id), { method: 'DELETE' }),\n test: (id: string) =>\n request<ConnectionTestResult>(`${withId(ADMIN_PATHS.deploymentConnections, id)}/test`, {\n method: 'POST',\n }),\n /** A manual run at the current publication snapshot. */\n trigger: (id: string) =>\n request<DeploymentRun>(`${withId(ADMIN_PATHS.deploymentConnections, id)}/runs`, { method: 'POST' }),\n },\n runs: {\n list: (query: DeploymentRunQuery = {}) =>\n request<Page<DeploymentRun>>(`${ADMIN_PATHS.deploymentRuns}${toQueryString(query)}`),\n get: (id: string) => request<DeploymentRun>(withId(ADMIN_PATHS.deploymentRuns, id)),\n /** A new run (linked by `retryOf`) at the current snapshot. */\n retry: (id: string) =>\n request<DeploymentRun>(`${withId(ADMIN_PATHS.deploymentRuns, id)}/retry`, { method: 'POST' }),\n },\n },\n preview: {\n tokens: {\n list: (query: { entryId?: string } = {}) =>\n request<PreviewToken[]>(`${ADMIN_PATHS.previewTokens}${toQueryString(query)}`),\n create: (body: CreatePreviewTokenInput) =>\n request<PreviewTokenCreated>(ADMIN_PATHS.previewTokens, { method: 'POST', body }),\n revoke: (id: string) => request<void>(withId(ADMIN_PATHS.previewTokens, id), { method: 'DELETE' }),\n },\n /** The site's connections with a preview URL (the entry form's Preview pane). */\n targets: () => request<PreviewTarget[]>(`${ADMIN_PATHS.preview}/targets`),\n /** The entry form's Preview action: a short-lived entry token and the rendered preview URL. */\n open: (body: OpenPreviewInput) =>\n request<OpenPreviewResult>(`${ADMIN_PATHS.preview}/open`, { method: 'POST', body }),\n },\n});\n","import type { RequestFn } from '../request.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport { toQueryString } from './query.js';\nimport type { SchemaApplyInput, SchemaApplyResult, SchemaExport } from './schemaSyncTypes.js';\nimport type {\n ChangeOutcome,\n ChangeScopeInput,\n ChangeScopeOutcome,\n CreateDefinitionInput,\n CreateLocaleInput,\n DefinitionCategory,\n DefinitionPayload,\n DefinitionDetail,\n DefinitionScope,\n DefinitionListItem,\n DefinitionRevision,\n DeleteLocaleResult,\n Locale,\n PlanPreview,\n PlanUpdateInput,\n SchemaChangeJob,\n SchemaSettings,\n SchemaSummary,\n SetDefaultLocaleResult,\n UpdateDefinitionInput,\n UpdateLocaleInput,\n UpdateSchemaSettingsInput,\n} from './schemaTypes.js';\n\nconst DEFINITION_PATHS = {\n model: ADMIN_PATHS.models,\n component: ADMIN_PATHS.components,\n} as const satisfies Record<DefinitionCategory, string>;\n\n/** Models (collections and singletons) and components share one set of endpoints under their own base. */\nexport const createDefinitionApi = (request: RequestFn, category: DefinitionCategory) => {\n const base = DEFINITION_PATHS[category];\n return {\n /** The site's view (shared definitions and its own); `{ scope: 'network' }` lists the shared ones. */\n list: async (options: { scope?: DefinitionScope } = {}) =>\n (await request<{ items: DefinitionListItem[] }>(`${base}${toQueryString(options)}`)).items,\n get: (id: string) => request<DefinitionDetail>(withId(base, id)),\n /** Creates and activates a definition (`pending` when prerequisites must run first). */\n create: (body: CreateDefinitionInput) => request<ChangeOutcome>(base, { method: 'POST', body }),\n /** Plan preview of a create: classification and impact, nothing written. */\n planCreate: (definition: DefinitionPayload, scope?: DefinitionScope) =>\n request<PlanPreview>(`${base}/plan`, {\n method: 'POST',\n body: scope ? { definition, scope } : { definition },\n }),\n /** Shares a definition with all sites, or keeps it on one (needs schema.create on every site). */\n changeScope: (id: string, body: ChangeScopeInput) =>\n request<ChangeScopeOutcome>(`${withId(base, id)}/scope`, { method: 'PUT', body }),\n /** Changes a definition; 409 SCHEMA_VERSION_CONFLICT when `expectedVersion` is stale. */\n update: (id: string, body: UpdateDefinitionInput) =>\n request<ChangeOutcome>(withId(base, id), { method: 'PUT', body }),\n planUpdate: (id: string, body: PlanUpdateInput) =>\n request<PlanPreview>(`${withId(base, id)}/plan`, { method: 'POST', body }),\n /** Soft delete: entries are kept and reappear if the definition is applied again. */\n remove: (id: string, expectedVersion: number) =>\n request<ChangeOutcome>(`${withId(base, id)}${toQueryString({ expectedVersion })}`, {\n method: 'DELETE',\n }),\n revisions: async (id: string) =>\n (await request<{ items: DefinitionRevision[] }>(`${withId(base, id)}/revisions`)).items,\n changes: async (id: string) =>\n (await request<{ items: SchemaChangeJob[] }>(`${withId(base, id)}/changes`)).items,\n };\n};\n\n/** Schema-wide endpoints: the version summary, planned-change status, the read-only lock, locales. */\nexport const createSchemaApi = (request: RequestFn) => ({\n models: createDefinitionApi(request, 'model'),\n components: createDefinitionApi(request, 'component'),\n schema: {\n /** The global schema version and every visible definition's version (cheap; poll it for changes). */\n summary: () => request<SchemaSummary>(ADMIN_PATHS.schema),\n change: (changeId: string) => request<SchemaChangeJob>(withId(ADMIN_PATHS.schemaChanges, changeId)),\n /** Every definition in the pull format, with the schema version they come from (`shapio schema pull`). */\n export: (options: { scope?: DefinitionScope } = {}) =>\n request<SchemaExport>(`${ADMIN_PATHS.schemaExport}${toQueryString(options)}`),\n /** Applies definition files live through the change planner; refuses when the base moved (409). */\n apply: (body: SchemaApplyInput) =>\n request<SchemaApplyResult>(ADMIN_PATHS.schemaApply, { method: 'POST', body }),\n settings: () => request<SchemaSettings>(ADMIN_PATHS.schemaSettings),\n updateSettings: (body: UpdateSchemaSettingsInput) =>\n request<SchemaSettings>(ADMIN_PATHS.schemaSettings, { method: 'PUT', body }),\n },\n locales: {\n list: async () => (await request<{ items: Locale[] }>(ADMIN_PATHS.locales)).items,\n create: (body: CreateLocaleInput) => request<Locale>(ADMIN_PATHS.locales, { method: 'POST', body }),\n update: (code: string, body: UpdateLocaleInput) =>\n request<Locale>(withId(ADMIN_PATHS.locales, code), { method: 'PUT', body }),\n /** A contract change: without `acknowledgeBreaking` the server answers 409 SCHEMA_CHANGE_NOT_ACKNOWLEDGED. */\n setDefault: (code: string, acknowledgeBreaking: boolean) =>\n request<SetDefaultLocaleResult>(`${withId(ADMIN_PATHS.locales, code)}/default`, {\n method: 'POST',\n body: { acknowledgeBreaking },\n }),\n /**\n * Deletes a locale and purges its content. When content exists and `acknowledgeDestructive` is false,\n * the server answers 409 SCHEMA_CHANGE_NOT_ACKNOWLEDGED with `details.plan.impact.affectedHeads`.\n */\n remove: (code: string, acknowledgeDestructive: boolean) =>\n request<DeleteLocaleResult>(\n `${withId(ADMIN_PATHS.locales, code)}${toQueryString({ acknowledgeDestructive: acknowledgeDestructive || undefined })}`,\n { method: 'DELETE' },\n ),\n },\n});\n","import type { RequestFn } from '../request.js';\nimport type {\n CreateSiteInput,\n SetSiteAppRolesInput,\n Site,\n SiteAppRoles,\n UpdateSiteInput,\n} from './sitesTypes.js';\n\nexport const SITES_PATHS = { sites: '/api/admin/sites' } as const;\n\n/** The admin API header that names the site a site-scoped request is about (default: the primary site). */\nexport const SITE_HEADER = 'shapio-site';\n\nconst sitePath = (id: string) => `${SITES_PATHS.sites}/${encodeURIComponent(id)}`;\n\n/** Sites (network routes): listing shows the sites the caller holds a role on; changes need `sites.manage`. */\nexport const createSitesApi = (request: RequestFn) => ({\n sites: {\n list: () => request<Site[]>(SITES_PATHS.sites),\n get: (id: string) => request<Site>(sitePath(id)),\n create: (body: CreateSiteInput) => request<Site>(SITES_PATHS.sites, { method: 'POST', body }),\n update: (id: string, body: UpdateSiteInput) => request<Site>(sitePath(id), { method: 'PATCH', body }),\n /** Only an empty site (409 `SITE_NOT_EMPTY`); never the primary site (409 `SITE_IS_PRIMARY`). */\n remove: (id: string) => request<void>(sitePath(id), { method: 'DELETE' }),\n /** The app roles bound to the site's anonymous callers (`public`) and signed-in app users (`authenticated`). */\n appRoles: {\n get: (id: string) => request<SiteAppRoles>(`${sitePath(id)}/app-roles`),\n /** Replaces both bindings (`roles.manage`). */\n set: (id: string, body: SetSiteAppRolesInput) =>\n request<SiteAppRoles>(`${sitePath(id)}/app-roles`, { method: 'PUT', body }),\n },\n },\n});\n","import type { RequestFn } from '../request.js';\nimport { toQueryString } from './query.js';\nimport type { FieldUsageQuery, FieldUsageResponse } from './usageTypes.js';\n\nexport const USAGE_PATHS = { fields: '/api/admin/usage/fields' } as const;\n\n/** Who reads which fields (needs `tokens.manage`). */\nexport const createUsageApi = (request: RequestFn) => ({\n usage: {\n fields: (query: FieldUsageQuery) =>\n request<FieldUsageResponse>(`${USAGE_PATHS.fields}${toQueryString(query)}`),\n },\n});\n","import type { SiteSummary } from './sitesTypes.js';\n/**\n * Admin identity API shapes (package B, build plan §4.B), mirroring the TypeBox route schemas in\n * apps/api/src/routes/admin/** and routes/schemas/adminIdentity.ts. JSON is camelCase; timestamps are ISO-8601.\n */\n\nexport type AdminUserStatus = 'active' | 'disabled';\n\n/** A role held on one site, or on every site (`siteId` null). */\nexport type RoleAssignment = { roleId: string; siteId: string | null };\n\nexport type AdminUser = {\n id: string;\n email: string;\n name: string;\n status: AdminUserStatus;\n /** Where each role applies. */\n assignments: RoleAssignment[];\n /** Deprecated: the distinct roles of `assignments`, on any site. */\n roleIds: string[];\n lastLoginAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport const CONTENT_ACTIONS = ['read', 'create', 'update', 'delete', 'publish', 'schemaManage'] as const;\nexport type ContentAction = (typeof CONTENT_ACTIONS)[number];\n\n/**\n * Network actions: about the whole instance. Only roles assigned on every site grant them, so a role held\n * on one site never reaches the network.\n */\nexport const NETWORK_ACTIONS = [\n 'schema.create',\n 'users.manage',\n 'roles.manage',\n 'audit.read',\n 'sites.manage',\n] as const;\nexport type NetworkAction = (typeof NETWORK_ACTIONS)[number];\n\n/** Site actions: about one site's library, tokens and publishing. */\nexport const SITE_ACTIONS = [\n 'tokens.manage',\n 'media.read',\n 'media.write',\n 'media.manage',\n 'publishing.manage',\n 'webhooks.manage',\n 'deployments.manage',\n 'deployments.trigger',\n 'changes.manage',\n 'changes.ship',\n] as const;\nexport type SiteAction = (typeof SITE_ACTIONS)[number];\n\n/** Actions not scoped to a model: network actions and site actions. */\nexport const GLOBAL_ACTIONS = [\n 'schema.create',\n 'users.manage',\n 'roles.manage',\n 'tokens.manage',\n 'audit.read',\n 'sites.manage',\n 'media.read',\n 'media.write',\n 'media.manage',\n 'publishing.manage',\n 'webhooks.manage',\n 'deployments.manage',\n 'deployments.trigger',\n 'changes.manage',\n 'changes.ship',\n] as const;\nexport type GlobalAction = (typeof GLOBAL_ACTIONS)[number];\n\nexport type PermissionAction = ContentAction | GlobalAction;\n\nexport type RoleSummary = { id: string; key: string; name: string };\n\n/** Returned whenever a session starts (setup, login, accepting an invitation). */\nexport type SessionStarted = { user: AdminUser; csrfToken: string };\n\nexport type MeResponse = {\n user: AdminUser;\n roles: RoleSummary[];\n /** The site this response is about: the request's `Shapio-Site`, else the primary site. */\n site: SiteSummary;\n /** Every site this admin holds a role on (all of them for a role assigned on every site). */\n sites: SiteSummary[];\n /** Sites on this instance (whether or not the admin holds a role on them); scope is shown only above 1. */\n siteCount: number;\n /** Network actions (roles assigned on every site only). */\n networkPermissions: NetworkAction[];\n /**\n * Site actions on the request's site, plus `schema.create` when a role on the site grants it for the\n * site's own definitions (`networkPermissions` lists it when shared definitions may be created too).\n */\n sitePermissions: Array<SiteAction | 'schema.create'>;\n /** `networkPermissions` and `sitePermissions` together. */\n globalPermissions: GlobalAction[];\n /** Content actions per model ID on the request's site (models without any action are left out). */\n modelPermissions: Record<string, ContentAction[]>;\n /** How the server sends email: `console` writes it to the server log (no real delivery is set up). */\n emailDelivery: EmailDelivery;\n csrfToken: string;\n};\n\nexport type EmailDelivery = 'console' | 'smtp';\n\nexport type SetupStatusResponse = {\n /** No admin exists yet. */\n required: boolean;\n /** SETUP_REQUIRE_TOKEN is set: setup also needs the one-time token from the server log. */\n requiresToken: boolean;\n};\n\n/** `token` is needed only when the server requires it (`requiresToken`); otherwise it is ignored. */\nexport type SetupInput = { token?: string; email: string; name: string; password: string };\n\nexport type LoginInput = { email: string; password: string };\n\nexport type CsrfResponse = { csrfToken: string };\n\nexport type UpdateProfileInput = { name: string };\n\nexport type ChangePasswordInput = { currentPassword: string; newPassword: string };\n\nexport type PasswordResetRequestInput = { email: string };\n\nexport type PasswordResetConfirmInput = { token: string; password: string };\n\nexport type AcceptInvitationInput = { token: string; name: string; password: string };\n\nexport type InspectInvitationResponse = { email: string; expiresAt: string };\n\nexport type AdminSession = {\n id: string;\n current: boolean;\n ip: string | null;\n userAgent: string | null;\n createdAt: string;\n lastSeenAt: string;\n expiresAt: string;\n};\n\nexport type Invitation = {\n id: string;\n email: string;\n /** The role assignments the invitee gets on accepting. */\n assignments: RoleAssignment[];\n /** Deprecated: the distinct roles of `assignments`. */\n roleIds: string[];\n invitedBy: string | null;\n expiresAt: string;\n createdAt: string;\n};\n\n/** A fresh accept link, shown once; issuing it makes earlier links (emailed or copied) stop working. */\nexport type InvitationLink = { acceptUrl: string; expiresAt: string };\n\n/**\n * Either `assignments` or (deprecated) `roleIds`, meaning those roles on every site; never both. Updating\n * either replaces every assignment.\n */\ntype AssignmentsInput =\n { assignments: RoleAssignment[]; roleIds?: never } | { roleIds: string[]; assignments?: never };\n\nexport type InviteUserInput = { email: string } & AssignmentsInput;\n\nexport type UpdateAdminUserInput = { name?: string; status?: AdminUserStatus } & (\n AssignmentsInput | { assignments?: never; roleIds?: never }\n);\n\nexport type RoleKind = 'admin' | 'delivery';\n\nexport type RoleCondition = 'ownedByPrincipal';\n\nexport type RolePermission = {\n action: PermissionAction;\n /** `null` grants the action on every model (and is required for global actions). */\n modelId: string | null;\n condition: RoleCondition | null;\n /** `null` = every field; otherwise only these stable field IDs. */\n fieldIds: string[] | null;\n};\n\nexport type Role = {\n id: string;\n key: string;\n name: string;\n description: string;\n kind: RoleKind;\n isSystem: boolean;\n /** Optimistic-concurrency version: send it back as `expectedVersion` on update. */\n version: number;\n permissions: RolePermission[];\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CreateRoleInput = {\n key: string;\n name: string;\n description?: string;\n kind?: RoleKind;\n permissions: RolePermission[];\n};\n\nexport type UpdateRoleInput = {\n expectedVersion: number;\n name?: string;\n description?: string;\n permissions?: RolePermission[];\n};\n\nexport type ApiToken = {\n id: string;\n name: string;\n /** First characters of the token (`shp_` + 6), for telling tokens apart. */\n tokenPrefix: string;\n roleId: string;\n scope: RoleKind;\n /** The token's site; null for a network admin token (its role applies on every site). */\n siteId: string | null;\n createdBy: string | null;\n expiresAt: string | null;\n lastUsedAt: string | null;\n revokedAt: string | null;\n createdAt: string;\n};\n\nexport type CreateApiTokenInput = {\n name: string;\n roleId: string;\n expiresAt?: string | null;\n /**\n * A network admin token (every site and network actions; needs `users.manage`). Omitted: a network token\n * when the creator may create one, else a token of the request's site. Delivery tokens are always per site.\n */\n network?: boolean;\n};\n\n/** `token` is the plain secret, returned once at creation and never again. */\nexport type CreatedApiToken = { token: string; apiToken: ApiToken };\n\nexport type AuditActorType = 'admin' | 'app_user' | 'token' | 'anonymous' | 'system';\n\nexport type AuditEvent = {\n id: string;\n occurredAt: string;\n actorType: AuditActorType;\n actorId: string | null;\n /** The acting admin's (or app user's) display name, when the actor is a known account. */\n actorName: string | null;\n actorEmail: string | null;\n action: string;\n targetType: string | null;\n targetId: string | null;\n outcome: 'success' | 'failure';\n requestId: string | null;\n ip: string | null;\n metadata: unknown;\n};\n\n/** Newest first, cursor-paginated. */\nexport type AuditQuery = {\n cursor?: string;\n limit?: number;\n actorType?: AuditActorType;\n actorId?: string;\n action?: string;\n actionPrefix?: string;\n targetType?: string;\n targetId?: string;\n outcome?: 'success' | 'failure';\n from?: string;\n to?: string;\n};\n\nexport type AuditPage = { items: AuditEvent[]; nextCursor: string | null };\n","/**\n * Publishing types (package H, `apps/api/src/routes/admin/{jobs,publishing,webhooks,deployments,preview}`).\n * Dates are ISO-8601 strings.\n */\nimport type { SiteRef } from './sitesTypes.js';\n\nexport type Page<T> = { items: T[]; nextCursor: string | null };\n\n// Jobs ---------------------------------------------------------------------------------------------\n\nexport const JOB_STATUSES = ['pending', 'running', 'succeeded', 'dead'] as const;\nexport type JobStatus = (typeof JOB_STATUSES)[number];\n\nexport type Job = {\n id: string;\n type: string;\n status: JobStatus;\n attempts: number;\n maxAttempts: number;\n /** When it runs next (pending) or ran last. */\n runAt: string;\n idempotencyKey: string | null;\n lockedBy: string | null;\n lockedUntil: string | null;\n /** Payload and result with secret-looking values replaced by `[redacted]`. */\n payload: unknown;\n result: unknown;\n /** Progress a long job saved (e.g. an import's phase and counts); null when it saved none. */\n progress: unknown;\n lastError: string | null;\n createdAt: string;\n updatedAt: string;\n finishedAt: string | null;\n};\n\nexport type JobQuery = { status?: JobStatus; type?: string; cursor?: string; limit?: number };\n\nexport type JobSummary = { counts: Record<JobStatus, number>; types: string[] };\n\n// Scheduled publications ---------------------------------------------------------------------------\n\nexport const PUBLICATION_ACTIONS = ['publish', 'unpublish'] as const;\nexport type PublicationAction = (typeof PUBLICATION_ACTIONS)[number];\n\nexport const SCHEDULE_STATUSES = ['scheduled', 'done', 'failed', 'cancelled'] as const;\nexport type ScheduleStatus = (typeof SCHEDULE_STATUSES)[number];\n\nexport type ScheduledPublication = {\n id: string;\n entryId: string;\n modelId: string;\n /** Null when the model no longer exists. */\n modelKey: string | null;\n locale: string;\n action: PublicationAction;\n runAt: string;\n status: ScheduleStatus;\n error: string | null;\n /** Publication sequence the change was published at (once done). */\n snapshot: number | null;\n createdBy: string | null;\n createdAt: string;\n executedAt: string | null;\n};\n\nexport type ScheduleQuery = { status?: ScheduleStatus; entryId?: string; cursor?: string; limit?: number };\n\nexport type CreateScheduleInput = {\n modelKey: string;\n entryId: string;\n /** Omit for non-localized models (and for the default locale). */\n locale?: string;\n action: PublicationAction;\n runAt: string;\n};\n\n// Webhooks -----------------------------------------------------------------------------------------\n\nexport type WebhookEventType = { type: string; group: string };\n\nexport type WebhookDeliveryStatus = 'pending' | 'retrying' | 'succeeded' | 'dead';\n\nexport type Webhook = {\n id: string;\n name: string;\n url: string;\n /** Event types or `group.*` patterns. */\n events: string[];\n enabled: boolean;\n allowPrivateNetwork: boolean;\n maxAttempts: number;\n /** The site whose events it receives; null for a network-wide webhook (every site's events). */\n site: SiteRef | null;\n lastDelivery: { status: WebhookDeliveryStatus; at: string } | null;\n createdBy: string | null;\n createdAt: string;\n updatedAt: string;\n version: number;\n};\n\nexport type CreateWebhookInput = {\n name: string;\n url: string;\n events: string[];\n enabled?: boolean;\n allowPrivateNetwork?: boolean;\n maxAttempts?: number;\n /** A network-wide webhook (every site's events); otherwise it belongs to the request's site. */\n network?: boolean;\n};\n\n/** A webhook's site is fixed once created. */\nexport type UpdateWebhookInput = Partial<Omit<CreateWebhookInput, 'network'>> & { expectedVersion: number };\n\n/** The JSON body every webhook delivery sends (signed; verify it with `verifyWebhookSignature`). */\nexport type WebhookEventBody = {\n id: string;\n type: string;\n createdAt: string;\n /** The site the event is about; null for events about no site (network-wide). */\n site: SiteRef | null;\n data: unknown;\n};\n\n/** `secret` is shown once: on creation and after rotation. */\nexport type WebhookWithSecret = { webhook: Webhook; secret: string };\n\nexport type WebhookAttempt = {\n attempt: number;\n at: string;\n durationMs: number;\n request: { method: string; url: string; headers: Record<string, string> };\n /** Null when no response arrived (refused, timeout, blocked by the network policy). */\n response: { status: number; headers: Record<string, string>; body: string; truncated: boolean } | null;\n error: string | null;\n};\n\nexport type WebhookDelivery = {\n id: string;\n webhookId: string;\n eventId: string | null;\n eventType: string;\n isTest: boolean;\n status: WebhookDeliveryStatus;\n attempts: number;\n lastResponseStatus: number | null;\n lastError: string | null;\n payload: unknown;\n attemptLog: WebhookAttempt[];\n createdAt: string;\n updatedAt: string;\n deliveredAt: string | null;\n};\n\n// Deployments --------------------------------------------------------------------------------------\n\nexport const DEPLOYMENT_PROVIDERS = [\n 'generic_webhook',\n 'cloudflare_pages',\n 'vercel',\n 'netlify',\n 'github',\n] as const;\nexport type DeploymentProvider = (typeof DEPLOYMENT_PROVIDERS)[number];\n\nexport const DEPLOYMENT_TRIGGERS = ['publish', 'change_set', 'schema', 'manual'] as const;\nexport type DeploymentTriggerPolicy = (typeof DEPLOYMENT_TRIGGERS)[number];\n\nexport const DEPLOYMENT_RUN_STATUSES = [\n 'queued',\n 'triggered',\n 'building',\n 'deployed',\n 'failed',\n 'unknown',\n] as const;\nexport type DeploymentRunStatus = (typeof DEPLOYMENT_RUN_STATUSES)[number];\n\nexport type DeploymentRunTrigger = 'publish' | 'change_set' | 'schema' | 'manual' | 'retry';\n\n/**\n * Provider settings (not secret). Generic: `{ url }`. Cloudflare Pages: `{ accountId, projectName }`.\n * GitHub: `{ owner, repo, branch, mode: 'commit' | 'pull_request', directory }`.\n */\nexport type DeploymentSettings = Record<string, string>;\n\n/**\n * Secret names per provider. Generic: `signingSecret` (generated when omitted). Cloudflare Pages:\n * `deployHookUrl`, `apiToken`. GitHub: `token`. Values are write-only. A value of `${ENV:VAR_NAME}`\n * makes the server read the secret from that environment variable instead of storing it.\n */\nexport type DeploymentSecretsInput = Record<string, string>;\n\n/** Which secrets are set; values never leave the server. `envVar`: read from this environment variable. */\nexport type DeploymentSecretState = Record<string, { set: boolean; envVar: string | null }>;\n\nexport type DeploymentTimelineEvent = {\n status: DeploymentRunStatus;\n at: string;\n source: 'shapio' | 'callback' | 'provider';\n message: string | null;\n};\n\nexport type DeploymentRun = {\n id: string;\n connectionId: string;\n connectionName: string;\n provider: DeploymentProvider;\n status: DeploymentRunStatus;\n trigger: DeploymentRunTrigger;\n /** Publication sequence the run was triggered at (`?snapshot=` on delivery). */\n snapshot: number | null;\n schemaVersion: number | null;\n retryOf: string | null;\n providerRef: string | null;\n logUrl: string | null;\n siteUrl: string | null;\n error: string | null;\n /** False for providers that cannot report completion without callbacks (shown as \"completion unknown\"). */\n completionReported: boolean;\n timeline: DeploymentTimelineEvent[];\n triggeredAt: string | null;\n finishedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type DeploymentConnection = {\n id: string;\n name: string;\n provider: DeploymentProvider;\n settings: DeploymentSettings;\n secrets: DeploymentSecretState;\n previewUrlTemplate: string | null;\n /** Preview tokens issued for this connection show exactly what this delivery role reads. */\n deliveryRoleId: string | null;\n triggerPolicy: DeploymentTriggerPolicy[];\n debounceSeconds: number;\n allowPrivateNetwork: boolean;\n enabled: boolean;\n /** Where the site posts signed build callbacks (generic webhook connections). */\n callbackUrl: string;\n latestRun: DeploymentRun | null;\n /** The newest deployed run by snapshot: what the site is serving, as far as Shapio knows. */\n currentRun: DeploymentRun | null;\n createdBy: string | null;\n createdAt: string;\n updatedAt: string;\n version: number;\n};\n\nexport type CreateDeploymentConnectionInput = {\n name: string;\n provider: DeploymentProvider;\n settings: DeploymentSettings;\n secrets: DeploymentSecretsInput;\n previewUrlTemplate?: string | null;\n triggerPolicy: DeploymentTriggerPolicy[];\n debounceSeconds?: number;\n allowPrivateNetwork?: boolean;\n enabled?: boolean;\n deliveryRoleId?: string | null;\n};\n\nexport type UpdateDeploymentConnectionInput = Partial<Omit<CreateDeploymentConnectionInput, 'provider'>> & {\n expectedVersion: number;\n};\n\n/** `generatedSecrets` holds secrets Shapio generated (the generic signing secret), shown once. */\nexport type DeploymentConnectionCreated = {\n connection: DeploymentConnection;\n generatedSecrets: Record<string, string>;\n};\n\nexport type ConnectionTestResult = {\n ok: boolean;\n checks: Array<{ name: string; ok: boolean; message: string }>;\n};\n\nexport type DeploymentRunQuery = { connectionId?: string; cursor?: string; limit?: number };\n\n// Preview ------------------------------------------------------------------------------------------\n\nexport type PreviewToken = {\n id: string;\n tokenPrefix: string;\n modelId: string;\n modelKey: string | null;\n entryId: string | null;\n locale: string | null;\n connectionId: string | null;\n /** Fields follow this delivery role (within the creator's access); null = the public fields. */\n deliveryRoleId: string | null;\n createdBy: string;\n expiresAt: string;\n revokedAt: string | null;\n lastUsedAt: string | null;\n createdAt: string;\n};\n\nexport type CreatePreviewTokenInput = {\n modelKey: string;\n entryId?: string;\n locale?: string;\n /** Default 1 hour, at most 30 days. */\n ttlSeconds?: number;\n connectionId?: string;\n /** Defaults to the connection's delivery role. */\n deliveryRoleId?: string;\n};\n\n/** `token` is shown once. `url` is rendered from the connection's preview URL template (null without one). */\nexport type PreviewTokenCreated = { token: string; previewToken: PreviewToken; url: string | null };\n\nexport type OpenPreviewInput = {\n modelKey: string;\n entryId: string;\n locale?: string;\n /** Defaults to the first enabled connection with a preview URL template. */\n connectionId?: string;\n};\n\n/** What the entry form's Preview button opens. `apiUrl` is the preview read endpoint for this entry. */\nexport type OpenPreviewResult = {\n /** The token's ID (revoke it when the preview closes). */\n id: string;\n url: string | null;\n apiUrl: string;\n token: string;\n expiresAt: string;\n connectionId: string | null;\n};\n\n/** A connection the site's previews open on (names and origins only). */\nexport type PreviewTarget = {\n connectionId: string;\n name: string;\n /** null when the preview URL template's origin depends on a variable. */\n origin: string | null;\n /** Whether the admin can show it in its preview frame. */\n framable: boolean;\n};\n","/**\n * App users and app roles as administrators manage them (package I), mirroring the TypeBox route schemas in\n * apps/api/src/routes/admin/{appUsers,appRoles}. JSON is camelCase; timestamps are ISO-8601.\n */\nimport type { RoleCondition } from './types.js';\n\nexport type AdminAppUser = {\n id: string;\n email: string;\n name: string;\n confirmed: boolean;\n blocked: boolean;\n /** False for accounts that only sign in with an OAuth provider. */\n hasPassword: boolean;\n /** OAuth providers linked to the account (`google`, `github`). */\n providers: string[];\n /** Custom app roles; `authenticated` applies to every app user implicitly. */\n roleIds: string[];\n lastLoginAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\n/** Newest first, cursor-paginated; `search` matches email or name. */\nexport type AppUserQuery = { search?: string; cursor?: string; limit?: number };\n\nexport type AppUserPage = { items: AdminAppUser[]; nextCursor: string | null };\n\nexport type UpdateAppUserInput = { blocked?: boolean; roleIds?: string[] };\n\n/** What app roles may grant: content actions only. */\nexport const APP_CONTENT_ACTIONS = ['read', 'create', 'update', 'delete', 'publish'] as const;\nexport type AppContentAction = (typeof APP_CONTENT_ACTIONS)[number];\n\n/** Built-in app role keys: `public` applies to anonymous callers, `authenticated` to every app user. */\nexport const BUILT_IN_APP_ROLE_KEYS = ['public', 'authenticated'] as const;\n\nexport type AppRolePermission = {\n action: AppContentAction;\n /** `null` grants the action on every model, including ones created later. */\n modelId: string | null;\n condition: RoleCondition | null;\n /** `null` = every public field; otherwise exactly these stable field IDs (non-public ones included). */\n fieldIds: string[] | null;\n};\n\nexport type AppRole = {\n id: string;\n key: string;\n name: string;\n description: string;\n isSystem: boolean;\n version: number;\n permissions: AppRolePermission[];\n userCount: number;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CreateAppRoleInput = {\n key: string;\n name: string;\n description?: string;\n permissions: AppRolePermission[];\n};\n\n/** Built-in roles accept `permissions` only. */\nexport type UpdateAppRoleInput = {\n expectedVersion: number;\n name?: string;\n description?: string;\n permissions?: AppRolePermission[];\n};\n","import type { SchemaDefinition } from '@shapio/schema';\nimport type { DeploymentRunStatus, Page, PublicationAction } from './publishingTypes.js';\nimport type { ChangePlan, DefinitionCategory, DefinitionPayload, PlanImpact } from './schemaTypes.js';\nimport type { SiteRef } from './sitesTypes.js';\n\n/**\n * Change sets and snapshots (developer-face plan §5), mirroring the TypeBox route schemas in\n * apps/api/src/routes/admin/{changeSets,snapshots}/schemas.ts. Dates are ISO-8601 strings.\n */\n\nexport const CHANGE_SET_STATUSES = [\n 'open',\n 'scheduled',\n 'shipping',\n 'shipped',\n 'failed',\n 'discarded',\n] as const;\nexport type ChangeSetStatus = (typeof CHANGE_SET_STATUSES)[number];\n/** While `shipping`: preparing (prerequisite dry runs, index builds) or activating (the final transaction). */\nexport type ShipPhase = 'preparing' | 'activating';\nexport type ChangeSetSource = 'manual' | 'release' | 'restore' | 'builder' | 'assist';\nexport type ChangeSetItemStatus = 'pending' | 'done' | 'failed';\nexport type SchemaOperation = 'create' | 'update' | 'delete';\n\nexport type ChangeSetActor = { type: 'admin' | 'token' | 'system'; id: string | null; name: string | null };\n\n/** Why a ship failed, and the item that stopped it (null when not tied to one item). */\nexport type ChangeSetError = { code: string; message: string; itemId: string | null; details?: unknown };\n\nexport type ChangeSetEntryItem = {\n id: string;\n kind: 'entry';\n position: number;\n entryId: string;\n modelId: string;\n modelKey: string | null;\n title: string | null;\n locale: string;\n action: PublicationAction;\n /** Restore items publish this exact revision instead of the current draft. */\n sourceRevisionId: string | null;\n status: ChangeSetItemStatus;\n error: string | null;\n};\n\nexport type ChangeSetSchemaItem = {\n id: string;\n kind: 'schema';\n position: number;\n draftId: string;\n definitionId: string;\n category: DefinitionCategory;\n apiKey: string;\n operation: SchemaOperation;\n /** The active version the draft was based on; null for a new definition. */\n baseVersion: number | null;\n draftVersion: number;\n status: ChangeSetItemStatus;\n error: string | null;\n};\n\nexport type ChangeSetItem = ChangeSetEntryItem | ChangeSetSchemaItem;\n\nexport type ChangeSetSummary = {\n id: string;\n title: string;\n description: string;\n status: ChangeSetStatus;\n shipPhase: ShipPhase | null;\n source: ChangeSetSource;\n restoreOfSnapshot: number | null;\n scheduledFor: string | null;\n /** Connection whose deploy is triggered (pinned to the shipped snapshot) after the set ships. */\n deploymentConnectionId: string | null;\n deploymentRunId: string | null;\n shippedAt: string | null;\n /** The publication snapshot the set went live in. */\n shippedSnapshot: number | null;\n schemaVersionAfter: number | null;\n error: ChangeSetError | null;\n entryItemCount: number;\n schemaItemCount: number;\n createdBy: ChangeSetActor;\n createdAt: string;\n updatedAt: string;\n version: number;\n};\n\nexport type ChangeSet = ChangeSetSummary & { items: ChangeSetItem[] };\n\nexport type ChangeSetQuery = {\n /** Comma-separated statuses; default: everything except `discarded`. */\n status?: string;\n cursor?: string;\n limit?: number;\n};\n\nexport type CreateChangeSetInput = {\n title: string;\n description?: string;\n /** `builder`: a one-item set the model builder ships at once (\"Review & ship now\"). Default `manual`. */\n source?: 'manual' | 'builder';\n};\nexport type UpdateChangeSetInput = {\n title?: string;\n description?: string;\n deploymentConnectionId?: string | null;\n expectedVersion: number;\n};\nexport type AddChangeSetEntryInput = {\n modelKey: string;\n entryId: string;\n /** Omit for non-localized models (and for the default locale). */\n locale?: string;\n action: PublicationAction;\n};\n\nexport type SchemaDraft = {\n id: string;\n changeSetId: string;\n definitionId: string;\n category: DefinitionCategory;\n operation: SchemaOperation;\n baseVersion: number | null;\n /** Null when the draft deletes the definition. */\n definition: SchemaDefinition | null;\n /** A new definition the draft creates shared with all sites (otherwise it belongs to the set's site). */\n shared: boolean;\n version: number;\n updatedBy: ChangeSetActor;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type PutSchemaDraftInput = {\n category: DefinitionCategory;\n /** The whole proposed definition, or null to delete the definition when the set ships. */\n definition: DefinitionPayload | null;\n /** The active version the edit is based on (null: a new definition). */\n baseVersion: number | null;\n /** For a new definition: create it shared with all sites (default false: the set's site). */\n shared?: boolean;\n /** The draft row version the caller saw; omit when creating the draft. */\n expectedDraftVersion?: number;\n};\n\nexport type FieldDiff = { fieldId: string; apiKey: string; label: string; before: unknown; after: unknown };\nexport type ReviewIssue = { path: string; code: string; message: string };\n\nexport type ReviewEntryItem = {\n itemId: string;\n entryId: string;\n modelId: string;\n modelKey: string | null;\n title: string | null;\n locale: string;\n action: PublicationAction;\n sourceRevisionId: string | null;\n /** Send back in `ship.itemVersions` (strict ship). Null when the item does not publish the draft. */\n draftVersion: number | null;\n liveState: 'unpublished' | 'published' | 'modified' | 'missing';\n fields: FieldDiff[];\n issues: ReviewIssue[];\n};\n\nexport type ReviewSchemaItem = {\n itemId: string;\n draftId: string;\n definitionId: string;\n category: DefinitionCategory;\n apiKey: string;\n operation: SchemaOperation;\n baseVersion: number | null;\n activeVersion: number | null;\n /** The active version moved since the draft was based on it: shipping refuses until it is rebased. */\n stale: boolean;\n plan: ChangePlan | null;\n impact: PlanImpact | null;\n /** Entries of the affected models per site (a shared definition converts every site's content). */\n affectedEntriesBySite: Array<{ site: SiteRef; entries: number }>;\n issues: ReviewIssue[];\n alsoChangedIn: Array<{ id: string; title: string }>;\n};\n\nexport const NOT_RESTORABLE_REASONS = [\n 'entry_deleted',\n 'model_missing',\n 'publishing_disabled',\n 'localization_changed',\n 'locale_missing',\n 'invalid',\n 'unique_conflict',\n] as const;\nexport type NotRestorableReason = (typeof NOT_RESTORABLE_REASONS)[number];\n\nexport type NotRestorable = {\n entryId: string;\n modelId: string;\n modelKey: string | null;\n locale: string;\n reason: NotRestorableReason;\n detail: string;\n};\n\nexport type FieldConsumer = {\n /** The site the reads were made on. */\n site: SiteRef;\n /** `token:<id>`, `app_users` or `anonymous`. */\n principalKey: string;\n label: string | null;\n reads: number;\n lastReadAt: string | null;\n /** `implicit`: the reader requested the whole model (no field selection). */\n selection: 'explicit' | 'implicit';\n};\n\nexport type FieldConsumers = {\n modelId: string;\n fieldId: string;\n apiKey: string;\n consumers: FieldConsumer[];\n /**\n * Readers on other sites, as totals, when the viewer holds no role on every site; null when the viewer\n * sees every site's readers in `consumers`.\n */\n otherSites: { consumers: number; reads: number } | null;\n};\n\nexport type ChangeSetReview = {\n changeSet: ChangeSet;\n entries: ReviewEntryItem[];\n schema: ReviewSchemaItem[];\n notRestorable: NotRestorable[];\n consumers: FieldConsumers[];\n usageDays: number;\n checks: { breaking: boolean; destructive: boolean; blocking: ReviewIssue[]; warnings: ReviewIssue[] };\n /** Fixed notices, e.g. `NEW_FIELDS_AFTER_SHIP`. */\n notices: string[];\n};\n\nexport type ShipChangeSetInput = {\n expectedVersion: number;\n acknowledgeBreaking?: boolean;\n acknowledgeDestructive?: boolean;\n /** Draft versions the review showed; a moved draft makes the ship refuse with 409 CHANGE_SET_STALE. */\n itemVersions?: Array<{ itemId: string; draftVersion: number }>;\n};\n\nexport type ScheduleChangeSetInput = {\n at: string;\n expectedVersion: number;\n acknowledgeBreaking?: boolean;\n acknowledgeDestructive?: boolean;\n};\n\nexport type ChangeSetTimelineEvent = {\n at: string;\n kind: string;\n actor: ChangeSetActor | null;\n message: string | null;\n snapshot: number | null;\n deploymentRunId: string | null;\n /** `item.changedAfterReview`: the entry whose draft moved between review and a scheduled ship. */\n item: { entryId: string; locale: string; fromVersion: number; toVersion: number } | null;\n};\n\nexport type UnassignedEntry = {\n entryId: string;\n modelId: string;\n modelKey: string | null;\n title: string | null;\n locale: string;\n status: 'draft' | 'modified';\n updatedAt: string;\n};\n\n// Snapshots ----------------------------------------------------------------------------------------\n\nexport const SNAPSHOT_SOURCES = [\n 'publish',\n 'unpublish',\n 'delete',\n 'schedule',\n 'change_set',\n 'schema',\n 'conversion',\n 'import',\n 'legacy',\n] as const;\nexport type SnapshotSource = (typeof SNAPSHOT_SOURCES)[number];\n\nexport type Snapshot = {\n seq: number;\n schemaVersion: number | null;\n source: SnapshotSource;\n changeSetId: string | null;\n changeSetTitle: string | null;\n actor: { type: string; id: string | null };\n changedEntries: number;\n deploymentRuns: Array<{ id: string; connectionId: string; status: DeploymentRunStatus }>;\n createdAt: string;\n};\n\nexport type SnapshotPage = Page<Snapshot> & { current: number };\nexport type SnapshotQuery = { cursor?: string; limit?: number };\n","/**\n * Shapes of the entry document's endpoints (editor experience, E0b): publish pre-flight, content health\n * findings, presence and per-model counts. Sentences are never sent: the admin builds them from `rule` and\n * `params` with its translations.\n */\n\n/** Health rules evaluated per entry (`apps/api/src/services/contentHealth.ts`). */\nexport const HEALTH_RULES = [\n 'requiredEmpty',\n 'altMissing',\n 'localeMissing',\n 'relationMissing',\n 'relationUnpublished',\n 'uniqueConflict',\n 'staleDraft',\n 'unpublishedChanges',\n] as const;\nexport type HealthRule = (typeof HEALTH_RULES)[number];\n\n/** Pre-flight adds the publish checks that are not health rules: validator issues and missing media. */\nexport type PreflightRule = HealthRule | 'invalid' | 'mediaMissing';\n\nexport type CheckSeverity = 'error' | 'warning';\n\n/** Values a sentence needs (field ID, asset ID, locale, counts…). */\nexport type CheckParams = Record<string, string | number | null>;\n\nexport type PreflightCheck = {\n rule: PreflightRule;\n /** Errors block publishing; warnings are informational. */\n severity: CheckSeverity;\n /** JSON pointer (API keys) of the value to fix, e.g. `/body` or `/sections/2/title`. */\n path?: string;\n /** The validator's issue code, for `invalid` and `requiredEmpty` errors. */\n code?: string;\n params: CheckParams;\n};\n\nexport type PreflightLocale = {\n locale: string;\n /** No error-severity check: publishing this locale is expected to succeed. */\n ready: boolean;\n checks: PreflightCheck[];\n};\n\nexport type PreflightInput = { locales?: string[] };\n\nexport type PreflightResponse = {\n locales: PreflightLocale[];\n /** Checks about the entry as a whole, not one locale (e.g. a configured locale not started yet). */\n entry: PreflightCheck[];\n};\n\n/** A finding of the health engine, open until its rule passes again. */\nexport type ContentHealthFinding = {\n id: string;\n entryId: string;\n modelId: string;\n modelKey: string;\n /** The entry's title in the finding's locale (or the default locale), when readable. */\n entryTitle: string | null;\n /** `*` for a finding about the entry as a whole. */\n locale: string;\n rule: HealthRule;\n /** Distinguishes several findings of one rule on one entry (e.g. two images without alt text). */\n subject: string;\n severity: CheckSeverity;\n path?: string;\n params: CheckParams;\n firstSeenAt: string;\n lastSeenAt: string;\n};\n\nexport type ContentHealthQuery = { rule?: HealthRule; modelKey?: string; cursor?: string; limit?: number };\n\nexport type ContentHealthPage = { items: ContentHealthFinding[]; nextCursor: string | null };\n\nexport type ContentHealthSummary = { rules: { rule: HealthRule; count: number }[] };\n\n/** Someone with the entry open. */\nexport type PresencePerson = {\n userId: string;\n name: string;\n /** The locale they are editing, when the model is localized. */\n locale: string | null;\n /** When this tab started editing. */\n since: string;\n /** The caller's own other tab (the calling tab itself is never listed). */\n you: boolean;\n};\n\nexport type PresenceHeartbeatInput = {\n /** A random ID per browser tab, so two tabs of one person are counted apart. */\n tabId: string;\n locale?: string | null;\n};\n\nexport type EntryPresence = { people: PresencePerson[] };\n\nexport type ModelPresence = { entries: { entryId: string; people: PresencePerson[] }[] };\n\nexport type ContentCount = { modelId: string; modelKey: string; total: number };\n\nexport type ContentCounts = { counts: ContentCount[] };\n","import type { SchemaDefinition } from '@shapio/schema';\n\n/** Editor assists (plan agentic-ecosystem §A0). Agents propose, people ship: nothing here publishes. */\nexport type AssistProvider = 'anthropic' | 'openai' | 'openai-compatible';\n\nexport type AssistUsage = { month: string; runs: number; inputTokens: number; outputTokens: number };\n\n/** `usage` only for admins with `changes.manage`; provider and model only while assist is on. */\nexport type AssistStatus = {\n enabled: boolean;\n provider?: AssistProvider;\n model?: string;\n usage?: AssistUsage;\n};\n\nexport type AltTextInput = { assetId: string; locale?: string };\nexport type AltTextResult = { alt: string; model: string };\n\n/** A model-written text; `truncated` when it was cut to the field's or the request's limit. */\nexport type AssistTextResult = { text: string; truncated: boolean; model: string };\n\nexport type SummarizeInput = { modelKey: string; entryId: string; locale?: string; fieldApiKey: string };\n\nexport type TranslateInput = { modelKey: string; entryId: string; from: string; to: string };\nexport type AssistIssue = { path: string; code: string; message: string };\n/** `data` is in the editor's save format: save it as the `to` locale's draft. */\nexport type TranslateResult = { data: Record<string, unknown>; issues: AssistIssue[]; model: string };\n\nexport type RewriteInput = { text: string; instruction: string; maxLength?: number };\n\nexport type SchemaDraftInput = { description: string };\n/** New definitions with new stable IDs, in save order (references first). Nothing is written. */\nexport type SchemaDraftResult = { definitions: SchemaDefinition[]; model: string };\n\nexport const CONTENT_OPS_RULES = ['altMissing', 'localeMissing'] as const;\nexport type ContentOpsRule = (typeof CONTENT_OPS_RULES)[number];\nexport type ContentOpsInput = { rule: ContentOpsRule; modelKey?: string; fromLocale?: string };\nexport type ContentOpsStatus = 'queued' | 'running' | 'succeeded' | 'failed';\n\n/** One library asset's proposed alt text; apply it with the media update at `assetVersion`. */\nexport type AltProposal = {\n assetId: string;\n filename: string;\n currentAlt: string | null;\n proposedAlt: string;\n assetVersion: number;\n findingCount: number;\n};\n\n/** A finding the run left alone, and why (an error code or a reason such as `publishesOnSave`). */\nexport type ContentOpsSkip = {\n key: string;\n entryId?: string;\n assetId?: string;\n locale?: string;\n reason: string;\n detail?: unknown;\n};\nexport type ContentOpsWritten = { entryId: string; modelKey: string; locale: string; version: number };\n\nexport type AltMissingResult = { rule: 'altMissing'; proposals: AltProposal[]; skipped: ContentOpsSkip[] };\n/** The drafts were written into the change set `changeSetId` (null when nothing was written). */\nexport type LocaleMissingResult = {\n rule: 'localeMissing';\n changeSetId: string | null;\n fromLocale: string;\n written: ContentOpsWritten[];\n skipped: ContentOpsSkip[];\n};\nexport type ContentOpsResult = AltMissingResult | LocaleMissingResult;\n\nexport type ContentOpsRun = {\n runId: string;\n rule: ContentOpsRule;\n status: ContentOpsStatus;\n model: string;\n createdAt: string;\n finishedAt: string | null;\n error: { code: string } | null;\n /** Once succeeded (null before, or partial progress while running). */\n result: ContentOpsResult | null;\n};\n","import type { RequestFn } from '../request.js';\nimport { createAppUsersApi } from './appUsers.js';\nimport { createAssistApi } from './assist.js';\nimport { createChangeSetsApi } from './changeSets.js';\nimport { createContentApi } from './content.js';\nimport { createEditingApi } from './editing.js';\nimport { createMediaApi } from './media.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport { createPublishingApi } from './publishing.js';\nimport { toQueryString } from './query.js';\nimport { createSchemaApi } from './schema.js';\nimport { createSitesApi } from './sites.js';\nimport type {\n AcceptInvitationInput,\n AdminSession,\n AdminUser,\n ApiToken,\n AuditPage,\n AuditQuery,\n ChangePasswordInput,\n CreateApiTokenInput,\n CreatedApiToken,\n CreateRoleInput,\n CsrfResponse,\n InspectInvitationResponse,\n Invitation,\n InvitationLink,\n InviteUserInput,\n LoginInput,\n MeResponse,\n PasswordResetConfirmInput,\n PasswordResetRequestInput,\n Role,\n SessionStarted,\n SetupInput,\n SetupStatusResponse,\n UpdateAdminUserInput,\n UpdateProfileInput,\n UpdateRoleInput,\n} from './types.js';\nimport { createUsageApi } from './usage.js';\n\n/**\n * Admin endpoints: identity (setup, auth, sessions, users, invitations, roles, tokens, audit) and the schema\n * registry (models, components, schema, locales), the media library and content.\n */\nexport const createAdminApi = (request: RequestFn) => ({\n setup: {\n status: () => request<SetupStatusResponse>(ADMIN_PATHS.setup),\n complete: (body: SetupInput) => request<SessionStarted>(ADMIN_PATHS.setup, { method: 'POST', body }),\n },\n auth: {\n csrf: () => request<CsrfResponse>(ADMIN_PATHS.csrf),\n login: (body: LoginInput) => request<SessionStarted>(ADMIN_PATHS.login, { method: 'POST', body }),\n logout: () => request<void>(ADMIN_PATHS.logout, { method: 'POST' }),\n me: () => request<MeResponse>(ADMIN_PATHS.me),\n updateProfile: (body: UpdateProfileInput) =>\n request<AdminUser>(ADMIN_PATHS.me, { method: 'PATCH', body }),\n /** The session is rotated: the response carries the new session's CSRF token. */\n changePassword: (body: ChangePasswordInput) =>\n request<CsrfResponse>(ADMIN_PATHS.password, { method: 'POST', body }),\n requestPasswordReset: (body: PasswordResetRequestInput) =>\n request<void>(ADMIN_PATHS.passwordReset, { method: 'POST', body }),\n confirmPasswordReset: (body: PasswordResetConfirmInput) =>\n request<void>(ADMIN_PATHS.passwordResetConfirm, { method: 'POST', body }),\n },\n sessions: {\n list: () => request<AdminSession[]>(ADMIN_PATHS.sessions),\n revoke: (id: string) => request<void>(withId(ADMIN_PATHS.sessions, id), { method: 'DELETE' }),\n },\n users: {\n list: () => request<AdminUser[]>(ADMIN_PATHS.users),\n get: (id: string) => request<AdminUser>(withId(ADMIN_PATHS.users, id)),\n update: (id: string, body: UpdateAdminUserInput) =>\n request<AdminUser>(withId(ADMIN_PATHS.users, id), { method: 'PATCH', body }),\n remove: (id: string) => request<void>(withId(ADMIN_PATHS.users, id), { method: 'DELETE' }),\n revokeSessions: (id: string) =>\n request<void>(`${withId(ADMIN_PATHS.users, id)}/sessions`, { method: 'DELETE' }),\n },\n invitations: {\n list: () => request<Invitation[]>(ADMIN_PATHS.invitations),\n create: (body: InviteUserInput) => request<Invitation>(ADMIN_PATHS.invitations, { method: 'POST', body }),\n revoke: (id: string) => request<void>(withId(ADMIN_PATHS.invitations, id), { method: 'DELETE' }),\n /** A fresh link to send by hand; any earlier link for this invitation stops working. */\n link: (id: string) =>\n request<InvitationLink>(`${withId(ADMIN_PATHS.invitations, id)}/link`, { method: 'POST' }),\n /** Public: the token travels in the body, never in a URL the server logs. */\n inspect: (token: string) =>\n request<InspectInvitationResponse>(ADMIN_PATHS.inspectInvitation, { method: 'POST', body: { token } }),\n accept: (body: AcceptInvitationInput) =>\n request<SessionStarted>(ADMIN_PATHS.acceptInvitation, { method: 'POST', body }),\n },\n roles: {\n list: () => request<Role[]>(ADMIN_PATHS.roles),\n get: (id: string) => request<Role>(withId(ADMIN_PATHS.roles, id)),\n create: (body: CreateRoleInput) => request<Role>(ADMIN_PATHS.roles, { method: 'POST', body }),\n update: (id: string, body: UpdateRoleInput) =>\n request<Role>(withId(ADMIN_PATHS.roles, id), { method: 'PATCH', body }),\n remove: (id: string) => request<void>(withId(ADMIN_PATHS.roles, id), { method: 'DELETE' }),\n },\n tokens: {\n list: () => request<ApiToken[]>(ADMIN_PATHS.tokens),\n create: (body: CreateApiTokenInput) =>\n request<CreatedApiToken>(ADMIN_PATHS.tokens, { method: 'POST', body }),\n revoke: (id: string) => request<void>(withId(ADMIN_PATHS.tokens, id), { method: 'DELETE' }),\n },\n audit: {\n list: (query: AuditQuery = {}) => request<AuditPage>(`${ADMIN_PATHS.audit}${toQueryString(query)}`),\n },\n ...createSchemaApi(request),\n ...createMediaApi(request),\n ...createContentApi(request),\n ...createEditingApi(request),\n ...createPublishingApi(request),\n ...createAppUsersApi(request),\n ...createChangeSetsApi(request),\n ...createUsageApi(request),\n ...createSitesApi(request),\n ...createAssistApi(request),\n});\n\nexport type AdminApi = ReturnType<typeof createAdminApi>;\nexport { ADMIN_PATHS } from './paths.js';\nexport * from './types.js';\nexport * from './schemaTypes.js';\nexport * from './schemaSyncTypes.js';\nexport * from './mediaTypes.js';\nexport * from './contentTypes.js';\nexport * from './publishingTypes.js';\nexport * from './appUsersTypes.js';\nexport * from './changeSetTypes.js';\nexport * from './usageTypes.js';\nexport * from './sitesTypes.js';\nexport { SITE_HEADER, SITES_PATHS } from './sites.js';\nexport { toContentQueryString } from './contentQuery.js';\nexport { buildUploadForm, resolveUploadUrl } from './media.js';\nexport { HEALTH_RULES } from './editingTypes.js';\nexport { ASSIST_PATHS } from './assist.js';\nexport { CONTENT_OPS_RULES } from './assistTypes.js';\n","import type { RequestFn } from '../request.js';\nimport type {\n AppChangePasswordInput,\n AppLoginInput,\n AppOAuthProvider,\n AppRegisterInput,\n AppRegisterResult,\n AppSession,\n AppUser,\n} from './types.js';\n\nexport const APP_AUTH_PATHS = {\n register: '/api/app-auth/register',\n login: '/api/app-auth/login',\n refresh: '/api/app-auth/refresh',\n logout: '/api/app-auth/logout',\n me: '/api/app-auth/me',\n password: '/api/app-auth/me/password',\n confirmEmail: '/api/app-auth/confirm-email',\n resendConfirmation: '/api/app-auth/confirm-email/resend',\n passwordReset: '/api/app-auth/password-reset',\n passwordResetConfirm: '/api/app-auth/password-reset/confirm',\n providers: '/api/app-auth/providers',\n oauthExchange: '/api/app-auth/oauth/exchange',\n} as const;\n\n/**\n * App-user endpoints. Calls that act as the signed-in user need a client created with `token: accessToken`.\n * `baseUrl` is the client's base URL, used to build the OAuth start link the browser navigates to.\n */\nexport const createAppAuthApi = (request: RequestFn, baseUrl: string) => ({\n register: (body: AppRegisterInput) =>\n request<AppRegisterResult>(APP_AUTH_PATHS.register, { method: 'POST', body }),\n login: (body: AppLoginInput) => request<AppSession>(APP_AUTH_PATHS.login, { method: 'POST', body }),\n refresh: (refreshToken: string) =>\n request<AppSession>(APP_AUTH_PATHS.refresh, { method: 'POST', body: { refreshToken } }),\n /**\n * Signs the account out everywhere: this login's refresh tokens are revoked, and every access token the\n * account holds (on any device) is refused from the next request. Other logins recover with their own\n * refresh token.\n */\n logout: (refreshToken: string) =>\n request<void>(APP_AUTH_PATHS.logout, { method: 'POST', body: { refreshToken } }),\n /** The signed-in user. Answers 401 once the account logged out anywhere, changed its password or was blocked. */\n me: () => request<AppUser>(APP_AUTH_PATHS.me),\n updateMe: (body: { name: string }) => request<AppUser>(APP_AUTH_PATHS.me, { method: 'PATCH', body }),\n /** Returns a new session; every other sign-in of the account is revoked. */\n changePassword: (body: AppChangePasswordInput) =>\n request<AppSession>(APP_AUTH_PATHS.password, { method: 'POST', body }),\n deleteMe: (body: { password?: string } = {}) =>\n request<void>(APP_AUTH_PATHS.me, { method: 'DELETE', body }),\n /** The token from the `#token=` fragment of the confirmation link. */\n confirmEmail: (token: string) =>\n request<void>(APP_AUTH_PATHS.confirmEmail, { method: 'POST', body: { token } }),\n resendConfirmation: (email: string) =>\n request<void>(APP_AUTH_PATHS.resendConfirmation, { method: 'POST', body: { email } }),\n requestPasswordReset: (email: string) =>\n request<void>(APP_AUTH_PATHS.passwordReset, { method: 'POST', body: { email } }),\n confirmPasswordReset: (body: { token: string; password: string }) =>\n request<void>(APP_AUTH_PATHS.passwordResetConfirm, { method: 'POST', body }),\n providers: async () =>\n (await request<{ providers: AppOAuthProvider[] }>(APP_AUTH_PATHS.providers)).providers,\n /**\n * Where to send the browser to sign in with a provider. `codeChallenge` comes from `createPkcePair()`;\n * keep its `codeVerifier` until the browser returns. It comes back to `redirectTo` (an allowed return URL,\n * by default an origin listed in CORS_ORIGINS) with `?code=` (pass it to `exchangeCode`) or `?error=`.\n */\n oauthStartUrl: (provider: AppOAuthProvider, redirectTo: string, codeChallenge: string) =>\n `${baseUrl.replace(/\\/+$/, '')}/api/app-auth/oauth/${provider}/start?redirectTo=${encodeURIComponent(redirectTo)}&codeChallenge=${encodeURIComponent(codeChallenge)}`,\n /** Trades the one-time code for a session. A wrong verifier spends the code: start the sign-in again. */\n exchangeCode: (code: string, codeVerifier: string) =>\n request<AppSession>(APP_AUTH_PATHS.oauthExchange, { method: 'POST', body: { code, codeVerifier } }),\n});\n\nexport type AppAuthApi = ReturnType<typeof createAppAuthApi>;\n","import { toContentQueryString } from './admin/contentQuery.js';\nimport type { DeliveryGetQuery, DeliveryItem, DeliveryList, DeliveryListQuery } from './deliveryTypes.js';\nimport type { RequestFn } from './request.js';\n\nexport const DELIVERY_PATH = '/api/content';\n\nconst routePath = (routeKey: string) => `${DELIVERY_PATH}/${encodeURIComponent(routeKey)}`;\n\n/** The content query string plus `snapshot`, which only delivery reads take. */\nconst deliveryQueryString = ({ snapshot, ...query }: DeliveryListQuery): string => {\n const base = toContentQueryString(query);\n if (snapshot === undefined) {\n return base;\n }\n const pinned = `snapshot=${encodeURIComponent(String(snapshot))}`;\n return base ? `${base}&${pinned}` : `?${pinned}`;\n};\n\n/**\n * Published content, typed by the caller (`delivery.list<Article>('articles', { locale: 'fr', snapshot })`).\n * A collection is read with `list` (a page) and `get` (one entry); a singleton with `singleton`.\n */\nexport const createDeliveryApi = (request: RequestFn) => ({\n list: <T = Record<string, unknown>>(routeKey: string, query: DeliveryListQuery = {}) =>\n request<DeliveryList<T>>(`${routePath(routeKey)}${deliveryQueryString(query)}`),\n singleton: <T = Record<string, unknown>>(apiKey: string, query: DeliveryGetQuery = {}) =>\n request<DeliveryItem<T>>(`${routePath(apiKey)}${deliveryQueryString(query)}`),\n get: <T = Record<string, unknown>>(routeKey: string, id: string, query: DeliveryGetQuery = {}) =>\n request<DeliveryItem<T>>(`${routePath(routeKey)}/${encodeURIComponent(id)}${deliveryQueryString(query)}`),\n});\n\nexport type DeliveryApi = ReturnType<typeof createDeliveryApi>;\n","import { toQueryString } from './admin/query.js';\nimport type { RequestFn } from './request.js';\nimport type {\n CurrentSnapshot,\n SnapshotChange,\n SnapshotChangesPage,\n SnapshotChangesQuery,\n} from './snapshotTypes.js';\n\nexport const SNAPSHOT_PATHS = {\n current: '/api/snapshots/current',\n changes: '/api/snapshots/changes',\n} as const;\n\n/** Snapshots and the diff between two of them, for incremental site builds (delivery credentials). */\nexport const createSnapshotsApi = (request: RequestFn) => {\n const changes = (query: SnapshotChangesQuery) =>\n request<SnapshotChangesPage>(`${SNAPSHOT_PATHS.changes}${toQueryString(query)}`);\n return {\n current: () => request<CurrentSnapshot>(SNAPSHOT_PATHS.current),\n changes,\n /** Every change between `from` and `to`, following `nextCursor` until the last page. */\n allChanges: async (query: Omit<SnapshotChangesQuery, 'after'>) => {\n const items: SnapshotChange[] = [];\n let page = await changes(query);\n items.push(...page.items);\n while (page.nextCursor !== null) {\n page = await changes({ ...query, to: page.to, after: page.nextCursor });\n items.push(...page.items);\n }\n return { from: page.from, to: page.to, schemaVersions: page.schemaVersions, items };\n },\n };\n};\n","import { SITE_HEADER } from './admin/sites.js';\nimport { DELIVERY_PATH } from './delivery.js';\nimport { SNAPSHOT_PATHS } from './snapshots.js';\n\n/** Delivery reads name their site with `?site=`; everything else with the `Shapio-Site` header. */\nexport const SITE_QUERY_PARAMETER = 'site';\n\n/** Delivery reads (content and snapshots): a GET there carries the site in its URL. */\nconst DELIVERY_READ_PREFIXES = [`${DELIVERY_PATH}/`, `${DELIVERY_PATH}?`, '/api/snapshots/'] as const;\n\nconst isDeliveryRead = (method: string, path: string) =>\n method === 'GET' &&\n (path === DELIVERY_PATH ||\n Object.values(SNAPSHOT_PATHS).some((snapshotPath) => path === snapshotPath) ||\n DELIVERY_READ_PREFIXES.some((prefix) => path.startsWith(prefix)));\n\nconst namesSite = (path: string) => {\n const index = path.indexOf('?');\n return index !== -1 && new URLSearchParams(path.slice(index + 1)).has(SITE_QUERY_PARAMETER);\n};\n\n/**\n * Where a request names the client's site (sites plan §H). Delivery GETs put it in the query string: a\n * simple cross-origin GET needs no CORS preflight, and URL-keyed CDN caches keep sites apart. Every other\n * request sends the `Shapio-Site` header. A path that already names a site is left as it is.\n */\nexport const applySite = (\n site: string | undefined,\n method: string,\n path: string,\n): { path: string; headers: Record<string, string> } => {\n if (site === undefined || namesSite(path)) {\n return { path, headers: {} };\n }\n if (isDeliveryRead(method, path)) {\n const parameter = `${SITE_QUERY_PARAMETER}=${encodeURIComponent(site)}`;\n return { path: `${path}${path.includes('?') ? '&' : '?'}${parameter}`, headers: {} };\n }\n return { path, headers: { [SITE_HEADER]: site } };\n};\n","import { ShapioApiError } from './errors.js';\nimport { applySite } from './site.js';\n\n/** Fetch's `credentials` mode (spelled out: the DOM lib type is not available to Node consumers). */\nexport type FetchCredentials = 'omit' | 'same-origin' | 'include';\n\nexport type RequestOptions = { method?: string; body?: unknown; signal?: AbortSignal };\n\nexport type RequestFn = <T>(path: string, options?: RequestOptions) => Promise<T>;\n\nexport type RequestConfig = {\n baseUrl: string;\n token: string | undefined;\n fetch: typeof globalThis.fetch;\n credentials: FetchCredentials | undefined;\n headers: (() => Readonly<Record<string, string>>) | undefined;\n /** The site key every request names (see site.ts); undefined: the credential's site, else the primary. */\n site: string | undefined;\n};\n\nconst parseBody = async (response: Response): Promise<unknown> => {\n const text = await response.text();\n if (text.length === 0) {\n return undefined;\n }\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n};\n\n/** Builds the JSON request function every endpoint group uses. Non-2xx responses throw ShapioApiError. */\nexport const createRequest = ({\n baseUrl,\n token,\n fetch,\n credentials,\n headers,\n site,\n}: RequestConfig): RequestFn => {\n const origin = baseUrl.replace(/\\/+$/, '');\n return async <T>(\n requestPath: string,\n { method = 'GET', body, signal }: RequestOptions = {},\n ): Promise<T> => {\n const { path, headers: siteHeaders } = applySite(site, method, requestPath);\n const requestHeaders: Record<string, string> = {\n accept: 'application/json',\n ...siteHeaders,\n ...headers?.(),\n };\n if (token) {\n requestHeaders.authorization = `Bearer ${token}`;\n }\n if (body !== undefined) {\n requestHeaders['content-type'] = 'application/json';\n }\n const response = await fetch(`${origin}${path}`, {\n method,\n headers: requestHeaders,\n ...(body !== undefined ? { body: JSON.stringify(body) } : {}),\n ...(signal ? { signal } : {}),\n ...(credentials ? { credentials } : {}),\n });\n const parsed = await parseBody(response);\n if (!response.ok) {\n throw new ShapioApiError(response.status, parsed);\n }\n return parsed as T;\n };\n};\n","import { createAdminApi } from './admin/index.js';\nimport { createAppAuthApi } from './appAuth/index.js';\nimport { createDeliveryApi } from './delivery.js';\nimport { createRequest, type FetchCredentials } from './request.js';\nimport { createSnapshotsApi } from './snapshots.js';\nimport type { HealthResponse, ReadyResponse, VersionResponse } from './types.js';\n\nexport type ShapioClientOptions = {\n /** Base URL of the Shapio server including any BASE_PATH, e.g. `https://cms.example.com/cms`. */\n baseUrl: string;\n /** API token sent as a bearer token. */\n token?: string;\n /** Defaults to the global fetch; injectable for tests and custom agents. */\n fetch?: typeof globalThis.fetch;\n /** Fetch credentials mode. The admin uses `same-origin` so its session cookie is sent. */\n credentials?: FetchCredentials;\n /** Extra headers computed per request (the admin's CSRF token). */\n headers?: () => Readonly<Record<string, string>>;\n /**\n * The site key (multi-site instances). Delivery reads send it as `?site=`, every other request as the\n * `Shapio-Site` header. Leave it out to use the token's site, else the primary site. A site token only\n * ever reads its own site: naming another one is refused (403 `SITE_MISMATCH`).\n */\n site?: string;\n};\n\nexport const createClient = ({\n baseUrl,\n token,\n fetch = globalThis.fetch,\n credentials,\n headers,\n site,\n}: ShapioClientOptions) => {\n const request = createRequest({ baseUrl, token, fetch, credentials, headers, site });\n\n return {\n /**\n * Any Shapio route, e.g. the delivery API. Delivery paths use the model's route key: a collection's\n * plural API ID (`request('/api/content/articles')`, `/api/content/articles/<id>`), a singleton's API ID\n * (`/api/content/homepage`). The admin API (`admin.*`) always uses the singular API ID.\n */\n request,\n system: {\n health: (signal?: AbortSignal) => request<HealthResponse>('/api/health', signal ? { signal } : {}),\n ready: (signal?: AbortSignal) => request<ReadyResponse>('/api/ready', signal ? { signal } : {}),\n version: (signal?: AbortSignal) => request<VersionResponse>('/api/version', signal ? { signal } : {}),\n },\n /** Published content (the delivery API), typed by the caller. */\n delivery: createDeliveryApi(request),\n admin: createAdminApi(request),\n /** Publication snapshots and the diff between two (incremental builds). */\n snapshots: createSnapshotsApi(request),\n /** End users of your sites and apps: sign-up, sign-in, tokens, OAuth. */\n appAuth: createAppAuthApi(request, baseUrl),\n };\n};\n\nexport type ShapioClient = ReturnType<typeof createClient>;\n","/**\n * Verifying Shapio's signed webhooks and deploy triggers on the receiving side (a site's revalidate route,\n * a build hook). The scheme is the server's (`apps/api/src/publishing/signature.ts`):\n * `X-Shapio-Signature: v1=<hex HMAC-SHA256(secret, \"<timestamp>.<raw body>\")>` with\n * `X-Shapio-Timestamp: <unix seconds>`; several comma-separated `v1=` values are accepted (secret rotation).\n * Uses Web Crypto, so it runs in Node, edge runtimes and browsers alike.\n */\nexport const WEBHOOK_SIGNATURE_HEADER = 'x-shapio-signature';\nexport const WEBHOOK_TIMESTAMP_HEADER = 'x-shapio-timestamp';\nexport const WEBHOOK_EVENT_HEADER = 'x-shapio-event';\n/** Requests signed further from now than this are rejected (replay protection). */\nexport const WEBHOOK_TOLERANCE_SECONDS = 300;\n\nconst SIGNATURE_VERSION = 'v1';\n\nexport type WebhookSignatureInput = {\n /** The webhook's or connection's signing secret. */\n secret: string;\n /** The `X-Shapio-Signature` header. */\n signature: string | null | undefined;\n /** The `X-Shapio-Timestamp` header. */\n timestamp: string | null | undefined;\n /** The raw request body, exactly as received (not re-serialised JSON). */\n body: string;\n /** Defaults to the current time. */\n now?: Date;\n /** Defaults to WEBHOOK_TOLERANCE_SECONDS. */\n toleranceSeconds?: number;\n};\n\nexport type WebhookSignatureCheck = { ok: true } | { ok: false; reason: string };\n\nconst toHex = (bytes: ArrayBuffer) =>\n Array.from(new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, '0')).join('');\n\n/** Compares two strings without returning early on the first difference. */\nconst constantTimeEqual = (a: string, b: string) => {\n let difference = a.length ^ b.length;\n for (let index = 0; index < Math.max(a.length, b.length); index += 1) {\n difference |= (a.charCodeAt(index) || 0) ^ (b.charCodeAt(index) || 0);\n }\n return difference === 0;\n};\n\nconst expectedSignature = async (secret: string, timestamp: number, body: string) => {\n const encoder = new TextEncoder();\n const key = await globalThis.crypto.subtle.importKey(\n 'raw',\n encoder.encode(secret),\n { name: 'HMAC', hash: 'SHA-256' },\n false,\n ['sign'],\n );\n const mac = await globalThis.crypto.subtle.sign('HMAC', key, encoder.encode(`${timestamp}.${body}`));\n return `${SIGNATURE_VERSION}=${toHex(mac)}`;\n};\n\n/** Checks a Shapio signature; `{ ok: false, reason }` says why it was refused (never throws for bad input). */\nexport const verifyWebhookSignature = async ({\n secret,\n signature,\n timestamp,\n body,\n now = new Date(),\n toleranceSeconds = WEBHOOK_TOLERANCE_SECONDS,\n}: WebhookSignatureInput): Promise<WebhookSignatureCheck> => {\n if (!signature || !timestamp || !/^\\d{1,12}$/.test(timestamp)) {\n return { ok: false, reason: 'missing signature or timestamp' };\n }\n const seconds = Number(timestamp);\n if (Math.abs(now.getTime() / 1000 - seconds) > toleranceSeconds) {\n return { ok: false, reason: 'timestamp outside the allowed window' };\n }\n const expected = await expectedSignature(secret, seconds, body);\n const matches = signature\n .split(',')\n .map((candidate) => candidate.trim())\n .some((candidate) => constantTimeEqual(candidate, expected));\n return matches ? { ok: true } : { ok: false, reason: 'signature mismatch' };\n};\n","/**\n * PKCE (RFC 7636) for the app side of Shapio's OAuth sign-in: the app keeps the verifier (e.g. in\n * sessionStorage) and sends the S256 challenge with the start link; the one-time code it gets back is only\n * exchanged together with that verifier. Uses Web Crypto, so it works in browsers and Node alike.\n */\nexport type AppPkcePair = { codeVerifier: string; codeChallenge: string };\n\nconst toBase64Url = (bytes: Uint8Array): string =>\n btoa(String.fromCharCode(...bytes))\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/, '');\n\n/** The S256 challenge of a verifier: base64url(SHA-256(verifier)). */\nexport const codeChallengeOf = async (codeVerifier: string): Promise<string> =>\n toBase64Url(\n new Uint8Array(await globalThis.crypto.subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier))),\n );\n\n/** A fresh verifier (32 random bytes, 43 characters) and its S256 challenge. */\nexport const createPkcePair = async (): Promise<AppPkcePair> => {\n const codeVerifier = toBase64Url(globalThis.crypto.getRandomValues(new Uint8Array(32)));\n return { codeVerifier, codeChallenge: await codeChallengeOf(codeVerifier) };\n};\n"],"mappings":";;;AAcA,MAAa,qBAAqB,aAAwB;CACxD,UAAU;EACR,OAAO,QA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K,CAAC,CAAC,CACpC,MAAM,cAAc,kBAAkB,WAAW,QAAQ,CAC/C,IAAI,EAAE,IAAI,KAAK,IAAI;EAAE,IAAI;EAAO,QAAQ;CAAqB;AAC5E;;;ACxEA,MAAM,eAAe,UACnB,KAAK,OAAO,aAAa,GAAG,KAAK,CAAC,CAAC,CAChC,QAAQ,OAAO,GAAG,CAAC,CACnB,QAAQ,OAAO,GAAG,CAAC,CACnB,QAAQ,OAAO,EAAE;;AAGtB,MAAa,kBAAkB,OAAO,iBACpC,YACE,IAAI,WAAW,MAAM,WAAW,OAAO,OAAO,OAAO,WAAW,IAAI,YAAY,CAAC,CAAC,OAAO,YAAY,CAAC,CAAC,CACzG;;AAGF,MAAa,iBAAiB,YAAkC;CAC9D,MAAM,eAAe,YAAY,WAAW,OAAO,gCAAgB,IAAI,WAAW,EAAE,CAAC,CAAC;CACtF,OAAO;EAAE;EAAc,eAAe,MAAM,gBAAgB,YAAY;CAAE;AAC5E"}
package/dist/node.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Bt as MediaAsset, St as ShapioClient, Zt as MediaVisibility } from "./index-BpSg5A3V.js";
1
+ import { Bt as MediaAsset, St as ShapioClient, Zt as MediaVisibility } from "./index-DJopnXJu.js";
2
2
  //#region src/node.d.ts
3
3
  export declare const mimeTypeOf: (path: string) => string | undefined;
4
4
  export type UploadFileInput = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shapio/client",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "Typed HTTP client for Shapio APIs.",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://shapio.dev",
@@ -32,7 +32,7 @@
32
32
  "dist"
33
33
  ],
34
34
  "dependencies": {
35
- "@shapio/schema": "0.2.1"
35
+ "@shapio/schema": "0.3.0"
36
36
  },
37
37
  "devDependencies": {
38
38
  "tsdown": "0.23.0",