@wix/redirects 1.0.48 → 1.0.50

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.
@@ -2,5 +2,6 @@
2
2
  "sideEffects": false,
3
3
  "module": "../build/es/context.js",
4
4
  "main": "../build/cjs/context.js",
5
- "typings": "../build/cjs/context.d.ts"
5
+ "typings": "../build/cjs/context.d.ts",
6
+ "typesBundle": "../type-bundles/context.bundle.d.ts"
6
7
  }
package/meta/package.json CHANGED
@@ -2,5 +2,6 @@
2
2
  "sideEffects": false,
3
3
  "module": "../build/es/meta.js",
4
4
  "main": "../build/cjs/meta.js",
5
- "typings": "../build/cjs/meta.d.ts"
5
+ "typings": "../build/cjs/meta.d.ts",
6
+ "typesBundle": "../type-bundles/meta.bundle.d.ts"
6
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/redirects",
3
- "version": "1.0.48",
3
+ "version": "1.0.50",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -9,21 +9,26 @@
9
9
  "module": "build/es/index.js",
10
10
  "main": "build/cjs/index.js",
11
11
  "typings": "./build/cjs/index.d.ts",
12
+ "typesBundle": "./type-bundles/index.bundle.d.ts",
12
13
  "files": [
13
14
  "build",
14
15
  "frontend/package.json",
15
16
  "meta",
16
- "context"
17
+ "context",
18
+ "type-bundles"
17
19
  ],
18
20
  "dependencies": {
19
- "@wix/redirects_redirects": "1.0.18"
21
+ "@wix/redirects_redirects": "1.0.20"
20
22
  },
21
23
  "devDependencies": {
22
- "@wix/sdk": "https://cdn.dev.wixpress.com/@wix/sdk/02e8069ab2fd783e0e6a080fc7d590e76cb26ab93c8389574286305b.tar.gz",
24
+ "glob": "^10.4.1",
25
+ "rollup": "^4.18.0",
26
+ "rollup-plugin-dts": "^6.1.1",
23
27
  "typescript": "^5.3.2"
24
28
  },
25
29
  "scripts": {
26
- "build": "tsc -b tsconfig.json tsconfig.esm.json",
30
+ "build": "tsc -b tsconfig.json tsconfig.esm.json && npm run build:dts-bundles",
31
+ "build:dts-bundles": "test -f config/rollup-config.js && rollup --config config/rollup-config.js || echo 'Warning: config/rollup-config.js not found!'",
27
32
  "test": ":"
28
33
  },
29
34
  "wix": {
@@ -37,5 +42,5 @@
37
42
  "fqdn": ""
38
43
  }
39
44
  },
40
- "falconPackageHash": "c819c99b08cf182fbc39dcacf6d0fcf747bf9e3f33a63688f221aaad"
45
+ "falconPackageHash": "1ccc9a9ddd03c35b832b522d21ba8a105700a099ec9353232a199a1a"
41
46
  }
@@ -0,0 +1,58 @@
1
+ type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
2
+ interface HttpClient {
3
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
4
+ fetchWithAuth: typeof fetch;
5
+ wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>;
6
+ }
7
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
8
+ type HttpResponse<T = any> = {
9
+ data: T;
10
+ status: number;
11
+ statusText: string;
12
+ headers: any;
13
+ request?: any;
14
+ };
15
+ type RequestOptions<_TResponse = any, Data = any> = {
16
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
17
+ url: string;
18
+ data?: Data;
19
+ params?: URLSearchParams;
20
+ } & APIMetadata;
21
+ type APIMetadata = {
22
+ methodFqn?: string;
23
+ entityFqdn?: string;
24
+ packageName?: string;
25
+ };
26
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
27
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
28
+ __type: 'event-definition';
29
+ type: Type;
30
+ isDomainEvent?: boolean;
31
+ transformations?: (envelope: unknown) => Payload;
32
+ __payload: Payload;
33
+ };
34
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, transformations?: (envelope: any) => unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
35
+ type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
36
+ type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
37
+
38
+ declare global {
39
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
40
+ interface SymbolConstructor {
41
+ readonly observable: symbol;
42
+ }
43
+ }
44
+
45
+ declare function createRESTModule<T extends RESTFunctionDescriptor>(descriptor: T, elevated?: boolean): BuildRESTFunction<T> & T;
46
+
47
+ declare function createEventModule<T extends EventDefinition<any, string>>(eventDefinition: T): BuildEventDefinition<T> & T;
48
+
49
+ declare const createRedirectSession: ReturnType<typeof createRESTModule<typeof publicCreateRedirectSession>>;
50
+ declare const onRedirectSessionCreated: ReturnType<typeof createEventModule<typeof publicOnRedirectSessionCreated>>;
51
+
52
+ declare const context_createRedirectSession: typeof createRedirectSession;
53
+ declare const context_onRedirectSessionCreated: typeof onRedirectSessionCreated;
54
+ declare namespace context {
55
+ export { context_createRedirectSession as createRedirectSession, context_onRedirectSessionCreated as onRedirectSessionCreated };
56
+ }
57
+
58
+ export { context as redirects };