????
Current Path : C:/inetpub/vhost/dbadm.gdtsolutions.vn/web/js/ |
Current File : C:/inetpub/vhost/dbadm.gdtsolutions.vn/web/js/core-resource-manager-ce26f67e4958f13854a2.js |
/*! For license information please see ../license.txt */ "use strict";(self.webpackChunk_cloudbeaver_product_default=self.webpackChunk_cloudbeaver_product_default||[]).push([[9801],{54059:(e,t,s)=>{s.r(t),s.d(t,{LocaleService:()=>c});var r=s(1118),a=s(82103),i=s(5576),o=s(34227);let c=class LocaleService extends a.j{constructor(e){super(),this.localizationService=e}register(){this.localizationService.addProvider(this.provider.bind(this))}async provider(e){switch(e){case"ru":return(await Promise.all([s.e(92436),s.e(63145)]).then(s.bind(s,37161))).default;case"it":return(await Promise.all([s.e(32756),s.e(40764)]).then(s.bind(s,10365))).default;case"zh":return(await Promise.all([s.e(52041),s.e(18383)]).then(s.bind(s,2086))).default;case"fr":return(await Promise.all([s.e(29671),s.e(96002)]).then(s.bind(s,89240))).default;default:return(await Promise.all([s.e(41114),s.e(73621)]).then(s.bind(s,76847))).default}}};c=(0,r.Cg)([(0,i._)(),(0,r.Sn)("design:paramtypes",[o.LocalizationService])],c)},36604:(e,t,s)=>{s.d(t,{Z:()=>r});const r="rm.folder"},79295:(e,t,s)=>{s.d(t,{M:()=>r});const r="rm.project"},66892:(e,t,s)=>{s.d(t,{B:()=>r});const r="rm.resource"},68641:(e,t,s)=>{s.r(t),s.d(t,{PluginBootstrap:()=>d});var r=s(1118),a=s(82103),i=s(5576),o=s(3702),c=s(79295),n=s(24362);let d=class PluginBootstrap extends a.j{constructor(e){super(),this.projectsNavNodeService=e}register(){this.addRmProjectIds()}load(){}addRmProjectIds(){this.projectsNavNodeService.addProjectType(c.M),this.projectsNavNodeService.addProjectPrefix(n.p+"/")}};d=(0,r.Cg)([(0,i._)(),(0,r.Sn)("design:paramtypes",[o.ProjectsNavNodeService])],d)},99351:(e,t,s)=>{s.r(t),s.d(t,{ProjectPermissionsResource:()=>d});var r=s(1118),a=s(5576),i=s(20839),o=s(72755),c=s(19462),n=s(83336);let d=class ProjectPermissionsResource extends i.V{constructor(e,t){super((()=>[])),this.graphQLService=e,t.require(this,o.y.admin).outdateResource(this)}async loader(){const{permissions:e}=await this.graphQLService.sdk.getProjectPermissionsList();return e}};d=(0,r.Cg)([(0,a._)(),(0,r.Sn)("design:paramtypes",[n.GraphQLService,c.SessionPermissionsResource])],d)},24362:(e,t,s)=>{s.d(t,{p:()=>r});const r="ext://resources"},74909:(e,t,s)=>{s.r(t),s.d(t,{ResourceManagerEventHandler:()=>n});var r=s(1118),a=s(5576),i=s(21335),o=s(43974),c=s(60018);let n=class ResourceManagerEventHandler extends i._{constructor(e){super(o.nKA.CbScripts,e)}map(e){return e}};n=(0,r.Cg)([(0,a._)(),(0,r.Sn)("design:paramtypes",[c.SessionEventSource])],n)},41825:(e,t,s)=>{s.r(t),s.d(t,{ResourceManagerResource:()=>P,getRmResourceKey:()=>getRmResourceKey,getRmResourcePath:()=>getRmResourcePath});var r=s(1118),a=s(5576),i=s(62151),o=s(45941),c=s(7278),n=s(85213),d=s(57985),h=s(43974),u=s(912),p=s(44512),l=s(83336),m=s(58158),g=s(45934),j=s(81374),v=s(74909);let P=class ResourceManagerResource extends o.FJ{constructor(e,t,s,r){super(),this.graphQLService=e,this.projectsService=t,this.projectsService.onActiveProjectChange.addHandler((e=>{"after"===e.type&&this.markOutdated((0,c.OU)(e.projects))})),s.onEvent(h.OYz.CbRmResourceCreated,(async e=>{const t=(0,m.U)(e);this.useTracker.isInUse(e)?r.requestSynchronization("resource",e).then((async s=>{s&&(this.isOutdated(t)||await this.load(e))})):this.isOutdated(t)||await this.load(e)}),(e=>getRmResourcePath(e.projectId,e.resourcePath)),this),s.onEvent(h.OYz.CbRmResourceUpdated,(e=>{this.useTracker.isInUse(e)?r.requestSynchronization("resource",e).then((t=>{t&&(this.onDataUpdate.execute(e),this.markOutdated(e))})):(this.onDataUpdate.execute(e),this.markOutdated(e))}),(e=>getRmResourcePath(e.projectId,e.resourcePath)),this),s.onEvent(h.OYz.CbRmResourceDeleted,(e=>{this.useTracker.isInUse(e)?r.requestSynchronization("resource",e).then((t=>{t&&(this.delete(e),this.onDataUpdate.execute(e))})):(this.delete(e),this.onDataUpdate.execute(e))}),(e=>getRmResourcePath(e.projectId,e.resourcePath)),this)}async move(e,t){const s=getRmResourceKey(e),r=getRmResourceKey(t);await this.performUpdate(e,void 0,(async()=>{await this.graphQLService.sdk.moveResource({projectId:s.projectId,oldPath:s.path,newPath:r.path}),await this.loader(t,[]),this.moveSync(e,t,this.get(t)),this.onDataOutdated.execute(e)}))}async setProperties(e,t){const s={},r=(await this.load(e,["includeProperties"])).properties,a=getRmResourceKey(e);return await this.performUpdate(e,void 0,(async()=>{for(const[e,i]of Object.entries(t))r[e]===i||null===i&&!(e in r)||(await this.graphQLService.sdk.setResourceProperty({projectId:a.projectId,resourcePath:a.path,name:e,value:i}),s[e]=i);Object.assign(r,s),this.onDataOutdated.execute(e)})),r}async create(e,t){const s=getRmResourceKey(e);await this.graphQLService.sdk.createResource({projectId:s.projectId,resourcePath:s.path,isFolder:t}),await this.load(e)}async writeText(e,t,s){const r=getRmResourceKey(e);await this.graphQLService.sdk.writeResourceContent({projectId:r.projectId,resourcePath:r.path,data:t,forceOverwrite:s}),this.markOutdated(e),await this.load(e)}async readText(e){await this.load(e);const t=getRmResourceKey(e);return(await this.graphQLService.sdk.readResource({projectId:t.projectId,resourcePath:t.path})).value}async deleteResource(e){await this.performUpdate(e,void 0,(async()=>{const t=getRmResourceKey(e);await this.graphQLService.sdk.deleteResource({projectId:t.projectId,resourcePath:t.path,recursive:!1}),this.delete(e),this.onDataOutdated.execute(e)}))}async loader(e,t){const s=new Map;return await n.F.forEachAsync(e,(async e=>{const r=this.aliases.isAlias(e,o.x1);if(r){const a=getRmResourceKey(r.options.path),{resources:i}=await this.graphQLService.sdk.getResourceList({projectId:a.projectId,path:a.path,...this.getDefaultIncludes(),...this.getIncludesMap(r.options.path,t)});for(const e of i)s.set((0,g.A)(r.options.path,e.name),e);const o=(0,m.U)(r.options.path);o&&(e=o)}if(!(0,d.l)(e)){const r=getRmResourceKey(e),{resources:a}=await this.graphQLService.sdk.getResourceList({projectId:r.projectId,path:r.parent,nameMask:r.name,...this.getDefaultIncludes(),...this.getIncludesMap(e,t)});if(r.name&&0===a.length)throw new p.d(`Resource "${e}" not found`);s.set(e,a[0])}})),this.set((0,c.OU)([...s.keys()]),[...s.values()]),this.data}getDefaultIncludes(){return{includeProperties:!1}}};function getRmResourcePath(e,t){return(0,g.A)(e,t)}function getRmResourceKey(e){const t=(0,j.u)(e),s=t[0],r=t.length>1?t[t.length-1]:void 0;return{path:(0,g.A)(...t.slice(1,t.length)),projectId:s,parent:(0,g.A)(...t.slice(1,t.length-1)),name:r}}P=(0,r.Cg)([(0,a._)(),(0,r.Sn)("design:paramtypes",[l.GraphQLService,i.ProjectsService,v.ResourceManagerEventHandler,u.DataSynchronizationService])],P)},97851:(e,t,s)=>{s.r(t),s.d(t,{SharedProjectsResource:()=>g,isEqualSharedProjectGrantInfo:()=>isEqualSharedProjectGrantInfo});var r=s(1118),a=s(94866),i=s(5576),o=s(10392),c=s(40813),n=s(85213),d=s(7278),h=s(72755),u=s(19462),p=s(83336),l=s(38387);const m=Symbol("new-project");let g=class SharedProjectsResource extends c.nG{constructor(e,t,s){super((()=>new Map),[]),this.graphQLService=e,s.require(this,h.y.admin),this.sync(s,(()=>{})),this.connect(t),this.onDataOutdated.addHandler((()=>t.markOutdated())),this.onItemUpdate.addHandler((()=>t.markOutdated())),this.onItemDelete.addHandler((()=>t.markOutdated()))}isNew(e){return!this.has(e)||m in this.get(e)}cleanNewFlags(){for(const e of this.data.values())e[m]=!1}async addProjectPermissions(e,t,s){await this.graphQLService.sdk.addProjectsPermissions({projectIds:e,subjectIds:t,permissions:s})}async deleteProjectPermissions(e,t,s){await this.graphQLService.sdk.deleteProjectsPermissions({projectIds:e,subjectIds:t,permissions:s})}async loadAccessSubjects(e){const{grantedPermissions:t}=await this.graphQLService.sdk.getProjectGrantedPermissions({projectId:e});return t}async loadSubjectAccess(e){const{grantedPermissions:t}=await this.graphQLService.sdk.getSubjectProjectsPermissions({subjectId:e});return t}async create(e){const{project:t}=await this.graphQLService.sdk.createProject({projectId:e.id,projectName:e.name,description:e.description});return t[m]=!0,this.set(t.id,t),this.get(t.id)}async deleteProject(e){const t=[];try{await this.performUpdate(e,void 0,(async e=>{await n.F.forEachAsync(this.aliases.transformToKey(e),(async e=>{await this.graphQLService.sdk.deleteProject({projectId:e}),t.push(e)})),this.onDataOutdated.execute(e)}))}finally{t.length>0&&this.delete((0,d.OU)(t))}}async loader(e){if(this.aliases.isAlias(e,c.fZ)){const{projects:e}=await this.graphQLService.sdk.getSharedProjects();(0,a.h5)((()=>{this.delete((0,d.OU)(this.keys.filter((t=>!e.some((e=>e.id===t)))))),this.set((0,d.OU)(e.map((e=>e.id))),e)}))}else await n.F.forEachAsync(this.aliases.transformToKey(e),(async e=>{const{project:t}=await this.graphQLService.sdk.getProject({projectId:e});this.set(e,t)}));return this.data}dataSet(e,t){e=this.getKeyRef(e);const s=this.data.get(e);this.data.set(e,Object.assign(s??{},t))}validateKey(e){return"string"==typeof e}};function isEqualSharedProjectGrantInfo(e,t){return e.subjectId===t.subjectId&&e.subjectType===t.subjectType&&e.objectPermissions.objectId===t.objectPermissions.objectId&&(0,l.x)(e.objectPermissions.permissions,t.objectPermissions.permissions)}g=(0,r.Cg)([(0,i._)(),(0,r.Sn)("design:paramtypes",[p.GraphQLService,o.ProjectInfoResource,u.SessionPermissionsResource])],g)},85028:(e,t,s)=>{s.d(t,{d:()=>isRMNavNode});var r=s(24362);function isRMNavNode(e){return e.startsWith(r.p)}}}]);