New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@wix/sdk

Package Overview
Dependencies
Maintainers
26
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wix/sdk - npm Package Compare versions

Comparing version

to
1.9.4

build/service-plugin-modules.d.ts

12

build/wixClient.d.ts

@@ -1,2 +0,2 @@

import { AuthenticationStrategy, BoundAuthenticationStrategy, BuildEventDefinition, BuildRESTFunction, EventDefinition, EventIdentity, Host, HostModule, HostModuleAPI, RESTFunctionDescriptor, SPIDefinition } from '@wix/sdk-types';
import { AuthenticationStrategy, BoundAuthenticationStrategy, BuildEventDefinition, BuildRESTFunction, EventDefinition, EventIdentity, Host, HostModule, HostModuleAPI, RESTFunctionDescriptor, ServicePluginDefinition, BuildServicePluginDefinition } from '@wix/sdk-types';
import { ConditionalExcept } from 'type-fest/source/conditional-except.js';

@@ -16,3 +16,3 @@ import { EmptyObject } from 'type-fest/source/empty-object.js';

done: T;
recurse: T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition ? BuildEventDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
recurse: T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [-1, 0, 1, 2, 3, 4, 5][Depth]> : never;

@@ -52,3 +52,3 @@ }, EmptyObject>;

};
export type WixClient<H extends Host<any> | undefined = undefined, Z extends AuthenticationStrategy<H> = AuthenticationStrategy<H>, T extends Descriptors = Descriptors> = {
export type WixClient<H extends Host<any> | undefined = undefined, Z extends AuthenticationStrategy<H> = AuthenticationStrategy<H>, T extends Descriptors = {}> = {
setHeaders(headers: Headers): void;

@@ -65,2 +65,3 @@ auth: Omit<Z, 'getAuthHeaders'> & BoundAuthenticationStrategy;

webhooks: {
getRegisteredEvents(): string[];
process<ExpectedEvents extends EventDefinition<any>[] = []>(jwt: string, opts?: {

@@ -82,7 +83,2 @@ expectedEvents: ExpectedEvents;

};
spi: <S extends SPIDefinition<any, any>>() => {
process(jwt: string): Promise<S['__input']>;
processRequest(request: Request): Promise<S['__input']>;
result(result: S['__result']): S['__result'];
};
} & BuildDescriptors<T, H>;

@@ -89,0 +85,0 @@ type ResolvePossibleEvents<T extends EventDefinition<any>[]> = {

@@ -9,2 +9,3 @@ import { EventDefinition, } from '@wix/sdk-types';

import { buildEventDefinition, isEventHandlerModule, runHandler, } from './event-handlers-modules.js';
import { buildServicePluginDefinition, isServicePluginModule, } from './service-plugin-modules.js';
export function createClient(config) {

@@ -43,2 +44,5 @@ const _headers = config.headers || { Authorization: '' };

}
else if (isServicePluginModule(modules)) {
return buildServicePluginDefinition(modules, authStrategy.decodeJWT);
}
else if (isHostModule(modules) && config.host) {

@@ -124,2 +128,3 @@ return buildHostModule(modules, config.host);

webhooks: {
getRegisteredEvents: () => Array.from(eventHandlers.keys()),
process: async (jwt, opts = {

@@ -173,24 +178,3 @@ expectedEvents: [],

},
spi() {
return {
async process(jwt) {
if (!authStrategy.decodeJWT) {
throw new Error('decodeJWT is not supported by the authentication strategy');
}
const { decoded, valid } = await authStrategy.decodeJWT(jwt, true);
if (!valid) {
throw new Error('JWT is not valid');
}
return decoded.data;
},
async processRequest(request) {
const body = await request.text();
return this.process(body);
},
result(result) {
return result;
},
};
},
};
}

@@ -1,2 +0,2 @@

import { AuthenticationStrategy, BoundAuthenticationStrategy, BuildEventDefinition, BuildRESTFunction, EventDefinition, EventIdentity, Host, HostModule, HostModuleAPI, RESTFunctionDescriptor, SPIDefinition } from '@wix/sdk-types';
import { AuthenticationStrategy, BoundAuthenticationStrategy, BuildEventDefinition, BuildRESTFunction, EventDefinition, EventIdentity, Host, HostModule, HostModuleAPI, RESTFunctionDescriptor, ServicePluginDefinition, BuildServicePluginDefinition } from '@wix/sdk-types';
import { ConditionalExcept } from 'type-fest/source/conditional-except.js';

@@ -16,3 +16,3 @@ import { EmptyObject } from 'type-fest/source/empty-object.js';

done: T;
recurse: T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition ? BuildEventDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
recurse: T extends AmbassadorFunctionDescriptor ? BuildAmbassadorFunction<T> : T extends RESTFunctionDescriptor ? BuildRESTFunction<T> : T extends EventDefinition ? BuildEventDefinition<T> : T extends ServicePluginDefinition<any> ? BuildServicePluginDefinition<T> : T extends HostModule<any, any> ? HostModuleAPI<T> : ConditionalExcept<{
[Key in keyof T]: T[Key] extends Descriptors ? BuildDescriptors<T[Key], H, [-1, 0, 1, 2, 3, 4, 5][Depth]> : never;

@@ -52,3 +52,3 @@ }, EmptyObject>;

};
export type WixClient<H extends Host<any> | undefined = undefined, Z extends AuthenticationStrategy<H> = AuthenticationStrategy<H>, T extends Descriptors = Descriptors> = {
export type WixClient<H extends Host<any> | undefined = undefined, Z extends AuthenticationStrategy<H> = AuthenticationStrategy<H>, T extends Descriptors = {}> = {
setHeaders(headers: Headers): void;

@@ -65,2 +65,3 @@ auth: Omit<Z, 'getAuthHeaders'> & BoundAuthenticationStrategy;

webhooks: {
getRegisteredEvents(): string[];
process<ExpectedEvents extends EventDefinition<any>[] = []>(jwt: string, opts?: {

@@ -82,7 +83,2 @@ expectedEvents: ExpectedEvents;

};
spi: <S extends SPIDefinition<any, any>>() => {
process(jwt: string): Promise<S['__input']>;
processRequest(request: Request): Promise<S['__input']>;
result(result: S['__result']): S['__result'];
};
} & BuildDescriptors<T, H>;

@@ -89,0 +85,0 @@ type ResolvePossibleEvents<T extends EventDefinition<any>[]> = {

@@ -12,2 +12,3 @@ "use strict";

const event_handlers_modules_js_1 = require("./event-handlers-modules.js");
const service_plugin_modules_js_1 = require("./service-plugin-modules.js");
function createClient(config) {

@@ -46,2 +47,5 @@ const _headers = config.headers || { Authorization: '' };

}
else if ((0, service_plugin_modules_js_1.isServicePluginModule)(modules)) {
return (0, service_plugin_modules_js_1.buildServicePluginDefinition)(modules, authStrategy.decodeJWT);
}
else if ((0, host_modules_js_1.isHostModule)(modules) && config.host) {

@@ -127,2 +131,3 @@ return (0, host_modules_js_1.buildHostModule)(modules, config.host);

webhooks: {
getRegisteredEvents: () => Array.from(eventHandlers.keys()),
process: async (jwt, opts = {

@@ -176,25 +181,4 @@ expectedEvents: [],

},
spi() {
return {
async process(jwt) {
if (!authStrategy.decodeJWT) {
throw new Error('decodeJWT is not supported by the authentication strategy');
}
const { decoded, valid } = await authStrategy.decodeJWT(jwt, true);
if (!valid) {
throw new Error('JWT is not valid');
}
return decoded.data;
},
async processRequest(request) {
const body = await request.text();
return this.process(body);
},
result(result) {
return result;
},
};
},
};
}
exports.createClient = createClient;
{
"name": "@wix/sdk",
"version": "1.9.3",
"version": "1.9.4",
"license": "UNLICENSED",

@@ -70,3 +70,3 @@ "author": {

"@wix/redirects": "^1.0.41",
"@wix/sdk-types": "^1.6.3",
"@wix/sdk-types": "^1.7.0",
"crypto-js": "^4.2.0",

@@ -124,3 +124,3 @@ "jose": "^5.2.1",

},
"falconPackageHash": "b793f7d8e56d121118c1a7a6f27eb8df6d14f23cdc6399d6352dd96f"
"falconPackageHash": "4b5ab480b70debacfd197e4f868613a615cd3854cb5b8b0aff383862"
}