@wix/sdk 1.12.9 → 1.12.10

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,5 +1,5 @@
1
- import { BuildRESTFunction, RESTFunctionDescriptor } from '@wix/sdk-types';
2
- export declare function elevate<T extends RESTFunctionDescriptor | BuildRESTFunction<any>>(restModule: T): T;
1
+ import { RESTFunctionDescriptor } from '@wix/sdk-types';
2
+ export declare function elevate<T extends RESTFunctionDescriptor>(restModule: T): T;
3
3
  export declare const fetchWithAuth: typeof fetch & ((restModuleOpts: import("@wix/sdk-types").HttpClient) => typeof fetch);
4
4
  export { graphql } from './graphql.js';
5
5
  export { setGlobalWixContext } from './wix-context.js';
@@ -1,5 +1,5 @@
1
1
  import { AuthenticationStrategy, EventDefinition, EventHandler, EventIdentity } from '@wix/sdk-types';
2
- import { Emitter } from 'nanoevents';
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;
5
5
  type ResolvePossibleEvents<T extends EventDefinition<any>[]> = {
@@ -1,5 +1,5 @@
1
1
  import { EventDefinition, } from '@wix/sdk-types';
2
- import { createNanoEvents } from 'nanoevents';
2
+ import { createNanoEvents } from './nanoevents.js';
3
3
  export const isEventHandlerModule = (val) => val.__type === 'event-definition';
4
4
  export function buildEventDefinition(eventDefinition, registerHandler) {
5
5
  return (handler) => {
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Create event emitter.
3
+ *
4
+ * ```js
5
+ * import { createNanoEvents } from 'nanoevents'
6
+ *
7
+ * class Ticker {
8
+ * constructor() {
9
+ * this.emitter = createNanoEvents()
10
+ * }
11
+ * on(...args) {
12
+ * return this.emitter.on(...args)
13
+ * }
14
+ * tick() {
15
+ * this.emitter.emit('tick')
16
+ * }
17
+ * }
18
+ * ```
19
+ * @returns Event emitter.
20
+ */
21
+ export declare function createNanoEvents<Events extends EventsMap = DefaultEvents>(): Emitter<Events>;
22
+ interface EventsMap {
23
+ [event: string]: any;
24
+ }
25
+ interface DefaultEvents extends EventsMap {
26
+ [event: string]: (...args: any) => void;
27
+ }
28
+ export type Unsubscribe = () => void;
29
+ export interface Emitter<Events extends EventsMap = DefaultEvents> {
30
+ /**
31
+ * Calls each of the listeners registered for a given event.
32
+ *
33
+ * ```js
34
+ * ee.emit('tick', tickType, tickDuration)
35
+ * ```
36
+ * @param event The event name.
37
+ * @param args The arguments for listeners.
38
+ */
39
+ emit<K extends keyof Events>(this: this, event: K, ...args: Parameters<Events[K]>): void;
40
+ /**
41
+ * Event names in keys and arrays with listeners in values.
42
+ *
43
+ * ```js
44
+ * emitter1.events = emitter2.events
45
+ * emitter2.events = { }
46
+ * ```
47
+ */
48
+ events: Partial<{
49
+ [E in keyof Events]: Events[E][];
50
+ }>;
51
+ /**
52
+ * Add a listener for a given event.
53
+ *
54
+ * ```js
55
+ * const unbind = ee.on('tick', (tickType, tickDuration) => {
56
+ * count += 1
57
+ * })
58
+ *
59
+ * disable () {
60
+ * unbind()
61
+ * }
62
+ * ```
63
+ * @param event The event name.
64
+ * @param cb The listener function.
65
+ * @returns Unbind listener from event.
66
+ */
67
+ on<K extends keyof Events>(this: this, event: K, cb: Events[K]): Unsubscribe;
68
+ }
69
+ export {};
@@ -0,0 +1,37 @@
1
+ // Inlined from https://github.com/ai/nanoevents/blob/main/index.js
2
+ /**
3
+ * Create event emitter.
4
+ *
5
+ * ```js
6
+ * import { createNanoEvents } from 'nanoevents'
7
+ *
8
+ * class Ticker {
9
+ * constructor() {
10
+ * this.emitter = createNanoEvents()
11
+ * }
12
+ * on(...args) {
13
+ * return this.emitter.on(...args)
14
+ * }
15
+ * tick() {
16
+ * this.emitter.emit('tick')
17
+ * }
18
+ * }
19
+ * ```
20
+ * @returns Event emitter.
21
+ */
22
+ export function createNanoEvents() {
23
+ return {
24
+ emit(event, ...args) {
25
+ for (let i = 0, callbacks = this.events[event] || [], length = callbacks.length; i < length; i++) {
26
+ callbacks[i](...args);
27
+ }
28
+ },
29
+ events: {},
30
+ on(event, cb) {
31
+ (this.events[event] ||= []).push(cb);
32
+ return () => {
33
+ this.events[event] = this.events[event]?.filter((i) => cb !== i);
34
+ };
35
+ },
36
+ };
37
+ }
@@ -1,5 +1,5 @@
1
1
  import { AuthenticationStrategy, ServicePluginContract, ServicePluginDefinition } from '@wix/sdk-types';
2
- import { Emitter } from 'nanoevents';
2
+ import { Emitter } from './nanoevents.js';
3
3
  export declare const isServicePluginModule: (val: any) => val is ServicePluginDefinition<ServicePluginContract>;
4
4
  export type UnknownServicePluginResponse = unknown;
5
5
  type ServicePluginRequestMetadata = {
@@ -1,4 +1,4 @@
1
- import { createNanoEvents } from 'nanoevents';
1
+ import { createNanoEvents } from './nanoevents.js';
2
2
  export const isServicePluginModule = (val) => val.__type === 'service-plugin-definition';
3
3
  export function servicePluginsModules(authStrategy) {
4
4
  const servicePluginsImplementations = new Map();
@@ -1,5 +1,5 @@
1
- import { BuildRESTFunction, RESTFunctionDescriptor } from '@wix/sdk-types';
2
- export declare function elevate<T extends RESTFunctionDescriptor | BuildRESTFunction<any>>(restModule: T): T;
1
+ import { RESTFunctionDescriptor } from '@wix/sdk-types';
2
+ export declare function elevate<T extends RESTFunctionDescriptor>(restModule: T): T;
3
3
  export declare const fetchWithAuth: typeof fetch & ((restModuleOpts: import("@wix/sdk-types").HttpClient) => typeof fetch);
4
4
  export { graphql } from './graphql.js';
5
5
  export { setGlobalWixContext } from './wix-context.js';
@@ -1,5 +1,5 @@
1
1
  import { AuthenticationStrategy, EventDefinition, EventHandler, EventIdentity } from '@wix/sdk-types';
2
- import { Emitter } from 'nanoevents';
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;
5
5
  type ResolvePossibleEvents<T extends EventDefinition<any>[]> = {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.eventHandlersModules = exports.buildEventDefinition = exports.isEventHandlerModule = void 0;
4
4
  const sdk_types_1 = require("@wix/sdk-types");
5
- const nanoevents_1 = require("nanoevents");
5
+ const nanoevents_js_1 = require("./nanoevents.js");
6
6
  const isEventHandlerModule = (val) => val.__type === 'event-definition';
7
7
  exports.isEventHandlerModule = isEventHandlerModule;
8
8
  function buildEventDefinition(eventDefinition, registerHandler) {
@@ -55,7 +55,7 @@ function runHandler(eventDefinition, handler, payload, baseEventMetadata) {
55
55
  }
56
56
  function eventHandlersModules(authStrategy) {
57
57
  const eventHandlers = new Map();
58
- const webhooksEmitter = (0, nanoevents_1.createNanoEvents)();
58
+ const webhooksEmitter = (0, nanoevents_js_1.createNanoEvents)();
59
59
  const client = {
60
60
  ...webhooksEmitter,
61
61
  getRegisteredEvents: () => eventHandlers,
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Create event emitter.
3
+ *
4
+ * ```js
5
+ * import { createNanoEvents } from 'nanoevents'
6
+ *
7
+ * class Ticker {
8
+ * constructor() {
9
+ * this.emitter = createNanoEvents()
10
+ * }
11
+ * on(...args) {
12
+ * return this.emitter.on(...args)
13
+ * }
14
+ * tick() {
15
+ * this.emitter.emit('tick')
16
+ * }
17
+ * }
18
+ * ```
19
+ * @returns Event emitter.
20
+ */
21
+ export declare function createNanoEvents<Events extends EventsMap = DefaultEvents>(): Emitter<Events>;
22
+ interface EventsMap {
23
+ [event: string]: any;
24
+ }
25
+ interface DefaultEvents extends EventsMap {
26
+ [event: string]: (...args: any) => void;
27
+ }
28
+ export type Unsubscribe = () => void;
29
+ export interface Emitter<Events extends EventsMap = DefaultEvents> {
30
+ /**
31
+ * Calls each of the listeners registered for a given event.
32
+ *
33
+ * ```js
34
+ * ee.emit('tick', tickType, tickDuration)
35
+ * ```
36
+ * @param event The event name.
37
+ * @param args The arguments for listeners.
38
+ */
39
+ emit<K extends keyof Events>(this: this, event: K, ...args: Parameters<Events[K]>): void;
40
+ /**
41
+ * Event names in keys and arrays with listeners in values.
42
+ *
43
+ * ```js
44
+ * emitter1.events = emitter2.events
45
+ * emitter2.events = { }
46
+ * ```
47
+ */
48
+ events: Partial<{
49
+ [E in keyof Events]: Events[E][];
50
+ }>;
51
+ /**
52
+ * Add a listener for a given event.
53
+ *
54
+ * ```js
55
+ * const unbind = ee.on('tick', (tickType, tickDuration) => {
56
+ * count += 1
57
+ * })
58
+ *
59
+ * disable () {
60
+ * unbind()
61
+ * }
62
+ * ```
63
+ * @param event The event name.
64
+ * @param cb The listener function.
65
+ * @returns Unbind listener from event.
66
+ */
67
+ on<K extends keyof Events>(this: this, event: K, cb: Events[K]): Unsubscribe;
68
+ }
69
+ export {};
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ // Inlined from https://github.com/ai/nanoevents/blob/main/index.js
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.createNanoEvents = void 0;
5
+ /**
6
+ * Create event emitter.
7
+ *
8
+ * ```js
9
+ * import { createNanoEvents } from 'nanoevents'
10
+ *
11
+ * class Ticker {
12
+ * constructor() {
13
+ * this.emitter = createNanoEvents()
14
+ * }
15
+ * on(...args) {
16
+ * return this.emitter.on(...args)
17
+ * }
18
+ * tick() {
19
+ * this.emitter.emit('tick')
20
+ * }
21
+ * }
22
+ * ```
23
+ * @returns Event emitter.
24
+ */
25
+ function createNanoEvents() {
26
+ return {
27
+ emit(event, ...args) {
28
+ for (let i = 0, callbacks = this.events[event] || [], length = callbacks.length; i < length; i++) {
29
+ callbacks[i](...args);
30
+ }
31
+ },
32
+ events: {},
33
+ on(event, cb) {
34
+ (this.events[event] ||= []).push(cb);
35
+ return () => {
36
+ this.events[event] = this.events[event]?.filter((i) => cb !== i);
37
+ };
38
+ },
39
+ };
40
+ }
41
+ exports.createNanoEvents = createNanoEvents;
@@ -1,5 +1,5 @@
1
1
  import { AuthenticationStrategy, ServicePluginContract, ServicePluginDefinition } from '@wix/sdk-types';
2
- import { Emitter } from 'nanoevents';
2
+ import { Emitter } from './nanoevents.js';
3
3
  export declare const isServicePluginModule: (val: any) => val is ServicePluginDefinition<ServicePluginContract>;
4
4
  export type UnknownServicePluginResponse = unknown;
5
5
  type ServicePluginRequestMetadata = {
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.servicePluginsModules = exports.isServicePluginModule = void 0;
4
- const nanoevents_1 = require("nanoevents");
4
+ const nanoevents_js_1 = require("./nanoevents.js");
5
5
  const isServicePluginModule = (val) => val.__type === 'service-plugin-definition';
6
6
  exports.isServicePluginModule = isServicePluginModule;
7
7
  function servicePluginsModules(authStrategy) {
8
8
  const servicePluginsImplementations = new Map();
9
- const servicePluginsEmitter = (0, nanoevents_1.createNanoEvents)();
9
+ const servicePluginsEmitter = (0, nanoevents_js_1.createNanoEvents)();
10
10
  const client = {
11
11
  ...servicePluginsEmitter,
12
12
  getRegisteredServicePlugins: () => servicePluginsImplementations,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/sdk",
3
- "version": "1.12.9",
3
+ "version": "1.12.10",
4
4
  "license": "UNLICENSED",
5
5
  "author": {
6
6
  "name": "Ronny Ringel",
@@ -65,14 +65,13 @@
65
65
  "dependencies": {
66
66
  "@babel/runtime": "^7.23.2",
67
67
  "@wix/identity": "^1.0.78",
68
- "@wix/image-kit": "^1.77.0",
68
+ "@wix/image-kit": "^1.78.0",
69
69
  "@wix/redirects": "^1.0.41",
70
70
  "@wix/sdk-context": "^0.0.1",
71
71
  "@wix/sdk-runtime": "0.3.14",
72
72
  "@wix/sdk-types": "^1.9.2",
73
73
  "crypto-js": "^4.2.0",
74
74
  "jose": "^5.2.1",
75
- "nanoevents": "^9.0.0",
76
75
  "pkce-challenge": "^3.1.0",
77
76
  "querystring": "^0.2.1",
78
77
  "type-fest": "^4.9.0"
@@ -123,5 +122,5 @@
123
122
  "wallaby": {
124
123
  "autoDetect": true
125
124
  },
126
- "falconPackageHash": "fac4a20ec702fb1a9e081a3fe2eb9dc105d284baeb49281de73dbf0e"
125
+ "falconPackageHash": "b81aa04bef95525c32b389a310367289cfce74217f89f45e72548824"
127
126
  }