@dereekb/firebase-server 13.6.17 → 13.8.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.
Files changed (47) hide show
  1. package/index.cjs.js +4233 -1923
  2. package/index.esm.js +4204 -1904
  3. package/mailgun/index.cjs.js +91 -1
  4. package/mailgun/index.esm.js +92 -3
  5. package/mailgun/package.json +9 -9
  6. package/mailgun/src/lib/auth.mailgun.d.ts +37 -1
  7. package/model/package.json +10 -10
  8. package/model/src/lib/storagefile/storagefile.action.server.d.ts +1 -1
  9. package/oidc/index.cjs.js +245 -180
  10. package/oidc/index.esm.js +242 -178
  11. package/oidc/package.json +12 -12
  12. package/oidc/src/lib/middleware/oauth-auth.module.d.ts +18 -25
  13. package/package.json +15 -14
  14. package/src/lib/auth/auth.service.d.ts +233 -0
  15. package/src/lib/auth/auth.service.error.d.ts +29 -0
  16. package/src/lib/auth/auth.service.error.util.d.ts +40 -0
  17. package/src/lib/auth/index.d.ts +1 -0
  18. package/src/lib/function/error.d.ts +11 -28
  19. package/src/lib/nest/app.d.ts +4 -45
  20. package/src/lib/nest/app.module.d.ts +4 -2
  21. package/src/lib/nest/auth/auth.util.d.ts +71 -5
  22. package/src/lib/nest/controller/index.d.ts +1 -0
  23. package/src/lib/nest/controller/model/index.d.ts +4 -0
  24. package/src/lib/nest/controller/model/model.api.controller.d.ts +93 -0
  25. package/src/lib/nest/controller/model/model.api.dispatch.d.ts +73 -0
  26. package/src/lib/nest/controller/model/model.api.get.service.d.ts +73 -0
  27. package/src/lib/nest/controller/model/model.api.module.d.ts +32 -0
  28. package/src/lib/nest/model/analytics.handler.d.ts +2 -0
  29. package/src/lib/nest/model/api.details.d.ts +53 -1
  30. package/src/lib/nest/model/call.model.function.d.ts +8 -5
  31. package/src/lib/nest/model/create.model.function.d.ts +1 -1
  32. package/src/lib/nest/model/crud.assert.function.d.ts +1 -1
  33. package/src/lib/nest/model/delete.model.function.d.ts +1 -1
  34. package/src/lib/nest/model/index.d.ts +1 -0
  35. package/src/lib/nest/model/query.model.function.d.ts +207 -0
  36. package/src/lib/nest/model/read.model.function.d.ts +1 -1
  37. package/src/lib/nest/model/update.model.function.d.ts +1 -1
  38. package/src/lib/nest/nest.provider.d.ts +19 -0
  39. package/test/index.cjs.js +1358 -398
  40. package/test/index.esm.js +1355 -400
  41. package/test/package.json +14 -12
  42. package/test/src/lib/firebase/firebase.test.d.ts +1 -1
  43. package/test/src/lib/index.d.ts +1 -0
  44. package/test/src/lib/oidc/index.d.ts +2 -0
  45. package/test/src/lib/oidc/oidc.test.fixture.d.ts +126 -0
  46. package/test/src/lib/oidc/oidc.test.flow.d.ts +43 -0
  47. package/zoho/package.json +9 -9
@@ -337,7 +337,97 @@ function _ts_generator(thisArg, body) {
337
337
  }
338
338
  ]);
339
339
  return AbstractMailgunContentFirebaseServerNewUserService;
340
+ }(firebaseServer.AbstractFirebaseServerNewUserService);
341
+ /**
342
+ * Abstract {@link FirebaseServerUserPasswordResetService} implementation that sends a password reset
343
+ * email to users via Mailgun templates.
344
+ *
345
+ * Subclasses implement `buildPasswordResetMailgunContentRequest` to define the template, subject,
346
+ * and any custom variables. The user's email, display name, UID, and reset password are
347
+ * automatically injected as Mailgun user variables.
348
+ *
349
+ * @example
350
+ * ```ts
351
+ * class PasswordResetEmailService extends AbstractMailgunContentFirebaseServerUserPasswordResetService {
352
+ * protected async buildPasswordResetMailgunContentRequest(details) {
353
+ * return {
354
+ * template: 'password-reset',
355
+ * subject: 'Reset Your Password',
356
+ * from: 'noreply@example.com'
357
+ * };
358
+ * }
359
+ * }
360
+ * ```
361
+ */ var AbstractMailgunContentFirebaseServerUserPasswordResetService = /*#__PURE__*/ function(AbstractFirebaseServerUserPasswordResetService) {
362
+ _inherits(AbstractMailgunContentFirebaseServerUserPasswordResetService, AbstractFirebaseServerUserPasswordResetService);
363
+ function AbstractMailgunContentFirebaseServerUserPasswordResetService(authService, mailgunService) {
364
+ _class_call_check(this, AbstractMailgunContentFirebaseServerUserPasswordResetService);
365
+ var _this;
366
+ _this = _call_super(this, AbstractMailgunContentFirebaseServerUserPasswordResetService, [
367
+ authService
368
+ ]), _define_property(_this, "mailgunService", void 0);
369
+ _this.mailgunService = mailgunService;
370
+ return _this;
371
+ }
372
+ _create_class(AbstractMailgunContentFirebaseServerUserPasswordResetService, [
373
+ {
374
+ key: "sendPasswordResetContentToUser",
375
+ value: function sendPasswordResetContentToUser(details) {
376
+ return _async_to_generator(function() {
377
+ var userRecord, resetPassword, uid, displayName, email, baseRequest, baseRequestTo;
378
+ return _ts_generator(this, function(_state) {
379
+ switch(_state.label){
380
+ case 0:
381
+ return [
382
+ 4,
383
+ details.userContext.loadRecord()
384
+ ];
385
+ case 1:
386
+ userRecord = _state.sent();
387
+ resetPassword = details.claims.resetPassword;
388
+ uid = userRecord.uid, displayName = userRecord.displayName, email = userRecord.email;
389
+ if (!email) {
390
+ throw new Error('Email is not present/available for the user record "'.concat(userRecord.uid, '"'));
391
+ }
392
+ return [
393
+ 4,
394
+ this.buildPasswordResetMailgunContentRequest(details)
395
+ ];
396
+ case 2:
397
+ baseRequest = _state.sent();
398
+ baseRequestTo = baseRequest.to;
399
+ return [
400
+ 4,
401
+ this.mailgunService.sendTemplateEmail(_object_spread_props(_object_spread({
402
+ batchSend: false
403
+ }, baseRequest), {
404
+ to: {
405
+ name: baseRequestTo === null || baseRequestTo === void 0 ? void 0 : baseRequestTo.name,
406
+ email: email,
407
+ userVariables: _object_spread_props(_object_spread({
408
+ resetPassword: resetPassword
409
+ }, baseRequestTo === null || baseRequestTo === void 0 ? void 0 : baseRequestTo.userVariables), {
410
+ displayName: displayName,
411
+ uid: uid
412
+ })
413
+ },
414
+ sendTestEmails: baseRequest.sendTestEmails || details.sendDetailsInTestEnvironment || undefined
415
+ }))
416
+ ];
417
+ case 3:
418
+ _state.sent();
419
+ return [
420
+ 2
421
+ ];
422
+ }
423
+ });
424
+ }).call(this);
425
+ }
426
+ }
427
+ ]);
428
+ return AbstractMailgunContentFirebaseServerUserPasswordResetService;
340
429
  }
341
- (firebaseServer.AbstractFirebaseServerNewUserService);
430
+ (firebaseServer.AbstractFirebaseServerUserPasswordResetService);
342
431
 
343
432
  exports.AbstractMailgunContentFirebaseServerNewUserService = AbstractMailgunContentFirebaseServerNewUserService;
433
+ exports.AbstractMailgunContentFirebaseServerUserPasswordResetService = AbstractMailgunContentFirebaseServerUserPasswordResetService;
@@ -1,4 +1,4 @@
1
- import { AbstractFirebaseServerNewUserService } from '@dereekb/firebase-server';
1
+ import { AbstractFirebaseServerNewUserService, AbstractFirebaseServerUserPasswordResetService } from '@dereekb/firebase-server';
2
2
 
3
3
  function _assert_this_initialized(self) {
4
4
  if (self === void 0) {
@@ -335,7 +335,96 @@ function _ts_generator(thisArg, body) {
335
335
  }
336
336
  ]);
337
337
  return AbstractMailgunContentFirebaseServerNewUserService;
338
+ }(AbstractFirebaseServerNewUserService);
339
+ /**
340
+ * Abstract {@link FirebaseServerUserPasswordResetService} implementation that sends a password reset
341
+ * email to users via Mailgun templates.
342
+ *
343
+ * Subclasses implement `buildPasswordResetMailgunContentRequest` to define the template, subject,
344
+ * and any custom variables. The user's email, display name, UID, and reset password are
345
+ * automatically injected as Mailgun user variables.
346
+ *
347
+ * @example
348
+ * ```ts
349
+ * class PasswordResetEmailService extends AbstractMailgunContentFirebaseServerUserPasswordResetService {
350
+ * protected async buildPasswordResetMailgunContentRequest(details) {
351
+ * return {
352
+ * template: 'password-reset',
353
+ * subject: 'Reset Your Password',
354
+ * from: 'noreply@example.com'
355
+ * };
356
+ * }
357
+ * }
358
+ * ```
359
+ */ var AbstractMailgunContentFirebaseServerUserPasswordResetService = /*#__PURE__*/ function(AbstractFirebaseServerUserPasswordResetService) {
360
+ _inherits(AbstractMailgunContentFirebaseServerUserPasswordResetService, AbstractFirebaseServerUserPasswordResetService);
361
+ function AbstractMailgunContentFirebaseServerUserPasswordResetService(authService, mailgunService) {
362
+ _class_call_check(this, AbstractMailgunContentFirebaseServerUserPasswordResetService);
363
+ var _this;
364
+ _this = _call_super(this, AbstractMailgunContentFirebaseServerUserPasswordResetService, [
365
+ authService
366
+ ]), _define_property(_this, "mailgunService", void 0);
367
+ _this.mailgunService = mailgunService;
368
+ return _this;
369
+ }
370
+ _create_class(AbstractMailgunContentFirebaseServerUserPasswordResetService, [
371
+ {
372
+ key: "sendPasswordResetContentToUser",
373
+ value: function sendPasswordResetContentToUser(details) {
374
+ return _async_to_generator(function() {
375
+ var userRecord, resetPassword, uid, displayName, email, baseRequest, baseRequestTo;
376
+ return _ts_generator(this, function(_state) {
377
+ switch(_state.label){
378
+ case 0:
379
+ return [
380
+ 4,
381
+ details.userContext.loadRecord()
382
+ ];
383
+ case 1:
384
+ userRecord = _state.sent();
385
+ resetPassword = details.claims.resetPassword;
386
+ uid = userRecord.uid, displayName = userRecord.displayName, email = userRecord.email;
387
+ if (!email) {
388
+ throw new Error('Email is not present/available for the user record "'.concat(userRecord.uid, '"'));
389
+ }
390
+ return [
391
+ 4,
392
+ this.buildPasswordResetMailgunContentRequest(details)
393
+ ];
394
+ case 2:
395
+ baseRequest = _state.sent();
396
+ baseRequestTo = baseRequest.to;
397
+ return [
398
+ 4,
399
+ this.mailgunService.sendTemplateEmail(_object_spread_props(_object_spread({
400
+ batchSend: false
401
+ }, baseRequest), {
402
+ to: {
403
+ name: baseRequestTo === null || baseRequestTo === void 0 ? void 0 : baseRequestTo.name,
404
+ email: email,
405
+ userVariables: _object_spread_props(_object_spread({
406
+ resetPassword: resetPassword
407
+ }, baseRequestTo === null || baseRequestTo === void 0 ? void 0 : baseRequestTo.userVariables), {
408
+ displayName: displayName,
409
+ uid: uid
410
+ })
411
+ },
412
+ sendTestEmails: baseRequest.sendTestEmails || details.sendDetailsInTestEnvironment || undefined
413
+ }))
414
+ ];
415
+ case 3:
416
+ _state.sent();
417
+ return [
418
+ 2
419
+ ];
420
+ }
421
+ });
422
+ }).call(this);
423
+ }
424
+ }
425
+ ]);
426
+ return AbstractMailgunContentFirebaseServerUserPasswordResetService;
338
427
  }
339
- (AbstractFirebaseServerNewUserService);
428
+ (AbstractFirebaseServerUserPasswordResetService);
340
429
 
341
- export { AbstractMailgunContentFirebaseServerNewUserService };
430
+ export { AbstractMailgunContentFirebaseServerNewUserService, AbstractMailgunContentFirebaseServerUserPasswordResetService };
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server/mailgun",
3
- "version": "13.6.17",
3
+ "version": "13.8.0",
4
4
  "peerDependencies": {
5
- "@dereekb/analytics": "13.6.17",
6
- "@dereekb/firebase": "13.6.17",
7
- "@dereekb/firebase-server": "13.6.17",
8
- "@dereekb/date": "13.6.17",
9
- "@dereekb/nestjs": "13.6.17",
10
- "@dereekb/model": "13.6.17",
11
- "@dereekb/rxjs": "13.6.17",
12
- "@dereekb/util": "13.6.17"
5
+ "@dereekb/analytics": "13.8.0",
6
+ "@dereekb/firebase": "13.8.0",
7
+ "@dereekb/firebase-server": "13.8.0",
8
+ "@dereekb/date": "13.8.0",
9
+ "@dereekb/nestjs": "13.8.0",
10
+ "@dereekb/model": "13.8.0",
11
+ "@dereekb/rxjs": "13.8.0",
12
+ "@dereekb/util": "13.8.0"
13
13
  },
14
14
  "exports": {
15
15
  "./package.json": "./package.json",
@@ -1,5 +1,5 @@
1
1
  import { type MailgunRecipient, type MailgunService, type MailgunTemplateEmailRequest } from '@dereekb/nestjs/mailgun';
2
- import { AbstractFirebaseServerNewUserService, type FirebaseServerAuthContext, type FirebaseServerAuthNewUserSetupDetails, type FirebaseServerAuthService, type FirebaseServerAuthUserContext } from '@dereekb/firebase-server';
2
+ import { AbstractFirebaseServerNewUserService, AbstractFirebaseServerUserPasswordResetService, type FirebaseServerAuthContext, type FirebaseServerAuthNewUserSetupDetails, type FirebaseServerAuthPasswordResetDetails, type FirebaseServerAuthService, type FirebaseServerAuthUserContext } from '@dereekb/firebase-server';
3
3
  /**
4
4
  * Partial {@link MailgunTemplateEmailRequest} for {@link AbstractMailgunContentFirebaseServerNewUserService}.
5
5
  *
@@ -36,3 +36,39 @@ export declare abstract class AbstractMailgunContentFirebaseServerNewUserService
36
36
  protected sendSetupContentToUser(user: FirebaseServerAuthNewUserSetupDetails<U, D>): Promise<void>;
37
37
  protected abstract buildNewUserMailgunContentRequest(user: FirebaseServerAuthNewUserSetupDetails<U, D>): Promise<NewUserMailgunContentRequest>;
38
38
  }
39
+ /**
40
+ * Partial {@link MailgunTemplateEmailRequest} for {@link AbstractMailgunContentFirebaseServerUserPasswordResetService}.
41
+ *
42
+ * The `to` field is omitted because the user's email and details are automatically
43
+ * configured from the Firebase Auth user record during `sendPasswordResetContentToUser`.
44
+ */
45
+ export interface ResetPasswordMailgunContentRequest extends Omit<MailgunTemplateEmailRequest, 'to'> {
46
+ to?: Partial<Omit<MailgunRecipient, 'email'>>;
47
+ }
48
+ /**
49
+ * Abstract {@link FirebaseServerUserPasswordResetService} implementation that sends a password reset
50
+ * email to users via Mailgun templates.
51
+ *
52
+ * Subclasses implement `buildPasswordResetMailgunContentRequest` to define the template, subject,
53
+ * and any custom variables. The user's email, display name, UID, and reset password are
54
+ * automatically injected as Mailgun user variables.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * class PasswordResetEmailService extends AbstractMailgunContentFirebaseServerUserPasswordResetService {
59
+ * protected async buildPasswordResetMailgunContentRequest(details) {
60
+ * return {
61
+ * template: 'password-reset',
62
+ * subject: 'Reset Your Password',
63
+ * from: 'noreply@example.com'
64
+ * };
65
+ * }
66
+ * }
67
+ * ```
68
+ */
69
+ export declare abstract class AbstractMailgunContentFirebaseServerUserPasswordResetService<U extends FirebaseServerAuthUserContext = FirebaseServerAuthUserContext, C extends FirebaseServerAuthContext = FirebaseServerAuthContext, D = unknown> extends AbstractFirebaseServerUserPasswordResetService<U, C, D> {
70
+ readonly mailgunService: MailgunService;
71
+ constructor(authService: FirebaseServerAuthService<U, C>, mailgunService: MailgunService);
72
+ protected sendPasswordResetContentToUser(details: FirebaseServerAuthPasswordResetDetails<U, D>): Promise<void>;
73
+ protected abstract buildPasswordResetMailgunContentRequest(details: FirebaseServerAuthPasswordResetDetails<U, D>): Promise<ResetPasswordMailgunContentRequest>;
74
+ }
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@dereekb/firebase-server/model",
3
- "version": "13.6.17",
3
+ "version": "13.8.0",
4
4
  "peerDependencies": {
5
- "@dereekb/analytics": "13.6.17",
6
- "@dereekb/date": "13.6.17",
7
- "@dereekb/firebase": "13.6.17",
8
- "@dereekb/firebase-server": "13.6.17",
9
- "@dereekb/model": "13.6.17",
10
- "@dereekb/nestjs": "13.6.17",
11
- "@dereekb/rxjs": "13.6.17",
12
- "@dereekb/util": "13.6.17",
5
+ "@dereekb/analytics": "13.8.0",
6
+ "@dereekb/date": "13.8.0",
7
+ "@dereekb/firebase": "13.8.0",
8
+ "@dereekb/firebase-server": "13.8.0",
9
+ "@dereekb/model": "13.8.0",
10
+ "@dereekb/nestjs": "13.8.0",
11
+ "@dereekb/rxjs": "13.8.0",
12
+ "@dereekb/util": "13.8.0",
13
13
  "@nestjs/common": "^11.1.17",
14
- "@nestjs/config": "^4.0.3",
14
+ "@nestjs/config": "^4.0.4",
15
15
  "archiver": "^7.0.0",
16
16
  "date-fns": "^4.0.0",
17
17
  "firebase-functions": "^7.0.0",
@@ -1,4 +1,4 @@
1
- import { type FirestoreContextReference, type InitializeStorageFileFromUploadParams, type AsyncStorageFileCreateAction, type StorageFileFirestoreCollections, type ProcessStorageFileParams, type StorageFileDocument, type ProcessStorageFileResult, type CreateStorageFileParams, type AsyncStorageFileUpdateAction, type UpdateStorageFileParams, type NotificationFirestoreCollections, type FirebaseStorageAccessorFile, type InitializeAllStorageFilesFromUploadsResult, type InitializeAllStorageFilesFromUploadsParams, type ProcessAllQueuedStorageFilesParams, type ProcessAllQueuedStorageFilesResult, type DeleteAllQueuedStorageFilesParams, type DeleteAllQueuedStorageFilesResult, type DeleteStorageFileParams, type AsyncStorageFileDeleteAction, type StorageFile, type DownloadStorageFileParams, type DownloadStorageFileResult, type DownloadMultipleStorageFilesParams, type DownloadMultipleStorageFilesResult, type DownloadMultipleStorageFileSuccessItem, type FirestoreModelKey, type SyncStorageFileWithGroupsParams, type SyncAllFlaggedStorageFilesWithGroupsParams, type SyncAllFlaggedStorageFilesWithGroupsResult, type SyncStorageFileWithGroupsResult, type RegenerateAllFlaggedStorageFileGroupsContentParams, type RegenerateAllFlaggedStorageFileGroupsContentResult, type RegenerateStorageFileGroupContentParams, type RegenerateStorageFileGroupContentResult, type StorageFileGroupDocument, type AsyncStorageFileGroupCreateAction, type CreateStorageFileGroupParams, type Transaction, type StorageFileGroup, type StorageFileGroupDocumentReferencePair, type StorageFileGroupId, type UpdateStorageFileGroupParams, DownloadStorageFileOptions } from '@dereekb/firebase';
1
+ import { type FirestoreContextReference, type InitializeStorageFileFromUploadParams, type AsyncStorageFileCreateAction, type StorageFileFirestoreCollections, type ProcessStorageFileParams, type StorageFileDocument, type ProcessStorageFileResult, type CreateStorageFileParams, type AsyncStorageFileUpdateAction, type UpdateStorageFileParams, type NotificationFirestoreCollections, type FirebaseStorageAccessorFile, type InitializeAllStorageFilesFromUploadsResult, type InitializeAllStorageFilesFromUploadsParams, type ProcessAllQueuedStorageFilesParams, type ProcessAllQueuedStorageFilesResult, type DeleteAllQueuedStorageFilesParams, type DeleteAllQueuedStorageFilesResult, type DeleteStorageFileParams, type AsyncStorageFileDeleteAction, type StorageFile, type DownloadStorageFileParams, type DownloadStorageFileResult, type DownloadMultipleStorageFilesParams, type DownloadMultipleStorageFilesResult, type DownloadMultipleStorageFileSuccessItem, type FirestoreModelKey, type SyncStorageFileWithGroupsParams, type SyncAllFlaggedStorageFilesWithGroupsParams, type SyncAllFlaggedStorageFilesWithGroupsResult, type SyncStorageFileWithGroupsResult, type RegenerateAllFlaggedStorageFileGroupsContentParams, type RegenerateAllFlaggedStorageFileGroupsContentResult, type RegenerateStorageFileGroupContentParams, type RegenerateStorageFileGroupContentResult, type StorageFileGroupDocument, type AsyncStorageFileGroupCreateAction, type CreateStorageFileGroupParams, type Transaction, type StorageFileGroup, type StorageFileGroupDocumentReferencePair, type StorageFileGroupId, type UpdateStorageFileGroupParams, type DownloadStorageFileOptions } from '@dereekb/firebase';
2
2
  import { type FirebaseServerStorageServiceRef, type FirebaseServerActionsContext, type FirebaseServerAuthServiceRef } from '@dereekb/firebase-server';
3
3
  import { type TransformAndValidateFunctionResult } from '@dereekb/model';
4
4
  import { type InjectionToken } from '@nestjs/common';