@ja-platform/parser-schema 0.0.0-dev-20261112183707 → 0.0.0-dev-20261118192020

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,11 @@
1
1
  export declare class Day {
2
2
  private _time;
3
+ static today(): Day;
4
+ static fromUTCDate(date: Date): Day;
5
+ /**
6
+ * Recognize Day objects, including instances from other copies of the package.
7
+ */
8
+ static isDay(obj: unknown): obj is Day;
3
9
  /**
4
10
  * Today in the local timezone.
5
11
  */
@@ -13,12 +19,6 @@ export declare class Day {
13
19
  * Construct from a year, zero-based month and day of month.
14
20
  */
15
21
  constructor(year: number, month: number, day: number);
16
- static today(): Day;
17
- static fromUTCDate(date: Date): Day;
18
- /**
19
- * Recognize Day objects, including instances from other copies of the package.
20
- */
21
- static isDay(obj: unknown): obj is Day;
22
22
  /**
23
23
  * Return a copy of the date at midnight UTC.
24
24
  */
@@ -1,4 +1,5 @@
1
1
  export * from './schema/Schema';
2
+ export * from './schema/SchemaError';
2
3
  export * from './schema/TypeFactory';
3
4
  export * from './types/EnumOption';
4
5
  export * from './types/Field';
@@ -15,8 +15,6 @@ export declare class Schema {
15
15
  objects: {
16
16
  [index: string]: SchemaModelType;
17
17
  };
18
- apiVersion?: any;
19
- mobileUserType?: any;
20
18
  /**
21
19
  * Create an empty resolved schema, independently of its input format.
22
20
  */
@@ -0,0 +1,4 @@
1
+ export declare class SchemaError extends Error {
2
+ readonly attribute: string;
3
+ constructor(message: string, attribute: string);
4
+ }
@@ -5,7 +5,6 @@ import { Type } from '@ja-platform/parser-type-system';
5
5
  */
6
6
  export declare class Field<T extends Type = Type> {
7
7
  static TYPE: string;
8
- static isInstanceOf(obj: any): obj is Field;
9
8
  name: string;
10
9
  type: T | null;
11
10
  label?: string;
@@ -4,11 +4,12 @@ import { Type } from '@ja-platform/parser-type-system';
4
4
  */
5
5
  export declare class QueryType extends Type {
6
6
  readonly itemType: Type;
7
+ static readonly TYPE = "query";
7
8
  readonly _typeName = "query";
8
9
  readonly name = "query";
9
10
  readonly isCollection = true;
10
- constructor(itemType: Type);
11
11
  static isInstanceOf(type: Type | null): type is QueryType;
12
+ constructor(itemType: Type);
12
13
  is(value: any): boolean;
13
14
  parse(value: unknown): unknown;
14
15
  stringify(): string;
@@ -1,9 +1,13 @@
1
1
  import { AbstractObjectTypeFactory } from '../schema/TypeFactory';
2
2
  import { SchemaModelType } from './SchemaModelType';
3
+ export declare enum RelationshipType {
4
+ ONE_TO_MANY = "one-to-many",
5
+ MANY_TO_MANY = "many-to-many",
6
+ ONE_TO_ONE = "one-to-one"
7
+ }
3
8
  export declare class Relationship {
4
9
  static readonly TYPE = "relationship";
5
- /** one-to-many, many-to-many, one-to-one */
6
- type: string;
10
+ type: RelationshipType;
7
11
  /** local object type (containing the belongs_to) */
8
12
  objectType: SchemaModelType;
9
13
  /** foreign object type (containing the has_many) */
@@ -12,29 +12,41 @@ export interface NotificationConfig {
12
12
  received: string;
13
13
  badgeCount: string;
14
14
  }
15
+ export declare enum WebhookType {
16
+ READY = "ready",
17
+ UPDATE = "update"
18
+ }
19
+ export declare enum WebhookReceiver {
20
+ CLOUDCODE = "cloudcode"
21
+ }
22
+ export declare enum WebhookFieldState {
23
+ PRESENT = "present",
24
+ UPLOADED = "uploaded"
25
+ }
26
+ export interface WebhookFieldConfig {
27
+ name: string;
28
+ required: boolean;
29
+ embed: boolean;
30
+ state: WebhookFieldState;
31
+ }
32
+ export interface WebhookConfig {
33
+ name: string;
34
+ type: WebhookType;
35
+ receiver: WebhookReceiver | null;
36
+ action: string | null;
37
+ fields: WebhookFieldConfig[];
38
+ }
15
39
  export declare class SchemaModelType extends ObjectType {
16
40
  static readonly TYPE = "object";
17
- readonly isPrimitiveType = false;
18
- readonly isObject = true;
19
- attributes: Record<string, Field>;
20
41
  static isInstanceOf(type: any): type is SchemaModelType;
42
+ attributes: Record<string, Field>;
21
43
  displayFormat: SchemaObjectDisplayExpression | null;
22
44
  label: string;
23
- belongsTo: {
24
- [index: string]: Relationship;
25
- };
26
- hasMany: {
27
- [index: string]: Relationship;
28
- };
29
- belongsToVars: {
30
- [index: string]: Field;
31
- };
32
- belongsToIdVars: {
33
- [index: string]: Field;
34
- };
35
- hasManyVars: {
36
- [index: string]: Field;
37
- };
45
+ belongsTo: Record<string, Relationship>;
46
+ hasMany: Record<string, Relationship>;
47
+ belongsToVars: Record<string, Field>;
48
+ belongsToIdVars: Record<string, Field>;
49
+ hasManyVars: Record<string, Field>;
38
50
  idVar: Field<TextType>;
39
51
  /**
40
52
  * App and Cloud indexes.
@@ -44,7 +56,7 @@ export declare class SchemaModelType extends ObjectType {
44
56
  * App indexes.
45
57
  */
46
58
  indexes: ModelIndex[];
47
- webhooks: any[];
59
+ webhooks: WebhookConfig[];
48
60
  notifyUsers: NotificationConfig[];
49
61
  constructor(name?: string);
50
62
  addAttribute(attribute: Field): void;
@@ -43,5 +43,8 @@ declare const ChoiceType_base: {
43
43
  export declare abstract class ChoiceType extends ChoiceType_base {
44
44
  static isInstanceOf(type: Type | null): type is ChoiceType;
45
45
  constructor(name: string, config?: ChoiceTypeConfig);
46
+ is(value: unknown): boolean;
47
+ parse(value: unknown): unknown;
48
+ private hasOption;
46
49
  }
47
50
  export {};
package/dist/day/Day.js CHANGED
@@ -3,6 +3,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Day = void 0;
4
4
  const utils_1 = require("./utils");
5
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
+ }
6
24
  constructor(...args) {
7
25
  if (args.length === 3) {
8
26
  this._time = new Date(Date.UTC(args[0], args[1], args[2]));
@@ -33,24 +51,6 @@ class Day {
33
51
  throw new Error('Invalid args for Day()');
34
52
  }
35
53
  }
36
- static today() {
37
- return new Day();
38
- }
39
- static fromUTCDate(date) {
40
- return new Day(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate());
41
- }
42
- /**
43
- * Recognize Day objects, including instances from other copies of the package.
44
- */
45
- static isDay(obj) {
46
- return (obj instanceof Day ||
47
- (obj !== null &&
48
- typeof obj === 'object' &&
49
- 'startOfDay' in obj &&
50
- typeof obj.startOfDay === 'function' &&
51
- 'endOfDay' in obj &&
52
- typeof obj.endOfDay === 'function'));
53
- }
54
54
  /**
55
55
  * Return a copy of the date at midnight UTC.
56
56
  */
@@ -1 +1 @@
1
- {"version":3,"file":"Day.js","sourceRoot":"","sources":["../../src/day/Day.ts"],"names":[],"mappings":";;;AAAA,mCAAmD;AAEnD;IAgBE,YAAY,GAAG,IAAoE;QACjF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtB,IAAI,CAAC,KAAK,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7D,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,YAAY,IAAI,EAAE,CAAC;YACxD,IAAI,CAAC,KAAK,GAAG,IAAA,oBAAY,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QACrC,CAAC;aAAM,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACnD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,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c,EAAE,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;IAChC,CAAC;CACF","sourcesContent":["import { dateFromTime, isPureDate } from './utils';\n\nexport class Day {\n private _time: Date;\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 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 * 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"]}
1
+ {"version":3,"file":"Day.js","sourceRoot":"","sources":["../../src/day/Day.ts"],"names":[],"mappings":";;;AAAA,mCAAmD;AAEnD;IAGE,MAAM,CAAC,KAAK;QACV,OAAO,IAAI,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,MAAM,CAAC,WAAW,CAAC,IAAU;QAC3B,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,GAAY;QACvB,OAAO,CACL,GAAG,YAAY,GAAG;YAClB,CAAC,GAAG,KAAK,IAAI;gBACX,OAAO,GAAG,KAAK,QAAQ;gBACvB,YAAY,IAAI,GAAG;gBACnB,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,OAAO,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;IACnF,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,EAAE,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC;IACjC,CAAC;IAED;;OAEG;IACH,YAAY;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC;IAChC,CAAC;CACF","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"]}
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  exports.ArrayType = exports.NumberType = exports.IntegerType = void 0;
18
18
  __exportStar(require("./schema/Schema"), exports);
19
+ __exportStar(require("./schema/SchemaError"), exports);
19
20
  __exportStar(require("./schema/TypeFactory"), exports);
20
21
  __exportStar(require("./types/EnumOption"), exports);
21
22
  __exportStar(require("./types/Field"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kDAAgC;AAEhC,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';\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"]}
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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../src/schema/Schema.ts"],"names":[],"mappings":";;;AAAA,0CAAqD;AACrD,0CAAqD;AACrD,wDAA8E;AAC9E,8DAAmF;AAEnF,uEAAyF;AACzF,+CAAkE;AAQlE;IASE;;OAEG;IACH;QAXA,kBAAa,GAAmC,EAAE,CAAC;QAYjD,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAElB,IAAI,CAAC,mBAAmB,CAAC,IAAI,oBAAY,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,mBAAmB,CAAC,IAAI,oBAAY,EAAE,CAAC,CAAC;QAC7C,IAAI,CAAC,mBAAmB,CAAC,IAAI,wCAAsB,EAAE,CAAC,CAAC;QACvD,IAAI,CAAC,mBAAmB,CAAC,IAAI,sCAAuB,EAAE,CAAC,CAAC;QAExD,mCAAmC;QACnC,KAAK,MAAM,aAAa,IAAI,MAAM,CAAC,IAAI,CAAC,iCAAgB,CAAC,EAAE,CAAC;YAC1D,IAAI,CAAC,mBAAmB,CAAC,IAAI,kCAAoB,CAAC,aAAkC,CAAC,CAAC,CAAC;QACzF,CAAC;IACH,CAAC;IAED,mBAAmB,CAAC,OAAoB;QACtC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;IAC7C,CAAC;IAED,UAAU,CAAC,IAAY;QACrB,OAAO,I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;QACD,0CAA0C;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAoB,CAAC;IACnD,CAAC;IAED,SAAS,CAAuC,IAAO;QACrD,IAAI,CAAC,CAAC,IAAI,IAAI,iCAAgB,CAAC,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,OAAO,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF","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 // these are used by the tern defs (legacy editor)\n apiVersion?;\n mobileUserType?;\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"]}
1
+ {"version":3,"file":"Schema.js","sourceRoot":"","sources":["../../src/schema/Schema.ts"],"names":[],"mappings":";;;AAAA,0CAAqD;AACrD,0CAAqD;AACrD,wDAA8E;AAC9E,8DAAmF;AAEnF,uEAAyF;AACzF,+CAAkE;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IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QACnE,OAAO,IAAI,CAAC,UAAU,CAAC,aAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACtF,CAAC;IAED,aAAa,CAAC,IAAa;QACzB,OAAO,IAAI,CAAC,UAAU,CAAC,iCAAe,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAoB,CAAC;IACnG,CAAC;IAED,eAAe;QACb,OAAO,IAAI,CAAC,UAAU,CAAC,2BAAY,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAiB,CAAC;IACvF,CAAC;IAED,8FAA8F;IAC9F,mFAAmF;IACnF,OAAO,CAAuC,QAAW;QACvD,IAAI,QAAQ,IAAI,iCAAgB,EAAE,CAAC;YACjC,YAAY;YACZ,OAAO,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;QAClC,CAAC;QACD,0CAA0C;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAoB,CAAC;IACnD,CAAC;IAED,SAAS,CAAuC,IAAO;QACrD,IAAI,CAAC,CAAC,IAAI,IAAI,iCAAgB,CAAC,EAAE,CAAC;YAChC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,OAAO,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5C,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;CACF","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"]}
@@ -25,7 +25,7 @@ exports.textSubtypeSpecs = {
25
25
  url: 'text.url',
26
26
  paragraph: 'text.paragraph',
27
27
  'signed-number': 'number',
28
- number: 'number', // TODO: fix
28
+ number: 'number',
29
29
  'south-african-id': 'number.za_id',
30
30
  'phone-number': 'phone',
31
31
  'decimal-number': 'decimal',
@@ -1 +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,EAAE,YAAY;IAC9B,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', // TODO: fix\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"]}
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"]}
@@ -1 +1 @@
1
- {"version":"7.0.2","root":[[128,145],[147,158]],"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/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/constant/ConstantExpression.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/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","822b842ad7efa3485d65fbeb2f919865","89b6053090a8d01f57cb8f521fae777d","26302a8b72d74f944dcf8f6452e54f7c","bc95bdb594a5aece18248fbf4387dd2e","90125a76f2ae701181f7e09dea41f3ad","ac52bb76ccad935a013384d2a71ab267","2c96eeb69afb823580d4e1e5f1b188e0","c06213bcb24cd658dfcd1239777159bd","84519ebe510a4219ef71e5a0a973c591","0c68f6d853b53c3d34189f5c99c4b624","18408a4ba98e42e70324ba5c0b71f379","d6ca1e855d5b6554555a009a40e806a2","92d25cb01f547225fee7d19311179220","e78cf9dc5bca6011a220581f56da19cb",{"version":"3575b2b8e50b5a5b3acce219e08900c5","impliedNodeFormat":99},"25aba7d58ecafcf7098f9bcca63ea72a","90506d77482148f93c56044616613958","ae63a2414b6a326b93ee65bba693d617","0b41d778150d6774bc72b9e36a6c409f","cc36a10654ee721a890569de343ee4a0","81bde6b904e09fb337a80f52526d0c49","61b4c95d7a2ba531a5faae6b4e0694f1","c3b9b5f9be217e9fabbfc9f5b48da439","be6a700c7b2a3007e5ff5eccccd1e6ca","f25290e9ca5aee09a0210e2a454437f8","cf3121ca4479d3afdaceb690d14cf086","c115de0a80c101e99244da31e79527d1","cabc47d72ba300dd603c14a7bb2b7cde","57845437bcd4011990eb52478f02c4a0","354fc88481ff608fcbbfaf7851a29043","bf6d579deb9596ec514083ea94789be0","3058c9c4ad1200a2ff62094072deed53","d33a7d16b8bb10392237228466f959f8","4678acee57e4a32f080f3a53600abf18",{"version":"f9bd850e5e3a05926dbfc2a68d393e2f","signature":"aa250c74fe5a950a7dea8c41eba97441","impliedNodeFormat":1},{"version":"e15b8a94bffca79fb19f767e7feb2f64","signature":"a2614d5bf8c8a719715fad139f7d2849","impliedNodeFormat":1},{"version":"2e0f0b769b39a42a5a9133ad03d07faf","signature":"88ae61f99ea8bab323e2e743e4ee8a90","impliedNodeFormat":1},{"version":"0ed54f86ee92c964f950c9d44df12feb","signature":"44ebda1090b59085d1eeda6c2c25e4af","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":"853e1f8841cceac171473411e2890199","signature":"a017252f6e0a3f0b8f7812273df80ece","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":"44f604903f90b5463fa5141e449472c6","signature":"e18c2c8b2f19905e6ee32e3885543768","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":"7ac16ec8fa5ac5ebab823873d1ae3303","signature":"4e9c1a842d05a1f95dcdcfec6b540283","impliedNodeFormat":1},{"version":"efd4e9ab467bfaf61ba44a65a04f68c1","signature":"6030b59fbf00d2b0aecb059c3352c479","impliedNodeFormat":1},{"version":"e3424277ca0424373630e388eb21ca6b","signature":"dcd337aeff86227b569df4951219b6b6","impliedNodeFormat":1},{"version":"d4b41c4ef58c0a466ddd9a3e6bc3e9fa","signature":"0e8db9e9df76cda9a82eefe26c9aad25","impliedNodeFormat":1},{"version":"8cc989ae5c82c1ff8840588694d62750","signature":"eb7b402991957b09b77be3d8046faa56","impliedNodeFormat":1},{"version":"3365c7d6a19dcfc162cb7fe14c8a16af","signature":"205c6187ac6e4ef53474b4a23ba47e42","impliedNodeFormat":1},{"version":"4e64f639aa18931d67ad0fdcd666fe46","signature":"9b10f44359c357ec9eb524788f857844","impliedNodeFormat":1}],"fileIdsList":[[89,103,104],[89,103],[107,108],[90,101],[89,102],[89,90,103,104],[89,103,104,111],[89,101,103,104],[89,90,103,104,113],[89,104,114],[89,90,101,102,103,104],[89,102,103,104,118,119],[89,113,114,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],[144],[127],[101,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,147,148,149,150,151,152,153,154,155,156,157],[101,130,131,151,152,153,154],[130,131,151,152,154,155],[101,153],[101,127,130,153],[152,153],[101,128,129,130,131,132,134,151,153,155],[101,136],[101,135],[101,144,145,146],[101,146],[101,134],[136],[101,133,134,137,138,139,140,141,142,143,147,148,149,150],[135,136],[133],[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],[113,6],[112,7],[116,8],[117,9],[115,10],[114,11],[120,12],[121,13],[127,14],[111,15],[122,15],[90,15],[125,15],[123,16],[124,15],[119,2],[118,15],[106,2],[126,17],[110,18],[145,19],[128,20],[157,20],[158,21],[155,22],[153,23],[130,24],[154,25],[129,18],[131,26],[152,27],[137,28],[136,29],[147,30],[148,31],[139,18],[138,32],[143,33],[142,33],[151,34],[141,35],[140,33],[134,18],[133,18],[149,36],[150,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"}
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"}
@@ -6,9 +6,6 @@ const TypeFactory_1 = require("../schema/TypeFactory");
6
6
  * A named, resolved field and its schema metadata.
7
7
  */
8
8
  class Field {
9
- static isInstanceOf(obj) {
10
- return obj instanceof Field || 'name' in obj;
11
- }
12
9
  constructor(name, type) {
13
10
  this.name = name;
14
11
  this.type = type;
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","sourceRoot":"","sources":["../../src/types/Field.ts"],"names":[],"mappings":";;;AAAA,uDAAqF;AAGrF;;GAEG;AACH;IAGE,MAAM,CAAC,YAAY,CAAC,GAAQ;QAC1B,OAAO,GAAG,YAAY,KAAK,IAAI,MAAM,IAAI,GAAG,CAAC;IAC/C,CAAC;IASD,YAAY,IAAY,EAAE,IAAc;QACtC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;;AAjBQ,UAAI,GAAG,OAAO,CAAC;AAwBxB,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 static isInstanceOf(obj: any): obj is Field {\n return obj instanceof Field || 'name' in obj;\n }\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"]}
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"]}
@@ -6,16 +6,16 @@ const parser_type_system_1 = require("@ja-platform/parser-type-system");
6
6
  * A query whose results share a value type.
7
7
  */
8
8
  class QueryType extends parser_type_system_1.Type {
9
+ static isInstanceOf(type) {
10
+ return (type === null || type === void 0 ? void 0 : type._typeName) === QueryType.TYPE;
11
+ }
9
12
  constructor(itemType) {
10
- super('query');
13
+ super(QueryType.TYPE);
11
14
  this.itemType = itemType;
12
- this._typeName = 'query';
13
- this.name = 'query';
15
+ this._typeName = QueryType.TYPE;
16
+ this.name = QueryType.TYPE;
14
17
  this.isCollection = true;
15
18
  }
16
- static isInstanceOf(type) {
17
- return (type === null || type === void 0 ? void 0 : type._typeName) === 'query';
18
- }
19
19
  is(value) {
20
20
  return (parser_type_system_1.ObjectType.isInstanceOf(value === null || value === void 0 ? void 0 : value.type) &&
21
21
  value.type.name === this.itemType.name &&
@@ -34,4 +34,5 @@ class QueryType extends parser_type_system_1.Type {
34
34
  }
35
35
  }
36
36
  exports.QueryType = QueryType;
37
+ QueryType.TYPE = 'query';
37
38
  //# sourceMappingURL=QueryType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QueryType.js","sourceRoot":"","sources":["../../src/types/QueryType.ts"],"names":[],"mappings":";;;AAAA,wEAAmE;AAEnE;;GAEG;AACH,eAAuB,SAAQ,yBAAI;IAKjC,YAAqB,QAAc;QACjC,KAAK,CAAC,OAAO,CAAC,CAAC;QADI,aAAQ,GAAR,QAAQ,CAAM;QAJ1B,cAAS,GAAG,OAAO,CAAC;QACpB,SAAI,GAAG,OAAO,CAAC;QACf,iBAAY,GAAG,IAAI,CAAC;IAI7B,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,IAAiB;QACnC,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,MAAK,OAAO,CAAC;IACrC,CAAC;IAED,EAAE,CAAC,KAAU;QACX,OAAO,CACL,+BAAU,CAAC,YAAY,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,IAAI,CAAC;YACpC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,QAAQ,CAAC,IAAI;YACtC,OAAO,KAAK,CAAC,MAAM,KAAK,UAAU,CACnC,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,KAAc;QAClB,IAAI,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC;YAAE,OAAO,KAAK,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,qCAAqC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED,SAAS;QACP,OAAO,GAAG,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC9C,CAAC;IAED,MAAM;QACJ,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;IACzD,CAAC;CACF","sourcesContent":["import { Type, ObjectType } from '@ja-platform/parser-type-system';\n\n/**\n * A query whose results share a value type.\n */\nexport class QueryType extends Type {\n readonly _typeName = 'query';\n readonly name = 'query';\n readonly isCollection = true;\n\n constructor(readonly itemType: Type) {\n super('query');\n }\n\n static isInstanceOf(type: Type | null): type is QueryType {\n return type?._typeName === 'query';\n }\n\n is(value: any): boolean {\n return (\n ObjectType.isInstanceOf(value?.type) &&\n value.type.name === this.itemType.name &&\n typeof value._fetch === 'function'\n );\n }\n\n parse(value: unknown): unknown {\n if (this.is(value)) return value;\n throw new Error(`Expected value to have query type ${this.itemType.name}`);\n }\n\n stringify(): string {\n return `${this.name}:${this.itemType.name}`;\n }\n\n toJSON() {\n return { type: this.name, object: this.itemType.name };\n }\n}\n"]}
1
+ {"version":3,"file":"QueryType.js","sourceRoot":"","sources":["../../src/types/QueryType.ts"],"names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query whose results share a value type.\n */\nexport class QueryType extends Type {\n static readonly TYPE = 'query';\n\n readonly _typeName = QueryType.TYPE;\n readonly name = QueryType.TYPE;\n readonly isCollection = true;\n\n static isInstanceOf(type: Type | null): type is QueryType {\n return type?._typeName === QueryType.TYPE;\n }\n\n constructor(readonly itemType: Type) {\n super(QueryType.TYPE);\n }\n\n is(value: any): boolean {\n return (\n ObjectType.isInstanceOf(value?.type) &&\n value.type.name === this.itemType.name &&\n typeof value._fetch === 'function'\n );\n }\n\n parse(value: unknown): unknown {\n if (this.is(value)) return value;\n throw new Error(`Expected value to have query type ${this.itemType.name}`);\n }\n\n stringify(): string {\n return `${this.name}:${this.itemType.name}`;\n }\n\n toJSON() {\n return { type: this.name, object: this.itemType.name };\n }\n}\n"]}
@@ -1,10 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RelationshipTypeFactory = exports.Relationship = void 0;
3
+ exports.RelationshipTypeFactory = exports.Relationship = exports.RelationshipType = void 0;
4
4
  const TypeFactory_1 = require("../schema/TypeFactory");
5
+ var RelationshipType;
6
+ (function (RelationshipType) {
7
+ RelationshipType["ONE_TO_MANY"] = "one-to-many";
8
+ RelationshipType["MANY_TO_MANY"] = "many-to-many";
9
+ RelationshipType["ONE_TO_ONE"] = "one-to-one";
10
+ })(RelationshipType || (exports.RelationshipType = RelationshipType = {}));
5
11
  class Relationship {
6
12
  constructor() {
7
- this.type = 'one-to-many';
13
+ this.type = RelationshipType.ONE_TO_MANY;
8
14
  this.objectType = null;
9
15
  this.foreignType = null;
10
16
  this.name = null;
@@ -1 +1 @@
1
- {"version":3,"file":"Relationship.js","sourceRoot":"","sources":["../../src/types/Relationship.ts"],"names":[],"mappings":";;;AAAA,uDAAkE;AAGlE;IAkBE;QACE,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC;QAE1B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAExB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;CACF;;AA1BiB,iBAAI,GAAG,cAAc,CAAC;AA4BxC,6BAAqC,SAAQ,uCAAuC;IAClF;QACE,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,YAAY,EAAE,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import { AbstractObjectTypeFactory } from '../schema/TypeFactory';\nimport { SchemaModelType } from './SchemaModelType';\n\nexport class Relationship {\n static readonly TYPE = 'relationship';\n\n /** one-to-many, many-to-many, one-to-one */\n type: string;\n\n /** local object type (containing the belongs_to) */\n objectType: SchemaModelType; // TODO\n\n /** foreign object type (containing the has_many) */\n foreignType: SchemaModelType; // TODO\n\n /** The name used on the local object to identify the relationship (singular) */\n name: string;\n\n /** The name used on the foreign object to identify the relationship (plural) */\n foreignName: string;\n\n constructor() {\n this.type = 'one-to-many';\n\n this.objectType = null;\n this.foreignType = null;\n\n this.name = null;\n this.foreignName = null;\n }\n}\n\nexport class RelationshipTypeFactory extends AbstractObjectTypeFactory<Relationship> {\n constructor() {\n super(Relationship.TYPE);\n }\n\n generate(): Relationship {\n return new Relationship();\n }\n}\n"]}
1
+ {"version":3,"file":"Relationship.js","sourceRoot":"","sources":["../../src/types/Relationship.ts"],"names":[],"mappings":";;;AAAA,uDAAkE;AAGlE,IAAY,gBAIX;AAJD,WAAY,gBAAgB;IAC1B,+CAA2B,CAAA;IAC3B,iDAA6B,CAAA;IAC7B,6CAAyB,CAAA;AAC3B,CAAC,EAJW,gBAAgB,aAAhB,gBAAgB,GAAhB,gBAAgB,QAI3B;AAED;IAiBE;QACE,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC,WAAW,CAAC;QAEzC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;QACvB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;QAExB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;CACF;;AAzBiB,iBAAI,GAAG,cAAc,CAAC;AA2BxC,6BAAqC,SAAQ,uCAAuC;IAClF;QACE,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,YAAY,EAAE,CAAC;IAC5B,CAAC;CACF","sourcesContent":["import { AbstractObjectTypeFactory } from '../schema/TypeFactory';\nimport { SchemaModelType } from './SchemaModelType';\n\nexport enum RelationshipType {\n ONE_TO_MANY = 'one-to-many',\n MANY_TO_MANY = 'many-to-many',\n ONE_TO_ONE = 'one-to-one'\n}\n\nexport class Relationship {\n static readonly TYPE = 'relationship';\n\n type: RelationshipType;\n\n /** local object type (containing the belongs_to) */\n objectType: SchemaModelType; // TODO\n\n /** foreign object type (containing the has_many) */\n foreignType: SchemaModelType; // TODO\n\n /** The name used on the local object to identify the relationship (singular) */\n name: string;\n\n /** The name used on the foreign object to identify the relationship (plural) */\n foreignName: string;\n\n constructor() {\n this.type = RelationshipType.ONE_TO_MANY;\n\n this.objectType = null;\n this.foreignType = null;\n\n this.name = null;\n this.foreignName = null;\n }\n}\n\nexport class RelationshipTypeFactory extends AbstractObjectTypeFactory<Relationship> {\n constructor() {\n super(Relationship.TYPE);\n }\n\n generate(): Relationship {\n return new Relationship();\n }\n}\n"]}
@@ -1,18 +1,31 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SchemaModelTypeFactory = exports.SchemaModelType = void 0;
3
+ exports.SchemaModelTypeFactory = exports.SchemaModelType = exports.WebhookFieldState = exports.WebhookReceiver = exports.WebhookType = void 0;
4
4
  const QueryType_1 = require("./QueryType");
5
5
  const parser_type_system_1 = require("@ja-platform/parser-type-system");
6
+ const SchemaError_1 = require("../schema/SchemaError");
6
7
  const PrimitiveTypes_1 = require("./primitives/PrimitiveTypes");
7
8
  const TypeFactory_1 = require("../schema/TypeFactory");
9
+ var WebhookType;
10
+ (function (WebhookType) {
11
+ WebhookType["READY"] = "ready";
12
+ WebhookType["UPDATE"] = "update";
13
+ })(WebhookType || (exports.WebhookType = WebhookType = {}));
14
+ var WebhookReceiver;
15
+ (function (WebhookReceiver) {
16
+ WebhookReceiver["CLOUDCODE"] = "cloudcode";
17
+ })(WebhookReceiver || (exports.WebhookReceiver = WebhookReceiver = {}));
18
+ var WebhookFieldState;
19
+ (function (WebhookFieldState) {
20
+ WebhookFieldState["PRESENT"] = "present";
21
+ WebhookFieldState["UPLOADED"] = "uploaded";
22
+ })(WebhookFieldState || (exports.WebhookFieldState = WebhookFieldState = {}));
8
23
  class SchemaModelType extends parser_type_system_1.ObjectType {
9
24
  static isInstanceOf(type) {
10
25
  return (type === null || type === void 0 ? void 0 : type._typeName) === SchemaModelType.TYPE;
11
26
  }
12
27
  constructor(name) {
13
28
  super(name);
14
- this.isPrimitiveType = false;
15
- this.isObject = true;
16
29
  this.attributes = {};
17
30
  this.displayFormat = null;
18
31
  this.belongsTo = {};
@@ -63,9 +76,7 @@ class SchemaModelType extends parser_type_system_1.ObjectType {
63
76
  return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, this.hasManyVars), this.belongsToIdVars), this.belongsToVars), this.attributes), { id: this.idVar });
64
77
  }
65
78
  addBelongsTo(options) {
66
- const object = this;
67
79
  const schema = options.schema;
68
- let err;
69
80
  const rel = schema.newRelationship();
70
81
  const typeName = options.type;
71
82
  const foreignName = options.foreignName;
@@ -75,32 +86,28 @@ class SchemaModelType extends parser_type_system_1.ObjectType {
75
86
  name = typeName;
76
87
  }
77
88
  rel.name = name;
78
- rel.objectType = object;
89
+ rel.objectType = this;
79
90
  rel.foreignType = schema.objects[typeName];
80
91
  if (rel.foreignType == null) {
81
- err = new Error("Object '" + typeName + "' is not defined");
82
- err.attribute = 'type';
83
- throw err;
92
+ throw new SchemaError_1.SchemaError(`Object '${typeName}' is not defined`, 'type');
84
93
  }
85
- if (object.belongsTo.hasOwnProperty(name)) {
86
- err = new Error("Relationship '" + name + "' is already defined");
87
- err.attribute = 'name';
88
- throw err;
94
+ if (this.belongsTo.hasOwnProperty(name)) {
95
+ throw new SchemaError_1.SchemaError(`Relationship '${name}' is already defined`, 'name');
89
96
  }
90
97
  else {
91
- object.belongsTo[name] = rel;
98
+ this.belongsTo[name] = rel;
92
99
  // For type lookups
93
- object.belongsToVars[name] = schema.field(name, rel.foreignType);
94
- object.belongsToVars[name].relationship = name;
100
+ this.belongsToVars[name] = schema.field(name, rel.foreignType);
101
+ this.belongsToVars[name].relationship = name;
95
102
  const idVar = schema.field(name + '_id', PrimitiveTypes_1.PrimitiveType.TEXT);
96
103
  idVar.relationship = name;
97
104
  idVar.isBelongsToId = true;
98
- object.belongsToIdVars[idVar.name] = idVar;
105
+ this.belongsToIdVars[idVar.name] = idVar;
99
106
  }
100
107
  if (foreignName != null) {
101
108
  rel.foreignName = foreignName;
102
109
  rel.foreignType.hasMany[foreignName] = rel;
103
- rel.foreignType.hasManyVars[foreignName] = schema.field(foreignName, new QueryType_1.QueryType(object));
110
+ rel.foreignType.hasManyVars[foreignName] = schema.field(foreignName, new QueryType_1.QueryType(this));
104
111
  }
105
112
  return rel;
106
113
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaModelType.js","sourceRoot":"","sources":["../../src/types/SchemaModelType.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AACxC,wEAAmE;AAKnE,gEAA4D;AAE5D,uDAAqF;AASrF,qBAA6B,SAAQ,+BAAU;IAO7C,MAAM,CAAC,YAAY,CAAC,IAAS;QAC3B,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,MAAK,eAAe,CAAC,IAAI,CAAC;IAClD,CAAC;IAwBD,YAAY,IAAa;QACvB,KAAK,CAAC,IAAI,CAAC,CAAC;QA/BL,oBAAe,GAAG,KAAK,CAAC;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CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC;gBAC3C,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,qBAAS,CAAC,MAAM,CAAC,CAAC,CAAC;YAC9F,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;;AAxIiB,oBAAI,GAAG,QAAQ,AAAX,CAAY;AA8IlC,4BAAoC,SAAQ,uCAAwE;IAClH;QACE,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,QAAQ,CAAC,KAAmC;QAC1C,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjD,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACtC,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF","sourcesContent":["import { SchemaObjectDisplayExpression } from '../expressions/SchemaObjectDisplayExpression';\nimport { QueryType } from './QueryType';\nimport { ObjectType, Type } from '@ja-platform/parser-type-system';\nimport { Field } from './Field';\nimport { Relationship } from './Relationship';\nimport { Schema } from '../schema/Schema';\nimport { ModelIndex } from '../schema/ModelIndex';\nimport { PrimitiveType } from './primitives/PrimitiveTypes';\nimport { TextType } from './primitives/TextType';\nimport { AbstractObjectTypeFactory, GenerateTypeEvent } from '../schema/TypeFactory';\n\nexport interface NotificationConfig {\n message: SchemaObjectDisplayExpression;\n recipient: string;\n received: string;\n badgeCount: string;\n}\n\nexport class SchemaModelType extends ObjectType {\n static readonly TYPE = 'object';\n\n readonly isPrimitiveType = false;\n readonly isObject = true;\n attributes: Record<string, Field> = {};\n\n static isInstanceOf(type: any): type is SchemaModelType {\n return type?._typeName === SchemaModelType.TYPE;\n }\n\n displayFormat: SchemaObjectDisplayExpression | null;\n label: string;\n\n belongsTo: { [index: string]: Relationship };\n hasMany: { [index: string]: Relationship };\n\n belongsToVars: { [index: string]: Field };\n belongsToIdVars: { [index: string]: Field };\n hasManyVars: { [index: string]: Field };\n idVar: Field<TextType>;\n\n /**\n * App and Cloud indexes.\n */\n allIndexes: ModelIndex[];\n /**\n * App indexes.\n */\n indexes: ModelIndex[];\n webhooks: any[]; // TODO\n notifyUsers: NotificationConfig[];\n\n constructor(name?: string) {\n super(name);\n\n this.displayFormat = null;\n this.belongsTo = {};\n this.hasMany = {};\n this.belongsToVars = {};\n this.belongsToIdVars = {};\n this.hasManyVars = {};\n this.indexes = [];\n this.allIndexes = [];\n this.webhooks = [];\n\n this.notifyUsers = [];\n }\n\n addAttribute(attribute: Field): void {\n this.attributes[attribute.name] = attribute;\n }\n\n setupVariables(schema: Schema) {\n this.idVar = schema.field('id', PrimitiveType.TEXT);\n }\n\n /**\n * Attribute or relationship variable.\n */\n getAttribute(name: string): Field | null {\n if (Object.prototype.hasOwnProperty.call(this.attributes, name)) {\n return this.attributes[name];\n } else if (Object.prototype.hasOwnProperty.call(this.belongsToVars, name)) {\n return this.belongsToVars[name];\n } else if (Object.prototype.hasOwnProperty.call(this.belongsToIdVars, name)) {\n return this.belongsToIdVars[name];\n } else if (Object.prototype.hasOwnProperty.call(this.hasManyVars, name)) {\n return this.hasManyVars[name];\n } else if (name == 'id') {\n return this.idVar;\n } else {\n return null;\n }\n }\n\n getField(name: string): Type | null {\n return this.getAttribute(name)?.type ?? null;\n }\n\n getAttributes(): { [index: string]: Field } {\n return {\n ...this.hasManyVars,\n ...this.belongsToIdVars,\n ...this.belongsToVars,\n ...this.attributes,\n id: this.idVar\n };\n }\n\n addBelongsTo(options: { schema: Schema; type?: string; foreignName?: string; name: string }) {\n const object = this;\n const schema = options.schema;\n let err;\n const rel = schema.newRelationship();\n const typeName = options.type;\n const foreignName = options.foreignName;\n if (typeName != null) {\n let name = options.name;\n if (name == null || name === '') {\n name = typeName;\n }\n rel.name = name;\n rel.objectType = object;\n rel.foreignType = schema.objects[typeName];\n if (rel.foreignType == null) {\n err = new Error(\"Object '\" + typeName + \"' is not defined\");\n (err as any).attribute = 'type';\n throw err;\n }\n\n if (object.belongsTo.hasOwnProperty(name)) {\n err = new Error(\"Relationship '\" + name + \"' is already defined\");\n (err as any).attribute = 'name';\n throw err;\n } else {\n object.belongsTo[name] = rel;\n\n // For type lookups\n object.belongsToVars[name] = schema.field(name, rel.foreignType);\n object.belongsToVars[name].relationship = name;\n\n const idVar = schema.field(name + '_id', PrimitiveType.TEXT);\n idVar.relationship = name;\n idVar.isBelongsToId = true;\n object.belongsToIdVars[idVar.name] = idVar;\n }\n\n if (foreignName != null) {\n rel.foreignName = foreignName;\n rel.foreignType.hasMany[foreignName] = rel;\n rel.foreignType.hasManyVars[foreignName] = schema.field(foreignName, new QueryType(object));\n }\n return rel;\n }\n return null;\n }\n}\n\nexport interface GenerateSchemaModelTypeEvent extends GenerateTypeEvent {\n name?: string;\n}\n\nexport class SchemaModelTypeFactory extends AbstractObjectTypeFactory<SchemaModelType, GenerateSchemaModelTypeEvent> {\n constructor() {\n super(SchemaModelType.TYPE);\n }\n\n generate(event: GenerateSchemaModelTypeEvent) {\n const instance = new SchemaModelType(event.name);\n instance.setupVariables(event.schema);\n return instance;\n }\n}\n"]}
1
+ {"version":3,"file":"SchemaModelType.js","sourceRoot":"","sources":["../../src/types/SchemaModelType.ts"],"names":[],"mappings":";;;AACA,2CAAwC;AACxC,wEAAmE;AAInE,uDAAoD;AAEpD,gEAA4D;AAE5D,uDAAqF;AASrF,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,8BAAe,CAAA;IACf,gCAAiB,CAAA;AACnB,CAAC,EAHW,WAAW,aAAX,WAAW,GAAX,WAAW,QAGtB;AAED,IAAY,eAEX;AAFD,WAAY,eAAe;IACzB,0CAAuB,CAAA;AACzB,CAAC,EAFW,eAAe,aAAf,eAAe,GAAf,eAAe,QAE1B;AAED,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,wC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AI,IAAI,EAAE,CAAC;gBACxB,GAAG,CAAC,WAAW,GAAG,WAAW,CAAC;gBAC9B,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,GAAG,CAAC;gBAC3C,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,WAAW,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,IAAI,qBAAS,CAAC,IAAI,CAAC,CAAC,CAAC;YAC5F,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;;AA/HiB,oBAAI,GAAG,QAAQ,AAAX,CAAY;AAqIlC,4BAAoC,SAAQ,uCAAwE;IAClH;QACE,KAAK,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAED,QAAQ,CAAC,KAAmC;QAC1C,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjD,QAAQ,CAAC,cAAc,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACtC,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF","sourcesContent":["import { SchemaObjectDisplayExpression } from '../expressions/SchemaObjectDisplayExpression';\nimport { QueryType } from './QueryType';\nimport { ObjectType, Type } from '@ja-platform/parser-type-system';\nimport { Field } from './Field';\nimport { Relationship } from './Relationship';\nimport { Schema } from '../schema/Schema';\nimport { SchemaError } from '../schema/SchemaError';\nimport { ModelIndex } from '../schema/ModelIndex';\nimport { PrimitiveType } from './primitives/PrimitiveTypes';\nimport { TextType } from './primitives/TextType';\nimport { AbstractObjectTypeFactory, GenerateTypeEvent } from '../schema/TypeFactory';\n\nexport interface NotificationConfig {\n message: SchemaObjectDisplayExpression;\n recipient: string;\n received: string;\n badgeCount: string;\n}\n\nexport enum WebhookType {\n READY = 'ready',\n UPDATE = 'update'\n}\n\nexport enum WebhookReceiver {\n CLOUDCODE = 'cloudcode'\n}\n\nexport enum WebhookFieldState {\n PRESENT = 'present',\n UPLOADED = 'uploaded'\n}\n\nexport interface WebhookFieldConfig {\n name: string;\n required: boolean;\n embed: boolean;\n state: WebhookFieldState;\n}\n\nexport interface WebhookConfig {\n name: string;\n type: WebhookType;\n receiver: WebhookReceiver | null;\n action: string | null;\n fields: WebhookFieldConfig[];\n}\n\nexport class SchemaModelType extends ObjectType {\n static readonly TYPE = 'object';\n\n static isInstanceOf(type: any): type is SchemaModelType {\n return type?._typeName === SchemaModelType.TYPE;\n }\n\n attributes: Record<string, Field> = {};\n displayFormat: SchemaObjectDisplayExpression | null;\n label: string;\n\n belongsTo: Record<string, Relationship>;\n hasMany: Record<string, Relationship>;\n\n belongsToVars: Record<string, Field>;\n belongsToIdVars: Record<string, Field>;\n hasManyVars: Record<string, Field>;\n idVar: Field<TextType>;\n\n /**\n * App and Cloud indexes.\n */\n allIndexes: ModelIndex[];\n /**\n * App indexes.\n */\n indexes: ModelIndex[];\n webhooks: WebhookConfig[];\n notifyUsers: NotificationConfig[];\n\n constructor(name?: string) {\n super(name);\n\n this.displayFormat = null;\n this.belongsTo = {};\n this.hasMany = {};\n this.belongsToVars = {};\n this.belongsToIdVars = {};\n this.hasManyVars = {};\n this.indexes = [];\n this.allIndexes = [];\n this.webhooks = [];\n\n this.notifyUsers = [];\n }\n\n addAttribute(attribute: Field): void {\n this.attributes[attribute.name] = attribute;\n }\n\n setupVariables(schema: Schema) {\n this.idVar = schema.field('id', PrimitiveType.TEXT);\n }\n\n /**\n * Attribute or relationship variable.\n */\n getAttribute(name: string): Field | null {\n if (Object.prototype.hasOwnProperty.call(this.attributes, name)) {\n return this.attributes[name];\n } else if (Object.prototype.hasOwnProperty.call(this.belongsToVars, name)) {\n return this.belongsToVars[name];\n } else if (Object.prototype.hasOwnProperty.call(this.belongsToIdVars, name)) {\n return this.belongsToIdVars[name];\n } else if (Object.prototype.hasOwnProperty.call(this.hasManyVars, name)) {\n return this.hasManyVars[name];\n } else if (name == 'id') {\n return this.idVar;\n } else {\n return null;\n }\n }\n\n getField(name: string): Type | null {\n return this.getAttribute(name)?.type ?? null;\n }\n\n getAttributes(): { [index: string]: Field } {\n return {\n ...this.hasManyVars,\n ...this.belongsToIdVars,\n ...this.belongsToVars,\n ...this.attributes,\n id: this.idVar\n };\n }\n\n addBelongsTo(options: { schema: Schema; type?: string; foreignName?: string; name: string }) {\n const schema = options.schema;\n const rel = schema.newRelationship();\n const typeName = options.type;\n const foreignName = options.foreignName;\n if (typeName != null) {\n let name = options.name;\n if (name == null || name === '') {\n name = typeName;\n }\n rel.name = name;\n rel.objectType = this;\n rel.foreignType = schema.objects[typeName];\n if (rel.foreignType == null) {\n throw new SchemaError(`Object '${typeName}' is not defined`, 'type');\n }\n\n if (this.belongsTo.hasOwnProperty(name)) {\n throw new SchemaError(`Relationship '${name}' is already defined`, 'name');\n } else {\n this.belongsTo[name] = rel;\n\n // For type lookups\n this.belongsToVars[name] = schema.field(name, rel.foreignType);\n this.belongsToVars[name].relationship = name;\n\n const idVar = schema.field(name + '_id', PrimitiveType.TEXT);\n idVar.relationship = name;\n idVar.isBelongsToId = true;\n this.belongsToIdVars[idVar.name] = idVar;\n }\n\n if (foreignName != null) {\n rel.foreignName = foreignName;\n rel.foreignType.hasMany[foreignName] = rel;\n rel.foreignType.hasManyVars[foreignName] = schema.field(foreignName, new QueryType(this));\n }\n return rel;\n }\n return null;\n }\n}\n\nexport interface GenerateSchemaModelTypeEvent extends GenerateTypeEvent {\n name?: string;\n}\n\nexport class SchemaModelTypeFactory extends AbstractObjectTypeFactory<SchemaModelType, GenerateSchemaModelTypeEvent> {\n constructor() {\n super(SchemaModelType.TYPE);\n }\n\n generate(event: GenerateSchemaModelTypeEvent) {\n const instance = new SchemaModelType(event.name);\n instance.setupVariables(event.schema);\n return instance;\n }\n}\n"]}
@@ -21,8 +21,9 @@ function withChoices(Base) {
21
21
  if (!this.multipleOptions) {
22
22
  return (_b = (_a = this.options[value]) === null || _a === void 0 ? void 0 : _a.label) !== null && _b !== void 0 ? _b : '< invalid value >';
23
23
  }
24
- if (value == null || value.length === 0)
24
+ if (value == null || value.length === 0) {
25
25
  return '';
26
+ }
26
27
  const values = Array.prototype.slice.call(value);
27
28
  values.sort((a, b) => {
28
29
  const left = this.options[a];
@@ -45,9 +46,7 @@ function withChoices(Base) {
45
46
  });
46
47
  }
47
48
  toJSON() {
48
- return Object.assign(Object.assign({}, super.toJSON()), { options: Object.keys(this.options).map((key) => {
49
- return this.options[key].toJSON();
50
- }) });
49
+ return Object.assign(Object.assign({}, super.toJSON()), { options: this.values(this.options) });
51
50
  }
52
51
  };
53
52
  }
@@ -60,6 +59,28 @@ class ChoiceType extends withChoices(parser_type_system_1.Type) {
60
59
  super(name);
61
60
  this.multipleOptions = (_a = config === null || config === void 0 ? void 0 : config.multiple) !== null && _a !== void 0 ? _a : false;
62
61
  }
62
+ is(value) {
63
+ if (this.multipleOptions) {
64
+ return Array.isArray(value) && value.every((item) => this.hasOption(item));
65
+ }
66
+ return this.hasOption(value);
67
+ }
68
+ parse(value) {
69
+ if (this.is(value)) {
70
+ return value;
71
+ }
72
+ if (this.multipleOptions) {
73
+ throw new SyntaxError('Expected an array of declared choice values');
74
+ }
75
+ throw new SyntaxError('Expected a declared choice value');
76
+ }
77
+ hasOption(value) {
78
+ var _a;
79
+ if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean') {
80
+ return false;
81
+ }
82
+ return ((_a = this.options[String(value)]) === null || _a === void 0 ? void 0 : _a.value) === value;
83
+ }
63
84
  }
64
85
  exports.ChoiceType = ChoiceType;
65
86
  //# sourceMappingURL=ChoiceType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChoiceType.js","sourceRoot":"","sources":["../../../src/types/primitives/ChoiceType.ts"],"names":[],"mappings":";;;;AAAA,8CAA2C;AAC3C,wEAAuD;AAMvD;;GAEG;AACH,qBAAwE,IAAW;IACjF,OAAO,KAAM,SAAQ,IAAI;QAAlB;;YACL,YAAO,GAA+B,EAAE,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AAK,CAAC,GAAG,IAAI,uBAAU,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC1D,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;YACvB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC7B,CAAC;QAED,MAAM,CAAC,GAAQ;YACb,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;gBAClC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;YAC3B,CAAC,CAAC,CAAC;QACL,CAAC;QAED,MAAM;YACJ,uCACK,KAAK,CAAC,MAAM,EAAE,KACjB,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;oBAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC;gBACpC,CAAC,CAAC,IACF;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,gBAAiC,SAAQ,WAAW,CAAC,yBAAI,CAAC;IACxD,MAAM,CAAC,YAAY,CAAC,IAAiB;QACnC,OAAO,IAAI,IAAI,IAAI,IAAI,SAAS,IAAI,IAAI,IAAI,WAAW,IAAI,IAAI,CAAC;IAClE,CAAC;IAED,YAAY,IAAY,EAAE,MAAyB;;QACjD,KAAK,CAAC,IAAI,CAAC,CAAC;QACZ,IAAI,CAAC,eAAe,SAAG,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,mCAAI,KAAK,CAAC;IACnD,CAAC;CACF","sourcesContent":["import { EnumOption } from '../EnumOption';\nimport { Type } from '@ja-platform/parser-type-system';\n\nexport interface ChoiceTypeConfig {\n multiple: boolean;\n}\n\n/**\n * Add schema option labels without replacing the underlying value type.\n */\nexport function withChoices<TBase extends new (...args: any[]) => Type>(Base: TBase) {\n return class extends Base {\n options: Record<string, EnumOption> = {};\n multipleOptions = false;\n hasOptions = false;\n\n format(value: any): string {\n if (!this.multipleOptions) {\n return this.options[value]?.label ?? '< invalid value >';\n }\n if (value == null || value.length === 0) return '';\n const values: any[] = Array.prototype.slice.call(value);\n values.sort((a, b) => {\n const left = this.options[a];\n const right = this.options[b];\n return left == null || right == null ? 0 : left.index - right.index;\n });\n return values.map((item) => this.options[item]?.label ?? '< invalid value >').join(', ');\n }\n\n addOption(value: any, label: string, index: number): EnumOption {\n if (value in this.options) {\n throw new Error(\"key '\" + value + \"' is already used\");\n }\n this.options[value] = new EnumOption(value, label, index);\n this.hasOptions = true;\n return this.options[value];\n }\n\n values(obj: any) {\n return Object.keys(obj).map((key) => {\n return obj[key].toJSON();\n });\n }\n\n toJSON(): any {\n return {\n ...super.toJSON(),\n options: Object.keys(this.options).map((key) => {\n return this.options[key].toJSON();\n })\n };\n }\n };\n}\n\nexport abstract class ChoiceType extends withChoices(Type) {\n static isInstanceOf(type: Type | null): type is ChoiceType {\n return type != null && 'options' in type && 'addOption' in type;\n }\n\n constructor(name: string, config?: ChoiceTypeConfig) {\n super(name);\n this.multipleOptions = config?.multiple ?? false;\n }\n}\n"]}
1
+ {"version":3,"file":"ChoiceType.js","sourceRoot":"","sources":["../../../src/types/primitives/ChoiceType.ts"],"names":[],"mappings":";;;;AAAA,8CAA2C;AAC3C,wEAAuD;AAMvD;;GAEG;AACH,qBAAwE,IAAW;IACjF,OAAO,KAAM,SAAQ,IAAI;QAAlB;;YACL,YAAO,GAA+B,EAAE,CAAC;YACzC,oBAAe,GAAG,KAAK,CAAC;YACxB,eAAU,GAAG,KAAK,CAAC;QAuCrB,CAAC;QArCC,MAAM,CAAC,KAAU;;;YACf,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;gBAC1B,aAAO,MAAA,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,0CAAE,KAAK,mCAAI,mBAAmB,CAAC;YAC3D,CAAC;YACD,IAAI,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5D,CAAC;IAEO,SAAS,CAAC,KAAc;;QAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;YACzF,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,CAAA,MAAA,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,0CAAE,KAAK,MAAK,KAAK,CAAC;IACtD,CAAC;CACF","sourcesContent":["import { EnumOption } from '../EnumOption';\nimport { Type } from '@ja-platform/parser-type-system';\n\nexport interface ChoiceTypeConfig {\n multiple: boolean;\n}\n\n/**\n * Add schema option labels without replacing the underlying value type.\n */\nexport function withChoices<TBase extends new (...args: any[]) => Type>(Base: TBase) {\n return class extends Base {\n options: Record<string, EnumOption> = {};\n multipleOptions = false;\n hasOptions = false;\n\n format(value: any): string {\n if (!this.multipleOptions) {\n return this.options[value]?.label ?? '< invalid value >';\n }\n if (value == null || value.length === 0) {\n return '';\n }\n const values: any[] = Array.prototype.slice.call(value);\n values.sort((a, b) => {\n const left = this.options[a];\n const right = this.options[b];\n return left == null || right == null ? 0 : left.index - right.index;\n });\n return values.map((item) => this.options[item]?.label ?? '< invalid value >').join(', ');\n }\n\n addOption(value: any, label: string, index: number): EnumOption {\n if (value in this.options) {\n throw new Error(\"key '\" + value + \"' is already used\");\n }\n this.options[value] = new EnumOption(value, label, index);\n this.hasOptions = true;\n return this.options[value];\n }\n\n values(obj: any) {\n return Object.keys(obj).map((key) => {\n return obj[key].toJSON();\n });\n }\n\n toJSON(): any {\n return {\n ...super.toJSON(),\n options: this.values(this.options)\n };\n }\n };\n}\n\nexport abstract class ChoiceType extends withChoices(Type) {\n static isInstanceOf(type: Type | null): type is ChoiceType {\n return type != null && 'options' in type && 'addOption' in type;\n }\n\n constructor(name: string, config?: ChoiceTypeConfig) {\n super(name);\n this.multipleOptions = config?.multiple ?? false;\n }\n\n is(value: unknown): boolean {\n if (this.multipleOptions) {\n return Array.isArray(value) && value.every((item) => this.hasOption(item));\n }\n return this.hasOption(value);\n }\n\n parse(value: unknown) {\n if (this.is(value)) {\n return value;\n }\n if (this.multipleOptions) {\n throw new SyntaxError('Expected an array of declared choice values');\n }\n throw new SyntaxError('Expected a declared choice value');\n }\n\n private hasOption(value: unknown): boolean {\n if (typeof value !== 'string' && typeof value !== 'number' && typeof value !== 'boolean') {\n return false;\n }\n return this.options[String(value)]?.value === value;\n }\n}\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "engines": {
4
4
  "node": "^22.19.0 || ^24.11.0 || >=26.0.0"
5
5
  },
6
- "version": "0.0.0-dev-20261112183707",
6
+ "version": "0.0.0-dev-20261118192020",
7
7
  "description": "JourneyApps Platform resolved schema models and types",
8
8
  "main": "./dist/index.js",
9
9
  "typings": "./dist/@types/index.d.ts",
@@ -11,8 +11,8 @@
11
11
  "dist"
12
12
  ],
13
13
  "dependencies": {
14
- "@ja-platform/parser-expressions": "0.0.0-dev-20261112183707",
15
- "@ja-platform/parser-type-system": "0.0.0-dev-20261112183707",
14
+ "@ja-platform/parser-expressions": "0.0.0-dev-20261118192020",
15
+ "@ja-platform/parser-type-system": "0.0.0-dev-20261118192020",
16
16
  "moment": "^2.31.0"
17
17
  },
18
18
  "devDependencies": {