File tree 3 files changed +11
-19
lines changed
3 files changed +11
-19
lines changed Original file line number Diff line number Diff line change @@ -39,3 +39,12 @@ export const DEFAULT_CONTROL_DIGEST_DIGEST_KEY = '';
39
39
40
40
export const DYNAMIC_PATH_ROOTS = [ 'subscriber.data.' , 'payload.' ] as const ;
41
41
export const DYNAMIC_STEP_NAME_ROOT_REGEX = / ^ s t e p s \. ( .+ ?) \. e v e n t s \[ \d + \] \. p a y l o a d $ / ;
42
+
43
+ export const INVALID_DYNAMIC_PATH_VALUES = [
44
+ 'subscriber.data' ,
45
+ 'subscriber.data.' ,
46
+ 'payload' ,
47
+ 'payload.' ,
48
+ / ^ s t e p s \. [ ^ . ] + \. e v e n t s \[ \d + \] \. p a y l o a d $ / , // Invalidates "steps.x.events[n].payload"
49
+ / ^ s t e p s \. [ ^ . ] + \. e v e n t s \[ \d + \] \. p a y l o a d \. $ / , // Invalidates "steps.x.events[n].payload."
50
+ ] as const ;
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { FILTERS } from '@/components/variable/constants';
2
2
import { LiquidVariable } from '@/utils/parseStepVariables' ;
3
3
import { Completion , CompletionContext , CompletionResult } from '@codemirror/autocomplete' ;
4
4
import { EditorView } from '@uiw/react-codemirror' ;
5
- import { DYNAMIC_PATH_ROOTS , DYNAMIC_STEP_NAME_ROOT_REGEX } from './constants' ;
5
+ import { DYNAMIC_PATH_ROOTS , DYNAMIC_STEP_NAME_ROOT_REGEX , INVALID_DYNAMIC_PATH_VALUES } from './constants' ;
6
6
7
7
interface CompletionOption {
8
8
label : string ;
@@ -22,15 +22,6 @@ const VALID_DYNAMIC_PATH_SUGGESTIONS = [
22
22
/ ^ s t e p s \. [ ^ . ] + \. e v e n t s \[ \d + \] \. p a y l o a d \. / ,
23
23
] as const ;
24
24
25
- const INVALID_DYNAMIC_PATH_VALUES = [
26
- 'subscriber.data' ,
27
- 'subscriber.data.' ,
28
- 'payload' ,
29
- 'payload.' ,
30
- / ^ s t e p s \. [ ^ . ] + \. e v e n t s \[ \d + \] \. p a y l o a d $ / , // Invalidates "steps.x.events[n].payload"
31
- / ^ s t e p s \. [ ^ . ] + \. e v e n t s \[ \d + \] \. p a y l o a d \. $ / , // Invalidates "steps.x.events[n].payload."
32
- ] as const ;
33
-
34
25
/**
35
26
* Liquid variable autocomplete for the following patterns:
36
27
*
Original file line number Diff line number Diff line change 1
1
import type { JSONSchemaDefinition } from '@novu/shared' ;
2
+ import { INVALID_DYNAMIC_PATH_VALUES } from './constants' ;
2
3
3
4
export interface LiquidVariable {
4
5
type : 'variable' ;
@@ -16,15 +17,6 @@ export interface ParsedVariables {
16
17
isAllowedVariable : IsAllowedVariable ;
17
18
}
18
19
19
- const INVALID_DYNAMIC_PATH_VALUES = [
20
- 'subscriber.data' ,
21
- 'subscriber.data.' ,
22
- 'payload' ,
23
- 'payload.' ,
24
- / ^ s t e p s \. [ ^ . ] + \. e v e n t s \[ \d + \] \. p a y l o a d $ / , // Invalidates "steps.x.events[n].payload"
25
- / ^ s t e p s \. [ ^ . ] + \. e v e n t s \[ \d + \] \. p a y l o a d \. $ / , // Invalidates "steps.x.events[n].payload."
26
- ] as const ;
27
-
28
20
/**
29
21
* Parse JSON Schema and extract variables for Liquid autocompletion.
30
22
* @param schema - The JSON Schema to parse.
You can’t perform that action at this time.
0 commit comments