@growi/core 1.1.0 → 1.2.0-next.a29562bbcdacd0e472c7c00fa17797bcf401f9ef

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 (33) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +29 -25
  3. package/dist/index.js.map +1 -1
  4. package/dist/interfaces/common.cjs +1 -1
  5. package/dist/interfaces/common.cjs.map +1 -1
  6. package/dist/interfaces/common.d.ts +1 -0
  7. package/dist/interfaces/common.js +6 -4
  8. package/dist/interfaces/common.js.map +1 -1
  9. package/dist/interfaces/index.cjs +1 -1
  10. package/dist/interfaces/index.d.ts +1 -0
  11. package/dist/interfaces/index.js +31 -27
  12. package/dist/interfaces/index.js.map +1 -1
  13. package/dist/interfaces/locale.cjs +2 -0
  14. package/dist/interfaces/locale.cjs.map +1 -0
  15. package/dist/interfaces/locale.d.ts +8 -0
  16. package/dist/interfaces/locale.js +11 -0
  17. package/dist/interfaces/locale.js.map +1 -0
  18. package/dist/models/serializers/attachment-serializer.cjs +2 -0
  19. package/dist/models/serializers/attachment-serializer.cjs.map +1 -0
  20. package/dist/models/serializers/attachment-serializer.d.ts +9 -0
  21. package/dist/models/serializers/attachment-serializer.js +17 -0
  22. package/dist/models/serializers/attachment-serializer.js.map +1 -0
  23. package/dist/models/serializers/index.cjs +2 -0
  24. package/dist/models/serializers/index.cjs.map +1 -0
  25. package/dist/models/serializers/index.d.ts +2 -0
  26. package/dist/models/serializers/index.js +8 -0
  27. package/dist/models/serializers/index.js.map +1 -0
  28. package/dist/models/serializers/user-serializer.cjs +2 -0
  29. package/dist/models/serializers/user-serializer.cjs.map +1 -0
  30. package/dist/models/serializers/user-serializer.d.ts +9 -0
  31. package/dist/models/serializers/user-serializer.js +20 -0
  32. package/dist/models/serializers/user-serializer.js.map +1 -0
  33. package/package.json +5 -1
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./consts/accepted-upload-file-type.cjs"),s=require("./consts/growi-plugin.cjs"),u=require("./consts/ydoc-status.cjs"),c=require("./interfaces/color-scheme.cjs"),r=require("./interfaces/common.cjs"),g=require("./interfaces/external-account.cjs"),t=require("./interfaces/growi-theme-metadata.cjs"),i=require("./interfaces/lang.cjs"),e=require("./interfaces/page.cjs"),o=require("./interfaces/revision.cjs"),n=require("./interfaces/subscription.cjs"),p=require("./interfaces/user.cjs");exports.AcceptedUploadFileType=a.AcceptedUploadFileType;exports.GrowiPluginType=s.GrowiPluginType;exports.YDocStatus=u.YDocStatus;exports.ColorScheme=c.ColorScheme;exports.getIdForRef=r.getIdForRef;exports.getIdStringForRef=r.getIdStringForRef;exports.isPopulated=r.isPopulated;exports.IExternalAuthProviderType=g.IExternalAuthProviderType;exports.GrowiThemeSchemeType=t.GrowiThemeSchemeType;exports.isGrowiThemeMetadata=t.isGrowiThemeMetadata;exports.AllLang=i.AllLang;exports.Lang=i.Lang;exports.GroupType=e.GroupType;exports.PageGrant=e.PageGrant;exports.PageStatus=e.PageStatus;exports.isIPageInfoForEntity=e.isIPageInfoForEntity;exports.isIPageInfoForListing=e.isIPageInfoForListing;exports.isIPageInfoForOperation=e.isIPageInfoForOperation;exports.Origin=o.Origin;exports.allOrigin=o.allOrigin;exports.AllSubscriptionStatusType=n.AllSubscriptionStatusType;exports.SubscriptionStatusType=n.SubscriptionStatusType;exports.USER_STATUS=p.USER_STATUS;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./consts/accepted-upload-file-type.cjs"),c=require("./consts/growi-plugin.cjs"),l=require("./consts/ydoc-status.cjs"),u=require("./interfaces/color-scheme.cjs"),r=require("./interfaces/common.cjs"),g=require("./interfaces/external-account.cjs"),o=require("./interfaces/growi-theme-metadata.cjs"),t=require("./interfaces/lang.cjs"),i=require("./interfaces/locale.cjs"),e=require("./interfaces/page.cjs"),a=require("./interfaces/revision.cjs"),n=require("./interfaces/subscription.cjs"),p=require("./interfaces/user.cjs");exports.AcceptedUploadFileType=s.AcceptedUploadFileType;exports.GrowiPluginType=c.GrowiPluginType;exports.YDocStatus=l.YDocStatus;exports.ColorScheme=u.ColorScheme;exports.getIdForRef=r.getIdForRef;exports.getIdStringForRef=r.getIdStringForRef;exports.isPopulated=r.isPopulated;exports.isRef=r.isRef;exports.IExternalAuthProviderType=g.IExternalAuthProviderType;exports.GrowiThemeSchemeType=o.GrowiThemeSchemeType;exports.isGrowiThemeMetadata=o.isGrowiThemeMetadata;exports.AllLang=t.AllLang;exports.Lang=t.Lang;exports.AllLocale=i.AllLocale;exports.Locale=i.Locale;exports.GroupType=e.GroupType;exports.PageGrant=e.PageGrant;exports.PageStatus=e.PageStatus;exports.isIPageInfoForEntity=e.isIPageInfoForEntity;exports.isIPageInfoForListing=e.isIPageInfoForListing;exports.isIPageInfoForOperation=e.isIPageInfoForOperation;exports.Origin=a.Origin;exports.allOrigin=a.allOrigin;exports.AllSubscriptionStatusType=n.AllSubscriptionStatusType;exports.SubscriptionStatusType=n.SubscriptionStatusType;exports.USER_STATUS=p.USER_STATUS;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -2,37 +2,41 @@ import { AcceptedUploadFileType as r } from "./consts/accepted-upload-file-type.
2
2
  import { GrowiPluginType as p } from "./consts/growi-plugin.js";
3
3
  import { YDocStatus as a } from "./consts/ydoc-status.js";
4
4
  import { ColorScheme as m } from "./interfaces/color-scheme.js";
5
- import { getIdForRef as g, getIdStringForRef as x, isPopulated as l } from "./interfaces/common.js";
6
- import { IExternalAuthProviderType as S } from "./interfaces/external-account.js";
7
- import { GrowiThemeSchemeType as u, isGrowiThemeMetadata as I } from "./interfaces/growi-theme-metadata.js";
8
- import { AllLang as P, Lang as c } from "./interfaces/lang.js";
9
- import { GroupType as F, PageGrant as h, PageStatus as A, isIPageInfoForEntity as G, isIPageInfoForListing as w, isIPageInfoForOperation as E } from "./interfaces/page.js";
10
- import { Origin as O, allOrigin as R } from "./interfaces/revision.js";
11
- import { AllSubscriptionStatusType as b, SubscriptionStatusType as v } from "./interfaces/subscription.js";
12
- import { USER_STATUS as D } from "./interfaces/user.js";
5
+ import { getIdForRef as n, getIdStringForRef as g, isPopulated as x, isRef as s } from "./interfaces/common.js";
6
+ import { IExternalAuthProviderType as T } from "./interfaces/external-account.js";
7
+ import { GrowiThemeSchemeType as c, isGrowiThemeMetadata as I } from "./interfaces/growi-theme-metadata.js";
8
+ import { AllLang as P, Lang as d } from "./interfaces/lang.js";
9
+ import { AllLocale as F, Locale as h } from "./interfaces/locale.js";
10
+ import { GroupType as L, PageGrant as R, PageStatus as w, isIPageInfoForEntity as E, isIPageInfoForListing as O, isIPageInfoForOperation as U } from "./interfaces/page.js";
11
+ import { Origin as v, allOrigin as C } from "./interfaces/revision.js";
12
+ import { AllSubscriptionStatusType as M, SubscriptionStatusType as Y } from "./interfaces/subscription.js";
13
+ import { USER_STATUS as j } from "./interfaces/user.js";
13
14
  export {
14
15
  r as AcceptedUploadFileType,
15
16
  P as AllLang,
16
- b as AllSubscriptionStatusType,
17
+ F as AllLocale,
18
+ M as AllSubscriptionStatusType,
17
19
  m as ColorScheme,
18
- F as GroupType,
20
+ L as GroupType,
19
21
  p as GrowiPluginType,
20
- u as GrowiThemeSchemeType,
21
- S as IExternalAuthProviderType,
22
- c as Lang,
23
- O as Origin,
24
- h as PageGrant,
25
- A as PageStatus,
26
- v as SubscriptionStatusType,
27
- D as USER_STATUS,
22
+ c as GrowiThemeSchemeType,
23
+ T as IExternalAuthProviderType,
24
+ d as Lang,
25
+ h as Locale,
26
+ v as Origin,
27
+ R as PageGrant,
28
+ w as PageStatus,
29
+ Y as SubscriptionStatusType,
30
+ j as USER_STATUS,
28
31
  a as YDocStatus,
29
- R as allOrigin,
30
- g as getIdForRef,
31
- x as getIdStringForRef,
32
+ C as allOrigin,
33
+ n as getIdForRef,
34
+ g as getIdStringForRef,
32
35
  I as isGrowiThemeMetadata,
33
- G as isIPageInfoForEntity,
34
- w as isIPageInfoForListing,
35
- E as isIPageInfoForOperation,
36
- l as isPopulated
36
+ E as isIPageInfoForEntity,
37
+ O as isIPageInfoForListing,
38
+ U as isIPageInfoForOperation,
39
+ x as isPopulated,
40
+ s as isRef
37
41
  };
38
42
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=t=>t!=null&&typeof t!="string"&&!("_bsontype"in t&&t._bsontype==="ObjectID"),o=t=>e(t)?t._id:t,n=t=>o(t).toString();exports.getIdForRef=o;exports.getIdStringForRef=n;exports.isPopulated=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../utils/objectid-utils.cjs"),o=t=>t!=null&&(typeof t=="string"&&i.isValidObjectId(t)||typeof t=="object"&&"_bsontype"in t&&t._bsontype==="ObjectID"||typeof t=="object"&&"_id"in t),e=t=>t!=null&&typeof t!="string"&&!("_bsontype"in t&&t._bsontype==="ObjectID"),n=t=>e(t)?t._id:t,s=t=>n(t).toString();exports.getIdForRef=n;exports.getIdStringForRef=s;exports.isPopulated=e;exports.isRef=o;
2
2
  //# sourceMappingURL=common.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.cjs","sources":["../../src/interfaces/common.ts"],"sourcesContent":["/*\n * Common types and interfaces\n */\n\n\nimport type { Types } from 'mongoose';\n\ntype ObjectId = Types.ObjectId;\n\n// Foreign key field\nexport type Ref<T> = string | ObjectId | T & { _id: string | ObjectId };\n\nexport type Nullable<T> = T | null | undefined;\n\nexport const isPopulated = <T>(ref: Ref<T>): ref is T & { _id: string | ObjectId } => {\n return ref != null\n && typeof ref !== 'string'\n && !('_bsontype' in ref && ref._bsontype === 'ObjectID');\n};\n\nexport const getIdForRef = <T>(ref: Ref<T>): string | ObjectId => {\n return isPopulated(ref)\n ? ref._id\n : ref;\n};\n\nexport const getIdStringForRef = <T>(ref: Ref<T>): string => {\n return getIdForRef(ref).toString();\n};\n"],"names":["isPopulated","ref","getIdForRef","getIdStringForRef"],"mappings":"gFAca,MAAAA,EAAkBC,GACtBA,GAAO,MACT,OAAOA,GAAQ,UACf,EAAE,cAAeA,GAAOA,EAAI,YAAc,YAGpCC,EAAkBD,GACtBD,EAAYC,CAAG,EAClBA,EAAI,IACJA,EAGOE,EAAwBF,GAC5BC,EAAYD,CAAG,EAAE"}
1
+ {"version":3,"file":"common.cjs","sources":["../../src/interfaces/common.ts"],"sourcesContent":["/*\n * Common types and interfaces\n */\n\nimport type { Types } from 'mongoose';\n\nimport { isValidObjectId } from '../utils/objectid-utils';\n\ntype ObjectId = Types.ObjectId;\n\n// Foreign key field\nexport type Ref<T> = string | ObjectId | T & { _id: string | ObjectId };\n\nexport type Nullable<T> = T | null | undefined;\n\nexport const isRef = <T>(obj: unknown): obj is Ref<T> => {\n return obj != null\n && (\n (typeof obj === 'string' && isValidObjectId(obj))\n || (typeof obj === 'object' && '_bsontype' in obj && obj._bsontype === 'ObjectID')\n || (typeof obj === 'object' && '_id' in obj)\n );\n};\n\nexport const isPopulated = <T>(ref: Ref<T>): ref is T & { _id: string | ObjectId } => {\n return ref != null\n && typeof ref !== 'string'\n && !('_bsontype' in ref && ref._bsontype === 'ObjectID');\n};\n\nexport const getIdForRef = <T>(ref: Ref<T>): string | ObjectId => {\n return isPopulated(ref)\n ? ref._id\n : ref;\n};\n\nexport const getIdStringForRef = <T>(ref: Ref<T>): string => {\n return getIdForRef(ref).toString();\n};\n"],"names":["isRef","obj","isValidObjectId","isPopulated","ref","getIdForRef","getIdStringForRef"],"mappings":"+HAeaA,EAAYC,GAChBA,GAAO,OAET,OAAOA,GAAQ,UAAYC,kBAAgBD,CAAG,GACzC,OAAOA,GAAQ,UAAY,cAAeA,GAAOA,EAAI,YAAc,YACnE,OAAOA,GAAQ,UAAY,QAASA,GAInCE,EAAkBC,GACtBA,GAAO,MACT,OAAOA,GAAQ,UACf,EAAE,cAAeA,GAAOA,EAAI,YAAc,YAGpCC,EAAkBD,GACtBD,EAAYC,CAAG,EAClBA,EAAI,IACJA,EAGOE,EAAwBF,GAC5BC,EAAYD,CAAG,EAAE"}
@@ -5,6 +5,7 @@ export type Ref<T> = string | ObjectId | T & {
5
5
  _id: string | ObjectId;
6
6
  };
7
7
  export type Nullable<T> = T | null | undefined;
8
+ export declare const isRef: <T>(obj: unknown) => obj is Ref<T>;
8
9
  export declare const isPopulated: <T>(ref: Ref<T>) => ref is T & {
9
10
  _id: string | ObjectId;
10
11
  };
@@ -1,7 +1,9 @@
1
- const n = (t) => t != null && typeof t != "string" && !("_bsontype" in t && t._bsontype === "ObjectID"), o = (t) => n(t) ? t._id : t, e = (t) => o(t).toString();
1
+ import { isValidObjectId as n } from "../utils/objectid-utils.js";
2
+ const s = (t) => t != null && (typeof t == "string" && n(t) || typeof t == "object" && "_bsontype" in t && t._bsontype === "ObjectID" || typeof t == "object" && "_id" in t), e = (t) => t != null && typeof t != "string" && !("_bsontype" in t && t._bsontype === "ObjectID"), i = (t) => e(t) ? t._id : t, r = (t) => i(t).toString();
2
3
  export {
3
- o as getIdForRef,
4
- e as getIdStringForRef,
5
- n as isPopulated
4
+ i as getIdForRef,
5
+ r as getIdStringForRef,
6
+ e as isPopulated,
7
+ s as isRef
6
8
  };
7
9
  //# sourceMappingURL=common.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sources":["../../src/interfaces/common.ts"],"sourcesContent":["/*\n * Common types and interfaces\n */\n\n\nimport type { Types } from 'mongoose';\n\ntype ObjectId = Types.ObjectId;\n\n// Foreign key field\nexport type Ref<T> = string | ObjectId | T & { _id: string | ObjectId };\n\nexport type Nullable<T> = T | null | undefined;\n\nexport const isPopulated = <T>(ref: Ref<T>): ref is T & { _id: string | ObjectId } => {\n return ref != null\n && typeof ref !== 'string'\n && !('_bsontype' in ref && ref._bsontype === 'ObjectID');\n};\n\nexport const getIdForRef = <T>(ref: Ref<T>): string | ObjectId => {\n return isPopulated(ref)\n ? ref._id\n : ref;\n};\n\nexport const getIdStringForRef = <T>(ref: Ref<T>): string => {\n return getIdForRef(ref).toString();\n};\n"],"names":["isPopulated","ref","getIdForRef","getIdStringForRef"],"mappings":"AAca,MAAAA,IAAc,CAAIC,MACtBA,KAAO,QACT,OAAOA,KAAQ,YACf,EAAE,eAAeA,KAAOA,EAAI,cAAc,aAGpCC,IAAc,CAAID,MACtBD,EAAYC,CAAG,IAClBA,EAAI,MACJA,GAGOE,IAAoB,CAAIF,MAC5BC,EAAYD,CAAG,EAAE;"}
1
+ {"version":3,"file":"common.js","sources":["../../src/interfaces/common.ts"],"sourcesContent":["/*\n * Common types and interfaces\n */\n\nimport type { Types } from 'mongoose';\n\nimport { isValidObjectId } from '../utils/objectid-utils';\n\ntype ObjectId = Types.ObjectId;\n\n// Foreign key field\nexport type Ref<T> = string | ObjectId | T & { _id: string | ObjectId };\n\nexport type Nullable<T> = T | null | undefined;\n\nexport const isRef = <T>(obj: unknown): obj is Ref<T> => {\n return obj != null\n && (\n (typeof obj === 'string' && isValidObjectId(obj))\n || (typeof obj === 'object' && '_bsontype' in obj && obj._bsontype === 'ObjectID')\n || (typeof obj === 'object' && '_id' in obj)\n );\n};\n\nexport const isPopulated = <T>(ref: Ref<T>): ref is T & { _id: string | ObjectId } => {\n return ref != null\n && typeof ref !== 'string'\n && !('_bsontype' in ref && ref._bsontype === 'ObjectID');\n};\n\nexport const getIdForRef = <T>(ref: Ref<T>): string | ObjectId => {\n return isPopulated(ref)\n ? ref._id\n : ref;\n};\n\nexport const getIdStringForRef = <T>(ref: Ref<T>): string => {\n return getIdForRef(ref).toString();\n};\n"],"names":["isRef","obj","isValidObjectId","isPopulated","ref","getIdForRef","getIdStringForRef"],"mappings":";AAea,MAAAA,IAAQ,CAAIC,MAChBA,KAAO,SAET,OAAOA,KAAQ,YAAYC,EAAgBD,CAAG,KACzC,OAAOA,KAAQ,YAAY,eAAeA,KAAOA,EAAI,cAAc,cACnE,OAAOA,KAAQ,YAAY,SAASA,IAInCE,IAAc,CAAIC,MACtBA,KAAO,QACT,OAAOA,KAAQ,YACf,EAAE,eAAeA,KAAOA,EAAI,cAAc,aAGpCC,IAAc,CAAID,MACtBD,EAAYC,CAAG,IAClBA,EAAI,MACJA,GAGOE,IAAoB,CAAIF,MAC5BC,EAAYD,CAAG,EAAE;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./color-scheme.cjs"),r=require("./common.cjs"),s=require("./external-account.cjs"),t=require("./growi-theme-metadata.cjs"),i=require("./lang.cjs"),e=require("./page.cjs"),o=require("./revision.cjs"),n=require("./subscription.cjs"),g=require("./user.cjs");exports.ColorScheme=a.ColorScheme;exports.getIdForRef=r.getIdForRef;exports.getIdStringForRef=r.getIdStringForRef;exports.isPopulated=r.isPopulated;exports.IExternalAuthProviderType=s.IExternalAuthProviderType;exports.GrowiThemeSchemeType=t.GrowiThemeSchemeType;exports.isGrowiThemeMetadata=t.isGrowiThemeMetadata;exports.AllLang=i.AllLang;exports.Lang=i.Lang;exports.GroupType=e.GroupType;exports.PageGrant=e.PageGrant;exports.PageStatus=e.PageStatus;exports.isIPageInfoForEntity=e.isIPageInfoForEntity;exports.isIPageInfoForListing=e.isIPageInfoForListing;exports.isIPageInfoForOperation=e.isIPageInfoForOperation;exports.Origin=o.Origin;exports.allOrigin=o.allOrigin;exports.AllSubscriptionStatusType=n.AllSubscriptionStatusType;exports.SubscriptionStatusType=n.SubscriptionStatusType;exports.USER_STATUS=g.USER_STATUS;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./color-scheme.cjs"),r=require("./common.cjs"),l=require("./external-account.cjs"),o=require("./growi-theme-metadata.cjs"),t=require("./lang.cjs"),i=require("./locale.cjs"),e=require("./page.cjs"),a=require("./revision.cjs"),n=require("./subscription.cjs"),u=require("./user.cjs");exports.ColorScheme=s.ColorScheme;exports.getIdForRef=r.getIdForRef;exports.getIdStringForRef=r.getIdStringForRef;exports.isPopulated=r.isPopulated;exports.isRef=r.isRef;exports.IExternalAuthProviderType=l.IExternalAuthProviderType;exports.GrowiThemeSchemeType=o.GrowiThemeSchemeType;exports.isGrowiThemeMetadata=o.isGrowiThemeMetadata;exports.AllLang=t.AllLang;exports.Lang=t.Lang;exports.AllLocale=i.AllLocale;exports.Locale=i.Locale;exports.GroupType=e.GroupType;exports.PageGrant=e.PageGrant;exports.PageStatus=e.PageStatus;exports.isIPageInfoForEntity=e.isIPageInfoForEntity;exports.isIPageInfoForListing=e.isIPageInfoForListing;exports.isIPageInfoForOperation=e.isIPageInfoForOperation;exports.Origin=a.Origin;exports.allOrigin=a.allOrigin;exports.AllSubscriptionStatusType=n.AllSubscriptionStatusType;exports.SubscriptionStatusType=n.SubscriptionStatusType;exports.USER_STATUS=u.USER_STATUS;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -7,6 +7,7 @@ export * from './growi-facade';
7
7
  export * from './growi-theme-metadata';
8
8
  export * from './has-object-id';
9
9
  export * from './lang';
10
+ export * from './locale';
10
11
  export * from './page';
11
12
  export * from './revision';
12
13
  export * from './subscription';
@@ -1,32 +1,36 @@
1
- import { ColorScheme as o } from "./color-scheme.js";
2
- import { getIdForRef as i, getIdStringForRef as p, isPopulated as a } from "./common.js";
3
- import { IExternalAuthProviderType as f } from "./external-account.js";
4
- import { GrowiThemeSchemeType as m, isGrowiThemeMetadata as s } from "./growi-theme-metadata.js";
5
- import { AllLang as x, Lang as l } from "./lang.js";
6
- import { GroupType as T, PageGrant as u, PageStatus as P, isIPageInfoForEntity as y, isIPageInfoForListing as d, isIPageInfoForOperation as h } from "./page.js";
7
- import { Origin as c, allOrigin as A } from "./revision.js";
8
- import { AllSubscriptionStatusType as E, SubscriptionStatusType as L } from "./subscription.js";
9
- import { USER_STATUS as R } from "./user.js";
1
+ import { ColorScheme as r } from "./color-scheme.js";
2
+ import { getIdForRef as i, getIdStringForRef as a, isPopulated as p, isRef as f } from "./common.js";
3
+ import { IExternalAuthProviderType as m } from "./external-account.js";
4
+ import { GrowiThemeSchemeType as l, isGrowiThemeMetadata as s } from "./growi-theme-metadata.js";
5
+ import { AllLang as S, Lang as I } from "./lang.js";
6
+ import { AllLocale as u, Locale as P } from "./locale.js";
7
+ import { GroupType as y, PageGrant as d, PageStatus as h, isIPageInfoForEntity as A, isIPageInfoForListing as F, isIPageInfoForOperation as L } from "./page.js";
8
+ import { Origin as R, allOrigin as E } from "./revision.js";
9
+ import { AllSubscriptionStatusType as b, SubscriptionStatusType as w } from "./subscription.js";
10
+ import { USER_STATUS as v } from "./user.js";
10
11
  export {
11
- x as AllLang,
12
- E as AllSubscriptionStatusType,
13
- o as ColorScheme,
14
- T as GroupType,
15
- m as GrowiThemeSchemeType,
16
- f as IExternalAuthProviderType,
17
- l as Lang,
18
- c as Origin,
19
- u as PageGrant,
20
- P as PageStatus,
21
- L as SubscriptionStatusType,
22
- R as USER_STATUS,
23
- A as allOrigin,
12
+ S as AllLang,
13
+ u as AllLocale,
14
+ b as AllSubscriptionStatusType,
15
+ r as ColorScheme,
16
+ y as GroupType,
17
+ l as GrowiThemeSchemeType,
18
+ m as IExternalAuthProviderType,
19
+ I as Lang,
20
+ P as Locale,
21
+ R as Origin,
22
+ d as PageGrant,
23
+ h as PageStatus,
24
+ w as SubscriptionStatusType,
25
+ v as USER_STATUS,
26
+ E as allOrigin,
24
27
  i as getIdForRef,
25
- p as getIdStringForRef,
28
+ a as getIdStringForRef,
26
29
  s as isGrowiThemeMetadata,
27
- y as isIPageInfoForEntity,
28
- d as isIPageInfoForListing,
29
- h as isIPageInfoForOperation,
30
- a as isPopulated
30
+ A as isIPageInfoForEntity,
31
+ F as isIPageInfoForListing,
32
+ L as isIPageInfoForOperation,
33
+ p as isPopulated,
34
+ f as isRef
31
35
  };
32
36
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={"en-US":"en-US","ja-JP":"ja-JP","zh-CN":"zh-CN","fr-FR":"fr-FR"},l=Object.values(e);exports.AllLocale=l;exports.Locale=e;
2
+ //# sourceMappingURL=locale.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.cjs","sources":["../../src/interfaces/locale.ts"],"sourcesContent":["export const Locale = {\n 'en-US': 'en-US',\n 'ja-JP': 'ja-JP',\n 'zh-CN': 'zh-CN',\n 'fr-FR': 'fr-FR',\n} as const;\nexport const AllLocale = Object.values(Locale);\nexport type Locale = typeof Locale[keyof typeof Locale];\n"],"names":["Locale","AllLocale"],"mappings":"gFAAO,MAAMA,EAAS,CACpB,QAAS,QACT,QAAS,QACT,QAAS,QACT,QAAS,OACX,EACaC,EAAY,OAAO,OAAOD,CAAM"}
@@ -0,0 +1,8 @@
1
+ export declare const Locale: {
2
+ readonly 'en-US': "en-US";
3
+ readonly 'ja-JP': "ja-JP";
4
+ readonly 'zh-CN': "zh-CN";
5
+ readonly 'fr-FR': "fr-FR";
6
+ };
7
+ export declare const AllLocale: ("en-US" | "ja-JP" | "zh-CN" | "fr-FR")[];
8
+ export type Locale = typeof Locale[keyof typeof Locale];
@@ -0,0 +1,11 @@
1
+ const e = {
2
+ "en-US": "en-US",
3
+ "ja-JP": "ja-JP",
4
+ "zh-CN": "zh-CN",
5
+ "fr-FR": "fr-FR"
6
+ }, a = Object.values(e);
7
+ export {
8
+ a as AllLocale,
9
+ e as Locale
10
+ };
11
+ //# sourceMappingURL=locale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"locale.js","sources":["../../src/interfaces/locale.ts"],"sourcesContent":["export const Locale = {\n 'en-US': 'en-US',\n 'ja-JP': 'ja-JP',\n 'zh-CN': 'zh-CN',\n 'fr-FR': 'fr-FR',\n} as const;\nexport const AllLocale = Object.values(Locale);\nexport type Locale = typeof Locale[keyof typeof Locale];\n"],"names":["Locale","AllLocale"],"mappings":"AAAO,MAAMA,IAAS;AAAA,EACpB,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AAAA,EACT,SAAS;AACX,GACaC,IAAY,OAAO,OAAOD,CAAM;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("mongoose"),o=require("../../interfaces/common.cjs"),n=require("./user-serializer.cjs"),c=e=>{const i=e instanceof u.Document?e.toObject():e,{creator:r,...s}=i;return{creator:r==null?void 0:n.serializeUserSecurely(r),...s}};function t(e){return e==null||o.isRef(e)&&!o.isPopulated(e)?e:c(e)}exports.serializeAttachmentSecurely=t;
2
+ //# sourceMappingURL=attachment-serializer.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachment-serializer.cjs","sources":["../../../src/models/serializers/attachment-serializer.ts"],"sourcesContent":["import { Document } from 'mongoose';\n\nimport type { IAttachment, IUser } from '~/interfaces';\n\nimport { isPopulated, isRef, type Ref } from '../../interfaces/common';\n\nimport { serializeUserSecurely, type IUserSerializedSecurely } from './user-serializer';\n\nexport type IAttachmentSerializedSecurely<A extends IAttachment> = Omit<A, 'creator'> & { creator?: Ref<IUserSerializedSecurely<IUser>> };\n\nconst omitInsecureAttributes = <A extends IAttachment>(attachment: A): IAttachmentSerializedSecurely<A> => {\n\n const leanDoc = (attachment instanceof Document)\n ? attachment.toObject<A>()\n : attachment;\n\n const { creator, ...rest } = leanDoc;\n\n const secureCreator = creator == null\n ? undefined\n : serializeUserSecurely(creator);\n\n return {\n creator: secureCreator,\n ...rest,\n };\n};\n\n\nexport function serializeAttachmentSecurely<A extends IAttachment>(attachment?: A): IAttachmentSerializedSecurely<A>;\nexport function serializeAttachmentSecurely<A extends IAttachment>(attachment?: Ref<A>): Ref<IAttachmentSerializedSecurely<A>>;\nexport function serializeAttachmentSecurely<A extends IAttachment>(attachment?: A | Ref<A>)\n : undefined | IAttachmentSerializedSecurely<A> | Ref<IAttachmentSerializedSecurely<A>> {\n\n if (attachment == null) return attachment;\n\n if (isRef(attachment) && !isPopulated(attachment)) return attachment;\n\n return omitInsecureAttributes(attachment);\n}\n"],"names":["omitInsecureAttributes","attachment","leanDoc","Document","creator","rest","serializeUserSecurely","serializeAttachmentSecurely","isRef","isPopulated"],"mappings":"wLAUMA,EAAiDC,GAAoD,CAEzG,MAAMC,EAAWD,aAAsBE,EAAAA,SACnCF,EAAW,SACX,EAAAA,EAEE,CAAE,QAAAG,EAAS,GAAGC,CAAA,EAASH,EAMtB,MAAA,CACL,QALoBE,GAAW,KAC7B,OACAE,EAAAA,sBAAsBF,CAAO,EAI/B,GAAGC,CAAA,CAEP,EAKO,SAASE,EAAmDN,EACwB,CAIzF,OAFIA,GAAc,MAEdO,EAAM,MAAAP,CAAU,GAAK,CAACQ,EAAAA,YAAYR,CAAU,EAAUA,EAEnDD,EAAuBC,CAAU,CAC1C"}
@@ -0,0 +1,9 @@
1
+ import { IUserSerializedSecurely } from './user-serializer';
2
+ import { Ref } from '../../interfaces/common';
3
+ import { IAttachment, IUser } from '../../interfaces';
4
+
5
+ export type IAttachmentSerializedSecurely<A extends IAttachment> = Omit<A, 'creator'> & {
6
+ creator?: Ref<IUserSerializedSecurely<IUser>>;
7
+ };
8
+ export declare function serializeAttachmentSecurely<A extends IAttachment>(attachment?: A): IAttachmentSerializedSecurely<A>;
9
+ export declare function serializeAttachmentSecurely<A extends IAttachment>(attachment?: Ref<A>): Ref<IAttachmentSerializedSecurely<A>>;
@@ -0,0 +1,17 @@
1
+ import { Document as s } from "mongoose";
2
+ import { isRef as u, isPopulated as n } from "../../interfaces/common.js";
3
+ import { serializeUserSecurely as c } from "./user-serializer.js";
4
+ const l = (r) => {
5
+ const o = r instanceof s ? r.toObject() : r, { creator: e, ...i } = o;
6
+ return {
7
+ creator: e == null ? void 0 : c(e),
8
+ ...i
9
+ };
10
+ };
11
+ function d(r) {
12
+ return r == null || u(r) && !n(r) ? r : l(r);
13
+ }
14
+ export {
15
+ d as serializeAttachmentSecurely
16
+ };
17
+ //# sourceMappingURL=attachment-serializer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachment-serializer.js","sources":["../../../src/models/serializers/attachment-serializer.ts"],"sourcesContent":["import { Document } from 'mongoose';\n\nimport type { IAttachment, IUser } from '~/interfaces';\n\nimport { isPopulated, isRef, type Ref } from '../../interfaces/common';\n\nimport { serializeUserSecurely, type IUserSerializedSecurely } from './user-serializer';\n\nexport type IAttachmentSerializedSecurely<A extends IAttachment> = Omit<A, 'creator'> & { creator?: Ref<IUserSerializedSecurely<IUser>> };\n\nconst omitInsecureAttributes = <A extends IAttachment>(attachment: A): IAttachmentSerializedSecurely<A> => {\n\n const leanDoc = (attachment instanceof Document)\n ? attachment.toObject<A>()\n : attachment;\n\n const { creator, ...rest } = leanDoc;\n\n const secureCreator = creator == null\n ? undefined\n : serializeUserSecurely(creator);\n\n return {\n creator: secureCreator,\n ...rest,\n };\n};\n\n\nexport function serializeAttachmentSecurely<A extends IAttachment>(attachment?: A): IAttachmentSerializedSecurely<A>;\nexport function serializeAttachmentSecurely<A extends IAttachment>(attachment?: Ref<A>): Ref<IAttachmentSerializedSecurely<A>>;\nexport function serializeAttachmentSecurely<A extends IAttachment>(attachment?: A | Ref<A>)\n : undefined | IAttachmentSerializedSecurely<A> | Ref<IAttachmentSerializedSecurely<A>> {\n\n if (attachment == null) return attachment;\n\n if (isRef(attachment) && !isPopulated(attachment)) return attachment;\n\n return omitInsecureAttributes(attachment);\n}\n"],"names":["omitInsecureAttributes","attachment","leanDoc","Document","creator","rest","serializeUserSecurely","serializeAttachmentSecurely","isRef","isPopulated"],"mappings":";;;AAUA,MAAMA,IAAyB,CAAwBC,MAAoD;AAEzG,QAAMC,IAAWD,aAAsBE,IACnCF,EAAW,SACX,IAAAA,GAEE,EAAE,SAAAG,GAAS,GAAGC,EAAA,IAASH;AAMtB,SAAA;AAAA,IACL,SALoBE,KAAW,OAC7B,SACAE,EAAsBF,CAAO;AAAA,IAI/B,GAAGC;AAAA,EAAA;AAEP;AAKO,SAASE,EAAmDN,GACwB;AAIzF,SAFIA,KAAc,QAEdO,EAAMP,CAAU,KAAK,CAACQ,EAAYR,CAAU,IAAUA,IAEnDD,EAAuBC,CAAU;AAC1C;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./user-serializer.cjs"),r=require("./attachment-serializer.cjs");exports.omitInsecureAttributes=e.omitInsecureAttributes;exports.serializeUserSecurely=e.serializeUserSecurely;exports.serializeAttachmentSecurely=r.serializeAttachmentSecurely;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from './user-serializer';
2
+ export * from './attachment-serializer';
@@ -0,0 +1,8 @@
1
+ import { omitInsecureAttributes as t, serializeUserSecurely as i } from "./user-serializer.js";
2
+ import { serializeAttachmentSecurely as s } from "./attachment-serializer.js";
3
+ export {
4
+ t as omitInsecureAttributes,
5
+ s as serializeAttachmentSecurely,
6
+ i as serializeUserSecurely
7
+ };
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("mongoose"),i=require("../../interfaces/common.cjs"),o=e=>{const n=e instanceof c.Document?e.toObject():e,{password:u,apiToken:a,email:r,...s}=n,t=s;return t.isEmailPublished&&(t.email=r),t};function l(e){return e==null||i.isRef(e)&&!i.isPopulated(e)?e:o(e)}exports.omitInsecureAttributes=o;exports.serializeUserSecurely=l;
2
+ //# sourceMappingURL=user-serializer.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-serializer.cjs","sources":["../../../src/models/serializers/user-serializer.ts"],"sourcesContent":["import { Document } from 'mongoose';\n\nimport { isPopulated, isRef, type Ref } from '../../interfaces/common';\nimport type { IUser } from '../../interfaces/user';\n\nexport type IUserSerializedSecurely<U extends IUser> = Omit<U, 'password' | 'apiToken' | 'email'> & { email?: string };\n\nexport const omitInsecureAttributes = <U extends IUser>(user: U): IUserSerializedSecurely<U> => {\n\n const leanDoc = (user instanceof Document)\n ? user.toObject<U>()\n : user;\n\n const {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n password, apiToken, email, ...rest\n } = leanDoc;\n\n const secureUser: IUserSerializedSecurely<U> = rest;\n\n // omit email\n if (secureUser.isEmailPublished) {\n secureUser.email = email;\n }\n\n return secureUser;\n};\n\nexport function serializeUserSecurely<U extends IUser>(user?: U): IUserSerializedSecurely<U>;\nexport function serializeUserSecurely<U extends IUser>(user?: Ref<U>): Ref<IUserSerializedSecurely<U>>;\nexport function serializeUserSecurely<U extends IUser>(user?: U | Ref<U>): undefined | IUserSerializedSecurely<U> | Ref<IUserSerializedSecurely<U>> {\n if (user == null) return user;\n\n if (isRef(user) && !isPopulated(user)) return user;\n\n return omitInsecureAttributes(user);\n}\n"],"names":["omitInsecureAttributes","user","leanDoc","Document","password","apiToken","email","rest","secureUser","serializeUserSecurely","isRef","isPopulated"],"mappings":"qJAOaA,EAA2CC,GAAwC,CAE9F,MAAMC,EAAWD,aAAgBE,EAAAA,SAC7BF,EAAK,SACL,EAAAA,EAEE,CAEJ,SAAAG,EAAU,SAAAC,EAAU,MAAAC,EAAO,GAAGC,CAC5B,EAAAL,EAEEM,EAAyCD,EAG/C,OAAIC,EAAW,mBACbA,EAAW,MAAQF,GAGdE,CACT,EAIO,SAASC,EAAuCR,EAA6F,CAGlJ,OAFIA,GAAQ,MAERS,EAAM,MAAAT,CAAI,GAAK,CAACU,EAAAA,YAAYV,CAAI,EAAUA,EAEvCD,EAAuBC,CAAI,CACpC"}
@@ -0,0 +1,9 @@
1
+ import { IUser } from '../../interfaces/user';
2
+ import { Ref } from '../../interfaces/common';
3
+
4
+ export type IUserSerializedSecurely<U extends IUser> = Omit<U, 'password' | 'apiToken' | 'email'> & {
5
+ email?: string;
6
+ };
7
+ export declare const omitInsecureAttributes: <U extends IUser>(user: U) => IUserSerializedSecurely<U>;
8
+ export declare function serializeUserSecurely<U extends IUser>(user?: U): IUserSerializedSecurely<U>;
9
+ export declare function serializeUserSecurely<U extends IUser>(user?: Ref<U>): Ref<IUserSerializedSecurely<U>>;
@@ -0,0 +1,20 @@
1
+ import { Document as r } from "mongoose";
2
+ import { isRef as c, isPopulated as s } from "../../interfaces/common.js";
3
+ const l = (t) => {
4
+ const i = t instanceof r ? t.toObject() : t, {
5
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
6
+ password: a,
7
+ apiToken: m,
8
+ email: o,
9
+ ...n
10
+ } = i, e = n;
11
+ return e.isEmailPublished && (e.email = o), e;
12
+ };
13
+ function u(t) {
14
+ return t == null || c(t) && !s(t) ? t : l(t);
15
+ }
16
+ export {
17
+ l as omitInsecureAttributes,
18
+ u as serializeUserSecurely
19
+ };
20
+ //# sourceMappingURL=user-serializer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-serializer.js","sources":["../../../src/models/serializers/user-serializer.ts"],"sourcesContent":["import { Document } from 'mongoose';\n\nimport { isPopulated, isRef, type Ref } from '../../interfaces/common';\nimport type { IUser } from '../../interfaces/user';\n\nexport type IUserSerializedSecurely<U extends IUser> = Omit<U, 'password' | 'apiToken' | 'email'> & { email?: string };\n\nexport const omitInsecureAttributes = <U extends IUser>(user: U): IUserSerializedSecurely<U> => {\n\n const leanDoc = (user instanceof Document)\n ? user.toObject<U>()\n : user;\n\n const {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n password, apiToken, email, ...rest\n } = leanDoc;\n\n const secureUser: IUserSerializedSecurely<U> = rest;\n\n // omit email\n if (secureUser.isEmailPublished) {\n secureUser.email = email;\n }\n\n return secureUser;\n};\n\nexport function serializeUserSecurely<U extends IUser>(user?: U): IUserSerializedSecurely<U>;\nexport function serializeUserSecurely<U extends IUser>(user?: Ref<U>): Ref<IUserSerializedSecurely<U>>;\nexport function serializeUserSecurely<U extends IUser>(user?: U | Ref<U>): undefined | IUserSerializedSecurely<U> | Ref<IUserSerializedSecurely<U>> {\n if (user == null) return user;\n\n if (isRef(user) && !isPopulated(user)) return user;\n\n return omitInsecureAttributes(user);\n}\n"],"names":["omitInsecureAttributes","user","leanDoc","Document","password","apiToken","email","rest","secureUser","serializeUserSecurely","isRef","isPopulated"],"mappings":";;AAOa,MAAAA,IAAyB,CAAkBC,MAAwC;AAE9F,QAAMC,IAAWD,aAAgBE,IAC7BF,EAAK,SACL,IAAAA,GAEE;AAAA;AAAA,IAEJ,UAAAG;AAAA,IAAU,UAAAC;AAAA,IAAU,OAAAC;AAAA,IAAO,GAAGC;AAAA,EAC5B,IAAAL,GAEEM,IAAyCD;AAG/C,SAAIC,EAAW,qBACbA,EAAW,QAAQF,IAGdE;AACT;AAIO,SAASC,EAAuCR,GAA6F;AAGlJ,SAFIA,KAAQ,QAERS,EAAMT,CAAI,KAAK,CAACU,EAAYV,CAAI,IAAUA,IAEvCD,EAAuBC,CAAI;AACpC;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growi/core",
3
- "version": "1.1.0",
3
+ "version": "1.2.0-next.a29562bbcdacd0e472c7c00fa17797bcf401f9ef",
4
4
  "description": "GROWI Core Libraries",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -30,6 +30,10 @@
30
30
  "import": "./dist/models/index.js",
31
31
  "require": "./dist/models/index.cjs"
32
32
  },
33
+ "./dist/models/serializers": {
34
+ "import": "./dist/models/serializers/index.js",
35
+ "require": "./dist/models/serializers/index.cjs"
36
+ },
33
37
  "./dist/remark-plugins": {
34
38
  "import": "./dist/remark-plugins/index.js",
35
39
  "require": "./dist/remark-plugins/index.cjs"