skapi-js 1.0.27 → 1.0.29

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/Types.d.ts CHANGED
@@ -85,6 +85,7 @@ export type Connection = {
85
85
  region: string;
86
86
  timestamp: number;
87
87
  ip: string;
88
+ group: number;
88
89
  };
89
90
  export type FormSubmitCallback = {
90
91
  response?(response: any): any;
@@ -147,6 +148,7 @@ export type PublicUser = {
147
148
  birthdate?: string;
148
149
  misc?: string;
149
150
  subscribers?: number;
151
+ records?: number;
150
152
  timestamp: number;
151
153
  service: string;
152
154
  owner: string;
package/js/main/skapi.js CHANGED
@@ -23,7 +23,7 @@ export default class Skapi {
23
23
  set user(value) {
24
24
  }
25
25
  constructor(service, owner, options, __etc) {
26
- this.version = '1.0.27';
26
+ this.version = '1.0.29';
27
27
  this.session = null;
28
28
  this.connection = null;
29
29
  this.host = 'skapi';
@@ -183,6 +183,9 @@ export default class Skapi {
183
183
  await this.__authConnection;
184
184
  let skapi = `%c\r\n $$\\ $$\\ \r\n $$ | \\__|\r\n $$$$$$$\\ $$ | $$\\ $$$$$$\\ $$$$$$\\ $$\\ \r\n$$ _____|$$ | $$ |\\____$$\\ $$ __$$\\ $$ |\r\n\\$$$$$$\\ $$$$$$ \/ $$$$$$$ |$$ \/ $$ |$$ |\r\n \\____$$\\ $$ _$$< $$ __$$ |$$ | $$ |$$ |\r\n$$$$$$$ |$$ | \\$$\\\\$$$$$$$ |$$$$$$$ |$$ |\r\n\\_______\/ \\__| \\__|\\_______|$$ ____\/ \\__|\r\n $$ | \r\n $$ | \r\n \\__| \r\n`;
185
185
  console.log(`Built with:\n${skapi}Version: ${this.version}\n\nDocumentation: https://docs.skapi.com`, `font-family: monospace; color:blue;`);
186
+ if (this.connection.group === 1) {
187
+ console.log(`%cSKAPI: THE SERVICE IS IN TRIAL MODE. ALL THE USERS AND DATA WILL BE INITIALIZED EVERY 7 DAYS.`, `font-family: monospace; color:red;`);
188
+ }
186
189
  return this.connection;
187
190
  })();
188
191
  }
@@ -25,9 +25,13 @@ export function connectRealtime(cb, delay = 0) {
25
25
  throw new SkapiError(`Callback must be a function.`, { code: 'INVALID_REQUEST' });
26
26
  }
27
27
  if (reconnectAttempts || !(this.__socket instanceof Promise)) {
28
- this.__socket = new Promise(resolve => {
28
+ this.__socket = new Promise(async (resolve) => {
29
29
  setTimeout(async () => {
30
30
  await this.__connection;
31
+ let user = await this.getProfile();
32
+ if (!user) {
33
+ throw new SkapiError(`No access.`, { code: 'INVALID_REQUEST' });
34
+ }
31
35
  let socket = await prepareWebsocket.bind(this)();
32
36
  socket.onopen = () => {
33
37
  reconnectAttempts = 0;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "skapi-js",
3
- "version": "1.0.27",
4
- "description": "Skapi: JS Backend API with no deployment required.",
3
+ "version": "1.0.29",
4
+ "description": "Skapi: Backend API Library for HTML frontend.",
5
5
  "main": "./dist/skapi.module.js",
6
6
  "types": "./js/Main.d.ts",
7
7
  "files": [
@@ -33,6 +33,8 @@
33
33
  "backend",
34
34
  "skapi",
35
35
  "api",
36
- "serverless"
36
+ "serverless",
37
+ "frontend",
38
+ "html"
37
39
  ]
38
40
  }