@flipdish/authorization 0.2.61 → 1.0.0

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