@gooddata/code-cli 0.35.0-alpha.0 → 0.35.0-alpha.2
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/NOTICE +3 -3
- package/dist/index.js +426 -427
- package/package.json +1 -1
package/NOTICE
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
The following 3rd-party software packages may be used by or distributed with gdc-analytics-as-code. Any information relevant to third-party vendors listed below are collected using common, reasonable means.
|
|
9
9
|
|
|
10
|
-
Date generated: 2026-5-
|
|
10
|
+
Date generated: 2026-5-26
|
|
11
11
|
|
|
12
|
-
Revision ID:
|
|
12
|
+
Revision ID: b42b72e25119ac36c2fd1496631b92d931308ca6
|
|
13
13
|
|
|
14
14
|
================================================================================
|
|
15
15
|
================================================================================
|
|
@@ -17909,4 +17909,4 @@ POSSIBILITY OF SUCH DAMAGE.
|
|
|
17909
17909
|
--------------------------------------------------------------------------------
|
|
17910
17910
|
--------------------------------------------------------------------------------
|
|
17911
17911
|
|
|
17912
|
-
Report Generated by FOSSA on 2026-5-
|
|
17912
|
+
Report Generated by FOSSA on 2026-5-26
|
package/dist/index.js
CHANGED
|
@@ -37119,7 +37119,7 @@ function isPromise(value) {
|
|
|
37119
37119
|
//#endregion
|
|
37120
37120
|
//#region package.json
|
|
37121
37121
|
var name$1 = "@gooddata/code-cli";
|
|
37122
|
-
var version$1 = "0.35.0-alpha.
|
|
37122
|
+
var version$1 = "0.35.0-alpha.2";
|
|
37123
37123
|
//#endregion
|
|
37124
37124
|
//#region ../code/esm/features/references/types.js
|
|
37125
37125
|
var UpdateReferencesType;
|
|
@@ -59179,6 +59179,33 @@ function createDocuments(parser, options, text) {
|
|
|
59179
59179
|
return Array.from(composer.compose(tokensArr, true, text.length));
|
|
59180
59180
|
}
|
|
59181
59181
|
//#endregion
|
|
59182
|
+
//#region ../code-ast/esm/schema/diagnostics.js
|
|
59183
|
+
function createDiagnostic$1(severity, position, schema, code, defaultMessage, parameters) {
|
|
59184
|
+
return {
|
|
59185
|
+
source: "json-schema",
|
|
59186
|
+
position: position || createEmptyPosition(),
|
|
59187
|
+
schema,
|
|
59188
|
+
defaultMessage,
|
|
59189
|
+
code,
|
|
59190
|
+
severity,
|
|
59191
|
+
parameters
|
|
59192
|
+
};
|
|
59193
|
+
}
|
|
59194
|
+
function createEmptyPosition() {
|
|
59195
|
+
return {
|
|
59196
|
+
start: {
|
|
59197
|
+
line: 0,
|
|
59198
|
+
column: 0,
|
|
59199
|
+
offset: 0
|
|
59200
|
+
},
|
|
59201
|
+
end: {
|
|
59202
|
+
line: 0,
|
|
59203
|
+
column: 0,
|
|
59204
|
+
offset: 0
|
|
59205
|
+
}
|
|
59206
|
+
};
|
|
59207
|
+
}
|
|
59208
|
+
//#endregion
|
|
59182
59209
|
//#region ../code-ast/esm/schema/errors.js
|
|
59183
59210
|
var SchemaErrorCodes;
|
|
59184
59211
|
(function(SchemaErrorCodes) {
|
|
@@ -59264,214 +59291,6 @@ const SchemaErrorMessages = {
|
|
|
59264
59291
|
[SchemaErrorCodes.DependantPropertyMissing]: "Object is missing property {0} required by property {1}."
|
|
59265
59292
|
};
|
|
59266
59293
|
//#endregion
|
|
59267
|
-
//#region ../code-ast/esm/schema/validator/helpers.js
|
|
59268
|
-
/**
|
|
59269
|
-
* @public
|
|
59270
|
-
* @param diagnostics
|
|
59271
|
-
*/
|
|
59272
|
-
function createSchemaValidatorDiagnostics(diagnostics) {
|
|
59273
|
-
return {
|
|
59274
|
-
diagnostics,
|
|
59275
|
-
matches: {
|
|
59276
|
-
schema: 0,
|
|
59277
|
-
structure: 0,
|
|
59278
|
-
enum: 0,
|
|
59279
|
-
type: 0,
|
|
59280
|
-
value: 0,
|
|
59281
|
-
semantic: 0
|
|
59282
|
-
}
|
|
59283
|
-
};
|
|
59284
|
-
}
|
|
59285
|
-
/**
|
|
59286
|
-
* @public
|
|
59287
|
-
* @param args
|
|
59288
|
-
*/
|
|
59289
|
-
function mergeSchemaValidatorDiagnostics(...args) {
|
|
59290
|
-
return args.reduce((prev, current) => {
|
|
59291
|
-
prev.diagnostics = [...prev.diagnostics, ...current.diagnostics];
|
|
59292
|
-
prev.matches = {
|
|
59293
|
-
schema: prev.matches.schema + current.matches.schema,
|
|
59294
|
-
structure: prev.matches.structure + current.matches.structure,
|
|
59295
|
-
type: prev.matches.type + current.matches.type,
|
|
59296
|
-
enum: prev.matches.enum + current.matches.enum,
|
|
59297
|
-
value: prev.matches.value + current.matches.value,
|
|
59298
|
-
semantic: prev.matches.semantic + current.matches.semantic
|
|
59299
|
-
};
|
|
59300
|
-
return prev;
|
|
59301
|
-
}, createSchemaValidatorDiagnostics([]));
|
|
59302
|
-
}
|
|
59303
|
-
function hasMatchesType(node, type) {
|
|
59304
|
-
return Boolean(node.type === type || type === "integer" && node.type === "number" && node.isInteger);
|
|
59305
|
-
}
|
|
59306
|
-
function getRelatedNodes(node) {
|
|
59307
|
-
return node ? filterChildren(node, { include: [
|
|
59308
|
-
"boolean",
|
|
59309
|
-
"null",
|
|
59310
|
-
"string",
|
|
59311
|
-
"number",
|
|
59312
|
-
"object",
|
|
59313
|
-
"property",
|
|
59314
|
-
"array"
|
|
59315
|
-
] }) : [];
|
|
59316
|
-
}
|
|
59317
|
-
function getPropertyNodes(node) {
|
|
59318
|
-
return node ? filterChildren(node, { include: ["property"] }) : [];
|
|
59319
|
-
}
|
|
59320
|
-
function removeNotDiagnostics(matches) {
|
|
59321
|
-
const notAllowed = [SchemaErrorCodes.WrongSchema, SchemaErrorCodes.MatchesNotAllowedSchema];
|
|
59322
|
-
const filtered = matches.filter(([, diag]) => {
|
|
59323
|
-
return !diag.diagnostics.some((d) => notAllowed.includes(d.code));
|
|
59324
|
-
});
|
|
59325
|
-
if (filtered.length === 0) return matches;
|
|
59326
|
-
return filtered;
|
|
59327
|
-
}
|
|
59328
|
-
function mergeDiagnosticsWithSameType(matches) {
|
|
59329
|
-
const diagnostics = createSchemaValidatorDiagnostics([]);
|
|
59330
|
-
const map = {};
|
|
59331
|
-
matches.forEach(([, diag]) => {
|
|
59332
|
-
diag.diagnostics.forEach((d) => {
|
|
59333
|
-
const key = `${d.position.start.line}:${d.position.start.column}-${d.position.end.line}:${d.position.end.column}(${d.code})[${d.defaultMessage}][${d.parameters.join(", ")}]`;
|
|
59334
|
-
if (!map[key]) {
|
|
59335
|
-
map[key] = d;
|
|
59336
|
-
diagnostics.diagnostics.push(d);
|
|
59337
|
-
}
|
|
59338
|
-
});
|
|
59339
|
-
});
|
|
59340
|
-
return diagnostics;
|
|
59341
|
-
}
|
|
59342
|
-
function pickDiagnosticsWithSimilarPriority(matches) {
|
|
59343
|
-
return filterByPriority(matches, matches[0]);
|
|
59344
|
-
}
|
|
59345
|
-
function filterByPriority(matches, match) {
|
|
59346
|
-
const [, b] = match;
|
|
59347
|
-
return matches.filter(([, a]) => {
|
|
59348
|
-
const [schemaA, schemaB] = [a.matches.schema, b.matches.schema];
|
|
59349
|
-
if (schemaA === schemaB) return true;
|
|
59350
|
-
return false;
|
|
59351
|
-
});
|
|
59352
|
-
}
|
|
59353
|
-
function sortByProblems(a, b) {
|
|
59354
|
-
const [valueA, valueB] = [a.matches.value, b.matches.value];
|
|
59355
|
-
const [enumA, enumB] = [a.matches.enum, b.matches.enum];
|
|
59356
|
-
const [schemaA, schemaB] = [a.matches.schema, b.matches.schema];
|
|
59357
|
-
const [structureA, structureB] = [a.matches.structure, b.matches.structure];
|
|
59358
|
-
const [typeA, typeB] = [a.matches.type, b.matches.type];
|
|
59359
|
-
if (schemaA < schemaB) return 1;
|
|
59360
|
-
if (enumA < enumB) return 1;
|
|
59361
|
-
if (structureA < structureB) return 1;
|
|
59362
|
-
if (typeA < typeB) return 1;
|
|
59363
|
-
if (valueA < valueB) return 1;
|
|
59364
|
-
return -1;
|
|
59365
|
-
}
|
|
59366
|
-
//#endregion
|
|
59367
|
-
//#region ../code-ast/esm/schema/diagnostics.js
|
|
59368
|
-
function createDiagnostic$1(severity, position, schema, code, defaultMessage, parameters) {
|
|
59369
|
-
return {
|
|
59370
|
-
source: "json-schema",
|
|
59371
|
-
position: position || createEmptyPosition(),
|
|
59372
|
-
schema,
|
|
59373
|
-
defaultMessage,
|
|
59374
|
-
code,
|
|
59375
|
-
severity,
|
|
59376
|
-
parameters
|
|
59377
|
-
};
|
|
59378
|
-
}
|
|
59379
|
-
function createEmptyPosition() {
|
|
59380
|
-
return {
|
|
59381
|
-
start: {
|
|
59382
|
-
line: 0,
|
|
59383
|
-
column: 0,
|
|
59384
|
-
offset: 0
|
|
59385
|
-
},
|
|
59386
|
-
end: {
|
|
59387
|
-
line: 0,
|
|
59388
|
-
column: 0,
|
|
59389
|
-
offset: 0
|
|
59390
|
-
}
|
|
59391
|
-
};
|
|
59392
|
-
}
|
|
59393
|
-
//#endregion
|
|
59394
|
-
//#region ../code-ast/esm/schema/types.js
|
|
59395
|
-
/**
|
|
59396
|
-
* @public
|
|
59397
|
-
*/
|
|
59398
|
-
var SchemaCompletionItemInsertTextKind;
|
|
59399
|
-
(function(SchemaCompletionItemInsertTextKind) {
|
|
59400
|
-
SchemaCompletionItemInsertTextKind["Simple"] = "simple";
|
|
59401
|
-
SchemaCompletionItemInsertTextKind["Snippet"] = "snippet";
|
|
59402
|
-
})(SchemaCompletionItemInsertTextKind || (SchemaCompletionItemInsertTextKind = {}));
|
|
59403
|
-
/**
|
|
59404
|
-
* @public
|
|
59405
|
-
*/
|
|
59406
|
-
var SchemaCompletionItemKind;
|
|
59407
|
-
(function(SchemaCompletionItemKind) {
|
|
59408
|
-
SchemaCompletionItemKind["Property"] = "property";
|
|
59409
|
-
SchemaCompletionItemKind["EnumMember"] = "enumMember";
|
|
59410
|
-
SchemaCompletionItemKind["Text"] = "text";
|
|
59411
|
-
SchemaCompletionItemKind["Method"] = "method";
|
|
59412
|
-
SchemaCompletionItemKind["Function"] = "function";
|
|
59413
|
-
SchemaCompletionItemKind["Constructor"] = "constructor";
|
|
59414
|
-
SchemaCompletionItemKind["Field"] = "field";
|
|
59415
|
-
SchemaCompletionItemKind["Variable"] = "variable";
|
|
59416
|
-
SchemaCompletionItemKind["Class"] = "class";
|
|
59417
|
-
SchemaCompletionItemKind["Interface"] = "interface";
|
|
59418
|
-
SchemaCompletionItemKind["Module"] = "module";
|
|
59419
|
-
SchemaCompletionItemKind["Unit"] = "unit";
|
|
59420
|
-
SchemaCompletionItemKind["Value"] = "value";
|
|
59421
|
-
SchemaCompletionItemKind["Enum"] = "enum";
|
|
59422
|
-
SchemaCompletionItemKind["Keyword"] = "keyword";
|
|
59423
|
-
SchemaCompletionItemKind["Snippet"] = "snippet";
|
|
59424
|
-
SchemaCompletionItemKind["Color"] = "color";
|
|
59425
|
-
SchemaCompletionItemKind["File"] = "file";
|
|
59426
|
-
SchemaCompletionItemKind["Reference"] = "reference";
|
|
59427
|
-
SchemaCompletionItemKind["Folder"] = "folder";
|
|
59428
|
-
SchemaCompletionItemKind["Constant"] = "constant";
|
|
59429
|
-
SchemaCompletionItemKind["Struct"] = "struct";
|
|
59430
|
-
SchemaCompletionItemKind["Event"] = "event";
|
|
59431
|
-
SchemaCompletionItemKind["Operator"] = "operator";
|
|
59432
|
-
SchemaCompletionItemKind["TypeParameter"] = "typeParameter";
|
|
59433
|
-
})(SchemaCompletionItemKind || (SchemaCompletionItemKind = {}));
|
|
59434
|
-
/**
|
|
59435
|
-
* @public
|
|
59436
|
-
*/
|
|
59437
|
-
var SchemaCompletionItemTag;
|
|
59438
|
-
(function(SchemaCompletionItemTag) {
|
|
59439
|
-
SchemaCompletionItemTag["Deprecated"] = "deprecated";
|
|
59440
|
-
SchemaCompletionItemTag["Required"] = "required";
|
|
59441
|
-
SchemaCompletionItemTag["Array"] = "array";
|
|
59442
|
-
})(SchemaCompletionItemTag || (SchemaCompletionItemTag = {}));
|
|
59443
|
-
/**
|
|
59444
|
-
* @public
|
|
59445
|
-
*/
|
|
59446
|
-
var SchemaHighlightTokenType;
|
|
59447
|
-
(function(SchemaHighlightTokenType) {
|
|
59448
|
-
SchemaHighlightTokenType["Number"] = "number";
|
|
59449
|
-
SchemaHighlightTokenType["EnumMember"] = "enumMember";
|
|
59450
|
-
SchemaHighlightTokenType["Property"] = "property";
|
|
59451
|
-
SchemaHighlightTokenType["String"] = "string";
|
|
59452
|
-
SchemaHighlightTokenType["Comment"] = "comment";
|
|
59453
|
-
SchemaHighlightTokenType["Decorator"] = "decorator";
|
|
59454
|
-
SchemaHighlightTokenType["Keyword"] = "keyword";
|
|
59455
|
-
SchemaHighlightTokenType["Function"] = "function";
|
|
59456
|
-
SchemaHighlightTokenType["Operator"] = "operator";
|
|
59457
|
-
})(SchemaHighlightTokenType || (SchemaHighlightTokenType = {}));
|
|
59458
|
-
/**
|
|
59459
|
-
* @public
|
|
59460
|
-
*/
|
|
59461
|
-
var SchemaHighlightTokenModifier;
|
|
59462
|
-
(function(SchemaHighlightTokenModifier) {
|
|
59463
|
-
SchemaHighlightTokenModifier["Deprecated"] = "deprecated";
|
|
59464
|
-
})(SchemaHighlightTokenModifier || (SchemaHighlightTokenModifier = {}));
|
|
59465
|
-
/**
|
|
59466
|
-
* @public
|
|
59467
|
-
*/
|
|
59468
|
-
var SchemaDiagnosticSeverity;
|
|
59469
|
-
(function(SchemaDiagnosticSeverity) {
|
|
59470
|
-
SchemaDiagnosticSeverity["Error"] = "error";
|
|
59471
|
-
SchemaDiagnosticSeverity["Warning"] = "warning";
|
|
59472
|
-
SchemaDiagnosticSeverity["Info"] = "info";
|
|
59473
|
-
})(SchemaDiagnosticSeverity || (SchemaDiagnosticSeverity = {}));
|
|
59474
|
-
//#endregion
|
|
59475
59294
|
//#region ../code-ast/esm/schema/formats.js
|
|
59476
59295
|
const formats = {
|
|
59477
59296
|
"color-hex": {
|
|
@@ -59608,6 +59427,186 @@ function getSingleSchemaTypeName(schema, parent) {
|
|
|
59608
59427
|
return title || getSchemaType(schema).join(" | ") || "unknown";
|
|
59609
59428
|
}
|
|
59610
59429
|
//#endregion
|
|
59430
|
+
//#region ../code-ast/esm/schema/types.js
|
|
59431
|
+
/**
|
|
59432
|
+
* @public
|
|
59433
|
+
*/
|
|
59434
|
+
var SchemaCompletionItemInsertTextKind;
|
|
59435
|
+
(function(SchemaCompletionItemInsertTextKind) {
|
|
59436
|
+
SchemaCompletionItemInsertTextKind["Simple"] = "simple";
|
|
59437
|
+
SchemaCompletionItemInsertTextKind["Snippet"] = "snippet";
|
|
59438
|
+
})(SchemaCompletionItemInsertTextKind || (SchemaCompletionItemInsertTextKind = {}));
|
|
59439
|
+
/**
|
|
59440
|
+
* @public
|
|
59441
|
+
*/
|
|
59442
|
+
var SchemaCompletionItemKind;
|
|
59443
|
+
(function(SchemaCompletionItemKind) {
|
|
59444
|
+
SchemaCompletionItemKind["Property"] = "property";
|
|
59445
|
+
SchemaCompletionItemKind["EnumMember"] = "enumMember";
|
|
59446
|
+
SchemaCompletionItemKind["Text"] = "text";
|
|
59447
|
+
SchemaCompletionItemKind["Method"] = "method";
|
|
59448
|
+
SchemaCompletionItemKind["Function"] = "function";
|
|
59449
|
+
SchemaCompletionItemKind["Constructor"] = "constructor";
|
|
59450
|
+
SchemaCompletionItemKind["Field"] = "field";
|
|
59451
|
+
SchemaCompletionItemKind["Variable"] = "variable";
|
|
59452
|
+
SchemaCompletionItemKind["Class"] = "class";
|
|
59453
|
+
SchemaCompletionItemKind["Interface"] = "interface";
|
|
59454
|
+
SchemaCompletionItemKind["Module"] = "module";
|
|
59455
|
+
SchemaCompletionItemKind["Unit"] = "unit";
|
|
59456
|
+
SchemaCompletionItemKind["Value"] = "value";
|
|
59457
|
+
SchemaCompletionItemKind["Enum"] = "enum";
|
|
59458
|
+
SchemaCompletionItemKind["Keyword"] = "keyword";
|
|
59459
|
+
SchemaCompletionItemKind["Snippet"] = "snippet";
|
|
59460
|
+
SchemaCompletionItemKind["Color"] = "color";
|
|
59461
|
+
SchemaCompletionItemKind["File"] = "file";
|
|
59462
|
+
SchemaCompletionItemKind["Reference"] = "reference";
|
|
59463
|
+
SchemaCompletionItemKind["Folder"] = "folder";
|
|
59464
|
+
SchemaCompletionItemKind["Constant"] = "constant";
|
|
59465
|
+
SchemaCompletionItemKind["Struct"] = "struct";
|
|
59466
|
+
SchemaCompletionItemKind["Event"] = "event";
|
|
59467
|
+
SchemaCompletionItemKind["Operator"] = "operator";
|
|
59468
|
+
SchemaCompletionItemKind["TypeParameter"] = "typeParameter";
|
|
59469
|
+
})(SchemaCompletionItemKind || (SchemaCompletionItemKind = {}));
|
|
59470
|
+
/**
|
|
59471
|
+
* @public
|
|
59472
|
+
*/
|
|
59473
|
+
var SchemaCompletionItemTag;
|
|
59474
|
+
(function(SchemaCompletionItemTag) {
|
|
59475
|
+
SchemaCompletionItemTag["Deprecated"] = "deprecated";
|
|
59476
|
+
SchemaCompletionItemTag["Required"] = "required";
|
|
59477
|
+
SchemaCompletionItemTag["Array"] = "array";
|
|
59478
|
+
})(SchemaCompletionItemTag || (SchemaCompletionItemTag = {}));
|
|
59479
|
+
/**
|
|
59480
|
+
* @public
|
|
59481
|
+
*/
|
|
59482
|
+
var SchemaHighlightTokenType;
|
|
59483
|
+
(function(SchemaHighlightTokenType) {
|
|
59484
|
+
SchemaHighlightTokenType["Number"] = "number";
|
|
59485
|
+
SchemaHighlightTokenType["EnumMember"] = "enumMember";
|
|
59486
|
+
SchemaHighlightTokenType["Property"] = "property";
|
|
59487
|
+
SchemaHighlightTokenType["String"] = "string";
|
|
59488
|
+
SchemaHighlightTokenType["Comment"] = "comment";
|
|
59489
|
+
SchemaHighlightTokenType["Decorator"] = "decorator";
|
|
59490
|
+
SchemaHighlightTokenType["Keyword"] = "keyword";
|
|
59491
|
+
SchemaHighlightTokenType["Function"] = "function";
|
|
59492
|
+
SchemaHighlightTokenType["Operator"] = "operator";
|
|
59493
|
+
})(SchemaHighlightTokenType || (SchemaHighlightTokenType = {}));
|
|
59494
|
+
/**
|
|
59495
|
+
* @public
|
|
59496
|
+
*/
|
|
59497
|
+
var SchemaHighlightTokenModifier;
|
|
59498
|
+
(function(SchemaHighlightTokenModifier) {
|
|
59499
|
+
SchemaHighlightTokenModifier["Deprecated"] = "deprecated";
|
|
59500
|
+
})(SchemaHighlightTokenModifier || (SchemaHighlightTokenModifier = {}));
|
|
59501
|
+
/**
|
|
59502
|
+
* @public
|
|
59503
|
+
*/
|
|
59504
|
+
var SchemaDiagnosticSeverity;
|
|
59505
|
+
(function(SchemaDiagnosticSeverity) {
|
|
59506
|
+
SchemaDiagnosticSeverity["Error"] = "error";
|
|
59507
|
+
SchemaDiagnosticSeverity["Warning"] = "warning";
|
|
59508
|
+
SchemaDiagnosticSeverity["Info"] = "info";
|
|
59509
|
+
})(SchemaDiagnosticSeverity || (SchemaDiagnosticSeverity = {}));
|
|
59510
|
+
//#endregion
|
|
59511
|
+
//#region ../code-ast/esm/schema/validator/helpers.js
|
|
59512
|
+
/**
|
|
59513
|
+
* @public
|
|
59514
|
+
* @param diagnostics
|
|
59515
|
+
*/
|
|
59516
|
+
function createSchemaValidatorDiagnostics(diagnostics) {
|
|
59517
|
+
return {
|
|
59518
|
+
diagnostics,
|
|
59519
|
+
matches: {
|
|
59520
|
+
schema: 0,
|
|
59521
|
+
structure: 0,
|
|
59522
|
+
enum: 0,
|
|
59523
|
+
type: 0,
|
|
59524
|
+
value: 0,
|
|
59525
|
+
semantic: 0
|
|
59526
|
+
}
|
|
59527
|
+
};
|
|
59528
|
+
}
|
|
59529
|
+
/**
|
|
59530
|
+
* @public
|
|
59531
|
+
* @param args
|
|
59532
|
+
*/
|
|
59533
|
+
function mergeSchemaValidatorDiagnostics(...args) {
|
|
59534
|
+
return args.reduce((prev, current) => {
|
|
59535
|
+
prev.diagnostics = [...prev.diagnostics, ...current.diagnostics];
|
|
59536
|
+
prev.matches = {
|
|
59537
|
+
schema: prev.matches.schema + current.matches.schema,
|
|
59538
|
+
structure: prev.matches.structure + current.matches.structure,
|
|
59539
|
+
type: prev.matches.type + current.matches.type,
|
|
59540
|
+
enum: prev.matches.enum + current.matches.enum,
|
|
59541
|
+
value: prev.matches.value + current.matches.value,
|
|
59542
|
+
semantic: prev.matches.semantic + current.matches.semantic
|
|
59543
|
+
};
|
|
59544
|
+
return prev;
|
|
59545
|
+
}, createSchemaValidatorDiagnostics([]));
|
|
59546
|
+
}
|
|
59547
|
+
function hasMatchesType(node, type) {
|
|
59548
|
+
return Boolean(node.type === type || type === "integer" && node.type === "number" && node.isInteger);
|
|
59549
|
+
}
|
|
59550
|
+
function getRelatedNodes(node) {
|
|
59551
|
+
return node ? filterChildren(node, { include: [
|
|
59552
|
+
"boolean",
|
|
59553
|
+
"null",
|
|
59554
|
+
"string",
|
|
59555
|
+
"number",
|
|
59556
|
+
"object",
|
|
59557
|
+
"property",
|
|
59558
|
+
"array"
|
|
59559
|
+
] }) : [];
|
|
59560
|
+
}
|
|
59561
|
+
function getPropertyNodes(node) {
|
|
59562
|
+
return node ? filterChildren(node, { include: ["property"] }) : [];
|
|
59563
|
+
}
|
|
59564
|
+
function removeNotDiagnostics(matches) {
|
|
59565
|
+
const notAllowed = [SchemaErrorCodes.WrongSchema, SchemaErrorCodes.MatchesNotAllowedSchema];
|
|
59566
|
+
const filtered = matches.filter(([, diag]) => {
|
|
59567
|
+
return !diag.diagnostics.some((d) => notAllowed.includes(d.code));
|
|
59568
|
+
});
|
|
59569
|
+
if (filtered.length === 0) return matches;
|
|
59570
|
+
return filtered;
|
|
59571
|
+
}
|
|
59572
|
+
function mergeDiagnosticsWithSameType(matches) {
|
|
59573
|
+
const diagnostics = createSchemaValidatorDiagnostics([]);
|
|
59574
|
+
const map = {};
|
|
59575
|
+
matches.forEach(([, diag]) => {
|
|
59576
|
+
diag.diagnostics.forEach((d) => {
|
|
59577
|
+
const key = `${d.position.start.line}:${d.position.start.column}-${d.position.end.line}:${d.position.end.column}(${d.code})[${d.defaultMessage}][${d.parameters.join(", ")}]`;
|
|
59578
|
+
if (!map[key]) {
|
|
59579
|
+
map[key] = d;
|
|
59580
|
+
diagnostics.diagnostics.push(d);
|
|
59581
|
+
}
|
|
59582
|
+
});
|
|
59583
|
+
});
|
|
59584
|
+
return diagnostics;
|
|
59585
|
+
}
|
|
59586
|
+
function pickDiagnosticsWithSimilarPriority(matches) {
|
|
59587
|
+
return filterByPriority(matches, matches[0]);
|
|
59588
|
+
}
|
|
59589
|
+
function filterByPriority(matches, match) {
|
|
59590
|
+
const [, b] = match;
|
|
59591
|
+
return matches.filter(([, a]) => {
|
|
59592
|
+
const [schemaA, schemaB] = [a.matches.schema, b.matches.schema];
|
|
59593
|
+
return schemaA === schemaB;
|
|
59594
|
+
});
|
|
59595
|
+
}
|
|
59596
|
+
function sortByProblems(a, b) {
|
|
59597
|
+
const [valueA, valueB] = [a.matches.value, b.matches.value];
|
|
59598
|
+
const [enumA, enumB] = [a.matches.enum, b.matches.enum];
|
|
59599
|
+
const [schemaA, schemaB] = [a.matches.schema, b.matches.schema];
|
|
59600
|
+
const [structureA, structureB] = [a.matches.structure, b.matches.structure];
|
|
59601
|
+
const [typeA, typeB] = [a.matches.type, b.matches.type];
|
|
59602
|
+
if (schemaA < schemaB) return 1;
|
|
59603
|
+
if (enumA < enumB) return 1;
|
|
59604
|
+
if (structureA < structureB) return 1;
|
|
59605
|
+
if (typeA < typeB) return 1;
|
|
59606
|
+
if (valueA < valueB) return 1;
|
|
59607
|
+
return -1;
|
|
59608
|
+
}
|
|
59609
|
+
//#endregion
|
|
59611
59610
|
//#region ../code-ast/esm/schema/validator/validate.js
|
|
59612
59611
|
async function validate$2(document, root, node, schemas, schema, opts) {
|
|
59613
59612
|
return validateInternal(document, root, node, schemas, schema, opts);
|
|
@@ -60288,93 +60287,6 @@ function buildMessage$1(message, params) {
|
|
|
60288
60287
|
return params.reduce((msg, param, index) => msg.replace(new RegExp(`\\{${index}}`, "gi"), param), message);
|
|
60289
60288
|
}
|
|
60290
60289
|
//#endregion
|
|
60291
|
-
//#region ../code-ast/esm/schema/validator/index.js
|
|
60292
|
-
async function validate$1(document, asts, schema, options) {
|
|
60293
|
-
if (options.invalid) return createSchemaValidatorDiagnostics([]);
|
|
60294
|
-
const tasks = asts.map((node) => validate$2(document, node, node, [], schema, options));
|
|
60295
|
-
return mergeSchemaValidatorDiagnostics(...await Promise.all(tasks));
|
|
60296
|
-
}
|
|
60297
|
-
//#endregion
|
|
60298
|
-
//#region ../code-ast/esm/schema/completion/helpers.js
|
|
60299
|
-
/**
|
|
60300
|
-
* @public
|
|
60301
|
-
* @param items
|
|
60302
|
-
* @param isIncomplete
|
|
60303
|
-
*/
|
|
60304
|
-
function createSchemaCompletionList(items, isIncomplete = false) {
|
|
60305
|
-
return {
|
|
60306
|
-
items,
|
|
60307
|
-
isIncomplete
|
|
60308
|
-
};
|
|
60309
|
-
}
|
|
60310
|
-
/**
|
|
60311
|
-
* @public
|
|
60312
|
-
* @param args
|
|
60313
|
-
*/
|
|
60314
|
-
function mergeSchemaCompletionLists(...args) {
|
|
60315
|
-
return args.slice(1).reduce((prev, current) => {
|
|
60316
|
-
prev.items = [...prev.items, ...current.items];
|
|
60317
|
-
prev.isIncomplete = prev.isIncomplete || current.isIncomplete;
|
|
60318
|
-
return prev;
|
|
60319
|
-
}, args[0]);
|
|
60320
|
-
}
|
|
60321
|
-
function getContextSchemaItem(schemaPath) {
|
|
60322
|
-
const nodes = schemaPath.nodes.slice(0);
|
|
60323
|
-
const schemas = schemaPath.schemas.slice(0);
|
|
60324
|
-
const root = nodes[0];
|
|
60325
|
-
const last = nodes[nodes.length - 1];
|
|
60326
|
-
const isValue = getPropertyValueNode(getParentNode(root, last)) === last;
|
|
60327
|
-
return {
|
|
60328
|
-
schemas: schemas.pop() || [],
|
|
60329
|
-
node: nodes.pop() || null,
|
|
60330
|
-
value: isValue
|
|
60331
|
-
};
|
|
60332
|
-
}
|
|
60333
|
-
//#endregion
|
|
60334
|
-
//#region ../code-ast/esm/schema/path/compare.js
|
|
60335
|
-
function compare(a, b) {
|
|
60336
|
-
if (a === b) return true;
|
|
60337
|
-
if (a && b && typeof a === "object" && typeof b === "object") {
|
|
60338
|
-
if (a.constructor !== b.constructor) return false;
|
|
60339
|
-
if (Array.isArray(a)) {
|
|
60340
|
-
let length = a.length;
|
|
60341
|
-
if (length !== b.length) return false;
|
|
60342
|
-
for (let i = length; i-- !== 0;) if (!compare(a[i], b[i])) return false;
|
|
60343
|
-
return true;
|
|
60344
|
-
}
|
|
60345
|
-
if (a instanceof Map && b instanceof Map) {
|
|
60346
|
-
if (a.size !== b.size) return false;
|
|
60347
|
-
for (let i of a.entries()) if (!b.has(i[0])) return false;
|
|
60348
|
-
for (let i of a.entries()) if (!compare(i[1], b.get(i[0]))) return false;
|
|
60349
|
-
return true;
|
|
60350
|
-
}
|
|
60351
|
-
if (a instanceof Set && b instanceof Set) {
|
|
60352
|
-
if (a.size !== b.size) return false;
|
|
60353
|
-
for (let i of a.entries()) if (!b.has(i[0])) return false;
|
|
60354
|
-
return true;
|
|
60355
|
-
}
|
|
60356
|
-
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
|
60357
|
-
const length = a.byteLength;
|
|
60358
|
-
if (length !== b.byteLength) return false;
|
|
60359
|
-
for (let i = length; i-- !== 0;) if (a[i] !== b[i]) return false;
|
|
60360
|
-
return true;
|
|
60361
|
-
}
|
|
60362
|
-
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
60363
|
-
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
60364
|
-
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
60365
|
-
const keys = Object.keys(a);
|
|
60366
|
-
const length = keys.length;
|
|
60367
|
-
if (length !== Object.keys(b).length) return false;
|
|
60368
|
-
for (let i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
60369
|
-
for (let i = length; i-- !== 0;) {
|
|
60370
|
-
const key = keys[i];
|
|
60371
|
-
if (!compare(a[key], b[key])) return false;
|
|
60372
|
-
}
|
|
60373
|
-
return true;
|
|
60374
|
-
}
|
|
60375
|
-
return a !== a && b !== b;
|
|
60376
|
-
}
|
|
60377
|
-
//#endregion
|
|
60378
60290
|
//#region ../code-ast/esm/value.js
|
|
60379
60291
|
/**
|
|
60380
60292
|
* @public
|
|
@@ -60514,6 +60426,50 @@ function schemaOnly(data) {
|
|
|
60514
60426
|
return data.filter(unique());
|
|
60515
60427
|
}
|
|
60516
60428
|
//#endregion
|
|
60429
|
+
//#region ../code-ast/esm/schema/path/compare.js
|
|
60430
|
+
function compare(a, b) {
|
|
60431
|
+
if (a === b) return true;
|
|
60432
|
+
if (a && b && typeof a === "object" && typeof b === "object") {
|
|
60433
|
+
if (a.constructor !== b.constructor) return false;
|
|
60434
|
+
if (Array.isArray(a)) {
|
|
60435
|
+
const length = a.length;
|
|
60436
|
+
if (length !== b.length) return false;
|
|
60437
|
+
for (let i = length; i-- !== 0;) if (!compare(a[i], b[i])) return false;
|
|
60438
|
+
return true;
|
|
60439
|
+
}
|
|
60440
|
+
if (a instanceof Map && b instanceof Map) {
|
|
60441
|
+
if (a.size !== b.size) return false;
|
|
60442
|
+
for (const i of a.entries()) if (!b.has(i[0])) return false;
|
|
60443
|
+
for (const i of a.entries()) if (!compare(i[1], b.get(i[0]))) return false;
|
|
60444
|
+
return true;
|
|
60445
|
+
}
|
|
60446
|
+
if (a instanceof Set && b instanceof Set) {
|
|
60447
|
+
if (a.size !== b.size) return false;
|
|
60448
|
+
for (const i of a.entries()) if (!b.has(i[0])) return false;
|
|
60449
|
+
return true;
|
|
60450
|
+
}
|
|
60451
|
+
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
|
60452
|
+
const length = a.byteLength;
|
|
60453
|
+
if (length !== b.byteLength) return false;
|
|
60454
|
+
for (let i = length; i-- !== 0;) if (a[i] !== b[i]) return false;
|
|
60455
|
+
return true;
|
|
60456
|
+
}
|
|
60457
|
+
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
60458
|
+
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
60459
|
+
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
60460
|
+
const keys = Object.keys(a);
|
|
60461
|
+
const length = keys.length;
|
|
60462
|
+
if (length !== Object.keys(b).length) return false;
|
|
60463
|
+
for (let i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
60464
|
+
for (let i = length; i-- !== 0;) {
|
|
60465
|
+
const key = keys[i];
|
|
60466
|
+
if (!compare(a[key], b[key])) return false;
|
|
60467
|
+
}
|
|
60468
|
+
return true;
|
|
60469
|
+
}
|
|
60470
|
+
return a !== a && b !== b;
|
|
60471
|
+
}
|
|
60472
|
+
//#endregion
|
|
60517
60473
|
//#region ../code-ast/esm/schema/path/completionPath.js
|
|
60518
60474
|
async function completionPath(document, createdSchema, path, { position, getValue }) {
|
|
60519
60475
|
const nodes = path.length === 0 ? [null] : path;
|
|
@@ -60859,6 +60815,42 @@ function spaces(column) {
|
|
|
60859
60815
|
return new Array(column).fill(" ").join("");
|
|
60860
60816
|
}
|
|
60861
60817
|
//#endregion
|
|
60818
|
+
//#region ../code-ast/esm/schema/completion/helpers.js
|
|
60819
|
+
/**
|
|
60820
|
+
* @public
|
|
60821
|
+
* @param items
|
|
60822
|
+
* @param isIncomplete
|
|
60823
|
+
*/
|
|
60824
|
+
function createSchemaCompletionList(items, isIncomplete = false) {
|
|
60825
|
+
return {
|
|
60826
|
+
items,
|
|
60827
|
+
isIncomplete
|
|
60828
|
+
};
|
|
60829
|
+
}
|
|
60830
|
+
/**
|
|
60831
|
+
* @public
|
|
60832
|
+
* @param args
|
|
60833
|
+
*/
|
|
60834
|
+
function mergeSchemaCompletionLists(...args) {
|
|
60835
|
+
return args.slice(1).reduce((prev, current) => {
|
|
60836
|
+
prev.items = [...prev.items, ...current.items];
|
|
60837
|
+
prev.isIncomplete = prev.isIncomplete || current.isIncomplete;
|
|
60838
|
+
return prev;
|
|
60839
|
+
}, args[0]);
|
|
60840
|
+
}
|
|
60841
|
+
function getContextSchemaItem(schemaPath) {
|
|
60842
|
+
const nodes = schemaPath.nodes.slice(0);
|
|
60843
|
+
const schemas = schemaPath.schemas.slice(0);
|
|
60844
|
+
const root = nodes[0];
|
|
60845
|
+
const last = nodes[nodes.length - 1];
|
|
60846
|
+
const isValue = getPropertyValueNode(getParentNode(root, last)) === last;
|
|
60847
|
+
return {
|
|
60848
|
+
schemas: schemas.pop() || [],
|
|
60849
|
+
node: nodes.pop() || null,
|
|
60850
|
+
value: isValue
|
|
60851
|
+
};
|
|
60852
|
+
}
|
|
60853
|
+
//#endregion
|
|
60862
60854
|
//#region ../code-ast/esm/schema/completion/collecting.js
|
|
60863
60855
|
function collectCompletionItems(document, position, schemaPath, schemaItem, schemas, schema, options) {
|
|
60864
60856
|
return [
|
|
@@ -61009,134 +61001,6 @@ function filterList(list) {
|
|
|
61009
61001
|
};
|
|
61010
61002
|
}
|
|
61011
61003
|
//#endregion
|
|
61012
|
-
//#region ../code-ast/esm/schema/mapper/references.js
|
|
61013
|
-
function resolveReferences$1(json) {
|
|
61014
|
-
const data = { ids: {} };
|
|
61015
|
-
const schemas = json.map((item) => collectReferences(item, data));
|
|
61016
|
-
const diagnostics = schemas.map((item) => item.diagnostics).flat();
|
|
61017
|
-
const [finalSchema, refsDiagnostics] = blendReferences(schemas, data);
|
|
61018
|
-
return {
|
|
61019
|
-
json: finalSchema,
|
|
61020
|
-
diagnostics: [...diagnostics, ...refsDiagnostics]
|
|
61021
|
-
};
|
|
61022
|
-
}
|
|
61023
|
-
function collectReferences(json, data) {
|
|
61024
|
-
const resolvedSchema = {
|
|
61025
|
-
refs: [],
|
|
61026
|
-
diagnostics: [],
|
|
61027
|
-
schema: {}
|
|
61028
|
-
};
|
|
61029
|
-
const schema = resolveSchemaRefs(json, [], json, data, resolvedSchema);
|
|
61030
|
-
return {
|
|
61031
|
-
...resolvedSchema,
|
|
61032
|
-
schema
|
|
61033
|
-
};
|
|
61034
|
-
}
|
|
61035
|
-
function resolveSchemaRefs(full, path, obj, data, schema) {
|
|
61036
|
-
switch (typeof obj) {
|
|
61037
|
-
case "undefined":
|
|
61038
|
-
const params = [path.join("/")];
|
|
61039
|
-
schema.diagnostics.push(createDiagnostic$1(SchemaDiagnosticSeverity.Error, void 0, getSchema(full), SchemaErrorCodes.UndefinedValue, SchemaErrorMessages[SchemaErrorCodes.UndefinedValue], params));
|
|
61040
|
-
return;
|
|
61041
|
-
case "string":
|
|
61042
|
-
case "number":
|
|
61043
|
-
case "boolean":
|
|
61044
|
-
case "bigint": return obj;
|
|
61045
|
-
case "function":
|
|
61046
|
-
case "symbol": return;
|
|
61047
|
-
case "object":
|
|
61048
|
-
if (Array.isArray(obj)) return obj.map((item, i) => resolveSchemaRefs(full, [...path, i.toString()], item, data, schema));
|
|
61049
|
-
const cloned = Object.keys(obj).reduce((prev, key) => ({
|
|
61050
|
-
...prev,
|
|
61051
|
-
[key]: resolveSchemaRefs(full, [...path, key], obj[key], data, schema)
|
|
61052
|
-
}), {});
|
|
61053
|
-
if (cloned.$ref) schema.refs.push(cloned);
|
|
61054
|
-
if (cloned.$id) data.ids[cloned.$id] = cloned;
|
|
61055
|
-
return cloned;
|
|
61056
|
-
}
|
|
61057
|
-
}
|
|
61058
|
-
function blendReferences(schemas, data) {
|
|
61059
|
-
const root = schemas[0];
|
|
61060
|
-
const diagnostics = [];
|
|
61061
|
-
schemas.forEach((schema) => {
|
|
61062
|
-
const cache = {};
|
|
61063
|
-
schema.refs.forEach((ref) => {
|
|
61064
|
-
const [loaded, diag] = loadSchemaRefs(schema.schema, data, cache, ref.$ref);
|
|
61065
|
-
Object.keys(loaded).forEach((key) => {
|
|
61066
|
-
ref[key] = loaded[key];
|
|
61067
|
-
});
|
|
61068
|
-
diagnostics.push(...diag);
|
|
61069
|
-
ref.title = retrieveSchemaTitle(ref);
|
|
61070
|
-
delete ref.$ref;
|
|
61071
|
-
delete ref.$id;
|
|
61072
|
-
});
|
|
61073
|
-
});
|
|
61074
|
-
return [root.schema, diagnostics];
|
|
61075
|
-
}
|
|
61076
|
-
function loadSchemaRefs(full, data, cache, ref) {
|
|
61077
|
-
if (!ref) return [{}, []];
|
|
61078
|
-
if (cache[ref]) return [cache[ref], []];
|
|
61079
|
-
const local = isLocalRef(ref);
|
|
61080
|
-
if (local) {
|
|
61081
|
-
const schema = findSubSchemaInSchema(full, local);
|
|
61082
|
-
if (schema) {
|
|
61083
|
-
cache[ref] = schema;
|
|
61084
|
-
return [schema, []];
|
|
61085
|
-
}
|
|
61086
|
-
const params = [ref];
|
|
61087
|
-
return [{}, [createDiagnostic$1(SchemaDiagnosticSeverity.Error, void 0, getSchema(full), SchemaErrorCodes.MissingSchema, SchemaErrorMessages[SchemaErrorCodes.MissingSchema], params)]];
|
|
61088
|
-
}
|
|
61089
|
-
if (isGlobalRelativeRef(ref)) {
|
|
61090
|
-
const schema = findSubSchemaInIds(data, ref);
|
|
61091
|
-
if (schema) {
|
|
61092
|
-
cache[ref] = schema;
|
|
61093
|
-
return [schema, []];
|
|
61094
|
-
}
|
|
61095
|
-
const params = [ref];
|
|
61096
|
-
return [{}, [createDiagnostic$1(SchemaDiagnosticSeverity.Error, void 0, getSchema(full), SchemaErrorCodes.MissingSchema, SchemaErrorMessages[SchemaErrorCodes.MissingSchema], params)]];
|
|
61097
|
-
}
|
|
61098
|
-
const params = [ref];
|
|
61099
|
-
return [{}, [createDiagnostic$1(SchemaDiagnosticSeverity.Error, void 0, getSchema(full), SchemaErrorCodes.UnknownSchemaRef, SchemaErrorMessages[SchemaErrorCodes.UnknownSchemaRef], params)]];
|
|
61100
|
-
}
|
|
61101
|
-
function findSubSchemaInSchema(full, path) {
|
|
61102
|
-
let find = full;
|
|
61103
|
-
for (let i = 0; i < path.length; i++) find = find ? find[path[i]] : void 0;
|
|
61104
|
-
return find;
|
|
61105
|
-
}
|
|
61106
|
-
function findSubSchemaInIds(data, ref) {
|
|
61107
|
-
return data.ids[ref];
|
|
61108
|
-
}
|
|
61109
|
-
function getSchema(full) {
|
|
61110
|
-
const schema = full.title || full.$id || full.$schema;
|
|
61111
|
-
return schema ? [schema] : [];
|
|
61112
|
-
}
|
|
61113
|
-
function isLocalRef(ref = "") {
|
|
61114
|
-
const refPath = ref.split("/");
|
|
61115
|
-
return ref && refPath[0] === "#" ? refPath.slice(1) : null;
|
|
61116
|
-
}
|
|
61117
|
-
function isGlobalRelativeRef(ref = "") {
|
|
61118
|
-
const refPath = ref.split("/");
|
|
61119
|
-
return ref && refPath[0] === "" ? refPath : null;
|
|
61120
|
-
}
|
|
61121
|
-
//#endregion
|
|
61122
|
-
//#region ../code-ast/esm/schema/mapper/validate.js
|
|
61123
|
-
var import_json_schema_draft_07 = /* @__PURE__ */ __toESM(require_json_schema_draft_07(), 1);
|
|
61124
|
-
const ajv = new import_ajv.Ajv();
|
|
61125
|
-
const schema07Validator = ajv.getSchema("http://json-schema.org/draft-07/schema") ?? ajv.compile(import_json_schema_draft_07.default);
|
|
61126
|
-
function validateJsonSchema(json) {
|
|
61127
|
-
const valid = schema07Validator(json);
|
|
61128
|
-
const diagnostics = [];
|
|
61129
|
-
if (!valid) for (const err of schema07Validator.errors) {
|
|
61130
|
-
const { instancePath, schemaPath, keyword, message, params } = err;
|
|
61131
|
-
const pars = [JSON.stringify(params)];
|
|
61132
|
-
diagnostics.push(createDiagnostic$1(SchemaDiagnosticSeverity.Error, void 0, [...instancePath ? [instancePath] : [], ...schemaPath ? [schemaPath] : []], keyword, `Json schema validator: ${message}`, pars));
|
|
61133
|
-
}
|
|
61134
|
-
return {
|
|
61135
|
-
json,
|
|
61136
|
-
diagnostics
|
|
61137
|
-
};
|
|
61138
|
-
}
|
|
61139
|
-
//#endregion
|
|
61140
61004
|
//#region ../code-ast/esm/schema/visitor/schema.js
|
|
61141
61005
|
async function schemaVisitor(document, schemas, parents, node, options) {
|
|
61142
61006
|
const root = parents[0] || node;
|
|
@@ -61261,7 +61125,7 @@ function getRootByRange(document, schema, ast, opts) {
|
|
|
61261
61125
|
character: range.end.column
|
|
61262
61126
|
})];
|
|
61263
61127
|
const map = createNodeOffsetsMap(document, ast);
|
|
61264
|
-
|
|
61128
|
+
const valids = [];
|
|
61265
61129
|
map.forEach(([itemFrom, itemTo, item]) => {
|
|
61266
61130
|
if (itemFrom <= from && to <= itemTo) valids.push(item);
|
|
61267
61131
|
});
|
|
@@ -61310,6 +61174,134 @@ async function highlight(document, asts, createdSchema, options) {
|
|
|
61310
61174
|
return (await Promise.all(tasks)).reduce((prev, current) => [...prev, ...current], []);
|
|
61311
61175
|
}
|
|
61312
61176
|
//#endregion
|
|
61177
|
+
//#region ../code-ast/esm/schema/mapper/references.js
|
|
61178
|
+
function resolveReferences$1(json) {
|
|
61179
|
+
const data = { ids: {} };
|
|
61180
|
+
const schemas = json.map((item) => collectReferences(item, data));
|
|
61181
|
+
const diagnostics = schemas.map((item) => item.diagnostics).flat();
|
|
61182
|
+
const [finalSchema, refsDiagnostics] = blendReferences(schemas, data);
|
|
61183
|
+
return {
|
|
61184
|
+
json: finalSchema,
|
|
61185
|
+
diagnostics: [...diagnostics, ...refsDiagnostics]
|
|
61186
|
+
};
|
|
61187
|
+
}
|
|
61188
|
+
function collectReferences(json, data) {
|
|
61189
|
+
const resolvedSchema = {
|
|
61190
|
+
refs: [],
|
|
61191
|
+
diagnostics: [],
|
|
61192
|
+
schema: {}
|
|
61193
|
+
};
|
|
61194
|
+
const schema = resolveSchemaRefs(json, [], json, data, resolvedSchema);
|
|
61195
|
+
return {
|
|
61196
|
+
...resolvedSchema,
|
|
61197
|
+
schema
|
|
61198
|
+
};
|
|
61199
|
+
}
|
|
61200
|
+
function resolveSchemaRefs(full, path, obj, data, schema) {
|
|
61201
|
+
switch (typeof obj) {
|
|
61202
|
+
case "undefined":
|
|
61203
|
+
const params = [path.join("/")];
|
|
61204
|
+
schema.diagnostics.push(createDiagnostic$1(SchemaDiagnosticSeverity.Error, void 0, getSchema(full), SchemaErrorCodes.UndefinedValue, SchemaErrorMessages[SchemaErrorCodes.UndefinedValue], params));
|
|
61205
|
+
return;
|
|
61206
|
+
case "string":
|
|
61207
|
+
case "number":
|
|
61208
|
+
case "boolean":
|
|
61209
|
+
case "bigint": return obj;
|
|
61210
|
+
case "function":
|
|
61211
|
+
case "symbol": return;
|
|
61212
|
+
case "object":
|
|
61213
|
+
if (Array.isArray(obj)) return obj.map((item, i) => resolveSchemaRefs(full, [...path, i.toString()], item, data, schema));
|
|
61214
|
+
const cloned = Object.keys(obj).reduce((prev, key) => ({
|
|
61215
|
+
...prev,
|
|
61216
|
+
[key]: resolveSchemaRefs(full, [...path, key], obj[key], data, schema)
|
|
61217
|
+
}), {});
|
|
61218
|
+
if (cloned.$ref) schema.refs.push(cloned);
|
|
61219
|
+
if (cloned.$id) data.ids[cloned.$id] = cloned;
|
|
61220
|
+
return cloned;
|
|
61221
|
+
}
|
|
61222
|
+
}
|
|
61223
|
+
function blendReferences(schemas, data) {
|
|
61224
|
+
const root = schemas[0];
|
|
61225
|
+
const diagnostics = [];
|
|
61226
|
+
schemas.forEach((schema) => {
|
|
61227
|
+
const cache = {};
|
|
61228
|
+
schema.refs.forEach((ref) => {
|
|
61229
|
+
const [loaded, diag] = loadSchemaRefs(schema.schema, data, cache, ref.$ref);
|
|
61230
|
+
Object.keys(loaded).forEach((key) => {
|
|
61231
|
+
ref[key] = loaded[key];
|
|
61232
|
+
});
|
|
61233
|
+
diagnostics.push(...diag);
|
|
61234
|
+
ref.title = retrieveSchemaTitle(ref);
|
|
61235
|
+
delete ref.$ref;
|
|
61236
|
+
delete ref.$id;
|
|
61237
|
+
});
|
|
61238
|
+
});
|
|
61239
|
+
return [root.schema, diagnostics];
|
|
61240
|
+
}
|
|
61241
|
+
function loadSchemaRefs(full, data, cache, ref) {
|
|
61242
|
+
if (!ref) return [{}, []];
|
|
61243
|
+
if (cache[ref]) return [cache[ref], []];
|
|
61244
|
+
const local = isLocalRef(ref);
|
|
61245
|
+
if (local) {
|
|
61246
|
+
const schema = findSubSchemaInSchema(full, local);
|
|
61247
|
+
if (schema) {
|
|
61248
|
+
cache[ref] = schema;
|
|
61249
|
+
return [schema, []];
|
|
61250
|
+
}
|
|
61251
|
+
const params = [ref];
|
|
61252
|
+
return [{}, [createDiagnostic$1(SchemaDiagnosticSeverity.Error, void 0, getSchema(full), SchemaErrorCodes.MissingSchema, SchemaErrorMessages[SchemaErrorCodes.MissingSchema], params)]];
|
|
61253
|
+
}
|
|
61254
|
+
if (isGlobalRelativeRef(ref)) {
|
|
61255
|
+
const schema = findSubSchemaInIds(data, ref);
|
|
61256
|
+
if (schema) {
|
|
61257
|
+
cache[ref] = schema;
|
|
61258
|
+
return [schema, []];
|
|
61259
|
+
}
|
|
61260
|
+
const params = [ref];
|
|
61261
|
+
return [{}, [createDiagnostic$1(SchemaDiagnosticSeverity.Error, void 0, getSchema(full), SchemaErrorCodes.MissingSchema, SchemaErrorMessages[SchemaErrorCodes.MissingSchema], params)]];
|
|
61262
|
+
}
|
|
61263
|
+
const params = [ref];
|
|
61264
|
+
return [{}, [createDiagnostic$1(SchemaDiagnosticSeverity.Error, void 0, getSchema(full), SchemaErrorCodes.UnknownSchemaRef, SchemaErrorMessages[SchemaErrorCodes.UnknownSchemaRef], params)]];
|
|
61265
|
+
}
|
|
61266
|
+
function findSubSchemaInSchema(full, path) {
|
|
61267
|
+
let find = full;
|
|
61268
|
+
for (let i = 0; i < path.length; i++) find = find ? find[path[i]] : void 0;
|
|
61269
|
+
return find;
|
|
61270
|
+
}
|
|
61271
|
+
function findSubSchemaInIds(data, ref) {
|
|
61272
|
+
return data.ids[ref];
|
|
61273
|
+
}
|
|
61274
|
+
function getSchema(full) {
|
|
61275
|
+
const schema = full.title || full.$id || full.$schema;
|
|
61276
|
+
return schema ? [schema] : [];
|
|
61277
|
+
}
|
|
61278
|
+
function isLocalRef(ref = "") {
|
|
61279
|
+
const refPath = ref.split("/");
|
|
61280
|
+
return ref && refPath[0] === "#" ? refPath.slice(1) : null;
|
|
61281
|
+
}
|
|
61282
|
+
function isGlobalRelativeRef(ref = "") {
|
|
61283
|
+
const refPath = ref.split("/");
|
|
61284
|
+
return ref && refPath[0] === "" ? refPath : null;
|
|
61285
|
+
}
|
|
61286
|
+
//#endregion
|
|
61287
|
+
//#region ../code-ast/esm/schema/mapper/validate.js
|
|
61288
|
+
var import_json_schema_draft_07 = /* @__PURE__ */ __toESM(require_json_schema_draft_07(), 1);
|
|
61289
|
+
const ajv = new import_ajv.Ajv();
|
|
61290
|
+
const schema07Validator = ajv.getSchema("http://json-schema.org/draft-07/schema") ?? ajv.compile(import_json_schema_draft_07.default);
|
|
61291
|
+
function validateJsonSchema(json) {
|
|
61292
|
+
const valid = schema07Validator(json);
|
|
61293
|
+
const diagnostics = [];
|
|
61294
|
+
if (!valid) for (const err of schema07Validator.errors) {
|
|
61295
|
+
const { instancePath, schemaPath, keyword, message, params } = err;
|
|
61296
|
+
const pars = [JSON.stringify(params)];
|
|
61297
|
+
diagnostics.push(createDiagnostic$1(SchemaDiagnosticSeverity.Error, void 0, [...instancePath ? [instancePath] : [], ...schemaPath ? [schemaPath] : []], keyword, `Json schema validator: ${message}`, pars));
|
|
61298
|
+
}
|
|
61299
|
+
return {
|
|
61300
|
+
json,
|
|
61301
|
+
diagnostics
|
|
61302
|
+
};
|
|
61303
|
+
}
|
|
61304
|
+
//#endregion
|
|
61313
61305
|
//#region ../code-ast/esm/schema/references/references.js
|
|
61314
61306
|
async function references$1(document, ast, createdSchema, { invalid = false, customTags = [], getReferences = () => Promise.resolve([]), ...restOptions }) {
|
|
61315
61307
|
const options = {
|
|
@@ -61348,6 +61340,13 @@ async function references(document, asts, createdSchema, options) {
|
|
|
61348
61340
|
return (await Promise.all(tasks)).reduce((prev, current) => [...prev, ...current], []);
|
|
61349
61341
|
}
|
|
61350
61342
|
//#endregion
|
|
61343
|
+
//#region ../code-ast/esm/schema/validator/index.js
|
|
61344
|
+
async function validate$1(document, asts, schema, options) {
|
|
61345
|
+
if (options.invalid) return createSchemaValidatorDiagnostics([]);
|
|
61346
|
+
const tasks = asts.map((node) => validate$2(document, node, node, [], schema, options));
|
|
61347
|
+
return mergeSchemaValidatorDiagnostics(...await Promise.all(tasks));
|
|
61348
|
+
}
|
|
61349
|
+
//#endregion
|
|
61351
61350
|
//#region ../code-ast/esm/schema/index.js
|
|
61352
61351
|
function createSchema(content) {
|
|
61353
61352
|
const validateResult = validateJsonSchema(content);
|
|
@@ -86184,7 +86183,7 @@ var merge = createAssigner(function(object, source, srcIndex) {
|
|
|
86184
86183
|
});
|
|
86185
86184
|
//#endregion
|
|
86186
86185
|
//#region ../../../sdk/libs/api-client-tiger/esm/__version.js
|
|
86187
|
-
const LIB_VERSION = "11.39.0-alpha.
|
|
86186
|
+
const LIB_VERSION = "11.39.0-alpha.2";
|
|
86188
86187
|
const LIB_NAME = "@gooddata/api-client-tiger";
|
|
86189
86188
|
//#endregion
|
|
86190
86189
|
//#region ../../../sdk/libs/api-client-tiger/esm/axios.js
|
|
@@ -193377,7 +193376,7 @@ async function get(state, opts) {
|
|
|
193377
193376
|
//#endregion
|
|
193378
193377
|
//#region ../code/package.json
|
|
193379
193378
|
var name = "@gooddata/code";
|
|
193380
|
-
var version = "0.35.0-alpha.
|
|
193379
|
+
var version = "0.35.0-alpha.2";
|
|
193381
193380
|
//#endregion
|
|
193382
193381
|
//#region ../code/esm/actions/initialize.js
|
|
193383
193382
|
async function initialize(state, emitter, options) {
|