-
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
Showing
12 changed files
with
167 additions
and
65 deletions.
There are no files selected for viewing
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
56 changes: 46 additions & 10 deletions
56
stack--current/5-incubator/active/view--chat/src/__fixtures/primitives--console.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
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
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
65 changes: 65 additions & 0 deletions
65
stack--current/5-incubator/active/view--chat/src/steps/bases.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,65 @@ | ||
import { StepType, type InputStep } from './types.js' | ||
import { | ||
combineꓽnormalizers, | ||
ensure_string, | ||
normalize_unicode, | ||
trim, | ||
} from '@offirmo-private/normalize-string' | ||
|
||
function getꓽInputStepⵧnonEmptyString<ContentType>( | ||
parts: Omit<InputStep<ContentType, string>, 'type' | 'normalizer' | 'validators'> | ||
): InputStep<ContentType, string> { | ||
const step: InputStep<ContentType, string> = { | ||
type: StepType.input, | ||
|
||
normalizer: (raw: any): string => { | ||
let val = ensure_string(raw) | ||
val = normalize_unicode(val) | ||
val = trim(val) | ||
return val | ||
}, | ||
validators: [ | ||
(value: string) => [value.length > 0, 'Should have at least 1 letter.'], | ||
], | ||
...parts | ||
} | ||
return step | ||
} | ||
|
||
/* | ||
function getꓽInputStepⵧconfirmation<ContentType>(): InputStep<ContentType, boolean> { | ||
return { | ||
type: typeof StepType.input, | ||
normalizer: (raw: any): number => { | ||
let val = Boolean(raw) | ||
return val | ||
}, | ||
validators: [ | ||
], | ||
} | ||
} | ||
function getꓽInputStepⵧinteger<ContentType>(): Omit<InputStep<ContentType, number>, 'prompt' | 'msg_as_user' | 'msg_acknowledge'> { | ||
return { | ||
type: typeof StepType.input, | ||
normalizer: (raw: any): number => { | ||
raw = ensure_string(raw) | ||
let val = Number(raw) | ||
val = normalize_unicode(val) | ||
val = trim(val) | ||
return val | ||
}, | ||
validators: [ | ||
], | ||
} | ||
}*/ | ||
|
||
///////////////////////////////////////////////// | ||
|
||
export { | ||
getꓽInputStepⵧnonEmptyString, | ||
} |
1 change: 1 addition & 0 deletions
1
...ator/active/view--chat/src/types/index.ts → ...ator/active/view--chat/src/steps/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 './types.js' | ||
export * from './bases.js' |
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