@open-rap/compiler 0.0.0-stage → 0.1.1
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.
- package/LICENSE +21 -0
- package/README.md +21 -2
- package/dist/agent/server.d.ts +35 -0
- package/dist/agent/server.js +408 -0
- package/dist/agent/server.js.map +1 -0
- package/dist/authoring/abapgit.d.ts +38 -0
- package/dist/authoring/abapgit.js +242 -0
- package/dist/authoring/abapgit.js.map +1 -0
- package/dist/authoring/catalog.d.ts +48 -0
- package/dist/authoring/catalog.js +117 -0
- package/dist/authoring/catalog.js.map +1 -0
- package/dist/authoring/floorplan.d.ts +28 -0
- package/dist/authoring/floorplan.js +31 -0
- package/dist/authoring/floorplan.js.map +1 -0
- package/dist/authoring/generate.d.ts +57 -0
- package/dist/authoring/generate.js +630 -0
- package/dist/authoring/generate.js.map +1 -0
- package/dist/authoring/mcp.d.ts +15 -0
- package/dist/authoring/mcp.js +52 -0
- package/dist/authoring/mcp.js.map +1 -0
- package/dist/authoring/new.d.ts +35 -0
- package/dist/authoring/new.js +389 -0
- package/dist/authoring/new.js.map +1 -0
- package/dist/bdef/ast.d.ts +249 -0
- package/dist/bdef/ast.js +3 -0
- package/dist/bdef/ast.js.map +1 -0
- package/dist/bdef/lexer.d.ts +105 -0
- package/dist/bdef/lexer.js +148 -0
- package/dist/bdef/lexer.js.map +1 -0
- package/dist/bdef/parser.d.ts +22 -0
- package/dist/bdef/parser.js +1012 -0
- package/dist/bdef/parser.js.map +1 -0
- package/dist/build.d.ts +26 -0
- package/dist/build.js +62 -0
- package/dist/build.js.map +1 -0
- package/dist/cds/adapter.d.ts +91 -0
- package/dist/cds/adapter.js +381 -0
- package/dist/cds/adapter.js.map +1 -0
- package/dist/cds/expression-ast.d.ts +65 -0
- package/dist/cds/expression-ast.js +330 -0
- package/dist/cds/expression-ast.js.map +1 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.js +485 -0
- package/dist/cli.js.map +1 -0
- package/dist/dcl/parser.d.ts +59 -0
- package/dist/dcl/parser.js +338 -0
- package/dist/dcl/parser.js.map +1 -0
- package/dist/ddic/catalog.d.ts +17 -0
- package/dist/ddic/catalog.js +211 -0
- package/dist/ddic/catalog.js.map +1 -0
- package/dist/ddic/cds-types.d.ts +47 -0
- package/dist/ddic/cds-types.js +131 -0
- package/dist/ddic/cds-types.js.map +1 -0
- package/dist/ddic/table-source.d.ts +70 -0
- package/dist/ddic/table-source.js +500 -0
- package/dist/ddic/table-source.js.map +1 -0
- package/dist/ddic/xml.d.ts +65 -0
- package/dist/ddic/xml.js +201 -0
- package/dist/ddic/xml.js.map +1 -0
- package/dist/dev.d.ts +128 -0
- package/dist/dev.js +434 -0
- package/dist/dev.js.map +1 -0
- package/dist/diagnostics.d.ts +33 -0
- package/dist/diagnostics.js +53 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/gen/abap/derived-types.d.ts +26 -0
- package/dist/gen/abap/derived-types.js +323 -0
- package/dist/gen/abap/derived-types.js.map +1 -0
- package/dist/gen/abap/eml.d.ts +118 -0
- package/dist/gen/abap/eml.js +362 -0
- package/dist/gen/abap/eml.js.map +1 -0
- package/dist/gen/abap/enums.d.ts +13 -0
- package/dist/gen/abap/enums.js +74 -0
- package/dist/gen/abap/enums.js.map +1 -0
- package/dist/gen/abap/framework-http.d.ts +14 -0
- package/dist/gen/abap/framework-http.js +1049 -0
- package/dist/gen/abap/framework-http.js.map +1 -0
- package/dist/gen/abap/framework-query.d.ts +14 -0
- package/dist/gen/abap/framework-query.js +225 -0
- package/dist/gen/abap/framework-query.js.map +1 -0
- package/dist/gen/abap/framework-utils.d.ts +29 -0
- package/dist/gen/abap/framework-utils.js +3707 -0
- package/dist/gen/abap/framework-utils.js.map +1 -0
- package/dist/gen/abap/framework.d.ts +12 -0
- package/dist/gen/abap/framework.js +480 -0
- package/dist/gen/abap/framework.js.map +1 -0
- package/dist/gen/abap/generate.d.ts +40 -0
- package/dist/gen/abap/generate.js +238 -0
- package/dist/gen/abap/generate.js.map +1 -0
- package/dist/gen/abap/rewrite.d.ts +82 -0
- package/dist/gen/abap/rewrite.js +957 -0
- package/dist/gen/abap/rewrite.js.map +1 -0
- package/dist/gen/abap/shadow.d.ts +25 -0
- package/dist/gen/abap/shadow.js +175 -0
- package/dist/gen/abap/shadow.js.map +1 -0
- package/dist/gen/abap/tokens.d.ts +33 -0
- package/dist/gen/abap/tokens.js +87 -0
- package/dist/gen/abap/tokens.js.map +1 -0
- package/dist/gen/app/index.d.ts +25 -0
- package/dist/gen/app/index.js +322 -0
- package/dist/gen/app/index.js.map +1 -0
- package/dist/gen/csdl.d.ts +11 -0
- package/dist/gen/csdl.js +562 -0
- package/dist/gen/csdl.js.map +1 -0
- package/dist/gen/deploy.d.ts +12 -0
- package/dist/gen/deploy.js +53 -0
- package/dist/gen/deploy.js.map +1 -0
- package/dist/gen/docs/index.d.ts +35 -0
- package/dist/gen/docs/index.js +267 -0
- package/dist/gen/docs/index.js.map +1 -0
- package/dist/gen/docs/markdown.d.ts +23 -0
- package/dist/gen/docs/markdown.js +187 -0
- package/dist/gen/docs/markdown.js.map +1 -0
- package/dist/gen/docs/site.d.ts +17 -0
- package/dist/gen/docs/site.js +106 -0
- package/dist/gen/docs/site.js.map +1 -0
- package/dist/gen/keycloak.d.ts +21 -0
- package/dist/gen/keycloak.js +90 -0
- package/dist/gen/keycloak.js.map +1 -0
- package/dist/gen/launchpad/index.d.ts +48 -0
- package/dist/gen/launchpad/index.js +302 -0
- package/dist/gen/launchpad/index.js.map +1 -0
- package/dist/gen/launchpad/ui.d.ts +14 -0
- package/dist/gen/launchpad/ui.js +350 -0
- package/dist/gen/launchpad/ui.js.map +1 -0
- package/dist/gen/mcp.d.ts +23 -0
- package/dist/gen/mcp.js +244 -0
- package/dist/gen/mcp.js.map +1 -0
- package/dist/gen/sql-expressions.d.ts +12 -0
- package/dist/gen/sql-expressions.js +136 -0
- package/dist/gen/sql-expressions.js.map +1 -0
- package/dist/gen/sql.d.ts +38 -0
- package/dist/gen/sql.js +612 -0
- package/dist/gen/sql.js.map +1 -0
- package/dist/gen/ui/index.d.ts +7 -0
- package/dist/gen/ui/index.js +27 -0
- package/dist/gen/ui/index.js.map +1 -0
- package/dist/gen/ui/layout.d.ts +230 -0
- package/dist/gen/ui/layout.js +511 -0
- package/dist/gen/ui/layout.js.map +1 -0
- package/dist/gen/ui/static.d.ts +55 -0
- package/dist/gen/ui/static.js +2901 -0
- package/dist/gen/ui/static.js.map +1 -0
- package/dist/gen/ui/views.d.ts +10 -0
- package/dist/gen/ui/views.js +511 -0
- package/dist/gen/ui/views.js.map +1 -0
- package/dist/gen/vendor.d.ts +23 -0
- package/dist/gen/vendor.js +68 -0
- package/dist/gen/vendor.js.map +1 -0
- package/dist/gen/xml.d.ts +9 -0
- package/dist/gen/xml.js +42 -0
- package/dist/gen/xml.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/input/project.d.ts +50 -0
- package/dist/input/project.js +128 -0
- package/dist/input/project.js.map +1 -0
- package/dist/ir/access-controls.d.ts +11 -0
- package/dist/ir/access-controls.js +148 -0
- package/dist/ir/access-controls.js.map +1 -0
- package/dist/ir/authorizations.d.ts +25 -0
- package/dist/ir/authorizations.js +178 -0
- package/dist/ir/authorizations.js.map +1 -0
- package/dist/ir/behaviors.d.ts +16 -0
- package/dist/ir/behaviors.js +548 -0
- package/dist/ir/behaviors.js.map +1 -0
- package/dist/ir/builder.d.ts +20 -0
- package/dist/ir/builder.js +505 -0
- package/dist/ir/builder.js.map +1 -0
- package/dist/ir/config.d.ts +25 -0
- package/dist/ir/config.js +130 -0
- package/dist/ir/config.js.map +1 -0
- package/dist/ir/dictionary.d.ts +54 -0
- package/dist/ir/dictionary.js +328 -0
- package/dist/ir/dictionary.js.map +1 -0
- package/dist/ir/entities.d.ts +58 -0
- package/dist/ir/entities.js +676 -0
- package/dist/ir/entities.js.map +1 -0
- package/dist/ir/expressions.d.ts +33 -0
- package/dist/ir/expressions.js +327 -0
- package/dist/ir/expressions.js.map +1 -0
- package/dist/ir/handlers.d.ts +63 -0
- package/dist/ir/handlers.js +398 -0
- package/dist/ir/handlers.js.map +1 -0
- package/dist/ir/number-ranges.d.ts +24 -0
- package/dist/ir/number-ranges.js +74 -0
- package/dist/ir/number-ranges.js.map +1 -0
- package/dist/ir/seed.d.ts +23 -0
- package/dist/ir/seed.js +78 -0
- package/dist/ir/seed.js.map +1 -0
- package/dist/ir/service.d.ts +21 -0
- package/dist/ir/service.js +96 -0
- package/dist/ir/service.js.map +1 -0
- package/dist/launchpad/config.d.ts +47 -0
- package/dist/launchpad/config.js +321 -0
- package/dist/launchpad/config.js.map +1 -0
- package/dist/launchpad/workspace.d.ts +48 -0
- package/dist/launchpad/workspace.js +166 -0
- package/dist/launchpad/workspace.js.map +1 -0
- package/dist/srvd/parser.d.ts +36 -0
- package/dist/srvd/parser.js +193 -0
- package/dist/srvd/parser.js.map +1 -0
- package/dist/standard/data.d.ts +18 -0
- package/dist/standard/data.js +534 -0
- package/dist/standard/data.js.map +1 -0
- package/dist/standard/index.d.ts +36 -0
- package/dist/standard/index.js +507 -0
- package/dist/standard/index.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.js +4 -0
- package/dist/version.js.map +1 -0
- package/docs/AGENTS.md +79 -0
- package/docs/ANNOTATIONS.md +76 -0
- package/docs/DECISIONS.md +1554 -0
- package/docs/DEPLOYMENT.md +113 -0
- package/docs/DIAGNOSTICS.md +116 -0
- package/docs/FEATURES.md +287 -0
- package/docs/GUIDE.md +560 -0
- package/docs/KNOWN_GAPS.md +216 -0
- package/docs/MCP.md +84 -0
- package/docs/PLAN.md +690 -0
- package/docs/README.md +148 -0
- package/docs/REMOTE_APIS.md +121 -0
- package/docs/ROADMAP.md +35 -0
- package/docs/UTILITIES.md +95 -0
- package/package.json +49 -3
|
@@ -0,0 +1,1049 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clean-room ABAP for the consumption of remote APIs from a behavior pool (decision D31): the
|
|
3
|
+
* HTTP client of ABAP Cloud (cl_http_destination_provider, cl_web_http_client_manager,
|
|
4
|
+
* if_web_http_client, if_web_http_request, if_web_http_response) and the OData client proxy of
|
|
5
|
+
* the service consumption model (/iwbep/cl_cp_factory_remote, cl_web_odata_client_factory and the
|
|
6
|
+
* /iwbep/if_cp_* requests). The ABAP keeps the state of the objects; the kernel (ZRAP_EML) does
|
|
7
|
+
* the network calls, reads the $metadata of the remote service and converts the values.
|
|
8
|
+
*/
|
|
9
|
+
const ZRAP_IF_HTTP = `INTERFACE zrap_if_http PUBLIC.
|
|
10
|
+
TYPES: BEGIN OF ty_header,
|
|
11
|
+
name TYPE string,
|
|
12
|
+
value TYPE string,
|
|
13
|
+
END OF ty_header,
|
|
14
|
+
tt_header TYPE STANDARD TABLE OF ty_header WITH EMPTY KEY.
|
|
15
|
+
ENDINTERFACE.
|
|
16
|
+
`;
|
|
17
|
+
/**
|
|
18
|
+
* An exception with a text of its own (the message of the remote side), for get_text( ). The
|
|
19
|
+
* classes under cx_static_check declare `zrap_text`; their subclasses inherit it.
|
|
20
|
+
*/
|
|
21
|
+
const textException = (name, superclass, attributes = "") => {
|
|
22
|
+
const root = superclass.toLowerCase() === "cx_static_check";
|
|
23
|
+
const http = attributes.includes("http_status_code");
|
|
24
|
+
return `CLASS ${name} DEFINITION PUBLIC INHERITING FROM ${superclass} CREATE PUBLIC.
|
|
25
|
+
PUBLIC SECTION.${root ? "\n DATA zrap_text TYPE string READ-ONLY." : ""}${attributes === "" ? "" : `\n${attributes}`}
|
|
26
|
+
METHODS constructor
|
|
27
|
+
IMPORTING textid LIKE textid OPTIONAL
|
|
28
|
+
previous LIKE previous OPTIONAL
|
|
29
|
+
zrap_text TYPE string OPTIONAL${http ? "\n http_status_code TYPE i OPTIONAL\n http_error_body TYPE string OPTIONAL" : ""}.
|
|
30
|
+
ENDCLASS.
|
|
31
|
+
|
|
32
|
+
CLASS ${name} IMPLEMENTATION.
|
|
33
|
+
METHOD constructor.
|
|
34
|
+
super->constructor( textid = textid previous = previous${root ? "" : " zrap_text = zrap_text"} ).${root ? "\n me->zrap_text = zrap_text." : ""}${http ? "\n me->http_status_code = http_status_code.\n me->http_error_body = http_error_body." : ""}
|
|
35
|
+
ENDMETHOD.
|
|
36
|
+
ENDCLASS.
|
|
37
|
+
`;
|
|
38
|
+
};
|
|
39
|
+
const IF_HTTP_DESTINATION = `INTERFACE if_http_destination PUBLIC.
|
|
40
|
+
ENDINTERFACE.
|
|
41
|
+
`;
|
|
42
|
+
const ZRAP_CL_HTTP_DESTINATION = `CLASS zrap_cl_http_destination DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
|
43
|
+
PUBLIC SECTION.
|
|
44
|
+
INTERFACES if_http_destination.
|
|
45
|
+
"! Base URL of the destination.
|
|
46
|
+
DATA url TYPE string READ-ONLY.
|
|
47
|
+
"! Name of the configured destination (credentials), empty for create_by_url.
|
|
48
|
+
DATA name TYPE string READ-ONLY.
|
|
49
|
+
METHODS constructor IMPORTING url TYPE string name TYPE string OPTIONAL.
|
|
50
|
+
ENDCLASS.
|
|
51
|
+
|
|
52
|
+
CLASS zrap_cl_http_destination IMPLEMENTATION.
|
|
53
|
+
METHOD constructor.
|
|
54
|
+
me->url = url.
|
|
55
|
+
me->name = name.
|
|
56
|
+
ENDMETHOD.
|
|
57
|
+
ENDCLASS.
|
|
58
|
+
`;
|
|
59
|
+
const CL_HTTP_DESTINATION_PROVIDER = `CLASS cl_http_destination_provider DEFINITION PUBLIC FINAL CREATE PRIVATE.
|
|
60
|
+
PUBLIC SECTION.
|
|
61
|
+
CLASS-METHODS create_by_url
|
|
62
|
+
IMPORTING i_url TYPE csequence
|
|
63
|
+
RETURNING VALUE(r_http_destination) TYPE REF TO if_http_destination
|
|
64
|
+
RAISING cx_http_dest_provider_error.
|
|
65
|
+
CLASS-METHODS create_by_comm_arrangement
|
|
66
|
+
IMPORTING comm_scenario TYPE csequence
|
|
67
|
+
comm_system_id TYPE csequence OPTIONAL
|
|
68
|
+
service_id TYPE csequence OPTIONAL
|
|
69
|
+
RETURNING VALUE(r_http_destination) TYPE REF TO if_http_destination
|
|
70
|
+
RAISING cx_http_dest_provider_error.
|
|
71
|
+
CLASS-METHODS create_by_cloud_destination
|
|
72
|
+
IMPORTING i_name TYPE csequence
|
|
73
|
+
i_service_instance_name TYPE csequence OPTIONAL
|
|
74
|
+
i_authn_mode TYPE any OPTIONAL
|
|
75
|
+
RETURNING VALUE(r_http_destination) TYPE REF TO if_http_destination
|
|
76
|
+
RAISING cx_http_dest_provider_error.
|
|
77
|
+
ENDCLASS.
|
|
78
|
+
|
|
79
|
+
CLASS cl_http_destination_provider IMPLEMENTATION.
|
|
80
|
+
METHOD create_by_url.
|
|
81
|
+
IF i_url IS INITIAL.
|
|
82
|
+
RAISE EXCEPTION TYPE cx_http_dest_provider_error EXPORTING zrap_text = |create_by_url: no URL|.
|
|
83
|
+
ENDIF.
|
|
84
|
+
r_http_destination = NEW zrap_cl_http_destination( url = |{ i_url }| ).
|
|
85
|
+
ENDMETHOD.
|
|
86
|
+
|
|
87
|
+
METHOD create_by_comm_arrangement.
|
|
88
|
+
DATA name TYPE string.
|
|
89
|
+
name = |{ comm_scenario }|.
|
|
90
|
+
IF service_id IS NOT INITIAL.
|
|
91
|
+
name = |{ name }.{ service_id }|.
|
|
92
|
+
ENDIF.
|
|
93
|
+
r_http_destination = NEW zrap_cl_http_destination( url = zrap_eml=>destination( name ) name = name ).
|
|
94
|
+
ENDMETHOD.
|
|
95
|
+
|
|
96
|
+
METHOD create_by_cloud_destination.
|
|
97
|
+
DATA name TYPE string.
|
|
98
|
+
name = |{ i_name }|.
|
|
99
|
+
r_http_destination = NEW zrap_cl_http_destination( url = zrap_eml=>destination( name ) name = name ).
|
|
100
|
+
ENDMETHOD.
|
|
101
|
+
ENDCLASS.
|
|
102
|
+
`;
|
|
103
|
+
const IF_WEB_HTTP_REQUEST = `INTERFACE if_web_http_request PUBLIC.
|
|
104
|
+
TYPES: BEGIN OF name_value_pair,
|
|
105
|
+
name TYPE string,
|
|
106
|
+
value TYPE string,
|
|
107
|
+
END OF name_value_pair,
|
|
108
|
+
name_value_pairs TYPE STANDARD TABLE OF name_value_pair WITH DEFAULT KEY.
|
|
109
|
+
METHODS set_uri_path IMPORTING i_uri_path TYPE csequence RETURNING VALUE(r_value) TYPE REF TO if_web_http_request.
|
|
110
|
+
METHODS get_uri_path RETURNING VALUE(r_value) TYPE string.
|
|
111
|
+
METHODS set_query IMPORTING query TYPE csequence RETURNING VALUE(r_value) TYPE REF TO if_web_http_request.
|
|
112
|
+
METHODS set_header_field IMPORTING i_name TYPE csequence i_value TYPE csequence RETURNING VALUE(r_value) TYPE REF TO if_web_http_request.
|
|
113
|
+
METHODS get_header_field IMPORTING i_name TYPE csequence RETURNING VALUE(r_value) TYPE string.
|
|
114
|
+
METHODS set_header_fields IMPORTING i_fields TYPE name_value_pairs RETURNING VALUE(r_value) TYPE REF TO if_web_http_request.
|
|
115
|
+
METHODS get_header_fields RETURNING VALUE(r_value) TYPE name_value_pairs.
|
|
116
|
+
METHODS delete_header_field IMPORTING i_name TYPE csequence RETURNING VALUE(r_value) TYPE REF TO if_web_http_request.
|
|
117
|
+
METHODS set_content_type IMPORTING content_type TYPE csequence RETURNING VALUE(r_value) TYPE REF TO if_web_http_request.
|
|
118
|
+
METHODS get_content_type RETURNING VALUE(r_value) TYPE string.
|
|
119
|
+
METHODS set_text IMPORTING i_text TYPE csequence RETURNING VALUE(r_value) TYPE REF TO if_web_http_request.
|
|
120
|
+
METHODS get_text RETURNING VALUE(r_value) TYPE string.
|
|
121
|
+
METHODS set_binary IMPORTING i_data TYPE xsequence RETURNING VALUE(r_value) TYPE REF TO if_web_http_request.
|
|
122
|
+
METHODS get_binary RETURNING VALUE(r_value) TYPE xstring.
|
|
123
|
+
METHODS set_form_field IMPORTING i_name TYPE csequence i_value TYPE csequence RETURNING VALUE(r_value) TYPE REF TO if_web_http_request.
|
|
124
|
+
METHODS set_form_fields IMPORTING i_fields TYPE name_value_pairs RETURNING VALUE(r_value) TYPE REF TO if_web_http_request.
|
|
125
|
+
METHODS set_authorization_basic IMPORTING i_username TYPE csequence i_password TYPE csequence RETURNING VALUE(r_value) TYPE REF TO if_web_http_request.
|
|
126
|
+
METHODS set_authorization_bearer IMPORTING i_bearer TYPE csequence RETURNING VALUE(r_value) TYPE REF TO if_web_http_request.
|
|
127
|
+
ENDINTERFACE.
|
|
128
|
+
`;
|
|
129
|
+
const IF_WEB_HTTP_RESPONSE = `INTERFACE if_web_http_response PUBLIC.
|
|
130
|
+
TYPES: BEGIN OF http_status,
|
|
131
|
+
code TYPE i,
|
|
132
|
+
reason TYPE string,
|
|
133
|
+
END OF http_status.
|
|
134
|
+
METHODS get_status RETURNING VALUE(r_value) TYPE http_status.
|
|
135
|
+
METHODS get_text RETURNING VALUE(r_value) TYPE string RAISING cx_web_message_error.
|
|
136
|
+
METHODS get_binary RETURNING VALUE(r_value) TYPE xstring RAISING cx_web_message_error.
|
|
137
|
+
METHODS get_header_field IMPORTING i_name TYPE csequence RETURNING VALUE(r_value) TYPE string.
|
|
138
|
+
METHODS get_header_fields RETURNING VALUE(r_value) TYPE if_web_http_request=>name_value_pairs.
|
|
139
|
+
METHODS get_content_type RETURNING VALUE(r_value) TYPE string.
|
|
140
|
+
ENDINTERFACE.
|
|
141
|
+
`;
|
|
142
|
+
/** Names and values of common header fields. */
|
|
143
|
+
const IF_WEB_HTTP_HEADER = `INTERFACE if_web_http_header PUBLIC.
|
|
144
|
+
CONSTANTS accept TYPE string VALUE 'accept'.
|
|
145
|
+
CONSTANTS accept_language TYPE string VALUE 'accept-language'.
|
|
146
|
+
CONSTANTS authorization TYPE string VALUE 'authorization'.
|
|
147
|
+
CONSTANTS content_type TYPE string VALUE 'content-type'.
|
|
148
|
+
CONSTANTS content_length TYPE string VALUE 'content-length'.
|
|
149
|
+
CONSTANTS cookie TYPE string VALUE 'cookie'.
|
|
150
|
+
CONSTANTS etag TYPE string VALUE 'etag'.
|
|
151
|
+
CONSTANTS if_match TYPE string VALUE 'if-match'.
|
|
152
|
+
CONSTANTS location TYPE string VALUE 'location'.
|
|
153
|
+
CONSTANTS user_agent TYPE string VALUE 'user-agent'.
|
|
154
|
+
CONSTANTS accept_application_json TYPE string VALUE 'application/json'.
|
|
155
|
+
CONSTANTS content_type_json TYPE string VALUE 'application/json'.
|
|
156
|
+
CONSTANTS content_type_xml TYPE string VALUE 'application/xml'.
|
|
157
|
+
CONSTANTS content_type_text_plain TYPE string VALUE 'text/plain'.
|
|
158
|
+
ENDINTERFACE.
|
|
159
|
+
`;
|
|
160
|
+
/** Authentication modes of create_by_cloud_destination (the kernel takes the destination's credentials). */
|
|
161
|
+
const IF_A4C_CP_SERVICE = `INTERFACE if_a4c_cp_service PUBLIC.
|
|
162
|
+
TYPES ty_authn_mode TYPE c LENGTH 1.
|
|
163
|
+
CONSTANTS service_specific TYPE ty_authn_mode VALUE 'S'.
|
|
164
|
+
CONSTANTS user_propagation TYPE ty_authn_mode VALUE 'U'.
|
|
165
|
+
ENDINTERFACE.
|
|
166
|
+
`;
|
|
167
|
+
const IF_WEB_HTTP_CLIENT = `INTERFACE if_web_http_client PUBLIC.
|
|
168
|
+
TYPES method TYPE string.
|
|
169
|
+
CONSTANTS get TYPE method VALUE 'GET'.
|
|
170
|
+
CONSTANTS post TYPE method VALUE 'POST'.
|
|
171
|
+
CONSTANTS put TYPE method VALUE 'PUT'.
|
|
172
|
+
CONSTANTS patch TYPE method VALUE 'PATCH'.
|
|
173
|
+
CONSTANTS delete TYPE method VALUE 'DELETE'.
|
|
174
|
+
CONSTANTS head TYPE method VALUE 'HEAD'.
|
|
175
|
+
CONSTANTS options TYPE method VALUE 'OPTIONS'.
|
|
176
|
+
METHODS get_http_request RETURNING VALUE(r_request) TYPE REF TO if_web_http_request.
|
|
177
|
+
METHODS execute
|
|
178
|
+
IMPORTING i_method TYPE method DEFAULT 'GET'
|
|
179
|
+
i_timeout TYPE i DEFAULT 0
|
|
180
|
+
PREFERRED PARAMETER i_method
|
|
181
|
+
RETURNING VALUE(r_response) TYPE REF TO if_web_http_response
|
|
182
|
+
RAISING cx_web_http_client_error.
|
|
183
|
+
METHODS close RAISING cx_web_http_client_error.
|
|
184
|
+
ENDINTERFACE.
|
|
185
|
+
`;
|
|
186
|
+
const ZRAP_CL_HTTP_REQUEST = `CLASS zrap_cl_http_request DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
|
187
|
+
PUBLIC SECTION.
|
|
188
|
+
INTERFACES if_web_http_request.
|
|
189
|
+
DATA path TYPE string READ-ONLY.
|
|
190
|
+
DATA query TYPE string READ-ONLY.
|
|
191
|
+
DATA headers TYPE zrap_if_http=>tt_header READ-ONLY.
|
|
192
|
+
DATA form TYPE zrap_if_http=>tt_header READ-ONLY.
|
|
193
|
+
DATA body TYPE string READ-ONLY.
|
|
194
|
+
DATA binary TYPE xstring READ-ONLY.
|
|
195
|
+
ENDCLASS.
|
|
196
|
+
|
|
197
|
+
CLASS zrap_cl_http_request IMPLEMENTATION.
|
|
198
|
+
METHOD if_web_http_request~set_uri_path.
|
|
199
|
+
path = i_uri_path.
|
|
200
|
+
r_value = me.
|
|
201
|
+
ENDMETHOD.
|
|
202
|
+
|
|
203
|
+
METHOD if_web_http_request~get_uri_path.
|
|
204
|
+
r_value = path.
|
|
205
|
+
ENDMETHOD.
|
|
206
|
+
|
|
207
|
+
METHOD if_web_http_request~set_query.
|
|
208
|
+
me->query = query.
|
|
209
|
+
r_value = me.
|
|
210
|
+
ENDMETHOD.
|
|
211
|
+
|
|
212
|
+
METHOD if_web_http_request~set_header_field.
|
|
213
|
+
DATA name TYPE string.
|
|
214
|
+
name = to_lower( |{ i_name }| ).
|
|
215
|
+
DELETE headers WHERE name = name.
|
|
216
|
+
APPEND VALUE #( name = name value = |{ i_value }| ) TO headers.
|
|
217
|
+
r_value = me.
|
|
218
|
+
ENDMETHOD.
|
|
219
|
+
|
|
220
|
+
METHOD if_web_http_request~get_header_field.
|
|
221
|
+
DATA name TYPE string.
|
|
222
|
+
name = to_lower( |{ i_name }| ).
|
|
223
|
+
READ TABLE headers INTO DATA(header) WITH KEY name = name.
|
|
224
|
+
IF sy-subrc = 0.
|
|
225
|
+
r_value = header-value.
|
|
226
|
+
ENDIF.
|
|
227
|
+
ENDMETHOD.
|
|
228
|
+
|
|
229
|
+
METHOD if_web_http_request~set_header_fields.
|
|
230
|
+
LOOP AT i_fields INTO DATA(field).
|
|
231
|
+
if_web_http_request~set_header_field( i_name = field-name i_value = field-value ).
|
|
232
|
+
ENDLOOP.
|
|
233
|
+
r_value = me.
|
|
234
|
+
ENDMETHOD.
|
|
235
|
+
|
|
236
|
+
METHOD if_web_http_request~get_header_fields.
|
|
237
|
+
r_value = headers.
|
|
238
|
+
ENDMETHOD.
|
|
239
|
+
|
|
240
|
+
METHOD if_web_http_request~delete_header_field.
|
|
241
|
+
DATA name TYPE string.
|
|
242
|
+
name = to_lower( |{ i_name }| ).
|
|
243
|
+
DELETE headers WHERE name = name.
|
|
244
|
+
r_value = me.
|
|
245
|
+
ENDMETHOD.
|
|
246
|
+
|
|
247
|
+
METHOD if_web_http_request~set_content_type.
|
|
248
|
+
r_value = if_web_http_request~set_header_field( i_name = 'content-type' i_value = content_type ).
|
|
249
|
+
ENDMETHOD.
|
|
250
|
+
|
|
251
|
+
METHOD if_web_http_request~get_content_type.
|
|
252
|
+
r_value = if_web_http_request~get_header_field( 'content-type' ).
|
|
253
|
+
ENDMETHOD.
|
|
254
|
+
|
|
255
|
+
METHOD if_web_http_request~set_text.
|
|
256
|
+
body = i_text.
|
|
257
|
+
CLEAR binary.
|
|
258
|
+
r_value = me.
|
|
259
|
+
ENDMETHOD.
|
|
260
|
+
|
|
261
|
+
METHOD if_web_http_request~get_text.
|
|
262
|
+
r_value = body.
|
|
263
|
+
ENDMETHOD.
|
|
264
|
+
|
|
265
|
+
METHOD if_web_http_request~set_binary.
|
|
266
|
+
binary = i_data.
|
|
267
|
+
CLEAR body.
|
|
268
|
+
r_value = me.
|
|
269
|
+
ENDMETHOD.
|
|
270
|
+
|
|
271
|
+
METHOD if_web_http_request~get_binary.
|
|
272
|
+
r_value = binary.
|
|
273
|
+
ENDMETHOD.
|
|
274
|
+
|
|
275
|
+
METHOD if_web_http_request~set_form_field.
|
|
276
|
+
APPEND VALUE #( name = |{ i_name }| value = |{ i_value }| ) TO form.
|
|
277
|
+
r_value = me.
|
|
278
|
+
ENDMETHOD.
|
|
279
|
+
|
|
280
|
+
METHOD if_web_http_request~set_form_fields.
|
|
281
|
+
LOOP AT i_fields INTO DATA(field).
|
|
282
|
+
if_web_http_request~set_form_field( i_name = field-name i_value = field-value ).
|
|
283
|
+
ENDLOOP.
|
|
284
|
+
r_value = me.
|
|
285
|
+
ENDMETHOD.
|
|
286
|
+
|
|
287
|
+
METHOD if_web_http_request~set_authorization_basic.
|
|
288
|
+
DATA token TYPE string.
|
|
289
|
+
token = zrap_eml=>base64_encode( |{ i_username }:{ i_password }| ).
|
|
290
|
+
r_value = if_web_http_request~set_header_field( i_name = 'authorization' i_value = |Basic { token }| ).
|
|
291
|
+
ENDMETHOD.
|
|
292
|
+
|
|
293
|
+
METHOD if_web_http_request~set_authorization_bearer.
|
|
294
|
+
r_value = if_web_http_request~set_header_field( i_name = 'authorization' i_value = |Bearer { i_bearer }| ).
|
|
295
|
+
ENDMETHOD.
|
|
296
|
+
ENDCLASS.
|
|
297
|
+
`;
|
|
298
|
+
const ZRAP_CL_HTTP_RESPONSE = `CLASS zrap_cl_http_response DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
|
299
|
+
PUBLIC SECTION.
|
|
300
|
+
INTERFACES if_web_http_response.
|
|
301
|
+
METHODS constructor
|
|
302
|
+
IMPORTING status TYPE i
|
|
303
|
+
reason TYPE string
|
|
304
|
+
headers TYPE zrap_if_http=>tt_header
|
|
305
|
+
body TYPE string
|
|
306
|
+
binary TYPE xstring.
|
|
307
|
+
PRIVATE SECTION.
|
|
308
|
+
DATA status TYPE i.
|
|
309
|
+
DATA reason TYPE string.
|
|
310
|
+
DATA headers TYPE zrap_if_http=>tt_header.
|
|
311
|
+
DATA body TYPE string.
|
|
312
|
+
DATA binary TYPE xstring.
|
|
313
|
+
ENDCLASS.
|
|
314
|
+
|
|
315
|
+
CLASS zrap_cl_http_response IMPLEMENTATION.
|
|
316
|
+
METHOD constructor.
|
|
317
|
+
me->status = status.
|
|
318
|
+
me->reason = reason.
|
|
319
|
+
me->headers = headers.
|
|
320
|
+
me->body = body.
|
|
321
|
+
me->binary = binary.
|
|
322
|
+
ENDMETHOD.
|
|
323
|
+
|
|
324
|
+
METHOD if_web_http_response~get_status.
|
|
325
|
+
r_value-code = status.
|
|
326
|
+
r_value-reason = reason.
|
|
327
|
+
ENDMETHOD.
|
|
328
|
+
|
|
329
|
+
METHOD if_web_http_response~get_text.
|
|
330
|
+
r_value = body.
|
|
331
|
+
ENDMETHOD.
|
|
332
|
+
|
|
333
|
+
METHOD if_web_http_response~get_binary.
|
|
334
|
+
r_value = binary.
|
|
335
|
+
ENDMETHOD.
|
|
336
|
+
|
|
337
|
+
METHOD if_web_http_response~get_header_field.
|
|
338
|
+
DATA name TYPE string.
|
|
339
|
+
name = to_lower( |{ i_name }| ).
|
|
340
|
+
READ TABLE headers INTO DATA(header) WITH KEY name = name.
|
|
341
|
+
IF sy-subrc = 0.
|
|
342
|
+
r_value = header-value.
|
|
343
|
+
ENDIF.
|
|
344
|
+
ENDMETHOD.
|
|
345
|
+
|
|
346
|
+
METHOD if_web_http_response~get_header_fields.
|
|
347
|
+
r_value = headers.
|
|
348
|
+
ENDMETHOD.
|
|
349
|
+
|
|
350
|
+
METHOD if_web_http_response~get_content_type.
|
|
351
|
+
r_value = if_web_http_response~get_header_field( 'content-type' ).
|
|
352
|
+
ENDMETHOD.
|
|
353
|
+
ENDCLASS.
|
|
354
|
+
`;
|
|
355
|
+
const ZRAP_CL_HTTP_CLIENT = `CLASS zrap_cl_http_client DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
|
356
|
+
PUBLIC SECTION.
|
|
357
|
+
INTERFACES if_web_http_client.
|
|
358
|
+
DATA destination TYPE REF TO zrap_cl_http_destination READ-ONLY.
|
|
359
|
+
METHODS constructor IMPORTING destination TYPE REF TO zrap_cl_http_destination.
|
|
360
|
+
PRIVATE SECTION.
|
|
361
|
+
DATA request TYPE REF TO zrap_cl_http_request.
|
|
362
|
+
ENDCLASS.
|
|
363
|
+
|
|
364
|
+
CLASS zrap_cl_http_client IMPLEMENTATION.
|
|
365
|
+
METHOD constructor.
|
|
366
|
+
me->destination = destination.
|
|
367
|
+
request = NEW #( ).
|
|
368
|
+
ENDMETHOD.
|
|
369
|
+
|
|
370
|
+
METHOD if_web_http_client~get_http_request.
|
|
371
|
+
r_request = request.
|
|
372
|
+
ENDMETHOD.
|
|
373
|
+
|
|
374
|
+
METHOD if_web_http_client~execute.
|
|
375
|
+
DATA status TYPE i.
|
|
376
|
+
DATA reason TYPE string.
|
|
377
|
+
DATA headers TYPE zrap_if_http=>tt_header.
|
|
378
|
+
DATA body TYPE string.
|
|
379
|
+
DATA binary TYPE xstring.
|
|
380
|
+
zrap_eml=>http_execute(
|
|
381
|
+
EXPORTING method = i_method
|
|
382
|
+
base = destination->url
|
|
383
|
+
path = request->path
|
|
384
|
+
query = request->query
|
|
385
|
+
destination = destination->name
|
|
386
|
+
headers = request->headers
|
|
387
|
+
form = request->form
|
|
388
|
+
body = request->body
|
|
389
|
+
binary = request->binary
|
|
390
|
+
timeout = i_timeout
|
|
391
|
+
IMPORTING status = status
|
|
392
|
+
reason = reason
|
|
393
|
+
response_headers = headers
|
|
394
|
+
response_body = body
|
|
395
|
+
response_binary = binary ).
|
|
396
|
+
r_response = NEW zrap_cl_http_response( status = status reason = reason headers = headers body = body binary = binary ).
|
|
397
|
+
ENDMETHOD.
|
|
398
|
+
|
|
399
|
+
METHOD if_web_http_client~close.
|
|
400
|
+
ENDMETHOD.
|
|
401
|
+
ENDCLASS.
|
|
402
|
+
`;
|
|
403
|
+
const CL_WEB_HTTP_CLIENT_MANAGER = `CLASS cl_web_http_client_manager DEFINITION PUBLIC FINAL CREATE PRIVATE.
|
|
404
|
+
PUBLIC SECTION.
|
|
405
|
+
CLASS-METHODS create_by_http_destination
|
|
406
|
+
IMPORTING i_destination TYPE REF TO if_http_destination
|
|
407
|
+
RETURNING VALUE(r_client) TYPE REF TO if_web_http_client
|
|
408
|
+
RAISING cx_web_http_client_error.
|
|
409
|
+
ENDCLASS.
|
|
410
|
+
|
|
411
|
+
CLASS cl_web_http_client_manager IMPLEMENTATION.
|
|
412
|
+
METHOD create_by_http_destination.
|
|
413
|
+
DATA destination TYPE REF TO zrap_cl_http_destination.
|
|
414
|
+
IF i_destination IS NOT BOUND.
|
|
415
|
+
RAISE EXCEPTION TYPE cx_web_http_client_error EXPORTING zrap_text = |create_by_http_destination: no destination|.
|
|
416
|
+
ENDIF.
|
|
417
|
+
destination ?= i_destination.
|
|
418
|
+
r_client = NEW zrap_cl_http_client( destination ).
|
|
419
|
+
ENDMETHOD.
|
|
420
|
+
ENDCLASS.
|
|
421
|
+
`;
|
|
422
|
+
// ---------------------------------------------------------------------------------------------
|
|
423
|
+
// OData client proxy
|
|
424
|
+
const IWBEP_RUNTIME_TYPES = `INTERFACE /iwbep/if_cp_runtime_types PUBLIC.
|
|
425
|
+
TYPES ty_entity_set_name TYPE c LENGTH 128.
|
|
426
|
+
TYPES ty_entity_type_name TYPE c LENGTH 128.
|
|
427
|
+
TYPES ty_complex_type_name TYPE c LENGTH 128.
|
|
428
|
+
TYPES ty_property_path TYPE string.
|
|
429
|
+
TYPES ty_t_property_path TYPE STANDARD TABLE OF ty_property_path WITH EMPTY KEY.
|
|
430
|
+
TYPES: BEGIN OF ty_s_sort_order,
|
|
431
|
+
property_path TYPE ty_property_path,
|
|
432
|
+
descending TYPE abap_bool,
|
|
433
|
+
END OF ty_s_sort_order,
|
|
434
|
+
ty_t_sort_order TYPE STANDARD TABLE OF ty_s_sort_order WITH EMPTY KEY.
|
|
435
|
+
ENDINTERFACE.
|
|
436
|
+
`;
|
|
437
|
+
const IWBEP_REGISTRY_TYPES = `INTERFACE /iwbep/if_cp_registry_types PUBLIC.
|
|
438
|
+
TYPES: BEGIN OF ty_s_proxy_model_key,
|
|
439
|
+
repository_id TYPE c LENGTH 30,
|
|
440
|
+
proxy_model_id TYPE c LENGTH 30,
|
|
441
|
+
proxy_model_version TYPE n LENGTH 4,
|
|
442
|
+
END OF ty_s_proxy_model_key.
|
|
443
|
+
ENDINTERFACE.
|
|
444
|
+
`;
|
|
445
|
+
/** Base class of the consumption model classes generated by a service consumption model (SCM2). */
|
|
446
|
+
const IWBEP_MODEL_PROVIDER = `CLASS /iwbep/cl_v4_abs_pm_model_prov DEFINITION PUBLIC ABSTRACT CREATE PUBLIC.
|
|
447
|
+
PUBLIC SECTION.
|
|
448
|
+
ENDCLASS.
|
|
449
|
+
|
|
450
|
+
CLASS /iwbep/cl_v4_abs_pm_model_prov IMPLEMENTATION.
|
|
451
|
+
ENDCLASS.
|
|
452
|
+
`;
|
|
453
|
+
const IWBEP_INTERFACES = `INTERFACE /iwbep/if_cp_filter_node PUBLIC.
|
|
454
|
+
METHODS and IMPORTING io_filter_node TYPE REF TO /iwbep/if_cp_filter_node RETURNING VALUE(ro_filter_node) TYPE REF TO /iwbep/if_cp_filter_node.
|
|
455
|
+
METHODS or IMPORTING io_filter_node TYPE REF TO /iwbep/if_cp_filter_node RETURNING VALUE(ro_filter_node) TYPE REF TO /iwbep/if_cp_filter_node.
|
|
456
|
+
METHODS not RETURNING VALUE(ro_filter_node) TYPE REF TO /iwbep/if_cp_filter_node.
|
|
457
|
+
ENDINTERFACE.
|
|
458
|
+
`;
|
|
459
|
+
const IWBEP_FILTER_FACTORY = `INTERFACE /iwbep/if_cp_filter_factory PUBLIC.
|
|
460
|
+
METHODS create_by_range
|
|
461
|
+
IMPORTING iv_property_path TYPE csequence
|
|
462
|
+
it_range TYPE ANY TABLE
|
|
463
|
+
RETURNING VALUE(ro_filter_node) TYPE REF TO /iwbep/if_cp_filter_node
|
|
464
|
+
RAISING /iwbep/cx_gateway.
|
|
465
|
+
ENDINTERFACE.
|
|
466
|
+
`;
|
|
467
|
+
const IWBEP_RESPONSES = [
|
|
468
|
+
`INTERFACE /iwbep/if_cp_response_read_lst PUBLIC.
|
|
469
|
+
METHODS get_business_data EXPORTING et_business_data TYPE ANY TABLE RAISING /iwbep/cx_gateway.
|
|
470
|
+
METHODS get_count RETURNING VALUE(rv_count) TYPE int8 RAISING /iwbep/cx_gateway.
|
|
471
|
+
ENDINTERFACE.
|
|
472
|
+
`,
|
|
473
|
+
`INTERFACE /iwbep/if_cp_response_read PUBLIC.
|
|
474
|
+
METHODS get_business_data EXPORTING es_business_data TYPE data RAISING /iwbep/cx_gateway.
|
|
475
|
+
ENDINTERFACE.
|
|
476
|
+
`,
|
|
477
|
+
`INTERFACE /iwbep/if_cp_response_create PUBLIC.
|
|
478
|
+
METHODS get_business_data EXPORTING es_business_data TYPE data RAISING /iwbep/cx_gateway.
|
|
479
|
+
ENDINTERFACE.
|
|
480
|
+
`,
|
|
481
|
+
`INTERFACE /iwbep/if_cp_response_update PUBLIC.
|
|
482
|
+
METHODS get_business_data EXPORTING es_business_data TYPE data RAISING /iwbep/cx_gateway.
|
|
483
|
+
ENDINTERFACE.
|
|
484
|
+
`,
|
|
485
|
+
];
|
|
486
|
+
const IWBEP_REQUESTS = [
|
|
487
|
+
`INTERFACE /iwbep/if_cp_request_read_list PUBLIC.
|
|
488
|
+
METHODS set_top IMPORTING iv_top TYPE i RETURNING VALUE(ro_request) TYPE REF TO /iwbep/if_cp_request_read_list.
|
|
489
|
+
METHODS set_skip IMPORTING iv_skip TYPE i RETURNING VALUE(ro_request) TYPE REF TO /iwbep/if_cp_request_read_list.
|
|
490
|
+
METHODS request_count RETURNING VALUE(ro_request) TYPE REF TO /iwbep/if_cp_request_read_list.
|
|
491
|
+
METHODS request_no_business_data RETURNING VALUE(ro_request) TYPE REF TO /iwbep/if_cp_request_read_list.
|
|
492
|
+
METHODS create_filter_factory RETURNING VALUE(ro_filter_factory) TYPE REF TO /iwbep/if_cp_filter_factory.
|
|
493
|
+
METHODS set_filter IMPORTING io_filter_node TYPE REF TO /iwbep/if_cp_filter_node RETURNING VALUE(ro_request) TYPE REF TO /iwbep/if_cp_request_read_list.
|
|
494
|
+
METHODS set_select_properties IMPORTING it_select_property TYPE /iwbep/if_cp_runtime_types=>ty_t_property_path RETURNING VALUE(ro_request) TYPE REF TO /iwbep/if_cp_request_read_list.
|
|
495
|
+
METHODS set_orderby IMPORTING it_orderby_property TYPE /iwbep/if_cp_runtime_types=>ty_t_sort_order RETURNING VALUE(ro_request) TYPE REF TO /iwbep/if_cp_request_read_list.
|
|
496
|
+
METHODS execute RETURNING VALUE(ro_response) TYPE REF TO /iwbep/if_cp_response_read_lst RAISING /iwbep/cx_gateway.
|
|
497
|
+
ENDINTERFACE.
|
|
498
|
+
`,
|
|
499
|
+
`INTERFACE /iwbep/if_cp_request_read PUBLIC.
|
|
500
|
+
METHODS set_select_properties IMPORTING it_select_property TYPE /iwbep/if_cp_runtime_types=>ty_t_property_path RETURNING VALUE(ro_request) TYPE REF TO /iwbep/if_cp_request_read.
|
|
501
|
+
METHODS execute RETURNING VALUE(ro_response) TYPE REF TO /iwbep/if_cp_response_read RAISING /iwbep/cx_gateway.
|
|
502
|
+
ENDINTERFACE.
|
|
503
|
+
`,
|
|
504
|
+
`INTERFACE /iwbep/if_cp_request_create PUBLIC.
|
|
505
|
+
METHODS set_business_data
|
|
506
|
+
IMPORTING is_business_data TYPE data
|
|
507
|
+
it_provided_property TYPE /iwbep/if_cp_runtime_types=>ty_t_property_path OPTIONAL
|
|
508
|
+
RAISING /iwbep/cx_gateway.
|
|
509
|
+
METHODS execute RETURNING VALUE(ro_response) TYPE REF TO /iwbep/if_cp_response_create RAISING /iwbep/cx_gateway.
|
|
510
|
+
ENDINTERFACE.
|
|
511
|
+
`,
|
|
512
|
+
`INTERFACE /iwbep/if_cp_request_update PUBLIC.
|
|
513
|
+
CONSTANTS: BEGIN OF gcs_update_semantic,
|
|
514
|
+
patch TYPE c LENGTH 5 VALUE 'PATCH',
|
|
515
|
+
put TYPE c LENGTH 5 VALUE 'PUT',
|
|
516
|
+
END OF gcs_update_semantic.
|
|
517
|
+
METHODS set_business_data
|
|
518
|
+
IMPORTING is_business_data TYPE data
|
|
519
|
+
it_provided_property TYPE /iwbep/if_cp_runtime_types=>ty_t_property_path OPTIONAL
|
|
520
|
+
RAISING /iwbep/cx_gateway.
|
|
521
|
+
METHODS set_if_match IMPORTING iv_if_match TYPE csequence.
|
|
522
|
+
METHODS execute RETURNING VALUE(ro_response) TYPE REF TO /iwbep/if_cp_response_update RAISING /iwbep/cx_gateway.
|
|
523
|
+
ENDINTERFACE.
|
|
524
|
+
`,
|
|
525
|
+
`INTERFACE /iwbep/if_cp_request_delete PUBLIC.
|
|
526
|
+
METHODS set_if_match IMPORTING iv_if_match TYPE csequence.
|
|
527
|
+
METHODS execute RAISING /iwbep/cx_gateway.
|
|
528
|
+
ENDINTERFACE.
|
|
529
|
+
`,
|
|
530
|
+
];
|
|
531
|
+
const IWBEP_RESOURCES = [
|
|
532
|
+
`INTERFACE /iwbep/if_cp_resource_entity PUBLIC.
|
|
533
|
+
METHODS create_request_for_read RETURNING VALUE(ro_request) TYPE REF TO /iwbep/if_cp_request_read RAISING /iwbep/cx_gateway.
|
|
534
|
+
METHODS create_request_for_update
|
|
535
|
+
IMPORTING iv_update_semantic TYPE csequence DEFAULT 'PATCH'
|
|
536
|
+
RETURNING VALUE(ro_request) TYPE REF TO /iwbep/if_cp_request_update
|
|
537
|
+
RAISING /iwbep/cx_gateway.
|
|
538
|
+
METHODS create_request_for_delete RETURNING VALUE(ro_request) TYPE REF TO /iwbep/if_cp_request_delete RAISING /iwbep/cx_gateway.
|
|
539
|
+
ENDINTERFACE.
|
|
540
|
+
`,
|
|
541
|
+
`INTERFACE /iwbep/if_cp_resource_entity_set PUBLIC.
|
|
542
|
+
METHODS create_request_for_read RETURNING VALUE(ro_request) TYPE REF TO /iwbep/if_cp_request_read_list RAISING /iwbep/cx_gateway.
|
|
543
|
+
METHODS create_request_for_create RETURNING VALUE(ro_request) TYPE REF TO /iwbep/if_cp_request_create RAISING /iwbep/cx_gateway.
|
|
544
|
+
METHODS navigate_with_key
|
|
545
|
+
IMPORTING is_key_values TYPE data
|
|
546
|
+
RETURNING VALUE(ro_resource) TYPE REF TO /iwbep/if_cp_resource_entity
|
|
547
|
+
RAISING /iwbep/cx_gateway.
|
|
548
|
+
ENDINTERFACE.
|
|
549
|
+
`,
|
|
550
|
+
`INTERFACE /iwbep/if_cp_client_proxy PUBLIC.
|
|
551
|
+
METHODS create_resource_for_entity_set
|
|
552
|
+
IMPORTING iv_entity_set_name TYPE csequence
|
|
553
|
+
RETURNING VALUE(ro_resource) TYPE REF TO /iwbep/if_cp_resource_entity_set
|
|
554
|
+
RAISING /iwbep/cx_gateway.
|
|
555
|
+
ENDINTERFACE.
|
|
556
|
+
`,
|
|
557
|
+
];
|
|
558
|
+
/** The implementation: each object keeps the handle of the proxy in the kernel and its state. */
|
|
559
|
+
const ZRAP_CL_CP = `CLASS zrap_cl_cp_filter_node DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
|
560
|
+
PUBLIC SECTION.
|
|
561
|
+
INTERFACES /iwbep/if_cp_filter_node.
|
|
562
|
+
DATA expression TYPE string READ-ONLY.
|
|
563
|
+
METHODS constructor IMPORTING expression TYPE string.
|
|
564
|
+
ENDCLASS.
|
|
565
|
+
|
|
566
|
+
CLASS zrap_cl_cp_filter_node IMPLEMENTATION.
|
|
567
|
+
METHOD constructor.
|
|
568
|
+
me->expression = expression.
|
|
569
|
+
ENDMETHOD.
|
|
570
|
+
|
|
571
|
+
METHOD /iwbep/if_cp_filter_node~and.
|
|
572
|
+
DATA other TYPE REF TO zrap_cl_cp_filter_node.
|
|
573
|
+
other ?= io_filter_node.
|
|
574
|
+
ro_filter_node = NEW zrap_cl_cp_filter_node( |({ expression }) and ({ other->expression })| ).
|
|
575
|
+
ENDMETHOD.
|
|
576
|
+
|
|
577
|
+
METHOD /iwbep/if_cp_filter_node~or.
|
|
578
|
+
DATA other TYPE REF TO zrap_cl_cp_filter_node.
|
|
579
|
+
other ?= io_filter_node.
|
|
580
|
+
ro_filter_node = NEW zrap_cl_cp_filter_node( |({ expression }) or ({ other->expression })| ).
|
|
581
|
+
ENDMETHOD.
|
|
582
|
+
|
|
583
|
+
METHOD /iwbep/if_cp_filter_node~not.
|
|
584
|
+
ro_filter_node = NEW zrap_cl_cp_filter_node( |not ({ expression })| ).
|
|
585
|
+
ENDMETHOD.
|
|
586
|
+
ENDCLASS.
|
|
587
|
+
`;
|
|
588
|
+
const ZRAP_CL_CP_FILTER_FACTORY = `CLASS zrap_cl_cp_filter_factory DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
|
589
|
+
PUBLIC SECTION.
|
|
590
|
+
INTERFACES /iwbep/if_cp_filter_factory.
|
|
591
|
+
METHODS constructor IMPORTING handle TYPE string set TYPE string.
|
|
592
|
+
PRIVATE SECTION.
|
|
593
|
+
DATA handle TYPE string.
|
|
594
|
+
DATA set TYPE string.
|
|
595
|
+
ENDCLASS.
|
|
596
|
+
|
|
597
|
+
CLASS zrap_cl_cp_filter_factory IMPLEMENTATION.
|
|
598
|
+
METHOD constructor.
|
|
599
|
+
me->handle = handle.
|
|
600
|
+
me->set = set.
|
|
601
|
+
ENDMETHOD.
|
|
602
|
+
|
|
603
|
+
METHOD /iwbep/if_cp_filter_factory~create_by_range.
|
|
604
|
+
ro_filter_node = NEW zrap_cl_cp_filter_node( zrap_eml=>odata_filter( handle = handle set = set property = |{ iv_property_path }| range = it_range ) ).
|
|
605
|
+
ENDMETHOD.
|
|
606
|
+
ENDCLASS.
|
|
607
|
+
`;
|
|
608
|
+
const ZRAP_CL_CP_RESPONSE = `CLASS zrap_cl_cp_response DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
|
609
|
+
PUBLIC SECTION.
|
|
610
|
+
INTERFACES /iwbep/if_cp_response_read_lst.
|
|
611
|
+
INTERFACES /iwbep/if_cp_response_read.
|
|
612
|
+
INTERFACES /iwbep/if_cp_response_create.
|
|
613
|
+
INTERFACES /iwbep/if_cp_response_update.
|
|
614
|
+
METHODS constructor IMPORTING handle TYPE string set TYPE string json TYPE string count TYPE int8 OPTIONAL.
|
|
615
|
+
PRIVATE SECTION.
|
|
616
|
+
DATA handle TYPE string.
|
|
617
|
+
DATA set TYPE string.
|
|
618
|
+
DATA json TYPE string.
|
|
619
|
+
DATA count TYPE int8.
|
|
620
|
+
ENDCLASS.
|
|
621
|
+
|
|
622
|
+
CLASS zrap_cl_cp_response IMPLEMENTATION.
|
|
623
|
+
METHOD constructor.
|
|
624
|
+
me->handle = handle.
|
|
625
|
+
me->set = set.
|
|
626
|
+
me->json = json.
|
|
627
|
+
me->count = count.
|
|
628
|
+
ENDMETHOD.
|
|
629
|
+
|
|
630
|
+
METHOD /iwbep/if_cp_response_read_lst~get_business_data.
|
|
631
|
+
zrap_eml=>odata_fill( EXPORTING handle = handle set = set json = json CHANGING target = et_business_data ).
|
|
632
|
+
ENDMETHOD.
|
|
633
|
+
|
|
634
|
+
METHOD /iwbep/if_cp_response_read_lst~get_count.
|
|
635
|
+
rv_count = count.
|
|
636
|
+
ENDMETHOD.
|
|
637
|
+
|
|
638
|
+
METHOD /iwbep/if_cp_response_read~get_business_data.
|
|
639
|
+
zrap_eml=>odata_fill( EXPORTING handle = handle set = set json = json CHANGING target = es_business_data ).
|
|
640
|
+
ENDMETHOD.
|
|
641
|
+
|
|
642
|
+
METHOD /iwbep/if_cp_response_create~get_business_data.
|
|
643
|
+
zrap_eml=>odata_fill( EXPORTING handle = handle set = set json = json CHANGING target = es_business_data ).
|
|
644
|
+
ENDMETHOD.
|
|
645
|
+
|
|
646
|
+
METHOD /iwbep/if_cp_response_update~get_business_data.
|
|
647
|
+
zrap_eml=>odata_fill( EXPORTING handle = handle set = set json = json CHANGING target = es_business_data ).
|
|
648
|
+
ENDMETHOD.
|
|
649
|
+
ENDCLASS.
|
|
650
|
+
`;
|
|
651
|
+
const ZRAP_CL_CP_REQUEST = `CLASS zrap_cl_cp_request DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
|
652
|
+
PUBLIC SECTION.
|
|
653
|
+
INTERFACES /iwbep/if_cp_request_read_list.
|
|
654
|
+
INTERFACES /iwbep/if_cp_request_read.
|
|
655
|
+
INTERFACES /iwbep/if_cp_request_create.
|
|
656
|
+
INTERFACES /iwbep/if_cp_request_update.
|
|
657
|
+
INTERFACES /iwbep/if_cp_request_delete.
|
|
658
|
+
METHODS constructor IMPORTING handle TYPE string set TYPE string key TYPE string OPTIONAL method TYPE string.
|
|
659
|
+
PRIVATE SECTION.
|
|
660
|
+
DATA handle TYPE string.
|
|
661
|
+
DATA set TYPE string.
|
|
662
|
+
DATA key TYPE string.
|
|
663
|
+
DATA method TYPE string.
|
|
664
|
+
DATA top TYPE i VALUE -1.
|
|
665
|
+
DATA skip TYPE i.
|
|
666
|
+
DATA with_count TYPE abap_bool.
|
|
667
|
+
DATA no_data TYPE abap_bool.
|
|
668
|
+
DATA filter TYPE string.
|
|
669
|
+
DATA select TYPE string.
|
|
670
|
+
DATA orderby TYPE string.
|
|
671
|
+
DATA payload TYPE string.
|
|
672
|
+
DATA if_match TYPE string.
|
|
673
|
+
METHODS send RETURNING VALUE(response) TYPE REF TO zrap_cl_cp_response RAISING /iwbep/cx_gateway.
|
|
674
|
+
METHODS select_list IMPORTING properties TYPE /iwbep/if_cp_runtime_types=>ty_t_property_path.
|
|
675
|
+
ENDCLASS.
|
|
676
|
+
|
|
677
|
+
CLASS zrap_cl_cp_request IMPLEMENTATION.
|
|
678
|
+
METHOD constructor.
|
|
679
|
+
me->handle = handle.
|
|
680
|
+
me->set = set.
|
|
681
|
+
me->key = key.
|
|
682
|
+
me->method = method.
|
|
683
|
+
ENDMETHOD.
|
|
684
|
+
|
|
685
|
+
METHOD send.
|
|
686
|
+
DATA json TYPE string.
|
|
687
|
+
DATA count TYPE int8.
|
|
688
|
+
zrap_eml=>odata_request(
|
|
689
|
+
EXPORTING handle = handle
|
|
690
|
+
method = method
|
|
691
|
+
set = set
|
|
692
|
+
key = key
|
|
693
|
+
top = top
|
|
694
|
+
skip = skip
|
|
695
|
+
count = with_count
|
|
696
|
+
no_data = no_data
|
|
697
|
+
filter = filter
|
|
698
|
+
select = select
|
|
699
|
+
orderby = orderby
|
|
700
|
+
payload = payload
|
|
701
|
+
if_match = if_match
|
|
702
|
+
IMPORTING json = json
|
|
703
|
+
total = count ).
|
|
704
|
+
response = NEW zrap_cl_cp_response( handle = handle set = set json = json count = count ).
|
|
705
|
+
ENDMETHOD.
|
|
706
|
+
|
|
707
|
+
METHOD select_list.
|
|
708
|
+
CLEAR select.
|
|
709
|
+
LOOP AT properties INTO DATA(property).
|
|
710
|
+
select = COND #( WHEN select IS INITIAL THEN property ELSE |{ select },{ property }| ).
|
|
711
|
+
ENDLOOP.
|
|
712
|
+
ENDMETHOD.
|
|
713
|
+
|
|
714
|
+
METHOD /iwbep/if_cp_request_read_list~set_top.
|
|
715
|
+
top = iv_top.
|
|
716
|
+
ro_request = me.
|
|
717
|
+
ENDMETHOD.
|
|
718
|
+
|
|
719
|
+
METHOD /iwbep/if_cp_request_read_list~set_skip.
|
|
720
|
+
skip = iv_skip.
|
|
721
|
+
ro_request = me.
|
|
722
|
+
ENDMETHOD.
|
|
723
|
+
|
|
724
|
+
METHOD /iwbep/if_cp_request_read_list~request_count.
|
|
725
|
+
with_count = abap_true.
|
|
726
|
+
ro_request = me.
|
|
727
|
+
ENDMETHOD.
|
|
728
|
+
|
|
729
|
+
METHOD /iwbep/if_cp_request_read_list~request_no_business_data.
|
|
730
|
+
no_data = abap_true.
|
|
731
|
+
ro_request = me.
|
|
732
|
+
ENDMETHOD.
|
|
733
|
+
|
|
734
|
+
METHOD /iwbep/if_cp_request_read_list~create_filter_factory.
|
|
735
|
+
ro_filter_factory = NEW zrap_cl_cp_filter_factory( handle = handle set = set ).
|
|
736
|
+
ENDMETHOD.
|
|
737
|
+
|
|
738
|
+
METHOD /iwbep/if_cp_request_read_list~set_filter.
|
|
739
|
+
DATA node TYPE REF TO zrap_cl_cp_filter_node.
|
|
740
|
+
node ?= io_filter_node.
|
|
741
|
+
filter = node->expression.
|
|
742
|
+
ro_request = me.
|
|
743
|
+
ENDMETHOD.
|
|
744
|
+
|
|
745
|
+
METHOD /iwbep/if_cp_request_read_list~set_select_properties.
|
|
746
|
+
select_list( it_select_property ).
|
|
747
|
+
ro_request = me.
|
|
748
|
+
ENDMETHOD.
|
|
749
|
+
|
|
750
|
+
METHOD /iwbep/if_cp_request_read_list~set_orderby.
|
|
751
|
+
CLEAR orderby.
|
|
752
|
+
LOOP AT it_orderby_property INTO DATA(order).
|
|
753
|
+
DATA(item) = COND string( WHEN order-descending = abap_true THEN |{ order-property_path } desc| ELSE order-property_path ).
|
|
754
|
+
orderby = COND #( WHEN orderby IS INITIAL THEN item ELSE |{ orderby },{ item }| ).
|
|
755
|
+
ENDLOOP.
|
|
756
|
+
ro_request = me.
|
|
757
|
+
ENDMETHOD.
|
|
758
|
+
|
|
759
|
+
METHOD /iwbep/if_cp_request_read_list~execute.
|
|
760
|
+
ro_response = send( ).
|
|
761
|
+
ENDMETHOD.
|
|
762
|
+
|
|
763
|
+
METHOD /iwbep/if_cp_request_read~set_select_properties.
|
|
764
|
+
select_list( it_select_property ).
|
|
765
|
+
ro_request = me.
|
|
766
|
+
ENDMETHOD.
|
|
767
|
+
|
|
768
|
+
METHOD /iwbep/if_cp_request_read~execute.
|
|
769
|
+
ro_response = send( ).
|
|
770
|
+
ENDMETHOD.
|
|
771
|
+
|
|
772
|
+
METHOD /iwbep/if_cp_request_create~set_business_data.
|
|
773
|
+
payload = zrap_eml=>odata_payload( handle = handle set = set source = is_business_data properties = it_provided_property ).
|
|
774
|
+
ENDMETHOD.
|
|
775
|
+
|
|
776
|
+
METHOD /iwbep/if_cp_request_create~execute.
|
|
777
|
+
ro_response = send( ).
|
|
778
|
+
ENDMETHOD.
|
|
779
|
+
|
|
780
|
+
METHOD /iwbep/if_cp_request_update~set_business_data.
|
|
781
|
+
payload = zrap_eml=>odata_payload( handle = handle set = set source = is_business_data properties = it_provided_property ).
|
|
782
|
+
ENDMETHOD.
|
|
783
|
+
|
|
784
|
+
METHOD /iwbep/if_cp_request_update~set_if_match.
|
|
785
|
+
if_match = iv_if_match.
|
|
786
|
+
ENDMETHOD.
|
|
787
|
+
|
|
788
|
+
METHOD /iwbep/if_cp_request_update~execute.
|
|
789
|
+
ro_response = send( ).
|
|
790
|
+
ENDMETHOD.
|
|
791
|
+
|
|
792
|
+
METHOD /iwbep/if_cp_request_delete~set_if_match.
|
|
793
|
+
if_match = iv_if_match.
|
|
794
|
+
ENDMETHOD.
|
|
795
|
+
|
|
796
|
+
METHOD /iwbep/if_cp_request_delete~execute.
|
|
797
|
+
send( ).
|
|
798
|
+
ENDMETHOD.
|
|
799
|
+
ENDCLASS.
|
|
800
|
+
`;
|
|
801
|
+
const ZRAP_CL_CP_RESOURCE = `CLASS zrap_cl_cp_resource DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
|
802
|
+
PUBLIC SECTION.
|
|
803
|
+
INTERFACES /iwbep/if_cp_resource_entity_set.
|
|
804
|
+
INTERFACES /iwbep/if_cp_resource_entity.
|
|
805
|
+
METHODS constructor IMPORTING handle TYPE string set TYPE string key TYPE string OPTIONAL.
|
|
806
|
+
PRIVATE SECTION.
|
|
807
|
+
DATA handle TYPE string.
|
|
808
|
+
DATA set TYPE string.
|
|
809
|
+
DATA key TYPE string.
|
|
810
|
+
ENDCLASS.
|
|
811
|
+
|
|
812
|
+
CLASS zrap_cl_cp_resource IMPLEMENTATION.
|
|
813
|
+
METHOD constructor.
|
|
814
|
+
me->handle = handle.
|
|
815
|
+
me->set = set.
|
|
816
|
+
me->key = key.
|
|
817
|
+
ENDMETHOD.
|
|
818
|
+
|
|
819
|
+
METHOD /iwbep/if_cp_resource_entity_set~create_request_for_read.
|
|
820
|
+
ro_request = NEW zrap_cl_cp_request( handle = handle set = set method = 'READ_LIST' ).
|
|
821
|
+
ENDMETHOD.
|
|
822
|
+
|
|
823
|
+
METHOD /iwbep/if_cp_resource_entity_set~create_request_for_create.
|
|
824
|
+
ro_request = NEW zrap_cl_cp_request( handle = handle set = set method = 'POST' ).
|
|
825
|
+
ENDMETHOD.
|
|
826
|
+
|
|
827
|
+
METHOD /iwbep/if_cp_resource_entity_set~navigate_with_key.
|
|
828
|
+
ro_resource = NEW zrap_cl_cp_resource( handle = handle set = set key = zrap_eml=>odata_key( handle = handle set = set source = is_key_values ) ).
|
|
829
|
+
ENDMETHOD.
|
|
830
|
+
|
|
831
|
+
METHOD /iwbep/if_cp_resource_entity~create_request_for_read.
|
|
832
|
+
ro_request = NEW zrap_cl_cp_request( handle = handle set = set key = key method = 'GET' ).
|
|
833
|
+
ENDMETHOD.
|
|
834
|
+
|
|
835
|
+
METHOD /iwbep/if_cp_resource_entity~create_request_for_update.
|
|
836
|
+
ro_request = NEW zrap_cl_cp_request( handle = handle set = set key = key method = to_upper( |{ iv_update_semantic }| ) ).
|
|
837
|
+
ENDMETHOD.
|
|
838
|
+
|
|
839
|
+
METHOD /iwbep/if_cp_resource_entity~create_request_for_delete.
|
|
840
|
+
ro_request = NEW zrap_cl_cp_request( handle = handle set = set key = key method = 'DELETE' ).
|
|
841
|
+
ENDMETHOD.
|
|
842
|
+
ENDCLASS.
|
|
843
|
+
`;
|
|
844
|
+
const ZRAP_CL_CP_CLIENT_PROXY = `CLASS zrap_cl_cp_client_proxy DEFINITION PUBLIC FINAL CREATE PUBLIC.
|
|
845
|
+
PUBLIC SECTION.
|
|
846
|
+
INTERFACES /iwbep/if_cp_client_proxy.
|
|
847
|
+
METHODS constructor
|
|
848
|
+
IMPORTING version TYPE string
|
|
849
|
+
client TYPE REF TO if_web_http_client
|
|
850
|
+
root TYPE csequence
|
|
851
|
+
csrf TYPE abap_bool DEFAULT abap_true
|
|
852
|
+
RAISING /iwbep/cx_gateway.
|
|
853
|
+
PRIVATE SECTION.
|
|
854
|
+
DATA handle TYPE string.
|
|
855
|
+
ENDCLASS.
|
|
856
|
+
|
|
857
|
+
CLASS zrap_cl_cp_client_proxy IMPLEMENTATION.
|
|
858
|
+
METHOD constructor.
|
|
859
|
+
DATA http TYPE REF TO zrap_cl_http_client.
|
|
860
|
+
IF client IS NOT BOUND.
|
|
861
|
+
RAISE EXCEPTION TYPE /iwbep/cx_gateway EXPORTING zrap_text = |client proxy: no HTTP client|.
|
|
862
|
+
ENDIF.
|
|
863
|
+
http ?= client.
|
|
864
|
+
handle = zrap_eml=>odata_open( version = version base = http->destination->url destination = http->destination->name root = |{ root }| csrf = csrf ).
|
|
865
|
+
ENDMETHOD.
|
|
866
|
+
|
|
867
|
+
METHOD /iwbep/if_cp_client_proxy~create_resource_for_entity_set.
|
|
868
|
+
ro_resource = NEW zrap_cl_cp_resource( handle = handle set = |{ iv_entity_set_name }| ).
|
|
869
|
+
ENDMETHOD.
|
|
870
|
+
ENDCLASS.
|
|
871
|
+
`;
|
|
872
|
+
const FACTORIES = `CLASS /iwbep/cl_cp_factory_remote DEFINITION PUBLIC FINAL CREATE PRIVATE.
|
|
873
|
+
PUBLIC SECTION.
|
|
874
|
+
CLASS-METHODS create_v2_remote_proxy
|
|
875
|
+
IMPORTING is_proxy_model_key TYPE /iwbep/if_cp_registry_types=>ty_s_proxy_model_key OPTIONAL
|
|
876
|
+
io_http_client TYPE REF TO if_web_http_client
|
|
877
|
+
iv_relative_service_root TYPE csequence
|
|
878
|
+
iv_do_fetch_csrf_token TYPE abap_bool DEFAULT abap_true
|
|
879
|
+
RETURNING VALUE(ro_client_proxy) TYPE REF TO /iwbep/if_cp_client_proxy
|
|
880
|
+
RAISING /iwbep/cx_gateway.
|
|
881
|
+
CLASS-METHODS create_v4_remote_proxy
|
|
882
|
+
IMPORTING is_proxy_model_key TYPE /iwbep/if_cp_registry_types=>ty_s_proxy_model_key OPTIONAL
|
|
883
|
+
io_http_client TYPE REF TO if_web_http_client
|
|
884
|
+
iv_relative_service_root TYPE csequence
|
|
885
|
+
iv_do_fetch_csrf_token TYPE abap_bool DEFAULT abap_true
|
|
886
|
+
RETURNING VALUE(ro_client_proxy) TYPE REF TO /iwbep/if_cp_client_proxy
|
|
887
|
+
RAISING /iwbep/cx_gateway.
|
|
888
|
+
ENDCLASS.
|
|
889
|
+
|
|
890
|
+
CLASS /iwbep/cl_cp_factory_remote IMPLEMENTATION.
|
|
891
|
+
METHOD create_v2_remote_proxy.
|
|
892
|
+
ro_client_proxy = NEW zrap_cl_cp_client_proxy( version = '2' client = io_http_client root = iv_relative_service_root csrf = iv_do_fetch_csrf_token ).
|
|
893
|
+
ENDMETHOD.
|
|
894
|
+
|
|
895
|
+
METHOD create_v4_remote_proxy.
|
|
896
|
+
ro_client_proxy = NEW zrap_cl_cp_client_proxy( version = '4' client = io_http_client root = iv_relative_service_root csrf = iv_do_fetch_csrf_token ).
|
|
897
|
+
ENDMETHOD.
|
|
898
|
+
ENDCLASS.
|
|
899
|
+
`;
|
|
900
|
+
const CL_WEB_ODATA_CLIENT_FACTORY = `CLASS cl_web_odata_client_factory DEFINITION PUBLIC FINAL CREATE PRIVATE.
|
|
901
|
+
PUBLIC SECTION.
|
|
902
|
+
TYPES ty_service_definition_name TYPE c LENGTH 40.
|
|
903
|
+
CLASS-METHODS create_v2_remote_proxy
|
|
904
|
+
IMPORTING iv_service_definition_name TYPE ty_service_definition_name OPTIONAL
|
|
905
|
+
io_http_client TYPE REF TO if_web_http_client
|
|
906
|
+
iv_relative_service_root TYPE csequence
|
|
907
|
+
iv_do_fetch_csrf_token TYPE abap_bool DEFAULT abap_true
|
|
908
|
+
RETURNING VALUE(ro_client_proxy) TYPE REF TO /iwbep/if_cp_client_proxy
|
|
909
|
+
RAISING /iwbep/cx_gateway.
|
|
910
|
+
CLASS-METHODS create_v4_remote_proxy
|
|
911
|
+
IMPORTING iv_service_definition_name TYPE ty_service_definition_name OPTIONAL
|
|
912
|
+
io_http_client TYPE REF TO if_web_http_client
|
|
913
|
+
iv_relative_service_root TYPE csequence
|
|
914
|
+
iv_do_fetch_csrf_token TYPE abap_bool DEFAULT abap_true
|
|
915
|
+
RETURNING VALUE(ro_client_proxy) TYPE REF TO /iwbep/if_cp_client_proxy
|
|
916
|
+
RAISING /iwbep/cx_gateway.
|
|
917
|
+
ENDCLASS.
|
|
918
|
+
|
|
919
|
+
CLASS cl_web_odata_client_factory IMPLEMENTATION.
|
|
920
|
+
METHOD create_v2_remote_proxy.
|
|
921
|
+
ro_client_proxy = NEW zrap_cl_cp_client_proxy( version = '2' client = io_http_client root = iv_relative_service_root csrf = iv_do_fetch_csrf_token ).
|
|
922
|
+
ENDMETHOD.
|
|
923
|
+
|
|
924
|
+
METHOD create_v4_remote_proxy.
|
|
925
|
+
ro_client_proxy = NEW zrap_cl_cp_client_proxy( version = '4' client = io_http_client root = iv_relative_service_root csrf = iv_do_fetch_csrf_token ).
|
|
926
|
+
ENDMETHOD.
|
|
927
|
+
ENDCLASS.
|
|
928
|
+
`;
|
|
929
|
+
/** abapGit file name of an object (namespaces: `/iwbep/x` → `#iwbep#x`). */
|
|
930
|
+
const file = (name, type) => `${name.toLowerCase().replace(/\//g, "#")}.${type}.abap`;
|
|
931
|
+
const interfaceName = (source) => /^INTERFACE (\S+)/i.exec(source)?.[1] ?? "";
|
|
932
|
+
const className = (source) => /^CLASS (\S+)/i.exec(source)?.[1] ?? "";
|
|
933
|
+
/** The sources, in an order where each object comes after the ones it uses (for reading only). */
|
|
934
|
+
export const HTTP_FRAMEWORK_SOURCES = [
|
|
935
|
+
{ fileName: file("zrap_if_http", "intf"), source: ZRAP_IF_HTTP },
|
|
936
|
+
{ fileName: file("cx_http_dest_provider_error", "clas"), source: textException("cx_http_dest_provider_error", "cx_static_check") },
|
|
937
|
+
{ fileName: file("cx_web_http_client_error", "clas"), source: textException("cx_web_http_client_error", "cx_static_check") },
|
|
938
|
+
{ fileName: file("cx_web_message_error", "clas"), source: textException("cx_web_message_error", "cx_static_check") },
|
|
939
|
+
{ fileName: file("/iwbep/cx_gateway", "clas"), source: textException("/iwbep/cx_gateway", "cx_static_check") },
|
|
940
|
+
{
|
|
941
|
+
fileName: file("/iwbep/cx_cp_remote", "clas"),
|
|
942
|
+
source: textException("/iwbep/cx_cp_remote", "/iwbep/cx_gateway", " DATA http_status_code TYPE i READ-ONLY.\n DATA http_error_body TYPE string READ-ONLY."),
|
|
943
|
+
},
|
|
944
|
+
{ fileName: file("if_http_destination", "intf"), source: IF_HTTP_DESTINATION },
|
|
945
|
+
{ fileName: file("zrap_cl_http_destination", "clas"), source: ZRAP_CL_HTTP_DESTINATION },
|
|
946
|
+
{ fileName: file("cl_http_destination_provider", "clas"), source: CL_HTTP_DESTINATION_PROVIDER },
|
|
947
|
+
{ fileName: file("if_web_http_request", "intf"), source: IF_WEB_HTTP_REQUEST },
|
|
948
|
+
{ fileName: file("if_web_http_response", "intf"), source: IF_WEB_HTTP_RESPONSE },
|
|
949
|
+
{ fileName: file("if_web_http_header", "intf"), source: IF_WEB_HTTP_HEADER },
|
|
950
|
+
{ fileName: file("if_a4c_cp_service", "intf"), source: IF_A4C_CP_SERVICE },
|
|
951
|
+
{ fileName: file("if_web_http_client", "intf"), source: IF_WEB_HTTP_CLIENT },
|
|
952
|
+
{ fileName: file("zrap_cl_http_request", "clas"), source: ZRAP_CL_HTTP_REQUEST },
|
|
953
|
+
{ fileName: file("zrap_cl_http_response", "clas"), source: ZRAP_CL_HTTP_RESPONSE },
|
|
954
|
+
{ fileName: file("zrap_cl_http_client", "clas"), source: ZRAP_CL_HTTP_CLIENT },
|
|
955
|
+
{ fileName: file("cl_web_http_client_manager", "clas"), source: CL_WEB_HTTP_CLIENT_MANAGER },
|
|
956
|
+
{ fileName: file("/iwbep/if_cp_runtime_types", "intf"), source: IWBEP_RUNTIME_TYPES },
|
|
957
|
+
{ fileName: file("/iwbep/if_cp_registry_types", "intf"), source: IWBEP_REGISTRY_TYPES },
|
|
958
|
+
{ fileName: file("/iwbep/cl_v4_abs_pm_model_prov", "clas"), source: IWBEP_MODEL_PROVIDER },
|
|
959
|
+
{ fileName: file("/iwbep/if_cp_filter_node", "intf"), source: IWBEP_INTERFACES },
|
|
960
|
+
{ fileName: file("/iwbep/if_cp_filter_factory", "intf"), source: IWBEP_FILTER_FACTORY },
|
|
961
|
+
...IWBEP_RESPONSES.map((source) => ({ fileName: file(interfaceName(source), "intf"), source })),
|
|
962
|
+
...IWBEP_REQUESTS.map((source) => ({ fileName: file(interfaceName(source), "intf"), source })),
|
|
963
|
+
...IWBEP_RESOURCES.map((source) => ({ fileName: file(interfaceName(source), "intf"), source })),
|
|
964
|
+
...[ZRAP_CL_CP, ZRAP_CL_CP_FILTER_FACTORY, ZRAP_CL_CP_RESPONSE, ZRAP_CL_CP_REQUEST, ZRAP_CL_CP_RESOURCE, ZRAP_CL_CP_CLIENT_PROXY, FACTORIES, CL_WEB_ODATA_CLIENT_FACTORY].map((source) => ({
|
|
965
|
+
fileName: file(className(source), "clas"),
|
|
966
|
+
source,
|
|
967
|
+
})),
|
|
968
|
+
];
|
|
969
|
+
/** The kernel entries of the API consumption, declared in ZRAP_EML (bodies replaced at run time). */
|
|
970
|
+
export const HTTP_KERNEL_DEFINITIONS = ` "! URL of a destination of the environment (DESTINATION_<NAME>_URL).
|
|
971
|
+
CLASS-METHODS destination
|
|
972
|
+
IMPORTING name TYPE string
|
|
973
|
+
RETURNING VALUE(url) TYPE string
|
|
974
|
+
RAISING cx_http_dest_provider_error.
|
|
975
|
+
CLASS-METHODS base64_encode
|
|
976
|
+
IMPORTING text TYPE string
|
|
977
|
+
RETURNING VALUE(result) TYPE string.
|
|
978
|
+
CLASS-METHODS http_execute
|
|
979
|
+
IMPORTING method TYPE string
|
|
980
|
+
base TYPE string
|
|
981
|
+
path TYPE string OPTIONAL
|
|
982
|
+
query TYPE string OPTIONAL
|
|
983
|
+
destination TYPE string OPTIONAL
|
|
984
|
+
headers TYPE zrap_if_http=>tt_header OPTIONAL
|
|
985
|
+
form TYPE zrap_if_http=>tt_header OPTIONAL
|
|
986
|
+
body TYPE string OPTIONAL
|
|
987
|
+
binary TYPE xstring OPTIONAL
|
|
988
|
+
timeout TYPE i DEFAULT 0
|
|
989
|
+
EXPORTING status TYPE i
|
|
990
|
+
reason TYPE string
|
|
991
|
+
response_headers TYPE zrap_if_http=>tt_header
|
|
992
|
+
response_body TYPE string
|
|
993
|
+
response_binary TYPE xstring
|
|
994
|
+
RAISING cx_web_http_client_error.
|
|
995
|
+
CLASS-METHODS odata_open
|
|
996
|
+
IMPORTING version TYPE string
|
|
997
|
+
base TYPE string
|
|
998
|
+
destination TYPE string OPTIONAL
|
|
999
|
+
root TYPE string
|
|
1000
|
+
csrf TYPE abap_bool DEFAULT abap_true
|
|
1001
|
+
RETURNING VALUE(handle) TYPE string.
|
|
1002
|
+
CLASS-METHODS odata_key
|
|
1003
|
+
IMPORTING handle TYPE string
|
|
1004
|
+
set TYPE string
|
|
1005
|
+
source TYPE data
|
|
1006
|
+
RETURNING VALUE(predicate) TYPE string
|
|
1007
|
+
RAISING /iwbep/cx_gateway.
|
|
1008
|
+
CLASS-METHODS odata_filter
|
|
1009
|
+
IMPORTING handle TYPE string
|
|
1010
|
+
set TYPE string
|
|
1011
|
+
property TYPE string
|
|
1012
|
+
range TYPE ANY TABLE
|
|
1013
|
+
RETURNING VALUE(expression) TYPE string
|
|
1014
|
+
RAISING /iwbep/cx_gateway.
|
|
1015
|
+
CLASS-METHODS odata_payload
|
|
1016
|
+
IMPORTING handle TYPE string
|
|
1017
|
+
set TYPE string
|
|
1018
|
+
source TYPE data
|
|
1019
|
+
properties TYPE /iwbep/if_cp_runtime_types=>ty_t_property_path OPTIONAL
|
|
1020
|
+
RETURNING VALUE(json) TYPE string
|
|
1021
|
+
RAISING /iwbep/cx_gateway.
|
|
1022
|
+
CLASS-METHODS odata_request
|
|
1023
|
+
IMPORTING handle TYPE string
|
|
1024
|
+
method TYPE string
|
|
1025
|
+
set TYPE string
|
|
1026
|
+
key TYPE string OPTIONAL
|
|
1027
|
+
top TYPE i DEFAULT -1
|
|
1028
|
+
skip TYPE i DEFAULT 0
|
|
1029
|
+
count TYPE abap_bool DEFAULT abap_false
|
|
1030
|
+
no_data TYPE abap_bool DEFAULT abap_false
|
|
1031
|
+
filter TYPE string OPTIONAL
|
|
1032
|
+
select TYPE string OPTIONAL
|
|
1033
|
+
orderby TYPE string OPTIONAL
|
|
1034
|
+
payload TYPE string OPTIONAL
|
|
1035
|
+
if_match TYPE string OPTIONAL
|
|
1036
|
+
EXPORTING json TYPE string
|
|
1037
|
+
total TYPE int8
|
|
1038
|
+
RAISING /iwbep/cx_gateway.
|
|
1039
|
+
CLASS-METHODS odata_fill
|
|
1040
|
+
IMPORTING handle TYPE string
|
|
1041
|
+
set TYPE string
|
|
1042
|
+
json TYPE string
|
|
1043
|
+
CHANGING target TYPE data
|
|
1044
|
+
RAISING /iwbep/cx_gateway.
|
|
1045
|
+
`;
|
|
1046
|
+
export const HTTP_KERNEL_IMPLEMENTATIONS = ["destination", "base64_encode", "http_execute", "odata_open", "odata_key", "odata_filter", "odata_payload", "odata_request", "odata_fill"]
|
|
1047
|
+
.map((m) => ` METHOD ${m}.\n ENDMETHOD.\n`)
|
|
1048
|
+
.join("\n");
|
|
1049
|
+
//# sourceMappingURL=framework-http.js.map
|