@itm-studio/partner-sdk 0.1.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 ADDED
@@ -0,0 +1,1098 @@
1
+ 'use strict';
2
+
3
+ // src/generated/runtime/error.ts
4
+ var GenqlError = class extends Error {
5
+ errors = [];
6
+ /**
7
+ * Partial data returned by the server
8
+ */
9
+ data;
10
+ constructor(errors, data) {
11
+ let message = Array.isArray(errors) ? errors.map((x) => x?.message || "").join("\n") : "";
12
+ if (!message) {
13
+ message = "GraphQL error";
14
+ }
15
+ super(message);
16
+ this.errors = errors;
17
+ this.data = data;
18
+ }
19
+ };
20
+
21
+ // src/generated/runtime/batcher.ts
22
+ function dispatchQueueBatch(client, queue) {
23
+ let batchedQuery = queue.map((item) => item.request);
24
+ if (batchedQuery.length === 1) {
25
+ batchedQuery = batchedQuery[0];
26
+ }
27
+ (() => {
28
+ try {
29
+ return client.fetcher(batchedQuery);
30
+ } catch (e) {
31
+ return Promise.reject(e);
32
+ }
33
+ })().then((responses) => {
34
+ if (queue.length === 1 && !Array.isArray(responses)) {
35
+ if (responses.errors && responses.errors.length) {
36
+ queue[0].reject(
37
+ new GenqlError(responses.errors, responses.data)
38
+ );
39
+ return;
40
+ }
41
+ queue[0].resolve(responses);
42
+ return;
43
+ } else if (responses.length !== queue.length) {
44
+ throw new Error("response length did not match query length");
45
+ }
46
+ for (let i = 0; i < queue.length; i++) {
47
+ if (responses[i].errors && responses[i].errors.length) {
48
+ queue[i].reject(
49
+ new GenqlError(responses[i].errors, responses[i].data)
50
+ );
51
+ } else {
52
+ queue[i].resolve(responses[i]);
53
+ }
54
+ }
55
+ }).catch((e) => {
56
+ for (let i = 0; i < queue.length; i++) {
57
+ queue[i].reject(e);
58
+ }
59
+ });
60
+ }
61
+ function dispatchQueue(client, options) {
62
+ const queue = client._queue;
63
+ const maxBatchSize = options.maxBatchSize || 0;
64
+ client._queue = [];
65
+ if (maxBatchSize > 0 && maxBatchSize < queue.length) {
66
+ for (let i = 0; i < queue.length / maxBatchSize; i++) {
67
+ dispatchQueueBatch(
68
+ client,
69
+ queue.slice(i * maxBatchSize, (i + 1) * maxBatchSize)
70
+ );
71
+ }
72
+ } else {
73
+ dispatchQueueBatch(client, queue);
74
+ }
75
+ }
76
+ var QueryBatcher = class _QueryBatcher {
77
+ fetcher;
78
+ _options;
79
+ _queue;
80
+ constructor(fetcher, {
81
+ batchInterval = 6,
82
+ shouldBatch = true,
83
+ maxBatchSize = 0
84
+ } = {}) {
85
+ this.fetcher = fetcher;
86
+ this._options = {
87
+ batchInterval,
88
+ shouldBatch,
89
+ maxBatchSize
90
+ };
91
+ this._queue = [];
92
+ }
93
+ /**
94
+ * Fetch will send a graphql request and return the parsed json.
95
+ * @param {string} query - the graphql query.
96
+ * @param {Variables} variables - any variables you wish to inject as key/value pairs.
97
+ * @param {[string]} operationName - the graphql operationName.
98
+ * @param {Options} overrides - the client options overrides.
99
+ *
100
+ * @return {promise} resolves to parsed json of server response
101
+ *
102
+ * @example
103
+ * client.fetch(`
104
+ * query getHuman($id: ID!) {
105
+ * human(id: $id) {
106
+ * name
107
+ * height
108
+ * }
109
+ * }
110
+ * `, { id: "1001" }, 'getHuman')
111
+ * .then(human => {
112
+ * // do something with human
113
+ * console.log(human);
114
+ * });
115
+ */
116
+ fetch(query, variables, operationName, overrides = {}) {
117
+ const request = {
118
+ query
119
+ };
120
+ const options = Object.assign({}, this._options, overrides);
121
+ if (variables) {
122
+ request.variables = variables;
123
+ }
124
+ if (operationName) {
125
+ request.operationName = operationName;
126
+ }
127
+ const promise = new Promise((resolve, reject) => {
128
+ this._queue.push({
129
+ request,
130
+ resolve,
131
+ reject
132
+ });
133
+ if (this._queue.length === 1) {
134
+ if (options.shouldBatch) {
135
+ setTimeout(
136
+ () => dispatchQueue(this, options),
137
+ options.batchInterval
138
+ );
139
+ } else {
140
+ dispatchQueue(this, options);
141
+ }
142
+ }
143
+ });
144
+ return promise;
145
+ }
146
+ /**
147
+ * Fetch will send a graphql request and return the parsed json.
148
+ * @param {string} query - the graphql query.
149
+ * @param {Variables} variables - any variables you wish to inject as key/value pairs.
150
+ * @param {[string]} operationName - the graphql operationName.
151
+ * @param {Options} overrides - the client options overrides.
152
+ *
153
+ * @return {Promise<Array<Result>>} resolves to parsed json of server response
154
+ *
155
+ * @example
156
+ * client.forceFetch(`
157
+ * query getHuman($id: ID!) {
158
+ * human(id: $id) {
159
+ * name
160
+ * height
161
+ * }
162
+ * }
163
+ * `, { id: "1001" }, 'getHuman')
164
+ * .then(human => {
165
+ * // do something with human
166
+ * console.log(human);
167
+ * });
168
+ */
169
+ forceFetch(query, variables, operationName, overrides = {}) {
170
+ const request = {
171
+ query
172
+ };
173
+ const options = Object.assign({}, this._options, overrides, {
174
+ shouldBatch: false
175
+ });
176
+ if (variables) {
177
+ request.variables = variables;
178
+ }
179
+ if (operationName) {
180
+ request.operationName = operationName;
181
+ }
182
+ const promise = new Promise((resolve, reject) => {
183
+ const client = new _QueryBatcher(this.fetcher, this._options);
184
+ client._queue = [
185
+ {
186
+ request,
187
+ resolve,
188
+ reject
189
+ }
190
+ ];
191
+ dispatchQueue(client, options);
192
+ });
193
+ return promise;
194
+ }
195
+ };
196
+
197
+ // src/generated/runtime/fetcher.ts
198
+ var DEFAULT_BATCH_OPTIONS = {
199
+ maxBatchSize: 10,
200
+ batchInterval: 40
201
+ };
202
+ var createFetcher = ({
203
+ url,
204
+ headers = {},
205
+ fetcher,
206
+ fetch: _fetch,
207
+ batch = false,
208
+ ...rest
209
+ }) => {
210
+ if (!url && !fetcher) {
211
+ throw new Error("url or fetcher is required");
212
+ }
213
+ fetcher = fetcher || (async (body) => {
214
+ let headersObject = typeof headers == "function" ? await headers() : headers;
215
+ headersObject = headersObject || {};
216
+ if (typeof fetch === "undefined" && !_fetch) {
217
+ throw new Error(
218
+ "Global `fetch` function is not available, pass a fetch polyfill to Genql `createClient`"
219
+ );
220
+ }
221
+ let fetchImpl = _fetch || fetch;
222
+ const res = await fetchImpl(url, {
223
+ headers: {
224
+ "Content-Type": "application/json",
225
+ ...headersObject
226
+ },
227
+ method: "POST",
228
+ body: JSON.stringify(body),
229
+ ...rest
230
+ });
231
+ if (!res.ok) {
232
+ throw new Error(`${res.statusText}: ${await res.text()}`);
233
+ }
234
+ const json = await res.json();
235
+ return json;
236
+ });
237
+ if (!batch) {
238
+ return async (body) => {
239
+ const json = await fetcher(body);
240
+ if (Array.isArray(json)) {
241
+ return json.map((json2) => {
242
+ if (json2?.errors?.length) {
243
+ throw new GenqlError(json2.errors || [], json2.data);
244
+ }
245
+ return json2.data;
246
+ });
247
+ } else {
248
+ if (json?.errors?.length) {
249
+ throw new GenqlError(json.errors || [], json.data);
250
+ }
251
+ return json.data;
252
+ }
253
+ };
254
+ }
255
+ const batcher = new QueryBatcher(
256
+ async (batchedQuery) => {
257
+ const json = await fetcher(batchedQuery);
258
+ return json;
259
+ },
260
+ batch === true ? DEFAULT_BATCH_OPTIONS : batch
261
+ );
262
+ return async ({ query, variables }) => {
263
+ const json = await batcher.fetch(query, variables);
264
+ if (json?.data) {
265
+ return json.data;
266
+ }
267
+ throw new Error(
268
+ "Genql batch fetcher returned unexpected result " + JSON.stringify(json)
269
+ );
270
+ };
271
+ };
272
+
273
+ // src/generated/runtime/generateGraphqlOperation.ts
274
+ var parseRequest = (request, ctx, path) => {
275
+ if (typeof request === "object" && "__args" in request) {
276
+ const args = request.__args;
277
+ let fields = { ...request };
278
+ delete fields.__args;
279
+ const argNames = Object.keys(args);
280
+ if (argNames.length === 0) {
281
+ return parseRequest(fields, ctx, path);
282
+ }
283
+ const field = getFieldFromPath(ctx.root, path);
284
+ const argStrings = argNames.map((argName) => {
285
+ ctx.varCounter++;
286
+ const varName = `v${ctx.varCounter}`;
287
+ const typing = field.args && field.args[argName];
288
+ if (!typing) {
289
+ throw new Error(
290
+ `no typing defined for argument \`${argName}\` in path \`${path.join(
291
+ "."
292
+ )}\``
293
+ );
294
+ }
295
+ ctx.variables[varName] = {
296
+ value: args[argName],
297
+ typing
298
+ };
299
+ return `${argName}:$${varName}`;
300
+ });
301
+ return `(${argStrings})${parseRequest(fields, ctx, path)}`;
302
+ } else if (typeof request === "object" && Object.keys(request).length > 0) {
303
+ const fields = request;
304
+ const fieldNames = Object.keys(fields).filter((k) => Boolean(fields[k]));
305
+ if (fieldNames.length === 0) {
306
+ throw new Error(
307
+ `field selection should not be empty: ${path.join(".")}`
308
+ );
309
+ }
310
+ const type = path.length > 0 ? getFieldFromPath(ctx.root, path).type : ctx.root;
311
+ const scalarFields = type.scalar;
312
+ let scalarFieldsFragment;
313
+ if (fieldNames.includes("__scalar")) {
314
+ const falsyFieldNames = new Set(
315
+ Object.keys(fields).filter((k) => !Boolean(fields[k]))
316
+ );
317
+ if (scalarFields?.length) {
318
+ ctx.fragmentCounter++;
319
+ scalarFieldsFragment = `f${ctx.fragmentCounter}`;
320
+ ctx.fragments.push(
321
+ `fragment ${scalarFieldsFragment} on ${type.name}{${scalarFields.filter((f) => !falsyFieldNames.has(f)).join(",")}}`
322
+ );
323
+ }
324
+ }
325
+ const fieldsSelection = fieldNames.filter((f) => !["__scalar", "__name"].includes(f)).map((f) => {
326
+ const parsed = parseRequest(fields[f], ctx, [...path, f]);
327
+ if (f.startsWith("on_")) {
328
+ ctx.fragmentCounter++;
329
+ const implementationFragment = `f${ctx.fragmentCounter}`;
330
+ const typeMatch = f.match(/^on_(.+)/);
331
+ if (!typeMatch || !typeMatch[1])
332
+ throw new Error("match failed");
333
+ ctx.fragments.push(
334
+ `fragment ${implementationFragment} on ${typeMatch[1]}${parsed}`
335
+ );
336
+ return `...${implementationFragment}`;
337
+ } else {
338
+ return `${f}${parsed}`;
339
+ }
340
+ }).concat(scalarFieldsFragment ? [`...${scalarFieldsFragment}`] : []).join(",");
341
+ return `{${fieldsSelection}}`;
342
+ } else {
343
+ return "";
344
+ }
345
+ };
346
+ var generateGraphqlOperation = (operation, root, fields) => {
347
+ const ctx = {
348
+ root,
349
+ varCounter: 0,
350
+ variables: {},
351
+ fragmentCounter: 0,
352
+ fragments: []
353
+ };
354
+ const result = parseRequest(fields, ctx, []);
355
+ const varNames = Object.keys(ctx.variables);
356
+ const varsString = varNames.length > 0 ? `(${varNames.map((v) => {
357
+ const variableType = ctx.variables[v].typing[1];
358
+ return `$${v}:${variableType}`;
359
+ })})` : "";
360
+ const operationName = fields?.__name || "";
361
+ return {
362
+ query: [
363
+ `${operation} ${operationName}${varsString}${result}`,
364
+ ...ctx.fragments
365
+ ].join(","),
366
+ variables: Object.keys(ctx.variables).reduce(
367
+ (r, v) => {
368
+ r[v] = ctx.variables[v].value;
369
+ return r;
370
+ },
371
+ {}
372
+ ),
373
+ ...operationName ? { operationName: operationName.toString() } : {}
374
+ };
375
+ };
376
+ var getFieldFromPath = (root, path) => {
377
+ let current;
378
+ if (!root) throw new Error("root type is not provided");
379
+ if (path.length === 0) throw new Error(`path is empty`);
380
+ path.forEach((f) => {
381
+ const type = current ? current.type : root;
382
+ if (!type.fields)
383
+ throw new Error(`type \`${type.name}\` does not have fields`);
384
+ const possibleTypes = Object.keys(type.fields).filter((i) => i.startsWith("on_")).reduce(
385
+ (types, fieldName) => {
386
+ const field2 = type.fields && type.fields[fieldName];
387
+ if (field2) types.push(field2.type);
388
+ return types;
389
+ },
390
+ [type]
391
+ );
392
+ let field = null;
393
+ possibleTypes.forEach((type2) => {
394
+ const found = type2.fields && type2.fields[f];
395
+ if (found) field = found;
396
+ });
397
+ if (!field)
398
+ throw new Error(
399
+ `type \`${type.name}\` does not have a field \`${f}\``
400
+ );
401
+ current = field;
402
+ });
403
+ return current;
404
+ };
405
+
406
+ // src/generated/runtime/createClient.ts
407
+ var createClient = ({
408
+ queryRoot,
409
+ mutationRoot,
410
+ subscriptionRoot,
411
+ ...options
412
+ }) => {
413
+ const fetcher = createFetcher(options);
414
+ const client = {};
415
+ if (queryRoot) {
416
+ client.query = (request) => {
417
+ if (!queryRoot) throw new Error("queryRoot argument is missing");
418
+ const resultPromise = fetcher(
419
+ generateGraphqlOperation("query", queryRoot, request)
420
+ );
421
+ return resultPromise;
422
+ };
423
+ }
424
+ if (mutationRoot) {
425
+ client.mutation = (request) => {
426
+ if (!mutationRoot)
427
+ throw new Error("mutationRoot argument is missing");
428
+ const resultPromise = fetcher(
429
+ generateGraphqlOperation("mutation", mutationRoot, request)
430
+ );
431
+ return resultPromise;
432
+ };
433
+ }
434
+ return client;
435
+ };
436
+
437
+ // src/generated/runtime/linkTypeMap.ts
438
+ var linkTypeMap = (typeMap2) => {
439
+ const indexToName = Object.assign(
440
+ {},
441
+ ...Object.keys(typeMap2.types).map((k, i) => ({ [i]: k }))
442
+ );
443
+ let intermediaryTypeMap = Object.assign(
444
+ {},
445
+ ...Object.keys(typeMap2.types || {}).map(
446
+ (k) => {
447
+ const type = typeMap2.types[k];
448
+ const fields = type || {};
449
+ return {
450
+ [k]: {
451
+ name: k,
452
+ // type scalar properties
453
+ scalar: Object.keys(fields).filter((f) => {
454
+ const [type2] = fields[f] || [];
455
+ const isScalar = type2 && typeMap2.scalars.includes(type2);
456
+ if (!isScalar) {
457
+ return false;
458
+ }
459
+ const args = fields[f]?.[1];
460
+ const argTypes = Object.values(args || {}).map((x) => x?.[1]).filter(Boolean);
461
+ const hasRequiredArgs = argTypes.some(
462
+ (str) => str && str.endsWith("!")
463
+ );
464
+ if (hasRequiredArgs) {
465
+ return false;
466
+ }
467
+ return true;
468
+ }),
469
+ // fields with corresponding `type` and `args`
470
+ fields: Object.assign(
471
+ {},
472
+ ...Object.keys(fields).map(
473
+ (f) => {
474
+ const [typeIndex, args] = fields[f] || [];
475
+ if (typeIndex == null) {
476
+ return {};
477
+ }
478
+ return {
479
+ [f]: {
480
+ // replace index with type name
481
+ type: indexToName[typeIndex],
482
+ args: Object.assign(
483
+ {},
484
+ ...Object.keys(args || {}).map(
485
+ (k2) => {
486
+ if (!args || !args[k2]) {
487
+ return;
488
+ }
489
+ const [
490
+ argTypeName,
491
+ argTypeString
492
+ ] = args[k2];
493
+ return {
494
+ [k2]: [
495
+ indexToName[argTypeName],
496
+ argTypeString || indexToName[argTypeName]
497
+ ]
498
+ };
499
+ }
500
+ )
501
+ )
502
+ }
503
+ };
504
+ }
505
+ )
506
+ )
507
+ }
508
+ };
509
+ }
510
+ )
511
+ );
512
+ const res = resolveConcreteTypes(intermediaryTypeMap);
513
+ return res;
514
+ };
515
+ var resolveConcreteTypes = (linkedTypeMap) => {
516
+ Object.keys(linkedTypeMap).forEach((typeNameFromKey) => {
517
+ const type = linkedTypeMap[typeNameFromKey];
518
+ if (!type.fields) {
519
+ return;
520
+ }
521
+ const fields = type.fields;
522
+ Object.keys(fields).forEach((f) => {
523
+ const field = fields[f];
524
+ if (field.args) {
525
+ const args = field.args;
526
+ Object.keys(args).forEach((key) => {
527
+ const arg = args[key];
528
+ if (arg) {
529
+ const [typeName2] = arg;
530
+ if (typeof typeName2 === "string") {
531
+ if (!linkedTypeMap[typeName2]) {
532
+ linkedTypeMap[typeName2] = { name: typeName2 };
533
+ }
534
+ arg[0] = linkedTypeMap[typeName2];
535
+ }
536
+ }
537
+ });
538
+ }
539
+ const typeName = field.type;
540
+ if (typeof typeName === "string") {
541
+ if (!linkedTypeMap[typeName]) {
542
+ linkedTypeMap[typeName] = { name: typeName };
543
+ }
544
+ field.type = linkedTypeMap[typeName];
545
+ }
546
+ });
547
+ });
548
+ return linkedTypeMap;
549
+ };
550
+
551
+ // src/generated/types.ts
552
+ var types_default = {
553
+ "scalars": [
554
+ 0,
555
+ 1,
556
+ 2,
557
+ 3,
558
+ 4,
559
+ 5,
560
+ 6,
561
+ 7,
562
+ 9,
563
+ 10,
564
+ 13,
565
+ 14,
566
+ 16
567
+ ],
568
+ "types": {
569
+ "DateTime": {},
570
+ "MomentStatus": {},
571
+ "MomentSortOrder": {},
572
+ "MomentType": {},
573
+ "MomentCategory": {},
574
+ "MomentSubcategory": {},
575
+ "PaymentStatus": {},
576
+ "TicketExtensionStatus": {},
577
+ "Currency": {
578
+ "uid": [
579
+ 9
580
+ ],
581
+ "code": [
582
+ 10
583
+ ],
584
+ "name": [
585
+ 10
586
+ ],
587
+ "symbol": [
588
+ 10
589
+ ],
590
+ "country": [
591
+ 10
592
+ ],
593
+ "countryCode": [
594
+ 10
595
+ ],
596
+ "createdAt": [
597
+ 0
598
+ ],
599
+ "updatedAt": [
600
+ 0
601
+ ],
602
+ "__typename": [
603
+ 10
604
+ ]
605
+ },
606
+ "ID": {},
607
+ "String": {},
608
+ "Venue": {
609
+ "uid": [
610
+ 9
611
+ ],
612
+ "name": [
613
+ 10
614
+ ],
615
+ "address": [
616
+ 10
617
+ ],
618
+ "city": [
619
+ 10
620
+ ],
621
+ "country": [
622
+ 10
623
+ ],
624
+ "postalCode": [
625
+ 10
626
+ ],
627
+ "createdAt": [
628
+ 0
629
+ ],
630
+ "updatedAt": [
631
+ 0
632
+ ],
633
+ "__typename": [
634
+ 10
635
+ ]
636
+ },
637
+ "Moment": {
638
+ "uid": [
639
+ 9
640
+ ],
641
+ "name": [
642
+ 10
643
+ ],
644
+ "description": [
645
+ 10
646
+ ],
647
+ "blurb": [
648
+ 10
649
+ ],
650
+ "slug": [
651
+ 10
652
+ ],
653
+ "startDate": [
654
+ 0
655
+ ],
656
+ "endDate": [
657
+ 0
658
+ ],
659
+ "isPrivate": [
660
+ 13
661
+ ],
662
+ "type": [
663
+ 3
664
+ ],
665
+ "category": [
666
+ 4
667
+ ],
668
+ "subcategory": [
669
+ 5
670
+ ],
671
+ "status": [
672
+ 1
673
+ ],
674
+ "soldOut": [
675
+ 13
676
+ ],
677
+ "timezone": [
678
+ 10
679
+ ],
680
+ "minimumAge": [
681
+ 14
682
+ ],
683
+ "venue": [
684
+ 11
685
+ ],
686
+ "ticketTiers": [
687
+ 15
688
+ ],
689
+ "createdAt": [
690
+ 0
691
+ ],
692
+ "updatedAt": [
693
+ 0
694
+ ],
695
+ "__typename": [
696
+ 10
697
+ ]
698
+ },
699
+ "Boolean": {},
700
+ "Int": {},
701
+ "TicketTier": {
702
+ "uid": [
703
+ 9
704
+ ],
705
+ "name": [
706
+ 10
707
+ ],
708
+ "description": [
709
+ 10
710
+ ],
711
+ "price": [
712
+ 16
713
+ ],
714
+ "currency": [
715
+ 8
716
+ ],
717
+ "isActive": [
718
+ 13
719
+ ],
720
+ "isPrivate": [
721
+ 13
722
+ ],
723
+ "maxPerUser": [
724
+ 14
725
+ ],
726
+ "minPerUser": [
727
+ 14
728
+ ],
729
+ "remainingSupply": [
730
+ 14
731
+ ],
732
+ "numSold": [
733
+ 16
734
+ ],
735
+ "numCheckedIn": [
736
+ 16
737
+ ],
738
+ "startDateOverride": [
739
+ 0
740
+ ],
741
+ "endDateOverride": [
742
+ 0
743
+ ],
744
+ "createdAt": [
745
+ 0
746
+ ],
747
+ "updatedAt": [
748
+ 0
749
+ ],
750
+ "__typename": [
751
+ 10
752
+ ]
753
+ },
754
+ "Float": {},
755
+ "User": {
756
+ "uid": [
757
+ 9
758
+ ],
759
+ "name": [
760
+ 10
761
+ ],
762
+ "phoneNumber": [
763
+ 10
764
+ ],
765
+ "primaryEmail": [
766
+ 10
767
+ ],
768
+ "instagramProfile": [
769
+ 10
770
+ ],
771
+ "twitterProfile": [
772
+ 10
773
+ ],
774
+ "spotifyProfile": [
775
+ 10
776
+ ],
777
+ "tiktokProfile": [
778
+ 10
779
+ ],
780
+ "createdAt": [
781
+ 0
782
+ ],
783
+ "updatedAt": [
784
+ 0
785
+ ],
786
+ "__typename": [
787
+ 10
788
+ ]
789
+ },
790
+ "Ticket": {
791
+ "uid": [
792
+ 9
793
+ ],
794
+ "price": [
795
+ 16
796
+ ],
797
+ "redeemedAt": [
798
+ 0
799
+ ],
800
+ "encryptedQRCode": [
801
+ 10
802
+ ],
803
+ "notes": [
804
+ 10
805
+ ],
806
+ "externalId": [
807
+ 10
808
+ ],
809
+ "hasExpired": [
810
+ 13
811
+ ],
812
+ "ticketTier": [
813
+ 15
814
+ ],
815
+ "user": [
816
+ 17
817
+ ],
818
+ "moment": [
819
+ 12
820
+ ],
821
+ "payment": [
822
+ 21
823
+ ],
824
+ "extensions": [
825
+ 19
826
+ ],
827
+ "discountCodeUsages": [
828
+ 20
829
+ ],
830
+ "createdAt": [
831
+ 0
832
+ ],
833
+ "updatedAt": [
834
+ 0
835
+ ],
836
+ "__typename": [
837
+ 10
838
+ ]
839
+ },
840
+ "TicketExtension": {
841
+ "uid": [
842
+ 9
843
+ ],
844
+ "hours": [
845
+ 14
846
+ ],
847
+ "previousTotalHours": [
848
+ 14
849
+ ],
850
+ "newTotalHours": [
851
+ 14
852
+ ],
853
+ "pricePerHourCents": [
854
+ 14
855
+ ],
856
+ "totalPriceCents": [
857
+ 14
858
+ ],
859
+ "status": [
860
+ 7
861
+ ],
862
+ "appliedAt": [
863
+ 0
864
+ ],
865
+ "createdAt": [
866
+ 0
867
+ ],
868
+ "updatedAt": [
869
+ 0
870
+ ],
871
+ "__typename": [
872
+ 10
873
+ ]
874
+ },
875
+ "MomentDiscountCodeUsage": {
876
+ "uid": [
877
+ 9
878
+ ],
879
+ "createdAt": [
880
+ 0
881
+ ],
882
+ "updatedAt": [
883
+ 0
884
+ ],
885
+ "__typename": [
886
+ 10
887
+ ]
888
+ },
889
+ "Payment": {
890
+ "uid": [
891
+ 9
892
+ ],
893
+ "amount": [
894
+ 16
895
+ ],
896
+ "status": [
897
+ 6
898
+ ],
899
+ "stripePaymentIntentId": [
900
+ 10
901
+ ],
902
+ "stripeConnectedPaymentId": [
903
+ 10
904
+ ],
905
+ "createdAt": [
906
+ 0
907
+ ],
908
+ "updatedAt": [
909
+ 0
910
+ ],
911
+ "__typename": [
912
+ 10
913
+ ]
914
+ },
915
+ "MerchPurchase": {
916
+ "uid": [
917
+ 9
918
+ ],
919
+ "createdAt": [
920
+ 0
921
+ ],
922
+ "updatedAt": [
923
+ 0
924
+ ],
925
+ "__typename": [
926
+ 10
927
+ ]
928
+ },
929
+ "PartnerCustomer": {
930
+ "user": [
931
+ 17
932
+ ],
933
+ "tickets": [
934
+ 18
935
+ ],
936
+ "__typename": [
937
+ 10
938
+ ]
939
+ },
940
+ "GetPublicMomentsResponse": {
941
+ "moments": [
942
+ 12
943
+ ],
944
+ "totalCount": [
945
+ 14
946
+ ],
947
+ "hasNextPage": [
948
+ 13
949
+ ],
950
+ "nextCursor": [
951
+ 10
952
+ ],
953
+ "__typename": [
954
+ 10
955
+ ]
956
+ },
957
+ "GetTicketsResponse": {
958
+ "tickets": [
959
+ 18
960
+ ],
961
+ "totalCount": [
962
+ 14
963
+ ],
964
+ "hasNextPage": [
965
+ 13
966
+ ],
967
+ "nextCursor": [
968
+ 10
969
+ ],
970
+ "__typename": [
971
+ 10
972
+ ]
973
+ },
974
+ "GetPartnerCustomersResponse": {
975
+ "customers": [
976
+ 23
977
+ ],
978
+ "totalCount": [
979
+ 14
980
+ ],
981
+ "hasNextPage": [
982
+ 13
983
+ ],
984
+ "nextCursor": [
985
+ 10
986
+ ],
987
+ "__typename": [
988
+ 10
989
+ ]
990
+ },
991
+ "Query": {
992
+ "getPartnerMomentsForBrand": [
993
+ 24,
994
+ {
995
+ "cursor": [
996
+ 10
997
+ ],
998
+ "take": [
999
+ 14
1000
+ ],
1001
+ "status": [
1002
+ 1
1003
+ ],
1004
+ "sortOrder": [
1005
+ 2
1006
+ ]
1007
+ }
1008
+ ],
1009
+ "getPartnerMoment": [
1010
+ 12,
1011
+ {
1012
+ "slug": [
1013
+ 10,
1014
+ "String!"
1015
+ ]
1016
+ }
1017
+ ],
1018
+ "getPartnerTicketsForMoment": [
1019
+ 25,
1020
+ {
1021
+ "momentSlug": [
1022
+ 10,
1023
+ "String!"
1024
+ ],
1025
+ "cursor": [
1026
+ 10
1027
+ ],
1028
+ "take": [
1029
+ 14
1030
+ ],
1031
+ "checkedIn": [
1032
+ 13
1033
+ ]
1034
+ }
1035
+ ],
1036
+ "getPartnerCustomersForMoment": [
1037
+ 26,
1038
+ {
1039
+ "momentSlug": [
1040
+ 10,
1041
+ "String!"
1042
+ ],
1043
+ "cursor": [
1044
+ 10
1045
+ ],
1046
+ "take": [
1047
+ 14
1048
+ ]
1049
+ }
1050
+ ],
1051
+ "__typename": [
1052
+ 10
1053
+ ]
1054
+ }
1055
+ }
1056
+ };
1057
+
1058
+ // src/generated/index.ts
1059
+ var typeMap = linkTypeMap(types_default);
1060
+ var createClient2 = function(options) {
1061
+ return createClient({
1062
+ url: void 0,
1063
+ ...options,
1064
+ queryRoot: typeMap.Query,
1065
+ mutationRoot: typeMap.Mutation,
1066
+ subscriptionRoot: typeMap.Subscription
1067
+ });
1068
+ };
1069
+ var everything = {
1070
+ __scalar: true
1071
+ };
1072
+ var generateQueryOp = function(fields) {
1073
+ return generateGraphqlOperation("query", typeMap.Query, fields);
1074
+ };
1075
+
1076
+ // src/client.ts
1077
+ function createITMPartnerClient(config) {
1078
+ const { token, baseUrl, headers: extraHeaders } = config;
1079
+ if (!token) {
1080
+ throw new Error(
1081
+ "ITM Partner SDK: token is required. Get one from backstage: Settings > Partner API."
1082
+ );
1083
+ }
1084
+ return createClient2({
1085
+ url: baseUrl ?? "https://api.itm.studio/graphql",
1086
+ headers: {
1087
+ "x-partner-api-key": token,
1088
+ "Content-Type": "application/json",
1089
+ ...extraHeaders
1090
+ }
1091
+ });
1092
+ }
1093
+
1094
+ exports.createITMPartnerClient = createITMPartnerClient;
1095
+ exports.everything = everything;
1096
+ exports.generateQueryOp = generateQueryOp;
1097
+ //# sourceMappingURL=index.js.map
1098
+ //# sourceMappingURL=index.js.map