auth-vir 1.3.2 → 2.0.1
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/README.md +27 -18
- package/dist/auth-client/backend-auth.client.d.ts +177 -0
- package/dist/auth-client/backend-auth.client.js +232 -0
- package/dist/auth-client/frontend-auth.client.d.ts +65 -0
- package/dist/auth-client/frontend-auth.client.js +108 -0
- package/dist/auth.d.ts +32 -46
- package/dist/auth.js +36 -36
- package/dist/cookie.d.ts +15 -4
- package/dist/cookie.js +16 -4
- package/dist/csrf-token.d.ts +113 -3
- package/dist/csrf-token.js +101 -5
- package/dist/generated/browser.d.ts +9 -0
- package/dist/generated/browser.js +16 -0
- package/dist/generated/client.d.ts +26 -0
- package/dist/generated/client.js +31 -0
- package/dist/generated/commonInputTypes.d.ts +122 -0
- package/dist/generated/commonInputTypes.js +1 -0
- package/dist/generated/enums.d.ts +1 -0
- package/dist/generated/enums.js +9 -0
- package/dist/generated/internal/class.d.ts +126 -0
- package/dist/generated/internal/class.js +84 -0
- package/dist/generated/internal/prismaNamespace.d.ts +544 -0
- package/dist/generated/internal/prismaNamespace.js +101 -0
- package/dist/generated/internal/prismaNamespaceBrowser.d.ts +75 -0
- package/dist/generated/internal/prismaNamespaceBrowser.js +69 -0
- package/dist/generated/models/User.d.ts +983 -0
- package/dist/generated/models/User.js +1 -0
- package/dist/generated/models.d.ts +2 -0
- package/dist/generated/models.js +1 -0
- package/dist/generated/shapes.gen.d.ts +8 -0
- package/dist/generated/shapes.gen.js +11 -0
- package/dist/headers.d.ts +20 -0
- package/dist/headers.js +33 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/jwt/jwt.d.ts +11 -2
- package/dist/jwt/jwt.js +14 -3
- package/dist/jwt/user-jwt.d.ts +8 -8
- package/dist/jwt/user-jwt.js +12 -9
- package/package.json +12 -7
- package/src/auth-client/backend-auth.client.ts +500 -0
- package/src/auth-client/frontend-auth.client.ts +183 -0
- package/src/auth.ts +99 -77
- package/src/cookie.ts +20 -8
- package/src/csrf-token.ts +196 -5
- package/src/generated/browser.ts +23 -0
- package/src/generated/client.ts +47 -0
- package/src/generated/commonInputTypes.ts +147 -0
- package/src/generated/enums.ts +14 -0
- package/src/generated/internal/class.ts +236 -0
- package/src/generated/internal/prismaNamespace.ts +761 -0
- package/src/generated/internal/prismaNamespaceBrowser.ts +102 -0
- package/src/generated/models/User.ts +1135 -0
- package/src/generated/models.ts +11 -0
- package/src/generated/shapes.gen.ts +15 -0
- package/src/headers.ts +35 -0
- package/src/index.ts +3 -0
- package/src/jwt/jwt.ts +34 -5
- package/src/jwt/user-jwt.ts +21 -12
package/dist/csrf-token.js
CHANGED
|
@@ -1,15 +1,111 @@
|
|
|
1
|
-
import { randomString } from '@augment-vir/common';
|
|
1
|
+
import { randomString, wrapInTry, } from '@augment-vir/common';
|
|
2
|
+
import { calculateRelativeDate, fullDateShape, getNowInUtcTimezone, isDateAfter, } from 'date-vir';
|
|
3
|
+
import { defineShape, parseJsonWithShape } from 'object-shape-tester';
|
|
4
|
+
import { AuthHeaderName } from './headers.js';
|
|
2
5
|
/**
|
|
3
|
-
*
|
|
6
|
+
* Shape definition for {@link CsrfToken}.
|
|
4
7
|
*
|
|
5
8
|
* @category Internal
|
|
6
9
|
*/
|
|
7
|
-
export const
|
|
10
|
+
export const csrfTokenShape = defineShape({
|
|
11
|
+
token: '',
|
|
12
|
+
expiration: fullDateShape,
|
|
13
|
+
});
|
|
8
14
|
/**
|
|
9
15
|
* Generates a random, cryptographically secure CSRF token.
|
|
10
16
|
*
|
|
11
17
|
* @category Internal
|
|
12
18
|
*/
|
|
13
|
-
export function generateCsrfToken(
|
|
14
|
-
|
|
19
|
+
export function generateCsrfToken(
|
|
20
|
+
/** How long the CSRF token is valid for. */
|
|
21
|
+
duration) {
|
|
22
|
+
return {
|
|
23
|
+
token: randomString(256),
|
|
24
|
+
expiration: calculateRelativeDate(getNowInUtcTimezone(), duration),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* CSRF token failure reasons for {@link GetCsrfTokenResult}.
|
|
29
|
+
*
|
|
30
|
+
* @category Internal
|
|
31
|
+
*/
|
|
32
|
+
export var CsrfTokenFailureReason;
|
|
33
|
+
(function (CsrfTokenFailureReason) {
|
|
34
|
+
/** No CSRF token was found. */
|
|
35
|
+
CsrfTokenFailureReason["DoesNotExist"] = "does-not-exist";
|
|
36
|
+
/** A CSRF token was found but parsing it failed. */
|
|
37
|
+
CsrfTokenFailureReason["ParseFailed"] = "parse-failed";
|
|
38
|
+
/** A CSRF token was found and parsed but is expired. */
|
|
39
|
+
CsrfTokenFailureReason["Expired"] = "expired";
|
|
40
|
+
})(CsrfTokenFailureReason || (CsrfTokenFailureReason = {}));
|
|
41
|
+
/**
|
|
42
|
+
* Extract the CSRF token header from a response.
|
|
43
|
+
*
|
|
44
|
+
* @category Auth : Client
|
|
45
|
+
*/
|
|
46
|
+
export function extractCsrfTokenHeader(response, overrides = {}) {
|
|
47
|
+
const csrfTokenHeaderName = overrides.csrfHeaderName || AuthHeaderName.CsrfToken;
|
|
48
|
+
const rawCsrfToken = response.headers.get(csrfTokenHeaderName);
|
|
49
|
+
return parseCsrfToken(rawCsrfToken);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Stores the given CSRF token into local storage.
|
|
53
|
+
*
|
|
54
|
+
* @category Auth : Client
|
|
55
|
+
*/
|
|
56
|
+
export function storeCsrfToken(csrfToken, overrides = {}) {
|
|
57
|
+
(overrides.localStorage || globalThis.localStorage).setItem(overrides.csrfHeaderName || AuthHeaderName.CsrfToken, JSON.stringify(csrfToken));
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Parse a raw CSRF token JSON string.
|
|
61
|
+
*
|
|
62
|
+
* @category Internal
|
|
63
|
+
*/
|
|
64
|
+
export function parseCsrfToken(value) {
|
|
65
|
+
if (!value) {
|
|
66
|
+
return {
|
|
67
|
+
failure: CsrfTokenFailureReason.DoesNotExist,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const csrfToken = wrapInTry(() => parseJsonWithShape(value, csrfTokenShape, {
|
|
71
|
+
/** For forwards / backwards compatibility. */
|
|
72
|
+
allowExtraKeys: true,
|
|
73
|
+
}), {
|
|
74
|
+
fallbackValue: undefined,
|
|
75
|
+
});
|
|
76
|
+
if (!csrfToken) {
|
|
77
|
+
return {
|
|
78
|
+
failure: CsrfTokenFailureReason.ParseFailed,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (isDateAfter({
|
|
82
|
+
fullDate: getNowInUtcTimezone(),
|
|
83
|
+
relativeTo: csrfToken.expiration,
|
|
84
|
+
})) {
|
|
85
|
+
return {
|
|
86
|
+
failure: CsrfTokenFailureReason.Expired,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
return {
|
|
90
|
+
csrfToken,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Used in client (frontend) code to retrieve the current CSRF token in order to send it with
|
|
95
|
+
* requests to the host (backend).
|
|
96
|
+
*
|
|
97
|
+
* @category Auth : Client
|
|
98
|
+
*/
|
|
99
|
+
export function getCurrentCsrfToken(overrides = {}) {
|
|
100
|
+
const rawCsrfToken = (overrides.localStorage || globalThis.localStorage).getItem(overrides.csrfHeaderName || AuthHeaderName.CsrfToken) || undefined;
|
|
101
|
+
return parseCsrfToken(rawCsrfToken);
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Wipes the current stored CSRF token. This should be used by client (frontend) code to logout a
|
|
105
|
+
* user or react to a session timeout.
|
|
106
|
+
*
|
|
107
|
+
* @category Auth : Client
|
|
108
|
+
*/
|
|
109
|
+
export function wipeCurrentCsrfToken(overrides = {}) {
|
|
110
|
+
return (overrides.localStorage || globalThis.localStorage).removeItem(overrides.csrfHeaderName || AuthHeaderName.CsrfToken);
|
|
15
111
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
/*
|
|
5
|
+
* This file should be your main import to use Prisma-related types and utilities in a browser.
|
|
6
|
+
* Use it to get access to models, enums, and input types.
|
|
7
|
+
*
|
|
8
|
+
* This file does not contain a `PrismaClient` class, nor several other helpers that are intended as server-side only.
|
|
9
|
+
* See `client.ts` for the standard, server-side entry point.
|
|
10
|
+
*
|
|
11
|
+
* 🟢 You can import this file directly.
|
|
12
|
+
*/
|
|
13
|
+
import * as Prisma from './internal/prismaNamespaceBrowser.js';
|
|
14
|
+
export { Prisma };
|
|
15
|
+
export * as $Enums from './enums.js';
|
|
16
|
+
export * from './enums.js';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as runtime from "@prisma/client/runtime/client";
|
|
2
|
+
import * as $Class from "./internal/class.js";
|
|
3
|
+
import * as Prisma from "./internal/prismaNamespace.js";
|
|
4
|
+
export * as $Enums from './enums.js';
|
|
5
|
+
export * from "./enums.js";
|
|
6
|
+
/**
|
|
7
|
+
* ## Prisma Client
|
|
8
|
+
*
|
|
9
|
+
* Type-safe database client for TypeScript
|
|
10
|
+
* @example
|
|
11
|
+
* ```
|
|
12
|
+
* const prisma = new PrismaClient()
|
|
13
|
+
* // Fetch zero or more Users
|
|
14
|
+
* const users = await prisma.user.findMany()
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
|
|
18
|
+
*/
|
|
19
|
+
export declare const PrismaClient: $Class.PrismaClientConstructor;
|
|
20
|
+
export type PrismaClient<LogOpts extends Prisma.LogLevel = never, OmitOpts extends Prisma.PrismaClientOptions["omit"] = Prisma.PrismaClientOptions["omit"], ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> = $Class.PrismaClient<LogOpts, OmitOpts, ExtArgs>;
|
|
21
|
+
export { Prisma };
|
|
22
|
+
/**
|
|
23
|
+
* Model User
|
|
24
|
+
*
|
|
25
|
+
*/
|
|
26
|
+
export type User = Prisma.UserModel;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
/*
|
|
5
|
+
* This file should be your main import to use Prisma. Through it you get access to all the models, enums, and input types.
|
|
6
|
+
* If you're looking for something you can import in the client-side of your application, please refer to the `browser.ts` file instead.
|
|
7
|
+
*
|
|
8
|
+
* 🟢 You can import this file directly.
|
|
9
|
+
*/
|
|
10
|
+
import * as path from 'node:path';
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
12
|
+
globalThis['__dirname'] = path.dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
import * as $Class from "./internal/class.js";
|
|
14
|
+
import * as Prisma from "./internal/prismaNamespace.js";
|
|
15
|
+
export * as $Enums from './enums.js';
|
|
16
|
+
export * from "./enums.js";
|
|
17
|
+
/**
|
|
18
|
+
* ## Prisma Client
|
|
19
|
+
*
|
|
20
|
+
* Type-safe database client for TypeScript
|
|
21
|
+
* @example
|
|
22
|
+
* ```
|
|
23
|
+
* const prisma = new PrismaClient()
|
|
24
|
+
* // Fetch zero or more Users
|
|
25
|
+
* const users = await prisma.user.findMany()
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
|
|
29
|
+
*/
|
|
30
|
+
export const PrismaClient = $Class.getPrismaClientClass(__dirname);
|
|
31
|
+
export { Prisma };
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { type UtcIsoString } from 'date-vir';
|
|
2
|
+
import type * as runtime from "@prisma/client/runtime/client";
|
|
3
|
+
import type * as Prisma from "./internal/prismaNamespace.js";
|
|
4
|
+
export type StringFilter<$PrismaModel = never, FieldType = string> = {
|
|
5
|
+
equals?: FieldType | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
6
|
+
in?: FieldType[] | Prisma.ListStringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
7
|
+
notIn?: FieldType[] | Prisma.ListStringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
8
|
+
lt?: FieldType | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
9
|
+
lte?: FieldType | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
10
|
+
gt?: FieldType | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
11
|
+
gte?: FieldType | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
12
|
+
contains?: FieldType | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
13
|
+
startsWith?: FieldType | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
14
|
+
endsWith?: FieldType | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
15
|
+
mode?: Prisma.QueryMode | runtime.Types.Skip;
|
|
16
|
+
not?: Prisma.NestedStringFilter<$PrismaModel> | FieldType | runtime.Types.Skip;
|
|
17
|
+
};
|
|
18
|
+
export type DateTimeFilter<$PrismaModel = never> = {
|
|
19
|
+
equals?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
20
|
+
in?: UtcIsoString[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
21
|
+
notIn?: UtcIsoString[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
22
|
+
lt?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
23
|
+
lte?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
24
|
+
gt?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
25
|
+
gte?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
26
|
+
not?: Prisma.NestedDateTimeFilter<$PrismaModel> | UtcIsoString | runtime.Types.Skip;
|
|
27
|
+
};
|
|
28
|
+
export type StringWithAggregatesFilter<$PrismaModel = never, FieldType = string> = {
|
|
29
|
+
equals?: FieldType | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
30
|
+
in?: FieldType[] | Prisma.ListStringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
31
|
+
notIn?: FieldType[] | Prisma.ListStringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
32
|
+
lt?: FieldType | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
33
|
+
lte?: FieldType | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
34
|
+
gt?: FieldType | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
35
|
+
gte?: FieldType | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
36
|
+
contains?: FieldType | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
37
|
+
startsWith?: FieldType | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
38
|
+
endsWith?: FieldType | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
39
|
+
mode?: Prisma.QueryMode | runtime.Types.Skip;
|
|
40
|
+
not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | FieldType | runtime.Types.Skip;
|
|
41
|
+
_count?: Prisma.NestedIntFilter<$PrismaModel> | runtime.Types.Skip;
|
|
42
|
+
_min?: Prisma.NestedStringFilter<$PrismaModel> | runtime.Types.Skip;
|
|
43
|
+
_max?: Prisma.NestedStringFilter<$PrismaModel> | runtime.Types.Skip;
|
|
44
|
+
};
|
|
45
|
+
export type DateTimeWithAggregatesFilter<$PrismaModel = never> = {
|
|
46
|
+
equals?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
47
|
+
in?: UtcIsoString[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
48
|
+
notIn?: UtcIsoString[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
49
|
+
lt?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
50
|
+
lte?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
51
|
+
gt?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
52
|
+
gte?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
53
|
+
not?: Prisma.NestedDateTimeWithAggregatesFilter<$PrismaModel> | UtcIsoString | runtime.Types.Skip;
|
|
54
|
+
_count?: Prisma.NestedIntFilter<$PrismaModel> | runtime.Types.Skip;
|
|
55
|
+
_min?: Prisma.NestedDateTimeFilter<$PrismaModel> | runtime.Types.Skip;
|
|
56
|
+
_max?: Prisma.NestedDateTimeFilter<$PrismaModel> | runtime.Types.Skip;
|
|
57
|
+
};
|
|
58
|
+
export type NestedStringFilter<$PrismaModel = never> = {
|
|
59
|
+
equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
60
|
+
in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
61
|
+
notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
62
|
+
lt?: string | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
63
|
+
lte?: string | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
64
|
+
gt?: string | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
65
|
+
gte?: string | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
66
|
+
contains?: string | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
67
|
+
startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
68
|
+
endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
69
|
+
not?: Prisma.NestedStringFilter<$PrismaModel> | string | runtime.Types.Skip;
|
|
70
|
+
};
|
|
71
|
+
export type NestedDateTimeFilter<$PrismaModel = never> = {
|
|
72
|
+
equals?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
73
|
+
in?: UtcIsoString[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
74
|
+
notIn?: UtcIsoString[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
75
|
+
lt?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
76
|
+
lte?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
77
|
+
gt?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
78
|
+
gte?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
79
|
+
not?: Prisma.NestedDateTimeFilter<$PrismaModel> | UtcIsoString | runtime.Types.Skip;
|
|
80
|
+
};
|
|
81
|
+
export type NestedStringWithAggregatesFilter<$PrismaModel = never> = {
|
|
82
|
+
equals?: string | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
83
|
+
in?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
84
|
+
notIn?: string[] | Prisma.ListStringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
85
|
+
lt?: string | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
86
|
+
lte?: string | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
87
|
+
gt?: string | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
88
|
+
gte?: string | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
89
|
+
contains?: string | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
90
|
+
startsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
91
|
+
endsWith?: string | Prisma.StringFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
92
|
+
not?: Prisma.NestedStringWithAggregatesFilter<$PrismaModel> | string | runtime.Types.Skip;
|
|
93
|
+
_count?: Prisma.NestedIntFilter<$PrismaModel> | runtime.Types.Skip;
|
|
94
|
+
_min?: Prisma.NestedStringFilter<$PrismaModel> | runtime.Types.Skip;
|
|
95
|
+
_max?: Prisma.NestedStringFilter<$PrismaModel> | runtime.Types.Skip;
|
|
96
|
+
};
|
|
97
|
+
export type NestedIntFilter<$PrismaModel = never> = {
|
|
98
|
+
equals?: number | Prisma.IntFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
99
|
+
in?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
100
|
+
notIn?: number[] | Prisma.ListIntFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
101
|
+
lt?: number | Prisma.IntFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
102
|
+
lte?: number | Prisma.IntFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
103
|
+
gt?: number | Prisma.IntFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
104
|
+
gte?: number | Prisma.IntFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
105
|
+
not?: Prisma.NestedIntFilter<$PrismaModel> | number | runtime.Types.Skip;
|
|
106
|
+
};
|
|
107
|
+
export type NestedDateTimeWithAggregatesFilter<$PrismaModel = never> = {
|
|
108
|
+
equals?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
109
|
+
in?: UtcIsoString[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
110
|
+
notIn?: UtcIsoString[] | Prisma.ListDateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
111
|
+
lt?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
112
|
+
lte?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
113
|
+
gt?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
114
|
+
gte?: UtcIsoString | Prisma.DateTimeFieldRefInput<$PrismaModel> | runtime.Types.Skip;
|
|
115
|
+
not?: Prisma.NestedDateTimeWithAggregatesFilter<$PrismaModel> | UtcIsoString | runtime.Types.Skip;
|
|
116
|
+
_count?: Prisma.NestedIntFilter<$PrismaModel> | runtime.Types.Skip;
|
|
117
|
+
_min?: Prisma.NestedDateTimeFilter<$PrismaModel> | runtime.Types.Skip;
|
|
118
|
+
_max?: Prisma.NestedDateTimeFilter<$PrismaModel> | runtime.Types.Skip;
|
|
119
|
+
};
|
|
120
|
+
export type StringFieldUpdateOperationsInput<FieldType = string> = {
|
|
121
|
+
set?: FieldType | runtime.Types.Skip;
|
|
122
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import * as runtime from "@prisma/client/runtime/client";
|
|
2
|
+
import type * as Prisma from "./prismaNamespace.js";
|
|
3
|
+
export type LogOptions<ClientOptions extends Prisma.PrismaClientOptions> = 'log' extends keyof ClientOptions ? ClientOptions['log'] extends Array<Prisma.LogLevel | Prisma.LogDefinition> ? Prisma.GetEvents<ClientOptions['log']> : never : never;
|
|
4
|
+
export interface PrismaClientConstructor {
|
|
5
|
+
/**
|
|
6
|
+
* ## Prisma Client
|
|
7
|
+
*
|
|
8
|
+
* Type-safe database client for TypeScript
|
|
9
|
+
* @example
|
|
10
|
+
* ```
|
|
11
|
+
* const prisma = new PrismaClient()
|
|
12
|
+
* // Fetch zero or more Users
|
|
13
|
+
* const users = await prisma.user.findMany()
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
|
|
17
|
+
*/
|
|
18
|
+
new <Options extends Prisma.PrismaClientOptions = Prisma.PrismaClientOptions, LogOpts extends LogOptions<Options> = LogOptions<Options>, OmitOpts extends Prisma.PrismaClientOptions['omit'] = Options extends {
|
|
19
|
+
omit: infer U;
|
|
20
|
+
} ? U : Prisma.PrismaClientOptions['omit'], ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs>(options?: Prisma.Subset<Options, Prisma.PrismaClientOptions>): PrismaClient<LogOpts, OmitOpts, ExtArgs>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* ## Prisma Client
|
|
24
|
+
*
|
|
25
|
+
* Type-safe database client for TypeScript
|
|
26
|
+
* @example
|
|
27
|
+
* ```
|
|
28
|
+
* const prisma = new PrismaClient()
|
|
29
|
+
* // Fetch zero or more Users
|
|
30
|
+
* const users = await prisma.user.findMany()
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client).
|
|
34
|
+
*/
|
|
35
|
+
export interface PrismaClient<in LogOpts extends Prisma.LogLevel = never, in out OmitOpts extends Prisma.PrismaClientOptions['omit'] = Prisma.PrismaClientOptions['omit'], in out ExtArgs extends runtime.Types.Extensions.InternalArgs = runtime.Types.Extensions.DefaultArgs> {
|
|
36
|
+
[K: symbol]: {
|
|
37
|
+
types: Prisma.TypeMap<ExtArgs>['other'];
|
|
38
|
+
};
|
|
39
|
+
$on<V extends LogOpts>(eventType: V, callback: (event: V extends 'query' ? Prisma.QueryEvent : Prisma.LogEvent) => void): PrismaClient;
|
|
40
|
+
/**
|
|
41
|
+
* Connect with the database
|
|
42
|
+
*/
|
|
43
|
+
$connect(): runtime.Types.Utils.JsPromise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Disconnect from the database
|
|
46
|
+
*/
|
|
47
|
+
$disconnect(): runtime.Types.Utils.JsPromise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Executes a prepared raw query and returns the number of affected rows.
|
|
50
|
+
* @example
|
|
51
|
+
* ```
|
|
52
|
+
* const result = await prisma.$executeRaw`UPDATE User SET cool = ${true} WHERE email = ${'user@email.com'};`
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
|
|
56
|
+
*/
|
|
57
|
+
$executeRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<number>;
|
|
58
|
+
/**
|
|
59
|
+
* Executes a raw query and returns the number of affected rows.
|
|
60
|
+
* Susceptible to SQL injections, see documentation.
|
|
61
|
+
* @example
|
|
62
|
+
* ```
|
|
63
|
+
* const result = await prisma.$executeRawUnsafe('UPDATE User SET cool = $1 WHERE email = $2 ;', true, 'user@email.com')
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
|
|
67
|
+
*/
|
|
68
|
+
$executeRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<number>;
|
|
69
|
+
/**
|
|
70
|
+
* Performs a prepared raw query and returns the `SELECT` data.
|
|
71
|
+
* @example
|
|
72
|
+
* ```
|
|
73
|
+
* const result = await prisma.$queryRaw`SELECT * FROM User WHERE id = ${1} OR email = ${'user@email.com'};`
|
|
74
|
+
* ```
|
|
75
|
+
*
|
|
76
|
+
* Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
|
|
77
|
+
*/
|
|
78
|
+
$queryRaw<T = unknown>(query: TemplateStringsArray | Prisma.Sql, ...values: any[]): Prisma.PrismaPromise<T>;
|
|
79
|
+
/**
|
|
80
|
+
* Performs a raw query and returns the `SELECT` data.
|
|
81
|
+
* Susceptible to SQL injections, see documentation.
|
|
82
|
+
* @example
|
|
83
|
+
* ```
|
|
84
|
+
* const result = await prisma.$queryRawUnsafe('SELECT * FROM User WHERE id = $1 OR email = $2;', 1, 'user@email.com')
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* Read more in our [docs](https://www.prisma.io/docs/reference/tools-and-interfaces/prisma-client/raw-database-access).
|
|
88
|
+
*/
|
|
89
|
+
$queryRawUnsafe<T = unknown>(query: string, ...values: any[]): Prisma.PrismaPromise<T>;
|
|
90
|
+
/**
|
|
91
|
+
* Allows the running of a sequence of read/write operations that are guaranteed to either succeed or fail as a whole.
|
|
92
|
+
* @example
|
|
93
|
+
* ```
|
|
94
|
+
* const [george, bob, alice] = await prisma.$transaction([
|
|
95
|
+
* prisma.user.create({ data: { name: 'George' } }),
|
|
96
|
+
* prisma.user.create({ data: { name: 'Bob' } }),
|
|
97
|
+
* prisma.user.create({ data: { name: 'Alice' } }),
|
|
98
|
+
* ])
|
|
99
|
+
* ```
|
|
100
|
+
*
|
|
101
|
+
* Read more in our [docs](https://www.prisma.io/docs/concepts/components/prisma-client/transactions).
|
|
102
|
+
*/
|
|
103
|
+
$transaction<P extends Prisma.PrismaPromise<any>[]>(arg: [...P], options?: {
|
|
104
|
+
isolationLevel?: Prisma.TransactionIsolationLevel;
|
|
105
|
+
}): runtime.Types.Utils.JsPromise<runtime.Types.Utils.UnwrapTuple<P>>;
|
|
106
|
+
$transaction<R>(fn: (prisma: Omit<PrismaClient, runtime.ITXClientDenyList>) => runtime.Types.Utils.JsPromise<R>, options?: {
|
|
107
|
+
maxWait?: number;
|
|
108
|
+
timeout?: number;
|
|
109
|
+
isolationLevel?: Prisma.TransactionIsolationLevel;
|
|
110
|
+
}): runtime.Types.Utils.JsPromise<R>;
|
|
111
|
+
$extends: runtime.Types.Extensions.ExtendsHook<"extends", Prisma.TypeMapCb<OmitOpts>, ExtArgs, runtime.Types.Utils.Call<Prisma.TypeMapCb<OmitOpts>, {
|
|
112
|
+
extArgs: ExtArgs;
|
|
113
|
+
}>>;
|
|
114
|
+
/**
|
|
115
|
+
* `prisma.user`: Exposes CRUD operations for the **User** model.
|
|
116
|
+
* Example usage:
|
|
117
|
+
* ```ts
|
|
118
|
+
* // Fetch zero or more Users
|
|
119
|
+
* const users = await prisma.user.findMany()
|
|
120
|
+
* ```
|
|
121
|
+
*/
|
|
122
|
+
get user(): Prisma.UserDelegate<ExtArgs, {
|
|
123
|
+
omit: OmitOpts;
|
|
124
|
+
}>;
|
|
125
|
+
}
|
|
126
|
+
export declare function getPrismaClientClass(dirname: string): PrismaClientConstructor;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/* !!! This is code generated by Prisma. Do not edit directly. !!! */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// @ts-nocheck
|
|
4
|
+
/*
|
|
5
|
+
* WARNING: This is an internal file that is subject to change!
|
|
6
|
+
*
|
|
7
|
+
* 🛑 Under no circumstances should you import this file directly! 🛑
|
|
8
|
+
*
|
|
9
|
+
* Please import the `PrismaClient` class from the `client.ts` file instead.
|
|
10
|
+
*/
|
|
11
|
+
import * as runtime from "@prisma/client/runtime/client";
|
|
12
|
+
const config = {
|
|
13
|
+
"generator": {
|
|
14
|
+
"name": "jsClient",
|
|
15
|
+
"provider": {
|
|
16
|
+
"fromEnvVar": null,
|
|
17
|
+
"value": "prisma-client"
|
|
18
|
+
},
|
|
19
|
+
"output": {
|
|
20
|
+
"value": "/Users/electrovir/repos/electrovir/auth-vir/packages/auth-vir/src/generated",
|
|
21
|
+
"fromEnvVar": null
|
|
22
|
+
},
|
|
23
|
+
"config": {
|
|
24
|
+
"engineType": "client",
|
|
25
|
+
"moduleFormat": "esm"
|
|
26
|
+
},
|
|
27
|
+
"binaryTargets": [
|
|
28
|
+
{
|
|
29
|
+
"fromEnvVar": null,
|
|
30
|
+
"value": "darwin-arm64",
|
|
31
|
+
"native": true
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"previewFeatures": [
|
|
35
|
+
"relationJoins",
|
|
36
|
+
"strictUndefinedChecks"
|
|
37
|
+
],
|
|
38
|
+
"sourceFilePath": "/Users/electrovir/repos/electrovir/auth-vir/packages/auth-vir/test-files/schema.prisma",
|
|
39
|
+
"isCustomOutput": true
|
|
40
|
+
},
|
|
41
|
+
"relativePath": "../../test-files",
|
|
42
|
+
"clientVersion": "6.17.1",
|
|
43
|
+
"engineVersion": "272a37d34178c2894197e17273bf937f25acdeac",
|
|
44
|
+
"datasourceNames": [
|
|
45
|
+
"db"
|
|
46
|
+
],
|
|
47
|
+
"activeProvider": "postgresql",
|
|
48
|
+
"postinstall": false,
|
|
49
|
+
"inlineDatasources": {
|
|
50
|
+
"db": {
|
|
51
|
+
"url": {
|
|
52
|
+
"fromEnvVar": "DATABASE_URL",
|
|
53
|
+
"value": null
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"inlineSchema": "generator jsClient {\n provider = \"prisma-client\"\n previewFeatures = [\"strictUndefinedChecks\", \"relationJoins\"]\n output = \"../src/generated\"\n engineType = \"client\"\n moduleFormat = \"esm\"\n}\n\ngenerator shapes {\n provider = \"prisma-shapes\"\n output = \"../src/generated\"\n}\n\ngenerator stringDates {\n provider = \"prisma-string-dates\"\n output = \"../src/generated\"\n}\n\ngenerator taggedIds {\n provider = \"prisma-tagged-ids\"\n output = \"../src/generated\"\n}\n\ndatasource db {\n provider = \"postgresql\"\n url = env(\"DATABASE_URL\")\n}\n\nmodel User {\n id String @id @default(cuid(2))\n createdAt DateTime @default(now())\n updatedAt DateTime @default(now()) @updatedAt\n\n name String\n}\n",
|
|
58
|
+
"inlineSchemaHash": "7d1ca802697687a0d28701b345324b445a425e1f524d6377a89cbc48895f7110",
|
|
59
|
+
"copyEngine": true,
|
|
60
|
+
"runtimeDataModel": {
|
|
61
|
+
"models": {},
|
|
62
|
+
"enums": {},
|
|
63
|
+
"types": {}
|
|
64
|
+
},
|
|
65
|
+
"dirname": ""
|
|
66
|
+
};
|
|
67
|
+
config.runtimeDataModel = JSON.parse("{\"models\":{\"User\":{\"fields\":[{\"name\":\"id\",\"kind\":\"scalar\",\"type\":\"String\"},{\"name\":\"createdAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"updatedAt\",\"kind\":\"scalar\",\"type\":\"DateTime\"},{\"name\":\"name\",\"kind\":\"scalar\",\"type\":\"String\"}],\"dbName\":null}},\"enums\":{},\"types\":{}}");
|
|
68
|
+
config.engineWasm = undefined;
|
|
69
|
+
async function decodeBase64AsWasm(wasmBase64) {
|
|
70
|
+
const { Buffer } = await import('node:buffer');
|
|
71
|
+
const wasmArray = Buffer.from(wasmBase64, 'base64');
|
|
72
|
+
return new WebAssembly.Module(wasmArray);
|
|
73
|
+
}
|
|
74
|
+
config.compilerWasm = {
|
|
75
|
+
getRuntime: async () => await import("@prisma/client/runtime/query_compiler_bg.postgresql.mjs"),
|
|
76
|
+
getQueryCompilerWasmModule: async () => {
|
|
77
|
+
const { wasm } = await import("@prisma/client/runtime/query_compiler_bg.postgresql.wasm-base64.mjs");
|
|
78
|
+
return await decodeBase64AsWasm(wasm);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
export function getPrismaClientClass(dirname) {
|
|
82
|
+
config.dirname = dirname;
|
|
83
|
+
return runtime.getPrismaClient(config);
|
|
84
|
+
}
|