@shapio/client 0.5.4 → 0.5.6

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,5 +1,5 @@
1
1
  import { DEFAULT_SEO_KEYS, ResolveSeoContext, SEO_COMPONENT_ID, SEO_FIELD_IDS, SeoDefaults, SeoKeys, SeoLocaleDefaults, SeoLocaleDefaults as SeoLocaleDefaults$1, applyTitleTemplate, resolveSeo, seoDefaultsForLocale } from "@shapio/schema/seo";
2
- import { ChangeSummary, ClassifiedChange, DefinitionInput, ExportedDefinition, LocaleDefinition, LockFile, SchemaChange, SchemaDefinition, SyncDecision, ValidationIssue } from "@shapio/schema";
2
+ import { ChangeSummary, ClassifiedChange, DataType, DefinitionInput, ExportedDefinition, LocaleDefinition, LockFile, SchemaChange, SchemaDefinition, SyncDecision, ValidationIssue } from "@shapio/schema";
3
3
  //#region src/nextCache.d.ts
4
4
  /**
5
5
  * Next.js data-cache support for delivery reads. Under Next (`process.env.NEXT_RUNTIME` is set) or when the
@@ -655,6 +655,11 @@ type DeploymentConnection = {
655
655
  createdAt: string;
656
656
  updatedAt: string;
657
657
  version: number;
658
+ /**
659
+ * The stored secrets cannot be decrypted (the server's SESSION_SECRET changed): every literal secret reads
660
+ * as not set until it is entered again; secrets read from the environment are unaffected.
661
+ */
662
+ secretsUnreadable: boolean;
658
663
  };
659
664
  type CreateDeploymentConnectionInput = {
660
665
  name: string;
@@ -676,6 +681,10 @@ type DeploymentConnectionCreated = {
676
681
  connection: DeploymentConnection;
677
682
  generatedSecrets: Record<string, string>;
678
683
  };
684
+ /** An update's result: `generatedSecrets` holds a secret Shapio minted to replace an unreadable one, shown once. */
685
+ type DeploymentConnectionUpdated = DeploymentConnection & {
686
+ generatedSecrets?: Record<string, string>;
687
+ };
679
688
  type ConnectionTestResult = {
680
689
  ok: boolean;
681
690
  checks: Array<{
@@ -821,6 +830,8 @@ type PlanStepImpact = {
821
830
  kind: string;
822
831
  affectedHeads: number;
823
832
  invalidHeads?: number;
833
+ /** On a `convert` step of a type change Shapio cannot convert: live entries that lose their value. */
834
+ droppedEntries?: number;
824
835
  };
825
836
  type PlanImpact = {
826
837
  /** Entry heads (every locale and state) of the affected models. */
@@ -1062,12 +1073,21 @@ type PutSchemaDraftInput = {
1062
1073
  /** The draft row version the caller saw; omit when creating the draft. */
1063
1074
  expectedDraftVersion?: number;
1064
1075
  };
1076
+ /**
1077
+ * One changed field. `summary` is the server's readable form of each side (rich text as its text, media as
1078
+ * filenames, relations as titles, components as labelled items); null when that side is empty.
1079
+ */
1065
1080
  type FieldDiff = {
1066
1081
  fieldId: string;
1067
1082
  apiKey: string;
1068
1083
  label: string;
1084
+ type: DataType;
1069
1085
  before: unknown;
1070
1086
  after: unknown;
1087
+ summary: {
1088
+ before: string | null;
1089
+ after: string | null;
1090
+ };
1071
1091
  };
1072
1092
  type ReviewIssue = {
1073
1093
  path: string;
@@ -1982,7 +2002,7 @@ declare const createClient: ({ baseUrl, token, fetch, credentials, headers, site
1982
2002
  list: () => Promise<DeploymentConnection[]>;
1983
2003
  get: (id: string) => Promise<DeploymentConnection>;
1984
2004
  create: (body: CreateDeploymentConnectionInput) => Promise<DeploymentConnectionCreated>;
1985
- update: (id: string, body: UpdateDeploymentConnectionInput) => Promise<DeploymentConnection>;
2005
+ update: (id: string, body: UpdateDeploymentConnectionInput) => Promise<DeploymentConnectionUpdated>;
1986
2006
  remove: (id: string) => Promise<void>;
1987
2007
  test: (id: string) => Promise<ConnectionTestResult>;
1988
2008
  trigger: (id: string) => Promise<DeploymentRun>;
@@ -2634,7 +2654,7 @@ declare const createAdminApi: (request: RequestFn) => {
2634
2654
  list: () => Promise<DeploymentConnection[]>;
2635
2655
  get: (id: string) => Promise<DeploymentConnection>;
2636
2656
  create: (body: CreateDeploymentConnectionInput) => Promise<DeploymentConnectionCreated>;
2637
- update: (id: string, body: UpdateDeploymentConnectionInput) => Promise<DeploymentConnection>;
2657
+ update: (id: string, body: UpdateDeploymentConnectionInput) => Promise<DeploymentConnectionUpdated>;
2638
2658
  remove: (id: string) => Promise<void>;
2639
2659
  test: (id: string) => Promise<ConnectionTestResult>;
2640
2660
  trigger: (id: string) => Promise<DeploymentRun>;
@@ -3052,5 +3072,5 @@ declare const codeChallengeOf: (codeVerifier: string) => Promise<string>;
3052
3072
  /** A fresh verifier (32 random bytes, 43 characters) and its S256 challenge. */
3053
3073
  declare const createPkcePair: () => Promise<AppPkcePair>;
3054
3074
  //#endregion
3055
- export { ContentHealthSummary as $, AdminEntry as $a, DeploymentSettings as $i, InvitationLink as $n, ShipPhase as $r, CreateMediaFolderInput as $t, DELIVERY_SITE_PATH as A, FieldUsageResponse as Aa, SchemaSummary as Ai, AcceptInvitationInput as An, ChangeSetQuery as Ar, SchemaDraftInput as At, buildUploadForm as B, UpdateSiteInput as Ba, CreateWebhookInput as Bi, ChangePasswordInput as Bn, FieldDiff as Br, CheckStatus as Bt, WEBHOOK_EVENT_HEADER as C, WebhookDelivery as Ca, PlanPreview as Ci, AppRolePermission as Cn, UpdateEntryInput as Co, CHANGE_SET_STATUSES as Cr, ContentOpsRule as Ct, WebhookSignatureCheck as D, WebhookWithSecret as Da, SchemaChangeJob as Di, CreateAppRoleInput as Dn, NextCacheMode as Do, ChangeSetError as Dr, ContentOpsWritten as Dt, WEBHOOK_TOLERANCE_SECONDS as E, WebhookEventType as Ea, PlanUpdateInput as Ei, BUILT_IN_APP_ROLE_KEYS as En, DeliveryReadOptions as Eo, ChangeSetEntryItem as Er, ContentOpsStatus as Et, createDeliveryClient as F, SetSiteAppRolesInput as Fa, UpdateSchemaSettingsInput as Fi, AuditActorType as Fn, ChangeSetSummary as Fr, ShapioApiError as Ft, ADMIN_PATHS as G, DeliveryGetQuery as Ga, DeploymentConnectionCreated as Gi, CsrfResponse as Gn, ReviewEntryItem as Gr, SnapshotChange as Gt, toContentQueryString as H, DeliverySite as Ha, DEPLOYMENT_RUN_STATUSES as Hi, CreateApiTokenInput as Hn, NotRestorable as Hr, ReadyResponse as Ht, DELIVERY_PATH as I, Site as Ia, ConnectionTestResult as Ii, AuditEvent as In, ChangeSetTimelineEvent as Ir, ShapioErrorBody as It, ContentCount as J, DeliveryListQuery as Ja, DeploymentRunQuery as Ji, EmailDelivery as Jn, SNAPSHOT_SOURCES as Jr, SnapshotChangesQuery as Jt, CheckParams as K, DeliveryItem as Ka, DeploymentProvider as Ki, DELIVERY_ACTIONS as Kn, ReviewIssue as Kr, SnapshotChangeKind as Kt, DeliveryApi as L, SiteAppRoles as La, CreateDeploymentConnectionInput as Li, AuditPage as Ln, CreateChangeSetInput as Lr, ShapioClient as Lt, SITE_QUERY_PARAMETER as M, PrincipalUsageSummary as Ma, SetDefaultLocaleResult as Mi, AdminUser as Mn, ChangeSetSchemaItem as Mr, SummarizeInput as Mt, DeliveryClientOptions as N, UsageSelection as Na, UpdateDefinitionInput as Ni, AdminUserStatus as Nn, ChangeSetSource as Nr, TranslateInput as Nt, WebhookSignatureInput as O, FieldPrincipalUsage as Oa, SchemaChangeStatus as Oi, UpdateAppRoleInput as On, NextCacheOptions as Oo, ChangeSetItem as Or, LocaleMissingResult as Ot, ShapioDeliveryClient as P, CreateSiteInput as Pa, UpdateLocaleInput as Pi, ApiToken as Pn, ChangeSetStatus as Pr, TranslateResult as Pt, ContentHealthQuery as Q, SeoMode as Qa, DeploymentSecretsInput as Qi, Invitation as Qn, ShipChangeSetInput as Qr, SchemaSyncResult as Qt, AdminApi as R, SiteRef as Ra, CreatePreviewTokenInput as Ri, AuditQuery as Rn, FieldConsumer as Rr, ShapioClientOptions as Rt, AppUser as S, WebhookAttempt as Sa, PlanImpact as Si, AppRole as Sn, RevisionSummary as So, AddChangeSetEntryInput as Sr, ContentOpsResult as St, WEBHOOK_TIMESTAMP_HEADER as T, WebhookEventBody as Ta, PlanStepImpact as Ti, AppUserQuery as Tn, RequestOptions as To, ChangeSetActor as Tr, ContentOpsSkip as Tt, SITES_PATHS as U, SeoFields as Ua, DEPLOYMENT_TRIGGERS as Ui, CreateRoleInput as Un, NotRestorableReason as Ur, VersionResponse as Ut, resolveUploadUrl as V, DeliveryAsset as Va, DEPLOYMENT_PROVIDERS as Vi, ContentAction as Vn, NOT_RESTORABLE_REASONS as Vr, HealthResponse as Vt, SITE_HEADER as W, SeoResolved as Wa, DeploymentConnection as Wi, CreatedApiToken as Wn, PutSchemaDraftInput as Wr, CurrentSnapshot as Wt, ContentHealthFinding as X, DeliveryPagination as Xa, DeploymentRunTrigger as Xi, GlobalAction as Xn, SchemaDraft as Xr, SchemaApplyResult as Xt, ContentCounts as Y, DeliveryMeta as Ya, DeploymentRunStatus as Yi, GLOBAL_ACTIONS as Yn, ScheduleChangeSetInput as Yr, SchemaApplyInput as Yt, ContentHealthPage as Z, RichTextMode as Za, DeploymentSecretState as Zi, InspectInvitationResponse as Zn, SchemaOperation as Zr, SchemaExport as Zt, AppLoginInput as _, ScheduleStatus as _a, DefinitionPayload as _i, UpdateMediaFolderInput as _n, EntryReferrer as _o, SetupStatusResponse as _r, AssistStatus as _t, SeoDefaults as a, JobStatus as aa, UpdateChangeSetInput as ai, MediaFocalPoint as an, ContentIssue as ao, PasswordResetConfirmInput as ar, PreflightInput as at, AppRegisterResult as b, UpdateWebhookInput as ba, DeleteLocaleResult as bi, AdminAppUser as bn, ExtensionThemeList as bo, UpdateProfileInput as br, CONTENT_OPS_RULES as bt, applyTitleTemplate as c, OpenPreviewResult as ca, ChangeOutcome as ci, MediaUsage as cn, ContentSort as co, Role as cr, PreflightRule as ct, AppPkcePair as d, PreviewTarget as da, ChangeScopeOutcome as di, MediaVariantStatus as dn, EditorManifestItem as do, RoleKind as dr, AltMissingResult as dt, DeploymentTimelineEvent as ea, Snapshot as ei, CreateUploadInput as en, AdminEntryListItem as eo, InviteUserInput as er, EntryPresence as et, codeChallengeOf as f, PreviewToken as fa, CreateDefinitionInput as fi, MediaVisibility as fn, EntryAuthor as fo, RolePermission as fr, AltProposal as ft, AppChangePasswordInput as g, ScheduleQuery as ga, DefinitionListItem as gi, UpdateMediaAssetInput as gn, EntryLocalesInput as go, SetupInput as gr, AssistProvider as gt, AppAuthApi as h, SCHEDULE_STATUSES as ha, DefinitionDetail as hi, ReplaceUploadInput as hn, EntryLocaleStatus as ho, SessionStarted as hr, AssistIssue as ht, SEO_FIELD_IDS as i, JobQuery as ia, UnassignedEntry as ii, MediaAssetStatus as in, ContentFilterValue as io, NetworkAction as ir, PreflightCheck as it, SiteApi as j, ModelFieldUsage as ja, SchemaSummaryItem as ji, AdminSession as jn, ChangeSetReview as jr, SchemaDraftResult as jt, verifyWebhookSignature as k, FieldUsageQuery as ka, SchemaSettings as ki, UpdateAppUserInput as kn, shapioTags as ko, ChangeSetItemStatus as kr, RewriteInput as kt, resolveSeo as l, PUBLICATION_ACTIONS as la, ChangePlan as li, MediaUsagePage as ln, CreateEntryInput as lo, RoleAssignment as lr, PresenceHeartbeatInput as lt, APP_AUTH_PATHS as m, PublicationAction as ma, DefinitionCategory as mi, MoveMediaAssetsResult as mn, EntryLocaleState as mo, SITE_ACTIONS as mr, AltTextResult as mt, ResolveSeoContext as n, JOB_STATUSES as na, SnapshotQuery as ni, MediaAssetPage as nn, ContentFilter as no, MeResponse as nr, HealthRule as nt, SeoKeys as o, JobSummary as oa, Acknowledgement as oi, MediaFolder as on, ContentListQuery as oo, PasswordResetRequestInput as or, PreflightLocale as ot, createPkcePair as p, PreviewTokenCreated as pa, CreateLocaleInput as pi, MoveMediaAssetsInput as pn, EntryData as po, RoleSummary as pr, AltTextInput as pt, CheckSeverity as q, DeliveryList as qa, DeploymentRun as qi, DeliveryAction as qn, ReviewSchemaItem as qr, SnapshotChangesPage as qt, SEO_COMPONENT_ID as r, Job as ra, SnapshotSource as ri, MediaAssetQuery as rn, ContentFilterOperator as ro, NETWORK_ACTIONS as rr, ModelPresence as rt, SeoLocaleDefaults$1 as s, OpenPreviewInput as sa, ActiveDefinition as si, MediaStorageDriver as sn, ContentPagination as so, PermissionAction as sr, PreflightResponse as st, DEFAULT_SEO_KEYS as t, DeploymentTriggerPolicy as ta, SnapshotPage as ti, MediaAsset as tn, AdminEntryPage as to, LoginInput as tr, HEALTH_RULES as tt, seoDefaultsForLocale as u, Page as ua, ChangeScopeInput as ui, MediaVariant as un, EditorManifest as uo, RoleCondition as ur, PresencePerson as ut, AppOAuthProvider as v, ScheduledPublication as va, DefinitionRevision as vi, UploadGrant as vn, EntryStatus as vo, SiteAction as vr, AssistTextResult as vt, WEBHOOK_SIGNATURE_HEADER as w, WebhookDeliveryStatus as wa, PlanStep as wi, AppUserPage as wn, RequestFn as wo, ChangeSet as wr, ContentOpsRun as wt, AppSession as x, Webhook as xa, Locale as xi, AppContentAction as xn, RevisionDetail as xo, UpdateRoleInput as xr, ContentOpsInput as xt, AppRegisterInput as y, UpdateDeploymentConnectionInput as ya, DefinitionScope as yi, APP_CONTENT_ACTIONS as yn, ExtensionTheme as yo, UpdateAdminUserInput as yr, AssistUsage as yt, ASSIST_PATHS as z, SiteSummary as za, CreateScheduleInput as zi, CONTENT_ACTIONS as zn, FieldConsumers as zr, createClient as zt };
3056
- //# sourceMappingURL=index-BWuxc5nS.d.ts.map
3075
+ export { ContentHealthSummary as $, SeoMode as $a, DeploymentSecretsInput as $i, InvitationLink as $n, ShipPhase as $r, CreateMediaFolderInput as $t, DELIVERY_SITE_PATH as A, FieldUsageQuery as Aa, SchemaSummary as Ai, AcceptInvitationInput as An, shapioTags as Ao, ChangeSetQuery as Ar, SchemaDraftInput as At, buildUploadForm as B, SiteSummary as Ba, CreateWebhookInput as Bi, ChangePasswordInput as Bn, FieldDiff as Br, CheckStatus as Bt, WEBHOOK_EVENT_HEADER as C, WebhookAttempt as Ca, PlanPreview as Ci, AppRolePermission as Cn, RevisionSummary as Co, CHANGE_SET_STATUSES as Cr, ContentOpsRule as Ct, WebhookSignatureCheck as D, WebhookEventType as Da, SchemaChangeJob as Di, CreateAppRoleInput as Dn, DeliveryReadOptions as Do, ChangeSetError as Dr, ContentOpsWritten as Dt, WEBHOOK_TOLERANCE_SECONDS as E, WebhookEventBody as Ea, PlanUpdateInput as Ei, BUILT_IN_APP_ROLE_KEYS as En, RequestOptions as Eo, ChangeSetEntryItem as Er, ContentOpsStatus as Et, createDeliveryClient as F, CreateSiteInput as Fa, UpdateSchemaSettingsInput as Fi, AuditActorType as Fn, ChangeSetSummary as Fr, ShapioApiError as Ft, ADMIN_PATHS as G, SeoResolved as Ga, DeploymentConnectionCreated as Gi, CsrfResponse as Gn, ReviewEntryItem as Gr, SnapshotChange as Gt, toContentQueryString as H, DeliveryAsset as Ha, DEPLOYMENT_RUN_STATUSES as Hi, CreateApiTokenInput as Hn, NotRestorable as Hr, ReadyResponse as Ht, DELIVERY_PATH as I, SetSiteAppRolesInput as Ia, ConnectionTestResult as Ii, AuditEvent as In, ChangeSetTimelineEvent as Ir, ShapioErrorBody as It, ContentCount as J, DeliveryList as Ja, DeploymentRun as Ji, EmailDelivery as Jn, SNAPSHOT_SOURCES as Jr, SnapshotChangesQuery as Jt, CheckParams as K, DeliveryGetQuery as Ka, DeploymentConnectionUpdated as Ki, DELIVERY_ACTIONS as Kn, ReviewIssue as Kr, SnapshotChangeKind as Kt, DeliveryApi as L, Site as La, CreateDeploymentConnectionInput as Li, AuditPage as Ln, CreateChangeSetInput as Lr, ShapioClient as Lt, SITE_QUERY_PARAMETER as M, ModelFieldUsage as Ma, SetDefaultLocaleResult as Mi, AdminUser as Mn, ChangeSetSchemaItem as Mr, SummarizeInput as Mt, DeliveryClientOptions as N, PrincipalUsageSummary as Na, UpdateDefinitionInput as Ni, AdminUserStatus as Nn, ChangeSetSource as Nr, TranslateInput as Nt, WebhookSignatureInput as O, WebhookWithSecret as Oa, SchemaChangeStatus as Oi, UpdateAppRoleInput as On, NextCacheMode as Oo, ChangeSetItem as Or, LocaleMissingResult as Ot, ShapioDeliveryClient as P, UsageSelection as Pa, UpdateLocaleInput as Pi, ApiToken as Pn, ChangeSetStatus as Pr, TranslateResult as Pt, ContentHealthQuery as Q, RichTextMode as Qa, DeploymentSecretState as Qi, Invitation as Qn, ShipChangeSetInput as Qr, SchemaSyncResult as Qt, AdminApi as R, SiteAppRoles as Ra, CreatePreviewTokenInput as Ri, AuditQuery as Rn, FieldConsumer as Rr, ShapioClientOptions as Rt, AppUser as S, Webhook as Sa, PlanImpact as Si, AppRole as Sn, RevisionDetail as So, AddChangeSetEntryInput as Sr, ContentOpsResult as St, WEBHOOK_TIMESTAMP_HEADER as T, WebhookDeliveryStatus as Ta, PlanStepImpact as Ti, AppUserQuery as Tn, RequestFn as To, ChangeSetActor as Tr, ContentOpsSkip as Tt, SITES_PATHS as U, DeliverySite as Ua, DEPLOYMENT_TRIGGERS as Ui, CreateRoleInput as Un, NotRestorableReason as Ur, VersionResponse as Ut, resolveUploadUrl as V, UpdateSiteInput as Va, DEPLOYMENT_PROVIDERS as Vi, ContentAction as Vn, NOT_RESTORABLE_REASONS as Vr, HealthResponse as Vt, SITE_HEADER as W, SeoFields as Wa, DeploymentConnection as Wi, CreatedApiToken as Wn, PutSchemaDraftInput as Wr, CurrentSnapshot as Wt, ContentHealthFinding as X, DeliveryMeta as Xa, DeploymentRunStatus as Xi, GlobalAction as Xn, SchemaDraft as Xr, SchemaApplyResult as Xt, ContentCounts as Y, DeliveryListQuery as Ya, DeploymentRunQuery as Yi, GLOBAL_ACTIONS as Yn, ScheduleChangeSetInput as Yr, SchemaApplyInput as Yt, ContentHealthPage as Z, DeliveryPagination as Za, DeploymentRunTrigger as Zi, InspectInvitationResponse as Zn, SchemaOperation as Zr, SchemaExport as Zt, AppLoginInput as _, ScheduleQuery as _a, DefinitionPayload as _i, UpdateMediaFolderInput as _n, EntryLocalesInput as _o, SetupStatusResponse as _r, AssistStatus as _t, SeoDefaults as a, JobQuery as aa, UpdateChangeSetInput as ai, MediaFocalPoint as an, ContentFilterValue as ao, PasswordResetConfirmInput as ar, PreflightInput as at, AppRegisterResult as b, UpdateDeploymentConnectionInput as ba, DeleteLocaleResult as bi, AdminAppUser as bn, ExtensionTheme as bo, UpdateProfileInput as br, CONTENT_OPS_RULES as bt, applyTitleTemplate as c, OpenPreviewInput as ca, ChangeOutcome as ci, MediaUsage as cn, ContentPagination as co, Role as cr, PreflightRule as ct, AppPkcePair as d, Page as da, ChangeScopeOutcome as di, MediaVariantStatus as dn, EditorManifest as do, RoleKind as dr, AltMissingResult as dt, DeploymentSettings as ea, Snapshot as ei, CreateUploadInput as en, AdminEntry as eo, InviteUserInput as er, EntryPresence as et, codeChallengeOf as f, PreviewTarget as fa, CreateDefinitionInput as fi, MediaVisibility as fn, EditorManifestItem as fo, RolePermission as fr, AltProposal as ft, AppChangePasswordInput as g, SCHEDULE_STATUSES as ga, DefinitionListItem as gi, UpdateMediaAssetInput as gn, EntryLocaleStatus as go, SetupInput as gr, AssistProvider as gt, AppAuthApi as h, PublicationAction as ha, DefinitionDetail as hi, ReplaceUploadInput as hn, EntryLocaleState as ho, SessionStarted as hr, AssistIssue as ht, SEO_FIELD_IDS as i, Job as ia, UnassignedEntry as ii, MediaAssetStatus as in, ContentFilterOperator as io, NetworkAction as ir, PreflightCheck as it, SiteApi as j, FieldUsageResponse as ja, SchemaSummaryItem as ji, AdminSession as jn, ChangeSetReview as jr, SchemaDraftResult as jt, verifyWebhookSignature as k, FieldPrincipalUsage as ka, SchemaSettings as ki, UpdateAppUserInput as kn, NextCacheOptions as ko, ChangeSetItemStatus as kr, RewriteInput as kt, resolveSeo as l, OpenPreviewResult as la, ChangePlan as li, MediaUsagePage as ln, ContentSort as lo, RoleAssignment as lr, PresenceHeartbeatInput as lt, APP_AUTH_PATHS as m, PreviewTokenCreated as ma, DefinitionCategory as mi, MoveMediaAssetsResult as mn, EntryData as mo, SITE_ACTIONS as mr, AltTextResult as mt, ResolveSeoContext as n, DeploymentTriggerPolicy as na, SnapshotQuery as ni, MediaAssetPage as nn, AdminEntryPage as no, MeResponse as nr, HealthRule as nt, SeoKeys as o, JobStatus as oa, Acknowledgement as oi, MediaFolder as on, ContentIssue as oo, PasswordResetRequestInput as or, PreflightLocale as ot, createPkcePair as p, PreviewToken as pa, CreateLocaleInput as pi, MoveMediaAssetsInput as pn, EntryAuthor as po, RoleSummary as pr, AltTextInput as pt, CheckSeverity as q, DeliveryItem as qa, DeploymentProvider as qi, DeliveryAction as qn, ReviewSchemaItem as qr, SnapshotChangesPage as qt, SEO_COMPONENT_ID as r, JOB_STATUSES as ra, SnapshotSource as ri, MediaAssetQuery as rn, ContentFilter as ro, NETWORK_ACTIONS as rr, ModelPresence as rt, SeoLocaleDefaults$1 as s, JobSummary as sa, ActiveDefinition as si, MediaStorageDriver as sn, ContentListQuery as so, PermissionAction as sr, PreflightResponse as st, DEFAULT_SEO_KEYS as t, DeploymentTimelineEvent as ta, SnapshotPage as ti, MediaAsset as tn, AdminEntryListItem as to, LoginInput as tr, HEALTH_RULES as tt, seoDefaultsForLocale as u, PUBLICATION_ACTIONS as ua, ChangeScopeInput as ui, MediaVariant as un, CreateEntryInput as uo, RoleCondition as ur, PresencePerson as ut, AppOAuthProvider as v, ScheduleStatus as va, DefinitionRevision as vi, UploadGrant as vn, EntryReferrer as vo, SiteAction as vr, AssistTextResult as vt, WEBHOOK_SIGNATURE_HEADER as w, WebhookDelivery as wa, PlanStep as wi, AppUserPage as wn, UpdateEntryInput as wo, ChangeSet as wr, ContentOpsRun as wt, AppSession as x, UpdateWebhookInput as xa, Locale as xi, AppContentAction as xn, ExtensionThemeList as xo, UpdateRoleInput as xr, ContentOpsInput as xt, AppRegisterInput as y, ScheduledPublication as ya, DefinitionScope as yi, APP_CONTENT_ACTIONS as yn, EntryStatus as yo, UpdateAdminUserInput as yr, AssistUsage as yt, ASSIST_PATHS as z, SiteRef as za, CreateScheduleInput as zi, CONTENT_ACTIONS as zn, FieldConsumers as zr, createClient as zt };
3076
+ //# sourceMappingURL=index-D_PFUTmi.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as ContentHealthSummary, $a as AdminEntry, $i as DeploymentSettings, $n as InvitationLink, $r as ShipPhase, $t as CreateMediaFolderInput, A as DELIVERY_SITE_PATH, Aa as FieldUsageResponse, Ai as SchemaSummary, An as AcceptInvitationInput, Ar as ChangeSetQuery, At as SchemaDraftInput, B as buildUploadForm, Ba as UpdateSiteInput, Bi as CreateWebhookInput, Bn as ChangePasswordInput, Br as FieldDiff, Bt as CheckStatus, C as WEBHOOK_EVENT_HEADER, Ca as WebhookDelivery, Ci as PlanPreview, Cn as AppRolePermission, Co as UpdateEntryInput, Cr as CHANGE_SET_STATUSES, Ct as ContentOpsRule, D as WebhookSignatureCheck, Da as WebhookWithSecret, Di as SchemaChangeJob, Dn as CreateAppRoleInput, Do as NextCacheMode, Dr as ChangeSetError, Dt as ContentOpsWritten, E as WEBHOOK_TOLERANCE_SECONDS, Ea as WebhookEventType, Ei as PlanUpdateInput, En as BUILT_IN_APP_ROLE_KEYS, Eo as DeliveryReadOptions, Er as ChangeSetEntryItem, Et as ContentOpsStatus, F as createDeliveryClient, Fa as SetSiteAppRolesInput, Fi as UpdateSchemaSettingsInput, Fn as AuditActorType, Fr as ChangeSetSummary, Ft as ShapioApiError, G as ADMIN_PATHS, Ga as DeliveryGetQuery, Gi as DeploymentConnectionCreated, Gn as CsrfResponse, Gr as ReviewEntryItem, Gt as SnapshotChange, H as toContentQueryString, Ha as DeliverySite, Hi as DEPLOYMENT_RUN_STATUSES, Hn as CreateApiTokenInput, Hr as NotRestorable, Ht as ReadyResponse, I as DELIVERY_PATH, Ia as Site, Ii as ConnectionTestResult, In as AuditEvent, Ir as ChangeSetTimelineEvent, It as ShapioErrorBody, J as ContentCount, Ja as DeliveryListQuery, Ji as DeploymentRunQuery, Jn as EmailDelivery, Jr as SNAPSHOT_SOURCES, Jt as SnapshotChangesQuery, K as CheckParams, Ka as DeliveryItem, Ki as DeploymentProvider, Kn as DELIVERY_ACTIONS, Kr as ReviewIssue, Kt as SnapshotChangeKind, L as DeliveryApi, La as SiteAppRoles, Li as CreateDeploymentConnectionInput, Ln as AuditPage, Lr as CreateChangeSetInput, Lt as ShapioClient, M as SITE_QUERY_PARAMETER, Ma as PrincipalUsageSummary, Mi as SetDefaultLocaleResult, Mn as AdminUser, Mr as ChangeSetSchemaItem, Mt as SummarizeInput, N as DeliveryClientOptions, Na as UsageSelection, Ni as UpdateDefinitionInput, Nn as AdminUserStatus, Nr as ChangeSetSource, Nt as TranslateInput, O as WebhookSignatureInput, Oa as FieldPrincipalUsage, Oi as SchemaChangeStatus, On as UpdateAppRoleInput, Oo as NextCacheOptions, Or as ChangeSetItem, Ot as LocaleMissingResult, P as ShapioDeliveryClient, Pa as CreateSiteInput, Pi as UpdateLocaleInput, Pn as ApiToken, Pr as ChangeSetStatus, Pt as TranslateResult, Q as ContentHealthQuery, Qa as SeoMode, Qi as DeploymentSecretsInput, Qn as Invitation, Qr as ShipChangeSetInput, Qt as SchemaSyncResult, R as AdminApi, Ra as SiteRef, Ri as CreatePreviewTokenInput, Rn as AuditQuery, Rr as FieldConsumer, Rt as ShapioClientOptions, S as AppUser, Sa as WebhookAttempt, Si as PlanImpact, Sn as AppRole, So as RevisionSummary, Sr as AddChangeSetEntryInput, St as ContentOpsResult, T as WEBHOOK_TIMESTAMP_HEADER, Ta as WebhookEventBody, Ti as PlanStepImpact, Tn as AppUserQuery, To as RequestOptions, Tr as ChangeSetActor, Tt as ContentOpsSkip, U as SITES_PATHS, Ua as SeoFields, Ui as DEPLOYMENT_TRIGGERS, Un as CreateRoleInput, Ur as NotRestorableReason, Ut as VersionResponse, V as resolveUploadUrl, Va as DeliveryAsset, Vi as DEPLOYMENT_PROVIDERS, Vn as ContentAction, Vr as NOT_RESTORABLE_REASONS, Vt as HealthResponse, W as SITE_HEADER, Wa as SeoResolved, Wi as DeploymentConnection, Wn as CreatedApiToken, Wr as PutSchemaDraftInput, Wt as CurrentSnapshot, X as ContentHealthFinding, Xa as DeliveryPagination, Xi as DeploymentRunTrigger, Xn as GlobalAction, Xr as SchemaDraft, Xt as SchemaApplyResult, Y as ContentCounts, Ya as DeliveryMeta, Yi as DeploymentRunStatus, Yn as GLOBAL_ACTIONS, Yr as ScheduleChangeSetInput, Yt as SchemaApplyInput, Z as ContentHealthPage, Za as RichTextMode, Zi as DeploymentSecretState, Zn as InspectInvitationResponse, Zr as SchemaOperation, Zt as SchemaExport, _ as AppLoginInput, _a as ScheduleStatus, _i as DefinitionPayload, _n as UpdateMediaFolderInput, _o as EntryReferrer, _r as SetupStatusResponse, _t as AssistStatus, a as SeoDefaults, aa as JobStatus, ai as UpdateChangeSetInput, an as MediaFocalPoint, ao as ContentIssue, ar as PasswordResetConfirmInput, at as PreflightInput, b as AppRegisterResult, ba as UpdateWebhookInput, bi as DeleteLocaleResult, bn as AdminAppUser, bo as ExtensionThemeList, br as UpdateProfileInput, bt as CONTENT_OPS_RULES, c as applyTitleTemplate, ca as OpenPreviewResult, ci as ChangeOutcome, cn as MediaUsage, co as ContentSort, cr as Role, ct as PreflightRule, d as AppPkcePair, da as PreviewTarget, di as ChangeScopeOutcome, dn as MediaVariantStatus, do as EditorManifestItem, dr as RoleKind, dt as AltMissingResult, ea as DeploymentTimelineEvent, ei as Snapshot, en as CreateUploadInput, eo as AdminEntryListItem, er as InviteUserInput, et as EntryPresence, f as codeChallengeOf, fa as PreviewToken, fi as CreateDefinitionInput, fn as MediaVisibility, fo as EntryAuthor, fr as RolePermission, ft as AltProposal, g as AppChangePasswordInput, ga as ScheduleQuery, gi as DefinitionListItem, gn as UpdateMediaAssetInput, go as EntryLocalesInput, gr as SetupInput, gt as AssistProvider, h as AppAuthApi, ha as SCHEDULE_STATUSES, hi as DefinitionDetail, hn as ReplaceUploadInput, ho as EntryLocaleStatus, hr as SessionStarted, ht as AssistIssue, i as SEO_FIELD_IDS, ia as JobQuery, ii as UnassignedEntry, in as MediaAssetStatus, io as ContentFilterValue, ir as NetworkAction, it as PreflightCheck, j as SiteApi, ja as ModelFieldUsage, ji as SchemaSummaryItem, jn as AdminSession, jr as ChangeSetReview, jt as SchemaDraftResult, k as verifyWebhookSignature, ka as FieldUsageQuery, ki as SchemaSettings, kn as UpdateAppUserInput, ko as shapioTags, kr as ChangeSetItemStatus, kt as RewriteInput, l as resolveSeo, la as PUBLICATION_ACTIONS, li as ChangePlan, ln as MediaUsagePage, lo as CreateEntryInput, lr as RoleAssignment, lt as PresenceHeartbeatInput, m as APP_AUTH_PATHS, ma as PublicationAction, mi as DefinitionCategory, mn as MoveMediaAssetsResult, mo as EntryLocaleState, mr as SITE_ACTIONS, mt as AltTextResult, n as ResolveSeoContext, na as JOB_STATUSES, ni as SnapshotQuery, nn as MediaAssetPage, no as ContentFilter, nr as MeResponse, nt as HealthRule, o as SeoKeys, oa as JobSummary, oi as Acknowledgement, on as MediaFolder, oo as ContentListQuery, or as PasswordResetRequestInput, ot as PreflightLocale, p as createPkcePair, pa as PreviewTokenCreated, pi as CreateLocaleInput, pn as MoveMediaAssetsInput, po as EntryData, pr as RoleSummary, pt as AltTextInput, q as CheckSeverity, qa as DeliveryList, qi as DeploymentRun, qn as DeliveryAction, qr as ReviewSchemaItem, qt as SnapshotChangesPage, r as SEO_COMPONENT_ID, ra as Job, ri as SnapshotSource, rn as MediaAssetQuery, ro as ContentFilterOperator, rr as NETWORK_ACTIONS, rt as ModelPresence, s as SeoLocaleDefaults, sa as OpenPreviewInput, si as ActiveDefinition, sn as MediaStorageDriver, so as ContentPagination, sr as PermissionAction, st as PreflightResponse, t as DEFAULT_SEO_KEYS, ta as DeploymentTriggerPolicy, ti as SnapshotPage, tn as MediaAsset, to as AdminEntryPage, tr as LoginInput, tt as HEALTH_RULES, u as seoDefaultsForLocale, ua as Page, ui as ChangeScopeInput, un as MediaVariant, uo as EditorManifest, ur as RoleCondition, ut as PresencePerson, v as AppOAuthProvider, va as ScheduledPublication, vi as DefinitionRevision, vn as UploadGrant, vo as EntryStatus, vr as SiteAction, vt as AssistTextResult, w as WEBHOOK_SIGNATURE_HEADER, wa as WebhookDeliveryStatus, wi as PlanStep, wn as AppUserPage, wo as RequestFn, wr as ChangeSet, wt as ContentOpsRun, x as AppSession, xa as Webhook, xi as Locale, xn as AppContentAction, xo as RevisionDetail, xr as UpdateRoleInput, xt as ContentOpsInput, y as AppRegisterInput, ya as UpdateDeploymentConnectionInput, yi as DefinitionScope, yn as APP_CONTENT_ACTIONS, yo as ExtensionTheme, yr as UpdateAdminUserInput, yt as AssistUsage, z as ASSIST_PATHS, za as SiteSummary, zi as CreateScheduleInput, zn as CONTENT_ACTIONS, zr as FieldConsumers, zt as createClient } from "./index-BWuxc5nS.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, DEFAULT_SEO_KEYS, DELIVERY_ACTIONS, DELIVERY_PATH, DELIVERY_SITE_PATH, DEPLOYMENT_PROVIDERS, DEPLOYMENT_RUN_STATUSES, DEPLOYMENT_TRIGGERS, type DefinitionCategory, type DefinitionDetail, type DefinitionListItem, type DefinitionPayload, type DefinitionRevision, type DefinitionScope, type DeleteLocaleResult, type DeliveryAction, type DeliveryApi, type DeliveryAsset, type DeliveryClientOptions, type DeliveryGetQuery, type DeliveryItem, type DeliveryList, type DeliveryListQuery, type DeliveryMeta, type DeliveryPagination, type DeliveryReadOptions, type DeliverySite, 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 ExtensionTheme, type ExtensionThemeList, 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 NextCacheMode, type NextCacheOptions, 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 ResolveSeoContext, type ReviewEntryItem, type ReviewIssue, type ReviewSchemaItem, type RevisionDetail, type RevisionSummary, type RewriteInput, type RichTextMode, type Role, type RoleAssignment, type RoleCondition, type RoleKind, type RolePermission, type RoleSummary, SCHEDULE_STATUSES, SEO_COMPONENT_ID, SEO_FIELD_IDS, 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 SeoDefaults, type SeoFields, type SeoKeys, type SeoLocaleDefaults, type SeoMode, type SeoResolved, type SessionStarted, type SetDefaultLocaleResult, type SetSiteAppRolesInput, type SetupInput, type SetupStatusResponse, ShapioApiError, type ShapioClient, type ShapioClientOptions, type ShapioDeliveryClient, type ShapioErrorBody, type ShipChangeSetInput, type ShipPhase, type Site, type SiteAction, type SiteApi, 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, applyTitleTemplate, buildUploadForm, codeChallengeOf, createClient, createDeliveryClient, createPkcePair, resolveSeo, resolveUploadUrl, seoDefaultsForLocale, shapioTags, toContentQueryString, verifyWebhookSignature };
1
+ import { $ as ContentHealthSummary, $a as SeoMode, $i as DeploymentSecretsInput, $n as InvitationLink, $r as ShipPhase, $t as CreateMediaFolderInput, A as DELIVERY_SITE_PATH, Aa as FieldUsageQuery, Ai as SchemaSummary, An as AcceptInvitationInput, Ao as shapioTags, Ar as ChangeSetQuery, At as SchemaDraftInput, B as buildUploadForm, Ba as SiteSummary, Bi as CreateWebhookInput, Bn as ChangePasswordInput, Br as FieldDiff, Bt as CheckStatus, C as WEBHOOK_EVENT_HEADER, Ca as WebhookAttempt, Ci as PlanPreview, Cn as AppRolePermission, Co as RevisionSummary, Cr as CHANGE_SET_STATUSES, Ct as ContentOpsRule, D as WebhookSignatureCheck, Da as WebhookEventType, Di as SchemaChangeJob, Dn as CreateAppRoleInput, Do as DeliveryReadOptions, Dr as ChangeSetError, Dt as ContentOpsWritten, E as WEBHOOK_TOLERANCE_SECONDS, Ea as WebhookEventBody, Ei as PlanUpdateInput, En as BUILT_IN_APP_ROLE_KEYS, Eo as RequestOptions, Er as ChangeSetEntryItem, Et as ContentOpsStatus, F as createDeliveryClient, Fa as CreateSiteInput, Fi as UpdateSchemaSettingsInput, Fn as AuditActorType, Fr as ChangeSetSummary, Ft as ShapioApiError, G as ADMIN_PATHS, Ga as SeoResolved, Gi as DeploymentConnectionCreated, Gn as CsrfResponse, Gr as ReviewEntryItem, Gt as SnapshotChange, H as toContentQueryString, Ha as DeliveryAsset, Hi as DEPLOYMENT_RUN_STATUSES, Hn as CreateApiTokenInput, Hr as NotRestorable, Ht as ReadyResponse, I as DELIVERY_PATH, Ia as SetSiteAppRolesInput, Ii as ConnectionTestResult, In as AuditEvent, Ir as ChangeSetTimelineEvent, It as ShapioErrorBody, J as ContentCount, Ja as DeliveryList, Ji as DeploymentRun, Jn as EmailDelivery, Jr as SNAPSHOT_SOURCES, Jt as SnapshotChangesQuery, K as CheckParams, Ka as DeliveryGetQuery, Ki as DeploymentConnectionUpdated, Kn as DELIVERY_ACTIONS, Kr as ReviewIssue, Kt as SnapshotChangeKind, L as DeliveryApi, La as Site, Li as CreateDeploymentConnectionInput, Ln as AuditPage, Lr as CreateChangeSetInput, Lt as ShapioClient, M as SITE_QUERY_PARAMETER, Ma as ModelFieldUsage, Mi as SetDefaultLocaleResult, Mn as AdminUser, Mr as ChangeSetSchemaItem, Mt as SummarizeInput, N as DeliveryClientOptions, Na as PrincipalUsageSummary, Ni as UpdateDefinitionInput, Nn as AdminUserStatus, Nr as ChangeSetSource, Nt as TranslateInput, O as WebhookSignatureInput, Oa as WebhookWithSecret, Oi as SchemaChangeStatus, On as UpdateAppRoleInput, Oo as NextCacheMode, Or as ChangeSetItem, Ot as LocaleMissingResult, P as ShapioDeliveryClient, Pa as UsageSelection, Pi as UpdateLocaleInput, Pn as ApiToken, Pr as ChangeSetStatus, Pt as TranslateResult, Q as ContentHealthQuery, Qa as RichTextMode, Qi as DeploymentSecretState, Qn as Invitation, Qr as ShipChangeSetInput, Qt as SchemaSyncResult, R as AdminApi, Ra as SiteAppRoles, Ri as CreatePreviewTokenInput, Rn as AuditQuery, Rr as FieldConsumer, Rt as ShapioClientOptions, S as AppUser, Sa as Webhook, Si as PlanImpact, Sn as AppRole, So as RevisionDetail, Sr as AddChangeSetEntryInput, St as ContentOpsResult, T as WEBHOOK_TIMESTAMP_HEADER, Ta as WebhookDeliveryStatus, Ti as PlanStepImpact, Tn as AppUserQuery, To as RequestFn, Tr as ChangeSetActor, Tt as ContentOpsSkip, U as SITES_PATHS, Ua as DeliverySite, Ui as DEPLOYMENT_TRIGGERS, Un as CreateRoleInput, Ur as NotRestorableReason, Ut as VersionResponse, V as resolveUploadUrl, Va as UpdateSiteInput, Vi as DEPLOYMENT_PROVIDERS, Vn as ContentAction, Vr as NOT_RESTORABLE_REASONS, Vt as HealthResponse, W as SITE_HEADER, Wa as SeoFields, Wi as DeploymentConnection, Wn as CreatedApiToken, Wr as PutSchemaDraftInput, Wt as CurrentSnapshot, X as ContentHealthFinding, Xa as DeliveryMeta, Xi as DeploymentRunStatus, Xn as GlobalAction, Xr as SchemaDraft, Xt as SchemaApplyResult, Y as ContentCounts, Ya as DeliveryListQuery, Yi as DeploymentRunQuery, Yn as GLOBAL_ACTIONS, Yr as ScheduleChangeSetInput, Yt as SchemaApplyInput, Z as ContentHealthPage, Za as DeliveryPagination, Zi as DeploymentRunTrigger, Zn as InspectInvitationResponse, Zr as SchemaOperation, Zt as SchemaExport, _ as AppLoginInput, _a as ScheduleQuery, _i as DefinitionPayload, _n as UpdateMediaFolderInput, _o as EntryLocalesInput, _r as SetupStatusResponse, _t as AssistStatus, a as SeoDefaults, aa as JobQuery, ai as UpdateChangeSetInput, an as MediaFocalPoint, ao as ContentFilterValue, ar as PasswordResetConfirmInput, at as PreflightInput, b as AppRegisterResult, ba as UpdateDeploymentConnectionInput, bi as DeleteLocaleResult, bn as AdminAppUser, bo as ExtensionTheme, br as UpdateProfileInput, bt as CONTENT_OPS_RULES, c as applyTitleTemplate, ca as OpenPreviewInput, ci as ChangeOutcome, cn as MediaUsage, co as ContentPagination, cr as Role, ct as PreflightRule, d as AppPkcePair, da as Page, di as ChangeScopeOutcome, dn as MediaVariantStatus, do as EditorManifest, dr as RoleKind, dt as AltMissingResult, ea as DeploymentSettings, ei as Snapshot, en as CreateUploadInput, eo as AdminEntry, er as InviteUserInput, et as EntryPresence, f as codeChallengeOf, fa as PreviewTarget, fi as CreateDefinitionInput, fn as MediaVisibility, fo as EditorManifestItem, fr as RolePermission, ft as AltProposal, g as AppChangePasswordInput, ga as SCHEDULE_STATUSES, gi as DefinitionListItem, gn as UpdateMediaAssetInput, go as EntryLocaleStatus, gr as SetupInput, gt as AssistProvider, h as AppAuthApi, ha as PublicationAction, hi as DefinitionDetail, hn as ReplaceUploadInput, ho as EntryLocaleState, hr as SessionStarted, ht as AssistIssue, i as SEO_FIELD_IDS, ia as Job, ii as UnassignedEntry, in as MediaAssetStatus, io as ContentFilterOperator, ir as NetworkAction, it as PreflightCheck, j as SiteApi, ja as FieldUsageResponse, ji as SchemaSummaryItem, jn as AdminSession, jr as ChangeSetReview, jt as SchemaDraftResult, k as verifyWebhookSignature, ka as FieldPrincipalUsage, ki as SchemaSettings, kn as UpdateAppUserInput, ko as NextCacheOptions, kr as ChangeSetItemStatus, kt as RewriteInput, l as resolveSeo, la as OpenPreviewResult, li as ChangePlan, ln as MediaUsagePage, lo as ContentSort, lr as RoleAssignment, lt as PresenceHeartbeatInput, m as APP_AUTH_PATHS, ma as PreviewTokenCreated, mi as DefinitionCategory, mn as MoveMediaAssetsResult, mo as EntryData, mr as SITE_ACTIONS, mt as AltTextResult, n as ResolveSeoContext, na as DeploymentTriggerPolicy, ni as SnapshotQuery, nn as MediaAssetPage, no as AdminEntryPage, nr as MeResponse, nt as HealthRule, o as SeoKeys, oa as JobStatus, oi as Acknowledgement, on as MediaFolder, oo as ContentIssue, or as PasswordResetRequestInput, ot as PreflightLocale, p as createPkcePair, pa as PreviewToken, pi as CreateLocaleInput, pn as MoveMediaAssetsInput, po as EntryAuthor, pr as RoleSummary, pt as AltTextInput, q as CheckSeverity, qa as DeliveryItem, qi as DeploymentProvider, qn as DeliveryAction, qr as ReviewSchemaItem, qt as SnapshotChangesPage, r as SEO_COMPONENT_ID, ra as JOB_STATUSES, ri as SnapshotSource, rn as MediaAssetQuery, ro as ContentFilter, rr as NETWORK_ACTIONS, rt as ModelPresence, s as SeoLocaleDefaults, sa as JobSummary, si as ActiveDefinition, sn as MediaStorageDriver, so as ContentListQuery, sr as PermissionAction, st as PreflightResponse, t as DEFAULT_SEO_KEYS, ta as DeploymentTimelineEvent, ti as SnapshotPage, tn as MediaAsset, to as AdminEntryListItem, tr as LoginInput, tt as HEALTH_RULES, u as seoDefaultsForLocale, ua as PUBLICATION_ACTIONS, ui as ChangeScopeInput, un as MediaVariant, uo as CreateEntryInput, ur as RoleCondition, ut as PresencePerson, v as AppOAuthProvider, va as ScheduleStatus, vi as DefinitionRevision, vn as UploadGrant, vo as EntryReferrer, vr as SiteAction, vt as AssistTextResult, w as WEBHOOK_SIGNATURE_HEADER, wa as WebhookDelivery, wi as PlanStep, wn as AppUserPage, wo as UpdateEntryInput, wr as ChangeSet, wt as ContentOpsRun, x as AppSession, xa as UpdateWebhookInput, xi as Locale, xn as AppContentAction, xo as ExtensionThemeList, xr as UpdateRoleInput, xt as ContentOpsInput, y as AppRegisterInput, ya as ScheduledPublication, yi as DefinitionScope, yn as APP_CONTENT_ACTIONS, yo as EntryStatus, yr as UpdateAdminUserInput, yt as AssistUsage, z as ASSIST_PATHS, za as SiteRef, zi as CreateScheduleInput, zn as CONTENT_ACTIONS, zr as FieldConsumers, zt as createClient } from "./index-D_PFUTmi.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, DEFAULT_SEO_KEYS, DELIVERY_ACTIONS, DELIVERY_PATH, DELIVERY_SITE_PATH, DEPLOYMENT_PROVIDERS, DEPLOYMENT_RUN_STATUSES, DEPLOYMENT_TRIGGERS, type DefinitionCategory, type DefinitionDetail, type DefinitionListItem, type DefinitionPayload, type DefinitionRevision, type DefinitionScope, type DeleteLocaleResult, type DeliveryAction, type DeliveryApi, type DeliveryAsset, type DeliveryClientOptions, type DeliveryGetQuery, type DeliveryItem, type DeliveryList, type DeliveryListQuery, type DeliveryMeta, type DeliveryPagination, type DeliveryReadOptions, type DeliverySite, type DeploymentConnection, type DeploymentConnectionCreated, type DeploymentConnectionUpdated, 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 ExtensionTheme, type ExtensionThemeList, 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 NextCacheMode, type NextCacheOptions, 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 ResolveSeoContext, type ReviewEntryItem, type ReviewIssue, type ReviewSchemaItem, type RevisionDetail, type RevisionSummary, type RewriteInput, type RichTextMode, type Role, type RoleAssignment, type RoleCondition, type RoleKind, type RolePermission, type RoleSummary, SCHEDULE_STATUSES, SEO_COMPONENT_ID, SEO_FIELD_IDS, 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 SeoDefaults, type SeoFields, type SeoKeys, type SeoLocaleDefaults, type SeoMode, type SeoResolved, type SessionStarted, type SetDefaultLocaleResult, type SetSiteAppRolesInput, type SetupInput, type SetupStatusResponse, ShapioApiError, type ShapioClient, type ShapioClientOptions, type ShapioDeliveryClient, type ShapioErrorBody, type ShipChangeSetInput, type ShipPhase, type Site, type SiteAction, type SiteApi, 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, applyTitleTemplate, buildUploadForm, codeChallengeOf, createClient, createDeliveryClient, createPkcePair, resolveSeo, resolveUploadUrl, seoDefaultsForLocale, shapioTags, toContentQueryString, verifyWebhookSignature };
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/nextCache.ts","../src/delivery.ts","../src/siteDelivery.ts","../src/snapshots.ts","../src/deliveryClient.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 ExtensionThemeList,\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 /** Admin colour themes the project declares (`shapio.config` `themes`). Public: no session needed. */\n themes: () => request<ExtensionThemeList>(ADMIN_PATHS.extensionThemes),\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 * What a delivery role grants: `read`, and `readDrafts` (drafts mode: the token's site may read drafts with\n * `publicationState=draft`). `readDrafts` always covers every model and is never granted to admin roles.\n */\nexport const DELIVERY_ACTIONS = ['read', 'readDrafts'] as const;\nexport type DeliveryAction = (typeof DELIVERY_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 'site.settings',\n] as const;\nexport type GlobalAction = (typeof GLOBAL_ACTIONS)[number];\n\nexport type PermissionAction = ContentAction | DeliveryAction | 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","/**\n * Next.js data-cache support for delivery reads. Under Next (`process.env.NEXT_RUNTIME` is set) or when the\n * client is given a `next` option, every delivery read passes `next: { tags }` to `fetch`, so a site can\n * refresh exactly what changed with `revalidateTag`. The cache mode is only set when asked for, except that a\n * read pinned to a publication snapshot is immutable and always `force-cache`, and a drafts-mode read is never\n * cached or tagged (`no-store`). Elsewhere nothing is added.\n */\n\n/** Next's `fetch` cache modes the client passes through. */\nexport type NextCacheMode = 'force-cache' | 'no-store';\n\nexport type NextCacheOptions = {\n /** Next's `fetch` `cache` option. Unset: Next's own default, except pinned snapshot reads (`force-cache`). */\n cache?: NextCacheMode;\n /** Seconds a cached response stays fresh (`next.revalidate`); `false` keeps it until a tag is revalidated. */\n revalidate?: number | false;\n};\n\n/** The last argument of every delivery read: overrides the client's `next` option; `false` adds nothing. */\nexport type DeliveryReadOptions = { next?: NextCacheOptions | false };\n\n/** What a delivery read adds to its `fetch` init. */\nexport type NextFetchInit = {\n cache?: NextCacheMode;\n next?: { tags: string[]; revalidate?: number | false };\n};\n\nconst TAG_PREFIX = 'shapio';\n\n/**\n * The cache tags delivery reads carry (`revalidateTag(shapioTags.entry('articles', id), { expire: 0 })`).\n * Models are named by their route key: a collection's plural API ID, a singleton's API ID.\n */\nexport const shapioTags = {\n /** Every delivery read of the site; `shapio:site` when the client names no site. */\n site: (siteKey?: string) =>\n siteKey === undefined ? `${TAG_PREFIX}:site` : `${TAG_PREFIX}:site:${siteKey}`,\n /** Every read of one model (lists, singletons and its entries). */\n model: (routeKey: string) => `${TAG_PREFIX}:${routeKey}`,\n /** Reads of one entry by its ID. */\n entry: (routeKey: string, entryId: string) => `${TAG_PREFIX}:${routeKey}:${entryId}`,\n} as const;\n\n/** Spelled out so bundlers that inline `process.env.NEXT_RUNTIME` see it; guarded for browsers. */\nconst isNextRuntime = (): boolean => {\n try {\n return typeof process !== 'undefined' && Boolean(process.env.NEXT_RUNTIME);\n } catch {\n return false;\n }\n};\n\n/** What every delivery read needs to tag itself: the client's site, `next` option and drafts mode. */\nexport type DeliveryCacheContext = {\n site: string | undefined;\n next: NextCacheOptions | false | undefined;\n /** Drafts mode (`drafts: true`): reads ask for drafts, which are never cached. */\n drafts: boolean;\n};\n\nexport type NextReadInput = {\n /** The client's `next` option. */\n client: NextCacheOptions | false | undefined;\n /** The read's own `next` option. */\n read: NextCacheOptions | false | undefined;\n tags: string[];\n /** The read names a publication snapshot (immutable). */\n pinned: boolean;\n /** Drafts mode: under Next (or with any `next` option) the read is `no-store` and untagged. */\n drafts?: boolean;\n};\n\n/** The `cache` and `next` fetch options of one delivery read; empty outside Next unless asked for. */\nexport const nextFetchInit = ({\n client,\n read,\n tags,\n pinned,\n drafts = false,\n}: NextReadInput): NextFetchInit => {\n if (drafts) {\n // Drafts change on every save: never in Next's data cache, never tagged, whatever the `next` options say.\n const asked = (client !== undefined && client !== false) || (read !== undefined && read !== false);\n return asked || isNextRuntime() ? { cache: 'no-store' } : {};\n }\n if (read === false || (read === undefined && client === false)) {\n return {};\n }\n const configured = client === false ? read : read === undefined ? client : { ...client, ...read };\n if (configured === undefined && !isNextRuntime()) {\n return {};\n }\n if (pinned && read?.cache === undefined) {\n return { cache: 'force-cache', next: { tags } };\n }\n const cache = configured?.cache;\n const revalidate = configured?.revalidate;\n return {\n ...(cache === undefined ? {} : { cache }),\n next: { tags, ...(revalidate === undefined ? {} : { revalidate }) },\n };\n};\n","import { toContentQueryString } from './admin/contentQuery.js';\nimport type { DeliveryGetQuery, DeliveryItem, DeliveryList, DeliveryListQuery } from './deliveryTypes.js';\nimport {\n nextFetchInit,\n shapioTags,\n type DeliveryCacheContext,\n type DeliveryReadOptions,\n} from './nextCache.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/**\n * The content query string plus `snapshot`, `richText` and `seo`, which only delivery reads take, and\n * `publicationState=draft` in drafts mode.\n */\nconst deliveryQueryString = (\n { snapshot, richText, seo, ...query }: DeliveryListQuery,\n drafts: boolean,\n): string => {\n const extra = [\n ...(snapshot === undefined ? [] : [`snapshot=${encodeURIComponent(String(snapshot))}`]),\n ...(richText === undefined ? [] : [`richText=${encodeURIComponent(richText)}`]),\n ...(seo === undefined ? [] : [`seo=${encodeURIComponent(seo)}`]),\n ...(drafts ? ['publicationState=draft'] : []),\n ];\n const base = toContentQueryString(query);\n if (extra.length === 0) {\n return base;\n }\n return base ? `${base}&${extra.join('&')}` : `?${extra.join('&')}`;\n};\n\n/** Drafts cannot be pinned: the server refuses `snapshot` with drafts, and so does the client, before sending. */\nconst draftsPinned = () =>\n Promise.reject(\n new Error(\n 'Drafts mode reads saved drafts, which have no publication snapshot: leave `snapshot` out when the client has `drafts: true`',\n ),\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`. Each read\n * takes Next.js cache options last and is tagged for `revalidateTag` (nextCache.ts): lists and singletons with\n * the site and model tags, `get` with the entry's tag too. In drafts mode (`drafts: true`) every read asks for\n * drafts (`publicationState=draft`), is never cached or tagged under Next, and refuses a pinned snapshot.\n */\nexport const createDeliveryApi = (request: RequestFn, cacheContext: DeliveryCacheContext) => {\n const { drafts } = cacheContext;\n const fetchInit = (tags: string[], query: DeliveryGetQuery, { next }: DeliveryReadOptions) =>\n nextFetchInit({\n client: cacheContext.next,\n read: next,\n tags,\n pinned: query.snapshot !== undefined,\n drafts,\n });\n const read = <R>(path: string, tags: string[], query: DeliveryListQuery, options: DeliveryReadOptions) =>\n drafts && query.snapshot !== undefined\n ? draftsPinned()\n : request<R>(`${path}${deliveryQueryString(query, drafts)}`, fetchInit(tags, query, options));\n const siteTag = shapioTags.site(cacheContext.site);\n return {\n list: <T = Record<string, unknown>>(\n routeKey: string,\n query: DeliveryListQuery = {},\n options: DeliveryReadOptions = {},\n ) => read<DeliveryList<T>>(routePath(routeKey), [siteTag, shapioTags.model(routeKey)], query, options),\n singleton: <T = Record<string, unknown>>(\n apiKey: string,\n query: DeliveryGetQuery = {},\n options: DeliveryReadOptions = {},\n ) => read<DeliveryItem<T>>(routePath(apiKey), [siteTag, shapioTags.model(apiKey)], query, options),\n get: <T = Record<string, unknown>>(\n routeKey: string,\n id: string,\n query: DeliveryGetQuery = {},\n options: DeliveryReadOptions = {},\n ) =>\n read<DeliveryItem<T>>(\n `${routePath(routeKey)}/${encodeURIComponent(id)}`,\n [siteTag, shapioTags.model(routeKey), shapioTags.entry(routeKey, id)],\n query,\n options,\n ),\n };\n};\n\nexport type DeliveryApi = ReturnType<typeof createDeliveryApi>;\n","import {\n nextFetchInit,\n shapioTags,\n type DeliveryCacheContext,\n type DeliveryReadOptions,\n} from './nextCache.js';\nimport type { RequestFn } from './request.js';\nimport type { DeliverySite } from './seoTypes.js';\n\nexport const DELIVERY_SITE_PATH = '/api/site';\n\n/**\n * The request's site as delivery sees it (key, name, SEO defaults), with the client's token and site. Under\n * Next.js the read carries the site tag (nextCache.ts); in drafts mode it is `no-store` and untagged instead\n * (the site has no draft state, so no `publicationState` is sent).\n */\nexport const createSiteApi = (request: RequestFn, cacheContext: DeliveryCacheContext) => ({\n get: ({ next }: DeliveryReadOptions = {}) =>\n request<DeliverySite>(\n DELIVERY_SITE_PATH,\n nextFetchInit({\n client: cacheContext.next,\n read: next,\n tags: [shapioTags.site(cacheContext.site)],\n pinned: false,\n drafts: cacheContext.drafts,\n }),\n ),\n});\n\nexport type SiteApi = ReturnType<typeof createSiteApi>;\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 { createDeliveryApi } from './delivery.js';\nimport type { NextCacheOptions } from './nextCache.js';\nimport type { RequestFn } from './request.js';\nimport { createSiteApi } from './siteDelivery.js';\nimport { createSnapshotsApi } from './snapshots.js';\n\nexport type DeliveryClientOptions = {\n /** The site key the reads are tagged with (`shapioTags.site`); the transport names the site itself. */\n site?: string;\n /** Next.js data-cache options, as `createClient`'s `next` option. */\n next?: NextCacheOptions | false;\n /** Drafts mode, as `createClient`'s `drafts` option. */\n drafts?: boolean;\n};\n\n/**\n * The read side of the client over any transport: published content (`delivery`), the site (`site`) and\n * publication snapshots (`snapshots`). `createClient` builds it over HTTP; `@shapio/local` over the delivery\n * API running in the same process. The transport receives exactly the paths the HTTP client sends.\n */\nexport const createDeliveryClient = (\n request: RequestFn,\n { site, next, drafts = false }: DeliveryClientOptions = {},\n) => {\n const cacheContext = { site, next, drafts };\n return {\n /** Published content (the delivery API; drafts in drafts mode), typed by the caller. */\n delivery: createDeliveryApi(request, cacheContext),\n /** The site as delivery sees it: key, name and SEO defaults (`GET /api/site`). */\n site: createSiteApi(request, cacheContext),\n /** Publication snapshots and the diff between two (incremental builds). */\n snapshots: createSnapshotsApi(request),\n };\n};\n\nexport type ShapioDeliveryClient = ReturnType<typeof createDeliveryClient>;\n","import { SITE_HEADER } from './admin/sites.js';\nimport { DELIVERY_PATH } from './delivery.js';\nimport { DELIVERY_SITE_PATH } from './siteDelivery.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, snapshots, the site): a GET there carries the site in its URL. */\nconst DELIVERY_READ_PREFIXES = [\n `${DELIVERY_PATH}/`,\n `${DELIVERY_PATH}?`,\n '/api/snapshots/',\n `${DELIVERY_SITE_PATH}?`,\n] as const;\n\nconst isDeliveryRead = (method: string, path: string) =>\n method === 'GET' &&\n (path === DELIVERY_PATH ||\n path === DELIVERY_SITE_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 type { NextFetchInit } from './nextCache.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 = {\n method?: string;\n body?: unknown;\n signal?: AbortSignal;\n} & NextFetchInit;\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, cache, next }: 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 // `next` is Next.js's extension of fetch (cache tags); other runtimes ignore it, and it is only set there.\n const init: RequestInit & Pick<NextFetchInit, 'next'> = {\n method,\n headers: requestHeaders,\n ...(body !== undefined ? { body: JSON.stringify(body) } : {}),\n ...(signal ? { signal } : {}),\n ...(credentials ? { credentials } : {}),\n ...(cache ? { cache } : {}),\n ...(next ? { next } : {}),\n };\n const response = await fetch(`${origin}${path}`, init);\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 { createDeliveryClient } from './deliveryClient.js';\nimport type { NextCacheOptions } from './nextCache.js';\nimport { createRequest, type FetchCredentials } from './request.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 * Next.js data-cache options for delivery reads (`delivery.*`, `site.get`), e.g. `{ cache: 'force-cache' }`.\n * Under Next the reads are tagged for `revalidateTag` whether or not this is set; the cache mode is only\n * passed when asked for, and reads pinned to a snapshot are always `force-cache`. Set it outside Next to send\n * the same fetch options; `false` sends none. A read's own `next` option overrides this one.\n */\n next?: NextCacheOptions | false;\n /**\n * Drafts mode, for a site's development server: every delivery read asks for drafts\n * (`publicationState=draft`) instead of published content, and under Next is never cached or tagged. Needs\n * a delivery token whose role grants Read drafts (the server refuses others with 403 `DRAFTS_FORBIDDEN`);\n * never set it on a production build. Reads pinned to a `snapshot` are refused. `snapshots` is unaffected.\n */\n drafts?: boolean;\n};\n\nexport const createClient = ({\n baseUrl,\n token,\n fetch = globalThis.fetch,\n credentials,\n headers,\n site,\n next,\n drafts,\n}: ShapioClientOptions) => {\n const request = createRequest({ baseUrl, token, fetch, credentials, headers, site });\n const reads = createDeliveryClient(request, { site, next, ...(drafts !== undefined ? { drafts } : {}) });\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: reads.delivery,\n /** The site as delivery sees it: key, name and SEO defaults (`GET /api/site`). */\n site: reads.site,\n admin: createAdminApi(request),\n /** Publication snapshots and the diff between two (incremental builds). */\n snapshots: reads.snapshots,\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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AAS;CAChC,IAAI,KAAK,IAAI,IAAI,QAAQ,IAAI,MAAO,OAAO,IAAI,kBAC7C,OAAO;EAAE,IAAI;EAAO,QAAQ;CAAuC;CAErE,MAAM,WAAW,MAAM,kBAAkB,QAAQ,SAAS,IAAI;CAK9D,OAJgB,UACb,MAAM,GAAG,CAAC,CACV,KAAK,cAAc,UAAU,KAAK,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"}
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/nextCache.ts","../src/delivery.ts","../src/siteDelivery.ts","../src/snapshots.ts","../src/deliveryClient.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 ExtensionThemeList,\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 /** Admin colour themes the project declares (`shapio.config` `themes`). Public: no session needed. */\n themes: () => request<ExtensionThemeList>(ADMIN_PATHS.extensionThemes),\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 DeploymentConnectionUpdated,\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<DeploymentConnectionUpdated>(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 * What a delivery role grants: `read`, and `readDrafts` (drafts mode: the token's site may read drafts with\n * `publicationState=draft`). `readDrafts` always covers every model and is never granted to admin roles.\n */\nexport const DELIVERY_ACTIONS = ['read', 'readDrafts'] as const;\nexport type DeliveryAction = (typeof DELIVERY_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 'site.settings',\n] as const;\nexport type GlobalAction = (typeof GLOBAL_ACTIONS)[number];\n\nexport type PermissionAction = ContentAction | DeliveryAction | 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 * The stored secrets cannot be decrypted (the server's SESSION_SECRET changed): every literal secret reads\n * as not set until it is entered again; secrets read from the environment are unaffected.\n */\n secretsUnreadable: boolean;\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\n/** An update's result: `generatedSecrets` holds a secret Shapio minted to replace an unreadable one, shown once. */\nexport type DeploymentConnectionUpdated = 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 { DataType, 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\n/**\n * One changed field. `summary` is the server's readable form of each side (rich text as its text, media as\n * filenames, relations as titles, components as labelled items); null when that side is empty.\n */\nexport type FieldDiff = {\n fieldId: string;\n apiKey: string;\n label: string;\n type: DataType;\n before: unknown;\n after: unknown;\n summary: { before: string | null; after: string | null };\n};\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","/**\n * Next.js data-cache support for delivery reads. Under Next (`process.env.NEXT_RUNTIME` is set) or when the\n * client is given a `next` option, every delivery read passes `next: { tags }` to `fetch`, so a site can\n * refresh exactly what changed with `revalidateTag`. The cache mode is only set when asked for, except that a\n * read pinned to a publication snapshot is immutable and always `force-cache`, and a drafts-mode read is never\n * cached or tagged (`no-store`). Elsewhere nothing is added.\n */\n\n/** Next's `fetch` cache modes the client passes through. */\nexport type NextCacheMode = 'force-cache' | 'no-store';\n\nexport type NextCacheOptions = {\n /** Next's `fetch` `cache` option. Unset: Next's own default, except pinned snapshot reads (`force-cache`). */\n cache?: NextCacheMode;\n /** Seconds a cached response stays fresh (`next.revalidate`); `false` keeps it until a tag is revalidated. */\n revalidate?: number | false;\n};\n\n/** The last argument of every delivery read: overrides the client's `next` option; `false` adds nothing. */\nexport type DeliveryReadOptions = { next?: NextCacheOptions | false };\n\n/** What a delivery read adds to its `fetch` init. */\nexport type NextFetchInit = {\n cache?: NextCacheMode;\n next?: { tags: string[]; revalidate?: number | false };\n};\n\nconst TAG_PREFIX = 'shapio';\n\n/**\n * The cache tags delivery reads carry (`revalidateTag(shapioTags.entry('articles', id), { expire: 0 })`).\n * Models are named by their route key: a collection's plural API ID, a singleton's API ID.\n */\nexport const shapioTags = {\n /** Every delivery read of the site; `shapio:site` when the client names no site. */\n site: (siteKey?: string) =>\n siteKey === undefined ? `${TAG_PREFIX}:site` : `${TAG_PREFIX}:site:${siteKey}`,\n /** Every read of one model (lists, singletons and its entries). */\n model: (routeKey: string) => `${TAG_PREFIX}:${routeKey}`,\n /** Reads of one entry by its ID. */\n entry: (routeKey: string, entryId: string) => `${TAG_PREFIX}:${routeKey}:${entryId}`,\n} as const;\n\n/** Spelled out so bundlers that inline `process.env.NEXT_RUNTIME` see it; guarded for browsers. */\nconst isNextRuntime = (): boolean => {\n try {\n return typeof process !== 'undefined' && Boolean(process.env.NEXT_RUNTIME);\n } catch {\n return false;\n }\n};\n\n/** What every delivery read needs to tag itself: the client's site, `next` option and drafts mode. */\nexport type DeliveryCacheContext = {\n site: string | undefined;\n next: NextCacheOptions | false | undefined;\n /** Drafts mode (`drafts: true`): reads ask for drafts, which are never cached. */\n drafts: boolean;\n};\n\nexport type NextReadInput = {\n /** The client's `next` option. */\n client: NextCacheOptions | false | undefined;\n /** The read's own `next` option. */\n read: NextCacheOptions | false | undefined;\n tags: string[];\n /** The read names a publication snapshot (immutable). */\n pinned: boolean;\n /** Drafts mode: under Next (or with any `next` option) the read is `no-store` and untagged. */\n drafts?: boolean;\n};\n\n/** The `cache` and `next` fetch options of one delivery read; empty outside Next unless asked for. */\nexport const nextFetchInit = ({\n client,\n read,\n tags,\n pinned,\n drafts = false,\n}: NextReadInput): NextFetchInit => {\n if (drafts) {\n // Drafts change on every save: never in Next's data cache, never tagged, whatever the `next` options say.\n const asked = (client !== undefined && client !== false) || (read !== undefined && read !== false);\n return asked || isNextRuntime() ? { cache: 'no-store' } : {};\n }\n if (read === false || (read === undefined && client === false)) {\n return {};\n }\n const configured = client === false ? read : read === undefined ? client : { ...client, ...read };\n if (configured === undefined && !isNextRuntime()) {\n return {};\n }\n if (pinned && read?.cache === undefined) {\n return { cache: 'force-cache', next: { tags } };\n }\n const cache = configured?.cache;\n const revalidate = configured?.revalidate;\n return {\n ...(cache === undefined ? {} : { cache }),\n next: { tags, ...(revalidate === undefined ? {} : { revalidate }) },\n };\n};\n","import { toContentQueryString } from './admin/contentQuery.js';\nimport type { DeliveryGetQuery, DeliveryItem, DeliveryList, DeliveryListQuery } from './deliveryTypes.js';\nimport {\n nextFetchInit,\n shapioTags,\n type DeliveryCacheContext,\n type DeliveryReadOptions,\n} from './nextCache.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/**\n * The content query string plus `snapshot`, `richText` and `seo`, which only delivery reads take, and\n * `publicationState=draft` in drafts mode.\n */\nconst deliveryQueryString = (\n { snapshot, richText, seo, ...query }: DeliveryListQuery,\n drafts: boolean,\n): string => {\n const extra = [\n ...(snapshot === undefined ? [] : [`snapshot=${encodeURIComponent(String(snapshot))}`]),\n ...(richText === undefined ? [] : [`richText=${encodeURIComponent(richText)}`]),\n ...(seo === undefined ? [] : [`seo=${encodeURIComponent(seo)}`]),\n ...(drafts ? ['publicationState=draft'] : []),\n ];\n const base = toContentQueryString(query);\n if (extra.length === 0) {\n return base;\n }\n return base ? `${base}&${extra.join('&')}` : `?${extra.join('&')}`;\n};\n\n/** Drafts cannot be pinned: the server refuses `snapshot` with drafts, and so does the client, before sending. */\nconst draftsPinned = () =>\n Promise.reject(\n new Error(\n 'Drafts mode reads saved drafts, which have no publication snapshot: leave `snapshot` out when the client has `drafts: true`',\n ),\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`. Each read\n * takes Next.js cache options last and is tagged for `revalidateTag` (nextCache.ts): lists and singletons with\n * the site and model tags, `get` with the entry's tag too. In drafts mode (`drafts: true`) every read asks for\n * drafts (`publicationState=draft`), is never cached or tagged under Next, and refuses a pinned snapshot.\n */\nexport const createDeliveryApi = (request: RequestFn, cacheContext: DeliveryCacheContext) => {\n const { drafts } = cacheContext;\n const fetchInit = (tags: string[], query: DeliveryGetQuery, { next }: DeliveryReadOptions) =>\n nextFetchInit({\n client: cacheContext.next,\n read: next,\n tags,\n pinned: query.snapshot !== undefined,\n drafts,\n });\n const read = <R>(path: string, tags: string[], query: DeliveryListQuery, options: DeliveryReadOptions) =>\n drafts && query.snapshot !== undefined\n ? draftsPinned()\n : request<R>(`${path}${deliveryQueryString(query, drafts)}`, fetchInit(tags, query, options));\n const siteTag = shapioTags.site(cacheContext.site);\n return {\n list: <T = Record<string, unknown>>(\n routeKey: string,\n query: DeliveryListQuery = {},\n options: DeliveryReadOptions = {},\n ) => read<DeliveryList<T>>(routePath(routeKey), [siteTag, shapioTags.model(routeKey)], query, options),\n singleton: <T = Record<string, unknown>>(\n apiKey: string,\n query: DeliveryGetQuery = {},\n options: DeliveryReadOptions = {},\n ) => read<DeliveryItem<T>>(routePath(apiKey), [siteTag, shapioTags.model(apiKey)], query, options),\n get: <T = Record<string, unknown>>(\n routeKey: string,\n id: string,\n query: DeliveryGetQuery = {},\n options: DeliveryReadOptions = {},\n ) =>\n read<DeliveryItem<T>>(\n `${routePath(routeKey)}/${encodeURIComponent(id)}`,\n [siteTag, shapioTags.model(routeKey), shapioTags.entry(routeKey, id)],\n query,\n options,\n ),\n };\n};\n\nexport type DeliveryApi = ReturnType<typeof createDeliveryApi>;\n","import {\n nextFetchInit,\n shapioTags,\n type DeliveryCacheContext,\n type DeliveryReadOptions,\n} from './nextCache.js';\nimport type { RequestFn } from './request.js';\nimport type { DeliverySite } from './seoTypes.js';\n\nexport const DELIVERY_SITE_PATH = '/api/site';\n\n/**\n * The request's site as delivery sees it (key, name, SEO defaults), with the client's token and site. Under\n * Next.js the read carries the site tag (nextCache.ts); in drafts mode it is `no-store` and untagged instead\n * (the site has no draft state, so no `publicationState` is sent).\n */\nexport const createSiteApi = (request: RequestFn, cacheContext: DeliveryCacheContext) => ({\n get: ({ next }: DeliveryReadOptions = {}) =>\n request<DeliverySite>(\n DELIVERY_SITE_PATH,\n nextFetchInit({\n client: cacheContext.next,\n read: next,\n tags: [shapioTags.site(cacheContext.site)],\n pinned: false,\n drafts: cacheContext.drafts,\n }),\n ),\n});\n\nexport type SiteApi = ReturnType<typeof createSiteApi>;\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 { createDeliveryApi } from './delivery.js';\nimport type { NextCacheOptions } from './nextCache.js';\nimport type { RequestFn } from './request.js';\nimport { createSiteApi } from './siteDelivery.js';\nimport { createSnapshotsApi } from './snapshots.js';\n\nexport type DeliveryClientOptions = {\n /** The site key the reads are tagged with (`shapioTags.site`); the transport names the site itself. */\n site?: string;\n /** Next.js data-cache options, as `createClient`'s `next` option. */\n next?: NextCacheOptions | false;\n /** Drafts mode, as `createClient`'s `drafts` option. */\n drafts?: boolean;\n};\n\n/**\n * The read side of the client over any transport: published content (`delivery`), the site (`site`) and\n * publication snapshots (`snapshots`). `createClient` builds it over HTTP; `@shapio/local` over the delivery\n * API running in the same process. The transport receives exactly the paths the HTTP client sends.\n */\nexport const createDeliveryClient = (\n request: RequestFn,\n { site, next, drafts = false }: DeliveryClientOptions = {},\n) => {\n const cacheContext = { site, next, drafts };\n return {\n /** Published content (the delivery API; drafts in drafts mode), typed by the caller. */\n delivery: createDeliveryApi(request, cacheContext),\n /** The site as delivery sees it: key, name and SEO defaults (`GET /api/site`). */\n site: createSiteApi(request, cacheContext),\n /** Publication snapshots and the diff between two (incremental builds). */\n snapshots: createSnapshotsApi(request),\n };\n};\n\nexport type ShapioDeliveryClient = ReturnType<typeof createDeliveryClient>;\n","import { SITE_HEADER } from './admin/sites.js';\nimport { DELIVERY_PATH } from './delivery.js';\nimport { DELIVERY_SITE_PATH } from './siteDelivery.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, snapshots, the site): a GET there carries the site in its URL. */\nconst DELIVERY_READ_PREFIXES = [\n `${DELIVERY_PATH}/`,\n `${DELIVERY_PATH}?`,\n '/api/snapshots/',\n `${DELIVERY_SITE_PATH}?`,\n] as const;\n\nconst isDeliveryRead = (method: string, path: string) =>\n method === 'GET' &&\n (path === DELIVERY_PATH ||\n path === DELIVERY_SITE_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 type { NextFetchInit } from './nextCache.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 = {\n method?: string;\n body?: unknown;\n signal?: AbortSignal;\n} & NextFetchInit;\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, cache, next }: 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 // `next` is Next.js's extension of fetch (cache tags); other runtimes ignore it, and it is only set there.\n const init: RequestInit & Pick<NextFetchInit, 'next'> = {\n method,\n headers: requestHeaders,\n ...(body !== undefined ? { body: JSON.stringify(body) } : {}),\n ...(signal ? { signal } : {}),\n ...(credentials ? { credentials } : {}),\n ...(cache ? { cache } : {}),\n ...(next ? { next } : {}),\n };\n const response = await fetch(`${origin}${path}`, init);\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 { createDeliveryClient } from './deliveryClient.js';\nimport type { NextCacheOptions } from './nextCache.js';\nimport { createRequest, type FetchCredentials } from './request.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 * Next.js data-cache options for delivery reads (`delivery.*`, `site.get`), e.g. `{ cache: 'force-cache' }`.\n * Under Next the reads are tagged for `revalidateTag` whether or not this is set; the cache mode is only\n * passed when asked for, and reads pinned to a snapshot are always `force-cache`. Set it outside Next to send\n * the same fetch options; `false` sends none. A read's own `next` option overrides this one.\n */\n next?: NextCacheOptions | false;\n /**\n * Drafts mode, for a site's development server: every delivery read asks for drafts\n * (`publicationState=draft`) instead of published content, and under Next is never cached or tagged. Needs\n * a delivery token whose role grants Read drafts (the server refuses others with 403 `DRAFTS_FORBIDDEN`);\n * never set it on a production build. Reads pinned to a `snapshot` are refused. `snapshots` is unaffected.\n */\n drafts?: boolean;\n};\n\nexport const createClient = ({\n baseUrl,\n token,\n fetch = globalThis.fetch,\n credentials,\n headers,\n site,\n next,\n drafts,\n}: ShapioClientOptions) => {\n const request = createRequest({ baseUrl, token, fetch, credentials, headers, site });\n const reads = createDeliveryClient(request, { site, next, ...(drafts !== undefined ? { drafts } : {}) });\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: reads.delivery,\n /** The site as delivery sees it: key, name and SEO defaults (`GET /api/site`). */\n site: reads.site,\n admin: createAdminApi(request),\n /** Publication snapshots and the diff between two (incremental builds). */\n snapshots: reads.snapshots,\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,S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ibility, tn as MediaAsset } from "./index-BWuxc5nS.js";
1
+ import { Lt as ShapioClient, fn as MediaVisibility, tn as MediaAsset } from "./index-D_PFUTmi.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.5.4",
3
+ "version": "0.5.6",
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.5.4"
35
+ "@shapio/schema": "0.5.6"
36
36
  },
37
37
  "devDependencies": {
38
38
  "tsdown": "0.23.0",