@coffre/ui 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +8 -2
  3. package/dist/client/.assetsignore +2 -0
  4. package/dist/client/_coffre/assets/account-C3Zo1l5A.js +1 -0
  5. package/dist/client/_coffre/assets/account-C4bNbeO7.js +2 -0
  6. package/dist/client/_coffre/assets/affordances-DiuJIiR2.js +1 -0
  7. package/dist/client/_coffre/assets/audit-1xLyuxGz.js +2 -0
  8. package/dist/client/_coffre/assets/audit-Dab2GuRj.js +1 -0
  9. package/dist/client/_coffre/assets/auth.device-BfCfeBWe.js +2 -0
  10. package/dist/client/_coffre/assets/auth.device-D2pCLF-X.js +1 -0
  11. package/dist/client/_coffre/assets/coffre-C7qL3HGR.js +1 -0
  12. package/dist/client/_coffre/assets/directory-C2Ou4SQv.js +1 -0
  13. package/dist/client/_coffre/assets/globals-Dgq4Jy0x.css +1 -0
  14. package/dist/client/_coffre/assets/grants-fqTtJ-aW.js +1 -0
  15. package/dist/client/_coffre/assets/index-BpGwbjmM.js +12 -0
  16. package/dist/client/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
  17. package/dist/client/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
  18. package/dist/client/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
  19. package/dist/client/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
  20. package/dist/client/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
  21. package/dist/client/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
  22. package/dist/client/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
  23. package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  24. package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  25. package/dist/client/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  26. package/dist/client/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  27. package/dist/client/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  28. package/dist/client/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  29. package/dist/client/_coffre/assets/login-CR9CBXlw.js +2 -0
  30. package/dist/client/_coffre/assets/login-DZizFxa4.js +1 -0
  31. package/dist/client/_coffre/assets/offboarding-DOLJQcXU.js +1 -0
  32. package/dist/client/_coffre/assets/page-BxW2MwaX.js +1 -0
  33. package/dist/client/_coffre/assets/preload-helper-BHuP8_FL.js +46 -0
  34. package/dist/client/_coffre/assets/principal-page-xnBZVURr.js +1 -0
  35. package/dist/client/_coffre/assets/project-environments-CfIH5kFM.js +1 -0
  36. package/dist/client/_coffre/assets/projects._project._environment-CrWjQmIA.js +2 -0
  37. package/dist/client/_coffre/assets/projects._project._environment-CwRVG9Ne.js +3 -0
  38. package/dist/client/_coffre/assets/projects._project.index-CCDEuE-z.js +2 -0
  39. package/dist/client/_coffre/assets/projects._project.index-DCJsmnD7.js +1 -0
  40. package/dist/client/_coffre/assets/projects.index-B8eV8JIn.js +1 -0
  41. package/dist/client/_coffre/assets/projects.index-BNEC7Oz8.js +2 -0
  42. package/dist/client/_coffre/assets/settings-2BPsenNM.js +2 -0
  43. package/dist/client/_coffre/assets/settings-BrS0-wEt.js +1 -0
  44. package/dist/client/_coffre/assets/signin-errors-CroZWZgm.js +1 -0
  45. package/dist/client/_coffre/assets/tokens._token-B3-YwuKp.js +2 -0
  46. package/dist/client/_coffre/assets/tokens._token-D_hsbHx6.js +1 -0
  47. package/dist/client/_coffre/assets/tokens.index-BdKE2Jv8.js +2 -0
  48. package/dist/client/_coffre/assets/tokens.index-XvA4XRxh.js +1 -0
  49. package/dist/client/_coffre/assets/unregistered-CTRMtBIy.js +1 -0
  50. package/dist/client/_coffre/assets/use-action-DgAf-tiX.js +1 -0
  51. package/dist/client/_coffre/assets/users._user-BFPXcJ4y.js +2 -0
  52. package/dist/client/_coffre/assets/users._user-DEtMeSoh.js +1 -0
  53. package/dist/client/_coffre/assets/users.index-B03beUHq.js +1 -0
  54. package/dist/client/_coffre/assets/users.index-D8hwzM6P.js +2 -0
  55. package/dist/client/_coffre/assets/validation-9Cl_XS-l.js +1 -0
  56. package/dist/index.d.ts +19 -0
  57. package/dist/server/.vite/manifest.json +572 -0
  58. package/dist/server/_coffre/assets/_tanstack-start-manifest_v-B6CZDfrB.js +133 -0
  59. package/dist/server/_coffre/assets/account-B71_b5xc.js +296 -0
  60. package/dist/server/_coffre/assets/account-BoO6ZqMc.js +176 -0
  61. package/dist/server/_coffre/assets/affordances-BNaXjMOb.js +46 -0
  62. package/dist/server/_coffre/assets/async-local-storage-C0cwgkEr.js +3107 -0
  63. package/dist/server/_coffre/assets/audit-CwRFnSAY.js +74 -0
  64. package/dist/server/_coffre/assets/audit-t1sYjtrf.js +964 -0
  65. package/dist/server/_coffre/assets/auth.device-1IcJ475s.js +208 -0
  66. package/dist/server/_coffre/assets/auth.device-CJwZYYtn.js +29 -0
  67. package/dist/server/_coffre/assets/coffre-1hxT2E_U.js +278 -0
  68. package/dist/server/_coffre/assets/directory-wm_JQUfk.js +396 -0
  69. package/dist/server/_coffre/assets/empty-plugin-adapters-Cq4--YW-.js +5 -0
  70. package/dist/server/_coffre/assets/globals-Dgq4Jy0x.css +1 -0
  71. package/dist/server/_coffre/assets/grants-BmhEY1vz.js +243 -0
  72. package/dist/server/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
  73. package/dist/server/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
  74. package/dist/server/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
  75. package/dist/server/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
  76. package/dist/server/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
  77. package/dist/server/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
  78. package/dist/server/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
  79. package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
  80. package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
  81. package/dist/server/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
  82. package/dist/server/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
  83. package/dist/server/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
  84. package/dist/server/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
  85. package/dist/server/_coffre/assets/login-B5O5LPXV.js +100 -0
  86. package/dist/server/_coffre/assets/login-Bvc4gp0X.js +22 -0
  87. package/dist/server/_coffre/assets/offboarding-CvSilnSm.js +330 -0
  88. package/dist/server/_coffre/assets/page-BjXk0Ehu.js +2003 -0
  89. package/dist/server/_coffre/assets/principal-page-DkwNGzM2.js +617 -0
  90. package/dist/server/_coffre/assets/project-environments-lEzFHUt4.js +9 -0
  91. package/dist/server/_coffre/assets/projects._project._environment-7grhqlgq.js +2227 -0
  92. package/dist/server/_coffre/assets/projects._project._environment-ByEf6pmz.js +55 -0
  93. package/dist/server/_coffre/assets/projects._project.index-B1bjowP-.js +932 -0
  94. package/dist/server/_coffre/assets/projects._project.index-DU8wtoHD.js +22 -0
  95. package/dist/server/_coffre/assets/projects.index-B0DoHbCz.js +280 -0
  96. package/dist/server/_coffre/assets/projects.index-kMDA6pMy.js +54 -0
  97. package/dist/server/_coffre/assets/react-dom-qCTiwGGR.js +1352 -0
  98. package/dist/server/_coffre/assets/router-ChU_CwCX.js +2028 -0
  99. package/dist/server/_coffre/assets/settings-CM9-h7in.js +18 -0
  100. package/dist/server/_coffre/assets/settings-Cg5qOGij.js +60 -0
  101. package/dist/server/_coffre/assets/signin-errors-BEFlVDbQ.js +28 -0
  102. package/dist/server/_coffre/assets/start-DR3rN0St.js +4 -0
  103. package/dist/server/_coffre/assets/tokens._token-CCpaPMAk.js +268 -0
  104. package/dist/server/_coffre/assets/tokens._token-Di4OZdAA.js +18 -0
  105. package/dist/server/_coffre/assets/tokens.index-Do3OHR31.js +34 -0
  106. package/dist/server/_coffre/assets/tokens.index-tDKq4AFh.js +10 -0
  107. package/dist/server/_coffre/assets/ui-BNzhIAQP.js +15710 -0
  108. package/dist/server/_coffre/assets/unregistered-BqaWYFJK.js +51 -0
  109. package/dist/server/_coffre/assets/use-action-BkJXC5JM.js +953 -0
  110. package/dist/server/_coffre/assets/useStore-DWGPqzXR.js +892 -0
  111. package/dist/server/_coffre/assets/users._user-BenYva93.js +15 -0
  112. package/dist/server/_coffre/assets/users._user-Cp039Va-.js +10 -0
  113. package/dist/server/_coffre/assets/users.index-BrzG1Ecq.js +10 -0
  114. package/dist/server/_coffre/assets/users.index-DQ_45DQl.js +34 -0
  115. package/dist/server/_coffre/assets/validation-BQtqPe2V.js +27 -0
  116. package/dist/server/index.js +13910 -0
  117. package/package.json +58 -3
  118. package/src/components/affordances.ts +80 -0
  119. package/src/components/agentation.tsx +34 -0
  120. package/src/components/command-palette.tsx +271 -0
  121. package/src/components/directory.tsx +448 -0
  122. package/src/components/grants.tsx +204 -0
  123. package/src/components/icons.tsx +283 -0
  124. package/src/components/offboarding.tsx +286 -0
  125. package/src/components/page.tsx +128 -0
  126. package/src/components/principal-page.tsx +549 -0
  127. package/src/components/principal-picker.tsx +168 -0
  128. package/src/components/principal.tsx +53 -0
  129. package/src/components/route-states.tsx +60 -0
  130. package/src/components/service-tokens.tsx +212 -0
  131. package/src/components/shell.tsx +641 -0
  132. package/src/components/syncs.tsx +581 -0
  133. package/src/components/theme.tsx +141 -0
  134. package/src/components/tile.tsx +22 -0
  135. package/src/components/ui.tsx +440 -0
  136. package/src/entry.ts +19 -0
  137. package/src/lib/access-plan.ts +201 -0
  138. package/src/lib/audit-sentences.ts +468 -0
  139. package/src/lib/capabilities.ts +45 -0
  140. package/src/lib/coffre.ts +57 -0
  141. package/src/lib/project-access.ts +95 -0
  142. package/src/lib/project-environments.ts +23 -0
  143. package/src/lib/reveal.ts +21 -0
  144. package/src/lib/secret-edit-batch.ts +181 -0
  145. package/src/lib/signin-errors.ts +33 -0
  146. package/src/lib/use-action.ts +50 -0
  147. package/src/lib/validation.ts +27 -0
  148. package/src/routeTree.gen.ts +367 -0
  149. package/src/router.tsx +84 -0
  150. package/src/routes/__root.tsx +192 -0
  151. package/src/routes/access.tsx +11 -0
  152. package/src/routes/account.tsx +359 -0
  153. package/src/routes/audit.tsx +545 -0
  154. package/src/routes/auth.device.tsx +200 -0
  155. package/src/routes/index.tsx +15 -0
  156. package/src/routes/login.tsx +129 -0
  157. package/src/routes/projects.$project.$environment.tsx +1659 -0
  158. package/src/routes/projects.$project.index.tsx +917 -0
  159. package/src/routes/projects.index.tsx +353 -0
  160. package/src/routes/settings.tsx +72 -0
  161. package/src/routes/tokens.$token.tsx +35 -0
  162. package/src/routes/tokens.index.tsx +37 -0
  163. package/src/routes/unregistered.tsx +59 -0
  164. package/src/routes/users.$user.tsx +13 -0
  165. package/src/routes/users.index.tsx +37 -0
  166. package/src/shared/models.ts +55 -0
  167. package/src/styles/globals.css +4118 -0
  168. package/src/types.ts +21 -0
@@ -0,0 +1,367 @@
1
+ /* eslint-disable */
2
+
3
+ // @ts-nocheck
4
+
5
+ // noinspection JSUnusedGlobalSymbols
6
+
7
+ // This file was automatically generated by TanStack Router.
8
+ // You should NOT make any changes in this file as it will be overwritten.
9
+ // Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
10
+
11
+ import { Route as rootRouteImport } from './routes/__root'
12
+ import { Route as IndexRouteImport } from './routes/index'
13
+ import { Route as AccessRouteImport } from './routes/access'
14
+ import { Route as AccountRouteImport } from './routes/account'
15
+ import { Route as AuditRouteImport } from './routes/audit'
16
+ import { Route as LoginRouteImport } from './routes/login'
17
+ import { Route as SettingsRouteImport } from './routes/settings'
18
+ import { Route as UnregisteredRouteImport } from './routes/unregistered'
19
+ import { Route as AuthDeviceRouteImport } from './routes/auth.device'
20
+ import { Route as ProjectsIndexRouteImport } from './routes/projects.index'
21
+ import { Route as TokensIndexRouteImport } from './routes/tokens.index'
22
+ import { Route as TokensTokenRouteImport } from './routes/tokens.$token'
23
+ import { Route as UsersIndexRouteImport } from './routes/users.index'
24
+ import { Route as UsersUserRouteImport } from './routes/users.$user'
25
+ import { Route as ProjectsProjectIndexRouteImport } from './routes/projects.$project.index'
26
+ import { Route as ProjectsProjectEnvironmentRouteImport } from './routes/projects.$project.$environment'
27
+
28
+ const IndexRoute = IndexRouteImport.update({
29
+ id: '/',
30
+ path: '/',
31
+ getParentRoute: () => rootRouteImport,
32
+ } as any)
33
+ const AccessRoute = AccessRouteImport.update({
34
+ id: '/access',
35
+ path: '/access',
36
+ getParentRoute: () => rootRouteImport,
37
+ } as any)
38
+ const AccountRoute = AccountRouteImport.update({
39
+ id: '/account',
40
+ path: '/account',
41
+ getParentRoute: () => rootRouteImport,
42
+ } as any)
43
+ const AuditRoute = AuditRouteImport.update({
44
+ id: '/audit',
45
+ path: '/audit',
46
+ getParentRoute: () => rootRouteImport,
47
+ } as any)
48
+ const LoginRoute = LoginRouteImport.update({
49
+ id: '/login',
50
+ path: '/login',
51
+ getParentRoute: () => rootRouteImport,
52
+ } as any)
53
+ const SettingsRoute = SettingsRouteImport.update({
54
+ id: '/settings',
55
+ path: '/settings',
56
+ getParentRoute: () => rootRouteImport,
57
+ } as any)
58
+ const UnregisteredRoute = UnregisteredRouteImport.update({
59
+ id: '/unregistered',
60
+ path: '/unregistered',
61
+ getParentRoute: () => rootRouteImport,
62
+ } as any)
63
+ const AuthDeviceRoute = AuthDeviceRouteImport.update({
64
+ id: '/auth/device',
65
+ path: '/auth/device',
66
+ getParentRoute: () => rootRouteImport,
67
+ } as any)
68
+ const ProjectsIndexRoute = ProjectsIndexRouteImport.update({
69
+ id: '/projects/',
70
+ path: '/projects/',
71
+ getParentRoute: () => rootRouteImport,
72
+ } as any)
73
+ const TokensIndexRoute = TokensIndexRouteImport.update({
74
+ id: '/tokens/',
75
+ path: '/tokens/',
76
+ getParentRoute: () => rootRouteImport,
77
+ } as any)
78
+ const TokensTokenRoute = TokensTokenRouteImport.update({
79
+ id: '/tokens/$token',
80
+ path: '/tokens/$token',
81
+ getParentRoute: () => rootRouteImport,
82
+ } as any)
83
+ const UsersIndexRoute = UsersIndexRouteImport.update({
84
+ id: '/users/',
85
+ path: '/users/',
86
+ getParentRoute: () => rootRouteImport,
87
+ } as any)
88
+ const UsersUserRoute = UsersUserRouteImport.update({
89
+ id: '/users/$user',
90
+ path: '/users/$user',
91
+ getParentRoute: () => rootRouteImport,
92
+ } as any)
93
+ const ProjectsProjectIndexRoute = ProjectsProjectIndexRouteImport.update({
94
+ id: '/projects/$project/',
95
+ path: '/projects/$project/',
96
+ getParentRoute: () => rootRouteImport,
97
+ } as any)
98
+ const ProjectsProjectEnvironmentRoute =
99
+ ProjectsProjectEnvironmentRouteImport.update({
100
+ id: '/projects/$project/$environment',
101
+ path: '/projects/$project/$environment',
102
+ getParentRoute: () => rootRouteImport,
103
+ } as any)
104
+
105
+ export interface FileRoutesByFullPath {
106
+ '/': typeof IndexRoute
107
+ '/access': typeof AccessRoute
108
+ '/account': typeof AccountRoute
109
+ '/audit': typeof AuditRoute
110
+ '/login': typeof LoginRoute
111
+ '/settings': typeof SettingsRoute
112
+ '/unregistered': typeof UnregisteredRoute
113
+ '/auth/device': typeof AuthDeviceRoute
114
+ '/tokens/$token': typeof TokensTokenRoute
115
+ '/users/$user': typeof UsersUserRoute
116
+ '/projects/': typeof ProjectsIndexRoute
117
+ '/tokens/': typeof TokensIndexRoute
118
+ '/users/': typeof UsersIndexRoute
119
+ '/projects/$project/$environment': typeof ProjectsProjectEnvironmentRoute
120
+ '/projects/$project/': typeof ProjectsProjectIndexRoute
121
+ }
122
+ export interface FileRoutesByTo {
123
+ '/': typeof IndexRoute
124
+ '/access': typeof AccessRoute
125
+ '/account': typeof AccountRoute
126
+ '/audit': typeof AuditRoute
127
+ '/login': typeof LoginRoute
128
+ '/settings': typeof SettingsRoute
129
+ '/unregistered': typeof UnregisteredRoute
130
+ '/auth/device': typeof AuthDeviceRoute
131
+ '/tokens/$token': typeof TokensTokenRoute
132
+ '/users/$user': typeof UsersUserRoute
133
+ '/projects': typeof ProjectsIndexRoute
134
+ '/tokens': typeof TokensIndexRoute
135
+ '/users': typeof UsersIndexRoute
136
+ '/projects/$project/$environment': typeof ProjectsProjectEnvironmentRoute
137
+ '/projects/$project': typeof ProjectsProjectIndexRoute
138
+ }
139
+ export interface FileRoutesById {
140
+ __root__: typeof rootRouteImport
141
+ '/': typeof IndexRoute
142
+ '/access': typeof AccessRoute
143
+ '/account': typeof AccountRoute
144
+ '/audit': typeof AuditRoute
145
+ '/login': typeof LoginRoute
146
+ '/settings': typeof SettingsRoute
147
+ '/unregistered': typeof UnregisteredRoute
148
+ '/auth/device': typeof AuthDeviceRoute
149
+ '/tokens/$token': typeof TokensTokenRoute
150
+ '/users/$user': typeof UsersUserRoute
151
+ '/projects/': typeof ProjectsIndexRoute
152
+ '/tokens/': typeof TokensIndexRoute
153
+ '/users/': typeof UsersIndexRoute
154
+ '/projects/$project/$environment': typeof ProjectsProjectEnvironmentRoute
155
+ '/projects/$project/': typeof ProjectsProjectIndexRoute
156
+ }
157
+ export interface FileRouteTypes {
158
+ fileRoutesByFullPath: FileRoutesByFullPath
159
+ fullPaths:
160
+ | '/'
161
+ | '/access'
162
+ | '/account'
163
+ | '/audit'
164
+ | '/login'
165
+ | '/settings'
166
+ | '/unregistered'
167
+ | '/auth/device'
168
+ | '/tokens/$token'
169
+ | '/users/$user'
170
+ | '/projects/'
171
+ | '/tokens/'
172
+ | '/users/'
173
+ | '/projects/$project/$environment'
174
+ | '/projects/$project/'
175
+ fileRoutesByTo: FileRoutesByTo
176
+ to:
177
+ | '/'
178
+ | '/access'
179
+ | '/account'
180
+ | '/audit'
181
+ | '/login'
182
+ | '/settings'
183
+ | '/unregistered'
184
+ | '/auth/device'
185
+ | '/tokens/$token'
186
+ | '/users/$user'
187
+ | '/projects'
188
+ | '/tokens'
189
+ | '/users'
190
+ | '/projects/$project/$environment'
191
+ | '/projects/$project'
192
+ id:
193
+ | '__root__'
194
+ | '/'
195
+ | '/access'
196
+ | '/account'
197
+ | '/audit'
198
+ | '/login'
199
+ | '/settings'
200
+ | '/unregistered'
201
+ | '/auth/device'
202
+ | '/tokens/$token'
203
+ | '/users/$user'
204
+ | '/projects/'
205
+ | '/tokens/'
206
+ | '/users/'
207
+ | '/projects/$project/$environment'
208
+ | '/projects/$project/'
209
+ fileRoutesById: FileRoutesById
210
+ }
211
+ export interface RootRouteChildren {
212
+ IndexRoute: typeof IndexRoute
213
+ AccessRoute: typeof AccessRoute
214
+ AccountRoute: typeof AccountRoute
215
+ AuditRoute: typeof AuditRoute
216
+ LoginRoute: typeof LoginRoute
217
+ SettingsRoute: typeof SettingsRoute
218
+ UnregisteredRoute: typeof UnregisteredRoute
219
+ AuthDeviceRoute: typeof AuthDeviceRoute
220
+ TokensTokenRoute: typeof TokensTokenRoute
221
+ UsersUserRoute: typeof UsersUserRoute
222
+ ProjectsIndexRoute: typeof ProjectsIndexRoute
223
+ TokensIndexRoute: typeof TokensIndexRoute
224
+ UsersIndexRoute: typeof UsersIndexRoute
225
+ ProjectsProjectEnvironmentRoute: typeof ProjectsProjectEnvironmentRoute
226
+ ProjectsProjectIndexRoute: typeof ProjectsProjectIndexRoute
227
+ }
228
+
229
+ declare module '@tanstack/react-router' {
230
+ interface FileRoutesByPath {
231
+ '/': {
232
+ id: '/'
233
+ path: '/'
234
+ fullPath: '/'
235
+ preLoaderRoute: typeof IndexRouteImport
236
+ parentRoute: typeof rootRouteImport
237
+ }
238
+ '/access': {
239
+ id: '/access'
240
+ path: '/access'
241
+ fullPath: '/access'
242
+ preLoaderRoute: typeof AccessRouteImport
243
+ parentRoute: typeof rootRouteImport
244
+ }
245
+ '/account': {
246
+ id: '/account'
247
+ path: '/account'
248
+ fullPath: '/account'
249
+ preLoaderRoute: typeof AccountRouteImport
250
+ parentRoute: typeof rootRouteImport
251
+ }
252
+ '/audit': {
253
+ id: '/audit'
254
+ path: '/audit'
255
+ fullPath: '/audit'
256
+ preLoaderRoute: typeof AuditRouteImport
257
+ parentRoute: typeof rootRouteImport
258
+ }
259
+ '/login': {
260
+ id: '/login'
261
+ path: '/login'
262
+ fullPath: '/login'
263
+ preLoaderRoute: typeof LoginRouteImport
264
+ parentRoute: typeof rootRouteImport
265
+ }
266
+ '/settings': {
267
+ id: '/settings'
268
+ path: '/settings'
269
+ fullPath: '/settings'
270
+ preLoaderRoute: typeof SettingsRouteImport
271
+ parentRoute: typeof rootRouteImport
272
+ }
273
+ '/unregistered': {
274
+ id: '/unregistered'
275
+ path: '/unregistered'
276
+ fullPath: '/unregistered'
277
+ preLoaderRoute: typeof UnregisteredRouteImport
278
+ parentRoute: typeof rootRouteImport
279
+ }
280
+ '/auth/device': {
281
+ id: '/auth/device'
282
+ path: '/auth/device'
283
+ fullPath: '/auth/device'
284
+ preLoaderRoute: typeof AuthDeviceRouteImport
285
+ parentRoute: typeof rootRouteImport
286
+ }
287
+ '/projects/': {
288
+ id: '/projects/'
289
+ path: '/projects'
290
+ fullPath: '/projects/'
291
+ preLoaderRoute: typeof ProjectsIndexRouteImport
292
+ parentRoute: typeof rootRouteImport
293
+ }
294
+ '/tokens/': {
295
+ id: '/tokens/'
296
+ path: '/tokens'
297
+ fullPath: '/tokens/'
298
+ preLoaderRoute: typeof TokensIndexRouteImport
299
+ parentRoute: typeof rootRouteImport
300
+ }
301
+ '/tokens/$token': {
302
+ id: '/tokens/$token'
303
+ path: '/tokens/$token'
304
+ fullPath: '/tokens/$token'
305
+ preLoaderRoute: typeof TokensTokenRouteImport
306
+ parentRoute: typeof rootRouteImport
307
+ }
308
+ '/users/': {
309
+ id: '/users/'
310
+ path: '/users'
311
+ fullPath: '/users/'
312
+ preLoaderRoute: typeof UsersIndexRouteImport
313
+ parentRoute: typeof rootRouteImport
314
+ }
315
+ '/users/$user': {
316
+ id: '/users/$user'
317
+ path: '/users/$user'
318
+ fullPath: '/users/$user'
319
+ preLoaderRoute: typeof UsersUserRouteImport
320
+ parentRoute: typeof rootRouteImport
321
+ }
322
+ '/projects/$project/': {
323
+ id: '/projects/$project/'
324
+ path: '/projects/$project'
325
+ fullPath: '/projects/$project/'
326
+ preLoaderRoute: typeof ProjectsProjectIndexRouteImport
327
+ parentRoute: typeof rootRouteImport
328
+ }
329
+ '/projects/$project/$environment': {
330
+ id: '/projects/$project/$environment'
331
+ path: '/projects/$project/$environment'
332
+ fullPath: '/projects/$project/$environment'
333
+ preLoaderRoute: typeof ProjectsProjectEnvironmentRouteImport
334
+ parentRoute: typeof rootRouteImport
335
+ }
336
+ }
337
+ }
338
+
339
+ const rootRouteChildren: RootRouteChildren = {
340
+ IndexRoute: IndexRoute,
341
+ AccessRoute: AccessRoute,
342
+ AccountRoute: AccountRoute,
343
+ AuditRoute: AuditRoute,
344
+ LoginRoute: LoginRoute,
345
+ SettingsRoute: SettingsRoute,
346
+ UnregisteredRoute: UnregisteredRoute,
347
+ AuthDeviceRoute: AuthDeviceRoute,
348
+ TokensTokenRoute: TokensTokenRoute,
349
+ UsersUserRoute: UsersUserRoute,
350
+ ProjectsIndexRoute: ProjectsIndexRoute,
351
+ TokensIndexRoute: TokensIndexRoute,
352
+ UsersIndexRoute: UsersIndexRoute,
353
+ ProjectsProjectEnvironmentRoute: ProjectsProjectEnvironmentRoute,
354
+ ProjectsProjectIndexRoute: ProjectsProjectIndexRoute,
355
+ }
356
+ export const routeTree = rootRouteImport
357
+ ._addFileChildren(rootRouteChildren)
358
+ ._addFileTypes<FileRouteTypes>()
359
+
360
+ import type { getRouter } from './router.tsx'
361
+ import type { createStart } from '@tanstack/react-start'
362
+ declare module '@tanstack/react-start' {
363
+ interface Register {
364
+ ssr: true
365
+ router: Awaited<ReturnType<typeof getRouter>>
366
+ }
367
+ }
package/src/router.tsx ADDED
@@ -0,0 +1,84 @@
1
+ import { createClient, type CoffreClient } from '@coffre/client';
2
+ import { createRouter as createTanStackRouter } from '@tanstack/react-router';
3
+ import { getGlobalStartContext } from '@tanstack/react-start';
4
+ import { routeTree } from './routeTree.gen';
5
+ import { NotFound, RouteError } from './components/route-states';
6
+
7
+ /**
8
+ * The router factory. TanStack Start calls this once per request on the server
9
+ * and once on the client.
10
+ *
11
+ * Note what is deliberately absent: any caching of loader data. Every screen in
12
+ * this app reports authorisation state that another person can change from
13
+ * another tab, so a stale project list or grant table is not a cosmetic
14
+ * problem. `staleTime: 0` means a navigation back to a screen refetches it,
15
+ * which is the behaviour the Next.js version got from `force-dynamic`.
16
+ */
17
+ export function getRouter() {
18
+ return createTanStackRouter({
19
+ routeTree,
20
+ defaultPreload: 'intent',
21
+ defaultStaleTime: 0,
22
+ scrollRestoration: true,
23
+ defaultNotFoundComponent: NotFound,
24
+ defaultErrorComponent: RouteError,
25
+ ssr: { nonce: cspNonce() },
26
+ context: { client: requestClient() },
27
+ });
28
+ }
29
+
30
+ /**
31
+ * The API as this visitor, which every loader reads through:
32
+ * `context.client.secrets.list('market/dev')`. On the server `@coffre/server`
33
+ * builds it per request, calling the API in process with the visitor's
34
+ * credential (`server/fetch-api.ts`); the UI only uses it. In the browser it
35
+ * is plain `fetch` to `/api`, which sends the session cookie itself.
36
+ */
37
+ function requestClient(): CoffreClient {
38
+ if (typeof window !== 'undefined') return createClient({ url: window.location.origin });
39
+ try {
40
+ const client = getGlobalStartContext()?.client;
41
+ if (client !== undefined) return client;
42
+ } catch {
43
+ // As for the nonce, below: outside a request there is no one to ask as.
44
+ }
45
+ return createClient({
46
+ url: 'http://coffre.invalid',
47
+ transport: () => Promise.reject(new Error('no request to call the API for')),
48
+ });
49
+ }
50
+
51
+ /**
52
+ * The nonce the server minted for this response's Content-Security-Policy,
53
+ * which the router puts on every script it renders. The client has none to
54
+ * give: hydration reads it back from the page. A router built only to
55
+ * resolve a redirect runs outside the request's context and renders nothing.
56
+ */
57
+ function cspNonce(): string | undefined {
58
+ try {
59
+ return getGlobalStartContext()?.cspNonce;
60
+ } catch {
61
+ return undefined;
62
+ }
63
+ }
64
+
65
+ /** What `@coffre/server` hands every request; see `types.ts`. */
66
+ type RequestContext = { cspNonce: string; client: CoffreClient };
67
+
68
+ /** What every loader and component can reach through the router. */
69
+ export type RouterContext = { client: CoffreClient };
70
+
71
+ // Start's server entry reads this `Register`, and its context helpers the
72
+ // one below: the two do not merge, so each hears of the request context.
73
+ declare module '@tanstack/react-router' {
74
+ interface Register {
75
+ router: ReturnType<typeof getRouter>;
76
+ server: { requestContext: RequestContext };
77
+ }
78
+ }
79
+
80
+ declare module '@tanstack/react-start' {
81
+ interface Register {
82
+ server: { requestContext: RequestContext };
83
+ }
84
+ }
@@ -0,0 +1,192 @@
1
+ import { CoffreError, type CoffreClient } from '@coffre/client';
2
+ import type { ReactNode } from 'react';
3
+ import {
4
+ createRootRouteWithContext,
5
+ HeadContent,
6
+ Outlet,
7
+ redirect,
8
+ ScriptOnce,
9
+ Scripts,
10
+ useRouterState,
11
+ } from '@tanstack/react-router';
12
+ import { Toaster } from 'sonner';
13
+ import globalsCss from '../styles/globals.css?url';
14
+ import { deriveUiCapabilities } from '../lib/capabilities';
15
+ import type { RouterContext } from '../router';
16
+ import type { Me } from '../shared/models';
17
+ import { Brand, Shell, sidebarBootScript } from '../components/shell';
18
+ import { TooltipProvider } from '../components/ui';
19
+ import { ThemeToggle, themeBootScript } from '../components/theme';
20
+ import { Agentation } from '../components/agentation';
21
+ import { MARK_SVG } from '../components/icons';
22
+
23
+ export const Route = createRootRouteWithContext<RouterContext>()({
24
+ head: () => ({
25
+ meta: [
26
+ { charSet: 'utf-8' },
27
+ { name: 'viewport', content: 'width=device-width, initial-scale=1' },
28
+ { title: 'coffre' },
29
+ { name: 'description', content: 'Secrets, with an audit log' },
30
+ ],
31
+ links: [
32
+ { rel: 'stylesheet', href: globalsCss },
33
+ // Inline, so the icon needs no route of its own: in Cloudflare mode
34
+ // every path but the health checks is behind Access.
35
+ { rel: 'icon', type: 'image/svg+xml', href: `data:image/svg+xml,${encodeURIComponent(MARK_SVG)}` },
36
+ ],
37
+ }),
38
+
39
+ // Identity and the project tree, which the shell needs on every screen.
40
+ loader: async ({ context: { client }, location }) => {
41
+ const shell = await loadShell(client);
42
+
43
+ if (shell.registrationRequired && location.pathname !== '/unregistered') {
44
+ throw redirect({ to: '/unregistered' });
45
+ }
46
+
47
+ // Signed out, the app has nothing to show. Letting it be browsed anyway
48
+ // put a "you are not signed in" notice in the middle of every page, which
49
+ // reads as a broken screen rather than as a closed door. Where they were
50
+ // headed rides along so signing in resumes it.
51
+ if (shell.principal === null && location.pathname !== '/login') {
52
+ throw redirect({ to: '/login', search: { next: location.href } });
53
+ }
54
+
55
+ // Once the API has authenticated the caller, the sign-in page, or behind
56
+ // Access the page explaining why it could not, has no place on screen.
57
+ if (shell.principal !== null && location.pathname === '/login') {
58
+ throw redirect({ to: '/projects' });
59
+ }
60
+ if (
61
+ shell.principal !== null &&
62
+ !shell.registrationRequired &&
63
+ location.pathname === '/unregistered'
64
+ ) {
65
+ throw redirect({ to: '/projects' });
66
+ }
67
+
68
+ return shell;
69
+ },
70
+
71
+ shellComponent: RootDocument,
72
+ component: RootComponent,
73
+ });
74
+
75
+ /**
76
+ * Who is looking, how this instance signs people in, and the projects they
77
+ * can see. Three calls at once: for someone signed out or not yet a member,
78
+ * the project list is refused, and they get the sign-in or closed-door page.
79
+ */
80
+ async function loadShell(client: CoffreClient) {
81
+ const [auth, me, projects] = await Promise.all([
82
+ client.auth(),
83
+ client.me().catch((error: unknown) => {
84
+ if (error instanceof CoffreError && error.status === 401) return null;
85
+ throw error;
86
+ }),
87
+ client.projects.list().then(
88
+ ({ projects }) => projects,
89
+ () => [],
90
+ ),
91
+ ]);
92
+ const member: Me | null = me?.registered === true ? me : null;
93
+ return {
94
+ auth,
95
+ principal: me === null ? null : me.principal,
96
+ instanceRole: member?.instanceRole ?? null,
97
+ projects,
98
+ capabilities: deriveUiCapabilities(member, projects),
99
+ registrationRequired: me !== null && !me.registered,
100
+ /** A member the vault refuses: their record failed its integrity check. */
101
+ accessTampered: me?.tampered === true,
102
+ };
103
+ }
104
+
105
+ function RootDocument({ children }: { children: ReactNode }) {
106
+ return (
107
+ <html lang="en" suppressHydrationWarning>
108
+ <head>
109
+ <HeadContent />
110
+ {/* Must run before first paint; see the comments on each script.
111
+ ScriptOnce gives them the page's CSP nonce, and removes them
112
+ once run so hydration finds nothing to reconcile. */}
113
+ <ScriptOnce>{themeBootScript}</ScriptOnce>
114
+ <ScriptOnce>{sidebarBootScript}</ScriptOnce>
115
+ </head>
116
+ <body>
117
+ {children}
118
+ <Scripts />
119
+ </body>
120
+ </html>
121
+ );
122
+ }
123
+
124
+ function Toasts() {
125
+ return (
126
+ <Toaster
127
+ position="bottom-right"
128
+ gap={10}
129
+ offset={20}
130
+ toastOptions={{
131
+ duration: 4200,
132
+ unstyled: true,
133
+ classNames: {
134
+ toast: 'toast',
135
+ title: 'toast-title',
136
+ description: 'toast-description',
137
+ actionButton: 'toast-action',
138
+ success: 'toast-success',
139
+ error: 'toast-error',
140
+ },
141
+ }}
142
+ />
143
+ );
144
+ }
145
+
146
+ function RootComponent() {
147
+ const { principal, instanceRole, projects, capabilities } = Route.useLoaderData();
148
+ const pathname = useRouterState({ select: (state) => state.location.pathname });
149
+
150
+ // Sign-in gets no navigation. Every destination in the sidebar and the
151
+ // command palette bounces straight back here while you are signed out, so
152
+ // offering them is a loop dressed up as navigation. The brand stays, as a
153
+ // mark rather than a link, so the page is still recognisably this app.
154
+ // Approving a CLI sign-in is the same kind of single-purpose stop.
155
+ if (pathname === '/login' || pathname === '/unregistered' || pathname === '/auth/device') {
156
+ return (
157
+ <TooltipProvider>
158
+ <div className="solo">
159
+ <div className="solo-top">
160
+ <Brand />
161
+ <ThemeToggle />
162
+ </div>
163
+ <main className="solo-main" id="content">
164
+ <Outlet />
165
+ </main>
166
+ </div>
167
+ <Toasts />
168
+ <Agentation />
169
+ </TooltipProvider>
170
+ );
171
+ }
172
+
173
+ return (
174
+ <TooltipProvider>
175
+ <a className="skip-link" href="#content">
176
+ Skip to content
177
+ </a>
178
+
179
+ <Shell
180
+ projects={projects}
181
+ principal={principal}
182
+ instanceRole={instanceRole}
183
+ capabilities={capabilities}
184
+ >
185
+ <Outlet />
186
+ </Shell>
187
+
188
+ <Toasts />
189
+ <Agentation />
190
+ </TooltipProvider>
191
+ );
192
+ }
@@ -0,0 +1,11 @@
1
+ import { createFileRoute, redirect } from '@tanstack/react-router';
2
+
3
+ /**
4
+ * The directory used to be one page here. It is now Users and Tokens; the
5
+ * old address still lands somewhere sensible for bookmarks and links.
6
+ */
7
+ export const Route = createFileRoute('/access')({
8
+ beforeLoad: () => {
9
+ throw redirect({ to: '/users' });
10
+ },
11
+ });