userDataSyncClient.ts ×5

Frontier kind: Code frontier

unlabeled · c_e347e30ed9e2

204 tests · 24647 LOC · 133 files · introduces 0 tests · 29 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges29 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
3851 ranges24647 lines · 133 files · Browse complete extent
All tests (intent)
204 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 29 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/userDataSync/test/common/userDataSyncClient.ts 16 introduced LOC · 5 ranges

Open complete file

240 }
241 if (options.type === 'POST' && segments.length === 2 && segments[0] === 'resource') {
242 > return this.writeData(undefined, segments[1], options.data, options.headers); userDataSyncClient.ts
243 > }
244 // resources in collection
245 if (options.type === 'GET' && segments.length === 5 && segments[0] === 'collection' && segments[2] === 'resource') {
310
311 private async writeData(collection: string | undefined, resource: string, content: string = '', headers: IHeaders = {}): Promise<IRequestContext> {
312 > if (!this.session) { userDataSyncClient.ts
313 > this.session = generateUuid();
314 > }
315 > const collectionData = collection ? this.collections.get(collection) : this.data;
316 > if (!collectionData) {
317 return this.toResponse(501);
318 }
319 > const resourceKey = ALL_SERVER_RESOURCES.find(key => key === resource); userDataSyncClient.ts
320 > if (resourceKey) {
321 > const data = collectionData.get(resourceKey);
322 > if (headers['If-Match'] !== undefined && headers['If-Match'] !== (data ? data.ref : '0')) {
323 return this.toResponse(412);
324 }
325 > const ref = `${parseInt(data?.ref || '0') + 1}`; userDataSyncClient.ts
326 > collectionData.set(resourceKey, { ref, content });
327 > return this.toResponse(200, { etag: ref });
328 > }
329 return this.toResponse(204);
331
332 private async deleteResourceData(collection: string | undefined, resource: string, headers: IHeaders = {}): Promise<IRequestContext> {
src/vs/platform/userDataSync/common/userDataSyncStoreService.ts 13 introduced LOC · 4 ranges

Open complete file

384
385 async writeResource(resource: ServerResource, data: string, ref: string | null, collection?: string, headers: IHeaders = {}): Promise<string> {
386 > if (!this.userDataSyncStoreUrl) { userDataSyncStoreService.ts
387 throw new Error('No settings sync store url configured.');
388 }
390 > const url = this.getResourceUrl(this.userDataSyncStoreUrl, collection, resource).toString();
391 > headers = { ...headers };
392 > headers['Content-Type'] = Mimes.text;
393 > if (ref) {
394 headers['If-Match'] = ref;
395 }
397 > const context = await this.request(url, { type: 'POST', data, headers, callSite: 'userDataSync.writeResource' }, [], CancellationToken.None);
398 >
399 > const newRef = context.res.headers['etag'];
400 > if (!newRef) {
401 throw new UserDataSyncStoreError('Server did not return the ref', url, UserDataSyncErrorCode.NoRef, context.res.statusCode, context.res.headers[HEADER_OPERATION_ID]);
402 }
403 > return newRef; userDataSyncStoreService.ts
404 > }
405
406 // #endregion