@shapio/client 0.5.0 → 0.5.2

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.
@@ -5,7 +5,8 @@ import { ChangeSummary, ClassifiedChange, DefinitionInput, ExportedDefinition, L
5
5
  * Next.js data-cache support for delivery reads. Under Next (`process.env.NEXT_RUNTIME` is set) or when the
6
6
  * client is given a `next` option, every delivery read passes `next: { tags }` to `fetch`, so a site can
7
7
  * refresh exactly what changed with `revalidateTag`. The cache mode is only set when asked for, except that a
8
- * read pinned to a publication snapshot is immutable and always `force-cache`. Elsewhere nothing is added.
8
+ * read pinned to a publication snapshot is immutable and always `force-cache`, and a drafts-mode read is never
9
+ * cached or tagged (`no-store`). Elsewhere nothing is added.
9
10
  */
10
11
  /** Next's `fetch` cache modes the client passes through. */
11
12
  type NextCacheMode = 'force-cache' | 'no-store';
@@ -39,10 +40,12 @@ declare const shapioTags: {
39
40
  /** Reads of one entry by its ID. */
40
41
  readonly entry: (routeKey: string, entryId: string) => string;
41
42
  };
42
- /** What every delivery read needs to tag itself: the client's site and `next` option. */
43
+ /** What every delivery read needs to tag itself: the client's site, `next` option and drafts mode. */
43
44
  type DeliveryCacheContext = {
44
45
  site: string | undefined;
45
46
  next: NextCacheOptions | false | undefined;
47
+ /** Drafts mode (`drafts: true`): reads ask for drafts, which are never cached. */
48
+ drafts: boolean;
46
49
  };
47
50
  //#endregion
48
51
  //#region src/request.d.ts
@@ -258,6 +261,8 @@ type DeliveryGetQuery = Pick<DeliveryListQuery, 'locale' | 'fields' | 'populate'
258
261
  type DeliveryMeta = {
259
262
  locale: string;
260
263
  snapshot: number;
264
+ /** Drafts mode reads only (`publicationState=draft`); published responses carry no such member. */
265
+ publicationState?: 'draft';
261
266
  };
262
267
  type DeliveryPagination = {
263
268
  page: number;
@@ -1253,6 +1258,12 @@ type AdminUser = {
1253
1258
  };
1254
1259
  declare const CONTENT_ACTIONS: readonly ["read", "create", "update", "delete", "publish", "schemaManage"];
1255
1260
  type ContentAction = (typeof CONTENT_ACTIONS)[number];
1261
+ /**
1262
+ * What a delivery role grants: `read`, and `readDrafts` (drafts mode: the token's site may read drafts with
1263
+ * `publicationState=draft`). `readDrafts` always covers every model and is never granted to admin roles.
1264
+ */
1265
+ declare const DELIVERY_ACTIONS: readonly ["read", "readDrafts"];
1266
+ type DeliveryAction = (typeof DELIVERY_ACTIONS)[number];
1256
1267
  /**
1257
1268
  * Network actions: about the whole instance. Only roles assigned on every site grant them, so a role held
1258
1269
  * on one site never reaches the network.
@@ -1265,7 +1276,7 @@ type SiteAction = (typeof SITE_ACTIONS)[number];
1265
1276
  /** Actions not scoped to a model: network actions and site actions. */
1266
1277
  declare const GLOBAL_ACTIONS: readonly ["schema.create", "users.manage", "roles.manage", "tokens.manage", "audit.read", "sites.manage", "media.read", "media.write", "media.manage", "publishing.manage", "webhooks.manage", "deployments.manage", "deployments.trigger", "changes.manage", "changes.ship", "site.settings"];
1267
1278
  type GlobalAction = (typeof GLOBAL_ACTIONS)[number];
1268
- type PermissionAction = ContentAction | GlobalAction;
1279
+ type PermissionAction = ContentAction | DeliveryAction | GlobalAction;
1269
1280
  type RoleSummary = {
1270
1281
  id: string;
1271
1282
  key: string;
@@ -1843,8 +1854,15 @@ type ShapioClientOptions = {
1843
1854
  * the same fetch options; `false` sends none. A read's own `next` option overrides this one.
1844
1855
  */
1845
1856
  next?: NextCacheOptions | false;
1857
+ /**
1858
+ * Drafts mode, for a site's development server: every delivery read asks for drafts
1859
+ * (`publicationState=draft`) instead of published content, and under Next is never cached or tagged. Needs
1860
+ * a delivery token whose role grants Read drafts (the server refuses others with 403 `DRAFTS_FORBIDDEN`);
1861
+ * never set it on a production build. Reads pinned to a `snapshot` are refused. `snapshots` is unaffected.
1862
+ */
1863
+ drafts?: boolean;
1846
1864
  };
1847
- declare const createClient: ({ baseUrl, token, fetch, credentials, headers, site, next }: ShapioClientOptions) => {
1865
+ declare const createClient: ({ baseUrl, token, fetch, credentials, headers, site, next, drafts }: ShapioClientOptions) => {
1848
1866
  /**
1849
1867
  * Any Shapio route, e.g. the delivery API. Delivery paths use the model's route key: a collection's
1850
1868
  * plural API ID (`request('/api/content/articles')`, `/api/content/articles/<id>`), a singleton's API ID
@@ -2803,7 +2821,8 @@ declare const DELIVERY_PATH = "/api/content";
2803
2821
  * Published content, typed by the caller (`delivery.list<Article>('articles', { locale: 'fr', snapshot })`).
2804
2822
  * A collection is read with `list` (a page) and `get` (one entry); a singleton with `singleton`. Each read
2805
2823
  * takes Next.js cache options last and is tagged for `revalidateTag` (nextCache.ts): lists and singletons with
2806
- * the site and model tags, `get` with the entry's tag too.
2824
+ * the site and model tags, `get` with the entry's tag too. In drafts mode (`drafts: true`) every read asks for
2825
+ * drafts (`publicationState=draft`), is never cached or tagged under Next, and refuses a pinned snapshot.
2807
2826
  */
2808
2827
  declare const createDeliveryApi: (request: RequestFn, cacheContext: DeliveryCacheContext) => {
2809
2828
  list: <T = Record<string, unknown>>(routeKey: string, query?: DeliveryListQuery, options?: DeliveryReadOptions) => Promise<DeliveryList<T>>;
@@ -2818,14 +2837,16 @@ type DeliveryClientOptions = {
2818
2837
  site?: string;
2819
2838
  /** Next.js data-cache options, as `createClient`'s `next` option. */
2820
2839
  next?: NextCacheOptions | false;
2840
+ /** Drafts mode, as `createClient`'s `drafts` option. */
2841
+ drafts?: boolean;
2821
2842
  };
2822
2843
  /**
2823
2844
  * The read side of the client over any transport: published content (`delivery`), the site (`site`) and
2824
2845
  * publication snapshots (`snapshots`). `createClient` builds it over HTTP; `@shapio/local` over the delivery
2825
2846
  * API running in the same process. The transport receives exactly the paths the HTTP client sends.
2826
2847
  */
2827
- declare const createDeliveryClient: (request: RequestFn, { site, next }?: DeliveryClientOptions) => {
2828
- /** Published content (the delivery API), typed by the caller. */
2848
+ declare const createDeliveryClient: (request: RequestFn, { site, next, drafts }?: DeliveryClientOptions) => {
2849
+ /** Published content (the delivery API; drafts in drafts mode), typed by the caller. */
2829
2850
  delivery: {
2830
2851
  list: <T = Record<string, unknown>>(routeKey: string, query?: DeliveryListQuery, options?: DeliveryReadOptions) => Promise<DeliveryList<T>>;
2831
2852
  singleton: <T = Record<string, unknown>>(apiKey: string, query?: DeliveryGetQuery, options?: DeliveryReadOptions) => Promise<DeliveryItem<T>>;
@@ -2860,7 +2881,8 @@ declare const SITE_QUERY_PARAMETER = "site";
2860
2881
  declare const DELIVERY_SITE_PATH = "/api/site";
2861
2882
  /**
2862
2883
  * The request's site as delivery sees it (key, name, SEO defaults), with the client's token and site. Under
2863
- * Next.js the read carries the site tag (nextCache.ts).
2884
+ * Next.js the read carries the site tag (nextCache.ts); in drafts mode it is `no-store` and untagged instead
2885
+ * (the site has no draft state, so no `publicationState` is sent).
2864
2886
  */
2865
2887
  declare const createSiteApi: (request: RequestFn, cacheContext: DeliveryCacheContext) => {
2866
2888
  get: ({ next }?: DeliveryReadOptions) => Promise<DeliverySite>;
@@ -3030,5 +3052,5 @@ declare const codeChallengeOf: (codeVerifier: string) => Promise<string>;
3030
3052
  /** A fresh verifier (32 random bytes, 43 characters) and its S256 challenge. */
3031
3053
  declare const createPkcePair: () => Promise<AppPkcePair>;
3032
3054
  //#endregion
3033
- export { ContentHealthSummary as $, AdminEntryPage as $a, DeploymentTriggerPolicy as $i, LoginInput as $n, SnapshotPage as $r, CreateMediaFolderInput as $t, DELIVERY_SITE_PATH as A, PrincipalUsageSummary as Aa, SetDefaultLocaleResult as Ai, AcceptInvitationInput as An, ChangeSetSchemaItem as Ar, SchemaDraftInput as At, buildUploadForm as B, DeliverySite as Ba, DEPLOYMENT_RUN_STATUSES as Bi, ChangePasswordInput as Bn, NotRestorable as Br, CheckStatus as Bt, WEBHOOK_EVENT_HEADER as C, WebhookEventBody as Ca, PlanStepImpact as Ci, AppRolePermission as Cn, RequestOptions as Co, ChangeSetActor as Cr, ContentOpsRule as Ct, WebhookSignatureCheck as D, FieldUsageQuery as Da, SchemaSettings as Di, CreateAppRoleInput as Dn, shapioTags as Do, ChangeSetItemStatus as Dr, ContentOpsWritten as Dt, WEBHOOK_TOLERANCE_SECONDS as E, FieldPrincipalUsage as Ea, SchemaChangeStatus as Ei, BUILT_IN_APP_ROLE_KEYS as En, NextCacheOptions as Eo, ChangeSetItem as Er, ContentOpsStatus as Et, createDeliveryClient as F, SiteAppRoles as Fa, CreateDeploymentConnectionInput as Fi, AuditActorType as Fn, CreateChangeSetInput as Fr, ShapioApiError as Ft, ADMIN_PATHS as G, DeliveryList as Ga, DeploymentRun as Gi, CsrfResponse as Gn, ReviewSchemaItem as Gr, SnapshotChange as Gt, toContentQueryString as H, SeoResolved as Ha, DeploymentConnection as Hi, CreateApiTokenInput as Hn, PutSchemaDraftInput as Hr, ReadyResponse as Ht, DELIVERY_PATH as I, SiteRef as Ia, CreatePreviewTokenInput as Ii, AuditEvent as In, FieldConsumer as Ir, ShapioErrorBody as It, ContentCount as J, DeliveryPagination as Ja, DeploymentRunTrigger as Ji, GlobalAction as Jn, SchemaDraft as Jr, SnapshotChangesQuery as Jt, CheckParams as K, DeliveryListQuery as Ka, DeploymentRunQuery as Ki, EmailDelivery as Kn, SNAPSHOT_SOURCES as Kr, SnapshotChangeKind as Kt, DeliveryApi as L, SiteSummary as La, CreateScheduleInput as Li, AuditPage as Ln, FieldConsumers as Lr, ShapioClient as Lt, SITE_QUERY_PARAMETER as M, CreateSiteInput as Ma, UpdateLocaleInput as Mi, AdminUser as Mn, ChangeSetStatus as Mr, SummarizeInput as Mt, DeliveryClientOptions as N, SetSiteAppRolesInput as Na, UpdateSchemaSettingsInput as Ni, AdminUserStatus as Nn, ChangeSetSummary as Nr, TranslateInput as Nt, WebhookSignatureInput as O, FieldUsageResponse as Oa, SchemaSummary as Oi, UpdateAppRoleInput as On, ChangeSetQuery as Or, LocaleMissingResult as Ot, ShapioDeliveryClient as P, Site as Pa, ConnectionTestResult as Pi, ApiToken as Pn, ChangeSetTimelineEvent as Pr, TranslateResult as Pt, ContentHealthQuery as Q, AdminEntryListItem as Qa, DeploymentTimelineEvent as Qi, InviteUserInput as Qn, Snapshot as Qr, SchemaSyncResult as Qt, AdminApi as R, UpdateSiteInput as Ra, CreateWebhookInput as Ri, AuditQuery as Rn, FieldDiff as Rr, ShapioClientOptions as Rt, AppUser as S, WebhookDeliveryStatus as Sa, PlanStep as Si, AppRole as Sn, RequestFn as So, ChangeSet as Sr, ContentOpsResult as St, WEBHOOK_TIMESTAMP_HEADER as T, WebhookWithSecret as Ta, SchemaChangeJob as Ti, AppUserQuery as Tn, NextCacheMode as To, ChangeSetError as Tr, ContentOpsSkip as Tt, SITES_PATHS as U, DeliveryGetQuery as Ua, DeploymentConnectionCreated as Ui, CreateRoleInput as Un, ReviewEntryItem as Ur, VersionResponse as Ut, resolveUploadUrl as V, SeoFields as Va, DEPLOYMENT_TRIGGERS as Vi, ContentAction as Vn, NotRestorableReason as Vr, HealthResponse as Vt, SITE_HEADER as W, DeliveryItem as Wa, DeploymentProvider as Wi, CreatedApiToken as Wn, ReviewIssue as Wr, CurrentSnapshot as Wt, ContentHealthFinding as X, SeoMode as Xa, DeploymentSecretsInput as Xi, Invitation as Xn, ShipChangeSetInput as Xr, SchemaApplyResult as Xt, ContentCounts as Y, RichTextMode as Ya, DeploymentSecretState as Yi, InspectInvitationResponse as Yn, SchemaOperation as Yr, SchemaApplyInput as Yt, ContentHealthPage as Z, AdminEntry as Za, DeploymentSettings as Zi, InvitationLink as Zn, ShipPhase as Zr, SchemaExport as Zt, AppLoginInput as _, UpdateDeploymentConnectionInput as _a, DefinitionScope as _i, UpdateMediaFolderInput as _n, ExtensionTheme as _o, UpdateAdminUserInput as _r, AssistStatus as _t, SeoDefaults as a, OpenPreviewInput as aa, ActiveDefinition as ai, MediaFocalPoint as an, ContentPagination as ao, PermissionAction as ar, PreflightInput as at, AppRegisterResult as b, WebhookAttempt as ba, PlanImpact as bi, AdminAppUser as bn, RevisionSummary as bo, AddChangeSetEntryInput as br, CONTENT_OPS_RULES as bt, applyTitleTemplate as c, Page as ca, ChangeScopeInput as ci, MediaUsage as cn, EditorManifest as co, RoleCondition as cr, PreflightRule as ct, AppPkcePair as d, PreviewTokenCreated as da, CreateLocaleInput as di, MediaVariantStatus as dn, EntryData as do, RoleSummary as dr, AltMissingResult as dt, JOB_STATUSES as ea, SnapshotQuery as ei, CreateUploadInput as en, ContentFilter as eo, MeResponse as er, EntryPresence as et, codeChallengeOf as f, PublicationAction as fa, DefinitionCategory as fi, MediaVisibility as fn, EntryLocaleState as fo, SITE_ACTIONS as fr, AltProposal as ft, AppChangePasswordInput as g, ScheduledPublication as ga, DefinitionRevision as gi, UpdateMediaAssetInput as gn, EntryStatus as go, SiteAction as gr, AssistProvider as gt, AppAuthApi as h, ScheduleStatus as ha, DefinitionPayload as hi, ReplaceUploadInput as hn, EntryReferrer as ho, SetupStatusResponse as hr, AssistIssue as ht, SEO_FIELD_IDS as i, JobSummary as ia, Acknowledgement as ii, MediaAssetStatus as in, ContentListQuery as io, PasswordResetRequestInput as ir, PreflightCheck as it, SiteApi as j, UsageSelection as ja, UpdateDefinitionInput as ji, AdminSession as jn, ChangeSetSource as jr, SchemaDraftResult as jt, verifyWebhookSignature as k, ModelFieldUsage as ka, SchemaSummaryItem as ki, UpdateAppUserInput as kn, ChangeSetReview as kr, RewriteInput as kt, resolveSeo as l, PreviewTarget as la, ChangeScopeOutcome as li, MediaUsagePage as ln, EditorManifestItem as lo, RoleKind as lr, PresenceHeartbeatInput as lt, APP_AUTH_PATHS as m, ScheduleQuery as ma, DefinitionListItem as mi, MoveMediaAssetsResult as mn, EntryLocalesInput as mo, SetupInput as mr, AltTextResult as mt, ResolveSeoContext as n, JobQuery as na, UnassignedEntry as ni, MediaAssetPage as nn, ContentFilterValue as no, NetworkAction as nr, HealthRule as nt, SeoKeys as o, OpenPreviewResult as oa, ChangeOutcome as oi, MediaFolder as on, ContentSort as oo, Role as or, PreflightLocale as ot, createPkcePair as p, SCHEDULE_STATUSES as pa, DefinitionDetail as pi, MoveMediaAssetsInput as pn, EntryLocaleStatus as po, SessionStarted as pr, AltTextInput as pt, CheckSeverity as q, DeliveryMeta as qa, DeploymentRunStatus as qi, GLOBAL_ACTIONS as qn, ScheduleChangeSetInput as qr, SnapshotChangesPage as qt, SEO_COMPONENT_ID as r, JobStatus as ra, UpdateChangeSetInput as ri, MediaAssetQuery as rn, ContentIssue as ro, PasswordResetConfirmInput as rr, ModelPresence as rt, SeoLocaleDefaults$1 as s, PUBLICATION_ACTIONS as sa, ChangePlan as si, MediaStorageDriver as sn, CreateEntryInput as so, RoleAssignment as sr, PreflightResponse as st, DEFAULT_SEO_KEYS as t, Job as ta, SnapshotSource as ti, MediaAsset as tn, ContentFilterOperator as to, NETWORK_ACTIONS as tr, HEALTH_RULES as tt, seoDefaultsForLocale as u, PreviewToken as ua, CreateDefinitionInput as ui, MediaVariant as un, EntryAuthor as uo, RolePermission as ur, PresencePerson as ut, AppOAuthProvider as v, UpdateWebhookInput as va, DeleteLocaleResult as vi, UploadGrant as vn, ExtensionThemeList as vo, UpdateProfileInput as vr, AssistTextResult as vt, WEBHOOK_SIGNATURE_HEADER as w, WebhookEventType as wa, PlanUpdateInput as wi, AppUserPage as wn, DeliveryReadOptions as wo, ChangeSetEntryItem as wr, ContentOpsRun as wt, AppSession as x, WebhookDelivery as xa, PlanPreview as xi, AppContentAction as xn, UpdateEntryInput as xo, CHANGE_SET_STATUSES as xr, ContentOpsInput as xt, AppRegisterInput as y, Webhook as ya, Locale as yi, APP_CONTENT_ACTIONS as yn, RevisionDetail as yo, UpdateRoleInput as yr, AssistUsage as yt, ASSIST_PATHS as z, DeliveryAsset as za, DEPLOYMENT_PROVIDERS as zi, CONTENT_ACTIONS as zn, NOT_RESTORABLE_REASONS as zr, createClient as zt };
3034
- //# sourceMappingURL=index-C48tjTFc.d.ts.map
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
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $ as ContentHealthSummary, $a as AdminEntryPage, $i as DeploymentTriggerPolicy, $n as LoginInput, $r as SnapshotPage, $t as CreateMediaFolderInput, A as DELIVERY_SITE_PATH, Aa as PrincipalUsageSummary, Ai as SetDefaultLocaleResult, An as AcceptInvitationInput, Ar as ChangeSetSchemaItem, At as SchemaDraftInput, B as buildUploadForm, Ba as DeliverySite, Bi as DEPLOYMENT_RUN_STATUSES, Bn as ChangePasswordInput, Br as NotRestorable, Bt as CheckStatus, C as WEBHOOK_EVENT_HEADER, Ca as WebhookEventBody, Ci as PlanStepImpact, Cn as AppRolePermission, Co as RequestOptions, Cr as ChangeSetActor, Ct as ContentOpsRule, D as WebhookSignatureCheck, Da as FieldUsageQuery, Di as SchemaSettings, Dn as CreateAppRoleInput, Do as shapioTags, Dr as ChangeSetItemStatus, Dt as ContentOpsWritten, E as WEBHOOK_TOLERANCE_SECONDS, Ea as FieldPrincipalUsage, Ei as SchemaChangeStatus, En as BUILT_IN_APP_ROLE_KEYS, Eo as NextCacheOptions, Er as ChangeSetItem, Et as ContentOpsStatus, F as createDeliveryClient, Fa as SiteAppRoles, Fi as CreateDeploymentConnectionInput, Fn as AuditActorType, Fr as CreateChangeSetInput, Ft as ShapioApiError, G as ADMIN_PATHS, Ga as DeliveryList, Gi as DeploymentRun, Gn as CsrfResponse, Gr as ReviewSchemaItem, Gt as SnapshotChange, H as toContentQueryString, Ha as SeoResolved, Hi as DeploymentConnection, Hn as CreateApiTokenInput, Hr as PutSchemaDraftInput, Ht as ReadyResponse, I as DELIVERY_PATH, Ia as SiteRef, Ii as CreatePreviewTokenInput, In as AuditEvent, Ir as FieldConsumer, It as ShapioErrorBody, J as ContentCount, Ja as DeliveryPagination, Ji as DeploymentRunTrigger, Jn as GlobalAction, Jr as SchemaDraft, Jt as SnapshotChangesQuery, K as CheckParams, Ka as DeliveryListQuery, Ki as DeploymentRunQuery, Kn as EmailDelivery, Kr as SNAPSHOT_SOURCES, Kt as SnapshotChangeKind, L as DeliveryApi, La as SiteSummary, Li as CreateScheduleInput, Ln as AuditPage, Lr as FieldConsumers, Lt as ShapioClient, M as SITE_QUERY_PARAMETER, Ma as CreateSiteInput, Mi as UpdateLocaleInput, Mn as AdminUser, Mr as ChangeSetStatus, Mt as SummarizeInput, N as DeliveryClientOptions, Na as SetSiteAppRolesInput, Ni as UpdateSchemaSettingsInput, Nn as AdminUserStatus, Nr as ChangeSetSummary, Nt as TranslateInput, O as WebhookSignatureInput, Oa as FieldUsageResponse, Oi as SchemaSummary, On as UpdateAppRoleInput, Or as ChangeSetQuery, Ot as LocaleMissingResult, P as ShapioDeliveryClient, Pa as Site, Pi as ConnectionTestResult, Pn as ApiToken, Pr as ChangeSetTimelineEvent, Pt as TranslateResult, Q as ContentHealthQuery, Qa as AdminEntryListItem, Qi as DeploymentTimelineEvent, Qn as InviteUserInput, Qr as Snapshot, Qt as SchemaSyncResult, R as AdminApi, Ra as UpdateSiteInput, Ri as CreateWebhookInput, Rn as AuditQuery, Rr as FieldDiff, Rt as ShapioClientOptions, S as AppUser, Sa as WebhookDeliveryStatus, Si as PlanStep, Sn as AppRole, So as RequestFn, Sr as ChangeSet, St as ContentOpsResult, T as WEBHOOK_TIMESTAMP_HEADER, Ta as WebhookWithSecret, Ti as SchemaChangeJob, Tn as AppUserQuery, To as NextCacheMode, Tr as ChangeSetError, Tt as ContentOpsSkip, U as SITES_PATHS, Ua as DeliveryGetQuery, Ui as DeploymentConnectionCreated, Un as CreateRoleInput, Ur as ReviewEntryItem, Ut as VersionResponse, V as resolveUploadUrl, Va as SeoFields, Vi as DEPLOYMENT_TRIGGERS, Vn as ContentAction, Vr as NotRestorableReason, Vt as HealthResponse, W as SITE_HEADER, Wa as DeliveryItem, Wi as DeploymentProvider, Wn as CreatedApiToken, Wr as ReviewIssue, Wt as CurrentSnapshot, X as ContentHealthFinding, Xa as SeoMode, Xi as DeploymentSecretsInput, Xn as Invitation, Xr as ShipChangeSetInput, Xt as SchemaApplyResult, Y as ContentCounts, Ya as RichTextMode, Yi as DeploymentSecretState, Yn as InspectInvitationResponse, Yr as SchemaOperation, Yt as SchemaApplyInput, Z as ContentHealthPage, Za as AdminEntry, Zi as DeploymentSettings, Zn as InvitationLink, Zr as ShipPhase, Zt as SchemaExport, _ as AppLoginInput, _a as UpdateDeploymentConnectionInput, _i as DefinitionScope, _n as UpdateMediaFolderInput, _o as ExtensionTheme, _r as UpdateAdminUserInput, _t as AssistStatus, a as SeoDefaults, aa as OpenPreviewInput, ai as ActiveDefinition, an as MediaFocalPoint, ao as ContentPagination, ar as PermissionAction, at as PreflightInput, b as AppRegisterResult, ba as WebhookAttempt, bi as PlanImpact, bn as AdminAppUser, bo as RevisionSummary, br as AddChangeSetEntryInput, bt as CONTENT_OPS_RULES, c as applyTitleTemplate, ca as Page, ci as ChangeScopeInput, cn as MediaUsage, co as EditorManifest, cr as RoleCondition, ct as PreflightRule, d as AppPkcePair, da as PreviewTokenCreated, di as CreateLocaleInput, dn as MediaVariantStatus, do as EntryData, dr as RoleSummary, dt as AltMissingResult, ea as JOB_STATUSES, ei as SnapshotQuery, en as CreateUploadInput, eo as ContentFilter, er as MeResponse, et as EntryPresence, f as codeChallengeOf, fa as PublicationAction, fi as DefinitionCategory, fn as MediaVisibility, fo as EntryLocaleState, fr as SITE_ACTIONS, ft as AltProposal, g as AppChangePasswordInput, ga as ScheduledPublication, gi as DefinitionRevision, gn as UpdateMediaAssetInput, go as EntryStatus, gr as SiteAction, gt as AssistProvider, h as AppAuthApi, ha as ScheduleStatus, hi as DefinitionPayload, hn as ReplaceUploadInput, ho as EntryReferrer, hr as SetupStatusResponse, ht as AssistIssue, i as SEO_FIELD_IDS, ia as JobSummary, ii as Acknowledgement, in as MediaAssetStatus, io as ContentListQuery, ir as PasswordResetRequestInput, it as PreflightCheck, j as SiteApi, ja as UsageSelection, ji as UpdateDefinitionInput, jn as AdminSession, jr as ChangeSetSource, jt as SchemaDraftResult, k as verifyWebhookSignature, ka as ModelFieldUsage, ki as SchemaSummaryItem, kn as UpdateAppUserInput, kr as ChangeSetReview, kt as RewriteInput, l as resolveSeo, la as PreviewTarget, li as ChangeScopeOutcome, ln as MediaUsagePage, lo as EditorManifestItem, lr as RoleKind, lt as PresenceHeartbeatInput, m as APP_AUTH_PATHS, ma as ScheduleQuery, mi as DefinitionListItem, mn as MoveMediaAssetsResult, mo as EntryLocalesInput, mr as SetupInput, mt as AltTextResult, n as ResolveSeoContext, na as JobQuery, ni as UnassignedEntry, nn as MediaAssetPage, no as ContentFilterValue, nr as NetworkAction, nt as HealthRule, o as SeoKeys, oa as OpenPreviewResult, oi as ChangeOutcome, on as MediaFolder, oo as ContentSort, or as Role, ot as PreflightLocale, p as createPkcePair, pa as SCHEDULE_STATUSES, pi as DefinitionDetail, pn as MoveMediaAssetsInput, po as EntryLocaleStatus, pr as SessionStarted, pt as AltTextInput, q as CheckSeverity, qa as DeliveryMeta, qi as DeploymentRunStatus, qn as GLOBAL_ACTIONS, qr as ScheduleChangeSetInput, qt as SnapshotChangesPage, r as SEO_COMPONENT_ID, ra as JobStatus, ri as UpdateChangeSetInput, rn as MediaAssetQuery, ro as ContentIssue, rr as PasswordResetConfirmInput, rt as ModelPresence, s as SeoLocaleDefaults, sa as PUBLICATION_ACTIONS, si as ChangePlan, sn as MediaStorageDriver, so as CreateEntryInput, sr as RoleAssignment, st as PreflightResponse, t as DEFAULT_SEO_KEYS, ta as Job, ti as SnapshotSource, tn as MediaAsset, to as ContentFilterOperator, tr as NETWORK_ACTIONS, tt as HEALTH_RULES, u as seoDefaultsForLocale, ua as PreviewToken, ui as CreateDefinitionInput, un as MediaVariant, uo as EntryAuthor, ur as RolePermission, ut as PresencePerson, v as AppOAuthProvider, va as UpdateWebhookInput, vi as DeleteLocaleResult, vn as UploadGrant, vo as ExtensionThemeList, vr as UpdateProfileInput, vt as AssistTextResult, w as WEBHOOK_SIGNATURE_HEADER, wa as WebhookEventType, wi as PlanUpdateInput, wn as AppUserPage, wo as DeliveryReadOptions, wr as ChangeSetEntryItem, wt as ContentOpsRun, x as AppSession, xa as WebhookDelivery, xi as PlanPreview, xn as AppContentAction, xo as UpdateEntryInput, xr as CHANGE_SET_STATUSES, xt as ContentOpsInput, y as AppRegisterInput, ya as Webhook, yi as Locale, yn as APP_CONTENT_ACTIONS, yo as RevisionDetail, yr as UpdateRoleInput, yt as AssistUsage, z as ASSIST_PATHS, za as DeliveryAsset, zi as DEPLOYMENT_PROVIDERS, zn as CONTENT_ACTIONS, zr as NOT_RESTORABLE_REASONS, zt as createClient } from "./index-C48tjTFc.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_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 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 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 };
package/dist/index.js CHANGED
@@ -457,6 +457,11 @@ const CONTENT_ACTIONS = [
457
457
  "schemaManage"
458
458
  ];
459
459
  /**
460
+ * What a delivery role grants: `read`, and `readDrafts` (drafts mode: the token's site may read drafts with
461
+ * `publicationState=draft`). `readDrafts` always covers every model and is never granted to admin roles.
462
+ */
463
+ const DELIVERY_ACTIONS = ["read", "readDrafts"];
464
+ /**
460
465
  * Network actions: about the whole instance. Only roles assigned on every site grant them, so a role held
461
466
  * on one site never reaches the network.
462
467
  */
@@ -822,7 +827,8 @@ const isNextRuntime = () => {
822
827
  }
823
828
  };
824
829
  /** The `cache` and `next` fetch options of one delivery read; empty outside Next unless asked for. */
825
- const nextFetchInit = ({ client, read, tags, pinned }) => {
830
+ const nextFetchInit = ({ client, read, tags, pinned, drafts = false }) => {
831
+ if (drafts) return client !== void 0 && client !== false || read !== void 0 && read !== false || isNextRuntime() ? { cache: "no-store" } : {};
826
832
  if (read === false || read === void 0 && client === false) return {};
827
833
  const configured = client === false ? read : read === void 0 ? client : {
828
834
  ...client,
@@ -847,39 +853,49 @@ const nextFetchInit = ({ client, read, tags, pinned }) => {
847
853
  //#region src/delivery.ts
848
854
  const DELIVERY_PATH = "/api/content";
849
855
  const routePath = (routeKey) => `${DELIVERY_PATH}/${encodeURIComponent(routeKey)}`;
850
- /** The content query string plus `snapshot`, `richText` and `seo`, which only delivery reads take. */
851
- const deliveryQueryString = ({ snapshot, richText, seo, ...query }) => {
856
+ /**
857
+ * The content query string plus `snapshot`, `richText` and `seo`, which only delivery reads take, and
858
+ * `publicationState=draft` in drafts mode.
859
+ */
860
+ const deliveryQueryString = ({ snapshot, richText, seo, ...query }, drafts) => {
852
861
  const extra = [
853
862
  ...snapshot === void 0 ? [] : [`snapshot=${encodeURIComponent(String(snapshot))}`],
854
863
  ...richText === void 0 ? [] : [`richText=${encodeURIComponent(richText)}`],
855
- ...seo === void 0 ? [] : [`seo=${encodeURIComponent(seo)}`]
864
+ ...seo === void 0 ? [] : [`seo=${encodeURIComponent(seo)}`],
865
+ ...drafts ? ["publicationState=draft"] : []
856
866
  ];
857
867
  const base = toContentQueryString(query);
858
868
  if (extra.length === 0) return base;
859
869
  return base ? `${base}&${extra.join("&")}` : `?${extra.join("&")}`;
860
870
  };
871
+ /** Drafts cannot be pinned: the server refuses `snapshot` with drafts, and so does the client, before sending. */
872
+ const draftsPinned = () => Promise.reject(/* @__PURE__ */ new Error("Drafts mode reads saved drafts, which have no publication snapshot: leave `snapshot` out when the client has `drafts: true`"));
861
873
  /**
862
874
  * Published content, typed by the caller (`delivery.list<Article>('articles', { locale: 'fr', snapshot })`).
863
875
  * A collection is read with `list` (a page) and `get` (one entry); a singleton with `singleton`. Each read
864
876
  * takes Next.js cache options last and is tagged for `revalidateTag` (nextCache.ts): lists and singletons with
865
- * the site and model tags, `get` with the entry's tag too.
877
+ * the site and model tags, `get` with the entry's tag too. In drafts mode (`drafts: true`) every read asks for
878
+ * drafts (`publicationState=draft`), is never cached or tagged under Next, and refuses a pinned snapshot.
866
879
  */
867
880
  const createDeliveryApi = (request, cacheContext) => {
881
+ const { drafts } = cacheContext;
868
882
  const fetchInit = (tags, query, { next }) => nextFetchInit({
869
883
  client: cacheContext.next,
870
884
  read: next,
871
885
  tags,
872
- pinned: query.snapshot !== void 0
886
+ pinned: query.snapshot !== void 0,
887
+ drafts
873
888
  });
889
+ const read = (path, tags, query, options) => drafts && query.snapshot !== void 0 ? draftsPinned() : request(`${path}${deliveryQueryString(query, drafts)}`, fetchInit(tags, query, options));
874
890
  const siteTag = shapioTags.site(cacheContext.site);
875
891
  return {
876
- list: (routeKey, query = {}, options = {}) => request(`${routePath(routeKey)}${deliveryQueryString(query)}`, fetchInit([siteTag, shapioTags.model(routeKey)], query, options)),
877
- singleton: (apiKey, query = {}, options = {}) => request(`${routePath(apiKey)}${deliveryQueryString(query)}`, fetchInit([siteTag, shapioTags.model(apiKey)], query, options)),
878
- get: (routeKey, id, query = {}, options = {}) => request(`${routePath(routeKey)}/${encodeURIComponent(id)}${deliveryQueryString(query)}`, fetchInit([
892
+ list: (routeKey, query = {}, options = {}) => read(routePath(routeKey), [siteTag, shapioTags.model(routeKey)], query, options),
893
+ singleton: (apiKey, query = {}, options = {}) => read(routePath(apiKey), [siteTag, shapioTags.model(apiKey)], query, options),
894
+ get: (routeKey, id, query = {}, options = {}) => read(`${routePath(routeKey)}/${encodeURIComponent(id)}`, [
879
895
  siteTag,
880
896
  shapioTags.model(routeKey),
881
897
  shapioTags.entry(routeKey, id)
882
- ], query, options))
898
+ ], query, options)
883
899
  };
884
900
  };
885
901
  //#endregion
@@ -887,13 +903,15 @@ const createDeliveryApi = (request, cacheContext) => {
887
903
  const DELIVERY_SITE_PATH = "/api/site";
888
904
  /**
889
905
  * The request's site as delivery sees it (key, name, SEO defaults), with the client's token and site. Under
890
- * Next.js the read carries the site tag (nextCache.ts).
906
+ * Next.js the read carries the site tag (nextCache.ts); in drafts mode it is `no-store` and untagged instead
907
+ * (the site has no draft state, so no `publicationState` is sent).
891
908
  */
892
909
  const createSiteApi = (request, cacheContext) => ({ get: ({ next } = {}) => request(DELIVERY_SITE_PATH, nextFetchInit({
893
910
  client: cacheContext.next,
894
911
  read: next,
895
912
  tags: [shapioTags.site(cacheContext.site)],
896
- pinned: false
913
+ pinned: false,
914
+ drafts: cacheContext.drafts
897
915
  })) });
898
916
  //#endregion
899
917
  //#region src/snapshots.ts
@@ -936,13 +954,14 @@ const createSnapshotsApi = (request) => {
936
954
  * publication snapshots (`snapshots`). `createClient` builds it over HTTP; `@shapio/local` over the delivery
937
955
  * API running in the same process. The transport receives exactly the paths the HTTP client sends.
938
956
  */
939
- const createDeliveryClient = (request, { site, next } = {}) => {
957
+ const createDeliveryClient = (request, { site, next, drafts = false } = {}) => {
940
958
  const cacheContext = {
941
959
  site,
942
- next
960
+ next,
961
+ drafts
943
962
  };
944
963
  return {
945
- /** Published content (the delivery API), typed by the caller. */
964
+ /** Published content (the delivery API; drafts in drafts mode), typed by the caller. */
946
965
  delivery: createDeliveryApi(request, cacheContext),
947
966
  /** The site as delivery sees it: key, name and SEO defaults (`GET /api/site`). */
948
967
  site: createSiteApi(request, cacheContext),
@@ -1028,7 +1047,7 @@ const createRequest = ({ baseUrl, token, fetch, credentials, headers, site }) =>
1028
1047
  };
1029
1048
  //#endregion
1030
1049
  //#region src/client.ts
1031
- const createClient = ({ baseUrl, token, fetch = globalThis.fetch, credentials, headers, site, next }) => {
1050
+ const createClient = ({ baseUrl, token, fetch = globalThis.fetch, credentials, headers, site, next, drafts }) => {
1032
1051
  const request = createRequest({
1033
1052
  baseUrl,
1034
1053
  token,
@@ -1039,7 +1058,8 @@ const createClient = ({ baseUrl, token, fetch = globalThis.fetch, credentials, h
1039
1058
  });
1040
1059
  const reads = createDeliveryClient(request, {
1041
1060
  site,
1042
- next
1061
+ next,
1062
+ ...drafts !== void 0 ? { drafts } : {}
1043
1063
  });
1044
1064
  return {
1045
1065
  /**
@@ -1126,6 +1146,6 @@ const createPkcePair = async () => {
1126
1146
  };
1127
1147
  };
1128
1148
  //#endregion
1129
- export { ADMIN_PATHS, APP_AUTH_PATHS, APP_CONTENT_ACTIONS, ASSIST_PATHS, BUILT_IN_APP_ROLE_KEYS, CHANGE_SET_STATUSES, CONTENT_ACTIONS, CONTENT_OPS_RULES, DEFAULT_SEO_KEYS, DELIVERY_PATH, DELIVERY_SITE_PATH, DEPLOYMENT_PROVIDERS, DEPLOYMENT_RUN_STATUSES, DEPLOYMENT_TRIGGERS, GLOBAL_ACTIONS, HEALTH_RULES, JOB_STATUSES, NETWORK_ACTIONS, NOT_RESTORABLE_REASONS, PUBLICATION_ACTIONS, SCHEDULE_STATUSES, SEO_COMPONENT_ID, SEO_FIELD_IDS, SITES_PATHS, SITE_ACTIONS, SITE_HEADER, SITE_QUERY_PARAMETER, SNAPSHOT_SOURCES, ShapioApiError, WEBHOOK_EVENT_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, WEBHOOK_TOLERANCE_SECONDS, applyTitleTemplate, buildUploadForm, codeChallengeOf, createClient, createDeliveryClient, createPkcePair, resolveSeo, resolveUploadUrl, seoDefaultsForLocale, shapioTags, toContentQueryString, verifyWebhookSignature };
1149
+ export { ADMIN_PATHS, APP_AUTH_PATHS, APP_CONTENT_ACTIONS, ASSIST_PATHS, BUILT_IN_APP_ROLE_KEYS, CHANGE_SET_STATUSES, CONTENT_ACTIONS, CONTENT_OPS_RULES, DEFAULT_SEO_KEYS, DELIVERY_ACTIONS, DELIVERY_PATH, DELIVERY_SITE_PATH, DEPLOYMENT_PROVIDERS, DEPLOYMENT_RUN_STATUSES, DEPLOYMENT_TRIGGERS, GLOBAL_ACTIONS, HEALTH_RULES, JOB_STATUSES, NETWORK_ACTIONS, NOT_RESTORABLE_REASONS, PUBLICATION_ACTIONS, SCHEDULE_STATUSES, SEO_COMPONENT_ID, SEO_FIELD_IDS, SITES_PATHS, SITE_ACTIONS, SITE_HEADER, SITE_QUERY_PARAMETER, SNAPSHOT_SOURCES, ShapioApiError, WEBHOOK_EVENT_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, WEBHOOK_TOLERANCE_SECONDS, applyTitleTemplate, buildUploadForm, codeChallengeOf, createClient, createDeliveryClient, createPkcePair, resolveSeo, resolveUploadUrl, seoDefaultsForLocale, shapioTags, toContentQueryString, verifyWebhookSignature };
1130
1150
 
1131
1151
  //# sourceMappingURL=index.js.map
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 * 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 | 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`. 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 and `next` option. */\nexport type DeliveryCacheContext = {\n site: string | undefined;\n next: NextCacheOptions | false | undefined;\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};\n\n/** The `cache` and `next` fetch options of one delivery read; empty outside Next unless asked for. */\nexport const nextFetchInit = ({ client, read, tags, pinned }: NextReadInput): NextFetchInit => {\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/** The content query string plus `snapshot`, `richText` and `seo`, which only delivery reads take. */\nconst deliveryQueryString = ({ snapshot, richText, seo, ...query }: DeliveryListQuery): string => {\n const extra = [\n ...(snapshot === undefined ? [] : [`snapshot=${encodeURIComponent(String(snapshot))}`]),\n ...(richText === undefined ? [] : [`richText=${encodeURIComponent(richText)}`]),\n ...(seo === undefined ? [] : [`seo=${encodeURIComponent(seo)}`]),\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/**\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.\n */\nexport const createDeliveryApi = (request: RequestFn, cacheContext: DeliveryCacheContext) => {\n const fetchInit = (tags: string[], query: DeliveryGetQuery, { next }: DeliveryReadOptions) =>\n nextFetchInit({ client: cacheContext.next, read: next, tags, pinned: query.snapshot !== undefined });\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 ) =>\n request<DeliveryList<T>>(\n `${routePath(routeKey)}${deliveryQueryString(query)}`,\n fetchInit([siteTag, shapioTags.model(routeKey)], query, options),\n ),\n singleton: <T = Record<string, unknown>>(\n apiKey: string,\n query: DeliveryGetQuery = {},\n options: DeliveryReadOptions = {},\n ) =>\n request<DeliveryItem<T>>(\n `${routePath(apiKey)}${deliveryQueryString(query)}`,\n fetchInit([siteTag, shapioTags.model(apiKey)], query, options),\n ),\n get: <T = Record<string, unknown>>(\n routeKey: string,\n id: string,\n query: DeliveryGetQuery = {},\n options: DeliveryReadOptions = {},\n ) =>\n request<DeliveryItem<T>>(\n `${routePath(routeKey)}/${encodeURIComponent(id)}${deliveryQueryString(query)}`,\n fetchInit([siteTag, shapioTags.model(routeKey), shapioTags.entry(routeKey, id)], query, 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).\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 }),\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};\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 = (request: RequestFn, { site, next }: DeliveryClientOptions = {}) => {\n const cacheContext = { site, next };\n return {\n /** Published content (the delivery API), 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\nexport const createClient = ({\n baseUrl,\n token,\n fetch = globalThis.fetch,\n credentials,\n headers,\n site,\n next,\n}: ShapioClientOptions) => {\n const request = createRequest({ baseUrl, token, fetch, credentials, headers, site });\n const reads = createDeliveryClient(request, { site, next });\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,OAA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,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 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,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,C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,IAAI,YAAY,CAAC,CAAC,OAAO,YAAY,CAAC,CAAC,CACzG;;AAGF,MAAa,iBAAiB,YAAkC;CAC9D,MAAM,eAAe,YAAY,WAAW,OAAO,gCAAgB,IAAI,WAAW,EAAE,CAAC,CAAC;CACtF,OAAO;EAAE;EAAc,eAAe,MAAM,gBAAgB,YAAY;CAAE;AAC5E"}
package/dist/node.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Lt as ShapioClient, fn as MediaVisibility, tn as MediaAsset } from "./index-C48tjTFc.js";
1
+ import { Lt as ShapioClient, fn as MediaVisibility, tn as MediaAsset } from "./index-BWuxc5nS.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.0",
3
+ "version": "0.5.2",
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.0"
35
+ "@shapio/schema": "0.5.2"
36
36
  },
37
37
  "devDependencies": {
38
38
  "tsdown": "0.23.0",