@selvajs/platform 0.21.0-beta.2 → 1.0.0-beta.4

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 (362) hide show
  1. package/README.md +10 -7
  2. package/dist/access/index.d.ts +1 -2
  3. package/dist/access/index.js +1 -2
  4. package/dist/access/rules.d.ts +11 -12
  5. package/dist/access/rules.js +27 -23
  6. package/dist/apiTokens/index.d.ts +2 -3
  7. package/dist/apiTokens/index.js +2 -3
  8. package/dist/apiTokens/interface.d.ts +0 -1
  9. package/dist/apiTokens/interface.js +0 -1
  10. package/dist/apiTokens/scope.d.ts +3 -2
  11. package/dist/apiTokens/scope.js +9 -5
  12. package/dist/apiTokens/types.d.ts +7 -2
  13. package/dist/apiTokens/types.js +10 -5
  14. package/dist/auth/index.d.ts +0 -1
  15. package/dist/auth/index.js +0 -1
  16. package/dist/auth/interface.d.ts +4 -23
  17. package/dist/auth/interface.js +0 -1
  18. package/dist/auth/types.d.ts +4 -2
  19. package/dist/auth/types.js +0 -1
  20. package/dist/bindings/index.d.ts +0 -1
  21. package/dist/bindings/index.js +0 -1
  22. package/dist/bindings/interface.d.ts +0 -1
  23. package/dist/bindings/interface.js +0 -1
  24. package/dist/computeServer/index.d.ts +1 -7
  25. package/dist/computeServer/index.js +2 -8
  26. package/dist/computeServer/interface.d.ts +9 -6
  27. package/dist/computeServer/interface.js +0 -1
  28. package/dist/computeServer/public.d.ts +6 -0
  29. package/dist/computeServer/public.js +2 -0
  30. package/dist/computeServer/secrets.d.ts +12 -6
  31. package/dist/computeServer/secrets.js +35 -15
  32. package/dist/computeServer/types.d.ts +5 -2
  33. package/dist/computeServer/types.js +4 -1
  34. package/dist/computeServer/utils.d.ts +17 -6
  35. package/dist/computeServer/utils.js +31 -21
  36. package/dist/config.d.ts +1 -2
  37. package/dist/config.js +0 -1
  38. package/dist/context.d.ts +12 -1
  39. package/dist/context.js +51 -2
  40. package/dist/data/index.d.ts +0 -1
  41. package/dist/data/index.js +0 -1
  42. package/dist/data/interface.d.ts +0 -1
  43. package/dist/data/interface.js +0 -1
  44. package/dist/definitions/index.d.ts +2 -3
  45. package/dist/definitions/index.js +2 -3
  46. package/dist/definitions/interface.d.ts +0 -1
  47. package/dist/definitions/interface.js +0 -1
  48. package/dist/definitions/paths.d.ts +0 -1
  49. package/dist/definitions/paths.js +1 -12
  50. package/dist/definitions/schemas.d.ts +2 -21
  51. package/dist/definitions/schemas.js +10 -19
  52. package/dist/definitions/types.d.ts +12 -4
  53. package/dist/definitions/types.js +1 -3
  54. package/dist/errors/interface.d.ts +1 -2
  55. package/dist/errors/interface.js +0 -1
  56. package/dist/errors.d.ts +8 -1
  57. package/dist/errors.js +11 -1
  58. package/dist/events/audit.d.ts +1 -2
  59. package/dist/events/audit.js +0 -1
  60. package/dist/events/index.d.ts +0 -1
  61. package/dist/events/index.js +0 -1
  62. package/dist/events/interface.d.ts +0 -1
  63. package/dist/events/interface.js +0 -1
  64. package/dist/index.d.ts +18 -61
  65. package/dist/index.js +18 -24
  66. package/dist/invites/index.d.ts +0 -1
  67. package/dist/invites/index.js +0 -1
  68. package/dist/invites/interface.d.ts +5 -6
  69. package/dist/invites/interface.js +0 -1
  70. package/dist/invites/types.d.ts +0 -1
  71. package/dist/invites/types.js +0 -1
  72. package/dist/logging/interface.d.ts +0 -1
  73. package/dist/logging/interface.js +0 -1
  74. package/dist/metrics/interface.d.ts +0 -1
  75. package/dist/metrics/interface.js +0 -1
  76. package/dist/notifications/index.d.ts +0 -1
  77. package/dist/notifications/index.js +0 -1
  78. package/dist/notifications/interface.d.ts +1 -3
  79. package/dist/notifications/interface.js +1 -3
  80. package/dist/notifications/types.d.ts +0 -1
  81. package/dist/notifications/types.js +0 -1
  82. package/dist/organizations/index.d.ts +2 -3
  83. package/dist/organizations/index.js +1 -2
  84. package/dist/organizations/interface.d.ts +3 -5
  85. package/dist/organizations/interface.js +0 -1
  86. package/dist/organizations/paths.d.ts +1 -6
  87. package/dist/organizations/paths.js +2 -20
  88. package/dist/organizations/schemas.d.ts +5 -7
  89. package/dist/organizations/schemas.js +20 -13
  90. package/dist/organizations/types.d.ts +0 -1
  91. package/dist/organizations/types.js +0 -1
  92. package/dist/pagination.d.ts +11 -3
  93. package/dist/pagination.js +15 -1
  94. package/dist/permissions/index.d.ts +2 -2
  95. package/dist/permissions/index.js +2 -2
  96. package/dist/permissions/interface.d.ts +4 -4
  97. package/dist/permissions/interface.js +0 -1
  98. package/dist/permissions/types.d.ts +0 -1
  99. package/dist/permissions/types.js +0 -1
  100. package/dist/platformProjects/index.d.ts +1 -3
  101. package/dist/platformProjects/index.js +1 -2
  102. package/dist/platformProjects/interface.d.ts +0 -1
  103. package/dist/platformProjects/interface.js +0 -1
  104. package/dist/platformProjects/schemas.d.ts +0 -1
  105. package/dist/platformProjects/schemas.js +0 -1
  106. package/dist/platformProjects/types.d.ts +3 -2
  107. package/dist/platformProjects/types.js +0 -1
  108. package/dist/projects/index.d.ts +0 -1
  109. package/dist/projects/index.js +0 -1
  110. package/dist/projects/interface.d.ts +0 -1
  111. package/dist/projects/interface.js +0 -1
  112. package/dist/projects/schemas.d.ts +0 -1
  113. package/dist/projects/schemas.js +0 -1
  114. package/dist/projects/types.d.ts +0 -1
  115. package/dist/projects/types.js +0 -1
  116. package/dist/shareLinks/index.d.ts +0 -1
  117. package/dist/shareLinks/index.js +0 -1
  118. package/dist/shareLinks/interface.d.ts +6 -3
  119. package/dist/shareLinks/interface.js +0 -1
  120. package/dist/shareLinks/schemas.d.ts +0 -1
  121. package/dist/shareLinks/schemas.js +4 -2
  122. package/dist/shareLinks/types.d.ts +0 -1
  123. package/dist/shareLinks/types.js +0 -1
  124. package/dist/solveCache/interface.d.ts +2 -3
  125. package/dist/solveCache/interface.js +0 -1
  126. package/dist/storage/assetClasses.d.ts +4 -8
  127. package/dist/storage/assetClasses.js +6 -21
  128. package/dist/storage/cacheBust.d.ts +0 -1
  129. package/dist/storage/cacheBust.js +5 -3
  130. package/dist/storage/image.d.ts +8 -5
  131. package/dist/storage/image.js +74 -12
  132. package/dist/storage/index.d.ts +2 -4
  133. package/dist/storage/index.js +2 -3
  134. package/dist/storage/interface.d.ts +11 -3
  135. package/dist/storage/interface.js +0 -1
  136. package/dist/storage/safeKey.d.ts +7 -0
  137. package/dist/storage/safeKey.js +12 -0
  138. package/dist/testing/index.d.ts +5 -2
  139. package/dist/testing/index.js +3 -2
  140. package/dist/testing/suites/apiTokenStoreSuite.d.ts +0 -1
  141. package/dist/testing/suites/apiTokenStoreSuite.js +0 -1
  142. package/dist/testing/suites/auditQuerySuite.d.ts +18 -0
  143. package/dist/testing/suites/auditQuerySuite.js +73 -0
  144. package/dist/testing/suites/authProviderSuite.d.ts +14 -3
  145. package/dist/testing/suites/authProviderSuite.js +57 -32
  146. package/dist/testing/suites/computeServerStoreSuite.d.ts +1 -2
  147. package/dist/testing/suites/computeServerStoreSuite.js +68 -4
  148. package/dist/testing/suites/definitionStoreSuite.d.ts +2 -1
  149. package/dist/testing/suites/definitionStoreSuite.js +48 -16
  150. package/dist/testing/suites/emailLinkAuthSuite.d.ts +2 -5
  151. package/dist/testing/suites/emailLinkAuthSuite.js +1 -9
  152. package/dist/testing/suites/eventSinkSuite.d.ts +0 -1
  153. package/dist/testing/suites/eventSinkSuite.js +9 -1
  154. package/dist/testing/suites/helpers.d.ts +5 -1
  155. package/dist/testing/suites/helpers.js +7 -1
  156. package/dist/testing/suites/inviteStoreSuite.d.ts +0 -1
  157. package/dist/testing/suites/inviteStoreSuite.js +17 -7
  158. package/dist/testing/suites/oauthAuthSuite.d.ts +18 -0
  159. package/dist/testing/suites/oauthAuthSuite.js +26 -0
  160. package/dist/testing/suites/orgStoreSuite.d.ts +5 -1
  161. package/dist/testing/suites/orgStoreSuite.js +26 -7
  162. package/dist/testing/suites/platformPermissionStoreSuite.d.ts +0 -5
  163. package/dist/testing/suites/platformPermissionStoreSuite.js +12 -63
  164. package/dist/testing/suites/platformProjectGrantStoreSuite.d.ts +0 -1
  165. package/dist/testing/suites/platformProjectGrantStoreSuite.js +0 -5
  166. package/dist/testing/suites/projectStoreSuite.d.ts +5 -1
  167. package/dist/testing/suites/projectStoreSuite.js +6 -6
  168. package/dist/testing/suites/shareLinkStoreSuite.d.ts +2 -1
  169. package/dist/testing/suites/shareLinkStoreSuite.js +22 -25
  170. package/dist/testing/suites/solveMetricSinkSuite.d.ts +0 -1
  171. package/dist/testing/suites/solveMetricSinkSuite.js +2 -2
  172. package/dist/testing/suites/storageProviderSuite.d.ts +0 -1
  173. package/dist/testing/suites/storageProviderSuite.js +15 -10
  174. package/dist/testing/suites/userProfileStoreSuite.d.ts +1 -2
  175. package/dist/testing/suites/userProfileStoreSuite.js +42 -7
  176. package/dist/userProfile/index.d.ts +2 -2
  177. package/dist/userProfile/index.js +2 -2
  178. package/dist/userProfile/interface.d.ts +5 -6
  179. package/dist/userProfile/interface.js +0 -1
  180. package/dist/userProfile/types.d.ts +2 -1
  181. package/dist/userProfile/types.js +2 -1
  182. package/dist/utils/audit.d.ts +0 -1
  183. package/dist/utils/audit.js +0 -1
  184. package/dist/utils/index.d.ts +0 -2
  185. package/dist/utils/index.js +0 -1
  186. package/package.json +7 -6
  187. package/dist/access/index.d.ts.map +0 -1
  188. package/dist/access/index.js.map +0 -1
  189. package/dist/access/rules.d.ts.map +0 -1
  190. package/dist/access/rules.js.map +0 -1
  191. package/dist/apiTokens/index.d.ts.map +0 -1
  192. package/dist/apiTokens/index.js.map +0 -1
  193. package/dist/apiTokens/interface.d.ts.map +0 -1
  194. package/dist/apiTokens/interface.js.map +0 -1
  195. package/dist/apiTokens/scope.d.ts.map +0 -1
  196. package/dist/apiTokens/scope.js.map +0 -1
  197. package/dist/apiTokens/types.d.ts.map +0 -1
  198. package/dist/apiTokens/types.js.map +0 -1
  199. package/dist/auth/index.d.ts.map +0 -1
  200. package/dist/auth/index.js.map +0 -1
  201. package/dist/auth/interface.d.ts.map +0 -1
  202. package/dist/auth/interface.js.map +0 -1
  203. package/dist/auth/types.d.ts.map +0 -1
  204. package/dist/auth/types.js.map +0 -1
  205. package/dist/bindings/index.d.ts.map +0 -1
  206. package/dist/bindings/index.js.map +0 -1
  207. package/dist/bindings/interface.d.ts.map +0 -1
  208. package/dist/bindings/interface.js.map +0 -1
  209. package/dist/computeServer/index.d.ts.map +0 -1
  210. package/dist/computeServer/index.js.map +0 -1
  211. package/dist/computeServer/interface.d.ts.map +0 -1
  212. package/dist/computeServer/interface.js.map +0 -1
  213. package/dist/computeServer/secrets.d.ts.map +0 -1
  214. package/dist/computeServer/secrets.js.map +0 -1
  215. package/dist/computeServer/types.d.ts.map +0 -1
  216. package/dist/computeServer/types.js.map +0 -1
  217. package/dist/computeServer/utils.d.ts.map +0 -1
  218. package/dist/computeServer/utils.js.map +0 -1
  219. package/dist/config.d.ts.map +0 -1
  220. package/dist/config.js.map +0 -1
  221. package/dist/context.d.ts.map +0 -1
  222. package/dist/context.js.map +0 -1
  223. package/dist/data/index.d.ts.map +0 -1
  224. package/dist/data/index.js.map +0 -1
  225. package/dist/data/interface.d.ts.map +0 -1
  226. package/dist/data/interface.js.map +0 -1
  227. package/dist/definitions/index.d.ts.map +0 -1
  228. package/dist/definitions/index.js.map +0 -1
  229. package/dist/definitions/interface.d.ts.map +0 -1
  230. package/dist/definitions/interface.js.map +0 -1
  231. package/dist/definitions/paths.d.ts.map +0 -1
  232. package/dist/definitions/paths.js.map +0 -1
  233. package/dist/definitions/schemas.d.ts.map +0 -1
  234. package/dist/definitions/schemas.js.map +0 -1
  235. package/dist/definitions/types.d.ts.map +0 -1
  236. package/dist/definitions/types.js.map +0 -1
  237. package/dist/errors/interface.d.ts.map +0 -1
  238. package/dist/errors/interface.js.map +0 -1
  239. package/dist/errors.d.ts.map +0 -1
  240. package/dist/errors.js.map +0 -1
  241. package/dist/events/audit.d.ts.map +0 -1
  242. package/dist/events/audit.js.map +0 -1
  243. package/dist/events/index.d.ts.map +0 -1
  244. package/dist/events/index.js.map +0 -1
  245. package/dist/events/interface.d.ts.map +0 -1
  246. package/dist/events/interface.js.map +0 -1
  247. package/dist/index.d.ts.map +0 -1
  248. package/dist/index.js.map +0 -1
  249. package/dist/invites/index.d.ts.map +0 -1
  250. package/dist/invites/index.js.map +0 -1
  251. package/dist/invites/interface.d.ts.map +0 -1
  252. package/dist/invites/interface.js.map +0 -1
  253. package/dist/invites/types.d.ts.map +0 -1
  254. package/dist/invites/types.js.map +0 -1
  255. package/dist/logging/interface.d.ts.map +0 -1
  256. package/dist/logging/interface.js.map +0 -1
  257. package/dist/metrics/interface.d.ts.map +0 -1
  258. package/dist/metrics/interface.js.map +0 -1
  259. package/dist/notifications/index.d.ts.map +0 -1
  260. package/dist/notifications/index.js.map +0 -1
  261. package/dist/notifications/interface.d.ts.map +0 -1
  262. package/dist/notifications/interface.js.map +0 -1
  263. package/dist/notifications/types.d.ts.map +0 -1
  264. package/dist/notifications/types.js.map +0 -1
  265. package/dist/organizations/index.d.ts.map +0 -1
  266. package/dist/organizations/index.js.map +0 -1
  267. package/dist/organizations/interface.d.ts.map +0 -1
  268. package/dist/organizations/interface.js.map +0 -1
  269. package/dist/organizations/paths.d.ts.map +0 -1
  270. package/dist/organizations/paths.js.map +0 -1
  271. package/dist/organizations/schemas.d.ts.map +0 -1
  272. package/dist/organizations/schemas.js.map +0 -1
  273. package/dist/organizations/types.d.ts.map +0 -1
  274. package/dist/organizations/types.js.map +0 -1
  275. package/dist/pagination.d.ts.map +0 -1
  276. package/dist/pagination.js.map +0 -1
  277. package/dist/permissions/index.d.ts.map +0 -1
  278. package/dist/permissions/index.js.map +0 -1
  279. package/dist/permissions/interface.d.ts.map +0 -1
  280. package/dist/permissions/interface.js.map +0 -1
  281. package/dist/permissions/types.d.ts.map +0 -1
  282. package/dist/permissions/types.js.map +0 -1
  283. package/dist/platformProjects/index.d.ts.map +0 -1
  284. package/dist/platformProjects/index.js.map +0 -1
  285. package/dist/platformProjects/interface.d.ts.map +0 -1
  286. package/dist/platformProjects/interface.js.map +0 -1
  287. package/dist/platformProjects/schemas.d.ts.map +0 -1
  288. package/dist/platformProjects/schemas.js.map +0 -1
  289. package/dist/platformProjects/types.d.ts.map +0 -1
  290. package/dist/platformProjects/types.js.map +0 -1
  291. package/dist/projects/index.d.ts.map +0 -1
  292. package/dist/projects/index.js.map +0 -1
  293. package/dist/projects/interface.d.ts.map +0 -1
  294. package/dist/projects/interface.js.map +0 -1
  295. package/dist/projects/schemas.d.ts.map +0 -1
  296. package/dist/projects/schemas.js.map +0 -1
  297. package/dist/projects/types.d.ts.map +0 -1
  298. package/dist/projects/types.js.map +0 -1
  299. package/dist/shareLinks/index.d.ts.map +0 -1
  300. package/dist/shareLinks/index.js.map +0 -1
  301. package/dist/shareLinks/interface.d.ts.map +0 -1
  302. package/dist/shareLinks/interface.js.map +0 -1
  303. package/dist/shareLinks/schemas.d.ts.map +0 -1
  304. package/dist/shareLinks/schemas.js.map +0 -1
  305. package/dist/shareLinks/types.d.ts.map +0 -1
  306. package/dist/shareLinks/types.js.map +0 -1
  307. package/dist/solveCache/interface.d.ts.map +0 -1
  308. package/dist/solveCache/interface.js.map +0 -1
  309. package/dist/storage/assetClasses.d.ts.map +0 -1
  310. package/dist/storage/assetClasses.js.map +0 -1
  311. package/dist/storage/cacheBust.d.ts.map +0 -1
  312. package/dist/storage/cacheBust.js.map +0 -1
  313. package/dist/storage/image.d.ts.map +0 -1
  314. package/dist/storage/image.js.map +0 -1
  315. package/dist/storage/index.d.ts.map +0 -1
  316. package/dist/storage/index.js.map +0 -1
  317. package/dist/storage/interface.d.ts.map +0 -1
  318. package/dist/storage/interface.js.map +0 -1
  319. package/dist/testing/index.d.ts.map +0 -1
  320. package/dist/testing/index.js.map +0 -1
  321. package/dist/testing/suites/apiTokenStoreSuite.d.ts.map +0 -1
  322. package/dist/testing/suites/apiTokenStoreSuite.js.map +0 -1
  323. package/dist/testing/suites/authProviderSuite.d.ts.map +0 -1
  324. package/dist/testing/suites/authProviderSuite.js.map +0 -1
  325. package/dist/testing/suites/computeServerStoreSuite.d.ts.map +0 -1
  326. package/dist/testing/suites/computeServerStoreSuite.js.map +0 -1
  327. package/dist/testing/suites/definitionStoreSuite.d.ts.map +0 -1
  328. package/dist/testing/suites/definitionStoreSuite.js.map +0 -1
  329. package/dist/testing/suites/emailLinkAuthSuite.d.ts.map +0 -1
  330. package/dist/testing/suites/emailLinkAuthSuite.js.map +0 -1
  331. package/dist/testing/suites/eventSinkSuite.d.ts.map +0 -1
  332. package/dist/testing/suites/eventSinkSuite.js.map +0 -1
  333. package/dist/testing/suites/helpers.d.ts.map +0 -1
  334. package/dist/testing/suites/helpers.js.map +0 -1
  335. package/dist/testing/suites/inviteStoreSuite.d.ts.map +0 -1
  336. package/dist/testing/suites/inviteStoreSuite.js.map +0 -1
  337. package/dist/testing/suites/orgStoreSuite.d.ts.map +0 -1
  338. package/dist/testing/suites/orgStoreSuite.js.map +0 -1
  339. package/dist/testing/suites/platformPermissionStoreSuite.d.ts.map +0 -1
  340. package/dist/testing/suites/platformPermissionStoreSuite.js.map +0 -1
  341. package/dist/testing/suites/platformProjectGrantStoreSuite.d.ts.map +0 -1
  342. package/dist/testing/suites/platformProjectGrantStoreSuite.js.map +0 -1
  343. package/dist/testing/suites/projectStoreSuite.d.ts.map +0 -1
  344. package/dist/testing/suites/projectStoreSuite.js.map +0 -1
  345. package/dist/testing/suites/shareLinkStoreSuite.d.ts.map +0 -1
  346. package/dist/testing/suites/shareLinkStoreSuite.js.map +0 -1
  347. package/dist/testing/suites/solveMetricSinkSuite.d.ts.map +0 -1
  348. package/dist/testing/suites/solveMetricSinkSuite.js.map +0 -1
  349. package/dist/testing/suites/storageProviderSuite.d.ts.map +0 -1
  350. package/dist/testing/suites/storageProviderSuite.js.map +0 -1
  351. package/dist/testing/suites/userProfileStoreSuite.d.ts.map +0 -1
  352. package/dist/testing/suites/userProfileStoreSuite.js.map +0 -1
  353. package/dist/userProfile/index.d.ts.map +0 -1
  354. package/dist/userProfile/index.js.map +0 -1
  355. package/dist/userProfile/interface.d.ts.map +0 -1
  356. package/dist/userProfile/interface.js.map +0 -1
  357. package/dist/userProfile/types.d.ts.map +0 -1
  358. package/dist/userProfile/types.js.map +0 -1
  359. package/dist/utils/audit.d.ts.map +0 -1
  360. package/dist/utils/audit.js.map +0 -1
  361. package/dist/utils/index.d.ts.map +0 -1
  362. package/dist/utils/index.js.map +0 -1
package/dist/errors.js CHANGED
@@ -2,12 +2,22 @@
2
2
  * Thrown by providers to signal an expected failure the API layer forwards with
3
3
  * a specific status. Unknown errors should propagate as plain `Error` and become 500s.
4
4
  */
5
+ const BRAND = Symbol.for('@selvajs/platform/ProviderError');
5
6
  export class ProviderError extends Error {
6
7
  statusCode;
8
+ [BRAND] = true;
9
+ /**
10
+ * Providers depend on this package, so a version mismatch installs two copies
11
+ * and plain `instanceof` would turn a 403 from one into a 500 in the other.
12
+ */
13
+ static [Symbol.hasInstance](value) {
14
+ if (this !== ProviderError)
15
+ return Function.prototype[Symbol.hasInstance].call(this, value);
16
+ return typeof value === 'object' && value !== null && BRAND in value;
17
+ }
7
18
  constructor(message, statusCode = 400) {
8
19
  super(message);
9
20
  this.name = 'ProviderError';
10
21
  this.statusCode = statusCode;
11
22
  }
12
23
  }
13
- //# sourceMappingURL=errors.js.map
@@ -34,7 +34,7 @@ export interface AuditQueryFilters {
34
34
  /** Inclusive bounds, ISO 8601. */
35
35
  sinceIso?: string;
36
36
  untilIso?: string;
37
- /** Implementations clamp to a sane upper bound (<=200). */
37
+ /** Implementations clamp to at least 1 and at most 200. */
38
38
  limit?: number;
39
39
  cursor?: AuditCursor;
40
40
  }
@@ -46,4 +46,3 @@ export interface AuditQueryResult {
46
46
  export interface IAuditQuery {
47
47
  list(ctx: RequestContext, filters: AuditQueryFilters): Promise<AuditQueryResult>;
48
48
  }
49
- //# sourceMappingURL=audit.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=audit.js.map
@@ -1,4 +1,3 @@
1
1
  export type { DomainEvent, DomainEventType, IEventSink } from './interface.js';
2
2
  export { actorFrom, actorOf, NoopEventSink, AUDIT_EVENT_VERSION } from './interface.js';
3
3
  export type { AuditEventRow, AuditCursor, AuditQueryFilters, AuditQueryResult, IAuditQuery } from './audit.js';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1 @@
1
1
  export { actorFrom, actorOf, NoopEventSink, AUDIT_EVENT_VERSION } from './interface.js';
2
- //# sourceMappingURL=index.js.map
@@ -227,4 +227,3 @@ export declare class NoopEventSink implements IEventSink {
227
227
  emit(_event: DomainEvent): Promise<void>;
228
228
  }
229
229
  export {};
230
- //# sourceMappingURL=interface.d.ts.map
@@ -21,4 +21,3 @@ export function actorOf(ctx) {
21
21
  export class NoopEventSink {
22
22
  async emit(_event) { }
23
23
  }
24
- //# sourceMappingURL=interface.js.map
package/dist/index.d.ts CHANGED
@@ -1,58 +1,20 @@
1
- export type { AuthUser, UserManagementResult, LoginResult } from './auth/types.js';
2
- export type { IAuthProvider, IOAuthAuth, ISessionRefresh, IPasswordAuth, IEmailLinkAuth, IProxyAuth, IDelegatedSession, DelegatedSessionStatus } from './auth/interface.js';
3
- export type { PlatformPermission } from './permissions/types.js';
4
- export { PlatformPermissionSchema, ALL_PLATFORM_PERMISSIONS, OPERATOR_PLATFORM_PERMISSIONS } from './permissions/types.js';
5
- export type { IPlatformPermissionStore } from './permissions/interface.js';
6
- export type { IUserProfileStore } from './userProfile/interface.js';
7
- export type { UserProfile, RecentRun } from './userProfile/types.js';
8
- export { emptyProfile } from './userProfile/types.js';
9
- export type { Organization, OrgMember, OrgAssets } from './organizations/types.js';
10
- export type { IOrgStore } from './organizations/interface.js';
11
- export { orgPaths } from './organizations/paths.js';
12
- export type { OrgRole, OrgPermission, OrgAssetKind, CreateOrgInput, UpdateOrgInput } from './organizations/schemas.js';
13
- export { OrgRoleSchema, OrgPermissionSchema, OrgAssetKindSchema, ALL_ORG_ASSET_KINDS, SlugSchema, slugify, RESERVED_SLUGS, CreateOrgSchema, UpdateOrgSchema, ALL_ORG_PERMISSIONS, DEFAULT_ORG_PERMISSIONS, OWNER_ADMIN_ONLY_PERMISSIONS, MEMBER_ASSIGNABLE_PERMISSIONS } from './organizations/schemas.js';
14
- export type { Invite } from './invites/types.js';
15
- export type { IInviteStore } from './invites/interface.js';
16
- export type { ApiScope, ApiScopeAction, ApiScopeResource, ApiToken, ApiTokenSummary, ApiTokenRevokeReason, ApiTokenLifetimeDays, IApiTokenStore, ScopeTarget } from './apiTokens/index.js';
17
- export { ApiScopeActionSchema, ApiScopeStringSchema, ApiTokenRevokeReasonSchema, API_TOKEN_LIFETIME_DAYS, parseApiScope, formatApiScope, describeApiScope, scopeAllows, narrowApiTokenContext, outsideTokenOrg } from './apiTokens/index.js';
18
- export type { Project, ProjectMember } from './projects/types.js';
19
- export type { IProjectStore } from './projects/interface.js';
20
- export type { ProjectVisibility, ProjectRole } from './projects/schemas.js';
21
- export { ProjectVisibilitySchema, ProjectRoleSchema, validateProjectFlags } from './projects/schemas.js';
22
- export type { PlatformProjectGrant, PlatformProjectGranteeType } from './platformProjects/types.js';
23
- export type { IPlatformProjectGrantStore } from './platformProjects/interface.js';
24
- export { PlatformProjectGrantSchema, PlatformProjectGranteeTypeSchema } from './platformProjects/schemas.js';
25
- export type { DefinitionFileExt, DefinitionListItem, DefinitionRecord, DefinitionRecordPatch, DefinitionStatus, DefinitionVersion, DefinitionChannel } from './definitions/types.js';
26
- export type { IDefinitionStore } from './definitions/interface.js';
27
- export type { UISchema } from '@selvajs/schemas';
28
- export { GH_EXTENSIONS, COVER_IMAGE_EXTENSIONS, ALLOWED_UPLOAD_EXTENSIONS, COVER_IMAGE_CONTENT_TYPES, toDefinitionListItem } from './definitions/types.js';
29
- export { definitionPaths } from './definitions/paths.js';
30
- export type { UpdateMetadataInput } from './definitions/schemas.js';
31
- export { DefinitionChannelSchema, PublishVersionInputSchema, CreateDefinitionInputSchema, UpdateMetadataInputSchema, GuidSchema, UUID_REGEX } from './definitions/schemas.js';
32
- export type { OrgShareLink, ShareLink } from './shareLinks/types.js';
33
- export type { IShareLinkStore } from './shareLinks/interface.js';
34
- export { DEFAULT_SHARE_LINK_MAX_SOLVES } from './shareLinks/types.js';
35
- export type { CreateShareLinkInput } from './shareLinks/schemas.js';
36
- export { CreateShareLinkInputSchema } from './shareLinks/schemas.js';
37
- export type { IStorageProvider } from './storage/interface.js';
38
- export { IMAGE_MAX_WIDTH, IMAGE_WEBP_QUALITY, isImageUpload, toWebpPath, transcodeImageIfNeeded } from './storage/image.js';
39
- export type { TranscodeResult } from './storage/image.js';
40
- export { ASSET_CLASSES, classifyAssetPath, isPublicAssetPath } from './storage/assetClasses.js';
41
- export type { AssetVisibility, AssetScope, AssetClass, AssetMatch } from './storage/assetClasses.js';
42
- export { withCacheBust } from './storage/cacheBust.js';
43
- export type { IDataProvider, SchemaVersionReport, UserErasureOptions } from './data/interface.js';
44
- export { ERASED_ACTOR_ID } from './data/interface.js';
45
- export type { ComputeServerConfig, ComputeConfig, PlatformComputeServer, OrgComputeServer } from './computeServer/types.js';
46
- export { isPlatformServer, isOrgServer } from './computeServer/types.js';
47
- export type { IComputeServerStore, GetConfigOptions } from './computeServer/interface.js';
48
- export type { SecretVerificationReport, SecretVerificationFailure, SecretVerificationFailureReason } from './computeServer/secrets.js';
49
- export type { ResolveOptions } from './computeServer/utils.js';
50
- export { serversVisibleTo, defaultServerIdFor, resolveServerForOrg, findServerById, platformServers, orgServersFor, scopeConfigToOrg } from './computeServer/utils.js';
51
- export type { ProjectAccessInput, DefinitionAccessInput, VisibilityChangeInput, ReclaimAccessInput, CreateProjectAccessInput, OrgOwnerAuthorityInput, OwnerRemovalInput, OwnerRemovalCheck } from './access/rules.js';
52
- export { canView, canSolve, canEdit, canManage, canEditProjectSettings, canChangeVisibilityToPublic, canEditDefinition, canReclaim, canCreateProject, canChangeOrgRole, checkOwnerRemoval, withAdminBypass } from './access/rules.js';
53
- export type { DomainEvent, DomainEventType, IEventSink } from './events/interface.js';
54
- export { actorFrom, actorOf, NoopEventSink, AUDIT_EVENT_VERSION } from './events/interface.js';
55
- export type { AuditEventRow, AuditCursor, AuditQueryFilters, AuditQueryResult, IAuditQuery } from './events/audit.js';
1
+ export * from './access/index.js';
2
+ export * from './apiTokens/index.js';
3
+ export * from './auth/index.js';
4
+ export * from './computeServer/public.js';
5
+ export * from './data/index.js';
6
+ export * from './definitions/index.js';
7
+ export * from './events/index.js';
8
+ export * from './invites/index.js';
9
+ export * from './notifications/index.js';
10
+ export * from './organizations/index.js';
11
+ export * from './permissions/index.js';
12
+ export * from './platformProjects/index.js';
13
+ export * from './projects/index.js';
14
+ export * from './shareLinks/index.js';
15
+ export * from './storage/index.js';
16
+ export * from './userProfile/index.js';
17
+ export * from './utils/index.js';
56
18
  export type { ISolveMetricSink, SolveMetric, SolveFailureKind } from './metrics/interface.js';
57
19
  export { NoopSolveMetricSink } from './metrics/interface.js';
58
20
  export type { ISolveResultCache, SolveCacheKey, SolveCacheSetOptions } from './solveCache/interface.js';
@@ -61,17 +23,12 @@ export type { IErrorReporter, ErrorContext } from './errors/interface.js';
61
23
  export { NoopErrorReporter } from './errors/interface.js';
62
24
  export type { ILogger, LogFields, LogLevel } from './logging/interface.js';
63
25
  export { NoopLogger } from './logging/interface.js';
64
- export type { INotificationProvider, NotificationKind, OutboundMessage, SendResult } from './notifications/index.js';
65
- export { NoopNotificationProvider } from './notifications/index.js';
66
26
  export type { IBindingResolver } from './bindings/interface.js';
67
27
  export { NoopBindingResolver } from './bindings/interface.js';
68
- export type { AuditUpdate, AuditSoftDelete } from './utils/audit.js';
69
- export { auditUpdate, auditSoftDelete } from './utils/audit.js';
70
28
  export type { RequestContext } from './context.js';
71
29
  export { SYSTEM_CONTEXT, hasPermission, requireActingOrg, isShareContext, assertNotShareContext } from './context.js';
72
30
  export type { ListOptions, DefinitionListOptions, Page } from './pagination.js';
73
- export { DEFAULT_PAGE_LIMIT, MAX_PAGE_LIMIT } from './pagination.js';
31
+ export { DEFAULT_PAGE_LIMIT, MAX_PAGE_LIMIT, clampPageLimit, decodeOffsetCursor, encodeOffsetCursor } from './pagination.js';
74
32
  export type { TenancyMode, SelvaFlags, SelvaBranding, SelvaConfig, SelvaConfigFactory } from './config.js';
75
33
  export { isFlagEnabled, defineConfig } from './config.js';
76
34
  export { ProviderError } from './errors.js';
77
- //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,33 +1,27 @@
1
1
  // @selvajs/platform — published API contract. Every symbol here is breaking-change-protected.
2
- export { PlatformPermissionSchema, ALL_PLATFORM_PERMISSIONS, OPERATOR_PLATFORM_PERMISSIONS } from './permissions/types.js';
3
- export { emptyProfile } from './userProfile/types.js';
4
- export { orgPaths } from './organizations/paths.js';
5
- export { OrgRoleSchema, OrgPermissionSchema, OrgAssetKindSchema, ALL_ORG_ASSET_KINDS, SlugSchema, slugify, RESERVED_SLUGS, CreateOrgSchema, UpdateOrgSchema, ALL_ORG_PERMISSIONS, DEFAULT_ORG_PERMISSIONS, OWNER_ADMIN_ONLY_PERMISSIONS, MEMBER_ASSIGNABLE_PERMISSIONS } from './organizations/schemas.js';
6
- export { ApiScopeActionSchema, ApiScopeStringSchema, ApiTokenRevokeReasonSchema, API_TOKEN_LIFETIME_DAYS, parseApiScope, formatApiScope, describeApiScope, scopeAllows, narrowApiTokenContext, outsideTokenOrg } from './apiTokens/index.js';
7
- export { ProjectVisibilitySchema, ProjectRoleSchema, validateProjectFlags } from './projects/schemas.js';
8
- export { PlatformProjectGrantSchema, PlatformProjectGranteeTypeSchema } from './platformProjects/schemas.js';
9
- export { GH_EXTENSIONS, COVER_IMAGE_EXTENSIONS, ALLOWED_UPLOAD_EXTENSIONS, COVER_IMAGE_CONTENT_TYPES, toDefinitionListItem } from './definitions/types.js';
10
- export { definitionPaths } from './definitions/paths.js';
11
- export { DefinitionChannelSchema, PublishVersionInputSchema, CreateDefinitionInputSchema, UpdateMetadataInputSchema, GuidSchema, UUID_REGEX } from './definitions/schemas.js';
12
- export { DEFAULT_SHARE_LINK_MAX_SOLVES } from './shareLinks/types.js';
13
- export { CreateShareLinkInputSchema } from './shareLinks/schemas.js';
14
- export { IMAGE_MAX_WIDTH, IMAGE_WEBP_QUALITY, isImageUpload, toWebpPath, transcodeImageIfNeeded } from './storage/image.js';
15
- export { ASSET_CLASSES, classifyAssetPath, isPublicAssetPath } from './storage/assetClasses.js';
16
- export { withCacheBust } from './storage/cacheBust.js';
17
- export { ERASED_ACTOR_ID } from './data/interface.js';
18
- export { isPlatformServer, isOrgServer } from './computeServer/types.js';
19
- export { serversVisibleTo, defaultServerIdFor, resolveServerForOrg, findServerById, platformServers, orgServersFor, scopeConfigToOrg } from './computeServer/utils.js';
20
- export { canView, canSolve, canEdit, canManage, canEditProjectSettings, canChangeVisibilityToPublic, canEditDefinition, canReclaim, canCreateProject, canChangeOrgRole, checkOwnerRemoval, withAdminBypass } from './access/rules.js';
21
- export { actorFrom, actorOf, NoopEventSink, AUDIT_EVENT_VERSION } from './events/interface.js';
2
+ export * from './access/index.js';
3
+ export * from './apiTokens/index.js';
4
+ export * from './auth/index.js';
5
+ export * from './computeServer/public.js';
6
+ export * from './data/index.js';
7
+ export * from './definitions/index.js';
8
+ export * from './events/index.js';
9
+ export * from './invites/index.js';
10
+ export * from './notifications/index.js';
11
+ export * from './organizations/index.js';
12
+ export * from './permissions/index.js';
13
+ export * from './platformProjects/index.js';
14
+ export * from './projects/index.js';
15
+ export * from './shareLinks/index.js';
16
+ export * from './storage/index.js';
17
+ export * from './userProfile/index.js';
18
+ export * from './utils/index.js';
22
19
  export { NoopSolveMetricSink } from './metrics/interface.js';
23
20
  export { NoopSolveResultCache } from './solveCache/interface.js';
24
21
  export { NoopErrorReporter } from './errors/interface.js';
25
22
  export { NoopLogger } from './logging/interface.js';
26
- export { NoopNotificationProvider } from './notifications/index.js';
27
23
  export { NoopBindingResolver } from './bindings/interface.js';
28
- export { auditUpdate, auditSoftDelete } from './utils/audit.js';
29
24
  export { SYSTEM_CONTEXT, hasPermission, requireActingOrg, isShareContext, assertNotShareContext } from './context.js';
30
- export { DEFAULT_PAGE_LIMIT, MAX_PAGE_LIMIT } from './pagination.js';
25
+ export { DEFAULT_PAGE_LIMIT, MAX_PAGE_LIMIT, clampPageLimit, decodeOffsetCursor, encodeOffsetCursor } from './pagination.js';
31
26
  export { isFlagEnabled, defineConfig } from './config.js';
32
27
  export { ProviderError } from './errors.js';
33
- //# sourceMappingURL=index.js.map
@@ -1,3 +1,2 @@
1
1
  export type { Invite } from './types.js';
2
2
  export type { IInviteStore } from './interface.js';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=index.js.map
@@ -18,7 +18,8 @@ export interface IInviteStore {
18
18
  getByTokenHash(ctx: RequestContext, tokenHash: string): Promise<Invite | null>;
19
19
  listByOrg(ctx: RequestContext, orgId: string, opts?: ListOptions): Promise<Page<Invite>>;
20
20
  /** No-op if already accepted. */
21
- markAccepted(ctx: RequestContext, id: string, userId: string): Promise<void>;
21
+ /** True if this call accepted the invite, false if it was already accepted or is gone. */
22
+ markAccepted(ctx: RequestContext, id: string, userId: string): Promise<boolean>;
22
23
  /** No-op if already consumed or missing. */
23
24
  revoke(ctx: RequestContext, id: string): Promise<void>;
24
25
  /**
@@ -26,10 +27,9 @@ export interface IInviteStore {
26
27
  * revoked. Accepted invites are left alone — consuming one is history, not
27
28
  * a live grant.
28
29
  *
29
- * Offboarding needs this: `removeOrgMember` cascades `project_members` but
30
- * has never touched invites, so a dormant invite let a removed user walk
31
- * back in at their original role for the rest of its TTL. Matching by email
32
- * rather than user id is deliberate — an invite names an address, and the
30
+ * Offboarding needs this: `removeOrgMember` does not touch invites, so a
31
+ * dormant invite would let a removed user walk back in at their original role
32
+ * for the rest of its TTL. Matching by email rather than user id is deliberate — an invite names an address, and the
33
33
  * account it will create may not exist yet.
34
34
  *
35
35
  * One call rather than list-then-revoke-each: the loop would race a
@@ -39,4 +39,3 @@ export interface IInviteStore {
39
39
  /** Called from the `deleteOrg` cascade — invites to a deleted org are unredeemable orphans otherwise. */
40
40
  deleteByOrg(ctx: RequestContext, orgId: string): Promise<void>;
41
41
  }
42
- //# sourceMappingURL=interface.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=interface.js.map
@@ -39,4 +39,3 @@ export interface Invite {
39
39
  acceptedAt?: string;
40
40
  acceptedByUserId?: string;
41
41
  }
42
- //# sourceMappingURL=types.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=types.js.map
@@ -65,4 +65,3 @@ export declare class NoopLogger implements ILogger {
65
65
  error(_message: string, _fields?: LogFields): void;
66
66
  child(_fields: LogFields): ILogger;
67
67
  }
68
- //# sourceMappingURL=interface.d.ts.map
@@ -22,4 +22,3 @@ export class NoopLogger {
22
22
  return this;
23
23
  }
24
24
  }
25
- //# sourceMappingURL=interface.js.map
@@ -71,4 +71,3 @@ export interface ISolveMetricSink {
71
71
  export declare class NoopSolveMetricSink implements ISolveMetricSink {
72
72
  record(_ctx: RequestContext, _metric: SolveMetric): Promise<void>;
73
73
  }
74
- //# sourceMappingURL=interface.d.ts.map
@@ -2,4 +2,3 @@
2
2
  export class NoopSolveMetricSink {
3
3
  async record(_ctx, _metric) { }
4
4
  }
5
- //# sourceMappingURL=interface.js.map
@@ -1,4 +1,3 @@
1
1
  export type { NotificationKind, OutboundMessage, SendResult } from './types.js';
2
2
  export type { INotificationProvider } from './interface.js';
3
3
  export { NoopNotificationProvider } from './interface.js';
4
- //# sourceMappingURL=index.d.ts.map
@@ -1,2 +1 @@
1
1
  export { NoopNotificationProvider } from './interface.js';
2
- //# sourceMappingURL=index.js.map
@@ -35,12 +35,10 @@ export interface INotificationProvider {
35
35
  * Default `INotificationProvider` — sends nothing, reports `not-configured`.
36
36
  *
37
37
  * Mail is optional in every deployment, so this is a supported wiring rather
38
- * than a test double: callers already handle `not-configured` as "no mail",
39
- * which keeps the no-SMTP path identical to the pre-notification behaviour.
38
+ * than a test double: callers already handle `not-configured` as "no mail".
40
39
  */
41
40
  export declare class NoopNotificationProvider implements INotificationProvider {
42
41
  readonly name = "None";
43
42
  send(_message: OutboundMessage, _log?: ILogger): Promise<SendResult>;
44
43
  isConfigured(): boolean;
45
44
  }
46
- //# sourceMappingURL=interface.d.ts.map
@@ -2,8 +2,7 @@
2
2
  * Default `INotificationProvider` — sends nothing, reports `not-configured`.
3
3
  *
4
4
  * Mail is optional in every deployment, so this is a supported wiring rather
5
- * than a test double: callers already handle `not-configured` as "no mail",
6
- * which keeps the no-SMTP path identical to the pre-notification behaviour.
5
+ * than a test double: callers already handle `not-configured` as "no mail".
7
6
  */
8
7
  export class NoopNotificationProvider {
9
8
  name = 'None';
@@ -14,4 +13,3 @@ export class NoopNotificationProvider {
14
13
  return false;
15
14
  }
16
15
  }
17
- //# sourceMappingURL=interface.js.map
@@ -37,4 +37,3 @@ export type SendResult = {
37
37
  status: 'failed';
38
38
  reason: string;
39
39
  };
40
- //# sourceMappingURL=types.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=types.js.map
@@ -1,6 +1,5 @@
1
1
  export type { Organization, OrgMember, OrgAssets } from './types.js';
2
2
  export type { IOrgStore } from './interface.js';
3
3
  export { orgPaths } from './paths.js';
4
- export type { OrgRole, OrgPermission, OrgAssetKind, CreateOrgInput, UpdateOrgInput } from './schemas.js';
5
- export { OrgRoleSchema, OrgPermissionSchema, OrgAssetKindSchema, ALL_ORG_ASSET_KINDS, SlugSchema, slugify, RESERVED_SLUGS, CreateOrgSchema, UpdateOrgSchema, ALL_ORG_PERMISSIONS, DEFAULT_ORG_PERMISSIONS, OWNER_ADMIN_ONLY_PERMISSIONS, MEMBER_ASSIGNABLE_PERMISSIONS } from './schemas.js';
6
- //# sourceMappingURL=index.d.ts.map
4
+ export type { OrgRole, OrgPermission, OrgAssetKind } from './schemas.js';
5
+ export { OrgRoleSchema, OrgPermissionSchema, OrgAssetKindSchema, SlugSchema, slugify, RESERVED_SLUGS, orgSlugFromName, CreateOrgSchema, UpdateOrgSchema, ALL_ORG_PERMISSIONS, DEFAULT_ORG_PERMISSIONS, OWNER_ADMIN_ONLY_PERMISSIONS, MEMBER_ASSIGNABLE_PERMISSIONS } from './schemas.js';
@@ -1,3 +1,2 @@
1
1
  export { orgPaths } from './paths.js';
2
- export { OrgRoleSchema, OrgPermissionSchema, OrgAssetKindSchema, ALL_ORG_ASSET_KINDS, SlugSchema, slugify, RESERVED_SLUGS, CreateOrgSchema, UpdateOrgSchema, ALL_ORG_PERMISSIONS, DEFAULT_ORG_PERMISSIONS, OWNER_ADMIN_ONLY_PERMISSIONS, MEMBER_ASSIGNABLE_PERMISSIONS } from './schemas.js';
3
- //# sourceMappingURL=index.js.map
2
+ export { OrgRoleSchema, OrgPermissionSchema, OrgAssetKindSchema, SlugSchema, slugify, RESERVED_SLUGS, orgSlugFromName, CreateOrgSchema, UpdateOrgSchema, ALL_ORG_PERMISSIONS, DEFAULT_ORG_PERMISSIONS, OWNER_ADMIN_ONLY_PERMISSIONS, MEMBER_ASSIGNABLE_PERMISSIONS } from './schemas.js';
@@ -13,10 +13,9 @@ export interface IOrgStore {
13
13
  createOrg(ctx: RequestContext, org: Organization): Promise<void>;
14
14
  updateOrg(ctx: RequestContext, id: string, patch: Partial<Pick<Organization, 'name' | 'slug' | 'assets'>>): Promise<void>;
15
15
  /**
16
- * Soft-deletes the org, cascading to org members, projects, and project
17
- * members (definitions and share links cascade through project deletion).
18
- * Invites and the org compute-server override are NOT cascaded — clean
19
- * those up explicitly if needed.
16
+ * Soft-deletes the org, cascading to org members, projects, project members and
17
+ * definitions. Share links die with their definition. Hard-deletes its invites,
18
+ * API tokens, compute servers and compute defaults.
20
19
  */
21
20
  deleteOrg(ctx: RequestContext, id: string): Promise<void>;
22
21
  listOrgMembers(ctx: RequestContext, orgId: string, opts?: ListOptions): Promise<Page<OrgMember>>;
@@ -47,4 +46,3 @@ export interface IOrgStore {
47
46
  updateOrgMemberPermissions(ctx: RequestContext, orgId: string, userId: string, permissions: readonly OrgPermission[]): Promise<void>;
48
47
  removeOrgMember(ctx: RequestContext, orgId: string, userId: string): Promise<void>;
49
48
  }
50
- //# sourceMappingURL=interface.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=interface.js.map
@@ -6,14 +6,9 @@ import type { OrgAssetKind } from './schemas.js';
6
6
  *
7
7
  * Branding lives under `orgs/{id}/branding/` because it's a *public* asset
8
8
  * class — anyone, including logged-out viewers, may read a company logo.
9
- * That segment distinguishes it from `orgs/{id}/private/` (members-only).
10
- * `classifyAssetPath` / `ASSET_CLASSES` decide public-vs-private from these
11
- * prefixes.
9
+ * `classifyAssetPath` / `ASSET_CLASSES` decide visibility from these prefixes.
12
10
  */
13
11
  export declare const orgPaths: {
14
12
  readonly asset: (id: string, kind: OrgAssetKind) => string;
15
- /** Members-only blob; `name` includes the extension. */
16
- readonly privateAsset: (id: string, name: string) => string;
17
13
  readonly prefix: (id: string) => string;
18
14
  };
19
- //# sourceMappingURL=paths.d.ts.map
@@ -1,13 +1,4 @@
1
- /**
2
- * Blocks path traversal, separators, and empty segments. Called by every
3
- * helper below so a malicious `id` can't escape the `orgs/` prefix.
4
- */
5
- function assertSafeKey(value, label) {
6
- // The regex alone allows '.' and '..' — both fully match the allowed alphabet — so they need an explicit check.
7
- if (!value || !/^[A-Za-z0-9._-]+$/.test(value) || value === '.' || value === '..') {
8
- throw new Error(`Unsafe ${label}: ${JSON.stringify(value)}`);
9
- }
10
- }
1
+ import { assertSafeKey } from '../storage/safeKey.js';
11
2
  /**
12
3
  * Every branding asset is stored as `.webp` (uploads go through the shared
13
4
  * transcoder), so the path per kind is fixed and a re-upload overwrites in
@@ -15,9 +6,7 @@ function assertSafeKey(value, label) {
15
6
  *
16
7
  * Branding lives under `orgs/{id}/branding/` because it's a *public* asset
17
8
  * class — anyone, including logged-out viewers, may read a company logo.
18
- * That segment distinguishes it from `orgs/{id}/private/` (members-only).
19
- * `classifyAssetPath` / `ASSET_CLASSES` decide public-vs-private from these
20
- * prefixes.
9
+ * `classifyAssetPath` / `ASSET_CLASSES` decide visibility from these prefixes.
21
10
  */
22
11
  export const orgPaths = {
23
12
  asset: (id, kind) => {
@@ -25,15 +14,8 @@ export const orgPaths = {
25
14
  assertSafeKey(kind, 'assetKind');
26
15
  return `orgs/${id}/branding/${kind}.webp`;
27
16
  },
28
- /** Members-only blob; `name` includes the extension. */
29
- privateAsset: (id, name) => {
30
- assertSafeKey(id, 'orgId');
31
- assertSafeKey(name, 'assetName');
32
- return `orgs/${id}/private/${name}`;
33
- },
34
17
  prefix: (id) => {
35
18
  assertSafeKey(id, 'orgId');
36
19
  return `orgs/${id}/`;
37
20
  }
38
21
  };
39
- //# sourceMappingURL=paths.js.map
@@ -1,12 +1,9 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
3
  * Top-level path segments a tenant slug must never equal, so a slug can never
4
- * shadow (or be shadowed by) a route. `/o/{slug}/` is the planned shape for
5
- * per-org URLs, so `o` is reserved even though the length gate below already
6
- * makes a 1-char slug impossible — that keeps a future move to `/o/{slug}/…`
7
- * collision-free before any external link is minted against a slug.
8
- * Lowercase; matching is case-insensitive so `Admin` can't slip through. Keep
9
- * in sync with the route tree's top-level directories.
4
+ * shadow (or be shadowed by) a route. `o` is reserved for `/o/{slug}/` even though
5
+ * the length gate below already makes a 1-char slug impossible.
6
+ * `reserved-slugs.test.ts` in the selva app holds this to the route tree.
10
7
  */
11
8
  export declare const RESERVED_SLUGS: readonly string[];
12
9
  /**
@@ -15,6 +12,8 @@ export declare const RESERVED_SLUGS: readonly string[];
15
12
  * untouched — run the result through `SlugSchema` where validity matters.
16
13
  */
17
14
  export declare function slugify(name: string): string;
15
+ /** A slug for an org named without a slug of its own. Always passes `SlugSchema`. */
16
+ export declare function orgSlugFromName(name: string, fallback?: string): string;
18
17
  /** Lowercase alphanumeric with internal hyphens, 3–63 chars, not a reserved word. */
19
18
  export declare const SlugSchema: z.ZodString;
20
19
  export declare const OrgRoleSchema: z.ZodEnum<{
@@ -54,4 +53,3 @@ export declare const UpdateOrgSchema: z.ZodObject<{
54
53
  }, z.core.$strip>;
55
54
  export type CreateOrgInput = z.infer<typeof CreateOrgSchema>;
56
55
  export type UpdateOrgInput = z.infer<typeof UpdateOrgSchema>;
57
- //# sourceMappingURL=schemas.d.ts.map
@@ -1,12 +1,9 @@
1
1
  import { z } from 'zod';
2
2
  /**
3
3
  * Top-level path segments a tenant slug must never equal, so a slug can never
4
- * shadow (or be shadowed by) a route. `/o/{slug}/` is the planned shape for
5
- * per-org URLs, so `o` is reserved even though the length gate below already
6
- * makes a 1-char slug impossible — that keeps a future move to `/o/{slug}/…`
7
- * collision-free before any external link is minted against a slug.
8
- * Lowercase; matching is case-insensitive so `Admin` can't slip through. Keep
9
- * in sync with the route tree's top-level directories.
4
+ * shadow (or be shadowed by) a route. `o` is reserved for `/o/{slug}/` even though
5
+ * the length gate below already makes a 1-char slug impossible.
6
+ * `reserved-slugs.test.ts` in the selva app holds this to the route tree.
10
7
  */
11
8
  export const RESERVED_SLUGS = [
12
9
  'o',
@@ -16,11 +13,13 @@ export const RESERVED_SLUGS = [
16
13
  'login',
17
14
  'logout',
18
15
  'setup',
19
- 'settings',
20
16
  'team',
21
17
  'library',
22
18
  'projects',
23
- 'accept-invite'
19
+ 'accept-invite',
20
+ 'docs',
21
+ 'mcp',
22
+ 'oauth'
24
23
  ];
25
24
  const RESERVED_SLUG_SET = new Set(RESERVED_SLUGS);
26
25
  /**
@@ -30,18 +29,27 @@ const RESERVED_SLUG_SET = new Set(RESERVED_SLUGS);
30
29
  */
31
30
  export function slugify(name) {
32
31
  return name
32
+ .normalize('NFKD')
33
+ .replace(/\p{M}/gu, '')
33
34
  .trim()
34
35
  .toLowerCase()
35
36
  .replace(/[^a-z0-9]+/g, '-')
36
- .replace(/^-|-$/g, '')
37
- .slice(0, 63);
37
+ .slice(0, 63)
38
+ .replace(/^-+|-+$/g, '');
39
+ }
40
+ /** A slug for an org named without a slug of its own. Always passes `SlugSchema`. */
41
+ export function orgSlugFromName(name, fallback = 'default') {
42
+ const slug = slugify(name);
43
+ if (slug.length < 3)
44
+ return fallback;
45
+ return RESERVED_SLUG_SET.has(slug) ? `${slug}-org` : slug;
38
46
  }
39
47
  /** Lowercase alphanumeric with internal hyphens, 3–63 chars, not a reserved word. */
40
48
  export const SlugSchema = z
41
49
  .string()
42
50
  .min(3, 'Slug must be at least 3 characters')
43
51
  .max(63, 'Slug must be at most 63 characters')
44
- .regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/, 'Slug must be lowercase alphanumeric with hyphens (no leading/trailing/consecutive hyphens)')
52
+ .regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/, 'Slug must be lowercase alphanumeric with hyphens (no leading or trailing hyphen)')
45
53
  .refine((s) => !RESERVED_SLUG_SET.has(s), {
46
54
  message: 'Slug is reserved and cannot be used'
47
55
  });
@@ -70,8 +78,7 @@ export const DEFAULT_ORG_PERMISSIONS = {
70
78
  member: []
71
79
  };
72
80
  export const CreateOrgSchema = z.object({
73
- name: z.string().min(1, 'Organization name is required').max(128),
81
+ name: z.string().trim().min(1, 'Organization name is required').max(128),
74
82
  slug: SlugSchema
75
83
  });
76
84
  export const UpdateOrgSchema = CreateOrgSchema.partial();
77
- //# sourceMappingURL=schemas.js.map
@@ -35,4 +35,3 @@ export interface OrgMember {
35
35
  updatedBy: string;
36
36
  deletedAt?: string | null;
37
37
  }
38
- //# sourceMappingURL=types.d.ts.map
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=types.js.map
@@ -1,7 +1,9 @@
1
1
  import type { DefinitionStatus } from './definitions/types.js';
2
2
  /**
3
- * Cursor-paginated list options. Adapters default to limit=50, orderBy=createdAt
4
- * desc, and clamp limit to `MAX_PAGE_LIMIT`.
3
+ * Cursor-paginated list options. Adapters default to limit=50 and clamp limit to
4
+ * `MAX_PAGE_LIMIT`. Order is `createdAt` desc unless a store says otherwise: local
5
+ * definitions default to `name` asc, and the Supabase member, invite and token
6
+ * lists have one fixed order and ignore `orderBy`.
5
7
  *
6
8
  * Cursors are opaque — adapters may use row ids, offsets, or keyset encodings.
7
9
  * Callers must not inspect them.
@@ -35,6 +37,8 @@ export interface DefinitionListOptions extends Omit<ListOptions, 'orderBy'> {
35
37
  * post-fetch can return a page of 50 with 3 items.
36
38
  */
37
39
  projectIds?: readonly string[];
40
+ /** Only definitions whose `sourceDocumentId` equals this lowercase GUID. */
41
+ sourceDocumentId?: string;
38
42
  }
39
43
  export interface Page<T> {
40
44
  items: T[];
@@ -42,4 +46,8 @@ export interface Page<T> {
42
46
  }
43
47
  export declare const DEFAULT_PAGE_LIMIT = 50;
44
48
  export declare const MAX_PAGE_LIMIT = 200;
45
- //# sourceMappingURL=pagination.d.ts.map
49
+ /** For adapters paging by offset. Junk and negatives read as the first page. */
50
+ export declare function decodeOffsetCursor(cursor: string | undefined): number;
51
+ export declare function encodeOffsetCursor(offset: number): string;
52
+ /** The effective page size for a requested limit. */
53
+ export declare function clampPageLimit(limit: number | undefined): number;
@@ -1,3 +1,17 @@
1
1
  export const DEFAULT_PAGE_LIMIT = 50;
2
2
  export const MAX_PAGE_LIMIT = 200;
3
- //# sourceMappingURL=pagination.js.map
3
+ /** For adapters paging by offset. Junk and negatives read as the first page. */
4
+ export function decodeOffsetCursor(cursor) {
5
+ const offset = cursor ? parseInt(cursor, 10) : 0;
6
+ return Number.isFinite(offset) && offset >= 0 ? offset : 0;
7
+ }
8
+ export function encodeOffsetCursor(offset) {
9
+ return String(offset);
10
+ }
11
+ /** The effective page size for a requested limit. */
12
+ export function clampPageLimit(limit) {
13
+ const requested = limit ?? DEFAULT_PAGE_LIMIT;
14
+ if (!Number.isFinite(requested))
15
+ return DEFAULT_PAGE_LIMIT;
16
+ return Math.min(Math.max(1, Math.floor(requested)), MAX_PAGE_LIMIT);
17
+ }