@shapio/client 0.5.6 → 0.5.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-D_PFUTmi.d.ts → index-DcylmHWk.d.ts} +125 -17
- package/dist/index.d.ts +2 -2
- package/dist/index.js +16 -4
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEFAULT_SEO_KEYS, ResolveSeoContext, SEO_COMPONENT_ID, SEO_FIELD_IDS, SeoDefaults, SeoKeys, SeoLocaleDefaults, SeoLocaleDefaults as SeoLocaleDefaults$1, applyTitleTemplate, resolveSeo, seoDefaultsForLocale } from "@shapio/schema/seo";
|
|
2
|
-
import { ChangeSummary, ClassifiedChange, DataType, DefinitionInput, ExportedDefinition, LocaleDefinition, LockFile,
|
|
2
|
+
import { ChangeSummary, ClassifiedChange, DataType, DefinitionInput, ExportedDefinition, LocaleDefinition, LockFile, PlannedChange, SchemaDefinition, SyncDecision, ValidationIssue } from "@shapio/schema";
|
|
3
3
|
//#region src/nextCache.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Next.js data-cache support for delivery reads. Under Next (`process.env.NEXT_RUNTIME` is set) or when the
|
|
@@ -183,6 +183,14 @@ type UpdateEntryInput = {
|
|
|
183
183
|
type EntryLocalesInput = {
|
|
184
184
|
locales?: string[];
|
|
185
185
|
};
|
|
186
|
+
/**
|
|
187
|
+
* Publish these locales, optionally guarded by the draft version(s) you saw (409 CONTENT_VERSION_CONFLICT when
|
|
188
|
+
* one moved): `expectedVersion` for a publish of one locale, `expectedVersions` (per locale) for several.
|
|
189
|
+
*/
|
|
190
|
+
type EntryPublishInput = EntryLocalesInput & {
|
|
191
|
+
expectedVersion?: number;
|
|
192
|
+
expectedVersions?: Record<string, number>;
|
|
193
|
+
};
|
|
186
194
|
type RevisionSummary = {
|
|
187
195
|
id: string;
|
|
188
196
|
locale: string;
|
|
@@ -197,6 +205,28 @@ type RevisionSummary = {
|
|
|
197
205
|
type RevisionDetail = RevisionSummary & {
|
|
198
206
|
data: EntryData;
|
|
199
207
|
};
|
|
208
|
+
/** One live period of an entry's locale: who published it and how, and whether it is still live. */
|
|
209
|
+
type EntryPublication = {
|
|
210
|
+
/** The revision that went live. */
|
|
211
|
+
revisionId: string;
|
|
212
|
+
locale: string;
|
|
213
|
+
publishedAt: string;
|
|
214
|
+
publishedBy: string | null;
|
|
215
|
+
/** How it went live when not by a plain Publish: on schedule, or with a change set (`changeSetTitle`). */
|
|
216
|
+
via: 'schedule' | 'changeSet' | null;
|
|
217
|
+
changeSetTitle: string | null;
|
|
218
|
+
live: boolean;
|
|
219
|
+
/** Set when it stopped being live without another publication of the locale replacing it. */
|
|
220
|
+
unpublishedAt: string | null;
|
|
221
|
+
unpublishedBy: string | null;
|
|
222
|
+
};
|
|
223
|
+
/** An entry's history: revisions with who made them, and its publications (both newest first). */
|
|
224
|
+
type EntryHistory = {
|
|
225
|
+
items: Array<RevisionSummary & {
|
|
226
|
+
authorName: string | null;
|
|
227
|
+
}>;
|
|
228
|
+
publications: EntryPublication[];
|
|
229
|
+
};
|
|
200
230
|
/** One problem with a content value (422 CONTENT_INVALID `details.issues`). */
|
|
201
231
|
type ContentIssue = {
|
|
202
232
|
path: string;
|
|
@@ -260,7 +290,8 @@ type DeliveryListQuery = Omit<ContentListQuery, 'status' | 'author'> & {
|
|
|
260
290
|
type DeliveryGetQuery = Pick<DeliveryListQuery, 'locale' | 'fields' | 'populate' | 'snapshot' | 'richText' | 'seo'>;
|
|
261
291
|
type DeliveryMeta = {
|
|
262
292
|
locale: string;
|
|
263
|
-
snapshot
|
|
293
|
+
/** The publication snapshot this response reflects; null in drafts mode, which cannot be pinned. */
|
|
294
|
+
snapshot: number | null;
|
|
264
295
|
/** Drafts mode reads only (`publicationState=draft`); published responses carry no such member. */
|
|
265
296
|
publicationState?: 'draft';
|
|
266
297
|
};
|
|
@@ -518,6 +549,8 @@ type Webhook = {
|
|
|
518
549
|
createdAt: string;
|
|
519
550
|
updatedAt: string;
|
|
520
551
|
version: number;
|
|
552
|
+
/** The stored signing secret cannot be decrypted (SESSION_SECRET changed): rotate it to repair the webhook. */
|
|
553
|
+
secretsUnreadable: boolean;
|
|
521
554
|
};
|
|
522
555
|
type CreateWebhookInput = {
|
|
523
556
|
name: string;
|
|
@@ -830,6 +863,8 @@ type PlanStepImpact = {
|
|
|
830
863
|
kind: string;
|
|
831
864
|
affectedHeads: number;
|
|
832
865
|
invalidHeads?: number;
|
|
866
|
+
/** The distinct entries those failing heads (entry versions) belong to. */
|
|
867
|
+
invalidEntries?: number;
|
|
833
868
|
/** On a `convert` step of a type change Shapio cannot convert: live entries that lose their value. */
|
|
834
869
|
droppedEntries?: number;
|
|
835
870
|
};
|
|
@@ -894,6 +929,14 @@ type DefinitionRevision = {
|
|
|
894
929
|
createdByType: string;
|
|
895
930
|
createdById: string | null;
|
|
896
931
|
createdAt: string;
|
|
932
|
+
/** The change that wrote this version: `failed` and `cancelled` versions never went live. */
|
|
933
|
+
status: SchemaChangeStatus;
|
|
934
|
+
/** The version the model serves now. */
|
|
935
|
+
active: boolean;
|
|
936
|
+
};
|
|
937
|
+
/** One revision of a definition with its body. */
|
|
938
|
+
type DefinitionRevisionDetail = DefinitionRevision & {
|
|
939
|
+
definition: SchemaDefinition;
|
|
897
940
|
};
|
|
898
941
|
type SchemaSummaryItem = {
|
|
899
942
|
id: string;
|
|
@@ -936,7 +979,12 @@ type SetDefaultLocaleResult = {
|
|
|
936
979
|
};
|
|
937
980
|
type DeleteLocaleResult = {
|
|
938
981
|
code: string;
|
|
982
|
+
/** Heads of localized models in the locale, purged. */
|
|
939
983
|
affectedHeads: number;
|
|
984
|
+
/** Entries that existed only in the locale, deleted. */
|
|
985
|
+
deletedEntries: number;
|
|
986
|
+
/** Entries of non-localized models stored in the locale, moved to the default locale. */
|
|
987
|
+
movedEntries: number;
|
|
940
988
|
};
|
|
941
989
|
//#endregion
|
|
942
990
|
//#region src/admin/changeSetTypes.d.ts
|
|
@@ -1020,6 +1068,8 @@ type ChangeSetSummary = {
|
|
|
1020
1068
|
};
|
|
1021
1069
|
type ChangeSet = ChangeSetSummary & {
|
|
1022
1070
|
items: ChangeSetItem[];
|
|
1071
|
+
/** Who shipped the set (the snapshot ledger's actor); null until it ships. */
|
|
1072
|
+
shippedBy: ChangeSetActor | null;
|
|
1023
1073
|
};
|
|
1024
1074
|
type ChangeSetQuery = {
|
|
1025
1075
|
/** Comma-separated statuses; default: everything except `discarded`. */
|
|
@@ -1132,6 +1182,8 @@ type ReviewSchemaItem = {
|
|
|
1132
1182
|
id: string;
|
|
1133
1183
|
title: string;
|
|
1134
1184
|
}>;
|
|
1185
|
+
/** A shipped set: the revision the draft replaced (null for a new definition, and for unshipped sets). */
|
|
1186
|
+
beforeRevisionId: string | null;
|
|
1135
1187
|
};
|
|
1136
1188
|
declare const NOT_RESTORABLE_REASONS: readonly ["entry_deleted", "model_missing", "publishing_disabled", "localization_changed", "locale_missing", "invalid", "unique_conflict"];
|
|
1137
1189
|
type NotRestorableReason = (typeof NOT_RESTORABLE_REASONS)[number];
|
|
@@ -1232,9 +1284,11 @@ type Snapshot = {
|
|
|
1232
1284
|
source: SnapshotSource;
|
|
1233
1285
|
changeSetId: string | null;
|
|
1234
1286
|
changeSetTitle: string | null;
|
|
1287
|
+
/** `name`: the admin's or token's name; null for the system, or once the admin or token is deleted. */
|
|
1235
1288
|
actor: {
|
|
1236
1289
|
type: string;
|
|
1237
1290
|
id: string | null;
|
|
1291
|
+
name: string | null;
|
|
1238
1292
|
};
|
|
1239
1293
|
changedEntries: number;
|
|
1240
1294
|
deploymentRuns: Array<{
|
|
@@ -1275,6 +1329,14 @@ type AdminUser = {
|
|
|
1275
1329
|
lastLoginAt: string | null;
|
|
1276
1330
|
createdAt: string;
|
|
1277
1331
|
updatedAt: string;
|
|
1332
|
+
/** Usable API tokens this admin created: refused while the account is disabled, revoked when it is deleted. */
|
|
1333
|
+
apiTokens: AdminUserApiToken[];
|
|
1334
|
+
};
|
|
1335
|
+
/** An API token listed with the admin who created it. */
|
|
1336
|
+
type AdminUserApiToken = {
|
|
1337
|
+
id: string;
|
|
1338
|
+
name: string;
|
|
1339
|
+
siteId: string | null;
|
|
1278
1340
|
};
|
|
1279
1341
|
declare const CONTENT_ACTIONS: readonly ["read", "create", "update", "delete", "publish", "schemaManage"];
|
|
1280
1342
|
type ContentAction = (typeof CONTENT_ACTIONS)[number];
|
|
@@ -1467,6 +1529,8 @@ type ApiToken = {
|
|
|
1467
1529
|
/** The token's site; null for a network admin token (its role applies on every site). */
|
|
1468
1530
|
siteId: string | null;
|
|
1469
1531
|
createdBy: string | null;
|
|
1532
|
+
/** The creator's account is disabled: the token is refused until it is enabled again. */
|
|
1533
|
+
creatorDisabled: boolean;
|
|
1470
1534
|
expiresAt: string | null;
|
|
1471
1535
|
lastUsedAt: string | null;
|
|
1472
1536
|
revokedAt: string | null;
|
|
@@ -1678,6 +1742,8 @@ type MediaUsage = {
|
|
|
1678
1742
|
locale: string;
|
|
1679
1743
|
state: 'draft' | 'published';
|
|
1680
1744
|
since: string;
|
|
1745
|
+
/** The entry's title; null when it has none or you may not read it (model, row, or field). */
|
|
1746
|
+
title: string | null;
|
|
1681
1747
|
};
|
|
1682
1748
|
type MediaUsagePage = {
|
|
1683
1749
|
items: MediaUsage[];
|
|
@@ -1751,7 +1817,8 @@ type SchemaSyncResult = {
|
|
|
1751
1817
|
apiKey: string;
|
|
1752
1818
|
kind: SchemaDefinition['kind'];
|
|
1753
1819
|
decision: SyncDecision;
|
|
1754
|
-
|
|
1820
|
+
/** Each classified by the server; older servers send no `dropsValues`. */
|
|
1821
|
+
changes: PlannedChange[];
|
|
1755
1822
|
outcome?: 'activated' | 'pending' | 'skipped';
|
|
1756
1823
|
version?: number | null;
|
|
1757
1824
|
changeId?: string;
|
|
@@ -1787,8 +1854,15 @@ type SchemaApplyInput = {
|
|
|
1787
1854
|
//#region src/snapshotTypes.d.ts
|
|
1788
1855
|
/** Publication snapshots for delivery callers (`/api/snapshots`, apps/api/src/routes/snapshots). */
|
|
1789
1856
|
type SnapshotChangeKind = 'published' | 'updated' | 'unpublished';
|
|
1857
|
+
/** Pass exactly one of `from` and `recent`. */
|
|
1790
1858
|
type SnapshotChangesQuery = {
|
|
1791
|
-
from
|
|
1859
|
+
/** The snapshot to compare from (your last build's). */
|
|
1860
|
+
from?: number;
|
|
1861
|
+
/**
|
|
1862
|
+
* Instead of `from`: start where the diff covers the last N entries (1–100) you may read that went live or
|
|
1863
|
+
* were updated and are still live; the page's `from` says where that was.
|
|
1864
|
+
*/
|
|
1865
|
+
recent?: number;
|
|
1792
1866
|
/** Defaults to the current snapshot. */
|
|
1793
1867
|
to?: number;
|
|
1794
1868
|
/** `nextCursor` of the previous page. */
|
|
@@ -2032,7 +2106,7 @@ declare const createClient: ({ baseUrl, token, fetch, credentials, headers, site
|
|
|
2032
2106
|
summary: () => Promise<ContentHealthSummary>;
|
|
2033
2107
|
};
|
|
2034
2108
|
presence: {
|
|
2035
|
-
heartbeat: (modelKey: string, id: string, body: PresenceHeartbeatInput) => Promise<
|
|
2109
|
+
heartbeat: (modelKey: string, id: string, body: PresenceHeartbeatInput) => Promise<EntryHeartbeat>;
|
|
2036
2110
|
entry: (modelKey: string, id: string) => Promise<EntryPresence>;
|
|
2037
2111
|
model: (modelKey: string) => Promise<ModelPresence>;
|
|
2038
2112
|
leave: (modelKey: string, id: string, tabId: string) => Promise<void>;
|
|
@@ -2049,11 +2123,14 @@ declare const createClient: ({ baseUrl, token, fetch, credentials, headers, site
|
|
|
2049
2123
|
update: (modelKey: string, id: string, body: UpdateEntryInput) => Promise<AdminEntry>;
|
|
2050
2124
|
remove: (modelKey: string, id: string) => Promise<void>;
|
|
2051
2125
|
duplicate: (modelKey: string, id: string) => Promise<AdminEntry>;
|
|
2052
|
-
publish: (modelKey: string, id: string, body?:
|
|
2126
|
+
publish: (modelKey: string, id: string, body?: EntryPublishInput) => Promise<AdminEntry>;
|
|
2053
2127
|
unpublish: (modelKey: string, id: string, body?: EntryLocalesInput) => Promise<AdminEntry>;
|
|
2054
2128
|
revisions: (modelKey: string, id: string, { locale }?: {
|
|
2055
2129
|
locale?: string;
|
|
2056
2130
|
}) => Promise<RevisionSummary[]>;
|
|
2131
|
+
history: (modelKey: string, id: string, { locale }?: {
|
|
2132
|
+
locale?: string;
|
|
2133
|
+
}) => Promise<EntryHistory>;
|
|
2057
2134
|
revision: (modelKey: string, id: string, revisionId: string) => Promise<RevisionDetail>;
|
|
2058
2135
|
restore: (modelKey: string, id: string, revisionId: string, expectedVersion: number) => Promise<AdminEntry>;
|
|
2059
2136
|
};
|
|
@@ -2094,8 +2171,11 @@ declare const createClient: ({ baseUrl, token, fetch, credentials, headers, site
|
|
|
2094
2171
|
changeScope: (id: string, body: ChangeScopeInput) => Promise<ChangeScopeOutcome>;
|
|
2095
2172
|
update: (id: string, body: UpdateDefinitionInput) => Promise<ChangeOutcome>;
|
|
2096
2173
|
planUpdate: (id: string, body: PlanUpdateInput) => Promise<PlanPreview>;
|
|
2097
|
-
remove: (id: string, expectedVersion: number
|
|
2174
|
+
remove: (id: string, expectedVersion: number, options?: {
|
|
2175
|
+
acknowledgeBreaking?: boolean;
|
|
2176
|
+
}) => Promise<ChangeOutcome>;
|
|
2098
2177
|
revisions: (id: string) => Promise<DefinitionRevision[]>;
|
|
2178
|
+
revision: (id: string, revisionId: string) => Promise<DefinitionRevisionDetail>;
|
|
2099
2179
|
changes: (id: string) => Promise<SchemaChangeJob[]>;
|
|
2100
2180
|
};
|
|
2101
2181
|
components: {
|
|
@@ -2108,8 +2188,11 @@ declare const createClient: ({ baseUrl, token, fetch, credentials, headers, site
|
|
|
2108
2188
|
changeScope: (id: string, body: ChangeScopeInput) => Promise<ChangeScopeOutcome>;
|
|
2109
2189
|
update: (id: string, body: UpdateDefinitionInput) => Promise<ChangeOutcome>;
|
|
2110
2190
|
planUpdate: (id: string, body: PlanUpdateInput) => Promise<PlanPreview>;
|
|
2111
|
-
remove: (id: string, expectedVersion: number
|
|
2191
|
+
remove: (id: string, expectedVersion: number, options?: {
|
|
2192
|
+
acknowledgeBreaking?: boolean;
|
|
2193
|
+
}) => Promise<ChangeOutcome>;
|
|
2112
2194
|
revisions: (id: string) => Promise<DefinitionRevision[]>;
|
|
2195
|
+
revision: (id: string, revisionId: string) => Promise<DefinitionRevisionDetail>;
|
|
2113
2196
|
changes: (id: string) => Promise<SchemaChangeJob[]>;
|
|
2114
2197
|
};
|
|
2115
2198
|
schema: {
|
|
@@ -2370,10 +2453,10 @@ type ContentOpsRun = {
|
|
|
2370
2453
|
* `params` with its translations.
|
|
2371
2454
|
*/
|
|
2372
2455
|
/** Health rules evaluated per entry (`apps/api/src/services/contentHealth.ts`). */
|
|
2373
|
-
declare const HEALTH_RULES: readonly ["requiredEmpty", "altMissing", "localeMissing", "relationMissing", "relationUnpublished", "uniqueConflict", "staleDraft", "unpublishedChanges"];
|
|
2456
|
+
declare const HEALTH_RULES: readonly ["requiredEmpty", "altMissing", "localeMissing", "relationMissing", "mediaMissing", "relationUnpublished", "uniqueConflict", "staleDraft", "unpublishedChanges"];
|
|
2374
2457
|
type HealthRule = (typeof HEALTH_RULES)[number];
|
|
2375
|
-
/** Pre-flight adds the publish checks that are not health rules: validator issues
|
|
2376
|
-
type PreflightRule = HealthRule | 'invalid'
|
|
2458
|
+
/** Pre-flight adds the publish checks that are not health rules: validator issues. */
|
|
2459
|
+
type PreflightRule = HealthRule | 'invalid';
|
|
2377
2460
|
type CheckSeverity = 'error' | 'warning';
|
|
2378
2461
|
/** Values a sentence needs (field ID, asset ID, locale, counts…). */
|
|
2379
2462
|
type CheckParams = Record<string, string | number | null>;
|
|
@@ -2455,6 +2538,22 @@ type PresenceHeartbeatInput = {
|
|
|
2455
2538
|
type EntryPresence = {
|
|
2456
2539
|
people: PresencePerson[];
|
|
2457
2540
|
};
|
|
2541
|
+
/** A locale's draft as the server has it: an open document compares `version` with the one it shows. */
|
|
2542
|
+
type DraftState = {
|
|
2543
|
+
locale: string;
|
|
2544
|
+
version: number;
|
|
2545
|
+
/** When the draft last moved (a save, an autosave, or publishing autosaved work). */
|
|
2546
|
+
savedAt: string;
|
|
2547
|
+
/** Who saved it; null when that isn't known reliably (an autosave, a token, a schedule). */
|
|
2548
|
+
savedBy: {
|
|
2549
|
+
name: string;
|
|
2550
|
+
you: boolean;
|
|
2551
|
+
} | null;
|
|
2552
|
+
};
|
|
2553
|
+
/** The heartbeat's answer: who else has the entry open, and every locale's current draft version. */
|
|
2554
|
+
type EntryHeartbeat = EntryPresence & {
|
|
2555
|
+
drafts: DraftState[];
|
|
2556
|
+
};
|
|
2458
2557
|
type ModelPresence = {
|
|
2459
2558
|
entries: {
|
|
2460
2559
|
entryId: string;
|
|
@@ -2684,7 +2783,7 @@ declare const createAdminApi: (request: RequestFn) => {
|
|
|
2684
2783
|
summary: () => Promise<ContentHealthSummary>;
|
|
2685
2784
|
};
|
|
2686
2785
|
presence: {
|
|
2687
|
-
heartbeat: (modelKey: string, id: string, body: PresenceHeartbeatInput) => Promise<
|
|
2786
|
+
heartbeat: (modelKey: string, id: string, body: PresenceHeartbeatInput) => Promise<EntryHeartbeat>;
|
|
2688
2787
|
entry: (modelKey: string, id: string) => Promise<EntryPresence>;
|
|
2689
2788
|
model: (modelKey: string) => Promise<ModelPresence>;
|
|
2690
2789
|
leave: (modelKey: string, id: string, tabId: string) => Promise<void>;
|
|
@@ -2701,11 +2800,14 @@ declare const createAdminApi: (request: RequestFn) => {
|
|
|
2701
2800
|
update: (modelKey: string, id: string, body: UpdateEntryInput) => Promise<AdminEntry>;
|
|
2702
2801
|
remove: (modelKey: string, id: string) => Promise<void>;
|
|
2703
2802
|
duplicate: (modelKey: string, id: string) => Promise<AdminEntry>;
|
|
2704
|
-
publish: (modelKey: string, id: string, body?:
|
|
2803
|
+
publish: (modelKey: string, id: string, body?: EntryPublishInput) => Promise<AdminEntry>;
|
|
2705
2804
|
unpublish: (modelKey: string, id: string, body?: EntryLocalesInput) => Promise<AdminEntry>;
|
|
2706
2805
|
revisions: (modelKey: string, id: string, { locale }?: {
|
|
2707
2806
|
locale?: string;
|
|
2708
2807
|
}) => Promise<RevisionSummary[]>;
|
|
2808
|
+
history: (modelKey: string, id: string, { locale }?: {
|
|
2809
|
+
locale?: string;
|
|
2810
|
+
}) => Promise<EntryHistory>;
|
|
2709
2811
|
revision: (modelKey: string, id: string, revisionId: string) => Promise<RevisionDetail>;
|
|
2710
2812
|
restore: (modelKey: string, id: string, revisionId: string, expectedVersion: number) => Promise<AdminEntry>;
|
|
2711
2813
|
};
|
|
@@ -2746,8 +2848,11 @@ declare const createAdminApi: (request: RequestFn) => {
|
|
|
2746
2848
|
changeScope: (id: string, body: ChangeScopeInput) => Promise<ChangeScopeOutcome>;
|
|
2747
2849
|
update: (id: string, body: UpdateDefinitionInput) => Promise<ChangeOutcome>;
|
|
2748
2850
|
planUpdate: (id: string, body: PlanUpdateInput) => Promise<PlanPreview>;
|
|
2749
|
-
remove: (id: string, expectedVersion: number
|
|
2851
|
+
remove: (id: string, expectedVersion: number, options?: {
|
|
2852
|
+
acknowledgeBreaking?: boolean;
|
|
2853
|
+
}) => Promise<ChangeOutcome>;
|
|
2750
2854
|
revisions: (id: string) => Promise<DefinitionRevision[]>;
|
|
2855
|
+
revision: (id: string, revisionId: string) => Promise<DefinitionRevisionDetail>;
|
|
2751
2856
|
changes: (id: string) => Promise<SchemaChangeJob[]>;
|
|
2752
2857
|
};
|
|
2753
2858
|
components: {
|
|
@@ -2760,8 +2865,11 @@ declare const createAdminApi: (request: RequestFn) => {
|
|
|
2760
2865
|
changeScope: (id: string, body: ChangeScopeInput) => Promise<ChangeScopeOutcome>;
|
|
2761
2866
|
update: (id: string, body: UpdateDefinitionInput) => Promise<ChangeOutcome>;
|
|
2762
2867
|
planUpdate: (id: string, body: PlanUpdateInput) => Promise<PlanPreview>;
|
|
2763
|
-
remove: (id: string, expectedVersion: number
|
|
2868
|
+
remove: (id: string, expectedVersion: number, options?: {
|
|
2869
|
+
acknowledgeBreaking?: boolean;
|
|
2870
|
+
}) => Promise<ChangeOutcome>;
|
|
2764
2871
|
revisions: (id: string) => Promise<DefinitionRevision[]>;
|
|
2872
|
+
revision: (id: string, revisionId: string) => Promise<DefinitionRevisionDetail>;
|
|
2765
2873
|
changes: (id: string) => Promise<SchemaChangeJob[]>;
|
|
2766
2874
|
};
|
|
2767
2875
|
schema: {
|
|
@@ -3072,5 +3180,5 @@ declare const codeChallengeOf: (codeVerifier: string) => Promise<string>;
|
|
|
3072
3180
|
/** A fresh verifier (32 random bytes, 43 characters) and its S256 challenge. */
|
|
3073
3181
|
declare const createPkcePair: () => Promise<AppPkcePair>;
|
|
3074
3182
|
//#endregion
|
|
3075
|
-
export { ContentHealthSummary as $,
|
|
3076
|
-
//# sourceMappingURL=index-
|
|
3183
|
+
export { ContentHealthSummary as $, DeliveryListQuery as $a, DeploymentRunQuery as $i, GlobalAction as $n, SchemaDraft as $r, SchemaExport as $t, DELIVERY_SITE_PATH as A, WebhookEventBody as Aa, PlanUpdateInput as Ai, UpdateAppRoleInput as An, RevisionSummary as Ao, ChangeSetError as Ar, LocaleMissingResult as At, buildUploadForm as B, SetSiteAppRolesInput as Ba, ConnectionTestResult as Bi, AuditPage as Bn, CreateChangeSetInput as Br, ShapioClientOptions as Bt, WEBHOOK_EVENT_HEADER as C, ScheduledPublication as Ca, DefinitionScope as Ci, AppContentAction as Cn, EntryPublication as Co, UpdateProfileInput as Cr, ContentOpsInput as Ct, WebhookSignatureCheck as D, WebhookAttempt as Da, PlanPreview as Di, AppUserQuery as Dn, ExtensionTheme as Do, ChangeSet as Dr, ContentOpsSkip as Dt, WEBHOOK_TOLERANCE_SECONDS as E, Webhook as Ea, PlanImpact as Ei, AppUserPage as En, EntryStatus as Eo, CHANGE_SET_STATUSES as Er, ContentOpsRun as Et, createDeliveryClient as F, FieldUsageResponse as Fa, SchemaSummaryItem as Fi, AdminUserApiToken as Fn, NextCacheMode as Fo, ChangeSetSchemaItem as Fr, TranslateInput as Ft, ADMIN_PATHS as G, UpdateSiteInput as Ga, DEPLOYMENT_PROVIDERS as Gi, CreateApiTokenInput as Gn, NotRestorable as Gr, VersionResponse as Gt, toContentQueryString as H, SiteAppRoles as Ha, CreatePreviewTokenInput as Hi, CONTENT_ACTIONS as Hn, FieldConsumers as Hr, CheckStatus as Ht, DELIVERY_PATH as I, ModelFieldUsage as Ia, SetDefaultLocaleResult as Ii, AdminUserStatus as In, NextCacheOptions as Io, ChangeSetSource as Ir, TranslateResult as It, ContentCount as J, SeoFields as Ja, DeploymentConnection as Ji, CsrfResponse as Jn, ReviewEntryItem as Jr, SnapshotChangeKind as Jt, CheckParams as K, DeliveryAsset as Ka, DEPLOYMENT_RUN_STATUSES as Ki, CreateRoleInput as Kn, NotRestorableReason as Kr, CurrentSnapshot as Kt, DeliveryApi as L, PrincipalUsageSummary as La, UpdateDefinitionInput as Li, ApiToken as Ln, shapioTags as Lo, ChangeSetStatus as Lr, ShapioApiError as Lt, SITE_QUERY_PARAMETER as M, WebhookWithSecret as Ma, SchemaChangeStatus as Mi, AcceptInvitationInput as Mn, RequestFn as Mo, ChangeSetItemStatus as Mr, SchemaDraftInput as Mt, DeliveryClientOptions as N, FieldPrincipalUsage as Na, SchemaSettings as Ni, AdminSession as Nn, RequestOptions as No, ChangeSetQuery as Nr, SchemaDraftResult as Nt, WebhookSignatureInput as O, WebhookDelivery as Oa, PlanStep as Oi, BUILT_IN_APP_ROLE_KEYS as On, ExtensionThemeList as Oo, ChangeSetActor as Or, ContentOpsStatus as Ot, ShapioDeliveryClient as P, FieldUsageQuery as Pa, SchemaSummary as Pi, AdminUser as Pn, DeliveryReadOptions as Po, ChangeSetReview as Pr, SummarizeInput as Pt, ContentHealthQuery as Q, DeliveryList as Qa, DeploymentRun as Qi, GLOBAL_ACTIONS as Qn, ScheduleChangeSetInput as Qr, SchemaApplyResult as Qt, AdminApi as R, UsageSelection as Ra, UpdateLocaleInput as Ri, AuditActorType as Rn, ChangeSetSummary as Rr, ShapioErrorBody as Rt, AppUser as S, ScheduleStatus as Sa, DefinitionRevisionDetail as Si, AdminAppUser as Sn, EntryLocalesInput as So, UpdateAdminUserInput as Sr, CONTENT_OPS_RULES as St, WEBHOOK_TIMESTAMP_HEADER as T, UpdateWebhookInput as Ta, Locale as Ti, AppRolePermission as Tn, EntryReferrer as To, AddChangeSetEntryInput as Tr, ContentOpsRule as Tt, SITES_PATHS as U, SiteRef as Ua, CreateScheduleInput as Ui, ChangePasswordInput as Un, FieldDiff as Ur, HealthResponse as Ut, resolveUploadUrl as V, Site as Va, CreateDeploymentConnectionInput as Vi, AuditQuery as Vn, FieldConsumer as Vr, createClient as Vt, SITE_HEADER as W, SiteSummary as Wa, CreateWebhookInput as Wi, ContentAction as Wn, NOT_RESTORABLE_REASONS as Wr, ReadyResponse as Wt, ContentHealthFinding as X, DeliveryGetQuery as Xa, DeploymentConnectionUpdated as Xi, DeliveryAction as Xn, ReviewSchemaItem as Xr, SnapshotChangesQuery as Xt, ContentCounts as Y, SeoResolved as Ya, DeploymentConnectionCreated as Yi, DELIVERY_ACTIONS as Yn, ReviewIssue as Yr, SnapshotChangesPage as Yt, ContentHealthPage as Z, DeliveryItem as Za, DeploymentProvider as Zi, EmailDelivery as Zn, SNAPSHOT_SOURCES as Zr, SchemaApplyInput as Zt, AppLoginInput as _, PreviewToken as _a, DefinitionCategory as _i, ReplaceUploadInput as _n, EntryAuthor as _o, SITE_ACTIONS as _r, AssistIssue as _t, SeoDefaults as a, DeploymentTimelineEvent as aa, SnapshotQuery as ai, MediaAssetQuery as an, AdminEntryListItem as ao, MeResponse as ar, ModelPresence as at, AppRegisterResult as b, SCHEDULE_STATUSES as ba, DefinitionPayload as bi, UploadGrant as bn, EntryLocaleState as bo, SetupStatusResponse as br, AssistTextResult as bt, applyTitleTemplate as c, Job as ca, UpdateChangeSetInput as ci, MediaFolder as cn, ContentFilterOperator as co, PasswordResetConfirmInput as cr, PreflightLocale as ct, AppPkcePair as d, JobSummary as da, ChangeOutcome as di, MediaUsagePage as dn, ContentListQuery as do, Role as dr, PresenceHeartbeatInput as dt, DeploymentRunStatus as ea, SchemaOperation as ei, SchemaSyncResult as en, DeliveryMeta as eo, InspectInvitationResponse as er, DraftState as et, codeChallengeOf as f, OpenPreviewInput as fa, ChangePlan as fi, MediaVariant as fn, ContentPagination as fo, RoleAssignment as fr, PresencePerson as ft, AppChangePasswordInput as g, PreviewTarget as ga, CreateLocaleInput as gi, MoveMediaAssetsResult as gn, EditorManifestItem as go, RoleSummary as gr, AltTextResult as gt, AppAuthApi as h, Page as ha, CreateDefinitionInput as hi, MoveMediaAssetsInput as hn, EditorManifest as ho, RolePermission as hr, AltTextInput as ht, SEO_FIELD_IDS as i, DeploymentSettings as ia, SnapshotPage as ii, MediaAssetPage as in, AdminEntry as io, LoginInput as ir, HealthRule as it, SiteApi as j, WebhookEventType as ja, SchemaChangeJob as ji, UpdateAppUserInput as jn, UpdateEntryInput as jo, ChangeSetItem as jr, RewriteInput as jt, verifyWebhookSignature as k, WebhookDeliveryStatus as ka, PlanStepImpact as ki, CreateAppRoleInput as kn, RevisionDetail as ko, ChangeSetEntryItem as kr, ContentOpsWritten as kt, resolveSeo as l, JobQuery as la, Acknowledgement as li, MediaStorageDriver as ln, ContentFilterValue as lo, PasswordResetRequestInput as lr, PreflightResponse as lt, APP_AUTH_PATHS as m, PUBLICATION_ACTIONS as ma, ChangeScopeOutcome as mi, MediaVisibility as mn, CreateEntryInput as mo, RoleKind as mr, AltProposal as mt, ResolveSeoContext as n, DeploymentSecretState as na, ShipPhase as ni, CreateUploadInput as nn, RichTextMode as no, InvitationLink as nr, EntryPresence as nt, SeoKeys as o, DeploymentTriggerPolicy as oa, SnapshotSource as oi, MediaAssetStatus as on, AdminEntryPage as oo, NETWORK_ACTIONS as or, PreflightCheck as ot, createPkcePair as p, OpenPreviewResult as pa, ChangeScopeInput as pi, MediaVariantStatus as pn, ContentSort as po, RoleCondition as pr, AltMissingResult as pt, CheckSeverity as q, DeliverySite as qa, DEPLOYMENT_TRIGGERS as qi, CreatedApiToken as qn, PutSchemaDraftInput as qr, SnapshotChange as qt, SEO_COMPONENT_ID as r, DeploymentSecretsInput as ra, Snapshot as ri, MediaAsset as rn, SeoMode as ro, InviteUserInput as rr, HEALTH_RULES as rt, SeoLocaleDefaults$1 as s, JOB_STATUSES as sa, UnassignedEntry as si, MediaFocalPoint as sn, ContentFilter as so, NetworkAction as sr, PreflightInput as st, DEFAULT_SEO_KEYS as t, DeploymentRunTrigger as ta, ShipChangeSetInput as ti, CreateMediaFolderInput as tn, DeliveryPagination as to, Invitation as tr, EntryHeartbeat as tt, seoDefaultsForLocale as u, JobStatus as ua, ActiveDefinition as ui, MediaUsage as un, ContentIssue as uo, PermissionAction as ur, PreflightRule as ut, AppOAuthProvider as v, PreviewTokenCreated as va, DefinitionDetail as vi, UpdateMediaAssetInput as vn, EntryData as vo, SessionStarted as vr, AssistProvider as vt, WEBHOOK_SIGNATURE_HEADER as w, UpdateDeploymentConnectionInput as wa, DeleteLocaleResult as wi, AppRole as wn, EntryPublishInput as wo, UpdateRoleInput as wr, ContentOpsResult as wt, AppSession as x, ScheduleQuery as xa, DefinitionRevision as xi, APP_CONTENT_ACTIONS as xn, EntryLocaleStatus as xo, SiteAction as xr, AssistUsage as xt, AppRegisterInput as y, PublicationAction as ya, DefinitionListItem as yi, UpdateMediaFolderInput as yn, EntryHistory as yo, SetupInput as yr, AssistStatus as yt, ASSIST_PATHS as z, CreateSiteInput as za, UpdateSchemaSettingsInput as zi, AuditEvent as zn, ChangeSetTimelineEvent as zr, ShapioClient as zt };
|
|
3184
|
+
//# sourceMappingURL=index-DcylmHWk.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as ContentHealthSummary, $a as
|
|
2
|
-
export { ADMIN_PATHS, APP_AUTH_PATHS, APP_CONTENT_ACTIONS, ASSIST_PATHS, type AcceptInvitationInput, type Acknowledgement, type ActiveDefinition, type AddChangeSetEntryInput, type AdminApi, type AdminAppUser, type AdminEntry, type AdminEntryListItem, type AdminEntryPage, type AdminSession, type AdminUser, type AdminUserStatus, type AltMissingResult, type AltProposal, type AltTextInput, type AltTextResult, type ApiToken, type AppAuthApi, type AppChangePasswordInput, type AppContentAction, type AppLoginInput, type AppOAuthProvider, type AppPkcePair, type AppRegisterInput, type AppRegisterResult, type AppRole, type AppRolePermission, type AppSession, type AppUser, type AppUserPage, type AppUserQuery, type AssistIssue, type AssistProvider, type AssistStatus, type AssistTextResult, type AssistUsage, type AuditActorType, type AuditEvent, type AuditPage, type AuditQuery, BUILT_IN_APP_ROLE_KEYS, CHANGE_SET_STATUSES, CONTENT_ACTIONS, CONTENT_OPS_RULES, type ChangeOutcome, type ChangePasswordInput, type ChangePlan, type ChangeScopeInput, type ChangeScopeOutcome, type ChangeSet, type ChangeSetActor, type ChangeSetEntryItem, type ChangeSetError, type ChangeSetItem, type ChangeSetItemStatus, type ChangeSetQuery, type ChangeSetReview, type ChangeSetSchemaItem, type ChangeSetSource, type ChangeSetStatus, type ChangeSetSummary, type ChangeSetTimelineEvent, type CheckParams, type CheckSeverity, type CheckStatus, type ConnectionTestResult, type ContentAction, type ContentCount, type ContentCounts, type ContentFilter, type ContentFilterOperator, type ContentFilterValue, type ContentHealthFinding, type ContentHealthPage, type ContentHealthQuery, type ContentHealthSummary, type ContentIssue, type ContentListQuery, type ContentOpsInput, type ContentOpsResult, type ContentOpsRule, type ContentOpsRun, type ContentOpsSkip, type ContentOpsStatus, type ContentOpsWritten, type ContentPagination, type ContentSort, type CreateApiTokenInput, type CreateAppRoleInput, type CreateChangeSetInput, type CreateDefinitionInput, type CreateDeploymentConnectionInput, type CreateEntryInput, type CreateLocaleInput, type CreateMediaFolderInput, type CreatePreviewTokenInput, type CreateRoleInput, type CreateScheduleInput, type CreateSiteInput, type CreateUploadInput, type CreateWebhookInput, type CreatedApiToken, type CsrfResponse, type CurrentSnapshot, DEFAULT_SEO_KEYS, DELIVERY_ACTIONS, DELIVERY_PATH, DELIVERY_SITE_PATH, DEPLOYMENT_PROVIDERS, DEPLOYMENT_RUN_STATUSES, DEPLOYMENT_TRIGGERS, type DefinitionCategory, type DefinitionDetail, type DefinitionListItem, type DefinitionPayload, type DefinitionRevision, type DefinitionScope, type DeleteLocaleResult, type DeliveryAction, type DeliveryApi, type DeliveryAsset, type DeliveryClientOptions, type DeliveryGetQuery, type DeliveryItem, type DeliveryList, type DeliveryListQuery, type DeliveryMeta, type DeliveryPagination, type DeliveryReadOptions, type DeliverySite, type DeploymentConnection, type DeploymentConnectionCreated, type DeploymentConnectionUpdated, type DeploymentProvider, type DeploymentRun, type DeploymentRunQuery, type DeploymentRunStatus, type DeploymentRunTrigger, type DeploymentSecretState, type DeploymentSecretsInput, type DeploymentSettings, type DeploymentTimelineEvent, type DeploymentTriggerPolicy, type EditorManifest, type EditorManifestItem, type EmailDelivery, type EntryAuthor, type EntryData, type EntryLocaleState, type EntryLocaleStatus, type EntryLocalesInput, type EntryPresence, type EntryReferrer, type EntryStatus, type ExtensionTheme, type ExtensionThemeList, type FieldConsumer, type FieldConsumers, type FieldDiff, type FieldPrincipalUsage, type FieldUsageQuery, type FieldUsageResponse, GLOBAL_ACTIONS, type GlobalAction, HEALTH_RULES, type HealthResponse, type HealthRule, type InspectInvitationResponse, type Invitation, type InvitationLink, type InviteUserInput, JOB_STATUSES, type Job, type JobQuery, type JobStatus, type JobSummary, type Locale, type LocaleMissingResult, type LoginInput, type MeResponse, type MediaAsset, type MediaAssetPage, type MediaAssetQuery, type MediaAssetStatus, type MediaFocalPoint, type MediaFolder, type MediaStorageDriver, type MediaUsage, type MediaUsagePage, type MediaVariant, type MediaVariantStatus, type MediaVisibility, type ModelFieldUsage, type ModelPresence, type MoveMediaAssetsInput, type MoveMediaAssetsResult, NETWORK_ACTIONS, NOT_RESTORABLE_REASONS, type NetworkAction, type NextCacheMode, type NextCacheOptions, type NotRestorable, type NotRestorableReason, type OpenPreviewInput, type OpenPreviewResult, PUBLICATION_ACTIONS, type Page, type PasswordResetConfirmInput, type PasswordResetRequestInput, type PermissionAction, type PlanImpact, type PlanPreview, type PlanStep, type PlanStepImpact, type PlanUpdateInput, type PreflightCheck, type PreflightInput, type PreflightLocale, type PreflightResponse, type PreflightRule, type PresenceHeartbeatInput, type PresencePerson, type PreviewTarget, type PreviewToken, type PreviewTokenCreated, type PrincipalUsageSummary, type PublicationAction, type PutSchemaDraftInput, type ReadyResponse, type ReplaceUploadInput, type RequestFn, type RequestOptions, type ResolveSeoContext, type ReviewEntryItem, type ReviewIssue, type ReviewSchemaItem, type RevisionDetail, type RevisionSummary, type RewriteInput, type RichTextMode, type Role, type RoleAssignment, type RoleCondition, type RoleKind, type RolePermission, type RoleSummary, SCHEDULE_STATUSES, SEO_COMPONENT_ID, SEO_FIELD_IDS, SITES_PATHS, SITE_ACTIONS, SITE_HEADER, SITE_QUERY_PARAMETER, SNAPSHOT_SOURCES, type ScheduleChangeSetInput, type ScheduleQuery, type ScheduleStatus, type ScheduledPublication, type SchemaApplyInput, type SchemaApplyResult, type SchemaChangeJob, type SchemaChangeStatus, type SchemaDraft, type SchemaDraftInput, type SchemaDraftResult, type SchemaExport, type SchemaOperation, type SchemaSettings, type SchemaSummary, type SchemaSummaryItem, type SchemaSyncResult, type SeoDefaults, type SeoFields, type SeoKeys, type SeoLocaleDefaults, type SeoMode, type SeoResolved, type SessionStarted, type SetDefaultLocaleResult, type SetSiteAppRolesInput, type SetupInput, type SetupStatusResponse, ShapioApiError, type ShapioClient, type ShapioClientOptions, type ShapioDeliveryClient, type ShapioErrorBody, type ShipChangeSetInput, type ShipPhase, type Site, type SiteAction, type SiteApi, type SiteAppRoles, type SiteRef, type SiteSummary, type Snapshot, type SnapshotChange, type SnapshotChangeKind, type SnapshotChangesPage, type SnapshotChangesQuery, type SnapshotPage, type SnapshotQuery, type SnapshotSource, type SummarizeInput, type TranslateInput, type TranslateResult, type UnassignedEntry, type UpdateAdminUserInput, type UpdateAppRoleInput, type UpdateAppUserInput, type UpdateChangeSetInput, type UpdateDefinitionInput, type UpdateDeploymentConnectionInput, type UpdateEntryInput, type UpdateLocaleInput, type UpdateMediaAssetInput, type UpdateMediaFolderInput, type UpdateProfileInput, type UpdateRoleInput, type UpdateSchemaSettingsInput, type UpdateSiteInput, type UpdateWebhookInput, type UploadGrant, type UsageSelection, type VersionResponse, WEBHOOK_EVENT_HEADER, WEBHOOK_SIGNATURE_HEADER, WEBHOOK_TIMESTAMP_HEADER, WEBHOOK_TOLERANCE_SECONDS, type Webhook, type WebhookAttempt, type WebhookDelivery, type WebhookDeliveryStatus, type WebhookEventBody, type WebhookEventType, type WebhookSignatureCheck, type WebhookSignatureInput, type WebhookWithSecret, applyTitleTemplate, buildUploadForm, codeChallengeOf, createClient, createDeliveryClient, createPkcePair, resolveSeo, resolveUploadUrl, seoDefaultsForLocale, shapioTags, toContentQueryString, verifyWebhookSignature };
|
|
1
|
+
import { $ as ContentHealthSummary, $a as DeliveryListQuery, $i as DeploymentRunQuery, $n as GlobalAction, $r as SchemaDraft, $t as SchemaExport, A as DELIVERY_SITE_PATH, Aa as WebhookEventBody, Ai as PlanUpdateInput, An as UpdateAppRoleInput, Ao as RevisionSummary, Ar as ChangeSetError, At as LocaleMissingResult, B as buildUploadForm, Ba as SetSiteAppRolesInput, Bi as ConnectionTestResult, Bn as AuditPage, Br as CreateChangeSetInput, Bt as ShapioClientOptions, C as WEBHOOK_EVENT_HEADER, Ca as ScheduledPublication, Ci as DefinitionScope, Cn as AppContentAction, Co as EntryPublication, Cr as UpdateProfileInput, Ct as ContentOpsInput, D as WebhookSignatureCheck, Da as WebhookAttempt, Di as PlanPreview, Dn as AppUserQuery, Do as ExtensionTheme, Dr as ChangeSet, Dt as ContentOpsSkip, E as WEBHOOK_TOLERANCE_SECONDS, Ea as Webhook, Ei as PlanImpact, En as AppUserPage, Eo as EntryStatus, Er as CHANGE_SET_STATUSES, Et as ContentOpsRun, F as createDeliveryClient, Fa as FieldUsageResponse, Fi as SchemaSummaryItem, Fn as AdminUserApiToken, Fo as NextCacheMode, Fr as ChangeSetSchemaItem, Ft as TranslateInput, G as ADMIN_PATHS, Ga as UpdateSiteInput, Gi as DEPLOYMENT_PROVIDERS, Gn as CreateApiTokenInput, Gr as NotRestorable, Gt as VersionResponse, H as toContentQueryString, Ha as SiteAppRoles, Hi as CreatePreviewTokenInput, Hn as CONTENT_ACTIONS, Hr as FieldConsumers, Ht as CheckStatus, I as DELIVERY_PATH, Ia as ModelFieldUsage, Ii as SetDefaultLocaleResult, In as AdminUserStatus, Io as NextCacheOptions, Ir as ChangeSetSource, It as TranslateResult, J as ContentCount, Ja as SeoFields, Ji as DeploymentConnection, Jn as CsrfResponse, Jr as ReviewEntryItem, Jt as SnapshotChangeKind, K as CheckParams, Ka as DeliveryAsset, Ki as DEPLOYMENT_RUN_STATUSES, Kn as CreateRoleInput, Kr as NotRestorableReason, Kt as CurrentSnapshot, L as DeliveryApi, La as PrincipalUsageSummary, Li as UpdateDefinitionInput, Ln as ApiToken, Lo as shapioTags, Lr as ChangeSetStatus, Lt as ShapioApiError, M as SITE_QUERY_PARAMETER, Ma as WebhookWithSecret, Mi as SchemaChangeStatus, Mn as AcceptInvitationInput, Mo as RequestFn, Mr as ChangeSetItemStatus, Mt as SchemaDraftInput, N as DeliveryClientOptions, Na as FieldPrincipalUsage, Ni as SchemaSettings, Nn as AdminSession, No as RequestOptions, Nr as ChangeSetQuery, Nt as SchemaDraftResult, O as WebhookSignatureInput, Oa as WebhookDelivery, Oi as PlanStep, On as BUILT_IN_APP_ROLE_KEYS, Oo as ExtensionThemeList, Or as ChangeSetActor, Ot as ContentOpsStatus, P as ShapioDeliveryClient, Pa as FieldUsageQuery, Pi as SchemaSummary, Pn as AdminUser, Po as DeliveryReadOptions, Pr as ChangeSetReview, Pt as SummarizeInput, Q as ContentHealthQuery, Qa as DeliveryList, Qi as DeploymentRun, Qn as GLOBAL_ACTIONS, Qr as ScheduleChangeSetInput, Qt as SchemaApplyResult, R as AdminApi, Ra as UsageSelection, Ri as UpdateLocaleInput, Rn as AuditActorType, Rr as ChangeSetSummary, Rt as ShapioErrorBody, S as AppUser, Sa as ScheduleStatus, Si as DefinitionRevisionDetail, Sn as AdminAppUser, So as EntryLocalesInput, Sr as UpdateAdminUserInput, St as CONTENT_OPS_RULES, T as WEBHOOK_TIMESTAMP_HEADER, Ta as UpdateWebhookInput, Ti as Locale, Tn as AppRolePermission, To as EntryReferrer, Tr as AddChangeSetEntryInput, Tt as ContentOpsRule, U as SITES_PATHS, Ua as SiteRef, Ui as CreateScheduleInput, Un as ChangePasswordInput, Ur as FieldDiff, Ut as HealthResponse, V as resolveUploadUrl, Va as Site, Vi as CreateDeploymentConnectionInput, Vn as AuditQuery, Vr as FieldConsumer, Vt as createClient, W as SITE_HEADER, Wa as SiteSummary, Wi as CreateWebhookInput, Wn as ContentAction, Wr as NOT_RESTORABLE_REASONS, Wt as ReadyResponse, X as ContentHealthFinding, Xa as DeliveryGetQuery, Xi as DeploymentConnectionUpdated, Xn as DeliveryAction, Xr as ReviewSchemaItem, Xt as SnapshotChangesQuery, Y as ContentCounts, Ya as SeoResolved, Yi as DeploymentConnectionCreated, Yn as DELIVERY_ACTIONS, Yr as ReviewIssue, Yt as SnapshotChangesPage, Z as ContentHealthPage, Za as DeliveryItem, Zi as DeploymentProvider, Zn as EmailDelivery, Zr as SNAPSHOT_SOURCES, Zt as SchemaApplyInput, _ as AppLoginInput, _a as PreviewToken, _i as DefinitionCategory, _n as ReplaceUploadInput, _o as EntryAuthor, _r as SITE_ACTIONS, _t as AssistIssue, a as SeoDefaults, aa as DeploymentTimelineEvent, ai as SnapshotQuery, an as MediaAssetQuery, ao as AdminEntryListItem, ar as MeResponse, at as ModelPresence, b as AppRegisterResult, ba as SCHEDULE_STATUSES, bi as DefinitionPayload, bn as UploadGrant, bo as EntryLocaleState, br as SetupStatusResponse, bt as AssistTextResult, c as applyTitleTemplate, ca as Job, ci as UpdateChangeSetInput, cn as MediaFolder, co as ContentFilterOperator, cr as PasswordResetConfirmInput, ct as PreflightLocale, d as AppPkcePair, da as JobSummary, di as ChangeOutcome, dn as MediaUsagePage, do as ContentListQuery, dr as Role, dt as PresenceHeartbeatInput, ea as DeploymentRunStatus, ei as SchemaOperation, en as SchemaSyncResult, eo as DeliveryMeta, er as InspectInvitationResponse, et as DraftState, f as codeChallengeOf, fa as OpenPreviewInput, fi as ChangePlan, fn as MediaVariant, fo as ContentPagination, fr as RoleAssignment, ft as PresencePerson, g as AppChangePasswordInput, ga as PreviewTarget, gi as CreateLocaleInput, gn as MoveMediaAssetsResult, go as EditorManifestItem, gr as RoleSummary, gt as AltTextResult, h as AppAuthApi, ha as Page, hi as CreateDefinitionInput, hn as MoveMediaAssetsInput, ho as EditorManifest, hr as RolePermission, ht as AltTextInput, i as SEO_FIELD_IDS, ia as DeploymentSettings, ii as SnapshotPage, in as MediaAssetPage, io as AdminEntry, ir as LoginInput, it as HealthRule, j as SiteApi, ja as WebhookEventType, ji as SchemaChangeJob, jn as UpdateAppUserInput, jo as UpdateEntryInput, jr as ChangeSetItem, jt as RewriteInput, k as verifyWebhookSignature, ka as WebhookDeliveryStatus, ki as PlanStepImpact, kn as CreateAppRoleInput, ko as RevisionDetail, kr as ChangeSetEntryItem, kt as ContentOpsWritten, l as resolveSeo, la as JobQuery, li as Acknowledgement, ln as MediaStorageDriver, lo as ContentFilterValue, lr as PasswordResetRequestInput, lt as PreflightResponse, m as APP_AUTH_PATHS, ma as PUBLICATION_ACTIONS, mi as ChangeScopeOutcome, mn as MediaVisibility, mo as CreateEntryInput, mr as RoleKind, mt as AltProposal, n as ResolveSeoContext, na as DeploymentSecretState, ni as ShipPhase, nn as CreateUploadInput, no as RichTextMode, nr as InvitationLink, nt as EntryPresence, o as SeoKeys, oa as DeploymentTriggerPolicy, oi as SnapshotSource, on as MediaAssetStatus, oo as AdminEntryPage, or as NETWORK_ACTIONS, ot as PreflightCheck, p as createPkcePair, pa as OpenPreviewResult, pi as ChangeScopeInput, pn as MediaVariantStatus, po as ContentSort, pr as RoleCondition, pt as AltMissingResult, q as CheckSeverity, qa as DeliverySite, qi as DEPLOYMENT_TRIGGERS, qn as CreatedApiToken, qr as PutSchemaDraftInput, qt as SnapshotChange, r as SEO_COMPONENT_ID, ra as DeploymentSecretsInput, ri as Snapshot, rn as MediaAsset, ro as SeoMode, rr as InviteUserInput, rt as HEALTH_RULES, s as SeoLocaleDefaults, sa as JOB_STATUSES, si as UnassignedEntry, sn as MediaFocalPoint, so as ContentFilter, sr as NetworkAction, st as PreflightInput, t as DEFAULT_SEO_KEYS, ta as DeploymentRunTrigger, ti as ShipChangeSetInput, tn as CreateMediaFolderInput, to as DeliveryPagination, tr as Invitation, tt as EntryHeartbeat, u as seoDefaultsForLocale, ua as JobStatus, ui as ActiveDefinition, un as MediaUsage, uo as ContentIssue, ur as PermissionAction, ut as PreflightRule, v as AppOAuthProvider, va as PreviewTokenCreated, vi as DefinitionDetail, vn as UpdateMediaAssetInput, vo as EntryData, vr as SessionStarted, vt as AssistProvider, w as WEBHOOK_SIGNATURE_HEADER, wa as UpdateDeploymentConnectionInput, wi as DeleteLocaleResult, wn as AppRole, wo as EntryPublishInput, wr as UpdateRoleInput, wt as ContentOpsResult, x as AppSession, xa as ScheduleQuery, xi as DefinitionRevision, xn as APP_CONTENT_ACTIONS, xo as EntryLocaleStatus, xr as SiteAction, xt as AssistUsage, y as AppRegisterInput, ya as PublicationAction, yi as DefinitionListItem, yn as UpdateMediaFolderInput, yo as EntryHistory, yr as SetupInput, yt as AssistStatus, z as ASSIST_PATHS, za as CreateSiteInput, zi as UpdateSchemaSettingsInput, zn as AuditEvent, zr as ChangeSetTimelineEvent, zt as ShapioClient } from "./index-DcylmHWk.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 AdminUserApiToken, 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 DefinitionRevisionDetail, type DefinitionScope, type DeleteLocaleResult, type DeliveryAction, type DeliveryApi, type DeliveryAsset, type DeliveryClientOptions, type DeliveryGetQuery, type DeliveryItem, type DeliveryList, type DeliveryListQuery, type DeliveryMeta, type DeliveryPagination, type DeliveryReadOptions, type DeliverySite, type DeploymentConnection, type DeploymentConnectionCreated, type DeploymentConnectionUpdated, type DeploymentProvider, type DeploymentRun, type DeploymentRunQuery, type DeploymentRunStatus, type DeploymentRunTrigger, type DeploymentSecretState, type DeploymentSecretsInput, type DeploymentSettings, type DeploymentTimelineEvent, type DeploymentTriggerPolicy, type DraftState, type EditorManifest, type EditorManifestItem, type EmailDelivery, type EntryAuthor, type EntryData, type EntryHeartbeat, type EntryHistory, type EntryLocaleState, type EntryLocaleStatus, type EntryLocalesInput, type EntryPresence, type EntryPublication, type EntryPublishInput, 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
|
@@ -190,6 +190,7 @@ const createContentApi = (request) => ({
|
|
|
190
190
|
/** 409 ENTRY_REFERENCED with `details.referrers` while other entries point at it. */
|
|
191
191
|
remove: (modelKey, id) => request(entryPath$1(modelKey, id), { method: "DELETE" }),
|
|
192
192
|
duplicate: (modelKey, id) => request(`${entryPath$1(modelKey, id)}/duplicate`, { method: "POST" }),
|
|
193
|
+
/** With `expectedVersion`/`expectedVersions`, 409 CONTENT_VERSION_CONFLICT when a draft moved since. */
|
|
193
194
|
publish: (modelKey, id, body = {}) => request(`${entryPath$1(modelKey, id)}/publish`, {
|
|
194
195
|
method: "POST",
|
|
195
196
|
body
|
|
@@ -199,6 +200,8 @@ const createContentApi = (request) => ({
|
|
|
199
200
|
body
|
|
200
201
|
}),
|
|
201
202
|
revisions: async (modelKey, id, { locale } = {}) => (await request(`${revisionsPath(modelKey, id)}${toQueryString({ locale })}`)).items,
|
|
203
|
+
/** Revisions with their authors' names, and the entry's publications (who published, when, how). */
|
|
204
|
+
history: (modelKey, id, { locale } = {}) => request(`${revisionsPath(modelKey, id)}${toQueryString({ locale })}`),
|
|
202
205
|
revision: (modelKey, id, revisionId) => request(withId(revisionsPath(modelKey, id), revisionId)),
|
|
203
206
|
/** Brings an older revision back as the new draft of its locale (a new revision). */
|
|
204
207
|
restore: (modelKey, id, revisionId, expectedVersion) => request(`${withId(revisionsPath(modelKey, id), revisionId)}/restore`, {
|
|
@@ -229,7 +232,7 @@ run: (modelKey, id, body = {}) => request(`${entryPath(ADMIN_PATHS.content, mode
|
|
|
229
232
|
summary: () => request(`${ADMIN_PATHS.contentHealth}/summary`)
|
|
230
233
|
},
|
|
231
234
|
presence: {
|
|
232
|
-
/** Heartbeat (every 15s while the document is visible)
|
|
235
|
+
/** Heartbeat (every 15s while the document is visible): who else has the entry open, and its drafts. */
|
|
233
236
|
heartbeat: (modelKey, id, body) => request(entryPath(ADMIN_PATHS.presence, modelKey, id), {
|
|
234
237
|
method: "PUT",
|
|
235
238
|
body
|
|
@@ -362,9 +365,16 @@ const createDefinitionApi = (request, category) => {
|
|
|
362
365
|
method: "POST",
|
|
363
366
|
body
|
|
364
367
|
}),
|
|
365
|
-
/**
|
|
366
|
-
|
|
368
|
+
/**
|
|
369
|
+
* Soft delete: entries are kept and reappear if the definition is applied again. Removing the API is a
|
|
370
|
+
* breaking change: without `acknowledgeBreaking` the server answers 409 SCHEMA_CHANGE_NOT_ACKNOWLEDGED.
|
|
371
|
+
*/
|
|
372
|
+
remove: (id, expectedVersion, options = {}) => request(`${withId(base, id)}${toQueryString({
|
|
373
|
+
expectedVersion,
|
|
374
|
+
acknowledgeBreaking: options.acknowledgeBreaking || void 0
|
|
375
|
+
})}`, { method: "DELETE" }),
|
|
367
376
|
revisions: async (id) => (await request(`${withId(base, id)}/revisions`)).items,
|
|
377
|
+
revision: (id, revisionId) => request(withId(`${withId(base, id)}/revisions`, revisionId)),
|
|
368
378
|
changes: async (id) => (await request(`${withId(base, id)}/changes`)).items
|
|
369
379
|
};
|
|
370
380
|
};
|
|
@@ -406,7 +416,8 @@ const createSchemaApi = (request) => ({
|
|
|
406
416
|
}),
|
|
407
417
|
/**
|
|
408
418
|
* Deletes a locale and purges its content. When content exists and `acknowledgeDestructive` is false,
|
|
409
|
-
* the server answers 409 SCHEMA_CHANGE_NOT_ACKNOWLEDGED with `details.plan.impact
|
|
419
|
+
* the server answers 409 SCHEMA_CHANGE_NOT_ACKNOWLEDGED with `details.plan.impact` (`affectedHeads`,
|
|
420
|
+
* `deletedEntries`, `movedEntries`).
|
|
410
421
|
*/
|
|
411
422
|
remove: (code, acknowledgeDestructive) => request(`${withId(ADMIN_PATHS.locales, code)}${toQueryString({ acknowledgeDestructive: acknowledgeDestructive || void 0 })}`, { method: "DELETE" })
|
|
412
423
|
}
|
|
@@ -599,6 +610,7 @@ const HEALTH_RULES = [
|
|
|
599
610
|
"altMissing",
|
|
600
611
|
"localeMissing",
|
|
601
612
|
"relationMissing",
|
|
613
|
+
"mediaMissing",
|
|
602
614
|
"relationUnpublished",
|
|
603
615
|
"uniqueConflict",
|
|
604
616
|
"staleDraft",
|
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 DeploymentConnectionUpdated,\n DeploymentRun,\n DeploymentRunQuery,\n Job,\n JobQuery,\n JobSummary,\n OpenPreviewInput,\n OpenPreviewResult,\n PreviewTarget,\n Page,\n PreviewToken,\n PreviewTokenCreated,\n ScheduledPublication,\n ScheduleQuery,\n UpdateDeploymentConnectionInput,\n UpdateWebhookInput,\n Webhook,\n WebhookDelivery,\n WebhookEventType,\n WebhookWithSecret,\n} from './publishingTypes.js';\nimport { toQueryString } from './query.js';\n\n/** Jobs, scheduled publications, webhooks, deployment connections and runs, preview (package H). */\nexport const createPublishingApi = (request: RequestFn) => ({\n jobs: {\n list: (query: JobQuery = {}) => request<Page<Job>>(`${ADMIN_PATHS.jobs}${toQueryString(query)}`),\n summary: () => request<JobSummary>(`${ADMIN_PATHS.jobs}/summary`),\n get: (id: string) => request<Job>(withId(ADMIN_PATHS.jobs, id)),\n /** Dead jobs only: runs again from attempt 1. 409 JOB_NOT_RETRYABLE otherwise. */\n retry: (id: string) => request<Job>(`${withId(ADMIN_PATHS.jobs, id)}/retry`, { method: 'POST' }),\n },\n schedules: {\n list: (query: ScheduleQuery = {}) =>\n request<Page<ScheduledPublication>>(`${ADMIN_PATHS.schedules}${toQueryString(query)}`),\n create: (body: CreateScheduleInput) =>\n request<ScheduledPublication>(ADMIN_PATHS.schedules, { method: 'POST', body }),\n cancel: (id: string) => request<void>(withId(ADMIN_PATHS.schedules, id), { method: 'DELETE' }),\n },\n webhooks: {\n list: () => request<Webhook[]>(ADMIN_PATHS.webhooks),\n events: async () =>\n (await request<{ items: WebhookEventType[] }>(`${ADMIN_PATHS.webhooks}/events`)).items,\n get: (id: string) => request<Webhook>(withId(ADMIN_PATHS.webhooks, id)),\n create: (body: CreateWebhookInput) =>\n request<WebhookWithSecret>(ADMIN_PATHS.webhooks, { method: 'POST', body }),\n update: (id: string, body: UpdateWebhookInput) =>\n request<Webhook>(withId(ADMIN_PATHS.webhooks, id), { method: 'PATCH', body }),\n remove: (id: string) => request<void>(withId(ADMIN_PATHS.webhooks, id), { method: 'DELETE' }),\n rotateSecret: (id: string) =>\n request<WebhookWithSecret>(`${withId(ADMIN_PATHS.webhooks, id)}/rotate-secret`, { method: 'POST' }),\n /** Queues a `webhook.test` delivery; poll the delivery log for its outcome. */\n test: (id: string) =>\n request<WebhookDelivery>(`${withId(ADMIN_PATHS.webhooks, id)}/test`, { method: 'POST' }),\n deliveries: (id: string, query: { cursor?: string; limit?: number } = {}) =>\n request<Page<WebhookDelivery>>(`${withId(ADMIN_PATHS.webhooks, id)}/deliveries${toQueryString(query)}`),\n /** Sends the same payload again as a new delivery. */\n redeliver: (id: string, deliveryId: string) =>\n request<WebhookDelivery>(\n `${withId(ADMIN_PATHS.webhooks, id)}/deliveries/${encodeURIComponent(deliveryId)}/redeliver`,\n { method: 'POST' },\n ),\n },\n deployments: {\n connections: {\n list: () => request<DeploymentConnection[]>(ADMIN_PATHS.deploymentConnections),\n get: (id: string) => request<DeploymentConnection>(withId(ADMIN_PATHS.deploymentConnections, id)),\n create: (body: CreateDeploymentConnectionInput) =>\n request<DeploymentConnectionCreated>(ADMIN_PATHS.deploymentConnections, { method: 'POST', body }),\n update: (id: string, body: UpdateDeploymentConnectionInput) =>\n request<DeploymentConnectionUpdated>(withId(ADMIN_PATHS.deploymentConnections, id), {\n method: 'PATCH',\n body,\n }),\n remove: (id: string) =>\n request<void>(withId(ADMIN_PATHS.deploymentConnections, id), { method: 'DELETE' }),\n test: (id: string) =>\n request<ConnectionTestResult>(`${withId(ADMIN_PATHS.deploymentConnections, id)}/test`, {\n method: 'POST',\n }),\n /** A manual run at the current publication snapshot. */\n trigger: (id: string) =>\n request<DeploymentRun>(`${withId(ADMIN_PATHS.deploymentConnections, id)}/runs`, { method: 'POST' }),\n },\n runs: {\n list: (query: DeploymentRunQuery = {}) =>\n request<Page<DeploymentRun>>(`${ADMIN_PATHS.deploymentRuns}${toQueryString(query)}`),\n get: (id: string) => request<DeploymentRun>(withId(ADMIN_PATHS.deploymentRuns, id)),\n /** A new run (linked by `retryOf`) at the current snapshot. */\n retry: (id: string) =>\n request<DeploymentRun>(`${withId(ADMIN_PATHS.deploymentRuns, id)}/retry`, { method: 'POST' }),\n },\n },\n preview: {\n tokens: {\n list: (query: { entryId?: string } = {}) =>\n request<PreviewToken[]>(`${ADMIN_PATHS.previewTokens}${toQueryString(query)}`),\n create: (body: CreatePreviewTokenInput) =>\n request<PreviewTokenCreated>(ADMIN_PATHS.previewTokens, { method: 'POST', body }),\n revoke: (id: string) => request<void>(withId(ADMIN_PATHS.previewTokens, id), { method: 'DELETE' }),\n },\n /** The site's connections with a preview URL (the entry form's Preview pane). */\n targets: () => request<PreviewTarget[]>(`${ADMIN_PATHS.preview}/targets`),\n /** The entry form's Preview action: a short-lived entry token and the rendered preview URL. */\n open: (body: OpenPreviewInput) =>\n request<OpenPreviewResult>(`${ADMIN_PATHS.preview}/open`, { method: 'POST', body }),\n },\n});\n","import type { RequestFn } from '../request.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport { toQueryString } from './query.js';\nimport type { SchemaApplyInput, SchemaApplyResult, SchemaExport } from './schemaSyncTypes.js';\nimport type {\n ChangeOutcome,\n ChangeScopeInput,\n ChangeScopeOutcome,\n CreateDefinitionInput,\n CreateLocaleInput,\n DefinitionCategory,\n DefinitionPayload,\n DefinitionDetail,\n DefinitionScope,\n DefinitionListItem,\n DefinitionRevision,\n DeleteLocaleResult,\n Locale,\n PlanPreview,\n PlanUpdateInput,\n SchemaChangeJob,\n SchemaSettings,\n SchemaSummary,\n SetDefaultLocaleResult,\n UpdateDefinitionInput,\n UpdateLocaleInput,\n UpdateSchemaSettingsInput,\n} from './schemaTypes.js';\n\nconst DEFINITION_PATHS = {\n model: ADMIN_PATHS.models,\n component: ADMIN_PATHS.components,\n} as const satisfies Record<DefinitionCategory, string>;\n\n/** Models (collections and singletons) and components share one set of endpoints under their own base. */\nexport const createDefinitionApi = (request: RequestFn, category: DefinitionCategory) => {\n const base = DEFINITION_PATHS[category];\n return {\n /** The site's view (shared definitions and its own); `{ scope: 'network' }` lists the shared ones. */\n list: async (options: { scope?: DefinitionScope } = {}) =>\n (await request<{ items: DefinitionListItem[] }>(`${base}${toQueryString(options)}`)).items,\n get: (id: string) => request<DefinitionDetail>(withId(base, id)),\n /** Creates and activates a definition (`pending` when prerequisites must run first). */\n create: (body: CreateDefinitionInput) => request<ChangeOutcome>(base, { method: 'POST', body }),\n /** Plan preview of a create: classification and impact, nothing written. */\n planCreate: (definition: DefinitionPayload, scope?: DefinitionScope) =>\n request<PlanPreview>(`${base}/plan`, {\n method: 'POST',\n body: scope ? { definition, scope } : { definition },\n }),\n /** Shares a definition with all sites, or keeps it on one (needs schema.create on every site). */\n changeScope: (id: string, body: ChangeScopeInput) =>\n request<ChangeScopeOutcome>(`${withId(base, id)}/scope`, { method: 'PUT', body }),\n /** Changes a definition; 409 SCHEMA_VERSION_CONFLICT when `expectedVersion` is stale. */\n update: (id: string, body: UpdateDefinitionInput) =>\n request<ChangeOutcome>(withId(base, id), { method: 'PUT', body }),\n planUpdate: (id: string, body: PlanUpdateInput) =>\n request<PlanPreview>(`${withId(base, id)}/plan`, { method: 'POST', body }),\n /** Soft delete: entries are kept and reappear if the definition is applied again. */\n remove: (id: string, expectedVersion: number) =>\n request<ChangeOutcome>(`${withId(base, id)}${toQueryString({ expectedVersion })}`, {\n method: 'DELETE',\n }),\n revisions: async (id: string) =>\n (await request<{ items: DefinitionRevision[] }>(`${withId(base, id)}/revisions`)).items,\n changes: async (id: string) =>\n (await request<{ items: SchemaChangeJob[] }>(`${withId(base, id)}/changes`)).items,\n };\n};\n\n/** Schema-wide endpoints: the version summary, planned-change status, the read-only lock, locales. */\nexport const createSchemaApi = (request: RequestFn) => ({\n models: createDefinitionApi(request, 'model'),\n components: createDefinitionApi(request, 'component'),\n schema: {\n /** The global schema version and every visible definition's version (cheap; poll it for changes). */\n summary: () => request<SchemaSummary>(ADMIN_PATHS.schema),\n change: (changeId: string) => request<SchemaChangeJob>(withId(ADMIN_PATHS.schemaChanges, changeId)),\n /** Every definition in the pull format, with the schema version they come from (`shapio schema pull`). */\n export: (options: { scope?: DefinitionScope } = {}) =>\n request<SchemaExport>(`${ADMIN_PATHS.schemaExport}${toQueryString(options)}`),\n /** Applies definition files live through the change planner; refuses when the base moved (409). */\n apply: (body: SchemaApplyInput) =>\n request<SchemaApplyResult>(ADMIN_PATHS.schemaApply, { method: 'POST', body }),\n settings: () => request<SchemaSettings>(ADMIN_PATHS.schemaSettings),\n updateSettings: (body: UpdateSchemaSettingsInput) =>\n request<SchemaSettings>(ADMIN_PATHS.schemaSettings, { method: 'PUT', body }),\n },\n locales: {\n list: async () => (await request<{ items: Locale[] }>(ADMIN_PATHS.locales)).items,\n create: (body: CreateLocaleInput) => request<Locale>(ADMIN_PATHS.locales, { method: 'POST', body }),\n update: (code: string, body: UpdateLocaleInput) =>\n request<Locale>(withId(ADMIN_PATHS.locales, code), { method: 'PUT', body }),\n /** A contract change: without `acknowledgeBreaking` the server answers 409 SCHEMA_CHANGE_NOT_ACKNOWLEDGED. */\n setDefault: (code: string, acknowledgeBreaking: boolean) =>\n request<SetDefaultLocaleResult>(`${withId(ADMIN_PATHS.locales, code)}/default`, {\n method: 'POST',\n body: { acknowledgeBreaking },\n }),\n /**\n * Deletes a locale and purges its content. When content exists and `acknowledgeDestructive` is false,\n * the server answers 409 SCHEMA_CHANGE_NOT_ACKNOWLEDGED with `details.plan.impact.affectedHeads`.\n */\n remove: (code: string, acknowledgeDestructive: boolean) =>\n request<DeleteLocaleResult>(\n `${withId(ADMIN_PATHS.locales, code)}${toQueryString({ acknowledgeDestructive: acknowledgeDestructive || undefined })}`,\n { method: 'DELETE' },\n ),\n },\n});\n","import type { RequestFn } from '../request.js';\nimport type {\n CreateSiteInput,\n SetSiteAppRolesInput,\n Site,\n SiteAppRoles,\n UpdateSiteInput,\n} from './sitesTypes.js';\n\nexport const SITES_PATHS = { sites: '/api/admin/sites' } as const;\n\n/** The admin API header that names the site a site-scoped request is about (default: the primary site). */\nexport const SITE_HEADER = 'shapio-site';\n\nconst sitePath = (id: string) => `${SITES_PATHS.sites}/${encodeURIComponent(id)}`;\n\n/** Sites (network routes): listing shows the sites the caller holds a role on; changes need `sites.manage`. */\nexport const createSitesApi = (request: RequestFn) => ({\n sites: {\n list: () => request<Site[]>(SITES_PATHS.sites),\n get: (id: string) => request<Site>(sitePath(id)),\n create: (body: CreateSiteInput) => request<Site>(SITES_PATHS.sites, { method: 'POST', body }),\n update: (id: string, body: UpdateSiteInput) => request<Site>(sitePath(id), { method: 'PATCH', body }),\n /** Only an empty site (409 `SITE_NOT_EMPTY`); never the primary site (409 `SITE_IS_PRIMARY`). */\n remove: (id: string) => request<void>(sitePath(id), { method: 'DELETE' }),\n /** The app roles bound to the site's anonymous callers (`public`) and signed-in app users (`authenticated`). */\n appRoles: {\n get: (id: string) => request<SiteAppRoles>(`${sitePath(id)}/app-roles`),\n /** Replaces both bindings (`roles.manage`). */\n set: (id: string, body: SetSiteAppRolesInput) =>\n request<SiteAppRoles>(`${sitePath(id)}/app-roles`, { method: 'PUT', body }),\n },\n },\n});\n","import type { RequestFn } from '../request.js';\nimport { toQueryString } from './query.js';\nimport type { FieldUsageQuery, FieldUsageResponse } from './usageTypes.js';\n\nexport const USAGE_PATHS = { fields: '/api/admin/usage/fields' } as const;\n\n/** Who reads which fields (needs `tokens.manage`). */\nexport const createUsageApi = (request: RequestFn) => ({\n usage: {\n fields: (query: FieldUsageQuery) =>\n request<FieldUsageResponse>(`${USAGE_PATHS.fields}${toQueryString(query)}`),\n },\n});\n","import type { SiteSummary } from './sitesTypes.js';\n/**\n * Admin identity API shapes (package B, build plan §4.B), mirroring the TypeBox route schemas in\n * apps/api/src/routes/admin/** and routes/schemas/adminIdentity.ts. JSON is camelCase; timestamps are ISO-8601.\n */\n\nexport type AdminUserStatus = 'active' | 'disabled';\n\n/** A role held on one site, or on every site (`siteId` null). */\nexport type RoleAssignment = { roleId: string; siteId: string | null };\n\nexport type AdminUser = {\n id: string;\n email: string;\n name: string;\n status: AdminUserStatus;\n /** Where each role applies. */\n assignments: RoleAssignment[];\n /** Deprecated: the distinct roles of `assignments`, on any site. */\n roleIds: string[];\n lastLoginAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport const CONTENT_ACTIONS = ['read', 'create', 'update', 'delete', 'publish', 'schemaManage'] as const;\nexport type ContentAction = (typeof CONTENT_ACTIONS)[number];\n\n/**\n * What a delivery role grants: `read`, and `readDrafts` (drafts mode: the token's site may read drafts with\n * `publicationState=draft`). `readDrafts` always covers every model and is never granted to admin roles.\n */\nexport const DELIVERY_ACTIONS = ['read', 'readDrafts'] as const;\nexport type DeliveryAction = (typeof DELIVERY_ACTIONS)[number];\n\n/**\n * Network actions: about the whole instance. Only roles assigned on every site grant them, so a role held\n * on one site never reaches the network.\n */\nexport const NETWORK_ACTIONS = [\n 'schema.create',\n 'users.manage',\n 'roles.manage',\n 'audit.read',\n 'sites.manage',\n] as const;\nexport type NetworkAction = (typeof NETWORK_ACTIONS)[number];\n\n/** Site actions: about one site's library, tokens and publishing. */\nexport const SITE_ACTIONS = [\n 'tokens.manage',\n 'media.read',\n 'media.write',\n 'media.manage',\n 'publishing.manage',\n 'webhooks.manage',\n 'deployments.manage',\n 'deployments.trigger',\n 'changes.manage',\n 'changes.ship',\n] as const;\nexport type SiteAction = (typeof SITE_ACTIONS)[number];\n\n/** Actions not scoped to a model: network actions and site actions. */\nexport const GLOBAL_ACTIONS = [\n 'schema.create',\n 'users.manage',\n 'roles.manage',\n 'tokens.manage',\n 'audit.read',\n 'sites.manage',\n 'media.read',\n 'media.write',\n 'media.manage',\n 'publishing.manage',\n 'webhooks.manage',\n 'deployments.manage',\n 'deployments.trigger',\n 'changes.manage',\n 'changes.ship',\n 'site.settings',\n] as const;\nexport type GlobalAction = (typeof GLOBAL_ACTIONS)[number];\n\nexport type PermissionAction = ContentAction | DeliveryAction | GlobalAction;\n\nexport type RoleSummary = { id: string; key: string; name: string };\n\n/** Returned whenever a session starts (setup, login, accepting an invitation). */\nexport type SessionStarted = { user: AdminUser; csrfToken: string };\n\nexport type MeResponse = {\n user: AdminUser;\n roles: RoleSummary[];\n /** The site this response is about: the request's `Shapio-Site`, else the primary site. */\n site: SiteSummary;\n /** Every site this admin holds a role on (all of them for a role assigned on every site). */\n sites: SiteSummary[];\n /** Sites on this instance (whether or not the admin holds a role on them); scope is shown only above 1. */\n siteCount: number;\n /** Network actions (roles assigned on every site only). */\n networkPermissions: NetworkAction[];\n /**\n * Site actions on the request's site, plus `schema.create` when a role on the site grants it for the\n * site's own definitions (`networkPermissions` lists it when shared definitions may be created too).\n */\n sitePermissions: Array<SiteAction | 'schema.create'>;\n /** `networkPermissions` and `sitePermissions` together. */\n globalPermissions: GlobalAction[];\n /** Content actions per model ID on the request's site (models without any action are left out). */\n modelPermissions: Record<string, ContentAction[]>;\n /** How the server sends email: `console` writes it to the server log (no real delivery is set up). */\n emailDelivery: EmailDelivery;\n csrfToken: string;\n};\n\nexport type EmailDelivery = 'console' | 'smtp';\n\nexport type SetupStatusResponse = {\n /** No admin exists yet. */\n required: boolean;\n /** SETUP_REQUIRE_TOKEN is set: setup also needs the one-time token from the server log. */\n requiresToken: boolean;\n};\n\n/** `token` is needed only when the server requires it (`requiresToken`); otherwise it is ignored. */\nexport type SetupInput = { token?: string; email: string; name: string; password: string };\n\nexport type LoginInput = { email: string; password: string };\n\nexport type CsrfResponse = { csrfToken: string };\n\nexport type UpdateProfileInput = { name: string };\n\nexport type ChangePasswordInput = { currentPassword: string; newPassword: string };\n\nexport type PasswordResetRequestInput = { email: string };\n\nexport type PasswordResetConfirmInput = { token: string; password: string };\n\nexport type AcceptInvitationInput = { token: string; name: string; password: string };\n\nexport type InspectInvitationResponse = { email: string; expiresAt: string };\n\nexport type AdminSession = {\n id: string;\n current: boolean;\n ip: string | null;\n userAgent: string | null;\n createdAt: string;\n lastSeenAt: string;\n expiresAt: string;\n};\n\nexport type Invitation = {\n id: string;\n email: string;\n /** The role assignments the invitee gets on accepting. */\n assignments: RoleAssignment[];\n /** Deprecated: the distinct roles of `assignments`. */\n roleIds: string[];\n invitedBy: string | null;\n expiresAt: string;\n createdAt: string;\n};\n\n/** A fresh accept link, shown once; issuing it makes earlier links (emailed or copied) stop working. */\nexport type InvitationLink = { acceptUrl: string; expiresAt: string };\n\n/**\n * Either `assignments` or (deprecated) `roleIds`, meaning those roles on every site; never both. Updating\n * either replaces every assignment.\n */\ntype AssignmentsInput =\n { assignments: RoleAssignment[]; roleIds?: never } | { roleIds: string[]; assignments?: never };\n\nexport type InviteUserInput = { email: string } & AssignmentsInput;\n\nexport type UpdateAdminUserInput = { name?: string; status?: AdminUserStatus } & (\n AssignmentsInput | { assignments?: never; roleIds?: never }\n);\n\nexport type RoleKind = 'admin' | 'delivery';\n\nexport type RoleCondition = 'ownedByPrincipal';\n\nexport type RolePermission = {\n action: PermissionAction;\n /** `null` grants the action on every model (and is required for global actions). */\n modelId: string | null;\n condition: RoleCondition | null;\n /** `null` = every field; otherwise only these stable field IDs. */\n fieldIds: string[] | null;\n};\n\nexport type Role = {\n id: string;\n key: string;\n name: string;\n description: string;\n kind: RoleKind;\n isSystem: boolean;\n /** Optimistic-concurrency version: send it back as `expectedVersion` on update. */\n version: number;\n permissions: RolePermission[];\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CreateRoleInput = {\n key: string;\n name: string;\n description?: string;\n kind?: RoleKind;\n permissions: RolePermission[];\n};\n\nexport type UpdateRoleInput = {\n expectedVersion: number;\n name?: string;\n description?: string;\n permissions?: RolePermission[];\n};\n\nexport type ApiToken = {\n id: string;\n name: string;\n /** First characters of the token (`shp_` + 6), for telling tokens apart. */\n tokenPrefix: string;\n roleId: string;\n scope: RoleKind;\n /** The token's site; null for a network admin token (its role applies on every site). */\n siteId: string | null;\n createdBy: string | null;\n expiresAt: string | null;\n lastUsedAt: string | null;\n revokedAt: string | null;\n createdAt: string;\n};\n\nexport type CreateApiTokenInput = {\n name: string;\n roleId: string;\n expiresAt?: string | null;\n /**\n * A network admin token (every site and network actions; needs `users.manage`). Omitted: a network token\n * when the creator may create one, else a token of the request's site. Delivery tokens are always per site.\n */\n network?: boolean;\n};\n\n/** `token` is the plain secret, returned once at creation and never again. */\nexport type CreatedApiToken = { token: string; apiToken: ApiToken };\n\nexport type AuditActorType = 'admin' | 'app_user' | 'token' | 'anonymous' | 'system';\n\nexport type AuditEvent = {\n id: string;\n occurredAt: string;\n actorType: AuditActorType;\n actorId: string | null;\n /** The acting admin's (or app user's) display name, when the actor is a known account. */\n actorName: string | null;\n actorEmail: string | null;\n action: string;\n targetType: string | null;\n targetId: string | null;\n outcome: 'success' | 'failure';\n requestId: string | null;\n ip: string | null;\n metadata: unknown;\n};\n\n/** Newest first, cursor-paginated. */\nexport type AuditQuery = {\n cursor?: string;\n limit?: number;\n actorType?: AuditActorType;\n actorId?: string;\n action?: string;\n actionPrefix?: string;\n targetType?: string;\n targetId?: string;\n outcome?: 'success' | 'failure';\n from?: string;\n to?: string;\n};\n\nexport type AuditPage = { items: AuditEvent[]; nextCursor: string | null };\n","/**\n * Publishing types (package H, `apps/api/src/routes/admin/{jobs,publishing,webhooks,deployments,preview}`).\n * Dates are ISO-8601 strings.\n */\nimport type { SiteRef } from './sitesTypes.js';\n\nexport type Page<T> = { items: T[]; nextCursor: string | null };\n\n// Jobs ---------------------------------------------------------------------------------------------\n\nexport const JOB_STATUSES = ['pending', 'running', 'succeeded', 'dead'] as const;\nexport type JobStatus = (typeof JOB_STATUSES)[number];\n\nexport type Job = {\n id: string;\n type: string;\n status: JobStatus;\n attempts: number;\n maxAttempts: number;\n /** When it runs next (pending) or ran last. */\n runAt: string;\n idempotencyKey: string | null;\n lockedBy: string | null;\n lockedUntil: string | null;\n /** Payload and result with secret-looking values replaced by `[redacted]`. */\n payload: unknown;\n result: unknown;\n /** Progress a long job saved (e.g. an import's phase and counts); null when it saved none. */\n progress: unknown;\n lastError: string | null;\n createdAt: string;\n updatedAt: string;\n finishedAt: string | null;\n};\n\nexport type JobQuery = { status?: JobStatus; type?: string; cursor?: string; limit?: number };\n\nexport type JobSummary = { counts: Record<JobStatus, number>; types: string[] };\n\n// Scheduled publications ---------------------------------------------------------------------------\n\nexport const PUBLICATION_ACTIONS = ['publish', 'unpublish'] as const;\nexport type PublicationAction = (typeof PUBLICATION_ACTIONS)[number];\n\nexport const SCHEDULE_STATUSES = ['scheduled', 'done', 'failed', 'cancelled'] as const;\nexport type ScheduleStatus = (typeof SCHEDULE_STATUSES)[number];\n\nexport type ScheduledPublication = {\n id: string;\n entryId: string;\n modelId: string;\n /** Null when the model no longer exists. */\n modelKey: string | null;\n locale: string;\n action: PublicationAction;\n runAt: string;\n status: ScheduleStatus;\n error: string | null;\n /** Publication sequence the change was published at (once done). */\n snapshot: number | null;\n createdBy: string | null;\n createdAt: string;\n executedAt: string | null;\n};\n\nexport type ScheduleQuery = { status?: ScheduleStatus; entryId?: string; cursor?: string; limit?: number };\n\nexport type CreateScheduleInput = {\n modelKey: string;\n entryId: string;\n /** Omit for non-localized models (and for the default locale). */\n locale?: string;\n action: PublicationAction;\n runAt: string;\n};\n\n// Webhooks -----------------------------------------------------------------------------------------\n\nexport type WebhookEventType = { type: string; group: string };\n\nexport type WebhookDeliveryStatus = 'pending' | 'retrying' | 'succeeded' | 'dead';\n\nexport type Webhook = {\n id: string;\n name: string;\n url: string;\n /** Event types or `group.*` patterns. */\n events: string[];\n enabled: boolean;\n allowPrivateNetwork: boolean;\n maxAttempts: number;\n /** The site whose events it receives; null for a network-wide webhook (every site's events). */\n site: SiteRef | null;\n lastDelivery: { status: WebhookDeliveryStatus; at: string } | null;\n createdBy: string | null;\n createdAt: string;\n updatedAt: string;\n version: number;\n};\n\nexport type CreateWebhookInput = {\n name: string;\n url: string;\n events: string[];\n enabled?: boolean;\n allowPrivateNetwork?: boolean;\n maxAttempts?: number;\n /** A network-wide webhook (every site's events); otherwise it belongs to the request's site. */\n network?: boolean;\n};\n\n/** A webhook's site is fixed once created. */\nexport type UpdateWebhookInput = Partial<Omit<CreateWebhookInput, 'network'>> & { expectedVersion: number };\n\n/** The JSON body every webhook delivery sends (signed; verify it with `verifyWebhookSignature`). */\nexport type WebhookEventBody = {\n id: string;\n type: string;\n createdAt: string;\n /** The site the event is about; null for events about no site (network-wide). */\n site: SiteRef | null;\n data: unknown;\n};\n\n/** `secret` is shown once: on creation and after rotation. */\nexport type WebhookWithSecret = { webhook: Webhook; secret: string };\n\nexport type WebhookAttempt = {\n attempt: number;\n at: string;\n durationMs: number;\n request: { method: string; url: string; headers: Record<string, string> };\n /** Null when no response arrived (refused, timeout, blocked by the network policy). */\n response: { status: number; headers: Record<string, string>; body: string; truncated: boolean } | null;\n error: string | null;\n};\n\nexport type WebhookDelivery = {\n id: string;\n webhookId: string;\n eventId: string | null;\n eventType: string;\n isTest: boolean;\n status: WebhookDeliveryStatus;\n attempts: number;\n lastResponseStatus: number | null;\n lastError: string | null;\n payload: unknown;\n attemptLog: WebhookAttempt[];\n createdAt: string;\n updatedAt: string;\n deliveredAt: string | null;\n};\n\n// Deployments --------------------------------------------------------------------------------------\n\nexport const DEPLOYMENT_PROVIDERS = [\n 'generic_webhook',\n 'cloudflare_pages',\n 'vercel',\n 'netlify',\n 'github',\n] as const;\nexport type DeploymentProvider = (typeof DEPLOYMENT_PROVIDERS)[number];\n\nexport const DEPLOYMENT_TRIGGERS = ['publish', 'change_set', 'schema', 'manual'] as const;\nexport type DeploymentTriggerPolicy = (typeof DEPLOYMENT_TRIGGERS)[number];\n\nexport const DEPLOYMENT_RUN_STATUSES = [\n 'queued',\n 'triggered',\n 'building',\n 'deployed',\n 'failed',\n 'unknown',\n] as const;\nexport type DeploymentRunStatus = (typeof DEPLOYMENT_RUN_STATUSES)[number];\n\nexport type DeploymentRunTrigger = 'publish' | 'change_set' | 'schema' | 'manual' | 'retry';\n\n/**\n * Provider settings (not secret). Generic: `{ url }`. Cloudflare Pages: `{ accountId, projectName }`.\n * GitHub: `{ owner, repo, branch, mode: 'commit' | 'pull_request', directory }`.\n */\nexport type DeploymentSettings = Record<string, string>;\n\n/**\n * Secret names per provider. Generic: `signingSecret` (generated when omitted). Cloudflare Pages:\n * `deployHookUrl`, `apiToken`. GitHub: `token`. Values are write-only. A value of `${ENV:VAR_NAME}`\n * makes the server read the secret from that environment variable instead of storing it.\n */\nexport type DeploymentSecretsInput = Record<string, string>;\n\n/** Which secrets are set; values never leave the server. `envVar`: read from this environment variable. */\nexport type DeploymentSecretState = Record<string, { set: boolean; envVar: string | null }>;\n\nexport type DeploymentTimelineEvent = {\n status: DeploymentRunStatus;\n at: string;\n source: 'shapio' | 'callback' | 'provider';\n message: string | null;\n};\n\nexport type DeploymentRun = {\n id: string;\n connectionId: string;\n connectionName: string;\n provider: DeploymentProvider;\n status: DeploymentRunStatus;\n trigger: DeploymentRunTrigger;\n /** Publication sequence the run was triggered at (`?snapshot=` on delivery). */\n snapshot: number | null;\n schemaVersion: number | null;\n retryOf: string | null;\n providerRef: string | null;\n logUrl: string | null;\n siteUrl: string | null;\n error: string | null;\n /** False for providers that cannot report completion without callbacks (shown as \"completion unknown\"). */\n completionReported: boolean;\n timeline: DeploymentTimelineEvent[];\n triggeredAt: string | null;\n finishedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type DeploymentConnection = {\n id: string;\n name: string;\n provider: DeploymentProvider;\n settings: DeploymentSettings;\n secrets: DeploymentSecretState;\n previewUrlTemplate: string | null;\n /** Preview tokens issued for this connection show exactly what this delivery role reads. */\n deliveryRoleId: string | null;\n triggerPolicy: DeploymentTriggerPolicy[];\n debounceSeconds: number;\n allowPrivateNetwork: boolean;\n enabled: boolean;\n /** Where the site posts signed build callbacks (generic webhook connections). */\n callbackUrl: string;\n latestRun: DeploymentRun | null;\n /** The newest deployed run by snapshot: what the site is serving, as far as Shapio knows. */\n currentRun: DeploymentRun | null;\n createdBy: string | null;\n createdAt: string;\n updatedAt: string;\n version: number;\n /**\n * The stored secrets cannot be decrypted (the server's SESSION_SECRET changed): every literal secret reads\n * as not set until it is entered again; secrets read from the environment are unaffected.\n */\n secretsUnreadable: boolean;\n};\n\nexport type CreateDeploymentConnectionInput = {\n name: string;\n provider: DeploymentProvider;\n settings: DeploymentSettings;\n secrets: DeploymentSecretsInput;\n previewUrlTemplate?: string | null;\n triggerPolicy: DeploymentTriggerPolicy[];\n debounceSeconds?: number;\n allowPrivateNetwork?: boolean;\n enabled?: boolean;\n deliveryRoleId?: string | null;\n};\n\nexport type UpdateDeploymentConnectionInput = Partial<Omit<CreateDeploymentConnectionInput, 'provider'>> & {\n expectedVersion: number;\n};\n\n/** `generatedSecrets` holds secrets Shapio generated (the generic signing secret), shown once. */\nexport type DeploymentConnectionCreated = {\n connection: DeploymentConnection;\n generatedSecrets: Record<string, string>;\n};\n\n/** An update's result: `generatedSecrets` holds a secret Shapio minted to replace an unreadable one, shown once. */\nexport type DeploymentConnectionUpdated = DeploymentConnection & {\n generatedSecrets?: Record<string, string>;\n};\n\nexport type ConnectionTestResult = {\n ok: boolean;\n checks: Array<{ name: string; ok: boolean; message: string }>;\n};\n\nexport type DeploymentRunQuery = { connectionId?: string; cursor?: string; limit?: number };\n\n// Preview ------------------------------------------------------------------------------------------\n\nexport type PreviewToken = {\n id: string;\n tokenPrefix: string;\n modelId: string;\n modelKey: string | null;\n entryId: string | null;\n locale: string | null;\n connectionId: string | null;\n /** Fields follow this delivery role (within the creator's access); null = the public fields. */\n deliveryRoleId: string | null;\n createdBy: string;\n expiresAt: string;\n revokedAt: string | null;\n lastUsedAt: string | null;\n createdAt: string;\n};\n\nexport type CreatePreviewTokenInput = {\n modelKey: string;\n entryId?: string;\n locale?: string;\n /** Default 1 hour, at most 30 days. */\n ttlSeconds?: number;\n connectionId?: string;\n /** Defaults to the connection's delivery role. */\n deliveryRoleId?: string;\n};\n\n/** `token` is shown once. `url` is rendered from the connection's preview URL template (null without one). */\nexport type PreviewTokenCreated = { token: string; previewToken: PreviewToken; url: string | null };\n\nexport type OpenPreviewInput = {\n modelKey: string;\n entryId: string;\n locale?: string;\n /** Defaults to the first enabled connection with a preview URL template. */\n connectionId?: string;\n};\n\n/** What the entry form's Preview button opens. `apiUrl` is the preview read endpoint for this entry. */\nexport type OpenPreviewResult = {\n /** The token's ID (revoke it when the preview closes). */\n id: string;\n url: string | null;\n apiUrl: string;\n token: string;\n expiresAt: string;\n connectionId: string | null;\n};\n\n/** A connection the site's previews open on (names and origins only). */\nexport type PreviewTarget = {\n connectionId: string;\n name: string;\n /** null when the preview URL template's origin depends on a variable. */\n origin: string | null;\n /** Whether the admin can show it in its preview frame. */\n framable: boolean;\n};\n","/**\n * App users and app roles as administrators manage them (package I), mirroring the TypeBox route schemas in\n * apps/api/src/routes/admin/{appUsers,appRoles}. JSON is camelCase; timestamps are ISO-8601.\n */\nimport type { RoleCondition } from './types.js';\n\nexport type AdminAppUser = {\n id: string;\n email: string;\n name: string;\n confirmed: boolean;\n blocked: boolean;\n /** False for accounts that only sign in with an OAuth provider. */\n hasPassword: boolean;\n /** OAuth providers linked to the account (`google`, `github`). */\n providers: string[];\n /** Custom app roles; `authenticated` applies to every app user implicitly. */\n roleIds: string[];\n lastLoginAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\n/** Newest first, cursor-paginated; `search` matches email or name. */\nexport type AppUserQuery = { search?: string; cursor?: string; limit?: number };\n\nexport type AppUserPage = { items: AdminAppUser[]; nextCursor: string | null };\n\nexport type UpdateAppUserInput = { blocked?: boolean; roleIds?: string[] };\n\n/** What app roles may grant: content actions only. */\nexport const APP_CONTENT_ACTIONS = ['read', 'create', 'update', 'delete', 'publish'] as const;\nexport type AppContentAction = (typeof APP_CONTENT_ACTIONS)[number];\n\n/** Built-in app role keys: `public` applies to anonymous callers, `authenticated` to every app user. */\nexport const BUILT_IN_APP_ROLE_KEYS = ['public', 'authenticated'] as const;\n\nexport type AppRolePermission = {\n action: AppContentAction;\n /** `null` grants the action on every model, including ones created later. */\n modelId: string | null;\n condition: RoleCondition | null;\n /** `null` = every public field; otherwise exactly these stable field IDs (non-public ones included). */\n fieldIds: string[] | null;\n};\n\nexport type AppRole = {\n id: string;\n key: string;\n name: string;\n description: string;\n isSystem: boolean;\n version: number;\n permissions: AppRolePermission[];\n userCount: number;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CreateAppRoleInput = {\n key: string;\n name: string;\n description?: string;\n permissions: AppRolePermission[];\n};\n\n/** Built-in roles accept `permissions` only. */\nexport type UpdateAppRoleInput = {\n expectedVersion: number;\n name?: string;\n description?: string;\n permissions?: AppRolePermission[];\n};\n","import type { DataType, SchemaDefinition } from '@shapio/schema';\nimport type { DeploymentRunStatus, Page, PublicationAction } from './publishingTypes.js';\nimport type { ChangePlan, DefinitionCategory, DefinitionPayload, PlanImpact } from './schemaTypes.js';\nimport type { SiteRef } from './sitesTypes.js';\n\n/**\n * Change sets and snapshots (developer-face plan §5), mirroring the TypeBox route schemas in\n * apps/api/src/routes/admin/{changeSets,snapshots}/schemas.ts. Dates are ISO-8601 strings.\n */\n\nexport const CHANGE_SET_STATUSES = [\n 'open',\n 'scheduled',\n 'shipping',\n 'shipped',\n 'failed',\n 'discarded',\n] as const;\nexport type ChangeSetStatus = (typeof CHANGE_SET_STATUSES)[number];\n/** While `shipping`: preparing (prerequisite dry runs, index builds) or activating (the final transaction). */\nexport type ShipPhase = 'preparing' | 'activating';\nexport type ChangeSetSource = 'manual' | 'release' | 'restore' | 'builder' | 'assist';\nexport type ChangeSetItemStatus = 'pending' | 'done' | 'failed';\nexport type SchemaOperation = 'create' | 'update' | 'delete';\n\nexport type ChangeSetActor = { type: 'admin' | 'token' | 'system'; id: string | null; name: string | null };\n\n/** Why a ship failed, and the item that stopped it (null when not tied to one item). */\nexport type ChangeSetError = { code: string; message: string; itemId: string | null; details?: unknown };\n\nexport type ChangeSetEntryItem = {\n id: string;\n kind: 'entry';\n position: number;\n entryId: string;\n modelId: string;\n modelKey: string | null;\n title: string | null;\n locale: string;\n action: PublicationAction;\n /** Restore items publish this exact revision instead of the current draft. */\n sourceRevisionId: string | null;\n status: ChangeSetItemStatus;\n error: string | null;\n};\n\nexport type ChangeSetSchemaItem = {\n id: string;\n kind: 'schema';\n position: number;\n draftId: string;\n definitionId: string;\n category: DefinitionCategory;\n apiKey: string;\n operation: SchemaOperation;\n /** The active version the draft was based on; null for a new definition. */\n baseVersion: number | null;\n draftVersion: number;\n status: ChangeSetItemStatus;\n error: string | null;\n};\n\nexport type ChangeSetItem = ChangeSetEntryItem | ChangeSetSchemaItem;\n\nexport type ChangeSetSummary = {\n id: string;\n title: string;\n description: string;\n status: ChangeSetStatus;\n shipPhase: ShipPhase | null;\n source: ChangeSetSource;\n restoreOfSnapshot: number | null;\n scheduledFor: string | null;\n /** Connection whose deploy is triggered (pinned to the shipped snapshot) after the set ships. */\n deploymentConnectionId: string | null;\n deploymentRunId: string | null;\n shippedAt: string | null;\n /** The publication snapshot the set went live in. */\n shippedSnapshot: number | null;\n schemaVersionAfter: number | null;\n error: ChangeSetError | null;\n entryItemCount: number;\n schemaItemCount: number;\n createdBy: ChangeSetActor;\n createdAt: string;\n updatedAt: string;\n version: number;\n};\n\nexport type ChangeSet = ChangeSetSummary & { items: ChangeSetItem[] };\n\nexport type ChangeSetQuery = {\n /** Comma-separated statuses; default: everything except `discarded`. */\n status?: string;\n cursor?: string;\n limit?: number;\n};\n\nexport type CreateChangeSetInput = {\n title: string;\n description?: string;\n /** `builder`: a one-item set the model builder ships at once (\"Review & ship now\"). Default `manual`. */\n source?: 'manual' | 'builder';\n};\nexport type UpdateChangeSetInput = {\n title?: string;\n description?: string;\n deploymentConnectionId?: string | null;\n expectedVersion: number;\n};\nexport type AddChangeSetEntryInput = {\n modelKey: string;\n entryId: string;\n /** Omit for non-localized models (and for the default locale). */\n locale?: string;\n action: PublicationAction;\n};\n\nexport type SchemaDraft = {\n id: string;\n changeSetId: string;\n definitionId: string;\n category: DefinitionCategory;\n operation: SchemaOperation;\n baseVersion: number | null;\n /** Null when the draft deletes the definition. */\n definition: SchemaDefinition | null;\n /** A new definition the draft creates shared with all sites (otherwise it belongs to the set's site). */\n shared: boolean;\n version: number;\n updatedBy: ChangeSetActor;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type PutSchemaDraftInput = {\n category: DefinitionCategory;\n /** The whole proposed definition, or null to delete the definition when the set ships. */\n definition: DefinitionPayload | null;\n /** The active version the edit is based on (null: a new definition). */\n baseVersion: number | null;\n /** For a new definition: create it shared with all sites (default false: the set's site). */\n shared?: boolean;\n /** The draft row version the caller saw; omit when creating the draft. */\n expectedDraftVersion?: number;\n};\n\n/**\n * One changed field. `summary` is the server's readable form of each side (rich text as its text, media as\n * filenames, relations as titles, components as labelled items); null when that side is empty.\n */\nexport type FieldDiff = {\n fieldId: string;\n apiKey: string;\n label: string;\n type: DataType;\n before: unknown;\n after: unknown;\n summary: { before: string | null; after: string | null };\n};\nexport type ReviewIssue = { path: string; code: string; message: string };\n\nexport type ReviewEntryItem = {\n itemId: string;\n entryId: string;\n modelId: string;\n modelKey: string | null;\n title: string | null;\n locale: string;\n action: PublicationAction;\n sourceRevisionId: string | null;\n /** Send back in `ship.itemVersions` (strict ship). Null when the item does not publish the draft. */\n draftVersion: number | null;\n liveState: 'unpublished' | 'published' | 'modified' | 'missing';\n fields: FieldDiff[];\n issues: ReviewIssue[];\n};\n\nexport type ReviewSchemaItem = {\n itemId: string;\n draftId: string;\n definitionId: string;\n category: DefinitionCategory;\n apiKey: string;\n operation: SchemaOperation;\n baseVersion: number | null;\n activeVersion: number | null;\n /** The active version moved since the draft was based on it: shipping refuses until it is rebased. */\n stale: boolean;\n plan: ChangePlan | null;\n impact: PlanImpact | null;\n /** Entries of the affected models per site (a shared definition converts every site's content). */\n affectedEntriesBySite: Array<{ site: SiteRef; entries: number }>;\n issues: ReviewIssue[];\n alsoChangedIn: Array<{ id: string; title: string }>;\n};\n\nexport const NOT_RESTORABLE_REASONS = [\n 'entry_deleted',\n 'model_missing',\n 'publishing_disabled',\n 'localization_changed',\n 'locale_missing',\n 'invalid',\n 'unique_conflict',\n] as const;\nexport type NotRestorableReason = (typeof NOT_RESTORABLE_REASONS)[number];\n\nexport type NotRestorable = {\n entryId: string;\n modelId: string;\n modelKey: string | null;\n locale: string;\n reason: NotRestorableReason;\n detail: string;\n};\n\nexport type FieldConsumer = {\n /** The site the reads were made on. */\n site: SiteRef;\n /** `token:<id>`, `app_users` or `anonymous`. */\n principalKey: string;\n label: string | null;\n reads: number;\n lastReadAt: string | null;\n /** `implicit`: the reader requested the whole model (no field selection). */\n selection: 'explicit' | 'implicit';\n};\n\nexport type FieldConsumers = {\n modelId: string;\n fieldId: string;\n apiKey: string;\n consumers: FieldConsumer[];\n /**\n * Readers on other sites, as totals, when the viewer holds no role on every site; null when the viewer\n * sees every site's readers in `consumers`.\n */\n otherSites: { consumers: number; reads: number } | null;\n};\n\nexport type ChangeSetReview = {\n changeSet: ChangeSet;\n entries: ReviewEntryItem[];\n schema: ReviewSchemaItem[];\n notRestorable: NotRestorable[];\n consumers: FieldConsumers[];\n usageDays: number;\n checks: { breaking: boolean; destructive: boolean; blocking: ReviewIssue[]; warnings: ReviewIssue[] };\n /** Fixed notices, e.g. `NEW_FIELDS_AFTER_SHIP`. */\n notices: string[];\n};\n\nexport type ShipChangeSetInput = {\n expectedVersion: number;\n acknowledgeBreaking?: boolean;\n acknowledgeDestructive?: boolean;\n /** Draft versions the review showed; a moved draft makes the ship refuse with 409 CHANGE_SET_STALE. */\n itemVersions?: Array<{ itemId: string; draftVersion: number }>;\n};\n\nexport type ScheduleChangeSetInput = {\n at: string;\n expectedVersion: number;\n acknowledgeBreaking?: boolean;\n acknowledgeDestructive?: boolean;\n};\n\nexport type ChangeSetTimelineEvent = {\n at: string;\n kind: string;\n actor: ChangeSetActor | null;\n message: string | null;\n snapshot: number | null;\n deploymentRunId: string | null;\n /** `item.changedAfterReview`: the entry whose draft moved between review and a scheduled ship. */\n item: { entryId: string; locale: string; fromVersion: number; toVersion: number } | null;\n};\n\nexport type UnassignedEntry = {\n entryId: string;\n modelId: string;\n modelKey: string | null;\n title: string | null;\n locale: string;\n status: 'draft' | 'modified';\n updatedAt: string;\n};\n\n// Snapshots ----------------------------------------------------------------------------------------\n\nexport const SNAPSHOT_SOURCES = [\n 'publish',\n 'unpublish',\n 'delete',\n 'schedule',\n 'change_set',\n 'schema',\n 'conversion',\n 'import',\n 'legacy',\n] as const;\nexport type SnapshotSource = (typeof SNAPSHOT_SOURCES)[number];\n\nexport type Snapshot = {\n seq: number;\n schemaVersion: number | null;\n source: SnapshotSource;\n changeSetId: string | null;\n changeSetTitle: string | null;\n actor: { type: string; id: string | null };\n changedEntries: number;\n deploymentRuns: Array<{ id: string; connectionId: string; status: DeploymentRunStatus }>;\n createdAt: string;\n};\n\nexport type SnapshotPage = Page<Snapshot> & { current: number };\nexport type SnapshotQuery = { cursor?: string; limit?: number };\n","/**\n * Shapes of the entry document's endpoints (editor experience, E0b): publish pre-flight, content health\n * findings, presence and per-model counts. Sentences are never sent: the admin builds them from `rule` and\n * `params` with its translations.\n */\n\n/** Health rules evaluated per entry (`apps/api/src/services/contentHealth.ts`). */\nexport const HEALTH_RULES = [\n 'requiredEmpty',\n 'altMissing',\n 'localeMissing',\n 'relationMissing',\n 'relationUnpublished',\n 'uniqueConflict',\n 'staleDraft',\n 'unpublishedChanges',\n] as const;\nexport type HealthRule = (typeof HEALTH_RULES)[number];\n\n/** Pre-flight adds the publish checks that are not health rules: validator issues and missing media. */\nexport type PreflightRule = HealthRule | 'invalid' | 'mediaMissing';\n\nexport type CheckSeverity = 'error' | 'warning';\n\n/** Values a sentence needs (field ID, asset ID, locale, counts…). */\nexport type CheckParams = Record<string, string | number | null>;\n\nexport type PreflightCheck = {\n rule: PreflightRule;\n /** Errors block publishing; warnings are informational. */\n severity: CheckSeverity;\n /** JSON pointer (API keys) of the value to fix, e.g. `/body` or `/sections/2/title`. */\n path?: string;\n /** The validator's issue code, for `invalid` and `requiredEmpty` errors. */\n code?: string;\n params: CheckParams;\n};\n\nexport type PreflightLocale = {\n locale: string;\n /** No error-severity check: publishing this locale is expected to succeed. */\n ready: boolean;\n checks: PreflightCheck[];\n};\n\nexport type PreflightInput = { locales?: string[] };\n\nexport type PreflightResponse = {\n locales: PreflightLocale[];\n /** Checks about the entry as a whole, not one locale (e.g. a configured locale not started yet). */\n entry: PreflightCheck[];\n};\n\n/** A finding of the health engine, open until its rule passes again. */\nexport type ContentHealthFinding = {\n id: string;\n entryId: string;\n modelId: string;\n modelKey: string;\n /** The entry's title in the finding's locale (or the default locale), when readable. */\n entryTitle: string | null;\n /** `*` for a finding about the entry as a whole. */\n locale: string;\n rule: HealthRule;\n /** Distinguishes several findings of one rule on one entry (e.g. two images without alt text). */\n subject: string;\n severity: CheckSeverity;\n path?: string;\n params: CheckParams;\n firstSeenAt: string;\n lastSeenAt: string;\n};\n\nexport type ContentHealthQuery = { rule?: HealthRule; modelKey?: string; cursor?: string; limit?: number };\n\nexport type ContentHealthPage = { items: ContentHealthFinding[]; nextCursor: string | null };\n\nexport type ContentHealthSummary = { rules: { rule: HealthRule; count: number }[] };\n\n/** Someone with the entry open. */\nexport type PresencePerson = {\n userId: string;\n name: string;\n /** The locale they are editing, when the model is localized. */\n locale: string | null;\n /** When this tab started editing. */\n since: string;\n /** The caller's own other tab (the calling tab itself is never listed). */\n you: boolean;\n};\n\nexport type PresenceHeartbeatInput = {\n /** A random ID per browser tab, so two tabs of one person are counted apart. */\n tabId: string;\n locale?: string | null;\n};\n\nexport type EntryPresence = { people: PresencePerson[] };\n\nexport type ModelPresence = { entries: { entryId: string; people: PresencePerson[] }[] };\n\nexport type ContentCount = { modelId: string; modelKey: string; total: number };\n\nexport type ContentCounts = { counts: ContentCount[] };\n","import type { SchemaDefinition } from '@shapio/schema';\n\n/** Editor assists (plan agentic-ecosystem §A0). Agents propose, people ship: nothing here publishes. */\nexport type AssistProvider = 'anthropic' | 'openai' | 'openai-compatible';\n\nexport type AssistUsage = { month: string; runs: number; inputTokens: number; outputTokens: number };\n\n/** `usage` only for admins with `changes.manage`; provider and model only while assist is on. */\nexport type AssistStatus = {\n enabled: boolean;\n provider?: AssistProvider;\n model?: string;\n usage?: AssistUsage;\n};\n\nexport type AltTextInput = { assetId: string; locale?: string };\nexport type AltTextResult = { alt: string; model: string };\n\n/** A model-written text; `truncated` when it was cut to the field's or the request's limit. */\nexport type AssistTextResult = { text: string; truncated: boolean; model: string };\n\nexport type SummarizeInput = { modelKey: string; entryId: string; locale?: string; fieldApiKey: string };\n\nexport type TranslateInput = { modelKey: string; entryId: string; from: string; to: string };\nexport type AssistIssue = { path: string; code: string; message: string };\n/** `data` is in the editor's save format: save it as the `to` locale's draft. */\nexport type TranslateResult = { data: Record<string, unknown>; issues: AssistIssue[]; model: string };\n\nexport type RewriteInput = { text: string; instruction: string; maxLength?: number };\n\nexport type SchemaDraftInput = { description: string };\n/** New definitions with new stable IDs, in save order (references first). Nothing is written. */\nexport type SchemaDraftResult = { definitions: SchemaDefinition[]; model: string };\n\nexport const CONTENT_OPS_RULES = ['altMissing', 'localeMissing'] as const;\nexport type ContentOpsRule = (typeof CONTENT_OPS_RULES)[number];\nexport type ContentOpsInput = { rule: ContentOpsRule; modelKey?: string; fromLocale?: string };\nexport type ContentOpsStatus = 'queued' | 'running' | 'succeeded' | 'failed';\n\n/** One library asset's proposed alt text; apply it with the media update at `assetVersion`. */\nexport type AltProposal = {\n assetId: string;\n filename: string;\n currentAlt: string | null;\n proposedAlt: string;\n assetVersion: number;\n findingCount: number;\n};\n\n/** A finding the run left alone, and why (an error code or a reason such as `publishesOnSave`). */\nexport type ContentOpsSkip = {\n key: string;\n entryId?: string;\n assetId?: string;\n locale?: string;\n reason: string;\n detail?: unknown;\n};\nexport type ContentOpsWritten = { entryId: string; modelKey: string; locale: string; version: number };\n\nexport type AltMissingResult = { rule: 'altMissing'; proposals: AltProposal[]; skipped: ContentOpsSkip[] };\n/** The drafts were written into the change set `changeSetId` (null when nothing was written). */\nexport type LocaleMissingResult = {\n rule: 'localeMissing';\n changeSetId: string | null;\n fromLocale: string;\n written: ContentOpsWritten[];\n skipped: ContentOpsSkip[];\n};\nexport type ContentOpsResult = AltMissingResult | LocaleMissingResult;\n\nexport type ContentOpsRun = {\n runId: string;\n rule: ContentOpsRule;\n status: ContentOpsStatus;\n model: string;\n createdAt: string;\n finishedAt: string | null;\n error: { code: string } | null;\n /** Once succeeded (null before, or partial progress while running). */\n result: ContentOpsResult | null;\n};\n","import type { RequestFn } from '../request.js';\nimport { createAppUsersApi } from './appUsers.js';\nimport { createAssistApi } from './assist.js';\nimport { createChangeSetsApi } from './changeSets.js';\nimport { createContentApi } from './content.js';\nimport { createEditingApi } from './editing.js';\nimport { createMediaApi } from './media.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport { createPublishingApi } from './publishing.js';\nimport { toQueryString } from './query.js';\nimport { createSchemaApi } from './schema.js';\nimport { createSitesApi } from './sites.js';\nimport type {\n AcceptInvitationInput,\n AdminSession,\n AdminUser,\n ApiToken,\n AuditPage,\n AuditQuery,\n ChangePasswordInput,\n CreateApiTokenInput,\n CreatedApiToken,\n CreateRoleInput,\n CsrfResponse,\n InspectInvitationResponse,\n Invitation,\n InvitationLink,\n InviteUserInput,\n LoginInput,\n MeResponse,\n PasswordResetConfirmInput,\n PasswordResetRequestInput,\n Role,\n SessionStarted,\n SetupInput,\n SetupStatusResponse,\n UpdateAdminUserInput,\n UpdateProfileInput,\n UpdateRoleInput,\n} from './types.js';\nimport { createUsageApi } from './usage.js';\n\n/**\n * Admin endpoints: identity (setup, auth, sessions, users, invitations, roles, tokens, audit) and the schema\n * registry (models, components, schema, locales), the media library and content.\n */\nexport const createAdminApi = (request: RequestFn) => ({\n setup: {\n status: () => request<SetupStatusResponse>(ADMIN_PATHS.setup),\n complete: (body: SetupInput) => request<SessionStarted>(ADMIN_PATHS.setup, { method: 'POST', body }),\n },\n auth: {\n csrf: () => request<CsrfResponse>(ADMIN_PATHS.csrf),\n login: (body: LoginInput) => request<SessionStarted>(ADMIN_PATHS.login, { method: 'POST', body }),\n logout: () => request<void>(ADMIN_PATHS.logout, { method: 'POST' }),\n me: () => request<MeResponse>(ADMIN_PATHS.me),\n updateProfile: (body: UpdateProfileInput) =>\n request<AdminUser>(ADMIN_PATHS.me, { method: 'PATCH', body }),\n /** The session is rotated: the response carries the new session's CSRF token. */\n changePassword: (body: ChangePasswordInput) =>\n request<CsrfResponse>(ADMIN_PATHS.password, { method: 'POST', body }),\n requestPasswordReset: (body: PasswordResetRequestInput) =>\n request<void>(ADMIN_PATHS.passwordReset, { method: 'POST', body }),\n confirmPasswordReset: (body: PasswordResetConfirmInput) =>\n request<void>(ADMIN_PATHS.passwordResetConfirm, { method: 'POST', body }),\n },\n sessions: {\n list: () => request<AdminSession[]>(ADMIN_PATHS.sessions),\n revoke: (id: string) => request<void>(withId(ADMIN_PATHS.sessions, id), { method: 'DELETE' }),\n },\n users: {\n list: () => request<AdminUser[]>(ADMIN_PATHS.users),\n get: (id: string) => request<AdminUser>(withId(ADMIN_PATHS.users, id)),\n update: (id: string, body: UpdateAdminUserInput) =>\n request<AdminUser>(withId(ADMIN_PATHS.users, id), { method: 'PATCH', body }),\n remove: (id: string) => request<void>(withId(ADMIN_PATHS.users, id), { method: 'DELETE' }),\n revokeSessions: (id: string) =>\n request<void>(`${withId(ADMIN_PATHS.users, id)}/sessions`, { method: 'DELETE' }),\n },\n invitations: {\n list: () => request<Invitation[]>(ADMIN_PATHS.invitations),\n create: (body: InviteUserInput) => request<Invitation>(ADMIN_PATHS.invitations, { method: 'POST', body }),\n revoke: (id: string) => request<void>(withId(ADMIN_PATHS.invitations, id), { method: 'DELETE' }),\n /** A fresh link to send by hand; any earlier link for this invitation stops working. */\n link: (id: string) =>\n request<InvitationLink>(`${withId(ADMIN_PATHS.invitations, id)}/link`, { method: 'POST' }),\n /** Public: the token travels in the body, never in a URL the server logs. */\n inspect: (token: string) =>\n request<InspectInvitationResponse>(ADMIN_PATHS.inspectInvitation, { method: 'POST', body: { token } }),\n accept: (body: AcceptInvitationInput) =>\n request<SessionStarted>(ADMIN_PATHS.acceptInvitation, { method: 'POST', body }),\n },\n roles: {\n list: () => request<Role[]>(ADMIN_PATHS.roles),\n get: (id: string) => request<Role>(withId(ADMIN_PATHS.roles, id)),\n create: (body: CreateRoleInput) => request<Role>(ADMIN_PATHS.roles, { method: 'POST', body }),\n update: (id: string, body: UpdateRoleInput) =>\n request<Role>(withId(ADMIN_PATHS.roles, id), { method: 'PATCH', body }),\n remove: (id: string) => request<void>(withId(ADMIN_PATHS.roles, id), { method: 'DELETE' }),\n },\n tokens: {\n list: () => request<ApiToken[]>(ADMIN_PATHS.tokens),\n create: (body: CreateApiTokenInput) =>\n request<CreatedApiToken>(ADMIN_PATHS.tokens, { method: 'POST', body }),\n revoke: (id: string) => request<void>(withId(ADMIN_PATHS.tokens, id), { method: 'DELETE' }),\n },\n audit: {\n list: (query: AuditQuery = {}) => request<AuditPage>(`${ADMIN_PATHS.audit}${toQueryString(query)}`),\n },\n ...createSchemaApi(request),\n ...createMediaApi(request),\n ...createContentApi(request),\n ...createEditingApi(request),\n ...createPublishingApi(request),\n ...createAppUsersApi(request),\n ...createChangeSetsApi(request),\n ...createUsageApi(request),\n ...createSitesApi(request),\n ...createAssistApi(request),\n});\n\nexport type AdminApi = ReturnType<typeof createAdminApi>;\nexport { ADMIN_PATHS } from './paths.js';\nexport * from './types.js';\nexport * from './schemaTypes.js';\nexport * from './schemaSyncTypes.js';\nexport * from './mediaTypes.js';\nexport * from './contentTypes.js';\nexport * from './publishingTypes.js';\nexport * from './appUsersTypes.js';\nexport * from './changeSetTypes.js';\nexport * from './usageTypes.js';\nexport * from './sitesTypes.js';\nexport { SITE_HEADER, SITES_PATHS } from './sites.js';\nexport { toContentQueryString } from './contentQuery.js';\nexport { buildUploadForm, resolveUploadUrl } from './media.js';\nexport { HEALTH_RULES } from './editingTypes.js';\nexport { ASSIST_PATHS } from './assist.js';\nexport { CONTENT_OPS_RULES } from './assistTypes.js';\n","import type { RequestFn } from '../request.js';\nimport type {\n AppChangePasswordInput,\n AppLoginInput,\n AppOAuthProvider,\n AppRegisterInput,\n AppRegisterResult,\n AppSession,\n AppUser,\n} from './types.js';\n\nexport const APP_AUTH_PATHS = {\n register: '/api/app-auth/register',\n login: '/api/app-auth/login',\n refresh: '/api/app-auth/refresh',\n logout: '/api/app-auth/logout',\n me: '/api/app-auth/me',\n password: '/api/app-auth/me/password',\n confirmEmail: '/api/app-auth/confirm-email',\n resendConfirmation: '/api/app-auth/confirm-email/resend',\n passwordReset: '/api/app-auth/password-reset',\n passwordResetConfirm: '/api/app-auth/password-reset/confirm',\n providers: '/api/app-auth/providers',\n oauthExchange: '/api/app-auth/oauth/exchange',\n} as const;\n\n/**\n * App-user endpoints. Calls that act as the signed-in user need a client created with `token: accessToken`.\n * `baseUrl` is the client's base URL, used to build the OAuth start link the browser navigates to.\n */\nexport const createAppAuthApi = (request: RequestFn, baseUrl: string) => ({\n register: (body: AppRegisterInput) =>\n request<AppRegisterResult>(APP_AUTH_PATHS.register, { method: 'POST', body }),\n login: (body: AppLoginInput) => request<AppSession>(APP_AUTH_PATHS.login, { method: 'POST', body }),\n refresh: (refreshToken: string) =>\n request<AppSession>(APP_AUTH_PATHS.refresh, { method: 'POST', body: { refreshToken } }),\n /**\n * Signs the account out everywhere: this login's refresh tokens are revoked, and every access token the\n * account holds (on any device) is refused from the next request. Other logins recover with their own\n * refresh token.\n */\n logout: (refreshToken: string) =>\n request<void>(APP_AUTH_PATHS.logout, { method: 'POST', body: { refreshToken } }),\n /** The signed-in user. Answers 401 once the account logged out anywhere, changed its password or was blocked. */\n me: () => request<AppUser>(APP_AUTH_PATHS.me),\n updateMe: (body: { name: string }) => request<AppUser>(APP_AUTH_PATHS.me, { method: 'PATCH', body }),\n /** Returns a new session; every other sign-in of the account is revoked. */\n changePassword: (body: AppChangePasswordInput) =>\n request<AppSession>(APP_AUTH_PATHS.password, { method: 'POST', body }),\n deleteMe: (body: { password?: string } = {}) =>\n request<void>(APP_AUTH_PATHS.me, { method: 'DELETE', body }),\n /** The token from the `#token=` fragment of the confirmation link. */\n confirmEmail: (token: string) =>\n request<void>(APP_AUTH_PATHS.confirmEmail, { method: 'POST', body: { token } }),\n resendConfirmation: (email: string) =>\n request<void>(APP_AUTH_PATHS.resendConfirmation, { method: 'POST', body: { email } }),\n requestPasswordReset: (email: string) =>\n request<void>(APP_AUTH_PATHS.passwordReset, { method: 'POST', body: { email } }),\n confirmPasswordReset: (body: { token: string; password: string }) =>\n request<void>(APP_AUTH_PATHS.passwordResetConfirm, { method: 'POST', body }),\n providers: async () =>\n (await request<{ providers: AppOAuthProvider[] }>(APP_AUTH_PATHS.providers)).providers,\n /**\n * Where to send the browser to sign in with a provider. `codeChallenge` comes from `createPkcePair()`;\n * keep its `codeVerifier` until the browser returns. It comes back to `redirectTo` (an allowed return URL,\n * by default an origin listed in CORS_ORIGINS) with `?code=` (pass it to `exchangeCode`) or `?error=`.\n */\n oauthStartUrl: (provider: AppOAuthProvider, redirectTo: string, codeChallenge: string) =>\n `${baseUrl.replace(/\\/+$/, '')}/api/app-auth/oauth/${provider}/start?redirectTo=${encodeURIComponent(redirectTo)}&codeChallenge=${encodeURIComponent(codeChallenge)}`,\n /** Trades the one-time code for a session. A wrong verifier spends the code: start the sign-in again. */\n exchangeCode: (code: string, codeVerifier: string) =>\n request<AppSession>(APP_AUTH_PATHS.oauthExchange, { method: 'POST', body: { code, codeVerifier } }),\n});\n\nexport type AppAuthApi = ReturnType<typeof createAppAuthApi>;\n","/**\n * Next.js data-cache support for delivery reads. Under Next (`process.env.NEXT_RUNTIME` is set) or when the\n * client is given a `next` option, every delivery read passes `next: { tags }` to `fetch`, so a site can\n * refresh exactly what changed with `revalidateTag`. The cache mode is only set when asked for, except that a\n * read pinned to a publication snapshot is immutable and always `force-cache`, and a drafts-mode read is never\n * cached or tagged (`no-store`). Elsewhere nothing is added.\n */\n\n/** Next's `fetch` cache modes the client passes through. */\nexport type NextCacheMode = 'force-cache' | 'no-store';\n\nexport type NextCacheOptions = {\n /** Next's `fetch` `cache` option. Unset: Next's own default, except pinned snapshot reads (`force-cache`). */\n cache?: NextCacheMode;\n /** Seconds a cached response stays fresh (`next.revalidate`); `false` keeps it until a tag is revalidated. */\n revalidate?: number | false;\n};\n\n/** The last argument of every delivery read: overrides the client's `next` option; `false` adds nothing. */\nexport type DeliveryReadOptions = { next?: NextCacheOptions | false };\n\n/** What a delivery read adds to its `fetch` init. */\nexport type NextFetchInit = {\n cache?: NextCacheMode;\n next?: { tags: string[]; revalidate?: number | false };\n};\n\nconst TAG_PREFIX = 'shapio';\n\n/**\n * The cache tags delivery reads carry (`revalidateTag(shapioTags.entry('articles', id), { expire: 0 })`).\n * Models are named by their route key: a collection's plural API ID, a singleton's API ID.\n */\nexport const shapioTags = {\n /** Every delivery read of the site; `shapio:site` when the client names no site. */\n site: (siteKey?: string) =>\n siteKey === undefined ? `${TAG_PREFIX}:site` : `${TAG_PREFIX}:site:${siteKey}`,\n /** Every read of one model (lists, singletons and its entries). */\n model: (routeKey: string) => `${TAG_PREFIX}:${routeKey}`,\n /** Reads of one entry by its ID. */\n entry: (routeKey: string, entryId: string) => `${TAG_PREFIX}:${routeKey}:${entryId}`,\n} as const;\n\n/** Spelled out so bundlers that inline `process.env.NEXT_RUNTIME` see it; guarded for browsers. */\nconst isNextRuntime = (): boolean => {\n try {\n return typeof process !== 'undefined' && Boolean(process.env.NEXT_RUNTIME);\n } catch {\n return false;\n }\n};\n\n/** What every delivery read needs to tag itself: the client's site, `next` option and drafts mode. */\nexport type DeliveryCacheContext = {\n site: string | undefined;\n next: NextCacheOptions | false | undefined;\n /** Drafts mode (`drafts: true`): reads ask for drafts, which are never cached. */\n drafts: boolean;\n};\n\nexport type NextReadInput = {\n /** The client's `next` option. */\n client: NextCacheOptions | false | undefined;\n /** The read's own `next` option. */\n read: NextCacheOptions | false | undefined;\n tags: string[];\n /** The read names a publication snapshot (immutable). */\n pinned: boolean;\n /** Drafts mode: under Next (or with any `next` option) the read is `no-store` and untagged. */\n drafts?: boolean;\n};\n\n/** The `cache` and `next` fetch options of one delivery read; empty outside Next unless asked for. */\nexport const nextFetchInit = ({\n client,\n read,\n tags,\n pinned,\n drafts = false,\n}: NextReadInput): NextFetchInit => {\n if (drafts) {\n // Drafts change on every save: never in Next's data cache, never tagged, whatever the `next` options say.\n const asked = (client !== undefined && client !== false) || (read !== undefined && read !== false);\n return asked || isNextRuntime() ? { cache: 'no-store' } : {};\n }\n if (read === false || (read === undefined && client === false)) {\n return {};\n }\n const configured = client === false ? read : read === undefined ? client : { ...client, ...read };\n if (configured === undefined && !isNextRuntime()) {\n return {};\n }\n if (pinned && read?.cache === undefined) {\n return { cache: 'force-cache', next: { tags } };\n }\n const cache = configured?.cache;\n const revalidate = configured?.revalidate;\n return {\n ...(cache === undefined ? {} : { cache }),\n next: { tags, ...(revalidate === undefined ? {} : { revalidate }) },\n };\n};\n","import { toContentQueryString } from './admin/contentQuery.js';\nimport type { DeliveryGetQuery, DeliveryItem, DeliveryList, DeliveryListQuery } from './deliveryTypes.js';\nimport {\n nextFetchInit,\n shapioTags,\n type DeliveryCacheContext,\n type DeliveryReadOptions,\n} from './nextCache.js';\nimport type { RequestFn } from './request.js';\n\nexport const DELIVERY_PATH = '/api/content';\n\nconst routePath = (routeKey: string) => `${DELIVERY_PATH}/${encodeURIComponent(routeKey)}`;\n\n/**\n * The content query string plus `snapshot`, `richText` and `seo`, which only delivery reads take, and\n * `publicationState=draft` in drafts mode.\n */\nconst deliveryQueryString = (\n { snapshot, richText, seo, ...query }: DeliveryListQuery,\n drafts: boolean,\n): string => {\n const extra = [\n ...(snapshot === undefined ? [] : [`snapshot=${encodeURIComponent(String(snapshot))}`]),\n ...(richText === undefined ? [] : [`richText=${encodeURIComponent(richText)}`]),\n ...(seo === undefined ? [] : [`seo=${encodeURIComponent(seo)}`]),\n ...(drafts ? ['publicationState=draft'] : []),\n ];\n const base = toContentQueryString(query);\n if (extra.length === 0) {\n return base;\n }\n return base ? `${base}&${extra.join('&')}` : `?${extra.join('&')}`;\n};\n\n/** Drafts cannot be pinned: the server refuses `snapshot` with drafts, and so does the client, before sending. */\nconst draftsPinned = () =>\n Promise.reject(\n new Error(\n 'Drafts mode reads saved drafts, which have no publication snapshot: leave `snapshot` out when the client has `drafts: true`',\n ),\n );\n\n/**\n * Published content, typed by the caller (`delivery.list<Article>('articles', { locale: 'fr', snapshot })`).\n * A collection is read with `list` (a page) and `get` (one entry); a singleton with `singleton`. Each read\n * takes Next.js cache options last and is tagged for `revalidateTag` (nextCache.ts): lists and singletons with\n * the site and model tags, `get` with the entry's tag too. In drafts mode (`drafts: true`) every read asks for\n * drafts (`publicationState=draft`), is never cached or tagged under Next, and refuses a pinned snapshot.\n */\nexport const createDeliveryApi = (request: RequestFn, cacheContext: DeliveryCacheContext) => {\n const { drafts } = cacheContext;\n const fetchInit = (tags: string[], query: DeliveryGetQuery, { next }: DeliveryReadOptions) =>\n nextFetchInit({\n client: cacheContext.next,\n read: next,\n tags,\n pinned: query.snapshot !== undefined,\n drafts,\n });\n const read = <R>(path: string, tags: string[], query: DeliveryListQuery, options: DeliveryReadOptions) =>\n drafts && query.snapshot !== undefined\n ? draftsPinned()\n : request<R>(`${path}${deliveryQueryString(query, drafts)}`, fetchInit(tags, query, options));\n const siteTag = shapioTags.site(cacheContext.site);\n return {\n list: <T = Record<string, unknown>>(\n routeKey: string,\n query: DeliveryListQuery = {},\n options: DeliveryReadOptions = {},\n ) => read<DeliveryList<T>>(routePath(routeKey), [siteTag, shapioTags.model(routeKey)], query, options),\n singleton: <T = Record<string, unknown>>(\n apiKey: string,\n query: DeliveryGetQuery = {},\n options: DeliveryReadOptions = {},\n ) => read<DeliveryItem<T>>(routePath(apiKey), [siteTag, shapioTags.model(apiKey)], query, options),\n get: <T = Record<string, unknown>>(\n routeKey: string,\n id: string,\n query: DeliveryGetQuery = {},\n options: DeliveryReadOptions = {},\n ) =>\n read<DeliveryItem<T>>(\n `${routePath(routeKey)}/${encodeURIComponent(id)}`,\n [siteTag, shapioTags.model(routeKey), shapioTags.entry(routeKey, id)],\n query,\n options,\n ),\n };\n};\n\nexport type DeliveryApi = ReturnType<typeof createDeliveryApi>;\n","import {\n nextFetchInit,\n shapioTags,\n type DeliveryCacheContext,\n type DeliveryReadOptions,\n} from './nextCache.js';\nimport type { RequestFn } from './request.js';\nimport type { DeliverySite } from './seoTypes.js';\n\nexport const DELIVERY_SITE_PATH = '/api/site';\n\n/**\n * The request's site as delivery sees it (key, name, SEO defaults), with the client's token and site. Under\n * Next.js the read carries the site tag (nextCache.ts); in drafts mode it is `no-store` and untagged instead\n * (the site has no draft state, so no `publicationState` is sent).\n */\nexport const createSiteApi = (request: RequestFn, cacheContext: DeliveryCacheContext) => ({\n get: ({ next }: DeliveryReadOptions = {}) =>\n request<DeliverySite>(\n DELIVERY_SITE_PATH,\n nextFetchInit({\n client: cacheContext.next,\n read: next,\n tags: [shapioTags.site(cacheContext.site)],\n pinned: false,\n drafts: cacheContext.drafts,\n }),\n ),\n});\n\nexport type SiteApi = ReturnType<typeof createSiteApi>;\n","import { toQueryString } from './admin/query.js';\nimport type { RequestFn } from './request.js';\nimport type {\n CurrentSnapshot,\n SnapshotChange,\n SnapshotChangesPage,\n SnapshotChangesQuery,\n} from './snapshotTypes.js';\n\nexport const SNAPSHOT_PATHS = {\n current: '/api/snapshots/current',\n changes: '/api/snapshots/changes',\n} as const;\n\n/** Snapshots and the diff between two of them, for incremental site builds (delivery credentials). */\nexport const createSnapshotsApi = (request: RequestFn) => {\n const changes = (query: SnapshotChangesQuery) =>\n request<SnapshotChangesPage>(`${SNAPSHOT_PATHS.changes}${toQueryString(query)}`);\n return {\n current: () => request<CurrentSnapshot>(SNAPSHOT_PATHS.current),\n changes,\n /** Every change between `from` and `to`, following `nextCursor` until the last page. */\n allChanges: async (query: Omit<SnapshotChangesQuery, 'after'>) => {\n const items: SnapshotChange[] = [];\n let page = await changes(query);\n items.push(...page.items);\n while (page.nextCursor !== null) {\n page = await changes({ ...query, to: page.to, after: page.nextCursor });\n items.push(...page.items);\n }\n return { from: page.from, to: page.to, schemaVersions: page.schemaVersions, items };\n },\n };\n};\n","import { createDeliveryApi } from './delivery.js';\nimport type { NextCacheOptions } from './nextCache.js';\nimport type { RequestFn } from './request.js';\nimport { createSiteApi } from './siteDelivery.js';\nimport { createSnapshotsApi } from './snapshots.js';\n\nexport type DeliveryClientOptions = {\n /** The site key the reads are tagged with (`shapioTags.site`); the transport names the site itself. */\n site?: string;\n /** Next.js data-cache options, as `createClient`'s `next` option. */\n next?: NextCacheOptions | false;\n /** Drafts mode, as `createClient`'s `drafts` option. */\n drafts?: boolean;\n};\n\n/**\n * The read side of the client over any transport: published content (`delivery`), the site (`site`) and\n * publication snapshots (`snapshots`). `createClient` builds it over HTTP; `@shapio/local` over the delivery\n * API running in the same process. The transport receives exactly the paths the HTTP client sends.\n */\nexport const createDeliveryClient = (\n request: RequestFn,\n { site, next, drafts = false }: DeliveryClientOptions = {},\n) => {\n const cacheContext = { site, next, drafts };\n return {\n /** Published content (the delivery API; drafts in drafts mode), typed by the caller. */\n delivery: createDeliveryApi(request, cacheContext),\n /** The site as delivery sees it: key, name and SEO defaults (`GET /api/site`). */\n site: createSiteApi(request, cacheContext),\n /** Publication snapshots and the diff between two (incremental builds). */\n snapshots: createSnapshotsApi(request),\n };\n};\n\nexport type ShapioDeliveryClient = ReturnType<typeof createDeliveryClient>;\n","import { SITE_HEADER } from './admin/sites.js';\nimport { DELIVERY_PATH } from './delivery.js';\nimport { DELIVERY_SITE_PATH } from './siteDelivery.js';\nimport { SNAPSHOT_PATHS } from './snapshots.js';\n\n/** Delivery reads name their site with `?site=`; everything else with the `Shapio-Site` header. */\nexport const SITE_QUERY_PARAMETER = 'site';\n\n/** Delivery reads (content, snapshots, the site): a GET there carries the site in its URL. */\nconst DELIVERY_READ_PREFIXES = [\n `${DELIVERY_PATH}/`,\n `${DELIVERY_PATH}?`,\n '/api/snapshots/',\n `${DELIVERY_SITE_PATH}?`,\n] as const;\n\nconst isDeliveryRead = (method: string, path: string) =>\n method === 'GET' &&\n (path === DELIVERY_PATH ||\n path === DELIVERY_SITE_PATH ||\n Object.values(SNAPSHOT_PATHS).some((snapshotPath) => path === snapshotPath) ||\n DELIVERY_READ_PREFIXES.some((prefix) => path.startsWith(prefix)));\n\nconst namesSite = (path: string) => {\n const index = path.indexOf('?');\n return index !== -1 && new URLSearchParams(path.slice(index + 1)).has(SITE_QUERY_PARAMETER);\n};\n\n/**\n * Where a request names the client's site (sites plan §H). Delivery GETs put it in the query string: a\n * simple cross-origin GET needs no CORS preflight, and URL-keyed CDN caches keep sites apart. Every other\n * request sends the `Shapio-Site` header. A path that already names a site is left as it is.\n */\nexport const applySite = (\n site: string | undefined,\n method: string,\n path: string,\n): { path: string; headers: Record<string, string> } => {\n if (site === undefined || namesSite(path)) {\n return { path, headers: {} };\n }\n if (isDeliveryRead(method, path)) {\n const parameter = `${SITE_QUERY_PARAMETER}=${encodeURIComponent(site)}`;\n return { path: `${path}${path.includes('?') ? '&' : '?'}${parameter}`, headers: {} };\n }\n return { path, headers: { [SITE_HEADER]: site } };\n};\n","import { ShapioApiError } from './errors.js';\nimport type { NextFetchInit } from './nextCache.js';\nimport { applySite } from './site.js';\n\n/** Fetch's `credentials` mode (spelled out: the DOM lib type is not available to Node consumers). */\nexport type FetchCredentials = 'omit' | 'same-origin' | 'include';\n\nexport type RequestOptions = {\n method?: string;\n body?: unknown;\n signal?: AbortSignal;\n} & NextFetchInit;\n\nexport type RequestFn = <T>(path: string, options?: RequestOptions) => Promise<T>;\n\nexport type RequestConfig = {\n baseUrl: string;\n token: string | undefined;\n fetch: typeof globalThis.fetch;\n credentials: FetchCredentials | undefined;\n headers: (() => Readonly<Record<string, string>>) | undefined;\n /** The site key every request names (see site.ts); undefined: the credential's site, else the primary. */\n site: string | undefined;\n};\n\nconst parseBody = async (response: Response): Promise<unknown> => {\n const text = await response.text();\n if (text.length === 0) {\n return undefined;\n }\n try {\n return JSON.parse(text);\n } catch {\n return text;\n }\n};\n\n/** Builds the JSON request function every endpoint group uses. Non-2xx responses throw ShapioApiError. */\nexport const createRequest = ({\n baseUrl,\n token,\n fetch,\n credentials,\n headers,\n site,\n}: RequestConfig): RequestFn => {\n const origin = baseUrl.replace(/\\/+$/, '');\n return async <T>(\n requestPath: string,\n { method = 'GET', body, signal, cache, next }: RequestOptions = {},\n ): Promise<T> => {\n const { path, headers: siteHeaders } = applySite(site, method, requestPath);\n const requestHeaders: Record<string, string> = {\n accept: 'application/json',\n ...siteHeaders,\n ...headers?.(),\n };\n if (token) {\n requestHeaders.authorization = `Bearer ${token}`;\n }\n if (body !== undefined) {\n requestHeaders['content-type'] = 'application/json';\n }\n // `next` is Next.js's extension of fetch (cache tags); other runtimes ignore it, and it is only set there.\n const init: RequestInit & Pick<NextFetchInit, 'next'> = {\n method,\n headers: requestHeaders,\n ...(body !== undefined ? { body: JSON.stringify(body) } : {}),\n ...(signal ? { signal } : {}),\n ...(credentials ? { credentials } : {}),\n ...(cache ? { cache } : {}),\n ...(next ? { next } : {}),\n };\n const response = await fetch(`${origin}${path}`, init);\n const parsed = await parseBody(response);\n if (!response.ok) {\n throw new ShapioApiError(response.status, parsed);\n }\n return parsed as T;\n };\n};\n","import { createAdminApi } from './admin/index.js';\nimport { createAppAuthApi } from './appAuth/index.js';\nimport { createDeliveryClient } from './deliveryClient.js';\nimport type { NextCacheOptions } from './nextCache.js';\nimport { createRequest, type FetchCredentials } from './request.js';\nimport type { HealthResponse, ReadyResponse, VersionResponse } from './types.js';\n\nexport type ShapioClientOptions = {\n /** Base URL of the Shapio server including any BASE_PATH, e.g. `https://cms.example.com/cms`. */\n baseUrl: string;\n /** API token sent as a bearer token. */\n token?: string;\n /** Defaults to the global fetch; injectable for tests and custom agents. */\n fetch?: typeof globalThis.fetch;\n /** Fetch credentials mode. The admin uses `same-origin` so its session cookie is sent. */\n credentials?: FetchCredentials;\n /** Extra headers computed per request (the admin's CSRF token). */\n headers?: () => Readonly<Record<string, string>>;\n /**\n * The site key (multi-site instances). Delivery reads send it as `?site=`, every other request as the\n * `Shapio-Site` header. Leave it out to use the token's site, else the primary site. A site token only\n * ever reads its own site: naming another one is refused (403 `SITE_MISMATCH`).\n */\n site?: string;\n /**\n * Next.js data-cache options for delivery reads (`delivery.*`, `site.get`), e.g. `{ cache: 'force-cache' }`.\n * Under Next the reads are tagged for `revalidateTag` whether or not this is set; the cache mode is only\n * passed when asked for, and reads pinned to a snapshot are always `force-cache`. Set it outside Next to send\n * the same fetch options; `false` sends none. A read's own `next` option overrides this one.\n */\n next?: NextCacheOptions | false;\n /**\n * Drafts mode, for a site's development server: every delivery read asks for drafts\n * (`publicationState=draft`) instead of published content, and under Next is never cached or tagged. Needs\n * a delivery token whose role grants Read drafts (the server refuses others with 403 `DRAFTS_FORBIDDEN`);\n * never set it on a production build. Reads pinned to a `snapshot` are refused. `snapshots` is unaffected.\n */\n drafts?: boolean;\n};\n\nexport const createClient = ({\n baseUrl,\n token,\n fetch = globalThis.fetch,\n credentials,\n headers,\n site,\n next,\n drafts,\n}: ShapioClientOptions) => {\n const request = createRequest({ baseUrl, token, fetch, credentials, headers, site });\n const reads = createDeliveryClient(request, { site, next, ...(drafts !== undefined ? { drafts } : {}) });\n\n return {\n /**\n * Any Shapio route, e.g. the delivery API. Delivery paths use the model's route key: a collection's\n * plural API ID (`request('/api/content/articles')`, `/api/content/articles/<id>`), a singleton's API ID\n * (`/api/content/homepage`). The admin API (`admin.*`) always uses the singular API ID.\n */\n request,\n system: {\n health: (signal?: AbortSignal) => request<HealthResponse>('/api/health', signal ? { signal } : {}),\n ready: (signal?: AbortSignal) => request<ReadyResponse>('/api/ready', signal ? { signal } : {}),\n version: (signal?: AbortSignal) => request<VersionResponse>('/api/version', signal ? { signal } : {}),\n },\n /** Published content (the delivery API), typed by the caller. */\n delivery: reads.delivery,\n /** The site as delivery sees it: key, name and SEO defaults (`GET /api/site`). */\n site: reads.site,\n admin: createAdminApi(request),\n /** Publication snapshots and the diff between two (incremental builds). */\n snapshots: reads.snapshots,\n /** End users of your sites and apps: sign-up, sign-in, tokens, OAuth. */\n appAuth: createAppAuthApi(request, baseUrl),\n };\n};\n\nexport type ShapioClient = ReturnType<typeof createClient>;\n","/**\n * Verifying Shapio's signed webhooks and deploy triggers on the receiving side (a site's revalidate route,\n * a build hook). The scheme is the server's (`apps/api/src/publishing/signature.ts`):\n * `X-Shapio-Signature: v1=<hex HMAC-SHA256(secret, \"<timestamp>.<raw body>\")>` with\n * `X-Shapio-Timestamp: <unix seconds>`; several comma-separated `v1=` values are accepted (secret rotation).\n * Uses Web Crypto, so it runs in Node, edge runtimes and browsers alike.\n */\nexport const WEBHOOK_SIGNATURE_HEADER = 'x-shapio-signature';\nexport const WEBHOOK_TIMESTAMP_HEADER = 'x-shapio-timestamp';\nexport const WEBHOOK_EVENT_HEADER = 'x-shapio-event';\n/** Requests signed further from now than this are rejected (replay protection). */\nexport const WEBHOOK_TOLERANCE_SECONDS = 300;\n\nconst SIGNATURE_VERSION = 'v1';\n\nexport type WebhookSignatureInput = {\n /** The webhook's or connection's signing secret. */\n secret: string;\n /** The `X-Shapio-Signature` header. */\n signature: string | null | undefined;\n /** The `X-Shapio-Timestamp` header. */\n timestamp: string | null | undefined;\n /** The raw request body, exactly as received (not re-serialised JSON). */\n body: string;\n /** Defaults to the current time. */\n now?: Date;\n /** Defaults to WEBHOOK_TOLERANCE_SECONDS. */\n toleranceSeconds?: number;\n};\n\nexport type WebhookSignatureCheck = { ok: true } | { ok: false; reason: string };\n\nconst toHex = (bytes: ArrayBuffer) =>\n Array.from(new Uint8Array(bytes), (byte) => byte.toString(16).padStart(2, '0')).join('');\n\n/** Compares two strings without returning early on the first difference. */\nconst constantTimeEqual = (a: string, b: string) => {\n let difference = a.length ^ b.length;\n for (let index = 0; index < Math.max(a.length, b.length); index += 1) {\n difference |= (a.charCodeAt(index) || 0) ^ (b.charCodeAt(index) || 0);\n }\n return difference === 0;\n};\n\nconst expectedSignature = async (secret: string, timestamp: number, body: string) => {\n const encoder = new TextEncoder();\n const key = await globalThis.crypto.subtle.importKey(\n 'raw',\n encoder.encode(secret),\n { name: 'HMAC', hash: 'SHA-256' },\n false,\n ['sign'],\n );\n const mac = await globalThis.crypto.subtle.sign('HMAC', key, encoder.encode(`${timestamp}.${body}`));\n return `${SIGNATURE_VERSION}=${toHex(mac)}`;\n};\n\n/** Checks a Shapio signature; `{ ok: false, reason }` says why it was refused (never throws for bad input). */\nexport const verifyWebhookSignature = async ({\n secret,\n signature,\n timestamp,\n body,\n now = new Date(),\n toleranceSeconds = WEBHOOK_TOLERANCE_SECONDS,\n}: WebhookSignatureInput): Promise<WebhookSignatureCheck> => {\n if (!signature || !timestamp || !/^\\d{1,12}$/.test(timestamp)) {\n return { ok: false, reason: 'missing signature or timestamp' };\n }\n const seconds = Number(timestamp);\n if (Math.abs(now.getTime() / 1000 - seconds) > toleranceSeconds) {\n return { ok: false, reason: 'timestamp outside the allowed window' };\n }\n const expected = await expectedSignature(secret, seconds, body);\n const matches = signature\n .split(',')\n .map((candidate) => candidate.trim())\n .some((candidate) => constantTimeEqual(candidate, expected));\n return matches ? { ok: true } : { ok: false, reason: 'signature mismatch' };\n};\n","/**\n * PKCE (RFC 7636) for the app side of Shapio's OAuth sign-in: the app keeps the verifier (e.g. in\n * sessionStorage) and sends the S256 challenge with the start link; the one-time code it gets back is only\n * exchanged together with that verifier. Uses Web Crypto, so it works in browsers and Node alike.\n */\nexport type AppPkcePair = { codeVerifier: string; codeChallenge: string };\n\nconst toBase64Url = (bytes: Uint8Array): string =>\n btoa(String.fromCharCode(...bytes))\n .replace(/\\+/g, '-')\n .replace(/\\//g, '_')\n .replace(/=+$/, '');\n\n/** The S256 challenge of a verifier: base64url(SHA-256(verifier)). */\nexport const codeChallengeOf = async (codeVerifier: string): Promise<string> =>\n toBase64Url(\n new Uint8Array(await globalThis.crypto.subtle.digest('SHA-256', new TextEncoder().encode(codeVerifier))),\n );\n\n/** A fresh verifier (32 random bytes, 43 characters) and its S256 challenge. */\nexport const createPkcePair = async (): Promise<AppPkcePair> => {\n const codeVerifier = toBase64Url(globalThis.crypto.getRandomValues(new Uint8Array(32)));\n return { codeVerifier, codeChallenge: await codeChallengeOf(codeVerifier) };\n};\n"],"mappings":";;;;AAcA,MAAa,qBAAqB,aAAwB;CACxD,UAAU;EACR,OAAO,QAAsB,CAAC,MAC5B,QAAqB,GAAG,YAAY,WAAW,cAAc,KAAK,GAAG;EACvE,MAAM,OAAe,QAAsB,OAAO,YAAY,UAAU,EAAE,CAAC;;EAE3E,SAAS,IAAY,SACnB,QAAsB,OAAO,YAAY,UAAU,EAAE,GAAG;GAAE,QAAQ;GAAS;EAAK,CAAC;EACnF,SAAS,OAAe,QAAc,OAAO,YAAY,UAAU,EAAE,GAAG,EAAE,QAAQ,SAAS,CAAC;;EAE5F,qBAAqB,OACnB,QAAc,GAAG,OAAO,YAAY,UAAU,EAAE,EAAE,uBAAuB,EAAE,QAAQ,OAAO,CAAC;CAC/F;CACA,UAAU;EACR,YAAY,QAAmB,YAAY,QAAQ;EACnD,MAAM,OAAe,QAAiB,OAAO,YAAY,UAAU,EAAE,CAAC;EACtE,SAAS,SAA6B,QAAiB,YAAY,UAAU;GAAE,QAAQ;GAAQ;EAAK,CAAC;;EAErG,SAAS,IAAY,SACnB,QAAiB,OAAO,YAAY,UAAU,EAAE,GAAG;GAAE,QAAQ;GAAS;EAAK,CAAC;EAC9E,SAAS,OAAe,QAAc,OAAO,YAAY,UAAU,EAAE,GAAG,EAAE,QAAQ,SAAS,CAAC;CAC9F;AACF;;;ACnBA,MAAa,eAAe;CAC1B,QAAQ;CACR,SAAS;CACT,WAAW;CACX,WAAW;CACX,SAAS;CACT,aAAa;CACb,mBAAmB;CACnB,YAAY;AACd;;AAGA,MAAa,mBAAmB,aAAwB,EACtD,QAAQ;CACN,cAAc,QAAsB,aAAa,MAAM;CACvD,UAAU,SAAuB,QAAuB,aAAa,SAAS;EAAE,QAAQ;EAAQ;CAAK,CAAC;CACtG,YAAY,SACV,QAA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","../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 EntryHistory,\n EntryLocalesInput,\n EntryPublishInput,\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 /** With `expectedVersion`/`expectedVersions`, 409 CONTENT_VERSION_CONFLICT when a draft moved since. */\n publish: (modelKey: string, id: string, body: EntryPublishInput = {}) =>\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 /** Revisions with their authors' names, and the entry's publications (who published, when, how). */\n history: (modelKey: string, id: string, { locale }: { locale?: string } = {}) =>\n request<EntryHistory>(`${revisionsPath(modelKey, id)}${toQueryString({ locale })}`),\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 EntryHeartbeat,\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): who else has the entry open, and its drafts. */\n heartbeat: (modelKey: string, id: string, body: PresenceHeartbeatInput) =>\n request<EntryHeartbeat>(entryPath(ADMIN_PATHS.presence, modelKey, id), { method: 'PUT', body }),\n entry: (modelKey: string, id: string) =>\n request<EntryPresence>(entryPath(ADMIN_PATHS.presence, modelKey, id)),\n /** Everyone editing an entry of the model (list rows). */\n model: (modelKey: string) => request<ModelPresence>(withId(ADMIN_PATHS.presence, modelKey)),\n leave: (modelKey: string, id: string, tabId: string) =>\n request<void>(`${entryPath(ADMIN_PATHS.presence, modelKey, id)}${toQueryString({ tabId })}`, {\n method: 'DELETE',\n }),\n },\n contentCounts: {\n list: () => request<ContentCounts>(ADMIN_PATHS.contentCounts),\n },\n});\n","import type { RequestFn } from '../request.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport type {\n ConnectionTestResult,\n CreateDeploymentConnectionInput,\n CreatePreviewTokenInput,\n CreateScheduleInput,\n CreateWebhookInput,\n DeploymentConnection,\n DeploymentConnectionCreated,\n DeploymentConnectionUpdated,\n DeploymentRun,\n DeploymentRunQuery,\n Job,\n JobQuery,\n JobSummary,\n OpenPreviewInput,\n OpenPreviewResult,\n PreviewTarget,\n Page,\n PreviewToken,\n PreviewTokenCreated,\n ScheduledPublication,\n ScheduleQuery,\n UpdateDeploymentConnectionInput,\n UpdateWebhookInput,\n Webhook,\n WebhookDelivery,\n WebhookEventType,\n WebhookWithSecret,\n} from './publishingTypes.js';\nimport { toQueryString } from './query.js';\n\n/** Jobs, scheduled publications, webhooks, deployment connections and runs, preview (package H). */\nexport const createPublishingApi = (request: RequestFn) => ({\n jobs: {\n list: (query: JobQuery = {}) => request<Page<Job>>(`${ADMIN_PATHS.jobs}${toQueryString(query)}`),\n summary: () => request<JobSummary>(`${ADMIN_PATHS.jobs}/summary`),\n get: (id: string) => request<Job>(withId(ADMIN_PATHS.jobs, id)),\n /** Dead jobs only: runs again from attempt 1. 409 JOB_NOT_RETRYABLE otherwise. */\n retry: (id: string) => request<Job>(`${withId(ADMIN_PATHS.jobs, id)}/retry`, { method: 'POST' }),\n },\n schedules: {\n list: (query: ScheduleQuery = {}) =>\n request<Page<ScheduledPublication>>(`${ADMIN_PATHS.schedules}${toQueryString(query)}`),\n create: (body: CreateScheduleInput) =>\n request<ScheduledPublication>(ADMIN_PATHS.schedules, { method: 'POST', body }),\n cancel: (id: string) => request<void>(withId(ADMIN_PATHS.schedules, id), { method: 'DELETE' }),\n },\n webhooks: {\n list: () => request<Webhook[]>(ADMIN_PATHS.webhooks),\n events: async () =>\n (await request<{ items: WebhookEventType[] }>(`${ADMIN_PATHS.webhooks}/events`)).items,\n get: (id: string) => request<Webhook>(withId(ADMIN_PATHS.webhooks, id)),\n create: (body: CreateWebhookInput) =>\n request<WebhookWithSecret>(ADMIN_PATHS.webhooks, { method: 'POST', body }),\n update: (id: string, body: UpdateWebhookInput) =>\n request<Webhook>(withId(ADMIN_PATHS.webhooks, id), { method: 'PATCH', body }),\n remove: (id: string) => request<void>(withId(ADMIN_PATHS.webhooks, id), { method: 'DELETE' }),\n rotateSecret: (id: string) =>\n request<WebhookWithSecret>(`${withId(ADMIN_PATHS.webhooks, id)}/rotate-secret`, { method: 'POST' }),\n /** Queues a `webhook.test` delivery; poll the delivery log for its outcome. */\n test: (id: string) =>\n request<WebhookDelivery>(`${withId(ADMIN_PATHS.webhooks, id)}/test`, { method: 'POST' }),\n deliveries: (id: string, query: { cursor?: string; limit?: number } = {}) =>\n request<Page<WebhookDelivery>>(`${withId(ADMIN_PATHS.webhooks, id)}/deliveries${toQueryString(query)}`),\n /** Sends the same payload again as a new delivery. */\n redeliver: (id: string, deliveryId: string) =>\n request<WebhookDelivery>(\n `${withId(ADMIN_PATHS.webhooks, id)}/deliveries/${encodeURIComponent(deliveryId)}/redeliver`,\n { method: 'POST' },\n ),\n },\n deployments: {\n connections: {\n list: () => request<DeploymentConnection[]>(ADMIN_PATHS.deploymentConnections),\n get: (id: string) => request<DeploymentConnection>(withId(ADMIN_PATHS.deploymentConnections, id)),\n create: (body: CreateDeploymentConnectionInput) =>\n request<DeploymentConnectionCreated>(ADMIN_PATHS.deploymentConnections, { method: 'POST', body }),\n update: (id: string, body: UpdateDeploymentConnectionInput) =>\n request<DeploymentConnectionUpdated>(withId(ADMIN_PATHS.deploymentConnections, id), {\n method: 'PATCH',\n body,\n }),\n remove: (id: string) =>\n request<void>(withId(ADMIN_PATHS.deploymentConnections, id), { method: 'DELETE' }),\n test: (id: string) =>\n request<ConnectionTestResult>(`${withId(ADMIN_PATHS.deploymentConnections, id)}/test`, {\n method: 'POST',\n }),\n /** A manual run at the current publication snapshot. */\n trigger: (id: string) =>\n request<DeploymentRun>(`${withId(ADMIN_PATHS.deploymentConnections, id)}/runs`, { method: 'POST' }),\n },\n runs: {\n list: (query: DeploymentRunQuery = {}) =>\n request<Page<DeploymentRun>>(`${ADMIN_PATHS.deploymentRuns}${toQueryString(query)}`),\n get: (id: string) => request<DeploymentRun>(withId(ADMIN_PATHS.deploymentRuns, id)),\n /** A new run (linked by `retryOf`) at the current snapshot. */\n retry: (id: string) =>\n request<DeploymentRun>(`${withId(ADMIN_PATHS.deploymentRuns, id)}/retry`, { method: 'POST' }),\n },\n },\n preview: {\n tokens: {\n list: (query: { entryId?: string } = {}) =>\n request<PreviewToken[]>(`${ADMIN_PATHS.previewTokens}${toQueryString(query)}`),\n create: (body: CreatePreviewTokenInput) =>\n request<PreviewTokenCreated>(ADMIN_PATHS.previewTokens, { method: 'POST', body }),\n revoke: (id: string) => request<void>(withId(ADMIN_PATHS.previewTokens, id), { method: 'DELETE' }),\n },\n /** The site's connections with a preview URL (the entry form's Preview pane). */\n targets: () => request<PreviewTarget[]>(`${ADMIN_PATHS.preview}/targets`),\n /** The entry form's Preview action: a short-lived entry token and the rendered preview URL. */\n open: (body: OpenPreviewInput) =>\n request<OpenPreviewResult>(`${ADMIN_PATHS.preview}/open`, { method: 'POST', body }),\n },\n});\n","import type { RequestFn } from '../request.js';\nimport { ADMIN_PATHS, withId } from './paths.js';\nimport { toQueryString } from './query.js';\nimport type { SchemaApplyInput, SchemaApplyResult, SchemaExport } from './schemaSyncTypes.js';\nimport type {\n ChangeOutcome,\n ChangeScopeInput,\n ChangeScopeOutcome,\n CreateDefinitionInput,\n CreateLocaleInput,\n DefinitionCategory,\n DefinitionPayload,\n DefinitionDetail,\n DefinitionScope,\n DefinitionListItem,\n DefinitionRevision,\n DefinitionRevisionDetail,\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 /**\n * Soft delete: entries are kept and reappear if the definition is applied again. Removing the API is a\n * breaking change: without `acknowledgeBreaking` the server answers 409 SCHEMA_CHANGE_NOT_ACKNOWLEDGED.\n */\n remove: (id: string, expectedVersion: number, options: { acknowledgeBreaking?: boolean } = {}) =>\n request<ChangeOutcome>(\n `${withId(base, id)}${toQueryString({ expectedVersion, acknowledgeBreaking: options.acknowledgeBreaking || undefined })}`,\n { method: 'DELETE' },\n ),\n revisions: async (id: string) =>\n (await request<{ items: DefinitionRevision[] }>(`${withId(base, id)}/revisions`)).items,\n revision: (id: string, revisionId: string) =>\n request<DefinitionRevisionDetail>(withId(`${withId(base, id)}/revisions`, revisionId)),\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 * `deletedEntries`, `movedEntries`).\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 /** Usable API tokens this admin created: refused while the account is disabled, revoked when it is deleted. */\n apiTokens: AdminUserApiToken[];\n};\n\n/** An API token listed with the admin who created it. */\nexport type AdminUserApiToken = { id: string; name: string; siteId: string | null };\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 /** The creator's account is disabled: the token is refused until it is enabled again. */\n creatorDisabled: boolean;\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 /** The stored signing secret cannot be decrypted (SESSION_SECRET changed): rotate it to repair the webhook. */\n secretsUnreadable: boolean;\n};\n\nexport type CreateWebhookInput = {\n name: string;\n url: string;\n events: string[];\n enabled?: boolean;\n allowPrivateNetwork?: boolean;\n maxAttempts?: number;\n /** A network-wide webhook (every site's events); otherwise it belongs to the request's site. */\n network?: boolean;\n};\n\n/** A webhook's site is fixed once created. */\nexport type UpdateWebhookInput = Partial<Omit<CreateWebhookInput, 'network'>> & { expectedVersion: number };\n\n/** The JSON body every webhook delivery sends (signed; verify it with `verifyWebhookSignature`). */\nexport type WebhookEventBody = {\n id: string;\n type: string;\n createdAt: string;\n /** The site the event is about; null for events about no site (network-wide). */\n site: SiteRef | null;\n data: unknown;\n};\n\n/** `secret` is shown once: on creation and after rotation. */\nexport type WebhookWithSecret = { webhook: Webhook; secret: string };\n\nexport type WebhookAttempt = {\n attempt: number;\n at: string;\n durationMs: number;\n request: { method: string; url: string; headers: Record<string, string> };\n /** Null when no response arrived (refused, timeout, blocked by the network policy). */\n response: { status: number; headers: Record<string, string>; body: string; truncated: boolean } | null;\n error: string | null;\n};\n\nexport type WebhookDelivery = {\n id: string;\n webhookId: string;\n eventId: string | null;\n eventType: string;\n isTest: boolean;\n status: WebhookDeliveryStatus;\n attempts: number;\n lastResponseStatus: number | null;\n lastError: string | null;\n payload: unknown;\n attemptLog: WebhookAttempt[];\n createdAt: string;\n updatedAt: string;\n deliveredAt: string | null;\n};\n\n// Deployments --------------------------------------------------------------------------------------\n\nexport const DEPLOYMENT_PROVIDERS = [\n 'generic_webhook',\n 'cloudflare_pages',\n 'vercel',\n 'netlify',\n 'github',\n] as const;\nexport type DeploymentProvider = (typeof DEPLOYMENT_PROVIDERS)[number];\n\nexport const DEPLOYMENT_TRIGGERS = ['publish', 'change_set', 'schema', 'manual'] as const;\nexport type DeploymentTriggerPolicy = (typeof DEPLOYMENT_TRIGGERS)[number];\n\nexport const DEPLOYMENT_RUN_STATUSES = [\n 'queued',\n 'triggered',\n 'building',\n 'deployed',\n 'failed',\n 'unknown',\n] as const;\nexport type DeploymentRunStatus = (typeof DEPLOYMENT_RUN_STATUSES)[number];\n\nexport type DeploymentRunTrigger = 'publish' | 'change_set' | 'schema' | 'manual' | 'retry';\n\n/**\n * Provider settings (not secret). Generic: `{ url }`. Cloudflare Pages: `{ accountId, projectName }`.\n * GitHub: `{ owner, repo, branch, mode: 'commit' | 'pull_request', directory }`.\n */\nexport type DeploymentSettings = Record<string, string>;\n\n/**\n * Secret names per provider. Generic: `signingSecret` (generated when omitted). Cloudflare Pages:\n * `deployHookUrl`, `apiToken`. GitHub: `token`. Values are write-only. A value of `${ENV:VAR_NAME}`\n * makes the server read the secret from that environment variable instead of storing it.\n */\nexport type DeploymentSecretsInput = Record<string, string>;\n\n/** Which secrets are set; values never leave the server. `envVar`: read from this environment variable. */\nexport type DeploymentSecretState = Record<string, { set: boolean; envVar: string | null }>;\n\nexport type DeploymentTimelineEvent = {\n status: DeploymentRunStatus;\n at: string;\n source: 'shapio' | 'callback' | 'provider';\n message: string | null;\n};\n\nexport type DeploymentRun = {\n id: string;\n connectionId: string;\n connectionName: string;\n provider: DeploymentProvider;\n status: DeploymentRunStatus;\n trigger: DeploymentRunTrigger;\n /** Publication sequence the run was triggered at (`?snapshot=` on delivery). */\n snapshot: number | null;\n schemaVersion: number | null;\n retryOf: string | null;\n providerRef: string | null;\n logUrl: string | null;\n siteUrl: string | null;\n error: string | null;\n /** False for providers that cannot report completion without callbacks (shown as \"completion unknown\"). */\n completionReported: boolean;\n timeline: DeploymentTimelineEvent[];\n triggeredAt: string | null;\n finishedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type DeploymentConnection = {\n id: string;\n name: string;\n provider: DeploymentProvider;\n settings: DeploymentSettings;\n secrets: DeploymentSecretState;\n previewUrlTemplate: string | null;\n /** Preview tokens issued for this connection show exactly what this delivery role reads. */\n deliveryRoleId: string | null;\n triggerPolicy: DeploymentTriggerPolicy[];\n debounceSeconds: number;\n allowPrivateNetwork: boolean;\n enabled: boolean;\n /** Where the site posts signed build callbacks (generic webhook connections). */\n callbackUrl: string;\n latestRun: DeploymentRun | null;\n /** The newest deployed run by snapshot: what the site is serving, as far as Shapio knows. */\n currentRun: DeploymentRun | null;\n createdBy: string | null;\n createdAt: string;\n updatedAt: string;\n version: number;\n /**\n * The stored secrets cannot be decrypted (the server's SESSION_SECRET changed): every literal secret reads\n * as not set until it is entered again; secrets read from the environment are unaffected.\n */\n secretsUnreadable: boolean;\n};\n\nexport type CreateDeploymentConnectionInput = {\n name: string;\n provider: DeploymentProvider;\n settings: DeploymentSettings;\n secrets: DeploymentSecretsInput;\n previewUrlTemplate?: string | null;\n triggerPolicy: DeploymentTriggerPolicy[];\n debounceSeconds?: number;\n allowPrivateNetwork?: boolean;\n enabled?: boolean;\n deliveryRoleId?: string | null;\n};\n\nexport type UpdateDeploymentConnectionInput = Partial<Omit<CreateDeploymentConnectionInput, 'provider'>> & {\n expectedVersion: number;\n};\n\n/** `generatedSecrets` holds secrets Shapio generated (the generic signing secret), shown once. */\nexport type DeploymentConnectionCreated = {\n connection: DeploymentConnection;\n generatedSecrets: Record<string, string>;\n};\n\n/** An update's result: `generatedSecrets` holds a secret Shapio minted to replace an unreadable one, shown once. */\nexport type DeploymentConnectionUpdated = DeploymentConnection & {\n generatedSecrets?: Record<string, string>;\n};\n\nexport type ConnectionTestResult = {\n ok: boolean;\n checks: Array<{ name: string; ok: boolean; message: string }>;\n};\n\nexport type DeploymentRunQuery = { connectionId?: string; cursor?: string; limit?: number };\n\n// Preview ------------------------------------------------------------------------------------------\n\nexport type PreviewToken = {\n id: string;\n tokenPrefix: string;\n modelId: string;\n modelKey: string | null;\n entryId: string | null;\n locale: string | null;\n connectionId: string | null;\n /** Fields follow this delivery role (within the creator's access); null = the public fields. */\n deliveryRoleId: string | null;\n createdBy: string;\n expiresAt: string;\n revokedAt: string | null;\n lastUsedAt: string | null;\n createdAt: string;\n};\n\nexport type CreatePreviewTokenInput = {\n modelKey: string;\n entryId?: string;\n locale?: string;\n /** Default 1 hour, at most 30 days. */\n ttlSeconds?: number;\n connectionId?: string;\n /** Defaults to the connection's delivery role. */\n deliveryRoleId?: string;\n};\n\n/** `token` is shown once. `url` is rendered from the connection's preview URL template (null without one). */\nexport type PreviewTokenCreated = { token: string; previewToken: PreviewToken; url: string | null };\n\nexport type OpenPreviewInput = {\n modelKey: string;\n entryId: string;\n locale?: string;\n /** Defaults to the first enabled connection with a preview URL template. */\n connectionId?: string;\n};\n\n/** What the entry form's Preview button opens. `apiUrl` is the preview read endpoint for this entry. */\nexport type OpenPreviewResult = {\n /** The token's ID (revoke it when the preview closes). */\n id: string;\n url: string | null;\n apiUrl: string;\n token: string;\n expiresAt: string;\n connectionId: string | null;\n};\n\n/** A connection the site's previews open on (names and origins only). */\nexport type PreviewTarget = {\n connectionId: string;\n name: string;\n /** null when the preview URL template's origin depends on a variable. */\n origin: string | null;\n /** Whether the admin can show it in its preview frame. */\n framable: boolean;\n};\n","/**\n * App users and app roles as administrators manage them (package I), mirroring the TypeBox route schemas in\n * apps/api/src/routes/admin/{appUsers,appRoles}. JSON is camelCase; timestamps are ISO-8601.\n */\nimport type { RoleCondition } from './types.js';\n\nexport type AdminAppUser = {\n id: string;\n email: string;\n name: string;\n confirmed: boolean;\n blocked: boolean;\n /** False for accounts that only sign in with an OAuth provider. */\n hasPassword: boolean;\n /** OAuth providers linked to the account (`google`, `github`). */\n providers: string[];\n /** Custom app roles; `authenticated` applies to every app user implicitly. */\n roleIds: string[];\n lastLoginAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\n/** Newest first, cursor-paginated; `search` matches email or name. */\nexport type AppUserQuery = { search?: string; cursor?: string; limit?: number };\n\nexport type AppUserPage = { items: AdminAppUser[]; nextCursor: string | null };\n\nexport type UpdateAppUserInput = { blocked?: boolean; roleIds?: string[] };\n\n/** What app roles may grant: content actions only. */\nexport const APP_CONTENT_ACTIONS = ['read', 'create', 'update', 'delete', 'publish'] as const;\nexport type AppContentAction = (typeof APP_CONTENT_ACTIONS)[number];\n\n/** Built-in app role keys: `public` applies to anonymous callers, `authenticated` to every app user. */\nexport const BUILT_IN_APP_ROLE_KEYS = ['public', 'authenticated'] as const;\n\nexport type AppRolePermission = {\n action: AppContentAction;\n /** `null` grants the action on every model, including ones created later. */\n modelId: string | null;\n condition: RoleCondition | null;\n /** `null` = every public field; otherwise exactly these stable field IDs (non-public ones included). */\n fieldIds: string[] | null;\n};\n\nexport type AppRole = {\n id: string;\n key: string;\n name: string;\n description: string;\n isSystem: boolean;\n version: number;\n permissions: AppRolePermission[];\n userCount: number;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CreateAppRoleInput = {\n key: string;\n name: string;\n description?: string;\n permissions: AppRolePermission[];\n};\n\n/** Built-in roles accept `permissions` only. */\nexport type UpdateAppRoleInput = {\n expectedVersion: number;\n name?: string;\n description?: string;\n permissions?: AppRolePermission[];\n};\n","import type { DataType, SchemaDefinition } from '@shapio/schema';\nimport type { DeploymentRunStatus, Page, PublicationAction } from './publishingTypes.js';\nimport type { ChangePlan, DefinitionCategory, DefinitionPayload, PlanImpact } from './schemaTypes.js';\nimport type { SiteRef } from './sitesTypes.js';\n\n/**\n * Change sets and snapshots (developer-face plan §5), mirroring the TypeBox route schemas in\n * apps/api/src/routes/admin/{changeSets,snapshots}/schemas.ts. Dates are ISO-8601 strings.\n */\n\nexport const CHANGE_SET_STATUSES = [\n 'open',\n 'scheduled',\n 'shipping',\n 'shipped',\n 'failed',\n 'discarded',\n] as const;\nexport type ChangeSetStatus = (typeof CHANGE_SET_STATUSES)[number];\n/** While `shipping`: preparing (prerequisite dry runs, index builds) or activating (the final transaction). */\nexport type ShipPhase = 'preparing' | 'activating';\nexport type ChangeSetSource = 'manual' | 'release' | 'restore' | 'builder' | 'assist';\nexport type ChangeSetItemStatus = 'pending' | 'done' | 'failed';\nexport type SchemaOperation = 'create' | 'update' | 'delete';\n\nexport type ChangeSetActor = { type: 'admin' | 'token' | 'system'; id: string | null; name: string | null };\n\n/** Why a ship failed, and the item that stopped it (null when not tied to one item). */\nexport type ChangeSetError = { code: string; message: string; itemId: string | null; details?: unknown };\n\nexport type ChangeSetEntryItem = {\n id: string;\n kind: 'entry';\n position: number;\n entryId: string;\n modelId: string;\n modelKey: string | null;\n title: string | null;\n locale: string;\n action: PublicationAction;\n /** Restore items publish this exact revision instead of the current draft. */\n sourceRevisionId: string | null;\n status: ChangeSetItemStatus;\n error: string | null;\n};\n\nexport type ChangeSetSchemaItem = {\n id: string;\n kind: 'schema';\n position: number;\n draftId: string;\n definitionId: string;\n category: DefinitionCategory;\n apiKey: string;\n operation: SchemaOperation;\n /** The active version the draft was based on; null for a new definition. */\n baseVersion: number | null;\n draftVersion: number;\n status: ChangeSetItemStatus;\n error: string | null;\n};\n\nexport type ChangeSetItem = ChangeSetEntryItem | ChangeSetSchemaItem;\n\nexport type ChangeSetSummary = {\n id: string;\n title: string;\n description: string;\n status: ChangeSetStatus;\n shipPhase: ShipPhase | null;\n source: ChangeSetSource;\n restoreOfSnapshot: number | null;\n scheduledFor: string | null;\n /** Connection whose deploy is triggered (pinned to the shipped snapshot) after the set ships. */\n deploymentConnectionId: string | null;\n deploymentRunId: string | null;\n shippedAt: string | null;\n /** The publication snapshot the set went live in. */\n shippedSnapshot: number | null;\n schemaVersionAfter: number | null;\n error: ChangeSetError | null;\n entryItemCount: number;\n schemaItemCount: number;\n createdBy: ChangeSetActor;\n createdAt: string;\n updatedAt: string;\n version: number;\n};\n\nexport type ChangeSet = ChangeSetSummary & {\n items: ChangeSetItem[];\n /** Who shipped the set (the snapshot ledger's actor); null until it ships. */\n shippedBy: ChangeSetActor | null;\n};\n\nexport type ChangeSetQuery = {\n /** Comma-separated statuses; default: everything except `discarded`. */\n status?: string;\n cursor?: string;\n limit?: number;\n};\n\nexport type CreateChangeSetInput = {\n title: string;\n description?: string;\n /** `builder`: a one-item set the model builder ships at once (\"Review & ship now\"). Default `manual`. */\n source?: 'manual' | 'builder';\n};\nexport type UpdateChangeSetInput = {\n title?: string;\n description?: string;\n deploymentConnectionId?: string | null;\n expectedVersion: number;\n};\nexport type AddChangeSetEntryInput = {\n modelKey: string;\n entryId: string;\n /** Omit for non-localized models (and for the default locale). */\n locale?: string;\n action: PublicationAction;\n};\n\nexport type SchemaDraft = {\n id: string;\n changeSetId: string;\n definitionId: string;\n category: DefinitionCategory;\n operation: SchemaOperation;\n baseVersion: number | null;\n /** Null when the draft deletes the definition. */\n definition: SchemaDefinition | null;\n /** A new definition the draft creates shared with all sites (otherwise it belongs to the set's site). */\n shared: boolean;\n version: number;\n updatedBy: ChangeSetActor;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type PutSchemaDraftInput = {\n category: DefinitionCategory;\n /** The whole proposed definition, or null to delete the definition when the set ships. */\n definition: DefinitionPayload | null;\n /** The active version the edit is based on (null: a new definition). */\n baseVersion: number | null;\n /** For a new definition: create it shared with all sites (default false: the set's site). */\n shared?: boolean;\n /** The draft row version the caller saw; omit when creating the draft. */\n expectedDraftVersion?: number;\n};\n\n/**\n * One changed field. `summary` is the server's readable form of each side (rich text as its text, media as\n * filenames, relations as titles, components as labelled items); null when that side is empty.\n */\nexport type FieldDiff = {\n fieldId: string;\n apiKey: string;\n label: string;\n type: DataType;\n before: unknown;\n after: unknown;\n summary: { before: string | null; after: string | null };\n};\nexport type ReviewIssue = { path: string; code: string; message: string };\n\nexport type ReviewEntryItem = {\n itemId: string;\n entryId: string;\n modelId: string;\n modelKey: string | null;\n title: string | null;\n locale: string;\n action: PublicationAction;\n sourceRevisionId: string | null;\n /** Send back in `ship.itemVersions` (strict ship). Null when the item does not publish the draft. */\n draftVersion: number | null;\n liveState: 'unpublished' | 'published' | 'modified' | 'missing';\n fields: FieldDiff[];\n issues: ReviewIssue[];\n};\n\nexport type ReviewSchemaItem = {\n itemId: string;\n draftId: string;\n definitionId: string;\n category: DefinitionCategory;\n apiKey: string;\n operation: SchemaOperation;\n baseVersion: number | null;\n activeVersion: number | null;\n /** The active version moved since the draft was based on it: shipping refuses until it is rebased. */\n stale: boolean;\n plan: ChangePlan | null;\n impact: PlanImpact | null;\n /** Entries of the affected models per site (a shared definition converts every site's content). */\n affectedEntriesBySite: Array<{ site: SiteRef; entries: number }>;\n issues: ReviewIssue[];\n alsoChangedIn: Array<{ id: string; title: string }>;\n /** A shipped set: the revision the draft replaced (null for a new definition, and for unshipped sets). */\n beforeRevisionId: string | null;\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 /** `name`: the admin's or token's name; null for the system, or once the admin or token is deleted. */\n actor: { type: string; id: string | null; name: 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 'mediaMissing',\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. */\nexport type PreflightRule = HealthRule | 'invalid';\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\n/** A locale's draft as the server has it: an open document compares `version` with the one it shows. */\nexport type DraftState = {\n locale: string;\n version: number;\n /** When the draft last moved (a save, an autosave, or publishing autosaved work). */\n savedAt: string;\n /** Who saved it; null when that isn't known reliably (an autosave, a token, a schedule). */\n savedBy: { name: string; you: boolean } | null;\n};\n\n/** The heartbeat's answer: who else has the entry open, and every locale's current draft version. */\nexport type EntryHeartbeat = EntryPresence & { drafts: DraftState[] };\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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AE,IAAI;EAAO,QAAQ;CAAqB;AAC5E;;;ACxEA,MAAM,eAAe,UACnB,KAAK,OAAO,aAAa,GAAG,KAAK,CAAC,CAAC,CAChC,QAAQ,OAAO,GAAG,CAAC,CACnB,QAAQ,OAAO,GAAG,CAAC,CACnB,QAAQ,OAAO,EAAE;;AAGtB,MAAa,kBAAkB,OAAO,iBACpC,YACE,IAAI,WAAW,MAAM,WAAW,OAAO,OAAO,OAAO,WAAW,IAAI,YAAY,CAAC,CAAC,OAAO,YAAY,CAAC,CAAC,CACzG;;AAGF,MAAa,iBAAiB,YAAkC;CAC9D,MAAM,eAAe,YAAY,WAAW,OAAO,gCAAgB,IAAI,WAAW,EAAE,CAAC,CAAC;CACtF,OAAO;EAAE;EAAc,eAAe,MAAM,gBAAgB,YAAY;CAAE;AAC5E"}
|
package/dist/node.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mn as MediaVisibility, rn as MediaAsset, zt as ShapioClient } from "./index-DcylmHWk.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.
|
|
3
|
+
"version": "0.5.7",
|
|
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.
|
|
35
|
+
"@shapio/schema": "0.5.7"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"tsdown": "0.23.0",
|