-
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.
extract one off code to /lib and types to /types
- Loading branch information
Showing
7 changed files
with
20 additions
and
13 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
packages/payloadset/packages/xns/plugins/record/src/validation/index.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 +1,2 @@ | ||
export * from './name/index.ts' | ||
export * from './validation/index.ts' |
15 changes: 2 additions & 13 deletions
15
packages/payloadset/packages/xns/plugins/record/src/validation/name/Name.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: 2 additions & 0 deletions
2
packages/payloadset/packages/xns/plugins/record/src/validation/name/index.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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from './Name.ts' | ||
export * from './types/index.ts' |
12 changes: 12 additions & 0 deletions
12
packages/payloadset/packages/xns/plugins/record/src/validation/name/lib/RegexHelpers.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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { DisallowedModuleIdentifierCharacters } from '@xyo-network/module-model' | ||
|
||
// Escaping special regex characters in the disallowed keys | ||
export const escapeRegex = (str: string) => str.replaceAll(/[$()*+.?[\\\]^{|}]/g, String.raw`\$&`) | ||
|
||
// Escaping and then creating the regex | ||
export const disallowedCharsPattern = Object.keys(DisallowedModuleIdentifierCharacters) | ||
.map(escapeRegex) | ||
.join('') | ||
|
||
// Creating the final regex | ||
export const REMOVE_DISALLOWED_CHARS = new RegExp(`[${disallowedCharsPattern}]`, 'g') |
1 change: 1 addition & 0 deletions
1
packages/payloadset/packages/xns/plugins/record/src/validation/name/lib/index.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './RegexHelpers.ts' |
1 change: 1 addition & 0 deletions
1
packages/payloadset/packages/xns/plugins/record/src/validation/name/types/ValidSources.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export type ValidSourceTypes = 'xnsName' | 'hash' | null |
1 change: 1 addition & 0 deletions
1
packages/payloadset/packages/xns/plugins/record/src/validation/name/types/index.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './ValidSources.ts' |