@openora/core 0.4.1-canary.78 → 0.4.1-canary.80

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 (107) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/admin-console/__tests__/backoffice.router.test.js +4 -1
  3. package/dist/admin-console/__tests__/backoffice.router.test.js.map +1 -1
  4. package/dist/admin-console/__tests__/backoffice.service.int.test.js +62 -12
  5. package/dist/admin-console/__tests__/backoffice.service.int.test.js.map +1 -1
  6. package/dist/admin-console/contract/index.d.ts +16 -0
  7. package/dist/admin-console/contract/index.d.ts.map +1 -1
  8. package/dist/admin-console/contract/index.js +1 -0
  9. package/dist/admin-console/contract/index.js.map +1 -1
  10. package/dist/admin-console/plugin.d.ts +1 -0
  11. package/dist/admin-console/plugin.d.ts.map +1 -1
  12. package/dist/admin-console/plugin.js +2 -2
  13. package/dist/admin-console/plugin.js.map +1 -1
  14. package/dist/admin-console/router/index.d.ts +12 -0
  15. package/dist/admin-console/router/index.d.ts.map +1 -1
  16. package/dist/admin-console/service/backoffice.service.d.ts +45 -5
  17. package/dist/admin-console/service/backoffice.service.d.ts.map +1 -1
  18. package/dist/admin-console/service/backoffice.service.js +29 -6
  19. package/dist/admin-console/service/backoffice.service.js.map +1 -1
  20. package/dist/analytics/plugin.d.ts +1 -0
  21. package/dist/analytics/plugin.d.ts.map +1 -1
  22. package/dist/audit/plugin.d.ts +1 -0
  23. package/dist/audit/plugin.d.ts.map +1 -1
  24. package/dist/audit/plugin.js +24 -0
  25. package/dist/audit/plugin.js.map +1 -1
  26. package/dist/casino/gaming/plugin.d.ts +1 -0
  27. package/dist/casino/gaming/plugin.d.ts.map +1 -1
  28. package/dist/casino/lobby/plugin.d.ts +1 -0
  29. package/dist/casino/lobby/plugin.d.ts.map +1 -1
  30. package/dist/cms/plugin.d.ts +1 -0
  31. package/dist/cms/plugin.d.ts.map +1 -1
  32. package/dist/compliance/plugin.d.ts +1 -0
  33. package/dist/compliance/plugin.d.ts.map +1 -1
  34. package/dist/contracts/adapters/admin-role-assignment-directory.d.ts +12 -0
  35. package/dist/contracts/adapters/admin-role-assignment-directory.d.ts.map +1 -0
  36. package/dist/contracts/adapters/admin-role-assignment-directory.js +3 -0
  37. package/dist/contracts/adapters/admin-role-assignment-directory.js.map +1 -0
  38. package/dist/contracts/adapters/index.d.ts +2 -0
  39. package/dist/contracts/adapters/index.d.ts.map +1 -1
  40. package/dist/contracts/adapters/index.js +1 -0
  41. package/dist/contracts/adapters/index.js.map +1 -1
  42. package/dist/contracts/schemas/events.d.ts +14 -0
  43. package/dist/contracts/schemas/events.d.ts.map +1 -1
  44. package/dist/contracts/schemas/events.js +10 -9
  45. package/dist/contracts/schemas/events.js.map +1 -1
  46. package/dist/engagement/chat/plugin.d.ts +1 -0
  47. package/dist/engagement/chat/plugin.d.ts.map +1 -1
  48. package/dist/engagement/chat/service/chat.service.d.ts.map +1 -1
  49. package/dist/engagement/chat/service/chat.service.js +8 -0
  50. package/dist/engagement/chat/service/chat.service.js.map +1 -1
  51. package/dist/engagement/chat-commands/plugin.d.ts +1 -0
  52. package/dist/engagement/chat-commands/plugin.d.ts.map +1 -1
  53. package/dist/engagement/notifications/plugin.d.ts +1 -0
  54. package/dist/engagement/notifications/plugin.d.ts.map +1 -1
  55. package/dist/engagement/social/__tests__/social.router.int.test.js +80 -0
  56. package/dist/engagement/social/__tests__/social.router.int.test.js.map +1 -1
  57. package/dist/engagement/social/__tests__/social.service.int.test.js +336 -1
  58. package/dist/engagement/social/__tests__/social.service.int.test.js.map +1 -1
  59. package/dist/engagement/social/contract/index.d.ts +74 -0
  60. package/dist/engagement/social/contract/index.d.ts.map +1 -1
  61. package/dist/engagement/social/contract/index.js +33 -0
  62. package/dist/engagement/social/contract/index.js.map +1 -1
  63. package/dist/engagement/social/drizzle/migrations/0004_friendship-cancel-constraint.sql +2 -0
  64. package/dist/engagement/social/drizzle/migrations/meta/0004_snapshot.json +145 -0
  65. package/dist/engagement/social/drizzle/migrations/meta/_journal.json +7 -0
  66. package/dist/engagement/social/plugin.d.ts +1 -0
  67. package/dist/engagement/social/plugin.d.ts.map +1 -1
  68. package/dist/engagement/social/router/index.d.ts +43 -0
  69. package/dist/engagement/social/router/index.d.ts.map +1 -1
  70. package/dist/engagement/social/router/index.js +27 -1
  71. package/dist/engagement/social/router/index.js.map +1 -1
  72. package/dist/engagement/social/schema/index.js +1 -1
  73. package/dist/engagement/social/schema/index.js.map +1 -1
  74. package/dist/engagement/social/service/social.service.d.ts +16 -16
  75. package/dist/engagement/social/service/social.service.d.ts.map +1 -1
  76. package/dist/engagement/social/service/social.service.js +183 -39
  77. package/dist/engagement/social/service/social.service.js.map +1 -1
  78. package/dist/engagement/social-transfers/plugin.d.ts +1 -0
  79. package/dist/engagement/social-transfers/plugin.d.ts.map +1 -1
  80. package/dist/iam/adapters/admin-role-assignment-directory.d.ts +8 -0
  81. package/dist/iam/adapters/admin-role-assignment-directory.d.ts.map +1 -0
  82. package/dist/iam/adapters/admin-role-assignment-directory.js +23 -0
  83. package/dist/iam/adapters/admin-role-assignment-directory.js.map +1 -0
  84. package/dist/iam/plugin.d.ts +1 -0
  85. package/dist/iam/plugin.d.ts.map +1 -1
  86. package/dist/iam/plugin.js +3 -1
  87. package/dist/iam/plugin.js.map +1 -1
  88. package/dist/pam/identity/adapters/identity-reader.service.d.ts.map +1 -1
  89. package/dist/pam/identity/adapters/identity-reader.service.js +5 -2
  90. package/dist/pam/identity/adapters/identity-reader.service.js.map +1 -1
  91. package/dist/pam/identity/plugin.d.ts +1 -0
  92. package/dist/pam/identity/plugin.d.ts.map +1 -1
  93. package/dist/pam/player-management/plugin.d.ts +1 -0
  94. package/dist/pam/player-management/plugin.d.ts.map +1 -1
  95. package/dist/pam/player-note/plugin.d.ts +1 -0
  96. package/dist/pam/player-note/plugin.d.ts.map +1 -1
  97. package/dist/pam/profile/plugin.d.ts +1 -0
  98. package/dist/pam/profile/plugin.d.ts.map +1 -1
  99. package/dist/pam/tag/plugin.d.ts +1 -0
  100. package/dist/pam/tag/plugin.d.ts.map +1 -1
  101. package/dist/server/runtime/core-token-catalog.d.ts +1 -0
  102. package/dist/server/runtime/core-token-catalog.d.ts.map +1 -1
  103. package/dist/server/runtime/core-token-catalog.js +2 -1
  104. package/dist/server/runtime/core-token-catalog.js.map +1 -1
  105. package/dist/wallet/plugin.d.ts +1 -0
  106. package/dist/wallet/plugin.d.ts.map +1 -1
  107. package/package.json +1 -1
@@ -52,6 +52,23 @@ export const FriendListEntrySchema = z.object({
52
52
  export const RemoveFriendInputSchema = z.object({
53
53
  targetUserId: UuidSchema,
54
54
  });
55
+ export const FRIEND_REQUEST_DIRECTIONS = ['incoming', 'outgoing'];
56
+ export const FriendRequestDirectionSchema = z.enum(FRIEND_REQUEST_DIRECTIONS);
57
+ export const ListFriendRequestsInputSchema = z.object({
58
+ ...PageQuerySchema.shape,
59
+ direction: FriendRequestDirectionSchema,
60
+ });
61
+ export const FriendRequestEntrySchema = z.object({
62
+ friendshipId: UuidSchema,
63
+ userId: UuidSchema,
64
+ displayName: z.string(),
65
+ direction: FriendRequestDirectionSchema,
66
+ createdAt: TimestampSchema,
67
+ mutualFriendsCount: z.number().int().min(0).nullable(),
68
+ });
69
+ export const FriendRequestIdInputSchema = z.object({
70
+ friendshipId: UuidSchema,
71
+ });
55
72
  export const socialContract = {
56
73
  sendFriendRequest: oc
57
74
  .route({ method: 'POST', path: '/social/friend-requests' })
@@ -70,5 +87,21 @@ export const socialContract = {
70
87
  .route({ method: 'DELETE', path: '/social/friends/{targetUserId}' })
71
88
  .input(RemoveFriendInputSchema)
72
89
  .output(z.object({ success: z.literal(true) })),
90
+ listFriendRequests: oc
91
+ .route({ method: 'GET', path: '/social/friend-requests' })
92
+ .input(ListFriendRequestsInputSchema)
93
+ .output(paginated(FriendRequestEntrySchema)),
94
+ acceptFriendRequest: oc
95
+ .route({ method: 'POST', path: '/social/friend-requests/{friendshipId}/accept' })
96
+ .input(FriendRequestIdInputSchema)
97
+ .output(FriendshipSchema),
98
+ declineFriendRequest: oc
99
+ .route({ method: 'POST', path: '/social/friend-requests/{friendshipId}/decline' })
100
+ .input(FriendRequestIdInputSchema)
101
+ .output(z.object({ success: z.literal(true) })),
102
+ cancelFriendRequest: oc
103
+ .route({ method: 'DELETE', path: '/social/friend-requests/{friendshipId}' })
104
+ .input(FriendRequestIdInputSchema)
105
+ .output(z.object({ success: z.literal(true) })),
73
106
  };
74
107
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/engagement/social/contract/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAEzE,uEAAuE;AACvE,qFAAqF;AACrF,mFAAmF;AACnF,0EAA0E;AAC1E,uFAAuF;AAEvF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC;IACnD,YAAY,EAAE,UAAU;CACzB,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,EAAE,EAAE,UAAU;IACd,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,UAAU;IACvB,SAAS,EAAE,eAAe;IAC1B,UAAU,EAAE,eAAe,CAAC,QAAQ,EAAE;IACtC,SAAS,EAAE,eAAe,CAAC,QAAQ,EAAE;CACtC,CAAC,CAAC;AAGH,kFAAkF;AAClF,mFAAmF;AACnF,+EAA+E;AAC/E,2EAA2E;AAC3E,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,MAAM;IACN,kBAAkB;IAClB,kBAAkB;IAClB,SAAS;IACT,SAAS;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AC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;CAClD,CAAC"}
@@ -0,0 +1,2 @@
1
+ ALTER TABLE "friendship" DROP CONSTRAINT "friendship_removed_requires_accepted_key";--> statement-breakpoint
2
+ ALTER TABLE "friendship" ADD CONSTRAINT "friendship_removed_excludes_refused_key" CHECK (NOT ("friendship"."removed_at" IS NOT NULL AND "friendship"."refused_at" IS NOT NULL));
@@ -0,0 +1,145 @@
1
+ {
2
+ "id": "fdc9e290-ba2e-49f9-9fcb-943da450abe1",
3
+ "prevId": "79d782d8-118a-4ec6-9c1f-69113497a180",
4
+ "version": "7",
5
+ "dialect": "postgresql",
6
+ "tables": {
7
+ "public.friendship": {
8
+ "name": "friendship",
9
+ "schema": "",
10
+ "columns": {
11
+ "id": {
12
+ "name": "id",
13
+ "type": "uuid",
14
+ "primaryKey": true,
15
+ "notNull": true,
16
+ "default": "gen_random_uuid()"
17
+ },
18
+ "requester_id": {
19
+ "name": "requester_id",
20
+ "type": "uuid",
21
+ "primaryKey": false,
22
+ "notNull": true
23
+ },
24
+ "addressee_id": {
25
+ "name": "addressee_id",
26
+ "type": "uuid",
27
+ "primaryKey": false,
28
+ "notNull": true
29
+ },
30
+ "created_at": {
31
+ "name": "created_at",
32
+ "type": "timestamp with time zone",
33
+ "primaryKey": false,
34
+ "notNull": true,
35
+ "default": "now()"
36
+ },
37
+ "updated_at": {
38
+ "name": "updated_at",
39
+ "type": "timestamp with time zone",
40
+ "primaryKey": false,
41
+ "notNull": true,
42
+ "default": "now()"
43
+ },
44
+ "accepted_at": {
45
+ "name": "accepted_at",
46
+ "type": "timestamp with time zone",
47
+ "primaryKey": false,
48
+ "notNull": false
49
+ },
50
+ "refused_at": {
51
+ "name": "refused_at",
52
+ "type": "timestamp with time zone",
53
+ "primaryKey": false,
54
+ "notNull": false
55
+ },
56
+ "removed_at": {
57
+ "name": "removed_at",
58
+ "type": "timestamp with time zone",
59
+ "primaryKey": false,
60
+ "notNull": false
61
+ }
62
+ },
63
+ "indexes": {
64
+ "friendship_pair_key": {
65
+ "name": "friendship_pair_key",
66
+ "columns": [
67
+ {
68
+ "expression": "LEAST(\"requester_id\", \"addressee_id\")",
69
+ "asc": true,
70
+ "isExpression": true,
71
+ "nulls": "last"
72
+ },
73
+ {
74
+ "expression": "GREATEST(\"requester_id\", \"addressee_id\")",
75
+ "asc": true,
76
+ "isExpression": true,
77
+ "nulls": "last"
78
+ }
79
+ ],
80
+ "isUnique": true,
81
+ "where": "\"friendship\".\"removed_at\" IS NULL",
82
+ "concurrently": false,
83
+ "method": "btree",
84
+ "with": {}
85
+ },
86
+ "friendship_addressee_idx": {
87
+ "name": "friendship_addressee_idx",
88
+ "columns": [
89
+ {
90
+ "expression": "addressee_id",
91
+ "isExpression": false,
92
+ "asc": true,
93
+ "nulls": "last"
94
+ }
95
+ ],
96
+ "isUnique": false,
97
+ "concurrently": false,
98
+ "method": "btree",
99
+ "with": {}
100
+ },
101
+ "friendship_requester_idx": {
102
+ "name": "friendship_requester_idx",
103
+ "columns": [
104
+ {
105
+ "expression": "requester_id",
106
+ "isExpression": false,
107
+ "asc": true,
108
+ "nulls": "last"
109
+ }
110
+ ],
111
+ "isUnique": false,
112
+ "concurrently": false,
113
+ "method": "btree",
114
+ "with": {}
115
+ }
116
+ },
117
+ "foreignKeys": {},
118
+ "compositePrimaryKeys": {},
119
+ "uniqueConstraints": {},
120
+ "policies": {},
121
+ "checkConstraints": {
122
+ "friendship_one_decision_key": {
123
+ "name": "friendship_one_decision_key",
124
+ "value": "NOT (\"friendship\".\"accepted_at\" IS NOT NULL AND \"friendship\".\"refused_at\" IS NOT NULL)"
125
+ },
126
+ "friendship_removed_excludes_refused_key": {
127
+ "name": "friendship_removed_excludes_refused_key",
128
+ "value": "NOT (\"friendship\".\"removed_at\" IS NOT NULL AND \"friendship\".\"refused_at\" IS NOT NULL)"
129
+ }
130
+ },
131
+ "isRLSEnabled": false
132
+ }
133
+ },
134
+ "enums": {},
135
+ "schemas": {},
136
+ "sequences": {},
137
+ "roles": {},
138
+ "policies": {},
139
+ "views": {},
140
+ "_meta": {
141
+ "columns": {},
142
+ "schemas": {},
143
+ "tables": {}
144
+ }
145
+ }
@@ -29,6 +29,13 @@
29
29
  "when": 1786693962441,
30
30
  "tag": "0003_fuzzy_shadow_king",
31
31
  "breakpoints": true
32
+ },
33
+ {
34
+ "idx": 4,
35
+ "version": "7",
36
+ "when": 1786967747341,
37
+ "tag": "0004_friendship-cancel-constraint",
38
+ "breakpoints": true
32
39
  }
33
40
  ]
34
41
  }
@@ -6,6 +6,7 @@ declare const _default: {
6
6
  ADMIN_GUARD: import("@openora/core/contracts").Token<import("@openora/core/server").AdminGuard>;
7
7
  ADMIN_PERMISSION_RESOLVER: import("@openora/core/contracts").Token<import("@openora/core/contracts").AdminPermissionResolver>;
8
8
  ADMIN_PLAYER_ACTIVITY: import("@openora/core/contracts").Token<import("@openora/core/contracts").AdminPlayerActivity>;
9
+ ADMIN_ROLE_ASSIGNMENT_DIRECTORY: import("@openora/core/contracts").Token<import("@openora/core/contracts").AdminRoleAssignmentDirectory>;
9
10
  ADMIN_USER_DIRECTORY: import("@openora/core/contracts").Token<import("@openora/core/contracts").AdminUserDirectory>;
10
11
  ADMIN_WALLET_REPORTING: import("@openora/core/contracts").Token<import("@openora/core/contracts").AdminWalletReporting>;
11
12
  AUDIT_WRITER: import("@openora/core/contracts").SealedToken<import("@openora/core/contracts").AuditWritePort>;
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/engagement/social/plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBAe8C"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/engagement/social/plugin.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAMA,wBAe8C"}
@@ -51,5 +51,48 @@ export declare function createSocialRouter(social: SocialService): {
51
51
  }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
52
52
  success: import("zod").ZodLiteral<true>;
53
53
  }, import("zod/v4/core").$strip>, import("@orpc/server").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
54
+ listFriendRequests: import("@orpc/server").Procedure<import("@orpc/server").MergedInitialContext<OssContext & Record<never, never>, OssContext & Record<never, never>, OssContext>, OssContext, import("zod").ZodObject<{
55
+ direction: import("zod").ZodEnum<{
56
+ incoming: "incoming";
57
+ outgoing: "outgoing";
58
+ }>;
59
+ page: import("zod").ZodDefault<import("zod").ZodCoercedNumber<unknown>>;
60
+ limit: import("zod").ZodDefault<import("zod").ZodCoercedNumber<unknown>>;
61
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
62
+ items: import("zod").ZodArray<import("zod").ZodObject<{
63
+ friendshipId: import("zod").ZodUUID;
64
+ userId: import("zod").ZodUUID;
65
+ displayName: import("zod").ZodString;
66
+ direction: import("zod").ZodEnum<{
67
+ incoming: "incoming";
68
+ outgoing: "outgoing";
69
+ }>;
70
+ createdAt: import("zod").ZodISODateTime;
71
+ mutualFriendsCount: import("zod").ZodNullable<import("zod").ZodNumber>;
72
+ }, import("zod/v4/core").$strip>>;
73
+ total: import("zod").ZodNumber;
74
+ page: import("zod").ZodNumber;
75
+ limit: import("zod").ZodNumber;
76
+ }, import("zod/v4/core").$strip>, import("@orpc/server").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
77
+ acceptFriendRequest: import("@orpc/server").Procedure<import("@orpc/server").MergedInitialContext<OssContext & Record<never, never>, OssContext & Record<never, never>, OssContext>, OssContext, import("zod").ZodObject<{
78
+ friendshipId: import("zod").ZodUUID;
79
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
80
+ id: import("zod").ZodUUID;
81
+ requesterId: import("zod").ZodUUID;
82
+ addresseeId: import("zod").ZodUUID;
83
+ createdAt: import("zod").ZodISODateTime;
84
+ acceptedAt: import("zod").ZodNullable<import("zod").ZodISODateTime>;
85
+ refusedAt: import("zod").ZodNullable<import("zod").ZodISODateTime>;
86
+ }, import("zod/v4/core").$strip>, import("@orpc/server").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
87
+ declineFriendRequest: import("@orpc/server").Procedure<import("@orpc/server").MergedInitialContext<OssContext & Record<never, never>, OssContext & Record<never, never>, OssContext>, OssContext, import("zod").ZodObject<{
88
+ friendshipId: import("zod").ZodUUID;
89
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
90
+ success: import("zod").ZodLiteral<true>;
91
+ }, import("zod/v4/core").$strip>, import("@orpc/server").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
92
+ cancelFriendRequest: import("@orpc/server").Procedure<import("@orpc/server").MergedInitialContext<OssContext & Record<never, never>, OssContext & Record<never, never>, OssContext>, OssContext, import("zod").ZodObject<{
93
+ friendshipId: import("zod").ZodUUID;
94
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
95
+ success: import("zod").ZodLiteral<true>;
96
+ }, import("zod/v4/core").$strip>, import("@orpc/server").MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
54
97
  };
55
98
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/engagement/social/router/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE7E,OAAO,EACL,aAAa,EASd,MAAM,8BAA8B,CAAC;AAKtC,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCvD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/engagement/social/router/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAwB,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE7E,OAAO,EACL,aAAa,EAUd,MAAM,8BAA8B,CAAC;AAKtC,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwEvD"}
@@ -1,7 +1,7 @@
1
1
  import { implement } from '@orpc/server';
2
2
  import { getUserId, mapErrors } from '@openora/core/server';
3
3
  import { socialContract } from '../contract/index.js';
4
- import { SelfFriendRequestError, FriendRequestTargetNotFoundError, FriendRequestUnavailableError, AlreadyFriendsError, RequestAlreadyPendingError, FriendRequestRefusedError, BlockedBySelfError, FriendshipNotFoundError, } from '../service/social.service.js';
4
+ import { SelfFriendRequestError, FriendRequestTargetNotFoundError, FriendRequestUnavailableError, AlreadyFriendsError, RequestAlreadyPendingError, FriendRequestRefusedError, BlockedBySelfError, FriendshipNotFoundError, FriendRequestNotFoundError, } from '../service/social.service.js';
5
5
  // oRPC router factory for Social. plugin.ts builds the service from the
6
6
  // container and passes it here; each procedure delegates to the service. Keep this
7
7
  // thin: resolve the caller, call the service, map domain errors - no business rules.
@@ -37,6 +37,32 @@ export function createSocialRouter(social) {
37
37
  return { success: true };
38
38
  });
39
39
  }),
40
+ listFriendRequests: os.listFriendRequests.handler(({ input, context }) => {
41
+ const callerId = getUserId(context);
42
+ return social.listFriendRequests(callerId, {
43
+ direction: input.direction,
44
+ page: input.page,
45
+ limit: input.limit,
46
+ });
47
+ }),
48
+ acceptFriendRequest: os.acceptFriendRequest.handler(({ input, context }) => {
49
+ const callerId = getUserId(context);
50
+ return mapErrors({ NOT_FOUND: [FriendRequestNotFoundError] }, () => social.acceptFriendRequest(callerId, input.friendshipId));
51
+ }),
52
+ declineFriendRequest: os.declineFriendRequest.handler(({ input, context }) => {
53
+ const callerId = getUserId(context);
54
+ return mapErrors({ NOT_FOUND: [FriendRequestNotFoundError] }, async () => {
55
+ await social.declineFriendRequest(callerId, input.friendshipId);
56
+ return { success: true };
57
+ });
58
+ }),
59
+ cancelFriendRequest: os.cancelFriendRequest.handler(({ input, context }) => {
60
+ const callerId = getUserId(context);
61
+ return mapErrors({ NOT_FOUND: [FriendRequestNotFoundError] }, async () => {
62
+ await social.cancelFriendRequest(callerId, input.friendshipId);
63
+ return { success: true };
64
+ });
65
+ }),
40
66
  });
41
67
  }
42
68
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/engagement/social/router/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAmB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAEL,sBAAsB,EACtB,gCAAgC,EAChC,6BAA6B,EAC7B,mBAAmB,EACnB,0BAA0B,EAC1B,yBAAyB,EACzB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AAEtC,wEAAwE;AACxE,mFAAmF;AACnF,qFAAqF;AACrF,MAAM,UAAU,kBAAkB,CAAC,MAAqB;IACtD,MAAM,EAAE,GAAG,SAAS,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAc,CAAC;IAE5D,OAAO,EAAE,CAAC,MAAM,CAAC;QACf,iBAAiB,EAAE,EAAE,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE;YACrE,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;YACpC,OAAO,SAAS,CACd;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AAO,EAAE,OAAO,EAAE,IAAa,EAAE,CAAC;YACpC,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;KACH,CAAC,CAAC;AACL,CAAC"}
@@ -19,6 +19,6 @@ export const friendship = pgTable('friendship', {
19
19
  index('friendship_addressee_idx').on(t.addresseeId),
20
20
  index('friendship_requester_idx').on(t.requesterId),
21
21
  check('friendship_one_decision_key', sql `NOT (${t.acceptedAt} IS NOT NULL AND ${t.refusedAt} IS NOT NULL)`),
22
- check('friendship_removed_requires_accepted_key', sql `NOT (${t.removedAt} IS NOT NULL AND ${t.acceptedAt} IS NULL)`),
22
+ check('friendship_removed_excludes_refused_key', sql `NOT (${t.removedAt} IS NOT NULL AND ${t.refusedAt} IS NOT NULL)`),
23
23
  ]);
24
24
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/engagement/social/schema/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE1F,MAAM,CAAC,MAAM,UAAU,GAAG,OAAO,CAC/B,YAAY,EACZ;IACE,EAAE,EAAE,IAAI,EAAE,CAAC,UAAU,EAAE,CAAC,aAAa,EAAE;IACvC,WAAW,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,gDAAgD;IAC/E,WAAW,EAAE,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,gDAAgD;IAC/E,SAAS,EAAE,SAAS,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,UAAU,EAAE;IACnE,SAAS,EAAE,SAAS,CAAC,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;SACzC,OAAO,EAAE;SACT,UAAU,EAAE;SACZ,WAAW,CAAC,GAAG,EA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AAG,CAAA,QAAQ,CAAC,CAAC,SAAS,oBAAoB,CAAC,CAAC,SAAS,eAAe,CACrE;CACF,CACF,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { type DrizzleService, type EventBus } from '@openora/core/server';
2
2
  import { type FriendshipDissolvedPayload, type IdentityReader, type Uuid } from '@openora/core/contracts';
3
- import { type Friendship, type FriendListEntry, type Relationship } from '../contract/index.js';
3
+ import { type Friendship, type FriendListEntry, type FriendRequestDirection, type FriendRequestEntry, type Relationship } from '../contract/index.js';
4
4
  export declare const SelfFriendRequestError: new () => Error;
5
5
  export declare const FriendRequestTargetNotFoundError: new (id: string) => Error;
6
6
  export declare const FriendRequestUnavailableError: new () => Error;
@@ -9,27 +9,13 @@ export declare const AlreadyFriendsError: new () => Error;
9
9
  export declare const RequestAlreadyPendingError: new () => Error;
10
10
  export declare const FriendRequestRefusedError: new () => Error;
11
11
  export declare const FriendshipNotFoundError: new (id: string) => Error;
12
+ export declare const FriendRequestNotFoundError: new (id: string) => Error;
12
13
  export declare class SocialService {
13
14
  private readonly drizzle;
14
15
  private readonly events;
15
16
  private readonly identityReader;
16
17
  constructor(drizzle: DrizzleService, events: EventBus, identityReader: IdentityReader);
17
- /**
18
- * Sends a friend request from `callerId` to `targetUserId`. The insert is
19
- * attempted directly against the canonical-pair unique index (no pre-SELECT,
20
- * avoiding a TOCTOU race); a unique-violation means a row for this pair already
21
- * exists, which is resolved by re-reading it - including the mutual/simultaneous
22
- * case where the existing row was already addressed TO the caller, which
23
- * auto-accepts instead of conflicting. Events are emitted strictly after the
24
- * mutating statement/transaction has committed.
25
- */
26
18
  sendFriendRequest(callerId: Uuid, targetUserId: Uuid): Promise<Friendship>;
27
- /**
28
- * Re-reads the row a unique-violation on `friendship_pair_key` proved already
29
- * exists and resolves it: already accepted -> conflict, same-direction duplicate
30
- * -> conflict, opposite-direction (mutual/simultaneous request) -> auto-accept.
31
- * `FOR UPDATE` serializes this against a concurrent resolution of the same pair.
32
- */
33
19
  private resolveExistingPair;
34
20
  /**
35
21
  * Batch relationship lookup for a set of target users, from the caller's point
@@ -49,5 +35,19 @@ export declare class SocialService {
49
35
  page: number;
50
36
  limit: number;
51
37
  }>;
38
+ acceptFriendRequest(callerId: Uuid, friendshipId: Uuid): Promise<Friendship>;
39
+ declineFriendRequest(callerId: Uuid, friendshipId: Uuid): Promise<void>;
40
+ cancelFriendRequest(callerId: Uuid, friendshipId: Uuid): Promise<void>;
41
+ listFriendRequests(callerId: Uuid, { direction, page, limit }: {
42
+ direction: FriendRequestDirection;
43
+ page: number;
44
+ limit: number;
45
+ }): Promise<{
46
+ items: FriendRequestEntry[];
47
+ total: number;
48
+ page: number;
49
+ limit: number;
50
+ }>;
51
+ private getMutualFriendsCounts;
52
52
  }
53
53
  //# sourceMappingURL=social.service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"social.service.d.ts","sourceRoot":"","sources":["../../../../src/engagement/social/service/social.service.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,QAAQ,EAOd,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,cAAc,EACnB,KAAK,IAAI,EACV,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAShG,eAAO,MAAM,sBAAsB,iBAGlC,CAAC;AAKF,eAAO,MAAM,gCAAgC,2BAA2C,CAAC;AAOzF,eAAO,MAAM,6BAA6B,iBAGzC,CAAC;AAGF,eAAO,MAAM,kBAAkB,iBAG9B,CAAC;AACF,eAAO,MAAM,mBAAmB,iBAG/B,CAAC;AACF,eAAO,MAAM,0BAA0B,iBAGtC,CAAC;AACF,eAAO,MAAM,yBAAyB,iBAGrC,CAAC;AAEF,eAAO,MAAM,uBAAuB,2BAAkC,CAAC;AAkCvE,qBAAa,aAAa;IAEtB,OAAO,CAAC,QAA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