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