@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.mjs ADDED
@@ -0,0 +1,1878 @@
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/identity.ts
780
+ var CLIENT_HEADER = "X-Flipdish-Client";
781
+ function detectRuntime() {
782
+ const g = globalThis;
783
+ const proc = typeof g.process === "object" ? g.process : void 0;
784
+ const versions = proc?.versions ?? {};
785
+ const isBrowser = typeof g.window !== "undefined" && typeof g.document !== "undefined";
786
+ let runtime;
787
+ if (versions.bun) {
788
+ runtime = `bun/${versions.bun}`;
789
+ } else if (versions.deno) {
790
+ runtime = `deno/${versions.deno}`;
791
+ } else if (versions.node) {
792
+ runtime = `node/${versions.node}`;
793
+ }
794
+ return {
795
+ isServer: !isBrowser && runtime !== void 0,
796
+ env: proc?.env ?? {},
797
+ runtime
798
+ };
799
+ }
800
+ function sanitize(value) {
801
+ const cleaned = value?.trim().replace(/[^A-Za-z0-9._@+-]+/g, "-").replace(/^-+|-+$/g, "");
802
+ return cleaned ? cleaned : void 0;
803
+ }
804
+ function firstDefined(...values) {
805
+ for (const value of values) {
806
+ const cleaned = sanitize(value);
807
+ if (cleaned) {
808
+ return cleaned;
809
+ }
810
+ }
811
+ return void 0;
812
+ }
813
+ function buildIdentity(sdk, options = {}, runtimeInfo = detectRuntime()) {
814
+ const { env } = runtimeInfo;
815
+ const clientName = firstDefined(
816
+ options.clientName,
817
+ env.FLIPDISH_CLIENT_NAME,
818
+ env.DD_SERVICE,
819
+ env.AWS_LAMBDA_FUNCTION_NAME,
820
+ env.npm_package_name
821
+ );
822
+ const clientVersion = firstDefined(
823
+ options.clientVersion,
824
+ env.FLIPDISH_CLIENT_VERSION,
825
+ env.DD_VERSION,
826
+ env.npm_package_version
827
+ );
828
+ const environment = firstDefined(env.DD_ENV, env.NODE_ENV);
829
+ const parts = [`Flipdish-${sanitize(sdk.name)}-ts/${sanitize(sdk.version)}`];
830
+ if (clientName) {
831
+ parts.push(clientVersion ? `${clientName}/${clientVersion}` : clientName);
832
+ }
833
+ if (environment) {
834
+ parts.push(`env/${environment}`);
835
+ }
836
+ if (runtimeInfo.runtime) {
837
+ parts.push(runtimeInfo.runtime);
838
+ }
839
+ const suffix = options.userAgentSuffix?.replace(/[^\x20-\x7e]+/g, "").trim();
840
+ if (suffix) {
841
+ parts.push(suffix);
842
+ }
843
+ return parts.join(" ");
844
+ }
845
+ function identityHeaders(sdk, options = {}, runtimeInfo = detectRuntime()) {
846
+ const identity = buildIdentity(sdk, options, runtimeInfo);
847
+ const headers = { [CLIENT_HEADER]: identity };
848
+ if (runtimeInfo.isServer) {
849
+ headers["User-Agent"] = identity;
850
+ }
851
+ return headers;
852
+ }
853
+ var defaultHeaders2;
854
+ function defaultIdentityHeaders(sdk) {
855
+ defaultHeaders2 ?? (defaultHeaders2 = identityHeaders(sdk));
856
+ return defaultHeaders2;
857
+ }
858
+
859
+ // src/sdk-info.ts
860
+ var SDK_INFO = { "name": "authorization", "version": "0.0.0-preview.184.g0a86e1e" };
861
+ var DEFAULT_BASE_URL = "https://api.flipdish.co/auth";
862
+
863
+ // src/flipdish-runtime.ts
864
+ var createClientConfig = (config) => ({
865
+ ...config,
866
+ headers: mergeHeaders(defaultIdentityHeaders(SDK_INFO), config?.headers)
867
+ });
868
+
869
+ // src/gen/client.gen.ts
870
+ var client = createClient(createClientConfig(createConfig({ baseUrl: "https://api.flipdish.co/auth" })));
871
+
872
+ // src/gen/sdk.gen.ts
873
+ var HeyApiClient = class {
874
+ constructor(args) {
875
+ this.client = args?.client ?? client;
876
+ }
877
+ };
878
+ var HeyApiRegistry = class {
879
+ constructor() {
880
+ this.defaultKey = "default";
881
+ this.instances = /* @__PURE__ */ new Map();
882
+ }
883
+ get(key) {
884
+ const instance = this.instances.get(key ?? this.defaultKey);
885
+ if (!instance) {
886
+ throw new Error(`No SDK client found. Create one with "new AuthorizationClient()" to fix this error.`);
887
+ }
888
+ return instance;
889
+ }
890
+ set(value, key) {
891
+ this.instances.set(key ?? this.defaultKey, value);
892
+ }
893
+ };
894
+ var _AuthorizationClient = class _AuthorizationClient extends HeyApiClient {
895
+ constructor(args) {
896
+ super(args);
897
+ _AuthorizationClient.__registry.set(this, args?.key);
898
+ }
899
+ /**
900
+ * Authorize Request
901
+ *
902
+ * Check if a user is authorized to perform an action
903
+ */
904
+ authorize(options) {
905
+ return (options?.client ?? this.client).post({
906
+ security: [{ name: "Authorization", type: "apiKey" }],
907
+ url: "/authorize",
908
+ ...options,
909
+ headers: {
910
+ "Content-Type": "application/json",
911
+ ...options?.headers
912
+ }
913
+ });
914
+ }
915
+ /**
916
+ * Authorize Batch Request
917
+ *
918
+ * Check if a user is authorized to perform an action on multiple resources
919
+ */
920
+ authorizeBatch(options) {
921
+ return (options?.client ?? this.client).post({
922
+ security: [{ name: "Authorization", type: "apiKey" }],
923
+ url: "/authorize/batch",
924
+ ...options,
925
+ headers: {
926
+ "Content-Type": "application/json",
927
+ ...options?.headers
928
+ }
929
+ });
930
+ }
931
+ /**
932
+ * Authorize Batch Checks Request
933
+ *
934
+ * Check whether each principal/resource/action tuple is authorized
935
+ */
936
+ authorizeBatchChecks(options) {
937
+ return (options?.client ?? this.client).post({
938
+ security: [{ name: "Authorization", type: "apiKey" }],
939
+ url: "/authorize/batch/checks",
940
+ ...options,
941
+ headers: {
942
+ "Content-Type": "application/json",
943
+ ...options?.headers
944
+ }
945
+ });
946
+ }
947
+ /**
948
+ * Check Is In Role
949
+ *
950
+ * Check if a user is in any/all of the roles
951
+ */
952
+ checkIsInRole(options) {
953
+ return (options?.client ?? this.client).post({
954
+ security: [{ name: "Authorization", type: "apiKey" }],
955
+ url: "/checkIsInRole",
956
+ ...options,
957
+ headers: {
958
+ "Content-Type": "application/json",
959
+ ...options?.headers
960
+ }
961
+ });
962
+ }
963
+ /**
964
+ * Authenticate and Check Is In Role
965
+ *
966
+ * Authenticate and check if a user is in any/all of the roles
967
+ */
968
+ authenticateAndCheckIsInRole(options) {
969
+ return (options?.client ?? this.client).post({
970
+ security: [{ name: "Authorization", type: "apiKey" }],
971
+ url: "/authenticateAndCheckIsInRole",
972
+ ...options,
973
+ headers: {
974
+ "Content-Type": "application/json",
975
+ ...options?.headers
976
+ }
977
+ });
978
+ }
979
+ /**
980
+ * Authenticate and authorize Request
981
+ *
982
+ * Authenticate and authorize a user to perform an action
983
+ */
984
+ authenticateAndAuthorize(options) {
985
+ return (options.client ?? this.client).post({
986
+ security: [{ name: "Authorization", type: "apiKey" }],
987
+ url: "/authenticateAndAuthorize",
988
+ ...options,
989
+ headers: {
990
+ "Content-Type": "application/json",
991
+ ...options.headers
992
+ }
993
+ });
994
+ }
995
+ /**
996
+ * Get Authorized Orgs
997
+ *
998
+ * Get the authorized orgs for a given principal
999
+ */
1000
+ getAuthorizedOrgs(options) {
1001
+ return (options?.client ?? this.client).post({
1002
+ security: [{ name: "Authorization", type: "apiKey" }],
1003
+ url: "/getAuthorizedOrgs",
1004
+ ...options,
1005
+ headers: {
1006
+ "Content-Type": "application/json",
1007
+ ...options?.headers
1008
+ }
1009
+ });
1010
+ }
1011
+ /**
1012
+ * Get Authorized Properties
1013
+ *
1014
+ * Get the authorized properties for a given org
1015
+ */
1016
+ getAuthorizedProperties(options) {
1017
+ return (options.client ?? this.client).post({
1018
+ security: [{ name: "Authorization", type: "apiKey" }],
1019
+ url: "/orgs/{orgId}/getAuthorizedProperties",
1020
+ ...options,
1021
+ headers: {
1022
+ "Content-Type": "application/json",
1023
+ ...options.headers
1024
+ }
1025
+ });
1026
+ }
1027
+ /**
1028
+ * Get Authorized Brands
1029
+ *
1030
+ * Get the authorized brands for a given org
1031
+ */
1032
+ getAuthorizedBrands(options) {
1033
+ return (options.client ?? this.client).post({
1034
+ security: [{ name: "Authorization", type: "apiKey" }],
1035
+ url: "/orgs/{orgId}/getAuthorizedBrands",
1036
+ ...options,
1037
+ headers: {
1038
+ "Content-Type": "application/json",
1039
+ ...options.headers
1040
+ }
1041
+ });
1042
+ }
1043
+ /**
1044
+ * List Users in Org
1045
+ *
1046
+ * List the users in a given org
1047
+ */
1048
+ listUsersInOrg(options) {
1049
+ return (options.client ?? this.client).get({
1050
+ security: [{ name: "Authorization", type: "apiKey" }],
1051
+ url: "/orgs/{orgId}/users",
1052
+ ...options
1053
+ });
1054
+ }
1055
+ /**
1056
+ * List User Permissions
1057
+ *
1058
+ * List the available permissions for a given user
1059
+ */
1060
+ listUserPermissions(options) {
1061
+ return (options.client ?? this.client).get({
1062
+ security: [{ name: "Authorization", type: "apiKey" }],
1063
+ url: "/orgs/{orgId}/user/{userId}/permissions",
1064
+ ...options
1065
+ });
1066
+ }
1067
+ /**
1068
+ * List Own Permissions
1069
+ *
1070
+ * List the available permissions for the current user
1071
+ */
1072
+ listOwnPermissions(options) {
1073
+ return (options.client ?? this.client).get({
1074
+ security: [{ name: "Authorization", type: "apiKey" }],
1075
+ url: "/orgs/{orgId}/user/permissions",
1076
+ ...options
1077
+ });
1078
+ }
1079
+ /**
1080
+ * List Own Roles
1081
+ *
1082
+ * List the role assignments for the current user in the org
1083
+ */
1084
+ listOwnRoles(options) {
1085
+ return (options.client ?? this.client).get({
1086
+ security: [{ name: "Authorization", type: "apiKey" }],
1087
+ url: "/orgs/{orgId}/user/roles",
1088
+ ...options
1089
+ });
1090
+ }
1091
+ /**
1092
+ * List Org Roles
1093
+ *
1094
+ * List the current roles assignments in the org
1095
+ */
1096
+ listOrgRoles(options) {
1097
+ return (options.client ?? this.client).get({
1098
+ security: [{ name: "Authorization", type: "apiKey" }],
1099
+ url: "/orgs/{orgId}/roles",
1100
+ ...options
1101
+ });
1102
+ }
1103
+ /**
1104
+ * List Org Permissions
1105
+ *
1106
+ * List the current permission assignments in the org
1107
+ */
1108
+ listOrgPermissions(options) {
1109
+ return (options.client ?? this.client).get({
1110
+ security: [{ name: "Authorization", type: "apiKey" }],
1111
+ url: "/orgs/{orgId}/permissions",
1112
+ ...options
1113
+ });
1114
+ }
1115
+ /**
1116
+ * Get principal org memberships
1117
+ *
1118
+ * 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.
1119
+ */
1120
+ getPrincipalOrgs(options) {
1121
+ return (options.client ?? this.client).get({
1122
+ security: [{ name: "Authorization", type: "apiKey" }],
1123
+ url: "/principals/{principalId}/orgs",
1124
+ ...options
1125
+ });
1126
+ }
1127
+ /**
1128
+ * Revoke the caller's active timed access pass early
1129
+ *
1130
+ * 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.
1131
+ */
1132
+ revokeTimedAccessGrant(options) {
1133
+ return (options.client ?? this.client).delete({
1134
+ security: [{ name: "Authorization", type: "apiKey" }],
1135
+ url: "/orgs/{orgId}/timedAccess/grants",
1136
+ ...options
1137
+ });
1138
+ }
1139
+ /**
1140
+ * List the caller's active timed access pass for an org
1141
+ *
1142
+ * Returns the authenticated caller's active pass for the requested org.
1143
+ */
1144
+ listMyTimedAccessGrants(options) {
1145
+ return (options.client ?? this.client).get({
1146
+ security: [{ name: "Authorization", type: "apiKey" }],
1147
+ url: "/orgs/{orgId}/timedAccess/grants",
1148
+ ...options
1149
+ });
1150
+ }
1151
+ /**
1152
+ * Create a timed access pass
1153
+ *
1154
+ * 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.
1155
+ */
1156
+ createTimedAccessGrant(options) {
1157
+ return (options.client ?? this.client).post({
1158
+ security: [{ name: "Authorization", type: "apiKey" }],
1159
+ url: "/orgs/{orgId}/timedAccess/grants",
1160
+ ...options,
1161
+ headers: {
1162
+ "Content-Type": "application/json",
1163
+ ...options.headers
1164
+ }
1165
+ });
1166
+ }
1167
+ /**
1168
+ * List the caller's timed access passes across every org
1169
+ *
1170
+ * 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.
1171
+ */
1172
+ listMyTimedAccessGrantsAcrossOrgs(options) {
1173
+ return (options?.client ?? this.client).get({
1174
+ security: [{ name: "Authorization", type: "apiKey" }],
1175
+ url: "/timedAccess/grants",
1176
+ ...options
1177
+ });
1178
+ }
1179
+ /**
1180
+ * An org's expired timed access grant history
1181
+ *
1182
+ * 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.
1183
+ */
1184
+ listExpiredTimedAccessGrantsForOrg(options) {
1185
+ return (options.client ?? this.client).get({
1186
+ security: [{ name: "Authorization", type: "apiKey" }],
1187
+ url: "/orgs/{orgId}/timedAccess/grants/expired",
1188
+ ...options
1189
+ });
1190
+ }
1191
+ /**
1192
+ * Assign a named role
1193
+ *
1194
+ * 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.
1195
+ */
1196
+ applyNamedRole(options) {
1197
+ return (options?.client ?? this.client).post({
1198
+ security: [{ name: "Authorization", type: "apiKey" }],
1199
+ url: "/namedRoles/apply",
1200
+ ...options,
1201
+ headers: {
1202
+ "Content-Type": "application/json",
1203
+ ...options?.headers
1204
+ }
1205
+ });
1206
+ }
1207
+ /**
1208
+ * Remove a named role
1209
+ *
1210
+ * 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.
1211
+ */
1212
+ removeNamedRole(options) {
1213
+ return (options?.client ?? this.client).post({
1214
+ security: [{ name: "Authorization", type: "apiKey" }],
1215
+ url: "/namedRoles/remove",
1216
+ ...options,
1217
+ headers: {
1218
+ "Content-Type": "application/json",
1219
+ ...options?.headers
1220
+ }
1221
+ });
1222
+ }
1223
+ /**
1224
+ * List named roles for a user
1225
+ *
1226
+ * 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.
1227
+ */
1228
+ listNamedRoles(options) {
1229
+ return (options.client ?? this.client).get({
1230
+ security: [{ name: "Authorization", type: "apiKey" }],
1231
+ url: "/namedRoles/{principalId}",
1232
+ ...options
1233
+ });
1234
+ }
1235
+ /**
1236
+ * Rematerialize Role Assignment
1237
+ *
1238
+ * Reconciles policy assignments for the role assignment principal: creates missing policies and revokes leftovers that materialize no longer emits
1239
+ */
1240
+ rematerializeRoleAssignmentV2(options) {
1241
+ return (options.client ?? this.client).post({
1242
+ security: [{ name: "Authorization", type: "apiKey" }],
1243
+ url: "/orgs/{orgId}/roleAssignments/rematerialize",
1244
+ ...options,
1245
+ headers: {
1246
+ "Content-Type": "application/json",
1247
+ ...options.headers
1248
+ }
1249
+ });
1250
+ }
1251
+ /**
1252
+ * Apply role assignment
1253
+ *
1254
+ * Apply a role assignment for the target user without invoking legacy teammate/Zeus role assignment flows.
1255
+ */
1256
+ applyRoleAssignment(options) {
1257
+ return (options.client ?? this.client).post({
1258
+ security: [{ name: "Authorization", type: "apiKey" }],
1259
+ url: "/orgs/{orgId}/roleAssignments/apply",
1260
+ ...options,
1261
+ headers: {
1262
+ "Content-Type": "application/json",
1263
+ ...options.headers
1264
+ }
1265
+ });
1266
+ }
1267
+ /**
1268
+ * Remove teammate
1269
+ *
1270
+ * 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.
1271
+ */
1272
+ removeTeammate(options) {
1273
+ return (options.client ?? this.client).post({
1274
+ security: [{ name: "Authorization", type: "apiKey" }],
1275
+ url: "/orgs/{orgId}/roleAssignments/remove",
1276
+ ...options,
1277
+ headers: {
1278
+ "Content-Type": "application/json",
1279
+ ...options.headers
1280
+ }
1281
+ });
1282
+ }
1283
+ /**
1284
+ * Leave org
1285
+ *
1286
+ * 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.
1287
+ */
1288
+ leaveOrg(options) {
1289
+ return (options.client ?? this.client).post({
1290
+ security: [{ name: "Authorization", type: "apiKey" }],
1291
+ url: "/orgs/{orgId}/leave",
1292
+ ...options
1293
+ });
1294
+ }
1295
+ /**
1296
+ * Invite teammate
1297
+ *
1298
+ * 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.
1299
+ */
1300
+ inviteTeammate(options) {
1301
+ return (options.client ?? this.client).post({
1302
+ security: [{ name: "Authorization", type: "apiKey" }],
1303
+ url: "/orgs/{orgId}/teammates/invite",
1304
+ ...options,
1305
+ headers: {
1306
+ "Content-Type": "application/json",
1307
+ ...options.headers
1308
+ }
1309
+ });
1310
+ }
1311
+ /**
1312
+ * Create an invite token
1313
+ *
1314
+ * Mints an opaque invite token after validating the RMS terminal passport. Call again when a previous token expires to get a new one.
1315
+ */
1316
+ createInviteToken(options) {
1317
+ return (options.client ?? this.client).post({
1318
+ security: [{ name: "Authorization", type: "apiKey" }],
1319
+ url: "/orgs/{orgId}/inviteTokens",
1320
+ ...options,
1321
+ headers: {
1322
+ "Content-Type": "application/json",
1323
+ ...options.headers
1324
+ }
1325
+ });
1326
+ }
1327
+ /**
1328
+ * List pending join requests for an organization
1329
+ *
1330
+ * Returns pending AccessRequests for an org. Optional propertyId/brandId filters. Requires ViewTeammates on orgId.
1331
+ */
1332
+ listJoinAccessRequests(options) {
1333
+ return (options.client ?? this.client).get({
1334
+ security: [{ name: "Authorization", type: "apiKey" }],
1335
+ url: "/orgs/{orgId}/joinRequests",
1336
+ ...options
1337
+ });
1338
+ }
1339
+ /**
1340
+ * Submit a join access request from an invite token
1341
+ *
1342
+ * Validates the opaque invite token and creates (or returns) a pending AccessRequest for the property/role encoded on the token.
1343
+ */
1344
+ createJoinAccessRequest(options) {
1345
+ return (options.client ?? this.client).post({
1346
+ security: [{ name: "Authorization", type: "apiKey" }],
1347
+ url: "/orgs/{orgId}/joinRequests",
1348
+ ...options,
1349
+ headers: {
1350
+ "Content-Type": "application/json",
1351
+ ...options.headers
1352
+ }
1353
+ });
1354
+ }
1355
+ /**
1356
+ * Get a join access request by id
1357
+ *
1358
+ * Returns request status for the authenticated requester only. Owners should use the list endpoint.
1359
+ */
1360
+ getJoinAccessRequest(options) {
1361
+ return (options.client ?? this.client).get({
1362
+ security: [{ name: "Authorization", type: "apiKey" }],
1363
+ url: "/orgs/{orgId}/joinRequests/{requestId}",
1364
+ ...options
1365
+ });
1366
+ }
1367
+ /**
1368
+ * Accept a pending join access request
1369
+ *
1370
+ * 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.
1371
+ */
1372
+ acceptJoinAccessRequest(options) {
1373
+ return (options.client ?? this.client).post({
1374
+ security: [{ name: "Authorization", type: "apiKey" }],
1375
+ url: "/orgs/{orgId}/joinRequests/{requestId}/accept",
1376
+ ...options,
1377
+ headers: {
1378
+ "Content-Type": "application/json",
1379
+ ...options.headers
1380
+ }
1381
+ });
1382
+ }
1383
+ /**
1384
+ * Reject a pending join access request
1385
+ *
1386
+ * Rejects a pending AccessRequest without granting access.
1387
+ */
1388
+ rejectJoinAccessRequest(options) {
1389
+ return (options.client ?? this.client).post({
1390
+ security: [{ name: "Authorization", type: "apiKey" }],
1391
+ url: "/orgs/{orgId}/joinRequests/{requestId}/reject",
1392
+ ...options
1393
+ });
1394
+ }
1395
+ /**
1396
+ * List global API keys
1397
+ *
1398
+ * List Automation API keys (non-secret fields). Optional status filter (active|revoked). Requires ListGlobalAPIKeys.
1399
+ */
1400
+ listGlobalApiKeys(options) {
1401
+ return (options?.client ?? this.client).get({
1402
+ security: [{ name: "Authorization", type: "apiKey" }],
1403
+ url: "/apiKeys",
1404
+ ...options
1405
+ });
1406
+ }
1407
+ /**
1408
+ * Create global API key
1409
+ *
1410
+ * Create an Automation API key (optional org association). Requires CreateGlobalAPIKey. Raw secret is returned once.
1411
+ */
1412
+ createGlobalApiKey(options) {
1413
+ return (options?.client ?? this.client).post({
1414
+ security: [{ name: "Authorization", type: "apiKey" }],
1415
+ url: "/apiKeys",
1416
+ ...options,
1417
+ headers: {
1418
+ "Content-Type": "application/json",
1419
+ ...options?.headers
1420
+ }
1421
+ });
1422
+ }
1423
+ /**
1424
+ * Get current API key state
1425
+ *
1426
+ * Self-introspection for the authenticated Automation API key (x-api-key). Returns non-secret fields only.
1427
+ */
1428
+ getGlobalApiKeyMe(options) {
1429
+ return (options?.client ?? this.client).get({
1430
+ security: [{ name: "Authorization", type: "apiKey" }],
1431
+ url: "/apiKeys/me",
1432
+ ...options
1433
+ });
1434
+ }
1435
+ /**
1436
+ * Authenticate API key
1437
+ *
1438
+ * 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.
1439
+ */
1440
+ authenticateApiKey(options) {
1441
+ return (options?.client ?? this.client).get({
1442
+ security: [{ name: "Authorization", type: "apiKey" }],
1443
+ url: "/apiKey/authenticate",
1444
+ ...options
1445
+ });
1446
+ }
1447
+ /**
1448
+ * Update global API key
1449
+ *
1450
+ * Update permissions, resources, and/or expiry for any Automation API key. Rotates the STATIC AVP policy.
1451
+ */
1452
+ updateGlobalApiKey(options) {
1453
+ return (options.client ?? this.client).post({
1454
+ security: [{ name: "Authorization", type: "apiKey" }],
1455
+ url: "/apiKeys/{apiKeyId}",
1456
+ ...options,
1457
+ headers: {
1458
+ "Content-Type": "application/json",
1459
+ ...options.headers
1460
+ }
1461
+ });
1462
+ }
1463
+ /**
1464
+ * Revoke global API key
1465
+ *
1466
+ * Delete the STATIC AVP policy and mark the API key revoked.
1467
+ */
1468
+ revokeGlobalApiKey(options) {
1469
+ return (options.client ?? this.client).post({
1470
+ security: [{ name: "Authorization", type: "apiKey" }],
1471
+ url: "/apiKeys/{apiKeyId}/revoke",
1472
+ ...options
1473
+ });
1474
+ }
1475
+ /**
1476
+ * Get principal access block
1477
+ *
1478
+ * Get the current access block for a principal. Requires BlockPrincipalAccess.
1479
+ */
1480
+ getPrincipalAccessBlock(options) {
1481
+ return (options.client ?? this.client).get({
1482
+ security: [{ name: "Authorization", type: "apiKey" }],
1483
+ url: "/principals/block",
1484
+ ...options
1485
+ });
1486
+ }
1487
+ /**
1488
+ * Block principal access
1489
+ *
1490
+ * 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.
1491
+ */
1492
+ blockPrincipalAccess(options) {
1493
+ return (options?.client ?? this.client).post({
1494
+ security: [{ name: "Authorization", type: "apiKey" }],
1495
+ url: "/principals/block",
1496
+ ...options,
1497
+ headers: {
1498
+ "Content-Type": "application/json",
1499
+ ...options?.headers
1500
+ }
1501
+ });
1502
+ }
1503
+ /**
1504
+ * Unblock principal access
1505
+ *
1506
+ * Start restoring existing role assignments. The access_block flag is removed asynchronously after restoration completes, and authorization remains denied until then. Requires BlockPrincipalAccess.
1507
+ */
1508
+ unblockPrincipalAccess(options) {
1509
+ return (options?.client ?? this.client).post({
1510
+ security: [{ name: "Authorization", type: "apiKey" }],
1511
+ url: "/principals/unblock",
1512
+ ...options,
1513
+ headers: {
1514
+ "Content-Type": "application/json",
1515
+ ...options?.headers
1516
+ }
1517
+ });
1518
+ }
1519
+ /**
1520
+ * List principal access blocks
1521
+ *
1522
+ * List currently blocked principals. Optional type filter. Requires BlockPrincipalAccess.
1523
+ */
1524
+ listPrincipalAccessBlocks(options) {
1525
+ return (options?.client ?? this.client).get({
1526
+ security: [{ name: "Authorization", type: "apiKey" }],
1527
+ url: "/principals/blocks",
1528
+ ...options
1529
+ });
1530
+ }
1531
+ /**
1532
+ * List Permissions
1533
+ *
1534
+ * List the available permissions
1535
+ */
1536
+ listPermissions(options) {
1537
+ return (options?.client ?? this.client).get({
1538
+ security: [{ name: "Authorization", type: "apiKey" }],
1539
+ url: "/config/permissions",
1540
+ ...options
1541
+ });
1542
+ }
1543
+ /**
1544
+ * List Roles
1545
+ *
1546
+ * List the available roles
1547
+ */
1548
+ listRoles(options) {
1549
+ return (options?.client ?? this.client).get({
1550
+ security: [{ name: "Authorization", type: "apiKey" }],
1551
+ url: "/config/roles",
1552
+ ...options
1553
+ });
1554
+ }
1555
+ /**
1556
+ * List Role Definitions
1557
+ *
1558
+ * List the teammate roles with the permissions they grant at each hierarchy level, including optional permission sets
1559
+ */
1560
+ listRoleDefinitions(options) {
1561
+ return (options?.client ?? this.client).get({
1562
+ security: [{ name: "Authorization", type: "apiKey" }],
1563
+ url: "/config/roleDefinitions",
1564
+ ...options
1565
+ });
1566
+ }
1567
+ };
1568
+ _AuthorizationClient.__registry = new HeyApiRegistry();
1569
+ var AuthorizationClient = _AuthorizationClient;
1570
+
1571
+ // src/gen/types.gen.ts
1572
+ var Permissions = {
1573
+ AnyAuditLogs: "AnyAuditLogs",
1574
+ ViewApp: "ViewApp",
1575
+ CreateApp: "CreateApp",
1576
+ UpdateApp: "UpdateApp",
1577
+ ViewAppName: "ViewAppName",
1578
+ EditAppAssets: "EditAppAssets",
1579
+ EditAppFeatures: "EditAppFeatures",
1580
+ ViewTeammates: "ViewTeammates",
1581
+ EditTeammates: "EditTeammates",
1582
+ CreateTeammateOwner: "CreateTeammateOwner",
1583
+ CreateTeammateManagedOwner: "CreateTeammateManagedOwner",
1584
+ CreateTeammateStoreOwner: "CreateTeammateStoreOwner",
1585
+ CreateTeammateStoreManager: "CreateTeammateStoreManager",
1586
+ CreateTeammateStoreStaff: "CreateTeammateStoreStaff",
1587
+ CreateTeammateStoreReadAccess: "CreateTeammateStoreReadAccess",
1588
+ CreateTeammateFinanceManager: "CreateTeammateFinanceManager",
1589
+ CreateTeammateIntegrator: "CreateTeammateIntegrator",
1590
+ CreateTeammateOnboarding: "CreateTeammateOnboarding",
1591
+ CreateTeammatePropertyManager: "CreateTeammatePropertyManager",
1592
+ CreateTeammatePropertyOwner: "CreateTeammatePropertyOwner",
1593
+ CreateTeammateStaffMember: "CreateTeammateStaffMember",
1594
+ CreateTeammateCourier: "CreateTeammateCourier",
1595
+ ViewApmConfigurations: "ViewApmConfigurations",
1596
+ EditApmConfigurations: "EditApmConfigurations",
1597
+ ViewCampaignsConfigurations: "ViewCampaignsConfigurations",
1598
+ CreateCampaignsConfigurations: "CreateCampaignsConfigurations",
1599
+ UpdateCampaignsConfigurations: "UpdateCampaignsConfigurations",
1600
+ DeleteCampaignsConfigurations: "DeleteCampaignsConfigurations",
1601
+ StampLoyaltyCardAgainstCampaignsConfigurations: "StampLoyaltyCardAgainstCampaignsConfigurations",
1602
+ ViewDevelopersSettings: "ViewDevelopersSettings",
1603
+ EditDevelopersSettings: "EditDevelopersSettings",
1604
+ ViewOrders: "ViewOrders",
1605
+ UpdateOrdersAccept: "UpdateOrdersAccept",
1606
+ UpdateOrdersReject: "UpdateOrdersReject",
1607
+ UpdateOrdersRefund: "UpdateOrdersRefund",
1608
+ UpdateOrdersDispatch: "UpdateOrdersDispatch",
1609
+ ViewStores: "ViewStores",
1610
+ CreateStores: "CreateStores",
1611
+ EditStores: "EditStores",
1612
+ ViewStoresOpeningHours: "ViewStoresOpeningHours",
1613
+ UpdateStoresOpenForCollectionOrDelivery: "UpdateStoresOpenForCollectionOrDelivery",
1614
+ UpdateStoresOpeningHours: "UpdateStoresOpeningHours",
1615
+ ViewStoresOpeningHoursOverride: "ViewStoresOpeningHoursOverride",
1616
+ EditStoresOpeningHoursOverride: "EditStoresOpeningHoursOverride",
1617
+ EditStoresOpeningHoursOverrideTemporary: "EditStoresOpeningHoursOverrideTemporary",
1618
+ UpdateStoresName: "UpdateStoresName",
1619
+ EditStoreKioskSettings: "EditStoreKioskSettings",
1620
+ EditStoreOrderCapacity: "EditStoreOrderCapacity",
1621
+ EditStoreNotifications: "EditStoreNotifications",
1622
+ ArchiveStores: "ArchiveStores",
1623
+ PublishStores: "PublishStores",
1624
+ UpdatePrinterTerminalsAssign: "UpdatePrinterTerminalsAssign",
1625
+ UpdatePrinterTerminalsToggle: "UpdatePrinterTerminalsToggle",
1626
+ ViewStoreGroups: "ViewStoreGroups",
1627
+ CreateStoreGroups: "CreateStoreGroups",
1628
+ UpdateStoreGroups: "UpdateStoreGroups",
1629
+ DeleteStoreGroups: "DeleteStoreGroups",
1630
+ ViewDeliveryZones: "ViewDeliveryZones",
1631
+ CreateDeliveryZones: "CreateDeliveryZones",
1632
+ UpdateDeliveryZones: "UpdateDeliveryZones",
1633
+ DeleteDeliveryZones: "DeleteDeliveryZones",
1634
+ ViewMenu: "ViewMenu",
1635
+ CreateGlobalApiKey: "CreateGlobalAPIKey",
1636
+ ListGlobalApiKeys: "ListGlobalAPIKeys",
1637
+ BlockPrincipalAccess: "BlockPrincipalAccess",
1638
+ ListPrincipalOrgs: "ListPrincipalOrgs",
1639
+ CreateMenu: "CreateMenu",
1640
+ UpdateMenu: "UpdateMenu",
1641
+ DeleteMenu: "DeleteMenu",
1642
+ UpdateMenuLock: "UpdateMenuLock",
1643
+ UpdateMenuItemsHideTemporarily: "UpdateMenuItemsHideTemporarily",
1644
+ EditMenuImage: "EditMenuImage",
1645
+ ViewVouchers: "ViewVouchers",
1646
+ EditVouchers: "EditVouchers",
1647
+ ViewWebsiteContent: "ViewWebsiteContent",
1648
+ EditWebsiteContent: "EditWebsiteContent",
1649
+ ViewWebsiteDnsVerified: "ViewWebsiteDnsVerified",
1650
+ ViewWebsiteCertificateCreated: "ViewWebsiteCertificateCreated",
1651
+ ViewWebsiteCertificateRenewed: "ViewWebsiteCertificateRenewed",
1652
+ ViewBankAccounts: "ViewBankAccounts",
1653
+ CreateBankAccounts: "CreateBankAccounts",
1654
+ UpdateBankAccounts: "UpdateBankAccounts",
1655
+ UpdateBankAccountsAssign: "UpdateBankAccountsAssign",
1656
+ ViewAssignedBankAccount: "ViewAssignedBankAccount",
1657
+ VerifyBankAccounts: "VerifyBankAccounts",
1658
+ ViewServiceChargeConfigurations: "ViewServiceChargeConfigurations",
1659
+ EditServiceChargeConfigurations: "EditServiceChargeConfigurations",
1660
+ EditStoreDeliveryZoneFees: "EditStoreDeliveryZoneFees",
1661
+ EditStoreDeliveryFeesLimited: "EditStoreDeliveryFeesLimited",
1662
+ ViewHydraConfig: "ViewHydraConfig",
1663
+ UpdateHydraConfigManage: "UpdateHydraConfigManage",
1664
+ InitiateBluetoothPairingMode: "InitiateBluetoothPairingMode",
1665
+ DeleteTerminal: "DeleteTerminal",
1666
+ ViewKioskTelemetry: "ViewKioskTelemetry",
1667
+ HydraOnly: "HydraOnly",
1668
+ ViewCustomers: "ViewCustomers",
1669
+ EditCustomers: "EditCustomers",
1670
+ CreateCustomers: "CreateCustomers",
1671
+ CreateCatalogElements: "CreateCatalogElements",
1672
+ UpdateCatalogElements: "UpdateCatalogElements",
1673
+ ViewCatalogElements: "ViewCatalogElements",
1674
+ DeleteCatalogElements: "DeleteCatalogElements",
1675
+ ViewMetafieldDefinitions: "ViewMetafieldDefinitions",
1676
+ CreateMetafieldDefinitions: "CreateMetafieldDefinitions",
1677
+ UpdateMetafieldDefinitions: "UpdateMetafieldDefinitions",
1678
+ DeleteMetafieldDefinitions: "DeleteMetafieldDefinitions",
1679
+ UpdateMetafields: "UpdateMetafields",
1680
+ ViewCatalogMenuChanges: "ViewCatalogMenuChanges",
1681
+ PublishCatalogMenuChanges: "PublishCatalogMenuChanges",
1682
+ ViewAppStatistics: "ViewAppStatistics",
1683
+ ViewApmStatistics: "ViewApmStatistics",
1684
+ ViewCampaignsStatistics: "ViewCampaignsStatistics",
1685
+ ViewCustomerStatistics: "ViewCustomerStatistics",
1686
+ ViewLiveStatistics: "ViewLiveStatistics",
1687
+ ViewOrderStatistics: "ViewOrderStatistics",
1688
+ ViewSalesStatistics: "ViewSalesStatistics",
1689
+ ViewSalesEndOfDayStatistics: "ViewSalesEndOfDayStatistics",
1690
+ ViewVouchersStatistics: "ViewVouchersStatistics",
1691
+ DownloadCustomerCsvExport: "DownloadCustomerCsvExport",
1692
+ ViewApmAuditLogs: "ViewApmAuditLogs",
1693
+ ViewStoreAuditLogs: "ViewStoreAuditLogs",
1694
+ ViewMenuAuditLogs: "ViewMenuAuditLogs",
1695
+ ViewBankAccountAuditLogs: "ViewBankAccountAuditLogs",
1696
+ ViewFeeConfigurationsAuditLogs: "ViewFeeConfigurationsAuditLogs",
1697
+ ViewOrdersAuditLogs: "ViewOrdersAuditLogs",
1698
+ ViewVouchersAuditLogs: "ViewVouchersAuditLogs",
1699
+ ViewUserEventsAuditLogs: "ViewUserEventsAuditLogs",
1700
+ ViewCampaignsAuditLogs: "ViewCampaignsAuditLogs",
1701
+ ViewTeammatesAuditLogs: "ViewTeammatesAuditLogs",
1702
+ ViewTimedAccessAuditLogs: "ViewTimedAccessAuditLogs",
1703
+ ViewAppAuditLogs: "ViewAppAuditLogs",
1704
+ ViewCustomerAuditLogs: "ViewCustomerAuditLogs",
1705
+ ViewPrinterAuditLogs: "ViewPrinterAuditLogs",
1706
+ ViewHydraAuditLogs: "ViewHydraAuditLogs",
1707
+ ViewPushNotificationAuditLogs: "ViewPushNotificationAuditLogs",
1708
+ ViewStripeCustomConnectedAccountAuditLogs: "ViewStripeCustomConnectedAccountAuditLogs",
1709
+ ViewKioskBluetoothDeviceAuditLogs: "ViewKioskBluetoothDeviceAuditLogs",
1710
+ ViewExternalAuditLogs: "ViewExternalAuditLogs",
1711
+ CreateExternalAuditLogEvents: "CreateExternalAuditLogEvents",
1712
+ ViewCatalogAuditLogs: "ViewCatalogAuditLogs",
1713
+ ViewOrderFulfillmentAuditLogs: "ViewOrderFulfillmentAuditLogs",
1714
+ ViewChannelAuditLogs: "ViewChannelAuditLogs",
1715
+ ViewAppStoreAuditLogs: "ViewAppStoreAuditLogs",
1716
+ SendPushNotificationToCustomer: "SendPushNotificationToCustomer",
1717
+ InviteDriverToApp: "InviteDriverToApp",
1718
+ GetDriverForApp: "GetDriverForApp",
1719
+ RemoveDriverFromApp: "RemoveDriverFromApp",
1720
+ AssignDriverToOrder: "AssignDriverToOrder",
1721
+ UnassignDriverFromOrder: "UnassignDriverFromOrder",
1722
+ UpdateOrdersDeliveryTrackingStatus: "UpdateOrdersDeliveryTrackingStatus",
1723
+ UpdateOrderFulfillmentStatus: "UpdateOrderFulfillmentStatus",
1724
+ ViewFulfillmentStatesConfiguration: "ViewFulfillmentStatesConfiguration",
1725
+ CreateFulfillmentStatesConfiguration: "CreateFulfillmentStatesConfiguration",
1726
+ UpdateFulfillmentStatesConfiguration: "UpdateFulfillmentStatesConfiguration",
1727
+ DeleteFulfillmentStatesConfiguration: "DeleteFulfillmentStatesConfiguration",
1728
+ ViewPayouts: "ViewPayouts",
1729
+ ViewChannels: "ViewChannels",
1730
+ ViewOnboarding: "ViewOnboarding",
1731
+ UpdateOnboarding: "UpdateOnboarding",
1732
+ ViewClientDevices: "ViewClientDevices",
1733
+ UpdateClientDevices: "UpdateClientDevices",
1734
+ EnrollClientDevices: "EnrollClientDevices",
1735
+ AssignClientDevices: "AssignClientDevices",
1736
+ ViewClientAuditLogs: "ViewClientAuditLogs",
1737
+ CreateAppStoreAppConfiguration: "CreateAppStoreAppConfiguration",
1738
+ ViewAppStoreAppConfiguration: "ViewAppStoreAppConfiguration",
1739
+ UpdateAppStoreAppConfiguration: "UpdateAppStoreAppConfiguration",
1740
+ DeleteAppStoreAppConfiguration: "DeleteAppStoreAppConfiguration",
1741
+ UpdateAppStoreAppConfigurationSettings: "UpdateAppStoreAppConfigurationSettings",
1742
+ CreateAppStoreSubscription: "CreateAppStoreSubscription",
1743
+ UpdateAppStoreSubscription: "UpdateAppStoreSubscription",
1744
+ DeleteAppStoreSubscription: "DeleteAppStoreSubscription",
1745
+ ViewSalesChannels: "ViewSalesChannels",
1746
+ EditSalesChannels: "EditSalesChannels",
1747
+ CreateSalesChannel: "CreateSalesChannel",
1748
+ ArchiveSalesChannel: "ArchiveSalesChannel",
1749
+ UnarchiveSalesChannel: "UnarchiveSalesChannel",
1750
+ PublishSalesChannel: "PublishSalesChannel",
1751
+ UnpublishSalesChannel: "UnpublishSalesChannel",
1752
+ CloneSalesChannel: "CloneSalesChannel",
1753
+ ViewPayGreenWhiteLabelConfiguration: "ViewPayGreenWhiteLabelConfiguration",
1754
+ CreatePayGreenWhiteLabelConfiguration: "CreatePayGreenWhiteLabelConfiguration",
1755
+ UpdatePayGreenWhiteLabelConfiguration: "UpdatePayGreenWhiteLabelConfiguration",
1756
+ UpdatePayGreenStoreConfiguration: "UpdatePayGreenStoreConfiguration",
1757
+ ViewSubscriptions: "ViewSubscriptions",
1758
+ ViewInvoices: "ViewInvoices",
1759
+ EditAccountsBills: "EditAccountsBills",
1760
+ ViewAccountsBills: "ViewAccountsBills",
1761
+ EditAccountsCategories: "EditAccountsCategories",
1762
+ ViewAccountsCategories: "ViewAccountsCategories",
1763
+ EditAccountsCreditAccounts: "EditAccountsCreditAccounts",
1764
+ ViewAccountsCreditAccounts: "ViewAccountsCreditAccounts",
1765
+ EditAccountsCreditBooks: "EditAccountsCreditBooks",
1766
+ ViewAccountsCreditBooks: "ViewAccountsCreditBooks",
1767
+ EditAccountsExpenses: "EditAccountsExpenses",
1768
+ ViewAccountsExpenses: "ViewAccountsExpenses",
1769
+ EditAccountsTransactionAccounts: "EditAccountsTransactionAccounts",
1770
+ ViewAccountsTransactionAccounts: "ViewAccountsTransactionAccounts",
1771
+ EditDocumentExplorer: "EditDocumentExplorer",
1772
+ ViewDocumentExplorer: "ViewDocumentExplorer",
1773
+ ViewInventoryReports: "ViewInventoryReports",
1774
+ EditInventoryPurchaseOrders: "EditInventoryPurchaseOrders",
1775
+ ViewInventoryPurchaseOrders: "ViewInventoryPurchaseOrders",
1776
+ EditInventoryStockItems: "EditInventoryStockItems",
1777
+ ViewInventoryStockItems: "ViewInventoryStockItems",
1778
+ EditInventorySupplier: "EditInventorySupplier",
1779
+ ViewInventorySupplier: "ViewInventorySupplier",
1780
+ EditInventoryTrackingProfiles: "EditInventoryTrackingProfiles",
1781
+ ViewInventoryTrackingProfiles: "ViewInventoryTrackingProfiles",
1782
+ ViewPayrollReports: "ViewPayrollReports",
1783
+ EditPayrollHoliday: "EditPayrollHoliday",
1784
+ ViewPayrollHoliday: "ViewPayrollHoliday",
1785
+ EditPayrollRota: "EditPayrollRota",
1786
+ ViewPayrollRota: "ViewPayrollRota",
1787
+ EditPayrollStaff: "EditPayrollStaff",
1788
+ ViewPayrollStaff: "ViewPayrollStaff",
1789
+ ViewSalesReports: "ViewSalesReports",
1790
+ ViewCostReports: "ViewCostReports",
1791
+ ViewMenuReports: "ViewMenuReports",
1792
+ ViewBrand: "ViewBrand",
1793
+ EditBrand: "EditBrand",
1794
+ CreateBrand: "CreateBrand",
1795
+ TransferBrand: "TransferBrand",
1796
+ ViewProperty: "ViewProperty",
1797
+ EditProperty: "EditProperty",
1798
+ CreateProperty: "CreateProperty",
1799
+ ArchiveProperty: "ArchiveProperty",
1800
+ ViewEntityFeatureFlags: "ViewEntityFeatureFlags",
1801
+ EditEntityFeatureFlags: "EditEntityFeatureFlags",
1802
+ CreateOrg: "CreateOrg",
1803
+ CreateOrgApiKey: "CreateOrgAPIKey",
1804
+ EditOrg: "EditOrg",
1805
+ ViewOrg: "ViewOrg",
1806
+ ViewWebhooks: "ViewWebhooks",
1807
+ EditWebhooks: "EditWebhooks",
1808
+ ViewOwnPermissions: "ViewOwnPermissions",
1809
+ LeaveOrg: "LeaveOrg",
1810
+ CreatePosSale: "CreatePosSale",
1811
+ ComplimentPosItems: "ComplimentPosItems",
1812
+ ApplyPosDiscounts: "ApplyPosDiscounts",
1813
+ CancelPosSales: "CancelPosSales",
1814
+ DeliverSale: "DeliverSale",
1815
+ PerformCashingUp: "PerformCashingUp",
1816
+ OpenCashDrawer: "OpenCashDrawer",
1817
+ EditPosSettings: "EditPosSettings",
1818
+ EditPosLayout: "EditPosLayout",
1819
+ ViewPosDailySummaryReport: "ViewPosDailySummaryReport",
1820
+ ViewPosDriverSalesReport: "ViewPosDriverSalesReport",
1821
+ CreatePurchaseOrder: "CreatePurchaseOrder",
1822
+ SubmitPurchaseOrder: "SubmitPurchaseOrder",
1823
+ ReceivePurchaseOrder: "ReceivePurchaseOrder",
1824
+ ViewBusinessInsights: "ViewBusinessInsights",
1825
+ SnoozePosMenu: "SnoozePosMenu",
1826
+ SnoozePosMenuIndefinitely: "SnoozePosMenuIndefinitely",
1827
+ SnoozePosItem: "SnoozePosItem",
1828
+ SnoozePosItemIndefinitely: "SnoozePosItemIndefinitely",
1829
+ SnoozePosProperty: "SnoozePosProperty",
1830
+ SendSmsToCustomers: "SendSmsToCustomers",
1831
+ RoleAdmin: "RoleAdmin",
1832
+ RoleFactory: "RoleFactory",
1833
+ RoleAuthDeveloper: "RoleAuthDeveloper",
1834
+ RoleFlipdishStaff: "RoleFlipdishStaff"
1835
+ };
1836
+ var RoleNames = {
1837
+ Admin: "Admin",
1838
+ Factory: "Factory",
1839
+ AuthDeveloper: "AuthDeveloper",
1840
+ FlipdishStaff: "FlipdishStaff"
1841
+ };
1842
+
1843
+ // src/index.ts
1844
+ function createFlipdishClient(options = {}) {
1845
+ const {
1846
+ baseUrl = DEFAULT_BASE_URL,
1847
+ accessToken,
1848
+ headers,
1849
+ fetch,
1850
+ config,
1851
+ ...identity
1852
+ } = options;
1853
+ const client2 = createClient(
1854
+ createConfig({
1855
+ ...config,
1856
+ baseUrl,
1857
+ ...fetch ? { fetch } : {},
1858
+ auth: typeof accessToken === "function" ? () => accessToken() : accessToken,
1859
+ headers: mergeHeaders(
1860
+ identityHeaders(SDK_INFO, identity),
1861
+ config?.headers,
1862
+ headers
1863
+ )
1864
+ })
1865
+ );
1866
+ return new AuthorizationClient({ client: client2 });
1867
+ }
1868
+ export {
1869
+ AuthorizationClient,
1870
+ CLIENT_HEADER,
1871
+ Permissions,
1872
+ RoleNames,
1873
+ SDK_INFO,
1874
+ buildIdentity,
1875
+ client,
1876
+ createFlipdishClient
1877
+ };
1878
+ //# sourceMappingURL=index.mjs.map