@riverbankcms/sdk 0.7.0 → 0.7.3
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/README.md +229 -0
- package/dist/cli/index.js +42 -95
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init-docs/content/agents-section.md +50 -0
- package/dist/cli/init-docs/content/cli-reference.md +574 -0
- package/dist/cli/init-docs/content/content-management.md +384 -0
- package/dist/cli/init-docs/content/context-brand.md +125 -0
- package/dist/cli/init-docs/content/context-brief.md +77 -0
- package/dist/cli/init-docs/content/context-knowledge.md +111 -0
- package/dist/cli/init-docs/content/getting-started.md +130 -0
- package/dist/cli/init-docs/content/site-workflows-readme.md +96 -0
- package/dist/cli/init-docs/content/workflow-add-block.md +228 -0
- package/dist/cli/init-docs/content/workflow-create-page.md +193 -0
- package/dist/cli/init-docs/content/workflow-publish.md +280 -0
- package/dist/client/bookings.d.mts +2 -0
- package/dist/client/bookings.d.ts +2 -0
- package/dist/client/bookings.js +2956 -104
- package/dist/client/bookings.js.map +1 -1
- package/dist/client/bookings.mjs +2929 -70
- package/dist/client/bookings.mjs.map +1 -1
- package/dist/client/client.d.mts +2 -2
- package/dist/client/client.d.ts +2 -2
- package/dist/client/client.js +602 -68
- package/dist/client/client.js.map +1 -1
- package/dist/client/client.mjs +602 -68
- package/dist/client/client.mjs.map +1 -1
- package/dist/client/hooks.d.mts +2 -2
- package/dist/client/hooks.d.ts +2 -2
- package/dist/client/rendering/client.js +3070 -259
- package/dist/client/rendering/client.js.map +1 -1
- package/dist/client/rendering/client.mjs +3212 -395
- package/dist/client/rendering/client.mjs.map +1 -1
- package/dist/client/spam-protection.d.mts +55 -0
- package/dist/client/spam-protection.d.ts +55 -0
- package/dist/client/spam-protection.js +2915 -0
- package/dist/client/spam-protection.js.map +1 -0
- package/dist/client/spam-protection.mjs +2893 -0
- package/dist/client/spam-protection.mjs.map +1 -0
- package/dist/client/{usePage-BiOReg0_.d.ts → usePage-BYmJCCm1.d.ts} +132 -11
- package/dist/client/{usePage-BXjk8BhD.d.mts → usePage-DZtrWajy.d.mts} +132 -11
- package/dist/server/{Layout-wBtJLTVX.d.ts → Layout-Yluyb6sK.d.ts} +1 -1
- package/dist/server/{Layout-B7cvis7r.d.mts → Layout-qWLdVm5-.d.mts} +1 -1
- package/dist/server/chunk-2IZ6S225.js +122 -0
- package/dist/server/chunk-2IZ6S225.js.map +1 -0
- package/dist/server/chunk-4CV4JOE5.js +27 -0
- package/dist/server/chunk-4CV4JOE5.js.map +1 -0
- package/dist/server/chunk-5LRR64Y6.mjs +72 -0
- package/dist/server/chunk-5LRR64Y6.mjs.map +1 -0
- package/dist/server/chunk-NBTRDLCM.js +72 -0
- package/dist/server/chunk-NBTRDLCM.js.map +1 -0
- package/dist/server/chunk-NFEGQTCC.mjs +27 -0
- package/dist/server/{chunk-7FIJSGHU.mjs → chunk-NFQLH5IA.mjs} +856 -74
- package/dist/server/chunk-NFQLH5IA.mjs.map +1 -0
- package/dist/server/chunk-PPHZV6YD.mjs +122 -0
- package/dist/server/chunk-PPHZV6YD.mjs.map +1 -0
- package/dist/server/{chunk-P7UVAMK6.js → chunk-VLXTNB2C.js} +866 -84
- package/dist/server/chunk-VLXTNB2C.js.map +1 -0
- package/dist/server/{components-CMMwDXTW.d.mts → components-DNHfSCML.d.mts} +3 -3
- package/dist/server/{components-CICSJyp_.d.ts → components-Di5ME6He.d.ts} +3 -3
- package/dist/server/components.d.mts +5 -5
- package/dist/server/components.d.ts +5 -5
- package/dist/server/components.js +1 -1
- package/dist/server/components.mjs +1 -1
- package/dist/server/config-validation.js +1 -1
- package/dist/server/config-validation.mjs +1 -1
- package/dist/server/config.js +1 -1
- package/dist/server/config.mjs +1 -1
- package/dist/server/data.d.mts +2 -2
- package/dist/server/data.d.ts +2 -2
- package/dist/server/data.js +1 -1
- package/dist/server/data.mjs +1 -1
- package/dist/server/env.d.mts +109 -0
- package/dist/server/env.d.ts +109 -0
- package/dist/server/env.js +14 -0
- package/dist/server/env.js.map +1 -0
- package/dist/server/env.mjs +14 -0
- package/dist/server/{index-DI_qlYx3.d.mts → index--Oyunk_B.d.mts} +2 -2
- package/dist/server/{index-BTwWvSBu.d.ts → index-C9Ra8dza.d.ts} +2 -2
- package/dist/server/{index-Bucs6UqG.d.mts → index-Clm3skz_.d.mts} +1 -1
- package/dist/server/{index-Cp7tJuRt.d.ts → index-DLvNddi-.d.ts} +1 -1
- package/dist/server/index.d.mts +216 -5
- package/dist/server/index.d.ts +216 -5
- package/dist/server/index.js +301 -4
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +301 -4
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/{loadContent-DmgpFcFC.d.ts → loadContent-D7LQwI0o.d.ts} +3 -3
- package/dist/server/{loadContent-C-YYUKQa.d.mts → loadContent-DVfuBLiZ.d.mts} +3 -3
- package/dist/server/{loadPage-IDGVDFBB.js → loadPage-AXNAERDS.js} +2 -2
- package/dist/server/{loadPage-IDGVDFBB.js.map → loadPage-AXNAERDS.js.map} +1 -1
- package/dist/server/{loadPage-DP3nrHBi.d.ts → loadPage-BmYJCe_V.d.ts} +2 -2
- package/dist/server/{loadPage-B8mQUUSo.d.mts → loadPage-BucnLHmE.d.mts} +2 -2
- package/dist/server/{loadPage-DNQTTRHL.mjs → loadPage-XR7ORQ2E.mjs} +2 -2
- package/dist/server/loadPage-XR7ORQ2E.mjs.map +1 -0
- package/dist/server/metadata.d.mts +4 -4
- package/dist/server/metadata.d.ts +4 -4
- package/dist/server/metadata.js +1 -1
- package/dist/server/metadata.mjs +1 -1
- package/dist/server/navigation.d.mts +2 -2
- package/dist/server/navigation.d.ts +2 -2
- package/dist/server/navigation.js +1 -1
- package/dist/server/navigation.mjs +1 -1
- package/dist/server/next/revalidate.d.mts +66 -0
- package/dist/server/next/revalidate.d.ts +66 -0
- package/dist/server/next/revalidate.js +60 -0
- package/dist/server/next/revalidate.js.map +1 -0
- package/dist/server/next/revalidate.mjs +60 -0
- package/dist/server/next/revalidate.mjs.map +1 -0
- package/dist/server/next/tags.d.mts +81 -0
- package/dist/server/next/tags.d.ts +81 -0
- package/dist/server/next/tags.js +36 -0
- package/dist/server/next/tags.js.map +1 -0
- package/dist/server/next/tags.mjs +36 -0
- package/dist/server/next/tags.mjs.map +1 -0
- package/dist/server/next.d.mts +164 -6
- package/dist/server/next.d.ts +164 -6
- package/dist/server/next.js +79 -11
- package/dist/server/next.js.map +1 -1
- package/dist/server/next.mjs +76 -8
- package/dist/server/next.mjs.map +1 -1
- package/dist/server/rendering/server.d.mts +4 -4
- package/dist/server/rendering/server.d.ts +4 -4
- package/dist/server/rendering/server.js +1 -1
- package/dist/server/rendering/server.mjs +1 -1
- package/dist/server/rendering.d.mts +7 -7
- package/dist/server/rendering.d.ts +7 -7
- package/dist/server/rendering.js +3 -3
- package/dist/server/rendering.js.map +1 -1
- package/dist/server/rendering.mjs +4 -4
- package/dist/server/routing.d.mts +3 -3
- package/dist/server/routing.d.ts +3 -3
- package/dist/server/routing.js +2 -2
- package/dist/server/routing.mjs +2 -2
- package/dist/server/server.d.mts +5 -5
- package/dist/server/server.d.ts +5 -5
- package/dist/server/server.js +5 -5
- package/dist/server/server.js.map +1 -1
- package/dist/server/server.mjs +5 -5
- package/dist/server/theme-bridge.js +1 -1
- package/dist/server/theme-bridge.mjs +1 -1
- package/dist/server/theme.js +1 -1
- package/dist/server/theme.mjs +1 -1
- package/dist/server/{types-BvcJU7zk.d.ts → types-BRQyLrQU.d.ts} +132 -11
- package/dist/server/{types-Dsu9wsUh.d.mts → types-BSV6Vc-P.d.mts} +2 -2
- package/dist/server/{types-1cLz0vnq.d.mts → types-C-LShyIg.d.mts} +132 -11
- package/dist/server/{types-CVykEqXN.d.ts → types-Dt98DeYa.d.ts} +2 -2
- package/dist/server/webhooks.d.mts +81 -0
- package/dist/server/webhooks.d.ts +81 -0
- package/dist/server/webhooks.js +12 -0
- package/dist/server/webhooks.js.map +1 -0
- package/dist/server/webhooks.mjs +12 -0
- package/dist/server/webhooks.mjs.map +1 -0
- package/package.json +29 -3
- package/dist/client/resolver-BhueZVxZ.d.mts +0 -61
- package/dist/client/resolver-BhueZVxZ.d.ts +0 -61
- package/dist/client/usePage--fGlyrgj.d.mts +0 -6439
- package/dist/client/usePage-BBcFCxOU.d.ts +0 -6297
- package/dist/client/usePage-BC8Q2E3t.d.mts +0 -6431
- package/dist/client/usePage-BTPnCuWC.d.mts +0 -6511
- package/dist/client/usePage-BafOS9UT.d.mts +0 -6512
- package/dist/client/usePage-BcjWPXvh.d.mts +0 -6388
- package/dist/client/usePage-Bnx-kA6x.d.mts +0 -6670
- package/dist/client/usePage-BvKAa3Zw.d.mts +0 -366
- package/dist/client/usePage-BvKAa3Zw.d.ts +0 -366
- package/dist/client/usePage-BydHcMYB.d.mts +0 -6297
- package/dist/client/usePage-C3ZKNwY7.d.mts +0 -6393
- package/dist/client/usePage-CE7X5NcN.d.ts +0 -6439
- package/dist/client/usePage-CHEybPMD.d.ts +0 -6429
- package/dist/client/usePage-CrKw1H6Y.d.ts +0 -6338
- package/dist/client/usePage-CyYpOJud.d.ts +0 -6388
- package/dist/client/usePage-D4fxZbRR.d.mts +0 -6429
- package/dist/client/usePage-DMI8ImsU.d.mts +0 -6338
- package/dist/client/usePage-DoPI6b8V.d.ts +0 -6511
- package/dist/client/usePage-DpRNZUtP.d.ts +0 -6431
- package/dist/client/usePage-QNWArrVO.d.ts +0 -6670
- package/dist/client/usePage-fBgPB6Oq.d.ts +0 -6512
- package/dist/client/usePage-gpVaeWDy.d.ts +0 -6393
- package/dist/server/chunk-7FIJSGHU.mjs.map +0 -1
- package/dist/server/chunk-BJTO5JO5.mjs +0 -11
- package/dist/server/chunk-DGUM43GV.js +0 -11
- package/dist/server/chunk-DGUM43GV.js.map +0 -1
- package/dist/server/chunk-P7UVAMK6.js.map +0 -1
- /package/dist/server/{chunk-BJTO5JO5.mjs.map → chunk-NFEGQTCC.mjs.map} +0 -0
- /package/dist/server/{loadPage-DNQTTRHL.mjs.map → env.mjs.map} +0 -0
|
@@ -3354,7 +3354,7 @@ type ListSiteMembersResponse = {
|
|
|
3354
3354
|
plan: SitePlanSummaryResponse;
|
|
3355
3355
|
};
|
|
3356
3356
|
type AuthFieldKey = 'email' | 'password' | 'confirmPassword' | 'name' | 'terms' | 'magicLink';
|
|
3357
|
-
type AuthSubmissionErrorReason = 'validation' | '
|
|
3357
|
+
type AuthSubmissionErrorReason = 'validation' | 'spam_protection' | 'supabase' | 'already_registered' | 'rate_limited' | 'email' | 'closed' | 'invalid_credentials' | 'not_confirmed' | 'not_allowed';
|
|
3358
3358
|
type AuthSubmissionSuccess = {
|
|
3359
3359
|
status: 'success';
|
|
3360
3360
|
message: string;
|
|
@@ -4926,7 +4926,7 @@ type APIEndpoints = {
|
|
|
4926
4926
|
referer?: string;
|
|
4927
4927
|
path?: string;
|
|
4928
4928
|
honeypot?: string;
|
|
4929
|
-
|
|
4929
|
+
altchaSolution?: string | null;
|
|
4930
4930
|
};
|
|
4931
4931
|
}, never, {
|
|
4932
4932
|
ok: boolean;
|
|
@@ -6250,10 +6250,17 @@ interface PaginationMeta {
|
|
|
6250
6250
|
type EntriesResponseWithMeta = {
|
|
6251
6251
|
entries: EntriesResponse['entries'];
|
|
6252
6252
|
} & PaginationMeta;
|
|
6253
|
+
/**
|
|
6254
|
+
* Common options for all SDK methods
|
|
6255
|
+
*/
|
|
6256
|
+
interface SdkMethodOptions {
|
|
6257
|
+
/** AbortSignal for cancelling the request */
|
|
6258
|
+
signal?: AbortSignal;
|
|
6259
|
+
}
|
|
6253
6260
|
/**
|
|
6254
6261
|
* Base parameters for getEntries - shared across all overloads
|
|
6255
6262
|
*/
|
|
6256
|
-
interface GetEntriesBaseParams {
|
|
6263
|
+
interface GetEntriesBaseParams extends SdkMethodOptions {
|
|
6257
6264
|
/** The site ID */
|
|
6258
6265
|
siteId: string;
|
|
6259
6266
|
/** The content type key (e.g., 'blog-post', 'product') */
|
|
@@ -6271,6 +6278,104 @@ interface GetEntriesBaseParams {
|
|
|
6271
6278
|
/** Entry IDs to fetch when mode is 'manual' */
|
|
6272
6279
|
entryIds?: string[];
|
|
6273
6280
|
}
|
|
6281
|
+
/**
|
|
6282
|
+
* Source of the data returned by a resilient fetch
|
|
6283
|
+
*/
|
|
6284
|
+
type ResilienceSource = 'live' | 'cache' | 'stale' | 'prebuild' | 'error';
|
|
6285
|
+
/**
|
|
6286
|
+
* Status information from a resilient fetch operation
|
|
6287
|
+
*/
|
|
6288
|
+
interface ResilienceStatus {
|
|
6289
|
+
/** Where the data came from */
|
|
6290
|
+
source: ResilienceSource;
|
|
6291
|
+
/** Whether this was a preview request */
|
|
6292
|
+
isPreview: boolean;
|
|
6293
|
+
/** Cache key used for this request */
|
|
6294
|
+
cacheKey?: string;
|
|
6295
|
+
/** Error details if fetch failed */
|
|
6296
|
+
error?: {
|
|
6297
|
+
code?: string;
|
|
6298
|
+
message: string;
|
|
6299
|
+
};
|
|
6300
|
+
/** Seconds since cache TTL expired (when source='stale') */
|
|
6301
|
+
staleAgeSec?: number;
|
|
6302
|
+
/** Seconds since prebuild was generated (when source='prebuild') */
|
|
6303
|
+
prebuildAgeSec?: number;
|
|
6304
|
+
/** Circuit breaker state at time of request */
|
|
6305
|
+
circuit: CircuitState;
|
|
6306
|
+
/** Correlation ID for debugging */
|
|
6307
|
+
requestId?: string;
|
|
6308
|
+
/** Total request duration including retries (ms) */
|
|
6309
|
+
durationMs?: number;
|
|
6310
|
+
}
|
|
6311
|
+
/**
|
|
6312
|
+
* Circuit breaker state information
|
|
6313
|
+
*/
|
|
6314
|
+
interface CircuitState {
|
|
6315
|
+
state: 'closed' | 'open' | 'half-open';
|
|
6316
|
+
failureCount: number;
|
|
6317
|
+
/** Timestamp when circuit will transition from open to half-open */
|
|
6318
|
+
openUntil?: number;
|
|
6319
|
+
}
|
|
6320
|
+
/**
|
|
6321
|
+
* Retry configuration
|
|
6322
|
+
*/
|
|
6323
|
+
interface RetryConfig {
|
|
6324
|
+
/** Maximum number of attempts (including initial) */
|
|
6325
|
+
maxAttempts?: number;
|
|
6326
|
+
/** Base delay between retries in ms */
|
|
6327
|
+
baseDelayMs?: number;
|
|
6328
|
+
/** Maximum delay between retries in ms */
|
|
6329
|
+
maxDelayMs?: number;
|
|
6330
|
+
/** Jitter strategy: 'full' adds randomization, 'none' uses exact delays */
|
|
6331
|
+
jitter?: 'full' | 'none';
|
|
6332
|
+
/** Custom function to determine if an error should be retried */
|
|
6333
|
+
retryOn?: (error: Error, statusCode?: number) => boolean;
|
|
6334
|
+
}
|
|
6335
|
+
/**
|
|
6336
|
+
* Circuit breaker configuration
|
|
6337
|
+
*/
|
|
6338
|
+
interface CircuitBreakerConfig {
|
|
6339
|
+
/** Number of failures before opening circuit */
|
|
6340
|
+
failureThreshold?: number;
|
|
6341
|
+
/** Time in ms before attempting to close circuit */
|
|
6342
|
+
resetTimeoutMs?: number;
|
|
6343
|
+
/** Number of successful requests needed to close from half-open */
|
|
6344
|
+
halfOpenMaxRequests?: number;
|
|
6345
|
+
}
|
|
6346
|
+
/**
|
|
6347
|
+
* Resilience configuration for the SDK client
|
|
6348
|
+
*/
|
|
6349
|
+
interface ResilienceConfig {
|
|
6350
|
+
/** Enable resilience features (default: true) */
|
|
6351
|
+
enabled?: boolean;
|
|
6352
|
+
/** Serve stale data on fetch failure (default: true) */
|
|
6353
|
+
staleIfError?: boolean;
|
|
6354
|
+
/** Seconds AFTER cache TTL expires that stale data remains valid (default: 300) */
|
|
6355
|
+
staleTtlSec?: number;
|
|
6356
|
+
/** Request timeout in ms (default: 8000 server, 5000 browser) */
|
|
6357
|
+
requestTimeoutMs?: number;
|
|
6358
|
+
/** Retry configuration */
|
|
6359
|
+
retry?: RetryConfig;
|
|
6360
|
+
/** Circuit breaker configuration */
|
|
6361
|
+
circuitBreaker?: CircuitBreakerConfig;
|
|
6362
|
+
/**
|
|
6363
|
+
* Path to prebuild cache directory.
|
|
6364
|
+
* If set, enables prebuild fallback when live + stale cache both fail.
|
|
6365
|
+
* @example '.riverbank-cache'
|
|
6366
|
+
*/
|
|
6367
|
+
prebuildDir?: string;
|
|
6368
|
+
/**
|
|
6369
|
+
* Maximum age in seconds for prebuild cache.
|
|
6370
|
+
* Prebuilds older than this are rejected.
|
|
6371
|
+
* @default 86400 (24 hours)
|
|
6372
|
+
*/
|
|
6373
|
+
maxPrebuildAgeSec?: number;
|
|
6374
|
+
/** Callback fired on every request with status information */
|
|
6375
|
+
onStatusChange?: (status: ResilienceStatus) => void;
|
|
6376
|
+
/** Callback fired only when transitioning into/out of degraded mode */
|
|
6377
|
+
onDegradedMode?: (degraded: boolean, status: ResilienceStatus) => void;
|
|
6378
|
+
}
|
|
6274
6379
|
/**
|
|
6275
6380
|
* Configuration for creating a Riverbank CMS client
|
|
6276
6381
|
*/
|
|
@@ -6302,6 +6407,10 @@ interface RiverbankClientConfig {
|
|
|
6302
6407
|
*/
|
|
6303
6408
|
maxSize?: number;
|
|
6304
6409
|
};
|
|
6410
|
+
/**
|
|
6411
|
+
* Resilience configuration for error handling, retries, and fallbacks
|
|
6412
|
+
*/
|
|
6413
|
+
resilience?: ResilienceConfig;
|
|
6305
6414
|
}
|
|
6306
6415
|
/**
|
|
6307
6416
|
* Riverbank CMS client interface
|
|
@@ -6314,7 +6423,7 @@ interface RiverbankClient {
|
|
|
6314
6423
|
slug?: string;
|
|
6315
6424
|
domain?: string;
|
|
6316
6425
|
id?: string;
|
|
6317
|
-
}): Promise<SiteResponse>;
|
|
6426
|
+
} & SdkMethodOptions): Promise<SiteResponse>;
|
|
6318
6427
|
/**
|
|
6319
6428
|
* Fetch a specific page by path
|
|
6320
6429
|
*
|
|
@@ -6324,7 +6433,7 @@ interface RiverbankClient {
|
|
|
6324
6433
|
siteId: string;
|
|
6325
6434
|
path: string;
|
|
6326
6435
|
preview?: boolean;
|
|
6327
|
-
}): Promise<PageResponse>;
|
|
6436
|
+
} & SdkMethodOptions): Promise<PageResponse>;
|
|
6328
6437
|
/**
|
|
6329
6438
|
* Fetch published content entries with optional pagination, sorting, and preview mode
|
|
6330
6439
|
*
|
|
@@ -6385,20 +6494,20 @@ interface RiverbankClient {
|
|
|
6385
6494
|
siteId: string;
|
|
6386
6495
|
contentType: string;
|
|
6387
6496
|
slug: string;
|
|
6388
|
-
}): Promise<EntryResponse>;
|
|
6497
|
+
} & SdkMethodOptions): Promise<EntryResponse>;
|
|
6389
6498
|
/**
|
|
6390
6499
|
* Fetch a public form definition by ID
|
|
6391
6500
|
*/
|
|
6392
6501
|
getPublicFormById(params: {
|
|
6393
6502
|
formId: string;
|
|
6394
|
-
}): Promise<PublicFormResponse>;
|
|
6503
|
+
} & SdkMethodOptions): Promise<PublicFormResponse>;
|
|
6395
6504
|
/**
|
|
6396
6505
|
* Fetch public booking services for a site
|
|
6397
6506
|
*/
|
|
6398
6507
|
getPublicBookingServices(params: {
|
|
6399
6508
|
siteId: string;
|
|
6400
6509
|
ids?: string;
|
|
6401
|
-
}): Promise<PublicBookingServicesResponse>;
|
|
6510
|
+
} & SdkMethodOptions): Promise<PublicBookingServicesResponse>;
|
|
6402
6511
|
/**
|
|
6403
6512
|
* List public events for a site (optionally time-filtered)
|
|
6404
6513
|
*/
|
|
@@ -6408,7 +6517,7 @@ interface RiverbankClient {
|
|
|
6408
6517
|
from?: string;
|
|
6409
6518
|
to?: string;
|
|
6410
6519
|
stage?: string;
|
|
6411
|
-
}): Promise<PublicEventsResponse>;
|
|
6520
|
+
} & SdkMethodOptions): Promise<PublicEventsResponse>;
|
|
6412
6521
|
/**
|
|
6413
6522
|
* Resolve an event occurrence by URL segment (date or UUID)
|
|
6414
6523
|
*
|
|
@@ -6437,7 +6546,7 @@ interface RiverbankClient {
|
|
|
6437
6546
|
siteId: string;
|
|
6438
6547
|
entryId: string;
|
|
6439
6548
|
segment: string;
|
|
6440
|
-
}): Promise<ResolveEventOccurrenceResponse>;
|
|
6549
|
+
} & SdkMethodOptions): Promise<ResolveEventOccurrenceResponse>;
|
|
6441
6550
|
/**
|
|
6442
6551
|
* Check if a path has a configured redirect rule
|
|
6443
6552
|
*
|
|
@@ -6458,11 +6567,23 @@ interface RiverbankClient {
|
|
|
6458
6567
|
checkRedirect(params: {
|
|
6459
6568
|
siteId: string;
|
|
6460
6569
|
path: string;
|
|
6461
|
-
}): Promise<CheckRedirectResponse>;
|
|
6570
|
+
} & SdkMethodOptions): Promise<CheckRedirectResponse>;
|
|
6462
6571
|
/**
|
|
6463
6572
|
* Force clear the cache
|
|
6464
6573
|
*/
|
|
6465
6574
|
clearCache(): void;
|
|
6575
|
+
/**
|
|
6576
|
+
* Get the status from the most recently emitted request
|
|
6577
|
+
*
|
|
6578
|
+
* Note: With concurrent requests, this returns the last status emitted,
|
|
6579
|
+
* which may not be from the request you're interested in. For reliable
|
|
6580
|
+
* per-request status, use the onStatusChange callback instead.
|
|
6581
|
+
*/
|
|
6582
|
+
getLastEmittedStatus(): ResilienceStatus | null;
|
|
6583
|
+
/**
|
|
6584
|
+
* Get the current circuit breaker state
|
|
6585
|
+
*/
|
|
6586
|
+
getCircuitState(): CircuitState;
|
|
6466
6587
|
}
|
|
6467
6588
|
|
|
6468
6589
|
/**
|
|
@@ -3354,7 +3354,7 @@ type ListSiteMembersResponse = {
|
|
|
3354
3354
|
plan: SitePlanSummaryResponse;
|
|
3355
3355
|
};
|
|
3356
3356
|
type AuthFieldKey = 'email' | 'password' | 'confirmPassword' | 'name' | 'terms' | 'magicLink';
|
|
3357
|
-
type AuthSubmissionErrorReason = 'validation' | '
|
|
3357
|
+
type AuthSubmissionErrorReason = 'validation' | 'spam_protection' | 'supabase' | 'already_registered' | 'rate_limited' | 'email' | 'closed' | 'invalid_credentials' | 'not_confirmed' | 'not_allowed';
|
|
3358
3358
|
type AuthSubmissionSuccess = {
|
|
3359
3359
|
status: 'success';
|
|
3360
3360
|
message: string;
|
|
@@ -4926,7 +4926,7 @@ type APIEndpoints = {
|
|
|
4926
4926
|
referer?: string;
|
|
4927
4927
|
path?: string;
|
|
4928
4928
|
honeypot?: string;
|
|
4929
|
-
|
|
4929
|
+
altchaSolution?: string | null;
|
|
4930
4930
|
};
|
|
4931
4931
|
}, never, {
|
|
4932
4932
|
ok: boolean;
|
|
@@ -6250,10 +6250,17 @@ interface PaginationMeta {
|
|
|
6250
6250
|
type EntriesResponseWithMeta = {
|
|
6251
6251
|
entries: EntriesResponse['entries'];
|
|
6252
6252
|
} & PaginationMeta;
|
|
6253
|
+
/**
|
|
6254
|
+
* Common options for all SDK methods
|
|
6255
|
+
*/
|
|
6256
|
+
interface SdkMethodOptions {
|
|
6257
|
+
/** AbortSignal for cancelling the request */
|
|
6258
|
+
signal?: AbortSignal;
|
|
6259
|
+
}
|
|
6253
6260
|
/**
|
|
6254
6261
|
* Base parameters for getEntries - shared across all overloads
|
|
6255
6262
|
*/
|
|
6256
|
-
interface GetEntriesBaseParams {
|
|
6263
|
+
interface GetEntriesBaseParams extends SdkMethodOptions {
|
|
6257
6264
|
/** The site ID */
|
|
6258
6265
|
siteId: string;
|
|
6259
6266
|
/** The content type key (e.g., 'blog-post', 'product') */
|
|
@@ -6271,6 +6278,104 @@ interface GetEntriesBaseParams {
|
|
|
6271
6278
|
/** Entry IDs to fetch when mode is 'manual' */
|
|
6272
6279
|
entryIds?: string[];
|
|
6273
6280
|
}
|
|
6281
|
+
/**
|
|
6282
|
+
* Source of the data returned by a resilient fetch
|
|
6283
|
+
*/
|
|
6284
|
+
type ResilienceSource = 'live' | 'cache' | 'stale' | 'prebuild' | 'error';
|
|
6285
|
+
/**
|
|
6286
|
+
* Status information from a resilient fetch operation
|
|
6287
|
+
*/
|
|
6288
|
+
interface ResilienceStatus {
|
|
6289
|
+
/** Where the data came from */
|
|
6290
|
+
source: ResilienceSource;
|
|
6291
|
+
/** Whether this was a preview request */
|
|
6292
|
+
isPreview: boolean;
|
|
6293
|
+
/** Cache key used for this request */
|
|
6294
|
+
cacheKey?: string;
|
|
6295
|
+
/** Error details if fetch failed */
|
|
6296
|
+
error?: {
|
|
6297
|
+
code?: string;
|
|
6298
|
+
message: string;
|
|
6299
|
+
};
|
|
6300
|
+
/** Seconds since cache TTL expired (when source='stale') */
|
|
6301
|
+
staleAgeSec?: number;
|
|
6302
|
+
/** Seconds since prebuild was generated (when source='prebuild') */
|
|
6303
|
+
prebuildAgeSec?: number;
|
|
6304
|
+
/** Circuit breaker state at time of request */
|
|
6305
|
+
circuit: CircuitState;
|
|
6306
|
+
/** Correlation ID for debugging */
|
|
6307
|
+
requestId?: string;
|
|
6308
|
+
/** Total request duration including retries (ms) */
|
|
6309
|
+
durationMs?: number;
|
|
6310
|
+
}
|
|
6311
|
+
/**
|
|
6312
|
+
* Circuit breaker state information
|
|
6313
|
+
*/
|
|
6314
|
+
interface CircuitState {
|
|
6315
|
+
state: 'closed' | 'open' | 'half-open';
|
|
6316
|
+
failureCount: number;
|
|
6317
|
+
/** Timestamp when circuit will transition from open to half-open */
|
|
6318
|
+
openUntil?: number;
|
|
6319
|
+
}
|
|
6320
|
+
/**
|
|
6321
|
+
* Retry configuration
|
|
6322
|
+
*/
|
|
6323
|
+
interface RetryConfig {
|
|
6324
|
+
/** Maximum number of attempts (including initial) */
|
|
6325
|
+
maxAttempts?: number;
|
|
6326
|
+
/** Base delay between retries in ms */
|
|
6327
|
+
baseDelayMs?: number;
|
|
6328
|
+
/** Maximum delay between retries in ms */
|
|
6329
|
+
maxDelayMs?: number;
|
|
6330
|
+
/** Jitter strategy: 'full' adds randomization, 'none' uses exact delays */
|
|
6331
|
+
jitter?: 'full' | 'none';
|
|
6332
|
+
/** Custom function to determine if an error should be retried */
|
|
6333
|
+
retryOn?: (error: Error, statusCode?: number) => boolean;
|
|
6334
|
+
}
|
|
6335
|
+
/**
|
|
6336
|
+
* Circuit breaker configuration
|
|
6337
|
+
*/
|
|
6338
|
+
interface CircuitBreakerConfig {
|
|
6339
|
+
/** Number of failures before opening circuit */
|
|
6340
|
+
failureThreshold?: number;
|
|
6341
|
+
/** Time in ms before attempting to close circuit */
|
|
6342
|
+
resetTimeoutMs?: number;
|
|
6343
|
+
/** Number of successful requests needed to close from half-open */
|
|
6344
|
+
halfOpenMaxRequests?: number;
|
|
6345
|
+
}
|
|
6346
|
+
/**
|
|
6347
|
+
* Resilience configuration for the SDK client
|
|
6348
|
+
*/
|
|
6349
|
+
interface ResilienceConfig {
|
|
6350
|
+
/** Enable resilience features (default: true) */
|
|
6351
|
+
enabled?: boolean;
|
|
6352
|
+
/** Serve stale data on fetch failure (default: true) */
|
|
6353
|
+
staleIfError?: boolean;
|
|
6354
|
+
/** Seconds AFTER cache TTL expires that stale data remains valid (default: 300) */
|
|
6355
|
+
staleTtlSec?: number;
|
|
6356
|
+
/** Request timeout in ms (default: 8000 server, 5000 browser) */
|
|
6357
|
+
requestTimeoutMs?: number;
|
|
6358
|
+
/** Retry configuration */
|
|
6359
|
+
retry?: RetryConfig;
|
|
6360
|
+
/** Circuit breaker configuration */
|
|
6361
|
+
circuitBreaker?: CircuitBreakerConfig;
|
|
6362
|
+
/**
|
|
6363
|
+
* Path to prebuild cache directory.
|
|
6364
|
+
* If set, enables prebuild fallback when live + stale cache both fail.
|
|
6365
|
+
* @example '.riverbank-cache'
|
|
6366
|
+
*/
|
|
6367
|
+
prebuildDir?: string;
|
|
6368
|
+
/**
|
|
6369
|
+
* Maximum age in seconds for prebuild cache.
|
|
6370
|
+
* Prebuilds older than this are rejected.
|
|
6371
|
+
* @default 86400 (24 hours)
|
|
6372
|
+
*/
|
|
6373
|
+
maxPrebuildAgeSec?: number;
|
|
6374
|
+
/** Callback fired on every request with status information */
|
|
6375
|
+
onStatusChange?: (status: ResilienceStatus) => void;
|
|
6376
|
+
/** Callback fired only when transitioning into/out of degraded mode */
|
|
6377
|
+
onDegradedMode?: (degraded: boolean, status: ResilienceStatus) => void;
|
|
6378
|
+
}
|
|
6274
6379
|
/**
|
|
6275
6380
|
* Configuration for creating a Riverbank CMS client
|
|
6276
6381
|
*/
|
|
@@ -6302,6 +6407,10 @@ interface RiverbankClientConfig {
|
|
|
6302
6407
|
*/
|
|
6303
6408
|
maxSize?: number;
|
|
6304
6409
|
};
|
|
6410
|
+
/**
|
|
6411
|
+
* Resilience configuration for error handling, retries, and fallbacks
|
|
6412
|
+
*/
|
|
6413
|
+
resilience?: ResilienceConfig;
|
|
6305
6414
|
}
|
|
6306
6415
|
/**
|
|
6307
6416
|
* Riverbank CMS client interface
|
|
@@ -6314,7 +6423,7 @@ interface RiverbankClient {
|
|
|
6314
6423
|
slug?: string;
|
|
6315
6424
|
domain?: string;
|
|
6316
6425
|
id?: string;
|
|
6317
|
-
}): Promise<SiteResponse>;
|
|
6426
|
+
} & SdkMethodOptions): Promise<SiteResponse>;
|
|
6318
6427
|
/**
|
|
6319
6428
|
* Fetch a specific page by path
|
|
6320
6429
|
*
|
|
@@ -6324,7 +6433,7 @@ interface RiverbankClient {
|
|
|
6324
6433
|
siteId: string;
|
|
6325
6434
|
path: string;
|
|
6326
6435
|
preview?: boolean;
|
|
6327
|
-
}): Promise<PageResponse>;
|
|
6436
|
+
} & SdkMethodOptions): Promise<PageResponse>;
|
|
6328
6437
|
/**
|
|
6329
6438
|
* Fetch published content entries with optional pagination, sorting, and preview mode
|
|
6330
6439
|
*
|
|
@@ -6385,20 +6494,20 @@ interface RiverbankClient {
|
|
|
6385
6494
|
siteId: string;
|
|
6386
6495
|
contentType: string;
|
|
6387
6496
|
slug: string;
|
|
6388
|
-
}): Promise<EntryResponse>;
|
|
6497
|
+
} & SdkMethodOptions): Promise<EntryResponse>;
|
|
6389
6498
|
/**
|
|
6390
6499
|
* Fetch a public form definition by ID
|
|
6391
6500
|
*/
|
|
6392
6501
|
getPublicFormById(params: {
|
|
6393
6502
|
formId: string;
|
|
6394
|
-
}): Promise<PublicFormResponse>;
|
|
6503
|
+
} & SdkMethodOptions): Promise<PublicFormResponse>;
|
|
6395
6504
|
/**
|
|
6396
6505
|
* Fetch public booking services for a site
|
|
6397
6506
|
*/
|
|
6398
6507
|
getPublicBookingServices(params: {
|
|
6399
6508
|
siteId: string;
|
|
6400
6509
|
ids?: string;
|
|
6401
|
-
}): Promise<PublicBookingServicesResponse>;
|
|
6510
|
+
} & SdkMethodOptions): Promise<PublicBookingServicesResponse>;
|
|
6402
6511
|
/**
|
|
6403
6512
|
* List public events for a site (optionally time-filtered)
|
|
6404
6513
|
*/
|
|
@@ -6408,7 +6517,7 @@ interface RiverbankClient {
|
|
|
6408
6517
|
from?: string;
|
|
6409
6518
|
to?: string;
|
|
6410
6519
|
stage?: string;
|
|
6411
|
-
}): Promise<PublicEventsResponse>;
|
|
6520
|
+
} & SdkMethodOptions): Promise<PublicEventsResponse>;
|
|
6412
6521
|
/**
|
|
6413
6522
|
* Resolve an event occurrence by URL segment (date or UUID)
|
|
6414
6523
|
*
|
|
@@ -6437,7 +6546,7 @@ interface RiverbankClient {
|
|
|
6437
6546
|
siteId: string;
|
|
6438
6547
|
entryId: string;
|
|
6439
6548
|
segment: string;
|
|
6440
|
-
}): Promise<ResolveEventOccurrenceResponse>;
|
|
6549
|
+
} & SdkMethodOptions): Promise<ResolveEventOccurrenceResponse>;
|
|
6441
6550
|
/**
|
|
6442
6551
|
* Check if a path has a configured redirect rule
|
|
6443
6552
|
*
|
|
@@ -6458,11 +6567,23 @@ interface RiverbankClient {
|
|
|
6458
6567
|
checkRedirect(params: {
|
|
6459
6568
|
siteId: string;
|
|
6460
6569
|
path: string;
|
|
6461
|
-
}): Promise<CheckRedirectResponse>;
|
|
6570
|
+
} & SdkMethodOptions): Promise<CheckRedirectResponse>;
|
|
6462
6571
|
/**
|
|
6463
6572
|
* Force clear the cache
|
|
6464
6573
|
*/
|
|
6465
6574
|
clearCache(): void;
|
|
6575
|
+
/**
|
|
6576
|
+
* Get the status from the most recently emitted request
|
|
6577
|
+
*
|
|
6578
|
+
* Note: With concurrent requests, this returns the last status emitted,
|
|
6579
|
+
* which may not be from the request you're interested in. For reliable
|
|
6580
|
+
* per-request status, use the onStatusChange callback instead.
|
|
6581
|
+
*/
|
|
6582
|
+
getLastEmittedStatus(): ResilienceStatus | null;
|
|
6583
|
+
/**
|
|
6584
|
+
* Get the current circuit breaker state
|
|
6585
|
+
*/
|
|
6586
|
+
getCircuitState(): CircuitState;
|
|
6466
6587
|
}
|
|
6467
6588
|
|
|
6468
6589
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { buildMenu, buildLogo } from './navigation.js';
|
|
3
|
-
import { S as SiteResponse, R as RiverbankClient } from './types-
|
|
3
|
+
import { S as SiteResponse, R as RiverbankClient } from './types-BRQyLrQU.js';
|
|
4
4
|
|
|
5
5
|
type HeaderData = {
|
|
6
6
|
menu: ReturnType<typeof buildMenu>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { buildMenu, buildLogo } from './navigation.mjs';
|
|
3
|
-
import { S as SiteResponse, R as RiverbankClient } from './types-
|
|
3
|
+
import { S as SiteResponse, R as RiverbankClient } from './types-C-LShyIg.mjs';
|
|
4
4
|
|
|
5
5
|
type HeaderData = {
|
|
6
6
|
menu: ReturnType<typeof buildMenu>;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/env.ts
|
|
2
|
+
var RiverbankEnvError = class extends Error {
|
|
3
|
+
constructor(message, missingVars) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.missingVars = missingVars;
|
|
6
|
+
this.name = "RiverbankEnvError";
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
function getEnvPrefix(target) {
|
|
10
|
+
return target === "remote" ? "RIVERBANK_REMOTE" : "RIVERBANK_LOCAL";
|
|
11
|
+
}
|
|
12
|
+
function detectTarget() {
|
|
13
|
+
const env = _optionalChain([process, 'access', _ => _.env, 'access', _2 => _2.RIVERBANK_ENV, 'optionalAccess', _3 => _3.toLowerCase, 'call', _4 => _4()]);
|
|
14
|
+
if (env === "remote" || env === "production" || env === "prod") {
|
|
15
|
+
return "remote";
|
|
16
|
+
}
|
|
17
|
+
return "local";
|
|
18
|
+
}
|
|
19
|
+
function detectPreviewMode() {
|
|
20
|
+
const previewMode = process.env.RIVERBANK_PREVIEW_MODE;
|
|
21
|
+
if (previewMode !== void 0 && previewMode !== "") {
|
|
22
|
+
return previewMode === "true";
|
|
23
|
+
}
|
|
24
|
+
const previewLegacy = process.env.RIVERBANK_PREVIEW;
|
|
25
|
+
if (previewLegacy !== void 0 && previewLegacy !== "") {
|
|
26
|
+
return previewLegacy === "true";
|
|
27
|
+
}
|
|
28
|
+
return process.env.VERCEL_ENV === "preview";
|
|
29
|
+
}
|
|
30
|
+
function validateKeyType(key, expectedType) {
|
|
31
|
+
const isPreviewKey = key.startsWith("bld_preview_sk_");
|
|
32
|
+
const isContentKey = key.startsWith("bld_live_sk_");
|
|
33
|
+
if (expectedType === "preview" && !isPreviewKey) {
|
|
34
|
+
if (isContentKey) {
|
|
35
|
+
throw new RiverbankEnvError(
|
|
36
|
+
`Preview mode is enabled (RIVERBANK_PREVIEW_MODE=true) but a content key was provided. Preview mode requires a preview API key (bld_preview_sk_...) to access draft content. Either:
|
|
37
|
+
1. Set RIVERBANK_*_PREVIEW_API_KEY with your preview key, or
|
|
38
|
+
2. Set RIVERBANK_PREVIEW_MODE=false to fetch published content instead.`,
|
|
39
|
+
[]
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
throw new RiverbankEnvError(
|
|
43
|
+
`Invalid API key format for preview mode. Expected key starting with bld_preview_sk_`,
|
|
44
|
+
[]
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
if (expectedType === "content" && !isContentKey) {
|
|
48
|
+
if (isPreviewKey) {
|
|
49
|
+
console.debug(
|
|
50
|
+
"[getRiverbankEnv] Using preview key for published content. Consider using a content key (bld_live_sk_...) for production."
|
|
51
|
+
);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
throw new RiverbankEnvError(
|
|
55
|
+
`Invalid API key format for content access. Expected key starting with bld_live_sk_ or bld_preview_sk_`,
|
|
56
|
+
[]
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function isPreviewMode() {
|
|
61
|
+
return detectPreviewMode();
|
|
62
|
+
}
|
|
63
|
+
function getRiverbankTarget() {
|
|
64
|
+
return detectTarget();
|
|
65
|
+
}
|
|
66
|
+
function getRiverbankEnv() {
|
|
67
|
+
const target = detectTarget();
|
|
68
|
+
const previewMode = detectPreviewMode();
|
|
69
|
+
const prefix = getEnvPrefix(target);
|
|
70
|
+
const siteId = process.env[`${prefix}_SITE_ID`];
|
|
71
|
+
const dashboardUrl = process.env[`${prefix}_DASHBOARD_URL`];
|
|
72
|
+
const contentKey = process.env[`${prefix}_API_KEY`];
|
|
73
|
+
const previewKey = process.env[`${prefix}_PREVIEW_API_KEY`];
|
|
74
|
+
const missingVars = [];
|
|
75
|
+
if (!siteId) missingVars.push(`${prefix}_SITE_ID`);
|
|
76
|
+
if (!dashboardUrl) missingVars.push(`${prefix}_DASHBOARD_URL`);
|
|
77
|
+
let apiKey;
|
|
78
|
+
let keyType;
|
|
79
|
+
if (previewMode) {
|
|
80
|
+
apiKey = previewKey;
|
|
81
|
+
keyType = "preview";
|
|
82
|
+
if (!apiKey) {
|
|
83
|
+
missingVars.push(`${prefix}_PREVIEW_API_KEY`);
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
apiKey = contentKey || previewKey;
|
|
87
|
+
keyType = contentKey ? "content" : "preview";
|
|
88
|
+
if (!apiKey) {
|
|
89
|
+
missingVars.push(`${prefix}_API_KEY`);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (missingVars.length > 0) {
|
|
93
|
+
throw new RiverbankEnvError(
|
|
94
|
+
`Missing required environment variables for Riverbank SDK:
|
|
95
|
+
` + missingVars.map((v) => ` - ${v}`).join("\n") + `
|
|
96
|
+
|
|
97
|
+
Current settings: RIVERBANK_ENV=${process.env.RIVERBANK_ENV || "local"}, RIVERBANK_PREVIEW_MODE=${process.env.RIVERBANK_PREVIEW_MODE || "false"}`,
|
|
98
|
+
missingVars
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
validateKeyType(apiKey, keyType);
|
|
102
|
+
let baseUrl = dashboardUrl;
|
|
103
|
+
if (!baseUrl.endsWith("/api")) {
|
|
104
|
+
baseUrl = baseUrl.replace(/\/$/, "") + "/api";
|
|
105
|
+
}
|
|
106
|
+
return {
|
|
107
|
+
target,
|
|
108
|
+
previewMode,
|
|
109
|
+
siteId,
|
|
110
|
+
baseUrl,
|
|
111
|
+
apiKey,
|
|
112
|
+
keyType
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
exports.RiverbankEnvError = RiverbankEnvError; exports.isPreviewMode = isPreviewMode; exports.getRiverbankTarget = getRiverbankTarget; exports.getRiverbankEnv = getRiverbankEnv;
|
|
122
|
+
//# sourceMappingURL=chunk-2IZ6S225.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/will/Projects/Business/cms/builder/packages/sdk/dist/server/chunk-2IZ6S225.js","../../src/env.ts"],"names":[],"mappings":"AAAA;ACgDO,IAAM,kBAAA,EAAN,MAAA,QAAgC,MAAM;AAAA,EAC3C,WAAA,CACE,OAAA,EACgB,WAAA,EAChB;AACA,IAAA,KAAA,CAAM,OAAO,C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B,EAAA;AAChB,IAAA;AACR,MAAA;AACyB;AACvB;AAAA,gCAAA;AAEF,MAAA;AACF,IAAA;AACF,EAAA;AAGyB,EAAA;AAGX,EAAA;AACc,EAAA;AACA,IAAA;AAC5B,EAAA;AAEO,EAAA;AACL,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACF,EAAA;AACF;ADnK8B;AACA;AACA;AACA;AACA;AACA;AACA","file":"/Users/will/Projects/Business/cms/builder/packages/sdk/dist/server/chunk-2IZ6S225.js","sourcesContent":[null,"/**\n * Environment detection utilities for SDK\n *\n * Provides helpers for detecting preview mode and auto-selecting the correct API key.\n *\n * @example\n * ```ts\n * import { getRiverbankEnv } from '@riverbankcms/sdk/env';\n * import { createRiverbankClient } from '@riverbankcms/sdk';\n *\n * const env = getRiverbankEnv();\n * const client = createRiverbankClient({\n * apiKey: env.apiKey,\n * baseUrl: env.baseUrl,\n * });\n * ```\n */\n\n// ============================================================================\n// Types\n// ============================================================================\n\n/**\n * Environment target: 'local' for development, 'remote' for production\n */\nexport type RiverbankEnvTarget = 'local' | 'remote';\n\n/**\n * Runtime environment configuration\n */\nexport interface RiverbankEnvConfig {\n /** The detected environment target */\n target: RiverbankEnvTarget;\n /** Whether preview mode is enabled */\n previewMode: boolean;\n /** Site ID */\n siteId: string;\n /** Dashboard/API base URL */\n baseUrl: string;\n /** The auto-selected API key (preview or content key based on mode) */\n apiKey: string;\n /** The type of key being used */\n keyType: 'preview' | 'content';\n}\n\n/**\n * Error thrown when required environment variables are missing\n */\nexport class RiverbankEnvError extends Error {\n constructor(\n message: string,\n public readonly missingVars: string[]\n ) {\n super(message);\n this.name = 'RiverbankEnvError';\n }\n}\n\n// ============================================================================\n// Internal Helpers\n// ============================================================================\n\n/**\n * Get the environment variable prefix based on target\n */\nfunction getEnvPrefix(target: RiverbankEnvTarget): string {\n return target === 'remote' ? 'RIVERBANK_REMOTE' : 'RIVERBANK_LOCAL';\n}\n\n/**\n * Detect the environment target from RIVERBANK_ENV\n */\nfunction detectTarget(): RiverbankEnvTarget {\n const env = process.env.RIVERBANK_ENV?.toLowerCase();\n if (env === 'remote' || env === 'production' || env === 'prod') {\n return 'remote';\n }\n return 'local';\n}\n\n/**\n * Detect if preview mode is enabled.\n * Uses RIVERBANK_PREVIEW_MODE first, then falls back to RIVERBANK_PREVIEW for backward compat.\n */\nfunction detectPreviewMode(): boolean {\n // RIVERBANK_PREVIEW_MODE takes precedence (new convention)\n const previewMode = process.env.RIVERBANK_PREVIEW_MODE;\n if (previewMode !== undefined && previewMode !== '') {\n return previewMode === 'true';\n }\n\n // Fall back to RIVERBANK_PREVIEW (backward compatibility)\n const previewLegacy = process.env.RIVERBANK_PREVIEW;\n if (previewLegacy !== undefined && previewLegacy !== '') {\n return previewLegacy === 'true';\n }\n\n // Fall back to Vercel environment detection\n return process.env.VERCEL_ENV === 'preview';\n}\n\n/**\n * Validate that an API key matches the expected format for its type\n */\nfunction validateKeyType(key: string, expectedType: 'preview' | 'content'): void {\n const isPreviewKey = key.startsWith('bld_preview_sk_');\n const isContentKey = key.startsWith('bld_live_sk_');\n\n if (expectedType === 'preview' && !isPreviewKey) {\n if (isContentKey) {\n throw new RiverbankEnvError(\n `Preview mode is enabled (RIVERBANK_PREVIEW_MODE=true) but a content key was provided. ` +\n `Preview mode requires a preview API key (bld_preview_sk_...) to access draft content. ` +\n `Either:\\n` +\n ` 1. Set RIVERBANK_*_PREVIEW_API_KEY with your preview key, or\\n` +\n ` 2. Set RIVERBANK_PREVIEW_MODE=false to fetch published content instead.`,\n []\n );\n }\n throw new RiverbankEnvError(\n `Invalid API key format for preview mode. Expected key starting with bld_preview_sk_`,\n []\n );\n }\n\n if (expectedType === 'content' && !isContentKey) {\n if (isPreviewKey) {\n // This is actually fine - preview keys can access both draft and published content\n // Just log a note that they could use a more restrictive key\n console.debug(\n '[getRiverbankEnv] Using preview key for published content. ' +\n 'Consider using a content key (bld_live_sk_...) for production.'\n );\n return;\n }\n throw new RiverbankEnvError(\n `Invalid API key format for content access. Expected key starting with bld_live_sk_ or bld_preview_sk_`,\n []\n );\n }\n}\n\n// ============================================================================\n// Public API\n// ============================================================================\n\n/**\n * Detects if the current environment is in preview mode.\n *\n * Precedence:\n * 1. RIVERBANK_PREVIEW_MODE env var (explicit override) - 'true' or 'false'\n * 2. RIVERBANK_PREVIEW env var (legacy) - 'true' or 'false'\n * 3. VERCEL_ENV === 'preview' (Vercel preview deployments)\n * 4. Default: false (production behavior)\n *\n * In preview mode:\n * - Draft content is visible\n * - ISR revalidation is more aggressive\n * - Cache bypass may be enabled\n *\n * @returns true if in preview mode, false otherwise\n */\nexport function isPreviewMode(): boolean {\n return detectPreviewMode();\n}\n\n/**\n * Get the current environment target.\n *\n * This is a convenience function for checking `RIVERBANK_ENV`.\n *\n * @returns 'local' or 'remote'\n */\nexport function getRiverbankTarget(): RiverbankEnvTarget {\n return detectTarget();\n}\n\n/**\n * Get runtime environment configuration with automatic API key selection.\n *\n * This helper reads environment variables and automatically selects the correct\n * API key based on the current environment and preview mode:\n *\n * - When `RIVERBANK_PREVIEW_MODE=true`: Uses preview API key (bld_preview_sk_...)\n * - When `RIVERBANK_PREVIEW_MODE=false` (default): Uses content API key (bld_live_sk_...)\n *\n * Environment variable patterns:\n * - `RIVERBANK_ENV`: 'local' (default) or 'remote'\n * - `RIVERBANK_PREVIEW_MODE`: 'true' or 'false' (default)\n * - `RIVERBANK_{LOCAL|REMOTE}_SITE_ID`: Site ID\n * - `RIVERBANK_{LOCAL|REMOTE}_DASHBOARD_URL`: Dashboard URL\n * - `RIVERBANK_{LOCAL|REMOTE}_API_KEY`: Content/live API key\n * - `RIVERBANK_{LOCAL|REMOTE}_PREVIEW_API_KEY`: Preview API key\n *\n * @returns Environment configuration with auto-selected API key\n * @throws {RiverbankEnvError} If required environment variables are missing\n *\n * @example\n * ```ts\n * // lib/builder-client.ts\n * import { getRiverbankEnv } from '@riverbankcms/sdk/env';\n * import { createRiverbankClient } from '@riverbankcms/sdk';\n *\n * const env = getRiverbankEnv();\n *\n * export const client = createRiverbankClient({\n * apiKey: env.apiKey,\n * baseUrl: env.baseUrl,\n * });\n *\n * export const siteId = env.siteId;\n * ```\n */\nexport function getRiverbankEnv(): RiverbankEnvConfig {\n const target = detectTarget();\n const previewMode = detectPreviewMode();\n const prefix = getEnvPrefix(target);\n\n // Required vars\n const siteId = process.env[`${prefix}_SITE_ID`];\n const dashboardUrl = process.env[`${prefix}_DASHBOARD_URL`];\n\n // API keys - pick based on preview mode\n const contentKey = process.env[`${prefix}_API_KEY`];\n const previewKey = process.env[`${prefix}_PREVIEW_API_KEY`];\n\n // Collect missing required vars\n const missingVars: string[] = [];\n if (!siteId) missingVars.push(`${prefix}_SITE_ID`);\n if (!dashboardUrl) missingVars.push(`${prefix}_DASHBOARD_URL`);\n\n // Select the appropriate key\n let apiKey: string | undefined;\n let keyType: 'preview' | 'content';\n\n if (previewMode) {\n apiKey = previewKey;\n keyType = 'preview';\n if (!apiKey) {\n missingVars.push(`${prefix}_PREVIEW_API_KEY`);\n }\n } else {\n // For published content, prefer content key but allow preview key as fallback\n apiKey = contentKey || previewKey;\n keyType = contentKey ? 'content' : 'preview';\n if (!apiKey) {\n missingVars.push(`${prefix}_API_KEY`);\n }\n }\n\n if (missingVars.length > 0) {\n throw new RiverbankEnvError(\n `Missing required environment variables for Riverbank SDK:\\n` +\n missingVars.map((v) => ` - ${v}`).join('\\n') +\n `\\n\\nCurrent settings: RIVERBANK_ENV=${process.env.RIVERBANK_ENV || 'local'}, ` +\n `RIVERBANK_PREVIEW_MODE=${process.env.RIVERBANK_PREVIEW_MODE || 'false'}`,\n missingVars\n );\n }\n\n // Validate key type matches expected usage\n validateKeyType(apiKey!, keyType);\n\n // Construct base URL (ensure it ends with /api)\n let baseUrl = dashboardUrl!;\n if (!baseUrl.endsWith('/api')) {\n baseUrl = baseUrl.replace(/\\/$/, '') + '/api';\n }\n\n return {\n target,\n previewMode,\n siteId: siteId!,\n baseUrl,\n apiKey: apiKey!,\n keyType,\n };\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __esm = (fn, res) => function __init() {
|
|
6
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
7
|
+
};
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
exports.__esm = __esm; exports.__export = __export; exports.__toCommonJS = __toCommonJS;
|
|
27
|
+
//# sourceMappingURL=chunk-4CV4JOE5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/will/Projects/Business/cms/builder/packages/sdk/dist/server/chunk-4CV4JOE5.js"],"names":[],"mappings":"AAAA,6EAAI,UAAU,EAAE,MAAM,CAAC,cAAc;AACrC,IAAI,iBAAiB,EAAE,MAAM,CAAC,wBAAwB;AACtD,IAAI,kBAAkB,EAAE,MAAM,CAAC,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