mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
refactor(editor): Move cloudPlans api to @n8n/rest-api-client (no-changelog) (#16182)
This commit is contained in:
61
packages/frontend/@n8n/rest-api-client/src/api/cloudPlans.ts
Normal file
61
packages/frontend/@n8n/rest-api-client/src/api/cloudPlans.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import type { IRestApiContext } from '../types';
|
||||
import { get, post } from '../utils';
|
||||
|
||||
export declare namespace Cloud {
|
||||
export interface PlanData {
|
||||
planId: number;
|
||||
monthlyExecutionsLimit: number;
|
||||
activeWorkflowsLimit: number;
|
||||
credentialsLimit: number;
|
||||
isActive: boolean;
|
||||
displayName: string;
|
||||
expirationDate: string;
|
||||
metadata: PlanMetadata;
|
||||
}
|
||||
|
||||
export interface PlanMetadata {
|
||||
version: 'v1';
|
||||
group: 'opt-out' | 'opt-in' | 'trial';
|
||||
slug: 'pro-1' | 'pro-2' | 'starter' | 'trial-1';
|
||||
trial?: Trial;
|
||||
}
|
||||
|
||||
interface Trial {
|
||||
length: number;
|
||||
gracePeriod: number;
|
||||
}
|
||||
|
||||
export type UserAccount = {
|
||||
confirmed: boolean;
|
||||
username: string;
|
||||
email: string;
|
||||
hasEarlyAccess?: boolean;
|
||||
role?: string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface InstanceUsage {
|
||||
timeframe?: string;
|
||||
executions: number;
|
||||
activeWorkflows: number;
|
||||
}
|
||||
|
||||
export async function getCurrentPlan(context: IRestApiContext): Promise<Cloud.PlanData> {
|
||||
return await get(context.baseUrl, '/admin/cloud-plan');
|
||||
}
|
||||
|
||||
export async function getCurrentUsage(context: IRestApiContext): Promise<InstanceUsage> {
|
||||
return await get(context.baseUrl, '/cloud/limits');
|
||||
}
|
||||
|
||||
export async function getCloudUserInfo(context: IRestApiContext): Promise<Cloud.UserAccount> {
|
||||
return await get(context.baseUrl, '/cloud/proxy/user/me');
|
||||
}
|
||||
|
||||
export async function sendConfirmationEmail(context: IRestApiContext): Promise<Cloud.UserAccount> {
|
||||
return await post(context.baseUrl, '/cloud/proxy/user/resend-confirmation-email');
|
||||
}
|
||||
|
||||
export async function getAdminPanelLoginCode(context: IRestApiContext): Promise<{ code: string }> {
|
||||
return await get(context.baseUrl, '/cloud/proxy/login/code');
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
export * from './api-keys';
|
||||
export * from './cloudPlans';
|
||||
export * from './communityNodes';
|
||||
export * from './ctas';
|
||||
export * from './eventbus.ee';
|
||||
|
||||
Reference in New Issue
Block a user