mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
refactor(schemas): improve regexp
This commit is contained in:
parent
d065cbc623
commit
a856145f81
3 changed files with 8 additions and 5 deletions
|
@ -6,13 +6,16 @@ import type { Field } from './types.js';
|
|||
export const normalizeWhitespaces = (string: string): string =>
|
||||
string.replaceAll(/\s+/g, ' ').trim();
|
||||
|
||||
// eslint-disable-next-line unicorn/prevent-abbreviations -- JSDoc is a term
|
||||
const leadingJsDocRegex = /^\s*\/\*\*([^*]*?)\*\//;
|
||||
|
||||
// eslint-disable-next-line unicorn/prevent-abbreviations -- JSDoc is a term
|
||||
export const stripLeadingJsDocComments = (string: string): string =>
|
||||
string.replace(/^\s*\/\*\*[^*]+\*\//, '').trim();
|
||||
string.replace(leadingJsDocRegex, '').trim();
|
||||
|
||||
// eslint-disable-next-line unicorn/prevent-abbreviations -- JSDoc is a term
|
||||
const getLeadingJsDocComments = (string: string): Optional<string> =>
|
||||
/^\s*\/\*\*([^*]+)\*\//g.exec(string)?.[1]?.trim();
|
||||
leadingJsDocRegex.exec(string)?.[1];
|
||||
|
||||
// Remove all comments not start with @
|
||||
export const removeUnrecognizedComments = (string: string): string =>
|
||||
|
|
|
@ -18,7 +18,7 @@ create table sentinel_activities (
|
|||
payload jsonb /* @use SentinelActivityPayload */ not null,
|
||||
/** The sentinel decision for the action. */
|
||||
decision sentinel_decision not null,
|
||||
/** The expiry date of the decision. */
|
||||
/** The expiry date of the decision. For instant decisions, this is the date the activity was created. */
|
||||
decision_expires_at timestamptz not null default(now()),
|
||||
/** The time the activity was created. */
|
||||
created_at timestamptz not null default(now()),
|
||||
|
|
Loading…
Reference in a new issue