@maplibre/maplibre-react-native 11.0.0-beta.19 → 11.0.0-beta.20

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 (59) hide show
  1. package/android/src/main/java/org/maplibre/reactnative/MLRNPackage.kt +13 -0
  2. package/android/src/main/java/org/maplibre/reactnative/modules/MLRNLogModule.kt +2 -0
  3. package/android/src/main/java/org/maplibre/reactnative/modules/MLRNNetworkModule.kt +0 -42
  4. package/android/src/main/java/org/maplibre/reactnative/modules/MLRNTransformRequestModule.kt +144 -0
  5. package/android/src/main/java/org/maplibre/reactnative/modules/TransformRequestInterceptor.kt +184 -0
  6. package/ios/modules/logging/MLRNLogging.h +4 -0
  7. package/ios/modules/logging/MLRNLogging.m +8 -0
  8. package/ios/modules/network/MLRNNetworkModule.mm +0 -10
  9. package/ios/modules/transform-request/MLRNTransformRequest.h +38 -0
  10. package/ios/modules/transform-request/MLRNTransformRequest.m +413 -0
  11. package/ios/modules/transform-request/MLRNTransformRequestModule.h +9 -0
  12. package/ios/modules/transform-request/MLRNTransformRequestModule.mm +72 -0
  13. package/lib/commonjs/index.js +7 -0
  14. package/lib/commonjs/index.js.map +1 -1
  15. package/lib/commonjs/modules/network/NativeNetworkModule.js.map +1 -1
  16. package/lib/commonjs/modules/network/NetworkManager.js +1 -39
  17. package/lib/commonjs/modules/network/NetworkManager.js.map +1 -1
  18. package/lib/commonjs/modules/transform-request/NativeTransformRequestModule.js +9 -0
  19. package/lib/commonjs/modules/transform-request/NativeTransformRequestModule.js.map +1 -0
  20. package/lib/commonjs/modules/transform-request/TransformRequestManager.js +223 -0
  21. package/lib/commonjs/modules/transform-request/TransformRequestManager.js.map +1 -0
  22. package/lib/module/index.js +1 -0
  23. package/lib/module/index.js.map +1 -1
  24. package/lib/module/modules/network/NativeNetworkModule.js.map +1 -1
  25. package/lib/module/modules/network/NetworkManager.js +1 -39
  26. package/lib/module/modules/network/NetworkManager.js.map +1 -1
  27. package/lib/module/modules/transform-request/NativeTransformRequestModule.js +5 -0
  28. package/lib/module/modules/transform-request/NativeTransformRequestModule.js.map +1 -0
  29. package/lib/module/modules/transform-request/TransformRequestManager.js +220 -0
  30. package/lib/module/modules/transform-request/TransformRequestManager.js.map +1 -0
  31. package/lib/typescript/commonjs/index.d.ts +1 -0
  32. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  33. package/lib/typescript/commonjs/modules/network/NativeNetworkModule.d.ts +0 -2
  34. package/lib/typescript/commonjs/modules/network/NativeNetworkModule.d.ts.map +1 -1
  35. package/lib/typescript/commonjs/modules/network/NetworkManager.d.ts +1 -33
  36. package/lib/typescript/commonjs/modules/network/NetworkManager.d.ts.map +1 -1
  37. package/lib/typescript/commonjs/modules/transform-request/NativeTransformRequestModule.d.ts +15 -0
  38. package/lib/typescript/commonjs/modules/transform-request/NativeTransformRequestModule.d.ts.map +1 -0
  39. package/lib/typescript/commonjs/modules/transform-request/TransformRequestManager.d.ts +201 -0
  40. package/lib/typescript/commonjs/modules/transform-request/TransformRequestManager.d.ts.map +1 -0
  41. package/lib/typescript/module/index.d.ts +1 -0
  42. package/lib/typescript/module/index.d.ts.map +1 -1
  43. package/lib/typescript/module/modules/network/NativeNetworkModule.d.ts +0 -2
  44. package/lib/typescript/module/modules/network/NativeNetworkModule.d.ts.map +1 -1
  45. package/lib/typescript/module/modules/network/NetworkManager.d.ts +1 -33
  46. package/lib/typescript/module/modules/network/NetworkManager.d.ts.map +1 -1
  47. package/lib/typescript/module/modules/transform-request/NativeTransformRequestModule.d.ts +15 -0
  48. package/lib/typescript/module/modules/transform-request/NativeTransformRequestModule.d.ts.map +1 -0
  49. package/lib/typescript/module/modules/transform-request/TransformRequestManager.d.ts +201 -0
  50. package/lib/typescript/module/modules/transform-request/TransformRequestManager.d.ts.map +1 -0
  51. package/package.json +1 -12
  52. package/src/index.ts +8 -0
  53. package/src/modules/network/NativeNetworkModule.ts +0 -4
  54. package/src/modules/network/NetworkManager.ts +1 -47
  55. package/src/modules/transform-request/NativeTransformRequestModule.ts +41 -0
  56. package/src/modules/transform-request/TransformRequestManager.ts +292 -0
  57. package/android/src/main/java/org/maplibre/reactnative/http/RequestHeadersInterceptor.kt +0 -65
  58. package/ios/modules/network/MLRNNetworkHTTPHeaders.h +0 -14
  59. package/ios/modules/network/MLRNNetworkHTTPHeaders.m +0 -97
@@ -0,0 +1,201 @@
1
+ export interface TransformOptions {
2
+ /**
3
+ * The id is used to identify a transform. Can be used to remove or update it.
4
+ * When omitted it will be auto-generated.
5
+ */
6
+ id?: string;
7
+ /**
8
+ * Optional regex to be used as the condition, if the transform should be
9
+ * applied. When omitted the transform will always be applied.
10
+ *
11
+ * Global flags are (like `/i`) are not supported. Supports only inline flags, e.g. `(?i)` for case-insensitive matching.
12
+ */
13
+ match?: RegExp | string;
14
+ }
15
+ /**
16
+ * A serializable transform for rewriting MapLibre request URLs.
17
+ *
18
+ * Transforms are applied as a pipeline in the order they were added: transform N+1 sees
19
+ * the URL *after* transform N has possibly changed it.
20
+ */
21
+ export interface UrlTransformOptions extends TransformOptions {
22
+ /**
23
+ * Regex to find the portion of the URL to replace.
24
+ * Supports capture groups that can be back-referenced in `replace` as `$1`, `$2`, …
25
+ *
26
+ * Global flags are (like `/i`) are not supported. Supports only inline flags, e.g. `(?i)` for case-insensitive matching.
27
+ */
28
+ find: RegExp | string;
29
+ /**
30
+ * Replacement string. Reference capture groups from `find` with `$1`, `$2`, …
31
+ */
32
+ replace: string;
33
+ }
34
+ /**
35
+ * A URL query parameter to append to matching map resource requests.
36
+ */
37
+ export interface UrlSearchParamOptions extends TransformOptions {
38
+ /** The query parameter name (e.g., `"apiKey"`). */
39
+ name: string;
40
+ /** The query parameter value (e.g., your API key). */
41
+ value: string;
42
+ }
43
+ /**
44
+ * A HTTP header to send with matching map resource requests.
45
+ */
46
+ export interface HeaderOptions extends TransformOptions {
47
+ /** The header name (e.g., `"Authorization"`). */
48
+ name: string;
49
+ /** The header value (e.g., `"Bearer token123"`). */
50
+ value: string;
51
+ }
52
+ /**
53
+ * TransformRequestManager provides methods for managing HTTP requests made by MapLibre.
54
+ *
55
+ * Transformations are possible in three ways:
56
+ *
57
+ * 1. Transforming the URL with search and replace
58
+ * 2. Adding URL search params
59
+ * 3. Adding HTTP headers
60
+ *
61
+ * Transforms are applied in this order. The `match` conditions are applied to
62
+ * possibly already transformed URLs.
63
+ *
64
+ * @remarks
65
+ * To gain insight into which transforms are applied set the log level to
66
+ * `"debug"` via {@link LogManager}:
67
+ *
68
+ * ```ts
69
+ * LogManager.setLogLevel("debug");
70
+ * ```
71
+ */
72
+ declare class TransformRequestManager {
73
+ /**
74
+ * Adds or updates a URL transform identified by `id`.
75
+ *
76
+ * Transforms execute in insertion order. Therefore `match` and `find` regexes
77
+ * are matched against possibly already modified URL by previous transforms.
78
+ *
79
+ * Re-adding an existing `id` updates the transform
80
+ * **in-place**, preserving its position in the pipeline. This makes it safe to
81
+ * refresh tokens or swap domains without disrupting the order of other transforms.
82
+ *
83
+ * URL transforms are applied before `addUrlSearchParam` and `addHeader`.
84
+ *
85
+ * @example
86
+ * // Upgrade all requests to HTTPS
87
+ * TransformRequestManager.addUrlTransform({
88
+ * id: "force-https",
89
+ * find: "^http://",
90
+ * replace: "https://",
91
+ * });
92
+ *
93
+ * @example
94
+ * // Redirect a specific domain through a proxy
95
+ * TransformRequestManager.addUrlTransform({
96
+ * id: "proxy",
97
+ * match: "tiles\\.example\\.com",
98
+ * find: "tiles\\.example\\.com",
99
+ * replace: "proxy.example.com",
100
+ * });
101
+ *
102
+ * @example
103
+ * // Inject an API key into the path using a capture group
104
+ * TransformRequestManager.addUrlTransform({
105
+ * id: "api-key",
106
+ * match: "api\\.example\\.com",
107
+ * find: "(https://api\\.example\\.com/)(.*)",
108
+ * replace: "$1mySecretKey/$2",
109
+ * });
110
+ *
111
+ * @param options The transform. Set {@link TransformOptions.id} to a stable string to
112
+ * enable in-place updates; if omitted an id is auto-generated and returned.
113
+ *
114
+ * @returns The id of the transform (the value of `transform.id` when provided, otherwise
115
+ * the auto-generated one). Pass it to {@link removeUrlTransform} to remove it later.
116
+ */
117
+ addUrlTransform(options: UrlTransformOptions): string;
118
+ /**
119
+ * Removes the URL transform with the given `id`.
120
+ * No-op if the id is not registered.
121
+ *
122
+ * @param id The identifier passed to/returned from {@link addUrlTransform}.
123
+ */
124
+ removeUrlTransform(id: string): void;
125
+ /**
126
+ * Removes all registered URL transforms
127
+ */
128
+ clearUrlTransforms(): void;
129
+ /**
130
+ * Adds or updates a URL query parameter identified by `id` that will be appended to all
131
+ * matching map resource requests. Re-adding an existing `id` updates the param in-place.
132
+ *
133
+ * @example
134
+ * // Add apiKey to for a specific domain
135
+ * TransformRequestManager.addUrlSearchParam({
136
+ * match: /tiles\.example\.com/,
137
+ * name: "apiKey",
138
+ * value: "your-api-key",
139
+ * });
140
+ *
141
+ * // Add apiKey to all requests (no match = applies to all)
142
+ * TransformRequestManager.addUrlSearchParam({ name: "apiKey", value: "your-api-key" });
143
+ *
144
+ * @param options The options. Set {@link TransformOptions.id} to a stable string to
145
+ * enable in-place updates; if omitted an id is auto-generated and returned.
146
+ *
147
+ * @returns The id of the options. Pass it to {@link removeUrlSearchParam} to remove it later.
148
+ */
149
+ addUrlSearchParam(options: UrlSearchParamOptions): string;
150
+ /**
151
+ * Removes a previously added URL query parameter by its `id`.
152
+ *
153
+ * @param id The identifier passed to/returned from {@link addUrlSearchParam}.
154
+ */
155
+ removeUrlSearchParam(id: string): void;
156
+ /**
157
+ * Adds or updates an HTTP header identified by `id` that will be sent with all
158
+ * matching map resource requests. Re-adding an existing `id` updates the header in-place.
159
+ *
160
+ * @example
161
+ * // Add header to all requests
162
+ * TransformRequestManager.addHeader({ name: "Authorization", value: "Bearer token123" });
163
+ *
164
+ * // Add header only to requests matching a pattern
165
+ * TransformRequestManager.addHeader({
166
+ * name: "X-API-Key",
167
+ * value: "key123",
168
+ * match: /https:\/\/api\.example\.com\/tiles\//,
169
+ * });
170
+ *
171
+ * @param options The options. Set {@link TransformOptions.id} to a stable string to
172
+ * enable in-place updates; if omitted an id is auto-generated and returned.
173
+ *
174
+ * @returns The id of the options. Pass it to {@link removeHeader} to remove it later.
175
+ */
176
+ addHeader(options: HeaderOptions): string;
177
+ /**
178
+ * Removes all registered URL search params.
179
+ */
180
+ clearUrlSearchParams(): void;
181
+ /**
182
+ * Removes a previously added HTTP header by its `id`.
183
+ *
184
+ * @param id The identifier passed to/returned from {@link addHeader}.
185
+ */
186
+ removeHeader(id: string): void;
187
+ /**
188
+ * Removes all registered HTTP headers.
189
+ */
190
+ clearHeaders(): void;
191
+ /**
192
+ * Removes all registered URL transforms, URL search params and HTTP headers.
193
+ */
194
+ clear(): void;
195
+ private lastId;
196
+ private getId;
197
+ private static toRegexString;
198
+ }
199
+ declare const transformRequestManager: TransformRequestManager;
200
+ export { transformRequestManager as TransformRequestManager };
201
+ //# sourceMappingURL=TransformRequestManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransformRequestManager.d.ts","sourceRoot":"","sources":["../../../../../src/modules/transform-request/TransformRequestManager.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D;;;;;OAKG;IACH,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAEtB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IAEb,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACrD,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IAEb,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,cAAM,uBAAuB;IAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;IACH,eAAe,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM;IAarD;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAIpC;;OAEG;IACH,kBAAkB,IAAI,IAAI;IAI1B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,iBAAiB,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM;IAazD;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAItC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM;IAazC;;OAEG;IACH,oBAAoB,IAAI,IAAI;IAI5B;;;;OAIG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAI9B;;OAEG;IACH,YAAY,IAAI,IAAI;IAIpB;;OAEG;IACH,KAAK,IAAI,IAAI;IAMb,OAAO,CAAC,MAAM,CAAc;IAE5B,OAAO,CAAC,KAAK;IAMb,OAAO,CAAC,MAAM,CAAC,aAAa;CAgB7B;AAED,QAAA,MAAM,uBAAuB,yBAAgC,CAAC;AAE9D,OAAO,EAAE,uBAAuB,IAAI,uBAAuB,EAAE,CAAC"}
@@ -20,6 +20,7 @@ export { NetworkManager } from "./modules/network/NetworkManager";
20
20
  export { OfflineManager, type OfflinePackCreateOptions, type OfflinePackDownloadState, type OfflinePackError, type OfflinePackProgressListener, type OfflinePackErrorListener, } from "./modules/offline/OfflineManager";
21
21
  export { OfflinePack, type OfflinePackStatus, } from "./modules/offline/OfflinePack";
22
22
  export { StaticMapImageManager, type StaticMapOptions, type StaticMapCenterOptions, type StaticMapBoundsOptions, type StaticMapCreateOptions, } from "./modules/static-map/StaticMapManager";
23
+ export { TransformRequestManager, type TransformOptions, type UrlTransformOptions, type UrlSearchParamOptions, type HeaderOptions, } from "./modules/transform-request/TransformRequestManager";
23
24
  export type { Anchor } from "./types/Anchor";
24
25
  export type { LngLat } from "./types/LngLat";
25
26
  export type { LngLatBounds } from "./types/LngLatBounds";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,4BAA4B,EACjC,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,MAAM,GACP,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,KAAK,SAAS,EACd,KAAK,oBAAoB,EACzB,KAAK,MAAM,EACX,KAAK,QAAQ,EACb,GAAG,GACJ,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,cAAc,GACf,MAAM,yDAAyD,CAAC;AAEjE,OAAO,EACL,KAAK,oBAAoB,EACzB,eAAe,GAChB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EACL,KAAK,YAAY,EACjB,OAAO,GACR,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAEhE,OAAO,EACL,KAAK,gBAAgB,EACrB,WAAW,GACZ,MAAM,+CAA+C,CAAC;AAEvD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B,GAC5B,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EACL,uBAAuB,EACvB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,GACnB,MAAM,qDAAqD,CAAC;AAE7D,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAC7C,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACzD,YAAY,EACV,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,UAAU,GACX,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACjE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,YAAY,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC7E,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErD,YAAY,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC"}
@@ -1,7 +1,5 @@
1
1
  import type { TurboModule } from "react-native";
2
2
  export interface Spec extends TurboModule {
3
- addRequestHeader(name: string, value: string, match: string | null): void;
4
- removeRequestHeader(name: string): void;
5
3
  setConnected(connected: boolean): void;
6
4
  }
7
5
  declare const _default: Spec;
@@ -1 +1 @@
1
- {"version":3,"file":"NativeNetworkModule.d.ts","sourceRoot":"","sources":["../../../../../src/modules/network/NativeNetworkModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;IAE1E,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAExC,YAAY,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAAC;CACxC;;AAED,wBAA2E"}
1
+ {"version":3,"file":"NativeNetworkModule.d.ts","sourceRoot":"","sources":["../../../../../src/modules/network/NativeNetworkModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,YAAY,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI,CAAC;CACxC;;AAED,wBAA2E"}
@@ -1,39 +1,7 @@
1
1
  /**
2
- * NetworkManager provides methods for managing HTTP requests made by MapLibre.
3
- * This includes adding custom headers to tile requests and controlling network connectivity.
2
+ * NetworkManager provides methods for managing and controlling network connectivity.
4
3
  */
5
4
  declare class NetworkManager {
6
- /**
7
- * Adds a custom HTTP header that will be sent with all map tile requests.
8
- * This is useful for adding authentication tokens or other custom headers
9
- * required by your tile server.
10
- *
11
- * @example
12
- * // Add header to all requests
13
- * NetworkManager.addRequestHeader("Authorization", "Bearer token123");
14
- *
15
- * // Add header only to requests matching a regex pattern (string)
16
- * NetworkManager.addRequestHeader("X-API-Key", "key123", "https:\\/\\/api\\.example\\.com\\/tiles\\/");
17
- *
18
- * // Add header only to requests matching a regex pattern (RegExp)
19
- * NetworkManager.addRequestHeader("X-API-Key", "key123", /https:\/\/api\.example\.com\/tiles\//);
20
- *
21
- * @param name The name of the header (e.g., "Authorization")
22
- * @param value The value of the header (e.g., "Bearer token123")
23
- * @param match Optional regex pattern to match against network URLs. If provided, the header will only be added to requests whose URLs match this pattern. Can be a RegExp object or a regex string.
24
- */
25
- static addRequestHeader(name: string, value: string, match?: string | RegExp): void;
26
- /**
27
- * Removes a previously added custom HTTP header.
28
- *
29
- * @example
30
- * ```ts
31
- * NetworkManager.removeRequestHeader("Authorization");
32
- * ```
33
- *
34
- * @param headerName The name of the header to remove
35
- */
36
- static removeRequestHeader(headerName: string): void;
37
5
  /**
38
6
  * Android only: Sets the connectivity state of the map. When set to false, the map will
39
7
  * not make any network requests and will only use cached tiles. This is
@@ -1 +1 @@
1
- {"version":3,"file":"NetworkManager.d.ts","sourceRoot":"","sources":["../../../../../src/modules/network/NetworkManager.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,cAAM,cAAc;IAClB;;;;;;;;;;;;;;;;;;OAkBG;IACH,MAAM,CAAC,gBAAgB,CACrB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GACtB,IAAI;IAQP;;;;;;;;;OASG;IACH,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAIpD;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;CAG9C;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"NetworkManager.d.ts","sourceRoot":"","sources":["../../../../../src/modules/network/NetworkManager.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,cAAM,cAAc;IAClB;;;;;;;;;;;;;;;OAeG;IACH,MAAM,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,GAAG,IAAI;CAG9C;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { TurboModule } from "react-native";
2
+ export interface Spec extends TurboModule {
3
+ addUrlTransform(id: string, match: string | null, find: string, replace: string): void;
4
+ removeUrlTransform(id: string): void;
5
+ clearUrlTransforms(): void;
6
+ addUrlSearchParam(id: string, match: string | null, name: string, value: string): void;
7
+ removeUrlSearchParam(id: string): void;
8
+ clearUrlSearchParams(): void;
9
+ addHeader(id: string, match: string | null, name: string, value: string): void;
10
+ removeHeader(id: string): void;
11
+ clearHeaders(): void;
12
+ }
13
+ declare const _default: Spec;
14
+ export default _default;
15
+ //# sourceMappingURL=NativeTransformRequestModule.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeTransformRequestModule.d.ts","sourceRoot":"","sources":["../../../../../src/modules/transform-request/NativeTransformRequestModule.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,IAAK,SAAQ,WAAW;IACvC,eAAe,CACb,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,IAAI,CAAC;IAER,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAErC,kBAAkB,IAAI,IAAI,CAAC;IAE3B,iBAAiB,CACf,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,IAAI,CAAC;IAER,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAEvC,oBAAoB,IAAI,IAAI,CAAC;IAE7B,SAAS,CACP,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,GAAG,IAAI,EACpB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,GACZ,IAAI,CAAC;IAER,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B,YAAY,IAAI,IAAI,CAAC;CACtB;;AAED,wBAEE"}
@@ -0,0 +1,201 @@
1
+ export interface TransformOptions {
2
+ /**
3
+ * The id is used to identify a transform. Can be used to remove or update it.
4
+ * When omitted it will be auto-generated.
5
+ */
6
+ id?: string;
7
+ /**
8
+ * Optional regex to be used as the condition, if the transform should be
9
+ * applied. When omitted the transform will always be applied.
10
+ *
11
+ * Global flags are (like `/i`) are not supported. Supports only inline flags, e.g. `(?i)` for case-insensitive matching.
12
+ */
13
+ match?: RegExp | string;
14
+ }
15
+ /**
16
+ * A serializable transform for rewriting MapLibre request URLs.
17
+ *
18
+ * Transforms are applied as a pipeline in the order they were added: transform N+1 sees
19
+ * the URL *after* transform N has possibly changed it.
20
+ */
21
+ export interface UrlTransformOptions extends TransformOptions {
22
+ /**
23
+ * Regex to find the portion of the URL to replace.
24
+ * Supports capture groups that can be back-referenced in `replace` as `$1`, `$2`, …
25
+ *
26
+ * Global flags are (like `/i`) are not supported. Supports only inline flags, e.g. `(?i)` for case-insensitive matching.
27
+ */
28
+ find: RegExp | string;
29
+ /**
30
+ * Replacement string. Reference capture groups from `find` with `$1`, `$2`, …
31
+ */
32
+ replace: string;
33
+ }
34
+ /**
35
+ * A URL query parameter to append to matching map resource requests.
36
+ */
37
+ export interface UrlSearchParamOptions extends TransformOptions {
38
+ /** The query parameter name (e.g., `"apiKey"`). */
39
+ name: string;
40
+ /** The query parameter value (e.g., your API key). */
41
+ value: string;
42
+ }
43
+ /**
44
+ * A HTTP header to send with matching map resource requests.
45
+ */
46
+ export interface HeaderOptions extends TransformOptions {
47
+ /** The header name (e.g., `"Authorization"`). */
48
+ name: string;
49
+ /** The header value (e.g., `"Bearer token123"`). */
50
+ value: string;
51
+ }
52
+ /**
53
+ * TransformRequestManager provides methods for managing HTTP requests made by MapLibre.
54
+ *
55
+ * Transformations are possible in three ways:
56
+ *
57
+ * 1. Transforming the URL with search and replace
58
+ * 2. Adding URL search params
59
+ * 3. Adding HTTP headers
60
+ *
61
+ * Transforms are applied in this order. The `match` conditions are applied to
62
+ * possibly already transformed URLs.
63
+ *
64
+ * @remarks
65
+ * To gain insight into which transforms are applied set the log level to
66
+ * `"debug"` via {@link LogManager}:
67
+ *
68
+ * ```ts
69
+ * LogManager.setLogLevel("debug");
70
+ * ```
71
+ */
72
+ declare class TransformRequestManager {
73
+ /**
74
+ * Adds or updates a URL transform identified by `id`.
75
+ *
76
+ * Transforms execute in insertion order. Therefore `match` and `find` regexes
77
+ * are matched against possibly already modified URL by previous transforms.
78
+ *
79
+ * Re-adding an existing `id` updates the transform
80
+ * **in-place**, preserving its position in the pipeline. This makes it safe to
81
+ * refresh tokens or swap domains without disrupting the order of other transforms.
82
+ *
83
+ * URL transforms are applied before `addUrlSearchParam` and `addHeader`.
84
+ *
85
+ * @example
86
+ * // Upgrade all requests to HTTPS
87
+ * TransformRequestManager.addUrlTransform({
88
+ * id: "force-https",
89
+ * find: "^http://",
90
+ * replace: "https://",
91
+ * });
92
+ *
93
+ * @example
94
+ * // Redirect a specific domain through a proxy
95
+ * TransformRequestManager.addUrlTransform({
96
+ * id: "proxy",
97
+ * match: "tiles\\.example\\.com",
98
+ * find: "tiles\\.example\\.com",
99
+ * replace: "proxy.example.com",
100
+ * });
101
+ *
102
+ * @example
103
+ * // Inject an API key into the path using a capture group
104
+ * TransformRequestManager.addUrlTransform({
105
+ * id: "api-key",
106
+ * match: "api\\.example\\.com",
107
+ * find: "(https://api\\.example\\.com/)(.*)",
108
+ * replace: "$1mySecretKey/$2",
109
+ * });
110
+ *
111
+ * @param options The transform. Set {@link TransformOptions.id} to a stable string to
112
+ * enable in-place updates; if omitted an id is auto-generated and returned.
113
+ *
114
+ * @returns The id of the transform (the value of `transform.id` when provided, otherwise
115
+ * the auto-generated one). Pass it to {@link removeUrlTransform} to remove it later.
116
+ */
117
+ addUrlTransform(options: UrlTransformOptions): string;
118
+ /**
119
+ * Removes the URL transform with the given `id`.
120
+ * No-op if the id is not registered.
121
+ *
122
+ * @param id The identifier passed to/returned from {@link addUrlTransform}.
123
+ */
124
+ removeUrlTransform(id: string): void;
125
+ /**
126
+ * Removes all registered URL transforms
127
+ */
128
+ clearUrlTransforms(): void;
129
+ /**
130
+ * Adds or updates a URL query parameter identified by `id` that will be appended to all
131
+ * matching map resource requests. Re-adding an existing `id` updates the param in-place.
132
+ *
133
+ * @example
134
+ * // Add apiKey to for a specific domain
135
+ * TransformRequestManager.addUrlSearchParam({
136
+ * match: /tiles\.example\.com/,
137
+ * name: "apiKey",
138
+ * value: "your-api-key",
139
+ * });
140
+ *
141
+ * // Add apiKey to all requests (no match = applies to all)
142
+ * TransformRequestManager.addUrlSearchParam({ name: "apiKey", value: "your-api-key" });
143
+ *
144
+ * @param options The options. Set {@link TransformOptions.id} to a stable string to
145
+ * enable in-place updates; if omitted an id is auto-generated and returned.
146
+ *
147
+ * @returns The id of the options. Pass it to {@link removeUrlSearchParam} to remove it later.
148
+ */
149
+ addUrlSearchParam(options: UrlSearchParamOptions): string;
150
+ /**
151
+ * Removes a previously added URL query parameter by its `id`.
152
+ *
153
+ * @param id The identifier passed to/returned from {@link addUrlSearchParam}.
154
+ */
155
+ removeUrlSearchParam(id: string): void;
156
+ /**
157
+ * Adds or updates an HTTP header identified by `id` that will be sent with all
158
+ * matching map resource requests. Re-adding an existing `id` updates the header in-place.
159
+ *
160
+ * @example
161
+ * // Add header to all requests
162
+ * TransformRequestManager.addHeader({ name: "Authorization", value: "Bearer token123" });
163
+ *
164
+ * // Add header only to requests matching a pattern
165
+ * TransformRequestManager.addHeader({
166
+ * name: "X-API-Key",
167
+ * value: "key123",
168
+ * match: /https:\/\/api\.example\.com\/tiles\//,
169
+ * });
170
+ *
171
+ * @param options The options. Set {@link TransformOptions.id} to a stable string to
172
+ * enable in-place updates; if omitted an id is auto-generated and returned.
173
+ *
174
+ * @returns The id of the options. Pass it to {@link removeHeader} to remove it later.
175
+ */
176
+ addHeader(options: HeaderOptions): string;
177
+ /**
178
+ * Removes all registered URL search params.
179
+ */
180
+ clearUrlSearchParams(): void;
181
+ /**
182
+ * Removes a previously added HTTP header by its `id`.
183
+ *
184
+ * @param id The identifier passed to/returned from {@link addHeader}.
185
+ */
186
+ removeHeader(id: string): void;
187
+ /**
188
+ * Removes all registered HTTP headers.
189
+ */
190
+ clearHeaders(): void;
191
+ /**
192
+ * Removes all registered URL transforms, URL search params and HTTP headers.
193
+ */
194
+ clear(): void;
195
+ private lastId;
196
+ private getId;
197
+ private static toRegexString;
198
+ }
199
+ declare const transformRequestManager: TransformRequestManager;
200
+ export { transformRequestManager as TransformRequestManager };
201
+ //# sourceMappingURL=TransformRequestManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TransformRequestManager.d.ts","sourceRoot":"","sources":["../../../../../src/modules/transform-request/TransformRequestManager.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACzB;AAED;;;;;GAKG;AACH,MAAM,WAAW,mBAAoB,SAAQ,gBAAgB;IAC3D;;;;;OAKG;IACH,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;IAEtB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,gBAAgB;IAC7D,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IAEb,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,gBAAgB;IACrD,iDAAiD;IACjD,IAAI,EAAE,MAAM,CAAC;IAEb,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,cAAM,uBAAuB;IAC3B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2CG;IACH,eAAe,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM;IAarD;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAIpC;;OAEG;IACH,kBAAkB,IAAI,IAAI;IAI1B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,iBAAiB,CAAC,OAAO,EAAE,qBAAqB,GAAG,MAAM;IAazD;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAItC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM;IAazC;;OAEG;IACH,oBAAoB,IAAI,IAAI;IAI5B;;;;OAIG;IACH,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAI9B;;OAEG;IACH,YAAY,IAAI,IAAI;IAIpB;;OAEG;IACH,KAAK,IAAI,IAAI;IAMb,OAAO,CAAC,MAAM,CAAc;IAE5B,OAAO,CAAC,KAAK;IAMb,OAAO,CAAC,MAAM,CAAC,aAAa;CAgB7B;AAED,QAAA,MAAM,uBAAuB,yBAAgC,CAAC;AAE9D,OAAO,EAAE,uBAAuB,IAAI,uBAAuB,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@maplibre/maplibre-react-native",
3
3
  "description": "React Native library for creating maps with MapLibre Native for Android & iOS",
4
- "version": "11.0.0-beta.19",
4
+ "version": "11.0.0-beta.20",
5
5
  "publishConfig": {
6
6
  "access": "public",
7
7
  "provenance": true
@@ -132,17 +132,6 @@
132
132
  "MLRNRasterSource": "MLRNRasterSourceComponentView",
133
133
  "MLRNGeoJSONSource": "MLRNGeoJSONSourceComponentView",
134
134
  "MLRNVectorSource": "MLRNVectorSourceComponentView"
135
- },
136
- "modulesProvider": {
137
- "MLRNCameraModule": "MLRNCameraModule",
138
- "MLRNGeoJSONSourceModule": "MLRNGeoJSONSourceModule",
139
- "MLRNImagesModule": "MLRNImagesModule",
140
- "MLRNLocationModule": "MLRNLocationModule",
141
- "MLRNLogModule": "MLRNLogModule",
142
- "MLRNMapViewModule": "MLRNMapViewModule",
143
- "MLRNOfflineModule": "MLRNOfflineModule",
144
- "MLRNStaticMapModule": "MLRNStaticMapModule",
145
- "MLRNVectorSourceModule": "MLRNVectorSourceModule"
146
135
  }
147
136
  }
148
137
  },
package/src/index.ts CHANGED
@@ -158,6 +158,14 @@ export {
158
158
  type StaticMapCreateOptions,
159
159
  } from "./modules/static-map/StaticMapManager";
160
160
 
161
+ export {
162
+ TransformRequestManager,
163
+ type TransformOptions,
164
+ type UrlTransformOptions,
165
+ type UrlSearchParamOptions,
166
+ type HeaderOptions,
167
+ } from "./modules/transform-request/TransformRequestManager";
168
+
161
169
  export type { Anchor } from "./types/Anchor";
162
170
  export type { LngLat } from "./types/LngLat";
163
171
  export type { LngLatBounds } from "./types/LngLatBounds";
@@ -2,10 +2,6 @@ import type { TurboModule } from "react-native";
2
2
  import { TurboModuleRegistry } from "react-native";
3
3
 
4
4
  export interface Spec extends TurboModule {
5
- addRequestHeader(name: string, value: string, match: string | null): void;
6
-
7
- removeRequestHeader(name: string): void;
8
-
9
5
  setConnected(connected: boolean): void;
10
6
  }
11
7
 
@@ -1,55 +1,9 @@
1
1
  import NativeNetworkModule from "./NativeNetworkModule";
2
2
 
3
3
  /**
4
- * NetworkManager provides methods for managing HTTP requests made by MapLibre.
5
- * This includes adding custom headers to tile requests and controlling network connectivity.
4
+ * NetworkManager provides methods for managing and controlling network connectivity.
6
5
  */
7
6
  class NetworkManager {
8
- /**
9
- * Adds a custom HTTP header that will be sent with all map tile requests.
10
- * This is useful for adding authentication tokens or other custom headers
11
- * required by your tile server.
12
- *
13
- * @example
14
- * // Add header to all requests
15
- * NetworkManager.addRequestHeader("Authorization", "Bearer token123");
16
- *
17
- * // Add header only to requests matching a regex pattern (string)
18
- * NetworkManager.addRequestHeader("X-API-Key", "key123", "https:\\/\\/api\\.example\\.com\\/tiles\\/");
19
- *
20
- * // Add header only to requests matching a regex pattern (RegExp)
21
- * NetworkManager.addRequestHeader("X-API-Key", "key123", /https:\/\/api\.example\.com\/tiles\//);
22
- *
23
- * @param name The name of the header (e.g., "Authorization")
24
- * @param value The value of the header (e.g., "Bearer token123")
25
- * @param match Optional regex pattern to match against network URLs. If provided, the header will only be added to requests whose URLs match this pattern. Can be a RegExp object or a regex string.
26
- */
27
- static addRequestHeader(
28
- name: string,
29
- value: string,
30
- match?: string | RegExp,
31
- ): void {
32
- NativeNetworkModule.addRequestHeader(
33
- name,
34
- value,
35
- (match instanceof RegExp ? match.source : match) || null,
36
- );
37
- }
38
-
39
- /**
40
- * Removes a previously added custom HTTP header.
41
- *
42
- * @example
43
- * ```ts
44
- * NetworkManager.removeRequestHeader("Authorization");
45
- * ```
46
- *
47
- * @param headerName The name of the header to remove
48
- */
49
- static removeRequestHeader(headerName: string): void {
50
- NativeNetworkModule.removeRequestHeader(headerName);
51
- }
52
-
53
7
  /**
54
8
  * Android only: Sets the connectivity state of the map. When set to false, the map will
55
9
  * not make any network requests and will only use cached tiles. This is