@ja-platform/parser-schema 0.0.0-dev-20261019214152 → 0.0.0-dev-20261021194038
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.
- package/dist/@types/day/Day.d.ts +48 -4
- package/dist/@types/expressions/parseParameterValueProvider.d.ts +5 -0
- package/dist/@types/index.d.ts +6 -6
- package/dist/@types/schema/Schema.d.ts +6 -22
- package/dist/@types/schema/TypeFactory.d.ts +3 -4
- package/dist/@types/schema/fieldMetadata.d.ts +5 -0
- package/dist/@types/types/EnumOption.d.ts +0 -2
- package/dist/@types/types/Field.d.ts +24 -0
- package/dist/@types/types/Param.d.ts +4 -4
- package/dist/@types/types/SchemaModelType.d.ts +9 -25
- package/dist/@types/types/primitives/Date.d.ts +2 -1
- package/dist/day/Day.js +89 -97
- package/dist/day/Day.js.map +1 -1
- package/dist/expressions/parseParameterValueProvider.js +13 -0
- package/dist/expressions/parseParameterValueProvider.js.map +1 -0
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/schema/Schema.js +7 -69
- package/dist/schema/Schema.js.map +1 -1
- package/dist/schema/TypeFactory.js.map +1 -1
- package/dist/schema/fieldMetadata.js +35 -0
- package/dist/schema/fieldMetadata.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/EnumOption.js.map +1 -1
- package/dist/types/Field.js +28 -0
- package/dist/types/Field.js.map +1 -0
- package/dist/types/Param.js +2 -12
- package/dist/types/Param.js.map +1 -1
- package/dist/types/SchemaModelType.js +4 -28
- package/dist/types/SchemaModelType.js.map +1 -1
- package/dist/types/primitives/Date.js +8 -7
- package/dist/types/primitives/Date.js.map +1 -1
- package/package.json +5 -8
- package/dist/@types/Version.d.ts +0 -19
- package/dist/@types/day/DayConstructorInterface.d.ts +0 -50
- package/dist/@types/day/DayInterface.d.ts +0 -34
- package/dist/@types/day/index.d.ts +0 -2
- package/dist/@types/schema/SchemaParserErrors.d.ts +0 -10
- package/dist/@types/schema/reservedNames.d.ts +0 -7
- package/dist/@types/schema/schemaParser.d.ts +0 -43
- package/dist/@types/schema/schemaSerializer.d.ts +0 -11
- package/dist/@types/types/FunctionType.d.ts +0 -15
- package/dist/@types/types/Variable.d.ts +0 -32
- package/dist/Version.js +0 -76
- package/dist/Version.js.map +0 -1
- package/dist/day/DayConstructorInterface.js +0 -3
- package/dist/day/DayConstructorInterface.js.map +0 -1
- package/dist/day/DayInterface.js +0 -3
- package/dist/day/DayInterface.js.map +0 -1
- package/dist/day/index.js +0 -19
- package/dist/day/index.js.map +0 -1
- package/dist/schema/SchemaParserErrors.js +0 -26
- package/dist/schema/SchemaParserErrors.js.map +0 -1
- package/dist/schema/reservedNames.js +0 -101
- package/dist/schema/reservedNames.js.map +0 -1
- package/dist/schema/schemaParser.js +0 -1135
- package/dist/schema/schemaParser.js.map +0 -1
- package/dist/schema/schemaSerializer.js +0 -181
- package/dist/schema/schemaSerializer.js.map +0 -1
- package/dist/types/FunctionType.js +0 -30
- package/dist/types/FunctionType.js.map +0 -1
- package/dist/types/Variable.js +0 -49
- package/dist/types/Variable.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Date.js","sourceRoot":"","sources":["../../../src/types/primitives/Date.ts"],"names":[],"mappings":";;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"Date.js","sourceRoot":"","sources":["../../../src/types/primitives/Date.ts"],"names":[],"mappings":";;;;;;AAAA,uCAAoC;AACpC,2CAA2C;AAC3C,oDAA4B;AAC5B,wEAAuD;AAEvD,cAAsB,SAAQ,yBAAI;IAKhC,MAAM,CAAC,YAAY,CAAC,IAAiB;QACnC,OAAO,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,MAAK,QAAQ,CAAC,IAAI,CAAC;IAC3C,CAAC;IAGD;QACE,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QATd,cAAS,GAAG,MAAM,CAAC;IAU5B,CAAC;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AAK,CAAC,CAAC;YACzB,CAAC;iBAAM,IAAI,SAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC5B,OAAO,KAAK,CAAC,MAAM,EAAE,CAAC;YACxB,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,KAAK,GAAG,gBAAgB,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC;IACH,CAAC;CACF;;AAxDQ,uBAAc,GAAG,aAAa,AAAhB,CAAiB;AAEtB,aAAI,GAAG,MAAM,AAAT,CAAU","sourcesContent":["import { Day } from '../../day/Day';\nimport { pureDate } from '../../day/utils';\nimport moment from 'moment';\nimport { Type } from '@ja-platform/parser-type-system';\n\nexport class DateType extends Type {\n static DEFAULT_FORMAT = 'MMMM D YYYY';\n readonly _typeName = 'date';\n static readonly TYPE = 'date';\n\n static isInstanceOf(type: Type | null): type is DateType {\n return type?._typeName === DateType.TYPE;\n }\n isDay?: boolean;\n\n constructor() {\n super(DateType.TYPE);\n }\n\n // Return either {} or {isDay: true}.\n // For consistency, we never return {isDay: undefined} or {isDay: false}.\n toJSON(): any {\n const json: { isDay?: boolean } = super.toJSON();\n if (this.isDay) {\n json.isDay = true;\n }\n return json;\n }\n format(value: any, format?: string) {\n // Works for Date and Day objects.\n if (Day.isDay(value)) {\n value = value.toDate();\n }\n const d = moment(value).utc();\n return d.format(format ?? DateType.DEFAULT_FORMAT);\n }\n\n is(value: any): boolean {\n return this.isDay ? Day.isDay(value) : value instanceof Date;\n }\n\n parse(value: any) {\n if (this.isDay) {\n if (Day.isDay(value)) {\n return value;\n } else if (value instanceof Date) {\n // Convert from local timezone\n return new Day(value);\n } else {\n throw new Error(value + ' is not a Day');\n }\n } else {\n if (value instanceof Date) {\n // Assume UTC timezone\n return pureDate(value);\n } else if (Day.isDay(value)) {\n return value.toDate();\n } else {\n throw new Error(value + ' is not a Date');\n }\n }\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -3,22 +3,19 @@
|
|
|
3
3
|
"engines": {
|
|
4
4
|
"node": "^22.19.0 || ^24.11.0 || >=26.0.0"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.0.0-dev-
|
|
7
|
-
"description": "
|
|
6
|
+
"version": "0.0.0-dev-20261021194038",
|
|
7
|
+
"description": "JourneyApps Platform resolved schema models and types",
|
|
8
8
|
"main": "./dist/index.js",
|
|
9
9
|
"typings": "./dist/@types/index.d.ts",
|
|
10
10
|
"files": [
|
|
11
11
|
"dist"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@ja-platform/parser-expressions": "^0.0.0-dev-
|
|
15
|
-
"@ja-platform/parser-type-system": "^0.0.0-dev-
|
|
16
|
-
"
|
|
17
|
-
"moment": "^2.31.0",
|
|
18
|
-
"@journeyapps/domparser": "^0.4.1"
|
|
14
|
+
"@ja-platform/parser-expressions": "^0.0.0-dev-20261021194038",
|
|
15
|
+
"@ja-platform/parser-type-system": "^0.0.0-dev-20261021194038",
|
|
16
|
+
"moment": "^2.31.0"
|
|
19
17
|
},
|
|
20
18
|
"devDependencies": {
|
|
21
|
-
"stream-browserify": "^3.0.0",
|
|
22
19
|
"vitest": "^5.0.5",
|
|
23
20
|
"@vitest/browser": "^5.0.5",
|
|
24
21
|
"@vitest/browser-webdriverio": "^5.0.0",
|
package/dist/@types/Version.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Version-related functions
|
|
3
|
-
*/
|
|
4
|
-
export declare class Version {
|
|
5
|
-
major: number;
|
|
6
|
-
minor: number;
|
|
7
|
-
hasPatch: boolean;
|
|
8
|
-
patch: number;
|
|
9
|
-
v3: boolean;
|
|
10
|
-
v3_1: boolean;
|
|
11
|
-
v2: boolean;
|
|
12
|
-
constructor(str: string);
|
|
13
|
-
toString(): string;
|
|
14
|
-
valueOf(): string;
|
|
15
|
-
compareTo(other: Version): -1 | 0 | 1;
|
|
16
|
-
supportsApi(api: string | Version): boolean;
|
|
17
|
-
gte(other: string | Version): boolean;
|
|
18
|
-
}
|
|
19
|
-
export declare const DEFAULT: Version;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { Day } from './DayInterface';
|
|
2
|
-
export interface DayConstructor {
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
* @param year number, e.g. 2001
|
|
6
|
-
* @param month 0-11
|
|
7
|
-
* @param day 1-31
|
|
8
|
-
*/
|
|
9
|
-
new (year: number, month: number, day: number): Day;
|
|
10
|
-
/**
|
|
11
|
-
* Construct from a Date(time) object, using the date in the local timezone.
|
|
12
|
-
*/
|
|
13
|
-
new (date: Date): Day;
|
|
14
|
-
/**
|
|
15
|
-
* Clone a Day object.
|
|
16
|
-
*/
|
|
17
|
-
new (date: Day): Day;
|
|
18
|
-
/**
|
|
19
|
-
* Parse a date string, for example:
|
|
20
|
-
*
|
|
21
|
-
* new Day("2014-02-15")
|
|
22
|
-
* new Day("2014-02-15T13:15")
|
|
23
|
-
* new Day("2014-02-15T13:15:11+02")
|
|
24
|
-
* new Day("2014-02-15T11:15:11Z")
|
|
25
|
-
*
|
|
26
|
-
* @param date - date string
|
|
27
|
-
*/
|
|
28
|
-
new (date: string): Day;
|
|
29
|
-
/**
|
|
30
|
-
* Construct from a timestamp number.
|
|
31
|
-
*
|
|
32
|
-
* Must be at exactly 00:00 in UTC.
|
|
33
|
-
*
|
|
34
|
-
* @param date - timestamp in ms
|
|
35
|
-
*/
|
|
36
|
-
new (date: number): Day;
|
|
37
|
-
/**
|
|
38
|
-
* Today in the current timezone.
|
|
39
|
-
*/
|
|
40
|
-
new (): Day;
|
|
41
|
-
/**
|
|
42
|
-
* Today in the current timezone.
|
|
43
|
-
*/
|
|
44
|
-
today(): Day;
|
|
45
|
-
fromUTCDate(date: Date): Day;
|
|
46
|
-
/**
|
|
47
|
-
* Return true if the argument is a Day object.
|
|
48
|
-
*/
|
|
49
|
-
isDay(obj: any): obj is Day;
|
|
50
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export interface Day {
|
|
2
|
-
/**
|
|
3
|
-
* Start of the Day (00:00) in UTC.
|
|
4
|
-
*/
|
|
5
|
-
toDate(): Date;
|
|
6
|
-
toString(): string;
|
|
7
|
-
toJSON(): string;
|
|
8
|
-
toISOString(): string;
|
|
9
|
-
valueOf(): number;
|
|
10
|
-
/**
|
|
11
|
-
* Start of the Day (00:00) in the local timezone.
|
|
12
|
-
*/
|
|
13
|
-
startOfDay(): Date;
|
|
14
|
-
/**
|
|
15
|
-
* End of the Day (23:59:59.999) in the local timezone.
|
|
16
|
-
*/
|
|
17
|
-
endOfDay(): Date;
|
|
18
|
-
/**
|
|
19
|
-
* @return a number representing the year, e.g. 2017
|
|
20
|
-
*/
|
|
21
|
-
getYear(): number;
|
|
22
|
-
/**
|
|
23
|
-
* @return a number from 0-11 representing the month. 0 is January, 11 is December
|
|
24
|
-
*/
|
|
25
|
-
getMonth(): number;
|
|
26
|
-
/**
|
|
27
|
-
* @return a number from 1-31 representing the day of month.
|
|
28
|
-
*/
|
|
29
|
-
getDay(): number;
|
|
30
|
-
/**
|
|
31
|
-
* @return a number from 0-6 representing the day of week. 0 is Sunday, 6 is Saturday.
|
|
32
|
-
*/
|
|
33
|
-
getDayOfWeek(): number;
|
|
34
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ValidationError, XMLDiagnostic } from '@journeyapps/common-xml';
|
|
2
|
-
import { XMLError } from '@journeyapps/domparser/types';
|
|
3
|
-
export declare class SchemaParserErrors {
|
|
4
|
-
private errors;
|
|
5
|
-
constructor();
|
|
6
|
-
pushError({ element, message, type }: XMLDiagnostic): void;
|
|
7
|
-
pushErrors(newErrors: (ValidationError | XMLError)[]): void;
|
|
8
|
-
reset(): void;
|
|
9
|
-
getErrors(): (ValidationError | XMLError)[];
|
|
10
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ErrorType } from '@journeyapps/common-xml';
|
|
2
|
-
export declare const RESERVED_WORDS: string[];
|
|
3
|
-
export declare const STRICT_RESERVED_WORDS: string[];
|
|
4
|
-
export declare const CONTEXTUAL_KEYWORDS: string[];
|
|
5
|
-
export declare const TYPE_BLACKLIST: Record<string, boolean>;
|
|
6
|
-
export declare function validateModelName(name: string): null | ErrorType;
|
|
7
|
-
export declare function validateFieldName(name: string): null | ErrorType;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { ArrayType } from '@ja-platform/parser-type-system';
|
|
2
|
-
import { QueryType } from '../types/QueryType';
|
|
3
|
-
import { FunctionExpression } from '@ja-platform/parser-expressions';
|
|
4
|
-
import { Schema } from './Schema';
|
|
5
|
-
import { SchemaModelType } from '../types/SchemaModelType';
|
|
6
|
-
import { Type } from '@ja-platform/parser-type-system';
|
|
7
|
-
import { Variable } from '../types/Variable';
|
|
8
|
-
import { XMLElement } from '@journeyapps/domparser/types';
|
|
9
|
-
/**
|
|
10
|
-
* Normalize serialized parameter providers once at the schema boundary.
|
|
11
|
-
*/
|
|
12
|
-
export declare function parseParameterValueProvider(source: string): FunctionExpression;
|
|
13
|
-
export declare const ATTACHMENT_MEDIA_TYPES: string[];
|
|
14
|
-
export declare const TEXT_SUBTYPES: string[];
|
|
15
|
-
export interface ParseVersion {
|
|
16
|
-
v3?: boolean;
|
|
17
|
-
v3_1?: boolean;
|
|
18
|
-
}
|
|
19
|
-
export interface SchemaParser {
|
|
20
|
-
parse: (rawxml: string) => void;
|
|
21
|
-
parseField: (element: XMLElement, isVariable?: boolean) => Variable;
|
|
22
|
-
validateVariableAttributes: (element: XMLElement, options?: {
|
|
23
|
-
validateType?: boolean;
|
|
24
|
-
}) => void;
|
|
25
|
-
parseObjectType: (element: XMLElement) => SchemaModelType;
|
|
26
|
-
parseBelongsTo: (object: SchemaModelType, element: XMLElement) => void;
|
|
27
|
-
parseDisplay: (object: SchemaModelType, element: XMLElement) => SchemaModelType;
|
|
28
|
-
reset: () => void;
|
|
29
|
-
getErrors: () => any[];
|
|
30
|
-
}
|
|
31
|
-
export declare function parser(schema: Schema, options?: {
|
|
32
|
-
version?: ParseVersion;
|
|
33
|
-
recordSource?: boolean;
|
|
34
|
-
}): SchemaParser;
|
|
35
|
-
/**
|
|
36
|
-
* Apply serialized field metadata to a variable whose type is already resolved.
|
|
37
|
-
*/
|
|
38
|
-
export declare function applyVariableMetadata(variable: Variable, attributeData: any): Variable<Type<any>>;
|
|
39
|
-
export declare function parseJsonVariable(schema: Schema, attributeName: string, attributeData: any): Variable<ArrayType> | Variable<QueryType> | Variable<Type<any>>;
|
|
40
|
-
export declare function parseJsonField(schema: Schema, attributeData: any): Variable<Type<any>>;
|
|
41
|
-
export declare function jsonParser(schema: Schema): {
|
|
42
|
-
parse: (data: any) => void;
|
|
43
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Schema } from './Schema';
|
|
2
|
-
import { OrderedIncrementalUpdater } from '@journeyapps/common-xml';
|
|
3
|
-
import { XMLDocument } from '@journeyapps/domparser/types';
|
|
4
|
-
import { Variable } from '../types/Variable';
|
|
5
|
-
export declare function toDOM(schema: Schema): XMLDocument;
|
|
6
|
-
/**
|
|
7
|
-
* Update the options for single-choice, single-choice-integer and boolean fields.
|
|
8
|
-
*
|
|
9
|
-
* No-op for other fields.
|
|
10
|
-
*/
|
|
11
|
-
export declare function updateOptions(fieldDiff: OrderedIncrementalUpdater, attribute: Variable): void;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { AbstractObjectTypeFactory } from '../schema/TypeFactory';
|
|
2
|
-
import { Type } from '@ja-platform/parser-type-system';
|
|
3
|
-
import { Variable } from './Variable';
|
|
4
|
-
export declare class FunctionType extends Type {
|
|
5
|
-
static readonly TYPE = "function";
|
|
6
|
-
static readonly ARG_TAG = "arg";
|
|
7
|
-
static isInstanceOf(type: Type): type is FunctionType;
|
|
8
|
-
arguments: Variable[];
|
|
9
|
-
constructor();
|
|
10
|
-
addArgument(argument: Variable): void;
|
|
11
|
-
}
|
|
12
|
-
export declare class FunctionTypeFactory extends AbstractObjectTypeFactory<FunctionType> {
|
|
13
|
-
constructor();
|
|
14
|
-
generate(): FunctionType;
|
|
15
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { AbstractObjectTypeFactory, GenerateTypeEvent } from '../schema/TypeFactory';
|
|
2
|
-
import { Type } from '@ja-platform/parser-type-system';
|
|
3
|
-
import { XMLElement } from '@journeyapps/domparser/types';
|
|
4
|
-
export interface VariableJsonType {
|
|
5
|
-
name: string;
|
|
6
|
-
type: string;
|
|
7
|
-
label?: string;
|
|
8
|
-
[key: string]: any;
|
|
9
|
-
}
|
|
10
|
-
export declare class Variable<T extends Type = Type> {
|
|
11
|
-
static TYPE: string;
|
|
12
|
-
static isInstanceOf(obj: any): obj is Variable;
|
|
13
|
-
name: string;
|
|
14
|
-
type: T | null;
|
|
15
|
-
errors: any[];
|
|
16
|
-
label?: string;
|
|
17
|
-
relationship?: string;
|
|
18
|
-
isRelationshipId?: boolean;
|
|
19
|
-
isBelongsToId?: boolean;
|
|
20
|
-
sourceTypeName?: string;
|
|
21
|
-
sourceElement: XMLElement;
|
|
22
|
-
constructor(name: string, type: T | null);
|
|
23
|
-
toJSON(): VariableJsonType;
|
|
24
|
-
}
|
|
25
|
-
export interface GenerateVariableEvent<T extends Type> extends GenerateTypeEvent {
|
|
26
|
-
name: string;
|
|
27
|
-
type: T;
|
|
28
|
-
}
|
|
29
|
-
export declare class VariableFactory<T extends Type = Type> extends AbstractObjectTypeFactory<Variable<T>, GenerateVariableEvent<T>> {
|
|
30
|
-
constructor();
|
|
31
|
-
generate<T extends Type = Type>(event: GenerateVariableEvent<T>): Variable<T>;
|
|
32
|
-
}
|
package/dist/Version.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT = exports.Version = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* Version-related functions
|
|
6
|
-
*/
|
|
7
|
-
class Version {
|
|
8
|
-
constructor(str) {
|
|
9
|
-
var components = str.split('.');
|
|
10
|
-
this.major = parseInt(components[0], 10);
|
|
11
|
-
this.minor = parseInt(components[1], 10);
|
|
12
|
-
this.hasPatch = components.length >= 3;
|
|
13
|
-
if (this.hasPatch) {
|
|
14
|
-
this.patch = parseInt(components[2], 10);
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
this.patch = null;
|
|
18
|
-
}
|
|
19
|
-
this.v3 = this.major >= 3;
|
|
20
|
-
this.v3_1 = (this.v3 && this.minor >= 1) || this.major > 3;
|
|
21
|
-
this.v2 = this.major < 3;
|
|
22
|
-
}
|
|
23
|
-
toString() {
|
|
24
|
-
if (this.patch != null) {
|
|
25
|
-
return this.major + '.' + this.minor + '.' + this.patch;
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
return this.major + '.' + this.minor;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
valueOf() {
|
|
32
|
-
return this.toString();
|
|
33
|
-
}
|
|
34
|
-
// Returns -1 if < other, 0 if equal, 1 if > other.
|
|
35
|
-
compareTo(other) {
|
|
36
|
-
var thisPatch = this.patch == null ? -1 : this.patch;
|
|
37
|
-
var otherPatch = other.patch == null ? -1 : other.patch;
|
|
38
|
-
if (this.major < other.major) {
|
|
39
|
-
return -1;
|
|
40
|
-
}
|
|
41
|
-
else if (this.major > other.major) {
|
|
42
|
-
return 1;
|
|
43
|
-
}
|
|
44
|
-
else if (this.minor < other.minor) {
|
|
45
|
-
return -1;
|
|
46
|
-
}
|
|
47
|
-
else if (this.minor > other.minor) {
|
|
48
|
-
return 1;
|
|
49
|
-
}
|
|
50
|
-
else if (thisPatch < otherPatch) {
|
|
51
|
-
return -1;
|
|
52
|
-
}
|
|
53
|
-
else if (thisPatch > otherPatch) {
|
|
54
|
-
return 1;
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
return 0;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
supportsApi(api) {
|
|
61
|
-
return api != null && this.gte(api) && ver(api).gte('2.0');
|
|
62
|
-
}
|
|
63
|
-
gte(other) {
|
|
64
|
-
const otherVersion = ver(other);
|
|
65
|
-
return this.compareTo(otherVersion) >= 0;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
exports.Version = Version;
|
|
69
|
-
function ver(v) {
|
|
70
|
-
if (typeof v == 'string') {
|
|
71
|
-
v = new Version(v);
|
|
72
|
-
}
|
|
73
|
-
return v;
|
|
74
|
-
}
|
|
75
|
-
exports.DEFAULT = new Version('2.5');
|
|
76
|
-
//# sourceMappingURL=Version.js.map
|
package/dist/Version.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Version.js","sourceRoot":"","sources":["../src/Version.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH;IASE,YAAY,GAAW;QACrB,IAAI,UAAU,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC;QACvC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QACpB,CAAC;QAED,IAAI,CAAC,EAAE,GAAG,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC;QAC1B,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE,IAAI,IAAI,CA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AS,GAAG,UAAU,EAAE,CAAC;YAClC,OAAO,CAAC,CAAC,CAAC;QACZ,CAAC;aAAM,IAAI,SAAS,GAAG,UAAU,EAAE,CAAC;YAClC,OAAO,CAAC,CAAC;QACX,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,CAAC;QACX,CAAC;IACH,CAAC;IAED,WAAW,CAAC,GAAqB;QAC/B,OAAO,GAAG,IAAI,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC7D,CAAC;IAED,GAAG,CAAC,KAAuB;QACzB,MAAM,YAAY,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC;QAChC,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAC3C,CAAC;CACF;;AAED,SAAS,GAAG,CAAC,CAAmB;IAC9B,IAAI,OAAO,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,CAAC,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;IACrB,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAEY,QAAA,OAAO,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC","sourcesContent":["/**\n * Version-related functions\n */\nexport class Version {\n major: number;\n minor: number;\n hasPatch: boolean;\n patch: number;\n v3: boolean;\n v3_1: boolean; // tslint:disable-line\n v2: boolean;\n\n constructor(str: string) {\n var components = str.split('.');\n this.major = parseInt(components[0], 10);\n this.minor = parseInt(components[1], 10);\n this.hasPatch = components.length >= 3;\n if (this.hasPatch) {\n this.patch = parseInt(components[2], 10);\n } else {\n this.patch = null;\n }\n\n this.v3 = this.major >= 3;\n this.v3_1 = (this.v3 && this.minor >= 1) || this.major > 3;\n this.v2 = this.major < 3;\n }\n\n toString() {\n if (this.patch != null) {\n return this.major + '.' + this.minor + '.' + this.patch;\n } else {\n return this.major + '.' + this.minor;\n }\n }\n\n valueOf() {\n return this.toString();\n }\n\n // Returns -1 if < other, 0 if equal, 1 if > other.\n compareTo(other: Version) {\n var thisPatch = this.patch == null ? -1 : this.patch;\n var otherPatch = other.patch == null ? -1 : other.patch;\n if (this.major < other.major) {\n return -1;\n } else if (this.major > other.major) {\n return 1;\n } else if (this.minor < other.minor) {\n return -1;\n } else if (this.minor > other.minor) {\n return 1;\n } else if (thisPatch < otherPatch) {\n return -1;\n } else if (thisPatch > otherPatch) {\n return 1;\n } else {\n return 0;\n }\n }\n\n supportsApi(api: string | Version) {\n return api != null && this.gte(api) && ver(api).gte('2.0');\n }\n\n gte(other: string | Version) {\n const otherVersion = ver(other);\n return this.compareTo(otherVersion) >= 0;\n }\n}\n\nfunction ver(v: string | Version) {\n if (typeof v == 'string') {\n v = new Version(v);\n }\n return v;\n}\n\nexport const DEFAULT = new Version('2.5');\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DayConstructorInterface.js","sourceRoot":"","sources":["../../src/day/DayConstructorInterface.ts"],"names":[],"mappings":"","sourcesContent":["import { Day } from './DayInterface';\n\nexport interface DayConstructor {\n /**\n *\n * @param year number, e.g. 2001\n * @param month 0-11\n * @param day 1-31\n */\n new (year: number, month: number, day: number): Day;\n\n /**\n * Construct from a Date(time) object, using the date in the local timezone.\n */\n new (date: Date): Day;\n\n /**\n * Clone a Day object.\n */\n new (date: Day): Day;\n\n /**\n * Parse a date string, for example:\n *\n * new Day(\"2014-02-15\")\n * new Day(\"2014-02-15T13:15\")\n * new Day(\"2014-02-15T13:15:11+02\")\n * new Day(\"2014-02-15T11:15:11Z\")\n *\n * @param date - date string\n */\n new (date: string): Day;\n\n /**\n * Construct from a timestamp number.\n *\n * Must be at exactly 00:00 in UTC.\n *\n * @param date - timestamp in ms\n */\n new (date: number): Day;\n\n /**\n * Today in the current timezone.\n */\n new (): Day;\n\n /**\n * Today in the current timezone.\n */\n today(): Day;\n fromUTCDate(date: Date): Day;\n\n /**\n * Return true if the argument is a Day object.\n */\n isDay(obj: any): obj is Day;\n}\n"]}
|
package/dist/day/DayInterface.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DayInterface.js","sourceRoot":"","sources":["../../src/day/DayInterface.ts"],"names":[],"mappings":"","sourcesContent":["export interface Day {\n /**\n * Start of the Day (00:00) in UTC.\n */\n toDate(): Date;\n\n toString(): string;\n\n toJSON(): string;\n\n toISOString(): string;\n\n valueOf(): number;\n\n /**\n * Start of the Day (00:00) in the local timezone.\n */\n startOfDay(): Date;\n\n /**\n * End of the Day (23:59:59.999) in the local timezone.\n */\n endOfDay(): Date;\n\n /**\n * @return a number representing the year, e.g. 2017\n */\n getYear(): number;\n\n /**\n * @return a number from 0-11 representing the month. 0 is January, 11 is December\n */\n getMonth(): number;\n\n /**\n * @return a number from 1-31 representing the day of month.\n */\n getDay(): number;\n\n /**\n * @return a number from 0-6 representing the day of week. 0 is Sunday, 6 is Saturday.\n */\n getDayOfWeek(): number;\n}\n"]}
|
package/dist/day/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./Day"), exports);
|
|
18
|
-
__exportStar(require("./utils"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
package/dist/day/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/day/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAsB;AACtB,0CAAwB","sourcesContent":["export * from './Day';\nexport * from './utils';\n"]}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SchemaParserErrors = void 0;
|
|
4
|
-
const common_xml_1 = require("@journeyapps/common-xml");
|
|
5
|
-
class SchemaParserErrors {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.errors = [];
|
|
8
|
-
}
|
|
9
|
-
pushError({ element, message, type }) {
|
|
10
|
-
this.errors.push((0, common_xml_1.error)(element, message, type));
|
|
11
|
-
}
|
|
12
|
-
pushErrors(newErrors) {
|
|
13
|
-
for (let i = 0; i < newErrors.length; i++) {
|
|
14
|
-
const err = newErrors[i];
|
|
15
|
-
this.errors.push(err);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
reset() {
|
|
19
|
-
this.errors = [];
|
|
20
|
-
}
|
|
21
|
-
getErrors() {
|
|
22
|
-
return this.errors;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
exports.SchemaParserErrors = SchemaParserErrors;
|
|
26
|
-
//# sourceMappingURL=SchemaParserErrors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaParserErrors.js","sourceRoot":"","sources":["../../src/schema/SchemaParserErrors.ts"],"names":[],"mappings":";;;AAAA,wDAAgF;AAGhF;IAGE;QACE,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,SAAS,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAiB;QACjD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAA,kBAAK,EAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,UAAU,CAAC,SAAyC;QAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC1C,MAAM,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;YACzB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,KAAK;QACH,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF","sourcesContent":["import { error, ValidationError, XMLDiagnostic } from '@journeyapps/common-xml';\nimport { XMLError } from '@journeyapps/domparser/types';\n\nexport class SchemaParserErrors {\n private errors: (ValidationError | XMLError)[];\n\n constructor() {\n this.errors = [];\n }\n\n pushError({ element, message, type }: XMLDiagnostic) {\n this.errors.push(error(element, message, type));\n }\n\n pushErrors(newErrors: (ValidationError | XMLError)[]) {\n for (let i = 0; i < newErrors.length; i++) {\n const err = newErrors[i];\n this.errors.push(err);\n }\n }\n\n reset() {\n this.errors = [];\n }\n\n getErrors() {\n return this.errors;\n }\n}\n"]}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TYPE_BLACKLIST = exports.CONTEXTUAL_KEYWORDS = exports.STRICT_RESERVED_WORDS = exports.RESERVED_WORDS = void 0;
|
|
4
|
-
exports.validateModelName = validateModelName;
|
|
5
|
-
exports.validateFieldName = validateFieldName;
|
|
6
|
-
exports.RESERVED_WORDS = [
|
|
7
|
-
'break',
|
|
8
|
-
'case',
|
|
9
|
-
'catch',
|
|
10
|
-
'class',
|
|
11
|
-
'const',
|
|
12
|
-
'continue',
|
|
13
|
-
'debugger',
|
|
14
|
-
'default',
|
|
15
|
-
'delete',
|
|
16
|
-
'do',
|
|
17
|
-
'else',
|
|
18
|
-
'enum',
|
|
19
|
-
'export',
|
|
20
|
-
'extends',
|
|
21
|
-
'false',
|
|
22
|
-
'finally',
|
|
23
|
-
'for',
|
|
24
|
-
'function',
|
|
25
|
-
'if',
|
|
26
|
-
'import',
|
|
27
|
-
'in',
|
|
28
|
-
'instanceof',
|
|
29
|
-
'new',
|
|
30
|
-
'null',
|
|
31
|
-
'return',
|
|
32
|
-
'super',
|
|
33
|
-
'switch',
|
|
34
|
-
'this',
|
|
35
|
-
'throw',
|
|
36
|
-
'true',
|
|
37
|
-
'try',
|
|
38
|
-
'typeof',
|
|
39
|
-
'var',
|
|
40
|
-
'void',
|
|
41
|
-
'while',
|
|
42
|
-
'with'
|
|
43
|
-
];
|
|
44
|
-
// These currently appear to work fine as interface names.
|
|
45
|
-
// Listed here for reference only
|
|
46
|
-
exports.STRICT_RESERVED_WORDS = [
|
|
47
|
-
'as',
|
|
48
|
-
'implements',
|
|
49
|
-
'interface',
|
|
50
|
-
'let',
|
|
51
|
-
'package',
|
|
52
|
-
'private',
|
|
53
|
-
'protected',
|
|
54
|
-
'public',
|
|
55
|
-
'static',
|
|
56
|
-
'yield'
|
|
57
|
-
];
|
|
58
|
-
// Some of these appear to work as interface names, but we blacklist them all.
|
|
59
|
-
exports.CONTEXTUAL_KEYWORDS = [
|
|
60
|
-
'any',
|
|
61
|
-
'boolean',
|
|
62
|
-
'constructor',
|
|
63
|
-
'declare',
|
|
64
|
-
'get',
|
|
65
|
-
'module',
|
|
66
|
-
'require',
|
|
67
|
-
'number',
|
|
68
|
-
'set',
|
|
69
|
-
'string',
|
|
70
|
-
'symbol',
|
|
71
|
-
'type',
|
|
72
|
-
'from',
|
|
73
|
-
'of'
|
|
74
|
-
];
|
|
75
|
-
exports.TYPE_BLACKLIST = {};
|
|
76
|
-
for (let key of exports.CONTEXTUAL_KEYWORDS) {
|
|
77
|
-
exports.TYPE_BLACKLIST[key] = true;
|
|
78
|
-
}
|
|
79
|
-
for (let key of exports.RESERVED_WORDS) {
|
|
80
|
-
exports.TYPE_BLACKLIST[key] = true;
|
|
81
|
-
}
|
|
82
|
-
const JOURNEY_RESERVED_NAMES = ['object', 'account', 'id', 'type'];
|
|
83
|
-
const JOURNEY_RESERVED_FIELD_NAMES = [...JOURNEY_RESERVED_NAMES, '_id', '_type', 'account_id', 'attribute'];
|
|
84
|
-
function validateModelName(name) {
|
|
85
|
-
if (JOURNEY_RESERVED_NAMES.indexOf(name) >= 0) {
|
|
86
|
-
return 'error';
|
|
87
|
-
}
|
|
88
|
-
else if (name in exports.TYPE_BLACKLIST) {
|
|
89
|
-
// These cause issues with TypeScript definitions, but are fine for regular JS.
|
|
90
|
-
// To not force a migration of existing apps, we just mark this as a warning.
|
|
91
|
-
return 'warning';
|
|
92
|
-
}
|
|
93
|
-
return null;
|
|
94
|
-
}
|
|
95
|
-
function validateFieldName(name) {
|
|
96
|
-
if (JOURNEY_RESERVED_FIELD_NAMES.indexOf(name) >= 0) {
|
|
97
|
-
return 'error';
|
|
98
|
-
}
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
|
-
//# sourceMappingURL=reservedNames.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reservedNames.js","sourceRoot":"","sources":["../../src/schema/reservedNames.ts"],"names":[],"mappings":";;;;;AAGa,QAAA,cAAc,GAAG;IAC5B,OAAO;IACP,MAAM;IACN,OAAO;IACP,OAAO;IACP,OAAO;IACP,UAAU;IACV,UAAU;IACV,SAAS;IACT,QAAQ;IACR,IAAI;IACJ,MAAM;IACN,MAAM;IACN,QAAQ;IACR,SAAS;IACT,OAAO;IACP,SAAS;IACT,KAAK;IACL,UAAU;IACV,IAAI;IACJ,QAAQ;IACR,IA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C;QAClC,+EAA+E;QAC/E,6EAA6E;QAC7E,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,2BAAkC,IAAY;IAC5C,IAAI,4BAA4B,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;QACpD,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["// From: https://github.com/Microsoft/TypeScript/issues/2536\nimport { ErrorType } from '@journeyapps/common-xml';\n\nexport const RESERVED_WORDS = [\n 'break',\n 'case',\n 'catch',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'else',\n 'enum',\n 'export',\n 'extends',\n 'false',\n 'finally',\n 'for',\n 'function',\n 'if',\n 'import',\n 'in',\n 'instanceof',\n 'new',\n 'null',\n 'return',\n 'super',\n 'switch',\n 'this',\n 'throw',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'while',\n 'with'\n];\n\n// These currently appear to work fine as interface names.\n// Listed here for reference only\nexport const STRICT_RESERVED_WORDS = [\n 'as',\n 'implements',\n 'interface',\n 'let',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'static',\n 'yield'\n];\n\n// Some of these appear to work as interface names, but we blacklist them all.\nexport const CONTEXTUAL_KEYWORDS = [\n 'any',\n 'boolean',\n 'constructor',\n 'declare',\n 'get',\n 'module',\n 'require',\n 'number',\n 'set',\n 'string',\n 'symbol',\n 'type',\n 'from',\n 'of'\n];\n\nexport const TYPE_BLACKLIST: Record<string, boolean> = {};\n\nfor (let key of CONTEXTUAL_KEYWORDS) {\n TYPE_BLACKLIST[key] = true;\n}\n\nfor (let key of RESERVED_WORDS) {\n TYPE_BLACKLIST[key] = true;\n}\n\nconst JOURNEY_RESERVED_NAMES = ['object', 'account', 'id', 'type'];\nconst JOURNEY_RESERVED_FIELD_NAMES = [...JOURNEY_RESERVED_NAMES, '_id', '_type', 'account_id', 'attribute'];\n\nexport function validateModelName(name: string): null | ErrorType {\n if (JOURNEY_RESERVED_NAMES.indexOf(name) >= 0) {\n return 'error';\n } else if (name in TYPE_BLACKLIST) {\n // These cause issues with TypeScript definitions, but are fine for regular JS.\n // To not force a migration of existing apps, we just mark this as a warning.\n return 'warning';\n }\n\n return null;\n}\n\nexport function validateFieldName(name: string): null | ErrorType {\n if (JOURNEY_RESERVED_FIELD_NAMES.indexOf(name) >= 0) {\n return 'error';\n }\n return null;\n}\n"]}
|