skapi-js 1.0.10 → 1.0.12

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/js/main/skapi.js CHANGED
@@ -22,7 +22,7 @@ export default class Skapi {
22
22
  set user(value) {
23
23
  }
24
24
  constructor(service, owner, options) {
25
- this.version = '1.0.10';
25
+ this.version = '1.0.12';
26
26
  this.session = null;
27
27
  this.connection = null;
28
28
  this.host = 'skapi';
@@ -364,8 +364,11 @@ export async function signup(form, option) {
364
364
  access_group: 'number',
365
365
  misc: 'string'
366
366
  }, is_admin ? ['email'] : ['email', 'password']);
367
- let admin_creating_account = is_admin;
368
- if (!is_admin) {
367
+ let admin_creating_account = is_admin && params.service && this.service !== params.service;
368
+ if (admin_creating_account) {
369
+ params.owner = this.__user.user_id;
370
+ }
371
+ else {
369
372
  if (params.access_group) {
370
373
  throw new SkapiError('Only admins can set "access_group" parameter.', { code: 'INVALID_PARAMETER' });
371
374
  }
@@ -404,7 +407,7 @@ export async function signup(form, option) {
404
407
  });
405
408
  let logUser = option?.login || false;
406
409
  let signup_confirmation = option?.signup_confirmation || false;
407
- if (admin_creating_account && signup_confirmation) {
410
+ if (admin_creating_account && signup_confirmation && params?.password) {
408
411
  throw new SkapiError('Admins cannot create an account with "option.signup_confirmation" option.', { code: 'INVALID_PARAMETER' });
409
412
  }
410
413
  if (params.email_public && !signup_confirmation) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skapi-js",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "Javascript library for Skapi: Complete JAM Stack, front-end driven serverless backend API service.",
5
5
  "main": "./dist/skapi.module.js",
6
6
  "types": "./js/Main.d.ts",