@reqquest/ui 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.
Files changed (41) hide show
  1. package/README.md +3 -0
  2. package/dist/api.d.ts +595 -0
  3. package/dist/api.js +618 -0
  4. package/dist/components/ButtonLoadingIcon.svelte +27 -0
  5. package/dist/components/ButtonLoadingIcon.svelte.d.ts +18 -0
  6. package/dist/components/index.d.ts +1 -0
  7. package/dist/components/index.js +1 -0
  8. package/dist/index.d.ts +4 -0
  9. package/dist/index.js +4 -0
  10. package/dist/registry.d.ts +138 -0
  11. package/dist/registry.js +42 -0
  12. package/dist/stores/IStateStore.d.ts +5 -0
  13. package/dist/stores/IStateStore.js +1 -0
  14. package/dist/typed-client/index.d.ts +25 -0
  15. package/dist/typed-client/index.js +23 -0
  16. package/dist/typed-client/runtime/batcher.d.ts +105 -0
  17. package/dist/typed-client/runtime/batcher.js +203 -0
  18. package/dist/typed-client/runtime/createClient.d.ts +17 -0
  19. package/dist/typed-client/runtime/createClient.js +24 -0
  20. package/dist/typed-client/runtime/error.d.ts +18 -0
  21. package/dist/typed-client/runtime/error.js +19 -0
  22. package/dist/typed-client/runtime/fetcher.d.ts +10 -0
  23. package/dist/typed-client/runtime/fetcher.js +65 -0
  24. package/dist/typed-client/runtime/generateGraphqlOperation.d.ts +30 -0
  25. package/dist/typed-client/runtime/generateGraphqlOperation.js +128 -0
  26. package/dist/typed-client/runtime/index.d.ts +11 -0
  27. package/dist/typed-client/runtime/index.js +10 -0
  28. package/dist/typed-client/runtime/linkTypeMap.d.ts +9 -0
  29. package/dist/typed-client/runtime/linkTypeMap.js +95 -0
  30. package/dist/typed-client/runtime/typeSelection.d.ts +28 -0
  31. package/dist/typed-client/runtime/typeSelection.js +3 -0
  32. package/dist/typed-client/runtime/types.d.ts +55 -0
  33. package/dist/typed-client/runtime/types.js +2 -0
  34. package/dist/typed-client/schema.d.ts +1483 -0
  35. package/dist/typed-client/schema.graphql +1217 -0
  36. package/dist/typed-client/schema.js +313 -0
  37. package/dist/typed-client/types.d.ts +540 -0
  38. package/dist/typed-client/types.js +1368 -0
  39. package/dist/util.d.ts +2 -0
  40. package/dist/util.js +3 -0
  41. package/package.json +56 -0
package/dist/api.js ADDED
@@ -0,0 +1,618 @@
1
+ import { PUBLIC_API_BASE, PUBLIC_AUTH_REDIRECT } from '$env/static/public';
2
+ import { APIBase } from '@txstate-mws/sveltekit-utils';
3
+ import { createClient, enumAppRequestIndexDestination, enumPromptVisibility, enumRequirementType } from './typed-client/index.js';
4
+ import { DateTime } from 'luxon';
5
+ class API extends APIBase {
6
+ client = createClient({
7
+ url: PUBLIC_API_BASE,
8
+ fetcher: async (operation) => {
9
+ if (Array.isArray(operation))
10
+ throw new Error('Batching not supported');
11
+ const data = await this.graphql(operation.query, operation.variables);
12
+ return { data };
13
+ }
14
+ });
15
+ async getAccess() {
16
+ const response = await this.client.query({
17
+ __name: 'GetAccess',
18
+ access: {
19
+ createPeriod: true,
20
+ createRole: true,
21
+ viewRoleManagement: true,
22
+ viewPeriodManagement: true,
23
+ viewReviewerInterface: true,
24
+ viewApplicantDashboard: true,
25
+ viewAppRequestList: true
26
+ }
27
+ });
28
+ return response.access;
29
+ }
30
+ async getApplicantRequests() {
31
+ const response = await this.client.query({
32
+ __name: 'GetApplicantRequests',
33
+ appRequests: {
34
+ __args: { filter: { own: true } },
35
+ id: true,
36
+ status: true,
37
+ period: {
38
+ name: true,
39
+ openDate: true,
40
+ closeDate: true
41
+ }
42
+ }
43
+ });
44
+ return response.appRequests;
45
+ }
46
+ async getNextPrompt(appRequestId, currentPromptKey) {
47
+ const response = await this.client.query({
48
+ __name: 'GetNextPrompt',
49
+ appRequests: {
50
+ __args: { filter: { ids: [appRequestId] } },
51
+ applications: {
52
+ requirements: {
53
+ prompts: {
54
+ id: true,
55
+ key: true,
56
+ answered: true,
57
+ visibility: true
58
+ }
59
+ }
60
+ }
61
+ }
62
+ });
63
+ let currentKeyFound = false;
64
+ for (const applications of response.appRequests[0]?.applications ?? []) {
65
+ for (const requirement of applications.requirements) {
66
+ for (const prompt of requirement.prompts) {
67
+ if ((!prompt.answered || currentKeyFound) && prompt.visibility === enumPromptVisibility.AVAILABLE)
68
+ return prompt;
69
+ if (prompt.key === currentPromptKey && prompt.visibility === enumPromptVisibility.AVAILABLE)
70
+ currentKeyFound = true;
71
+ }
72
+ }
73
+ }
74
+ }
75
+ async getApplyNavigation(appRequestId) {
76
+ const response = await this.client.query({
77
+ __name: 'GetApplyNavigation',
78
+ appRequests: {
79
+ __args: { filter: { ids: [appRequestId] } },
80
+ id: true,
81
+ status: true,
82
+ applications: {
83
+ id: true,
84
+ status: true,
85
+ statusReason: true,
86
+ title: true,
87
+ navTitle: true,
88
+ requirements: {
89
+ id: true,
90
+ type: true,
91
+ status: true,
92
+ statusReason: true,
93
+ prompts: {
94
+ id: true,
95
+ key: true,
96
+ title: true,
97
+ navTitle: true,
98
+ answered: true,
99
+ visibility: true
100
+ }
101
+ }
102
+ }
103
+ }
104
+ });
105
+ if (response.appRequests.length === 0)
106
+ return { prequalPrompts: [], appRequest: undefined };
107
+ const appRequest = response.appRequests[0];
108
+ const prequalPrompts = appRequest.applications.flatMap(application => application.requirements.filter(r => r.type === enumRequirementType.PREQUAL).flatMap(r => r.prompts.filter(p => p.visibility === enumPromptVisibility.AVAILABLE)));
109
+ const postqualPrompts = appRequest.applications.flatMap(application => application.requirements.filter(r => r.type === enumRequirementType.POSTQUAL).flatMap(r => r.prompts.filter(p => p.visibility === enumPromptVisibility.AVAILABLE)));
110
+ const applications = appRequest.applications.map(application => ({
111
+ ...application,
112
+ requirements: application.requirements.filter(r => r.type === enumRequirementType.QUALIFICATION).map(requirement => ({
113
+ ...requirement,
114
+ prompts: requirement.prompts.filter(p => p.visibility === enumPromptVisibility.AVAILABLE)
115
+ }))
116
+ }));
117
+ return { prequalPrompts, postqualPrompts, appRequest: { ...appRequest, applications } };
118
+ }
119
+ async getApplicantPrompt(appRequestId, promptKey) {
120
+ const response = await this.client.query({
121
+ __name: 'GetPromptData',
122
+ appRequests: {
123
+ __args: { filter: { ids: [appRequestId] } },
124
+ data: true,
125
+ applications: {
126
+ id: true,
127
+ requirements: {
128
+ type: true,
129
+ status: true,
130
+ statusReason: true,
131
+ prompts: {
132
+ id: true,
133
+ key: true,
134
+ visibility: true,
135
+ fetchedData: true,
136
+ configurationRelatedData: true
137
+ }
138
+ }
139
+ }
140
+ }
141
+ });
142
+ if (response.appRequests.length === 0)
143
+ return {};
144
+ const appRequest = response.appRequests[0];
145
+ for (const application of appRequest.applications) {
146
+ for (const requirement of application.requirements.filter(r => r.type === enumRequirementType.PREQUAL || r.type === enumRequirementType.QUALIFICATION || r.type === enumRequirementType.POSTQUAL)) {
147
+ for (const prompt of requirement.prompts) {
148
+ if (prompt.key === promptKey && prompt.visibility === enumPromptVisibility.AVAILABLE)
149
+ return { appRequestData: appRequest.data, prompt };
150
+ }
151
+ }
152
+ }
153
+ return { appRequestData: appRequest.data };
154
+ }
155
+ async updatePrompt(promptId, data, validateOnly) {
156
+ const response = await this.client.mutation({
157
+ __name: 'UpdatePrompt',
158
+ updatePrompt: {
159
+ __args: { promptId, data, validateOnly },
160
+ success: true,
161
+ messages: {
162
+ message: true,
163
+ type: true,
164
+ arg: true
165
+ }
166
+ }
167
+ });
168
+ return this.mutationForDialog(response.updatePrompt);
169
+ }
170
+ async updateConfiguration(periodId, definitionKey, data, validateOnly) {
171
+ const response = await this.client.mutation({
172
+ __name: 'UpdateConfiguration',
173
+ updateConfiguration: {
174
+ __args: { periodId, key: definitionKey, data, validateOnly },
175
+ success: true,
176
+ messages: {
177
+ message: true,
178
+ type: true,
179
+ arg: true
180
+ }
181
+ }
182
+ });
183
+ return this.mutationForDialog(response.updateConfiguration);
184
+ }
185
+ async getAppRequestData(appRequestId) {
186
+ const response = await this.client.query({
187
+ __name: 'GetAppRequestData',
188
+ appRequests: {
189
+ __args: { filter: { ids: [appRequestId] } },
190
+ id: true,
191
+ data: true
192
+ }
193
+ });
194
+ if (response.appRequests.length === 0)
195
+ return {};
196
+ const appRequest = response.appRequests[0];
197
+ return appRequest.data;
198
+ }
199
+ async submitAppRequest(appRequestId) {
200
+ const response = await this.client.mutation({
201
+ __name: 'SubmitAppRequest',
202
+ submitAppRequest: {
203
+ __args: { appRequestId },
204
+ success: true,
205
+ messages: {
206
+ message: true,
207
+ type: true,
208
+ arg: true
209
+ }
210
+ }
211
+ });
212
+ return this.mutationForDialog(response.submitAppRequest);
213
+ }
214
+ async getAppRequests(filter, dest = enumAppRequestIndexDestination.APP_REQUEST_LIST) {
215
+ const response = await this.client.query({
216
+ __name: 'GetAppRequests',
217
+ appRequests: {
218
+ __args: { filter },
219
+ id: true,
220
+ applicant: {
221
+ login: true,
222
+ fullname: true
223
+ },
224
+ status: true,
225
+ statusReason: true,
226
+ period: {
227
+ id: true,
228
+ name: true
229
+ },
230
+ indexCategories: {
231
+ __args: { for: dest },
232
+ category: true,
233
+ categoryLabel: true,
234
+ values: {
235
+ value: true,
236
+ label: true
237
+ }
238
+ },
239
+ actions: {
240
+ cancel: true,
241
+ close: true,
242
+ reopen: true,
243
+ return: true,
244
+ review: true,
245
+ offer: true,
246
+ submit: true
247
+ }
248
+ },
249
+ appRequestIndexes: {
250
+ category: true,
251
+ categoryLabel: true,
252
+ appRequestListPriority: true,
253
+ listFiltersPriority: true,
254
+ listable: true,
255
+ values: {
256
+ __args: { inUse: true },
257
+ value: true,
258
+ label: true
259
+ }
260
+ }
261
+ });
262
+ return response;
263
+ }
264
+ async searchIndexItems(category, search) {
265
+ const response = await this.client.query({
266
+ __name: 'SearchIndexItems',
267
+ appRequestIndexes: {
268
+ __args: { categories: [category] },
269
+ values: {
270
+ __args: { search },
271
+ value: true,
272
+ label: true
273
+ }
274
+ }
275
+ });
276
+ return response.appRequestIndexes[0]?.values ?? [];
277
+ }
278
+ async getBasicRequestData(appRequestId) {
279
+ const response = await this.client.query({
280
+ __name: 'GetBasicRequestData',
281
+ appRequests: {
282
+ __args: { filter: { ids: [appRequestId] } },
283
+ applicant: {
284
+ login: true,
285
+ fullname: true,
286
+ otherIdentifiers: {
287
+ id: true,
288
+ label: true
289
+ },
290
+ otherInfo: true
291
+ },
292
+ period: {
293
+ id: true,
294
+ name: true
295
+ }
296
+ }
297
+ });
298
+ if (response.appRequests.length === 0)
299
+ return undefined;
300
+ return response.appRequests[0];
301
+ }
302
+ async getReviewData(appRequestId) {
303
+ const response = await this.client.query({
304
+ __name: 'GetReviewData',
305
+ appRequests: {
306
+ __args: { filter: { ids: [appRequestId] } },
307
+ id: true,
308
+ status: true,
309
+ data: true,
310
+ applications: {
311
+ id: true,
312
+ status: true,
313
+ statusReason: true,
314
+ title: true,
315
+ navTitle: true,
316
+ requirements: {
317
+ id: true,
318
+ type: true,
319
+ title: true,
320
+ status: true,
321
+ statusReason: true,
322
+ reachable: true,
323
+ prompts: {
324
+ id: true,
325
+ key: true,
326
+ title: true,
327
+ navTitle: true,
328
+ answered: true,
329
+ visibility: true,
330
+ actions: {
331
+ update: true
332
+ }
333
+ }
334
+ }
335
+ }
336
+ }
337
+ });
338
+ if (response.appRequests.length === 0)
339
+ return undefined;
340
+ const appRequest = response.appRequests[0];
341
+ return { ...appRequest, applications: appRequest.applications.map(a => ({ ...a, requirements: a.requirements.filter(r => r.reachable).map(r => ({ ...r, prompts: r.prompts.filter(p => p.visibility !== enumPromptVisibility.UNREACHABLE) })) })) };
342
+ }
343
+ async getRequestActivity(appRequestId, filters) {
344
+ const response = await this.client.query({
345
+ __name: 'GetRequestActivity',
346
+ appRequests: {
347
+ __args: { filter: { ids: [appRequestId] } },
348
+ activity: {
349
+ __args: { filters },
350
+ id: true,
351
+ user: {
352
+ login: true,
353
+ fullname: true
354
+ },
355
+ impersonatedBy: {
356
+ login: true,
357
+ fullname: true
358
+ },
359
+ action: true,
360
+ description: true,
361
+ data: true,
362
+ createdAt: true
363
+ }
364
+ }
365
+ });
366
+ if (response.appRequests.length === 0)
367
+ return undefined;
368
+ return response.appRequests[0].activity.map(activity => ({
369
+ ...activity,
370
+ createdAt: DateTime.fromISO(activity.createdAt)
371
+ }));
372
+ }
373
+ async getPromptData(appRequestId, promptId) {
374
+ const response = await this.client.query({
375
+ __name: 'GetPromptData',
376
+ appRequests: {
377
+ __args: { filter: { ids: [appRequestId] } },
378
+ prompt: {
379
+ __args: { promptId },
380
+ data: true,
381
+ preloadData: true,
382
+ configurationRelatedData: true,
383
+ fetchedData: true
384
+ }
385
+ }
386
+ });
387
+ const appRequest = response.appRequests[0];
388
+ return appRequest.prompt;
389
+ }
390
+ async getPeriodList() {
391
+ const response = await this.client.query({
392
+ __name: 'GetPeriodList',
393
+ periods: {
394
+ id: true,
395
+ name: true,
396
+ openDate: true,
397
+ closeDate: true,
398
+ archiveDate: true
399
+ }
400
+ });
401
+ return response.periods;
402
+ }
403
+ async getPeriodConfigurations(periodId) {
404
+ const response = await this.client.query({
405
+ __name: 'GetPeriodConfigurations',
406
+ periods: {
407
+ __args: { filter: { ids: [periodId] } },
408
+ id: true,
409
+ name: true,
410
+ code: true,
411
+ openDate: true,
412
+ closeDate: true,
413
+ archiveDate: true,
414
+ programs: {
415
+ key: true,
416
+ title: true,
417
+ enabled: true,
418
+ requirements: {
419
+ key: true,
420
+ title: true,
421
+ description: true,
422
+ enabled: true,
423
+ configuration: {
424
+ data: true,
425
+ actions: {
426
+ update: true
427
+ }
428
+ },
429
+ prompts: {
430
+ key: true,
431
+ title: true,
432
+ description: true,
433
+ configuration: {
434
+ data: true,
435
+ actions: {
436
+ update: true
437
+ }
438
+ }
439
+ }
440
+ }
441
+ }
442
+ }
443
+ });
444
+ if (!response.periods.length)
445
+ return { period: undefined, programs: [] };
446
+ const period = response.periods[0];
447
+ return { programs: period.programs, period };
448
+ }
449
+ async getRoleList() {
450
+ const response = await this.client.query({
451
+ __name: 'GetRoleList',
452
+ roles: {
453
+ id: true,
454
+ name: true,
455
+ description: true,
456
+ groups: true,
457
+ actions: {
458
+ update: true,
459
+ delete: true
460
+ }
461
+ }
462
+ });
463
+ return response.roles;
464
+ }
465
+ async getRoleDetails(roleId) {
466
+ const response = await this.client.query({
467
+ __name: 'GetRoleDetails',
468
+ roles: {
469
+ __args: { filter: { ids: [roleId] } },
470
+ id: true,
471
+ name: true,
472
+ description: true,
473
+ groups: true,
474
+ grants: {
475
+ id: true,
476
+ subjectType: {
477
+ name: true,
478
+ title: true,
479
+ description: true
480
+ },
481
+ allow: true,
482
+ controls: true,
483
+ tags: {
484
+ category: true,
485
+ categoryLabel: true,
486
+ tag: true,
487
+ label: true
488
+ },
489
+ actions: {
490
+ update: true,
491
+ delete: true
492
+ }
493
+ },
494
+ actions: {
495
+ update: true,
496
+ delete: true
497
+ }
498
+ }
499
+ });
500
+ if (!response.roles.length)
501
+ return undefined;
502
+ const role = response.roles[0];
503
+ return role;
504
+ }
505
+ async getAuthorizationInfo() {
506
+ const response = await this.client.query({
507
+ __name: 'GetAuthorizationInfo',
508
+ subjectTypes: {
509
+ name: true,
510
+ title: true,
511
+ description: true,
512
+ tags: {
513
+ category: true,
514
+ label: true,
515
+ description: true,
516
+ listable: true,
517
+ tags: {
518
+ value: true,
519
+ label: true
520
+ }
521
+ },
522
+ controls: {
523
+ name: true,
524
+ description: true
525
+ }
526
+ }
527
+ });
528
+ return response.subjectTypes;
529
+ }
530
+ async upsertRole(roleId, role, validateOnly) {
531
+ if (roleId != null) {
532
+ const response = await this.client.mutation({
533
+ __name: 'UpdateRole',
534
+ roleUpdate: {
535
+ __args: { roleId, role, validateOnly },
536
+ success: true,
537
+ messages: {
538
+ message: true,
539
+ type: true,
540
+ arg: true
541
+ }
542
+ }
543
+ });
544
+ return this.mutationForDialog(response.roleUpdate);
545
+ }
546
+ else {
547
+ const response = await this.client.mutation({
548
+ __name: 'CreateRole',
549
+ roleCreate: {
550
+ __args: { role, validateOnly },
551
+ success: true,
552
+ messages: {
553
+ message: true,
554
+ type: true,
555
+ arg: true
556
+ }
557
+ }
558
+ });
559
+ return this.mutationForDialog(response.roleCreate);
560
+ }
561
+ }
562
+ async deleteRole(roleId) {
563
+ const response = await this.client.mutation({
564
+ __name: 'DeleteRole',
565
+ roleDelete: {
566
+ __args: { roleId },
567
+ success: true
568
+ }
569
+ });
570
+ return response.roleDelete.success;
571
+ }
572
+ async updateGrant(grantId, grant, validateOnly) {
573
+ const response = await this.client.mutation({
574
+ __name: 'UpdateGrant',
575
+ roleUpdateGrant: {
576
+ __args: { grantId, grant, validateOnly },
577
+ success: true,
578
+ messages: {
579
+ message: true,
580
+ type: true,
581
+ arg: true
582
+ }
583
+ }
584
+ });
585
+ return this.mutationForDialog(response.roleUpdateGrant);
586
+ }
587
+ async createGrant(roleId, grant, validateOnly) {
588
+ const response = await this.client.mutation({
589
+ __name: 'CreateGrant',
590
+ roleAddGrant: {
591
+ __args: { roleId, grant, validateOnly },
592
+ success: true,
593
+ messages: {
594
+ message: true,
595
+ type: true,
596
+ arg: true
597
+ }
598
+ }
599
+ });
600
+ return this.mutationForDialog(response.roleAddGrant);
601
+ }
602
+ async deleteGrant(grantId) {
603
+ const response = await this.client.mutation({
604
+ __name: 'DeleteGrant',
605
+ roleDeleteGrant: {
606
+ __args: { grantId },
607
+ success: true,
608
+ messages: {
609
+ message: true,
610
+ type: true,
611
+ arg: true
612
+ }
613
+ }
614
+ });
615
+ return this.mutationForDialog(response.roleDeleteGrant);
616
+ }
617
+ }
618
+ export const api = new API(PUBLIC_API_BASE, PUBLIC_AUTH_REDIRECT);
@@ -0,0 +1,27 @@
1
+ <script>import { ScreenReaderOnly } from "@txstate-mws/svelte-components";
2
+ </script>
3
+
4
+ <svg style:display="none"></svg>
5
+ <span {...$$restProps} class="{$$restProps.class} loader" aria-hidden="false"><ScreenReaderOnly>loading</ScreenReaderOnly></span>
6
+
7
+ <style>
8
+ .loader {
9
+ width: 16px;
10
+ height: 16px;
11
+ border: 3px solid #FFF;
12
+ border-bottom-color: transparent;
13
+ border-radius: 50%;
14
+ display: inline-block;
15
+ box-sizing: border-box;
16
+ animation: rotation 1s linear infinite;
17
+ }
18
+
19
+ @keyframes rotation {
20
+ 0% {
21
+ transform: rotate(0deg);
22
+ }
23
+ 100% {
24
+ transform: rotate(360deg);
25
+ }
26
+ }
27
+ </style>
@@ -0,0 +1,18 @@
1
+ import { SvelteComponent } from "svelte";
2
+ declare const __propDef: {
3
+ props: {
4
+ [x: string]: any;
5
+ };
6
+ events: {
7
+ [evt: string]: CustomEvent<any>;
8
+ };
9
+ slots: {};
10
+ exports?: undefined;
11
+ bindings?: undefined;
12
+ };
13
+ export type ButtonLoadingIconProps = typeof __propDef.props;
14
+ export type ButtonLoadingIconEvents = typeof __propDef.events;
15
+ export type ButtonLoadingIconSlots = typeof __propDef.slots;
16
+ export default class ButtonLoadingIcon extends SvelteComponent<ButtonLoadingIconProps, ButtonLoadingIconEvents, ButtonLoadingIconSlots> {
17
+ }
18
+ export {};
@@ -0,0 +1 @@
1
+ export { default as ButtonLoadingIcon } from './ButtonLoadingIcon.svelte';
@@ -0,0 +1 @@
1
+ export { default as ButtonLoadingIcon } from './ButtonLoadingIcon.svelte';
@@ -0,0 +1,4 @@
1
+ export * from './api.js';
2
+ export * from './components/index.js';
3
+ export * from './typed-client/index.js';
4
+ export * from './util.js';
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './api.js';
2
+ export * from './components/index.js';
3
+ export * from './typed-client/index.js';
4
+ export * from './util.js';