Skip to content

feat: dynamically inferred core types #995

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

Open
wants to merge 51 commits into
base: 22.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
895ca53
Add init script for generating the schema
deepjyoti30-st Apr 29, 2025
7df8b4a
Add type definitions for inferring response body and request body fro…
deepjyoti30-st Apr 29, 2025
7ca8a96
Refactor querier to use inferred types in network methods
deepjyoti30-st Apr 30, 2025
bd35f00
Update all querier references to avoid usage of NormalisedURLPath
deepjyoti30-st Apr 30, 2025
9a6f0a5
Add fixes for webauthn schema issues
deepjyoti30-st May 6, 2025
8bb464b
Update the local API spec based on the updated version
deepjyoti30-st May 6, 2025
a76d845
Update API spec to match user definition changes in spec
deepjyoti30-st May 6, 2025
1693aae
Add fix for user handling in SDK from API
deepjyoti30-st May 6, 2025
f05d6e6
Add fix for emailpassword recipe
deepjyoti30-st May 6, 2025
0669778
Add fixes for multitenancy related conflicts
deepjyoti30-st May 6, 2025
9362710
Fix some more recipe related type conflicts
deepjyoti30-st May 6, 2025
24c715d
Fix various type conflicts in the schema
deepjyoti30-st May 7, 2025
6b7f9a0
Fix passwordless type mismatches
deepjyoti30-st May 7, 2025
9e165e2
Add fixes to thirdparty and usermetadata based on types
deepjyoti30-st May 7, 2025
cbe9c28
Fix some issues with unused variables/imports
deepjyoti30-st May 7, 2025
90ed34e
Update built spec with oauth endpoint returning incorrect status
deepjyoti30-st May 7, 2025
cc35817
Update oauth2provider related type fixes
deepjyoti30-st May 8, 2025
7b10194
Add build files and pretty fixes
deepjyoti30-st May 9, 2025
8af3ebf
Bumps version to 22.2.0
deepjyoti30-st May 9, 2025
bf3cf4e
Add init script for generating the schema
deepjyoti30-st Apr 29, 2025
4416c46
Add type definitions for inferring response body and request body fro…
deepjyoti30-st Apr 29, 2025
49f2e0e
Refactor querier to use inferred types in network methods
deepjyoti30-st Apr 30, 2025
8d1c655
Update all querier references to avoid usage of NormalisedURLPath
deepjyoti30-st Apr 30, 2025
a1e3df8
Add fixes for webauthn schema issues
deepjyoti30-st May 6, 2025
fa03ed3
Update the local API spec based on the updated version
deepjyoti30-st May 6, 2025
571f48a
Update API spec to match user definition changes in spec
deepjyoti30-st May 6, 2025
ce92ee8
Add fix for user handling in SDK from API
deepjyoti30-st May 6, 2025
f8b2776
Add fix for emailpassword recipe
deepjyoti30-st May 6, 2025
90af0bf
Add fixes for multitenancy related conflicts
deepjyoti30-st May 6, 2025
12cdb0e
Fix some more recipe related type conflicts
deepjyoti30-st May 6, 2025
fcd1bd9
Fix various type conflicts in the schema
deepjyoti30-st May 7, 2025
87c7b4b
Fix passwordless type mismatches
deepjyoti30-st May 7, 2025
6ea5a1c
Add fixes to thirdparty and usermetadata based on types
deepjyoti30-st May 7, 2025
7d68cd3
Fix some issues with unused variables/imports
deepjyoti30-st May 7, 2025
39b0d74
Update built spec with oauth endpoint returning incorrect status
deepjyoti30-st May 7, 2025
8574eec
Update oauth2provider related type fixes
deepjyoti30-st May 8, 2025
e96361c
Add build files and pretty fixes
deepjyoti30-st May 9, 2025
8a70534
Bumps version to 22.2.0
deepjyoti30-st May 9, 2025
07b702a
Merge branch '22.1' into feat/dynamically-inferred-core-types
porcellus May 13, 2025
602b7dd
Merge branch 'feat/dynamically-inferred-core-types' of github.com-sup…
deepjyoti30-st May 15, 2025
645ce92
Fix a path in the generate script
deepjyoti30-st May 16, 2025
3dc0ec3
Rename template to template_path in querier
deepjyoti30-st May 16, 2025
4e2bbc6
Move to using Required instead of MakeAllRequired
deepjyoti30-st May 16, 2025
4d269e7
Get rid of word boundary in regex
deepjyoti30-st May 16, 2025
22e068d
Get rid of some unused code
deepjyoti30-st May 16, 2025
9586901
Add support for auto generating paths.ts
deepjyoti30-st May 16, 2025
c328ab6
Add build files after changes
deepjyoti30-st May 16, 2025
df9c389
Add comment explaining fromApi method in User
deepjyoti30-st May 16, 2025
0cd1a50
Fix type mismatch in multitenancy routes
deepjyoti30-st May 16, 2025
d08660f
Fix name of template path to camelCase
deepjyoti30-st May 16, 2025
ab48e5c
Fix querier change in build
deepjyoti30-st May 16, 2025
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Sets up workflow to run auth-react tests
- Updates test-servers to work with updated tests

## [22.2.0] - 2025-05-09

- Refactors querier to use dynamic request body and response body types inference

## [22.1.0] - 2025-04-04

- Adds support for using `code_challenge_method` from OIDC provider response to determine whether to use PKCE or not.
Expand Down
3 changes: 3 additions & 0 deletions lib/build/core/paths.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// @ts-nocheck
import { paths } from "./versions/5.3/schema";
export { paths };
2 changes: 2 additions & 0 deletions lib/build/core/paths.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
58 changes: 58 additions & 0 deletions lib/build/core/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// @ts-nocheck
/**
* This file contains the types for providing automatic type inference
* for core related method calls that is generated from the OpenAPI spec.
*
* This file is not needed for the core driver interface to work, but it is
* useful for providing type inference for the core related method calls.
*/
import { paths } from "./paths";
export declare type Method = "get" | "post" | "put" | "delete" | "patch";
declare type ExtractMethodTypeWithUndefined<P extends keyof paths, M extends Method> = M extends keyof paths[P]
? paths[P][M]
: never;
export declare type ExtractMethodType<P extends keyof paths, M extends Method> = Exclude<
ExtractMethodTypeWithUndefined<P, M>,
undefined
>;
declare type DeepRequireAllFields<T> = T extends any ? Required<T> : never;
export declare type RequestBody<P extends keyof paths, M extends Method> = ExtractMethodType<P, M> extends {
requestBody?: infer ReqBody;
}
? ReqBody extends {
content: {
"application/json": infer R;
};
}
? R | undefined
: undefined
: undefined;
export declare type UncleanedResponseBody<P extends keyof paths, M extends Method> = ExtractMethodType<P, M> extends {
responses: {
200: {
content: {
"application/json": infer R;
};
};
};
}
? R
: unknown;
export declare type ResponseBody<P extends keyof paths, M extends Method> = DeepRequireAllFields<
UncleanedResponseBody<P, M>
>;
declare type ExtractPathParams<T extends string> = T extends `${string}<${infer Param}>${infer Rest}`
? Param | ExtractPathParams<Rest>
: never;
declare type PathParamsObject<T extends string> = ExtractPathParams<T> extends never
? undefined
: {
[K in ExtractPathParams<T>]: string;
};
export declare type PathParam<P extends keyof paths> =
| P
| {
path: P;
params: PathParamsObject<P>;
};
export {};
9 changes: 9 additions & 0 deletions lib/build/core/types.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"use strict";
/**
* This file contains the types for providing automatic type inference
* for core related method calls that is generated from the OpenAPI spec.
*
* This file is not needed for the core driver interface to work, but it is
* useful for providing type inference for the core related method calls.
*/
Object.defineProperty(exports, "__esModule", { value: true });
4 changes: 1 addition & 3 deletions lib/build/customFramework.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion lib/build/customFramework.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion lib/build/framework/custom/framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ var __importDefault =
return mod && mod.__esModule ? mod : { default: mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CustomFrameworkWrapper = exports.errorHandler = exports.middleware = exports.CollectingResponse = exports.PreParsedRequest = void 0;
exports.CustomFrameworkWrapper =
exports.errorHandler =
exports.middleware =
exports.CollectingResponse =
exports.PreParsedRequest =
void 0;
const utils_1 = require("../../utils");
const request_1 = require("../request");
const response_1 = require("../response");
Expand Down
7 changes: 6 additions & 1 deletion lib/build/framework/express/framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ var __importDefault =
return mod && mod.__esModule ? mod : { default: mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExpressWrapper = exports.errorHandler = exports.middleware = exports.ExpressResponse = exports.ExpressRequest = void 0;
exports.ExpressWrapper =
exports.errorHandler =
exports.middleware =
exports.ExpressResponse =
exports.ExpressRequest =
void 0;
const utils_1 = require("../../utils");
const request_1 = require("../request");
const response_1 = require("../response");
Expand Down
8 changes: 3 additions & 5 deletions lib/build/framework/fastify/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// @ts-nocheck
export type { SessionRequest } from "./framework";
export declare const plugin: import("./types").FastifyPluginCallback<import("./types").FastifyInstance<
unknown,
import("./types").FastifyRequest,
import("./types").FastifyReply
>>;
export declare const plugin: import("./types").FastifyPluginCallback<
import("./types").FastifyInstance<unknown, import("./types").FastifyRequest, import("./types").FastifyReply>
>;
export declare const errorHandler: () => (
err: any,
req: import("./types").FastifyRequest,
Expand Down
10 changes: 9 additions & 1 deletion lib/build/framework/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ var __importStar =
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.awsLambda = exports.koa = exports.loopback = exports.hapi = exports.fastify = exports.express = exports.BaseResponse = exports.BaseRequest = void 0;
exports.awsLambda =
exports.koa =
exports.loopback =
exports.hapi =
exports.fastify =
exports.express =
exports.BaseResponse =
exports.BaseRequest =
void 0;
/* Copyright (c) 2021, VRAI Labs and/or its affiliates. All rights reserved.
*
* This software is licensed under the Apache License, Version 2.0 (the
Expand Down
18 changes: 16 additions & 2 deletions lib/build/framework/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,20 @@ var __importDefault =
return mod && mod.__esModule ? mod : { default: mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.isBoxedPrimitive = exports.serializeCookieValue = exports.getCookieValueToSetInHeader = exports.setCookieForServerResponse = exports.setHeaderForExpressLikeResponse = exports.assertFormDataBodyParserHasBeenUsedForExpressLikeRequest = exports.assertThatBodyParserHasBeenUsedForExpressLikeRequest = exports.parseURLEncodedFormData = exports.parseJSONBodyFromRequest = exports.normalizeHeaderValue = exports.getHeaderValueFromIncomingMessage = exports.getCookieValueFromIncomingMessage = exports.getCookieValueFromHeaders = void 0;
exports.isBoxedPrimitive =
exports.serializeCookieValue =
exports.getCookieValueToSetInHeader =
exports.setCookieForServerResponse =
exports.setHeaderForExpressLikeResponse =
exports.assertFormDataBodyParserHasBeenUsedForExpressLikeRequest =
exports.assertThatBodyParserHasBeenUsedForExpressLikeRequest =
exports.parseURLEncodedFormData =
exports.parseJSONBodyFromRequest =
exports.normalizeHeaderValue =
exports.getHeaderValueFromIncomingMessage =
exports.getCookieValueFromIncomingMessage =
exports.getCookieValueFromHeaders =
void 0;
const cookie_1 = require("cookie");
const error_1 = __importDefault(require("../error"));
const constants_1 = require("./constants");
Expand Down Expand Up @@ -300,7 +313,8 @@ async function assertFormDataBodyParserHasBeenUsedForExpressLikeRequest(request)
}
}
}
exports.assertFormDataBodyParserHasBeenUsedForExpressLikeRequest = assertFormDataBodyParserHasBeenUsedForExpressLikeRequest;
exports.assertFormDataBodyParserHasBeenUsedForExpressLikeRequest =
assertFormDataBodyParserHasBeenUsedForExpressLikeRequest;
function setHeaderForExpressLikeResponse(res, key, value, allowDuplicateKey) {
var _a;
try {
Expand Down
19 changes: 18 additions & 1 deletion lib/build/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion lib/build/nextjs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

65 changes: 49 additions & 16 deletions lib/build/querier.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading