keycloakify 4.2.13 → 4.2.15

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.
@@ -1,208 +0,0 @@
1
- <script>const _=
2
- <#macro objectToJson_please_ignore_errors object depth>
3
- <@compress>
4
-
5
- <#local isHash = false>
6
- <#attempt>
7
- <#local isHash = object?is_hash || object?is_hash_ex>
8
- <#recover>
9
- /* can't evaluate if object is hash */
10
- undefined
11
- <#return>
12
- </#attempt>
13
- <#if isHash>
14
-
15
- <#local keys = "">
16
-
17
- <#attempt>
18
- <#local keys = object?keys>
19
- <#recover>
20
- /* can't list keys of object */
21
- undefined
22
- <#return>
23
- </#attempt>
24
-
25
- {${'\n'}
26
-
27
- <#list keys as key>
28
-
29
- <#if key == "class">
30
- /* skipping "class" property of object */
31
- <#continue>
32
- </#if>
33
-
34
- <#local value = "">
35
-
36
- <#attempt>
37
- <#local value = object[key]>
38
- <#recover>
39
- /* couldn't dereference ${key} of object */
40
- <#continue>
41
- </#attempt>
42
-
43
- <#if depth gt 7>
44
- /* Avoid calling recustively too many times depth: ${depth}, key: ${key} */
45
- <#continue>
46
- </#if>
47
-
48
- "${key}": <@objectToJson_please_ignore_errors object=value depth=depth+1/>,
49
-
50
- </#list>
51
-
52
- }${'\n'}
53
-
54
- <#return>
55
-
56
- </#if>
57
-
58
-
59
- <#local isMethod = "">
60
- <#attempt>
61
- <#local isMethod = object?is_method>
62
- <#recover>
63
- /* can't test if object is a method */
64
- undefined
65
- <#return>
66
- </#attempt>
67
-
68
- <#if isMethod>
69
- undefined
70
- <#return>
71
- </#if>
72
-
73
-
74
-
75
- <#local isBoolean = "">
76
- <#attempt>
77
- <#local isBoolean = object?is_boolean>
78
- <#recover>
79
- /* can't test if object is a boolean */
80
- undefined
81
- <#return>
82
- </#attempt>
83
-
84
- <#if isBoolean>
85
- ${object?c}
86
- <#return>
87
- </#if>
88
-
89
-
90
- <#local isEnumerable = "">
91
- <#attempt>
92
- <#local isEnumerable = object?is_enumerable>
93
- <#recover>
94
- /* can't test if object is enumerable */
95
- undefined
96
- <#return>
97
- </#attempt>
98
-
99
- <#if isEnumerable>
100
-
101
- [${'\n'}
102
-
103
- <#list object as item>
104
-
105
- <@objectToJson_please_ignore_errors object=item depth=depth+1/>,
106
-
107
- </#list>
108
-
109
- ]${'\n'}
110
-
111
- <#return>
112
- </#if>
113
-
114
-
115
- <#attempt>
116
- "${object?replace('"', '\\"')?no_esc}"
117
- <#recover>
118
- /* couldn't convert into string non hash, non method, non boolean, non enumerable object */
119
- undefined;
120
- <#return>
121
- </#attempt>
122
-
123
-
124
- </@compress>
125
- </#macro>
126
-
127
- (()=>{
128
-
129
- const nonAutomaticallyConvertible = {
130
- "messagesPerField": {
131
-
132
- <#assign fieldNames = ["global", "userLabel", "username", "email", "firstName", "lastName", "password", "password-confirm"]>
133
-
134
- <#attempt>
135
- <#list profile.attributes as attribute>
136
- <#assign fieldNames += [attribute.name]>
137
- </#list>
138
- <#recover>
139
- </#attempt>
140
-
141
- "printIfExists": function (fieldName, x) {
142
- <#list fieldNames as fieldName>
143
- if(fieldName === "${fieldName}" ){
144
- <#attempt>
145
- return "${messagesPerField.printIfExists(fieldName,'1')}" ? x : undefined;
146
- <#recover>
147
- </#attempt>
148
- }
149
- </#list>
150
- throw new Error("There is no " + fieldName + " field");
151
- },
152
- "existsError": function (fieldName) {
153
- <#list fieldNames as fieldName>
154
- if(fieldName === "${fieldName}" ){
155
- <#attempt>
156
- return <#if messagesPerField.existsError('${fieldName}')>true<#else>false</#if>;
157
- <#recover>
158
- </#attempt>
159
- }
160
- </#list>
161
- throw new Error("There is no " + fieldName + " field");
162
- },
163
- "get": function (fieldName) {
164
- <#list fieldNames as fieldName>
165
- if(fieldName === "${fieldName}" ){
166
- <#attempt>
167
- <#if messagesPerField.existsError('${fieldName}')>
168
- return "${messagesPerField.get('${fieldName}')?no_esc}";
169
- </#if>
170
- <#recover>
171
- </#attempt>
172
- }
173
- </#list>
174
- throw new Error("There is no " + fieldName + " field");
175
- },
176
- "exists": function (fieldName) {
177
- <#list fieldNames as fieldName>
178
- if(fieldName === "${fieldName}" ){
179
- <#attempt>
180
- return <#if messagesPerField.exists('${fieldName}')>true<#else>false</#if>;
181
- <#recover>
182
- </#attempt>
183
- }
184
- </#list>
185
- throw new Error("There is no " + fieldName + " field");
186
- }
187
- },
188
- "msg": function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); },
189
- "advancedMsg": function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); }
190
- };
191
-
192
- const out = {};
193
-
194
- Object.deepAssign(
195
- out,
196
- //Removing all the undefined
197
- JSON.parse(JSON.stringify(<@objectToJson_please_ignore_errors object=.data_model depth=0 />))
198
- );
199
-
200
- Object.deepAssign(
201
- out,
202
- nonAutomaticallyConvertible
203
- );
204
-
205
- return out;
206
-
207
- })()
208
- </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,208 +0,0 @@
1
- <script>const _=
2
- <#macro objectToJson_please_ignore_errors object depth>
3
- <@compress>
4
-
5
- <#local isHash = false>
6
- <#attempt>
7
- <#local isHash = object?is_hash || object?is_hash_ex>
8
- <#recover>
9
- /* can't evaluate if object is hash */
10
- undefined
11
- <#return>
12
- </#attempt>
13
- <#if isHash>
14
-
15
- <#local keys = "">
16
-
17
- <#attempt>
18
- <#local keys = object?keys>
19
- <#recover>
20
- /* can't list keys of object */
21
- undefined
22
- <#return>
23
- </#attempt>
24
-
25
- {${'\n'}
26
-
27
- <#list keys as key>
28
-
29
- <#if key == "class">
30
- /* skipping "class" property of object */
31
- <#continue>
32
- </#if>
33
-
34
- <#local value = "">
35
-
36
- <#attempt>
37
- <#local value = object[key]>
38
- <#recover>
39
- /* couldn't dereference ${key} of object */
40
- <#continue>
41
- </#attempt>
42
-
43
- <#if depth gt 7>
44
- /* Avoid calling recustively too many times depth: ${depth}, key: ${key} */
45
- <#continue>
46
- </#if>
47
-
48
- "${key}": <@objectToJson_please_ignore_errors object=value depth=depth+1/>,
49
-
50
- </#list>
51
-
52
- }${'\n'}
53
-
54
- <#return>
55
-
56
- </#if>
57
-
58
-
59
- <#local isMethod = "">
60
- <#attempt>
61
- <#local isMethod = object?is_method>
62
- <#recover>
63
- /* can't test if object is a method */
64
- undefined
65
- <#return>
66
- </#attempt>
67
-
68
- <#if isMethod>
69
- undefined
70
- <#return>
71
- </#if>
72
-
73
-
74
-
75
- <#local isBoolean = "">
76
- <#attempt>
77
- <#local isBoolean = object?is_boolean>
78
- <#recover>
79
- /* can't test if object is a boolean */
80
- undefined
81
- <#return>
82
- </#attempt>
83
-
84
- <#if isBoolean>
85
- ${object?c}
86
- <#return>
87
- </#if>
88
-
89
-
90
- <#local isEnumerable = "">
91
- <#attempt>
92
- <#local isEnumerable = object?is_enumerable>
93
- <#recover>
94
- /* can't test if object is enumerable */
95
- undefined
96
- <#return>
97
- </#attempt>
98
-
99
- <#if isEnumerable>
100
-
101
- [${'\n'}
102
-
103
- <#list object as item>
104
-
105
- <@objectToJson_please_ignore_errors object=item depth=depth+1/>,
106
-
107
- </#list>
108
-
109
- ]${'\n'}
110
-
111
- <#return>
112
- </#if>
113
-
114
-
115
- <#attempt>
116
- "${object?replace('"', '\\"')?no_esc}"
117
- <#recover>
118
- /* couldn't convert into string non hash, non method, non boolean, non enumerable object */
119
- undefined;
120
- <#return>
121
- </#attempt>
122
-
123
-
124
- </@compress>
125
- </#macro>
126
-
127
- (()=>{
128
-
129
- const nonAutomaticallyConvertible = {
130
- "messagesPerField": {
131
-
132
- <#assign fieldNames = ["global", "userLabel", "username", "email", "firstName", "lastName", "password", "password-confirm"]>
133
-
134
- <#attempt>
135
- <#list profile.attributes as attribute>
136
- <#assign fieldNames += [attribute.name]>
137
- </#list>
138
- <#recover>
139
- </#attempt>
140
-
141
- "printIfExists": function (fieldName, x) {
142
- <#list fieldNames as fieldName>
143
- if(fieldName === "${fieldName}" ){
144
- <#attempt>
145
- return "${messagesPerField.printIfExists(fieldName,'1')}" ? x : undefined;
146
- <#recover>
147
- </#attempt>
148
- }
149
- </#list>
150
- throw new Error("There is no " + fieldName + " field");
151
- },
152
- "existsError": function (fieldName) {
153
- <#list fieldNames as fieldName>
154
- if(fieldName === "${fieldName}" ){
155
- <#attempt>
156
- return <#if messagesPerField.existsError('${fieldName}')>true<#else>false</#if>;
157
- <#recover>
158
- </#attempt>
159
- }
160
- </#list>
161
- throw new Error("There is no " + fieldName + " field");
162
- },
163
- "get": function (fieldName) {
164
- <#list fieldNames as fieldName>
165
- if(fieldName === "${fieldName}" ){
166
- <#attempt>
167
- <#if messagesPerField.existsError('${fieldName}')>
168
- return "${messagesPerField.get('${fieldName}')?no_esc}";
169
- </#if>
170
- <#recover>
171
- </#attempt>
172
- }
173
- </#list>
174
- throw new Error("There is no " + fieldName + " field");
175
- },
176
- "exists": function (fieldName) {
177
- <#list fieldNames as fieldName>
178
- if(fieldName === "${fieldName}" ){
179
- <#attempt>
180
- return <#if messagesPerField.exists('${fieldName}')>true<#else>false</#if>;
181
- <#recover>
182
- </#attempt>
183
- }
184
- </#list>
185
- throw new Error("There is no " + fieldName + " field");
186
- }
187
- },
188
- "msg": function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); },
189
- "advancedMsg": function(){ throw new Error("use import { useKcMessage } from 'keycloakify'"); }
190
- };
191
-
192
- const out = {};
193
-
194
- Object.deepAssign(
195
- out,
196
- //Removing all the undefined
197
- JSON.parse(JSON.stringify(<@objectToJson_please_ignore_errors object=.data_model depth=0 />))
198
- );
199
-
200
- Object.deepAssign(
201
- out,
202
- nonAutomaticallyConvertible
203
- );
204
-
205
- return out;
206
-
207
- })()
208
- </script>