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

fix(browser): use auth mode in query string in browser #1250

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/algoliasearch/src/builds/browser.ts
Expand Up @@ -17,7 +17,7 @@ import {
stopABTest,
StopABTestResponse,
} from '@algolia/client-analytics';
import { version, WaitablePromise } from '@algolia/client-common';
import { AuthMode, version, WaitablePromise } from '@algolia/client-common';
import {
createRecommendationClient,
getPersonalizationStrategy,
Expand Down Expand Up @@ -201,6 +201,7 @@ export default function algoliasearch(
],
}),
userAgent: createUserAgent(version).add({ segment: 'Browser' }),
authMode: AuthMode.WithinQueryParameters,
};

return createSearchClient({
Expand Down
8 changes: 5 additions & 3 deletions packages/client-common/src/types/AuthModeType.ts
@@ -1,4 +1,6 @@
export const AuthMode: Readonly<Record<string, AuthModeType>> = {
// @MAJOR: export this as individual constants, so it can be minified

export const AuthMode = {
/**
* If auth credentials should be in query parameters.
*/
Expand All @@ -8,6 +10,6 @@ export const AuthMode: Readonly<Record<string, AuthModeType>> = {
* If auth credentials should be in headers.
*/
WithinHeaders: 1,
};
} as const;

export type AuthModeType = 0 | 1;
export type AuthModeType = typeof AuthMode[keyof typeof AuthMode];
8 changes: 5 additions & 3 deletions packages/transporter/src/types/CallType.ts
@@ -1,4 +1,6 @@
export const CallEnum: Readonly<Record<string, CallType>> = {
// @MAJOR: export this as individual constants, so it can be minified

export const CallEnum = {
/**
* If the host is read only.
*/
Expand All @@ -13,6 +15,6 @@ export const CallEnum: Readonly<Record<string, CallType>> = {
* If the host is both read and write.
*/
Any: 3,
};
} as const;

export type CallType = 1 | 2 | 3;
export type CallType = typeof CallEnum[keyof typeof CallEnum];