@appsemble/utils 0.30.14-test.6 → 0.32.1-test.14

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 (171) hide show
  1. package/README.md +3 -3
  2. package/allActions.js +5 -3
  3. package/api/components/parameters/$orderby.js +2 -2
  4. package/api/components/parameters/index.d.ts +2 -1
  5. package/api/components/parameters/index.js +2 -1
  6. package/api/components/parameters/webhookName.d.ts +2 -0
  7. package/api/components/parameters/webhookName.js +10 -0
  8. package/api/components/parameters/webhookSecretId.d.ts +2 -0
  9. package/api/components/parameters/webhookSecretId.js +8 -0
  10. package/api/components/schemas/ActionDefinition.js +3 -0
  11. package/api/components/schemas/App.js +8 -0
  12. package/api/components/schemas/AppDefinition.js +6 -0
  13. package/api/components/schemas/AppLayoutDefinition.js +8 -0
  14. package/api/components/schemas/AppServiceSecret.js +5 -0
  15. package/api/components/schemas/AppWebhookSecret.d.ts +2 -0
  16. package/api/components/schemas/AppWebhookSecret.js +25 -0
  17. package/api/components/schemas/DialogOkActionDefinition.js +1 -1
  18. package/api/components/schemas/FilterParametersDefinition.d.ts +2 -0
  19. package/api/components/schemas/FilterParametersDefinition.js +15 -0
  20. package/api/components/schemas/FlowCancelActionDefinition.js +1 -1
  21. package/api/components/schemas/FlowFinishActionDefinition.js +1 -1
  22. package/api/components/schemas/GroupMemberDeleteActionDefinition.js +1 -1
  23. package/api/components/schemas/ResourceDefinition.js +5 -0
  24. package/api/components/schemas/ResourceDeleteAllActionDefinition.d.ts +1 -0
  25. package/api/components/schemas/ResourceDeleteAllActionDefinition.js +21 -0
  26. package/api/components/schemas/ResourceDeleteBulkActionDefinition.d.ts +1 -0
  27. package/api/components/schemas/ResourceDeleteBulkActionDefinition.js +18 -0
  28. package/api/components/schemas/ResourceGetActionDefinition.js +3 -0
  29. package/api/components/schemas/ResourcePatchActionDefinition.js +3 -0
  30. package/api/components/schemas/ResourceSubscriptionStatusActionDefinition.js +1 -0
  31. package/api/components/schemas/ResourceSubscriptionSubscribeActionDefinition.js +1 -0
  32. package/api/components/schemas/ResourceSubscriptionToggleActionDefinition.js +1 -0
  33. package/api/components/schemas/ResourceSubscriptionUnsubscribeActionDefinition.js +1 -0
  34. package/api/components/schemas/ResourceUpdatePositionsActionDefinition.d.ts +1 -0
  35. package/api/components/schemas/ResourceUpdatePositionsActionDefinition.js +21 -0
  36. package/api/components/schemas/SecurityCronDefinition.d.ts +2 -0
  37. package/api/components/schemas/SecurityCronDefinition.js +26 -0
  38. package/api/components/schemas/SecurityDefinition.js +1 -0
  39. package/api/components/schemas/StorageSubtractActionDefinition.js +2 -2
  40. package/api/components/schemas/Training.js +2 -25
  41. package/api/components/schemas/TrainingCompleted.d.ts +2 -0
  42. package/api/components/schemas/TrainingCompleted.js +17 -0
  43. package/api/components/schemas/WebhookDefinition.d.ts +2 -0
  44. package/api/components/schemas/WebhookDefinition.js +17 -0
  45. package/api/components/schemas/index.d.ts +8 -1
  46. package/api/components/schemas/index.js +8 -1
  47. package/api/components/schemas/utils.js +1 -1
  48. package/api/components/securitySchemes/index.d.ts +1 -0
  49. package/api/components/securitySchemes/index.js +1 -0
  50. package/api/components/securitySchemes/webhook.d.ts +2 -0
  51. package/api/components/securitySchemes/webhook.js +6 -0
  52. package/api/paths/apps/appId/resources/resourceType/resourceId/positions.js +54 -0
  53. package/api/paths/apps/appId/secrets/webhook/secretId.js +61 -0
  54. package/api/paths/apps/appId/secrets/webhook.js +44 -0
  55. package/api/paths/apps/appId/webhooks/webhookName.js +35 -0
  56. package/api/paths/apps/appId.js +6 -0
  57. package/api/paths/auth/email/patchPassword.js +30 -0
  58. package/api/paths/index.d.ts +7 -5
  59. package/api/paths/index.js +16 -12
  60. package/api/paths/trainings/completeTraining.js +18 -0
  61. package/api/paths/trainings/completedTrainings.d.ts +2 -0
  62. package/api/paths/trainings/completedTrainings.js +21 -0
  63. package/api/paths/trainings/trainingIds.d.ts +2 -0
  64. package/api/paths/trainings/trainingIds.js +20 -0
  65. package/api/tags/index.js +4 -4
  66. package/appMessages.js +1 -1
  67. package/assets.js +1 -1
  68. package/authorization.d.ts +1 -1
  69. package/authorization.js +1 -1
  70. package/blockUtils.d.ts +1 -1
  71. package/blockUtils.js +1 -0
  72. package/convertToCsv.js +2 -0
  73. package/examples.js +214 -4
  74. package/formatRequestAction.js +2 -2
  75. package/has.d.ts +1 -1
  76. package/has.js +1 -1
  77. package/i18n.js +6 -8
  78. package/ics.js +1 -1
  79. package/iterApp.js +3 -3
  80. package/jsonschema.js +16 -3
  81. package/package.json +15 -11
  82. package/reference-schemas/actions/appMember.d.ts +2 -0
  83. package/reference-schemas/actions/appMember.js +21 -0
  84. package/reference-schemas/actions/flow.d.ts +2 -0
  85. package/reference-schemas/actions/flow.js +13 -0
  86. package/reference-schemas/actions/group.d.ts +2 -0
  87. package/reference-schemas/actions/group.js +13 -0
  88. package/reference-schemas/actions/index.d.ts +7 -0
  89. package/reference-schemas/actions/index.js +8 -0
  90. package/reference-schemas/actions/link.d.ts +2 -0
  91. package/reference-schemas/actions/link.js +9 -0
  92. package/reference-schemas/actions/miscellaneous.d.ts +2 -0
  93. package/reference-schemas/actions/miscellaneous.js +41 -0
  94. package/reference-schemas/actions/resources.d.ts +2 -0
  95. package/reference-schemas/actions/resources.js +19 -0
  96. package/reference-schemas/actions/storage.d.ts +2 -0
  97. package/reference-schemas/actions/storage.js +15 -0
  98. package/reference-schemas/remappers/conditionals.js +39 -0
  99. package/reference-schemas/remappers/data.js +26 -2
  100. package/reference-schemas/remappers/index.d.ts +1 -0
  101. package/reference-schemas/remappers/index.js +1 -0
  102. package/reference-schemas/remappers/objects.js +32 -0
  103. package/reference-schemas/remappers/odata.d.ts +2 -0
  104. package/reference-schemas/remappers/odata.js +95 -0
  105. package/reference-schemas/remappers/strings.js +33 -0
  106. package/reference-schemas/remappers/unsorted.js +9 -0
  107. package/remap.d.ts +2 -0
  108. package/remap.js +192 -15
  109. package/serializeResource.d.ts +7 -0
  110. package/serializeResource.js +7 -0
  111. package/serverActions.d.ts +1 -1
  112. package/serverActions.js +2 -0
  113. package/theme.js +5 -1
  114. package/validateStyle.js +2 -0
  115. package/validation.js +52 -16
  116. package/api/components/parameters/trainingBlockId.d.ts +0 -2
  117. package/api/components/parameters/trainingBlockId.js +0 -8
  118. package/api/components/schemas/TrainingBlock.d.ts +0 -2
  119. package/api/components/schemas/TrainingBlock.js +0 -38
  120. package/api/components/securitySchemes/cli.test.d.ts +0 -1
  121. package/api/components/securitySchemes/cli.test.js +0 -7
  122. package/api/index.test.d.ts +0 -1
  123. package/api/index.test.js +0 -180
  124. package/api/paths/trainingBlocks/trainingBlockId.js +0 -41
  125. package/api/paths/trainings/trainingId/blocks.js +0 -51
  126. package/api/paths/trainings/trainingId/users/current.js +0 -62
  127. package/api/paths/trainings/trainingId/users.js +0 -25
  128. package/api/paths/trainings/trainingId.js +0 -85
  129. package/api/paths/trainings.js +0 -44
  130. package/appMessages.test.d.ts +0 -1
  131. package/appMessages.test.js +0 -409
  132. package/blockUtils.test.d.ts +0 -1
  133. package/blockUtils.test.js +0 -77
  134. package/constants/patterns.test.d.ts +0 -1
  135. package/constants/patterns.test.js +0 -83
  136. package/convertToCsv.test.d.ts +0 -1
  137. package/convertToCsv.test.js +0 -55
  138. package/has.test.d.ts +0 -1
  139. package/has.test.js +0 -17
  140. package/i18n.test.d.ts +0 -1
  141. package/i18n.test.js +0 -76
  142. package/iterApp.test.d.ts +0 -1
  143. package/iterApp.test.js +0 -439
  144. package/jsonschema.test.d.ts +0 -1
  145. package/jsonschema.test.js +0 -256
  146. package/mapValues.test.d.ts +0 -1
  147. package/mapValues.test.js +0 -16
  148. package/miscellaneous.test.d.ts +0 -1
  149. package/miscellaneous.test.js +0 -87
  150. package/normalize.test.d.ts +0 -1
  151. package/normalize.test.js +0 -23
  152. package/objectCache.test.d.ts +0 -1
  153. package/objectCache.test.js +0 -20
  154. package/prefix.test.d.ts +0 -1
  155. package/prefix.test.js +0 -11
  156. package/remap.test.d.ts +0 -1
  157. package/remap.test.js +0 -1387
  158. package/string.test.d.ts +0 -1
  159. package/string.test.js +0 -27
  160. package/theme.test.d.ts +0 -1
  161. package/theme.test.js +0 -91
  162. package/validateStyle.test.d.ts +0 -1
  163. package/validateStyle.test.js +0 -13
  164. package/validation.test.d.ts +0 -1
  165. package/validation.test.js +0 -3121
  166. /package/api/paths/{trainingBlocks/trainingBlockId.d.ts → apps/appId/resources/resourceType/resourceId/positions.d.ts} +0 -0
  167. /package/api/paths/{trainings/trainingId.d.ts → apps/appId/secrets/webhook/secretId.d.ts} +0 -0
  168. /package/api/paths/{trainings.d.ts → apps/appId/secrets/webhook.d.ts} +0 -0
  169. /package/api/paths/{trainings/trainingId/blocks.d.ts → apps/appId/webhooks/webhookName.d.ts} +0 -0
  170. /package/api/paths/{trainings/trainingId/users.d.ts → auth/email/patchPassword.d.ts} +0 -0
  171. /package/api/paths/trainings/{trainingId/users/current.d.ts → completeTraining.d.ts} +0 -0
package/api/index.test.js DELETED
@@ -1,180 +0,0 @@
1
- import { readdirSync } from 'node:fs';
2
- import { readFile } from 'node:fs/promises';
3
- import { createValidator } from 'koas-core/lib/validation.js';
4
- import { describe, expect, it } from 'vitest';
5
- import { parse } from 'yaml';
6
- import { api, schemas } from './index.js';
7
- describe('schemas', () => {
8
- const document = api('');
9
- const validator = createValidator(document);
10
- const entries = Object.entries(validator.schemas);
11
- describe('boolean', () => {
12
- it.each(entries.filter(([, schema]) => schema.type === 'boolean'))('%s', (path, schema) => {
13
- expect(schema).not.toHaveProperty('additionalItems');
14
- expect(schema).not.toHaveProperty('additionalProperties');
15
- expect(schema).not.toHaveProperty('allOf');
16
- expect(schema).not.toHaveProperty('anyOf');
17
- expect(schema).not.toHaveProperty('const');
18
- // Expect(schema).toHaveProperty('description');
19
- expect(schema).not.toHaveProperty('else');
20
- expect(schema).not.toHaveProperty('enum');
21
- expect(schema).not.toHaveProperty('exclusiveMaximum');
22
- expect(schema).not.toHaveProperty('exclusiveMinimum');
23
- expect(schema).not.toHaveProperty('format');
24
- expect(schema).not.toHaveProperty('if');
25
- expect(schema).not.toHaveProperty('maximum');
26
- expect(schema).not.toHaveProperty('maxItems');
27
- expect(schema).not.toHaveProperty('maxLength');
28
- expect(schema).not.toHaveProperty('minimum');
29
- expect(schema).not.toHaveProperty('minItems');
30
- expect(schema).not.toHaveProperty('minLength');
31
- expect(schema).not.toHaveProperty('multipleOf');
32
- expect(schema).not.toHaveProperty('oneOf');
33
- expect(schema).not.toHaveProperty('required');
34
- expect(schema).not.toHaveProperty('then');
35
- expect(schema).not.toHaveProperty('uniqueItems');
36
- });
37
- });
38
- describe('enum', () => {
39
- it.each(entries.filter(([, schema]) => schema.enum))('%s', (path, schema) => {
40
- expect(schema).not.toHaveProperty('additionalItems');
41
- expect(schema).not.toHaveProperty('additionalProperties');
42
- expect(schema).not.toHaveProperty('allOf');
43
- expect(schema).not.toHaveProperty('anyOf');
44
- expect(schema).not.toHaveProperty('const');
45
- // Expect(schema).toHaveProperty('description');
46
- expect(schema).not.toHaveProperty('else');
47
- expect(schema).not.toHaveProperty('exclusiveMaximum');
48
- expect(schema).not.toHaveProperty('exclusiveMinimum');
49
- expect(schema).not.toHaveProperty('format');
50
- expect(schema).not.toHaveProperty('if');
51
- expect(schema).not.toHaveProperty('maximum');
52
- expect(schema).not.toHaveProperty('maxItems');
53
- expect(schema).not.toHaveProperty('maxLength');
54
- expect(schema).not.toHaveProperty('minimum');
55
- expect(schema).not.toHaveProperty('minItems');
56
- expect(schema).not.toHaveProperty('minLength');
57
- expect(schema).not.toHaveProperty('multipleOf');
58
- expect(schema).not.toHaveProperty('oneOf');
59
- expect(schema).not.toHaveProperty('required');
60
- expect(schema).not.toHaveProperty('then');
61
- expect(schema).not.toHaveProperty('type');
62
- expect(schema).not.toHaveProperty('uniqueItems');
63
- });
64
- });
65
- describe('object', () => {
66
- it.each(entries.filter(([, schema]) => schema.type === 'object'))('%s', (path, schema) => {
67
- // Action descriptions are defined on the type property.
68
- const descriptionSchema = path.endsWith('ActionDefinition') ? schema.properties.type : schema;
69
- const isTabsPageDefinition = path.endsWith('TabsPageDefinition');
70
- expect(schema).not.toHaveProperty('additionalItems');
71
- expect(schema).toHaveProperty('additionalProperties');
72
- expect(schema).not.toHaveProperty('allOf');
73
- expect(schema).not.toHaveProperty('anyOf');
74
- expect(schema).not.toHaveProperty('const');
75
- expect(descriptionSchema).toHaveProperty('description');
76
- expect(schema).not.toHaveProperty('else');
77
- expect(schema).not.toHaveProperty('enum');
78
- expect(schema).not.toHaveProperty('exclusiveMaximum');
79
- expect(schema).not.toHaveProperty('exclusiveMinimum');
80
- expect(schema).not.toHaveProperty('format');
81
- expect(schema).not.toHaveProperty('if');
82
- expect(schema).not.toHaveProperty('maximum');
83
- expect(schema).not.toHaveProperty('maxItems');
84
- expect(schema).not.toHaveProperty('maxLength');
85
- expect(schema).not.toHaveProperty('minimum');
86
- expect(schema).not.toHaveProperty('minItems');
87
- expect(schema).not.toHaveProperty('minLength');
88
- expect(schema).not.toHaveProperty('multipleOf');
89
- if (!isTabsPageDefinition) {
90
- // eslint-disable-next-line vitest/no-conditional-expect
91
- expect(schema).not.toHaveProperty('oneOf');
92
- }
93
- expect(schema).not.toHaveProperty('then');
94
- expect(schema).not.toHaveProperty('uniqueItems');
95
- if (schema.required && !schema.additionalProperties) {
96
- for (const name of schema.required) {
97
- // eslint-disable-next-line vitest/no-conditional-expect
98
- expect(schema.properties).toHaveProperty(name);
99
- }
100
- }
101
- });
102
- });
103
- describe('number', () => {
104
- it.each(entries.filter(([, schema]) => schema.type === 'number' || schema.type === 'integer'))('%s', (path, schema) => {
105
- expect(schema).not.toHaveProperty('additionalItems');
106
- expect(schema).not.toHaveProperty('additionalProperties');
107
- expect(schema).not.toHaveProperty('allOf');
108
- expect(schema).not.toHaveProperty('anyOf');
109
- expect(schema).not.toHaveProperty('const');
110
- // Expect(schema).toHaveProperty('description');
111
- expect(schema).not.toHaveProperty('else');
112
- expect(schema).not.toHaveProperty('enum');
113
- expect(schema).not.toHaveProperty('format');
114
- expect(schema).not.toHaveProperty('if');
115
- expect(schema).not.toHaveProperty('maxItems');
116
- expect(schema).not.toHaveProperty('maxLength');
117
- expect(schema).not.toHaveProperty('minLength');
118
- expect(schema).not.toHaveProperty('minItems');
119
- expect(schema).not.toHaveProperty('multipleOf');
120
- expect(schema).not.toHaveProperty('oneOf');
121
- expect(schema).not.toHaveProperty('required');
122
- expect(schema).not.toHaveProperty('then');
123
- expect(schema).not.toHaveProperty('uniqueItems');
124
- });
125
- });
126
- describe('string', () => {
127
- it.each(entries.filter(([, schema]) => schema.type === 'string'))('%s', (path, schema) => {
128
- expect(schema).not.toHaveProperty('additionalItems');
129
- expect(schema).not.toHaveProperty('additionalProperties');
130
- expect(schema).not.toHaveProperty('allOf');
131
- expect(schema).not.toHaveProperty('anyOf');
132
- expect(schema).not.toHaveProperty('const');
133
- // Expect(schema).toHaveProperty('description');
134
- expect(schema).not.toHaveProperty('else');
135
- expect(schema).not.toHaveProperty('enum');
136
- expect(schema).not.toHaveProperty('exclusiveMaximum');
137
- expect(schema).not.toHaveProperty('exclusiveMinimum');
138
- expect(schema).not.toHaveProperty('if');
139
- expect(schema).not.toHaveProperty('maximum');
140
- expect(schema).not.toHaveProperty('maxItems');
141
- // Expect(schema).toHaveProperty('maxLength');
142
- expect(schema).not.toHaveProperty('minimum');
143
- expect(schema).not.toHaveProperty('minItems');
144
- expect(schema).not.toHaveProperty('multipleOf');
145
- expect(schema).not.toHaveProperty('oneOf');
146
- expect(schema).not.toHaveProperty('required');
147
- expect(schema).not.toHaveProperty('then');
148
- expect(schema).not.toHaveProperty('uniqueItems');
149
- });
150
- });
151
- describe('validation', () => {
152
- const testsDir = new URL('schema-tests/', import.meta.url);
153
- describe.each(readdirSync(testsDir))('%s', (name) => {
154
- const schema = schemas[name];
155
- it('should reference an existing schema', () => {
156
- expect(schemas).toHaveProperty(name);
157
- });
158
- describe('valid', () => {
159
- const valid = new URL(`${name}/valid/`, testsDir);
160
- it.each(readdirSync(valid))('%s', async (filename) => {
161
- const buffer = await readFile(new URL(filename, valid), 'utf8');
162
- expect(buffer).toMatch(new RegExp(`^# yaml-language-server: \\$schema=https://appsemble.app/api.json#/components/schemas/${name}\n`));
163
- const instance = parse(buffer);
164
- const result = validator.validate(instance, schema, { base: '#', nestedErrors: true });
165
- expect(result.valid).toBe(true);
166
- });
167
- });
168
- describe('invalid', () => {
169
- const invalid = new URL(`${name}/invalid/`, testsDir);
170
- it.each(readdirSync(invalid))('%s', async (filename) => {
171
- const buffer = await readFile(new URL(filename, invalid), 'utf8');
172
- const instance = parse(buffer);
173
- const result = validator.validate(instance, schema, { base: '#', nestedErrors: true });
174
- expect(result.valid).toBe(false);
175
- });
176
- });
177
- });
178
- });
179
- });
180
- //# sourceMappingURL=index.test.js.map
@@ -1,41 +0,0 @@
1
- export const pathItems = {
2
- parameters: [{ $ref: '#/components/parameters/trainingBlockId' }],
3
- patch: {
4
- tags: ['main', 'training-block'],
5
- description: 'Update a training block with new content',
6
- operationId: 'patchTrainingBlock',
7
- requestBody: {
8
- required: true,
9
- content: {
10
- 'multipart/form-data': {
11
- schema: {
12
- type: 'object',
13
- properties: {
14
- documentationLink: {
15
- $ref: '#/components/schemas/TrainingBlock/properties/documentationLink',
16
- },
17
- videoLink: { $ref: '#/components/schemas/TrainingBlock/properties/videoLink' },
18
- exampleCode: { $ref: '#/components/schemas/TrainingBlock/properties/exampleCode' },
19
- title: { $ref: '#/components/schemas/TrainingBlock/properties/title' },
20
- externalResource: {
21
- $ref: '#/components/schemas/TrainingBlock/properties/externalResource',
22
- },
23
- },
24
- },
25
- },
26
- },
27
- },
28
- responses: { 200: { $ref: '#/components/schemas/TrainingBlock' } },
29
- security: [{ studio: [] }],
30
- },
31
- delete: {
32
- tags: ['main', 'training-block'],
33
- description: 'Delete a training block by Id.',
34
- operationId: 'deleteTrainingBlock',
35
- responses: {
36
- 204: { description: 'Deleted the specified training block.' },
37
- },
38
- security: [{ studio: [] }],
39
- },
40
- };
41
- //# sourceMappingURL=trainingBlockId.js.map
@@ -1,51 +0,0 @@
1
- export const pathItems = {
2
- parameters: [{ $ref: '#/components/parameters/trainingId' }],
3
- get: {
4
- tags: ['main', 'training', 'training-block'],
5
- description: 'Fetch all training blocks by training id',
6
- operationId: 'getTrainingBlocksByTrainingId',
7
- responses: {
8
- 200: {
9
- description: 'An array of all the training Blocks associated with a training.',
10
- content: {
11
- 'application/json': {
12
- schema: {
13
- type: 'array',
14
- items: { $ref: '#/components/schemas/TrainingBlock' },
15
- },
16
- },
17
- },
18
- },
19
- },
20
- security: [{ studio: [] }, {}],
21
- },
22
- post: {
23
- tags: ['main', 'training', 'training-block'],
24
- description: 'Create a new training block as a child of a training.',
25
- operationId: 'createTrainingBlock',
26
- requestBody: {
27
- required: true,
28
- content: {
29
- 'multipart/form-data': {
30
- schema: {
31
- type: 'object',
32
- properties: {
33
- documentationLink: {
34
- $ref: '#/components/schemas/TrainingBlock/properties/documentationLink',
35
- },
36
- videoLink: { $ref: '#/components/schemas/TrainingBlock/properties/videoLink' },
37
- exampleCode: { $ref: '#/components/schemas/TrainingBlock/properties/exampleCode' },
38
- title: { $ref: '#/components/schemas/TrainingBlock/properties/title' },
39
- externalResource: {
40
- $ref: '#/components/schemas/TrainingBlock/properties/externalResource',
41
- },
42
- },
43
- },
44
- },
45
- },
46
- },
47
- responses: { 201: { description: 'Created new training block successfully' } },
48
- security: [{ studio: [] }],
49
- },
50
- };
51
- //# sourceMappingURL=blocks.js.map
@@ -1,62 +0,0 @@
1
- export const pathItems = {
2
- parameters: [{ $ref: '#/components/parameters/trainingId' }],
3
- get: {
4
- tags: ['main', 'training', 'user'],
5
- description: 'Check if a user is enrolled in a training.',
6
- operationId: 'isCurrentUserEnrolledInTraining',
7
- responses: {
8
- 200: {
9
- description: 'A boolean returning whether a user is enrolled in a training',
10
- content: {
11
- 'application/json': {
12
- schema: {
13
- type: 'object',
14
- properties: {
15
- enrolled: {
16
- type: 'boolean',
17
- description: 'If a user is enrolled in a training',
18
- },
19
- completed: {
20
- type: 'boolean',
21
- description: 'If the training has been completed by the user.',
22
- },
23
- },
24
- },
25
- },
26
- },
27
- },
28
- },
29
- security: [{ studio: [] }],
30
- },
31
- post: {
32
- tags: ['main', 'training', 'user'],
33
- description: 'Enroll a user in a training.',
34
- operationId: 'enrollCurrentUserInTraining',
35
- responses: { 201: { description: 'Enrolled in the training successfully' } },
36
- security: [{ studio: [] }],
37
- },
38
- patch: {
39
- tags: ['main', 'training', 'user'],
40
- description: 'Edit an enrollment of a user in a training',
41
- operationId: 'setCurrentUserTrainingCompleted',
42
- requestBody: {
43
- required: true,
44
- content: {
45
- 'multipart/form-data': {
46
- schema: {
47
- type: 'object',
48
- properties: {
49
- completed: {
50
- type: 'boolean',
51
- description: 'If the training has been completed by the user.',
52
- },
53
- },
54
- },
55
- },
56
- },
57
- },
58
- responses: { 200: { description: 'Updated user training successfully.' } },
59
- security: [{ studio: [] }],
60
- },
61
- };
62
- //# sourceMappingURL=current.js.map
@@ -1,25 +0,0 @@
1
- export const pathItems = {
2
- parameters: [{ $ref: '#/components/parameters/trainingId' }],
3
- get: {
4
- tags: ['main', 'training', 'user'],
5
- description: 'Get a list of all users who have completed a training.',
6
- operationId: 'getTrainedUsers',
7
- responses: {
8
- 200: {
9
- description: 'A list of all the users who have completed a training.',
10
- content: {
11
- 'application/json': {
12
- schema: {
13
- type: 'array',
14
- items: {
15
- $ref: '#/components/schemas/User',
16
- },
17
- },
18
- },
19
- },
20
- },
21
- },
22
- security: [{ studio: [] }],
23
- },
24
- };
25
- //# sourceMappingURL=users.js.map
@@ -1,85 +0,0 @@
1
- export const pathItems = {
2
- parameters: [{ $ref: '#/components/parameters/trainingId' }],
3
- get: {
4
- tags: ['main', 'training'],
5
- description: 'Fetch a single training by id.',
6
- operationId: 'getTrainingById',
7
- responses: {
8
- 200: {
9
- description: 'Object representation of a training',
10
- content: {
11
- 'application/json': {
12
- schema: {
13
- $ref: '#/components/schemas/Training',
14
- },
15
- },
16
- },
17
- },
18
- },
19
- security: [{ studio: [] }, {}],
20
- },
21
- patch: {
22
- tags: ['main', 'training'],
23
- description: 'Fetch a single training by id.',
24
- operationId: 'patchTraining',
25
- requestBody: {
26
- required: true,
27
- content: {
28
- 'multipart/form-data': {
29
- schema: {
30
- description: 'Schema to be used for editing trainings.',
31
- properties: {
32
- id: {
33
- type: 'number',
34
- readOnly: true,
35
- minimum: 0,
36
- description: 'The id of the training, will be generated automatically by the system.',
37
- },
38
- title: {
39
- type: 'string',
40
- description: 'Title of the training.',
41
- },
42
- description: {
43
- type: 'string',
44
- description: 'A brief overview of the training.',
45
- },
46
- competence: {
47
- type: 'string',
48
- description: 'Competence tags for the training',
49
- },
50
- difficultyLevel: {
51
- type: 'number',
52
- description: 'Difficulty level between 1 and 5',
53
- minimum: 1,
54
- maximum: 5,
55
- },
56
- },
57
- },
58
- },
59
- },
60
- },
61
- responses: {
62
- 200: {
63
- description: 'Object representation of a training',
64
- content: {
65
- 'application/json': {
66
- schema: {
67
- $ref: '#/components/schemas/Training',
68
- },
69
- },
70
- },
71
- },
72
- },
73
- security: [{ studio: [] }],
74
- },
75
- delete: {
76
- tags: ['main', 'training'],
77
- description: 'Delete a training by Id.',
78
- operationId: 'deleteTraining',
79
- responses: {
80
- 204: { description: 'Deleted the specified training.' },
81
- },
82
- security: [{ studio: [] }],
83
- },
84
- };
85
- //# sourceMappingURL=trainingId.js.map
@@ -1,44 +0,0 @@
1
- export const pathItems = {
2
- get: {
3
- tags: ['main', 'training'],
4
- description: 'Fetch all trainings available',
5
- operationId: 'getTrainings',
6
- responses: {
7
- 200: {
8
- description: 'An array of all the available trainings.',
9
- content: {
10
- 'application/json': {
11
- schema: {
12
- type: 'array',
13
- items: { $ref: '#/components/schemas/Training' },
14
- },
15
- },
16
- },
17
- },
18
- },
19
- security: [{ studio: [] }, {}],
20
- },
21
- post: {
22
- tags: ['main', 'training'],
23
- description: '',
24
- operationId: 'createTraining',
25
- requestBody: {
26
- required: true,
27
- content: {
28
- 'application/json': {
29
- schema: {
30
- $ref: '#/components/schemas/Training',
31
- },
32
- },
33
- },
34
- },
35
- responses: {
36
- 201: {
37
- description: 'Created new training successfully',
38
- $ref: '#/components/schemas/Training',
39
- },
40
- },
41
- security: [{ studio: [] }],
42
- },
43
- };
44
- //# sourceMappingURL=trainings.js.map
@@ -1 +0,0 @@
1
- export {};