quickbase-js 0.1.0-beta.12 → 0.1.0-beta.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 (168) hide show
  1. package/README.md +48 -18
  2. package/dist/esm/quickbase.d.ts +13 -3
  3. package/dist/esm/quickbase.js +416 -49
  4. package/dist/esm/quickbase.js.map +1 -1
  5. package/dist/esm/quickbase.min.js +1 -1
  6. package/dist/esm/quickbase.min.js.map +1 -1
  7. package/dist/umd/quickbase.umd.js +416 -49
  8. package/dist/umd/quickbase.umd.js.map +1 -1
  9. package/dist/umd/quickbase.umd.min.js +1 -1
  10. package/dist/umd/quickbase.umd.min.js.map +1 -1
  11. package/package.json +11 -4
  12. package/CHANGELOG.md +0 -227
  13. package/build-common.js +0 -131
  14. package/build-esm.js +0 -71
  15. package/build-umd.js +0 -69
  16. package/docs/.vitepress/cache/deps/@theme_index.js +0 -275
  17. package/docs/.vitepress/cache/deps/@theme_index.js.map +0 -7
  18. package/docs/.vitepress/cache/deps/_metadata.json +0 -40
  19. package/docs/.vitepress/cache/deps/chunk-5A67QEFC.js +0 -12542
  20. package/docs/.vitepress/cache/deps/chunk-5A67QEFC.js.map +0 -7
  21. package/docs/.vitepress/cache/deps/chunk-7D4P4MMP.js +0 -9719
  22. package/docs/.vitepress/cache/deps/chunk-7D4P4MMP.js.map +0 -7
  23. package/docs/.vitepress/cache/deps/package.json +0 -3
  24. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +0 -4504
  25. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +0 -7
  26. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +0 -583
  27. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +0 -7
  28. package/docs/.vitepress/cache/deps/vue.js +0 -343
  29. package/docs/.vitepress/cache/deps/vue.js.map +0 -7
  30. package/docs/.vitepress/config.mts +0 -26
  31. package/docs/api-examples.md +0 -49
  32. package/docs/index.md +0 -59
  33. package/docs/markdown-examples.md +0 -85
  34. package/docs-data/api-docs.json +0 -4143
  35. package/examples/quicbase-jsCDN.html +0 -36
  36. package/examples/react.js +0 -48
  37. package/examples/vanillajs.html +0 -47
  38. package/index.md +0 -25
  39. package/open-api/fix-spec-main.ts +0 -133
  40. package/open-api/generate-unified-interface.ts +0 -104
  41. package/open-api/generateDocsJson.ts +0 -24
  42. package/open-api/output/quickbase-fixed.json +0 -11191
  43. package/open-api/post-process-generated.ts +0 -226
  44. package/open-api/regenerate-client.ts +0 -117
  45. package/open-api/schema/enhance-general.ts +0 -111
  46. package/open-api/schema/fix-arrays.ts +0 -68
  47. package/open-api/schema/tags/apps.ts +0 -90
  48. package/open-api/schema/tags/fields.ts +0 -471
  49. package/open-api/schema/tags/groups.ts +0 -51
  50. package/open-api/schema/tags/index.ts +0 -66
  51. package/open-api/schema/tags/records.ts +0 -115
  52. package/open-api/schema/tags/tables.ts +0 -211
  53. package/open-api/schema/tags/users.ts +0 -47
  54. package/open-api/types/spec.ts +0 -42
  55. package/open-api/utils/common.ts +0 -29
  56. package/open-api/utils/generateJsDoc.ts +0 -74
  57. package/open-api/utils/infer-schema.ts +0 -40
  58. package/open-api/utils/naming.ts +0 -10
  59. package/open-api/utils/sharedUtils.ts +0 -352
  60. package/playwright.config.ts +0 -37
  61. package/rollup.config.js +0 -114
  62. package/specs/QuickBase_RESTful_API_2025-03-04T06_22_39.725Z.json +0 -46878
  63. package/specs/split/apps.json +0 -1315
  64. package/specs/split/auth.json +0 -191
  65. package/specs/split/fields.json +0 -3869
  66. package/specs/split/records.json +0 -754
  67. package/specs/split/reports.json +0 -619
  68. package/specs/split/tables.json +0 -1605
  69. package/src/RateLimitError.ts +0 -12
  70. package/src/ThrottleBucket.ts +0 -77
  71. package/src/authorizationStrategy.ts +0 -310
  72. package/src/generated-unified/QuickbaseClient.ts +0 -1135
  73. package/src/generated-unified/missing-types-report.json +0 -3
  74. package/src/index.ts +0 -1
  75. package/src/invokeMethod.ts +0 -212
  76. package/src/quickbaseClient.ts +0 -199
  77. package/src/rateLimiter.ts +0 -30
  78. package/src/tokenCache.ts +0 -39
  79. package/src/utils.ts +0 -50
  80. package/tests/playwright/qb/auth/cacheSwitching.test.ts +0 -159
  81. package/tests/playwright/qb/auth/fetchTempToken401.test.ts +0 -219
  82. package/tests/playwright/qb/auth/getAppWithTempToken.test.ts +0 -162
  83. package/tests/playwright/qb/auth/getAppWithTempTokenConcurrency.test.ts +0 -208
  84. package/tests/playwright/qb/auth/getAppWithUserToken.test.ts +0 -153
  85. package/tests/playwright/qb/auth/getTempToken.test.ts +0 -152
  86. package/tests/playwright/qb/auth/tempTokenPrefetch.test.ts +0 -179
  87. package/tests/playwright/qb/auth/tempTokenRenewal.test.ts +0 -133
  88. package/tests/setup.ts +0 -53
  89. package/tests/vitest/qb/ThrottleBucket.test.ts +0 -77
  90. package/tests/vitest/qb/apps/copyApp.test.ts +0 -76
  91. package/tests/vitest/qb/apps/createApp.test.ts +0 -64
  92. package/tests/vitest/qb/apps/deleteApp.test.ts +0 -76
  93. package/tests/vitest/qb/apps/getApp.test.ts +0 -44
  94. package/tests/vitest/qb/apps/getAppEvents.test.ts +0 -67
  95. package/tests/vitest/qb/apps/updateApp.test.ts +0 -58
  96. package/tests/vitest/qb/auth/mockQuickbaseServer.ts +0 -60
  97. package/tests/vitest/qb/auth/retryUserToken401.test.ts +0 -73
  98. package/tests/vitest/qb/auth/ssoTokenConcurrency.test.ts +0 -68
  99. package/tests/vitest/qb/auth/ssoTokenIntegrationWithServer.test.ts +0 -65
  100. package/tests/vitest/qb/auth/userTokenConcurrency.test.ts +0 -63
  101. package/tests/vitest/qb/fields/createField.test.ts +0 -77
  102. package/tests/vitest/qb/fields/deleteFields.test.ts +0 -83
  103. package/tests/vitest/qb/fields/getField.test.ts +0 -85
  104. package/tests/vitest/qb/fields/getFieldUsage.test.ts +0 -82
  105. package/tests/vitest/qb/fields/getFields.test.ts +0 -232
  106. package/tests/vitest/qb/fields/getFieldsUsage.test.ts +0 -77
  107. package/tests/vitest/qb/fields/updateField.test.ts +0 -93
  108. package/tests/vitest/qb/formulas/runFormula.test.ts +0 -96
  109. package/tests/vitest/qb/index.ts +0 -29
  110. package/tests/vitest/qb/records/deleteRecords.test.ts +0 -110
  111. package/tests/vitest/qb/records/runQuery.test.ts +0 -146
  112. package/tests/vitest/qb/records/upsert.test.ts +0 -102
  113. package/tests/vitest/qb/tables/createRelationship.test.ts +0 -102
  114. package/tests/vitest/qb/tables/createTable.test.ts +0 -55
  115. package/tests/vitest/qb/tables/deleteRelationship.test.ts +0 -143
  116. package/tests/vitest/qb/tables/deleteTable.test.ts +0 -50
  117. package/tests/vitest/qb/tables/getAppTables.test.ts +0 -46
  118. package/tests/vitest/qb/tables/getRelationships.test.ts +0 -80
  119. package/tests/vitest/qb/tables/getTable.test.ts +0 -26
  120. package/tests/vitest/qb/tables/updateRelationship.test.ts +0 -250
  121. package/tests/vitest/qb/tables/updateTable.test.ts +0 -48
  122. package/tests/vitest/unit/ThrottleBucket.test.ts +0 -101
  123. package/tests/vitest/unit/apps/copyApp.test.ts +0 -581
  124. package/tests/vitest/unit/apps/createApp.test.ts +0 -186
  125. package/tests/vitest/unit/apps/deleteApp.test.ts +0 -216
  126. package/tests/vitest/unit/apps/getApp.test.ts +0 -128
  127. package/tests/vitest/unit/apps/getAppConcurrency.test.ts +0 -151
  128. package/tests/vitest/unit/apps/getAppEvents.test.ts +0 -193
  129. package/tests/vitest/unit/apps/updateApp.test.ts +0 -412
  130. package/tests/vitest/unit/auth/fetchTempToken401.test.ts +0 -81
  131. package/tests/vitest/unit/auth/getTempToken.test.ts +0 -119
  132. package/tests/vitest/unit/auth/retryTempToken401.test.ts +0 -95
  133. package/tests/vitest/unit/auth/retryTempTokenMaxRetries.test.ts +0 -206
  134. package/tests/vitest/unit/auth/retryUserToken401.test.ts +0 -69
  135. package/tests/vitest/unit/auth/ssoTokenRefresh.test.ts +0 -325
  136. package/tests/vitest/unit/auth/userTokenConcurrency.test.ts +0 -62
  137. package/tests/vitest/unit/fields/createField.test.ts +0 -451
  138. package/tests/vitest/unit/fields/deleteFields.test.ts +0 -141
  139. package/tests/vitest/unit/fields/getField.test.ts +0 -189
  140. package/tests/vitest/unit/fields/getFieldUsage.test.ts +0 -180
  141. package/tests/vitest/unit/fields/getFields.test.ts +0 -122
  142. package/tests/vitest/unit/fields/getFieldsUsage.test.ts +0 -160
  143. package/tests/vitest/unit/fields/updateField.test.ts +0 -285
  144. package/tests/vitest/unit/formulas/runFormula.test.ts +0 -205
  145. package/tests/vitest/unit/index.ts +0 -34
  146. package/tests/vitest/unit/quickbaseClientHttpMethods.test.ts +0 -139
  147. package/tests/vitest/unit/rateLimit.test.ts +0 -191
  148. package/tests/vitest/unit/records/deleteRecords.test.ts +0 -112
  149. package/tests/vitest/unit/records/runQuery.test.ts +0 -102
  150. package/tests/vitest/unit/records/upsert.test.ts +0 -234
  151. package/tests/vitest/unit/tables/createRelationship.test.ts +0 -212
  152. package/tests/vitest/unit/tables/createTable.test.ts +0 -70
  153. package/tests/vitest/unit/tables/deleteRelationship.test.ts +0 -97
  154. package/tests/vitest/unit/tables/deleteTable.test.ts +0 -77
  155. package/tests/vitest/unit/tables/getAppTables.test.ts +0 -85
  156. package/tests/vitest/unit/tables/getRelationships.test.ts +0 -259
  157. package/tests/vitest/unit/tables/getTable.test.ts +0 -233
  158. package/tests/vitest/unit/tables/updateRelationship.test.ts +0 -307
  159. package/tests/vitest/unit/tables/updateTable.test.ts +0 -80
  160. package/tests/vitest/unit/tokenLifespan.test.ts +0 -204
  161. package/tests/vitest/unit/umd.test.ts +0 -8
  162. package/tools/log-gen.ts +0 -251
  163. package/tools/log-gen.yaml +0 -4829
  164. package/tools/openapi-jars/openapi-generator-cli-7.12.0.jar +0 -0
  165. package/tsconfig.build.json +0 -17
  166. package/tsconfig.json +0 -32
  167. package/versionrc.json +0 -9
  168. package/vitest.config.ts +0 -27
@@ -1,471 +0,0 @@
1
- // schema/tags/fields.ts
2
- import { Operation, Parameter, Spec } from "../../types/spec.ts";
3
- import { normalizeDefinitionName } from "../../utils/naming.ts";
4
-
5
- export function enhanceFields(
6
- spec: Spec,
7
- pathKey: string,
8
- method: string,
9
- operation: Operation
10
- ): void {
11
- const opId =
12
- operation.operationId || `${method}${pathKey.replace(/\W/g, "")}`;
13
- if (operation.parameters && operation.tags?.includes("Fields")) {
14
- operation.parameters.forEach((param: Parameter) => {
15
- if (param.in === "body") {
16
- if (!param.schema) param.schema = {};
17
- let requestName =
18
- param.schema.$ref?.split("/").pop() || `${opId}Request`;
19
- requestName = normalizeDefinitionName(requestName);
20
-
21
- if (
22
- !spec.definitions[requestName] ||
23
- !spec.definitions[requestName].type ||
24
- Object.keys(spec.definitions[requestName]?.properties || {})
25
- .length === 0
26
- ) {
27
- console.log(
28
- `Defining schema for ${requestName} in ${pathKey}(${method})`
29
- );
30
- let properties;
31
- let requiredFields: string[];
32
-
33
- if (method === "delete") {
34
- // DELETE /fields (deleteFields)
35
- properties = {
36
- fieldIds: { type: "array", items: { type: "integer" } },
37
- };
38
- requiredFields = ["fieldIds"];
39
- } else {
40
- // Common properties for createField and updateField
41
- properties = {
42
- label: { type: "string", description: "The label of the field" },
43
- fieldType: {
44
- type: "string",
45
- description: "The type of the field",
46
- enum: [
47
- "text",
48
- "text-multiple-choice",
49
- "text-multi-line",
50
- "rich-text",
51
- "numeric",
52
- "currency",
53
- "percent",
54
- "rating",
55
- "date",
56
- "date-time",
57
- "time-of-day",
58
- "duration",
59
- "checkbox",
60
- "user",
61
- "multi-user",
62
- "address",
63
- "email",
64
- "phone",
65
- "url",
66
- "file",
67
- "record-id",
68
- ],
69
- },
70
- fieldHelp: {
71
- type: "string",
72
- description: "Help text for the field",
73
- nullable: true,
74
- },
75
- addToForms: {
76
- type: "boolean",
77
- description: "Whether to add the field to forms",
78
- nullable: true,
79
- },
80
- permissions: {
81
- anyOf: [
82
- {
83
- type: "array",
84
- items: { $ref: "#/definitions/Permission" },
85
- },
86
- { type: "null" },
87
- ],
88
- description: "Custom permissions for the field",
89
- },
90
- required: {
91
- type: "boolean",
92
- description: "Whether the field is required",
93
- nullable: true,
94
- },
95
- unique: {
96
- type: "boolean",
97
- description: "Whether the field must have unique values",
98
- nullable: true,
99
- },
100
- noWrap: {
101
- type: "boolean",
102
- description: "Whether text wrapping is disabled",
103
- nullable: true,
104
- },
105
- bold: {
106
- type: "boolean",
107
- description: "Whether the field is bolded",
108
- nullable: true,
109
- },
110
- appearsByDefault: {
111
- type: "boolean",
112
- description: "Whether the field appears by default in reports",
113
- nullable: true,
114
- },
115
- findEnabled: {
116
- type: "boolean",
117
- description: "Whether the field is searchable",
118
- nullable: true,
119
- },
120
- doesDataCopy: {
121
- type: "boolean",
122
- description: "Whether the field copies data",
123
- nullable: true,
124
- },
125
- audited: {
126
- type: "boolean",
127
- description: "Whether changes to the field are audited",
128
- nullable: true,
129
- },
130
- properties: {
131
- type: "object",
132
- description: "Specific field properties",
133
- properties: {
134
- numLines: {
135
- type: "integer",
136
- description:
137
- "The number of lines shown in QuickBase for this text field",
138
- },
139
- maxLength: {
140
- type: "integer",
141
- description:
142
- "The maximum number of characters allowed for entry",
143
- },
144
- appendOnly: {
145
- type: "boolean",
146
- description: "Whether this field is append-only",
147
- },
148
- sortAsGiven: {
149
- type: "boolean",
150
- description:
151
- "Indicates if the listed entries sort as entered vs alphabetically",
152
- },
153
- allowMentions: {
154
- type: "boolean",
155
- description:
156
- "If someone can @mention users in the rich text field",
157
- },
158
- comments: {
159
- type: "string",
160
- description:
161
- "The comments entered on the field properties by an administrator",
162
- },
163
- doesTotal: {
164
- type: "boolean",
165
- description:
166
- "Whether this field totals in reports within the product",
167
- },
168
- autoSave: {
169
- type: "boolean",
170
- description: "Whether the link field will auto save",
171
- },
172
- defaultValueLuid: {
173
- type: "integer",
174
- description: "Default user id value",
175
- },
176
- useI18NFormat: {
177
- type: "boolean",
178
- description:
179
- "Whether phone numbers should be in E.164 standard international format",
180
- },
181
- maxVersions: {
182
- type: "integer",
183
- description:
184
- "The maximum number of versions configured for a file attachment",
185
- },
186
- format: {
187
- type: "integer",
188
- description: "The format to display time",
189
- },
190
- carryChoices: {
191
- type: "boolean",
192
- description:
193
- "Whether the field should carry its multiple choice fields when copied",
194
- },
195
- linkText: {
196
- type: "string",
197
- description:
198
- "The configured text value that replaces the URL users see",
199
- },
200
- parentFieldId: {
201
- type: "integer",
202
- description:
203
- "The id of the parent composite field, when applicable",
204
- },
205
- displayTimezone: {
206
- type: "boolean",
207
- description:
208
- "Indicates whether to display the timezone within the product",
209
- },
210
- summaryTargetFieldId: {
211
- type: "integer",
212
- description:
213
- "The id of the field used to aggregate values from the child",
214
- },
215
- allowNewChoices: {
216
- type: "boolean",
217
- description:
218
- "Indicates if users can add new choices to a selection list",
219
- },
220
- defaultToday: {
221
- type: "boolean",
222
- description:
223
- "Indicates if the field value is defaulted today for new records",
224
- },
225
- units: {
226
- type: "string",
227
- description: "The units label",
228
- },
229
- openTargetIn: {
230
- type: "string",
231
- enum: ["sameWindow", "newWindow", "popup"],
232
- description:
233
- "Indicates which target the URL should open in when clicked",
234
- },
235
- lookupTargetFieldId: {
236
- type: "integer",
237
- description:
238
- "The id of the field that is the target on the parent table for this lookup",
239
- },
240
- summaryFunction: {
241
- type: "string",
242
- enum: [
243
- "AVG",
244
- "SUM",
245
- "MAX",
246
- "MIN",
247
- "STD-DEV",
248
- "COUNT",
249
- "COMBINED-TEXT",
250
- "COMBINED-USER",
251
- "DISTINCT-COUNT",
252
- ],
253
- description: "The accumulation type for the summary field",
254
- },
255
- sourceFieldId: {
256
- type: "integer",
257
- description: "The id of the source field",
258
- },
259
- doesAverage: {
260
- type: "boolean",
261
- description:
262
- "Whether this field averages in reports within the product",
263
- },
264
- formula: {
265
- type: "string",
266
- description:
267
- "The formula of the field as configured in QuickBase",
268
- },
269
- decimalPlaces: {
270
- type: "integer",
271
- description:
272
- "The number of decimal places displayed in the product",
273
- },
274
- defaultCountryCode: {
275
- type: "string",
276
- description:
277
- "Controls the default country shown on international phone widgets",
278
- },
279
- displayMonth: {
280
- type: "string",
281
- description: "How to display months",
282
- },
283
- seeVersions: {
284
- type: "boolean",
285
- description:
286
- "Indicates if users can see other versions of a file attachment",
287
- },
288
- defaultKind: {
289
- type: "string",
290
- description: "The user default type",
291
- },
292
- displayEmail: {
293
- type: "string",
294
- description: "How the email is displayed",
295
- },
296
- coverText: {
297
- type: "string",
298
- description:
299
- "Alternate user-friendly text for displaying a link",
300
- },
301
- currencySymbol: {
302
- type: "string",
303
- description:
304
- "The currency symbol used when displaying field values",
305
- },
306
- summaryQuery: {
307
- type: "string",
308
- description: "The summary query",
309
- },
310
- targetFieldId: {
311
- type: "integer",
312
- description: "The id of the target field",
313
- },
314
- displayUser: {
315
- type: "string",
316
- description: "The configured option for how users display",
317
- },
318
- blankIsZero: {
319
- type: "boolean",
320
- description:
321
- "Whether a blank value is treated as 0 in calculations",
322
- },
323
- exact: {
324
- type: "boolean",
325
- description:
326
- "Whether an exact match is required for a report link",
327
- },
328
- defaultDomain: {
329
- type: "string",
330
- description: "Default email domain",
331
- },
332
- defaultValue: {
333
- type: "string",
334
- description: "The default value configured for a field",
335
- },
336
- abbreviate: {
337
- type: "boolean",
338
- description:
339
- "Don't show the URL protocol when showing the URL",
340
- },
341
- numberFormat: {
342
- type: "integer",
343
- description:
344
- "The format used for displaying numeric values",
345
- },
346
- targetTableName: {
347
- type: "string",
348
- description: "The field's target table name",
349
- },
350
- appearsAs: {
351
- type: "string",
352
- description:
353
- "The link text; if empty, the URL will be used",
354
- },
355
- width: {
356
- type: "integer",
357
- description: "The field's HTML input width in the product",
358
- },
359
- currencyFormat: {
360
- type: "string",
361
- enum: ["left", "right", "middle"],
362
- description:
363
- "The currency format used when displaying field values",
364
- },
365
- displayDayOfWeek: {
366
- type: "boolean",
367
- description:
368
- "Indicates whether to display the day of the week",
369
- },
370
- summaryReferenceFieldId: {
371
- type: "integer",
372
- description:
373
- "The id of the field that is the reference in the relationship",
374
- },
375
- commaStart: {
376
- type: "integer",
377
- description: "The number of digits before commas display",
378
- },
379
- choices: {
380
- type: "array",
381
- items: { type: "string" },
382
- description:
383
- "An array of entries that exist for a field offering choices",
384
- },
385
- targetTableId: {
386
- type: "string",
387
- description: "The id of the target table",
388
- },
389
- displayRelative: {
390
- type: "boolean",
391
- description: "Whether to display time as relative",
392
- },
393
- compositeFields: {
394
- type: "array",
395
- items: { type: "object", additionalProperties: true },
396
- description:
397
- "An array of fields that make up a composite field (e.g., address)",
398
- },
399
- displayCheckboxAsText: {
400
- type: "boolean",
401
- description:
402
- "Indicates whether checkbox values are shown as text in reports",
403
- },
404
- versionMode: {
405
- type: "string",
406
- enum: ["keepallversions", "keeplastversions"],
407
- description: "Version modes for files",
408
- },
409
- snapFieldId: {
410
- type: "integer",
411
- description: "The id of the field used to snapshot values",
412
- },
413
- hours24: {
414
- type: "boolean",
415
- description:
416
- "Indicates whether to display time in 24-hour format",
417
- },
418
- sortAlpha: {
419
- type: "boolean",
420
- description:
421
- "Whether to sort alphabetically (default is by record ID)",
422
- },
423
- hasExtension: {
424
- type: "boolean",
425
- description: "Whether this field has a phone extension",
426
- },
427
- useNewWindow: {
428
- type: "boolean",
429
- description:
430
- "Indicates if the file should open a new window when clicked",
431
- },
432
- displayAsLink: {
433
- type: "boolean",
434
- description:
435
- "Indicates if the field should be shown as a hyperlink",
436
- },
437
- lookupReferenceFieldId: {
438
- type: "integer",
439
- description:
440
- "The id of the field that is the reference for this lookup",
441
- },
442
- },
443
- nullable: true,
444
- },
445
- };
446
-
447
- // Adjust required fields based on operation
448
- if (pathKey.includes("{fieldId}") && method === "post") {
449
- // UpdateField (POST /fields/{fieldId})
450
- requiredFields = ["label"]; // fieldType is not allowed in updates
451
- } else {
452
- // CreateField (POST /fields)
453
- requiredFields = ["label", "fieldType"];
454
- }
455
- }
456
-
457
- spec.definitions[requestName] = {
458
- type: "object",
459
- properties,
460
- required: requiredFields,
461
- description: operation.summary || `Request body for ${opId}`,
462
- };
463
- }
464
- param.schema = { $ref: `#/definitions/${requestName}` };
465
- console.log(
466
- `Ensured ${requestName} in definitions for ${pathKey}(${method})`
467
- );
468
- }
469
- });
470
- }
471
- }
@@ -1,51 +0,0 @@
1
- // schema/tags/groups.ts
2
- import { Operation, Parameter, Spec } from "../../types/spec.ts";
3
- import { normalizeDefinitionName } from "../../utils/naming.ts";
4
-
5
- export function enhanceGroups(
6
- spec: Spec,
7
- pathKey: string,
8
- method: string,
9
- operation: Operation
10
- ): void {
11
- const opId =
12
- operation.operationId || `${method}${pathKey.replace(/\W/g, "")}`;
13
- if (
14
- operation.parameters &&
15
- operation.tags?.includes("Groups") &&
16
- operation.summary?.toLowerCase().includes("subgroup")
17
- ) {
18
- operation.parameters.forEach((param: Parameter) => {
19
- if (param.in === "body") {
20
- if (!param.schema) param.schema = {};
21
- let requestName =
22
- param.schema.$ref?.split("/").pop() || `${opId}Request`;
23
- requestName = normalizeDefinitionName(requestName);
24
-
25
- if (
26
- !spec.definitions[requestName] ||
27
- !spec.definitions[requestName].type ||
28
- Object.keys(spec.definitions[requestName]?.properties || {})
29
- .length === 0
30
- ) {
31
- console.log(
32
- `Defining schema for ${requestName} in ${pathKey}(${method})`
33
- );
34
- const properties = {
35
- groupIds: { type: "array", items: { type: "string" } },
36
- };
37
- spec.definitions[requestName] = {
38
- type: "object",
39
- properties,
40
- required: Object.keys(properties),
41
- description: operation.summary || `Request body for ${opId}`,
42
- };
43
- }
44
- param.schema = { $ref: `#/definitions/${requestName}` };
45
- console.log(
46
- `Ensured ${requestName} in definitions for ${pathKey}(${method})`
47
- );
48
- }
49
- });
50
- }
51
- }
@@ -1,66 +0,0 @@
1
- // open-api/schema/tags/index.ts
2
- import { Operation, Parameter, Spec } from "../../types/spec.ts";
3
- import { normalizeDefinitionName } from "../../utils/naming.ts";
4
- import { enhanceUsers } from "./users.ts";
5
- import { enhanceGroups } from "./groups.ts";
6
- import { enhanceRecords } from "./records.ts";
7
- import { enhanceApps } from "./apps.ts";
8
- import { enhanceFields } from "./fields.ts";
9
- import { enhanceTables } from "./tables.ts";
10
-
11
- export function enhanceTags(spec: Spec): void {
12
- console.log("enhanceTags version: 2025-03-16-fix-applied"); // Confirmation log
13
-
14
- for (const pathKey in spec.paths) {
15
- for (const method in spec.paths[pathKey]) {
16
- const operation: Operation = spec.paths[pathKey][method];
17
- const opId =
18
- operation.operationId || `${method}${pathKey.replace(/\W/g, "")}`;
19
-
20
- if (operation.parameters) {
21
- operation.parameters.forEach((param: Parameter) => {
22
- if (param.in === "body") {
23
- if (!param.schema) param.schema = {};
24
- let requestName =
25
- param.schema.$ref?.split("/").pop() || `${opId}Request`;
26
- requestName = normalizeDefinitionName(requestName);
27
-
28
- if (spec.definitions[requestName]?.type === "array") {
29
- console.log(
30
- `Wrapping array schema for ${requestName} in ${pathKey}(${method})`
31
- );
32
- const arraySchema = spec.definitions[requestName];
33
- let wrapperPropName = operation.tags?.includes("Users")
34
- ? "userIds"
35
- : "items";
36
- if (
37
- operation.tags?.includes("Groups") &&
38
- operation.summary?.toLowerCase().includes("subgroup")
39
- ) {
40
- wrapperPropName = "groupIds";
41
- }
42
- spec.definitions[requestName] = {
43
- type: "object",
44
- properties: { [wrapperPropName]: arraySchema },
45
- required: arraySchema.minItems > 0 ? [wrapperPropName] : [],
46
- description:
47
- arraySchema.description || `Request body for ${opId}`,
48
- };
49
- param.schema = { $ref: `#/definitions/${requestName}` };
50
- console.log(
51
- `Ensured ${requestName} in definitions for ${pathKey}(${method})`
52
- );
53
- }
54
- }
55
- });
56
- }
57
-
58
- enhanceUsers(spec, pathKey, method, operation);
59
- enhanceGroups(spec, pathKey, method, operation);
60
- enhanceRecords(spec, pathKey, method, operation);
61
- enhanceApps(spec, pathKey, method, operation);
62
- enhanceFields(spec, pathKey, method, operation);
63
- enhanceTables(spec, pathKey, method, operation);
64
- }
65
- }
66
- }