alepha 0.19.3 → 0.19.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/swagger-ui/swagger-ui-bundle.js +1 -1
- package/dist/api/invitations/index.d.ts +790 -0
- package/dist/api/invitations/index.d.ts.map +1 -0
- package/dist/api/invitations/index.js +665 -0
- package/dist/api/invitations/index.js.map +1 -0
- package/dist/api/issues/index.d.ts +810 -0
- package/dist/api/issues/index.d.ts.map +1 -0
- package/dist/api/issues/index.js +447 -0
- package/dist/api/issues/index.js.map +1 -0
- package/dist/api/jobs/index.browser.js +8 -9
- package/dist/api/jobs/index.browser.js.map +1 -1
- package/dist/api/jobs/index.d.ts +99 -43
- package/dist/api/jobs/index.d.ts.map +1 -1
- package/dist/api/jobs/index.js +257 -40
- package/dist/api/jobs/index.js.map +1 -1
- package/dist/api/notifications/index.browser.js +0 -1
- package/dist/api/notifications/index.browser.js.map +1 -1
- package/dist/api/notifications/index.d.ts +3 -3
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/notifications/index.js +0 -1
- package/dist/api/notifications/index.js.map +1 -1
- package/dist/api/parameters/index.browser.js +112 -1
- package/dist/api/parameters/index.browser.js.map +1 -1
- package/dist/api/parameters/index.d.ts +90 -3
- package/dist/api/parameters/index.d.ts.map +1 -1
- package/dist/api/parameters/index.js +79 -12
- package/dist/api/parameters/index.js.map +1 -1
- package/dist/{billing → api/payments}/index.d.ts +67 -49
- package/dist/api/payments/index.d.ts.map +1 -0
- package/dist/{billing → api/payments}/index.js +108 -74
- package/dist/api/payments/index.js.map +1 -0
- package/dist/api/subscriptions/index.d.ts +1692 -0
- package/dist/api/subscriptions/index.d.ts.map +1 -0
- package/dist/api/subscriptions/index.js +1870 -0
- package/dist/api/subscriptions/index.js.map +1 -0
- package/dist/api/users/index.d.ts +24 -2
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +176 -36
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.d.ts +13 -13
- package/dist/api/workflows/index.browser.js +246 -0
- package/dist/api/workflows/index.browser.js.map +1 -0
- package/dist/api/workflows/index.d.ts +1618 -0
- package/dist/api/workflows/index.d.ts.map +1 -0
- package/dist/api/workflows/index.js +1504 -0
- package/dist/api/workflows/index.js.map +1 -0
- package/dist/captcha/index.d.ts +142 -0
- package/dist/captcha/index.d.ts.map +1 -0
- package/dist/captcha/index.js +177 -0
- package/dist/captcha/index.js.map +1 -0
- package/dist/cli/core/index.d.ts +126 -30
- package/dist/cli/core/index.d.ts.map +1 -1
- package/dist/cli/core/index.js +106 -67
- package/dist/cli/core/index.js.map +1 -1
- package/dist/cli/platform/index.d.ts +84 -10
- package/dist/cli/platform/index.d.ts.map +1 -1
- package/dist/cli/platform/index.js +92 -4
- package/dist/cli/platform/index.js.map +1 -1
- package/dist/cli/vendor/index.d.ts +60 -10
- package/dist/cli/vendor/index.d.ts.map +1 -1
- package/dist/cli/vendor/index.js +177 -45
- package/dist/cli/vendor/index.js.map +1 -1
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +2 -3
- package/dist/command/index.js.map +1 -1
- package/dist/core/index.browser.js +21 -2
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +33 -2
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +21 -2
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +21 -2
- package/dist/core/index.native.js.map +1 -1
- package/dist/core/index.workerd.js +21 -2
- package/dist/core/index.workerd.js.map +1 -1
- package/dist/email/smtp/index.js +24 -8
- package/dist/email/smtp/index.js.map +1 -1
- package/dist/orm/core/index.browser.js +0 -18
- package/dist/orm/core/index.browser.js.map +1 -1
- package/dist/orm/core/index.bun.js +6 -23
- package/dist/orm/core/index.bun.js.map +1 -1
- package/dist/orm/core/index.d.ts +1 -13
- package/dist/orm/core/index.d.ts.map +1 -1
- package/dist/orm/core/index.js +6 -23
- package/dist/orm/core/index.js.map +1 -1
- package/dist/orm/postgres/index.bun.js +3 -3
- package/dist/orm/postgres/index.bun.js.map +1 -1
- package/dist/orm/postgres/index.d.ts.map +1 -1
- package/dist/orm/postgres/index.js +3 -3
- package/dist/orm/postgres/index.js.map +1 -1
- package/dist/react/i18n/index.d.ts +1 -0
- package/dist/react/i18n/index.d.ts.map +1 -1
- package/dist/react/i18n/index.js +8 -4
- package/dist/react/i18n/index.js.map +1 -1
- package/dist/react/router/index.browser.js +25 -3
- package/dist/react/router/index.browser.js.map +1 -1
- package/dist/react/router/index.d.ts +16 -1
- package/dist/react/router/index.d.ts.map +1 -1
- package/dist/react/router/index.js +25 -3
- package/dist/react/router/index.js.map +1 -1
- package/dist/security/index.d.ts +28 -0
- package/dist/security/index.d.ts.map +1 -1
- package/dist/security/index.js +28 -0
- package/dist/security/index.js.map +1 -1
- package/dist/server/auth/index.d.ts +145 -2
- package/dist/server/auth/index.d.ts.map +1 -1
- package/dist/server/auth/index.js +364 -63
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/cookies/index.d.ts.map +1 -1
- package/dist/server/cookies/index.js.map +1 -1
- package/dist/websocket/index.d.ts.map +1 -1
- package/dist/websocket/index.js.map +1 -1
- package/package.json +47 -20
- package/src/api/invitations/__tests__/InvitationService.spec.ts +439 -0
- package/src/api/invitations/controllers/AdminInvitationController.ts +86 -0
- package/src/api/invitations/controllers/InvitationController.ts +84 -0
- package/src/api/invitations/entities/invitations.ts +33 -0
- package/src/api/invitations/index.ts +65 -0
- package/src/api/invitations/jobs/InvitationJobs.ts +37 -0
- package/src/api/invitations/providers/InvitationProvider.ts +45 -0
- package/src/api/invitations/schemas/createInvitationSchema.ts +12 -0
- package/src/api/invitations/schemas/invitationConfigAtom.ts +20 -0
- package/src/api/invitations/schemas/invitationQuerySchema.ts +15 -0
- package/src/api/invitations/schemas/invitationResourceSchema.ts +6 -0
- package/src/api/invitations/schemas/invitationWithResourceInfoSchema.ts +22 -0
- package/src/api/invitations/schemas/myInvitationsQuerySchema.ts +10 -0
- package/src/api/invitations/services/InvitationService.ts +556 -0
- package/src/api/issues/__tests__/IssueService.spec.ts +263 -0
- package/src/api/issues/controllers/AdminIssueController.ts +149 -0
- package/src/api/issues/controllers/IssueController.ts +44 -0
- package/src/api/issues/entities/issues.ts +49 -0
- package/src/api/issues/index.ts +53 -0
- package/src/api/issues/schemas/createIssueSchema.ts +13 -0
- package/src/api/issues/schemas/issueConfigAtom.ts +13 -0
- package/src/api/issues/schemas/issueQuerySchema.ts +18 -0
- package/src/api/issues/schemas/issueResourceSchema.ts +6 -0
- package/src/api/issues/schemas/myIssueQuerySchema.ts +10 -0
- package/src/api/issues/schemas/updateIssueSchema.ts +13 -0
- package/src/api/issues/services/IssueService.ts +264 -0
- package/src/api/jobs/__tests__/$job.spec.ts +876 -0
- package/src/api/jobs/controllers/AdminJobController.ts +44 -0
- package/src/api/jobs/entities/jobExecutionEntity.ts +0 -2
- package/src/api/jobs/index.ts +0 -3
- package/src/api/jobs/primitives/$job.ts +22 -11
- package/src/api/jobs/providers/JobProvider.ts +229 -19
- package/src/api/jobs/schemas/jobConfigAtom.ts +4 -0
- package/src/api/jobs/schemas/jobCronInfoSchema.ts +1 -0
- package/src/api/jobs/schemas/jobExecutionQuerySchema.ts +0 -1
- package/src/api/jobs/schemas/jobQueueDepthSchema.ts +1 -0
- package/src/api/jobs/schemas/jobRegistrationSchema.ts +1 -6
- package/src/api/jobs/services/JobService.ts +51 -12
- package/src/api/notifications/schemas/notificationQuerySchema.ts +0 -1
- package/src/api/parameters/__tests__/$parameter.spec.ts +327 -0
- package/src/api/parameters/controllers/AdminParameterController.ts +29 -3
- package/src/api/parameters/index.browser.ts +12 -0
- package/src/api/parameters/primitives/$parameter.ts +20 -3
- package/src/api/parameters/services/ParameterProvider.ts +48 -7
- package/src/{billing → api/payments}/__tests__/PaymentMethodService.spec.ts +32 -6
- package/src/api/payments/__tests__/PaymentService.spec.ts +279 -0
- package/src/{billing/controllers/AdminBillingController.ts → api/payments/controllers/AdminPaymentController.ts} +26 -21
- package/src/{billing/controllers/BillingController.ts → api/payments/controllers/PaymentController.ts} +23 -11
- package/src/{billing → api/payments}/entities/paymentIntents.ts +1 -0
- package/src/{billing/errors/BillingError.ts → api/payments/errors/PaymentError.ts} +1 -1
- package/src/{billing → api/payments}/index.ts +31 -25
- package/src/{billing/providers/MemoryBillingProvider.ts → api/payments/providers/MemoryPaymentProvider.ts} +4 -4
- package/src/{billing/providers/BillingProvider.ts → api/payments/providers/PaymentProvider.ts} +9 -2
- package/src/{billing → api/payments}/services/PaymentMethodService.ts +5 -5
- package/src/{billing/services/BillingService.ts → api/payments/services/PaymentService.ts} +94 -18
- package/src/api/subscriptions/__tests__/BillingService.spec.ts +218 -0
- package/src/api/subscriptions/__tests__/SubscriptionService.spec.ts +278 -0
- package/src/api/subscriptions/controllers/AdminSubscriptionController.ts +212 -0
- package/src/api/subscriptions/controllers/SubscriptionController.ts +189 -0
- package/src/api/subscriptions/entities/subscriptionEvents.ts +54 -0
- package/src/api/subscriptions/entities/subscriptions.ts +68 -0
- package/src/api/subscriptions/index.ts +144 -0
- package/src/api/subscriptions/jobs/SubscriptionJobs.ts +382 -0
- package/src/api/subscriptions/middleware/$requireLimit.ts +50 -0
- package/src/api/subscriptions/middleware/$requirePlan.ts +49 -0
- package/src/api/subscriptions/notifications/SubscriptionNotifications.ts +110 -0
- package/src/api/subscriptions/schemas/cancelSubscriptionSchema.ts +8 -0
- package/src/api/subscriptions/schemas/changePlanSchema.ts +9 -0
- package/src/api/subscriptions/schemas/createSubscriptionSchema.ts +11 -0
- package/src/api/subscriptions/schemas/entitlementsSchema.ts +21 -0
- package/src/api/subscriptions/schemas/mrrSchema.ts +13 -0
- package/src/api/subscriptions/schemas/planDefinitionSchema.ts +71 -0
- package/src/api/subscriptions/schemas/planResourceSchema.ts +25 -0
- package/src/api/subscriptions/schemas/subscriptionEventResourceSchema.ts +8 -0
- package/src/api/subscriptions/schemas/subscriptionQuerySchema.ts +19 -0
- package/src/api/subscriptions/schemas/subscriptionResourceSchema.ts +6 -0
- package/src/api/subscriptions/schemas/subscriptionSettingsSchema.ts +32 -0
- package/src/api/subscriptions/schemas/subscriptionStatsSchema.ts +23 -0
- package/src/api/subscriptions/services/BillingService.ts +437 -0
- package/src/api/subscriptions/services/SubscriptionConfig.ts +56 -0
- package/src/api/subscriptions/services/SubscriptionService.ts +867 -0
- package/src/api/subscriptions/services/UsageService.ts +118 -0
- package/src/api/users/__tests__/AdminUserController.spec.ts +80 -1
- package/src/api/users/__tests__/CredentialService.spec.ts +177 -0
- package/src/api/users/__tests__/EmailVerification.spec.ts +29 -18
- package/src/api/users/__tests__/PasswordReset.spec.ts +3 -0
- package/src/api/users/__tests__/RegistrationService.spec.ts +148 -1
- package/src/api/users/__tests__/SessionService.spec.ts +142 -1
- package/src/api/users/atoms/realmAuthSettingsAtom.ts +10 -1
- package/src/api/users/controllers/UserController.ts +3 -8
- package/src/api/users/notifications/UserNotifications.ts +23 -0
- package/src/api/users/primitives/$realm.ts +24 -0
- package/src/api/users/schemas/loginSchema.ts +1 -1
- package/src/api/users/services/CredentialService.ts +57 -7
- package/src/api/users/services/RegistrationService.ts +50 -11
- package/src/api/users/services/SessionService.ts +64 -9
- package/src/api/users/services/UserService.ts +21 -12
- package/src/api/workflows/__tests__/$workflow.spec.ts +616 -0
- package/src/api/workflows/controllers/AdminWorkflowController.ts +191 -0
- package/src/api/workflows/entities/workflowExecutions.ts +74 -0
- package/src/api/workflows/entities/workflowStepExecutions.ts +74 -0
- package/src/api/workflows/entities/workflowStepLogs.ts +13 -0
- package/src/api/workflows/index.browser.ts +22 -0
- package/src/api/workflows/index.ts +124 -0
- package/src/api/workflows/jobs/WorkflowJobs.ts +77 -0
- package/src/api/workflows/primitives/$workflow.ts +202 -0
- package/src/api/workflows/providers/WorkflowProvider.ts +1284 -0
- package/src/api/workflows/schemas/workflowActivitySchema.ts +15 -0
- package/src/api/workflows/schemas/workflowConfigAtom.ts +51 -0
- package/src/api/workflows/schemas/workflowExecutionDetailSchema.ts +18 -0
- package/src/api/workflows/schemas/workflowExecutionQuerySchema.ts +26 -0
- package/src/api/workflows/schemas/workflowExecutionResourceSchema.ts +30 -0
- package/src/api/workflows/schemas/workflowRegistrationSchema.ts +26 -0
- package/src/api/workflows/schemas/workflowStatsSchema.ts +16 -0
- package/src/api/workflows/schemas/workflowStepExecutionResourceSchema.ts +15 -0
- package/src/api/workflows/services/WorkflowService.ts +382 -0
- package/src/captcha/__tests__/MemoryCaptchaProvider.spec.ts +74 -0
- package/src/captcha/index.ts +33 -0
- package/src/captcha/providers/CaptchaProvider.ts +17 -0
- package/src/captcha/providers/MemoryCaptchaProvider.ts +65 -0
- package/src/captcha/providers/TurnstileCaptchaProvider.ts +125 -0
- package/src/cli/core/atoms/buildOptions.ts +57 -0
- package/src/cli/core/commands/build.ts +2 -0
- package/src/cli/core/providers/ViteDevServerProvider.ts +1 -1
- package/src/cli/core/services/ViteUtils.ts +5 -2
- package/src/cli/core/tasks/BuildClientTask.ts +3 -1
- package/src/cli/core/tasks/BuildCloudflareTask.ts +4 -0
- package/src/cli/core/tasks/BuildPwaTask.ts +81 -0
- package/src/cli/core/templates/webAppRouterTs.ts +5 -58
- package/src/cli/platform/adapters/CloudflareAdapter.ts +24 -0
- package/src/cli/platform/atoms/platformOptions.ts +19 -3
- package/src/cli/platform/hooks/PlatformHook.ts +51 -0
- package/src/cli/platform/index.ts +1 -0
- package/src/cli/platform/services/CloudflareApi.ts +22 -1
- package/src/cli/platform/services/PlatformOrchestrator.ts +67 -2
- package/src/cli/vendor/__tests__/VendorService.spec.ts +322 -178
- package/src/cli/vendor/commands/VendorCommand.ts +41 -38
- package/src/cli/vendor/services/VendorService.ts +234 -31
- package/src/command/__tests__/CliProvider.spec.ts +45 -0
- package/src/command/providers/CliProvider.ts +3 -4
- package/src/core/__tests__/TypeProvider.spec.ts +4 -2
- package/src/core/providers/SchemaValidator.ts +1 -1
- package/src/core/providers/TypeProvider.ts +46 -3
- package/src/orm/__tests__/enums.spec.ts +22 -29
- package/src/orm/__tests__/orm-showcase-tests.ts +430 -0
- package/src/orm/__tests__/orm-showcase.spec.ts +167 -0
- package/src/orm/core/providers/DatabaseTypeProvider.ts +0 -29
- package/src/orm/core/services/Repository.ts +20 -6
- package/src/orm/postgres/services/PostgresModelBuilder.ts +3 -6
- package/src/react/i18n/__tests__/I18nProvider.spec.ts +83 -0
- package/src/react/i18n/providers/I18nProvider.ts +12 -10
- package/src/react/router/__tests__/$page.browser.spec.tsx +157 -0
- package/src/react/router/providers/ReactBrowserProvider.ts +39 -0
- package/src/react/router/providers/ReactBrowserRouterProvider.ts +22 -0
- package/src/security/__tests__/$secure-combinations.spec.ts +945 -0
- package/src/security/primitives/$issuer.ts +3 -1
- package/src/security/primitives/$secure.ts +28 -0
- package/src/server/auth/index.ts +7 -0
- package/src/server/auth/primitives/$auth.ts +37 -3
- package/src/server/auth/primitives/$authApple.ts +114 -4
- package/src/server/auth/primitives/$authFacebook.ts +98 -0
- package/src/server/auth/primitives/$authFranceConnect.ts +105 -0
- package/src/server/auth/primitives/$authGithub.ts +22 -16
- package/src/server/auth/primitives/$authMicrosoft.ts +88 -0
- package/src/server/auth/providers/ServerAuthProvider.ts +197 -72
- package/src/server/cookies/providers/ServerCookiesProvider.ts +3 -0
- package/src/server/core/__tests__/ServerRouterProvider-errorHandler.spec.ts +1 -1
- package/src/websocket/providers/NodeWebSocketServerProvider.ts +3 -1
- package/dist/billing/index.d.ts.map +0 -1
- package/dist/billing/index.js.map +0 -1
- package/src/billing/__tests__/BillingService.spec.ts +0 -136
- /package/src/{billing → api/payments}/entities/paymentMethods.ts +0 -0
- /package/src/{billing → api/payments}/entities/refunds.ts +0 -0
- /package/src/{billing → api/payments}/schemas/intentSchemas.ts +0 -0
- /package/src/{billing → api/payments}/schemas/paymentMethodSchemas.ts +0 -0
- /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
|