Skip to content

Commit

Permalink
Merge pull request #12090 from Budibase/refactor/remove-jsdoc-types-i…
Browse files Browse the repository at this point in the history
…n-ts-files

Remove type information from JSDoc in .ts files
  • Loading branch information
samwho authored Oct 18, 2023
2 parents 9a8f7ae + f9bff08 commit 1ab52f3
Show file tree
Hide file tree
Showing 48 changed files with 265 additions and 265 deletions.
10 changes: 5 additions & 5 deletions packages/backend-core/src/cache/appMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ function isInvalid(metadata?: { state: string }) {
* Get the requested app metadata by id.
* Use redis cache to first read the app metadata.
* If not present fallback to loading the app metadata directly and re-caching.
* @param {string} appId the id of the app to get metadata from.
* @returns {object} the app metadata.
* @param appId the id of the app to get metadata from.
* @returns the app metadata.
*/
export async function getAppMetadata(appId: string): Promise<App | DeletedApp> {
const client = await getAppClient()
Expand Down Expand Up @@ -72,9 +72,9 @@ export async function getAppMetadata(appId: string): Promise<App | DeletedApp> {

/**
* Invalidate/reset the cached metadata when a change occurs in the db.
* @param appId {string} the cache key to bust/update.
* @param newMetadata {object|undefined} optional - can simply provide the new metadata to update with.
* @return {Promise<void>} will respond with success when cache is updated.
* @param appId the cache key to bust/update.
* @param newMetadata optional - can simply provide the new metadata to update with.
* @return will respond with success when cache is updated.
*/
export async function invalidateAppMetadata(appId: string, newMetadata?: any) {
if (!appId) {
Expand Down
10 changes: 5 additions & 5 deletions packages/backend-core/src/cache/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ async function populateUsersFromDB(
* Get the requested user by id.
* Use redis cache to first read the user.
* If not present fallback to loading the user directly and re-caching.
* @param {*} userId the id of the user to get
* @param {*} tenantId the tenant of the user to get
* @param {*} populateUser function to provide the user for re-caching. default to couch db
* @param userId the id of the user to get
* @param tenantId the tenant of the user to get
* @param populateUser function to provide the user for re-caching. default to couch db
* @returns
*/
export async function getUser(
Expand Down Expand Up @@ -111,8 +111,8 @@ export async function getUser(
* Get the requested users by id.
* Use redis cache to first read the users.
* If not present fallback to loading the users directly and re-caching.
* @param {*} userIds the ids of the user to get
* @param {*} tenantId the tenant of the users to get
* @param userIds the ids of the user to get
* @param tenantId the tenant of the users to get
* @returns
*/
export async function getUsers(
Expand Down
2 changes: 1 addition & 1 deletion packages/backend-core/src/configs/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import environment from "../environment"

/**
* Generates a new configuration ID.
* @returns {string} The new configuration ID which the config doc can be stored under.
* @returns The new configuration ID which the config doc can be stored under.
*/
export function generateConfigID(type: ConfigType) {
return `${DocumentType.CONFIG}${SEPARATOR}${type}`
Expand Down
2 changes: 1 addition & 1 deletion packages/backend-core/src/context/mainContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function isTenancyEnabled() {

/**
* Given an app ID this will attempt to retrieve the tenant ID from it.
* @return {null|string} The tenant ID found within the app ID.
* @return The tenant ID found within the app ID.
*/
export function getTenantIDFromAppID(appId: string) {
if (!appId) {
Expand Down
8 changes: 4 additions & 4 deletions packages/backend-core/src/db/Replication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ class Replication {

/**
*
* @param {String} source - the DB you want to replicate or rollback to
* @param {String} target - the DB you want to replicate to, or rollback from
* @param source - the DB you want to replicate or rollback to
* @param target - the DB you want to replicate to, or rollback from
*/
constructor({ source, target }: any) {
this.source = getPouchDB(source)
Expand Down Expand Up @@ -38,7 +38,7 @@ class Replication {

/**
* Two way replication operation, intended to be promise based.
* @param {Object} opts - PouchDB replication options
* @param opts - PouchDB replication options
*/
sync(opts = {}) {
this.replication = this.promisify(this.source.sync, opts)
Expand All @@ -47,7 +47,7 @@ class Replication {

/**
* One way replication operation, intended to be promise based.
* @param {Object} opts - PouchDB replication options
* @param opts - PouchDB replication options
*/
replicate(opts = {}) {
this.replication = this.promisify(this.source.replicate.to, opts)
Expand Down
24 changes: 12 additions & 12 deletions packages/backend-core/src/db/lucene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -599,10 +599,10 @@ async function runQuery<T>(
* Gets round the fixed limit of 200 results from a query by fetching as many
* pages as required and concatenating the results. This recursively operates
* until enough results have been found.
* @param dbName {string} Which database to run a lucene query on
* @param index {string} Which search index to utilise
* @param query {object} The JSON query structure
* @param params {object} The search params including:
* @param dbName Which database to run a lucene query on
* @param index Which search index to utilise
* @param query The JSON query structure
* @param params The search params including:
* tableId {string} The table ID to search
* sort {string} The sort column
* sortOrder {string} The sort order ("ascending" or "descending")
Expand Down Expand Up @@ -655,10 +655,10 @@ async function recursiveSearch<T>(
* Performs a paginated search. A bookmark will be returned to allow the next
* page to be fetched. There is a max limit off 200 results per page in a
* paginated search.
* @param dbName {string} Which database to run a lucene query on
* @param index {string} Which search index to utilise
* @param query {object} The JSON query structure
* @param params {object} The search params including:
* @param dbName Which database to run a lucene query on
* @param index Which search index to utilise
* @param query The JSON query structure
* @param params The search params including:
* tableId {string} The table ID to search
* sort {string} The sort column
* sortOrder {string} The sort order ("ascending" or "descending")
Expand Down Expand Up @@ -722,10 +722,10 @@ export async function paginatedSearch<T>(
* desired amount of results. There is a limit of 1000 results to avoid
* heavy performance hits, and to avoid client components breaking from
* handling too much data.
* @param dbName {string} Which database to run a lucene query on
* @param index {string} Which search index to utilise
* @param query {object} The JSON query structure
* @param params {object} The search params including:
* @param dbName Which database to run a lucene query on
* @param index Which search index to utilise
* @param query The JSON query structure
* @param params The search params including:
* tableId {string} The table ID to search
* sort {string} The sort column
* sortOrder {string} The sort order ("ascending" or "descending")
Expand Down
2 changes: 1 addition & 1 deletion packages/backend-core/src/db/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export async function getAllDbs(opts = { efficient: false }) {
* Lots of different points in the system need to find the full list of apps, this will
* enumerate the entire CouchDB cluster and get the list of databases (every app).
*
* @return {Promise<object[]>} returns the app information document stored in each app database.
* @return returns the app information document stored in each app database.
*/
export async function getAllApps({
dev,
Expand Down
2 changes: 1 addition & 1 deletion packages/backend-core/src/docIds/conversions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function isDevApp(app: App) {

/**
* Generates a development app ID from a real app ID.
* @returns {string} the dev app ID which can be used for dev database.
* @returns the dev app ID which can be used for dev database.
*/
export function getDevelopmentAppID(appId: string) {
if (!appId || appId.startsWith(APP_DEV_PREFIX)) {
Expand Down
22 changes: 11 additions & 11 deletions packages/backend-core/src/docIds/ids.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { newid } from "./newid"

/**
* Generates a new app ID.
* @returns {string} The new app ID which the app doc can be stored under.
* @returns The new app ID which the app doc can be stored under.
*/
export const generateAppID = (tenantId?: string | null) => {
let id = APP_PREFIX
Expand All @@ -20,9 +20,9 @@ export const generateAppID = (tenantId?: string | null) => {

/**
* Gets a new row ID for the specified table.
* @param {string} tableId The table which the row is being created for.
* @param {string|null} id If an ID is to be used then the UUID can be substituted for this.
* @returns {string} The new ID which a row doc can be stored under.
* @param tableId The table which the row is being created for.
* @param id If an ID is to be used then the UUID can be substituted for this.
* @returns The new ID which a row doc can be stored under.
*/
export function generateRowID(tableId: string, id?: string) {
id = id || newid()
Expand All @@ -31,15 +31,15 @@ export function generateRowID(tableId: string, id?: string) {

/**
* Generates a new workspace ID.
* @returns {string} The new workspace ID which the workspace doc can be stored under.
* @returns The new workspace ID which the workspace doc can be stored under.
*/
export function generateWorkspaceID() {
return `${DocumentType.WORKSPACE}${SEPARATOR}${newid()}`
}

/**
* Generates a new global user ID.
* @returns {string} The new user ID which the user doc can be stored under.
* @returns The new user ID which the user doc can be stored under.
*/
export function generateGlobalUserID(id?: any) {
return `${DocumentType.USER}${SEPARATOR}${id || newid()}`
Expand All @@ -52,8 +52,8 @@ export function isGlobalUserID(id: string) {

/**
* Generates a new user ID based on the passed in global ID.
* @param {string} globalId The ID of the global user.
* @returns {string} The new user ID which the user doc can be stored under.
* @param globalId The ID of the global user.
* @returns The new user ID which the user doc can be stored under.
*/
export function generateUserMetadataID(globalId: string) {
return generateRowID(InternalTable.USER_METADATA, globalId)
Expand Down Expand Up @@ -84,7 +84,7 @@ export function generateAppUserID(prodAppId: string, userId: string) {

/**
* Generates a new role ID.
* @returns {string} The new role ID which the role doc can be stored under.
* @returns The new role ID which the role doc can be stored under.
*/
export function generateRoleID(name: string) {
const prefix = `${DocumentType.ROLE}${SEPARATOR}`
Expand All @@ -103,15 +103,15 @@ export function prefixRoleID(name: string) {

/**
* Generates a new dev info document ID - this is scoped to a user.
* @returns {string} The new dev info ID which info for dev (like api key) can be stored under.
* @returns The new dev info ID which info for dev (like api key) can be stored under.
*/
export const generateDevInfoID = (userId: any) => {
return `${DocumentType.DEV_INFO}${SEPARATOR}${userId}`
}

/**
* Generates a new plugin ID - to be used in the global DB.
* @returns {string} The new plugin ID which a plugin metadata document can be stored under.
* @returns The new plugin ID which a plugin metadata document can be stored under.
*/
export const generatePluginID = (name: string) => {
return `${DocumentType.PLUGIN}${SEPARATOR}${name}`
Expand Down
16 changes: 8 additions & 8 deletions packages/backend-core/src/docIds/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import { getProdAppID } from "./conversions"
* is usually the case as most of our docs are top level e.g. tables, automations, users and so on.
* More complex cases such as link docs and rows which have multiple levels of IDs that their
* ID consists of need their own functions to build the allDocs parameters.
* @param {string} docType The type of document which input params are being built for, e.g. user,
* @param docType The type of document which input params are being built for, e.g. user,
* link, app, table and so on.
* @param {string|null} docId The ID of the document minus its type - this is only needed if looking
* @param docId The ID of the document minus its type - this is only needed if looking
* for a singular document.
* @param {object} otherProps Add any other properties onto the request, e.g. include_docs.
* @returns {object} Parameters which can then be used with an allDocs request.
* @param otherProps Add any other properties onto the request, e.g. include_docs.
* @returns Parameters which can then be used with an allDocs request.
*/
export function getDocParams(
docType: string,
Expand All @@ -36,11 +36,11 @@ export function getDocParams(

/**
* Gets the DB allDocs/query params for retrieving a row.
* @param {string|null} tableId The table in which the rows have been stored.
* @param {string|null} rowId The ID of the row which is being specifically queried for. This can be
* @param tableId The table in which the rows have been stored.
* @param rowId The ID of the row which is being specifically queried for. This can be
* left null to get all the rows in the table.
* @param {object} otherProps Any other properties to add to the request.
* @returns {object} Parameters which can then be used with an allDocs request.
* @param otherProps Any other properties to add to the request.
* @returns Parameters which can then be used with an allDocs request.
*/
export function getRowParams(
tableId?: string | null,
Expand Down
4 changes: 2 additions & 2 deletions packages/backend-core/src/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* Makes sure that a URL has the correct number of slashes, while maintaining the
* http(s):// double slashes.
* @param {string} url The URL to test and remove any extra double slashes.
* @return {string} The updated url.
* @param url The URL to test and remove any extra double slashes.
* @return The updated url.
*/
export function checkSlashesInUrl(url: string) {
return url.replace(/(https?:\/\/)|(\/)+/g, "$1$2")
Expand Down
8 changes: 4 additions & 4 deletions packages/backend-core/src/middleware/passport/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export const options = {

/**
* Passport Local Authentication Middleware.
* @param {*} ctx the request structure
* @param {*} email username to login with
* @param {*} password plain text password to log in with
* @param {*} done callback from passport to return user information and errors
* @param ctx the request structure
* @param email username to login with
* @param password plain text password to log in with
* @param done callback from passport to return user information and errors
* @returns The authenticated user, or errors if they occur
*/
export async function authenticate(
Expand Down
22 changes: 11 additions & 11 deletions packages/backend-core/src/middleware/passport/sso/oidc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ const OIDCStrategy = require("@techpass/passport-openidconnect").Strategy

export function buildVerifyFn(saveUserFn: SaveSSOUserFunction) {
/**
* @param {*} issuer The identity provider base URL
* @param {*} sub The user ID
* @param {*} profile The user profile information. Created by passport from the /userinfo response
* @param {*} jwtClaims The parsed id_token claims
* @param {*} accessToken The access_token for contacting the identity provider - may or may not be a JWT
* @param {*} refreshToken The refresh_token for obtaining a new access_token - usually not a JWT
* @param {*} idToken The id_token - always a JWT
* @param {*} params The response body from requesting an access_token
* @param {*} done The passport callback: err, user, info
* @param issuer The identity provider base URL
* @param sub The user ID
* @param profile The user profile information. Created by passport from the /userinfo response
* @param jwtClaims The parsed id_token claims
* @param accessToken The access_token for contacting the identity provider - may or may not be a JWT
* @param refreshToken The refresh_token for obtaining a new access_token - usually not a JWT
* @param idToken The id_token - always a JWT
* @param params The response body from requesting an access_token
* @param done The passport callback: err, user, info
*/
return async (
issuer: string,
Expand Down Expand Up @@ -61,8 +61,8 @@ export function buildVerifyFn(saveUserFn: SaveSSOUserFunction) {
}

/**
* @param {*} profile The structured profile created by passport using the user info endpoint
* @param {*} jwtClaims The claims returned in the id token
* @param profile The structured profile created by passport using the user info endpoint
* @param jwtClaims The claims returned in the id token
*/
function getEmail(profile: SSOProfile, jwtClaims: JwtClaims) {
// profile not guaranteed to contain email e.g. github connected azure ad account
Expand Down
6 changes: 3 additions & 3 deletions packages/backend-core/src/middleware/passport/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { ConfigType, GoogleInnerConfig } from "@budibase/types"
/**
* Utility to handle authentication errors.
*
* @param {*} done The passport callback.
* @param {*} message Message that will be returned in the response body
* @param {*} err (Optional) error that will be logged
* @param done The passport callback.
* @param message Message that will be returned in the response body
* @param err (Optional) error that will be logged
*/

export function authError(done: Function, message: string, err?: any) {
Expand Down
6 changes: 3 additions & 3 deletions packages/backend-core/src/objectStore/buckets/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import * as cloudfront from "../cloudfront"
* In production the client library is stored in the object store, however in development
* we use the symlinked version produced by lerna, located in node modules. We link to this
* via a specific endpoint (under /api/assets/client).
* @param {string} appId In production we need the appId to look up the correct bucket, as the
* @param appId In production we need the appId to look up the correct bucket, as the
* version of the client lib may differ between apps.
* @param {string} version The version to retrieve.
* @return {string} The URL to be inserted into appPackage response or server rendered
* @param version The version to retrieve.
* @return The URL to be inserted into appPackage response or server rendered
* app index file.
*/
export const clientLibraryUrl = (appId: string, version: string) => {
Expand Down
6 changes: 3 additions & 3 deletions packages/backend-core/src/objectStore/objectStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ export function sanitizeBucket(input: string) {

/**
* Gets a connection to the object store using the S3 SDK.
* @param {string} bucket the name of the bucket which blobs will be uploaded/retrieved from.
* @param {object} opts configuration for the object store.
* @return {Object} an S3 object store object, check S3 Nodejs SDK for usage.
* @param bucket the name of the bucket which blobs will be uploaded/retrieved from.
* @param opts configuration for the object store.
* @return an S3 object store object, check S3 Nodejs SDK for usage.
* @constructor
*/
export const ObjectStore = (
Expand Down
Loading

0 comments on commit 1ab52f3

Please sign in to comment.