jr-common-micro 1.1.93 → 1.1.95
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/proto/micro/v1/chat/chat_messages_nest.d.ts +4 -0
- package/dist/proto/micro/v1/chat/chat_messages_pb.d.ts +4 -0
- package/dist/proto/micro/v1/chat/chat_messages_pb.js +8 -0
- package/dist/proto/micro/v1/index.d.ts +1 -0
- package/dist/proto/micro/v1/index.js +2 -1
- package/dist/proto/micro/v1/subscription/index.d.ts +3 -0
- package/dist/proto/micro/v1/subscription/index.js +7 -0
- package/dist/proto/micro/v1/subscription/services_connect.d.ts +56 -0
- package/dist/proto/micro/v1/subscription/services_connect.js +59 -0
- package/dist/proto/micro/v1/subscription/services_nest.d.ts +28 -0
- package/dist/proto/micro/v1/subscription/services_nest.js +31 -0
- package/dist/proto/micro/v1/subscription/subscription_messages_nest.d.ts +75 -0
- package/dist/proto/micro/v1/subscription/subscription_messages_nest.js +5 -0
- package/dist/proto/micro/v1/subscription/subscription_messages_pb.d.ts +163 -0
- package/dist/proto/micro/v1/subscription/subscription_messages_pb.js +358 -0
- package/dist/proto/micro/v1/user/services_connect.d.ts +7 -1
- package/dist/proto/micro/v1/user/services_connect.js +6 -0
- package/dist/proto/micro/v1/user/services_nest.d.ts +3 -1
- package/dist/proto/micro/v1/user/services_nest.js +1 -0
- package/dist/proto/micro/v1/user/user_messages_nest.d.ts +6 -0
- package/dist/proto/micro/v1/user/user_messages_pb.d.ts +14 -0
- package/dist/proto/micro/v1/user/user_messages_pb.js +32 -1
- package/dist/utils/constants.d.ts +1 -0
- package/dist/utils/constants.js +2 -1
- package/dist/utils/entitlements.d.ts +16 -0
- package/dist/utils/entitlements.js +41 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +2 -1
- package/package.json +1 -1
- package/proto/micro/v1/chat/chat_messages.proto +10 -0
- package/proto/micro/v1/subscription/services.proto +28 -0
- package/proto/micro/v1/subscription/subscription_messages.proto +112 -0
- package/proto/micro/v1/user/services.proto +2 -0
- package/proto/micro/v1/user/user_messages.proto +11 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package micro.v1.subscription;
|
|
4
|
+
|
|
5
|
+
import "micro/v1/general.proto";
|
|
6
|
+
import "micro/v1/subscription/subscription_messages.proto";
|
|
7
|
+
|
|
8
|
+
// Paid plans. The store side (receipts, renewals, refunds) is handled by
|
|
9
|
+
// RevenueCat; this service turns its view of a customer into our own
|
|
10
|
+
// entitlement rows, which every other service reads. Nothing else talks to
|
|
11
|
+
// the store.
|
|
12
|
+
service PSubscriptionService {
|
|
13
|
+
// The caller's plan and entitlements as we know them (no store call).
|
|
14
|
+
rpc Me(EmptyRequest) returns(stream SubscriptionMeResponse) {}
|
|
15
|
+
// The caller just bought or restored: pull the store's view now instead
|
|
16
|
+
// of waiting for the webhook. Rate-limited per person.
|
|
17
|
+
rpc Sync(EmptyRequest) returns(stream SubscriptionMeResponse) {}
|
|
18
|
+
// Service-to-service: entitlements of many users at once (chat/data).
|
|
19
|
+
rpc EntitlementsByIds(EntitlementsByIdsRequest) returns(stream EntitlementsListResponse) {}
|
|
20
|
+
// RevenueCat webhook, forwarded by the gateway with its raw body.
|
|
21
|
+
rpc Webhook(SubscriptionWebhookRequest) returns(stream EmptyResponse) {}
|
|
22
|
+
// Support tools.
|
|
23
|
+
rpc AdminRead(ByIdRequest) returns(stream SubscriptionAdminResponse) {}
|
|
24
|
+
rpc AdminGrant(SubscriptionGrantRequest) returns(stream SubscriptionAdminResponse) {}
|
|
25
|
+
rpc AdminRevoke(SubscriptionRevokeRequest) returns(stream SubscriptionAdminResponse) {}
|
|
26
|
+
// Account deletion parity with every other micro.
|
|
27
|
+
rpc RemoveUserData(ByIdRequest) returns(stream EmptyResponse) {}
|
|
28
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package micro.v1.subscription;
|
|
4
|
+
|
|
5
|
+
import "micro/v1/general.proto";
|
|
6
|
+
|
|
7
|
+
// A person's standing on one plan. `plan` is the RevenueCat entitlement
|
|
8
|
+
// identifier (premium); the feature keys it unlocks live in jr-common
|
|
9
|
+
// utils/entitlements.
|
|
10
|
+
message SubscriptionInfo {
|
|
11
|
+
string plan = 1;
|
|
12
|
+
// active | cancelled (renewal off, access until expires_at) | grace
|
|
13
|
+
// (payment failed, access until grace_until) | paused | expired | refunded
|
|
14
|
+
string status = 2;
|
|
15
|
+
string product_id = 3;
|
|
16
|
+
// app_store | play_store | promotional | stripe ...
|
|
17
|
+
string store = 4;
|
|
18
|
+
// production | sandbox
|
|
19
|
+
string environment = 5;
|
|
20
|
+
// normal | trial | intro | promotional | prepaid
|
|
21
|
+
string period_type = 6;
|
|
22
|
+
// RFC 3339, UTC. Empty when unknown.
|
|
23
|
+
string purchased_at = 7;
|
|
24
|
+
string original_purchase_at = 8;
|
|
25
|
+
string expires_at = 9;
|
|
26
|
+
string grace_until = 10;
|
|
27
|
+
// Until when the person keeps the features (expires_at or grace_until).
|
|
28
|
+
string access_until = 11;
|
|
29
|
+
bool auto_renew = 12;
|
|
30
|
+
// purchased | family_shared
|
|
31
|
+
string ownership_type = 13;
|
|
32
|
+
// Google pause: when billing resumes.
|
|
33
|
+
string auto_resume_at = 14;
|
|
34
|
+
// Store page where the person manages the subscription (may be empty).
|
|
35
|
+
string management_url = 15;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// One unlocked feature. `key` is a catalogue key such as badge.premium;
|
|
39
|
+
// `expires_at` empty means no end date (manual grants).
|
|
40
|
+
message EntitlementInfo {
|
|
41
|
+
string key = 1;
|
|
42
|
+
string expires_at = 2;
|
|
43
|
+
string plan = 3;
|
|
44
|
+
// subscription | promotional
|
|
45
|
+
string source = 4;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
message SubscriptionMeResponse {
|
|
49
|
+
ResponseStatus status = 1;
|
|
50
|
+
optional SubscriptionInfo subscription = 2;
|
|
51
|
+
repeated EntitlementInfo entitlements = 3;
|
|
52
|
+
// When the store was last consulted for this person (RFC 3339).
|
|
53
|
+
string synced_at = 4;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
message EntitlementsByIdsRequest {
|
|
57
|
+
repeated string user_ids = 1;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
message UserEntitlements {
|
|
61
|
+
string user_id = 1;
|
|
62
|
+
repeated EntitlementInfo entitlements = 2;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
message EntitlementsListResponse {
|
|
66
|
+
ResponseStatus status = 1;
|
|
67
|
+
repeated UserEntitlements data = 2;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// The webhook exactly as RevenueCat sent it. The body stays raw so the
|
|
71
|
+
// HMAC signature can be checked over the original bytes.
|
|
72
|
+
message SubscriptionWebhookRequest {
|
|
73
|
+
string authorization = 1;
|
|
74
|
+
string signature = 2;
|
|
75
|
+
string raw_body = 3;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
message SubscriptionEventInfo {
|
|
79
|
+
string id = 1;
|
|
80
|
+
string type = 2;
|
|
81
|
+
string store = 3;
|
|
82
|
+
string product_id = 4;
|
|
83
|
+
string environment = 5;
|
|
84
|
+
string received_at = 6;
|
|
85
|
+
string processed_at = 7;
|
|
86
|
+
string error = 8;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
message SubscriptionAdminResponse {
|
|
90
|
+
ResponseStatus status = 1;
|
|
91
|
+
repeated SubscriptionInfo subscriptions = 2;
|
|
92
|
+
repeated EntitlementInfo entitlements = 3;
|
|
93
|
+
// Newest first, capped.
|
|
94
|
+
repeated SubscriptionEventInfo events = 4;
|
|
95
|
+
string synced_at = 5;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Support: give a plan for a while without a purchase (goes through the
|
|
99
|
+
// store layer as a promotional entitlement, so it is visible everywhere).
|
|
100
|
+
// duration: daily | three_day | weekly | monthly | two_month | three_month
|
|
101
|
+
// | six_month | yearly | lifetime
|
|
102
|
+
message SubscriptionGrantRequest {
|
|
103
|
+
string user_id = 1;
|
|
104
|
+
string plan = 2;
|
|
105
|
+
string duration = 3;
|
|
106
|
+
string note = 4;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
message SubscriptionRevokeRequest {
|
|
110
|
+
string user_id = 1;
|
|
111
|
+
string plan = 2;
|
|
112
|
+
}
|
|
@@ -76,6 +76,8 @@ service PProfileService {
|
|
|
76
76
|
rpc Followers(PaginateRequest) returns(stream ProfileListResponse) {}
|
|
77
77
|
rpc ProfilesByIds(ProfilesByIdsRequest) returns(stream ProfileListResponse) {}
|
|
78
78
|
rpc Following(PaginateRequest) returns(stream ProfileListResponse) {}
|
|
79
|
+
// Service-to-service only (internal hash, no user token).
|
|
80
|
+
rpc SetSubscriptionBadge(SubscriptionBadgeRequest) returns(stream UserBadgesResponse) {}
|
|
79
81
|
}
|
|
80
82
|
|
|
81
83
|
// Admin
|
|
@@ -49,6 +49,17 @@ message UserBadgesResponse {
|
|
|
49
49
|
repeated string badges = 2;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
// Internal (subscription service): keep a plan's badge in step with the
|
|
53
|
+
// plan. active=true (re)grants with source=subscription until expires_at
|
|
54
|
+
// (RFC 3339, empty = open-ended); active=false revokes it. Never touches
|
|
55
|
+
// badges granted by hand.
|
|
56
|
+
message SubscriptionBadgeRequest {
|
|
57
|
+
string user_id = 1;
|
|
58
|
+
string badge = 2;
|
|
59
|
+
bool active = 3;
|
|
60
|
+
string expires_at = 4;
|
|
61
|
+
}
|
|
62
|
+
|
|
52
63
|
enum TfaSelectionEnum { nothing = 0; sms = 1; authenticator = 2; }
|
|
53
64
|
|
|
54
65
|
message UserProfileDto {
|