riverbankcms 0.9.0 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acceptance/matrix.mjs +45 -4
- package/dist/cli/index.mjs +3414 -1604
- package/dist/cli/init-docs/content/cli-reference.md +240 -58
- package/dist/cli/init-docs/content/content-management.md +6 -2
- package/dist/cli/init-docs/content/workflow-create-page.md +4 -0
- package/dist/{eventUpsertInputSchema-CqHIJp9H.mjs → eventUpsertInputSchema-DFPgv4ay.mjs} +3 -2
- package/dist/{load-config-Cf5uPEAn.mjs → load-config-B7AiZalH.mjs} +2 -2
- package/dist/load-config-ELWKxyb5.mjs +4 -0
- package/dist/{local-sync-DF-2DL_D.mjs → local-sync-7ecbT9He.mjs} +363 -66
- package/dist/{plan-By0bjnd3.mjs → plan-BIwseF-X.mjs} +1 -1
- package/dist/scaffold/index.mjs +2 -2
- package/dist/{sdk-event-upsert-BNxbxaA0.mjs → sdk-event-upsert-CRQseim3.mjs} +26181 -25733
- package/dist/{src-DbmhanBI.mjs → src-CiZrHLCj.mjs} +131 -1
- package/dist/testing.mjs +3 -3
- package/package.json +1 -1
- package/dist/load-config-CKBdp8M0.mjs +0 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import * as fs from "fs/promises";
|
|
2
|
+
import { T as eventBookingOfferIntentSchema, an as pageDesignBoundaryTreatmentSchema, d as stableStringify, en as buttonStyleSelectionSchema, ir as asSiteStyleId, n as sdkCourseBookingSettingsSchema, on as pageDesignIntentSchemaVersion, q as themeSchema, r as sdkEventOccurrenceInputSchema, rr as asPageFlowPresetId, s as eventVisibilitySchema, tr as asAppearancePresetId } from "./sdk-event-upsert-CRQseim3.mjs";
|
|
3
|
+
import { At as unsafeAsOriginalFilename, Bt as unsafeAsStoragePath, Ct as unsafeAsDetectedMimeType, Dt as unsafeAsFileChecksumSha256, Et as unsafeAsEventSeriesId, Ft as unsafeAsSiteFontId, Ht as unsafeAsUserId, It as unsafeAsSiteId, J as parseUtcIsoDateTimeString, Lt as unsafeAsSiteScopedStoragePath, Mt as unsafeAsPositiveSeconds, Nt as unsafeAsProductId, Ot as unsafeAsMediaAssetId, Pt as unsafeAsSafeDownloadFilename, Tt as unsafeAsEventOfferingId, Ut as err, Vt as unsafeAsUploadSessionId, Wt as ok, a as parseVerticalId, bt as unsafeAsBookingSessionId, ct as fromArray, dt as assertNever, gt as parseSiteId, i as canonicalizeConfiguredBookingVerticalConfig, j as parseFooterCompositionV1, jt as unsafeAsPositiveByteCount, kt as unsafeAsOccurrenceId, l as EVENT_PRESET_VALUES, lt as mapNonEmptyArray, o as parseVerticalPresetId, s as resolveSiteVerticalBookingConfig, v as exposeSecret, wt as unsafeAsEntitlementId, xt as unsafeAsDeclaredMimeType, yt as unsafeAsBookingRequirementId, zt as unsafeAsStorageBucketName } from "./src-CiZrHLCj.mjs";
|
|
4
|
+
import * as fs$1 from "fs/promises";
|
|
5
5
|
import * as path$1 from "path";
|
|
6
6
|
import { z } from "zod";
|
|
7
7
|
import { constants } from "node:fs";
|
|
@@ -185,6 +185,101 @@ const sdkEventOccurrenceResponseSchema = z.object({ occurrence: sdkManagementEve
|
|
|
185
185
|
const sdkDeleteEventOccurrenceResponseSchema = z.object({ deleted: z.literal(true) });
|
|
186
186
|
const sdkReorderResponseSchema = z.object({ reordered: z.literal(true) });
|
|
187
187
|
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region ../api/src/sdkPageDesign.ts
|
|
190
|
+
/**
|
|
191
|
+
* The portable page design document (issue 1497).
|
|
192
|
+
*
|
|
193
|
+
* A stored `PageDesignIntent` names blocks by their database ids, so it only
|
|
194
|
+
* makes sense on the page it came from. The portable document is the same
|
|
195
|
+
* intent with every block reference expressed as the block's management
|
|
196
|
+
* identifier (`hero-0`, `body-text-1`), which is what lets a design travel from
|
|
197
|
+
* one page to another page built from the same blocks.
|
|
198
|
+
*
|
|
199
|
+
* A boundary is carried as its identifier pair only. Its stored `boundaryId`
|
|
200
|
+
* is derived from the pair after mapping, so the two can never disagree.
|
|
201
|
+
*
|
|
202
|
+
* The document is parsed once, here, at the JSON boundary. Whether it fits a
|
|
203
|
+
* particular destination page is a separate, semantic decision made by the
|
|
204
|
+
* dashboard against that page's blocks and site style.
|
|
205
|
+
*/
|
|
206
|
+
const unsafeAsBlockIdentifier = (value) => value;
|
|
207
|
+
const blockIdentifierSchema = z.string().min(1).transform(unsafeAsBlockIdentifier);
|
|
208
|
+
const portableBlockLookPinSchema = z.object({
|
|
209
|
+
blockIdentifier: blockIdentifierSchema,
|
|
210
|
+
blockKind: z.string().min(1),
|
|
211
|
+
choice: z.object({
|
|
212
|
+
kind: z.literal("user-pinned"),
|
|
213
|
+
value: z.string().min(1).transform(asAppearancePresetId)
|
|
214
|
+
}).strict()
|
|
215
|
+
}).strict();
|
|
216
|
+
const portableBoundaryPinSchema = z.object({
|
|
217
|
+
previousBlockIdentifier: blockIdentifierSchema,
|
|
218
|
+
nextBlockIdentifier: blockIdentifierSchema,
|
|
219
|
+
choice: z.object({
|
|
220
|
+
kind: z.literal("user-pinned"),
|
|
221
|
+
value: pageDesignBoundaryTreatmentSchema
|
|
222
|
+
}).strict()
|
|
223
|
+
}).strict();
|
|
224
|
+
function isRepeated(items, same) {
|
|
225
|
+
return (item, index) => items.findIndex((other) => same(item, other)) !== index;
|
|
226
|
+
}
|
|
227
|
+
function refineUniquePins(design, ctx) {
|
|
228
|
+
design.blockLookPins.filter(isRepeated(design.blockLookPins, (a, b) => a.blockIdentifier === b.blockIdentifier)).forEach((pin) => ctx.addIssue({
|
|
229
|
+
code: "custom",
|
|
230
|
+
path: ["blockLookPins"],
|
|
231
|
+
message: `The design pins block "${pin.blockIdentifier}" more than once.`
|
|
232
|
+
}));
|
|
233
|
+
design.boundaryPins.filter(isRepeated(design.boundaryPins, (a, b) => a.previousBlockIdentifier === b.previousBlockIdentifier && a.nextBlockIdentifier === b.nextBlockIdentifier)).forEach((pin) => ctx.addIssue({
|
|
234
|
+
code: "custom",
|
|
235
|
+
path: ["boundaryPins"],
|
|
236
|
+
message: `The design pins the break between "${pin.previousBlockIdentifier}" and "${pin.nextBlockIdentifier}" more than once.`
|
|
237
|
+
}));
|
|
238
|
+
}
|
|
239
|
+
const portablePageDesignSchema = z.object({
|
|
240
|
+
schemaVersion: z.literal(pageDesignIntentSchemaVersion),
|
|
241
|
+
siteStyleId: z.string().min(1).transform(asSiteStyleId),
|
|
242
|
+
pageFlowPresetId: z.string().min(1).transform(asPageFlowPresetId),
|
|
243
|
+
blockLookPins: z.array(portableBlockLookPinSchema),
|
|
244
|
+
boundaryPins: z.array(portableBoundaryPinSchema)
|
|
245
|
+
}).strict().superRefine(refineUniquePins);
|
|
246
|
+
const pageDesignRevisionTokenSchema = z.discriminatedUnion("kind", [
|
|
247
|
+
z.object({ kind: z.literal("absent") }).strict(),
|
|
248
|
+
z.object({
|
|
249
|
+
kind: z.literal("draft"),
|
|
250
|
+
contentVersionId: z.string().min(1),
|
|
251
|
+
updatedAt: z.string().min(1)
|
|
252
|
+
}).strict(),
|
|
253
|
+
z.object({
|
|
254
|
+
kind: z.literal("published"),
|
|
255
|
+
contentVersionId: z.string().min(1),
|
|
256
|
+
updatedAt: z.string().min(1)
|
|
257
|
+
}).strict()
|
|
258
|
+
]);
|
|
259
|
+
const sdkSavePageDesignBodySchema = z.object({
|
|
260
|
+
design: portablePageDesignSchema,
|
|
261
|
+
expectedRevision: pageDesignRevisionTokenSchema
|
|
262
|
+
}).strict();
|
|
263
|
+
const omittedPagePinSchema = z.discriminatedUnion("kind", [z.object({
|
|
264
|
+
kind: z.literal("look-on-missing-block"),
|
|
265
|
+
blockId: z.string().min(1)
|
|
266
|
+
}), z.object({
|
|
267
|
+
kind: z.literal("boundary-on-missing-block"),
|
|
268
|
+
previousBlockId: z.string().min(1),
|
|
269
|
+
nextBlockId: z.string().min(1)
|
|
270
|
+
})]);
|
|
271
|
+
const sdkGetPageDesignResponseSchema = z.discriminatedUnion("kind", [z.object({ kind: z.literal("absent") }), z.object({
|
|
272
|
+
kind: z.literal("stored"),
|
|
273
|
+
source: z.enum(["draft", "published"]),
|
|
274
|
+
design: portablePageDesignSchema,
|
|
275
|
+
revision: pageDesignRevisionTokenSchema,
|
|
276
|
+
omitted: z.array(omittedPagePinSchema)
|
|
277
|
+
})]);
|
|
278
|
+
const sdkSavePageDesignResponseSchema = z.object({
|
|
279
|
+
outcome: z.enum(["created", "updated"]),
|
|
280
|
+
revision: pageDesignRevisionTokenSchema
|
|
281
|
+
});
|
|
282
|
+
|
|
188
283
|
//#endregion
|
|
189
284
|
//#region ../api/src/sdkMediaResponseSchemas.ts
|
|
190
285
|
const identifierSchema = z.string().min(1);
|
|
@@ -682,6 +777,7 @@ const sdkEventScheduleSchema = z.object({
|
|
|
682
777
|
});
|
|
683
778
|
const sdkPullEventSchema = z.object({
|
|
684
779
|
identifier: sdkIdentifierSchema$1,
|
|
780
|
+
courseBooking: sdkCourseBookingSettingsSchema.optional(),
|
|
685
781
|
administrativeStatus: z.enum(["active", "archived"]),
|
|
686
782
|
title: z.string(),
|
|
687
783
|
slug: sdkIdentifierSchema$1,
|
|
@@ -705,11 +801,7 @@ const sdkPullEventRunSchema = z.object({
|
|
|
705
801
|
"cancelled",
|
|
706
802
|
"completed"
|
|
707
803
|
]),
|
|
708
|
-
visibility:
|
|
709
|
-
"private",
|
|
710
|
-
"public",
|
|
711
|
-
"unlisted"
|
|
712
|
-
]),
|
|
804
|
+
visibility: eventVisibilitySchema.optional(),
|
|
713
805
|
bookingScope: z.enum(["single_occurrence", "whole_series"]),
|
|
714
806
|
occurrences: z.array(sdkEventOccurrenceInputSchema),
|
|
715
807
|
capacity: z.number().int().nonnegative().nullable(),
|
|
@@ -912,7 +1004,10 @@ const sdkUpsertSettingsResponseSchema = sdkCommandApplicationResultSchema(sdkPul
|
|
|
912
1004
|
const sdkUpsertFormResponseSchema = sdkCommandApplicationResultSchema(sdkPullFormSchemaWithId);
|
|
913
1005
|
const sdkUpsertVenueResponseSchema = sdkCommandApplicationResultSchema(sdkPullVenueSchema.extend({ id: sdkIdentifierSchema }));
|
|
914
1006
|
const sdkUpsertEventCategoryResponseSchema = sdkCommandApplicationResultSchema(sdkPullEventCategorySchema.extend({ id: sdkIdentifierSchema }));
|
|
915
|
-
const sdkManagementEventSchema = sdkPullEventSchema.extend({
|
|
1007
|
+
const sdkManagementEventSchema = sdkPullEventSchema.extend({
|
|
1008
|
+
id: sdkIdentifierSchema.transform(unsafeAsEventOfferingId),
|
|
1009
|
+
pageState: z.enum(["online", "offline"]).optional()
|
|
1010
|
+
});
|
|
916
1011
|
const sdkManagementEventRunSchema = sdkPullEventRunSchema.extend({
|
|
917
1012
|
id: sdkIdentifierSchema.transform(unsafeAsEventSeriesId),
|
|
918
1013
|
eventId: sdkIdentifierSchema.transform(unsafeAsEventOfferingId),
|
|
@@ -927,6 +1022,24 @@ const sdkListEventsResponseSchema = z.object({
|
|
|
927
1022
|
eventRuns: z.array(sdkManagementEventRunSchema)
|
|
928
1023
|
});
|
|
929
1024
|
const sdkGetEventResponseSchema = sdkManagementEventGraphSchema;
|
|
1025
|
+
const sdkEventSeriesIdSchema = sdkIdentifierSchema.transform(unsafeAsEventSeriesId);
|
|
1026
|
+
/**
|
|
1027
|
+
* The lifecycle outcome for `POST /sdk/{siteId}/events/{identifier}/lifecycle`.
|
|
1028
|
+
* `applied` always changed something: at least one run, or the Event page.
|
|
1029
|
+
*/
|
|
1030
|
+
const sdkTakeEventOfflineResponseSchema = z.union([
|
|
1031
|
+
z.object({
|
|
1032
|
+
kind: z.literal("applied"),
|
|
1033
|
+
changedRunIds: z.tuple([sdkEventSeriesIdSchema], sdkEventSeriesIdSchema),
|
|
1034
|
+
pageTakenOffline: z.boolean()
|
|
1035
|
+
}),
|
|
1036
|
+
z.object({
|
|
1037
|
+
kind: z.literal("applied"),
|
|
1038
|
+
changedRunIds: z.tuple([]),
|
|
1039
|
+
pageTakenOffline: z.literal(true)
|
|
1040
|
+
}),
|
|
1041
|
+
z.object({ kind: z.literal("already-offline") })
|
|
1042
|
+
]);
|
|
930
1043
|
const sdkUpsertEventResponseSchema = sdkCommandApplicationResultSchema(sdkManagementEventGraphSchema);
|
|
931
1044
|
const sdkUpsertThemeResponseSchema = sdkCommandApplicationResultSchema(z.object({
|
|
932
1045
|
themeId: sdkIdentifierSchema,
|
|
@@ -1054,6 +1167,145 @@ function validateManagementResponse(value, schema) {
|
|
|
1054
1167
|
};
|
|
1055
1168
|
}
|
|
1056
1169
|
|
|
1170
|
+
//#endregion
|
|
1171
|
+
//#region ../management-client/src/transportFailure.ts
|
|
1172
|
+
/**
|
|
1173
|
+
* Sanitised transport failures (issue 1496).
|
|
1174
|
+
*
|
|
1175
|
+
* When `fetch` rejects, the caught value can carry anything the platform put
|
|
1176
|
+
* there: a message naming the host and port, a cause chain, a stack, and in
|
|
1177
|
+
* some runtimes echoes of the request. None of that may leave the client. The
|
|
1178
|
+
* caught value is inspected here, and only here, for one thing: whether its
|
|
1179
|
+
* platform code (`cause.code`, else `code`) is one of an allow-listed set of
|
|
1180
|
+
* Node and undici codes. The result is a closed union whose `code` is always
|
|
1181
|
+
* one of those literals, and a fixed message per kind. Nothing else from the caught value is kept.
|
|
1182
|
+
*
|
|
1183
|
+
* Code lists were checked against Node 24.18 (undici bundled with it) by
|
|
1184
|
+
* provoking each failure: DNS lookups fail with `ENOTFOUND`/`EAI_AGAIN`, a
|
|
1185
|
+
* closed port with `ECONNREFUSED` (an `AggregateError` carrying the same code
|
|
1186
|
+
* when happy-eyeballs tries several addresses), an unroutable host with
|
|
1187
|
+
* undici's `UND_ERR_CONNECT_TIMEOUT`, a peer reset with `ECONNRESET`, a peer
|
|
1188
|
+
* closing mid-response with `UND_ERR_SOCKET`, and TLS failures with the
|
|
1189
|
+
* OpenSSL verification codes and `ERR_TLS_CERT_ALTNAME_INVALID`.
|
|
1190
|
+
*
|
|
1191
|
+
* Bun puts its code on the error itself rather than on `cause`, so that is read
|
|
1192
|
+
* as a fallback. Bun 1.3 reports resets and TLS failures with the same codes
|
|
1193
|
+
* as Node; it reports refused connections *and* failed DNS lookups alike as
|
|
1194
|
+
* `ConnectionRefused`, which is deliberately not listed and stays `unknown`.
|
|
1195
|
+
*/
|
|
1196
|
+
const DNS_CODES = ["ENOTFOUND", "EAI_AGAIN"];
|
|
1197
|
+
const CONNECT_CODES = [
|
|
1198
|
+
"ECONNREFUSED",
|
|
1199
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
1200
|
+
"ECONNABORTED",
|
|
1201
|
+
"EHOSTUNREACH",
|
|
1202
|
+
"ENETUNREACH"
|
|
1203
|
+
];
|
|
1204
|
+
const RESET_CODES = [
|
|
1205
|
+
"ECONNRESET",
|
|
1206
|
+
"EPIPE",
|
|
1207
|
+
"UND_ERR_SOCKET"
|
|
1208
|
+
];
|
|
1209
|
+
const TLS_CODES = [
|
|
1210
|
+
"CERT_HAS_EXPIRED",
|
|
1211
|
+
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
1212
|
+
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
1213
|
+
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
1214
|
+
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
1215
|
+
"ERR_TLS_CERT_ALTNAME_INVALID",
|
|
1216
|
+
"ERR_SSL_WRONG_VERSION_NUMBER"
|
|
1217
|
+
];
|
|
1218
|
+
const TIMEOUT_CODES = [
|
|
1219
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
1220
|
+
"UND_ERR_BODY_TIMEOUT",
|
|
1221
|
+
"ETIMEDOUT"
|
|
1222
|
+
];
|
|
1223
|
+
function isOneOf$1(values, value) {
|
|
1224
|
+
return values.includes(value);
|
|
1225
|
+
}
|
|
1226
|
+
/**
|
|
1227
|
+
* Read one property of an arbitrary value. A throwing getter or a hostile
|
|
1228
|
+
* proxy yields `undefined`, so inspection can never throw past the boundary.
|
|
1229
|
+
*/
|
|
1230
|
+
function readProperty(value, key) {
|
|
1231
|
+
if (typeof value !== "object" || value === null) return undefined;
|
|
1232
|
+
try {
|
|
1233
|
+
return Reflect.get(value, key);
|
|
1234
|
+
} catch {
|
|
1235
|
+
return undefined;
|
|
1236
|
+
}
|
|
1237
|
+
}
|
|
1238
|
+
function stringCode(value) {
|
|
1239
|
+
const code = readProperty(value, "code");
|
|
1240
|
+
return typeof code === "string" ? code : undefined;
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* The platform code for a rejected `fetch`: Node/undici put it on `cause`;
|
|
1244
|
+
* Bun puts its own on the error itself. Nothing else is read.
|
|
1245
|
+
*/
|
|
1246
|
+
function platformCode(caught) {
|
|
1247
|
+
return stringCode(readProperty(caught, "cause")) ?? stringCode(caught);
|
|
1248
|
+
}
|
|
1249
|
+
/** Map a raw code onto the closed union; anything unlisted is `unknown`. */
|
|
1250
|
+
function transportFailureFromCode(code) {
|
|
1251
|
+
if (code === undefined) return { kind: "unknown" };
|
|
1252
|
+
if (isOneOf$1(DNS_CODES, code)) return {
|
|
1253
|
+
kind: "dns",
|
|
1254
|
+
code
|
|
1255
|
+
};
|
|
1256
|
+
if (isOneOf$1(CONNECT_CODES, code)) return {
|
|
1257
|
+
kind: "connect",
|
|
1258
|
+
code
|
|
1259
|
+
};
|
|
1260
|
+
if (isOneOf$1(RESET_CODES, code)) return {
|
|
1261
|
+
kind: "reset",
|
|
1262
|
+
code
|
|
1263
|
+
};
|
|
1264
|
+
if (isOneOf$1(TLS_CODES, code)) return {
|
|
1265
|
+
kind: "tls",
|
|
1266
|
+
code
|
|
1267
|
+
};
|
|
1268
|
+
if (isOneOf$1(TIMEOUT_CODES, code)) return {
|
|
1269
|
+
kind: "timeout",
|
|
1270
|
+
code
|
|
1271
|
+
};
|
|
1272
|
+
return { kind: "unknown" };
|
|
1273
|
+
}
|
|
1274
|
+
/** True when the client's own `AbortSignal.timeout` ended the request. */
|
|
1275
|
+
function isClientTimeout(caught) {
|
|
1276
|
+
return readProperty(caught, "name") === "TimeoutError";
|
|
1277
|
+
}
|
|
1278
|
+
/**
|
|
1279
|
+
* Classify a rejected `fetch` or body read. The caught value is read only for
|
|
1280
|
+
* its `name` and platform code (guarded, see `readProperty`). `timeoutMs` is
|
|
1281
|
+
* the limit the client itself applied, so the timeout message can name it.
|
|
1282
|
+
*/
|
|
1283
|
+
function classifyTransportFailure(caught, timeoutMs) {
|
|
1284
|
+
return isClientTimeout(caught) ? {
|
|
1285
|
+
code: "sdk:timeout",
|
|
1286
|
+
transport: { kind: "timeout" },
|
|
1287
|
+
timeoutMs
|
|
1288
|
+
} : {
|
|
1289
|
+
code: "sdk:network-error",
|
|
1290
|
+
transport: transportFailureFromCode(platformCode(caught))
|
|
1291
|
+
};
|
|
1292
|
+
}
|
|
1293
|
+
/** The fixed message for a classified failure. */
|
|
1294
|
+
function transportErrorMessage(failure) {
|
|
1295
|
+
return failure.code === "sdk:timeout" ? `Request timed out after ${failure.timeoutMs}ms` : transportFailureMessage(failure.transport);
|
|
1296
|
+
}
|
|
1297
|
+
/** The fixed, safe message for each kind of network failure. */
|
|
1298
|
+
function transportFailureMessage(failure) {
|
|
1299
|
+
switch (failure.kind) {
|
|
1300
|
+
case "dns": return "Could not resolve the dashboard hostname";
|
|
1301
|
+
case "connect": return "Could not open a connection to the dashboard";
|
|
1302
|
+
case "reset": return "The connection to the dashboard closed before a response arrived";
|
|
1303
|
+
case "tls": return "The TLS handshake with the dashboard failed";
|
|
1304
|
+
case "timeout": return "The connection to the dashboard timed out";
|
|
1305
|
+
case "unknown": return "Network request failed";
|
|
1306
|
+
}
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1057
1309
|
//#endregion
|
|
1058
1310
|
//#region ../management-client/src/http.ts
|
|
1059
1311
|
/**
|
|
@@ -1081,6 +1333,29 @@ var ManagementInvalidResponseError = class extends ManagementApiError {
|
|
|
1081
1333
|
}
|
|
1082
1334
|
};
|
|
1083
1335
|
/**
|
|
1336
|
+
* The request never produced a dashboard answer. The message is fixed per
|
|
1337
|
+
* failure kind and nothing from the platform error (its message, cause, stack
|
|
1338
|
+
* or anything echoing the request) is kept: `transport` is the only diagnostic.
|
|
1339
|
+
*/
|
|
1340
|
+
var ManagementTransportError = class extends ManagementApiError {
|
|
1341
|
+
/** The message is derived from the classification; no free text is accepted. */
|
|
1342
|
+
constructor(classified, request) {
|
|
1343
|
+
super(transportErrorMessage(classified), classified.code, undefined, undefined, request);
|
|
1344
|
+
this.details = undefined;
|
|
1345
|
+
this.name = "ManagementTransportError";
|
|
1346
|
+
this.code = classified.code;
|
|
1347
|
+
this.transport = classified.transport;
|
|
1348
|
+
}
|
|
1349
|
+
};
|
|
1350
|
+
/**
|
|
1351
|
+
* Turn a rejected `fetch` or body read into a {@link ManagementTransportError}.
|
|
1352
|
+
* Every catch site around a management `fetch` or response-body read goes
|
|
1353
|
+
* through here so none of them can leak the platform error.
|
|
1354
|
+
*/
|
|
1355
|
+
function managementTransportError(caught, timeoutMs, request) {
|
|
1356
|
+
return new ManagementTransportError(classifyTransportFailure(caught, timeoutMs), request);
|
|
1357
|
+
}
|
|
1358
|
+
/**
|
|
1084
1359
|
* Type guard to check if an error is a 404 Not Found response.
|
|
1085
1360
|
* Use this to handle "resource not found" scenarios gracefully.
|
|
1086
1361
|
*
|
|
@@ -1150,6 +1425,7 @@ function parseApiResponse(value) {
|
|
|
1150
1425
|
function buildRequestInfo(options) {
|
|
1151
1426
|
return {
|
|
1152
1427
|
method: options.method,
|
|
1428
|
+
intent: options.intent,
|
|
1153
1429
|
path: options.path,
|
|
1154
1430
|
url: options.url,
|
|
1155
1431
|
baseUrl: options.baseUrl,
|
|
@@ -1157,9 +1433,20 @@ function buildRequestInfo(options) {
|
|
|
1157
1433
|
siteId: options.siteId
|
|
1158
1434
|
};
|
|
1159
1435
|
}
|
|
1160
|
-
|
|
1436
|
+
/**
|
|
1437
|
+
* Read a response body as text. A body that fails mid-read (a reset, undici's
|
|
1438
|
+
* body timeout, the client's own abort) is a transport failure like any other.
|
|
1439
|
+
*/
|
|
1440
|
+
async function readResponseText(response, timeoutMs, requestInfo) {
|
|
1441
|
+
try {
|
|
1442
|
+
return await response.text();
|
|
1443
|
+
} catch (error) {
|
|
1444
|
+
throw managementTransportError(error, timeoutMs, requestInfo);
|
|
1445
|
+
}
|
|
1446
|
+
}
|
|
1447
|
+
async function readApiResponse(response, requestInfo, options) {
|
|
1161
1448
|
const contentType = response.headers.get("content-type");
|
|
1162
|
-
const text = await response.
|
|
1449
|
+
const text = await readResponseText(response, options.timeoutMs, requestInfo);
|
|
1163
1450
|
if (!contentType?.includes("application/json")) {
|
|
1164
1451
|
if (response.ok && options.allowNonJsonOk) return undefined;
|
|
1165
1452
|
if (response.ok && options.invalidOkResponse) {
|
|
@@ -1199,6 +1486,10 @@ function requestUrl(baseUrl, path$2, params) {
|
|
|
1199
1486
|
const query = new URLSearchParams(params).toString();
|
|
1200
1487
|
return `${baseUrl}${path$2}?${query}`;
|
|
1201
1488
|
}
|
|
1489
|
+
const DEFAULT_REQUEST_TIMEOUT_MS = 3e4;
|
|
1490
|
+
function requestTimeoutMs(config) {
|
|
1491
|
+
return config.timeout ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
1492
|
+
}
|
|
1202
1493
|
function requestFetchOptions(config, method, body) {
|
|
1203
1494
|
const options = {
|
|
1204
1495
|
method,
|
|
@@ -1206,14 +1497,15 @@ function requestFetchOptions(config, method, body) {
|
|
|
1206
1497
|
Authorization: `Bearer ${exposeSecret(config.managementApiKey)}`,
|
|
1207
1498
|
"Content-Type": "application/json"
|
|
1208
1499
|
},
|
|
1209
|
-
signal: AbortSignal.timeout(config
|
|
1500
|
+
signal: AbortSignal.timeout(requestTimeoutMs(config))
|
|
1210
1501
|
};
|
|
1211
1502
|
if (body !== undefined && method !== "GET") options.body = JSON.stringify(body);
|
|
1212
1503
|
return options;
|
|
1213
1504
|
}
|
|
1214
|
-
async function fetchManagementResponse(config, method, path$2, url, baseUrl, options) {
|
|
1505
|
+
async function fetchManagementResponse(config, method, intent, path$2, url, baseUrl, options) {
|
|
1215
1506
|
const requestInfo = buildRequestInfo({
|
|
1216
1507
|
method,
|
|
1508
|
+
intent,
|
|
1217
1509
|
path: path$2,
|
|
1218
1510
|
url,
|
|
1219
1511
|
baseUrl,
|
|
@@ -1226,10 +1518,7 @@ async function fetchManagementResponse(config, method, path$2, url, baseUrl, opt
|
|
|
1226
1518
|
requestInfo
|
|
1227
1519
|
};
|
|
1228
1520
|
} catch (error) {
|
|
1229
|
-
|
|
1230
|
-
throw new ManagementApiError(`Request timed out after ${config.timeout ?? 3e4}ms`, "sdk:timeout", undefined, undefined, requestInfo);
|
|
1231
|
-
}
|
|
1232
|
-
throw new ManagementApiError(error instanceof Error ? error.message : "Network request failed", "sdk:network-error", undefined, undefined, requestInfo);
|
|
1521
|
+
throw managementTransportError(error, requestTimeoutMs(config), requestInfo);
|
|
1233
1522
|
}
|
|
1234
1523
|
}
|
|
1235
1524
|
function throwApiError(response, json, requestInfo) {
|
|
@@ -1242,53 +1531,61 @@ function throwApiError(response, json, requestInfo) {
|
|
|
1242
1531
|
}
|
|
1243
1532
|
async function requestWithConfig(config, method, path$2, options) {
|
|
1244
1533
|
const baseUrl = `${config.dashboardUrl}/api/sdk/${config.siteId}`;
|
|
1245
|
-
const url = requestUrl(baseUrl, path$2, options
|
|
1246
|
-
const fetchOptions = requestFetchOptions(config, method, options
|
|
1247
|
-
const { response, requestInfo } = await fetchManagementResponse(config, method, path$2, url, baseUrl, fetchOptions);
|
|
1248
|
-
const responseSchema = options
|
|
1249
|
-
const
|
|
1534
|
+
const url = requestUrl(baseUrl, path$2, options.params);
|
|
1535
|
+
const fetchOptions = requestFetchOptions(config, method, options.body);
|
|
1536
|
+
const { response, requestInfo } = await fetchManagementResponse(config, method, options.intent, path$2, url, baseUrl, fetchOptions);
|
|
1537
|
+
const responseSchema = options.responseSchema ?? schemaForManagementRequest(method, path$2, options.body);
|
|
1538
|
+
const timeoutMs = requestTimeoutMs(config);
|
|
1539
|
+
const json = responseSchema ? await readApiResponse(response, requestInfo, {
|
|
1540
|
+
timeoutMs,
|
|
1541
|
+
invalidOkResponse: true
|
|
1542
|
+
}) : await readApiResponse(response, requestInfo, {
|
|
1543
|
+
timeoutMs,
|
|
1544
|
+
allowNonJsonOk: true
|
|
1545
|
+
});
|
|
1250
1546
|
if (!json) return undefined;
|
|
1251
1547
|
throwApiError(response, json, requestInfo);
|
|
1252
1548
|
return responseSchema ? parseRuntimeResponse(json.data, responseSchema, requestInfo, response.status) : json.data;
|
|
1253
1549
|
}
|
|
1254
1550
|
function createHttpClient(config) {
|
|
1551
|
+
const send = (method, path$2, options) => requestWithConfig(config, method, path$2, options);
|
|
1255
1552
|
return {
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
},
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
}
|
|
1553
|
+
get: (path$2, params) => send("GET", path$2, {
|
|
1554
|
+
intent: "read",
|
|
1555
|
+
params
|
|
1556
|
+
}),
|
|
1557
|
+
post: (path$2, body, intent) => send("POST", path$2, {
|
|
1558
|
+
intent,
|
|
1559
|
+
body
|
|
1560
|
+
}),
|
|
1561
|
+
patch: (path$2, body) => send("PATCH", path$2, {
|
|
1562
|
+
intent: "write",
|
|
1563
|
+
body
|
|
1564
|
+
}),
|
|
1565
|
+
delete: (path$2, body) => send("DELETE", path$2, {
|
|
1566
|
+
intent: "write",
|
|
1567
|
+
body
|
|
1568
|
+
}),
|
|
1569
|
+
getValidated: (path$2, responseSchema, params) => send("GET", path$2, {
|
|
1570
|
+
intent: "read",
|
|
1571
|
+
params,
|
|
1572
|
+
responseSchema
|
|
1573
|
+
}),
|
|
1574
|
+
postValidated: (path$2, responseSchema, body, intent) => send("POST", path$2, {
|
|
1575
|
+
intent,
|
|
1576
|
+
body,
|
|
1577
|
+
responseSchema
|
|
1578
|
+
}),
|
|
1579
|
+
patchValidated: (path$2, responseSchema, body) => send("PATCH", path$2, {
|
|
1580
|
+
intent: "write",
|
|
1581
|
+
body,
|
|
1582
|
+
responseSchema
|
|
1583
|
+
}),
|
|
1584
|
+
deleteValidated: (path$2, responseSchema, body) => send("DELETE", path$2, {
|
|
1585
|
+
intent: "write",
|
|
1586
|
+
body,
|
|
1587
|
+
responseSchema
|
|
1588
|
+
})
|
|
1292
1589
|
};
|
|
1293
1590
|
}
|
|
1294
1591
|
|
|
@@ -7353,7 +7650,7 @@ const MANIFEST_VERSION = 2;
|
|
|
7353
7650
|
const getManifestPath = (contentDir) => path$1.join(contentDir, "media", ".manifest.json");
|
|
7354
7651
|
const ensureDir = async (dirPath) => {
|
|
7355
7652
|
try {
|
|
7356
|
-
await fs.mkdir(dirPath, { recursive: true });
|
|
7653
|
+
await fs$1.mkdir(dirPath, { recursive: true });
|
|
7357
7654
|
} catch (error) {
|
|
7358
7655
|
if (error.code !== "EEXIST") {
|
|
7359
7656
|
throw error;
|
|
@@ -7362,7 +7659,7 @@ const ensureDir = async (dirPath) => {
|
|
|
7362
7659
|
};
|
|
7363
7660
|
const writeJsonFile = async (filePath, data) => {
|
|
7364
7661
|
const content = JSON.stringify(data, null, 2) + "\n";
|
|
7365
|
-
await fs.writeFile(filePath, content, "utf-8");
|
|
7662
|
+
await fs$1.writeFile(filePath, content, "utf-8");
|
|
7366
7663
|
};
|
|
7367
7664
|
const isRecord$1 = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7368
7665
|
const hasManifestShape = (value) => {
|
|
@@ -7431,7 +7728,7 @@ const createEmptyMediaManifest = () => ({
|
|
|
7431
7728
|
async function readMediaManifest(contentDir) {
|
|
7432
7729
|
const manifestPath = getManifestPath(contentDir);
|
|
7433
7730
|
try {
|
|
7434
|
-
const content = await fs.readFile(manifestPath, "utf-8");
|
|
7731
|
+
const content = await fs$1.readFile(manifestPath, "utf-8");
|
|
7435
7732
|
return parseManifest(content) ?? createEmptyMediaManifest();
|
|
7436
7733
|
} catch (error) {
|
|
7437
7734
|
const nodeError = error;
|
|
@@ -8493,7 +8790,7 @@ async function writeBinaryFileAtomic(filePath, data, options) {
|
|
|
8493
8790
|
const MEDIA_DIR_NAME = "media";
|
|
8494
8791
|
const fileExists = async (filePath) => {
|
|
8495
8792
|
try {
|
|
8496
|
-
await fs.access(filePath);
|
|
8793
|
+
await fs$1.access(filePath);
|
|
8497
8794
|
return true;
|
|
8498
8795
|
} catch {
|
|
8499
8796
|
return false;
|
|
@@ -8501,7 +8798,7 @@ const fileExists = async (filePath) => {
|
|
|
8501
8798
|
};
|
|
8502
8799
|
const listMediaDirFiles = async (mediaDir) => {
|
|
8503
8800
|
try {
|
|
8504
|
-
return await fs.readdir(mediaDir);
|
|
8801
|
+
return await fs$1.readdir(mediaDir);
|
|
8505
8802
|
} catch (error) {
|
|
8506
8803
|
const nodeError = error;
|
|
8507
8804
|
if (nodeError.code === "ENOENT") return [];
|
|
@@ -8557,7 +8854,7 @@ async function loadLocalMediaFile(contentDir, identifier, manifest) {
|
|
|
8557
8854
|
}
|
|
8558
8855
|
async function writeLocalMediaFile(contentDir, filename, data) {
|
|
8559
8856
|
const mediaDir = path$1.join(contentDir, MEDIA_DIR_NAME);
|
|
8560
|
-
await fs.mkdir(mediaDir, { recursive: true });
|
|
8857
|
+
await fs$1.mkdir(mediaDir, { recursive: true });
|
|
8561
8858
|
const filePath = path$1.join(mediaDir, filename);
|
|
8562
8859
|
const written = await writeBinaryFileAtomic(filePath, data, {
|
|
8563
8860
|
overwrite: "allow",
|
|
@@ -9824,7 +10121,7 @@ const removeStaleLocalFile = async (options) => {
|
|
|
9824
10121
|
}
|
|
9825
10122
|
const previousPath = path$1.join(options.contentDir, "media", options.previousFilename);
|
|
9826
10123
|
if (await localMediaFileExists(previousPath)) {
|
|
9827
|
-
await fs.unlink(previousPath).catch(() => {});
|
|
10124
|
+
await fs$1.unlink(previousPath).catch(() => {});
|
|
9828
10125
|
}
|
|
9829
10126
|
};
|
|
9830
10127
|
const applySkipDecision = (decision, context, local, existingEntry) => {
|
|
@@ -10057,4 +10354,4 @@ async function syncLocalMediaForPush(options) {
|
|
|
10057
10354
|
}
|
|
10058
10355
|
|
|
10059
10356
|
//#endregion
|
|
10060
|
-
export {
|
|
10357
|
+
export { sdkListEventsResponseSchema as $, resolveMediaTransformForAspect as A, asRecord as B, walkAndCollectImageAttrs as C, normalizeWidthCandidates as D, rotateNormalizedPoint as E, buildMediaIdentifierFromFilename as F, parseSafeDownloadFilename as G, FILE_SIZE_LIMITS as H, parseMediaIdentifier as I, createHttpClient as J, ManagementApiError as K, deriveVideoSlotPolicy as L, getDirectImageUrlForSiteScopedPath as M, getImageUrl as N, isExplicitRectCrop as O, isSiteScopedDirectImageStoragePath as P, sdkGetEventResponseSchema as Q, resolveVideoSelectionIntentForMediaField as R, buildRenderableMediaAssetIndex as S, sdkConfiguredBookingVerticalConfigSchema as St, looksLikeUuid as T, classifyKnownMimeType as U, parseRelativeStoragePath as V, managementMediaLibraryUploadLimitForMimeType as W, managementTransportError as X, is404Error as Y, sdkConfigureBookingVerticalResponseSchema as Z, buildSettingsUpdateInput as _, sdkSavePageDesignResponseSchema as _t, prepareLocalMediaForPush as a, customLinkSchema$1 as at, isMediaValue as b, sdkListEventOccurrencesResponseSchema as bt, writeBinaryFileAtomic as c, internalLinkSchema as ct, normalizeMediaValueToIdentifierOnly as d, isInternalResolvedLinkValue as dt, sdkTakeEventOfflineResponseSchema as et, walkLocalContentMedia as f, isResolvedInternalLinkEntityType as ft, SETTINGS_FILE_FIELDS as g, sdkGetPageDesignResponseSchema as gt, extractMediaIdentifiers as h, portablePageDesignSchema as ht, applyLocalMediaPush as i, RESOLVED_INTERNAL_LINK_ENTITY_TYPES as it, getDirectImageUrlForRelativePath as j, parseAspectRatioValue as k, sha256 as l, internalResolvedLinkSchema as lt, downloadMedia as m, pageLinkSchema$1 as mt, syncLocalMediaForPush as n, sdkSettingsUpdateSchema as nt, admitBinaryWriteDestination as o, entryLinkSchema$1 as ot, buildStorageUrl as p, linkSchema as pt, buildRequestInfo as q, syncLocalMediaForPull as r, linkPayloadSchema as rt, readStableBinaryFile as s, externalLinkSchema$1 as st, revalidateLocalMediaPushPlan as t, sdkUpsertEventResponseSchema as tt, normalizeMediaIdentifierInput as u, internalRouteOnlyLinkSchema as ut, hasOwnSettingsField as v, sdkDeleteEventOccurrenceResponseSchema as vt, deleteEnvSpecificKeys as w, attachRenderableMediaAssetFields as x, sdkReorderResponseSchema as xt, writeMediaManifest as y, sdkEventOccurrenceResponseSchema as yt, getMimeType as z };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { Ut as err, Wt as ok, gt as parseSiteId } from "./src-CiZrHLCj.mjs";
|
|
3
3
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
4
|
import { dirname, isAbsolute, join, parse, relative, resolve, sep } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
package/dist/scaffold/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "../src-
|
|
3
|
-
import { a as prepareScaffoldExecution, d as loadGeneratedPackageRanges, i as preflightScaffoldTargets, l as deriveGeneratedPackageRanges, o as writeScaffoldFiles, r as preflightScaffoldPlan, s as deriveScaffoldLocalManifest, t as deriveScaffoldPlan, u as findPackageManifestPath } from "../plan-
|
|
2
|
+
import "../src-CiZrHLCj.mjs";
|
|
3
|
+
import { a as prepareScaffoldExecution, d as loadGeneratedPackageRanges, i as preflightScaffoldTargets, l as deriveGeneratedPackageRanges, o as writeScaffoldFiles, r as preflightScaffoldPlan, s as deriveScaffoldLocalManifest, t as deriveScaffoldPlan, u as findPackageManifestPath } from "../plan-BIwseF-X.mjs";
|
|
4
4
|
|
|
5
5
|
export { deriveGeneratedPackageRanges, deriveScaffoldLocalManifest, deriveScaffoldPlan, findPackageManifestPath, loadGeneratedPackageRanges, preflightScaffoldPlan, preflightScaffoldTargets, prepareScaffoldExecution, writeScaffoldFiles };
|