alepha 0.20.1 → 0.20.2
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/dist/api/files/index.js +2 -1
- package/dist/api/files/index.js.map +1 -1
- package/dist/api/jobs/index.browser.js +64 -148
- package/dist/api/jobs/index.browser.js.map +1 -1
- package/dist/api/jobs/index.d.ts +371 -573
- package/dist/api/jobs/index.d.ts.map +1 -1
- package/dist/api/jobs/index.js +605 -1012
- package/dist/api/jobs/index.js.map +1 -1
- package/dist/api/notifications/index.d.ts +78 -17
- package/dist/api/notifications/index.d.ts.map +1 -1
- package/dist/api/notifications/index.js +90 -23
- package/dist/api/notifications/index.js.map +1 -1
- package/dist/api/payments/index.d.ts +2 -1
- package/dist/api/payments/index.d.ts.map +1 -1
- package/dist/api/payments/index.js +4 -2
- package/dist/api/payments/index.js.map +1 -1
- package/dist/api/users/index.d.ts +34 -31
- package/dist/api/users/index.d.ts.map +1 -1
- package/dist/api/users/index.js +13 -7
- package/dist/api/users/index.js.map +1 -1
- package/dist/api/verifications/index.js +2 -1
- package/dist/api/verifications/index.js.map +1 -1
- package/dist/cli/core/index.d.ts +8 -34
- package/dist/cli/core/index.d.ts.map +1 -1
- package/dist/cli/core/index.js +43 -232
- package/dist/cli/core/index.js.map +1 -1
- package/dist/cli/platform/index.d.ts +36 -11
- package/dist/cli/platform/index.d.ts.map +1 -1
- package/dist/cli/platform/index.js +93 -27
- package/dist/cli/platform/index.js.map +1 -1
- package/dist/command/index.d.ts +1 -1
- package/dist/core/index.browser.js +6 -0
- package/dist/core/index.browser.js.map +1 -1
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +6 -0
- package/dist/core/index.js.map +1 -1
- package/dist/core/index.native.js +6 -0
- package/dist/core/index.native.js.map +1 -1
- package/dist/core/index.workerd.js +6 -0
- package/dist/core/index.workerd.js.map +1 -1
- package/dist/react/form/index.d.ts +60 -1
- package/dist/react/form/index.d.ts.map +1 -1
- package/dist/react/form/index.js +86 -1
- package/dist/react/form/index.js.map +1 -1
- package/dist/react/head/index.browser.js +16 -1
- package/dist/react/head/index.browser.js.map +1 -1
- package/dist/react/head/index.d.ts +6 -0
- package/dist/react/head/index.d.ts.map +1 -1
- package/dist/react/head/index.js +16 -1
- package/dist/react/head/index.js.map +1 -1
- package/dist/react/router/index.browser.js +0 -10
- package/dist/react/router/index.browser.js.map +1 -1
- package/dist/react/router/index.d.ts +35 -12
- package/dist/react/router/index.d.ts.map +1 -1
- package/dist/react/router/index.js +0 -10
- package/dist/react/router/index.js.map +1 -1
- package/dist/react/ui/index.d.ts +124 -0
- package/dist/react/ui/index.d.ts.map +1 -0
- package/dist/react/ui/index.js +206 -0
- package/dist/react/ui/index.js.map +1 -0
- package/dist/router/index.d.ts +13 -13
- package/dist/router/index.d.ts.map +1 -1
- package/dist/router/index.js +45 -32
- package/dist/router/index.js.map +1 -1
- package/dist/system/index.d.ts.map +1 -1
- package/dist/system/index.js +1 -0
- package/dist/system/index.js.map +1 -1
- package/dist/topic/core/index.js +1 -1
- package/dist/topic/core/index.js.map +1 -1
- package/package.json +6 -23
- package/src/api/files/jobs/FileJobs.ts +2 -1
- package/src/api/jobs/__tests__/$job.spec.ts +316 -2867
- package/src/api/jobs/controllers/AdminJobController.ts +29 -138
- package/src/api/jobs/entities/jobExecutionEntity.ts +27 -19
- package/src/api/jobs/index.browser.ts +5 -7
- package/src/api/jobs/index.ts +23 -51
- package/src/api/jobs/primitives/$job.ts +66 -58
- package/src/api/jobs/providers/JobProvider.ts +561 -566
- package/src/api/jobs/providers/JobQueueProvider.ts +18 -19
- package/src/api/jobs/schemas/jobConfigAtom.ts +20 -23
- package/src/api/jobs/schemas/jobExecutionQuerySchema.ts +3 -27
- package/src/api/jobs/schemas/jobExecutionResourceSchema.ts +5 -7
- package/src/api/jobs/schemas/jobRegistrationSchema.ts +7 -4
- package/src/api/jobs/schemas/triggerJobSchema.ts +0 -1
- package/src/api/jobs/services/JobService.ts +90 -483
- package/src/api/notifications/controllers/AdminNotificationController.ts +19 -12
- package/src/api/notifications/index.ts +7 -4
- package/src/api/notifications/jobs/NotificationJobs.ts +83 -12
- package/src/api/payments/services/PaymentService.ts +4 -2
- package/src/api/users/__tests__/UserJobs.spec.ts +10 -49
- package/src/api/users/audits/UserAudits.ts +3 -1
- package/src/api/users/buckets/UserBuckets.ts +2 -1
- package/src/api/users/index.ts +1 -4
- package/src/api/users/jobs/UserJobs.ts +5 -4
- package/src/api/verifications/jobs/VerificationJobs.ts +2 -1
- package/src/cli/core/__tests__/init.spec.ts +1 -1
- package/src/cli/core/commands/init.ts +0 -12
- package/src/cli/core/services/PackageManagerUtils.ts +2 -9
- package/src/cli/core/services/ProjectScaffolder.ts +17 -65
- package/src/cli/core/templates/agentMd.ts +2 -8
- package/src/cli/core/templates/apiIndexTs.ts +4 -18
- package/src/cli/core/templates/mainCss.ts +1 -36
- package/src/cli/core/templates/vitestConfigTs.ts +17 -0
- package/src/cli/core/templates/webAppRouterTs.ts +2 -85
- package/src/cli/platform/__tests__/CloudflareAdapter.spec.ts +22 -71
- package/src/cli/platform/adapters/CloudflareAdapter.ts +12 -11
- package/src/cli/platform/atoms/platformOptions.ts +9 -0
- package/src/cli/platform/schemas/cloudflare.ts +3 -2
- package/src/cli/platform/services/CloudflareApi.ts +164 -25
- package/src/cli/platform/services/WranglerApi.ts +0 -17
- package/src/core/Alepha.ts +9 -0
- package/src/react/form/index.ts +2 -0
- package/src/react/form/services/parseField.ts +163 -0
- package/src/react/form/services/prettyName.ts +19 -0
- package/src/react/head/providers/BrowserHeadProvider.ts +31 -10
- package/src/react/router/primitives/$page.ts +35 -12
- package/src/react/ui/atoms/uiAtom.ts +28 -0
- package/src/react/ui/components/ColorScheme.tsx +36 -0
- package/src/react/ui/hooks/useColorMode.ts +49 -0
- package/src/react/ui/hooks/useSidebarState.ts +26 -0
- package/src/react/ui/hooks/useTheme.ts +22 -0
- package/src/react/ui/index.ts +35 -0
- package/src/react/ui/services/UiPersistence.ts +41 -0
- package/src/router/TemplatedPathParser.ts +50 -51
- package/src/router/__tests__/RouterProvider.spec.ts +62 -0
- package/src/router/__tests__/TemplatedPathParser.spec.ts +18 -0
- package/src/router/providers/RouterProvider.ts +10 -5
- package/src/system/providers/NodeShellProvider.ts +1 -0
- package/src/topic/core/providers/TopicProvider.ts +1 -1
- package/dist/api/invitations/index.d.ts +0 -790
- package/dist/api/invitations/index.d.ts.map +0 -1
- package/dist/api/invitations/index.js +0 -662
- package/dist/api/invitations/index.js.map +0 -1
- package/dist/api/issues/index.d.ts +0 -810
- package/dist/api/issues/index.d.ts.map +0 -1
- package/dist/api/issues/index.js +0 -444
- package/dist/api/issues/index.js.map +0 -1
- package/dist/api/subscriptions/index.d.ts +0 -1692
- package/dist/api/subscriptions/index.d.ts.map +0 -1
- package/dist/api/subscriptions/index.js +0 -1867
- package/dist/api/subscriptions/index.js.map +0 -1
- package/dist/api/workflows/index.browser.js +0 -246
- package/dist/api/workflows/index.browser.js.map +0 -1
- package/dist/api/workflows/index.d.ts +0 -1618
- package/dist/api/workflows/index.d.ts.map +0 -1
- package/dist/api/workflows/index.js +0 -1495
- package/dist/api/workflows/index.js.map +0 -1
- package/src/api/invitations/__tests__/InvitationService.spec.ts +0 -439
- package/src/api/invitations/controllers/AdminInvitationController.ts +0 -86
- package/src/api/invitations/controllers/InvitationController.ts +0 -84
- package/src/api/invitations/entities/invitations.ts +0 -33
- package/src/api/invitations/index.ts +0 -58
- package/src/api/invitations/jobs/InvitationJobs.ts +0 -37
- package/src/api/invitations/providers/InvitationProvider.ts +0 -45
- package/src/api/invitations/schemas/createInvitationSchema.ts +0 -12
- package/src/api/invitations/schemas/invitationConfigAtom.ts +0 -20
- package/src/api/invitations/schemas/invitationQuerySchema.ts +0 -15
- package/src/api/invitations/schemas/invitationResourceSchema.ts +0 -6
- package/src/api/invitations/schemas/invitationWithResourceInfoSchema.ts +0 -22
- package/src/api/invitations/schemas/myInvitationsQuerySchema.ts +0 -10
- package/src/api/invitations/services/InvitationService.ts +0 -556
- package/src/api/issues/__tests__/IssueService.spec.ts +0 -263
- package/src/api/issues/controllers/AdminIssueController.ts +0 -149
- package/src/api/issues/controllers/IssueController.ts +0 -44
- package/src/api/issues/entities/issues.ts +0 -49
- package/src/api/issues/index.ts +0 -50
- package/src/api/issues/schemas/createIssueSchema.ts +0 -13
- package/src/api/issues/schemas/issueConfigAtom.ts +0 -13
- package/src/api/issues/schemas/issueQuerySchema.ts +0 -18
- package/src/api/issues/schemas/issueResourceSchema.ts +0 -6
- package/src/api/issues/schemas/myIssueQuerySchema.ts +0 -10
- package/src/api/issues/schemas/updateIssueSchema.ts +0 -13
- package/src/api/issues/services/IssueService.ts +0 -264
- package/src/api/jobs/__tests__/$job-middleware.spec.ts +0 -126
- package/src/api/jobs/__tests__/JobService.spec.ts +0 -31
- package/src/api/jobs/entities/jobExecutionLogEntity.ts +0 -13
- package/src/api/jobs/schemas/jobActivitySchema.ts +0 -15
- package/src/api/jobs/schemas/jobCronInfoSchema.ts +0 -22
- package/src/api/jobs/schemas/jobExecutionDetailResourceSchema.ts +0 -20
- package/src/api/jobs/schemas/jobFailureSchema.ts +0 -9
- package/src/api/jobs/schemas/jobQueueDepthSchema.ts +0 -14
- package/src/api/jobs/schemas/jobStatsSchema.ts +0 -14
- package/src/api/jobs/services/JobService-tests.ts +0 -157
- package/src/api/subscriptions/__tests__/BillingService.spec.ts +0 -218
- package/src/api/subscriptions/__tests__/SubscriptionService.spec.ts +0 -278
- package/src/api/subscriptions/controllers/AdminSubscriptionController.ts +0 -212
- package/src/api/subscriptions/controllers/SubscriptionController.ts +0 -189
- package/src/api/subscriptions/entities/subscriptionEvents.ts +0 -54
- package/src/api/subscriptions/entities/subscriptions.ts +0 -68
- package/src/api/subscriptions/index.ts +0 -133
- package/src/api/subscriptions/jobs/SubscriptionJobs.ts +0 -382
- package/src/api/subscriptions/middleware/$requireLimit.ts +0 -50
- package/src/api/subscriptions/middleware/$requirePlan.ts +0 -49
- package/src/api/subscriptions/notifications/SubscriptionNotifications.ts +0 -110
- package/src/api/subscriptions/schemas/cancelSubscriptionSchema.ts +0 -8
- package/src/api/subscriptions/schemas/changePlanSchema.ts +0 -9
- package/src/api/subscriptions/schemas/createSubscriptionSchema.ts +0 -11
- package/src/api/subscriptions/schemas/entitlementsSchema.ts +0 -21
- package/src/api/subscriptions/schemas/mrrSchema.ts +0 -13
- package/src/api/subscriptions/schemas/planDefinitionSchema.ts +0 -71
- package/src/api/subscriptions/schemas/planResourceSchema.ts +0 -25
- package/src/api/subscriptions/schemas/subscriptionEventResourceSchema.ts +0 -8
- package/src/api/subscriptions/schemas/subscriptionQuerySchema.ts +0 -19
- package/src/api/subscriptions/schemas/subscriptionResourceSchema.ts +0 -6
- package/src/api/subscriptions/schemas/subscriptionSettingsSchema.ts +0 -32
- package/src/api/subscriptions/schemas/subscriptionStatsSchema.ts +0 -23
- package/src/api/subscriptions/services/BillingService.ts +0 -437
- package/src/api/subscriptions/services/SubscriptionConfig.ts +0 -56
- package/src/api/subscriptions/services/SubscriptionService.ts +0 -867
- package/src/api/subscriptions/services/UsageService.ts +0 -118
- package/src/api/workflows/__tests__/$workflow.spec.ts +0 -616
- package/src/api/workflows/controllers/AdminWorkflowController.ts +0 -191
- package/src/api/workflows/entities/workflowExecutions.ts +0 -74
- package/src/api/workflows/entities/workflowStepExecutions.ts +0 -74
- package/src/api/workflows/entities/workflowStepLogs.ts +0 -13
- package/src/api/workflows/index.browser.ts +0 -22
- package/src/api/workflows/index.ts +0 -115
- package/src/api/workflows/jobs/WorkflowJobs.ts +0 -77
- package/src/api/workflows/primitives/$workflow.ts +0 -202
- package/src/api/workflows/providers/WorkflowProvider.ts +0 -1284
- package/src/api/workflows/schemas/workflowActivitySchema.ts +0 -15
- package/src/api/workflows/schemas/workflowConfigAtom.ts +0 -51
- package/src/api/workflows/schemas/workflowExecutionDetailSchema.ts +0 -18
- package/src/api/workflows/schemas/workflowExecutionQuerySchema.ts +0 -26
- package/src/api/workflows/schemas/workflowExecutionResourceSchema.ts +0 -30
- package/src/api/workflows/schemas/workflowRegistrationSchema.ts +0 -26
- package/src/api/workflows/schemas/workflowStatsSchema.ts +0 -16
- package/src/api/workflows/schemas/workflowStepExecutionResourceSchema.ts +0 -15
- package/src/api/workflows/services/WorkflowService.ts +0 -382
- package/src/cli/core/templates/apiAppSecurityTs.ts +0 -43
- package/src/cli/core/templates/webAdminDashboardTsx.ts +0 -17
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { $inject } from "alepha";
|
|
2
|
-
import { $job } from "alepha/api/jobs";
|
|
3
|
-
import { $logger } from "alepha/logger";
|
|
4
|
-
import { InvitationService } from "../services/InvitationService.ts";
|
|
5
|
-
|
|
6
|
-
export class InvitationJobs {
|
|
7
|
-
protected readonly log = $logger();
|
|
8
|
-
protected readonly invitationService = $inject(InvitationService);
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Expire pending invitations that have passed their expiration date.
|
|
12
|
-
*/
|
|
13
|
-
public readonly expireInvitations = $job({
|
|
14
|
-
cron: "0 * * * *",
|
|
15
|
-
lock: true,
|
|
16
|
-
handler: async () => {
|
|
17
|
-
const count = await this.invitationService.expirePending();
|
|
18
|
-
if (count > 0) {
|
|
19
|
-
this.log.info(`Expired ${count} invitations`);
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Purge old resolved invitations.
|
|
26
|
-
*/
|
|
27
|
-
public readonly purgeInvitations = $job({
|
|
28
|
-
cron: "0 3 * * *",
|
|
29
|
-
lock: true,
|
|
30
|
-
handler: async () => {
|
|
31
|
-
const count = await this.invitationService.purgeResolved();
|
|
32
|
-
if (count > 0) {
|
|
33
|
-
this.log.info(`Purged ${count} old invitations`);
|
|
34
|
-
}
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { InvitationEntity } from "../entities/invitations.ts";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Abstract provider that apps implement to customize invitation behavior
|
|
5
|
-
* per resource type.
|
|
6
|
-
*/
|
|
7
|
-
export abstract class InvitationProvider {
|
|
8
|
-
/**
|
|
9
|
-
* Validate that the resource exists and the inviter has permission to invite.
|
|
10
|
-
* Throw BadRequestError/ForbiddenError to reject.
|
|
11
|
-
*/
|
|
12
|
-
abstract validateResource(
|
|
13
|
-
resourceType: string,
|
|
14
|
-
resourceId: string,
|
|
15
|
-
inviter: { id: string; email?: string },
|
|
16
|
-
): Promise<void>;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Check if the email is already a member of the resource.
|
|
20
|
-
* Return true to reject the invitation as duplicate membership.
|
|
21
|
-
*/
|
|
22
|
-
abstract isMember(
|
|
23
|
-
resourceType: string,
|
|
24
|
-
resourceId: string,
|
|
25
|
-
email: string,
|
|
26
|
-
userId?: string,
|
|
27
|
-
): Promise<boolean>;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Called when an invitation is accepted.
|
|
31
|
-
* Create membership records, assign roles, etc.
|
|
32
|
-
*/
|
|
33
|
-
abstract onAccept(
|
|
34
|
-
invitation: InvitationEntity,
|
|
35
|
-
acceptedBy: { id: string; email?: string },
|
|
36
|
-
): Promise<void>;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Return display info for the resource (used in API responses).
|
|
40
|
-
*/
|
|
41
|
-
abstract getResourceInfo(
|
|
42
|
-
resourceType: string,
|
|
43
|
-
resourceId: string,
|
|
44
|
-
): Promise<{ name: string; description?: string; url?: string }>;
|
|
45
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { Static } from "alepha";
|
|
2
|
-
import { t } from "alepha";
|
|
3
|
-
|
|
4
|
-
export const createInvitationSchema = t.object({
|
|
5
|
-
email: t.string({ format: "email" }),
|
|
6
|
-
resourceType: t.text({ minLength: 1, maxLength: 100 }),
|
|
7
|
-
resourceId: t.text({ minLength: 1, maxLength: 255 }),
|
|
8
|
-
roles: t.optional(t.array(t.text())),
|
|
9
|
-
metadata: t.optional(t.record(t.text(), t.any())),
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
export type CreateInvitation = Static<typeof createInvitationSchema>;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { $atom, t } from "alepha";
|
|
2
|
-
|
|
3
|
-
export const invitationConfigAtom = $atom({
|
|
4
|
-
name: "alepha.api.invitations.config",
|
|
5
|
-
schema: t.object({
|
|
6
|
-
expirationDays: t.integer({ minimum: 1, maximum: 90 }),
|
|
7
|
-
maxPendingPerResource: t.integer({ minimum: 1, maximum: 500 }),
|
|
8
|
-
maxPendingPerInviter: t.integer({
|
|
9
|
-
minimum: 1,
|
|
10
|
-
maximum: 1000,
|
|
11
|
-
}),
|
|
12
|
-
purgeDays: t.integer({ minimum: 0, maximum: 365 }),
|
|
13
|
-
}),
|
|
14
|
-
default: {
|
|
15
|
-
expirationDays: 7,
|
|
16
|
-
maxPendingPerResource: 50,
|
|
17
|
-
maxPendingPerInviter: 100,
|
|
18
|
-
purgeDays: 90,
|
|
19
|
-
},
|
|
20
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Static } from "alepha";
|
|
2
|
-
import { t } from "alepha";
|
|
3
|
-
import { pageQuerySchema } from "alepha/orm";
|
|
4
|
-
|
|
5
|
-
export const invitationQuerySchema = t.extend(pageQuerySchema, {
|
|
6
|
-
email: t.optional(t.text({ description: "Filter by invited email" })),
|
|
7
|
-
resourceType: t.optional(t.text({ description: "Filter by resource type" })),
|
|
8
|
-
resourceId: t.optional(t.text({ description: "Filter by resource ID" })),
|
|
9
|
-
status: t.optional(
|
|
10
|
-
t.enum(["pending", "accepted", "declined", "expired", "revoked"]),
|
|
11
|
-
),
|
|
12
|
-
invitedBy: t.optional(t.uuid()),
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
export type InvitationQuery = Static<typeof invitationQuerySchema>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Static } from "alepha";
|
|
2
|
-
import { t } from "alepha";
|
|
3
|
-
|
|
4
|
-
export const invitationWithResourceInfoSchema = t.object({
|
|
5
|
-
id: t.uuid(),
|
|
6
|
-
email: t.string({ format: "email" }),
|
|
7
|
-
resourceType: t.text(),
|
|
8
|
-
resourceId: t.text(),
|
|
9
|
-
resourceName: t.text(),
|
|
10
|
-
resourceUrl: t.optional(t.text()),
|
|
11
|
-
invitedBy: t.uuid(),
|
|
12
|
-
inviterName: t.optional(t.text()),
|
|
13
|
-
inviterEmail: t.optional(t.string({ format: "email" })),
|
|
14
|
-
roles: t.optional(t.array(t.text())),
|
|
15
|
-
status: t.enum(["pending", "accepted", "declined", "expired", "revoked"]),
|
|
16
|
-
createdAt: t.datetime(),
|
|
17
|
-
expiresAt: t.datetime(),
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
export type InvitationWithResourceInfo = Static<
|
|
21
|
-
typeof invitationWithResourceInfoSchema
|
|
22
|
-
>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { Static } from "alepha";
|
|
2
|
-
import { t } from "alepha";
|
|
3
|
-
|
|
4
|
-
export const myInvitationsQuerySchema = t.object({
|
|
5
|
-
status: t.optional(
|
|
6
|
-
t.enum(["pending", "accepted", "declined", "expired", "revoked"]),
|
|
7
|
-
),
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
export type MyInvitationsQuery = Static<typeof myInvitationsQuerySchema>;
|