@aemforms/af-core 0.22.23 → 0.22.26

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 (52) hide show
  1. package/lib/browser/afb-events.js +151 -0
  2. package/lib/browser/afb-runtime.js +3620 -0
  3. package/lib/cjs/index.cjs +1876 -267
  4. package/lib/esm/BaseNode.js +454 -26
  5. package/lib/esm/Checkbox.js +1 -37
  6. package/lib/esm/CheckboxGroup.js +1 -38
  7. package/lib/esm/Container.js +9 -30
  8. package/lib/esm/DateField.js +2 -38
  9. package/lib/esm/Field.d.ts +2 -2
  10. package/lib/esm/Field.js +26 -62
  11. package/lib/esm/Fieldset.js +3 -36
  12. package/lib/esm/FileObject.js +1 -23
  13. package/lib/esm/FileUpload.js +1 -34
  14. package/lib/esm/Form.d.ts +1 -1
  15. package/lib/esm/Form.js +8 -40
  16. package/lib/esm/FormInstance.js +5 -53
  17. package/lib/esm/FormMetaData.js +1 -26
  18. package/lib/esm/InstanceManager.js +8 -35
  19. package/lib/esm/Node.js +1 -25
  20. package/lib/esm/Scriptable.js +2 -29
  21. package/lib/esm/controller/EventQueue.js +1 -23
  22. package/lib/esm/controller/Events.d.ts +1 -1
  23. package/lib/esm/controller/Events.js +19 -41
  24. package/lib/esm/controller/Logger.d.ts +2 -2
  25. package/lib/esm/controller/Logger.js +1 -23
  26. package/lib/esm/data/DataGroup.js +1 -24
  27. package/lib/esm/data/DataValue.js +1 -23
  28. package/lib/esm/data/EmptyDataValue.js +1 -23
  29. package/lib/esm/index.js +21 -55
  30. package/lib/esm/rules/FunctionRuntime.d.ts +3 -3
  31. package/lib/esm/rules/FunctionRuntime.js +6 -31
  32. package/lib/esm/rules/RuleEngine.js +1 -30
  33. package/lib/esm/types/Json.d.ts +16 -16
  34. package/lib/esm/types/Json.js +2 -24
  35. package/lib/esm/types/Model.d.ts +4 -4
  36. package/lib/esm/types/Model.js +1 -23
  37. package/lib/esm/types/index.js +2 -22
  38. package/lib/esm/utils/DataRefParser.d.ts +2 -2
  39. package/lib/esm/utils/DataRefParser.js +6 -31
  40. package/lib/esm/utils/Fetch.d.ts +1 -1
  41. package/lib/esm/utils/Fetch.js +2 -24
  42. package/lib/esm/utils/FormCreationUtils.js +2 -40
  43. package/lib/esm/utils/FormUtils.js +8 -33
  44. package/lib/esm/utils/JsonUtils.js +11 -34
  45. package/lib/esm/utils/LogUtils.js +1 -23
  46. package/lib/esm/utils/SchemaUtils.js +2 -24
  47. package/lib/esm/utils/TranslationUtils.d.ts +1 -1
  48. package/lib/esm/utils/TranslationUtils.js +9 -32
  49. package/lib/esm/utils/ValidationUtils.d.ts +4 -4
  50. package/lib/esm/utils/ValidationUtils.js +4 -30
  51. package/package.json +2 -14
  52. package/lib/esm/BaseNode-dc59ab07.js +0 -478
@@ -1,24 +1,4 @@
1
- /*************************************************************************
2
- * ADOBE CONFIDENTIAL
3
- * ___________________
4
- *
5
- * Copyright 2022 Adobe
6
- * All Rights Reserved.
7
- *
8
- * NOTICE: All information contained herein is, and remains
9
- * the property of Adobe and its suppliers, if any. The intellectual
10
- * and technical concepts contained herein are proprietary to Adobe
11
- * and its suppliers and are protected by all applicable intellectual
12
- * property laws, including trade secret and copyright laws.
13
- * Dissemination of this information or reproduction of this material
14
- * is strictly forbidden unless prior written permission is obtained
15
- * from Adobe.
16
-
17
- * Adobe permits you to use and modify this file solely in accordance with
18
- * the terms of the Adobe license agreement accompanying it.
19
- *************************************************************************/
20
-
21
- class ValidationError {
1
+ export class ValidationError {
22
2
  fieldName;
23
3
  errorMessages;
24
4
  constructor(fieldName = '', errorMessages = []) {
@@ -26,5 +6,3 @@ class ValidationError {
26
6
  this.fieldName = fieldName;
27
7
  }
28
8
  }
29
-
30
- export { ValidationError };
@@ -1,22 +1,2 @@
1
- /*************************************************************************
2
- * ADOBE CONFIDENTIAL
3
- * ___________________
4
- *
5
- * Copyright 2022 Adobe
6
- * All Rights Reserved.
7
- *
8
- * NOTICE: All information contained herein is, and remains
9
- * the property of Adobe and its suppliers, if any. The intellectual
10
- * and technical concepts contained herein are proprietary to Adobe
11
- * and its suppliers and are protected by all applicable intellectual
12
- * property laws, including trade secret and copyright laws.
13
- * Dissemination of this information or reproduction of this material
14
- * is strictly forbidden unless prior written permission is obtained
15
- * from Adobe.
16
-
17
- * Adobe permits you to use and modify this file solely in accordance with
18
- * the terms of the Adobe license agreement accompanying it.
19
- *************************************************************************/
20
-
21
- export { constraintProps, translationProps } from './Json.js';
22
- export { ValidationError } from './Model.js';
1
+ export * from './Json.js';
2
+ export * from './Model.js';
@@ -1,8 +1,8 @@
1
1
  import DataGroup from '../data/DataGroup.js';
2
2
  import DataValue from '../data/DataValue.js';
3
- type TokenType = string;
3
+ declare type TokenType = string;
4
4
  export declare const TOK_GLOBAL: TokenType;
5
- export type Token = {
5
+ export declare type Token = {
6
6
  type: TokenType;
7
7
  value: string | number;
8
8
  start: number;
@@ -1,48 +1,25 @@
1
- /*************************************************************************
2
- * ADOBE CONFIDENTIAL
3
- * ___________________
4
- *
5
- * Copyright 2022 Adobe
6
- * All Rights Reserved.
7
- *
8
- * NOTICE: All information contained herein is, and remains
9
- * the property of Adobe and its suppliers, if any. The intellectual
10
- * and technical concepts contained herein are proprietary to Adobe
11
- * and its suppliers and are protected by all applicable intellectual
12
- * property laws, including trade secret and copyright laws.
13
- * Dissemination of this information or reproduction of this material
14
- * is strictly forbidden unless prior written permission is obtained
15
- * from Adobe.
16
-
17
- * Adobe permits you to use and modify this file solely in accordance with
18
- * the terms of the Adobe license agreement accompanying it.
19
- *************************************************************************/
20
-
21
1
  import DataGroup from '../data/DataGroup.js';
22
- import '../data/DataValue.js';
23
- import '../data/EmptyDataValue.js';
24
-
25
2
  const TOK_DOT = 'DOT';
26
3
  const TOK_IDENTIFIER = 'Identifier';
27
- const TOK_GLOBAL = 'Global';
4
+ export const TOK_GLOBAL = 'Global';
28
5
  const TOK_BRACKET = 'bracket';
29
6
  const TOK_NUMBER = 'Number';
30
7
  const globalStartToken = '$';
31
- const identifier = (value, start) => {
8
+ export const identifier = (value, start) => {
32
9
  return {
33
10
  type: TOK_IDENTIFIER,
34
11
  value,
35
12
  start
36
13
  };
37
14
  };
38
- const bracket = (value, start) => {
15
+ export const bracket = (value, start) => {
39
16
  return {
40
17
  type: TOK_BRACKET,
41
18
  value,
42
19
  start
43
20
  };
44
21
  };
45
- const global$ = () => {
22
+ export const global$ = () => {
46
23
  return {
47
24
  type: TOK_GLOBAL,
48
25
  start: 0,
@@ -177,10 +154,10 @@ class Tokenizer {
177
154
  return this._result_tokens;
178
155
  }
179
156
  }
180
- const tokenize = (stream) => {
157
+ export const tokenize = (stream) => {
181
158
  return new Tokenizer(stream).tokenize();
182
159
  };
183
- const resolveData = (data, input, create) => {
160
+ export const resolveData = (data, input, create) => {
184
161
  let tokens;
185
162
  if (typeof input === 'string') {
186
163
  tokens = tokenize(input);
@@ -243,5 +220,3 @@ const resolveData = (data, input, create) => {
243
220
  }
244
221
  return result;
245
222
  };
246
-
247
- export { TOK_GLOBAL, bracket, global$, identifier, resolveData, tokenize };
@@ -1,5 +1,5 @@
1
1
  export declare const request: (url: string, data?: any, options?: RequestOptions) => any;
2
- export type RequestOptions = {
2
+ export declare type RequestOptions = {
3
3
  contentType?: string;
4
4
  method?: 'POST' | 'GET';
5
5
  headers?: any;
@@ -1,24 +1,4 @@
1
- /*************************************************************************
2
- * ADOBE CONFIDENTIAL
3
- * ___________________
4
- *
5
- * Copyright 2022 Adobe
6
- * All Rights Reserved.
7
- *
8
- * NOTICE: All information contained herein is, and remains
9
- * the property of Adobe and its suppliers, if any. The intellectual
10
- * and technical concepts contained herein are proprietary to Adobe
11
- * and its suppliers and are protected by all applicable intellectual
12
- * property laws, including trade secret and copyright laws.
13
- * Dissemination of this information or reproduction of this material
14
- * is strictly forbidden unless prior written permission is obtained
15
- * from Adobe.
16
-
17
- * Adobe permits you to use and modify this file solely in accordance with
18
- * the terms of the Adobe license agreement accompanying it.
19
- *************************************************************************/
20
-
21
- const request = (url, data = null, options = {}) => {
1
+ export const request = (url, data = null, options = {}) => {
22
2
  const opts = { ...defaultRequestOptions, ...options };
23
3
  const updatedUrl = opts.method === 'GET' && data ? convertQueryString(url, data) : url;
24
4
  if (opts.method !== 'GET') {
@@ -54,7 +34,7 @@ const request = (url, data = null, options = {}) => {
54
34
  const defaultRequestOptions = {
55
35
  method: 'GET'
56
36
  };
57
- const convertQueryString = (endpoint, payload) => {
37
+ export const convertQueryString = (endpoint, payload) => {
58
38
  if (!payload) {
59
39
  return endpoint;
60
40
  }
@@ -79,5 +59,3 @@ const convertQueryString = (endpoint, payload) => {
79
59
  }
80
60
  return endpoint.includes('?') ? `${endpoint}&${params.join('&')}` : `${endpoint}?${params.join('&')}`;
81
61
  };
82
-
83
- export { convertQueryString, request };
@@ -1,47 +1,11 @@
1
- /*************************************************************************
2
- * ADOBE CONFIDENTIAL
3
- * ___________________
4
- *
5
- * Copyright 2022 Adobe
6
- * All Rights Reserved.
7
- *
8
- * NOTICE: All information contained herein is, and remains
9
- * the property of Adobe and its suppliers, if any. The intellectual
10
- * and technical concepts contained herein are proprietary to Adobe
11
- * and its suppliers and are protected by all applicable intellectual
12
- * property laws, including trade secret and copyright laws.
13
- * Dissemination of this information or reproduction of this material
14
- * is strictly forbidden unless prior written permission is obtained
15
- * from Adobe.
16
-
17
- * Adobe permits you to use and modify this file solely in accordance with
18
- * the terms of the Adobe license agreement accompanying it.
19
- *************************************************************************/
20
-
21
1
  import { InstanceManager } from '../InstanceManager.js';
22
2
  import { Fieldset } from '../Fieldset.js';
23
- import { isRepeatable, isFile, isCheckbox, isCheckboxGroup, isDateField } from './JsonUtils.js';
3
+ import { isCheckbox, isCheckboxGroup, isDateField, isFile, isRepeatable } from './JsonUtils.js';
24
4
  import FileUpload from '../FileUpload.js';
25
5
  import Checkbox from '../Checkbox.js';
26
6
  import CheckboxGroup from '../CheckboxGroup.js';
27
7
  import DateField from '../DateField.js';
28
8
  import Field from '../Field.js';
29
- import '../BaseNode-dc59ab07.js';
30
- import '../controller/Events.js';
31
- import './DataRefParser.js';
32
- import '../data/DataGroup.js';
33
- import '../data/DataValue.js';
34
- import '../data/EmptyDataValue.js';
35
- import '../Container.js';
36
- import '../Scriptable.js';
37
- import '../types/Json.js';
38
- import './SchemaUtils.js';
39
- import './FormUtils.js';
40
- import '../FileObject.js';
41
- import './ValidationUtils.js';
42
- import '../types/Model.js';
43
- import '@aemforms/af-formatters';
44
-
45
9
  const alternateFieldTypeMapping = {
46
10
  'text': 'text-input',
47
11
  'number': 'number-input',
@@ -107,6 +71,4 @@ class FormFieldFactoryImpl {
107
71
  return retVal;
108
72
  }
109
73
  }
110
- const FormFieldFactory = new FormFieldFactoryImpl();
111
-
112
- export { FormFieldFactory };
74
+ export const FormFieldFactory = new FormFieldFactoryImpl();
@@ -1,31 +1,8 @@
1
- /*************************************************************************
2
- * ADOBE CONFIDENTIAL
3
- * ___________________
4
- *
5
- * Copyright 2022 Adobe
6
- * All Rights Reserved.
7
- *
8
- * NOTICE: All information contained herein is, and remains
9
- * the property of Adobe and its suppliers, if any. The intellectual
10
- * and technical concepts contained herein are proprietary to Adobe
11
- * and its suppliers and are protected by all applicable intellectual
12
- * property laws, including trade secret and copyright laws.
13
- * Dissemination of this information or reproduction of this material
14
- * is strictly forbidden unless prior written permission is obtained
15
- * from Adobe.
16
-
17
- * Adobe permits you to use and modify this file solely in accordance with
18
- * the terms of the Adobe license agreement accompanying it.
19
- *************************************************************************/
20
-
21
1
  import { isFile } from './JsonUtils.js';
22
2
  import { FileObject } from '../FileObject.js';
23
- import '../types/Json.js';
24
- import './SchemaUtils.js';
25
-
26
3
  const chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'.split('');
27
4
  const fileSizeRegex = /^(\d*\.?\d+)(\\?(?=[KMGT])([KMGT])(?:i?B)?|B?)$/i;
28
- const randomWord = (l) => {
5
+ export const randomWord = (l) => {
29
6
  const ret = [];
30
7
  for (let i = 0; i <= l; i++) {
31
8
  const randIndex = Math.floor(Math.random() * (chars.length));
@@ -33,10 +10,10 @@ const randomWord = (l) => {
33
10
  }
34
11
  return ret.join('');
35
12
  };
36
- const isEmpty = (value) => {
13
+ export const isEmpty = (value) => {
37
14
  return value === '' || value === null || value === undefined;
38
15
  };
39
- const getAttachments = (input) => {
16
+ export const getAttachments = (input) => {
40
17
  const items = input.items || [];
41
18
  return items?.reduce((acc, item) => {
42
19
  let ret = null;
@@ -63,7 +40,7 @@ const getAttachments = (input) => {
63
40
  return Object.assign(acc, ret);
64
41
  }, {});
65
42
  };
66
- const getFileSizeInBytes = (str) => {
43
+ export const getFileSizeInBytes = (str) => {
67
44
  let retVal = 0;
68
45
  if (typeof str === 'string') {
69
46
  const matches = fileSizeRegex.exec(str.trim());
@@ -78,7 +55,7 @@ const sizeToBytes = (size, symbol) => {
78
55
  const i = Math.pow(1024, sizes[symbol]);
79
56
  return Math.round(size * i);
80
57
  };
81
- const IdGenerator = function* (initial = 50) {
58
+ export const IdGenerator = function* (initial = 50) {
82
59
  const initialize = function () {
83
60
  const arr = [];
84
61
  for (let i = 0; i < initial; i++) {
@@ -103,11 +80,11 @@ const IdGenerator = function* (initial = 50) {
103
80
  }
104
81
  } while (ids.length > 0);
105
82
  };
106
- const isDataUrl = (str) => {
83
+ export const isDataUrl = (str) => {
107
84
  const dataUrlRegex = /^data:([a-z]+\/[a-z0-9-+.]+)?;(?:name=(.*);)?base64,(.*)$/;
108
85
  return dataUrlRegex.exec(str.trim()) != null;
109
86
  };
110
- const extractFileInfo = (file) => {
87
+ export const extractFileInfo = (file) => {
111
88
  if (file !== null) {
112
89
  let retVal = null;
113
90
  if (file instanceof FileObject) {
@@ -183,7 +160,7 @@ const extractFileInfo = (file) => {
183
160
  return null;
184
161
  }
185
162
  };
186
- const dataURItoBlob = (dataURI) => {
163
+ export const dataURItoBlob = (dataURI) => {
187
164
  const regex = /^data:([a-z]+\/[a-z0-9-+.]+)?(?:;name=([^;]+))?(;base64)?,(.+)$/;
188
165
  const groups = regex.exec(dataURI);
189
166
  if (groups !== null) {
@@ -208,5 +185,3 @@ const dataURItoBlob = (dataURI) => {
208
185
  return null;
209
186
  }
210
187
  };
211
-
212
- export { IdGenerator, dataURItoBlob, extractFileInfo, getAttachments, getFileSizeInBytes, isDataUrl, isEmpty, randomWord };
@@ -1,27 +1,6 @@
1
- /*************************************************************************
2
- * ADOBE CONFIDENTIAL
3
- * ___________________
4
- *
5
- * Copyright 2022 Adobe
6
- * All Rights Reserved.
7
- *
8
- * NOTICE: All information contained herein is, and remains
9
- * the property of Adobe and its suppliers, if any. The intellectual
10
- * and technical concepts contained herein are proprietary to Adobe
11
- * and its suppliers and are protected by all applicable intellectual
12
- * property laws, including trade secret and copyright laws.
13
- * Dissemination of this information or reproduction of this material
14
- * is strictly forbidden unless prior written permission is obtained
15
- * from Adobe.
16
-
17
- * Adobe permits you to use and modify this file solely in accordance with
18
- * the terms of the Adobe license agreement accompanying it.
19
- *************************************************************************/
20
-
21
- import { constraintProps } from '../types/Json.js';
1
+ import { constraintProps } from '../types/index.js';
22
2
  import { defaultFieldTypes } from './SchemaUtils.js';
23
-
24
- const getProperty = (data, key, def) => {
3
+ export const getProperty = (data, key, def) => {
25
4
  if (key in data) {
26
5
  return data[key];
27
6
  }
@@ -33,27 +12,27 @@ const getProperty = (data, key, def) => {
33
12
  }
34
13
  return def;
35
14
  };
36
- const isFile = function (item) {
15
+ export const isFile = function (item) {
37
16
  return (item?.type === 'file' || item?.type === 'file[]') ||
38
17
  ((item?.type === 'string' || item?.type === 'string[]') &&
39
18
  (item?.format === 'binary' || item?.format === 'data-url'));
40
19
  };
41
- const checkIfConstraintsArePresent = function (item) {
20
+ export const checkIfConstraintsArePresent = function (item) {
42
21
  return constraintProps.some(cp => item[cp] !== undefined);
43
22
  };
44
- const isCheckbox = function (item) {
23
+ export const isCheckbox = function (item) {
45
24
  const fieldType = item?.fieldType || defaultFieldTypes(item);
46
25
  return fieldType === 'checkbox';
47
26
  };
48
- const isCheckboxGroup = function (item) {
27
+ export const isCheckboxGroup = function (item) {
49
28
  const fieldType = item?.fieldType || defaultFieldTypes(item);
50
29
  return fieldType === 'checkbox-group';
51
30
  };
52
- const isDateField = function (item) {
31
+ export const isDateField = function (item) {
53
32
  const fieldType = item?.fieldType || defaultFieldTypes(item);
54
33
  return (fieldType === 'text-input' && item?.format === 'date') || fieldType === 'date-input';
55
34
  };
56
- function deepClone(obj, idGenerator) {
35
+ export function deepClone(obj, idGenerator) {
57
36
  let result;
58
37
  if (obj instanceof Array) {
59
38
  result = [];
@@ -73,7 +52,7 @@ function deepClone(obj, idGenerator) {
73
52
  }
74
53
  return result;
75
54
  }
76
- function checkIfKeyAdded(currentObj, prevObj, objKey) {
55
+ export function checkIfKeyAdded(currentObj, prevObj, objKey) {
77
56
  if (currentObj != null && prevObj != null) {
78
57
  const newPrvObj = { ...prevObj };
79
58
  newPrvObj[objKey] = currentObj[objKey];
@@ -84,10 +63,10 @@ function checkIfKeyAdded(currentObj, prevObj, objKey) {
84
63
  return false;
85
64
  }
86
65
  }
87
- const jsonString = (obj) => {
66
+ export const jsonString = (obj) => {
88
67
  return JSON.stringify(obj, null, 2);
89
68
  };
90
- const isRepeatable = (obj) => {
69
+ export const isRepeatable = (obj) => {
91
70
  return ((obj.repeatable &&
92
71
  ((obj.minOccur === undefined && obj.maxOccur === undefined) ||
93
72
  (obj.minOccur !== undefined && obj.maxOccur !== undefined && obj.maxOccur !== 0) ||
@@ -95,5 +74,3 @@ const isRepeatable = (obj) => {
95
74
  (obj.minOccur !== undefined && obj.minOccur >= 0) ||
96
75
  (obj.maxOccur !== undefined && obj.maxOccur !== 0))) || false);
97
76
  };
98
-
99
- export { checkIfConstraintsArePresent, checkIfKeyAdded, deepClone, getProperty, isCheckbox, isCheckboxGroup, isDateField, isFile, isRepeatable, jsonString };
@@ -1,28 +1,6 @@
1
- /*************************************************************************
2
- * ADOBE CONFIDENTIAL
3
- * ___________________
4
- *
5
- * Copyright 2022 Adobe
6
- * All Rights Reserved.
7
- *
8
- * NOTICE: All information contained herein is, and remains
9
- * the property of Adobe and its suppliers, if any. The intellectual
10
- * and technical concepts contained herein are proprietary to Adobe
11
- * and its suppliers and are protected by all applicable intellectual
12
- * property laws, including trade secret and copyright laws.
13
- * Dissemination of this information or reproduction of this material
14
- * is strictly forbidden unless prior written permission is obtained
15
- * from Adobe.
16
-
17
- * Adobe permits you to use and modify this file solely in accordance with
18
- * the terms of the Adobe license agreement accompanying it.
19
- *************************************************************************/
20
-
21
- const logFormCallbacks = (callbacks) => {
1
+ export const logFormCallbacks = (callbacks) => {
22
2
  const s = Object.entries(callbacks).map(([id, fn]) => {
23
3
  return `${id} : ${fn.length}`;
24
4
  }).join(' ');
25
5
  console.log(s);
26
6
  };
27
-
28
- export { logFormCallbacks };
@@ -1,23 +1,3 @@
1
- /*************************************************************************
2
- * ADOBE CONFIDENTIAL
3
- * ___________________
4
- *
5
- * Copyright 2022 Adobe
6
- * All Rights Reserved.
7
- *
8
- * NOTICE: All information contained herein is, and remains
9
- * the property of Adobe and its suppliers, if any. The intellectual
10
- * and technical concepts contained herein are proprietary to Adobe
11
- * and its suppliers and are protected by all applicable intellectual
12
- * property laws, including trade secret and copyright laws.
13
- * Dissemination of this information or reproduction of this material
14
- * is strictly forbidden unless prior written permission is obtained
15
- * from Adobe.
16
-
17
- * Adobe permits you to use and modify this file solely in accordance with
18
- * the terms of the Adobe license agreement accompanying it.
19
- *************************************************************************/
20
-
21
1
  const objToMap = (o) => new Map(Object.entries(o));
22
2
  const stringViewTypes = objToMap({ 'date': 'date-input', 'data-url': 'file-input', 'binary': 'file-input' });
23
3
  const typeToViewTypes = objToMap({
@@ -29,7 +9,7 @@ const typeToViewTypes = objToMap({
29
9
  'file[]': 'file-input'
30
10
  });
31
11
  const arrayTypes = ['string[]', 'boolean[]', 'number[]', 'array'];
32
- const defaultFieldTypes = (schema) => {
12
+ export const defaultFieldTypes = (schema) => {
33
13
  const type = schema.type || 'string';
34
14
  if ('enum' in schema) {
35
15
  const enums = schema.enum;
@@ -86,8 +66,6 @@ const fieldSchema = (input) => {
86
66
  };
87
67
  }
88
68
  };
89
- const exportDataSchema = (form) => {
69
+ export const exportDataSchema = (form) => {
90
70
  return fieldSchema(form);
91
71
  };
92
-
93
- export { defaultFieldTypes, exportDataSchema };
@@ -2,7 +2,7 @@ import { FieldJson, FieldsetJson, FormJson } from '../types/index.js';
2
2
  export declare const TRANSLATION_TOKEN = "##";
3
3
  export declare const TRANSLATION_ID = "afs:translationIds";
4
4
  export declare const CUSTOM_PROPS_KEY = "properties";
5
- type formElementJson = FieldJson | FieldsetJson | FormJson | any;
5
+ declare type formElementJson = FieldJson | FieldsetJson | FormJson | any;
6
6
  export declare const invalidateTranslation: (input: formElementJson, updates: any) => void;
7
7
  export declare const addTranslationId: (input: formElementJson, additionalTranslationProps?: string[]) => formElementJson;
8
8
  export declare const getOrElse: (input: any, key: string | string[], defaultValue?: any) => any;
@@ -1,28 +1,7 @@
1
- /*************************************************************************
2
- * ADOBE CONFIDENTIAL
3
- * ___________________
4
- *
5
- * Copyright 2022 Adobe
6
- * All Rights Reserved.
7
- *
8
- * NOTICE: All information contained herein is, and remains
9
- * the property of Adobe and its suppliers, if any. The intellectual
10
- * and technical concepts contained herein are proprietary to Adobe
11
- * and its suppliers and are protected by all applicable intellectual
12
- * property laws, including trade secret and copyright laws.
13
- * Dissemination of this information or reproduction of this material
14
- * is strictly forbidden unless prior written permission is obtained
15
- * from Adobe.
16
-
17
- * Adobe permits you to use and modify this file solely in accordance with
18
- * the terms of the Adobe license agreement accompanying it.
19
- *************************************************************************/
20
-
21
- import { translationProps } from '../types/Json.js';
22
-
23
- const TRANSLATION_TOKEN = '##';
24
- const TRANSLATION_ID = 'afs:translationIds';
25
- const CUSTOM_PROPS_KEY = 'properties';
1
+ import { translationProps } from '../types/index.js';
2
+ export const TRANSLATION_TOKEN = '##';
3
+ export const TRANSLATION_ID = 'afs:translationIds';
4
+ export const CUSTOM_PROPS_KEY = 'properties';
26
5
  const defaultBcp47LangTags = [
27
6
  'de-DE',
28
7
  'en-US',
@@ -35,14 +14,14 @@ const defaultBcp47LangTags = [
35
14
  'zh-CN',
36
15
  'zh-TW'
37
16
  ];
38
- const invalidateTranslation = (input, updates) => {
17
+ export const invalidateTranslation = (input, updates) => {
39
18
  translationProps.forEach((prop) => {
40
19
  if (prop in updates && input?.[CUSTOM_PROPS_KEY]?.[TRANSLATION_ID]?.[prop]) {
41
20
  delete input?.[CUSTOM_PROPS_KEY]?.[TRANSLATION_ID]?.[prop];
42
21
  }
43
22
  });
44
23
  };
45
- const addTranslationId = (input, additionalTranslationProps = []) => {
24
+ export const addTranslationId = (input, additionalTranslationProps = []) => {
46
25
  const model = input;
47
26
  const transProps = [...translationProps, ...additionalTranslationProps];
48
27
  _createTranslationId(model, '', transProps);
@@ -105,7 +84,7 @@ const _createTranslationObj = (input, translationObj, translationProps) => {
105
84
  }
106
85
  });
107
86
  };
108
- const getOrElse = (input, key, defaultValue = null) => {
87
+ export const getOrElse = (input, key, defaultValue = null) => {
109
88
  if (!key) {
110
89
  return defaultValue;
111
90
  }
@@ -117,13 +96,13 @@ const getOrElse = (input, key, defaultValue = null) => {
117
96
  }
118
97
  return index == arr.length ? objValue : defaultValue;
119
98
  };
120
- const createTranslationObj = (input, additionalTranslationProps = []) => {
99
+ export const createTranslationObj = (input, additionalTranslationProps = []) => {
121
100
  const obj = {};
122
101
  const transProps = [...translationProps, ...additionalTranslationProps];
123
102
  _createTranslationObj(input, obj, transProps);
124
103
  return obj;
125
104
  };
126
- const createTranslationObject = (input, additionalTranslationProps = [], bcp47LangTags = []) => {
105
+ export const createTranslationObject = (input, additionalTranslationProps = [], bcp47LangTags = []) => {
127
106
  const transProps = [...translationProps, ...additionalTranslationProps];
128
107
  const inputCopy = JSON.parse(JSON.stringify(input));
129
108
  const obj = createTranslationObj(addTranslationId(inputCopy, additionalTranslationProps), transProps);
@@ -134,5 +113,3 @@ const createTranslationObject = (input, additionalTranslationProps = [], bcp47La
134
113
  }
135
114
  return [inputCopy, allLangs];
136
115
  };
137
-
138
- export { CUSTOM_PROPS_KEY, TRANSLATION_ID, TRANSLATION_TOKEN, addTranslationId, createTranslationObj, createTranslationObject, getOrElse, invalidateTranslation };
@@ -1,9 +1,9 @@
1
- type ValidationResult = {
1
+ declare type ValidationResult = {
2
2
  valid: boolean;
3
3
  value: any;
4
4
  };
5
5
  export declare const coerceType: (param: any, type: 'string' | 'number' | 'boolean') => string | number | boolean;
6
- type ValidConstraintsType = {
6
+ declare type ValidConstraintsType = {
7
7
  date: ValidationConstraints[];
8
8
  string: ValidationConstraints[];
9
9
  number: ValidationConstraints[];
@@ -11,8 +11,8 @@ type ValidConstraintsType = {
11
11
  file: ValidationConstraints[];
12
12
  };
13
13
  export declare const ValidConstraints: ValidConstraintsType;
14
- export type ValidationConstraints = 'type' | 'format' | 'minimum' | 'maximum' | 'exclusiveMinimum' | 'exclusiveMaximum' | 'minItems' | 'maxItems' | 'uniqueItems' | 'minLength' | 'maxLength' | 'pattern' | 'required' | 'enum' | 'accept' | 'maxFileSize';
15
- type ConstraintsObject = {
14
+ export declare type ValidationConstraints = 'type' | 'format' | 'minimum' | 'maximum' | 'exclusiveMinimum' | 'exclusiveMaximum' | 'minItems' | 'maxItems' | 'uniqueItems' | 'minLength' | 'maxLength' | 'pattern' | 'required' | 'enum' | 'accept' | 'maxFileSize';
15
+ declare type ConstraintsObject = {
16
16
  [key in ValidationConstraints]: (constraint: any, inputVal: any) => ValidationResult;
17
17
  };
18
18
  export declare const Constraints: ConstraintsObject;