@candlerip/shared3 0.0.110 → 0.0.112

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. package/package.json +3 -2
  2. package/src/backend/database/model/error-log/index.d.ts +2 -0
  3. package/src/backend/database/model/error-log/index.js +2 -0
  4. package/src/backend/database/model/error-log/type.d.ts +7 -0
  5. package/src/backend/database/model/error-log/util.d.ts +7 -0
  6. package/src/backend/database/model/error-log/util.js +5 -0
  7. package/src/backend/database/model/index.d.ts +1 -0
  8. package/src/backend/database/model/index.js +1 -0
  9. package/src/backend/database/mutation/error-log/create-error-log/type.d.ts +7 -0
  10. package/src/backend/database/mutation/error-log/create-error-log/type.js +1 -0
  11. package/src/backend/database/mutation/error-log/create-error-log/util.d.ts +2 -0
  12. package/src/backend/database/mutation/error-log/create-error-log/util.js +15 -0
  13. package/src/backend/database/mutation/error-log/index.d.ts +1 -0
  14. package/src/backend/database/mutation/error-log/index.js +1 -0
  15. package/src/backend/database/mutation/index.d.ts +1 -0
  16. package/src/backend/database/mutation/index.js +1 -0
  17. package/src/backend/dictionary/compose-dictionary/util.js +1 -1
  18. package/src/backend/dictionary/index.d.ts +0 -1
  19. package/src/backend/dictionary/index.js +0 -1
  20. package/src/dictionary/get-excluded-translation-ids/index.d.ts +1 -0
  21. package/src/dictionary/get-excluded-translation-ids/index.js +1 -0
  22. package/src/{backend/dictionary → dictionary}/get-excluded-translation-ids/type.d.ts +2 -2
  23. package/src/dictionary/get-excluded-translation-ids/type.js +1 -0
  24. package/src/{backend/dictionary → dictionary}/get-excluded-translation-ids/util.js +1 -1
  25. package/src/dictionary/index.d.ts +1 -0
  26. package/src/dictionary/index.js +1 -0
  27. /package/src/backend/{dictionary/get-excluded-translation-ids → database/model/error-log}/type.js +0 -0
  28. /package/src/backend/{dictionary/get-excluded-translation-ids → database/mutation/error-log/create-error-log}/index.d.ts +0 -0
  29. /package/src/backend/{dictionary/get-excluded-translation-ids → database/mutation/error-log/create-error-log}/index.js +0 -0
  30. /package/src/{backend/dictionary → dictionary}/get-excluded-translation-ids/util.d.ts +0 -0
package/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "@candlerip/shared3",
3
- "version": "0.0.110",
3
+ "version": "0.0.112",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.js",
7
7
  "./aws": "./src/aws/index.js",
8
- "./backend": "./src/backend/index.js"
8
+ "./backend": "./src/backend/index.js",
9
+ "./backend/*": "./src/backend/*"
9
10
  },
10
11
  "bin": {
11
12
  "crs-cdk-deploy": "./_devops/cdk/cdk-deploy.sh",
@@ -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,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,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';
@@ -1,6 +1,6 @@
1
1
  import { DICTIONARY_CONFIG } from '../../../dictionary/index.js';
2
2
  import { getTranslationsAsDictionary } from '../../database/mutation/translation/index.js';
3
- import { getExcludedTranslationIds } from '../get-excluded-translation-ids/index.js';
3
+ import { getExcludedTranslationIds } from '../../../dictionary/get-excluded-translation-ids/index.js';
4
4
  export const composeDictionary = async (page, language, options) => {
5
5
  let translationIds = [...DICTIONARY_CONFIG[page].translationIds];
6
6
  const excludedIds = getExcludedTranslationIds(page, options);
@@ -1,2 +1 @@
1
- export * from './get-excluded-translation-ids/index.js';
2
1
  export * from './compose-dictionary/index.js';
@@ -1,2 +1 @@
1
- export * from './get-excluded-translation-ids/index.js';
2
1
  export * from './compose-dictionary/index.js';
@@ -0,0 +1 @@
1
+ export * from './util.js';
@@ -0,0 +1 @@
1
+ export * from './util.js';
@@ -1,5 +1,5 @@
1
- import { TranslationId } from '../../../dictionary/index.js';
2
- import { Page } from '../../../page/index.js';
1
+ import { TranslationId } from '../index.js';
2
+ import { Page } from '../../page/index.js';
3
3
  export type GetExcludedTranslationIds = (page: Page, options?: {
4
4
  isAuthenticated?: boolean;
5
5
  }) => TranslationId[];
@@ -1,4 +1,4 @@
1
- import { isUndefined } from '../../../type/index.js';
1
+ import { isUndefined } from '../../type/index.js';
2
2
  export const getExcludedTranslationIds = (page, options) => {
3
3
  const excludedIds = [`pageMenu.${page}`];
4
4
  if (options) {
@@ -1,3 +1,4 @@
1
1
  export * from './dictionary/index.js';
2
2
  export * from './language/index.js';
3
3
  export * from './translation-id/index.js';
4
+ export * from './get-excluded-translation-ids/index.js';
@@ -1,3 +1,4 @@
1
1
  export * from './dictionary/index.js';
2
2
  export * from './language/index.js';
3
3
  export * from './translation-id/index.js';
4
+ export * from './get-excluded-translation-ids/index.js';