@growi/core 1.6.0 → 2.0.0-next.d92d1aa0318d5fdc7fe811d2d94d2cd9e881ec33

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 (72) hide show
  1. package/LICENSE +1 -1
  2. package/dist/consts/system.cjs +1 -1
  3. package/dist/consts/system.cjs.map +1 -1
  4. package/dist/consts/system.d.ts +1 -0
  5. package/dist/consts/system.js +1 -0
  6. package/dist/consts/system.js.map +1 -1
  7. package/dist/index.cjs +1 -1
  8. package/dist/index.js +44 -38
  9. package/dist/index.js.map +1 -1
  10. package/dist/interfaces/growi-app-info.cjs.map +1 -1
  11. package/dist/interfaces/growi-app-info.d.ts +7 -3
  12. package/dist/interfaces/growi-app-info.js.map +1 -1
  13. package/dist/interfaces/index.cjs +1 -1
  14. package/dist/interfaces/index.d.ts +1 -0
  15. package/dist/interfaces/index.js +34 -28
  16. package/dist/interfaces/index.js.map +1 -1
  17. package/dist/interfaces/page.cjs +1 -1
  18. package/dist/interfaces/page.cjs.map +1 -1
  19. package/dist/interfaces/page.d.ts +23 -9
  20. package/dist/interfaces/page.js +11 -9
  21. package/dist/interfaces/page.js.map +1 -1
  22. package/dist/interfaces/scope.cjs +2 -0
  23. package/dist/interfaces/scope.cjs.map +1 -0
  24. package/dist/interfaces/scope.d.ts +106 -0
  25. package/dist/interfaces/scope.js +66 -0
  26. package/dist/interfaces/scope.js.map +1 -0
  27. package/dist/models/devided-page-path.cjs +1 -1
  28. package/dist/models/devided-page-path.cjs.map +1 -1
  29. package/dist/models/devided-page-path.js +9 -9
  30. package/dist/models/devided-page-path.js.map +1 -1
  31. package/dist/models/index.cjs +1 -1
  32. package/dist/models/index.js +5 -4
  33. package/dist/models/serializers/attachment-serializer.cjs.map +1 -1
  34. package/dist/models/serializers/attachment-serializer.js.map +1 -1
  35. package/dist/models/serializers/user-serializer.cjs.map +1 -1
  36. package/dist/models/serializers/user-serializer.js +2 -1
  37. package/dist/models/serializers/user-serializer.js.map +1 -1
  38. package/dist/models/vo/error-apiv3.cjs +1 -1
  39. package/dist/models/vo/error-apiv3.cjs.map +1 -1
  40. package/dist/models/vo/error-apiv3.d.ts +4 -3
  41. package/dist/models/vo/error-apiv3.js +8 -7
  42. package/dist/models/vo/error-apiv3.js.map +1 -1
  43. package/dist/swr/index.cjs +1 -1
  44. package/dist/swr/index.d.ts +0 -2
  45. package/dist/swr/index.js +2 -8
  46. package/dist/swr/index.js.map +1 -1
  47. package/dist/utils/global-event-target.cjs +2 -0
  48. package/dist/utils/global-event-target.cjs.map +1 -0
  49. package/dist/utils/global-event-target.d.ts +6 -0
  50. package/dist/utils/global-event-target.js +15 -0
  51. package/dist/utils/global-event-target.js.map +1 -0
  52. package/dist/utils/index.cjs +1 -1
  53. package/dist/utils/index.cjs.map +1 -1
  54. package/dist/utils/index.d.ts +1 -0
  55. package/dist/utils/index.js +10 -8
  56. package/dist/utils/index.js.map +1 -1
  57. package/dist/utils/page-path-utils/index.cjs.map +1 -1
  58. package/dist/utils/page-path-utils/index.js +3 -3
  59. package/dist/utils/page-path-utils/index.js.map +1 -1
  60. package/dist/utils/page-utils.cjs.map +1 -1
  61. package/dist/utils/page-utils.js.map +1 -1
  62. package/package.json +1 -1
  63. package/dist/swr/use-global-socket.cjs +0 -2
  64. package/dist/swr/use-global-socket.cjs.map +0 -1
  65. package/dist/swr/use-global-socket.d.ts +0 -6
  66. package/dist/swr/use-global-socket.js +0 -8
  67. package/dist/swr/use-global-socket.js.map +0 -1
  68. package/dist/swr/use-swr-static.cjs +0 -2
  69. package/dist/swr/use-swr-static.cjs.map +0 -1
  70. package/dist/swr/use-swr-static.d.ts +0 -5
  71. package/dist/swr/use-swr-static.js +0 -17
  72. package/dist/swr/use-swr-static.js.map +0 -1
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018 WESEEK, Inc.
3
+ Copyright (c) 2018 GROWI, Inc.
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={cloud:"cloud",privateCloud:"private-cloud",onPremise:"on-premise",others:"others"},o={officialHelmChart:"official-helm-chart",growiDockerCompose:"growi-docker-compose",node:"node",others:"others"};exports.GrowiDeploymentType=o;exports.GrowiServiceType=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={cloud:"cloud",privateCloud:"private-cloud",onPremise:"on-premise",dev:"dev",others:"others"},o={officialHelmChart:"official-helm-chart",growiDockerCompose:"growi-docker-compose",node:"node",others:"others"};exports.GrowiDeploymentType=o;exports.GrowiServiceType=e;
2
2
  //# sourceMappingURL=system.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"system.cjs","sources":["../../src/consts/system.ts"],"sourcesContent":["export const GrowiServiceType = {\n cloud: 'cloud',\n privateCloud: 'private-cloud',\n onPremise: 'on-premise',\n others: 'others',\n} as const;\n\nexport const GrowiDeploymentType = {\n officialHelmChart: 'official-helm-chart',\n growiDockerCompose: 'growi-docker-compose',\n node: 'node',\n others: 'others',\n} as const;\n\nexport type GrowiServiceType =\n (typeof GrowiServiceType)[keyof typeof GrowiServiceType];\n\nexport type GrowiDeploymentType =\n (typeof GrowiDeploymentType)[keyof typeof GrowiDeploymentType];\n"],"names":["GrowiServiceType","GrowiDeploymentType"],"mappings":"gFAAO,MAAMA,EAAmB,CAC9B,MAAO,QACP,aAAc,gBACd,UAAW,aACX,OAAQ,QACV,EAEaC,EAAsB,CACjC,kBAAmB,sBACnB,mBAAoB,uBACpB,KAAM,OACN,OAAQ,QACV"}
1
+ {"version":3,"file":"system.cjs","sources":["../../src/consts/system.ts"],"sourcesContent":["export const GrowiServiceType = {\n cloud: 'cloud',\n privateCloud: 'private-cloud',\n onPremise: 'on-premise',\n dev: 'dev',\n others: 'others',\n} as const;\n\nexport const GrowiDeploymentType = {\n officialHelmChart: 'official-helm-chart',\n growiDockerCompose: 'growi-docker-compose',\n node: 'node',\n others: 'others',\n} as const;\n\nexport type GrowiServiceType =\n (typeof GrowiServiceType)[keyof typeof GrowiServiceType];\n\nexport type GrowiDeploymentType =\n (typeof GrowiDeploymentType)[keyof typeof GrowiDeploymentType];\n"],"names":["GrowiServiceType","GrowiDeploymentType"],"mappings":"gFAAO,MAAMA,EAAmB,CAC9B,MAAO,QACP,aAAc,gBACd,UAAW,aACX,IAAK,MACL,OAAQ,QACV,EAEaC,EAAsB,CACjC,kBAAmB,sBACnB,mBAAoB,uBACpB,KAAM,OACN,OAAQ,QACV"}
@@ -2,6 +2,7 @@ export declare const GrowiServiceType: {
2
2
  readonly cloud: "cloud";
3
3
  readonly privateCloud: "private-cloud";
4
4
  readonly onPremise: "on-premise";
5
+ readonly dev: "dev";
5
6
  readonly others: "others";
6
7
  };
7
8
  export declare const GrowiDeploymentType: {
@@ -2,6 +2,7 @@ const o = {
2
2
  cloud: "cloud",
3
3
  privateCloud: "private-cloud",
4
4
  onPremise: "on-premise",
5
+ dev: "dev",
5
6
  others: "others"
6
7
  }, e = {
7
8
  officialHelmChart: "official-helm-chart",
@@ -1 +1 @@
1
- {"version":3,"file":"system.js","sources":["../../src/consts/system.ts"],"sourcesContent":["export const GrowiServiceType = {\n cloud: 'cloud',\n privateCloud: 'private-cloud',\n onPremise: 'on-premise',\n others: 'others',\n} as const;\n\nexport const GrowiDeploymentType = {\n officialHelmChart: 'official-helm-chart',\n growiDockerCompose: 'growi-docker-compose',\n node: 'node',\n others: 'others',\n} as const;\n\nexport type GrowiServiceType =\n (typeof GrowiServiceType)[keyof typeof GrowiServiceType];\n\nexport type GrowiDeploymentType =\n (typeof GrowiDeploymentType)[keyof typeof GrowiDeploymentType];\n"],"names":["GrowiServiceType","GrowiDeploymentType"],"mappings":"AAAO,MAAMA,IAAmB;AAAA,EAC9B,OAAO;AAAA,EACP,cAAc;AAAA,EACd,WAAW;AAAA,EACX,QAAQ;AACV,GAEaC,IAAsB;AAAA,EACjC,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,MAAM;AAAA,EACN,QAAQ;AACV;"}
1
+ {"version":3,"file":"system.js","sources":["../../src/consts/system.ts"],"sourcesContent":["export const GrowiServiceType = {\n cloud: 'cloud',\n privateCloud: 'private-cloud',\n onPremise: 'on-premise',\n dev: 'dev',\n others: 'others',\n} as const;\n\nexport const GrowiDeploymentType = {\n officialHelmChart: 'official-helm-chart',\n growiDockerCompose: 'growi-docker-compose',\n node: 'node',\n others: 'others',\n} as const;\n\nexport type GrowiServiceType =\n (typeof GrowiServiceType)[keyof typeof GrowiServiceType];\n\nexport type GrowiDeploymentType =\n (typeof GrowiDeploymentType)[keyof typeof GrowiDeploymentType];\n"],"names":["GrowiServiceType","GrowiDeploymentType"],"mappings":"AAAO,MAAMA,IAAmB;AAAA,EAC9B,OAAO;AAAA,EACP,cAAc;AAAA,EACd,WAAW;AAAA,EACX,KAAK;AAAA,EACL,QAAQ;AACV,GAEaC,IAAsB;AAAA,EACjC,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,MAAM;AAAA,EACN,QAAQ;AACV;"}
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./consts/accepted-upload-file-type.cjs"),S=require("./consts/growi-plugin.cjs"),n=require("./consts/system.cjs"),c=require("./consts/ydoc-status.cjs"),u=require("./interfaces/color-scheme.cjs"),o=require("./interfaces/common.cjs"),r=require("./interfaces/config-manager.cjs"),l=require("./interfaces/growi-app-info.cjs"),t=require("./interfaces/growi-theme-metadata.cjs"),a=require("./interfaces/lang.cjs"),e=require("./interfaces/page.cjs"),i=require("./interfaces/primitive/string.cjs"),g=require("./interfaces/revision.cjs"),s=require("./interfaces/subscription.cjs"),y=require("./interfaces/user.cjs");exports.AcceptedUploadFileType=p.AcceptedUploadFileType;exports.GrowiPluginType=S.GrowiPluginType;exports.GrowiDeploymentType=n.GrowiDeploymentType;exports.GrowiServiceType=n.GrowiServiceType;exports.YDocStatus=c.YDocStatus;exports.ColorScheme=u.ColorScheme;exports.getIdForRef=o.getIdForRef;exports.getIdStringForRef=o.getIdStringForRef;exports.isPopulated=o.isPopulated;exports.isRef=o.isRef;exports.ConfigSource=r.ConfigSource;exports.defineConfig=r.defineConfig;exports.GrowiWikiType=l.GrowiWikiType;exports.GrowiThemeSchemeType=t.GrowiThemeSchemeType;exports.isGrowiThemeMetadata=t.isGrowiThemeMetadata;exports.AllLang=a.AllLang;exports.Lang=a.Lang;exports.GroupType=e.GroupType;exports.PageGrant=e.PageGrant;exports.PageStatus=e.PageStatus;exports.isIPageInfo=e.isIPageInfo;exports.isIPageInfoForEntity=e.isIPageInfoForEntity;exports.isIPageInfoForListing=e.isIPageInfoForListing;exports.isIPageInfoForOperation=e.isIPageInfoForOperation;exports.isNonBlankString=i.isNonBlankString;exports.isNonEmptyString=i.isNonEmptyString;exports.toNonBlankString=i.toNonBlankString;exports.toNonBlankStringOrUndefined=i.toNonBlankStringOrUndefined;exports.toNonEmptyString=i.toNonEmptyString;exports.toNonEmptyStringOrUndefined=i.toNonEmptyStringOrUndefined;exports.Origin=g.Origin;exports.allOrigin=g.allOrigin;exports.AllSubscriptionStatusType=s.AllSubscriptionStatusType;exports.SubscriptionStatusType=s.SubscriptionStatusType;exports.USER_STATUS=y.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"),r=require("./consts/system.cjs"),u=require("./consts/ydoc-status.cjs"),l=require("./interfaces/color-scheme.cjs"),o=require("./interfaces/common.cjs"),t=require("./interfaces/config-manager.cjs"),y=require("./interfaces/growi-app-info.cjs"),s=require("./interfaces/growi-theme-metadata.cjs"),a=require("./interfaces/lang.cjs"),e=require("./interfaces/page.cjs"),i=require("./interfaces/primitive/string.cjs"),g=require("./interfaces/revision.cjs"),n=require("./interfaces/scope.cjs"),p=require("./interfaces/subscription.cjs"),I=require("./interfaces/user.cjs");exports.AcceptedUploadFileType=S.AcceptedUploadFileType;exports.GrowiPluginType=c.GrowiPluginType;exports.GrowiDeploymentType=r.GrowiDeploymentType;exports.GrowiServiceType=r.GrowiServiceType;exports.YDocStatus=u.YDocStatus;exports.ColorScheme=l.ColorScheme;exports.getIdForRef=o.getIdForRef;exports.getIdStringForRef=o.getIdStringForRef;exports.isPopulated=o.isPopulated;exports.isRef=o.isRef;exports.ConfigSource=t.ConfigSource;exports.defineConfig=t.defineConfig;exports.GrowiWikiType=y.GrowiWikiType;exports.GrowiThemeSchemeType=s.GrowiThemeSchemeType;exports.isGrowiThemeMetadata=s.isGrowiThemeMetadata;exports.AllLang=a.AllLang;exports.Lang=a.Lang;exports.GroupType=e.GroupType;exports.PageGrant=e.PageGrant;exports.PageStatus=e.PageStatus;exports.isIPageInfo=e.isIPageInfo;exports.isIPageInfoForEmpty=e.isIPageInfoForEmpty;exports.isIPageInfoForEntity=e.isIPageInfoForEntity;exports.isIPageInfoForListing=e.isIPageInfoForListing;exports.isIPageInfoForOperation=e.isIPageInfoForOperation;exports.isIPageNotFoundInfo=e.isIPageNotFoundInfo;exports.isNonBlankString=i.isNonBlankString;exports.isNonEmptyString=i.isNonEmptyString;exports.toNonBlankString=i.toNonBlankString;exports.toNonBlankStringOrUndefined=i.toNonBlankStringOrUndefined;exports.toNonEmptyString=i.toNonEmptyString;exports.toNonEmptyStringOrUndefined=i.toNonEmptyStringOrUndefined;exports.Origin=g.Origin;exports.allOrigin=g.allOrigin;exports.ACTION=n.ACTION;exports.ALL_SIGN=n.ALL_SIGN;exports.SCOPE=n.SCOPE;exports.AllSubscriptionStatusType=p.AllSubscriptionStatusType;exports.SubscriptionStatusType=p.SubscriptionStatusType;exports.USER_STATUS=I.USER_STATUS;
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -3,51 +3,57 @@ import { GrowiPluginType as i } from "./consts/growi-plugin.js";
3
3
  import { GrowiDeploymentType as p, GrowiServiceType as f } from "./consts/system.js";
4
4
  import { YDocStatus as g } from "./consts/ydoc-status.js";
5
5
  import { ColorScheme as S } from "./interfaces/color-scheme.js";
6
- import { getIdForRef as l, getIdStringForRef as x, isPopulated as y, isRef as T } from "./interfaces/common.js";
7
- import { ConfigSource as u, defineConfig as I } from "./interfaces/config-manager.js";
8
- import { GrowiWikiType as G } from "./interfaces/growi-app-info.js";
9
- import { GrowiThemeSchemeType as w, isGrowiThemeMetadata as F } from "./interfaces/growi-theme-metadata.js";
10
- import { AllLang as E, Lang as O } from "./interfaces/lang.js";
11
- import { GroupType as h, PageGrant as k, PageStatus as A, isIPageInfo as R, isIPageInfoForEntity as B, isIPageInfoForListing as C, isIPageInfoForOperation as L } from "./interfaces/page.js";
12
- import { isNonBlankString as D, isNonEmptyString as v, toNonBlankString as M, toNonBlankStringOrUndefined as W, toNonEmptyString as Y, toNonEmptyStringOrUndefined as _ } from "./interfaces/primitive/string.js";
13
- import { Origin as q, allOrigin as z } from "./interfaces/revision.js";
14
- import { AllSubscriptionStatusType as J, SubscriptionStatusType as K } from "./interfaces/subscription.js";
15
- import { USER_STATUS as V } from "./interfaces/user.js";
6
+ import { getIdForRef as x, getIdStringForRef as I, isPopulated as l, isRef as y } from "./interfaces/common.js";
7
+ import { ConfigSource as d, defineConfig as u } from "./interfaces/config-manager.js";
8
+ import { GrowiWikiType as c } from "./interfaces/growi-app-info.js";
9
+ import { GrowiThemeSchemeType as N, isGrowiThemeMetadata as F } from "./interfaces/growi-theme-metadata.js";
10
+ import { AllLang as O, Lang as w } from "./interfaces/lang.js";
11
+ import { GroupType as C, PageGrant as L, PageStatus as U, isIPageInfo as h, isIPageInfoForEmpty as k, isIPageInfoForEntity as R, isIPageInfoForListing as B, isIPageInfoForOperation as b, isIPageNotFoundInfo as D } from "./interfaces/page.js";
12
+ import { isNonBlankString as v, isNonEmptyString as M, toNonBlankString as W, toNonBlankStringOrUndefined as Y, toNonEmptyString as j, toNonEmptyStringOrUndefined as q } from "./interfaces/primitive/string.js";
13
+ import { Origin as H, allOrigin as J } from "./interfaces/revision.js";
14
+ import { ACTION as Q, ALL_SIGN as V, SCOPE as X } from "./interfaces/scope.js";
15
+ import { AllSubscriptionStatusType as $, SubscriptionStatusType as oo } from "./interfaces/subscription.js";
16
+ import { USER_STATUS as ro } from "./interfaces/user.js";
16
17
  export {
18
+ Q as ACTION,
19
+ V as ALL_SIGN,
17
20
  r as AcceptedUploadFileType,
18
- E as AllLang,
19
- J as AllSubscriptionStatusType,
21
+ O as AllLang,
22
+ $ as AllSubscriptionStatusType,
20
23
  S as ColorScheme,
21
- u as ConfigSource,
22
- h as GroupType,
24
+ d as ConfigSource,
25
+ C as GroupType,
23
26
  p as GrowiDeploymentType,
24
27
  i as GrowiPluginType,
25
28
  f as GrowiServiceType,
26
- w as GrowiThemeSchemeType,
27
- G as GrowiWikiType,
28
- O as Lang,
29
- q as Origin,
30
- k as PageGrant,
31
- A as PageStatus,
32
- K as SubscriptionStatusType,
33
- V as USER_STATUS,
29
+ N as GrowiThemeSchemeType,
30
+ c as GrowiWikiType,
31
+ w as Lang,
32
+ H as Origin,
33
+ L as PageGrant,
34
+ U as PageStatus,
35
+ X as SCOPE,
36
+ oo as SubscriptionStatusType,
37
+ ro as USER_STATUS,
34
38
  g as YDocStatus,
35
- z as allOrigin,
36
- I as defineConfig,
37
- l as getIdForRef,
38
- x as getIdStringForRef,
39
+ J as allOrigin,
40
+ u as defineConfig,
41
+ x as getIdForRef,
42
+ I as getIdStringForRef,
39
43
  F as isGrowiThemeMetadata,
40
- R as isIPageInfo,
41
- B as isIPageInfoForEntity,
42
- C as isIPageInfoForListing,
43
- L as isIPageInfoForOperation,
44
- D as isNonBlankString,
45
- v as isNonEmptyString,
46
- y as isPopulated,
47
- T as isRef,
48
- M as toNonBlankString,
49
- W as toNonBlankStringOrUndefined,
50
- Y as toNonEmptyString,
51
- _ as toNonEmptyStringOrUndefined
44
+ h as isIPageInfo,
45
+ k as isIPageInfoForEmpty,
46
+ R as isIPageInfoForEntity,
47
+ B as isIPageInfoForListing,
48
+ b as isIPageInfoForOperation,
49
+ D as isIPageNotFoundInfo,
50
+ v as isNonBlankString,
51
+ M as isNonEmptyString,
52
+ l as isPopulated,
53
+ y as isRef,
54
+ W as toNonBlankString,
55
+ Y as toNonBlankStringOrUndefined,
56
+ j as toNonEmptyString,
57
+ q as toNonEmptyStringOrUndefined
52
58
  };
53
59
  //# 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 +1 @@
1
- {"version":3,"file":"growi-app-info.cjs","sources":["../../src/interfaces/growi-app-info.ts"],"sourcesContent":["import type * as os from 'node:os';\n\nimport type { GrowiDeploymentType, GrowiServiceType } from '../consts/system';\n\nexport const GrowiWikiType = { open: 'open', closed: 'closed' } as const;\ntype GrowiWikiType = (typeof GrowiWikiType)[keyof typeof GrowiWikiType];\n\n// Info options for additionalInfo selection\nexport interface GrowiInfoOptions {\n includeAttachmentInfo?: boolean;\n includeInstalledInfo?: boolean;\n includeUserCountInfo?: boolean;\n // Future extensions can be added here\n // includePageCount?: boolean;\n}\n\ninterface IGrowiOSInfo {\n type?: ReturnType<typeof os.type>;\n platform?: ReturnType<typeof os.platform>;\n arch?: ReturnType<typeof os.arch>;\n totalmem?: ReturnType<typeof os.totalmem>;\n}\n\ninterface IAdditionalAttachmentInfo {\n attachmentType: string;\n activeExternalAccountTypes: string[];\n}\n\ninterface IAdditionalInstalledAtInfo {\n installedAt: Date;\n installedAtByOldestUser: Date | null;\n}\n\ninterface IAdditionalUserCountInfo {\n currentUsersCount: number;\n currentActiveUsersCount: number;\n}\n\nexport interface IGrowiAdditionalInfo\n extends IAdditionalInstalledAtInfo,\n IAdditionalUserCountInfo,\n IAdditionalAttachmentInfo {}\n\n// Type mapping for flexible options\nexport type IGrowiAdditionalInfoByOptions<T extends GrowiInfoOptions> =\n (T['includeAttachmentInfo'] extends true\n ? IAdditionalAttachmentInfo\n : Record<string, never>) &\n (T['includeInstalledInfo'] extends true\n ? IAdditionalInstalledAtInfo\n : Record<string, never>) &\n (T['includeUserCountInfo'] extends true\n ? IAdditionalUserCountInfo\n : Record<string, never>);\n\n// Helper type to check if any option is enabled\nexport type HasAnyOption<T extends GrowiInfoOptions> =\n T['includeAttachmentInfo'] extends true\n ? true\n : T['includeInstalledInfo'] extends true\n ? true\n : T['includeUserCountInfo'] extends true\n ? true\n : false;\n\n// Final result type based on options\nexport type IGrowiAdditionalInfoResult<T extends GrowiInfoOptions> =\n HasAnyOption<T> extends true ? IGrowiAdditionalInfoByOptions<T> : undefined;\n\nexport interface IGrowiInfo<A extends object | undefined = undefined> {\n serviceInstanceId: string;\n appSiteUrl: string;\n osInfo: IGrowiOSInfo;\n version: string;\n type: GrowiServiceType;\n wikiType: GrowiWikiType;\n deploymentType: GrowiDeploymentType;\n additionalInfo?: A;\n}\n"],"names":["GrowiWikiType"],"mappings":"gFAIO,MAAMA,EAAgB,CAAE,KAAM,OAAQ,OAAQ,QAAS"}
1
+ {"version":3,"file":"growi-app-info.cjs","sources":["../../src/interfaces/growi-app-info.ts"],"sourcesContent":["import type * as os from 'node:os';\n\nimport type { GrowiDeploymentType, GrowiServiceType } from '../consts/system';\n\nexport const GrowiWikiType = { open: 'open', closed: 'closed' } as const;\ntype GrowiWikiType = (typeof GrowiWikiType)[keyof typeof GrowiWikiType];\n\n// Info options for additionalInfo selection\nexport interface GrowiInfoOptions {\n includeAttachmentInfo?: boolean;\n includeInstalledInfo?: boolean;\n includeUserCountInfo?: boolean;\n includePageCountInfo?: boolean;\n // Future extensions can be added here\n}\n\ninterface IGrowiOSInfo {\n type?: ReturnType<typeof os.type>;\n platform?: ReturnType<typeof os.platform>;\n arch?: ReturnType<typeof os.arch>;\n totalmem?: ReturnType<typeof os.totalmem>;\n}\n\ninterface IAdditionalAttachmentInfo {\n attachmentType: string;\n activeExternalAccountTypes: string[];\n}\n\ninterface IAdditionalInstalledAtInfo {\n installedAt: Date;\n installedAtByOldestUser: Date | null;\n}\n\ninterface IAdditionalUserCountInfo {\n currentUsersCount: number;\n currentActiveUsersCount: number;\n}\n\ninterface IAdditionalPageCountInfo {\n currentPagesCount: number;\n}\n\nexport interface IGrowiAdditionalInfo\n extends IAdditionalInstalledAtInfo,\n IAdditionalUserCountInfo,\n IAdditionalPageCountInfo,\n IAdditionalAttachmentInfo {}\n\n// Type mapping for flexible options\nexport type IGrowiAdditionalInfoByOptions<T extends GrowiInfoOptions> =\n (T['includeAttachmentInfo'] extends true\n ? IAdditionalAttachmentInfo\n : Record<string, never>) &\n (T['includeInstalledInfo'] extends true\n ? IAdditionalInstalledAtInfo\n : Record<string, never>) &\n (T['includeUserCountInfo'] extends true\n ? IAdditionalUserCountInfo\n : Record<string, never>) &\n (T['includePageCountInfo'] extends true\n ? IAdditionalPageCountInfo\n : Record<string, never>);\n\n// Helper type to check if any option is enabled\nexport type HasAnyOption<T extends GrowiInfoOptions> =\n T['includeAttachmentInfo'] extends true\n ? true\n : T['includeInstalledInfo'] extends true\n ? true\n : T['includeUserCountInfo'] extends true\n ? true\n : T['includePageCountInfo'] extends true\n ? true\n : false;\n\n// Final result type based on options\nexport type IGrowiAdditionalInfoResult<T extends GrowiInfoOptions> =\n HasAnyOption<T> extends true ? IGrowiAdditionalInfoByOptions<T> : undefined;\n\nexport interface IGrowiInfo<A extends object | undefined = undefined> {\n serviceInstanceId: string;\n appSiteUrl: string;\n osInfo: IGrowiOSInfo;\n version: string;\n type: GrowiServiceType;\n wikiType: GrowiWikiType;\n deploymentType: GrowiDeploymentType;\n additionalInfo?: A;\n}\n"],"names":["GrowiWikiType"],"mappings":"gFAIO,MAAMA,EAAgB,CAAE,KAAM,OAAQ,OAAQ,QAAS"}
@@ -9,6 +9,7 @@ export interface GrowiInfoOptions {
9
9
  includeAttachmentInfo?: boolean;
10
10
  includeInstalledInfo?: boolean;
11
11
  includeUserCountInfo?: boolean;
12
+ includePageCountInfo?: boolean;
12
13
  }
13
14
  interface IGrowiOSInfo {
14
15
  type?: ReturnType<typeof os.type>;
@@ -28,10 +29,13 @@ interface IAdditionalUserCountInfo {
28
29
  currentUsersCount: number;
29
30
  currentActiveUsersCount: number;
30
31
  }
31
- export interface IGrowiAdditionalInfo extends IAdditionalInstalledAtInfo, IAdditionalUserCountInfo, IAdditionalAttachmentInfo {
32
+ interface IAdditionalPageCountInfo {
33
+ currentPagesCount: number;
32
34
  }
33
- export type IGrowiAdditionalInfoByOptions<T extends GrowiInfoOptions> = (T['includeAttachmentInfo'] extends true ? IAdditionalAttachmentInfo : Record<string, never>) & (T['includeInstalledInfo'] extends true ? IAdditionalInstalledAtInfo : Record<string, never>) & (T['includeUserCountInfo'] extends true ? IAdditionalUserCountInfo : Record<string, never>);
34
- export type HasAnyOption<T extends GrowiInfoOptions> = T['includeAttachmentInfo'] extends true ? true : T['includeInstalledInfo'] extends true ? true : T['includeUserCountInfo'] extends true ? true : false;
35
+ export interface IGrowiAdditionalInfo extends IAdditionalInstalledAtInfo, IAdditionalUserCountInfo, IAdditionalPageCountInfo, IAdditionalAttachmentInfo {
36
+ }
37
+ export type IGrowiAdditionalInfoByOptions<T extends GrowiInfoOptions> = (T['includeAttachmentInfo'] extends true ? IAdditionalAttachmentInfo : Record<string, never>) & (T['includeInstalledInfo'] extends true ? IAdditionalInstalledAtInfo : Record<string, never>) & (T['includeUserCountInfo'] extends true ? IAdditionalUserCountInfo : Record<string, never>) & (T['includePageCountInfo'] extends true ? IAdditionalPageCountInfo : Record<string, never>);
38
+ export type HasAnyOption<T extends GrowiInfoOptions> = T['includeAttachmentInfo'] extends true ? true : T['includeInstalledInfo'] extends true ? true : T['includeUserCountInfo'] extends true ? true : T['includePageCountInfo'] extends true ? true : false;
35
39
  export type IGrowiAdditionalInfoResult<T extends GrowiInfoOptions> = HasAnyOption<T> extends true ? IGrowiAdditionalInfoByOptions<T> : undefined;
36
40
  export interface IGrowiInfo<A extends object | undefined = undefined> {
37
41
  serviceInstanceId: string;
@@ -1 +1 @@
1
- {"version":3,"file":"growi-app-info.js","sources":["../../src/interfaces/growi-app-info.ts"],"sourcesContent":["import type * as os from 'node:os';\n\nimport type { GrowiDeploymentType, GrowiServiceType } from '../consts/system';\n\nexport const GrowiWikiType = { open: 'open', closed: 'closed' } as const;\ntype GrowiWikiType = (typeof GrowiWikiType)[keyof typeof GrowiWikiType];\n\n// Info options for additionalInfo selection\nexport interface GrowiInfoOptions {\n includeAttachmentInfo?: boolean;\n includeInstalledInfo?: boolean;\n includeUserCountInfo?: boolean;\n // Future extensions can be added here\n // includePageCount?: boolean;\n}\n\ninterface IGrowiOSInfo {\n type?: ReturnType<typeof os.type>;\n platform?: ReturnType<typeof os.platform>;\n arch?: ReturnType<typeof os.arch>;\n totalmem?: ReturnType<typeof os.totalmem>;\n}\n\ninterface IAdditionalAttachmentInfo {\n attachmentType: string;\n activeExternalAccountTypes: string[];\n}\n\ninterface IAdditionalInstalledAtInfo {\n installedAt: Date;\n installedAtByOldestUser: Date | null;\n}\n\ninterface IAdditionalUserCountInfo {\n currentUsersCount: number;\n currentActiveUsersCount: number;\n}\n\nexport interface IGrowiAdditionalInfo\n extends IAdditionalInstalledAtInfo,\n IAdditionalUserCountInfo,\n IAdditionalAttachmentInfo {}\n\n// Type mapping for flexible options\nexport type IGrowiAdditionalInfoByOptions<T extends GrowiInfoOptions> =\n (T['includeAttachmentInfo'] extends true\n ? IAdditionalAttachmentInfo\n : Record<string, never>) &\n (T['includeInstalledInfo'] extends true\n ? IAdditionalInstalledAtInfo\n : Record<string, never>) &\n (T['includeUserCountInfo'] extends true\n ? IAdditionalUserCountInfo\n : Record<string, never>);\n\n// Helper type to check if any option is enabled\nexport type HasAnyOption<T extends GrowiInfoOptions> =\n T['includeAttachmentInfo'] extends true\n ? true\n : T['includeInstalledInfo'] extends true\n ? true\n : T['includeUserCountInfo'] extends true\n ? true\n : false;\n\n// Final result type based on options\nexport type IGrowiAdditionalInfoResult<T extends GrowiInfoOptions> =\n HasAnyOption<T> extends true ? IGrowiAdditionalInfoByOptions<T> : undefined;\n\nexport interface IGrowiInfo<A extends object | undefined = undefined> {\n serviceInstanceId: string;\n appSiteUrl: string;\n osInfo: IGrowiOSInfo;\n version: string;\n type: GrowiServiceType;\n wikiType: GrowiWikiType;\n deploymentType: GrowiDeploymentType;\n additionalInfo?: A;\n}\n"],"names":["GrowiWikiType"],"mappings":"AAIO,MAAMA,IAAgB,EAAE,MAAM,QAAQ,QAAQ,SAAS;"}
1
+ {"version":3,"file":"growi-app-info.js","sources":["../../src/interfaces/growi-app-info.ts"],"sourcesContent":["import type * as os from 'node:os';\n\nimport type { GrowiDeploymentType, GrowiServiceType } from '../consts/system';\n\nexport const GrowiWikiType = { open: 'open', closed: 'closed' } as const;\ntype GrowiWikiType = (typeof GrowiWikiType)[keyof typeof GrowiWikiType];\n\n// Info options for additionalInfo selection\nexport interface GrowiInfoOptions {\n includeAttachmentInfo?: boolean;\n includeInstalledInfo?: boolean;\n includeUserCountInfo?: boolean;\n includePageCountInfo?: boolean;\n // Future extensions can be added here\n}\n\ninterface IGrowiOSInfo {\n type?: ReturnType<typeof os.type>;\n platform?: ReturnType<typeof os.platform>;\n arch?: ReturnType<typeof os.arch>;\n totalmem?: ReturnType<typeof os.totalmem>;\n}\n\ninterface IAdditionalAttachmentInfo {\n attachmentType: string;\n activeExternalAccountTypes: string[];\n}\n\ninterface IAdditionalInstalledAtInfo {\n installedAt: Date;\n installedAtByOldestUser: Date | null;\n}\n\ninterface IAdditionalUserCountInfo {\n currentUsersCount: number;\n currentActiveUsersCount: number;\n}\n\ninterface IAdditionalPageCountInfo {\n currentPagesCount: number;\n}\n\nexport interface IGrowiAdditionalInfo\n extends IAdditionalInstalledAtInfo,\n IAdditionalUserCountInfo,\n IAdditionalPageCountInfo,\n IAdditionalAttachmentInfo {}\n\n// Type mapping for flexible options\nexport type IGrowiAdditionalInfoByOptions<T extends GrowiInfoOptions> =\n (T['includeAttachmentInfo'] extends true\n ? IAdditionalAttachmentInfo\n : Record<string, never>) &\n (T['includeInstalledInfo'] extends true\n ? IAdditionalInstalledAtInfo\n : Record<string, never>) &\n (T['includeUserCountInfo'] extends true\n ? IAdditionalUserCountInfo\n : Record<string, never>) &\n (T['includePageCountInfo'] extends true\n ? IAdditionalPageCountInfo\n : Record<string, never>);\n\n// Helper type to check if any option is enabled\nexport type HasAnyOption<T extends GrowiInfoOptions> =\n T['includeAttachmentInfo'] extends true\n ? true\n : T['includeInstalledInfo'] extends true\n ? true\n : T['includeUserCountInfo'] extends true\n ? true\n : T['includePageCountInfo'] extends true\n ? true\n : false;\n\n// Final result type based on options\nexport type IGrowiAdditionalInfoResult<T extends GrowiInfoOptions> =\n HasAnyOption<T> extends true ? IGrowiAdditionalInfoByOptions<T> : undefined;\n\nexport interface IGrowiInfo<A extends object | undefined = undefined> {\n serviceInstanceId: string;\n appSiteUrl: string;\n osInfo: IGrowiOSInfo;\n version: string;\n type: GrowiServiceType;\n wikiType: GrowiWikiType;\n deploymentType: GrowiDeploymentType;\n additionalInfo?: A;\n}\n"],"names":["GrowiWikiType"],"mappings":"AAIO,MAAMA,IAAgB,EAAE,MAAM,QAAQ,QAAQ,SAAS;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./color-scheme.cjs"),n=require("./common.cjs"),o=require("./config-manager.cjs"),S=require("./growi-app-info.cjs"),r=require("./growi-theme-metadata.cjs"),t=require("./lang.cjs"),e=require("./page.cjs"),i=require("./primitive/string.cjs"),g=require("./revision.cjs"),a=require("./subscription.cjs"),u=require("./user.cjs");exports.ColorScheme=s.ColorScheme;exports.getIdForRef=n.getIdForRef;exports.getIdStringForRef=n.getIdStringForRef;exports.isPopulated=n.isPopulated;exports.isRef=n.isRef;exports.ConfigSource=o.ConfigSource;exports.defineConfig=o.defineConfig;exports.GrowiWikiType=S.GrowiWikiType;exports.GrowiThemeSchemeType=r.GrowiThemeSchemeType;exports.isGrowiThemeMetadata=r.isGrowiThemeMetadata;exports.AllLang=t.AllLang;exports.Lang=t.Lang;exports.GroupType=e.GroupType;exports.PageGrant=e.PageGrant;exports.PageStatus=e.PageStatus;exports.isIPageInfo=e.isIPageInfo;exports.isIPageInfoForEntity=e.isIPageInfoForEntity;exports.isIPageInfoForListing=e.isIPageInfoForListing;exports.isIPageInfoForOperation=e.isIPageInfoForOperation;exports.isNonBlankString=i.isNonBlankString;exports.isNonEmptyString=i.isNonEmptyString;exports.toNonBlankString=i.toNonBlankString;exports.toNonBlankStringOrUndefined=i.toNonBlankStringOrUndefined;exports.toNonEmptyString=i.toNonEmptyString;exports.toNonEmptyStringOrUndefined=i.toNonEmptyStringOrUndefined;exports.Origin=g.Origin;exports.allOrigin=g.allOrigin;exports.AllSubscriptionStatusType=a.AllSubscriptionStatusType;exports.SubscriptionStatusType=a.SubscriptionStatusType;exports.USER_STATUS=u.USER_STATUS;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("./color-scheme.cjs"),n=require("./common.cjs"),r=require("./config-manager.cjs"),u=require("./growi-app-info.cjs"),t=require("./growi-theme-metadata.cjs"),g=require("./lang.cjs"),e=require("./page.cjs"),i=require("./primitive/string.cjs"),a=require("./revision.cjs"),o=require("./scope.cjs"),s=require("./subscription.cjs"),p=require("./user.cjs");exports.ColorScheme=S.ColorScheme;exports.getIdForRef=n.getIdForRef;exports.getIdStringForRef=n.getIdStringForRef;exports.isPopulated=n.isPopulated;exports.isRef=n.isRef;exports.ConfigSource=r.ConfigSource;exports.defineConfig=r.defineConfig;exports.GrowiWikiType=u.GrowiWikiType;exports.GrowiThemeSchemeType=t.GrowiThemeSchemeType;exports.isGrowiThemeMetadata=t.isGrowiThemeMetadata;exports.AllLang=g.AllLang;exports.Lang=g.Lang;exports.GroupType=e.GroupType;exports.PageGrant=e.PageGrant;exports.PageStatus=e.PageStatus;exports.isIPageInfo=e.isIPageInfo;exports.isIPageInfoForEmpty=e.isIPageInfoForEmpty;exports.isIPageInfoForEntity=e.isIPageInfoForEntity;exports.isIPageInfoForListing=e.isIPageInfoForListing;exports.isIPageInfoForOperation=e.isIPageInfoForOperation;exports.isIPageNotFoundInfo=e.isIPageNotFoundInfo;exports.isNonBlankString=i.isNonBlankString;exports.isNonEmptyString=i.isNonEmptyString;exports.toNonBlankString=i.toNonBlankString;exports.toNonBlankStringOrUndefined=i.toNonBlankStringOrUndefined;exports.toNonEmptyString=i.toNonEmptyString;exports.toNonEmptyStringOrUndefined=i.toNonEmptyStringOrUndefined;exports.Origin=a.Origin;exports.allOrigin=a.allOrigin;exports.ACTION=o.ACTION;exports.ALL_SIGN=o.ALL_SIGN;exports.SCOPE=o.SCOPE;exports.AllSubscriptionStatusType=s.AllSubscriptionStatusType;exports.SubscriptionStatusType=s.SubscriptionStatusType;exports.USER_STATUS=p.USER_STATUS;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -13,6 +13,7 @@ export * from './locale';
13
13
  export * from './page';
14
14
  export * from './primitive/string';
15
15
  export * from './revision';
16
+ export * from './scope';
16
17
  export * from './subscription';
17
18
  export * from './tag';
18
19
  export * from './user';
@@ -1,44 +1,50 @@
1
1
  import { ColorScheme as e } from "./color-scheme.js";
2
- import { getIdForRef as i, getIdStringForRef as n, isPopulated as p, isRef as f } from "./common.js";
2
+ import { getIdForRef as i, getIdStringForRef as n, isPopulated as f, isRef as p } from "./common.js";
3
3
  import { ConfigSource as a, defineConfig as m } from "./config-manager.js";
4
4
  import { GrowiWikiType as s } from "./growi-app-info.js";
5
- import { GrowiThemeSchemeType as x, isGrowiThemeMetadata as I } from "./growi-theme-metadata.js";
6
- import { AllLang as y, Lang as T } from "./lang.js";
7
- import { GroupType as P, PageGrant as N, PageStatus as c, isIPageInfo as E, isIPageInfoForEntity as F, isIPageInfoForListing as G, isIPageInfoForOperation as O } from "./page.js";
8
- import { isNonBlankString as k, isNonEmptyString as R, toNonBlankString as U, toNonBlankStringOrUndefined as w, toNonEmptyString as A, toNonEmptyStringOrUndefined as B } from "./primitive/string.js";
9
- import { Origin as L, allOrigin as b } from "./revision.js";
10
- import { AllSubscriptionStatusType as W, SubscriptionStatusType as _ } from "./subscription.js";
11
- import { USER_STATUS as q } from "./user.js";
5
+ import { GrowiThemeSchemeType as x, isGrowiThemeMetadata as l } from "./growi-theme-metadata.js";
6
+ import { AllLang as y, Lang as P } from "./lang.js";
7
+ import { GroupType as u, PageGrant as N, PageStatus as E, isIPageInfo as F, isIPageInfoForEmpty as O, isIPageInfoForEntity as G, isIPageInfoForListing as c, isIPageInfoForOperation as A, isIPageNotFoundInfo as C } from "./page.js";
8
+ import { isNonBlankString as h, isNonEmptyString as k, toNonBlankString as R, toNonBlankStringOrUndefined as U, toNonEmptyString as w, toNonEmptyStringOrUndefined as B } from "./primitive/string.js";
9
+ import { Origin as _, allOrigin as M } from "./revision.js";
10
+ import { ACTION as j, ALL_SIGN as q, SCOPE as v } from "./scope.js";
11
+ import { AllSubscriptionStatusType as D, SubscriptionStatusType as H } from "./subscription.js";
12
+ import { USER_STATUS as K } from "./user.js";
12
13
  export {
14
+ j as ACTION,
15
+ q as ALL_SIGN,
13
16
  y as AllLang,
14
- W as AllSubscriptionStatusType,
17
+ D as AllSubscriptionStatusType,
15
18
  e as ColorScheme,
16
19
  a as ConfigSource,
17
- P as GroupType,
20
+ u as GroupType,
18
21
  x as GrowiThemeSchemeType,
19
22
  s as GrowiWikiType,
20
- T as Lang,
21
- L as Origin,
23
+ P as Lang,
24
+ _ as Origin,
22
25
  N as PageGrant,
23
- c as PageStatus,
24
- _ as SubscriptionStatusType,
25
- q as USER_STATUS,
26
- b as allOrigin,
26
+ E as PageStatus,
27
+ v as SCOPE,
28
+ H as SubscriptionStatusType,
29
+ K as USER_STATUS,
30
+ M as allOrigin,
27
31
  m as defineConfig,
28
32
  i as getIdForRef,
29
33
  n as getIdStringForRef,
30
- I as isGrowiThemeMetadata,
31
- E as isIPageInfo,
32
- F as isIPageInfoForEntity,
33
- G as isIPageInfoForListing,
34
- O as isIPageInfoForOperation,
35
- k as isNonBlankString,
36
- R as isNonEmptyString,
37
- p as isPopulated,
38
- f as isRef,
39
- U as toNonBlankString,
40
- w as toNonBlankStringOrUndefined,
41
- A as toNonEmptyString,
34
+ l as isGrowiThemeMetadata,
35
+ F as isIPageInfo,
36
+ O as isIPageInfoForEmpty,
37
+ G as isIPageInfoForEntity,
38
+ c as isIPageInfoForListing,
39
+ A as isIPageInfoForOperation,
40
+ C as isIPageNotFoundInfo,
41
+ h as isNonBlankString,
42
+ k as isNonEmptyString,
43
+ f as isPopulated,
44
+ p as isRef,
45
+ R as toNonBlankString,
46
+ U as toNonBlankStringOrUndefined,
47
+ w as toNonEmptyString,
42
48
  B as toNonEmptyStringOrUndefined
43
49
  };
44
50
  //# 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":";;;;;;;;;;;;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s={userGroup:"UserGroup",externalUserGroup:"ExternalUserGroup"},i={GRANT_PUBLIC:1,GRANT_RESTRICTED:2,GRANT_SPECIFIED:3,GRANT_OWNER:4,GRANT_USER_GROUP:5},n={STATUS_PUBLISHED:"published",STATUS_DELETED:"deleted"},e=t=>t!=null&&t instanceof Object&&"isEmpty"in t,r=t=>e(t)&&t.isEmpty===!1,o=t=>r(t)&&("isBookmarked"in t||"isLiked"in t||"subscriptionStatus"in t),u=t=>r(t)&&"revisionShortBody"in t;exports.GroupType=s;exports.PageGrant=i;exports.PageStatus=n;exports.isIPageInfo=e;exports.isIPageInfoForEntity=r;exports.isIPageInfoForListing=u;exports.isIPageInfoForOperation=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s={userGroup:"UserGroup",externalUserGroup:"ExternalUserGroup"},i={GRANT_PUBLIC:1,GRANT_RESTRICTED:2,GRANT_SPECIFIED:3,GRANT_OWNER:4,GRANT_USER_GROUP:5},o={STATUS_PUBLISHED:"published",STATUS_DELETED:"deleted"},e=t=>t!=null&&t instanceof Object&&t.isNotFound===!0&&"isForbidden"in t,r=t=>t!=null&&t instanceof Object&&"isEmpty"in t,u=t=>r(t)&&t.isEmpty===!0,n=t=>r(t)&&t.isEmpty===!1,P=t=>n(t)&&("isBookmarked"in t||"isLiked"in t||"subscriptionStatus"in t),a=t=>n(t)&&"revisionShortBody"in t;exports.GroupType=s;exports.PageGrant=i;exports.PageStatus=o;exports.isIPageInfo=r;exports.isIPageInfoForEmpty=u;exports.isIPageInfoForEntity=n;exports.isIPageInfoForListing=a;exports.isIPageInfoForOperation=P;exports.isIPageNotFoundInfo=e;
2
2
  //# sourceMappingURL=page.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"page.cjs","sources":["../../src/interfaces/page.ts"],"sourcesContent":["import type { Ref } from './common';\nimport type { HasObjectId } from './has-object-id';\nimport type {\n HasRevisionShortbody,\n IRevision,\n IRevisionHasId,\n} from './revision';\nimport type { SubscriptionStatusType } from './subscription';\nimport type { ITag } from './tag';\nimport type { IUser, IUserGroup, IUserGroupHasId, IUserHasId } from './user';\n\nexport const GroupType = {\n userGroup: 'UserGroup',\n externalUserGroup: 'ExternalUserGroup',\n} as const;\nexport type GroupType = (typeof GroupType)[keyof typeof GroupType];\n\nexport type IGrantedGroup = {\n type: GroupType;\n item: Ref<IUserGroup>;\n};\n\nexport type IPage = {\n path: string;\n status: string;\n revision?: Ref<IRevision>;\n tags: Ref<ITag>[];\n creator?: Ref<IUser>;\n createdAt: Date;\n updatedAt: Date;\n seenUsers: Ref<IUser>[];\n parent: Ref<IPage> | null;\n descendantCount: number;\n isEmpty: boolean;\n grant: PageGrant;\n grantedUsers: Ref<IUser>[];\n grantedGroups: IGrantedGroup[];\n lastUpdateUser?: Ref<IUser>;\n liker: Ref<IUser>[];\n commentCount: number;\n slackChannels: string;\n deleteUser: Ref<IUser>;\n deletedAt: Date;\n latestRevision?: Ref<IRevision>;\n latestRevisionBodyLength?: number;\n expandContentWidth?: boolean;\n wip?: boolean;\n ttlTimestamp?: Date;\n};\n\nexport type IPagePopulatedToShowRevision = Omit<\n IPageHasId,\n | 'lastUpdateUser'\n | 'creator'\n | 'deleteUser'\n | 'grantedGroups'\n | 'revision'\n | 'author'\n> & {\n lastUpdateUser?: IUserHasId;\n creator?: IUserHasId;\n deleteUser: IUserHasId;\n grantedGroups: { type: GroupType; item: IUserGroupHasId }[];\n revision?: IRevisionHasId;\n author: IUserHasId;\n};\n\nexport const PageGrant = {\n GRANT_PUBLIC: 1,\n GRANT_RESTRICTED: 2,\n GRANT_SPECIFIED: 3, // DEPRECATED\n GRANT_OWNER: 4,\n GRANT_USER_GROUP: 5,\n} as const;\ntype UnionPageGrantKeys = keyof typeof PageGrant;\nexport type PageGrant = (typeof PageGrant)[UnionPageGrantKeys];\n\nexport const PageStatus = {\n STATUS_PUBLISHED: 'published',\n STATUS_DELETED: 'deleted',\n} as const;\nexport type PageStatus = (typeof PageStatus)[keyof typeof PageStatus];\n\nexport type IPageHasId = IPage & HasObjectId;\n\nexport type IPageInfo = {\n isV5Compatible: boolean;\n isEmpty: boolean;\n isMovable: boolean;\n isDeletable: boolean;\n isAbleToDeleteCompletely: boolean;\n isRevertible: boolean;\n};\n\nexport type IPageInfoForEntity = IPageInfo & {\n bookmarkCount: number;\n sumOfLikers: number;\n likerIds: string[];\n sumOfSeenUsers: number;\n seenUserIds: string[];\n contentAge: number;\n descendantCount: number;\n commentCount: number;\n};\n\nexport type IPageInfoForOperation = IPageInfoForEntity & {\n isBookmarked?: boolean;\n isLiked?: boolean;\n subscriptionStatus?: SubscriptionStatusType;\n};\n\nexport type IPageInfoForListing = IPageInfoForEntity & HasRevisionShortbody;\n\nexport type IPageInfoAll =\n | IPageInfo\n | IPageInfoForEntity\n | IPageInfoForOperation\n | IPageInfoForListing;\n\nexport const isIPageInfo = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfo => {\n return (\n pageInfo != null && pageInfo instanceof Object && 'isEmpty' in pageInfo\n );\n};\n\nexport const isIPageInfoForEntity = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfoForEntity => {\n return isIPageInfo(pageInfo) && pageInfo.isEmpty === false;\n};\n\nexport const isIPageInfoForOperation = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfoForOperation => {\n return (\n isIPageInfoForEntity(pageInfo) &&\n ('isBookmarked' in pageInfo ||\n 'isLiked' in pageInfo ||\n 'subscriptionStatus' in pageInfo)\n );\n};\n\nexport const isIPageInfoForListing = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfoForListing => {\n return isIPageInfoForEntity(pageInfo) && 'revisionShortBody' in pageInfo;\n};\n\n// export type IPageInfoTypeResolver<T extends IPageInfo> =\n// T extends HasRevisionShortbody ? IPageInfoForListing :\n// T extends { isBookmarked?: boolean } | { isLiked?: boolean } | { subscriptionStatus?: SubscriptionStatusType } ? IPageInfoForOperation :\n// T extends { bookmarkCount: number } ? IPageInfoForEntity :\n// T extends { isEmpty: number } ? IPageInfo :\n// T;\n\n/**\n * Union Distribution\n * @param pageInfo\n * @returns\n */\n// export const resolvePageInfo = <T extends IPageInfo>(pageInfo: T | undefined): IPageInfoTypeResolver<T> => {\n// return <IPageInfoTypeResolver<T>>pageInfo;\n// };\n\nexport type IDataWithMeta<D = unknown, M = unknown> = {\n data: D;\n meta?: M;\n};\n\nexport type IPageWithMeta<M = IPageInfoAll> = IDataWithMeta<IPageHasId, M>;\n\nexport type IPageToDeleteWithMeta<T = IPageInfoForEntity | unknown> =\n IDataWithMeta<\n HasObjectId & (IPage | { path: string; revision: string | null }),\n T\n >;\nexport type IPageToRenameWithMeta<T = IPageInfoForEntity | unknown> =\n IPageToDeleteWithMeta<T>;\n"],"names":["GroupType","PageGrant","PageStatus","isIPageInfo","pageInfo","isIPageInfoForEntity","isIPageInfoForOperation","isIPageInfoForListing"],"mappings":"gFAWO,MAAMA,EAAY,CACvB,UAAW,YACX,kBAAmB,mBACrB,EAqDaC,EAAY,CACvB,aAAc,EACd,iBAAkB,EAClB,gBAAiB,EACjB,YAAa,EACb,iBAAkB,CACpB,EAIaC,EAAa,CACxB,iBAAkB,YAClB,eAAgB,SAClB,EAuCaC,EAEXC,GAGEA,GAAY,MAAQA,aAAoB,QAAU,YAAaA,EAItDC,EAEXD,GAEOD,EAAYC,CAAQ,GAAKA,EAAS,UAAY,GAG1CE,EAEXF,GAGEC,EAAqBD,CAAQ,IAC5B,iBAAkBA,GACjB,YAAaA,GACb,uBAAwBA,GAIjBG,EAEXH,GAEOC,EAAqBD,CAAQ,GAAK,sBAAuBA"}
1
+ {"version":3,"file":"page.cjs","sources":["../../src/interfaces/page.ts"],"sourcesContent":["import type { Ref } from './common';\nimport type { HasObjectId } from './has-object-id';\nimport type {\n HasRevisionShortbody,\n IRevision,\n IRevisionHasId,\n} from './revision';\nimport type { SubscriptionStatusType } from './subscription';\nimport type { ITag } from './tag';\nimport type { IUser, IUserGroup, IUserGroupHasId, IUserHasId } from './user';\n\nexport const GroupType = {\n userGroup: 'UserGroup',\n externalUserGroup: 'ExternalUserGroup',\n} as const;\nexport type GroupType = (typeof GroupType)[keyof typeof GroupType];\n\nexport type IGrantedGroup = {\n type: GroupType;\n item: Ref<IUserGroup>;\n};\n\nexport type IPage = {\n path: string;\n status: string;\n revision?: Ref<IRevision>;\n tags: Ref<ITag>[];\n creator?: Ref<IUser>;\n createdAt: Date;\n updatedAt: Date;\n seenUsers: Ref<IUser>[];\n parent: Ref<IPage> | null;\n descendantCount: number;\n isEmpty: boolean;\n grant: PageGrant;\n grantedUsers: Ref<IUser>[];\n grantedGroups: IGrantedGroup[];\n lastUpdateUser?: Ref<IUser>;\n liker: Ref<IUser>[];\n commentCount: number;\n slackChannels: string;\n deleteUser: Ref<IUser>;\n deletedAt: Date;\n latestRevision?: Ref<IRevision>;\n latestRevisionBodyLength?: number;\n expandContentWidth?: boolean;\n wip?: boolean;\n ttlTimestamp?: Date;\n};\n\nexport type IPagePopulatedToShowRevision = Omit<\n IPageHasId,\n | 'lastUpdateUser'\n | 'creator'\n | 'deleteUser'\n | 'grantedGroups'\n | 'revision'\n | 'author'\n> & {\n lastUpdateUser?: IUserHasId;\n creator?: IUserHasId;\n deleteUser: IUserHasId;\n grantedGroups: { type: GroupType; item: IUserGroupHasId }[];\n revision?: IRevisionHasId;\n author: IUserHasId;\n};\n\nexport const PageGrant = {\n GRANT_PUBLIC: 1,\n GRANT_RESTRICTED: 2,\n GRANT_SPECIFIED: 3, // DEPRECATED\n GRANT_OWNER: 4,\n GRANT_USER_GROUP: 5,\n} as const;\ntype UnionPageGrantKeys = keyof typeof PageGrant;\nexport type PageGrant = (typeof PageGrant)[UnionPageGrantKeys];\n\nexport const PageStatus = {\n STATUS_PUBLISHED: 'published',\n STATUS_DELETED: 'deleted',\n} as const;\nexport type PageStatus = (typeof PageStatus)[keyof typeof PageStatus];\n\nexport type IPageHasId = IPage & HasObjectId;\n\n// Special type to represent page is an empty page or not found or forbidden status\nexport type IPageNotFoundInfo = {\n isNotFound: true;\n isForbidden: boolean;\n};\n\nexport type IPageInfo = {\n isNotFound: boolean;\n isV5Compatible: boolean;\n isEmpty: boolean;\n isMovable: boolean;\n isDeletable: boolean;\n isAbleToDeleteCompletely: boolean;\n isRevertible: boolean;\n bookmarkCount: number;\n};\n\nexport type IPageInfoForEmpty = Omit<IPageInfo, 'isNotFound' | 'isEmpty'> & {\n emptyPageId: string;\n isNotFound: false;\n isEmpty: true;\n isBookmarked?: boolean;\n};\n\nexport type IPageInfoForEntity = Omit<IPageInfo, 'isNotFound' | 'isEmpty'> & {\n isNotFound: false;\n isEmpty: false;\n sumOfLikers: number;\n likerIds: string[];\n sumOfSeenUsers: number;\n seenUserIds: string[];\n contentAge: number;\n descendantCount: number;\n commentCount: number;\n latestRevisionId: Ref<IRevision>;\n};\n\nexport type IPageInfoForOperation = IPageInfoForEntity & {\n isBookmarked?: boolean;\n isLiked?: boolean;\n subscriptionStatus?: SubscriptionStatusType;\n};\n\nexport type IPageInfoForListing = IPageInfoForEntity & HasRevisionShortbody;\n\nexport type IPageInfoExt =\n | IPageInfo\n | IPageInfoForEmpty\n | IPageInfoForEntity\n | IPageInfoForOperation\n | IPageInfoForListing;\n\nexport const isIPageNotFoundInfo = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageNotFoundInfo => {\n return (\n pageInfo != null &&\n pageInfo instanceof Object &&\n pageInfo.isNotFound === true &&\n 'isForbidden' in pageInfo\n );\n};\n\nexport const isIPageInfo = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfo => {\n return (\n pageInfo != null && pageInfo instanceof Object && 'isEmpty' in pageInfo\n );\n};\n\nexport const isIPageInfoForEmpty = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfoForEmpty => {\n return isIPageInfo(pageInfo) && pageInfo.isEmpty === true;\n};\n\nexport const isIPageInfoForEntity = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfoForEntity => {\n return isIPageInfo(pageInfo) && pageInfo.isEmpty === false;\n};\n\nexport const isIPageInfoForOperation = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfoForOperation => {\n return (\n isIPageInfoForEntity(pageInfo) &&\n ('isBookmarked' in pageInfo ||\n 'isLiked' in pageInfo ||\n 'subscriptionStatus' in pageInfo)\n );\n};\n\nexport const isIPageInfoForListing = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfoForListing => {\n return isIPageInfoForEntity(pageInfo) && 'revisionShortBody' in pageInfo;\n};\n\nexport type IDataWithMeta<D = unknown, M = unknown> = {\n data: D;\n meta?: M;\n};\nexport type IDataWithRequiredMeta<D = unknown, M = unknown> = IDataWithMeta<\n D,\n M\n> & { meta: M };\n\nexport type IPageWithMeta<M = IPageInfoExt> = IDataWithMeta<IPageHasId, M>;\n\nexport type IPageToDeleteWithMeta<T = IPageInfoForEntity | unknown> =\n IDataWithMeta<\n HasObjectId & (IPage | { path: string; revision: string | null }),\n T\n >;\nexport type IPageToRenameWithMeta<T = IPageInfoForEntity | unknown> =\n IPageToDeleteWithMeta<T>;\n"],"names":["GroupType","PageGrant","PageStatus","isIPageNotFoundInfo","pageInfo","isIPageInfo","isIPageInfoForEmpty","isIPageInfoForEntity","isIPageInfoForOperation","isIPageInfoForListing"],"mappings":"gFAWO,MAAMA,EAAY,CACvB,UAAW,YACX,kBAAmB,mBACrB,EAqDaC,EAAY,CACvB,aAAc,EACd,iBAAkB,EAClB,gBAAiB,EACjB,YAAa,EACb,iBAAkB,CACpB,EAIaC,EAAa,CACxB,iBAAkB,YAClB,eAAgB,SAClB,EAyDaC,EAEXC,GAGEA,GAAY,MACZA,aAAoB,QACpBA,EAAS,aAAe,IACxB,gBAAiBA,EAIRC,EAEXD,GAGEA,GAAY,MAAQA,aAAoB,QAAU,YAAaA,EAItDE,EAEXF,GAEOC,EAAYD,CAAQ,GAAKA,EAAS,UAAY,GAG1CG,EAEXH,GAEOC,EAAYD,CAAQ,GAAKA,EAAS,UAAY,GAG1CI,EAEXJ,GAGEG,EAAqBH,CAAQ,IAC5B,iBAAkBA,GACjB,YAAaA,GACb,uBAAwBA,GAIjBK,EAEXL,GAEOG,EAAqBH,CAAQ,GAAK,sBAAuBA"}
@@ -67,16 +67,29 @@ export declare const PageStatus: {
67
67
  };
68
68
  export type PageStatus = (typeof PageStatus)[keyof typeof PageStatus];
69
69
  export type IPageHasId = IPage & HasObjectId;
70
+ export type IPageNotFoundInfo = {
71
+ isNotFound: true;
72
+ isForbidden: boolean;
73
+ };
70
74
  export type IPageInfo = {
75
+ isNotFound: boolean;
71
76
  isV5Compatible: boolean;
72
77
  isEmpty: boolean;
73
78
  isMovable: boolean;
74
79
  isDeletable: boolean;
75
80
  isAbleToDeleteCompletely: boolean;
76
81
  isRevertible: boolean;
77
- };
78
- export type IPageInfoForEntity = IPageInfo & {
79
82
  bookmarkCount: number;
83
+ };
84
+ export type IPageInfoForEmpty = Omit<IPageInfo, 'isNotFound' | 'isEmpty'> & {
85
+ emptyPageId: string;
86
+ isNotFound: false;
87
+ isEmpty: true;
88
+ isBookmarked?: boolean;
89
+ };
90
+ export type IPageInfoForEntity = Omit<IPageInfo, 'isNotFound' | 'isEmpty'> & {
91
+ isNotFound: false;
92
+ isEmpty: false;
80
93
  sumOfLikers: number;
81
94
  likerIds: string[];
82
95
  sumOfSeenUsers: number;
@@ -84,6 +97,7 @@ export type IPageInfoForEntity = IPageInfo & {
84
97
  contentAge: number;
85
98
  descendantCount: number;
86
99
  commentCount: number;
100
+ latestRevisionId: Ref<IRevision>;
87
101
  };
88
102
  export type IPageInfoForOperation = IPageInfoForEntity & {
89
103
  isBookmarked?: boolean;
@@ -91,21 +105,21 @@ export type IPageInfoForOperation = IPageInfoForEntity & {
91
105
  subscriptionStatus?: SubscriptionStatusType;
92
106
  };
93
107
  export type IPageInfoForListing = IPageInfoForEntity & HasRevisionShortbody;
94
- export type IPageInfoAll = IPageInfo | IPageInfoForEntity | IPageInfoForOperation | IPageInfoForListing;
108
+ export type IPageInfoExt = IPageInfo | IPageInfoForEmpty | IPageInfoForEntity | IPageInfoForOperation | IPageInfoForListing;
109
+ export declare const isIPageNotFoundInfo: (pageInfo: any | undefined) => pageInfo is IPageNotFoundInfo;
95
110
  export declare const isIPageInfo: (pageInfo: any | undefined) => pageInfo is IPageInfo;
111
+ export declare const isIPageInfoForEmpty: (pageInfo: any | undefined) => pageInfo is IPageInfoForEmpty;
96
112
  export declare const isIPageInfoForEntity: (pageInfo: any | undefined) => pageInfo is IPageInfoForEntity;
97
113
  export declare const isIPageInfoForOperation: (pageInfo: any | undefined) => pageInfo is IPageInfoForOperation;
98
114
  export declare const isIPageInfoForListing: (pageInfo: any | undefined) => pageInfo is IPageInfoForListing;
99
- /**
100
- * Union Distribution
101
- * @param pageInfo
102
- * @returns
103
- */
104
115
  export type IDataWithMeta<D = unknown, M = unknown> = {
105
116
  data: D;
106
117
  meta?: M;
107
118
  };
108
- export type IPageWithMeta<M = IPageInfoAll> = IDataWithMeta<IPageHasId, M>;
119
+ export type IDataWithRequiredMeta<D = unknown, M = unknown> = IDataWithMeta<D, M> & {
120
+ meta: M;
121
+ };
122
+ export type IPageWithMeta<M = IPageInfoExt> = IDataWithMeta<IPageHasId, M>;
109
123
  export type IPageToDeleteWithMeta<T = IPageInfoForEntity | unknown> = IDataWithMeta<HasObjectId & (IPage | {
110
124
  path: string;
111
125
  revision: string | null;
@@ -1,7 +1,7 @@
1
- const i = {
1
+ const n = {
2
2
  userGroup: "UserGroup",
3
3
  externalUserGroup: "ExternalUserGroup"
4
- }, n = {
4
+ }, i = {
5
5
  GRANT_PUBLIC: 1,
6
6
  GRANT_RESTRICTED: 2,
7
7
  GRANT_SPECIFIED: 3,
@@ -11,14 +11,16 @@ const i = {
11
11
  }, e = {
12
12
  STATUS_PUBLISHED: "published",
13
13
  STATUS_DELETED: "deleted"
14
- }, s = (t) => t != null && t instanceof Object && "isEmpty" in t, r = (t) => s(t) && t.isEmpty === !1, o = (t) => r(t) && ("isBookmarked" in t || "isLiked" in t || "subscriptionStatus" in t), u = (t) => r(t) && "revisionShortBody" in t;
14
+ }, o = (t) => t != null && t instanceof Object && t.isNotFound === !0 && "isForbidden" in t, r = (t) => t != null && t instanceof Object && "isEmpty" in t, u = (t) => r(t) && t.isEmpty === !0, s = (t) => r(t) && t.isEmpty === !1, E = (t) => s(t) && ("isBookmarked" in t || "isLiked" in t || "subscriptionStatus" in t), c = (t) => s(t) && "revisionShortBody" in t;
15
15
  export {
16
- i as GroupType,
17
- n as PageGrant,
16
+ n as GroupType,
17
+ i as PageGrant,
18
18
  e as PageStatus,
19
- s as isIPageInfo,
20
- r as isIPageInfoForEntity,
21
- u as isIPageInfoForListing,
22
- o as isIPageInfoForOperation
19
+ r as isIPageInfo,
20
+ u as isIPageInfoForEmpty,
21
+ s as isIPageInfoForEntity,
22
+ c as isIPageInfoForListing,
23
+ E as isIPageInfoForOperation,
24
+ o as isIPageNotFoundInfo
23
25
  };
24
26
  //# sourceMappingURL=page.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"page.js","sources":["../../src/interfaces/page.ts"],"sourcesContent":["import type { Ref } from './common';\nimport type { HasObjectId } from './has-object-id';\nimport type {\n HasRevisionShortbody,\n IRevision,\n IRevisionHasId,\n} from './revision';\nimport type { SubscriptionStatusType } from './subscription';\nimport type { ITag } from './tag';\nimport type { IUser, IUserGroup, IUserGroupHasId, IUserHasId } from './user';\n\nexport const GroupType = {\n userGroup: 'UserGroup',\n externalUserGroup: 'ExternalUserGroup',\n} as const;\nexport type GroupType = (typeof GroupType)[keyof typeof GroupType];\n\nexport type IGrantedGroup = {\n type: GroupType;\n item: Ref<IUserGroup>;\n};\n\nexport type IPage = {\n path: string;\n status: string;\n revision?: Ref<IRevision>;\n tags: Ref<ITag>[];\n creator?: Ref<IUser>;\n createdAt: Date;\n updatedAt: Date;\n seenUsers: Ref<IUser>[];\n parent: Ref<IPage> | null;\n descendantCount: number;\n isEmpty: boolean;\n grant: PageGrant;\n grantedUsers: Ref<IUser>[];\n grantedGroups: IGrantedGroup[];\n lastUpdateUser?: Ref<IUser>;\n liker: Ref<IUser>[];\n commentCount: number;\n slackChannels: string;\n deleteUser: Ref<IUser>;\n deletedAt: Date;\n latestRevision?: Ref<IRevision>;\n latestRevisionBodyLength?: number;\n expandContentWidth?: boolean;\n wip?: boolean;\n ttlTimestamp?: Date;\n};\n\nexport type IPagePopulatedToShowRevision = Omit<\n IPageHasId,\n | 'lastUpdateUser'\n | 'creator'\n | 'deleteUser'\n | 'grantedGroups'\n | 'revision'\n | 'author'\n> & {\n lastUpdateUser?: IUserHasId;\n creator?: IUserHasId;\n deleteUser: IUserHasId;\n grantedGroups: { type: GroupType; item: IUserGroupHasId }[];\n revision?: IRevisionHasId;\n author: IUserHasId;\n};\n\nexport const PageGrant = {\n GRANT_PUBLIC: 1,\n GRANT_RESTRICTED: 2,\n GRANT_SPECIFIED: 3, // DEPRECATED\n GRANT_OWNER: 4,\n GRANT_USER_GROUP: 5,\n} as const;\ntype UnionPageGrantKeys = keyof typeof PageGrant;\nexport type PageGrant = (typeof PageGrant)[UnionPageGrantKeys];\n\nexport const PageStatus = {\n STATUS_PUBLISHED: 'published',\n STATUS_DELETED: 'deleted',\n} as const;\nexport type PageStatus = (typeof PageStatus)[keyof typeof PageStatus];\n\nexport type IPageHasId = IPage & HasObjectId;\n\nexport type IPageInfo = {\n isV5Compatible: boolean;\n isEmpty: boolean;\n isMovable: boolean;\n isDeletable: boolean;\n isAbleToDeleteCompletely: boolean;\n isRevertible: boolean;\n};\n\nexport type IPageInfoForEntity = IPageInfo & {\n bookmarkCount: number;\n sumOfLikers: number;\n likerIds: string[];\n sumOfSeenUsers: number;\n seenUserIds: string[];\n contentAge: number;\n descendantCount: number;\n commentCount: number;\n};\n\nexport type IPageInfoForOperation = IPageInfoForEntity & {\n isBookmarked?: boolean;\n isLiked?: boolean;\n subscriptionStatus?: SubscriptionStatusType;\n};\n\nexport type IPageInfoForListing = IPageInfoForEntity & HasRevisionShortbody;\n\nexport type IPageInfoAll =\n | IPageInfo\n | IPageInfoForEntity\n | IPageInfoForOperation\n | IPageInfoForListing;\n\nexport const isIPageInfo = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfo => {\n return (\n pageInfo != null && pageInfo instanceof Object && 'isEmpty' in pageInfo\n );\n};\n\nexport const isIPageInfoForEntity = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfoForEntity => {\n return isIPageInfo(pageInfo) && pageInfo.isEmpty === false;\n};\n\nexport const isIPageInfoForOperation = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfoForOperation => {\n return (\n isIPageInfoForEntity(pageInfo) &&\n ('isBookmarked' in pageInfo ||\n 'isLiked' in pageInfo ||\n 'subscriptionStatus' in pageInfo)\n );\n};\n\nexport const isIPageInfoForListing = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfoForListing => {\n return isIPageInfoForEntity(pageInfo) && 'revisionShortBody' in pageInfo;\n};\n\n// export type IPageInfoTypeResolver<T extends IPageInfo> =\n// T extends HasRevisionShortbody ? IPageInfoForListing :\n// T extends { isBookmarked?: boolean } | { isLiked?: boolean } | { subscriptionStatus?: SubscriptionStatusType } ? IPageInfoForOperation :\n// T extends { bookmarkCount: number } ? IPageInfoForEntity :\n// T extends { isEmpty: number } ? IPageInfo :\n// T;\n\n/**\n * Union Distribution\n * @param pageInfo\n * @returns\n */\n// export const resolvePageInfo = <T extends IPageInfo>(pageInfo: T | undefined): IPageInfoTypeResolver<T> => {\n// return <IPageInfoTypeResolver<T>>pageInfo;\n// };\n\nexport type IDataWithMeta<D = unknown, M = unknown> = {\n data: D;\n meta?: M;\n};\n\nexport type IPageWithMeta<M = IPageInfoAll> = IDataWithMeta<IPageHasId, M>;\n\nexport type IPageToDeleteWithMeta<T = IPageInfoForEntity | unknown> =\n IDataWithMeta<\n HasObjectId & (IPage | { path: string; revision: string | null }),\n T\n >;\nexport type IPageToRenameWithMeta<T = IPageInfoForEntity | unknown> =\n IPageToDeleteWithMeta<T>;\n"],"names":["GroupType","PageGrant","PageStatus","isIPageInfo","pageInfo","isIPageInfoForEntity","isIPageInfoForOperation","isIPageInfoForListing"],"mappings":"AAWO,MAAMA,IAAY;AAAA,EACvB,WAAW;AAAA,EACX,mBAAmB;AACrB,GAqDaC,IAAY;AAAA,EACvB,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,iBAAiB;AAAA;AAAA,EACjB,aAAa;AAAA,EACb,kBAAkB;AACpB,GAIaC,IAAa;AAAA,EACxB,kBAAkB;AAAA,EAClB,gBAAgB;AAClB,GAuCaC,IAAc,CAEzBC,MAGEA,KAAY,QAAQA,aAAoB,UAAU,aAAaA,GAItDC,IAAuB,CAElCD,MAEOD,EAAYC,CAAQ,KAAKA,EAAS,YAAY,IAG1CE,IAA0B,CAErCF,MAGEC,EAAqBD,CAAQ,MAC5B,kBAAkBA,KACjB,aAAaA,KACb,wBAAwBA,IAIjBG,IAAwB,CAEnCH,MAEOC,EAAqBD,CAAQ,KAAK,uBAAuBA;"}
1
+ {"version":3,"file":"page.js","sources":["../../src/interfaces/page.ts"],"sourcesContent":["import type { Ref } from './common';\nimport type { HasObjectId } from './has-object-id';\nimport type {\n HasRevisionShortbody,\n IRevision,\n IRevisionHasId,\n} from './revision';\nimport type { SubscriptionStatusType } from './subscription';\nimport type { ITag } from './tag';\nimport type { IUser, IUserGroup, IUserGroupHasId, IUserHasId } from './user';\n\nexport const GroupType = {\n userGroup: 'UserGroup',\n externalUserGroup: 'ExternalUserGroup',\n} as const;\nexport type GroupType = (typeof GroupType)[keyof typeof GroupType];\n\nexport type IGrantedGroup = {\n type: GroupType;\n item: Ref<IUserGroup>;\n};\n\nexport type IPage = {\n path: string;\n status: string;\n revision?: Ref<IRevision>;\n tags: Ref<ITag>[];\n creator?: Ref<IUser>;\n createdAt: Date;\n updatedAt: Date;\n seenUsers: Ref<IUser>[];\n parent: Ref<IPage> | null;\n descendantCount: number;\n isEmpty: boolean;\n grant: PageGrant;\n grantedUsers: Ref<IUser>[];\n grantedGroups: IGrantedGroup[];\n lastUpdateUser?: Ref<IUser>;\n liker: Ref<IUser>[];\n commentCount: number;\n slackChannels: string;\n deleteUser: Ref<IUser>;\n deletedAt: Date;\n latestRevision?: Ref<IRevision>;\n latestRevisionBodyLength?: number;\n expandContentWidth?: boolean;\n wip?: boolean;\n ttlTimestamp?: Date;\n};\n\nexport type IPagePopulatedToShowRevision = Omit<\n IPageHasId,\n | 'lastUpdateUser'\n | 'creator'\n | 'deleteUser'\n | 'grantedGroups'\n | 'revision'\n | 'author'\n> & {\n lastUpdateUser?: IUserHasId;\n creator?: IUserHasId;\n deleteUser: IUserHasId;\n grantedGroups: { type: GroupType; item: IUserGroupHasId }[];\n revision?: IRevisionHasId;\n author: IUserHasId;\n};\n\nexport const PageGrant = {\n GRANT_PUBLIC: 1,\n GRANT_RESTRICTED: 2,\n GRANT_SPECIFIED: 3, // DEPRECATED\n GRANT_OWNER: 4,\n GRANT_USER_GROUP: 5,\n} as const;\ntype UnionPageGrantKeys = keyof typeof PageGrant;\nexport type PageGrant = (typeof PageGrant)[UnionPageGrantKeys];\n\nexport const PageStatus = {\n STATUS_PUBLISHED: 'published',\n STATUS_DELETED: 'deleted',\n} as const;\nexport type PageStatus = (typeof PageStatus)[keyof typeof PageStatus];\n\nexport type IPageHasId = IPage & HasObjectId;\n\n// Special type to represent page is an empty page or not found or forbidden status\nexport type IPageNotFoundInfo = {\n isNotFound: true;\n isForbidden: boolean;\n};\n\nexport type IPageInfo = {\n isNotFound: boolean;\n isV5Compatible: boolean;\n isEmpty: boolean;\n isMovable: boolean;\n isDeletable: boolean;\n isAbleToDeleteCompletely: boolean;\n isRevertible: boolean;\n bookmarkCount: number;\n};\n\nexport type IPageInfoForEmpty = Omit<IPageInfo, 'isNotFound' | 'isEmpty'> & {\n emptyPageId: string;\n isNotFound: false;\n isEmpty: true;\n isBookmarked?: boolean;\n};\n\nexport type IPageInfoForEntity = Omit<IPageInfo, 'isNotFound' | 'isEmpty'> & {\n isNotFound: false;\n isEmpty: false;\n sumOfLikers: number;\n likerIds: string[];\n sumOfSeenUsers: number;\n seenUserIds: string[];\n contentAge: number;\n descendantCount: number;\n commentCount: number;\n latestRevisionId: Ref<IRevision>;\n};\n\nexport type IPageInfoForOperation = IPageInfoForEntity & {\n isBookmarked?: boolean;\n isLiked?: boolean;\n subscriptionStatus?: SubscriptionStatusType;\n};\n\nexport type IPageInfoForListing = IPageInfoForEntity & HasRevisionShortbody;\n\nexport type IPageInfoExt =\n | IPageInfo\n | IPageInfoForEmpty\n | IPageInfoForEntity\n | IPageInfoForOperation\n | IPageInfoForListing;\n\nexport const isIPageNotFoundInfo = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageNotFoundInfo => {\n return (\n pageInfo != null &&\n pageInfo instanceof Object &&\n pageInfo.isNotFound === true &&\n 'isForbidden' in pageInfo\n );\n};\n\nexport const isIPageInfo = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfo => {\n return (\n pageInfo != null && pageInfo instanceof Object && 'isEmpty' in pageInfo\n );\n};\n\nexport const isIPageInfoForEmpty = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfoForEmpty => {\n return isIPageInfo(pageInfo) && pageInfo.isEmpty === true;\n};\n\nexport const isIPageInfoForEntity = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfoForEntity => {\n return isIPageInfo(pageInfo) && pageInfo.isEmpty === false;\n};\n\nexport const isIPageInfoForOperation = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfoForOperation => {\n return (\n isIPageInfoForEntity(pageInfo) &&\n ('isBookmarked' in pageInfo ||\n 'isLiked' in pageInfo ||\n 'subscriptionStatus' in pageInfo)\n );\n};\n\nexport const isIPageInfoForListing = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n pageInfo: any | undefined,\n): pageInfo is IPageInfoForListing => {\n return isIPageInfoForEntity(pageInfo) && 'revisionShortBody' in pageInfo;\n};\n\nexport type IDataWithMeta<D = unknown, M = unknown> = {\n data: D;\n meta?: M;\n};\nexport type IDataWithRequiredMeta<D = unknown, M = unknown> = IDataWithMeta<\n D,\n M\n> & { meta: M };\n\nexport type IPageWithMeta<M = IPageInfoExt> = IDataWithMeta<IPageHasId, M>;\n\nexport type IPageToDeleteWithMeta<T = IPageInfoForEntity | unknown> =\n IDataWithMeta<\n HasObjectId & (IPage | { path: string; revision: string | null }),\n T\n >;\nexport type IPageToRenameWithMeta<T = IPageInfoForEntity | unknown> =\n IPageToDeleteWithMeta<T>;\n"],"names":["GroupType","PageGrant","PageStatus","isIPageNotFoundInfo","pageInfo","isIPageInfo","isIPageInfoForEmpty","isIPageInfoForEntity","isIPageInfoForOperation","isIPageInfoForListing"],"mappings":"AAWO,MAAMA,IAAY;AAAA,EACvB,WAAW;AAAA,EACX,mBAAmB;AACrB,GAqDaC,IAAY;AAAA,EACvB,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,iBAAiB;AAAA;AAAA,EACjB,aAAa;AAAA,EACb,kBAAkB;AACpB,GAIaC,IAAa;AAAA,EACxB,kBAAkB;AAAA,EAClB,gBAAgB;AAClB,GAyDaC,IAAsB,CAEjCC,MAGEA,KAAY,QACZA,aAAoB,UACpBA,EAAS,eAAe,MACxB,iBAAiBA,GAIRC,IAAc,CAEzBD,MAGEA,KAAY,QAAQA,aAAoB,UAAU,aAAaA,GAItDE,IAAsB,CAEjCF,MAEOC,EAAYD,CAAQ,KAAKA,EAAS,YAAY,IAG1CG,IAAuB,CAElCH,MAEOC,EAAYD,CAAQ,KAAKA,EAAS,YAAY,IAG1CI,IAA0B,CAErCJ,MAGEG,EAAqBH,CAAQ,MAC5B,kBAAkBA,KACjB,aAAaA,KACb,wBAAwBA,IAIjBK,IAAwB,CAEnCL,MAEOG,EAAqBH,CAAQ,KAAK,uBAAuBA;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l={admin:{top:{},app:{},security:{},markdown:{},customize:{},import_data:{},export_data:{},data_transfer:{},external_notification:{},slack_integration:{},legacy_slack_integration:{},user_management:{},user_group_management:{},audit_log:{},plugin:{},ai_integration:{},full_text_search:{}}},E={user_settings:{info:{},external_account:{},password:{},api:{api_token:{},access_token:{}},in_app_notification:{},other:{}},features:{ai_assistant:{},page:{},share_link:{},bookmark:{},attachment:{},page_bulk_export:{}}},S={...l,...E},i={READ:"read",WRITE:"write"},_="*",g=Object.values(i).reduce((t,n)=>(t[n]=S,t),{}),f=()=>{const t={},n=(p,u=[],o)=>{for(const[s,e]of Object.entries(p)){const a=s.toUpperCase(),c=[...u,s],r=c.join(":");e!=null&&(typeof e=="object"&&Object.keys(e).length===0?o[a]=`${r}`:typeof e=="object"&&(o[a]={ALL:`${r}:${_}`},n(e,c,o[a])))}};return n(g,[],t),t},d=f();exports.ACTION=i;exports.ALL_SIGN=_;exports.SCOPE=d;
2
+ //# sourceMappingURL=scope.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope.cjs","sources":["../../src/interfaces/scope.ts"],"sourcesContent":["// SCOPE_SEED defines the basic scope structure.\n// When you need to set different permissions for Admin and User\n// on specific endpoints (like /me), use SCOPE rather than modifying SCOPE_SEED.\n\n// If you want to add a new scope, you only need to add a new key to the SCOPE_SEED object.\n\n// Change translation file contents (accesstoken_scopes_desc) when scope structure is modified\n\nconst SCOPE_SEED_ADMIN = {\n admin: {\n top: {},\n app: {},\n security: {},\n markdown: {},\n customize: {},\n import_data: {},\n export_data: {},\n data_transfer: {},\n external_notification: {},\n slack_integration: {},\n legacy_slack_integration: {},\n user_management: {},\n user_group_management: {},\n audit_log: {},\n plugin: {},\n ai_integration: {},\n full_text_search: {},\n },\n} as const;\n\nconst SCOPE_SEED_USER = {\n user_settings: {\n info: {},\n external_account: {},\n password: {},\n api: {\n api_token: {},\n access_token: {},\n },\n in_app_notification: {},\n other: {},\n },\n features: {\n ai_assistant: {},\n page: {},\n share_link: {},\n bookmark: {},\n attachment: {},\n page_bulk_export: {},\n },\n} as const;\n\nconst SCOPE_SEED = {\n ...SCOPE_SEED_ADMIN,\n ...SCOPE_SEED_USER,\n} as const;\n\nexport const ACTION = {\n READ: 'read',\n WRITE: 'write',\n} as const;\n\ntype ACTION_TYPE = (typeof ACTION)[keyof typeof ACTION];\nexport const ALL_SIGN = '*';\n\nconst SCOPE_SEED_WITH_ACTION = Object.values(ACTION).reduce(\n (acc, action) => {\n acc[action] = SCOPE_SEED;\n return acc;\n },\n {} as Record<ACTION_TYPE, typeof SCOPE_SEED>,\n);\n\ntype FlattenObject<T> = {\n [K in keyof T]: T[K] extends object\n ? keyof T[K] extends never\n ? K\n : `${K & string}:${FlattenObject<T[K]> & string}`\n : K;\n}[keyof T];\n\ntype AddAllToScope<S extends string> = S extends `${infer X}:${infer Y}`\n ? `${X}:${typeof ALL_SIGN}` | `${X}:${AddAllToScope<Y>}` | S\n : S;\n\ntype ScopeOnly = FlattenObject<typeof SCOPE_SEED_WITH_ACTION>;\ntype ScopeWithAll = AddAllToScope<ScopeOnly>;\nexport type Scope = ScopeOnly | ScopeWithAll;\n\n// ScopeConstants type definition\ntype ScopeConstantLeaf = Scope;\n\ntype ScopeConstantNode<T> = {\n [K in keyof T as Uppercase<string & K>]: T[K] extends object\n ? keyof T[K] extends never\n ? ScopeConstantLeaf\n : ScopeConstantNode<T[K]> & { ALL: Scope }\n : ScopeConstantLeaf;\n};\n\ntype ScopeConstantType = {\n [A in keyof typeof SCOPE_SEED_WITH_ACTION as Uppercase<\n string & A\n >]: ScopeConstantNode<typeof SCOPE_SEED> & { ALL: Scope };\n};\n\nconst buildScopeConstants = (): ScopeConstantType => {\n const result = {} as Partial<ScopeConstantType>;\n\n const processObject = (\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n obj: Record<string, any>,\n path: string[] = [],\n // biome-ignore lint/suspicious/noExplicitAny: ignore\n resultObj: Record<string, any>,\n ) => {\n for (const [key, value] of Object.entries(obj)) {\n const upperKey = key.toUpperCase();\n const currentPath = [...path, key];\n const scopePath = currentPath.join(':');\n\n if (value == null) {\n continue; // Changed from 'return' to 'continue' to match the loop behavior\n }\n\n if (typeof value === 'object' && Object.keys(value).length === 0) {\n resultObj[upperKey] = `${scopePath}` as Scope;\n } else if (typeof value === 'object') {\n resultObj[upperKey] = {\n ALL: `${scopePath}:${ALL_SIGN}` as Scope,\n };\n\n processObject(value, currentPath, resultObj[upperKey]);\n }\n }\n };\n processObject(SCOPE_SEED_WITH_ACTION, [], result);\n\n return result as ScopeConstantType;\n};\n\nexport const SCOPE = buildScopeConstants();\n"],"names":["SCOPE_SEED_ADMIN","SCOPE_SEED_USER","SCOPE_SEED","ACTION","ALL_SIGN","SCOPE_SEED_WITH_ACTION","acc","action","buildScopeConstants","result","processObject","obj","path","resultObj","key","value","upperKey","currentPath","scopePath","SCOPE"],"mappings":"gFAQA,MAAMA,EAAmB,CACvB,MAAO,CACL,IAAK,CAAC,EACN,IAAK,CAAC,EACN,SAAU,CAAC,EACX,SAAU,CAAC,EACX,UAAW,CAAC,EACZ,YAAa,CAAC,EACd,YAAa,CAAC,EACd,cAAe,CAAC,EAChB,sBAAuB,CAAC,EACxB,kBAAmB,CAAC,EACpB,yBAA0B,CAAC,EAC3B,gBAAiB,CAAC,EAClB,sBAAuB,CAAC,EACxB,UAAW,CAAC,EACZ,OAAQ,CAAC,EACT,eAAgB,CAAC,EACjB,iBAAkB,CAAA,CAAC,CAEvB,EAEMC,EAAkB,CACtB,cAAe,CACb,KAAM,CAAC,EACP,iBAAkB,CAAC,EACnB,SAAU,CAAC,EACX,IAAK,CACH,UAAW,CAAC,EACZ,aAAc,CAAA,CAChB,EACA,oBAAqB,CAAC,EACtB,MAAO,CAAA,CACT,EACA,SAAU,CACR,aAAc,CAAC,EACf,KAAM,CAAC,EACP,WAAY,CAAC,EACb,SAAU,CAAC,EACX,WAAY,CAAC,EACb,iBAAkB,CAAA,CAAC,CAEvB,EAEMC,EAAa,CACjB,GAAGF,EACH,GAAGC,CACL,EAEaE,EAAS,CACpB,KAAM,OACN,MAAO,OACT,EAGaC,EAAW,IAElBC,EAAyB,OAAO,OAAOF,CAAM,EAAE,OACnD,CAACG,EAAKC,KACJD,EAAIC,CAAM,EAAIL,EACPI,GAET,CAAA,CACF,EAmCME,EAAsB,IAAyB,CACnD,MAAMC,EAAS,CAAC,EAEVC,EAAgB,CAEpBC,EACAC,EAAiB,CAAA,EAEjBC,IACG,CACH,SAAW,CAACC,EAAKC,CAAK,IAAK,OAAO,QAAQJ,CAAG,EAAG,CACxC,MAAAK,EAAWF,EAAI,YAAY,EAC3BG,EAAc,CAAC,GAAGL,EAAME,CAAG,EAC3BI,EAAYD,EAAY,KAAK,GAAG,EAElCF,GAAS,OAIT,OAAOA,GAAU,UAAY,OAAO,KAAKA,CAAK,EAAE,SAAW,EACnDF,EAAAG,CAAQ,EAAI,GAAGE,CAAS,GACzB,OAAOH,GAAU,WAC1BF,EAAUG,CAAQ,EAAI,CACpB,IAAK,GAAGE,CAAS,IAAId,CAAQ,EAC/B,EAEAM,EAAcK,EAAOE,EAAaJ,EAAUG,CAAQ,CAAC,GACvD,CAEJ,EACc,OAAAN,EAAAL,EAAwB,CAAC,EAAGI,CAAM,EAEzCA,CACT,EAEaU,EAAQX,EAAoB"}