adminforth 1.3.53 → 1.3.54-next.0
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.
- package/dist/index.js +9 -0
- package/index.ts +10 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -137,6 +137,15 @@ class AdminForth {
|
|
|
137
137
|
}
|
|
138
138
|
getUserByPk(pk) {
|
|
139
139
|
return __awaiter(this, void 0, void 0, function* () {
|
|
140
|
+
// if database discovery is not done, throw
|
|
141
|
+
if (this.statuses.dbDiscover !== 'done') {
|
|
142
|
+
if (this.statuses.dbDiscover === 'running') {
|
|
143
|
+
throw new Error('Database discovery is running. You can\'t use data API while database discovery is not finished.\n' +
|
|
144
|
+
'Consider moving your code to a place where it will be executed after database discovery is already done (after await admin.discoverDatabases())');
|
|
145
|
+
}
|
|
146
|
+
throw new Error('Database discovery is not yet started. You can\'t use data API before database discovery is done. \n' +
|
|
147
|
+
'Call admin.discoverDatabases() first and await it before using data API');
|
|
148
|
+
}
|
|
140
149
|
const resource = this.config.resources.find((res) => res.resourceId === this.config.auth.usersResourceId);
|
|
141
150
|
if (!resource) {
|
|
142
151
|
const similar = suggestIfTypo(this.config.resources.map((res) => res.resourceId), this.config.auth.usersResourceId);
|
package/index.ts
CHANGED
|
@@ -197,6 +197,16 @@ class AdminForth implements IAdminForth {
|
|
|
197
197
|
}
|
|
198
198
|
|
|
199
199
|
async getUserByPk(pk: string) {
|
|
200
|
+
// if database discovery is not done, throw
|
|
201
|
+
if (this.statuses.dbDiscover !== 'done') {
|
|
202
|
+
if (this.statuses.dbDiscover === 'running') {
|
|
203
|
+
throw new Error('Database discovery is running. You can\'t use data API while database discovery is not finished.\n'+
|
|
204
|
+
'Consider moving your code to a place where it will be executed after database discovery is already done (after await admin.discoverDatabases())');
|
|
205
|
+
}
|
|
206
|
+
throw new Error('Database discovery is not yet started. You can\'t use data API before database discovery is done. \n'+
|
|
207
|
+
'Call admin.discoverDatabases() first and await it before using data API');
|
|
208
|
+
}
|
|
209
|
+
|
|
200
210
|
const resource = this.config.resources.find((res) => res.resourceId === this.config.auth.usersResourceId);
|
|
201
211
|
if (!resource) {
|
|
202
212
|
const similar = suggestIfTypo(this.config.resources.map((res) => res.resourceId), this.config.auth.usersResourceId);
|