@secrecy/lib 1.0.0-dev.54 → 1.0.0-dev.57

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.
@@ -1,106 +1,13 @@
1
1
  import type { DownloadProgress as DLProgress } from "ky";
2
- import type { UserSession } from "./client/types/index.js";
3
2
  import type { SecrecyEnv } from "./client/helpers.js";
4
- import type { Lang, PayInputType, PlanKind, Thunder, UserRole } from "./zeus/index.js";
3
+ import type { Lang, Thunder, UserRole } from "./zeus/index.js";
5
4
  import { InfuraNetwork } from "./zeus/index.js";
6
- import type { ErrorAccessDenied, ErrorLimit, ErrorNotFound, ErrorNotExist, ErrorLangNotExist, ErrorBasic } from "./error.js";
5
+ import type { ErrorAccessDenied, ErrorLimit, ErrorNotFound, ErrorNotExist } from "./error.js";
7
6
  export declare type SuccessResponse<T> = {
8
7
  __typename: "SuccessResponse";
9
8
  data: T;
10
9
  };
11
10
  export declare type DownloadProgress = DLProgress;
12
- export declare type PayInput = {
13
- type: PayInputType;
14
- token: string;
15
- firstName: string;
16
- lastName: string;
17
- street: string;
18
- postalCode: string;
19
- city: string;
20
- country: string;
21
- month: string;
22
- year: string;
23
- cvv: string;
24
- number: string;
25
- };
26
- export declare type MailLimits = {
27
- count?: bigint | undefined;
28
- fileCount?: bigint | undefined;
29
- fileSize?: bigint | undefined;
30
- hardCount?: bigint | undefined;
31
- hardFileCount?: bigint | undefined;
32
- hardFileSize?: bigint | undefined;
33
- perFileSize?: bigint | undefined;
34
- };
35
- export declare type Limits = {
36
- downloadBandwidth?: bigint | undefined;
37
- downloadCount?: bigint | undefined;
38
- hardFileCount?: bigint | undefined;
39
- hardFileSize?: bigint | undefined;
40
- perFileSize?: bigint | undefined;
41
- receivedMails: MailLimits;
42
- sentMails: MailLimits;
43
- uploadBandwidth?: bigint | undefined;
44
- uploadCount?: bigint | undefined;
45
- };
46
- export declare type GodUser = {
47
- id: string;
48
- firstname: string;
49
- lastname: string;
50
- email: string;
51
- phone: string;
52
- };
53
- export declare type GodFatherAndChildren = {
54
- godFather: GodUser | null;
55
- godChildren: GodUser[];
56
- };
57
- export declare type Plan = {
58
- codes: string[];
59
- kind: PlanKind;
60
- limits: Limits;
61
- };
62
- export declare type SubscriptionState = "active" | "canceled" | "paused" | "expired" | "future" | "in_trial" | "live" | "past_due";
63
- export declare type SubscriptionCollectionMethod = "automatic" | "manual";
64
- declare type InternalSubscription = {
65
- autorenew: boolean;
66
- activatedAt?: Date | null | undefined;
67
- currentPeriodEndsAt?: Date | null | undefined;
68
- currentPeriodStartedAt?: Date | null | undefined;
69
- canceledAt?: Date | null | undefined;
70
- createdAt?: Date | null | undefined;
71
- expiresAt?: Date | null | undefined;
72
- pausedAt?: Date | null | undefined;
73
- trialEndsAt?: Date | null | undefined;
74
- trialStartedAt?: Date | null | undefined;
75
- updatedAt?: Date | null | undefined;
76
- collectionMethod: string;
77
- state: string;
78
- plan?: string | null | undefined;
79
- planCode?: string | null | undefined;
80
- total?: number | null | undefined;
81
- };
82
- declare type RecurlyInvoiceStatus = "pending" | "paid" | "failed" | "past_due" | "open" | "closed" | "voided" | "processing";
83
- declare type InternalRecurlyInvoices = {
84
- pdf: string;
85
- date: Date;
86
- due: Date;
87
- status: string;
88
- total: number;
89
- name: string;
90
- currency: string;
91
- };
92
- export declare type Subscription = InternalSubscription & {
93
- collectionMethod: SubscriptionCollectionMethod;
94
- state: SubscriptionState;
95
- };
96
- export declare type RecurlyInvoices = InternalRecurlyInvoices & {
97
- status: RecurlyInvoiceStatus;
98
- };
99
- export declare type PaymentInfos = {
100
- hostedUrl: string;
101
- currentSubscription: Subscription;
102
- invoices: RecurlyInvoices[];
103
- };
104
11
  export declare type SendReport = {
105
12
  id: string;
106
13
  user: {
@@ -117,9 +24,6 @@ export declare type SendReport = {
117
24
  };
118
25
  customMessage?: string | undefined;
119
26
  };
120
- declare const plansCodes: readonly ["basic_month", "advanced_month", "pro_month", "basic_year", "advanced_year", "pro_year"];
121
- export declare type SecrecyPlansCodes = typeof plansCodes[number];
122
- export declare function isValidPlan(planCode: string): planCode is SecrecyPlansCodes;
123
27
  export declare type UserData<T extends Record<string, unknown> = Record<string, unknown>> = {
124
28
  isSuperuser: boolean;
125
29
  isSearchable: boolean;
@@ -136,23 +40,6 @@ export declare type AppDBConfigField = {
136
40
  export declare type AppDBConfig = {
137
41
  fields: AppDBConfigField[];
138
42
  };
139
- export declare type FaqItem = {
140
- order: number;
141
- question: string;
142
- answer: string;
143
- };
144
- export declare type BlogItem = {
145
- id: string;
146
- blogId: string;
147
- order: number;
148
- author: string;
149
- body: string;
150
- date: Date;
151
- image: string;
152
- imageAlt: string;
153
- summary: string;
154
- title: string;
155
- };
156
43
  export declare type UserBase = {
157
44
  email: string;
158
45
  phone: string;
@@ -202,11 +89,10 @@ export declare type QueryLimits = {
202
89
  };
203
90
  export declare class BaseClient {
204
91
  static readonly getBaseUrl: (env?: SecrecyEnv, graphcdn?: boolean) => string;
205
- private static readonly _getBaseClient;
206
- protected client: ReturnType<typeof Thunder>;
92
+ static readonly getBaseClient: (env: SecrecyEnv, session?: string | null | undefined) => ReturnType<typeof Thunder>;
93
+ protected thunder: ReturnType<typeof Thunder>;
207
94
  sessionId: string;
208
95
  constructor(session: string, env: SecrecyEnv);
209
- sessions(): Promise<SuccessResponse<UserSession[]> | ErrorNotFound | null>;
210
96
  logout(sessionId?: string | null | undefined): Promise<void>;
211
97
  me<T extends WithPublicKey = WithPublicKey>(params?: T): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
212
98
  static user<T extends StaticGetUserParams>(params: T, sessionId?: string | null | undefined): Promise<SuccessResponse<User<T>> | ErrorNotFound | null>;
@@ -216,17 +102,12 @@ export declare class BaseClient {
216
102
  lastname: string | null;
217
103
  lang: Lang | null;
218
104
  }): Promise<SuccessResponse<User> | ErrorNotFound | ErrorAccessDenied | null>;
219
- static plans(env: SecrecyEnv, sessionId?: string | null | undefined): Promise<SuccessResponse<Plan[]> | null>;
220
105
  static isCryptoTransactionDone({ env, idOrHash, network }: {
221
106
  env: SecrecyEnv;
222
107
  idOrHash: string;
223
108
  network?: InfuraNetwork;
224
109
  }): Promise<boolean>;
225
- pay(planCode: SecrecyPlansCodes, input: PayInput, autoRenew?: boolean | null | undefined): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
226
- cancelPayment(): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
227
- paymentInfos(): Promise<SuccessResponse<PaymentInfos> | ErrorAccessDenied | null>;
228
110
  limits(): Promise<SuccessResponse<QueryLimits> | ErrorAccessDenied | ErrorNotExist | ErrorLimit | ErrorNotFound | null>;
229
- godFatherAndChildren(): Promise<SuccessResponse<GodFatherAndChildren> | ErrorNotFound | null>;
230
111
  static updateAppDBConfig({ appCode, config, env, sessionId }: {
231
112
  appCode: string;
232
113
  config: AppDBConfig;
@@ -234,28 +115,9 @@ export declare class BaseClient {
234
115
  sessionId?: string | null | undefined;
235
116
  }): Promise<SuccessResponse<AppDBConfig> | ErrorAccessDenied | null>;
236
117
  static getAppDBConfig(appCode: string, env: SecrecyEnv, sessionId?: string | null | undefined): Promise<SuccessResponse<AppDBConfig> | ErrorAccessDenied | ErrorNotFound | ErrorNotExist | null>;
237
- static getFAQ({ lang, env, sessionId }: {
238
- lang?: Lang;
239
- env: SecrecyEnv;
240
- sessionId?: string | null | undefined;
241
- }): Promise<SuccessResponse<FaqItem[]> | ErrorAccessDenied | null>;
242
- static getBlog({ env, lang, sessionId }: {
243
- env: SecrecyEnv;
244
- lang?: Lang | null | undefined;
245
- sessionId?: string | null | undefined;
246
- }): Promise<SuccessResponse<BlogItem[]> | ErrorLangNotExist | null>;
247
118
  reportUser(reportedUserId: string, customMessage?: string): Promise<SuccessResponse<SendReport> | ErrorAccessDenied | ErrorNotFound | null>;
248
- static deleteUser({ sessionId, userId, env }: {
249
- sessionId: string;
250
- userId?: string;
251
- env: SecrecyEnv;
252
- }): Promise<SuccessResponse<boolean> | ErrorAccessDenied | null>;
253
119
  getSponsorshipLink({ backUrl }: {
254
120
  backUrl: string;
255
121
  }): Promise<string | null>;
256
- updateAutoDisconnectDelay({ id, delay }: {
257
- id: string;
258
- delay: number | null;
259
- }): Promise<SuccessResponse<boolean> | ErrorNotFound | ErrorAccessDenied | ErrorBasic | null>;
260
122
  }
261
123
  export {};