alepha 0.19.2 → 0.19.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 (241) hide show
  1. package/assets/swagger-ui/swagger-ui-bundle.js +1 -1
  2. package/dist/api/audits/index.d.ts +8 -8
  3. package/dist/api/invitations/index.d.ts +790 -0
  4. package/dist/api/invitations/index.d.ts.map +1 -0
  5. package/dist/api/invitations/index.js +665 -0
  6. package/dist/api/invitations/index.js.map +1 -0
  7. package/dist/api/jobs/index.browser.js +8 -9
  8. package/dist/api/jobs/index.browser.js.map +1 -1
  9. package/dist/api/jobs/index.d.ts +90 -34
  10. package/dist/api/jobs/index.d.ts.map +1 -1
  11. package/dist/api/jobs/index.js +267 -44
  12. package/dist/api/jobs/index.js.map +1 -1
  13. package/dist/api/notifications/index.browser.js +0 -1
  14. package/dist/api/notifications/index.browser.js.map +1 -1
  15. package/dist/api/notifications/index.d.ts +3 -3
  16. package/dist/api/notifications/index.d.ts.map +1 -1
  17. package/dist/api/notifications/index.js +0 -1
  18. package/dist/api/notifications/index.js.map +1 -1
  19. package/dist/api/parameters/index.browser.js +112 -1
  20. package/dist/api/parameters/index.browser.js.map +1 -1
  21. package/dist/api/parameters/index.d.ts +90 -3
  22. package/dist/api/parameters/index.d.ts.map +1 -1
  23. package/dist/api/parameters/index.js +79 -12
  24. package/dist/api/parameters/index.js.map +1 -1
  25. package/dist/{billing → api/payments}/index.d.ts +67 -49
  26. package/dist/api/payments/index.d.ts.map +1 -0
  27. package/dist/{billing → api/payments}/index.js +108 -74
  28. package/dist/api/payments/index.js.map +1 -0
  29. package/dist/api/subscriptions/index.d.ts +1692 -0
  30. package/dist/api/subscriptions/index.d.ts.map +1 -0
  31. package/dist/api/subscriptions/index.js +1870 -0
  32. package/dist/api/subscriptions/index.js.map +1 -0
  33. package/dist/api/users/index.d.ts +27 -21
  34. package/dist/api/users/index.d.ts.map +1 -1
  35. package/dist/api/users/index.js +167 -34
  36. package/dist/api/users/index.js.map +1 -1
  37. package/dist/api/workflows/index.browser.js +246 -0
  38. package/dist/api/workflows/index.browser.js.map +1 -0
  39. package/dist/api/workflows/index.d.ts +1618 -0
  40. package/dist/api/workflows/index.d.ts.map +1 -0
  41. package/dist/api/workflows/index.js +1504 -0
  42. package/dist/api/workflows/index.js.map +1 -0
  43. package/dist/cli/config/index.d.ts +6 -28
  44. package/dist/cli/config/index.d.ts.map +1 -1
  45. package/dist/cli/config/index.js +5 -10
  46. package/dist/cli/config/index.js.map +1 -1
  47. package/dist/cli/core/index.d.ts +11669 -208
  48. package/dist/cli/core/index.d.ts.map +1 -1
  49. package/dist/cli/core/index.js +60 -69
  50. package/dist/cli/core/index.js.map +1 -1
  51. package/dist/cli/devtools/index.d.ts +5 -0
  52. package/dist/cli/devtools/index.d.ts.map +1 -1
  53. package/dist/cli/devtools/index.js +4 -0
  54. package/dist/cli/devtools/index.js.map +1 -1
  55. package/dist/cli/platform/index.d.ts +69 -64
  56. package/dist/cli/platform/index.d.ts.map +1 -1
  57. package/dist/cli/platform/index.js +6 -2
  58. package/dist/cli/platform/index.js.map +1 -1
  59. package/dist/cli/vendor/index.d.ts +38 -10
  60. package/dist/cli/vendor/index.d.ts.map +1 -1
  61. package/dist/cli/vendor/index.js +85 -26
  62. package/dist/cli/vendor/index.js.map +1 -1
  63. package/dist/core/index.browser.js +21 -2
  64. package/dist/core/index.browser.js.map +1 -1
  65. package/dist/core/index.d.ts +33 -2
  66. package/dist/core/index.d.ts.map +1 -1
  67. package/dist/core/index.js +25 -2
  68. package/dist/core/index.js.map +1 -1
  69. package/dist/core/index.native.js +25 -2
  70. package/dist/core/index.native.js.map +1 -1
  71. package/dist/core/index.workerd.js +25 -2
  72. package/dist/core/index.workerd.js.map +1 -1
  73. package/dist/email/smtp/index.js +24 -8
  74. package/dist/email/smtp/index.js.map +1 -1
  75. package/dist/logger/index.d.ts.map +1 -1
  76. package/dist/logger/index.js +1 -1
  77. package/dist/logger/index.js.map +1 -1
  78. package/dist/orm/core/index.browser.js +0 -18
  79. package/dist/orm/core/index.browser.js.map +1 -1
  80. package/dist/orm/core/index.bun.js +25 -73
  81. package/dist/orm/core/index.bun.js.map +1 -1
  82. package/dist/orm/core/index.d.ts +10 -32
  83. package/dist/orm/core/index.d.ts.map +1 -1
  84. package/dist/orm/core/index.js +25 -73
  85. package/dist/orm/core/index.js.map +1 -1
  86. package/dist/orm/postgres/index.bun.js +3 -3
  87. package/dist/orm/postgres/index.bun.js.map +1 -1
  88. package/dist/orm/postgres/index.d.ts +2 -1
  89. package/dist/orm/postgres/index.d.ts.map +1 -1
  90. package/dist/orm/postgres/index.js +3 -3
  91. package/dist/orm/postgres/index.js.map +1 -1
  92. package/dist/react/router/index.browser.js +25 -3
  93. package/dist/react/router/index.browser.js.map +1 -1
  94. package/dist/react/router/index.d.ts +16 -1
  95. package/dist/react/router/index.d.ts.map +1 -1
  96. package/dist/react/router/index.js +25 -3
  97. package/dist/react/router/index.js.map +1 -1
  98. package/dist/security/index.d.ts +28 -0
  99. package/dist/security/index.d.ts.map +1 -1
  100. package/dist/security/index.js +28 -0
  101. package/dist/security/index.js.map +1 -1
  102. package/package.json +37 -20
  103. package/src/api/invitations/__tests__/InvitationService.spec.ts +439 -0
  104. package/src/api/invitations/controllers/AdminInvitationController.ts +86 -0
  105. package/src/api/invitations/controllers/InvitationController.ts +84 -0
  106. package/src/api/invitations/entities/invitations.ts +33 -0
  107. package/src/api/invitations/index.ts +65 -0
  108. package/src/api/invitations/jobs/InvitationJobs.ts +37 -0
  109. package/src/api/invitations/providers/InvitationProvider.ts +45 -0
  110. package/src/api/invitations/schemas/createInvitationSchema.ts +12 -0
  111. package/src/api/invitations/schemas/invitationConfigAtom.ts +20 -0
  112. package/src/api/invitations/schemas/invitationQuerySchema.ts +15 -0
  113. package/src/api/invitations/schemas/invitationResourceSchema.ts +6 -0
  114. package/src/api/invitations/schemas/invitationWithResourceInfoSchema.ts +22 -0
  115. package/src/api/invitations/schemas/myInvitationsQuerySchema.ts +10 -0
  116. package/src/api/invitations/services/InvitationService.ts +556 -0
  117. package/src/api/jobs/__tests__/$job.spec.ts +876 -0
  118. package/src/api/jobs/controllers/AdminJobController.ts +44 -0
  119. package/src/api/jobs/entities/jobExecutionEntity.ts +0 -2
  120. package/src/api/jobs/index.ts +0 -3
  121. package/src/api/jobs/primitives/$job.ts +22 -11
  122. package/src/api/jobs/providers/JobProvider.ts +239 -25
  123. package/src/api/jobs/schemas/jobConfigAtom.ts +4 -0
  124. package/src/api/jobs/schemas/jobCronInfoSchema.ts +1 -0
  125. package/src/api/jobs/schemas/jobExecutionQuerySchema.ts +0 -1
  126. package/src/api/jobs/schemas/jobQueueDepthSchema.ts +1 -0
  127. package/src/api/jobs/schemas/jobRegistrationSchema.ts +1 -6
  128. package/src/api/jobs/services/JobService.ts +51 -12
  129. package/src/api/notifications/schemas/notificationQuerySchema.ts +0 -1
  130. package/src/api/parameters/__tests__/$parameter.spec.ts +327 -0
  131. package/src/api/parameters/controllers/AdminParameterController.ts +29 -3
  132. package/src/api/parameters/index.browser.ts +12 -0
  133. package/src/api/parameters/primitives/$parameter.ts +20 -3
  134. package/src/api/parameters/services/ParameterProvider.ts +48 -7
  135. package/src/{billing → api/payments}/__tests__/PaymentMethodService.spec.ts +32 -6
  136. package/src/api/payments/__tests__/PaymentService.spec.ts +279 -0
  137. package/src/{billing/controllers/AdminBillingController.ts → api/payments/controllers/AdminPaymentController.ts} +26 -21
  138. package/src/{billing/controllers/BillingController.ts → api/payments/controllers/PaymentController.ts} +23 -11
  139. package/src/{billing → api/payments}/entities/paymentIntents.ts +1 -0
  140. package/src/{billing/errors/BillingError.ts → api/payments/errors/PaymentError.ts} +1 -1
  141. package/src/{billing → api/payments}/index.ts +31 -25
  142. package/src/{billing/providers/MemoryBillingProvider.ts → api/payments/providers/MemoryPaymentProvider.ts} +4 -4
  143. package/src/{billing/providers/BillingProvider.ts → api/payments/providers/PaymentProvider.ts} +9 -2
  144. package/src/{billing → api/payments}/services/PaymentMethodService.ts +5 -5
  145. package/src/{billing/services/BillingService.ts → api/payments/services/PaymentService.ts} +94 -18
  146. package/src/api/subscriptions/__tests__/BillingService.spec.ts +218 -0
  147. package/src/api/subscriptions/__tests__/SubscriptionService.spec.ts +278 -0
  148. package/src/api/subscriptions/controllers/AdminSubscriptionController.ts +212 -0
  149. package/src/api/subscriptions/controllers/SubscriptionController.ts +189 -0
  150. package/src/api/subscriptions/entities/subscriptionEvents.ts +54 -0
  151. package/src/api/subscriptions/entities/subscriptions.ts +68 -0
  152. package/src/api/subscriptions/index.ts +144 -0
  153. package/src/api/subscriptions/jobs/SubscriptionJobs.ts +382 -0
  154. package/src/api/subscriptions/middleware/$requireLimit.ts +50 -0
  155. package/src/api/subscriptions/middleware/$requirePlan.ts +49 -0
  156. package/src/api/subscriptions/notifications/SubscriptionNotifications.ts +110 -0
  157. package/src/api/subscriptions/schemas/cancelSubscriptionSchema.ts +8 -0
  158. package/src/api/subscriptions/schemas/changePlanSchema.ts +9 -0
  159. package/src/api/subscriptions/schemas/createSubscriptionSchema.ts +11 -0
  160. package/src/api/subscriptions/schemas/entitlementsSchema.ts +21 -0
  161. package/src/api/subscriptions/schemas/mrrSchema.ts +13 -0
  162. package/src/api/subscriptions/schemas/planDefinitionSchema.ts +71 -0
  163. package/src/api/subscriptions/schemas/planResourceSchema.ts +25 -0
  164. package/src/api/subscriptions/schemas/subscriptionEventResourceSchema.ts +8 -0
  165. package/src/api/subscriptions/schemas/subscriptionQuerySchema.ts +19 -0
  166. package/src/api/subscriptions/schemas/subscriptionResourceSchema.ts +6 -0
  167. package/src/api/subscriptions/schemas/subscriptionSettingsSchema.ts +32 -0
  168. package/src/api/subscriptions/schemas/subscriptionStatsSchema.ts +23 -0
  169. package/src/api/subscriptions/services/BillingService.ts +437 -0
  170. package/src/api/subscriptions/services/SubscriptionConfig.ts +56 -0
  171. package/src/api/subscriptions/services/SubscriptionService.ts +867 -0
  172. package/src/api/subscriptions/services/UsageService.ts +118 -0
  173. package/src/api/users/__tests__/AdminUserController.spec.ts +80 -1
  174. package/src/api/users/__tests__/CredentialService.spec.ts +177 -0
  175. package/src/api/users/__tests__/EmailVerification.spec.ts +29 -18
  176. package/src/api/users/__tests__/PasswordReset.spec.ts +3 -0
  177. package/src/api/users/__tests__/RegistrationService.spec.ts +148 -1
  178. package/src/api/users/__tests__/SessionService.spec.ts +142 -1
  179. package/src/api/users/atoms/realmAuthSettingsAtom.ts +10 -1
  180. package/src/api/users/controllers/UserController.ts +3 -8
  181. package/src/api/users/notifications/UserNotifications.ts +23 -0
  182. package/src/api/users/schemas/loginSchema.ts +1 -1
  183. package/src/api/users/services/CredentialService.ts +51 -4
  184. package/src/api/users/services/RegistrationService.ts +38 -9
  185. package/src/api/users/services/SessionService.ts +62 -9
  186. package/src/api/users/services/UserService.ts +21 -12
  187. package/src/api/workflows/__tests__/$workflow.spec.ts +616 -0
  188. package/src/api/workflows/controllers/AdminWorkflowController.ts +191 -0
  189. package/src/api/workflows/entities/workflowExecutions.ts +74 -0
  190. package/src/api/workflows/entities/workflowStepExecutions.ts +74 -0
  191. package/src/api/workflows/entities/workflowStepLogs.ts +13 -0
  192. package/src/api/workflows/index.browser.ts +22 -0
  193. package/src/api/workflows/index.ts +124 -0
  194. package/src/api/workflows/jobs/WorkflowJobs.ts +77 -0
  195. package/src/api/workflows/primitives/$workflow.ts +202 -0
  196. package/src/api/workflows/providers/WorkflowProvider.ts +1284 -0
  197. package/src/api/workflows/schemas/workflowActivitySchema.ts +15 -0
  198. package/src/api/workflows/schemas/workflowConfigAtom.ts +51 -0
  199. package/src/api/workflows/schemas/workflowExecutionDetailSchema.ts +18 -0
  200. package/src/api/workflows/schemas/workflowExecutionQuerySchema.ts +26 -0
  201. package/src/api/workflows/schemas/workflowExecutionResourceSchema.ts +30 -0
  202. package/src/api/workflows/schemas/workflowRegistrationSchema.ts +26 -0
  203. package/src/api/workflows/schemas/workflowStatsSchema.ts +16 -0
  204. package/src/api/workflows/schemas/workflowStepExecutionResourceSchema.ts +15 -0
  205. package/src/api/workflows/services/WorkflowService.ts +382 -0
  206. package/src/cli/config/defineConfig.ts +17 -46
  207. package/src/cli/core/providers/ViteDevServerProvider.ts +45 -3
  208. package/src/cli/core/services/PackageManagerUtils.ts +3 -1
  209. package/src/cli/core/services/ProjectScaffolder.ts +5 -5
  210. package/src/cli/core/templates/agentMd.ts +14 -5
  211. package/src/cli/core/templates/webAppRouterTs.ts +5 -58
  212. package/src/cli/devtools/index.ts +21 -1
  213. package/src/cli/platform/index.ts +23 -2
  214. package/src/cli/vendor/__tests__/VendorService.spec.ts +283 -178
  215. package/src/cli/vendor/index.ts +20 -3
  216. package/src/cli/vendor/services/VendorService.ts +126 -27
  217. package/src/core/Alepha.ts +10 -0
  218. package/src/core/__tests__/TypeProvider.spec.ts +4 -2
  219. package/src/core/providers/SchemaValidator.ts +1 -1
  220. package/src/core/providers/TypeProvider.ts +46 -3
  221. package/src/logger/index.ts +6 -1
  222. package/src/orm/__tests__/enums.spec.ts +22 -29
  223. package/src/orm/__tests__/orm-showcase-tests.ts +430 -0
  224. package/src/orm/__tests__/orm-showcase.spec.ts +167 -0
  225. package/src/orm/core/providers/DatabaseTypeProvider.ts +0 -29
  226. package/src/orm/core/providers/DrizzleKitProvider.ts +56 -105
  227. package/src/orm/postgres/services/PostgresModelBuilder.ts +3 -6
  228. package/src/react/router/__tests__/$page.browser.spec.tsx +157 -0
  229. package/src/react/router/providers/ReactBrowserProvider.ts +39 -0
  230. package/src/react/router/providers/ReactBrowserRouterProvider.ts +22 -0
  231. package/src/security/__tests__/$secure-combinations.spec.ts +945 -0
  232. package/src/security/primitives/$secure.ts +28 -0
  233. package/tsconfig.base.json +0 -1
  234. package/dist/billing/index.d.ts.map +0 -1
  235. package/dist/billing/index.js.map +0 -1
  236. package/src/billing/__tests__/BillingService.spec.ts +0 -136
  237. /package/src/{billing → api/payments}/entities/paymentMethods.ts +0 -0
  238. /package/src/{billing → api/payments}/entities/refunds.ts +0 -0
  239. /package/src/{billing → api/payments}/schemas/intentSchemas.ts +0 -0
  240. /package/src/{billing → api/payments}/schemas/paymentMethodSchemas.ts +0 -0
  241. /package/src/{billing → api/payments}/schemas/refundSchemas.ts +0 -0
@@ -0,0 +1,790 @@
1
+ import * as _$alepha from "alepha";
2
+ import { Alepha, Static, TNull, TObject, TOptional, TSchema, TUnion } from "alepha";
3
+ import * as _$alepha_server0 from "alepha/server";
4
+ import * as _$alepha_orm0 from "alepha/orm";
5
+ import { Page } from "alepha/orm";
6
+ import { UserEntity } from "alepha/api/users";
7
+ import { CryptoProvider } from "alepha/crypto";
8
+ import { DateTimeProvider } from "alepha/datetime";
9
+ import * as _$alepha_logger0 from "alepha/logger";
10
+ import * as _$alepha_api_jobs0 from "alepha/api/jobs";
11
+ import { BuildExtraConfigColumns, SQL } from "drizzle-orm";
12
+ import { PgColumnBuilderBase, PgSequenceOptions, PgTableExtraConfigValue, UpdateDeleteAction } from "drizzle-orm/pg-core";
13
+ //#region ../../src/api/invitations/entities/invitations.d.ts
14
+ declare const invitations: _$alepha_orm0.EntityPrimitive<_$alepha.TObject<{
15
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
16
+ version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
17
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
18
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
19
+ invitedBy: _$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_REF>;
20
+ email: _$alepha.TString;
21
+ resourceType: _$alepha.TString;
22
+ resourceId: _$alepha.TString;
23
+ status: _$alepha.TUnsafe<"pending" | "accepted" | "declined" | "expired" | "revoked">;
24
+ roles: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
25
+ metadata: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
26
+ token: _$alepha.TString;
27
+ expiresAt: _$alepha.TString;
28
+ resolvedAt: _$alepha.TOptional<_$alepha.TString>;
29
+ resolvedBy: _$alepha.TOptional<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_REF>>;
30
+ }>>;
31
+ type InvitationEntity = Static<typeof invitations.schema>;
32
+ //#endregion
33
+ //#region ../../src/orm/core/schemas/insertSchema.d.ts
34
+ /**
35
+ * Transforms a TObject schema for insert operations.
36
+ * All default properties at the root level are made optional.
37
+ * Generated columns are excluded entirely.
38
+ *
39
+ * @example
40
+ * Before: { name: string; age: number(default=0); fullName: generated }
41
+ * After: { name: string; age?: number; }
42
+ */
43
+ type TObjectInsert<T extends TObject> = TObject<{ [K in keyof T["properties"] as T["properties"][K] extends {
44
+ [PG_GENERATED]: any;
45
+ } ? never : K]: T["properties"][K] extends {
46
+ [PG_DEFAULT]: any;
47
+ } | {
48
+ "~optional": true;
49
+ } ? TOptional<T["properties"][K]> : T["properties"][K] }>;
50
+ //#endregion
51
+ //#region ../../src/orm/core/schemas/updateSchema.d.ts
52
+ /**
53
+ * Transforms a TObject schema for update operations.
54
+ * All optional properties at the root level are made nullable (i.e., `T | null`).
55
+ * Generated columns are excluded entirely.
56
+ *
57
+ * @example
58
+ * Before: { name?: string; age: number; fullName: generated }
59
+ * After: { name?: string | null; age: number; }
60
+ */
61
+ type TObjectUpdate<T extends TObject> = TObject<{ [K in keyof T["properties"] as T["properties"][K] extends {
62
+ [PG_GENERATED]: any;
63
+ } ? never : K]: T["properties"][K] extends TOptional<infer U> ? TOptional<TUnion<[U, TNull]>> : T["properties"][K] }>;
64
+ //#endregion
65
+ //#region ../../src/orm/core/primitives/$entity.d.ts
66
+ interface EntityPrimitiveOptions<T extends TObject, Keys = keyof Static<T>> {
67
+ /**
68
+ * The database table name that will be created for this entity.
69
+ * If not provided, name will be inferred from the $repository variable name.
70
+ */
71
+ name: string;
72
+ /**
73
+ * TypeBox schema defining the table structure and column types.
74
+ */
75
+ schema: T;
76
+ /**
77
+ * Database indexes to create for query optimization.
78
+ */
79
+ indexes?: (Keys | {
80
+ /**
81
+ * Single column to index.
82
+ */
83
+ column: Keys;
84
+ /**
85
+ * Whether this should be a unique index (enforces uniqueness constraint).
86
+ */
87
+ unique?: boolean;
88
+ /**
89
+ * Custom name for the index. If not provided, generates name automatically.
90
+ */
91
+ name?: string;
92
+ /**
93
+ * Partial index condition. Only rows matching this SQL expression are indexed.
94
+ */
95
+ where?: SQL;
96
+ } | {
97
+ /**
98
+ * Multiple columns for composite index (order matters for query optimization).
99
+ */
100
+ columns: Keys[];
101
+ /**
102
+ * Whether this should be a unique index (enforces uniqueness constraint).
103
+ */
104
+ unique?: boolean;
105
+ /**
106
+ * Custom name for the index. If not provided, generates name automatically.
107
+ */
108
+ name?: string;
109
+ /**
110
+ * Partial index condition. Only rows matching this SQL expression are indexed.
111
+ */
112
+ where?: SQL;
113
+ } | {
114
+ /**
115
+ * SQL expressions for expression-based indexes.
116
+ *
117
+ * Can include column references and SQL functions like `LOWER()`, `UPPER()`, etc.
118
+ * Columns and expressions can be mixed together.
119
+ *
120
+ * @example
121
+ * ```ts
122
+ * // Case-insensitive unique username per realm
123
+ * indexes: [{
124
+ * expressions: (self) => [self.realm, sql`LOWER(${self.username})`],
125
+ * unique: true,
126
+ * name: "users_realm_username_lower_idx",
127
+ * }]
128
+ * ```
129
+ */
130
+ expressions: (self: Record<Keys & string, any>) => (SQL | any)[];
131
+ /**
132
+ * Whether this should be a unique index (enforces uniqueness constraint).
133
+ */
134
+ unique?: boolean;
135
+ /**
136
+ * Custom name for the index. If not provided, generates name automatically.
137
+ */
138
+ name: string;
139
+ /**
140
+ * Partial index condition. Only rows matching this SQL expression are indexed.
141
+ */
142
+ where?: SQL;
143
+ })[];
144
+ /**
145
+ * Foreign key constraints to maintain referential integrity.
146
+ */
147
+ foreignKeys?: Array<{
148
+ /**
149
+ * Optional name for the foreign key constraint.
150
+ */
151
+ name?: string;
152
+ /**
153
+ * Local columns that reference the foreign table.
154
+ */
155
+ columns: Array<keyof Static<T>>;
156
+ /**
157
+ * Referenced columns in the foreign table.
158
+ * Must be EntityColumn references from other entities.
159
+ */
160
+ foreignColumns: Array<() => EntityColumn<any>>;
161
+ }>;
162
+ /**
163
+ * Additional table constraints for data validation.
164
+ *
165
+ * Constraints enforce business rules at the database level, providing
166
+ * an additional layer of data integrity beyond application validation.
167
+ *
168
+ * **Constraint Types**:
169
+ * - **Unique constraints**: Prevent duplicate values across columns
170
+ * - **Check constraints**: Enforce custom validation rules with SQL expressions
171
+ *
172
+ * @example
173
+ * ```ts
174
+ * constraints: [
175
+ * {
176
+ * name: "unique_user_email",
177
+ * columns: ["email"],
178
+ * unique: true
179
+ * },
180
+ * {
181
+ * name: "valid_age_range",
182
+ * columns: ["age"],
183
+ * check: sql`age >= 0 AND age <= 150`
184
+ * },
185
+ * {
186
+ * name: "unique_user_username_per_tenant",
187
+ * columns: ["tenantId", "username"],
188
+ * unique: true
189
+ * }
190
+ * ]
191
+ * ```
192
+ */
193
+ constraints?: Array<{
194
+ /**
195
+ * Columns involved in this constraint.
196
+ */
197
+ columns: Array<keyof Static<T>>;
198
+ /**
199
+ * Optional name for the constraint.
200
+ */
201
+ name?: string;
202
+ /**
203
+ * Whether this is a unique constraint.
204
+ */
205
+ unique?: boolean | {};
206
+ /**
207
+ * SQL expression for check constraint validation.
208
+ */
209
+ check?: SQL;
210
+ }>;
211
+ /**
212
+ * Advanced Drizzle ORM configuration for complex table setups.
213
+ */
214
+ config?: (self: BuildExtraConfigColumns<string, FromSchema<T>, "pg">) => PgTableExtraConfigValue[];
215
+ }
216
+ declare class EntityPrimitive<T extends TObject = TObject> {
217
+ readonly options: EntityPrimitiveOptions<T>;
218
+ constructor(options: EntityPrimitiveOptions<T>);
219
+ alias(alias: string): this;
220
+ get cols(): EntityColumns<T>;
221
+ get name(): string;
222
+ get schema(): T;
223
+ get insertSchema(): TObjectInsert<T>;
224
+ get updateSchema(): TObjectUpdate<T>;
225
+ }
226
+ /**
227
+ * Convert a schema to columns.
228
+ */
229
+ type FromSchema<T extends TObject> = { [key in keyof T["properties"]]: PgColumnBuilderBase };
230
+ type EntityColumn<T extends TObject> = {
231
+ name: string;
232
+ entity: EntityPrimitive<T>;
233
+ };
234
+ type EntityColumns<T extends TObject> = { [key in keyof T["properties"]]: EntityColumn<T> };
235
+ //#endregion
236
+ //#region ../../src/orm/core/constants/PG_SYMBOLS.d.ts
237
+ declare const PG_DEFAULT: unique symbol;
238
+ declare const PG_PRIMARY_KEY: unique symbol;
239
+ declare const PG_CREATED_AT: unique symbol;
240
+ declare const PG_UPDATED_AT: unique symbol;
241
+ declare const PG_DELETED_AT: unique symbol;
242
+ declare const PG_VERSION: unique symbol;
243
+ declare const PG_IDENTITY: unique symbol;
244
+ declare const PG_ENUM: unique symbol;
245
+ declare const PG_REF: unique symbol;
246
+ declare const PG_GENERATED: unique symbol;
247
+ declare const PG_ORGANIZATION: unique symbol;
248
+ /**
249
+ * @deprecated Use `PG_IDENTITY` instead.
250
+ */
251
+ declare const PG_SERIAL: unique symbol;
252
+ type PgSymbols = {
253
+ [PG_DEFAULT]: {};
254
+ [PG_PRIMARY_KEY]: {};
255
+ [PG_CREATED_AT]: {};
256
+ [PG_UPDATED_AT]: {};
257
+ [PG_DELETED_AT]: {};
258
+ [PG_VERSION]: {};
259
+ [PG_IDENTITY]: PgIdentityOptions;
260
+ [PG_REF]: PgRefOptions;
261
+ [PG_ENUM]: PgEnumOptions;
262
+ [PG_GENERATED]: PgGeneratedOptions;
263
+ [PG_ORGANIZATION]: {};
264
+ /**
265
+ * @deprecated Use `PG_IDENTITY` instead.
266
+ */
267
+ [PG_SERIAL]: {};
268
+ };
269
+ type PgSymbolKeys = keyof PgSymbols;
270
+ type PgIdentityOptions = {
271
+ mode: "always" | "byDefault";
272
+ } & PgSequenceOptions & {
273
+ name?: string;
274
+ };
275
+ interface PgEnumOptions {
276
+ name?: string;
277
+ description?: string;
278
+ }
279
+ interface PgGeneratedOptions {
280
+ /**
281
+ * SQL expression for the generated column.
282
+ */
283
+ expression: SQL;
284
+ /**
285
+ * Storage mode for the generated column.
286
+ * - `"stored"` — value is computed on write and stored on disk (default for PostgreSQL).
287
+ * - `"virtual"` — value is computed on read (default for SQLite).
288
+ */
289
+ mode?: "stored" | "virtual";
290
+ }
291
+ interface PgRefOptions {
292
+ ref: () => {
293
+ name: string;
294
+ entity: EntityPrimitive;
295
+ };
296
+ actions?: {
297
+ onUpdate?: UpdateDeleteAction;
298
+ onDelete?: UpdateDeleteAction;
299
+ };
300
+ }
301
+ //#endregion
302
+ //#region ../../src/orm/core/helpers/pgAttr.d.ts
303
+ /**
304
+ * Type representation.
305
+ */
306
+ type PgAttr<T extends TSchema, TAttr extends PgSymbolKeys> = T & { [K in TAttr]: PgSymbols[K] };
307
+ //#endregion
308
+ //#region ../../src/orm/core/schemas/databaseEnvSchema.d.ts
309
+ /**
310
+ * Base database environment schema.
311
+ *
312
+ * Defines the `DATABASE_URL` connection string used by all ORM providers
313
+ * to determine the database driver and connection target.
314
+ *
315
+ * Supported URL formats:
316
+ * - `sqlite://:memory:` or `sqlite://./path/to/db` — SQLite (Node.js or Bun)
317
+ * - `postgres://user:password@host:port/database` — PostgreSQL (Node.js or Bun)
318
+ * - `pglite://:memory:` or `pglite://./path` — PGlite (embedded Postgres)
319
+ * - `d1://BINDING_NAME` — Cloudflare D1
320
+ * - `hyperdrive://BINDING_NAME` — Cloudflare Hyperdrive
321
+ */
322
+ declare const databaseEnvSchema: _$alepha.TObject<{
323
+ DATABASE_URL: _$alepha.TOptional<_$alepha.TString>;
324
+ /**
325
+ * Enable or disable push-based schema synchronization (drizzle-kit push).
326
+ *
327
+ * Defaults to `true` in development and test, `false` in production.
328
+ * Set to `false` in development to skip automatic schema sync
329
+ * (e.g. when managing migrations manually).
330
+ */
331
+ DATABASE_SYNC: _$alepha.TOptional<_$alepha.TBoolean>;
332
+ }>;
333
+ declare module "alepha" {
334
+ interface Env extends Partial<Static<typeof databaseEnvSchema>> {}
335
+ } //# sourceMappingURL=databaseEnvSchema.d.ts.map
336
+ //#endregion
337
+ //#region ../../src/api/invitations/providers/InvitationProvider.d.ts
338
+ /**
339
+ * Abstract provider that apps implement to customize invitation behavior
340
+ * per resource type.
341
+ */
342
+ declare abstract class InvitationProvider {
343
+ /**
344
+ * Validate that the resource exists and the inviter has permission to invite.
345
+ * Throw BadRequestError/ForbiddenError to reject.
346
+ */
347
+ abstract validateResource(resourceType: string, resourceId: string, inviter: {
348
+ id: string;
349
+ email?: string;
350
+ }): Promise<void>;
351
+ /**
352
+ * Check if the email is already a member of the resource.
353
+ * Return true to reject the invitation as duplicate membership.
354
+ */
355
+ abstract isMember(resourceType: string, resourceId: string, email: string, userId?: string): Promise<boolean>;
356
+ /**
357
+ * Called when an invitation is accepted.
358
+ * Create membership records, assign roles, etc.
359
+ */
360
+ abstract onAccept(invitation: InvitationEntity, acceptedBy: {
361
+ id: string;
362
+ email?: string;
363
+ }): Promise<void>;
364
+ /**
365
+ * Return display info for the resource (used in API responses).
366
+ */
367
+ abstract getResourceInfo(resourceType: string, resourceId: string): Promise<{
368
+ name: string;
369
+ description?: string;
370
+ url?: string;
371
+ }>;
372
+ }
373
+ //#endregion
374
+ //#region ../../src/api/invitations/schemas/createInvitationSchema.d.ts
375
+ declare const createInvitationSchema: _$alepha.TObject<{
376
+ email: _$alepha.TString;
377
+ resourceType: _$alepha.TString;
378
+ resourceId: _$alepha.TString;
379
+ roles: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
380
+ metadata: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
381
+ }>;
382
+ type CreateInvitation = Static<typeof createInvitationSchema>;
383
+ //#endregion
384
+ //#region ../../src/api/invitations/schemas/invitationQuerySchema.d.ts
385
+ declare const invitationQuerySchema: _$alepha.TObject<{
386
+ page: _$alepha.TOptional<_$alepha.TInteger>;
387
+ size: _$alepha.TOptional<_$alepha.TInteger>;
388
+ sort: _$alepha.TOptional<_$alepha.TString>;
389
+ email: _$alepha.TOptional<_$alepha.TString>;
390
+ resourceType: _$alepha.TOptional<_$alepha.TString>;
391
+ resourceId: _$alepha.TOptional<_$alepha.TString>;
392
+ status: _$alepha.TOptional<_$alepha.TUnsafe<"pending" | "accepted" | "declined" | "expired" | "revoked">>;
393
+ invitedBy: _$alepha.TOptional<_$alepha.TString>;
394
+ }>;
395
+ type InvitationQuery = Static<typeof invitationQuerySchema>;
396
+ //#endregion
397
+ //#region ../../src/api/invitations/schemas/invitationWithResourceInfoSchema.d.ts
398
+ declare const invitationWithResourceInfoSchema: _$alepha.TObject<{
399
+ id: _$alepha.TString;
400
+ email: _$alepha.TString;
401
+ resourceType: _$alepha.TString;
402
+ resourceId: _$alepha.TString;
403
+ resourceName: _$alepha.TString;
404
+ resourceUrl: _$alepha.TOptional<_$alepha.TString>;
405
+ invitedBy: _$alepha.TString;
406
+ inviterName: _$alepha.TOptional<_$alepha.TString>;
407
+ inviterEmail: _$alepha.TOptional<_$alepha.TString>;
408
+ roles: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
409
+ status: _$alepha.TUnsafe<"pending" | "accepted" | "declined" | "expired" | "revoked">;
410
+ createdAt: _$alepha.TString;
411
+ expiresAt: _$alepha.TString;
412
+ }>;
413
+ type InvitationWithResourceInfo = Static<typeof invitationWithResourceInfoSchema>;
414
+ //#endregion
415
+ //#region ../../src/api/invitations/schemas/myInvitationsQuerySchema.d.ts
416
+ declare const myInvitationsQuerySchema: _$alepha.TObject<{
417
+ status: _$alepha.TOptional<_$alepha.TUnsafe<"pending" | "accepted" | "declined" | "expired" | "revoked">>;
418
+ }>;
419
+ type MyInvitationsQuery = Static<typeof myInvitationsQuerySchema>;
420
+ //#endregion
421
+ //#region ../../src/api/invitations/services/InvitationService.d.ts
422
+ declare class InvitationService {
423
+ protected readonly alepha: Alepha;
424
+ protected readonly log: _$alepha_logger0.Logger;
425
+ protected readonly repo: _$alepha_orm0.Repository<_$alepha.TObject<{
426
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
427
+ version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
428
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
429
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
430
+ invitedBy: _$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_REF>;
431
+ email: _$alepha.TString;
432
+ resourceType: _$alepha.TString;
433
+ resourceId: _$alepha.TString;
434
+ status: _$alepha.TUnsafe<"pending" | "accepted" | "declined" | "expired" | "revoked">;
435
+ roles: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
436
+ metadata: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
437
+ token: _$alepha.TString;
438
+ expiresAt: _$alepha.TString;
439
+ resolvedAt: _$alepha.TOptional<_$alepha.TString>;
440
+ resolvedBy: _$alepha.TOptional<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_REF>>;
441
+ }>>;
442
+ protected readonly users: _$alepha_orm0.Repository<_$alepha.TObject<{
443
+ id: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_PRIMARY_KEY>, typeof _$alepha_orm0.PG_DEFAULT>;
444
+ version: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TInteger, typeof _$alepha_orm0.PG_VERSION>, typeof _$alepha_orm0.PG_DEFAULT>;
445
+ createdAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_CREATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
446
+ updatedAt: _$alepha_orm0.PgAttr<_$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_UPDATED_AT>, typeof _$alepha_orm0.PG_DEFAULT>;
447
+ realm: _$alepha_orm0.PgAttr<_$alepha.TString, typeof _$alepha_orm0.PG_DEFAULT>;
448
+ username: _$alepha.TOptional<_$alepha.TString>;
449
+ email: _$alepha.TOptional<_$alepha.TString>;
450
+ phoneNumber: _$alepha.TOptional<_$alepha.TString>;
451
+ roles: _$alepha_orm0.PgAttr<_$alepha.TArray<_$alepha.TString>, typeof _$alepha_orm0.PG_DEFAULT>;
452
+ firstName: _$alepha.TOptional<_$alepha.TString>;
453
+ lastName: _$alepha.TOptional<_$alepha.TString>;
454
+ picture: _$alepha.TOptional<_$alepha.TString>;
455
+ enabled: _$alepha_orm0.PgAttr<_$alepha.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
456
+ emailVerified: _$alepha_orm0.PgAttr<_$alepha.TBoolean, typeof _$alepha_orm0.PG_DEFAULT>;
457
+ organizationId: _$alepha_orm0.PgAttr<_$alepha.TOptional<_$alepha.TString>, typeof _$alepha_orm0.PG_ORGANIZATION>;
458
+ }>>;
459
+ protected readonly crypto: CryptoProvider;
460
+ protected readonly dateTime: DateTimeProvider;
461
+ protected readonly provider: InvitationProvider;
462
+ /**
463
+ * Get an invitation by ID.
464
+ */
465
+ getById(id: string): Promise<InvitationEntity>;
466
+ /**
467
+ * Create a new invitation.
468
+ */
469
+ create(data: CreateInvitation, inviter: {
470
+ id: string;
471
+ email?: string;
472
+ }): Promise<InvitationEntity>;
473
+ /**
474
+ * Accept a pending invitation.
475
+ */
476
+ accept(invitationId: string, acceptedBy: {
477
+ id: string;
478
+ email?: string;
479
+ }): Promise<void>;
480
+ /**
481
+ * Decline a pending invitation.
482
+ */
483
+ decline(invitationId: string, declinedBy: {
484
+ id: string;
485
+ email?: string;
486
+ }): Promise<void>;
487
+ /**
488
+ * Revoke a pending invitation (by the inviter or admin).
489
+ */
490
+ revoke(invitationId: string, revokedBy: {
491
+ id: string;
492
+ }): Promise<void>;
493
+ /**
494
+ * Find invitations for a given email with resource info enrichment.
495
+ */
496
+ findByEmail(email: string, query?: MyInvitationsQuery): Promise<InvitationWithResourceInfo[]>;
497
+ /**
498
+ * Find invitations for a specific resource.
499
+ */
500
+ findByResource(resourceType: string, resourceId: string, status?: string): Promise<InvitationEntity[]>;
501
+ /**
502
+ * Find invitations with pagination and filtering (admin).
503
+ */
504
+ findInvitations(query?: InvitationQuery): Promise<Page<InvitationEntity>>;
505
+ /**
506
+ * Delete an invitation (admin). Only non-pending invitations can be deleted.
507
+ */
508
+ deleteInvitation(id: string): Promise<void>;
509
+ /**
510
+ * Expire all pending invitations that have passed their expiration date.
511
+ * Returns the number of expired invitations.
512
+ */
513
+ expirePending(): Promise<number>;
514
+ /**
515
+ * Purge resolved invitations older than the configured purge days.
516
+ * Returns the number of purged invitations.
517
+ */
518
+ purgeResolved(): Promise<number>;
519
+ /**
520
+ * Load user records for a list of inviter IDs.
521
+ */
522
+ protected loadInviters(ids: string[]): Promise<Map<string, UserEntity>>;
523
+ /**
524
+ * Format inviter display name from user entity.
525
+ */
526
+ protected formatInviterName(user?: UserEntity): string | undefined;
527
+ }
528
+ //#endregion
529
+ //#region ../../src/api/invitations/controllers/AdminInvitationController.d.ts
530
+ declare class AdminInvitationController {
531
+ protected readonly url = "/invitations";
532
+ protected readonly group = "admin:invitations";
533
+ protected readonly invitationService: InvitationService;
534
+ /**
535
+ * Find invitations with pagination and filtering.
536
+ */
537
+ readonly findInvitations: _$alepha_server0.ActionPrimitiveFn<{
538
+ query: _$alepha.TObject<{
539
+ page: _$alepha.TOptional<_$alepha.TInteger>;
540
+ size: _$alepha.TOptional<_$alepha.TInteger>;
541
+ sort: _$alepha.TOptional<_$alepha.TString>;
542
+ email: _$alepha.TOptional<_$alepha.TString>;
543
+ resourceType: _$alepha.TOptional<_$alepha.TString>;
544
+ resourceId: _$alepha.TOptional<_$alepha.TString>;
545
+ status: _$alepha.TOptional<_$alepha.TUnsafe<"pending" | "accepted" | "declined" | "expired" | "revoked">>;
546
+ invitedBy: _$alepha.TOptional<_$alepha.TString>;
547
+ }>;
548
+ response: _$alepha.TPage<_$alepha.TObject<{
549
+ id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
550
+ version: PgAttr<PgAttr<_$alepha.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
551
+ createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
552
+ updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
553
+ invitedBy: PgAttr<_$alepha.TString, typeof PG_REF>;
554
+ email: _$alepha.TString;
555
+ resourceType: _$alepha.TString;
556
+ resourceId: _$alepha.TString;
557
+ status: _$alepha.TUnsafe<"pending" | "accepted" | "declined" | "expired" | "revoked">;
558
+ roles: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
559
+ metadata: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
560
+ token: _$alepha.TString;
561
+ expiresAt: _$alepha.TString;
562
+ resolvedAt: _$alepha.TOptional<_$alepha.TString>;
563
+ resolvedBy: _$alepha.TOptional<PgAttr<_$alepha.TString, typeof PG_REF>>;
564
+ }>>;
565
+ }>;
566
+ /**
567
+ * Get an invitation by ID.
568
+ */
569
+ readonly getInvitation: _$alepha_server0.ActionPrimitiveFn<{
570
+ params: _$alepha.TObject<{
571
+ id: _$alepha.TString;
572
+ }>;
573
+ response: _$alepha.TObject<{
574
+ id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
575
+ version: PgAttr<PgAttr<_$alepha.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
576
+ createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
577
+ updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
578
+ invitedBy: PgAttr<_$alepha.TString, typeof PG_REF>;
579
+ email: _$alepha.TString;
580
+ resourceType: _$alepha.TString;
581
+ resourceId: _$alepha.TString;
582
+ status: _$alepha.TUnsafe<"pending" | "accepted" | "declined" | "expired" | "revoked">;
583
+ roles: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
584
+ metadata: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
585
+ token: _$alepha.TString;
586
+ expiresAt: _$alepha.TString;
587
+ resolvedAt: _$alepha.TOptional<_$alepha.TString>;
588
+ resolvedBy: _$alepha.TOptional<PgAttr<_$alepha.TString, typeof PG_REF>>;
589
+ }>;
590
+ }>;
591
+ /**
592
+ * Revoke a pending invitation.
593
+ */
594
+ readonly revokeInvitation: _$alepha_server0.ActionPrimitiveFn<{
595
+ params: _$alepha.TObject<{
596
+ id: _$alepha.TString;
597
+ }>;
598
+ response: _$alepha.TObject<{
599
+ ok: _$alepha.TBoolean;
600
+ id: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TString, _$alepha.TInteger]>>;
601
+ count: _$alepha.TOptional<_$alepha.TNumber>;
602
+ }>;
603
+ }>;
604
+ /**
605
+ * Delete an invitation.
606
+ */
607
+ readonly deleteInvitation: _$alepha_server0.ActionPrimitiveFn<{
608
+ params: _$alepha.TObject<{
609
+ id: _$alepha.TString;
610
+ }>;
611
+ response: _$alepha.TObject<{
612
+ ok: _$alepha.TBoolean;
613
+ id: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TString, _$alepha.TInteger]>>;
614
+ count: _$alepha.TOptional<_$alepha.TNumber>;
615
+ }>;
616
+ }>;
617
+ }
618
+ //#endregion
619
+ //#region ../../src/api/invitations/controllers/InvitationController.d.ts
620
+ declare class InvitationController {
621
+ protected readonly url = "/invitations";
622
+ protected readonly group = "invitations";
623
+ protected readonly invitationService: InvitationService;
624
+ /**
625
+ * Create a new invitation.
626
+ */
627
+ readonly createInvitation: _$alepha_server0.ActionPrimitiveFn<{
628
+ body: _$alepha.TObject<{
629
+ email: _$alepha.TString;
630
+ resourceType: _$alepha.TString;
631
+ resourceId: _$alepha.TString;
632
+ roles: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
633
+ metadata: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
634
+ }>;
635
+ response: _$alepha.TObject<{
636
+ id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
637
+ version: PgAttr<PgAttr<_$alepha.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
638
+ createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
639
+ updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
640
+ invitedBy: PgAttr<_$alepha.TString, typeof PG_REF>;
641
+ email: _$alepha.TString;
642
+ resourceType: _$alepha.TString;
643
+ resourceId: _$alepha.TString;
644
+ status: _$alepha.TUnsafe<"pending" | "accepted" | "declined" | "expired" | "revoked">;
645
+ roles: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
646
+ metadata: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
647
+ token: _$alepha.TString;
648
+ expiresAt: _$alepha.TString;
649
+ resolvedAt: _$alepha.TOptional<_$alepha.TString>;
650
+ resolvedBy: _$alepha.TOptional<PgAttr<_$alepha.TString, typeof PG_REF>>;
651
+ }>;
652
+ }>;
653
+ /**
654
+ * List invitations for the current user.
655
+ */
656
+ readonly getMyInvitations: _$alepha_server0.ActionPrimitiveFn<{
657
+ query: _$alepha.TObject<{
658
+ status: _$alepha.TOptional<_$alepha.TUnsafe<"pending" | "accepted" | "declined" | "expired" | "revoked">>;
659
+ }>;
660
+ response: _$alepha.TArray<_$alepha.TObject<{
661
+ id: _$alepha.TString;
662
+ email: _$alepha.TString;
663
+ resourceType: _$alepha.TString;
664
+ resourceId: _$alepha.TString;
665
+ resourceName: _$alepha.TString;
666
+ resourceUrl: _$alepha.TOptional<_$alepha.TString>;
667
+ invitedBy: _$alepha.TString;
668
+ inviterName: _$alepha.TOptional<_$alepha.TString>;
669
+ inviterEmail: _$alepha.TOptional<_$alepha.TString>;
670
+ roles: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
671
+ status: _$alepha.TUnsafe<"pending" | "accepted" | "declined" | "expired" | "revoked">;
672
+ createdAt: _$alepha.TString;
673
+ expiresAt: _$alepha.TString;
674
+ }>>;
675
+ }>;
676
+ /**
677
+ * Accept an invitation.
678
+ */
679
+ readonly acceptInvitation: _$alepha_server0.ActionPrimitiveFn<{
680
+ params: _$alepha.TObject<{
681
+ id: _$alepha.TString;
682
+ }>;
683
+ response: _$alepha.TObject<{
684
+ ok: _$alepha.TBoolean;
685
+ id: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TString, _$alepha.TInteger]>>;
686
+ count: _$alepha.TOptional<_$alepha.TNumber>;
687
+ }>;
688
+ }>;
689
+ /**
690
+ * Decline an invitation.
691
+ */
692
+ readonly declineInvitation: _$alepha_server0.ActionPrimitiveFn<{
693
+ params: _$alepha.TObject<{
694
+ id: _$alepha.TString;
695
+ }>;
696
+ response: _$alepha.TObject<{
697
+ ok: _$alepha.TBoolean;
698
+ id: _$alepha.TOptional<_$alepha.TUnion<[_$alepha.TString, _$alepha.TInteger]>>;
699
+ count: _$alepha.TOptional<_$alepha.TNumber>;
700
+ }>;
701
+ }>;
702
+ }
703
+ //#endregion
704
+ //#region ../../src/api/invitations/jobs/InvitationJobs.d.ts
705
+ declare class InvitationJobs {
706
+ protected readonly log: _$alepha_logger0.Logger;
707
+ protected readonly invitationService: InvitationService;
708
+ /**
709
+ * Expire pending invitations that have passed their expiration date.
710
+ */
711
+ readonly expireInvitations: _$alepha_api_jobs0.JobPrimitive<_$alepha.TSchema>;
712
+ /**
713
+ * Purge old resolved invitations.
714
+ */
715
+ readonly purgeInvitations: _$alepha_api_jobs0.JobPrimitive<_$alepha.TSchema>;
716
+ }
717
+ //#endregion
718
+ //#region ../../src/api/invitations/schemas/invitationConfigAtom.d.ts
719
+ declare const invitationConfigAtom: _$alepha.Atom<_$alepha.TObject<{
720
+ expirationDays: _$alepha.TInteger;
721
+ maxPendingPerResource: _$alepha.TInteger;
722
+ maxPendingPerInviter: _$alepha.TInteger;
723
+ purgeDays: _$alepha.TInteger;
724
+ }>, "alepha.api.invitations.config">;
725
+ //#endregion
726
+ //#region ../../src/api/invitations/schemas/invitationResourceSchema.d.ts
727
+ declare const invitationResourceSchema: _$alepha.TObject<{
728
+ id: PgAttr<PgAttr<_$alepha.TString, typeof PG_PRIMARY_KEY>, typeof PG_DEFAULT>;
729
+ version: PgAttr<PgAttr<_$alepha.TInteger, typeof PG_VERSION>, typeof PG_DEFAULT>;
730
+ createdAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_CREATED_AT>, typeof PG_DEFAULT>;
731
+ updatedAt: PgAttr<PgAttr<_$alepha.TString, typeof PG_UPDATED_AT>, typeof PG_DEFAULT>;
732
+ invitedBy: PgAttr<_$alepha.TString, typeof PG_REF>;
733
+ email: _$alepha.TString;
734
+ resourceType: _$alepha.TString;
735
+ resourceId: _$alepha.TString;
736
+ status: _$alepha.TUnsafe<"pending" | "accepted" | "declined" | "expired" | "revoked">;
737
+ roles: _$alepha.TOptional<_$alepha.TArray<_$alepha.TString>>;
738
+ metadata: _$alepha.TOptional<_$alepha.TRecord<"^.*$", _$alepha.TAny>>;
739
+ token: _$alepha.TString;
740
+ expiresAt: _$alepha.TString;
741
+ resolvedAt: _$alepha.TOptional<_$alepha.TString>;
742
+ resolvedBy: _$alepha.TOptional<PgAttr<_$alepha.TString, typeof PG_REF>>;
743
+ }>;
744
+ type InvitationResource = Static<typeof invitationResourceSchema>;
745
+ //#endregion
746
+ //#region ../../src/api/invitations/index.d.ts
747
+ declare module "alepha" {
748
+ interface Hooks {
749
+ "invitation:created": {
750
+ invitation: InvitationEntity;
751
+ token: string;
752
+ inviter: {
753
+ id: string;
754
+ email?: string;
755
+ };
756
+ };
757
+ "invitation:accepted": {
758
+ invitation: InvitationEntity;
759
+ acceptedBy: {
760
+ id: string;
761
+ email?: string;
762
+ };
763
+ };
764
+ "invitation:declined": {
765
+ invitation: InvitationEntity;
766
+ declinedBy: {
767
+ id: string;
768
+ email?: string;
769
+ };
770
+ };
771
+ "invitation:expired": {
772
+ invitation: InvitationEntity;
773
+ };
774
+ "invitation:revoked": {
775
+ invitation: InvitationEntity;
776
+ revokedBy: {
777
+ id: string;
778
+ };
779
+ };
780
+ }
781
+ }
782
+ /**
783
+ * Invitation management module — create, accept, decline, revoke, and expire invitations.
784
+ *
785
+ * @module alepha.api.invitations
786
+ */
787
+ declare const AlephaApiInvitations: _$alepha.Service<_$alepha.Module>;
788
+ //#endregion
789
+ export { AdminInvitationController, AlephaApiInvitations, CreateInvitation, InvitationController, InvitationEntity, InvitationJobs, InvitationProvider, InvitationQuery, InvitationResource, InvitationService, InvitationWithResourceInfo, MyInvitationsQuery, createInvitationSchema, invitationConfigAtom, invitationQuerySchema, invitationResourceSchema, invitationWithResourceInfoSchema, invitations, myInvitationsQuerySchema };
790
+ //# sourceMappingURL=index.d.ts.map