@secrecy/lib 1.0.0-dev.53 → 1.0.0-dev.56

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