From e1a0f3a1b2fb6b60b02fb3b7ba22bc4aaf91af32 Mon Sep 17 00:00:00 2001 From: Matteo <193476828+mzner@users.noreply.github.com> Date: Thu, 17 Sep 2026 07:18:50 +0200 Subject: [PATCH] [full-ci] chore: [OCISDEV-1412] remove the readOnly workaround from the libre-graph client generation (#12956) * chore: [OCISDEV-1412] remove the readOnly workaround from the libre-graph client generation The client generation stripped every `readOnly: true` line from the spec before running the generator, because the typescript-fetch templates leave read-only fields out of the serializers they emit and a few fields oCIS does accept on write were annotated read-only. Stripping them all also unmarked the fields that genuinely are response-only. The annotations are corrected upstream now, so the generator runs on the spec as published. Everything oCIS writes is still serialized: the drive quota total, the drive type, a space image and readme, the hidden flag and remote item of a drive item, and the fields of a sharing permission. Response-only fields such as the computed quota values are now typed read-only, which the handful of places that assigned to them had to be adjusted for. * chore: [OCISDEV-1412] regenerate the libre-graph client after the driveType split drive now declares its own writable driveType while driveUpdate marks it readOnly, so updateDrive no longer accepts a value the server rejects. * fix: [OCISDEV-1412] keep the special folder id in the drive update body Setting a space image or readme patches the drive with the id of an existing item under special. driveItem.id was marked readOnly in the spec, so the generated serializer dropped it and the server skipped the entry: the request returned 200 and did nothing, which the e2e space image test caught as a timeout waiting for the image to load. The annotation is gone from the spec, and updateDrive now has tests asserting the serialized body, since neither type checking nor a mocked call notices a field that quietly disappears. * fix: [OCISDEV-1412] regenerate after splitting the drive special folder schema An update to a drive assigns its special folders by referencing existing items by id. Upstream now models that with a dedicated schema instead of reusing the response-only drive item, so the update body keeps the id while the drive item itself is read-only again. The wrapper around the generated client typed the update body as a drive rather than a drive update, which no longer holds now that the two differ in how they describe the special folders. --- .../components/Users/SideBar/EditPanel.vue | 7 +- .../web-client/scripts/generate-openapi.sh | 14 ++-- .../web-client/src/graph/drives/types.ts | 4 +- .../graph/generated/.openapi-generator/FILES | 2 + .../src/graph/generated/apis/DriveItemApi.ts | 2 +- .../src/graph/generated/apis/DrivesApi.ts | 4 +- .../generated/apis/DrivesPermissionsApi.ts | 2 +- .../src/graph/generated/apis/DrivesRootApi.ts | 4 +- .../graph/generated/apis/EducationClassApi.ts | 4 +- .../generated/apis/EducationSchoolApi.ts | 4 +- .../graph/generated/apis/EducationUserApi.ts | 4 +- .../src/graph/generated/apis/GroupApi.ts | 2 +- .../src/graph/generated/apis/GroupsApi.ts | 2 +- .../src/graph/generated/apis/MeUserApi.ts | 2 +- .../src/graph/generated/apis/UserApi.ts | 2 +- .../apis/UserAppRoleAssignmentApi.ts | 2 +- .../src/graph/generated/docs/DriveItem.md | 2 +- .../src/graph/generated/docs/DriveUpdate.md | 2 +- .../src/graph/generated/docs/Quota.md | 2 +- .../generated/docs/SpecialDriveItemUpdate.md | 37 +++++++++ .../src/graph/generated/docs/SpecialFolder.md | 2 +- .../generated/models/AppRoleAssignment.ts | 5 +- .../src/graph/generated/models/Application.ts | 5 +- .../src/graph/generated/models/Drive.ts | 27 +++---- .../src/graph/generated/models/DriveItem.ts | 34 +++----- .../src/graph/generated/models/DriveUpdate.ts | 40 +++++----- .../graph/generated/models/EducationClass.ts | 5 +- .../graph/generated/models/EducationSchool.ts | 5 +- .../graph/generated/models/EducationUser.ts | 8 +- .../src/graph/generated/models/Group.ts | 5 +- .../src/graph/generated/models/Image.ts | 8 +- .../graph/generated/models/ItemReference.ts | 17 ++-- .../graph/generated/models/OpenGraphFile.ts | 5 +- .../src/graph/generated/models/Permission.ts | 8 +- .../src/graph/generated/models/Quota.ts | 18 ++--- .../src/graph/generated/models/RemoteItem.ts | 11 +-- .../src/graph/generated/models/SharingLink.ts | 8 +- .../models/SpecialDriveItemUpdate.ts | 77 +++++++++++++++++++ .../graph/generated/models/SpecialFolder.ts | 2 +- .../src/graph/generated/models/User.ts | 17 ++-- .../src/graph/generated/models/UserUpdate.ts | 17 ++-- .../src/graph/generated/models/index.ts | 1 + .../web-client/src/helpers/space/functions.ts | 4 +- .../tests/unit/graph/drives.spec.ts | 18 ++++- .../unit/helpers/share/functions.spec.ts | 48 +++++++----- .../spaces/useSpaceActionsDuplicate.ts | 4 +- 46 files changed, 295 insertions(+), 208 deletions(-) create mode 100644 web/packages/web-client/src/graph/generated/docs/SpecialDriveItemUpdate.md create mode 100644 web/packages/web-client/src/graph/generated/models/SpecialDriveItemUpdate.ts diff --git a/web/packages/web-app-admin-settings/src/components/Users/SideBar/EditPanel.vue b/web/packages/web-app-admin-settings/src/components/Users/SideBar/EditPanel.vue index 671cd155aac..a5358654366 100644 --- a/web/packages/web-app-admin-settings/src/components/Users/SideBar/EditPanel.vue +++ b/web/packages/web-app-admin-settings/src/components/Users/SideBar/EditPanel.vue @@ -150,7 +150,12 @@ const eventBus = useEventBus() const { showErrorMessage } = useMessages() const { $gettext } = useGettext() -let editUser: MaybeRef = ref() +// A local draft of the user the form edits. Properties the graph API only ever returns, +// such as `memberOf`, are still editable here: the dialog diffs the draft against the +// user on confirm and applies those changes through their own endpoints. +type UserDraft = { -readonly [K in keyof User]: User[K] } + +let editUser: MaybeRef = ref() const formData = ref({ displayName: { errorMessage: '', diff --git a/web/packages/web-client/scripts/generate-openapi.sh b/web/packages/web-client/scripts/generate-openapi.sh index fe2ebcb82e0..2ba8ca905f7 100755 --- a/web/packages/web-client/scripts/generate-openapi.sh +++ b/web/packages/web-client/scripts/generate-openapi.sh @@ -3,14 +3,13 @@ set -eu # Regenerates the libre-graph client under src/graph/generated. # -# The spec marks many fields `readOnly: true`, including every field of `Quota` and the -# `parentReference` identifiers. The typescript-fetch templates take that literally: they -# emit `readonly` modifiers and, more importantly, omit those fields from the generated -# `*ToJSON` serializers, so a PATCH body such as `{ quota: { total: 500 } }` would go out -# as `{ quota: {} }`. oCIS does accept these fields on write, so the annotation is stripped -# from the spec before generating. +# `readOnly: true` in the spec is load-bearing here: the typescript-fetch templates omit +# those fields from the generated `*ToJSON` serializers, so a field that oCIS does accept +# on write but that the spec marks read-only is silently dropped from the request body. +# Note that a `readOnly` next to a `$ref` has no effect (OpenAPI 3.0 ignores siblings of +# `$ref`) — what propagates is the annotation on the referenced schema itself. # -# oCIS also returns a field the spec does not declare: `attributes` on users, added by +# oCIS returns a field the spec does not declare: `attributes` on users, added by # `UserWithAttributes` in services/graph and filled from # OCIS_USER_SEARCH_DISPLAYED_ATTRIBUTES. The typescript-fetch templates rebuild every # response from the declared fields only, so an undeclared field is dropped during decoding. @@ -31,7 +30,6 @@ trap cleanup EXIT rm -rf "$GRAPH_DIR/generated" curl -sSfL "$SPEC_URL" \ - | sed '/^ *readOnly: true$/d' \ | awk -v anchor="$USER_ALL_OF_LINE" ' { print } $0 == anchor { diff --git a/web/packages/web-client/src/graph/drives/types.ts b/web/packages/web-client/src/graph/drives/types.ts index dde6308e88b..eea8ddac1dd 100644 --- a/web/packages/web-client/src/graph/drives/types.ts +++ b/web/packages/web-client/src/graph/drives/types.ts @@ -1,5 +1,5 @@ import type { ShareRole, SpaceResource } from '../../helpers' -import type { Drive } from '../generated' +import type { Drive, DriveUpdate } from '../generated' import type { GraphRequestOptions } from '../types' export interface GraphDrives { @@ -15,7 +15,7 @@ export interface GraphDrives { ) => Promise updateDrive: ( id: string, - data: Drive, + data: DriveUpdate, graphRoles: Record, requestOptions?: GraphRequestOptions ) => Promise diff --git a/web/packages/web-client/src/graph/generated/.openapi-generator/FILES b/web/packages/web-client/src/graph/generated/.openapi-generator/FILES index 1eab1bf50bf..18dbf6c0bd7 100644 --- a/web/packages/web-client/src/graph/generated/.openapi-generator/FILES +++ b/web/packages/web-client/src/graph/generated/.openapi-generator/FILES @@ -112,6 +112,7 @@ docs/SharingLink.md docs/SharingLinkPassword.md docs/SharingLinkType.md docs/SignInActivity.md +docs/SpecialDriveItemUpdate.md docs/SpecialFolder.md docs/TagAssignment.md docs/TagUnassignment.md @@ -196,6 +197,7 @@ models/SharingLink.ts models/SharingLinkPassword.ts models/SharingLinkType.ts models/SignInActivity.ts +models/SpecialDriveItemUpdate.ts models/SpecialFolder.ts models/TagAssignment.ts models/TagUnassignment.ts diff --git a/web/packages/web-client/src/graph/generated/apis/DriveItemApi.ts b/web/packages/web-client/src/graph/generated/apis/DriveItemApi.ts index 34388d1da2e..276c81745de 100644 --- a/web/packages/web-client/src/graph/generated/apis/DriveItemApi.ts +++ b/web/packages/web-client/src/graph/generated/apis/DriveItemApi.ts @@ -58,7 +58,7 @@ export interface UpdateDriveItemRequest { /** * */ - driveItem: DriveItem; + driveItem: Omit; } /** diff --git a/web/packages/web-client/src/graph/generated/apis/DrivesApi.ts b/web/packages/web-client/src/graph/generated/apis/DrivesApi.ts index c1b56975a2b..6d8e2376cb9 100644 --- a/web/packages/web-client/src/graph/generated/apis/DrivesApi.ts +++ b/web/packages/web-client/src/graph/generated/apis/DrivesApi.ts @@ -87,7 +87,7 @@ export interface UpdateDriveRequest { /** * */ - driveUpdate: DriveUpdate; + driveUpdate: Omit; } export interface UpdateDriveBetaRequest { @@ -98,7 +98,7 @@ export interface UpdateDriveBetaRequest { /** * */ - driveUpdate: DriveUpdate; + driveUpdate: Omit; } /** diff --git a/web/packages/web-client/src/graph/generated/apis/DrivesPermissionsApi.ts b/web/packages/web-client/src/graph/generated/apis/DrivesPermissionsApi.ts index 9b67670a2e2..4e923203c56 100644 --- a/web/packages/web-client/src/graph/generated/apis/DrivesPermissionsApi.ts +++ b/web/packages/web-client/src/graph/generated/apis/DrivesPermissionsApi.ts @@ -163,7 +163,7 @@ export interface UpdatePermissionRequest { /** * */ - permission: Permission; + permission: Omit; } /** diff --git a/web/packages/web-client/src/graph/generated/apis/DrivesRootApi.ts b/web/packages/web-client/src/graph/generated/apis/DrivesRootApi.ts index b8c8ae1dd73..569c5855925 100644 --- a/web/packages/web-client/src/graph/generated/apis/DrivesRootApi.ts +++ b/web/packages/web-client/src/graph/generated/apis/DrivesRootApi.ts @@ -62,7 +62,7 @@ export interface CreateDriveItemRequest { /** * */ - driveItem?: DriveItem; + driveItem?: Omit; } export interface CreateLinkSpaceRootRequest { @@ -158,7 +158,7 @@ export interface UpdatePermissionSpaceRootRequest { /** * */ - permission: Permission; + permission: Omit; } /** diff --git a/web/packages/web-client/src/graph/generated/apis/EducationClassApi.ts b/web/packages/web-client/src/graph/generated/apis/EducationClassApi.ts index 8e8b4566116..79bfb1a2d55 100644 --- a/web/packages/web-client/src/graph/generated/apis/EducationClassApi.ts +++ b/web/packages/web-client/src/graph/generated/apis/EducationClassApi.ts @@ -54,7 +54,7 @@ export interface CreateClassRequest { /** * */ - educationClass: EducationClass; + educationClass: Omit; } export interface DeleteClassRequest { @@ -97,7 +97,7 @@ export interface UpdateClassRequest { /** * */ - educationClass: EducationClass; + educationClass: Omit; } /** diff --git a/web/packages/web-client/src/graph/generated/apis/EducationSchoolApi.ts b/web/packages/web-client/src/graph/generated/apis/EducationSchoolApi.ts index 46e561e84e6..54952b5088b 100644 --- a/web/packages/web-client/src/graph/generated/apis/EducationSchoolApi.ts +++ b/web/packages/web-client/src/graph/generated/apis/EducationSchoolApi.ts @@ -75,7 +75,7 @@ export interface CreateSchoolRequest { /** * */ - educationSchool: EducationSchool; + educationSchool: Omit; } export interface DeleteClassFromSchoolRequest { @@ -136,7 +136,7 @@ export interface UpdateSchoolRequest { /** * */ - educationSchool: EducationSchool; + educationSchool: Omit; } /** diff --git a/web/packages/web-client/src/graph/generated/apis/EducationUserApi.ts b/web/packages/web-client/src/graph/generated/apis/EducationUserApi.ts index 95c2506a4b6..f8411bce336 100644 --- a/web/packages/web-client/src/graph/generated/apis/EducationUserApi.ts +++ b/web/packages/web-client/src/graph/generated/apis/EducationUserApi.ts @@ -33,7 +33,7 @@ export interface CreateEducationUserRequest { /** * */ - educationUser: EducationUser; + educationUser: Omit; } export interface DeleteEducationUserRequest { @@ -73,7 +73,7 @@ export interface UpdateEducationUserRequest { /** * */ - educationUser: EducationUser; + educationUser: Omit; } /** diff --git a/web/packages/web-client/src/graph/generated/apis/GroupApi.ts b/web/packages/web-client/src/graph/generated/apis/GroupApi.ts index cbe03152bcf..5cc1fcd7e81 100644 --- a/web/packages/web-client/src/graph/generated/apis/GroupApi.ts +++ b/web/packages/web-client/src/graph/generated/apis/GroupApi.ts @@ -101,7 +101,7 @@ export interface UpdateGroupRequest { /** * */ - group: Group; + group: Omit; } /** diff --git a/web/packages/web-client/src/graph/generated/apis/GroupsApi.ts b/web/packages/web-client/src/graph/generated/apis/GroupsApi.ts index a24f6b44a2c..584bd108e4e 100644 --- a/web/packages/web-client/src/graph/generated/apis/GroupsApi.ts +++ b/web/packages/web-client/src/graph/generated/apis/GroupsApi.ts @@ -33,7 +33,7 @@ export interface CreateGroupRequest { /** * */ - group: Group; + group: Omit; } export interface ListGroupsRequest { diff --git a/web/packages/web-client/src/graph/generated/apis/MeUserApi.ts b/web/packages/web-client/src/graph/generated/apis/MeUserApi.ts index 7eaa7a43766..4c4b664368d 100644 --- a/web/packages/web-client/src/graph/generated/apis/MeUserApi.ts +++ b/web/packages/web-client/src/graph/generated/apis/MeUserApi.ts @@ -40,7 +40,7 @@ export interface UpdateOwnUserRequest { /** * */ - userUpdate?: UserUpdate; + userUpdate?: Omit; } /** diff --git a/web/packages/web-client/src/graph/generated/apis/UserApi.ts b/web/packages/web-client/src/graph/generated/apis/UserApi.ts index 5635940e53b..ab29095b17f 100644 --- a/web/packages/web-client/src/graph/generated/apis/UserApi.ts +++ b/web/packages/web-client/src/graph/generated/apis/UserApi.ts @@ -79,7 +79,7 @@ export interface UpdateUserRequest { /** * */ - userUpdate: UserUpdate; + userUpdate: Omit; } /** diff --git a/web/packages/web-client/src/graph/generated/apis/UserAppRoleAssignmentApi.ts b/web/packages/web-client/src/graph/generated/apis/UserAppRoleAssignmentApi.ts index b54ec01c482..69df6ec295b 100644 --- a/web/packages/web-client/src/graph/generated/apis/UserAppRoleAssignmentApi.ts +++ b/web/packages/web-client/src/graph/generated/apis/UserAppRoleAssignmentApi.ts @@ -37,7 +37,7 @@ export interface UserCreateAppRoleAssignmentsRequest { /** * */ - appRoleAssignment: AppRoleAssignment; + appRoleAssignment: Omit; } export interface UserDeleteAppRoleAssignmentsRequest { diff --git a/web/packages/web-client/src/graph/generated/docs/DriveItem.md b/web/packages/web-client/src/graph/generated/docs/DriveItem.md index 6dcc77b4925..963bb68a4de 100644 --- a/web/packages/web-client/src/graph/generated/docs/DriveItem.md +++ b/web/packages/web-client/src/graph/generated/docs/DriveItem.md @@ -1,7 +1,7 @@ # DriveItem -Represents a resource inside a drive. Read-only. +Represents a resource inside a drive. Most properties are read-only, but the schema is also used as a request body, see the individual properties. ## Properties diff --git a/web/packages/web-client/src/graph/generated/docs/DriveUpdate.md b/web/packages/web-client/src/graph/generated/docs/DriveUpdate.md index 8dd5792d36c..64a875648e4 100644 --- a/web/packages/web-client/src/graph/generated/docs/DriveUpdate.md +++ b/web/packages/web-client/src/graph/generated/docs/DriveUpdate.md @@ -23,7 +23,7 @@ Name | Type `quota` | [Quota](Quota.md) `items` | [Array<DriveItem>](DriveItem.md) `root` | [DriveItem](DriveItem.md) -`special` | [Array<DriveItem>](DriveItem.md) +`special` | [Array<SpecialDriveItemUpdate>](SpecialDriveItemUpdate.md) ## Example diff --git a/web/packages/web-client/src/graph/generated/docs/Quota.md b/web/packages/web-client/src/graph/generated/docs/Quota.md index 3e69e5e40d0..36887d5fc0d 100644 --- a/web/packages/web-client/src/graph/generated/docs/Quota.md +++ b/web/packages/web-client/src/graph/generated/docs/Quota.md @@ -1,7 +1,7 @@ # Quota -Optional. Information about the drive\'s storage space quota. Read-only. +Optional. Information about the drive\'s storage space quota. Only `total` is writable, the other properties are computed by the server and read-only. ## Properties diff --git a/web/packages/web-client/src/graph/generated/docs/SpecialDriveItemUpdate.md b/web/packages/web-client/src/graph/generated/docs/SpecialDriveItemUpdate.md new file mode 100644 index 00000000000..69211347ecd --- /dev/null +++ b/web/packages/web-client/src/graph/generated/docs/SpecialDriveItemUpdate.md @@ -0,0 +1,37 @@ + +# SpecialDriveItemUpdate + +References an existing item inside a drive to be assigned as one of the drive\'s special resources, such as its image or readme. + +## Properties + +Name | Type +------------ | ------------- +`id` | string +`specialFolder` | [SpecialFolder](SpecialFolder.md) + +## Example + +```typescript +import type { SpecialDriveItemUpdate } from '' + +// TODO: Update the object below with actual values +const example = { + "id": null, + "specialFolder": null, +} satisfies SpecialDriveItemUpdate + +console.log(example) + +// Convert the instance to a JSON string +const exampleJSON: string = JSON.stringify(example) +console.log(exampleJSON) + +// Parse the JSON string back to an object +const exampleParsed = JSON.parse(exampleJSON) as SpecialDriveItemUpdate +console.log(exampleParsed) +``` + +[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md) + + diff --git a/web/packages/web-client/src/graph/generated/docs/SpecialFolder.md b/web/packages/web-client/src/graph/generated/docs/SpecialFolder.md index 125b38b3984..79cbbca7745 100644 --- a/web/packages/web-client/src/graph/generated/docs/SpecialFolder.md +++ b/web/packages/web-client/src/graph/generated/docs/SpecialFolder.md @@ -1,7 +1,7 @@ # SpecialFolder -If the current item is also available as a special folder, this facet is returned. Read-only +If the current item is also available as a special folder, this facet is returned. ## Properties diff --git a/web/packages/web-client/src/graph/generated/models/AppRoleAssignment.ts b/web/packages/web-client/src/graph/generated/models/AppRoleAssignment.ts index 793dd5e92f7..467591fc59d 100644 --- a/web/packages/web-client/src/graph/generated/models/AppRoleAssignment.ts +++ b/web/packages/web-client/src/graph/generated/models/AppRoleAssignment.ts @@ -22,7 +22,7 @@ export interface AppRoleAssignment { /** * The unique identifier for the object. 12345678-9abc-def0-1234-56789abcde. The value of the ID property is often, but not exclusively, in the form of a GUID. The value should be treated as an opaque identifier and not based in being a GUID. Null values are not allowed. Read-only. */ - id?: string; + readonly id?: string; /** * */ @@ -93,14 +93,13 @@ export function AppRoleAssignmentToJSON(json: any): AppRoleAssignment { return AppRoleAssignmentToJSONTyped(json, false); } -export function AppRoleAssignmentToJSONTyped(value?: AppRoleAssignment | null, ignoreDiscriminator: boolean = false): any { +export function AppRoleAssignmentToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { - 'id': value['id'], 'deletedDateTime': value['deletedDateTime'], 'appRoleId': value['appRoleId'], 'createdDateTime': value['createdDateTime'], diff --git a/web/packages/web-client/src/graph/generated/models/Application.ts b/web/packages/web-client/src/graph/generated/models/Application.ts index ab0f21ba7e9..2e16c780d39 100644 --- a/web/packages/web-client/src/graph/generated/models/Application.ts +++ b/web/packages/web-client/src/graph/generated/models/Application.ts @@ -30,7 +30,7 @@ export interface Application { /** * The unique identifier for the object. 12345678-9abc-def0-1234-56789abcde. The value of the ID property is often, but not exclusively, in the form of a GUID. The value should be treated as an opaque identifier and not based in being a GUID. Null values are not allowed. Read-only. */ - id: string; + readonly id: string; /** * The collection of roles defined for the application. With app role assignments, these roles can be assigned to users, groups, or service principals associated with other applications. Not nullable. */ @@ -69,14 +69,13 @@ export function ApplicationToJSON(json: any): Application { return ApplicationToJSONTyped(json, false); } -export function ApplicationToJSONTyped(value?: Application | null, ignoreDiscriminator: boolean = false): any { +export function ApplicationToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { - 'id': value['id'], 'appRoles': value['appRoles'] == null ? undefined : ((value['appRoles'] as Array).map(AppRoleToJSON)), 'displayName': value['displayName'], }; diff --git a/web/packages/web-client/src/graph/generated/models/Drive.ts b/web/packages/web-client/src/graph/generated/models/Drive.ts index 891cba927d3..b5e799535a1 100644 --- a/web/packages/web-client/src/graph/generated/models/Drive.ts +++ b/web/packages/web-client/src/graph/generated/models/Drive.ts @@ -51,7 +51,7 @@ export interface Drive { /** * The unique identifier for this drive. */ - id?: string; + readonly id?: string; /** * */ @@ -59,7 +59,7 @@ export interface Drive { /** * Date and time of item creation. Read-only. */ - createdDateTime?: string; + readonly createdDateTime?: string; /** * Provides a user-visible description of the item. Optional. */ @@ -67,7 +67,7 @@ export interface Drive { /** * ETag for the item. Read-only. */ - eTag?: string; + readonly eTag?: string; /** * */ @@ -75,7 +75,7 @@ export interface Drive { /** * Date and time the item was last modified. Read-only. */ - lastModifiedDateTime?: string; + readonly lastModifiedDateTime?: string; /** * The name of the item. Read-write. */ @@ -87,9 +87,9 @@ export interface Drive { /** * URL that displays the resource in the browser. Read-only. */ - webUrl?: string; + readonly webUrl?: string; /** - * Describes the type of drive represented by this resource. Values are "personal" for users home spaces, "project", "virtual" or "share". Read-only. + * Describes the type of drive represented by this resource. Values are "personal" for users home spaces, "project", "virtual" or "share". Read-write on create, read-only afterwards, see the `driveUpdate` schema. */ driveType?: string; /** @@ -107,15 +107,15 @@ export interface Drive { /** * All items contained in the drive. Read-only. Nullable. */ - items?: Array; + readonly items?: Array; /** * */ root?: DriveItem; /** - * A collection of special drive resources. + * A collection of special drive resources. Read-only, see the `driveUpdate` schema for assigning them. */ - special?: Array; + readonly special?: Array; } /** @@ -160,30 +160,23 @@ export function DriveToJSON(json: any): Drive { return DriveToJSONTyped(json, false); } -export function DriveToJSONTyped(value?: Drive | null, ignoreDiscriminator: boolean = false): any { +export function DriveToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { - 'id': value['id'], 'createdBy': IdentitySetToJSON(value['createdBy']), - 'createdDateTime': value['createdDateTime'], 'description': value['description'], - 'eTag': value['eTag'], 'lastModifiedBy': IdentitySetToJSON(value['lastModifiedBy']), - 'lastModifiedDateTime': value['lastModifiedDateTime'], 'name': value['name'], 'parentReference': ItemReferenceToJSON(value['parentReference']), - 'webUrl': value['webUrl'], 'driveType': value['driveType'], 'driveAlias': value['driveAlias'], 'owner': IdentitySetToJSON(value['owner']), 'quota': QuotaToJSON(value['quota']), - 'items': value['items'] == null ? undefined : ((value['items'] as Array).map(DriveItemToJSON)), 'root': DriveItemToJSON(value['root']), - 'special': value['special'] == null ? undefined : ((value['special'] as Array).map(DriveItemToJSON)), }; } diff --git a/web/packages/web-client/src/graph/generated/models/DriveItem.ts b/web/packages/web-client/src/graph/generated/models/DriveItem.ts index c3275da21cd..fc0651b46de 100644 --- a/web/packages/web-client/src/graph/generated/models/DriveItem.ts +++ b/web/packages/web-client/src/graph/generated/models/DriveItem.ts @@ -127,7 +127,7 @@ import { } from './SpecialFolder'; /** - * Represents a resource inside a drive. Read-only. + * Represents a resource inside a drive. Most properties are read-only, but the schema is also used as a request body, see the individual properties. * @export * @interface DriveItem */ @@ -135,7 +135,7 @@ export interface DriveItem { /** * Read-only. */ - id?: string; + readonly id?: string; /** * */ @@ -143,7 +143,7 @@ export interface DriveItem { /** * Date and time of item creation. Read-only. */ - createdDateTime?: string; + readonly createdDateTime?: string; /** * Provides a user-visible description of the item. Optional. */ @@ -151,7 +151,7 @@ export interface DriveItem { /** * ETag for the item. Read-only. */ - eTag?: string; + readonly eTag?: string; /** * */ @@ -159,7 +159,7 @@ export interface DriveItem { /** * Date and time the item was last modified. Read-only. */ - lastModifiedDateTime?: string; + readonly lastModifiedDateTime?: string; /** * The name of the item. Read-write. */ @@ -171,7 +171,7 @@ export interface DriveItem { /** * URL that displays the resource in the browser. Read-only. */ - webUrl?: string; + readonly webUrl?: string; /** * The content stream, if the item represents a file. */ @@ -179,7 +179,7 @@ export interface DriveItem { /** * An eTag for the content of the item. This eTag is not changed if only the metadata is changed. Note This property is not returned if the item is a folder. Read-only. */ - cTag?: string; + readonly cTag?: string; /** * */ @@ -231,19 +231,19 @@ export interface DriveItem { /** * Size of the item in bytes. Read-only. */ - size?: number; + readonly size?: number; /** * WebDAV compatible URL for the item. Read-only. */ - webDavUrl?: string; + readonly webDavUrl?: string; /** * Collection containing Item objects for the immediate children of Item. Only items representing folders have children. Read-only. Nullable. */ - children?: Array; + readonly children?: Array; /** * The set of permissions for the item. Read-only. Nullable. */ - permissions?: Array; + readonly permissions?: Array; /** * */ @@ -318,25 +318,19 @@ export function DriveItemToJSON(json: any): DriveItem { return DriveItemToJSONTyped(json, false); } -export function DriveItemToJSONTyped(value?: DriveItem | null, ignoreDiscriminator: boolean = false): any { +export function DriveItemToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { - 'id': value['id'], 'createdBy': IdentitySetToJSON(value['createdBy']), - 'createdDateTime': value['createdDateTime'], 'description': value['description'], - 'eTag': value['eTag'], 'lastModifiedBy': IdentitySetToJSON(value['lastModifiedBy']), - 'lastModifiedDateTime': value['lastModifiedDateTime'], 'name': value['name'], 'parentReference': ItemReferenceToJSON(value['parentReference']), - 'webUrl': value['webUrl'], 'content': value['content'], - 'cTag': value['cTag'], 'deleted': DeletedToJSON(value['deleted']), 'file': OpenGraphFileToJSON(value['file']), 'fileSystemInfo': FileSystemInfoToJSON(value['fileSystemInfo']), @@ -349,10 +343,6 @@ export function DriveItemToJSONTyped(value?: DriveItem | null, ignoreDiscriminat 'trash': TrashToJSON(value['trash']), 'specialFolder': SpecialFolderToJSON(value['specialFolder']), 'remoteItem': RemoteItemToJSON(value['remoteItem']), - 'size': value['size'], - 'webDavUrl': value['webDavUrl'], - 'children': value['children'] == null ? undefined : ((value['children'] as Array).map(DriveItemToJSON)), - 'permissions': value['permissions'] == null ? undefined : ((value['permissions'] as Array).map(PermissionToJSON)), 'audio': AudioToJSON(value['audio']), 'video': VideoToJSON(value['video']), '@client.synchronize': value['atClientSynchronize'], diff --git a/web/packages/web-client/src/graph/generated/models/DriveUpdate.ts b/web/packages/web-client/src/graph/generated/models/DriveUpdate.ts index 39a0417030d..ac8f0e1d26f 100644 --- a/web/packages/web-client/src/graph/generated/models/DriveUpdate.ts +++ b/web/packages/web-client/src/graph/generated/models/DriveUpdate.ts @@ -20,6 +20,13 @@ import { ItemReferenceToJSON, ItemReferenceToJSONTyped, } from './ItemReference'; +import type { SpecialDriveItemUpdate } from './SpecialDriveItemUpdate'; +import { + SpecialDriveItemUpdateFromJSON, + SpecialDriveItemUpdateFromJSONTyped, + SpecialDriveItemUpdateToJSON, + SpecialDriveItemUpdateToJSONTyped, +} from './SpecialDriveItemUpdate'; import type { DriveItem } from './DriveItem'; import { DriveItemFromJSON, @@ -51,7 +58,7 @@ export interface DriveUpdate { /** * The unique identifier for this drive. */ - id?: string; + readonly id?: string; /** * */ @@ -59,7 +66,7 @@ export interface DriveUpdate { /** * Date and time of item creation. Read-only. */ - createdDateTime?: string; + readonly createdDateTime?: string; /** * Provides a user-visible description of the item. Optional. */ @@ -67,7 +74,7 @@ export interface DriveUpdate { /** * ETag for the item. Read-only. */ - eTag?: string; + readonly eTag?: string; /** * */ @@ -75,7 +82,7 @@ export interface DriveUpdate { /** * Date and time the item was last modified. Read-only. */ - lastModifiedDateTime?: string; + readonly lastModifiedDateTime?: string; /** * The name of the item. Read-write. */ @@ -87,11 +94,11 @@ export interface DriveUpdate { /** * URL that displays the resource in the browser. Read-only. */ - webUrl?: string; + readonly webUrl?: string; /** - * Describes the type of drive represented by this resource. Values are "personal" for users home spaces, "project", "virtual" or "share". Read-only. + * Describes the type of drive represented by this resource. Values are "personal" for users home spaces, "project", "virtual" or "share". Read-only, see the `drive` schema for creating a drive. */ - driveType?: string; + readonly driveType?: string; /** * The drive alias can be used in clients to make the urls user friendly. Example: 'personal/einstein'. This will be used to resolve to the correct driveID. */ @@ -107,15 +114,15 @@ export interface DriveUpdate { /** * All items contained in the drive. Read-only. Nullable. */ - items?: Array; + readonly items?: Array; /** * */ root?: DriveItem; /** - * A collection of special drive resources. + * A collection of special drive resources. See the `drive` schema for the resources returned by the server. */ - special?: Array; + special?: Array; } /** @@ -151,7 +158,7 @@ export function DriveUpdateFromJSONTyped(json: any, ignoreDiscriminator: boolean 'quota': json['quota'] == null ? undefined : QuotaFromJSON(json['quota']), 'items': json['items'] == null ? undefined : ((json['items'] as Array).map(DriveItemFromJSON)), 'root': json['root'] == null ? undefined : DriveItemFromJSON(json['root']), - 'special': json['special'] == null ? undefined : ((json['special'] as Array).map(DriveItemFromJSON)), + 'special': json['special'] == null ? undefined : ((json['special'] as Array).map(SpecialDriveItemUpdateFromJSON)), }; } @@ -159,30 +166,23 @@ export function DriveUpdateToJSON(json: any): DriveUpdate { return DriveUpdateToJSONTyped(json, false); } -export function DriveUpdateToJSONTyped(value?: DriveUpdate | null, ignoreDiscriminator: boolean = false): any { +export function DriveUpdateToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { - 'id': value['id'], 'createdBy': IdentitySetToJSON(value['createdBy']), - 'createdDateTime': value['createdDateTime'], 'description': value['description'], - 'eTag': value['eTag'], 'lastModifiedBy': IdentitySetToJSON(value['lastModifiedBy']), - 'lastModifiedDateTime': value['lastModifiedDateTime'], 'name': value['name'], 'parentReference': ItemReferenceToJSON(value['parentReference']), - 'webUrl': value['webUrl'], - 'driveType': value['driveType'], 'driveAlias': value['driveAlias'], 'owner': IdentitySetToJSON(value['owner']), 'quota': QuotaToJSON(value['quota']), - 'items': value['items'] == null ? undefined : ((value['items'] as Array).map(DriveItemToJSON)), 'root': DriveItemToJSON(value['root']), - 'special': value['special'] == null ? undefined : ((value['special'] as Array).map(DriveItemToJSON)), + 'special': value['special'] == null ? undefined : ((value['special'] as Array).map(SpecialDriveItemUpdateToJSON)), }; } diff --git a/web/packages/web-client/src/graph/generated/models/EducationClass.ts b/web/packages/web-client/src/graph/generated/models/EducationClass.ts index 3245915d691..9b39dfbd637 100644 --- a/web/packages/web-client/src/graph/generated/models/EducationClass.ts +++ b/web/packages/web-client/src/graph/generated/models/EducationClass.ts @@ -30,7 +30,7 @@ export interface EducationClass { /** * Read-only. */ - id?: string; + readonly id?: string; /** * An optional description for the group. Returned by default. */ @@ -99,14 +99,13 @@ export function EducationClassToJSON(json: any): EducationClass { return EducationClassToJSONTyped(json, false); } -export function EducationClassToJSONTyped(value?: EducationClass | null, ignoreDiscriminator: boolean = false): any { +export function EducationClassToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { - 'id': value['id'], 'description': value['description'], 'displayName': value['displayName'], 'members': value['members'] == null ? undefined : ((value['members'] as Array).map(UserToJSON)), diff --git a/web/packages/web-client/src/graph/generated/models/EducationSchool.ts b/web/packages/web-client/src/graph/generated/models/EducationSchool.ts index 65ea8f4fc42..799850471e0 100644 --- a/web/packages/web-client/src/graph/generated/models/EducationSchool.ts +++ b/web/packages/web-client/src/graph/generated/models/EducationSchool.ts @@ -22,7 +22,7 @@ export interface EducationSchool { /** * The unique identifier for an entity. Read-only. */ - id?: string; + readonly id?: string; /** * The organization name */ @@ -65,14 +65,13 @@ export function EducationSchoolToJSON(json: any): EducationSchool { return EducationSchoolToJSONTyped(json, false); } -export function EducationSchoolToJSONTyped(value?: EducationSchool | null, ignoreDiscriminator: boolean = false): any { +export function EducationSchoolToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { - 'id': value['id'], 'displayName': value['displayName'], 'schoolNumber': value['schoolNumber'], 'terminationDate': value['terminationDate'], diff --git a/web/packages/web-client/src/graph/generated/models/EducationUser.ts b/web/packages/web-client/src/graph/generated/models/EducationUser.ts index a0fdacce0da..ed044d44430 100644 --- a/web/packages/web-client/src/graph/generated/models/EducationUser.ts +++ b/web/packages/web-client/src/graph/generated/models/EducationUser.ts @@ -51,7 +51,7 @@ export interface EducationUser { /** * Read-only. */ - id?: string; + readonly id?: string; /** * Set to "true" when the account is enabled. */ @@ -63,7 +63,7 @@ export interface EducationUser { /** * A collection of drives available for this user. Read-only. */ - drives?: Array; + readonly drives?: Array; /** * */ @@ -149,17 +149,15 @@ export function EducationUserToJSON(json: any): EducationUser { return EducationUserToJSONTyped(json, false); } -export function EducationUserToJSONTyped(value?: EducationUser | null, ignoreDiscriminator: boolean = false): any { +export function EducationUserToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { - 'id': value['id'], 'accountEnabled': value['accountEnabled'], 'displayName': value['displayName'], - 'drives': value['drives'] == null ? undefined : ((value['drives'] as Array).map(DriveToJSON)), 'drive': DriveToJSON(value['drive']), 'identities': value['identities'] == null ? undefined : ((value['identities'] as Array).map(ObjectIdentityToJSON)), 'mail': value['mail'], diff --git a/web/packages/web-client/src/graph/generated/models/Group.ts b/web/packages/web-client/src/graph/generated/models/Group.ts index 5d6901f02ad..eb593839b7c 100644 --- a/web/packages/web-client/src/graph/generated/models/Group.ts +++ b/web/packages/web-client/src/graph/generated/models/Group.ts @@ -30,7 +30,7 @@ export interface Group { /** * Read-only. */ - id?: string; + readonly id?: string; /** * An optional description for the group. Returned by default. */ @@ -83,14 +83,13 @@ export function GroupToJSON(json: any): Group { return GroupToJSONTyped(json, false); } -export function GroupToJSONTyped(value?: Group | null, ignoreDiscriminator: boolean = false): any { +export function GroupToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { - 'id': value['id'], 'description': value['description'], 'displayName': value['displayName'], 'groupTypes': value['groupTypes'], diff --git a/web/packages/web-client/src/graph/generated/models/Image.ts b/web/packages/web-client/src/graph/generated/models/Image.ts index 17a63a321f7..827c62c30bb 100644 --- a/web/packages/web-client/src/graph/generated/models/Image.ts +++ b/web/packages/web-client/src/graph/generated/models/Image.ts @@ -22,11 +22,11 @@ export interface Image { /** * Optional. Height of the image, in pixels. Read-only. */ - height?: number; + readonly height?: number; /** * Optional. Width of the image, in pixels. Read-only. */ - width?: number; + readonly width?: number; } /** @@ -55,15 +55,13 @@ export function ImageToJSON(json: any): Image { return ImageToJSONTyped(json, false); } -export function ImageToJSONTyped(value?: Image | null, ignoreDiscriminator: boolean = false): any { +export function ImageToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { - 'height': value['height'], - 'width': value['width'], }; } diff --git a/web/packages/web-client/src/graph/generated/models/ItemReference.ts b/web/packages/web-client/src/graph/generated/models/ItemReference.ts index 81a00469da5..26d6c178f6d 100644 --- a/web/packages/web-client/src/graph/generated/models/ItemReference.ts +++ b/web/packages/web-client/src/graph/generated/models/ItemReference.ts @@ -22,23 +22,23 @@ export interface ItemReference { /** * Unique identifier of the drive instance that contains the item. Read-only. */ - driveId?: string; + readonly driveId?: string; /** * Identifies the type of drive. See [drive][] resource for values. Read-only. */ - driveType?: string; + readonly driveType?: string; /** * Unique identifier of the item in the drive. Read-only. */ - id?: string; + readonly id?: string; /** * The name of the item being referenced. Read-only. */ - name?: string; + readonly name?: string; /** * Path that can be used to navigate to the item. Read-only. */ - path?: string; + readonly path?: string; } /** @@ -70,18 +70,13 @@ export function ItemReferenceToJSON(json: any): ItemReference { return ItemReferenceToJSONTyped(json, false); } -export function ItemReferenceToJSONTyped(value?: ItemReference | null, ignoreDiscriminator: boolean = false): any { +export function ItemReferenceToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { - 'driveId': value['driveId'], - 'driveType': value['driveType'], - 'id': value['id'], - 'name': value['name'], - 'path': value['path'], }; } diff --git a/web/packages/web-client/src/graph/generated/models/OpenGraphFile.ts b/web/packages/web-client/src/graph/generated/models/OpenGraphFile.ts index 154b12db5e5..75b39b9cb6b 100644 --- a/web/packages/web-client/src/graph/generated/models/OpenGraphFile.ts +++ b/web/packages/web-client/src/graph/generated/models/OpenGraphFile.ts @@ -34,7 +34,7 @@ export interface OpenGraphFile { /** * The MIME type for the file. This is determined by logic on the server and might not be the value provided when the file was uploaded. Read-only. */ - mimeType?: string; + readonly mimeType?: string; /** * */ @@ -68,7 +68,7 @@ export function OpenGraphFileToJSON(json: any): OpenGraphFile { return OpenGraphFileToJSONTyped(json, false); } -export function OpenGraphFileToJSONTyped(value?: OpenGraphFile | null, ignoreDiscriminator: boolean = false): any { +export function OpenGraphFileToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } @@ -76,7 +76,6 @@ export function OpenGraphFileToJSONTyped(value?: OpenGraphFile | null, ignoreDis return { 'hashes': HashesToJSON(value['hashes']), - 'mimeType': value['mimeType'], 'processingMetadata': value['processingMetadata'], }; } diff --git a/web/packages/web-client/src/graph/generated/models/Permission.ts b/web/packages/web-client/src/graph/generated/models/Permission.ts index e792bd96378..2c95779b76e 100644 --- a/web/packages/web-client/src/graph/generated/models/Permission.ts +++ b/web/packages/web-client/src/graph/generated/models/Permission.ts @@ -60,13 +60,13 @@ export interface Permission { /** * The unique identifier of the permission among all permissions on the item. Read-only. */ - id?: string; + readonly id?: string; /** * Indicates whether the password is set for this permission. This property only * appears in the response. Optional. Read-only. * */ - hasPassword?: boolean; + readonly hasPassword?: boolean; /** * An optional expiration date which limits the permission in time. */ @@ -136,15 +136,13 @@ export function PermissionToJSON(json: any): Permission { return PermissionToJSONTyped(json, false); } -export function PermissionToJSONTyped(value?: Permission | null, ignoreDiscriminator: boolean = false): any { +export function PermissionToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { - 'id': value['id'], - 'hasPassword': value['hasPassword'], 'expirationDateTime': value['expirationDateTime'], 'createdDateTime': value['createdDateTime'], 'grantedToV2': SharePointIdentitySetToJSON(value['grantedToV2']), diff --git a/web/packages/web-client/src/graph/generated/models/Quota.ts b/web/packages/web-client/src/graph/generated/models/Quota.ts index 92f7da7c79d..9ec8e5cf246 100644 --- a/web/packages/web-client/src/graph/generated/models/Quota.ts +++ b/web/packages/web-client/src/graph/generated/models/Quota.ts @@ -14,7 +14,7 @@ import { mapValues } from '../runtime'; /** - * Optional. Information about the drive's storage space quota. Read-only. + * Optional. Information about the drive's storage space quota. Only `total` is writable, the other properties are computed by the server and read-only. * @export * @interface Quota */ @@ -22,23 +22,23 @@ export interface Quota { /** * Total space consumed by files in the recycle bin, in bytes. Read-only. */ - deleted?: number; + readonly deleted?: number; /** * Total space remaining before reaching the quota limit, in bytes. Read-only. */ - remaining?: number; + readonly remaining?: number; /** * Enumeration value that indicates the state of the storage space. Either "normal", "nearing", "critical" or "exceeded". Read-only. */ - state?: string; + readonly state?: string; /** - * Total allowed storage space, in bytes. Read-only. + * Total allowed storage space, in bytes. Read-write. */ total?: number; /** * Total space used, in bytes. Read-only. */ - used?: number; + readonly used?: number; } /** @@ -70,18 +70,14 @@ export function QuotaToJSON(json: any): Quota { return QuotaToJSONTyped(json, false); } -export function QuotaToJSONTyped(value?: Quota | null, ignoreDiscriminator: boolean = false): any { +export function QuotaToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { - 'deleted': value['deleted'], - 'remaining': value['remaining'], - 'state': value['state'], 'total': value['total'], - 'used': value['used'], }; } diff --git a/web/packages/web-client/src/graph/generated/models/RemoteItem.ts b/web/packages/web-client/src/graph/generated/models/RemoteItem.ts index 59815702b86..68f0393d269 100644 --- a/web/packages/web-client/src/graph/generated/models/RemoteItem.ts +++ b/web/packages/web-client/src/graph/generated/models/RemoteItem.ts @@ -131,11 +131,11 @@ export interface RemoteItem { /** * ETag for the item. Read-only. */ - eTag?: string; + readonly eTag?: string; /** * An eTag for the content of the item. This eTag is not changed if only the metadata is changed. Note This property is not returned if the item is a folder. Read-only. */ - cTag?: string; + readonly cTag?: string; /** * */ @@ -143,7 +143,7 @@ export interface RemoteItem { /** * The set of permissions for the item. Read-only. Nullable. */ - permissions?: Array; + readonly permissions?: Array; /** * Size of the remote item. Read-only. */ @@ -212,7 +212,7 @@ export function RemoteItemToJSON(json: any): RemoteItem { return RemoteItemToJSONTyped(json, false); } -export function RemoteItemToJSONTyped(value?: RemoteItem | null, ignoreDiscriminator: boolean = false): any { +export function RemoteItemToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } @@ -232,10 +232,7 @@ export function RemoteItemToJSONTyped(value?: RemoteItem | null, ignoreDiscrimin 'lastModifiedBy': IdentitySetToJSON(value['lastModifiedBy']), 'lastModifiedDateTime': value['lastModifiedDateTime'], 'name': value['name'], - 'eTag': value['eTag'], - 'cTag': value['cTag'], 'parentReference': ItemReferenceToJSON(value['parentReference']), - 'permissions': value['permissions'] == null ? undefined : ((value['permissions'] as Array).map(PermissionToJSON)), 'size': value['size'], 'specialFolder': SpecialFolderToJSON(value['specialFolder']), 'webDavUrl': value['webDavUrl'], diff --git a/web/packages/web-client/src/graph/generated/models/SharingLink.ts b/web/packages/web-client/src/graph/generated/models/SharingLink.ts index 0cb41d64dc4..8fa133431bc 100644 --- a/web/packages/web-client/src/graph/generated/models/SharingLink.ts +++ b/web/packages/web-client/src/graph/generated/models/SharingLink.ts @@ -37,11 +37,11 @@ export interface SharingLink { /** * If `true` then the user can only use this link to view the item on the web, and cannot use it to download the contents of the item. */ - preventsDownload?: boolean; + readonly preventsDownload?: boolean; /** * A URL that opens the item in the browser on the website. */ - webUrl?: string; + readonly webUrl?: string; /** * Provides a user-visible display name of the link. Optional. Libregraph only. */ @@ -83,7 +83,7 @@ export function SharingLinkToJSON(json: any): SharingLink { return SharingLinkToJSONTyped(json, false); } -export function SharingLinkToJSONTyped(value?: SharingLink | null, ignoreDiscriminator: boolean = false): any { +export function SharingLinkToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } @@ -91,8 +91,6 @@ export function SharingLinkToJSONTyped(value?: SharingLink | null, ignoreDiscrim return { 'type': SharingLinkTypeToJSON(value['type']), - 'preventsDownload': value['preventsDownload'], - 'webUrl': value['webUrl'], '@libre.graph.displayName': value['atLibreGraphDisplayName'], '@libre.graph.quickLink': value['atLibreGraphQuickLink'], }; diff --git a/web/packages/web-client/src/graph/generated/models/SpecialDriveItemUpdate.ts b/web/packages/web-client/src/graph/generated/models/SpecialDriveItemUpdate.ts new file mode 100644 index 00000000000..85e65724af5 --- /dev/null +++ b/web/packages/web-client/src/graph/generated/models/SpecialDriveItemUpdate.ts @@ -0,0 +1,77 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * Libre Graph API + * Libre Graph is a free API for cloud collaboration inspired by the MS Graph API. + * + * The version of the OpenAPI document: v1.0.4 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { SpecialFolder } from './SpecialFolder'; +import { + SpecialFolderFromJSON, + SpecialFolderFromJSONTyped, + SpecialFolderToJSON, + SpecialFolderToJSONTyped, +} from './SpecialFolder'; + +/** + * References an existing item inside a drive to be assigned as one of the drive's special resources, such as its image or readme. + * @export + * @interface SpecialDriveItemUpdate + */ +export interface SpecialDriveItemUpdate { + /** + * The unique identifier of the item to assign. Read-write. + */ + id?: string; + /** + * + */ + specialFolder?: SpecialFolder; +} + +/** + * Check if a given object implements the SpecialDriveItemUpdate interface. + */ +export function instanceOfSpecialDriveItemUpdate(value: object): value is SpecialDriveItemUpdate { + return true; +} + +export function SpecialDriveItemUpdateFromJSON(json: any): SpecialDriveItemUpdate { + return SpecialDriveItemUpdateFromJSONTyped(json, false); +} + +export function SpecialDriveItemUpdateFromJSONTyped(json: any, ignoreDiscriminator: boolean): SpecialDriveItemUpdate { + if (json == null) { + return json; + } + return { + + 'id': json['id'] == null ? undefined : json['id'], + 'specialFolder': json['specialFolder'] == null ? undefined : SpecialFolderFromJSON(json['specialFolder']), + }; +} + +export function SpecialDriveItemUpdateToJSON(json: any): SpecialDriveItemUpdate { + return SpecialDriveItemUpdateToJSONTyped(json, false); +} + +export function SpecialDriveItemUpdateToJSONTyped(value?: SpecialDriveItemUpdate | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'specialFolder': SpecialFolderToJSON(value['specialFolder']), + }; +} + diff --git a/web/packages/web-client/src/graph/generated/models/SpecialFolder.ts b/web/packages/web-client/src/graph/generated/models/SpecialFolder.ts index 294ceb5f227..12faacda1b2 100644 --- a/web/packages/web-client/src/graph/generated/models/SpecialFolder.ts +++ b/web/packages/web-client/src/graph/generated/models/SpecialFolder.ts @@ -14,7 +14,7 @@ import { mapValues } from '../runtime'; /** - * If the current item is also available as a special folder, this facet is returned. Read-only + * If the current item is also available as a special folder, this facet is returned. * @export * @interface SpecialFolder */ diff --git a/web/packages/web-client/src/graph/generated/models/User.ts b/web/packages/web-client/src/graph/generated/models/User.ts index 9c562ed041c..ef832fd147e 100644 --- a/web/packages/web-client/src/graph/generated/models/User.ts +++ b/web/packages/web-client/src/graph/generated/models/User.ts @@ -72,7 +72,7 @@ export interface User { /** * Read-only. */ - id?: string; + readonly id?: string; /** * Set to "true" when the account is enabled. */ @@ -80,7 +80,7 @@ export interface User { /** * The apps and app roles which this user has been assigned. */ - appRoleAssignments?: Array; + readonly appRoleAssignments?: Array; /** * The name displayed in the address book for the user. This value is usually the combination of the user's first name, middle initial, and last name. This property is required when a user is created and it cannot be cleared during updates. Returned by default. Supports $orderby. */ @@ -88,7 +88,7 @@ export interface User { /** * A collection of drives available for this user. Read-only. */ - drives?: Array; + readonly drives?: Array; /** * */ @@ -104,7 +104,7 @@ export interface User { /** * Groups that this user is a member of. HTTP Methods: GET (supported for all groups). Read-only. Nullable. Supports $expand. */ - memberOf?: Array; + readonly memberOf?: Array; /** * Contains the on-premises SAM account name synchronized from the on-premises directory. */ @@ -124,7 +124,7 @@ export interface User { /** * The user`s type. This can be either "Member" for regular user, "Guest" for guest users or "Federated" for users imported from a federated instance. */ - userType?: string; + readonly userType?: string; /** * Represents the users language setting, ISO-639-1 Code */ @@ -197,27 +197,22 @@ export function UserToJSON(json: any): User { return UserToJSONTyped(json, false); } -export function UserToJSONTyped(value?: User | null, ignoreDiscriminator: boolean = false): any { +export function UserToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { - 'id': value['id'], 'accountEnabled': value['accountEnabled'], - 'appRoleAssignments': value['appRoleAssignments'] == null ? undefined : ((value['appRoleAssignments'] as Array).map(AppRoleAssignmentToJSON)), 'displayName': value['displayName'], - 'drives': value['drives'] == null ? undefined : ((value['drives'] as Array).map(DriveToJSON)), 'drive': DriveToJSON(value['drive']), 'identities': value['identities'] == null ? undefined : ((value['identities'] as Array).map(ObjectIdentityToJSON)), 'mail': value['mail'], - 'memberOf': value['memberOf'] == null ? undefined : ((value['memberOf'] as Array).map(GroupToJSON)), 'onPremisesSamAccountName': value['onPremisesSamAccountName'], 'passwordProfile': PasswordProfileToJSON(value['passwordProfile']), 'surname': value['surname'], 'givenName': value['givenName'], - 'userType': value['userType'], 'preferredLanguage': value['preferredLanguage'], 'signInActivity': SignInActivityToJSON(value['signInActivity']), 'externalID': value['externalID'], diff --git a/web/packages/web-client/src/graph/generated/models/UserUpdate.ts b/web/packages/web-client/src/graph/generated/models/UserUpdate.ts index ef117ddc409..7da85958b9e 100644 --- a/web/packages/web-client/src/graph/generated/models/UserUpdate.ts +++ b/web/packages/web-client/src/graph/generated/models/UserUpdate.ts @@ -72,7 +72,7 @@ export interface UserUpdate { /** * Read-only. */ - id?: string; + readonly id?: string; /** * Set to "true" when the account is enabled. */ @@ -80,7 +80,7 @@ export interface UserUpdate { /** * The apps and app roles which this user has been assigned. */ - appRoleAssignments?: Array; + readonly appRoleAssignments?: Array; /** * The name displayed in the address book for the user. This value is usually the combination of the user's first name, middle initial, and last name. This property is required when a user is created and it cannot be cleared during updates. Returned by default. Supports $orderby. */ @@ -88,7 +88,7 @@ export interface UserUpdate { /** * A collection of drives available for this user. Read-only. */ - drives?: Array; + readonly drives?: Array; /** * */ @@ -104,7 +104,7 @@ export interface UserUpdate { /** * Groups that this user is a member of. HTTP Methods: GET (supported for all groups). Read-only. Nullable. Supports $expand. */ - memberOf?: Array; + readonly memberOf?: Array; /** * Contains the on-premises SAM account name synchronized from the on-premises directory. */ @@ -124,7 +124,7 @@ export interface UserUpdate { /** * The user`s type. This can be either "Member" for regular user, "Guest" for guest users or "Federated" for users imported from a federated instance. */ - userType?: string; + readonly userType?: string; /** * Represents the users language setting, ISO-639-1 Code */ @@ -190,27 +190,22 @@ export function UserUpdateToJSON(json: any): UserUpdate { return UserUpdateToJSONTyped(json, false); } -export function UserUpdateToJSONTyped(value?: UserUpdate | null, ignoreDiscriminator: boolean = false): any { +export function UserUpdateToJSONTyped(value?: Omit | null, ignoreDiscriminator: boolean = false): any { if (value == null) { return value; } return { - 'id': value['id'], 'accountEnabled': value['accountEnabled'], - 'appRoleAssignments': value['appRoleAssignments'] == null ? undefined : ((value['appRoleAssignments'] as Array).map(AppRoleAssignmentToJSON)), 'displayName': value['displayName'], - 'drives': value['drives'] == null ? undefined : ((value['drives'] as Array).map(DriveToJSON)), 'drive': DriveToJSON(value['drive']), 'identities': value['identities'] == null ? undefined : ((value['identities'] as Array).map(ObjectIdentityToJSON)), 'mail': value['mail'], - 'memberOf': value['memberOf'] == null ? undefined : ((value['memberOf'] as Array).map(GroupToJSON)), 'onPremisesSamAccountName': value['onPremisesSamAccountName'], 'passwordProfile': PasswordProfileToJSON(value['passwordProfile']), 'surname': value['surname'], 'givenName': value['givenName'], - 'userType': value['userType'], 'preferredLanguage': value['preferredLanguage'], 'signInActivity': SignInActivityToJSON(value['signInActivity']), 'externalID': value['externalID'], diff --git a/web/packages/web-client/src/graph/generated/models/index.ts b/web/packages/web-client/src/graph/generated/models/index.ts index fb6b864dbe8..900f554c2bd 100644 --- a/web/packages/web-client/src/graph/generated/models/index.ts +++ b/web/packages/web-client/src/graph/generated/models/index.ts @@ -68,6 +68,7 @@ export * from './SharingLink'; export * from './SharingLinkPassword'; export * from './SharingLinkType'; export * from './SignInActivity'; +export * from './SpecialDriveItemUpdate'; export * from './SpecialFolder'; export * from './TagAssignment'; export * from './TagUnassignment'; diff --git a/web/packages/web-client/src/helpers/space/functions.ts b/web/packages/web-client/src/helpers/space/functions.ts index 324435a4af5..5e0a0a0b730 100644 --- a/web/packages/web-client/src/helpers/space/functions.ts +++ b/web/packages/web-client/src/helpers/space/functions.ts @@ -145,11 +145,11 @@ export function buildSpace( spaceReadmeData = data.special.find((el) => el.specialFolder.name === 'readme') if (spaceImageData) { - spaceImageData.webDavUrl = decodeURI(spaceImageData.webDavUrl) + spaceImageData = { ...spaceImageData, webDavUrl: decodeURI(spaceImageData.webDavUrl) } } if (spaceReadmeData) { - spaceReadmeData.webDavUrl = decodeURI(spaceReadmeData.webDavUrl) + spaceReadmeData = { ...spaceReadmeData, webDavUrl: decodeURI(spaceReadmeData.webDavUrl) } } } diff --git a/web/packages/web-client/tests/unit/graph/drives.spec.ts b/web/packages/web-client/tests/unit/graph/drives.spec.ts index 4c92ebbce44..5ab71a6acab 100644 --- a/web/packages/web-client/tests/unit/graph/drives.spec.ts +++ b/web/packages/web-client/tests/unit/graph/drives.spec.ts @@ -23,9 +23,10 @@ describe('graph drives', () => { describe('updateDrive', () => { /** - * The spec marks every `Quota` field read-only, which the generator honours by omitting - * them from its serializers. Without stripping the annotation before generating, the - * quota would silently leave as `{}` and the drive would keep its old limit. + * A `readOnly: true` in the spec makes the generator omit the field from its serializers, + * so a field oCIS does read on write but that the spec marks read-only leaves as `{}` or + * disappears entirely — the request still succeeds, it just does nothing. Type checking + * cannot catch that, hence these tests assert on the serialized body. */ it('sends the quota in the request body', async () => { await graph('https://host', new FetchClient()).drives.updateDrive( @@ -38,6 +39,17 @@ describe('graph drives', () => { expect(body.quota).toEqual({ total: 500 }) }) + it.each(['image', 'readme'])('sends the id of the %s special folder', async (name) => { + await graph('https://host', new FetchClient()).drives.updateDrive( + drive.id, + { name: drive.name, special: [{ specialFolder: { name }, id: 'file-id' }] }, + {} + ) + + const body = JSON.parse(fetchMock.mock.calls[0][1].body) + expect(body.special).toEqual([{ specialFolder: { name }, id: 'file-id' }]) + }) + it('returns the updated quota on the space', async () => { const space = await graph('https://host', new FetchClient()).drives.updateDrive( drive.id, diff --git a/web/packages/web-client/tests/unit/helpers/share/functions.spec.ts b/web/packages/web-client/tests/unit/helpers/share/functions.spec.ts index def1b00a4df..b4a6fa9d8be 100644 --- a/web/packages/web-client/tests/unit/helpers/share/functions.spec.ts +++ b/web/packages/web-client/tests/unit/helpers/share/functions.spec.ts @@ -76,7 +76,9 @@ describe('share helper functions', () => { describe('getShareResourceRoles', () => { it("returns all roles from a drive item's permissions that are also included in the graphRoles", () => { const driveItem = mockDeep() - driveItem.remoteItem.permissions = [{ roles: ['1', '2'] }, { roles: ['1', '3'] }] + Object.assign(driveItem.remoteItem, { + permissions: [{ roles: ['1', '2'] }, { roles: ['1', '3'] }] + }) const graphRoles = { '1': mock({ id: '1' }), '4': mock({ id: '4' }) } const result = getShareResourceRoles({ driveItem, graphRoles }) @@ -101,10 +103,12 @@ describe('share helper functions', () => { it('returns permissions based on a drive item if no graph share roles given', () => { const permissions = ['view', 'edit'] const driveItem = mockDeep() - driveItem.remoteItem.permissions = [ - { atLibreGraphPermissionsActions: [permissions[0]] }, - { atLibreGraphPermissionsActions: [permissions[1]] } - ] + Object.assign(driveItem.remoteItem, { + permissions: [ + { atLibreGraphPermissionsActions: [permissions[0]] }, + { atLibreGraphPermissionsActions: [permissions[1]] } + ] + }) const result = getShareResourcePermissions({ driveItem, shareRoles: [] }) @@ -116,13 +120,15 @@ describe('share helper functions', () => { const driveItem = mockDeep({ id: 'driveItemId', name: 'driveItemName' }) const sharedBy = { id: '1', displayName: 'user1' } as Identity const sharedWith = { id: '2', displayName: 'user2' } as Identity - driveItem.remoteItem.permissions = [ - { - roles: ['1', '2'], - invitation: { invitedBy: { user: sharedBy } }, - grantedToV2: { user: sharedWith } - } - ] + Object.assign(driveItem.remoteItem, { + permissions: [ + { + roles: ['1', '2'], + invitation: { invitedBy: { user: sharedBy } }, + grantedToV2: { user: sharedWith } + } + ] + }) const graphRoles = { '1': mock({ id: '1', rolePermissions: [{ allowedResourceActions: ['view'] }] }), @@ -167,16 +173,18 @@ describe('share helper functions', () => { describe('buildOutgoingShareResource', () => { const driveItem = mockDeep({ id: 'driveItemId', name: 'driveItemName' }) - driveItem.parentReference.path = '' + Object.assign(driveItem.parentReference, { path: '' }) const sharedBy = { id: '1', displayName: 'user1' } as Identity const sharedWith = { id: '2', displayName: 'user2' } as Identity - driveItem.permissions = [ - { - roles: ['1', '2'], - invitation: { invitedBy: { user: sharedBy } }, - grantedToV2: { user: sharedWith } - } - ] + Object.assign(driveItem, { + permissions: [ + { + roles: ['1', '2'], + invitation: { invitedBy: { user: sharedBy } }, + grantedToV2: { user: sharedWith } + } + ] + }) const user = { id: '1', displayName: 'user1' } as User it('sets ids based on the drive item, its first permission and parent reference', () => { diff --git a/web/packages/web-pkg/src/composables/actions/spaces/useSpaceActionsDuplicate.ts b/web/packages/web-pkg/src/composables/actions/spaces/useSpaceActionsDuplicate.ts index 637e8cffeb8..6d20facc8c6 100644 --- a/web/packages/web-pkg/src/composables/actions/spaces/useSpaceActionsDuplicate.ts +++ b/web/packages/web-pkg/src/composables/actions/spaces/useSpaceActionsDuplicate.ts @@ -6,7 +6,7 @@ import { useAbility } from '../../ability' import { useClientService } from '../../clientService' import { useLoadingService } from '../../loadingService' import { isProjectSpaceResource } from '@ownclouders/web-client' -import { Drive } from '@ownclouders/web-client/graph/generated' +import { DriveUpdate } from '@ownclouders/web-client/graph/generated' import { resolveFileNameDuplicate } from '../../../helpers/resource/conflictHandling' import PQueue from 'p-queue' import { useRouter } from '../../router' @@ -70,7 +70,7 @@ export const useSpaceActionsDuplicate = () => { if (existingSpace.spaceReadmeData || existingSpace.spaceImageData) { const specialRequestData = { special: [] - } as Drive + } as DriveUpdate if (existingSpace.spaceReadmeData) { const newSpaceReadmeFile = await clientService.webdav.getFileInfo(duplicatedSpace, {