@candlerip/shared3 0.0.110 → 0.0.111

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@candlerip/shared3",
3
- "version": "0.0.110",
3
+ "version": "0.0.111",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.js",
@@ -0,0 +1,2 @@
1
+ export * from './type.js';
2
+ export * from './util.js';
@@ -0,0 +1,2 @@
1
+ export * from './type.js';
2
+ export * from './util.js';
@@ -0,0 +1,7 @@
1
+ import { CustomError } from '@candlerip/shared3';
2
+ export interface ErrorLog {
3
+ _id: string;
4
+ customError: CustomError;
5
+ createdAt: Date;
6
+ updatedAt: Date;
7
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import * as mongoose from 'mongoose';
2
+ import { ErrorLog } from './type.js';
3
+ export declare const ErrorLogModel: mongoose.Model<ErrorLog & mongoose.Document<unknown, any, any>, {}, {}, {}, mongoose.Document<unknown, {}, ErrorLog & mongoose.Document<unknown, any, any>> & ErrorLog & mongoose.Document<unknown, any, any> & Required<{
4
+ _id: string;
5
+ }> & {
6
+ __v: number;
7
+ }, any>;
@@ -0,0 +1,5 @@
1
+ import * as mongoose from 'mongoose';
2
+ const ErrorLogSchema = new mongoose.Schema({
3
+ customError: { type: mongoose.Schema.Types.Mixed },
4
+ }, { timestamps: true, versionKey: false });
5
+ export const ErrorLogModel = mongoose.model('errorLogs', ErrorLogSchema);
@@ -1 +1,2 @@
1
+ export * from './error-log/index.js';
1
2
  export * from './translation/index.js';
@@ -1 +1,2 @@
1
+ export * from './error-log/index.js';
1
2
  export * from './translation/index.js';
@@ -0,0 +1 @@
1
+ export * from './util.js';
@@ -0,0 +1 @@
1
+ export * from './util.js';
@@ -0,0 +1,7 @@
1
+ import { CustomError } from '../../../../../error/index.js';
2
+ import { ErrorLog } from '../../../model/index.js';
3
+ export type CreateErrorLog = (customError: CustomError) => Promise<{
4
+ data: ErrorLog;
5
+ } | {
6
+ customError: CustomError;
7
+ }>;
@@ -0,0 +1,2 @@
1
+ import { CreateErrorLog } from './type.js';
2
+ export declare const createErrorLog: CreateErrorLog;
@@ -0,0 +1,15 @@
1
+ import { customErrorWorker } from '../../../../../error/index.js';
2
+ import { ErrorLogModel } from '../../../model/error-log/index.js';
3
+ export const createErrorLog = async (customError) => {
4
+ let data;
5
+ const { composeCustomError } = customErrorWorker({ customError });
6
+ try {
7
+ data = await ErrorLogModel.create({ customError });
8
+ }
9
+ catch (err) {
10
+ return composeCustomError('Create error log failed', { err });
11
+ }
12
+ return {
13
+ data,
14
+ };
15
+ };
@@ -0,0 +1 @@
1
+ export * from './create-error-log/index.js';
@@ -0,0 +1 @@
1
+ export * from './create-error-log/index.js';
@@ -1 +1,2 @@
1
+ export * from './error-log/index.js';
1
2
  export * from './translation/index.js';
@@ -1 +1,2 @@
1
+ export * from './error-log/index.js';
1
2
  export * from './translation/index.js';