Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sdk blobs #7868

Merged
merged 7 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions buildSrc/RustGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,12 @@ function rustValueType(valueName, type, value) {
let innerType
if (valueName === "_id" && (type.type === Type.ListElement || type.type === Type.BlobElement)) {
if (value.type === ValueType.CustomId) {
innerType = "IdTupleCustom"
innerType = "Option<IdTupleCustom>"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's probably no way for us to avoid making IDs optional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there probably is, but I think it would involve some major changes to how we think about entities and their metadata

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or at least we would need a "here's data to create this thing" structure for each of them so yeah, just was wondering if you considered some options. I will admit (reluctantly) that this is probably the most pragmatic option

} else {
innerType = "IdTupleGenerated"
innerType = "Option<IdTupleGenerated>"
}
} else if (valueName === "_id") {
innerType = `Option<${ValueToRustTypes[value.type]}>`
} else {
innerType = ValueToRustTypes[value.type]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export async function initLocator(worker: CalendarWorkerImpl, browserData: Brows
locator.restClient = new RestClient(suspensionHandler, domainConfig)
locator.serviceExecutor = new ServiceExecutor(locator.restClient, locator.user, locator.instanceMapper, () => locator.crypto)
locator.entropyFacade = new EntropyFacade(locator.user, locator.serviceExecutor, random, () => locator.keyLoader)
locator.blobAccessToken = new BlobAccessTokenFacade(locator.serviceExecutor, dateProvider, locator.user)
locator.blobAccessToken = new BlobAccessTokenFacade(locator.serviceExecutor, locator.user, dateProvider)
const entityRestClient = new EntityRestClient(locator.user, locator.restClient, () => locator.crypto, locator.instanceMapper, locator.blobAccessToken)

locator.native = worker
Expand Down
6 changes: 1 addition & 5 deletions src/common/api/worker/facades/BlobAccessTokenFacade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,7 @@ export class BlobAccessTokenFacade {
// cache for upload requests are valid for the whole archive (key:<ownerGroup + archiveDataType>).
private readonly writeCache: BlobAccessTokenCache<string>

constructor(
private readonly serviceExecutor: IServiceExecutor,
private readonly dateProvider: DateProvider,
private readonly authDataProvider: AuthDataProvider,
) {
constructor(private readonly serviceExecutor: IServiceExecutor, private readonly authDataProvider: AuthDataProvider, dateProvider: DateProvider) {
this.readArchiveCache = new BlobAccessTokenCache<Id>(dateProvider)
this.readBlobCache = new BlobAccessTokenCache<Id>(dateProvider)
this.writeCache = new BlobAccessTokenCache<string>(dateProvider)
Expand Down
2 changes: 1 addition & 1 deletion src/common/api/worker/rest/RestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export class RestClient {
const queryParams: Dict = options.queryParams ?? {}

if (method === HttpMethod.GET && typeof options.body === "string") {
queryParams["_body"] = options.body // get requests are not allowed to send a body. Therefore, we convert our body to a paramater
queryParams["_body"] = options.body // get requests are not allowed to send a body. Therefore, we convert our body to a parameter
}

if (options.noCORS) {
Expand Down
2 changes: 1 addition & 1 deletion src/mail-app/workerUtils/worker/WorkerLocator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export async function initLocator(worker: WorkerImpl, browserData: BrowserData)
locator.restClient = new RestClient(suspensionHandler, domainConfig)
locator.serviceExecutor = new ServiceExecutor(locator.restClient, locator.user, locator.instanceMapper, () => locator.crypto)
locator.entropyFacade = new EntropyFacade(locator.user, locator.serviceExecutor, random, () => locator.keyLoader)
locator.blobAccessToken = new BlobAccessTokenFacade(locator.serviceExecutor, dateProvider, locator.user)
locator.blobAccessToken = new BlobAccessTokenFacade(locator.serviceExecutor, locator.user, dateProvider)
const entityRestClient = new EntityRestClient(locator.user, locator.restClient, () => locator.crypto, locator.instanceMapper, locator.blobAccessToken)

locator.native = worker
Expand Down
2 changes: 1 addition & 1 deletion test/tests/api/worker/facades/BlobAccessTokenFacadeTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ o.spec("BlobAccessTokenFacade test", function () {
}
serviceMock = object<ServiceExecutor>()
authDataProvider = object<AuthDataProvider>()
blobAccessTokenFacade = new BlobAccessTokenFacade(serviceMock, dateProvider, authDataProvider)
blobAccessTokenFacade = new BlobAccessTokenFacade(serviceMock, authDataProvider, dateProvider)
})

o.afterEach(function () {
Expand Down
Loading