@r2wa-org/eden 0.0.100 → 0.0.102

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 (35) hide show
  1. package/dist/admin/index.d.ts +282 -365
  2. package/dist/asset-convert-product/admin/dto.schemas.d.ts +12 -0
  3. package/dist/asset-convert-product/admin/router.d.ts +13 -25
  4. package/dist/asset-convert-product/admin/service.d.ts +12 -12
  5. package/dist/auth/better-auth.d.ts +6 -6
  6. package/dist/auth/permissions.d.ts +5 -5
  7. package/dist/auth/roles.d.ts +15 -15
  8. package/dist/check-in/admin/reward.dto.schemas.d.ts +113 -86
  9. package/dist/check-in/admin/reward.router.d.ts +266 -349
  10. package/dist/check-in/admin/reward.service.d.ts +11 -57
  11. package/dist/check-in/admin/router.d.ts +266 -349
  12. package/dist/check-in/constants.d.ts +2 -0
  13. package/dist/check-in/errors/index.d.ts +1 -0
  14. package/dist/check-in/errors/locales/zh.d.ts +1 -0
  15. package/dist/check-in/index.d.ts +2 -0
  16. package/dist/check-in/internal/reward-config.service.d.ts +31 -0
  17. package/dist/check-in/internal/reward.service.d.ts +31 -0
  18. package/dist/check-in/permissions.d.ts +1 -1
  19. package/dist/check-in/user/dto.schemas.d.ts +3 -22
  20. package/dist/check-in/user/router.d.ts +3 -10
  21. package/dist/check-in/user/service.d.ts +3 -4
  22. package/dist/content-video/user/router.d.ts +1 -13
  23. package/dist/file-storage/user/router.d.ts +13 -1
  24. package/dist/index.d.ts +287 -377
  25. package/dist/ledger/admin/dto.schemas.d.ts +12 -0
  26. package/dist/ledger/admin/router.d.ts +4 -4
  27. package/dist/ledger/db.schemas.d.ts +8 -8
  28. package/dist/ledger/schema.d.ts +6 -6
  29. package/dist/ledger/user/dto.schemas.d.ts +8 -8
  30. package/dist/ledger/user/router.d.ts +2 -2
  31. package/dist/ledger/user/service.d.ts +2 -2
  32. package/dist/referral/admin/router.d.ts +1 -13
  33. package/dist/team/user/router.d.ts +13 -1
  34. package/dist/welfare-cycle/admin/router.d.ts +13 -1
  35. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ /** 当前产品仅开放 App 签到 */
2
+ export declare const CHECK_IN_ACTIVE_TYPE: 'app';
@@ -11,6 +11,7 @@ export declare const CheckInErrorCodes: {
11
11
  /** 时区切换申请尚未生效 */
12
12
  readonly CHECK_IN_TIMEZONE_CHANGE_PENDING_EXISTS: 'CHECK_IN_TIMEZONE_CHANGE_PENDING_EXISTS';
13
13
  readonly CHECK_IN_REWARD_PLAN_NOT_FOUND: 'CHECK_IN_REWARD_PLAN_NOT_FOUND';
14
+ readonly CHECK_IN_REWARD_PLAN_ALREADY_EXISTS: 'CHECK_IN_REWARD_PLAN_ALREADY_EXISTS';
14
15
  readonly CHECK_IN_REWARD_RULE_NOT_FOUND: 'CHECK_IN_REWARD_RULE_NOT_FOUND';
15
16
  readonly CHECK_IN_REWARD_RULE_ALREADY_EXISTS: 'CHECK_IN_REWARD_RULE_ALREADY_EXISTS';
16
17
  readonly CHECK_IN_REWARD_AMOUNT_INVALID: 'CHECK_IN_REWARD_AMOUNT_INVALID';
@@ -5,6 +5,7 @@ export declare const zh: {
5
5
  CHECK_IN_TIMEZONE_CHANGE_TOO_FREQUENT: string;
6
6
  CHECK_IN_TIMEZONE_CHANGE_PENDING_EXISTS: string;
7
7
  CHECK_IN_REWARD_PLAN_NOT_FOUND: string;
8
+ CHECK_IN_REWARD_PLAN_ALREADY_EXISTS: string;
8
9
  CHECK_IN_REWARD_RULE_NOT_FOUND: string;
9
10
  CHECK_IN_REWARD_RULE_ALREADY_EXISTS: string;
10
11
  CHECK_IN_REWARD_AMOUNT_INVALID: string;
@@ -5,7 +5,9 @@ export { checkInRewardPlanAdminRouter } from './admin/reward.router';
5
5
  export * from './db.schemas';
6
6
  export * from './reward.db.schemas';
7
7
  export * from './reward.schema';
8
+ export * from './constants';
8
9
  export * from './internal/service';
10
+ export * from './internal/reward.service';
9
11
  export * from './permissions';
10
12
  export * from './schema';
11
13
  export { checkInRouter } from './user/router';
@@ -57,6 +57,37 @@ export declare abstract class InternalCheckInRewardConfigService {
57
57
  updatedAt: Date;
58
58
  updatedBy: string | null;
59
59
  }>;
60
+ static findSingletonPlan(tx: TransactionTx): Promise<{
61
+ checkInType: "app" | "meeting";
62
+ createdAt: Date;
63
+ createdBy: string;
64
+ dailyPayoutAccountTypeId: string;
65
+ dailyRewardAmount: string;
66
+ dailyRewardCategory: string;
67
+ id: string;
68
+ isEnabled: boolean;
69
+ name: string;
70
+ rewardAssetId: string;
71
+ sortOrder: number;
72
+ updatedAt: Date;
73
+ updatedBy: string | null;
74
+ } | undefined>;
75
+ static ensureSingletonPlan(tx: TransactionTx): Promise<{
76
+ checkInType: "app" | "meeting";
77
+ createdAt: Date;
78
+ createdBy: string;
79
+ dailyPayoutAccountTypeId: string;
80
+ dailyRewardAmount: string;
81
+ dailyRewardCategory: string;
82
+ id: string;
83
+ isEnabled: boolean;
84
+ name: string;
85
+ rewardAssetId: string;
86
+ sortOrder: number;
87
+ updatedAt: Date;
88
+ updatedBy: string | null;
89
+ }>;
90
+ static assertNoSingletonPlan(tx: TransactionTx): Promise<void>;
60
91
  static assertRuleUnique(tx: TransactionTx, input: {
61
92
  planId: string;
62
93
  ruleType: typeof checkInRewardRule.$inferSelect.ruleType;
@@ -0,0 +1,31 @@
1
+ import type { TransactionTx } from '../../db/transaction';
2
+ import { checkInRewardRule } from '../reward.schema';
3
+ type CheckInRewardPayoutItem = {
4
+ kind: 'daily' | 'milestone';
5
+ ruleId?: string;
6
+ ruleType?: (typeof checkInRewardRule.$inferSelect)['ruleType'];
7
+ thresholdDays?: number;
8
+ amount: string;
9
+ ledgerEntryId: string;
10
+ isIdempotent: boolean;
11
+ };
12
+ export type CheckInRewardPayoutResult = {
13
+ payouts: CheckInRewardPayoutItem[];
14
+ };
15
+ export declare abstract class InternalCheckInRewardService {
16
+ private static addDays;
17
+ private static resolveActivePlan;
18
+ private static countCumulativeDays;
19
+ private static countConsecutiveStreakDays;
20
+ private static buildDailyIdempotencyKey;
21
+ private static buildMilestoneIdempotencyKey;
22
+ private static payoutAmount;
23
+ private static processDailyReward;
24
+ private static processMilestoneRewards;
25
+ static processCheckInRewards(tx: TransactionTx, params: {
26
+ userId: string;
27
+ checkInId: string;
28
+ localDate: string;
29
+ }): Promise<CheckInRewardPayoutResult>;
30
+ }
31
+ export {};
@@ -2,7 +2,7 @@
2
2
  export declare const checkInPermissions: {
3
3
  readonly 'checkIn:checkIn': readonly ['create', 'read', 'list'];
4
4
  readonly 'checkIn:admin': readonly ['read', 'list'];
5
- readonly 'checkIn:rewardPlan': readonly ['create', 'read', 'update', 'delete', 'list'];
5
+ readonly 'checkIn:rewardPlan': readonly ['create', 'read', 'update', 'delete'];
6
6
  readonly 'checkIn:rewardRule': readonly ['create', 'read', 'update', 'delete', 'list'];
7
7
  };
8
8
  export type CheckInPermission = keyof typeof checkInPermissions;
@@ -154,12 +154,7 @@ export declare const checkInResponseSchema: import("drizzle-typebox").BuildSchem
154
154
  }, {}, {}>;
155
155
  }, undefined>;
156
156
  export type CheckInResponseType = typeof checkInResponseSchema.static;
157
- export declare const checkInCreateSchema: import("@sinclair/typebox").TObject<{
158
- checkInType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<{
159
- app: "app";
160
- meeting: "meeting";
161
- }>>;
162
- }>;
157
+ export declare const checkInCreateSchema: import("@sinclair/typebox").TObject<{}>;
163
158
  export type CheckInCreateInputType = typeof checkInCreateSchema.static;
164
159
  export declare const checkInListResponseSchema: import("@sinclair/typebox").TObject<{
165
160
  data: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
@@ -477,25 +472,11 @@ export declare const checkInSummaryResponseSchema: import("@sinclair/typebox").T
477
472
  checkedInToday: import("@sinclair/typebox").TBoolean;
478
473
  }>;
479
474
  export type CheckInSummaryResponseType = typeof checkInSummaryResponseSchema.static;
480
- export declare const checkInStatsQuerySchema: import("@sinclair/typebox").TObject<{
481
- checkInType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<{
482
- app: "app";
483
- meeting: "meeting";
484
- }>>;
485
- }>;
475
+ export declare const checkInStatsQuerySchema: import("@sinclair/typebox").TObject<{}>;
486
476
  export type CheckInStatsQueryType = typeof checkInStatsQuerySchema.static;
487
- export declare const checkInTodayQuerySchema: import("@sinclair/typebox").TObject<{
488
- checkInType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<{
489
- app: "app";
490
- meeting: "meeting";
491
- }>>;
492
- }>;
477
+ export declare const checkInTodayQuerySchema: import("@sinclair/typebox").TObject<{}>;
493
478
  export type CheckInTodayQueryType = typeof checkInTodayQuerySchema.static;
494
479
  export declare const checkInListQuerySchema: import("@sinclair/typebox").TObject<{
495
- checkInType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TEnum<{
496
- app: "app";
497
- meeting: "meeting";
498
- }>>;
499
480
  endDate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TDate>;
500
481
  limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
501
482
  offset: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
@@ -382,9 +382,7 @@ export declare const checkInRouter: Elysia<"/checkIns", {
382
382
  } & {
383
383
  checkIns: {
384
384
  post: {
385
- body: {
386
- checkInType?: "app" | "meeting" | undefined;
387
- };
385
+ body: {};
388
386
  params: {};
389
387
  query: {};
390
388
  headers: {};
@@ -419,7 +417,6 @@ export declare const checkInRouter: Elysia<"/checkIns", {
419
417
  body: {};
420
418
  params: {};
421
419
  query: {
422
- checkInType?: "app" | "meeting" | undefined;
423
420
  endDate?: Date | undefined;
424
421
  limit?: number | undefined;
425
422
  offset?: number | undefined;
@@ -486,9 +483,7 @@ export declare const checkInRouter: Elysia<"/checkIns", {
486
483
  get: {
487
484
  body: {};
488
485
  params: {};
489
- query: {
490
- checkInType?: "app" | "meeting" | undefined;
491
- };
486
+ query: {};
492
487
  headers: {};
493
488
  response: {
494
489
  200: {
@@ -550,9 +545,7 @@ export declare const checkInRouter: Elysia<"/checkIns", {
550
545
  get: {
551
546
  body: {};
552
547
  params: {};
553
- query: {
554
- checkInType?: "app" | "meeting" | undefined;
555
- };
548
+ query: {};
556
549
  headers: {};
557
550
  response: {
558
551
  200: {
@@ -1,7 +1,6 @@
1
1
  import type { CheckInCreateInputType, CheckInListQueryType, CheckInStatsQueryType, CheckInTodayQueryType, CheckInTimezoneUpdateInputType } from './dto.schemas';
2
2
  export declare abstract class UserCheckInService {
3
3
  private static validateUserId;
4
- private static getCheckInTypeOrDefault;
5
4
  private static addDays;
6
5
  private static validateTimezone;
7
6
  private static getNextDayStartUtc;
@@ -20,7 +19,7 @@ export declare abstract class UserCheckInService {
20
19
  pendingEffectiveAt: Date | null;
21
20
  timezoneChangedAt: Date | null;
22
21
  }>;
23
- static checkIn(userId: string, payload?: CheckInCreateInputType): Promise<{
22
+ static checkIn(userId: string, _payload?: CheckInCreateInputType): Promise<{
24
23
  checkInAt: Date;
25
24
  checkInLocalDate: string;
26
25
  checkInOffsetMinutes: number | null;
@@ -65,12 +64,12 @@ export declare abstract class UserCheckInService {
65
64
  limit: number;
66
65
  offset: number;
67
66
  }>;
68
- static getMySummary(userId: string, query?: CheckInStatsQueryType): Promise<{
67
+ static getMySummary(userId: string, _query?: CheckInStatsQueryType): Promise<{
69
68
  totalDays: number;
70
69
  checkedInToday: boolean;
71
70
  currentStreakDays: number;
72
71
  }>;
73
- static getMyTodayStatus(userId: string, query: CheckInTodayQueryType): Promise<{
72
+ static getMyTodayStatus(userId: string, _query: CheckInTodayQueryType): Promise<{
74
73
  checkedInToday: boolean;
75
74
  }>;
76
75
  }
@@ -35,19 +35,7 @@ export declare const contentVideoRouter: Elysia<"/content_videos", {
35
35
  headers: import("elysia").HTTPHeaders;
36
36
  status?: number | keyof import("elysia").StatusMap;
37
37
  redirect?: string;
38
- cookie?: Record<string, {
39
- domain?: string | undefined;
40
- expires?: Date | undefined;
41
- httpOnly?: boolean | undefined;
42
- maxAge?: number | undefined;
43
- path?: string | undefined;
44
- priority?: 'low' | 'medium' | 'high' | undefined;
45
- partitioned?: boolean | undefined;
46
- sameSite?: true | false | 'lax' | 'strict' | 'none' | undefined;
47
- secure?: boolean | undefined;
48
- secrets?: string | null | (string | null)[];
49
- value?: unknown;
50
- }>;
38
+ cookie?: Record<string, import("elysia/cookies").ElysiaCookie>;
51
39
  };
52
40
  path: string;
53
41
  route: string;
@@ -35,7 +35,19 @@ export declare const fileStorageRouter: Elysia<"/file_storage", {
35
35
  headers: import("elysia").HTTPHeaders;
36
36
  status?: number | keyof import("elysia").StatusMap;
37
37
  redirect?: string;
38
- cookie?: Record<string, import("elysia/cookies").ElysiaCookie>;
38
+ cookie?: Record<string, {
39
+ domain?: string | undefined;
40
+ expires?: Date | undefined;
41
+ httpOnly?: boolean | undefined;
42
+ maxAge?: number | undefined;
43
+ path?: string | undefined;
44
+ priority?: 'low' | 'medium' | 'high' | undefined;
45
+ partitioned?: boolean | undefined;
46
+ sameSite?: true | false | 'lax' | 'strict' | 'none' | undefined;
47
+ secure?: boolean | undefined;
48
+ secrets?: string | null | (string | null)[];
49
+ value?: unknown;
50
+ }>;
39
51
  };
40
52
  path: string;
41
53
  route: string;