graphiti 2.0.0.beta.3 → 2.0.0.beta.5

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 (274) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +30 -86
  3. data/.github/workflows/docs.yml +57 -0
  4. data/.github/workflows/release.yml +8 -8
  5. data/.gitignore +7 -0
  6. data/.npmrc +9 -0
  7. data/.standard.yml +4 -1
  8. data/Appraisals +33 -32
  9. data/CHANGELOG.md +48 -0
  10. data/README.md +13 -2
  11. data/UPGRADING.md +2 -58
  12. data/docs/concepts/backends-and-models.md +122 -0
  13. data/docs/concepts/endpoints.md +183 -0
  14. data/docs/concepts/links.md +212 -0
  15. data/docs/concepts/overview.md +80 -0
  16. data/docs/concepts/persisting.md +376 -0
  17. data/docs/concepts/relationships.md +527 -0
  18. data/docs/concepts/resources.md +677 -0
  19. data/docs/getting-started/first-api.md +289 -0
  20. data/docs/getting-started/installation.md +185 -0
  21. data/docs/intro.md +307 -0
  22. data/docs/js/authentication.md +63 -0
  23. data/docs/js/ddau.md +20 -0
  24. data/docs/js/extra-params.md +41 -0
  25. data/docs/js/index.md +112 -0
  26. data/docs/js/installation.md +120 -0
  27. data/docs/js/middleware.md +72 -0
  28. data/docs/js/models.md +202 -0
  29. data/docs/js/reads.md +494 -0
  30. data/docs/js/state-syncing.md +100 -0
  31. data/docs/js/writes.md +373 -0
  32. data/docs/reference/vandal.md +63 -0
  33. data/docs/reference/why.md +13 -0
  34. data/docs/topics/authorization.md +155 -0
  35. data/docs/topics/caching.md +55 -0
  36. data/docs/topics/customizing-sideloads.md +156 -0
  37. data/docs/topics/debugging.md +216 -0
  38. data/docs/topics/error-handling.md +210 -0
  39. data/docs/topics/etags.md +46 -0
  40. data/docs/topics/hopping-relationships.md +149 -0
  41. data/docs/topics/json-attributes.md +77 -0
  42. data/docs/topics/openstruct-models.md +50 -0
  43. data/docs/topics/remote-resources.md +291 -0
  44. data/docs/topics/testing.md +894 -0
  45. data/docs/topics/without-activerecord.md +324 -0
  46. data/docs/tutorial/index.md +58 -0
  47. data/docs/tutorial/step_0.md +107 -0
  48. data/docs/tutorial/step_1.md +199 -0
  49. data/docs/tutorial/step_2.md +312 -0
  50. data/docs/tutorial/step_3.md +142 -0
  51. data/docs/tutorial/step_4.md +135 -0
  52. data/docs/tutorial/step_5.md +69 -0
  53. data/docs/tutorial/step_6.md +82 -0
  54. data/docs/tutorial/step_7.md +205 -0
  55. data/docs/tutorial/step_8.md +128 -0
  56. data/docs/tutorial/step_9.md +171 -0
  57. data/docs/upgrading.md +260 -0
  58. data/gemfiles/rails_7_1.gemfile +4 -3
  59. data/gemfiles/{rails_7_2_graphiti_rails.gemfile → rails_7_2.gemfile} +3 -3
  60. data/gemfiles/{rails_8_1_graphiti_rails.gemfile → rails_8_0.gemfile} +3 -3
  61. data/gemfiles/{rails_8_0_graphiti_rails.gemfile → rails_8_1.gemfile} +3 -3
  62. data/graphiti.gemspec +7 -23
  63. data/{deprecated_generators → lib/generators}/graphiti/api_test_generator.rb +7 -1
  64. data/{deprecated_generators → lib/generators}/graphiti/generator_mixin.rb +14 -1
  65. data/{deprecated_generators → lib/generators}/graphiti/install_generator.rb +19 -13
  66. data/{deprecated_generators → lib/generators}/graphiti/resource_generator.rb +68 -7
  67. data/{deprecated_generators → lib/generators}/graphiti/templates/controller.rb.erb +1 -1
  68. data/{deprecated_generators → lib/generators}/graphiti/templates/index_request_spec.rb.erb +1 -1
  69. data/{deprecated_generators → lib/generators}/graphiti/templates/resource_reads_spec.rb.erb +6 -6
  70. data/{deprecated_generators → lib/generators}/graphiti/templates/show_request_spec.rb.erb +1 -1
  71. data/lib/graphiti/configuration.rb +2 -2
  72. data/lib/graphiti/error_serializers/conflict_request.rb +19 -0
  73. data/lib/graphiti/error_serializers/deprecated_constants.rb +48 -0
  74. data/lib/graphiti/error_serializers/invalid_request.rb +56 -0
  75. data/lib/graphiti/error_serializers/validation.rb +143 -0
  76. data/lib/graphiti/errors.rb +4 -4
  77. data/lib/graphiti/query.rb +1 -1
  78. data/lib/graphiti/rails/context.rb +33 -0
  79. data/lib/graphiti/rails/controller.rb +41 -0
  80. data/lib/graphiti/rails/debugging.rb +18 -0
  81. data/lib/graphiti/rails/exception_handlers.rb +77 -0
  82. data/lib/graphiti/rails/railtie.rb +139 -0
  83. data/lib/graphiti/rails/rake_helpers.rb +42 -0
  84. data/lib/graphiti/rails/responders.rb +21 -0
  85. data/lib/graphiti/rails/test_helpers.rb +22 -0
  86. data/lib/graphiti/rails.rb +47 -29
  87. data/lib/graphiti/resource/configuration.rb +1 -0
  88. data/lib/graphiti/resource/interface.rb +2 -2
  89. data/lib/graphiti/resource/remote.rb +2 -2
  90. data/lib/graphiti/resource/sideloading.rb +1 -1
  91. data/lib/graphiti/resource.rb +13 -1
  92. data/lib/graphiti/responders.rb +7 -20
  93. data/lib/graphiti/schema.rb +5 -1
  94. data/lib/graphiti/schema_diff.rb +4 -0
  95. data/lib/graphiti/scope.rb +45 -37
  96. data/lib/graphiti/serializer.rb +6 -0
  97. data/lib/graphiti/sideload/belongs_to.rb +38 -5
  98. data/lib/graphiti/sideload/polymorphic_belongs_to.rb +27 -23
  99. data/lib/graphiti/sideload.rb +54 -35
  100. data/lib/graphiti/spec_helpers/errors.rb +73 -0
  101. data/lib/graphiti/spec_helpers/errors_proxy.rb +75 -0
  102. data/lib/graphiti/spec_helpers/helpers.rb +107 -0
  103. data/lib/graphiti/spec_helpers/matchers.rb +196 -0
  104. data/lib/graphiti/spec_helpers/node.rb +88 -0
  105. data/lib/graphiti/spec_helpers/rspec.rb +148 -0
  106. data/lib/graphiti/spec_helpers.rb +54 -0
  107. data/lib/graphiti/util/include_params.rb +2 -2
  108. data/lib/graphiti/util/serializer_relationships.rb +41 -5
  109. data/lib/graphiti/version.rb +1 -1
  110. data/lib/graphiti-rails.rb +11 -0
  111. data/lib/graphiti.rb +34 -10
  112. data/lib/graphiti_errors.rb +11 -0
  113. data/lib/graphiti_spec_helpers/rspec.rb +3 -0
  114. data/lib/graphiti_spec_helpers.rb +11 -0
  115. data/lib/tasks/graphiti.rake +29 -0
  116. data/package-lock.json +6199 -0
  117. data/package.json +5 -4
  118. data/website/.gitignore +20 -0
  119. data/website/README.md +43 -0
  120. data/website/docusaurus.config.js +197 -0
  121. data/website/package-lock.json +19474 -0
  122. data/website/package.json +46 -0
  123. data/website/sidebars.js +82 -0
  124. data/website/src/css/custom.css +85 -0
  125. data/website/src/pages/markdown-page.mdx +7 -0
  126. data/website/static/.nojekyll +0 -0
  127. data/website/static/1.13/2019/03/31/graphiti-1-0.html +205 -0
  128. data/website/static/1.13/2019/05/08/graphiti-1-1.html +212 -0
  129. data/website/static/1.13/2019/05/20/graphiti-1-2.html +214 -0
  130. data/website/static/1.13/2019/10/14/tutorial.html +198 -0
  131. data/website/static/1.13/CNAME +1 -0
  132. data/website/static/1.13/README.md +16 -0
  133. data/website/static/1.13/assets/css/syntax.css +60 -0
  134. data/website/static/1.13/assets/favicons/android-chrome-192x192.png +0 -0
  135. data/website/static/1.13/assets/favicons/android-chrome-256x256.png +0 -0
  136. data/website/static/1.13/assets/favicons/apple-touch-icon.png +0 -0
  137. data/website/static/1.13/assets/favicons/browserconfig.xml +9 -0
  138. data/website/static/1.13/assets/favicons/favicon-16x16.png +0 -0
  139. data/website/static/1.13/assets/favicons/favicon-32x32.png +0 -0
  140. data/website/static/1.13/assets/favicons/favicon.ico +0 -0
  141. data/website/static/1.13/assets/favicons/mstile-150x150.png +0 -0
  142. data/website/static/1.13/assets/favicons/safari-pinned-tab.svg +1 -0
  143. data/website/static/1.13/assets/favicons/site.webmanifest +19 -0
  144. data/website/static/1.13/assets/img/backend.gif +0 -0
  145. data/website/static/1.13/assets/img/conformity.png +0 -0
  146. data/website/static/1.13/assets/img/error_payload.png +0 -0
  147. data/website/static/1.13/assets/img/fancy-cushion.png +0 -0
  148. data/website/static/1.13/assets/img/gh.png +0 -0
  149. data/website/static/1.13/assets/img/home-bg.jpg +0 -0
  150. data/website/static/1.13/assets/img/lifecycle.gif +0 -0
  151. data/website/static/1.13/assets/img/logo-500.png +0 -0
  152. data/website/static/1.13/assets/img/logo.png +0 -0
  153. data/website/static/1.13/assets/img/love-graffiti.jpg +0 -0
  154. data/website/static/1.13/assets/img/meta_total_count.png +0 -0
  155. data/website/static/1.13/assets/img/persist.jpg +0 -0
  156. data/website/static/1.13/assets/img/resource.gif +0 -0
  157. data/website/static/1.13/assets/img/rest-graffiti.jpg +0 -0
  158. data/website/static/1.13/assets/img/rest1.gif +0 -0
  159. data/website/static/1.13/assets/img/rest2.gif +0 -0
  160. data/website/static/1.13/assets/img/rest3.gif +0 -0
  161. data/website/static/1.13/assets/img/rethink-rest-graffiti.jpg +0 -0
  162. data/website/static/1.13/assets/img/sunrise.png +0 -0
  163. data/website/static/1.13/assets/img/why.png +0 -0
  164. data/website/static/1.13/assets/js/highlight.pack.js +2 -0
  165. data/website/static/1.13/assets/main.css +15518 -0
  166. data/website/static/1.13/assets/main.css.map +1 -0
  167. data/website/static/1.13/bin/bundle +109 -0
  168. data/website/static/1.13/bin/jekyll +27 -0
  169. data/website/static/1.13/bin/kramdown +27 -0
  170. data/website/static/1.13/bin/listen +27 -0
  171. data/website/static/1.13/bin/rake +27 -0
  172. data/website/static/1.13/bin/rougify +27 -0
  173. data/website/static/1.13/bin/safe_yaml +27 -0
  174. data/website/static/1.13/bin/sass +27 -0
  175. data/website/static/1.13/bin/sass-convert +27 -0
  176. data/website/static/1.13/bin/scss +27 -0
  177. data/website/static/1.13/blog.html +259 -0
  178. data/website/static/1.13/cheatsheet.html +316 -0
  179. data/website/static/1.13/cookbooks/authorization.md +0 -0
  180. data/website/static/1.13/cookbooks/caching.md +0 -0
  181. data/website/static/1.13/cookbooks/customizing-sideloads.html +325 -0
  182. data/website/static/1.13/cookbooks/etags.md +0 -0
  183. data/website/static/1.13/cookbooks/hopping-relationships.html +324 -0
  184. data/website/static/1.13/cookbooks/json_attributes.md +0 -0
  185. data/website/static/1.13/cookbooks/openstruct-models.md +0 -0
  186. data/website/static/1.13/cookbooks/remote-resources.md +0 -0
  187. data/website/static/1.13/cookbooks/without-activerecord.html +510 -0
  188. data/website/static/1.13/features.html +249 -0
  189. data/website/static/1.13/feed.xml +106 -0
  190. data/website/static/1.13/guides/concepts/backends-and-models.html +467 -0
  191. data/website/static/1.13/guides/concepts/debugging.html +440 -0
  192. data/website/static/1.13/guides/concepts/endpoints.html +432 -0
  193. data/website/static/1.13/guides/concepts/error-handling.html +396 -0
  194. data/website/static/1.13/guides/concepts/links.html +501 -0
  195. data/website/static/1.13/guides/concepts/remote-resources.html +536 -0
  196. data/website/static/1.13/guides/concepts/resources.html +2176 -0
  197. data/website/static/1.13/guides/concepts/testing.html +1469 -0
  198. data/website/static/1.13/guides/getting-started/installation.html +420 -0
  199. data/website/static/1.13/guides/graphiti-rails-migration.html +242 -0
  200. data/website/static/1.13/guides/index.html +269 -0
  201. data/website/static/1.13/guides/overview.html +325 -0
  202. data/website/static/1.13/guides/upgrading-2-0.html +193 -0
  203. data/website/static/1.13/guides/upgrading.html +314 -0
  204. data/website/static/1.13/guides/vandal.html +282 -0
  205. data/website/static/1.13/guides/why.html +1121 -0
  206. data/website/static/1.13/index.html +72 -0
  207. data/website/static/1.13/js/authentication.html +295 -0
  208. data/website/static/1.13/js/ddau.html +238 -0
  209. data/website/static/1.13/js/extra-params.html +270 -0
  210. data/website/static/1.13/js/index.html +321 -0
  211. data/website/static/1.13/js/installation.html +637 -0
  212. data/website/static/1.13/js/introduction.html +257 -0
  213. data/website/static/1.13/js/middleware.html +318 -0
  214. data/website/static/1.13/js/reads/fieldsets.html +271 -0
  215. data/website/static/1.13/js/reads/filtering.html +289 -0
  216. data/website/static/1.13/js/reads/includes.html +260 -0
  217. data/website/static/1.13/js/reads/index.html +497 -0
  218. data/website/static/1.13/js/reads/nested-queries.html +353 -0
  219. data/website/static/1.13/js/reads/pagination.html +260 -0
  220. data/website/static/1.13/js/reads/sorting.html +265 -0
  221. data/website/static/1.13/js/reads/statistics.html +289 -0
  222. data/website/static/1.13/js/state-syncing.html +340 -0
  223. data/website/static/1.13/js/writes/deferred.html +296 -0
  224. data/website/static/1.13/js/writes/dirty-tracking.html +399 -0
  225. data/website/static/1.13/js/writes/index.html +391 -0
  226. data/website/static/1.13/js/writes/nested.html +330 -0
  227. data/website/static/1.13/js/writes/validations.html +272 -0
  228. data/website/static/1.13/quickstart.html +660 -0
  229. data/website/static/1.13/template +161 -0
  230. data/website/static/1.13/tutorial/index.html +250 -0
  231. data/website/static/1.13/tutorial/step_0.html +292 -0
  232. data/website/static/1.13/tutorial/step_1.html +517 -0
  233. data/website/static/1.13/tutorial/step_2.html +481 -0
  234. data/website/static/1.13/tutorial/step_3.html +323 -0
  235. data/website/static/1.13/tutorial/step_4.html +318 -0
  236. data/website/static/1.13/tutorial/step_5.html +265 -0
  237. data/website/static/1.13/tutorial/step_6.html +276 -0
  238. data/website/static/1.13/tutorial/step_7.html +390 -0
  239. data/website/static/1.13/tutorial/step_8.html +316 -0
  240. data/website/static/1.13/tutorial/step_9.html +365 -0
  241. data/website/static/CNAME +1 -0
  242. data/website/static/assets/img/error_payload.png +0 -0
  243. data/website/static/assets/img/legacy/legacy-0378a3bb39.png +0 -0
  244. data/website/static/assets/img/legacy/legacy-05bbd3e5fd.png +0 -0
  245. data/website/static/assets/img/legacy/legacy-07aa104495.png +0 -0
  246. data/website/static/assets/img/legacy/legacy-0c75a16b3a.gif +0 -0
  247. data/website/static/assets/img/legacy/legacy-3076df6209.png +0 -0
  248. data/website/static/assets/img/legacy/legacy-7f6889bc89.png +0 -0
  249. data/website/static/assets/img/legacy/legacy-a2cc4363c3.png +0 -0
  250. data/website/static/assets/img/legacy/legacy-f67cfa89ab.png +0 -0
  251. data/website/static/assets/img/meta_total_count.png +0 -0
  252. data/website/static/img/docusaurus-social-card.jpg +0 -0
  253. data/website/static/img/docusaurus.png +0 -0
  254. data/website/static/img/favicon.ico +0 -0
  255. data/website/static/img/logo.png +0 -0
  256. data/website/static/img/logo.svg +1 -0
  257. data/website/static/img/undraw_docusaurus_mountain.svg +171 -0
  258. data/website/static/img/undraw_docusaurus_react.svg +170 -0
  259. data/website/static/img/undraw_docusaurus_tree.svg +40 -0
  260. metadata +251 -54
  261. data/gemfiles/rails_6.gemfile +0 -18
  262. data/gemfiles/rails_6_graphiti_rails.gemfile +0 -19
  263. data/gemfiles/rails_7.gemfile +0 -18
  264. data/gemfiles/rails_7_1_graphiti_rails.gemfile +0 -19
  265. data/gemfiles/rails_7_graphiti_rails.gemfile +0 -19
  266. data/lib/graphiti/deprecated_tasks.rb +0 -49
  267. data/lib/graphiti/railtie.rb +0 -121
  268. /data/{deprecated_generators → lib/generators}/graphiti/resource_test_generator.rb +0 -0
  269. /data/{deprecated_generators → lib/generators}/graphiti/templates/application_resource.rb.erb +0 -0
  270. /data/{deprecated_generators → lib/generators}/graphiti/templates/create_request_spec.rb.erb +0 -0
  271. /data/{deprecated_generators → lib/generators}/graphiti/templates/destroy_request_spec.rb.erb +0 -0
  272. /data/{deprecated_generators → lib/generators}/graphiti/templates/resource.rb.erb +0 -0
  273. /data/{deprecated_generators → lib/generators}/graphiti/templates/resource_writes_spec.rb.erb +0 -0
  274. /data/{deprecated_generators → lib/generators}/graphiti/templates/update_request_spec.rb.erb +0 -0
data/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "graphiti",
3
- "version": "1.4.0",
3
+ "private": true,
4
+ "version": "0.0.0-development",
4
5
  "repository": {
5
6
  "type": "git",
6
7
  "url": "git+https://github.com/graphiti-api/graphiti.git"
@@ -15,9 +16,9 @@
15
16
  },
16
17
  "devDependencies": {
17
18
  "semantic-release-rubygem": "^1.2.0",
18
- "semantic-release": "^19.0.3",
19
- "@semantic-release/changelog": "^6.0.1",
20
- "@semantic-release/git": "^10.0.1"
19
+ "semantic-release": "^25.0.8",
20
+ "@semantic-release/changelog": "^7.0.0",
21
+ "@semantic-release/git": "^11.0.1"
21
22
  },
22
23
  "release": {
23
24
  "branches": [
@@ -0,0 +1,20 @@
1
+ # Dependencies
2
+ /node_modules
3
+
4
+ # Production
5
+ /build
6
+
7
+ # Generated files
8
+ .docusaurus
9
+ .cache-loader
10
+
11
+ # Misc
12
+ .DS_Store
13
+ .env.local
14
+ .env.development.local
15
+ .env.test.local
16
+ .env.production.local
17
+
18
+ npm-debug.log*
19
+ yarn-debug.log*
20
+ yarn-error.log*
data/website/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # Website
2
+
3
+ This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install
9
+ ```
10
+
11
+ **Note**: feel free to use the package manager of your choice.
12
+
13
+ ## Local Development
14
+
15
+ ```bash
16
+ npm run start
17
+ ```
18
+
19
+ This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
20
+
21
+ ## Build
22
+
23
+ ```bash
24
+ npm run build
25
+ ```
26
+
27
+ This command generates static content into the `build` directory and can be served using any static contents hosting service.
28
+
29
+ ## Deployment
30
+
31
+ Using SSH:
32
+
33
+ ```bash
34
+ USE_SSH=true npm run deploy
35
+ ```
36
+
37
+ Not using SSH:
38
+
39
+ ```bash
40
+ GIT_USER=<Your GitHub username> npm run deploy
41
+ ```
42
+
43
+ If you are using GitHub Pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
@@ -0,0 +1,197 @@
1
+ // @ts-check
2
+ const {themes} = require('prism-react-renderer');
3
+
4
+ const codeBlockTheme = (theme, backgroundColor) => ({
5
+ ...theme,
6
+ plain: {...theme.plain, backgroundColor},
7
+ });
8
+
9
+ // Docusaurus prepends baseUrl to navbar and Link hrefs, but not to raw HTML
10
+ // like announcementBar content, so that markup has to build its own absolute
11
+ // paths. Always has a trailing slash.
12
+ const baseUrl = process.env.DOCS_BASE_URL || '/';
13
+
14
+ // The theme's strikethrough and underline on diff lines are inline styles, so
15
+ // CSS cannot undo them. Colour and the +/- signs already carry it.
16
+ const withoutDiffDecoration = (theme) => ({
17
+ ...theme,
18
+ styles: theme.styles.map(({types, style}) =>
19
+ types.some((type) => type === 'inserted' || type === 'deleted')
20
+ ? {types, style: {...style, textDecorationLine: undefined}}
21
+ : {types, style}
22
+ ),
23
+ });
24
+
25
+ /** @type {import('@docusaurus/types').Config} */
26
+ const config = {
27
+ title: 'Graphiti',
28
+ tagline: 'Stylish Graph APIs',
29
+ favicon: 'img/favicon.ico',
30
+
31
+ // Apex, matching the CNAME. This feeds canonical tags and sitemap.xml, so it
32
+ // has to agree with the host actually serving the site or the two split
33
+ // search ranking between them.
34
+ url: 'https://graphiti.dev',
35
+ // graphiti.dev resolves to this repo, so the site serves from the root.
36
+ // DOCS_BASE_URL still overrides it for a build served from the project-pages
37
+ // path, which is what /graphiti/ was during the beta.
38
+ baseUrl,
39
+ organizationName: 'graphiti-api',
40
+ projectName: 'graphiti',
41
+
42
+ onBrokenLinks: 'warn',
43
+ markdown: {hooks: {onBrokenMarkdownLinks: 'warn'}},
44
+
45
+ presets: [
46
+ [
47
+ 'classic',
48
+ /** @type {import('@docusaurus/preset-classic').Options} */
49
+ ({
50
+ docs: {
51
+ // markdown lives at the repo root, next to the code it documents
52
+ path: '../docs',
53
+ routeBasePath: '/',
54
+ sidebarPath: require.resolve('./sidebars.js'),
55
+ editUrl: 'https://github.com/graphiti-api/graphiti/tree/main/website/',
56
+ // Unversioned docs serve at the root, and would otherwise be
57
+ // labelled "Next" in the dropdown. Once `npm run docusaurus
58
+ // docs:version 2.0` cuts a version, that becomes the root and the
59
+ // working copy moves to /next.
60
+ versions: {current: {label: '2.0 beta'}},
61
+ },
62
+ blog: false,
63
+ theme: {customCss: require.resolve('./src/css/custom.css')},
64
+ }),
65
+ ],
66
+ ],
67
+
68
+ plugins: [
69
+ [
70
+ '@docusaurus/plugin-client-redirects',
71
+ {
72
+ // The 1.x Jekyll site served /guides/* and /cookbooks/*, and early 2.0
73
+ // drafts served /quickstart and /cheatsheet. Keep those URLs alive.
74
+ // Nothing under /1.13/ is touched: that is the frozen 1.x site.
75
+ redirects: [
76
+ {from: ['/quickstart'], to: '/getting-started/first-api'},
77
+ {from: ['/cheatsheet', '/guides', '/guides/index'], to: '/'},
78
+ {from: ['/guides/overview'], to: '/concepts/overview'},
79
+ {from: ['/guides/why'], to: '/reference/why'},
80
+ {from: ['/guides/vandal'], to: '/reference/vandal'},
81
+ {from: ['/guides/upgrading', '/guides/upgrading-2-0', '/reference/upgrading-2-0', '/upgrading/controllers', '/upgrading/testing', '/upgrading/persistence-hooks', '/upgrading/exception-handling', '/upgrading/belongs-to-linkage', '/upgrading/without-rails'], to: '/upgrading'},
82
+ {from: ['/guides/getting-started/installation'], to: '/getting-started/installation'},
83
+
84
+ {from: ['/guides/concepts/resources'], to: '/concepts/resources'},
85
+ {from: ['/guides/concepts/endpoints'], to: '/concepts/endpoints'},
86
+ {from: ['/guides/concepts/links'], to: '/concepts/links'},
87
+ {from: ['/guides/concepts/backends-and-models'], to: '/concepts/backends-and-models'},
88
+ {from: ['/guides/concepts/testing'], to: '/topics/testing'},
89
+ {from: ['/guides/concepts/debugging'], to: '/topics/debugging'},
90
+ {from: ['/guides/concepts/error-handling'], to: '/topics/error-handling'},
91
+ {from: ['/guides/concepts/remote-resources', '/cookbooks/remote-resources'], to: '/topics/remote-resources'},
92
+
93
+ // Cookbook stubs that never had content now point at the real pages
94
+ {from: ['/cookbooks/authorization'], to: '/topics/authorization'},
95
+ {from: ['/cookbooks/caching'], to: '/topics/caching'},
96
+ {from: ['/cookbooks/etags'], to: '/topics/etags'},
97
+ {from: ['/cookbooks/json_attributes'], to: '/topics/json-attributes'},
98
+ {from: ['/cookbooks/openstruct-models'], to: '/topics/openstruct-models'},
99
+ {from: ['/cookbooks/without-activerecord'], to: '/topics/without-activerecord'},
100
+ {from: ['/cookbooks/customizing-sideloads'], to: '/topics/customizing-sideloads'},
101
+ {from: ['/cookbooks/hopping-relationships'], to: '/topics/hopping-relationships'},
102
+
103
+ {from: ['/js/introduction'], to: '/js/'},
104
+ {
105
+ from: [
106
+ '/js/reads/index',
107
+ '/js/reads/filtering',
108
+ '/js/reads/sorting',
109
+ '/js/reads/pagination',
110
+ '/js/reads/fieldsets',
111
+ '/js/reads/includes',
112
+ '/js/reads/nested-queries',
113
+ '/js/reads/statistics',
114
+ ],
115
+ to: '/js/reads',
116
+ },
117
+ {
118
+ from: [
119
+ '/js/writes/index',
120
+ '/js/writes/validations',
121
+ '/js/writes/dirty-tracking',
122
+ '/js/writes/nested',
123
+ '/js/writes/deferred',
124
+ ],
125
+ to: '/js/writes',
126
+ },
127
+ ],
128
+
129
+ // The 2.0 docs were staged under /graphiti/ for the whole beta, so
130
+ // those URLs are in the wild. createRedirects sees every generated
131
+ // route, which the static /1.13/ tree is not: that one is by hand.
132
+ createRedirects(existingPath) {
133
+ return [`/graphiti${existingPath}`];
134
+ },
135
+ },
136
+ ],
137
+ ],
138
+
139
+ themeConfig: {
140
+ announcementBar: {
141
+ // Changing the id un-dismisses the bar for everyone who has closed it.
142
+ id: 'graphiti-2-0-beta',
143
+ content: `Graphiti 2.0 is in beta, and the docs have been reorganized to describe it. <a href="${baseUrl}1.13/">Docs for 1.x</a>.`,
144
+ isCloseable: true,
145
+ },
146
+ colorMode: {
147
+ // Dark for a first-time visitor. Flip respectPrefersColorScheme to true
148
+ // to follow the OS setting instead, in which case defaultMode only
149
+ // applies when the visitor has no preference either way. Once someone
150
+ // uses the navbar toggle their choice is remembered and wins over both.
151
+ defaultMode: 'dark',
152
+ respectPrefersColorScheme: false,
153
+ },
154
+ navbar: {
155
+ title: 'Graphiti',
156
+ logo: {alt: 'Graphiti', src: 'img/logo.png'},
157
+ items: [
158
+ {
159
+ type: 'docsVersionDropdown',
160
+ position: 'right',
161
+ // 1.x stays as the original Jekyll site, frozen under /1.13.
162
+ //
163
+ // The pathname:// prefix is required. It is Docusaurus' escape hatch
164
+ // for a path that is served statically but is not an app route:
165
+ // without it the link renders as a react-router push, which finds no
166
+ // match and shows the 404 page even though the file is served fine.
167
+ // The prefix is stripped before baseUrl is applied, and it also makes
168
+ // the link count as external, hence target '_self' to keep it from
169
+ // opening in a new tab.
170
+ dropdownItemsAfter: [
171
+ {href: 'pathname:///1.13/', label: '1.x', target: '_self'},
172
+ ],
173
+ },
174
+ {href: 'https://github.com/graphiti-api/graphiti', label: 'GitHub', position: 'right'},
175
+ {href: 'https://discord.gg/wgqkMBsSRV', label: 'Discord', position: 'right'},
176
+ ],
177
+ },
178
+ footer: {
179
+ style: 'dark',
180
+ copyright: [
181
+ 'Originally created by <a href="https://github.com/richmolj">Lee Richmond</a>,',
182
+ '<a href="https://github.com/wadetandy">Wade Tandy</a>, and',
183
+ '<a href="https://github.com/wagenet">Peter Wagenet</a>.',
184
+ 'Maintained by <a href="https://github.com/jkeen">Jeff Keen</a>',
185
+ 'with <a href="https://github.com/graphiti-api/graphiti/graphs/contributors">many contributors</a>.',
186
+ '<br />Graphiti is released under the MIT license.',
187
+ ].join(' '),
188
+ },
189
+ prism: {
190
+ theme: withoutDiffDecoration(themes.oneLight),
191
+ darkTheme: withoutDiffDecoration(codeBlockTheme(themes.oneDark, '#21252b')),
192
+ additionalLanguages: ['ruby', 'bash', 'json', 'http', 'diff'],
193
+ },
194
+ },
195
+ };
196
+
197
+ module.exports = config;