@enonic/js-utils
Advanced tools
Comparing version 0.16.3 to 0.16.4
@@ -254,2 +254,25 @@ var __defProp = Object.defineProperty; | ||
}; | ||
this.repo = { | ||
create: ({ | ||
id, | ||
settings | ||
}) => { | ||
const repo = new Repo({ | ||
id, | ||
settings | ||
}); | ||
this._repos[id] = repo; | ||
return repo.get(); | ||
}, | ||
get: (repoId) => { | ||
const repo = this._repos[repoId]; | ||
if (!repo) { | ||
throw new Error(`getRepo: No repo with id:${repoId}`); | ||
} | ||
return repo.get(); | ||
}, | ||
list: () => { | ||
return Object.keys(this._repos).map((repoId) => this.repo.get(repoId)); | ||
} | ||
}; | ||
this.value = { | ||
@@ -269,13 +292,2 @@ geoPoint: (v) => v, | ||
} | ||
createRepo({ | ||
id, | ||
settings | ||
}) { | ||
const repo = new Repo({ | ||
id, | ||
settings | ||
}); | ||
this._repos[id] = repo; | ||
return repo.get(); | ||
} | ||
connect({ | ||
@@ -282,0 +294,0 @@ repoId, |
@@ -254,2 +254,25 @@ var __defProp = Object.defineProperty; | ||
}; | ||
this.repo = { | ||
create: ({ | ||
id, | ||
settings | ||
}) => { | ||
const repo = new Repo({ | ||
id, | ||
settings | ||
}); | ||
this._repos[id] = repo; | ||
return repo.get(); | ||
}, | ||
get: (repoId) => { | ||
const repo = this._repos[repoId]; | ||
if (!repo) { | ||
throw new Error(`getRepo: No repo with id:${repoId}`); | ||
} | ||
return repo.get(); | ||
}, | ||
list: () => { | ||
return Object.keys(this._repos).map((repoId) => this.repo.get(repoId)); | ||
} | ||
}; | ||
this.value = { | ||
@@ -269,13 +292,2 @@ geoPoint: (v) => v, | ||
} | ||
createRepo({ | ||
id, | ||
settings | ||
}) { | ||
const repo = new Repo({ | ||
id, | ||
settings | ||
}); | ||
this._repos[id] = repo; | ||
return repo.get(); | ||
} | ||
connect({ | ||
@@ -282,0 +294,0 @@ repoId, |
@@ -57,3 +57,3 @@ { | ||
}, | ||
"version": "0.16.3" | ||
"version": "0.16.4" | ||
} |
@@ -11,2 +11,3 @@ import type { | ||
CreateRepoParams, | ||
RepoLib, | ||
RepositoryConfig | ||
@@ -36,2 +37,28 @@ } from './repo.d'; | ||
}; | ||
readonly repo :RepoLib = { | ||
create: ({ | ||
id, | ||
//rootChildOrder, | ||
//rootPermissions, | ||
settings | ||
} :CreateRepoParams) :RepositoryConfig => { | ||
const repo = new Repo({ | ||
id, | ||
//rootPermissions, | ||
settings | ||
}); | ||
this._repos[id] = repo; | ||
return repo.get(); | ||
}, | ||
get: (repoId :string) :RepositoryConfig => { | ||
const repo = this._repos[repoId]; | ||
if (!repo) { | ||
throw new Error(`getRepo: No repo with id:${repoId}`); | ||
} | ||
return repo.get(); | ||
}, | ||
list: () :RepositoryConfig[] => { | ||
return Object.keys(this._repos).map(repoId => this.repo.get(repoId)); | ||
} | ||
} | ||
readonly value :ValueLib = { | ||
@@ -60,17 +87,2 @@ geoPoint: (v) => v, | ||
createRepo({ | ||
id, | ||
//rootChildOrder, | ||
//rootPermissions, | ||
settings | ||
} :CreateRepoParams) :RepositoryConfig { | ||
const repo = new Repo({ | ||
id, | ||
//rootPermissions, | ||
settings | ||
}); | ||
this._repos[id] = repo; | ||
return repo.get(); | ||
} | ||
connect({ | ||
@@ -77,0 +89,0 @@ repoId, |
@@ -110,1 +110,7 @@ import type {PermissionsParams} from './auth' | ||
} | ||
export interface RepoLib { | ||
create(param :CreateRepoParams) :RepositoryConfig | ||
get(repoId :string) :RepositoryConfig | ||
list() :RepositoryConfig[] | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1039967
27509