@zweer/mage-space-client 1.3.0 → 1.4.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/README.md CHANGED
@@ -168,6 +168,41 @@ Unlike traditional REST APIs, mage.space uses Next.js Server Actions:
168
168
  - Responses use the React Server Component (RSC) "Flight" wire format
169
169
  - Action hashes change on every Vercel deploy — discovered from the page bundles (across routes) and cached, with a bundled seed for a warm start
170
170
 
171
+ ### Batched discovery (subrequest-capped hosts)
172
+
173
+ `discoverActions` fetches every discovery page and every referenced chunk in one
174
+ go. On hosts with a hard per-invocation subrequest cap — e.g. the Cloudflare
175
+ Workers free plan — that can exceed the limit. Three platform-agnostic
176
+ primitives let such a host discover hashes in bounded batches:
177
+
178
+ - `listDiscoveryChunks({ fetch, baseUrl, pages? })` — GETs only the pages
179
+ (one subrequest each, `<= pages.length`) and returns the de-duplicated,
180
+ insertion-ordered `chunkPaths` plus the `deploymentId`.
181
+ - `scrapeChunks({ fetch, baseUrl, chunkPaths })` — fetches ONLY the chunk paths
182
+ it is given (one subrequest each) and returns a partial `hashes` map that can
183
+ be merged across batches. It never throws on an empty batch.
184
+ - `requiredActionsForClient()` — the action names the portal actually invokes,
185
+ so a batched caller can early-exit once it has found all of them.
186
+
187
+ ```typescript
188
+ import {
189
+ listDiscoveryChunks,
190
+ scrapeChunks,
191
+ requiredActionsForClient,
192
+ } from '@zweer/mage-space-client';
193
+
194
+ const { chunkPaths } = await listDiscoveryChunks({ fetch, baseUrl });
195
+ const required = requiredActionsForClient();
196
+ const hashes: Record<string, string> = {};
197
+
198
+ // Process chunks in batches sized to the host's subrequest budget.
199
+ for (const batch of chunksInGroupsOf(chunkPaths, 40)) {
200
+ const partial = await scrapeChunks({ fetch, baseUrl, chunkPaths: batch });
201
+ Object.assign(hashes, partial.hashes);
202
+ if (required.every((name) => name in hashes)) break; // early-exit
203
+ }
204
+ ```
205
+
171
206
  ## Project Structure
172
207
 
173
208
  ```
package/dist/index.cjs CHANGED
@@ -125,14 +125,66 @@ var InMemoryActionCache = class {
125
125
  }
126
126
  };
127
127
  /**
128
- * Discover the current Server Action hashes by scraping the page HTML for JS
129
- * chunk URLs and extracting `createServerReference(...)` calls from each chunk.
128
+ * The action names the portal actually invokes.
130
129
  *
131
- * @throws {DiscoveryError} on network failure or when nothing is discovered.
130
+ * @remarks
131
+ * Verified against `lib/auth.ts`, `lib/generation.ts`/`lib/history.ts` (via
132
+ * `resolveActionName` on `PRODUCTION_TARGET`), `lib/characters.ts`, and
133
+ * `lib/references.ts`. A batched, subrequest-capped caller (e.g. a Cloudflare
134
+ * Worker) uses this list to know when it has discovered everything it needs and
135
+ * can early-exit without scraping the remaining chunks. Every name is a key in
136
+ * {@link SEED_SNAPSHOT}.hashes.
132
137
  */
133
- async function discoverActions(opts) {
138
+ const REQUIRED_ACTIONS = [
139
+ "createUserSession",
140
+ "getHistoryPaginated",
141
+ "getHistoryById",
142
+ "runArchitecture",
143
+ "cancelArchitectureJob",
144
+ "getCreationsPaginatedParallel",
145
+ "getMentionSuggestionsParallel",
146
+ "createCharacter",
147
+ "updateCharacter",
148
+ "deleteCharacter",
149
+ "getCharacter",
150
+ "getCharacters",
151
+ "publishCharacter",
152
+ "unpublishCharacter",
153
+ "uploadCharacterImage",
154
+ "getCharactersPaginated",
155
+ "generateCharacterVoice",
156
+ "followCharacter",
157
+ "unfollowCharacter",
158
+ "uploadReferenceImage",
159
+ "createReference",
160
+ "updateReference",
161
+ "deleteReference",
162
+ "getReferences",
163
+ "getReferencesPaginated"
164
+ ];
165
+ /**
166
+ * The action names a batched discovery caller must find before it can stop.
167
+ *
168
+ * @remarks
169
+ * These are the actions the portal invokes; once a batched caller has hashes for
170
+ * all of them it can early-exit instead of scraping every remaining chunk.
171
+ */
172
+ function requiredActionsForClient() {
173
+ return [...REQUIRED_ACTIONS];
174
+ }
175
+ /**
176
+ * List the JS chunk paths referenced by the discovery pages.
177
+ *
178
+ * @remarks
179
+ * Issues at most one GET per page (`<= pages.length` subrequests), so a caller on
180
+ * a subrequest-capped host (e.g. Cloudflare Workers free plan) can list chunks
181
+ * cheaply and then scrape them in bounded batches via {@link scrapeChunks}.
182
+ *
183
+ * @throws {DiscoveryError} when no JS chunk references are found.
184
+ */
185
+ async function listDiscoveryChunks(opts) {
134
186
  const { fetch, baseUrl } = opts;
135
- const pages = opts.discoveryPath !== void 0 ? [opts.discoveryPath] : opts.discoveryPaths ?? DISCOVERY_PAGES;
187
+ const pages = opts.pages ?? DISCOVERY_PAGES;
136
188
  let deploymentId = "";
137
189
  const chunkPaths = /* @__PURE__ */ new Set();
138
190
  for (const page of pages) {
@@ -151,8 +203,26 @@ async function discoverActions(opts) {
151
203
  }
152
204
  }
153
205
  if (chunkPaths.size === 0) throw new DiscoveryError("No JS chunk references found in discovery pages");
206
+ return {
207
+ deploymentId,
208
+ chunkPaths: [...chunkPaths]
209
+ };
210
+ }
211
+ /**
212
+ * Scrape a specific set of JS chunks for `createServerReference(...)` hashes.
213
+ *
214
+ * @remarks
215
+ * Fetches ONLY the passed `chunkPaths` (one subrequest each), so a caller can
216
+ * process chunks in batches sized to its subrequest budget and merge the partial
217
+ * hash maps across batches. First hash wins per function name, mirroring
218
+ * {@link discoverActions}. Never throws on an empty result — a single batch may
219
+ * legitimately find nothing.
220
+ */
221
+ async function scrapeChunks(opts) {
222
+ const { fetch, baseUrl, chunkPaths } = opts;
223
+ let deploymentId = "";
154
224
  const hashes = {};
155
- await Promise.all([...chunkPaths].map(async (path) => {
225
+ await Promise.all(chunkPaths.map(async (path) => {
156
226
  try {
157
227
  const chunkRes = await fetch(`${baseUrl}${path}`, { headers: { accept: "application/javascript" } });
158
228
  if (!chunkRes.ok) return;
@@ -165,9 +235,37 @@ async function discoverActions(opts) {
165
235
  }
166
236
  } catch {}
167
237
  }));
168
- if (Object.keys(hashes).length === 0) throw new DiscoveryError("No server action hashes discovered in JS chunks");
169
238
  return {
170
239
  deploymentId,
240
+ hashes
241
+ };
242
+ }
243
+ /**
244
+ * Discover the current Server Action hashes by scraping the page HTML for JS
245
+ * chunk URLs and extracting `createServerReference(...)` calls from each chunk.
246
+ *
247
+ * @remarks
248
+ * Composes {@link listDiscoveryChunks} (page GETs) and {@link scrapeChunks} (over
249
+ * all discovered chunks) into the full snapshot. Unsuitable for subrequest-capped
250
+ * hosts, which should batch {@link scrapeChunks} instead.
251
+ *
252
+ * @throws {DiscoveryError} on network failure or when nothing is discovered.
253
+ */
254
+ async function discoverActions(opts) {
255
+ const { fetch, baseUrl } = opts;
256
+ const { deploymentId: pageDeploymentId, chunkPaths } = await listDiscoveryChunks({
257
+ fetch,
258
+ baseUrl,
259
+ pages: opts.discoveryPath !== void 0 ? [opts.discoveryPath] : opts.discoveryPaths ?? DISCOVERY_PAGES
260
+ });
261
+ const { deploymentId: chunkDeploymentId, hashes } = await scrapeChunks({
262
+ fetch,
263
+ baseUrl,
264
+ chunkPaths
265
+ });
266
+ if (Object.keys(hashes).length === 0) throw new DiscoveryError("No server action hashes discovered in JS chunks");
267
+ return {
268
+ deploymentId: pageDeploymentId !== "" ? pageDeploymentId : chunkDeploymentId,
171
269
  hashes,
172
270
  discoveredAt: Date.now()
173
271
  };
@@ -1670,8 +1768,11 @@ exports.StaleActionError = StaleActionError;
1670
1768
  exports.TimeoutError = TimeoutError;
1671
1769
  exports.VERSION = VERSION;
1672
1770
  exports.discoverActions = discoverActions;
1771
+ exports.listDiscoveryChunks = listDiscoveryChunks;
1673
1772
  exports.parseFlightRows = parseFlightRows;
1674
1773
  exports.parseServerActionResponse = parseServerActionResponse;
1774
+ exports.requiredActionsForClient = requiredActionsForClient;
1675
1775
  exports.resolveActionName = resolveActionName;
1676
1776
  exports.resolveFlightValue = resolveFlightValue;
1777
+ exports.scrapeChunks = scrapeChunks;
1677
1778
  exports.unwrapResult = unwrapResult;
package/dist/index.d.cts CHANGED
@@ -28,7 +28,7 @@ interface Target {
28
28
  readonly pollStrategy: PollStrategy;
29
29
  }
30
30
  /** Resolve a logical action to its host-specific wire name (identity if unlisted). */
31
- declare function resolveActionName(target: Target, logical: LogicalAction): string;
31
+ export declare function resolveActionName(target: Target, logical: LogicalAction): string;
32
32
  /**
33
33
  * Production target.
34
34
  *
@@ -41,14 +41,14 @@ declare function resolveActionName(target: Target, logical: LogicalAction): stri
41
41
  * than empty so production behaviour is reproduced exactly regardless of the
42
42
  * logical-name vocabulary.
43
43
  */
44
- declare const PRODUCTION_TARGET: Target;
44
+ export declare const PRODUCTION_TARGET: Target;
45
45
  /**
46
46
  * Beta target. Beta facts are assumptions pending a reverse-engineering capture
47
47
  * under `docs/api/beta` — treat them as unverified until that doc lands.
48
48
  */
49
- declare const BETA_TARGET: Target;
49
+ export declare const BETA_TARGET: Target;
50
50
  /** Default ordered fallback chain: production first, then beta. */
51
- declare const DEFAULT_TARGET_CHAIN: readonly Target[];
51
+ export declare const DEFAULT_TARGET_CHAIN: readonly Target[];
52
52
  //#endregion
53
53
  //#region lib/types.d.ts
54
54
  /** Minimal `fetch` signature the client depends on (injectable for tests). */
@@ -526,7 +526,7 @@ interface VoiceResult {
526
526
  //#endregion
527
527
  //#region lib/actions.d.ts
528
528
  /** Default in-process snapshot cache. */
529
- declare class InMemoryActionCache implements ActionCache {
529
+ export declare class InMemoryActionCache implements ActionCache {
530
530
  private snapshot;
531
531
  load(): Promise<ActionSnapshot | null>;
532
532
  save(snapshot: ActionSnapshot): Promise<void>;
@@ -539,13 +539,66 @@ interface DiscoveryOptions {
539
539
  /** Pages to scrape and union (default: the main app routes). */
540
540
  discoveryPaths?: string[];
541
541
  }
542
+ /** Result of {@link listDiscoveryChunks}: the JS chunk paths to scrape. */
543
+ interface ChunkListResult {
544
+ /** Vercel deployment id from the first page's `x-deployment-id` (`''` if none). */
545
+ deploymentId: string;
546
+ /** De-duplicated, insertion-ordered `/_next/static/chunks/*.js` paths. */
547
+ chunkPaths: string[];
548
+ }
549
+ /**
550
+ * The action names a batched discovery caller must find before it can stop.
551
+ *
552
+ * @remarks
553
+ * These are the actions the portal invokes; once a batched caller has hashes for
554
+ * all of them it can early-exit instead of scraping every remaining chunk.
555
+ */
556
+ export declare function requiredActionsForClient(): ActionName[];
557
+ /**
558
+ * List the JS chunk paths referenced by the discovery pages.
559
+ *
560
+ * @remarks
561
+ * Issues at most one GET per page (`<= pages.length` subrequests), so a caller on
562
+ * a subrequest-capped host (e.g. Cloudflare Workers free plan) can list chunks
563
+ * cheaply and then scrape them in bounded batches via {@link scrapeChunks}.
564
+ *
565
+ * @throws {DiscoveryError} when no JS chunk references are found.
566
+ */
567
+ export declare function listDiscoveryChunks(opts: {
568
+ fetch: FetchLike;
569
+ baseUrl: string;
570
+ pages?: string[];
571
+ }): Promise<ChunkListResult>;
572
+ /**
573
+ * Scrape a specific set of JS chunks for `createServerReference(...)` hashes.
574
+ *
575
+ * @remarks
576
+ * Fetches ONLY the passed `chunkPaths` (one subrequest each), so a caller can
577
+ * process chunks in batches sized to its subrequest budget and merge the partial
578
+ * hash maps across batches. First hash wins per function name, mirroring
579
+ * {@link discoverActions}. Never throws on an empty result — a single batch may
580
+ * legitimately find nothing.
581
+ */
582
+ export declare function scrapeChunks(opts: {
583
+ fetch: FetchLike;
584
+ baseUrl: string;
585
+ chunkPaths: string[];
586
+ }): Promise<{
587
+ deploymentId: string;
588
+ hashes: ActionHashes;
589
+ }>;
542
590
  /**
543
591
  * Discover the current Server Action hashes by scraping the page HTML for JS
544
592
  * chunk URLs and extracting `createServerReference(...)` calls from each chunk.
545
593
  *
594
+ * @remarks
595
+ * Composes {@link listDiscoveryChunks} (page GETs) and {@link scrapeChunks} (over
596
+ * all discovered chunks) into the full snapshot. Unsuitable for subrequest-capped
597
+ * hosts, which should batch {@link scrapeChunks} instead.
598
+ *
546
599
  * @throws {DiscoveryError} on network failure or when nothing is discovered.
547
600
  */
548
- declare function discoverActions(opts: DiscoveryOptions): Promise<ActionSnapshot>;
601
+ export declare function discoverActions(opts: DiscoveryOptions): Promise<ActionSnapshot>;
549
602
  interface ActionRegistryOptions {
550
603
  fetch: FetchLike;
551
604
  baseUrl: string;
@@ -560,7 +613,7 @@ interface ActionRegistryOptions {
560
613
  * Serves action hashes from a warm seed / pluggable cache, discovering lazily and
561
614
  * refreshing on staleness. Concurrent refreshes are de-duplicated (single-flight).
562
615
  */
563
- declare class ActionRegistry {
616
+ export declare class ActionRegistry {
564
617
  private readonly fetch;
565
618
  private readonly baseUrl;
566
619
  private readonly cache;
@@ -652,7 +705,7 @@ declare class AuthManager {
652
705
  }
653
706
  //#endregion
654
707
  //#region lib/characters.d.ts
655
- declare class CharactersService {
708
+ export declare class CharactersService {
656
709
  private readonly http;
657
710
  private readonly auth;
658
711
  constructor(http: HttpClient, auth: AuthManager);
@@ -708,7 +761,7 @@ declare class CharactersService {
708
761
  }
709
762
  //#endregion
710
763
  //#region lib/references.d.ts
711
- declare class ReferencesService {
764
+ export declare class ReferencesService {
712
765
  private readonly http;
713
766
  private readonly auth;
714
767
  constructor(http: HttpClient, auth: AuthManager);
@@ -740,7 +793,7 @@ declare class ReferencesService {
740
793
  }
741
794
  //#endregion
742
795
  //#region lib/client.d.ts
743
- declare class MageSpaceClient {
796
+ export declare class MageSpaceClient {
744
797
  private readonly auth;
745
798
  private readonly chain;
746
799
  private readonly auto;
@@ -817,19 +870,19 @@ declare class MageSpaceClient {
817
870
  //#region lib/errors.d.ts
818
871
  /** Typed error hierarchy for the mage.space client. */
819
872
  /** Base class for every error thrown by this library. */
820
- declare class MageSpaceError extends Error {
873
+ export declare class MageSpaceError extends Error {
821
874
  constructor(message: string, options?: {
822
875
  cause?: unknown;
823
876
  });
824
877
  }
825
878
  /** Authentication failures (token refresh, session creation). */
826
- declare class AuthError extends MageSpaceError {
879
+ export declare class AuthError extends MageSpaceError {
827
880
  constructor(message: string, options?: {
828
881
  cause?: unknown;
829
882
  });
830
883
  }
831
884
  /** Action-hash discovery failures (page/chunk fetch, empty registry). */
832
- declare class DiscoveryError extends MageSpaceError {
885
+ export declare class DiscoveryError extends MageSpaceError {
833
886
  /**
834
887
  * `true` when the action name was absent even after a forced re-discovery
835
888
  * (a fallback trigger); `false` for scrape failures (no chunks/no hashes).
@@ -844,7 +897,7 @@ declare class DiscoveryError extends MageSpaceError {
844
897
  * A required action is unavailable on the active host (a persistent 404 / HTML
845
898
  * fallback that survived one in-place re-discovery). A fallback trigger.
846
899
  */
847
- declare class ActionUnavailableError extends MageSpaceError {
900
+ export declare class ActionUnavailableError extends MageSpaceError {
848
901
  readonly action: string;
849
902
  readonly targetKey: string;
850
903
  constructor(action: string, targetKey: string, options?: {
@@ -858,27 +911,27 @@ declare class ActionUnavailableError extends MageSpaceError {
858
911
  * The current signal for a definitively unavailable action is
859
912
  * {@link ActionUnavailableError}.
860
913
  */
861
- declare class StaleActionError extends MageSpaceError {
914
+ export declare class StaleActionError extends MageSpaceError {
862
915
  readonly action: string;
863
916
  constructor(action: string, options?: {
864
917
  cause?: unknown;
865
918
  });
866
919
  }
867
920
  /** Failures while submitting or polling a generation job. */
868
- declare class GenerationError extends MageSpaceError {
921
+ export declare class GenerationError extends MageSpaceError {
869
922
  readonly code?: number | undefined;
870
923
  constructor(message: string, code?: number | undefined, options?: {
871
924
  cause?: unknown;
872
925
  });
873
926
  }
874
927
  /** Failure to parse a React Server Component (RSC) wire response. */
875
- declare class RscParseError extends MageSpaceError {
928
+ export declare class RscParseError extends MageSpaceError {
876
929
  constructor(message: string, options?: {
877
930
  cause?: unknown;
878
931
  });
879
932
  }
880
933
  /** A wait/poll operation exceeded its deadline or was aborted. */
881
- declare class TimeoutError extends MageSpaceError {
934
+ export declare class TimeoutError extends MageSpaceError {
882
935
  constructor(message: string, options?: {
883
936
  cause?: unknown;
884
937
  });
@@ -897,15 +950,15 @@ declare class TimeoutError extends MageSpaceError {
897
950
  * position/length aware so length-delimited rows are consumed exactly and every
898
951
  * subsequent row stays isolated.
899
952
  */
900
- declare function parseFlightRows(text: string): Map<string, unknown>;
953
+ export declare function parseFlightRows(text: string): Map<string, unknown>;
901
954
  /** Recursively resolve Flight sentinels/references within a parsed value. */
902
- declare function resolveFlightValue(value: unknown, rows: Map<string, unknown>, seen?: Set<string>): unknown;
955
+ export declare function resolveFlightValue(value: unknown, rows: Map<string, unknown>, seen?: Set<string>): unknown;
903
956
  /**
904
957
  * Parse a Server Action response and return the action's resolved return value.
905
958
  *
906
959
  * @throws {RscParseError} when the response contains no parseable rows.
907
960
  */
908
- declare function parseServerActionResponse<T = unknown>(text: string): T;
961
+ export declare function parseServerActionResponse<T = unknown>(text: string): T;
909
962
  /**
910
963
  * Unwrap a single-object result that some Server Actions (notably the
911
964
  * `*Parallel` family) wrap in a one-element array.
@@ -917,7 +970,7 @@ declare function parseServerActionResponse<T = unknown>(text: string): T;
917
970
  * a no-op when the response is already the object. Do NOT use it for actions whose
918
971
  * genuine return type is an array (e.g. `getReferences`).
919
972
  */
920
- declare function unwrapResult<T>(value: unknown): T;
973
+ export declare function unwrapResult<T>(value: unknown): T;
921
974
  //#endregion
922
975
  //#region lib/seed.d.ts
923
976
  /**
@@ -929,11 +982,11 @@ declare function unwrapResult<T>(value: unknown): T;
929
982
  * Hashes change on every deploy; when one goes stale the client re-discovers
930
983
  * automatically (404 → invalidate → refresh).
931
984
  */
932
- declare const SEED_SNAPSHOT: ActionSnapshot;
985
+ export declare const SEED_SNAPSHOT: ActionSnapshot;
933
986
  //#endregion
934
987
  //#region lib/index.d.ts
935
988
  /** Public entry point for `@zweer/mage-space-client`. */
936
- declare const VERSION = "0.0.0";
989
+ export declare const VERSION = "0.0.0";
937
990
  //#endregion
938
- export { type ActionCache, type ActionHashes, type ActionName, ActionRegistry, type ActionSnapshot, ActionUnavailableError, type ArchitectureConfig, type AspectRatio, AuthError, type AuthTokens, BETA_TARGET, type Character, type CharacterPage, type CharacterRef, type CharacterSearchResult, CharactersService, type ConfirmOptions, type CreateCharacterInput, type CreateReferenceInput, type Creation, type CreationPage, DEFAULT_TARGET_CHAIN, DiscoveryError, type FallbackOptions, type FetchLike, type GenerateOptions, type GenerateVideoOptions, type GenerateVoiceOptions, GenerationError, type GenerationMode, type GenerationResult, type HistoryItem, type HistoryPage, InMemoryActionCache, type JobStatus, type ListCharactersOptions, type ListCreationsOptions, type ListHistoryOptions, type ListReferencesOptions, type LogicalAction, MageSpaceClient, type MageSpaceClientOptions, MageSpaceError, type Modality, PRODUCTION_TARGET, type PollStrategy, type Reference, type ReferenceOrder, type ReferencePage, type ReferenceVariant, ReferencesService, type Resolution, RscParseError, SEED_SNAPSHOT, type SearchCharactersOptions, type SessionState, StaleActionError, type Target, type TargetKey, TimeoutError, type UpdateCharacterInput, type UpdateReferenceInput, VERSION, type VideoArchitectureConfig, type VideoAspectRatio, type VideoResolution, type Visibility, type VoiceResult, type WaitOptions, discoverActions, parseFlightRows, parseServerActionResponse, resolveActionName, resolveFlightValue, unwrapResult };
991
+ export type { ActionCache, ActionHashes, ActionName, ActionSnapshot, ArchitectureConfig, AspectRatio, AuthTokens, Character, CharacterPage, CharacterRef, CharacterSearchResult, ChunkListResult, ConfirmOptions, CreateCharacterInput, CreateReferenceInput, Creation, CreationPage, FallbackOptions, FetchLike, GenerateOptions, GenerateVideoOptions, GenerateVoiceOptions, GenerationMode, GenerationResult, HistoryItem, HistoryPage, JobStatus, ListCharactersOptions, ListCreationsOptions, ListHistoryOptions, ListReferencesOptions, LogicalAction, MageSpaceClientOptions, Modality, PollStrategy, Reference, ReferenceOrder, ReferencePage, ReferenceVariant, Resolution, SearchCharactersOptions, SessionState, Target, TargetKey, UpdateCharacterInput, UpdateReferenceInput, VideoArchitectureConfig, VideoAspectRatio, VideoResolution, Visibility, VoiceResult, WaitOptions };
939
992
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../lib/targets.ts","../lib/types.ts","../lib/actions.ts","../lib/http.ts","../lib/auth.ts","../lib/characters.ts","../lib/references.ts","../lib/client.ts","../lib/errors.ts","../lib/rsc.ts","../lib/seed.ts","../lib/index.ts"],"mappings":";;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iBAAiB;IAAY;;;;;;;;;;;;;;;;;iBCjC3B,gBAAgB,eAAe;;iBAmE/B,mBACd,gBACA,MAAM,sBACN,OAAM;;;;;;iBAqDQ,0BAA0B,aAAa,eAAe;;;;;;;;;;;;iBA8BtD,aAAa,GAAG,iBAAiB;;;;;;;;;;;;cCpMpC,eAAe;;;;cCVf"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../lib/targets.ts","../lib/types.ts","../lib/actions.ts","../lib/http.ts","../lib/auth.ts","../lib/characters.ts","../lib/references.ts","../lib/client.ts","../lib/errors.ts","../lib/rsc.ts","../lib/seed.ts","../lib/index.ts"],"mappings":";;;;;;;;;;;;KAYY;;KAGA;;;;;;KAOA;;UAQK;WACN,KAAK;WACL;;WAEA,aAAa,SAAS,QAAQ,OAAO;WACrC,cAAc;;;wBAIT,kBAAkB,QAAQ,QAAQ,SAAS;;;;;;;;;;;;;qBAgB9C,mBAAmB;;;;;qBAiBnB,aAAa;;qBAkBb,+BAA+B;;;;KC/EhC,aAAa,eAAe,OAAO,gBAAgB,QAAQ;;UAOtD;;EAEf;;EAEA;;EAEA;;EAEA;;;UAIe;;EAEf;;EAEA;;;KAQU;;KAoCA,eAAe;;UAGV;;EAEf;;EAEA,QAAQ;;EAER;;;;;;;;;;UAWe;EACf,QAAQ,QAAQ;EAChB,KAAK,UAAU,iBAAiB;;KAOtB;KACA;;KAEA;;KAEA;;UAGK;EACf;EACA;EACA;EACA;;EAEA;;;UAIe;EACf;EACA;EACA;EACA;EACA;EACA;EACA,eAAe;;EAEf;EACA;EACA,YAAY;EACZ;EACA;;EAEA;;;UAIe;EACf;IACE;IACA;IACA;IACA;IACA;IACA;MAAe;MAAkB;;;EAEnC;EACA;;;UAIe;EACf;EACA;EACA,QAAQ;EACR;EACA;EACA;EACA,QAAQ;EACR;EACA,sBAAsB;EACtB;EACA;EACA;GACC;;;UAIc;EACf,WAAW;EACX;;UAOe;;EAEf;;EAEA,QAAQ;;EAER,QAAQ;;EAER;;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