@selvajs/server 1.1.0 → 1.3.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 (233) hide show
  1. package/dist/access/guards.d.ts +213 -0
  2. package/dist/access/guards.d.ts.map +1 -0
  3. package/dist/access/guards.js +417 -0
  4. package/dist/access/guards.js.map +1 -0
  5. package/dist/access/index.d.ts +2 -0
  6. package/dist/access/index.d.ts.map +1 -1
  7. package/dist/access/index.js +6 -0
  8. package/dist/access/index.js.map +1 -1
  9. package/dist/access/permissions-scope.d.ts +15 -0
  10. package/dist/access/permissions-scope.d.ts.map +1 -0
  11. package/dist/access/permissions-scope.js +23 -0
  12. package/dist/access/permissions-scope.js.map +1 -0
  13. package/dist/api/bodies.d.ts +104 -0
  14. package/dist/api/bodies.d.ts.map +1 -0
  15. package/dist/api/bodies.js +87 -0
  16. package/dist/api/bodies.js.map +1 -0
  17. package/dist/api/deps.d.ts +135 -0
  18. package/dist/api/deps.d.ts.map +1 -0
  19. package/dist/api/deps.js +55 -0
  20. package/dist/api/deps.js.map +1 -0
  21. package/dist/api/errors.d.ts +35 -0
  22. package/dist/api/errors.d.ts.map +1 -0
  23. package/dist/api/errors.js +63 -0
  24. package/dist/api/errors.js.map +1 -0
  25. package/dist/api/index.d.ts +12 -0
  26. package/dist/api/index.d.ts.map +1 -0
  27. package/dist/api/index.js +15 -0
  28. package/dist/api/index.js.map +1 -0
  29. package/dist/api/map-core-error.d.ts +19 -0
  30. package/dist/api/map-core-error.d.ts.map +1 -0
  31. package/dist/api/map-core-error.js +49 -0
  32. package/dist/api/map-core-error.js.map +1 -0
  33. package/dist/api/pagination.d.ts +19 -0
  34. package/dist/api/pagination.d.ts.map +1 -0
  35. package/dist/api/pagination.js +40 -0
  36. package/dist/api/pagination.js.map +1 -0
  37. package/dist/api/request.d.ts +93 -0
  38. package/dist/api/request.d.ts.map +1 -0
  39. package/dist/api/request.js +150 -0
  40. package/dist/api/request.js.map +1 -0
  41. package/dist/api/respond.d.ts +29 -0
  42. package/dist/api/respond.d.ts.map +1 -0
  43. package/dist/api/respond.js +59 -0
  44. package/dist/api/respond.js.map +1 -0
  45. package/dist/api/responses-schema.d.ts +158 -0
  46. package/dist/api/responses-schema.d.ts.map +1 -0
  47. package/dist/api/responses-schema.js +104 -0
  48. package/dist/api/responses-schema.js.map +1 -0
  49. package/dist/api/responses.d.ts +19 -0
  50. package/dist/api/responses.d.ts.map +1 -0
  51. package/dist/api/responses.js +21 -0
  52. package/dist/api/responses.js.map +1 -0
  53. package/dist/api/shaped.d.ts +23 -0
  54. package/dist/api/shaped.d.ts.map +1 -0
  55. package/dist/api/shaped.js +29 -0
  56. package/dist/api/shaped.js.map +1 -0
  57. package/dist/api/types.d.ts +41 -0
  58. package/dist/api/types.d.ts.map +1 -0
  59. package/dist/api/types.js +12 -0
  60. package/dist/api/types.js.map +1 -0
  61. package/dist/compute/errors.d.ts +18 -0
  62. package/dist/compute/errors.d.ts.map +1 -0
  63. package/dist/compute/errors.js +21 -0
  64. package/dist/compute/errors.js.map +1 -0
  65. package/dist/compute/evict-changed-servers.d.ts +22 -0
  66. package/dist/compute/evict-changed-servers.d.ts.map +1 -0
  67. package/dist/compute/evict-changed-servers.js +31 -0
  68. package/dist/compute/evict-changed-servers.js.map +1 -0
  69. package/dist/compute/idempotency-http.d.ts +47 -0
  70. package/dist/compute/idempotency-http.d.ts.map +1 -0
  71. package/dist/compute/idempotency-http.js +51 -0
  72. package/dist/compute/idempotency-http.js.map +1 -0
  73. package/dist/compute/index.d.ts +5 -0
  74. package/dist/compute/index.d.ts.map +1 -1
  75. package/dist/compute/index.js +5 -0
  76. package/dist/compute/index.js.map +1 -1
  77. package/dist/compute/resolve-server.d.ts +25 -0
  78. package/dist/compute/resolve-server.d.ts.map +1 -0
  79. package/dist/compute/resolve-server.js +35 -0
  80. package/dist/compute/resolve-server.js.map +1 -0
  81. package/dist/compute/server-config-write.d.ts +52 -0
  82. package/dist/compute/server-config-write.d.ts.map +1 -0
  83. package/dist/compute/server-config-write.js +100 -0
  84. package/dist/compute/server-config-write.js.map +1 -0
  85. package/dist/definitions/index.d.ts +1 -0
  86. package/dist/definitions/index.d.ts.map +1 -1
  87. package/dist/definitions/index.js +1 -0
  88. package/dist/definitions/index.js.map +1 -1
  89. package/dist/definitions/visibility.d.ts +74 -0
  90. package/dist/definitions/visibility.d.ts.map +1 -0
  91. package/dist/definitions/visibility.js +117 -0
  92. package/dist/definitions/visibility.js.map +1 -0
  93. package/dist/handlers/definitionVersions.d.ts +30 -0
  94. package/dist/handlers/definitionVersions.d.ts.map +1 -0
  95. package/dist/handlers/definitionVersions.js +93 -0
  96. package/dist/handlers/definitionVersions.js.map +1 -0
  97. package/dist/handlers/definitions.d.ts +35 -0
  98. package/dist/handlers/definitions.d.ts.map +1 -0
  99. package/dist/handlers/definitions.js +207 -0
  100. package/dist/handlers/definitions.js.map +1 -0
  101. package/dist/handlers/index.d.ts +27 -0
  102. package/dist/handlers/index.d.ts.map +1 -0
  103. package/dist/handlers/index.js +29 -0
  104. package/dist/handlers/index.js.map +1 -0
  105. package/dist/handlers/invite-lookup.d.ts +11 -0
  106. package/dist/handlers/invite-lookup.d.ts.map +1 -0
  107. package/dist/handlers/invite-lookup.js +20 -0
  108. package/dist/handlers/invite-lookup.js.map +1 -0
  109. package/dist/handlers/invites.d.ts +31 -0
  110. package/dist/handlers/invites.d.ts.map +1 -0
  111. package/dist/handlers/invites.js +148 -0
  112. package/dist/handlers/invites.js.map +1 -0
  113. package/dist/handlers/me.d.ts +8 -0
  114. package/dist/handlers/me.d.ts.map +1 -0
  115. package/dist/handlers/me.js +21 -0
  116. package/dist/handlers/me.js.map +1 -0
  117. package/dist/handlers/me.starred.d.ts +11 -0
  118. package/dist/handlers/me.starred.d.ts.map +1 -0
  119. package/dist/handlers/me.starred.js +21 -0
  120. package/dist/handlers/me.starred.js.map +1 -0
  121. package/dist/handlers/orgAssets.d.ts +13 -0
  122. package/dist/handlers/orgAssets.d.ts.map +1 -0
  123. package/dist/handlers/orgAssets.js +54 -0
  124. package/dist/handlers/orgAssets.js.map +1 -0
  125. package/dist/handlers/orgCompute.d.ts +16 -0
  126. package/dist/handlers/orgCompute.d.ts.map +1 -0
  127. package/dist/handlers/orgCompute.js +96 -0
  128. package/dist/handlers/orgCompute.js.map +1 -0
  129. package/dist/handlers/orgMembers.d.ts +29 -0
  130. package/dist/handlers/orgMembers.d.ts.map +1 -0
  131. package/dist/handlers/orgMembers.js +200 -0
  132. package/dist/handlers/orgMembers.js.map +1 -0
  133. package/dist/handlers/orgs.d.ts +16 -0
  134. package/dist/handlers/orgs.d.ts.map +1 -0
  135. package/dist/handlers/orgs.js +26 -0
  136. package/dist/handlers/orgs.js.map +1 -0
  137. package/dist/handlers/projectMembers.d.ts +15 -0
  138. package/dist/handlers/projectMembers.d.ts.map +1 -0
  139. package/dist/handlers/projectMembers.js +95 -0
  140. package/dist/handlers/projectMembers.js.map +1 -0
  141. package/dist/handlers/projects.d.ts +21 -0
  142. package/dist/handlers/projects.d.ts.map +1 -0
  143. package/dist/handlers/projects.js +164 -0
  144. package/dist/handlers/projects.js.map +1 -0
  145. package/dist/handlers/reclaim.d.ts +10 -0
  146. package/dist/handlers/reclaim.d.ts.map +1 -0
  147. package/dist/handlers/reclaim.js +38 -0
  148. package/dist/handlers/reclaim.js.map +1 -0
  149. package/dist/handlers/services.d.ts +22 -0
  150. package/dist/handlers/services.d.ts.map +1 -0
  151. package/dist/handlers/services.js +37 -0
  152. package/dist/handlers/services.js.map +1 -0
  153. package/dist/handlers/shareLinks.d.ts +23 -0
  154. package/dist/handlers/shareLinks.d.ts.map +1 -0
  155. package/dist/handlers/shareLinks.js +85 -0
  156. package/dist/handlers/shareLinks.js.map +1 -0
  157. package/dist/http/index.d.ts +1 -0
  158. package/dist/http/index.d.ts.map +1 -1
  159. package/dist/http/index.js +1 -0
  160. package/dist/http/index.js.map +1 -1
  161. package/dist/http/login-rate-limit.d.ts +72 -0
  162. package/dist/http/login-rate-limit.d.ts.map +1 -0
  163. package/dist/http/login-rate-limit.js +84 -0
  164. package/dist/http/login-rate-limit.js.map +1 -0
  165. package/dist/notifications/deliver-invite.d.ts +27 -0
  166. package/dist/notifications/deliver-invite.d.ts.map +1 -0
  167. package/dist/notifications/deliver-invite.js +32 -0
  168. package/dist/notifications/deliver-invite.js.map +1 -0
  169. package/dist/notifications/index.d.ts +4 -0
  170. package/dist/notifications/index.d.ts.map +1 -0
  171. package/dist/notifications/index.js +4 -0
  172. package/dist/notifications/index.js.map +1 -0
  173. package/dist/notifications/smtp-config.d.ts +37 -0
  174. package/dist/notifications/smtp-config.d.ts.map +1 -0
  175. package/dist/notifications/smtp-config.js +41 -0
  176. package/dist/notifications/smtp-config.js.map +1 -0
  177. package/dist/notifications/smtp-provider.d.ts +18 -0
  178. package/dist/notifications/smtp-provider.d.ts.map +1 -0
  179. package/dist/notifications/smtp-provider.js +71 -0
  180. package/dist/notifications/smtp-provider.js.map +1 -0
  181. package/dist/ops/deploymentConfig.d.ts +73 -0
  182. package/dist/ops/deploymentConfig.d.ts.map +1 -0
  183. package/dist/ops/deploymentConfig.js +154 -0
  184. package/dist/ops/deploymentConfig.js.map +1 -0
  185. package/dist/ops/index.d.ts +1 -0
  186. package/dist/ops/index.d.ts.map +1 -1
  187. package/dist/ops/index.js +3 -2
  188. package/dist/ops/index.js.map +1 -1
  189. package/dist/organizations/index.d.ts +3 -0
  190. package/dist/organizations/index.d.ts.map +1 -0
  191. package/dist/organizations/index.js +5 -0
  192. package/dist/organizations/index.js.map +1 -0
  193. package/dist/organizations/list-all-members.d.ts +10 -0
  194. package/dist/organizations/list-all-members.d.ts.map +1 -0
  195. package/dist/organizations/list-all-members.js +36 -0
  196. package/dist/organizations/list-all-members.js.map +1 -0
  197. package/dist/organizations/org-asset-service.d.ts +39 -0
  198. package/dist/organizations/org-asset-service.d.ts.map +1 -0
  199. package/dist/organizations/org-asset-service.js +71 -0
  200. package/dist/organizations/org-asset-service.js.map +1 -0
  201. package/dist/projects/create-project.d.ts +30 -0
  202. package/dist/projects/create-project.d.ts.map +1 -0
  203. package/dist/projects/create-project.js +56 -0
  204. package/dist/projects/create-project.js.map +1 -0
  205. package/dist/projects/index.d.ts +2 -0
  206. package/dist/projects/index.d.ts.map +1 -0
  207. package/dist/projects/index.js +3 -0
  208. package/dist/projects/index.js.map +1 -0
  209. package/dist/providers/auth-lookup.d.ts +14 -0
  210. package/dist/providers/auth-lookup.d.ts.map +1 -0
  211. package/dist/providers/auth-lookup.js +34 -0
  212. package/dist/providers/auth-lookup.js.map +1 -0
  213. package/dist/providers/index.d.ts +1 -0
  214. package/dist/providers/index.d.ts.map +1 -1
  215. package/dist/providers/index.js +1 -0
  216. package/dist/providers/index.js.map +1 -1
  217. package/dist/testing/harness.d.ts +168 -0
  218. package/dist/testing/harness.d.ts.map +1 -0
  219. package/dist/testing/harness.js +314 -0
  220. package/dist/testing/harness.js.map +1 -0
  221. package/dist/testing/index.d.ts +18 -0
  222. package/dist/testing/index.d.ts.map +1 -0
  223. package/dist/testing/index.js +15 -0
  224. package/dist/testing/index.js.map +1 -0
  225. package/dist/testing/scenarios.d.ts +67 -0
  226. package/dist/testing/scenarios.d.ts.map +1 -0
  227. package/dist/testing/scenarios.js +104 -0
  228. package/dist/testing/scenarios.js.map +1 -0
  229. package/dist/testing/seed-adapter.d.ts +31 -0
  230. package/dist/testing/seed-adapter.d.ts.map +1 -0
  231. package/dist/testing/seed-adapter.js +19 -0
  232. package/dist/testing/seed-adapter.js.map +1 -0
  233. package/package.json +42 -3
@@ -0,0 +1,67 @@
1
+ /**
2
+ * The shared cast the handler tests are written against.
3
+ *
4
+ * These compose only the seeders in `./harness.ts`, so they run on whatever
5
+ * provider stack the host built its {@link TestHarness} around. They live here
6
+ * rather than in a host's fixtures because a handler test that travels with its
7
+ * handler needs the same two tenants wherever it runs — a host that reseeds its
8
+ * own Acme with different roles gets different results from the same test.
9
+ */
10
+ import type { Organization, Project } from '@selvajs/platform';
11
+ import type { SeededDefinition, SeededUser, TestHarness } from './harness.js';
12
+ export interface AcmeFixture {
13
+ acme: Organization;
14
+ alice: SeededUser;
15
+ bob: SeededUser;
16
+ alicesPrivate: Project;
17
+ acmeOrg: Project;
18
+ acmePublic: Project;
19
+ }
20
+ /**
21
+ * The primary tenant.
22
+ *
23
+ * **Alice is the org's `ownerId` but her membership row is `admin`.** Those are
24
+ * separate fields and this fixture deliberately makes them disagree, because
25
+ * production can too. Every org-role gate reads the **membership row**, so a
26
+ * test that treats `alice` as "the owner" will invert its own result and pass
27
+ * for the wrong reason — seed an explicit `role: 'owner'` member instead.
28
+ */
29
+ export declare function seedAcme(h: TestHarness): Promise<AcmeFixture>;
30
+ export interface BigClientFixture {
31
+ bigClient: Organization;
32
+ carol: SeededUser;
33
+ }
34
+ /**
35
+ * Second tenant. Carol is a member of BigClient — used for cross-org rejection
36
+ * scenarios (Carol acting in BigClient context cannot view Acme data).
37
+ */
38
+ export declare function seedBigClient(h: TestHarness): Promise<BigClientFixture>;
39
+ export interface ThirdOrgFixture {
40
+ initech: Organization;
41
+ dave: SeededUser;
42
+ }
43
+ /**
44
+ * Third tenant. Dave is a member of Initech — used for cross-org public-visibility
45
+ * scenarios (any authenticated user from any org can view a public project when
46
+ * cross-org public access is enabled).
47
+ */
48
+ export declare function seedThirdOrg(h: TestHarness): Promise<ThirdOrgFixture>;
49
+ export interface CommonsFixture {
50
+ commonsProject: Project;
51
+ alicesCommonsDef: SeededDefinition;
52
+ peter: SeededUser;
53
+ }
54
+ /**
55
+ * Commons-mode project (`autoJoinOnUpload=true`) inside Acme with Alice's
56
+ * pre-existing definition. Peter is a separate authenticated user — *not* a
57
+ * project member — who is allowed to upload his own new definitions but cannot
58
+ * touch Alice's existing one.
59
+ *
60
+ * Requires {@link seedAcme} to have run first (uses Alice as project owner +
61
+ * existing-def owner).
62
+ */
63
+ export declare function seedCommons(h: TestHarness, opts: {
64
+ acmeId: string;
65
+ aliceId: string;
66
+ }): Promise<CommonsFixture>;
67
+ //# sourceMappingURL=scenarios.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenarios.d.ts","sourceRoot":"","sources":["../../src/testing/scenarios.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE9E,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,UAAU,CAAC;IAClB,GAAG,EAAE,UAAU,CAAC;IAChB,aAAa,EAAE,OAAO,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAsB,QAAQ,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CA8BnE;AAED,MAAM,WAAW,gBAAgB;IAChC,SAAS,EAAE,YAAY,CAAC;IACxB,KAAK,EAAE,UAAU,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAS7E;AAED,MAAM,WAAW,eAAe;IAC/B,OAAO,EAAE,YAAY,CAAC;IACtB,IAAI,EAAE,UAAU,CAAC;CACjB;AAED;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAS3E;AAED,MAAM,WAAW,cAAc;IAC9B,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,KAAK,EAAE,UAAU,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAChC,CAAC,EAAE,WAAW,EACd,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACvC,OAAO,CAAC,cAAc,CAAC,CAgBzB"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * The shared cast the handler tests are written against.
3
+ *
4
+ * These compose only the seeders in `./harness.ts`, so they run on whatever
5
+ * provider stack the host built its {@link TestHarness} around. They live here
6
+ * rather than in a host's fixtures because a handler test that travels with its
7
+ * handler needs the same two tenants wherever it runs — a host that reseeds its
8
+ * own Acme with different roles gets different results from the same test.
9
+ */
10
+ import { seedDefinition, seedOrg, seedOrgMember, seedProject, seedUser } from './harness.js';
11
+ /**
12
+ * The primary tenant.
13
+ *
14
+ * **Alice is the org's `ownerId` but her membership row is `admin`.** Those are
15
+ * separate fields and this fixture deliberately makes them disagree, because
16
+ * production can too. Every org-role gate reads the **membership row**, so a
17
+ * test that treats `alice` as "the owner" will invert its own result and pass
18
+ * for the wrong reason — seed an explicit `role: 'owner'` member instead.
19
+ */
20
+ export async function seedAcme(h) {
21
+ const alice = await seedUser(h, 'alice@acme.test');
22
+ const bob = await seedUser(h, 'bob@acme.test');
23
+ const acme = await seedOrg(h, { name: 'Acme', slug: 'acme', ownerId: alice.id });
24
+ await seedOrgMember(h, { orgId: acme.id, userId: alice.id, role: 'admin' });
25
+ await seedOrgMember(h, { orgId: acme.id, userId: bob.id, role: 'member' });
26
+ const alicesPrivate = await seedProject(h, {
27
+ orgId: acme.id,
28
+ name: 'Alice Private',
29
+ slug: 'alice-private',
30
+ ownerId: alice.id,
31
+ visibility: 'private'
32
+ });
33
+ const acmeOrg = await seedProject(h, {
34
+ orgId: acme.id,
35
+ name: 'Acme Org Project',
36
+ slug: 'acme-org',
37
+ ownerId: alice.id,
38
+ visibility: 'org'
39
+ });
40
+ const acmePublic = await seedProject(h, {
41
+ orgId: acme.id,
42
+ name: 'Acme Public',
43
+ slug: 'acme-public',
44
+ ownerId: alice.id,
45
+ visibility: 'public'
46
+ });
47
+ return { acme, alice, bob, alicesPrivate, acmeOrg, acmePublic };
48
+ }
49
+ /**
50
+ * Second tenant. Carol is a member of BigClient — used for cross-org rejection
51
+ * scenarios (Carol acting in BigClient context cannot view Acme data).
52
+ */
53
+ export async function seedBigClient(h) {
54
+ const carol = await seedUser(h, 'carol@bigclient.test');
55
+ const bigClient = await seedOrg(h, {
56
+ name: 'BigClient',
57
+ slug: 'bigclient',
58
+ ownerId: carol.id
59
+ });
60
+ await seedOrgMember(h, { orgId: bigClient.id, userId: carol.id, role: 'member' });
61
+ return { bigClient, carol };
62
+ }
63
+ /**
64
+ * Third tenant. Dave is a member of Initech — used for cross-org public-visibility
65
+ * scenarios (any authenticated user from any org can view a public project when
66
+ * cross-org public access is enabled).
67
+ */
68
+ export async function seedThirdOrg(h) {
69
+ const dave = await seedUser(h, 'dave@initech.test');
70
+ const initech = await seedOrg(h, {
71
+ name: 'Initech',
72
+ slug: 'initech',
73
+ ownerId: dave.id
74
+ });
75
+ await seedOrgMember(h, { orgId: initech.id, userId: dave.id, role: 'member' });
76
+ return { initech, dave };
77
+ }
78
+ /**
79
+ * Commons-mode project (`autoJoinOnUpload=true`) inside Acme with Alice's
80
+ * pre-existing definition. Peter is a separate authenticated user — *not* a
81
+ * project member — who is allowed to upload his own new definitions but cannot
82
+ * touch Alice's existing one.
83
+ *
84
+ * Requires {@link seedAcme} to have run first (uses Alice as project owner +
85
+ * existing-def owner).
86
+ */
87
+ export async function seedCommons(h, opts) {
88
+ const peter = await seedUser(h, 'peter@elsewhere.test');
89
+ const commonsProject = await seedProject(h, {
90
+ orgId: opts.acmeId,
91
+ name: 'Acme Commons',
92
+ slug: 'acme-commons',
93
+ ownerId: opts.aliceId,
94
+ visibility: 'public',
95
+ autoJoinOnUpload: true
96
+ });
97
+ const alicesCommonsDef = await seedDefinition(h, {
98
+ projectId: commonsProject.id,
99
+ ownerId: opts.aliceId,
100
+ displayName: "Alice's Commons Def"
101
+ });
102
+ return { commonsProject, alicesCommonsDef, peter };
103
+ }
104
+ //# sourceMappingURL=scenarios.js.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CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC/E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC1B,CAAC;AAQD;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAChC,CAAc,EACd,IAAyC;IAEzC,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,CAAC,EAAE,sBAAsB,CAAC,CAAC;IACxD,MAAM,cAAc,GAAG,MAAM,WAAW,CAAC,CAAC,EAAE;QAC3C,KAAK,EAAE,IAAI,CAAC,MAAM;QAClB,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,UAAU,EAAE,QAAQ;QACpB,gBAAgB,EAAE,IAAI;KACtB,CAAC,CAAC;IACH,MAAM,gBAAgB,GAAG,MAAM,cAAc,CAAC,CAAC,EAAE;QAChD,SAAS,EAAE,cAAc,CAAC,EAAE;QAC5B,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,WAAW,EAAE,qBAAqB;KAClC,CAAC,CAAC;IACH,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,KAAK,EAAE,CAAC;AACpD,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The one thing test fixtures cannot get from `SelvaConfig`: creating and
3
+ * reading identities.
4
+ *
5
+ * Everything else a fixture needs — orgs, projects, definitions, invites —
6
+ * lives behind `IDataProvider` and is portable as-is. Identity is not.
7
+ * `IAuthProvider` exposes user *creation* only through the optional
8
+ * `passwordAuth.createUserWithPassword`, and a provider that authenticates by
9
+ * OAuth or forwarded headers implements none of it, so there is no interface
10
+ * method every provider answers. Each provider also stores identity its own
11
+ * way — the local one in `auth-users.json`, Supabase in its own `auth.users`
12
+ * table — and seeding has to reach that store directly, not through a login
13
+ * flow no test wants to perform.
14
+ *
15
+ * So the host supplies this. Two methods, because that is all the shared
16
+ * fixtures use: `seedUser` creates, `actAs` reads back.
17
+ */
18
+ import type { AuthUser } from '@selvajs/platform';
19
+ export interface SeedAuthAdapter {
20
+ /**
21
+ * Create an identity and return it. Called before the data-layer row exists,
22
+ * so implementations must not assume `ensureUser` has run.
23
+ *
24
+ * The returned `id` is what every other seeder keys off, so it has to be the
25
+ * id the auth provider will report for this user later — not a fresh one.
26
+ */
27
+ createUser(email: string): Promise<AuthUser>;
28
+ /** Read an identity back. `null` when absent, so `actAs` can fail loudly. */
29
+ findById(id: string): Promise<AuthUser | null>;
30
+ }
31
+ //# sourceMappingURL=seed-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-adapter.d.ts","sourceRoot":"","sources":["../../src/testing/seed-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,MAAM,WAAW,eAAe;IAC/B;;;;;;OAMG;IACH,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAE7C,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;CAC/C"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The one thing test fixtures cannot get from `SelvaConfig`: creating and
3
+ * reading identities.
4
+ *
5
+ * Everything else a fixture needs — orgs, projects, definitions, invites —
6
+ * lives behind `IDataProvider` and is portable as-is. Identity is not.
7
+ * `IAuthProvider` exposes user *creation* only through the optional
8
+ * `passwordAuth.createUserWithPassword`, and a provider that authenticates by
9
+ * OAuth or forwarded headers implements none of it, so there is no interface
10
+ * method every provider answers. Each provider also stores identity its own
11
+ * way — the local one in `auth-users.json`, Supabase in its own `auth.users`
12
+ * table — and seeding has to reach that store directly, not through a login
13
+ * flow no test wants to perform.
14
+ *
15
+ * So the host supplies this. Two methods, because that is all the shared
16
+ * fixtures use: `seedUser` creates, `actAs` reads back.
17
+ */
18
+ export {};
19
+ //# sourceMappingURL=seed-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed-adapter.js","sourceRoot":"","sources":["../../src/testing/seed-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@selvajs/server",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "description": "Transport-agnostic server building blocks for apps built on the Selva engine (limits, rate limiting, SSRF guard, remote-definition fetch, definition service + render loader); the solve core lives in @selvajs/solve/server",
5
5
  "license": "MIT",
6
6
  "author": "VektorNode",
@@ -66,10 +66,40 @@
66
66
  "types": "./dist/access/index.d.ts",
67
67
  "import": "./dist/access/index.js"
68
68
  },
69
+ "./api": {
70
+ "selva-source": "./src/api/index.ts",
71
+ "types": "./dist/api/index.d.ts",
72
+ "import": "./dist/api/index.js"
73
+ },
74
+ "./handlers": {
75
+ "selva-source": "./src/handlers/index.ts",
76
+ "types": "./dist/handlers/index.d.ts",
77
+ "import": "./dist/handlers/index.js"
78
+ },
69
79
  "./ops": {
70
80
  "selva-source": "./src/ops/index.ts",
71
81
  "types": "./dist/ops/index.d.ts",
72
82
  "import": "./dist/ops/index.js"
83
+ },
84
+ "./projects": {
85
+ "selva-source": "./src/projects/index.ts",
86
+ "types": "./dist/projects/index.d.ts",
87
+ "import": "./dist/projects/index.js"
88
+ },
89
+ "./organizations": {
90
+ "selva-source": "./src/organizations/index.ts",
91
+ "types": "./dist/organizations/index.d.ts",
92
+ "import": "./dist/organizations/index.js"
93
+ },
94
+ "./notifications": {
95
+ "selva-source": "./src/notifications/index.ts",
96
+ "types": "./dist/notifications/index.d.ts",
97
+ "import": "./dist/notifications/index.js"
98
+ },
99
+ "./testing": {
100
+ "selva-source": "./src/testing/index.ts",
101
+ "types": "./dist/testing/index.d.ts",
102
+ "import": "./dist/testing/index.js"
73
103
  }
74
104
  },
75
105
  "files": [
@@ -79,27 +109,36 @@
79
109
  "!**/*.spec.*"
80
110
  ],
81
111
  "dependencies": {
82
- "@selvajs/platform": "^0.19.1",
112
+ "zod": "^4.3.6",
83
113
  "@selvajs/compute": "^4.0.2",
114
+ "@selvajs/notifications": "^0.2.0",
115
+ "@selvajs/platform": "^0.20.0",
84
116
  "@selvajs/schemas": "^5.0.1"
85
117
  },
86
118
  "peerDependencies": {
87
119
  "@sentry/node": ">=8",
120
+ "nodemailer": ">=7",
88
121
  "pino": ">=9"
89
122
  },
90
123
  "peerDependenciesMeta": {
91
124
  "@sentry/node": {
92
125
  "optional": true
93
126
  },
127
+ "nodemailer": {
128
+ "optional": true
129
+ },
94
130
  "pino": {
95
131
  "optional": true
96
132
  }
97
133
  },
98
134
  "devDependencies": {
99
135
  "@types/node": "^26.2.0",
136
+ "@types/nodemailer": "^8.0.1",
137
+ "nodemailer": "^9.0.5",
100
138
  "typescript": "~6.0.3",
101
139
  "vitest": "^4.1.10",
102
- "@selvajs/config": "0.0.4"
140
+ "@selvajs/config": "0.0.4",
141
+ "@selvajs/local-provider": "0.15.2"
103
142
  },
104
143
  "scripts": {
105
144
  "build": "tsc",