skapi-js 1.0.22 → 1.0.23

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.
@@ -42,6 +42,15 @@ export default class Skapi {
42
42
  message: any;
43
43
  sender?: string;
44
44
  }) => Promise<WebSocket>): any;
45
+ consumeTicket(params: {
46
+ ticket_id: string;
47
+ }): Promise<string>;
48
+ releaseTicket(params: {
49
+ ticket_id: string;
50
+ }): Promise<string>;
51
+ getTicketKey(params: {
52
+ ticket_id: string;
53
+ }): Promise<string>;
45
54
  closeRealtime(): Promise<void>;
46
55
  getRealtimeUsers(params: {
47
56
  group: string;
package/js/main/skapi.js CHANGED
@@ -10,7 +10,7 @@ import { getRecords, postRecord, deleteRecords, getTables, getIndexes, getTags,
10
10
  import { connectRealtime, joinRealtime, postRealtime, closeRealtime, getRealtimeUsers, getRealtimeGroups } from '../methods/realtime';
11
11
  import { request, secureRequest, mock, getFormResponse, formHandler, getConnection } from '../methods/request';
12
12
  import { subscribe, unsubscribe, blockSubscriber, unblockSubscriber, getSubscriptions, subscribeNewsletter, getNewsletters, unsubscribeNewsletter, getNewsletterSubscription } from '../methods/subscription';
13
- import { checkAdmin, getProfile, logout, recoverAccount, resendSignupConfirmation, authentication, login, signup, disableAccount, resetPassword, verifyEmail, verifyPhoneNumber, forgotPassword, changePassword, updateProfile, getUsers, setUserPool, userPool, lastVerifiedEmail, requestUsernameChange } from '../methods/user';
13
+ import { checkAdmin, getProfile, logout, recoverAccount, resendSignupConfirmation, authentication, login, signup, disableAccount, resetPassword, verifyEmail, verifyPhoneNumber, forgotPassword, changePassword, updateProfile, getUsers, setUserPool, userPool, lastVerifiedEmail, requestUsernameChange, consumeTicket, releaseTicket, getTicketKey } from '../methods/user';
14
14
  export default class Skapi {
15
15
  get user() {
16
16
  if (this.__user && Object.keys(this.__user).length) {
@@ -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.22';
26
+ this.version = '1.0.23';
27
27
  this.session = null;
28
28
  this.connection = null;
29
29
  this.host = 'skapi';
@@ -196,6 +196,15 @@ export default class Skapi {
196
196
  connectRealtime(cb) {
197
197
  return connectRealtime.bind(this)(cb);
198
198
  }
199
+ consumeTicket(params) {
200
+ return consumeTicket.bind(this)(params);
201
+ }
202
+ releaseTicket(params) {
203
+ return releaseTicket.bind(this)(params);
204
+ }
205
+ getTicketKey(params) {
206
+ return getTicketKey.bind(this)(params);
207
+ }
199
208
  closeRealtime() {
200
209
  return closeRealtime.bind(this)();
201
210
  }
@@ -63,6 +63,7 @@ export async function request(url, data = null, options) {
63
63
  case 'service':
64
64
  case 'grant-access':
65
65
  case 'last-verified-email':
66
+ case 'ticket':
66
67
  case 'get-newsletter-subscription':
67
68
  case 'request-username-change':
68
69
  return {
@@ -5,6 +5,15 @@ export declare function setUserPool(params: {
5
5
  UserPoolId: string;
6
6
  ClientId: string;
7
7
  }): void;
8
+ export declare function consumeTicket(params: {
9
+ ticket_id: string;
10
+ }): Promise<string>;
11
+ export declare function releaseTicket(params: {
12
+ ticket_id: string;
13
+ }): Promise<string>;
14
+ export declare function getTicketKey(params: {
15
+ ticket_id: string;
16
+ }): Promise<string>;
8
17
  export declare function authentication(): {
9
18
  getSession: (option?: {
10
19
  refreshToken?: boolean;
@@ -8,6 +8,24 @@ export let userPool = null;
8
8
  export function setUserPool(params) {
9
9
  userPool = new CognitoUserPool(params);
10
10
  }
11
+ export function consumeTicket(params) {
12
+ if (!params.ticket_id) {
13
+ throw new SkapiError('Ticket ID is required.', { code: 'INVALID_PARAMETER' });
14
+ }
15
+ return request.bind(this)('ticket', { ticket_id: params, exec: 'consume' }, { auth: true });
16
+ }
17
+ export function releaseTicket(params) {
18
+ if (!params.ticket_id) {
19
+ throw new SkapiError('Ticket ID is required.', { code: 'INVALID_PARAMETER' });
20
+ }
21
+ return request.bind(this)('ticket', { ticket_id: params, exec: 'release' }, { auth: true });
22
+ }
23
+ export function getTicketKey(params) {
24
+ if (!params.ticket_id) {
25
+ throw new SkapiError('Ticket ID is required.', { code: 'INVALID_PARAMETER' });
26
+ }
27
+ return request.bind(this)('ticket', { ticket_id: params, exec: 'request' }, { auth: true });
28
+ }
11
29
  export function authentication() {
12
30
  if (!userPool)
13
31
  throw new SkapiError('User pool is missing', { code: 'INVALID_REQUEST' });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "skapi-js",
3
- "version": "1.0.22",
4
- "description": "Skapi: Serverless Backend API.",
3
+ "version": "1.0.23",
4
+ "description": "Skapi: JS Backend API with no deployment required.",
5
5
  "main": "./dist/skapi.module.js",
6
6
  "types": "./js/Main.d.ts",
7
7
  "files": [
@@ -33,7 +33,6 @@
33
33
  "backend",
34
34
  "skapi",
35
35
  "api",
36
- "jamstack",
37
36
  "serverless"
38
37
  ]
39
38
  }