@flipdish/authorization 0.0.671-rc.1794575868 → 0.0.673-rc.1794584635

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs ADDED
@@ -0,0 +1,1928 @@
1
+ // src/gen/core/bodySerializer.gen.ts
2
+ var jsonBodySerializer = {
3
+ bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value)
4
+ };
5
+
6
+ // src/gen/core/serverSentEvents.gen.ts
7
+ function createSseClient({
8
+ onRequest,
9
+ onSseError,
10
+ onSseEvent,
11
+ responseTransformer,
12
+ responseValidator,
13
+ sseDefaultRetryDelay,
14
+ sseMaxRetryAttempts,
15
+ sseMaxRetryDelay,
16
+ sseSleepFn,
17
+ url,
18
+ ...options
19
+ }) {
20
+ let lastEventId;
21
+ const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
22
+ const createStream = async function* () {
23
+ let retryDelay = sseDefaultRetryDelay ?? 3e3;
24
+ let attempt = 0;
25
+ const signal = options.signal ?? new AbortController().signal;
26
+ while (true) {
27
+ if (signal.aborted) break;
28
+ attempt++;
29
+ const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
30
+ if (lastEventId !== void 0) {
31
+ headers.set("Last-Event-ID", lastEventId);
32
+ }
33
+ try {
34
+ const requestInit = {
35
+ redirect: "follow",
36
+ ...options,
37
+ body: options.serializedBody,
38
+ headers,
39
+ signal
40
+ };
41
+ let request = new Request(url, requestInit);
42
+ if (onRequest) {
43
+ request = await onRequest(url, requestInit);
44
+ }
45
+ const _fetch = options.fetch ?? globalThis.fetch;
46
+ const response = await _fetch(request);
47
+ if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
48
+ if (!response.body) throw new Error("No body in SSE response");
49
+ const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
50
+ let buffer = "";
51
+ const abortHandler = () => {
52
+ try {
53
+ reader.cancel();
54
+ } catch {
55
+ }
56
+ };
57
+ signal.addEventListener("abort", abortHandler);
58
+ try {
59
+ while (true) {
60
+ const { done, value } = await reader.read();
61
+ if (done) break;
62
+ buffer += value;
63
+ buffer = buffer.replace(/\r\n?/g, "\n");
64
+ const chunks = buffer.split("\n\n");
65
+ buffer = chunks.pop() ?? "";
66
+ for (const chunk of chunks) {
67
+ const lines = chunk.split("\n");
68
+ const dataLines = [];
69
+ let eventName;
70
+ for (const line of lines) {
71
+ if (line.startsWith("data:")) {
72
+ dataLines.push(line.replace(/^data:\s*/, ""));
73
+ } else if (line.startsWith("event:")) {
74
+ eventName = line.replace(/^event:\s*/, "");
75
+ } else if (line.startsWith("id:")) {
76
+ lastEventId = line.replace(/^id:\s*/, "");
77
+ } else if (line.startsWith("retry:")) {
78
+ const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
79
+ if (!Number.isNaN(parsed)) {
80
+ retryDelay = parsed;
81
+ }
82
+ }
83
+ }
84
+ let data;
85
+ let parsedJson = false;
86
+ if (dataLines.length) {
87
+ const rawData = dataLines.join("\n");
88
+ try {
89
+ data = JSON.parse(rawData);
90
+ parsedJson = true;
91
+ } catch {
92
+ data = rawData;
93
+ }
94
+ }
95
+ if (parsedJson) {
96
+ if (responseValidator) {
97
+ await responseValidator(data);
98
+ }
99
+ if (responseTransformer) {
100
+ data = await responseTransformer(data);
101
+ }
102
+ }
103
+ onSseEvent?.({
104
+ data,
105
+ event: eventName,
106
+ id: lastEventId,
107
+ retry: retryDelay
108
+ });
109
+ if (dataLines.length) {
110
+ yield data;
111
+ }
112
+ }
113
+ }
114
+ } finally {
115
+ signal.removeEventListener("abort", abortHandler);
116
+ reader.releaseLock();
117
+ }
118
+ break;
119
+ } catch (error) {
120
+ onSseError?.(error);
121
+ if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
122
+ break;
123
+ }
124
+ const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4);
125
+ await sleep(backoff);
126
+ }
127
+ }
128
+ };
129
+ const stream = createStream();
130
+ return { stream };
131
+ }
132
+
133
+ // src/gen/core/pathSerializer.gen.ts
134
+ var separatorArrayExplode = (style) => {
135
+ switch (style) {
136
+ case "label":
137
+ return ".";
138
+ case "matrix":
139
+ return ";";
140
+ case "simple":
141
+ return ",";
142
+ default:
143
+ return "&";
144
+ }
145
+ };
146
+ var separatorArrayNoExplode = (style) => {
147
+ switch (style) {
148
+ case "form":
149
+ return ",";
150
+ case "pipeDelimited":
151
+ return "|";
152
+ case "spaceDelimited":
153
+ return "%20";
154
+ default:
155
+ return ",";
156
+ }
157
+ };
158
+ var separatorObjectExplode = (style) => {
159
+ switch (style) {
160
+ case "label":
161
+ return ".";
162
+ case "matrix":
163
+ return ";";
164
+ case "simple":
165
+ return ",";
166
+ default:
167
+ return "&";
168
+ }
169
+ };
170
+ var serializeArrayParam = ({
171
+ allowReserved,
172
+ explode,
173
+ name,
174
+ style,
175
+ value
176
+ }) => {
177
+ if (!explode) {
178
+ const joinedValues2 = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
179
+ switch (style) {
180
+ case "label":
181
+ return `.${joinedValues2}`;
182
+ case "matrix":
183
+ return `;${name}=${joinedValues2}`;
184
+ case "simple":
185
+ return joinedValues2;
186
+ default:
187
+ return `${name}=${joinedValues2}`;
188
+ }
189
+ }
190
+ const separator = separatorArrayExplode(style);
191
+ const joinedValues = value.map((v) => {
192
+ if (style === "label" || style === "simple") {
193
+ return allowReserved ? v : encodeURIComponent(v);
194
+ }
195
+ return serializePrimitiveParam({
196
+ allowReserved,
197
+ name,
198
+ value: v
199
+ });
200
+ }).join(separator);
201
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
202
+ };
203
+ var serializePrimitiveParam = ({
204
+ allowReserved,
205
+ name,
206
+ value
207
+ }) => {
208
+ if (value === void 0 || value === null) {
209
+ return "";
210
+ }
211
+ if (typeof value === "object") {
212
+ throw new Error(
213
+ "Deeply-nested arrays/objects aren\u2019t supported. Provide your own `querySerializer()` to handle these."
214
+ );
215
+ }
216
+ return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
217
+ };
218
+ var serializeObjectParam = ({
219
+ allowReserved,
220
+ explode,
221
+ name,
222
+ style,
223
+ value,
224
+ valueOnly
225
+ }) => {
226
+ if (value instanceof Date) {
227
+ return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
228
+ }
229
+ if (style !== "deepObject" && !explode) {
230
+ let values = [];
231
+ Object.entries(value).forEach(([key, v]) => {
232
+ values = [...values, key, allowReserved ? v : encodeURIComponent(v)];
233
+ });
234
+ const joinedValues2 = values.join(",");
235
+ switch (style) {
236
+ case "form":
237
+ return `${name}=${joinedValues2}`;
238
+ case "label":
239
+ return `.${joinedValues2}`;
240
+ case "matrix":
241
+ return `;${name}=${joinedValues2}`;
242
+ default:
243
+ return joinedValues2;
244
+ }
245
+ }
246
+ const separator = separatorObjectExplode(style);
247
+ const joinedValues = Object.entries(value).map(
248
+ ([key, v]) => serializePrimitiveParam({
249
+ allowReserved,
250
+ name: style === "deepObject" ? `${name}[${key}]` : key,
251
+ value: v
252
+ })
253
+ ).join(separator);
254
+ return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
255
+ };
256
+
257
+ // src/gen/core/utils.gen.ts
258
+ var PATH_PARAM_RE = /\{[^{}]+\}/g;
259
+ var defaultPathSerializer = ({ path, url: _url }) => {
260
+ let url = _url;
261
+ const matches = _url.match(PATH_PARAM_RE);
262
+ if (matches) {
263
+ for (const match of matches) {
264
+ let explode = false;
265
+ let name = match.substring(1, match.length - 1);
266
+ let style = "simple";
267
+ if (name.endsWith("*")) {
268
+ explode = true;
269
+ name = name.substring(0, name.length - 1);
270
+ }
271
+ if (name.startsWith(".")) {
272
+ name = name.substring(1);
273
+ style = "label";
274
+ } else if (name.startsWith(";")) {
275
+ name = name.substring(1);
276
+ style = "matrix";
277
+ }
278
+ const value = path[name];
279
+ if (value === void 0 || value === null) {
280
+ continue;
281
+ }
282
+ if (Array.isArray(value)) {
283
+ url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
284
+ continue;
285
+ }
286
+ if (typeof value === "object") {
287
+ url = url.replace(
288
+ match,
289
+ serializeObjectParam({
290
+ explode,
291
+ name,
292
+ style,
293
+ value,
294
+ valueOnly: true
295
+ })
296
+ );
297
+ continue;
298
+ }
299
+ if (style === "matrix") {
300
+ url = url.replace(
301
+ match,
302
+ `;${serializePrimitiveParam({
303
+ name,
304
+ value
305
+ })}`
306
+ );
307
+ continue;
308
+ }
309
+ const replaceValue = encodeURIComponent(
310
+ style === "label" ? `.${value}` : value
311
+ );
312
+ url = url.replace(match, replaceValue);
313
+ }
314
+ }
315
+ return url;
316
+ };
317
+ var getUrl = ({
318
+ baseUrl,
319
+ path,
320
+ query,
321
+ querySerializer,
322
+ url: _url
323
+ }) => {
324
+ const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
325
+ let url = (baseUrl ?? "") + pathUrl;
326
+ if (path) {
327
+ url = defaultPathSerializer({ path, url });
328
+ }
329
+ let search = query ? querySerializer(query) : "";
330
+ if (search.startsWith("?")) {
331
+ search = search.substring(1);
332
+ }
333
+ if (search) {
334
+ url += `?${search}`;
335
+ }
336
+ return url;
337
+ };
338
+ function getValidRequestBody(options) {
339
+ const hasBody = options.body !== void 0;
340
+ const isSerializedBody = hasBody && options.bodySerializer;
341
+ if (isSerializedBody) {
342
+ if ("serializedBody" in options) {
343
+ const hasSerializedBody = options.serializedBody !== void 0 && options.serializedBody !== "";
344
+ return hasSerializedBody ? options.serializedBody : null;
345
+ }
346
+ return options.body !== "" ? options.body : null;
347
+ }
348
+ if (hasBody) {
349
+ return options.body;
350
+ }
351
+ return void 0;
352
+ }
353
+
354
+ // src/gen/core/auth.gen.ts
355
+ var getAuthToken = async (auth, callback) => {
356
+ const token = typeof callback === "function" ? await callback(auth) : callback;
357
+ if (!token) {
358
+ return;
359
+ }
360
+ if (auth.scheme === "bearer") {
361
+ return `Bearer ${token}`;
362
+ }
363
+ if (auth.scheme === "basic") {
364
+ return `Basic ${btoa(token)}`;
365
+ }
366
+ return token;
367
+ };
368
+
369
+ // src/gen/client/utils.gen.ts
370
+ var createQuerySerializer = ({
371
+ parameters = {},
372
+ ...args
373
+ } = {}) => {
374
+ const querySerializer = (queryParams) => {
375
+ const search = [];
376
+ if (queryParams && typeof queryParams === "object") {
377
+ for (const name in queryParams) {
378
+ const value = queryParams[name];
379
+ if (value === void 0 || value === null) {
380
+ continue;
381
+ }
382
+ const options = parameters[name] || args;
383
+ if (Array.isArray(value)) {
384
+ const serializedArray = serializeArrayParam({
385
+ allowReserved: options.allowReserved,
386
+ explode: true,
387
+ name,
388
+ style: "form",
389
+ value,
390
+ ...options.array
391
+ });
392
+ if (serializedArray) search.push(serializedArray);
393
+ } else if (typeof value === "object") {
394
+ const serializedObject = serializeObjectParam({
395
+ allowReserved: options.allowReserved,
396
+ explode: true,
397
+ name,
398
+ style: "deepObject",
399
+ value,
400
+ ...options.object
401
+ });
402
+ if (serializedObject) search.push(serializedObject);
403
+ } else {
404
+ const serializedPrimitive = serializePrimitiveParam({
405
+ allowReserved: options.allowReserved,
406
+ name,
407
+ value
408
+ });
409
+ if (serializedPrimitive) search.push(serializedPrimitive);
410
+ }
411
+ }
412
+ }
413
+ return search.join("&");
414
+ };
415
+ return querySerializer;
416
+ };
417
+ var getParseAs = (contentType) => {
418
+ if (!contentType) {
419
+ return "stream";
420
+ }
421
+ const cleanContent = contentType.split(";")[0]?.trim();
422
+ if (!cleanContent) {
423
+ return;
424
+ }
425
+ if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) {
426
+ return "json";
427
+ }
428
+ if (cleanContent === "multipart/form-data") {
429
+ return "formData";
430
+ }
431
+ if (["application/", "audio/", "image/", "video/"].some((type) => cleanContent.startsWith(type))) {
432
+ return "blob";
433
+ }
434
+ if (cleanContent.startsWith("text/")) {
435
+ return "text";
436
+ }
437
+ return;
438
+ };
439
+ var checkForExistence = (options, name) => {
440
+ if (!name) {
441
+ return false;
442
+ }
443
+ if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) {
444
+ return true;
445
+ }
446
+ return false;
447
+ };
448
+ async function setAuthParams(options) {
449
+ for (const auth of options.security ?? []) {
450
+ if (checkForExistence(options, auth.name)) {
451
+ continue;
452
+ }
453
+ const token = await getAuthToken(auth, options.auth);
454
+ if (!token) {
455
+ continue;
456
+ }
457
+ const name = auth.name ?? "Authorization";
458
+ switch (auth.in) {
459
+ case "query":
460
+ if (!options.query) {
461
+ options.query = {};
462
+ }
463
+ options.query[name] = token;
464
+ break;
465
+ case "cookie":
466
+ options.headers.append("Cookie", `${name}=${token}`);
467
+ break;
468
+ case "header":
469
+ default:
470
+ options.headers.set(name, token);
471
+ break;
472
+ }
473
+ }
474
+ }
475
+ var buildUrl = (options) => getUrl({
476
+ baseUrl: options.baseUrl,
477
+ path: options.path,
478
+ query: options.query,
479
+ querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
480
+ url: options.url
481
+ });
482
+ var mergeConfigs = (a, b) => {
483
+ const config = { ...a, ...b };
484
+ if (config.baseUrl?.endsWith("/")) {
485
+ config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
486
+ }
487
+ config.headers = mergeHeaders(a.headers, b.headers);
488
+ return config;
489
+ };
490
+ var headersEntries = (headers) => {
491
+ const entries = [];
492
+ headers.forEach((value, key) => {
493
+ entries.push([key, value]);
494
+ });
495
+ return entries;
496
+ };
497
+ var mergeHeaders = (...headers) => {
498
+ const mergedHeaders = new Headers();
499
+ for (const header of headers) {
500
+ if (!header) {
501
+ continue;
502
+ }
503
+ const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
504
+ for (const [key, value] of iterator) {
505
+ if (value === null) {
506
+ mergedHeaders.delete(key);
507
+ } else if (Array.isArray(value)) {
508
+ for (const v of value) {
509
+ mergedHeaders.append(key, v);
510
+ }
511
+ } else if (value !== void 0) {
512
+ mergedHeaders.set(
513
+ key,
514
+ typeof value === "object" ? JSON.stringify(value) : value
515
+ );
516
+ }
517
+ }
518
+ }
519
+ return mergedHeaders;
520
+ };
521
+ var Interceptors = class {
522
+ constructor() {
523
+ this.fns = [];
524
+ }
525
+ clear() {
526
+ this.fns = [];
527
+ }
528
+ eject(id) {
529
+ const index = this.getInterceptorIndex(id);
530
+ if (this.fns[index]) {
531
+ this.fns[index] = null;
532
+ }
533
+ }
534
+ exists(id) {
535
+ const index = this.getInterceptorIndex(id);
536
+ return Boolean(this.fns[index]);
537
+ }
538
+ getInterceptorIndex(id) {
539
+ if (typeof id === "number") {
540
+ return this.fns[id] ? id : -1;
541
+ }
542
+ return this.fns.indexOf(id);
543
+ }
544
+ update(id, fn) {
545
+ const index = this.getInterceptorIndex(id);
546
+ if (this.fns[index]) {
547
+ this.fns[index] = fn;
548
+ return id;
549
+ }
550
+ return false;
551
+ }
552
+ use(fn) {
553
+ this.fns.push(fn);
554
+ return this.fns.length - 1;
555
+ }
556
+ };
557
+ var createInterceptors = () => ({
558
+ error: new Interceptors(),
559
+ request: new Interceptors(),
560
+ response: new Interceptors()
561
+ });
562
+ var defaultQuerySerializer = createQuerySerializer({
563
+ allowReserved: false,
564
+ array: {
565
+ explode: true,
566
+ style: "form"
567
+ },
568
+ object: {
569
+ explode: true,
570
+ style: "deepObject"
571
+ }
572
+ });
573
+ var defaultHeaders = {
574
+ "Content-Type": "application/json"
575
+ };
576
+ var createConfig = (override = {}) => ({
577
+ ...jsonBodySerializer,
578
+ headers: defaultHeaders,
579
+ parseAs: "auto",
580
+ querySerializer: defaultQuerySerializer,
581
+ ...override
582
+ });
583
+
584
+ // src/gen/client/client.gen.ts
585
+ var createClient = (config = {}) => {
586
+ let _config = mergeConfigs(createConfig(), config);
587
+ const getConfig = () => ({ ..._config });
588
+ const setConfig = (config2) => {
589
+ _config = mergeConfigs(_config, config2);
590
+ return getConfig();
591
+ };
592
+ const interceptors = createInterceptors();
593
+ const beforeRequest = async (options) => {
594
+ const opts = {
595
+ ..._config,
596
+ ...options,
597
+ fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
598
+ headers: mergeHeaders(_config.headers, options.headers),
599
+ serializedBody: void 0
600
+ };
601
+ if (opts.security) {
602
+ await setAuthParams(opts);
603
+ }
604
+ if (opts.requestValidator) {
605
+ await opts.requestValidator(opts);
606
+ }
607
+ if (opts.body !== void 0 && opts.bodySerializer) {
608
+ opts.serializedBody = opts.bodySerializer(opts.body);
609
+ }
610
+ if (opts.body === void 0 || opts.serializedBody === "") {
611
+ opts.headers.delete("Content-Type");
612
+ }
613
+ const resolvedOpts = opts;
614
+ const url = buildUrl(resolvedOpts);
615
+ return { opts: resolvedOpts, url };
616
+ };
617
+ const request = async (options) => {
618
+ const throwOnError = options.throwOnError ?? _config.throwOnError;
619
+ const responseStyle = options.responseStyle ?? _config.responseStyle;
620
+ let request2;
621
+ let response;
622
+ try {
623
+ const { opts, url } = await beforeRequest(options);
624
+ const requestInit = {
625
+ redirect: "follow",
626
+ ...opts,
627
+ body: getValidRequestBody(opts)
628
+ };
629
+ request2 = new Request(url, requestInit);
630
+ for (const fn of interceptors.request.fns) {
631
+ if (fn) {
632
+ request2 = await fn(request2, opts);
633
+ }
634
+ }
635
+ const _fetch = opts.fetch;
636
+ response = await _fetch(request2);
637
+ for (const fn of interceptors.response.fns) {
638
+ if (fn) {
639
+ response = await fn(response, request2, opts);
640
+ }
641
+ }
642
+ const result = {
643
+ request: request2,
644
+ response
645
+ };
646
+ if (response.ok) {
647
+ const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
648
+ if (response.status === 204 || response.headers.get("Content-Length") === "0") {
649
+ let emptyData;
650
+ switch (parseAs) {
651
+ case "arrayBuffer":
652
+ case "blob":
653
+ case "text":
654
+ emptyData = await response[parseAs]();
655
+ break;
656
+ case "formData":
657
+ emptyData = new FormData();
658
+ break;
659
+ case "stream":
660
+ emptyData = response.body;
661
+ break;
662
+ case "json":
663
+ default:
664
+ emptyData = {};
665
+ break;
666
+ }
667
+ return opts.responseStyle === "data" ? emptyData : {
668
+ data: emptyData,
669
+ ...result
670
+ };
671
+ }
672
+ let data;
673
+ switch (parseAs) {
674
+ case "arrayBuffer":
675
+ case "blob":
676
+ case "formData":
677
+ case "text":
678
+ data = await response[parseAs]();
679
+ break;
680
+ case "json": {
681
+ const text = await response.text();
682
+ data = text ? JSON.parse(text) : {};
683
+ break;
684
+ }
685
+ case "stream":
686
+ return opts.responseStyle === "data" ? response.body : {
687
+ data: response.body,
688
+ ...result
689
+ };
690
+ }
691
+ if (parseAs === "json") {
692
+ if (opts.responseValidator) {
693
+ await opts.responseValidator(data);
694
+ }
695
+ if (opts.responseTransformer) {
696
+ data = await opts.responseTransformer(data);
697
+ }
698
+ }
699
+ return opts.responseStyle === "data" ? data : {
700
+ data,
701
+ ...result
702
+ };
703
+ }
704
+ const textError = await response.text();
705
+ let jsonError;
706
+ try {
707
+ jsonError = JSON.parse(textError);
708
+ } catch {
709
+ }
710
+ throw jsonError ?? textError;
711
+ } catch (error) {
712
+ let finalError = error;
713
+ for (const fn of interceptors.error.fns) {
714
+ if (fn) {
715
+ finalError = await fn(finalError, response, request2, options);
716
+ }
717
+ }
718
+ finalError = finalError || {};
719
+ if (throwOnError) {
720
+ throw finalError;
721
+ }
722
+ return responseStyle === "data" ? void 0 : {
723
+ error: finalError,
724
+ request: request2,
725
+ response
726
+ };
727
+ }
728
+ };
729
+ const makeMethodFn = (method) => (options) => request({ ...options, method });
730
+ const makeSseFn = (method) => async (options) => {
731
+ const { opts, url } = await beforeRequest(options);
732
+ return createSseClient({
733
+ ...opts,
734
+ body: opts.body,
735
+ method,
736
+ onRequest: async (url2, init) => {
737
+ let request2 = new Request(url2, init);
738
+ for (const fn of interceptors.request.fns) {
739
+ if (fn) {
740
+ request2 = await fn(request2, opts);
741
+ }
742
+ }
743
+ return request2;
744
+ },
745
+ serializedBody: getValidRequestBody(opts),
746
+ url
747
+ });
748
+ };
749
+ const _buildUrl = (options) => buildUrl({ ..._config, ...options });
750
+ return {
751
+ buildUrl: _buildUrl,
752
+ connect: makeMethodFn("CONNECT"),
753
+ delete: makeMethodFn("DELETE"),
754
+ get: makeMethodFn("GET"),
755
+ getConfig,
756
+ head: makeMethodFn("HEAD"),
757
+ interceptors,
758
+ options: makeMethodFn("OPTIONS"),
759
+ patch: makeMethodFn("PATCH"),
760
+ post: makeMethodFn("POST"),
761
+ put: makeMethodFn("PUT"),
762
+ request,
763
+ setConfig,
764
+ sse: {
765
+ connect: makeSseFn("CONNECT"),
766
+ delete: makeSseFn("DELETE"),
767
+ get: makeSseFn("GET"),
768
+ head: makeSseFn("HEAD"),
769
+ options: makeSseFn("OPTIONS"),
770
+ patch: makeSseFn("PATCH"),
771
+ post: makeSseFn("POST"),
772
+ put: makeSseFn("PUT"),
773
+ trace: makeSseFn("TRACE")
774
+ },
775
+ trace: makeMethodFn("TRACE")
776
+ };
777
+ };
778
+
779
+ // src/fetch.ts
780
+ var NULL_BODY_STATUSES = /* @__PURE__ */ new Set([101, 103, 204, 205, 304]);
781
+ function withJsonContentTypeFallback(fetchImpl) {
782
+ const wrapped = async (input, init) => {
783
+ const response = fetchImpl ? await fetchImpl(input, init) : await globalThis.fetch(input, init);
784
+ const contentType = response.headers.get("content-type");
785
+ if (!contentType?.toLowerCase().startsWith("text/plain") || NULL_BODY_STATUSES.has(response.status)) {
786
+ return response;
787
+ }
788
+ const text = await response.clone().text();
789
+ try {
790
+ JSON.parse(text);
791
+ } catch {
792
+ return response;
793
+ }
794
+ const headers = new Headers(response.headers);
795
+ headers.set("content-type", "application/json");
796
+ return new Response(text, {
797
+ status: response.status,
798
+ statusText: response.statusText,
799
+ headers
800
+ });
801
+ };
802
+ return wrapped;
803
+ }
804
+
805
+ // src/identity.ts
806
+ var CLIENT_HEADER = "X-Flipdish-Client";
807
+ function detectRuntime() {
808
+ const g = globalThis;
809
+ const proc = typeof g.process === "object" ? g.process : void 0;
810
+ const versions = proc?.versions ?? {};
811
+ const isBrowser = typeof g.window !== "undefined" && typeof g.document !== "undefined";
812
+ let runtime;
813
+ if (versions.bun) {
814
+ runtime = `bun/${versions.bun}`;
815
+ } else if (versions.deno) {
816
+ runtime = `deno/${versions.deno}`;
817
+ } else if (versions.node) {
818
+ runtime = `node/${versions.node}`;
819
+ }
820
+ return {
821
+ isServer: !isBrowser && runtime !== void 0,
822
+ env: proc?.env ?? {},
823
+ runtime
824
+ };
825
+ }
826
+ function sanitize(value) {
827
+ const cleaned = value?.trim().replace(/[^A-Za-z0-9._@+-]+/g, "-").replace(/^-+|-+$/g, "");
828
+ return cleaned ? cleaned : void 0;
829
+ }
830
+ function firstDefined(...values) {
831
+ for (const value of values) {
832
+ const cleaned = sanitize(value);
833
+ if (cleaned) {
834
+ return cleaned;
835
+ }
836
+ }
837
+ return void 0;
838
+ }
839
+ function firstRuntime(...values) {
840
+ for (const value of values) {
841
+ const cleaned = value?.split("/").map(sanitize).filter(Boolean).join("/");
842
+ if (cleaned) {
843
+ return cleaned;
844
+ }
845
+ }
846
+ return void 0;
847
+ }
848
+ function buildIdentity(sdk, options = {}, runtimeInfo = detectRuntime()) {
849
+ const { env } = runtimeInfo;
850
+ const clientName = firstDefined(
851
+ options.clientName,
852
+ env.FLIPDISH_CLIENT_NAME,
853
+ env.DD_SERVICE,
854
+ env.AWS_LAMBDA_FUNCTION_NAME,
855
+ env.npm_package_name
856
+ );
857
+ const clientVersion = firstDefined(
858
+ options.clientVersion,
859
+ env.FLIPDISH_CLIENT_VERSION,
860
+ env.DD_VERSION,
861
+ env.npm_package_version
862
+ );
863
+ const environment = firstDefined(
864
+ options.clientEnvironment,
865
+ env.FLIPDISH_CLIENT_ENVIRONMENT,
866
+ env.DD_ENV,
867
+ env.NODE_ENV
868
+ );
869
+ const runtime = firstRuntime(
870
+ options.runtime,
871
+ env.FLIPDISH_CLIENT_RUNTIME,
872
+ runtimeInfo.runtime
873
+ );
874
+ const parts = [`Flipdish-${sanitize(sdk.name)}-ts/${sanitize(sdk.version)}`];
875
+ if (clientName) {
876
+ parts.push(clientVersion ? `${clientName}/${clientVersion}` : clientName);
877
+ }
878
+ if (environment) {
879
+ parts.push(`env/${environment}`);
880
+ }
881
+ if (runtime) {
882
+ parts.push(runtime);
883
+ }
884
+ const suffix = (options.userAgentSuffix ?? env.FLIPDISH_CLIENT_USER_AGENT_SUFFIX)?.replace(/[^\x20-\x7e]+/g, "").trim();
885
+ if (suffix) {
886
+ parts.push(suffix);
887
+ }
888
+ return parts.join(" ");
889
+ }
890
+ function identityHeaders(sdk, options = {}, runtimeInfo = detectRuntime()) {
891
+ const identity = buildIdentity(sdk, options, runtimeInfo);
892
+ const headers = { [CLIENT_HEADER]: identity };
893
+ if (runtimeInfo.isServer) {
894
+ headers["User-Agent"] = identity;
895
+ }
896
+ return headers;
897
+ }
898
+ var defaultHeaders2;
899
+ function defaultIdentityHeaders(sdk) {
900
+ defaultHeaders2 ?? (defaultHeaders2 = identityHeaders(sdk));
901
+ return defaultHeaders2;
902
+ }
903
+
904
+ // src/sdk-info.ts
905
+ var SDK_INFO = { "name": "authorization", "version": "0.0.673-rc.1794584635" };
906
+ var DEFAULT_BASE_URL = "https://api.flipdish.co/auth";
907
+
908
+ // src/flipdish-runtime.ts
909
+ var createClientConfig = (config) => ({
910
+ ...config,
911
+ fetch: withJsonContentTypeFallback(config?.fetch),
912
+ headers: mergeHeaders(defaultIdentityHeaders(SDK_INFO), config?.headers)
913
+ });
914
+
915
+ // src/gen/client.gen.ts
916
+ var client = createClient(createClientConfig(createConfig({ baseUrl: "https://api.flipdish.co/auth" })));
917
+
918
+ // src/gen/sdk.gen.ts
919
+ var HeyApiClient = class {
920
+ constructor(args) {
921
+ this.client = args?.client ?? client;
922
+ }
923
+ };
924
+ var HeyApiRegistry = class {
925
+ constructor() {
926
+ this.defaultKey = "default";
927
+ this.instances = /* @__PURE__ */ new Map();
928
+ }
929
+ get(key) {
930
+ const instance = this.instances.get(key ?? this.defaultKey);
931
+ if (!instance) {
932
+ throw new Error(`No SDK client found. Create one with "new AuthorizationClient()" to fix this error.`);
933
+ }
934
+ return instance;
935
+ }
936
+ set(value, key) {
937
+ this.instances.set(key ?? this.defaultKey, value);
938
+ }
939
+ };
940
+ var _AuthorizationClient = class _AuthorizationClient extends HeyApiClient {
941
+ constructor(args) {
942
+ super(args);
943
+ _AuthorizationClient.__registry.set(this, args?.key);
944
+ }
945
+ /**
946
+ * Authorize Request
947
+ *
948
+ * Check if a user is authorized to perform an action
949
+ */
950
+ authorize(options) {
951
+ return (options?.client ?? this.client).post({
952
+ security: [{ name: "Authorization", type: "apiKey" }],
953
+ url: "/authorize",
954
+ ...options,
955
+ headers: {
956
+ "Content-Type": "application/json",
957
+ ...options?.headers
958
+ }
959
+ });
960
+ }
961
+ /**
962
+ * Authorize Batch Request
963
+ *
964
+ * Check if a user is authorized to perform an action on multiple resources
965
+ */
966
+ authorizeBatch(options) {
967
+ return (options?.client ?? this.client).post({
968
+ security: [{ name: "Authorization", type: "apiKey" }],
969
+ url: "/authorize/batch",
970
+ ...options,
971
+ headers: {
972
+ "Content-Type": "application/json",
973
+ ...options?.headers
974
+ }
975
+ });
976
+ }
977
+ /**
978
+ * Authorize Batch Checks Request
979
+ *
980
+ * Check whether each principal/resource/action tuple is authorized
981
+ */
982
+ authorizeBatchChecks(options) {
983
+ return (options?.client ?? this.client).post({
984
+ security: [{ name: "Authorization", type: "apiKey" }],
985
+ url: "/authorize/batch/checks",
986
+ ...options,
987
+ headers: {
988
+ "Content-Type": "application/json",
989
+ ...options?.headers
990
+ }
991
+ });
992
+ }
993
+ /**
994
+ * Check Is In Role
995
+ *
996
+ * Check if a user is in any/all of the roles
997
+ */
998
+ checkIsInRole(options) {
999
+ return (options?.client ?? this.client).post({
1000
+ security: [{ name: "Authorization", type: "apiKey" }],
1001
+ url: "/checkIsInRole",
1002
+ ...options,
1003
+ headers: {
1004
+ "Content-Type": "application/json",
1005
+ ...options?.headers
1006
+ }
1007
+ });
1008
+ }
1009
+ /**
1010
+ * Authenticate and Check Is In Role
1011
+ *
1012
+ * Authenticate and check if a user is in any/all of the roles
1013
+ */
1014
+ authenticateAndCheckIsInRole(options) {
1015
+ return (options?.client ?? this.client).post({
1016
+ security: [{ name: "Authorization", type: "apiKey" }],
1017
+ url: "/authenticateAndCheckIsInRole",
1018
+ ...options,
1019
+ headers: {
1020
+ "Content-Type": "application/json",
1021
+ ...options?.headers
1022
+ }
1023
+ });
1024
+ }
1025
+ /**
1026
+ * Authenticate and authorize Request
1027
+ *
1028
+ * Authenticate and authorize a user to perform an action
1029
+ */
1030
+ authenticateAndAuthorize(options) {
1031
+ return (options.client ?? this.client).post({
1032
+ security: [{ name: "Authorization", type: "apiKey" }],
1033
+ url: "/authenticateAndAuthorize",
1034
+ ...options,
1035
+ headers: {
1036
+ "Content-Type": "application/json",
1037
+ ...options.headers
1038
+ }
1039
+ });
1040
+ }
1041
+ /**
1042
+ * Get Authorized Orgs
1043
+ *
1044
+ * Get the authorized orgs for a given principal
1045
+ */
1046
+ getAuthorizedOrgs(options) {
1047
+ return (options?.client ?? this.client).post({
1048
+ security: [{ name: "Authorization", type: "apiKey" }],
1049
+ url: "/getAuthorizedOrgs",
1050
+ ...options,
1051
+ headers: {
1052
+ "Content-Type": "application/json",
1053
+ ...options?.headers
1054
+ }
1055
+ });
1056
+ }
1057
+ /**
1058
+ * Get Authorized Properties
1059
+ *
1060
+ * Get the authorized properties for a given org
1061
+ */
1062
+ getAuthorizedProperties(options) {
1063
+ return (options.client ?? this.client).post({
1064
+ security: [{ name: "Authorization", type: "apiKey" }],
1065
+ url: "/orgs/{orgId}/getAuthorizedProperties",
1066
+ ...options,
1067
+ headers: {
1068
+ "Content-Type": "application/json",
1069
+ ...options.headers
1070
+ }
1071
+ });
1072
+ }
1073
+ /**
1074
+ * Get Authorized Brands
1075
+ *
1076
+ * Get the authorized brands for a given org
1077
+ */
1078
+ getAuthorizedBrands(options) {
1079
+ return (options.client ?? this.client).post({
1080
+ security: [{ name: "Authorization", type: "apiKey" }],
1081
+ url: "/orgs/{orgId}/getAuthorizedBrands",
1082
+ ...options,
1083
+ headers: {
1084
+ "Content-Type": "application/json",
1085
+ ...options.headers
1086
+ }
1087
+ });
1088
+ }
1089
+ /**
1090
+ * List Users in Org
1091
+ *
1092
+ * List the users in a given org
1093
+ */
1094
+ listUsersInOrg(options) {
1095
+ return (options.client ?? this.client).get({
1096
+ security: [{ name: "Authorization", type: "apiKey" }],
1097
+ url: "/orgs/{orgId}/users",
1098
+ ...options
1099
+ });
1100
+ }
1101
+ /**
1102
+ * List User Permissions
1103
+ *
1104
+ * List the available permissions for a given user
1105
+ */
1106
+ listUserPermissions(options) {
1107
+ return (options.client ?? this.client).get({
1108
+ security: [{ name: "Authorization", type: "apiKey" }],
1109
+ url: "/orgs/{orgId}/user/{userId}/permissions",
1110
+ ...options
1111
+ });
1112
+ }
1113
+ /**
1114
+ * List Own Permissions
1115
+ *
1116
+ * List the available permissions for the current user
1117
+ */
1118
+ listOwnPermissions(options) {
1119
+ return (options.client ?? this.client).get({
1120
+ security: [{ name: "Authorization", type: "apiKey" }],
1121
+ url: "/orgs/{orgId}/user/permissions",
1122
+ ...options
1123
+ });
1124
+ }
1125
+ /**
1126
+ * List Own Roles
1127
+ *
1128
+ * List the role assignments for the current user in the org
1129
+ */
1130
+ listOwnRoles(options) {
1131
+ return (options.client ?? this.client).get({
1132
+ security: [{ name: "Authorization", type: "apiKey" }],
1133
+ url: "/orgs/{orgId}/user/roles",
1134
+ ...options
1135
+ });
1136
+ }
1137
+ /**
1138
+ * List Org Roles
1139
+ *
1140
+ * List the current roles assignments in the org
1141
+ */
1142
+ listOrgRoles(options) {
1143
+ return (options.client ?? this.client).get({
1144
+ security: [{ name: "Authorization", type: "apiKey" }],
1145
+ url: "/orgs/{orgId}/roles",
1146
+ ...options
1147
+ });
1148
+ }
1149
+ /**
1150
+ * List Org Permissions
1151
+ *
1152
+ * List the current permission assignments in the org
1153
+ */
1154
+ listOrgPermissions(options) {
1155
+ return (options.client ?? this.client).get({
1156
+ security: [{ name: "Authorization", type: "apiKey" }],
1157
+ url: "/orgs/{orgId}/permissions",
1158
+ ...options
1159
+ });
1160
+ }
1161
+ /**
1162
+ * Get principal org memberships
1163
+ *
1164
+ * Returns the principal and the orgs it holds permission assignments in, read from the principals store with no policy evaluation. This is a superset of the orgs any single action is allowed on, so it is a sound negative filter (no membership means no permission) but not an authoritative allow. Intended as a cheap prefilter ahead of /authorize/batch/checks; use /getAuthorizedOrgs when you need a per-action answer. Requires ListPrincipalOrgs.
1165
+ */
1166
+ getPrincipalOrgs(options) {
1167
+ return (options.client ?? this.client).get({
1168
+ security: [{ name: "Authorization", type: "apiKey" }],
1169
+ url: "/principals/{principalId}/orgs",
1170
+ ...options
1171
+ });
1172
+ }
1173
+ /**
1174
+ * Revoke the caller's active timed access pass early
1175
+ *
1176
+ * Ends the authenticated caller's own active pass on the org before its natural expiry, removing the temporary role assignment and recording the pass as revoked. Returns 404 when the caller has no active pass on the org.
1177
+ */
1178
+ revokeTimedAccessGrant(options) {
1179
+ return (options.client ?? this.client).delete({
1180
+ security: [{ name: "Authorization", type: "apiKey" }],
1181
+ url: "/orgs/{orgId}/timedAccess/grants",
1182
+ ...options
1183
+ });
1184
+ }
1185
+ /**
1186
+ * List the caller's active timed access pass for an org
1187
+ *
1188
+ * Returns the authenticated caller's active pass for the requested org.
1189
+ */
1190
+ listMyTimedAccessGrants(options) {
1191
+ return (options.client ?? this.client).get({
1192
+ security: [{ name: "Authorization", type: "apiKey" }],
1193
+ url: "/orgs/{orgId}/timedAccess/grants",
1194
+ ...options
1195
+ });
1196
+ }
1197
+ /**
1198
+ * Create a timed access pass
1199
+ *
1200
+ * Grants the authenticated caller temporary Owner access to a single org. Requesting again while a pass is active extends it rather than creating a second one.
1201
+ */
1202
+ createTimedAccessGrant(options) {
1203
+ return (options.client ?? this.client).post({
1204
+ security: [{ name: "Authorization", type: "apiKey" }],
1205
+ url: "/orgs/{orgId}/timedAccess/grants",
1206
+ ...options,
1207
+ headers: {
1208
+ "Content-Type": "application/json",
1209
+ ...options.headers
1210
+ }
1211
+ });
1212
+ }
1213
+ /**
1214
+ * List the caller's timed access passes across every org
1215
+ *
1216
+ * Returns the authenticated caller's active passes across all orgs, or their expired passes (most recent first, paginated) when status=expired. Used to show which orgs the caller already has access to.
1217
+ */
1218
+ listMyTimedAccessGrantsAcrossOrgs(options) {
1219
+ return (options?.client ?? this.client).get({
1220
+ security: [{ name: "Authorization", type: "apiKey" }],
1221
+ url: "/timedAccess/grants",
1222
+ ...options
1223
+ });
1224
+ }
1225
+ /**
1226
+ * An org's expired timed access grant history
1227
+ *
1228
+ * Returns the org’s expired timed access passes, most recent first. Intended for client-facing visibility into Flipdish staff access to their org, not for the staff member themselves.
1229
+ */
1230
+ listExpiredTimedAccessGrantsForOrg(options) {
1231
+ return (options.client ?? this.client).get({
1232
+ security: [{ name: "Authorization", type: "apiKey" }],
1233
+ url: "/orgs/{orgId}/timedAccess/grants/expired",
1234
+ ...options
1235
+ });
1236
+ }
1237
+ /**
1238
+ * Assign a named role
1239
+ *
1240
+ * Grants a user the named role given in the body. The caller must themselves hold a named role, and may only assign roles at or below their own privilege level (see NamedRolePrivilegeLevel in auth-config); AuthDeveloper can never be assigned here, it's IaC-only. Idempotent: assigning twice returns the same result. Mirrors /orgs/{orgId}/roleAssignments/apply.
1241
+ */
1242
+ applyNamedRole(options) {
1243
+ return (options?.client ?? this.client).post({
1244
+ security: [{ name: "Authorization", type: "apiKey" }],
1245
+ url: "/namedRoles/apply",
1246
+ ...options,
1247
+ headers: {
1248
+ "Content-Type": "application/json",
1249
+ ...options?.headers
1250
+ }
1251
+ });
1252
+ }
1253
+ /**
1254
+ * Remove a named role
1255
+ *
1256
+ * Removes the named role given in the body so the user can no longer act as it. Removing FlipdishStaff also ends any timed access passes the user currently holds, revoking that access immediately rather than leaving it to run to its own expiry. Subject to the same privilege-level gate and AuthDeveloper block as assignment. Mirrors /orgs/{orgId}/roleAssignments/remove.
1257
+ */
1258
+ removeNamedRole(options) {
1259
+ return (options?.client ?? this.client).post({
1260
+ security: [{ name: "Authorization", type: "apiKey" }],
1261
+ url: "/namedRoles/remove",
1262
+ ...options,
1263
+ headers: {
1264
+ "Content-Type": "application/json",
1265
+ ...options?.headers
1266
+ }
1267
+ });
1268
+ }
1269
+ /**
1270
+ * List named roles for a user
1271
+ *
1272
+ * Lists the named roles currently held by the given user. No org context needed, since named roles are global. Caller must hold Admin, Factory, or AuthDeveloper.
1273
+ */
1274
+ listNamedRoles(options) {
1275
+ return (options.client ?? this.client).get({
1276
+ security: [{ name: "Authorization", type: "apiKey" }],
1277
+ url: "/namedRoles/{principalId}",
1278
+ ...options
1279
+ });
1280
+ }
1281
+ /**
1282
+ * Rematerialize Role Assignment
1283
+ *
1284
+ * Reconciles policy assignments for the role assignment principal: creates missing policies and revokes leftovers that materialize no longer emits
1285
+ */
1286
+ rematerializeRoleAssignmentV2(options) {
1287
+ return (options.client ?? this.client).post({
1288
+ security: [{ name: "Authorization", type: "apiKey" }],
1289
+ url: "/orgs/{orgId}/roleAssignments/rematerialize",
1290
+ ...options,
1291
+ headers: {
1292
+ "Content-Type": "application/json",
1293
+ ...options.headers
1294
+ }
1295
+ });
1296
+ }
1297
+ /**
1298
+ * Apply role assignment
1299
+ *
1300
+ * Apply a role assignment for the target user without invoking legacy teammate/Zeus role assignment flows.
1301
+ */
1302
+ applyRoleAssignment(options) {
1303
+ return (options.client ?? this.client).post({
1304
+ security: [{ name: "Authorization", type: "apiKey" }],
1305
+ url: "/orgs/{orgId}/roleAssignments/apply",
1306
+ ...options,
1307
+ headers: {
1308
+ "Content-Type": "application/json",
1309
+ ...options.headers
1310
+ }
1311
+ });
1312
+ }
1313
+ /**
1314
+ * Remove teammate
1315
+ *
1316
+ * Revokes all V2 role assignments for the teammate in this org, reconciles away their policies, and removes them from the org user list. Does not delete the teammate account in Zeus.
1317
+ */
1318
+ removeTeammate(options) {
1319
+ return (options.client ?? this.client).post({
1320
+ security: [{ name: "Authorization", type: "apiKey" }],
1321
+ url: "/orgs/{orgId}/roleAssignments/remove",
1322
+ ...options,
1323
+ headers: {
1324
+ "Content-Type": "application/json",
1325
+ ...options.headers
1326
+ }
1327
+ });
1328
+ }
1329
+ /**
1330
+ * Leave org
1331
+ *
1332
+ * Removes the caller from the org: revokes all of their V2 role assignments, reconciles away their policies, and removes them from the org user list. Does not change their Zeus teammate record.
1333
+ */
1334
+ leaveOrg(options) {
1335
+ return (options.client ?? this.client).post({
1336
+ security: [{ name: "Authorization", type: "apiKey" }],
1337
+ url: "/orgs/{orgId}/leave",
1338
+ ...options
1339
+ });
1340
+ }
1341
+ /**
1342
+ * Invite teammate
1343
+ *
1344
+ * Invites a teammate through Zeus after the same rank and scope checks as applying a role assignment. If the email already belongs to an org member, the caller must be able to change them, since Zeus replaces their access.
1345
+ */
1346
+ inviteTeammate(options) {
1347
+ return (options.client ?? this.client).post({
1348
+ security: [{ name: "Authorization", type: "apiKey" }],
1349
+ url: "/orgs/{orgId}/teammates/invite",
1350
+ ...options,
1351
+ headers: {
1352
+ "Content-Type": "application/json",
1353
+ ...options.headers
1354
+ }
1355
+ });
1356
+ }
1357
+ /**
1358
+ * Create an invite token
1359
+ *
1360
+ * Mints an opaque invite token after validating the RMS terminal passport. Call again when a previous token expires to get a new one.
1361
+ */
1362
+ createInviteToken(options) {
1363
+ return (options.client ?? this.client).post({
1364
+ security: [{ name: "Authorization", type: "apiKey" }],
1365
+ url: "/orgs/{orgId}/inviteTokens",
1366
+ ...options,
1367
+ headers: {
1368
+ "Content-Type": "application/json",
1369
+ ...options.headers
1370
+ }
1371
+ });
1372
+ }
1373
+ /**
1374
+ * List pending join requests for an organization
1375
+ *
1376
+ * Returns pending AccessRequests for an org. Optional propertyId/brandId filters. Requires ViewTeammates on orgId.
1377
+ */
1378
+ listJoinAccessRequests(options) {
1379
+ return (options.client ?? this.client).get({
1380
+ security: [{ name: "Authorization", type: "apiKey" }],
1381
+ url: "/orgs/{orgId}/joinRequests",
1382
+ ...options
1383
+ });
1384
+ }
1385
+ /**
1386
+ * Submit a join access request from an invite token
1387
+ *
1388
+ * Validates the opaque invite token and creates (or returns) a pending AccessRequest for the property/role encoded on the token.
1389
+ */
1390
+ createJoinAccessRequest(options) {
1391
+ return (options.client ?? this.client).post({
1392
+ security: [{ name: "Authorization", type: "apiKey" }],
1393
+ url: "/orgs/{orgId}/joinRequests",
1394
+ ...options,
1395
+ headers: {
1396
+ "Content-Type": "application/json",
1397
+ ...options.headers
1398
+ }
1399
+ });
1400
+ }
1401
+ /**
1402
+ * Get a join access request by id
1403
+ *
1404
+ * Returns request status for the authenticated requester only. Owners should use the list endpoint.
1405
+ */
1406
+ getJoinAccessRequest(options) {
1407
+ return (options.client ?? this.client).get({
1408
+ security: [{ name: "Authorization", type: "apiKey" }],
1409
+ url: "/orgs/{orgId}/joinRequests/{requestId}",
1410
+ ...options
1411
+ });
1412
+ }
1413
+ /**
1414
+ * Accept a pending join access request
1415
+ *
1416
+ * Grants access via AuthZ V2 role assignment (source join). Optional body fields override the role and property scope stored on the pending request; omitted fields use the request defaults from the invite token.
1417
+ */
1418
+ acceptJoinAccessRequest(options) {
1419
+ return (options.client ?? this.client).post({
1420
+ security: [{ name: "Authorization", type: "apiKey" }],
1421
+ url: "/orgs/{orgId}/joinRequests/{requestId}/accept",
1422
+ ...options,
1423
+ headers: {
1424
+ "Content-Type": "application/json",
1425
+ ...options.headers
1426
+ }
1427
+ });
1428
+ }
1429
+ /**
1430
+ * Reject a pending join access request
1431
+ *
1432
+ * Rejects a pending AccessRequest without granting access.
1433
+ */
1434
+ rejectJoinAccessRequest(options) {
1435
+ return (options.client ?? this.client).post({
1436
+ security: [{ name: "Authorization", type: "apiKey" }],
1437
+ url: "/orgs/{orgId}/joinRequests/{requestId}/reject",
1438
+ ...options
1439
+ });
1440
+ }
1441
+ /**
1442
+ * List global API keys
1443
+ *
1444
+ * List Automation API keys (non-secret fields). Optional status filter (active|revoked). Requires ListGlobalAPIKeys.
1445
+ */
1446
+ listGlobalApiKeys(options) {
1447
+ return (options?.client ?? this.client).get({
1448
+ security: [{ name: "Authorization", type: "apiKey" }],
1449
+ url: "/apiKeys",
1450
+ ...options
1451
+ });
1452
+ }
1453
+ /**
1454
+ * Create global API key
1455
+ *
1456
+ * Create an Automation API key (optional org association). Requires CreateGlobalAPIKey. Raw secret is returned once.
1457
+ */
1458
+ createGlobalApiKey(options) {
1459
+ return (options?.client ?? this.client).post({
1460
+ security: [{ name: "Authorization", type: "apiKey" }],
1461
+ url: "/apiKeys",
1462
+ ...options,
1463
+ headers: {
1464
+ "Content-Type": "application/json",
1465
+ ...options?.headers
1466
+ }
1467
+ });
1468
+ }
1469
+ /**
1470
+ * Get current API key state
1471
+ *
1472
+ * Self-introspection for the authenticated Automation API key (x-api-key). Returns non-secret fields only.
1473
+ */
1474
+ getGlobalApiKeyMe(options) {
1475
+ return (options?.client ?? this.client).get({
1476
+ security: [{ name: "Authorization", type: "apiKey" }],
1477
+ url: "/apiKeys/me",
1478
+ ...options
1479
+ });
1480
+ }
1481
+ /**
1482
+ * Authenticate API key
1483
+ *
1484
+ * Authenticates the presented Automation API key (x-api-key or Authorization: ApiKey <key>) and returns status only: 200 when the key is active and not expired, 401 otherwise. Not authenticated by cookie/JWT sessions.
1485
+ */
1486
+ authenticateApiKey(options) {
1487
+ return (options?.client ?? this.client).get({
1488
+ security: [{ name: "Authorization", type: "apiKey" }],
1489
+ url: "/apiKey/authenticate",
1490
+ ...options
1491
+ });
1492
+ }
1493
+ /**
1494
+ * Update global API key
1495
+ *
1496
+ * Update permissions, resources, and/or expiry for any Automation API key. Rotates the STATIC AVP policy.
1497
+ */
1498
+ updateGlobalApiKey(options) {
1499
+ return (options.client ?? this.client).post({
1500
+ security: [{ name: "Authorization", type: "apiKey" }],
1501
+ url: "/apiKeys/{apiKeyId}",
1502
+ ...options,
1503
+ headers: {
1504
+ "Content-Type": "application/json",
1505
+ ...options.headers
1506
+ }
1507
+ });
1508
+ }
1509
+ /**
1510
+ * Revoke global API key
1511
+ *
1512
+ * Delete the STATIC AVP policy and mark the API key revoked.
1513
+ */
1514
+ revokeGlobalApiKey(options) {
1515
+ return (options.client ?? this.client).post({
1516
+ security: [{ name: "Authorization", type: "apiKey" }],
1517
+ url: "/apiKeys/{apiKeyId}/revoke",
1518
+ ...options
1519
+ });
1520
+ }
1521
+ /**
1522
+ * Get principal access block
1523
+ *
1524
+ * Get the current access block for a principal. Requires BlockPrincipalAccess.
1525
+ */
1526
+ getPrincipalAccessBlock(options) {
1527
+ return (options.client ?? this.client).get({
1528
+ security: [{ name: "Authorization", type: "apiKey" }],
1529
+ url: "/principals/block",
1530
+ ...options
1531
+ });
1532
+ }
1533
+ /**
1534
+ * Block principal access
1535
+ *
1536
+ * Write an access_block flag and a temporary AVP forbid so authorization checks DENY. Decision-cache bust is delayed like other grant changes. Grant drain/restore runs asynchronously. Authentication still succeeds. Requires BlockPrincipalAccess.
1537
+ */
1538
+ blockPrincipalAccess(options) {
1539
+ return (options?.client ?? this.client).post({
1540
+ security: [{ name: "Authorization", type: "apiKey" }],
1541
+ url: "/principals/block",
1542
+ ...options,
1543
+ headers: {
1544
+ "Content-Type": "application/json",
1545
+ ...options?.headers
1546
+ }
1547
+ });
1548
+ }
1549
+ /**
1550
+ * Unblock principal access
1551
+ *
1552
+ * Start restoring existing role assignments. The access_block flag is removed asynchronously after restoration completes, and authorization remains denied until then. Requires BlockPrincipalAccess.
1553
+ */
1554
+ unblockPrincipalAccess(options) {
1555
+ return (options?.client ?? this.client).post({
1556
+ security: [{ name: "Authorization", type: "apiKey" }],
1557
+ url: "/principals/unblock",
1558
+ ...options,
1559
+ headers: {
1560
+ "Content-Type": "application/json",
1561
+ ...options?.headers
1562
+ }
1563
+ });
1564
+ }
1565
+ /**
1566
+ * List principal access blocks
1567
+ *
1568
+ * List currently blocked principals. Optional type filter. Requires BlockPrincipalAccess.
1569
+ */
1570
+ listPrincipalAccessBlocks(options) {
1571
+ return (options?.client ?? this.client).get({
1572
+ security: [{ name: "Authorization", type: "apiKey" }],
1573
+ url: "/principals/blocks",
1574
+ ...options
1575
+ });
1576
+ }
1577
+ /**
1578
+ * List Permissions
1579
+ *
1580
+ * List the available permissions
1581
+ */
1582
+ listPermissions(options) {
1583
+ return (options?.client ?? this.client).get({
1584
+ security: [{ name: "Authorization", type: "apiKey" }],
1585
+ url: "/config/permissions",
1586
+ ...options
1587
+ });
1588
+ }
1589
+ /**
1590
+ * List Roles
1591
+ *
1592
+ * List the available roles
1593
+ */
1594
+ listRoles(options) {
1595
+ return (options?.client ?? this.client).get({
1596
+ security: [{ name: "Authorization", type: "apiKey" }],
1597
+ url: "/config/roles",
1598
+ ...options
1599
+ });
1600
+ }
1601
+ /**
1602
+ * List Role Definitions
1603
+ *
1604
+ * List the teammate roles with the permissions they grant at each hierarchy level, including optional permission sets
1605
+ */
1606
+ listRoleDefinitions(options) {
1607
+ return (options?.client ?? this.client).get({
1608
+ security: [{ name: "Authorization", type: "apiKey" }],
1609
+ url: "/config/roleDefinitions",
1610
+ ...options
1611
+ });
1612
+ }
1613
+ };
1614
+ _AuthorizationClient.__registry = new HeyApiRegistry();
1615
+ var AuthorizationClient = _AuthorizationClient;
1616
+
1617
+ // src/gen/types.gen.ts
1618
+ var Permissions = {
1619
+ AnyAuditLogs: "AnyAuditLogs",
1620
+ ViewApp: "ViewApp",
1621
+ CreateApp: "CreateApp",
1622
+ UpdateApp: "UpdateApp",
1623
+ ViewAppName: "ViewAppName",
1624
+ EditAppAssets: "EditAppAssets",
1625
+ EditAppFeatures: "EditAppFeatures",
1626
+ ViewTeammates: "ViewTeammates",
1627
+ EditTeammates: "EditTeammates",
1628
+ CreateTeammateOwner: "CreateTeammateOwner",
1629
+ CreateTeammateManagedOwner: "CreateTeammateManagedOwner",
1630
+ CreateTeammateStoreOwner: "CreateTeammateStoreOwner",
1631
+ CreateTeammateStoreManager: "CreateTeammateStoreManager",
1632
+ CreateTeammateStoreStaff: "CreateTeammateStoreStaff",
1633
+ CreateTeammateStoreReadAccess: "CreateTeammateStoreReadAccess",
1634
+ CreateTeammateFinanceManager: "CreateTeammateFinanceManager",
1635
+ CreateTeammateIntegrator: "CreateTeammateIntegrator",
1636
+ CreateTeammateOnboarding: "CreateTeammateOnboarding",
1637
+ CreateTeammatePropertyManager: "CreateTeammatePropertyManager",
1638
+ CreateTeammatePropertyOwner: "CreateTeammatePropertyOwner",
1639
+ CreateTeammateStaffMember: "CreateTeammateStaffMember",
1640
+ CreateTeammateCourier: "CreateTeammateCourier",
1641
+ ViewApmConfigurations: "ViewApmConfigurations",
1642
+ EditApmConfigurations: "EditApmConfigurations",
1643
+ ViewCampaignsConfigurations: "ViewCampaignsConfigurations",
1644
+ CreateCampaignsConfigurations: "CreateCampaignsConfigurations",
1645
+ UpdateCampaignsConfigurations: "UpdateCampaignsConfigurations",
1646
+ DeleteCampaignsConfigurations: "DeleteCampaignsConfigurations",
1647
+ StampLoyaltyCardAgainstCampaignsConfigurations: "StampLoyaltyCardAgainstCampaignsConfigurations",
1648
+ ViewDevelopersSettings: "ViewDevelopersSettings",
1649
+ EditDevelopersSettings: "EditDevelopersSettings",
1650
+ ViewOrders: "ViewOrders",
1651
+ UpdateOrdersAccept: "UpdateOrdersAccept",
1652
+ UpdateOrdersReject: "UpdateOrdersReject",
1653
+ UpdateOrdersRefund: "UpdateOrdersRefund",
1654
+ UpdateOrdersDispatch: "UpdateOrdersDispatch",
1655
+ ViewStores: "ViewStores",
1656
+ CreateStores: "CreateStores",
1657
+ EditStores: "EditStores",
1658
+ ViewStoresOpeningHours: "ViewStoresOpeningHours",
1659
+ UpdateStoresOpenForCollectionOrDelivery: "UpdateStoresOpenForCollectionOrDelivery",
1660
+ UpdateStoresOpeningHours: "UpdateStoresOpeningHours",
1661
+ ViewStoresOpeningHoursOverride: "ViewStoresOpeningHoursOverride",
1662
+ EditStoresOpeningHoursOverride: "EditStoresOpeningHoursOverride",
1663
+ EditStoresOpeningHoursOverrideTemporary: "EditStoresOpeningHoursOverrideTemporary",
1664
+ UpdateStoresName: "UpdateStoresName",
1665
+ EditStoreKioskSettings: "EditStoreKioskSettings",
1666
+ EditStoreOrderCapacity: "EditStoreOrderCapacity",
1667
+ EditStoreNotifications: "EditStoreNotifications",
1668
+ ArchiveStores: "ArchiveStores",
1669
+ PublishStores: "PublishStores",
1670
+ UpdatePrinterTerminalsAssign: "UpdatePrinterTerminalsAssign",
1671
+ UpdatePrinterTerminalsToggle: "UpdatePrinterTerminalsToggle",
1672
+ ViewStoreGroups: "ViewStoreGroups",
1673
+ CreateStoreGroups: "CreateStoreGroups",
1674
+ UpdateStoreGroups: "UpdateStoreGroups",
1675
+ DeleteStoreGroups: "DeleteStoreGroups",
1676
+ ViewDeliveryZones: "ViewDeliveryZones",
1677
+ CreateDeliveryZones: "CreateDeliveryZones",
1678
+ UpdateDeliveryZones: "UpdateDeliveryZones",
1679
+ DeleteDeliveryZones: "DeleteDeliveryZones",
1680
+ ViewMenu: "ViewMenu",
1681
+ CreateGlobalApiKey: "CreateGlobalAPIKey",
1682
+ ListGlobalApiKeys: "ListGlobalAPIKeys",
1683
+ BlockPrincipalAccess: "BlockPrincipalAccess",
1684
+ ListPrincipalOrgs: "ListPrincipalOrgs",
1685
+ CreateMenu: "CreateMenu",
1686
+ UpdateMenu: "UpdateMenu",
1687
+ DeleteMenu: "DeleteMenu",
1688
+ UpdateMenuLock: "UpdateMenuLock",
1689
+ UpdateMenuItemsHideTemporarily: "UpdateMenuItemsHideTemporarily",
1690
+ EditMenuImage: "EditMenuImage",
1691
+ ViewVouchers: "ViewVouchers",
1692
+ EditVouchers: "EditVouchers",
1693
+ ViewWebsiteContent: "ViewWebsiteContent",
1694
+ EditWebsiteContent: "EditWebsiteContent",
1695
+ ViewWebsiteDnsVerified: "ViewWebsiteDnsVerified",
1696
+ ViewWebsiteCertificateCreated: "ViewWebsiteCertificateCreated",
1697
+ ViewWebsiteCertificateRenewed: "ViewWebsiteCertificateRenewed",
1698
+ ViewBankAccounts: "ViewBankAccounts",
1699
+ CreateBankAccounts: "CreateBankAccounts",
1700
+ UpdateBankAccounts: "UpdateBankAccounts",
1701
+ UpdateBankAccountsAssign: "UpdateBankAccountsAssign",
1702
+ ViewAssignedBankAccount: "ViewAssignedBankAccount",
1703
+ VerifyBankAccounts: "VerifyBankAccounts",
1704
+ ViewServiceChargeConfigurations: "ViewServiceChargeConfigurations",
1705
+ EditServiceChargeConfigurations: "EditServiceChargeConfigurations",
1706
+ EditStoreDeliveryZoneFees: "EditStoreDeliveryZoneFees",
1707
+ EditStoreDeliveryFeesLimited: "EditStoreDeliveryFeesLimited",
1708
+ ViewHydraConfig: "ViewHydraConfig",
1709
+ UpdateHydraConfigManage: "UpdateHydraConfigManage",
1710
+ InitiateBluetoothPairingMode: "InitiateBluetoothPairingMode",
1711
+ DeleteTerminal: "DeleteTerminal",
1712
+ ViewKioskTelemetry: "ViewKioskTelemetry",
1713
+ HydraOnly: "HydraOnly",
1714
+ ViewCustomers: "ViewCustomers",
1715
+ EditCustomers: "EditCustomers",
1716
+ CreateCustomers: "CreateCustomers",
1717
+ CreateCatalogElements: "CreateCatalogElements",
1718
+ UpdateCatalogElements: "UpdateCatalogElements",
1719
+ ViewCatalogElements: "ViewCatalogElements",
1720
+ DeleteCatalogElements: "DeleteCatalogElements",
1721
+ ViewMetafieldDefinitions: "ViewMetafieldDefinitions",
1722
+ CreateMetafieldDefinitions: "CreateMetafieldDefinitions",
1723
+ UpdateMetafieldDefinitions: "UpdateMetafieldDefinitions",
1724
+ DeleteMetafieldDefinitions: "DeleteMetafieldDefinitions",
1725
+ UpdateMetafields: "UpdateMetafields",
1726
+ ViewCatalogMenuChanges: "ViewCatalogMenuChanges",
1727
+ PublishCatalogMenuChanges: "PublishCatalogMenuChanges",
1728
+ ViewAppStatistics: "ViewAppStatistics",
1729
+ ViewApmStatistics: "ViewApmStatistics",
1730
+ ViewCampaignsStatistics: "ViewCampaignsStatistics",
1731
+ ViewCustomerStatistics: "ViewCustomerStatistics",
1732
+ ViewLiveStatistics: "ViewLiveStatistics",
1733
+ ViewOrderStatistics: "ViewOrderStatistics",
1734
+ ViewSalesStatistics: "ViewSalesStatistics",
1735
+ ViewSalesEndOfDayStatistics: "ViewSalesEndOfDayStatistics",
1736
+ ViewVouchersStatistics: "ViewVouchersStatistics",
1737
+ DownloadCustomerCsvExport: "DownloadCustomerCsvExport",
1738
+ ViewApmAuditLogs: "ViewApmAuditLogs",
1739
+ ViewStoreAuditLogs: "ViewStoreAuditLogs",
1740
+ ViewMenuAuditLogs: "ViewMenuAuditLogs",
1741
+ ViewBankAccountAuditLogs: "ViewBankAccountAuditLogs",
1742
+ ViewFeeConfigurationsAuditLogs: "ViewFeeConfigurationsAuditLogs",
1743
+ ViewOrdersAuditLogs: "ViewOrdersAuditLogs",
1744
+ ViewVouchersAuditLogs: "ViewVouchersAuditLogs",
1745
+ ViewUserEventsAuditLogs: "ViewUserEventsAuditLogs",
1746
+ ViewCampaignsAuditLogs: "ViewCampaignsAuditLogs",
1747
+ ViewTeammatesAuditLogs: "ViewTeammatesAuditLogs",
1748
+ ViewTimedAccessAuditLogs: "ViewTimedAccessAuditLogs",
1749
+ ViewAppAuditLogs: "ViewAppAuditLogs",
1750
+ ViewCustomerAuditLogs: "ViewCustomerAuditLogs",
1751
+ ViewPrinterAuditLogs: "ViewPrinterAuditLogs",
1752
+ ViewHydraAuditLogs: "ViewHydraAuditLogs",
1753
+ ViewPushNotificationAuditLogs: "ViewPushNotificationAuditLogs",
1754
+ ViewStripeCustomConnectedAccountAuditLogs: "ViewStripeCustomConnectedAccountAuditLogs",
1755
+ ViewKioskBluetoothDeviceAuditLogs: "ViewKioskBluetoothDeviceAuditLogs",
1756
+ ViewExternalAuditLogs: "ViewExternalAuditLogs",
1757
+ CreateExternalAuditLogEvents: "CreateExternalAuditLogEvents",
1758
+ ViewCatalogAuditLogs: "ViewCatalogAuditLogs",
1759
+ ViewOrderFulfillmentAuditLogs: "ViewOrderFulfillmentAuditLogs",
1760
+ ViewChannelAuditLogs: "ViewChannelAuditLogs",
1761
+ ViewAppStoreAuditLogs: "ViewAppStoreAuditLogs",
1762
+ SendPushNotificationToCustomer: "SendPushNotificationToCustomer",
1763
+ InviteDriverToApp: "InviteDriverToApp",
1764
+ GetDriverForApp: "GetDriverForApp",
1765
+ RemoveDriverFromApp: "RemoveDriverFromApp",
1766
+ AssignDriverToOrder: "AssignDriverToOrder",
1767
+ UnassignDriverFromOrder: "UnassignDriverFromOrder",
1768
+ UpdateOrdersDeliveryTrackingStatus: "UpdateOrdersDeliveryTrackingStatus",
1769
+ UpdateOrderFulfillmentStatus: "UpdateOrderFulfillmentStatus",
1770
+ ViewFulfillmentStatesConfiguration: "ViewFulfillmentStatesConfiguration",
1771
+ CreateFulfillmentStatesConfiguration: "CreateFulfillmentStatesConfiguration",
1772
+ UpdateFulfillmentStatesConfiguration: "UpdateFulfillmentStatesConfiguration",
1773
+ DeleteFulfillmentStatesConfiguration: "DeleteFulfillmentStatesConfiguration",
1774
+ ViewPayouts: "ViewPayouts",
1775
+ ViewChannels: "ViewChannels",
1776
+ ViewOnboarding: "ViewOnboarding",
1777
+ UpdateOnboarding: "UpdateOnboarding",
1778
+ ViewClientDevices: "ViewClientDevices",
1779
+ UpdateClientDevices: "UpdateClientDevices",
1780
+ EnrollClientDevices: "EnrollClientDevices",
1781
+ AssignClientDevices: "AssignClientDevices",
1782
+ ViewClientAuditLogs: "ViewClientAuditLogs",
1783
+ CreateAppStoreAppConfiguration: "CreateAppStoreAppConfiguration",
1784
+ ViewAppStoreAppConfiguration: "ViewAppStoreAppConfiguration",
1785
+ UpdateAppStoreAppConfiguration: "UpdateAppStoreAppConfiguration",
1786
+ DeleteAppStoreAppConfiguration: "DeleteAppStoreAppConfiguration",
1787
+ UpdateAppStoreAppConfigurationSettings: "UpdateAppStoreAppConfigurationSettings",
1788
+ CreateAppStoreSubscription: "CreateAppStoreSubscription",
1789
+ UpdateAppStoreSubscription: "UpdateAppStoreSubscription",
1790
+ DeleteAppStoreSubscription: "DeleteAppStoreSubscription",
1791
+ ViewSalesChannels: "ViewSalesChannels",
1792
+ EditSalesChannels: "EditSalesChannels",
1793
+ CreateSalesChannel: "CreateSalesChannel",
1794
+ ArchiveSalesChannel: "ArchiveSalesChannel",
1795
+ UnarchiveSalesChannel: "UnarchiveSalesChannel",
1796
+ PublishSalesChannel: "PublishSalesChannel",
1797
+ UnpublishSalesChannel: "UnpublishSalesChannel",
1798
+ CloneSalesChannel: "CloneSalesChannel",
1799
+ ViewPayGreenWhiteLabelConfiguration: "ViewPayGreenWhiteLabelConfiguration",
1800
+ CreatePayGreenWhiteLabelConfiguration: "CreatePayGreenWhiteLabelConfiguration",
1801
+ UpdatePayGreenWhiteLabelConfiguration: "UpdatePayGreenWhiteLabelConfiguration",
1802
+ UpdatePayGreenStoreConfiguration: "UpdatePayGreenStoreConfiguration",
1803
+ ViewSubscriptions: "ViewSubscriptions",
1804
+ ViewInvoices: "ViewInvoices",
1805
+ EditAccountsBills: "EditAccountsBills",
1806
+ ViewAccountsBills: "ViewAccountsBills",
1807
+ EditAccountsCategories: "EditAccountsCategories",
1808
+ ViewAccountsCategories: "ViewAccountsCategories",
1809
+ EditAccountsCreditAccounts: "EditAccountsCreditAccounts",
1810
+ ViewAccountsCreditAccounts: "ViewAccountsCreditAccounts",
1811
+ EditAccountsCreditBooks: "EditAccountsCreditBooks",
1812
+ ViewAccountsCreditBooks: "ViewAccountsCreditBooks",
1813
+ EditAccountsExpenses: "EditAccountsExpenses",
1814
+ ViewAccountsExpenses: "ViewAccountsExpenses",
1815
+ EditAccountsTransactionAccounts: "EditAccountsTransactionAccounts",
1816
+ ViewAccountsTransactionAccounts: "ViewAccountsTransactionAccounts",
1817
+ EditDocumentExplorer: "EditDocumentExplorer",
1818
+ ViewDocumentExplorer: "ViewDocumentExplorer",
1819
+ ViewInventoryReports: "ViewInventoryReports",
1820
+ EditInventoryPurchaseOrders: "EditInventoryPurchaseOrders",
1821
+ ViewInventoryPurchaseOrders: "ViewInventoryPurchaseOrders",
1822
+ EditInventoryStockItems: "EditInventoryStockItems",
1823
+ ViewInventoryStockItems: "ViewInventoryStockItems",
1824
+ EditInventorySupplier: "EditInventorySupplier",
1825
+ ViewInventorySupplier: "ViewInventorySupplier",
1826
+ EditInventoryTrackingProfiles: "EditInventoryTrackingProfiles",
1827
+ ViewInventoryTrackingProfiles: "ViewInventoryTrackingProfiles",
1828
+ ViewPayrollReports: "ViewPayrollReports",
1829
+ EditPayrollHoliday: "EditPayrollHoliday",
1830
+ ViewPayrollHoliday: "ViewPayrollHoliday",
1831
+ EditPayrollRota: "EditPayrollRota",
1832
+ ViewPayrollRota: "ViewPayrollRota",
1833
+ EditPayrollStaff: "EditPayrollStaff",
1834
+ ViewPayrollStaff: "ViewPayrollStaff",
1835
+ ViewSalesReports: "ViewSalesReports",
1836
+ ViewCostReports: "ViewCostReports",
1837
+ ViewMenuReports: "ViewMenuReports",
1838
+ ViewBrand: "ViewBrand",
1839
+ EditBrand: "EditBrand",
1840
+ CreateBrand: "CreateBrand",
1841
+ TransferBrand: "TransferBrand",
1842
+ ViewProperty: "ViewProperty",
1843
+ EditProperty: "EditProperty",
1844
+ CreateProperty: "CreateProperty",
1845
+ ArchiveProperty: "ArchiveProperty",
1846
+ ViewEntityFeatureFlags: "ViewEntityFeatureFlags",
1847
+ EditEntityFeatureFlags: "EditEntityFeatureFlags",
1848
+ CreateOrg: "CreateOrg",
1849
+ CreateOrgApiKey: "CreateOrgAPIKey",
1850
+ EditOrg: "EditOrg",
1851
+ ViewOrg: "ViewOrg",
1852
+ ViewWebhooks: "ViewWebhooks",
1853
+ EditWebhooks: "EditWebhooks",
1854
+ ViewOwnPermissions: "ViewOwnPermissions",
1855
+ LeaveOrg: "LeaveOrg",
1856
+ CreatePosSale: "CreatePosSale",
1857
+ ComplimentPosItems: "ComplimentPosItems",
1858
+ ApplyPosDiscounts: "ApplyPosDiscounts",
1859
+ CancelPosSales: "CancelPosSales",
1860
+ DeliverSale: "DeliverSale",
1861
+ PerformCashingUp: "PerformCashingUp",
1862
+ OpenCashDrawer: "OpenCashDrawer",
1863
+ EditPosSettings: "EditPosSettings",
1864
+ EditPosLayout: "EditPosLayout",
1865
+ ViewPosDailySummaryReport: "ViewPosDailySummaryReport",
1866
+ ViewPosDriverSalesReport: "ViewPosDriverSalesReport",
1867
+ CreatePurchaseOrder: "CreatePurchaseOrder",
1868
+ SubmitPurchaseOrder: "SubmitPurchaseOrder",
1869
+ ReceivePurchaseOrder: "ReceivePurchaseOrder",
1870
+ ViewBusinessInsights: "ViewBusinessInsights",
1871
+ SnoozePosMenu: "SnoozePosMenu",
1872
+ SnoozePosMenuIndefinitely: "SnoozePosMenuIndefinitely",
1873
+ SnoozePosItem: "SnoozePosItem",
1874
+ SnoozePosItemIndefinitely: "SnoozePosItemIndefinitely",
1875
+ SnoozePosProperty: "SnoozePosProperty",
1876
+ SendSmsToCustomers: "SendSmsToCustomers",
1877
+ RoleAdmin: "RoleAdmin",
1878
+ RoleFactory: "RoleFactory",
1879
+ RoleAuthDeveloper: "RoleAuthDeveloper",
1880
+ RoleFlipdishStaff: "RoleFlipdishStaff"
1881
+ };
1882
+ var RoleNames = {
1883
+ Admin: "Admin",
1884
+ Factory: "Factory",
1885
+ AuthDeveloper: "AuthDeveloper",
1886
+ FlipdishStaff: "FlipdishStaff"
1887
+ };
1888
+
1889
+ // src/index.ts
1890
+ function createFlipdishClient(options = {}) {
1891
+ const {
1892
+ baseUrl = DEFAULT_BASE_URL,
1893
+ accessToken,
1894
+ headers,
1895
+ fetch,
1896
+ config,
1897
+ ...identity
1898
+ } = options;
1899
+ const client2 = createClient(
1900
+ createConfig({
1901
+ ...config,
1902
+ baseUrl,
1903
+ fetch: withJsonContentTypeFallback(fetch ?? config?.fetch),
1904
+ auth: accessToken === void 0 ? config?.auth : typeof accessToken === "function" ? () => accessToken() : accessToken,
1905
+ headers: mergeHeaders(
1906
+ identityHeaders(SDK_INFO, identity),
1907
+ config?.headers,
1908
+ headers
1909
+ )
1910
+ })
1911
+ );
1912
+ return new AuthorizationClient({ client: client2 });
1913
+ }
1914
+ function configureClientIdentity(options) {
1915
+ client.setConfig({ headers: identityHeaders(SDK_INFO, options) });
1916
+ }
1917
+ export {
1918
+ AuthorizationClient,
1919
+ CLIENT_HEADER,
1920
+ Permissions,
1921
+ RoleNames,
1922
+ SDK_INFO,
1923
+ buildIdentity,
1924
+ client,
1925
+ configureClientIdentity,
1926
+ createFlipdishClient
1927
+ };
1928
+ //# sourceMappingURL=index.mjs.map