ondc-code-generator 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/constants/operations.d.ts +6 -0
  2. package/dist/constants/syntax.d.ts +15 -0
  3. package/dist/generator/config-compiler.d.ts +23 -0
  4. package/dist/generator/generators/classes/abstract-generator.d.ts +11 -0
  5. package/dist/generator/generators/documentation/markdown-message-generator.d.ts +2 -0
  6. package/dist/generator/generators/documentation/md-generator.d.ts +9 -0
  7. package/dist/generator/generators/typescript/templates/json-path-utils.d.ts +5 -0
  8. package/dist/generator/generators/typescript/templates/validation-utils.d.ts +21 -0
  9. package/dist/generator/generators/typescript/ts-ast.d.ts +1 -0
  10. package/dist/generator/generators/typescript/ts-generator.d.ts +17 -0
  11. package/dist/generator/validators/abstract-validator.d.ts +17 -0
  12. package/dist/generator/validators/config-validator.d.ts +11 -0
  13. package/dist/generator/validators/session-data-config/session-data-validator.d.ts +9 -0
  14. package/dist/generator/validators/tests-config/sub-validations.d.ts +38 -0
  15. package/dist/generator/validators/tests-config/test-list-validator.d.ts +10 -0
  16. package/dist/generator/validators/tests-config/test-validator.d.ts +7 -0
  17. package/dist/index.d.ts +1 -0
  18. package/dist/index.js +39 -1
  19. package/dist/services/return-complier/ast-functions/compile-to-markdown.d.ts +2 -0
  20. package/dist/services/return-complier/ast-functions/semantic-validations.d.ts +2 -0
  21. package/dist/services/return-complier/ast.d.ts +42 -0
  22. package/dist/services/return-complier/combined.d.ts +2 -0
  23. package/dist/services/return-complier/parser.d.ts +14 -0
  24. package/dist/services/return-complier/tokens.d.ts +22 -0
  25. package/dist/services/schema-service.d.ts +6 -0
  26. package/dist/types/build.d.ts +48 -0
  27. package/dist/types/compiler-types.d.ts +3 -0
  28. package/dist/types/config-types.d.ts +21 -0
  29. package/dist/types/error-codes.d.ts +6 -0
  30. package/dist/types/general-types.d.ts +2 -0
  31. package/dist/utils/config-utils/json-schema-utils.d.ts +7 -0
  32. package/dist/utils/config-utils/yaml.d.ts +1 -0
  33. package/dist/utils/fs-utils.d.ts +3 -0
  34. package/dist/utils/general-utils/string-utils.d.ts +27 -0
  35. package/dist/utils/general-utils/test-object-utils.d.ts +2 -0
  36. package/dist/utils/general-utils/validation-utils.d.ts +5 -0
  37. package/dist/utils/json-path-utils/extract-string-paths.d.ts +8 -0
  38. package/dist/utils/json-path-utils/paths.d.ts +9 -0
  39. package/dist/utils/logger.d.ts +3 -0
  40. package/package.json +2 -2
  41. package/generated/L1-validations/api-tests/cancel.ts +0 -569
  42. package/generated/L1-validations/api-tests/confirm.ts +0 -1162
  43. package/generated/L1-validations/api-tests/init.ts +0 -1063
  44. package/generated/L1-validations/api-tests/on_cancel.ts +0 -2069
  45. package/generated/L1-validations/api-tests/on_confirm.ts +0 -2219
  46. package/generated/L1-validations/api-tests/on_init.ts +0 -1949
  47. package/generated/L1-validations/api-tests/on_search.ts +0 -1574
  48. package/generated/L1-validations/api-tests/on_select.ts +0 -1723
  49. package/generated/L1-validations/api-tests/on_status.ts +0 -2221
  50. package/generated/L1-validations/api-tests/on_update.ts +0 -1969
  51. package/generated/L1-validations/api-tests/search.ts +0 -695
  52. package/generated/L1-validations/api-tests/select.ts +0 -994
  53. package/generated/L1-validations/api-tests/status.ts +0 -443
  54. package/generated/L1-validations/api-tests/update.ts +0 -898
  55. package/generated/L1-validations/error.ts +0 -64
  56. package/generated/L1-validations/index.ts +0 -138
  57. package/generated/L1-validations/page/index.html +0 -2118
  58. package/generated/L1-validations/page/style.css +0 -225
  59. package/generated/L1-validations/readme.md +0 -1779
  60. package/generated/L1-validations/types/test-config.ts +0 -27
  61. package/generated/L1-validations/utils/json-path-utils.ts +0 -17
  62. package/generated/L1-validations/utils/validation-utils.ts +0 -116
  63. package/generated-structure/api-tests/search.ts +0 -24
  64. package/generated-structure/types/test-config.ts +0 -21
  65. package/samples/build.yaml +0 -24799
  66. package/samples/output.md +0 -91
  67. package/samples/output.ts +0 -27
  68. package/samples/selections.json +0 -216
  69. package/samples/validation-config.json +0 -3422
  70. package/samples/x-validations.yaml +0 -2893
  71. /package/{generated-structure/error.ts → dist/example.d.ts} +0 -0
  72. /package/{generated-structure/index.ts → dist/generator/generators/python/py-generator.d.ts} +0 -0
package/samples/output.md DELETED
@@ -1,91 +0,0 @@
1
- ## a are unique && b are unique
2
-
3
- - **condition A**: all of the following sub conditions must be met:
4
-
5
- - **condition A.1**: {{a}} must be unique
6
- - **condition A.2**: {{b}} must be unique
7
-
8
- ## a are unique
9
-
10
- - **condition A**: {{a}} must be unique
11
-
12
- ## (a are unique && b are unique) || c are unique
13
-
14
- - **condition A**: any one of the following sub conditions must be met:
15
-
16
- - **condition A.1**: all of the following sub conditions must be met:
17
-
18
- - **condition A.1.1**: {{a}} must be unique
19
- - **condition A.1.2**: {{b}} must be unique
20
-
21
- - **condition A.2**: {{c}} must be unique
22
-
23
- ## a are unique && b are unique || c are unique
24
-
25
- - **condition A**: any one of the following sub conditions must be met:
26
-
27
- - **condition A.1**: all of the following sub conditions must be met:
28
-
29
- - **condition A.1.1**: {{a}} must be unique
30
- - **condition A.1.2**: {{b}} must be unique
31
-
32
- - **condition A.2**: {{c}} must be unique
33
-
34
- ## a are unique && (b are unique || c are unique)
35
-
36
- - **condition A**: all of the following sub conditions must be met:
37
-
38
- - **condition A.1**: {{a}} must be unique
39
- - **condition A.2**: any one of the following sub conditions must be met:
40
-
41
- - **condition A.2.1**: {{b}} must be unique
42
- - **condition A.2.2**: {{c}} must be unique
43
-
44
- ## a are unique && b are unique && c are unique && d are unique
45
-
46
- - **condition A**: all of the following sub conditions must be met:
47
-
48
- - **condition A.1**: all of the following sub conditions must be met:
49
-
50
- - **condition A.1.1**: all of the following sub conditions must be met:
51
-
52
- - **condition A.1.1.1**: {{a}} must be unique
53
- - **condition A.1.1.2**: {{b}} must be unique
54
-
55
- - **condition A.1.2**: {{c}} must be unique
56
-
57
- - **condition A.2**: {{d}} must be unique
58
-
59
- ## a are unique && !(b are unique || !(c are unique))
60
-
61
- - **condition A**: all of the following sub conditions must be met:
62
-
63
- - **condition A.1**: {{a}} must be unique
64
- - **condition A.2**: any one of the following sub conditions must **not** be met:
65
-
66
- - **condition A.2.1**: {{b}} must **not** be unique
67
- - **condition A.2.2**: {{c}} must be unique
68
-
69
- ## a are unique && (b are unique || !(!(c are unique))) && !(d are unique)
70
-
71
- - **condition A**: all of the following sub conditions must be met:
72
-
73
- - **condition A.1**: all of the following sub conditions must be met:
74
-
75
- - **condition A.1.1**: {{a}} must be unique
76
- - **condition A.1.2**: any one of the following sub conditions must be met:
77
-
78
- - **condition A.1.2.1**: {{b}} must be unique
79
- - **condition A.1.2.2**: {{c}} must be unique
80
-
81
- - **condition A.2**: {{d}} must **not** be unique
82
-
83
- ## hello
84
-
85
- - **condition A**: no element of $.context.location.country.code must be in ["null"]
86
-
87
- ###
88
-
89
- > Note: **Condition A** can be skipped if the following conditions are met:
90
- >
91
- > - **condition B**: $.context.location.country.code must be unique
package/samples/output.ts DELETED
@@ -1,27 +0,0 @@
1
- function finder_fees_percetage_check(input: validationInput): validationOutput {
2
- const scope = payloadUtils.getJsonPath(input.payload,"$.message.order.payments[*].tags[?(@.descriptor.code=='BUYER_FINDER_FEES')].list[?(@.descriptor.code=='BUYER_FINDER_FEES_PERCENTAGE')]");
3
- for(const testObj of scope){
4
- testObj._EXTERNAL = input.externalData;
5
- const value = payloadUtils.getJsonPath(testObj, '$.value')
6
- const reg = ["^[0-9]{1,2}$"]
7
- const nulls = ["null"]
8
-
9
-
10
-
11
-
12
- const validate = (validations.noneIn(value, nulls)) && (validations.followRegex(value, reg))
13
-
14
-
15
- if(!validate){
16
- return [{
17
- valid: false,
18
- errorCode: "30000",
19
- description: `- **condition A**: all of the following sub conditions must be met:
20
-
21
- - **condition A.1**: no element of $.value must be in ["null"]
22
- - **condition A.2**: all elements of $.value must follow every regex in ["^[0-9]{1,2}$"]`
23
- }]
24
- }
25
- }
26
- return [{valid: true}];
27
- }
@@ -1,216 +0,0 @@
1
- {
2
- "_TESTS_": {
3
- "search": [
4
- {
5
- "_NAME_": "first_search_request",
6
- "mockType": "$._EXTERNAL.mock_type",
7
- "forType": ["BAP"],
8
- "_RETURN_": "(mockType equal to forType)",
9
- "_SUCCESS_CODE_": 100
10
- },
11
- {
12
- "_NAME_": "second_search_request",
13
- "mockType": "$._EXTERNAL.mock_type",
14
- "forType": ["BAP"],
15
- "_RETURN_": "(mockType equal to forType)",
16
- "_SUCCESS_CODE_": 101
17
- },
18
- {
19
- "_NAME_": "first_onsearch_request",
20
- "mockType": "$._EXTERNAL.mock_type",
21
- "city_code": "$._EXTERNAL.city_code",
22
- "bap_uri": "$._EXTERNAL.bap_uri",
23
- "forType": ["BPP"],
24
- "_RETURN_": "(mockType equal to forType) && (bap_uri are present) && (city_code are present)",
25
- "_SUCCESS_CODE_": 102
26
- },
27
- {
28
- "_NAME_": "second_onsearch_request",
29
- "mockType": "$._EXTERNAL.mock_type",
30
- "start_code": "$._EXTERNAL.start_code",
31
- "forType": ["BPP"],
32
- "_RETURN_": "(mockType equal to forType) && (start_code are present)",
33
- "_SUCCESS_CODE_": 103
34
- },
35
- {
36
- "_NAME_": "select_request",
37
- "lastAction": "$._EXTERNAL.last_action",
38
- "mockType": "$._EXTERNAL.mock_type",
39
- "forType": ["BAP"],
40
- "_RETURN_": "(mockType equal to forType)",
41
- "_SUCCESS_CODE_": 104
42
- },
43
- {
44
- "_NAME_": "onselect_request",
45
- "mockType": "$._EXTERNAL.mock_type",
46
- "selected_item_ids": "$._EXTERNAL.selected_item_ids[*]",
47
- "forType": ["BPP"],
48
- "_RETURN_": "(mockType equal to forType) && (selected_item_ids are present)",
49
- "_SUCCESS_CODE_": 105
50
- },
51
- {
52
- "_NAME_": "init_request",
53
- "mockType": "$._EXTERNAL.mock_type",
54
- "forType": ["BAP"],
55
- "_RETURN_": "(mockType equal to forType)",
56
- "_SUCCESS_CODE_": 106
57
- },
58
- {
59
- "_NAME_": "oninit_request",
60
- "mockType": "$._EXTERNAL.mock_type",
61
- "payments": "$._EXTERNAL.payments[*].collected_by",
62
- "forType": ["BPP"],
63
- "_RETURN_": "(mockType equal to forType) && (payments are present)",
64
- "_SUCCESS_CODE_": 107
65
- },
66
- {
67
- "_NAME_": "confirm_request",
68
- "mockType": "$._EXTERNAL.mock_type",
69
- "forType": ["BAP"],
70
- "_RETURN_": "(mockType equal to forType)",
71
- "_SUCCESS_CODE_": 108
72
- },
73
- {
74
- "_NAME_": "onconfirm_request",
75
- "mockType": "$._EXTERNAL.mock_type",
76
- "updated_payments": "$._EXTERNAL.updated_payments[*].id",
77
- "forType": ["BPP"],
78
- "_RETURN_": "(mockType equal to forType) && (updated_payments are present)",
79
- "_SUCCESS_CODE_": 109
80
- },
81
- {
82
- "_NAME_": "onconfirm_delayed_request",
83
- "mockType": "$._EXTERNAL.mock_type",
84
- "updated_payments": "$._EXTERNAL.updated_payments[*].id",
85
- "forType": ["BPP"],
86
- "_RETURN_": "(mockType equal to forType) && (updated_payments are present)",
87
- "_SUCCESS_CODE_": 110
88
- },
89
- {
90
- "_NAME_": "status_request",
91
- "mockType": "$._EXTERNAL.mock_type",
92
- "forType": ["BAP"],
93
- "_RETURN_": "(mockType equal to forType)",
94
- "_SUCCESS_CODE_": 111
95
- },
96
- {
97
- "_NAME_": "onstatus_active_request",
98
- "mockType": "$._EXTERNAL.mock_type",
99
- "forType": ["BPP"],
100
- "order_id": "$._EXTERNAL.order_id",
101
- "_RETURN_": "(mockType equal to forType) && (order_id are present)",
102
- "_SUCCESS_CODE_": 112
103
- },
104
- {
105
- "_NAME_": "onstatus_complete_request",
106
- "mockType": "$._EXTERNAL.mock_type",
107
- "forType": ["BPP"],
108
- "order_id": "$._EXTERNAL.order_id",
109
- "_RETURN_": "(mockType equal to forType) && (order_id are present)",
110
- "_SUCCESS_CODE_": 113
111
- },
112
- {
113
- "_NAME_": "onstatus_complete_unsolicited_request",
114
- "mockType": "$._EXTERNAL.mock_type",
115
- "forType": ["BPP"],
116
- "order_id": "$._EXTERNAL.order_id",
117
- "_RETURN_": "(mockType equal to forType) && (order_id are present)",
118
- "_SUCCESS_CODE_": 114
119
- },
120
- {
121
- "_NAME_": "cancel_request",
122
- "mockType": "$._EXTERNAL.mock_type",
123
- "forType": ["BAP"],
124
- "_RETURN_": "(mockType equal to forType) ",
125
- "_SUCCESS_CODE_": 115
126
- },
127
- {
128
- "_NAME_": "cancel_soft_request",
129
- "mockType": "$._EXTERNAL.mock_type",
130
- "forType": ["BAP"],
131
- "_RETURN_": "(mockType equal to forType)",
132
- "_SUCCESS_CODE_": 116
133
- },
134
- {
135
- "_NAME_": "cancel_hard_request",
136
- "mockType": "$._EXTERNAL.mock_type",
137
- "forType": ["BAP"],
138
- "_RETURN_": "(mockType equal to forType)",
139
- "_SUCCESS_CODE_": 117
140
- },
141
- {
142
- "_NAME_": "oncancel_request",
143
- "mockType": "$._EXTERNAL.mock_type",
144
- "forType": ["BPP"],
145
- "order_id": "$._EXTERNAL.order_id",
146
- "_RETURN_": "(mockType equal to forType) && (order_id are present)",
147
- "_SUCCESS_CODE_": 118
148
- },
149
- {
150
- "_NAME_": "oncancel_soft_request",
151
- "mockType": "$._EXTERNAL.mock_type",
152
- "forType": ["BPP"],
153
- "order_id": "$._EXTERNAL.order_id",
154
- "_RETURN_": "(mockType equal to forType) && (order_id are present)",
155
- "_SUCCESS_CODE_": 119
156
- },
157
- {
158
- "_NAME_": "oncancel_hard_request",
159
- "mockType": "$._EXTERNAL.mock_type",
160
- "forType": ["BPP"],
161
- "order_id": "$._EXTERNAL.order_id",
162
- "_RETURN_": "(mockType equal to forType) && (order_id are present)",
163
- "_SUCCESS_CODE_": 120
164
- },
165
- {
166
- "_NAME_": "oncancel_init_request",
167
- "mockType": "$._EXTERNAL.mock_type",
168
- "forType": ["BPP"],
169
- "order_id": "$._EXTERNAL.order_id",
170
- "_RETURN_": "(mockType equal to forType) && (order_id are present)",
171
- "_SUCCESS_CODE_": 121
172
- },
173
- {
174
- "_NAME_": "onupdate_request",
175
- "mockType": "$._EXTERNAL.mock_type",
176
- "forType": ["BPP"],
177
- "order_id": "$._EXTERNAL.order_id",
178
- "_RETURN_": "(mockType equal to forType) && (order_id are present)",
179
- "_SUCCESS_CODE_": 122
180
- }
181
- ]
182
- },
183
- "_SESSION_DATA_": {
184
- "search": {
185
- "transaction_id": null,
186
- "message_id": null,
187
- "last_action": null,
188
- "mock_type": null,
189
- "city_code": null,
190
- "bap_id": null,
191
- "bap_uri": null,
192
- "bpp_id": null,
193
- "bpp_uri": null,
194
- "start_code": null,
195
- "end_code": null,
196
- "buyer_app_fee": null,
197
- "vehicle_type": null,
198
- "fulfillments": null,
199
- "category_ids": null,
200
- "provider_id": null,
201
- "fulfillment_ids": null,
202
- "item_ids": null,
203
- "items": null,
204
- "selected_items": null,
205
- "selected_item_ids": null,
206
- "billing": null,
207
- "payments": null,
208
- "updated_payments": null,
209
- "order_id": null,
210
- "status": null,
211
- "error_code": null,
212
- "error_message": null,
213
- "quote": null
214
- }
215
- }
216
- }