@bymax-one/nest-auth 1.5.11 → 1.5.12
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/CHANGELOG.md +62 -1
- package/dist/server/index.cjs +579 -47
- package/dist/server/index.d.cts +3 -4
- package/dist/server/index.d.ts +3 -4
- package/dist/server/index.mjs +580 -48
- package/package.json +1 -1
package/dist/server/index.cjs
CHANGED
|
@@ -27,6 +27,11 @@ var BYMAX_AUTH_API_KEY_REPOSITORY = /* @__PURE__ */ Symbol("BYMAX_AUTH_API_KEY_R
|
|
|
27
27
|
var BYMAX_AUTH_API_KEY_CLOCK = /* @__PURE__ */ Symbol("BYMAX_AUTH_API_KEY_CLOCK");
|
|
28
28
|
var BYMAX_AUTH_WORKSPACE_REPOSITORY = /* @__PURE__ */ Symbol("BYMAX_AUTH_WORKSPACE_REPOSITORY");
|
|
29
29
|
var BYMAX_AUTH_MEMBERSHIP_REPOSITORY = /* @__PURE__ */ Symbol("BYMAX_AUTH_MEMBERSHIP_REPOSITORY");
|
|
30
|
+
var GUARDED_USER_REPOSITORY = /* @__PURE__ */ Symbol("GUARDED_USER_REPOSITORY");
|
|
31
|
+
var GUARDED_PLATFORM_USER_REPOSITORY = /* @__PURE__ */ Symbol("GUARDED_PLATFORM_USER_REPOSITORY");
|
|
32
|
+
var GUARDED_API_KEY_REPOSITORY = /* @__PURE__ */ Symbol("GUARDED_API_KEY_REPOSITORY");
|
|
33
|
+
var GUARDED_WORKSPACE_REPOSITORY = /* @__PURE__ */ Symbol("GUARDED_WORKSPACE_REPOSITORY");
|
|
34
|
+
var GUARDED_MEMBERSHIP_REPOSITORY = /* @__PURE__ */ Symbol("GUARDED_MEMBERSHIP_REPOSITORY");
|
|
30
35
|
|
|
31
36
|
// src/server/config/describe-received.ts
|
|
32
37
|
function describeReceived(value) {
|
|
@@ -5935,10 +5940,10 @@ exports.AccountStatusService = class _AccountStatusService {
|
|
|
5935
5940
|
exports.AccountStatusService = _ts_decorate12([
|
|
5936
5941
|
common.Injectable(),
|
|
5937
5942
|
_ts_param7(0, common.Inject(AuthRedisService)),
|
|
5938
|
-
_ts_param7(1, common.Inject(
|
|
5943
|
+
_ts_param7(1, common.Inject(GUARDED_USER_REPOSITORY)),
|
|
5939
5944
|
_ts_param7(2, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
5940
5945
|
_ts_param7(3, common.Optional()),
|
|
5941
|
-
_ts_param7(3, common.Inject(
|
|
5946
|
+
_ts_param7(3, common.Inject(GUARDED_PLATFORM_USER_REPOSITORY)),
|
|
5942
5947
|
_ts_metadata12("design:type", Function),
|
|
5943
5948
|
_ts_metadata12("design:paramtypes", [
|
|
5944
5949
|
typeof AuthRedisService === "undefined" ? Object : AuthRedisService,
|
|
@@ -7150,6 +7155,532 @@ PasswordService = _ts_decorate20([
|
|
|
7150
7155
|
])
|
|
7151
7156
|
], PasswordService);
|
|
7152
7157
|
|
|
7158
|
+
// src/server/utils/repository-contracts.ts
|
|
7159
|
+
var RECORD_CONTRACTS = {
|
|
7160
|
+
workspace: {
|
|
7161
|
+
fields: {
|
|
7162
|
+
id: "~id",
|
|
7163
|
+
tenantId: "id",
|
|
7164
|
+
name: "~string",
|
|
7165
|
+
status: "string",
|
|
7166
|
+
createdAt: "~date",
|
|
7167
|
+
deletionScheduledAt: "date|null"
|
|
7168
|
+
},
|
|
7169
|
+
nested: {}
|
|
7170
|
+
},
|
|
7171
|
+
membership: {
|
|
7172
|
+
fields: {
|
|
7173
|
+
tenantId: "id",
|
|
7174
|
+
workspaceId: "~id",
|
|
7175
|
+
userId: "~id",
|
|
7176
|
+
role: "string",
|
|
7177
|
+
status: "string",
|
|
7178
|
+
invitedByUserId: "~id",
|
|
7179
|
+
createdAt: "~date",
|
|
7180
|
+
updatedAt: "~date"
|
|
7181
|
+
},
|
|
7182
|
+
nested: {}
|
|
7183
|
+
},
|
|
7184
|
+
user: {
|
|
7185
|
+
fields: {
|
|
7186
|
+
id: "~id",
|
|
7187
|
+
email: "~string",
|
|
7188
|
+
name: "~string",
|
|
7189
|
+
passwordHash: "string|null",
|
|
7190
|
+
role: "string",
|
|
7191
|
+
status: "string",
|
|
7192
|
+
tenantId: "id",
|
|
7193
|
+
emailVerified: "boolean",
|
|
7194
|
+
mfaEnabled: "boolean",
|
|
7195
|
+
mfaSecret: "string?",
|
|
7196
|
+
mfaRecoveryCodes: "strings?",
|
|
7197
|
+
oauthProvider: "~string",
|
|
7198
|
+
oauthProviderId: "~string",
|
|
7199
|
+
lastLoginAt: "~date",
|
|
7200
|
+
createdAt: "~date"
|
|
7201
|
+
},
|
|
7202
|
+
nested: {}
|
|
7203
|
+
},
|
|
7204
|
+
platformUser: {
|
|
7205
|
+
fields: {
|
|
7206
|
+
id: "~id",
|
|
7207
|
+
email: "~string",
|
|
7208
|
+
name: "~string",
|
|
7209
|
+
passwordHash: "string",
|
|
7210
|
+
role: "string",
|
|
7211
|
+
status: "string",
|
|
7212
|
+
mfaEnabled: "boolean",
|
|
7213
|
+
mfaSecret: "string?",
|
|
7214
|
+
mfaRecoveryCodes: "strings?",
|
|
7215
|
+
platformId: "~id",
|
|
7216
|
+
lastLoginAt: "~date",
|
|
7217
|
+
updatedAt: "~date",
|
|
7218
|
+
createdAt: "~date"
|
|
7219
|
+
},
|
|
7220
|
+
nested: {}
|
|
7221
|
+
},
|
|
7222
|
+
apiKey: {
|
|
7223
|
+
fields: {
|
|
7224
|
+
id: "~id",
|
|
7225
|
+
label: "~string",
|
|
7226
|
+
digest: "string",
|
|
7227
|
+
scopes: "strings",
|
|
7228
|
+
createdAt: "~date",
|
|
7229
|
+
expiresAt: "date|null",
|
|
7230
|
+
revokedAt: "date|null",
|
|
7231
|
+
lastUsedAt: "~date"
|
|
7232
|
+
},
|
|
7233
|
+
nested: {}
|
|
7234
|
+
},
|
|
7235
|
+
removedMembership: {
|
|
7236
|
+
fields: {
|
|
7237
|
+
workspaceId: "~id",
|
|
7238
|
+
role: "string"
|
|
7239
|
+
},
|
|
7240
|
+
nested: {}
|
|
7241
|
+
}
|
|
7242
|
+
};
|
|
7243
|
+
var WORKSPACE = RECORD_CONTRACTS.workspace;
|
|
7244
|
+
var MEMBERSHIP = RECORD_CONTRACTS.membership;
|
|
7245
|
+
var USER = RECORD_CONTRACTS.user;
|
|
7246
|
+
var PLATFORM_USER = RECORD_CONTRACTS.platformUser;
|
|
7247
|
+
var API_KEY = RECORD_CONTRACTS.apiKey;
|
|
7248
|
+
var REMOVED_MEMBERSHIP = RECORD_CONTRACTS.removedMembership;
|
|
7249
|
+
var MEMBERSHIP_WITH_WORKSPACE = {
|
|
7250
|
+
fields: {
|
|
7251
|
+
...MEMBERSHIP.fields,
|
|
7252
|
+
workspace: "nested"
|
|
7253
|
+
},
|
|
7254
|
+
nested: {
|
|
7255
|
+
workspace: WORKSPACE
|
|
7256
|
+
}
|
|
7257
|
+
};
|
|
7258
|
+
var PAGE_OF_MEMBERSHIPS_WITH_WORKSPACE = {
|
|
7259
|
+
fields: {
|
|
7260
|
+
items: "nested",
|
|
7261
|
+
nextCursor: "~string"
|
|
7262
|
+
},
|
|
7263
|
+
nested: {
|
|
7264
|
+
items: {
|
|
7265
|
+
list: MEMBERSHIP_WITH_WORKSPACE
|
|
7266
|
+
}
|
|
7267
|
+
}
|
|
7268
|
+
};
|
|
7269
|
+
var PAGE_OF_MEMBERSHIPS = {
|
|
7270
|
+
fields: {
|
|
7271
|
+
items: "nested",
|
|
7272
|
+
nextCursor: "~string"
|
|
7273
|
+
},
|
|
7274
|
+
nested: {
|
|
7275
|
+
items: {
|
|
7276
|
+
list: MEMBERSHIP
|
|
7277
|
+
}
|
|
7278
|
+
}
|
|
7279
|
+
};
|
|
7280
|
+
var PAGE_OF_WORKSPACES = {
|
|
7281
|
+
fields: {
|
|
7282
|
+
items: "nested",
|
|
7283
|
+
nextCursor: "~string"
|
|
7284
|
+
},
|
|
7285
|
+
nested: {
|
|
7286
|
+
items: {
|
|
7287
|
+
list: WORKSPACE
|
|
7288
|
+
}
|
|
7289
|
+
}
|
|
7290
|
+
};
|
|
7291
|
+
var orNothing = /* @__PURE__ */ __name((contract) => ({
|
|
7292
|
+
...contract,
|
|
7293
|
+
nullable: true
|
|
7294
|
+
}), "orNothing");
|
|
7295
|
+
var USER_REPOSITORY_CONTRACT = {
|
|
7296
|
+
findById: orNothing(USER),
|
|
7297
|
+
findByEmail: orNothing(USER),
|
|
7298
|
+
create: USER,
|
|
7299
|
+
updatePassword: "void",
|
|
7300
|
+
updateMfa: "void",
|
|
7301
|
+
updateLastLogin: "void",
|
|
7302
|
+
updateStatus: "void",
|
|
7303
|
+
updateEmailVerified: "void",
|
|
7304
|
+
updateEmail: "void",
|
|
7305
|
+
findByOAuthId: orNothing(USER),
|
|
7306
|
+
linkOAuth: "void",
|
|
7307
|
+
createWithOAuth: USER
|
|
7308
|
+
};
|
|
7309
|
+
var PLATFORM_USER_REPOSITORY_CONTRACT = {
|
|
7310
|
+
findById: orNothing(PLATFORM_USER),
|
|
7311
|
+
findByEmail: orNothing(PLATFORM_USER),
|
|
7312
|
+
updateLastLogin: "void",
|
|
7313
|
+
updateMfa: "void",
|
|
7314
|
+
updatePassword: "void",
|
|
7315
|
+
updateStatus: "void"
|
|
7316
|
+
};
|
|
7317
|
+
var API_KEY_REPOSITORY_CONTRACT = {
|
|
7318
|
+
findById: orNothing(API_KEY),
|
|
7319
|
+
create: API_KEY,
|
|
7320
|
+
markRevoked: "boolean",
|
|
7321
|
+
setExpiry: "boolean",
|
|
7322
|
+
limitExpiry: "boolean",
|
|
7323
|
+
touchLastUsed: "void",
|
|
7324
|
+
listByLabel: {
|
|
7325
|
+
list: API_KEY
|
|
7326
|
+
}
|
|
7327
|
+
};
|
|
7328
|
+
var WORKSPACE_REPOSITORY_CONTRACT = {
|
|
7329
|
+
createWithOwner: {
|
|
7330
|
+
fields: {
|
|
7331
|
+
status: "string",
|
|
7332
|
+
workspace: "nested?"
|
|
7333
|
+
},
|
|
7334
|
+
nested: {
|
|
7335
|
+
workspace: WORKSPACE
|
|
7336
|
+
}
|
|
7337
|
+
},
|
|
7338
|
+
findById: orNothing(WORKSPACE),
|
|
7339
|
+
rename: "string",
|
|
7340
|
+
updateStatus: "string"
|
|
7341
|
+
};
|
|
7342
|
+
var MEMBERSHIP_REPOSITORY_CONTRACT = {
|
|
7343
|
+
find: orNothing(MEMBERSHIP),
|
|
7344
|
+
listForUser: PAGE_OF_MEMBERSHIPS_WITH_WORKSPACE,
|
|
7345
|
+
listForWorkspace: PAGE_OF_MEMBERSHIPS,
|
|
7346
|
+
create: "string",
|
|
7347
|
+
changeRole: "string",
|
|
7348
|
+
remove: "string",
|
|
7349
|
+
removeAllForUser: {
|
|
7350
|
+
fields: {
|
|
7351
|
+
result: "string",
|
|
7352
|
+
removed: "nested?",
|
|
7353
|
+
workspaceIds: "strings?"
|
|
7354
|
+
},
|
|
7355
|
+
nested: {
|
|
7356
|
+
removed: {
|
|
7357
|
+
list: REMOVED_MEMBERSHIP
|
|
7358
|
+
}
|
|
7359
|
+
}
|
|
7360
|
+
},
|
|
7361
|
+
transferOwnership: "string",
|
|
7362
|
+
countOwned: "number",
|
|
7363
|
+
listSoleOwned: PAGE_OF_WORKSPACES,
|
|
7364
|
+
getLastActiveWorkspaceId: "string|null",
|
|
7365
|
+
setLastActiveWorkspaceId: "void"
|
|
7366
|
+
};
|
|
7367
|
+
var CREDENTIAL_FIELDS = /* @__PURE__ */ new Set([
|
|
7368
|
+
"passwordHash",
|
|
7369
|
+
"mfaSecret",
|
|
7370
|
+
"mfaRecoveryCodes",
|
|
7371
|
+
"digest"
|
|
7372
|
+
]);
|
|
7373
|
+
|
|
7374
|
+
// src/server/utils/host-read.ts
|
|
7375
|
+
var MAX_BREADTH = 1e5;
|
|
7376
|
+
function copiedUnder(seen, value, contract) {
|
|
7377
|
+
return seen.get(value)?.get(contract);
|
|
7378
|
+
}
|
|
7379
|
+
__name(copiedUnder, "copiedUnder");
|
|
7380
|
+
function rememberUnder(seen, value, contract, copy) {
|
|
7381
|
+
const copies = seen.get(value) ?? /* @__PURE__ */ new Map();
|
|
7382
|
+
copies.set(contract, copy);
|
|
7383
|
+
seen.set(value, copies);
|
|
7384
|
+
}
|
|
7385
|
+
__name(rememberUnder, "rememberUnder");
|
|
7386
|
+
function readHostOptions(read) {
|
|
7387
|
+
try {
|
|
7388
|
+
return read();
|
|
7389
|
+
} catch (error) {
|
|
7390
|
+
throw configurationError(error);
|
|
7391
|
+
}
|
|
7392
|
+
}
|
|
7393
|
+
__name(readHostOptions, "readHostOptions");
|
|
7394
|
+
async function readHostOptionsAsync(read) {
|
|
7395
|
+
try {
|
|
7396
|
+
return {
|
|
7397
|
+
value: await read()
|
|
7398
|
+
};
|
|
7399
|
+
} catch (error) {
|
|
7400
|
+
throw configurationError(error);
|
|
7401
|
+
}
|
|
7402
|
+
}
|
|
7403
|
+
__name(readHostOptionsAsync, "readHostOptionsAsync");
|
|
7404
|
+
function callFactory(factory, args) {
|
|
7405
|
+
return readHostOptionsAsync(async () => factory(...args));
|
|
7406
|
+
}
|
|
7407
|
+
__name(callFactory, "callFactory");
|
|
7408
|
+
function hostHasKey(host, key) {
|
|
7409
|
+
return readHostOptions(() => key in host);
|
|
7410
|
+
}
|
|
7411
|
+
__name(hostHasKey, "hostHasKey");
|
|
7412
|
+
function configurationError(error) {
|
|
7413
|
+
if (error instanceof Error && error.message.startsWith("[BymaxAuthModule]")) return error;
|
|
7414
|
+
return new Error("[BymaxAuthModule] the options could not be read: the factory, a getter or a Proxy of the host threw", {
|
|
7415
|
+
cause: error
|
|
7416
|
+
});
|
|
7417
|
+
}
|
|
7418
|
+
__name(configurationError, "configurationError");
|
|
7419
|
+
function define(copy, key, value, enumerable) {
|
|
7420
|
+
Object.defineProperty(copy, key, {
|
|
7421
|
+
value,
|
|
7422
|
+
enumerable,
|
|
7423
|
+
writable: true,
|
|
7424
|
+
configurable: true
|
|
7425
|
+
});
|
|
7426
|
+
}
|
|
7427
|
+
__name(define, "define");
|
|
7428
|
+
var ENTITIES = /* @__PURE__ */ new WeakMap();
|
|
7429
|
+
function refuseBreadth(size) {
|
|
7430
|
+
if (size > MAX_BREADTH) throw new Error("the answer holds more than the library follows");
|
|
7431
|
+
}
|
|
7432
|
+
__name(refuseBreadth, "refuseBreadth");
|
|
7433
|
+
function isDateLike(value) {
|
|
7434
|
+
return util.types.isDate(value) || util.types.isProxy(value) && value instanceof Date;
|
|
7435
|
+
}
|
|
7436
|
+
__name(isDateLike, "isDateLike");
|
|
7437
|
+
function isPlainObject(value) {
|
|
7438
|
+
const prototype = Object.getPrototypeOf(value);
|
|
7439
|
+
return prototype === null || Object.getPrototypeOf(prototype) === null;
|
|
7440
|
+
}
|
|
7441
|
+
__name(isPlainObject, "isPlainObject");
|
|
7442
|
+
var WRONG_KIND = "the answer holds a value that is not the kind its method promises";
|
|
7443
|
+
var ABSENT = "the answer lacks a field its method promises";
|
|
7444
|
+
var NOT_A_TIME = "the answer holds a date that is not a time";
|
|
7445
|
+
function accept(ok, value) {
|
|
7446
|
+
if (!ok) throw new Error(WRONG_KIND);
|
|
7447
|
+
return value;
|
|
7448
|
+
}
|
|
7449
|
+
__name(accept, "accept");
|
|
7450
|
+
function isHostInstance(value) {
|
|
7451
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) && !util.types.isBoxedPrimitive(value) && !isPlainObject(value);
|
|
7452
|
+
}
|
|
7453
|
+
__name(isHostInstance, "isHostInstance");
|
|
7454
|
+
function copyDate(value) {
|
|
7455
|
+
if (typeof value !== "object" || value === null || !isDateLike(value)) throw new Error(WRONG_KIND);
|
|
7456
|
+
const time = value.getTime();
|
|
7457
|
+
const copy = new Date(typeof time === "number" ? time : Number.NaN);
|
|
7458
|
+
if (Number.isNaN(copy.getTime())) throw new Error(NOT_A_TIME);
|
|
7459
|
+
return copy;
|
|
7460
|
+
}
|
|
7461
|
+
__name(copyDate, "copyDate");
|
|
7462
|
+
function copyStrings(value) {
|
|
7463
|
+
if (!Array.isArray(value)) throw new Error(WRONG_KIND);
|
|
7464
|
+
refuseBreadth(value.length);
|
|
7465
|
+
const copy = [];
|
|
7466
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
7467
|
+
const element = value[index];
|
|
7468
|
+
copy.push(accept(typeof element === "string", element));
|
|
7469
|
+
}
|
|
7470
|
+
return copy;
|
|
7471
|
+
}
|
|
7472
|
+
__name(copyStrings, "copyStrings");
|
|
7473
|
+
function readInforming(value) {
|
|
7474
|
+
return accept(typeof value === "string" || Number.isFinite(value) || isHostInstance(value), value);
|
|
7475
|
+
}
|
|
7476
|
+
__name(readInforming, "readInforming");
|
|
7477
|
+
function readInformingDate(value) {
|
|
7478
|
+
if (typeof value === "string" || Number.isFinite(value)) return value;
|
|
7479
|
+
if (!isHostInstance(value)) throw new Error(WRONG_KIND);
|
|
7480
|
+
if (!isDateLike(value)) return value;
|
|
7481
|
+
const time = value.getTime();
|
|
7482
|
+
const copy = new Date(typeof time === "number" ? time : Number.NaN);
|
|
7483
|
+
return Number.isNaN(copy.getTime()) ? value : copy;
|
|
7484
|
+
}
|
|
7485
|
+
__name(readInformingDate, "readInformingDate");
|
|
7486
|
+
var READERS = {
|
|
7487
|
+
boolean: /* @__PURE__ */ __name((value) => accept(typeof value === "boolean", value), "boolean"),
|
|
7488
|
+
string: /* @__PURE__ */ __name((value) => accept(typeof value === "string", value), "string"),
|
|
7489
|
+
number: /* @__PURE__ */ __name((value) => accept(Number.isFinite(value), value), "number"),
|
|
7490
|
+
id: /* @__PURE__ */ __name((value) => accept(typeof value === "string" || isHostInstance(value), value), "id"),
|
|
7491
|
+
date: copyDate,
|
|
7492
|
+
strings: copyStrings,
|
|
7493
|
+
"~id": readInforming,
|
|
7494
|
+
"~string": readInforming,
|
|
7495
|
+
"~date": readInformingDate
|
|
7496
|
+
};
|
|
7497
|
+
function parseSpec(spec) {
|
|
7498
|
+
const lenient = spec.startsWith("~");
|
|
7499
|
+
const optional = lenient || spec.endsWith("?");
|
|
7500
|
+
const rest = spec.endsWith("?") ? spec.slice(0, -1) : spec;
|
|
7501
|
+
const nullable = lenient || rest.endsWith("|null");
|
|
7502
|
+
return {
|
|
7503
|
+
base: rest.endsWith("|null") ? rest.slice(0, -"|null".length) : rest,
|
|
7504
|
+
nullable,
|
|
7505
|
+
optional
|
|
7506
|
+
};
|
|
7507
|
+
}
|
|
7508
|
+
__name(parseSpec, "parseSpec");
|
|
7509
|
+
function readNull(nullable) {
|
|
7510
|
+
if (!nullable) throw new Error(WRONG_KIND);
|
|
7511
|
+
return null;
|
|
7512
|
+
}
|
|
7513
|
+
__name(readNull, "readNull");
|
|
7514
|
+
function readScalar(value, spec) {
|
|
7515
|
+
const { base, nullable } = parseSpec(spec);
|
|
7516
|
+
if (base === "void") return void 0;
|
|
7517
|
+
return value === null ? readNull(nullable) : READERS[base](value);
|
|
7518
|
+
}
|
|
7519
|
+
__name(readScalar, "readScalar");
|
|
7520
|
+
function copyRecord(value, contract, seen) {
|
|
7521
|
+
const copy = {};
|
|
7522
|
+
rememberUnder(seen, value, contract, copy);
|
|
7523
|
+
ENTITIES.set(copy, value);
|
|
7524
|
+
const source = value;
|
|
7525
|
+
const keys = Object.keys(value);
|
|
7526
|
+
refuseBreadth(keys.length);
|
|
7527
|
+
for (const key of keys) {
|
|
7528
|
+
if (Object.hasOwn(contract.fields, key)) continue;
|
|
7529
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
7530
|
+
if (descriptor !== void 0 && "value" in descriptor) define(copy, key, descriptor.value, true);
|
|
7531
|
+
}
|
|
7532
|
+
const own = new Set(keys);
|
|
7533
|
+
for (const [field, spec] of Object.entries(contract.fields)) {
|
|
7534
|
+
const { base, nullable, optional } = parseSpec(spec);
|
|
7535
|
+
const read = source[field];
|
|
7536
|
+
if (read === void 0) {
|
|
7537
|
+
if (optional) continue;
|
|
7538
|
+
throw new Error(ABSENT);
|
|
7539
|
+
}
|
|
7540
|
+
const copied = read === null ? readNull(nullable || optional) : base === "nested" ? applyContract(read, contract.nested[field], seen) : READERS[base](read);
|
|
7541
|
+
define(copy, field, copied, own.has(field) || !CREDENTIAL_FIELDS.has(field));
|
|
7542
|
+
}
|
|
7543
|
+
return copy;
|
|
7544
|
+
}
|
|
7545
|
+
__name(copyRecord, "copyRecord");
|
|
7546
|
+
function applyContract(value, contract, seen) {
|
|
7547
|
+
if (typeof value !== "object" || value === null) throw new Error(WRONG_KIND);
|
|
7548
|
+
const known = copiedUnder(seen, value, contract);
|
|
7549
|
+
if (known !== void 0) return known;
|
|
7550
|
+
if ("list" in contract) {
|
|
7551
|
+
if (!Array.isArray(value)) throw new Error("the answer is not the list its method promises");
|
|
7552
|
+
refuseBreadth(value.length);
|
|
7553
|
+
const copy = [];
|
|
7554
|
+
rememberUnder(seen, value, contract, copy);
|
|
7555
|
+
for (let index = 0; index < value.length; index += 1) copy.push(applyContract(value[index], contract.list, seen));
|
|
7556
|
+
return copy;
|
|
7557
|
+
}
|
|
7558
|
+
if (Array.isArray(value)) throw new Error("the answer is not the record its method promises");
|
|
7559
|
+
return copyRecord(value, contract, seen);
|
|
7560
|
+
}
|
|
7561
|
+
__name(applyContract, "applyContract");
|
|
7562
|
+
function copyHostRecord(record, contract) {
|
|
7563
|
+
try {
|
|
7564
|
+
if (typeof contract === "string") return readScalar(record, contract);
|
|
7565
|
+
if ((record === null || record === void 0) && contract.nullable === true) return record;
|
|
7566
|
+
return applyContract(record, contract, /* @__PURE__ */ new WeakMap());
|
|
7567
|
+
} catch (error) {
|
|
7568
|
+
throw new AuthException(AUTH_ERROR_CODES.INTERNAL, void 0, {
|
|
7569
|
+
cause: error
|
|
7570
|
+
});
|
|
7571
|
+
}
|
|
7572
|
+
}
|
|
7573
|
+
__name(copyHostRecord, "copyHostRecord");
|
|
7574
|
+
function isTypedError(error) {
|
|
7575
|
+
try {
|
|
7576
|
+
return error instanceof common.HttpException;
|
|
7577
|
+
} catch {
|
|
7578
|
+
return false;
|
|
7579
|
+
}
|
|
7580
|
+
}
|
|
7581
|
+
__name(isTypedError, "isTypedError");
|
|
7582
|
+
var LIFECYCLE_HOOKS = /* @__PURE__ */ new Set([
|
|
7583
|
+
"onModuleInit",
|
|
7584
|
+
"onApplicationBootstrap",
|
|
7585
|
+
"onModuleDestroy",
|
|
7586
|
+
"beforeApplicationShutdown",
|
|
7587
|
+
"onApplicationShutdown"
|
|
7588
|
+
]);
|
|
7589
|
+
function hostEntityOf(record) {
|
|
7590
|
+
return typeof record === "object" && record !== null ? ENTITIES.get(record) ?? record : record;
|
|
7591
|
+
}
|
|
7592
|
+
__name(hostEntityOf, "hostEntityOf");
|
|
7593
|
+
function guardRepository(host, contract) {
|
|
7594
|
+
return new Proxy({}, {
|
|
7595
|
+
get(_target, key) {
|
|
7596
|
+
if (LIFECYCLE_HOOKS.has(key)) return void 0;
|
|
7597
|
+
let member;
|
|
7598
|
+
try {
|
|
7599
|
+
member = Reflect.get(host, key, host);
|
|
7600
|
+
} catch (error) {
|
|
7601
|
+
if (key === "then" || typeof key === "symbol") return void 0;
|
|
7602
|
+
return async () => {
|
|
7603
|
+
throw new AuthException(AUTH_ERROR_CODES.INTERNAL, void 0, {
|
|
7604
|
+
cause: error
|
|
7605
|
+
});
|
|
7606
|
+
};
|
|
7607
|
+
}
|
|
7608
|
+
if (typeof member !== "function") return member;
|
|
7609
|
+
return async (...args) => {
|
|
7610
|
+
let answer;
|
|
7611
|
+
try {
|
|
7612
|
+
answer = await member.apply(host, args);
|
|
7613
|
+
} catch (error) {
|
|
7614
|
+
if (isTypedError(error)) throw error;
|
|
7615
|
+
throw new AuthException(AUTH_ERROR_CODES.INTERNAL, void 0, {
|
|
7616
|
+
cause: error
|
|
7617
|
+
});
|
|
7618
|
+
}
|
|
7619
|
+
const promised = typeof key === "string" && Object.hasOwn(contract, key) ? contract[key] : void 0;
|
|
7620
|
+
return promised === void 0 ? answer : copyHostRecord(answer, promised);
|
|
7621
|
+
};
|
|
7622
|
+
}
|
|
7623
|
+
});
|
|
7624
|
+
}
|
|
7625
|
+
__name(guardRepository, "guardRepository");
|
|
7626
|
+
var GUARDED_BY_HOST = /* @__PURE__ */ new Map([
|
|
7627
|
+
[
|
|
7628
|
+
BYMAX_AUTH_USER_REPOSITORY,
|
|
7629
|
+
[
|
|
7630
|
+
GUARDED_USER_REPOSITORY,
|
|
7631
|
+
USER_REPOSITORY_CONTRACT
|
|
7632
|
+
]
|
|
7633
|
+
],
|
|
7634
|
+
[
|
|
7635
|
+
BYMAX_AUTH_PLATFORM_USER_REPOSITORY,
|
|
7636
|
+
[
|
|
7637
|
+
GUARDED_PLATFORM_USER_REPOSITORY,
|
|
7638
|
+
PLATFORM_USER_REPOSITORY_CONTRACT
|
|
7639
|
+
]
|
|
7640
|
+
],
|
|
7641
|
+
[
|
|
7642
|
+
BYMAX_AUTH_API_KEY_REPOSITORY,
|
|
7643
|
+
[
|
|
7644
|
+
GUARDED_API_KEY_REPOSITORY,
|
|
7645
|
+
API_KEY_REPOSITORY_CONTRACT
|
|
7646
|
+
]
|
|
7647
|
+
],
|
|
7648
|
+
[
|
|
7649
|
+
BYMAX_AUTH_WORKSPACE_REPOSITORY,
|
|
7650
|
+
[
|
|
7651
|
+
GUARDED_WORKSPACE_REPOSITORY,
|
|
7652
|
+
WORKSPACE_REPOSITORY_CONTRACT
|
|
7653
|
+
]
|
|
7654
|
+
],
|
|
7655
|
+
[
|
|
7656
|
+
BYMAX_AUTH_MEMBERSHIP_REPOSITORY,
|
|
7657
|
+
[
|
|
7658
|
+
GUARDED_MEMBERSHIP_REPOSITORY,
|
|
7659
|
+
MEMBERSHIP_REPOSITORY_CONTRACT
|
|
7660
|
+
]
|
|
7661
|
+
]
|
|
7662
|
+
]);
|
|
7663
|
+
function guardedViewProvider(host, guarded, contract) {
|
|
7664
|
+
return {
|
|
7665
|
+
provide: guarded,
|
|
7666
|
+
useFactory: /* @__PURE__ */ __name((repository) => guardRepository(repository, contract), "useFactory"),
|
|
7667
|
+
inject: [
|
|
7668
|
+
host
|
|
7669
|
+
]
|
|
7670
|
+
};
|
|
7671
|
+
}
|
|
7672
|
+
__name(guardedViewProvider, "guardedViewProvider");
|
|
7673
|
+
function withGuardedViews(providers) {
|
|
7674
|
+
const views = [
|
|
7675
|
+
...GUARDED_BY_HOST
|
|
7676
|
+
].filter(([host]) => providers.some((provider) => typeof provider !== "function" && "provide" in provider && provider.provide === host)).map(([host, [guarded, contract]]) => guardedViewProvider(host, guarded, contract));
|
|
7677
|
+
return [
|
|
7678
|
+
...providers,
|
|
7679
|
+
...views
|
|
7680
|
+
];
|
|
7681
|
+
}
|
|
7682
|
+
__name(withGuardedViews, "withGuardedViews");
|
|
7683
|
+
|
|
7153
7684
|
// src/server/utils/run-detached.ts
|
|
7154
7685
|
function runDetached(logger, run, hook) {
|
|
7155
7686
|
try {
|
|
@@ -7884,10 +8415,9 @@ exports.SessionService = class _SessionService {
|
|
|
7884
8415
|
/**
|
|
7885
8416
|
* Resolves the maximum number of concurrent sessions allowed for a user.
|
|
7886
8417
|
*
|
|
7887
|
-
* When `options.sessions.maxSessionsResolver` is configured, it is called with
|
|
7888
|
-
*
|
|
7889
|
-
* the
|
|
7890
|
-
* with something that is not a usable limit.
|
|
8418
|
+
* When `options.sessions.maxSessionsResolver` is configured, it is called with the entity the user
|
|
8419
|
+
* repository returned. Falls back to `options.sessions.defaultMaxSessions` if the resolver is absent,
|
|
8420
|
+
* the user cannot be found, the resolver throws, or it answers with an unusable limit.
|
|
7891
8421
|
*
|
|
7892
8422
|
* That last case is the one that mattered. The resolver is the host's code and its return
|
|
7893
8423
|
* value went straight into the eviction arithmetic, where `NaN` — the result of, say,
|
|
@@ -7912,7 +8442,7 @@ exports.SessionService = class _SessionService {
|
|
|
7912
8442
|
tenantId
|
|
7913
8443
|
});
|
|
7914
8444
|
if (!user) return defaultMaxSessions;
|
|
7915
|
-
const resolved = await maxSessionsResolver(user);
|
|
8445
|
+
const resolved = await maxSessionsResolver(hostEntityOf(user));
|
|
7916
8446
|
if (!Number.isInteger(resolved) || resolved < 1) {
|
|
7917
8447
|
logEvent(this.logger, "AUTH_SESSION_LIMIT_RESOLVER_INVALID");
|
|
7918
8448
|
return defaultMaxSessions;
|
|
@@ -7927,7 +8457,7 @@ exports.SessionService = class _SessionService {
|
|
|
7927
8457
|
exports.SessionService = _ts_decorate21([
|
|
7928
8458
|
common.Injectable(),
|
|
7929
8459
|
_ts_param13(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
7930
|
-
_ts_param13(1, common.Inject(
|
|
8460
|
+
_ts_param13(1, common.Inject(GUARDED_USER_REPOSITORY)),
|
|
7931
8461
|
_ts_param13(2, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
7932
8462
|
_ts_param13(2, common.Optional()),
|
|
7933
8463
|
_ts_param13(3, common.Inject(AuthRedisService)),
|
|
@@ -10136,7 +10666,7 @@ exports.AuthService = class _AuthService {
|
|
|
10136
10666
|
exports.AuthService = _ts_decorate23([
|
|
10137
10667
|
common.Injectable(),
|
|
10138
10668
|
_ts_param15(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
10139
|
-
_ts_param15(1, common.Inject(
|
|
10669
|
+
_ts_param15(1, common.Inject(GUARDED_USER_REPOSITORY)),
|
|
10140
10670
|
_ts_param15(2, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
10141
10671
|
_ts_param15(2, common.Optional()),
|
|
10142
10672
|
_ts_param15(3, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
@@ -10347,7 +10877,7 @@ exports.WsTicketService = _ts_decorate24([
|
|
|
10347
10877
|
common.Injectable(),
|
|
10348
10878
|
_ts_param16(0, common.Inject(AuthRedisService)),
|
|
10349
10879
|
_ts_param16(1, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
10350
|
-
_ts_param16(2, common.Inject(
|
|
10880
|
+
_ts_param16(2, common.Inject(GUARDED_USER_REPOSITORY)),
|
|
10351
10881
|
_ts_param16(3, common.Inject(exports.AuthRevocationService)),
|
|
10352
10882
|
_ts_metadata21("design:type", Function),
|
|
10353
10883
|
_ts_metadata21("design:paramtypes", [
|
|
@@ -11047,7 +11577,7 @@ exports.EmailChangeService = class _EmailChangeService {
|
|
|
11047
11577
|
exports.EmailChangeService = _ts_decorate28([
|
|
11048
11578
|
common.Injectable(),
|
|
11049
11579
|
_ts_param18(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
11050
|
-
_ts_param18(1, common.Inject(
|
|
11580
|
+
_ts_param18(1, common.Inject(GUARDED_USER_REPOSITORY)),
|
|
11051
11581
|
_ts_param18(2, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
11052
11582
|
_ts_param18(3, common.Inject(PasswordService)),
|
|
11053
11583
|
_ts_param18(4, common.Inject(AuthRedisService)),
|
|
@@ -11877,7 +12407,7 @@ exports.InvitationService = class _InvitationService {
|
|
|
11877
12407
|
};
|
|
11878
12408
|
exports.InvitationService = _ts_decorate33([
|
|
11879
12409
|
common.Injectable(),
|
|
11880
|
-
_ts_param20(0, common.Inject(
|
|
12410
|
+
_ts_param20(0, common.Inject(GUARDED_USER_REPOSITORY)),
|
|
11881
12411
|
_ts_param20(1, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
11882
12412
|
_ts_param20(2, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
11883
12413
|
_ts_param20(3, common.Inject(AuthRedisService)),
|
|
@@ -12775,9 +13305,9 @@ var MfaRecordService = class {
|
|
|
12775
13305
|
MfaRecordService = _ts_decorate41([
|
|
12776
13306
|
common.Injectable(),
|
|
12777
13307
|
_ts_param23(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
12778
|
-
_ts_param23(1, common.Inject(
|
|
13308
|
+
_ts_param23(1, common.Inject(GUARDED_USER_REPOSITORY)),
|
|
12779
13309
|
_ts_param23(2, common.Optional()),
|
|
12780
|
-
_ts_param23(2, common.Inject(
|
|
13310
|
+
_ts_param23(2, common.Inject(GUARDED_PLATFORM_USER_REPOSITORY)),
|
|
12781
13311
|
_ts_param23(3, common.Inject(AuthRedisService)),
|
|
12782
13312
|
_ts_metadata38("design:type", Function),
|
|
12783
13313
|
_ts_metadata38("design:paramtypes", [
|
|
@@ -13173,9 +13703,9 @@ var MfaChallengeService = class {
|
|
|
13173
13703
|
MfaChallengeService = _ts_decorate42([
|
|
13174
13704
|
common.Injectable(),
|
|
13175
13705
|
_ts_param24(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
13176
|
-
_ts_param24(1, common.Inject(
|
|
13706
|
+
_ts_param24(1, common.Inject(GUARDED_USER_REPOSITORY)),
|
|
13177
13707
|
_ts_param24(2, common.Optional()),
|
|
13178
|
-
_ts_param24(2, common.Inject(
|
|
13708
|
+
_ts_param24(2, common.Inject(GUARDED_PLATFORM_USER_REPOSITORY)),
|
|
13179
13709
|
_ts_param24(3, common.Inject(TokenManagerService)),
|
|
13180
13710
|
_ts_param24(4, common.Inject(MfaFlowLockoutService)),
|
|
13181
13711
|
_ts_param24(5, common.Inject(MfaRecordService)),
|
|
@@ -13567,7 +14097,7 @@ MfaManagementService = _ts_decorate43([
|
|
|
13567
14097
|
common.Injectable(),
|
|
13568
14098
|
_ts_param25(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
13569
14099
|
_ts_param25(1, common.Optional()),
|
|
13570
|
-
_ts_param25(1, common.Inject(
|
|
14100
|
+
_ts_param25(1, common.Inject(GUARDED_PLATFORM_USER_REPOSITORY)),
|
|
13571
14101
|
_ts_param25(2, common.Inject(AuthRedisService)),
|
|
13572
14102
|
_ts_param25(3, common.Inject(MfaFlowLockoutService)),
|
|
13573
14103
|
_ts_param25(4, common.Inject(MfaRecordService)),
|
|
@@ -14089,9 +14619,9 @@ exports.MfaService = class _MfaService {
|
|
|
14089
14619
|
exports.MfaService = _ts_decorate45([
|
|
14090
14620
|
common.Injectable(),
|
|
14091
14621
|
_ts_param27(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
14092
|
-
_ts_param27(1, common.Inject(
|
|
14622
|
+
_ts_param27(1, common.Inject(GUARDED_USER_REPOSITORY)),
|
|
14093
14623
|
_ts_param27(2, common.Optional()),
|
|
14094
|
-
_ts_param27(2, common.Inject(
|
|
14624
|
+
_ts_param27(2, common.Inject(GUARDED_PLATFORM_USER_REPOSITORY)),
|
|
14095
14625
|
_ts_param27(3, common.Inject(AuthRedisService)),
|
|
14096
14626
|
_ts_param27(4, common.Inject(TokenManagerService)),
|
|
14097
14627
|
_ts_param27(5, common.Inject(MfaRecordService)),
|
|
@@ -15482,7 +16012,7 @@ exports.PasswordResetService = class _PasswordResetService {
|
|
|
15482
16012
|
exports.PasswordResetService = _ts_decorate52([
|
|
15483
16013
|
common.Injectable(),
|
|
15484
16014
|
_ts_param29(0, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
15485
|
-
_ts_param29(1, common.Inject(
|
|
16015
|
+
_ts_param29(1, common.Inject(GUARDED_USER_REPOSITORY)),
|
|
15486
16016
|
_ts_param29(2, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
15487
16017
|
_ts_param29(2, common.Optional()),
|
|
15488
16018
|
_ts_param29(3, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
@@ -16238,7 +16768,7 @@ exports.PlatformAuthService = class _PlatformAuthService {
|
|
|
16238
16768
|
};
|
|
16239
16769
|
exports.PlatformAuthService = _ts_decorate56([
|
|
16240
16770
|
common.Injectable(),
|
|
16241
|
-
_ts_param32(0, common.Inject(
|
|
16771
|
+
_ts_param32(0, common.Inject(GUARDED_PLATFORM_USER_REPOSITORY)),
|
|
16242
16772
|
_ts_param32(1, common.Inject(PasswordService)),
|
|
16243
16773
|
_ts_param32(2, common.Inject(TokenManagerService)),
|
|
16244
16774
|
_ts_param32(3, common.Inject(exports.BruteForceService)),
|
|
@@ -17522,8 +18052,8 @@ exports.WorkspaceAccessService = class _WorkspaceAccessService {
|
|
|
17522
18052
|
exports.WorkspaceAccessService = _ts_decorate66([
|
|
17523
18053
|
common.Injectable(),
|
|
17524
18054
|
_ts_param36(0, common.Inject(AuthRedisService)),
|
|
17525
|
-
_ts_param36(1, common.Inject(
|
|
17526
|
-
_ts_param36(2, common.Inject(
|
|
18055
|
+
_ts_param36(1, common.Inject(GUARDED_WORKSPACE_REPOSITORY)),
|
|
18056
|
+
_ts_param36(2, common.Inject(GUARDED_MEMBERSHIP_REPOSITORY)),
|
|
17527
18057
|
_ts_param36(3, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
17528
18058
|
_ts_param36(4, common.Inject(exports.AccountStatusService)),
|
|
17529
18059
|
_ts_param36(4, common.Optional()),
|
|
@@ -18402,7 +18932,7 @@ exports.MembershipService = class MembershipService {
|
|
|
18402
18932
|
};
|
|
18403
18933
|
exports.MembershipService = _ts_decorate70([
|
|
18404
18934
|
common.Injectable(),
|
|
18405
|
-
_ts_param40(0, common.Inject(
|
|
18935
|
+
_ts_param40(0, common.Inject(GUARDED_MEMBERSHIP_REPOSITORY)),
|
|
18406
18936
|
_ts_param40(1, common.Inject(exports.WorkspaceAccessService)),
|
|
18407
18937
|
_ts_param40(2, common.Inject(WorkspaceEventsService)),
|
|
18408
18938
|
_ts_param40(3, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
@@ -19107,9 +19637,9 @@ WorkspaceInvitationAcceptService = _ts_decorate72([
|
|
|
19107
19637
|
_ts_param42(4, common.Inject(PasswordService)),
|
|
19108
19638
|
_ts_param42(5, common.Inject(TokenManagerService)),
|
|
19109
19639
|
_ts_param42(6, common.Inject(exports.SessionService)),
|
|
19110
|
-
_ts_param42(7, common.Inject(
|
|
19111
|
-
_ts_param42(8, common.Inject(
|
|
19112
|
-
_ts_param42(9, common.Inject(
|
|
19640
|
+
_ts_param42(7, common.Inject(GUARDED_USER_REPOSITORY)),
|
|
19641
|
+
_ts_param42(8, common.Inject(GUARDED_WORKSPACE_REPOSITORY)),
|
|
19642
|
+
_ts_param42(9, common.Inject(GUARDED_MEMBERSHIP_REPOSITORY)),
|
|
19113
19643
|
_ts_param42(10, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
19114
19644
|
_ts_param42(11, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
19115
19645
|
_ts_metadata69("design:type", Function),
|
|
@@ -19591,9 +20121,9 @@ exports.WorkspaceInvitationService = _ts_decorate73([
|
|
|
19591
20121
|
_ts_param43(1, common.Inject(AuthRedisService)),
|
|
19592
20122
|
_ts_param43(2, common.Inject(exports.MembershipService)),
|
|
19593
20123
|
_ts_param43(3, common.Inject(WorkspaceEventsService)),
|
|
19594
|
-
_ts_param43(4, common.Inject(
|
|
19595
|
-
_ts_param43(5, common.Inject(
|
|
19596
|
-
_ts_param43(6, common.Inject(
|
|
20124
|
+
_ts_param43(4, common.Inject(GUARDED_USER_REPOSITORY)),
|
|
20125
|
+
_ts_param43(5, common.Inject(GUARDED_WORKSPACE_REPOSITORY)),
|
|
20126
|
+
_ts_param43(6, common.Inject(GUARDED_MEMBERSHIP_REPOSITORY)),
|
|
19597
20127
|
_ts_param43(7, common.Inject(BYMAX_AUTH_EMAIL_PROVIDER)),
|
|
19598
20128
|
_ts_param43(8, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
19599
20129
|
_ts_metadata70("design:type", Function),
|
|
@@ -20274,7 +20804,7 @@ exports.WorkspaceCallerService = class WorkspaceCallerService {
|
|
|
20274
20804
|
};
|
|
20275
20805
|
exports.WorkspaceCallerService = _ts_decorate81([
|
|
20276
20806
|
common.Injectable(),
|
|
20277
|
-
_ts_param45(0, common.Inject(
|
|
20807
|
+
_ts_param45(0, common.Inject(GUARDED_USER_REPOSITORY)),
|
|
20278
20808
|
_ts_param45(1, common.Inject(exports.ReauthenticationService)),
|
|
20279
20809
|
_ts_metadata78("design:type", Function),
|
|
20280
20810
|
_ts_metadata78("design:paramtypes", [
|
|
@@ -20611,8 +21141,8 @@ exports.WorkspaceService = class WorkspaceService {
|
|
|
20611
21141
|
};
|
|
20612
21142
|
exports.WorkspaceService = _ts_decorate82([
|
|
20613
21143
|
common.Injectable(),
|
|
20614
|
-
_ts_param46(0, common.Inject(
|
|
20615
|
-
_ts_param46(1, common.Inject(
|
|
21144
|
+
_ts_param46(0, common.Inject(GUARDED_WORKSPACE_REPOSITORY)),
|
|
21145
|
+
_ts_param46(1, common.Inject(GUARDED_MEMBERSHIP_REPOSITORY)),
|
|
20616
21146
|
_ts_param46(2, common.Inject(exports.WorkspaceAccessService)),
|
|
20617
21147
|
_ts_param46(3, common.Inject(WorkspaceEventsService)),
|
|
20618
21148
|
_ts_param46(4, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
@@ -21414,7 +21944,7 @@ var ApiKeyLastUsedService = class _ApiKeyLastUsedService {
|
|
|
21414
21944
|
};
|
|
21415
21945
|
ApiKeyLastUsedService = _ts_decorate85([
|
|
21416
21946
|
common.Injectable(),
|
|
21417
|
-
_ts_param49(0, common.Inject(
|
|
21947
|
+
_ts_param49(0, common.Inject(GUARDED_API_KEY_REPOSITORY)),
|
|
21418
21948
|
_ts_param49(1, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
21419
21949
|
_ts_metadata82("design:type", Function),
|
|
21420
21950
|
_ts_metadata82("design:paramtypes", [
|
|
@@ -21553,7 +22083,7 @@ var ApiKeyVerifierService = class {
|
|
|
21553
22083
|
};
|
|
21554
22084
|
ApiKeyVerifierService = _ts_decorate86([
|
|
21555
22085
|
common.Injectable(),
|
|
21556
|
-
_ts_param50(0, common.Inject(
|
|
22086
|
+
_ts_param50(0, common.Inject(GUARDED_API_KEY_REPOSITORY)),
|
|
21557
22087
|
_ts_param50(1, common.Inject(BYMAX_AUTH_API_KEY_CLOCK)),
|
|
21558
22088
|
_ts_param50(2, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
21559
22089
|
_ts_param50(3, common.Inject(ApiKeyLastUsedService)),
|
|
@@ -22708,7 +23238,7 @@ exports.OAuthService = class _OAuthService {
|
|
|
22708
23238
|
exports.OAuthService = _ts_decorate93([
|
|
22709
23239
|
common.Injectable(),
|
|
22710
23240
|
_ts_param56(0, common.Inject(OAUTH_PLUGINS)),
|
|
22711
|
-
_ts_param56(1, common.Inject(
|
|
23241
|
+
_ts_param56(1, common.Inject(GUARDED_USER_REPOSITORY)),
|
|
22712
23242
|
_ts_param56(2, common.Inject(BYMAX_AUTH_HOOKS)),
|
|
22713
23243
|
_ts_param56(2, common.Optional()),
|
|
22714
23244
|
_ts_param56(3, common.Inject(AuthRedisService)),
|
|
@@ -23461,9 +23991,10 @@ var OAuthModule = class _OAuthModule {
|
|
|
23461
23991
|
/**
|
|
23462
23992
|
* Returns the provider array for inline inclusion in `BymaxAuthModule`.
|
|
23463
23993
|
*
|
|
23464
|
-
* Includes `OAUTH_PLUGINS` (value provider)
|
|
23465
|
-
*
|
|
23466
|
-
* `
|
|
23994
|
+
* Includes `OAUTH_PLUGINS` (value provider), `OAuthService` and the guarded view of the host's user repository
|
|
23995
|
+
* that `OAuthService` reads, built from the repository the host provides under `BYMAX_AUTH_USER_REPOSITORY`.
|
|
23996
|
+
* All other dependencies (`AuthRedisService`, etc.) are expected to be present in the parent module's own
|
|
23997
|
+
* providers array.
|
|
23467
23998
|
*
|
|
23468
23999
|
* @param options - Fully resolved options from `resolveOptions()`.
|
|
23469
24000
|
* @returns Provider array ready to be spread into a parent module's `providers`.
|
|
@@ -23474,7 +24005,8 @@ var OAuthModule = class _OAuthModule {
|
|
|
23474
24005
|
provide: OAUTH_PLUGINS,
|
|
23475
24006
|
useValue: buildOAuthPlugins(options)
|
|
23476
24007
|
},
|
|
23477
|
-
exports.OAuthService
|
|
24008
|
+
exports.OAuthService,
|
|
24009
|
+
guardedViewProvider(BYMAX_AUTH_USER_REPOSITORY, GUARDED_USER_REPOSITORY, USER_REPOSITORY_CONTRACT)
|
|
23478
24010
|
];
|
|
23479
24011
|
}
|
|
23480
24012
|
/**
|
|
@@ -25671,7 +26203,7 @@ exports.ApiKeyService = class ApiKeyService {
|
|
|
25671
26203
|
};
|
|
25672
26204
|
exports.ApiKeyService = _ts_decorate104([
|
|
25673
26205
|
common.Injectable(),
|
|
25674
|
-
_ts_param63(0, common.Inject(
|
|
26206
|
+
_ts_param63(0, common.Inject(GUARDED_API_KEY_REPOSITORY)),
|
|
25675
26207
|
_ts_param63(1, common.Inject(BYMAX_AUTH_API_KEY_CLOCK)),
|
|
25676
26208
|
_ts_param63(2, common.Inject(BYMAX_AUTH_OPTIONS)),
|
|
25677
26209
|
_ts_metadata98("design:type", Function),
|
|
@@ -26090,11 +26622,11 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
26090
26622
|
const resolvedOptionsProvider = {
|
|
26091
26623
|
provide: BYMAX_AUTH_OPTIONS,
|
|
26092
26624
|
useFactory: /* @__PURE__ */ __name(async (...args) => {
|
|
26093
|
-
const userOptions = await options.useFactory
|
|
26094
|
-
if ("controllers"
|
|
26625
|
+
const { value: userOptions } = await callFactory(options.useFactory, args);
|
|
26626
|
+
if (hostHasKey(userOptions, "controllers")) {
|
|
26095
26627
|
throw new Error("[BymaxAuthModule] `controllers` must be passed to registerAsync() itself, not returned from useFactory \u2014 the module is assembled before the factory runs, so flags returned here are ignored and the endpoints are never registered.");
|
|
26096
26628
|
}
|
|
26097
|
-
const resolved = resolveOptions(userOptions);
|
|
26629
|
+
const resolved = readHostOptions(() => resolveOptions(userOptions));
|
|
26098
26630
|
if (includeMfa && resolved.mfa === void 0) {
|
|
26099
26631
|
throw new Error("[BymaxAuthModule] controllers.mfa: true requires the mfa group (encryptionKey and issuer) to be configured in the useFactory return value.");
|
|
26100
26632
|
}
|
|
@@ -26252,9 +26784,9 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
26252
26784
|
// The factory runs here too, so it needs the modules the consumer's `inject` tokens come from.
|
|
26253
26785
|
imports: options.imports ?? [],
|
|
26254
26786
|
useFactory: /* @__PURE__ */ __name(async (...args) => {
|
|
26255
|
-
const userOptions = await options.useFactory
|
|
26787
|
+
const { value: userOptions } = await callFactory(options.useFactory, args);
|
|
26256
26788
|
return {
|
|
26257
|
-
secret: userOptions.jwt.secret,
|
|
26789
|
+
secret: readHostOptions(() => userOptions.jwt.secret),
|
|
26258
26790
|
// Stryker disable next-line ObjectLiteral: jsonwebtoken defaults to HS256 and TokenManagerService overrides signOptions per call, so the emptied `signOptions` produces identical signing
|
|
26259
26791
|
signOptions: {
|
|
26260
26792
|
algorithm: "HS256"
|
|
@@ -26266,7 +26798,7 @@ exports.BymaxAuthModule = class _BymaxAuthModule {
|
|
|
26266
26798
|
],
|
|
26267
26799
|
providers: [
|
|
26268
26800
|
// Consumer-supplied providers first so they can override internal ones.
|
|
26269
|
-
...extraProviders,
|
|
26801
|
+
...withGuardedViews(extraProviders),
|
|
26270
26802
|
// Resolved options (depends on consumer's inject tokens).
|
|
26271
26803
|
resolvedOptionsProvider,
|
|
26272
26804
|
// Which controllers this registration mounted, and the contributor that reads it.
|