quickbase-js 0.1.0-beta.10

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 (165) hide show
  1. package/CHANGELOG.md +211 -0
  2. package/LICENSE +21 -0
  3. package/README.md +179 -0
  4. package/api-examples.md +49 -0
  5. package/build-common.js +131 -0
  6. package/build-esm.js +71 -0
  7. package/build-umd.js +69 -0
  8. package/dist/esm/quickbase.d.ts +8081 -0
  9. package/dist/esm/quickbase.js +7928 -0
  10. package/dist/esm/quickbase.js.map +1 -0
  11. package/dist/esm/quickbase.min.js +2 -0
  12. package/dist/esm/quickbase.min.js.map +1 -0
  13. package/dist/umd/quickbase.umd.js +8504 -0
  14. package/dist/umd/quickbase.umd.js.map +1 -0
  15. package/dist/umd/quickbase.umd.min.js +2 -0
  16. package/dist/umd/quickbase.umd.min.js.map +1 -0
  17. package/docs/.vitepress/cache/deps/@theme_index.js +275 -0
  18. package/docs/.vitepress/cache/deps/@theme_index.js.map +7 -0
  19. package/docs/.vitepress/cache/deps/_metadata.json +40 -0
  20. package/docs/.vitepress/cache/deps/chunk-5A67QEFC.js +12542 -0
  21. package/docs/.vitepress/cache/deps/chunk-5A67QEFC.js.map +7 -0
  22. package/docs/.vitepress/cache/deps/chunk-7D4P4MMP.js +9719 -0
  23. package/docs/.vitepress/cache/deps/chunk-7D4P4MMP.js.map +7 -0
  24. package/docs/.vitepress/cache/deps/package.json +3 -0
  25. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js +4504 -0
  26. package/docs/.vitepress/cache/deps/vitepress___@vue_devtools-api.js.map +7 -0
  27. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js +583 -0
  28. package/docs/.vitepress/cache/deps/vitepress___@vueuse_core.js.map +7 -0
  29. package/docs/.vitepress/cache/deps/vue.js +343 -0
  30. package/docs/.vitepress/cache/deps/vue.js.map +7 -0
  31. package/docs/.vitepress/config.mts +26 -0
  32. package/docs/api-examples.md +49 -0
  33. package/docs/index.md +59 -0
  34. package/docs/markdown-examples.md +85 -0
  35. package/docs-data/api-docs.json +4143 -0
  36. package/examples/quicbase-jsCDN.html +36 -0
  37. package/examples/react.js +48 -0
  38. package/examples/vanillajs.html +47 -0
  39. package/index.md +25 -0
  40. package/markdown-examples.md +85 -0
  41. package/open-api/fix-spec-main.ts +133 -0
  42. package/open-api/generate-unified-interface.ts +104 -0
  43. package/open-api/generateDocsJson.ts +24 -0
  44. package/open-api/output/quickbase-fixed.json +11191 -0
  45. package/open-api/post-process-generated.ts +226 -0
  46. package/open-api/regenerate-client.ts +117 -0
  47. package/open-api/schema/enhance-general.ts +111 -0
  48. package/open-api/schema/fix-arrays.ts +68 -0
  49. package/open-api/schema/tags/apps.ts +90 -0
  50. package/open-api/schema/tags/fields.ts +471 -0
  51. package/open-api/schema/tags/groups.ts +51 -0
  52. package/open-api/schema/tags/index.ts +66 -0
  53. package/open-api/schema/tags/records.ts +115 -0
  54. package/open-api/schema/tags/tables.ts +211 -0
  55. package/open-api/schema/tags/users.ts +47 -0
  56. package/open-api/types/spec.ts +42 -0
  57. package/open-api/utils/common.ts +29 -0
  58. package/open-api/utils/generateJsDoc.ts +74 -0
  59. package/open-api/utils/infer-schema.ts +40 -0
  60. package/open-api/utils/naming.ts +10 -0
  61. package/open-api/utils/sharedUtils.ts +352 -0
  62. package/package.json +96 -0
  63. package/playwright.config.ts +37 -0
  64. package/rollup.config.js +114 -0
  65. package/specs/QuickBase_RESTful_API_2025-03-04T06_22_39.725Z.json +46878 -0
  66. package/specs/split/apps.json +1315 -0
  67. package/specs/split/auth.json +191 -0
  68. package/specs/split/fields.json +3869 -0
  69. package/specs/split/records.json +754 -0
  70. package/specs/split/reports.json +619 -0
  71. package/specs/split/tables.json +1605 -0
  72. package/src/RateLimitError.ts +12 -0
  73. package/src/ThrottleBucket.ts +41 -0
  74. package/src/authorizationStrategy.ts +283 -0
  75. package/src/generated-unified/QuickbaseClient.ts +1135 -0
  76. package/src/generated-unified/missing-types-report.json +3 -0
  77. package/src/index.ts +1 -0
  78. package/src/invokeMethod.ts +245 -0
  79. package/src/quickbaseClient.ts +194 -0
  80. package/src/rateLimiter.ts +25 -0
  81. package/src/tokenCache.ts +35 -0
  82. package/src/utils.ts +50 -0
  83. package/tests/playwright/qb/auth/cacheSwitching.test.ts +159 -0
  84. package/tests/playwright/qb/auth/fetchTempToken401.test.ts +219 -0
  85. package/tests/playwright/qb/auth/getAppWithTempToken.test.ts +162 -0
  86. package/tests/playwright/qb/auth/getAppWithUserToken.test.ts +153 -0
  87. package/tests/playwright/qb/auth/getTempToken.test.ts +152 -0
  88. package/tests/playwright/qb/auth/tempTokenPrefetch.test.ts +179 -0
  89. package/tests/playwright/qb/auth/tempTokenRenewal.test.ts +133 -0
  90. package/tests/setup.ts +53 -0
  91. package/tests/vitest/qb/apps/copyApp.test.ts +76 -0
  92. package/tests/vitest/qb/apps/createApp.test.ts +64 -0
  93. package/tests/vitest/qb/apps/deleteApp.test.ts +76 -0
  94. package/tests/vitest/qb/apps/getApp.test.ts +44 -0
  95. package/tests/vitest/qb/apps/getAppEvents.test.ts +67 -0
  96. package/tests/vitest/qb/apps/updateApp.test.ts +58 -0
  97. package/tests/vitest/qb/auth/mockQuickbaseServer.ts +60 -0
  98. package/tests/vitest/qb/auth/retryUserToken401.test.ts +73 -0
  99. package/tests/vitest/qb/auth/ssoTokenIntegrationWithServer.test.ts +65 -0
  100. package/tests/vitest/qb/fields/createField.test.ts +77 -0
  101. package/tests/vitest/qb/fields/deleteFields.test.ts +83 -0
  102. package/tests/vitest/qb/fields/getField.test.ts +85 -0
  103. package/tests/vitest/qb/fields/getFieldUsage.test.ts +82 -0
  104. package/tests/vitest/qb/fields/getFields.test.ts +232 -0
  105. package/tests/vitest/qb/fields/getFieldsUsage.test.ts +77 -0
  106. package/tests/vitest/qb/fields/updateField.test.ts +93 -0
  107. package/tests/vitest/qb/formulas/runFormula.test.ts +96 -0
  108. package/tests/vitest/qb/index.ts +29 -0
  109. package/tests/vitest/qb/records/deleteRecords.test.ts +110 -0
  110. package/tests/vitest/qb/records/runQuery.test.ts +146 -0
  111. package/tests/vitest/qb/records/upsert.test.ts +102 -0
  112. package/tests/vitest/qb/tables/createRelationship.test.ts +102 -0
  113. package/tests/vitest/qb/tables/createTable.test.ts +55 -0
  114. package/tests/vitest/qb/tables/deleteRelationship.test.ts +143 -0
  115. package/tests/vitest/qb/tables/deleteTable.test.ts +50 -0
  116. package/tests/vitest/qb/tables/getAppTables.test.ts +46 -0
  117. package/tests/vitest/qb/tables/getRelationships.test.ts +80 -0
  118. package/tests/vitest/qb/tables/getTable.test.ts +26 -0
  119. package/tests/vitest/qb/tables/updateRelationship.test.ts +250 -0
  120. package/tests/vitest/qb/tables/updateTable.test.ts +48 -0
  121. package/tests/vitest/unit/ThrottleBucket.test.ts +95 -0
  122. package/tests/vitest/unit/apps/copyApp.test.ts +581 -0
  123. package/tests/vitest/unit/apps/createApp.test.ts +186 -0
  124. package/tests/vitest/unit/apps/deleteApp.test.ts +216 -0
  125. package/tests/vitest/unit/apps/getApp.test.ts +128 -0
  126. package/tests/vitest/unit/apps/getAppEvents.test.ts +193 -0
  127. package/tests/vitest/unit/apps/updateApp.test.ts +412 -0
  128. package/tests/vitest/unit/auth/fetchTempToken401.test.ts +63 -0
  129. package/tests/vitest/unit/auth/getTempToken.test.ts +119 -0
  130. package/tests/vitest/unit/auth/retryTempToken401.test.ts +95 -0
  131. package/tests/vitest/unit/auth/retryTempTokenMaxRetries.test.ts +206 -0
  132. package/tests/vitest/unit/auth/retryUserToken401.test.ts +69 -0
  133. package/tests/vitest/unit/auth/ssoTokenRefresh.test.ts +325 -0
  134. package/tests/vitest/unit/fields/createField.test.ts +451 -0
  135. package/tests/vitest/unit/fields/deleteFields.test.ts +141 -0
  136. package/tests/vitest/unit/fields/getField.test.ts +189 -0
  137. package/tests/vitest/unit/fields/getFieldUsage.test.ts +180 -0
  138. package/tests/vitest/unit/fields/getFields.test.ts +122 -0
  139. package/tests/vitest/unit/fields/getFieldsUsage.test.ts +160 -0
  140. package/tests/vitest/unit/fields/updateField.test.ts +285 -0
  141. package/tests/vitest/unit/formulas/runFormula.test.ts +205 -0
  142. package/tests/vitest/unit/index.ts +34 -0
  143. package/tests/vitest/unit/quickbaseClientHttpMethods.test.ts +139 -0
  144. package/tests/vitest/unit/rateLimit.test.ts +191 -0
  145. package/tests/vitest/unit/records/deleteRecords.test.ts +112 -0
  146. package/tests/vitest/unit/records/runQuery.test.ts +102 -0
  147. package/tests/vitest/unit/records/upsert.test.ts +234 -0
  148. package/tests/vitest/unit/tables/createRelationship.test.ts +212 -0
  149. package/tests/vitest/unit/tables/createTable.test.ts +70 -0
  150. package/tests/vitest/unit/tables/deleteRelationship.test.ts +97 -0
  151. package/tests/vitest/unit/tables/deleteTable.test.ts +77 -0
  152. package/tests/vitest/unit/tables/getAppTables.test.ts +85 -0
  153. package/tests/vitest/unit/tables/getRelationships.test.ts +259 -0
  154. package/tests/vitest/unit/tables/getTable.test.ts +233 -0
  155. package/tests/vitest/unit/tables/updateRelationship.test.ts +307 -0
  156. package/tests/vitest/unit/tables/updateTable.test.ts +80 -0
  157. package/tests/vitest/unit/tokenLifespan.test.ts +204 -0
  158. package/tests/vitest/unit/umd.test.ts +8 -0
  159. package/tools/log-gen.ts +251 -0
  160. package/tools/log-gen.yaml +4777 -0
  161. package/tools/openapi-jars/openapi-generator-cli-7.12.0.jar +0 -0
  162. package/tsconfig.build.json +17 -0
  163. package/tsconfig.json +32 -0
  164. package/versionrc.json +9 -0
  165. package/vitest.config.ts +27 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,211 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
+
5
+ ## [0.1.0-beta.10](https://github.com/DrewBradfordXYZ/quickbase-js/compare/v0.1.0-beta.9...v0.1.0-beta.10) (2025-03-22)
6
+
7
+
8
+ ### Features
9
+
10
+ * add descriptions to post-processed openapi files ([a607817](https://github.com/DrewBradfordXYZ/quickbase-js/commit/a607817156fb265f5198fc3b21189e7205f08c54))
11
+ * Add VitePress docs build to docs-dist for GitHub Pages ([db84f94](https://github.com/DrewBradfordXYZ/quickbase-js/commit/db84f946affe2111de5d8bc339c17dd66db6dddb))
12
+ * Add VitePress site ([92b941c](https://github.com/DrewBradfordXYZ/quickbase-js/commit/92b941cfba75f482dc542c948d8a48ad6338ff8f))
13
+ * align jsDoc parsing with the richness of the vitepress's DocsJson ([1059bbb](https://github.com/DrewBradfordXYZ/quickbase-js/commit/1059bbb72274416a8825e663ee52abac5d17d585))
14
+ * Configure GitHub Action to deploy VitePress from docs/.vitepress/dist ([90c1507](https://github.com/DrewBradfordXYZ/quickbase-js/commit/90c1507cf1a5642ec6197fa36b5f498e67da543d))
15
+ * extractHttpMethod, a more targeted approach to getting the HTTP method ([d64bda3](https://github.com/DrewBradfordXYZ/quickbase-js/commit/d64bda3dbf511bf74522de4362e62281f375bd01))
16
+ * generate-unified-interface.ts and generateDocsJson.ts are functionally separated ([030c62d](https://github.com/DrewBradfordXYZ/quickbase-js/commit/030c62dd73d489eca893e6fa745f6361bae77857))
17
+ * generate-unified-interface.ts and generateDocsJson.ts are separated and DRY using sharedUtils.ts ([6426fda](https://github.com/DrewBradfordXYZ/quickbase-js/commit/6426fda8c28fe3f4922a6341d6edf44330b82526))
18
+ * ItemsInner has basic properties ([24a5631](https://github.com/DrewBradfordXYZ/quickbase-js/commit/24a56315c1211aa07ae68e7a2760d49b1628669c))
19
+ * jsDoc and docsJson uses the new post-process structure ([f87572d](https://github.com/DrewBradfordXYZ/quickbase-js/commit/f87572ddc25e31013abb50463b1362a881a759b3))
20
+ * jsdoc styling ([fd41d3d](https://github.com/DrewBradfordXYZ/quickbase-js/commit/fd41d3de26b5f48c3926c7813eeeb564746be816))
21
+ * make open-api files more dry with common utils and tweak jsdoc removing repitive descriptions for nested properties ([ff98f84](https://github.com/DrewBradfordXYZ/quickbase-js/commit/ff98f845ddda44faa3a0bf6a0a68bff3d0d41188))
22
+ * refactor fetchTempToken into TempTokenStrategy ([8203833](https://github.com/DrewBradfordXYZ/quickbase-js/commit/8203833b0126e35d5a11596dbf5ce13c36db66f7))
23
+ * refactored out generateDocsJson.ts ([0973f0f](https://github.com/DrewBradfordXYZ/quickbase-js/commit/0973f0fa4d2d2547b47e11e06cda23b628bd52ec))
24
+ * wrapTopLevelArrays fixing empty some 200 return type files ([f26e047](https://github.com/DrewBradfordXYZ/quickbase-js/commit/f26e0470a46368ee0a24c5cf4c0c2045c1d20e77))
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * github code page deploy update ([9305c36](https://github.com/DrewBradfordXYZ/quickbase-js/commit/9305c36220cf016cc0cda32a66882c989c07f4fa))
30
+ * Update workflow to use JamesIves/github-pages-deploy-action ([5bd7342](https://github.com/DrewBradfordXYZ/quickbase-js/commit/5bd73421ea00080e5b67ecf5b64a639117fa542c))
31
+
32
+ ## [0.1.0-beta.9](https://github.com/DrewBradfordXYZ/quickbase-js/compare/v0.1.0-beta.8...v0.1.0-beta.9) (2025-03-20)
33
+
34
+
35
+ ### Features
36
+
37
+ * 429 and throttlebucket tests pass ([5591e19](https://github.com/DrewBradfordXYZ/quickbase-js/commit/5591e19357c3c3232337ec4ede020530a635aa76))
38
+ * add baseUrl with a default ([5c5829f](https://github.com/DrewBradfordXYZ/quickbase-js/commit/5c5829fcbe32e780efebea903db11a505bb9166c))
39
+ * add SSO strategy ([501034d](https://github.com/DrewBradfordXYZ/quickbase-js/commit/501034d363ffd7b4d5acdd9cf2932b5d97f249ee))
40
+ * all relationship tests are passing ([5cdd0e9](https://github.com/DrewBradfordXYZ/quickbase-js/commit/5cdd0e9aafe5d22e354f3915e45b3950eec98cdf))
41
+ * auth refactor, auth tests pass, other tests still have errors ([47f353f](https://github.com/DrewBradfordXYZ/quickbase-js/commit/47f353f0fdb38813b9c047ec06059c9ff6354225))
42
+ * createField unit test passes ([676b6ab](https://github.com/DrewBradfordXYZ/quickbase-js/commit/676b6ab98379300b2d16e01c58b180bf1277ed86))
43
+ * createRelationship unit and integration tests pass ([577e7bb](https://github.com/DrewBradfordXYZ/quickbase-js/commit/577e7bbce7f7fa3d6ffbe1f9f2b7cb00e1a5e486))
44
+ * inferHttpMethod test and updateRelationship test pass ([1c6b342](https://github.com/DrewBradfordXYZ/quickbase-js/commit/1c6b34203a2100f17e9f626f547d426252922c67))
45
+ * jsdoc documents type properties ([191d721](https://github.com/DrewBradfordXYZ/quickbase-js/commit/191d7211c5c1cecd55b2019237c132225cf2d461))
46
+ * retryTempTokenMaxRetires unit test pass and update copyApp unit test is now more self contained ([8f38b1b](https://github.com/DrewBradfordXYZ/quickbase-js/commit/8f38b1b81a525702c6a49db07c1ef5b70a686792))
47
+ * retryUserToken401 integration test passes ([d78b0c6](https://github.com/DrewBradfordXYZ/quickbase-js/commit/d78b0c62cea3c1a35b9beca3db30d9fa1596c4e7))
48
+ * runFormula integration test passes ([4e5927d](https://github.com/DrewBradfordXYZ/quickbase-js/commit/4e5927d51d10d44534430c58321580bc363a9496))
49
+ * runFormula unit test passes ([871d6e9](https://github.com/DrewBradfordXYZ/quickbase-js/commit/871d6e97c4aa93bc8a206337f20b8ba325e16a64))
50
+ * runFormula.test.ts unit test pass ([8fe27d8](https://github.com/DrewBradfordXYZ/quickbase-js/commit/8fe27d8401ac53f4da8e7a52ea4c8645c5a46508))
51
+ * sso integration test passes ([c09a02c](https://github.com/DrewBradfordXYZ/quickbase-js/commit/c09a02cd379efd935dd0c256d8cf6fb4a7402a7e))
52
+ * sso unit test passes ([5e5baeb](https://github.com/DrewBradfordXYZ/quickbase-js/commit/5e5baeb3fb0a00e7301183346ef49b6aee483a6a))
53
+ * tokenLifespan unit test passes ([09a72a9](https://github.com/DrewBradfordXYZ/quickbase-js/commit/09a72a965a99bb6bd712cb705354c1904c72aebb))
54
+ * updateField unit test passes ([9a2aae1](https://github.com/DrewBradfordXYZ/quickbase-js/commit/9a2aae1338c53eb92a82a6bff212c275705d027e))
55
+
56
+
57
+ ### Bug Fixes
58
+
59
+ * updateRelationship integration test cleanup ([d27c030](https://github.com/DrewBradfordXYZ/quickbase-js/commit/d27c0303ec55162bea8d479064c5a93584cdef37))
60
+
61
+ ## [0.1.0-beta.8](https://github.com/DrewBradfordXYZ/quickbase-js/compare/v0.1.0-beta.7...v0.1.0-beta.8) (2025-03-18)
62
+
63
+
64
+ ### Features
65
+
66
+ * add updateField subfields that are not included in raw spec, test pass ([4481cff](https://github.com/DrewBradfordXYZ/quickbase-js/commit/4481cff81d4e6205a90537d49bb596214c0e45bd))
67
+ * build now works without error ([3f6ef2c](https://github.com/DrewBradfordXYZ/quickbase-js/commit/3f6ef2c1337f50b93bb937dd4de1d702c2eb984b))
68
+ * dev dependencies reinstall, pipeline runs again ([91a8216](https://github.com/DrewBradfordXYZ/quickbase-js/commit/91a8216064a48708fbf598e9d7be6084052cd439))
69
+ * generate-report for spec diff ([53ad6e7](https://github.com/DrewBradfordXYZ/quickbase-js/commit/53ad6e7d2f94683134dfa79e50022a8d2ab0b448))
70
+ * integration getApp and deleteFields pass ([ba07e9a](https://github.com/DrewBradfordXYZ/quickbase-js/commit/ba07e9a68d298ab6dbcf326c865261fcc46b51ba))
71
+ * integration tests pass for getAppEvents and updateApp ([58f4d20](https://github.com/DrewBradfordXYZ/quickbase-js/commit/58f4d20b5e9d539e91ac29662cae4d2a5bb4eed0))
72
+ * rename TokenBucket to ThrottleBucket ([3a3cdb4](https://github.com/DrewBradfordXYZ/quickbase-js/commit/3a3cdb4869856622e40ae3898f7fc66d50918b6c))
73
+ * throttle limits and 429 retry ([a7aec4a](https://github.com/DrewBradfordXYZ/quickbase-js/commit/a7aec4af37f0a74c0e42a938c97e6ce1df7c5250))
74
+ * tokenLifespan and separate invokeMethod.ts ([2336bce](https://github.com/DrewBradfordXYZ/quickbase-js/commit/2336bce25a9a22b6f14f2e3915e58849d5cb64f3))
75
+ * updateApp.test.ts unit test passes ([f2a3dcc](https://github.com/DrewBradfordXYZ/quickbase-js/commit/f2a3dcc904da07bbb1c363732df551da60430de1))
76
+ * updateField unit test pass ([c6ad2d5](https://github.com/DrewBradfordXYZ/quickbase-js/commit/c6ad2d53996bae3f7ed8a51a5795a6bfe0c293fd))
77
+ * updateRelationship integration test passes, creates and cleans summary and lookup fields ([cc6645f](https://github.com/DrewBradfordXYZ/quickbase-js/commit/cc6645f91be43b1e63dc8b3428a24af42b69ad1c))
78
+ * updateRelationship unit test passes ([155defc](https://github.com/DrewBradfordXYZ/quickbase-js/commit/155defcb1f3a746ac2bb135ec09db39b64dd58e2))
79
+ * user token 401 retry, all tests now passing ([a81a05d](https://github.com/DrewBradfordXYZ/quickbase-js/commit/a81a05d873f95d23f5721337854e2794be80ac64))
80
+
81
+
82
+ ### Bug Fixes
83
+
84
+ * 429 retry logic now has all tests passing ([a2da0ad](https://github.com/DrewBradfordXYZ/quickbase-js/commit/a2da0ad28c24c843d2bfd318f78827ba543e6833))
85
+ * build runs and all tests pass ([b1cbfaf](https://github.com/DrewBradfordXYZ/quickbase-js/commit/b1cbfafb879d1325e60024e837e8c5602e027e47))
86
+
87
+ ## [0.1.0-beta.7](https://github.com/DrewBradfordXYZ/quickbase-js/compare/v1.1.0-beta.6...v0.1.0-beta.7) (2025-03-16)
88
+
89
+
90
+ ### Features
91
+
92
+ * added Record, hybrid semantic naming, fully typed QuickbaseClient with few response models left as type:any ([535a02e](https://github.com/DrewBradfordXYZ/quickbase-js/commit/535a02e10d5974d2a2deb6dc213286da94d68dea))
93
+ * all fields tests pass ([84c539f](https://github.com/DrewBradfordXYZ/quickbase-js/commit/84c539fce7ba9d57c997b831be404a1398a6ac25))
94
+ * all types, methods and files generated ([f25bea0](https://github.com/DrewBradfordXYZ/quickbase-js/commit/f25bea0e65a019d75b39a9caf85901d520bf1ac8))
95
+ * build files always produce production code ([2f78598](https://github.com/DrewBradfordXYZ/quickbase-js/commit/2f785984416c61e1b3deda2b801071cbb1303a74))
96
+ * copyApp unit test passes ([0e13f91](https://github.com/DrewBradfordXYZ/quickbase-js/commit/0e13f918c5daabbbd6e17c2424b3f18eca2eb3a4))
97
+ * FieldMap issue resolved ([b3b7b41](https://github.com/DrewBradfordXYZ/quickbase-js/commit/b3b7b415d6a0f7701851f32a5e0b1207a07ba481))
98
+ * getApp and deleteApp test passes ([f5225e0](https://github.com/DrewBradfordXYZ/quickbase-js/commit/f5225e06299de58f34d6a765e73268d9a54e807d))
99
+ * getAppEvents spec update ([1028255](https://github.com/DrewBradfordXYZ/quickbase-js/commit/10282559cd76d004899fa2ebcea6f5f435ffae2b))
100
+ * import and upsert success ([ea9d9ee](https://github.com/DrewBradfordXYZ/quickbase-js/commit/ea9d9eef8384ad73b8cffb8183fbc374ab9cc25b))
101
+ * log-gen yaml file gets created next to the build file ([cfe25af](https://github.com/DrewBradfordXYZ/quickbase-js/commit/cfe25afb60498909d2bac8ec963484e1c1b42d3f))
102
+ * logging for swagger2.0 ([819aa17](https://github.com/DrewBradfordXYZ/quickbase-js/commit/819aa170cfc02e4e5b223ac13834d50bce5dda93))
103
+ * missing-types-report updated to empty on success ([e35b28d](https://github.com/DrewBradfordXYZ/quickbase-js/commit/e35b28d61563b21f7bad3e1c9c3751bfa254ab4a))
104
+ * QuickbaseClient is fully-typed from raw spec ([5c875c2](https://github.com/DrewBradfordXYZ/quickbase-js/commit/5c875c2ee07c38731c5609c384aaa8d3fbbdd64a))
105
+ * reorganize open-api folder ([a0fe5bd](https://github.com/DrewBradfordXYZ/quickbase-js/commit/a0fe5bda606c37e7636d36c7fc5e233d191ac249))
106
+ * simplifyName refactor again ([2a2952e](https://github.com/DrewBradfordXYZ/quickbase-js/commit/2a2952ea90fab818501d17908d6cd85a79c41adb))
107
+ * split up fix-spec- files ([85b6a3e](https://github.com/DrewBradfordXYZ/quickbase-js/commit/85b6a3efb92520a46aa619bdfc4bf70d06984b3f))
108
+ * unit auth tests pass ([494897f](https://github.com/DrewBradfordXYZ/quickbase-js/commit/494897f4551854096f89b1af43df4a455dfd9f4b))
109
+ * unit records tests pass ([8160b53](https://github.com/DrewBradfordXYZ/quickbase-js/commit/8160b53378447fcd8e37fac178e7d4693b502288))
110
+ * unit tables tests pass ([c4ec0ac](https://github.com/DrewBradfordXYZ/quickbase-js/commit/c4ec0ac378dd03e5d018b4ea83530e2c0fe905a2))
111
+ * unit tests for apps folder is passing ([72ae8e5](https://github.com/DrewBradfordXYZ/quickbase-js/commit/72ae8e529cddc66626617c6b1ff672f40763f7b7))
112
+ * update scripts to call integration tests, all tests pass ([08911f7](https://github.com/DrewBradfordXYZ/quickbase-js/commit/08911f76b214e6eb3ca8b4362c156d55383d7264))
113
+
114
+
115
+ ### Bug Fixes
116
+
117
+ * added back CreateRelationshipRequest and UpdateRelationshipRequest ([0d932ee](https://github.com/DrewBradfordXYZ/quickbase-js/commit/0d932eed8b603c6b84e13b8834a89722b91fabf3))
118
+ * generate-unified-interface type fixes ([b8acd16](https://github.com/DrewBradfordXYZ/quickbase-js/commit/b8acd16805f456336d396856c6ff88a29aa02813))
119
+ * playwright cleanup and type fixes ([ff30a15](https://github.com/DrewBradfordXYZ/quickbase-js/commit/ff30a15c1a244c7eb1ad4f52941f60b775bb88d4))
120
+ * remove the old /paths /definitons completely in scripts ([48ee6a3](https://github.com/DrewBradfordXYZ/quickbase-js/commit/48ee6a3b15579ca9224b89acde73f492e0769cab))
121
+ * update tags/tables.ts to match raw schema ([c6ed554](https://github.com/DrewBradfordXYZ/quickbase-js/commit/c6ed554f0994187224219b454d1e8671307fc189))
122
+
123
+ ## [1.1.0-beta.6](https://github.com/DrewBradfordXYZ/quickbase-js/compare/v1.1.0-beta.5...v1.1.0-beta.6) (2025-03-13)
124
+
125
+
126
+ ### Features
127
+
128
+ * omit credientials for all api calls that are not fetching a temp token ([b1b4aae](https://github.com/DrewBradfordXYZ/quickbase-js/commit/b1b4aae02aaa655e6eaab2fe0d532d526e6dc69f))
129
+
130
+ ## [1.1.0-beta.5](https://github.com/DrewBradfordXYZ/quickbase-js/compare/v1.1.0-beta.4...v1.1.0-beta.5) (2025-03-13)
131
+
132
+
133
+ ### Features
134
+
135
+ * ESM and UMD build prod ([49513e9](https://github.com/DrewBradfordXYZ/quickbase-js/commit/49513e902e7bf4dd35da3c6508242e96507a91bd))
136
+ * ESM and UMD support and src folder reorganization ([dc0170b](https://github.com/DrewBradfordXYZ/quickbase-js/commit/dc0170b547e6e9e57a117fbcccfdbeb86e48a8c7))
137
+
138
+ ## [1.1.0-beta.4](https://github.com/DrewBradfordXYZ/quickbase-js/compare/v1.1.0-beta.3...v1.1.0-beta.4) (2025-03-12)
139
+
140
+
141
+ ### Features
142
+
143
+ * createField and deleteFields tests are passing ([4b47c4d](https://github.com/DrewBradfordXYZ/quickbase-js/commit/4b47c4deb9b3d731e6e7938c12fcebe97830568b))
144
+ * createField mock and integration tests pass ([b227c73](https://github.com/DrewBradfordXYZ/quickbase-js/commit/b227c73b08f7efa5ce5f3d0c2897f82c8976a009))
145
+ * deleteFields spec update ([1f8beca](https://github.com/DrewBradfordXYZ/quickbase-js/commit/1f8becaca0d6b7950648c1b9bc2b0215781fa829))
146
+ * getFeildsUsage.test.ts unit and integration tests pass ([82a4886](https://github.com/DrewBradfordXYZ/quickbase-js/commit/82a488622967ec24a8767cbb19c59ef4ce808749))
147
+ * getField.test.ts unit and integration tests pass ([3e50b70](https://github.com/DrewBradfordXYZ/quickbase-js/commit/3e50b704f0ebea47f2fee3d02d811ea1b43db6c4))
148
+ * getFieldsUsage fix spec ([031faaa](https://github.com/DrewBradfordXYZ/quickbase-js/commit/031faaaeab9597f35fdd1ddcf5157ce5d774390b))
149
+ * getFieldUsage spec and unit test pass ([ac2824b](https://github.com/DrewBradfordXYZ/quickbase-js/commit/ac2824b226140dde99e33cf594d57bd6ffd4dc39))
150
+ * getFieldUsage unit and integration tests pass ([e62b586](https://github.com/DrewBradfordXYZ/quickbase-js/commit/e62b586d534620479a25dda2796ba5dcb8043705))
151
+ * split up fix-spec-paths and fix-spec-definitions into many files ([20d3246](https://github.com/DrewBradfordXYZ/quickbase-js/commit/20d32464e6337028778845fa55fbb19c5543f7eb))
152
+
153
+
154
+ ### Bug Fixes
155
+
156
+ * cleanup createField.test.ts logging ([7b1306b](https://github.com/DrewBradfordXYZ/quickbase-js/commit/7b1306bd8eb49e2c932ce267f33457e949e0f74b))
157
+ * createField test syntax update ([043f964](https://github.com/DrewBradfordXYZ/quickbase-js/commit/043f964a47346878440eb73cc10c110dab904ad7))
158
+ * getFieldsUsage type fix ([4c6f271](https://github.com/DrewBradfordXYZ/quickbase-js/commit/4c6f271d123131ae13a236664f28fbbdfde3d564))
159
+ * update deleteFields error type spec ([1788e1c](https://github.com/DrewBradfordXYZ/quickbase-js/commit/1788e1ce6d4d2c8df871ec8b112be908d706f884))
160
+
161
+ ## [1.1.0-beta.3](https://github.com/DrewBradfordXYZ/quickbase-js/compare/v1.1.0-beta.2...v1.1.0-beta.3) (2025-03-11)
162
+
163
+ ### Features
164
+
165
+ - copyApp fix-spec updates ([4c10ab4](https://github.com/DrewBradfordXYZ/quickbase-js/commit/4c10ab41464df047402a207c7b9e81026a7b6202))
166
+ - copyApp unit test passes ([b121bf1](https://github.com/DrewBradfordXYZ/quickbase-js/commit/b121bf1d0130f338f131de5417896d798fe90db3))
167
+ - deleteApp fix spec added ([b27ce11](https://github.com/DrewBradfordXYZ/quickbase-js/commit/b27ce11e2b08bc631d7656dedec57f6f5e579450))
168
+ - fix-spec-\* for getRelationship interface ([aad9fbd](https://github.com/DrewBradfordXYZ/quickbase-js/commit/aad9fbd7fc92b8aaaef901174c81169543ae86d2))
169
+ - getRelationship unit and integration test pass ([a1269bb](https://github.com/DrewBradfordXYZ/quickbase-js/commit/a1269bb60523944bdf5030404539043c967f0b83))
170
+ - updated Upsert200Response and Upsert207Response, deleteRecords.test.ts integration type issues resolved ([d39dad5](https://github.com/DrewBradfordXYZ/quickbase-js/commit/d39dad55d783d280db9dbae2ca4c782df3a1f12e))
171
+ - usertokens 401s do not generate a token, createApp unit and integration tests, deleteApp integration tests pass ([e3a092d](https://github.com/DrewBradfordXYZ/quickbase-js/commit/e3a092d76f283d5c5200ddbb5afd32782fc15379))
172
+
173
+ ## [1.1.0-beta.2](https://github.com/DrewBradfordXYZ/quickbase-js/compare/v1.1.0-beta.1...v1.1.0-beta.2) (2025-03-11)
174
+
175
+ ## [1.1.0-beta.1](https://github.com/DrewBradfordXYZ/quickbase-js/compare/v1.1.0-beta.0...v1.1.0-beta.1) (2025-03-11)
176
+
177
+ ### Features
178
+
179
+ - runQuery.test.ts integration test pass ([180b17f](https://github.com/DrewBradfordXYZ/quickbase-js/commit/180b17f265c26a0d23bde3ca6993bad1ba4f65ee))
180
+ - runQuery.test.ts unit test pass ([84e2fc4](https://github.com/DrewBradfordXYZ/quickbase-js/commit/84e2fc4f237d5f558fcd20d7b6b8eb83f685d7ac))
181
+
182
+ ### Bug Fixes
183
+
184
+ - added stub variables to unit tests ([d84b534](https://github.com/DrewBradfordXYZ/quickbase-js/commit/d84b5344201300d8d59e622b025d96ad9813d4eb))
185
+ - create env stubs for mock tests and update getTables.test.ts ([3d31c9e](https://github.com/DrewBradfordXYZ/quickbase-js/commit/3d31c9ebc9f852b99d1a807759490055d75c6396))
186
+
187
+ ## [1.1.0-beta.0](https://github.com/DrewBradfordXYZ/quickbase-js/compare/v1.0.1-beta.0...v1.1.0-beta.0) (2025-03-11)
188
+
189
+ ### Features
190
+
191
+ - add deleteTable integration test with 404 verification ([277aec6](https://github.com/DrewBradfordXYZ/quickbase-js/commit/277aec66a3047fab687ce81ad42b9371e8c2bf56))
192
+ - deleteRecords integration and unit tests ([d3beba1](https://github.com/DrewBradfordXYZ/quickbase-js/commit/d3beba1a362b13166b38f59eeea83c289ddaf999))
193
+ - integration tests for deleteRecords and upsert pass ([759978b](https://github.com/DrewBradfordXYZ/quickbase-js/commit/759978bc13cb1c50c03770232eb02a1c3c08428d))
194
+ - mock deleteRecords passes ([a167028](https://github.com/DrewBradfordXYZ/quickbase-js/commit/a1670286def030950c568e92ca99ea12e20d5b62))
195
+ - upsert mock test passes ([dde6d07](https://github.com/DrewBradfordXYZ/quickbase-js/commit/dde6d07d4c4c73bd14189f87fdc6347744004e4e))
196
+
197
+ ### Bug Fixes
198
+
199
+ - all vitests are passing again ([7206ba3](https://github.com/DrewBradfordXYZ/quickbase-js/commit/7206ba3f28bd7a3c7f5d699988e9a9a1f0053f42))
200
+ - fix-spec and test updates for createTable ([9c0cdd3](https://github.com/DrewBradfordXYZ/quickbase-js/commit/9c0cdd3b707971e6fb8f3e73598e3a600ff2b33d))
201
+ - fix-spec for upsertRecords and createApp ([d12de40](https://github.com/DrewBradfordXYZ/quickbase-js/commit/d12de40feac35e5d86a0b7d5019d8058cdfcffd9))
202
+ - fix-spec getTable ([1eb936c](https://github.com/DrewBradfordXYZ/quickbase-js/commit/1eb936c360ce5df4818b8d5ef7ccf4dc6b769af0))
203
+ - fix-spec getTable deleteTable ([236349a](https://github.com/DrewBradfordXYZ/quickbase-js/commit/236349af9e30776e00754232d83d76e065aab00b))
204
+ - fix-spec updates for createApp ([3614958](https://github.com/DrewBradfordXYZ/quickbase-js/commit/36149589ff2544ec50a82d9dc9b183f15d07778d))
205
+ - fix-spec updateTable ([26e278c](https://github.com/DrewBradfordXYZ/quickbase-js/commit/26e278cdbbe96d33e51f14e90ebb2c8b47d70f07))
206
+ - getTables test pass, change order for extractDbid to assign temp token dbid ([37b7685](https://github.com/DrewBradfordXYZ/quickbase-js/commit/37b7685d55a0f64e62cb91ad23df28d4916d5a50))
207
+ - upsert unit test type fixes ([8460cc8](https://github.com/DrewBradfordXYZ/quickbase-js/commit/8460cc8e63564bc8602dc12a9b6415094cc215f0))
208
+
209
+ ### 1.0.1-beta.0 (2025-03-10)
210
+
211
+ Testing done in a consuming library for getApp() and getFields()
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Drew Bradford
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,179 @@
1
+ # quickbase-js
2
+
3
+ A Typescript library using the QuickBase OpenAPI spec and the typescipt-fetch generator. This library is designed for both browser and Node.js environments. Code pages have first class support.
4
+
5
+ Authentication methods: `Temporary Tokens`, `User Tokens`, `SSO`.
6
+
7
+ ## API Documentation
8
+
9
+ https://quickbase-js.netlify.app/
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install --save quickbase-js
15
+ ```
16
+
17
+ ## Examples
18
+
19
+ ### Auth: User Token
20
+
21
+ ```javascript
22
+ import { quickbase } from "quickbase-js"; // Adjust the import path as needed
23
+
24
+ // QuickBase config variables
25
+ const QB_REALM = ""; // Your QuickBase realm (e.g., 'mycompany')
26
+ const QB_USER_TOKEN = ""; // Your QuickBase user token (e.g., 'b12345_abcde...')
27
+ const QB_APP_ID = ""; // Your app ID (e.g., 'bxyz789')
28
+
29
+ const qb = quickbase({
30
+ realm: QB_REALM,
31
+ userToken: QB_USER_TOKEN,
32
+ });
33
+
34
+ const getAppDetails = async () => {
35
+ try {
36
+ const response = await qb.getApp({
37
+ appId: QB_APP_ID,
38
+ });
39
+ console.log("App Details:", response);
40
+ } catch (error) {
41
+ console.error("Error fetching app:", error.message);
42
+ }
43
+ };
44
+
45
+ getAppDetails();
46
+ ```
47
+
48
+ ### Auth: Temporary Tokens (Code Pages)
49
+
50
+ ```javascript
51
+ import { quickbase } from "quickbase-js"; // Adjust the import path as needed
52
+
53
+ // QuickBase config variables
54
+ const QB_REALM = ""; // Your QuickBase realm (e.g., 'mycompany')
55
+ const QB_APP_ID = ""; // Your app ID (e.g., 'bxyz789')
56
+
57
+ const qb = quickbase({
58
+ realm: QB_REALM,
59
+ useTempTokens: true,
60
+ });
61
+
62
+ const getAppDetails = async () => {
63
+ try {
64
+ const response = await qb.getApp({
65
+ appId: QB_APP_ID,
66
+ });
67
+ console.log("App Details:", response);
68
+ } catch (error) {
69
+ console.error("Error fetching app:", error.message);
70
+ }
71
+ };
72
+
73
+ getAppDetails();
74
+ ```
75
+
76
+ ### Auth: SSO
77
+
78
+ ```javascript
79
+ import { quickbase } from "quickbase-js"; // Adjust the import path as needed
80
+
81
+ // QuickBase config variables
82
+ const QB_REALM = ""; // Your QuickBase realm (e.g., 'mycompany')
83
+ const QB_SAML_TOKEN = ""; // Your SAML token (e.g., 'saml_xyz789...')
84
+ const QB_APP_ID = ""; // Your app ID (e.g., 'bxyz789')
85
+
86
+ const qb = quickbase({
87
+ realm: QB_REALM,
88
+ samlToken: QB_SAML_TOKEN,
89
+ useSso: true,
90
+ });
91
+
92
+ const getAppDetails = async () => {
93
+ try {
94
+ const response = await qb.getApp({
95
+ appId: QB_APP_ID,
96
+ });
97
+ console.log("App Details:", response);
98
+ } catch (error) {
99
+ console.error("Error fetching app:", error.message);
100
+ }
101
+ };
102
+
103
+ getAppDetails();
104
+ ```
105
+
106
+ ## Configuration
107
+
108
+ The `quickbase` function accepts a `QuickbaseConfig` object with the following options:
109
+
110
+ _User options:_
111
+
112
+ - **`realm`** (`string`): Your QuickBase realm (e.g., "company"). This is required and has no default value.
113
+ - **`userToken`** (`string`, optional): A QuickBase user token for authentication. No default is provided.
114
+ - **`useTempTokens`** (`boolean`, optional): Enables temporary token authentication. Defaults to `false`.
115
+ - **`useSso`** (`boolean`, optional): Enables SSO authentication. Defaults to `false`.
116
+ - **`samlToken`** (`string`, optional): A SAML token for SSO authentication. No default is provided.
117
+
118
+ _Advanced user options:_
119
+
120
+ - **`tempTokenLifespan`** (`number`, optional): The lifespan (in milliseconds) of temporary tokens in the cache. Defaults to 4 minutes 50 seconds (290000 ms).
121
+
122
+ - **`throttle`** (`{ rate: number; burst: number }`, optional): Configures rate limiting, where `rate` is requests per second and `burst` is the maximum burst of requests. Defaults to `{ rate: 10, burst: 10 }`.
123
+
124
+ - **`maxRetries`** (`number`, optional): The maximum number of retries for failed requests. Defaults to `3`.
125
+
126
+ - **`retryDelay`** (`number`, optional): The base delay (in milliseconds) between retries, which increases exponentially. Defaults to `1000`.
127
+
128
+ - **`convertDates`** (`boolean`, optional): Converts ISO date strings to `Date` objects in responses. Defaults to `true`.
129
+
130
+ _Overrides and development options:_
131
+
132
+ - **`fetchApi`** (`typeof fetch`, optional): For browser environments, this defaults to the built-in `fetch`. In Node.js, you are able to use `node-fetch` or another compatible library.
133
+
134
+ - **`baseUrl`** (`string`, optional): The base URL for the QuickBase API. Defaults to `"https://api.quickbase.com/v1"`.
135
+
136
+ - **`debug`** (`boolean`, optional): Enables debug logging to the console. Defaults to `false`.
137
+
138
+ - **`tempToken`** (`string`, optional): If you would like to override the default behavior of tempTokens you can provide your own tempToken.
139
+
140
+ - **`tokenCache`** (`TokenCache`, optional): If you would like to use your own token cache, you can provide an instance of `TokenCache`.
141
+
142
+ ---
143
+
144
+ #### Configuration Notes
145
+
146
+ - **Authentication**: There are three mutually exclusive authentication methods: `userToken`, `useTempTokens` and `useSso` with `samlToken`. Only one auth method may be active at a time.
147
+
148
+ - **`throttle`**: Adjust this to handle 429 Too Many Requests errors. Controls API request pacing to avoid hitting rate limits. For example, `{ rate: 5, burst: 20 }` allows 5 requests per second with a burst capacity of 20.
149
+
150
+ - **`tokenCache`**: Temporary tokens are cached with their dbid with a `tempTokenLifespan`. This is automatically setup for you when `useTempTokens` is enabled.
151
+
152
+ ### Development workflow
153
+
154
+ ```bash
155
+ npm run gen:all
156
+ npm run build
157
+ npm run test:all
158
+ ```
159
+
160
+ ---
161
+
162
+ ### Prerequisites
163
+
164
+ - Node.js version >= 18
165
+ - A Quickbase account. [Free tier available](https://www.quickbase.com/builder-program).
166
+
167
+ ---
168
+
169
+ ### Contributing
170
+
171
+ If you would like to contribute to this project, please fork the repository and submit a pull request.
172
+
173
+ ---
174
+
175
+ ### License
176
+
177
+ MIT License - see LICENSE for details.
178
+
179
+ ---
@@ -0,0 +1,49 @@
1
+ ---
2
+ outline: deep
3
+ ---
4
+
5
+ # Runtime API Examples
6
+
7
+ This page demonstrates usage of some of the runtime APIs provided by VitePress.
8
+
9
+ The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:
10
+
11
+ ```md
12
+ <script setup>
13
+ import { useData } from 'vitepress'
14
+
15
+ const { theme, page, frontmatter } = useData()
16
+ </script>
17
+
18
+ ## Results
19
+
20
+ ### Theme Data
21
+ <pre>{{ theme }}</pre>
22
+
23
+ ### Page Data
24
+ <pre>{{ page }}</pre>
25
+
26
+ ### Page Frontmatter
27
+ <pre>{{ frontmatter }}</pre>
28
+ ```
29
+
30
+ <script setup>
31
+ import { useData } from 'vitepress'
32
+
33
+ const { site, theme, page, frontmatter } = useData()
34
+ </script>
35
+
36
+ ## Results
37
+
38
+ ### Theme Data
39
+ <pre>{{ theme }}</pre>
40
+
41
+ ### Page Data
42
+ <pre>{{ page }}</pre>
43
+
44
+ ### Page Frontmatter
45
+ <pre>{{ frontmatter }}</pre>
46
+
47
+ ## More
48
+
49
+ Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).
@@ -0,0 +1,131 @@
1
+ // build-common.js
2
+ import { execSync } from "child_process";
3
+ import { rollup } from "rollup";
4
+ import terser from "@rollup/plugin-terser";
5
+ import nodeResolve from "@rollup/plugin-node-resolve";
6
+ import commonjs from "@rollup/plugin-commonjs";
7
+ import dts from "rollup-plugin-dts";
8
+ import { rimrafSync } from "rimraf";
9
+ import {
10
+ copyFileSync,
11
+ readdirSync,
12
+ readFileSync,
13
+ writeFileSync,
14
+ mkdirSync,
15
+ statSync,
16
+ } from "fs";
17
+ import { join } from "path";
18
+
19
+ export const external = [
20
+ "node:http",
21
+ "node:https",
22
+ "node:zlib",
23
+ "node:stream",
24
+ "node:buffer",
25
+ "node:util",
26
+ "node:url",
27
+ "node:net",
28
+ "node:fs",
29
+ "node:path",
30
+ "node-fetch",
31
+ ];
32
+ export const globals = { "node-fetch": "fetch" };
33
+
34
+ export const srcDir = join(process.cwd(), "src");
35
+ export const tempSrcDir = join(process.cwd(), "dist/temp-src");
36
+ export const excludeDirs = ["specs"];
37
+ export const excludeFiles = ["generated/index.ts"]; // Exclude generated/index.ts to avoid duplicate exports
38
+
39
+ export function copyAndRewriteTsExtensions(src, dest) {
40
+ console.log(`Copying from ${src} to ${dest}`);
41
+ mkdirSync(dest, { recursive: true });
42
+ const files = readdirSync(src, { withFileTypes: true });
43
+
44
+ for (const file of files) {
45
+ const srcPath = join(src, file.name);
46
+ const destPath = join(dest, file.name);
47
+
48
+ if (file.isDirectory()) {
49
+ if (excludeDirs.includes(file.name)) {
50
+ console.log(`Skipping excluded directory ${srcPath}`);
51
+ continue;
52
+ }
53
+ copyAndRewriteTsExtensions(srcPath, destPath);
54
+ } else if (file.name.endsWith(".ts")) {
55
+ if (excludeFiles.some((excluded) => srcPath.includes(excluded))) {
56
+ console.log(`Skipping excluded file ${srcPath}`);
57
+ continue;
58
+ }
59
+ console.log(`Processing ${srcPath} -> ${destPath}`);
60
+ let fileContent = readFileSync(srcPath, "utf8");
61
+
62
+ // Remove .ts extensions from import/export statements for runtime compatibility
63
+ fileContent = removeTsExtensionsFromImports(fileContent);
64
+ fileContent = removeTsExtensionsFromStarExports(fileContent);
65
+
66
+ writeFileSync(destPath, fileContent, "utf8");
67
+ } else {
68
+ console.log(`Skipping non-.ts file ${srcPath}`);
69
+ }
70
+ }
71
+ }
72
+
73
+ export function removeTsExtensionsFromImports(content) {
74
+ // Matches: 'from "./some/path.ts"' or 'from "../another.ts"'
75
+ const importPattern = /from\s+(['"])(\.[\w\/-]+)\.ts\1/g;
76
+ return content.replace(importPattern, `from $1$2$1`);
77
+ }
78
+
79
+ export function removeTsExtensionsFromStarExports(content) {
80
+ // Matches: 'export * from "./some/path.ts"' or 'export * from "../another.ts"'
81
+ const exportStarPattern = /export\s+\*\s+from\s+(['"])(\.[\w\/-]+)\.ts\1/g;
82
+ return content.replace(exportStarPattern, `export * from $1$2$1`);
83
+ }
84
+
85
+ export async function createBundle(input, plugins, format, outputOptions) {
86
+ const bundle = await rollup({
87
+ input,
88
+ external,
89
+ plugins,
90
+ });
91
+ await bundle.write(outputOptions);
92
+ await bundle.close();
93
+ }
94
+
95
+ export function compileTypeScript() {
96
+ console.log("Running tsc...");
97
+ const tsFiles = readdirSync(tempSrcDir, { recursive: true })
98
+ .filter((file) => file.endsWith(".ts"))
99
+ .map((file) => join(tempSrcDir, file));
100
+ const tscCommand = `npx tsc ${tsFiles.join(" ")} --outDir ${join(
101
+ process.cwd(),
102
+ "dist/temp"
103
+ )} --module ESNext --target ESNext --sourceMap --moduleResolution bundler --baseUrl ${process.cwd()}`;
104
+ console.log(`Command: ${tscCommand}`);
105
+ execSync(tscCommand, { stdio: "inherit" });
106
+ }
107
+
108
+ export async function generateDeclarations() {
109
+ console.log("Generating declarations...");
110
+ const dtsBundle = await rollup({
111
+ input: "src/quickbaseClient.ts",
112
+ plugins: [dts({ tsconfig: "./tsconfig.json", respectExternal: true })],
113
+ });
114
+ await dtsBundle.write({ file: "dist/esm/quickbase.d.ts", format: "esm" });
115
+ await dtsBundle.write({ file: "dist/umd/quickbase.umd.d.ts", format: "umd" });
116
+ await dtsBundle.close();
117
+ }
118
+
119
+ export function listFilesWithSizes(dir, prefix = "") {
120
+ const files = readdirSync(dir, { withFileTypes: true });
121
+ for (const file of files) {
122
+ const filePath = join(dir, file.name);
123
+ if (file.isDirectory()) {
124
+ listFilesWithSizes(filePath, `${prefix}${file.name}/`);
125
+ } else {
126
+ const stats = statSync(filePath);
127
+ const sizeKB = (stats.size / 1024).toFixed(2);
128
+ console.log(`${prefix}${file.name} - ${sizeKB} KB`);
129
+ }
130
+ }
131
+ }