keycloakify 4.2.14-beta.0 → 4.2.16

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 (28) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +28 -46
  3. package/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +290 -0
  4. package/bin/build-keycloak-theme/generateFtl/generateFtl.js +25 -25
  5. package/bin/build-keycloak-theme/generateFtl/generateFtl.js.map +1 -1
  6. package/lib/components/LoginOtp.js +2 -2
  7. package/lib/components/LoginOtp.js.map +1 -1
  8. package/lib/components/Template.js +3 -3
  9. package/lib/components/Template.js.map +1 -1
  10. package/lib/getKcContext/kcContextMocks/kcContextMocks.js +3 -3
  11. package/lib/getKcContext/kcContextMocks/kcContextMocks.js.map +1 -1
  12. package/lib/getKcContext/kcContextMocks/urlResourcesPath.js +3 -3
  13. package/lib/getKcContext/kcContextMocks/urlResourcesPath.js.map +1 -1
  14. package/lib/tools/pathJoin.d.ts +1 -0
  15. package/lib/tools/pathJoin.js +12 -0
  16. package/lib/tools/pathJoin.js.map +1 -0
  17. package/package.json +7 -5
  18. package/src/bin/build-keycloak-theme/generateFtl/ftl_object_to_js_code_declaring_an_object.ftl +290 -0
  19. package/src/bin/build-keycloak-theme/generateFtl/generateFtl.ts +14 -33
  20. package/src/lib/components/LoginOtp.tsx +1 -1
  21. package/src/lib/components/Template.tsx +1 -1
  22. package/src/lib/getKcContext/kcContextMocks/kcContextMocks.ts +1 -1
  23. package/src/lib/getKcContext/kcContextMocks/urlResourcesPath.ts +3 -3
  24. package/src/lib/tools/pathJoin.ts +3 -0
  25. package/bin/build-keycloak-theme/generateFtl/Object.deepAssign.js +0 -28
  26. package/bin/build-keycloak-theme/generateFtl/common.ftl +0 -181
  27. package/src/bin/build-keycloak-theme/generateFtl/Object.deepAssign.js +0 -28
  28. package/src/bin/build-keycloak-theme/generateFtl/common.ftl +0 -181
@@ -1,181 +0,0 @@
1
- <script>const _=
2
- <#macro objectToJson_please_ignore_errors object depth arr ftl>
3
- <@compress>
4
- <#local isHash = false>
5
- <#attempt>
6
- <#local isHash = object?is_hash || object?is_hash_ex>
7
- <#recover>
8
- /* can't evaluate if object is hash */
9
- undefined
10
- <#return>
11
- </#attempt>
12
- <#if isHash>
13
- <#local keys = "">
14
- <#attempt>
15
- <#local keys = object?keys>
16
- <#recover>
17
- /* can't list keys of object */
18
- undefined
19
- <#return>
20
- </#attempt>
21
- <#if arr?sequence?size gte 1>
22
- <#local keys = arr>
23
- </#if>
24
- {${'\n'}
25
- <#list keys as key>
26
- <#if key == "class">
27
- /* skipping "class" property of object */
28
- <#continue>
29
- </#if>
30
- <#attempt>
31
- <#local value = object[key]!"error_data_is_undefined">
32
- <#recover>
33
- /* couldn't dereference ${key} of object */
34
- <#continue>
35
- </#attempt>
36
- <#if depth gt 7>
37
- /* Avoid calling recustively too many times depth: ${depth}, key: ${key} */
38
- <#continue>
39
- </#if>
40
- <#local arr_keys = []>
41
- <#if depth==0 && key=="url" && ftl=="saml-post-form.ftl" >
42
- <#local arr_keys = ["resourcesPath", "resourcesCommonPath", "loginRestartFlowUrl", "loginUrl", "loginResetCredentialsUrl", "registrationUrl", "registrationAction", "oauth2DeviceVerificationAction", "oauthAction", "loginResetCredentialsUrl"]>
43
- <#elseif depth==0 && key=="url">
44
- <#local arr_keys = ["loginAction", "resourcesPath", "resourcesCommonPath", "loginRestartFlowUrl", "loginUrl", "loginResetCredentialsUrl", "registrationUrl", "registrationAction", "oauth2DeviceVerificationAction", "oauthAction", "loginResetCredentialsUrl"]>
45
- </#if>
46
- <#if depth==0 && key=="auth" && ftl=="login-reset-password.ftl" >
47
- <#local arr_keys = ["showUsername", "showResetCredentials", "showTryAnotherWayLink", "attemptedUsername"]>
48
- <#elseif depth==0 && key=="auth">
49
- <#local arr_keys = ["showUsername", "showResetCredentials", "showTryAnotherWayLink"]>
50
- </#if>
51
- <#if depth==0 && key=="updateProfileCtx" ><#continue></#if>
52
- "${key}": <@objectToJson_please_ignore_errors object=value depth=depth+1 arr=arr_keys ftl=ftl />,
53
- </#list>
54
- }${'\n'}
55
- <#return>
56
- </#if>
57
- <#local isMethod = "">
58
- <#attempt>
59
- <#local isMethod = object?is_method>
60
- <#recover>
61
- /* can't test if object is a method */
62
- undefined
63
- <#return>
64
- </#attempt>
65
- <#if isMethod>
66
- undefined
67
- <#return>
68
- </#if>
69
- <#local isBoolean = "">
70
- <#attempt>
71
- <#local isBoolean = object?is_boolean>
72
- <#recover>
73
- /* can't test if object is a boolean */
74
- undefined
75
- <#return>
76
- </#attempt>
77
- <#if isBoolean>
78
- ${object?c}
79
- <#return>
80
- </#if>
81
- <#local isEnumerable = "">
82
- <#attempt>
83
- <#local isEnumerable = object?is_enumerable>
84
- <#recover>
85
- /* can't test if object is enumerable */
86
- undefined
87
- <#return>
88
- </#attempt>
89
- <#if isEnumerable>
90
- [${'\n'}
91
- <#list object as item>
92
- <@objectToJson_please_ignore_errors object=item depth=depth+1 arr=[] ftl=ftl/>,
93
- </#list>
94
- ]${'\n'}
95
- <#return>
96
- </#if>
97
- <#attempt>
98
- "${object?replace('"', '\\"')?no_esc}"
99
- <#recover>
100
- /* couldn't convert into string non hash, non method, non boolean, non enumerable object */
101
- undefined;
102
- <#return>
103
- </#attempt>
104
- </@compress>
105
- </#macro>
106
- (()=>{
107
- const nonAutomaticallyConvertible = {
108
- "messagesPerField": {
109
- <#assign fieldNames = ["global", "userLabel", "username", "email", "firstName", "lastName", "password", "password-confirm", "totp", "totpSecret", "SAMLRequest", "SAMLResponse", "relayState", "device_user_code", "code", "password-new", "rememberMe", "login", "authenticationExecution", "cancel-aia", "clientDataJSON", "authenticatorData", "signature", "credentialId", "userHandle", "error", "authn_use_chk", "authenticationExecution", "isSetRetry", "try-again", "attestationObject", "publicKeyCredentialId", "authenticatorLabel"]>
110
- <#assign attributes = (profile.attributes)![]>
111
- <#attempt>
112
- <#list attributes as attribute>
113
- <#if (attribute.name)??>
114
- <#assign fieldNames += [attribute.name]>
115
- </#if>
116
- </#list>
117
- <#recover>
118
- </#attempt>
119
- "printIfExists": function (fieldName, x) {
120
- <#list fieldNames as fieldName>
121
- if(fieldName === "${fieldName}" ){
122
- <#attempt>
123
- return "${messagesPerField.printIfExists(fieldName,'1')}" ? x : undefined;
124
- <#recover>
125
- </#attempt>
126
- }
127
- </#list>
128
- throw new Error("There is no " + fieldName + " field");
129
- },
130
- "existsError": function (fieldName) {
131
- <#list fieldNames as fieldName>
132
- if(fieldName === "${fieldName}" ){
133
- <#attempt>
134
- return <#if messagesPerField.existsError('${fieldName}')>true<#else>false</#if>;
135
- <#recover>
136
- </#attempt>
137
- }
138
- </#list>
139
- throw new Error("There is no " + fieldName + " field");
140
- },
141
- "get": function (fieldName) {
142
- <#list fieldNames as fieldName>
143
- if(fieldName === "${fieldName}" ){
144
- <#attempt>
145
- <#if messagesPerField.existsError('${fieldName}')>
146
- return "${messagesPerField.get('${fieldName}')?no_esc}";
147
- </#if>
148
- <#recover>
149
- </#attempt>
150
- }
151
- </#list>
152
- throw new Error("There is no " + fieldName + " field");
153
- },
154
- "exists": function (fieldName) {
155
- <#list fieldNames as fieldName>
156
- if(fieldName === "${fieldName}" ){
157
- <#attempt>
158
- return <#if messagesPerField.exists('${fieldName}')>true<#else>false</#if>;
159
- <#recover>
160
- </#attempt>
161
- }
162
- </#list>
163
- throw new Error("There is no " + fieldName + " field");
164
- }
165
- },
166
- "msg": function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); },
167
- "advancedMsg": function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); }
168
- };
169
- const out = {};
170
- Object.deepAssign(
171
- out,
172
- //Removing all the undefined
173
- JSON.parse(JSON.stringify(<@objectToJson_please_ignore_errors object=.data_model depth=0 arr=[] ftl="ftl_template_for_replacement" />), (key, value) => value === "error_data_is_undefined" ? undefined : value)
174
- );
175
- Object.deepAssign(
176
- out,
177
- nonAutomaticallyConvertible
178
- );
179
- return out;
180
- })()
181
- </script>
@@ -1,28 +0,0 @@
1
-
2
- Object.defineProperty(
3
- Object,
4
- "deepAssign",
5
- {
6
- "value": function callee(target, source) {
7
- Object.keys(source).forEach(function (key) {
8
- var value = source[key];
9
- if (target[key] === undefined) {
10
- target[key] = value;
11
- return;
12
- }
13
- if (value instanceof Object) {
14
- if (value instanceof Array) {
15
- value.forEach(function (entry) {
16
- target[key].push(entry);
17
- });
18
- return;
19
- }
20
- callee(target[key], value);
21
- return;
22
- }
23
- target[key] = value;
24
- });
25
- return target;
26
- }
27
- }
28
- );
@@ -1,181 +0,0 @@
1
- <script>const _=
2
- <#macro objectToJson_please_ignore_errors object depth arr ftl>
3
- <@compress>
4
- <#local isHash = false>
5
- <#attempt>
6
- <#local isHash = object?is_hash || object?is_hash_ex>
7
- <#recover>
8
- /* can't evaluate if object is hash */
9
- undefined
10
- <#return>
11
- </#attempt>
12
- <#if isHash>
13
- <#local keys = "">
14
- <#attempt>
15
- <#local keys = object?keys>
16
- <#recover>
17
- /* can't list keys of object */
18
- undefined
19
- <#return>
20
- </#attempt>
21
- <#if arr?sequence?size gte 1>
22
- <#local keys = arr>
23
- </#if>
24
- {${'\n'}
25
- <#list keys as key>
26
- <#if key == "class">
27
- /* skipping "class" property of object */
28
- <#continue>
29
- </#if>
30
- <#attempt>
31
- <#local value = object[key]!"error_data_is_undefined">
32
- <#recover>
33
- /* couldn't dereference ${key} of object */
34
- <#continue>
35
- </#attempt>
36
- <#if depth gt 7>
37
- /* Avoid calling recustively too many times depth: ${depth}, key: ${key} */
38
- <#continue>
39
- </#if>
40
- <#local arr_keys = []>
41
- <#if depth==0 && key=="url" && ftl=="saml-post-form.ftl" >
42
- <#local arr_keys = ["resourcesPath", "resourcesCommonPath", "loginRestartFlowUrl", "loginUrl", "loginResetCredentialsUrl", "registrationUrl", "registrationAction", "oauth2DeviceVerificationAction", "oauthAction", "loginResetCredentialsUrl"]>
43
- <#elseif depth==0 && key=="url">
44
- <#local arr_keys = ["loginAction", "resourcesPath", "resourcesCommonPath", "loginRestartFlowUrl", "loginUrl", "loginResetCredentialsUrl", "registrationUrl", "registrationAction", "oauth2DeviceVerificationAction", "oauthAction", "loginResetCredentialsUrl"]>
45
- </#if>
46
- <#if depth==0 && key=="auth" && ftl=="login-reset-password.ftl" >
47
- <#local arr_keys = ["showUsername", "showResetCredentials", "showTryAnotherWayLink", "attemptedUsername"]>
48
- <#elseif depth==0 && key=="auth">
49
- <#local arr_keys = ["showUsername", "showResetCredentials", "showTryAnotherWayLink"]>
50
- </#if>
51
- <#if depth==0 && key=="updateProfileCtx" ><#continue></#if>
52
- "${key}": <@objectToJson_please_ignore_errors object=value depth=depth+1 arr=arr_keys ftl=ftl />,
53
- </#list>
54
- }${'\n'}
55
- <#return>
56
- </#if>
57
- <#local isMethod = "">
58
- <#attempt>
59
- <#local isMethod = object?is_method>
60
- <#recover>
61
- /* can't test if object is a method */
62
- undefined
63
- <#return>
64
- </#attempt>
65
- <#if isMethod>
66
- undefined
67
- <#return>
68
- </#if>
69
- <#local isBoolean = "">
70
- <#attempt>
71
- <#local isBoolean = object?is_boolean>
72
- <#recover>
73
- /* can't test if object is a boolean */
74
- undefined
75
- <#return>
76
- </#attempt>
77
- <#if isBoolean>
78
- ${object?c}
79
- <#return>
80
- </#if>
81
- <#local isEnumerable = "">
82
- <#attempt>
83
- <#local isEnumerable = object?is_enumerable>
84
- <#recover>
85
- /* can't test if object is enumerable */
86
- undefined
87
- <#return>
88
- </#attempt>
89
- <#if isEnumerable>
90
- [${'\n'}
91
- <#list object as item>
92
- <@objectToJson_please_ignore_errors object=item depth=depth+1 arr=[] ftl=ftl/>,
93
- </#list>
94
- ]${'\n'}
95
- <#return>
96
- </#if>
97
- <#attempt>
98
- "${object?replace('"', '\\"')?no_esc}"
99
- <#recover>
100
- /* couldn't convert into string non hash, non method, non boolean, non enumerable object */
101
- undefined;
102
- <#return>
103
- </#attempt>
104
- </@compress>
105
- </#macro>
106
- (()=>{
107
- const nonAutomaticallyConvertible = {
108
- "messagesPerField": {
109
- <#assign fieldNames = ["global", "userLabel", "username", "email", "firstName", "lastName", "password", "password-confirm", "totp", "totpSecret", "SAMLRequest", "SAMLResponse", "relayState", "device_user_code", "code", "password-new", "rememberMe", "login", "authenticationExecution", "cancel-aia", "clientDataJSON", "authenticatorData", "signature", "credentialId", "userHandle", "error", "authn_use_chk", "authenticationExecution", "isSetRetry", "try-again", "attestationObject", "publicKeyCredentialId", "authenticatorLabel"]>
110
- <#assign attributes = (profile.attributes)![]>
111
- <#attempt>
112
- <#list attributes as attribute>
113
- <#if (attribute.name)??>
114
- <#assign fieldNames += [attribute.name]>
115
- </#if>
116
- </#list>
117
- <#recover>
118
- </#attempt>
119
- "printIfExists": function (fieldName, x) {
120
- <#list fieldNames as fieldName>
121
- if(fieldName === "${fieldName}" ){
122
- <#attempt>
123
- return "${messagesPerField.printIfExists(fieldName,'1')}" ? x : undefined;
124
- <#recover>
125
- </#attempt>
126
- }
127
- </#list>
128
- throw new Error("There is no " + fieldName + " field");
129
- },
130
- "existsError": function (fieldName) {
131
- <#list fieldNames as fieldName>
132
- if(fieldName === "${fieldName}" ){
133
- <#attempt>
134
- return <#if messagesPerField.existsError('${fieldName}')>true<#else>false</#if>;
135
- <#recover>
136
- </#attempt>
137
- }
138
- </#list>
139
- throw new Error("There is no " + fieldName + " field");
140
- },
141
- "get": function (fieldName) {
142
- <#list fieldNames as fieldName>
143
- if(fieldName === "${fieldName}" ){
144
- <#attempt>
145
- <#if messagesPerField.existsError('${fieldName}')>
146
- return "${messagesPerField.get('${fieldName}')?no_esc}";
147
- </#if>
148
- <#recover>
149
- </#attempt>
150
- }
151
- </#list>
152
- throw new Error("There is no " + fieldName + " field");
153
- },
154
- "exists": function (fieldName) {
155
- <#list fieldNames as fieldName>
156
- if(fieldName === "${fieldName}" ){
157
- <#attempt>
158
- return <#if messagesPerField.exists('${fieldName}')>true<#else>false</#if>;
159
- <#recover>
160
- </#attempt>
161
- }
162
- </#list>
163
- throw new Error("There is no " + fieldName + " field");
164
- }
165
- },
166
- "msg": function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); },
167
- "advancedMsg": function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); }
168
- };
169
- const out = {};
170
- Object.deepAssign(
171
- out,
172
- //Removing all the undefined
173
- JSON.parse(JSON.stringify(<@objectToJson_please_ignore_errors object=.data_model depth=0 arr=[] ftl="ftl_template_for_replacement" />), (key, value) => value === "error_data_is_undefined" ? undefined : value)
174
- );
175
- Object.deepAssign(
176
- out,
177
- nonAutomaticallyConvertible
178
- );
179
- return out;
180
- })()
181
- </script>