@flipdish/authorization 0.0.0-preview.184.g0a86e1e

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