@mountaya/client 0.0.0-stage → 0.1.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.
Files changed (96) hide show
  1. package/CHANGELOG.md +104 -0
  2. package/LICENCE.fr.txt +280 -0
  3. package/LICENSE.txt +262 -0
  4. package/README.md +1260 -2
  5. package/dist/admin/index.cjs +3521 -0
  6. package/dist/admin/index.cjs.map +1 -0
  7. package/dist/admin/index.d.cts +1070 -0
  8. package/dist/admin/index.d.ts +1070 -0
  9. package/dist/admin/index.js +301 -0
  10. package/dist/admin/index.js.map +1 -0
  11. package/dist/browser.cjs +8073 -0
  12. package/dist/browser.cjs.map +1 -0
  13. package/dist/browser.d.cts +106 -0
  14. package/dist/browser.d.ts +106 -0
  15. package/dist/browser.js +53 -0
  16. package/dist/browser.js.map +1 -0
  17. package/dist/chunk-BM526BHG.js +342 -0
  18. package/dist/chunk-BM526BHG.js.map +1 -0
  19. package/dist/chunk-D2YEVTG7.js +327 -0
  20. package/dist/chunk-D2YEVTG7.js.map +1 -0
  21. package/dist/chunk-OHKVUREN.js +3500 -0
  22. package/dist/chunk-OHKVUREN.js.map +1 -0
  23. package/dist/chunk-TDTK2L5H.js +3842 -0
  24. package/dist/chunk-TDTK2L5H.js.map +1 -0
  25. package/dist/coreOperations.gen-BMYPoBbz.d.ts +1760 -0
  26. package/dist/coreOperations.gen-BxX5xRxw.d.cts +1760 -0
  27. package/dist/errors-B-GqAtQv.d.cts +75960 -0
  28. package/dist/errors-B-GqAtQv.d.ts +75960 -0
  29. package/dist/events/index.cjs +1972 -0
  30. package/dist/events/index.cjs.map +1 -0
  31. package/dist/events/index.d.cts +781 -0
  32. package/dist/events/index.d.ts +781 -0
  33. package/dist/events/index.js +826 -0
  34. package/dist/events/index.js.map +1 -0
  35. package/dist/index.cjs +8072 -0
  36. package/dist/index.cjs.map +1 -0
  37. package/dist/index.d.cts +76 -0
  38. package/dist/index.d.ts +76 -0
  39. package/dist/index.js +52 -0
  40. package/dist/index.js.map +1 -0
  41. package/dist/operations.gen-CvTyzKNF.d.cts +3993 -0
  42. package/dist/operations.gen-DUD406TV.d.ts +3993 -0
  43. package/package.json +127 -4
  44. package/src/admin/index.ts +47 -0
  45. package/src/admin/rules/mountayaAdmin.ts +102 -0
  46. package/src/browser.ts +232 -0
  47. package/src/core/engines/sessionToken.ts +870 -0
  48. package/src/core/rules/auth.ts +1017 -0
  49. package/src/core/rules/clientHeader.ts +28 -0
  50. package/src/core/rules/dates.ts +200 -0
  51. package/src/core/rules/decode.ts +154 -0
  52. package/src/core/rules/envelope.ts +41 -0
  53. package/src/core/rules/errors.ts +1486 -0
  54. package/src/core/rules/graphql.ts +576 -0
  55. package/src/core/rules/headerValue.ts +42 -0
  56. package/src/core/rules/idempotencyKey.ts +64 -0
  57. package/src/core/rules/nullMask.ts +127 -0
  58. package/src/core/rules/nullMasks.gen.ts +416 -0
  59. package/src/core/rules/paginate.ts +316 -0
  60. package/src/core/rules/rateLimit.ts +507 -0
  61. package/src/core/rules/redaction.ts +219 -0
  62. package/src/core/rules/resourceRef.ts +110 -0
  63. package/src/core/rules/responseBody.ts +492 -0
  64. package/src/core/rules/retry.ts +386 -0
  65. package/src/core/rules/selection.ts +416 -0
  66. package/src/core/rules/sessionAnswer.ts +90 -0
  67. package/src/core/rules/sessionSchedule.ts +131 -0
  68. package/src/core/rules/sessionWait.ts +112 -0
  69. package/src/core/rules/transport.ts +2386 -0
  70. package/src/core/rules/version.gen.ts +16 -0
  71. package/src/core/rules/webAddress.ts +165 -0
  72. package/src/core/rules/webAddresses.gen.ts +30 -0
  73. package/src/data/operations.gen.ts +603 -0
  74. package/src/data/schema.gen.ts +8078 -0
  75. package/src/data/selection.gen.ts +472 -0
  76. package/src/events/index.ts +67 -0
  77. package/src/events/rules/agent.ts +439 -0
  78. package/src/events/rules/collab.ts +554 -0
  79. package/src/events/rules/collabNulls.gen.ts +17 -0
  80. package/src/events/rules/eventStream.ts +94 -0
  81. package/src/events/rules/openSseStream.ts +594 -0
  82. package/src/events/rules/sse.ts +349 -0
  83. package/src/index.ts +231 -0
  84. package/src/rest/adminOperations.gen.ts +70 -0
  85. package/src/rest/adminResources.gen.ts +136 -0
  86. package/src/rest/coreOperations.gen.ts +74 -0
  87. package/src/rest/coreResources.gen.ts +244 -0
  88. package/src/rest/dates.gen.ts +217 -0
  89. package/src/rest/operations.gen.ts +4341 -0
  90. package/src/rest/resources.gen.ts +369 -0
  91. package/src/rest/schema.gen.ts +56840 -0
  92. package/src/tiles/operations.gen.ts +206 -0
  93. package/src/tiles/schema.gen.ts +8408 -0
  94. package/src/webhooks/rules/constructWebhookEvent.ts +482 -0
  95. package/src/webhooks/rules/webhookEvent.ts +38 -0
  96. package/src/webhooks/rules/webhookEvents.gen.ts +732 -0
@@ -0,0 +1,106 @@
1
+ export { Geometry } from 'geojson';
2
+ import { ba as PublishableCredential, bb as ShareCredential, bc as CookieCredential } from './errors-B-GqAtQv.cjs';
3
+ import { ClientOptions, MountayaTransport as MountayaTransport$1 } from './index.cjs';
4
+ export { bd as AcceptedResponse, be as Activity, bf as ActivityCapabilities, bg as ActivitySlug, bh as AgentAwaitingInputEvent, bi as AgentBudgetDimension, bj as AgentBudgetExhaustedEvent, bk as AgentChecksUnmetEvent, bl as AgentClientToolManifest, bm as AgentCloseInput, bn as AgentConfirmInput, bo as AgentConfirmRequiredEvent, bp as AgentDoneEvent, bq as AgentErrorCode, br as AgentErrorEvent, bs as AgentManifestUpdateInput, bt as AgentMessageDeltaEvent, bu as AgentMessageEvent, bv as AgentReconnectEvent, bw as AgentRun, bx as AgentRunCreateParams, by as AgentRunEvent, bz as AgentRunEventType, bA as AgentRunFeedbackParams, bB as AgentRunFeedbackRating, bC as AgentRunInputParams, bD as AgentRunInputType, bE as AgentRunProfile, bF as AgentRunReason, bG as AgentToolAbandonedEvent, bH as AgentToolAbandonedReason, bI as AgentToolCallEvent, bJ as AgentToolCallTarget, bK as AgentToolErrorCode, bL as AgentToolResultEvent, bM as AgentToolResultInput, bN as AgentUserMessageInput, bO as AnalyzeGeometryResult, bP as ApiErrorDetails, bQ as BadRequestResponse, bR as BaseUrlOverrides, bS as BinaryBody, bT as Boundaries, bU as CategoryActivities, bV as CategoryOverlays, bW as CollabChangeAction, bX as CollabChangeKind, bY as CollabCollectionChangedEvent, bZ as CollabCursorEvent, b_ as CollabCursorSignal, b$ as CollabDraftClearEvent, c0 as CollabDraftClearSignal, c1 as CollabDraftUpdateEvent, c2 as CollabDraftUpdateSignal, c3 as CollabEntity, c4 as CollabEntityKind, c5 as CollabItineraryChangedEvent, c6 as CollabLock, c7 as CollabLockAcquireSignal, c8 as CollabLockAcquiredEvent, c9 as CollabLockReleaseSignal, ca as CollabLockReleasedEvent, cb as CollabLockSnapshotEvent, cc as CollabMember, cd as CollabPosition, ce as CollabPresenceJoinEvent, cf as CollabPresenceLeaveEvent, cg as CollabPresenceSnapshotEvent, ch as CollabReconnectEvent, ci as CollabSegmentChangedEvent, cj as CollabSelectionEvent, ck as CollabSelectionKind, cl as CollabSelectionRef, cm as CollabSelectionSignal, cn as CollabSignalParams, co as CollabSignalType, cp as CollabStreamEvent, cq as CollabStreamEventType, cr as CollabWaypointChangedEvent, cs as CollabZoneChangedEvent, ct as Collection, cu as CollectionCount, cv as CollectionCreateParams, cw as CollectionItinerariesAddParams, cx as CollectionItineraryUpdateParams, cy as CollectionUpdateParams, cz as CollectionZonesAddParams, cA as ConflictMetadata, cB as ConflictResponse, cC as CreatedResponse, cD as DataSchema, cE as DateMask, cF as DirectionsResult, cG as Elevation, cH as ElevationTileSize, cI as EmbeddedStudioDefaultProps, cJ as EmbeddedStudioSafetyRules, cK as EmbeddedStudioTheme, cL as EmbeddedStudioThemeColors, cM as ErrorCode, cN as ErrorEntry, cO as ErrorMetadata, cP as Errors, cQ as ExportFormat, cR as ExportItineraryResult, cS as ExportVariant, cT as ForbiddenResponse, cU as GatewayTimeoutResponse, cV as GeoJSONGeometry, cW as GeoJSONGeometryCollection, cX as GeoJSONLineString, cY as GeoJSONMultiLineString, cZ as GeoJSONMultiPoint, c_ as GeoJSONMultiPolygon, c$ as GeoJSONPoint, d0 as GeoJSONPolygon, d1 as GeocodeResult, d2 as HTTPError, d3 as IdempotentAnswer, d4 as IdempotentReplayed, d5 as ImportGranularity, d6 as ImportProvider, d7 as ImportRecommendationReason, d8 as ImportWarning, d9 as InternalErrorResponse, da as IsochronesResult, db as Itinerary, dc as ItineraryCount, dd as ItineraryCreateParams, de as ItineraryDirectionsStep, df as ItineraryDuplicateParams, dg as ItineraryImportConfirmParams, dh as ItineraryImportConfirmSegment, di as ItineraryImportConfirmWaypoint, dj as ItineraryImportPreview, dk as ItineraryPace, dl as ItineraryPaceSegment, dm as ItineraryResult, dn as ItinerarySegment, dp as ItinerarySegmentGroup, dq as ItineraryStatus, dr as ItineraryUpdateParams, ds as ItineraryWaypoint, dt as ItineraryWithDetails, du as Language, dv as Layers, dw as LimitKey, dx as ListMetadata, dy as LocaleMap, dz as Locales, dA as ManeuverType, dB as MatrixResult, dC as MountayaApiError, dD as MountayaAuthenticationError, dE as MountayaBadRequestError, dF as MountayaBillingError, dG as MountayaConfigurationError, dH as MountayaConflictError, dI as MountayaConnectionError, dJ as MountayaDataError, M as MountayaError, dK as MountayaForbiddenError, dL as MountayaIdempotencyKeyInUseError, dM as MountayaIdempotentAnswerUnavailableError, dN as MountayaMethodNotAllowedError, dO as MountayaNotFoundError, dP as MountayaPayloadTooLargeError, dQ as MountayaPreconditionFailedError, dR as MountayaRateLimitError, dS as MountayaServerError, dT as NotFoundResponse, dU as OkResponse, dV as Organization, dW as OrganizationLookupParams, dX as OrganizationRole, dY as OrganizationSettings, dZ as Overlay, d_ as OverlayCapabilities, d$ as OverlayContentType, e0 as OverlaySupportedCapabilities, e1 as PAYMENT_REQUIRED_CODE, e2 as PaginationMetadata, e3 as PayloadTooLargeResponse, e4 as PaymentRequiredResponse, e5 as PoisResult, e6 as ProposedCandidate, e7 as ProposedSegment, e8 as ProposedWaypoint, e9 as RangeType, ea as RateLimitInfo, eb as RateLimitPolicy, ec as ReadSurface, ed as RelationToUser, ee as RequestArgs, ef as RequestOptions, eg as ResponseMetadataCreatedPart, eh as ResponseMetadataIdempotentAnswer, ei as ResponseMetadataLimitReached, ej as ResponseMetadataLockConflict, ek as ResponseMetadataPatchCollection, el as ResponseMetadataPatchItinerary, em as ResponseMetadataPatchZone, en as ResponseMetadataPostCollection, eo as ResponseMetadataPostItinerary, ep as ResponseMetadataPostZone, eq as ResponseReport, er as RestSchema, es as RetryOptions, et as ReverseGeocodeResult, eu as RoadAccessInfo, ev as RoadAccessRestrictionType, ew as SearchResult, ex as SegmentConvertParams, ey as SegmentCreateParams, ez as SegmentGroupCreateParams, eA as SegmentGroupUpdateParams, eB as SegmentMode, eC as SegmentSplitParams, eD as SegmentUpdateParams, eE as ServiceUnavailableResponse, eF as Session, eG as SessionSurface, eH as SessionTokenEngine, eI as SessionTokenEngineOptions, eJ as SessionTokenSnapshot, eK as SessionTokenSource, eL as ShareLink, eM as SlopeInfo, eN as SpeedInfo, eO as StreamReconnectReason, eP as StreamSeam, eQ as StudioEntitlement, eR as SuccessExtensions, eS as SuggestionsResult, eT as Surface, eU as SurfaceInfo, eV as SurfaceType, eW as Terrain, eX as TerrainGridResult, eY as TerrainProfileResult, eZ as TerrainSamplesResult, e_ as TerrainTileSize, e$ as TerrainVariant, f0 as TerrainVariantAsStyle, f1 as TerrainVariantAsTiles, f2 as TerrainVariantConfig, f3 as TerrainVariants, f4 as Theme, f5 as TileLayer, f6 as TileLayerType, f7 as TileLegend, f8 as TileLegendKind, f9 as TileLegendStep, fa as TileSchema, fb as TileSource, fc as TileSourceSize, fd as TileSourceType, fe as TooManyRequestsResponse, ff as TrailDifficultyInfo, fg as TrailDifficultyType, fh as UnauthorizedResponse, fi as UnitLegend, fj as UnitLength, fk as UnitPace, fl as UnitSlope, fm as UnitTemperature, fn as WayType, fo as WayTypeInfo, fp as WaypointAmenity, fq as WaypointContact, fr as WaypointCreateParams, fs as WaypointIcon, ft as WaypointLink, fu as WaypointMedia, fv as WaypointMode, fw as WaypointPhoto, fx as WaypointProperty, fy as WaypointPropertyFormat, fz as WaypointTiming, fA as WaypointUpdateParams, fB as Zone, fC as ZoneCreateParams, fD as ZoneFeature, fE as ZoneLevel, fF as ZoneMode, fG as ZoneSource, fH as ZoneSourceKind, fI as ZoneStatus, fJ as ZoneUpdateParams, fK as boundFetch, fL as defaultBaseUrls, fM as errorForStatus, fN as isMountayaApiError, fO as isMountayaError, fP as parseRateLimit } from './errors-B-GqAtQv.cjs';
5
+ import { b as bind$1, a as bind$2 } from './coreOperations.gen-BxX5xRxw.cjs';
6
+ export { D as DataOptions, c as DataResult, s as DataSelection, F as FieldTree, M as MountayaResponse, d as MountayaSelectionError, P as PagedResponse, e as PaginateOptions, R as ResourceKind, f as ResourceRef, S as SCHEMA_VERSION, g as Selected, h as Selection, i as SelectionValue, o as data, j as decodeRestSchema, p as paginate, k as rest, l as tiles } from './coreOperations.gen-BxX5xRxw.cjs';
7
+ import { a5 as bind } from './operations.gen-CvTyzKNF.cjs';
8
+
9
+ /**
10
+ * The browser-safe entry point of `@mountaya/client`.
11
+ *
12
+ * Identical to the default entry except for what it refuses to give you: there is no
13
+ * secret-key credential here, so a browser bundle cannot reach one through this import
14
+ * even by mistake.
15
+ *
16
+ * ```ts
17
+ * import { Mountaya } from "@mountaya/client/browser";
18
+ *
19
+ * // A publishable key alone reaches public data on the Map Studio and Tile APIs.
20
+ * const mountaya = new Mountaya({ credential: { publishableKey: "pk_…" } });
21
+ *
22
+ * // A session token minted by your server scopes it up to the organization, and is what
23
+ * // every Data API call requires beside the key.
24
+ * const scoped = new Mountaya({
25
+ * credential: { publishableKey: "pk_…", sessionToken },
26
+ * });
27
+ * ```
28
+ *
29
+ * Mint the session token on your server with `POST /v1/sessions`, using the secret key
30
+ * there, and send only the token to the browser. The token is short-lived and carries an
31
+ * `expires_at`, which is the whole reason it is safe to ship where the secret key is not.
32
+ *
33
+ * This is one of two defences. The other is a runtime guard in `core/rules/auth.ts` that throws
34
+ * if a secret key is constructed where a page's `window` and `document` both exist, or in a React
35
+ * Native application: it catches the cases this entry point cannot, where a bundler resolves the
36
+ * Node condition into browser code anyway, and where a runtime resolves no browser entry point.
37
+ */
38
+
39
+ /**
40
+ * BrowserClientOptions is ClientOptions with the secret-key credential removed.
41
+ *
42
+ * The narrowing is the point of this module: `{ secretKey }` is not assignable here, so
43
+ * the mistake is a type error at the call site rather than a key in a bundle.
44
+ */
45
+ interface BrowserClientOptions extends Omit<ClientOptions, "credential"> {
46
+ /** How the client authenticates: a publishable key, a share token or the browser's session. */
47
+ readonly credential: PublishableCredential | ShareCredential | CookieCredential;
48
+ }
49
+ /**
50
+ * MountayaTransport is the default entry's transport, as a type: the constructor below builds
51
+ * that same class, so a transport this entry hands out is one the default entry's type describes.
52
+ */
53
+ type MountayaTransport = MountayaTransport$1;
54
+ /**
55
+ * MountayaTransport builds a transport from {@link BrowserClientOptions}, so a secret key is a type
56
+ * error at the call site here as it is for {@link Mountaya}, rather than a key in a bundle that
57
+ * only the runtime guard refuses.
58
+ *
59
+ * It is the default entry's class under a narrower constructor type, not a second class, so
60
+ * `instanceof` answers the same against either entry's name. A secret-key transport is built from
61
+ * `@mountaya/client`, on a server.
62
+ */
63
+ declare const MountayaTransport: new (options: BrowserClientOptions) => MountayaTransport$1;
64
+ /**
65
+ * Mountaya is the browser client. It accepts a publishable key or a share token, and
66
+ * cannot be constructed with a secret key.
67
+ *
68
+ * The organization's operations are the admin unit's: `new MountayaAdmin(mountaya)` of
69
+ * `@mountaya/client/admin` answers them, bound to this client's transport.
70
+ */
71
+ declare class Mountaya {
72
+ /**
73
+ * The AI agent: starting a run, answering it, rating it. Each method resolves to the response
74
+ * envelope, with the payload at `data`; a run's events are read through
75
+ * `createAgentTransport` of `@mountaya/client/events`.
76
+ */
77
+ readonly agent: ReturnType<typeof bind>["agent"];
78
+ /**
79
+ * The GraphQL Data API: directions, search, terrain, isochrones, matrices. Each method resolves
80
+ * to the operation's own field, with no envelope.
81
+ */
82
+ readonly data: ReturnType<typeof bind$1>;
83
+ /**
84
+ * The Map Studio API's map half: itineraries, zones, collections, and their catalogs. Each
85
+ * method resolves to the response envelope, with the payload at `data`.
86
+ */
87
+ readonly studio: ReturnType<typeof bind>["studio"];
88
+ /** The Tile API's style specifications. Each method resolves to the response envelope. */
89
+ readonly tiles: ReturnType<typeof bind$2>;
90
+ /**
91
+ * The transport every method calls through: for a call this client binds no method for, and
92
+ * for the openers of `@mountaya/client/events`.
93
+ */
94
+ readonly transport: MountayaTransport;
95
+ /**
96
+ * Builds a browser client over one credential and its options, checking both before anything
97
+ * is sent.
98
+ *
99
+ * @throws `MountayaConfigurationError` for options that are not an object, a credential that
100
+ * cannot work, or an option outside its range: see {@link ClientOptions}.
101
+ */
102
+ constructor(options: BrowserClientOptions);
103
+ }
104
+
105
+ export { CookieCredential, Mountaya, MountayaTransport, PublishableCredential, ShareCredential };
106
+ export type { BrowserClientOptions };
@@ -0,0 +1,106 @@
1
+ export { Geometry } from 'geojson';
2
+ import { ba as PublishableCredential, bb as ShareCredential, bc as CookieCredential } from './errors-B-GqAtQv.js';
3
+ import { ClientOptions, MountayaTransport as MountayaTransport$1 } from './index.js';
4
+ export { bd as AcceptedResponse, be as Activity, bf as ActivityCapabilities, bg as ActivitySlug, bh as AgentAwaitingInputEvent, bi as AgentBudgetDimension, bj as AgentBudgetExhaustedEvent, bk as AgentChecksUnmetEvent, bl as AgentClientToolManifest, bm as AgentCloseInput, bn as AgentConfirmInput, bo as AgentConfirmRequiredEvent, bp as AgentDoneEvent, bq as AgentErrorCode, br as AgentErrorEvent, bs as AgentManifestUpdateInput, bt as AgentMessageDeltaEvent, bu as AgentMessageEvent, bv as AgentReconnectEvent, bw as AgentRun, bx as AgentRunCreateParams, by as AgentRunEvent, bz as AgentRunEventType, bA as AgentRunFeedbackParams, bB as AgentRunFeedbackRating, bC as AgentRunInputParams, bD as AgentRunInputType, bE as AgentRunProfile, bF as AgentRunReason, bG as AgentToolAbandonedEvent, bH as AgentToolAbandonedReason, bI as AgentToolCallEvent, bJ as AgentToolCallTarget, bK as AgentToolErrorCode, bL as AgentToolResultEvent, bM as AgentToolResultInput, bN as AgentUserMessageInput, bO as AnalyzeGeometryResult, bP as ApiErrorDetails, bQ as BadRequestResponse, bR as BaseUrlOverrides, bS as BinaryBody, bT as Boundaries, bU as CategoryActivities, bV as CategoryOverlays, bW as CollabChangeAction, bX as CollabChangeKind, bY as CollabCollectionChangedEvent, bZ as CollabCursorEvent, b_ as CollabCursorSignal, b$ as CollabDraftClearEvent, c0 as CollabDraftClearSignal, c1 as CollabDraftUpdateEvent, c2 as CollabDraftUpdateSignal, c3 as CollabEntity, c4 as CollabEntityKind, c5 as CollabItineraryChangedEvent, c6 as CollabLock, c7 as CollabLockAcquireSignal, c8 as CollabLockAcquiredEvent, c9 as CollabLockReleaseSignal, ca as CollabLockReleasedEvent, cb as CollabLockSnapshotEvent, cc as CollabMember, cd as CollabPosition, ce as CollabPresenceJoinEvent, cf as CollabPresenceLeaveEvent, cg as CollabPresenceSnapshotEvent, ch as CollabReconnectEvent, ci as CollabSegmentChangedEvent, cj as CollabSelectionEvent, ck as CollabSelectionKind, cl as CollabSelectionRef, cm as CollabSelectionSignal, cn as CollabSignalParams, co as CollabSignalType, cp as CollabStreamEvent, cq as CollabStreamEventType, cr as CollabWaypointChangedEvent, cs as CollabZoneChangedEvent, ct as Collection, cu as CollectionCount, cv as CollectionCreateParams, cw as CollectionItinerariesAddParams, cx as CollectionItineraryUpdateParams, cy as CollectionUpdateParams, cz as CollectionZonesAddParams, cA as ConflictMetadata, cB as ConflictResponse, cC as CreatedResponse, cD as DataSchema, cE as DateMask, cF as DirectionsResult, cG as Elevation, cH as ElevationTileSize, cI as EmbeddedStudioDefaultProps, cJ as EmbeddedStudioSafetyRules, cK as EmbeddedStudioTheme, cL as EmbeddedStudioThemeColors, cM as ErrorCode, cN as ErrorEntry, cO as ErrorMetadata, cP as Errors, cQ as ExportFormat, cR as ExportItineraryResult, cS as ExportVariant, cT as ForbiddenResponse, cU as GatewayTimeoutResponse, cV as GeoJSONGeometry, cW as GeoJSONGeometryCollection, cX as GeoJSONLineString, cY as GeoJSONMultiLineString, cZ as GeoJSONMultiPoint, c_ as GeoJSONMultiPolygon, c$ as GeoJSONPoint, d0 as GeoJSONPolygon, d1 as GeocodeResult, d2 as HTTPError, d3 as IdempotentAnswer, d4 as IdempotentReplayed, d5 as ImportGranularity, d6 as ImportProvider, d7 as ImportRecommendationReason, d8 as ImportWarning, d9 as InternalErrorResponse, da as IsochronesResult, db as Itinerary, dc as ItineraryCount, dd as ItineraryCreateParams, de as ItineraryDirectionsStep, df as ItineraryDuplicateParams, dg as ItineraryImportConfirmParams, dh as ItineraryImportConfirmSegment, di as ItineraryImportConfirmWaypoint, dj as ItineraryImportPreview, dk as ItineraryPace, dl as ItineraryPaceSegment, dm as ItineraryResult, dn as ItinerarySegment, dp as ItinerarySegmentGroup, dq as ItineraryStatus, dr as ItineraryUpdateParams, ds as ItineraryWaypoint, dt as ItineraryWithDetails, du as Language, dv as Layers, dw as LimitKey, dx as ListMetadata, dy as LocaleMap, dz as Locales, dA as ManeuverType, dB as MatrixResult, dC as MountayaApiError, dD as MountayaAuthenticationError, dE as MountayaBadRequestError, dF as MountayaBillingError, dG as MountayaConfigurationError, dH as MountayaConflictError, dI as MountayaConnectionError, dJ as MountayaDataError, M as MountayaError, dK as MountayaForbiddenError, dL as MountayaIdempotencyKeyInUseError, dM as MountayaIdempotentAnswerUnavailableError, dN as MountayaMethodNotAllowedError, dO as MountayaNotFoundError, dP as MountayaPayloadTooLargeError, dQ as MountayaPreconditionFailedError, dR as MountayaRateLimitError, dS as MountayaServerError, dT as NotFoundResponse, dU as OkResponse, dV as Organization, dW as OrganizationLookupParams, dX as OrganizationRole, dY as OrganizationSettings, dZ as Overlay, d_ as OverlayCapabilities, d$ as OverlayContentType, e0 as OverlaySupportedCapabilities, e1 as PAYMENT_REQUIRED_CODE, e2 as PaginationMetadata, e3 as PayloadTooLargeResponse, e4 as PaymentRequiredResponse, e5 as PoisResult, e6 as ProposedCandidate, e7 as ProposedSegment, e8 as ProposedWaypoint, e9 as RangeType, ea as RateLimitInfo, eb as RateLimitPolicy, ec as ReadSurface, ed as RelationToUser, ee as RequestArgs, ef as RequestOptions, eg as ResponseMetadataCreatedPart, eh as ResponseMetadataIdempotentAnswer, ei as ResponseMetadataLimitReached, ej as ResponseMetadataLockConflict, ek as ResponseMetadataPatchCollection, el as ResponseMetadataPatchItinerary, em as ResponseMetadataPatchZone, en as ResponseMetadataPostCollection, eo as ResponseMetadataPostItinerary, ep as ResponseMetadataPostZone, eq as ResponseReport, er as RestSchema, es as RetryOptions, et as ReverseGeocodeResult, eu as RoadAccessInfo, ev as RoadAccessRestrictionType, ew as SearchResult, ex as SegmentConvertParams, ey as SegmentCreateParams, ez as SegmentGroupCreateParams, eA as SegmentGroupUpdateParams, eB as SegmentMode, eC as SegmentSplitParams, eD as SegmentUpdateParams, eE as ServiceUnavailableResponse, eF as Session, eG as SessionSurface, eH as SessionTokenEngine, eI as SessionTokenEngineOptions, eJ as SessionTokenSnapshot, eK as SessionTokenSource, eL as ShareLink, eM as SlopeInfo, eN as SpeedInfo, eO as StreamReconnectReason, eP as StreamSeam, eQ as StudioEntitlement, eR as SuccessExtensions, eS as SuggestionsResult, eT as Surface, eU as SurfaceInfo, eV as SurfaceType, eW as Terrain, eX as TerrainGridResult, eY as TerrainProfileResult, eZ as TerrainSamplesResult, e_ as TerrainTileSize, e$ as TerrainVariant, f0 as TerrainVariantAsStyle, f1 as TerrainVariantAsTiles, f2 as TerrainVariantConfig, f3 as TerrainVariants, f4 as Theme, f5 as TileLayer, f6 as TileLayerType, f7 as TileLegend, f8 as TileLegendKind, f9 as TileLegendStep, fa as TileSchema, fb as TileSource, fc as TileSourceSize, fd as TileSourceType, fe as TooManyRequestsResponse, ff as TrailDifficultyInfo, fg as TrailDifficultyType, fh as UnauthorizedResponse, fi as UnitLegend, fj as UnitLength, fk as UnitPace, fl as UnitSlope, fm as UnitTemperature, fn as WayType, fo as WayTypeInfo, fp as WaypointAmenity, fq as WaypointContact, fr as WaypointCreateParams, fs as WaypointIcon, ft as WaypointLink, fu as WaypointMedia, fv as WaypointMode, fw as WaypointPhoto, fx as WaypointProperty, fy as WaypointPropertyFormat, fz as WaypointTiming, fA as WaypointUpdateParams, fB as Zone, fC as ZoneCreateParams, fD as ZoneFeature, fE as ZoneLevel, fF as ZoneMode, fG as ZoneSource, fH as ZoneSourceKind, fI as ZoneStatus, fJ as ZoneUpdateParams, fK as boundFetch, fL as defaultBaseUrls, fM as errorForStatus, fN as isMountayaApiError, fO as isMountayaError, fP as parseRateLimit } from './errors-B-GqAtQv.js';
5
+ import { b as bind$1, a as bind$2 } from './coreOperations.gen-BMYPoBbz.js';
6
+ export { D as DataOptions, c as DataResult, s as DataSelection, F as FieldTree, M as MountayaResponse, d as MountayaSelectionError, P as PagedResponse, e as PaginateOptions, R as ResourceKind, f as ResourceRef, S as SCHEMA_VERSION, g as Selected, h as Selection, i as SelectionValue, o as data, j as decodeRestSchema, p as paginate, k as rest, l as tiles } from './coreOperations.gen-BMYPoBbz.js';
7
+ import { a5 as bind } from './operations.gen-DUD406TV.js';
8
+
9
+ /**
10
+ * The browser-safe entry point of `@mountaya/client`.
11
+ *
12
+ * Identical to the default entry except for what it refuses to give you: there is no
13
+ * secret-key credential here, so a browser bundle cannot reach one through this import
14
+ * even by mistake.
15
+ *
16
+ * ```ts
17
+ * import { Mountaya } from "@mountaya/client/browser";
18
+ *
19
+ * // A publishable key alone reaches public data on the Map Studio and Tile APIs.
20
+ * const mountaya = new Mountaya({ credential: { publishableKey: "pk_…" } });
21
+ *
22
+ * // A session token minted by your server scopes it up to the organization, and is what
23
+ * // every Data API call requires beside the key.
24
+ * const scoped = new Mountaya({
25
+ * credential: { publishableKey: "pk_…", sessionToken },
26
+ * });
27
+ * ```
28
+ *
29
+ * Mint the session token on your server with `POST /v1/sessions`, using the secret key
30
+ * there, and send only the token to the browser. The token is short-lived and carries an
31
+ * `expires_at`, which is the whole reason it is safe to ship where the secret key is not.
32
+ *
33
+ * This is one of two defences. The other is a runtime guard in `core/rules/auth.ts` that throws
34
+ * if a secret key is constructed where a page's `window` and `document` both exist, or in a React
35
+ * Native application: it catches the cases this entry point cannot, where a bundler resolves the
36
+ * Node condition into browser code anyway, and where a runtime resolves no browser entry point.
37
+ */
38
+
39
+ /**
40
+ * BrowserClientOptions is ClientOptions with the secret-key credential removed.
41
+ *
42
+ * The narrowing is the point of this module: `{ secretKey }` is not assignable here, so
43
+ * the mistake is a type error at the call site rather than a key in a bundle.
44
+ */
45
+ interface BrowserClientOptions extends Omit<ClientOptions, "credential"> {
46
+ /** How the client authenticates: a publishable key, a share token or the browser's session. */
47
+ readonly credential: PublishableCredential | ShareCredential | CookieCredential;
48
+ }
49
+ /**
50
+ * MountayaTransport is the default entry's transport, as a type: the constructor below builds
51
+ * that same class, so a transport this entry hands out is one the default entry's type describes.
52
+ */
53
+ type MountayaTransport = MountayaTransport$1;
54
+ /**
55
+ * MountayaTransport builds a transport from {@link BrowserClientOptions}, so a secret key is a type
56
+ * error at the call site here as it is for {@link Mountaya}, rather than a key in a bundle that
57
+ * only the runtime guard refuses.
58
+ *
59
+ * It is the default entry's class under a narrower constructor type, not a second class, so
60
+ * `instanceof` answers the same against either entry's name. A secret-key transport is built from
61
+ * `@mountaya/client`, on a server.
62
+ */
63
+ declare const MountayaTransport: new (options: BrowserClientOptions) => MountayaTransport$1;
64
+ /**
65
+ * Mountaya is the browser client. It accepts a publishable key or a share token, and
66
+ * cannot be constructed with a secret key.
67
+ *
68
+ * The organization's operations are the admin unit's: `new MountayaAdmin(mountaya)` of
69
+ * `@mountaya/client/admin` answers them, bound to this client's transport.
70
+ */
71
+ declare class Mountaya {
72
+ /**
73
+ * The AI agent: starting a run, answering it, rating it. Each method resolves to the response
74
+ * envelope, with the payload at `data`; a run's events are read through
75
+ * `createAgentTransport` of `@mountaya/client/events`.
76
+ */
77
+ readonly agent: ReturnType<typeof bind>["agent"];
78
+ /**
79
+ * The GraphQL Data API: directions, search, terrain, isochrones, matrices. Each method resolves
80
+ * to the operation's own field, with no envelope.
81
+ */
82
+ readonly data: ReturnType<typeof bind$1>;
83
+ /**
84
+ * The Map Studio API's map half: itineraries, zones, collections, and their catalogs. Each
85
+ * method resolves to the response envelope, with the payload at `data`.
86
+ */
87
+ readonly studio: ReturnType<typeof bind>["studio"];
88
+ /** The Tile API's style specifications. Each method resolves to the response envelope. */
89
+ readonly tiles: ReturnType<typeof bind$2>;
90
+ /**
91
+ * The transport every method calls through: for a call this client binds no method for, and
92
+ * for the openers of `@mountaya/client/events`.
93
+ */
94
+ readonly transport: MountayaTransport;
95
+ /**
96
+ * Builds a browser client over one credential and its options, checking both before anything
97
+ * is sent.
98
+ *
99
+ * @throws `MountayaConfigurationError` for options that are not an object, a credential that
100
+ * cannot work, or an option outside its range: see {@link ClientOptions}.
101
+ */
102
+ constructor(options: BrowserClientOptions);
103
+ }
104
+
105
+ export { CookieCredential, Mountaya, MountayaTransport, PublishableCredential, ShareCredential };
106
+ export type { BrowserClientOptions };
@@ -0,0 +1,53 @@
1
+ import { MountayaTransport, bind as bind$1, bind2 } from './chunk-OHKVUREN.js';
2
+ export { selection_gen_exports as DataSelection, MountayaSelectionError, SCHEMA_VERSION, SessionTokenEngine, boundFetch, operations_gen_exports as data, defaultBaseUrls, paginate, coreOperations_gen_exports as rest, operations_gen_exports2 as tiles } from './chunk-OHKVUREN.js';
3
+ export { decodeRestSchema } from './chunk-BM526BHG.js';
4
+ import './chunk-D2YEVTG7.js';
5
+ import { bind } from './chunk-TDTK2L5H.js';
6
+ export { MountayaApiError, MountayaAuthenticationError, MountayaBadRequestError, MountayaBillingError, MountayaConfigurationError, MountayaConflictError, MountayaConnectionError, MountayaDataError, MountayaError, MountayaForbiddenError, MountayaIdempotencyKeyInUseError, MountayaIdempotentAnswerUnavailableError, MountayaMethodNotAllowedError, MountayaNotFoundError, MountayaPayloadTooLargeError, MountayaPreconditionFailedError, MountayaRateLimitError, MountayaServerError, PAYMENT_REQUIRED_CODE, errorForStatus, isMountayaApiError, isMountayaError, parseRateLimit } from './chunk-TDTK2L5H.js';
7
+
8
+ // src/browser.ts
9
+ var MountayaTransport2 = MountayaTransport;
10
+ var Mountaya = class {
11
+ /**
12
+ * The AI agent: starting a run, answering it, rating it. Each method resolves to the response
13
+ * envelope, with the payload at `data`; a run's events are read through
14
+ * `createAgentTransport` of `@mountaya/client/events`.
15
+ */
16
+ agent;
17
+ /**
18
+ * The GraphQL Data API: directions, search, terrain, isochrones, matrices. Each method resolves
19
+ * to the operation's own field, with no envelope.
20
+ */
21
+ data;
22
+ /**
23
+ * The Map Studio API's map half: itineraries, zones, collections, and their catalogs. Each
24
+ * method resolves to the response envelope, with the payload at `data`.
25
+ */
26
+ studio;
27
+ /** The Tile API's style specifications. Each method resolves to the response envelope. */
28
+ tiles;
29
+ /**
30
+ * The transport every method calls through: for a call this client binds no method for, and
31
+ * for the openers of `@mountaya/client/events`.
32
+ */
33
+ transport;
34
+ /**
35
+ * Builds a browser client over one credential and its options, checking both before anything
36
+ * is sent.
37
+ *
38
+ * @throws `MountayaConfigurationError` for options that are not an object, a credential that
39
+ * cannot work, or an option outside its range: see {@link ClientOptions}.
40
+ */
41
+ constructor(options) {
42
+ this.transport = new MountayaTransport2(options);
43
+ const api = bind(this.transport);
44
+ this.agent = api.agent;
45
+ this.data = bind$1(this.transport);
46
+ this.studio = api.studio;
47
+ this.tiles = bind2(this.transport);
48
+ }
49
+ };
50
+
51
+ export { Mountaya, MountayaTransport2 as MountayaTransport };
52
+ //# sourceMappingURL=browser.js.map
53
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/browser.ts"],"names":["MountayaTransport","bind"],"mappings":";;;;;;;;AAmLO,IAAMA,kBAAAA,GACX;AASK,IAAM,WAAN,MAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMX,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,IAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,MAAA;AAAA;AAAA,EAEA,KAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,SAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAST,YAAY,OAAA,EAA+B;AACzC,IAAA,IAAA,CAAK,SAAA,GAAY,IAAIA,kBAAAA,CAAkB,OAAO,CAAA;AAE9C,IAAA,MAAM,GAAA,GAAMC,IAAAA,CAAS,IAAA,CAAK,SAAS,CAAA;AAEnC,IAAA,IAAA,CAAK,QAAQ,GAAA,CAAI,KAAA;AACjB,IAAA,IAAA,CAAK,IAAA,GAAOA,MAAA,CAAS,IAAA,CAAK,SAAS,CAAA;AACnC,IAAA,IAAA,CAAK,SAAS,GAAA,CAAI,MAAA;AAClB,IAAA,IAAA,CAAK,KAAA,GAAQA,KAAAA,CAAU,IAAA,CAAK,SAAS,CAAA;AAAA,EACvC;AACF","file":"browser.js"}
@@ -0,0 +1,342 @@
1
+ import { withAbsentNulls, restSchemaDates, instantOf } from './chunk-TDTK2L5H.js';
2
+
3
+ // src/core/rules/nullMasks.gen.ts
4
+ var localesNulls = { de: true, en: true, es: true, fr: true, it: true, ja: true, zh: true };
5
+ var activityNulls = { locales: localesNulls };
6
+ var aiProviderConfigNulls = { base_url: true };
7
+ var billingPricingNulls = { unit_amount: true };
8
+ var billingProductNulls = { prices: [billingPricingNulls] };
9
+ var categoryActivitiesNulls = { children: [activityNulls], locales: localesNulls };
10
+ var tileLegendNulls = { locales: localesNulls };
11
+ var tileLayerNulls = { layout: true, legend: tileLegendNulls, paint: true };
12
+ var tileSourceNulls = { layers: [tileLayerNulls] };
13
+ var overlayNulls = { locales: localesNulls, sources: [tileSourceNulls] };
14
+ var categoryOverlaysNulls = { children: [overlayNulls], locales: localesNulls };
15
+ var collabCursorEventNulls = { position: true };
16
+ var collabCursorSignalNulls = { position: true };
17
+ var collabSelectionEventNulls = { selection: true };
18
+ var collabSelectionSignalNulls = { selection: true };
19
+ var collabSignalParamsNulls = ["type", { cursor: collabCursorSignalNulls, selection: collabSelectionSignalNulls }];
20
+ var collabStreamEventNulls = ["type", { cursor: collabCursorEventNulls, selection: collabSelectionEventNulls }];
21
+ var collectionNulls = { description: true, organization_id: true, sources: [tileSourceNulls] };
22
+ var collectionEventObjectNulls = { description: true };
23
+ var itineraryNulls = { ascent: true, description: true, distance: true, organization_id: true };
24
+ var itineraryDirectionsStepNulls = { exit_number: true };
25
+ var itineraryEventObjectNulls = { description: true };
26
+ var proposedSegmentNulls = { recommendation_reason: true };
27
+ var itineraryImportPreviewNulls = { segments: [proposedSegmentNulls] };
28
+ var itinerarySegmentNulls = { altitude_max: true, altitude_min: true, ascent: true, color: true, descent: true, description: true, distance: true, duration: true, geojson: true, gradient_max: true, gradient_min: true, group_id: true, road_access_info: true, slope_info: true, speed: true, speed_info: true, start_at: true, steps: [true, [itineraryDirectionsStepNulls]], surface_info: true, trail_difficulty_info: true, way_type_info: true };
29
+ var itinerarySegmentGroupNulls = { speed: true };
30
+ var itineraryWaypointNulls = { color: true, contact: true, description: true, geojson: true, icon: true, media: true, name: true, properties: true, timing: true };
31
+ var itineraryWaypointEventObjectNulls = { name: true };
32
+ var itineraryWithDetailsNulls = { ascent: true, description: true, distance: true, groups: [itinerarySegmentGroupNulls], organization_id: true, published_at: true, segments: [itinerarySegmentNulls], waypoints: [itineraryWaypointNulls] };
33
+ var terrainNulls = { locales: localesNulls };
34
+ var layersNulls = { itineraries: overlayNulls, overlays: [categoryOverlaysNulls], terrains: [terrainNulls], zones: overlayNulls };
35
+ var paginationMetadataNulls = { next_cursor: true };
36
+ var listMetadataNulls = { pagination: paginationMetadataNulls };
37
+ var notificationPreferenceNulls = { locked_reason: true };
38
+ var notificationPreferencesNulls = { notifications: [notificationPreferenceNulls] };
39
+ var subscriptionDiscountNulls = { ends_at: true };
40
+ var organizationSubscriptionNulls = { discount: subscriptionDiscountNulls };
41
+ var organizationSubscriptionSummaryNulls = { api: organizationSubscriptionNulls };
42
+ var sessionNulls = { user_id: true };
43
+ var webhookDeliveryNulls = { next_attempt_at: true };
44
+ var webhookDeliveryTriggerNulls = { delivery_id: true };
45
+ var webhookDeliveryWithAttemptsNulls = { next_attempt_at: true };
46
+ var webhookEndpointNulls = { created_by: true, description: true, disabled_at: true, disabled_reason: true, failing_since: true };
47
+ var webhookEndpointEventObjectNulls = { failing_since: true };
48
+ var webhookEndpointWithSecretNulls = { created_by: true, description: true, disabled_at: true, disabled_reason: true, failing_since: true };
49
+ var zoneEventObjectNulls = { description: true, end_at: true, start_at: true };
50
+ var webhookEventObjectNulls = ["object", { collection: collectionEventObjectNulls, itinerary: itineraryEventObjectNulls, "itinerary.waypoint": itineraryWaypointEventObjectNulls, "organization.webhook_endpoint": webhookEndpointEventObjectNulls, zone: zoneEventObjectNulls }];
51
+ var webhookEventDataNulls = { object: webhookEventObjectNulls };
52
+ var webhookEventNulls = { data: webhookEventDataNulls, request: true };
53
+ var webhookEventWithDeliveriesNulls = { data: webhookEventDataNulls, deliveries: [webhookDeliveryNulls], request: true };
54
+ var webhookHealthDestinationNulls = { eventual_success_rate: true, first_attempt_success_rate: true, last_success_at: true };
55
+ var webhookHealthFiguresNulls = { availability: true, dispatch_delay_p50_ms: true, dispatch_delay_p95_ms: true, dispatched_within_60s: true, eventual_success_rate: true, first_attempt_success_rate: true, response_time_p50_ms: true, response_time_p95_ms: true };
56
+ var webhookHealthPointNulls = { availability: true, dispatch_delay_p50_ms: true, dispatch_delay_p95_ms: true, dispatched_within_60s: true, eventual_success_rate: true, first_attempt_success_rate: true, response_time_p50_ms: true, response_time_p95_ms: true };
57
+ var webhookHealthNulls = { destinations: [webhookHealthDestinationNulls], series: [webhookHealthPointNulls], totals: webhookHealthFiguresNulls };
58
+ var zoneNulls = { description: true, end_at: true, organization_id: true, published_at: true, source: true, start_at: true };
59
+ var restSchemaNulls = {
60
+ Activity: activityNulls,
61
+ AiProviderConfig: aiProviderConfigNulls,
62
+ BillingPricing: billingPricingNulls,
63
+ BillingProduct: billingProductNulls,
64
+ CategoryActivities: categoryActivitiesNulls,
65
+ CategoryOverlays: categoryOverlaysNulls,
66
+ CollabCursorEvent: collabCursorEventNulls,
67
+ CollabCursorSignal: collabCursorSignalNulls,
68
+ CollabSelectionEvent: collabSelectionEventNulls,
69
+ CollabSelectionSignal: collabSelectionSignalNulls,
70
+ CollabSignalParams: collabSignalParamsNulls,
71
+ CollabStreamEvent: collabStreamEventNulls,
72
+ Collection: collectionNulls,
73
+ CollectionEventObject: collectionEventObjectNulls,
74
+ Itinerary: itineraryNulls,
75
+ ItineraryDirectionsStep: itineraryDirectionsStepNulls,
76
+ ItineraryEventObject: itineraryEventObjectNulls,
77
+ ItineraryImportPreview: itineraryImportPreviewNulls,
78
+ ItinerarySegment: itinerarySegmentNulls,
79
+ ItinerarySegmentGroup: itinerarySegmentGroupNulls,
80
+ ItineraryWaypoint: itineraryWaypointNulls,
81
+ ItineraryWaypointEventObject: itineraryWaypointEventObjectNulls,
82
+ ItineraryWithDetails: itineraryWithDetailsNulls,
83
+ Layers: layersNulls,
84
+ ListMetadata: listMetadataNulls,
85
+ Locales: localesNulls,
86
+ NotificationPreference: notificationPreferenceNulls,
87
+ NotificationPreferences: notificationPreferencesNulls,
88
+ OrganizationSubscription: organizationSubscriptionNulls,
89
+ OrganizationSubscriptionSummary: organizationSubscriptionSummaryNulls,
90
+ Overlay: overlayNulls,
91
+ PaginationMetadata: paginationMetadataNulls,
92
+ ProposedSegment: proposedSegmentNulls,
93
+ Session: sessionNulls,
94
+ SubscriptionDiscount: subscriptionDiscountNulls,
95
+ Terrain: terrainNulls,
96
+ TileLayer: tileLayerNulls,
97
+ TileLegend: tileLegendNulls,
98
+ TileSource: tileSourceNulls,
99
+ WebhookDelivery: webhookDeliveryNulls,
100
+ WebhookDeliveryTrigger: webhookDeliveryTriggerNulls,
101
+ WebhookDeliveryWithAttempts: webhookDeliveryWithAttemptsNulls,
102
+ WebhookEndpoint: webhookEndpointNulls,
103
+ WebhookEndpointEventObject: webhookEndpointEventObjectNulls,
104
+ WebhookEndpointWithSecret: webhookEndpointWithSecretNulls,
105
+ WebhookEvent: webhookEventNulls,
106
+ WebhookEventData: webhookEventDataNulls,
107
+ WebhookEventObject: webhookEventObjectNulls,
108
+ WebhookEventWithDeliveries: webhookEventWithDeliveriesNulls,
109
+ WebhookHealth: webhookHealthNulls,
110
+ WebhookHealthDestination: webhookHealthDestinationNulls,
111
+ WebhookHealthFigures: webhookHealthFiguresNulls,
112
+ WebhookHealthPoint: webhookHealthPointNulls,
113
+ Zone: zoneNulls,
114
+ ZoneEventObject: zoneEventObjectNulls
115
+ };
116
+ var responseNulls = {
117
+ /** DELETE /v1/collections/{collection_id} */
118
+ deleteCollection: { data: true },
119
+ /** DELETE /v1/collections/{collection_id}/itineraries/{itinerary_id} */
120
+ deleteCollectionItinerary: { data: collectionNulls },
121
+ /** DELETE /v1/collections/{collection_id}/share-link */
122
+ deleteCollectionShareLink: { data: true },
123
+ /** DELETE /v1/collections/{collection_id}/zones/{zone_id} */
124
+ deleteCollectionZone: { data: collectionNulls },
125
+ /** DELETE /v1/itineraries/{itinerary_id} */
126
+ deleteItinerary: { data: true },
127
+ /** DELETE /v1/itineraries/{itinerary_id}/publication */
128
+ deleteItineraryPublication: { data: itineraryWithDetailsNulls },
129
+ /** DELETE /v1/itineraries/{itinerary_id}/segments/{segment_id} */
130
+ deleteItinerarySegment: { data: itineraryWithDetailsNulls },
131
+ /** DELETE /v1/itineraries/{itinerary_id}/segment-groups/{group_id} */
132
+ deleteItinerarySegmentGroup: { data: itineraryWithDetailsNulls },
133
+ /** DELETE /v1/itineraries/{itinerary_id}/share-link */
134
+ deleteItineraryShareLink: { data: true },
135
+ /** DELETE /v1/itineraries/{itinerary_id}/waypoints/{waypoint_id} */
136
+ deleteItineraryWaypoint: { data: itineraryWithDetailsNulls },
137
+ /** DELETE /v1/me/invitations/{invitation_id} */
138
+ deleteMyInvitation: { data: true },
139
+ /** DELETE /v1/organizations/{organization_id}/ai-provider-config */
140
+ deleteOrganizationAiProviderConfig: { data: true },
141
+ /** DELETE /v1/organizations/{organization_id}/billing/payment-methods/{payment_method_id} */
142
+ deleteOrganizationBillingPaymentMethod: { data: true },
143
+ /** DELETE /v1/organizations/{organization_id}/billing/subscription */
144
+ deleteOrganizationBillingSubscription: { data: [true, organizationSubscriptionSummaryNulls] },
145
+ /** DELETE /v1/organizations/{organization_id}/invitations/{invitation_id} */
146
+ deleteOrganizationInvitation: { data: true },
147
+ /** DELETE /v1/organizations/{organization_id}/members/{user_id} */
148
+ deleteOrganizationMember: { data: true },
149
+ /** DELETE /v1/organizations/{organization_id}/webhook-endpoints/{webhook_endpoint_id} */
150
+ deleteOrganizationWebhookEndpoint: { data: true },
151
+ /** DELETE /v1/zones/{zone_id} */
152
+ deleteZone: { data: true },
153
+ /** DELETE /v1/zones/{zone_id}/publication */
154
+ deleteZonePublication: { data: zoneNulls },
155
+ /** GET /v1/activities */
156
+ getActivities: { data: [categoryActivitiesNulls] },
157
+ /** GET /v1/billing/products */
158
+ getBillingProducts: { data: [billingProductNulls] },
159
+ /** GET /v1/collections/{collection_id} */
160
+ getCollection: { data: collectionNulls },
161
+ /** GET /v1/collections/{collection_id}/itineraries */
162
+ getCollectionItineraries: { data: [itineraryNulls], extensions: { metadata: listMetadataNulls } },
163
+ /** GET /v1/collections/{collection_id}/share-link */
164
+ getCollectionShareLink: { data: true },
165
+ /** GET /v1/collections/{collection_id}/zones */
166
+ getCollectionZones: { data: [zoneNulls], extensions: { metadata: listMetadataNulls } },
167
+ /** GET /v1/collections */
168
+ getCollections: { data: [collectionNulls], extensions: { metadata: listMetadataNulls } },
169
+ /** GET /v1/itineraries */
170
+ getItineraries: { data: [itineraryNulls], extensions: { metadata: listMetadataNulls } },
171
+ /** GET /v1/itineraries/{itinerary_id} */
172
+ getItinerary: { data: itineraryWithDetailsNulls },
173
+ /** GET /v1/itineraries/{itinerary_id}/share-link */
174
+ getItineraryShareLink: { data: true },
175
+ /** GET /v1/layers */
176
+ getLayers: { data: layersNulls },
177
+ /** GET /v1/me/invitations */
178
+ getMyInvitations: { extensions: { metadata: listMetadataNulls } },
179
+ /** GET /v1/me/organizations/{organization_id}/notification-preferences */
180
+ getMyOrganizationNotificationPreferences: { data: notificationPreferencesNulls },
181
+ /** GET /v1/me/organizations */
182
+ getMyOrganizations: { extensions: { metadata: listMetadataNulls } },
183
+ /** GET /v1/organizations/{organization_id}/ai-provider-config */
184
+ getOrganizationAiProviderConfig: { data: [true, aiProviderConfigNulls] },
185
+ /** GET /v1/organizations/{organization_id}/billing/info */
186
+ getOrganizationBillingInfo: { data: true },
187
+ /** GET /v1/organizations/{organization_id}/billing/invoices */
188
+ getOrganizationBillingInvoices: { extensions: { metadata: listMetadataNulls } },
189
+ /** GET /v1/organizations/{organization_id}/billing/payment-methods */
190
+ getOrganizationBillingPaymentMethods: { extensions: { metadata: listMetadataNulls } },
191
+ /** GET /v1/organizations/{organization_id}/billing/subscription */
192
+ getOrganizationBillingSubscription: { data: [true, organizationSubscriptionSummaryNulls] },
193
+ /** GET /v1/organizations/{organization_id}/invitations */
194
+ getOrganizationInvitations: { extensions: { metadata: listMetadataNulls } },
195
+ /** GET /v1/organizations/{organization_id}/members */
196
+ getOrganizationMembers: { extensions: { metadata: listMetadataNulls } },
197
+ /** GET /v1/organizations/{organization_id}/publishable-keys */
198
+ getOrganizationPublishableKeys: { extensions: { metadata: listMetadataNulls } },
199
+ /** GET /v1/organizations/{organization_id}/webhook-deliveries */
200
+ getOrganizationWebhookDeliveries: { data: [webhookDeliveryNulls], extensions: { metadata: listMetadataNulls } },
201
+ /** GET /v1/organizations/{organization_id}/webhook-deliveries/{delivery_id} */
202
+ getOrganizationWebhookDelivery: { data: webhookDeliveryWithAttemptsNulls },
203
+ /** GET /v1/organizations/{organization_id}/webhook-endpoints/{webhook_endpoint_id} */
204
+ getOrganizationWebhookEndpoint: { data: webhookEndpointNulls },
205
+ /** GET /v1/organizations/{organization_id}/webhook-endpoints */
206
+ getOrganizationWebhookEndpoints: { data: [webhookEndpointNulls], extensions: { metadata: listMetadataNulls } },
207
+ /** GET /v1/organizations/{organization_id}/webhook-events/{event_id} */
208
+ getOrganizationWebhookEvent: { data: webhookEventWithDeliveriesNulls },
209
+ /** GET /v1/organizations/{organization_id}/webhook-events */
210
+ getOrganizationWebhookEvents: { data: [webhookEventNulls], extensions: { metadata: listMetadataNulls } },
211
+ /** GET /v1/organizations/{organization_id}/webhook-health */
212
+ getOrganizationWebhookHealth: { data: webhookHealthNulls },
213
+ /** GET /v1/zones/{zone_id} */
214
+ getZone: { data: zoneNulls },
215
+ /** GET /v1/zones */
216
+ getZones: { data: [zoneNulls], extensions: { metadata: listMetadataNulls } },
217
+ /** PATCH /v1/collections/{collection_id} */
218
+ patchCollection: { data: collectionNulls },
219
+ /** PATCH /v1/collections/{collection_id}/itineraries/{itinerary_id} */
220
+ patchCollectionItinerary: { data: collectionNulls },
221
+ /** PATCH /v1/itineraries/{itinerary_id} */
222
+ patchItinerary: { data: itineraryWithDetailsNulls },
223
+ /** PATCH /v1/itineraries/{itinerary_id}/segments/{segment_id} */
224
+ patchItinerarySegment: { data: itineraryWithDetailsNulls },
225
+ /** PATCH /v1/itineraries/{itinerary_id}/segment-groups/{group_id} */
226
+ patchItinerarySegmentGroup: { data: itineraryWithDetailsNulls },
227
+ /** PATCH /v1/itineraries/{itinerary_id}/waypoints/{waypoint_id} */
228
+ patchItineraryWaypoint: { data: itineraryWithDetailsNulls },
229
+ /** PATCH /v1/me/organizations/{organization_id}/notification-preferences */
230
+ patchMyOrganizationNotificationPreferences: { data: notificationPreferencesNulls },
231
+ /** PATCH /v1/organizations/{organization_id}/ai-provider-config */
232
+ patchOrganizationAiProviderConfig: { data: aiProviderConfigNulls },
233
+ /** PATCH /v1/organizations/{organization_id}/webhook-endpoints/{webhook_endpoint_id} */
234
+ patchOrganizationWebhookEndpoint: { data: webhookEndpointNulls },
235
+ /** PATCH /v1/zones/{zone_id} */
236
+ patchZone: { data: zoneNulls },
237
+ /** POST /v1/agent/runs/{run_id}/feedback */
238
+ postAgentRunFeedback: { data: true },
239
+ /** POST /v1/agent/runs/{run_id}/input */
240
+ postAgentRunInput: { data: true },
241
+ /** POST /v1/collections */
242
+ postCollection: { data: collectionNulls },
243
+ /** POST /v1/collections/{collection_id}/itineraries */
244
+ postCollectionItineraries: { data: collectionNulls },
245
+ /** POST /v1/collections/{collection_id}/zones */
246
+ postCollectionZones: { data: collectionNulls },
247
+ /** POST /v1/itineraries */
248
+ postItinerary: { data: itineraryWithDetailsNulls },
249
+ /** POST /v1/itineraries/{itinerary_id}/collab */
250
+ postItineraryCollab: { data: true },
251
+ /** POST /v1/itineraries/{itinerary_id}/duplicate */
252
+ postItineraryDuplicate: { data: itineraryWithDetailsNulls },
253
+ /** POST /v1/itineraries/import */
254
+ postItineraryImport: { data: itineraryWithDetailsNulls },
255
+ /** POST /v1/itineraries/preview */
256
+ postItineraryPreview: { data: itineraryImportPreviewNulls },
257
+ /** POST /v1/itineraries/{itinerary_id}/publication */
258
+ postItineraryPublication: { data: itineraryWithDetailsNulls },
259
+ /** POST /v1/itineraries/{itinerary_id}/segments */
260
+ postItinerarySegment: { data: itineraryWithDetailsNulls },
261
+ /** POST /v1/itineraries/{itinerary_id}/segments/{segment_id}/convert */
262
+ postItinerarySegmentConvert: { data: itineraryWithDetailsNulls },
263
+ /** POST /v1/itineraries/{itinerary_id}/segment-groups */
264
+ postItinerarySegmentGroup: { data: itineraryWithDetailsNulls },
265
+ /** POST /v1/itineraries/{itinerary_id}/segments/{segment_id}/merge */
266
+ postItinerarySegmentMerge: { data: itineraryWithDetailsNulls },
267
+ /** POST /v1/itineraries/{itinerary_id}/segments/{segment_id}/split */
268
+ postItinerarySegmentSplit: { data: itineraryWithDetailsNulls },
269
+ /** POST /v1/itineraries/{itinerary_id}/waypoints */
270
+ postItineraryWaypoint: { data: itineraryWithDetailsNulls },
271
+ /** POST /v1/organizations/{organization_id}/ai-provider-config */
272
+ postOrganizationAiProviderConfig: { data: aiProviderConfigNulls },
273
+ /** POST /v1/organizations/{organization_id}/billing/subscription */
274
+ postOrganizationBillingSubscription: { data: organizationSubscriptionSummaryNulls },
275
+ /** POST /v1/organizations/{organization_id}/webhook-deliveries */
276
+ postOrganizationWebhookDelivery: { data: webhookDeliveryTriggerNulls },
277
+ /** POST /v1/organizations/{organization_id}/webhook-endpoints */
278
+ postOrganizationWebhookEndpoint: { data: webhookEndpointWithSecretNulls },
279
+ /** POST /v1/sessions */
280
+ postSession: { data: sessionNulls },
281
+ /** POST /v1/zones */
282
+ postZone: { data: zoneNulls },
283
+ /** POST /v1/zones/{zone_id}/collab */
284
+ postZoneCollab: { data: true },
285
+ /** POST /v1/zones/{zone_id}/publication */
286
+ postZonePublication: { data: zoneNulls }
287
+ };
288
+
289
+ // src/core/rules/decode.ts
290
+ var schemaDates = restSchemaDates;
291
+ var schemaNulls = restSchemaNulls;
292
+ var isList = (value) => Array.isArray(value);
293
+ var decodedCopy = (value, mask) => {
294
+ if (mask === true) {
295
+ return typeof value === "string" ? instantOf(value) ?? value : value;
296
+ }
297
+ if (isList(mask)) {
298
+ if (!isList(value)) {
299
+ return value;
300
+ }
301
+ const [element] = mask;
302
+ let copy2;
303
+ for (const [index, member] of value.entries()) {
304
+ const decoded = decodedCopy(member, element);
305
+ if (decoded !== member) {
306
+ copy2 ??= [...value];
307
+ copy2[index] = decoded;
308
+ }
309
+ }
310
+ return copy2 ?? value;
311
+ }
312
+ if (typeof value !== "object" || value === null || isList(value)) {
313
+ return value;
314
+ }
315
+ let copy;
316
+ for (const [field, fieldMask] of Object.entries(mask)) {
317
+ if (Object.hasOwn(value, field)) {
318
+ const current = Reflect.get(value, field);
319
+ const decoded = decodedCopy(current, fieldMask);
320
+ if (decoded !== current) {
321
+ copy ??= { ...value };
322
+ copy[field] = decoded;
323
+ }
324
+ }
325
+ }
326
+ return copy ?? value;
327
+ };
328
+ var decodeRestSchema = (schema, json) => (
329
+ // The cast is this function's contract: the schema types the answer, and nothing is validated.
330
+ withAbsentNulls(
331
+ decodeSchemaInstants(schema, json),
332
+ Object.hasOwn(schemaNulls, schema) ? schemaNulls[schema] : void 0
333
+ )
334
+ );
335
+ var decodeSchemaInstants = (schema, json) => {
336
+ const mask = schemaDates[schema];
337
+ return mask === void 0 ? json : decodedCopy(json, mask);
338
+ };
339
+
340
+ export { decodeRestSchema, decodeSchemaInstants, responseNulls };
341
+ //# sourceMappingURL=chunk-BM526BHG.js.map
342
+ //# sourceMappingURL=chunk-BM526BHG.js.map