@ja-platform/parser-schema 0.0.0-stage → 9.0.0

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 (96) hide show
  1. package/dist/@types/day/Day.d.ts +48 -0
  2. package/dist/@types/day/utils.d.ts +4 -0
  3. package/dist/@types/expressions/SchemaObjectDisplayExpression.d.ts +17 -0
  4. package/dist/@types/expressions/parseParameterValueProvider.d.ts +5 -0
  5. package/dist/@types/index.d.ts +32 -0
  6. package/dist/@types/schema/ModelIndex.d.ts +19 -0
  7. package/dist/@types/schema/Schema.d.ts +33 -0
  8. package/dist/@types/schema/SchemaError.d.ts +4 -0
  9. package/dist/@types/schema/TypeFactory.d.ts +25 -0
  10. package/dist/@types/schema/fieldMetadata.d.ts +5 -0
  11. package/dist/@types/types/EnumOption.d.ts +13 -0
  12. package/dist/@types/types/Field.d.ts +23 -0
  13. package/dist/@types/types/Param.d.ts +19 -0
  14. package/dist/@types/types/QueryType.d.ts +20 -0
  15. package/dist/@types/types/Relationship.d.ts +24 -0
  16. package/dist/@types/types/SchemaModelType.d.ts +85 -0
  17. package/dist/@types/types/primitives/BooleanType.d.ts +21 -0
  18. package/dist/@types/types/primitives/ChoiceType.d.ts +50 -0
  19. package/dist/@types/types/primitives/DateType.d.ts +14 -0
  20. package/dist/@types/types/primitives/DatetimeType.d.ts +9 -0
  21. package/dist/@types/types/primitives/GeoTrackType.d.ts +5 -0
  22. package/dist/@types/types/primitives/LocationType.d.ts +6 -0
  23. package/dist/@types/types/primitives/MultipleChoiceIntegerType.d.ts +8 -0
  24. package/dist/@types/types/primitives/MultipleChoiceType.d.ts +5 -0
  25. package/dist/@types/types/primitives/PrimitiveTypes.d.ts +52 -0
  26. package/dist/@types/types/primitives/SingleChoiceIntegerType.d.ts +8 -0
  27. package/dist/@types/types/primitives/SingleChoiceType.d.ts +5 -0
  28. package/dist/@types/types/primitives/TextType.d.ts +8 -0
  29. package/dist/@types/types/primitives/attachments/AttachmentType.d.ts +9 -0
  30. package/dist/@types/types/primitives/attachments/PhotoType.d.ts +6 -0
  31. package/dist/@types/types/primitives/attachments/SignatureType.d.ts +6 -0
  32. package/dist/day/Day.js +104 -0
  33. package/dist/day/Day.js.map +1 -0
  34. package/dist/day/utils.js +43 -0
  35. package/dist/day/utils.js.map +1 -0
  36. package/dist/expressions/SchemaObjectDisplayExpression.js +40 -0
  37. package/dist/expressions/SchemaObjectDisplayExpression.js.map +1 -0
  38. package/dist/expressions/parseParameterValueProvider.js +13 -0
  39. package/dist/expressions/parseParameterValueProvider.js.map +1 -0
  40. package/dist/index.js +53 -0
  41. package/dist/index.js.map +1 -0
  42. package/dist/schema/ModelIndex.js +14 -0
  43. package/dist/schema/ModelIndex.js.map +1 -0
  44. package/dist/schema/Schema.js +70 -0
  45. package/dist/schema/Schema.js.map +1 -0
  46. package/dist/schema/SchemaError.js +12 -0
  47. package/dist/schema/SchemaError.js.map +1 -0
  48. package/dist/schema/TypeFactory.js +21 -0
  49. package/dist/schema/TypeFactory.js.map +1 -0
  50. package/dist/schema/fieldMetadata.js +35 -0
  51. package/dist/schema/fieldMetadata.js.map +1 -0
  52. package/dist/tsconfig.tsbuildinfo +1 -0
  53. package/dist/types/EnumOption.js +22 -0
  54. package/dist/types/EnumOption.js.map +1 -0
  55. package/dist/types/Field.js +25 -0
  56. package/dist/types/Field.js.map +1 -0
  57. package/dist/types/Param.js +25 -0
  58. package/dist/types/Param.js.map +1 -0
  59. package/dist/types/QueryType.js +38 -0
  60. package/dist/types/QueryType.js.map +1 -0
  61. package/dist/types/Relationship.js +31 -0
  62. package/dist/types/Relationship.js.map +1 -0
  63. package/dist/types/SchemaModelType.js +130 -0
  64. package/dist/types/SchemaModelType.js.map +1 -0
  65. package/dist/types/primitives/BooleanType.js +9 -0
  66. package/dist/types/primitives/BooleanType.js.map +1 -0
  67. package/dist/types/primitives/ChoiceType.js +86 -0
  68. package/dist/types/primitives/ChoiceType.js.map +1 -0
  69. package/dist/types/primitives/DateType.js +69 -0
  70. package/dist/types/primitives/DateType.js.map +1 -0
  71. package/dist/types/primitives/DatetimeType.js +31 -0
  72. package/dist/types/primitives/DatetimeType.js.map +1 -0
  73. package/dist/types/primitives/GeoTrackType.js +12 -0
  74. package/dist/types/primitives/GeoTrackType.js.map +1 -0
  75. package/dist/types/primitives/LocationType.js +18 -0
  76. package/dist/types/primitives/LocationType.js.map +1 -0
  77. package/dist/types/primitives/MultipleChoiceIntegerType.js +34 -0
  78. package/dist/types/primitives/MultipleChoiceIntegerType.js.map +1 -0
  79. package/dist/types/primitives/MultipleChoiceType.js +12 -0
  80. package/dist/types/primitives/MultipleChoiceType.js.map +1 -0
  81. package/dist/types/primitives/PrimitiveTypes.js +54 -0
  82. package/dist/types/primitives/PrimitiveTypes.js.map +1 -0
  83. package/dist/types/primitives/SingleChoiceIntegerType.js +38 -0
  84. package/dist/types/primitives/SingleChoiceIntegerType.js.map +1 -0
  85. package/dist/types/primitives/SingleChoiceType.js +12 -0
  86. package/dist/types/primitives/SingleChoiceType.js.map +1 -0
  87. package/dist/types/primitives/TextType.js +22 -0
  88. package/dist/types/primitives/TextType.js.map +1 -0
  89. package/dist/types/primitives/attachments/AttachmentType.js +16 -0
  90. package/dist/types/primitives/attachments/AttachmentType.js.map +1 -0
  91. package/dist/types/primitives/attachments/PhotoType.js +16 -0
  92. package/dist/types/primitives/attachments/PhotoType.js.map +1 -0
  93. package/dist/types/primitives/attachments/SignatureType.js +16 -0
  94. package/dist/types/primitives/attachments/SignatureType.js.map +1 -0
  95. package/package.json +35 -3
  96. package/README.md +0 -3
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Day = void 0;
4
+ const utils_1 = require("./utils");
5
+ class Day {
6
+ static today() {
7
+ return new Day();
8
+ }
9
+ static fromUTCDate(date) {
10
+ return new Day(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
11
+ }
12
+ /**
13
+ * Recognize Day objects, including instances from other copies of the package.
14
+ */
15
+ static isDay(obj) {
16
+ return (obj instanceof Day ||
17
+ (obj !== null &&
18
+ typeof obj === 'object' &&
19
+ 'startOfDay' in obj &&
20
+ typeof obj.startOfDay === 'function' &&
21
+ 'endOfDay' in obj &&
22
+ typeof obj.endOfDay === 'function'));
23
+ }
24
+ constructor(...args) {
25
+ if (args.length === 3) {
26
+ this._time = new Date(Date.UTC(args[0], args[1], args[2]));
27
+ }
28
+ else if (args.length === 1 && args[0] instanceof Date) {
29
+ this._time = (0, utils_1.dateFromTime)(args[0]);
30
+ }
31
+ else if (args.length === 1 && Day.isDay(args[0])) {
32
+ this._time = args[0].toDate();
33
+ }
34
+ else if (args.length === 1 && typeof args[0] === 'string') {
35
+ if (!/^\d\d\d\d-\d\d-\d\d/.test(args[0])) {
36
+ throw new Error('Invalid date format');
37
+ }
38
+ this._time = new Date(args[0].substring(0, 10) + 'T00:00Z');
39
+ }
40
+ else if (args.length === 1 && typeof args[0] === 'number') {
41
+ const date = new Date(args[0]);
42
+ if (!(0, utils_1.isPureDate)(date)) {
43
+ throw new Error('Invalid Day');
44
+ }
45
+ this._time = date;
46
+ }
47
+ else if (args.length === 0) {
48
+ this._time = (0, utils_1.dateFromTime)(new Date());
49
+ }
50
+ else {
51
+ throw new Error('Invalid args for Day()');
52
+ }
53
+ }
54
+ /**
55
+ * Return a copy of the date at midnight UTC.
56
+ */
57
+ toDate() {
58
+ return new Date(this._time.getTime());
59
+ }
60
+ toString() {
61
+ return this._time.toISOString().substring(0, 10);
62
+ }
63
+ toJSON() {
64
+ return this.toString();
65
+ }
66
+ toISOString() {
67
+ return this.toString();
68
+ }
69
+ valueOf() {
70
+ return this._time.getTime();
71
+ }
72
+ /**
73
+ * Start of the day in the local timezone.
74
+ */
75
+ startOfDay() {
76
+ return new Date(this.getYear(), this.getMonth(), this.getDay());
77
+ }
78
+ /**
79
+ * End of the day in the local timezone.
80
+ */
81
+ endOfDay() {
82
+ return new Date(this.getYear(), this.getMonth(), this.getDay(), 23, 59, 59, 999);
83
+ }
84
+ getYear() {
85
+ return this._time.getUTCFullYear();
86
+ }
87
+ /**
88
+ * Zero-based month, from 0 (January) to 11 (December).
89
+ */
90
+ getMonth() {
91
+ return this._time.getUTCMonth();
92
+ }
93
+ getDay() {
94
+ return this._time.getUTCDate();
95
+ }
96
+ /**
97
+ * Day of the week, from 0 (Sunday) to 6 (Saturday).
98
+ */
99
+ getDayOfWeek() {
100
+ return this._time.getUTCDay();
101
+ }
102
+ }
103
+ exports.Day = Day;
104
+ //# sourceMappingURL=Day.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Day.js","sourceRoot":"","sources":["../../src/day/Day.ts"],"names":[],"mappings":"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","sourcesContent":["import { dateFromTime, isPureDate } from './utils';\n\nexport class Day {\n private _time: Date;\n\n static today(): Day {\n return new Day();\n }\n\n static fromUTCDate(date: Date): Day {\n return new Day(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());\n }\n\n /**\n * Recognize Day objects, including instances from other copies of the package.\n */\n static isDay(obj: unknown): obj is Day {\n return (\n obj instanceof Day ||\n (obj !== null &&\n typeof obj === 'object' &&\n 'startOfDay' in obj &&\n typeof obj.startOfDay === 'function' &&\n 'endOfDay' in obj &&\n typeof obj.endOfDay === 'function')\n );\n }\n\n /**\n * Today in the local timezone.\n */\n constructor();\n /**\n * Construct from a local Date, another Day, a date string, or a UTC midnight timestamp.\n * Date strings use their leading YYYY-MM-DD portion without timezone conversion.\n */\n constructor(date: Date | Day | string | number);\n /**\n * Construct from a year, zero-based month and day of month.\n */\n constructor(year: number, month: number, day: number);\n constructor(...args: [] | [Date | Day | string | number] | [number, number, number]) {\n if (args.length === 3) {\n this._time = new Date(Date.UTC(args[0], args[1], args[2]));\n } else if (args.length === 1 && args[0] instanceof Date) {\n this._time = dateFromTime(args[0]);\n } else if (args.length === 1 && Day.isDay(args[0])) {\n this._time = args[0].toDate();\n } else if (args.length === 1 && typeof args[0] === 'string') {\n if (!/^\\d\\d\\d\\d-\\d\\d-\\d\\d/.test(args[0])) {\n throw new Error('Invalid date format');\n }\n this._time = new Date(args[0].substring(0, 10) + 'T00:00Z');\n } else if (args.length === 1 && typeof args[0] === 'number') {\n const date = new Date(args[0]);\n if (!isPureDate(date)) {\n throw new Error('Invalid Day');\n }\n this._time = date;\n } else if (args.length === 0) {\n this._time = dateFromTime(new Date());\n } else {\n throw new Error('Invalid args for Day()');\n }\n }\n\n /**\n * Return a copy of the date at midnight UTC.\n */\n toDate(): Date {\n return new Date(this._time.getTime());\n }\n\n toString(): string {\n return this._time.toISOString().substring(0, 10);\n }\n\n toJSON(): string {\n return this.toString();\n }\n\n toISOString(): string {\n return this.toString();\n }\n\n valueOf(): number {\n return this._time.getTime();\n }\n\n /**\n * Start of the day in the local timezone.\n */\n startOfDay(): Date {\n return new Date(this.getYear(), this.getMonth(), this.getDay());\n }\n\n /**\n * End of the day in the local timezone.\n */\n endOfDay(): Date {\n return new Date(this.getYear(), this.getMonth(), this.getDay(), 23, 59, 59, 999);\n }\n\n getYear(): number {\n return this._time.getUTCFullYear();\n }\n\n /**\n * Zero-based month, from 0 (January) to 11 (December).\n */\n getMonth(): number {\n return this._time.getUTCMonth();\n }\n\n getDay(): number {\n return this._time.getUTCDate();\n }\n\n /**\n * Day of the week, from 0 (Sunday) to 6 (Saturday).\n */\n getDayOfWeek(): number {\n return this._time.getUTCDay();\n }\n}\n"]}
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ // # date module
3
+ // Date/time utility functions
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ exports.dateFromTime = dateFromTime;
6
+ exports.pureDate = pureDate;
7
+ exports.isPureDate = isPureDate;
8
+ exports.parseDateTime = parseDateTime;
9
+ // Take a time in the local timezone, and the date portion as a pure UTC date.
10
+ function dateFromTime(time) {
11
+ return new Date(Date.UTC(time.getFullYear(), time.getMonth(), time.getDate()));
12
+ }
13
+ // If it is already a pure date, return it.
14
+ // Otherwise, make it a pure date.
15
+ function pureDate(time) {
16
+ if (isPureDate(time)) {
17
+ return time;
18
+ }
19
+ else {
20
+ return dateFromTime(time);
21
+ }
22
+ }
23
+ function isPureDate(date) {
24
+ return (date.getUTCHours() === 0 &&
25
+ date.getUTCMinutes() === 0 &&
26
+ date.getUTCSeconds() === 0 &&
27
+ date.getUTCMilliseconds() === 0);
28
+ }
29
+ function parseDateTime(value) {
30
+ if (typeof value == 'string') {
31
+ const parsed = Date.parse(value);
32
+ if (isNaN(parsed)) {
33
+ return null;
34
+ }
35
+ else {
36
+ return new Date(parsed);
37
+ }
38
+ }
39
+ else {
40
+ return null;
41
+ }
42
+ }
43
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/day/utils.ts"],"names":[],"mappings":";AAAA,gBAAgB;AAChB,8BAA8B;;;;;;AAE9B,8EAA8E;AAC9E,sBAA6B,IAAU;IACrC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AACjF,CAAC;AAED,2CAA2C;AAC3C,kCAAkC;AAClC,kBAAyB,IAAU;IACjC,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;SAAM,CAAC;QACN,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC;AAED,oBAA2B,IAAU;IACnC,OAAO,CACL,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC;QACxB,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC;QAC1B,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC;QAC1B,IAAI,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAChC,CAAC;AACJ,CAAC;AAED,uBAA8B,KAAK;IACjC,IAAI,OAAO,KAAK,IAAI,QAAQ,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QACjC,IAAI,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;YAClB,OAAO,IAAI,CAAC;QACd,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC","sourcesContent":["// # date module\n// Date/time utility functions\n\n// Take a time in the local timezone, and the date portion as a pure UTC date.\nexport function dateFromTime(time: Date) {\n return new Date(Date.UTC(time.getFullYear(), time.getMonth(), time.getDate()));\n}\n\n// If it is already a pure date, return it.\n// Otherwise, make it a pure date.\nexport function pureDate(time: Date) {\n if (isPureDate(time)) {\n return time;\n } else {\n return dateFromTime(time);\n }\n}\n\nexport function isPureDate(date: Date) {\n return (\n date.getUTCHours() === 0 &&\n date.getUTCMinutes() === 0 &&\n date.getUTCSeconds() === 0 &&\n date.getUTCMilliseconds() === 0\n );\n}\n\nexport function parseDateTime(value): Date | null {\n if (typeof value == 'string') {\n const parsed = Date.parse(value);\n if (isNaN(parsed)) {\n return null;\n } else {\n return new Date(parsed);\n }\n } else {\n return null;\n }\n}\n"]}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SchemaObjectDisplayExpressionParser = exports.SchemaObjectDisplayExpression = void 0;
4
+ const parser_expressions_1 = require("@ja-platform/parser-expressions");
5
+ /**
6
+ * Schema object display text containing only references and formatted references.
7
+ */
8
+ class SchemaObjectDisplayExpression extends parser_expressions_1.AbstractFormatExpression {
9
+ static parse(source, start = 0) {
10
+ return new SchemaObjectDisplayExpressionParser().parse(source, start);
11
+ }
12
+ constructor(options) {
13
+ super(SchemaObjectDisplayExpression.TYPE, options);
14
+ }
15
+ isValid() {
16
+ return super.isValid() && this.parameters.every((parameter) => parameter instanceof parser_expressions_1.ShorthandExpression);
17
+ }
18
+ getParser() {
19
+ return new SchemaObjectDisplayExpressionParser();
20
+ }
21
+ }
22
+ exports.SchemaObjectDisplayExpression = SchemaObjectDisplayExpression;
23
+ SchemaObjectDisplayExpression.TYPE = 'schema-object-display';
24
+ class SchemaObjectDisplayExpressionParser extends parser_expressions_1.AbstractFormatExpressionParser {
25
+ constructor() {
26
+ super(...arguments);
27
+ this.placeholders = new parser_expressions_1.CombinedParser([
28
+ new parser_expressions_1.FormatShorthandExpressionParser(),
29
+ new parser_expressions_1.ShorthandExpressionParser()
30
+ ]);
31
+ }
32
+ parsePlaceholder(source, start) {
33
+ return this.placeholders.parse(source, start);
34
+ }
35
+ createExpression(options) {
36
+ return new SchemaObjectDisplayExpression(options);
37
+ }
38
+ }
39
+ exports.SchemaObjectDisplayExpressionParser = SchemaObjectDisplayExpressionParser;
40
+ //# sourceMappingURL=SchemaObjectDisplayExpression.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaObjectDisplayExpression.js","sourceRoot":"","sources":["../../src/expressions/SchemaObjectDisplayExpression.ts"],"names":[],"mappings":";;;AAAA,wEAOyC;AAGzC;;GAEG;AACH,mCAA2C,SAAQ,6CAGlD;IAGC,MAAM,CAAC,KAAK,CAAC,MAAwB,EAAE,KAAK,GAAG,CAAC;QAC9C,OAAO,IAAI,mCAAmC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACxE,CAAC;IAED,YAAY,OAA6D;QACvE,KAAK,CAAC,6BAA6B,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACrD,CAAC;IAED,OAAO;QACL,OAAO,KAAK,CAAC,OAAO,EAAE,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,YAAY,wCAAmB,CAAC,CAAC;IAC3G,CAAC;IAES,SAAS;QACjB,OAAO,IAAI,mCAAmC,EAAE,CAAC;IACnD,CAAC;CACF;;AAjBiB,kCAAI,GAAG,uBAAuB,CAAC;AAmBjD,yCAAiD,SAAQ,mDAGxD;IAHD;;QAImB,iBAAY,GAAG,IAAI,mCAAc,CAAsB;YACtE,IAAI,oDAA+B,EAAE;YACrC,IAAI,8CAAyB,EAAE;SAChC,CAAC,CAAC;IASL,CAAC;IAPW,gBAAgB,CAAC,MAAwB,EAAE,KAAa;QAChE,OAAO,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC;IAES,gBAAgB,CAAC,OAA6D;QACtF,OAAO,IAAI,6BAA6B,CAAC,OAAO,CAAC,CAAC;IACpD,CAAC;CACF","sourcesContent":["import {\n AbstractFormatExpression,\n AbstractFormatExpressionParser,\n CombinedParser,\n FormatShorthandExpressionParser,\n ShorthandExpression,\n ShorthandExpressionParser\n} from '@ja-platform/parser-expressions';\nimport type { AbstractFormatExpressionOptions, ExpressionSource } from '@ja-platform/parser-expressions';\n\n/**\n * Schema object display text containing only references and formatted references.\n */\nexport class SchemaObjectDisplayExpression extends AbstractFormatExpression<\n SchemaObjectDisplayExpression,\n ShorthandExpression\n> {\n static readonly TYPE = 'schema-object-display';\n\n static parse(source: ExpressionSource, start = 0): SchemaObjectDisplayExpression {\n return new SchemaObjectDisplayExpressionParser().parse(source, start);\n }\n\n constructor(options: AbstractFormatExpressionOptions<ShorthandExpression>) {\n super(SchemaObjectDisplayExpression.TYPE, options);\n }\n\n isValid(): boolean {\n return super.isValid() && this.parameters.every((parameter) => parameter instanceof ShorthandExpression);\n }\n\n protected getParser(): SchemaObjectDisplayExpressionParser {\n return new SchemaObjectDisplayExpressionParser();\n }\n}\n\nexport class SchemaObjectDisplayExpressionParser extends AbstractFormatExpressionParser<\n SchemaObjectDisplayExpression,\n ShorthandExpression\n> {\n private readonly placeholders = new CombinedParser<ShorthandExpression>([\n new FormatShorthandExpressionParser(),\n new ShorthandExpressionParser()\n ]);\n\n protected parsePlaceholder(source: ExpressionSource, start: number) {\n return this.placeholders.parse(source, start);\n }\n\n protected createExpression(options: AbstractFormatExpressionOptions<ShorthandExpression>) {\n return new SchemaObjectDisplayExpression(options);\n }\n}\n"]}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseParameterValueProvider = parseParameterValueProvider;
4
+ const parser_expressions_1 = require("@ja-platform/parser-expressions");
5
+ /**
6
+ * Normalize serialized parameter providers once at the schema boundary.
7
+ */
8
+ function parseParameterValueProvider(source) {
9
+ const code = source.trim().replace(/^\$:/, '');
10
+ const call = /^[\w$]+(?:\.[\w$]+)*$/.test(code) ? `${code}()` : code;
11
+ return parser_expressions_1.FunctionExpression.parse(`${parser_expressions_1.FUNCTION_PREFIX}${call}`);
12
+ }
13
+ //# sourceMappingURL=parseParameterValueProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseParameterValueProvider.js","sourceRoot":"","sources":["../../src/expressions/parseParameterValueProvider.ts"],"names":[],"mappings":";;;AAAA,wEAAsF;AAEtF;;GAEG;AACH,qCAA4C,MAAc;IACxD,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC/C,MAAM,IAAI,GAAG,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IACrE,OAAO,uCAAkB,CAAC,KAAK,CAAC,GAAG,oCAAe,GAAG,IAAI,EAAE,CAAC,CAAC;AAC/D,CAAC","sourcesContent":["import { FunctionExpression, FUNCTION_PREFIX } from '@ja-platform/parser-expressions';\n\n/**\n * Normalize serialized parameter providers once at the schema boundary.\n */\nexport function parseParameterValueProvider(source: string): FunctionExpression {\n const code = source.trim().replace(/^\\$:/, '');\n const call = /^[\\w$]+(?:\\.[\\w$]+)*$/.test(code) ? `${code}()` : code;\n return FunctionExpression.parse(`${FUNCTION_PREFIX}${call}`);\n}\n"]}
package/dist/index.js ADDED
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ArrayType = exports.NumberType = exports.IntegerType = void 0;
18
+ __exportStar(require("./schema/Schema"), exports);
19
+ __exportStar(require("./schema/SchemaError"), exports);
20
+ __exportStar(require("./schema/TypeFactory"), exports);
21
+ __exportStar(require("./types/EnumOption"), exports);
22
+ __exportStar(require("./types/Field"), exports);
23
+ __exportStar(require("./types/Param"), exports);
24
+ __exportStar(require("./types/SchemaModelType"), exports);
25
+ __exportStar(require("./types/Relationship"), exports);
26
+ __exportStar(require("./types/primitives/PrimitiveTypes"), exports);
27
+ __exportStar(require("./types/primitives/BooleanType"), exports);
28
+ __exportStar(require("./types/primitives/DateType"), exports);
29
+ __exportStar(require("./types/primitives/DatetimeType"), exports);
30
+ var parser_type_system_1 = require("@ja-platform/parser-type-system");
31
+ Object.defineProperty(exports, "IntegerType", { enumerable: true, get: function () { return parser_type_system_1.IntegerType; } });
32
+ Object.defineProperty(exports, "NumberType", { enumerable: true, get: function () { return parser_type_system_1.NumberType; } });
33
+ __exportStar(require("./types/primitives/TextType"), exports);
34
+ __exportStar(require("./types/primitives/LocationType"), exports);
35
+ __exportStar(require("./types/primitives/GeoTrackType"), exports);
36
+ __exportStar(require("./types/primitives/ChoiceType"), exports);
37
+ __exportStar(require("./types/primitives/MultipleChoiceType"), exports);
38
+ __exportStar(require("./types/primitives/MultipleChoiceIntegerType"), exports);
39
+ __exportStar(require("./types/primitives/SingleChoiceType"), exports);
40
+ __exportStar(require("./types/primitives/SingleChoiceIntegerType"), exports);
41
+ __exportStar(require("./types/primitives/attachments/AttachmentType"), exports);
42
+ __exportStar(require("./types/primitives/attachments/PhotoType"), exports);
43
+ __exportStar(require("./types/primitives/attachments/SignatureType"), exports);
44
+ var parser_type_system_2 = require("@ja-platform/parser-type-system");
45
+ Object.defineProperty(exports, "ArrayType", { enumerable: true, get: function () { return parser_type_system_2.ArrayType; } });
46
+ __exportStar(require("./types/QueryType"), exports);
47
+ __exportStar(require("./expressions/SchemaObjectDisplayExpression"), exports);
48
+ __exportStar(require("./day/Day"), exports);
49
+ __exportStar(require("./day/utils"), exports);
50
+ __exportStar(require("./schema/ModelIndex"), exports);
51
+ __exportStar(require("./schema/fieldMetadata"), exports);
52
+ __exportStar(require("./expressions/parseParameterValueProvider"), exports);
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,uDAAqC;AAErC,uDAAqC;AAErC,qDAAmC;AACnC,gDAA8B;AAC9B,gDAA8B;AAC9B,0DAAwC;AACxC,uDAAqC;AAErC,oEAAkD;AAClD,iEAA+C;AAC/C,8DAA4C;AAC5C,kEAAgD;AAChD,sEAA0E;AAAjE,iHAAA,WAAW,OAAA;AAAE,gHAAA,UAAU,OAAA;AAChC,8DAA4C;AAC5C,kEAAgD;AAChD,kEAAgD;AAChD,gEAA8C;AAC9C,wEAAsD;AACtD,+EAA6D;AAC7D,sEAAoD;AACpD,6EAA2D;AAC3D,gFAA8D;AAC9D,2EAAyD;AACzD,+EAA6D;AAE7D,sEAA4D;AAAnD,+GAAA,SAAS,OAAA;AAClB,oDAAkC;AAElC,8EAA4D;AAE5D,4CAA0B;AAC1B,8CAA4B;AAE5B,sDAAoC;AACpC,yDAAuC;AACvC,4EAA0D","sourcesContent":["export * from './schema/Schema';\nexport * from './schema/SchemaError';\n\nexport * from './schema/TypeFactory';\n\nexport * from './types/EnumOption';\nexport * from './types/Field';\nexport * from './types/Param';\nexport * from './types/SchemaModelType';\nexport * from './types/Relationship';\n\nexport * from './types/primitives/PrimitiveTypes';\nexport * from './types/primitives/BooleanType';\nexport * from './types/primitives/DateType';\nexport * from './types/primitives/DatetimeType';\nexport { IntegerType, NumberType } from '@ja-platform/parser-type-system';\nexport * from './types/primitives/TextType';\nexport * from './types/primitives/LocationType';\nexport * from './types/primitives/GeoTrackType';\nexport * from './types/primitives/ChoiceType';\nexport * from './types/primitives/MultipleChoiceType';\nexport * from './types/primitives/MultipleChoiceIntegerType';\nexport * from './types/primitives/SingleChoiceType';\nexport * from './types/primitives/SingleChoiceIntegerType';\nexport * from './types/primitives/attachments/AttachmentType';\nexport * from './types/primitives/attachments/PhotoType';\nexport * from './types/primitives/attachments/SignatureType';\n\nexport { ArrayType } from '@ja-platform/parser-type-system';\nexport * from './types/QueryType';\n\nexport * from './expressions/SchemaObjectDisplayExpression';\n\nexport * from './day/Day';\nexport * from './day/utils';\n\nexport * from './schema/ModelIndex';\nexport * from './schema/fieldMetadata';\nexport * from './expressions/parseParameterValueProvider';\n"]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IndexDatabase = exports.IndexDirection = void 0;
4
+ var IndexDirection;
5
+ (function (IndexDirection) {
6
+ IndexDirection[IndexDirection["ASCENDING"] = 1] = "ASCENDING";
7
+ IndexDirection[IndexDirection["DESCENDING"] = -1] = "DESCENDING";
8
+ })(IndexDirection || (exports.IndexDirection = IndexDirection = {}));
9
+ var IndexDatabase;
10
+ (function (IndexDatabase) {
11
+ IndexDatabase["CLOUD"] = "cloud";
12
+ IndexDatabase["APP"] = "app";
13
+ })(IndexDatabase || (exports.IndexDatabase = IndexDatabase = {}));
14
+ //# sourceMappingURL=ModelIndex.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModelIndex.js","sourceRoot":"","sources":["../../src/schema/ModelIndex.ts"],"names":[],"mappings":";;;AAAA,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,6DAAa,CAAA;IACb,gEAAe,CAAA;AACjB,CAAC,EAHW,cAAc,aAAd,cAAc,GAAd,cAAc,QAGzB;AAED,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,gCAAe,CAAA;IACf,4BAAW,CAAA;AACb,CAAC,EAHW,aAAa,aAAb,aAAa,GAAb,aAAa,QAGxB","sourcesContent":["export enum IndexDirection {\n ASCENDING = 1,\n DESCENDING = -1\n}\n\nexport enum IndexDatabase {\n CLOUD = 'cloud',\n APP = 'app'\n}\n\nexport interface ModelIndexKey {\n field: string;\n dir: IndexDirection;\n}\n\nexport interface ModelIndex {\n name: string;\n /** @deprecated Use `keys` instead. */\n on: string[];\n keys: ModelIndexKey[];\n databases: IndexDatabase[];\n}\n"]}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Schema = void 0;
4
+ const Param_1 = require("../types/Param");
5
+ const Field_1 = require("../types/Field");
6
+ const Relationship_1 = require("../types/Relationship");
7
+ const SchemaModelType_1 = require("../types/SchemaModelType");
8
+ const PrimitiveTypes_1 = require("../types/primitives/PrimitiveTypes");
9
+ const TypeFactory_1 = require("./TypeFactory");
10
+ class Schema {
11
+ /**
12
+ * Create an empty resolved schema, independently of its input format.
13
+ */
14
+ constructor() {
15
+ this.typeFactories = {};
16
+ this.objects = {};
17
+ this.registerTypeFactory(new Field_1.FieldFactory());
18
+ this.registerTypeFactory(new Param_1.ParamFactory());
19
+ this.registerTypeFactory(new SchemaModelType_1.SchemaModelTypeFactory());
20
+ this.registerTypeFactory(new Relationship_1.RelationshipTypeFactory());
21
+ // Register all the primitive types
22
+ for (const primitiveName of Object.keys(PrimitiveTypes_1.PrimitiveTypeMap)) {
23
+ this.registerTypeFactory(new TypeFactory_1.PrimitiveTypeFactory(primitiveName));
24
+ }
25
+ }
26
+ registerTypeFactory(factory) {
27
+ this.typeFactories[factory.name] = factory;
28
+ }
29
+ getFactory(name) {
30
+ return this.typeFactories[name];
31
+ }
32
+ field(name, type) {
33
+ const _type = typeof type === 'string' ? this.getType(type) : type;
34
+ return this.getFactory(Field_1.Field.TYPE).generate({ schema: this, name, type: _type });
35
+ }
36
+ param(name, type) {
37
+ const _type = typeof type === 'string' ? this.getType(type) : type;
38
+ return this.getFactory(Param_1.Param.TYPE).generate({ schema: this, name, type: _type });
39
+ }
40
+ newObjectType(name) {
41
+ return this.getFactory(SchemaModelType_1.SchemaModelType.TYPE).generate({ schema: this, name });
42
+ }
43
+ newRelationship() {
44
+ return this.getFactory(Relationship_1.Relationship.TYPE).generate({ schema: this });
45
+ }
46
+ // Given a type name, return the specified type. Returns `undefined` if the type is not found.
47
+ // The type name may refer to a primitive, or an object type defined in the schema.
48
+ getType(typeName) {
49
+ if (typeName in PrimitiveTypes_1.PrimitiveTypeMap) {
50
+ // primitive
51
+ return this.primitive(typeName);
52
+ }
53
+ // not a primitive - most likely an object
54
+ return this.objects[typeName];
55
+ }
56
+ primitive(name) {
57
+ if (!(name in PrimitiveTypes_1.PrimitiveTypeMap)) {
58
+ return null;
59
+ }
60
+ const factory = this.getFactory(name);
61
+ if (factory) {
62
+ return factory.generate({ schema: this });
63
+ }
64
+ else {
65
+ return null;
66
+ }
67
+ }
68
+ }
69
+ exports.Schema = Schema;
70
+ //# sourceMappingURL=Schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../src/schema/Schema.ts"],"names":[],"mappings":"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","sourcesContent":["import { Param, ParamFactory } from '../types/Param';\nimport { Field, FieldFactory } from '../types/Field';\nimport { Relationship, RelationshipTypeFactory } from '../types/Relationship';\nimport { SchemaModelType, SchemaModelTypeFactory } from '../types/SchemaModelType';\nimport { Type } from '@ja-platform/parser-type-system';\nimport { PrimitiveTypeMap, PrimitiveTypeName } from '../types/primitives/PrimitiveTypes';\nimport { PrimitiveTypeFactory, TypeFactory } from './TypeFactory';\n\nexport type InferGetType<\n T extends string | PrimitiveTypeName,\n MAP extends { [key in PrimitiveTypeName]: new (...args: any[]) => Type } = PrimitiveTypeMap,\n Model extends SchemaModelType = SchemaModelType\n> = T extends PrimitiveTypeName ? InstanceType<MAP[T]> : Model;\n\nexport class Schema {\n typeFactories: { [key: string]: TypeFactory } = {};\n\n objects: { [index: string]: SchemaModelType };\n\n /**\n * Create an empty resolved schema, independently of its input format.\n */\n constructor() {\n this.objects = {};\n\n this.registerTypeFactory(new FieldFactory());\n this.registerTypeFactory(new ParamFactory());\n this.registerTypeFactory(new SchemaModelTypeFactory());\n this.registerTypeFactory(new RelationshipTypeFactory());\n\n // Register all the primitive types\n for (const primitiveName of Object.keys(PrimitiveTypeMap)) {\n this.registerTypeFactory(new PrimitiveTypeFactory(primitiveName as PrimitiveTypeName));\n }\n }\n\n registerTypeFactory(factory: TypeFactory) {\n this.typeFactories[factory.name] = factory;\n }\n\n getFactory(name: string) {\n return this.typeFactories[name];\n }\n\n /** Helper function to assist in creating variables */\n field<T extends Type = Type>(name?: string, type?: string): Field<T>;\n field<T extends Type = Type>(name?: string, type?: T): Field<T>;\n field<T extends Type = Type>(name?: string, type?: T | string): Field<T> {\n const _type = typeof type === 'string' ? this.getType(type) : type;\n return this.getFactory(Field.TYPE).generate<T>({ schema: this, name, type: _type });\n }\n\n param<T extends Type = Type>(name?: string, type?: string): Param<T>;\n param<T extends Type = Type>(name?: string, type?: T): Param<T>;\n param<T extends Type = Type>(name?: string, type?: T | string): Param<T> {\n const _type = typeof type === 'string' ? this.getType(type) : type;\n return this.getFactory(Param.TYPE).generate<T>({ schema: this, name, type: _type });\n }\n\n newObjectType(name?: string) {\n return this.getFactory(SchemaModelType.TYPE).generate({ schema: this, name }) as SchemaModelType;\n }\n\n newRelationship() {\n return this.getFactory(Relationship.TYPE).generate({ schema: this }) as Relationship;\n }\n\n // Given a type name, return the specified type. Returns `undefined` if the type is not found.\n // The type name may refer to a primitive, or an object type defined in the schema.\n getType<T extends string | PrimitiveTypeName>(typeName: T): InferGetType<T> {\n if (typeName in PrimitiveTypeMap) {\n // primitive\n return this.primitive(typeName);\n }\n // not a primitive - most likely an object\n return this.objects[typeName] as InferGetType<T>;\n }\n\n primitive<T extends string | PrimitiveTypeName>(name: T): InferGetType<T> {\n if (!(name in PrimitiveTypeMap)) {\n return null;\n }\n const factory = this.getFactory(name);\n if (factory) {\n return factory.generate({ schema: this });\n } else {\n return null;\n }\n }\n}\n"]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SchemaError = void 0;
4
+ class SchemaError extends Error {
5
+ constructor(message, attribute) {
6
+ super(message);
7
+ this.attribute = attribute;
8
+ this.name = 'SchemaError';
9
+ }
10
+ }
11
+ exports.SchemaError = SchemaError;
12
+ //# sourceMappingURL=SchemaError.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SchemaError.js","sourceRoot":"","sources":["../../src/schema/SchemaError.ts"],"names":[],"mappings":";;;AAAA,iBAAyB,SAAQ,KAAK;IACpC,YACE,OAAe,EACN,SAAiB;QAE1B,KAAK,CAAC,OAAO,CAAC,CAAC;yBAFN,SAAS;QAGlB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;IAC5B,CAAC;CACF","sourcesContent":["export class SchemaError extends Error {\n constructor(\n message: string,\n readonly attribute: string\n ) {\n super(message);\n this.name = 'SchemaError';\n }\n}\n"]}
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PrimitiveTypeFactory = exports.AbstractObjectTypeFactory = void 0;
4
+ const PrimitiveTypes_1 = require("../types/primitives/PrimitiveTypes");
5
+ class AbstractObjectTypeFactory {
6
+ constructor(name) {
7
+ this.name = name;
8
+ }
9
+ }
10
+ exports.AbstractObjectTypeFactory = AbstractObjectTypeFactory;
11
+ class PrimitiveTypeFactory {
12
+ constructor(name) {
13
+ this.name = name;
14
+ }
15
+ generate(event) {
16
+ const instance = new PrimitiveTypes_1.PrimitiveTypeMap[this.name]();
17
+ return instance;
18
+ }
19
+ }
20
+ exports.PrimitiveTypeFactory = PrimitiveTypeFactory;
21
+ //# sourceMappingURL=TypeFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypeFactory.js","sourceRoot":"","sources":["../../src/schema/TypeFactory.ts"],"names":[],"mappings":";;;AAEA,uEAAgH;AAmBhH;IAME,YAAY,IAAoB;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CAGF;;AAED;IAKE,YAAY,IAAuB;QACjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IACD,QAAQ,CAAC,KAAQ;QACf,MAAM,QAAQ,GAAG,IAAI,iCAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACnD,OAAO,QAAa,CAAC;IACvB,CAAC;CACF","sourcesContent":["import { SchemaModelType } from '../types/SchemaModelType';\nimport { Param } from '../types/Param';\nimport { PrimitiveTypeInstance, PrimitiveTypeMap, PrimitiveTypeName } from '../types/primitives/PrimitiveTypes';\nimport { Relationship } from '../types/Relationship';\nimport { Field } from '../types/Field';\nimport { Schema } from './Schema';\n\nexport interface TypeFactory<NAME extends string = string> {\n name: NAME;\n generate: <T>(event?: any) => any;\n}\n\nexport interface GenerateTypeEvent {\n schema: Schema;\n}\n\nexport type ObjectTypeInstance = Field<any> | Param | SchemaModelType | Relationship;\n\nexport type ObjectTypeName =\n typeof Param.TYPE | typeof Field.TYPE | typeof SchemaModelType.TYPE | typeof Relationship.TYPE;\n\nexport abstract class AbstractObjectTypeFactory<\n R extends ObjectTypeInstance = ObjectTypeInstance,\n E extends GenerateTypeEvent = GenerateTypeEvent\n> implements TypeFactory<ObjectTypeName> {\n name: ObjectTypeName;\n\n constructor(name: ObjectTypeName) {\n this.name = name;\n }\n\n abstract generate<T>(event: E): R;\n}\n\nexport class PrimitiveTypeFactory<\n T extends PrimitiveTypeInstance,\n E extends GenerateTypeEvent = GenerateTypeEvent\n> implements TypeFactory<PrimitiveTypeName> {\n name: PrimitiveTypeName;\n constructor(name: PrimitiveTypeName) {\n this.name = name;\n }\n generate(event: E): T {\n const instance = new PrimitiveTypeMap[this.name]();\n return instance as T;\n }\n}\n"]}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TEXT_SUBTYPES = exports.textSubtypeSpecs = exports.ATTACHMENT_MEDIA_TYPES = void 0;
4
+ exports.ATTACHMENT_MEDIA_TYPES = [
5
+ 'image/png',
6
+ 'image/jpeg',
7
+ 'image/svg+xml',
8
+ 'application/pdf',
9
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
10
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
11
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
12
+ 'application/vnd.ms-excel',
13
+ 'application/msword',
14
+ 'application/vnd.anritsu',
15
+ 'application/vnd.valvelink',
16
+ 'application/xml',
17
+ 'text/plain',
18
+ 'text/csv',
19
+ 'any'
20
+ ];
21
+ exports.textSubtypeSpecs = {
22
+ email: 'text.email',
23
+ address: 'text.address',
24
+ name: 'text.name',
25
+ url: 'text.url',
26
+ paragraph: 'text.paragraph',
27
+ 'signed-number': 'number',
28
+ number: 'number',
29
+ 'south-african-id': 'number.za_id',
30
+ 'phone-number': 'phone',
31
+ 'decimal-number': 'decimal',
32
+ password: 'password'
33
+ };
34
+ exports.TEXT_SUBTYPES = Object.keys(exports.textSubtypeSpecs);
35
+ //# sourceMappingURL=fieldMetadata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fieldMetadata.js","sourceRoot":"","sources":["../../src/schema/fieldMetadata.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG;IACpC,WAAW;IACX,YAAY;IACZ,eAAe;IACf,iBAAiB;IACjB,2EAA2E;IAC3E,mEAAmE;IACnE,yEAAyE;IACzE,0BAA0B;IAC1B,oBAAoB;IACpB,yBAAyB;IACzB,2BAA2B;IAC3B,iBAAiB;IACjB,YAAY;IACZ,UAAU;IACV,KAAK;CACN,CAAC;AAEW,QAAA,gBAAgB,GAAgC;IAC3D,KAAK,EAAE,YAAY;IACnB,OAAO,EAAE,cAAc;IACvB,IAAI,EAAE,WAAW;IACjB,GAAG,EAAE,UAAU;IACf,SAAS,EAAE,gBAAgB;IAC3B,eAAe,EAAE,QAAQ;IACzB,MAAM,EAAE,QAAQ;IAChB,kBAAkB,EAAE,cAAc;IAClC,cAAc,EAAE,OAAO;IACvB,gBAAgB,EAAE,SAAS;IAC3B,QAAQ,EAAE,UAAU;CACrB,CAAC;AAEW,QAAA,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,QAAA,gBAAgB,CAAC,CAAC","sourcesContent":["export const ATTACHMENT_MEDIA_TYPES = [\n 'image/png',\n 'image/jpeg',\n 'image/svg+xml',\n 'application/pdf',\n 'application/vnd.openxmlformats-officedocument.presentationml.presentation',\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'application/vnd.ms-excel',\n 'application/msword',\n 'application/vnd.anritsu',\n 'application/vnd.valvelink',\n 'application/xml',\n 'text/plain',\n 'text/csv',\n 'any'\n];\n\nexport const textSubtypeSpecs: { [index: string]: string } = {\n email: 'text.email',\n address: 'text.address',\n name: 'text.name',\n url: 'text.url',\n paragraph: 'text.paragraph',\n 'signed-number': 'number',\n number: 'number',\n 'south-african-id': 'number.za_id',\n 'phone-number': 'phone',\n 'decimal-number': 'decimal',\n password: 'password'\n};\n\nexport const TEXT_SUBTYPES = Object.keys(textSubtypeSpecs);\n"]}
@@ -0,0 +1 @@
1
+ {"version":"7.0.2","root":[[128,146],[148,159]],"packageJsons":["../../../node_modules/.pnpm/@babel+types@8.0.6/node_modules/@babel/types/package.json","../../../node_modules/.pnpm/moment@2.31.0/node_modules/moment/package.json","../../expressions/package.json","../package.json","../../type-system/package.json"],"missingPackageJsons":["../../../node_modules/.pnpm/@babel+types@8.0.6/node_modules/@babel/types/lib/package.json","../../../node_modules/.pnpm/moment@2.31.0/node_modules/moment/ts3.1-typings/package.json"],"fileNames":["lib.es5.d.ts","lib.es2015.d.ts","lib.es2016.d.ts","lib.es2017.d.ts","lib.es2018.d.ts","lib.es2019.d.ts","lib.es2020.d.ts","lib.es2021.d.ts","lib.es2022.d.ts","lib.es2023.d.ts","lib.es2024.d.ts","lib.es2025.d.ts","lib.esnext.d.ts","lib.dom.d.ts","lib.es2015.core.d.ts","lib.es2015.collection.d.ts","lib.es2015.generator.d.ts","lib.es2015.iterable.d.ts","lib.es2015.promise.d.ts","lib.es2015.proxy.d.ts","lib.es2015.reflect.d.ts","lib.es2015.symbol.d.ts","lib.es2015.symbol.wellknown.d.ts","lib.es2016.array.include.d.ts","lib.es2016.intl.d.ts","lib.es2017.arraybuffer.d.ts","lib.es2017.date.d.ts","lib.es2017.object.d.ts","lib.es2017.sharedmemory.d.ts","lib.es2017.string.d.ts","lib.es2017.intl.d.ts","lib.es2017.typedarrays.d.ts","lib.es2018.asyncgenerator.d.ts","lib.es2018.asynciterable.d.ts","lib.es2018.intl.d.ts","lib.es2018.promise.d.ts","lib.es2018.regexp.d.ts","lib.es2019.array.d.ts","lib.es2019.object.d.ts","lib.es2019.string.d.ts","lib.es2019.symbol.d.ts","lib.es2019.intl.d.ts","lib.es2020.bigint.d.ts","lib.es2020.date.d.ts","lib.es2020.promise.d.ts","lib.es2020.sharedmemory.d.ts","lib.es2020.string.d.ts","lib.es2020.symbol.wellknown.d.ts","lib.es2020.intl.d.ts","lib.es2020.number.d.ts","lib.es2021.promise.d.ts","lib.es2021.string.d.ts","lib.es2021.weakref.d.ts","lib.es2021.intl.d.ts","lib.es2022.array.d.ts","lib.es2022.error.d.ts","lib.es2022.intl.d.ts","lib.es2022.object.d.ts","lib.es2022.string.d.ts","lib.es2022.regexp.d.ts","lib.es2023.array.d.ts","lib.es2023.collection.d.ts","lib.es2023.intl.d.ts","lib.es2024.arraybuffer.d.ts","lib.es2024.collection.d.ts","lib.es2024.object.d.ts","lib.es2024.promise.d.ts","lib.es2024.regexp.d.ts","lib.es2024.sharedmemory.d.ts","lib.es2024.string.d.ts","lib.es2025.collection.d.ts","lib.es2025.float16.d.ts","lib.es2025.intl.d.ts","lib.es2025.iterator.d.ts","lib.es2025.promise.d.ts","lib.es2025.regexp.d.ts","lib.esnext.array.d.ts","lib.esnext.collection.d.ts","lib.esnext.date.d.ts","lib.esnext.decorators.d.ts","lib.esnext.disposable.d.ts","lib.esnext.error.d.ts","lib.esnext.intl.d.ts","lib.esnext.sharedmemory.d.ts","lib.esnext.temporal.d.ts","lib.esnext.typedarrays.d.ts","lib.decorators.d.ts","lib.decorators.legacy.d.ts","../../expressions/dist/@types/tokens/AbstractToken.d.ts","../../expressions/dist/@types/tokens/code/CodeToken.d.ts","../../type-system/dist/@types/Formatter.d.ts","../../type-system/dist/@types/Type.d.ts","../../type-system/dist/@types/ObjectType.d.ts","../../type-system/dist/@types/ArrayType.d.ts","../../type-system/dist/@types/UnknownType.d.ts","../../type-system/dist/@types/ScalarType.d.ts","../../type-system/dist/@types/TextType.d.ts","../../type-system/dist/@types/NumberType.d.ts","../../type-system/dist/@types/IntegerType.d.ts","../../type-system/dist/@types/BooleanType.d.ts","../../type-system/dist/@types/index.d.ts","../../expressions/dist/@types/definitions/ValidationContext.d.ts","../../expressions/dist/@types/expressions/AbstractExpression.d.ts","../../expressions/dist/@types/ExpressionParser.d.ts","../../expressions/dist/@types/CombinedParser.d.ts","../../expressions/dist/@types/utils/parserUtils.d.ts","../../expressions/dist/@types/code-parsers/CodeParser.d.ts","../../../node_modules/.pnpm/@babel+types@8.0.6/node_modules/@babel/types/lib/index.d.ts","../../expressions/dist/@types/code-parsers/JavaScriptParser.d.ts","../../expressions/dist/@types/utils/valueFormatting.d.ts","../../expressions/dist/@types/expressions/constant/ConstantExpression.d.ts","../../expressions/dist/@types/tokens/DelimiterToken.d.ts","../../expressions/dist/@types/expressions/ListExpression.d.ts","../../expressions/dist/@types/expressions/EvaluatedExpression.d.ts","../../expressions/dist/@types/expressions/shorthand/ShorthandExpression.d.ts","../../expressions/dist/@types/expressions/shorthand/FormatShorthandExpression.d.ts","../../expressions/dist/@types/expressions/function/FunctionExpression.d.ts","../../expressions/dist/@types/tokens/text/TextToken.d.ts","../../expressions/dist/@types/tokens/text/PlaceholderToken.d.ts","../../expressions/dist/@types/expressions/text/AbstractFormatExpression.d.ts","../../expressions/dist/@types/expressions/text/FormatStringExpression.d.ts","../../expressions/dist/@types/tokens/EnumToken.d.ts","../../expressions/dist/@types/tokens/code/JSToken.d.ts","../../expressions/dist/@types/tokens/code/PrefixToken.d.ts","../../expressions/dist/@types/tokens/code/IdentifierToken.d.ts","../../expressions/dist/@types/utils/tokenUtils.d.ts","../../expressions/dist/@types/index.d.ts","../src/expressions/SchemaObjectDisplayExpression.ts","../src/types/QueryType.ts","../src/types/Field.ts","../src/types/Relationship.ts","../src/schema/SchemaError.ts","../src/schema/ModelIndex.ts","../src/types/primitives/attachments/AttachmentType.ts","../src/types/primitives/TextType.ts","../src/types/EnumOption.ts","../src/types/primitives/ChoiceType.ts","../src/types/primitives/BooleanType.ts","../src/types/primitives/LocationType.ts","../src/types/primitives/GeoTrackType.ts","../src/types/primitives/SingleChoiceType.ts","../src/types/primitives/SingleChoiceIntegerType.ts","../src/types/primitives/MultipleChoiceType.ts","../src/types/primitives/MultipleChoiceIntegerType.ts","../src/day/utils.ts","../src/day/Day.ts","../../../node_modules/.pnpm/moment@2.31.0/node_modules/moment/ts3.1-typings/moment.d.ts","../src/types/primitives/DateType.ts","../src/types/primitives/DatetimeType.ts","../src/types/primitives/attachments/PhotoType.ts","../src/types/primitives/attachments/SignatureType.ts","../src/types/primitives/PrimitiveTypes.ts","../src/types/SchemaModelType.ts","../src/schema/TypeFactory.ts","../src/types/Param.ts","../src/schema/Schema.ts","../src/schema/fieldMetadata.ts","../src/expressions/parseParameterValueProvider.ts","../src/index.ts"],"fileInfos":[{"version":"16934abaab7026ac114da441aabea1a0","affectsGlobalScope":true,"impliedNodeFormat":1},"d4306fb2e47f74835e8674ffac07d76f","e437c5c1302869326c3bb93da85bbbcf","e4324975a566567b21d350615f1fc6ac","333b1b9a2a9ac3b8497dba5c63b5ba50","6cffacd662b6eb5fa7a36aa2ea366bfa","b4c34f9c23304dbef2d23698637ed638","e5cb86a5fc491796ecd1d2dd348d208f","feb6c6fb19cdb246a5d8acb36a6901c7","9443a7f109277ffaa79d893ed2549995","793cee405385076e27c24f409659dccd","09f69c6610266eaee1ac9e3e30df2c71","62bad718844246b8e17547f37bad6085",{"version":"aae8996e8b5684814785a42cbbefcd79","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"926204c28cd3d073865348473ae28d2e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f25e42c801b2cb3cf2b39792006a9beb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6344b55f26a4e81d9608777dbfb877dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3c0ed28e53d3695b363e256ec1c023fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4c2761daba7f17141c25baa0821ac5da","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b87656acabd63e69379ff6ffcfe52fc7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"597469522da047a5af5222cc6989f405","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1708ea4d34dc37fadadc63ca01127e80","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"55d97a8c6fbf34a30450a7b1e5f7a298","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0ee05eb59426d33e374226d8dcfa708b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e347c14030993906efcfbb88915b6a05","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b0231263857c9b6a03641acdc9280ceb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3b15c4a83b598cacb4067676e6f0abed","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b417d97b7934cef63b1889abec0bbfbf","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"09a6cf4032ebba60ce22a501e663f881","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2b056277dd138e8f5650fc04e20eaa8d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"e22cc07e3f3cc242ba52fa3f8ea1fc58","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2c45da767a1bfbb220848df1bc4029e4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b44c3e0fbaf2130cdcf6ac38b120ffa1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b612fb5cf8e5d964b92063a75207632a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"02705151a5e1551b9162a9ed8ab763f7","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"41025e398be9215d32e4337335da8f0b","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"52684c2b1f353a5538e4f275182a54cd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6dedb6a4f90d1df3a6fbe5693e44886c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ca3f36fe3562c07e0f0d71c2bebd3f6d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"409974d6129befbb8226ddd1c6558568","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4d9cfde2a1ae1b4925f1f9bc10848e5d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7e1daecc66dd564144e3bb1a0266b5fd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a8e1d9bb35fd0637f2f9fd2b2a54f2ec","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4f168501772a6543182765bfd5f2fbfe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a19c80aad1b2162103496f5ba293a732","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b69afa63cd5d059851c78adb2856ee09","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ae2fc5d954e9b0f5feee3d481b953c27","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1cfd3091a071d8b6feec15277643bafe","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1da2c1f258970fd3cc91184f69e91a9d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"a0d87491913d843139e0c993650a3235","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4ef72aa378127e7b7abba915b0110b1e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"3ec74c6a7d4463f0254db3a74cf75646","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"84c2bdfa470d075526cce6322d81b0b6","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0b3844c2b8c73e4e1ab91431411cad11","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"4fc71cf4a15b8d99675a31df77f26e07","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d1b49564ddaeca3df5b6dbae925d2242","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6a25be566d60ccfc2d6e8b7bfdeefa83","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8a20e27646985dfd58c57ca6566553dd","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9969f02ad3cdcbf4f709405cda44167f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"9c9be4792a7a4f42c15ae7360bf28779","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"8cf777fe00349b71ee9c4b6f3fe7fd19","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"74f96bc192530c9723f572bfff3d3078","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1df91c56b25955c56387426f378173c5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"38856f70edcd2115c355d96ec77cc09e","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"de8700156c1275465bcd473c28b359aa","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d47cfdb6ede40518357bb5a4cd7cd9fb","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6e5773860cd9e5b15e683113f642ab47","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"30ff5fe1682f7fcd629880476ca3c2e0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"bf23d7d1b40b9015b694ddc2f011752f","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"2cc585d42e2c548f9f24a30a1989fd33","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"713906ce9d332d2242b7f05ed9304be3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"0219894bfe5042c7e1aa2d22e4a91ed0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"6009ffff7e43c93318804d2d28e37fe3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"03be89b227587594fbb50509fc1c2e45","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"b30df52dc24740c0bad7c55c3511df7d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"ab8d3c9b5ed5c2ab8f383607eef439f0","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d950ec671d0a8e07f3c1a31e94abed86","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1abef2ace5eccb02d60dd73cd5a5ee4c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f5f0a3044029d1cc081b5887eb4deb07","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d57c697f1446940ec4bfe669c962e2c4","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"be41035d7b941482a1e1ae6a5c5dcca5","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"10f7d9da7564f27f8ddf4a162b6da6d3","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"1d0520af549e0c3581f15173cc713ca1","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"d65083f97fd741cff028472563eddb79","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"da7f24f00653ebac660ac1c0821ed33d","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"7cb5ae9e65516ea2235f0721f6aac43c","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"f64453cbf9671f28158677fa5c43967a","affectsGlobalScope":true,"impliedNodeFormat":1},{"version":"33f317af5428801f944a478d2c1e38e5","affectsGlobalScope":true,"impliedNodeFormat":1},"510b0b622fafd6eff2bf5d020de046ee","968dbf07ccc13a1a84f319c26e9909b3","e5fb7990b84f5089ba92554ea3614810","770ee32ef332fd48bfef508442b30edb","5c1b5931ee0c894699ca56f5b573f88a","e37fe31d1631404aaee1668c9a2acfdd","89b6053090a8d01f57cb8f521fae777d","26302a8b72d74f944dcf8f6452e54f7c","bc95bdb594a5aece18248fbf4387dd2e","90125a76f2ae701181f7e09dea41f3ad","ac52bb76ccad935a013384d2a71ab267","2c96eeb69afb823580d4e1e5f1b188e0","c06213bcb24cd658dfcd1239777159bd","84519ebe510a4219ef71e5a0a973c591","0c68f6d853b53c3d34189f5c99c4b624","18408a4ba98e42e70324ba5c0b71f379","d6ca1e855d5b6554555a009a40e806a2","92d25cb01f547225fee7d19311179220","e78cf9dc5bca6011a220581f56da19cb",{"version":"3575b2b8e50b5a5b3acce219e08900c5","impliedNodeFormat":99},"25aba7d58ecafcf7098f9bcca63ea72a","90506d77482148f93c56044616613958","c3b9b5f9be217e9fabbfc9f5b48da439","ae63a2414b6a326b93ee65bba693d617","a950824f78fe1cb40eeff5cf89a2245d","cc36a10654ee721a890569de343ee4a0","81bde6b904e09fb337a80f52526d0c49","61b4c95d7a2ba531a5faae6b4e0694f1","be6a700c7b2a3007e5ff5eccccd1e6ca","f25290e9ca5aee09a0210e2a454437f8","cf3121ca4479d3afdaceb690d14cf086","c115de0a80c101e99244da31e79527d1","cabc47d72ba300dd603c14a7bb2b7cde","57845437bcd4011990eb52478f02c4a0","354fc88481ff608fcbbfaf7851a29043","bf6d579deb9596ec514083ea94789be0","3058c9c4ad1200a2ff62094072deed53","d33a7d16b8bb10392237228466f959f8","4678acee57e4a32f080f3a53600abf18",{"version":"f9bd850e5e3a05926dbfc2a68d393e2f","signature":"aa250c74fe5a950a7dea8c41eba97441","impliedNodeFormat":1},{"version":"cbf01ec3f6810a708590801b695aecfe","signature":"821245fb6716a92b8a110ff76e16faeb","impliedNodeFormat":1},{"version":"9738b8419fa63d2761367a93fab3eaca","signature":"e42b7c5c230dedd906cbc7e576efbfe2","impliedNodeFormat":1},{"version":"86282c8b579436311695061f5d465ec1","signature":"c8cddf03dfecaa822330026d82db7da8","impliedNodeFormat":1},{"version":"e8362e5f8156982e5624ad0c933afa07","signature":"51f034a28414596588750aeca1878c98","impliedNodeFormat":1},{"version":"0973156bf9ac211846a3984519c9ff9a","signature":"2d1c84be972f91834168ee8b45ef3260","impliedNodeFormat":1},{"version":"d9ec3b9d0e317b6e05cfca6d17a72c5b","signature":"01d13385ca95028b548f57422632cd10","impliedNodeFormat":1},{"version":"56f99034e7ca1de3f11e3942d42866a0","signature":"e1421b701f3826a978db13ebc309e2db","impliedNodeFormat":1},{"version":"b5f1e4e6e26ff0ce16a892c338a393fc","signature":"c5f116e28ed4d9b893b3bb22615c4a6e","impliedNodeFormat":1},{"version":"dad5f42a38c1be85d7db5bd0e4be98a0","signature":"d2a7a9d26b7a78a458799d08f36040e4","impliedNodeFormat":1},{"version":"4a44098fe761e3d312038c4f38bba8cd","signature":"4fdad46f00f0e8c18ff903eacb5cab67","impliedNodeFormat":1},{"version":"1c62a09292215a4cf95f0d5df0b1508d","signature":"4538c220c4065a35c60d00ac0baa8e76","impliedNodeFormat":1},{"version":"73fe0aa7eb191e1180dca2b3bac48fcd","signature":"363c6b7126845050cea9bd1b53a77a66","impliedNodeFormat":1},{"version":"4d52f2f9aff3960fd8112462c999364c","signature":"0b856f0bab913d03af59d1f4f0f59562","impliedNodeFormat":1},{"version":"0ea802eee8d188d1c8159b0791d10f20","signature":"8264702ad4ee79cdcbea078c3da56f14","impliedNodeFormat":1},{"version":"4bd3004fb92e43c60401993de8f08ec8","signature":"5d7211f45479b46afb44d4d8e573535b","impliedNodeFormat":1},{"version":"76c75ada51f066eceb74736c546e0dc6","signature":"ec0bba0a0909104c137edc876deb700c","impliedNodeFormat":1},{"version":"ecde8511f785827876f35c97838f2217","signature":"df8eef6e7eccf796eb60b204e7fb0f8c","impliedNodeFormat":1},{"version":"caba67378a7405730b0a39465ca15df6","signature":"656f58418f5ca993800324d1e272bf2f","impliedNodeFormat":1},"bdce55db2d0ce77261b470a9b7a64095",{"version":"4184bcd819603715ed5412485b85ab04","signature":"96ee6501eee7a02a19ea7ff1f53d661c","impliedNodeFormat":1},{"version":"37716ac94c7c13750508fe67b1985b58","signature":"d964aada007f95d0dd07460963f68a0c","impliedNodeFormat":1},{"version":"9c3b005269572f68f3d8b496be4581af","signature":"f063601c5b39dd0ae3fe66459e8ccea2","impliedNodeFormat":1},{"version":"3e57bf75e0c5984047078be90b15ac85","signature":"97867d951e0249277164096f5bbadc20","impliedNodeFormat":1},{"version":"bafb9786356e055bbfd633d30727f512","signature":"05ebce4882d0c7d1c066b51e55f93685","impliedNodeFormat":1},{"version":"7982f41c8baa765af159cf756f83b8b9","signature":"37da33245ab4f3fd1011d9b382dcad27","impliedNodeFormat":1},{"version":"efd4e9ab467bfaf61ba44a65a04f68c1","signature":"6030b59fbf00d2b0aecb059c3352c479","impliedNodeFormat":1},{"version":"e3424277ca0424373630e388eb21ca6b","signature":"dcd337aeff86227b569df4951219b6b6","impliedNodeFormat":1},{"version":"ae0a2a9c1a8a7e7d2a9a4366b7ec183a","signature":"a1121cd5843eb7bba687673dfc04b5cb","impliedNodeFormat":1},{"version":"41a174bf469213fd6d56f178c134fff2","signature":"eb7b402991957b09b77be3d8046faa56","impliedNodeFormat":1},{"version":"3365c7d6a19dcfc162cb7fe14c8a16af","signature":"205c6187ac6e4ef53474b4a23ba47e42","impliedNodeFormat":1},{"version":"5d35f969afb09026dbb2d2336fbad9e7","signature":"c50035832d4308e4867baeda73d9b34a","impliedNodeFormat":1}],"fileIdsList":[[89,103,104],[89,103],[107,108],[90,101],[89,102],[89,90,103,104],[89,101,103,104,111,112],[89,101,103,104],[89,90,103,104,114],[89,104,115],[89,90,101,102,103,104],[89,102,103,104,118,119],[89,114,115,120],[89,90,102,103,104,105,106,107,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126],[89],[90,108],[89,90,123],[101],[145],[127],[101,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,148,149,150,151,152,153,154,155,156,157,158],[101,130,131,152,153,154,155],[130,131,152,153,155,156],[101,154],[101,127,130,154],[153,154],[101,128,129,130,131,132,133,135,152,154,156],[101,137],[101,136],[101,145,146,147],[101,147],[101,135],[137],[101,134,135,138,139,140,141,142,143,144,148,149,150,151],[136,137],[134],[92],[92,96],[91],[91,92,93,94,95,96,97,98,99,100]],"options":{"composite":true,"declaration":true,"declarationDir":"./@types","inlineSources":true,"module":199,"outDir":"./","rootDir":"../src","skipLibCheck":true,"strict":false,"stripInternal":true,"sourceMap":true,"target":4,"tsBuildInfoFile":"./tsconfig.tsbuildinfo","esModuleInterop":true},"referencedMap":[[105,1],[104,2],[109,3],[102,4],[103,5],[114,6],[113,7],[111,8],[117,9],[116,10],[115,11],[120,12],[121,13],[127,14],[112,15],[122,15],[90,15],[125,15],[123,16],[124,15],[119,2],[118,15],[106,2],[126,17],[110,18],[146,19],[128,20],[158,20],[159,21],[156,22],[154,23],[130,24],[155,25],[129,18],[131,26],[153,27],[138,28],[137,29],[148,30],[149,31],[140,18],[139,32],[144,33],[143,33],[152,34],[142,35],[141,33],[135,18],[134,18],[150,36],[151,36],[94,37],[100,38],[99,38],[98,38],[93,37],[96,37],[97,38],[92,39],[95,37],[101,40]],"latestChangedDtsFile":"./@types/index.d.ts"}
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnumOption = void 0;
4
+ class EnumOption {
5
+ static isInstanceOf(value) {
6
+ return (value instanceof EnumOption || (typeof value == 'object' && value != null && 'value' in value && 'label' in value));
7
+ }
8
+ constructor(key, label, index) {
9
+ this.value = key;
10
+ this.label = label;
11
+ this.index = index;
12
+ }
13
+ toJSON() {
14
+ return {
15
+ value: this.value,
16
+ label: this.label,
17
+ index: this.index
18
+ };
19
+ }
20
+ }
21
+ exports.EnumOption = EnumOption;
22
+ //# sourceMappingURL=EnumOption.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EnumOption.js","sourceRoot":"","sources":["../../src/types/EnumOption.ts"],"names":[],"mappings":";;;AAAA;IAQE,MAAM,CAAC,YAAY,CAAC,KAAU;QAC5B,OAAO,CACL,KAAK,YAAY,UAAU,IAAI,CAAC,OAAO,KAAK,IAAI,QAAQ,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,IAAI,OAAO,IAAI,KAAK,CAAC,CACnH,CAAC;IACJ,CAAC;IAED,YAAY,GAA8B,EAAE,KAAa,EAAE,KAAc;QACvE,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC;QACjB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,MAAM;QACJ,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,KAAK,EAAE,IAAI,CAAC,KAAK;SAClB,CAAC;IACJ,CAAC;CACF","sourcesContent":["export class EnumOption {\n /** They key */\n value: string | number | boolean;\n\n label: string;\n\n index: number;\n\n static isInstanceOf(value: any): value is EnumOption {\n return (\n value instanceof EnumOption || (typeof value == 'object' && value != null && 'value' in value && 'label' in value)\n );\n }\n\n constructor(key: string | number | boolean, label: string, index?: number) {\n this.value = key;\n this.label = label;\n this.index = index;\n }\n\n toJSON() {\n return {\n value: this.value,\n label: this.label,\n index: this.index\n };\n }\n}\n"]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FieldFactory = exports.Field = void 0;
4
+ const TypeFactory_1 = require("../schema/TypeFactory");
5
+ /**
6
+ * A named, resolved field and its schema metadata.
7
+ */
8
+ class Field {
9
+ constructor(name, type) {
10
+ this.name = name;
11
+ this.type = type;
12
+ }
13
+ }
14
+ exports.Field = Field;
15
+ Field.TYPE = 'field';
16
+ class FieldFactory extends TypeFactory_1.AbstractObjectTypeFactory {
17
+ constructor() {
18
+ super(Field.TYPE);
19
+ }
20
+ generate(event) {
21
+ return new Field(event.name, event.type);
22
+ }
23
+ }
24
+ exports.FieldFactory = FieldFactory;
25
+ //# sourceMappingURL=Field.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Field.js","sourceRoot":"","sources":["../../src/types/Field.ts"],"names":[],"mappings":";;;AAAA,uDAAqF;AAGrF;;GAEG;AACH;IAUE,YAAY,IAAY,EAAE,IAAc;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;;AAbQ,UAAI,GAAG,OAAO,CAAC;AAoBxB,kBAAiD,SAAQ,uCAA0D;IACjH;QACE,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACpB,CAAC;IACD,QAAQ,CAAwB,KAA4B;QAC1D,OAAO,IAAI,KAAK,CAAI,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9C,CAAC;CACF","sourcesContent":["import { AbstractObjectTypeFactory, GenerateTypeEvent } from '../schema/TypeFactory';\nimport { Type } from '@ja-platform/parser-type-system';\n\n/**\n * A named, resolved field and its schema metadata.\n */\nexport class Field<T extends Type = Type> {\n static TYPE = 'field';\n\n name: string;\n type: T | null;\n label?: string;\n relationship?: string;\n isRelationshipId?: boolean;\n isBelongsToId?: boolean;\n\n constructor(name: string, type: T | null) {\n this.name = name;\n this.type = type;\n }\n}\n\nexport interface GenerateFieldEvent<T extends Type> extends GenerateTypeEvent {\n name: string;\n type: T;\n}\n\nexport class FieldFactory<T extends Type = Type> extends AbstractObjectTypeFactory<Field<T>, GenerateFieldEvent<T>> {\n constructor() {\n super(Field.TYPE);\n }\n generate<T extends Type = Type>(event: GenerateFieldEvent<T>): Field<T> {\n return new Field<T>(event.name, event.type);\n }\n}\n"]}