@growi/core 2.0.0 → 2.1.0-next.4336eed8f84dc00cd1a3bb7359df7d8b03fdab8b

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.
@@ -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\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"}
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 type IPageInfoBasicForEmpty = Omit<\n IPageInfoForEmpty,\n 'bookmarkCount' | 'isDeletable' | 'isAbleToDeleteCompletely' | 'isBookmarked'\n>;\n\nexport type IPageInfoBasicForEntity = Omit<\n IPageInfoForEntity,\n 'bookmarkCount' | 'isDeletable' | 'isAbleToDeleteCompletely'\n>;\n\nexport type IPageInfoBasic = IPageInfoBasicForEmpty | IPageInfoBasicForEntity;\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,GAe1CI,EAEXJ,GAGEG,EAAqBH,CAAQ,IAC5B,iBAAkBA,GACjB,YAAaA,GACb,uBAAwBA,GAIjBK,EAEXL,GAEOG,EAAqBH,CAAQ,GAAK,sBAAuBA"}
@@ -110,6 +110,9 @@ export declare const isIPageNotFoundInfo: (pageInfo: any | undefined) => pageInf
110
110
  export declare const isIPageInfo: (pageInfo: any | undefined) => pageInfo is IPageInfo;
111
111
  export declare const isIPageInfoForEmpty: (pageInfo: any | undefined) => pageInfo is IPageInfoForEmpty;
112
112
  export declare const isIPageInfoForEntity: (pageInfo: any | undefined) => pageInfo is IPageInfoForEntity;
113
+ export type IPageInfoBasicForEmpty = Omit<IPageInfoForEmpty, 'bookmarkCount' | 'isDeletable' | 'isAbleToDeleteCompletely' | 'isBookmarked'>;
114
+ export type IPageInfoBasicForEntity = Omit<IPageInfoForEntity, 'bookmarkCount' | 'isDeletable' | 'isAbleToDeleteCompletely'>;
115
+ export type IPageInfoBasic = IPageInfoBasicForEmpty | IPageInfoBasicForEntity;
113
116
  export declare const isIPageInfoForOperation: (pageInfo: any | undefined) => pageInfo is IPageInfoForOperation;
114
117
  export declare const isIPageInfoForListing: (pageInfo: any | undefined) => pageInfo is IPageInfoForListing;
115
118
  export type IDataWithMeta<D = unknown, M = unknown> = {
@@ -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\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;"}
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 type IPageInfoBasicForEmpty = Omit<\n IPageInfoForEmpty,\n 'bookmarkCount' | 'isDeletable' | 'isAbleToDeleteCompletely' | 'isBookmarked'\n>;\n\nexport type IPageInfoBasicForEntity = Omit<\n IPageInfoForEntity,\n 'bookmarkCount' | 'isDeletable' | 'isAbleToDeleteCompletely'\n>;\n\nexport type IPageInfoBasic = IPageInfoBasicForEmpty | IPageInfoBasicForEntity;\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,IAe1CI,IAA0B,CAErCJ,MAGEG,EAAqBH,CAAQ,MAC5B,kBAAkBA,KACjB,aAAaA,KACb,wBAAwBA,IAIjBK,IAAwB,CAEnCL,MAEOG,EAAqBH,CAAQ,KAAK,uBAAuBA;"}
@@ -1 +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"}
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:\n// 1. Add a new key to the SCOPE_SEED object below\n// 2. Add the corresponding scope strings to the Scope type union at the bottom of this file\n// 3. 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\n// ============================================================================\n// SCOPE LITERAL TYPE\n// ============================================================================\n// This type is explicitly defined to avoid TS2589 \"Type instantiation is\n// excessively deep\" errors that occur with recursive type definitions.\n//\n// IMPORTANT: When modifying SCOPE_SEED above, update this type union accordingly.\n// The scope strings follow the pattern: {action}:{category}[:{subcategory}[:{item}]]\n// Wildcard scopes use '*' at any level: {action}:{category}:*\n// ============================================================================\n\n// Read scopes - Admin\ntype ReadAdminScope =\n | 'read:admin:top'\n | 'read:admin:app'\n | 'read:admin:security'\n | 'read:admin:markdown'\n | 'read:admin:customize'\n | 'read:admin:import_data'\n | 'read:admin:export_data'\n | 'read:admin:data_transfer'\n | 'read:admin:external_notification'\n | 'read:admin:slack_integration'\n | 'read:admin:legacy_slack_integration'\n | 'read:admin:user_management'\n | 'read:admin:user_group_management'\n | 'read:admin:audit_log'\n | 'read:admin:plugin'\n | 'read:admin:ai_integration'\n | 'read:admin:full_text_search'\n | 'read:admin:*';\n\n// Read scopes - User Settings\ntype ReadUserSettingsScope =\n | 'read:user_settings:info'\n | 'read:user_settings:external_account'\n | 'read:user_settings:password'\n | 'read:user_settings:api:api_token'\n | 'read:user_settings:api:access_token'\n | 'read:user_settings:api:*'\n | 'read:user_settings:in_app_notification'\n | 'read:user_settings:other'\n | 'read:user_settings:*';\n\n// Read scopes - Features\ntype ReadFeaturesScope =\n | 'read:features:ai_assistant'\n | 'read:features:page'\n | 'read:features:share_link'\n | 'read:features:bookmark'\n | 'read:features:attachment'\n | 'read:features:page_bulk_export'\n | 'read:features:*';\n\n// Write scopes - Admin\ntype WriteAdminScope =\n | 'write:admin:top'\n | 'write:admin:app'\n | 'write:admin:security'\n | 'write:admin:markdown'\n | 'write:admin:customize'\n | 'write:admin:import_data'\n | 'write:admin:export_data'\n | 'write:admin:data_transfer'\n | 'write:admin:external_notification'\n | 'write:admin:slack_integration'\n | 'write:admin:legacy_slack_integration'\n | 'write:admin:user_management'\n | 'write:admin:user_group_management'\n | 'write:admin:audit_log'\n | 'write:admin:plugin'\n | 'write:admin:ai_integration'\n | 'write:admin:full_text_search'\n | 'write:admin:*';\n\n// Write scopes - User Settings\ntype WriteUserSettingsScope =\n | 'write:user_settings:info'\n | 'write:user_settings:external_account'\n | 'write:user_settings:password'\n | 'write:user_settings:api:api_token'\n | 'write:user_settings:api:access_token'\n | 'write:user_settings:api:*'\n | 'write:user_settings:in_app_notification'\n | 'write:user_settings:other'\n | 'write:user_settings:*';\n\n// Write scopes - Features\ntype WriteFeaturesScope =\n | 'write:features:ai_assistant'\n | 'write:features:page'\n | 'write:features:share_link'\n | 'write:features:bookmark'\n | 'write:features:attachment'\n | 'write:features:page_bulk_export'\n | 'write:features:*';\n\n// Combined Scope type - all valid scope strings\nexport type Scope =\n | ReadAdminScope\n | ReadUserSettingsScope\n | ReadFeaturesScope\n | WriteAdminScope\n | WriteUserSettingsScope\n | WriteFeaturesScope\n | 'read:*'\n | 'write:*';\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":"gFASA,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,EA+HME,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"}
@@ -84,13 +84,13 @@ declare const SCOPE_SEED_WITH_ACTION: Record<ACTION_TYPE, {
84
84
  readonly full_text_search: {};
85
85
  };
86
86
  }>;
87
- type FlattenObject<T> = {
88
- [K in keyof T]: T[K] extends object ? keyof T[K] extends never ? K : `${K & string}:${FlattenObject<T[K]> & string}` : K;
89
- }[keyof T];
90
- type AddAllToScope<S extends string> = S extends `${infer X}:${infer Y}` ? `${X}:${typeof ALL_SIGN}` | `${X}:${AddAllToScope<Y>}` | S : S;
91
- type ScopeOnly = FlattenObject<typeof SCOPE_SEED_WITH_ACTION>;
92
- type ScopeWithAll = AddAllToScope<ScopeOnly>;
93
- export type Scope = ScopeOnly | ScopeWithAll;
87
+ type ReadAdminScope = 'read:admin:top' | 'read:admin:app' | 'read:admin:security' | 'read:admin:markdown' | 'read:admin:customize' | 'read:admin:import_data' | 'read:admin:export_data' | 'read:admin:data_transfer' | 'read:admin:external_notification' | 'read:admin:slack_integration' | 'read:admin:legacy_slack_integration' | 'read:admin:user_management' | 'read:admin:user_group_management' | 'read:admin:audit_log' | 'read:admin:plugin' | 'read:admin:ai_integration' | 'read:admin:full_text_search' | 'read:admin:*';
88
+ type ReadUserSettingsScope = 'read:user_settings:info' | 'read:user_settings:external_account' | 'read:user_settings:password' | 'read:user_settings:api:api_token' | 'read:user_settings:api:access_token' | 'read:user_settings:api:*' | 'read:user_settings:in_app_notification' | 'read:user_settings:other' | 'read:user_settings:*';
89
+ type ReadFeaturesScope = 'read:features:ai_assistant' | 'read:features:page' | 'read:features:share_link' | 'read:features:bookmark' | 'read:features:attachment' | 'read:features:page_bulk_export' | 'read:features:*';
90
+ type WriteAdminScope = 'write:admin:top' | 'write:admin:app' | 'write:admin:security' | 'write:admin:markdown' | 'write:admin:customize' | 'write:admin:import_data' | 'write:admin:export_data' | 'write:admin:data_transfer' | 'write:admin:external_notification' | 'write:admin:slack_integration' | 'write:admin:legacy_slack_integration' | 'write:admin:user_management' | 'write:admin:user_group_management' | 'write:admin:audit_log' | 'write:admin:plugin' | 'write:admin:ai_integration' | 'write:admin:full_text_search' | 'write:admin:*';
91
+ type WriteUserSettingsScope = 'write:user_settings:info' | 'write:user_settings:external_account' | 'write:user_settings:password' | 'write:user_settings:api:api_token' | 'write:user_settings:api:access_token' | 'write:user_settings:api:*' | 'write:user_settings:in_app_notification' | 'write:user_settings:other' | 'write:user_settings:*';
92
+ type WriteFeaturesScope = 'write:features:ai_assistant' | 'write:features:page' | 'write:features:share_link' | 'write:features:bookmark' | 'write:features:attachment' | 'write:features:page_bulk_export' | 'write:features:*';
93
+ export type Scope = ReadAdminScope | ReadUserSettingsScope | ReadFeaturesScope | WriteAdminScope | WriteUserSettingsScope | WriteFeaturesScope | 'read:*' | 'write:*';
94
94
  type ScopeConstantLeaf = Scope;
95
95
  type ScopeConstantNode<T> = {
96
96
  [K in keyof T as Uppercase<string & K>]: T[K] extends object ? keyof T[K] extends never ? ScopeConstantLeaf : ScopeConstantNode<T[K]> & {
@@ -1 +1 @@
1
- {"version":3,"file":"scope.js","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":"AAQA,MAAMA,IAAmB;AAAA,EACvB,OAAO;AAAA,IACL,KAAK,CAAC;AAAA,IACN,KAAK,CAAC;AAAA,IACN,UAAU,CAAC;AAAA,IACX,UAAU,CAAC;AAAA,IACX,WAAW,CAAC;AAAA,IACZ,aAAa,CAAC;AAAA,IACd,aAAa,CAAC;AAAA,IACd,eAAe,CAAC;AAAA,IAChB,uBAAuB,CAAC;AAAA,IACxB,mBAAmB,CAAC;AAAA,IACpB,0BAA0B,CAAC;AAAA,IAC3B,iBAAiB,CAAC;AAAA,IAClB,uBAAuB,CAAC;AAAA,IACxB,WAAW,CAAC;AAAA,IACZ,QAAQ,CAAC;AAAA,IACT,gBAAgB,CAAC;AAAA,IACjB,kBAAkB,CAAA;AAAA,EAAC;AAEvB,GAEMC,IAAkB;AAAA,EACtB,eAAe;AAAA,IACb,MAAM,CAAC;AAAA,IACP,kBAAkB,CAAC;AAAA,IACnB,UAAU,CAAC;AAAA,IACX,KAAK;AAAA,MACH,WAAW,CAAC;AAAA,MACZ,cAAc,CAAA;AAAA,IAChB;AAAA,IACA,qBAAqB,CAAC;AAAA,IACtB,OAAO,CAAA;AAAA,EACT;AAAA,EACA,UAAU;AAAA,IACR,cAAc,CAAC;AAAA,IACf,MAAM,CAAC;AAAA,IACP,YAAY,CAAC;AAAA,IACb,UAAU,CAAC;AAAA,IACX,YAAY,CAAC;AAAA,IACb,kBAAkB,CAAA;AAAA,EAAC;AAEvB,GAEMC,IAAa;AAAA,EACjB,GAAGF;AAAA,EACH,GAAGC;AACL,GAEaE,IAAS;AAAA,EACpB,MAAM;AAAA,EACN,OAAO;AACT,GAGaC,IAAW,KAElBC,IAAyB,OAAO,OAAOF,CAAM,EAAE;AAAA,EACnD,CAACG,GAAKC,OACJD,EAAIC,CAAM,IAAIL,GACPI;AAAA,EAET,CAAA;AACF,GAmCME,IAAsB,MAAyB;AACnD,QAAMC,IAAS,CAAC,GAEVC,IAAgB,CAEpBC,GACAC,IAAiB,CAAA,GAEjBC,MACG;AACH,eAAW,CAACC,GAAKC,CAAK,KAAK,OAAO,QAAQJ,CAAG,GAAG;AACxC,YAAAK,IAAWF,EAAI,YAAY,GAC3BG,IAAc,CAAC,GAAGL,GAAME,CAAG,GAC3BI,IAAYD,EAAY,KAAK,GAAG;AAEtC,MAAIF,KAAS,SAIT,OAAOA,KAAU,YAAY,OAAO,KAAKA,CAAK,EAAE,WAAW,IACnDF,EAAAG,CAAQ,IAAI,GAAGE,CAAS,KACzB,OAAOH,KAAU,aAC1BF,EAAUG,CAAQ,IAAI;AAAA,QACpB,KAAK,GAAGE,CAAS,IAAId,CAAQ;AAAA,MAC/B,GAEAM,EAAcK,GAAOE,GAAaJ,EAAUG,CAAQ,CAAC;AAAA,IACvD;AAAA,EAEJ;AACc,SAAAN,EAAAL,GAAwB,CAAC,GAAGI,CAAM,GAEzCA;AACT,GAEaU,IAAQX,EAAoB;"}
1
+ {"version":3,"file":"scope.js","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:\n// 1. Add a new key to the SCOPE_SEED object below\n// 2. Add the corresponding scope strings to the Scope type union at the bottom of this file\n// 3. 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\n// ============================================================================\n// SCOPE LITERAL TYPE\n// ============================================================================\n// This type is explicitly defined to avoid TS2589 \"Type instantiation is\n// excessively deep\" errors that occur with recursive type definitions.\n//\n// IMPORTANT: When modifying SCOPE_SEED above, update this type union accordingly.\n// The scope strings follow the pattern: {action}:{category}[:{subcategory}[:{item}]]\n// Wildcard scopes use '*' at any level: {action}:{category}:*\n// ============================================================================\n\n// Read scopes - Admin\ntype ReadAdminScope =\n | 'read:admin:top'\n | 'read:admin:app'\n | 'read:admin:security'\n | 'read:admin:markdown'\n | 'read:admin:customize'\n | 'read:admin:import_data'\n | 'read:admin:export_data'\n | 'read:admin:data_transfer'\n | 'read:admin:external_notification'\n | 'read:admin:slack_integration'\n | 'read:admin:legacy_slack_integration'\n | 'read:admin:user_management'\n | 'read:admin:user_group_management'\n | 'read:admin:audit_log'\n | 'read:admin:plugin'\n | 'read:admin:ai_integration'\n | 'read:admin:full_text_search'\n | 'read:admin:*';\n\n// Read scopes - User Settings\ntype ReadUserSettingsScope =\n | 'read:user_settings:info'\n | 'read:user_settings:external_account'\n | 'read:user_settings:password'\n | 'read:user_settings:api:api_token'\n | 'read:user_settings:api:access_token'\n | 'read:user_settings:api:*'\n | 'read:user_settings:in_app_notification'\n | 'read:user_settings:other'\n | 'read:user_settings:*';\n\n// Read scopes - Features\ntype ReadFeaturesScope =\n | 'read:features:ai_assistant'\n | 'read:features:page'\n | 'read:features:share_link'\n | 'read:features:bookmark'\n | 'read:features:attachment'\n | 'read:features:page_bulk_export'\n | 'read:features:*';\n\n// Write scopes - Admin\ntype WriteAdminScope =\n | 'write:admin:top'\n | 'write:admin:app'\n | 'write:admin:security'\n | 'write:admin:markdown'\n | 'write:admin:customize'\n | 'write:admin:import_data'\n | 'write:admin:export_data'\n | 'write:admin:data_transfer'\n | 'write:admin:external_notification'\n | 'write:admin:slack_integration'\n | 'write:admin:legacy_slack_integration'\n | 'write:admin:user_management'\n | 'write:admin:user_group_management'\n | 'write:admin:audit_log'\n | 'write:admin:plugin'\n | 'write:admin:ai_integration'\n | 'write:admin:full_text_search'\n | 'write:admin:*';\n\n// Write scopes - User Settings\ntype WriteUserSettingsScope =\n | 'write:user_settings:info'\n | 'write:user_settings:external_account'\n | 'write:user_settings:password'\n | 'write:user_settings:api:api_token'\n | 'write:user_settings:api:access_token'\n | 'write:user_settings:api:*'\n | 'write:user_settings:in_app_notification'\n | 'write:user_settings:other'\n | 'write:user_settings:*';\n\n// Write scopes - Features\ntype WriteFeaturesScope =\n | 'write:features:ai_assistant'\n | 'write:features:page'\n | 'write:features:share_link'\n | 'write:features:bookmark'\n | 'write:features:attachment'\n | 'write:features:page_bulk_export'\n | 'write:features:*';\n\n// Combined Scope type - all valid scope strings\nexport type Scope =\n | ReadAdminScope\n | ReadUserSettingsScope\n | ReadFeaturesScope\n | WriteAdminScope\n | WriteUserSettingsScope\n | WriteFeaturesScope\n | 'read:*'\n | 'write:*';\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":"AASA,MAAMA,IAAmB;AAAA,EACvB,OAAO;AAAA,IACL,KAAK,CAAC;AAAA,IACN,KAAK,CAAC;AAAA,IACN,UAAU,CAAC;AAAA,IACX,UAAU,CAAC;AAAA,IACX,WAAW,CAAC;AAAA,IACZ,aAAa,CAAC;AAAA,IACd,aAAa,CAAC;AAAA,IACd,eAAe,CAAC;AAAA,IAChB,uBAAuB,CAAC;AAAA,IACxB,mBAAmB,CAAC;AAAA,IACpB,0BAA0B,CAAC;AAAA,IAC3B,iBAAiB,CAAC;AAAA,IAClB,uBAAuB,CAAC;AAAA,IACxB,WAAW,CAAC;AAAA,IACZ,QAAQ,CAAC;AAAA,IACT,gBAAgB,CAAC;AAAA,IACjB,kBAAkB,CAAA;AAAA,EAAC;AAEvB,GAEMC,IAAkB;AAAA,EACtB,eAAe;AAAA,IACb,MAAM,CAAC;AAAA,IACP,kBAAkB,CAAC;AAAA,IACnB,UAAU,CAAC;AAAA,IACX,KAAK;AAAA,MACH,WAAW,CAAC;AAAA,MACZ,cAAc,CAAA;AAAA,IAChB;AAAA,IACA,qBAAqB,CAAC;AAAA,IACtB,OAAO,CAAA;AAAA,EACT;AAAA,EACA,UAAU;AAAA,IACR,cAAc,CAAC;AAAA,IACf,MAAM,CAAC;AAAA,IACP,YAAY,CAAC;AAAA,IACb,UAAU,CAAC;AAAA,IACX,YAAY,CAAC;AAAA,IACb,kBAAkB,CAAA;AAAA,EAAC;AAEvB,GAEMC,IAAa;AAAA,EACjB,GAAGF;AAAA,EACH,GAAGC;AACL,GAEaE,IAAS;AAAA,EACpB,MAAM;AAAA,EACN,OAAO;AACT,GAGaC,IAAW,KAElBC,IAAyB,OAAO,OAAOF,CAAM,EAAE;AAAA,EACnD,CAACG,GAAKC,OACJD,EAAIC,CAAM,IAAIL,GACPI;AAAA,EAET,CAAA;AACF,GA+HME,IAAsB,MAAyB;AACnD,QAAMC,IAAS,CAAC,GAEVC,IAAgB,CAEpBC,GACAC,IAAiB,CAAA,GAEjBC,MACG;AACH,eAAW,CAACC,GAAKC,CAAK,KAAK,OAAO,QAAQJ,CAAG,GAAG;AACxC,YAAAK,IAAWF,EAAI,YAAY,GAC3BG,IAAc,CAAC,GAAGL,GAAME,CAAG,GAC3BI,IAAYD,EAAY,KAAK,GAAG;AAEtC,MAAIF,KAAS,SAIT,OAAOA,KAAU,YAAY,OAAO,KAAKA,CAAK,EAAE,WAAW,IACnDF,EAAAG,CAAQ,IAAI,GAAGE,CAAS,KACzB,OAAOH,KAAU,aAC1BF,EAAUG,CAAQ,IAAI;AAAA,QACpB,KAAK,GAAGE,CAAS,IAAId,CAAQ;AAAA,MAC/B,GAEAM,EAAcK,GAAOE,GAAaJ,EAAUG,CAAQ,CAAC;AAAA,IACvD;AAAA,EAEJ;AACc,SAAAN,EAAAL,GAAwB,CAAC,GAAGI,CAAM,GAEzCA;AACT,GAEaU,IAAQX,EAAoB;"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=access-token-parser.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access-token-parser.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,17 @@
1
+ import { Request, RequestHandler } from 'express';
2
+ import { IUserSerializedSecurely } from '../../models/serializers';
3
+ import { Scope } from '../scope';
4
+ import { IUserHasId } from '../user';
5
+
6
+ export interface AccessTokenParserReq extends Request {
7
+ user?: IUserSerializedSecurely<IUserHasId>;
8
+ query: Request['query'] & {
9
+ access_token?: string;
10
+ };
11
+ body: Request['body'] & {
12
+ access_token?: string;
13
+ };
14
+ }
15
+ export type AccessTokenParser = (scopes?: Scope[], opts?: {
16
+ acceptLegacy: boolean;
17
+ }) => RequestHandler;
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=access-token-parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access-token-parser.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export * from './access-token-parser';
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { IAttachment, IUser } from '../../interfaces';
1
+ import { IAttachment, IUser } from '~/interfaces';
2
2
  import { Ref } from '../../interfaces/common';
3
3
  import { IUserSerializedSecurely } from './user-serializer';
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@growi/core",
3
- "version": "2.0.0",
3
+ "version": "2.1.0-next.4336eed8f84dc00cd1a3bb7359df7d8b03fdab8b",
4
4
  "description": "GROWI Core Libraries",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -26,6 +26,10 @@
26
26
  "import": "./dist/interfaces/index.js",
27
27
  "require": "./dist/interfaces/index.cjs"
28
28
  },
29
+ "./dist/interfaces/server": {
30
+ "import": "./dist/interfaces/server/index.js",
31
+ "require": "./dist/interfaces/server/index.cjs"
32
+ },
29
33
  "./dist/models": {
30
34
  "import": "./dist/models/index.js",
31
35
  "require": "./dist/models/index.cjs"
@@ -63,6 +67,7 @@
63
67
  "escape-string-regexp": "^4.0.0"
64
68
  },
65
69
  "devDependencies": {
70
+ "@types/express": "^4",
66
71
  "mongoose": "^6.13.6",
67
72
  "socket.io-client": "^4.7.5",
68
73
  "swr": "^2.2.2"
@@ -72,8 +77,8 @@
72
77
  "clean": "shx rm -rf dist",
73
78
  "dev": "vite build --mode dev",
74
79
  "watch": "pnpm run dev -w --emptyOutDir=false",
75
- "lint:js": "biome check",
76
- "lint:typecheck": "vue-tsc --noEmit",
80
+ "lint:biome": "biome check",
81
+ "lint:typecheck": "tsgo --noEmit",
77
82
  "lint": "npm-run-all -p lint:*",
78
83
  "test": "vitest run --coverage"
79
84
  }