@vrplatform/api 1.3.1-stage.38528929357 → 1.3.1-stage.38530799777

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.
@@ -1 +1,6 @@
1
1
  export declare function getControlPlaneRequestUrl(method: string, url: URL): URL;
2
+ /**
3
+ * Whether the API places this request by its `x-data-region` header or its
4
+ * path instead of the `x-team-id` team's own region.
5
+ */
6
+ export declare function isRequestRegionRoute(method: string, url: URL): boolean;
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getControlPlaneRequestUrl = getControlPlaneRequestUrl;
4
+ exports.isRequestRegionRoute = isRequestRegionRoute;
4
5
  const routing_1 = require("./generated/routing");
5
- const routes = routing_1.controlPlaneRouting.routes.map(({ method, endpoint }) => ({
6
+ const toMatchers = (routeList) => routeList.map(({ method, endpoint }) => ({
6
7
  method,
7
8
  pattern: new RegExp(`^${endpoint
8
9
  .split('/')
@@ -11,6 +12,8 @@ const routes = routing_1.controlPlaneRouting.routes.map(({ method, endpoint }) =
11
12
  : segment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
12
13
  .join('/')}$`),
13
14
  }));
15
+ const routes = toMatchers(routing_1.controlPlaneRouting.routes);
16
+ const regionRoutes = toMatchers(routing_1.requestRegionRoutes);
14
17
  function getControlPlaneRequestUrl(method, url) {
15
18
  const origin = routing_1.controlPlaneRouting.origins[url.origin];
16
19
  if (!origin ||
@@ -21,4 +24,11 @@ function getControlPlaneRequestUrl(method, url) {
21
24
  target.host = new URL(origin).host;
22
25
  return target;
23
26
  }
27
+ /**
28
+ * Whether the API places this request by its `x-data-region` header or its
29
+ * path instead of the `x-team-id` team's own region.
30
+ */
31
+ function isRequestRegionRoute(method, url) {
32
+ return regionRoutes.some((route) => route.method === method && route.pattern.test(url.pathname));
33
+ }
24
34
  //# sourceMappingURL=control-plane-routing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-plane-routing.js","sourceRoot":"src/","sources":["control-plane-routing.ts"],"names":[],"mappings":";;AAgBA,8DAaC;AA7BD,iDAA0D;AAE1D,MAAM,MAAM,GAAG,6BAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;IACvE,MAAM;IACN,OAAO,EAAE,IAAI,MAAM,CACjB,IAAI,QAAQ;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CACf,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC9C,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CACnD;SACA,IAAI,CAAC,GAAG,CAAC,GAAG,CAChB;CACF,CAAC,CAAC,CAAC;AAEJ,SAAgB,yBAAyB,CAAC,MAAc,EAAE,GAAQ;IAChE,MAAM,MAAM,GAAG,6BAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACvD,IACE,CAAC,MAAM;QACP,CAAC,MAAM,CAAC,IAAI,CACV,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CACvE,EACD,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,MAAM,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;IACnC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { controlPlaneRouting } from './generated/routing';\n\nconst routes = controlPlaneRouting.routes.map(({ method, endpoint }) => ({\n method,\n pattern: new RegExp(\n `^${endpoint\n .split('/')\n .map((segment) =>\n segment.startsWith('{') && segment.endsWith('}')\n ? '[^/]+'\n : segment.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n )\n .join('/')}$`\n ),\n}));\n\nexport function getControlPlaneRequestUrl(method: string, url: URL): URL {\n const origin = controlPlaneRouting.origins[url.origin];\n if (\n !origin ||\n !routes.some(\n (route) => route.method === method && route.pattern.test(url.pathname)\n )\n ) {\n return url;\n }\n const target = new URL(url);\n target.host = new URL(origin).host;\n return target;\n}\n"]}
1
+ {"version":3,"file":"control-plane-routing.js","sourceRoot":"src/","sources":["control-plane-routing.ts"],"names":[],"mappings":";;AAsBA,8DAaC;AAMD,oDAIC;AA7CD,iDAA+E;AAE/E,MAAM,UAAU,GAAG,CACjB,SAA0D,EAC1D,EAAE,CACF,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;IACvC,MAAM;IACN,OAAO,EAAE,IAAI,MAAM,CACjB,IAAI,QAAQ;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CACf,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC9C,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CACnD;SACA,IAAI,CAAC,GAAG,CAAC,GAAG,CAChB;CACF,CAAC,CAAC,CAAC;AAEN,MAAM,MAAM,GAAG,UAAU,CAAC,6BAAmB,CAAC,MAAM,CAAC,CAAC;AACtD,MAAM,YAAY,GAAG,UAAU,CAAC,6BAAmB,CAAC,CAAC;AAErD,SAAgB,yBAAyB,CAAC,MAAc,EAAE,GAAQ;IAChE,MAAM,MAAM,GAAG,6BAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACvD,IACE,CAAC,MAAM;QACP,CAAC,MAAM,CAAC,IAAI,CACV,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CACvE,EACD,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,MAAM,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;IACnC,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAAC,MAAc,EAAE,GAAQ;IAC3D,OAAO,YAAY,CAAC,IAAI,CACtB,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CACvE,CAAC;AACJ,CAAC","sourcesContent":["import { controlPlaneRouting, requestRegionRoutes } from './generated/routing';\n\nconst toMatchers = (\n routeList: readonly { method: string; endpoint: string }[]\n) =>\n routeList.map(({ method, endpoint }) => ({\n method,\n pattern: new RegExp(\n `^${endpoint\n .split('/')\n .map((segment) =>\n segment.startsWith('{') && segment.endsWith('}')\n ? '[^/]+'\n : segment.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n )\n .join('/')}$`\n ),\n }));\n\nconst routes = toMatchers(controlPlaneRouting.routes);\nconst regionRoutes = toMatchers(requestRegionRoutes);\n\nexport function getControlPlaneRequestUrl(method: string, url: URL): URL {\n const origin = controlPlaneRouting.origins[url.origin];\n if (\n !origin ||\n !routes.some(\n (route) => route.method === method && route.pattern.test(url.pathname)\n )\n ) {\n return url;\n }\n const target = new URL(url);\n target.host = new URL(origin).host;\n return target;\n}\n\n/**\n * Whether the API places this request by its `x-data-region` header or its\n * path instead of the `x-team-id` team's own region.\n */\nexport function isRequestRegionRoute(method: string, url: URL) {\n return regionRoutes.some(\n (route) => route.method === method && route.pattern.test(url.pathname)\n );\n}\n"]}
@@ -5,3 +5,7 @@ export declare const controlPlaneRouting: {
5
5
  endpoint: string;
6
6
  }[];
7
7
  };
8
+ export declare const requestRegionRoutes: readonly {
9
+ method: string;
10
+ endpoint: string;
11
+ }[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.controlPlaneRouting = void 0;
3
+ exports.requestRegionRoutes = exports.controlPlaneRouting = void 0;
4
4
  // Generated by packages/client/openapi.ts from API route and deployment metadata.
5
5
  exports.controlPlaneRouting = {
6
6
  "origins": {
@@ -94,4 +94,195 @@ exports.controlPlaneRouting = {
94
94
  }
95
95
  ]
96
96
  };
97
+ // Routes the API places by `x-data-region` or path, not by `x-team-id`.
98
+ exports.requestRegionRoutes = [
99
+ {
100
+ "method": "DELETE",
101
+ "endpoint": "/internal/teams/{teamId}"
102
+ },
103
+ {
104
+ "method": "GET",
105
+ "endpoint": "/internal/memberships/{membershipId}"
106
+ },
107
+ {
108
+ "method": "GET",
109
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases"
110
+ },
111
+ {
112
+ "method": "GET",
113
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}"
114
+ },
115
+ {
116
+ "method": "GET",
117
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/evidence"
118
+ },
119
+ {
120
+ "method": "GET",
121
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/health"
122
+ },
123
+ {
124
+ "method": "GET",
125
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans"
126
+ },
127
+ {
128
+ "method": "GET",
129
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}"
130
+ },
131
+ {
132
+ "method": "GET",
133
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/runs"
134
+ },
135
+ {
136
+ "method": "GET",
137
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/runs/{runId}"
138
+ },
139
+ {
140
+ "method": "GET",
141
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/work-queue"
142
+ },
143
+ {
144
+ "method": "GET",
145
+ "endpoint": "/internal/teams/billing"
146
+ },
147
+ {
148
+ "method": "GET",
149
+ "endpoint": "/internal/users"
150
+ },
151
+ {
152
+ "method": "GET",
153
+ "endpoint": "/operations"
154
+ },
155
+ {
156
+ "method": "GET",
157
+ "endpoint": "/operations/{id}"
158
+ },
159
+ {
160
+ "method": "GET",
161
+ "endpoint": "/partner/audit-events"
162
+ },
163
+ {
164
+ "method": "GET",
165
+ "endpoint": "/partner/billing"
166
+ },
167
+ {
168
+ "method": "GET",
169
+ "endpoint": "/partner/connections"
170
+ },
171
+ {
172
+ "method": "GET",
173
+ "endpoint": "/partner/listings"
174
+ },
175
+ {
176
+ "method": "GET",
177
+ "endpoint": "/partner/owner-statements"
178
+ },
179
+ {
180
+ "method": "GET",
181
+ "endpoint": "/partner/users"
182
+ },
183
+ {
184
+ "method": "GET",
185
+ "endpoint": "/partner/users/{id}"
186
+ },
187
+ {
188
+ "method": "GET",
189
+ "endpoint": "/partner/vri-to-vrt/reservation-line-mappings"
190
+ },
191
+ {
192
+ "method": "GET",
193
+ "endpoint": "/partner/vri-to-vrt/statements/account-mappings"
194
+ },
195
+ {
196
+ "method": "GET",
197
+ "endpoint": "/partner/vri-to-vrt/statements/listing-mappings"
198
+ },
199
+ {
200
+ "method": "GET",
201
+ "endpoint": "/teams"
202
+ },
203
+ {
204
+ "method": "GET",
205
+ "endpoint": "/teams/issues"
206
+ },
207
+ {
208
+ "method": "GET",
209
+ "endpoint": "/teams/lookup"
210
+ },
211
+ {
212
+ "method": "POST",
213
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/claim"
214
+ },
215
+ {
216
+ "method": "POST",
217
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/release"
218
+ },
219
+ {
220
+ "method": "POST",
221
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/review"
222
+ },
223
+ {
224
+ "method": "POST",
225
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/previews"
226
+ },
227
+ {
228
+ "method": "POST",
229
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans"
230
+ },
231
+ {
232
+ "method": "POST",
233
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/cancel"
234
+ },
235
+ {
236
+ "method": "POST",
237
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/complete"
238
+ },
239
+ {
240
+ "method": "POST",
241
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/apply"
242
+ },
243
+ {
244
+ "method": "POST",
245
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/approve"
246
+ },
247
+ {
248
+ "method": "POST",
249
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/dry-run"
250
+ },
251
+ {
252
+ "method": "POST",
253
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/request-approval"
254
+ },
255
+ {
256
+ "method": "POST",
257
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/verify"
258
+ },
259
+ {
260
+ "method": "POST",
261
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/shadow-runs"
262
+ },
263
+ {
264
+ "method": "POST",
265
+ "endpoint": "/internal/teams/{teamId}/vri-vrt-preview"
266
+ },
267
+ {
268
+ "method": "POST",
269
+ "endpoint": "/internal/teams/{teamId}/vri-vrt-preview/activate"
270
+ },
271
+ {
272
+ "method": "POST",
273
+ "endpoint": "/partner/vri-to-vrt"
274
+ },
275
+ {
276
+ "method": "POST",
277
+ "endpoint": "/partner/vri-to-vrt/booking-channels"
278
+ },
279
+ {
280
+ "method": "POST",
281
+ "endpoint": "/partner/vri-to-vrt/cutover"
282
+ },
283
+ {
284
+ "method": "POST",
285
+ "endpoint": "/partner/vri-to-vrt/statements"
286
+ }
287
+ ];
97
288
  //# sourceMappingURL=routing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"routing.js","sourceRoot":"src/","sources":["generated/routing.ts"],"names":[],"mappings":";;;AAAA,kFAAkF;AACrE,QAAA,mBAAmB,GAG5B;IACF,SAAS,EAAE;QACT,4BAA4B,EAAE,+BAA+B;QAC7D,iCAAiC,EAAE,+BAA+B;QAClE,oCAAoC,EAAE,uCAAuC;QAC7E,yCAAyC,EAAE,uCAAuC;QAClF,uCAAuC,EAAE,uCAAuC;QAChF,uCAAuC,EAAE,uCAAuC;QAChF,uCAAuC,EAAE,uCAAuC;QAChF,+BAA+B,EAAE,+BAA+B;QAChE,+BAA+B,EAAE,+BAA+B;QAChE,+BAA+B,EAAE,+BAA+B;KACjE;IACD,QAAQ,EAAE;QACR;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,8BAA8B;SAC3C;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,kEAAkE;SAC/E;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,uDAAuD;SACpE;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,8DAA8D;SAC3E;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,oCAAoC;SACjD;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,8CAA8C;SAC3D;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,WAAW;SACxB;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,0BAA0B;SACvC;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,uCAAuC;SACpD;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,6DAA6D;SAC1E;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,0EAA0E;SACvF;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,2EAA2E;SACxF;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,8BAA8B;SAC3C;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,8CAA8C;SAC3D;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,4BAA4B;SACzC;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,iCAAiC;SAC9C;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,kEAAkE;SAC/E;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,4CAA4C;SACzD;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,oCAAoC;SACjD;KACF;CACF,CAAC","sourcesContent":["// Generated by packages/client/openapi.ts from API route and deployment metadata.\nexport const controlPlaneRouting: {\n readonly origins: Readonly<Record<string, string>>;\n readonly routes: readonly { method: string; endpoint: string }[];\n} = {\n \"origins\": {\n \"https://api.vrplatform.app\": \"https://us.api.vrplatform.app\",\n \"https://api.edge.vrplatform.app\": \"https://us.api.vrplatform.app\",\n \"https://staging.api.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://staging.api.edge.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://us.staging.api.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://eu.staging.api.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://ap.staging.api.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://us.api.vrplatform.app\": \"https://us.api.vrplatform.app\",\n \"https://eu.api.vrplatform.app\": \"https://us.api.vrplatform.app\",\n \"https://ap.api.vrplatform.app\": \"https://us.api.vrplatform.app\"\n },\n \"routes\": [\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/message-overwrites\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts/{id}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definitions\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definitions/{code}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/owner-portals/{hostname}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/owner-portals/{hostname}/providers\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/me/teams\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/embed-sessions/exchange\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/embed-sessions/frame-ancestor-policy\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts/{id}/publish\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts/{id}/validate\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/owner-portals/logo\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/owner-portals/{hostname}/providers\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/owner-portal-previews/end\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/owner-portal-previews/exchange\"\n },\n {\n \"method\": \"PUT\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts/{id}\"\n },\n {\n \"method\": \"PUT\",\n \"endpoint\": \"/internal/operations/grants/users/{userId}\"\n },\n {\n \"method\": \"PUT\",\n \"endpoint\": \"/internal/owner-portals/{hostname}\"\n }\n ]\n};\n"]}
1
+ {"version":3,"file":"routing.js","sourceRoot":"src/","sources":["generated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AAQ,EAAE,MAAM;QAChB,UAAU,EAAE,2FAA2F;KACxG;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,yGAAyG;KACtH;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,2GAA2G;KACxH;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,2GAA2G;KACxH;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,oHAAoH;KACjI;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,0GAA0G;KACvH;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,wEAAwE;KACrF;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,0CAA0C;KACvD;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,mDAAmD;KAChE;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,qBAAqB;KAClC;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,sCAAsC;KACnD;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,6BAA6B;KAC1C;IACD;QACE,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,gCAAgC;KAC7C;CACF,CAAC","sourcesContent":["// Generated by packages/client/openapi.ts from API route and deployment metadata.\nexport const controlPlaneRouting: {\n readonly origins: Readonly<Record<string, string>>;\n readonly routes: readonly { method: string; endpoint: string }[];\n} = {\n \"origins\": {\n \"https://api.vrplatform.app\": \"https://us.api.vrplatform.app\",\n \"https://api.edge.vrplatform.app\": \"https://us.api.vrplatform.app\",\n \"https://staging.api.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://staging.api.edge.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://us.staging.api.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://eu.staging.api.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://ap.staging.api.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://us.api.vrplatform.app\": \"https://us.api.vrplatform.app\",\n \"https://eu.api.vrplatform.app\": \"https://us.api.vrplatform.app\",\n \"https://ap.api.vrplatform.app\": \"https://us.api.vrplatform.app\"\n },\n \"routes\": [\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/message-overwrites\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts/{id}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definitions\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definitions/{code}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/owner-portals/{hostname}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/owner-portals/{hostname}/providers\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/me/teams\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/embed-sessions/exchange\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/embed-sessions/frame-ancestor-policy\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts/{id}/publish\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts/{id}/validate\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/owner-portals/logo\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/owner-portals/{hostname}/providers\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/owner-portal-previews/end\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/owner-portal-previews/exchange\"\n },\n {\n \"method\": \"PUT\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts/{id}\"\n },\n {\n \"method\": \"PUT\",\n \"endpoint\": \"/internal/operations/grants/users/{userId}\"\n },\n {\n \"method\": \"PUT\",\n \"endpoint\": \"/internal/owner-portals/{hostname}\"\n }\n ]\n};\n\n// Routes the API places by `x-data-region` or path, not by `x-team-id`.\nexport const requestRegionRoutes: readonly { method: string; endpoint: string }[] = [\n {\n \"method\": \"DELETE\",\n \"endpoint\": \"/internal/teams/{teamId}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/memberships/{membershipId}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/cases\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/evidence\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/health\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/runs\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/runs/{runId}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/work-queue\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/teams/billing\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/users\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/operations\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/operations/{id}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/audit-events\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/billing\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/connections\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/listings\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/owner-statements\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/users\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/users/{id}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/vri-to-vrt/reservation-line-mappings\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/vri-to-vrt/statements/account-mappings\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/vri-to-vrt/statements/listing-mappings\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/teams\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/teams/issues\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/teams/lookup\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/claim\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/release\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/review\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/previews\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/cancel\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/complete\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/apply\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/approve\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/dry-run\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/request-approval\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/verify\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/shadow-runs\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/teams/{teamId}/vri-vrt-preview\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/teams/{teamId}/vri-vrt-preview/activate\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/partner/vri-to-vrt\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/partner/vri-to-vrt/booking-channels\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/partner/vri-to-vrt/cutover\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/partner/vri-to-vrt/statements\"\n }\n];\n"]}
@@ -1 +1,6 @@
1
1
  export declare function getControlPlaneRequestUrl(method: string, url: URL): URL;
2
+ /**
3
+ * Whether the API places this request by its `x-data-region` header or its
4
+ * path instead of the `x-team-id` team's own region.
5
+ */
6
+ export declare function isRequestRegionRoute(method: string, url: URL): boolean;
@@ -1,5 +1,5 @@
1
- import { controlPlaneRouting } from './generated/routing';
2
- const routes = controlPlaneRouting.routes.map(({ method, endpoint }) => ({
1
+ import { controlPlaneRouting, requestRegionRoutes } from './generated/routing';
2
+ const toMatchers = (routeList) => routeList.map(({ method, endpoint }) => ({
3
3
  method,
4
4
  pattern: new RegExp(`^${endpoint
5
5
  .split('/')
@@ -8,6 +8,8 @@ const routes = controlPlaneRouting.routes.map(({ method, endpoint }) => ({
8
8
  : segment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'))
9
9
  .join('/')}$`),
10
10
  }));
11
+ const routes = toMatchers(controlPlaneRouting.routes);
12
+ const regionRoutes = toMatchers(requestRegionRoutes);
11
13
  export function getControlPlaneRequestUrl(method, url) {
12
14
  const origin = controlPlaneRouting.origins[url.origin];
13
15
  if (!origin ||
@@ -18,4 +20,11 @@ export function getControlPlaneRequestUrl(method, url) {
18
20
  target.host = new URL(origin).host;
19
21
  return target;
20
22
  }
23
+ /**
24
+ * Whether the API places this request by its `x-data-region` header or its
25
+ * path instead of the `x-team-id` team's own region.
26
+ */
27
+ export function isRequestRegionRoute(method, url) {
28
+ return regionRoutes.some((route) => route.method === method && route.pattern.test(url.pathname));
29
+ }
21
30
  //# sourceMappingURL=control-plane-routing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"control-plane-routing.js","sourceRoot":"src/","sources":["control-plane-routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,MAAM,GAAG,mBAAmB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC;IACvE,MAAM;IACN,OAAO,EAAE,IAAI,MAAM,CACjB,IAAI,QAAQ;SACT,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CACf,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC9C,CAAC,CAAC,OAAO;QACT,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CACnD;SACA,IAAI,CAAC,GAAG,CAAC,GAAG,CAChB;CACF,CAAC,CAAC,CAAC;AAEJ,MAAM,UAAU,yBAAyB,CAAC,MAAc,EAAE,GAAQ;IAChE,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACvD,IACE,CAAC,MAAM;QACP,CAAC,MAAM,CAAC,IAAI,CACV,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,KAAK,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CACvE,EACD,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IAC5B,MAAM,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;IACnC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { controlPlaneRouting } from './generated/routing';\n\nconst routes = controlPlaneRouting.routes.map(({ method, endpoint }) => ({\n method,\n pattern: new RegExp(\n `^${endpoint\n .split('/')\n .map((segment) =>\n segment.startsWith('{') && segment.endsWith('}')\n ? '[^/]+'\n : segment.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n )\n .join('/')}$`\n ),\n}));\n\nexport function getControlPlaneRequestUrl(method: string, url: URL): URL {\n const origin = controlPlaneRouting.origins[url.origin];\n if (\n !origin ||\n !routes.some(\n (route) => route.method === method && route.pattern.test(url.pathname)\n )\n ) {\n return url;\n }\n const target = new URL(url);\n target.host = new URL(origin).host;\n return target;\n}\n"]}
1
+ {"version":3,"file":"control-plane-routing.js","sourceRoot":"src/","sources":["control-plane-routing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/E,MAAM,UAAU,GAAG,CACjB,SAA0D,EAC1D,EAAE,CACF,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CA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CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CACvE,CAAC;AACJ,CAAC","sourcesContent":["import { controlPlaneRouting, requestRegionRoutes } from './generated/routing';\n\nconst toMatchers = (\n routeList: readonly { method: string; endpoint: string }[]\n) =>\n routeList.map(({ method, endpoint }) => ({\n method,\n pattern: new RegExp(\n `^${endpoint\n .split('/')\n .map((segment) =>\n segment.startsWith('{') && segment.endsWith('}')\n ? '[^/]+'\n : segment.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n )\n .join('/')}$`\n ),\n }));\n\nconst routes = toMatchers(controlPlaneRouting.routes);\nconst regionRoutes = toMatchers(requestRegionRoutes);\n\nexport function getControlPlaneRequestUrl(method: string, url: URL): URL {\n const origin = controlPlaneRouting.origins[url.origin];\n if (\n !origin ||\n !routes.some(\n (route) => route.method === method && route.pattern.test(url.pathname)\n )\n ) {\n return url;\n }\n const target = new URL(url);\n target.host = new URL(origin).host;\n return target;\n}\n\n/**\n * Whether the API places this request by its `x-data-region` header or its\n * path instead of the `x-team-id` team's own region.\n */\nexport function isRequestRegionRoute(method: string, url: URL) {\n return regionRoutes.some(\n (route) => route.method === method && route.pattern.test(url.pathname)\n );\n}\n"]}
@@ -5,3 +5,7 @@ export declare const controlPlaneRouting: {
5
5
  endpoint: string;
6
6
  }[];
7
7
  };
8
+ export declare const requestRegionRoutes: readonly {
9
+ method: string;
10
+ endpoint: string;
11
+ }[];
@@ -91,4 +91,195 @@ export const controlPlaneRouting = {
91
91
  }
92
92
  ]
93
93
  };
94
+ // Routes the API places by `x-data-region` or path, not by `x-team-id`.
95
+ export const requestRegionRoutes = [
96
+ {
97
+ "method": "DELETE",
98
+ "endpoint": "/internal/teams/{teamId}"
99
+ },
100
+ {
101
+ "method": "GET",
102
+ "endpoint": "/internal/memberships/{membershipId}"
103
+ },
104
+ {
105
+ "method": "GET",
106
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases"
107
+ },
108
+ {
109
+ "method": "GET",
110
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}"
111
+ },
112
+ {
113
+ "method": "GET",
114
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/evidence"
115
+ },
116
+ {
117
+ "method": "GET",
118
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/health"
119
+ },
120
+ {
121
+ "method": "GET",
122
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans"
123
+ },
124
+ {
125
+ "method": "GET",
126
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}"
127
+ },
128
+ {
129
+ "method": "GET",
130
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/runs"
131
+ },
132
+ {
133
+ "method": "GET",
134
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/runs/{runId}"
135
+ },
136
+ {
137
+ "method": "GET",
138
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/work-queue"
139
+ },
140
+ {
141
+ "method": "GET",
142
+ "endpoint": "/internal/teams/billing"
143
+ },
144
+ {
145
+ "method": "GET",
146
+ "endpoint": "/internal/users"
147
+ },
148
+ {
149
+ "method": "GET",
150
+ "endpoint": "/operations"
151
+ },
152
+ {
153
+ "method": "GET",
154
+ "endpoint": "/operations/{id}"
155
+ },
156
+ {
157
+ "method": "GET",
158
+ "endpoint": "/partner/audit-events"
159
+ },
160
+ {
161
+ "method": "GET",
162
+ "endpoint": "/partner/billing"
163
+ },
164
+ {
165
+ "method": "GET",
166
+ "endpoint": "/partner/connections"
167
+ },
168
+ {
169
+ "method": "GET",
170
+ "endpoint": "/partner/listings"
171
+ },
172
+ {
173
+ "method": "GET",
174
+ "endpoint": "/partner/owner-statements"
175
+ },
176
+ {
177
+ "method": "GET",
178
+ "endpoint": "/partner/users"
179
+ },
180
+ {
181
+ "method": "GET",
182
+ "endpoint": "/partner/users/{id}"
183
+ },
184
+ {
185
+ "method": "GET",
186
+ "endpoint": "/partner/vri-to-vrt/reservation-line-mappings"
187
+ },
188
+ {
189
+ "method": "GET",
190
+ "endpoint": "/partner/vri-to-vrt/statements/account-mappings"
191
+ },
192
+ {
193
+ "method": "GET",
194
+ "endpoint": "/partner/vri-to-vrt/statements/listing-mappings"
195
+ },
196
+ {
197
+ "method": "GET",
198
+ "endpoint": "/teams"
199
+ },
200
+ {
201
+ "method": "GET",
202
+ "endpoint": "/teams/issues"
203
+ },
204
+ {
205
+ "method": "GET",
206
+ "endpoint": "/teams/lookup"
207
+ },
208
+ {
209
+ "method": "POST",
210
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/claim"
211
+ },
212
+ {
213
+ "method": "POST",
214
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/release"
215
+ },
216
+ {
217
+ "method": "POST",
218
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/review"
219
+ },
220
+ {
221
+ "method": "POST",
222
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/previews"
223
+ },
224
+ {
225
+ "method": "POST",
226
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans"
227
+ },
228
+ {
229
+ "method": "POST",
230
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/cancel"
231
+ },
232
+ {
233
+ "method": "POST",
234
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/complete"
235
+ },
236
+ {
237
+ "method": "POST",
238
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/apply"
239
+ },
240
+ {
241
+ "method": "POST",
242
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/approve"
243
+ },
244
+ {
245
+ "method": "POST",
246
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/dry-run"
247
+ },
248
+ {
249
+ "method": "POST",
250
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/request-approval"
251
+ },
252
+ {
253
+ "method": "POST",
254
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/verify"
255
+ },
256
+ {
257
+ "method": "POST",
258
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/shadow-runs"
259
+ },
260
+ {
261
+ "method": "POST",
262
+ "endpoint": "/internal/teams/{teamId}/vri-vrt-preview"
263
+ },
264
+ {
265
+ "method": "POST",
266
+ "endpoint": "/internal/teams/{teamId}/vri-vrt-preview/activate"
267
+ },
268
+ {
269
+ "method": "POST",
270
+ "endpoint": "/partner/vri-to-vrt"
271
+ },
272
+ {
273
+ "method": "POST",
274
+ "endpoint": "/partner/vri-to-vrt/booking-channels"
275
+ },
276
+ {
277
+ "method": "POST",
278
+ "endpoint": "/partner/vri-to-vrt/cutover"
279
+ },
280
+ {
281
+ "method": "POST",
282
+ "endpoint": "/partner/vri-to-vrt/statements"
283
+ }
284
+ ];
94
285
  //# sourceMappingURL=routing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"routing.js","sourceRoot":"src/","sources":["generated/routing.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,CAAC,MAAM,mBAAmB,GAG5B;IACF,SAAS,EAAE;QACT,4BAA4B,EAAE,+BAA+B;QAC7D,iCAAiC,EAAE,+BAA+B;QAClE,oCAAoC,EAAE,uCAAuC;QAC7E,yCAAyC,EAAE,uCAAuC;QAClF,uCAAuC,EAAE,uCAAuC;QAChF,uCAAuC,EAAE,uCAAuC;QAChF,uCAAuC,EAAE,uCAAuC;QAChF,+BAA+B,EAAE,+BAA+B;QAChE,+BAA+B,EAAE,+BAA+B;QAChE,+BAA+B,EAAE,+BAA+B;KACjE;IACD,QAAQ,EAAE;QACR;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,8BAA8B;SAC3C;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,kEAAkE;SAC/E;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,uDAAuD;SACpE;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,8DAA8D;SAC3E;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,oCAAoC;SACjD;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,8CAA8C;SAC3D;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,WAAW;SACxB;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,0BAA0B;SACvC;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,uCAAuC;SACpD;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,6DAA6D;SAC1E;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,0EAA0E;SACvF;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,2EAA2E;SACxF;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,8BAA8B;SAC3C;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,8CAA8C;SAC3D;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,4BAA4B;SACzC;QACD;YACE,QAAQ,EAAE,MAAM;YAChB,UAAU,EAAE,iCAAiC;SAC9C;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,kEAAkE;SAC/E;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,4CAA4C;SACzD;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,oCAAoC;SACjD;KACF;CACF,CAAC","sourcesContent":["// Generated by packages/client/openapi.ts from API route and deployment metadata.\nexport const controlPlaneRouting: {\n readonly origins: Readonly<Record<string, string>>;\n readonly routes: readonly { method: string; endpoint: string }[];\n} = {\n \"origins\": {\n \"https://api.vrplatform.app\": \"https://us.api.vrplatform.app\",\n \"https://api.edge.vrplatform.app\": \"https://us.api.vrplatform.app\",\n \"https://staging.api.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://staging.api.edge.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://us.staging.api.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://eu.staging.api.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://ap.staging.api.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://us.api.vrplatform.app\": \"https://us.api.vrplatform.app\",\n \"https://eu.api.vrplatform.app\": \"https://us.api.vrplatform.app\",\n \"https://ap.api.vrplatform.app\": \"https://us.api.vrplatform.app\"\n },\n \"routes\": [\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/message-overwrites\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts/{id}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definitions\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definitions/{code}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/owner-portals/{hostname}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/owner-portals/{hostname}/providers\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/me/teams\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/embed-sessions/exchange\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/embed-sessions/frame-ancestor-policy\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts/{id}/publish\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts/{id}/validate\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/owner-portals/logo\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/owner-portals/{hostname}/providers\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/owner-portal-previews/end\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/owner-portal-previews/exchange\"\n },\n {\n \"method\": \"PUT\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts/{id}\"\n },\n {\n \"method\": \"PUT\",\n \"endpoint\": \"/internal/operations/grants/users/{userId}\"\n },\n {\n \"method\": \"PUT\",\n \"endpoint\": \"/internal/owner-portals/{hostname}\"\n }\n ]\n};\n"]}
1
+ {"version":3,"file":"routing.js","sourceRoot":"src/","sources":["generated/routing.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,MAAM,CAAC,MAAM,mBAAmB,GAG5B;IACF,SAAS,EAAE;QACT,4BAA4B,EAAE,+BAA+B;QAC7D,iCAAiC,EAAE,+BAA+B;QAClE,oCAAoC,EAAE,uCAAuC;QAC7E,yCAAyC,EAAE,uCAAuC;QAClF,uCAAuC,EAAE,uCAAuC;QAChF,uCAAuC,EAAE,uCAAuC;QAChF,uCAAuC,EAAE,uCAAuC;QAChF,+BAA+B,EAAE,+BAA+B;QAChE,+BAA+B,EAAE,+BAA+B;QAChE,+BAA+B,EAAE,+BAA+B;KACjE;IACD,QAAQ,EAAE;QACR;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,8BAA8B;SAC3C;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,kEAAkE;SAC/E;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,uDAAuD;SACpE;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,8DAA8D;SAC3E;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,oCAAoC;SACjD;QACD;YACE,QAAQ,EAAE,KAAK;YACf,UAAU,EAAE,8CAA8C;SAC3D;QACD;YACE,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AAU,EAAE,gCAAgC;KAC7C;CACF,CAAC","sourcesContent":["// Generated by packages/client/openapi.ts from API route and deployment metadata.\nexport const controlPlaneRouting: {\n readonly origins: Readonly<Record<string, string>>;\n readonly routes: readonly { method: string; endpoint: string }[];\n} = {\n \"origins\": {\n \"https://api.vrplatform.app\": \"https://us.api.vrplatform.app\",\n \"https://api.edge.vrplatform.app\": \"https://us.api.vrplatform.app\",\n \"https://staging.api.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://staging.api.edge.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://us.staging.api.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://eu.staging.api.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://ap.staging.api.vrplatform.app\": \"https://us.staging.api.vrplatform.app\",\n \"https://us.api.vrplatform.app\": \"https://us.api.vrplatform.app\",\n \"https://eu.api.vrplatform.app\": \"https://us.api.vrplatform.app\",\n \"https://ap.api.vrplatform.app\": \"https://us.api.vrplatform.app\"\n },\n \"routes\": [\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/message-overwrites\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts/{id}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definitions\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definitions/{code}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/owner-portals/{hostname}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/owner-portals/{hostname}/providers\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/me/teams\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/embed-sessions/exchange\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/embed-sessions/frame-ancestor-policy\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts/{id}/publish\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts/{id}/validate\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/owner-portals/logo\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/owner-portals/{hostname}/providers\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/owner-portal-previews/end\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/owner-portal-previews/exchange\"\n },\n {\n \"method\": \"PUT\",\n \"endpoint\": \"/internal/operations/accounting-integrity/definition-drafts/{id}\"\n },\n {\n \"method\": \"PUT\",\n \"endpoint\": \"/internal/operations/grants/users/{userId}\"\n },\n {\n \"method\": \"PUT\",\n \"endpoint\": \"/internal/owner-portals/{hostname}\"\n }\n ]\n};\n\n// Routes the API places by `x-data-region` or path, not by `x-team-id`.\nexport const requestRegionRoutes: readonly { method: string; endpoint: string }[] = [\n {\n \"method\": \"DELETE\",\n \"endpoint\": \"/internal/teams/{teamId}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/memberships/{membershipId}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/cases\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/evidence\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/health\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/runs\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/runs/{runId}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/work-queue\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/teams/billing\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/internal/users\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/operations\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/operations/{id}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/audit-events\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/billing\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/connections\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/listings\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/owner-statements\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/users\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/users/{id}\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/vri-to-vrt/reservation-line-mappings\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/vri-to-vrt/statements/account-mappings\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/partner/vri-to-vrt/statements/listing-mappings\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/teams\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/teams/issues\"\n },\n {\n \"method\": \"GET\",\n \"endpoint\": \"/teams/lookup\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/claim\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/release\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/review\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/previews\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/cancel\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/complete\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/apply\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/approve\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/dry-run\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/request-approval\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/verify\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/operations/accounting-integrity/regions/{region}/shadow-runs\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/teams/{teamId}/vri-vrt-preview\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/internal/teams/{teamId}/vri-vrt-preview/activate\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/partner/vri-to-vrt\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/partner/vri-to-vrt/booking-channels\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/partner/vri-to-vrt/cutover\"\n },\n {\n \"method\": \"POST\",\n \"endpoint\": \"/partner/vri-to-vrt/statements\"\n }\n];\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.3.1-stage.38528929357",
6
+ "version": "1.3.1-stage.38530799777",
7
7
  "description": "",
8
8
  "main": "build/main/index.js",
9
9
  "module": "build/module/index.js",
@@ -1,18 +1,24 @@
1
- import { controlPlaneRouting } from './generated/routing';
1
+ import { controlPlaneRouting, requestRegionRoutes } from './generated/routing';
2
2
 
3
- const routes = controlPlaneRouting.routes.map(({ method, endpoint }) => ({
4
- method,
5
- pattern: new RegExp(
6
- `^${endpoint
7
- .split('/')
8
- .map((segment) =>
9
- segment.startsWith('{') && segment.endsWith('}')
10
- ? '[^/]+'
11
- : segment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
12
- )
13
- .join('/')}$`
14
- ),
15
- }));
3
+ const toMatchers = (
4
+ routeList: readonly { method: string; endpoint: string }[]
5
+ ) =>
6
+ routeList.map(({ method, endpoint }) => ({
7
+ method,
8
+ pattern: new RegExp(
9
+ `^${endpoint
10
+ .split('/')
11
+ .map((segment) =>
12
+ segment.startsWith('{') && segment.endsWith('}')
13
+ ? '[^/]+'
14
+ : segment.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
15
+ )
16
+ .join('/')}$`
17
+ ),
18
+ }));
19
+
20
+ const routes = toMatchers(controlPlaneRouting.routes);
21
+ const regionRoutes = toMatchers(requestRegionRoutes);
16
22
 
17
23
  export function getControlPlaneRequestUrl(method: string, url: URL): URL {
18
24
  const origin = controlPlaneRouting.origins[url.origin];
@@ -28,3 +34,13 @@ export function getControlPlaneRequestUrl(method: string, url: URL): URL {
28
34
  target.host = new URL(origin).host;
29
35
  return target;
30
36
  }
37
+
38
+ /**
39
+ * Whether the API places this request by its `x-data-region` header or its
40
+ * path instead of the `x-team-id` team's own region.
41
+ */
42
+ export function isRequestRegionRoute(method: string, url: URL) {
43
+ return regionRoutes.some(
44
+ (route) => route.method === method && route.pattern.test(url.pathname)
45
+ );
46
+ }
@@ -94,3 +94,195 @@ export const controlPlaneRouting: {
94
94
  }
95
95
  ]
96
96
  };
97
+
98
+ // Routes the API places by `x-data-region` or path, not by `x-team-id`.
99
+ export const requestRegionRoutes: readonly { method: string; endpoint: string }[] = [
100
+ {
101
+ "method": "DELETE",
102
+ "endpoint": "/internal/teams/{teamId}"
103
+ },
104
+ {
105
+ "method": "GET",
106
+ "endpoint": "/internal/memberships/{membershipId}"
107
+ },
108
+ {
109
+ "method": "GET",
110
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases"
111
+ },
112
+ {
113
+ "method": "GET",
114
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}"
115
+ },
116
+ {
117
+ "method": "GET",
118
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/evidence"
119
+ },
120
+ {
121
+ "method": "GET",
122
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/health"
123
+ },
124
+ {
125
+ "method": "GET",
126
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans"
127
+ },
128
+ {
129
+ "method": "GET",
130
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}"
131
+ },
132
+ {
133
+ "method": "GET",
134
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/runs"
135
+ },
136
+ {
137
+ "method": "GET",
138
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/runs/{runId}"
139
+ },
140
+ {
141
+ "method": "GET",
142
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/work-queue"
143
+ },
144
+ {
145
+ "method": "GET",
146
+ "endpoint": "/internal/teams/billing"
147
+ },
148
+ {
149
+ "method": "GET",
150
+ "endpoint": "/internal/users"
151
+ },
152
+ {
153
+ "method": "GET",
154
+ "endpoint": "/operations"
155
+ },
156
+ {
157
+ "method": "GET",
158
+ "endpoint": "/operations/{id}"
159
+ },
160
+ {
161
+ "method": "GET",
162
+ "endpoint": "/partner/audit-events"
163
+ },
164
+ {
165
+ "method": "GET",
166
+ "endpoint": "/partner/billing"
167
+ },
168
+ {
169
+ "method": "GET",
170
+ "endpoint": "/partner/connections"
171
+ },
172
+ {
173
+ "method": "GET",
174
+ "endpoint": "/partner/listings"
175
+ },
176
+ {
177
+ "method": "GET",
178
+ "endpoint": "/partner/owner-statements"
179
+ },
180
+ {
181
+ "method": "GET",
182
+ "endpoint": "/partner/users"
183
+ },
184
+ {
185
+ "method": "GET",
186
+ "endpoint": "/partner/users/{id}"
187
+ },
188
+ {
189
+ "method": "GET",
190
+ "endpoint": "/partner/vri-to-vrt/reservation-line-mappings"
191
+ },
192
+ {
193
+ "method": "GET",
194
+ "endpoint": "/partner/vri-to-vrt/statements/account-mappings"
195
+ },
196
+ {
197
+ "method": "GET",
198
+ "endpoint": "/partner/vri-to-vrt/statements/listing-mappings"
199
+ },
200
+ {
201
+ "method": "GET",
202
+ "endpoint": "/teams"
203
+ },
204
+ {
205
+ "method": "GET",
206
+ "endpoint": "/teams/issues"
207
+ },
208
+ {
209
+ "method": "GET",
210
+ "endpoint": "/teams/lookup"
211
+ },
212
+ {
213
+ "method": "POST",
214
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/claim"
215
+ },
216
+ {
217
+ "method": "POST",
218
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/release"
219
+ },
220
+ {
221
+ "method": "POST",
222
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/cases/{caseId}/review"
223
+ },
224
+ {
225
+ "method": "POST",
226
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/previews"
227
+ },
228
+ {
229
+ "method": "POST",
230
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans"
231
+ },
232
+ {
233
+ "method": "POST",
234
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/cancel"
235
+ },
236
+ {
237
+ "method": "POST",
238
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/complete"
239
+ },
240
+ {
241
+ "method": "POST",
242
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/apply"
243
+ },
244
+ {
245
+ "method": "POST",
246
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/approve"
247
+ },
248
+ {
249
+ "method": "POST",
250
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/dry-run"
251
+ },
252
+ {
253
+ "method": "POST",
254
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/request-approval"
255
+ },
256
+ {
257
+ "method": "POST",
258
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/repair-plans/{planId}/stages/{ordinal}/verify"
259
+ },
260
+ {
261
+ "method": "POST",
262
+ "endpoint": "/internal/operations/accounting-integrity/regions/{region}/shadow-runs"
263
+ },
264
+ {
265
+ "method": "POST",
266
+ "endpoint": "/internal/teams/{teamId}/vri-vrt-preview"
267
+ },
268
+ {
269
+ "method": "POST",
270
+ "endpoint": "/internal/teams/{teamId}/vri-vrt-preview/activate"
271
+ },
272
+ {
273
+ "method": "POST",
274
+ "endpoint": "/partner/vri-to-vrt"
275
+ },
276
+ {
277
+ "method": "POST",
278
+ "endpoint": "/partner/vri-to-vrt/booking-channels"
279
+ },
280
+ {
281
+ "method": "POST",
282
+ "endpoint": "/partner/vri-to-vrt/cutover"
283
+ },
284
+ {
285
+ "method": "POST",
286
+ "endpoint": "/partner/vri-to-vrt/statements"
287
+ }
288
+ ];