@wix/sdk 1.21.1 → 1.21.2
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthenticationStrategy, EventDefinition, EventHandler, EventIdentity } from '@wix/sdk-types';
|
|
1
|
+
import { AuthenticationStrategy, EventDefinition, EventHandler, EventIdentity, AccountInfo } from '@wix/sdk-types';
|
|
2
2
|
import { Emitter } from './nanoevents.js';
|
|
3
3
|
export declare const isEventHandlerModule: (val: any) => val is EventDefinition<unknown, string>;
|
|
4
4
|
export declare function buildEventDefinition<T extends EventDefinition<any, string>>(eventDefinition: T, registerHandler: (eventDefinition: T, handler: EventHandler<T>) => void): (handler: EventHandler<T>) => void;
|
|
@@ -11,6 +11,7 @@ type ResolvePossibleEvents<T extends EventDefinition<any>[]> = {
|
|
|
11
11
|
export type ProcessedEvent<T extends EventDefinition<any>[] = []> = {
|
|
12
12
|
instanceId: string;
|
|
13
13
|
identity?: EventIdentity;
|
|
14
|
+
accountInfo?: AccountInfo;
|
|
14
15
|
} & (T['length'] extends 0 ? {
|
|
15
16
|
eventType: string;
|
|
16
17
|
payload: unknown;
|
|
@@ -82,7 +82,7 @@ export function eventHandlersModules(getAuthStrategy) {
|
|
|
82
82
|
async process(jwt, opts = {
|
|
83
83
|
expectedEvents: [],
|
|
84
84
|
}) {
|
|
85
|
-
const { eventType, identity, instanceId, payload } = await this.parseJWT(jwt);
|
|
85
|
+
const { eventType, identity, instanceId, payload, accountInfo } = await this.parseJWT(jwt);
|
|
86
86
|
const allExpectedEvents = [
|
|
87
87
|
...opts.expectedEvents,
|
|
88
88
|
...Array.from(eventHandlers.keys()).map((type) => ({ type })),
|
|
@@ -97,12 +97,14 @@ export function eventHandlersModules(getAuthStrategy) {
|
|
|
97
97
|
await Promise.all(handlers.map(({ eventDefinition, handler }) => runHandler(eventDefinition, handler, payload, {
|
|
98
98
|
instanceId,
|
|
99
99
|
identity,
|
|
100
|
+
accountInfo,
|
|
100
101
|
})));
|
|
101
102
|
return {
|
|
102
103
|
instanceId,
|
|
103
104
|
eventType,
|
|
104
105
|
payload,
|
|
105
106
|
identity,
|
|
107
|
+
accountInfo,
|
|
106
108
|
};
|
|
107
109
|
},
|
|
108
110
|
async processRequest(request, opts) {
|
|
@@ -123,6 +125,7 @@ export function eventHandlersModules(getAuthStrategy) {
|
|
|
123
125
|
}
|
|
124
126
|
const parsedDecoded = JSON.parse(decoded.data);
|
|
125
127
|
const eventType = parsedDecoded.eventType;
|
|
128
|
+
const accountInfo = parsedDecoded.accountInfo;
|
|
126
129
|
const instanceId = parsedDecoded.instanceId;
|
|
127
130
|
const identity = parsedDecoded.identity
|
|
128
131
|
? JSON.parse(parsedDecoded.identity)
|
|
@@ -133,6 +136,7 @@ export function eventHandlersModules(getAuthStrategy) {
|
|
|
133
136
|
eventType,
|
|
134
137
|
payload,
|
|
135
138
|
identity,
|
|
139
|
+
accountInfo,
|
|
136
140
|
};
|
|
137
141
|
},
|
|
138
142
|
async parseRequest(request) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AuthenticationStrategy, EventDefinition, EventHandler, EventIdentity } from '@wix/sdk-types';
|
|
1
|
+
import { AuthenticationStrategy, EventDefinition, EventHandler, EventIdentity, AccountInfo } from '@wix/sdk-types';
|
|
2
2
|
import { Emitter } from './nanoevents.js';
|
|
3
3
|
export declare const isEventHandlerModule: (val: any) => val is EventDefinition<unknown, string>;
|
|
4
4
|
export declare function buildEventDefinition<T extends EventDefinition<any, string>>(eventDefinition: T, registerHandler: (eventDefinition: T, handler: EventHandler<T>) => void): (handler: EventHandler<T>) => void;
|
|
@@ -11,6 +11,7 @@ type ResolvePossibleEvents<T extends EventDefinition<any>[]> = {
|
|
|
11
11
|
export type ProcessedEvent<T extends EventDefinition<any>[] = []> = {
|
|
12
12
|
instanceId: string;
|
|
13
13
|
identity?: EventIdentity;
|
|
14
|
+
accountInfo?: AccountInfo;
|
|
14
15
|
} & (T['length'] extends 0 ? {
|
|
15
16
|
eventType: string;
|
|
16
17
|
payload: unknown;
|
|
@@ -88,7 +88,7 @@ function eventHandlersModules(getAuthStrategy) {
|
|
|
88
88
|
async process(jwt, opts = {
|
|
89
89
|
expectedEvents: [],
|
|
90
90
|
}) {
|
|
91
|
-
const { eventType, identity, instanceId, payload } = await this.parseJWT(jwt);
|
|
91
|
+
const { eventType, identity, instanceId, payload, accountInfo } = await this.parseJWT(jwt);
|
|
92
92
|
const allExpectedEvents = [
|
|
93
93
|
...opts.expectedEvents,
|
|
94
94
|
...Array.from(eventHandlers.keys()).map((type) => ({ type })),
|
|
@@ -103,12 +103,14 @@ function eventHandlersModules(getAuthStrategy) {
|
|
|
103
103
|
await Promise.all(handlers.map(({ eventDefinition, handler }) => runHandler(eventDefinition, handler, payload, {
|
|
104
104
|
instanceId,
|
|
105
105
|
identity,
|
|
106
|
+
accountInfo,
|
|
106
107
|
})));
|
|
107
108
|
return {
|
|
108
109
|
instanceId,
|
|
109
110
|
eventType,
|
|
110
111
|
payload,
|
|
111
112
|
identity,
|
|
113
|
+
accountInfo,
|
|
112
114
|
};
|
|
113
115
|
},
|
|
114
116
|
async processRequest(request, opts) {
|
|
@@ -129,6 +131,7 @@ function eventHandlersModules(getAuthStrategy) {
|
|
|
129
131
|
}
|
|
130
132
|
const parsedDecoded = JSON.parse(decoded.data);
|
|
131
133
|
const eventType = parsedDecoded.eventType;
|
|
134
|
+
const accountInfo = parsedDecoded.accountInfo;
|
|
132
135
|
const instanceId = parsedDecoded.instanceId;
|
|
133
136
|
const identity = parsedDecoded.identity
|
|
134
137
|
? JSON.parse(parsedDecoded.identity)
|
|
@@ -139,6 +142,7 @@ function eventHandlersModules(getAuthStrategy) {
|
|
|
139
142
|
eventType,
|
|
140
143
|
payload,
|
|
141
144
|
identity,
|
|
145
|
+
accountInfo,
|
|
142
146
|
};
|
|
143
147
|
},
|
|
144
148
|
async parseRequest(request) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/sdk",
|
|
3
|
-
"version": "1.21.
|
|
3
|
+
"version": "1.21.2",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Ronny Ringel",
|
|
6
6
|
"email": "ronnyr@wix.com"
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"@wix/image-kit": "^1.114.0",
|
|
11
11
|
"@wix/redirects": "^1.0.70",
|
|
12
12
|
"@wix/sdk-context": "0.0.1",
|
|
13
|
-
"@wix/sdk-runtime": "1.0.
|
|
14
|
-
"@wix/sdk-types": "1.17.
|
|
13
|
+
"@wix/sdk-runtime": "1.0.4",
|
|
14
|
+
"@wix/sdk-types": "1.17.2",
|
|
15
15
|
"jose": "^5.10.0",
|
|
16
16
|
"type-fest": "^4.41.0"
|
|
17
17
|
},
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"@wix/events": "^1.0.382",
|
|
24
24
|
"@wix/metro": "^1.0.93",
|
|
25
25
|
"@wix/metro-runtime": "^1.1891.0",
|
|
26
|
-
"@wix/sdk-runtime": "1.0.
|
|
26
|
+
"@wix/sdk-runtime": "1.0.4",
|
|
27
27
|
"eslint": "^8.57.1",
|
|
28
28
|
"eslint-config-sdk": "1.0.0",
|
|
29
29
|
"graphql": "^16.8.0",
|
|
@@ -126,5 +126,5 @@
|
|
|
126
126
|
"yoshiFlowLibrary": {
|
|
127
127
|
"buildEsmWithBabel": true
|
|
128
128
|
},
|
|
129
|
-
"falconPackageHash": "
|
|
129
|
+
"falconPackageHash": "6c3be1dc51c31ae28b5b8cf467d5d129452c7a7722dfce6898b929f2"
|
|
130
130
|
}
|