@shware/security 2.0.2 → 2.1.0
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/auth/index.cjs +94 -26
- package/dist/auth/index.cjs.map +1 -1
- package/dist/auth/index.d.cts +33 -17
- package/dist/auth/index.d.ts +33 -17
- package/dist/auth/index.mjs +92 -25
- package/dist/auth/index.mjs.map +1 -1
- package/dist/auth/types.cjs.map +1 -1
- package/dist/auth/types.d.cts +16 -5
- package/dist/auth/types.d.ts +16 -5
- package/dist/email/schema.cjs +41 -0
- package/dist/email/schema.cjs.map +1 -0
- package/dist/email/schema.d.cts +13 -0
- package/dist/email/schema.d.ts +13 -0
- package/dist/email/schema.mjs +15 -0
- package/dist/email/schema.mjs.map +1 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/dist/oauth2/client.d.cts +17 -17
- package/dist/oauth2/client.d.ts +17 -17
- package/dist/oauth2/provider/apple.cjs.map +1 -1
- package/dist/oauth2/provider/apple.mjs.map +1 -1
- package/dist/oauth2/provider/common.cjs.map +1 -1
- package/dist/oauth2/provider/common.mjs.map +1 -1
- package/dist/oauth2/provider/facebook.cjs.map +1 -1
- package/dist/oauth2/provider/facebook.mjs.map +1 -1
- package/dist/oauth2/provider/github.cjs.map +1 -1
- package/dist/oauth2/provider/github.mjs.map +1 -1
- package/dist/oauth2/provider/google.cjs.map +1 -1
- package/dist/oauth2/provider/google.mjs.map +1 -1
- package/dist/oauth2/provider/wechat.cjs.map +1 -1
- package/dist/oauth2/provider/wechat.mjs.map +1 -1
- package/dist/oauth2/provider/x.cjs.map +1 -1
- package/dist/oauth2/provider/x.mjs.map +1 -1
- package/dist/session/__tests__/redis.test.cjs +17 -12
- package/dist/session/__tests__/redis.test.cjs.map +1 -1
- package/dist/session/__tests__/redis.test.mjs +17 -12
- package/dist/session/__tests__/redis.test.mjs.map +1 -1
- package/dist/session/db.cjs.map +1 -1
- package/dist/session/db.d.cts +1 -1
- package/dist/session/db.d.ts +1 -1
- package/dist/session/db.mjs.map +1 -1
- package/dist/session/redis.cjs.map +1 -1
- package/dist/session/redis.d.cts +2 -2
- package/dist/session/redis.d.ts +2 -2
- package/dist/session/redis.mjs.map +1 -1
- package/dist/utils/valid.cjs +78 -0
- package/dist/utils/valid.cjs.map +1 -0
- package/dist/utils/valid.d.cts +27 -0
- package/dist/utils/valid.d.ts +27 -0
- package/dist/utils/valid.mjs +51 -0
- package/dist/utils/valid.mjs.map +1 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/oauth2/provider/x.ts"],"sourcesContent":["import { invariant } from '@shware/utils';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/oauth2/provider/x.ts"],"sourcesContent":["import { invariant } from '@shware/utils';\nimport type { OAuth2Token, Provider } from '../types';\nimport { OAuth2Error } from '../error';\nimport {\n createAuthorizationUri,\n exchangeAuthorizationCode,\n refreshAccessToken,\n revokeToken,\n} from './common';\n\nexport interface XOptions {\n userFields?: UserField[];\n}\n\nconst defaultUserFields = [\n 'id',\n 'name',\n 'profile_image_url',\n 'url',\n 'username',\n 'location',\n 'verified',\n];\n\nexport function createXProvider(options?: XOptions): Provider {\n return {\n authorizationUri: 'https://x.com/i/oauth2/authorize',\n tokenUri: 'https://api.x.com/2/oauth2/token',\n tokenRefreshUri: 'https://api.x.com/2/oauth2/token',\n tokenRevokeUri: 'https://api.x.com/2/oauth2/revoke',\n // https://docs.x.com/x-api/users/user-lookup-me\n userInfoUri: 'https://api.x.com/2/users/me',\n defaultScope: ['users.read', 'tweet.read', 'offline.access'],\n createAuthorizationUri(params) {\n if (!params.pkce) throw new Error('pkce is required for x');\n return createAuthorizationUri({\n ...params,\n scope: params.scope ?? this.defaultScope,\n authorizationUri: this.authorizationUri,\n });\n },\n async exchangeAuthorizationCode(params) {\n if (!params.pkce) throw new Error('pkce is required for x');\n const response = await exchangeAuthorizationCode({\n ...params,\n tokenUri: this.tokenUri,\n authentication: 'basic',\n });\n if (!response.ok) {\n const { error, error_description } = (await response.json()) as XErrorResponse;\n throw new OAuth2Error(response.status, error, error_description);\n }\n return (await response.json()) as XToken;\n },\n async getUserInfo({ access_token }) {\n invariant(access_token, 'access_token is required');\n invariant(this.userInfoUri, 'userInfoUri is required');\n\n const userFields = options?.userFields ?? defaultUserFields;\n const headers = { Accept: 'application/json', Authorization: `Bearer ${access_token}` };\n\n const url = new URL(this.userInfoUri);\n userFields.forEach((field) => url.searchParams.append('user.fields', field));\n\n const response = await fetch(this.userInfoUri, { headers });\n if (!response.ok) {\n const { errors } = (await response.json()) as XAPIErrorResponse;\n throw new OAuth2Error(\n response.status,\n 'invalid_request',\n `Failed to fetch user info: ${errors.at(0)?.detail ?? errors.at(0)?.title}`\n );\n }\n const profile = (await response.json()) as XUserInfo;\n return {\n data: profile,\n claims: {\n sub: profile.data.id,\n name: profile.data.name,\n picture: profile.data.profile_image_url,\n email: profile.data.email,\n email_verified: profile.data.verified || false,\n preferred_username: profile.data.username,\n profile: `https://x.com/${profile.data.username}`,\n website: profile.data.url,\n },\n };\n },\n async refreshAccessToken(params) {\n invariant(this.tokenRefreshUri, 'tokenRefreshUri is required');\n const response = await refreshAccessToken({\n ...params,\n tokenUri: this.tokenRefreshUri,\n authentication: 'basic',\n });\n if (!response.ok) {\n const { error, error_description } = (await response.json()) as XErrorResponse;\n throw new OAuth2Error(response.status, error, error_description);\n }\n return (await response.json()) as XToken;\n },\n async revokeToken(params) {\n invariant(this.tokenRevokeUri, 'tokenRevokeUri is required');\n return revokeToken({\n ...params,\n tokenRevokeUri: this.tokenRevokeUri,\n authentication: 'basic',\n });\n },\n };\n}\n\nexport const x = createXProvider();\n\ntype UserField =\n | 'affiliation'\n | 'connection_status'\n | 'created_at'\n | 'description'\n | 'entities'\n | 'id'\n | 'is_identity_verified'\n | 'location'\n | 'most_recent_tweet_id'\n | 'name'\n | 'parody'\n | 'pinned_tweet_id'\n | 'profile_banner_url'\n | 'profile_image_url'\n | 'protected'\n | 'public_metrics'\n | 'receives_your_dm'\n | 'subscription'\n | 'subscription_type'\n | 'url'\n | 'username'\n | 'verified'\n | 'verified_followers_count'\n | 'verified_type'\n | 'withheld';\n\nexport interface XUser {\n id: string;\n name: string;\n email?: string;\n username: string;\n location?: string;\n entities?: {\n url: { urls: UrlEntity[] };\n description: {\n hashtags: HashtagEntity[];\n cashtags: HashtagEntity[];\n mentions: MentionEntity[];\n };\n };\n verified?: boolean;\n description?: string;\n url?: string;\n profile_image_url?: string;\n protected?: boolean;\n pinned_tweet_id?: string;\n created_at?: string;\n}\n\nexport interface XUserInfo {\n data: XUser;\n includes?: { tweets?: { id: string; text: string }[]; users?: XUser[] };\n}\n\ntype UrlEntity = {\n start: number;\n end: number;\n url: string;\n display_url: string;\n expanded_url: string;\n};\ntype HashtagEntity = { start: number; end: number; tag: string };\ntype MentionEntity = { start: number; end: string; username: string };\n\nexport interface XToken extends OAuth2Token {\n token_type: string;\n expires_in: number;\n access_token: string;\n scope: string;\n refresh_token: string;\n}\n\ntype XErrorResponse = { error: string; error_description: string };\ntype XAPIErrorResponse = {\n errors: { title: string; type: string; detail?: string; status?: number }[];\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0B;AAE1B,mBAA4B;AAC5B,oBAKO;AAMP,IAAM,oBAAoB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,gBAAgB,SAA8B;AAC5D,SAAO;AAAA,IACL,kBAAkB;AAAA,IAClB,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB,gBAAgB;AAAA;AAAA,IAEhB,aAAa;AAAA,IACb,cAAc,CAAC,cAAc,cAAc,gBAAgB;A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,MAAM,SAAS,KAAK;AACrC,aAAO;AAAA,QACL,MAAM;AAAA,QACN,QAAQ;AAAA,UACN,KAAK,QAAQ,KAAK;AAAA,UAClB,MAAM,QAAQ,KAAK;AAAA,UACnB,SAAS,QAAQ,KAAK;AAAA,UACtB,OAAO,QAAQ,KAAK;AAAA,UACpB,gBAAgB,QAAQ,KAAK,YAAY;AAAA,UACzC,oBAAoB,QAAQ,KAAK;AAAA,UACjC,SAAS,iBAAiB,QAAQ,KAAK,QAAQ;AAAA,UAC/C,SAAS,QAAQ,KAAK;AAAA,QACxB;AAAA,MACF;AAAA,IACF;AAAA,IACA,MAAM,mBAAmB,QAAQ;AAC/B,kCAAU,KAAK,iBAAiB,6BAA6B;AAC7D,YAAM,WAAW,UAAM,kCAAmB;AAAA,QACxC,GAAG;AAAA,QACH,UAAU,KAAK;AAAA,QACf,gBAAgB;AAAA,MAClB,CAAC;AACD,UAAI,CAAC,SAAS,IAAI;AAChB,cAAM,EAAE,OAAO,kBAAkB,IAAK,MAAM,SAAS,KAAK;AAC1D,cAAM,IAAI,yBAAY,SAAS,QAAQ,OAAO,iBAAiB;AAAA,MACjE;AACA,aAAQ,MAAM,SAAS,KAAK;AAAA,IAC9B;AAAA,IACA,MAAM,YAAY,QAAQ;AACxB,kCAAU,KAAK,gBAAgB,4BAA4B;AAC3D,iBAAO,2BAAY;AAAA,QACjB,GAAG;AAAA,QACH,gBAAgB,KAAK;AAAA,QACrB,gBAAgB;AAAA,MAClB,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,IAAM,IAAI,gBAAgB;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/oauth2/provider/x.ts"],"sourcesContent":["import { invariant } from '@shware/utils';\nimport {
|
|
1
|
+
{"version":3,"sources":["../../../src/oauth2/provider/x.ts"],"sourcesContent":["import { invariant } from '@shware/utils';\nimport type { OAuth2Token, Provider } from '../types';\nimport { OAuth2Error } from '../error';\nimport {\n createAuthorizationUri,\n exchangeAuthorizationCode,\n refreshAccessToken,\n revokeToken,\n} from './common';\n\nexport interface XOptions {\n userFields?: UserField[];\n}\n\nconst defaultUserFields = [\n 'id',\n 'name',\n 'profile_image_url',\n 'url',\n 'username',\n 'location',\n 'verified',\n];\n\nexport function createXProvider(options?: XOptions): Provider {\n return {\n authorizationUri: 'https://x.com/i/oauth2/authorize',\n tokenUri: 'https://api.x.com/2/oauth2/token',\n tokenRefreshUri: 'https://api.x.com/2/oauth2/token',\n tokenRevokeUri: 'https://api.x.com/2/oauth2/revoke',\n // https://docs.x.com/x-api/users/user-lookup-me\n userInfoUri: 'https://api.x.com/2/users/me',\n defaultScope: ['users.read', 'tweet.read', 'offline.access'],\n createAuthorizationUri(params) {\n if (!params.pkce) throw new Error('pkce is required for x');\n return createAuthorizationUri({\n ...params,\n scope: params.scope ?? this.defaultScope,\n authorizationUri: this.authorizationUri,\n });\n },\n async exchangeAuthorizationCode(params) {\n if (!params.pkce) throw new Error('pkce is required for x');\n const response = await exchangeAuthorizationCode({\n ...params,\n tokenUri: this.tokenUri,\n authentication: 'basic',\n });\n if (!response.ok) {\n const { error, error_description } = (await response.json()) as XErrorResponse;\n throw new OAuth2Error(response.status, error, error_description);\n }\n return (await response.json()) as XToken;\n },\n async getUserInfo({ access_token }) {\n invariant(access_token, 'access_token is required');\n invariant(this.userInfoUri, 'userInfoUri is required');\n\n const userFields = options?.userFields ?? defaultUserFields;\n const headers = { Accept: 'application/json', Authorization: `Bearer ${access_token}` };\n\n const url = new URL(this.userInfoUri);\n userFields.forEach((field) => url.searchParams.append('user.fields', field));\n\n const response = await fetch(this.userInfoUri, { headers });\n if (!response.ok) {\n const { errors } = (await response.json()) as XAPIErrorResponse;\n throw new OAuth2Error(\n response.status,\n 'invalid_request',\n `Failed to fetch user info: ${errors.at(0)?.detail ?? errors.at(0)?.title}`\n );\n }\n const profile = (await response.json()) as XUserInfo;\n return {\n data: profile,\n claims: {\n sub: profile.data.id,\n name: profile.data.name,\n picture: profile.data.profile_image_url,\n email: profile.data.email,\n email_verified: profile.data.verified || false,\n preferred_username: profile.data.username,\n profile: `https://x.com/${profile.data.username}`,\n website: profile.data.url,\n },\n };\n },\n async refreshAccessToken(params) {\n invariant(this.tokenRefreshUri, 'tokenRefreshUri is required');\n const response = await refreshAccessToken({\n ...params,\n tokenUri: this.tokenRefreshUri,\n authentication: 'basic',\n });\n if (!response.ok) {\n const { error, error_description } = (await response.json()) as XErrorResponse;\n throw new OAuth2Error(response.status, error, error_description);\n }\n return (await response.json()) as XToken;\n },\n async revokeToken(params) {\n invariant(this.tokenRevokeUri, 'tokenRevokeUri is required');\n return revokeToken({\n ...params,\n tokenRevokeUri: this.tokenRevokeUri,\n authentication: 'basic',\n });\n },\n };\n}\n\nexport const x = createXProvider();\n\ntype UserField =\n | 'affiliation'\n | 'connection_status'\n | 'created_at'\n | 'description'\n | 'entities'\n | 'id'\n | 'is_identity_verified'\n | 'location'\n | 'most_recent_tweet_id'\n | 'name'\n | 'parody'\n | 'pinned_tweet_id'\n | 'profile_banner_url'\n | 'profile_image_url'\n | 'protected'\n | 'public_metrics'\n | 'receives_your_dm'\n | 'subscription'\n | 'subscription_type'\n | 'url'\n | 'username'\n | 'verified'\n | 'verified_followers_count'\n | 'verified_type'\n | 'withheld';\n\nexport interface XUser {\n id: string;\n name: string;\n email?: string;\n username: string;\n location?: string;\n entities?: {\n url: { urls: UrlEntity[] };\n description: {\n hashtags: HashtagEntity[];\n cashtags: HashtagEntity[];\n mentions: MentionEntity[];\n };\n };\n verified?: boolean;\n description?: string;\n url?: string;\n profile_image_url?: string;\n protected?: boolean;\n pinned_tweet_id?: string;\n created_at?: string;\n}\n\nexport interface XUserInfo {\n data: XUser;\n includes?: { tweets?: { id: string; text: string }[]; users?: XUser[] };\n}\n\ntype UrlEntity = {\n start: number;\n end: number;\n url: string;\n display_url: string;\n expanded_url: string;\n};\ntype HashtagEntity = { start: number; end: number; tag: string };\ntype MentionEntity = { start: number; end: string; username: string };\n\nexport interface XToken extends OAuth2Token {\n token_type: string;\n expires_in: number;\n access_token: string;\n scope: string;\n refresh_token: string;\n}\n\ntype XErrorResponse = { error: string; error_description: string };\ntype XAPIErrorResponse = {\n errors: { title: string; type: string; detail?: string; status?: number }[];\n};\n"],"mappings":";AAAA,SAAS,iBAAiB;AAE1B,SAAS,mBAAmB;AAC5B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAMP,IAAM,oBAAoB;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEO,SAAS,gBAAgB,SAA8B;AAC5D,SAAO;AAAA,IACL,kBAAkB;AAAA,IAClB,UAAU;AAAA,IACV,iBAAiB;AAAA,IACjB,gBAAgB;AAAA;AAAA,IAEhB,aAAa;AAAA,IACb,cAAc,CAAC,cAAc,cAAc,gBAAgB;AAAA,IAC3D,uBAAuB,QAAQ;AAC7B,UAAI,CAAC,OAAO,KAAM,OAAM,IAAI,MAAM,wBAAwB;AAC1D,aAAO,uBAAuB;AAAA,QAC5B,GAAG;AAAA,QACH,OAAO,OAAO,SAAS,KAAK;AAAA,QAC5B,kBAAkB,KAAK;AAAA,MACzB,CAAC;AAAA,IACH;AAAA,IACA,MAAM,0BAA0B,QAAQ;AACtC,UAAI,CAAC,OAAO,KAAM,OAAM,IAAI,MAAM,wBAAwB;AAC1D,YAAM,WAAW,MAAM,0BAA0B;AAAA,QAC/C,GAAG;AAAA,QACH,UAAU,KAAK;AAAA,QACf,gBAAgB;AAAA,MAClB,CAAC;AACD,UAAI,CAAC,SAAS,IAAI;AAChB,cAAM,EAAE,OAAO,kBAAkB,IAAK,MAAM,SAAS,KAAK;AAC1D,cAAM,IAAI,YAAY,SAAS,QAAQ,OAAO,iBAAiB;AAAA,MACjE;AACA,aAAQ,MAAM,SAAS,KAAK;AAAA,IAC9B;AAAA,IACA,MAAM,YAAY,EAAE,aAAa,GAAG;AAClC,gB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AY,SAAS,QAAQ,OAAO,iBAAiB;AAAA,MACjE;AACA,aAAQ,MAAM,SAAS,KAAK;AAAA,IAC9B;AAAA,IACA,MAAM,YAAY,QAAQ;AACxB,gBAAU,KAAK,gBAAgB,4BAA4B;AAC3D,aAAO,YAAY;AAAA,QACjB,GAAG;AAAA,QACH,gBAAgB,KAAK;AAAA,QACrB,gBAAgB;AAAA,MAClB,CAAC;AAAA,IACH;AAAA,EACF;AACF;AAEO,IAAM,IAAI,gBAAgB;","names":[]}
|
|
@@ -108,7 +108,7 @@ var require_dist = __commonJS({
|
|
|
108
108
|
// src/session/__tests__/redis.test.ts
|
|
109
109
|
var import_ioredis = __toESM(require("ioredis"), 1);
|
|
110
110
|
|
|
111
|
-
// ../../node_modules/.pnpm/vitest@4.0.
|
|
111
|
+
// ../../node_modules/.pnpm/vitest@4.0.17_@types+node@24.10.6_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_yaml@2.8.2/node_modules/vitest/dist/index.js
|
|
112
112
|
var import_vi_2VT5v0um = require("./chunks/vi.2VT5v0um.js.cjs");
|
|
113
113
|
var import_benchmark_B3N2zMcH = require("./chunks/benchmark.B3N2zMcH.js.cjs");
|
|
114
114
|
var import_evaluatedModules_Dg1zASAC = require("./chunks/evaluatedModules.Dg1zASAC.js.cjs");
|
|
@@ -196,7 +196,7 @@ function f() {
|
|
|
196
196
|
}
|
|
197
197
|
var C = f();
|
|
198
198
|
|
|
199
|
-
// ../../node_modules/.pnpm/@vitest+pretty-format@4.0.
|
|
199
|
+
// ../../node_modules/.pnpm/@vitest+pretty-format@4.0.17/node_modules/@vitest/pretty-format/dist/index.js
|
|
200
200
|
function _mergeNamespaces(n2, m2) {
|
|
201
201
|
m2.forEach(function(e2) {
|
|
202
202
|
e2 && typeof e2 !== "string" && !Array.isArray(e2) && Object.keys(e2).forEach(function(k2) {
|
|
@@ -1153,7 +1153,7 @@ var plugins = {
|
|
|
1153
1153
|
Error: ErrorPlugin
|
|
1154
1154
|
};
|
|
1155
1155
|
|
|
1156
|
-
// ../../node_modules/.pnpm/@vitest+utils@4.0.
|
|
1156
|
+
// ../../node_modules/.pnpm/@vitest+utils@4.0.17/node_modules/@vitest/utils/dist/helpers.js
|
|
1157
1157
|
var import_constants = require("./constants.js.cjs");
|
|
1158
1158
|
function assertTypes(value, name, types) {
|
|
1159
1159
|
const receivedType = typeof value;
|
|
@@ -1207,7 +1207,7 @@ function isNegativeNaN(val) {
|
|
|
1207
1207
|
return isNegative;
|
|
1208
1208
|
}
|
|
1209
1209
|
|
|
1210
|
-
// ../../node_modules/.pnpm/@vitest+utils@4.0.
|
|
1210
|
+
// ../../node_modules/.pnpm/@vitest+utils@4.0.17/node_modules/@vitest/utils/dist/timers.js
|
|
1211
1211
|
var SAFE_TIMERS_SYMBOL = /* @__PURE__ */ Symbol("vitest:SAFE_TIMERS");
|
|
1212
1212
|
function getSafeTimers() {
|
|
1213
1213
|
const { setTimeout: safeSetTimeout, setInterval: safeSetInterval, clearInterval: safeClearInterval, clearTimeout: safeClearTimeout, setImmediate: safeSetImmediate, clearImmediate: safeClearImmediate, queueMicrotask: safeQueueMicrotask } = globalThis[SAFE_TIMERS_SYMBOL] || globalThis;
|
|
@@ -1224,7 +1224,7 @@ function getSafeTimers() {
|
|
|
1224
1224
|
};
|
|
1225
1225
|
}
|
|
1226
1226
|
|
|
1227
|
-
// ../../node_modules/.pnpm/@vitest+utils@4.0.
|
|
1227
|
+
// ../../node_modules/.pnpm/@vitest+utils@4.0.17/node_modules/@vitest/utils/dist/display.js
|
|
1228
1228
|
var ansiColors = {
|
|
1229
1229
|
bold: ["1", "22"],
|
|
1230
1230
|
dim: ["2", "22"],
|
|
@@ -1908,7 +1908,7 @@ function objDisplay(obj, options = {}) {
|
|
|
1908
1908
|
return str;
|
|
1909
1909
|
}
|
|
1910
1910
|
|
|
1911
|
-
// ../../node_modules/.pnpm/@vitest+runner@4.0.
|
|
1911
|
+
// ../../node_modules/.pnpm/@vitest+runner@4.0.17/node_modules/@vitest/runner/dist/index.js
|
|
1912
1912
|
var import_chunk_tasks = require("./chunk-tasks.js.cjs");
|
|
1913
1913
|
var PendingError = class extends Error {
|
|
1914
1914
|
code = "VITEST_PENDING";
|
|
@@ -2286,7 +2286,12 @@ var defaultSuite;
|
|
|
2286
2286
|
var currentTestFilepath;
|
|
2287
2287
|
function assert(condition, message) {
|
|
2288
2288
|
if (!condition) {
|
|
2289
|
-
throw new Error(`Vitest failed to find ${message}.
|
|
2289
|
+
throw new Error(`Vitest failed to find ${message}. One of the following is possible:
|
|
2290
|
+
- "vitest" is imported directly without running "vitest" command
|
|
2291
|
+
- "vitest" is imported inside "globalSetup" (to fix this, use "setupFiles" instead, because "globalSetup" runs in a different context)
|
|
2292
|
+
- "vitest" is imported inside Vite / Vitest config file
|
|
2293
|
+
- Otherwise, it might be a Vitest bug. Please report it to https://github.com/vitest-dev/vitest/issues
|
|
2294
|
+
`);
|
|
2290
2295
|
}
|
|
2291
2296
|
}
|
|
2292
2297
|
function getRunner() {
|
|
@@ -3048,17 +3053,17 @@ function manageArtifactAttachment(attachment) {
|
|
|
3048
3053
|
}
|
|
3049
3054
|
}
|
|
3050
3055
|
|
|
3051
|
-
// ../../node_modules/.pnpm/vitest@4.0.
|
|
3056
|
+
// ../../node_modules/.pnpm/vitest@4.0.17_@types+node@24.10.6_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_yaml@2.8.2/node_modules/vitest/dist/index.js
|
|
3052
3057
|
var import_utils_DvEY5TfP = require("./chunks/utils.DvEY5TfP.js.cjs");
|
|
3053
3058
|
|
|
3054
|
-
// ../../node_modules/.pnpm/@vitest+runner@4.0.
|
|
3059
|
+
// ../../node_modules/.pnpm/@vitest+runner@4.0.17/node_modules/@vitest/runner/dist/utils.js
|
|
3055
3060
|
var import_chunk_tasks2 = require("./chunk-tasks.js.cjs");
|
|
3056
3061
|
|
|
3057
|
-
// ../../node_modules/.pnpm/vitest@4.0.
|
|
3062
|
+
// ../../node_modules/.pnpm/vitest@4.0.17_@types+node@24.10.6_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_yaml@2.8.2/node_modules/vitest/dist/index.js
|
|
3058
3063
|
var import_commonjsHelpers_D26ty3Ew = require("./chunks/_commonjsHelpers.D26ty3Ew.js.cjs");
|
|
3059
3064
|
var import_date_Bq6ZW5rf = require("./chunks/date.Bq6ZW5rf.js.cjs");
|
|
3060
3065
|
|
|
3061
|
-
// ../../node_modules/.pnpm/vite@7.3.
|
|
3066
|
+
// ../../node_modules/.pnpm/vite@7.3.1_@types+node@24.10.6_jiti@2.6.1_lightningcss@1.30.2_terser@5.44.1_yaml@2.8.2/node_modules/vite/dist/node/module-runner.js
|
|
3062
3067
|
var SOURCEMAPPING_URL = "sourceMa";
|
|
3063
3068
|
SOURCEMAPPING_URL += "ppingURL";
|
|
3064
3069
|
var isWindows = typeof process < "u" && process.platform === "win32";
|
|
@@ -3142,7 +3147,7 @@ describe("redis session attributes", () => {
|
|
|
3142
3147
|
(0, import_vi_2VT5v0um.g)(foundSession).not.toBeNull();
|
|
3143
3148
|
(0, import_vi_2VT5v0um.g)(foundSession?.getAttribute("test_key")).toBe("test_value");
|
|
3144
3149
|
foundSession?.removeAttribute("test_key");
|
|
3145
|
-
await repository.save(foundSession);
|
|
3150
|
+
if (foundSession) await repository.save(foundSession);
|
|
3146
3151
|
const foundSession2 = await repository.findById(sessionId);
|
|
3147
3152
|
(0, import_vi_2VT5v0um.g)(foundSession2?.getAttribute("test_key")).toBeNull();
|
|
3148
3153
|
});
|