mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-30 00:29:46 +08:00
feat(server): early subscription for iap (#13826)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a mutation to request/apply a subscription by transaction ID (client mutation and server operation), returning subscription details. * **Bug Fixes / Improvements** * More robust external subscription sync with safer conflict detection, optional short-lived confirmation, improved parsing and error logging. * **Chores** * Standardized time constants for clarity. * **Tests** * Updated subscription test data (expiration date) to reflect new lifecycle expectations. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -2237,6 +2237,25 @@ export const refreshSubscriptionMutation = {
|
||||
deprecations: ["'id' is deprecated: removed"],
|
||||
};
|
||||
|
||||
export const requestApplySubscriptionMutation = {
|
||||
id: 'requestApplySubscriptionMutation' as const,
|
||||
op: 'requestApplySubscription',
|
||||
query: `mutation requestApplySubscription($transactionId: String!) {
|
||||
requestApplySubscription(transactionId: $transactionId) {
|
||||
id
|
||||
status
|
||||
plan
|
||||
recurring
|
||||
start
|
||||
end
|
||||
nextBillAt
|
||||
canceledAt
|
||||
variant
|
||||
}
|
||||
}`,
|
||||
deprecations: ["'id' is deprecated: removed"],
|
||||
};
|
||||
|
||||
export const subscriptionQuery = {
|
||||
id: 'subscriptionQuery' as const,
|
||||
op: 'subscription',
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
mutation requestApplySubscription($transactionId: String!) {
|
||||
requestApplySubscription(transactionId: $transactionId) {
|
||||
id
|
||||
status
|
||||
plan
|
||||
recurring
|
||||
start
|
||||
end
|
||||
nextBillAt
|
||||
canceledAt
|
||||
variant
|
||||
}
|
||||
}
|
||||
@@ -1467,6 +1467,8 @@ export interface Mutation {
|
||||
/** Remove workspace embedding files */
|
||||
removeWorkspaceEmbeddingFiles: Scalars['Boolean']['output'];
|
||||
removeWorkspaceFeature: Scalars['Boolean']['output'];
|
||||
/** Request to apply the subscription in advance */
|
||||
requestApplySubscription: Array<SubscriptionType>;
|
||||
/** Resolve a comment or not */
|
||||
resolveComment: Scalars['Boolean']['output'];
|
||||
resumeSubscription: SubscriptionType;
|
||||
@@ -1788,6 +1790,10 @@ export interface MutationRemoveWorkspaceFeatureArgs {
|
||||
workspaceId: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface MutationRequestApplySubscriptionArgs {
|
||||
transactionId: Scalars['String']['input'];
|
||||
}
|
||||
|
||||
export interface MutationResolveCommentArgs {
|
||||
input: CommentResolveInput;
|
||||
}
|
||||
@@ -6018,6 +6024,26 @@ export type RefreshSubscriptionMutation = {
|
||||
}>;
|
||||
};
|
||||
|
||||
export type RequestApplySubscriptionMutationVariables = Exact<{
|
||||
transactionId: Scalars['String']['input'];
|
||||
}>;
|
||||
|
||||
export type RequestApplySubscriptionMutation = {
|
||||
__typename?: 'Mutation';
|
||||
requestApplySubscription: Array<{
|
||||
__typename?: 'SubscriptionType';
|
||||
id: string | null;
|
||||
status: SubscriptionStatus;
|
||||
plan: SubscriptionPlan;
|
||||
recurring: SubscriptionRecurring;
|
||||
start: string;
|
||||
end: string | null;
|
||||
nextBillAt: string | null;
|
||||
canceledAt: string | null;
|
||||
variant: SubscriptionVariant | null;
|
||||
}>;
|
||||
};
|
||||
|
||||
export type SubscriptionQueryVariables = Exact<{ [key: string]: never }>;
|
||||
|
||||
export type SubscriptionQuery = {
|
||||
@@ -7108,6 +7134,11 @@ export type Mutations =
|
||||
variables: RefreshSubscriptionMutationVariables;
|
||||
response: RefreshSubscriptionMutation;
|
||||
}
|
||||
| {
|
||||
name: 'requestApplySubscriptionMutation';
|
||||
variables: RequestApplySubscriptionMutationVariables;
|
||||
response: RequestApplySubscriptionMutation;
|
||||
}
|
||||
| {
|
||||
name: 'updateDocDefaultRoleMutation';
|
||||
variables: UpdateDocDefaultRoleMutationVariables;
|
||||
|
||||
Reference in New Issue
Block a user