-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86e22e9
commit 68137a4
Showing
33 changed files
with
4,940 additions
and
166 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
@jsr:registry=https://npm.jsr.io |
File renamed without changes.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"name": "@vighnesh153/api", | ||
"version": "1.0.0", | ||
"description": "", | ||
"private": true, | ||
"type": "module", | ||
"author": { | ||
"name": "Vighnesh Raut", | ||
"email": "[email protected]", | ||
"url": "https://vighnesh153.dev" | ||
}, | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "tsup", | ||
"test:watch": "vitest", | ||
"test": "vitest run --passWithNoTests", | ||
"deploy:dev": "npm run build && dotenvx run --env-file=../../.env.local -- sst deploy --stage dev", | ||
"deploy:prod": "npm run build && dotenvx run --env-file=../../.env.local -- sst deploy --stage prod", | ||
"remove:dev": "npm run build && dotenvx run --env-file=../../.env.local -- sst remove --stage dev", | ||
"remove:prod": "npm run build && dotenvx run --env-file=../../.env.local -- sst remove --stage prod" | ||
}, | ||
"files": [ | ||
"dist" | ||
], | ||
"dependencies": { | ||
"@aws-sdk/client-dynamodb": "^3.679.0", | ||
"@aws-sdk/lib-dynamodb": "^3.679.0", | ||
"@std/text": "npm:@jsr/std__text@^1.0.8", | ||
"@vighnesh153/tools-server": "npm:@jsr/vighnesh153__tools-server@^0.1.1" | ||
}, | ||
"devDependencies": { | ||
"@aws-sdk/types": "^3.679.0", | ||
"@dotenvx/dotenvx": "^1.21.0", | ||
"@types/aws-lambda": "^8.10.145", | ||
"@types/cookie": "^0.6.0", | ||
"@types/node": "*", | ||
"@vighnesh153/tools": "npm:@jsr/vighnesh153__tools@^0.1.4", | ||
"@vighnesh153/tsconfig": "0.4.8", | ||
"cookie": "^1.0.1", | ||
"sst": "^3.2.70", | ||
"tsup": "^8.3.5", | ||
"typescript": "^5.6.3", | ||
"vitest": "^2.1.4" | ||
}, | ||
"keywords": [], | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:vighnesh153/vighnesh153-monorepo.git" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
9 changes: 6 additions & 3 deletions
9
...s/api/src/common/dynamoDBTableMetadata.ts → ...53/src/common/dynamo_db_table_metadata.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import { DynamoTypeMap, TableMetadata } from "@vighnesh153/aws-dynamo-db"; | ||
import type { | ||
DynamoTypeMap, | ||
TableMetadata, | ||
} from "@vighnesh153/tools-server/aws_dynamodb"; | ||
|
||
export const userInfoFields = { | ||
export const userInfoFields = /* @__PURE__ */ { | ||
userId: "string", | ||
name: "string", | ||
email: "string", | ||
profilePictureUrl: "string", | ||
createdAtMillis: "number", | ||
} satisfies Record<string, keyof DynamoTypeMap>; | ||
|
||
export const UserInfoTableMetadata = { | ||
export const UserInfoTableMetadata = /* @__PURE__ */ { | ||
fields: userInfoFields, | ||
} satisfies Partial<TableMetadata>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { Resource } from "sst"; | ||
|
||
import { | ||
createDynamoDBDocumentClient, | ||
DynamoDBTable, | ||
DynamoDBTableImpl, | ||
type IDynamoDBDocumentClient, | ||
type TableMetadata, | ||
} from "@vighnesh153/tools-server/aws_dynamodb"; | ||
import { | ||
ConsoleLogger, | ||
createFactory, | ||
createSingletonFactory, | ||
JsonHttpClient, | ||
JsonHttpClientImpl, | ||
Logger, | ||
} from "@vighnesh153/tools"; | ||
|
||
import { userInfoFields } from "./dynamo_db_table_metadata.ts"; | ||
import { | ||
RandomStringGenerator, | ||
RandomStringGeneratorImpl, | ||
} from "./random_string_generator.ts"; | ||
import { | ||
AuthTokenGenerator, | ||
AuthTokenGeneratorImpl, | ||
} from "./auth_token_generator.ts"; | ||
import { CookieSerializer, CookieSerializerImpl } from "./cookie_serializer.ts"; | ||
import { inProduction } from "./utils.ts"; | ||
import { | ||
type UserInfoDecoder, | ||
UserInfoDecoderImpl, | ||
} from "./user_info_decoder.ts"; | ||
|
||
export const loggerSingletonFactory = createSingletonFactory<Logger>(() => { | ||
return ConsoleLogger.getInstance(); | ||
}); | ||
|
||
export const httpClientSingletonFactory = createSingletonFactory< | ||
JsonHttpClient | ||
>(() => { | ||
return new JsonHttpClientImpl({ | ||
baseUrl: "", | ||
}); | ||
}); | ||
|
||
const dynamoDBDocumentClientSingletonFactory = | ||
/* @__PURE__ */ createSingletonFactory< | ||
IDynamoDBDocumentClient | ||
>(() => { | ||
return createDynamoDBDocumentClient(); | ||
}); | ||
|
||
export const userInfoTableMetadata = /* @__PURE__ */ { | ||
fields: userInfoFields, | ||
// @ts-ignore: sst stuff | ||
tableName: /* @__PURE__ */ inProduction(() => Resource.UserInfoTable.name), | ||
} satisfies TableMetadata; | ||
|
||
export const userInfoTableSingletonFactory = | ||
/* @__PURE__ */ createSingletonFactory< | ||
DynamoDBTable<typeof userInfoTableMetadata> | ||
>(() => { | ||
const dynamoDBdocumentClient = dynamoDBDocumentClientSingletonFactory(); | ||
return new DynamoDBTableImpl(dynamoDBdocumentClient, userInfoTableMetadata); | ||
}); | ||
|
||
export const userInfoDecoderSingletonFactory = | ||
/* @__PURE__ */ createSingletonFactory< | ||
UserInfoDecoder | ||
>(() => { | ||
return new UserInfoDecoderImpl(loggerSingletonFactory()); | ||
}); | ||
|
||
export const randomStringGeneratorSingletonFactory = | ||
/* @__PURE__ */ createSingletonFactory< | ||
RandomStringGenerator | ||
>(() => { | ||
return new RandomStringGeneratorImpl(); | ||
}); | ||
|
||
export const authTokenGeneratorSingletonFactory = | ||
/* @__PURE__ */ createSingletonFactory< | ||
AuthTokenGenerator | ||
>(() => { | ||
return new AuthTokenGeneratorImpl(); | ||
}); | ||
|
||
export const cookieSerializerFactory = /* @__PURE__ */ createFactory< | ||
CookieSerializer | ||
>(() => { | ||
return new CookieSerializerImpl(); | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...gleLogin/constructAuthRedirectUrl.test.ts → ...Login/construct_auth_redirect_url.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...api/src/initiateGoogleLogin/controller.ts → ...153/src/initiateGoogleLogin/controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ools/api/src/initiateGoogleLogin/index.ts → ...ighnesh153/src/initiateGoogleLogin/mod.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.