@wix/auth-management 1.0.26 → 1.0.28

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/auth-management",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "publishConfig": {
5
5
  "registry": "https://registry.npmjs.org/",
6
6
  "access": "public"
@@ -9,21 +9,27 @@
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/auth-management_o-auth-apps": "1.0.12"
21
+ "@wix/auth-management_o-auth-apps": "1.0.14"
20
22
  },
21
23
  "devDependencies": {
22
24
  "@wix/sdk": "https://cdn.dev.wixpress.com/@wix/sdk/02e8069ab2fd783e0e6a080fc7d590e76cb26ab93c8389574286305b.tar.gz",
25
+ "glob": "^10.4.1",
26
+ "rollup": "^4.18.0",
27
+ "rollup-plugin-dts": "^6.1.1",
23
28
  "typescript": "^5.3.2"
24
29
  },
25
30
  "scripts": {
26
- "build": "tsc -b tsconfig.json tsconfig.esm.json",
31
+ "build": "tsc -b tsconfig.json tsconfig.esm.json && npm run build:dts-bundles",
32
+ "build:dts-bundles": "test -f config/rollup-config.js && rollup --config config/rollup-config.js || echo 'Warning: config/rollup-config.js not found!'",
27
33
  "test": ":"
28
34
  },
29
35
  "wix": {
@@ -37,5 +43,5 @@
37
43
  "fqdn": ""
38
44
  }
39
45
  },
40
- "falconPackageHash": "c0ee39f6786a8aac14c7270f696c1ecb201caac06b2ba6dbe2ab29a5"
46
+ "falconPackageHash": "7ffa53cb1abc1d8840847ef00d8a105e303b38634e677570b97af67b"
41
47
  }
@@ -0,0 +1,293 @@
1
+ /** An intermediary application that authorizes and authenticates an external client to access data on a Wix project or site. */
2
+ interface OAuthApp {
3
+ /**
4
+ * ID of the OAuth app.
5
+ * @readonly
6
+ */
7
+ _id?: string | null;
8
+ /**
9
+ * Date and time the OAuth app was created, in ISO 8601 format.
10
+ * @readonly
11
+ */
12
+ _createdDate?: Date;
13
+ /** Display name of the OAuth app, as it appears in the dashboard. */
14
+ name?: string | null;
15
+ /** Description of the OAuth app, as it appears in the dashboard. */
16
+ description?: string | null;
17
+ /**
18
+ * For internal use only.
19
+ * @readonly
20
+ * @deprecated
21
+ */
22
+ secret?: string | null;
23
+ /** External login URL to which users are redirected automatically to authenticate. If no login URL is specified, the user is redirected to Wix to authenticate. */
24
+ loginUrl?: string | null;
25
+ /**
26
+ * List of URIs to which redirection from Wix is allowed after authentication.
27
+ *
28
+ * When a client redirects a user to Wix for authentication, the client provides a URI to redirect the user back to after the user has been authenticated.
29
+ * Wix only redirects the user if the exact URI is contained in this array.
30
+ */
31
+ allowedRedirectUris?: string[];
32
+ /**
33
+ * List of domains to which redirection from Wix is allowed after processes other than authentication.
34
+ *
35
+ * When a client redirects a user to a Wix page (for example, for checkout), the client provides a URL to redirect the user back to.
36
+ * Wix only redirects the user if the URL is in one of the specified domains.
37
+ */
38
+ allowedRedirectDomains?: string[];
39
+ /**
40
+ * Whether a secret can be generated for this OAuth app.
41
+ *
42
+ * Default: `true` until a secret has been generated for the OAuth App.
43
+ */
44
+ allowSecretGeneration?: boolean | null;
45
+ /** External logout URL to which we invoke when user logout at wix. If no logout URL is specified, the user is logged out only at Wix. */
46
+ logoutUrl?: string | null;
47
+ }
48
+ interface IdentificationData extends IdentificationDataIdOneOf {
49
+ /** ID of a site visitor that has not logged in to the site. */
50
+ anonymousVisitorId?: string;
51
+ /** ID of a site visitor that has logged in to the site. */
52
+ memberId?: string;
53
+ /** ID of a Wix user (site owner, contributor, etc.). */
54
+ wixUserId?: string;
55
+ /** ID of an app. */
56
+ appId?: string;
57
+ /** @readonly */
58
+ identityType?: WebhookIdentityType;
59
+ }
60
+ /** @oneof */
61
+ interface IdentificationDataIdOneOf {
62
+ /** ID of a site visitor that has not logged in to the site. */
63
+ anonymousVisitorId?: string;
64
+ /** ID of a site visitor that has logged in to the site. */
65
+ memberId?: string;
66
+ /** ID of a Wix user (site owner, contributor, etc.). */
67
+ wixUserId?: string;
68
+ /** ID of an app. */
69
+ appId?: string;
70
+ }
71
+ declare enum WebhookIdentityType {
72
+ UNKNOWN = "UNKNOWN",
73
+ ANONYMOUS_VISITOR = "ANONYMOUS_VISITOR",
74
+ MEMBER = "MEMBER",
75
+ WIX_USER = "WIX_USER",
76
+ APP = "APP"
77
+ }
78
+ interface BaseEventMetadata {
79
+ /** App instance ID. */
80
+ instanceId?: string | null;
81
+ /** Event type. */
82
+ eventType?: string;
83
+ /** The identification type and identity data. */
84
+ identity?: IdentificationData;
85
+ }
86
+ interface EventMetadata extends BaseEventMetadata {
87
+ /**
88
+ * Unique event ID.
89
+ * Allows clients to ignore duplicate webhooks.
90
+ */
91
+ _id?: string;
92
+ /**
93
+ * Assumes actions are also always typed to an entity_type
94
+ * Example: wix.stores.catalog.product, wix.bookings.session, wix.payments.transaction
95
+ */
96
+ entityFqdn?: string;
97
+ /**
98
+ * This is top level to ease client code dispatching of messages (switch on entity_fqdn+slug)
99
+ * This is although the created/updated/deleted notion is duplication of the oneof types
100
+ * Example: created/updated/deleted/started/completed/email_opened
101
+ */
102
+ slug?: string;
103
+ /** ID of the entity associated with the event. */
104
+ entityId?: string;
105
+ /** Event timestamp. */
106
+ eventTime?: Date;
107
+ /**
108
+ * Whether the event was triggered as a result of a privacy regulation application
109
+ * (for example, GDPR).
110
+ */
111
+ triggeredByAnonymizeRequest?: boolean | null;
112
+ /** If present, indicates the action that triggered the event. */
113
+ originatedFrom?: string | null;
114
+ /**
115
+ * A sequence number defining the order of updates to the underlying entity.
116
+ * For example, given that some entity was updated at 16:00 and than again at 16:01,
117
+ * it is guaranteed that the sequence number of the second update is strictly higher than the first.
118
+ * As the consumer, you can use this value to ensure that you handle messages in the correct order.
119
+ * To do so, you will need to persist this number on your end, and compare the sequence number from the
120
+ * message against the one you have stored. Given that the stored number is higher, you should ignore the message.
121
+ */
122
+ entityEventSequence?: string | null;
123
+ }
124
+ interface OAuthAppCreatedEnvelope {
125
+ entity: OAuthApp;
126
+ metadata: EventMetadata;
127
+ }
128
+ interface OAuthAppUpdatedEnvelope {
129
+ entity: OAuthApp;
130
+ metadata: EventMetadata;
131
+ }
132
+ interface OAuthAppDeletedEnvelope {
133
+ metadata: EventMetadata;
134
+ }
135
+ interface UpdateOAuthApp {
136
+ /**
137
+ * ID of the OAuth app.
138
+ * @readonly
139
+ */
140
+ _id?: string | null;
141
+ /**
142
+ * Date and time the OAuth app was created, in ISO 8601 format.
143
+ * @readonly
144
+ */
145
+ _createdDate?: Date;
146
+ /** Display name of the OAuth app, as it appears in the dashboard. */
147
+ name?: string | null;
148
+ /** Description of the OAuth app, as it appears in the dashboard. */
149
+ description?: string | null;
150
+ /**
151
+ * For internal use only.
152
+ * @readonly
153
+ * @deprecated
154
+ */
155
+ secret?: string | null;
156
+ /** External login URL to which users are redirected automatically to authenticate. If no login URL is specified, the user is redirected to Wix to authenticate. */
157
+ loginUrl?: string | null;
158
+ /**
159
+ * List of URIs to which redirection from Wix is allowed after authentication.
160
+ *
161
+ * When a client redirects a user to Wix for authentication, the client provides a URI to redirect the user back to after the user has been authenticated.
162
+ * Wix only redirects the user if the exact URI is contained in this array.
163
+ */
164
+ allowedRedirectUris?: string[];
165
+ /**
166
+ * List of domains to which redirection from Wix is allowed after processes other than authentication.
167
+ *
168
+ * When a client redirects a user to a Wix page (for example, for checkout), the client provides a URL to redirect the user back to.
169
+ * Wix only redirects the user if the URL is in one of the specified domains.
170
+ */
171
+ allowedRedirectDomains?: string[];
172
+ /**
173
+ * Whether a secret can be generated for this OAuth app.
174
+ *
175
+ * Default: `true` until a secret has been generated for the OAuth App.
176
+ */
177
+ allowSecretGeneration?: boolean | null;
178
+ /** External logout URL to which we invoke when user logout at wix. If no logout URL is specified, the user is logged out only at Wix. */
179
+ logoutUrl?: string | null;
180
+ }
181
+ interface QueryOffsetResult {
182
+ currentPage: number | undefined;
183
+ totalPages: number | undefined;
184
+ totalCount: number | undefined;
185
+ hasNext: () => boolean;
186
+ hasPrev: () => boolean;
187
+ length: number;
188
+ pageSize: number;
189
+ }
190
+ interface OAuthAppsQueryResult extends QueryOffsetResult {
191
+ items: OAuthApp[];
192
+ query: OAuthAppsQueryBuilder;
193
+ next: () => Promise<OAuthAppsQueryResult>;
194
+ prev: () => Promise<OAuthAppsQueryResult>;
195
+ }
196
+ interface OAuthAppsQueryBuilder {
197
+ /** @param propertyName - Property whose value is compared with `value`.
198
+ * @param value - Value to compare against.
199
+ * @documentationMaturity preview
200
+ */
201
+ eq: (propertyName: '_id', value: any) => OAuthAppsQueryBuilder;
202
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
203
+ * @documentationMaturity preview
204
+ */
205
+ ascending: (...propertyNames: Array<'_createdDate' | 'name'>) => OAuthAppsQueryBuilder;
206
+ /** @param propertyNames - Properties used in the sort. To sort by multiple properties, pass properties as additional arguments.
207
+ * @documentationMaturity preview
208
+ */
209
+ descending: (...propertyNames: Array<'_createdDate' | 'name'>) => OAuthAppsQueryBuilder;
210
+ /** @param limit - Number of items to return, which is also the `pageSize` of the results object.
211
+ * @documentationMaturity preview
212
+ */
213
+ limit: (limit: number) => OAuthAppsQueryBuilder;
214
+ /** @param skip - Number of items to skip in the query results before returning the results.
215
+ * @documentationMaturity preview
216
+ */
217
+ skip: (skip: number) => OAuthAppsQueryBuilder;
218
+ /** @documentationMaturity preview */
219
+ find: () => Promise<OAuthAppsQueryResult>;
220
+ }
221
+
222
+ type RESTFunctionDescriptor<T extends (...args: any[]) => any = (...args: any[]) => any> = (httpClient: HttpClient) => T;
223
+ interface HttpClient {
224
+ request<TResponse, TData = any>(req: RequestOptionsFactory<TResponse, TData>): Promise<HttpResponse<TResponse>>;
225
+ }
226
+ type RequestOptionsFactory<TResponse = any, TData = any> = (context: any) => RequestOptions<TResponse, TData>;
227
+ type HttpResponse<T = any> = {
228
+ data: T;
229
+ status: number;
230
+ statusText: string;
231
+ headers: any;
232
+ request?: any;
233
+ };
234
+ type RequestOptions<_TResponse = any, Data = any> = {
235
+ method: 'POST' | 'GET' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
236
+ url: string;
237
+ data?: Data;
238
+ params?: URLSearchParams;
239
+ } & APIMetadata;
240
+ type APIMetadata = {
241
+ methodFqn?: string;
242
+ entityFqdn?: string;
243
+ packageName?: string;
244
+ };
245
+ type BuildRESTFunction<T extends RESTFunctionDescriptor> = T extends RESTFunctionDescriptor<infer U> ? U : never;
246
+ type EventDefinition<Payload = unknown, Type extends string = string> = {
247
+ __type: 'event-definition';
248
+ type: Type;
249
+ isDomainEvent?: boolean;
250
+ transformations?: unknown;
251
+ __payload: Payload;
252
+ };
253
+ declare function EventDefinition<Type extends string>(type: Type, isDomainEvent?: boolean, _transformations?: unknown): <Payload = unknown>() => EventDefinition<Payload, Type>;
254
+ type EventHandler<T extends EventDefinition> = (payload: T['__payload']) => void | Promise<void>;
255
+ type BuildEventDefinition<T extends EventDefinition<any, string>> = (handler: EventHandler<T>) => void;
256
+
257
+ declare function createOAuthApp$1(httpClient: HttpClient): (oAuthApp: OAuthApp) => Promise<OAuthApp & {
258
+ allowedRedirectUris: string[];
259
+ allowedRedirectDomains: string[];
260
+ }>;
261
+ declare function getOAuthApp$1(httpClient: HttpClient): (oAuthAppId: string) => Promise<OAuthApp & {
262
+ allowedRedirectUris: string[];
263
+ allowedRedirectDomains: string[];
264
+ }>;
265
+ declare function updateOAuthApp$1(httpClient: HttpClient): (_id: string | null, oAuthApp: UpdateOAuthApp) => Promise<OAuthApp & {
266
+ allowedRedirectUris: string[];
267
+ allowedRedirectDomains: string[];
268
+ }>;
269
+ declare function queryOAuthApps$1(httpClient: HttpClient): () => OAuthAppsQueryBuilder;
270
+ declare const onOAuthAppCreated$1: EventDefinition<OAuthAppCreatedEnvelope, "wix.headless.v1.o_auth_app_created">;
271
+ declare const onOAuthAppUpdated$1: EventDefinition<OAuthAppUpdatedEnvelope, "wix.headless.v1.o_auth_app_updated">;
272
+ declare const onOAuthAppDeleted$1: EventDefinition<OAuthAppDeletedEnvelope, "wix.headless.v1.o_auth_app_deleted">;
273
+
274
+ declare const createOAuthApp: BuildRESTFunction<typeof createOAuthApp$1>;
275
+ declare const getOAuthApp: BuildRESTFunction<typeof getOAuthApp$1>;
276
+ declare const updateOAuthApp: BuildRESTFunction<typeof updateOAuthApp$1>;
277
+ declare const queryOAuthApps: BuildRESTFunction<typeof queryOAuthApps$1>;
278
+ declare const onOAuthAppCreated: BuildEventDefinition<typeof onOAuthAppCreated$1>;
279
+ declare const onOAuthAppUpdated: BuildEventDefinition<typeof onOAuthAppUpdated$1>;
280
+ declare const onOAuthAppDeleted: BuildEventDefinition<typeof onOAuthAppDeleted$1>;
281
+
282
+ declare const context_createOAuthApp: typeof createOAuthApp;
283
+ declare const context_getOAuthApp: typeof getOAuthApp;
284
+ declare const context_onOAuthAppCreated: typeof onOAuthAppCreated;
285
+ declare const context_onOAuthAppDeleted: typeof onOAuthAppDeleted;
286
+ declare const context_onOAuthAppUpdated: typeof onOAuthAppUpdated;
287
+ declare const context_queryOAuthApps: typeof queryOAuthApps;
288
+ declare const context_updateOAuthApp: typeof updateOAuthApp;
289
+ declare namespace context {
290
+ export { context_createOAuthApp as createOAuthApp, context_getOAuthApp as getOAuthApp, context_onOAuthAppCreated as onOAuthAppCreated, context_onOAuthAppDeleted as onOAuthAppDeleted, context_onOAuthAppUpdated as onOAuthAppUpdated, context_queryOAuthApps as queryOAuthApps, context_updateOAuthApp as updateOAuthApp };
291
+ }
292
+
293
+ export { context as oAuthApps };