@secrecy/lib 1.7.0-integration-trpc-client.12 → 1.7.0-integration-trpc-client.13
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/lib/client/SecrecyDbClient.js +50 -2
- package/dist/lib/client/types/orm/core.js +1 -0
- package/dist/lib/client/types/orm/index.js +1 -0
- package/dist/lib/client/types/orm/keywords/data.js +1 -0
- package/dist/lib/client/types/orm/keywords/order-by.js +1 -0
- package/dist/lib/client/types/orm/keywords/select.js +1 -0
- package/dist/lib/client/types/orm/keywords/skip.js +1 -0
- package/dist/lib/client/types/orm/keywords/take.js +1 -0
- package/dist/lib/client/types/orm/keywords/where.js +1 -0
- package/dist/lib/client/types/orm/methods.js +1 -0
- package/dist/types/client/SecrecyAppClient.d.ts +3 -2
- package/dist/types/client/SecrecyCloudClient.d.ts +3 -2
- package/dist/types/client/SecrecyDbClient.d.ts +19 -3
- package/dist/types/client/SecrecyMailClient.d.ts +3 -2
- package/dist/types/client/SecrecyPayClient.d.ts +3 -2
- package/dist/types/client/SecrecyWalletClient.d.ts +3 -2
- package/dist/types/client/convert/mail.d.ts +1 -1
- package/dist/types/client/index.d.ts +8 -7
- package/dist/types/client/types/orm/core.d.ts +25 -0
- package/dist/types/client/types/orm/index.d.ts +3 -0
- package/dist/types/client/types/orm/keywords/data.d.ts +4 -0
- package/dist/types/client/types/orm/keywords/order-by.d.ts +6 -0
- package/dist/types/client/types/orm/keywords/select.d.ts +7 -0
- package/dist/types/client/types/orm/keywords/skip.d.ts +1 -0
- package/dist/types/client/types/orm/keywords/take.d.ts +1 -0
- package/dist/types/client/types/orm/keywords/where.d.ts +21 -0
- package/dist/types/client/types/orm/methods.d.ts +56 -0
- package/dist/types/client.d.ts +8 -8
- package/package.json +2 -4
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// import { type UserData } from '../types.js'
|
|
2
|
-
// import { bufferToBase64 } from '../utils/base64.js'
|
|
3
1
|
export class SecrecyDbClient {
|
|
4
2
|
// #client: SecrecyClient;
|
|
5
3
|
// #keys: KeyPair;
|
|
@@ -9,4 +7,54 @@ export class SecrecyDbClient {
|
|
|
9
7
|
// this.#keys = keys;
|
|
10
8
|
this.#apiClient = apiClient;
|
|
11
9
|
}
|
|
10
|
+
async getConfig(input) {
|
|
11
|
+
return await this.#apiClient.db.developer.config.query(input);
|
|
12
|
+
}
|
|
13
|
+
async updateConfig(input) {
|
|
14
|
+
return await this.#apiClient.db.developer.updateConfig.mutate(input);
|
|
15
|
+
}
|
|
16
|
+
async createEnv(input) {
|
|
17
|
+
return await this.#apiClient.db.developer.createEnv.mutate(input);
|
|
18
|
+
}
|
|
19
|
+
async deleteEnv(input) {
|
|
20
|
+
return await this.#apiClient.db.developer.deleteEnv.mutate(input);
|
|
21
|
+
}
|
|
22
|
+
async diff(input) {
|
|
23
|
+
return await this.#apiClient.db.developer.diff.query(input);
|
|
24
|
+
}
|
|
25
|
+
async migrate(input) {
|
|
26
|
+
return await this.#apiClient.db.developer.migrate.mutate(input);
|
|
27
|
+
}
|
|
28
|
+
async create(input) {
|
|
29
|
+
const response = await this.#apiClient.db.user.create.mutate(input);
|
|
30
|
+
return response;
|
|
31
|
+
}
|
|
32
|
+
async createMany(input) {
|
|
33
|
+
const response = await this.#apiClient.db.user.createMany.mutate(input);
|
|
34
|
+
return response;
|
|
35
|
+
}
|
|
36
|
+
async delete(input) {
|
|
37
|
+
const response = await this.#apiClient.db.user.delete.mutate(input);
|
|
38
|
+
return response;
|
|
39
|
+
}
|
|
40
|
+
async deleteMany(input) {
|
|
41
|
+
const response = await this.#apiClient.db.user.deleteMany.mutate(input);
|
|
42
|
+
return response;
|
|
43
|
+
}
|
|
44
|
+
async findFirst(input) {
|
|
45
|
+
const response = await this.#apiClient.db.user.findFirst.query(input);
|
|
46
|
+
return response;
|
|
47
|
+
}
|
|
48
|
+
async findMany(input) {
|
|
49
|
+
const response = await this.#apiClient.db.user.findMany.query(input);
|
|
50
|
+
return response;
|
|
51
|
+
}
|
|
52
|
+
async update(input) {
|
|
53
|
+
const response = await this.#apiClient.db.user.update.mutate(input);
|
|
54
|
+
return response;
|
|
55
|
+
}
|
|
56
|
+
async updateMany(input) {
|
|
57
|
+
const response = await this.#apiClient.db.user.updateMany.mutate(input);
|
|
58
|
+
return response;
|
|
59
|
+
}
|
|
12
60
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,11 +2,12 @@ import type { SecrecyClient, UserAppNotifications, UserAppSettings } from '../in
|
|
|
2
2
|
import type { JwtPayload } from 'jsonwebtoken';
|
|
3
3
|
import { type RouterOutputs, type ApiClient } from '../client.js';
|
|
4
4
|
import { type KeyPair } from './types/index.js';
|
|
5
|
-
|
|
5
|
+
import { type DatabaseSchema } from './types/orm/core.js';
|
|
6
|
+
export declare class SecrecyAppClient<Schema extends DatabaseSchema = DatabaseSchema> {
|
|
6
7
|
#private;
|
|
7
8
|
jwt: string;
|
|
8
9
|
jwtDecoded: JwtPayload;
|
|
9
|
-
constructor(uaJwt: string, _client: SecrecyClient
|
|
10
|
+
constructor(uaJwt: string, _client: SecrecyClient<Schema>, _keys: KeyPair, apiClient: ApiClient);
|
|
10
11
|
get userId(): string;
|
|
11
12
|
getJwt(): Promise<string>;
|
|
12
13
|
limits(): Promise<RouterOutputs['application']['limits']>;
|
|
@@ -2,9 +2,10 @@ import type { ProgressCallback, SecrecyClient } from '../index.js';
|
|
|
2
2
|
import type { FileMetadata, KeyPair, Node, NodeFull, NodeType, Rights } from './types/index.js';
|
|
3
3
|
import { type ApiClient } from '../client.js';
|
|
4
4
|
import { type DownloadProgress } from '../types.js';
|
|
5
|
-
|
|
5
|
+
import { type DatabaseSchema } from './types/orm/core.js';
|
|
6
|
+
export declare class SecrecyCloudClient<Schema extends DatabaseSchema = DatabaseSchema> {
|
|
6
7
|
#private;
|
|
7
|
-
constructor(client: SecrecyClient
|
|
8
|
+
constructor(client: SecrecyClient<Schema>, keys: KeyPair, apiClient: ApiClient);
|
|
8
9
|
addFileToHistory({ fileId, nodeId, }: {
|
|
9
10
|
fileId: string;
|
|
10
11
|
nodeId: string;
|
|
@@ -1,7 +1,23 @@
|
|
|
1
|
-
import { type ApiClient } from '../client.js';
|
|
1
|
+
import { type RouterInputs, type ApiClient, type RouterOutputs } from '../client.js';
|
|
2
2
|
import type { SecrecyClient } from '../index.js';
|
|
3
3
|
import { type KeyPair } from './types/index.js';
|
|
4
|
-
|
|
4
|
+
import { type DatabaseSchema } from './types/orm/core.js';
|
|
5
|
+
import type * as ORM from './types/orm/index.js';
|
|
6
|
+
export declare class SecrecyDbClient<Schema extends DatabaseSchema = DatabaseSchema> {
|
|
5
7
|
#private;
|
|
6
|
-
constructor(_client: SecrecyClient
|
|
8
|
+
constructor(_client: SecrecyClient<Schema>, _keys: KeyPair, apiClient: ApiClient);
|
|
9
|
+
getConfig(input: RouterInputs['db']['developer']['config']): Promise<RouterOutputs['db']['developer']['config']>;
|
|
10
|
+
updateConfig(input: RouterInputs['db']['developer']['updateConfig']): Promise<RouterOutputs['db']['developer']['updateConfig']>;
|
|
11
|
+
createEnv(input: RouterInputs['db']['developer']['createEnv']): Promise<RouterOutputs['db']['developer']['createEnv']>;
|
|
12
|
+
deleteEnv(input: RouterInputs['db']['developer']['deleteEnv']): Promise<RouterOutputs['db']['developer']['deleteEnv']>;
|
|
13
|
+
diff(input: RouterInputs['db']['developer']['diff']): Promise<RouterOutputs['db']['developer']['diff']>;
|
|
14
|
+
migrate(input: RouterInputs['db']['developer']['migrate']): Promise<RouterOutputs['db']['developer']['migrate']>;
|
|
15
|
+
create<AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv]>(input: ORM.CreateInput<Schema, AppEnv, AppTable>): Promise<ORM.CreateOutput<Schema, AppEnv, AppTable>>;
|
|
16
|
+
createMany<AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv]>(input: ORM.CreateManyInput<Schema, AppEnv, AppTable>): Promise<ORM.CreateManyOutput>;
|
|
17
|
+
delete<AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv]>(input: ORM.DeleteInput<Schema, AppEnv, AppTable>): Promise<ORM.DeleteOutput>;
|
|
18
|
+
deleteMany<AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv]>(input: ORM.DeleteManyInput<Schema, AppEnv, AppTable>): Promise<ORM.DeleteManyOutput>;
|
|
19
|
+
findFirst<AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv], Select extends ORM.DatabaseSelectArg<Schema[AppEnv][AppTable]>>(input: ORM.FindFirstInput<Schema, AppEnv, AppTable, Select>): Promise<ORM.FindFirstOutput<Schema, AppEnv, AppTable, Select>>;
|
|
20
|
+
findMany<AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv], Select extends ORM.DatabaseSelectArg<Schema[AppEnv][AppTable]>>(input: ORM.FindManyInput<Schema, AppEnv, AppTable, Select>): Promise<ORM.FindManyOutput<Schema, AppEnv, AppTable, Select>>;
|
|
21
|
+
update<AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv], Select extends ORM.DatabaseSelectArg<Schema[AppEnv][AppTable]>>(input: ORM.UpdateInput<Schema, AppEnv, AppTable, Select>): Promise<ORM.UpdateOutput<Schema, AppEnv, AppTable, Select>>;
|
|
22
|
+
updateMany<AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv]>(input: ORM.UpdateManyInput<Schema, AppEnv, AppTable>): Promise<ORM.UpdateManyOutput>;
|
|
7
23
|
}
|
|
@@ -2,9 +2,10 @@ import { type ApiClient } from '../client.js';
|
|
|
2
2
|
import type { DraftMail, Mail, NewMail, ReceivedMail, SecrecyClient, SentMail, WaitingReceivedMail } from '../index.js';
|
|
3
3
|
import { type KeyPair } from './types/index.js';
|
|
4
4
|
import { type ApiMail } from './types/mail.js';
|
|
5
|
-
|
|
5
|
+
import { type DatabaseSchema } from './types/orm/core.js';
|
|
6
|
+
export declare class SecrecyMailClient<Schema extends DatabaseSchema = DatabaseSchema> {
|
|
6
7
|
#private;
|
|
7
|
-
constructor(client: SecrecyClient
|
|
8
|
+
constructor(client: SecrecyClient<Schema>, keys: KeyPair, apiClient: ApiClient);
|
|
8
9
|
get({ id }: {
|
|
9
10
|
id: string;
|
|
10
11
|
}): Promise<Mail>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { SecrecyClient } from '../index.js';
|
|
2
2
|
import { type ApiClient } from '../client.js';
|
|
3
3
|
import { type KeyPair } from './types/index.js';
|
|
4
|
+
import { type DatabaseSchema } from './types/orm/core.js';
|
|
4
5
|
interface SuccessPayResponse<T> {
|
|
5
6
|
success: true;
|
|
6
7
|
data: T;
|
|
@@ -10,9 +11,9 @@ interface ErrorPayResponse {
|
|
|
10
11
|
error: string;
|
|
11
12
|
}
|
|
12
13
|
export type SecrecyPayResponse<T> = SuccessPayResponse<T> | ErrorPayResponse;
|
|
13
|
-
export declare class SecrecyPayClient {
|
|
14
|
+
export declare class SecrecyPayClient<Schema extends DatabaseSchema = DatabaseSchema> {
|
|
14
15
|
#private;
|
|
15
|
-
constructor(client: SecrecyClient
|
|
16
|
+
constructor(client: SecrecyClient<Schema>, _keys: KeyPair, _apiClient: ApiClient);
|
|
16
17
|
confirmPaymentIntent({ paymentIntentId, secrecyIdWhoCreatedPaymentIntent, secrecyIdWhoNeedToConfirmPaymentIntent, amount, currency, }: {
|
|
17
18
|
paymentIntentId: string;
|
|
18
19
|
secrecyIdWhoCreatedPaymentIntent: string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SecrecyClient, InfuraNetwork } from '../index.js';
|
|
2
2
|
import { type TransactionRequest } from 'ethers';
|
|
3
|
+
import { type DatabaseSchema } from './types/orm/core.js';
|
|
3
4
|
interface SuccessWalletResponse<T> {
|
|
4
5
|
success: true;
|
|
5
6
|
data: T;
|
|
@@ -9,9 +10,9 @@ interface ErrorWalletResponse {
|
|
|
9
10
|
error: string;
|
|
10
11
|
}
|
|
11
12
|
export type SecrecyWalletResponse<T> = SuccessWalletResponse<T> | ErrorWalletResponse;
|
|
12
|
-
export declare class SecrecyWalletClient {
|
|
13
|
+
export declare class SecrecyWalletClient<Schema extends DatabaseSchema = DatabaseSchema> {
|
|
13
14
|
#private;
|
|
14
|
-
constructor(client: SecrecyClient);
|
|
15
|
+
constructor(client: SecrecyClient<Schema>);
|
|
15
16
|
createTransaction({ network, tx, }: {
|
|
16
17
|
network?: InfuraNetwork;
|
|
17
18
|
tx: TransactionRequest;
|
|
@@ -3,6 +3,6 @@ import { type KeyPair } from '../types/index.js';
|
|
|
3
3
|
import { type ApiMail } from '../types/mail.js';
|
|
4
4
|
export declare function convertInternalMailToExternal({ client, mail, keyPair, }: {
|
|
5
5
|
mail: ApiMail;
|
|
6
|
-
client: SecrecyClient
|
|
6
|
+
client: SecrecyClient<any>;
|
|
7
7
|
keyPair: KeyPair;
|
|
8
8
|
}): Promise<Mail>;
|
|
@@ -8,17 +8,18 @@ import { SecrecyWalletClient } from './SecrecyWalletClient.js';
|
|
|
8
8
|
import { SecrecyPayClient } from './SecrecyPayClient.js';
|
|
9
9
|
import { type RouterInputs } from '../client.js';
|
|
10
10
|
import { type KeyPair } from './types/index.js';
|
|
11
|
+
import { type DatabaseSchema } from './types/orm/core.js';
|
|
11
12
|
export type NewMail = Pick<RouterInputs['mail']['createDraft'], 'body' | 'subject' | 'senderFiles' | 'recipients' | 'replyToId'>;
|
|
12
13
|
export type ProgressCallback = (progress: Progress) => Promise<void>;
|
|
13
14
|
export declare const encryptName: (name: string, nameKey: string) => Promise<string>;
|
|
14
|
-
export declare class SecrecyClient extends BaseClient {
|
|
15
|
+
export declare class SecrecyClient<Schema extends DatabaseSchema = DatabaseSchema> extends BaseClient {
|
|
15
16
|
#private;
|
|
16
|
-
cloud: SecrecyCloudClient
|
|
17
|
-
mail: SecrecyMailClient
|
|
18
|
-
app: SecrecyAppClient
|
|
19
|
-
db: SecrecyDbClient
|
|
20
|
-
wallet: SecrecyWalletClient
|
|
21
|
-
pay: SecrecyPayClient
|
|
17
|
+
cloud: SecrecyCloudClient<Schema>;
|
|
18
|
+
mail: SecrecyMailClient<Schema>;
|
|
19
|
+
app: SecrecyAppClient<Schema>;
|
|
20
|
+
db: SecrecyDbClient<Schema>;
|
|
21
|
+
wallet: SecrecyWalletClient<Schema>;
|
|
22
|
+
pay: SecrecyPayClient<Schema>;
|
|
22
23
|
constructor(uaSession: string, uaKeys: KeyPair, uaJwt: string);
|
|
23
24
|
get publicKey(): string;
|
|
24
25
|
logout(sessionId?: string | null | undefined): Promise<void>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
interface DatabaseTableIdentifier<Schema extends DatabaseSchema, AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv]> {
|
|
2
|
+
appId: string;
|
|
3
|
+
appEnv: AppEnv;
|
|
4
|
+
appTable: AppTable;
|
|
5
|
+
}
|
|
6
|
+
export type DatabaseRequestInput<Schema extends DatabaseSchema, AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv], T> = DatabaseTableIdentifier<Schema, AppEnv, AppTable> & T;
|
|
7
|
+
export interface DatabaseCountResponse {
|
|
8
|
+
count: number;
|
|
9
|
+
}
|
|
10
|
+
export type DatabasePrimitiveFieldType = 'string' | 'number' | 'boolean';
|
|
11
|
+
export type DatabaseFieldType = DatabasePrimitiveFieldType | 'object';
|
|
12
|
+
export interface DatabaseFieldSchema {
|
|
13
|
+
type: DatabaseFieldType;
|
|
14
|
+
isArray?: boolean;
|
|
15
|
+
isKey?: boolean;
|
|
16
|
+
isNullable?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export type DatabaseTableSchema = Record<string, DatabaseFieldSchema>;
|
|
19
|
+
export type DatabaseEnvironmentSchema = Record<string, DatabaseTableSchema>;
|
|
20
|
+
export type DatabaseSchema = Record<string, DatabaseEnvironmentSchema>;
|
|
21
|
+
export type DataTypeIsArray<F extends DatabaseFieldSchema, T> = F['isArray'] extends true ? T[] : T;
|
|
22
|
+
export type DataTypeIsNullable<F extends DatabaseFieldSchema, T> = F['isNullable'] extends true ? T | null : T;
|
|
23
|
+
export type GetFieldType<Field extends DatabaseFieldSchema> = Field['type'] extends 'string' ? string : Field['type'] extends 'number' ? number : Field['type'] extends 'boolean' ? boolean : Field['type'] extends 'object' ? object : never;
|
|
24
|
+
export type GetDataType<Field extends DatabaseFieldSchema> = DataTypeIsNullable<Field, DataTypeIsArray<Field, GetFieldType<Field>>>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type DatabasePrimitiveFieldType, type DatabaseTableSchema } from '../core';
|
|
2
|
+
type DatabaseOrderByArgKeyword = 'asc' | 'desc';
|
|
3
|
+
export type DatabaseOrderByArg<Table extends DatabaseTableSchema> = {
|
|
4
|
+
[Key in keyof Table]: Table[Key]['type'] extends DatabasePrimitiveFieldType ? DatabaseOrderByArgKeyword : never;
|
|
5
|
+
};
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type GetDataType, type DatabaseTableSchema } from '../core';
|
|
2
|
+
export type DatabaseSelectArg<Table extends DatabaseTableSchema> = {
|
|
3
|
+
[Key in keyof Table]?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export type DatabaseSelectResponse<Table extends DatabaseTableSchema, Select extends DatabaseSelectArg<Table>> = {
|
|
6
|
+
[Key in keyof Select as Select[Key] extends true ? Key : never]: Key extends keyof Table ? GetDataType<Table[Key]> : never;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type DatabaseSkipArg = number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type DatabaseTakeArg = number;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type GetFieldType, type DatabaseFieldSchema, type DatabaseTableSchema } from '../core';
|
|
2
|
+
type WhereConditionnalKeyword = 'AND' | 'OR';
|
|
3
|
+
type WhereNumberComparatorKeyword = 'eq' | 'gt' | 'gte' | 'lt' | 'lte';
|
|
4
|
+
type WhereNumberComparatorPipe<T> = T | Partial<Record<WhereNumberComparatorKeyword, number>>;
|
|
5
|
+
type WhereIsArrayPipe<T, Field extends DatabaseFieldSchema> = Field['isArray'] extends true ? T[] : T;
|
|
6
|
+
type WhereIsNullablePipe<T, Field extends DatabaseFieldSchema> = Field['isNullable'] extends true ? T | null : T;
|
|
7
|
+
type WhereIsNotKeywordPipe<T> = T | {
|
|
8
|
+
isNot: T;
|
|
9
|
+
};
|
|
10
|
+
type WhereStringContainsKeywordPipe<T> = T | {
|
|
11
|
+
contains: string;
|
|
12
|
+
};
|
|
13
|
+
type DatabaseWhereStringHandler<Field extends DatabaseFieldSchema> = WhereIsNotKeywordPipe<WhereStringContainsKeywordPipe<WhereIsNullablePipe<WhereIsArrayPipe<GetFieldType<Field>, Field>, Field>>>;
|
|
14
|
+
type DatabaseWhereNumberHandler<Field extends DatabaseFieldSchema> = WhereIsNotKeywordPipe<WhereNumberComparatorPipe<WhereIsNullablePipe<WhereIsArrayPipe<GetFieldType<Field>, Field>, Field>>>;
|
|
15
|
+
type DatabaseWhereBooleanHandler<Field extends DatabaseFieldSchema> = WhereIsNotKeywordPipe<WhereIsNullablePipe<WhereIsArrayPipe<GetFieldType<Field>, Field>, Field>>;
|
|
16
|
+
type DatabaseWhereObjectHandler<Field extends DatabaseFieldSchema> = WhereIsNullablePipe<WhereIsArrayPipe<GetFieldType<Field>, Field>, Field>;
|
|
17
|
+
type DatabaseWhereArgType<Field extends DatabaseFieldSchema> = Field['type'] extends 'string' ? DatabaseWhereStringHandler<Field> : Field['type'] extends 'number' ? DatabaseWhereNumberHandler<Field> : Field['type'] extends 'boolean' ? DatabaseWhereBooleanHandler<Field> : Field['type'] extends 'object' ? DatabaseWhereObjectHandler<Field> : never;
|
|
18
|
+
export type DatabaseWhereArg<Table extends DatabaseTableSchema, IsRoot = true> = {
|
|
19
|
+
[Key in IsRoot extends true ? keyof Table | WhereConditionnalKeyword : keyof Table]?: Key extends WhereConditionnalKeyword ? Array<DatabaseWhereArg<Table, false>> : DatabaseWhereArgType<Table[Key]>;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { type DatabaseSchema, type DatabaseCountResponse, type DatabaseRequestInput, type DatabaseTableSchema } from './core';
|
|
2
|
+
import { type DatabaseDataArg } from './keywords/data';
|
|
3
|
+
import { type DatabaseOrderByArg } from './keywords/order-by';
|
|
4
|
+
import { type DatabaseSelectResponse, type DatabaseSelectArg } from './keywords/select';
|
|
5
|
+
import { type DatabaseSkipArg } from './keywords/skip';
|
|
6
|
+
import { type DatabaseTakeArg } from './keywords/take';
|
|
7
|
+
import { type DatabaseWhereArg } from './keywords/where';
|
|
8
|
+
interface CreateArgs<Table extends DatabaseTableSchema> {
|
|
9
|
+
data: DatabaseDataArg<Table>;
|
|
10
|
+
}
|
|
11
|
+
export type CreateInput<Schema extends DatabaseSchema, AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv]> = DatabaseRequestInput<Schema, AppEnv, AppTable, CreateArgs<Schema[AppEnv][AppTable]>>;
|
|
12
|
+
export type CreateOutput<Schema extends DatabaseSchema, AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv]> = Schema[AppEnv][AppTable];
|
|
13
|
+
interface CreateManyArgs<Table extends DatabaseTableSchema> {
|
|
14
|
+
data: Array<DatabaseDataArg<Table>>;
|
|
15
|
+
}
|
|
16
|
+
export type CreateManyInput<Schema extends DatabaseSchema, AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv]> = DatabaseRequestInput<Schema, AppEnv, AppTable, CreateManyArgs<Schema[AppEnv][AppTable]>>;
|
|
17
|
+
export type CreateManyOutput = DatabaseCountResponse;
|
|
18
|
+
interface DeleteArgs<Table extends DatabaseTableSchema> {
|
|
19
|
+
where: DatabaseWhereArg<Table>;
|
|
20
|
+
}
|
|
21
|
+
export type DeleteInput<Schema extends DatabaseSchema, AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv]> = DatabaseRequestInput<Schema, AppEnv, AppTable, DeleteArgs<Schema[AppEnv][AppTable]>>;
|
|
22
|
+
export type DeleteOutput = DatabaseCountResponse;
|
|
23
|
+
interface DeleteManyArgs<Table extends DatabaseTableSchema> {
|
|
24
|
+
where?: DatabaseWhereArg<Table>;
|
|
25
|
+
}
|
|
26
|
+
export type DeleteManyInput<Schema extends DatabaseSchema, AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv]> = DatabaseRequestInput<Schema, AppEnv, AppTable, DeleteManyArgs<Schema[AppEnv][AppTable]>>;
|
|
27
|
+
export type DeleteManyOutput = DatabaseCountResponse;
|
|
28
|
+
interface FindFirstArgs<Table extends DatabaseTableSchema, Select extends DatabaseSelectArg<Table>> {
|
|
29
|
+
where: DatabaseWhereArg<Table>;
|
|
30
|
+
select?: Select;
|
|
31
|
+
}
|
|
32
|
+
export type FindFirstInput<Schema extends DatabaseSchema, AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv], Select extends DatabaseSelectArg<Schema[AppEnv][AppTable]>> = DatabaseRequestInput<Schema, AppEnv, AppTable, FindFirstArgs<Schema[AppEnv][AppTable], Select>>;
|
|
33
|
+
export type FindFirstOutput<Schema extends DatabaseSchema, AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv], Select extends DatabaseSelectArg<Schema[AppEnv][AppTable]>> = DatabaseSelectResponse<Schema[AppEnv][AppTable], Select>;
|
|
34
|
+
interface FindManyArgs<Table extends DatabaseTableSchema, Select extends DatabaseSelectArg<Table>> {
|
|
35
|
+
where?: DatabaseWhereArg<Table>;
|
|
36
|
+
select?: Select;
|
|
37
|
+
take?: DatabaseTakeArg;
|
|
38
|
+
skip?: DatabaseSkipArg;
|
|
39
|
+
orderBy?: DatabaseOrderByArg<Table>;
|
|
40
|
+
}
|
|
41
|
+
export type FindManyInput<Schema extends DatabaseSchema, AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv], Select extends DatabaseSelectArg<Schema[AppEnv][AppTable]>> = DatabaseRequestInput<Schema, AppEnv, AppTable, FindManyArgs<Schema[AppEnv][AppTable], Select>>;
|
|
42
|
+
export type FindManyOutput<Schema extends DatabaseSchema, AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv], Select extends DatabaseSelectArg<Schema[AppEnv][AppTable]>> = Array<DatabaseSelectResponse<Schema[AppEnv][AppTable], Select>>;
|
|
43
|
+
interface UpdateArgs<Table extends DatabaseTableSchema, Select extends DatabaseSelectArg<Table>> {
|
|
44
|
+
data: DatabaseDataArg<Table>;
|
|
45
|
+
where: DatabaseWhereArg<Table>;
|
|
46
|
+
select?: Select;
|
|
47
|
+
}
|
|
48
|
+
export type UpdateInput<Schema extends DatabaseSchema, AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv], Select extends DatabaseSelectArg<Schema[AppEnv][AppTable]>> = DatabaseRequestInput<Schema, AppEnv, AppTable, UpdateArgs<Schema[AppEnv][AppTable], Select>>;
|
|
49
|
+
export type UpdateOutput<Schema extends DatabaseSchema, AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv], Select extends DatabaseSelectArg<Schema[AppEnv][AppTable]>> = DatabaseSelectResponse<Schema[AppEnv][AppTable], Select>;
|
|
50
|
+
interface UpdateManyArgs<Table extends DatabaseTableSchema> {
|
|
51
|
+
data: DatabaseDataArg<Table>;
|
|
52
|
+
where?: DatabaseWhereArg<Table>;
|
|
53
|
+
}
|
|
54
|
+
export type UpdateManyInput<Schema extends DatabaseSchema, AppEnv extends keyof Schema, AppTable extends keyof Schema[AppEnv]> = DatabaseRequestInput<Schema, AppEnv, AppTable, UpdateManyArgs<Schema[AppEnv][AppTable]>>;
|
|
55
|
+
export type UpdateManyOutput = DatabaseCountResponse;
|
|
56
|
+
export {};
|
package/dist/types/client.d.ts
CHANGED
|
@@ -5331,7 +5331,7 @@ export declare const createTRPCClient: (session?: string | null | undefined) =>
|
|
|
5331
5331
|
appId?: string | undefined;
|
|
5332
5332
|
} & {
|
|
5333
5333
|
where: Record<string, unknown>;
|
|
5334
|
-
select?: Record<string, boolean> | undefined;
|
|
5334
|
+
select?: Record<string, boolean | undefined> | undefined;
|
|
5335
5335
|
};
|
|
5336
5336
|
_input_out: {
|
|
5337
5337
|
appEnv: string;
|
|
@@ -5339,7 +5339,7 @@ export declare const createTRPCClient: (session?: string | null | undefined) =>
|
|
|
5339
5339
|
appId?: string | undefined;
|
|
5340
5340
|
} & {
|
|
5341
5341
|
where: Record<string, unknown>;
|
|
5342
|
-
select?: Record<string, boolean> | undefined;
|
|
5342
|
+
select?: Record<string, boolean | undefined> | undefined;
|
|
5343
5343
|
};
|
|
5344
5344
|
_output_in: Record<string, unknown> | null;
|
|
5345
5345
|
_output_out: Record<string, unknown> | null;
|
|
@@ -5374,7 +5374,7 @@ export declare const createTRPCClient: (session?: string | null | undefined) =>
|
|
|
5374
5374
|
appTable: string;
|
|
5375
5375
|
appId?: string | undefined;
|
|
5376
5376
|
} & {
|
|
5377
|
-
select?: Record<string, boolean> | undefined;
|
|
5377
|
+
select?: Record<string, boolean | undefined> | undefined;
|
|
5378
5378
|
where?: Record<string, unknown> | undefined;
|
|
5379
5379
|
take?: number | undefined;
|
|
5380
5380
|
skip?: number | undefined;
|
|
@@ -5385,7 +5385,7 @@ export declare const createTRPCClient: (session?: string | null | undefined) =>
|
|
|
5385
5385
|
appTable: string;
|
|
5386
5386
|
appId?: string | undefined;
|
|
5387
5387
|
} & {
|
|
5388
|
-
select?: Record<string, boolean> | undefined;
|
|
5388
|
+
select?: Record<string, boolean | undefined> | undefined;
|
|
5389
5389
|
where?: Record<string, unknown> | undefined;
|
|
5390
5390
|
take?: number | undefined;
|
|
5391
5391
|
skip?: number | undefined;
|
|
@@ -5426,7 +5426,7 @@ export declare const createTRPCClient: (session?: string | null | undefined) =>
|
|
|
5426
5426
|
} & {
|
|
5427
5427
|
where: Record<string, unknown>;
|
|
5428
5428
|
data: Record<string, unknown>;
|
|
5429
|
-
select?: Record<string, boolean> | undefined;
|
|
5429
|
+
select?: Record<string, boolean | undefined> | undefined;
|
|
5430
5430
|
};
|
|
5431
5431
|
_input_out: {
|
|
5432
5432
|
appEnv: string;
|
|
@@ -5435,7 +5435,7 @@ export declare const createTRPCClient: (session?: string | null | undefined) =>
|
|
|
5435
5435
|
} & {
|
|
5436
5436
|
where: Record<string, unknown>;
|
|
5437
5437
|
data: Record<string, unknown>;
|
|
5438
|
-
select?: Record<string, boolean> | undefined;
|
|
5438
|
+
select?: Record<string, boolean | undefined> | undefined;
|
|
5439
5439
|
};
|
|
5440
5440
|
_output_in: Record<string, unknown>;
|
|
5441
5441
|
_output_out: Record<string, unknown>;
|
|
@@ -5471,7 +5471,7 @@ export declare const createTRPCClient: (session?: string | null | undefined) =>
|
|
|
5471
5471
|
appId?: string | undefined;
|
|
5472
5472
|
} & {
|
|
5473
5473
|
data: Record<string, unknown>;
|
|
5474
|
-
select?: Record<string, boolean> | undefined;
|
|
5474
|
+
select?: Record<string, boolean | undefined> | undefined;
|
|
5475
5475
|
where?: Record<string, unknown> | undefined;
|
|
5476
5476
|
take?: number | undefined;
|
|
5477
5477
|
skip?: number | undefined;
|
|
@@ -5483,7 +5483,7 @@ export declare const createTRPCClient: (session?: string | null | undefined) =>
|
|
|
5483
5483
|
appId?: string | undefined;
|
|
5484
5484
|
} & {
|
|
5485
5485
|
data: Record<string, unknown>;
|
|
5486
|
-
select?: Record<string, boolean> | undefined;
|
|
5486
|
+
select?: Record<string, boolean | undefined> | undefined;
|
|
5487
5487
|
where?: Record<string, unknown> | undefined;
|
|
5488
5488
|
take?: number | undefined;
|
|
5489
5489
|
skip?: number | undefined;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@secrecy/lib",
|
|
3
3
|
"author": "Anonymize <anonymize@gmail.com>",
|
|
4
4
|
"description": "Anonymize Secrecy Library",
|
|
5
|
-
"version": "1.7.0-integration-trpc-client.
|
|
5
|
+
"version": "1.7.0-integration-trpc-client.13",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "https://github.com/anonymize-org/lib.git"
|
|
@@ -45,8 +45,6 @@
|
|
|
45
45
|
"prepublish": "bun run build",
|
|
46
46
|
"typecheck": "tsc --noEmit",
|
|
47
47
|
"build": "tsc -p tsconfig.build.json",
|
|
48
|
-
"build:bun": "bun build ./src/index.ts --outdir ./dist --target browser",
|
|
49
|
-
"build:types": "tsc src/index.ts --noEmit false --emitDeclarationOnly --declaration --outDir dist --rootDir src --target esnext --moduleResolution bundler --skipLibCheck",
|
|
50
48
|
"prepare": "husky install",
|
|
51
49
|
"semantic-release": "semantic-release"
|
|
52
50
|
},
|
|
@@ -76,7 +74,7 @@
|
|
|
76
74
|
},
|
|
77
75
|
"dependencies": {
|
|
78
76
|
"@secrecy/lib-utils": "^1.0.18",
|
|
79
|
-
"@secrecy/trpc-api-types": "1.6.0-integration-prisma-selectors.
|
|
77
|
+
"@secrecy/trpc-api-types": "1.6.0-integration-prisma-selectors.23",
|
|
80
78
|
"@trpc/client": "^10.45.0",
|
|
81
79
|
"@trpc/server": "^10.45.0",
|
|
82
80
|
"@types/libsodium-wrappers-sumo": "^0.7.6",
|