@codingame/monaco-vscode-authentication-service-override 4.5.0 → 4.5.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.
package/index.d.ts CHANGED
@@ -1 +1 @@
1
- export { default } from './authentication.js';
1
+ export { default } from 'vscode/service-override/authentication';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codingame/monaco-vscode-authentication-service-override",
3
- "version": "4.5.0",
3
+ "version": "4.5.2",
4
4
  "keywords": [],
5
5
  "author": {
6
6
  "name": "CodinGame",
@@ -26,6 +26,6 @@
26
26
  }
27
27
  },
28
28
  "dependencies": {
29
- "vscode": "npm:@codingame/monaco-vscode-api@4.5.0"
29
+ "vscode": "npm:@codingame/monaco-vscode-api@4.5.2"
30
30
  }
31
31
  }
@@ -14,6 +14,7 @@ import { IAuthenticationUsageService } from 'vscode/vscode/vs/workbench/services
14
14
  import { IAuthenticationService } from 'vscode/vscode/vs/workbench/services/authentication/common/authentication.service';
15
15
  import Severity$1 from 'vscode/vscode/vs/base/common/severity';
16
16
 
17
+ const _moduleId = "vs/workbench/services/authentication/browser/authenticationExtensionsService";
17
18
  const SCOPESLIST_SEPARATOR = ' ';
18
19
  let AuthenticationExtensionsService = class AuthenticationExtensionsService extends Disposable {
19
20
  constructor(activityService, storageService, dialogService, quickInputService, _authenticationService, _authenticationUsageService, _authenticationAccessService) {
@@ -25,9 +26,9 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
25
26
  this._authenticationService = _authenticationService;
26
27
  this._authenticationUsageService = _authenticationUsageService;
27
28
  this._authenticationAccessService = _authenticationAccessService;
28
- this._signInRequestItems = ( new Map());
29
- this._sessionAccessRequestItems = ( new Map());
30
- this._accountBadgeDisposable = this._register(( new MutableDisposable()));
29
+ this._signInRequestItems = ( (new Map()));
30
+ this._sessionAccessRequestItems = ( (new Map()));
31
+ this._accountBadgeDisposable = this._register(( (new MutableDisposable())));
31
32
  this.registerListeners();
32
33
  }
33
34
  registerListeners() {
@@ -42,7 +43,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
42
43
  }));
43
44
  this._register(this._authenticationService.onDidUnregisterAuthenticationProvider(e => {
44
45
  const accessRequests = this._sessionAccessRequestItems.get(e.id) || {};
45
- ( Object.keys(accessRequests)).forEach(extensionId => {
46
+ ( (Object.keys(accessRequests))).forEach(extensionId => {
46
47
  this.removeAccessRequest(e.id, extensionId);
47
48
  });
48
49
  }));
@@ -52,14 +53,14 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
52
53
  if (!existingRequestsForProvider) {
53
54
  return;
54
55
  }
55
- ( Object.keys(existingRequestsForProvider)).forEach(requestedScopes => {
56
- if (( addedSessions.some(
56
+ ( (Object.keys(existingRequestsForProvider))).forEach(requestedScopes => {
57
+ if (( (addedSessions.some(
57
58
  session => session.scopes.slice().join(SCOPESLIST_SEPARATOR) === requestedScopes
58
- ))) {
59
+ )))) {
59
60
  const sessionRequest = existingRequestsForProvider[requestedScopes];
60
61
  sessionRequest?.disposables.forEach(item => item.dispose());
61
62
  delete existingRequestsForProvider[requestedScopes];
62
- if (( Object.keys(existingRequestsForProvider)).length === 0) {
63
+ if (( (Object.keys(existingRequestsForProvider))).length === 0) {
63
64
  this._signInRequestItems.delete(providerId);
64
65
  }
65
66
  else {
@@ -71,7 +72,7 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
71
72
  async updateAccessRequests(providerId, removedSessions) {
72
73
  const providerRequests = this._sessionAccessRequestItems.get(providerId);
73
74
  if (providerRequests) {
74
- ( Object.keys(providerRequests)).forEach(extensionId => {
75
+ ( (Object.keys(providerRequests))).forEach(extensionId => {
75
76
  removedSessions.forEach(removed => {
76
77
  const indexOfSession = providerRequests[extensionId].possibleSessions.findIndex(session => session.id === removed.id);
77
78
  if (indexOfSession) {
@@ -88,19 +89,15 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
88
89
  this._accountBadgeDisposable.clear();
89
90
  let numberOfRequests = 0;
90
91
  this._signInRequestItems.forEach(providerRequests => {
91
- ( Object.keys(providerRequests)).forEach(request => {
92
+ ( (Object.keys(providerRequests))).forEach(request => {
92
93
  numberOfRequests += providerRequests[request].requestingExtensionIds.length;
93
94
  });
94
95
  });
95
96
  this._sessionAccessRequestItems.forEach(accessRequest => {
96
- numberOfRequests += ( Object.keys(accessRequest)).length;
97
+ numberOfRequests += ( (Object.keys(accessRequest))).length;
97
98
  });
98
99
  if (numberOfRequests > 0) {
99
- const badge = ( new NumberBadge(numberOfRequests, () => ( localizeWithPath(
100
- 'vs/workbench/services/authentication/browser/authenticationExtensionsService',
101
- 'sign in',
102
- "Sign in requested"
103
- ))));
100
+ const badge = ( (new NumberBadge(numberOfRequests, () => ( localizeWithPath(_moduleId, 0, "Sign in requested")))));
104
101
  this._accountBadgeDisposable.value = this.activityService.showAccountsActivity({ badge });
105
102
  }
106
103
  }
@@ -128,16 +125,16 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
128
125
  }
129
126
  async showGetSessionPrompt(provider, accountName, extensionId, extensionName) {
130
127
  let SessionPromptChoice;
131
- ( (function(SessionPromptChoice) {
128
+ ( ((function(SessionPromptChoice) {
132
129
  SessionPromptChoice[SessionPromptChoice["Allow"] = 0] = "Allow";
133
130
  SessionPromptChoice[SessionPromptChoice["Deny"] = 1] = "Deny";
134
131
  SessionPromptChoice[SessionPromptChoice["Cancel"] = 2] = "Cancel";
135
- })(SessionPromptChoice || (SessionPromptChoice = {})));
132
+ })(SessionPromptChoice || (SessionPromptChoice = {}))));
136
133
  const { result } = await this.dialogService.prompt({
137
134
  type: Severity$1.Info,
138
135
  message: ( localizeWithPath(
139
- 'vs/workbench/services/authentication/browser/authenticationExtensionsService',
140
- 'confirmAuthenticationAccess',
136
+ _moduleId,
137
+ 1,
141
138
  "The extension '{0}' wants to access the {1} account '{2}'.",
142
139
  extensionName,
143
140
  provider.label,
@@ -145,19 +142,11 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
145
142
  )),
146
143
  buttons: [
147
144
  {
148
- label: ( localizeWithPath(
149
- 'vs/workbench/services/authentication/browser/authenticationExtensionsService',
150
- { key: 'allow', comment: ['&& denotes a mnemonic'] },
151
- "&&Allow"
152
- )),
145
+ label: ( localizeWithPath(_moduleId, 2, "&&Allow")),
153
146
  run: () => SessionPromptChoice.Allow
154
147
  },
155
148
  {
156
- label: ( localizeWithPath(
157
- 'vs/workbench/services/authentication/browser/authenticationExtensionsService',
158
- { key: 'deny', comment: ['&& denotes a mnemonic'] },
159
- "&&Deny"
160
- )),
149
+ label: ( localizeWithPath(_moduleId, 3, "&&Deny")),
161
150
  run: () => SessionPromptChoice.Deny
162
151
  }
163
152
  ],
@@ -172,60 +161,55 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
172
161
  return result === SessionPromptChoice.Allow;
173
162
  }
174
163
  async selectSession(providerId, extensionId, extensionName, scopes, availableSessions) {
175
- return ( new Promise((resolve, reject) => {
176
- if (!availableSessions.length) {
177
- reject('No available sessions');
178
- return;
179
- }
180
- const quickPick = this.quickInputService.createQuickPick();
181
- quickPick.ignoreFocusOut = true;
182
- const items = ( availableSessions.map(session => {
183
- return {
184
- label: session.account.label,
185
- session: session
186
- };
187
- }));
188
- items.push({
189
- label: ( localizeWithPath(
190
- 'vs/workbench/services/authentication/browser/authenticationExtensionsService',
191
- 'useOtherAccount',
192
- "Sign in to another account"
193
- ))
194
- });
195
- quickPick.items = items;
196
- quickPick.title = ( localizeWithPath(
197
- 'vs/workbench/services/authentication/browser/authenticationExtensionsService',
198
- {
199
- key: 'selectAccount',
200
- comment: ['The placeholder {0} is the name of an extension. {1} is the name of the type of account, such as Microsoft or GitHub.']
201
- },
202
- "The extension '{0}' wants to access a {1} account",
203
- extensionName,
204
- this._authenticationService.getProvider(providerId).label
205
- ));
206
- quickPick.placeholder = ( localizeWithPath(
207
- 'vs/workbench/services/authentication/browser/authenticationExtensionsService',
208
- 'getSessionPlateholder',
209
- "Select an account for '{0}' to use or Esc to cancel",
210
- extensionName
211
- ));
212
- quickPick.onDidAccept(async (_) => {
213
- const session = quickPick.selectedItems[0].session ?? (await this._authenticationService.createSession(providerId, scopes));
214
- const accountName = session.account.label;
215
- this._authenticationAccessService.updateAllowedExtensions(providerId, accountName, [{ id: extensionId, name: extensionName, allowed: true }]);
216
- this.updateSessionPreference(providerId, extensionId, session);
217
- this.removeAccessRequest(providerId, extensionId);
218
- quickPick.dispose();
219
- resolve(session);
220
- });
221
- quickPick.onDidHide(_ => {
222
- if (!quickPick.selectedItems[0]) {
223
- reject('User did not consent to account access');
164
+ return (
165
+ (new Promise((resolve, reject) => {
166
+ if (!availableSessions.length) {
167
+ reject('No available sessions');
168
+ return;
224
169
  }
225
- quickPick.dispose();
226
- });
227
- quickPick.show();
228
- }));
170
+ const quickPick = this.quickInputService.createQuickPick();
171
+ quickPick.ignoreFocusOut = true;
172
+ const items = ( (availableSessions.map(session => {
173
+ return {
174
+ label: session.account.label,
175
+ session: session
176
+ };
177
+ })));
178
+ items.push({
179
+ label: ( localizeWithPath(_moduleId, 4, "Sign in to another account"))
180
+ });
181
+ quickPick.items = items;
182
+ quickPick.title = ( localizeWithPath(
183
+ _moduleId,
184
+ 5,
185
+ "The extension '{0}' wants to access a {1} account",
186
+ extensionName,
187
+ this._authenticationService.getProvider(providerId).label
188
+ ));
189
+ quickPick.placeholder = ( localizeWithPath(
190
+ _moduleId,
191
+ 6,
192
+ "Select an account for '{0}' to use or Esc to cancel",
193
+ extensionName
194
+ ));
195
+ quickPick.onDidAccept(async (_) => {
196
+ const session = quickPick.selectedItems[0].session ?? (await this._authenticationService.createSession(providerId, scopes));
197
+ const accountName = session.account.label;
198
+ this._authenticationAccessService.updateAllowedExtensions(providerId, accountName, [{ id: extensionId, name: extensionName, allowed: true }]);
199
+ this.updateSessionPreference(providerId, extensionId, session);
200
+ this.removeAccessRequest(providerId, extensionId);
201
+ quickPick.dispose();
202
+ resolve(session);
203
+ });
204
+ quickPick.onDidHide(_ => {
205
+ if (!quickPick.selectedItems[0]) {
206
+ reject('User did not consent to account access');
207
+ }
208
+ quickPick.dispose();
209
+ });
210
+ quickPick.show();
211
+ }))
212
+ );
229
213
  }
230
214
  async completeSessionAccessRequest(provider, extensionId, extensionName, scopes) {
231
215
  const providerRequests = this._sessionAccessRequestItems.get(provider.id) || {};
@@ -262,22 +246,19 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
262
246
  return;
263
247
  }
264
248
  const provider = this._authenticationService.getProvider(providerId);
265
- const menuItem = ( MenuRegistry.appendMenuItem(MenuId.AccountsContext, {
249
+ const menuItem = ( (MenuRegistry.appendMenuItem(MenuId.AccountsContext, {
266
250
  group: '3_accessRequests',
267
251
  command: {
268
252
  id: `${providerId}${extensionId}Access`,
269
253
  title: ( localizeWithPath(
270
- 'vs/workbench/services/authentication/browser/authenticationExtensionsService',
271
- {
272
- key: 'accessRequest',
273
- comment: [`The placeholder {0} will be replaced with an authentication provider''s label. {1} will be replaced with an extension name. (1) is to indicate that this menu item contributes to a badge count`]
274
- },
254
+ _moduleId,
255
+ 7,
275
256
  "Grant access to {0} for {1}... (1)",
276
257
  provider.label,
277
258
  extensionName
278
259
  ))
279
260
  }
280
- }));
261
+ })));
281
262
  const accessCommand = CommandsRegistry.registerCommand({
282
263
  id: `${providerId}${extensionId}Access`,
283
264
  handler: async (accessor) => {
@@ -290,14 +271,14 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
290
271
  }
291
272
  async requestNewSession(providerId, scopes, extensionId, extensionName) {
292
273
  if (!this._authenticationService.isAuthenticationProviderRegistered(providerId)) {
293
- await ( new Promise((resolve, _) => {
274
+ await ( (new Promise((resolve, _) => {
294
275
  const dispose = this._authenticationService.onDidRegisterAuthenticationProvider(e => {
295
276
  if (e.id === providerId) {
296
277
  dispose.dispose();
297
278
  resolve();
298
279
  }
299
280
  });
300
- }));
281
+ })));
301
282
  }
302
283
  let provider;
303
284
  try {
@@ -314,23 +295,20 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
314
295
  if (extensionHasExistingRequest) {
315
296
  return;
316
297
  }
317
- const commandId = `${providerId}:${extensionId}:signIn${( Object.keys(providerRequests || [])).length}`;
318
- const menuItem = ( MenuRegistry.appendMenuItem(MenuId.AccountsContext, {
298
+ const commandId = `${providerId}:${extensionId}:signIn${( (Object.keys(providerRequests || []))).length}`;
299
+ const menuItem = ( (MenuRegistry.appendMenuItem(MenuId.AccountsContext, {
319
300
  group: '2_signInRequests',
320
301
  command: {
321
302
  id: commandId,
322
303
  title: ( localizeWithPath(
323
- 'vs/workbench/services/authentication/browser/authenticationExtensionsService',
324
- {
325
- key: 'signInRequest',
326
- comment: [`The placeholder {0} will be replaced with an authentication provider's label. {1} will be replaced with an extension name. (1) is to indicate that this menu item contributes to a badge count.`]
327
- },
304
+ _moduleId,
305
+ 8,
328
306
  "Sign in with {0} to use {1} (1)",
329
307
  provider.label,
330
308
  extensionName
331
309
  ))
332
310
  }
333
- }));
311
+ })));
334
312
  const signInCommand = CommandsRegistry.registerCommand({
335
313
  id: commandId,
336
314
  handler: async (accessor) => {
@@ -359,14 +337,14 @@ let AuthenticationExtensionsService = class AuthenticationExtensionsService exte
359
337
  this.updateBadgeCount();
360
338
  }
361
339
  };
362
- AuthenticationExtensionsService = ( __decorate([
363
- ( __param(0, IActivityService)),
364
- ( __param(1, IStorageService)),
365
- ( __param(2, IDialogService)),
366
- ( __param(3, IQuickInputService)),
367
- ( __param(4, IAuthenticationService)),
368
- ( __param(5, IAuthenticationUsageService)),
369
- ( __param(6, IAuthenticationAccessService))
370
- ], AuthenticationExtensionsService));
340
+ AuthenticationExtensionsService = ( (__decorate([
341
+ ( (__param(0, IActivityService))),
342
+ ( (__param(1, IStorageService))),
343
+ ( (__param(2, IDialogService))),
344
+ ( (__param(3, IQuickInputService))),
345
+ ( (__param(4, IAuthenticationService))),
346
+ ( (__param(5, IAuthenticationUsageService))),
347
+ ( (__param(6, IAuthenticationAccessService)))
348
+ ], AuthenticationExtensionsService)));
371
349
 
372
350
  export { AuthenticationExtensionsService };
@@ -1,5 +0,0 @@
1
- import { IEditorOverrideServices } from 'vscode/vscode/vs/editor/standalone/browser/standaloneServices';
2
-
3
- declare function getServiceOverride(): IEditorOverrideServices;
4
-
5
- export { getServiceOverride as default };