@digitaldefiance/express-suite-starter 3.0.0 → 3.0.2
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/package.json +1 -1
- package/scaffolding/api-lib/src/lib/documents/user.ts +2 -2
- package/scaffolding/api-lib/src/lib/models/email-token.ts +2 -2
- package/scaffolding/api-lib/src/lib/models/mnemonic.ts +2 -2
- package/scaffolding/api-lib/src/lib/models/role.ts +2 -2
- package/scaffolding/api-lib/src/lib/models/used-direct-login-token.ts +3 -3
- package/scaffolding/api-lib/src/lib/models/user-role.ts +3 -3
- package/scaffolding/api-lib/src/lib/services/email.ts +1 -1
- package/scaffolding/api-lib/src/lib/shared-types.ts +6 -6
- package/scaffolding/inituserdb/src/main.ts.mustache +7 -3
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Types } from '@digitaldefiance/mongoose-types';
|
|
2
2
|
import { AccountStatus, IUserBase } from '@digitaldefiance/suite-core-lib';
|
|
3
|
-
import {
|
|
3
|
+
import { BaseDocument } from '@digitaldefiance/node-express-suite';
|
|
4
4
|
import { CoreLanguageCode } from '@digitaldefiance/i18n-lib';
|
|
5
5
|
import { PlatformID } from '@digitaldefiance/node-ecies-lib';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Composite interface for user collection documents
|
|
9
9
|
*/
|
|
10
|
-
export interface IUserDocument<TID extends PlatformID = PlatformID, TDate extends Date = Date, TLanguage extends string = CoreLanguageCode, TAccountStatus extends AccountStatus = AccountStatus> extends
|
|
10
|
+
export interface IUserDocument<TID extends PlatformID = PlatformID, TDate extends Date = Date, TLanguage extends string = CoreLanguageCode, TAccountStatus extends AccountStatus = AccountStatus> extends BaseDocument<
|
|
11
11
|
IUserBase<
|
|
12
12
|
TID,
|
|
13
13
|
TDate,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseModelName, SchemaCollection,
|
|
1
|
+
import { BaseModelName, SchemaCollection, EmailTokenDocument, EmailTokenSchema } from '@digitaldefiance/node-express-suite';
|
|
2
2
|
import { Connection } from '@digitaldefiance/mongoose-types';
|
|
3
3
|
|
|
4
4
|
export function EmailTokenModel(connection: Connection) {
|
|
5
|
-
return connection.model<
|
|
5
|
+
return connection.model<EmailTokenDocument>(
|
|
6
6
|
BaseModelName.EmailToken,
|
|
7
7
|
EmailTokenSchema,
|
|
8
8
|
SchemaCollection.EmailToken,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseModelName, SchemaCollection,
|
|
1
|
+
import { BaseModelName, SchemaCollection, MnemonicDocument, MnemonicSchema } from '@digitaldefiance/node-express-suite';
|
|
2
2
|
import { Connection } from '@digitaldefiance/mongoose-types';
|
|
3
3
|
|
|
4
4
|
export function MnemonicModel(connection: Connection) {
|
|
5
|
-
return connection.model<
|
|
5
|
+
return connection.model<MnemonicDocument>(
|
|
6
6
|
BaseModelName.Mnemonic,
|
|
7
7
|
MnemonicSchema,
|
|
8
8
|
SchemaCollection.Mnemonic,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseModelName, SchemaCollection,
|
|
1
|
+
import { BaseModelName, SchemaCollection, RoleDocument, RoleSchema } from '@digitaldefiance/node-express-suite';
|
|
2
2
|
import { Connection } from '@digitaldefiance/mongoose-types';
|
|
3
3
|
|
|
4
4
|
export function RoleModel(connection: Connection) {
|
|
5
|
-
return connection.model<
|
|
5
|
+
return connection.model<RoleDocument>(
|
|
6
6
|
BaseModelName.Role,
|
|
7
7
|
RoleSchema,
|
|
8
8
|
SchemaCollection.Role,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { BaseModelName,
|
|
1
|
+
import { BaseModelName, UsedDirectLoginTokenDocument, SchemaCollection,UsedDirectLoginTokenSchema } from '@digitaldefiance/node-express-suite';
|
|
2
2
|
import { Connection, Model } from '@digitaldefiance/mongoose-types';
|
|
3
3
|
|
|
4
4
|
export default function UsedDirectLoginTokenModel(
|
|
5
5
|
connection: Connection,
|
|
6
|
-
): Model<
|
|
7
|
-
return connection.model<
|
|
6
|
+
): Model<UsedDirectLoginTokenDocument> {
|
|
7
|
+
return connection.model<UsedDirectLoginTokenDocument>(
|
|
8
8
|
BaseModelName.UsedDirectLoginToken,
|
|
9
9
|
UsedDirectLoginTokenSchema,
|
|
10
10
|
SchemaCollection.UsedDirectLoginToken,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { SchemaCollection,
|
|
1
|
+
import { SchemaCollection, UserRoleDocument, UserRoleSchema, BaseModelName } from '@digitaldefiance/node-express-suite';
|
|
2
2
|
import { Connection, Model } from '@digitaldefiance/mongoose-types';
|
|
3
3
|
|
|
4
4
|
export default function UserRoleModel(
|
|
5
5
|
connection: Connection,
|
|
6
|
-
): Model<
|
|
7
|
-
return connection.model<
|
|
6
|
+
): Model<UserRoleDocument> {
|
|
7
|
+
return connection.model<UserRoleDocument>(
|
|
8
8
|
BaseModelName.UserRole,
|
|
9
9
|
UserRoleSchema,
|
|
10
10
|
SchemaCollection.UserRole,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SESClient, SendEmailCommand } from '@aws-sdk/client-ses';
|
|
2
|
-
import { IApplication,
|
|
2
|
+
import { IApplication, BaseDocument } from '@digitaldefiance/node-express-suite';
|
|
3
3
|
|
|
4
4
|
// Simple debugLog implementation
|
|
5
5
|
function debugLog(debug: boolean, type: 'log' | 'warn' | 'error', ...args: any[]): void {
|
|
@@ -5,7 +5,7 @@ import { Brand } from 'ts-brand';
|
|
|
5
5
|
import type { IUserDocument } from './documents/user';
|
|
6
6
|
import { CoreLanguageCode } from '@digitaldefiance/i18n-lib';
|
|
7
7
|
import { IKeyPairBufferWithUnEncryptedPrivateKey, ISigningKeyPrivateKeyInfo, ISimplePublicKeyOnly, ISimpleKeyPairBuffer, ISimplePublicKeyOnlyBuffer } from '@digitaldefiance/node-ecies-lib'
|
|
8
|
-
import {IApiErrorResponse, IApiMessageResponse, ISchema, IStatusCodeResponse, IApiExpressValidationErrorResponse, IApiMongoValidationErrorResponse,
|
|
8
|
+
import {IApiErrorResponse, IApiMessageResponse, ISchema, IStatusCodeResponse, IApiExpressValidationErrorResponse, IApiMongoValidationErrorResponse, UserRoleDocument, UsedDirectLoginTokenDocument, RoleDocument, MnemonicDocument, EmailTokenDocument } from '@digitaldefiance/node-express-suite';
|
|
9
9
|
|
|
10
10
|
export type DefaultBackendIdType = Types.ObjectId;
|
|
11
11
|
|
|
@@ -36,12 +36,12 @@ export type ValidatedBody<T extends string> = {
|
|
|
36
36
|
* Schema map interface
|
|
37
37
|
*/
|
|
38
38
|
export type ModelDocMap = {
|
|
39
|
-
EmailToken:
|
|
40
|
-
Mnemonic:
|
|
41
|
-
Role:
|
|
42
|
-
UsedDirectLoginToken:
|
|
39
|
+
EmailToken: EmailTokenDocument;
|
|
40
|
+
Mnemonic: MnemonicDocument;
|
|
41
|
+
Role: RoleDocument;
|
|
42
|
+
UsedDirectLoginToken: UsedDirectLoginTokenDocument;
|
|
43
43
|
User: IUserDocument;
|
|
44
|
-
UserRole:
|
|
44
|
+
UserRole: UserRoleDocument;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
export type SchemaMap = {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BaseApplication,
|
|
3
3
|
MongoDatabasePlugin,
|
|
4
|
-
MongooseDocumentStore,
|
|
5
4
|
DatabaseInitializationService,
|
|
6
5
|
Environment,
|
|
7
6
|
IServerInitResult,
|
|
8
7
|
getSchemaMap,
|
|
9
8
|
} from '@digitaldefiance/node-express-suite';
|
|
10
|
-
import type { IMongoApplication } from '@digitaldefiance/node-express-suite';
|
|
11
9
|
|
|
12
10
|
// Simple debugLog implementation
|
|
13
11
|
function debugLog(debug: boolean, type: 'log' | 'warn' | 'error', ...args: any[]): void {
|
|
@@ -160,8 +158,14 @@ async function main() {
|
|
|
160
158
|
'log',
|
|
161
159
|
getSuiteCoreTranslation(SuiteCoreStringKey.Admin_StartingDbInitialization),
|
|
162
160
|
);
|
|
161
|
+
const mongoApp = mongoPlugin.mongoApplication;
|
|
162
|
+
if (!mongoApp) {
|
|
163
|
+
console.error('MongoPlugin was not initialized — mongoApplication is undefined');
|
|
164
|
+
await mongoPlugin.disconnect();
|
|
165
|
+
process.exit(2);
|
|
166
|
+
}
|
|
163
167
|
const result: IFailableResult<IServerInitResult> =
|
|
164
|
-
await DatabaseInitializationService.initUserDb(
|
|
168
|
+
await DatabaseInitializationService.initUserDb(mongoApp);
|
|
165
169
|
if (result.success && result.data) {
|
|
166
170
|
debugLog(
|
|
167
171
|
app.environment.debug,
|